@tanstack/svelte-table 8.0.0-beta.6 → 8.0.0-beta.9
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 +35 -30
- package/build/cjs/table-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +35 -30
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +47 -47
- package/build/umd/index.development.js +35 -30
- 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
|
@@ -982,38 +982,54 @@ const Expanding = {
|
|
|
982
982
|
};
|
|
983
983
|
|
|
984
984
|
const includesString = (row, columnId, filterValue) => {
|
|
985
|
+
var _row$getValue;
|
|
986
|
+
|
|
985
987
|
const search = filterValue.toLowerCase();
|
|
986
|
-
return row.getValue(columnId).toLowerCase().includes(search);
|
|
988
|
+
return (_row$getValue = row.getValue(columnId)) == null ? void 0 : _row$getValue.toLowerCase().includes(search);
|
|
987
989
|
};
|
|
988
990
|
|
|
989
991
|
includesString.autoRemove = val => testFalsey(val);
|
|
990
992
|
|
|
991
993
|
const includesStringSensitive = (row, columnId, filterValue) => {
|
|
992
|
-
|
|
994
|
+
var _row$getValue2;
|
|
995
|
+
|
|
996
|
+
return (_row$getValue2 = row.getValue(columnId)) == null ? void 0 : _row$getValue2.includes(filterValue);
|
|
993
997
|
};
|
|
994
998
|
|
|
995
999
|
includesStringSensitive.autoRemove = val => testFalsey(val);
|
|
996
1000
|
|
|
997
1001
|
const equalsString = (row, columnId, filterValue) => {
|
|
998
|
-
|
|
1002
|
+
var _row$getValue3;
|
|
1003
|
+
|
|
1004
|
+
return ((_row$getValue3 = row.getValue(columnId)) == null ? void 0 : _row$getValue3.toLowerCase()) === filterValue.toLowerCase();
|
|
999
1005
|
};
|
|
1000
1006
|
|
|
1001
1007
|
equalsString.autoRemove = val => testFalsey(val);
|
|
1002
1008
|
|
|
1003
1009
|
const arrIncludes = (row, columnId, filterValue) => {
|
|
1004
|
-
|
|
1010
|
+
var _row$getValue4;
|
|
1011
|
+
|
|
1012
|
+
return (_row$getValue4 = row.getValue(columnId)) == null ? void 0 : _row$getValue4.includes(filterValue);
|
|
1005
1013
|
};
|
|
1006
1014
|
|
|
1007
1015
|
arrIncludes.autoRemove = val => testFalsey(val) || !(val != null && val.length);
|
|
1008
1016
|
|
|
1009
1017
|
const arrIncludesAll = (row, columnId, filterValue) => {
|
|
1010
|
-
return !filterValue.some(val =>
|
|
1018
|
+
return !filterValue.some(val => {
|
|
1019
|
+
var _row$getValue5;
|
|
1020
|
+
|
|
1021
|
+
return !((_row$getValue5 = row.getValue(columnId)) != null && _row$getValue5.includes(val));
|
|
1022
|
+
});
|
|
1011
1023
|
};
|
|
1012
1024
|
|
|
1013
1025
|
arrIncludesAll.autoRemove = val => testFalsey(val) || !(val != null && val.length);
|
|
1014
1026
|
|
|
1015
1027
|
const arrIncludesSome = (row, columnId, filterValue) => {
|
|
1016
|
-
return filterValue.some(val =>
|
|
1028
|
+
return filterValue.some(val => {
|
|
1029
|
+
var _row$getValue6;
|
|
1030
|
+
|
|
1031
|
+
return (_row$getValue6 = row.getValue(columnId)) == null ? void 0 : _row$getValue6.includes(val);
|
|
1032
|
+
});
|
|
1017
1033
|
};
|
|
1018
1034
|
|
|
1019
1035
|
arrIncludesSome.autoRemove = val => testFalsey(val) || !(val != null && val.length);
|
|
@@ -1543,7 +1559,7 @@ const Grouping = {
|
|
|
1543
1559
|
getIsAggregated: () => {
|
|
1544
1560
|
var _row$subRows;
|
|
1545
1561
|
|
|
1546
|
-
return !cell.getIsGrouped() && !cell.getIsPlaceholder() && ((_row$subRows = row.subRows)
|
|
1562
|
+
return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
|
|
1547
1563
|
},
|
|
1548
1564
|
renderAggregatedCell: () => {
|
|
1549
1565
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -1698,7 +1714,7 @@ const Pagination = {
|
|
|
1698
1714
|
setPageIndex: updater => {
|
|
1699
1715
|
instance.setPagination(old => {
|
|
1700
1716
|
let pageIndex = functionalUpdate(updater, old.pageIndex);
|
|
1701
|
-
const maxPageIndex = typeof
|
|
1717
|
+
const maxPageIndex = typeof instance.options.pageCount === 'undefined' || instance.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : instance.options.pageCount - 1;
|
|
1702
1718
|
pageIndex = Math.min(Math.max(0, pageIndex), maxPageIndex);
|
|
1703
1719
|
return { ...old,
|
|
1704
1720
|
pageIndex
|
|
@@ -1727,9 +1743,9 @@ const Pagination = {
|
|
|
1727
1743
|
});
|
|
1728
1744
|
},
|
|
1729
1745
|
setPageCount: updater => instance.setPagination(old => {
|
|
1730
|
-
var
|
|
1746
|
+
var _instance$options$pag;
|
|
1731
1747
|
|
|
1732
|
-
let newPageCount = functionalUpdate(updater, (
|
|
1748
|
+
let newPageCount = functionalUpdate(updater, (_instance$options$pag = instance.options.pageCount) != null ? _instance$options$pag : -1);
|
|
1733
1749
|
|
|
1734
1750
|
if (typeof newPageCount === 'number') {
|
|
1735
1751
|
newPageCount = Math.max(-1, newPageCount);
|
|
@@ -1739,7 +1755,7 @@ const Pagination = {
|
|
|
1739
1755
|
pageCount: newPageCount
|
|
1740
1756
|
};
|
|
1741
1757
|
}),
|
|
1742
|
-
getPageOptions: memo(() => [instance.
|
|
1758
|
+
getPageOptions: memo(() => [instance.getPageCount()], pageCount => {
|
|
1743
1759
|
let pageOptions = [];
|
|
1744
1760
|
|
|
1745
1761
|
if (pageCount && pageCount > 0) {
|
|
@@ -1793,15 +1809,9 @@ const Pagination = {
|
|
|
1793
1809
|
return instance._getPaginationRowModel();
|
|
1794
1810
|
},
|
|
1795
1811
|
getPageCount: () => {
|
|
1796
|
-
|
|
1797
|
-
pageCount
|
|
1798
|
-
} = instance.getState().pagination;
|
|
1812
|
+
var _instance$options$pag2;
|
|
1799
1813
|
|
|
1800
|
-
|
|
1801
|
-
return pageCount;
|
|
1802
|
-
}
|
|
1803
|
-
|
|
1804
|
-
return Math.ceil(instance.getPrePaginationRowModel().rows.length / instance.getState().pagination.pageSize);
|
|
1814
|
+
return (_instance$options$pag2 = instance.options.pageCount) != null ? _instance$options$pag2 : Math.ceil(instance.getPrePaginationRowModel().rows.length / instance.getState().pagination.pageSize);
|
|
1805
1815
|
}
|
|
1806
1816
|
};
|
|
1807
1817
|
}
|
|
@@ -3236,8 +3246,6 @@ function filterRows(rows, filterRowImpl, instance) {
|
|
|
3236
3246
|
function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
|
|
3237
3247
|
const newFilteredFlatRows = [];
|
|
3238
3248
|
const newFilteredRowsById = {};
|
|
3239
|
-
let row;
|
|
3240
|
-
let newRow;
|
|
3241
3249
|
|
|
3242
3250
|
const recurseFilterRows = function (rowsToFilter, depth) {
|
|
3243
3251
|
if (depth === void 0) {
|
|
@@ -3249,10 +3257,10 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
|
|
|
3249
3257
|
for (let i = 0; i < rowsToFilter.length; i++) {
|
|
3250
3258
|
var _row$subRows;
|
|
3251
3259
|
|
|
3252
|
-
row = rowsToFilter[i];
|
|
3260
|
+
let row = rowsToFilter[i];
|
|
3253
3261
|
|
|
3254
3262
|
if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
|
|
3255
|
-
newRow = createRow(instance, row.id, row.original, row.index, row.depth);
|
|
3263
|
+
const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
|
|
3256
3264
|
newRow.columnFilters = row.columnFilters;
|
|
3257
3265
|
newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
|
|
3258
3266
|
|
|
@@ -3281,10 +3289,7 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
|
|
|
3281
3289
|
}
|
|
3282
3290
|
function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
|
|
3283
3291
|
const newFilteredFlatRows = [];
|
|
3284
|
-
const newFilteredRowsById = {};
|
|
3285
|
-
let rows;
|
|
3286
|
-
let row;
|
|
3287
|
-
let newRow; // Filters top level and nested rows
|
|
3292
|
+
const newFilteredRowsById = {}; // Filters top level and nested rows
|
|
3288
3293
|
|
|
3289
3294
|
const recurseFilterRows = function (rowsToFilter, depth) {
|
|
3290
3295
|
if (depth === void 0) {
|
|
@@ -3292,17 +3297,17 @@ function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
|
|
|
3292
3297
|
}
|
|
3293
3298
|
|
|
3294
3299
|
// Filter from parents downward first
|
|
3295
|
-
rows = []; // Apply the filter to any subRows
|
|
3300
|
+
const rows = []; // Apply the filter to any subRows
|
|
3296
3301
|
|
|
3297
3302
|
for (let i = 0; i < rowsToFilter.length; i++) {
|
|
3298
|
-
row = rowsToFilter[i];
|
|
3303
|
+
let row = rowsToFilter[i];
|
|
3299
3304
|
const pass = filterRow(row);
|
|
3300
3305
|
|
|
3301
3306
|
if (pass) {
|
|
3302
3307
|
var _row$subRows2;
|
|
3303
3308
|
|
|
3304
3309
|
if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
|
|
3305
|
-
newRow = createRow(instance, row.id, row.original, row.index, row.depth);
|
|
3310
|
+
const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
|
|
3306
3311
|
newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
|
|
3307
3312
|
row = newRow;
|
|
3308
3313
|
}
|