Browse Source

fix(nc-gui): Fixed issue with lookup when combined with links

pull/6582/head
Muhammed Mustafa 11 months ago
parent
commit
37ab1c3ee1
  1. 4
      packages/nc-gui/components/smartsheet/VirtualCell.vue
  2. 17
      packages/nc-gui/components/virtual-cell/Links.vue

4
packages/nc-gui/components/smartsheet/VirtualCell.vue

@ -51,6 +51,8 @@ const isForm = inject(IsFormInj, ref(false))
const isExpandedForm = inject(IsExpandedFormOpenInj, ref(false))
const isUnderLookup = inject(IsUnderLookupInj, ref(false))
function onNavigate(dir: NavigateDir, e: KeyboardEvent) {
emit('navigate', dir)
@ -99,7 +101,7 @@ onUnmounted(() => {
@keydown.shift.enter.exact="onNavigate(NavigateDir.PREV, $event)"
>
<template v-if="intersected">
<LazyVirtualCellLinks v-if="isLink(column)" />
<LazyVirtualCellLinks v-if="isLink(column)" :readonly="isUnderLookup" />
<LazyVirtualCellHasMany v-else-if="isHm(column)" />
<LazyVirtualCellManyToMany v-else-if="isMm(column)" />
<LazyVirtualCellBelongsTo v-else-if="isBt(column)" />

17
packages/nc-gui/components/virtual-cell/Links.vue

@ -5,6 +5,10 @@ import { ref } from 'vue'
import type { Ref } from 'vue'
import { ActiveCellInj, CellValueInj, ColumnInj, IsUnderLookupInj, inject, useSelectedCellKeyupListener } from '#imports'
const props = defineProps<{
readonly: boolean
}>()
const value = inject(CellValueInj, ref(0))
const column = inject(ColumnInj)!
@ -15,7 +19,9 @@ const reloadRowTrigger = inject(ReloadRowDataHookInj, createEventHook())
const isForm = inject(IsFormInj)
const readOnly = inject(ReadonlyInj, ref(false))
const _readOnly = inject(ReadonlyInj, ref(false))
const readOnly = computed(() => props.readonly || _readOnly.value)
const isLocked = inject(IsLockedInj, ref(false))
@ -77,6 +83,8 @@ const onAttachRecord = () => {
}
const openChildList = () => {
if (readOnly.value) return
if (!isLocked.value) {
childListDlg.value = true
}
@ -98,6 +106,11 @@ const localCellValue = computed<any[]>(() => {
}
return []
})
const openListDlg = () => {
if (readOnly.value) return
listItemsDlg.value = true
}
</script>
<template>
@ -120,7 +133,7 @@ const localCellValue = computed<any[]>(() => {
<MdiPlus
v-if="(!readOnly && isUIAllowed('dataEdit')) || isForm"
class="select-none !text-md text-gray-700 nc-action-icon nc-plus"
@click.stop="listItemsDlg = true"
@click.stop="openListDlg"
/>
</div>

Loading…
Cancel
Save