Browse Source

fix: modal closing

pull/6554/head
DarkPhoenix2704 1 year ago
parent
commit
f31720c4dc
  1. 47
      packages/nc-gui/components/smartsheet/expanded-form/index.vue
  2. 1
      packages/nc-gui/components/smartsheet/grid/index.vue

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

@ -47,7 +47,7 @@ interface Props {
const props = defineProps<Props>() const props = defineProps<Props>()
const emits = defineEmits(['update:modelValue', 'cancel', 'next', 'prev']) const emits = defineEmits(['update:modelValue', 'cancel', 'next', 'prev', 'update:row'])
const key = ref(0) const key = ref(0)
@ -57,7 +57,9 @@ const { isMobileMode } = useGlobal()
const { t } = useI18n() const { t } = useI18n()
const row = ref(props.row) const rowId = toRef(props, 'rowId')
const row = useVModel(props, 'row', emits)
const state = toRef(props, 'state') const state = toRef(props, 'state')
@ -108,6 +110,7 @@ const {
loadRow: _loadRow, loadRow: _loadRow,
primaryKey, primaryKey,
saveRowAndStay, saveRowAndStay,
row: _row,
syncLTARRefs, syncLTARRefs,
save: _save, save: _save,
} = useProvideExpandedFormStore(meta, row) } = useProvideExpandedFormStore(meta, row)
@ -115,12 +118,12 @@ const {
const duplicatingRowInProgress = ref(false) const duplicatingRowInProgress = ref(false)
if (props.loadRow) { if (props.loadRow) {
await _loadRow() await _loadRow(rowId.value)
} }
if (props.rowId) { if (rowId.value) {
try { try {
await _loadRow(props.rowId) await _loadRow(rowId.value)
} catch (e: any) { } catch (e: any) {
if (e.response?.status === 404) { if (e.response?.status === 404) {
// todo: i18n // todo: i18n
@ -225,11 +228,6 @@ if (isKanban.value) {
} }
} }
} }
watch(isUnsavedFormExist, () => {
console.log(isUnsavedFormExist.value, 'HEHEH')
})
provide(IsExpandedFormOpenInj, isExpanded) provide(IsExpandedFormOpenInj, isExpanded)
const cellWrapperEl = ref() const cellWrapperEl = ref()
@ -340,22 +338,16 @@ const onConfirmDeleteRowClick = async () => {
showDeleteRowModal.value = false showDeleteRowModal.value = false
} }
watch( watch(rowId, (nRow) => {
state, console.log('Loooding', _row.value)
() => { _loadRow(nRow)
if (!state.value?.id) return console.log('Loooding', nRow)
})
setTimeout(() => { watch(_row, (nRow) => {
const rowDom = wrapper.value?.querySelector(`.nc-expanded-form-row[col-id="${state.value?.id}"]`) console.log('Loooding', nRow)
if (rowDom) { row.value = nRow.value
rowDom.scrollIntoView({ behavior: 'smooth', block: 'center' }) })
}
}, 650)
},
{
immediate: true,
},
)
const showRightSections = computed(() => { const showRightSections = computed(() => {
return !isNew.value && commentsDrawer.value && isUIAllowed('commentList') return !isNew.value && commentsDrawer.value && isUIAllowed('commentList')
@ -370,17 +362,17 @@ export default {
<template> <template>
<NcModal <NcModal
:key="key"
v-model:visible="isExpanded" v-model:visible="isExpanded"
:footer="null" :footer="null"
:width="commentsDrawer && isUIAllowed('commentList') ? 'min(80vw,1280px)' : 'min(80vw,1280px)'" :width="commentsDrawer && isUIAllowed('commentList') ? 'min(80vw,1280px)' : 'min(80vw,1280px)'"
:body-style="{ padding: 0 }" :body-style="{ padding: 0 }"
:closable="false" :closable="false"
size="small" size="small"
transition=""
class="nc-drawer-expanded-form" class="nc-drawer-expanded-form"
:class="{ active: isExpanded }" :class="{ active: isExpanded }"
> >
<div class="h-[85vh] xs:(max-h-full) max-h-215 flex flex-col p-6"> <div :key="row.row" class="h-[85vh] xs:(max-h-full) max-h-215 flex flex-col p-6">
<div class="flex h-8 flex-shrink-0 w-full items-center nc-expanded-form-header relative mb-4 justify-between"> <div class="flex h-8 flex-shrink-0 w-full items-center nc-expanded-form-header relative mb-4 justify-between">
<template v-if="!isMobileMode"> <template v-if="!isMobileMode">
<div class="flex gap-3 w-100"> <div class="flex gap-3 w-100">
@ -496,6 +488,7 @@ export default {
'w-2/3': showRightSections, 'w-2/3': showRightSections,
}" }"
> >
{{ rowId }}{{ _row }}
<div <div
class="flex flex-col flex-grow mt-2 h-full max-h-full nc-scrollbar-md !pb-2 items-center w-full bg-white p-4 xs:p-0" class="flex flex-col flex-grow mt-2 h-full max-h-full nc-scrollbar-md !pb-2 items-center w-full bg-white p-4 xs:p-0"
> >

1
packages/nc-gui/components/smartsheet/grid/index.vue

@ -241,7 +241,6 @@ onMounted(() => {
<SmartsheetExpandedForm <SmartsheetExpandedForm
v-if="expandedFormOnRowIdDlg" v-if="expandedFormOnRowIdDlg"
:key="routeQuery.rowId"
v-model="expandedFormOnRowIdDlg" v-model="expandedFormOnRowIdDlg"
:row="{ row: {}, oldRow: {}, rowMeta: {} }" :row="{ row: {}, oldRow: {}, rowMeta: {} }"
:meta="meta" :meta="meta"

Loading…
Cancel
Save