@tanstack/svelte-table 8.0.0-beta.8 → 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.
@@ -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
- return row.getValue(columnId).includes(filterValue);
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
- return row.getValue(columnId).toLowerCase() === filterValue.toLowerCase();
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
- return row.getValue(columnId).includes(filterValue);
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 => !row.getValue(columnId).includes(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 => row.getValue(columnId).includes(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);
@@ -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 instance.options.pageCount !== 'undefined' ? instance.options.pageCount - 1 : Number.MAX_SAFE_INTEGER;
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
@@ -3230,8 +3246,6 @@ function filterRows(rows, filterRowImpl, instance) {
3230
3246
  function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
3231
3247
  const newFilteredFlatRows = [];
3232
3248
  const newFilteredRowsById = {};
3233
- let row;
3234
- let newRow;
3235
3249
 
3236
3250
  const recurseFilterRows = function (rowsToFilter, depth) {
3237
3251
  if (depth === void 0) {
@@ -3243,10 +3257,10 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
3243
3257
  for (let i = 0; i < rowsToFilter.length; i++) {
3244
3258
  var _row$subRows;
3245
3259
 
3246
- row = rowsToFilter[i];
3260
+ let row = rowsToFilter[i];
3247
3261
 
3248
3262
  if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
3249
- newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3263
+ const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3250
3264
  newRow.columnFilters = row.columnFilters;
3251
3265
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3252
3266
 
@@ -3275,10 +3289,7 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
3275
3289
  }
3276
3290
  function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
3277
3291
  const newFilteredFlatRows = [];
3278
- const newFilteredRowsById = {};
3279
- let rows;
3280
- let row;
3281
- let newRow; // Filters top level and nested rows
3292
+ const newFilteredRowsById = {}; // Filters top level and nested rows
3282
3293
 
3283
3294
  const recurseFilterRows = function (rowsToFilter, depth) {
3284
3295
  if (depth === void 0) {
@@ -3286,17 +3297,17 @@ function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
3286
3297
  }
3287
3298
 
3288
3299
  // Filter from parents downward first
3289
- rows = []; // Apply the filter to any subRows
3300
+ const rows = []; // Apply the filter to any subRows
3290
3301
 
3291
3302
  for (let i = 0; i < rowsToFilter.length; i++) {
3292
- row = rowsToFilter[i];
3303
+ let row = rowsToFilter[i];
3293
3304
  const pass = filterRow(row);
3294
3305
 
3295
3306
  if (pass) {
3296
3307
  var _row$subRows2;
3297
3308
 
3298
3309
  if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
3299
- newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3310
+ const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3300
3311
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3301
3312
  row = newRow;
3302
3313
  }