File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -99,9 +99,8 @@ const renderedRoot = computed(() => {
9999 return fillNodeInfo (root .value )
100100})
101101const fillNodeInfo = (node : TreeNode ): TreeNode => {
102- const isLeaf = node .children === undefined || node .children .length === 0
103102 const isExpanded = expandedKeys .value [node .key ]
104- const icon = isLeaf
103+ const icon = node . leaf
105104 ? ' pi pi-circle-fill'
106105 : isExpanded
107106 ? ' pi pi-folder-open'
@@ -112,8 +111,8 @@ const fillNodeInfo = (node: TreeNode): TreeNode => {
112111 ... node ,
113112 icon ,
114113 children ,
115- type: isLeaf ? ' node' : ' folder' ,
116- totalNodes: isLeaf
114+ type: node . leaf ? ' node' : ' folder' ,
115+ totalNodes: node . leaf
117116 ? 1
118117 : children .reduce ((acc , child ) => acc + child .totalNodes , 0 )
119118 }
Original file line number Diff line number Diff line change @@ -260,6 +260,7 @@ export const useNodeDefStore = defineStore('nodeDef', {
260260 const root : TreeNode = {
261261 key : 'root' ,
262262 label : 'Nodes' ,
263+ leaf : false ,
263264 children : [ ]
264265 }
265266 for ( const nodeDef of Object . values ( state . nodeDefsByName ) ) {
@@ -270,15 +271,16 @@ export const useNodeDefStore = defineStore('nodeDef', {
270271 key += `/${ part } `
271272 let next = current . children . find ( ( child ) => child . label === part )
272273 if ( ! next ) {
273- next = { key, label : part , children : [ ] }
274+ next = { key, label : part , children : [ ] , leaf : false }
274275 current . children . push ( next )
275276 }
276277 current = next
277278 }
278279 current . children . push ( {
279280 label : nodeDef . display_name ,
280281 data : nodeDef ,
281- key : `${ key } /${ nodeDef . name } `
282+ key : `${ key } /${ nodeDef . name } ` ,
283+ leaf : true
282284 } )
283285 }
284286 return root
You can’t perform that action at this time.
0 commit comments