diff --git a/packages/nc-gui/components/smartsheet/Form.vue b/packages/nc-gui/components/smartsheet/Form.vue index ef07c90f1f..1f3a336e70 100644 --- a/packages/nc-gui/components/smartsheet/Form.vue +++ b/packages/nc-gui/components/smartsheet/Form.vue @@ -24,6 +24,7 @@ import { reactive, ref, useDebounceFn, + useEventListener, useGlobal, useI18n, useNuxtApp, @@ -31,7 +32,6 @@ import { useViewColumnsOrThrow, useViewData, watch, - useEventListener, } from '#imports' provide(IsFormInj, ref(true)) @@ -115,6 +115,8 @@ const submitted = ref(false) const activeRow = ref('') +const isLoadingFormView = ref(false) + const focusLabel: VNodeRef = (el) => { return (el as HTMLInputElement)?.focus() } @@ -396,8 +398,10 @@ onClickOutside(draggableRef, () => { }) onMounted(async () => { + isLoadingFormView.value = true await loadFormView() setFormData() + isLoadingFormView.value = false }) watch(view, (nextView) => { @@ -416,11 +420,8 @@ useEventListener(document, 'focusout', (e: FocusEvent) => { const nextActiveFieldTitle = e?.relatedTarget?.getAttribute('data-title') || e?.relatedTarget?.offsetParent?.closest('.nc-form-focus-element')?.getAttribute('data-title') - - if (activeRow.value && nextActiveFieldTitle && activeRow.value !== nextActiveFieldTitle) { + if (nextActiveFieldTitle && activeRow.value !== nextActiveFieldTitle) { activeRow.value = nextActiveFieldTitle - } else { - console.log(document.activeElement) } }) @@ -494,8 +495,9 @@ useEventListener(document, 'focusout', (e: FocusEvent) => {