@tanstack/react-table 8.0.14 → 8.1.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":"4b50-123"},{"name":"react-table/src/index.tsx","uid":"4b50-125"}]}]}],"isRoot":true},"nodeParts":{"4b50-123":{"renderedLength":134035,"gzipLength":22987,"brotliLength":0,"mainUid":"4b50-122"},"4b50-125":{"renderedLength":1900,"gzipLength":752,"brotliLength":0,"mainUid":"4b50-124"}},"nodeMetas":{"4b50-122":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"4b50-123"},"imported":[],"importedBy":[{"uid":"4b50-124"}]},"4b50-124":{"id":"/packages/react-table/src/index.tsx","moduleParts":{"index.production.js":"4b50-125"},"imported":[{"uid":"4b50-126"},{"uid":"4b50-122"}],"importedBy":[],"isEntry":true},"4b50-126":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"4b50-124"}],"isExternal":true}},"env":{"rollup":"2.75.7"},"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":"6062-123"},{"name":"react-table/src/index.tsx","uid":"6062-125"}]}]}],"isRoot":true},"nodeParts":{"6062-123":{"renderedLength":134450,"gzipLength":23084,"brotliLength":0,"mainUid":"6062-122"},"6062-125":{"renderedLength":1900,"gzipLength":752,"brotliLength":0,"mainUid":"6062-124"}},"nodeMetas":{"6062-122":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"6062-123"},"imported":[],"importedBy":[{"uid":"6062-124"}]},"6062-124":{"id":"/packages/react-table/src/index.tsx","moduleParts":{"index.production.js":"6062-125"},"imported":[{"uid":"6062-126"},{"uid":"6062-122"}],"importedBy":[],"isEntry":true},"6062-126":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"6062-124"}],"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;
@@ -11,11 +11,11 @@
11
11
  "children": [
12
12
  {
13
13
  "name": "table-core/build/esm/index.js",
14
- "uid": "4b50-128"
14
+ "uid": "6062-128"
15
15
  },
16
16
  {
17
17
  "name": "react-table/src/index.tsx",
18
- "uid": "4b50-130"
18
+ "uid": "6062-130"
19
19
  }
20
20
  ]
21
21
  }
@@ -25,55 +25,55 @@
25
25
  "isRoot": true
26
26
  },
27
27
  "nodeParts": {
28
- "4b50-128": {
29
- "renderedLength": 134035,
30
- "gzipLength": 22987,
28
+ "6062-128": {
29
+ "renderedLength": 134450,
30
+ "gzipLength": 23084,
31
31
  "brotliLength": 0,
32
- "mainUid": "4b50-127"
32
+ "mainUid": "6062-127"
33
33
  },
34
- "4b50-130": {
34
+ "6062-130": {
35
35
  "renderedLength": 1900,
36
36
  "gzipLength": 752,
37
37
  "brotliLength": 0,
38
- "mainUid": "4b50-129"
38
+ "mainUid": "6062-129"
39
39
  }
40
40
  },
41
41
  "nodeMetas": {
42
- "4b50-127": {
42
+ "6062-127": {
43
43
  "id": "/packages/table-core/build/esm/index.js",
44
44
  "moduleParts": {
45
- "index.production.js": "4b50-128"
45
+ "index.production.js": "6062-128"
46
46
  },
47
47
  "imported": [],
48
48
  "importedBy": [
49
49
  {
50
- "uid": "4b50-129"
50
+ "uid": "6062-129"
51
51
  }
52
52
  ]
53
53
  },
54
- "4b50-129": {
54
+ "6062-129": {
55
55
  "id": "/packages/react-table/src/index.tsx",
56
56
  "moduleParts": {
57
- "index.production.js": "4b50-130"
57
+ "index.production.js": "6062-130"
58
58
  },
59
59
  "imported": [
60
60
  {
61
- "uid": "4b50-131"
61
+ "uid": "6062-131"
62
62
  },
63
63
  {
64
- "uid": "4b50-127"
64
+ "uid": "6062-127"
65
65
  }
66
66
  ],
67
67
  "importedBy": [],
68
68
  "isEntry": true
69
69
  },
70
- "4b50-131": {
70
+ "6062-131": {
71
71
  "id": "react",
72
72
  "moduleParts": {},
73
73
  "imported": [],
74
74
  "importedBy": [
75
75
  {
76
- "uid": "4b50-129"
76
+ "uid": "6062-129"
77
77
  }
78
78
  ],
79
79
  "isExternal": true
@@ -2219,13 +2219,19 @@
2219
2219
  const {
2220
2220
  rowSelection
2221
2221
  } = table.getState();
2222
- return isRowSelected(row, rowSelection) === true;
2222
+ return isRowSelected(row, rowSelection);
2223
2223
  },
2224
2224
  getIsSomeSelected: () => {
2225
2225
  const {
2226
2226
  rowSelection
2227
2227
  } = table.getState();
2228
- return isRowSelected(row, rowSelection) === 'some';
2228
+ return isSubRowSelected(row, rowSelection) === 'some';
2229
+ },
2230
+ getIsAllSubRowsSelected: () => {
2231
+ const {
2232
+ rowSelection
2233
+ } = table.getState();
2234
+ return isSubRowSelected(row, rowSelection) === 'all';
2229
2235
  },
2230
2236
  getCanSelect: () => {
2231
2237
  var _table$options$enable;
@@ -2277,6 +2283,10 @@
2277
2283
  // ) {
2278
2284
 
2279
2285
  if (value) {
2286
+ if (!row.getCanMultiSelect()) {
2287
+ Object.keys(selectedRowIds).forEach(key => delete selectedRowIds[key]);
2288
+ }
2289
+
2280
2290
  selectedRowIds[id] = true;
2281
2291
  } else {
2282
2292
  delete selectedRowIds[id];
@@ -2298,7 +2308,7 @@
2298
2308
  return rows.map(row => {
2299
2309
  var _row$subRows2;
2300
2310
 
2301
- const isSelected = isRowSelected(row, rowSelection) === true;
2311
+ const isSelected = isRowSelected(row, rowSelection);
2302
2312
 
2303
2313
  if (isSelected) {
2304
2314
  newSelectedFlatRows.push(row);
@@ -2323,11 +2333,12 @@
2323
2333
  rowsById: newSelectedRowsById
2324
2334
  };
2325
2335
  }
2326
- function isRowSelected(row, selection, table) {
2327
- if (selection[row.id]) {
2328
- return true;
2329
- }
2336
+ function isRowSelected(row, selection) {
2337
+ var _selection$row$id;
2330
2338
 
2339
+ return (_selection$row$id = selection[row.id]) != null ? _selection$row$id : false;
2340
+ }
2341
+ function isSubRowSelected(row, selection, table) {
2331
2342
  if (row.subRows && row.subRows.length) {
2332
2343
  let allChildrenSelected = true;
2333
2344
  let someSelected = false;
@@ -2343,7 +2354,7 @@
2343
2354
  allChildrenSelected = false;
2344
2355
  }
2345
2356
  });
2346
- return allChildrenSelected ? true : someSelected ? 'some' : false;
2357
+ return allChildrenSelected ? 'all' : someSelected ? 'some' : false;
2347
2358
  }
2348
2359
 
2349
2360
  return false;
@@ -3864,6 +3875,7 @@
3864
3875
  exports.getSortedRowModel = getSortedRowModel;
3865
3876
  exports.isFunction = isFunction;
3866
3877
  exports.isRowSelected = isRowSelected;
3878
+ exports.isSubRowSelected = isSubRowSelected;
3867
3879
  exports.makeStateUpdater = makeStateUpdater;
3868
3880
  exports.memo = memo;
3869
3881
  exports.noop = noop;