@mui/x-tree-view
Version:
The community edition of the MUI X Tree View components.
33 lines • 1.68 kB
TypeScript
import { TreeViewItemId } from "../../../models/index.js";
import { TreeViewItemMeta } from "../../models/index.js";
import type { SimpleTreeViewStore } from "../../SimpleTreeViewStore/index.js";
export declare class TreeViewJSXItemsPlugin {
private store;
/**
* Tracks which component instance owns each item id,
* so that duplicate ids from different components can be detected.
*/
private itemOwners;
constructor(store: SimpleTreeViewStore<any>);
/**
* Insert or update an item in the state from a Tree Item component.
* If the item already exists and belongs to the same owner (e.g. after a deps-change re-run of the layout effect),
* its meta is updated in place instead of removing and re-inserting.
*/
upsertJSXItem: (item: TreeViewItemMeta, ownerToken: symbol) => () => 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;
}