@tanstack/react-table 8.19.2 → 8.19.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.
|
@@ -3292,6 +3292,10 @@
|
|
|
3292
3292
|
function getGroupedRowModel() {
|
|
3293
3293
|
return table => memo(() => [table.getState().grouping, table.getPreGroupedRowModel()], (grouping, rowModel) => {
|
|
3294
3294
|
if (!rowModel.rows.length || !grouping.length) {
|
|
3295
|
+
rowModel.rows.forEach(row => {
|
|
3296
|
+
row.depth = 0;
|
|
3297
|
+
row.parentId = undefined;
|
|
3298
|
+
});
|
|
3295
3299
|
return rowModel;
|
|
3296
3300
|
}
|
|
3297
3301
|
|
|
@@ -3327,7 +3331,7 @@
|
|
|
3327
3331
|
// Group the rows together for this level
|
|
3328
3332
|
const rowGroupsMap = groupBy(rows, columnId);
|
|
3329
3333
|
|
|
3330
|
-
//
|
|
3334
|
+
// Perform aggregations for each group
|
|
3331
3335
|
const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map((_ref, index) => {
|
|
3332
3336
|
let [groupingValue, groupedRows] = _ref;
|
|
3333
3337
|
let id = `${columnId}:${groupingValue}`;
|
|
@@ -3335,6 +3339,9 @@
|
|
|
3335
3339
|
|
|
3336
3340
|
// First, Recurse to group sub rows before aggregation
|
|
3337
3341
|
const subRows = groupUpRecursively(groupedRows, depth + 1, id);
|
|
3342
|
+
subRows.forEach(subRow => {
|
|
3343
|
+
subRow.parentId = id;
|
|
3344
|
+
});
|
|
3338
3345
|
|
|
3339
3346
|
// Flatten the leaf rows of the rows in this group
|
|
3340
3347
|
const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows;
|