@tanstack/react-table 8.0.0-beta.7 → 8.0.0

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":"779a-127"},{"name":"react-table/src/index.tsx","uid":"779a-129"}]}]}],"isRoot":true},"nodeParts":{"779a-127":{"renderedLength":138802,"gzipLength":23615,"brotliLength":0,"mainUid":"779a-126"},"779a-129":{"renderedLength":2135,"gzipLength":854,"brotliLength":0,"mainUid":"779a-128"}},"nodeMetas":{"779a-126":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"779a-127"},"imported":[],"importedBy":[{"uid":"779a-128"}]},"779a-128":{"id":"/packages/react-table/src/index.tsx","moduleParts":{"index.production.js":"779a-129"},"imported":[{"uid":"779a-130"},{"uid":"779a-126"}],"importedBy":[],"isEntry":true},"779a-130":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"779a-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":"0a0b-127"},{"name":"react-table/src/index.tsx","uid":"0a0b-129"}]}]}],"isRoot":true},"nodeParts":{"0a0b-127":{"renderedLength":139321,"gzipLength":23694,"brotliLength":0,"mainUid":"0a0b-126"},"0a0b-129":{"renderedLength":2135,"gzipLength":854,"brotliLength":0,"mainUid":"0a0b-128"}},"nodeMetas":{"0a0b-126":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"0a0b-127"},"imported":[],"importedBy":[{"uid":"0a0b-128"}]},"0a0b-128":{"id":"/packages/react-table/src/index.tsx","moduleParts":{"index.production.js":"0a0b-129"},"imported":[{"uid":"0a0b-130"},{"uid":"0a0b-126"}],"importedBy":[],"isEntry":true},"0a0b-130":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"0a0b-128"}],"isExternal":true}},"env":{"rollup":"2.70.2"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
2673
2673
 
2674
2674
  const run = () => {
2675
2675
  const width = window.innerWidth;
@@ -11,11 +11,11 @@
11
11
  "children": [
12
12
  {
13
13
  "name": "table-core/build/esm/index.js",
14
- "uid": "779a-132"
14
+ "uid": "0a0b-132"
15
15
  },
16
16
  {
17
17
  "name": "react-table/src/index.tsx",
18
- "uid": "779a-134"
18
+ "uid": "0a0b-134"
19
19
  }
20
20
  ]
21
21
  }
@@ -25,55 +25,55 @@
25
25
  "isRoot": true
26
26
  },
27
27
  "nodeParts": {
28
- "779a-132": {
29
- "renderedLength": 138802,
30
- "gzipLength": 23615,
28
+ "0a0b-132": {
29
+ "renderedLength": 139321,
30
+ "gzipLength": 23694,
31
31
  "brotliLength": 0,
32
- "mainUid": "779a-131"
32
+ "mainUid": "0a0b-131"
33
33
  },
34
- "779a-134": {
34
+ "0a0b-134": {
35
35
  "renderedLength": 2135,
36
36
  "gzipLength": 854,
37
37
  "brotliLength": 0,
38
- "mainUid": "779a-133"
38
+ "mainUid": "0a0b-133"
39
39
  }
40
40
  },
41
41
  "nodeMetas": {
42
- "779a-131": {
42
+ "0a0b-131": {
43
43
  "id": "/packages/table-core/build/esm/index.js",
44
44
  "moduleParts": {
45
- "index.production.js": "779a-132"
45
+ "index.production.js": "0a0b-132"
46
46
  },
47
47
  "imported": [],
48
48
  "importedBy": [
49
49
  {
50
- "uid": "779a-133"
50
+ "uid": "0a0b-133"
51
51
  }
52
52
  ]
53
53
  },
54
- "779a-133": {
54
+ "0a0b-133": {
55
55
  "id": "/packages/react-table/src/index.tsx",
56
56
  "moduleParts": {
57
- "index.production.js": "779a-134"
57
+ "index.production.js": "0a0b-134"
58
58
  },
59
59
  "imported": [
60
60
  {
61
- "uid": "779a-135"
61
+ "uid": "0a0b-135"
62
62
  },
63
63
  {
64
- "uid": "779a-131"
64
+ "uid": "0a0b-131"
65
65
  }
66
66
  ],
67
67
  "importedBy": [],
68
68
  "isEntry": true
69
69
  },
70
- "779a-135": {
70
+ "0a0b-135": {
71
71
  "id": "react",
72
72
  "moduleParts": {},
73
73
  "imported": [],
74
74
  "importedBy": [
75
75
  {
76
- "uid": "779a-133"
76
+ "uid": "0a0b-133"
77
77
  }
78
78
  ],
79
79
  "isExternal": true
@@ -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 old.pageCount !== 'undefined' ? old.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
@@ -1748,9 +1767,9 @@
1748
1767
  });
1749
1768
  },
1750
1769
  setPageCount: updater => instance.setPagination(old => {
1751
- var _old$pageCount;
1770
+ var _instance$options$pag;
1752
1771
 
1753
- let newPageCount = functionalUpdate(updater, (_old$pageCount = old.pageCount) != null ? _old$pageCount : -1);
1772
+ let newPageCount = functionalUpdate(updater, (_instance$options$pag = instance.options.pageCount) != null ? _instance$options$pag : -1);
1754
1773
 
1755
1774
  if (typeof newPageCount === 'number') {
1756
1775
  newPageCount = Math.max(-1, newPageCount);
@@ -1760,7 +1779,7 @@
1760
1779
  pageCount: newPageCount
1761
1780
  };
1762
1781
  }),
1763
- getPageOptions: memo(() => [instance.getState().pagination.pageSize, instance.getState().pagination.pageCount], (pageSize, pageCount) => {
1782
+ getPageOptions: memo(() => [instance.getPageCount()], pageCount => {
1764
1783
  let pageOptions = [];
1765
1784
 
1766
1785
  if (pageCount && pageCount > 0) {
@@ -1814,15 +1833,9 @@
1814
1833
  return instance._getPaginationRowModel();
1815
1834
  },
1816
1835
  getPageCount: () => {
1817
- const {
1818
- pageCount
1819
- } = instance.getState().pagination;
1836
+ var _instance$options$pag2;
1820
1837
 
1821
- if (typeof pageCount !== 'undefined') {
1822
- return pageCount;
1823
- }
1824
-
1825
- return Math.ceil(instance.getPrePaginationRowModel().rows.length / instance.getState().pagination.pageSize);
1838
+ return (_instance$options$pag2 = instance.options.pageCount) != null ? _instance$options$pag2 : Math.ceil(instance.getPrePaginationRowModel().rows.length / instance.getState().pagination.pageSize);
1826
1839
  }
1827
1840
  };
1828
1841
  }
@@ -3255,8 +3268,6 @@
3255
3268
  function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
3256
3269
  const newFilteredFlatRows = [];
3257
3270
  const newFilteredRowsById = {};
3258
- let row;
3259
- let newRow;
3260
3271
 
3261
3272
  const recurseFilterRows = function (rowsToFilter, depth) {
3262
3273
  if (depth === void 0) {
@@ -3268,10 +3279,10 @@
3268
3279
  for (let i = 0; i < rowsToFilter.length; i++) {
3269
3280
  var _row$subRows;
3270
3281
 
3271
- row = rowsToFilter[i];
3282
+ let row = rowsToFilter[i];
3272
3283
 
3273
3284
  if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
3274
- newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3285
+ const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3275
3286
  newRow.columnFilters = row.columnFilters;
3276
3287
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3277
3288
 
@@ -3300,10 +3311,7 @@
3300
3311
  }
3301
3312
  function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
3302
3313
  const newFilteredFlatRows = [];
3303
- const newFilteredRowsById = {};
3304
- let rows;
3305
- let row;
3306
- let newRow; // Filters top level and nested rows
3314
+ const newFilteredRowsById = {}; // Filters top level and nested rows
3307
3315
 
3308
3316
  const recurseFilterRows = function (rowsToFilter, depth) {
3309
3317
  if (depth === void 0) {
@@ -3311,17 +3319,17 @@
3311
3319
  }
3312
3320
 
3313
3321
  // Filter from parents downward first
3314
- rows = []; // Apply the filter to any subRows
3322
+ const rows = []; // Apply the filter to any subRows
3315
3323
 
3316
3324
  for (let i = 0; i < rowsToFilter.length; i++) {
3317
- row = rowsToFilter[i];
3325
+ let row = rowsToFilter[i];
3318
3326
  const pass = filterRow(row);
3319
3327
 
3320
3328
  if (pass) {
3321
3329
  var _row$subRows2;
3322
3330
 
3323
3331
  if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
3324
- newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3332
+ const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3325
3333
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3326
3334
  row = newRow;
3327
3335
  }