diff --git a/packages/nc-gui/components/smartsheet/Form.vue b/packages/nc-gui/components/smartsheet/Form.vue index 36ab5528f9..f667e52911 100644 --- a/packages/nc-gui/components/smartsheet/Form.vue +++ b/packages/nc-gui/components/smartsheet/Form.vue @@ -655,10 +655,30 @@ const handleOnUploadImage = (data: AttachmentResType = null) => { updateView() } +const isFocusedFieldLabel = ref(false) + const onFocusActiveFieldLabel = (e: FocusEvent) => { + isFocusedFieldLabel.value = true + + if (activeField.value && !activeField.value.label) { + activeField.value.label = activeField.value?.title ?? '' + } + ;(e.target as HTMLTextAreaElement).select() } +const activeFieldLabel = computed(() => { + if (!isFocusedFieldLabel.value && !activeField.value?.label) { + return activeField.value?.title + } + + return activeField.value?.label ?? '' +}) + +onClickOutside(focusLabel, () => { + isFocusedFieldLabel.value = false +}) + const updateFieldTitle = (value: string) => { if (!activeField.value) return @@ -1459,7 +1479,7 @@ useEventListener(