1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = void 0;
|
7 |
|
8 | var _lodash = _interopRequireDefault(require("lodash"));
|
9 |
|
10 | var _calculateCellHeight = _interopRequireDefault(require("./calculateCellHeight"));
|
11 |
|
12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | const calculateRowHeightIndex = (rows, config) => {
|
22 | const tableWidth = rows[0].length;
|
23 | const rowSpanIndex = [];
|
24 | rows.forEach(cells => {
|
25 | const cellHeightIndex = new Array(tableWidth).fill(1);
|
26 | cells.forEach((value, index1) => {
|
27 | if (!_lodash.default.isNumber(config.columns[index1].width)) {
|
28 | throw new TypeError('column[index].width must be a number.');
|
29 | }
|
30 |
|
31 | if (!_lodash.default.isBoolean(config.columns[index1].wrapWord)) {
|
32 | throw new TypeError('column[index].wrapWord must be a boolean.');
|
33 | }
|
34 |
|
35 | cellHeightIndex[index1] = (0, _calculateCellHeight.default)(value, config.columns[index1].width, config.columns[index1].wrapWord);
|
36 | });
|
37 | rowSpanIndex.push(_lodash.default.max(cellHeightIndex));
|
38 | });
|
39 | return rowSpanIndex;
|
40 | };
|
41 |
|
42 | var _default = calculateRowHeightIndex;
|
43 | exports.default = _default;
|
44 |
|
\ | No newline at end of file |