Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

layout-margin / layout-padding and flex="?" #5014

Closed
tinusn opened this issue Oct 5, 2015 · 6 comments
Closed

layout-margin / layout-padding and flex="?" #5014

tinusn opened this issue Oct 5, 2015 · 6 comments
Assignees
Milestone

Comments

@tinusn
Copy link

tinusn commented Oct 5, 2015

In release 0.10.x adding layout-margin and layout-padding to a parent container and then adding flex="?" to a child works as expected, but in 0.11.2 it does not.

Here is a codepen demonstrated the issue:

0.10.1
0.11.2 (not, this one does not work at all... dunno why)

And here is a codepen with just flex, that works in 0.11.2
0.11.2 - flex

The issue seems to be that the new class based approach does not add "flex" to the class list and is thus not hit by the following:

.layout-margin, .layout-margin > .flex, .layout-margin > .flex-gt-sm, .layout-margin > .flex-md, .layout-margin > .flex-lt-lg {
  margin: 8px; }

In 0.10.1:

<div layout="row" layout-margin>

becomes

<div layout="row" class="layout layout-row layout-margin">

whereas in 0.11.2 it becomes:

<div class="md-layout-row layout-margin">
@tinusn tinusn changed the title layout-margin / layout-paddind and flex="?" layout-margin / layout-padding and flex="?" Oct 5, 2015
@panzershreck
Copy link

+1

@mattiLeBlanc
Copy link

probably related: Flex turns into class="flex-flex"

#5044

@Sebastien-Meiffren
Copy link

+1
my workaround is to add the css class flex to the flexed element

@ThomasBurleson
Copy link
Contributor

@tinusn - Here is a CodePen that shows the working v0.11.2 Layout features: http://codepen.io/ThomasBurleson/pen/RWgqom

<div ng-app="demoApp" layout="column" layout-fill>
  <div layout="row" layout-margin flex>
    <div class="one" flex="20"> test1 </div>
    <div class="two" flex="80"> test2 </div>
  </div>
  <div layout="row" layout-padding flex >
    <div class="one" flex="20"> test1 </div>
    <div class="two" flex="80"> test2 </div>
  </div>
</div>

You need to create the ng-app (so the ngMaterial Layout directives run) and you need layout-fill:

ThomasBurleson added a commit that referenced this issue Oct 9, 2015
* improved consistent use of `attrs.$observe( )` to watch for interpolated attribute values (for Layout attributes which support value specifiers).
* add validation of Layout attribute values with fallbacks to default value approprate to each attribute type
* significant code cleanup for use of `$observe( )`
* removed possible classname generation with raw, uninterpolated strings
* removed multiple classname generation
* fixed invalid classname generation when interpolation values are invalid
* remove `md-` prefix from layout class names
* remove all attribute selectors from layout.scss
* deprecated use of `offset` attribute; now uses `layout-offset`
* add box-sizing to all flex variants
* add max-width/height to flex variants
* fixed max-width/height for flex 33, 34, 66, and 67 variants.
* complete refactor for spec testing of Layouts

Fixes #5076. Fixes #5054. Refs #5014. Fixes #4994. Fixes #4959. Fixes #4902. Fixes #2954. Fixes #5014.
ThomasBurleson added a commit that referenced this issue Oct 10, 2015
* improved consistent use of `attrs.$observe( )` to watch for interpolated attribute values (for Layout attributes which support value specifiers).
* add validation of Layout attribute values with fallbacks to default value approprate to each attribute type
* significant code cleanup for use of `$observe( )`
* removed possible classname generation with raw, uninterpolated strings
* removed multiple classname generation
* fixed invalid classname generation when interpolation values are invalid
* remove `md-` prefix from layout class names
* remove all attribute selectors from layout.scss
* deprecated use of `offset` attribute; now uses `layout-offset`
* add box-sizing to all flex variants
* add max-width/height to flex variants
* fixed max-width/height for flex 33, 34, 66, and 67 variants.
* complete refactor for spec testing of Layouts

Fixes #5076. Fixes #5054. Refs #5014. Fixes #4994. Fixes #4959. Fixes #4902. Fixes #2954. Fixes #5014.
Closes #5090.
@tinusn
Copy link
Author

tinusn commented Oct 11, 2015

@ThomasBurleson The pen you have made still does not work?

Here is what I would expect (or at least, that is how it worked in 0.10.x):
image

But the pen you have made gives this:
image
Notice that there is no margin between the two first children, and no padding on the next two children.

I fixed the two pens in the beginning, so now the layout row/column works, but layout-padding and layout-margin still does not work. Finally I added a pen that shows that it works with just flex.

@rigobcastro
Copy link

In 0.11.1 it's works. In current version 0.11.2 you need add .flex class manually.

<div layout="row" layout-padding>
    <div class="flex" flex="20"></div>
    <div class="flex" flex="80"></div>
</div>

Pen: http://codepen.io/rigobcastro/pen/LpjNqe

@angular angular locked and limited conversation to collaborators Oct 12, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants