Browse Source

Revert "Revert "fix: add event handler based activeCell status""

This reverts commit 9f53f98027.
pull/5977/head
Raju Udava 2 years ago
parent
commit
7e8601847c
  1. 6
      packages/nc-gui/components/cell/MultiSelect.vue
  2. 6
      packages/nc-gui/components/cell/SingleSelect.vue

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

@ -48,11 +48,11 @@ const readOnly = inject(ReadonlyInj)!
const isEditable = inject(EditModeInj, ref(false)) const isEditable = inject(EditModeInj, ref(false))
const _active = inject(ActiveCellInj, ref(false)) const activeCell = inject(ActiveCellInj, ref(false))
// use both ActiveCellInj or EditModeInj to determine the active state // use both ActiveCellInj or EditModeInj to determine the active state
// since active will be false in case of form view // since active will be false in case of form view
const active = computed(() => _active.value || isEditable.value) const active = computed(() => activeCell.value || isEditable.value)
const isPublic = inject(IsPublicInj, ref(false)) const isPublic = inject(IsPublicInj, ref(false))
@ -180,7 +180,7 @@ watch(isOpen, (n, _o) => {
} }
}) })
useSelectedCellKeyupListener(active, (e) => { useSelectedCellKeyupListener(activeCell, (e) => {
switch (e.key) { switch (e.key) {
case 'Escape': case 'Escape':
isOpen.value = false isOpen.value = false

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

@ -42,11 +42,11 @@ const readOnly = inject(ReadonlyInj)!
const isEditable = inject(EditModeInj, ref(false)) const isEditable = inject(EditModeInj, ref(false))
const _active = inject(ActiveCellInj, ref(false)) const activeCell = inject(ActiveCellInj, ref(false))
// use both ActiveCellInj or EditModeInj to determine the active state // use both ActiveCellInj or EditModeInj to determine the active state
// since active will be false in case of form view // since active will be false in case of form view
const active = computed(() => _active.value || isEditable.value) const active = computed(() => activeCell.value || isEditable.value)
const aselect = ref<typeof AntSelect>() const aselect = ref<typeof AntSelect>()
@ -119,7 +119,7 @@ watch(isOpen, (n, _o) => {
} }
}) })
useSelectedCellKeyupListener(active, (e) => { useSelectedCellKeyupListener(activeCell, (e) => {
switch (e.key) { switch (e.key) {
case 'Escape': case 'Escape':
isOpen.value = false isOpen.value = false

Loading…
Cancel
Save