wave-ui 3.6.0 → 3.6.2
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/wave-ui.cjs.js +1 -1
- package/dist/wave-ui.es.js +224 -218
- package/dist/wave-ui.umd.js +1 -1
- package/package.json +1 -1
- package/src/wave-ui/components/w-list.vue +5 -5
- package/src/wave-ui/components/w-menu.vue +4 -0
- package/src/wave-ui/components/w-select.vue +2 -1
- package/src/wave-ui/mixins/detachable.js +23 -5
- package/src/wave-ui/utils/dynamic-css.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wave-ui",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.2",
|
|
4
4
|
"description": "An emerging UI framework for Vue.js (2 & 3) with only the bright side. :sunny:",
|
|
5
5
|
"author": "Antoni Andre <antoniandre.web@gmail.com>",
|
|
6
6
|
"homepage": "https://antoniandre.github.io/wave-ui",
|
|
@@ -347,11 +347,11 @@ export default {
|
|
|
347
347
|
// Reset the selections when single selection allowed for w-select.
|
|
348
348
|
if (!this.isMultipleSelect) this.listItems.forEach(item => (item._selected = false))
|
|
349
349
|
|
|
350
|
-
this.checkSelection(selection) // Create an array with the selected values.
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
350
|
+
const selectedItems = this.checkSelection(selection) // Create an array with the selected values.
|
|
351
|
+
// Update which items are selected or not.
|
|
352
|
+
this.listItems.forEach(item => {
|
|
353
|
+
item._selected = selectedItems.find(val => item._value === val) !== undefined
|
|
354
|
+
})
|
|
355
355
|
}
|
|
356
356
|
},
|
|
357
357
|
|
|
@@ -248,6 +248,10 @@ export default {
|
|
|
248
248
|
* even while hovering the menu.
|
|
249
249
|
*/
|
|
250
250
|
async close (force = false) {
|
|
251
|
+
// The user may open and close the detachable so fast (like when toggling on hover) that it
|
|
252
|
+
// should not show up at all. This cancels the opening timer (if there is a set delay prop).
|
|
253
|
+
this.openTimeout = clearTimeout(this.openTimeout)
|
|
254
|
+
|
|
251
255
|
// Might be already closed.
|
|
252
256
|
// E.g. showOnHover & hideOnMenuClick: on click, force hide then mouseleave is also firing.
|
|
253
257
|
if (!this.detachableVisible) return
|
|
@@ -16,7 +16,7 @@ component(
|
|
|
16
16
|
|
|
17
17
|
w-menu(
|
|
18
18
|
v-model="showMenu"
|
|
19
|
-
@close="
|
|
19
|
+
@close="closeMenu"
|
|
20
20
|
:menu-class="`w-select__menu ${menuClass || ''}`"
|
|
21
21
|
transition="slide-fade-down"
|
|
22
22
|
:append-to="(menuProps || {}).appendTo !== undefined ? (menuProps || {}).appendTo : undefined"
|
|
@@ -27,6 +27,7 @@ component(
|
|
|
27
27
|
template(#activator="{ on }")
|
|
28
28
|
//- Input wrapper.
|
|
29
29
|
.w-select__selection-wrap(
|
|
30
|
+
v-on="on"
|
|
30
31
|
@click="!isDisabled && !isReadonly && onInputFieldClick()"
|
|
31
32
|
role="button"
|
|
32
33
|
aria-haspopup="listbox"
|
|
@@ -22,7 +22,8 @@ export default {
|
|
|
22
22
|
noPosition: { type: Boolean },
|
|
23
23
|
zIndex: { type: [Number, String, Boolean] },
|
|
24
24
|
// Optionally designate an external activator.
|
|
25
|
-
|
|
25
|
+
// The activator can be a DOM string selector, a ref or a DOM node.
|
|
26
|
+
activator: { type: [String, Object] }
|
|
26
27
|
},
|
|
27
28
|
|
|
28
29
|
inject: {
|
|
@@ -35,7 +36,11 @@ export default {
|
|
|
35
36
|
// as is in an array so we can delete them on destroy.
|
|
36
37
|
// This only applies to the activatorEventHandlers, the other events listeners can be removed
|
|
37
38
|
// normally.
|
|
38
|
-
docEventListenersHandlers: []
|
|
39
|
+
docEventListenersHandlers: [],
|
|
40
|
+
// The user may open and close the detachable so fast (like when toggling on hover) that it
|
|
41
|
+
// should not show up at all. Keep the ability to cancel the opening timer (if there is a set
|
|
42
|
+
// delay prop).
|
|
43
|
+
openTimeout: null
|
|
39
44
|
}),
|
|
40
45
|
|
|
41
46
|
computed: {
|
|
@@ -111,6 +116,13 @@ export default {
|
|
|
111
116
|
(['left', 'right'].includes(this.position) && this.alignBottom && 'bottom') ||
|
|
112
117
|
''
|
|
113
118
|
)
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
shouldShowOnClick () {
|
|
122
|
+
// For props simplicity, the w-tooltip component has the `showOnHover` prop,
|
|
123
|
+
// whereas the w-menu has `showOnClick`.
|
|
124
|
+
return (this.$options.props.showOnHover && !this.showOnHover) ||
|
|
125
|
+
(this.$options.props.showOnClick && this.showOnClick)
|
|
114
126
|
}
|
|
115
127
|
},
|
|
116
128
|
|
|
@@ -119,7 +131,10 @@ export default {
|
|
|
119
131
|
async open (e) {
|
|
120
132
|
// A tiny delay may help positioning the detachable correctly in case of multiple activators
|
|
121
133
|
// with different menu contents.
|
|
122
|
-
if (this.delay) await new Promise(resolve => setTimeout(resolve, this.delay))
|
|
134
|
+
if (this.delay) await new Promise(resolve => (this.openTimeout = setTimeout(resolve, this.delay)))
|
|
135
|
+
|
|
136
|
+
// Cancel opening if the timeout has been cancelled by blur event (when going fast).
|
|
137
|
+
if (this.delay && !this.openTimeout) return
|
|
123
138
|
|
|
124
139
|
this.detachableVisible = true
|
|
125
140
|
|
|
@@ -339,7 +354,7 @@ export default {
|
|
|
339
354
|
if (this.overlay) this.overlayEl = this.$refs.overlay?.$el
|
|
340
355
|
|
|
341
356
|
if (this.modelValue && this.activator) {
|
|
342
|
-
this.toggle({ type: this.
|
|
357
|
+
this.toggle({ type: this.shouldShowOnClick ? 'click' : 'mouseenter', target: this.activatorEl })
|
|
343
358
|
}
|
|
344
359
|
else if (this.modelValue) this.open({ target: this.activatorEl })
|
|
345
360
|
},
|
|
@@ -360,7 +375,10 @@ export default {
|
|
|
360
375
|
|
|
361
376
|
watch: {
|
|
362
377
|
modelValue (bool) {
|
|
363
|
-
if (!!bool !== this.detachableVisible)
|
|
378
|
+
if (!!bool !== this.detachableVisible) {
|
|
379
|
+
if (bool) this.open({ target: this.activatorEl })
|
|
380
|
+
else this.close()
|
|
381
|
+
}
|
|
364
382
|
},
|
|
365
383
|
appendTo () {
|
|
366
384
|
this.removeFromDOM()
|
|
@@ -159,6 +159,7 @@ const genBreakpointLayoutClasses = breakpoints => {
|
|
|
159
159
|
'text-nowrap{white-space:nowrap}',
|
|
160
160
|
'row{flex-direction:row}',
|
|
161
161
|
'column{flex-direction:column}',
|
|
162
|
+
'column-reverse{flex-direction:column-reverse}',
|
|
162
163
|
'grow{flex-grow:1;flex-basis:auto}',
|
|
163
164
|
'no-grow{flex-grow:0}',
|
|
164
165
|
'shrink{flex-shrink:1;margin-left:auto;margin-right:auto}',
|