|
|
@ -24,6 +24,8 @@ const emit = defineEmits(['update:modelValue', 'attachRecord']) |
|
|
|
|
|
|
|
|
|
|
|
const vModel = useVModel(props, 'modelValue', emit) |
|
|
|
const vModel = useVModel(props, 'modelValue', emit) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { isMobileMode } = useGlobal() |
|
|
|
|
|
|
|
|
|
|
|
const isForm = inject(IsFormInj, ref(false)) |
|
|
|
const isForm = inject(IsFormInj, ref(false)) |
|
|
|
|
|
|
|
|
|
|
|
const isPublic = inject(IsPublicInj, ref(false)) |
|
|
|
const isPublic = inject(IsPublicInj, ref(false)) |
|
|
@ -159,13 +161,14 @@ const linkOrUnLink = (rowRef: Record<string, string>, id: string) => { |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<a-modal |
|
|
|
<NcModal |
|
|
|
v-model:visible="vModel" |
|
|
|
v-model:visible="vModel" |
|
|
|
:class="{ active: vModel }" |
|
|
|
:class="{ active: vModel }" |
|
|
|
:footer="null" |
|
|
|
:footer="null" |
|
|
|
:closable="false" |
|
|
|
:closable="false" |
|
|
|
|
|
|
|
size="medium" |
|
|
|
:width="isForm ? 600 : 800" |
|
|
|
:width="isForm ? 600 : 800" |
|
|
|
:body-style="{ 'padding': 0, 'margin': 0, 'min-height': isForm ? '300px' : '500px' }" |
|
|
|
:body-style="{ 'max-height': '640px', 'height': '85vh' }" |
|
|
|
wrap-class-name="nc-modal-child-list" |
|
|
|
wrap-class-name="nc-modal-child-list" |
|
|
|
> |
|
|
|
> |
|
|
|
<LazyVirtualCellComponentsHeader |
|
|
|
<LazyVirtualCellComponentsHeader |
|
|
@ -199,19 +202,15 @@ const linkOrUnLink = (rowRef: Record<string, string>, id: string) => { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div v-if="isDataExist || isChildrenLoading" class="mt-2 mb-2"> |
|
|
|
<div class="flex flex-col flex-grow"> |
|
|
|
<div |
|
|
|
<template v-if="(isNew && state?.[colTitle]?.length) || childrenList?.pageInfo?.totalRows"> |
|
|
|
:class="{ |
|
|
|
<div class="mt-2 mb-2"> |
|
|
|
'h-[420px]': !isForm, |
|
|
|
<div class="nc-scrollbar-md cursor-pointer pr-1"> |
|
|
|
'h-[250px]': isForm, |
|
|
|
|
|
|
|
}" |
|
|
|
|
|
|
|
class="overflow-scroll nc-scrollbar-md cursor-pointer pr-1" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<template v-if="isChildrenLoading"> |
|
|
|
<template v-if="isChildrenLoading"> |
|
|
|
<div |
|
|
|
<div |
|
|
|
v-for="(x, i) in Array.from({ length: skeltonAmountToShow })" |
|
|
|
v-for="(x, i) in Array.from({ length: 10 })" |
|
|
|
:key="i" |
|
|
|
:key="i" |
|
|
|
class="border-2 flex flex-row gap-2 mb-2 transition-all rounded-xl relative border-gray-200 hover:bg-gray-50" |
|
|
|
class="!border-2 flex flex-row gap-2 mb-2 transition-all !rounded-xl relative !border-gray-200 hover:bg-gray-50" |
|
|
|
> |
|
|
|
> |
|
|
|
<a-skeleton-image class="h-24 w-24 !rounded-xl" /> |
|
|
|
<a-skeleton-image class="h-24 w-24 !rounded-xl" /> |
|
|
|
<div class="flex flex-col m-[.5rem] gap-2 flex-grow justify-center"> |
|
|
|
<div class="flex flex-col m-[.5rem] gap-2 flex-grow justify-center"> |
|
|
@ -249,19 +248,22 @@ const linkOrUnLink = (rowRef: Record<string, string>, id: string) => { |
|
|
|
:is-linked="childrenList?.list ? isChildrenListLinked[Number.parseInt(id)] : true" |
|
|
|
:is-linked="childrenList?.list ? isChildrenListLinked[Number.parseInt(id)] : true" |
|
|
|
:is-loading="isChildrenListLoading[Number.parseInt(id)]" |
|
|
|
:is-loading="isChildrenListLoading[Number.parseInt(id)]" |
|
|
|
@expand="onClick(refRow)" |
|
|
|
@expand="onClick(refRow)" |
|
|
|
@click="linkOrUnLink(refRow, id)" |
|
|
|
@click=" |
|
|
|
|
|
|
|
() => { |
|
|
|
|
|
|
|
if (isPublic && !isForm) return |
|
|
|
|
|
|
|
isNew |
|
|
|
|
|
|
|
? unlinkRow(refRow, Number.parseInt(id)) |
|
|
|
|
|
|
|
: isChildrenListLinked[Number.parseInt(id)] |
|
|
|
|
|
|
|
? unlinkRow(refRow, Number.parseInt(id)) |
|
|
|
|
|
|
|
: linkRow(refRow, Number.parseInt(id)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
" |
|
|
|
/> |
|
|
|
/> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div |
|
|
|
</template> |
|
|
|
v-else |
|
|
|
<div v-else class="pt-1 flex flex-col gap-3 my-auto items-center justify-center text-gray-500"> |
|
|
|
:class="{ |
|
|
|
|
|
|
|
'h-[420px]': !isForm, |
|
|
|
|
|
|
|
'h-[250px]': isForm, |
|
|
|
|
|
|
|
}" |
|
|
|
|
|
|
|
class="pt-1 flex flex-col gap-3 items-center justify-center text-gray-500" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<InboxIcon class="w-16 h-16 mx-auto" /> |
|
|
|
<InboxIcon class="w-16 h-16 mx-auto" /> |
|
|
|
<p> |
|
|
|
<p> |
|
|
|
{{ $t('msg.noRecordsAreLinkedFromTable') }} |
|
|
|
{{ $t('msg.noRecordsAreLinkedFromTable') }} |
|
|
@ -276,18 +278,22 @@ const linkOrUnLink = (rowRef: Record<string, string>, id: string) => { |
|
|
|
<div class="flex items-center gap-1"><MdiPlus /> {{ $t('title.linkMoreRecords') }}</div> |
|
|
|
<div class="flex items-center gap-1"><MdiPlus /> {{ $t('title.linkMoreRecords') }}</div> |
|
|
|
</NcButton> |
|
|
|
</NcButton> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="my-2 bg-gray-50 border-gray-50 border-b-2"></div> |
|
|
|
<div class="my-2 bg-gray-50 border-gray-50 border-b-2"></div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="flex flex-row justify-between bg-white relative pt-1"> |
|
|
|
<div class="flex flex-row justify-between bg-white relative pt-1"> |
|
|
|
<div v-if="!isForm" class="flex items-center justify-center px-2 rounded-md text-gray-500 bg-brand-50"> |
|
|
|
<div v-if="!isForm" class="flex items-center justify-center px-2 rounded-md text-gray-500 bg-brand-50"> |
|
|
|
{{ childrenListCount || 0 }} {{ $t('objects.records') }} {{ childrenListCount !== 0 ? $t('general.are') : '' }} |
|
|
|
{{ childrenListCount || 0 }} {{ !isMobileMode ? $t('objects.records') : '' }} |
|
|
|
|
|
|
|
{{ !isMobileMode && childrenListCount !== 0 ? $t('general.are') : '' }} |
|
|
|
{{ $t('general.linked') }} |
|
|
|
{{ $t('general.linked') }} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div v-else class="flex items-center justify-center px-2 rounded-md text-gray-500 bg-brand-50"> |
|
|
|
<div v-else class="flex items-center justify-center px-2 rounded-md text-gray-500 bg-brand-50"> |
|
|
|
|
|
|
|
<span class=""> |
|
|
|
{{ state?.[colTitle]?.length || 0 }} {{ $t('objects.records') }} |
|
|
|
{{ state?.[colTitle]?.length || 0 }} {{ $t('objects.records') }} |
|
|
|
{{ state?.[colTitle]?.length !== 0 ? $t('general.are') : '' }} |
|
|
|
{{ state?.[colTitle]?.length !== 0 ? $t('general.are') : '' }} |
|
|
|
{{ $t('general.linked') }} |
|
|
|
{{ $t('general.linked') }} |
|
|
|
|
|
|
|
</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="flex absolute items-center py-2 justify-center w-full"> |
|
|
|
<div class="flex absolute items-center py-2 justify-center w-full"> |
|
|
|
<a-pagination |
|
|
|
<a-pagination |
|
|
@ -310,7 +316,9 @@ const linkOrUnLink = (rowRef: Record<string, string>, id: string) => { |
|
|
|
data-testid="nc-child-list-button-link-to" |
|
|
|
data-testid="nc-child-list-button-link-to" |
|
|
|
@click="emit('attachRecord')" |
|
|
|
@click="emit('attachRecord')" |
|
|
|
> |
|
|
|
> |
|
|
|
<div class="flex items-center gap-1"><MdiPlus /> {{ $t('title.linkMoreRecords') }}</div> |
|
|
|
<div class="flex items-center gap-1"> |
|
|
|
|
|
|
|
<MdiPlus class="!xs:hidden" /> {{ isMobileMode ? 'Link More' : $t('title.linkMoreRecords') }} |
|
|
|
|
|
|
|
</div> |
|
|
|
</NcButton> |
|
|
|
</NcButton> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -333,11 +341,21 @@ const linkOrUnLink = (rowRef: Record<string, string>, id: string) => { |
|
|
|
use-meta-fields |
|
|
|
use-meta-fields |
|
|
|
/> |
|
|
|
/> |
|
|
|
</Suspense> |
|
|
|
</Suspense> |
|
|
|
</a-modal> |
|
|
|
</NcModal> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss"> |
|
|
|
<style scoped lang="scss"> |
|
|
|
:deep(.nc-nested-list-item .ant-card-body) { |
|
|
|
:deep(.nc-nested-list-item .ant-card-body) { |
|
|
|
@apply !px-1 !py-0; |
|
|
|
@apply !px-1 !py-0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:deep(.ant-modal-content) { |
|
|
|
|
|
|
|
@apply !p-0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
</style> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss"> |
|
|
|
|
|
|
|
.nc-modal-child-list > .ant-modal > .ant-modal-content { |
|
|
|
|
|
|
|
@apply !p-0; |
|
|
|
|
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |
|
|
|