@mui/x-tree-view
Version:
The community edition of the MUI X Tree View components.
73 lines • 3.33 kB
TypeScript
export declare class TreeViewSelectionPlugin<Multiple extends boolean | undefined> {
private store;
private lastSelectedItem;
private lastSelectedRange;
constructor(store: any);
private setSelectedItems;
private selectRange;
buildPublicAPI: () => {
setItemSelection: ({
itemId,
event,
keepExistingSelection,
shouldBeSelected
}: {
itemId: string;
event?: React.SyntheticEvent | null;
shouldBeSelected?: boolean;
keepExistingSelection?: boolean;
}) => void;
};
/**
* Select or deselect an item.
* @param {object} parameters The parameters of the method.
* @param {TreeViewItemId} parameters.itemId The id of the item to select or deselect.
* @param {React.SyntheticEvent} parameters.event The DOM event that triggered the change.
* @param {boolean} parameters.keepExistingSelection If `true`, the other already selected items will remain selected, otherwise, they will be deselected. This parameter is only relevant when `multiSelect` is `true`
* @param {boolean | undefined} parameters.shouldBeSelected If `true` the item will be selected. If `false` the item will be deselected. If not defined, the item's selection status will be toggled.
*/
setItemSelection: ({
itemId,
event,
keepExistingSelection,
shouldBeSelected
}: {
itemId: string;
event?: React.SyntheticEvent | null;
shouldBeSelected?: boolean;
keepExistingSelection?: boolean;
}) => void;
/**
* Select all the navigable items in the tree.
* @param {React.SyntheticEvent} event The DOM event that triggered the change.
*/
selectAllNavigableItems: (event: React.SyntheticEvent) => void;
/**
* Expand the current selection range up to the given item.
* @param {React.SyntheticEvent} event The DOM event that triggered the change.
* @param {TreeViewItemId} itemId The id of the item to expand the selection to.
*/
expandSelectionRange: (event: React.SyntheticEvent, itemId: string) => void;
/**
* Expand the current selection range from the first navigable item to the given item.
* @param {React.SyntheticEvent} event The DOM event that triggered the change.
* @param {TreeViewItemId} itemId The id of the item up to which the selection range should be expanded.
*/
selectRangeFromStartToItem: (event: React.SyntheticEvent, itemId: string) => void;
/**
* Expand the current selection range from the given item to the last navigable item.
* @param {React.SyntheticEvent} event The DOM event that triggered the change.
* @param {TreeViewItemId} itemId The id of the item from which the selection range should be expanded.
*/
selectRangeFromItemToEnd: (event: React.SyntheticEvent, itemId: string) => void;
/**
* Update the selection when navigating with ArrowUp / ArrowDown keys.
* @param {React.SyntheticEvent} event The DOM event that triggered the change.
* @param {TreeViewItemId} currentItemId The id of the active item before the keyboard navigation.
* @param {TreeViewItemId} nextItemId The id of the active item after the keyboard navigation.
*/
selectItemFromArrowNavigation: (event: React.SyntheticEvent, currentItem: string, nextItem: string) => void;
}
export declare function getLookupFromArray(array: string[]): {
[itemId: string]: true;
};