release/utils/math.js
function scaleColumns(colsByGroup, maxWidth, totalFlexGrow) {
    // calculate total width and flexgrow points for coulumns that can be resized
    for (var attr in colsByGroup) {
        for (var _i = 0, _a = colsByGroup[attr]; _i < _a.length; _i++) {
            var column = _a[_i];
            if (!column.canAutoResize) {
                maxWidth -= column.width;
                totalFlexGrow -= column.flexGrow ? column.flexGrow : 0;
            }
            else {
                column.width = 0;
            }
        }
    }
    var hasMinWidth = {};
    var remainingWidth = maxWidth;
    // resize columns until no width is left to be distributed
    do {
        var widthPerFlexPoint = remainingWidth / totalFlexGrow;
        remainingWidth = 0;
        for (var attr in colsByGroup) {
            for (var _b = 0, _c = colsByGroup[attr]; _b < _c.length; _b++) {
                var column = _c[_b];
                // if the column can be resize and it hasn't reached its minimum width yet
                if (column.canAutoResize && !hasMinWidth[column.prop]) {
                    var newWidth = column.width + column.flexGrow * widthPerFlexPoint;
                    if (column.minWidth !== undefined && newWidth < column.minWidth) {
                        remainingWidth += newWidth - column.minWidth;
                        column.width = column.minWidth;
                        hasMinWidth[column.prop] = true;
                    }
                    else {
                        column.width = newWidth;
                    }
                }
            }
        }
    } while (remainingWidth !== 0);
}
function scaleColumns(colsByGroup, maxWidth, totalFlexGrow) {
    // calculate total width and flexgrow points for coulumns that can be resized
    for (var attr in colsByGroup) {
        for (var _i = 0, _a = colsByGroup[attr]; _i < _a.length; _i++) {
            var column = _a[_i];
            if (!column.canAutoResize) {
                maxWidth -= column.width;
                totalFlexGrow -= column.flexGrow ? column.flexGrow : 0;
            }
            else {
                column.width = 0;
            }
        }
    }
    var hasMinWidth = {};
    var remainingWidth = maxWidth;
    // resize columns until no width is left to be distributed
    do {
        var widthPerFlexPoint = remainingWidth / totalFlexGrow;
        remainingWidth = 0;
        for (var attr in colsByGroup) {
            for (var _b = 0, _c = colsByGroup[attr]; _b < _c.length; _b++) {
                var column = _c[_b];
                // if the column can be resize and it hasn't reached its minimum width yet
                if (column.canAutoResize && !hasMinWidth[column.prop]) {
                    var newWidth = column.width + column.flexGrow * widthPerFlexPoint;
                    if (column.minWidth !== undefined && newWidth < column.minWidth) {
                        remainingWidth += newWidth - column.minWidth;
                        column.width = column.minWidth;
                        hasMinWidth[column.prop] = true;
                    }
                    else {
                        column.width = newWidth;
                    }
                }
            }
        }
    } while (remainingWidth !== 0);
}
function scaleColumns ( colsByGroup , maxWidth , totalFlexGrow ) { // calculate total width and flexgrow points for coulumns that can be resized for ( var attr in colsByGroup ) { for ( var _i = 0 , _a = colsByGroup [ attr ] ; _i < _a . length ; _i ++ ) { var column = _a [ _i ] ; if ( ! column . canAutoResize ) { maxWidth -= column . width ; totalFlexGrow -= column . flexGrow ? column . flexGrow : 0 ; } else { column . width = 0 ; } } } var hasMinWidth = { } ; var remainingWidth = maxWidth ; // resize columns until no width is left to be distributed do { var widthPerFlexPoint = remainingWidth / totalFlexGrow ; remainingWidth = 0 ; for ( var attr in colsByGroup ) { for ( var _b = 0 , _c = colsByGroup [ attr ] ; _b < _c . length ; _b ++ ) { var column = _c [ _b ] ; // if the column can be resize and it hasn't reached its minimum width yet if ( column . canAutoResize && ! hasMinWidth [ column . prop ] ) { var newWidth = column . width + column . flexGrow * widthPerFlexPoint ; if ( column . minWidth !== undefined && newWidth < column . minWidth ) { remainingWidth += newWidth - column . minWidth ; column . width = column . minWidth ; hasMinWidth [ column . prop ] = true ; } else { column . width = newWidth ; } } } } } while ( remainingWidth !== 0 ) ; }
Resizes columns based on the flexGrow property, while respecting manually set widths
Resizes columns based on the flexGrow property while respecting manually set widths