wave-ui 1.63.0 → 1.64.0
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.css +1 -1
- package/dist/wave-ui.es.js +13 -4
- package/dist/wave-ui.umd.js +1 -1
- package/package.json +2 -1
- package/src/wave-ui/components/w-button/index.vue +9 -1
- package/src/wave-ui/components/w-input.vue +4 -1
- package/src/wave-ui/components/w-select.vue +27 -15
- package/src/wave-ui/components/w-textarea.vue +1 -0
- package/src/wave-ui/components/w-tree.vue +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wave-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.64.0",
|
|
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",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"./package.json": "./package.json",
|
|
24
24
|
"./dist/*": "./dist/*",
|
|
25
25
|
"./src/wave-ui": "./src/wave-ui/index.js",
|
|
26
|
+
"./src/wave-ui/components": "./src/wave-ui/components/index.js",
|
|
26
27
|
"./src/wave-ui/*": "./src/wave-ui/*"
|
|
27
28
|
},
|
|
28
29
|
"type": "module",
|
|
@@ -61,7 +61,15 @@ export default {
|
|
|
61
61
|
computed: {
|
|
62
62
|
buttonProps () {
|
|
63
63
|
const { tooltip, tooltipProps, ...props } = this.$props
|
|
64
|
-
return {
|
|
64
|
+
return {
|
|
65
|
+
...props,
|
|
66
|
+
...this.$attrs,
|
|
67
|
+
// Vue 2 specific:
|
|
68
|
+
// The classes and styles are not in $attrs. Add them from $vnode.data.staticClass, so
|
|
69
|
+
// the button gets these classes wen used with tooltip.
|
|
70
|
+
// https://v2.vuejs.org/v2/guide/components-props.html#Disabling-Attribute-Inheritance
|
|
71
|
+
class: this.tooltip && this.$vnode.data.staticClass
|
|
72
|
+
}
|
|
65
73
|
}
|
|
66
74
|
}
|
|
67
75
|
}
|
|
@@ -115,7 +115,9 @@ component(
|
|
|
115
115
|
|
|
116
116
|
<script>
|
|
117
117
|
/**
|
|
118
|
-
* @todo
|
|
118
|
+
* @todo
|
|
119
|
+
* - Share the common parts between w-input, w-textarea & w-select.
|
|
120
|
+
* - option to fit to the content using contenteditable div
|
|
119
121
|
**/
|
|
120
122
|
|
|
121
123
|
import FormElementMixin from '../mixins/form-elements'
|
|
@@ -575,6 +577,7 @@ $inactive-color: #777;
|
|
|
575
577
|
top: 50%;
|
|
576
578
|
left: 0;
|
|
577
579
|
padding-left: 2 * $base-increment;
|
|
580
|
+
white-space: nowrap;
|
|
578
581
|
transform: translateY(-50%);
|
|
579
582
|
pointer-events: none;
|
|
580
583
|
|
|
@@ -40,21 +40,19 @@ component(
|
|
|
40
40
|
.w-select__selection-slot(v-if="$scopedSlots.selection")
|
|
41
41
|
//- inputValue is always an array.
|
|
42
42
|
slot(name="selection" :item="multiple ? inputValue : inputValue[0]")
|
|
43
|
-
|
|
43
|
+
.w-select__selection(
|
|
44
44
|
ref="selection-input"
|
|
45
|
-
|
|
46
|
-
:value="$scopedSlots.selection ? '' : selectionString"
|
|
45
|
+
:contenteditable="isDisabled || isReadonly ? 'false' : 'true'"
|
|
47
46
|
@focus="!isDisabled && !isReadonly && onFocus($event)"
|
|
48
47
|
@blur="onBlur"
|
|
49
48
|
@keydown="!isDisabled && !isReadonly && onKeydown($event)"
|
|
50
49
|
:id="`w-select--${_uid}`"
|
|
51
|
-
:
|
|
50
|
+
:class="{ 'w-select__selection--placeholder': !$scopedSlots.selection && !selectionString && placeholder }"
|
|
52
51
|
:disabled="isDisabled || null"
|
|
53
52
|
readonly
|
|
54
53
|
aria-readonly="true"
|
|
55
|
-
:required="required || null"
|
|
56
54
|
:tabindex="tabindex || null"
|
|
57
|
-
|
|
55
|
+
v-html="($scopedSlots.selection ? '' : selectionString) || placeholder")
|
|
58
56
|
//- For standard HTML form submission.
|
|
59
57
|
input(
|
|
60
58
|
v-for="(val, i) in (inputValue.length ? inputValue : [{}])"
|
|
@@ -149,7 +147,8 @@ export default {
|
|
|
149
147
|
// By default you can unselect a list item by re-selecting it.
|
|
150
148
|
// Allow preventing that on single selection lists only.
|
|
151
149
|
noUnselect: { type: Boolean },
|
|
152
|
-
menuProps: { type: Object } // Allow passing down an object of props to the w-menu component.
|
|
150
|
+
menuProps: { type: Object }, // Allow passing down an object of props to the w-menu component.
|
|
151
|
+
fitToContent: { type: Boolean }
|
|
153
152
|
// Props from mixin: name, disabled, readonly, required, tabindex, validators.
|
|
154
153
|
// Computed from mixin: inputName, isDisabled & isReadonly.
|
|
155
154
|
},
|
|
@@ -198,6 +197,7 @@ export default {
|
|
|
198
197
|
return {
|
|
199
198
|
'w-select': true,
|
|
200
199
|
'w-select--disabled': this.isDisabled,
|
|
200
|
+
'w-select--fit-to-content': this.fitToContent,
|
|
201
201
|
'w-select--readonly': this.isReadonly,
|
|
202
202
|
[`w-select--${this.hasValue ? 'filled' : 'empty'}`]: true,
|
|
203
203
|
'w-select--focused': (this.isFocused || this.showMenu) && !this.isReadonly,
|
|
@@ -229,6 +229,7 @@ export default {
|
|
|
229
229
|
onFocus (e) {
|
|
230
230
|
this.isFocused = true
|
|
231
231
|
this.$emit('focus', e)
|
|
232
|
+
return false
|
|
232
233
|
},
|
|
233
234
|
|
|
234
235
|
onBlur (e) {
|
|
@@ -237,6 +238,11 @@ export default {
|
|
|
237
238
|
},
|
|
238
239
|
|
|
239
240
|
onKeydown (e) {
|
|
241
|
+
// Forbid typing in contenteditable element.
|
|
242
|
+
// Note: using contenteditable rather than input in order to be able to fit the select list
|
|
243
|
+
// to its content with CSS. Only contenteditable divs/non-interactive elements can react to focus/blur ).
|
|
244
|
+
e.preventDefault()
|
|
245
|
+
|
|
240
246
|
if ([13, 27, 38, 40].includes(e.keyCode)) e.preventDefault()
|
|
241
247
|
|
|
242
248
|
if (e.keyCode === 27) this.closeMenu() // Escape.
|
|
@@ -364,6 +370,11 @@ export default {
|
|
|
364
370
|
-webkit-tap-highlight-color: transparent;
|
|
365
371
|
}
|
|
366
372
|
|
|
373
|
+
&--fit-to-content {
|
|
374
|
+
display: inline-flex;
|
|
375
|
+
flex-grow: 0;
|
|
376
|
+
}
|
|
377
|
+
|
|
367
378
|
// Selection wrapper.
|
|
368
379
|
// ------------------------------------------------------
|
|
369
380
|
&__selection-wrap {
|
|
@@ -419,21 +430,21 @@ export default {
|
|
|
419
430
|
}
|
|
420
431
|
}
|
|
421
432
|
|
|
422
|
-
//
|
|
433
|
+
// Selection (contenteditable) field.
|
|
434
|
+
// Using contenteditable instead of readonly input in order to be able to fit to content.
|
|
435
|
+
// Then disable typing and hide caret.
|
|
423
436
|
// ------------------------------------------------------
|
|
424
437
|
&__selection {
|
|
425
438
|
width: 100%;
|
|
426
439
|
height: 100%;
|
|
427
440
|
min-height: inherit;
|
|
428
|
-
font: inherit;
|
|
429
|
-
color: inherit;
|
|
430
|
-
text-align: inherit;
|
|
431
|
-
background: none;
|
|
432
|
-
border: none;
|
|
433
441
|
outline: none;
|
|
434
442
|
padding-left: 2 * $base-increment;
|
|
435
443
|
padding-right: 2 * $base-increment;
|
|
444
|
+
display: flex;
|
|
445
|
+
align-items: center;
|
|
436
446
|
cursor: pointer;
|
|
447
|
+
caret-color: transparent;
|
|
437
448
|
|
|
438
449
|
.w-select__selection-slot + & {
|
|
439
450
|
position: absolute;
|
|
@@ -459,9 +470,9 @@ export default {
|
|
|
459
470
|
-webkit-tap-highlight-color: transparent;
|
|
460
471
|
}
|
|
461
472
|
|
|
462
|
-
.w-select--disabled input::placeholder {color: inherit;}
|
|
463
|
-
|
|
464
473
|
.w-select--readonly & {cursor: auto;}
|
|
474
|
+
|
|
475
|
+
&--placeholder {color: #888;}
|
|
465
476
|
}
|
|
466
477
|
|
|
467
478
|
&__selection-slot {
|
|
@@ -525,6 +536,7 @@ export default {
|
|
|
525
536
|
top: 50%;
|
|
526
537
|
left: 0;
|
|
527
538
|
right: 0;
|
|
539
|
+
white-space: nowrap;
|
|
528
540
|
// Use margin instead of padding as the scale transformation below decreases the real padding
|
|
529
541
|
// size and misaligns the label.
|
|
530
542
|
margin-left: 2 * $base-increment;
|
|
@@ -78,6 +78,7 @@ export default {
|
|
|
78
78
|
counts: { type: Boolean },
|
|
79
79
|
itemIconKey: { type: String, default: 'icon' }, // Support a different icon per item.
|
|
80
80
|
iconColor: { type: String }, // Applies a color on all the label item icons.
|
|
81
|
+
itemLabelKey: { type: String, default: 'label' }, // Specify a different key for the item label.
|
|
81
82
|
itemIconColorKey: { type: String, default: 'iconColor' }, // Applies a specific color on each label item icons.
|
|
82
83
|
itemRouteKey: { type: String, default: 'route' }, // Uses a router link if the item has the `route` key.
|
|
83
84
|
itemDisabledKey: { type: String, default: 'disabled' }, // Disables the item click and selection.
|
|
@@ -117,7 +118,7 @@ export default {
|
|
|
117
118
|
this.currentDepthItems.push({
|
|
118
119
|
originalItem: item, // Store the original item to return it on event emits.
|
|
119
120
|
_uid: this.depth.toString() + (i + 1),
|
|
120
|
-
label: item.
|
|
121
|
+
label: item[this.itemLabelKey],
|
|
121
122
|
children: !!item.children, // The children tree remains available in originalItem.
|
|
122
123
|
branch: item.branch,
|
|
123
124
|
route: item[this.itemRouteKey],
|