@mui/x-tree-view
Version:
The community edition of the MUI X Tree View components.
49 lines • 1.93 kB
TypeScript
import { TreeViewBaseItem, TreeViewItemId } from "../../../models/index.js";
import { TreeViewItemMeta } from "../../models/index.js";
import { UseTreeViewItemsParametersWithDefaults, UseTreeViewItemsState } from "./useTreeViewItems.types.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;
type State = UseTreeViewItemsState<any>['items'];
export declare function buildItemsState(parameters: BuildItemsStateParameters): State;
interface BuildItemsStateParameters extends Pick<BuildItemsLookupsParameters, 'items' | 'config'> {
disabledItemsFocusable: boolean;
}
export declare function buildItemsLookups(parameters: BuildItemsLookupsParameters): {
metaLookup: {
[itemId: string]: TreeViewItemMeta;
};
modelLookup: {
[itemId: string]: any;
};
orderedChildrenIds: string[];
childrenIndexes: {
[itemId: string]: number;
};
itemsChildren: {
id: string | null;
children: TreeViewBaseItem[];
}[];
};
interface BuildItemsLookupsParameters {
items: readonly TreeViewBaseItem[];
config: BuildItemsLookupConfig;
parentId: string | null;
depth: number;
isItemExpandable: (item: TreeViewBaseItem, children: TreeViewBaseItem[] | undefined) => boolean;
otherItemsMetaLookup: {
[itemId: string]: TreeViewItemMeta;
};
}
export interface BuildItemsLookupConfig extends Pick<UseTreeViewItemsParametersWithDefaults<TreeViewBaseItem>, 'isItemDisabled' | 'getItemLabel' | 'getItemChildren' | 'getItemId'> {}
export {};