1 |
|
2 |
|
3 |
|
4 | export interface IObjectWithKey {
|
5 | key?: string | number;
|
6 | }
|
7 | export declare const SELECTION_CHANGE = "change";
|
8 | export declare const SELECTION_ITEMS_CHANGE = "items-change";
|
9 |
|
10 |
|
11 |
|
12 | export declare enum SelectionMode {
|
13 | none = 0,
|
14 | single = 1,
|
15 | multiple = 2
|
16 | }
|
17 |
|
18 |
|
19 |
|
20 | export interface ISelection<TItem = IObjectWithKey> {
|
21 | count: number;
|
22 | mode: SelectionMode;
|
23 | canSelectItem: (item: TItem, index?: number) => boolean;
|
24 | setChangeEvents(isEnabled: boolean, suppressChange?: boolean): void;
|
25 | setItems(items: TItem[], shouldClear: boolean): void;
|
26 | getItems(): TItem[];
|
27 | getItemIndex?(key: string): number;
|
28 | getSelection(): TItem[];
|
29 | getSelectedIndices(): number[];
|
30 | getSelectedCount(): number;
|
31 | isRangeSelected(fromIndex: number, count: number): boolean;
|
32 | isAllSelected(): boolean;
|
33 | isKeySelected(key: string): boolean;
|
34 | isIndexSelected(index: number): boolean;
|
35 | isModal?(): boolean;
|
36 | setAllSelected(isAllSelected: boolean): void;
|
37 | setKeySelected(key: string, isSelected: boolean, shouldAnchor: boolean): void;
|
38 | setIndexSelected(index: number, isSelected: boolean, shouldAnchor: boolean): void;
|
39 | setRangeSelected?(fromIndex: number, count: number, isSelected: boolean, shouldAnchor: boolean): void;
|
40 | setModal?(isModal: boolean): void;
|
41 | selectToKey(key: string, clearSelection?: boolean): void;
|
42 | selectToIndex(index: number, clearSelection?: boolean): void;
|
43 | selectToRange?(index: number, count: number, clearSelection?: boolean): void;
|
44 | toggleAllSelected(): void;
|
45 | toggleKeySelected(key: string): void;
|
46 | toggleIndexSelected(index: number): void;
|
47 | toggleRangeSelected(fromIndex: number, count: number): void;
|
48 | }
|
49 |
|
50 |
|
51 |
|
52 | export declare enum SelectionDirection {
|
53 | horizontal = 0,
|
54 | vertical = 1
|
55 | }
|