Browse Source

fix(gui-v2): formula AC tree

pull/3198/head
Wing-Kam Wong 2 years ago
parent
commit
9ff49523ed
  1. 6
      packages/nc-gui-v2/utils/NcAutocompleteTree.ts

6
packages/nc-gui-v2/utils/NcAutocompleteTree.ts

@ -37,6 +37,7 @@ export class NcAutocompleteTree {
} }
root.value = root.value || [] root.value = root.value || []
root.value.push(word) root.value.push(word)
root.isLeaf = true
} }
find(word: string) { find(word: string) {
@ -48,12 +49,11 @@ export class NcAutocompleteTree {
return null // if not found return null return null // if not found return null
} }
} }
return root // return the root where it ends search return root // return the root where it ends search
} }
traverse(root: Node) { traverse(root: Node) {
if (root.value && root.value.length) { if (root.isLeaf) {
this.suggestions.push(...root.value) this.suggestions.push(...root.value)
} }
@ -70,6 +70,8 @@ export class NcAutocompleteTree {
return this.suggestions return this.suggestions
} // cannot suggest anything } // cannot suggest anything
this.suggestions.push(...root.value)
const children = root.children const children = root.children
let spread = 0 let spread = 0

Loading…
Cancel
Save