3 Object.defineProperty(exports, "__esModule", {
7 var _lodash = require('lodash');
9 var _lodash2 = _interopRequireDefault(_lodash);
11 var _calculateCellHeight = require('./calculateCellHeight');
13 var _calculateCellHeight2 = _interopRequireDefault(_calculateCellHeight);
15 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18 * Calculates the vertical row span index.
20 * @param {Array[]} rows
21 * @param {Object} config
24 exports.default = (rows, config) => {
25 const tableWidth = rows[0].length;
27 const rowSpanIndex = [];
29 rows.forEach(cells => {
30 const cellHeightIndex = Array(tableWidth).fill(1);
32 cells.forEach((value, index1) => {
33 if (!_lodash2.default.isNumber(config.columns[index1].width)) {
34 throw new TypeError('column[index].width must be a number.');
37 if (!_lodash2.default.isBoolean(config.columns[index1].wrapWord)) {
38 throw new TypeError('column[index].wrapWord must be a boolean.');
41 cellHeightIndex[index1] = (0, _calculateCellHeight2.default)(value, config.columns[index1].width, config.columns[index1].wrapWord);
44 rowSpanIndex.push(_lodash2.default.max(cellHeightIndex));