@mozaic-ds/vue 0.20.0-beta.3 → 0.20.0-beta.4

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.20.0-beta.3",
3
+ "version": "0.20.0-beta.4",
4
4
  "description": "Vue.js implementation of Mozaic Design System",
5
5
  "author": "Adeo - Mozaic Design System",
6
6
  "scripts": {
@@ -1,46 +1,44 @@
1
1
  <template>
2
- <div class="template">
3
- <p>Listbox Value : {{ listboxValue }}</p>
4
- <div
5
- ref="autocomplete"
6
- v-click-outside="onClickOutside"
7
- class="mc-autocomplete"
8
- :class="{ 'mc-autocomplete--multi': multiple }"
9
- :style="tagStyle"
2
+ <div
3
+ ref="autocomplete"
4
+ v-click-outside="onClickOutside"
5
+ class="mc-autocomplete"
6
+ :class="{ 'mc-autocomplete--multi': multiple }"
7
+ :style="tagStyle"
8
+ >
9
+ <m-tag
10
+ v-if="multiple && tagValue.length > 1"
11
+ type="removable"
12
+ :label="tagValue.length.toString() + ' ' + tagLabel"
13
+ class="mc-autocomplete__tag"
14
+ size="s"
15
+ @remove-tag="clearAutocomplete()"
16
+ />
17
+ <m-text-input
18
+ v-model="inputValue"
19
+ :placeholder="placeholder"
20
+ text-input-field-class="mc-autocomplete__trigger"
21
+ icon-position="left"
22
+ icon="DisplaySearch48"
23
+ autocomplete="off"
24
+ @input="filterList"
25
+ @click="isOpen = true"
26
+ />
27
+ <m-list-box
28
+ v-model="listboxValue"
29
+ :open="isOpen"
30
+ :items="itemListForDropdown"
31
+ :multiple="multiple"
32
+ :empty-search-label="emptySearchLabel"
33
+ :data-key-expr="dataKeyExpr"
34
+ :data-text-expr="dataTextExpr"
35
+ :data-value-expr="dataValueExpr"
36
+ @change="onChange"
10
37
  >
11
- <m-tag
12
- v-if="multiple && tagValue.length > 1"
13
- type="removable"
14
- :label="tagValue.length.toString() + ' ' + tagLabel"
15
- class="mc-autocomplete__tag"
16
- size="s"
17
- @remove-tag="clearAutocomplete()"
18
- />
19
- <m-text-input
20
- v-model="inputValue"
21
- :placeholder="placeholder"
22
- text-input-field-class="mc-autocomplete__trigger"
23
- icon-position="left"
24
- icon="DisplaySearch48"
25
- autocomplete="off"
26
- @input="filterList"
27
- @click="isOpen = true"
28
- />
29
- <m-list-box
30
- v-model="listboxValue"
31
- :open="isOpen"
32
- :items="itemListForDropdown"
33
- :multiple="multiple"
34
- :empty-search-label="emptySearchLabel"
35
- :data-key-expr="dataKeyExpr"
36
- :data-text-expr="dataTextExpr"
37
- :data-value-expr="dataValueExpr"
38
- >
39
- <template #item="{ item }">
40
- <slot name="item" :item="item" />
41
- </template>
42
- </m-list-box>
43
- </div>
38
+ <template #item="{ item }">
39
+ <slot name="item" :item="item" />
40
+ </template>
41
+ </m-list-box>
44
42
  </div>
45
43
  </template>
46
44
 
@@ -74,6 +72,10 @@ export default {
74
72
  },
75
73
  },
76
74
 
75
+ model: {
76
+ event: 'change',
77
+ },
78
+
77
79
  props: {
78
80
  open: {
79
81
  type: Boolean,
@@ -116,10 +118,10 @@ export default {
116
118
  type: String,
117
119
  default: 'text',
118
120
  },
119
- // value: {
120
- // type: Array,
121
- // default: () => [],
122
- // },
121
+ value: {
122
+ type: Array,
123
+ default: () => [],
124
+ },
123
125
  },
124
126
 
125
127
  data() {
@@ -163,6 +165,13 @@ export default {
163
165
  },
164
166
  immediate: true,
165
167
  },
168
+
169
+ value: {
170
+ handler: function (value) {
171
+ this.listboxValue = value;
172
+ },
173
+ immediate: true,
174
+ },
166
175
  },
167
176
 
168
177
  mounted() {
@@ -181,6 +190,7 @@ export default {
181
190
 
182
191
  clearAutocomplete() {
183
192
  this.listboxValue = [];
193
+ this.onChange();
184
194
  this.$emit('clear');
185
195
  },
186
196
 
@@ -200,6 +210,10 @@ export default {
200
210
  onClickOutside() {
201
211
  this.isOpen = false;
202
212
  },
213
+
214
+ onChange() {
215
+ this.$emit('change', this.listboxValue);
216
+ },
203
217
  },
204
218
  };
205
219
 
@@ -210,6 +224,7 @@ export default {
210
224
 
211
225
  <style lang="scss">
212
226
  @import 'settings-tools/all-settings';
227
+ @import 'components/c.checkbox';
213
228
  @import 'components/c.autocomplete';
214
229
 
215
230
  .mc-autocomplete--multi .mc-autocomplete__trigger {
@@ -15,13 +15,6 @@
15
15
  >{{ item[dataTextExpr] }}
16
16
  </label>
17
17
  </slot>
18
- <!-- <m-checkbox
19
- v-if="multiple"
20
- :id="`checkbox-dropdown-${item.id}`"
21
- v-model="selectableItems.find((elem) => elem.id === item.id).selected"
22
- class="mc-listbox__input"
23
- @change="updateList(item.id, item.text, !item.selected, $e)"
24
- /> -->
25
18
  <input
26
19
  :id="`checkbox-dropdown-${item[dataKeyExpr]}-${uuid}`"
27
20
  ref="input"