Browse Source

Merge pull request #3353 from nocodb/fix/gui-v2-missing-expand-cell-in-shared-view

fix(gui-v2) missing expand cell in shared view
pull/3355/head
Pranav C 2 years ago committed by GitHub
parent
commit
49d67f6885
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      packages/nc-gui-v2/components/smartsheet/expanded-form/index.vue
  2. 4
      packages/nc-gui-v2/components/virtual-cell/HasMany.vue
  3. 2
      packages/nc-gui-v2/components/virtual-cell/components/ListChildItems.vue
  4. 12
      packages/nc-gui-v2/composables/useLTARStore.ts

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

@ -60,9 +60,11 @@ const { $api } = useNuxtApp()
if (props.loadRow) {
const { project } = useProject()
const { sharedView } = useSharedView() as Record<string, any>
row.value.row = await $api.dbTableRow.read(
NOCO,
project.value.id as string,
(project?.value?.id || sharedView.value.view.project_id) as string,
meta.value.title,
extractPkFromRow(row.value.row, meta.value.columns as ColumnType[]),
)

4
packages/nc-gui-v2/components/virtual-cell/HasMany.vue

@ -95,13 +95,13 @@ const unlinkRef = async (rec: Record<string, any>) => {
</span>
</template>
</div>
<div v-if="!isLocked && isUIAllowed('xcDatatableEditable')" class="flex justify-end gap-1 min-h-[30px] items-center">
<div v-if="!isLocked" class="flex justify-end gap-1 min-h-[30px] items-center">
<MdiArrowExpand
class="select-none transform text-sm nc-action-icon text-gray-500/50 hover:text-gray-500 nc-arrow-expand"
@click="childListDlg = true"
/>
<MdiPlus
v-if="!readOnly"
v-if="!readOnly && isUIAllowed('xcDatatableEditable')"
class="select-none text-sm nc-action-icon text-gray-500/50 hover:text-gray-500 nc-plus"
@click="listItemsDlg = true"
/>

2
packages/nc-gui-v2/components/virtual-cell/components/ListChildItems.vue

@ -94,7 +94,7 @@ const expandedFormRow = ref()
</a-button>
</div>
<template v-if="(isNew && state?.[column?.title]?.length) || childrenList?.pageInfo?.totalRows">
<div class="flex-1 overflow-auto min-h-0 scrollbar-thin-dull px-12">
<div class="flex-1 overflow-auto min-h-0 scrollbar-thin-dull px-12 cursor-pointer">
<a-card
v-for="(row, i) of childrenList?.list ?? state?.[column?.title] ?? []"
:key="i"

12
packages/nc-gui-v2/composables/useLTARStore.ts

@ -46,6 +46,10 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
const colOptions = $computed(() => column?.value.colOptions as LinkToAnotherRecordType)
const { sharedView } = useSharedView() as Record<string, any>
const projectId = project?.value?.id || sharedView.value.view.project_id
// getters
const meta = computed(() => metas?.value?.[column?.value?.fk_model_id as string])
const relatedTableMeta = computed<TableType>(() => {
@ -109,7 +113,7 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
} else if (isNewRow?.value) {
childrenExcludedList.value = await $api.dbTableRow.list(
NOCO,
project.value.id as string,
projectId,
relatedTableMeta?.value?.id as string,
{
limit: childrenExcludedListPagination.size,
@ -123,7 +127,7 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
} else {
childrenExcludedList.value = await $api.dbTableRow.nestedChildrenExcludedList(
NOCO,
project.value.id as string,
projectId,
meta.value.id,
rowId.value,
colOptions.type as 'mm' | 'hm',
@ -149,7 +153,7 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
childrenList.value = await $api.dbTableRow.nestedList(
NOCO,
project.value.id as string,
(project?.value?.id || sharedView?.value?.view?.project_id) as string,
meta.value.id,
rowId.value,
colOptions.type as 'mm' | 'hm',
@ -172,7 +176,7 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
onOk: async () => {
const id = getRelatedTableRowId(row)
try {
$api.dbTableRow.delete(NOCO, project.value.id as string, relatedTableMeta.value.id as string, id as string)
$api.dbTableRow.delete(NOCO, projectId, relatedTableMeta.value.id as string, id as string)
reloadData?.()
/** reload child list if not a new row */

Loading…
Cancel
Save