@tanstack/table-core 8.2.2 → 8.2.5
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.
- package/build/cjs/features/Expanding.js +1 -1
- package/build/cjs/features/Expanding.js.map +1 -1
- package/build/cjs/features/RowSelection.js +9 -3
- package/build/cjs/features/RowSelection.js.map +1 -1
- package/build/cjs/utils/getGroupedRowModel.js +14 -3
- package/build/cjs/utils/getGroupedRowModel.js.map +1 -1
- package/build/esm/index.js +24 -7
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +305 -305
- package/build/umd/index.development.js +24 -7
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/features/Expanding.ts +5 -3
- package/src/features/RowSelection.ts +7 -2
- package/src/utils/getGroupedRowModel.ts +16 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/table-core",
|
|
3
3
|
"author": "Tanner Linsley",
|
|
4
|
-
"version": "8.2.
|
|
4
|
+
"version": "8.2.5",
|
|
5
5
|
"description": "Headless UI for building powerful tables & datagrids for TS/JS.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/tanstack/table#readme",
|
|
@@ -218,9 +218,11 @@ export const Expanding: TableFeature = {
|
|
|
218
218
|
},
|
|
219
219
|
getCanExpand: () => {
|
|
220
220
|
return (
|
|
221
|
-
|
|
222
|
-
(
|
|
223
|
-
|
|
221
|
+
table.options.getRowCanExpand?.(row) ??
|
|
222
|
+
(
|
|
223
|
+
(table.options.enableExpanding ?? true) &&
|
|
224
|
+
!!row.subRows?.length
|
|
225
|
+
)
|
|
224
226
|
)
|
|
225
227
|
},
|
|
226
228
|
getToggleExpandedHandler: () => {
|
|
@@ -108,6 +108,9 @@ export const RowSelection: TableFeature = {
|
|
|
108
108
|
// All of the rows are flat already, so it wouldn't be worth it
|
|
109
109
|
if (value) {
|
|
110
110
|
preGroupedFlatRows.forEach(row => {
|
|
111
|
+
if (!row.getCanSelect()) {
|
|
112
|
+
return
|
|
113
|
+
}
|
|
111
114
|
rowSelection[row.id] = true
|
|
112
115
|
})
|
|
113
116
|
} else {
|
|
@@ -420,7 +423,7 @@ const mutateRowIsSelected = <TData extends RowData>(
|
|
|
420
423
|
) => {
|
|
421
424
|
const row = table.getRow(id)
|
|
422
425
|
|
|
423
|
-
const isGrouped = row.getIsGrouped()
|
|
426
|
+
// const isGrouped = row.getIsGrouped()
|
|
424
427
|
|
|
425
428
|
// if ( // TODO: enforce grouping row selection rules
|
|
426
429
|
// !isGrouped ||
|
|
@@ -430,7 +433,9 @@ const mutateRowIsSelected = <TData extends RowData>(
|
|
|
430
433
|
if (!row.getCanMultiSelect()) {
|
|
431
434
|
Object.keys(selectedRowIds).forEach(key => delete selectedRowIds[key])
|
|
432
435
|
}
|
|
433
|
-
|
|
436
|
+
if (row.getCanSelect()) {
|
|
437
|
+
selectedRowIds[id] = true
|
|
438
|
+
}
|
|
434
439
|
} else {
|
|
435
440
|
delete selectedRowIds[id]
|
|
436
441
|
}
|
|
@@ -29,11 +29,23 @@ export function getGroupedRowModel<TData extends RowData>(): (
|
|
|
29
29
|
const groupUpRecursively = (
|
|
30
30
|
rows: Row<TData>[],
|
|
31
31
|
depth = 0,
|
|
32
|
-
parentId
|
|
32
|
+
parentId?: string
|
|
33
33
|
) => {
|
|
34
|
-
//
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
// Grouping depth has been been met
|
|
35
|
+
// Stop grouping and simply rewrite thd depth and row relationships
|
|
36
|
+
if (depth >= existingGrouping.length) {
|
|
37
|
+
return rows.map(row => {
|
|
38
|
+
row.depth = depth
|
|
39
|
+
|
|
40
|
+
groupedFlatRows.push(row)
|
|
41
|
+
groupedRowsById[row.id] = row
|
|
42
|
+
|
|
43
|
+
if (row.subRows) {
|
|
44
|
+
row.subRows = groupUpRecursively(row.subRows, depth + 1)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return row
|
|
48
|
+
})
|
|
37
49
|
}
|
|
38
50
|
|
|
39
51
|
const columnId = existingGrouping[depth]!
|