@@ -524,8 +524,14 @@ export class IgxColumnComponent implements AfterContentInit, OnDestroy, ColumnTy
524524 */
525525 @WatchColumnChanges ( )
526526 @Input ( )
527- public maxWidth : string ;
527+ public set maxWidth ( value : string ) {
528+ this . _maxWidth = value ;
528529
530+ this . grid . notifyChanges ( true ) ;
531+ }
532+ public get maxWidth ( ) : string {
533+ return this . _maxWidth ;
534+ }
529535 /**
530536 * Sets/gets the class selector of the column header.
531537 * ```typescript
@@ -938,6 +944,15 @@ export class IgxColumnComponent implements AfterContentInit, OnDestroy, ColumnTy
938944 return isPercentageWidth ? parseFloat ( this . minWidth ) / 100 * gridAvailableSize : parseFloat ( this . minWidth ) ;
939945 }
940946
947+ /**
948+ * @hidden
949+ */
950+ public get userSetMinWidthPx ( ) {
951+ const gridAvailableSize = this . grid . calcWidth ;
952+ const isPercentageWidth = this . _defaultMinWidth && typeof this . _defaultMinWidth === 'string' && this . _defaultMinWidth . indexOf ( '%' ) !== - 1 ;
953+ return isPercentageWidth ? parseFloat ( this . _defaultMinWidth ) / 100 * gridAvailableSize : parseFloat ( this . _defaultMinWidth ) ;
954+ }
955+
941956 /**
942957 * @hidden
943958 */
@@ -969,7 +984,7 @@ export class IgxColumnComponent implements AfterContentInit, OnDestroy, ColumnTy
969984 return ;
970985 }
971986 this . _defaultMinWidth = value ;
972-
987+ this . grid . notifyChanges ( true ) ;
973988 }
974989 public get minWidth ( ) : string {
975990 return ! this . _defaultMinWidth ? this . defaultMinWidth : this . _defaultMinWidth ;
@@ -1737,6 +1752,11 @@ export class IgxColumnComponent implements AfterContentInit, OnDestroy, ColumnTy
17371752 */
17381753 public destroy$ = new Subject < any > ( ) ;
17391754
1755+ /**
1756+ * @hidden
1757+ */
1758+ public widthConstrained = false ;
1759+
17401760 /**
17411761 * @hidden
17421762 */
@@ -1811,6 +1831,10 @@ export class IgxColumnComponent implements AfterContentInit, OnDestroy, ColumnTy
18111831 * @hidden
18121832 */
18131833 protected _defaultMinWidth = '' ;
1834+ /**
1835+ * @hidden
1836+ */
1837+ protected _maxWidth ;
18141838 /**
18151839 * @hidden
18161840 */
@@ -2096,7 +2120,8 @@ export class IgxColumnComponent implements AfterContentInit, OnDestroy, ColumnTy
20962120 if ( size && ! ! size . width ) {
20972121 result . push ( size . width + 'px' ) ;
20982122 } else {
2099- result . push ( parseFloat ( this . grid . getPossibleColumnWidth ( ) ) + 'px' ) ;
2123+ const currentWidth = parseFloat ( this . grid . getPossibleColumnWidth ( ) ) ;
2124+ result . push ( ( this . getConstrainedSizePx ( currentWidth ) ) + 'px' ) ;
21002125 }
21012126 }
21022127 return result ;
@@ -2558,6 +2583,23 @@ export class IgxColumnComponent implements AfterContentInit, OnDestroy, ColumnTy
25582583 return res . join ( ' ' ) ;
25592584 }
25602585
2586+ /**
2587+ * @hidden
2588+ * @internal
2589+ */
2590+ public getConstrainedSizePx ( newSize ) {
2591+ if ( this . maxWidth && newSize > this . maxWidthPx ) {
2592+ this . widthConstrained = true ;
2593+ return this . maxWidthPx ;
2594+ } else if ( this . minWidth && newSize < this . userSetMinWidthPx ) {
2595+ this . widthConstrained = true ;
2596+ return this . userSetMinWidthPx ;
2597+ } else {
2598+ this . widthConstrained = false ;
2599+ return newSize ;
2600+ }
2601+ }
2602+
25612603 /**
25622604 * @hidden
25632605 * @internal
@@ -2567,14 +2609,17 @@ export class IgxColumnComponent implements AfterContentInit, OnDestroy, ColumnTy
25672609 const isPercentageWidth = colWidth && typeof colWidth === 'string' && colWidth . indexOf ( '%' ) !== - 1 ;
25682610 const isAutoWidth = colWidth && typeof colWidth === 'string' && colWidth === 'fit-content' ;
25692611 if ( isPercentageWidth && this . grid . isColumnWidthSum ) {
2570- this . _calcWidth = this . grid . minColumnWidth ;
2612+ this . _calcWidth = this . userSetMinWidthPx ? this . userSetMinWidthPx : this . grid . minColumnWidth ;
25712613 } else if ( isPercentageWidth ) {
2572- this . _calcWidth = parseFloat ( colWidth ) / 100 * this . grid . calcWidth ;
2614+ const currentCalcWidth = parseFloat ( colWidth ) / 100 * this . grid . calcWidth ;
2615+ this . _calcWidth = this . grid . calcWidth ? this . getConstrainedSizePx ( currentCalcWidth ) : 0 ;
25732616 } else if ( ! colWidth || isAutoWidth && ! this . autoSize ) {
25742617 // no width
2575- this . _calcWidth = this . defaultWidth || this . grid . getPossibleColumnWidth ( ) ;
2618+ const currentCalcWidth = this . defaultWidth || this . grid . getPossibleColumnWidth ( ) ;
2619+ this . _calcWidth = this . getConstrainedSizePx ( currentCalcWidth ) ;
25762620 } else {
2577- this . _calcWidth = this . width ;
2621+ const currentCalcWidth = parseFloat ( this . width ) ;
2622+ this . _calcWidth = this . getConstrainedSizePx ( currentCalcWidth ) ;
25782623 }
25792624 this . calcPixelWidth = parseFloat ( this . _calcWidth ) ;
25802625 }
0 commit comments