|
|
@ -145,13 +145,6 @@ const suggestionsList = computed(() => { |
|
|
|
// set default suggestion list |
|
|
|
// set default suggestion list |
|
|
|
const suggestion: Ref<Record<string, any>[]> = ref(suggestionsList.value) |
|
|
|
const suggestion: Ref<Record<string, any>[]> = ref(suggestionsList.value) |
|
|
|
|
|
|
|
|
|
|
|
const suggestedFormulas = computed(() => { |
|
|
|
|
|
|
|
return suggestion.value.filter((s) => s && s.type !== 'column') |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
const variableList = computed(() => { |
|
|
|
|
|
|
|
return suggestion.value.filter((s) => s && s.type === 'column') |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const acTree = computed(() => { |
|
|
|
const acTree = computed(() => { |
|
|
|
const ref = new NcAutocompleteTree() |
|
|
|
const ref = new NcAutocompleteTree() |
|
|
|
for (const sug of suggestionsList.value) { |
|
|
|
for (const sug of suggestionsList.value) { |
|
|
@ -160,6 +153,14 @@ const acTree = computed(() => { |
|
|
|
return ref |
|
|
|
return ref |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const suggestedFormulas = computed(() => { |
|
|
|
|
|
|
|
return suggestion.value.filter((s) => s && s.type !== 'column') |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const variableList = computed(() => { |
|
|
|
|
|
|
|
return suggestion.value.filter((s) => s && s.type === 'column') |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
function isCurlyBracketBalanced() { |
|
|
|
function isCurlyBracketBalanced() { |
|
|
|
// count number of opening curly brackets and closing curly brackets |
|
|
|
// count number of opening curly brackets and closing curly brackets |
|
|
|
const cntCurlyBrackets = (formulaRef.value.$el.value.match(/\{|}/g) || []).reduce( |
|
|
|
const cntCurlyBrackets = (formulaRef.value.$el.value.match(/\{|}/g) || []).reduce( |
|
|
@ -252,7 +253,6 @@ function suggestionListDown() { |
|
|
|
function scrollToSelectedOption() { |
|
|
|
function scrollToSelectedOption() { |
|
|
|
nextTick(() => { |
|
|
|
nextTick(() => { |
|
|
|
if (sugOptionsRef.value[selected.value]) { |
|
|
|
if (sugOptionsRef.value[selected.value]) { |
|
|
|
console.log('scrollToSelectedOption', selected.value, sugOptionsRef.value[selected.value].$el, sugListRef.value) |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
sugOptionsRef.value[selected.value].$el.scrollIntoView({ |
|
|
|
sugOptionsRef.value[selected.value].$el.scrollIntoView({ |
|
|
|
block: 'nearest', |
|
|
|
block: 'nearest', |
|
|
|