@mozaic-ds/vue 0.21.1 → 0.22.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 +23 -23
- package/dist/mozaic-vue.adeo.umd.js +4337 -2637
- package/dist/mozaic-vue.common.js +4337 -2637
- package/dist/mozaic-vue.common.js.map +1 -1
- package/dist/mozaic-vue.css +1 -1
- package/dist/mozaic-vue.umd.js +4335 -2635
- 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 +4 -4
- package/src/components/autocomplete/MAutocomplete.vue +133 -92
- package/src/components/checkbox/MCheckboxGroup.vue +8 -0
- package/src/components/listbox/MListBox.vue +213 -41
- package/src/components/quantityselector/MQuantitySelector.vue +7 -2
- package/src/components/tabs/MTab.vue +65 -55
- package/src/components/textinput/MTextInputField.vue +0 -1
|
@@ -13,8 +13,20 @@
|
|
|
13
13
|
class="mc-tabs__item"
|
|
14
14
|
role="presentation"
|
|
15
15
|
>
|
|
16
|
+
<component
|
|
17
|
+
:is="`${tab.router}`"
|
|
18
|
+
v-if="tab.router"
|
|
19
|
+
v-bind="tab.attrs"
|
|
20
|
+
:to="tab.to"
|
|
21
|
+
class="mc-tabs__link"
|
|
22
|
+
:class="setLinkClass(tab)"
|
|
23
|
+
active-class="mc-tabs__link--selected"
|
|
24
|
+
>
|
|
25
|
+
{{ tab.text }}
|
|
26
|
+
</component>
|
|
16
27
|
<component
|
|
17
28
|
:is="tab.href ? (tab.disabled ? 'span' : 'a') : 'button'"
|
|
29
|
+
v-else
|
|
18
30
|
:id="tab.id"
|
|
19
31
|
ref="tab"
|
|
20
32
|
:href="tab.href ? (!tab.disabled ? tab.href : null) : null"
|
|
@@ -23,14 +35,9 @@
|
|
|
23
35
|
class="mc-tabs__link"
|
|
24
36
|
role="tab"
|
|
25
37
|
:aria-selected="tab.active ? 'true' : 'false'"
|
|
26
|
-
:class="
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
$event.target,
|
|
30
|
-
$event,
|
|
31
|
-
Object.assign({ index: index }, tab)
|
|
32
|
-
)
|
|
33
|
-
"
|
|
38
|
+
:class="setLinkClass(tab)"
|
|
39
|
+
v-bind="tab.attrs"
|
|
40
|
+
@click="onTabClicked($event, tab, index)"
|
|
34
41
|
>
|
|
35
42
|
{{ tab.text }}
|
|
36
43
|
</component>
|
|
@@ -82,38 +89,41 @@ export default {
|
|
|
82
89
|
},
|
|
83
90
|
activeIndex: {
|
|
84
91
|
type: Number,
|
|
85
|
-
default:
|
|
92
|
+
default: null,
|
|
86
93
|
},
|
|
87
94
|
},
|
|
88
95
|
|
|
89
96
|
data() {
|
|
90
97
|
return {
|
|
91
98
|
tablist: null,
|
|
99
|
+
localActiveIndex: null,
|
|
92
100
|
};
|
|
93
101
|
},
|
|
94
102
|
|
|
95
103
|
computed: {
|
|
96
104
|
setClasses() {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
},
|
|
104
|
-
];
|
|
105
|
-
|
|
106
|
-
return classes;
|
|
105
|
+
return {
|
|
106
|
+
'mc-tabs--full': this.align === 'full',
|
|
107
|
+
'mc-tabs--full-centered': this.align === 'centered',
|
|
108
|
+
'mc-tabs--dropdown': this.type === 'dropdown',
|
|
109
|
+
'mc-tabs--no-shadow': !this.shadow,
|
|
110
|
+
};
|
|
107
111
|
},
|
|
108
112
|
},
|
|
109
113
|
|
|
110
114
|
watch: {
|
|
111
115
|
activeIndex(newValue) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
this.localActiveIndex = newValue;
|
|
117
|
+
},
|
|
118
|
+
localActiveIndex: {
|
|
119
|
+
handler: function (newValue) {
|
|
120
|
+
const selectedTab = this.getTabFromIndex(newValue);
|
|
121
|
+
if (selectedTab) {
|
|
122
|
+
this.setTabState(selectedTab);
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
immediate: true,
|
|
126
|
+
},
|
|
117
127
|
},
|
|
118
128
|
|
|
119
129
|
mounted: function () {
|
|
@@ -122,17 +132,16 @@ export default {
|
|
|
122
132
|
this.tablist = this.$refs.tablist;
|
|
123
133
|
|
|
124
134
|
if (this.activeIndex) {
|
|
125
|
-
|
|
126
|
-
if (tab) {
|
|
127
|
-
this.manageTabs(tab);
|
|
128
|
-
}
|
|
135
|
+
this.localActiveIndex = this.activeIndex;
|
|
129
136
|
} else {
|
|
130
|
-
const isActive = this.tabs.some(
|
|
131
|
-
|
|
137
|
+
const isActive = this.tabs.some(
|
|
138
|
+
(tab) =>
|
|
139
|
+
Object.prototype.hasOwnProperty.call(tab, 'active') &&
|
|
140
|
+
tab.active === true
|
|
132
141
|
);
|
|
142
|
+
|
|
133
143
|
if (!isActive) {
|
|
134
|
-
|
|
135
|
-
this.manageTabs(firstTab);
|
|
144
|
+
this.localActiveIndex = 0;
|
|
136
145
|
}
|
|
137
146
|
}
|
|
138
147
|
}
|
|
@@ -140,40 +149,41 @@ export default {
|
|
|
140
149
|
},
|
|
141
150
|
|
|
142
151
|
methods: {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if (tab.disabled) {
|
|
151
|
-
tabClasses.push('mc-tabs__link--disabled');
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return tabClasses;
|
|
152
|
+
setLinkClass: function (tab) {
|
|
153
|
+
return {
|
|
154
|
+
'mc-tabs__link--selected': tab.active,
|
|
155
|
+
'mc-tabs__link--disabled': tab.disabled,
|
|
156
|
+
};
|
|
155
157
|
},
|
|
156
|
-
|
|
157
|
-
if (tab && tab.disabled) {
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
if (e) {
|
|
161
|
-
this.$emit('tab-clicked', e.target, tab);
|
|
162
|
-
}
|
|
163
|
-
|
|
158
|
+
setTabState(tab) {
|
|
164
159
|
this.tablist.querySelectorAll('.mc-tabs__link').forEach((el) => {
|
|
165
160
|
el.classList.remove('mc-tabs__link--selected');
|
|
166
161
|
el.setAttribute('aria-selected', 'false');
|
|
167
162
|
});
|
|
168
163
|
|
|
169
|
-
|
|
170
|
-
|
|
164
|
+
tab.classList.add('mc-tabs__link--selected');
|
|
165
|
+
tab.setAttribute('aria-selected', 'true');
|
|
171
166
|
},
|
|
172
167
|
getTabFromIndex: function (index) {
|
|
173
|
-
if (
|
|
168
|
+
if (
|
|
169
|
+
this.tablist &&
|
|
170
|
+
this.tablist.children[index] &&
|
|
171
|
+
this.tablist.children[index].children[0]
|
|
172
|
+
) {
|
|
174
173
|
return this.tablist.children[index].children[0];
|
|
175
174
|
}
|
|
176
175
|
},
|
|
176
|
+
onTabClicked(e, tab, index) {
|
|
177
|
+
if (tab && tab.disabled) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (typeof this.activeIndex !== 'number') {
|
|
182
|
+
this.localActiveIndex = index;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
this.$emit('tab-clicked', e.target, Object.assign({ index: index }, tab));
|
|
186
|
+
},
|
|
177
187
|
},
|
|
178
188
|
};
|
|
179
189
|
</script>
|