@onereach/ui-components 2.58.0 → 2.58.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/v2/{OrTabs-4fcaa8ee.js → OrTabs-94e45ed2.js} +24 -8
- package/dist/v2/components/or-tabs-v3/OrTabs.vue.d.ts +13 -0
- package/dist/v2/index.js +1 -1
- package/dist/v2/index2.js +1 -1
- package/dist/v2/index76.js +1 -1
- package/dist/v3/{OrTabs-d2e9d48b.js → OrTabs-ff70020b.js} +24 -8
- package/dist/v3/components/or-tabs-v3/OrTabs.vue.d.ts +13 -0
- package/dist/v3/index.js +1 -1
- package/dist/v3/index2.js +1 -1
- package/dist/v3/index76.js +1 -1
- package/package.json +2 -2
- package/src/components/or-tabs-v3/OrTabs.stories3.ts +12 -2
- package/src/components/or-tabs-v3/OrTabs.vue +26 -7
|
@@ -50,12 +50,16 @@ var script = defineComponent({
|
|
|
50
50
|
type: [String, Number],
|
|
51
51
|
default: undefined
|
|
52
52
|
},
|
|
53
|
+
value: {
|
|
54
|
+
type: [String, Number],
|
|
55
|
+
default: undefined
|
|
56
|
+
},
|
|
53
57
|
variant: {
|
|
54
58
|
type: String,
|
|
55
59
|
default: TabsVariant.Default
|
|
56
60
|
}
|
|
57
61
|
},
|
|
58
|
-
emits: ['update:modelValue'],
|
|
62
|
+
emits: ['update:modelValue', 'input'],
|
|
59
63
|
expose: ['root'],
|
|
60
64
|
setup(props, context) {
|
|
61
65
|
// Refs
|
|
@@ -78,9 +82,20 @@ var script = defineComponent({
|
|
|
78
82
|
normal: [],
|
|
79
83
|
hidden: []
|
|
80
84
|
});
|
|
85
|
+
const proxyModelValue = computed({
|
|
86
|
+
get: () => {
|
|
87
|
+
var _a;
|
|
88
|
+
return (_a = props.modelValue) !== null && _a !== void 0 ? _a : props.value; // TODO: Remove Vue 2 fallback
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
set: value => {
|
|
92
|
+
context.emit('input', value);
|
|
93
|
+
context.emit('update:modelValue', value);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
81
96
|
const activeTab = computed(() => props.items.find(({
|
|
82
97
|
value
|
|
83
|
-
}) => value ===
|
|
98
|
+
}) => value === proxyModelValue.value));
|
|
84
99
|
// Functions
|
|
85
100
|
function rearrangeTabs(items, activeTab, rootElement) {
|
|
86
101
|
const {
|
|
@@ -121,8 +136,8 @@ var script = defineComponent({
|
|
|
121
136
|
// #endregion
|
|
122
137
|
onMounted(() => {
|
|
123
138
|
var _a;
|
|
124
|
-
if (!
|
|
125
|
-
|
|
139
|
+
if (!proxyModelValue.value) {
|
|
140
|
+
proxyModelValue.value = (_a = props.items[0]) === null || _a === void 0 ? void 0 : _a.value;
|
|
126
141
|
}
|
|
127
142
|
});
|
|
128
143
|
return {
|
|
@@ -133,6 +148,7 @@ var script = defineComponent({
|
|
|
133
148
|
overflowMenuRoot,
|
|
134
149
|
rootStyles,
|
|
135
150
|
tabs,
|
|
151
|
+
proxyModelValue,
|
|
136
152
|
activeTab
|
|
137
153
|
};
|
|
138
154
|
}
|
|
@@ -153,12 +169,12 @@ var __vue_render__ = function () {
|
|
|
153
169
|
return _c('OrTab', {
|
|
154
170
|
key: tab.value,
|
|
155
171
|
attrs: {
|
|
156
|
-
"selected": _vm.
|
|
172
|
+
"selected": _vm.proxyModelValue === tab.value
|
|
157
173
|
},
|
|
158
174
|
on: {
|
|
159
175
|
"click": function ($event) {
|
|
160
176
|
$event.stopPropagation();
|
|
161
|
-
|
|
177
|
+
_vm.proxyModelValue = tab.value;
|
|
162
178
|
}
|
|
163
179
|
}
|
|
164
180
|
}, [_vm._v("\n " + _vm._s(tab.label) + "\n ")]);
|
|
@@ -186,12 +202,12 @@ var __vue_render__ = function () {
|
|
|
186
202
|
on: {
|
|
187
203
|
"click": function ($event) {
|
|
188
204
|
$event.stopPropagation();
|
|
189
|
-
_vm
|
|
205
|
+
_vm.proxyModelValue = tab.value;
|
|
190
206
|
_vm.overflowMenu.close();
|
|
191
207
|
}
|
|
192
208
|
}
|
|
193
209
|
}, [_vm._v("\n " + _vm._s(tab.label) + "\n ")]);
|
|
194
|
-
}), 1)] : _vm._e()], 2), _vm._v(" "), _vm._t(String(_vm.
|
|
210
|
+
}), 1)] : _vm._e()], 2), _vm._v(" "), _vm._t(String(_vm.proxyModelValue))], 2);
|
|
195
211
|
};
|
|
196
212
|
var __vue_staticRenderFns__ = [];
|
|
197
213
|
|
|
@@ -26,6 +26,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
26
26
|
label: string;
|
|
27
27
|
}[];
|
|
28
28
|
};
|
|
29
|
+
proxyModelValue: import("@vue/composition-api").WritableComputedRef<string | number>;
|
|
29
30
|
activeTab: import("@vue/composition-api").ComputedRef<TabsItem>;
|
|
30
31
|
}> & import("@vue/composition-api").Data, {}, {}, {
|
|
31
32
|
items: {
|
|
@@ -36,6 +37,10 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
36
37
|
type: (StringConstructor | NumberConstructor)[];
|
|
37
38
|
default: undefined;
|
|
38
39
|
};
|
|
40
|
+
value: {
|
|
41
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
42
|
+
default: undefined;
|
|
43
|
+
};
|
|
39
44
|
variant: {
|
|
40
45
|
type: PropType<TabsVariant>;
|
|
41
46
|
default: TabsVariant;
|
|
@@ -49,6 +54,10 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
49
54
|
type: (StringConstructor | NumberConstructor)[];
|
|
50
55
|
default: undefined;
|
|
51
56
|
};
|
|
57
|
+
value: {
|
|
58
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
59
|
+
default: undefined;
|
|
60
|
+
};
|
|
52
61
|
variant: {
|
|
53
62
|
type: PropType<TabsVariant>;
|
|
54
63
|
default: TabsVariant;
|
|
@@ -56,6 +65,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
56
65
|
}>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
|
|
57
66
|
items: TabsItem[];
|
|
58
67
|
modelValue: string | number;
|
|
68
|
+
value: string | number;
|
|
59
69
|
variant: TabsVariant;
|
|
60
70
|
} & {} & {
|
|
61
71
|
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
@@ -84,15 +94,18 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
84
94
|
label: string;
|
|
85
95
|
}[];
|
|
86
96
|
};
|
|
97
|
+
proxyModelValue: import("@vue/composition-api").WritableComputedRef<string | number>;
|
|
87
98
|
activeTab: import("@vue/composition-api").ComputedRef<TabsItem>;
|
|
88
99
|
}>, import("@vue/composition-api").Data, {}, {}, {}, {}, string[], {
|
|
89
100
|
items: TabsItem[];
|
|
90
101
|
modelValue: string | number;
|
|
102
|
+
value: string | number;
|
|
91
103
|
variant: TabsVariant;
|
|
92
104
|
} & {} & {
|
|
93
105
|
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
94
106
|
}, {
|
|
95
107
|
modelValue: string | number;
|
|
108
|
+
value: string | number;
|
|
96
109
|
variant: TabsVariant;
|
|
97
110
|
}, true>);
|
|
98
111
|
export default _default;
|
package/dist/v2/index.js
CHANGED
|
@@ -76,7 +76,7 @@ export { _ as OrTab } from './OrTab-8dfdeca0.js';
|
|
|
76
76
|
export { _ as OrTabHeaderItem } from './OrTabHeaderItem-6a08756e.js';
|
|
77
77
|
export { _ as OrTabV3 } from './OrTab-4e6ff742.js';
|
|
78
78
|
export { _ as OrTabs } from './OrTabs-12138346.js';
|
|
79
|
-
export { _ as OrTabsV3, T as TabsVariant } from './OrTabs-
|
|
79
|
+
export { _ as OrTabsV3, T as TabsVariant } from './OrTabs-94e45ed2.js';
|
|
80
80
|
export { _ as OrTag } from './OrTag-140d4f72.js';
|
|
81
81
|
export { _ as OrTagV3, a as TagColor, T as TagVariant } from './OrTag-23de8510.js';
|
|
82
82
|
export { _ as OrTeleport } from './OrTeleportVue2-fce4676d.js';
|
package/dist/v2/index2.js
CHANGED
|
@@ -76,7 +76,7 @@ export { _ as OrTab } from './OrTab-8dfdeca0.js';
|
|
|
76
76
|
export { _ as OrTabHeaderItem } from './OrTabHeaderItem-6a08756e.js';
|
|
77
77
|
export { _ as OrTabV3 } from './OrTab-4e6ff742.js';
|
|
78
78
|
export { _ as OrTabs } from './OrTabs-12138346.js';
|
|
79
|
-
export { _ as OrTabsV3, T as TabsVariant } from './OrTabs-
|
|
79
|
+
export { _ as OrTabsV3, T as TabsVariant } from './OrTabs-94e45ed2.js';
|
|
80
80
|
export { _ as OrTag } from './OrTag-140d4f72.js';
|
|
81
81
|
export { _ as OrTagV3, a as TagColor, T as TagVariant } from './OrTag-23de8510.js';
|
|
82
82
|
export { _ as OrTeleport } from './OrTeleportVue2-fce4676d.js';
|
package/dist/v2/index76.js
CHANGED
|
@@ -50,12 +50,16 @@ var script = defineComponent({
|
|
|
50
50
|
type: [String, Number],
|
|
51
51
|
default: undefined
|
|
52
52
|
},
|
|
53
|
+
value: {
|
|
54
|
+
type: [String, Number],
|
|
55
|
+
default: undefined
|
|
56
|
+
},
|
|
53
57
|
variant: {
|
|
54
58
|
type: String,
|
|
55
59
|
default: TabsVariant.Default
|
|
56
60
|
}
|
|
57
61
|
},
|
|
58
|
-
emits: ['update:modelValue'],
|
|
62
|
+
emits: ['update:modelValue', 'input'],
|
|
59
63
|
expose: ['root'],
|
|
60
64
|
setup(props, context) {
|
|
61
65
|
// Refs
|
|
@@ -78,9 +82,20 @@ var script = defineComponent({
|
|
|
78
82
|
normal: [],
|
|
79
83
|
hidden: []
|
|
80
84
|
});
|
|
85
|
+
const proxyModelValue = computed({
|
|
86
|
+
get: () => {
|
|
87
|
+
var _a;
|
|
88
|
+
return (_a = props.modelValue) !== null && _a !== void 0 ? _a : props.value; // TODO: Remove Vue 2 fallback
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
set: value => {
|
|
92
|
+
context.emit('input', value);
|
|
93
|
+
context.emit('update:modelValue', value);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
81
96
|
const activeTab = computed(() => props.items.find(({
|
|
82
97
|
value
|
|
83
|
-
}) => value ===
|
|
98
|
+
}) => value === proxyModelValue.value));
|
|
84
99
|
// Functions
|
|
85
100
|
function rearrangeTabs(items, activeTab, rootElement) {
|
|
86
101
|
const {
|
|
@@ -121,8 +136,8 @@ var script = defineComponent({
|
|
|
121
136
|
// #endregion
|
|
122
137
|
onMounted(() => {
|
|
123
138
|
var _a;
|
|
124
|
-
if (!
|
|
125
|
-
|
|
139
|
+
if (!proxyModelValue.value) {
|
|
140
|
+
proxyModelValue.value = (_a = props.items[0]) === null || _a === void 0 ? void 0 : _a.value;
|
|
126
141
|
}
|
|
127
142
|
});
|
|
128
143
|
return {
|
|
@@ -133,6 +148,7 @@ var script = defineComponent({
|
|
|
133
148
|
overflowMenuRoot,
|
|
134
149
|
rootStyles,
|
|
135
150
|
tabs,
|
|
151
|
+
proxyModelValue,
|
|
136
152
|
activeTab
|
|
137
153
|
};
|
|
138
154
|
}
|
|
@@ -150,8 +166,8 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
150
166
|
}), [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.tabs.normal, tab => {
|
|
151
167
|
return openBlock(), createBlock(_component_OrTab, {
|
|
152
168
|
key: tab.value,
|
|
153
|
-
selected: _ctx.
|
|
154
|
-
onClick: withModifiers($event => _ctx
|
|
169
|
+
selected: _ctx.proxyModelValue === tab.value,
|
|
170
|
+
onClick: withModifiers($event => _ctx.proxyModelValue = tab.value, ["stop"])
|
|
155
171
|
}, {
|
|
156
172
|
default: withCtx(() => [createTextVNode(toDisplayString(tab.label), 1 /* TEXT */)]),
|
|
157
173
|
|
|
@@ -176,7 +192,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
176
192
|
return openBlock(), createBlock(_component_OrMenuItem, {
|
|
177
193
|
key: tab.value,
|
|
178
194
|
onClick: withModifiers($event => {
|
|
179
|
-
_ctx
|
|
195
|
+
_ctx.proxyModelValue = tab.value;
|
|
180
196
|
_ctx.overflowMenu.close();
|
|
181
197
|
}, ["stop"])
|
|
182
198
|
}, {
|
|
@@ -187,7 +203,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
187
203
|
}), 128 /* KEYED_FRAGMENT */))]),
|
|
188
204
|
|
|
189
205
|
_: 1 /* STABLE */
|
|
190
|
-
}, 8 /* PROPS */, ["trigger"])], 64 /* STABLE_FRAGMENT */)) : createCommentVNode("v-if", true)], 16 /* FULL_PROPS */), renderSlot(_ctx.$slots, String(_ctx.
|
|
206
|
+
}, 8 /* PROPS */, ["trigger"])], 64 /* STABLE_FRAGMENT */)) : createCommentVNode("v-if", true)], 16 /* FULL_PROPS */), renderSlot(_ctx.$slots, String(_ctx.proxyModelValue))]);
|
|
191
207
|
}
|
|
192
208
|
|
|
193
209
|
script.render = render;
|
|
@@ -26,6 +26,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
26
26
|
label: string;
|
|
27
27
|
}[];
|
|
28
28
|
};
|
|
29
|
+
proxyModelValue: import("@vue/composition-api").WritableComputedRef<string | number>;
|
|
29
30
|
activeTab: import("@vue/composition-api").ComputedRef<TabsItem>;
|
|
30
31
|
}> & import("@vue/composition-api").Data, {}, {}, {
|
|
31
32
|
items: {
|
|
@@ -36,6 +37,10 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
36
37
|
type: (StringConstructor | NumberConstructor)[];
|
|
37
38
|
default: undefined;
|
|
38
39
|
};
|
|
40
|
+
value: {
|
|
41
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
42
|
+
default: undefined;
|
|
43
|
+
};
|
|
39
44
|
variant: {
|
|
40
45
|
type: PropType<TabsVariant>;
|
|
41
46
|
default: TabsVariant;
|
|
@@ -49,6 +54,10 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
49
54
|
type: (StringConstructor | NumberConstructor)[];
|
|
50
55
|
default: undefined;
|
|
51
56
|
};
|
|
57
|
+
value: {
|
|
58
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
59
|
+
default: undefined;
|
|
60
|
+
};
|
|
52
61
|
variant: {
|
|
53
62
|
type: PropType<TabsVariant>;
|
|
54
63
|
default: TabsVariant;
|
|
@@ -56,6 +65,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
56
65
|
}>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
|
|
57
66
|
items: TabsItem[];
|
|
58
67
|
modelValue: string | number;
|
|
68
|
+
value: string | number;
|
|
59
69
|
variant: TabsVariant;
|
|
60
70
|
} & {} & {
|
|
61
71
|
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
@@ -84,15 +94,18 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
84
94
|
label: string;
|
|
85
95
|
}[];
|
|
86
96
|
};
|
|
97
|
+
proxyModelValue: import("@vue/composition-api").WritableComputedRef<string | number>;
|
|
87
98
|
activeTab: import("@vue/composition-api").ComputedRef<TabsItem>;
|
|
88
99
|
}>, import("@vue/composition-api").Data, {}, {}, {}, {}, string[], {
|
|
89
100
|
items: TabsItem[];
|
|
90
101
|
modelValue: string | number;
|
|
102
|
+
value: string | number;
|
|
91
103
|
variant: TabsVariant;
|
|
92
104
|
} & {} & {
|
|
93
105
|
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
94
106
|
}, {
|
|
95
107
|
modelValue: string | number;
|
|
108
|
+
value: string | number;
|
|
96
109
|
variant: TabsVariant;
|
|
97
110
|
}, true>);
|
|
98
111
|
export default _default;
|
package/dist/v3/index.js
CHANGED
|
@@ -71,7 +71,7 @@ export { s as OrTab } from './OrTab-bc98be02.js';
|
|
|
71
71
|
export { s as OrTabHeaderItem } from './OrTabHeaderItem-d668cc59.js';
|
|
72
72
|
export { s as OrTabV3 } from './OrTab-97044946.js';
|
|
73
73
|
export { s as OrTabs } from './OrTabs-d3812c11.js';
|
|
74
|
-
export { s as OrTabsV3, T as TabsVariant } from './OrTabs-
|
|
74
|
+
export { s as OrTabsV3, T as TabsVariant } from './OrTabs-ff70020b.js';
|
|
75
75
|
export { s as OrTag } from './OrTag-7e24fdbc.js';
|
|
76
76
|
export { s as OrTagV3, a as TagColor, T as TagVariant } from './OrTag-09cc3f1f.js';
|
|
77
77
|
export { s as OrTeleport } from './OrTeleportVue3-ad639f12.js';
|
package/dist/v3/index2.js
CHANGED
|
@@ -71,7 +71,7 @@ export { s as OrTab } from './OrTab-bc98be02.js';
|
|
|
71
71
|
export { s as OrTabHeaderItem } from './OrTabHeaderItem-d668cc59.js';
|
|
72
72
|
export { s as OrTabV3 } from './OrTab-97044946.js';
|
|
73
73
|
export { s as OrTabs } from './OrTabs-d3812c11.js';
|
|
74
|
-
export { s as OrTabsV3, T as TabsVariant } from './OrTabs-
|
|
74
|
+
export { s as OrTabsV3, T as TabsVariant } from './OrTabs-ff70020b.js';
|
|
75
75
|
export { s as OrTag } from './OrTag-7e24fdbc.js';
|
|
76
76
|
export { s as OrTagV3, a as TagColor, T as TagVariant } from './OrTag-09cc3f1f.js';
|
|
77
77
|
export { s as OrTeleport } from './OrTeleportVue3-ad639f12.js';
|
package/dist/v3/index76.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onereach/ui-components",
|
|
3
|
-
"version": "2.58.
|
|
3
|
+
"version": "2.58.1",
|
|
4
4
|
"description": "Vue components library for v2/3",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/auto/index.js",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"optional": true
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "2ebaa2889b89fed8d2f9d9a74914c5eedc1bbb82"
|
|
80
80
|
}
|
|
@@ -25,6 +25,10 @@ export default {
|
|
|
25
25
|
control: { type: 'text' },
|
|
26
26
|
},
|
|
27
27
|
|
|
28
|
+
value: { // TODO: Remove Vue 2 fallback
|
|
29
|
+
table: { disable: true },
|
|
30
|
+
},
|
|
31
|
+
|
|
28
32
|
variant: {
|
|
29
33
|
control: { type: 'select' },
|
|
30
34
|
options: Object.values(TabsVariant),
|
|
@@ -34,6 +38,10 @@ export default {
|
|
|
34
38
|
'update:modelValue': {
|
|
35
39
|
table: { disable: true },
|
|
36
40
|
},
|
|
41
|
+
|
|
42
|
+
input: {
|
|
43
|
+
table: { disable: true },
|
|
44
|
+
},
|
|
37
45
|
},
|
|
38
46
|
|
|
39
47
|
parameters: {
|
|
@@ -60,7 +68,8 @@ const Template: StoryFn<typeof OrTabs> = (args) => ({
|
|
|
60
68
|
return {
|
|
61
69
|
args,
|
|
62
70
|
value,
|
|
63
|
-
|
|
71
|
+
onUpdateModelValue: action('update:modelValue'),
|
|
72
|
+
onInput: action('input'),
|
|
64
73
|
};
|
|
65
74
|
},
|
|
66
75
|
|
|
@@ -68,7 +77,8 @@ const Template: StoryFn<typeof OrTabs> = (args) => ({
|
|
|
68
77
|
<OrTabs
|
|
69
78
|
v-model="value"
|
|
70
79
|
v-bind="args"
|
|
71
|
-
@update:modelValue="
|
|
80
|
+
@update:modelValue="onUpdateModelValue"
|
|
81
|
+
@input="onInput"
|
|
72
82
|
>
|
|
73
83
|
<template v-for="item in args.items" #[item.value]>
|
|
74
84
|
{{ item.label }} Content
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
<OrTab
|
|
9
9
|
v-for="tab in tabs.normal"
|
|
10
10
|
:key="tab.value"
|
|
11
|
-
:selected="
|
|
12
|
-
@click.stop="
|
|
11
|
+
:selected="proxyModelValue === tab.value"
|
|
12
|
+
@click.stop="proxyModelValue = tab.value"
|
|
13
13
|
>
|
|
14
14
|
{{ tab.label }}
|
|
15
15
|
</OrTab>
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
<OrMenuItem
|
|
33
33
|
v-for="tab in tabs.hidden"
|
|
34
34
|
:key="tab.value"
|
|
35
|
-
@click.stop="
|
|
35
|
+
@click.stop="proxyModelValue = tab.value; overflowMenu.close()"
|
|
36
36
|
>
|
|
37
37
|
{{ tab.label }}
|
|
38
38
|
</OrMenuItem>
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
</template>
|
|
41
41
|
</div>
|
|
42
42
|
|
|
43
|
-
<slot :name="String(
|
|
43
|
+
<slot :name="String(proxyModelValue)" />
|
|
44
44
|
</div>
|
|
45
45
|
</template>
|
|
46
46
|
|
|
@@ -79,6 +79,11 @@ export default defineComponent({
|
|
|
79
79
|
default: undefined,
|
|
80
80
|
},
|
|
81
81
|
|
|
82
|
+
value: { // TODO: Remove Vue 2 fallback
|
|
83
|
+
type: [String, Number],
|
|
84
|
+
default: undefined,
|
|
85
|
+
},
|
|
86
|
+
|
|
82
87
|
variant: {
|
|
83
88
|
type: String as PropType<TabsVariant>,
|
|
84
89
|
default: TabsVariant.Default,
|
|
@@ -87,6 +92,8 @@ export default defineComponent({
|
|
|
87
92
|
|
|
88
93
|
emits: [
|
|
89
94
|
'update:modelValue',
|
|
95
|
+
|
|
96
|
+
'input',
|
|
90
97
|
],
|
|
91
98
|
|
|
92
99
|
expose: [
|
|
@@ -119,7 +126,18 @@ export default defineComponent({
|
|
|
119
126
|
hidden: [] as TabsItem[],
|
|
120
127
|
});
|
|
121
128
|
|
|
122
|
-
const
|
|
129
|
+
const proxyModelValue = computed({
|
|
130
|
+
get: () => {
|
|
131
|
+
return props.modelValue ?? props.value; // TODO: Remove Vue 2 fallback
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
set: (value) => {
|
|
135
|
+
context.emit('input', value);
|
|
136
|
+
context.emit('update:modelValue', value);
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
const activeTab = computed(() => props.items.find(({ value }) => value === proxyModelValue.value)!);
|
|
123
141
|
|
|
124
142
|
// Functions
|
|
125
143
|
function rearrangeTabs(items: TabsItem[], activeTab: TabsItem, rootElement: Element): typeof tabs {
|
|
@@ -176,8 +194,8 @@ export default defineComponent({
|
|
|
176
194
|
// #endregion
|
|
177
195
|
|
|
178
196
|
onMounted(() => {
|
|
179
|
-
if (!
|
|
180
|
-
|
|
197
|
+
if (!proxyModelValue.value) {
|
|
198
|
+
proxyModelValue.value = props.items[0]?.value;
|
|
181
199
|
}
|
|
182
200
|
});
|
|
183
201
|
|
|
@@ -189,6 +207,7 @@ export default defineComponent({
|
|
|
189
207
|
overflowMenuRoot,
|
|
190
208
|
rootStyles,
|
|
191
209
|
tabs,
|
|
210
|
+
proxyModelValue,
|
|
192
211
|
activeTab,
|
|
193
212
|
};
|
|
194
213
|
},
|