3 Object.defineProperty(exports, "__esModule", {
6 exports.default = void 0;
8 var _isBooleanObject = _interopRequireDefault(require("is-boolean-object"));
10 var _isNumberObject = _interopRequireDefault(require("is-number-object"));
12 var _calculateCellHeight = _interopRequireDefault(require("./calculateCellHeight"));
14 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17 * Calculates the vertical row span index.
19 * @param {Array[]} rows
20 * @param {object} config
23 const calculateRowHeightIndex = (rows, config) => {
24 const tableWidth = rows[0].length;
25 const rowSpanIndex = [];
26 rows.forEach(cells => {
27 const cellHeightIndex = new Array(tableWidth).fill(1);
28 cells.forEach((value, index1) => {
29 if (!(0, _isNumberObject.default)(config.columns[index1].width)) {
30 throw new TypeError('column[index].width must be a number.');
33 if (!(0, _isBooleanObject.default)(config.columns[index1].wrapWord)) {
34 throw new TypeError('column[index].wrapWord must be a boolean.');
37 cellHeightIndex[index1] = (0, _calculateCellHeight.default)(value, config.columns[index1].width, config.columns[index1].wrapWord);
39 rowSpanIndex.push(Math.max(...cellHeightIndex));
44 var _default = calculateRowHeightIndex;
45 exports.default = _default;
46 //# sourceMappingURL=calculateRowHeightIndex.js.map