@mozaic-ds/vue 0.30.0-beta.0 → 0.30.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/dist/mozaic-vue.adeo.umd.js +116 -101
- package/dist/mozaic-vue.common.js +116 -101
- package/dist/mozaic-vue.common.js.map +1 -1
- package/dist/mozaic-vue.umd.js +116 -101
- 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 +1 -1
- package/src/components/quantityselector/MQuantitySelector.vue +2 -2
- package/src/components/tabs/MTab.vue +103 -85
- package/src/components/tags/MTag.vue +3 -1
package/package.json
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
:size="small ? 's' : null"
|
|
30
30
|
:disabled="disabled"
|
|
31
31
|
role="spinbutton"
|
|
32
|
-
@
|
|
32
|
+
@change="handle"
|
|
33
33
|
@focus="onFocus"
|
|
34
34
|
@keypress="integerOnly && formatValue($event)"
|
|
35
35
|
v-on="$listeners"
|
|
@@ -130,7 +130,7 @@ export default {
|
|
|
130
130
|
if (this.currentValue > this.valuemax) {
|
|
131
131
|
this.currentValue = this.valuemax;
|
|
132
132
|
}
|
|
133
|
-
if (this.currentValue
|
|
133
|
+
if (this.currentValue <= this.valuemin) {
|
|
134
134
|
this.currentValue = this.valuemin;
|
|
135
135
|
}
|
|
136
136
|
this.$emit('input', this.currentValue);
|
|
@@ -2,25 +2,47 @@
|
|
|
2
2
|
<div :class="['mc-tabs', setClasses]">
|
|
3
3
|
<ul
|
|
4
4
|
v-if="type !== 'dropdown'"
|
|
5
|
-
|
|
5
|
+
ref="tablist"
|
|
6
6
|
class="mc-tabs__nav"
|
|
7
|
+
role="tablist"
|
|
7
8
|
:aria-label="description"
|
|
8
9
|
>
|
|
9
10
|
<li
|
|
10
11
|
v-for="(tab, index) in tabs"
|
|
11
12
|
:key="`tab-${index}`"
|
|
12
|
-
role="presentation"
|
|
13
13
|
class="mc-tabs__item"
|
|
14
|
+
role="presentation"
|
|
14
15
|
>
|
|
15
16
|
<component
|
|
16
|
-
:is="
|
|
17
|
+
:is="`${tab.router}`"
|
|
18
|
+
v-if="tab.router"
|
|
19
|
+
v-bind="tab.attrs"
|
|
20
|
+
:to="tab.to"
|
|
21
|
+
class="mc-tabs__element"
|
|
22
|
+
:class="setActiveClass(tab)"
|
|
23
|
+
active-class="mc-tabs__element--selected"
|
|
24
|
+
>
|
|
25
|
+
<span class="mc-tabs__text">{{ tab.text }}</span>
|
|
26
|
+
</component>
|
|
27
|
+
<component
|
|
28
|
+
:is="tab.href ? (tab.disabled ? 'span' : 'a') : 'button'"
|
|
29
|
+
v-else
|
|
17
30
|
:id="tab.id"
|
|
18
|
-
v-bind="setTabAttributes(tab, index)"
|
|
19
31
|
ref="tab"
|
|
20
|
-
|
|
32
|
+
:href="tab.href ? (!tab.disabled ? tab.href : null) : null"
|
|
33
|
+
:type="!tab.href ? 'button' : null"
|
|
34
|
+
:disabled="!tab.href && tab.disabled ? true : null"
|
|
21
35
|
class="mc-tabs__element"
|
|
22
|
-
|
|
23
|
-
|
|
36
|
+
role="tab"
|
|
37
|
+
:aria-selected="tab.active ? 'true' : 'false'"
|
|
38
|
+
:class="setActiveClass(tab)"
|
|
39
|
+
@click="
|
|
40
|
+
manageTabs(
|
|
41
|
+
$event.target,
|
|
42
|
+
$event,
|
|
43
|
+
Object.assign({ index: index }, tab)
|
|
44
|
+
)
|
|
45
|
+
"
|
|
24
46
|
>
|
|
25
47
|
<span class="mc-tabs__text">{{ tab.text }}</span>
|
|
26
48
|
</component>
|
|
@@ -44,6 +66,9 @@ export default {
|
|
|
44
66
|
tabs: {
|
|
45
67
|
type: Array,
|
|
46
68
|
required: true,
|
|
69
|
+
default() {
|
|
70
|
+
return [];
|
|
71
|
+
},
|
|
47
72
|
},
|
|
48
73
|
type: {
|
|
49
74
|
type: String,
|
|
@@ -59,18 +84,10 @@ export default {
|
|
|
59
84
|
default: 'auto',
|
|
60
85
|
validator: (value) => ['auto', 'full', 'centered'].includes(value),
|
|
61
86
|
},
|
|
62
|
-
/**
|
|
63
|
-
* Remove the tabs shadow
|
|
64
|
-
* @deprecated Use the nodivider prop instead
|
|
65
|
-
*/
|
|
66
87
|
shadow: {
|
|
67
88
|
type: Boolean,
|
|
68
89
|
default: true,
|
|
69
90
|
},
|
|
70
|
-
nodivider: {
|
|
71
|
-
type: Boolean,
|
|
72
|
-
default: false,
|
|
73
|
-
},
|
|
74
91
|
selectAttributes: {
|
|
75
92
|
type: Object,
|
|
76
93
|
default: null,
|
|
@@ -83,98 +100,99 @@ export default {
|
|
|
83
100
|
|
|
84
101
|
data() {
|
|
85
102
|
return {
|
|
86
|
-
|
|
103
|
+
tablist: null,
|
|
87
104
|
};
|
|
88
105
|
},
|
|
89
106
|
|
|
90
107
|
computed: {
|
|
91
108
|
setClasses() {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
109
|
+
const classes = [
|
|
110
|
+
{
|
|
111
|
+
'mc-tabs--full': this.align === 'full',
|
|
112
|
+
'mc-tabs--full-centered': this.align === 'centered',
|
|
113
|
+
'mc-tabs--dropdown': this.type === 'dropdown',
|
|
114
|
+
'mc-tabs--no-shadow': !this.shadow,
|
|
115
|
+
},
|
|
116
|
+
];
|
|
117
|
+
|
|
118
|
+
return classes;
|
|
99
119
|
},
|
|
100
120
|
},
|
|
101
121
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
122
|
+
watch: {
|
|
123
|
+
activeIndex(newValue) {
|
|
124
|
+
const tab = this.getTabFromIndex(newValue);
|
|
125
|
+
if (tab && this.tabs[newValue]) {
|
|
126
|
+
this.manageTabs(
|
|
127
|
+
tab,
|
|
128
|
+
null,
|
|
129
|
+
Object.assign({ index: newValue }, this.tabs[newValue])
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
},
|
|
105
133
|
},
|
|
106
134
|
|
|
107
|
-
|
|
108
|
-
|
|
135
|
+
mounted: function () {
|
|
136
|
+
this.$nextTick(() => {
|
|
137
|
+
if (this.type === 'tabs') {
|
|
138
|
+
this.tablist = this.$refs.tablist;
|
|
139
|
+
|
|
140
|
+
if (this.activeIndex) {
|
|
141
|
+
const tab = this.getTabFromIndex(this.activeIndex);
|
|
142
|
+
if (tab) {
|
|
143
|
+
this.manageTabs(tab);
|
|
144
|
+
}
|
|
145
|
+
} else {
|
|
146
|
+
const isActive = this.tabs.some((tab) =>
|
|
147
|
+
Object.prototype.hasOwnProperty.call(tab, 'active')
|
|
148
|
+
);
|
|
149
|
+
if (!isActive) {
|
|
150
|
+
const firstTab = this.tablist.querySelector('.mc-tabs__element');
|
|
151
|
+
this.manageTabs(firstTab);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
});
|
|
109
156
|
},
|
|
110
157
|
|
|
111
158
|
methods: {
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
const routerElement = this.router ?? null;
|
|
115
|
-
|
|
116
|
-
return routerElement ?? tabElement;
|
|
117
|
-
},
|
|
118
|
-
setTabAttributes(tab, index) {
|
|
119
|
-
const href = tab.href ? (tab.disabled ? null : tab.href) : null;
|
|
120
|
-
const type = !tab.href ? 'button' : null;
|
|
121
|
-
const disabled = !tab.href && tab.disabled ? true : null;
|
|
122
|
-
|
|
123
|
-
return {
|
|
124
|
-
...tab.attrs,
|
|
125
|
-
href,
|
|
126
|
-
type,
|
|
127
|
-
disabled,
|
|
128
|
-
'aria-selected': this.isTabActive(index).toString(),
|
|
129
|
-
};
|
|
130
|
-
},
|
|
131
|
-
setTabClass(tab, index) {
|
|
132
|
-
return [
|
|
133
|
-
tab.class,
|
|
134
|
-
{
|
|
135
|
-
'mc-tabs__element--selected': this.isTabActive(index),
|
|
136
|
-
'mc-tabs__element--disabled': tab.disabled,
|
|
137
|
-
},
|
|
138
|
-
];
|
|
139
|
-
},
|
|
140
|
-
onTabClicked(event, tab, index) {
|
|
141
|
-
if (tab && tab.disabled) {
|
|
142
|
-
event.preventDefault();
|
|
159
|
+
setActiveClass: function (tab) {
|
|
160
|
+
const tabClasses = [];
|
|
143
161
|
|
|
144
|
-
|
|
162
|
+
if (tab.active) {
|
|
163
|
+
tabClasses.push('mc-tabs__element--selected');
|
|
145
164
|
}
|
|
146
165
|
|
|
147
|
-
if (
|
|
148
|
-
|
|
149
|
-
this.$emit('update:activeIndex', this.localActiveIndex);
|
|
166
|
+
if (tab.disabled) {
|
|
167
|
+
tabClasses.push('mc-tabs__element--disabled');
|
|
150
168
|
}
|
|
151
169
|
|
|
152
|
-
|
|
153
|
-
this.$emit('tab-clicked', event.currentTarget, { index, ...tab });
|
|
154
|
-
}
|
|
170
|
+
return tabClasses;
|
|
155
171
|
},
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
(tab) =>
|
|
163
|
-
Object.prototype.hasOwnProperty.call(tab, 'active') &&
|
|
164
|
-
tab.active === true
|
|
165
|
-
);
|
|
166
|
-
|
|
167
|
-
if (activeAttrIndex > -1 && !this.activeIndex) {
|
|
168
|
-
defaultActiveIndex = activeAttrIndex;
|
|
169
|
-
} else if (this.activeIndex) {
|
|
170
|
-
defaultActiveIndex = this.activeIndex;
|
|
171
|
-
} else {
|
|
172
|
-
defaultActiveIndex = 0;
|
|
172
|
+
manageTabs: function (el, e, tab) {
|
|
173
|
+
if (tab && tab.disabled) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
if (e) {
|
|
177
|
+
this.$emit('tab-clicked', e.currentTarget, tab);
|
|
173
178
|
}
|
|
174
179
|
|
|
175
|
-
this
|
|
180
|
+
this.tablist.querySelectorAll('.mc-tabs__element').forEach((el) => {
|
|
181
|
+
el.classList.remove('mc-tabs__element--selected');
|
|
182
|
+
el.setAttribute('aria-selected', 'false');
|
|
183
|
+
});
|
|
176
184
|
|
|
177
|
-
|
|
185
|
+
el.classList.add('mc-tabs__element--selected');
|
|
186
|
+
el.setAttribute('aria-selected', 'true');
|
|
187
|
+
},
|
|
188
|
+
getTabFromIndex: function (index) {
|
|
189
|
+
if (
|
|
190
|
+
this.tablist &&
|
|
191
|
+
this.tablist.children[index] &&
|
|
192
|
+
this.tablist.children[index].children[0]
|
|
193
|
+
) {
|
|
194
|
+
return this.tablist.children[index].children[0];
|
|
195
|
+
}
|
|
178
196
|
},
|
|
179
197
|
},
|
|
180
198
|
};
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
</span>
|
|
39
39
|
<span
|
|
40
40
|
v-else-if="type === 'removable'"
|
|
41
|
+
:id="id"
|
|
41
42
|
class="mc-tag-removable"
|
|
42
43
|
:class="setClasses"
|
|
43
44
|
>
|
|
@@ -47,7 +48,8 @@
|
|
|
47
48
|
<button
|
|
48
49
|
type="button"
|
|
49
50
|
class="mc-tag-removable__remove"
|
|
50
|
-
|
|
51
|
+
:disabled="disabled"
|
|
52
|
+
@click="$emit('remove-tag', id)"
|
|
51
53
|
/>
|
|
52
54
|
</span>
|
|
53
55
|
</template>
|