juxscript 1.1.195 → 1.1.196
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":"dataframe.d.ts","sourceRoot":"","sources":["dataframe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAQnC,MAAM,WAAW,gBAAgB;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,KAAK,cAAc,GAAG,SAAS,GAAG;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM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W;IAyDzB,OAAO,CAAC,iBAAiB;IAyJzB,OAAO,CAAC,aAAa;IAuBrB,OAAO,CAAC,aAAa;IAkErB,OAAO,CAAC,oBAAoB;IA6B5B,OAAO,CAAC,sBAAsB;IA8B9B,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,oBAAoB;YASd,sBAAsB;IAoMpC,OAAO,CAAC,oBAAoB;IAyM5B,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,IAAI;IAExC,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,IAAI;CAoErE;AAED,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,kBAAkB,CAExF"}
|
|
@@ -526,14 +526,14 @@ export class DataFrameComponent extends BaseComponent {
|
|
|
526
526
|
max="50"
|
|
527
527
|
style="width: 100%;"
|
|
528
528
|
/>
|
|
529
|
-
<div id="${this._id}-reshape-hint" class="jux-reshape-hint">
|
|
529
|
+
<div id="${this._id}-reshape-hint" class="jux-reshape-hint" style="margin-top: 0.5rem; padding: 0.75rem; background: hsl(var(--muted) / 0.5); border-radius: var(--radius); font-size: 0.875rem;">
|
|
530
530
|
</div>
|
|
531
531
|
</div>
|
|
532
532
|
<div class="jux-reshape-preview-container">
|
|
533
533
|
<div style="font-weight: 600; margin-bottom: 0.5rem; color: hsl(var(--foreground));">
|
|
534
534
|
Preview
|
|
535
535
|
</div>
|
|
536
|
-
<div id="${this._id}-preview"
|
|
536
|
+
<div id="${this._id}-preview" style="font-family: monospace; font-size: 0.75rem; background: hsl(var(--muted) / 0.3); border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 1rem; overflow-x: auto; white-space: pre; max-height: 400px; overflow-y: auto;"></div>
|
|
537
537
|
</div>
|
|
538
538
|
`;
|
|
539
539
|
this._reshapeModal
|
|
@@ -583,69 +583,84 @@ export class DataFrameComponent extends BaseComponent {
|
|
|
583
583
|
const updateHint = (headerRow) => {
|
|
584
584
|
if (!hintDiv)
|
|
585
585
|
return;
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
`
|
|
589
|
-
|
|
586
|
+
if (headerRow > 0) {
|
|
587
|
+
hintDiv.innerHTML = `Row <strong>${headerRow}</strong> will be used as column headers. ` +
|
|
588
|
+
`Rows <strong>0–${headerRow - 1}</strong> will be skipped (not imported).`;
|
|
589
|
+
}
|
|
590
|
+
else {
|
|
591
|
+
hintDiv.innerHTML = `Row <strong>0</strong> (first row) will be used as column headers. No rows will be skipped.`;
|
|
592
|
+
}
|
|
590
593
|
};
|
|
591
594
|
const updatePreview = async () => {
|
|
592
595
|
const headerRow = parseInt(headerRowInput?.value) || 0;
|
|
593
596
|
updateHint(headerRow);
|
|
594
597
|
try {
|
|
595
|
-
//
|
|
598
|
+
// Get raw data (headerRow=0) to show ALL rows including skipped ones
|
|
596
599
|
const rawSheets = await this._driver.streamFileMultiSheet(this._rawFileData.file, {
|
|
597
600
|
headerRow: 0,
|
|
598
|
-
maxSheetSize: headerRow +
|
|
601
|
+
maxSheetSize: headerRow + 12
|
|
599
602
|
});
|
|
600
603
|
const rawSheet = Object.values(rawSheets)[0];
|
|
601
|
-
|
|
602
|
-
const parsedSheets = await this._driver.streamFileMultiSheet(this._rawFileData.file, {
|
|
603
|
-
headerRow,
|
|
604
|
-
maxSheetSize: headerRow + 15
|
|
605
|
-
});
|
|
606
|
-
const parsedSheet = Object.values(parsedSheets)[0];
|
|
607
|
-
if (!rawSheet && !parsedSheet) {
|
|
604
|
+
if (!rawSheet) {
|
|
608
605
|
if (previewDiv)
|
|
609
606
|
previewDiv.textContent = 'No data found';
|
|
610
607
|
return;
|
|
611
608
|
}
|
|
612
|
-
const
|
|
613
|
-
const
|
|
609
|
+
const rawCols = rawSheet.columns;
|
|
610
|
+
const rawRows = rawSheet.toRows();
|
|
611
|
+
const colWidth = 20;
|
|
614
612
|
const lines = [];
|
|
615
|
-
//
|
|
616
|
-
if (
|
|
613
|
+
// === SKIPPED ROWS SECTION ===
|
|
614
|
+
if (headerRow > 0) {
|
|
615
|
+
lines.push('┌─────────────────────────────────────────────────────────────────────────────────┐');
|
|
616
|
+
lines.push(`│ SKIPPED: Rows 0–${headerRow - 1} will NOT be imported │`);
|
|
617
|
+
lines.push('└─────────────────────────────────────────────────────────────────────────────────┘');
|
|
617
618
|
lines.push('');
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
lines.push(`
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
const rawCols = rawSheet.columns;
|
|
624
|
-
// Show raw header (row 0) - dimmed
|
|
625
|
-
lines.push(`${'[0]'.padEnd(idxWidth)}${rawCols.map(c => String(c).substring(0, colWidth - 2).padEnd(colWidth)).join('│ ')} ← skipped`);
|
|
626
|
-
const skippedCount = Math.min(headerRow - 1, rawRows.length);
|
|
627
|
-
for (let i = 0; i < skippedCount; i++) {
|
|
619
|
+
// Row 0 is the raw file header (becomes column names when headerRow=0)
|
|
620
|
+
const row0Line = rawCols.slice(0, 5).map(c => String(c ?? '').substring(0, colWidth - 1).padEnd(colWidth)).join('│');
|
|
621
|
+
lines.push(` [0] ${row0Line}${rawCols.length > 5 ? ' ...' : ''}`);
|
|
622
|
+
// Rows 1 to headerRow-1 are skipped data rows
|
|
623
|
+
for (let i = 0; i < Math.min(headerRow - 1, rawRows.length); i++) {
|
|
628
624
|
const row = rawRows[i];
|
|
629
|
-
const
|
|
630
|
-
|
|
631
|
-
lines.push(`${rowIdx}${cols} ← skipped`);
|
|
625
|
+
const vals = Object.values(row).slice(0, 5).map(v => String(v ?? '').substring(0, colWidth - 1).padEnd(colWidth)).join('│');
|
|
626
|
+
lines.push(` [${i + 1}] ${vals}${Object.values(row).length > 5 ? ' ...' : ''}`);
|
|
632
627
|
}
|
|
633
628
|
lines.push('');
|
|
634
|
-
lines.push(` ╔${'═'.repeat(100)}╗`);
|
|
635
|
-
lines.push(` ║ ▼ DATA STARTS HERE (Row ${headerRow} = Column Headers)`.padEnd(101) + '║');
|
|
636
|
-
lines.push(` ╚${'═'.repeat(100)}╝`);
|
|
637
|
-
lines.push('');
|
|
638
629
|
}
|
|
639
|
-
//
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
630
|
+
// === HEADER ROW (will become column names) ===
|
|
631
|
+
lines.push('╔═════════════════════════════════════════════════════════════════════════════════╗');
|
|
632
|
+
lines.push(`║ HEADER ROW ${headerRow} — These values become your column names ║`);
|
|
633
|
+
lines.push('╚═════════════════════════════════════════════════════════════════════════════════╝');
|
|
634
|
+
lines.push('');
|
|
635
|
+
// The header row content - if headerRow=0, it's rawCols, else it's rawRows[headerRow-1]
|
|
636
|
+
let headerValues;
|
|
637
|
+
if (headerRow === 0) {
|
|
638
|
+
headerValues = rawCols;
|
|
639
|
+
}
|
|
640
|
+
else if (headerRow - 1 < rawRows.length) {
|
|
641
|
+
headerValues = Object.values(rawRows[headerRow - 1]).map(v => String(v ?? ''));
|
|
642
|
+
}
|
|
643
|
+
else {
|
|
644
|
+
headerValues = rawCols; // fallback
|
|
645
|
+
}
|
|
646
|
+
const headerLine = headerValues.slice(0, 5).map(c => String(c ?? '').substring(0, colWidth - 1).padEnd(colWidth)).join('│');
|
|
647
|
+
lines.push(`▶ [${headerRow}] ${headerLine}${headerValues.length > 5 ? ' ...' : ''}`);
|
|
648
|
+
lines.push('');
|
|
649
|
+
// === DATA ROWS ===
|
|
650
|
+
lines.push('────────────────────────────────────────────────────────────────────────────────────');
|
|
651
|
+
lines.push(' DATA ROWS (will be imported):');
|
|
652
|
+
lines.push('');
|
|
653
|
+
// Data starts at rawRows[headerRow] (since rawRows is 0-indexed after the header)
|
|
654
|
+
const dataStartIdx = headerRow;
|
|
655
|
+
const dataRows = rawRows.slice(dataStartIdx, dataStartIdx + 6);
|
|
656
|
+
if (dataRows.length === 0) {
|
|
657
|
+
lines.push(' (No data rows found after header)');
|
|
658
|
+
}
|
|
659
|
+
else {
|
|
645
660
|
dataRows.forEach((row, i) => {
|
|
646
|
-
const rowIdx =
|
|
647
|
-
const
|
|
648
|
-
lines.push(
|
|
661
|
+
const rowIdx = headerRow + 1 + i;
|
|
662
|
+
const vals = Object.values(row).slice(0, 5).map(v => String(v ?? '').substring(0, colWidth - 1).padEnd(colWidth)).join('│');
|
|
663
|
+
lines.push(` [${rowIdx}] ${vals}${Object.values(row).length > 5 ? ' ...' : ''}`);
|
|
649
664
|
});
|
|
650
665
|
}
|
|
651
666
|
if (previewDiv) {
|
|
@@ -652,14 +652,14 @@ export class DataFrameComponent extends BaseComponent<DataFrameState> {
|
|
|
652
652
|
max="50"
|
|
653
653
|
style="width: 100%;"
|
|
654
654
|
/>
|
|
655
|
-
<div id="${this._id}-reshape-hint" class="jux-reshape-hint">
|
|
655
|
+
<div id="${this._id}-reshape-hint" class="jux-reshape-hint" style="margin-top: 0.5rem; padding: 0.75rem; background: hsl(var(--muted) / 0.5); border-radius: var(--radius); font-size: 0.875rem;">
|
|
656
656
|
</div>
|
|
657
657
|
</div>
|
|
658
658
|
<div class="jux-reshape-preview-container">
|
|
659
659
|
<div style="font-weight: 600; margin-bottom: 0.5rem; color: hsl(var(--foreground));">
|
|
660
660
|
Preview
|
|
661
661
|
</div>
|
|
662
|
-
<div id="${this._id}-preview"
|
|
662
|
+
<div id="${this._id}-preview" style="font-family: monospace; font-size: 0.75rem; background: hsl(var(--muted) / 0.3); border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 1rem; overflow-x: auto; white-space: pre; max-height: 400px; overflow-y: auto;"></div>
|
|
663
663
|
</div>
|
|
664
664
|
`;
|
|
665
665
|
|
|
@@ -716,10 +716,12 @@ export class DataFrameComponent extends BaseComponent<DataFrameState> {
|
|
|
716
716
|
|
|
717
717
|
const updateHint = (headerRow: number) => {
|
|
718
718
|
if (!hintDiv) return;
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
719
|
+
if (headerRow > 0) {
|
|
720
|
+
hintDiv.innerHTML = `Row <strong>${headerRow}</strong> will be used as column headers. ` +
|
|
721
|
+
`Rows <strong>0–${headerRow - 1}</strong> will be skipped (not imported).`;
|
|
722
|
+
} else {
|
|
723
|
+
hintDiv.innerHTML = `Row <strong>0</strong> (first row) will be used as column headers. No rows will be skipped.`;
|
|
724
|
+
}
|
|
723
725
|
};
|
|
724
726
|
|
|
725
727
|
const updatePreview = async () => {
|
|
@@ -727,69 +729,80 @@ export class DataFrameComponent extends BaseComponent<DataFrameState> {
|
|
|
727
729
|
updateHint(headerRow);
|
|
728
730
|
|
|
729
731
|
try {
|
|
730
|
-
//
|
|
732
|
+
// Get raw data (headerRow=0) to show ALL rows including skipped ones
|
|
731
733
|
const rawSheets = await this._driver.streamFileMultiSheet(this._rawFileData!.file, {
|
|
732
734
|
headerRow: 0,
|
|
733
|
-
maxSheetSize: headerRow +
|
|
735
|
+
maxSheetSize: headerRow + 12
|
|
734
736
|
});
|
|
735
737
|
const rawSheet = Object.values(rawSheets)[0];
|
|
736
738
|
|
|
737
|
-
|
|
738
|
-
const parsedSheets = await this._driver.streamFileMultiSheet(this._rawFileData!.file, {
|
|
739
|
-
headerRow,
|
|
740
|
-
maxSheetSize: headerRow + 15
|
|
741
|
-
});
|
|
742
|
-
const parsedSheet = Object.values(parsedSheets)[0];
|
|
743
|
-
|
|
744
|
-
if (!rawSheet && !parsedSheet) {
|
|
739
|
+
if (!rawSheet) {
|
|
745
740
|
if (previewDiv) previewDiv.textContent = 'No data found';
|
|
746
741
|
return;
|
|
747
742
|
}
|
|
748
743
|
|
|
749
|
-
const
|
|
750
|
-
const
|
|
744
|
+
const rawCols = rawSheet.columns;
|
|
745
|
+
const rawRows = rawSheet.toRows();
|
|
746
|
+
const colWidth = 20;
|
|
751
747
|
const lines: string[] = [];
|
|
752
748
|
|
|
753
|
-
//
|
|
754
|
-
if (
|
|
749
|
+
// === SKIPPED ROWS SECTION ===
|
|
750
|
+
if (headerRow > 0) {
|
|
751
|
+
lines.push('┌─────────────────────────────────────────────────────────────────────────────────┐');
|
|
752
|
+
lines.push(`│ SKIPPED: Rows 0–${headerRow - 1} will NOT be imported │`);
|
|
753
|
+
lines.push('└─────────────────────────────────────────────────────────────────────────────────┘');
|
|
755
754
|
lines.push('');
|
|
756
|
-
lines.push(` ┌${'─'.repeat(100)}┐`);
|
|
757
|
-
lines.push(` │ ROWS 0-${headerRow - 1} WILL BE SKIPPED (not imported)`.padEnd(101) + '│');
|
|
758
|
-
lines.push(` └${'─'.repeat(100)}┘`);
|
|
759
|
-
lines.push('');
|
|
760
|
-
|
|
761
|
-
const rawRows = rawSheet.toRows();
|
|
762
|
-
const rawCols = rawSheet.columns;
|
|
763
755
|
|
|
764
|
-
//
|
|
765
|
-
|
|
756
|
+
// Row 0 is the raw file header (becomes column names when headerRow=0)
|
|
757
|
+
const row0Line = rawCols.slice(0, 5).map(c => String(c ?? '').substring(0, colWidth - 1).padEnd(colWidth)).join('│');
|
|
758
|
+
lines.push(` [0] ${row0Line}${rawCols.length > 5 ? ' ...' : ''}`);
|
|
766
759
|
|
|
767
|
-
|
|
768
|
-
for (let i = 0; i <
|
|
760
|
+
// Rows 1 to headerRow-1 are skipped data rows
|
|
761
|
+
for (let i = 0; i < Math.min(headerRow - 1, rawRows.length); i++) {
|
|
769
762
|
const row = rawRows[i];
|
|
770
|
-
const
|
|
771
|
-
|
|
772
|
-
lines.push(`${rowIdx}${cols} ← skipped`);
|
|
763
|
+
const vals = Object.values(row).slice(0, 5).map(v => String(v ?? '').substring(0, colWidth - 1).padEnd(colWidth)).join('│');
|
|
764
|
+
lines.push(` [${i + 1}] ${vals}${Object.values(row).length > 5 ? ' ...' : ''}`);
|
|
773
765
|
}
|
|
774
766
|
|
|
775
767
|
lines.push('');
|
|
776
|
-
lines.push(` ╔${'═'.repeat(100)}╗`);
|
|
777
|
-
lines.push(` ║ ▼ DATA STARTS HERE (Row ${headerRow} = Column Headers)`.padEnd(101) + '║');
|
|
778
|
-
lines.push(` ╚${'═'.repeat(100)}╝`);
|
|
779
|
-
lines.push('');
|
|
780
768
|
}
|
|
781
769
|
|
|
782
|
-
//
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
770
|
+
// === HEADER ROW (will become column names) ===
|
|
771
|
+
lines.push('╔═════════════════════════════════════════════════════════════════════════════════╗');
|
|
772
|
+
lines.push(`║ HEADER ROW ${headerRow} — These values become your column names ║`);
|
|
773
|
+
lines.push('╚═════════════════════════════════════════════════════════════════════════════════╝');
|
|
774
|
+
lines.push('');
|
|
775
|
+
|
|
776
|
+
// The header row content - if headerRow=0, it's rawCols, else it's rawRows[headerRow-1]
|
|
777
|
+
let headerValues: string[];
|
|
778
|
+
if (headerRow === 0) {
|
|
779
|
+
headerValues = rawCols;
|
|
780
|
+
} else if (headerRow - 1 < rawRows.length) {
|
|
781
|
+
headerValues = Object.values(rawRows[headerRow - 1]).map(v => String(v ?? ''));
|
|
782
|
+
} else {
|
|
783
|
+
headerValues = rawCols; // fallback
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
const headerLine = headerValues.slice(0, 5).map(c => String(c ?? '').substring(0, colWidth - 1).padEnd(colWidth)).join('│');
|
|
787
|
+
lines.push(`▶ [${headerRow}] ${headerLine}${headerValues.length > 5 ? ' ...' : ''}`);
|
|
788
|
+
lines.push('');
|
|
789
|
+
|
|
790
|
+
// === DATA ROWS ===
|
|
791
|
+
lines.push('────────────────────────────────────────────────────────────────────────────────────');
|
|
792
|
+
lines.push(' DATA ROWS (will be imported):');
|
|
793
|
+
lines.push('');
|
|
787
794
|
|
|
788
|
-
|
|
795
|
+
// Data starts at rawRows[headerRow] (since rawRows is 0-indexed after the header)
|
|
796
|
+
const dataStartIdx = headerRow;
|
|
797
|
+
const dataRows = rawRows.slice(dataStartIdx, dataStartIdx + 6);
|
|
798
|
+
|
|
799
|
+
if (dataRows.length === 0) {
|
|
800
|
+
lines.push(' (No data rows found after header)');
|
|
801
|
+
} else {
|
|
789
802
|
dataRows.forEach((row, i) => {
|
|
790
|
-
const rowIdx =
|
|
791
|
-
const
|
|
792
|
-
lines.push(
|
|
803
|
+
const rowIdx = headerRow + 1 + i;
|
|
804
|
+
const vals = Object.values(row).slice(0, 5).map(v => String(v ?? '').substring(0, colWidth - 1).padEnd(colWidth)).join('│');
|
|
805
|
+
lines.push(` [${rowIdx}] ${vals}${Object.values(row).length > 5 ? ' ...' : ''}`);
|
|
793
806
|
});
|
|
794
807
|
}
|
|
795
808
|
|