|
|
@ -7,6 +7,7 @@ import { |
|
|
|
computed, |
|
|
|
computed, |
|
|
|
inject, |
|
|
|
inject, |
|
|
|
ref, |
|
|
|
ref, |
|
|
|
|
|
|
|
useExpandedFormDetached, |
|
|
|
useLTARStoreOrThrow, |
|
|
|
useLTARStoreOrThrow, |
|
|
|
useSmartsheetRowStoreOrThrow, |
|
|
|
useSmartsheetRowStoreOrThrow, |
|
|
|
useVModel, |
|
|
|
useVModel, |
|
|
@ -22,6 +23,8 @@ const vModel = useVModel(props, 'modelValue', emit) |
|
|
|
|
|
|
|
|
|
|
|
const column = inject(ColumnInj) |
|
|
|
const column = inject(ColumnInj) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { open, close } = useExpandedFormDetached() |
|
|
|
|
|
|
|
|
|
|
|
const { |
|
|
|
const { |
|
|
|
childrenExcludedList, |
|
|
|
childrenExcludedList, |
|
|
|
loadChildrenExcludedList, |
|
|
|
loadChildrenExcludedList, |
|
|
@ -57,8 +60,6 @@ watch(vModel, (nextVal, prevVal) => { |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const expandedFormDlg = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** populate initial state for a new row which is parent/child of current record */ |
|
|
|
/** populate initial state for a new row which is parent/child of current record */ |
|
|
|
const newRowState = computed(() => { |
|
|
|
const newRowState = computed(() => { |
|
|
|
if (isNew.value) return {} |
|
|
|
if (isNew.value) return {} |
|
|
@ -93,11 +94,23 @@ const newRowState = computed(() => { |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// if it's an existing record close the list |
|
|
|
function openExpandedForm() { |
|
|
|
// after new record creation since it's already linking while creating |
|
|
|
// if it's an existing record close the list |
|
|
|
watch(expandedFormDlg, (nexVal) => { |
|
|
|
// after new record creation since it's already linking while creating |
|
|
|
if (!nexVal && !isNew.value) vModel.value = false |
|
|
|
if (!isNew.value) { |
|
|
|
}) |
|
|
|
vModel.value = false |
|
|
|
|
|
|
|
return close() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
open({ |
|
|
|
|
|
|
|
isOpen: true, |
|
|
|
|
|
|
|
row: { row: {}, oldRow: {}, rowMeta: { new: true } }, |
|
|
|
|
|
|
|
meta: relatedTableMeta.value, |
|
|
|
|
|
|
|
loadRow: false, |
|
|
|
|
|
|
|
useMetaFields: true, |
|
|
|
|
|
|
|
state: newRowState.value, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
@ -122,7 +135,7 @@ watch(expandedFormDlg, (nexVal) => { |
|
|
|
<MdiReload class="cursor-pointer text-gray-500 nc-reload" @click="loadChildrenExcludedList" /> |
|
|
|
<MdiReload class="cursor-pointer text-gray-500 nc-reload" @click="loadChildrenExcludedList" /> |
|
|
|
|
|
|
|
|
|
|
|
<!-- Add new record --> |
|
|
|
<!-- Add new record --> |
|
|
|
<a-button v-if="!isPublic" type="primary" size="small" @click="expandedFormDlg = true"> |
|
|
|
<a-button v-if="!isPublic" type="primary" size="small" @click="openExpandedForm"> |
|
|
|
{{ $t('activity.addNewRecord') }} |
|
|
|
{{ $t('activity.addNewRecord') }} |
|
|
|
</a-button> |
|
|
|
</a-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -156,17 +169,6 @@ watch(expandedFormDlg, (nexVal) => { |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<a-empty v-else class="my-10" :image="Empty.PRESENTED_IMAGE_SIMPLE" /> |
|
|
|
<a-empty v-else class="my-10" :image="Empty.PRESENTED_IMAGE_SIMPLE" /> |
|
|
|
|
|
|
|
|
|
|
|
<Suspense> |
|
|
|
|
|
|
|
<LazySmartsheetExpandedForm |
|
|
|
|
|
|
|
v-if="expandedFormDlg" |
|
|
|
|
|
|
|
v-model="expandedFormDlg" |
|
|
|
|
|
|
|
:meta="relatedTableMeta" |
|
|
|
|
|
|
|
:row="{ row: {}, oldRow: {}, rowMeta: { new: true } }" |
|
|
|
|
|
|
|
:state="newRowState" |
|
|
|
|
|
|
|
use-meta-fields |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</Suspense> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</a-modal> |
|
|
|
</a-modal> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|