@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.
@@ -981,38 +981,54 @@ const Expanding = {
981
981
  };
982
982
 
983
983
  const includesString = (row, columnId, filterValue) => {
984
+ var _row$getValue;
985
+
984
986
  const search = filterValue.toLowerCase();
985
- return row.getValue(columnId).toLowerCase().includes(search);
987
+ return (_row$getValue = row.getValue(columnId)) == null ? void 0 : _row$getValue.toLowerCase().includes(search);
986
988
  };
987
989
 
988
990
  includesString.autoRemove = val => testFalsey(val);
989
991
 
990
992
  const includesStringSensitive = (row, columnId, filterValue) => {
991
- return row.getValue(columnId).includes(filterValue);
993
+ var _row$getValue2;
994
+
995
+ return (_row$getValue2 = row.getValue(columnId)) == null ? void 0 : _row$getValue2.includes(filterValue);
992
996
  };
993
997
 
994
998
  includesStringSensitive.autoRemove = val => testFalsey(val);
995
999
 
996
1000
  const equalsString = (row, columnId, filterValue) => {
997
- return row.getValue(columnId).toLowerCase() === filterValue.toLowerCase();
1001
+ var _row$getValue3;
1002
+
1003
+ return ((_row$getValue3 = row.getValue(columnId)) == null ? void 0 : _row$getValue3.toLowerCase()) === filterValue.toLowerCase();
998
1004
  };
999
1005
 
1000
1006
  equalsString.autoRemove = val => testFalsey(val);
1001
1007
 
1002
1008
  const arrIncludes = (row, columnId, filterValue) => {
1003
- return row.getValue(columnId).includes(filterValue);
1009
+ var _row$getValue4;
1010
+
1011
+ return (_row$getValue4 = row.getValue(columnId)) == null ? void 0 : _row$getValue4.includes(filterValue);
1004
1012
  };
1005
1013
 
1006
1014
  arrIncludes.autoRemove = val => testFalsey(val) || !(val != null && val.length);
1007
1015
 
1008
1016
  const arrIncludesAll = (row, columnId, filterValue) => {
1009
- return !filterValue.some(val => !row.getValue(columnId).includes(val));
1017
+ return !filterValue.some(val => {
1018
+ var _row$getValue5;
1019
+
1020
+ return !((_row$getValue5 = row.getValue(columnId)) != null && _row$getValue5.includes(val));
1021
+ });
1010
1022
  };
1011
1023
 
1012
1024
  arrIncludesAll.autoRemove = val => testFalsey(val) || !(val != null && val.length);
1013
1025
 
1014
1026
  const arrIncludesSome = (row, columnId, filterValue) => {
1015
- return filterValue.some(val => row.getValue(columnId).includes(val));
1027
+ return filterValue.some(val => {
1028
+ var _row$getValue6;
1029
+
1030
+ return (_row$getValue6 = row.getValue(columnId)) == null ? void 0 : _row$getValue6.includes(val);
1031
+ });
1016
1032
  };
1017
1033
 
1018
1034
  arrIncludesSome.autoRemove = val => testFalsey(val) || !(val != null && val.length);
@@ -1697,7 +1713,7 @@ const Pagination = {
1697
1713
  setPageIndex: updater => {
1698
1714
  instance.setPagination(old => {
1699
1715
  let pageIndex = functionalUpdate(updater, old.pageIndex);
1700
- const maxPageIndex = typeof instance.options.pageCount !== 'undefined' ? instance.options.pageCount - 1 : Number.MAX_SAFE_INTEGER;
1716
+ const maxPageIndex = typeof instance.options.pageCount === 'undefined' || instance.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : instance.options.pageCount - 1;
1701
1717
  pageIndex = Math.min(Math.max(0, pageIndex), maxPageIndex);
1702
1718
  return { ...old,
1703
1719
  pageIndex
@@ -3229,8 +3245,6 @@ function filterRows(rows, filterRowImpl, instance) {
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
3250
  if (depth === void 0) {
@@ -3242,10 +3256,10 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
3242
3256
  for (let i = 0; i < rowsToFilter.length; i++) {
3243
3257
  var _row$subRows;
3244
3258
 
3245
- row = rowsToFilter[i];
3259
+ let row = rowsToFilter[i];
3246
3260
 
3247
3261
  if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
3248
- newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3262
+ const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3249
3263
  newRow.columnFilters = row.columnFilters;
3250
3264
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3251
3265
 
@@ -3274,10 +3288,7 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
3274
3288
  }
3275
3289
  function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
3276
3290
  const newFilteredFlatRows = [];
3277
- const newFilteredRowsById = {};
3278
- let rows;
3279
- let row;
3280
- let newRow; // Filters top level and nested rows
3291
+ const newFilteredRowsById = {}; // Filters top level and nested rows
3281
3292
 
3282
3293
  const recurseFilterRows = function (rowsToFilter, depth) {
3283
3294
  if (depth === void 0) {
@@ -3285,17 +3296,17 @@ function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
3285
3296
  }
3286
3297
 
3287
3298
  // Filter from parents downward first
3288
- rows = []; // Apply the filter to any subRows
3299
+ const rows = []; // Apply the filter to any subRows
3289
3300
 
3290
3301
  for (let i = 0; i < rowsToFilter.length; i++) {
3291
- row = rowsToFilter[i];
3302
+ let row = rowsToFilter[i];
3292
3303
  const pass = filterRow(row);
3293
3304
 
3294
3305
  if (pass) {
3295
3306
  var _row$subRows2;
3296
3307
 
3297
3308
  if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
3298
- newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3309
+ const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3299
3310
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3300
3311
  row = newRow;
3301
3312
  }