@@ -440,24 +440,36 @@ export class IgxColumnComponent implements AfterContentInit {
440440 @Input ( )
441441 public maxWidth : string ;
442442
443+ /**
444+ * @hidden
445+ */
443446 get maxWidthPx ( ) {
444447 const gridAvailableSize = this . grid . calcWidth ;
445448 const isPercentageWidth = this . maxWidth && typeof this . maxWidth === 'string' && this . maxWidth . indexOf ( '%' ) !== - 1 ;
446449 return isPercentageWidth ? parseFloat ( this . maxWidth ) / 100 * gridAvailableSize : parseFloat ( this . maxWidth ) ;
447450 }
448451
452+ /**
453+ * @hidden
454+ */
449455 get maxWidthPercent ( ) {
450456 const gridAvailableSize = this . grid . calcWidth ;
451457 const isPercentageWidth = this . maxWidth && typeof this . maxWidth === 'string' && this . maxWidth . indexOf ( '%' ) !== - 1 ;
452458 return isPercentageWidth ? parseFloat ( this . maxWidth ) : parseFloat ( this . maxWidth ) / gridAvailableSize * 100 ;
453459 }
454460
461+ /**
462+ * @hidden
463+ */
455464 get minWidthPx ( ) {
456465 const gridAvailableSize = this . grid . calcWidth ;
457466 const isPercentageWidth = this . minWidth && typeof this . minWidth === 'string' && this . minWidth . indexOf ( '%' ) !== - 1 ;
458467 return isPercentageWidth ? parseFloat ( this . minWidth ) / 100 * gridAvailableSize : parseFloat ( this . minWidth ) ;
459468 }
460469
470+ /**
471+ * @hidden
472+ */
461473 get minWidthPercent ( ) {
462474 const gridAvailableSize = this . grid . calcWidth ;
463475 const isPercentageWidth = this . minWidth && typeof this . minWidth === 'string' && this . minWidth . indexOf ( '%' ) !== - 1 ;
@@ -1779,27 +1791,29 @@ export class IgxColumnComponent implements AfterContentInit {
17791791 */
17801792 public autosize ( ) {
17811793 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 ;
17991796 this . grid . reflow ( ) ;
18001797 }
18011798 }
18021799
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+
18031817 /**
18041818 * @hidden
18051819 */
@@ -1905,7 +1919,7 @@ export class IgxColumnComponent implements AfterContentInit {
19051919 const colWidth = this . width ;
19061920 const isPercentageWidth = colWidth && typeof colWidth === 'string' && colWidth . indexOf ( '%' ) !== - 1 ;
19071921 if ( isPercentageWidth ) {
1908- this . _calcWidth = parseInt ( colWidth , 10 ) / 100 * grid . calcWidth ;
1922+ this . _calcWidth = parseInt ( colWidth , 10 ) / 100 * ( grid . calcWidth - grid . featureColumnsWidth ( ) ) ;
19091923 } else if ( ! colWidth ) {
19101924 // no width
19111925 this . _calcWidth = this . defaultWidth || grid . getPossibleColumnWidth ( ) ;
0 commit comments