Browse Source

fix(nc-gui): if useSElectedCellKeyupListner is not grid cell activeCell then dont prevent handler fn call

pull/9983/head
Ramesh Mane 2 days ago
parent
commit
c41447a4ac
  1. 12
      packages/nc-gui/components/cell/MultiSelect.vue
  2. 12
      packages/nc-gui/components/cell/User.vue
  3. 2
      packages/nc-gui/components/smartsheet/expanded-form/index.vue
  4. 2
      packages/nc-gui/components/tabs/auth/user-management/UsersModal.vue
  5. 11
      packages/nc-gui/composables/useSelectedCellKeyupListener/index.ts

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

@ -235,9 +235,15 @@ useSelectedCellKeyupListener(activeCell, (e) => {
})
// close dropdown list on escape
useSelectedCellKeyupListener(isOpen, (e) => {
if (e.key === 'Escape') isOpen.value = false
})
useSelectedCellKeyupListener(
isOpen,
(e) => {
if (e.key === 'Escape') isOpen.value = false
},
{
isGridCell: false,
},
)
const activeOptCreateInProgress = ref(0)

12
packages/nc-gui/components/cell/User.vue

@ -247,9 +247,15 @@ useSelectedCellKeyupListener(activeCell, (e) => {
})
// close dropdown list on escape
useSelectedCellKeyupListener(isOpen, (e) => {
if (e.key === 'Escape') isOpen.value = false
})
useSelectedCellKeyupListener(
isOpen,
(e) => {
if (e.key === 'Escape') isOpen.value = false
},
{
isGridCell: false,
},
)
const search = () => {
searchVal.value = aselect.value?.$el?.querySelector('.ant-select-selection-search-input')?.value

2
packages/nc-gui/components/smartsheet/expanded-form/index.vue

@ -502,7 +502,7 @@ useActiveKeyupListener(
}
}
},
{ immediate: true },
{ immediate: true, isGridCell: false },
)
const showDeleteRowModal = ref(false)

2
packages/nc-gui/components/tabs/auth/user-management/UsersModal.vue

@ -120,7 +120,7 @@ useActiveKeyupListener(
close()
}
},
{ immediate: true },
{ immediate: true, isGridCell: false },
)
watch(

11
packages/nc-gui/composables/useSelectedCellKeyupListener/index.ts

@ -4,10 +4,17 @@ import type { ComputedRef, Ref } from 'vue'
function useSelectedCellKeyupListener(
selected: Ref<boolean | undefined> | ComputedRef<boolean | undefined>,
handler: (e: KeyboardEvent) => void,
{ immediate = false }: { immediate?: boolean } = {},
{ immediate = false, isGridCell = true }: { immediate?: boolean; isGridCell?: boolean } = {},
) {
const finalHandler = (e: KeyboardEvent) => {
if (cmdKActive() || isExpandedFormOpenExist() || isExpandedCellInputExist() || isFieldEditOrAddDropdownOpen()) return
if (cmdKActive()) return
/**
* If `useSelectedCellKeyupListener` used for grid cell and active element is not in grid then prevent
*/
if (isGridCell && (isExpandedFormOpenExist() || isExpandedCellInputExist() || isFieldEditOrAddDropdownOpen())) {
return
}
// TODO: Check if their is any active element which is outside grid then return
handler(e)
}

Loading…
Cancel
Save