@mozaic-ds/vue 0.35.0-beta.0 → 0.35.0-beta.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/mozaic-vue.adeo.css +1 -1
- package/dist/mozaic-vue.adeo.umd.js +90 -82
- package/dist/mozaic-vue.common.js +90 -82
- package/dist/mozaic-vue.common.js.map +1 -1
- package/dist/mozaic-vue.css +1 -1
- package/dist/mozaic-vue.umd.js +54 -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 +1 -1
- package/src/components/autocomplete/MAutocomplete.vue +48 -13
- package/src/components/listbox/MListBox.vue +26 -39
package/package.json
CHANGED
|
@@ -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,13 @@ 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
|
+
const invalidClass = this.isInvalid ? 'is-invalid' : '';
|
|
241
|
+
return invalidClass;
|
|
242
|
+
},
|
|
233
243
|
},
|
|
234
244
|
|
|
235
245
|
watch: {
|
|
@@ -239,6 +249,13 @@ export default {
|
|
|
239
249
|
},
|
|
240
250
|
immediate: true,
|
|
241
251
|
},
|
|
252
|
+
localItems: {
|
|
253
|
+
handler: function (val) {
|
|
254
|
+
// this.localItems = val;
|
|
255
|
+
this.isFiltered = !val.length;
|
|
256
|
+
this.$emit('list-filtered', val);
|
|
257
|
+
},
|
|
258
|
+
},
|
|
242
259
|
input: {
|
|
243
260
|
handler: function (val) {
|
|
244
261
|
this.inputValue = val;
|
|
@@ -309,18 +326,24 @@ export default {
|
|
|
309
326
|
filterList(value) {
|
|
310
327
|
if (value.length && this.filter) {
|
|
311
328
|
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
329
|
} else {
|
|
319
|
-
this.
|
|
320
|
-
|
|
321
|
-
|
|
330
|
+
if (!this.filterOnType) {
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
322
333
|
|
|
323
|
-
|
|
334
|
+
if (value.length) {
|
|
335
|
+
this.localItems = this.items.filter((item) =>
|
|
336
|
+
item[this.dataTextExpr].toUpperCase().includes(value.toUpperCase())
|
|
337
|
+
);
|
|
338
|
+
|
|
339
|
+
// this.isFiltered = !this.localItems.length;
|
|
340
|
+
} else {
|
|
341
|
+
this.localItems = this.items;
|
|
342
|
+
// this.isFiltered = !this.localItems.length;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// this.$emit('list-filtered', this.localItems);
|
|
346
|
+
}
|
|
324
347
|
},
|
|
325
348
|
closeListBox() {
|
|
326
349
|
this.openState = false;
|
|
@@ -384,6 +407,18 @@ export default {
|
|
|
384
407
|
@import 'components/c.autocomplete';
|
|
385
408
|
|
|
386
409
|
.mc-autocomplete {
|
|
410
|
+
&__main {
|
|
411
|
+
position: relative;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
&__error {
|
|
415
|
+
@include set-font-scale('04', 'm');
|
|
416
|
+
|
|
417
|
+
color: $color-fields-error;
|
|
418
|
+
display: inline-block;
|
|
419
|
+
margin-top: $mu025;
|
|
420
|
+
}
|
|
421
|
+
|
|
387
422
|
.mc-autocomplete__trigger {
|
|
388
423
|
padding-right: $mu300;
|
|
389
424
|
}
|
|
@@ -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',
|