@tanstack/svelte-table 8.0.0-alpha.70 → 8.0.0-alpha.73
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/build/cjs/table-core/build/esm/index.js +54 -37
- package/build/cjs/table-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +54 -37
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +36 -36
- package/build/umd/index.development.js +54 -37
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
package/build/esm/index.js
CHANGED
|
@@ -386,7 +386,7 @@ const Cells = {
|
|
|
386
386
|
row,
|
|
387
387
|
column,
|
|
388
388
|
getValue: () => row.getValue(columnId),
|
|
389
|
-
renderCell: () => column.cell ? instance.
|
|
389
|
+
renderCell: () => column.cell ? instance._render(column.cell, {
|
|
390
390
|
instance,
|
|
391
391
|
column,
|
|
392
392
|
row,
|
|
@@ -635,28 +635,28 @@ const ColumnSizing = {
|
|
|
635
635
|
var _instance$getHeaderGr, _instance$getHeaderGr2;
|
|
636
636
|
|
|
637
637
|
return (_instance$getHeaderGr = (_instance$getHeaderGr2 = instance.getHeaderGroups()[0]) == null ? void 0 : _instance$getHeaderGr2.headers.reduce((sum, header) => {
|
|
638
|
-
return sum + header.
|
|
638
|
+
return sum + header.getSize();
|
|
639
639
|
}, 0)) != null ? _instance$getHeaderGr : 0;
|
|
640
640
|
},
|
|
641
641
|
getLeftTotalSize: () => {
|
|
642
642
|
var _instance$getLeftHead, _instance$getLeftHead2;
|
|
643
643
|
|
|
644
644
|
return (_instance$getLeftHead = (_instance$getLeftHead2 = instance.getLeftHeaderGroups()[0]) == null ? void 0 : _instance$getLeftHead2.headers.reduce((sum, header) => {
|
|
645
|
-
return sum + header.
|
|
645
|
+
return sum + header.getSize();
|
|
646
646
|
}, 0)) != null ? _instance$getLeftHead : 0;
|
|
647
647
|
},
|
|
648
648
|
getCenterTotalSize: () => {
|
|
649
649
|
var _instance$getCenterHe, _instance$getCenterHe2;
|
|
650
650
|
|
|
651
651
|
return (_instance$getCenterHe = (_instance$getCenterHe2 = instance.getCenterHeaderGroups()[0]) == null ? void 0 : _instance$getCenterHe2.headers.reduce((sum, header) => {
|
|
652
|
-
return sum + header.
|
|
652
|
+
return sum + header.getSize();
|
|
653
653
|
}, 0)) != null ? _instance$getCenterHe : 0;
|
|
654
654
|
},
|
|
655
655
|
getRightTotalSize: () => {
|
|
656
656
|
var _instance$getRightHea, _instance$getRightHea2;
|
|
657
657
|
|
|
658
658
|
return (_instance$getRightHea = (_instance$getRightHea2 = instance.getRightHeaderGroups()[0]) == null ? void 0 : _instance$getRightHea2.headers.reduce((sum, header) => {
|
|
659
|
-
return sum + header.
|
|
659
|
+
return sum + header.getSize();
|
|
660
660
|
}, 0)) != null ? _instance$getRightHea : 0;
|
|
661
661
|
}
|
|
662
662
|
};
|
|
@@ -710,10 +710,14 @@ const Expanding = {
|
|
|
710
710
|
},
|
|
711
711
|
createInstance: instance => {
|
|
712
712
|
let registered = false;
|
|
713
|
+
let queued = false;
|
|
713
714
|
return {
|
|
714
715
|
_autoResetExpanded: () => {
|
|
715
716
|
if (!registered) {
|
|
716
|
-
|
|
717
|
+
instance._queue(() => {
|
|
718
|
+
registered = true;
|
|
719
|
+
});
|
|
720
|
+
|
|
717
721
|
return;
|
|
718
722
|
}
|
|
719
723
|
|
|
@@ -722,7 +726,13 @@ const Expanding = {
|
|
|
722
726
|
}
|
|
723
727
|
|
|
724
728
|
if (instance.options.autoResetAll === true || instance.options.autoResetExpanded) {
|
|
725
|
-
|
|
729
|
+
if (queued) return;
|
|
730
|
+
queued = true;
|
|
731
|
+
|
|
732
|
+
instance._queue(() => {
|
|
733
|
+
instance.resetExpanded();
|
|
734
|
+
queued = false;
|
|
735
|
+
});
|
|
726
736
|
}
|
|
727
737
|
},
|
|
728
738
|
setExpanded: updater => instance.options.onExpandedChange == null ? void 0 : instance.options.onExpandedChange(updater),
|
|
@@ -1075,7 +1085,7 @@ const Filters = {
|
|
|
1075
1085
|
_getFacetedMinMaxValues: instance.options.getFacetedMinMaxValues && instance.options.getFacetedMinMaxValues(instance, column.id),
|
|
1076
1086
|
getFacetedMinMaxValues: () => {
|
|
1077
1087
|
if (!column._getFacetedMinMaxValues) {
|
|
1078
|
-
return
|
|
1088
|
+
return undefined;
|
|
1079
1089
|
}
|
|
1080
1090
|
|
|
1081
1091
|
return column._getFacetedMinMaxValues();
|
|
@@ -1166,7 +1176,7 @@ const Filters = {
|
|
|
1166
1176
|
_getGlobalFacetedMinMaxValues: instance.options.getFacetedMinMaxValues && instance.options.getFacetedMinMaxValues(instance, '__global__'),
|
|
1167
1177
|
getGlobalFacetedMinMaxValues: () => {
|
|
1168
1178
|
if (!instance._getGlobalFacetedMinMaxValues) {
|
|
1169
|
-
return
|
|
1179
|
+
return;
|
|
1170
1180
|
}
|
|
1171
1181
|
|
|
1172
1182
|
return instance._getGlobalFacetedMinMaxValues();
|
|
@@ -1403,7 +1413,7 @@ const Grouping = {
|
|
|
1403
1413
|
var _column$aggregatedCel;
|
|
1404
1414
|
|
|
1405
1415
|
const template = (_column$aggregatedCel = column.aggregatedCell) != null ? _column$aggregatedCel : column.cell;
|
|
1406
|
-
return template ? instance.
|
|
1416
|
+
return template ? instance._render(template, {
|
|
1407
1417
|
instance,
|
|
1408
1418
|
column,
|
|
1409
1419
|
row,
|
|
@@ -1504,25 +1514,32 @@ const Pagination = {
|
|
|
1504
1514
|
},
|
|
1505
1515
|
getDefaultOptions: instance => {
|
|
1506
1516
|
return {
|
|
1507
|
-
onPaginationChange: makeStateUpdater('pagination', instance)
|
|
1508
|
-
autoResetPageIndex: true
|
|
1517
|
+
onPaginationChange: makeStateUpdater('pagination', instance)
|
|
1509
1518
|
};
|
|
1510
1519
|
},
|
|
1511
1520
|
createInstance: instance => {
|
|
1512
1521
|
let registered = false;
|
|
1522
|
+
let queued = false;
|
|
1513
1523
|
return {
|
|
1514
1524
|
_autoResetPageIndex: () => {
|
|
1525
|
+
var _ref, _instance$options$aut;
|
|
1526
|
+
|
|
1515
1527
|
if (!registered) {
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1528
|
+
instance._queue(() => {
|
|
1529
|
+
registered = true;
|
|
1530
|
+
});
|
|
1519
1531
|
|
|
1520
|
-
if (instance.options.autoResetAll === false) {
|
|
1521
1532
|
return;
|
|
1522
1533
|
}
|
|
1523
1534
|
|
|
1524
|
-
if (instance.options.autoResetAll
|
|
1525
|
-
|
|
1535
|
+
if ((_ref = (_instance$options$aut = instance.options.autoResetAll) != null ? _instance$options$aut : instance.options.autoResetPageIndex) != null ? _ref : !instance.options.manualPagination) {
|
|
1536
|
+
if (queued) return;
|
|
1537
|
+
queued = true;
|
|
1538
|
+
|
|
1539
|
+
instance._queue(() => {
|
|
1540
|
+
instance.resetPageIndex();
|
|
1541
|
+
queued = false;
|
|
1542
|
+
});
|
|
1526
1543
|
}
|
|
1527
1544
|
},
|
|
1528
1545
|
setPagination: updater => {
|
|
@@ -1541,7 +1558,7 @@ const Pagination = {
|
|
|
1541
1558
|
setPageIndex: updater => {
|
|
1542
1559
|
instance.setPagination(old => {
|
|
1543
1560
|
let pageIndex = functionalUpdate(updater, old.pageIndex);
|
|
1544
|
-
const maxPageIndex =
|
|
1561
|
+
const maxPageIndex = typeof old.pageCount !== 'undefined' ? old.pageCount - 1 : Number.MAX_SAFE_INTEGER;
|
|
1545
1562
|
pageIndex = Math.min(Math.max(0, pageIndex), maxPageIndex);
|
|
1546
1563
|
return { ...old,
|
|
1547
1564
|
pageIndex
|
|
@@ -2652,12 +2669,12 @@ const Headers = {
|
|
|
2652
2669
|
recurseHeader(header);
|
|
2653
2670
|
return leafHeaders;
|
|
2654
2671
|
},
|
|
2655
|
-
renderHeader: () => column.header ? instance.
|
|
2672
|
+
renderHeader: () => column.header ? instance._render(column.header, {
|
|
2656
2673
|
instance,
|
|
2657
2674
|
header: header,
|
|
2658
2675
|
column
|
|
2659
2676
|
}) : null,
|
|
2660
|
-
renderFooter: () => column.footer ? instance.
|
|
2677
|
+
renderFooter: () => column.footer ? instance._render(column.footer, {
|
|
2661
2678
|
instance,
|
|
2662
2679
|
header: header,
|
|
2663
2680
|
column
|
|
@@ -3131,7 +3148,7 @@ function createTableInstance$1(options) {
|
|
|
3131
3148
|
...options
|
|
3132
3149
|
},
|
|
3133
3150
|
initialState,
|
|
3134
|
-
|
|
3151
|
+
_queue: cb => {
|
|
3135
3152
|
queued.push(cb);
|
|
3136
3153
|
|
|
3137
3154
|
if (!queuedTimeout) {
|
|
@@ -3189,7 +3206,7 @@ function createTableInstance$1(options) {
|
|
|
3189
3206
|
const newOptions = functionalUpdate(updater, instance.options);
|
|
3190
3207
|
instance.options = mergeOptions(newOptions);
|
|
3191
3208
|
},
|
|
3192
|
-
|
|
3209
|
+
_render: (template, props) => {
|
|
3193
3210
|
if (typeof instance.options.render === 'function') {
|
|
3194
3211
|
return instance.options.render(template, props);
|
|
3195
3212
|
}
|
|
@@ -3363,9 +3380,7 @@ function getCoreRowModel() {
|
|
|
3363
3380
|
return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
|
|
3364
3381
|
},
|
|
3365
3382
|
onChange: () => {
|
|
3366
|
-
instance.
|
|
3367
|
-
instance._autoResetPageIndex();
|
|
3368
|
-
});
|
|
3383
|
+
instance._autoResetPageIndex();
|
|
3369
3384
|
}
|
|
3370
3385
|
});
|
|
3371
3386
|
}
|
|
@@ -3571,9 +3586,7 @@ function getFilteredRowModel() {
|
|
|
3571
3586
|
return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
|
|
3572
3587
|
},
|
|
3573
3588
|
onChange: () => {
|
|
3574
|
-
instance.
|
|
3575
|
-
instance._autoResetPageIndex();
|
|
3576
|
-
});
|
|
3589
|
+
instance._autoResetPageIndex();
|
|
3577
3590
|
}
|
|
3578
3591
|
});
|
|
3579
3592
|
}
|
|
@@ -3641,14 +3654,20 @@ function getFacetedUniqueValues() {
|
|
|
3641
3654
|
|
|
3642
3655
|
function getFacetedMinMaxValues() {
|
|
3643
3656
|
return (instance, columnId) => memo(() => [instance.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
|
|
3644
|
-
var _facetedRowModel$flat
|
|
3657
|
+
var _facetedRowModel$flat;
|
|
3645
3658
|
|
|
3646
|
-
|
|
3659
|
+
const firstValue = (_facetedRowModel$flat = facetedRowModel.flatRows[0]) == null ? void 0 : _facetedRowModel$flat.getValue(columnId);
|
|
3660
|
+
|
|
3661
|
+
if (typeof firstValue === 'undefined') {
|
|
3662
|
+
return undefined;
|
|
3663
|
+
}
|
|
3664
|
+
|
|
3665
|
+
let facetedMinMaxValues = [firstValue, firstValue];
|
|
3647
3666
|
|
|
3648
3667
|
for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
|
|
3649
|
-
var _facetedRowModel$
|
|
3668
|
+
var _facetedRowModel$flat2;
|
|
3650
3669
|
|
|
3651
|
-
const value = (_facetedRowModel$
|
|
3670
|
+
const value = (_facetedRowModel$flat2 = facetedRowModel.flatRows[i]) == null ? void 0 : _facetedRowModel$flat2.getValue(columnId);
|
|
3652
3671
|
|
|
3653
3672
|
if (value < facetedMinMaxValues[0]) {
|
|
3654
3673
|
facetedMinMaxValues[0] = value;
|
|
@@ -3756,9 +3775,7 @@ function getSortedRowModel() {
|
|
|
3756
3775
|
return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
|
|
3757
3776
|
},
|
|
3758
3777
|
onChange: () => {
|
|
3759
|
-
instance.
|
|
3760
|
-
instance._autoResetPageIndex();
|
|
3761
|
-
});
|
|
3778
|
+
instance._autoResetPageIndex();
|
|
3762
3779
|
}
|
|
3763
3780
|
});
|
|
3764
3781
|
}
|
|
@@ -3888,7 +3905,7 @@ function getGroupedRowModel() {
|
|
|
3888
3905
|
return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
|
|
3889
3906
|
},
|
|
3890
3907
|
onChange: () => {
|
|
3891
|
-
instance.
|
|
3908
|
+
instance._queue(() => {
|
|
3892
3909
|
instance._autoResetExpanded();
|
|
3893
3910
|
|
|
3894
3911
|
instance._autoResetPageIndex();
|