From b23c9b109a5ce851ffaec76e6e7866b4f153eac3 Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Sat, 16 Sep 2023 12:17:52 +0530 Subject: [PATCH] fix: links in forms --- .../nc-gui/components/virtual-cell/Links.vue | 8 +++- .../components/ListChildItems.vue | 48 ++++++++++++++----- .../virtual-cell/components/ListItem.vue | 2 +- .../virtual-cell/components/ListItems.vue | 2 +- 4 files changed, 45 insertions(+), 15 deletions(-) diff --git a/packages/nc-gui/components/virtual-cell/Links.vue b/packages/nc-gui/components/virtual-cell/Links.vue index f9ba1286d8..410575fecf 100644 --- a/packages/nc-gui/components/virtual-cell/Links.vue +++ b/packages/nc-gui/components/virtual-cell/Links.vue @@ -21,6 +21,8 @@ const isLocked = inject(IsLockedInj, ref(false)) const isUnderLookup = inject(IsUnderLookupInj, ref(false)) +const colTitle = computed(() => column.value?.title || '') + const listItemsDlg = ref(false) const childListDlg = ref(false) @@ -43,6 +45,10 @@ const relatedTableDisplayColumn = computed( loadRelatedTableMeta() const textVal = computed(() => { + if (isForm?.value) { + return state.value?.[colTitle.value]?.length ? `${state.value?.[colTitle.value]?.length} records Linked` : 'No records linked' + } + const parsedValue = +value?.value || 0 if (!parsedValue) { @@ -90,7 +96,7 @@ const localCellValue = computed(() => { :is="isLocked || isUnderLookup ? 'span' : 'a'" :title="textVal" class="text-center pl-3 nc-datatype-link underline-transparent" - :class="{ '!text-gray-300': !value }" + :class="{ '!text-gray-300': !textVal }" @click.stop.prevent="openChildList" > {{ textVal }} diff --git a/packages/nc-gui/components/virtual-cell/components/ListChildItems.vue b/packages/nc-gui/components/virtual-cell/components/ListChildItems.vue index f8319e7467..8a5cb6c70e 100644 --- a/packages/nc-gui/components/virtual-cell/components/ListChildItems.vue +++ b/packages/nc-gui/components/virtual-cell/components/ListChildItems.vue @@ -103,6 +103,13 @@ const relation = computed(() => { return injectedColumn!.value?.colOptions?.type }) +watch( + () => props.cellValue, + () => { + if (!isNew.value) loadChildrenList() + }, +) + watch(expandedFormDlg, () => { loadChildrenList() }) @@ -114,20 +121,21 @@ watch(expandedFormDlg, () => { :class="{ active: vModel }" :footer="null" :closable="false" - :width="840" - :body-style="{ 'padding': 0, 'margin': 0, 'min-height': '500px' }" + :width="isForm ? 600 : 800" + :body-style="{ 'padding': 0, 'margin': 0, 'min-height': isForm ? '300px' : '500px' }" wrap-class-name="nc-modal-child-list" > -
+
-
+
{ -
+

There are no records in table

@@ -183,9 +204,12 @@ watch(expandedFormDlg, () => {
-
+
{{ childrenListCount || 0 }} records {{ childrenListCount !== 0 ? 'are' : '' }} linked
+
+ {{ state?.[colTitle]?.length || 0 }} records {{ state?.[colTitle]?.length !== 0 ? 'are' : '' }} linked +
{ Link more records - Close + Close
diff --git a/packages/nc-gui/components/virtual-cell/components/ListItem.vue b/packages/nc-gui/components/virtual-cell/components/ListItem.vue index 8e53200e17..84ae5e7842 100644 --- a/packages/nc-gui/components/virtual-cell/components/ListItem.vue +++ b/packages/nc-gui/components/virtual-cell/components/ListItem.vue @@ -115,7 +115,7 @@ const attachments: Attachment[] = computed(() => {
{ v-model:visible="vModel" :class="{ active: vModel }" :footer="null" - :width="840" + :width="isForm ? 600 : 800" :closable="false" :body-style="{ 'padding': 0, 'margin': 0, 'min-height': '500px' }" wrap-class-name="nc-modal-link-record"