From bb9ae844a16e3165249dfe01f31dded2d12d5c07 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Thu, 4 Aug 2022 18:50:54 +0800 Subject: [PATCH] fix(gui-v2): undefined is not iterable --- .../components/smartsheet-column/FormulaOptions.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/nc-gui-v2/components/smartsheet-column/FormulaOptions.vue b/packages/nc-gui-v2/components/smartsheet-column/FormulaOptions.vue index 40022e7f36..b2c3c4f8f5 100644 --- a/packages/nc-gui-v2/components/smartsheet-column/FormulaOptions.vue +++ b/packages/nc-gui-v2/components/smartsheet-column/FormulaOptions.vue @@ -91,7 +91,7 @@ const suggestionsList = computed(() => { }) // set default suggestion list -const suggestion: Ref[] | null> = ref(suggestionsList.value) +const suggestion: Ref[]> = ref(suggestionsList.value) const acTree = computed(() => { const ref = new NcAutocompleteTree() @@ -328,6 +328,7 @@ function isCurlyBracketBalanced() { function appendText(it: Record) { const text = it.text const len = wordToComplete.value?.length || 0 + if (it.type === 'function') { formState.value.colOptions.formula_raw = insertAtCursor(formulaRef.value.$el, text, len, 1) } else if (it.type === 'column') { @@ -336,7 +337,7 @@ function appendText(it: Record) { formState.value.colOptions.formula_raw = insertAtCursor(formulaRef.value.$el, text, len) } autocomplete.value = false - suggestion.value = null + suggestion.value = suggestionsList.value } const handleInputDeb = useDebounceFn(function () { @@ -345,7 +346,7 @@ const handleInputDeb = useDebounceFn(function () { function handleInput() { selected.value = 0 - suggestion.value = null + suggestion.value = [] const query = getWordUntilCaret(formulaRef.value.$el) const parts = query.split(/\W+/) wordToComplete.value = parts.pop() || '' @@ -445,7 +446,7 @@ formState.value.colOptions = { } " class="cursor-pointer" - @mousedown.stop="appendText(item)" + @click.prevent.stop="appendText(item)" >