@tanstack/react-table 8.0.0-beta.8 → 8.0.3

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-127"},{"name":"react-table/src/index.tsx","uid":"6e21-129"}]}]}],"isRoot":true},"nodeParts":{"6e21-127":{"renderedLength":138740,"gzipLength":23599,"brotliLength":0,"mainUid":"6e21-126"},"6e21-129":{"renderedLength":2135,"gzipLength":854,"brotliLength":0,"mainUid":"6e21-128"}},"nodeMetas":{"6e21-126":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"6e21-127"},"imported":[],"importedBy":[{"uid":"6e21-128"}]},"6e21-128":{"id":"/packages/react-table/src/index.tsx","moduleParts":{"index.production.js":"6e21-129"},"imported":[{"uid":"6e21-130"},{"uid":"6e21-126"}],"importedBy":[],"isEntry":true},"6e21-130":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"6e21-128"}],"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":"6785-127"},{"name":"react-table/src/index.tsx","uid":"6785-129"}]}]}],"isRoot":true},"nodeParts":{"6785-127":{"renderedLength":139117,"gzipLength":23688,"brotliLength":0,"mainUid":"6785-126"},"6785-129":{"renderedLength":2135,"gzipLength":854,"brotliLength":0,"mainUid":"6785-128"}},"nodeMetas":{"6785-126":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"6785-127"},"imported":[],"importedBy":[{"uid":"6785-128"}]},"6785-128":{"id":"/packages/react-table/src/index.tsx","moduleParts":{"index.production.js":"6785-129"},"imported":[{"uid":"6785-130"},{"uid":"6785-126"}],"importedBy":[],"isEntry":true},"6785-130":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"6785-128"}],"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;
@@ -1003,38 +1003,54 @@
1003
1003
  };
1004
1004
 
1005
1005
  const includesString = (row, columnId, filterValue) => {
1006
+ var _row$getValue;
1007
+
1006
1008
  const search = filterValue.toLowerCase();
1007
- return row.getValue(columnId).toLowerCase().includes(search);
1009
+ return (_row$getValue = row.getValue(columnId)) == null ? void 0 : _row$getValue.toLowerCase().includes(search);
1008
1010
  };
1009
1011
 
1010
1012
  includesString.autoRemove = val => testFalsey(val);
1011
1013
 
1012
1014
  const includesStringSensitive = (row, columnId, filterValue) => {
1013
- return row.getValue(columnId).includes(filterValue);
1015
+ var _row$getValue2;
1016
+
1017
+ return (_row$getValue2 = row.getValue(columnId)) == null ? void 0 : _row$getValue2.includes(filterValue);
1014
1018
  };
1015
1019
 
1016
1020
  includesStringSensitive.autoRemove = val => testFalsey(val);
1017
1021
 
1018
1022
  const equalsString = (row, columnId, filterValue) => {
1019
- return row.getValue(columnId).toLowerCase() === filterValue.toLowerCase();
1023
+ var _row$getValue3;
1024
+
1025
+ return ((_row$getValue3 = row.getValue(columnId)) == null ? void 0 : _row$getValue3.toLowerCase()) === filterValue.toLowerCase();
1020
1026
  };
1021
1027
 
1022
1028
  equalsString.autoRemove = val => testFalsey(val);
1023
1029
 
1024
1030
  const arrIncludes = (row, columnId, filterValue) => {
1025
- return row.getValue(columnId).includes(filterValue);
1031
+ var _row$getValue4;
1032
+
1033
+ return (_row$getValue4 = row.getValue(columnId)) == null ? void 0 : _row$getValue4.includes(filterValue);
1026
1034
  };
1027
1035
 
1028
1036
  arrIncludes.autoRemove = val => testFalsey(val) || !(val != null && val.length);
1029
1037
 
1030
1038
  const arrIncludesAll = (row, columnId, filterValue) => {
1031
- return !filterValue.some(val => !row.getValue(columnId).includes(val));
1039
+ return !filterValue.some(val => {
1040
+ var _row$getValue5;
1041
+
1042
+ return !((_row$getValue5 = row.getValue(columnId)) != null && _row$getValue5.includes(val));
1043
+ });
1032
1044
  };
1033
1045
 
1034
1046
  arrIncludesAll.autoRemove = val => testFalsey(val) || !(val != null && val.length);
1035
1047
 
1036
1048
  const arrIncludesSome = (row, columnId, filterValue) => {
1037
- return filterValue.some(val => row.getValue(columnId).includes(val));
1049
+ return filterValue.some(val => {
1050
+ var _row$getValue6;
1051
+
1052
+ return (_row$getValue6 = row.getValue(columnId)) == null ? void 0 : _row$getValue6.includes(val);
1053
+ });
1038
1054
  };
1039
1055
 
1040
1056
  arrIncludesSome.autoRemove = val => testFalsey(val) || !(val != null && val.length);
@@ -1339,7 +1355,10 @@
1339
1355
  const sum = (columnId, _leafRows, childRows) => {
1340
1356
  // It's faster to just add the aggregations together instead of
1341
1357
  // process leaf nodes individually
1342
- return childRows.reduce((sum, next) => sum + (typeof next === 'number' ? next : 0), 0);
1358
+ return childRows.reduce((sum, next) => {
1359
+ const nextValue = next.getValue(columnId);
1360
+ return sum + (typeof nextValue === 'number' ? nextValue : 0);
1361
+ }, 0);
1343
1362
  };
1344
1363
 
1345
1364
  const min = (columnId, _leafRows, childRows) => {
@@ -1719,7 +1738,7 @@
1719
1738
  setPageIndex: updater => {
1720
1739
  instance.setPagination(old => {
1721
1740
  let pageIndex = functionalUpdate(updater, old.pageIndex);
1722
- const maxPageIndex = typeof instance.options.pageCount !== 'undefined' ? instance.options.pageCount - 1 : Number.MAX_SAFE_INTEGER;
1741
+ const maxPageIndex = typeof instance.options.pageCount === 'undefined' || instance.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : instance.options.pageCount - 1;
1723
1742
  pageIndex = Math.min(Math.max(0, pageIndex), maxPageIndex);
1724
1743
  return { ...old,
1725
1744
  pageIndex
@@ -2312,9 +2331,6 @@
2312
2331
  const newSelectedRowsById = {}; // Filters top level and nested rows
2313
2332
 
2314
2333
  const recurseRows = function (rows, depth) {
2315
- if (depth === void 0) {
2316
- depth = 0;
2317
- }
2318
2334
 
2319
2335
  return rows.map(row => {
2320
2336
  var _row$subRows2;
@@ -2328,7 +2344,7 @@
2328
2344
 
2329
2345
  if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
2330
2346
  row = { ...row,
2331
- subRows: recurseRows(row.subRows, depth + 1)
2347
+ subRows: recurseRows(row.subRows)
2332
2348
  };
2333
2349
  }
2334
2350
 
@@ -3249,25 +3265,20 @@
3249
3265
  function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
3250
3266
  const newFilteredFlatRows = [];
3251
3267
  const newFilteredRowsById = {};
3252
- let row;
3253
- let newRow;
3254
3268
 
3255
3269
  const recurseFilterRows = function (rowsToFilter, depth) {
3256
- if (depth === void 0) {
3257
- depth = 0;
3258
- }
3259
3270
 
3260
3271
  const rows = []; // Filter from children up first
3261
3272
 
3262
3273
  for (let i = 0; i < rowsToFilter.length; i++) {
3263
3274
  var _row$subRows;
3264
3275
 
3265
- row = rowsToFilter[i];
3276
+ let row = rowsToFilter[i];
3266
3277
 
3267
3278
  if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
3268
- newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3279
+ const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3269
3280
  newRow.columnFilters = row.columnFilters;
3270
- newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3281
+ newRow.subRows = recurseFilterRows(row.subRows);
3271
3282
 
3272
3283
  if (!newRow.subRows.length) {
3273
3284
  continue;
@@ -3294,29 +3305,23 @@
3294
3305
  }
3295
3306
  function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
3296
3307
  const newFilteredFlatRows = [];
3297
- const newFilteredRowsById = {};
3298
- let rows;
3299
- let row;
3300
- let newRow; // Filters top level and nested rows
3308
+ const newFilteredRowsById = {}; // Filters top level and nested rows
3301
3309
 
3302
3310
  const recurseFilterRows = function (rowsToFilter, depth) {
3303
- if (depth === void 0) {
3304
- depth = 0;
3305
- }
3306
3311
 
3307
3312
  // Filter from parents downward first
3308
- rows = []; // Apply the filter to any subRows
3313
+ const rows = []; // Apply the filter to any subRows
3309
3314
 
3310
3315
  for (let i = 0; i < rowsToFilter.length; i++) {
3311
- row = rowsToFilter[i];
3316
+ let row = rowsToFilter[i];
3312
3317
  const pass = filterRow(row);
3313
3318
 
3314
3319
  if (pass) {
3315
3320
  var _row$subRows2;
3316
3321
 
3317
3322
  if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
3318
- newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3319
- newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3323
+ const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3324
+ newRow.subRows = recurseFilterRows(row.subRows);
3320
3325
  row = newRow;
3321
3326
  }
3322
3327