expanded tree by default
mellbacon committed
Dec 29, 2022 at 12:17 UTC
f793c1907da35de3bced1ba69192c7ac5b35c097
2 files changed
+9
-1
src/components/FileTree/TreeView.svelte
+8
@@ -1,4 +1,7 @@
1
<script lang="ts">
2
+ // Code originally from Carbon Components Svelte
3
+ // Modified because its trash lol
4
+
5
/**
6
* @typedef {string | number} TreeNodeId
7
* @typedef {{ id: TreeNodeId; name: string; icon?: typeof import("svelte").SvelteComponent; disabled?: boolean; expanded?: boolean; path?: string; }} TreeNode
@@ -48,6 +51,8 @@
51
52
export let isFileTree = false;
53
54
+ export let expanded = false;
55
+
56
/**
57
* Programmatically expand all nodes
58
* @type {() => void}
@@ -112,6 +117,9 @@
117
if (firstFocusableNode != null) {
118
firstFocusableNode.tabIndex = "0";
119
}
120
+ if (expanded) {
121
+ expandAll();
122
+ }
123
});
124
125
/**
src/components/Settings/SettingsTree.svelte
+1
-1
@@ -17,4 +17,4 @@
17
}
18
</script>
19
20
-<TreeView children={tree} size="compact" on:select={openSetting}></TreeView>
\ No newline at end of file
20
+<TreeView children={tree} size="compact" expanded on:select={openSetting}></TreeView>
\ No newline at end of file