Browse Source

Merge pull request #3198 from nocodb/fix/gui-v2-formula-search

fix(gui-v2): formula AC tree
pull/3203/head
Raju Udava 2 years ago committed by GitHub
parent
commit
7db7151e76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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