@tanstack/react-table 8.0.0-beta.6 → 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.
@@ -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":"c1f5-127"},{"name":"react-table/src/index.tsx","uid":"c1f5-129"}]}]}],"isRoot":true},"nodeParts":{"c1f5-127":{"renderedLength":138812,"gzipLength":23634,"brotliLength":0,"mainUid":"c1f5-126"},"c1f5-129":{"renderedLength":2135,"gzipLength":854,"brotliLength":0,"mainUid":"c1f5-128"}},"nodeMetas":{"c1f5-126":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"c1f5-127"},"imported":[],"importedBy":[{"uid":"c1f5-128"}]},"c1f5-128":{"id":"/packages/react-table/src/index.tsx","moduleParts":{"index.production.js":"c1f5-129"},"imported":[{"uid":"c1f5-130"},{"uid":"c1f5-126"}],"importedBy":[],"isEntry":true},"c1f5-130":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"c1f5-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":"612e-127"},{"name":"react-table/src/index.tsx","uid":"612e-129"}]}]}],"isRoot":true},"nodeParts":{"612e-127":{"renderedLength":139240,"gzipLength":23684,"brotliLength":0,"mainUid":"612e-126"},"612e-129":{"renderedLength":2135,"gzipLength":854,"brotliLength":0,"mainUid":"612e-128"}},"nodeMetas":{"612e-126":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"612e-127"},"imported":[],"importedBy":[{"uid":"612e-128"}]},"612e-128":{"id":"/packages/react-table/src/index.tsx","moduleParts":{"index.production.js":"612e-129"},"imported":[{"uid":"612e-130"},{"uid":"612e-126"}],"importedBy":[],"isEntry":true},"612e-130":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"612e-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": "c1f5-132"
14
+ "uid": "612e-132"
15
15
  },
16
16
  {
17
17
  "name": "react-table/src/index.tsx",
18
- "uid": "c1f5-134"
18
+ "uid": "612e-134"
19
19
  }
20
20
  ]
21
21
  }
@@ -25,55 +25,55 @@
25
25
  "isRoot": true
26
26
  },
27
27
  "nodeParts": {
28
- "c1f5-132": {
29
- "renderedLength": 138812,
30
- "gzipLength": 23634,
28
+ "612e-132": {
29
+ "renderedLength": 139240,
30
+ "gzipLength": 23684,
31
31
  "brotliLength": 0,
32
- "mainUid": "c1f5-131"
32
+ "mainUid": "612e-131"
33
33
  },
34
- "c1f5-134": {
34
+ "612e-134": {
35
35
  "renderedLength": 2135,
36
36
  "gzipLength": 854,
37
37
  "brotliLength": 0,
38
- "mainUid": "c1f5-133"
38
+ "mainUid": "612e-133"
39
39
  }
40
40
  },
41
41
  "nodeMetas": {
42
- "c1f5-131": {
42
+ "612e-131": {
43
43
  "id": "/packages/table-core/build/esm/index.js",
44
44
  "moduleParts": {
45
- "index.production.js": "c1f5-132"
45
+ "index.production.js": "612e-132"
46
46
  },
47
47
  "imported": [],
48
48
  "importedBy": [
49
49
  {
50
- "uid": "c1f5-133"
50
+ "uid": "612e-133"
51
51
  }
52
52
  ]
53
53
  },
54
- "c1f5-133": {
54
+ "612e-133": {
55
55
  "id": "/packages/react-table/src/index.tsx",
56
56
  "moduleParts": {
57
- "index.production.js": "c1f5-134"
57
+ "index.production.js": "612e-134"
58
58
  },
59
59
  "imported": [
60
60
  {
61
- "uid": "c1f5-135"
61
+ "uid": "612e-135"
62
62
  },
63
63
  {
64
- "uid": "c1f5-131"
64
+ "uid": "612e-131"
65
65
  }
66
66
  ],
67
67
  "importedBy": [],
68
68
  "isEntry": true
69
69
  },
70
- "c1f5-135": {
70
+ "612e-135": {
71
71
  "id": "react",
72
72
  "moduleParts": {},
73
73
  "imported": [],
74
74
  "importedBy": [
75
75
  {
76
- "uid": "c1f5-133"
76
+ "uid": "612e-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);
@@ -1564,7 +1580,7 @@
1564
1580
  getIsAggregated: () => {
1565
1581
  var _row$subRows;
1566
1582
 
1567
- return !cell.getIsGrouped() && !cell.getIsPlaceholder() && ((_row$subRows = row.subRows) == null ? void 0 : _row$subRows.length) > 1;
1583
+ return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
1568
1584
  },
1569
1585
  renderAggregatedCell: () => {
1570
1586
  {
@@ -1719,7 +1735,7 @@
1719
1735
  setPageIndex: updater => {
1720
1736
  instance.setPagination(old => {
1721
1737
  let pageIndex = functionalUpdate(updater, old.pageIndex);
1722
- const maxPageIndex = typeof old.pageCount !== 'undefined' ? old.pageCount - 1 : Number.MAX_SAFE_INTEGER;
1738
+ const maxPageIndex = typeof instance.options.pageCount === 'undefined' || instance.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : instance.options.pageCount - 1;
1723
1739
  pageIndex = Math.min(Math.max(0, pageIndex), maxPageIndex);
1724
1740
  return { ...old,
1725
1741
  pageIndex
@@ -1748,9 +1764,9 @@
1748
1764
  });
1749
1765
  },
1750
1766
  setPageCount: updater => instance.setPagination(old => {
1751
- var _old$pageCount;
1767
+ var _instance$options$pag;
1752
1768
 
1753
- let newPageCount = functionalUpdate(updater, (_old$pageCount = old.pageCount) != null ? _old$pageCount : -1);
1769
+ let newPageCount = functionalUpdate(updater, (_instance$options$pag = instance.options.pageCount) != null ? _instance$options$pag : -1);
1754
1770
 
1755
1771
  if (typeof newPageCount === 'number') {
1756
1772
  newPageCount = Math.max(-1, newPageCount);
@@ -1760,7 +1776,7 @@
1760
1776
  pageCount: newPageCount
1761
1777
  };
1762
1778
  }),
1763
- getPageOptions: memo(() => [instance.getState().pagination.pageSize, instance.getState().pagination.pageCount], (pageSize, pageCount) => {
1779
+ getPageOptions: memo(() => [instance.getPageCount()], pageCount => {
1764
1780
  let pageOptions = [];
1765
1781
 
1766
1782
  if (pageCount && pageCount > 0) {
@@ -1814,15 +1830,9 @@
1814
1830
  return instance._getPaginationRowModel();
1815
1831
  },
1816
1832
  getPageCount: () => {
1817
- const {
1818
- pageCount
1819
- } = instance.getState().pagination;
1833
+ var _instance$options$pag2;
1820
1834
 
1821
- if (typeof pageCount !== 'undefined') {
1822
- return pageCount;
1823
- }
1824
-
1825
- return Math.ceil(instance.getPrePaginationRowModel().rows.length / instance.getState().pagination.pageSize);
1835
+ return (_instance$options$pag2 = instance.options.pageCount) != null ? _instance$options$pag2 : Math.ceil(instance.getPrePaginationRowModel().rows.length / instance.getState().pagination.pageSize);
1826
1836
  }
1827
1837
  };
1828
1838
  }
@@ -3255,8 +3265,6 @@
3255
3265
  function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
3256
3266
  const newFilteredFlatRows = [];
3257
3267
  const newFilteredRowsById = {};
3258
- let row;
3259
- let newRow;
3260
3268
 
3261
3269
  const recurseFilterRows = function (rowsToFilter, depth) {
3262
3270
  if (depth === void 0) {
@@ -3268,10 +3276,10 @@
3268
3276
  for (let i = 0; i < rowsToFilter.length; i++) {
3269
3277
  var _row$subRows;
3270
3278
 
3271
- row = rowsToFilter[i];
3279
+ let row = rowsToFilter[i];
3272
3280
 
3273
3281
  if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
3274
- newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3282
+ const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3275
3283
  newRow.columnFilters = row.columnFilters;
3276
3284
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3277
3285
 
@@ -3300,10 +3308,7 @@
3300
3308
  }
3301
3309
  function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
3302
3310
  const newFilteredFlatRows = [];
3303
- const newFilteredRowsById = {};
3304
- let rows;
3305
- let row;
3306
- let newRow; // Filters top level and nested rows
3311
+ const newFilteredRowsById = {}; // Filters top level and nested rows
3307
3312
 
3308
3313
  const recurseFilterRows = function (rowsToFilter, depth) {
3309
3314
  if (depth === void 0) {
@@ -3311,17 +3316,17 @@
3311
3316
  }
3312
3317
 
3313
3318
  // Filter from parents downward first
3314
- rows = []; // Apply the filter to any subRows
3319
+ const rows = []; // Apply the filter to any subRows
3315
3320
 
3316
3321
  for (let i = 0; i < rowsToFilter.length; i++) {
3317
- row = rowsToFilter[i];
3322
+ let row = rowsToFilter[i];
3318
3323
  const pass = filterRow(row);
3319
3324
 
3320
3325
  if (pass) {
3321
3326
  var _row$subRows2;
3322
3327
 
3323
3328
  if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
3324
- newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3329
+ const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3325
3330
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3326
3331
  row = newRow;
3327
3332
  }