Browse Source

fix(gui): add confirm option for save when switching to next record

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5271/head
Pranav C 2 years ago
parent
commit
1c51efa43b
  1. 23
      packages/nc-gui/components/smartsheet/expanded-form/index.vue

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

@ -141,8 +141,22 @@ const onDuplicateRow = () => {
}
const onNext = async () => {
await save()
emits('next')
if (changedColumns.value.size > 0) {
await Modal.confirm({
title: 'Do you want to save the changes?',
okText: 'Save',
cancelText: 'Discard',
onOk: async () => {
await save()
emits('next')
},
onCancel: () => {
emits('next')
},
})
} else {
emits('next')
}
}
const reloadParentRowHook = inject(ReloadRowDataHookInj, createEventHook())
@ -196,7 +210,7 @@ useActiveKeyupListener(
emits('prev')
} else if (e.key === 'ArrowRight') {
e.stopPropagation()
emits('next')
onNext()
}
// on alt + s save record
else if (e.code === 'KeyS') {
@ -319,7 +333,8 @@ export default {
:ref="i ? null : (el) => (cellWrapperEl = el)"
class="!bg-white rounded px-1 min-h-[35px] flex items-center mt-2 relative"
>
<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
v-else

Loading…
Cancel
Save