⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.45
Server IP:
185.238.29.86
Server:
Linux server2 6.8.12-6-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-6 (2024-12-19T19:05Z) x86_64
Server Software:
nginx/1.18.0
PHP Version:
8.1.31
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
www
/
invoice
/
node_modules
/
table
/
dist
/
src
/
View File Name :
validateSpanningCellConfig.js
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.validateSpanningCellConfig = void 0; const utils_1 = require("./utils"); const inRange = (start, end, value) => { return start <= value && value <= end; }; const validateSpanningCellConfig = (rows, configs) => { const [nRow, nCol] = [rows.length, rows[0].length]; configs.forEach((config, configIndex) => { const { colSpan, rowSpan } = config; if (colSpan === undefined && rowSpan === undefined) { throw new Error(`Expect at least colSpan or rowSpan is provided in config.spanningCells[${configIndex}]`); } if (colSpan !== undefined && colSpan < 1) { throw new Error(`Expect colSpan is not equal zero, instead got: ${colSpan} in config.spanningCells[${configIndex}]`); } if (rowSpan !== undefined && rowSpan < 1) { throw new Error(`Expect rowSpan is not equal zero, instead got: ${rowSpan} in config.spanningCells[${configIndex}]`); } }); const rangeCoordinates = configs.map(utils_1.calculateRangeCoordinate); rangeCoordinates.forEach(({ topLeft, bottomRight }, rangeIndex) => { if (!inRange(0, nCol - 1, topLeft.col) || !inRange(0, nRow - 1, topLeft.row) || !inRange(0, nCol - 1, bottomRight.col) || !inRange(0, nRow - 1, bottomRight.row)) { throw new Error(`Some cells in config.spanningCells[${rangeIndex}] are out of the table`); } }); const configOccupy = Array.from({ length: nRow }, () => { return Array.from({ length: nCol }); }); rangeCoordinates.forEach(({ topLeft, bottomRight }, rangeIndex) => { (0, utils_1.sequence)(topLeft.row, bottomRight.row).forEach((row) => { (0, utils_1.sequence)(topLeft.col, bottomRight.col).forEach((col) => { if (configOccupy[row][col] !== undefined) { throw new Error(`Spanning cells in config.spanningCells[${configOccupy[row][col]}] and config.spanningCells[${rangeIndex}] are overlap each other`); } configOccupy[row][col] = rangeIndex; }); }); }); }; exports.validateSpanningCellConfig = validateSpanningCellConfig; //# sourceMappingURL=validateSpanningCellConfig.js.map