@@ -178,8 +178,8 @@ export class FlexDirective extends BaseFxDirective implements OnInit, OnChanges,
178
178
* Validate the value to be one of the acceptable value options
179
179
* Use default fallback of "row"
180
180
*/
181
- private _validateValue ( grow : number , shrink : number , basis : string | number | FlexBasisAlias ) {
182
- let css ;
181
+ private _validateValue ( grow : number | string , shrink : number | string , basis : string | number | FlexBasisAlias ) {
182
+ let css , isValue ;
183
183
let direction = ( this . _layout === 'column' ) || ( this . _layout == 'column-reverse' ) ?
184
184
'column' :
185
185
'row' ;
@@ -216,6 +216,7 @@ export class FlexDirective extends BaseFxDirective implements OnInit, OnChanges,
216
216
css = extendObject ( clearStyles , { 'flex' : '1 1 auto' } ) ;
217
217
break ;
218
218
case 'none' :
219
+ shrink = 0 ;
219
220
css = extendObject ( clearStyles , { 'flex' : '0 0 auto' } ) ;
220
221
break ;
221
222
case 'nogrow' :
@@ -225,16 +226,18 @@ export class FlexDirective extends BaseFxDirective implements OnInit, OnChanges,
225
226
css = extendObject ( clearStyles , { 'flex' : 'none' } ) ;
226
227
break ;
227
228
case 'noshrink' :
229
+ shrink = 0 ;
228
230
css = extendObject ( clearStyles , { 'flex' : '1 0 auto' } ) ;
229
231
break ;
230
232
231
233
default :
232
234
let isPercent = String ( basis ) . indexOf ( '%' ) > - 1 ;
233
- let isValue = String ( basis ) . indexOf ( 'px' ) > - 1 ||
234
- String ( basis ) . indexOf ( 'calc' ) > - 1 ||
235
- String ( basis ) . indexOf ( 'em' ) > - 1 ||
236
- String ( basis ) . indexOf ( 'vw' ) > - 1 ||
237
- String ( basis ) . indexOf ( 'vh' ) > - 1 ;
235
+
236
+ isValue = String ( basis ) . indexOf ( 'px' ) > - 1 ||
237
+ String ( basis ) . indexOf ( 'calc' ) > - 1 ||
238
+ String ( basis ) . indexOf ( 'em' ) > - 1 ||
239
+ String ( basis ) . indexOf ( 'vw' ) > - 1 ||
240
+ String ( basis ) . indexOf ( 'vh' ) > - 1 ;
238
241
239
242
// Defaults to percentage sizing unless `px` is explicitly set
240
243
if ( ! isValue && ! isPercent && ! isNaN ( basis as any ) )
@@ -253,9 +256,11 @@ export class FlexDirective extends BaseFxDirective implements OnInit, OnChanges,
253
256
254
257
let max = ( direction === 'row' ) ? 'max-width' : 'max-height' ;
255
258
let min = ( direction === 'row' ) ? 'min-width' : 'min-height' ;
259
+
256
260
let usingCalc = String ( basis ) . indexOf ( 'calc' ) > - 1 ;
261
+ let isPx = String ( basis ) . indexOf ( 'px' ) > - 1 || usingCalc ;
257
262
258
- css [ min ] = ( basis == '0%' ) ? 0 : null ;
263
+ css [ min ] = ( basis == '0%' ) ? 0 : isPx ? basis : null ;
259
264
css [ max ] = ( basis == '0%' ) ? 0 : usingCalc ? null : basis ;
260
265
261
266
return extendObject ( css , { 'box-sizing' : 'border-box' } ) ;
0 commit comments