Browse Source

fix(gui-v2): add editEnabled for select cells

pull/3087/head
Wing-Kam Wong 2 years ago
parent
commit
d003b39e00
  1. 6
      packages/nc-gui-v2/components/cell/MultiSelect.vue
  2. 6
      packages/nc-gui-v2/components/cell/SingleSelect.vue

6
packages/nc-gui-v2/components/cell/MultiSelect.vue

@ -1,7 +1,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { Select as AntSelect } from 'ant-design-vue' import type { Select as AntSelect } from 'ant-design-vue'
import type { SelectOptionType } from 'nocodb-sdk' import type { SelectOptionType } from 'nocodb-sdk'
import { ActiveCellInj, ColumnInj, computed, inject } from '#imports' import { ActiveCellInj, ColumnInj, ReadonlyInj, computed, inject } from '#imports'
import MdiCloseCircle from '~icons/mdi/close-circle' import MdiCloseCircle from '~icons/mdi/close-circle'
interface Props { interface Props {
@ -18,8 +18,7 @@ const column = inject(ColumnInj)
// const isForm = inject<boolean>('isForm', false) // const isForm = inject<boolean>('isForm', false)
// FIXME: use editEnabled to control the UI permission const editEnabled = inject(ReadonlyInj)
// const editEnabled = inject(ReadonlyInj)
const active = inject(ActiveCellInj, ref(false)) const active = inject(ActiveCellInj, ref(false))
@ -117,6 +116,7 @@ watch(isOpen, (n, _o) => {
show-arrow show-arrow
:show-search="false" :show-search="false"
:open="isOpen" :open="isOpen"
:disabled="!editEnabled"
@keydown="handleKeys" @keydown="handleKeys"
@click="isOpen = !isOpen" @click="isOpen = !isOpen"
> >

6
packages/nc-gui-v2/components/cell/SingleSelect.vue

@ -1,7 +1,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { Select as AntSelect } from 'ant-design-vue' import type { Select as AntSelect } from 'ant-design-vue'
import type { SelectOptionType } from 'nocodb-sdk' import type { SelectOptionType } from 'nocodb-sdk'
import { ActiveCellInj, ColumnInj, computed, inject } from '#imports' import { ActiveCellInj, ColumnInj, ReadonlyInj, computed, inject } from '#imports'
interface Props { interface Props {
modelValue: string | undefined modelValue: string | undefined
@ -15,8 +15,7 @@ const column = inject(ColumnInj)
// const isForm = inject<boolean>('isForm', false) // const isForm = inject<boolean>('isForm', false)
// FIXME: use editEnabled to control the UI permission const editEnabled = inject(ReadonlyInj)
// const editEnabled = inject(ReadonlyInj)
const active = inject(ActiveCellInj, ref(false)) const active = inject(ActiveCellInj, ref(false))
@ -76,6 +75,7 @@ watch(isOpen, (n, _o) => {
placeholder="Select an option" placeholder="Select an option"
:bordered="false" :bordered="false"
:open="isOpen" :open="isOpen"
:disabled="!editEnabled"
@select="isOpen = false" @select="isOpen = false"
@keydown="handleKeys" @keydown="handleKeys"
@click="isOpen = !isOpen" @click="isOpen = !isOpen"

Loading…
Cancel
Save