@keenmate/svelte-treeview 1.1.4 → 1.1.6

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.
@@ -159,7 +159,6 @@ export function setNodeExpansion(nodePath, changeTo) {
159
159
  }
160
160
  if (changeTo === null) {
161
161
  changeTo = !expandedPaths.includes(nodePath);
162
- return;
163
162
  }
164
163
  expandedPaths = helper.changeExpansion(nodePath, changeTo, expandedPaths);
165
164
  }
@@ -226,6 +225,9 @@ function onExpand(detail) {
226
225
  }
227
226
  }
228
227
  function handleCallback(node) {
228
+ if (node.useCallback !== true) {
229
+ return;
230
+ }
229
231
  // only call on nodes with children
230
232
  if (node.hasChildren !== true) {
231
233
  return;
@@ -1,9 +1,9 @@
1
- import { type Node, type HelperConfig, type Tree, type NodeId, type Props, type FilterFunction } from '../types.js';
1
+ import { type Node, type HelperConfig, type Tree, type Props, type FilterFunction } from '../types.js';
2
2
  export declare class TreeHelper {
3
3
  config: HelperConfig;
4
4
  constructor(config?: HelperConfig);
5
5
  mapTree(tree: Tree, properties: Props): Node[];
6
- markExpanded(tree: Tree, expandedNodeIds: NodeId[]): void;
6
+ markExpanded(tree: Tree, expandedPaths: string[]): void;
7
7
  getParentNodePath(nodePath: string): string | null;
8
8
  isChildrenOf(parentNodePath: string | null, childrenNodePath: string): boolean;
9
9
  hasChildren(tree: Tree, nodePath: string): Node | undefined;
@@ -32,10 +32,10 @@ export class TreeHelper {
32
32
  });
33
33
  }
34
34
  }
35
- markExpanded(tree, expandedNodeIds) {
35
+ markExpanded(tree, expandedPaths) {
36
36
  {
37
37
  tree.forEach((node) => {
38
- node.expanded = expandedNodeIds.includes(node.id ?? '');
38
+ node.expanded = expandedPaths.includes(node.path ?? '');
39
39
  });
40
40
  }
41
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keenmate/svelte-treeview",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",