@tanstack/table-core 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.
@@ -973,38 +973,54 @@
973
973
  };
974
974
 
975
975
  const includesString = (row, columnId, filterValue) => {
976
+ var _row$getValue;
977
+
976
978
  const search = filterValue.toLowerCase();
977
- return row.getValue(columnId).toLowerCase().includes(search);
979
+ return (_row$getValue = row.getValue(columnId)) == null ? void 0 : _row$getValue.toLowerCase().includes(search);
978
980
  };
979
981
 
980
982
  includesString.autoRemove = val => testFalsey(val);
981
983
 
982
984
  const includesStringSensitive = (row, columnId, filterValue) => {
983
- return row.getValue(columnId).includes(filterValue);
985
+ var _row$getValue2;
986
+
987
+ return (_row$getValue2 = row.getValue(columnId)) == null ? void 0 : _row$getValue2.includes(filterValue);
984
988
  };
985
989
 
986
990
  includesStringSensitive.autoRemove = val => testFalsey(val);
987
991
 
988
992
  const equalsString = (row, columnId, filterValue) => {
989
- return row.getValue(columnId).toLowerCase() === filterValue.toLowerCase();
993
+ var _row$getValue3;
994
+
995
+ return ((_row$getValue3 = row.getValue(columnId)) == null ? void 0 : _row$getValue3.toLowerCase()) === filterValue.toLowerCase();
990
996
  };
991
997
 
992
998
  equalsString.autoRemove = val => testFalsey(val);
993
999
 
994
1000
  const arrIncludes = (row, columnId, filterValue) => {
995
- return row.getValue(columnId).includes(filterValue);
1001
+ var _row$getValue4;
1002
+
1003
+ return (_row$getValue4 = row.getValue(columnId)) == null ? void 0 : _row$getValue4.includes(filterValue);
996
1004
  };
997
1005
 
998
1006
  arrIncludes.autoRemove = val => testFalsey(val) || !(val != null && val.length);
999
1007
 
1000
1008
  const arrIncludesAll = (row, columnId, filterValue) => {
1001
- return !filterValue.some(val => !row.getValue(columnId).includes(val));
1009
+ return !filterValue.some(val => {
1010
+ var _row$getValue5;
1011
+
1012
+ return !((_row$getValue5 = row.getValue(columnId)) != null && _row$getValue5.includes(val));
1013
+ });
1002
1014
  };
1003
1015
 
1004
1016
  arrIncludesAll.autoRemove = val => testFalsey(val) || !(val != null && val.length);
1005
1017
 
1006
1018
  const arrIncludesSome = (row, columnId, filterValue) => {
1007
- return filterValue.some(val => row.getValue(columnId).includes(val));
1019
+ return filterValue.some(val => {
1020
+ var _row$getValue6;
1021
+
1022
+ return (_row$getValue6 = row.getValue(columnId)) == null ? void 0 : _row$getValue6.includes(val);
1023
+ });
1008
1024
  };
1009
1025
 
1010
1026
  arrIncludesSome.autoRemove = val => testFalsey(val) || !(val != null && val.length);
@@ -1689,7 +1705,7 @@
1689
1705
  setPageIndex: updater => {
1690
1706
  instance.setPagination(old => {
1691
1707
  let pageIndex = functionalUpdate(updater, old.pageIndex);
1692
- const maxPageIndex = typeof instance.options.pageCount !== 'undefined' ? instance.options.pageCount - 1 : Number.MAX_SAFE_INTEGER;
1708
+ const maxPageIndex = typeof instance.options.pageCount === 'undefined' || instance.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : instance.options.pageCount - 1;
1693
1709
  pageIndex = Math.min(Math.max(0, pageIndex), maxPageIndex);
1694
1710
  return { ...old,
1695
1711
  pageIndex
@@ -3219,8 +3235,6 @@
3219
3235
  function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
3220
3236
  const newFilteredFlatRows = [];
3221
3237
  const newFilteredRowsById = {};
3222
- let row;
3223
- let newRow;
3224
3238
 
3225
3239
  const recurseFilterRows = function (rowsToFilter, depth) {
3226
3240
  if (depth === void 0) {
@@ -3232,10 +3246,10 @@
3232
3246
  for (let i = 0; i < rowsToFilter.length; i++) {
3233
3247
  var _row$subRows;
3234
3248
 
3235
- row = rowsToFilter[i];
3249
+ let row = rowsToFilter[i];
3236
3250
 
3237
3251
  if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
3238
- newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3252
+ const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3239
3253
  newRow.columnFilters = row.columnFilters;
3240
3254
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3241
3255
 
@@ -3264,10 +3278,7 @@
3264
3278
  }
3265
3279
  function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
3266
3280
  const newFilteredFlatRows = [];
3267
- const newFilteredRowsById = {};
3268
- let rows;
3269
- let row;
3270
- let newRow; // Filters top level and nested rows
3281
+ const newFilteredRowsById = {}; // Filters top level and nested rows
3271
3282
 
3272
3283
  const recurseFilterRows = function (rowsToFilter, depth) {
3273
3284
  if (depth === void 0) {
@@ -3275,17 +3286,17 @@
3275
3286
  }
3276
3287
 
3277
3288
  // Filter from parents downward first
3278
- rows = []; // Apply the filter to any subRows
3289
+ const rows = []; // Apply the filter to any subRows
3279
3290
 
3280
3291
  for (let i = 0; i < rowsToFilter.length; i++) {
3281
- row = rowsToFilter[i];
3292
+ let row = rowsToFilter[i];
3282
3293
  const pass = filterRow(row);
3283
3294
 
3284
3295
  if (pass) {
3285
3296
  var _row$subRows2;
3286
3297
 
3287
3298
  if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
3288
- newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3299
+ const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3289
3300
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3290
3301
  row = newRow;
3291
3302
  }