Browse Source

feat(gui): use query param for providing rowId

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3655/head
Pranav C 2 years ago
parent
commit
5a6cb79714
  1. 17
      packages/nc-gui/components/smartsheet/Grid.vue
  2. 1
      packages/nc-gui/components/smartsheet/expanded-form/Header.vue
  3. 4
      packages/nc-gui/components/smartsheet/expanded-form/index.vue
  4. 0
      packages/nc-gui/pages/[projectType]/[projectId]/index/index/[type]/[title]/[[viewTitle]].vue

17
packages/nc-gui/components/smartsheet/Grid.vue

@ -139,8 +139,8 @@ const expandForm = (row: Row, state?: Record<string, any>, fromToolbar = false)
if (rowId) {
router.push({
params: {
...route.params,
query: {
...route.query,
rowId,
},
})
@ -398,18 +398,21 @@ onBeforeUnmount(async () => {
const expandedFormOnRowIdDlg = computed({
get() {
return !!route.params.rowId
return !!route.query.rowId
},
set(val) {
if (!val)
router.push({
params: {
...route.params,
query: {
...route.query,
rowId: undefined,
},
})
},
})
// reload table data reload hook as fallback to rowdatareload
provide(ReloadRowDataHookInj, reloadViewDataHook)
</script>
<template>
@ -653,11 +656,11 @@ const expandedFormOnRowIdDlg = computed({
<SmartsheetExpandedForm
v-if="expandedFormOnRowIdDlg"
:key="route.params.rowId"
:key="route.query.rowId"
v-model="expandedFormOnRowIdDlg"
:row="{ row: {}, oldRow: {}, rowMeta: {} }"
:meta="meta"
:row-id="route.params.rowId"
:row-id="route.query.rowId"
/>
</div>
</template>

1
packages/nc-gui/components/smartsheet/expanded-form/Header.vue

@ -26,6 +26,7 @@ const save = async () => {
reloadTrigger?.trigger()
} else {
await _save()
reloadTrigger?.trigger()
}
}

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

@ -53,16 +53,14 @@ provide(MetaInj, meta)
const { commentsDrawer, changedColumns, state: rowState, isNew, loadRow } = useProvideExpandedFormStore(meta, row)
if (props.loadRow) {
await loadRow()
}
if (props.rowId) {
loadRow(props.rowId)
await loadRow(props.rowId)
}
useProvideSmartsheetStore(ref({}) as Ref<ViewType>, meta)
provide(IsFormInj, ref(true))

0
packages/nc-gui/pages/[projectType]/[projectId]/index/index/[type]/[title]/[[viewTitle]]/[[rowId]].vue → packages/nc-gui/pages/[projectType]/[projectId]/index/index/[type]/[title]/[[viewTitle]].vue

Loading…
Cancel
Save