wave-ui 3.4.2 → 3.4.4
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 +108 -104
- package/dist/wave-ui.umd.js +1 -1
- package/package.json +3 -2
- package/src/wave-ui/components/w-card.vue +7 -2
- package/src/wave-ui/components/w-select.vue +20 -10
- package/src/wave-ui/components/w-tree.vue +50 -34
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wave-ui",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.4",
|
|
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",
|
|
@@ -46,7 +46,8 @@
|
|
|
46
46
|
"build": "vite build --base /wave-ui/",
|
|
47
47
|
"build-bundle": "BUNDLE=true vite build && mv ./dist/style.css ./dist/wave-ui.css",
|
|
48
48
|
"serve": "vite preview --base /wave-ui/",
|
|
49
|
-
"lint": "vite lint"
|
|
49
|
+
"lint": "vite lint",
|
|
50
|
+
"publish": "npm run build && npm run build-bundle && git add . && git commit -m 'Publish documentation on Github.' && git push && git push --tag && npm publish --tag latest"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
53
|
"@babel/core": "^7.21.3",
|
|
@@ -103,12 +103,17 @@ export default {
|
|
|
103
103
|
padding: (2 * $base-increment) (3 * $base-increment);
|
|
104
104
|
font-size: 1.3em;
|
|
105
105
|
border-bottom: $border;
|
|
106
|
-
border-top-left-radius: inherit;
|
|
107
|
-
border-top-right-radius: inherit;
|
|
108
106
|
|
|
109
107
|
&--has-toolbar {padding: 0;border-bottom: none;}
|
|
110
108
|
}
|
|
111
109
|
|
|
110
|
+
// When there is no title apply the border radius to the image.
|
|
111
|
+
&__image:first-child {
|
|
112
|
+
border-top-left-radius: inherit;
|
|
113
|
+
border-top-right-radius: inherit;
|
|
114
|
+
overflow: hidden;
|
|
115
|
+
}
|
|
116
|
+
|
|
112
117
|
&__content {
|
|
113
118
|
padding: 3 * $base-increment;
|
|
114
119
|
flex-grow: 1;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
component(
|
|
3
3
|
ref="formEl"
|
|
4
4
|
:is="formRegister ? 'w-form-element' : 'div'"
|
|
5
|
-
v-bind="formRegister && { validators, inputValue: selectionString, disabled: isDisabled, readonly: isReadonly }"
|
|
5
|
+
v-bind="formRegister && { validators, inputValue: selectionString, disabled: isDisabled, readonly: isReadonly, isFocused }"
|
|
6
6
|
v-model:valid="valid"
|
|
7
7
|
@reset="onReset"
|
|
8
8
|
:wrap="hasLabel && labelPosition !== 'inside'"
|
|
@@ -16,6 +16,7 @@ component(
|
|
|
16
16
|
|
|
17
17
|
w-menu(
|
|
18
18
|
v-model="showMenu"
|
|
19
|
+
@close="!$event && closeMenu()"
|
|
19
20
|
:menu-class="`w-select__menu ${menuClass || ''}`"
|
|
20
21
|
transition="slide-fade-down"
|
|
21
22
|
:append-to="(menuProps || {}).appendTo !== undefined ? (menuProps || {}).appendTo : undefined"
|
|
@@ -26,7 +27,7 @@ component(
|
|
|
26
27
|
template(#activator="{ on }")
|
|
27
28
|
//- Input wrapper.
|
|
28
29
|
.w-select__selection-wrap(
|
|
29
|
-
@click="!isDisabled && !isReadonly && (
|
|
30
|
+
@click="!isDisabled && !isReadonly && onInputFieldClick()"
|
|
30
31
|
role="button"
|
|
31
32
|
aria-haspopup="listbox"
|
|
32
33
|
:aria-expanded="showMenu ? 'true' : 'false'"
|
|
@@ -76,8 +77,8 @@ component(
|
|
|
76
77
|
@update:model-value="onInput"
|
|
77
78
|
@item-click="$emit('item-click', $event)"
|
|
78
79
|
@item-select="onListItemSelect"
|
|
79
|
-
@keydown:enter="noUnselect && !multiple && closeMenu()"
|
|
80
|
-
@keydown:escape="closeMenu"
|
|
80
|
+
@keydown:enter="noUnselect && !multiple && closeMenu('la3')"
|
|
81
|
+
@keydown:escape="showMenu && (this.showMenu = false) /* Will call closeMenu() from w-menu(@close). */"
|
|
81
82
|
:items="selectItems"
|
|
82
83
|
:multiple="multiple"
|
|
83
84
|
arrows-navigation
|
|
@@ -228,12 +229,18 @@ export default {
|
|
|
228
229
|
|
|
229
230
|
methods: {
|
|
230
231
|
onFocus (e) {
|
|
232
|
+
if (this.isFocused) return
|
|
233
|
+
|
|
231
234
|
this.isFocused = true
|
|
232
235
|
this.$emit('focus', e)
|
|
233
236
|
return false
|
|
234
237
|
},
|
|
235
238
|
|
|
236
239
|
onBlur (e) {
|
|
240
|
+
// As long as the menu is open the focus is still on.
|
|
241
|
+
// When closing the menu, the focus is given back to the input (not blur yet).
|
|
242
|
+
if (this.showMenu) return
|
|
243
|
+
|
|
237
244
|
this.isFocused = false
|
|
238
245
|
this.$emit('blur', e)
|
|
239
246
|
},
|
|
@@ -242,11 +249,10 @@ export default {
|
|
|
242
249
|
// Forbid typing in contenteditable element.
|
|
243
250
|
// Note: using contenteditable rather than input in order to be able to fit the select list
|
|
244
251
|
// to its content with CSS. Only contenteditable divs/non-interactive elements can react to focus/blur ).
|
|
245
|
-
|
|
252
|
+
// still allow meta key & ctrl key combinations and the tab key (9).
|
|
253
|
+
if (!e.metaKey && !e.ctrlKey && e.keyCode !== 9) e.preventDefault()
|
|
246
254
|
|
|
247
|
-
if (
|
|
248
|
-
|
|
249
|
-
if (e.keyCode === 27) this.closeMenu() // Escape.
|
|
255
|
+
if (e.keyCode === 27 && this.showMenu) this.closeMenu('la5') // Escape.
|
|
250
256
|
else if (e.keyCode === 13) this.openMenu() // Enter.
|
|
251
257
|
|
|
252
258
|
// Up & down arrows.
|
|
@@ -285,12 +291,16 @@ export default {
|
|
|
285
291
|
this.$emit('update:modelValue', selection)
|
|
286
292
|
this.$emit('input', selection)
|
|
287
293
|
},
|
|
294
|
+
onInputFieldClick () {
|
|
295
|
+
if (this.showMenu) this.showMenu = false // Will call `closeMenu()` from w-menu(@close).
|
|
296
|
+
else this.openMenu()
|
|
297
|
+
},
|
|
288
298
|
|
|
289
299
|
// Called on item selection: on click & `enter` keydown.
|
|
290
300
|
onListItemSelect (e) {
|
|
291
301
|
this.$emit('item-select', e)
|
|
292
302
|
// Close menu after selection on single select, but keep open if multiple.
|
|
293
|
-
if (!this.multiple) this.closeMenu()
|
|
303
|
+
if (!this.multiple) this.showMenu = false // Will call `closeMenu()` from w-menu(@close).
|
|
294
304
|
},
|
|
295
305
|
|
|
296
306
|
onReset () {
|
|
@@ -333,7 +343,7 @@ export default {
|
|
|
333
343
|
|
|
334
344
|
// Close the dropdown selection list.
|
|
335
345
|
closeMenu () {
|
|
336
|
-
if (
|
|
346
|
+
if (this.menuProps?.hideOnMenuClick === false) return
|
|
337
347
|
|
|
338
348
|
this.showMenu = false
|
|
339
349
|
// Set the focus back on the main w-select input.
|
|
@@ -28,15 +28,19 @@ ul.w-tree(:class="classes")
|
|
|
28
28
|
:depth="depth"
|
|
29
29
|
:path="item.path"
|
|
30
30
|
:open="item.open")
|
|
31
|
-
w-icon(
|
|
31
|
+
w-icon(
|
|
32
|
+
v-if="itemIcon(item)"
|
|
33
|
+
class="w-tree__item-icon"
|
|
34
|
+
:color="item.originalItem[itemIconColorKey] || iconColor").
|
|
35
|
+
{{ itemIcon(item) }}
|
|
32
36
|
span(v-html="item.label")
|
|
33
37
|
span.ml1(v-if="counts && (item.children || item.branch)").
|
|
34
38
|
({{ item.originalItem.children?.length || 0 }})
|
|
35
39
|
component(
|
|
36
40
|
:is="noTransition ? 'div' : 'w-transition-expand'"
|
|
37
41
|
:y="!noTransition || null"
|
|
38
|
-
@after-enter="$emit('open',
|
|
39
|
-
@after-leave="$emit('close',
|
|
42
|
+
@after-enter="$emit('open', emitPayload(item))"
|
|
43
|
+
@after-leave="$emit('close', emitPayload(item))")
|
|
40
44
|
w-tree(
|
|
41
45
|
v-if="item.children && item.open"
|
|
42
46
|
v-bind="$props"
|
|
@@ -104,6 +108,7 @@ export default {
|
|
|
104
108
|
return {
|
|
105
109
|
[`w-tree--depth${this.depth}`]: true,
|
|
106
110
|
'w-tree--expand-icon': this.expandIcon && !this.depth,
|
|
111
|
+
'w-tree--selectable': this.selectable,
|
|
107
112
|
'w-tree--disabled': this.disabled && !this.depth,
|
|
108
113
|
'w-tree--no-expand-button': !this.expandIcon
|
|
109
114
|
}
|
|
@@ -130,6 +135,7 @@ export default {
|
|
|
130
135
|
branch: item.branch,
|
|
131
136
|
route: item[this.itemRouteKey],
|
|
132
137
|
disabled: item[this.itemDisabledKey],
|
|
138
|
+
selected: oldItems[i]?.selected || false,
|
|
133
139
|
depth: this.depth,
|
|
134
140
|
open: !!(oldItems[i]?.open || this.expandAll || item[this.itemOpenKey]),
|
|
135
141
|
parent: this.parent || null,
|
|
@@ -183,17 +189,12 @@ export default {
|
|
|
183
189
|
if (typeof open === 'boolean') item.open = open
|
|
184
190
|
else item.open = !item.open
|
|
185
191
|
|
|
186
|
-
const
|
|
187
|
-
item: item.originalItem,
|
|
188
|
-
open: item.open,
|
|
189
|
-
depth: this.depth,
|
|
190
|
-
path: this.getTreeItemPathForOutput(item)
|
|
191
|
-
}
|
|
192
|
+
const emitPayload = this.emitPayload(item)
|
|
192
193
|
|
|
193
|
-
this.$emit(item.open ? 'before-open' : 'before-close',
|
|
194
|
+
this.$emit(item.open ? 'before-open' : 'before-close', emitPayload)
|
|
194
195
|
|
|
195
196
|
if (!this.unexpandableEmpty && !item.children) {
|
|
196
|
-
this.$emit(item.open ? 'open' : 'close',
|
|
197
|
+
this.$emit(item.open ? 'open' : 'close', emitPayload)
|
|
197
198
|
}
|
|
198
199
|
|
|
199
200
|
return true // Just to chain instructions.
|
|
@@ -203,29 +204,12 @@ export default {
|
|
|
203
204
|
const route = item[this.itemRouteKey]
|
|
204
205
|
if (route && this.$router && !this.hasExternalLink(item)) e.preventDefault()
|
|
205
206
|
|
|
206
|
-
this.$emit('click', {
|
|
207
|
-
item: item.originalItem,
|
|
208
|
-
depth: this.depth,
|
|
209
|
-
path: this.getTreeItemPathForOutput(item),
|
|
210
|
-
e
|
|
211
|
-
})
|
|
212
207
|
if (item.children || (item.branch && !this.unexpandableEmpty)) this.expandDepth(item)
|
|
208
|
+
if (this.selectable) item.selected = !item.selected
|
|
213
209
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
emitItemSelection (item, e) {
|
|
218
|
-
const emitParams = {
|
|
219
|
-
item: item.originalItem,
|
|
220
|
-
depth: this.depth,
|
|
221
|
-
path: this.getTreeItemPathForOutput(item),
|
|
222
|
-
e
|
|
223
|
-
}
|
|
224
|
-
if (item.children || (item.branch && !this.unexpandableEmpty)) {
|
|
225
|
-
emitParams.open = item.open
|
|
226
|
-
}
|
|
227
|
-
this.$emit('update:model-value', emitParams)
|
|
228
|
-
this.$emit('select', emitParams)
|
|
210
|
+
const emitPayload = this.emitPayload(item, e)
|
|
211
|
+
this.$emit('click', emitPayload)
|
|
212
|
+
this.emitItemSelection(item, e) // Always emitting on click, but different event for selection.
|
|
229
213
|
},
|
|
230
214
|
|
|
231
215
|
onLabelKeydown (item, e) {
|
|
@@ -254,7 +238,32 @@ export default {
|
|
|
254
238
|
}
|
|
255
239
|
}
|
|
256
240
|
|
|
257
|
-
if (
|
|
241
|
+
if (e.which === 13) {
|
|
242
|
+
if (this.selectable) item.selected = !item.selected
|
|
243
|
+
// Always emitting on enter keydown, but different event for selection.
|
|
244
|
+
this.emitItemSelection(item, e)
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
emitItemSelection (item, e) {
|
|
249
|
+
const emitPayload = this.emitPayload(item, e)
|
|
250
|
+
|
|
251
|
+
this.$emit('update:model-value', emitPayload)
|
|
252
|
+
if (this.selectable) this.$emit('select', emitPayload)
|
|
253
|
+
},
|
|
254
|
+
|
|
255
|
+
emitPayload (item, e) {
|
|
256
|
+
const emitPayload = {
|
|
257
|
+
item: item.originalItem,
|
|
258
|
+
depth: this.depth,
|
|
259
|
+
path: this.getTreeItemPathForOutput(item)
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (e) emitPayload.e = e
|
|
263
|
+
if (item.children || (item.branch && !this.unexpandableEmpty)) emitPayload.open = item.open
|
|
264
|
+
if (this.selectable) emitPayload.selected = item.selected
|
|
265
|
+
|
|
266
|
+
return emitPayload
|
|
258
267
|
},
|
|
259
268
|
|
|
260
269
|
/**
|
|
@@ -305,6 +314,7 @@ export default {
|
|
|
305
314
|
return {
|
|
306
315
|
[item.children || item.branch ? 'w-tree__item--branch' : 'w-tree__item--leaf']: true,
|
|
307
316
|
'w-tree__item--disabled': item[this.itemDisabledKey],
|
|
317
|
+
'w-tree__item--selected': item.selected,
|
|
308
318
|
'w-tree__item--empty': item.branch && !item.children,
|
|
309
319
|
'w-tree__item--unexpandable': item.branch && !item.children && this.unexpandableEmpty
|
|
310
320
|
}
|
|
@@ -359,12 +369,18 @@ $expand-icon-size: 20px;
|
|
|
359
369
|
border-radius: $border-radius;
|
|
360
370
|
}
|
|
361
371
|
&:hover:before {background-color: $primary;opacity: 0.1;}
|
|
362
|
-
&:focus:before {background-color: $primary;opacity: 0.
|
|
372
|
+
&:focus-visible:before {background-color: $primary;opacity: 0.15;}
|
|
363
373
|
}
|
|
374
|
+
&.w-tree--selectable &__item-label {cursor: pointer;}
|
|
375
|
+
&.w-tree--selectable &__item--disabled &__item-label {cursor: auto;}
|
|
364
376
|
&__item--leaf &__item-label:before {
|
|
365
377
|
left: - $base-increment;
|
|
366
378
|
right: - $base-increment;
|
|
367
379
|
}
|
|
380
|
+
&__item--selected > &__item-label:before {
|
|
381
|
+
background-color: $primary;
|
|
382
|
+
opacity: 0.25;
|
|
383
|
+
}
|
|
368
384
|
&__item--disabled &__item-label {opacity: 0.5;}
|
|
369
385
|
&__item--disabled &__item-label:before {display: none;}
|
|
370
386
|
|