-
Notifications
You must be signed in to change notification settings - Fork 772
poll: what should be the default behavior for fxFlex? #689
Comments
Option 1) The
|
Option 2) The same as option 1, but |
Option 3) The same as option 1, but the
|
Option 4) The same as the current default, but the min-width/height and max-width/height can be specified at the end of the fxFlex declaration as follows:
|
Option 5) The same as option 3 but the default min/max is |
Update: once beta.14 gets released, I'll close out the results of this poll and start working on the implementation. Then we'll take comments on the PR before it gets merged. |
Talked about this offline with @ThomasBurleson and here's our consensus:
Hope that helps, and as always feel free to post any comments/concerns below. |
Hi, so the beta.14 is out, after I tried it, my flex-layout seems to be a bit broken..
what breaks? the toolbar shrink caused by the long item list below it. so with beta.14 I have to add UPDATE 25 April 2018 : stackblitz link |
Can you encapsulate this in a StackBlitz demo on a separate issue? It might be a bug introduced by the flex basis changes made in beta.14 |
Sure, will do it soon.. I thought this is by design. |
I've also attempted an upgrade to beta.14 and it broke most of my app. The app itself is a full screen experience with custom scrolling, so often I'm using fxFlex to fill the remaining space of parent components, whether they be row or column layouts. This app is ported from Angular 1 material, where I was originally using After this upgrade, I think most of my issues stem from I've also had somewhat of a hack in place that set's *[fxlayout],
*[fxlayout='row'],
.layout-row,
*[style*='display: flex'][style*='flex-direction: row'] {
> *[fxflex],
> .flex,
> ui-view,
> *[style*='flex: 1 1 1e-09px'] {
min-width: 0;
}
} I feel like this is about to be the 3rd time I've been burned by these layout changes. Can you please advise on what fxFlex/fxLayout should do in terms of a full screen app and filling vertical space to accommodate custom scrolling? And how should components interact outside their own template and within their own template? |
@mtraynham Flex styles are no longer implicitly applied from import {ADD_FLEX_STYLES} from '@angular/flex-layout';
{provide: ADD_FLEX_STYLES, useValue: true} My best guess at a fullscreen app filling vertical space would be something like this: styles.css html, body {
height: 100%;
width: 100%;
} app.component.html <div fxLayout="column" fxFill>
<div fxFlex>
<router-outlet></router-outlet>
</div>
</div> |
Also, we no longer use the 1e-9px hack, we instead set the flex-basis to 0% in row mode and auto for column mode. |
So |
It's a workaround for column layouts in IE and Safari as documented by FlexBugs. |
Alright @CaerusKaru, I have my app back in it's original state... For some reason *[fxlayout='column'] > *[fxFlex] {
flex-basis: 0.000000001px !important;
} |
@mtraynham Can you put what you're seeing in a StackBlitz, where the child |
Is there a recommended way to get the Beta 13 behavior back in Beta 14? I'm not doing anything flex-related directly in CSS, but Beta 14 still breaks my existing layouts in a lot of weird ways that don't seem easy to work around. Edit: Didn't notice all the new messages since I last opened this thread. It sounds like |
It depends on what's different in your layouts. As mentioned above, the only stark change you should see is that
|
Thanks! I'll try that out. |
I am also seeing the same as @mtraynham in that I have fxLayout="column" and using fxFlex now doesn't adjust the content to fit the remaining space (On FireFox and Edge). In these cases there are fixed header and footer elements and the content using fxFlex is longer than the remaining space. So the aim is for that content to be placed into the gap and have a scrollbar. I'll try and create a StackBlitz showing it |
Here it is https://stackblitz.com/edit/angular-xmaew3 The issue only happens with a bit of nesting, which is generally what you get anyway when using |
@mrjpeterj This is probably something we can consider. My memory was that we made the change because it affected row/columns in Safari or IE11, but it looks like |
@CaerusKaru Here is the stackblitz : Please tell me if I did it the wrong way... |
@CaerusKaru, I just tested out the Luckily stacking that with @mtraynham's flex-basis trick seems to do the job for now. |
I've been thinking a lot more about this since I read #825. How about adding to the {
defaults: {
fxFlex: '1',
},
styleBuilders: {
flex: (val: string) => {},
flexGap: (val: string) => {},
}
} |
I've encapsulated the style builders from the above comment into #884. This allows you to provide a custom override implementation, e.g. for |
This change decouples the style-generation from the actual directives, meaning that the library is now composed of the following: * Directives that respond to inputs and `matchMedia` events * Style generation providers that return styles when triggered by directives This allows for end-users or library authors to provide their own unique style generation (even by borrowing or extending our existing library code) for any directive. This is entirely non-mandatory for use of the `BaseDirective`, since the `BaseDirective` need not always use a de-coupled style provider to function. The canonical example is the following: ```ts @Injectable() export class CustomStyleBuilder extends StyleBuilder { buildStyles(input: string) { return { 'style1': 'value1', }; } } @NgModule({ ... providers: [ provide: <the style builder to orverride, e.g. FlexStyleBuilder>, useClass: CustomStyleBuilder, ], }) export class MyAppModule {} ``` Fixes #689
StyleBuilders are documented on the Wiki here: https://github.com/angular/flex-layout/wiki/Style-Builders. Otherwise, docs PRs are welcome. |
It's still not clear how to disable max-width and min-width together. Looking at the code, they seem to be coming up when there is a wrap element as the parent. It still doesn't make sense that the min and max should be set together to the third value of fxFlex... I don't think that extending with a styleBuilder is appropriate. My work-around is to revert to css as there seems to be little benefit to |
@ronniebarker I'm still confused too :-( Flex-Layout works for me very well nearly every time, but I kind of want to be able to do this with my current situation:
Would this micro-syntax be easy for me to implement with a style builder? I think most people finding this question have just ONE thing they need to prevent a style for - and the thought of learning about style builders is just too much work. Of course I could revert to |
For the record, I'm not opposed to providing some "prebuilt" |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This issue tracks the possibility of changing the default behavior for the
fxFlex
directive. Currently, the behavior is as follows:fxFlex
flex-basis
value and results inflex: 1 1 <input>
withmin-width
andmax-width
applied (assuming row format)flex
property, withmin/max-width
applied according to the algorithm specified hereI'll list some alternative options for
fxFlex
behavior below, please vote for your preferred option, or feel free to add your own. If you like the current behavior, please do not add comments, but simply vote for this comment.The text was updated successfully, but these errors were encountered: