juxscript 1.1.214 → 1.1.216
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.
- package/lib/components/dataframe.d.ts.map +1 -1
- package/lib/components/dataframe.js +8 -2
- package/lib/components/dataframe.ts +9 -2
- package/lib/components/table.d.ts.map +1 -1
- package/lib/components/table.js +36 -100
- package/lib/components/table.ts +68 -130
- package/lib/components/tabs.d.ts +2 -3
- package/lib/components/tabs.d.ts.map +1 -1
- package/lib/components/tabs.js +6 -9
- package/lib/components/tabs.ts +7 -11
- package/package.json +1 -1
|
@@ -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;AASnC,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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class DataFrameComponent extends BaseComponent {
|
|
|
422
422
|
sheetNames.forEach((sheetName) => {
|
|
423
423
|
const df = sheets[sheetName];
|
|
424
424
|
const safeId = sanitizeId(sheetName);
|
|
425
|
+
// ✅ DEBUG: Log table options
|
|
426
|
+
console.log(`[DataFrame] Creating table for sheet "${sheetName}" with options:`, {
|
|
427
|
+
filterable: this._tableOptions.filterable,
|
|
428
|
+
paginated: this._tableOptions.paginated,
|
|
429
|
+
sortable: this._tableOptions.sortable
|
|
430
|
+
});
|
|
425
431
|
const table = new Table(`${this._id}-table-${safeId}`, {
|
|
426
432
|
striped: this._tableOptions.striped,
|
|
427
433
|
hoverable: this._tableOptions.hoverable,
|
|
428
434
|
sortable: this._tableOptions.sortable,
|
|
429
|
-
filterable:
|
|
435
|
+
filterable: this._tableOptions.filterable,
|
|
430
436
|
paginated: this._tableOptions.paginated,
|
|
431
437
|
rowsPerPage: this._tableOptions.rowsPerPage
|
|
432
438
|
});
|
|
@@ -983,7 +989,7 @@ export class DataFrameComponent extends BaseComponent {
|
|
|
983
989
|
striped: this._tableOptions.striped,
|
|
984
990
|
hoverable: this._tableOptions.hoverable,
|
|
985
991
|
sortable: this._tableOptions.sortable,
|
|
986
|
-
filterable:
|
|
992
|
+
filterable: this._tableOptions.filterable, // ✅ Use actual option
|
|
987
993
|
paginated: this._tableOptions.paginated,
|
|
988
994
|
rowsPerPage: this._tableOptions.rowsPerPage
|
|
989
995
|
});
|
|
@@ -514,11 +514,18 @@ export class DataFrameComponent extends BaseComponent<DataFrameState> {
|
|
|
514
514
|
const df = sheets[sheetName];
|
|
515
515
|
const safeId = sanitizeId(sheetName);
|
|
516
516
|
|
|
517
|
+
// ✅ DEBUG: Log table options
|
|
518
|
+
console.log(`[DataFrame] Creating table for sheet "${sheetName}" with options:`, {
|
|
519
|
+
filterable: this._tableOptions.filterable,
|
|
520
|
+
paginated: this._tableOptions.paginated,
|
|
521
|
+
sortable: this._tableOptions.sortable
|
|
522
|
+
});
|
|
523
|
+
|
|
517
524
|
const table = new Table(`${this._id}-table-${safeId}`, {
|
|
518
525
|
striped: this._tableOptions.striped,
|
|
519
526
|
hoverable: this._tableOptions.hoverable,
|
|
520
527
|
sortable: this._tableOptions.sortable,
|
|
521
|
-
filterable:
|
|
528
|
+
filterable: this._tableOptions.filterable,
|
|
522
529
|
paginated: this._tableOptions.paginated,
|
|
523
530
|
rowsPerPage: this._tableOptions.rowsPerPage
|
|
524
531
|
});
|
|
@@ -1158,7 +1165,7 @@ export class DataFrameComponent extends BaseComponent<DataFrameState> {
|
|
|
1158
1165
|
striped: this._tableOptions.striped,
|
|
1159
1166
|
hoverable: this._tableOptions.hoverable,
|
|
1160
1167
|
sortable: this._tableOptions.sortable,
|
|
1161
|
-
filterable:
|
|
1168
|
+
filterable: this._tableOptions.filterable, // ✅ Use actual option
|
|
1162
1169
|
paginated: this._tableOptions.paginated,
|
|
1163
1170
|
rowsPerPage: this._tableOptions.rowsPerPage
|
|
1164
1171
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["table.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAiBxD,MAAM,MAAM,6BAA6B,GAAG,OAAO,GAAG,UAAU,CAAC;AACjE,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,UAAU,CAAC;AAElD,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,KAAK,MAAM,GAAG,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["table.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAiBxD,MAAM,MAAM,6BAA6B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,OAAO,CAAC,qBAAqB;IA6B7B,OAAO,CAAC,mBAAmB;IAuB3B,OAAO,CAAC,iBAAiB;CAiD1B;AAED,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,KAAK,CAEnE"}
|
package/lib/components/table.js
CHANGED
|
@@ -48,6 +48,9 @@ export class Table extends BaseComponent {
|
|
|
48
48
|
selectionBehavior: options.selectionBehavior ?? 'clear'
|
|
49
49
|
});
|
|
50
50
|
this._tableElement = null;
|
|
51
|
+
// ✅ DEBUG: Log what was passed vs what was stored
|
|
52
|
+
console.log(`[Table ${id}] constructor options.filterable:`, options.filterable);
|
|
53
|
+
console.log(`[Table ${id}] this.state.filterable:`, this.state.filterable);
|
|
51
54
|
}
|
|
52
55
|
/* ═════════════════════════════════════════════════════════════════
|
|
53
56
|
* ABSTRACT METHOD IMPLEMENTATIONS
|
|
@@ -412,24 +415,20 @@ export class Table extends BaseComponent {
|
|
|
412
415
|
input.type = 'text';
|
|
413
416
|
input.placeholder = 'Filter...';
|
|
414
417
|
input.className = 'jux-table-filter';
|
|
415
|
-
input.
|
|
416
|
-
|
|
418
|
+
input.id = `${this._id}-filter`;
|
|
419
|
+
input.style.cssText = 'margin-bottom: 10px; padding: 5px; width: 100%; box-sizing: border-box;';
|
|
417
420
|
input.addEventListener('input', (e) => {
|
|
418
421
|
const target = e.target;
|
|
419
422
|
this.state.filterText = target.value;
|
|
420
|
-
// Re-render table body
|
|
421
423
|
const tbody = this._tableElement?.querySelector('tbody');
|
|
422
424
|
if (tbody) {
|
|
423
425
|
this._renderTableBody(tbody);
|
|
424
|
-
// Update pagination if enabled
|
|
425
426
|
const wrapper = this._tableElement?.closest('.jux-table-wrapper');
|
|
426
427
|
if (wrapper && this.state.paginated) {
|
|
427
|
-
// Reset to page 1 when filtering
|
|
428
428
|
this.state.currentPage = 1;
|
|
429
429
|
this._updatePagination(wrapper, tbody);
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
|
-
// Fire callback
|
|
433
432
|
this._triggerCallback('filterChange', target.value, e);
|
|
434
433
|
});
|
|
435
434
|
return input;
|
|
@@ -462,19 +461,37 @@ export class Table extends BaseComponent {
|
|
|
462
461
|
const headerRow = document.createElement('tr');
|
|
463
462
|
// Add bulk checkbox or empty checkbox column
|
|
464
463
|
if (this.state.showBulkCheckbox) {
|
|
465
|
-
|
|
464
|
+
const bulkTh = document.createElement('th');
|
|
465
|
+
bulkTh.style.width = '40px';
|
|
466
|
+
bulkTh.style.textAlign = 'center';
|
|
467
|
+
const bulkCheckbox = document.createElement('input');
|
|
468
|
+
bulkCheckbox.type = 'checkbox';
|
|
469
|
+
bulkCheckbox.className = 'jux-bulk-checkbox';
|
|
470
|
+
bulkCheckbox.style.cursor = 'pointer';
|
|
471
|
+
bulkCheckbox.title = 'Select all';
|
|
472
|
+
bulkCheckbox.addEventListener('change', (e) => {
|
|
473
|
+
if (bulkCheckbox.checked) {
|
|
474
|
+
this.selectAll();
|
|
475
|
+
}
|
|
476
|
+
else {
|
|
477
|
+
this.deselectAll();
|
|
478
|
+
}
|
|
479
|
+
});
|
|
480
|
+
bulkTh.appendChild(bulkCheckbox);
|
|
481
|
+
headerRow.insertBefore(bulkTh, headerRow.firstChild);
|
|
466
482
|
}
|
|
467
483
|
else if (this.state.showCheckboxes) {
|
|
468
|
-
const
|
|
469
|
-
|
|
470
|
-
headerRow.
|
|
484
|
+
const checkboxTh = document.createElement('th');
|
|
485
|
+
checkboxTh.style.width = '40px';
|
|
486
|
+
headerRow.insertBefore(checkboxTh, headerRow.firstChild);
|
|
471
487
|
}
|
|
472
|
-
// Add column headers with optional
|
|
488
|
+
// Add column headers with optional sorts
|
|
473
489
|
this.state.columns.forEach(col => {
|
|
474
490
|
const th = this._buildColumnHeader(col);
|
|
475
491
|
headerRow.appendChild(th);
|
|
476
492
|
});
|
|
477
493
|
thead.appendChild(headerRow);
|
|
494
|
+
thead.appendChild(headerRow);
|
|
478
495
|
return thead;
|
|
479
496
|
}
|
|
480
497
|
_buildBulkCheckboxCell() {
|
|
@@ -507,7 +524,6 @@ export class Table extends BaseComponent {
|
|
|
507
524
|
th.style.cursor = 'pointer';
|
|
508
525
|
th.style.userSelect = 'none';
|
|
509
526
|
th.addEventListener('click', (e) => {
|
|
510
|
-
// Update state
|
|
511
527
|
if (this.state.sortColumn === col.key) {
|
|
512
528
|
this.state.sortDirection = this.state.sortDirection === 'asc' ? 'desc' : 'asc';
|
|
513
529
|
}
|
|
@@ -515,36 +531,30 @@ export class Table extends BaseComponent {
|
|
|
515
531
|
this.state.sortColumn = col.key;
|
|
516
532
|
this.state.sortDirection = 'asc';
|
|
517
533
|
}
|
|
518
|
-
// Re-render
|
|
519
534
|
const tbody = this._tableElement.querySelector('tbody');
|
|
520
535
|
this._renderTableBody(tbody);
|
|
521
|
-
// Update UI indicators
|
|
522
536
|
const headerRow = th.parentElement;
|
|
523
537
|
headerRow.querySelectorAll('th[data-column-key]').forEach(h => {
|
|
524
538
|
h.textContent = h.textContent?.replace(' ▲', '').replace(' ▼', '') || '';
|
|
525
539
|
});
|
|
526
540
|
th.textContent = col.label + (this.state.sortDirection === 'asc' ? ' ▲' : ' ▼');
|
|
527
|
-
// Fire callback
|
|
528
541
|
this._triggerCallback('sortChange', col.key, this.state.sortDirection, e);
|
|
529
542
|
});
|
|
530
543
|
}
|
|
531
544
|
return th;
|
|
532
545
|
}
|
|
533
|
-
// Step 4: WIRE orchestrator
|
|
534
546
|
_wireAllEvents(wrapper, tbody) {
|
|
535
547
|
this._wireTriggerEvents(tbody);
|
|
536
548
|
if (this.state.paginated) {
|
|
537
549
|
this._updatePagination(wrapper, tbody);
|
|
538
550
|
}
|
|
539
|
-
this._wireStandardEvents(wrapper);
|
|
551
|
+
this._wireStandardEvents(wrapper);
|
|
540
552
|
this._wireSyncBindings(wrapper, tbody);
|
|
541
553
|
}
|
|
542
554
|
/* ═════════════════════════════════════════════════════════════════
|
|
543
555
|
* SECTION 6: EVENT WIRING
|
|
544
|
-
* WIRE phase - connects storage to actual DOM listeners/subscriptions
|
|
545
556
|
* ═════════════════════════════════════════════════════════════════ */
|
|
546
557
|
_wireTriggerEvents(tbody) {
|
|
547
|
-
// === rowClick: Fire immediately when row is clicked ===
|
|
548
558
|
if (this._triggerHandlers.has('rowClick')) {
|
|
549
559
|
const handler = this._triggerHandlers.get('rowClick');
|
|
550
560
|
tbody.addEventListener('click', (e) => {
|
|
@@ -555,14 +565,12 @@ export class Table extends BaseComponent {
|
|
|
555
565
|
rows = this._getSortedRows(rows);
|
|
556
566
|
rows = this._getPaginatedRows(rows);
|
|
557
567
|
const rowData = rows[rowIndex];
|
|
558
|
-
if (rowData)
|
|
568
|
+
if (rowData)
|
|
559
569
|
handler(rowData, rowIndex, e);
|
|
560
|
-
}
|
|
561
570
|
}
|
|
562
571
|
});
|
|
563
572
|
tbody.style.cursor = 'pointer';
|
|
564
573
|
}
|
|
565
|
-
// === cellClick: Fire immediately when cell is clicked ===
|
|
566
574
|
if (this._triggerHandlers.has('cellClick')) {
|
|
567
575
|
const handler = this._triggerHandlers.get('cellClick');
|
|
568
576
|
tbody.addEventListener('click', (e) => {
|
|
@@ -585,21 +593,16 @@ export class Table extends BaseComponent {
|
|
|
585
593
|
}
|
|
586
594
|
});
|
|
587
595
|
}
|
|
588
|
-
// === Selection events: Fire with internal logic ===
|
|
589
596
|
if (this.state.selectable) {
|
|
590
597
|
tbody.addEventListener('click', (e) => {
|
|
591
598
|
const target = e.target;
|
|
592
|
-
// Check if click was on checkbox
|
|
593
599
|
const isCheckboxClick = target.tagName === 'INPUT' && target.getAttribute('type') === 'checkbox';
|
|
594
|
-
|
|
595
|
-
if (this.state.selectionTrigger === 'checkbox' && !isCheckboxClick) {
|
|
600
|
+
if (this.state.selectionTrigger === 'checkbox' && !isCheckboxClick)
|
|
596
601
|
return;
|
|
597
|
-
}
|
|
598
|
-
// ✨ FIX: If trigger is 'row' and click WAS on checkbox, toggle it manually
|
|
599
602
|
if (this.state.selectionTrigger === 'row' && isCheckboxClick) {
|
|
600
|
-
e.preventDefault();
|
|
603
|
+
e.preventDefault();
|
|
601
604
|
const checkbox = target;
|
|
602
|
-
checkbox.checked = !checkbox.checked;
|
|
605
|
+
checkbox.checked = !checkbox.checked;
|
|
603
606
|
}
|
|
604
607
|
const tr = target.closest('tr');
|
|
605
608
|
if (tr && tbody.contains(tr)) {
|
|
@@ -611,11 +614,9 @@ export class Table extends BaseComponent {
|
|
|
611
614
|
return;
|
|
612
615
|
const wasSelected = this.state.selectedIndexes.has(actualRowIndex);
|
|
613
616
|
if (this.state.multiSelect) {
|
|
614
|
-
// Toggle selection
|
|
615
617
|
if (wasSelected) {
|
|
616
618
|
this.state.selectedIndexes.delete(actualRowIndex);
|
|
617
619
|
tr.classList.remove('jux-table-row-selected');
|
|
618
|
-
// Update checkbox if present
|
|
619
620
|
const checkbox = tr.querySelector('input[type="checkbox"]');
|
|
620
621
|
if (checkbox)
|
|
621
622
|
checkbox.checked = false;
|
|
@@ -626,7 +627,6 @@ export class Table extends BaseComponent {
|
|
|
626
627
|
else {
|
|
627
628
|
this.state.selectedIndexes.add(actualRowIndex);
|
|
628
629
|
tr.classList.add('jux-table-row-selected');
|
|
629
|
-
// Update checkbox if present
|
|
630
630
|
const checkbox = tr.querySelector('input[type="checkbox"]');
|
|
631
631
|
if (checkbox)
|
|
632
632
|
checkbox.checked = true;
|
|
@@ -636,7 +636,6 @@ export class Table extends BaseComponent {
|
|
|
636
636
|
}
|
|
637
637
|
}
|
|
638
638
|
else {
|
|
639
|
-
// Single select
|
|
640
639
|
const previousSelection = Array.from(this.state.selectedIndexes);
|
|
641
640
|
this.state.selectedIndexes.clear();
|
|
642
641
|
tbody.querySelectorAll('tr').forEach(row => {
|
|
@@ -648,7 +647,6 @@ export class Table extends BaseComponent {
|
|
|
648
647
|
if (!wasSelected) {
|
|
649
648
|
this.state.selectedIndexes.add(actualRowIndex);
|
|
650
649
|
tr.classList.add('jux-table-row-selected');
|
|
651
|
-
// Update checkbox if present
|
|
652
650
|
const checkbox = tr.querySelector('input[type="checkbox"]');
|
|
653
651
|
if (checkbox)
|
|
654
652
|
checkbox.checked = true;
|
|
@@ -664,15 +662,12 @@ export class Table extends BaseComponent {
|
|
|
664
662
|
});
|
|
665
663
|
}
|
|
666
664
|
}
|
|
667
|
-
// Update bulk checkbox state if present
|
|
668
665
|
this._updateBulkCheckboxState();
|
|
669
|
-
// Fire selectionChange
|
|
670
666
|
if (this._triggerHandlers.has('selectionChange')) {
|
|
671
667
|
this._triggerHandlers.get('selectionChange')(this.getSelectedRows(), this.getSelectedIndexes(), e);
|
|
672
668
|
}
|
|
673
669
|
}
|
|
674
670
|
});
|
|
675
|
-
// Only set pointer cursor if row is trigger
|
|
676
671
|
if (this.state.selectionTrigger === 'row') {
|
|
677
672
|
tbody.style.cursor = 'pointer';
|
|
678
673
|
}
|
|
@@ -693,7 +688,6 @@ export class Table extends BaseComponent {
|
|
|
693
688
|
stateObj.subscribe((val) => {
|
|
694
689
|
const previousRows = this.state.rows;
|
|
695
690
|
const transformed = transform(val);
|
|
696
|
-
// Handle selections
|
|
697
691
|
const hadSelections = this.state.selectedIndexes.size > 0;
|
|
698
692
|
if (this.state.selectionBehavior === 'preserve' && this.state.rowIdField) {
|
|
699
693
|
this._preserveSelections(previousRows, transformed);
|
|
@@ -714,7 +708,6 @@ export class Table extends BaseComponent {
|
|
|
714
708
|
}
|
|
715
709
|
}
|
|
716
710
|
this.state.rows = transformed;
|
|
717
|
-
// Auto-reset pagination
|
|
718
711
|
if (this.state.paginated) {
|
|
719
712
|
const totalPages = Math.ceil(transformed.length / this.state.rowsPerPage);
|
|
720
713
|
if (this.state.currentPage > totalPages && totalPages > 0) {
|
|
@@ -724,12 +717,10 @@ export class Table extends BaseComponent {
|
|
|
724
717
|
this.state.currentPage = 1;
|
|
725
718
|
}
|
|
726
719
|
}
|
|
727
|
-
// Re-render
|
|
728
720
|
this._renderTableBody(tbody);
|
|
729
721
|
if (this.state.paginated) {
|
|
730
722
|
this._updatePagination(wrapper, tbody);
|
|
731
723
|
}
|
|
732
|
-
// Fire callbacks
|
|
733
724
|
this._triggerCallback('dataChange', transformed, previousRows);
|
|
734
725
|
if (hadSelections || this.state.selectedIndexes.size > 0) {
|
|
735
726
|
this._triggerHandlers.get('selectionChange')?.(this.getSelectedRows(), this.getSelectedIndexes(), new CustomEvent('dataChange'));
|
|
@@ -741,7 +732,6 @@ export class Table extends BaseComponent {
|
|
|
741
732
|
stateObj.subscribe((val) => {
|
|
742
733
|
const transformed = transform(val);
|
|
743
734
|
this.state.columns = transformed;
|
|
744
|
-
// Full re-render needed for columns
|
|
745
735
|
const table = this._tableElement;
|
|
746
736
|
table.innerHTML = '';
|
|
747
737
|
const thead = this._buildTableHeader();
|
|
@@ -749,7 +739,6 @@ export class Table extends BaseComponent {
|
|
|
749
739
|
const newTbody = document.createElement('tbody');
|
|
750
740
|
this._renderTableBody(newTbody);
|
|
751
741
|
table.appendChild(newTbody);
|
|
752
|
-
// Re-wire events
|
|
753
742
|
this._wireTriggerEvents(newTbody);
|
|
754
743
|
if (this.state.paginated) {
|
|
755
744
|
this._updatePagination(wrapper, newTbody);
|
|
@@ -758,9 +747,7 @@ export class Table extends BaseComponent {
|
|
|
758
747
|
}
|
|
759
748
|
/* ═════════════════════════════════════════════════════════════════
|
|
760
749
|
* SECTION 7: INTERNAL HELPERS
|
|
761
|
-
* Data processing, DOM updates, selection management
|
|
762
750
|
* ═════════════════════════════════════════════════════════════════ */
|
|
763
|
-
// Data processing
|
|
764
751
|
_getFilteredRows() {
|
|
765
752
|
if (!this.state.filterText)
|
|
766
753
|
return this.state.rows;
|
|
@@ -775,24 +762,20 @@ export class Table extends BaseComponent {
|
|
|
775
762
|
_getSortedRows(rows) {
|
|
776
763
|
if (!this.state.sortColumn)
|
|
777
764
|
return rows;
|
|
778
|
-
// ✨ Check if sorting by computed column
|
|
779
765
|
const computedDef = this.state.computedColumns.get(this.state.sortColumn);
|
|
780
766
|
const sorted = [...rows].sort((a, b) => {
|
|
781
767
|
let aVal;
|
|
782
768
|
let bVal;
|
|
783
769
|
if (computedDef) {
|
|
784
|
-
// ✨ Compute values on the fly for computed columns
|
|
785
770
|
const aIndex = this.state.rows.indexOf(a);
|
|
786
771
|
const bIndex = this.state.rows.indexOf(b);
|
|
787
772
|
aVal = computedDef.compute(a, aIndex);
|
|
788
773
|
bVal = computedDef.compute(b, bIndex);
|
|
789
774
|
}
|
|
790
775
|
else {
|
|
791
|
-
// Normal column: get value from row data
|
|
792
776
|
aVal = a[this.state.sortColumn];
|
|
793
777
|
bVal = b[this.state.sortColumn];
|
|
794
778
|
}
|
|
795
|
-
// Standard comparison logic
|
|
796
779
|
if (aVal === bVal)
|
|
797
780
|
return 0;
|
|
798
781
|
if (aVal == null)
|
|
@@ -811,16 +794,13 @@ export class Table extends BaseComponent {
|
|
|
811
794
|
const end = start + this.state.rowsPerPage;
|
|
812
795
|
return rows.slice(start, end);
|
|
813
796
|
}
|
|
814
|
-
// DOM updates
|
|
815
797
|
_updateTable() {
|
|
816
798
|
if (!this._tableElement)
|
|
817
799
|
return;
|
|
818
800
|
const tbody = this._tableElement.querySelector('tbody');
|
|
819
801
|
if (!tbody)
|
|
820
802
|
return;
|
|
821
|
-
// Re-render using the same logic as initial render
|
|
822
803
|
this._renderTableBody(tbody);
|
|
823
|
-
// Update pagination if enabled
|
|
824
804
|
const wrapper = this._tableElement.closest('.jux-table-wrapper');
|
|
825
805
|
if (wrapper && this.state.paginated) {
|
|
826
806
|
this._updatePagination(wrapper, tbody);
|
|
@@ -830,17 +810,14 @@ export class Table extends BaseComponent {
|
|
|
830
810
|
tbody.innerHTML = '';
|
|
831
811
|
let rows = this._getFilteredRows();
|
|
832
812
|
rows = this._getSortedRows(rows);
|
|
833
|
-
const totalPages = Math.ceil(rows.length / this.state.rowsPerPage);
|
|
834
813
|
rows = this._getPaginatedRows(rows);
|
|
835
|
-
rows.forEach((row
|
|
814
|
+
rows.forEach((row) => {
|
|
836
815
|
const tr = document.createElement('tr');
|
|
837
|
-
// Check if this row is selected
|
|
838
816
|
const actualRowIndex = this.state.rows.indexOf(row);
|
|
839
817
|
const isSelected = this.state.selectedIndexes.has(actualRowIndex);
|
|
840
818
|
if (isSelected) {
|
|
841
819
|
tr.classList.add('jux-table-row-selected');
|
|
842
820
|
}
|
|
843
|
-
// Add checkbox column if enabled
|
|
844
821
|
if (this.state.showCheckboxes) {
|
|
845
822
|
const checkboxTd = document.createElement('td');
|
|
846
823
|
checkboxTd.style.width = '40px';
|
|
@@ -852,29 +829,22 @@ export class Table extends BaseComponent {
|
|
|
852
829
|
checkboxTd.appendChild(checkbox);
|
|
853
830
|
tr.appendChild(checkboxTd);
|
|
854
831
|
}
|
|
855
|
-
// Add data columns (including computed columns)
|
|
856
832
|
this.state.columns.forEach(col => {
|
|
857
833
|
const td = document.createElement('td');
|
|
858
|
-
// ✨ NEW: Check if this is a computed column
|
|
859
834
|
const computedDef = this.state.computedColumns.get(col.key);
|
|
860
835
|
let cellValue;
|
|
861
836
|
let rendered;
|
|
862
837
|
if (computedDef) {
|
|
863
|
-
// ✨ Computed column: Evaluate compute function
|
|
864
838
|
cellValue = computedDef.compute(row, actualRowIndex);
|
|
865
|
-
// Use computed column's custom renderer if provided
|
|
866
839
|
if (computedDef.render) {
|
|
867
840
|
rendered = computedDef.render(cellValue, row, actualRowIndex);
|
|
868
841
|
}
|
|
869
842
|
else {
|
|
870
|
-
// Default: stringify the computed value
|
|
871
843
|
rendered = cellValue != null ? String(cellValue) : '';
|
|
872
844
|
}
|
|
873
845
|
}
|
|
874
846
|
else {
|
|
875
|
-
// Normal column: Get value from row data
|
|
876
847
|
cellValue = row[col.key];
|
|
877
|
-
// Use column's render function if provided
|
|
878
848
|
if (col.render) {
|
|
879
849
|
rendered = col.render(cellValue, row);
|
|
880
850
|
}
|
|
@@ -882,7 +852,6 @@ export class Table extends BaseComponent {
|
|
|
882
852
|
rendered = cellValue != null ? String(cellValue) : '';
|
|
883
853
|
}
|
|
884
854
|
}
|
|
885
|
-
// Insert rendered content
|
|
886
855
|
if (typeof rendered === 'string') {
|
|
887
856
|
td.innerHTML = rendered;
|
|
888
857
|
}
|
|
@@ -898,36 +867,17 @@ export class Table extends BaseComponent {
|
|
|
898
867
|
const headerRow = thead.querySelector('tr');
|
|
899
868
|
if (!headerRow)
|
|
900
869
|
return;
|
|
901
|
-
// Remove existing checkbox column(s)
|
|
902
870
|
const existingCheckboxThs = headerRow.querySelectorAll('th:first-child');
|
|
903
871
|
existingCheckboxThs.forEach(th => {
|
|
904
872
|
if (th.querySelector('.jux-bulk-checkbox') || th.textContent === '') {
|
|
905
873
|
th.remove();
|
|
906
874
|
}
|
|
907
875
|
});
|
|
908
|
-
// Add bulk checkbox or empty checkbox column
|
|
909
876
|
if (this.state.showBulkCheckbox) {
|
|
910
|
-
const bulkTh =
|
|
911
|
-
bulkTh.style.width = '40px';
|
|
912
|
-
bulkTh.style.textAlign = 'center';
|
|
913
|
-
const bulkCheckbox = document.createElement('input');
|
|
914
|
-
bulkCheckbox.type = 'checkbox';
|
|
915
|
-
bulkCheckbox.className = 'jux-bulk-checkbox';
|
|
916
|
-
bulkCheckbox.style.cursor = 'pointer';
|
|
917
|
-
bulkCheckbox.title = 'Select all';
|
|
918
|
-
bulkCheckbox.addEventListener('change', (e) => {
|
|
919
|
-
if (bulkCheckbox.checked) {
|
|
920
|
-
this.selectAll();
|
|
921
|
-
}
|
|
922
|
-
else {
|
|
923
|
-
this.deselectAll();
|
|
924
|
-
}
|
|
925
|
-
});
|
|
926
|
-
bulkTh.appendChild(bulkCheckbox);
|
|
877
|
+
const bulkTh = this._buildBulkCheckboxCell();
|
|
927
878
|
headerRow.insertBefore(bulkTh, headerRow.firstChild);
|
|
928
879
|
}
|
|
929
880
|
else if (this.state.showCheckboxes) {
|
|
930
|
-
// Add empty header cell for checkbox column (no bulk select)
|
|
931
881
|
const checkboxTh = document.createElement('th');
|
|
932
882
|
checkboxTh.style.width = '40px';
|
|
933
883
|
headerRow.insertBefore(checkboxTh, headerRow.firstChild);
|
|
@@ -960,38 +910,31 @@ export class Table extends BaseComponent {
|
|
|
960
910
|
const tbody = this._tableElement.querySelector('tbody');
|
|
961
911
|
if (!tbody)
|
|
962
912
|
return;
|
|
963
|
-
// Get current page rows
|
|
964
913
|
let rows = this._getFilteredRows();
|
|
965
914
|
rows = this._getSortedRows(rows);
|
|
966
915
|
const pageRows = this._getPaginatedRows(rows);
|
|
967
|
-
// Update each visible row's selection state
|
|
968
916
|
Array.from(tbody.children).forEach((tr, visualIndex) => {
|
|
969
917
|
const pageRowData = pageRows[visualIndex];
|
|
970
918
|
const actualRowIndex = this.state.rows.indexOf(pageRowData);
|
|
971
919
|
const isSelected = this.state.selectedIndexes.has(actualRowIndex);
|
|
972
|
-
// Update row highlight
|
|
973
920
|
if (isSelected) {
|
|
974
921
|
tr.classList.add('jux-table-row-selected');
|
|
975
922
|
}
|
|
976
923
|
else {
|
|
977
924
|
tr.classList.remove('jux-table-row-selected');
|
|
978
925
|
}
|
|
979
|
-
// Update checkbox if present
|
|
980
926
|
const checkbox = tr.querySelector('input[type="checkbox"]');
|
|
981
927
|
if (checkbox) {
|
|
982
928
|
checkbox.checked = isSelected;
|
|
983
929
|
}
|
|
984
930
|
});
|
|
985
|
-
// Update bulk checkbox state
|
|
986
931
|
this._updateBulkCheckboxState();
|
|
987
932
|
}
|
|
988
|
-
// Selection management
|
|
989
933
|
_preserveSelections(previousRows, newRows) {
|
|
990
934
|
if (!this.state.rowIdField || this.state.selectionBehavior === 'clear') {
|
|
991
935
|
this.state.selectedIndexes.clear();
|
|
992
936
|
return;
|
|
993
937
|
}
|
|
994
|
-
// Build map of old selections by ID
|
|
995
938
|
const selectedIds = new Set();
|
|
996
939
|
Array.from(this.state.selectedIndexes).forEach(index => {
|
|
997
940
|
const row = previousRows[index];
|
|
@@ -999,7 +942,6 @@ export class Table extends BaseComponent {
|
|
|
999
942
|
selectedIds.add(row[this.state.rowIdField]);
|
|
1000
943
|
}
|
|
1001
944
|
});
|
|
1002
|
-
// Find new indexes for selected IDs
|
|
1003
945
|
this.state.selectedIndexes.clear();
|
|
1004
946
|
newRows.forEach((row, index) => {
|
|
1005
947
|
const rowId = row[this.state.rowIdField];
|
|
@@ -1008,13 +950,10 @@ export class Table extends BaseComponent {
|
|
|
1008
950
|
}
|
|
1009
951
|
});
|
|
1010
952
|
}
|
|
1011
|
-
// Pagination
|
|
1012
953
|
_updatePagination(wrapper, tbody) {
|
|
1013
|
-
// Remove existing pagination
|
|
1014
954
|
const existingPagination = wrapper.querySelector('.jux-table-pagination');
|
|
1015
|
-
if (existingPagination)
|
|
955
|
+
if (existingPagination)
|
|
1016
956
|
existingPagination.remove();
|
|
1017
|
-
}
|
|
1018
957
|
let rows = this._getFilteredRows();
|
|
1019
958
|
rows = this._getSortedRows(rows);
|
|
1020
959
|
const totalPages = Math.ceil(rows.length / this.state.rowsPerPage);
|
|
@@ -1023,7 +962,6 @@ export class Table extends BaseComponent {
|
|
|
1023
962
|
const pagination = document.createElement('div');
|
|
1024
963
|
pagination.className = 'jux-table-pagination';
|
|
1025
964
|
pagination.style.cssText = 'margin-top: 10px; display: flex; gap: 5px; justify-content: center;';
|
|
1026
|
-
// Previous button
|
|
1027
965
|
const prevBtn = document.createElement('button');
|
|
1028
966
|
prevBtn.textContent = 'Previous';
|
|
1029
967
|
prevBtn.disabled = this.state.currentPage === 1;
|
|
@@ -1037,12 +975,10 @@ export class Table extends BaseComponent {
|
|
|
1037
975
|
}
|
|
1038
976
|
});
|
|
1039
977
|
pagination.appendChild(prevBtn);
|
|
1040
|
-
// Page info
|
|
1041
978
|
const pageInfo = document.createElement('span');
|
|
1042
979
|
pageInfo.textContent = `Page ${this.state.currentPage} of ${totalPages}`;
|
|
1043
980
|
pageInfo.style.cssText = 'display: flex; align-items: center; padding: 0 10px;';
|
|
1044
981
|
pagination.appendChild(pageInfo);
|
|
1045
|
-
// Next button
|
|
1046
982
|
const nextBtn = document.createElement('button');
|
|
1047
983
|
nextBtn.textContent = 'Next';
|
|
1048
984
|
nextBtn.disabled = this.state.currentPage === totalPages;
|