@tanstack/react-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.
|
@@ -3036,25 +3036,18 @@
|
|
|
3036
3036
|
var _table$getColumn;
|
|
3037
3037
|
return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()];
|
|
3038
3038
|
}, facetedRowModel => {
|
|
3039
|
-
var _facetedRowModel$flat;
|
|
3040
3039
|
if (!facetedRowModel) return undefined;
|
|
3041
|
-
const
|
|
3042
|
-
|
|
3043
|
-
return
|
|
3040
|
+
const uniqueValues = facetedRowModel.flatRows.flatMap(flatRow => {
|
|
3041
|
+
var _flatRow$getUniqueVal;
|
|
3042
|
+
return (_flatRow$getUniqueVal = flatRow.getUniqueValues(columnId)) != null ? _flatRow$getUniqueVal : [];
|
|
3043
|
+
}).map(Number).filter(value => !Number.isNaN(value));
|
|
3044
|
+
if (!uniqueValues.length) return;
|
|
3045
|
+
let facetedMinValue = uniqueValues[0];
|
|
3046
|
+
let facetedMaxValue = uniqueValues[uniqueValues.length - 1];
|
|
3047
|
+
for (const value of uniqueValues) {
|
|
3048
|
+
if (value < facetedMinValue) facetedMinValue = value;else if (value > facetedMaxValue) facetedMaxValue = value;
|
|
3044
3049
|
}
|
|
3045
|
-
|
|
3046
|
-
for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
|
|
3047
|
-
const values = facetedRowModel.flatRows[i].getUniqueValues(columnId);
|
|
3048
|
-
for (let j = 0; j < values.length; j++) {
|
|
3049
|
-
const value = values[j];
|
|
3050
|
-
if (value < facetedMinMaxValues[0]) {
|
|
3051
|
-
facetedMinMaxValues[0] = value;
|
|
3052
|
-
} else if (value > facetedMinMaxValues[1]) {
|
|
3053
|
-
facetedMinMaxValues[1] = value;
|
|
3054
|
-
}
|
|
3055
|
-
}
|
|
3056
|
-
}
|
|
3057
|
-
return facetedMinMaxValues;
|
|
3050
|
+
return [facetedMinValue, facetedMaxValue];
|
|
3058
3051
|
}, getMemoOptions(table.options, 'debugTable', 'getFacetedMinMaxValues'));
|
|
3059
3052
|
}
|
|
3060
3053
|
|
|
@@ -3292,6 +3285,10 @@
|
|
|
3292
3285
|
function getGroupedRowModel() {
|
|
3293
3286
|
return table => memo(() => [table.getState().grouping, table.getPreGroupedRowModel()], (grouping, rowModel) => {
|
|
3294
3287
|
if (!rowModel.rows.length || !grouping.length) {
|
|
3288
|
+
rowModel.rows.forEach(row => {
|
|
3289
|
+
row.depth = 0;
|
|
3290
|
+
row.parentId = undefined;
|
|
3291
|
+
});
|
|
3295
3292
|
return rowModel;
|
|
3296
3293
|
}
|
|
3297
3294
|
|
|
@@ -3327,7 +3324,7 @@
|
|
|
3327
3324
|
// Group the rows together for this level
|
|
3328
3325
|
const rowGroupsMap = groupBy(rows, columnId);
|
|
3329
3326
|
|
|
3330
|
-
//
|
|
3327
|
+
// Perform aggregations for each group
|
|
3331
3328
|
const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map((_ref, index) => {
|
|
3332
3329
|
let [groupingValue, groupedRows] = _ref;
|
|
3333
3330
|
let id = `${columnId}:${groupingValue}`;
|
|
@@ -3335,6 +3332,9 @@
|
|
|
3335
3332
|
|
|
3336
3333
|
// First, Recurse to group sub rows before aggregation
|
|
3337
3334
|
const subRows = groupUpRecursively(groupedRows, depth + 1, id);
|
|
3335
|
+
subRows.forEach(subRow => {
|
|
3336
|
+
subRow.parentId = id;
|
|
3337
|
+
});
|
|
3338
3338
|
|
|
3339
3339
|
// Flatten the leaf rows of the rows in this group
|
|
3340
3340
|
const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows;
|