@maas/vue-equipment 0.7.7 → 0.7.9
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/dist/nuxt/module.json
CHANGED
|
@@ -60,13 +60,22 @@ import {
|
|
|
60
60
|
type MaybeRef,
|
|
61
61
|
} from 'vue'
|
|
62
62
|
import { onKeyStroke } from '@vueuse/core'
|
|
63
|
-
import { defu } from 'defu'
|
|
64
63
|
import { defaultOptions } from './../utils/defaultOptions'
|
|
65
64
|
import { useModalApi } from './../composables/useModalApi'
|
|
66
65
|
import { useModalCallback } from '../composables/private/useModalCallback'
|
|
67
66
|
|
|
68
67
|
import type { Options } from './../types/index'
|
|
69
68
|
|
|
69
|
+
import { createDefu } from 'defu'
|
|
70
|
+
|
|
71
|
+
// Prevent keys array from being merged with default
|
|
72
|
+
const customDefu = createDefu((obj, key, value) => {
|
|
73
|
+
if (key === 'keys') {
|
|
74
|
+
obj[key] = value
|
|
75
|
+
return true
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
|
|
70
79
|
interface MagicModalProps {
|
|
71
80
|
id: MaybeRef<string>
|
|
72
81
|
component?: Component
|
|
@@ -80,7 +89,7 @@ const props = withDefaults(defineProps<MagicModalProps>(), {
|
|
|
80
89
|
|
|
81
90
|
const modal = ref<HTMLElement | undefined>(undefined)
|
|
82
91
|
const modalApi = useModalApi(props.id, { focusTarget: modal })
|
|
83
|
-
const mappedOptions =
|
|
92
|
+
const mappedOptions = customDefu(props.options, defaultOptions)
|
|
84
93
|
|
|
85
94
|
const {
|
|
86
95
|
isActive,
|
|
@@ -127,10 +136,14 @@ function onClose() {
|
|
|
127
136
|
innerActive.value = false
|
|
128
137
|
}
|
|
129
138
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
139
|
+
if (mappedOptions.keys) {
|
|
140
|
+
for (const key of mappedOptions.keys) {
|
|
141
|
+
onKeyStroke(key, (e) => {
|
|
142
|
+
e.preventDefault()
|
|
143
|
+
close()
|
|
144
|
+
})
|
|
145
|
+
}
|
|
146
|
+
}
|
|
134
147
|
|
|
135
148
|
watch(isActive, async (value) => {
|
|
136
149
|
if (value) {
|
|
@@ -146,6 +159,8 @@ watch(isActive, async (value) => {
|
|
|
146
159
|
--magic-modal-z-index: 999;
|
|
147
160
|
--magic-modal-backdrop-color: rgba(0, 0, 0, 0.5);
|
|
148
161
|
--magic-modal-backdrop-filter: unset;
|
|
162
|
+
--magic-modal-content-align-items: center;
|
|
163
|
+
--magic-modal-content-justify-content: center;
|
|
149
164
|
}
|
|
150
165
|
|
|
151
166
|
.magic-modal {
|
|
@@ -169,8 +184,8 @@ watch(isActive, async (value) => {
|
|
|
169
184
|
max-height: 100%;
|
|
170
185
|
width: 100%;
|
|
171
186
|
display: flex;
|
|
172
|
-
align-items:
|
|
173
|
-
justify-content:
|
|
187
|
+
align-items: var(--magic-modal-content-align-items);
|
|
188
|
+
justify-content: var(--magic-modal-content-justify-content);
|
|
174
189
|
overflow-y: auto;
|
|
175
190
|
}
|
|
176
191
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maas/vue-equipment",
|
|
3
3
|
"description": "A magic collection of Vue composables, plugins, components and directives",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.9",
|
|
5
5
|
"author": "Robin Scholz <https://github.com/robinscholz>, Christoph Jeworutzki <https://github.com/ChristophJeworutzki>",
|
|
6
6
|
"devDependencies": {
|
|
7
7
|
"@antfu/ni": "^0.21.5",
|