@@ -440,24 +440,36 @@ export class IgxColumnComponent implements AfterContentInit {
440
440
@Input ( )
441
441
public maxWidth : string ;
442
442
443
+ /**
444
+ * @hidden
445
+ */
443
446
get maxWidthPx ( ) {
444
447
const gridAvailableSize = this . grid . calcWidth ;
445
448
const isPercentageWidth = this . maxWidth && typeof this . maxWidth === 'string' && this . maxWidth . indexOf ( '%' ) !== - 1 ;
446
449
return isPercentageWidth ? parseFloat ( this . maxWidth ) / 100 * gridAvailableSize : parseFloat ( this . maxWidth ) ;
447
450
}
448
451
452
+ /**
453
+ * @hidden
454
+ */
449
455
get maxWidthPercent ( ) {
450
456
const gridAvailableSize = this . grid . calcWidth ;
451
457
const isPercentageWidth = this . maxWidth && typeof this . maxWidth === 'string' && this . maxWidth . indexOf ( '%' ) !== - 1 ;
452
458
return isPercentageWidth ? parseFloat ( this . maxWidth ) : parseFloat ( this . maxWidth ) / gridAvailableSize * 100 ;
453
459
}
454
460
461
+ /**
462
+ * @hidden
463
+ */
455
464
get minWidthPx ( ) {
456
465
const gridAvailableSize = this . grid . calcWidth ;
457
466
const isPercentageWidth = this . minWidth && typeof this . minWidth === 'string' && this . minWidth . indexOf ( '%' ) !== - 1 ;
458
467
return isPercentageWidth ? parseFloat ( this . minWidth ) / 100 * gridAvailableSize : parseFloat ( this . minWidth ) ;
459
468
}
460
469
470
+ /**
471
+ * @hidden
472
+ */
461
473
get minWidthPercent ( ) {
462
474
const gridAvailableSize = this . grid . calcWidth ;
463
475
const isPercentageWidth = this . minWidth && typeof this . minWidth === 'string' && this . minWidth . indexOf ( '%' ) !== - 1 ;
@@ -1779,27 +1791,29 @@ export class IgxColumnComponent implements AfterContentInit {
1779
1791
*/
1780
1792
public autosize ( ) {
1781
1793
if ( ! this . columnGroup ) {
1782
- const size = this . getLargestCellWidth ( ) ;
1783
- const gridAvailableSize = this . grid . calcWidth ;
1784
- let newWidth ;
1785
- const isPercentageWidth = this . width && typeof this . width === 'string' && this . width . indexOf ( '%' ) !== - 1 ;
1786
- if ( isPercentageWidth ) {
1787
- const percentageSize = parseFloat ( size ) / gridAvailableSize * 100 ;
1788
- newWidth = percentageSize + '%' ;
1789
- } else {
1790
- newWidth = size ;
1791
- }
1792
- if ( this . maxWidth && ( parseFloat ( size ) > this . maxWidthPx ) ) {
1793
- newWidth = isPercentageWidth ? this . maxWidthPercent + '%' : this . maxWidthPx + 'px' ;
1794
- } else if ( parseFloat ( size ) < this . minWidthPx ) {
1795
- newWidth = isPercentageWidth ? this . minWidthPercent + '%' : this . minWidthPx + 'px' ;
1796
- }
1797
-
1798
- this . width = newWidth ;
1794
+ const size = this . getAutoSize ( ) ;
1795
+ this . width = size ;
1799
1796
this . grid . reflow ( ) ;
1800
1797
}
1801
1798
}
1802
1799
1800
+ /**
1801
+ * @hidden
1802
+ */
1803
+ public getAutoSize ( ) {
1804
+ const size = this . getLargestCellWidth ( ) ;
1805
+ const gridAvailableSize = this . grid . calcWidth ;
1806
+ let newWidth ;
1807
+ const isPercentageWidth = this . width && typeof this . width === 'string' && this . width . indexOf ( '%' ) !== - 1 ;
1808
+ if ( isPercentageWidth ) {
1809
+ const percentageSize = parseFloat ( size ) / gridAvailableSize * 100 ;
1810
+ newWidth = percentageSize + '%' ;
1811
+ } else {
1812
+ newWidth = size ;
1813
+ }
1814
+ return newWidth ;
1815
+ }
1816
+
1803
1817
/**
1804
1818
* @hidden
1805
1819
*/
@@ -1905,7 +1919,7 @@ export class IgxColumnComponent implements AfterContentInit {
1905
1919
const colWidth = this . width ;
1906
1920
const isPercentageWidth = colWidth && typeof colWidth === 'string' && colWidth . indexOf ( '%' ) !== - 1 ;
1907
1921
if ( isPercentageWidth ) {
1908
- this . _calcWidth = parseInt ( colWidth , 10 ) / 100 * grid . calcWidth ;
1922
+ this . _calcWidth = parseInt ( colWidth , 10 ) / 100 * ( grid . calcWidth - grid . featureColumnsWidth ( ) ) ;
1909
1923
} else if ( ! colWidth ) {
1910
1924
// no width
1911
1925
this . _calcWidth = this . defaultWidth || grid . getPossibleColumnWidth ( ) ;
0 commit comments