@tanstack/svelte-table 8.19.2 → 8.19.4
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.
|
@@ -3017,25 +3017,18 @@
|
|
|
3017
3017
|
var _table$getColumn;
|
|
3018
3018
|
return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()];
|
|
3019
3019
|
}, facetedRowModel => {
|
|
3020
|
-
var _facetedRowModel$flat;
|
|
3021
3020
|
if (!facetedRowModel) return undefined;
|
|
3022
|
-
const
|
|
3023
|
-
|
|
3024
|
-
return
|
|
3021
|
+
const uniqueValues = facetedRowModel.flatRows.flatMap(flatRow => {
|
|
3022
|
+
var _flatRow$getUniqueVal;
|
|
3023
|
+
return (_flatRow$getUniqueVal = flatRow.getUniqueValues(columnId)) != null ? _flatRow$getUniqueVal : [];
|
|
3024
|
+
}).map(Number).filter(value => !Number.isNaN(value));
|
|
3025
|
+
if (!uniqueValues.length) return;
|
|
3026
|
+
let facetedMinValue = uniqueValues[0];
|
|
3027
|
+
let facetedMaxValue = uniqueValues[uniqueValues.length - 1];
|
|
3028
|
+
for (const value of uniqueValues) {
|
|
3029
|
+
if (value < facetedMinValue) facetedMinValue = value;else if (value > facetedMaxValue) facetedMaxValue = value;
|
|
3025
3030
|
}
|
|
3026
|
-
|
|
3027
|
-
for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
|
|
3028
|
-
const values = facetedRowModel.flatRows[i].getUniqueValues(columnId);
|
|
3029
|
-
for (let j = 0; j < values.length; j++) {
|
|
3030
|
-
const value = values[j];
|
|
3031
|
-
if (value < facetedMinMaxValues[0]) {
|
|
3032
|
-
facetedMinMaxValues[0] = value;
|
|
3033
|
-
} else if (value > facetedMinMaxValues[1]) {
|
|
3034
|
-
facetedMinMaxValues[1] = value;
|
|
3035
|
-
}
|
|
3036
|
-
}
|
|
3037
|
-
}
|
|
3038
|
-
return facetedMinMaxValues;
|
|
3031
|
+
return [facetedMinValue, facetedMaxValue];
|
|
3039
3032
|
}, getMemoOptions(table.options, 'debugTable', 'getFacetedMinMaxValues'));
|
|
3040
3033
|
}
|
|
3041
3034
|
|
|
@@ -3273,6 +3266,10 @@
|
|
|
3273
3266
|
function getGroupedRowModel() {
|
|
3274
3267
|
return table => memo(() => [table.getState().grouping, table.getPreGroupedRowModel()], (grouping, rowModel) => {
|
|
3275
3268
|
if (!rowModel.rows.length || !grouping.length) {
|
|
3269
|
+
rowModel.rows.forEach(row => {
|
|
3270
|
+
row.depth = 0;
|
|
3271
|
+
row.parentId = undefined;
|
|
3272
|
+
});
|
|
3276
3273
|
return rowModel;
|
|
3277
3274
|
}
|
|
3278
3275
|
|
|
@@ -3308,7 +3305,7 @@
|
|
|
3308
3305
|
// Group the rows together for this level
|
|
3309
3306
|
const rowGroupsMap = groupBy(rows, columnId);
|
|
3310
3307
|
|
|
3311
|
-
//
|
|
3308
|
+
// Perform aggregations for each group
|
|
3312
3309
|
const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map((_ref, index) => {
|
|
3313
3310
|
let [groupingValue, groupedRows] = _ref;
|
|
3314
3311
|
let id = `${columnId}:${groupingValue}`;
|
|
@@ -3316,6 +3313,9 @@
|
|
|
3316
3313
|
|
|
3317
3314
|
// First, Recurse to group sub rows before aggregation
|
|
3318
3315
|
const subRows = groupUpRecursively(groupedRows, depth + 1, id);
|
|
3316
|
+
subRows.forEach(subRow => {
|
|
3317
|
+
subRow.parentId = id;
|
|
3318
|
+
});
|
|
3319
3319
|
|
|
3320
3320
|
// Flatten the leaf rows of the rows in this group
|
|
3321
3321
|
const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows;
|