@mui/x-data-grid-pro
Version:
The Pro plan edition of the MUI X Data Grid components.
64 lines • 2.01 kB
TypeScript
import { GridRowId, GridRowTreeConfig } from '@mui/x-data-grid';
import { GridTreeDepths } from '@mui/x-data-grid/internals';
import { GridTreePathDuplicateHandler, RowTreeBuilderGroupingCriterion } from "./models.js";
import { DataGridProProps } from "../../models/dataGridProProps.js";
interface InsertDataRowInTreeParams {
/**
* ID of the data row to insert in the tree.
*/
id: GridRowId;
/**
* Path of the data row to insert in the tree.
*/
path: RowTreeBuilderGroupingCriterion[];
/**
* Tree in which to insert the data row.
* This tree can be mutated but it's children should not.
* For instance:
*
* - `tree[nodeId] = newNode` => valid
* - `tree[nodeId].children.push(newNodeId)` => invalid
*/
tree: GridRowTreeConfig;
/**
* Previous tree instance for comparison.
*/
previousTree: GridRowTreeConfig | null;
/**
* Amount of nodes at each depth of the tree.
* This object can be mutated.
* For instance:
*
* - `treeDepths[nodeDepth] = treeDepth[nodeDepth] + 1` => valid
*/
treeDepths: GridTreeDepths;
/**
* Callback fired when trying to insert a data row for a path already populated by another data row.
*/
onDuplicatePath?: GridTreePathDuplicateHandler;
isGroupExpandedByDefault?: DataGridProProps['isGroupExpandedByDefault'];
defaultGroupingExpansionDepth: number;
serverChildrenCount?: number;
groupsToFetch?: Set<GridRowId>;
maxDepth?: number;
}
/**
* Inserts a data row in a tree.
* For each steps of its path:
* - if a node exists with the same partial path, it will register this node as the ancestor of the data row.
* - if not, it will create an auto-generated node and register it as ancestor of the data row.
*/
export declare const insertDataRowInTree: ({
id,
path,
previousTree,
tree,
treeDepths,
onDuplicatePath,
isGroupExpandedByDefault,
defaultGroupingExpansionDepth,
serverChildrenCount,
groupsToFetch,
maxDepth
}: InsertDataRowInTreeParams) => void;
export {};