|
|
@ -3,8 +3,8 @@ import { Empty, Modal } from 'ant-design-vue' |
|
|
|
import type { ColumnType } from 'nocodb-sdk' |
|
|
|
import type { ColumnType } from 'nocodb-sdk' |
|
|
|
import { |
|
|
|
import { |
|
|
|
ColumnInj, |
|
|
|
ColumnInj, |
|
|
|
EditModeInj, |
|
|
|
|
|
|
|
IsFormInj, |
|
|
|
IsFormInj, |
|
|
|
|
|
|
|
ReadonlyInj, |
|
|
|
computed, |
|
|
|
computed, |
|
|
|
useLTARStoreOrThrow, |
|
|
|
useLTARStoreOrThrow, |
|
|
|
useSmartsheetRowStoreOrThrow, |
|
|
|
useSmartsheetRowStoreOrThrow, |
|
|
@ -24,7 +24,7 @@ const isForm = inject(IsFormInj, ref(false)) |
|
|
|
|
|
|
|
|
|
|
|
const column = inject(ColumnInj) |
|
|
|
const column = inject(ColumnInj) |
|
|
|
|
|
|
|
|
|
|
|
const editEnabled = inject(EditModeInj) |
|
|
|
const readonly = inject(ReadonlyInj, false) |
|
|
|
|
|
|
|
|
|
|
|
const { |
|
|
|
const { |
|
|
|
childrenList, |
|
|
|
childrenList, |
|
|
@ -43,7 +43,7 @@ const { isNew, state, removeLTARRef } = useSmartsheetRowStoreOrThrow() |
|
|
|
watch( |
|
|
|
watch( |
|
|
|
[vModel, isForm], |
|
|
|
[vModel, isForm], |
|
|
|
(nextVal) => { |
|
|
|
(nextVal) => { |
|
|
|
if (nextVal[0] || nextVal[1]) { |
|
|
|
if ((nextVal[0] || nextVal[1]) && !isNew.value) { |
|
|
|
loadChildrenList() |
|
|
|
loadChildrenList() |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
@ -59,6 +59,12 @@ const unlinkRow = async (row: Record<string, any>) => { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const unlinkIfNewRow = async (row: Record<string, any>) => { |
|
|
|
|
|
|
|
if (isNew.value) { |
|
|
|
|
|
|
|
removeLTARRef(row, column?.value as ColumnType) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const container = computed(() => |
|
|
|
const container = computed(() => |
|
|
|
isForm?.value |
|
|
|
isForm?.value |
|
|
|
? h('div', { |
|
|
|
? h('div', { |
|
|
@ -79,7 +85,7 @@ const expandedFormRow = ref() |
|
|
|
|
|
|
|
|
|
|
|
<MdiReload v-if="!isForm" class="cursor-pointer text-gray-500" @click="loadChildrenList" /> |
|
|
|
<MdiReload v-if="!isForm" class="cursor-pointer text-gray-500" @click="loadChildrenList" /> |
|
|
|
|
|
|
|
|
|
|
|
<a-button v-if="editEnabled" type="primary" ghost class="!text-xs" size="small" @click="emit('attachRecord')"> |
|
|
|
<a-button v-if="!readonly" type="primary" ghost class="!text-xs" size="small" @click="emit('attachRecord')"> |
|
|
|
<div class="flex align-center gap-1"> |
|
|
|
<div class="flex align-center gap-1"> |
|
|
|
<MdiLinkVariantRemove class="text-xs" type="primary" @click="unlinkRow(row)" /> |
|
|
|
<MdiLinkVariantRemove class="text-xs" type="primary" @click="unlinkRow(row)" /> |
|
|
|
Link to '{{ meta.title }}' |
|
|
|
Link to '{{ meta.title }}' |
|
|
@ -101,18 +107,19 @@ const expandedFormRow = ref() |
|
|
|
> |
|
|
|
> |
|
|
|
<div class="flex align-center"> |
|
|
|
<div class="flex align-center"> |
|
|
|
<div class="flex-grow overflow-hidden min-w-0"> |
|
|
|
<div class="flex-grow overflow-hidden min-w-0"> |
|
|
|
{{ row[relatedTablePrimaryValueProp] |
|
|
|
{{ row[relatedTablePrimaryValueProp] }} |
|
|
|
}}<span class="text-gray-400 text-[11px] ml-1">(Primary key : {{ getRelatedTableRowId(row) }})</span> |
|
|
|
<span class="text-gray-400 text-[11px] ml-1">(Primary key : {{ getRelatedTableRowId(row) }})</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="flex-1"></div> |
|
|
|
<div class="flex-1"></div> |
|
|
|
<div v-if="editEnabled" class="flex gap-2"> |
|
|
|
<div v-if="!readonly" class="flex gap-2"> |
|
|
|
<MdiLinkVariantRemove |
|
|
|
<MdiLinkVariantRemove |
|
|
|
class="text-xs text-grey hover:(!text-red-500) cursor-pointer" |
|
|
|
class="text-xs text-grey hover:(!text-red-500) cursor-pointer" |
|
|
|
@click.stop="unlinkRow(row)" |
|
|
|
@click.stop="unlinkRow(row)" |
|
|
|
/> |
|
|
|
/> |
|
|
|
<MdiDeleteOutline |
|
|
|
<MdiDeleteOutline |
|
|
|
|
|
|
|
v-if="!readonly" |
|
|
|
class="text-xs text-grey hover:(!text-red-500) cursor-pointer" |
|
|
|
class="text-xs text-grey hover:(!text-red-500) cursor-pointer" |
|
|
|
@click.stop="deleteRelatedRow(row)" |
|
|
|
@click.stop="deleteRelatedRow(row, unlinkIfNewRow)" |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -128,7 +135,12 @@ const expandedFormRow = ref() |
|
|
|
show-less-items |
|
|
|
show-less-items |
|
|
|
/> |
|
|
|
/> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<a-empty v-else class="my-10" :image="Empty.PRESENTED_IMAGE_SIMPLE" /> |
|
|
|
<a-empty |
|
|
|
|
|
|
|
v-else |
|
|
|
|
|
|
|
:class="{ 'my-10': !isForm, 'my-1 !text-xs': isForm }" |
|
|
|
|
|
|
|
:image="Empty.PRESENTED_IMAGE_SIMPLE" |
|
|
|
|
|
|
|
:image-style="isForm ? { height: '20px' } : {}" |
|
|
|
|
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<Suspense> |
|
|
|
<Suspense> |
|
|
|