Browse Source

fix: disabled button on duplicate expand form

pull/6486/head
sreehari jayaraj 1 year ago
parent
commit
37aa036e55
  1. 12
      packages/nc-gui/components/smartsheet/expanded-form/index.vue

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

@ -66,6 +66,9 @@ const router = useRouter()
const isPublic = inject(IsPublicInj, ref(false)) const isPublic = inject(IsPublicInj, ref(false))
// to check if a expanded form which is not yet saved exist or not
const isUnsavedFormExist = ref(false)
const { isUIAllowed } = useRoles() const { isUIAllowed } = useRoles()
const reloadTrigger = inject(ReloadRowDataHookInj, createEventHook()) const reloadTrigger = inject(ReloadRowDataHookInj, createEventHook())
@ -151,6 +154,7 @@ const onClose = () => {
const onDuplicateRow = () => { const onDuplicateRow = () => {
duplicatingRowInProgress.value = true duplicatingRowInProgress.value = true
isUnsavedFormExist.value = true
const oldRow = { ...row.value.row } const oldRow = { ...row.value.row }
delete oldRow.ncRecordId delete oldRow.ncRecordId
const newRow = Object.assign( const newRow = Object.assign(
@ -177,6 +181,7 @@ const save = async () => {
await _save() await _save()
reloadTrigger?.trigger() reloadTrigger?.trigger()
} }
isUnsavedFormExist.value = false
} }
const isPreventChangeModalOpen = ref(false) const isPreventChangeModalOpen = ref(false)
@ -195,6 +200,7 @@ const onNext = async () => {
} }
const saveChanges = async () => { const saveChanges = async () => {
isUnsavedFormExist.value = false
await save() await save()
emits('next') emits('next')
} }
@ -219,6 +225,10 @@ if (isKanban.value) {
} }
} }
watch(isUnsavedFormExist, () => {
console.log(isUnsavedFormExist.value, 'HEHEH')
})
provide(IsExpandedFormOpenInj, isExpanded) provide(IsExpandedFormOpenInj, isExpanded)
const cellWrapperEl = ref() const cellWrapperEl = ref()
@ -614,7 +624,7 @@ export default {
type="primary" type="primary"
size="medium" size="medium"
class="nc-expand-form-save-btn !xs:(text-base)" class="nc-expand-form-save-btn !xs:(text-base)"
:disabled="changedColumns.size === 0" :disabled="changedColumns.size === 0 && !isUnsavedFormExist"
@click="save" @click="save"
> >
<div class="xs:px-1">Save</div> <div class="xs:px-1">Save</div>

Loading…
Cancel
Save