wave-ui 2.34.0 → 2.36.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/dist/wave-ui.cjs.js +1 -1
- package/dist/wave-ui.css +1 -1
- package/dist/wave-ui.es.js +472 -483
- package/dist/wave-ui.umd.js +1 -1
- package/package.json +12 -13
- package/src/wave-ui/components/transitions/w-transition-expand.vue +1 -13
- package/src/wave-ui/components/w-accordion.vue +50 -18
- package/src/wave-ui/components/w-card.vue +3 -4
- package/src/wave-ui/components/w-checkbox.vue +11 -6
- package/src/wave-ui/components/w-checkboxes.vue +7 -16
- package/src/wave-ui/components/w-dialog.vue +18 -9
- package/src/wave-ui/components/w-divider.vue +4 -1
- package/src/wave-ui/components/w-drawer.vue +38 -12
- package/src/wave-ui/components/w-form-element.vue +14 -14
- package/src/wave-ui/components/w-form.vue +16 -11
- package/src/wave-ui/components/w-icon.vue +19 -19
- package/src/wave-ui/components/w-input.vue +14 -37
- package/src/wave-ui/components/w-menu.vue +48 -50
- package/src/wave-ui/components/w-notification.vue +3 -1
- package/src/wave-ui/components/w-overlay.vue +21 -14
- package/src/wave-ui/components/w-radio.vue +11 -6
- package/src/wave-ui/components/w-radios.vue +5 -13
- package/src/wave-ui/components/w-select.vue +13 -28
- package/src/wave-ui/components/w-slider.vue +21 -10
- package/src/wave-ui/components/w-switch.vue +44 -16
- package/src/wave-ui/components/w-textarea.vue +15 -17
- package/src/wave-ui/components/w-tooltip.vue +9 -21
- package/src/wave-ui/mixins/detachable.js +21 -28
- package/src/wave-ui/mixins/form-elements.js +9 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
component.w-icon(
|
|
3
3
|
:is="tag || 'i'"
|
|
4
|
-
:class="classes"
|
|
5
4
|
v-on="$attrs"
|
|
5
|
+
:class="classes"
|
|
6
6
|
role="icon"
|
|
7
7
|
aria-hidden="true"
|
|
8
|
-
:style="styles")
|
|
9
|
-
template(v-if="
|
|
8
|
+
:style="readIcon() /* Always reacting to slot change when called from template. */ && styles")
|
|
9
|
+
template(v-if="hasLigature") {{ icon }}
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
12
|
<script>
|
|
@@ -41,15 +41,13 @@ export default {
|
|
|
41
41
|
emits: [],
|
|
42
42
|
|
|
43
43
|
data: () => ({
|
|
44
|
-
icon: ''
|
|
44
|
+
icon: '',
|
|
45
|
+
fontName: ''
|
|
45
46
|
}),
|
|
46
47
|
|
|
47
48
|
computed: {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const [fontName, icon] = this.icon.split(' ')
|
|
52
|
-
return fontName === config.iconsLigature && { fontName, icon }
|
|
49
|
+
hasLigature () {
|
|
50
|
+
return config.iconsLigature === this.fontName
|
|
53
51
|
},
|
|
54
52
|
forcedSize () {
|
|
55
53
|
return this.size && (!isNaN(this.size) ? `${this.size}px` : this.size)
|
|
@@ -66,7 +64,8 @@ export default {
|
|
|
66
64
|
},
|
|
67
65
|
classes () {
|
|
68
66
|
return {
|
|
69
|
-
[this.
|
|
67
|
+
[this.fontName]: true,
|
|
68
|
+
[!this.hasLigature && this.icon]: !this.hasLigature && this.icon,
|
|
70
69
|
[this.color]: this.color,
|
|
71
70
|
[`${this.bgColor}--bg`]: this.bgColor,
|
|
72
71
|
[`size--${this.presetSize}`]: this.presetSize && !this.forcedSize,
|
|
@@ -80,8 +79,7 @@ export default {
|
|
|
80
79
|
'w-icon--rotate-90': this.rotate90a,
|
|
81
80
|
'w-icon--rotate-135': this.rotate135a,
|
|
82
81
|
'w-icon--flip-x': this.flipX,
|
|
83
|
-
'w-icon--flip-y': this.flipY
|
|
84
|
-
[this.ligature && this.ligature.fontName]: this.ligature
|
|
82
|
+
'w-icon--flip-y': this.flipY
|
|
85
83
|
}
|
|
86
84
|
},
|
|
87
85
|
styles () {
|
|
@@ -89,14 +87,15 @@ export default {
|
|
|
89
87
|
}
|
|
90
88
|
},
|
|
91
89
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
methods: {
|
|
91
|
+
readIcon () {
|
|
92
|
+
const { default: slot } = this.$slots
|
|
93
|
+
const [fontName = '', icon = ''] = typeof slot === 'function' && slot()[0].children.trim().split(' ') || []
|
|
94
|
+
this.fontName = fontName
|
|
95
|
+
this.icon = icon
|
|
95
96
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
updated () {
|
|
99
|
-
this.icon = this.$slots.default && this.$slots.default()[0].children
|
|
97
|
+
return true // Always return true for styles to be applied (c.f. template styles).
|
|
98
|
+
}
|
|
100
99
|
}
|
|
101
100
|
}
|
|
102
101
|
</script>
|
|
@@ -110,6 +109,7 @@ export default {
|
|
|
110
109
|
justify-content: center;
|
|
111
110
|
vertical-align: middle;
|
|
112
111
|
user-select: none;
|
|
112
|
+
speak: never;
|
|
113
113
|
line-height: 1;
|
|
114
114
|
font-size: 1.2em;
|
|
115
115
|
width: 1em;
|
|
@@ -13,15 +13,10 @@ component(
|
|
|
13
13
|
//- Left label.
|
|
14
14
|
template(v-if="labelPosition === 'left'")
|
|
15
15
|
label.w-input__label.w-input__label--left.w-form-el-shakable(
|
|
16
|
-
v-if="$slots.default"
|
|
16
|
+
v-if="$slots.default || label"
|
|
17
17
|
:for="`w-input--${_.uid}`"
|
|
18
|
-
:class="
|
|
19
|
-
slot
|
|
20
|
-
label.w-input__label.w-input__label--left.w-form-el-shakable(
|
|
21
|
-
v-else-if="label"
|
|
22
|
-
:for="`w-input--${_.uid}`"
|
|
23
|
-
:class="validationClasses"
|
|
24
|
-
v-html="label")
|
|
18
|
+
:class="labelClasses")
|
|
19
|
+
slot {{ label }}
|
|
25
20
|
|
|
26
21
|
//- Input wrapper.
|
|
27
22
|
.w-input__input-wrap(:class="inputWrapClasses")
|
|
@@ -81,15 +76,10 @@ component(
|
|
|
81
76
|
|
|
82
77
|
template(v-if="labelPosition === 'inside' && showLabelInside")
|
|
83
78
|
label.w-input__label.w-input__label--inside.w-form-el-shakable(
|
|
84
|
-
v-if="$slots.default"
|
|
85
|
-
:for="`w-input--${_.uid}`"
|
|
86
|
-
:class="validationClasses")
|
|
87
|
-
slot
|
|
88
|
-
label.w-input__label.w-input__label--inside.w-form-el-shakable(
|
|
89
|
-
v-else-if="label"
|
|
79
|
+
v-if="$slots.default || label"
|
|
90
80
|
:for="`w-input--${_.uid}`"
|
|
91
|
-
|
|
92
|
-
|
|
81
|
+
:class="labelClasses")
|
|
82
|
+
slot {{ label }}
|
|
93
83
|
w-icon.w-input__icon.w-input__icon--inner-right(
|
|
94
84
|
v-if="innerIconRight"
|
|
95
85
|
tag="label"
|
|
@@ -121,15 +111,10 @@ component(
|
|
|
121
111
|
//- Right label.
|
|
122
112
|
template(v-if="labelPosition === 'right'")
|
|
123
113
|
label.w-input__label.w-input__label--right.w-form-el-shakable(
|
|
124
|
-
v-if="$slots.default"
|
|
125
|
-
:for="`w-input--${_.uid}`"
|
|
126
|
-
:class="validationClasses")
|
|
127
|
-
slot
|
|
128
|
-
label.w-input__label.w-input__label--right.w-form-el-shakable(
|
|
129
|
-
v-else-if="label"
|
|
114
|
+
v-if="$slots.default || label"
|
|
130
115
|
:for="`w-input--${_.uid}`"
|
|
131
|
-
:class="
|
|
132
|
-
|
|
116
|
+
:class="labelClasses")
|
|
117
|
+
slot {{ label }}
|
|
133
118
|
</template>
|
|
134
119
|
|
|
135
120
|
<script>
|
|
@@ -151,12 +136,12 @@ export default {
|
|
|
151
136
|
labelPosition: { type: String, default: 'inside' },
|
|
152
137
|
innerIconLeft: { type: String },
|
|
153
138
|
innerIconRight: { type: String },
|
|
154
|
-
// When label is inside,
|
|
155
|
-
staticLabel: { type: Boolean },
|
|
139
|
+
staticLabel: { type: Boolean }, // When label is inside, fix the label above.
|
|
156
140
|
placeholder: { type: String },
|
|
157
141
|
color: { type: String, default: 'primary' },
|
|
158
|
-
progressColor: { type: String },
|
|
159
142
|
bgColor: { type: String },
|
|
143
|
+
labelColor: { type: String, default: 'primary' },
|
|
144
|
+
progressColor: { type: String },
|
|
160
145
|
minlength: { type: [Number, String] },
|
|
161
146
|
maxlength: { type: [Number, String] },
|
|
162
147
|
step: { type: [Number, String] },
|
|
@@ -248,7 +233,7 @@ export default {
|
|
|
248
233
|
},
|
|
249
234
|
|
|
250
235
|
overallFilesProgress () {
|
|
251
|
-
const progress = this.inputFiles.reduce((total, file) => total + file.progress, 0)
|
|
236
|
+
const progress = +this.inputFiles.reduce((total, file) => total + file.progress, 0)
|
|
252
237
|
const total = progress / this.inputFiles.length
|
|
253
238
|
this.$emit('update:overallProgress', this.inputFiles.length ? total : undefined)
|
|
254
239
|
|
|
@@ -280,15 +265,9 @@ export default {
|
|
|
280
265
|
}
|
|
281
266
|
},
|
|
282
267
|
|
|
283
|
-
validationClasses () {
|
|
284
|
-
return this.isFocused && {
|
|
285
|
-
[this.valid === false ? 'error' : this.color]: this.color || this.valid === false
|
|
286
|
-
}
|
|
287
|
-
},
|
|
288
|
-
|
|
289
268
|
inputWrapClasses () {
|
|
290
269
|
return {
|
|
291
|
-
[this.valid === false ?
|
|
270
|
+
[this.valid === false ? this.validationColor : this.color]: this.color || this.valid === false,
|
|
292
271
|
[`${this.bgColor}--bg`]: this.bgColor,
|
|
293
272
|
'w-input__input-wrap--file': this.type === 'file',
|
|
294
273
|
'w-input__input-wrap--round': this.round,
|
|
@@ -645,8 +624,6 @@ $inactive-color: #777;
|
|
|
645
624
|
.w-input--filled.w-input--floating-label.w-input--inner-icon-left & {left: 0;}
|
|
646
625
|
// Chrome & Safari - Must remain in a separated rule as Firefox discard the whole rule seeing -webkit-.
|
|
647
626
|
.w-input--floating-label.w-input--inner-icon-left .w-input__input:-webkit-autofill & {left: 0;}
|
|
648
|
-
|
|
649
|
-
.w-input--focused & {color: currentColor;}
|
|
650
627
|
}
|
|
651
628
|
}
|
|
652
629
|
</style>
|
|
@@ -1,57 +1,47 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
@update:model-value="detachableVisible = false")
|
|
2
|
+
slot(name="activator" :on="activatorEventHandlers")
|
|
3
|
+
transition(:name="transitionName" appear)
|
|
4
|
+
.w-menu(
|
|
5
|
+
v-if="custom && detachableVisible"
|
|
6
|
+
ref="detachable"
|
|
7
|
+
v-bind="$attrs"
|
|
8
|
+
@click="hideOnMenuClick && close(true)"
|
|
9
|
+
@mouseenter="showOnHover && (hoveringMenu = true)"
|
|
10
|
+
@mouseleave="showOnHover && ((hoveringMenu = false), close())"
|
|
11
|
+
:class="classes"
|
|
12
|
+
:style="styles")
|
|
13
|
+
slot
|
|
14
|
+
w-card.w-menu(
|
|
15
|
+
v-else-if="detachableVisible"
|
|
16
|
+
ref="detachable"
|
|
17
|
+
v-bind="$attrs"
|
|
18
|
+
@click.native="hideOnMenuClick && close(true)"
|
|
19
|
+
@mouseenter.native="showOnHover && (hoveringMenu = true)"
|
|
20
|
+
@mouseleave.native="showOnHover && ((hoveringMenu = false), close())"
|
|
21
|
+
:tile="tile"
|
|
22
|
+
:title-class="titleClasses"
|
|
23
|
+
:content-class="contentClasses"
|
|
24
|
+
:shadow="shadow"
|
|
25
|
+
:no-border="noBorder"
|
|
26
|
+
:class="classes"
|
|
27
|
+
:style="styles")
|
|
28
|
+
template(v-if="$slots.title" #title)
|
|
29
|
+
slot(name="title")
|
|
30
|
+
template(v-if="$slots.actions" #actions)
|
|
31
|
+
slot(name="actions")
|
|
32
|
+
slot
|
|
33
|
+
w-overlay(
|
|
34
|
+
v-if="overlay"
|
|
35
|
+
ref="overlay"
|
|
36
|
+
:model-value="detachableVisible"
|
|
37
|
+
:persistent="persistent"
|
|
38
|
+
:class="overlayClasses"
|
|
39
|
+
v-bind="overlayProps"
|
|
40
|
+
:z-index="(zIndex || 200) - 1"
|
|
41
|
+
@update:model-value="detachableVisible = false")
|
|
43
42
|
</template>
|
|
44
43
|
|
|
45
44
|
<script>
|
|
46
|
-
/**
|
|
47
|
-
* Complexity of this component: Vue 2.x can only mount 1 single root element, but we don't
|
|
48
|
-
* want to wrap the activator as it may break the layout.
|
|
49
|
-
* Another simpler way would be to append the menu inside the activator, but some HTML tags
|
|
50
|
-
* can't have children like <input>.
|
|
51
|
-
* So a solution is to mount both the activator element and the menu in a wrapper then unwrap
|
|
52
|
-
* and move the menu elsewhere in the DOM.
|
|
53
|
-
*/
|
|
54
|
-
|
|
55
45
|
import { objectifyClasses } from '../utils/index'
|
|
56
46
|
import DetachableMixin from '../mixins/detachable'
|
|
57
47
|
|
|
@@ -88,6 +78,14 @@ export default {
|
|
|
88
78
|
// alignRight, noPosition, zIndex, activator.
|
|
89
79
|
},
|
|
90
80
|
|
|
81
|
+
provide () {
|
|
82
|
+
return {
|
|
83
|
+
// If a detachable is used inside a w-menu without an appendTo, default to the menu element
|
|
84
|
+
// instead of the w-app.
|
|
85
|
+
detachableDefaultRoot: () => this.$refs.detachable?.$el || this.$refs.detachable || null
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
|
|
91
89
|
emits: ['input', 'update:modelValue', 'open', 'close'],
|
|
92
90
|
|
|
93
91
|
data: () => ({
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
transition(:name="transitionName" appear)
|
|
3
3
|
.w-notification(v-if="show" :class="classes" :style="styles")
|
|
4
|
-
w-alert.white--bg(
|
|
4
|
+
w-alert.white--bg(
|
|
5
|
+
v-bind="alertProps"
|
|
6
|
+
@update:model-value="$emit('update:modelValue', false);$emit('input', false)")
|
|
5
7
|
slot
|
|
6
8
|
</template>
|
|
7
9
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
|
-
transition(name="fade" appear @after-leave="
|
|
2
|
+
transition(name="fade" appear @after-leave="onClose")
|
|
3
3
|
.w-overlay(
|
|
4
|
-
v-if="
|
|
5
|
-
v-show="
|
|
4
|
+
v-if="modelValue"
|
|
5
|
+
v-show="showOverlay"
|
|
6
|
+
ref="overlay"
|
|
6
7
|
:style="(modelValue && styles) || null"
|
|
7
8
|
@keydown.escape.stop="onClick"
|
|
8
9
|
@click="onClick"
|
|
@@ -25,7 +26,15 @@ export default {
|
|
|
25
26
|
persistentNoAnimation: { type: Boolean }
|
|
26
27
|
},
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
provide () {
|
|
30
|
+
return {
|
|
31
|
+
// If a detachable is used inside a w-overlay without an appendTo, default to the overlay element
|
|
32
|
+
// instead of the w-app.
|
|
33
|
+
detachableDefaultRoot: () => this.$refs.overlay || null
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
emits: ['input', 'update:modelValue', 'click', 'before-close', 'close'],
|
|
29
38
|
|
|
30
39
|
data: () => ({
|
|
31
40
|
persistentAnimate: false,
|
|
@@ -60,21 +69,19 @@ export default {
|
|
|
60
69
|
setTimeout(() => (this.persistentAnimate = false), 150) // Must match CSS animation duration.
|
|
61
70
|
}
|
|
62
71
|
else if (!this.persistent) {
|
|
63
|
-
this
|
|
64
|
-
this.$emit('
|
|
65
|
-
this.$emit('close')
|
|
72
|
+
this.showOverlay = false
|
|
73
|
+
this.$emit('before-close')
|
|
66
74
|
}
|
|
67
75
|
|
|
68
76
|
this.$emit('click', e)
|
|
69
77
|
},
|
|
70
78
|
|
|
71
|
-
// Wait until the end of the closing transition to unmount
|
|
72
|
-
//
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
this.
|
|
77
|
-
this.$emit('closed')
|
|
79
|
+
// Wait until the end of the closing transition (v-show) to completely unmount (v-if).
|
|
80
|
+
// The onClose method is called twice from the transition: once for the v-show, and once for the v-if.
|
|
81
|
+
onClose () {
|
|
82
|
+
this.$emit('update:modelValue', false)
|
|
83
|
+
this.$emit('input', false)
|
|
84
|
+
if (!this.modelValue) this.$emit('close') // Only emit once.
|
|
78
85
|
}
|
|
79
86
|
},
|
|
80
87
|
|
|
@@ -20,16 +20,20 @@ component(
|
|
|
20
20
|
:aria-checked="inputValue || 'false'"
|
|
21
21
|
role="radio")
|
|
22
22
|
template(v-if="hasLabel && labelOnLeft")
|
|
23
|
-
label.w-radio__label.w-form-el-shakable.pr2(
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
label.w-radio__label.w-form-el-shakable.pr2(
|
|
24
|
+
v-if="$slots.default || label"
|
|
25
|
+
:for="`w-radio--${_.uid}`"
|
|
26
|
+
:class="labelClasses")
|
|
27
|
+
slot {{ label }}
|
|
26
28
|
.w-radio__input(
|
|
27
29
|
@click="$refs.input.focus();$refs.input.click()"
|
|
28
30
|
:class="this.color")
|
|
29
31
|
template(v-if="hasLabel && !labelOnLeft")
|
|
30
|
-
label.w-radio__label.w-form-el-shakable.pl2(
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
label.w-radio__label.w-form-el-shakable.pl2(
|
|
33
|
+
v-if="$slots.default || label"
|
|
34
|
+
:for="`w-radio--${_.uid}`"
|
|
35
|
+
:class="labelClasses")
|
|
36
|
+
slot {{ label }}
|
|
33
37
|
</template>
|
|
34
38
|
|
|
35
39
|
<script>
|
|
@@ -48,6 +52,7 @@ export default {
|
|
|
48
52
|
label: { type: String },
|
|
49
53
|
labelOnLeft: { type: Boolean },
|
|
50
54
|
color: { type: String, default: 'primary' },
|
|
55
|
+
labelColor: { type: String, default: 'primary' },
|
|
51
56
|
noRipple: { type: Boolean }
|
|
52
57
|
// Props from mixin: name, disabled, readonly, required, tabindex, validators.
|
|
53
58
|
// Computed from mixin: inputName, isDisabled & isReadonly.
|
|
@@ -15,22 +15,13 @@ component(
|
|
|
15
15
|
@update:model-value="onInput(item)"
|
|
16
16
|
@focus="$emit('focus', $event)"
|
|
17
17
|
:name="inputName"
|
|
18
|
-
|
|
19
|
-
:label-on-left="labelOnLeft"
|
|
20
|
-
:color="item.color"
|
|
18
|
+
v-bind="{ label: item.label, color: item.color, labelOnLeft, labelColor }"
|
|
21
19
|
:disabled="isDisabled || null"
|
|
22
20
|
:readonly="isReadonly || null"
|
|
23
21
|
:class="{ mt1: !inline && i }")
|
|
24
22
|
slot(
|
|
25
|
-
v-if="$slots[`item.${i + 1}`]"
|
|
26
|
-
:name="`item.${i + 1}`"
|
|
27
|
-
:item="getOriginalItem(item)"
|
|
28
|
-
:index="i + 1"
|
|
29
|
-
:checked="item.value === modelValue"
|
|
30
|
-
v-html="item.label")
|
|
31
|
-
slot(
|
|
32
|
-
v-else-if="$slots.item"
|
|
33
|
-
name="item"
|
|
23
|
+
v-if="$slots[`item.${i + 1}`] || $slots.item"
|
|
24
|
+
:name="$slots[`item.${i + 1}`] ? `item.${i + 1}` : 'item'"
|
|
34
25
|
:item="getOriginalItem(item)"
|
|
35
26
|
:index="i + 1"
|
|
36
27
|
:checked="item.value === modelValue"
|
|
@@ -53,7 +44,8 @@ export default {
|
|
|
53
44
|
itemValueKey: { type: String, default: 'value' },
|
|
54
45
|
itemColorKey: { type: String, default: 'color' }, // Support a different color per item.
|
|
55
46
|
inline: { type: Boolean },
|
|
56
|
-
color: { type: String, default: 'primary' }
|
|
47
|
+
color: { type: String, default: 'primary' },
|
|
48
|
+
labelColor: { type: String, default: 'primary' }
|
|
57
49
|
// Props from mixin: name, disabled, readonly, required, validators.
|
|
58
50
|
// Computed from mixin: inputName, isDisabled & isReadonly.
|
|
59
51
|
},
|
|
@@ -9,24 +9,19 @@ component(
|
|
|
9
9
|
:class="classes")
|
|
10
10
|
template(v-if="labelPosition === 'left'")
|
|
11
11
|
label.w-select__label.w-select__label--left.w-form-el-shakable(
|
|
12
|
-
v-if="$slots.default"
|
|
13
|
-
:for="`w-select--${_.uid}`")
|
|
14
|
-
slot
|
|
15
|
-
label.w-select__label.w-select__label--left.w-form-el-shakable(
|
|
16
|
-
v-else-if="label"
|
|
12
|
+
v-if="$slots.default || label"
|
|
17
13
|
:for="`w-select--${_.uid}`"
|
|
18
|
-
|
|
14
|
+
:class="labelClasses")
|
|
15
|
+
slot {{ label }}
|
|
19
16
|
|
|
20
17
|
w-menu(
|
|
21
18
|
v-model="showMenu"
|
|
22
19
|
:menu-class="`w-select__menu ${menuClass || ''}`"
|
|
23
20
|
transition="slide-fade-down"
|
|
24
|
-
:append-to="(menuProps || {}).appendTo !== undefined ? (menuProps || {}).appendTo :
|
|
21
|
+
:append-to="(menuProps || {}).appendTo !== undefined ? (menuProps || {}).appendTo : undefined"
|
|
25
22
|
align-left
|
|
26
23
|
custom
|
|
27
24
|
min-width="activator"
|
|
28
|
-
@mousedown="isFocused = true, selectingItem = true"
|
|
29
|
-
@mouseup="isFocused = true, selectingItem = false"
|
|
30
25
|
v-bind="menuProps || {}")
|
|
31
26
|
template(#activator="{ on }")
|
|
32
27
|
//- Input wrapper.
|
|
@@ -69,15 +64,10 @@ component(
|
|
|
69
64
|
:name="inputName + (multiple ? '[]' : '')")
|
|
70
65
|
template(v-if="labelPosition === 'inside' && showLabelInside")
|
|
71
66
|
label.w-select__label.w-select__label--inside.w-form-el-shakable(
|
|
72
|
-
v-if="$slots.default"
|
|
73
|
-
:for="`w-select--${_.uid}`"
|
|
74
|
-
:class="isFocused && { [valid === false ? 'error' : color]: color || valid === false }")
|
|
75
|
-
slot
|
|
76
|
-
label.w-select__label.w-select__label--inside.w-form-el-shakable(
|
|
77
|
-
v-else-if="label"
|
|
67
|
+
v-if="$slots.default || label"
|
|
78
68
|
:for="`w-select--${_.uid}`"
|
|
79
|
-
|
|
80
|
-
|
|
69
|
+
:class="labelClasses")
|
|
70
|
+
slot {{ label }}
|
|
81
71
|
w-icon.w-select__icon.w-select__icon--inner-right(
|
|
82
72
|
v-if="innerIconRight"
|
|
83
73
|
tag="label"
|
|
@@ -112,13 +102,10 @@ component(
|
|
|
112
102
|
|
|
113
103
|
template(v-if="labelPosition === 'right'")
|
|
114
104
|
label.w-select__label.w-select__label--right.w-form-el-shakable(
|
|
115
|
-
v-if="$slots.default"
|
|
116
|
-
:for="`w-select--${_.uid}`")
|
|
117
|
-
slot
|
|
118
|
-
label.w-select__label.w-select__label--right.w-form-el-shakable(
|
|
119
|
-
v-else-if="label"
|
|
105
|
+
v-if="$slots.default || label"
|
|
120
106
|
:for="`w-select--${_.uid}`"
|
|
121
|
-
|
|
107
|
+
:class="labelClasses")
|
|
108
|
+
slot {{ label }}
|
|
122
109
|
</template>
|
|
123
110
|
|
|
124
111
|
<script>
|
|
@@ -149,8 +136,9 @@ export default {
|
|
|
149
136
|
itemClass: { type: String },
|
|
150
137
|
menuClass: { type: String },
|
|
151
138
|
color: { type: String, default: 'primary' }, // Applies to all the items.
|
|
152
|
-
selectionColor: { type: String, default: 'primary' }, // Applies to the selected items only.
|
|
153
139
|
bgColor: { type: String }, // Applies to all the items.
|
|
140
|
+
labelColor: { type: String, default: 'primary' },
|
|
141
|
+
selectionColor: { type: String, default: 'primary' }, // Applies to the selected items only.
|
|
154
142
|
outline: { type: Boolean },
|
|
155
143
|
round: { type: Boolean },
|
|
156
144
|
shadow: { type: Boolean },
|
|
@@ -174,7 +162,6 @@ export default {
|
|
|
174
162
|
showMenu: false,
|
|
175
163
|
menuMinWidth: 0,
|
|
176
164
|
isFocused: false,
|
|
177
|
-
selectingItem: false,
|
|
178
165
|
selectionWrapRef: undefined
|
|
179
166
|
}),
|
|
180
167
|
|
|
@@ -212,7 +199,7 @@ export default {
|
|
|
212
199
|
'w-select--disabled': this.isDisabled,
|
|
213
200
|
'w-select--readonly': this.isReadonly,
|
|
214
201
|
[`w-select--${this.hasValue ? 'filled' : 'empty'}`]: true,
|
|
215
|
-
'w-select--focused': (this.isFocused || this.
|
|
202
|
+
'w-select--focused': (this.isFocused || this.showMenu) && !this.isReadonly,
|
|
216
203
|
'w-select--dark': this.dark,
|
|
217
204
|
'w-select--floating-label': this.hasLabel && this.labelPosition === 'inside' && !this.staticLabel,
|
|
218
205
|
'w-select--no-padding': !this.outline && !this.bgColor && !this.shadow && !this.round,
|
|
@@ -578,8 +565,6 @@ export default {
|
|
|
578
565
|
.w-select--filled.w-select--floating-label.w-select--inner-icon-left & {left: 0;}
|
|
579
566
|
// Chrome & Safari - Must remain in a separated rule as Firefox discard the whole rule seeing -webkit-.
|
|
580
567
|
.w-select--floating-label.w-select--inner-icon-left .w-select__select:-webkit-autofill & {left: 0;}
|
|
581
|
-
|
|
582
|
-
.w-select--focused &, .w-select--open & {color: currentColor;}
|
|
583
568
|
}
|
|
584
569
|
|
|
585
570
|
// Menu.
|
|
@@ -5,15 +5,17 @@ component(
|
|
|
5
5
|
v-bind="formRegister && { validators, inputValue: rangeValueScaled, disabled: isDisabled, readonly: isReadonly }"
|
|
6
6
|
v-model:valid="valid"
|
|
7
7
|
@reset="rangeValuePercent = 0;updateRangeValueScaled()"
|
|
8
|
-
wrap
|
|
8
|
+
:wrap="formRegister || null"
|
|
9
9
|
:class="wrapperClasses")
|
|
10
10
|
label.w-slider__label.w-slider__label--left.w-form-el-shakable(
|
|
11
11
|
v-if="$slots['label-left']"
|
|
12
|
-
:for="`button--${_.uid}`"
|
|
12
|
+
:for="`button--${_.uid}`"
|
|
13
|
+
:class="labelClasses")
|
|
13
14
|
slot(name="label-left")
|
|
14
15
|
label.w-slider__label.w-slider__label--left.w-form-el-shakable(
|
|
15
16
|
v-else-if="labelLeft"
|
|
16
17
|
:for="`button--${_.uid}`"
|
|
18
|
+
:class="labelClasses"
|
|
17
19
|
v-html="labelLeft")
|
|
18
20
|
.w-slider__track-wrap
|
|
19
21
|
.w-slider__track(
|
|
@@ -39,6 +41,7 @@ component(
|
|
|
39
41
|
:disabled="isDisabled || null"
|
|
40
42
|
:readonly="isReadonly || null"
|
|
41
43
|
:aria-readonly="isReadonly ? 'true' : 'false'"
|
|
44
|
+
:tabindex="isDisabled || isReadonly ? -1 : null"
|
|
42
45
|
@keydown.left="onKeyDown($event, -1)"
|
|
43
46
|
@keydown.right="onKeyDown($event, 1)"
|
|
44
47
|
@focus="$emit('focus', $event)"
|
|
@@ -64,11 +67,13 @@ component(
|
|
|
64
67
|
style="left: 100%") {{ this.maxVal }}
|
|
65
68
|
label.w-slider__label.w-slider__label--right.w-form-el-shakable(
|
|
66
69
|
v-if="$slots['label-right']"
|
|
67
|
-
:for="`button--${_.uid}`"
|
|
70
|
+
:for="`button--${_.uid}`"
|
|
71
|
+
:class="labelClasses")
|
|
68
72
|
slot(name="label-right")
|
|
69
73
|
label.w-slider__label.w-slider__label--right.w-form-el-shakable(
|
|
70
74
|
v-else-if="labelRight"
|
|
71
75
|
:for="`button--${_.uid}`"
|
|
76
|
+
:class="labelClasses"
|
|
72
77
|
v-html="labelRight")
|
|
73
78
|
</template>
|
|
74
79
|
|
|
@@ -83,6 +88,7 @@ export default {
|
|
|
83
88
|
modelValue: { type: Number, default: 0 },
|
|
84
89
|
color: { type: String, default: 'primary' },
|
|
85
90
|
bgColor: { type: String },
|
|
91
|
+
labelColor: { type: String, default: 'primary' },
|
|
86
92
|
stepLabels: { type: [Boolean, Array] },
|
|
87
93
|
thumbLabel: { type: [Boolean, String] }, // One of true, false, 'droplet'.
|
|
88
94
|
thumbLabelClass: { type: String },
|
|
@@ -378,16 +384,17 @@ export default {
|
|
|
378
384
|
&:before, &:after {
|
|
379
385
|
content: '';
|
|
380
386
|
position: absolute;
|
|
387
|
+
border-radius: inherit;
|
|
388
|
+
@include default-transition;
|
|
381
389
|
}
|
|
390
|
+
// Colored border on thumb when hover and active - but with a transparency.
|
|
382
391
|
&:before {
|
|
383
392
|
left: 0;
|
|
384
393
|
right: 0;
|
|
385
394
|
top: 0;
|
|
386
395
|
bottom: 0;
|
|
387
396
|
opacity: 0.5;
|
|
388
|
-
border-radius: inherit;
|
|
389
397
|
border: 1px solid currentColor;
|
|
390
|
-
@include default-transition;
|
|
391
398
|
}
|
|
392
399
|
&:hover:before, &:focus:before {opacity: 0.7;}
|
|
393
400
|
&:active:before, .w-slider--dragging &:before {
|
|
@@ -398,13 +405,17 @@ export default {
|
|
|
398
405
|
.w-slider--disabled &:before,
|
|
399
406
|
.w-slider--readonly &:before {box-shadow: none;opacity: 0.4;}
|
|
400
407
|
|
|
401
|
-
//
|
|
408
|
+
// The outline when focused, but also a bigger reactive zone for fat fingers when not.
|
|
402
409
|
&:after {
|
|
403
|
-
left: -
|
|
404
|
-
right: -
|
|
405
|
-
top: -
|
|
406
|
-
bottom: -
|
|
410
|
+
left: -2 * $base-increment;
|
|
411
|
+
right: -2 * $base-increment;
|
|
412
|
+
top: -2 * $base-increment;
|
|
413
|
+
bottom: -2 * $base-increment;
|
|
414
|
+
opacity: 0;
|
|
415
|
+
background-color: currentColor;
|
|
407
416
|
}
|
|
417
|
+
&:focus:after {opacity: 0.15;}
|
|
418
|
+
.w-slider--dragging &:after, &:active:after {opacity: 0.1;transform: scale(1.2);}
|
|
408
419
|
}
|
|
409
420
|
|
|
410
421
|
// Thumb label.
|