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