Browse Source

feat(nc-gui): pass belongsToColumn to ItemChip & ListItems

pull/5724/head
Wing-Kam Wong 2 years ago
parent
commit
6ce3ee312f
  1. 16
      packages/nc-gui/components/virtual-cell/BelongsTo.vue

16
packages/nc-gui/components/virtual-cell/BelongsTo.vue

@ -42,7 +42,7 @@ const listItemsDlg = ref(false)
const { state, isNew, removeLTARRef } = useSmartsheetRowStoreOrThrow()
const { loadRelatedTableMeta, relatedTableDisplayValueProp, unlink } = useProvideLTARStore(
const { relatedTableMeta, loadRelatedTableMeta, relatedTableDisplayValueProp, unlink } = useProvideLTARStore(
column as Ref<Required<ColumnType>>,
row,
isNew,
@ -78,13 +78,23 @@ useSelectedCellKeyupListener(active, (e: KeyboardEvent) => {
break
}
})
const belongsToColumn = computed(
() =>
relatedTableMeta.value?.columns?.find((c: any) => c.title === relatedTableDisplayValueProp.value) as ColumnType | undefined,
)
</script>
<template>
<div class="flex w-full chips-wrapper items-center" :class="{ active }">
<div class="chips flex items-center flex-1">
<template v-if="value && relatedTableDisplayValueProp">
<VirtualCellComponentsItemChip :item="value" :value="value[relatedTableDisplayValueProp]" @unlink="unlinkRef(value)" />
<VirtualCellComponentsItemChip
:item="value"
:value="value[relatedTableDisplayValueProp]"
:column="belongsToColumn"
@unlink="unlinkRef(value)"
/>
</template>
</div>
@ -99,7 +109,7 @@ useSelectedCellKeyupListener(active, (e: KeyboardEvent) => {
/>
</div>
<LazyVirtualCellComponentsListItems v-model="listItemsDlg" @attach-record="listItemsDlg = true" />
<LazyVirtualCellComponentsListItems v-model="listItemsDlg" :column="belongsToColumn" @attach-record="listItemsDlg = true" />
</div>
</template>

Loading…
Cancel
Save