vxe-pc-ui 4.6.35 → 4.6.37
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/es/icon/style.css +1 -1
- package/es/notice-bar/src/notice-bar.js +9 -2
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/tabs/src/tabs.js +323 -106
- package/es/tabs/style.css +434 -156
- package/es/tabs/style.min.css +1 -1
- package/es/ui/index.js +3 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-tabs/style.css +434 -156
- package/es/vxe-tabs/style.min.css +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.umd.js +354 -102
- package/lib/index.umd.min.js +1 -1
- package/lib/notice-bar/src/notice-bar.js +8 -1
- package/lib/notice-bar/src/notice-bar.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/tabs/src/tabs.js +342 -99
- package/lib/tabs/src/tabs.min.js +1 -1
- package/lib/tabs/style/style.css +434 -156
- package/lib/tabs/style/style.min.css +1 -1
- package/lib/ui/index.js +3 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-tabs/style/style.css +434 -156
- package/lib/vxe-tabs/style/style.min.css +1 -1
- package/package.json +1 -1
- package/packages/notice-bar/src/notice-bar.ts +13 -3
- package/packages/tabs/src/tabs.ts +334 -107
- package/packages/ui/index.ts +2 -0
- package/styles/components/tabs.scss +539 -183
- package/types/components/tabs.d.ts +27 -7
- package/types/ui/global-icon.d.ts +2 -0
- /package/es/icon/{iconfont.1750910542831.ttf → iconfont.1751116737472.ttf} +0 -0
- /package/es/icon/{iconfont.1750910542831.woff → iconfont.1751116737472.woff} +0 -0
- /package/es/icon/{iconfont.1750910542831.woff2 → iconfont.1751116737472.woff2} +0 -0
- /package/es/{iconfont.1750910542831.ttf → iconfont.1751116737472.ttf} +0 -0
- /package/es/{iconfont.1750910542831.woff → iconfont.1751116737472.woff} +0 -0
- /package/es/{iconfont.1750910542831.woff2 → iconfont.1751116737472.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1750910542831.ttf → iconfont.1751116737472.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1750910542831.woff → iconfont.1751116737472.woff} +0 -0
- /package/lib/icon/style/{iconfont.1750910542831.woff2 → iconfont.1751116737472.woff2} +0 -0
- /package/lib/{iconfont.1750910542831.ttf → iconfont.1751116737472.ttf} +0 -0
- /package/lib/{iconfont.1750910542831.woff → iconfont.1751116737472.woff} +0 -0
- /package/lib/{iconfont.1750910542831.woff2 → iconfont.1751116737472.woff2} +0 -0
package/lib/tabs/src/tabs.js
CHANGED
|
@@ -13,17 +13,30 @@ var _utils = require("../../ui/src/utils");
|
|
|
13
13
|
var _log = require("../../ui/src/log");
|
|
14
14
|
var _xeUtils = _interopRequireDefault(require("xe-utils"));
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
const scrollbarOffsetSize = 20;
|
|
16
17
|
var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
17
18
|
name: 'VxeTabs',
|
|
18
19
|
props: {
|
|
19
20
|
modelValue: [String, Number, Boolean],
|
|
20
21
|
options: Array,
|
|
22
|
+
width: [String, Number],
|
|
21
23
|
height: [String, Number],
|
|
22
24
|
destroyOnClose: Boolean,
|
|
23
25
|
titleWidth: [String, Number],
|
|
24
26
|
titleAlign: [String, Number],
|
|
25
|
-
type:
|
|
27
|
+
type: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: () => (0, _ui.getConfig)().tabs.type
|
|
30
|
+
},
|
|
31
|
+
position: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: () => (0, _ui.getConfig)().tabs.position
|
|
34
|
+
},
|
|
26
35
|
showClose: Boolean,
|
|
36
|
+
showBody: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: true
|
|
39
|
+
},
|
|
27
40
|
padding: {
|
|
28
41
|
type: Boolean,
|
|
29
42
|
default: () => (0, _ui.getConfig)().tabs.padding
|
|
@@ -45,12 +58,18 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
45
58
|
const $xeParentTabs = (0, _vue.inject)('$xeTabs', null);
|
|
46
59
|
const refElem = (0, _vue.ref)();
|
|
47
60
|
const refHeadWrapperElem = (0, _vue.ref)();
|
|
61
|
+
const refHeadPrevElem = (0, _vue.ref)();
|
|
62
|
+
const refHeadNextElem = (0, _vue.ref)();
|
|
48
63
|
const reactData = (0, _vue.reactive)({
|
|
49
64
|
staticTabs: [],
|
|
50
65
|
activeName: null,
|
|
51
66
|
initNames: [],
|
|
52
67
|
lintLeft: 0,
|
|
68
|
+
lintTop: 0,
|
|
53
69
|
lintWidth: 0,
|
|
70
|
+
lintHeight: 0,
|
|
71
|
+
scrollbarWidth: 0,
|
|
72
|
+
scrollbarHeight: 0,
|
|
54
73
|
isTabOver: false,
|
|
55
74
|
resizeFlag: 1,
|
|
56
75
|
cacheTabMaps: {}
|
|
@@ -61,6 +80,52 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
61
80
|
const refMaps = {
|
|
62
81
|
refElem
|
|
63
82
|
};
|
|
83
|
+
const computeTabType = (0, _vue.computed)(() => {
|
|
84
|
+
const {
|
|
85
|
+
type
|
|
86
|
+
} = props;
|
|
87
|
+
return type || 'default';
|
|
88
|
+
});
|
|
89
|
+
const computeTabPosition = (0, _vue.computed)(() => {
|
|
90
|
+
const {
|
|
91
|
+
position
|
|
92
|
+
} = props;
|
|
93
|
+
return position || 'top';
|
|
94
|
+
});
|
|
95
|
+
const computeLrPosition = (0, _vue.computed)(() => {
|
|
96
|
+
const tabPosition = computeTabPosition.value;
|
|
97
|
+
return tabPosition === 'left' || tabPosition === 'right';
|
|
98
|
+
});
|
|
99
|
+
const computeLineStyle = (0, _vue.computed)(() => {
|
|
100
|
+
const {
|
|
101
|
+
lintLeft,
|
|
102
|
+
lintTop,
|
|
103
|
+
lintWidth,
|
|
104
|
+
lintHeight
|
|
105
|
+
} = reactData;
|
|
106
|
+
const lrPosition = computeLrPosition.value;
|
|
107
|
+
return lrPosition ? {
|
|
108
|
+
top: `${lintTop}px`,
|
|
109
|
+
height: `${lintHeight}px`
|
|
110
|
+
} : {
|
|
111
|
+
left: `${lintLeft}px`,
|
|
112
|
+
width: `${lintWidth}px`
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
const computeWrapperStyle = (0, _vue.computed)(() => {
|
|
116
|
+
const {
|
|
117
|
+
width,
|
|
118
|
+
height
|
|
119
|
+
} = props;
|
|
120
|
+
const stys = {};
|
|
121
|
+
if (width) {
|
|
122
|
+
stys.width = (0, _dom.toCssUnit)(width);
|
|
123
|
+
}
|
|
124
|
+
if (width) {
|
|
125
|
+
stys.height = (0, _dom.toCssUnit)(height);
|
|
126
|
+
}
|
|
127
|
+
return stys;
|
|
128
|
+
});
|
|
64
129
|
const computeCloseOpts = (0, _vue.computed)(() => {
|
|
65
130
|
return Object.assign({}, (0, _ui.getConfig)().tabs.closeConfig, props.closeConfig);
|
|
66
131
|
});
|
|
@@ -79,6 +144,9 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
79
144
|
} = reactData;
|
|
80
145
|
return staticTabs.filter(item => handleFilterTab(item));
|
|
81
146
|
});
|
|
147
|
+
const computeParentTabsResizeFlag = (0, _vue.computed)(() => {
|
|
148
|
+
return $xeParentTabs ? $xeParentTabs.reactData.resizeFlag : null;
|
|
149
|
+
});
|
|
82
150
|
const computeMaps = {};
|
|
83
151
|
const $xeTabs = {
|
|
84
152
|
xID,
|
|
@@ -110,49 +178,118 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
110
178
|
}
|
|
111
179
|
return [];
|
|
112
180
|
};
|
|
113
|
-
const
|
|
114
|
-
|
|
181
|
+
const checkScrolling = () => {
|
|
182
|
+
const lrPosition = computeLrPosition.value;
|
|
183
|
+
const headerWrapperEl = refHeadWrapperElem.value;
|
|
184
|
+
const headPrevEl = refHeadPrevElem.value;
|
|
185
|
+
const headNextEl = refHeadNextElem.value;
|
|
186
|
+
if (headerWrapperEl) {
|
|
115
187
|
const {
|
|
116
|
-
|
|
117
|
-
|
|
188
|
+
scrollLeft,
|
|
189
|
+
scrollTop,
|
|
190
|
+
clientWidth,
|
|
191
|
+
clientHeight,
|
|
192
|
+
scrollWidth,
|
|
193
|
+
scrollHeight
|
|
194
|
+
} = headerWrapperEl;
|
|
195
|
+
if (headPrevEl) {
|
|
196
|
+
if ((lrPosition ? scrollTop : scrollLeft) > 0) {
|
|
197
|
+
(0, _dom.addClass)(headPrevEl, 'scrolling--middle');
|
|
198
|
+
} else {
|
|
199
|
+
(0, _dom.removeClass)(headPrevEl, 'scrolling--middle');
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (headNextEl) {
|
|
203
|
+
if (lrPosition ? clientHeight < scrollHeight - Math.ceil(scrollTop) : clientWidth < scrollWidth - Math.ceil(scrollLeft)) {
|
|
204
|
+
(0, _dom.addClass)(headNextEl, 'scrolling--middle');
|
|
205
|
+
} else {
|
|
206
|
+
(0, _dom.removeClass)(headNextEl, 'scrolling--middle');
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
const updateTabStyle = () => {
|
|
212
|
+
const handleStyle = () => {
|
|
118
213
|
const {
|
|
119
214
|
activeName
|
|
120
215
|
} = reactData;
|
|
216
|
+
const tabType = computeTabType.value;
|
|
121
217
|
const tabOptions = computeTabOptions.value;
|
|
122
218
|
const tabStaticOptions = computeTabStaticOptions.value;
|
|
123
219
|
const headerWrapperEl = refHeadWrapperElem.value;
|
|
220
|
+
const lrPosition = computeLrPosition.value;
|
|
124
221
|
let lintWidth = 0;
|
|
222
|
+
let lintHeight = 0;
|
|
125
223
|
let lintLeft = 0;
|
|
224
|
+
let lintTop = 0;
|
|
225
|
+
let sBarWidth = 0;
|
|
226
|
+
let sBarHeight = 0;
|
|
126
227
|
let isOver = false;
|
|
127
228
|
if (headerWrapperEl) {
|
|
128
229
|
const index = _xeUtils.default.findIndexOf(tabStaticOptions.length ? tabStaticOptions : tabOptions, item => item.name === activeName);
|
|
129
230
|
const {
|
|
130
231
|
children,
|
|
232
|
+
offsetWidth,
|
|
131
233
|
scrollWidth,
|
|
132
|
-
|
|
234
|
+
offsetHeight,
|
|
235
|
+
scrollHeight,
|
|
236
|
+
clientWidth,
|
|
237
|
+
clientHeight
|
|
133
238
|
} = headerWrapperEl;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if (
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
239
|
+
sBarWidth = offsetWidth - clientWidth;
|
|
240
|
+
sBarHeight = offsetHeight - clientHeight;
|
|
241
|
+
if (lrPosition) {
|
|
242
|
+
isOver = scrollHeight !== clientHeight;
|
|
243
|
+
if (index > -1) {
|
|
244
|
+
const tabEl = children[index];
|
|
245
|
+
if (tabEl) {
|
|
246
|
+
const tabHeight = tabEl.clientHeight;
|
|
247
|
+
const tabWidth = tabEl.clientWidth;
|
|
248
|
+
if (tabType === 'card') {
|
|
249
|
+
lintWidth = tabWidth;
|
|
250
|
+
lintHeight = tabHeight;
|
|
251
|
+
lintTop = tabEl.offsetTop;
|
|
252
|
+
} else if (tabType === 'border-card') {
|
|
253
|
+
lintWidth = tabWidth;
|
|
254
|
+
lintHeight = tabHeight;
|
|
255
|
+
lintTop = tabEl.offsetTop - 1;
|
|
256
|
+
} else {
|
|
257
|
+
lintHeight = Math.max(4, Math.floor(tabHeight * 0.6));
|
|
258
|
+
lintTop = tabEl.offsetTop + Math.floor((tabHeight - lintHeight) / 2);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
} else {
|
|
263
|
+
isOver = scrollWidth !== clientWidth;
|
|
264
|
+
if (index > -1) {
|
|
265
|
+
const tabEl = children[index];
|
|
266
|
+
if (tabEl) {
|
|
267
|
+
const tabWidth = tabEl.clientWidth;
|
|
268
|
+
if (tabType === 'card') {
|
|
269
|
+
lintWidth = tabWidth + 1;
|
|
270
|
+
lintLeft = tabEl.offsetLeft;
|
|
271
|
+
} else if (tabType === 'border-card') {
|
|
272
|
+
lintWidth = tabWidth;
|
|
273
|
+
lintLeft = tabEl.offsetLeft - 1;
|
|
274
|
+
} else {
|
|
275
|
+
lintWidth = Math.max(4, Math.floor(tabWidth * 0.6));
|
|
276
|
+
lintLeft = tabEl.offsetLeft + Math.floor((tabWidth - lintWidth) / 2);
|
|
277
|
+
}
|
|
145
278
|
}
|
|
146
|
-
} else {
|
|
147
|
-
lintWidth = Math.max(4, Math.floor(tabWidth * 0.6));
|
|
148
|
-
lintLeft = tabEl.offsetLeft + Math.floor((tabWidth - lintWidth) / 2);
|
|
149
279
|
}
|
|
150
280
|
}
|
|
151
281
|
}
|
|
282
|
+
reactData.scrollbarWidth = sBarWidth;
|
|
283
|
+
reactData.scrollbarHeight = sBarHeight;
|
|
152
284
|
reactData.lintLeft = lintLeft;
|
|
285
|
+
reactData.lintTop = lintTop;
|
|
153
286
|
reactData.lintWidth = lintWidth;
|
|
287
|
+
reactData.lintHeight = lintHeight;
|
|
154
288
|
reactData.isTabOver = isOver;
|
|
155
|
-
|
|
289
|
+
checkScrolling();
|
|
290
|
+
};
|
|
291
|
+
handleStyle();
|
|
292
|
+
(0, _vue.nextTick)(handleStyle);
|
|
156
293
|
};
|
|
157
294
|
const dispatchEvent = (type, params, evnt) => {
|
|
158
295
|
emit(type, (0, _ui.createEvent)(evnt, {
|
|
@@ -346,7 +483,9 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
346
483
|
const {
|
|
347
484
|
slTimeout
|
|
348
485
|
} = internalData;
|
|
349
|
-
|
|
486
|
+
const lrPosition = computeLrPosition.value;
|
|
487
|
+
let offsetLeft = lrPosition ? 0 : offsetSize;
|
|
488
|
+
let offsetTop = lrPosition ? offsetSize : 0;
|
|
350
489
|
let scrollCount = 6;
|
|
351
490
|
let delayNum = 35;
|
|
352
491
|
if (slTimeout) {
|
|
@@ -360,21 +499,41 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
360
499
|
if (headerWrapperEl) {
|
|
361
500
|
const {
|
|
362
501
|
clientWidth,
|
|
502
|
+
clientHeight,
|
|
363
503
|
scrollWidth,
|
|
364
|
-
|
|
504
|
+
scrollHeight,
|
|
505
|
+
scrollLeft,
|
|
506
|
+
scrollTop
|
|
365
507
|
} = headerWrapperEl;
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
if (
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
508
|
+
if (lrPosition) {
|
|
509
|
+
offsetTop = Math.floor(offsetTop / 2);
|
|
510
|
+
if (offsetPos > 0) {
|
|
511
|
+
if (clientHeight + scrollTop < scrollHeight) {
|
|
512
|
+
headerWrapperEl.scrollTop += offsetTop;
|
|
513
|
+
delayNum -= 4;
|
|
514
|
+
internalData.slTimeout = setTimeout(scrollAnimate, delayNum);
|
|
515
|
+
}
|
|
516
|
+
} else {
|
|
517
|
+
if (scrollTop > 0) {
|
|
518
|
+
headerWrapperEl.scrollTop -= offsetTop;
|
|
519
|
+
delayNum -= 4;
|
|
520
|
+
internalData.slTimeout = setTimeout(scrollAnimate, delayNum);
|
|
521
|
+
}
|
|
372
522
|
}
|
|
373
523
|
} else {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
524
|
+
offsetLeft = Math.floor(offsetLeft / 2);
|
|
525
|
+
if (offsetPos > 0) {
|
|
526
|
+
if (clientWidth + scrollLeft < scrollWidth) {
|
|
527
|
+
headerWrapperEl.scrollLeft += offsetLeft;
|
|
528
|
+
delayNum -= 4;
|
|
529
|
+
internalData.slTimeout = setTimeout(scrollAnimate, delayNum);
|
|
530
|
+
}
|
|
531
|
+
} else {
|
|
532
|
+
if (scrollLeft > 0) {
|
|
533
|
+
headerWrapperEl.scrollLeft -= offsetLeft;
|
|
534
|
+
delayNum -= 4;
|
|
535
|
+
internalData.slTimeout = setTimeout(scrollAnimate, delayNum);
|
|
536
|
+
}
|
|
378
537
|
}
|
|
379
538
|
}
|
|
380
539
|
updateTabStyle();
|
|
@@ -384,9 +543,14 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
384
543
|
scrollAnimate();
|
|
385
544
|
};
|
|
386
545
|
const handleScrollToLeft = offsetPos => {
|
|
546
|
+
const lrPosition = computeLrPosition.value;
|
|
387
547
|
const headerWrapperEl = refHeadWrapperElem.value;
|
|
388
548
|
if (headerWrapperEl) {
|
|
389
|
-
const
|
|
549
|
+
const {
|
|
550
|
+
clientWidth,
|
|
551
|
+
clientHeight
|
|
552
|
+
} = headerWrapperEl;
|
|
553
|
+
const offsetSize = Math.floor((lrPosition ? clientHeight : clientWidth) * 0.75);
|
|
390
554
|
startScrollAnimation(offsetPos, offsetSize);
|
|
391
555
|
}
|
|
392
556
|
};
|
|
@@ -399,6 +563,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
399
563
|
const scrollToTab = name => {
|
|
400
564
|
const tabOptions = computeTabOptions.value;
|
|
401
565
|
const tabStaticOptions = computeTabStaticOptions.value;
|
|
566
|
+
const lrPosition = computeLrPosition.value;
|
|
402
567
|
return (0, _vue.nextTick)().then(() => {
|
|
403
568
|
const headerWrapperEl = refHeadWrapperElem.value;
|
|
404
569
|
if (headerWrapperEl) {
|
|
@@ -406,21 +571,37 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
406
571
|
if (index > -1) {
|
|
407
572
|
const {
|
|
408
573
|
scrollLeft,
|
|
574
|
+
scrollTop,
|
|
409
575
|
clientWidth,
|
|
576
|
+
clientHeight,
|
|
410
577
|
children
|
|
411
578
|
} = headerWrapperEl;
|
|
412
579
|
const tabEl = children[index];
|
|
413
580
|
if (tabEl) {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
581
|
+
if (lrPosition) {
|
|
582
|
+
const tabOffsetTop = tabEl.offsetTop;
|
|
583
|
+
const tabClientHeight = tabEl.clientHeight;
|
|
584
|
+
// 如果顶部被挡
|
|
585
|
+
const overSize = tabOffsetTop + tabClientHeight - (scrollTop + clientHeight);
|
|
586
|
+
if (overSize > 0) {
|
|
587
|
+
headerWrapperEl.scrollTop += overSize;
|
|
588
|
+
}
|
|
589
|
+
// 如果底部被挡,优先
|
|
590
|
+
if (tabOffsetTop < scrollTop) {
|
|
591
|
+
headerWrapperEl.scrollTop = tabOffsetTop;
|
|
592
|
+
}
|
|
593
|
+
} else {
|
|
594
|
+
const tabOffsetLeft = tabEl.offsetLeft;
|
|
595
|
+
const tabClientWidth = tabEl.clientWidth;
|
|
596
|
+
// 如果右侧被挡
|
|
597
|
+
const overSize = tabOffsetLeft + tabClientWidth - (scrollLeft + clientWidth);
|
|
598
|
+
if (overSize > 0) {
|
|
599
|
+
headerWrapperEl.scrollLeft += overSize;
|
|
600
|
+
}
|
|
601
|
+
// 如果左侧被挡,优先
|
|
602
|
+
if (tabOffsetLeft < scrollLeft) {
|
|
603
|
+
headerWrapperEl.scrollLeft = tabOffsetLeft;
|
|
604
|
+
}
|
|
424
605
|
}
|
|
425
606
|
}
|
|
426
607
|
}
|
|
@@ -479,7 +660,6 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
479
660
|
Object.assign($xeTabs, tabsMethods, tabsPrivateMethods);
|
|
480
661
|
const renderTabHeader = tabList => {
|
|
481
662
|
const {
|
|
482
|
-
type,
|
|
483
663
|
titleWidth: allTitleWidth,
|
|
484
664
|
titleAlign: allTitleAlign,
|
|
485
665
|
showClose,
|
|
@@ -488,28 +668,47 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
488
668
|
} = props;
|
|
489
669
|
const {
|
|
490
670
|
activeName,
|
|
491
|
-
|
|
492
|
-
|
|
671
|
+
scrollbarWidth,
|
|
672
|
+
scrollbarHeight,
|
|
493
673
|
isTabOver,
|
|
494
674
|
cacheTabMaps
|
|
495
675
|
} = reactData;
|
|
496
|
-
const
|
|
676
|
+
const tabType = computeTabType.value;
|
|
677
|
+
const tabPosition = computeTabPosition.value;
|
|
678
|
+
const lrPosition = computeLrPosition.value;
|
|
679
|
+
const lineStyle = computeLineStyle.value;
|
|
680
|
+
const prefixSlot = slots.prefix;
|
|
681
|
+
const suffixSlot = slots.suffix || slots.extra;
|
|
497
682
|
const closeOpts = computeCloseOpts.value;
|
|
498
683
|
const closeVisibleMethod = closeOpts.visibleMethod;
|
|
499
684
|
const refreshOpts = computeRefreshOpts.value;
|
|
500
685
|
const refreshVisibleMethod = refreshOpts.visibleMethod;
|
|
501
686
|
return (0, _vue.h)('div', {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
687
|
+
key: 'th',
|
|
688
|
+
class: ['vxe-tabs-header', `type--${tabType}`, `pos--${tabPosition}`]
|
|
689
|
+
}, [prefixSlot ? (0, _vue.h)('div', {
|
|
690
|
+
class: ['vxe-tabs-header--prefix', `type--${tabType}`, `pos--${tabPosition}`]
|
|
691
|
+
}, (0, _vn.getSlotVNs)(prefixSlot({
|
|
692
|
+
name: activeName
|
|
693
|
+
}))) : (0, _ui.renderEmptyElement)($xeTabs), isTabOver ? (0, _vue.h)('div', {
|
|
694
|
+
ref: refHeadPrevElem,
|
|
695
|
+
class: ['vxe-tabs-header--bar vxe-tabs-header--prev-bar', `type--${tabType}`, `pos--${tabPosition}`],
|
|
505
696
|
onClick: scrollLeftEvent
|
|
506
697
|
}, [(0, _vue.h)('span', {
|
|
507
|
-
class: (0, _ui.getIcon)().TABS_TAB_BUTTON_LEFT
|
|
698
|
+
class: lrPosition ? (0, _ui.getIcon)().TABS_TAB_BUTTON_TOP : (0, _ui.getIcon)().TABS_TAB_BUTTON_LEFT
|
|
508
699
|
})]) : (0, _ui.renderEmptyElement)($xeTabs), (0, _vue.h)('div', {
|
|
509
|
-
class: 'vxe-tabs-header--wrapper'
|
|
700
|
+
class: ['vxe-tabs-header--wrapper', `type--${tabType}`, `pos--${tabPosition}`]
|
|
510
701
|
}, [(0, _vue.h)('div', {
|
|
511
702
|
ref: refHeadWrapperElem,
|
|
512
|
-
class: 'vxe-tabs-header--item-wrapper'
|
|
703
|
+
class: 'vxe-tabs-header--item-wrapper',
|
|
704
|
+
style: lrPosition ? {
|
|
705
|
+
marginRight: `-${scrollbarWidth + scrollbarOffsetSize}px`,
|
|
706
|
+
paddingRight: `${scrollbarOffsetSize}px`
|
|
707
|
+
} : {
|
|
708
|
+
marginBottom: `-${scrollbarHeight + scrollbarOffsetSize}px`,
|
|
709
|
+
paddingBottom: `${scrollbarOffsetSize}px`
|
|
710
|
+
},
|
|
711
|
+
onScroll: checkScrolling
|
|
513
712
|
}, tabList.map((item, index) => {
|
|
514
713
|
const {
|
|
515
714
|
title,
|
|
@@ -533,12 +732,12 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
533
732
|
const isLoading = cacheItem ? cacheItem.loading : false;
|
|
534
733
|
return (0, _vue.h)('div', {
|
|
535
734
|
key: `${name}`,
|
|
536
|
-
class: ['vxe-tabs-header--item', itemAlign ? `align--${itemAlign}` : '', {
|
|
735
|
+
class: ['vxe-tabs-header--item', `type--${tabType}`, `pos--${tabPosition}`, itemAlign ? `align--${itemAlign}` : '', {
|
|
537
736
|
'is--active': isActive
|
|
538
737
|
}],
|
|
539
738
|
style: itemWidth ? {
|
|
540
739
|
width: (0, _dom.toCssUnit)(itemWidth)
|
|
541
|
-
} :
|
|
740
|
+
} : undefined,
|
|
542
741
|
onClick(evnt) {
|
|
543
742
|
clickEvent(evnt, item);
|
|
544
743
|
}
|
|
@@ -555,15 +754,19 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
555
754
|
}, titleSlot ? callSlot(titleSlot, {
|
|
556
755
|
name,
|
|
557
756
|
title
|
|
558
|
-
}) : `${title}`)]), ((0, _utils.isEnableConf)(refreshConfig) || refreshOpts.enabled) && (refreshVisibleMethod ? refreshVisibleMethod(params) :
|
|
559
|
-
class: 'vxe-tabs-header--refresh-btn',
|
|
757
|
+
}) : `${title}`)]), ((0, _utils.isEnableConf)(refreshConfig) || refreshOpts.enabled) && (refreshVisibleMethod ? refreshVisibleMethod(params) : true) ? (0, _vue.h)('div', {
|
|
758
|
+
class: ['vxe-tabs-header--refresh-btn', {
|
|
759
|
+
'is--active': isActive
|
|
760
|
+
}],
|
|
560
761
|
onClick(evnt) {
|
|
561
762
|
handleRefreshTabEvent(evnt, item);
|
|
562
763
|
}
|
|
563
764
|
}, [(0, _vue.h)('i', {
|
|
564
765
|
class: isLoading ? (0, _ui.getIcon)().TABS_TAB_REFRESH_LOADING : (0, _ui.getIcon)().TABS_TAB_REFRESH
|
|
565
766
|
})]) : (0, _ui.renderEmptyElement)($xeTabs), (showClose || (0, _utils.isEnableConf)(closeConfig) || closeOpts.enabled) && (!closeVisibleMethod || closeVisibleMethod(params)) ? (0, _vue.h)('div', {
|
|
566
|
-
class: 'vxe-tabs-header--close-btn',
|
|
767
|
+
class: ['vxe-tabs-header--close-btn', {
|
|
768
|
+
'is--active': isActive
|
|
769
|
+
}],
|
|
567
770
|
onClick(evnt) {
|
|
568
771
|
handleCloseTabEvent(evnt, item, index, tabList);
|
|
569
772
|
}
|
|
@@ -572,19 +775,19 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
572
775
|
})]) : (0, _ui.renderEmptyElement)($xeTabs)])]);
|
|
573
776
|
}).concat([(0, _vue.h)('span', {
|
|
574
777
|
key: 'line',
|
|
575
|
-
class:
|
|
576
|
-
style:
|
|
577
|
-
left: `${lintLeft}px`,
|
|
578
|
-
width: `${lintWidth}px`
|
|
579
|
-
}
|
|
778
|
+
class: ['vxe-tabs-header--active-line', `type--${tabType}`, `pos--${tabPosition}`],
|
|
779
|
+
style: lineStyle
|
|
580
780
|
})]))]), isTabOver ? (0, _vue.h)('div', {
|
|
581
|
-
|
|
781
|
+
ref: refHeadNextElem,
|
|
782
|
+
class: ['vxe-tabs-header--bar vxe-tabs-header--next-bar', `type--${tabType}`, `pos--${tabPosition}`],
|
|
582
783
|
onClick: scrollRightEvent
|
|
583
784
|
}, [(0, _vue.h)('span', {
|
|
584
|
-
class: (0, _ui.getIcon)().TABS_TAB_BUTTON_RIGHT
|
|
585
|
-
})]) : (0, _ui.renderEmptyElement)($xeTabs),
|
|
586
|
-
class: 'vxe-tabs-header--
|
|
587
|
-
}, (0, _vn.getSlotVNs)(
|
|
785
|
+
class: lrPosition ? (0, _ui.getIcon)().TABS_TAB_BUTTON_BOTTOM : (0, _ui.getIcon)().TABS_TAB_BUTTON_RIGHT
|
|
786
|
+
})]) : (0, _ui.renderEmptyElement)($xeTabs), suffixSlot ? (0, _vue.h)('div', {
|
|
787
|
+
class: ['vxe-tabs-header--suffix', `type--${tabType}`, `pos--${tabPosition}`]
|
|
788
|
+
}, (0, _vn.getSlotVNs)(suffixSlot({
|
|
789
|
+
name: activeName
|
|
790
|
+
}))) : (0, _ui.renderEmptyElement)($xeTabs)]);
|
|
588
791
|
};
|
|
589
792
|
const renderTabPane = item => {
|
|
590
793
|
const {
|
|
@@ -599,64 +802,106 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
599
802
|
return name && initNames.includes(name) ? (0, _vue.h)('div', {
|
|
600
803
|
key: `${name}`,
|
|
601
804
|
class: ['vxe-tabs-pane--item', {
|
|
602
|
-
'is--visible': activeName === name
|
|
603
|
-
'has--content': !!defaultSlot
|
|
805
|
+
'is--visible': activeName === name
|
|
604
806
|
}]
|
|
605
807
|
}, defaultSlot ? callSlot(defaultSlot, {
|
|
606
808
|
name
|
|
607
809
|
}) : []) : (0, _ui.renderEmptyElement)($xeTabs);
|
|
608
810
|
};
|
|
609
|
-
const renderTabContent = tabList => {
|
|
811
|
+
const renderTabContent = (tabList, activeTab) => {
|
|
610
812
|
const {
|
|
611
813
|
destroyOnClose
|
|
612
814
|
} = props;
|
|
815
|
+
if (destroyOnClose) {
|
|
816
|
+
return [activeTab ? renderTabPane(activeTab) : (0, _ui.renderEmptyElement)($xeTabs)];
|
|
817
|
+
}
|
|
818
|
+
return tabList.map(item => renderTabPane(item));
|
|
819
|
+
};
|
|
820
|
+
const rendetTabBody = tabList => {
|
|
821
|
+
const {
|
|
822
|
+
height,
|
|
823
|
+
padding,
|
|
824
|
+
showBody
|
|
825
|
+
} = props;
|
|
613
826
|
const {
|
|
614
827
|
activeName
|
|
615
828
|
} = reactData;
|
|
829
|
+
const tabType = computeTabType.value;
|
|
830
|
+
const tabPosition = computeTabPosition.value;
|
|
831
|
+
const headerpSlot = slots.header;
|
|
832
|
+
const footerSlot = slots.footer;
|
|
833
|
+
const defParams = {
|
|
834
|
+
name: activeName
|
|
835
|
+
};
|
|
616
836
|
const activeDefaultTab = tabList.find(item => item.name === activeName);
|
|
617
|
-
|
|
618
|
-
|
|
837
|
+
let hasContent = false;
|
|
838
|
+
if (activeDefaultTab) {
|
|
839
|
+
const {
|
|
840
|
+
slots
|
|
841
|
+
} = activeDefaultTab;
|
|
842
|
+
hasContent = !!(slots && slots.default);
|
|
619
843
|
}
|
|
620
|
-
return
|
|
844
|
+
return (0, _vue.h)('div', {
|
|
845
|
+
key: 'tb',
|
|
846
|
+
class: ['vxe-tabs-pane--wrapper', `type--${tabType}`, `pos--${tabPosition}`, {
|
|
847
|
+
'is--content': showBody === false ? showBody : hasContent
|
|
848
|
+
}]
|
|
849
|
+
}, [headerpSlot ? (0, _vue.h)('div', {
|
|
850
|
+
class: 'vxe-tabs-pane--header'
|
|
851
|
+
}, callSlot(headerpSlot, defParams)) : (0, _ui.renderEmptyElement)($xeTabs), (0, _vue.h)('div', {
|
|
852
|
+
class: ['vxe-tabs-pane--body', `type--${tabType}`, `pos--${tabPosition}`, {
|
|
853
|
+
'is--padding': padding,
|
|
854
|
+
'is--height': height
|
|
855
|
+
}]
|
|
856
|
+
}, renderTabContent(tabList, activeDefaultTab)), footerSlot ? (0, _vue.h)('div', {
|
|
857
|
+
class: 'vxe-tabs-pane--footer'
|
|
858
|
+
}, callSlot(footerSlot, defParams)) : (0, _ui.renderEmptyElement)($xeTabs)]);
|
|
621
859
|
};
|
|
622
860
|
const renderVN = () => {
|
|
623
861
|
const {
|
|
624
|
-
type,
|
|
625
862
|
height,
|
|
626
863
|
padding,
|
|
627
864
|
trigger
|
|
628
865
|
} = props;
|
|
866
|
+
const {
|
|
867
|
+
activeName
|
|
868
|
+
} = reactData;
|
|
629
869
|
const tabOptions = computeTabOptions.value;
|
|
630
870
|
const tabStaticOptions = computeTabStaticOptions.value;
|
|
871
|
+
const tabType = computeTabType.value;
|
|
872
|
+
const tabPosition = computeTabPosition.value;
|
|
873
|
+
const wrapperStyle = computeWrapperStyle.value;
|
|
631
874
|
const defaultSlot = slots.default;
|
|
632
|
-
const footerSlot = slots.footer;
|
|
633
875
|
const tabList = defaultSlot ? tabStaticOptions : tabOptions;
|
|
876
|
+
const vns = [(0, _vue.h)('div', {
|
|
877
|
+
key: 'ts',
|
|
878
|
+
class: 'vxe-tabs-slots'
|
|
879
|
+
}, defaultSlot ? defaultSlot({
|
|
880
|
+
name: activeName
|
|
881
|
+
}) : [])];
|
|
882
|
+
if (tabPosition === 'right' || tabPosition === 'bottom') {
|
|
883
|
+
vns.push(rendetTabBody(tabList), renderTabHeader(tabList));
|
|
884
|
+
} else {
|
|
885
|
+
vns.push(renderTabHeader(tabList), rendetTabBody(tabList));
|
|
886
|
+
}
|
|
634
887
|
return (0, _vue.h)('div', {
|
|
635
888
|
ref: refElem,
|
|
636
|
-
class: ['vxe-tabs', `vxe-tabs--${
|
|
889
|
+
class: ['vxe-tabs', `pos--${tabPosition}`, `vxe-tabs--${tabType}`, `trigger--${trigger === 'manual' ? 'trigger' : 'default'}`, {
|
|
637
890
|
'is--padding': padding,
|
|
638
891
|
'is--height': height
|
|
639
892
|
}],
|
|
640
|
-
style:
|
|
641
|
-
|
|
642
|
-
} : null
|
|
643
|
-
}, [(0, _vue.h)('div', {
|
|
644
|
-
class: 'vxe-tabs-slots'
|
|
645
|
-
}, defaultSlot ? defaultSlot({}) : []), renderTabHeader(tabList), (0, _vue.h)('div', {
|
|
646
|
-
class: 'vxe-tabs-pane'
|
|
647
|
-
}, renderTabContent(tabList)), footerSlot ? (0, _vue.h)('div', {
|
|
648
|
-
class: 'vxe-tabs-footer'
|
|
649
|
-
}, callSlot(footerSlot, {})) : (0, _ui.renderEmptyElement)($xeTabs)]);
|
|
893
|
+
style: wrapperStyle
|
|
894
|
+
}, vns);
|
|
650
895
|
};
|
|
896
|
+
(0, _vue.watch)(() => props.position, () => {
|
|
897
|
+
reactData.resizeFlag++;
|
|
898
|
+
});
|
|
651
899
|
(0, _vue.watch)(() => props.modelValue, val => {
|
|
652
900
|
addInitName(val, null);
|
|
653
901
|
reactData.activeName = val;
|
|
654
902
|
});
|
|
655
903
|
(0, _vue.watch)(() => reactData.activeName, val => {
|
|
656
904
|
scrollToTab(val);
|
|
657
|
-
(0, _vue.nextTick)(() => {
|
|
658
|
-
reactData.resizeFlag++;
|
|
659
|
-
});
|
|
660
905
|
});
|
|
661
906
|
const optsFlag = (0, _vue.ref)(0);
|
|
662
907
|
(0, _vue.watch)(() => props.options ? props.options.length : -1, () => {
|
|
@@ -667,7 +912,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
667
912
|
});
|
|
668
913
|
(0, _vue.watch)(optsFlag, () => {
|
|
669
914
|
initDefaultName(props.options);
|
|
670
|
-
|
|
915
|
+
reactData.resizeFlag++;
|
|
671
916
|
});
|
|
672
917
|
const stFlag = (0, _vue.ref)(0);
|
|
673
918
|
(0, _vue.watch)(() => reactData.staticTabs ? reactData.staticTabs.length : -1, () => {
|
|
@@ -678,21 +923,19 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
678
923
|
});
|
|
679
924
|
(0, _vue.watch)(stFlag, () => {
|
|
680
925
|
initDefaultName(reactData.staticTabs);
|
|
681
|
-
|
|
926
|
+
reactData.resizeFlag++;
|
|
927
|
+
});
|
|
928
|
+
(0, _vue.watch)(computeParentTabsResizeFlag, () => {
|
|
929
|
+
reactData.resizeFlag++;
|
|
682
930
|
});
|
|
683
|
-
if ($xeParentTabs) {
|
|
684
|
-
(0, _vue.watch)(() => $xeParentTabs ? $xeParentTabs.reactData.resizeFlag : null, () => {
|
|
685
|
-
reactData.resizeFlag++;
|
|
686
|
-
});
|
|
687
|
-
}
|
|
688
931
|
(0, _vue.watch)(() => reactData.resizeFlag, () => {
|
|
689
932
|
(0, _vue.nextTick)(() => {
|
|
690
933
|
updateTabStyle();
|
|
691
934
|
});
|
|
692
935
|
});
|
|
693
936
|
(0, _vue.onMounted)(() => {
|
|
694
|
-
_ui.globalEvents.on($xeTabs, 'resize', updateTabStyle);
|
|
695
937
|
updateTabStyle();
|
|
938
|
+
_ui.globalEvents.on($xeTabs, 'resize', updateTabStyle);
|
|
696
939
|
});
|
|
697
940
|
(0, _vue.onUnmounted)(() => {
|
|
698
941
|
_ui.globalEvents.off($xeTabs, 'resize');
|