Browse Source

Merge pull request #4485 from nocodb/fix/expanded-form-focus

fix(nc-gui): focus on the first input in expanded form nextTick
pull/4490/head
աɨռɢӄաօռɢ 2 years ago committed by GitHub
parent
commit
75ecbf2e4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      packages/nc-gui/components/smartsheet/expanded-form/index.vue

15
packages/nc-gui/components/smartsheet/expanded-form/index.vue

@ -122,11 +122,13 @@ if (isKanban.value) {
} }
} }
const cellWrapperEl = (wrapperEl: HTMLElement) => { const cellWrapperEl = ref<HTMLElement>()
nextTick(() => {
;(wrapperEl?.querySelector('input,select,textarea') as HTMLInputElement)?.focus() onMounted(() => {
setTimeout(() => {
;(cellWrapperEl.value?.querySelector('input,select,textarea') as HTMLInputElement)?.focus()
}) })
} })
</script> </script>
<script lang="ts"> <script lang="ts">
@ -163,7 +165,10 @@ export default {
<LazySmartsheetHeaderCell v-else :column="col" /> <LazySmartsheetHeaderCell v-else :column="col" />
<div :ref="i ? null : cellWrapperEl" class="!bg-white rounded px-1 min-h-[35px] flex items-center mt-2"> <div
:ref="i ? null : (el) => (cellWrapperEl = el)"
class="!bg-white rounded px-1 min-h-[35px] flex items-center mt-2"
>
<LazySmartsheetVirtualCell v-if="isVirtualCol(col)" v-model="row.row[col.title]" :row="row" :column="col" /> <LazySmartsheetVirtualCell v-if="isVirtualCol(col)" v-model="row.row[col.title]" :row="row" :column="col" />
<LazySmartsheetCell <LazySmartsheetCell

Loading…
Cancel
Save