@mui/x-data-grid-pro
Version:
The Pro plan edition of the MUI X Data Grid components.
37 lines (35 loc) • 1.4 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getParentPath = getParentPath;
exports.skipFiltering = skipFiltering;
exports.skipSorting = skipSorting;
var _xDataGrid = require("@mui/x-data-grid");
var _internals = require("@mui/x-data-grid/internals");
function skipFiltering(rowTree) {
const filteredChildrenCountLookup = {};
const nodes = Object.values(rowTree);
for (let i = 0; i < nodes.length; i += 1) {
const node = nodes[i];
filteredChildrenCountLookup[node.id] = node.serverChildrenCount ?? 0;
}
return {
filteredRowsLookup: _internals.defaultGridFilterLookup.filteredRowsLookup,
filteredChildrenCountLookup,
filteredDescendantCountLookup: _internals.defaultGridFilterLookup.filteredDescendantCountLookup
};
}
function skipSorting(rowTree) {
return (0, _internals.getTreeNodeDescendants)(rowTree, _xDataGrid.GRID_ROOT_GROUP_ID, false);
}
/**
* Retrieves the parent path for a row from the previous tree state.
* Used during full tree updates to maintain correct hierarchy.
*/
function getParentPath(rowId, treeCreationParams) {
if (treeCreationParams.updates.type !== 'full' || !treeCreationParams.previousTree?.[rowId] || treeCreationParams.previousTree[rowId].depth < 1 || !('path' in treeCreationParams.previousTree[rowId])) {
return [];
}
return treeCreationParams.previousTree[rowId].path || [];
}
;