1 | import { TreeNode } from './tree';
|
2 | import { Event, Disposable, SelectionProvider } from '../../common';
|
3 |
|
4 |
|
5 |
|
6 | export declare const TreeSelectionService: unique symbol;
|
7 | export interface TreeSelectionService extends Disposable, SelectionProvider<ReadonlyArray<Readonly<SelectableTreeNode>>> {
|
8 | |
9 |
|
10 |
|
11 |
|
12 | readonly selectedNodes: ReadonlyArray<Readonly<SelectableTreeNode>>;
|
13 | |
14 |
|
15 |
|
16 | readonly onSelectionChanged: Event<ReadonlyArray<Readonly<SelectableTreeNode>>>;
|
17 | |
18 |
|
19 |
|
20 |
|
21 |
|
22 | addSelection(selectionOrTreeNode: TreeSelection | Readonly<SelectableTreeNode>): void;
|
23 | |
24 |
|
25 |
|
26 | clearSelection(): void;
|
27 | |
28 |
|
29 |
|
30 | storeState(): object;
|
31 | |
32 |
|
33 |
|
34 | restoreState(state: object): void;
|
35 | }
|
36 |
|
37 |
|
38 |
|
39 | export interface TreeSelection {
|
40 | |
41 |
|
42 |
|
43 | readonly node: Readonly<SelectableTreeNode>;
|
44 | |
45 |
|
46 |
|
47 | readonly type?: TreeSelection.SelectionType;
|
48 | }
|
49 | export declare namespace TreeSelection {
|
50 | |
51 |
|
52 |
|
53 | enum SelectionType {
|
54 | DEFAULT = 0,
|
55 | TOGGLE = 1,
|
56 | RANGE = 2
|
57 | }
|
58 | function is(arg: unknown): arg is TreeSelection;
|
59 | function isRange(arg: TreeSelection | SelectionType | undefined): boolean;
|
60 | function isToggle(arg: TreeSelection | SelectionType | undefined): boolean;
|
61 | }
|
62 |
|
63 |
|
64 |
|
65 | export interface SelectableTreeNode extends TreeNode {
|
66 | |
67 |
|
68 |
|
69 | selected: boolean;
|
70 | |
71 |
|
72 |
|
73 |
|
74 |
|
75 | focus?: boolean;
|
76 | }
|
77 | export declare namespace SelectableTreeNode {
|
78 | function is(node: unknown): node is SelectableTreeNode;
|
79 | function isSelected(node: unknown): node is SelectableTreeNode;
|
80 | |
81 |
|
82 |
|
83 | function hasFocus(node: TreeNode | undefined): boolean;
|
84 | function isVisible(node: TreeNode | undefined): node is SelectableTreeNode;
|
85 | function getVisibleParent(node: TreeNode | undefined): SelectableTreeNode | undefined;
|
86 | }
|
87 |
|
\ | No newline at end of file |