Browse Source

fix: overwrite `ColumnInj` in links to behave nested component in the same way as LTAR

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5848/head
Pranav C 1 year ago
parent
commit
0afbcfe2eb
  1. 11
      packages/nc-gui/components/virtual-cell/Link.vue

11
packages/nc-gui/components/virtual-cell/Link.vue

@ -2,7 +2,7 @@
import { computed } from '@vue/reactivity' import { computed } from '@vue/reactivity'
import type { ColumnType } from 'nocodb-sdk' import type { ColumnType } from 'nocodb-sdk'
import type { Ref } from 'vue' import type { Ref } from 'vue'
import { CellValueInj, inject } from '#imports' import { CellValueInj, ColumnInj, inject } from '#imports'
const value = inject(CellValueInj) const value = inject(CellValueInj)
@ -14,6 +14,8 @@ const relColumn = computed(() => {
return meta.value.columns.find((c: ColumnType) => c.id === column.value?.colOptions?.fk_relation_column_id) return meta.value.columns.find((c: ColumnType) => c.id === column.value?.colOptions?.fk_relation_column_id)
}) })
provide(ColumnInj, relColumn)
const cellValue = inject(CellValueInj)! const cellValue = inject(CellValueInj)!
const row = inject(RowInj)! const row = inject(RowInj)!
@ -34,9 +36,9 @@ const childListDlg = ref(false)
const { isUIAllowed } = useUIPermission() const { isUIAllowed } = useUIPermission()
const { state, isNew, removeLTARRef } = useSmartsheetRowStoreOrThrow() const { state, isNew } = useSmartsheetRowStoreOrThrow()
const { relatedTableMeta, loadRelatedTableMeta, relatedTableDisplayValueProp, unlink } = useProvideLTARStore( const { relatedTableMeta, loadRelatedTableMeta, relatedTableDisplayValueProp } = useProvideLTARStore(
relColumn as Ref<Required<ColumnType>>, relColumn as Ref<Required<ColumnType>>,
row, row,
isNew, isNew,
@ -68,8 +70,7 @@ const onAttachRecord = () => {
<template> <template>
<div class="flex w-full items-center"> <div class="flex w-full items-center">
<template v-if="!isForm"> <template v-if="!isForm">
<a @click.stop.prevent="childListDlg = true" class="text-center pl-3 flex-grow block" <a class="text-center pl-3 flex-grow block" :class="{ '!text-gray-300': !value }" @click.stop.prevent="childListDlg = true">
:class="{'!text-gray-300': !value}">
{{ textVal }} {{ textVal }}
</a> </a>

Loading…
Cancel
Save