@mozaic-ds/vue 0.35.0-beta.0 → 0.35.0-beta.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/README.md +1 -1
- package/dist/mozaic-vue.adeo.css +1 -1
- package/dist/mozaic-vue.adeo.umd.js +357 -53
- package/dist/mozaic-vue.common.js +357 -53
- package/dist/mozaic-vue.common.js.map +1 -1
- package/dist/mozaic-vue.css +1 -1
- package/dist/mozaic-vue.umd.js +350 -46
- package/dist/mozaic-vue.umd.js.map +1 -1
- package/dist/mozaic-vue.umd.min.js +2 -2
- package/dist/mozaic-vue.umd.min.js.map +1 -1
- package/package.json +5 -5
- package/src/components/autocomplete/MAutocomplete.vue +47 -13
- package/src/components/listbox/MListBox.vue +26 -39
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mozaic-ds/vue",
|
|
3
|
-
"version": "0.35.0-beta.
|
|
3
|
+
"version": "0.35.0-beta.2",
|
|
4
4
|
"description": "Vue.js implementation of Mozaic Design System",
|
|
5
5
|
"author": "Adeo - Mozaic Design System",
|
|
6
6
|
"scripts": {
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"@mozaic-ds/icons": "1.49.0",
|
|
28
28
|
"@mozaic-ds/styles": "1.51.0",
|
|
29
29
|
"@mozaic-ds/web-fonts": "1.22.0",
|
|
30
|
-
"core-js": "^3.27.
|
|
30
|
+
"core-js": "^3.27.1",
|
|
31
31
|
"libphonenumber-js": "^1.10.15",
|
|
32
32
|
"vue": "^2.6.14",
|
|
33
33
|
"vue-country-flag": "2.3.2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@babel/core": "^7.20.
|
|
36
|
+
"@babel/core": "^7.20.12",
|
|
37
37
|
"@babel/eslint-parser": "^7.19.1",
|
|
38
38
|
"@rushstack/eslint-patch": "^1.2.0",
|
|
39
39
|
"@vue/cli-plugin-babel": "~5.0.8",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"@vue/compiler-sfc": "^3.2.45",
|
|
42
42
|
"@vue/eslint-config-prettier": "^7.0.0",
|
|
43
43
|
"babel-eslint": "^10.1.0",
|
|
44
|
-
"eslint": "^8.
|
|
45
|
-
"eslint-config-prettier": "^8.
|
|
44
|
+
"eslint": "^8.31.0",
|
|
45
|
+
"eslint-config-prettier": "^8.6.0",
|
|
46
46
|
"eslint-plugin-vue": "^9.8.0",
|
|
47
47
|
"postcss": "^8.4.20",
|
|
48
48
|
"postcss-loader": "^7.0.2",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
:id="id"
|
|
22
22
|
v-model="inputValue"
|
|
23
23
|
:placeholder="placeholder"
|
|
24
|
-
:is-invalid="
|
|
24
|
+
:is-invalid="isInvalid"
|
|
25
25
|
:disabled="disabled"
|
|
26
26
|
:size="size"
|
|
27
|
-
:root-class="
|
|
27
|
+
:root-class="getInvalidRootClass"
|
|
28
28
|
text-input-field-class="mc-autocomplete__trigger"
|
|
29
29
|
icon-position="left"
|
|
30
30
|
icon="DisplaySearch48"
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
</button>
|
|
45
45
|
</div>
|
|
46
46
|
<MListBox
|
|
47
|
+
v-if="!isFiltered"
|
|
47
48
|
v-model="listboxValue"
|
|
48
49
|
:open="openState"
|
|
49
50
|
:items="localItems"
|
|
@@ -52,7 +53,6 @@
|
|
|
52
53
|
:data-key-expr="dataKeyExpr"
|
|
53
54
|
:data-text-expr="dataTextExpr"
|
|
54
55
|
:data-value-expr="dataValueExpr"
|
|
55
|
-
:is-filtered="isFiltered"
|
|
56
56
|
:max-width="maxWidth"
|
|
57
57
|
@change="onChangeListbox"
|
|
58
58
|
>
|
|
@@ -60,6 +60,9 @@
|
|
|
60
60
|
<slot name="item" :item="item"></slot>
|
|
61
61
|
</template>
|
|
62
62
|
</MListBox>
|
|
63
|
+
<div v-else class="mc-autocomplete__error">
|
|
64
|
+
{{ emptySearchLabel }}
|
|
65
|
+
</div>
|
|
63
66
|
</div>
|
|
64
67
|
</template>
|
|
65
68
|
|
|
@@ -230,6 +233,12 @@ export default {
|
|
|
230
233
|
hasValues() {
|
|
231
234
|
return this.inputValue?.length > 0;
|
|
232
235
|
},
|
|
236
|
+
isInvalid() {
|
|
237
|
+
return this.invalid || this.isFiltered;
|
|
238
|
+
},
|
|
239
|
+
getInvalidRootClass() {
|
|
240
|
+
return (this.isInvalid && 'is-invalid') || null;
|
|
241
|
+
},
|
|
233
242
|
},
|
|
234
243
|
|
|
235
244
|
watch: {
|
|
@@ -239,6 +248,13 @@ export default {
|
|
|
239
248
|
},
|
|
240
249
|
immediate: true,
|
|
241
250
|
},
|
|
251
|
+
localItems: {
|
|
252
|
+
handler: function (val) {
|
|
253
|
+
// this.localItems = val;
|
|
254
|
+
this.isFiltered = !val.length;
|
|
255
|
+
this.$emit('list-filtered', val);
|
|
256
|
+
},
|
|
257
|
+
},
|
|
242
258
|
input: {
|
|
243
259
|
handler: function (val) {
|
|
244
260
|
this.inputValue = val;
|
|
@@ -309,18 +325,24 @@ export default {
|
|
|
309
325
|
filterList(value) {
|
|
310
326
|
if (value.length && this.filter) {
|
|
311
327
|
this.filter(value);
|
|
312
|
-
} else if (value.length && this.filterOnType) {
|
|
313
|
-
this.localItems = this.items.filter((item) =>
|
|
314
|
-
item[this.dataTextExpr].toUpperCase().includes(value.toUpperCase())
|
|
315
|
-
);
|
|
316
|
-
|
|
317
|
-
this.isFiltered = !this.localItems.length;
|
|
318
328
|
} else {
|
|
319
|
-
this.
|
|
320
|
-
|
|
321
|
-
|
|
329
|
+
if (!this.filterOnType) {
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
322
332
|
|
|
323
|
-
|
|
333
|
+
if (value.length) {
|
|
334
|
+
this.localItems = this.items.filter((item) =>
|
|
335
|
+
item[this.dataTextExpr].toUpperCase().includes(value.toUpperCase())
|
|
336
|
+
);
|
|
337
|
+
|
|
338
|
+
// this.isFiltered = !this.localItems.length;
|
|
339
|
+
} else {
|
|
340
|
+
this.localItems = this.items;
|
|
341
|
+
// this.isFiltered = !this.localItems.length;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// this.$emit('list-filtered', this.localItems);
|
|
345
|
+
}
|
|
324
346
|
},
|
|
325
347
|
closeListBox() {
|
|
326
348
|
this.openState = false;
|
|
@@ -384,6 +406,18 @@ export default {
|
|
|
384
406
|
@import 'components/c.autocomplete';
|
|
385
407
|
|
|
386
408
|
.mc-autocomplete {
|
|
409
|
+
&__main {
|
|
410
|
+
position: relative;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
&__error {
|
|
414
|
+
@include set-font-scale('04', 'm');
|
|
415
|
+
|
|
416
|
+
color: $color-fields-error;
|
|
417
|
+
display: inline-block;
|
|
418
|
+
margin-top: $mu025;
|
|
419
|
+
}
|
|
420
|
+
|
|
387
421
|
.mc-autocomplete__trigger {
|
|
388
422
|
padding-right: $mu300;
|
|
389
423
|
}
|
|
@@ -6,37 +6,32 @@
|
|
|
6
6
|
:class="{ 'is-open': open, 'mc-listbox--multi': multiple }"
|
|
7
7
|
:style="{ '--listbox-width': maxWidth }"
|
|
8
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
|
-
</label>
|
|
36
|
-
</li>
|
|
37
|
-
</template>
|
|
38
|
-
<li v-else class="mc-listbox__item">
|
|
39
|
-
<span class="mc-listbox__empty">{{ emptySearchLabel }}</span>
|
|
9
|
+
<li
|
|
10
|
+
v-for="(item, index) in localItems"
|
|
11
|
+
:key="item.id"
|
|
12
|
+
class="mc-listbox__item"
|
|
13
|
+
>
|
|
14
|
+
<MIcon
|
|
15
|
+
v-if="item.icon"
|
|
16
|
+
:name="item.icon"
|
|
17
|
+
class="mc-listbox__icon"
|
|
18
|
+
color="#666666"
|
|
19
|
+
/>
|
|
20
|
+
<input
|
|
21
|
+
:id="setItemId(index)"
|
|
22
|
+
v-model="localValue"
|
|
23
|
+
class="mc-listbox__input"
|
|
24
|
+
:class="{ 'mc-checkbox__input': multiple }"
|
|
25
|
+
:type="multiple ? 'checkbox' : 'radio'"
|
|
26
|
+
:value="item[dataValueExpr]"
|
|
27
|
+
:name="!multiple ? `listboxradio-${uuid}` : null"
|
|
28
|
+
@change="onChange"
|
|
29
|
+
/>
|
|
30
|
+
<label :for="setItemId(index)" class="mc-listbox__label">
|
|
31
|
+
<slot name="item" :item="item">
|
|
32
|
+
{{ item[dataTextExpr] }}
|
|
33
|
+
</slot>
|
|
34
|
+
</label>
|
|
40
35
|
</li>
|
|
41
36
|
</ul>
|
|
42
37
|
</template>
|
|
@@ -64,18 +59,10 @@ export default {
|
|
|
64
59
|
type: Boolean,
|
|
65
60
|
default: false,
|
|
66
61
|
},
|
|
67
|
-
isFiltered: {
|
|
68
|
-
type: Boolean,
|
|
69
|
-
default: false,
|
|
70
|
-
},
|
|
71
62
|
multiple: {
|
|
72
63
|
type: Boolean,
|
|
73
64
|
default: false,
|
|
74
65
|
},
|
|
75
|
-
emptySearchLabel: {
|
|
76
|
-
type: String,
|
|
77
|
-
default: 'No item matching your criteria found',
|
|
78
|
-
},
|
|
79
66
|
dataKeyExpr: {
|
|
80
67
|
type: String,
|
|
81
68
|
default: 'id',
|