Browse Source

fix(nc-gui): list child items shortcut

pull/7624/head
DarkPhoenix2704 10 months ago
parent
commit
1b88804507
  1. 29
      packages/nc-gui/components/virtual-cell/components/ListChildItems.vue
  2. 26
      packages/nc-gui/components/virtual-cell/components/ListItems.vue

29
packages/nc-gui/components/virtual-cell/components/ListChildItems.vue

@ -1,22 +1,20 @@
<script lang="ts" setup>
import { type ColumnType, isLinksOrLTAR, isSystemColumn } from 'nocodb-sdk'
import { type Row } from '#imports'
import InboxIcon from '~icons/nc-icons/inbox'
import {
ColumnInj,
IsFormInj,
IsPublicInj,
ReadonlyInj,
type Row,
computed,
inject,
isPrimary,
onKeyStroke,
ref,
useLTARStoreOrThrow,
useSmartsheetRowStoreOrThrow,
useVModel,
} from '#imports'
import InboxIcon from '~icons/nc-icons/inbox'
interface Prop {
modelValue?: boolean
@ -129,10 +127,6 @@ watch(expandedFormDlg, () => {
}
})
onKeyStroke('Escape', () => {
vModel.value = false
})
/*
to render same number of skeleton as the number of cards
displayed
@ -181,6 +175,24 @@ watch([filterQueryRef, isDataExist], () => {
filterQueryRef.value?.focus()
}
})
const linkedShortcuts = (e: KeyboardEvent) => {
if (e.key === 'Escape') {
vModel.value = false
} else if (e.key !== 'Tab' && e.key !== 'Shift' && e.key !== 'Enter' && e.key !== ' ') {
try {
filterQueryRef.value?.focus()
} catch (e) {}
}
}
onMounted(() => {
window.addEventListener('keydown', linkedShortcuts)
})
onUnmounted(() => {
window.removeEventListener('keydown', linkedShortcuts)
})
</script>
<template>
@ -272,6 +284,7 @@ watch([filterQueryRef, isDataExist], () => {
:is-loading="isChildrenListLoading[Number.parseInt(id)]"
@expand="onClick(refRow)"
@keydown.space.prevent="linkOrUnLink(refRow, id)"
@keydown.enter.prevent="() => onClick(refRow, id)"
@click="linkOrUnLink(refRow, id)"
/>
</template>

26
packages/nc-gui/components/virtual-cell/components/ListItems.vue

@ -1,6 +1,6 @@
<script lang="ts" setup>
import { RelationTypes, isLinksOrLTAR, isSystemColumn } from 'nocodb-sdk'
import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk'
import { RelationTypes, isLinksOrLTAR, isSystemColumn } from 'nocodb-sdk'
import InboxIcon from '~icons/nc-icons/inbox'
import {
ColumnInj,
@ -8,7 +8,6 @@ import {
SaveRowInj,
computed,
inject,
onKeyStroke,
ref,
useLTARStoreOrThrow,
useSmartsheetRowStoreOrThrow,
@ -173,10 +172,6 @@ watch(filterQueryRef, () => {
filterQueryRef.value?.focus()
})
onKeyStroke('Escape', () => {
vModel.value = false
})
const onClick = (refRow: any, id: string) => {
if (isSharedBase.value) return
if (isChildrenExcludedListLinked.value[Number.parseInt(id)]) {
@ -221,6 +216,24 @@ const onCreatedRecord = (record: any) => {
message.success(msgVNode)
}
const linkedShortcuts = (e: KeyboardEvent) => {
if (e.key === 'Escape') {
vModel.value = false
} else if (e.key !== 'Tab' && e.key !== 'Shift' && e.key !== 'Enter' && e.key !== ' ') {
try {
filterQueryRef.value?.focus()
} catch (e) {}
}
}
onMounted(() => {
window.addEventListener('keydown', linkedShortcuts)
})
onUnmounted(() => {
window.removeEventListener('keydown', linkedShortcuts)
})
</script>
<template>
@ -329,6 +342,7 @@ const onCreatedRecord = (record: any) => {
}
"
@keydown.space.prevent="() => onClick(refRow, id)"
@keydown.enter.prevent="() => onClick(refRow, id)"
@click="() => onClick(refRow, id)"
/>
</template>

Loading…
Cancel
Save