Browse Source

fix(api): block delete key press action for input fields at cell level

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4222/head
Pranav C 2 years ago
parent
commit
f8e52e39e0
  1. 1
      packages/nc-gui/components/cell/Currency.vue
  2. 1
      packages/nc-gui/components/cell/Decimal.vue
  3. 1
      packages/nc-gui/components/cell/Duration.vue
  4. 1
      packages/nc-gui/components/cell/Email.vue
  5. 1
      packages/nc-gui/components/cell/Float.vue
  6. 1
      packages/nc-gui/components/cell/Integer.vue
  7. 1
      packages/nc-gui/components/cell/Percent.vue
  8. 1
      packages/nc-gui/components/cell/Text.vue
  9. 1
      packages/nc-gui/components/cell/TextArea.vue
  10. 1
      packages/nc-gui/components/cell/Url.vue
  11. 2
      packages/nc-gui/components/virtual-cell/components/ListItems.vue
  12. 8
      packages/nc-gui/composables/useMultiSelect/index.ts

1
packages/nc-gui/components/cell/Currency.vue

@ -65,6 +65,7 @@ onMounted(() => {
@keydown.left.stop
@keydown.right.stop
@keydown.up.stop
@keydown.delete.stop
/>
<span v-else-if="vModel">{{ currency }}</span>

1
packages/nc-gui/components/cell/Decimal.vue

@ -34,6 +34,7 @@ const focus: VNodeRef = (el) => (el as HTMLInputElement)?.focus()
@keydown.left.stop
@keydown.right.stop
@keydown.up.stop
@keydown.delete.stop
/>
<span v-else class="text-sm">{{ vModel }}</span>
</template>

1
packages/nc-gui/components/cell/Duration.vue

@ -88,6 +88,7 @@ const focus: VNodeRef = (el) => (el as HTMLInputElement)?.focus()
@keydown.left.stop
@keydown.right.stop
@keydown.up.stop
@keydown.delete.stop
/>
<span v-else> {{ localState }}</span>

1
packages/nc-gui/components/cell/Email.vue

@ -34,6 +34,7 @@ const focus: VNodeRef = (el) => (el as HTMLInputElement)?.focus()
@keydown.left.stop
@keydown.right.stop
@keydown.up.stop
@keydown.delete.stop
/>
<a v-else-if="validEmail" class="text-sm underline hover:opacity-75" :href="`mailto:${vModel}`" target="_blank">

1
packages/nc-gui/components/cell/Float.vue

@ -34,6 +34,7 @@ const focus: VNodeRef = (el) => (el as HTMLInputElement)?.focus()
@keydown.left.stop
@keydown.right.stop
@keydown.up.stop
@keydown.delete.stop
/>
<span v-else class="text-sm">{{ vModel }}</span>
</template>

1
packages/nc-gui/components/cell/Integer.vue

@ -38,6 +38,7 @@ function onKeyDown(evt: KeyboardEvent) {
@keydown.left.stop
@keydown.right.stop
@keydown.up.stop
@keydown.delete.stop
/>
<span v-else class="text-sm">{{ vModel }}</span>
</template>

1
packages/nc-gui/components/cell/Percent.vue

@ -25,6 +25,7 @@ const vModel = useVModel(props, 'modelValue', emits)
@keydown.left.stop
@keydown.right.stop
@keydown.up.stop
@keydown.delete.stop
/>
<span v-else>{{ vModel }}</span>
</template>

1
packages/nc-gui/components/cell/Text.vue

@ -31,6 +31,7 @@ const focus: VNodeRef = (el) => (el as HTMLInputElement)?.focus()
@keydown.left.stop
@keydown.right.stop
@keydown.up.stop
@keydown.delete.stop
/>
<span v-else>{{ vModel }}</span>

1
packages/nc-gui/components/cell/TextArea.vue

@ -30,6 +30,7 @@ const focus: VNodeRef = (el) => (el as HTMLTextAreaElement)?.focus()
@keydown.left.stop
@keydown.right.stop
@keydown.up.stop
@keydown.delete.stop
/>
<span v-else>{{ vModel }}</span>

1
packages/nc-gui/components/cell/Url.vue

@ -83,6 +83,7 @@ watch(
@keydown.left.stop
@keydown.right.stop
@keydown.up.stop
@keydown.delete.stop
/>
<nuxt-link

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

@ -1,6 +1,6 @@
<script lang="ts" setup>
import { onUnmounted } from '@vue/runtime-core'
import { Card } from 'ant-design-vue'
import type { Card } from 'ant-design-vue'
import { RelationTypes, UITypes } from 'nocodb-sdk'
import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk'
import {

8
packages/nc-gui/composables/useMultiSelect/index.ts

@ -176,11 +176,9 @@ export function useMultiSelect(
break
/** on delete key press clear cell */
case 'Delete':
if (!unref(editEnabled)) {
e.preventDefault()
clearRangeRows()
await clearCell(selected as { row: number; col: number })
}
e.preventDefault()
clearRangeRows()
await clearCell(selected as { row: number; col: number })
break
/** on arrow key press navigate through cells */
case 'ArrowRight':

Loading…
Cancel
Save