vxe-pc-ui 4.6.35 → 4.6.36

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 (44) hide show
  1. package/es/icon/style.css +1 -1
  2. package/es/style.css +1 -1
  3. package/es/style.min.css +1 -1
  4. package/es/tabs/src/tabs.js +290 -89
  5. package/es/tabs/style.css +431 -156
  6. package/es/tabs/style.min.css +1 -1
  7. package/es/ui/index.js +3 -1
  8. package/es/ui/src/log.js +1 -1
  9. package/es/vxe-tabs/style.css +431 -156
  10. package/es/vxe-tabs/style.min.css +1 -1
  11. package/lib/icon/style/style.css +1 -1
  12. package/lib/icon/style/style.min.css +1 -1
  13. package/lib/index.umd.js +310 -84
  14. package/lib/index.umd.min.js +1 -1
  15. package/lib/style.css +1 -1
  16. package/lib/style.min.css +1 -1
  17. package/lib/tabs/src/tabs.js +306 -82
  18. package/lib/tabs/src/tabs.min.js +1 -1
  19. package/lib/tabs/style/style.css +431 -156
  20. package/lib/tabs/style/style.min.css +1 -1
  21. package/lib/ui/index.js +3 -1
  22. package/lib/ui/index.min.js +1 -1
  23. package/lib/ui/src/log.js +1 -1
  24. package/lib/ui/src/log.min.js +1 -1
  25. package/lib/vxe-tabs/style/style.css +431 -156
  26. package/lib/vxe-tabs/style/style.min.css +1 -1
  27. package/package.json +1 -1
  28. package/packages/tabs/src/tabs.ts +299 -90
  29. package/packages/ui/index.ts +2 -0
  30. package/styles/components/tabs.scss +534 -183
  31. package/types/components/tabs.d.ts +22 -6
  32. package/types/ui/global-icon.d.ts +2 -0
  33. /package/es/icon/{iconfont.1750910542831.ttf → iconfont.1751108492990.ttf} +0 -0
  34. /package/es/icon/{iconfont.1750910542831.woff → iconfont.1751108492990.woff} +0 -0
  35. /package/es/icon/{iconfont.1750910542831.woff2 → iconfont.1751108492990.woff2} +0 -0
  36. /package/es/{iconfont.1750910542831.ttf → iconfont.1751108492990.ttf} +0 -0
  37. /package/es/{iconfont.1750910542831.woff → iconfont.1751108492990.woff} +0 -0
  38. /package/es/{iconfont.1750910542831.woff2 → iconfont.1751108492990.woff2} +0 -0
  39. /package/lib/icon/style/{iconfont.1750910542831.ttf → iconfont.1751108492990.ttf} +0 -0
  40. /package/lib/icon/style/{iconfont.1750910542831.woff → iconfont.1751108492990.woff} +0 -0
  41. /package/lib/icon/style/{iconfont.1750910542831.woff2 → iconfont.1751108492990.woff2} +0 -0
  42. /package/lib/{iconfont.1750910542831.ttf → iconfont.1751108492990.ttf} +0 -0
  43. /package/lib/{iconfont.1750910542831.woff → iconfont.1751108492990.woff} +0 -0
  44. /package/lib/{iconfont.1750910542831.woff2 → iconfont.1751108492990.woff2} +0 -0
@@ -18,11 +18,19 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
18
18
  props: {
19
19
  modelValue: [String, Number, Boolean],
20
20
  options: Array,
21
+ width: [String, Number],
21
22
  height: [String, Number],
22
23
  destroyOnClose: Boolean,
23
24
  titleWidth: [String, Number],
24
25
  titleAlign: [String, Number],
25
- type: String,
26
+ type: {
27
+ type: String,
28
+ default: () => (0, _ui.getConfig)().tabs.type
29
+ },
30
+ position: {
31
+ type: String,
32
+ default: () => (0, _ui.getConfig)().tabs.position
33
+ },
26
34
  showClose: Boolean,
27
35
  padding: {
28
36
  type: Boolean,
@@ -45,12 +53,17 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
45
53
  const $xeParentTabs = (0, _vue.inject)('$xeTabs', null);
46
54
  const refElem = (0, _vue.ref)();
47
55
  const refHeadWrapperElem = (0, _vue.ref)();
56
+ const refHeadPrevElem = (0, _vue.ref)();
57
+ const refHeadNextElem = (0, _vue.ref)();
48
58
  const reactData = (0, _vue.reactive)({
49
59
  staticTabs: [],
50
60
  activeName: null,
51
61
  initNames: [],
52
62
  lintLeft: 0,
63
+ lintTop: 0,
53
64
  lintWidth: 0,
65
+ lintHeight: 0,
66
+ scrollbarWidth: 0,
54
67
  isTabOver: false,
55
68
  resizeFlag: 1,
56
69
  cacheTabMaps: {}
@@ -61,6 +74,52 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
61
74
  const refMaps = {
62
75
  refElem
63
76
  };
77
+ const computeTabType = (0, _vue.computed)(() => {
78
+ const {
79
+ type
80
+ } = props;
81
+ return type || 'default';
82
+ });
83
+ const computeTabPosition = (0, _vue.computed)(() => {
84
+ const {
85
+ position
86
+ } = props;
87
+ return position || 'top';
88
+ });
89
+ const computeLrPosition = (0, _vue.computed)(() => {
90
+ const tabPosition = computeTabPosition.value;
91
+ return tabPosition === 'left' || tabPosition === 'right';
92
+ });
93
+ const computeLineStyle = (0, _vue.computed)(() => {
94
+ const {
95
+ lintLeft,
96
+ lintTop,
97
+ lintWidth,
98
+ lintHeight
99
+ } = reactData;
100
+ const lrPosition = computeLrPosition.value;
101
+ return lrPosition ? {
102
+ top: `${lintTop}px`,
103
+ height: `${lintHeight}px`
104
+ } : {
105
+ left: `${lintLeft}px`,
106
+ width: `${lintWidth}px`
107
+ };
108
+ });
109
+ const computeWrapperStyle = (0, _vue.computed)(() => {
110
+ const {
111
+ width,
112
+ height
113
+ } = props;
114
+ const stys = {};
115
+ if (width) {
116
+ stys.width = (0, _dom.toCssUnit)(width);
117
+ }
118
+ if (width) {
119
+ stys.height = (0, _dom.toCssUnit)(height);
120
+ }
121
+ return stys;
122
+ });
64
123
  const computeCloseOpts = (0, _vue.computed)(() => {
65
124
  return Object.assign({}, (0, _ui.getConfig)().tabs.closeConfig, props.closeConfig);
66
125
  });
@@ -110,49 +169,114 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
110
169
  }
111
170
  return [];
112
171
  };
113
- const updateTabStyle = () => {
114
- (0, _vue.nextTick)(() => {
172
+ const checkScrolling = () => {
173
+ const lrPosition = computeLrPosition.value;
174
+ const headerWrapperEl = refHeadWrapperElem.value;
175
+ const headPrevEl = refHeadPrevElem.value;
176
+ const headNextEl = refHeadNextElem.value;
177
+ if (headerWrapperEl) {
115
178
  const {
116
- type
117
- } = props;
179
+ scrollLeft,
180
+ scrollTop,
181
+ clientWidth,
182
+ clientHeight,
183
+ scrollWidth,
184
+ scrollHeight
185
+ } = headerWrapperEl;
186
+ if (headPrevEl) {
187
+ if ((lrPosition ? scrollTop : scrollLeft) > 0) {
188
+ (0, _dom.addClass)(headPrevEl, 'scrolling--middle');
189
+ } else {
190
+ (0, _dom.removeClass)(headPrevEl, 'scrolling--middle');
191
+ }
192
+ }
193
+ if (headNextEl) {
194
+ if (lrPosition ? clientHeight < scrollHeight - Math.ceil(scrollTop) : clientWidth < scrollWidth - Math.ceil(scrollLeft)) {
195
+ (0, _dom.addClass)(headNextEl, 'scrolling--middle');
196
+ } else {
197
+ (0, _dom.removeClass)(headNextEl, 'scrolling--middle');
198
+ }
199
+ }
200
+ }
201
+ };
202
+ const updateTabStyle = () => {
203
+ const handleStyle = () => {
118
204
  const {
119
205
  activeName
120
206
  } = reactData;
207
+ const tabType = computeTabType.value;
121
208
  const tabOptions = computeTabOptions.value;
122
209
  const tabStaticOptions = computeTabStaticOptions.value;
123
210
  const headerWrapperEl = refHeadWrapperElem.value;
211
+ const lrPosition = computeLrPosition.value;
124
212
  let lintWidth = 0;
213
+ let lintHeight = 0;
125
214
  let lintLeft = 0;
215
+ let lintTop = 0;
216
+ let scrollbarWidth = 0;
126
217
  let isOver = false;
127
218
  if (headerWrapperEl) {
128
219
  const index = _xeUtils.default.findIndexOf(tabStaticOptions.length ? tabStaticOptions : tabOptions, item => item.name === activeName);
129
220
  const {
130
221
  children,
222
+ offsetWidth,
131
223
  scrollWidth,
132
- clientWidth
224
+ scrollHeight,
225
+ clientWidth,
226
+ clientHeight
133
227
  } = headerWrapperEl;
134
- isOver = scrollWidth !== clientWidth;
135
- if (index > -1) {
136
- const tabEl = children[index];
137
- const tabWidth = tabEl.clientWidth;
138
- if (type) {
139
- if (type === 'card') {
140
- lintWidth = tabWidth + 2;
141
- lintLeft = tabEl.offsetLeft;
142
- } else if (type === 'border-card') {
143
- lintWidth = tabWidth + 2;
144
- lintLeft = tabEl.offsetLeft - 1;
228
+ scrollbarWidth = offsetWidth - clientWidth;
229
+ if (lrPosition) {
230
+ isOver = scrollHeight !== clientHeight;
231
+ if (index > -1) {
232
+ const tabEl = children[index];
233
+ if (tabEl) {
234
+ const tabHeight = tabEl.clientHeight;
235
+ const tabWidth = tabEl.clientWidth;
236
+ if (tabType === 'card') {
237
+ lintWidth = tabWidth;
238
+ lintHeight = tabHeight;
239
+ lintTop = tabEl.offsetTop;
240
+ } else if (tabType === 'border-card') {
241
+ lintWidth = tabWidth;
242
+ lintHeight = tabHeight;
243
+ lintTop = tabEl.offsetTop - 1;
244
+ } else {
245
+ lintHeight = Math.max(4, Math.floor(tabHeight * 0.6));
246
+ lintTop = tabEl.offsetTop + Math.floor((tabHeight - lintHeight) / 2);
247
+ }
248
+ }
249
+ }
250
+ } else {
251
+ isOver = scrollWidth !== clientWidth;
252
+ if (index > -1) {
253
+ const tabEl = children[index];
254
+ if (tabEl) {
255
+ const tabWidth = tabEl.clientWidth;
256
+ if (tabType === 'card') {
257
+ lintWidth = tabWidth;
258
+ lintLeft = tabEl.offsetLeft;
259
+ } else if (tabType === 'border-card') {
260
+ lintWidth = tabWidth;
261
+ lintLeft = tabEl.offsetLeft - 1;
262
+ } else {
263
+ lintWidth = Math.max(4, Math.floor(tabWidth * 0.6));
264
+ lintLeft = tabEl.offsetLeft + Math.floor((tabWidth - lintWidth) / 2);
265
+ }
145
266
  }
146
- } else {
147
- lintWidth = Math.max(4, Math.floor(tabWidth * 0.6));
148
- lintLeft = tabEl.offsetLeft + Math.floor((tabWidth - lintWidth) / 2);
149
267
  }
150
268
  }
151
269
  }
270
+ reactData.scrollbarWidth = scrollbarWidth;
152
271
  reactData.lintLeft = lintLeft;
272
+ reactData.lintTop = lintTop;
153
273
  reactData.lintWidth = lintWidth;
274
+ reactData.lintHeight = lintHeight;
154
275
  reactData.isTabOver = isOver;
155
- });
276
+ checkScrolling();
277
+ };
278
+ handleStyle();
279
+ (0, _vue.nextTick)(handleStyle);
156
280
  };
157
281
  const dispatchEvent = (type, params, evnt) => {
158
282
  emit(type, (0, _ui.createEvent)(evnt, {
@@ -346,7 +470,9 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
346
470
  const {
347
471
  slTimeout
348
472
  } = internalData;
349
- let offsetLeft = offsetSize;
473
+ const lrPosition = computeLrPosition.value;
474
+ let offsetLeft = lrPosition ? 0 : offsetSize;
475
+ let offsetTop = lrPosition ? offsetSize : 0;
350
476
  let scrollCount = 6;
351
477
  let delayNum = 35;
352
478
  if (slTimeout) {
@@ -360,21 +486,41 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
360
486
  if (headerWrapperEl) {
361
487
  const {
362
488
  clientWidth,
489
+ clientHeight,
363
490
  scrollWidth,
364
- scrollLeft
491
+ scrollHeight,
492
+ scrollLeft,
493
+ scrollTop
365
494
  } = headerWrapperEl;
366
- offsetLeft = Math.floor(offsetLeft / 2);
367
- if (offsetPos > 0) {
368
- if (clientWidth + scrollLeft < scrollWidth) {
369
- headerWrapperEl.scrollLeft += offsetLeft;
370
- delayNum -= 4;
371
- internalData.slTimeout = setTimeout(scrollAnimate, delayNum);
495
+ if (lrPosition) {
496
+ offsetTop = Math.floor(offsetTop / 2);
497
+ if (offsetPos > 0) {
498
+ if (clientHeight + scrollTop < scrollHeight) {
499
+ headerWrapperEl.scrollTop += offsetTop;
500
+ delayNum -= 4;
501
+ internalData.slTimeout = setTimeout(scrollAnimate, delayNum);
502
+ }
503
+ } else {
504
+ if (scrollTop > 0) {
505
+ headerWrapperEl.scrollTop -= offsetTop;
506
+ delayNum -= 4;
507
+ internalData.slTimeout = setTimeout(scrollAnimate, delayNum);
508
+ }
372
509
  }
373
510
  } else {
374
- if (scrollLeft > 0) {
375
- headerWrapperEl.scrollLeft -= offsetLeft;
376
- delayNum -= 4;
377
- internalData.slTimeout = setTimeout(scrollAnimate, delayNum);
511
+ offsetLeft = Math.floor(offsetLeft / 2);
512
+ if (offsetPos > 0) {
513
+ if (clientWidth + scrollLeft < scrollWidth) {
514
+ headerWrapperEl.scrollLeft += offsetLeft;
515
+ delayNum -= 4;
516
+ internalData.slTimeout = setTimeout(scrollAnimate, delayNum);
517
+ }
518
+ } else {
519
+ if (scrollLeft > 0) {
520
+ headerWrapperEl.scrollLeft -= offsetLeft;
521
+ delayNum -= 4;
522
+ internalData.slTimeout = setTimeout(scrollAnimate, delayNum);
523
+ }
378
524
  }
379
525
  }
380
526
  updateTabStyle();
@@ -384,9 +530,14 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
384
530
  scrollAnimate();
385
531
  };
386
532
  const handleScrollToLeft = offsetPos => {
533
+ const lrPosition = computeLrPosition.value;
387
534
  const headerWrapperEl = refHeadWrapperElem.value;
388
535
  if (headerWrapperEl) {
389
- const offsetSize = Math.floor(headerWrapperEl.clientWidth * 0.75);
536
+ const {
537
+ clientWidth,
538
+ clientHeight
539
+ } = headerWrapperEl;
540
+ const offsetSize = Math.floor((lrPosition ? clientHeight : clientWidth) * 0.75);
390
541
  startScrollAnimation(offsetPos, offsetSize);
391
542
  }
392
543
  };
@@ -399,6 +550,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
399
550
  const scrollToTab = name => {
400
551
  const tabOptions = computeTabOptions.value;
401
552
  const tabStaticOptions = computeTabStaticOptions.value;
553
+ const lrPosition = computeLrPosition.value;
402
554
  return (0, _vue.nextTick)().then(() => {
403
555
  const headerWrapperEl = refHeadWrapperElem.value;
404
556
  if (headerWrapperEl) {
@@ -406,21 +558,37 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
406
558
  if (index > -1) {
407
559
  const {
408
560
  scrollLeft,
561
+ scrollTop,
409
562
  clientWidth,
563
+ clientHeight,
410
564
  children
411
565
  } = headerWrapperEl;
412
566
  const tabEl = children[index];
413
567
  if (tabEl) {
414
- const tabOffsetLeft = tabEl.offsetLeft;
415
- const tabClientWidth = tabEl.clientWidth;
416
- // 如果右侧被挡
417
- const overSize = tabOffsetLeft + tabClientWidth - (scrollLeft + clientWidth);
418
- if (overSize > 0) {
419
- headerWrapperEl.scrollLeft += overSize;
420
- }
421
- // 如果左侧被挡,优先
422
- if (tabOffsetLeft < scrollLeft) {
423
- headerWrapperEl.scrollLeft = tabOffsetLeft;
568
+ if (lrPosition) {
569
+ const tabOffsetTop = tabEl.offsetTop;
570
+ const tabClientHeight = tabEl.clientHeight;
571
+ // 如果顶部被挡
572
+ const overSize = tabOffsetTop + tabClientHeight - (scrollTop + clientHeight);
573
+ if (overSize > 0) {
574
+ headerWrapperEl.scrollTop += overSize;
575
+ }
576
+ // 如果底部被挡,优先
577
+ if (tabOffsetTop < scrollTop) {
578
+ headerWrapperEl.scrollTop = tabOffsetTop;
579
+ }
580
+ } else {
581
+ const tabOffsetLeft = tabEl.offsetLeft;
582
+ const tabClientWidth = tabEl.clientWidth;
583
+ // 如果右侧被挡
584
+ const overSize = tabOffsetLeft + tabClientWidth - (scrollLeft + clientWidth);
585
+ if (overSize > 0) {
586
+ headerWrapperEl.scrollLeft += overSize;
587
+ }
588
+ // 如果左侧被挡,优先
589
+ if (tabOffsetLeft < scrollLeft) {
590
+ headerWrapperEl.scrollLeft = tabOffsetLeft;
591
+ }
424
592
  }
425
593
  }
426
594
  }
@@ -479,7 +647,6 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
479
647
  Object.assign($xeTabs, tabsMethods, tabsPrivateMethods);
480
648
  const renderTabHeader = tabList => {
481
649
  const {
482
- type,
483
650
  titleWidth: allTitleWidth,
484
651
  titleAlign: allTitleAlign,
485
652
  showClose,
@@ -488,28 +655,42 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
488
655
  } = props;
489
656
  const {
490
657
  activeName,
491
- lintLeft,
492
- lintWidth,
658
+ scrollbarWidth,
493
659
  isTabOver,
494
660
  cacheTabMaps
495
661
  } = reactData;
496
- const extraSlot = slots.extra;
662
+ const tabType = computeTabType.value;
663
+ const tabPosition = computeTabPosition.value;
664
+ const lrPosition = computeLrPosition.value;
665
+ const lineStyle = computeLineStyle.value;
666
+ const prefixSlot = slots.prefix;
667
+ const suffixSlot = slots.suffix || slots.extra;
497
668
  const closeOpts = computeCloseOpts.value;
498
669
  const closeVisibleMethod = closeOpts.visibleMethod;
499
670
  const refreshOpts = computeRefreshOpts.value;
500
671
  const refreshVisibleMethod = refreshOpts.visibleMethod;
501
672
  return (0, _vue.h)('div', {
502
- class: 'vxe-tabs-header'
503
- }, [isTabOver ? (0, _vue.h)('div', {
504
- class: 'vxe-tabs-header--bar vxe-tabs-header--left-bar',
673
+ key: 'th',
674
+ class: ['vxe-tabs-header', `type--${tabType}`, `pos--${tabPosition}`]
675
+ }, [prefixSlot ? (0, _vue.h)('div', {
676
+ class: ['vxe-tabs-header--prefix', `type--${tabType}`, `pos--${tabPosition}`]
677
+ }, (0, _vn.getSlotVNs)(prefixSlot({
678
+ name: activeName
679
+ }))) : (0, _ui.renderEmptyElement)($xeTabs), isTabOver ? (0, _vue.h)('div', {
680
+ ref: refHeadPrevElem,
681
+ class: ['vxe-tabs-header--bar vxe-tabs-header--prev-bar', `type--${tabType}`, `pos--${tabPosition}`],
505
682
  onClick: scrollLeftEvent
506
683
  }, [(0, _vue.h)('span', {
507
- class: (0, _ui.getIcon)().TABS_TAB_BUTTON_LEFT
684
+ class: lrPosition ? (0, _ui.getIcon)().TABS_TAB_BUTTON_TOP : (0, _ui.getIcon)().TABS_TAB_BUTTON_LEFT
508
685
  })]) : (0, _ui.renderEmptyElement)($xeTabs), (0, _vue.h)('div', {
509
- class: 'vxe-tabs-header--wrapper'
686
+ class: ['vxe-tabs-header--wrapper', `type--${tabType}`, `pos--${tabPosition}`]
510
687
  }, [(0, _vue.h)('div', {
511
688
  ref: refHeadWrapperElem,
512
- class: 'vxe-tabs-header--item-wrapper'
689
+ class: 'vxe-tabs-header--item-wrapper',
690
+ style: lrPosition && scrollbarWidth ? {
691
+ marginRight: `-${scrollbarWidth}px`
692
+ } : undefined,
693
+ onScroll: checkScrolling
513
694
  }, tabList.map((item, index) => {
514
695
  const {
515
696
  title,
@@ -533,12 +714,12 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
533
714
  const isLoading = cacheItem ? cacheItem.loading : false;
534
715
  return (0, _vue.h)('div', {
535
716
  key: `${name}`,
536
- class: ['vxe-tabs-header--item', itemAlign ? `align--${itemAlign}` : '', {
717
+ class: ['vxe-tabs-header--item', `type--${tabType}`, `pos--${tabPosition}`, itemAlign ? `align--${itemAlign}` : '', {
537
718
  'is--active': isActive
538
719
  }],
539
720
  style: itemWidth ? {
540
721
  width: (0, _dom.toCssUnit)(itemWidth)
541
- } : null,
722
+ } : undefined,
542
723
  onClick(evnt) {
543
724
  clickEvent(evnt, item);
544
725
  }
@@ -555,15 +736,19 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
555
736
  }, titleSlot ? callSlot(titleSlot, {
556
737
  name,
557
738
  title
558
- }) : `${title}`)]), ((0, _utils.isEnableConf)(refreshConfig) || refreshOpts.enabled) && (refreshVisibleMethod ? refreshVisibleMethod(params) : isActive) ? (0, _vue.h)('div', {
559
- class: 'vxe-tabs-header--refresh-btn',
739
+ }) : `${title}`)]), ((0, _utils.isEnableConf)(refreshConfig) || refreshOpts.enabled) && (refreshVisibleMethod ? refreshVisibleMethod(params) : true) ? (0, _vue.h)('div', {
740
+ class: ['vxe-tabs-header--refresh-btn', {
741
+ 'is--active': isActive
742
+ }],
560
743
  onClick(evnt) {
561
744
  handleRefreshTabEvent(evnt, item);
562
745
  }
563
746
  }, [(0, _vue.h)('i', {
564
747
  class: isLoading ? (0, _ui.getIcon)().TABS_TAB_REFRESH_LOADING : (0, _ui.getIcon)().TABS_TAB_REFRESH
565
748
  })]) : (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',
749
+ class: ['vxe-tabs-header--close-btn', {
750
+ 'is--active': isActive
751
+ }],
567
752
  onClick(evnt) {
568
753
  handleCloseTabEvent(evnt, item, index, tabList);
569
754
  }
@@ -572,19 +757,19 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
572
757
  })]) : (0, _ui.renderEmptyElement)($xeTabs)])]);
573
758
  }).concat([(0, _vue.h)('span', {
574
759
  key: 'line',
575
- class: `vxe-tabs-header--active-line type--${type || 'default'}`,
576
- style: {
577
- left: `${lintLeft}px`,
578
- width: `${lintWidth}px`
579
- }
760
+ class: ['vxe-tabs-header--active-line', `type--${tabType}`, `pos--${tabPosition}`],
761
+ style: lineStyle
580
762
  })]))]), isTabOver ? (0, _vue.h)('div', {
581
- class: 'vxe-tabs-header--bar vxe-tabs-header--right-bar',
763
+ ref: refHeadNextElem,
764
+ class: ['vxe-tabs-header--bar vxe-tabs-header--next-bar', `type--${tabType}`, `pos--${tabPosition}`],
582
765
  onClick: scrollRightEvent
583
766
  }, [(0, _vue.h)('span', {
584
- class: (0, _ui.getIcon)().TABS_TAB_BUTTON_RIGHT
585
- })]) : (0, _ui.renderEmptyElement)($xeTabs), extraSlot ? (0, _vue.h)('div', {
586
- class: 'vxe-tabs-header--extra'
587
- }, (0, _vn.getSlotVNs)(extraSlot({}))) : (0, _ui.renderEmptyElement)($xeTabs)]);
767
+ class: lrPosition ? (0, _ui.getIcon)().TABS_TAB_BUTTON_BOTTOM : (0, _ui.getIcon)().TABS_TAB_BUTTON_RIGHT
768
+ })]) : (0, _ui.renderEmptyElement)($xeTabs), suffixSlot ? (0, _vue.h)('div', {
769
+ class: ['vxe-tabs-header--suffix', `type--${tabType}`, `pos--${tabPosition}`]
770
+ }, (0, _vn.getSlotVNs)(suffixSlot({
771
+ name: activeName
772
+ }))) : (0, _ui.renderEmptyElement)($xeTabs)]);
588
773
  };
589
774
  const renderTabPane = item => {
590
775
  const {
@@ -619,35 +804,74 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
619
804
  }
620
805
  return tabList.map(item => renderTabPane(item));
621
806
  };
807
+ const rendetTabBody = tabList => {
808
+ const {
809
+ height,
810
+ padding
811
+ } = props;
812
+ const {
813
+ activeName
814
+ } = reactData;
815
+ const tabType = computeTabType.value;
816
+ const tabPosition = computeTabPosition.value;
817
+ const topSlot = slots.top;
818
+ const footerSlot = slots.footer;
819
+ const defParams = {
820
+ name: activeName
821
+ };
822
+ return (0, _vue.h)('div', {
823
+ key: 'tb',
824
+ class: ['vxe-tabs-pane--wrapper', `type--${tabType}`, `pos--${tabPosition}`]
825
+ }, [topSlot ? (0, _vue.h)('div', {
826
+ class: 'vxe-tabs-pane--top'
827
+ }, callSlot(topSlot, defParams)) : (0, _ui.renderEmptyElement)($xeTabs), (0, _vue.h)('div', {
828
+ class: ['vxe-tabs-pane--body', `type--${tabType}`, `pos--${tabPosition}`, {
829
+ 'is--padding': padding,
830
+ 'is--height': height
831
+ }]
832
+ }, renderTabContent(tabList)), footerSlot ? (0, _vue.h)('div', {
833
+ class: 'vxe-tabs-pane--footer'
834
+ }, callSlot(footerSlot, defParams)) : (0, _ui.renderEmptyElement)($xeTabs)]);
835
+ };
622
836
  const renderVN = () => {
623
837
  const {
624
- type,
625
838
  height,
626
839
  padding,
627
840
  trigger
628
841
  } = props;
842
+ const {
843
+ activeName
844
+ } = reactData;
629
845
  const tabOptions = computeTabOptions.value;
630
846
  const tabStaticOptions = computeTabStaticOptions.value;
847
+ const tabType = computeTabType.value;
848
+ const tabPosition = computeTabPosition.value;
849
+ const wrapperStyle = computeWrapperStyle.value;
631
850
  const defaultSlot = slots.default;
632
- const footerSlot = slots.footer;
633
851
  const tabList = defaultSlot ? tabStaticOptions : tabOptions;
852
+ const vns = [(0, _vue.h)('div', {
853
+ key: 'ts',
854
+ class: 'vxe-tabs-slots'
855
+ }, defaultSlot ? defaultSlot({
856
+ name: activeName
857
+ }) : [])];
858
+ if (tabPosition === 'right' || tabPosition === 'bottom') {
859
+ vns.push(rendetTabBody(tabList), renderTabHeader(tabList));
860
+ } else {
861
+ vns.push(renderTabHeader(tabList), rendetTabBody(tabList));
862
+ }
634
863
  return (0, _vue.h)('div', {
635
864
  ref: refElem,
636
- class: ['vxe-tabs', `vxe-tabs--${type || 'default'}`, `trigger--${trigger === 'manual' ? 'trigger' : 'default'}`, {
865
+ class: ['vxe-tabs', `pos--${tabPosition}`, `vxe-tabs--${tabType}`, `trigger--${trigger === 'manual' ? 'trigger' : 'default'}`, {
637
866
  'is--padding': padding,
638
867
  'is--height': height
639
868
  }],
640
- style: height ? {
641
- height: (0, _dom.toCssUnit)(height)
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)]);
869
+ style: wrapperStyle
870
+ }, vns);
650
871
  };
872
+ (0, _vue.watch)(() => props.position, () => {
873
+ updateTabStyle();
874
+ });
651
875
  (0, _vue.watch)(() => props.modelValue, val => {
652
876
  addInitName(val, null);
653
877
  reactData.activeName = val;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_comp=require("../../ui/src/comp"),_ui=require("../../ui"),_vn=require("../../ui/src/vn"),_dom=require("../../ui/src/dom"),_utils=require("../../ui/src/utils"),_log=require("../../ui/src/log"),_xeUtils=_interopRequireDefault(require("xe-utils"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeTabs",props:{modelValue:[String,Number,Boolean],options:Array,height:[String,Number],destroyOnClose:Boolean,titleWidth:[String,Number],titleAlign:[String,Number],type:String,showClose:Boolean,padding:{type:Boolean,default:()=>(0,_ui.getConfig)().tabs.padding},trigger:String,beforeChangeMethod:Function,closeConfig:Object,refreshConfig:Object,beforeCloseMethod:Function},emits:["update:modelValue","change","tab-change","tab-change-fail","tab-close","tab-close-fail","tab-click","tab-load"],setup(u,e){const{slots:o,emit:r}=e;var t=_xeUtils.default.uniqueId();const a=(0,_vue.inject)("$xeTabs",null),v=(0,_vue.ref)(),C=(0,_vue.ref)(),E=(0,_vue.reactive)({staticTabs:[],activeName:null,initNames:[],lintLeft:0,lintWidth:0,isTabOver:!1,resizeFlag:1,cacheTabMaps:{}}),c={slTimeout:void 0},l={refElem:v},y=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().tabs.closeConfig,u.closeConfig)),M=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().tabs.refreshConfig,u.refreshConfig)),d=(0,_vue.computed)(()=>{var e=u["options"];return(e||[]).filter(e=>n(e))}),h=(0,_vue.computed)(()=>{var e=E["staticTabs"];return e.filter(e=>n(e))}),i={},w={xID:t,props:u,context:e,reactData:E,getRefMaps:()=>l,getComputeMaps:()=>i},n=e=>{e=e.permissionCode;return!(e&&!_ui.permission.checkVisible(e))},L=(e,t)=>e&&(_xeUtils.default.isString(e)&&(e=o[e]||null),_xeUtils.default.isFunction(e))?(0,_vn.getSlotVNs)(e(t)):[],m=()=>{(0,_vue.nextTick)(()=>{var e=u["type"];const t=E["activeName"];var a,l=d.value,i=h.value,n=C.value;let s=0,r=0,o=!1;n&&(i=_xeUtils.default.findIndexOf(i.length?i:l,e=>e.name===t),{children:l,scrollWidth:n,clientWidth:a}=n,o=n!==a,-1<i)&&(a=(n=l[i]).clientWidth,e?"card"===e?(s=a+2,r=n.offsetLeft):"border-card"===e&&(s=a+2,r=n.offsetLeft-1):(s=Math.max(4,Math.floor(.6*a)),r=n.offsetLeft+Math.floor((a-s)/2))),E.lintLeft=r,E.lintWidth=s,E.isTabOver=o})},_=(e,t,a)=>{r(e,(0,_ui.createEvent)(a,{$tabs:w},t))},f=(e,t)=>{var a=E["initNames"];return!(!e||a.includes(e)||(_("tab-load",{name:e},t),a.push(e),0))},s=e=>{let l=null;const i={};if(e&&e.length){let a=!1;l=u.modelValue,e.forEach(e=>{var{name:e,preload:t}=e||{};e&&(i[""+e]={loading:!1},l===e&&(a=!0),t)&&f(e,null)}),a||(l=e[0].name,f(l,null),r("update:modelValue",l))}E.activeName=l,E.cacheTabMaps=i},O=(t,a)=>{var e=u["trigger"],l=u.beforeChangeMethod||(0,_ui.getConfig)().tabs.beforeChangeMethod;const i=E["activeName"],n=a["name"],s=n;_("tab-click",{name:n},t),"manual"!==e&&n!==i&&Promise.resolve(!l||l({$tabs:w,name:n,oldName:i,newName:n,option:a})).then(e=>{e?(E.activeName=n,r("update:modelValue",s),f(n,t),_("change",{value:s,name:n,oldName:i,newName:n,option:a},t),_("tab-change",{value:s,name:n,oldName:i,newName:n,option:a},t)):_("tab-change-fail",{value:s,name:n,oldName:i,newName:n,option:a},t)}).catch(()=>{_("tab-change-fail",{value:s,name:n,oldName:i,newName:n,option:a},t)})},S=(e,t)=>{e.stopPropagation();var{activeName:e,cacheTabMaps:a}=E,l=t["name"],i=M.value["queryMethod"];const n=l?a[""+l]:null;n&&(i?(n.loading=!0,Promise.resolve(i({$tabs:w,value:e,name:l,option:t})).finally(()=>{n.loading=!1})):(0,_log.errLog)("vxe.error.notFunc",["refresh-config.queryMethod"]))},k=(t,e,a,l)=>{t.stopPropagation();var i=E["activeName"],n=y.value.beforeMethod||u.beforeCloseMethod||(0,_ui.getConfig)().tabs.beforeCloseMethod;const s=e["name"],r=i;let o=r;i===s&&(i=a<l.length-1?l[a+1]:l[a-1],o=i?i.name:null),Promise.resolve(!n||n({$tabs:w,value:r,name:s,nextName:o,option:e})).then(e=>{e?_("tab-close",{value:r,name:s,nextName:o},t):_("tab-close-fail",{value:r,name:s,nextName:o},t)}).catch(()=>{_("tab-close-fail",{value:r,name:s,nextName:o},t)})},b=e=>{var t=C.value;if(t){t=Math.floor(.75*t.clientWidth);{var r=e,e=t,t=c["slTimeout"];let i=e,n=6,s=35;t&&(clearTimeout(t),c.slTimeout=void 0);const o=()=>{var e,t,a,l=C.value;0<n&&(n--,l)&&({clientWidth:e,scrollWidth:t,scrollLeft:a}=l,i=Math.floor(i/2),0<r?e+a<t&&(l.scrollLeft+=i,s-=4,c.slTimeout=setTimeout(o,s)):0<a&&(l.scrollLeft-=i,s-=4,c.slTimeout=setTimeout(o,s)),m())};o()}}},B=()=>{b(-1)},A=()=>{b(1)},g=n=>{const s=d.value,r=h.value;return(0,_vue.nextTick)().then(()=>{var e,t,a,l,i=C.value;i&&(-1<(a=_xeUtils.default.findIndexOf(r.length?r:s,e=>e.name===n))&&({scrollLeft:e,clientWidth:t,children:l}=i,l=l[a])&&(0<(l=(a=l.offsetLeft)+l.clientWidth-(e+t))&&(i.scrollLeft+=l),a<e)&&(i.scrollLeft=a),m())})},p=t=>{const a=E["activeName"];var l=d.value,i=h.value,i=i.length?i:l,l=_xeUtils.default.findIndexOf(i,e=>e.name===a);if(-1<l){let e=null;t?l<i.length-1&&(e=i[l+1]):0<l&&(e=i[l-1]),e&&(i=t=e.name,E.activeName=t,r("update:modelValue",i),f(t,null))}return(0,_vue.nextTick)()},x={dispatchEvent:_,scrollToTab:g,prev(){return p(!1)},next(){return p(!0)},prevTab(){return(0,_log.warnLog)("vxe.error.delFunc",["prevTab","prev"]),x.prev()},nextTab(){return(0,_log.warnLog)("vxe.error.delFunc",["nextTab","next"]),x.next()}};Object.assign(w,x,{});const T=e=>{var{initNames:t,activeName:a}=E,{name:e,slots:l}=e,l=l?l.default:null;return e&&t.includes(e)?(0,_vue.h)("div",{key:""+e,class:["vxe-tabs-pane--item",{"is--visible":a===e,"has--content":!!l}]},l?L(l,{name:e}):[]):(0,_ui.renderEmptyElement)(w)};(0,_vue.watch)(()=>u.modelValue,e=>{f(e,null),E.activeName=e}),(0,_vue.watch)(()=>E.activeName,e=>{g(e),(0,_vue.nextTick)(()=>{E.resizeFlag++})});const N=(0,_vue.ref)(0),V=((0,_vue.watch)(()=>u.options?u.options.length:-1,()=>{N.value++}),(0,_vue.watch)(()=>u.options,()=>{N.value++}),(0,_vue.watch)(N,()=>{s(u.options),m()}),(0,_vue.ref)(0));return(0,_vue.watch)(()=>E.staticTabs?E.staticTabs.length:-1,()=>{V.value++}),(0,_vue.watch)(()=>E.staticTabs,()=>{V.value++}),(0,_vue.watch)(V,()=>{s(E.staticTabs),m()}),a&&(0,_vue.watch)(()=>a?a.reactData.resizeFlag:null,()=>{E.resizeFlag++}),(0,_vue.watch)(()=>E.resizeFlag,()=>{(0,_vue.nextTick)(()=>{m()})}),(0,_vue.onMounted)(()=>{_ui.globalEvents.on(w,"resize",m),m()}),(0,_vue.onUnmounted)(()=>{_ui.globalEvents.off(w,"resize")}),(0,_vue.provide)("$xeTabs",w),f(u.modelValue,null),s(E.staticTabs.length?E.staticTabs:u.options),w.renderVN=()=>{var{type:e,height:t,padding:a,trigger:l}=u,i=d.value,n=h.value,s=o.default,r=o.footer,n=s?n:i;return(0,_vue.h)("div",{ref:v,class:["vxe-tabs","vxe-tabs--"+(e||"default"),"trigger--"+("manual"===l?"trigger":"default"),{"is--padding":a,"is--height":t}],style:t?{height:(0,_dom.toCssUnit)(t)}:null},[(0,_vue.h)("div",{class:"vxe-tabs-slots"},s?s({}):[]),(c=>{const{type:e,titleWidth:d,titleAlign:h,showClose:m,closeConfig:_,refreshConfig:f}=u,{activeName:b,lintLeft:t,lintWidth:a,isTabOver:l,cacheTabMaps:g}=E;var i=o.extra;const p=y.value,x=p.visibleMethod,T=M.value,N=T.visibleMethod;return(0,_vue.h)("div",{class:"vxe-tabs-header"},[l?(0,_vue.h)("div",{class:"vxe-tabs-header--bar vxe-tabs-header--left-bar",onClick:B},[(0,_vue.h)("span",{class:(0,_ui.getIcon)().TABS_TAB_BUTTON_LEFT})]):(0,_ui.renderEmptyElement)(w),(0,_vue.h)("div",{class:"vxe-tabs-header--wrapper"},[(0,_vue.h)("div",{ref:C,class:"vxe-tabs-header--item-wrapper"},c.map((t,a)=>{var{title:e,titleWidth:l,titleAlign:i,icon:n,name:s,slots:r}=t,r=r?r.title||r.tab:null,l=l||d,i=i||h,o={$tabs:w,value:b,name:s,option:t},u=b===s,v=s?g[""+s]:null,v=!!v&&v.loading;return(0,_vue.h)("div",{key:""+s,class:["vxe-tabs-header--item",i?"align--"+i:"",{"is--active":u}],style:l?{width:(0,_dom.toCssUnit)(l)}:null,onClick(e){O(e,t)}},[(0,_vue.h)("div",{class:"vxe-tabs-header--item-inner"},[(0,_vue.h)("div",{class:"vxe-tabs-header--item-content"},[n?(0,_vue.h)("span",{class:"vxe-tabs-header--item-icon"},[(0,_vue.h)("i",{class:n})]):(0,_ui.renderEmptyElement)(w),(0,_vue.h)("span",{class:"vxe-tabs-header--item-name"},r?L(r,{name:s,title:e}):""+e)]),((0,_utils.isEnableConf)(f)||T.enabled)&&(N?N(o):u)?(0,_vue.h)("div",{class:"vxe-tabs-header--refresh-btn",onClick(e){S(e,t)}},[(0,_vue.h)("i",{class:v?(0,_ui.getIcon)().TABS_TAB_REFRESH_LOADING:(0,_ui.getIcon)().TABS_TAB_REFRESH})]):(0,_ui.renderEmptyElement)(w),!(m||(0,_utils.isEnableConf)(_)||p.enabled)||x&&!x(o)?(0,_ui.renderEmptyElement)(w):(0,_vue.h)("div",{class:"vxe-tabs-header--close-btn",onClick(e){k(e,t,a,c)}},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().TABS_TAB_CLOSE})])])])}).concat([(0,_vue.h)("span",{key:"line",class:"vxe-tabs-header--active-line type--"+(e||"default"),style:{left:t+"px",width:a+"px"}})]))]),l?(0,_vue.h)("div",{class:"vxe-tabs-header--bar vxe-tabs-header--right-bar",onClick:A},[(0,_vue.h)("span",{class:(0,_ui.getIcon)().TABS_TAB_BUTTON_RIGHT})]):(0,_ui.renderEmptyElement)(w),i?(0,_vue.h)("div",{class:"vxe-tabs-header--extra"},(0,_vn.getSlotVNs)(i({}))):(0,_ui.renderEmptyElement)(w)])})(n),(0,_vue.h)("div",{class:"vxe-tabs-pane"},(e=>{var t=u["destroyOnClose"];const a=E["activeName"];var l=e.find(e=>e.name===a);return t?[l?T(l):(0,_ui.renderEmptyElement)(w)]:e.map(e=>T(e))})(n)),r?(0,_vue.h)("div",{class:"vxe-tabs-footer"},L(r,{})):(0,_ui.renderEmptyElement)(w)])},w},render(){return this.renderVN()}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_comp=require("../../ui/src/comp"),_ui=require("../../ui"),_vn=require("../../ui/src/vn"),_dom=require("../../ui/src/dom"),_utils=require("../../ui/src/utils"),_log=require("../../ui/src/log"),_xeUtils=_interopRequireDefault(require("xe-utils"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeTabs",props:{modelValue:[String,Number,Boolean],options:Array,width:[String,Number],height:[String,Number],destroyOnClose:Boolean,titleWidth:[String,Number],titleAlign:[String,Number],type:{type:String,default:()=>(0,_ui.getConfig)().tabs.type},position:{type:String,default:()=>(0,_ui.getConfig)().tabs.position},showClose:Boolean,padding:{type:Boolean,default:()=>(0,_ui.getConfig)().tabs.padding},trigger:String,beforeChangeMethod:Function,closeConfig:Object,refreshConfig:Object,beforeCloseMethod:Function},emits:["update:modelValue","change","tab-change","tab-change-fail","tab-close","tab-close-fail","tab-click","tab-load"],setup(v,e){const{slots:E,emit:s}=e;var t=_xeUtils.default.uniqueId();const a=(0,_vue.inject)("$xeTabs",null),c=(0,_vue.ref)(),M=(0,_vue.ref)(),u=(0,_vue.ref)(),w=(0,_vue.ref)(),B=(0,_vue.reactive)({staticTabs:[],activeName:null,initNames:[],lintLeft:0,lintTop:0,lintWidth:0,lintHeight:0,scrollbarWidth:0,isTabOver:!1,resizeFlag:1,cacheTabMaps:{}}),m={slTimeout:void 0},V={refElem:c},O=(0,_vue.computed)(()=>{var e=v["type"];return e||"default"}),S=(0,_vue.computed)(()=>{var e=v["position"];return e||"top"}),W=(0,_vue.computed)(()=>{var e=S.value;return"left"===e||"right"===e}),U=(0,_vue.computed)(()=>{var{lintLeft:e,lintTop:t,lintWidth:a,lintHeight:i}=B;return W.value?{top:t+"px",height:i+"px"}:{left:e+"px",width:a+"px"}}),F=(0,_vue.computed)(()=>{var{width:e,height:t}=v,a={};return e&&(a.width=(0,_dom.toCssUnit)(e)),e&&(a.height=(0,_dom.toCssUnit)(t)),a}),L=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().tabs.closeConfig,v.closeConfig)),o=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().tabs.refreshConfig,v.refreshConfig)),_=(0,_vue.computed)(()=>{var e=v["options"];return(e||[]).filter(e=>i(e))}),f=(0,_vue.computed)(()=>{var e=B["staticTabs"];return e.filter(e=>i(e))}),I={},k={xID:t,props:v,context:e,reactData:B,getRefMaps:()=>V,getComputeMaps:()=>I},i=e=>{e=e.permissionCode;return!(e&&!_ui.permission.checkVisible(e))},A=(e,t)=>e&&(_xeUtils.default.isString(e)&&(e=E[e]||null),_xeUtils.default.isFunction(e))?(0,_vn.getSlotVNs)(e(t)):[],H=()=>{var e,t,a,i,l,n=W.value,o=M.value,s=u.value,r=w.value;o&&({scrollLeft:o,scrollTop:e,clientWidth:t,clientHeight:a,scrollWidth:i,scrollHeight:l}=o,s&&(0<(n?e:o)?(0,_dom.addClass):(0,_dom.removeClass))(s,"scrolling--middle"),r)&&((n?a<l-Math.ceil(e):t<i-Math.ceil(o))?(0,_dom.addClass):(0,_dom.removeClass))(r,"scrolling--middle")},p=()=>{var e=()=>{const t=B["activeName"];var e,a,i,l,n=O.value,o=_.value,s=f.value,r=M.value,u=W.value;let v=0,c=0,d=0,h=0,m=0,p=!1;r&&(s=_xeUtils.default.findIndexOf(s.length?s:o,e=>e.name===t),{children:o,offsetWidth:r,scrollWidth:e,scrollHeight:l,clientWidth:a,clientHeight:i}=r,m=r-a,u?(p=l!==i,-1<s&&(r=o[s])&&(u=r.clientHeight,l=r.clientWidth,h="card"===n?(v=l,c=u,r.offsetTop):"border-card"===n?(v=l,c=u,r.offsetTop-1):(c=Math.max(4,Math.floor(.6*u)),r.offsetTop+Math.floor((u-c)/2)))):(p=e!==a,-1<s&&(i=o[s])&&(l=i.clientWidth,d="card"===n?(v=l,i.offsetLeft):"border-card"===n?(v=l,i.offsetLeft-1):(v=Math.max(4,Math.floor(.6*l)),i.offsetLeft+Math.floor((l-v)/2))))),B.scrollbarWidth=m,B.lintLeft=d,B.lintTop=h,B.lintWidth=v,B.lintHeight=c,B.isTabOver=p,H()};e(),(0,_vue.nextTick)(e)},d=(e,t,a)=>{s(e,(0,_ui.createEvent)(a,{$tabs:k},t))},r=(e,t)=>{var a=B["initNames"];return!(!e||a.includes(e)||(d("tab-load",{name:e},t),a.push(e),0))},l=e=>{let i=null;const l={};if(e&&e.length){let a=!1;i=v.modelValue,e.forEach(e=>{var{name:e,preload:t}=e||{};e&&(l[""+e]={loading:!1},i===e&&(a=!0),t)&&r(e,null)}),a||(i=e[0].name,r(i,null),s("update:modelValue",i))}B.activeName=i,B.cacheTabMaps=l},q=(t,a)=>{var e=v["trigger"],i=v.beforeChangeMethod||(0,_ui.getConfig)().tabs.beforeChangeMethod;const l=B["activeName"],n=a["name"],o=n;d("tab-click",{name:n},t),"manual"!==e&&n!==l&&Promise.resolve(!i||i({$tabs:k,name:n,oldName:l,newName:n,option:a})).then(e=>{e?(B.activeName=n,s("update:modelValue",o),r(n,t),d("change",{value:o,name:n,oldName:l,newName:n,option:a},t),d("tab-change",{value:o,name:n,oldName:l,newName:n,option:a},t)):d("tab-change-fail",{value:o,name:n,oldName:l,newName:n,option:a},t)}).catch(()=>{d("tab-change-fail",{value:o,name:n,oldName:l,newName:n,option:a},t)})},R=(e,t)=>{e.stopPropagation();var{activeName:e,cacheTabMaps:a}=B,i=t["name"],l=o.value["queryMethod"];const n=i?a[""+i]:null;n&&(l?(n.loading=!0,Promise.resolve(l({$tabs:k,value:e,name:i,option:t})).finally(()=>{n.loading=!1})):(0,_log.errLog)("vxe.error.notFunc",["refresh-config.queryMethod"]))},$=(t,e,a,i)=>{t.stopPropagation();var l=B["activeName"],n=L.value.beforeMethod||v.beforeCloseMethod||(0,_ui.getConfig)().tabs.beforeCloseMethod;const o=e["name"],s=l;let r=s;l===o&&(l=a<i.length-1?i[a+1]:i[a-1],r=l?l.name:null),Promise.resolve(!n||n({$tabs:k,value:s,name:o,nextName:r,option:e})).then(e=>{e?d("tab-close",{value:s,name:o,nextName:r},t):d("tab-close-fail",{value:s,name:o,nextName:r},t)}).catch(()=>{d("tab-close-fail",{value:s,name:o,nextName:r},t)})},n=e=>{var t=W.value,a=M.value;if(a){var{clientWidth:a,clientHeight:i}=a,t=Math.floor(.75*(t?i:a));{var c=e,i=t,a=m["slTimeout"];const d=W.value;let s=d?0:i,r=d?i:0,u=6,v=35;a&&(clearTimeout(a),m.slTimeout=void 0);const h=()=>{var e,t,a,i,l,n,o=M.value;0<u&&(u--,o)&&({clientWidth:e,clientHeight:t,scrollWidth:a,scrollHeight:i,scrollLeft:l,scrollTop:n}=o,d?(r=Math.floor(r/2),0<c?t+n<i&&(o.scrollTop+=r,v-=4,m.slTimeout=setTimeout(h,v)):0<n&&(o.scrollTop-=r,v-=4,m.slTimeout=setTimeout(h,v))):(s=Math.floor(s/2),0<c?e+l<a&&(o.scrollLeft+=s,v-=4,m.slTimeout=setTimeout(h,v)):0<l&&(o.scrollLeft-=s,v-=4,m.slTimeout=setTimeout(h,v))),p())};h()}}},j=()=>{n(-1)},z=()=>{n(1)},h=s=>{const r=_.value,u=f.value,v=W.value;return(0,_vue.nextTick)().then(()=>{var e,t,a,i,l,n,o=M.value;o&&(-1<(i=_xeUtils.default.findIndexOf(u.length?u:r,e=>e.name===s))&&({scrollLeft:e,scrollTop:n,clientWidth:t,clientHeight:l,children:a}=o,a=a[i])&&(v?(0<(l=(i=a.offsetTop)+a.clientHeight-(n+l))&&(o.scrollTop+=l),i<n&&(o.scrollTop=i)):(0<(n=(l=a.offsetLeft)+a.clientWidth-(e+t))&&(o.scrollLeft+=n),l<e&&(o.scrollLeft=l))),p())})},g=t=>{const a=B["activeName"];var i=_.value,l=f.value,l=l.length?l:i,i=_xeUtils.default.findIndexOf(l,e=>e.name===a);if(-1<i){let e=null;t?i<l.length-1&&(e=l[i+1]):0<i&&(e=l[i-1]),e&&(l=t=e.name,B.activeName=t,s("update:modelValue",l),r(t,null))}return(0,_vue.nextTick)()},b={dispatchEvent:d,scrollToTab:h,prev(){return g(!1)},next(){return g(!0)},prevTab(){return(0,_log.warnLog)("vxe.error.delFunc",["prevTab","prev"]),b.prev()},nextTab(){return(0,_log.warnLog)("vxe.error.delFunc",["nextTab","next"]),b.next()}};Object.assign(k,b,{});const T=c=>{const{titleWidth:d,titleAlign:h,showClose:m,closeConfig:p,refreshConfig:_}=v,{activeName:f,scrollbarWidth:e,isTabOver:t,cacheTabMaps:g}=B,b=O.value,T=S.value;var a=W.value,i=U.value,l=E.prefix,n=E.suffix||E.extra;const x=L.value,N=x.visibleMethod,y=o.value,C=y.visibleMethod;return(0,_vue.h)("div",{key:"th",class:["vxe-tabs-header","type--"+b,"pos--"+T]},[l?(0,_vue.h)("div",{class:["vxe-tabs-header--prefix","type--"+b,"pos--"+T]},(0,_vn.getSlotVNs)(l({name:f}))):(0,_ui.renderEmptyElement)(k),t?(0,_vue.h)("div",{ref:u,class:["vxe-tabs-header--bar vxe-tabs-header--prev-bar","type--"+b,"pos--"+T],onClick:j},[(0,_vue.h)("span",{class:a?(0,_ui.getIcon)().TABS_TAB_BUTTON_TOP:(0,_ui.getIcon)().TABS_TAB_BUTTON_LEFT})]):(0,_ui.renderEmptyElement)(k),(0,_vue.h)("div",{class:["vxe-tabs-header--wrapper","type--"+b,"pos--"+T]},[(0,_vue.h)("div",{ref:M,class:"vxe-tabs-header--item-wrapper",style:a&&e?{marginRight:`-${e}px`}:void 0,onScroll:H},c.map((t,a)=>{var{title:e,titleWidth:i,titleAlign:l,icon:n,name:o,slots:s}=t,s=s?s.title||s.tab:null,i=i||d,l=l||h,r={$tabs:k,value:f,name:o,option:t},u=f===o,v=o?g[""+o]:null,v=!!v&&v.loading;return(0,_vue.h)("div",{key:""+o,class:["vxe-tabs-header--item","type--"+b,"pos--"+T,l?"align--"+l:"",{"is--active":u}],style:i?{width:(0,_dom.toCssUnit)(i)}:void 0,onClick(e){q(e,t)}},[(0,_vue.h)("div",{class:"vxe-tabs-header--item-inner"},[(0,_vue.h)("div",{class:"vxe-tabs-header--item-content"},[n?(0,_vue.h)("span",{class:"vxe-tabs-header--item-icon"},[(0,_vue.h)("i",{class:n})]):(0,_ui.renderEmptyElement)(k),(0,_vue.h)("span",{class:"vxe-tabs-header--item-name"},s?A(s,{name:o,title:e}):""+e)]),!(0,_utils.isEnableConf)(_)&&!y.enabled||C&&!C(r)?(0,_ui.renderEmptyElement)(k):(0,_vue.h)("div",{class:["vxe-tabs-header--refresh-btn",{"is--active":u}],onClick(e){R(e,t)}},[(0,_vue.h)("i",{class:v?(0,_ui.getIcon)().TABS_TAB_REFRESH_LOADING:(0,_ui.getIcon)().TABS_TAB_REFRESH})]),!(m||(0,_utils.isEnableConf)(p)||x.enabled)||N&&!N(r)?(0,_ui.renderEmptyElement)(k):(0,_vue.h)("div",{class:["vxe-tabs-header--close-btn",{"is--active":u}],onClick(e){$(e,t,a,c)}},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().TABS_TAB_CLOSE})])])])}).concat([(0,_vue.h)("span",{key:"line",class:["vxe-tabs-header--active-line","type--"+b,"pos--"+T],style:i})]))]),t?(0,_vue.h)("div",{ref:w,class:["vxe-tabs-header--bar vxe-tabs-header--next-bar","type--"+b,"pos--"+T],onClick:z},[(0,_vue.h)("span",{class:a?(0,_ui.getIcon)().TABS_TAB_BUTTON_BOTTOM:(0,_ui.getIcon)().TABS_TAB_BUTTON_RIGHT})]):(0,_ui.renderEmptyElement)(k),n?(0,_vue.h)("div",{class:["vxe-tabs-header--suffix","type--"+b,"pos--"+T]},(0,_vn.getSlotVNs)(n({name:f}))):(0,_ui.renderEmptyElement)(k)])},x=e=>{var{initNames:t,activeName:a}=B,{name:e,slots:i}=e,i=i?i.default:null;return e&&t.includes(e)?(0,_vue.h)("div",{key:""+e,class:["vxe-tabs-pane--item",{"is--visible":a===e,"has--content":!!i}]},i?A(i,{name:e}):[]):(0,_ui.renderEmptyElement)(k)},P=e=>{var t=v["destroyOnClose"];const a=B["activeName"];var i=e.find(e=>e.name===a);return t?[i?x(i):(0,_ui.renderEmptyElement)(k)]:e.map(e=>x(e))},N=e=>{var{height:t,padding:a}=v,i=B["activeName"],l=O.value,n=S.value,o=E.top,s=E.footer,i={name:i};return(0,_vue.h)("div",{key:"tb",class:["vxe-tabs-pane--wrapper","type--"+l,"pos--"+n]},[o?(0,_vue.h)("div",{class:"vxe-tabs-pane--top"},A(o,i)):(0,_ui.renderEmptyElement)(k),(0,_vue.h)("div",{class:["vxe-tabs-pane--body","type--"+l,"pos--"+n,{"is--padding":a,"is--height":t}]},P(e)),s?(0,_vue.h)("div",{class:"vxe-tabs-pane--footer"},A(s,i)):(0,_ui.renderEmptyElement)(k)])};(0,_vue.watch)(()=>v.position,()=>{p()}),(0,_vue.watch)(()=>v.modelValue,e=>{r(e,null),B.activeName=e}),(0,_vue.watch)(()=>B.activeName,e=>{h(e),(0,_vue.nextTick)(()=>{B.resizeFlag++})});const y=(0,_vue.ref)(0),C=((0,_vue.watch)(()=>v.options?v.options.length:-1,()=>{y.value++}),(0,_vue.watch)(()=>v.options,()=>{y.value++}),(0,_vue.watch)(y,()=>{l(v.options),p()}),(0,_vue.ref)(0));return(0,_vue.watch)(()=>B.staticTabs?B.staticTabs.length:-1,()=>{C.value++}),(0,_vue.watch)(()=>B.staticTabs,()=>{C.value++}),(0,_vue.watch)(C,()=>{l(B.staticTabs),p()}),a&&(0,_vue.watch)(()=>a?a.reactData.resizeFlag:null,()=>{B.resizeFlag++}),(0,_vue.watch)(()=>B.resizeFlag,()=>{(0,_vue.nextTick)(()=>{p()})}),(0,_vue.onMounted)(()=>{_ui.globalEvents.on(k,"resize",p),p()}),(0,_vue.onUnmounted)(()=>{_ui.globalEvents.off(k,"resize")}),(0,_vue.provide)("$xeTabs",k),r(v.modelValue,null),l(B.staticTabs.length?B.staticTabs:v.options),k.renderVN=()=>{var{height:e,padding:t,trigger:a}=v,i=B["activeName"],l=_.value,n=f.value,o=O.value,s=S.value,r=F.value,u=E.default,n=u?n:l,l=[(0,_vue.h)("div",{key:"ts",class:"vxe-tabs-slots"},u?u({name:i}):[])];return"right"===s||"bottom"===s?l.push(N(n),T(n)):l.push(T(n),N(n)),(0,_vue.h)("div",{ref:c,class:["vxe-tabs","pos--"+s,"vxe-tabs--"+o,"trigger--"+("manual"===a?"trigger":"default"),{"is--padding":t,"is--height":e}],style:r},l)},k},render(){return this.renderVN()}});