@mozaic-ds/vue 0.35.1 → 0.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/mozaic-vue.adeo.css +1 -0
- package/dist/mozaic-vue.adeo.umd.js +338 -127
- package/dist/mozaic-vue.common.js +338 -127
- package/dist/mozaic-vue.common.js.map +1 -1
- package/dist/mozaic-vue.css +1 -1
- package/dist/mozaic-vue.umd.js +338 -127
- 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 +7 -7
- package/src/components/dropdown/MDropdown.vue +82 -52
- package/src/components/kpi/MKpi.vue +465 -0
- package/src/components/kpi/index.js +7 -0
- package/src/index.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mozaic-ds/vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.1",
|
|
4
4
|
"description": "Vue.js implementation of Mozaic Design System",
|
|
5
5
|
"author": "Adeo - Mozaic Design System",
|
|
6
6
|
"scripts": {
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"@mozaic-ds/icons": "1.52.0",
|
|
29
29
|
"@mozaic-ds/styles": "1.52.0",
|
|
30
30
|
"@mozaic-ds/web-fonts": "1.22.0",
|
|
31
|
-
"core-js": "^3.27.
|
|
32
|
-
"libphonenumber-js": "^1.10.
|
|
31
|
+
"core-js": "^3.27.2",
|
|
32
|
+
"libphonenumber-js": "^1.10.18",
|
|
33
33
|
"vue": "^2.6.14",
|
|
34
34
|
"vue-country-flag": "2.3.2"
|
|
35
35
|
},
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
"@vue/compiler-sfc": "^3.2.45",
|
|
43
43
|
"@vue/eslint-config-prettier": "^7.0.0",
|
|
44
44
|
"babel-eslint": "^10.1.0",
|
|
45
|
-
"eslint": "^8.
|
|
45
|
+
"eslint": "^8.32.0",
|
|
46
46
|
"eslint-config-prettier": "^8.6.0",
|
|
47
|
-
"eslint-plugin-vue": "^9.
|
|
48
|
-
"postcss": "^8.4.
|
|
47
|
+
"eslint-plugin-vue": "^9.9.0",
|
|
48
|
+
"postcss": "^8.4.21",
|
|
49
49
|
"postcss-loader": "^7.0.2",
|
|
50
50
|
"postcss-scss": "^4.0.6",
|
|
51
|
-
"prettier": "^2.8.
|
|
51
|
+
"prettier": "^2.8.3",
|
|
52
52
|
"sass": "^1.57.1",
|
|
53
53
|
"sass-loader": "^13.2.0",
|
|
54
54
|
"vue-template-compiler": "^2.7.14"
|
|
@@ -1,31 +1,42 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
ref="dropdown"
|
|
4
|
-
v-click-outside="
|
|
4
|
+
v-click-outside="closeListBox"
|
|
5
5
|
class="mc-dropdown"
|
|
6
|
-
:class="
|
|
6
|
+
:class="classObject"
|
|
7
7
|
:style="setStyles"
|
|
8
8
|
>
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
9
|
+
<div class="mc-dropdown__main">
|
|
10
|
+
<MTag
|
|
11
|
+
v-if="multiple && listboxValue.length > 0"
|
|
12
|
+
:id="tagId ? tagId : `dropdownTag-${uuid}`"
|
|
13
|
+
ref="tag"
|
|
14
|
+
:label="setTagLabel"
|
|
15
|
+
:disabled="disabled"
|
|
16
|
+
type="removable"
|
|
17
|
+
class="mc-dropdown__tag"
|
|
18
|
+
size="s"
|
|
19
|
+
@remove-tag="clearListbox()"
|
|
20
|
+
/>
|
|
21
|
+
<button
|
|
22
|
+
type="button"
|
|
23
|
+
class="mc-select mc-dropdown__trigger"
|
|
24
|
+
:class="classObjectTrigger"
|
|
25
|
+
:disabled="disabled"
|
|
26
|
+
@click="openState = !openState"
|
|
27
|
+
>
|
|
28
|
+
{{ buttonValue }}
|
|
29
|
+
</button>
|
|
30
|
+
<button
|
|
31
|
+
v-if="isClearable"
|
|
32
|
+
class="mc-dropdown__clear"
|
|
33
|
+
type="button"
|
|
34
|
+
@click="clearListbox"
|
|
35
|
+
>
|
|
36
|
+
<MIcon name="ControlTagCross24" class="mc-dropdown__clear-icon" />
|
|
37
|
+
<span class="mc-dropdown__clear-text">{{ labelClearButton }}</span>
|
|
38
|
+
</button>
|
|
39
|
+
</div>
|
|
29
40
|
<MListBox
|
|
30
41
|
v-model="listboxValue"
|
|
31
42
|
:open="openState"
|
|
@@ -36,16 +47,17 @@
|
|
|
36
47
|
:data-text-expr="dataTextExpr"
|
|
37
48
|
:data-value-expr="dataValueExpr"
|
|
38
49
|
:max-width="maxWidth"
|
|
39
|
-
@change="
|
|
50
|
+
@change="onChangeListbox"
|
|
40
51
|
>
|
|
41
52
|
<template #item="{ item }">
|
|
42
|
-
<slot name="item" :item="item"
|
|
53
|
+
<slot name="item" :item="item" />
|
|
43
54
|
</template>
|
|
44
55
|
</MListBox>
|
|
45
56
|
</div>
|
|
46
57
|
</template>
|
|
47
58
|
|
|
48
59
|
<script>
|
|
60
|
+
import MIcon from '../icon/MIcon.vue';
|
|
49
61
|
import MTag from '../tags/MTag.vue';
|
|
50
62
|
import MListBox from '../listbox/MListBox.vue';
|
|
51
63
|
|
|
@@ -53,6 +65,7 @@ export default {
|
|
|
53
65
|
name: 'MDropdown',
|
|
54
66
|
|
|
55
67
|
components: {
|
|
68
|
+
MIcon,
|
|
56
69
|
MTag,
|
|
57
70
|
MListBox,
|
|
58
71
|
},
|
|
@@ -92,10 +105,6 @@ export default {
|
|
|
92
105
|
type: String,
|
|
93
106
|
default: '-- Placeholder --',
|
|
94
107
|
},
|
|
95
|
-
filter: {
|
|
96
|
-
type: Function,
|
|
97
|
-
default: null,
|
|
98
|
-
},
|
|
99
108
|
size: {
|
|
100
109
|
type: String,
|
|
101
110
|
default: 'm',
|
|
@@ -142,6 +151,15 @@ export default {
|
|
|
142
151
|
type: Boolean,
|
|
143
152
|
default: true,
|
|
144
153
|
},
|
|
154
|
+
// Clear Button
|
|
155
|
+
clearable: {
|
|
156
|
+
type: Boolean,
|
|
157
|
+
default: true,
|
|
158
|
+
},
|
|
159
|
+
labelClearButton: {
|
|
160
|
+
type: String,
|
|
161
|
+
default: 'Clear',
|
|
162
|
+
},
|
|
145
163
|
// Global
|
|
146
164
|
maxWidth: {
|
|
147
165
|
type: String,
|
|
@@ -163,8 +181,11 @@ export default {
|
|
|
163
181
|
},
|
|
164
182
|
|
|
165
183
|
computed: {
|
|
166
|
-
|
|
167
|
-
return
|
|
184
|
+
classObject() {
|
|
185
|
+
return {
|
|
186
|
+
'mc-dropdown--multi': this.multiple,
|
|
187
|
+
'mc-dropdown--clearable': this.isClearable,
|
|
188
|
+
};
|
|
168
189
|
},
|
|
169
190
|
setStyles() {
|
|
170
191
|
return {
|
|
@@ -172,9 +193,31 @@ export default {
|
|
|
172
193
|
'--dropdown-tag-width': this.tagWidth,
|
|
173
194
|
};
|
|
174
195
|
},
|
|
196
|
+
setTagLabel() {
|
|
197
|
+
return this.listboxValue.length.toString() + ' ' + this.tagLabel;
|
|
198
|
+
},
|
|
199
|
+
getListboxValue() {
|
|
200
|
+
const val = this.multiple ? this.listboxValue.length : this.listboxValue;
|
|
201
|
+
return !!val;
|
|
202
|
+
},
|
|
203
|
+
isClearable() {
|
|
204
|
+
return this.clearable && this.getListboxValue && !this.disabled;
|
|
205
|
+
},
|
|
206
|
+
classObjectTrigger() {
|
|
207
|
+
return {
|
|
208
|
+
'is-open': this.openState,
|
|
209
|
+
'mc-select--s': this.size === 's',
|
|
210
|
+
};
|
|
211
|
+
},
|
|
175
212
|
},
|
|
176
213
|
|
|
177
214
|
watch: {
|
|
215
|
+
items: {
|
|
216
|
+
handler: function (val) {
|
|
217
|
+
this.localItems = val;
|
|
218
|
+
},
|
|
219
|
+
immediate: true,
|
|
220
|
+
},
|
|
178
221
|
value: {
|
|
179
222
|
handler: function (val) {
|
|
180
223
|
if (!val && this.multiple) {
|
|
@@ -185,15 +228,6 @@ export default {
|
|
|
185
228
|
},
|
|
186
229
|
immediate: true,
|
|
187
230
|
},
|
|
188
|
-
|
|
189
|
-
items: {
|
|
190
|
-
handler: function (val) {
|
|
191
|
-
this.localItems = val;
|
|
192
|
-
// this.clearAutocomplete();
|
|
193
|
-
},
|
|
194
|
-
immediate: true,
|
|
195
|
-
},
|
|
196
|
-
|
|
197
231
|
listboxValue: function (val) {
|
|
198
232
|
const selectedItems = this.getSelectedItems(val);
|
|
199
233
|
const seletedLabels = selectedItems.map(
|
|
@@ -201,17 +235,16 @@ export default {
|
|
|
201
235
|
);
|
|
202
236
|
|
|
203
237
|
this.buttonValue =
|
|
204
|
-
val.length === 0
|
|
238
|
+
((!val || val.length === 0) && this.placeholder) ||
|
|
239
|
+
seletedLabels.join(', ');
|
|
205
240
|
|
|
206
241
|
if (this.multiple) {
|
|
207
242
|
this.tagValue = val;
|
|
208
243
|
}
|
|
209
244
|
},
|
|
210
|
-
|
|
211
245
|
tagValue: function () {
|
|
212
246
|
this.setTagWidth();
|
|
213
247
|
},
|
|
214
|
-
|
|
215
248
|
openState: function (val) {
|
|
216
249
|
const eventName = val ? 'open' : 'close';
|
|
217
250
|
this.$emit(eventName);
|
|
@@ -229,14 +262,12 @@ export default {
|
|
|
229
262
|
}
|
|
230
263
|
});
|
|
231
264
|
},
|
|
232
|
-
|
|
233
|
-
clearAutocomplete() {
|
|
265
|
+
clearListbox() {
|
|
234
266
|
this.listboxValue = this.multiple ? [] : undefined;
|
|
235
|
-
this.
|
|
267
|
+
this.onChangeListbox();
|
|
236
268
|
this.$emit('clear');
|
|
237
269
|
},
|
|
238
|
-
|
|
239
|
-
onClickOutside() {
|
|
270
|
+
closeListBox() {
|
|
240
271
|
this.openState = false;
|
|
241
272
|
|
|
242
273
|
if (this.multiple && this.sort) {
|
|
@@ -245,15 +276,13 @@ export default {
|
|
|
245
276
|
this.localItems = this.items;
|
|
246
277
|
}
|
|
247
278
|
},
|
|
248
|
-
|
|
249
|
-
onChange() {
|
|
279
|
+
onChangeListbox() {
|
|
250
280
|
this.$emit('change', this.listboxValue);
|
|
251
281
|
|
|
252
282
|
if (!this.multiple) {
|
|
253
|
-
this.
|
|
283
|
+
this.closeListBox();
|
|
254
284
|
}
|
|
255
285
|
},
|
|
256
|
-
|
|
257
286
|
getSelectedItems(val) {
|
|
258
287
|
const value = val ? val : this.listboxValue;
|
|
259
288
|
|
|
@@ -265,7 +294,6 @@ export default {
|
|
|
265
294
|
|
|
266
295
|
return selectedItems;
|
|
267
296
|
},
|
|
268
|
-
|
|
269
297
|
sortItems() {
|
|
270
298
|
this.sortedListItems = this.items;
|
|
271
299
|
const selectedItems = this.getSelectedItems();
|
|
@@ -282,6 +310,8 @@ export default {
|
|
|
282
310
|
return -1;
|
|
283
311
|
}
|
|
284
312
|
});
|
|
313
|
+
|
|
314
|
+
this.localItems = this.sortedListItems;
|
|
285
315
|
},
|
|
286
316
|
},
|
|
287
317
|
};
|