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) { if (rowId) {
router.push({ router.push({
params: { query: {
...route.params, ...route.query,
rowId, rowId,
}, },
}) })
@ -398,18 +398,21 @@ onBeforeUnmount(async () => {
const expandedFormOnRowIdDlg = computed({ const expandedFormOnRowIdDlg = computed({
get() { get() {
return !!route.params.rowId return !!route.query.rowId
}, },
set(val) { set(val) {
if (!val) if (!val)
router.push({ router.push({
params: { query: {
...route.params, ...route.query,
rowId: undefined, rowId: undefined,
}, },
}) })
}, },
}) })
// reload table data reload hook as fallback to rowdatareload
provide(ReloadRowDataHookInj, reloadViewDataHook)
</script> </script>
<template> <template>
@ -653,11 +656,11 @@ const expandedFormOnRowIdDlg = computed({
<SmartsheetExpandedForm <SmartsheetExpandedForm
v-if="expandedFormOnRowIdDlg" v-if="expandedFormOnRowIdDlg"
:key="route.params.rowId" :key="route.query.rowId"
v-model="expandedFormOnRowIdDlg" v-model="expandedFormOnRowIdDlg"
:row="{ row: {}, oldRow: {}, rowMeta: {} }" :row="{ row: {}, oldRow: {}, rowMeta: {} }"
:meta="meta" :meta="meta"
:row-id="route.params.rowId" :row-id="route.query.rowId"
/> />
</div> </div>
</template> </template>

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

@ -26,6 +26,7 @@ const save = async () => {
reloadTrigger?.trigger() reloadTrigger?.trigger()
} else { } else {
await _save() 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) const { commentsDrawer, changedColumns, state: rowState, isNew, loadRow } = useProvideExpandedFormStore(meta, row)
if (props.loadRow) { if (props.loadRow) {
await loadRow() await loadRow()
} }
if (props.rowId) { if (props.rowId) {
loadRow(props.rowId) await loadRow(props.rowId)
} }
useProvideSmartsheetStore(ref({}) as Ref<ViewType>, meta) useProvideSmartsheetStore(ref({}) as Ref<ViewType>, meta)
provide(IsFormInj, ref(true)) 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