@fy-/fws-vue 2.2.45 → 2.2.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ui/DefaultDropdown.vue +15 -3
- package/components/ui/DefaultGallery.vue +695 -167
- package/components/ui/DefaultModal.vue +137 -35
- package/package.json +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { onMounted, onUnmounted } from 'vue'
|
|
3
|
-
|
|
2
|
+
import { onMounted, onUnmounted, ref } from 'vue'
|
|
4
3
|
import ScaleTransition from './transitions/ScaleTransition.vue'
|
|
5
4
|
|
|
6
5
|
const props = defineProps<{
|
|
@@ -17,6 +16,17 @@ const props = defineProps<{
|
|
|
17
16
|
closeDropdown: () => void
|
|
18
17
|
}>()
|
|
19
18
|
|
|
19
|
+
const dropdownRef = ref<HTMLElement | null>(null)
|
|
20
|
+
|
|
21
|
+
// Custom implementation of click-outside functionality
|
|
22
|
+
function handleClickOutsideElement(event: MouseEvent) {
|
|
23
|
+
if (props.preventClickOutside) return
|
|
24
|
+
|
|
25
|
+
if (props.show && dropdownRef.value && !dropdownRef.value.contains(event.target as Node)) {
|
|
26
|
+
props.handleClickOutside()
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
20
30
|
function handleCloseOnEscape(event: KeyboardEvent) {
|
|
21
31
|
if (['Escape', 'Esc'].includes(event.key)) {
|
|
22
32
|
props.closeDropdown()
|
|
@@ -25,10 +35,12 @@ function handleCloseOnEscape(event: KeyboardEvent) {
|
|
|
25
35
|
|
|
26
36
|
onMounted(() => {
|
|
27
37
|
document.addEventListener('keydown', handleCloseOnEscape)
|
|
38
|
+
document.addEventListener('click', handleClickOutsideElement)
|
|
28
39
|
})
|
|
29
40
|
|
|
30
41
|
onUnmounted(() => {
|
|
31
42
|
document.removeEventListener('keydown', handleCloseOnEscape)
|
|
43
|
+
document.removeEventListener('click', handleClickOutsideElement)
|
|
32
44
|
})
|
|
33
45
|
</script>
|
|
34
46
|
|
|
@@ -42,7 +54,7 @@ onUnmounted(() => {
|
|
|
42
54
|
<ScaleTransition>
|
|
43
55
|
<div
|
|
44
56
|
v-show="props.show"
|
|
45
|
-
|
|
57
|
+
ref="dropdownRef"
|
|
46
58
|
:class="props.position"
|
|
47
59
|
:style="props.coordinates"
|
|
48
60
|
class="absolute z-[100] w-[200px] mt-2 rounded-sm bg-white dark:bg-fv-neutral-900 shadow-lg border border-fv-neutral-100 dark:border-fv-neutral-600 focus:outline-none"
|