juxscript 1.1.200 → 1.1.202
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabularDriver.d.ts","sourceRoot":"","sources":["TabularDriver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,WAAW,WAAW;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,YAAY;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,qBAAa,aAAa;IACtB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,GA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AG,OAAO,CAAC,IAAI,CAAC;IAYjC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAgB5B;;OAEG;IACG,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,SAAS,CAAC;IA0ExE;;;OAGG;IACG,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAmItG,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,UAAU;IAmClB,OAAO,CAAC,SAAS;IAYjB,KAAK,IAAI,IAAI;CAMhB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,aAAa,CAEhF"}
|
|
@@ -520,59 +520,67 @@ export class TabularDriver {
|
|
|
520
520
|
continue;
|
|
521
521
|
}
|
|
522
522
|
const range = XLSX.utils.decode_range(ref);
|
|
523
|
-
const
|
|
524
|
-
|
|
523
|
+
const startRow = range.s.r; // first row index
|
|
524
|
+
const endRow = range.e.r; // last row index
|
|
525
|
+
const startCol = range.s.c; // first col index
|
|
526
|
+
const endCol = range.e.c; // last col index
|
|
527
|
+
const numCols = endCol - startCol + 1;
|
|
528
|
+
if (endRow < startRow) {
|
|
525
529
|
processedSheets++;
|
|
526
530
|
continue;
|
|
527
531
|
}
|
|
528
|
-
//
|
|
529
|
-
const
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
532
|
+
// Helper: read a single cell value from the worksheet
|
|
533
|
+
const getCellValue = (r, c) => {
|
|
534
|
+
const cellAddress = XLSX.utils.encode_cell({ r, c });
|
|
535
|
+
const cell = worksheet[cellAddress];
|
|
536
|
+
if (!cell)
|
|
537
|
+
return null;
|
|
538
|
+
// Use formatted value (v = raw, w = formatted text)
|
|
539
|
+
return cell.v !== undefined ? cell.v : null;
|
|
540
|
+
};
|
|
541
|
+
// Helper: read an entire row as an array
|
|
542
|
+
const readRow = (r) => {
|
|
543
|
+
const vals = [];
|
|
544
|
+
for (let c = startCol; c <= endCol; c++) {
|
|
545
|
+
vals.push(getCellValue(r, c));
|
|
546
|
+
}
|
|
547
|
+
return vals;
|
|
548
|
+
};
|
|
549
|
+
// The actual row in the sheet for the header
|
|
550
|
+
const headerSheetRow = startRow + headerRow;
|
|
551
|
+
if (headerSheetRow > endRow) {
|
|
552
|
+
console.warn(`[TabularDriver] headerRow ${headerRow} exceeds sheet range (max row: ${endRow - startRow})`);
|
|
542
553
|
processedSheets++;
|
|
543
554
|
continue;
|
|
544
555
|
}
|
|
545
|
-
//
|
|
546
|
-
const
|
|
547
|
-
|
|
556
|
+
// Read header row values directly from cells
|
|
557
|
+
const headerValues = readRow(headerSheetRow);
|
|
558
|
+
// Build headers array
|
|
559
|
+
const headers = headerValues.map((h, i) => {
|
|
548
560
|
if (h === null || h === undefined || String(h).trim() === '') {
|
|
549
561
|
return `__EMPTY${i > 0 ? '_' + i : ''}`;
|
|
550
562
|
}
|
|
551
563
|
return String(h).trim();
|
|
552
564
|
});
|
|
553
565
|
// Ensure we have at least one valid header
|
|
554
|
-
|
|
555
|
-
|
|
566
|
+
const validHeaders = headers.filter(h => !h.startsWith('__EMPTY'));
|
|
567
|
+
if (validHeaders.length === 0) {
|
|
568
|
+
console.warn(`[TabularDriver] No valid headers found at row ${headerRow} in sheet "${sheetName}"`);
|
|
556
569
|
processedSheets++;
|
|
557
570
|
continue;
|
|
558
571
|
}
|
|
559
|
-
// Build rows
|
|
572
|
+
// Build data rows: everything after the header row
|
|
560
573
|
const rows = [];
|
|
561
|
-
for (let
|
|
562
|
-
const rowData =
|
|
574
|
+
for (let r = headerSheetRow + 1; r <= endRow; r++) {
|
|
575
|
+
const rowData = readRow(r);
|
|
563
576
|
// Skip completely empty rows
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
}
|
|
567
|
-
// Skip rows where all cells are null/undefined/empty
|
|
568
|
-
const hasContent = rowData.some((cell) => cell !== null && cell !== undefined && String(cell).trim() !== '');
|
|
569
|
-
if (!hasContent) {
|
|
577
|
+
const hasContent = rowData.some(cell => cell !== null && cell !== undefined && String(cell).trim() !== '');
|
|
578
|
+
if (!hasContent)
|
|
570
579
|
continue;
|
|
571
|
-
}
|
|
572
580
|
const row = {};
|
|
573
|
-
headers.
|
|
574
|
-
row[
|
|
575
|
-
}
|
|
581
|
+
for (let j = 0; j < headers.length; j++) {
|
|
582
|
+
row[headers[j]] = rowData[j] !== undefined ? rowData[j] : null;
|
|
583
|
+
}
|
|
576
584
|
rows.push(row);
|
|
577
585
|
}
|
|
578
586
|
if (rows.length > 0) {
|
|
@@ -646,36 +646,49 @@ export class TabularDriver {
|
|
|
646
646
|
}
|
|
647
647
|
|
|
648
648
|
const range = XLSX.utils.decode_range(ref);
|
|
649
|
-
const
|
|
649
|
+
const startRow = range.s.r; // first row index
|
|
650
|
+
const endRow = range.e.r; // last row index
|
|
651
|
+
const startCol = range.s.c; // first col index
|
|
652
|
+
const endCol = range.e.c; // last col index
|
|
653
|
+
const numCols = endCol - startCol + 1;
|
|
650
654
|
|
|
651
|
-
if (
|
|
655
|
+
if (endRow < startRow) {
|
|
652
656
|
processedSheets++;
|
|
653
657
|
continue;
|
|
654
658
|
}
|
|
655
659
|
|
|
656
|
-
//
|
|
657
|
-
const
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
660
|
+
// Helper: read a single cell value from the worksheet
|
|
661
|
+
const getCellValue = (r: number, c: number): any => {
|
|
662
|
+
const cellAddress = XLSX.utils.encode_cell({ r, c });
|
|
663
|
+
const cell = worksheet[cellAddress];
|
|
664
|
+
if (!cell) return null;
|
|
665
|
+
// Use formatted value (v = raw, w = formatted text)
|
|
666
|
+
return cell.v !== undefined ? cell.v : null;
|
|
667
|
+
};
|
|
663
668
|
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
669
|
+
// Helper: read an entire row as an array
|
|
670
|
+
const readRow = (r: number): any[] => {
|
|
671
|
+
const vals: any[] = [];
|
|
672
|
+
for (let c = startCol; c <= endCol; c++) {
|
|
673
|
+
vals.push(getCellValue(r, c));
|
|
674
|
+
}
|
|
675
|
+
return vals;
|
|
676
|
+
};
|
|
677
|
+
|
|
678
|
+
// The actual row in the sheet for the header
|
|
679
|
+
const headerSheetRow = startRow + headerRow;
|
|
668
680
|
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
console.warn(`[TabularDriver] headerRow ${headerRow} exceeds data length ${rawData.length}, using 0`);
|
|
681
|
+
if (headerSheetRow > endRow) {
|
|
682
|
+
console.warn(`[TabularDriver] headerRow ${headerRow} exceeds sheet range (max row: ${endRow - startRow})`);
|
|
672
683
|
processedSheets++;
|
|
673
684
|
continue;
|
|
674
685
|
}
|
|
675
686
|
|
|
676
|
-
//
|
|
677
|
-
const
|
|
678
|
-
|
|
687
|
+
// Read header row values directly from cells
|
|
688
|
+
const headerValues = readRow(headerSheetRow);
|
|
689
|
+
|
|
690
|
+
// Build headers array
|
|
691
|
+
const headers: string[] = headerValues.map((h: any, i: number) => {
|
|
679
692
|
if (h === null || h === undefined || String(h).trim() === '') {
|
|
680
693
|
return `__EMPTY${i > 0 ? '_' + i : ''}`;
|
|
681
694
|
}
|
|
@@ -683,34 +696,28 @@ export class TabularDriver {
|
|
|
683
696
|
});
|
|
684
697
|
|
|
685
698
|
// Ensure we have at least one valid header
|
|
686
|
-
|
|
687
|
-
|
|
699
|
+
const validHeaders = headers.filter(h => !h.startsWith('__EMPTY'));
|
|
700
|
+
if (validHeaders.length === 0) {
|
|
701
|
+
console.warn(`[TabularDriver] No valid headers found at row ${headerRow} in sheet "${sheetName}"`);
|
|
688
702
|
processedSheets++;
|
|
689
703
|
continue;
|
|
690
704
|
}
|
|
691
705
|
|
|
692
|
-
// Build rows
|
|
706
|
+
// Build data rows: everything after the header row
|
|
693
707
|
const rows: Record<string, any>[] = [];
|
|
694
|
-
for (let
|
|
695
|
-
const rowData =
|
|
708
|
+
for (let r = headerSheetRow + 1; r <= endRow; r++) {
|
|
709
|
+
const rowData = readRow(r);
|
|
696
710
|
|
|
697
711
|
// Skip completely empty rows
|
|
698
|
-
|
|
699
|
-
continue;
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
// Skip rows where all cells are null/undefined/empty
|
|
703
|
-
const hasContent = rowData.some((cell: any) =>
|
|
712
|
+
const hasContent = rowData.some(cell =>
|
|
704
713
|
cell !== null && cell !== undefined && String(cell).trim() !== ''
|
|
705
714
|
);
|
|
706
|
-
if (!hasContent)
|
|
707
|
-
continue;
|
|
708
|
-
}
|
|
715
|
+
if (!hasContent) continue;
|
|
709
716
|
|
|
710
717
|
const row: Record<string, any> = {};
|
|
711
|
-
|
|
712
|
-
row[
|
|
713
|
-
}
|
|
718
|
+
for (let j = 0; j < headers.length; j++) {
|
|
719
|
+
row[headers[j]] = rowData[j] !== undefined ? rowData[j] : null;
|
|
720
|
+
}
|
|
714
721
|
rows.push(row);
|
|
715
722
|
}
|
|
716
723
|
|