@volverjs/ui-vue 0.0.8-beta.9 → 0.0.9-beta.1
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/README.md +2 -0
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +41 -5
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.es.js +72 -41
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvDialog/VvDialog.es.js +33 -1
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +71 -40
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +10 -2
- package/dist/components/index.es.js +105 -42
- package/dist/components/index.umd.js +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/package.json +28 -28
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvAlertGroup/VvAlertGroup.vue +28 -0
- package/src/components/VvAlertGroup/index.ts +11 -1
- package/src/components/VvCombobox/VvCombobox.vue +1 -1
- package/src/components/VvDialog/VvDialog.vue +20 -0
- package/src/components/VvDialog/index.ts +13 -1
- package/src/components/VvDropdown/VvDropdown.vue +84 -48
|
@@ -11,6 +11,33 @@
|
|
|
11
11
|
const props = defineProps(VvAlertGroupProps)
|
|
12
12
|
const emit = defineEmits(VvAlertGroupEvents)
|
|
13
13
|
const { hasProps, hasTransition } = useVvAlertGroup(props, emit)
|
|
14
|
+
|
|
15
|
+
const alertGroupTransitionHandlers = {
|
|
16
|
+
'before-enter': () => {
|
|
17
|
+
emit('before-enter')
|
|
18
|
+
},
|
|
19
|
+
'after-leave': () => {
|
|
20
|
+
emit('after-leave')
|
|
21
|
+
},
|
|
22
|
+
enter: () => {
|
|
23
|
+
emit('enter')
|
|
24
|
+
},
|
|
25
|
+
'after-enter': () => {
|
|
26
|
+
emit('after-enter')
|
|
27
|
+
},
|
|
28
|
+
'enter-cancelled': () => {
|
|
29
|
+
emit('enter-cancelled')
|
|
30
|
+
},
|
|
31
|
+
'before-leave': () => {
|
|
32
|
+
emit('before-leave')
|
|
33
|
+
},
|
|
34
|
+
leave: () => {
|
|
35
|
+
emit('leave')
|
|
36
|
+
},
|
|
37
|
+
'leave-cancelled': () => {
|
|
38
|
+
emit('leave-cancelled')
|
|
39
|
+
},
|
|
40
|
+
}
|
|
14
41
|
</script>
|
|
15
42
|
|
|
16
43
|
<template>
|
|
@@ -22,6 +49,7 @@
|
|
|
22
49
|
role="group"
|
|
23
50
|
:name="hasTransition"
|
|
24
51
|
class="vv-alert-group__list"
|
|
52
|
+
v-on="alertGroupTransitionHandlers"
|
|
25
53
|
>
|
|
26
54
|
<!-- @slot The slot for alert list -->
|
|
27
55
|
<slot>
|
|
@@ -50,7 +50,17 @@ export const VvAlertGroupProps = {
|
|
|
50
50
|
},
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
export const VvAlertGroupEvents = [
|
|
53
|
+
export const VvAlertGroupEvents = [
|
|
54
|
+
'close',
|
|
55
|
+
'before-enter',
|
|
56
|
+
'after-leave',
|
|
57
|
+
'enter',
|
|
58
|
+
'after-enter',
|
|
59
|
+
'enter-cancelled',
|
|
60
|
+
'before-leave',
|
|
61
|
+
'leave',
|
|
62
|
+
'leave-cancelled',
|
|
63
|
+
]
|
|
54
64
|
|
|
55
65
|
export const useVvAlertGroup = (
|
|
56
66
|
props: Readonly<ExtractPropTypes<typeof VvAlertGroupProps>>,
|
|
@@ -578,7 +578,7 @@
|
|
|
578
578
|
<slot name="dropdown::after">
|
|
579
579
|
<!-- Close button if dropdown custom position is enabled and floating-ui disabled -->
|
|
580
580
|
<VvButton
|
|
581
|
-
v-if="dropdownEl?.
|
|
581
|
+
v-if="dropdownEl?.customPosition"
|
|
582
582
|
label="Close"
|
|
583
583
|
modifiers="secondary"
|
|
584
584
|
@click="dropdownEl.hide()"
|
|
@@ -51,10 +51,30 @@
|
|
|
51
51
|
'before-enter': () => {
|
|
52
52
|
dialogEl.value?.showModal()
|
|
53
53
|
emit('open')
|
|
54
|
+
emit('before-enter')
|
|
54
55
|
},
|
|
55
56
|
'after-leave': () => {
|
|
56
57
|
dialogEl.value?.close()
|
|
57
58
|
emit('close')
|
|
59
|
+
emit('after-leave')
|
|
60
|
+
},
|
|
61
|
+
enter: () => {
|
|
62
|
+
emit('enter')
|
|
63
|
+
},
|
|
64
|
+
'after-enter': () => {
|
|
65
|
+
emit('after-enter')
|
|
66
|
+
},
|
|
67
|
+
'enter-cancelled': () => {
|
|
68
|
+
emit('enter-cancelled')
|
|
69
|
+
},
|
|
70
|
+
'before-leave': () => {
|
|
71
|
+
emit('before-leave')
|
|
72
|
+
},
|
|
73
|
+
leave: () => {
|
|
74
|
+
emit('leave')
|
|
75
|
+
},
|
|
76
|
+
'leave-cancelled': () => {
|
|
77
|
+
emit('leave-cancelled')
|
|
58
78
|
},
|
|
59
79
|
}
|
|
60
80
|
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import { IdProps } from '../../props'
|
|
2
2
|
|
|
3
|
-
export const VvDialogEvents = [
|
|
3
|
+
export const VvDialogEvents = [
|
|
4
|
+
'open',
|
|
5
|
+
'close',
|
|
6
|
+
'update:modelValue',
|
|
7
|
+
'before-enter',
|
|
8
|
+
'after-leave',
|
|
9
|
+
'enter',
|
|
10
|
+
'after-enter',
|
|
11
|
+
'enter-cancelled',
|
|
12
|
+
'before-leave',
|
|
13
|
+
'leave',
|
|
14
|
+
'leave-cancelled',
|
|
15
|
+
]
|
|
4
16
|
|
|
5
17
|
export const VvDialogProps = {
|
|
6
18
|
...IdProps,
|
|
@@ -34,6 +34,14 @@
|
|
|
34
34
|
'beforeCollapse',
|
|
35
35
|
'afterExpand',
|
|
36
36
|
'afterCollapse',
|
|
37
|
+
'before-enter',
|
|
38
|
+
'after-leave',
|
|
39
|
+
'enter',
|
|
40
|
+
'after-enter',
|
|
41
|
+
'enter-cancelled',
|
|
42
|
+
'before-leave',
|
|
43
|
+
'leave',
|
|
44
|
+
'leave-cancelled',
|
|
37
45
|
])
|
|
38
46
|
const { id } = toRefs(props)
|
|
39
47
|
const hasId = useUniqueId(id)
|
|
@@ -54,22 +62,24 @@
|
|
|
54
62
|
})
|
|
55
63
|
|
|
56
64
|
// ref to store the value of css-var "--dropdown-custom-position"
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
// set dropdownCustomPosition value from css-var "--dropdown-custom-position"
|
|
60
|
-
const onChangeDropdownCustomPosition = () => {
|
|
61
|
-
dropdownCustomPosition.value = window
|
|
62
|
-
.getComputedStyle(floatingEl.value)
|
|
63
|
-
.getPropertyValue('--dropdown-custom-position')
|
|
64
|
-
?.trim()
|
|
65
|
-
}
|
|
65
|
+
const hasCustomPosition = ref(false)
|
|
66
66
|
|
|
67
67
|
// observe dropdown style for "--dropdown-custom-position" css var to disable floating-ui
|
|
68
68
|
onMounted(() => {
|
|
69
|
-
useMutationObserver(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
useMutationObserver(
|
|
70
|
+
floatingEl.value,
|
|
71
|
+
() => {
|
|
72
|
+
hasCustomPosition.value =
|
|
73
|
+
window
|
|
74
|
+
.getComputedStyle(floatingEl.value)
|
|
75
|
+
.getPropertyValue('--dropdown-custom-position')
|
|
76
|
+
?.trim() === 'true'
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
attributeFilter: ['style'],
|
|
80
|
+
window,
|
|
81
|
+
},
|
|
82
|
+
)
|
|
73
83
|
})
|
|
74
84
|
|
|
75
85
|
// floating ui
|
|
@@ -158,8 +168,8 @@
|
|
|
158
168
|
},
|
|
159
169
|
)
|
|
160
170
|
const dropdownPlacement = computed(() => {
|
|
161
|
-
if (
|
|
162
|
-
return
|
|
171
|
+
if (hasCustomPosition.value) {
|
|
172
|
+
return undefined
|
|
163
173
|
}
|
|
164
174
|
return {
|
|
165
175
|
position: strategy.value,
|
|
@@ -175,31 +185,34 @@
|
|
|
175
185
|
})
|
|
176
186
|
|
|
177
187
|
// placement
|
|
178
|
-
const side = computed(
|
|
179
|
-
const staticSide = computed(
|
|
188
|
+
const side = computed(
|
|
180
189
|
() =>
|
|
181
|
-
(
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}[side.value] ?? 'bottom'),
|
|
190
|
+
placement.value.split('-')[0] as
|
|
191
|
+
| 'top'
|
|
192
|
+
| 'right'
|
|
193
|
+
| 'bottom'
|
|
194
|
+
| 'left',
|
|
187
195
|
)
|
|
188
196
|
const arrowPlacement = computed(() => {
|
|
189
|
-
if (
|
|
190
|
-
return
|
|
191
|
-
}
|
|
192
|
-
if (['bottom', 'top'].includes(staticSide.value)) {
|
|
193
|
-
return {
|
|
194
|
-
right: `${middlewareData.value.arrow?.x ?? 0}px`,
|
|
195
|
-
[staticSide.value]: `${
|
|
196
|
-
-(arrowEl.value?.offsetWidth ?? 0) / 2
|
|
197
|
-
}px`,
|
|
198
|
-
}
|
|
197
|
+
if (hasCustomPosition.value) {
|
|
198
|
+
return undefined
|
|
199
199
|
}
|
|
200
|
+
const staticSide = {
|
|
201
|
+
top: 'bottom',
|
|
202
|
+
right: 'left',
|
|
203
|
+
bottom: 'top',
|
|
204
|
+
left: 'right',
|
|
205
|
+
}[side.value]
|
|
200
206
|
return {
|
|
201
|
-
|
|
202
|
-
|
|
207
|
+
left:
|
|
208
|
+
middlewareData.value.arrow?.x !== undefined
|
|
209
|
+
? `${middlewareData.value.arrow?.x}px`
|
|
210
|
+
: undefined,
|
|
211
|
+
top:
|
|
212
|
+
middlewareData.value.arrow?.y !== undefined
|
|
213
|
+
? `${middlewareData.value.arrow?.y}px`
|
|
214
|
+
: undefined,
|
|
215
|
+
[staticSide]: `${-(arrowEl.value?.offsetWidth ?? 0) / 2}px`,
|
|
203
216
|
}
|
|
204
217
|
})
|
|
205
218
|
|
|
@@ -228,7 +241,13 @@
|
|
|
228
241
|
const init = (el: HTMLElement) => {
|
|
229
242
|
referenceEl.value = el
|
|
230
243
|
}
|
|
231
|
-
defineExpose({
|
|
244
|
+
defineExpose({
|
|
245
|
+
toggle,
|
|
246
|
+
show,
|
|
247
|
+
hide,
|
|
248
|
+
init,
|
|
249
|
+
customPosition: hasCustomPosition,
|
|
250
|
+
})
|
|
232
251
|
watch(expanded, (newValue) => {
|
|
233
252
|
if (newValue && props.autofocusFirst) {
|
|
234
253
|
nextTick(() => {
|
|
@@ -377,11 +396,34 @@
|
|
|
377
396
|
htmlEl?.click()
|
|
378
397
|
}
|
|
379
398
|
})
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
399
|
+
|
|
400
|
+
const dropdownTransitionHandlers = {
|
|
401
|
+
'before-enter': () => {
|
|
402
|
+
emit(expanded.value ? 'beforeExpand' : 'beforeCollapse')
|
|
403
|
+
emit('before-enter')
|
|
404
|
+
},
|
|
405
|
+
'after-leave': () => {
|
|
406
|
+
emit(expanded.value ? 'afterExpand' : 'afterCollapse')
|
|
407
|
+
emit('after-leave')
|
|
408
|
+
},
|
|
409
|
+
enter: () => {
|
|
410
|
+
emit('enter')
|
|
411
|
+
},
|
|
412
|
+
'after-enter': () => {
|
|
413
|
+
emit('after-enter')
|
|
414
|
+
},
|
|
415
|
+
'enter-cancelled': () => {
|
|
416
|
+
emit('enter-cancelled')
|
|
417
|
+
},
|
|
418
|
+
'before-leave': () => {
|
|
419
|
+
emit('before-leave')
|
|
420
|
+
},
|
|
421
|
+
leave: () => {
|
|
422
|
+
emit('leave')
|
|
423
|
+
},
|
|
424
|
+
'leave-cancelled': () => {
|
|
425
|
+
emit('leave-cancelled')
|
|
426
|
+
},
|
|
385
427
|
}
|
|
386
428
|
</script>
|
|
387
429
|
|
|
@@ -391,13 +433,7 @@
|
|
|
391
433
|
v-bind="{ init, show, hide, toggle, expanded, aria: referenceAria }"
|
|
392
434
|
/>
|
|
393
435
|
</VvDropdownTriggerProvider>
|
|
394
|
-
<Transition
|
|
395
|
-
:name="transitionName"
|
|
396
|
-
v-on="{
|
|
397
|
-
beforeEnter: onTransitionBeforeEnter,
|
|
398
|
-
onAfterLeave: onTransitionAfterLeave,
|
|
399
|
-
}"
|
|
400
|
-
>
|
|
436
|
+
<Transition :name="transitionName" v-on="dropdownTransitionHandlers">
|
|
401
437
|
<div
|
|
402
438
|
v-show="expanded"
|
|
403
439
|
ref="floatingEl"
|