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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wave-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.36.1",
|
|
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
|
"main": "./dist/wave-ui.umd.js",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"exports": {
|
|
11
11
|
"./dist/wave-ui.css": "./dist/wave-ui.css",
|
|
12
12
|
"./dist/wave-ui.cjs.js": "./dist/wave-ui.cjs.js",
|
|
13
|
+
"./src/wave-ui/": "./src/wave-ui/index.js",
|
|
13
14
|
".": {
|
|
14
15
|
"import": "./dist/wave-ui.es.js",
|
|
15
16
|
"require": "./dist/wave-ui.umd.js"
|
|
@@ -43,32 +44,30 @@
|
|
|
43
44
|
"*.vue"
|
|
44
45
|
],
|
|
45
46
|
"devDependencies": {
|
|
46
|
-
"@babel/core": "^7.17.
|
|
47
|
+
"@babel/core": "^7.17.9",
|
|
47
48
|
"@babel/eslint-parser": "^7.17.0",
|
|
48
49
|
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
49
50
|
"@mdi/font": "^5.9.55",
|
|
50
51
|
"@vitejs/plugin-vue": "^1.10.2",
|
|
51
52
|
"@vue/compiler-sfc": "3.1.5",
|
|
52
|
-
"autoprefixer": "^10.4.
|
|
53
|
+
"autoprefixer": "^10.4.4",
|
|
53
54
|
"axios": "^0.25.0",
|
|
54
55
|
"eslint": "^7.32.0",
|
|
55
56
|
"font-awesome": "^4.7.0",
|
|
56
|
-
"gsap": "^3.
|
|
57
|
+
"gsap": "^3.10.3",
|
|
57
58
|
"ionicons": "^4.6.3",
|
|
58
59
|
"material-design-icons": "^3.0.1",
|
|
60
|
+
"postcss": "^8.4.12",
|
|
59
61
|
"rollup-plugin-delete": "^2.0.0",
|
|
60
|
-
"sass": "^1.
|
|
62
|
+
"sass": "^1.50.0",
|
|
61
63
|
"simple-syntax-highlighter": "^2.2.0",
|
|
62
|
-
"splitpanes": "^3.
|
|
63
|
-
"vite": "^2.
|
|
64
|
-
"vite-plugin-pug": "^0.3.
|
|
65
|
-
"vue": "^3.2.
|
|
64
|
+
"splitpanes": "^3.1.1",
|
|
65
|
+
"vite": "^2.9.5",
|
|
66
|
+
"vite-plugin-pug": "^0.3.1",
|
|
67
|
+
"vue": "^3.2.33",
|
|
66
68
|
"vue-cal": "^4.2.0",
|
|
67
|
-
"vue-router": "^4.0.
|
|
69
|
+
"vue-router": "^4.0.14",
|
|
68
70
|
"vueperslides": "^3.3.2",
|
|
69
71
|
"vuex": "^4.0.2"
|
|
70
|
-
},
|
|
71
|
-
"dependencies": {
|
|
72
|
-
"postcss": "^8.4.6"
|
|
73
72
|
}
|
|
74
73
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
transition(
|
|
3
3
|
name="expand"
|
|
4
4
|
mode="out-in"
|
|
5
|
-
v-bind="$props"
|
|
6
5
|
:css="false"
|
|
7
6
|
@before-appear="beforeAppear"
|
|
8
7
|
@appear="appear"
|
|
@@ -17,15 +16,13 @@ transition(
|
|
|
17
16
|
</template>
|
|
18
17
|
|
|
19
18
|
<script>
|
|
20
|
-
// const duration = 250 // ms.
|
|
21
|
-
|
|
22
19
|
export default {
|
|
23
20
|
name: 'w-transition-expand',
|
|
24
21
|
|
|
25
22
|
props: {
|
|
26
23
|
x: { type: Boolean },
|
|
27
24
|
y: { type: Boolean },
|
|
28
|
-
duration: { type: Number, default:
|
|
25
|
+
duration: { type: Number, default: 250 }
|
|
29
26
|
},
|
|
30
27
|
|
|
31
28
|
data: () => ({
|
|
@@ -64,56 +61,47 @@ export default {
|
|
|
64
61
|
// Not when clicking very fast and mixing states order.
|
|
65
62
|
if (this.cleanTransitionCycle) this.saveOriginalStyles(el)
|
|
66
63
|
this.cleanTransitionCycle = false
|
|
67
|
-
this.$emit('before-appear')
|
|
68
64
|
},
|
|
69
65
|
appear (el, done) {
|
|
70
66
|
this.show(el)
|
|
71
67
|
setTimeout(done, this.duration)
|
|
72
68
|
this.cleanTransitionCycle = false
|
|
73
|
-
this.$emit('appear')
|
|
74
69
|
},
|
|
75
70
|
afterAppear (el) {
|
|
76
71
|
this.applyOriginalStyles(el)
|
|
77
72
|
// May be transitioning with v-show, if so don't reapply display none.
|
|
78
73
|
el.style.cssText = el.style.cssText.replace('display: none;', '')
|
|
79
74
|
this.cleanTransitionCycle = false
|
|
80
|
-
this.$emit('after-appear')
|
|
81
75
|
},
|
|
82
76
|
beforeEnter (el) {
|
|
83
77
|
// Only save original state once before a 'clean' transition start.
|
|
84
78
|
// Not when clicking very fast and mixing states order.
|
|
85
79
|
if (this.cleanTransitionCycle) this.saveOriginalStyles(el)
|
|
86
80
|
this.cleanTransitionCycle = false
|
|
87
|
-
this.$emit('before-enter')
|
|
88
81
|
},
|
|
89
82
|
enter (el, done) {
|
|
90
83
|
this.show(el)
|
|
91
84
|
setTimeout(done, this.duration)
|
|
92
85
|
this.cleanTransitionCycle = false
|
|
93
|
-
this.$emit('enter')
|
|
94
86
|
},
|
|
95
87
|
afterEnter (el) {
|
|
96
88
|
this.applyOriginalStyles(el)
|
|
97
89
|
// May be transitioning with v-show, if so don't reapply display none.
|
|
98
90
|
el.style.cssText = el.style.cssText.replace('display: none;', '')
|
|
99
91
|
this.cleanTransitionCycle = false
|
|
100
|
-
this.$emit('after-enter')
|
|
101
92
|
},
|
|
102
93
|
beforeLeave (el) {
|
|
103
94
|
this.beforeHide(el)
|
|
104
95
|
this.cleanTransitionCycle = false
|
|
105
|
-
this.$emit('before-leave')
|
|
106
96
|
},
|
|
107
97
|
leave (el, done) {
|
|
108
98
|
this.hide(el)
|
|
109
99
|
setTimeout(done, this.duration)
|
|
110
100
|
this.cleanTransitionCycle = false
|
|
111
|
-
this.$emit('leave')
|
|
112
101
|
},
|
|
113
102
|
afterLeave (el) {
|
|
114
103
|
this.applyOriginalStyles(el)
|
|
115
104
|
this.cleanTransitionCycle = true
|
|
116
|
-
this.$emit('after-leave')
|
|
117
105
|
},
|
|
118
106
|
|
|
119
107
|
applyHideStyles (el) {
|
|
@@ -38,20 +38,29 @@
|
|
|
38
38
|
@click.stop="!item._disabled && toggleItem(item, $event)"
|
|
39
39
|
:class="{ 'w-accordion__expand-icon--expanded': item._expanded }")
|
|
40
40
|
//- Content.
|
|
41
|
-
w-transition-expand(
|
|
42
|
-
|
|
41
|
+
w-transition-expand(
|
|
42
|
+
y
|
|
43
|
+
@after-leave="onEndOfCollapse(item)"
|
|
44
|
+
:duration="duration")
|
|
45
|
+
.w-accordion__item-content(
|
|
46
|
+
v-if="item._expanded"
|
|
47
|
+
:class="contentClass")
|
|
43
48
|
slot(
|
|
44
49
|
v-if="$slots[`item-content.${item.id || i + 1}`]"
|
|
45
50
|
:name="`item-content.${item.id || i + 1}`"
|
|
46
51
|
:item="getOriginalItem(item)"
|
|
47
|
-
:expanded="item._expanded"
|
|
48
|
-
|
|
52
|
+
:expanded="item._expanded"
|
|
53
|
+
:index="i + 1")
|
|
54
|
+
slot(
|
|
55
|
+
v-else
|
|
56
|
+
name="item-content"
|
|
57
|
+
:item="getOriginalItem(item)"
|
|
58
|
+
:expanded="item._expanded"
|
|
59
|
+
:index="i + 1")
|
|
49
60
|
div(v-html="item[itemContentKey]")
|
|
50
61
|
</template>
|
|
51
62
|
|
|
52
63
|
<script>
|
|
53
|
-
import { reactive } from 'vue'
|
|
54
|
-
|
|
55
64
|
export default {
|
|
56
65
|
name: 'w-accordion',
|
|
57
66
|
|
|
@@ -70,22 +79,17 @@ export default {
|
|
|
70
79
|
expandIconRight: { type: Boolean },
|
|
71
80
|
expandSingle: { type: Boolean },
|
|
72
81
|
collapseIcon: { type: String },
|
|
73
|
-
shadow: { type: Boolean }
|
|
82
|
+
shadow: { type: Boolean },
|
|
83
|
+
duration: { type: Number, default: 250 }
|
|
74
84
|
},
|
|
75
85
|
|
|
76
|
-
emits: ['input', 'update:modelValue', 'focus', 'item-expand'],
|
|
86
|
+
emits: ['input', 'update:modelValue', 'focus', 'item-expand', 'item-collapsed'],
|
|
77
87
|
|
|
78
|
-
|
|
79
|
-
accordionItems
|
|
80
|
-
|
|
81
|
-
return items.map((item, _index) => reactive({
|
|
82
|
-
...item,
|
|
83
|
-
_index,
|
|
84
|
-
_expanded: this.modelValue && this.modelValue[_index],
|
|
85
|
-
_disabled: !!item.disabled
|
|
86
|
-
}))
|
|
87
|
-
},
|
|
88
|
+
data: () => ({
|
|
89
|
+
accordionItems: []
|
|
90
|
+
}),
|
|
88
91
|
|
|
92
|
+
computed: {
|
|
89
93
|
accordionClasses () {
|
|
90
94
|
return {
|
|
91
95
|
[this.color]: this.color,
|
|
@@ -113,6 +117,9 @@ export default {
|
|
|
113
117
|
e.target.blur()
|
|
114
118
|
setTimeout(() => e.target.focus(), 300)
|
|
115
119
|
},
|
|
120
|
+
onEndOfCollapse (item) {
|
|
121
|
+
this.$emit('item-collapsed', { item, expanded: item._expanded })
|
|
122
|
+
},
|
|
116
123
|
// Return the original accordion item (so there is no `_index`, etc.).
|
|
117
124
|
getOriginalItem (item) {
|
|
118
125
|
return this.items[item._index]
|
|
@@ -124,6 +131,31 @@ export default {
|
|
|
124
131
|
'w-accordion__item--disabled': item._disabled,
|
|
125
132
|
[item[this.itemColorKey]]: item[this.itemColorKey]
|
|
126
133
|
}
|
|
134
|
+
},
|
|
135
|
+
updateItems () {
|
|
136
|
+
const items = typeof this.items === 'number' ? Array(this.items).fill({}) : this.items || []
|
|
137
|
+
this.accordionItems = items.map((item, _index) => ({
|
|
138
|
+
...item,
|
|
139
|
+
_index,
|
|
140
|
+
_expanded: this.modelValue && this.modelValue[_index],
|
|
141
|
+
_disabled: !!item.disabled
|
|
142
|
+
}))
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
created () {
|
|
147
|
+
this.updateItems()
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
watch: {
|
|
151
|
+
modelValue () {
|
|
152
|
+
this.updateItems()
|
|
153
|
+
},
|
|
154
|
+
items: {
|
|
155
|
+
handler () {
|
|
156
|
+
this.updateItems()
|
|
157
|
+
},
|
|
158
|
+
deep: true
|
|
127
159
|
}
|
|
128
160
|
}
|
|
129
161
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
.w-card(:class="classes")
|
|
3
3
|
.w-card__title(
|
|
4
|
-
v-if="$slots.title"
|
|
5
|
-
:class="{ 'w-card__title--has-toolbar': titleHasToolbar, ...titleClasses }")
|
|
6
|
-
slot(name="title")
|
|
7
|
-
.w-card__title(v-else-if="title" :class="titleClasses" v-html="title")
|
|
4
|
+
v-if="$slots.title || title"
|
|
5
|
+
:class="{ 'w-card__title--has-toolbar': $slots.title && titleHasToolbar, ...titleClasses }")
|
|
6
|
+
slot(name="title") {{ title }}
|
|
8
7
|
w-image.w-card__image(v-if="image" :src="image" v-bind="imgProps")
|
|
9
8
|
slot(name="image-content")
|
|
10
9
|
.w-card__content(:class="contentClasses")
|
|
@@ -22,16 +22,20 @@ component(
|
|
|
22
22
|
:aria-checked="isChecked || 'false'"
|
|
23
23
|
role="checkbox")
|
|
24
24
|
template(v-if="hasLabel && labelOnLeft")
|
|
25
|
-
label.w-checkbox__label.w-form-el-shakable.pr2(
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
label.w-checkbox__label.w-form-el-shakable.pr2(
|
|
26
|
+
v-if="$slots.default || label"
|
|
27
|
+
:for="`w-checkbox--${_.uid}`"
|
|
28
|
+
:class="labelClasses")
|
|
29
|
+
slot {{ label }}
|
|
28
30
|
.w-checkbox__input(@click="$refs.input.focus();$refs.input.click()" :class="this.color")
|
|
29
31
|
svg(width="11px" height="9px" viewbox="0 0 12 9")
|
|
30
32
|
polyline(points="1 5 4 8 10 2")
|
|
31
33
|
template(v-if="hasLabel && !labelOnLeft")
|
|
32
|
-
label.w-checkbox__label.w-form-el-shakable.pl2(
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
label.w-checkbox__label.w-form-el-shakable.pl2(
|
|
35
|
+
v-if="$slots.default || label"
|
|
36
|
+
:for="`w-checkbox--${_.uid}`"
|
|
37
|
+
:class="labelClasses")
|
|
38
|
+
slot {{ label }}
|
|
35
39
|
</template>
|
|
36
40
|
|
|
37
41
|
<script>
|
|
@@ -53,6 +57,7 @@ export default {
|
|
|
53
57
|
label: { type: String },
|
|
54
58
|
labelOnLeft: { type: Boolean },
|
|
55
59
|
color: { type: String, default: 'primary' },
|
|
60
|
+
labelColor: { type: String, default: 'primary' },
|
|
56
61
|
noRipple: { type: Boolean },
|
|
57
62
|
indeterminate: { type: Boolean },
|
|
58
63
|
round: { type: Boolean }
|
|
@@ -12,26 +12,16 @@ component(
|
|
|
12
12
|
v-for="(item, i) in checkboxItems"
|
|
13
13
|
:key="i"
|
|
14
14
|
:model-value="item._isChecked"
|
|
15
|
-
:name="`${name || `w-checkboxes--${_.uid}`}[]`"
|
|
16
|
-
:label="item.label"
|
|
17
|
-
:label-on-left="labelOnLeft"
|
|
18
|
-
:color="item.color"
|
|
19
|
-
:round="round"
|
|
20
15
|
@update:model-value="toggleCheck(item, $event)"
|
|
16
|
+
@focus="$emit('focus', $event)"
|
|
17
|
+
:name="`${inputName}[]`"
|
|
18
|
+
v-bind="{ label: item.label, color: item.color, labelOnLeft, labelColor, round }"
|
|
21
19
|
:disabled="isDisabled || null"
|
|
22
20
|
:readonly="isReadonly || null"
|
|
23
|
-
@focus="$emit('focus', $event)"
|
|
24
21
|
:class="{ mt1: !inline && i }")
|
|
25
22
|
slot(
|
|
26
|
-
v-if="$slots[`item.${i + 1}`]"
|
|
27
|
-
:name="`item.${i + 1}`"
|
|
28
|
-
:item="getOriginalItem(item)"
|
|
29
|
-
:checked="!!item._isChecked"
|
|
30
|
-
:index="i + 1"
|
|
31
|
-
v-html="item.label")
|
|
32
|
-
slot(
|
|
33
|
-
v-else-if="$slots.item"
|
|
34
|
-
name="item"
|
|
23
|
+
v-if="$slots[`item.${i + 1}`] || $slots.item"
|
|
24
|
+
:name="$slots[`item.${i + 1}`] ? `item.${i + 1}` : 'item'"
|
|
35
25
|
:item="getOriginalItem(item)"
|
|
36
26
|
:checked="!!item._isChecked"
|
|
37
27
|
:index="i + 1"
|
|
@@ -56,7 +46,8 @@ export default {
|
|
|
56
46
|
itemColorKey: { type: String, default: 'color' }, // Support a different color per item.
|
|
57
47
|
inline: { type: Boolean },
|
|
58
48
|
round: { type: Boolean },
|
|
59
|
-
color: { type: String, default: 'primary' }
|
|
49
|
+
color: { type: String, default: 'primary' },
|
|
50
|
+
labelColor: { type: String, default: 'primary' }
|
|
60
51
|
// Props from mixin: name, disabled, readonly, required, validators.
|
|
61
52
|
// Computed from mixin: inputName, isDisabled & isReadonly.
|
|
62
53
|
},
|
|
@@ -4,13 +4,14 @@ w-overlay.w-dialog(
|
|
|
4
4
|
:persistent="persistent"
|
|
5
5
|
:persistent-no-animation="persistentNoAnimation"
|
|
6
6
|
@click="onOutsideClick"
|
|
7
|
-
@
|
|
7
|
+
@close="onClose"
|
|
8
8
|
:bg-color="overlayColor"
|
|
9
9
|
:opacity="overlayOpacity"
|
|
10
10
|
:class="classes")
|
|
11
|
-
transition(:name="transition" appear @after-leave="
|
|
11
|
+
transition(:name="transition" appear @after-leave="onBeforeClose")
|
|
12
12
|
w-card.w-dialog__content(
|
|
13
13
|
v-show="showContent"
|
|
14
|
+
ref="dialog"
|
|
14
15
|
no-border
|
|
15
16
|
:color="color"
|
|
16
17
|
:bg-color="bgColor"
|
|
@@ -48,7 +49,15 @@ export default {
|
|
|
48
49
|
overlayOpacity: { type: [Number, String, Boolean] }
|
|
49
50
|
},
|
|
50
51
|
|
|
51
|
-
|
|
52
|
+
provide () {
|
|
53
|
+
return {
|
|
54
|
+
// If a detachable is used inside a w-drawer without an appendTo, default to the drawer element
|
|
55
|
+
// instead of the w-app.
|
|
56
|
+
detachableDefaultRoot: () => this.$refs.dialog.$el || null
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
emits: ['input', 'update:modelValue', 'before-close', 'close'],
|
|
52
61
|
|
|
53
62
|
data () {
|
|
54
63
|
return {
|
|
@@ -81,11 +90,14 @@ export default {
|
|
|
81
90
|
this.showContent = false
|
|
82
91
|
// If fade transition close both dialog and overlay at the same time
|
|
83
92
|
// (don't need to wait for the end of the dialog transition).
|
|
84
|
-
if (this.transition === 'fade') this.
|
|
93
|
+
if (this.transition === 'fade') this.onBeforeClose()
|
|
85
94
|
}
|
|
86
95
|
},
|
|
87
|
-
|
|
96
|
+
onBeforeClose () {
|
|
88
97
|
this.showWrapper = false
|
|
98
|
+
this.$emit('before-close')
|
|
99
|
+
},
|
|
100
|
+
onClose () {
|
|
89
101
|
this.$emit('update:modelValue', false)
|
|
90
102
|
this.$emit('input', false)
|
|
91
103
|
this.$emit('close')
|
|
@@ -94,10 +106,7 @@ export default {
|
|
|
94
106
|
|
|
95
107
|
watch: {
|
|
96
108
|
modelValue (value) {
|
|
97
|
-
|
|
98
|
-
// If value is false, keep the wrapper in DOM and close the dialog;
|
|
99
|
-
// At the end of the dialog transition the value is updated and wrapper removed from the DOM.
|
|
100
|
-
if (value) this.showWrapper = value
|
|
109
|
+
this.showWrapper = value
|
|
101
110
|
this.showContent = value
|
|
102
111
|
}
|
|
103
112
|
}
|
|
@@ -9,11 +9,19 @@
|
|
|
9
9
|
@click="onOutsideClick"
|
|
10
10
|
:persistent="persistent"
|
|
11
11
|
persistent-no-animation
|
|
12
|
-
:bg-color="overlayColor"
|
|
12
|
+
:bg-color="overlayColor || 'transparent'"
|
|
13
13
|
:opacity="overlayOpacity")
|
|
14
14
|
slot(name="pushable")
|
|
15
|
-
transition(
|
|
16
|
-
|
|
15
|
+
transition(
|
|
16
|
+
name="fade"
|
|
17
|
+
@before-leave="onBeforeClose"
|
|
18
|
+
@after-leave="onClose")
|
|
19
|
+
component.w-drawer(
|
|
20
|
+
v-if="showDrawer"
|
|
21
|
+
ref="drawer"
|
|
22
|
+
:is="tag || 'aside'"
|
|
23
|
+
:class="drawerClasses"
|
|
24
|
+
:style="styles")
|
|
17
25
|
slot
|
|
18
26
|
//- Other cases.
|
|
19
27
|
template(v-else)
|
|
@@ -25,8 +33,17 @@
|
|
|
25
33
|
persistent-no-animation
|
|
26
34
|
:bg-color="overlayColor"
|
|
27
35
|
:opacity="overlayOpacity")
|
|
28
|
-
transition(
|
|
29
|
-
|
|
36
|
+
transition(
|
|
37
|
+
:name="transitionName"
|
|
38
|
+
appear
|
|
39
|
+
@before-leave="onBeforeClose"
|
|
40
|
+
@after-leave="onClose")
|
|
41
|
+
component.w-drawer(
|
|
42
|
+
v-if="showDrawer"
|
|
43
|
+
ref="drawer"
|
|
44
|
+
:is="tag || 'aside'"
|
|
45
|
+
:class="drawerClasses"
|
|
46
|
+
:style="styles")
|
|
30
47
|
slot
|
|
31
48
|
</template>
|
|
32
49
|
|
|
@@ -62,7 +79,15 @@ export default {
|
|
|
62
79
|
tag: { type: String, default: 'aside' }
|
|
63
80
|
},
|
|
64
81
|
|
|
65
|
-
|
|
82
|
+
provide () {
|
|
83
|
+
return {
|
|
84
|
+
// If a detachable is used inside a w-drawer without an appendTo, default to the drawer element
|
|
85
|
+
// instead of the w-app.
|
|
86
|
+
detachableDefaultRoot: () => this.$refs.drawer || null
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
emits: ['input', 'update:modelValue', 'before-close', 'close'],
|
|
66
91
|
|
|
67
92
|
data () {
|
|
68
93
|
return {
|
|
@@ -113,7 +138,7 @@ export default {
|
|
|
113
138
|
// It moves inside the overflow hidden outer wrap.
|
|
114
139
|
trackStyles () {
|
|
115
140
|
return this.pushContent && this.showDrawer && {
|
|
116
|
-
transform: `translateX(${this.position === 'left' ? '' : '-'}${this.size})`
|
|
141
|
+
transform: `translateX(${this.position === 'left' ? '' : '-'}${this.size || '200px'})`
|
|
117
142
|
}
|
|
118
143
|
},
|
|
119
144
|
styles () {
|
|
@@ -133,18 +158,19 @@ export default {
|
|
|
133
158
|
},
|
|
134
159
|
|
|
135
160
|
methods: {
|
|
136
|
-
|
|
161
|
+
onBeforeClose () {
|
|
162
|
+
this.$emit('before-close')
|
|
163
|
+
},
|
|
164
|
+
onClose () {
|
|
137
165
|
this.showWrapper = false
|
|
138
166
|
this.$emit('update:modelValue', false)
|
|
139
167
|
this.$emit('input', false)
|
|
140
|
-
this.$emit('close'
|
|
168
|
+
this.$emit('close')
|
|
141
169
|
},
|
|
142
170
|
onOutsideClick () {
|
|
143
171
|
if (!this.persistent) {
|
|
144
|
-
// The close method is called on animation end
|
|
145
|
-
// (not using the same transition).
|
|
172
|
+
// The close method is called on animation end.
|
|
146
173
|
this.showDrawer = false
|
|
147
|
-
if (this.pushContent) this.close()
|
|
148
174
|
}
|
|
149
175
|
else if (!this.persistentNoAnimation) {
|
|
150
176
|
this.persistentAnimate = true
|
|
@@ -6,15 +6,25 @@ div(:class="classes")
|
|
|
6
6
|
//- Error message.
|
|
7
7
|
w-transition-expand(y)
|
|
8
8
|
template(v-if="Validation.message")
|
|
9
|
-
.w-form-el__error
|
|
10
|
-
slot(name="error-message" :message="Validation.message")
|
|
11
|
-
.w-form-el__error.error(v-else v-html="Validation.message" class="w-form-el__error w-form-el__error")
|
|
9
|
+
.w-form-el__error(:class="formProps.validationColor")
|
|
10
|
+
slot(name="error-message" :message="Validation.message") {{ Validation.message }}
|
|
12
11
|
</template>
|
|
13
12
|
|
|
14
13
|
<script>
|
|
15
14
|
export default {
|
|
16
15
|
name: 'w-form-element',
|
|
17
16
|
|
|
17
|
+
props: {
|
|
18
|
+
valid: { required: true },
|
|
19
|
+
disabled: { type: Boolean },
|
|
20
|
+
readonly: { type: Boolean },
|
|
21
|
+
inputValue: { required: true }, // The form element's input value.
|
|
22
|
+
validators: { type: Array },
|
|
23
|
+
isFocused: { default: false }, // Watched.
|
|
24
|
+
column: { default: false }, // Flex direction of the embedded component: column or row by default.
|
|
25
|
+
wrap: { default: false } // Flex-wrap if needed.
|
|
26
|
+
},
|
|
27
|
+
|
|
18
28
|
inject: {
|
|
19
29
|
formRegister: { default: null },
|
|
20
30
|
formUnregister: { default: null },
|
|
@@ -23,23 +33,13 @@ export default {
|
|
|
23
33
|
default: () => ({
|
|
24
34
|
noKeyupValidation: false,
|
|
25
35
|
noBlurValidation: false,
|
|
36
|
+
validationColor: 'error',
|
|
26
37
|
disabled: false,
|
|
27
38
|
readonly: false
|
|
28
39
|
})
|
|
29
40
|
}
|
|
30
41
|
},
|
|
31
42
|
|
|
32
|
-
props: {
|
|
33
|
-
valid: { required: true },
|
|
34
|
-
disabled: { type: Boolean },
|
|
35
|
-
readonly: { type: Boolean },
|
|
36
|
-
inputValue: { required: true }, // The form element's input value.
|
|
37
|
-
validators: { type: Array },
|
|
38
|
-
isFocused: { default: false }, // Watched.
|
|
39
|
-
column: { default: false }, // Flex direction of the embedded component: column or row by default.
|
|
40
|
-
wrap: { default: false } // Flex-wrap if needed.
|
|
41
|
-
},
|
|
42
|
-
|
|
43
43
|
emits: ['reset', 'update:valid'],
|
|
44
44
|
|
|
45
45
|
data: () => ({
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
|
-
form.w-form(
|
|
2
|
+
form.w-form(
|
|
3
|
+
@submit="onSubmit"
|
|
4
|
+
@reset="reset"
|
|
5
|
+
novalidate
|
|
6
|
+
:class="classes")
|
|
3
7
|
slot
|
|
4
8
|
</template>
|
|
5
9
|
|
|
@@ -16,6 +20,17 @@ const asyncSome = async (array, predicate) => {
|
|
|
16
20
|
export default {
|
|
17
21
|
name: 'w-form',
|
|
18
22
|
|
|
23
|
+
props: {
|
|
24
|
+
modelValue: {},
|
|
25
|
+
allowSubmit: { type: Boolean },
|
|
26
|
+
noKeyupValidation: { type: Boolean },
|
|
27
|
+
noBlurValidation: { type: Boolean },
|
|
28
|
+
errorPlaceholders: { type: Boolean },
|
|
29
|
+
validationColor: { type: String, default: 'error' },
|
|
30
|
+
disabled: { type: Boolean },
|
|
31
|
+
readonly: { type: Boolean }
|
|
32
|
+
},
|
|
33
|
+
|
|
19
34
|
provide () {
|
|
20
35
|
return {
|
|
21
36
|
formRegister: this.register,
|
|
@@ -27,16 +42,6 @@ export default {
|
|
|
27
42
|
}
|
|
28
43
|
},
|
|
29
44
|
|
|
30
|
-
props: {
|
|
31
|
-
modelValue: {},
|
|
32
|
-
allowSubmit: { type: Boolean },
|
|
33
|
-
noKeyupValidation: { type: Boolean },
|
|
34
|
-
noBlurValidation: { type: Boolean },
|
|
35
|
-
errorPlaceholders: { type: Boolean },
|
|
36
|
-
disabled: { type: Boolean },
|
|
37
|
-
readonly: { type: Boolean }
|
|
38
|
-
},
|
|
39
|
-
|
|
40
45
|
emits: [
|
|
41
46
|
'submit',
|
|
42
47
|
'before-validate',
|