@v-c/tabs 1.0.0 → 1.0.2
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/TabContext.js +2 -0
- package/dist/TabNavList/AddButton.js +2 -0
- package/dist/TabNavList/AddButton.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/TabNavList/ExtraContent.js +2 -0
- package/dist/TabNavList/ExtraContent.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/TabNavList/OperationNode.js +2 -0
- package/dist/TabNavList/OperationNode.vue_vue_type_script_setup_true_lang.js +6 -4
- package/dist/TabNavList/TabNode.js +2 -0
- package/dist/TabNavList/TabNode.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/TabNavList/Wrapper.js +2 -0
- package/dist/TabNavList/Wrapper.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/TabNavList/index.js +2 -0
- package/dist/TabNavList/index.vue_vue_type_script_setup_true_lang.js +23 -8
- package/dist/TabPanelList/TabPane.js +2 -0
- package/dist/TabPanelList/TabPane.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/TabPanelList/index.js +2 -0
- package/dist/TabPanelList/index.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/Tabs.js +2 -0
- package/dist/Tabs.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/hooks/useAnimateConfig.js +2 -0
- package/dist/hooks/useIndicator.js +3 -2
- package/dist/hooks/useOffsets.js +2 -0
- package/dist/hooks/useTouchMove.js +3 -3
- package/dist/hooks/useVisibleRange.js +2 -0
- package/dist/index.js +2 -0
- package/dist/utils.js +7 -1
- package/package.json +9 -6
- package/dist/TabContext.cjs +0 -12
- package/dist/TabNavList/AddButton.cjs +0 -7
- package/dist/TabNavList/AddButton.vue_vue_type_script_setup_true_lang.cjs +0 -36
- package/dist/TabNavList/ExtraContent.cjs +0 -7
- package/dist/TabNavList/ExtraContent.vue_vue_type_script_setup_true_lang.cjs +0 -51
- package/dist/TabNavList/OperationNode.cjs +0 -7
- package/dist/TabNavList/OperationNode.vue_vue_type_script_setup_true_lang.cjs +0 -210
- package/dist/TabNavList/TabNode.cjs +0 -7
- package/dist/TabNavList/TabNode.vue_vue_type_script_setup_true_lang.cjs +0 -129
- package/dist/TabNavList/Wrapper.cjs +0 -7
- package/dist/TabNavList/Wrapper.vue_vue_type_script_setup_true_lang.cjs +0 -54
- package/dist/TabNavList/index.cjs +0 -7
- package/dist/TabNavList/index.vue_vue_type_script_setup_true_lang.cjs +0 -516
- package/dist/TabPanelList/TabPane.cjs +0 -7
- package/dist/TabPanelList/TabPane.vue_vue_type_script_setup_true_lang.cjs +0 -85
- package/dist/TabPanelList/index.cjs +0 -7
- package/dist/TabPanelList/index.vue_vue_type_script_setup_true_lang.cjs +0 -105
- package/dist/Tabs.cjs +0 -7
- package/dist/Tabs.vue_vue_type_script_setup_true_lang.cjs +0 -194
- package/dist/_virtual/rolldown_runtime.cjs +0 -21
- package/dist/hooks/useAnimateConfig.cjs +0 -31
- package/dist/hooks/useIndicator.cjs +0 -71
- package/dist/hooks/useOffsets.cjs +0 -42
- package/dist/hooks/useTouchMove.cjs +0 -122
- package/dist/hooks/useVisibleRange.cjs +0 -54
- package/dist/index.cjs +0 -7
- package/dist/interface.cjs +0 -1
- package/dist/utils.cjs +0 -34
|
@@ -1,516 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
2
|
-
const require_TabContext = require("../TabContext.cjs");
|
|
3
|
-
const require_useIndicator = require("../hooks/useIndicator.cjs");
|
|
4
|
-
const require_useOffsets = require("../hooks/useOffsets.cjs");
|
|
5
|
-
const require_useTouchMove = require("../hooks/useTouchMove.cjs");
|
|
6
|
-
const require_useVisibleRange = require("../hooks/useVisibleRange.cjs");
|
|
7
|
-
const require_utils = require("../utils.cjs");
|
|
8
|
-
const require_AddButton = require("./AddButton.cjs");
|
|
9
|
-
const require_ExtraContent = require("./ExtraContent.cjs");
|
|
10
|
-
const require_OperationNode = require("./OperationNode.cjs");
|
|
11
|
-
const require_TabNode = require("./TabNode.cjs");
|
|
12
|
-
let vue = require("vue");
|
|
13
|
-
let _v_c_util_dist_RenderComponent = require("@v-c/util/dist/RenderComponent");
|
|
14
|
-
_v_c_util_dist_RenderComponent = require_rolldown_runtime.__toESM(_v_c_util_dist_RenderComponent);
|
|
15
|
-
let _v_c_resize_observer = require("@v-c/resize-observer");
|
|
16
|
-
_v_c_resize_observer = require_rolldown_runtime.__toESM(_v_c_resize_observer);
|
|
17
|
-
var _hoisted_1 = ["aria-orientation"];
|
|
18
|
-
var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
19
|
-
name: "TabNavList",
|
|
20
|
-
inheritAttrs: false,
|
|
21
|
-
__name: "index",
|
|
22
|
-
props: {
|
|
23
|
-
id: {},
|
|
24
|
-
tabPosition: {},
|
|
25
|
-
activeKey: {},
|
|
26
|
-
rtl: { type: Boolean },
|
|
27
|
-
animated: {},
|
|
28
|
-
extra: { type: [
|
|
29
|
-
Object,
|
|
30
|
-
String,
|
|
31
|
-
Number,
|
|
32
|
-
null,
|
|
33
|
-
Boolean,
|
|
34
|
-
Array
|
|
35
|
-
] },
|
|
36
|
-
editable: {},
|
|
37
|
-
more: {},
|
|
38
|
-
mobile: { type: Boolean },
|
|
39
|
-
tabBarGutter: {},
|
|
40
|
-
renderTabBar: { type: Function },
|
|
41
|
-
className: {},
|
|
42
|
-
style: {},
|
|
43
|
-
locale: {},
|
|
44
|
-
onTabClick: { type: Function },
|
|
45
|
-
onTabScroll: { type: Function },
|
|
46
|
-
children: { type: Function },
|
|
47
|
-
getPopupContainer: { type: Function },
|
|
48
|
-
popupClassName: {},
|
|
49
|
-
indicator: {},
|
|
50
|
-
classNames: {},
|
|
51
|
-
styles: {}
|
|
52
|
-
},
|
|
53
|
-
setup(__props) {
|
|
54
|
-
const props = __props;
|
|
55
|
-
const { className, style, id, animated, activeKey, rtl, extra, editable, locale, tabPosition, tabBarGutter: tabBarGutterProp, children, onTabClick, onTabScroll, indicator, classNames: tabsClassNames, styles, mobile, more, getPopupContainer, popupClassName } = (0, vue.toRefs)(props);
|
|
56
|
-
const tabBarGutter = (0, vue.computed)(() => tabBarGutterProp.value ? `${tabBarGutterProp.value}px` : void 0);
|
|
57
|
-
const ctx = require_TabContext.useTabContext();
|
|
58
|
-
const tabs = (0, vue.computed)(() => ctx?.value.tabs || []);
|
|
59
|
-
const prefixCls = (0, vue.computed)(() => ctx?.value.prefixCls || "");
|
|
60
|
-
const containerRef = (0, vue.ref)(null);
|
|
61
|
-
const extraLeftRef = (0, vue.ref)(null);
|
|
62
|
-
const extraRightRef = (0, vue.ref)(null);
|
|
63
|
-
const tabsWrapperRef = (0, vue.ref)(null);
|
|
64
|
-
const tabListRef = (0, vue.ref)(null);
|
|
65
|
-
const tabPositionTopOrBottom = (0, vue.computed)(() => tabPosition.value === "top" || tabPosition.value === "bottom");
|
|
66
|
-
const transformLeft = (0, vue.ref)(0);
|
|
67
|
-
const transformTop = (0, vue.ref)(0);
|
|
68
|
-
(0, vue.watch)(transformLeft, (next, prev) => {
|
|
69
|
-
if (tabPositionTopOrBottom.value && onTabScroll) props.onTabScroll?.({ direction: next > (prev || 0) ? "left" : "right" });
|
|
70
|
-
}, { immediate: true });
|
|
71
|
-
(0, vue.watch)(transformTop, (next, prev) => {
|
|
72
|
-
if (!tabPositionTopOrBottom.value && onTabScroll) props.onTabScroll?.({ direction: next > (prev || 0) ? "top" : "bottom" });
|
|
73
|
-
}, { immediate: true });
|
|
74
|
-
const containerExcludeExtraSize = (0, vue.ref)([0, 0]);
|
|
75
|
-
const tabContentSize = (0, vue.ref)([0, 0]);
|
|
76
|
-
const firstTabContentSize = (0, vue.computed)(() => tabContentSize.value[0]);
|
|
77
|
-
const addSize = (0, vue.ref)([0, 0]);
|
|
78
|
-
const operationSize = (0, vue.ref)([0, 0]);
|
|
79
|
-
const tabSizes = (0, vue.shallowRef)(/* @__PURE__ */ new Map());
|
|
80
|
-
const tabOffsets = require_useOffsets.default(tabs, tabSizes, firstTabContentSize);
|
|
81
|
-
const operationsRef = (0, vue.ref)(null);
|
|
82
|
-
const innerAddButtonRef = (0, vue.ref)(null);
|
|
83
|
-
function getUnitValue(size, tabPositionTopOrBottom$1) {
|
|
84
|
-
return size[tabPositionTopOrBottom$1 ? 0 : 1];
|
|
85
|
-
}
|
|
86
|
-
const containerExcludeExtraSizeValue = (0, vue.computed)(() => getUnitValue(containerExcludeExtraSize.value, tabPositionTopOrBottom.value));
|
|
87
|
-
const tabContentSizeValue = (0, vue.computed)(() => getUnitValue(tabContentSize.value, tabPositionTopOrBottom.value));
|
|
88
|
-
const addSizeValue = (0, vue.computed)(() => getUnitValue(addSize.value, tabPositionTopOrBottom.value));
|
|
89
|
-
const operationSizeValue = (0, vue.computed)(() => getUnitValue(operationSize.value, tabPositionTopOrBottom.value));
|
|
90
|
-
const needScroll = (0, vue.computed)(() => Math.floor(containerExcludeExtraSizeValue.value) < Math.floor(tabContentSizeValue.value + addSizeValue.value));
|
|
91
|
-
const visibleTabContentValue = (0, vue.computed)(() => needScroll.value ? containerExcludeExtraSizeValue.value - operationSizeValue.value : containerExcludeExtraSizeValue.value - addSizeValue.value);
|
|
92
|
-
const operationsHiddenClassName = (0, vue.computed)(() => `${prefixCls.value}-nav-operations-hidden`);
|
|
93
|
-
const transformComputed = (0, vue.computed)(() => {
|
|
94
|
-
let transformMin = 0;
|
|
95
|
-
let transformMax = 0;
|
|
96
|
-
if (!tabPositionTopOrBottom.value) {
|
|
97
|
-
transformMin = Math.min(0, visibleTabContentValue.value - tabContentSizeValue.value);
|
|
98
|
-
transformMax = 0;
|
|
99
|
-
} else if (rtl.value) {
|
|
100
|
-
transformMin = 0;
|
|
101
|
-
transformMax = Math.max(0, tabContentSizeValue.value - visibleTabContentValue.value);
|
|
102
|
-
} else {
|
|
103
|
-
transformMin = Math.min(0, visibleTabContentValue.value - tabContentSizeValue.value);
|
|
104
|
-
transformMax = 0;
|
|
105
|
-
}
|
|
106
|
-
return {
|
|
107
|
-
transformMin,
|
|
108
|
-
transformMax
|
|
109
|
-
};
|
|
110
|
-
});
|
|
111
|
-
function alignInRange(value) {
|
|
112
|
-
const { transformMin, transformMax } = transformComputed.value;
|
|
113
|
-
if (value < transformMin) return transformMin;
|
|
114
|
-
if (value > transformMax) return transformMax;
|
|
115
|
-
return value;
|
|
116
|
-
}
|
|
117
|
-
const touchMovingRef = (0, vue.ref)(null);
|
|
118
|
-
const lockAnimation = (0, vue.ref)();
|
|
119
|
-
function doLockAnimation() {
|
|
120
|
-
lockAnimation.value = Date.now();
|
|
121
|
-
}
|
|
122
|
-
function clearTouchMoving() {
|
|
123
|
-
if (touchMovingRef.value) clearTimeout(touchMovingRef.value);
|
|
124
|
-
}
|
|
125
|
-
require_useTouchMove.default(tabsWrapperRef, (offsetX, offsetY) => {
|
|
126
|
-
function doMove(dataRef, offset) {
|
|
127
|
-
dataRef.value = alignInRange(dataRef.value + offset);
|
|
128
|
-
}
|
|
129
|
-
if (!needScroll.value) return false;
|
|
130
|
-
if (tabPositionTopOrBottom.value) doMove(transformLeft, offsetX);
|
|
131
|
-
else doMove(transformTop, offsetY);
|
|
132
|
-
clearTouchMoving();
|
|
133
|
-
doLockAnimation();
|
|
134
|
-
return true;
|
|
135
|
-
});
|
|
136
|
-
(0, vue.watch)(() => lockAnimation.value, async (_n, _o, onCleanup) => {
|
|
137
|
-
await (0, vue.nextTick)();
|
|
138
|
-
if (lockAnimation.value) touchMovingRef.value = setTimeout(() => {
|
|
139
|
-
lockAnimation.value = 0;
|
|
140
|
-
}, 100);
|
|
141
|
-
onCleanup(() => {
|
|
142
|
-
clearTouchMoving();
|
|
143
|
-
});
|
|
144
|
-
}, { immediate: true });
|
|
145
|
-
(0, vue.onUnmounted)(() => {
|
|
146
|
-
clearTouchMoving();
|
|
147
|
-
});
|
|
148
|
-
const visibleRangeRef = require_useVisibleRange.default(tabOffsets, visibleTabContentValue, (0, vue.computed)(() => tabPositionTopOrBottom.value ? transformLeft.value : transformTop.value), tabContentSizeValue, addSizeValue, operationSizeValue, {
|
|
149
|
-
tabs,
|
|
150
|
-
tabPosition,
|
|
151
|
-
rtl
|
|
152
|
-
});
|
|
153
|
-
const visibleStart = (0, vue.computed)(() => visibleRangeRef.value[0]);
|
|
154
|
-
const visibleEnd = (0, vue.computed)(() => visibleRangeRef.value[1]);
|
|
155
|
-
const hiddenTabs = (0, vue.computed)(() => {
|
|
156
|
-
const startHidden = tabs.value.slice(0, visibleStart.value);
|
|
157
|
-
const endHidden = tabs.value.slice(visibleEnd.value + 1);
|
|
158
|
-
return [...startHidden, ...endHidden];
|
|
159
|
-
});
|
|
160
|
-
const hasDropdown = (0, vue.computed)(() => hiddenTabs.value.length > 0);
|
|
161
|
-
const wrapPrefix = (0, vue.computed)(() => `${prefixCls.value}-nav-wrap`);
|
|
162
|
-
const pingLeft = (0, vue.computed)(() => tabPositionTopOrBottom.value ? rtl.value ? transformLeft.value > 0 : transformLeft.value < 0 : false);
|
|
163
|
-
const pingRight = (0, vue.computed)(() => {
|
|
164
|
-
if (!tabPositionTopOrBottom.value) return false;
|
|
165
|
-
if (rtl.value) return transformLeft.value !== transformComputed.value.transformMax;
|
|
166
|
-
return transformLeft.value !== transformComputed.value.transformMin;
|
|
167
|
-
});
|
|
168
|
-
const pingTop = (0, vue.computed)(() => !tabPositionTopOrBottom.value ? transformTop.value < 0 : false);
|
|
169
|
-
const pingBottom = (0, vue.computed)(() => !tabPositionTopOrBottom.value ? transformTop.value !== transformComputed.value.transformMin : false);
|
|
170
|
-
function scrollToTab(key = activeKey.value) {
|
|
171
|
-
const tabOffset = tabOffsets.value.get(key) || {
|
|
172
|
-
width: 0,
|
|
173
|
-
height: 0,
|
|
174
|
-
left: 0,
|
|
175
|
-
right: 0,
|
|
176
|
-
top: 0
|
|
177
|
-
};
|
|
178
|
-
if (tabPositionTopOrBottom.value) {
|
|
179
|
-
const newTransform = transformLeft;
|
|
180
|
-
if (rtl.value) {
|
|
181
|
-
if (tabOffset.right < transformLeft.value) newTransform.value = tabOffset.right;
|
|
182
|
-
else if (tabOffset.right + tabOffset.width > transformLeft.value + visibleTabContentValue.value) newTransform.value = tabOffset.right + tabOffset.width - visibleTabContentValue.value;
|
|
183
|
-
} else if (tabOffset.left < -transformLeft.value) newTransform.value = -tabOffset.left;
|
|
184
|
-
else if (tabOffset.left + tabOffset.width > -transformLeft.value + visibleTabContentValue.value) newTransform.value = -(tabOffset.left + tabOffset.width - visibleTabContentValue.value);
|
|
185
|
-
transformTop.value = 0;
|
|
186
|
-
transformLeft.value = alignInRange(newTransform.value);
|
|
187
|
-
} else {
|
|
188
|
-
const newTransform = transformTop;
|
|
189
|
-
if (tabOffset.top < -transformTop.value) newTransform.value = -tabOffset.top;
|
|
190
|
-
else if (tabOffset.top + tabOffset.height > -transformTop.value + visibleTabContentValue.value) newTransform.value = -(tabOffset.top + tabOffset.height - visibleTabContentValue.value);
|
|
191
|
-
transformLeft.value = 0;
|
|
192
|
-
transformTop.value = alignInRange(newTransform.value);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
const focusKey = (0, vue.ref)();
|
|
196
|
-
const isMouse = (0, vue.ref)(false);
|
|
197
|
-
const enabledTabs = (0, vue.computed)(() => tabs.value.filter((tab) => !tab.disabled).map((tab) => tab.key));
|
|
198
|
-
function onOffset(offset) {
|
|
199
|
-
const enabledKeys = getEnabledKeys(tabs.value);
|
|
200
|
-
const currentIndex = enabledKeys.indexOf(focusKey.value || activeKey.value);
|
|
201
|
-
const len = enabledKeys.length;
|
|
202
|
-
focusKey.value = enabledKeys[(currentIndex + offset + len) % len];
|
|
203
|
-
}
|
|
204
|
-
function handleRemoveTab(removalKey, e) {
|
|
205
|
-
if (!removalKey) return;
|
|
206
|
-
const removeTab = tabs.value.find((t) => t.key === removalKey);
|
|
207
|
-
if (removeTab && !removeTab.disabled && (removeTab.closable || editable.value)) {
|
|
208
|
-
e.preventDefault();
|
|
209
|
-
e.stopPropagation();
|
|
210
|
-
editable.value?.onEdit("remove", {
|
|
211
|
-
key: removalKey,
|
|
212
|
-
event: e
|
|
213
|
-
});
|
|
214
|
-
const enabledKeys = getEnabledKeys(tabs.value);
|
|
215
|
-
if (enabledKeys.indexOf(removalKey) === enabledKeys.length - 1) onOffset(-1);
|
|
216
|
-
else onOffset(1);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
function handleMouseDown(key, e) {
|
|
220
|
-
isMouse.value = true;
|
|
221
|
-
if (e.button === 1) handleRemoveTab(key, e);
|
|
222
|
-
}
|
|
223
|
-
function handleKeyDown(e) {
|
|
224
|
-
const { code } = e;
|
|
225
|
-
const isRTL = rtl.value && tabPositionTopOrBottom.value;
|
|
226
|
-
const firstEnabledTab = enabledTabs.value[0];
|
|
227
|
-
const lastEnabledTab = enabledTabs.value[enabledTabs.value.length - 1];
|
|
228
|
-
switch (code) {
|
|
229
|
-
case "ArrowLeft":
|
|
230
|
-
if (tabPositionTopOrBottom.value) onOffset(isRTL ? 1 : -1);
|
|
231
|
-
break;
|
|
232
|
-
case "ArrowRight":
|
|
233
|
-
if (tabPositionTopOrBottom.value) onOffset(isRTL ? -1 : 1);
|
|
234
|
-
break;
|
|
235
|
-
case "ArrowUp":
|
|
236
|
-
e.preventDefault();
|
|
237
|
-
if (!tabPositionTopOrBottom.value) onOffset(-1);
|
|
238
|
-
break;
|
|
239
|
-
case "ArrowDown":
|
|
240
|
-
e.preventDefault();
|
|
241
|
-
if (!tabPositionTopOrBottom.value) onOffset(1);
|
|
242
|
-
break;
|
|
243
|
-
case "Home":
|
|
244
|
-
e.preventDefault();
|
|
245
|
-
focusKey.value = firstEnabledTab;
|
|
246
|
-
break;
|
|
247
|
-
case "End":
|
|
248
|
-
e.preventDefault();
|
|
249
|
-
focusKey.value = lastEnabledTab;
|
|
250
|
-
break;
|
|
251
|
-
case "Enter":
|
|
252
|
-
case "Space":
|
|
253
|
-
e.preventDefault();
|
|
254
|
-
props.onTabClick?.(focusKey.value ?? activeKey.value, e);
|
|
255
|
-
break;
|
|
256
|
-
case "Backspace":
|
|
257
|
-
case "Delete":
|
|
258
|
-
handleRemoveTab(focusKey.value, e);
|
|
259
|
-
break;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
const isHorizontal = (0, vue.computed)(() => tabPositionTopOrBottom.value);
|
|
263
|
-
const navClass = (0, vue.computed)(() => [
|
|
264
|
-
`${prefixCls.value}-nav`,
|
|
265
|
-
className.value,
|
|
266
|
-
tabsClassNames.value?.header
|
|
267
|
-
]);
|
|
268
|
-
const navStyle = (0, vue.computed)(() => ({
|
|
269
|
-
...styles.value?.header || {},
|
|
270
|
-
...style.value || {}
|
|
271
|
-
}));
|
|
272
|
-
const navListClass = (0, vue.computed)(() => `${prefixCls.value}-nav-list`);
|
|
273
|
-
function onItemClick(key, e) {
|
|
274
|
-
onTabClick.value?.(key, e);
|
|
275
|
-
}
|
|
276
|
-
function getEnabledKeys(list) {
|
|
277
|
-
return list.filter((t) => !t.disabled).map((t) => t.key);
|
|
278
|
-
}
|
|
279
|
-
function onItemBlur() {
|
|
280
|
-
focusKey.value = void 0;
|
|
281
|
-
}
|
|
282
|
-
function onTabFocus(key) {
|
|
283
|
-
if (!isMouse.value) focusKey.value = key;
|
|
284
|
-
scrollToTab(key);
|
|
285
|
-
doLockAnimation();
|
|
286
|
-
const wrap = tabsWrapperRef.value;
|
|
287
|
-
if (!wrap) return;
|
|
288
|
-
if (!rtl.value) wrap.scrollLeft = 0;
|
|
289
|
-
wrap.scrollTop = 0;
|
|
290
|
-
}
|
|
291
|
-
const inkStyle = require_useIndicator.default({
|
|
292
|
-
activeTabOffset: (0, vue.computed)(() => tabOffsets.value.get(activeKey.value)),
|
|
293
|
-
horizontal: isHorizontal,
|
|
294
|
-
indicator,
|
|
295
|
-
rtl
|
|
296
|
-
});
|
|
297
|
-
function getTabSize(tab, containerRect) {
|
|
298
|
-
const { offsetWidth, offsetHeight, offsetTop, offsetLeft } = tab;
|
|
299
|
-
const { width, height, left, top } = tab.getBoundingClientRect();
|
|
300
|
-
if (Math.abs(width - offsetWidth) < 1) return [
|
|
301
|
-
width,
|
|
302
|
-
height,
|
|
303
|
-
left - containerRect.left,
|
|
304
|
-
top - containerRect.top
|
|
305
|
-
];
|
|
306
|
-
return [
|
|
307
|
-
offsetWidth,
|
|
308
|
-
offsetHeight,
|
|
309
|
-
offsetLeft,
|
|
310
|
-
offsetTop
|
|
311
|
-
];
|
|
312
|
-
}
|
|
313
|
-
function getSize(refObj) {
|
|
314
|
-
const el = refObj.value;
|
|
315
|
-
const { offsetWidth = 0, offsetHeight = 0 } = el || {};
|
|
316
|
-
if (el) {
|
|
317
|
-
const { width, height } = el.getBoundingClientRect();
|
|
318
|
-
if (Math.abs(width - offsetWidth) < 1) return [width, height];
|
|
319
|
-
}
|
|
320
|
-
return [offsetWidth, offsetHeight];
|
|
321
|
-
}
|
|
322
|
-
function updateTabSizes() {
|
|
323
|
-
tabSizes.value = (() => {
|
|
324
|
-
const newSizes = /* @__PURE__ */ new Map();
|
|
325
|
-
const listRect = tabListRef.value?.getBoundingClientRect?.();
|
|
326
|
-
tabs.value.forEach(({ key }) => {
|
|
327
|
-
const btnNode = tabListRef.value?.querySelector?.(`[data-node-key="${require_utils.genDataNodeKey(key)}"]`);
|
|
328
|
-
if (btnNode && listRect) {
|
|
329
|
-
const [width, height, left, top] = getTabSize(btnNode, listRect);
|
|
330
|
-
newSizes.set(key, {
|
|
331
|
-
width,
|
|
332
|
-
height,
|
|
333
|
-
left,
|
|
334
|
-
top
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
});
|
|
338
|
-
return newSizes;
|
|
339
|
-
})();
|
|
340
|
-
}
|
|
341
|
-
function onListHolderResize() {
|
|
342
|
-
const containerSize = getSize(containerRef);
|
|
343
|
-
const extraLeftEl = extraLeftRef.value?.extraContentRef;
|
|
344
|
-
const extraRightEl = extraRightRef.value?.extraContentRef;
|
|
345
|
-
const extraLeftSize = extraLeftEl ? getSize({ value: extraLeftEl }) : [0, 0];
|
|
346
|
-
const extraRightSize = extraRightEl ? getSize({ value: extraRightEl }) : [0, 0];
|
|
347
|
-
containerExcludeExtraSize.value = [containerSize[0] - extraLeftSize[0] - extraRightSize[0], containerSize[1] - extraLeftSize[1] - extraRightSize[1]];
|
|
348
|
-
const opEl = operationsRef.value?.operationNodeRef;
|
|
349
|
-
operationSize.value = opEl ? getSize({ value: opEl }) : [0, 0];
|
|
350
|
-
const tabListEl = tabListRef.value;
|
|
351
|
-
const tabContentFullSize = tabListEl ? getSize({ value: tabListEl }) : [0, 0];
|
|
352
|
-
const addEl = innerAddButtonRef.value?.buttonRef;
|
|
353
|
-
addSize.value = addEl ? getSize({ value: addEl }) : [0, 0];
|
|
354
|
-
tabContentSize.value = [tabContentFullSize[0] - addSize.value[0], tabContentFullSize[1] - addSize.value[1]];
|
|
355
|
-
updateTabSizes();
|
|
356
|
-
}
|
|
357
|
-
(0, vue.watch)(() => tabs.value.map((t) => t.key).join("_"), () => {
|
|
358
|
-
(0, vue.nextTick)(() => {
|
|
359
|
-
updateTabSizes();
|
|
360
|
-
});
|
|
361
|
-
});
|
|
362
|
-
(0, vue.watch)([
|
|
363
|
-
activeKey,
|
|
364
|
-
() => transformComputed.value.transformMin,
|
|
365
|
-
() => transformComputed.value.transformMax,
|
|
366
|
-
visibleTabContentValue,
|
|
367
|
-
tabOffsets
|
|
368
|
-
], () => {
|
|
369
|
-
scrollToTab();
|
|
370
|
-
});
|
|
371
|
-
(0, vue.watch)(rtl, () => {
|
|
372
|
-
onListHolderResize();
|
|
373
|
-
});
|
|
374
|
-
return (_ctx, _cache) => {
|
|
375
|
-
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_v_c_resize_observer.default), { onResize: onListHolderResize }, {
|
|
376
|
-
default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", {
|
|
377
|
-
ref_key: "containerRef",
|
|
378
|
-
ref: containerRef,
|
|
379
|
-
class: (0, vue.normalizeClass)(navClass.value),
|
|
380
|
-
style: (0, vue.normalizeStyle)(navStyle.value),
|
|
381
|
-
role: "tablist",
|
|
382
|
-
"aria-orientation": isHorizontal.value ? "horizontal" : "vertical",
|
|
383
|
-
onKeydown: _cache[0] || (_cache[0] = () => {
|
|
384
|
-
doLockAnimation();
|
|
385
|
-
})
|
|
386
|
-
}, [
|
|
387
|
-
(0, vue.createVNode)(require_ExtraContent.default, {
|
|
388
|
-
ref_key: "extraLeftRef",
|
|
389
|
-
ref: extraLeftRef,
|
|
390
|
-
position: "left",
|
|
391
|
-
"prefix-cls": prefixCls.value,
|
|
392
|
-
extra: (0, vue.unref)(extra)
|
|
393
|
-
}, null, 8, ["prefix-cls", "extra"]),
|
|
394
|
-
(0, vue.createVNode)((0, vue.unref)(_v_c_resize_observer.default), { onResize: onListHolderResize }, {
|
|
395
|
-
default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", {
|
|
396
|
-
ref_key: "tabsWrapperRef",
|
|
397
|
-
ref: tabsWrapperRef,
|
|
398
|
-
class: (0, vue.normalizeClass)([wrapPrefix.value, {
|
|
399
|
-
[`${wrapPrefix.value}-ping-left`]: pingLeft.value,
|
|
400
|
-
[`${wrapPrefix.value}-ping-right`]: pingRight.value,
|
|
401
|
-
[`${wrapPrefix.value}-ping-top`]: pingTop.value,
|
|
402
|
-
[`${wrapPrefix.value}-ping-bottom`]: pingBottom.value
|
|
403
|
-
}])
|
|
404
|
-
}, [(0, vue.createVNode)((0, vue.unref)(_v_c_resize_observer.default), { onResize: onListHolderResize }, {
|
|
405
|
-
default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", {
|
|
406
|
-
ref_key: "tabListRef",
|
|
407
|
-
ref: tabListRef,
|
|
408
|
-
class: (0, vue.normalizeClass)(navListClass.value),
|
|
409
|
-
style: (0, vue.normalizeStyle)({
|
|
410
|
-
transform: `translate(${transformLeft.value}px, ${transformTop.value}px)`,
|
|
411
|
-
transition: lockAnimation.value ? "none" : void 0
|
|
412
|
-
})
|
|
413
|
-
}, [
|
|
414
|
-
(0, vue.createVNode)((0, vue.unref)(_v_c_util_dist_RenderComponent.default), { render: tabs.value.map((tab, i) => (0, vue.h)(require_TabNode.default, {
|
|
415
|
-
id: (0, vue.unref)(id),
|
|
416
|
-
prefixCls: prefixCls.value,
|
|
417
|
-
key: tab.key,
|
|
418
|
-
tab,
|
|
419
|
-
className: (0, vue.unref)(tabsClassNames)?.item,
|
|
420
|
-
style: i === 0 ? (0, vue.unref)(styles)?.item : {
|
|
421
|
-
...isHorizontal.value ? { marginInlineStart: tabBarGutter.value } : { marginTop: tabBarGutter.value },
|
|
422
|
-
...(0, vue.unref)(styles)?.item || {}
|
|
423
|
-
},
|
|
424
|
-
closable: tab.closable,
|
|
425
|
-
editable: (0, vue.unref)(editable),
|
|
426
|
-
active: tab.key === (0, vue.unref)(activeKey),
|
|
427
|
-
focus: tab.key === focusKey.value,
|
|
428
|
-
renderWrapper: (0, vue.unref)(children),
|
|
429
|
-
removeAriaLabel: (0, vue.unref)(locale)?.removeAriaLabel,
|
|
430
|
-
tabCount: tabs.value.filter((t) => !t.disabled).length,
|
|
431
|
-
currentPosition: i + 1,
|
|
432
|
-
onClick: (e) => onItemClick(tab.key, e),
|
|
433
|
-
onKeyDown: handleKeyDown,
|
|
434
|
-
onFocus: () => onTabFocus(tab.key),
|
|
435
|
-
onBlur: () => onItemBlur(),
|
|
436
|
-
onMouseDown: (e) => handleMouseDown(tab.key, e),
|
|
437
|
-
onMouseUp: () => {
|
|
438
|
-
isMouse.value = false;
|
|
439
|
-
}
|
|
440
|
-
})) }, null, 8, ["render"]),
|
|
441
|
-
(0, vue.createVNode)(require_AddButton.default, {
|
|
442
|
-
ref_key: "innerAddButtonRef",
|
|
443
|
-
ref: innerAddButtonRef,
|
|
444
|
-
"prefix-cls": prefixCls.value,
|
|
445
|
-
locale: (0, vue.unref)(locale),
|
|
446
|
-
editable: (0, vue.unref)(editable),
|
|
447
|
-
style: (0, vue.normalizeStyle)({
|
|
448
|
-
...tabs.value.length === 0 ? {} : isHorizontal.value ? { marginInlineStart: tabBarGutter.value } : { marginTop: tabBarGutter.value },
|
|
449
|
-
visibility: hasDropdown.value ? "hidden" : null
|
|
450
|
-
})
|
|
451
|
-
}, null, 8, [
|
|
452
|
-
"prefix-cls",
|
|
453
|
-
"locale",
|
|
454
|
-
"editable",
|
|
455
|
-
"style"
|
|
456
|
-
]),
|
|
457
|
-
(0, vue.createElementVNode)("div", {
|
|
458
|
-
class: (0, vue.normalizeClass)([
|
|
459
|
-
`${prefixCls.value}-ink-bar`,
|
|
460
|
-
(0, vue.unref)(tabsClassNames)?.indicator,
|
|
461
|
-
{ [`${prefixCls.value}-ink-bar-animated`]: (0, vue.unref)(animated)?.inkBar }
|
|
462
|
-
]),
|
|
463
|
-
style: (0, vue.normalizeStyle)({
|
|
464
|
-
...(0, vue.unref)(styles)?.indicator || {},
|
|
465
|
-
...(0, vue.unref)(inkStyle)
|
|
466
|
-
})
|
|
467
|
-
}, null, 6)
|
|
468
|
-
], 6)]),
|
|
469
|
-
_: 1
|
|
470
|
-
})], 2)]),
|
|
471
|
-
_: 1
|
|
472
|
-
}),
|
|
473
|
-
(0, vue.createVNode)(require_OperationNode.default, (0, vue.mergeProps)({
|
|
474
|
-
ref_key: "operationsRef",
|
|
475
|
-
ref: operationsRef,
|
|
476
|
-
"remove-aria-label": (0, vue.unref)(locale)?.removeAriaLabel,
|
|
477
|
-
"prefix-cls": prefixCls.value,
|
|
478
|
-
tabs: hiddenTabs.value,
|
|
479
|
-
"class-name": [(0, vue.unref)(tabsClassNames)?.operations, !hasDropdown.value ? operationsHiddenClassName.value : void 0],
|
|
480
|
-
"popup-style": (0, vue.unref)(styles)?.popup,
|
|
481
|
-
"tab-moving": !!lockAnimation.value
|
|
482
|
-
}, {
|
|
483
|
-
id: (0, vue.unref)(id),
|
|
484
|
-
rtl: (0, vue.unref)(rtl),
|
|
485
|
-
tabBarGutter: (0, vue.unref)(tabBarGutterProp),
|
|
486
|
-
activeKey: (0, vue.unref)(activeKey),
|
|
487
|
-
mobile: (0, vue.unref)(mobile),
|
|
488
|
-
more: (0, vue.unref)(more),
|
|
489
|
-
editable: (0, vue.unref)(editable),
|
|
490
|
-
locale: (0, vue.unref)(locale),
|
|
491
|
-
onTabClick: (0, vue.unref)(onTabClick),
|
|
492
|
-
getPopupContainer: (0, vue.unref)(getPopupContainer),
|
|
493
|
-
popupClassName: (0, vue.unref)(popupClassName)
|
|
494
|
-
}), null, 16, [
|
|
495
|
-
"remove-aria-label",
|
|
496
|
-
"prefix-cls",
|
|
497
|
-
"tabs",
|
|
498
|
-
"class-name",
|
|
499
|
-
"popup-style",
|
|
500
|
-
"tab-moving"
|
|
501
|
-
]),
|
|
502
|
-
(0, vue.createVNode)(require_ExtraContent.default, {
|
|
503
|
-
ref_key: "extraRightRef",
|
|
504
|
-
ref: extraRightRef,
|
|
505
|
-
position: "right",
|
|
506
|
-
"prefix-cls": prefixCls.value,
|
|
507
|
-
extra: (0, vue.unref)(extra)
|
|
508
|
-
}, null, 8, ["prefix-cls", "extra"]),
|
|
509
|
-
(0, vue.createVNode)((0, vue.unref)(_v_c_util_dist_RenderComponent.default), { render: (0, vue.unref)(children) }, null, 8, ["render"])
|
|
510
|
-
], 46, _hoisted_1)]),
|
|
511
|
-
_: 1
|
|
512
|
-
});
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
});
|
|
516
|
-
exports.default = index_vue_vue_type_script_setup_true_lang_default;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_TabPane_vue_vue_type_script_setup_true_lang = require("./TabPane.vue_vue_type_script_setup_true_lang.cjs");
|
|
6
|
-
var TabPane_default = require_TabPane_vue_vue_type_script_setup_true_lang.default;
|
|
7
|
-
exports.default = TabPane_default;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
2
|
-
let vue = require("vue");
|
|
3
|
-
let _v_c_util_dist_RenderComponent = require("@v-c/util/dist/RenderComponent");
|
|
4
|
-
_v_c_util_dist_RenderComponent = require_rolldown_runtime.__toESM(_v_c_util_dist_RenderComponent);
|
|
5
|
-
let _v_c_util_dist_vnode = require("@v-c/util/dist/vnode");
|
|
6
|
-
var _hoisted_1 = [
|
|
7
|
-
"id",
|
|
8
|
-
"tabindex",
|
|
9
|
-
"aria-labelledby",
|
|
10
|
-
"aria-hidden"
|
|
11
|
-
];
|
|
12
|
-
var TabPane_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
13
|
-
name: "TabPane",
|
|
14
|
-
inheritAttrs: false,
|
|
15
|
-
__name: "TabPane",
|
|
16
|
-
props: {
|
|
17
|
-
tab: { type: [
|
|
18
|
-
Object,
|
|
19
|
-
String,
|
|
20
|
-
Number,
|
|
21
|
-
null,
|
|
22
|
-
Boolean,
|
|
23
|
-
Array
|
|
24
|
-
] },
|
|
25
|
-
className: {},
|
|
26
|
-
style: {},
|
|
27
|
-
disabled: { type: Boolean },
|
|
28
|
-
children: { type: [
|
|
29
|
-
Object,
|
|
30
|
-
String,
|
|
31
|
-
Number,
|
|
32
|
-
null,
|
|
33
|
-
Boolean,
|
|
34
|
-
Array
|
|
35
|
-
] },
|
|
36
|
-
forceRender: { type: Boolean },
|
|
37
|
-
closable: { type: Boolean },
|
|
38
|
-
closeIcon: { type: [
|
|
39
|
-
Object,
|
|
40
|
-
String,
|
|
41
|
-
Number,
|
|
42
|
-
null,
|
|
43
|
-
Boolean,
|
|
44
|
-
Array
|
|
45
|
-
] },
|
|
46
|
-
icon: { type: [
|
|
47
|
-
Object,
|
|
48
|
-
String,
|
|
49
|
-
Number,
|
|
50
|
-
null,
|
|
51
|
-
Boolean,
|
|
52
|
-
Array
|
|
53
|
-
] },
|
|
54
|
-
prefixCls: {},
|
|
55
|
-
tabKey: {},
|
|
56
|
-
id: {},
|
|
57
|
-
animated: { type: Boolean },
|
|
58
|
-
active: { type: Boolean },
|
|
59
|
-
destroyOnHidden: { type: Boolean }
|
|
60
|
-
},
|
|
61
|
-
setup(__props) {
|
|
62
|
-
const slots = (0, vue.useSlots)();
|
|
63
|
-
const childrenNode = (0, vue.computed)(() => (0, _v_c_util_dist_vnode.ensureValidVNode)(slots.default?.() || []));
|
|
64
|
-
const TabPaneRef = (0, vue.ref)();
|
|
65
|
-
const hasContent = (0, vue.computed)(() => childrenNode.value && childrenNode.value?.length > 0);
|
|
66
|
-
return (_ctx, _cache) => {
|
|
67
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
68
|
-
id: __props.id && `${__props.id}-panel-${__props.tabKey}`,
|
|
69
|
-
ref_key: "TabPaneRef",
|
|
70
|
-
ref: TabPaneRef,
|
|
71
|
-
role: "tabpanel",
|
|
72
|
-
tabindex: __props.active && hasContent.value ? 0 : -1,
|
|
73
|
-
"aria-labelledby": __props.id && `${__props.id}-tab-${__props.tabKey}`,
|
|
74
|
-
"aria-hidden": !__props.active,
|
|
75
|
-
style: (0, vue.normalizeStyle)(__props.style),
|
|
76
|
-
class: (0, vue.normalizeClass)([
|
|
77
|
-
__props.prefixCls,
|
|
78
|
-
__props.active && `${__props.prefixCls}-active`,
|
|
79
|
-
__props.className
|
|
80
|
-
])
|
|
81
|
-
}, [(0, vue.createVNode)((0, vue.unref)(_v_c_util_dist_RenderComponent.default), { render: childrenNode.value }, null, 8, ["render"])], 14, _hoisted_1);
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
exports.default = TabPane_vue_vue_type_script_setup_true_lang_default;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_index_vue_vue_type_script_setup_true_lang = require("./index.vue_vue_type_script_setup_true_lang.cjs");
|
|
6
|
-
var TabPanelList_default = require_index_vue_vue_type_script_setup_true_lang.default;
|
|
7
|
-
exports.default = TabPanelList_default;
|