Browse Source

fix(nc-gui): focus form title on mount component

pull/7741/head
Ramesh Mane 9 months ago
parent
commit
fa3bc17587
  1. 6
      packages/nc-gui/components/general/FormBanner.vue
  2. 6
      packages/nc-gui/components/smartsheet/Form.vue

6
packages/nc-gui/components/general/FormBanner.vue

@ -8,7 +8,11 @@ const { getPossibleAttachmentSrc } = useAttachment()
</script> </script>
<template> <template>
<div class="nc-form-banner-wrapper w-full mx-auto rounded-2xl overflow-hidden" :style="{ aspectRatio: 4 / 1 }"> <div
class="nc-form-banner-wrapper w-full mx-auto rounded-2xl overflow-hidden"
:class="!bannerImageUrl ? 'shadow-sm' : ''"
:style="{ aspectRatio: 4 / 1 }"
>
<LazyCellAttachmentImage <LazyCellAttachmentImage
v-if="bannerImageUrl" v-if="bannerImageUrl"
:srcs="getPossibleAttachmentSrc(parseProp(bannerImageUrl))" :srcs="getPossibleAttachmentSrc(parseProp(bannerImageUrl))"

6
packages/nc-gui/components/smartsheet/Form.vue

@ -43,6 +43,7 @@ import {
useViewData, useViewData,
watch, watch,
} from '#imports' } from '#imports'
import type { VNodeRef } from '@vue/runtime-core'
provide(IsFormInj, ref(true)) provide(IsFormInj, ref(true))
provide(IsGalleryInj, ref(false)) provide(IsGalleryInj, ref(false))
@ -174,6 +175,8 @@ const imageCropperData = ref<{
const focusLabel = ref<HTMLTextAreaElement>() const focusLabel = ref<HTMLTextAreaElement>()
const focusFormTitle: VNodeRef = (el) => el && activeRow.value === NcForm.heading && (el as HTMLTextAreaElement)?.focus()
const searchQuery = ref('') const searchQuery = ref('')
const { t } = useI18n() const { t } = useI18n()
@ -556,6 +559,8 @@ onMounted(async () => {
await loadFormView() await loadFormView()
setFormData() setFormData()
isLoadingFormView.value = false isLoadingFormView.value = false
activeRow.value = NcForm.heading
}) })
watch(submitted, (v) => { watch(submitted, (v) => {
@ -909,6 +914,7 @@ useEventListener(
<a-form-item v-if="isEditable" class="!my-0"> <a-form-item v-if="isEditable" class="!my-0">
<a-textarea <a-textarea
v-model:value="formViewData.heading" v-model:value="formViewData.heading"
:ref="focusFormTitle"
class="nc-form-focus-element !p-0 !m-0 w-full !font-bold !text-2xl !border-0 !rounded-none !text-gray-900" class="nc-form-focus-element !p-0 !m-0 w-full !font-bold !text-2xl !border-0 !rounded-none !text-gray-900"
:style="{ :style="{
'borderRightWidth': '0px !important', 'borderRightWidth': '0px !important',

Loading…
Cancel
Save