diff --git a/src/components/AutoQueryGrid.vue b/src/components/AutoQueryGrid.vue index baca666..a5186c3 100644 --- a/src/components/AutoQueryGrid.vue +++ b/src/components/AutoQueryGrid.vue @@ -34,7 +34,7 @@
- +
diff --git a/src/components/AutoViewForm.vue b/src/components/AutoViewForm.vue index 27e17e1..6f1636d 100644 --- a/src/components/AutoViewForm.vue +++ b/src/components/AutoViewForm.vue @@ -1,127 +1,176 @@ - - \ No newline at end of file +function done() { + if (props.done) { + props.done() + } +} + +/* SlideOver */ +const show = ref(false) +const transition1 = ref('') +const rule1 = { + entering: { cls: 'transform transition ease-in-out duration-500 sm:duration-700', from: 'translate-x-full', to: 'translate-x-0' }, + leaving: { cls: 'transform transition ease-in-out duration-500 sm:duration-700', from: 'translate-x-0', to: 'translate-x-full' } +} +watch(show, () => { + transition(rule1, transition1, show.value) + if (!show.value) setTimeout(done, 700) +}) +show.value = true +function close() { + if (props.formStyle == 'slideOver') { + show.value = false + } else { + done() + } +} + +const globalKeyHandler = (e:KeyboardEvent) => { if (e.key === 'Escape') close() } +onMounted(() => window.addEventListener('keydown', globalKeyHandler)) +onUnmounted(() => window.removeEventListener('keydown', globalKeyHandler)) + \ No newline at end of file