@tanstack/table-core 8.19.1 → 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.
- package/build/lib/features/RowPinning.d.ts +1 -1
- package/build/lib/features/RowPinning.js +7 -7
- package/build/lib/features/RowPinning.js.map +1 -1
- package/build/lib/index.esm.js +15 -8
- package/build/lib/index.esm.js.map +1 -1
- package/build/lib/index.mjs +15 -8
- package/build/lib/index.mjs.map +1 -1
- package/build/lib/utils/getGroupedRowModel.d.ts +1 -1
- package/build/lib/utils/getGroupedRowModel.js +8 -1
- package/build/lib/utils/getGroupedRowModel.js.map +1 -1
- package/build/umd/index.development.js +15 -8
- 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/RowPinning.ts +35 -31
- package/src/utils/getGroupedRowModel.ts +11 -2
package/build/lib/index.mjs
CHANGED
|
@@ -2003,13 +2003,13 @@ const RowPinning = {
|
|
|
2003
2003
|
return isTop ? 'top' : isBottom ? 'bottom' : false;
|
|
2004
2004
|
};
|
|
2005
2005
|
row.getPinnedIndex = () => {
|
|
2006
|
-
var
|
|
2006
|
+
var _ref4, _visiblePinnedRowIds$;
|
|
2007
2007
|
const position = row.getIsPinned();
|
|
2008
2008
|
if (!position) return -1;
|
|
2009
|
-
const visiblePinnedRowIds = (
|
|
2009
|
+
const visiblePinnedRowIds = (_ref4 = position === 'top' ? table.getTopRows() : table.getBottomRows()) == null ? void 0 : _ref4.map(_ref5 => {
|
|
2010
2010
|
let {
|
|
2011
2011
|
id
|
|
2012
|
-
} =
|
|
2012
|
+
} = _ref5;
|
|
2013
2013
|
return id;
|
|
2014
2014
|
});
|
|
2015
2015
|
return (_visiblePinnedRowIds$ = visiblePinnedRowIds == null ? void 0 : visiblePinnedRowIds.indexOf(row.id)) != null ? _visiblePinnedRowIds$ : -1;
|
|
@@ -2030,7 +2030,7 @@ const RowPinning = {
|
|
|
2030
2030
|
}
|
|
2031
2031
|
return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
|
|
2032
2032
|
};
|
|
2033
|
-
table._getPinnedRows =
|
|
2033
|
+
table._getPinnedRows = (visibleRows, pinnedRowIds, position) => {
|
|
2034
2034
|
var _table$options$keepPi;
|
|
2035
2035
|
const rows = ((_table$options$keepPi = table.options.keepPinnedRows) != null ? _table$options$keepPi : true) ?
|
|
2036
2036
|
//get all rows that are pinned even if they would not be otherwise visible
|
|
@@ -2045,9 +2045,9 @@ const RowPinning = {
|
|
|
2045
2045
|
...d,
|
|
2046
2046
|
position
|
|
2047
2047
|
}));
|
|
2048
|
-
}
|
|
2049
|
-
table.getTopRows = () => table._getPinnedRows('top');
|
|
2050
|
-
table.getBottomRows = () => table._getPinnedRows('bottom');
|
|
2048
|
+
};
|
|
2049
|
+
table.getTopRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.top], (allRows, topPinnedRowIds) => table._getPinnedRows(allRows, topPinnedRowIds, 'top'), getMemoOptions(table.options, 'debugRows', 'getTopRows'));
|
|
2050
|
+
table.getBottomRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.bottom], (allRows, bottomPinnedRowIds) => table._getPinnedRows(allRows, bottomPinnedRowIds, 'bottom'), getMemoOptions(table.options, 'debugRows', 'getBottomRows'));
|
|
2051
2051
|
table.getCenterRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.top, table.getState().rowPinning.bottom], (allRows, top, bottom) => {
|
|
2052
2052
|
const topAndBottom = new Set([...(top != null ? top : []), ...(bottom != null ? bottom : [])]);
|
|
2053
2053
|
return allRows.filter(d => !topAndBottom.has(d.id));
|
|
@@ -3259,6 +3259,10 @@ function getFilteredRowModel() {
|
|
|
3259
3259
|
function getGroupedRowModel() {
|
|
3260
3260
|
return table => memo(() => [table.getState().grouping, table.getPreGroupedRowModel()], (grouping, rowModel) => {
|
|
3261
3261
|
if (!rowModel.rows.length || !grouping.length) {
|
|
3262
|
+
rowModel.rows.forEach(row => {
|
|
3263
|
+
row.depth = 0;
|
|
3264
|
+
row.parentId = undefined;
|
|
3265
|
+
});
|
|
3262
3266
|
return rowModel;
|
|
3263
3267
|
}
|
|
3264
3268
|
|
|
@@ -3294,7 +3298,7 @@ function getGroupedRowModel() {
|
|
|
3294
3298
|
// Group the rows together for this level
|
|
3295
3299
|
const rowGroupsMap = groupBy(rows, columnId);
|
|
3296
3300
|
|
|
3297
|
-
//
|
|
3301
|
+
// Perform aggregations for each group
|
|
3298
3302
|
const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map((_ref, index) => {
|
|
3299
3303
|
let [groupingValue, groupedRows] = _ref;
|
|
3300
3304
|
let id = `${columnId}:${groupingValue}`;
|
|
@@ -3302,6 +3306,9 @@ function getGroupedRowModel() {
|
|
|
3302
3306
|
|
|
3303
3307
|
// First, Recurse to group sub rows before aggregation
|
|
3304
3308
|
const subRows = groupUpRecursively(groupedRows, depth + 1, id);
|
|
3309
|
+
subRows.forEach(subRow => {
|
|
3310
|
+
subRow.parentId = id;
|
|
3311
|
+
});
|
|
3305
3312
|
|
|
3306
3313
|
// Flatten the leaf rows of the rows in this group
|
|
3307
3314
|
const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows;
|