UNPKG

@mui/x-tree-view

Version:

The community edition of the MUI X Tree View components.

35 lines 1.92 kB
import { TreeViewItemMeta, TreeViewPluginSignature } from "../../models/index.js"; import { UseTreeViewItemsSignature } from "../useTreeViewItems/index.js"; import { UseTreeViewKeyboardNavigationSignature } from "../useTreeViewKeyboardNavigation/index.js"; import { TreeViewItemId } from "../../../models/index.js"; export interface UseTreeViewItemsInstance { /** * Insert a new item in the state from a Tree Item component. * @param {TreeViewItemMeta} item The meta-information of the item to insert. * @returns {() => void} A function to remove the item from the state. */ insertJSXItem: (item: TreeViewItemMeta) => () => void; /** * Updates the `labelMap` to register the first character of the given item's label. * This map is used to navigate the tree using type-ahead search. * @param {TreeViewItemId} itemId The id of the item to map the label of. * @param {string} label The item's label. * @returns {() => void} A function to remove the item from the `labelMap`. */ mapLabelFromJSX: (itemId: TreeViewItemId, label: string) => () => void; /** * Store the ids of a given item's children in the state. * Those ids must be passed in the order they should be rendered. * @param {TreeViewItemId | null} parentId The id of the item to store the children of. * @param {TreeViewItemId[]} orderedChildrenIds The ids of the item's children. */ setJSXItemsOrderedChildrenIds: (parentId: TreeViewItemId | null, orderedChildrenIds: TreeViewItemId[]) => void; } export interface UseTreeViewJSXItemsParameters {} export interface UseTreeViewItemsParametersWithDefaults {} export type UseTreeViewJSXItemsSignature = TreeViewPluginSignature<{ params: UseTreeViewJSXItemsParameters; paramsWithDefaults: UseTreeViewItemsParametersWithDefaults; instance: UseTreeViewItemsInstance; dependencies: [UseTreeViewItemsSignature, UseTreeViewKeyboardNavigationSignature]; }>;