@mozaic-ds/vue 0.39.0-beta.0 → 0.39.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.39.0-beta.0",
3
+ "version": "0.39.0",
4
4
  "description": "Vue.js implementation of Mozaic Design System",
5
5
  "author": "Adeo - Mozaic Design System",
6
6
  "scripts": {
@@ -24,9 +24,9 @@
24
24
  ],
25
25
  "dependencies": {
26
26
  "@linusborg/vue-simple-portal": "^0.1.5",
27
- "@mozaic-ds/css-dev-tools": "1.50.0",
28
- "@mozaic-ds/icons": "1.52.0",
29
- "@mozaic-ds/styles": "1.53.0",
27
+ "@mozaic-ds/css-dev-tools": "1.54.0",
28
+ "@mozaic-ds/icons": "1.54.0",
29
+ "@mozaic-ds/styles": "1.54.0",
30
30
  "@mozaic-ds/web-fonts": "1.22.0",
31
31
  "core-js": "^3.28.0",
32
32
  "libphonenumber-js": "^1.10.19",
@@ -22,9 +22,10 @@
22
22
  v-model="inputValue"
23
23
  :placeholder="placeholder"
24
24
  :is-invalid="isInvalid"
25
+ :is-valid="isValid"
25
26
  :disabled="disabled"
26
27
  :size="size"
27
- :root-class="getInvalidRootClass"
28
+ :root-class="[getInvalidRootClass, getValidRootClass]"
28
29
  text-input-field-class="mc-autocomplete__trigger"
29
30
  icon-position="left"
30
31
  icon="DisplaySearch48"
@@ -153,6 +154,10 @@ export default {
153
154
  type: Boolean,
154
155
  default: false,
155
156
  },
157
+ valid: {
158
+ type: Boolean,
159
+ default: false,
160
+ },
156
161
  loading: {
157
162
  type: Boolean,
158
163
  default: false,
@@ -242,9 +247,15 @@ export default {
242
247
  isInvalid() {
243
248
  return this.invalid || this.isFiltered;
244
249
  },
250
+ isValid() {
251
+ return this.valid || this.isFiltered;
252
+ },
245
253
  getInvalidRootClass() {
246
254
  return (this.isInvalid && 'is-invalid') || null;
247
255
  },
256
+ getValidRootClass() {
257
+ return (this.isValid && 'is-valid') || null;
258
+ },
248
259
  },
249
260
 
250
261
  watch: {
@@ -166,17 +166,4 @@ export default {
166
166
  <style lang="scss">
167
167
  @import 'settings-tools/all-settings';
168
168
  @import 'components/c.fields';
169
-
170
- // TODO: temporary fix - should be put inside @mozaic-ds/styles
171
- .mc-field--group {
172
- .mc-field {
173
- &__container {
174
- margin-top: 0;
175
- }
176
-
177
- &__legend {
178
- margin-bottom: 1rem;
179
- }
180
- }
181
- }
182
169
  </style>
@@ -7,13 +7,6 @@
7
7
  <table aria-describedby="data" :class="getTableClasses">
8
8
  <thead>
9
9
  <tr v-if="!hideHeader">
10
- <th
11
- v-if="expandable"
12
- scope="col"
13
- class="mc-datatable__cell-button"
14
- >
15
- &nbsp;
16
- </th>
17
10
  <th
18
11
  v-for="(header, index) in getHeaders"
19
12
  :key="`header-${index}`"
@@ -47,68 +40,30 @@
47
40
  </tr>
48
41
  </thead>
49
42
  <tbody>
50
- <template v-for="(item, rowIndex) in getSource">
51
- <tr
52
- :key="item[dataKeyExpr]"
53
- :class="[rowClasses(item), parentRowClasses]"
43
+ <tr
44
+ v-for="(item, rowIndex) in getSource"
45
+ :key="item[dataKeyExpr]"
46
+ :class="rowClasses(item)"
47
+ >
48
+ <td
49
+ v-for="(header, index) in getHeaders"
50
+ :key="`${index}-${getItemValue(item, dataKeyExpr)}-${
51
+ header.dataFieldExpr
52
+ }`"
53
+ :class="header.cssClass"
54
+ @click="
55
+ allowRowClick && onRowClick({ event: $event, item: item })
56
+ "
54
57
  >
55
- <td v-if="expandable">
56
- <button
57
- v-if="expandableList?.includes(item.id) || !expandableList"
58
- type="button"
59
- class="mc-datatable__expand mc-datatable__btn"
60
- @click="onClickExpander($event, item, rowIndex)"
61
- >
62
- <span class="mc-datatable__btn-label">
63
- {{ expanderAccessibleLabel }}
64
- </span>
65
- <MIcon
66
- name="ControlCircleMore24"
67
- class="mc-datatable__btn-icon expand-more"
68
- />
69
- <MIcon
70
- name="ControlCircleLess24"
71
- class="mc-datatable__btn-icon expand-less"
72
- />
73
- </button>
74
- </td>
75
- <td
76
- v-for="(header, index) in getHeaders"
77
- :key="`${index}-${getItemValue(item, dataKeyExpr)}-${
78
- header.dataFieldExpr
79
- }`"
80
- :class="header.cssClass"
81
- @click="
82
- allowRowClick && onRowClick({ event: $event, item: item })
83
- "
58
+ <slot
59
+ :name="`item.${header.dataFieldExpr}`"
60
+ :item="item"
61
+ :index="rowIndex"
84
62
  >
85
- <slot
86
- :name="`item.${header.dataFieldExpr}`"
87
- :item="item"
88
- :index="rowIndex"
89
- >
90
- {{ getItemValue(item, header.dataFieldExpr) }}
91
- </slot>
92
- </td>
93
- </tr>
94
- <tr
95
- v-if="expandable"
96
- :key="'subrow' + item[dataKeyExpr]"
97
- class="mc-datatable__row-expandable"
98
- :class="expandableRowClasses"
99
- >
100
- <td :colspan="getHeaders.length + 1">
101
- <div class="mc-datatable__row-inner">
102
- <slot
103
- name="expandContent"
104
- :item="item"
105
- :row-index="rowIndex"
106
- >
107
- </slot>
108
- </div>
109
- </td>
110
- </tr>
111
- </template>
63
+ {{ getItemValue(item, header.dataFieldExpr) }}
64
+ </slot>
65
+ </td>
66
+ </tr>
112
67
  <tr v-if="getSource.length == 0">
113
68
  <td :colspan="getHeaders.length">
114
69
  <slot name="no-data" />
@@ -345,18 +300,6 @@ export default {
345
300
  type: [String, Function, Object],
346
301
  default: '',
347
302
  },
348
- expandable: {
349
- type: Boolean,
350
- default: false,
351
- },
352
- expandableList: {
353
- type: Array,
354
- default: undefined,
355
- },
356
- expanderAccessibleLabel: {
357
- type: String,
358
- default: 'Déplier la ligne',
359
- },
360
303
  },
361
304
 
362
305
  data() {
@@ -445,18 +388,6 @@ export default {
445
388
  const on = skip + take;
446
389
  return `${skip + 1} - ${on >= this.total ? this.total : on}`;
447
390
  },
448
-
449
- parentRowClasses() {
450
- return {
451
- 'mc-datatable__row-parent': this.expandable,
452
- };
453
- },
454
-
455
- expandableRowClasses() {
456
- return {
457
- 'mc-datatable__row-expandable--offset-1': this.expandable,
458
- };
459
- },
460
391
  },
461
392
 
462
393
  watch: {
@@ -660,30 +591,13 @@ export default {
660
591
  onRowClick(e) {
661
592
  this.$emit('row-click', e);
662
593
  },
663
-
664
- onClickExpander(e, rowData, rowIndex) {
665
- const button = e.currentTarget;
666
- const row = button.closest('tr');
667
-
668
- button.classList.toggle('is-expand');
669
- row.classList.toggle('mc-datatable__row-parent--expanded');
670
-
671
- const isExpanded = button.classList.contains('is-expand');
672
-
673
- const eventName = isExpanded ? 'expand-row' : 'retract-row';
674
- const eventArg = { data: rowData, index: rowIndex };
675
-
676
- this.$emit(eventName, eventArg);
677
- },
678
594
  },
679
595
  };
680
596
  </script>
681
597
 
682
598
  <style lang="scss">
683
599
  /* stylelint-disable */
684
- @import 'settings-tools/all-settings';
685
- @import 'components/c.datatable-tools';
686
- @import 'components/c.datatable-subtable';
600
+ @import 'settings-tools/_all-settings';
687
601
 
688
602
  .mc-data-table {
689
603
  @include set-font-family;
@@ -814,62 +728,6 @@ export default {
814
728
  vertical-align: middle;
815
729
  padding: 0 $mu100;
816
730
  }
817
-
818
- .mc-datatable__row {
819
- $datatable-row: &;
820
-
821
- &-parent:not(.mc-datatable__row-parent--expanded)
822
- + .mc-datatable__row-expandable {
823
- height: 0;
824
-
825
- .mc-datatable__row-inner {
826
- overflow: hidden;
827
- max-height: 0;
828
- }
829
- }
830
-
831
- &-parent.mc-datatable__row-parent--expanded
832
- + .mc-datatable__row-expandable {
833
- .mc-datatable__row-inner {
834
- max-height: 100%;
835
- }
836
- }
837
-
838
- &-expandable {
839
- height: auto;
840
-
841
- & > td {
842
- padding: 0;
843
- border-bottom: 0;
844
- }
845
-
846
- &--offset {
847
- &-1 {
848
- table {
849
- th:first-child,
850
- td:first-child {
851
- padding-left: $width-cell-checkbox + $mu100;
852
- }
853
- }
854
- }
855
-
856
- &-2 {
857
- table {
858
- th:first-child,
859
- td:first-child {
860
- padding-left: $width-cell-checkbox + $width-cell-button +
861
- $mu100;
862
- }
863
- }
864
- }
865
- }
866
- }
867
-
868
- &__inner,
869
- &-inner {
870
- background-color: $color-background-datatable-subtable;
871
- }
872
- }
873
731
  }
874
732
  }
875
733
 
@@ -907,6 +765,7 @@ export default {
907
765
  }
908
766
 
909
767
  // footer
768
+
910
769
  &__footer {
911
770
  @include set-box-shadow('s');
912
771
 
@@ -949,40 +808,6 @@ export default {
949
808
  background-color: $color-background-datatable-container;
950
809
  overflow: hidden;
951
810
  }
952
-
953
- &__cell {
954
- &-checkbox {
955
- width: $width-cell-checkbox;
956
- }
957
-
958
- &-button {
959
- width: $width-cell-button;
960
- }
961
-
962
- &-field {
963
- min-width: $width-cell-field;
964
- }
965
-
966
- &-number {
967
- @at-root td#{&} {
968
- text-align: right;
969
- }
970
- }
971
- }
972
-
973
- &__expand {
974
- &:not(.is-expand) {
975
- .expand-less {
976
- display: none;
977
- }
978
- }
979
-
980
- &.is-expand {
981
- .expand-more {
982
- display: none;
983
- }
984
- }
985
- }
986
811
  }
987
812
  /* stylelint-enable */
988
813
  </style>
@@ -25,7 +25,7 @@
25
25
  :disabled="disabled"
26
26
  @click="openState = !openState"
27
27
  >
28
- {{ getButtonLabel }}
28
+ {{ buttonValue }}
29
29
  </button>
30
30
  <button
31
31
  v-if="isClearable"
@@ -174,6 +174,7 @@ export default {
174
174
  openState: this.open,
175
175
  tagWidth: '0px',
176
176
  tagValue: null,
177
+ buttonValue: this.placeholder,
177
178
  localItems: null,
178
179
  sortedListItems: null,
179
180
  listboxValue: null,
@@ -209,25 +210,6 @@ export default {
209
210
  'mc-select--s': this.size === 's',
210
211
  };
211
212
  },
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
- },
231
213
  },
232
214
 
233
215
  watch: {
@@ -249,6 +231,15 @@ export default {
249
231
  },
250
232
  listboxValue: {
251
233
  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
+
252
243
  if (this.multiple) {
253
244
  this.tagValue = val;
254
245
  }
@@ -267,6 +258,7 @@ export default {
267
258
  this.$emit('update:open', val);
268
259
  },
269
260
  },
261
+
270
262
  methods: {
271
263
  setTagWidth() {
272
264
  this.$nextTick(() => {
@@ -270,7 +270,7 @@ export default {
270
270
 
271
271
  &__tile {
272
272
  align-items: center;
273
- color: #1e1e1c;
273
+ color: $color-grey-900;
274
274
  display: flex;
275
275
  gap: $mu050;
276
276
  min-height: $mu250;
@@ -108,17 +108,4 @@ export default {
108
108
  <style lang="scss">
109
109
  @import 'settings-tools/all-settings';
110
110
  @import 'components/c.fields';
111
-
112
- // TODO: temporary fix - should be put inside @mozaic-ds/styles
113
- .mc-field--group {
114
- .mc-field {
115
- &__container {
116
- margin-top: 0;
117
- }
118
-
119
- &__legend {
120
- margin-bottom: 1rem;
121
- }
122
- }
123
- }
124
111
  </style>