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