Browse Source

fix(gui-v2): remove formulaSuggestionDrawer

pull/3149/head
Wing-Kam Wong 2 years ago
parent
commit
ae48ae2c9c
  1. 19
      packages/nc-gui-v2/components/smartsheet-column/EditOrAdd.vue
  2. 6
      packages/nc-gui-v2/components/smartsheet-column/FormulaOptions.vue

19
packages/nc-gui-v2/components/smartsheet-column/EditOrAdd.vue

@ -17,9 +17,11 @@ const { formState, generateNewColumnMeta, addOrUpdate, onAlter, onUidtOrIdTypeCh
const reloadDataTrigger = inject(ReloadViewDataHookInj) const reloadDataTrigger = inject(ReloadViewDataHookInj)
const advancedOptions = ref(false) const advancedOptions = ref(false)
const { getMeta } = useMetas() const { getMeta } = useMetas()
const formulaOptionsRef = ref() const formulaOptionsRef = ref()
const editOrAddRef = ref<HTMLElement>() const editOrAddRef = ref<HTMLElement>()
const columnToValidate = [UITypes.Email, UITypes.URL, UITypes.PhoneNumber] const columnToValidate = [UITypes.Email, UITypes.URL, UITypes.PhoneNumber]
@ -74,23 +76,12 @@ onMounted(() => {
generateNewColumnMeta() generateNewColumnMeta()
} }
if (formState.value.uidt === UITypes.Formula) {
formulaOptionsRef.value.formulaSuggestionDrawer = true
}
// for cases like formula // for cases like formula
if (formState.value && !formState.value.column_name) { if (formState.value && !formState.value.column_name) {
formState.value.column_name = formState.value?.title formState.value.column_name = formState.value?.title
} }
}) })
onUnmounted(() => {
if (formState.value.uidt === UITypes.Formula) {
// close formula drawer
formulaOptionsRef.value.formulaSuggestionDrawer = false
}
})
const handleClose = (e: MouseEvent) => { const handleClose = (e: MouseEvent) => {
if ( if (
e.target && e.target &&
@ -127,11 +118,7 @@ useEventListener(document, 'click', handleClose)
</a-select-option> </a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
<SmartsheetColumnFormulaOptions <SmartsheetColumnFormulaOptions v-if="formState.uidt === UITypes.Formula" v-model:value="formState" />
v-if="formState.uidt === UITypes.Formula"
ref="formulaOptionsRef"
v-model:value="formState"
/>
<SmartsheetColumnCurrencyOptions v-if="formState.uidt === UITypes.Currency" v-model:value="formState" /> <SmartsheetColumnCurrencyOptions v-if="formState.uidt === UITypes.Currency" v-model:value="formState" />
<SmartsheetColumnDurationOptions v-if="formState.uidt === UITypes.Duration" v-model:value="formState" /> <SmartsheetColumnDurationOptions v-if="formState.uidt === UITypes.Duration" v-model:value="formState" />
<SmartsheetColumnRatingOptions v-if="formState.uidt === UITypes.Rating" v-model:value="formState" /> <SmartsheetColumnRatingOptions v-if="formState.uidt === UITypes.Rating" v-model:value="formState" />

6
packages/nc-gui-v2/components/smartsheet-column/FormulaOptions.vue

@ -59,8 +59,6 @@ const validators = {
], ],
} }
const formulaSuggestionDrawer = ref(true)
const availableFunctions = formulaList const availableFunctions = formulaList
const availableBinOps = ['+', '-', '*', '/', '>', '<', '==', '<=', '>=', '!='] const availableBinOps = ['+', '-', '*', '/', '>', '<', '==', '<=', '>=', '!=']
@ -597,10 +595,6 @@ setAdditionalValidations({
...validators, ...validators,
}) })
defineExpose({
formulaSuggestionDrawer,
})
onMounted(() => { onMounted(() => {
jsep.plugins.register(jsepCurlyHook) jsep.plugins.register(jsepCurlyHook)
}) })

Loading…
Cancel
Save