diff --git a/packages/nc-gui/components/smartsheet/expanded-form/Detached.vue b/packages/nc-gui/components/smartsheet/expanded-form/Detached.vue new file mode 100644 index 0000000000..cdc4311005 --- /dev/null +++ b/packages/nc-gui/components/smartsheet/expanded-form/Detached.vue @@ -0,0 +1,20 @@ + + + diff --git a/packages/nc-gui/components/smartsheet/expanded-form/index.vue b/packages/nc-gui/components/smartsheet/expanded-form/index.vue index 3dbb20469f..01c4505cc1 100644 --- a/packages/nc-gui/components/smartsheet/expanded-form/index.vue +++ b/packages/nc-gui/components/smartsheet/expanded-form/index.vue @@ -9,7 +9,10 @@ import { MetaInj, ReloadRowDataHookInj, computedInject, + createEventHook, + inject, message, + onBeforeMount, provide, ref, toRef, @@ -57,21 +60,23 @@ provide(MetaInj, meta) const { commentsDrawer, changedColumns, state: rowState, isNew, loadRow } = useProvideExpandedFormStore(meta, row) -if (props.loadRow) { - await loadRow() -} +onBeforeMount(async () => { + if (props.loadRow) { + await loadRow() + } -if (props.rowId) { - try { - await loadRow(props.rowId) - } catch (e: any) { - if (e.response?.status === 404) { - // todo: i18n - message.error('Record not found') - router.replace({ query: {} }) - } else throw e + if (props.rowId) { + try { + await loadRow(props.rowId) + } catch (e: any) { + if (e.response?.status === 404) { + // todo: i18n + message.error('Record not found') + router.replace({ query: {} }) + } else throw e + } } -} +}) useProvideSmartsheetStore(ref({}) as Ref, meta) @@ -134,6 +139,7 @@ export default { width="min(90vw,1000px)" :body-style="{ 'padding': 0, 'display': 'flex', 'flex-direction': 'column' }" :closable="false" + destroy-on-close class="nc-drawer-expanded-form" > diff --git a/packages/nc-gui/components/tabs/Smartsheet.vue b/packages/nc-gui/components/tabs/Smartsheet.vue index db6aad701d..38d473de5c 100644 --- a/packages/nc-gui/components/tabs/Smartsheet.vue +++ b/packages/nc-gui/components/tabs/Smartsheet.vue @@ -7,6 +7,7 @@ import { IsLockedInj, MetaInj, OpenNewRecordFormHookInj, + ReadonlyInj, ReloadViewDataHookInj, ReloadViewMetaHookInj, TabMetaInj, @@ -55,6 +56,7 @@ provide(OpenNewRecordFormHookInj, openNewRecordFormHook) provide(FieldsInj, fields) provide(IsFormInj, isForm) provide(TabMetaInj, activeTab) +provide(ReadonlyInj, false)