|
|
|
@ -6,7 +6,6 @@ import {
|
|
|
|
|
CellValueInj, |
|
|
|
|
ColumnInj, |
|
|
|
|
MetaInj, |
|
|
|
|
ReadonlyInj, |
|
|
|
|
computed, |
|
|
|
|
inject, |
|
|
|
|
isAttachment, |
|
|
|
@ -19,8 +18,6 @@ import {
|
|
|
|
|
|
|
|
|
|
const { metas, getMeta } = useMetas() |
|
|
|
|
|
|
|
|
|
provide(ReadonlyInj, ref(true)) |
|
|
|
|
|
|
|
|
|
const column = inject(ColumnInj, ref()) |
|
|
|
|
|
|
|
|
|
const meta = inject(MetaInj, ref()) |
|
|
|
@ -29,7 +26,7 @@ const cellValue = inject(CellValueInj, ref())
|
|
|
|
|
|
|
|
|
|
const relationColumn = computed( |
|
|
|
|
() => |
|
|
|
|
meta.value?.columns?.find((c) => c.id === (column.value?.colOptions as LookupType)?.fk_relation_column_id) as |
|
|
|
|
meta.value?.columns?.find((c: ColumnType) => c.id === (column.value?.colOptions as LookupType)?.fk_relation_column_id) as |
|
|
|
|
| (ColumnType & { |
|
|
|
|
colOptions: LinkToAnotherRecordType | undefined |
|
|
|
|
}) |
|
|
|
@ -38,7 +35,7 @@ const relationColumn = computed(
|
|
|
|
|
|
|
|
|
|
watch( |
|
|
|
|
relationColumn, |
|
|
|
|
async (relationCol) => { |
|
|
|
|
async (relationCol: { colOptions: LinkToAnotherRecordType }) => { |
|
|
|
|
if (relationCol && relationCol.colOptions) await getMeta(relationCol.colOptions.fk_related_model_id!) |
|
|
|
|
}, |
|
|
|
|
{ immediate: true }, |
|
|
|
@ -94,28 +91,46 @@ const { showEditNonEditableFieldWarning, showClearNonEditableFieldWarning, activ
|
|
|
|
|
:edit-enabled="false" |
|
|
|
|
:model-value="v" |
|
|
|
|
:column="lookupColumn" |
|
|
|
|
:read-only="true" |
|
|
|
|
/> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<LazySmartsheetVirtualCell v-else :edit-enabled="false" :model-value="arrValue" :column="lookupColumn" /> |
|
|
|
|
<LazySmartsheetVirtualCell |
|
|
|
|
v-else |
|
|
|
|
:edit-enabled="false" |
|
|
|
|
:read-only="true" |
|
|
|
|
:model-value="arrValue" |
|
|
|
|
:column="lookupColumn" |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<!-- Render normal cell --> |
|
|
|
|
<template v-else> |
|
|
|
|
<!-- For attachment cell avoid adding chip style --> |
|
|
|
|
<div |
|
|
|
|
v-for="(v, i) of arrValue" |
|
|
|
|
:key="i" |
|
|
|
|
class="min-w-max" |
|
|
|
|
:class="{ |
|
|
|
|
'bg-gray-100 px-1 rounded-full flex-1': !isAttachment(lookupColumn), |
|
|
|
|
' border-gray-200 rounded border-1': ![UITypes.Attachment, UITypes.MultiSelect, UITypes.SingleSelect].includes( |
|
|
|
|
lookupColumn.uidt, |
|
|
|
|
), |
|
|
|
|
}" |
|
|
|
|
> |
|
|
|
|
<LazySmartsheetCell :model-value="v" :column="lookupColumn" :edit-enabled="false" :virtual="true" /> |
|
|
|
|
<div v-if="isAttachment(lookupColumn) && arrValue[0] && !Array.isArray(arrValue[0]) && typeof arrValue[0] === 'object'"> |
|
|
|
|
<LazySmartsheetCell :model-value="arrValue" :column="lookupColumn" :edit-enabled="false" :read-only="true" /> |
|
|
|
|
</div> |
|
|
|
|
<!-- For attachment cell avoid adding chip style --> |
|
|
|
|
<template v-else> |
|
|
|
|
<div |
|
|
|
|
v-for="(v, i) of arrValue" |
|
|
|
|
:key="i" |
|
|
|
|
class="min-w-max" |
|
|
|
|
:class="{ |
|
|
|
|
'bg-gray-100 px-1 rounded-full flex-1': !isAttachment(lookupColumn), |
|
|
|
|
'border-gray-200 rounded border-1': ![UITypes.Attachment, UITypes.MultiSelect, UITypes.SingleSelect].includes( |
|
|
|
|
lookupColumn.uidt, |
|
|
|
|
), |
|
|
|
|
}" |
|
|
|
|
> |
|
|
|
|
<LazySmartsheetCell |
|
|
|
|
:model-value="v" |
|
|
|
|
:column="lookupColumn" |
|
|
|
|
:edit-enabled="false" |
|
|
|
|
:virtual="true" |
|
|
|
|
:read-only="true" |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</template> |
|
|
|
|
</template> |
|
|
|
|
</div> |
|
|
|
|