import { SelectionMode } from "./SelectionModes"; /** Prototype for a Selection Changed handler * @public */ export declare type OnSelectionChanged = (shiftDown?: boolean, ctrlDown?: boolean) => void; /** * Contains single item specific methods required by selection handler. * @internal */ export interface SingleSelectionHandler { /** * Callback for before an item is selected. */ preselect: () => void; /** * Selects the item. */ select: () => void; /** * Deselects the item. */ deselect: () => void; /** * Returns true if item is selected. */ isSelected: () => boolean; /** * Returns the item. */ item: () => TItem; } /** * Contains multi-selection methods required by selection handler. * @internal */ export interface MultiSelectionHandler { /** * Shift selects between two items. * Returns items that were selected. */ selectBetween: (item1: TItem, item2: TItem) => TItem[]; /** * Updates selection. * @param selections Items to be added to selection. * @param deselections Items to be removed from selection. */ updateSelection: (selections: TItem[], deselections: TItem[]) => void; /** * Deselects all items. */ deselectAll: () => void; /** * Returns true if items are equal. */ areEqual: (item1: TItem, item2: TItem) => boolean; } /** * Called after items were selected. * @param items Items that were selected. * @param replace Should replace current selection. * @public */ export declare type OnItemsSelectedCallback = (items: TItem[], replace: boolean) => void | boolean; /** * Called after items were deselected. * @param items Items that were deselected. * @public */ export declare type OnItemsDeselectedCallback = (items: Item[]) => void | boolean; /** @internal */ export declare class DragAction { private _itemSelectionHandlers; private _componentSelectionHandler; private _previousRow; private _previousColumn; private _firstItemRow; private _firstItemColumn; private _firstItemSelected; constructor(componentSelectionHandler: MultiSelectionHandler, itemSelectionHandlers: Array>>, firstItem: Item); updateDragAction(latestItem: Item): { selections: Item[]; deselections: Item[]; }; private findItem; } /** @internal */ export declare class SelectionHandler { /** Selection mode. */ selectionMode: SelectionMode; onItemsSelectedCallback?: OnItemsSelectedCallback; onItemsDeselectedCallback?: OnItemsDeselectedCallback; private _currentOperation?; private _lastItem?; private _processedItem?; private _dragAction?; private _componentSelectionHandler?; constructor(selectionMode: SelectionMode, onItemsSelectedCallback?: OnItemsSelectedCallback, onItemsDeselectedCallback?: OnItemsDeselectedCallback); /** Get the onSelectionChange processed item */ get processedItem(): Item | undefined; /** Creates a function that should be called when selection changes. */ createSelectionFunction(componentHandler: MultiSelectionHandler, itemHandler: SingleSelectionHandler): OnSelectionChanged; private completeOperation; /** * Creates drag action. * @param componentSelectionHandler Component selection handler. * @param items Ordered item selection handlers separated into arrays by rows. * @param firstItem Item on which drag action was started. */ createDragAction(componentSelectionHandler: MultiSelectionHandler, items: Array>>, firstItem: Item): void; /** * Updates existing drag action. * @param latestItem Latest item in drag action. */ updateDragAction(latestItem: Item): void; /** * Completes drag action. */ completeDragAction(): void; } //# sourceMappingURL=SelectionHandler.d.ts.map