From 06e14f505440e80865fd7a151fc60fddbc326368 Mon Sep 17 00:00:00 2001 From: Ramesh Mane <101566080+rameshmane7218@users.noreply.github.com> Date: Thu, 22 Feb 2024 16:17:02 +0000 Subject: [PATCH] fix(nc-gui): form view onclick focus issue --- .../nc-gui/components/smartsheet/Form.vue | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) 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) => {
+
@@ -598,7 +600,7 @@ useEventListener(document, 'focusout', (e: FocusEvent) => { @start="drag = true" @end="drag = false" > -