Browse Source

fix(gui-v2): select cells use readOnly instead of editEnabled

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/3179/head
mertmit 2 years ago
parent
commit
993d72dfb9
  1. 10
      packages/nc-gui-v2/components/cell/MultiSelect.vue
  2. 10
      packages/nc-gui-v2/components/cell/SingleSelect.vue

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

@ -4,7 +4,7 @@ import type { SelectOptionsType } from 'nocodb-sdk'
import { import {
ActiveCellInj, ActiveCellInj,
ColumnInj, ColumnInj,
EditModeInj, ReadonlyInj,
computed, computed,
h, h,
inject, inject,
@ -28,7 +28,7 @@ const { isMysql } = useProject()
const column = inject(ColumnInj)! const column = inject(ColumnInj)!
const editEnabled = inject(EditModeInj)! const readOnly = inject(ReadonlyInj)!
const active = inject(ActiveCellInj, ref(false)) const active = inject(ActiveCellInj, ref(false))
@ -129,12 +129,12 @@ watch(isOpen, (n, _o) => {
v-model:value="vModel" v-model:value="vModel"
mode="multiple" mode="multiple"
class="w-full" class="w-full"
placeholder="Select an option" :placeholder="!readOnly ? 'Select an option' : ''"
:bordered="false" :bordered="false"
show-arrow :show-arrow="!readOnly"
:show-search="false" :show-search="false"
:open="isOpen" :open="isOpen"
:disabled="!editEnabled" :disabled="readOnly"
@keydown="handleKeys" @keydown="handleKeys"
@click="isOpen = !isOpen" @click="isOpen = !isOpen"
> >

10
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 { SelectOptionsType } from 'nocodb-sdk' import type { SelectOptionsType } from 'nocodb-sdk'
import { ActiveCellInj, ColumnInj, EditModeInj, computed, inject, ref, useEventListener, watch } from '#imports' import { ActiveCellInj, ColumnInj, ReadonlyInj, computed, inject, ref, useEventListener, watch } from '#imports'
interface Props { interface Props {
modelValue?: string | undefined modelValue?: string | undefined
@ -13,7 +13,7 @@ const emit = defineEmits(['update:modelValue'])
const column = inject(ColumnInj)! const column = inject(ColumnInj)!
const editEnabled = inject(EditModeInj)! const readOnly = inject(ReadonlyInj)!
const active = inject(ActiveCellInj, ref(false)) const active = inject(ActiveCellInj, ref(false))
@ -69,11 +69,11 @@ watch(isOpen, (n, _o) => {
v-model:value="vModel" v-model:value="vModel"
class="w-full" class="w-full"
:allow-clear="!column.rqd && active" :allow-clear="!column.rqd && active"
placeholder="Select an option" :placeholder="!readOnly ? 'Select an option' : ''"
:bordered="false" :bordered="false"
:open="isOpen" :open="isOpen"
:disabled="!editEnabled" :disabled="readOnly"
:show-arrow="active || vModel === null" :show-arrow="!readOnly && (active || vModel === null)"
@select="isOpen = false" @select="isOpen = false"
@keydown="handleKeys" @keydown="handleKeys"
@click="isOpen = !isOpen" @click="isOpen = !isOpen"

Loading…
Cancel
Save