diff --git a/packages/nc-gui-v2/components/cell/Text.vue b/packages/nc-gui-v2/components/cell/Text.vue index 2b530448d3..ccd0bca0c7 100644 --- a/packages/nc-gui-v2/components/cell/Text.vue +++ b/packages/nc-gui-v2/components/cell/Text.vue @@ -18,6 +18,6 @@ const focus = (el: HTMLInputElement) => el?.focus() diff --git a/packages/nc-gui-v2/components/cell/TextArea.vue b/packages/nc-gui-v2/components/cell/TextArea.vue index a6d50e9efc..c27933fe56 100644 --- a/packages/nc-gui-v2/components/cell/TextArea.vue +++ b/packages/nc-gui-v2/components/cell/TextArea.vue @@ -24,6 +24,7 @@ const focus = (el: HTMLTextAreaElement) => el?.focus() v-model="vModel" rows="4" class="h-full w-full min-h-[60px] outline-none" + @blur="editEnabled = false" @keydown.alt.enter.stop @keydown.shift.enter.stop /> diff --git a/packages/nc-gui-v2/components/smartsheet/Cell.vue b/packages/nc-gui-v2/components/smartsheet/Cell.vue index fccce1ed79..bc725b74fa 100644 --- a/packages/nc-gui-v2/components/smartsheet/Cell.vue +++ b/packages/nc-gui-v2/components/smartsheet/Cell.vue @@ -4,6 +4,7 @@ import type { ColumnType } from 'nocodb-sdk' import { provide, toRef } from 'vue' import { computed, useColumn, useDebounceFn, useVModel } from '#imports' import { ColumnInj, EditModeInj } from '~/context' +import { NavigateDir } from '~/lib' interface Props { column: ColumnType @@ -17,14 +18,15 @@ interface Emits { const { column, ...props } = defineProps() -const emit = defineEmits(['update:modelValue', 'save']) +const emit = defineEmits(['update:modelValue', 'save', 'navigate', 'update:editEnabled']) provide(ColumnInj, column) -provide(EditModeInj, toRef(props, 'editEnabled')) +provide(EditModeInj, useVModel(props, 'editEnabled', emit)) let changed = $ref(false) const syncValue = useDebounceFn(function () { + changed = false emit('save') }, 1000) @@ -59,6 +61,7 @@ const vModel = computed({ syncValue() } else if (!isManualSaved) { emit('save') + changed = true } } }, @@ -87,10 +90,26 @@ const { isPercent, isPhoneNumber, } = useColumn(column) + +const syncAndNavigate = (dir: NavigateDir) => { + if (changed) { + emit('save') + changed = false + } + emit('navigate', dir) +}