@keenmate/svelte-treeview 1.0.0-beta.0 → 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,50 +1,51 @@
1
- <!-- component from https://svelte.dev/repl/3a33725c3adb4f57b46b597f9dade0c1?version=3.25.0 -->
2
-
3
- <script>
4
- // @ts-nocheck
5
-
6
- import { onMount, setContext, createEventDispatcher } from 'svelte';
7
- import { fade } from 'svelte/transition';
8
- import { key } from './menu.js';
9
-
10
- export let x;
11
- export let y;
12
-
13
- // whenever x and y is changed, restrict box to be within bounds
14
- $: (() => {
15
- if (!menuEl) return;
16
-
17
- const rect = menuEl.getBoundingClientRect();
18
- x = Math.min(window.innerWidth - rect.width, x);
19
- if (y > window.innerHeight - rect.height) y -= rect.height;
20
- })(x, y);
21
-
22
- const dispatch = createEventDispatcher();
23
-
24
- setContext(key, {
25
- dispatchClick: () => dispatch('click')
26
- });
27
-
28
- let menuEl;
29
- function onPageClick(e) {
30
- if (e.target === menuEl || menuEl.contains(e.target)) return;
31
- dispatch('clickoutside');
32
- }
33
- </script>
34
-
35
- <svelte:body on:click={onPageClick} />
36
-
37
- <div transition:fade={{ duration: 100 }} bind:this={menuEl} style="top: {y}px; left: {x}px;">
38
- <slot />
39
- </div>
40
-
41
- <style>
42
- div {
43
- position: fixed;
44
- display: grid;
45
- border: 1px solid #0003;
46
- box-shadow: 2px 2px 5px 0px #0002;
47
- background: white;
48
- z-index: 999;
49
- }
50
- </style>
1
+ <!-- component from https://svelte.dev/repl/3a33725c3adb4f57b46b597f9dade0c1?version=3.25.0 -->
2
+
3
+ <script>
4
+ // @ts-nocheck
5
+
6
+ import { onMount, setContext, createEventDispatcher } from 'svelte';
7
+ import { fade } from 'svelte/transition';
8
+ import { key } from './menu.js';
9
+
10
+ export let x;
11
+ export let y;
12
+
13
+ // whenever x and y is changed, restrict box to be within bounds
14
+ $: (() => {
15
+ if (!menuEl) return;
16
+
17
+ const rect = menuEl.getBoundingClientRect();
18
+ x = Math.min(window.innerWidth - rect.width, x);
19
+ if (y > window.innerHeight - rect.height) y -= rect.height;
20
+ })(x, y);
21
+
22
+ const dispatch = createEventDispatcher();
23
+
24
+ setContext(key, {
25
+ dispatchClick: () => dispatch('click')
26
+ });
27
+
28
+ let menuEl;
29
+ function onPageClick(e) {
30
+ if (e.target === menuEl || menuEl.contains(e.target)) return;
31
+ dispatch('clickoutside');
32
+ }
33
+ </script>
34
+
35
+ <svelte:body on:click={onPageClick} />
36
+
37
+ <div transition:fade={{ duration: 100 }} bind:this={menuEl} style="top: {y}px; left: {x}px;">
38
+ <slot />
39
+ </div>
40
+
41
+ <style>
42
+ div {
43
+ position: fixed;
44
+ display: grid;
45
+ border: 1px solid #0003;
46
+ box-shadow: 2px 2px 5px 0px #0002;
47
+ background: white;
48
+ z-index: 999;
49
+ }
50
+
51
+ </style>
@@ -1,10 +1,11 @@
1
- <style>
2
- hr {
3
- border-top: 1px solid #0003;
4
- width: 100%;
5
- margin: 2px 0;
6
- }
7
- </style>
8
-
9
-
10
- <hr />
1
+ <style>
2
+ hr {
3
+ border-top: 1px solid #0003;
4
+ width: 100%;
5
+ margin: 2px 0;
6
+ }
7
+
8
+ </style>
9
+
10
+
11
+ <hr />
@@ -1,49 +1,50 @@
1
- <script>
2
- // @ts-nocheck
3
-
4
- import { onMount, getContext } from 'svelte';
5
- import { key } from './menu.js';
6
-
7
- export let isDisabled = false;
8
- export let text = '';
9
-
10
- import { createEventDispatcher } from 'svelte';
11
- const dispatch = createEventDispatcher();
12
-
13
- const { dispatchClick } = getContext(key);
14
-
15
- const handleClick = (e) => {
16
- if (isDisabled) return;
17
-
18
- dispatch('click');
19
- dispatchClick();
20
- };
21
- </script>
22
-
23
- <div class:disabled={isDisabled} on:click={handleClick} on:keydown={handleClick} role="button" tabindex="">
24
- {#if text}
25
- {text}
26
- {:else}
27
- <slot />
28
- {/if}
29
- </div>
30
-
31
- <style>
32
- div {
33
- padding: 4px 15px;
34
- cursor: default;
35
- font-size: 14px;
36
- display: flex;
37
- align-items: center;
38
- grid-gap: 5px;
39
- }
40
- div:hover {
41
- background: #0002;
42
- }
43
- div.disabled {
44
- color: #0006;
45
- }
46
- div.disabled:hover {
47
- background: white;
48
- }
49
- </style>
1
+ <script>
2
+ // @ts-nocheck
3
+
4
+ import { onMount, getContext } from 'svelte';
5
+ import { key } from './menu.js';
6
+
7
+ export let isDisabled = false;
8
+ export let text = '';
9
+
10
+ import { createEventDispatcher } from 'svelte';
11
+ const dispatch = createEventDispatcher();
12
+
13
+ const { dispatchClick } = getContext(key);
14
+
15
+ const handleClick = (e) => {
16
+ if (isDisabled) return;
17
+
18
+ dispatch('click');
19
+ dispatchClick();
20
+ };
21
+ </script>
22
+
23
+ <div class:disabled={isDisabled} on:click={handleClick} on:keydown={handleClick} role="button" tabindex="">
24
+ {#if text}
25
+ {text}
26
+ {:else}
27
+ <slot />
28
+ {/if}
29
+ </div>
30
+
31
+ <style>
32
+ div {
33
+ padding: 4px 15px;
34
+ cursor: default;
35
+ font-size: 14px;
36
+ display: flex;
37
+ align-items: center;
38
+ grid-gap: 5px;
39
+ }
40
+ div:hover {
41
+ background: #0002;
42
+ }
43
+ div.disabled {
44
+ color: #0006;
45
+ }
46
+ div.disabled:hover {
47
+ background: white;
48
+ }
49
+
50
+ </style>
package/dist/menu/menu.js CHANGED
@@ -1,3 +1,3 @@
1
- const key = {};
2
-
1
+ const key = {};
2
+
3
3
  export { key };
@@ -1,29 +0,0 @@
1
- import type { PropertyHelper } from '../helpers/property-helper.js';
2
- import type { TreeHelper } from '../helpers/tree-helper.js';
3
- import { InsertionType, type Node, type NodePath, type Tree } from '../types.js';
4
- export declare class DragDropProvider {
5
- helper: TreeHelper;
6
- props: PropertyHelper;
7
- separator: string;
8
- constructor(treeHelper: TreeHelper);
9
- path(node: Node): NodePath;
10
- /**
11
- * moves node from one parent to another
12
- * @param {Object[]} tree - tree
13
- * @param {nodePath} movedNodePath - nodepath of moved(dragged) node
14
- * @param {nodePath} targetNodePath - nodepath of node where it should be moved ( either bellow it in priority or as child)
15
- * @param {int} insType - if true, it will insert moved node as child of target node, if false, it will insert it bellow it in priority
16
- * @param {boolean} recalculateNodePath - wont recalculare id of moved node, used when last part of nodePath is always unique
17
- */
18
- moveNode(tree: Node[], movedNodePath: NodePath, targetNodePath: NodePath, insType: InsertionType, recalculateNodePath: boolean): Node[];
19
- calculateNewNodePath(tree: Tree, parentNodePath: NodePath, movedNodePath: NodePath, recalculateNodePath: boolean): string;
20
- updatePriority(tree: Tree, node: Node, parentNodePath: NodePath, newNodePath: NodePath, targetNode: Node, insType: InsertionType): void;
21
- /** recomputes all priorities after inserted priority.F
22
- * Also changes all priorities to be one apart (1,5,6 => 1,2,3)
23
- */
24
- recalculatesPriorities(tree: Tree, parentNode: NodePath, movedNodePath: NodePath, insertedPriority?: number): void;
25
- /** return biggest value of nodepath number that children are using +1 */
26
- getNextNodeId(tree: Tree, parentPath: NodePath): string;
27
- getInsertionPosition(e: DragEvent, element: HTMLElement): InsertionType;
28
- getNodeIdFromPath(nodePath: NodePath): string | null;
29
- }
@@ -1,163 +1,186 @@
1
- import { InsertionType } from '../types.js';
2
- export class DragDropProvider {
3
- helper;
4
- props;
5
- separator;
6
- constructor(treeHelper) {
7
- this.helper = treeHelper;
8
- this.props = treeHelper.props;
9
- this.separator = this.helper.config.separator ?? '.';
10
- }
11
- path(node) {
12
- return this.helper.path(node);
13
- }
14
- /**
15
- * moves node from one parent to another
16
- * @param {Object[]} tree - tree
17
- * @param {nodePath} movedNodePath - nodepath of moved(dragged) node
18
- * @param {nodePath} targetNodePath - nodepath of node where it should be moved ( either bellow it in priority or as child)
19
- * @param {int} insType - if true, it will insert moved node as child of target node, if false, it will insert it bellow it in priority
20
- * @param {boolean} recalculateNodePath - wont recalculare id of moved node, used when last part of nodePath is always unique
21
- */
22
- moveNode(tree, movedNodePath, targetNodePath, insType, recalculateNodePath) {
23
- // cannot move root node
24
- if (!movedNodePath)
25
- return tree;
26
- const isNesting = insType === InsertionType.nest;
27
- // if you are not isNestinging, you want to be on same level
28
- //so you will have same parent as target node
29
- const parentNodePath = isNesting
30
- ? targetNodePath
31
- : this.helper.getParentNodePath(targetNodePath);
32
- //trying to move parent to child
33
- if (parentNodePath?.startsWith(movedNodePath)) {
34
- return tree;
35
- }
36
- const changedParent = this.helper.getParentNodePath(movedNodePath) !== parentNodePath;
37
- let newNodePath = movedNodePath;
38
- //dont create new node if you only moved inside same parent
39
- if (changedParent) {
40
- newNodePath = this.calculateNewNodePath(tree, parentNodePath, movedNodePath, recalculateNodePath);
41
- }
42
- //* find target node
43
- const targetNode = this.helper.findNode(tree, targetNodePath);
44
- if (!targetNode)
45
- return tree;
46
- let movedNode;
47
- //move nodes
48
- tree = tree.map((node) => {
49
- //make sure that parent's haschild is set to true, so that children are visible
50
- if (this.path(node) == parentNodePath) {
51
- this.props.setHasChildren(node, true);
52
- this.props.setExpanded(node, true);
53
- }
54
- //move moved nodes to new location ( if location is being changed)
55
- if (changedParent && this.path(node)?.startsWith(movedNodePath)) {
56
- //replace old parent with new one
57
- const newPath = this.path(node)?.replace(movedNodePath, newNodePath) ?? null;
58
- this.props.setPath(node, newPath);
59
- }
60
- //if it is moved node
61
- if (this.path(node) === newNodePath) {
62
- movedNode = node;
63
- //? not sure if this is best
64
- this.updatePriority(tree, movedNode, parentNodePath, newNodePath, targetNode, insType);
65
- }
66
- return node;
67
- });
68
- if (!movedNode)
69
- return tree;
70
- //* insert node at right possition of array
71
- const oldIndex = tree.findIndex((x) => this.path(x) == newNodePath);
72
- tree.splice(oldIndex, 1);
73
- const index = tree.findIndex((x) => this.path(x) == this.path(targetNode));
74
- tree.splice(index + (insType == InsertionType.above ? 0 : 1), 0, movedNode);
75
- //TODO maybe add option to setting this.hasChildren to false when moved last children
76
- //hide plus icon if parent of moved node doesnt have any more children
77
- const oldParent = this.helper.findNode(tree, this.helper.getParentNodePath(movedNodePath));
78
- if (!oldParent)
79
- return tree;
80
- //moved last node
81
- const oldParentHasChildren = this.helper.allCHildren(tree, this.path(oldParent)).length;
82
- if (oldParent && !oldParentHasChildren) {
83
- this.props.setHasChildren(oldParent, false);
84
- }
85
- return tree;
86
- }
87
- calculateNewNodePath(tree, parentNodePath, movedNodePath, recalculateNodePath) {
88
- //node id is last part of nodePath
89
- let nodeId;
90
- if (recalculateNodePath) {
91
- nodeId = this.getNextNodeId(tree, parentNodePath);
92
- }
93
- else {
94
- //get last segment of path
95
- // nodeId = this.helper.getNodeIdFromPath(movedNodePath);
96
- }
97
- if (parentNodePath === null)
98
- return nodeId;
99
- return `${parentNodePath}${this.separator}${nodeId}`;
100
- }
101
- updatePriority(tree, node, parentNodePath, newNodePath, targetNode, insType) {
102
- const isNesting = insType == InsertionType.nest;
103
- if (isNesting || this.props.priority(targetNode) != null) {
104
- let newpriority = 0;
105
- if (!isNesting) {
106
- //calculate next
107
- newpriority = this.props.priority(targetNode) ?? 0;
108
- if (insType == InsertionType.below) {
109
- newpriority += 1;
110
- }
111
- else {
112
- //targetNode[this.props.priority] -= 1;
113
- }
114
- }
115
- this.recalculatesPriorities(tree, parentNodePath, newNodePath, newpriority);
116
- this.props.setPriority(targetNode, newpriority);
117
- }
118
- else {
119
- //so old priority doesnt mess up orderring
120
- this.props.setPriority(targetNode, undefined);
121
- }
122
- }
123
- /** recomputes all priorities after inserted priority.F
124
- * Also changes all priorities to be one apart (1,5,6 => 1,2,3)
125
- */
126
- //? maybe it will recalculate properly if dont set insertedPriority
127
- recalculatesPriorities(tree, parentNode, movedNodePath, insertedPriority = -1) {
128
- let nextPriority = insertedPriority + 1;
129
- this.helper.orderByPriority(this.helper.allCHildren(tree, parentNode)).forEach((node) => {
130
- if (this.props.priority(node) >= insertedPriority && this.path(node) != movedNodePath) {
131
- this.props.setPriority(node, nextPriority++);
132
- }
133
- });
134
- }
135
- /** return biggest value of nodepath number that children are using +1 */
136
- getNextNodeId(tree, parentPath) {
137
- let max = 0;
138
- //findes biggest nodeNumber for
139
- this.helper.allCHildren(tree, parentPath).forEach((node) => {
140
- const parent = this.helper.getParentNodePath(this.path(node));
141
- if (parent === parentPath) {
142
- const num = parseInt(this.path(node)?.substring(parent ? parent.length + 1 : 0) ?? '0');
143
- max = Math.max(max, num);
144
- }
145
- });
146
- return (max + 1).toString();
147
- }
148
- getInsertionPosition(e, element) {
149
- const targetCords = element.getBoundingClientRect();
150
- const half = targetCords.bottom - targetCords.height / 2;
151
- if (e.y < half) {
152
- return InsertionType.below;
153
- }
154
- return InsertionType.above;
155
- }
156
- getNodeIdFromPath(nodePath) {
157
- if (nodePath == null) {
158
- console.warn('getting node id of null node path');
159
- return null;
160
- }
161
- return nodePath?.split(this.helper.config.separator).slice(-1)[0];
162
- }
163
- }
1
+ "use strict";
2
+ // import type { PropertyHelper } from '../helpers/property-helper.js';
3
+ // import type { TreeHelper } from '../helpers/tree-helper.js';
4
+ // import { InsertionType, type Node, type NodePath, type Tree } from '../types.js';
5
+ // export class DragDropProvider {
6
+ // helper: TreeHelper;
7
+ // props: PropertyHelper;
8
+ // separator: string;
9
+ // constructor(treeHelper: TreeHelper) {
10
+ // this.helper = treeHelper;
11
+ // this.props = treeHelper.props;
12
+ // this.separator = this.helper.config.separator ?? '.';
13
+ // }
14
+ // path(node: Node) {
15
+ // return this.helper.path(node);
16
+ // }
17
+ // /**
18
+ // * moves node from one parent to another
19
+ // * @param {Object[]} tree - tree
20
+ // * @param {nodePath} movedNodePath - nodepath of moved(dragged) node
21
+ // * @param {nodePath} targetNodePath - nodepath of node where it should be moved ( either bellow it in priority or as child)
22
+ // * @param {int} insType - if true, it will insert moved node as child of target node, if false, it will insert it bellow it in priority
23
+ // * @param {boolean} recalculateNodePath - wont recalculare id of moved node, used when last part of nodePath is always unique
24
+ // */
25
+ // moveNode(
26
+ // tree: Node[],
27
+ // movedNodePath: NodePath,
28
+ // targetNodePath: NodePath,
29
+ // insType: InsertionType,
30
+ // recalculateNodePath: boolean
31
+ // ): Node[] {
32
+ // // cannot move root node
33
+ // if (!movedNodePath) return tree;
34
+ // const isNesting = insType === InsertionType.nest;
35
+ // // if you are not isNestinging, you want to be on same level
36
+ // //so you will have same parent as target node
37
+ // const parentNodePath = isNesting
38
+ // ? targetNodePath
39
+ // : this.helper.getParentNodePath(targetNodePath);
40
+ // //trying to move parent to child
41
+ // if (parentNodePath?.startsWith(movedNodePath)) {
42
+ // return tree;
43
+ // }
44
+ // const changedParent = this.helper.getParentNodePath(movedNodePath) !== parentNodePath;
45
+ // let newNodePath = movedNodePath;
46
+ // //dont create new node if you only moved inside same parent
47
+ // if (changedParent) {
48
+ // newNodePath = this.calculateNewNodePath(
49
+ // tree,
50
+ // parentNodePath,
51
+ // movedNodePath,
52
+ // recalculateNodePath
53
+ // );
54
+ // }
55
+ // //* find target node
56
+ // const targetNode = this.helper.findNode(tree, targetNodePath);
57
+ // if (!targetNode) return tree;
58
+ // let movedNode;
59
+ // //move nodes
60
+ // tree = tree.map((node) => {
61
+ // //make sure that parent's haschild is set to true, so that children are visible
62
+ // if (this.path(node) == parentNodePath) {
63
+ // this.props.setHasChildren(node, true);
64
+ // this.props.setExpanded(node, true);
65
+ // }
66
+ // //move moved nodes to new location ( if location is being changed)
67
+ // if (changedParent && this.path(node)?.startsWith(movedNodePath)) {
68
+ // //replace old parent with new one
69
+ // const newPath = this.path(node)?.replace(movedNodePath, newNodePath) ?? null;
70
+ // this.props.setPath(node, newPath);
71
+ // }
72
+ // //if it is moved node
73
+ // if (this.path(node) === newNodePath) {
74
+ // movedNode = node;
75
+ // //? not sure if this is best
76
+ // this.updatePriority(tree, movedNode, parentNodePath, newNodePath, targetNode, insType);
77
+ // }
78
+ // return node;
79
+ // });
80
+ // if (!movedNode) return tree;
81
+ // //* insert node at right possition of array
82
+ // const oldIndex = tree.findIndex((x) => this.path(x) == newNodePath);
83
+ // tree.splice(oldIndex, 1);
84
+ // const index = tree.findIndex((x) => this.path(x) == this.path(targetNode));
85
+ // tree.splice(index + (insType == InsertionType.above ? 0 : 1), 0, movedNode);
86
+ // //TODO maybe add option to setting this.hasChildren to false when moved last children
87
+ // //hide plus icon if parent of moved node doesnt have any more children
88
+ // const oldParent = this.helper.findNode(tree, this.helper.getParentNodePath(movedNodePath));
89
+ // if (!oldParent) return tree;
90
+ // //moved last node
91
+ // const oldParentHasChildren = this.helper.allCHildren(tree, this.path(oldParent)).length;
92
+ // if (oldParent && !oldParentHasChildren) {
93
+ // this.props.setHasChildren(oldParent, false);
94
+ // }
95
+ // return tree;
96
+ // }
97
+ // calculateNewNodePath(
98
+ // tree: Tree,
99
+ // parentNodePath: NodePath,
100
+ // movedNodePath: NodePath,
101
+ // recalculateNodePath: boolean
102
+ // ) {
103
+ // //node id is last part of nodePath
104
+ // let nodeId;
105
+ // if (recalculateNodePath) {
106
+ // nodeId = this.getNextNodeId(tree, parentNodePath);
107
+ // } else {
108
+ // //get last segment of path
109
+ // // nodeId = this.helper.getNodeIdFromPath(movedNodePath);
110
+ // }
111
+ // if (parentNodePath === null) return nodeId as string;
112
+ // return `${parentNodePath}${this.separator}${nodeId}`;
113
+ // }
114
+ // updatePriority(
115
+ // tree: Tree,
116
+ // node: Node,
117
+ // parentNodePath: NodePath,
118
+ // newNodePath: NodePath,
119
+ // targetNode: Node,
120
+ // insType: InsertionType
121
+ // ) {
122
+ // const isNesting = insType == InsertionType.nest;
123
+ // if (isNesting || this.props.priority(targetNode) != null) {
124
+ // let newpriority = 0;
125
+ // if (!isNesting) {
126
+ // //calculate next
127
+ // newpriority = this.props.priority(targetNode) ?? 0;
128
+ // if (insType == InsertionType.below) {
129
+ // newpriority += 1;
130
+ // } else {
131
+ // //targetNode[this.props.priority] -= 1;
132
+ // }
133
+ // }
134
+ // this.recalculatesPriorities(tree, parentNodePath, newNodePath, newpriority);
135
+ // this.props.setPriority(targetNode, newpriority);
136
+ // } else {
137
+ // //so old priority doesnt mess up orderring
138
+ // this.props.setPriority(targetNode, undefined);
139
+ // }
140
+ // }
141
+ // /** recomputes all priorities after inserted priority.F
142
+ // * Also changes all priorities to be one apart (1,5,6 => 1,2,3)
143
+ // */
144
+ // //? maybe it will recalculate properly if dont set insertedPriority
145
+ // recalculatesPriorities(
146
+ // tree: Tree,
147
+ // parentNode: NodePath,
148
+ // movedNodePath: NodePath,
149
+ // insertedPriority = -1
150
+ // ) {
151
+ // let nextPriority = insertedPriority + 1;
152
+ // this.helper.orderByPriority(this.helper.allCHildren(tree, parentNode)).forEach((node) => {
153
+ // if (this.props.priority(node) >= insertedPriority && this.path(node) != movedNodePath) {
154
+ // this.props.setPriority(node, nextPriority++);
155
+ // }
156
+ // });
157
+ // }
158
+ // /** return biggest value of nodepath number that children are using +1 */
159
+ // getNextNodeId(tree: Tree, parentPath: NodePath) {
160
+ // let max = 0;
161
+ // //findes biggest nodeNumber for
162
+ // this.helper.allCHildren(tree, parentPath).forEach((node) => {
163
+ // const parent = this.helper.getParentNodePath(this.path(node));
164
+ // if (parent === parentPath) {
165
+ // const num = parseInt(this.path(node)?.substring(parent ? parent.length + 1 : 0) ?? '0');
166
+ // max = Math.max(max, num);
167
+ // }
168
+ // });
169
+ // return (max + 1).toString();
170
+ // }
171
+ // getInsertionPosition(e: DragEvent, element: HTMLElement): InsertionType {
172
+ // const targetCords = element.getBoundingClientRect();
173
+ // const half = targetCords.bottom - targetCords.height / 2;
174
+ // if (e.y < half) {
175
+ // return InsertionType.below;
176
+ // }
177
+ // return InsertionType.above;
178
+ // }
179
+ // getNodeIdFromPath(nodePath: NodePath) {
180
+ // if (nodePath == null) {
181
+ // console.warn('getting node id of null node path');
182
+ // return null;
183
+ // }
184
+ // return nodePath?.split(this.helper.config.separator).slice(-1)[0];
185
+ // }
186
+ // }
@@ -1,19 +1,16 @@
1
- import type { PropertyHelper } from '../helpers/property-helper.js';
2
1
  import type { TreeHelper } from '../helpers/tree-helper.js';
3
- import { SelectionModes, type Node, type NodePath, type Tree, type TreeVisualStates, type NodeId } from '../types.js';
2
+ import { SelectionModes, type NodePath, type Tree, type TreeVisualStates, type Node, type NodeId } from '../types.js';
4
3
  export declare class SelectionProvider {
5
4
  helper: TreeHelper;
6
- props: PropertyHelper;
7
5
  recursiveMode: boolean;
8
6
  constructor(treeHelper: TreeHelper, recursive: boolean);
9
- private path;
7
+ markSelected(tree: Tree, selectedNodeIds: NodeId[]): void;
10
8
  isNodeSelected(node: Node): boolean;
11
9
  isSelected(nodeId: string, visualStates: TreeVisualStates, selectedNodeIds: NodeId[]): boolean;
12
- getSelectableDirectChildren(tree: Tree, parentNodePath: string | null): object[];
10
+ getSelectableDirectChildren(tree: Tree, parentNodePath: string | null): Node[];
13
11
  setSelection(tree: Tree, nodePath: NodePath, changeTo: boolean, oldSelection: NodeId[]): NodeId[];
14
12
  /** Computes visual states for all nodes. Used for computing initial visual states when tree changes */
15
13
  computeVisualStates(tree: Tree, selectedNodeIds: (string | number)[]): TreeVisualStates;
16
- isSelectable(node: Node, showCheckboxes: SelectionModes): boolean;
17
14
  private computeVisualState;
18
15
  /**
19
16
  * Computes visual state from leaf to node
@@ -25,3 +22,4 @@ export declare class SelectionProvider {
25
22
  private computeVisualStateRecursively;
26
23
  private changeSelectedRecursively;
27
24
  }
25
+ export declare function isSelectable(node: Node, showCheckboxes: SelectionModes): boolean;