Sha256: 4fbc1724f76ea50cbb12cc7f20edec6b7bcd94c9aecee9fd8e1f30801332ec40

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.calculateSpanningCellWidth = void 0;
const utils_1 = require("./utils");
const calculateSpanningCellWidth = (rangeConfig, dependencies) => {
    const { columnsConfig, drawVerticalLine } = dependencies;
    const { topLeft, bottomRight } = rangeConfig;
    const totalWidth = (0, utils_1.sumArray)(columnsConfig.slice(topLeft.col, bottomRight.col + 1).map(({ width }) => {
        return width;
    }));
    const totalPadding = topLeft.col === bottomRight.col ?
        columnsConfig[topLeft.col].paddingRight +
            columnsConfig[bottomRight.col].paddingLeft :
        (0, utils_1.sumArray)(columnsConfig
            .slice(topLeft.col, bottomRight.col + 1)
            .map(({ paddingLeft, paddingRight }) => {
            return paddingLeft + paddingRight;
        }));
    const totalBorderWidths = bottomRight.col - topLeft.col;
    const totalHiddenVerticalBorders = (0, utils_1.sequence)(topLeft.col + 1, bottomRight.col).filter((verticalBorderIndex) => {
        return !drawVerticalLine(verticalBorderIndex, columnsConfig.length);
    }).length;
    return totalWidth + totalPadding + totalBorderWidths - totalHiddenVerticalBorders;
};
exports.calculateSpanningCellWidth = calculateSpanningCellWidth;
//# sourceMappingURL=calculateSpanningCellWidth.js.map

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trusty-cms-6.3.1 node_modules/table/dist/src/calculateSpanningCellWidth.js