@tanstack/react-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.
@@ -983,38 +983,54 @@ const Expanding = {
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);
@@ -1699,7 +1715,7 @@ const Pagination = {
1699
1715
  setPageIndex: updater => {
1700
1716
  instance.setPagination(old => {
1701
1717
  let pageIndex = functionalUpdate(updater, old.pageIndex);
1702
- const maxPageIndex = typeof instance.options.pageCount !== 'undefined' ? instance.options.pageCount - 1 : Number.MAX_SAFE_INTEGER;
1718
+ const maxPageIndex = typeof instance.options.pageCount === 'undefined' || instance.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : instance.options.pageCount - 1;
1703
1719
  pageIndex = Math.min(Math.max(0, pageIndex), maxPageIndex);
1704
1720
  return { ...old,
1705
1721
  pageIndex
@@ -3231,8 +3247,6 @@ function filterRows(rows, filterRowImpl, instance) {
3231
3247
  function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
3232
3248
  const newFilteredFlatRows = [];
3233
3249
  const newFilteredRowsById = {};
3234
- let row;
3235
- let newRow;
3236
3250
 
3237
3251
  const recurseFilterRows = function (rowsToFilter, depth) {
3238
3252
  if (depth === void 0) {
@@ -3244,10 +3258,10 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
3244
3258
  for (let i = 0; i < rowsToFilter.length; i++) {
3245
3259
  var _row$subRows;
3246
3260
 
3247
- row = rowsToFilter[i];
3261
+ let row = rowsToFilter[i];
3248
3262
 
3249
3263
  if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
3250
- newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3264
+ const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3251
3265
  newRow.columnFilters = row.columnFilters;
3252
3266
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3253
3267
 
@@ -3276,10 +3290,7 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
3276
3290
  }
3277
3291
  function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
3278
3292
  const newFilteredFlatRows = [];
3279
- const newFilteredRowsById = {};
3280
- let rows;
3281
- let row;
3282
- let newRow; // Filters top level and nested rows
3293
+ const newFilteredRowsById = {}; // Filters top level and nested rows
3283
3294
 
3284
3295
  const recurseFilterRows = function (rowsToFilter, depth) {
3285
3296
  if (depth === void 0) {
@@ -3287,17 +3298,17 @@ function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
3287
3298
  }
3288
3299
 
3289
3300
  // Filter from parents downward first
3290
- rows = []; // Apply the filter to any subRows
3301
+ const rows = []; // Apply the filter to any subRows
3291
3302
 
3292
3303
  for (let i = 0; i < rowsToFilter.length; i++) {
3293
- row = rowsToFilter[i];
3304
+ let row = rowsToFilter[i];
3294
3305
  const pass = filterRow(row);
3295
3306
 
3296
3307
  if (pass) {
3297
3308
  var _row$subRows2;
3298
3309
 
3299
3310
  if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
3300
- newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3311
+ const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3301
3312
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3302
3313
  row = newRow;
3303
3314
  }