@mui/x-tree-view
Version:
The community edition of the MUI X Tree View components.
43 lines • 1.58 kB
TypeScript
import { TreeViewValidItem, TreeViewItemId } from "../../../models/index.js";
import { TreeViewItemMeta } from "../../models/index.js";
import type { MinimalTreeViewParameters } from "../../MinimalTreeViewStore/index.js";
export declare const TREE_VIEW_ROOT_PARENT_ID = "__TREE_VIEW_ROOT_PARENT_ID__";
export declare const buildSiblingIndexes: (siblings: string[]) => {
[itemId: string]: number;
};
/**
* Check if an item is disabled.
* This method should only be used in selectors that are checking if several items are disabled.
* Otherwise, use the `itemsSelector.isItemDisabled` selector.
* @returns
*/
export declare const isItemDisabled: (itemMetaLookup: {
[itemId: string]: TreeViewItemMeta;
}, itemId: TreeViewItemId) => boolean;
export declare function buildItemsLookups<R extends TreeViewValidItem<R>>(parameters: BuildItemsLookupsParameters<R>): {
metaLookup: {
[itemId: string]: TreeViewItemMeta;
};
modelLookup: {
[itemId: string]: R;
};
orderedChildrenIds: string[];
childrenIndexes: {
[itemId: string]: number;
};
itemsChildren: {
id: string | null;
children: R[];
}[];
};
interface BuildItemsLookupsParameters<R extends TreeViewValidItem<R>> {
items: readonly R[];
storeParameters: Pick<MinimalTreeViewParameters<R, any>, 'getItemId' | 'getItemLabel' | 'getItemChildren' | 'isItemDisabled' | 'isItemSelectionDisabled'>;
parentId: string | null;
depth: number;
isItemExpandable: (item: R, children: R[] | undefined) => boolean;
otherItemsMetaLookup: {
[itemId: string]: TreeViewItemMeta;
};
}
export {};