@tanstack/svelte-table 8.0.0-beta.8 → 8.0.4

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.
@@ -2669,7 +2669,7 @@ var drawChart = (function (exports) {
2669
2669
  </script>
2670
2670
  <script>
2671
2671
  /*<!--*/
2672
- const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"name":"packages","children":[{"name":"table-core/build/esm/index.js","uid":"6e21-163"},{"name":"svelte-table/src","children":[{"uid":"6e21-165","name":"placeholder.svelte"},{"uid":"6e21-167","name":"placeholder.ts"},{"uid":"6e21-169","name":"render-component.ts"},{"uid":"6e21-171","name":"index.ts"}]}]}]}],"isRoot":true},"nodeParts":{"6e21-163":{"renderedLength":138742,"gzipLength":23601,"brotliLength":0,"mainUid":"6e21-162"},"6e21-165":{"renderedLength":927,"gzipLength":445,"brotliLength":0,"mainUid":"6e21-164"},"6e21-167":{"renderedLength":246,"gzipLength":184,"brotliLength":0,"mainUid":"6e21-166"},"6e21-169":{"renderedLength":1458,"gzipLength":539,"brotliLength":0,"mainUid":"6e21-168"},"6e21-171":{"renderedLength":3046,"gzipLength":993,"brotliLength":0,"mainUid":"6e21-170"}},"nodeMetas":{"6e21-162":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"6e21-163"},"imported":[],"importedBy":[{"uid":"6e21-170"}]},"6e21-164":{"id":"/packages/svelte-table/src/placeholder.svelte","moduleParts":{"index.production.js":"6e21-165"},"imported":[{"uid":"6e21-172"}],"importedBy":[{"uid":"6e21-166"}]},"6e21-166":{"id":"/packages/svelte-table/src/placeholder.ts","moduleParts":{"index.production.js":"6e21-167"},"imported":[{"uid":"6e21-172"},{"uid":"6e21-164"}],"importedBy":[{"uid":"6e21-170"}]},"6e21-168":{"id":"/packages/svelte-table/src/render-component.ts","moduleParts":{"index.production.js":"6e21-169"},"imported":[{"uid":"6e21-172"}],"importedBy":[{"uid":"6e21-170"}]},"6e21-170":{"id":"/packages/svelte-table/src/index.ts","moduleParts":{"index.production.js":"6e21-171"},"imported":[{"uid":"6e21-162"},{"uid":"6e21-166"},{"uid":"6e21-172"},{"uid":"6e21-173"},{"uid":"6e21-168"}],"importedBy":[],"isEntry":true},"6e21-172":{"id":"svelte/internal","moduleParts":{},"imported":[],"importedBy":[{"uid":"6e21-170"},{"uid":"6e21-166"},{"uid":"6e21-168"},{"uid":"6e21-164"}],"isExternal":true},"6e21-173":{"id":"svelte/store","moduleParts":{},"imported":[],"importedBy":[{"uid":"6e21-170"}],"isExternal":true}},"env":{"rollup":"2.70.2"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
2672
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"name":"packages","children":[{"name":"table-core/build/esm/index.js","uid":"edd0-163"},{"name":"svelte-table/src","children":[{"uid":"edd0-165","name":"placeholder.svelte"},{"uid":"edd0-167","name":"placeholder.ts"},{"uid":"edd0-169","name":"render-component.ts"},{"uid":"edd0-171","name":"index.ts"}]}]}]}],"isRoot":true},"nodeParts":{"edd0-163":{"renderedLength":139119,"gzipLength":23690,"brotliLength":0,"mainUid":"edd0-162"},"edd0-165":{"renderedLength":927,"gzipLength":445,"brotliLength":0,"mainUid":"edd0-164"},"edd0-167":{"renderedLength":246,"gzipLength":184,"brotliLength":0,"mainUid":"edd0-166"},"edd0-169":{"renderedLength":1458,"gzipLength":539,"brotliLength":0,"mainUid":"edd0-168"},"edd0-171":{"renderedLength":3046,"gzipLength":993,"brotliLength":0,"mainUid":"edd0-170"}},"nodeMetas":{"edd0-162":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"edd0-163"},"imported":[],"importedBy":[{"uid":"edd0-170"}]},"edd0-164":{"id":"/packages/svelte-table/src/placeholder.svelte","moduleParts":{"index.production.js":"edd0-165"},"imported":[{"uid":"edd0-172"}],"importedBy":[{"uid":"edd0-166"}]},"edd0-166":{"id":"/packages/svelte-table/src/placeholder.ts","moduleParts":{"index.production.js":"edd0-167"},"imported":[{"uid":"edd0-172"},{"uid":"edd0-164"}],"importedBy":[{"uid":"edd0-170"}]},"edd0-168":{"id":"/packages/svelte-table/src/render-component.ts","moduleParts":{"index.production.js":"edd0-169"},"imported":[{"uid":"edd0-172"}],"importedBy":[{"uid":"edd0-170"}]},"edd0-170":{"id":"/packages/svelte-table/src/index.ts","moduleParts":{"index.production.js":"edd0-171"},"imported":[{"uid":"edd0-162"},{"uid":"edd0-166"},{"uid":"edd0-172"},{"uid":"edd0-173"},{"uid":"edd0-168"}],"importedBy":[],"isEntry":true},"edd0-172":{"id":"svelte/internal","moduleParts":{},"imported":[],"importedBy":[{"uid":"edd0-170"},{"uid":"edd0-166"},{"uid":"edd0-168"},{"uid":"edd0-164"}],"isExternal":true},"edd0-173":{"id":"svelte/store","moduleParts":{},"imported":[],"importedBy":[{"uid":"edd0-170"}],"isExternal":true}},"env":{"rollup":"2.75.7"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
2673
2673
 
2674
2674
  const run = () => {
2675
2675
  const width = window.innerWidth;
@@ -983,38 +983,54 @@
983
983
  };
984
984
 
985
985
  const includesString = (row, columnId, filterValue) => {
986
+ var _row$getValue;
987
+
986
988
  const search = filterValue.toLowerCase();
987
- return row.getValue(columnId).toLowerCase().includes(search);
989
+ return (_row$getValue = row.getValue(columnId)) == null ? void 0 : _row$getValue.toLowerCase().includes(search);
988
990
  };
989
991
 
990
992
  includesString.autoRemove = val => testFalsey(val);
991
993
 
992
994
  const includesStringSensitive = (row, columnId, filterValue) => {
993
- return row.getValue(columnId).includes(filterValue);
995
+ var _row$getValue2;
996
+
997
+ return (_row$getValue2 = row.getValue(columnId)) == null ? void 0 : _row$getValue2.includes(filterValue);
994
998
  };
995
999
 
996
1000
  includesStringSensitive.autoRemove = val => testFalsey(val);
997
1001
 
998
1002
  const equalsString = (row, columnId, filterValue) => {
999
- return row.getValue(columnId).toLowerCase() === filterValue.toLowerCase();
1003
+ var _row$getValue3;
1004
+
1005
+ return ((_row$getValue3 = row.getValue(columnId)) == null ? void 0 : _row$getValue3.toLowerCase()) === filterValue.toLowerCase();
1000
1006
  };
1001
1007
 
1002
1008
  equalsString.autoRemove = val => testFalsey(val);
1003
1009
 
1004
1010
  const arrIncludes = (row, columnId, filterValue) => {
1005
- return row.getValue(columnId).includes(filterValue);
1011
+ var _row$getValue4;
1012
+
1013
+ return (_row$getValue4 = row.getValue(columnId)) == null ? void 0 : _row$getValue4.includes(filterValue);
1006
1014
  };
1007
1015
 
1008
1016
  arrIncludes.autoRemove = val => testFalsey(val) || !(val != null && val.length);
1009
1017
 
1010
1018
  const arrIncludesAll = (row, columnId, filterValue) => {
1011
- return !filterValue.some(val => !row.getValue(columnId).includes(val));
1019
+ return !filterValue.some(val => {
1020
+ var _row$getValue5;
1021
+
1022
+ return !((_row$getValue5 = row.getValue(columnId)) != null && _row$getValue5.includes(val));
1023
+ });
1012
1024
  };
1013
1025
 
1014
1026
  arrIncludesAll.autoRemove = val => testFalsey(val) || !(val != null && val.length);
1015
1027
 
1016
1028
  const arrIncludesSome = (row, columnId, filterValue) => {
1017
- return filterValue.some(val => row.getValue(columnId).includes(val));
1029
+ return filterValue.some(val => {
1030
+ var _row$getValue6;
1031
+
1032
+ return (_row$getValue6 = row.getValue(columnId)) == null ? void 0 : _row$getValue6.includes(val);
1033
+ });
1018
1034
  };
1019
1035
 
1020
1036
  arrIncludesSome.autoRemove = val => testFalsey(val) || !(val != null && val.length);
@@ -1319,7 +1335,10 @@
1319
1335
  const sum = (columnId, _leafRows, childRows) => {
1320
1336
  // It's faster to just add the aggregations together instead of
1321
1337
  // process leaf nodes individually
1322
- return childRows.reduce((sum, next) => sum + (typeof next === 'number' ? next : 0), 0);
1338
+ return childRows.reduce((sum, next) => {
1339
+ const nextValue = next.getValue(columnId);
1340
+ return sum + (typeof nextValue === 'number' ? nextValue : 0);
1341
+ }, 0);
1323
1342
  };
1324
1343
 
1325
1344
  const min = (columnId, _leafRows, childRows) => {
@@ -1699,7 +1718,7 @@
1699
1718
  setPageIndex: updater => {
1700
1719
  instance.setPagination(old => {
1701
1720
  let pageIndex = functionalUpdate(updater, old.pageIndex);
1702
- const maxPageIndex = typeof instance.options.pageCount !== 'undefined' ? instance.options.pageCount - 1 : Number.MAX_SAFE_INTEGER;
1721
+ const maxPageIndex = typeof instance.options.pageCount === 'undefined' || instance.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : instance.options.pageCount - 1;
1703
1722
  pageIndex = Math.min(Math.max(0, pageIndex), maxPageIndex);
1704
1723
  return { ...old,
1705
1724
  pageIndex
@@ -2292,9 +2311,6 @@
2292
2311
  const newSelectedRowsById = {}; // Filters top level and nested rows
2293
2312
 
2294
2313
  const recurseRows = function (rows, depth) {
2295
- if (depth === void 0) {
2296
- depth = 0;
2297
- }
2298
2314
 
2299
2315
  return rows.map(row => {
2300
2316
  var _row$subRows2;
@@ -2308,7 +2324,7 @@
2308
2324
 
2309
2325
  if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
2310
2326
  row = { ...row,
2311
- subRows: recurseRows(row.subRows, depth + 1)
2327
+ subRows: recurseRows(row.subRows)
2312
2328
  };
2313
2329
  }
2314
2330
 
@@ -3229,25 +3245,20 @@
3229
3245
  function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
3230
3246
  const newFilteredFlatRows = [];
3231
3247
  const newFilteredRowsById = {};
3232
- let row;
3233
- let newRow;
3234
3248
 
3235
3249
  const recurseFilterRows = function (rowsToFilter, depth) {
3236
- if (depth === void 0) {
3237
- depth = 0;
3238
- }
3239
3250
 
3240
3251
  const rows = []; // Filter from children up first
3241
3252
 
3242
3253
  for (let i = 0; i < rowsToFilter.length; i++) {
3243
3254
  var _row$subRows;
3244
3255
 
3245
- row = rowsToFilter[i];
3256
+ let row = rowsToFilter[i];
3246
3257
 
3247
3258
  if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
3248
- newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3259
+ const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3249
3260
  newRow.columnFilters = row.columnFilters;
3250
- newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3261
+ newRow.subRows = recurseFilterRows(row.subRows);
3251
3262
 
3252
3263
  if (!newRow.subRows.length) {
3253
3264
  continue;
@@ -3274,29 +3285,23 @@
3274
3285
  }
3275
3286
  function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
3276
3287
  const newFilteredFlatRows = [];
3277
- const newFilteredRowsById = {};
3278
- let rows;
3279
- let row;
3280
- let newRow; // Filters top level and nested rows
3288
+ const newFilteredRowsById = {}; // Filters top level and nested rows
3281
3289
 
3282
3290
  const recurseFilterRows = function (rowsToFilter, depth) {
3283
- if (depth === void 0) {
3284
- depth = 0;
3285
- }
3286
3291
 
3287
3292
  // Filter from parents downward first
3288
- rows = []; // Apply the filter to any subRows
3293
+ const rows = []; // Apply the filter to any subRows
3289
3294
 
3290
3295
  for (let i = 0; i < rowsToFilter.length; i++) {
3291
- row = rowsToFilter[i];
3296
+ let row = rowsToFilter[i];
3292
3297
  const pass = filterRow(row);
3293
3298
 
3294
3299
  if (pass) {
3295
3300
  var _row$subRows2;
3296
3301
 
3297
3302
  if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
3298
- newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3299
- newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3303
+ const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3304
+ newRow.subRows = recurseFilterRows(row.subRows);
3300
3305
  row = newRow;
3301
3306
  }
3302
3307