padTableData.js 973 B

1234567891011121314151617181920212223
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.padTableData = exports.padString = void 0;
  4. const padString = (input, paddingLeft, paddingRight) => {
  5. return ' '.repeat(paddingLeft) + input + ' '.repeat(paddingRight);
  6. };
  7. exports.padString = padString;
  8. const padTableData = (rows, config) => {
  9. return rows.map((cells, rowIndex) => {
  10. return cells.map((cell, cellIndex) => {
  11. var _a;
  12. const containingRange = (_a = config.spanningCellManager) === null || _a === void 0 ? void 0 : _a.getContainingRange({ col: cellIndex,
  13. row: rowIndex }, { mapped: true });
  14. if (containingRange) {
  15. return cell;
  16. }
  17. const { paddingLeft, paddingRight } = config.columns[cellIndex];
  18. return (0, exports.padString)(cell, paddingLeft, paddingRight);
  19. });
  20. });
  21. };
  22. exports.padTableData = padTableData;
  23. //# sourceMappingURL=padTableData.js.map