@mozaic-ds/vue 0.40.1-beta.1 → 0.42.0-beta.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mozaic-ds/vue",
3
- "version": "0.40.1-beta.1",
3
+ "version": "0.42.0-beta.0",
4
4
  "description": "Vue.js implementation of Mozaic Design System",
5
5
  "author": "Adeo - Mozaic Design System",
6
6
  "scripts": {
@@ -25,29 +25,29 @@
25
25
  "dependencies": {
26
26
  "@linusborg/vue-simple-portal": "^0.1.5",
27
27
  "@mozaic-ds/css-dev-tools": "1.54.0",
28
- "@mozaic-ds/icons": "1.54.0",
28
+ "@mozaic-ds/icons": "1.57.0",
29
29
  "@mozaic-ds/styles": "1.56.0",
30
30
  "@mozaic-ds/web-fonts": "1.22.0",
31
31
  "core-js": "^3.29.1",
32
- "libphonenumber-js": "^1.10.21",
32
+ "libphonenumber-js": "^1.10.24",
33
33
  "vue": "^2.6.14",
34
34
  "vue-country-flag": "2.3.2"
35
35
  },
36
36
  "devDependencies": {
37
- "@babel/core": "^7.21.0",
38
- "@babel/eslint-parser": "^7.19.1",
37
+ "@babel/core": "^7.21.4",
38
+ "@babel/eslint-parser": "^7.21.3",
39
39
  "@rushstack/eslint-patch": "^1.2.0",
40
40
  "@vue/cli-plugin-babel": "~5.0.8",
41
41
  "@vue/cli-service": "~5.0.8",
42
42
  "@vue/compiler-sfc": "^3.2.47",
43
43
  "@vue/eslint-config-prettier": "^7.1.0",
44
44
  "babel-eslint": "^10.1.0",
45
- "eslint": "^8.36.0",
46
- "eslint-config-prettier": "^8.7.0",
47
- "eslint-plugin-vue": "^9.9.0",
48
- "prettier": "^2.8.4",
45
+ "eslint": "^8.37.0",
46
+ "eslint-config-prettier": "^8.8.0",
47
+ "eslint-plugin-vue": "^9.10.0",
48
+ "prettier": "^2.8.7",
49
49
  "sass": "^1.60.0",
50
- "sass-loader": "^13.2.1",
50
+ "sass-loader": "^13.2.2",
51
51
  "vue-template-compiler": "^2.7.14"
52
52
  },
53
53
  "bugs": {
@@ -307,7 +307,7 @@ export default {
307
307
 
308
308
  /**
309
309
  * Get or set paging informations.
310
- * @type {{ enabled: boolean, text: string, index: number }}
310
+ * @type {{ enabled: boolean, text: string, index: number, totalPage?: number }}
311
311
  */
312
312
  paging: {
313
313
  type: Object,
@@ -428,7 +428,9 @@ export default {
428
428
  getPagingSize() {
429
429
  let size = 1;
430
430
 
431
- if (this.total) {
431
+ if(this.paging.totalPage) {
432
+ size = this.paging.totalPage;
433
+ } else if (this.total) {
432
434
  size = Math.ceil(this.total / this.pagerOptions.value);
433
435
  } else {
434
436
  size = parseInt(this.pagingOptions.index);
@@ -659,11 +661,12 @@ export default {
659
661
  },
660
662
 
661
663
  async onPageSizeChanged(value) {
662
- this.pagerOptions.value = +value;
664
+ const newPageSize = +value;
665
+ this.pagerOptions.value = newPageSize;
663
666
 
664
667
  await this.load();
665
668
 
666
- this.$emit('page-size-changed', value);
669
+ this.$emit('page-size-changed', newPageSize);
667
670
  },
668
671
 
669
672
  onRowClick(e) {
@@ -25,7 +25,7 @@
25
25
  :disabled="disabled"
26
26
  @click="openState = !openState"
27
27
  >
28
- {{ buttonValue }}
28
+ {{ getButtonLabel }}
29
29
  </button>
30
30
  <button
31
31
  v-if="isClearable"
@@ -174,7 +174,6 @@ export default {
174
174
  openState: this.open,
175
175
  tagWidth: '0px',
176
176
  tagValue: null,
177
- buttonValue: this.placeholder,
178
177
  localItems: null,
179
178
  sortedListItems: null,
180
179
  listboxValue: null,
@@ -210,6 +209,25 @@ export default {
210
209
  'mc-select--s': this.size === 's',
211
210
  };
212
211
  },
212
+ getButtonLabel() {
213
+ let label = this.placeholder;
214
+
215
+ if (this.modelValue && !this.items.length) {
216
+ return label;
217
+ }
218
+
219
+ const value = this.listboxValue;
220
+ const selectedItems = this.getSelectedItems(value);
221
+ const selectedLabels = selectedItems.map(
222
+ (item) => item[this.dataTextExpr]
223
+ );
224
+
225
+ label =
226
+ ((!value || value.length === 0) && this.placeholder) ||
227
+ selectedLabels.join(', ');
228
+
229
+ return label;
230
+ },
213
231
  },
214
232
 
215
233
  watch: {
@@ -231,15 +249,6 @@ export default {
231
249
  },
232
250
  listboxValue: {
233
251
  handler: function (val) {
234
- const selectedItems = this.getSelectedItems(val);
235
- const seletedLabels = selectedItems.map(
236
- (item) => item[this.dataTextExpr]
237
- );
238
-
239
- this.buttonValue =
240
- ((!val || val.length === 0) && this.placeholder) ||
241
- seletedLabels.join(', ');
242
-
243
252
  if (this.multiple) {
244
253
  this.tagValue = val;
245
254
  }
@@ -258,7 +267,6 @@ export default {
258
267
  this.$emit('update:open', val);
259
268
  },
260
269
  },
261
-
262
270
  methods: {
263
271
  setTagWidth() {
264
272
  this.$nextTick(() => {
@@ -14,7 +14,7 @@
14
14
  type="button"
15
15
  class="mc-password-input__button"
16
16
  role="switch"
17
- :aria-pressed="setAriaPressed"
17
+ :aria-checked="setAriaChecked"
18
18
  @click="onClick"
19
19
  >
20
20
  {{ setButtonLabel }}
@@ -73,7 +73,7 @@ export default {
73
73
  'is-invalid': this.isInvalid,
74
74
  };
75
75
  },
76
- setAriaPressed() {
76
+ setAriaChecked() {
77
77
  return this.isVisible ? 'true' : 'false';
78
78
  },
79
79
  setButtonLabel() {
@@ -83,7 +83,7 @@ export default {
83
83
 
84
84
  methods: {
85
85
  onClick() {
86
- const aria = this.$refs.button.getAttribute('aria-pressed') === 'false';
86
+ const aria = this.$refs.button.getAttribute('aria-checked') === 'false';
87
87
  this.isVisible = aria;
88
88
  },
89
89
  },
@@ -9,7 +9,11 @@
9
9
  :checked="checked"
10
10
  @change="$emit('change', $event.target.checked)"
11
11
  />
12
- <label :for="id" class="mc-radio__label">{{ label }}</label>
12
+ <label :for="id" class="mc-radio__label">
13
+ <slot name="label">
14
+ {{ label }}
15
+ </slot>
16
+ </label>
13
17
  </div>
14
18
  </template>
15
19
 
@@ -18,16 +18,21 @@
18
18
  :class="{ 'mc-field__container--inline': inline }"
19
19
  >
20
20
  <m-radio
21
- v-for="option in options"
21
+ v-for="(option, index) in options"
22
22
  :id="option.id ? option.id : option.value"
23
23
  :key="option.id ? option.id : option.value"
24
24
  :is-invalid="isInvalid"
25
- :label="option.label"
26
25
  :name="option.name"
27
26
  root-class="mc-field__item"
28
27
  :checked="value === option.value"
29
28
  @change="(v) => (v ? $emit('input', option.value) : null)"
30
- />
29
+ >
30
+ <template #label>
31
+ <slot :name="`label${index + 1}`">
32
+ {{ option.label }}
33
+ </slot>
34
+ </template>
35
+ </m-radio>
31
36
  </div>
32
37
  <span v-if="isInvalid" :id="errorId" class="mc-field__error-message">
33
38
  {{ errorMessage }}