@tanstack/svelte-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.
|
@@ -3273,6 +3273,10 @@
|
|
|
3273
3273
|
function getGroupedRowModel() {
|
|
3274
3274
|
return table => memo(() => [table.getState().grouping, table.getPreGroupedRowModel()], (grouping, rowModel) => {
|
|
3275
3275
|
if (!rowModel.rows.length || !grouping.length) {
|
|
3276
|
+
rowModel.rows.forEach(row => {
|
|
3277
|
+
row.depth = 0;
|
|
3278
|
+
row.parentId = undefined;
|
|
3279
|
+
});
|
|
3276
3280
|
return rowModel;
|
|
3277
3281
|
}
|
|
3278
3282
|
|
|
@@ -3308,7 +3312,7 @@
|
|
|
3308
3312
|
// Group the rows together for this level
|
|
3309
3313
|
const rowGroupsMap = groupBy(rows, columnId);
|
|
3310
3314
|
|
|
3311
|
-
//
|
|
3315
|
+
// Perform aggregations for each group
|
|
3312
3316
|
const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map((_ref, index) => {
|
|
3313
3317
|
let [groupingValue, groupedRows] = _ref;
|
|
3314
3318
|
let id = `${columnId}:${groupingValue}`;
|
|
@@ -3316,6 +3320,9 @@
|
|
|
3316
3320
|
|
|
3317
3321
|
// First, Recurse to group sub rows before aggregation
|
|
3318
3322
|
const subRows = groupUpRecursively(groupedRows, depth + 1, id);
|
|
3323
|
+
subRows.forEach(subRow => {
|
|
3324
|
+
subRow.parentId = id;
|
|
3325
|
+
});
|
|
3319
3326
|
|
|
3320
3327
|
// Flatten the leaf rows of the rows in this group
|
|
3321
3328
|
const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows;
|