@volverjs/ui-vue 0.0.8-beta.8 → 0.0.8
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/VvCombobox/VvCombobox.es.js +40 -37
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +35 -32
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +1 -1
- package/dist/components/index.es.js +40 -37
- 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/VvCombobox/VvCombobox.vue +2 -2
- package/src/components/VvDropdown/VvDropdown.vue +47 -37
|
@@ -381,7 +381,6 @@
|
|
|
381
381
|
:role="DropdownRole.listbox"
|
|
382
382
|
@after-expand="onAfterExpand"
|
|
383
383
|
@after-collapse="onAfterCollapse"
|
|
384
|
-
@click="$event.stopPropagation()"
|
|
385
384
|
>
|
|
386
385
|
<template
|
|
387
386
|
v-if="searchable || $slots['dropdown::before']"
|
|
@@ -579,9 +578,10 @@
|
|
|
579
578
|
<slot name="dropdown::after">
|
|
580
579
|
<!-- Close button if dropdown custom position is enabled and floating-ui disabled -->
|
|
581
580
|
<VvButton
|
|
582
|
-
v-if="dropdownEl?.
|
|
581
|
+
v-if="dropdownEl?.customPosition"
|
|
583
582
|
label="Close"
|
|
584
583
|
modifiers="secondary"
|
|
584
|
+
@click="dropdownEl.hide()"
|
|
585
585
|
/>
|
|
586
586
|
</slot>
|
|
587
587
|
</template>
|
|
@@ -54,22 +54,24 @@
|
|
|
54
54
|
})
|
|
55
55
|
|
|
56
56
|
// 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
|
-
}
|
|
57
|
+
const hasCustomPosition = ref(false)
|
|
66
58
|
|
|
67
59
|
// observe dropdown style for "--dropdown-custom-position" css var to disable floating-ui
|
|
68
60
|
onMounted(() => {
|
|
69
|
-
useMutationObserver(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
61
|
+
useMutationObserver(
|
|
62
|
+
floatingEl.value,
|
|
63
|
+
() => {
|
|
64
|
+
hasCustomPosition.value =
|
|
65
|
+
window
|
|
66
|
+
.getComputedStyle(floatingEl.value)
|
|
67
|
+
.getPropertyValue('--dropdown-custom-position')
|
|
68
|
+
?.trim() === 'true'
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
attributeFilter: ['style'],
|
|
72
|
+
window,
|
|
73
|
+
},
|
|
74
|
+
)
|
|
73
75
|
})
|
|
74
76
|
|
|
75
77
|
// floating ui
|
|
@@ -158,8 +160,8 @@
|
|
|
158
160
|
},
|
|
159
161
|
)
|
|
160
162
|
const dropdownPlacement = computed(() => {
|
|
161
|
-
if (
|
|
162
|
-
return
|
|
163
|
+
if (hasCustomPosition.value) {
|
|
164
|
+
return undefined
|
|
163
165
|
}
|
|
164
166
|
return {
|
|
165
167
|
position: strategy.value,
|
|
@@ -175,31 +177,34 @@
|
|
|
175
177
|
})
|
|
176
178
|
|
|
177
179
|
// placement
|
|
178
|
-
const side = computed(
|
|
179
|
-
const staticSide = computed(
|
|
180
|
+
const side = computed(
|
|
180
181
|
() =>
|
|
181
|
-
(
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}[side.value] ?? 'bottom'),
|
|
182
|
+
placement.value.split('-')[0] as
|
|
183
|
+
| 'top'
|
|
184
|
+
| 'right'
|
|
185
|
+
| 'bottom'
|
|
186
|
+
| 'left',
|
|
187
187
|
)
|
|
188
188
|
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
|
-
}
|
|
189
|
+
if (hasCustomPosition.value) {
|
|
190
|
+
return undefined
|
|
199
191
|
}
|
|
192
|
+
const staticSide = {
|
|
193
|
+
top: 'bottom',
|
|
194
|
+
right: 'left',
|
|
195
|
+
bottom: 'top',
|
|
196
|
+
left: 'right',
|
|
197
|
+
}[side.value]
|
|
200
198
|
return {
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
left:
|
|
200
|
+
middlewareData.value.arrow?.x !== undefined
|
|
201
|
+
? `${middlewareData.value.arrow?.x}px`
|
|
202
|
+
: undefined,
|
|
203
|
+
top:
|
|
204
|
+
middlewareData.value.arrow?.y !== undefined
|
|
205
|
+
? `${middlewareData.value.arrow?.y}px`
|
|
206
|
+
: undefined,
|
|
207
|
+
[staticSide]: `${-(arrowEl.value?.offsetWidth ?? 0) / 2}px`,
|
|
203
208
|
}
|
|
204
209
|
})
|
|
205
210
|
|
|
@@ -228,7 +233,13 @@
|
|
|
228
233
|
const init = (el: HTMLElement) => {
|
|
229
234
|
referenceEl.value = el
|
|
230
235
|
}
|
|
231
|
-
defineExpose({
|
|
236
|
+
defineExpose({
|
|
237
|
+
toggle,
|
|
238
|
+
show,
|
|
239
|
+
hide,
|
|
240
|
+
init,
|
|
241
|
+
customPosition: hasCustomPosition,
|
|
242
|
+
})
|
|
232
243
|
watch(expanded, (newValue) => {
|
|
233
244
|
if (newValue && props.autofocusFirst) {
|
|
234
245
|
nextTick(() => {
|
|
@@ -403,7 +414,6 @@
|
|
|
403
414
|
ref="floatingEl"
|
|
404
415
|
:style="dropdownPlacement"
|
|
405
416
|
:class="bemCssClasses"
|
|
406
|
-
@click="hide()"
|
|
407
417
|
>
|
|
408
418
|
<div
|
|
409
419
|
v-if="props.arrow"
|