calculateRowHeights.js 735 B

123456789101112131415161718
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.calculateRowHeights = void 0;
  4. const calculateCellHeight_1 = require("./calculateCellHeight");
  5. /**
  6. * Produces an array of values that describe the largest value length (height) in every row.
  7. */
  8. const calculateRowHeights = (rows, config) => {
  9. return rows.map((row) => {
  10. let rowHeight = 1;
  11. row.forEach((cell, cellIndex) => {
  12. const cellHeight = calculateCellHeight_1.calculateCellHeight(cell, config.columns[cellIndex].width, config.columns[cellIndex].wrapWord);
  13. rowHeight = Math.max(rowHeight, cellHeight);
  14. });
  15. return rowHeight;
  16. });
  17. };
  18. exports.calculateRowHeights = calculateRowHeights;