Browse Source

fix(gui-v2): focus decimal cell on edit enabled

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3005/head
Pranav C 2 years ago
parent
commit
95de96b6b4
  1. 8
      packages/nc-gui-v2/components/cell/Decimal.vue
  2. 2
      packages/nc-gui-v2/components/smartsheet/Cell.vue

8
packages/nc-gui-v2/components/cell/Decimal.vue

@ -3,7 +3,7 @@ import { computed, inject, onMounted, ref } from '#imports'
import { EditModeInj } from '~/context' import { EditModeInj } from '~/context'
interface Props { interface Props {
modelValue: number | null modelValue: number | null | string
} }
interface Emits { interface Emits {
@ -20,15 +20,13 @@ const root = ref<HTMLInputElement>()
const vModel = useVModel(props, 'modelValue', emits) const vModel = useVModel(props, 'modelValue', emits)
onMounted(() => { const focus = (el: HTMLInputElement) => el?.focus()
root.value?.focus()
})
</script> </script>
<template> <template>
<input <input
v-if="editEnabled" v-if="editEnabled"
ref="root" :ref="focus"
v-model="vModel" v-model="vModel"
class="outline-none pa-0 border-none w-full h-full prose-sm" class="outline-none pa-0 border-none w-full h-full prose-sm"
type="number" type="number"

2
packages/nc-gui-v2/components/smartsheet/Cell.vue

@ -102,7 +102,7 @@ const syncAndNavigate = (dir: NavigateDir) => {
<template> <template>
<div <div
class="nc-cell" class="nc-cell w-full-h-full"
@keydown.stop.left @keydown.stop.left
@keydown.stop.right @keydown.stop.right
@keydown.stop.up @keydown.stop.up

Loading…
Cancel
Save