UNPKG

@mui/x-tree-view

Version:

The community edition of the MUI X Tree View components.

32 lines 2.52 kB
import { TreeViewState } from "../models/index.js"; import type { UseTreeViewExpansionSignature } from "../plugins/useTreeViewExpansion/index.js"; import type { UseTreeViewItemsSignature } from "../plugins/useTreeViewItems/index.js"; export declare const getPreviousNavigableItem: (state: TreeViewState<[UseTreeViewItemsSignature, UseTreeViewExpansionSignature]>, itemId: string) => string | null; export declare const getNextNavigableItem: (state: TreeViewState<[UseTreeViewItemsSignature, UseTreeViewExpansionSignature]>, itemId: string) => string | null; export declare const getLastNavigableItem: (state: TreeViewState<[UseTreeViewExpansionSignature, UseTreeViewItemsSignature]>) => string; export declare const getFirstNavigableItem: (state: TreeViewState<[UseTreeViewExpansionSignature, UseTreeViewItemsSignature]>) => string; /** * This is used to determine the start and end of a selection range so * we can get the items between the two border items. * * It finds the items' common ancestor using * a naive implementation of a lowest common ancestor algorithm * (https://en.wikipedia.org/wiki/Lowest_common_ancestor). * Then compares the ancestor's 2 children that are ancestors of itemA and ItemB * so we can compare their indexes to work out which item comes first in a depth first search. * (https://en.wikipedia.org/wiki/Depth-first_search) * * Another way to put it is which item is shallower in a trémaux tree * https://en.wikipedia.org/wiki/Tr%C3%A9maux_tree */ export declare const findOrderInTremauxTree: (state: TreeViewState<[UseTreeViewExpansionSignature, UseTreeViewItemsSignature]>, itemAId: string, itemBId: string) => string[]; export declare const getNonDisabledItemsInRange: (state: TreeViewState<[UseTreeViewItemsSignature, UseTreeViewExpansionSignature]>, itemAId: string, itemBId: string) => string[]; export declare const getAllNavigableItems: (state: TreeViewState<[UseTreeViewItemsSignature, UseTreeViewExpansionSignature]>) => string[]; /** * Checks if the target is in a descendant of this item. * This can prevent from firing some logic on the ancestors on the interacted item when the event handler is on the root. * @param {HTMLElement} target The target to check * @param {HTMLElement | null} itemRoot The root of the item to check if the event target is in its descendants * @returns {boolean} Whether the target is in a descendant of this item */ export declare const isTargetInDescendants: (target: HTMLElement, itemRoot: HTMLElement | null) => boolean;