Browse Source

fix(gui-v2): use isUIAllowed('xcDatatableEditable') instead of isSharedBase

pull/3234/head
Wing-Kam Wong 2 years ago
parent
commit
49a488494c
  1. 10
      packages/nc-gui-v2/components/virtual-cell/BelongsTo.vue
  2. 10
      packages/nc-gui-v2/components/virtual-cell/HasMany.vue
  3. 6
      packages/nc-gui-v2/components/virtual-cell/ManyToMany.vue
  4. 10
      packages/nc-gui-v2/components/virtual-cell/components/ItemChip.vue

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

@ -11,9 +11,9 @@ import {
defineAsyncComponent, defineAsyncComponent,
inject, inject,
ref, ref,
useProject,
useProvideLTARStore, useProvideLTARStore,
useSmartsheetRowStoreOrThrow, useSmartsheetRowStoreOrThrow,
useUIPermission,
} from '#imports' } from '#imports'
import MdiArrowExpand from '~icons/mdi/arrow-expand' import MdiArrowExpand from '~icons/mdi/arrow-expand'
import MdiPlus from '~icons/mdi/plus' import MdiPlus from '~icons/mdi/plus'
@ -36,11 +36,12 @@ const readOnly = inject(ReadonlyInj, false)
const isLocked = inject(IsLockedInj) const isLocked = inject(IsLockedInj)
const { isSharedBase } = useProject() const { isUIAllowed } = useUIPermission()
const listItemsDlg = ref(false) const listItemsDlg = ref(false)
const { state, isNew, removeLTARRef } = useSmartsheetRowStoreOrThrow() const { state, isNew, removeLTARRef } = useSmartsheetRowStoreOrThrow()
const { loadRelatedTableMeta, relatedTablePrimaryValueProp, unlink } = useProvideLTARStore( const { loadRelatedTableMeta, relatedTablePrimaryValueProp, unlink } = useProvideLTARStore(
column as Ref<Required<ColumnType>>, column as Ref<Required<ColumnType>>,
row, row,
@ -77,7 +78,10 @@ const unlinkRef = async (rec: Record<string, any>) => {
<ItemChip :item="value" :value="value[relatedTablePrimaryValueProp]" @unlink="unlinkRef(value)" /> <ItemChip :item="value" :value="value[relatedTablePrimaryValueProp]" @unlink="unlinkRef(value)" />
</template> </template>
</div> </div>
<div v-if="!readOnly && !isLocked && !isSharedBase" class="flex-1 flex justify-end gap-1 min-h-[30px] align-center"> <div
v-if="!readOnly && !isLocked && isUIAllowed('xcDatatableEditable')"
class="flex-1 flex justify-end gap-1 min-h-[30px] align-center"
>
<component <component
:is="addIcon" :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" class="text-sm nc-action-icon text-gray-500/50 hover:text-gray-500 select-none group-hover:(text-gray-500) nc-plus"

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

@ -13,9 +13,9 @@ import {
defineAsyncComponent, defineAsyncComponent,
inject, inject,
ref, ref,
useProject,
useProvideLTARStore, useProvideLTARStore,
useSmartsheetRowStoreOrThrow, useSmartsheetRowStoreOrThrow,
useUIPermission,
} from '#imports' } from '#imports'
const ItemChip = defineAsyncComponent(() => import('./components/ItemChip.vue')) const ItemChip = defineAsyncComponent(() => import('./components/ItemChip.vue'))
@ -42,9 +42,10 @@ const listItemsDlg = ref(false)
const childListDlg = ref(false) const childListDlg = ref(false)
const { isSharedBase } = useProject() const { isUIAllowed } = useUIPermission()
const { state, isNew, removeLTARRef } = useSmartsheetRowStoreOrThrow() const { state, isNew, removeLTARRef } = useSmartsheetRowStoreOrThrow()
const { loadRelatedTableMeta, relatedTablePrimaryValueProp, unlink } = useProvideLTARStore( const { loadRelatedTableMeta, relatedTablePrimaryValueProp, unlink } = useProvideLTARStore(
column as Ref<Required<ColumnType>>, column as Ref<Required<ColumnType>>,
row, row,
@ -94,7 +95,10 @@ const unlinkRef = async (rec: Record<string, any>) => {
</span> </span>
</template> </template>
</div> </div>
<div v-if="!isLocked && !isSharedBase" class="flex-grow flex justify-end gap-1 min-h-[30px] align-center"> <div
v-if="!isLocked && isUIAllowed('xcDatatableEditable')"
class="flex-grow flex justify-end gap-1 min-h-[30px] align-center"
>
<MdiArrowExpand <MdiArrowExpand
class="select-none transform text-sm nc-action-icon text-gray-500/50 hover:text-gray-500 nc-arrow-expand" class="select-none transform text-sm nc-action-icon text-gray-500/50 hover:text-gray-500 nc-arrow-expand"
@click="childListDlg = true" @click="childListDlg = true"

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

@ -12,9 +12,9 @@ import {
computed, computed,
inject, inject,
ref, ref,
useProject,
useProvideLTARStore, useProvideLTARStore,
useSmartsheetRowStoreOrThrow, useSmartsheetRowStoreOrThrow,
useUIPermission,
} from '#imports' } from '#imports'
const ItemChip = defineAsyncComponent(() => import('./components/ItemChip.vue')) const ItemChip = defineAsyncComponent(() => import('./components/ItemChip.vue'))
@ -41,7 +41,7 @@ const listItemsDlg = ref(false)
const childListDlg = ref(false) const childListDlg = ref(false)
const { isSharedBase } = useProject() const { isUIAllowed } = useUIPermission()
const { state, isNew, removeLTARRef } = useSmartsheetRowStoreOrThrow() const { state, isNew, removeLTARRef } = useSmartsheetRowStoreOrThrow()
const { loadRelatedTableMeta, relatedTablePrimaryValueProp, unlink } = useProvideLTARStore( const { loadRelatedTableMeta, relatedTablePrimaryValueProp, unlink } = useProvideLTARStore(
@ -94,7 +94,7 @@ const unlinkRef = async (rec: Record<string, any>) => {
</template> </template>
</div> </div>
<div v-if="!isLocked && !isSharedBase" class="flex-1 flex justify-end gap-1 min-h-[30px] align-center"> <div v-if="!isLocked && isUIAllowed('xcDatatableEditable')" class="flex-1 flex justify-end gap-1 min-h-[30px] align-center">
<MdiArrowExpand <MdiArrowExpand
class="text-sm nc-action-icon text-gray-500/50 hover:text-gray-500 nc-arrow-expand" class="text-sm nc-action-icon text-gray-500/50 hover:text-gray-500 nc-arrow-expand"
@click="childListDlg = true" @click="childListDlg = true"

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

@ -7,7 +7,7 @@ import {
inject, inject,
ref, ref,
useLTARStoreOrThrow, useLTARStoreOrThrow,
useProject, useUIPermission,
} from '#imports' } from '#imports'
interface Props { interface Props {
@ -23,9 +23,9 @@ const ExpandedForm: any = defineAsyncComponent(() => import('../../smartsheet/ex
const { relatedTableMeta } = useLTARStoreOrThrow()! const { relatedTableMeta } = useLTARStoreOrThrow()!
const { isSharedBase } = useProject() const { isUIAllowed } = useUIPermission()
const readonly = inject(ReadonlyInj, false) const readOnly = inject(ReadonlyInj, false)
const active = inject(ActiveCellInj, ref(false)) const active = inject(ActiveCellInj, ref(false))
@ -50,13 +50,13 @@ export default {
> >
<span class="name">{{ value }}</span> <span class="name">{{ value }}</span>
<div v-show="active || isForm" v-if="!readonly && !isLocked" class="flex align-center"> <div v-show="active || isForm" v-if="!readOnly && !isLocked && isUIAllowed('xcDatatableEditable')" class="flex align-center">
<MdiCloseThick class="unlink-icon text-xs text-gray-500/50 group-hover:text-gray-500" @click.stop="emit('unlink')" /> <MdiCloseThick class="unlink-icon text-xs text-gray-500/50 group-hover:text-gray-500" @click.stop="emit('unlink')" />
</div> </div>
<Suspense> <Suspense>
<ExpandedForm <ExpandedForm
v-if="!readonly && !isLocked && expandedFormDlg && !isSharedBase" v-if="!readOnly && !isLocked && expandedFormDlg"
v-model="expandedFormDlg" v-model="expandedFormDlg"
:row="{ row: item }" :row="{ row: item }"
:meta="relatedTableMeta" :meta="relatedTableMeta"

Loading…
Cancel
Save