UNPKG

@mui/x-tree-view

Version:

The community edition of the MUI X Tree View components.

69 lines 2.72 kB
import { TreeViewItemId } from "../../../models/index.js"; export declare class TreeViewExpansionPlugin { private store; constructor(store: any); private setExpandedItems; /** * Check if an item is expanded. * @param {TreeViewItemId} itemId The id of the item to check. * @returns {boolean} `true` if the item is expanded, `false` otherwise. */ private isItemExpanded; buildPublicAPI: () => { isItemExpanded: (itemId: TreeViewItemId) => boolean; setItemExpansion: ({ itemId, event, shouldBeExpanded }: { itemId: TreeViewItemId; event?: React.SyntheticEvent | null; shouldBeExpanded?: boolean; }) => void; }; /** * Change the expansion status of a given item. * @param {object} parameters The parameters of the method. * @param {TreeViewItemId} parameters.itemId The id of the item to expand of collapse. * @param {React.SyntheticEvent} parameters.event The DOM event that triggered the change. * @param {boolean} parameters.shouldBeExpanded If `true` the item will be expanded. If `false` the item will be collapsed. If not defined, the item's expansion status will be the toggled. */ setItemExpansion: ({ itemId, event, shouldBeExpanded }: { itemId: TreeViewItemId; event?: React.SyntheticEvent | null; shouldBeExpanded?: boolean; }) => void; /** * Apply the new expansion status of a given item. * Is used by the `setItemExpansion` method and by the `useTreeViewLazyLoading` plugin. * Unlike `setItemExpansion`, this method does not trigger the lazy loading. * @param {object} parameters The parameters of the method. * @param {TreeViewItemId} parameters.itemId The id of the item to expand of collapse. * @param {React.SyntheticEvent | null} parameters.event The DOM event that triggered the change. * @param {boolean} parameters.shouldBeExpanded If `true` the item will be expanded. If `false` the item will be collapsed. */ applyItemExpansion: ({ itemId, event, shouldBeExpanded }: { itemId: TreeViewItemId; event: React.SyntheticEvent | null; shouldBeExpanded: boolean; }) => void; /** * Expand all the siblings (i.e.: the items that have the same parent) of a given item. * @param {React.SyntheticEvent} event The DOM event that triggered the change. * @param {TreeViewItemId} itemId The id of the item whose siblings will be expanded. */ expandAllSiblings: (event: React.KeyboardEvent, itemId: TreeViewItemId) => void; /** * Mark a list of items as expandable. * @param {TreeViewItemId[]} items The ids of the items to mark as expandable. */ addExpandableItems: (items: TreeViewItemId[]) => void; }