@keenmate/svelte-treeview 4.0.0-rc09 → 4.0.0
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.
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
// Destructure props using Svelte 5 syntax
|
|
30
30
|
let {
|
|
31
31
|
node,
|
|
32
|
-
children,
|
|
32
|
+
children = undefined,
|
|
33
33
|
onNodeClicked,
|
|
34
34
|
onNodeRightClicked,
|
|
35
35
|
onNodeDragStart,
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
142
142
|
const x = e.clientX;
|
|
143
143
|
const y = e.clientY;
|
|
144
|
-
|
|
144
|
+
|
|
145
145
|
if (x < rect.left || x >= rect.right || y < rect.top || y >= rect.bottom) {
|
|
146
146
|
isDraggedOver = false;
|
|
147
147
|
}
|
|
@@ -109,11 +109,11 @@
|
|
|
109
109
|
insertResult = $bindable(),
|
|
110
110
|
|
|
111
111
|
// SLOTS
|
|
112
|
-
nodeTemplate,
|
|
113
|
-
treeHeader,
|
|
114
|
-
treeFooter,
|
|
115
|
-
noDataFound,
|
|
116
|
-
contextMenu,
|
|
112
|
+
nodeTemplate = undefined,
|
|
113
|
+
treeHeader = undefined,
|
|
114
|
+
treeFooter = undefined,
|
|
115
|
+
noDataFound = undefined,
|
|
116
|
+
contextMenu = undefined,
|
|
117
117
|
|
|
118
118
|
// BEHAVIOUR
|
|
119
119
|
expandLevel = 2,
|
|
@@ -145,15 +145,6 @@
|
|
|
145
145
|
|
|
146
146
|
export async function expandNodes(nodePath: string) {
|
|
147
147
|
tree.expandNodes(nodePath);
|
|
148
|
-
|
|
149
|
-
// trie.dummyText = Date.now().toLocaleString();
|
|
150
|
-
// console.log(trie.dummyText);
|
|
151
|
-
// rootNodes.forEach((element) => {
|
|
152
|
-
// if (element.path === nodePath) {
|
|
153
|
-
// element.isExpanded = !element.isExpanded;
|
|
154
|
-
// console.log(element)
|
|
155
|
-
// }
|
|
156
|
-
// });
|
|
157
148
|
}
|
|
158
149
|
|
|
159
150
|
export async function collapseNodes(nodePath: string) {
|
|
@@ -172,7 +163,10 @@
|
|
|
172
163
|
tree?.filterNodes(searchText, searchOptions);
|
|
173
164
|
}
|
|
174
165
|
|
|
175
|
-
export function searchNodes(
|
|
166
|
+
export function searchNodes(
|
|
167
|
+
searchText: string | null | undefined,
|
|
168
|
+
searchOptions?: SearchOptions
|
|
169
|
+
): LTreeNode<T>[] {
|
|
176
170
|
return tree?.searchNodes(searchText, searchOptions) || [];
|
|
177
171
|
}
|
|
178
172
|
|
|
@@ -218,17 +212,7 @@
|
|
|
218
212
|
// Highlight the node temporarily if requested
|
|
219
213
|
if (highlight && scrollHighlightClass) {
|
|
220
214
|
contentDiv.classList.add(scrollHighlightClass);
|
|
221
|
-
console.log(
|
|
222
|
-
'🚀 elementId ~ scrollToPath ~ adding scrollHighlightClass:',
|
|
223
|
-
elementId,
|
|
224
|
-
scrollHighlightClass
|
|
225
|
-
);
|
|
226
215
|
setTimeout(() => {
|
|
227
|
-
console.log(
|
|
228
|
-
'🚀 elementId ~ scrollToPath ~ removing scrollHighlightClass:',
|
|
229
|
-
elementId,
|
|
230
|
-
scrollHighlightClass
|
|
231
|
-
);
|
|
232
216
|
contentDiv.classList.remove(scrollHighlightClass);
|
|
233
217
|
}, scrollHighlightTimeout);
|
|
234
218
|
}
|
|
@@ -445,9 +429,7 @@
|
|
|
445
429
|
</div>
|
|
446
430
|
{/if}
|
|
447
431
|
|
|
448
|
-
{
|
|
449
|
-
{@render treeHeader?.()}
|
|
450
|
-
{/if}
|
|
432
|
+
{@render treeHeader?.()}
|
|
451
433
|
<div class:bodyClass>
|
|
452
434
|
{#if tree?.root}
|
|
453
435
|
{#key tree.changeTracker}
|
|
@@ -482,9 +464,8 @@
|
|
|
482
464
|
</div>
|
|
483
465
|
{/if}
|
|
484
466
|
</div>
|
|
485
|
-
|
|
467
|
+
|
|
486
468
|
{@render treeFooter?.()}
|
|
487
|
-
{/if}
|
|
488
469
|
|
|
489
470
|
<!-- Context Menu -->
|
|
490
471
|
{#if contextMenuVisible && contextMenu && contextMenuNode}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keenmate/svelte-treeview",
|
|
3
|
-
"version": "4.0.0
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite dev --port 17777",
|
|
6
|
-
"build": "vite build",
|
|
6
|
+
"build": "vite build && npm run prepack",
|
|
7
7
|
"build:showcase": "vite build",
|
|
8
8
|
"preview": "vite preview",
|
|
9
9
|
"prepare": "svelte-kit sync || echo ''",
|