|
|
@ -1,7 +1,7 @@ |
|
|
|
<script lang="ts" setup> |
|
|
|
<script lang="ts" setup> |
|
|
|
import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk' |
|
|
|
import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk' |
|
|
|
import { RelationTypes, UITypes, isVirtualCol } from 'nocodb-sdk' |
|
|
|
import { RelationTypes, UITypes, isVirtualCol } from 'nocodb-sdk' |
|
|
|
import { SwipeDirection } from '@vueuse/core' |
|
|
|
import { SwipeDirection, breakpointsTailwind } from '@vueuse/core' |
|
|
|
import { |
|
|
|
import { |
|
|
|
DropZoneRef, |
|
|
|
DropZoneRef, |
|
|
|
computed, |
|
|
|
computed, |
|
|
@ -9,7 +9,7 @@ import { |
|
|
|
onMounted, |
|
|
|
onMounted, |
|
|
|
provide, |
|
|
|
provide, |
|
|
|
ref, |
|
|
|
ref, |
|
|
|
useEventListener, |
|
|
|
useBreakpoints, |
|
|
|
usePointerSwipe, |
|
|
|
usePointerSwipe, |
|
|
|
useSharedFormStoreOrThrow, |
|
|
|
useSharedFormStoreOrThrow, |
|
|
|
useStepper, |
|
|
|
useStepper, |
|
|
@ -20,6 +20,8 @@ enum TransitionDirection { |
|
|
|
Right = 'right', |
|
|
|
Right = 'right', |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { md } = useBreakpoints(breakpointsTailwind) |
|
|
|
|
|
|
|
|
|
|
|
const { v$, formState, formColumns, submitForm, submitted, secondsRemain, sharedFormView } = useSharedFormStoreOrThrow() |
|
|
|
const { v$, formState, formColumns, submitForm, submitted, secondsRemain, sharedFormView } = useSharedFormStoreOrThrow() |
|
|
|
|
|
|
|
|
|
|
|
const isTransitioning = ref(false) |
|
|
|
const isTransitioning = ref(false) |
|
|
@ -28,18 +30,6 @@ const transitionName = ref<TransitionDirection>(TransitionDirection.Left) |
|
|
|
|
|
|
|
|
|
|
|
const el = ref<HTMLDivElement>() |
|
|
|
const el = ref<HTMLDivElement>() |
|
|
|
|
|
|
|
|
|
|
|
const { direction } = usePointerSwipe(el, { |
|
|
|
|
|
|
|
onSwipe: () => { |
|
|
|
|
|
|
|
if (isTransitioning.value) return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (direction.value === SwipeDirection.LEFT) { |
|
|
|
|
|
|
|
goNext() |
|
|
|
|
|
|
|
} else if (direction.value === SwipeDirection.RIGHT) { |
|
|
|
|
|
|
|
goPrevious() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
provide(DropZoneRef, el) |
|
|
|
provide(DropZoneRef, el) |
|
|
|
|
|
|
|
|
|
|
|
const steps = computed(() => { |
|
|
|
const steps = computed(() => { |
|
|
@ -129,25 +119,26 @@ function focusInput() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
useEventListener('wheel', (event) => { |
|
|
|
onKeyStroke(['ArrowLeft', 'ArrowDown'], goPrevious) |
|
|
|
if (Math.abs(event.deltaX) < Math.abs(event.deltaY)) { |
|
|
|
onKeyStroke(['ArrowRight', 'ArrowUp', 'Enter', 'Space'], goNext) |
|
|
|
// Scrolling more vertically than horizontally |
|
|
|
|
|
|
|
return |
|
|
|
onMounted(() => { |
|
|
|
} |
|
|
|
focusInput() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!md.value) { |
|
|
|
|
|
|
|
const { direction } = usePointerSwipe(el, { |
|
|
|
|
|
|
|
onSwipe: () => { |
|
|
|
if (isTransitioning.value) return |
|
|
|
if (isTransitioning.value) return |
|
|
|
|
|
|
|
|
|
|
|
if (event.deltaX < -15) { |
|
|
|
if (direction.value === SwipeDirection.LEFT) { |
|
|
|
goPrevious() |
|
|
|
|
|
|
|
} else if (event.deltaX > 15) { |
|
|
|
|
|
|
|
goNext() |
|
|
|
goNext() |
|
|
|
|
|
|
|
} else if (direction.value === SwipeDirection.RIGHT) { |
|
|
|
|
|
|
|
goPrevious() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
onKeyStroke(['ArrowLeft', 'ArrowDown'], goPrevious) |
|
|
|
|
|
|
|
onKeyStroke(['ArrowRight', 'ArrowUp', 'Enter', 'Space'], goNext) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(focusInput) |
|
|
|
|
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
@ -248,7 +239,7 @@ onMounted(focusInput) |
|
|
|
</a-tooltip> |
|
|
|
</a-tooltip> |
|
|
|
|
|
|
|
|
|
|
|
<!-- todo: i18n --> |
|
|
|
<!-- todo: i18n --> |
|
|
|
<div class="text-sm text-gray-500 flex items-center gap-1"> |
|
|
|
<div class="hidden md:flex text-sm text-gray-500 items-center gap-1"> |
|
|
|
Press Enter <MaterialSymbolsKeyboardReturn class="mt-1" /> |
|
|
|
Press Enter <MaterialSymbolsKeyboardReturn class="mt-1" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|