UNPKG

@mui/x-tree-view

Version:

The community edition of the MUI X Tree View components.

90 lines 4.31 kB
import { Store } from '@mui/x-internals/store'; import { MinimalTreeViewParameters, TreeViewParametersToStateMapper, MinimalTreeViewState } from "./MinimalTreeViewStore.types.js"; import { TreeViewValidItem } from "../../models/index.js"; import { TimeoutManager } from "./TimeoutManager.js"; import { TreeViewKeyboardNavigationPlugin } from "../plugins/keyboardNavigation/index.js"; import { TreeViewFocusPlugin } from "../plugins/focus/TreeViewFocusPlugin.js"; import { TreeViewItemsPlugin } from "../plugins/items/TreeViewItemsPlugin.js"; import { TreeViewSelectionPlugin } from "../plugins/selection/TreeViewSelectionPlugin.js"; import { TreeViewExpansionPlugin } from "../plugins/expansion/index.js"; import { TreeViewItemPluginManager } from "./TreeViewItemPluginManager.js"; import { TreeViewEventEvent, TreeViewEventListener, TreeViewEventParameters, TreeViewEvents } from "../models/index.js"; export declare class MinimalTreeViewStore<R extends TreeViewValidItem<R>, Multiple extends boolean | undefined, State extends MinimalTreeViewState<R, Multiple> = MinimalTreeViewState<R, Multiple>, Parameters extends MinimalTreeViewParameters<R, Multiple> = MinimalTreeViewParameters<R, Multiple>> extends Store<State> { private initialParameters; private mapper; private eventManager; instanceName: string; parameters: Parameters; timeoutManager: TimeoutManager; itemPluginManager: TreeViewItemPluginManager<this>; items: TreeViewItemsPlugin<R>; focus: TreeViewFocusPlugin; expansion: TreeViewExpansionPlugin; selection: TreeViewSelectionPlugin<Multiple>; keyboardNavigation: TreeViewKeyboardNavigationPlugin; constructor(parameters: Parameters, instanceName: string, mapper: TreeViewParametersToStateMapper<R, Multiple, State, Parameters>); /** * Builds an object containing the method that should be exposed publicly by the Tree View components. */ buildPublicAPI(): { setItemSelection: ({ itemId, event, keepExistingSelection, shouldBeSelected }: { itemId: string; event?: React.SyntheticEvent | null; shouldBeSelected?: boolean; keepExistingSelection?: boolean; }) => void; isItemExpanded: (itemId: import("../../index.js").TreeViewItemId) => boolean; setItemExpansion: ({ itemId, event, shouldBeExpanded }: { itemId: import("../../index.js").TreeViewItemId; event?: React.SyntheticEvent | null; shouldBeExpanded?: boolean; }) => void; focusItem: (event: React.SyntheticEvent | null, itemId: import("../../index.js").TreeViewItemId) => void; getItem: (itemId: import("../../index.js").TreeViewItemId) => R; getItemDOMElement: (itemId: import("../../index.js").TreeViewItemId) => HTMLElement | null; getItemOrderedChildrenIds: (itemId: import("../../index.js").TreeViewItemId | null) => import("../../index.js").TreeViewItemId[]; getItemTree: () => R[]; getParentId: (itemId: import("../../index.js").TreeViewItemId) => import("../../index.js").TreeViewItemId | null; setIsItemDisabled: ({ itemId, shouldBeDisabled }: { itemId: import("../../index.js").TreeViewItemId; shouldBeDisabled?: boolean; }) => void; }; /** * Updates the state of the Tree View based on the new parameters provided to the root component. */ updateStateFromParameters(parameters: Parameters): void; /** * Returns a cleanup function that need to be called when the store is destroyed. */ disposeEffect: () => () => void; /** * Whether updates based on `props.items` change should be ignored. */ shouldIgnoreItemsStateUpdate: () => boolean; /** * Registers an effect to be run when the value returned by the selector changes. */ registerStoreEffect: <Value>(selector: (state: State) => Value, effect: (previous: Value, next: Value) => void) => void; /** * Publishes an event to all its subscribers. */ publishEvent: <E extends TreeViewEvents>(name: E, params: TreeViewEventParameters<E>, event: TreeViewEventEvent<E>) => void; /** * Subscribe to an event emitted by the store. * For now, the subscription is only removed when the store is destroyed. */ subscribeEvent: <E extends TreeViewEvents>(eventName: E, handler: TreeViewEventListener<E>) => void; }