Browse Source

fix(nc-gui): Fixed shared base editor issue

pull/6622/head
Muhammed Mustafa 1 year ago
parent
commit
4c1eed75a9
  1. 4
      packages/nc-gui/components/virtual-cell/components/ListChildItems.vue
  2. 4
      packages/nc-gui/components/virtual-cell/components/ListItem.vue
  3. 18
      packages/nc-gui/components/virtual-cell/components/ListItems.vue

4
packages/nc-gui/components/virtual-cell/components/ListChildItems.vue

@ -41,6 +41,8 @@ const injectedColumn = inject(ColumnInj, ref())
const readonly = inject(ReadonlyInj, ref(false))
const { isSharedBase } = storeToRefs(useBase())
const {
childrenList,
childrenListCount,
@ -165,6 +167,8 @@ const isDataExist = computed<boolean>(() => {
})
const linkOrUnLink = (rowRef: Record<string, string>, id: string) => {
if (isSharedBase.value) return
if (isPublic.value && !isForm.value) return
if (isNew.value || isChildrenListLinked.value[parseInt(id)]) {
unlinkRow(rowRef, parseInt(id))

4
packages/nc-gui/components/virtual-cell/components/ListItem.vue

@ -38,6 +38,8 @@ const row = useVModel(props, 'row')
const isPublic = inject(IsPublicInj, ref(false))
const readonly = inject(ReadonlyInj, ref(false))
const { getPossibleAttachmentSrc } = useAttachment()
interface Attachment {
@ -151,7 +153,7 @@ const attachments: ComputedRef<Attachment[]> = computed(() => {
</div>
</div>
<NcButton
v-if="!isForm && !isPublic"
v-if="!isForm && !isPublic && !readonly"
v-e="['c:row-expand:open']"
type="text"
size="lg"

18
packages/nc-gui/components/virtual-cell/components/ListItems.vue

@ -25,6 +25,8 @@ const { isMobileMode } = useGlobal()
const injectedColumn = inject(ColumnInj)
const { isSharedBase } = storeToRefs(useBase())
const filterQueryRef = ref()
const { $e } = useNuxtApp()
@ -162,6 +164,15 @@ watch(expandedFormDlg, () => {
onKeyStroke('Escape', () => {
vModel.value = false
})
const onClick = (refRow: any, id: string) => {
if (isSharedBase.value) return
if (isChildrenExcludedListLinked.value[Number.parseInt(id)]) {
unlinkRow(refRow, Number.parseInt(id))
} else {
linkRow(refRow, Number.parseInt(id))
}
}
</script>
<template>
@ -272,12 +283,7 @@ onKeyStroke('Escape', () => {
expandedFormDlg = true
}
"
@click="
() => {
if (isChildrenExcludedListLinked[Number.parseInt(id)]) unlinkRow(refRow, Number.parseInt(id))
else linkRow(refRow, Number.parseInt(id))
}
"
@click="() => onClick(refRow, id)"
/>
</template>
</div>

Loading…
Cancel
Save