Browse Source

fix(gui-v2): add missing isSharedBase on LTAR cells

pull/3234/head
Wing-Kam Wong 2 years ago
parent
commit
b4ba3315c9
  1. 7
      packages/nc-gui-v2/components/virtual-cell/BelongsTo.vue
  2. 9
      packages/nc-gui-v2/components/virtual-cell/HasMany.vue
  3. 9
      packages/nc-gui-v2/components/virtual-cell/ManyToMany.vue
  4. 15
      packages/nc-gui-v2/components/virtual-cell/components/ItemChip.vue

7
packages/nc-gui-v2/components/virtual-cell/BelongsTo.vue

@ -11,6 +11,7 @@ import {
defineAsyncComponent,
inject,
ref,
useProject,
useProvideLTARStore,
useSmartsheetRowStoreOrThrow,
} from '#imports'
@ -31,10 +32,12 @@ const row = inject(RowInj)!
const active = inject(ActiveCellInj)!
const readonly = inject(ReadonlyInj, false)
const readOnly = inject(ReadonlyInj, false)
const isLocked = inject(IsLockedInj)
const { isSharedBase } = useProject()
const listItemsDlg = ref(false)
const { state, isNew, removeLTARRef } = useSmartsheetRowStoreOrThrow()
@ -74,7 +77,7 @@ const unlinkRef = async (rec: Record<string, any>) => {
<ItemChip :item="value" :value="value[relatedTablePrimaryValueProp]" @unlink="unlinkRef(value)" />
</template>
</div>
<div v-if="!readonly || !isLocked" class="flex-1 flex justify-end gap-1 min-h-[30px] align-center">
<div v-if="!readOnly && !isLocked && !isSharedBase" class="flex-1 flex justify-end gap-1 min-h-[30px] align-center">
<component
:is="addIcon"
class="text-sm nc-action-icon text-gray-500/50 hover:text-gray-500 select-none group-hover:(text-gray-500) nc-plus"

9
packages/nc-gui-v2/components/virtual-cell/HasMany.vue

@ -13,6 +13,7 @@ import {
defineAsyncComponent,
inject,
ref,
useProject,
useProvideLTARStore,
useSmartsheetRowStoreOrThrow,
} from '#imports'
@ -33,7 +34,7 @@ const reloadTrigger = inject(ReloadViewDataHookInj)!
const isForm = inject(IsFormInj)
const readonly = inject(ReadonlyInj, false)
const readOnly = inject(ReadonlyInj, false)
const isLocked = inject(IsLockedInj)
@ -41,6 +42,8 @@ const listItemsDlg = ref(false)
const childListDlg = ref(false)
const { isSharedBase } = useProject()
const { state, isNew, removeLTARRef } = useSmartsheetRowStoreOrThrow()
const { loadRelatedTableMeta, relatedTablePrimaryValueProp, unlink } = useProvideLTARStore(
column as Ref<Required<ColumnType>>,
@ -91,13 +94,13 @@ const unlinkRef = async (rec: Record<string, any>) => {
</span>
</template>
</div>
<div v-if="!isLocked" class="flex-grow flex justify-end gap-1 min-h-[30px] align-center">
<div v-if="!isLocked && !isSharedBase" class="flex-grow flex justify-end gap-1 min-h-[30px] align-center">
<MdiArrowExpand
class="select-none transform text-sm nc-action-icon text-gray-500/50 hover:text-gray-500 nc-arrow-expand"
@click="childListDlg = true"
/>
<MdiPlus
v-if="!readonly"
v-if="!readOnly"
class="select-none text-sm nc-action-icon text-gray-500/50 hover:text-gray-500 nc-plus"
@click="listItemsDlg = true"
/>

9
packages/nc-gui-v2/components/virtual-cell/ManyToMany.vue

@ -12,6 +12,7 @@ import {
computed,
inject,
ref,
useProject,
useProvideLTARStore,
useSmartsheetRowStoreOrThrow,
} from '#imports'
@ -32,7 +33,7 @@ const reloadTrigger = inject(ReloadViewDataHookInj)!
const isForm = inject(IsFormInj)
const readonly = inject(ReadonlyInj, false)
const readOnly = inject(ReadonlyInj, false)
const isLocked = inject(IsLockedInj)
@ -40,6 +41,8 @@ const listItemsDlg = ref(false)
const childListDlg = ref(false)
const { isSharedBase } = useProject()
const { state, isNew, removeLTARRef } = useSmartsheetRowStoreOrThrow()
const { loadRelatedTableMeta, relatedTablePrimaryValueProp, unlink } = useProvideLTARStore(
column as Ref<Required<ColumnType>>,
@ -91,14 +94,14 @@ const unlinkRef = async (rec: Record<string, any>) => {
</template>
</div>
<div v-if="!isLocked" class="flex-1 flex justify-end gap-1 min-h-[30px] align-center">
<div v-if="!isLocked && !isSharedBase" class="flex-1 flex justify-end gap-1 min-h-[30px] align-center">
<MdiArrowExpand
class="text-sm nc-action-icon text-gray-500/50 hover:text-gray-500 nc-arrow-expand"
@click="childListDlg = true"
/>
<MdiPlus
v-if="!readonly"
v-if="!readOnly"
class="text-sm nc-action-icon text-gray-500/50 hover:text-gray-500 nc-plus"
@click="listItemsDlg = true"
/>

15
packages/nc-gui-v2/components/virtual-cell/components/ItemChip.vue

@ -1,5 +1,14 @@
<script lang="ts" setup>
import { ActiveCellInj, IsFormInj, ReadonlyInj, defineAsyncComponent, inject, ref, useLTARStoreOrThrow } from '#imports'
import {
ActiveCellInj,
IsFormInj,
ReadonlyInj,
defineAsyncComponent,
inject,
ref,
useLTARStoreOrThrow,
useProject,
} from '#imports'
interface Props {
value?: string | number | boolean
@ -14,6 +23,8 @@ const ExpandedForm: any = defineAsyncComponent(() => import('../../smartsheet/ex
const { relatedTableMeta } = useLTARStoreOrThrow()!
const { isSharedBase } = useProject()
const readonly = inject(ReadonlyInj, false)
const active = inject(ActiveCellInj, ref(false))
@ -45,7 +56,7 @@ export default {
<Suspense>
<ExpandedForm
v-if="!readonly && !isLocked && expandedFormDlg"
v-if="!readonly && !isLocked && expandedFormDlg && !isSharedBase"
v-model="expandedFormDlg"
:row="{ row: item }"
:meta="relatedTableMeta"

Loading…
Cancel
Save