diff --git a/packages/nc-gui/components/smartsheet/expanded-form/index.vue b/packages/nc-gui/components/smartsheet/expanded-form/index.vue index e7d4b84c58..d1ba6d245a 100644 --- a/packages/nc-gui/components/smartsheet/expanded-form/index.vue +++ b/packages/nc-gui/components/smartsheet/expanded-form/index.vue @@ -41,6 +41,7 @@ interface Props { showNextPrevIcons?: boolean firstRow?: boolean lastRow?: boolean + closeAfterSave?: boolean } const props = defineProps() @@ -201,6 +202,10 @@ const save = async () => { reloadTrigger?.trigger() } isUnsavedFormExist.value = false + + if (props.closeAfterSave) { + isExpanded.value = false + } } const isPreventChangeModalOpen = ref(false) diff --git a/packages/nc-gui/components/virtual-cell/components/ListItems.vue b/packages/nc-gui/components/virtual-cell/components/ListItems.vue index 7e91152058..01eafc23ab 100644 --- a/packages/nc-gui/components/virtual-cell/components/ListItems.vue +++ b/packages/nc-gui/components/virtual-cell/components/ListItems.vue @@ -53,6 +53,8 @@ const { addLTARRef, isNew, removeLTARRef, state: rowState } = useSmartsheetRowSt const isPublic = inject(IsPublicInj, ref(false)) +const isExpandedFormCloseAfterSave = ref(false) + isChildrenExcludedLoading.value = true const isForm = inject(IsFormInj, ref(false)) @@ -113,7 +115,7 @@ const newRowState = computed(() => { const colOpt = (injectedColumn?.value as ColumnType)?.colOptions as LinkToAnotherRecordType const colInRelatedTable: ColumnType | undefined = relatedTableMeta?.value?.columns?.find((col) => { // Links as for the case of 'mm' we need the 'Links' column - if (col.uidt !== UITypes.LinkToAnotherRecord && col.uidt !== UITypes.Links) return false + if (!isLinksOrLTAR(col)) return false const colOpt1 = col?.colOptions as LinkToAnotherRecordType if (colOpt1?.fk_related_model_id !== meta.value.id) return false @@ -158,6 +160,10 @@ const relation = computed(() => { watch(expandedFormDlg, () => { if (!expandedFormDlg.value) { + isExpandedFormCloseAfterSave.value = false + if (!isForm.value) { + loadChildrenList() + } loadChildrenExcludedList(rowState.value) } }) @@ -174,6 +180,12 @@ const onClick = (refRow: any, id: string) => { linkRow(refRow, Number.parseInt(id)) } } + +const addNewRecord = () => { + expandedFormRow.value = {} + expandedFormDlg.value = true + isExpandedFormCloseAfterSave.value = true +}