vxe-pc-ui 4.19.7 → 4.19.8

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 (85) hide show
  1. package/dist/all.esm.js +1893 -1837
  2. package/dist/style.css +1 -1
  3. package/dist/style.min.css +1 -1
  4. package/es/card/src/card.js +35 -12
  5. package/es/card/style.css +42 -44
  6. package/es/card/style.min.css +1 -1
  7. package/es/icon/style.css +1 -1
  8. package/es/list/src/list.js +6 -2
  9. package/es/scrollbar/src/scrollbar.js +9 -1
  10. package/es/scrollbar/style.css +5 -5
  11. package/es/scrollbar/style.min.css +1 -1
  12. package/es/style.css +1 -1
  13. package/es/style.min.css +1 -1
  14. package/es/tabs/src/tabs.js +27 -8
  15. package/es/tabs/style.css +4 -2
  16. package/es/tabs/style.min.css +1 -1
  17. package/es/tree/src/tree.js +6 -2
  18. package/es/ui/index.js +1 -1
  19. package/es/ui/src/log.js +1 -1
  20. package/es/vxe-card/style.css +42 -44
  21. package/es/vxe-card/style.min.css +1 -1
  22. package/es/vxe-scrollbar/style.css +5 -5
  23. package/es/vxe-scrollbar/style.min.css +1 -1
  24. package/es/vxe-tabs/style.css +4 -2
  25. package/es/vxe-tabs/style.min.css +1 -1
  26. package/lib/card/src/card.js +42 -6
  27. package/lib/card/src/card.min.js +1 -1
  28. package/lib/card/style/style.css +42 -44
  29. package/lib/card/style/style.min.css +1 -1
  30. package/lib/icon/style/style.css +1 -1
  31. package/lib/icon/style/style.min.css +1 -1
  32. package/lib/index.umd.js +2474 -2390
  33. package/lib/index.umd.min.js +1 -1
  34. package/lib/list/src/list.js +5 -1
  35. package/lib/list/src/list.min.js +1 -1
  36. package/lib/scrollbar/src/scrollbar.js +9 -1
  37. package/lib/scrollbar/src/scrollbar.min.js +1 -1
  38. package/lib/scrollbar/style/style.css +5 -5
  39. package/lib/scrollbar/style/style.min.css +1 -1
  40. package/lib/style.css +1 -1
  41. package/lib/style.min.css +1 -1
  42. package/lib/tabs/src/tabs.js +40 -8
  43. package/lib/tabs/src/tabs.min.js +1 -1
  44. package/lib/tabs/style/style.css +4 -2
  45. package/lib/tabs/style/style.min.css +1 -1
  46. package/lib/tree/src/tree.js +5 -1
  47. package/lib/tree/src/tree.min.js +1 -1
  48. package/lib/ui/index.js +1 -1
  49. package/lib/ui/index.min.js +1 -1
  50. package/lib/ui/src/log.js +1 -1
  51. package/lib/ui/src/log.min.js +1 -1
  52. package/lib/vxe-card/style/style.css +42 -44
  53. package/lib/vxe-card/style/style.min.css +1 -1
  54. package/lib/vxe-scrollbar/style/style.css +5 -5
  55. package/lib/vxe-scrollbar/style/style.min.css +1 -1
  56. package/lib/vxe-tabs/style/style.css +4 -2
  57. package/lib/vxe-tabs/style/style.min.css +1 -1
  58. package/package.json +1 -1
  59. package/packages/card/src/card.ts +55 -12
  60. package/packages/list/src/list.ts +6 -2
  61. package/packages/scrollbar/src/scrollbar.ts +10 -1
  62. package/packages/tabs/src/tabs.ts +34 -8
  63. package/packages/tree/src/tree.ts +6 -2
  64. package/styles/components/card.scss +44 -58
  65. package/styles/components/scrollbar.scss +15 -11
  66. package/styles/components/tabs.scss +2 -1
  67. package/types/components/card.d.ts +11 -0
  68. package/types/components/grid.d.ts +37 -0
  69. package/types/components/layout-aside.d.ts +6 -0
  70. package/types/components/layout-body.d.ts +6 -0
  71. package/types/components/menu.d.ts +6 -0
  72. package/types/components/table.d.ts +1 -2
  73. package/types/components/tabs.d.ts +11 -0
  74. /package/es/icon/{iconfont.1791794447472.ttf → iconfont.1791862962954.ttf} +0 -0
  75. /package/es/icon/{iconfont.1791794447472.woff → iconfont.1791862962954.woff} +0 -0
  76. /package/es/icon/{iconfont.1791794447472.woff2 → iconfont.1791862962954.woff2} +0 -0
  77. /package/es/{iconfont.1791794447472.ttf → iconfont.1791862962954.ttf} +0 -0
  78. /package/es/{iconfont.1791794447472.woff → iconfont.1791862962954.woff} +0 -0
  79. /package/es/{iconfont.1791794447472.woff2 → iconfont.1791862962954.woff2} +0 -0
  80. /package/lib/icon/style/{iconfont.1791794447472.ttf → iconfont.1791862962954.ttf} +0 -0
  81. /package/lib/icon/style/{iconfont.1791794447472.woff → iconfont.1791862962954.woff} +0 -0
  82. /package/lib/icon/style/{iconfont.1791794447472.woff2 → iconfont.1791862962954.woff2} +0 -0
  83. /package/lib/{iconfont.1791794447472.ttf → iconfont.1791862962954.ttf} +0 -0
  84. /package/lib/{iconfont.1791794447472.woff → iconfont.1791862962954.woff} +0 -0
  85. /package/lib/{iconfont.1791794447472.woff2 → iconfont.1791862962954.woff2} +0 -0
package/dist/all.esm.js CHANGED
@@ -101,7 +101,7 @@ function checkDynamic() {
101
101
  }
102
102
 
103
103
  const { log } = VxeUI;
104
- const uiVersion = `ui v${"4.19.7"}`;
104
+ const uiVersion = `ui v${"4.19.8"}`;
105
105
  function createComponentLog(name) {
106
106
  const tableVersion = VxeUI.tableVersion ? `table v${VxeUI.tableVersion}` : '';
107
107
  const ganttVersion = VxeUI.ganttVersion ? `gantt v${VxeUI.ganttVersion}` : '';
@@ -115,7 +115,7 @@ function createComponentLog(name) {
115
115
  const warnLog$j = log.create('warn', uiVersion);
116
116
  log.create('error', uiVersion);
117
117
 
118
- const version = "4.19.7";
118
+ const version = "4.19.8";
119
119
  VxeUI.uiVersion = version;
120
120
  VxeUI.dynamicApp = dynamicApp;
121
121
  function config(options) {
@@ -6402,235 +6402,225 @@ VxeUI.component(VxeLoadingComponent);
6402
6402
  VxeUI.loading = LoadingController;
6403
6403
  const Loading = VxeLoading;
6404
6404
 
6405
- var VxeCardComponent = defineVxeComponent({
6406
- name: 'VxeCard',
6405
+ /**
6406
+ * 计算滚动条滑块的长度
6407
+ */
6408
+ function getThumbSize(viewportSize, contentSize, trackSize) {
6409
+ if (contentSize <= viewportSize) {
6410
+ return 0;
6411
+ }
6412
+ const ratio = viewportSize / contentSize;
6413
+ const ideal = trackSize * ratio;
6414
+ return Math.max(20, Math.min(ideal, trackSize));
6415
+ }
6416
+ /**
6417
+ * 计算滚动条滑块的偏移位置
6418
+ */
6419
+ function getThumbOffsetSize(offsetSize, viewportSize, contentSize, trackSize, thumbSize) {
6420
+ const maxScroll = contentSize - viewportSize;
6421
+ if (maxScroll <= 0) {
6422
+ return 0;
6423
+ }
6424
+ const maxThumbOffset = trackSize - thumbSize;
6425
+ if (maxThumbOffset <= 0) {
6426
+ return 0;
6427
+ }
6428
+ const clamped = Math.min(Math.max(offsetSize, 0), maxScroll);
6429
+ const ratio = clamped / maxScroll;
6430
+ return ratio * maxThumbOffset;
6431
+ }
6432
+ /**
6433
+ * 根据点击轨道的位置,计算滑块的偏移位置
6434
+ */
6435
+ function getScrollFromClick(clickPosition, viewportSize, contentSize, trackSize, thumbSize) {
6436
+ const maxThumbOffset = trackSize - thumbSize;
6437
+ const maxScroll = contentSize - viewportSize;
6438
+ if (maxScroll <= 0 || maxThumbOffset <= 0) {
6439
+ return 0;
6440
+ }
6441
+ let thumbOffset = clickPosition - thumbSize / 2;
6442
+ thumbOffset = Math.min(Math.max(thumbOffset, 0), maxThumbOffset);
6443
+ const scrollOffset = (thumbOffset / maxThumbOffset) * maxScroll;
6444
+ return scrollOffset;
6445
+ }
6446
+ /**
6447
+ * 拖拽 thumb 时,根据鼠标位置计算滑块的偏移位置
6448
+ */
6449
+ function getScrollFromDrag(pointerPosition, dragOffset, viewportSize, contentSize, trackSize, thumbSize) {
6450
+ const maxScroll = contentSize - viewportSize;
6451
+ const maxThumbOffset = trackSize - thumbSize;
6452
+ if (maxScroll <= 0 || maxThumbOffset <= 0) {
6453
+ return 0;
6454
+ }
6455
+ let thumbOffset = pointerPosition - dragOffset;
6456
+ thumbOffset = Math.min(Math.max(thumbOffset, 0), maxThumbOffset);
6457
+ return (thumbOffset / maxThumbOffset) * maxScroll;
6458
+ }
6459
+
6460
+ const { getConfig: getConfig$2, createEvent, domUtils, globalResize, globalEvents, renderEmptyElement } = VxeUI;
6461
+ function createReactData$n() {
6462
+ return {
6463
+ yThumbHeight: 0,
6464
+ xThumbWidth: 0
6465
+ };
6466
+ }
6467
+ function createInternalData$m() {
6468
+ return {
6469
+ // resizeObserver: undefined,
6470
+ // isThumbDrag: false,
6471
+ thumbDragOffset: 0,
6472
+ yThumbTop: 0,
6473
+ xThumbLeft: 0,
6474
+ lastScrollTop: 0,
6475
+ lastScrollLeft: 0
6476
+ };
6477
+ }
6478
+ var VxeScrollbarComponent = defineVxeComponent({
6479
+ name: 'VxeScrollbar',
6407
6480
  props: {
6408
- title: String,
6409
- showTitleOverflow: {
6410
- type: Boolean,
6411
- default: () => getConfig$4().card.showTitleOverflow
6412
- },
6481
+ id: [String, Number],
6413
6482
  width: [String, Number],
6414
6483
  height: [String, Number],
6415
- border: {
6416
- type: Boolean,
6417
- default: () => getConfig$4().card.border
6418
- },
6484
+ minWidth: [String, Number],
6485
+ minHeight: [String, Number],
6486
+ maxWidth: [String, Number],
6487
+ maxHeight: [String, Number],
6419
6488
  loading: Boolean,
6420
- shadow: {
6489
+ native: {
6421
6490
  type: Boolean,
6422
- default: () => getConfig$4().card.shadow
6491
+ default: () => getConfig$2().scrollbar.native
6423
6492
  },
6424
6493
  padding: {
6425
6494
  type: Boolean,
6426
- default: () => getConfig$4().card.padding
6495
+ default: () => getConfig$2().scrollbar.padding
6427
6496
  },
6428
- size: {
6497
+ xConfig: Object,
6498
+ yConfig: Object,
6499
+ className: {
6429
6500
  type: String,
6430
- default: () => getConfig$4().card.size || getConfig$4().size
6431
- }
6432
- },
6433
- emits: [],
6434
- setup(props, context) {
6435
- const { slots, emit } = context;
6436
- const xID = XEUtils.uniqueId();
6437
- const refElem = ref();
6438
- const { computeSize } = useSize(props);
6439
- const reactData = reactive({});
6440
- const refMaps = {
6441
- refElem
6442
- };
6443
- const computeCardStyle = computed(() => {
6444
- const { height, width } = props;
6445
- const stys = {};
6446
- if (width) {
6447
- stys.width = toCssUnit(width);
6448
- }
6449
- if (height) {
6450
- stys.height = toCssUnit(height);
6451
- }
6452
- return stys;
6453
- });
6454
- const computeMaps = {
6455
- computeSize
6456
- };
6457
- const $xeCard = {
6458
- xID,
6459
- props,
6460
- context,
6461
- reactData,
6462
- getRefMaps: () => refMaps,
6463
- getComputeMaps: () => computeMaps
6464
- };
6465
- const dispatchEvent = (type, params, evnt) => {
6466
- emit(type, createEvent$1(evnt, { $card: $xeCard }, params));
6467
- };
6468
- const cardMethods = {
6469
- dispatchEvent
6470
- };
6471
- const cardPrivateMethods = {};
6472
- Object.assign($xeCard, cardMethods, cardPrivateMethods);
6473
- const renderVN = () => {
6474
- const { title, border, shadow, padding, loading, showTitleOverflow } = props;
6475
- const defaultSlot = slots.default;
6476
- const headerSlot = slots.header;
6477
- const titleSlot = slots.title;
6478
- const extraSlot = slots.extra;
6479
- const footerSlot = slots.footer;
6480
- const leftSlot = slots.left;
6481
- const rightSlot = slots.right;
6482
- const vSize = computeSize.value;
6483
- const cardStyle = computeCardStyle.value;
6484
- return h('div', {
6485
- ref: refElem,
6486
- class: ['vxe-card', {
6487
- [`size--${vSize}`]: vSize,
6488
- 'is--border': border,
6489
- 'is--shadow': shadow,
6490
- 'is--padding': padding
6491
- }],
6492
- style: cardStyle
6493
- }, [
6494
- title || titleSlot || headerSlot
6495
- ? h('div', {
6496
- class: 'vxe-card--header'
6497
- }, headerSlot
6498
- ? getSlotVNs(headerSlot({}))
6499
- : [
6500
- h('div', {
6501
- class: ['vxe-card--header-title', {
6502
- 'is--ellipsis': showTitleOverflow
6503
- }]
6504
- }, titleSlot ? getSlotVNs(titleSlot({})) : `${title || ''}`),
6505
- extraSlot
6506
- ? h('div', {
6507
- class: 'vxe-card--header-extra'
6508
- }, getSlotVNs(extraSlot({})))
6509
- : renderEmptyElement$1($xeCard)
6510
- ])
6511
- : renderEmptyElement$1($xeCard),
6512
- h('div', {
6513
- class: 'vxe-card--body'
6514
- }, [
6515
- leftSlot
6516
- ? h('div', {
6517
- class: 'vxe-card--body-left'
6518
- }, getSlotVNs(leftSlot({})))
6519
- : renderEmptyElement$1($xeCard),
6520
- h('div', {
6521
- class: 'vxe-card--body-content'
6522
- }, defaultSlot ? getSlotVNs(defaultSlot({})) : []),
6523
- rightSlot
6524
- ? h('div', {
6525
- class: 'vxe-card--body-right'
6526
- }, getSlotVNs(rightSlot({})))
6527
- : renderEmptyElement$1($xeCard)
6528
- ]),
6529
- footerSlot
6530
- ? h('div', {
6531
- class: 'vxe-card--footer'
6532
- }, getSlotVNs(footerSlot({})))
6533
- : renderEmptyElement$1($xeCard),
6534
- /**
6535
- * 加载中
6536
- */
6537
- h(VxeLoading, {
6538
- class: 'vxe-card--loading',
6539
- modelValue: loading
6540
- })
6541
- ]);
6542
- };
6543
- $xeCard.renderVN = renderVN;
6544
- return $xeCard;
6545
- },
6546
- render() {
6547
- return this.renderVN();
6548
- }
6549
- });
6550
-
6551
- const VxeCard = Object.assign({}, VxeCardComponent, {
6552
- install(app) {
6553
- app.component(VxeCardComponent.name, VxeCardComponent);
6554
- }
6555
- });
6556
- dynamicApp.use(VxeCard);
6557
- VxeUI.component(VxeCardComponent);
6558
- const Card = VxeCard;
6559
-
6560
- var VxeCarouselComponent = defineVxeComponent({
6561
- name: 'VxeCarousel',
6562
- props: {
6563
- modelValue: [String, Number],
6564
- options: Array,
6565
- loading: Boolean,
6566
- height: {
6567
- type: [Number, String],
6568
- default: () => getConfig$4().carousel.height
6569
- },
6570
- width: {
6571
- type: [Number, String],
6572
- default: () => getConfig$4().carousel.width
6501
+ default: () => getConfig$2().scrollbar.className
6573
6502
  },
6574
- autoPlay: {
6575
- type: Boolean,
6576
- default: () => getConfig$4().carousel.autoPlay
6503
+ viewAttrs: {
6504
+ type: Object,
6505
+ default: () => getConfig$2().scrollbar.viewAttrs
6577
6506
  },
6578
- interval: {
6579
- type: [Number, String],
6580
- default: () => getConfig$4().carousel.interval
6507
+ viewClassName: {
6508
+ type: String,
6509
+ default: () => getConfig$2().scrollbar.viewClassName
6581
6510
  },
6582
- loop: {
6583
- type: Boolean,
6584
- default: () => getConfig$4().carousel.loop
6511
+ viewInnerClassName: {
6512
+ type: String,
6513
+ default: () => getConfig$2().scrollbar.viewInnerClassName
6585
6514
  },
6586
- vertical: {
6515
+ autoResize: {
6587
6516
  type: Boolean,
6588
- default: () => getConfig$4().carousel.vertical
6517
+ default: () => getConfig$2().scrollbar.autoResize
6589
6518
  },
6590
- showIndicators: {
6591
- type: Boolean,
6592
- default: () => getConfig$4().carousel.showIndicators
6593
- }
6519
+ syncResize: [Boolean, String, Number]
6594
6520
  },
6595
6521
  emits: [
6596
- 'update:modelValue',
6597
- 'change'
6522
+ 'scroll',
6523
+ 'scroll-boundary'
6598
6524
  ],
6599
6525
  setup(props, context) {
6600
6526
  const { emit, slots } = context;
6601
6527
  const xID = XEUtils.uniqueId();
6602
6528
  const refElem = ref();
6603
- const refWrapperElem = ref();
6604
- const reactData = reactive({
6605
- activeName: '',
6606
- staticItems: [],
6607
- itemWidth: 0,
6608
- itemHeight: 0
6609
- });
6610
- const internalData = {
6611
- apTimeout: undefined,
6612
- stopFlag: false
6613
- };
6614
- const refMaps = {
6615
- refElem
6616
- };
6617
- const computeListStyle = computed(() => {
6618
- const { vertical, options } = props;
6619
- const { activeName, itemWidth, itemHeight, staticItems } = reactData;
6620
- const list = (staticItems && staticItems.length ? staticItems : options) || [];
6621
- const activeIndex = Math.max(0, XEUtils.findIndexOf(list, item => item.name === activeName));
6529
+ const refViewElem = ref();
6530
+ const refViewInnerElem = ref();
6531
+ const refTrackXElem = ref();
6532
+ const refTrackYElem = ref();
6533
+ const refThumbXElem = ref();
6534
+ const refThumbYElem = ref();
6535
+ const reactData = reactive(createReactData$n());
6536
+ const internalData = createInternalData$m();
6537
+ const computeWrapperStyle = computed(() => {
6538
+ const { width, height, minWidth, minHeight, maxWidth, maxHeight } = props;
6539
+ const xOpts = computeXOpts.value;
6540
+ const yOpts = computeYOpts.value;
6622
6541
  const stys = {};
6623
- if (vertical) {
6624
- stys.transform = `translateY(-${activeIndex * itemHeight}px)`;
6542
+ if (width) {
6543
+ stys.width = toCssUnit(width);
6625
6544
  }
6626
- else {
6627
- stys.width = `${itemWidth * list.length}px`;
6628
- stys.transform = `translateX(-${activeIndex * itemWidth}px)`;
6545
+ if (height) {
6546
+ stys.height = toCssUnit(height);
6547
+ }
6548
+ if (minWidth) {
6549
+ stys.minWidth = toCssUnit(minWidth);
6550
+ }
6551
+ if (minHeight) {
6552
+ stys.minHeight = toCssUnit(minHeight);
6553
+ }
6554
+ if (maxWidth) {
6555
+ stys.maxWidth = toCssUnit(maxWidth);
6556
+ }
6557
+ if (maxHeight) {
6558
+ stys.maxHeight = toCssUnit(maxHeight);
6559
+ }
6560
+ if (yOpts.width) {
6561
+ stys['--vxe-ui-scrollbar-y-width'] = toCssUnit(yOpts.width);
6562
+ }
6563
+ if (xOpts.height) {
6564
+ stys['--vxe-ui-scrollbar-x-height'] = toCssUnit(xOpts.height);
6629
6565
  }
6630
6566
  return stys;
6631
6567
  });
6568
+ const computeWrapperClss = computed(() => {
6569
+ const { native, className, padding } = props;
6570
+ const { yThumbHeight, xThumbWidth } = reactData;
6571
+ const xOpts = computeXOpts.value;
6572
+ const yOpts = computeYOpts.value;
6573
+ const xToTop = computeXToTop.value;
6574
+ const yToLeft = computeYToLeft.value;
6575
+ return domUtils.buildClass([
6576
+ 'vxe-scrollbar',
6577
+ `ov-x--${xOpts.visible || 'visible'}`,
6578
+ `ov-y--${yOpts.visible || 'visible'}`,
6579
+ `sx-pos--${xToTop ? 'top' : 'bottom'}`,
6580
+ `sy-pos--${yToLeft ? 'left' : 'right'}`,
6581
+ native ? 'is--native' : 'is--virtual',
6582
+ className
6583
+ ], {
6584
+ 'is--padding': padding,
6585
+ 'ov-x--auto-hide': xOpts.autoHide,
6586
+ 'ov-y--auto-hide': yOpts.autoHide,
6587
+ 'overflow-y': yThumbHeight,
6588
+ 'overflow-x': xThumbWidth
6589
+ });
6590
+ });
6591
+ const computeViewClss = computed(() => {
6592
+ const { viewClassName } = props;
6593
+ return domUtils.buildClass([
6594
+ 'vxe-scrollbar--view',
6595
+ viewClassName
6596
+ ]);
6597
+ });
6598
+ const computeViewInnerClss = computed(() => {
6599
+ const { viewInnerClassName } = props;
6600
+ return domUtils.buildClass([
6601
+ 'vxe-scrollbar--view-inner',
6602
+ viewInnerClassName
6603
+ ]);
6604
+ });
6605
+ const computeXOpts = computed(() => {
6606
+ return Object.assign({}, getConfig$2().scrollbar.xConfig, props.xConfig);
6607
+ });
6608
+ const computeYOpts = computed(() => {
6609
+ return Object.assign({}, getConfig$2().scrollbar.yConfig, props.yConfig);
6610
+ });
6611
+ const computeXToTop = computed(() => {
6612
+ const xOpts = computeXOpts.value;
6613
+ return xOpts.position === 'top';
6614
+ });
6615
+ const computeYToLeft = computed(() => {
6616
+ const yOpts = computeYOpts.value;
6617
+ return yOpts.position === 'left';
6618
+ });
6619
+ const refMaps = {
6620
+ refElem
6621
+ };
6632
6622
  const computeMaps = {};
6633
- const $xeCarousel = {
6623
+ const $xeScrollbar = {
6634
6624
  xID,
6635
6625
  props,
6636
6626
  context,
@@ -6639,671 +6629,1362 @@ var VxeCarouselComponent = defineVxeComponent({
6639
6629
  getRefMaps: () => refMaps,
6640
6630
  getComputeMaps: () => computeMaps
6641
6631
  };
6642
- const updateStyle = () => {
6643
- nextTick(() => {
6644
- const wrapperElem = refWrapperElem.value;
6645
- if (wrapperElem) {
6646
- reactData.itemWidth = wrapperElem.clientWidth;
6647
- reactData.itemHeight = wrapperElem.clientHeight;
6648
- }
6649
- });
6650
- };
6651
- const clickItemEvent = (evnt, item) => {
6652
- const value = item.name;
6653
- reactData.activeName = item.name;
6654
- emit('update:modelValue', value);
6655
- emit('change', { value }, evnt);
6656
- updateStyle();
6657
- };
6658
- const initDefaultActive = (list) => {
6659
- let activeName = null;
6660
- if (list && list.length) {
6661
- let validVal = false;
6662
- activeName = props.modelValue;
6663
- list.forEach((item) => {
6664
- if (activeName === item.name) {
6665
- validVal = true;
6666
- }
6667
- });
6668
- if (!validVal) {
6669
- activeName = list[0].name;
6670
- emit('update:modelValue', activeName);
6671
- }
6672
- }
6673
- reactData.activeName = activeName;
6674
- };
6675
6632
  const dispatchEvent = (type, params, evnt) => {
6676
- emit(type, createEvent$1(evnt, { $carousel: $xeCarousel }, params));
6633
+ emit(type, createEvent(evnt, { $scrollbar: $xeScrollbar }, params));
6677
6634
  };
6678
- const handlePrevNext = (isNext) => {
6679
- const { options, loop } = props;
6680
- const { activeName, staticItems } = reactData;
6681
- const list = (staticItems && staticItems.length ? staticItems : options) || [];
6682
- const index = Math.max(0, XEUtils.findIndexOf(list, item => item.name === activeName));
6683
- if (index > -1) {
6684
- let item = null;
6685
- if (isNext) {
6686
- if (index < list.length - 1) {
6687
- item = list[index + 1];
6635
+ const scrollbarMethods = {
6636
+ dispatchEvent,
6637
+ scrollTo(left, top) {
6638
+ const viewEl = refViewElem.value;
6639
+ if (viewEl) {
6640
+ if (XEUtils.isNumber(left)) {
6641
+ viewEl.scrollTo(left, top || 0);
6688
6642
  }
6689
6643
  else {
6690
- if (loop) {
6691
- item = list[0];
6692
- }
6644
+ viewEl.scrollTo(left);
6693
6645
  }
6694
6646
  }
6695
- else {
6696
- if (index > 0) {
6697
- item = list[index - 1];
6698
- }
6699
- else {
6700
- if (loop) {
6701
- item = list[list.length - 1];
6702
- }
6703
- }
6647
+ },
6648
+ scrollIntoView() {
6649
+ const viewEl = refViewElem.value;
6650
+ if (viewEl) {
6651
+ viewEl.scrollIntoView();
6704
6652
  }
6705
- if (item) {
6706
- const name = item.name;
6707
- const value = name;
6708
- reactData.activeName = name;
6709
- emit('update:modelValue', value);
6710
- return true;
6653
+ },
6654
+ setScrollTop(top) {
6655
+ const viewEl = refViewElem.value;
6656
+ if (viewEl) {
6657
+ viewEl.scrollTop = top;
6711
6658
  }
6712
- }
6713
- return false;
6714
- };
6715
- const carouselMethods = {
6716
- dispatchEvent,
6717
- prev() {
6718
- if (handlePrevNext(false)) {
6719
- handleAutoPlay();
6659
+ },
6660
+ setScrollLeft(left) {
6661
+ const viewEl = refViewElem.value;
6662
+ if (viewEl) {
6663
+ viewEl.scrollLeft = left;
6720
6664
  }
6721
- return nextTick();
6722
6665
  },
6723
- next() {
6724
- if (handlePrevNext(true)) {
6725
- handleAutoPlay();
6666
+ getScrollTop() {
6667
+ const viewEl = refViewElem.value;
6668
+ if (viewEl) {
6669
+ return viewEl.scrollTop;
6670
+ }
6671
+ return 0;
6672
+ },
6673
+ getScrollLeft() {
6674
+ const viewEl = refViewElem.value;
6675
+ if (viewEl) {
6676
+ return viewEl.scrollLeft;
6677
+ }
6678
+ return 0;
6679
+ },
6680
+ clearScroll() {
6681
+ const viewEl = refViewElem.value;
6682
+ if (viewEl) {
6683
+ viewEl.scrollTop = 0;
6684
+ viewEl.scrollLeft = 0;
6726
6685
  }
6686
+ },
6687
+ recalculate() {
6688
+ updateThumbSize();
6689
+ updateThumbOffset();
6727
6690
  return nextTick();
6728
6691
  }
6729
6692
  };
6730
- const prevEvent = (evnt) => {
6731
- if (handlePrevNext(false)) {
6732
- const value = reactData.activeName;
6733
- emit('change', { value }, evnt);
6693
+ const updateThumbSize = () => {
6694
+ const viewEl = refViewElem.value;
6695
+ if (!viewEl) {
6696
+ return;
6734
6697
  }
6735
- };
6736
- const nextEvent = (evnt) => {
6737
- if (handlePrevNext(true)) {
6738
- const value = reactData.activeName;
6739
- emit('change', { value }, evnt);
6698
+ if (!viewEl.clientHeight || !viewEl.clientHeight) {
6699
+ return;
6700
+ }
6701
+ const trackXEl = refTrackXElem.value;
6702
+ const xThumbWidth = trackXEl ? getThumbSize(viewEl.clientWidth, viewEl.scrollWidth, trackXEl.clientWidth) : 0;
6703
+ const thumbXElem = refThumbXElem.value;
6704
+ if (thumbXElem) {
6705
+ thumbXElem.style.width = xThumbWidth + 'px';
6706
+ }
6707
+ reactData.xThumbWidth = xThumbWidth;
6708
+ const trackYEl = refTrackYElem.value;
6709
+ const yThumbHeight = trackYEl ? getThumbSize(viewEl.clientHeight, viewEl.scrollHeight, trackYEl.clientHeight) : 0;
6710
+ const thumbYElem = refThumbYElem.value;
6711
+ if (thumbYElem) {
6712
+ thumbYElem.style.height = yThumbHeight + 'px';
6740
6713
  }
6714
+ reactData.yThumbHeight = yThumbHeight;
6741
6715
  };
6742
- const stopAutoPlay = () => {
6743
- const { apTimeout } = internalData;
6744
- internalData.stopFlag = true;
6745
- if (apTimeout) {
6746
- clearTimeout(apTimeout);
6747
- internalData.apTimeout = undefined;
6716
+ const updateThumbOffset = () => {
6717
+ const viewEl = refViewElem.value;
6718
+ if (!viewEl) {
6719
+ return;
6720
+ }
6721
+ if (!viewEl.clientHeight || !viewEl.clientHeight) {
6722
+ return;
6723
+ }
6724
+ const { xThumbWidth, yThumbHeight } = reactData;
6725
+ const trackXEl = refTrackXElem.value;
6726
+ const thumbXElem = refThumbXElem.value;
6727
+ const xThumbLeft = trackXEl && xThumbWidth ? getThumbOffsetSize(viewEl.scrollLeft, viewEl.clientWidth, viewEl.scrollWidth, trackXEl.clientWidth, xThumbWidth) : 0;
6728
+ internalData.xThumbLeft = xThumbLeft;
6729
+ if (thumbXElem && xThumbWidth) {
6730
+ thumbXElem.style.width = xThumbWidth + 'px';
6731
+ thumbXElem.style.transform = `translateX(${xThumbLeft}px)`;
6732
+ }
6733
+ const trackYEl = refTrackYElem.value;
6734
+ const thumbYElem = refThumbYElem.value;
6735
+ const yThumbTop = trackYEl && yThumbHeight ? getThumbOffsetSize(viewEl.scrollTop, viewEl.clientHeight, viewEl.scrollHeight, trackYEl.clientHeight, yThumbHeight) : 0;
6736
+ internalData.yThumbTop = yThumbTop;
6737
+ if (thumbYElem && yThumbHeight) {
6738
+ thumbYElem.style.height = yThumbHeight + 'px';
6739
+ thumbYElem.style.transform = `translateY(${yThumbTop}px)`;
6748
6740
  }
6749
6741
  };
6750
- const handleAutoPlay = () => {
6751
- const { autoPlay, interval } = props;
6752
- const { stopFlag } = internalData;
6753
- stopAutoPlay();
6754
- if (autoPlay) {
6755
- internalData.stopFlag = false;
6756
- internalData.apTimeout = setTimeout(() => {
6757
- if (!stopFlag) {
6758
- handlePrevNext(true);
6742
+ const scrollEvent = (evnt) => {
6743
+ const { xThumbWidth, yThumbHeight } = reactData;
6744
+ const { lastScrollTop, lastScrollLeft } = internalData;
6745
+ const xOpts = computeXOpts.value;
6746
+ const yOpts = computeYOpts.value;
6747
+ const viewEl = evnt.currentTarget;
6748
+ const { scrollTop, scrollLeft, clientWidth, clientHeight, scrollHeight, scrollWidth } = viewEl;
6749
+ let direction = '';
6750
+ let isTopBoundary = false;
6751
+ let isBottomBoundary = false;
6752
+ let isLeftBoundary = false;
6753
+ let isRightBoundary = false;
6754
+ if (lastScrollTop !== scrollTop) {
6755
+ const yThreshold = XEUtils.toNumber(yOpts.threshold) || 1;
6756
+ if (lastScrollTop < scrollTop) {
6757
+ direction = 'bottom';
6758
+ if (yThumbHeight > 0 && scrollTop + clientHeight >= scrollHeight - yThreshold) {
6759
+ isBottomBoundary = true;
6759
6760
  }
6760
- }, XEUtils.toNumber(interval) || 300);
6761
+ }
6762
+ else {
6763
+ direction = 'top';
6764
+ if (yThumbHeight > 0 && scrollTop <= yThreshold) {
6765
+ isTopBoundary = true;
6766
+ }
6767
+ }
6768
+ }
6769
+ if (lastScrollLeft !== scrollLeft) {
6770
+ const xThreshold = XEUtils.toNumber(xOpts.threshold) || 1;
6771
+ if (lastScrollLeft < scrollLeft) {
6772
+ direction = 'right';
6773
+ if (xThumbWidth > 0 && scrollLeft + clientWidth >= scrollWidth - xThreshold) {
6774
+ isRightBoundary = true;
6775
+ }
6776
+ }
6777
+ else {
6778
+ direction = 'left';
6779
+ if (xThumbWidth > 0 && scrollLeft <= xThreshold) {
6780
+ isLeftBoundary = true;
6781
+ }
6782
+ }
6783
+ }
6784
+ updateThumbOffset();
6785
+ internalData.lastScrollTop = scrollTop;
6786
+ internalData.lastScrollLeft = scrollLeft;
6787
+ if (isBottomBoundary || isTopBoundary || isRightBoundary || isLeftBoundary) {
6788
+ dispatchEvent('scroll-boundary', {
6789
+ direction: direction,
6790
+ isTop: isTopBoundary,
6791
+ isBottom: isBottomBoundary,
6792
+ isLeft: isLeftBoundary,
6793
+ isRight: isRightBoundary,
6794
+ scrollTop: scrollTop,
6795
+ scrollLeft: scrollLeft,
6796
+ clientWidth: clientWidth,
6797
+ clientHeight: clientHeight,
6798
+ scrollHeight: scrollHeight,
6799
+ scrollWidth: scrollWidth
6800
+ }, evnt);
6801
+ }
6802
+ dispatchEvent('scroll', {
6803
+ direction: direction,
6804
+ isTop: yThumbHeight > 0 && scrollTop <= 0,
6805
+ isBottom: yThumbHeight > 0 && scrollTop + clientHeight >= scrollHeight,
6806
+ isLeft: xThumbWidth > 0 && scrollLeft <= 0,
6807
+ isRight: xThumbWidth > 0 && scrollLeft + clientWidth >= scrollWidth,
6808
+ scrollTop: scrollTop,
6809
+ scrollLeft: scrollLeft,
6810
+ clientWidth: clientWidth,
6811
+ clientHeight: clientHeight,
6812
+ scrollHeight: scrollHeight,
6813
+ scrollWidth: scrollWidth
6814
+ }, evnt);
6815
+ };
6816
+ const clickTrackXEvent = (evnt) => {
6817
+ const trackEl = evnt.currentTarget;
6818
+ if (trackEl !== evnt.target) {
6819
+ return;
6761
6820
  }
6821
+ const viewEl = refViewElem.value;
6822
+ if (!viewEl) {
6823
+ return;
6824
+ }
6825
+ const { xThumbWidth } = reactData;
6826
+ const trackRect = trackEl.getBoundingClientRect();
6827
+ viewEl.scrollTo({
6828
+ left: getScrollFromClick(evnt.clientX - trackRect.left, viewEl.clientWidth, viewEl.scrollWidth, trackEl.clientWidth, xThumbWidth),
6829
+ behavior: 'auto'
6830
+ });
6762
6831
  };
6763
- const mouseenterEvent = () => {
6764
- stopAutoPlay();
6832
+ const clickTrackYEvent = (evnt) => {
6833
+ const trackEl = evnt.currentTarget;
6834
+ if (trackEl !== evnt.target) {
6835
+ return;
6836
+ }
6837
+ const viewEl = refViewElem.value;
6838
+ if (!viewEl) {
6839
+ return;
6840
+ }
6841
+ const { yThumbHeight } = reactData;
6842
+ const trackRect = trackEl.getBoundingClientRect();
6843
+ viewEl.scrollTo({
6844
+ top: getScrollFromClick(evnt.clientY - trackRect.top, viewEl.clientHeight, viewEl.scrollHeight, trackEl.clientHeight, yThumbHeight),
6845
+ behavior: 'auto'
6846
+ });
6765
6847
  };
6766
- const mouseleaveEvent = () => {
6767
- handleAutoPlay();
6848
+ const pointerdownThumbXEvent = (evnt) => {
6849
+ const thumbEl = evnt.currentTarget;
6850
+ internalData.isThumbDrag = true;
6851
+ thumbEl.setPointerCapture(evnt.pointerId);
6852
+ const viewEl = refViewElem.value;
6853
+ if (!viewEl) {
6854
+ return;
6855
+ }
6856
+ const { xThumbWidth } = reactData;
6857
+ const trackEl = thumbEl.parentElement;
6858
+ const trackRect = trackEl.getBoundingClientRect();
6859
+ const pointerPosition = evnt.clientX - trackRect.left;
6860
+ // 记录 thumb 的偏移
6861
+ const thumbOffset = getThumbOffsetSize(viewEl.scrollLeft, viewEl.clientWidth, viewEl.scrollWidth, trackEl.clientWidth, xThumbWidth);
6862
+ internalData.thumbDragOffset = pointerPosition - thumbOffset;
6768
6863
  };
6769
- const carouselPrivateMethods = {};
6770
- const callSlot = (slotFunc, params) => {
6771
- if (slotFunc) {
6772
- if (XEUtils.isString(slotFunc)) {
6773
- slotFunc = slots[slotFunc] || null;
6774
- }
6775
- if (XEUtils.isFunction(slotFunc)) {
6776
- return getSlotVNs(slotFunc(params));
6864
+ const pointermoveThumbXEvent = (evnt) => {
6865
+ const thumbEl = evnt.currentTarget;
6866
+ if (!thumbEl.hasPointerCapture(evnt.pointerId)) {
6867
+ return;
6868
+ }
6869
+ const { isThumbDrag, thumbDragOffset } = internalData;
6870
+ if (isThumbDrag) {
6871
+ const viewEl = refViewElem.value;
6872
+ if (!viewEl) {
6873
+ return;
6777
6874
  }
6875
+ const { xThumbWidth } = reactData;
6876
+ const thumbEl = evnt.currentTarget;
6877
+ const trackEl = thumbEl.parentElement;
6878
+ const trackRect = trackEl.getBoundingClientRect();
6879
+ // 更新偏移
6880
+ viewEl.scrollLeft = getScrollFromDrag(evnt.clientX - trackRect.left, thumbDragOffset, viewEl.clientWidth, viewEl.scrollWidth, trackEl.clientWidth, xThumbWidth);
6778
6881
  }
6779
- return [];
6780
6882
  };
6781
- Object.assign($xeCarousel, carouselMethods, carouselPrivateMethods);
6782
- const renderItemWrapper = (list) => {
6783
- const { height } = props;
6784
- const { activeName } = reactData;
6785
- const listStyle = computeListStyle.value;
6786
- return h('div', {
6787
- class: 'vxe-carousel--list',
6788
- style: listStyle
6789
- }, list.map(item => {
6790
- const { name, url, slots } = item;
6791
- const defaultSlot = slots ? slots.default : null;
6792
- return h('div', {
6793
- key: `${name}`,
6794
- class: ['vxe-carousel--item-inner', {
6795
- 'is--active': activeName === name
6796
- }],
6797
- style: height
6798
- ? {
6799
- height: toCssUnit(height)
6800
- }
6801
- : null
6802
- }, defaultSlot
6803
- ? callSlot(defaultSlot, {})
6804
- : [
6805
- h('img', {
6806
- class: 'vxe-carousel--item-img',
6807
- src: url
6808
- })
6809
- ]);
6810
- }));
6883
+ const cleatPointerThumbEvent = (evnt) => {
6884
+ const thumbEl = evnt.currentTarget;
6885
+ thumbEl.releasePointerCapture(evnt.pointerId);
6886
+ internalData.isThumbDrag = false;
6811
6887
  };
6812
- const renderIndicators = (list) => {
6813
- const { activeName } = reactData;
6814
- return h('div', {
6815
- class: 'vxe-carousel--indicators'
6816
- }, list.map((item) => {
6817
- const { name } = item;
6818
- return h('div', {
6819
- key: `${name}`,
6820
- class: ['vxe-carousel--indicators-item', {
6821
- 'is--active': activeName === name
6822
- }],
6823
- onClick(evnt) {
6824
- clickItemEvent(evnt, item);
6825
- }
6826
- });
6827
- }));
6888
+ const pointerdownThumbYEvent = (evnt) => {
6889
+ const thumbEl = evnt.currentTarget;
6890
+ internalData.isThumbDrag = true;
6891
+ thumbEl.setPointerCapture(evnt.pointerId);
6892
+ const viewEl = refViewElem.value;
6893
+ if (!viewEl) {
6894
+ return;
6895
+ }
6896
+ const { yThumbHeight } = reactData;
6897
+ const trackEl = thumbEl.parentElement;
6898
+ const trackRect = trackEl.getBoundingClientRect();
6899
+ const pointerPosition = evnt.clientY - trackRect.top;
6900
+ // 记录 thumb 的偏移
6901
+ const thumbOffset = getThumbOffsetSize(viewEl.scrollTop, viewEl.clientHeight, viewEl.scrollHeight, trackEl.clientHeight, yThumbHeight);
6902
+ internalData.thumbDragOffset = pointerPosition - thumbOffset;
6903
+ };
6904
+ const pointermoveThumbYEvent = (evnt) => {
6905
+ const thumbEl = evnt.currentTarget;
6906
+ if (!thumbEl.hasPointerCapture(evnt.pointerId)) {
6907
+ return;
6908
+ }
6909
+ const { isThumbDrag, thumbDragOffset } = internalData;
6910
+ if (isThumbDrag) {
6911
+ const viewEl = refViewElem.value;
6912
+ if (!viewEl) {
6913
+ return;
6914
+ }
6915
+ const { yThumbHeight } = reactData;
6916
+ const thumbEl = evnt.currentTarget;
6917
+ const trackEl = thumbEl.parentElement;
6918
+ const trackRect = trackEl.getBoundingClientRect();
6919
+ // 更新偏移
6920
+ viewEl.scrollTop = getScrollFromDrag(evnt.clientY - trackRect.top, thumbDragOffset, viewEl.clientHeight, viewEl.scrollHeight, trackEl.clientHeight, yThumbHeight);
6921
+ }
6828
6922
  };
6923
+ const scrollbarPrivateMethods = {};
6924
+ Object.assign($xeScrollbar, scrollbarMethods, scrollbarPrivateMethods);
6829
6925
  const renderVN = () => {
6830
- const { loading, height, width, showIndicators, vertical, options } = props;
6831
- const { staticItems } = reactData;
6926
+ const { id, native, loading, viewAttrs } = props;
6927
+ const wrapperStyle = computeWrapperStyle.value;
6928
+ const wrapperClss = computeWrapperClss.value;
6929
+ const viewClss = computeViewClss.value;
6930
+ const viewInnerClss = computeViewInnerClss.value;
6931
+ const xOpts = computeXOpts.value;
6932
+ const yOpts = computeYOpts.value;
6832
6933
  const defaultSlot = slots.default;
6833
- const list = (staticItems && staticItems.length ? staticItems : options) || [];
6834
6934
  return h('div', {
6835
6935
  ref: refElem,
6836
- class: ['vxe-carousel', `is--${vertical ? 'vertical' : 'horizontal'}`],
6837
- style: width
6838
- ? {
6839
- width: toCssUnit(width)
6840
- }
6841
- : null,
6842
- onMouseenter: mouseenterEvent,
6843
- onMouseleave: mouseleaveEvent
6936
+ id: id || null,
6937
+ class: wrapperClss,
6938
+ style: wrapperStyle
6844
6939
  }, [
6845
- h('div', {
6846
- class: 'vxe-carousel--slots'
6847
- }, defaultSlot ? defaultSlot({}) : []),
6848
- h('div', {
6849
- ref: refWrapperElem,
6850
- class: 'vxe-carousel--item-wrapper',
6851
- style: height
6852
- ? {
6853
- height: toCssUnit(height)
6854
- }
6855
- : null
6856
- }, [
6857
- renderItemWrapper(list)
6858
- ]),
6859
- showIndicators ? renderIndicators(list) : renderEmptyElement$1($xeCarousel),
6860
- h('div', {
6861
- class: 'vxe-carousel--btn-wrapper'
6862
- }, [
6940
+ h('div', Object.assign({ ref: refViewElem, class: viewClss, onScroll: scrollEvent }, viewAttrs), [
6863
6941
  h('div', {
6864
- class: 'vxe-carousel--previous-btn',
6865
- onClick: prevEvent
6942
+ key: 'vi',
6943
+ ref: refViewInnerElem,
6944
+ class: viewInnerClss
6945
+ }, defaultSlot ? defaultSlot({}) : [])
6946
+ ]),
6947
+ native || xOpts.visible === 'hidden'
6948
+ ? renderEmptyElement($xeScrollbar)
6949
+ : h('div', {
6950
+ ref: refTrackXElem,
6951
+ class: 'vxe-scrollbar--track-x',
6952
+ onClick: clickTrackXEvent
6866
6953
  }, [
6867
- h('i', {
6868
- class: vertical ? getIcon$2().CAROUSEL_VERTICAL_PREVIOUS : getIcon$2().CAROUSEL_HORIZONTAL_PREVIOUS
6954
+ h('div', {
6955
+ ref: refThumbXElem,
6956
+ class: 'vxe-scrollbar--thumb-x',
6957
+ onPointerdown: pointerdownThumbXEvent,
6958
+ onPointermove: pointermoveThumbXEvent,
6959
+ onPointerup: cleatPointerThumbEvent,
6960
+ onPointercancel: cleatPointerThumbEvent,
6961
+ onLostpointercapture: cleatPointerThumbEvent
6869
6962
  })
6870
6963
  ]),
6871
- h('div', {
6872
- class: 'vxe-carousel--next-btn',
6873
- onClick: nextEvent
6964
+ native || yOpts.visible === 'hidden'
6965
+ ? renderEmptyElement($xeScrollbar)
6966
+ : h('div', {
6967
+ ref: refTrackYElem,
6968
+ class: 'vxe-scrollbar--track-y',
6969
+ onClick: clickTrackYEvent
6874
6970
  }, [
6875
- h('i', {
6876
- class: vertical ? getIcon$2().CAROUSEL_VERTICAL_NEXT : getIcon$2().CAROUSEL_HORIZONTAL_NEXT
6971
+ h('div', {
6972
+ ref: refThumbYElem,
6973
+ class: 'vxe-scrollbar--thumb-y',
6974
+ onPointerdown: pointerdownThumbYEvent,
6975
+ onPointermove: pointermoveThumbYEvent,
6976
+ onPointerup: cleatPointerThumbEvent,
6977
+ onPointercancel: cleatPointerThumbEvent,
6978
+ onLostpointercapture: cleatPointerThumbEvent
6877
6979
  })
6878
- ])
6879
- ]),
6880
- /**
6881
- * 加载中
6882
- */
6980
+ ]),
6883
6981
  h(VxeLoading, {
6884
- class: 'vxe-carousel--loading',
6982
+ class: 'vxe-scrollbar--loading',
6885
6983
  modelValue: loading
6886
6984
  })
6887
6985
  ]);
6888
6986
  };
6889
- const optsFlag = ref(0);
6890
- watch(() => props.options ? props.options.length : -1, () => {
6891
- optsFlag.value++;
6987
+ const reFlag = ref(0);
6988
+ watch(() => props.height, () => {
6989
+ reFlag.value++;
6892
6990
  });
6893
- watch(() => props.options, () => {
6894
- optsFlag.value++;
6991
+ watch(() => props.width, () => {
6992
+ reFlag.value++;
6895
6993
  });
6896
- watch(optsFlag, () => {
6897
- initDefaultActive(props.options);
6994
+ watch(() => props.minHeight, () => {
6995
+ reFlag.value++;
6898
6996
  });
6899
- const stFlag = ref(0);
6900
- watch(() => reactData.staticItems ? reactData.staticItems.length : -1, () => {
6901
- stFlag.value++;
6997
+ watch(() => props.minWidth, () => {
6998
+ reFlag.value++;
6902
6999
  });
6903
- watch(() => reactData.staticItems, () => {
6904
- stFlag.value++;
7000
+ watch(() => props.maxHeight, () => {
7001
+ reFlag.value++;
6905
7002
  });
6906
- watch(stFlag, () => {
6907
- initDefaultActive(reactData.staticItems);
7003
+ watch(() => props.maxWidth, () => {
7004
+ reFlag.value++;
6908
7005
  });
6909
- watch(() => props.autoPlay, () => {
6910
- handleAutoPlay();
7006
+ watch(() => props.native, () => {
7007
+ reFlag.value++;
7008
+ });
7009
+ watch(() => props.syncResize, () => {
7010
+ reFlag.value++;
7011
+ });
7012
+ watch(reFlag, () => {
7013
+ $xeScrollbar.recalculate().then(() => {
7014
+ $xeScrollbar.recalculate();
7015
+ });
6911
7016
  });
6912
- initDefaultActive(reactData.staticItems.length ? reactData.staticItems : props.options);
6913
7017
  onMounted(() => {
6914
- handleAutoPlay();
6915
- updateStyle();
7018
+ const { autoResize } = props;
7019
+ const viewEl = refViewElem.value;
7020
+ const viewInnerEl = refViewInnerElem.value;
7021
+ if (autoResize) {
7022
+ const resizeObserver = globalResize.create(() => {
7023
+ if (props.autoResize) {
7024
+ reFlag.value++;
7025
+ }
7026
+ });
7027
+ if (viewEl) {
7028
+ resizeObserver.observe(viewEl);
7029
+ }
7030
+ if (viewInnerEl) {
7031
+ resizeObserver.observe(viewInnerEl);
7032
+ }
7033
+ internalData.resizeObserver = resizeObserver;
7034
+ }
7035
+ reFlag.value++;
7036
+ globalEvents.on($xeScrollbar, 'resize', () => {
7037
+ reFlag.value++;
7038
+ });
6916
7039
  });
6917
- onUnmounted(() => {
6918
- stopAutoPlay();
7040
+ onBeforeUnmount(() => {
7041
+ const { resizeObserver } = internalData;
7042
+ if (resizeObserver) {
7043
+ resizeObserver.disconnect();
7044
+ }
7045
+ globalEvents.off($xeScrollbar, 'resize');
6919
7046
  });
6920
- provide('$xeCarousel', $xeCarousel);
6921
- $xeCarousel.renderVN = renderVN;
6922
- return $xeCarousel;
7047
+ $xeScrollbar.renderVN = renderVN;
7048
+ return $xeScrollbar;
6923
7049
  },
6924
7050
  render() {
6925
7051
  return this.renderVN();
6926
7052
  }
6927
7053
  });
6928
7054
 
6929
- const VxeCarousel = Object.assign({}, VxeCarouselComponent, {
7055
+ const VxeScrollbar = Object.assign({}, VxeScrollbarComponent, {
6930
7056
  install(app) {
6931
- app.component(VxeCarouselComponent.name, VxeCarouselComponent);
7057
+ app.component(VxeScrollbarComponent.name, VxeScrollbarComponent);
6932
7058
  }
6933
7059
  });
6934
- dynamicApp.use(VxeCarousel);
6935
- VxeUI.component(VxeCarouselComponent);
6936
- const Carousel = VxeCarousel;
6937
-
6938
- function assembleCarouselItem($xeCarousel, elem, itemConfig) {
6939
- const staticItems = $xeCarousel.reactData.staticItems;
6940
- const parentElem = elem.parentNode;
6941
- if (parentElem) {
6942
- staticItems.splice(XEUtils.arrayIndexOf(parentElem.children, elem), 0, itemConfig);
6943
- }
6944
- $xeCarousel.reactData.staticItems = staticItems.slice(0);
6945
- }
6946
- function destroyCarouselItem($xeCarousel, itemConfig) {
6947
- const staticItems = $xeCarousel.reactData.staticItems;
6948
- const index = XEUtils.findIndexOf(staticItems, item => item.id === itemConfig.id);
6949
- if (index > -1) {
6950
- staticItems.splice(index, 1);
6951
- }
6952
- $xeCarousel.reactData.staticItems = staticItems.slice(0);
6953
- }
7060
+ dynamicApp.use(VxeScrollbar);
7061
+ VxeUI.component(VxeScrollbarComponent);
7062
+ const Scrollbar = VxeScrollbar;
6954
7063
 
6955
- var VxeCarouselItemComponent = defineVxeComponent({
6956
- name: 'VxeCarouselItem',
7064
+ var VxeCardComponent = defineVxeComponent({
7065
+ name: 'VxeCard',
6957
7066
  props: {
6958
- name: [String, Number],
6959
- className: String,
6960
- url: String
6961
- },
6962
- emits: [],
6963
- setup(props, context) {
6964
- const { slots, emit } = context;
6965
- const $xeCarousel = inject('$xeCarousel', null);
6966
- const xID = XEUtils.uniqueId();
6967
- const refElem = ref();
6968
- const reactData = reactive({});
6969
- const itemConfig = reactive({
6970
- id: xID,
6971
- name: props.name,
6972
- url: props.url,
6973
- className: props.className,
6974
- slots
6975
- });
6976
- const refMaps = {
6977
- refElem
6978
- };
6979
- const computeMaps = {};
6980
- const $xeCarouselItem = {
6981
- xID,
6982
- props,
6983
- context,
7067
+ title: String,
7068
+ showTitleOverflow: {
7069
+ type: Boolean,
7070
+ default: () => getConfig$4().card.showTitleOverflow
7071
+ },
7072
+ width: [String, Number],
7073
+ height: [String, Number],
7074
+ border: {
7075
+ type: Boolean,
7076
+ default: () => getConfig$4().card.border
7077
+ },
7078
+ loading: Boolean,
7079
+ shadow: {
7080
+ type: Boolean,
7081
+ default: () => getConfig$4().card.shadow
7082
+ },
7083
+ padding: {
7084
+ type: Boolean,
7085
+ default: () => getConfig$4().card.padding
7086
+ },
7087
+ size: {
7088
+ type: String,
7089
+ default: () => getConfig$4().card.size || getConfig$4().size
7090
+ },
7091
+ useScrollbar: {
7092
+ type: Boolean,
7093
+ default: () => getConfig$4().card.useScrollbar
7094
+ },
7095
+ scrollbarConfig: Object
7096
+ },
7097
+ emits: [],
7098
+ setup(props, context) {
7099
+ const { slots, emit } = context;
7100
+ const xID = XEUtils.uniqueId();
7101
+ const refElem = ref();
7102
+ const { computeSize } = useSize(props);
7103
+ const reactData = reactive({});
7104
+ const refMaps = {
7105
+ refElem
7106
+ };
7107
+ const computeCardStyle = computed(() => {
7108
+ const { height, width } = props;
7109
+ const stys = {};
7110
+ if (width) {
7111
+ stys.width = toCssUnit(width);
7112
+ }
7113
+ if (height) {
7114
+ stys.height = toCssUnit(height);
7115
+ }
7116
+ return stys;
7117
+ });
7118
+ const computeScrollbarOpts = computed(() => {
7119
+ return Object.assign({}, getConfig$4().card.scrollbarConfig, props.scrollbarConfig);
7120
+ });
7121
+ const computeMaps = {
7122
+ computeSize
7123
+ };
7124
+ const $xeCard = {
7125
+ xID,
7126
+ props,
7127
+ context,
6984
7128
  reactData,
6985
7129
  getRefMaps: () => refMaps,
6986
7130
  getComputeMaps: () => computeMaps
6987
7131
  };
6988
7132
  const dispatchEvent = (type, params, evnt) => {
6989
- emit(type, createEvent$1(evnt, { $carouselItem: $xeCarouselItem }, params));
7133
+ emit(type, createEvent$1(evnt, { $card: $xeCard }, params));
6990
7134
  };
6991
- const carouselItemMethods = {
7135
+ const cardMethods = {
6992
7136
  dispatchEvent
6993
7137
  };
6994
- const carouselItemPrivateMethods = {};
6995
- Object.assign($xeCarouselItem, carouselItemMethods, carouselItemPrivateMethods);
7138
+ const cardPrivateMethods = {};
7139
+ Object.assign($xeCard, cardMethods, cardPrivateMethods);
6996
7140
  const renderVN = () => {
7141
+ const { title, border, shadow, padding, loading, showTitleOverflow, useScrollbar } = props;
7142
+ const defaultSlot = slots.default;
7143
+ const headerSlot = slots.header;
7144
+ const titleSlot = slots.title;
7145
+ const extraSlot = slots.extra;
7146
+ const footerSlot = slots.footer;
7147
+ const leftSlot = slots.left;
7148
+ const rightSlot = slots.right;
7149
+ const vSize = computeSize.value;
7150
+ const cardStyle = computeCardStyle.value;
7151
+ const scrollbarOpts = computeScrollbarOpts.value;
7152
+ const { viewClassName, viewInnerClassName } = scrollbarOpts;
6997
7153
  return h('div', {
6998
- ref: refElem
6999
- });
7154
+ ref: refElem,
7155
+ class: ['vxe-card', {
7156
+ [`size--${vSize}`]: vSize,
7157
+ 'is--border': border,
7158
+ 'is--shadow': shadow,
7159
+ 'is--padding': padding
7160
+ }],
7161
+ style: cardStyle
7162
+ }, [
7163
+ title || titleSlot || headerSlot
7164
+ ? h('div', {
7165
+ class: 'vxe-card--header'
7166
+ }, headerSlot
7167
+ ? getSlotVNs(headerSlot({}))
7168
+ : [
7169
+ h('div', {
7170
+ class: ['vxe-card--header-title', {
7171
+ 'is--ellipsis': showTitleOverflow
7172
+ }]
7173
+ }, titleSlot ? getSlotVNs(titleSlot({})) : `${title || ''}`),
7174
+ extraSlot
7175
+ ? h('div', {
7176
+ class: 'vxe-card--header-extra'
7177
+ }, getSlotVNs(extraSlot({})))
7178
+ : renderEmptyElement$1($xeCard)
7179
+ ])
7180
+ : renderEmptyElement$1($xeCard),
7181
+ h('div', {
7182
+ class: 'vxe-card--body'
7183
+ }, [
7184
+ leftSlot
7185
+ ? (useScrollbar
7186
+ ? h(VxeScrollbar, Object.assign(Object.assign({ class: 'vxe-card--body-scrollbar-left' }, scrollbarOpts), { viewClassName: 'vxe-card--body-scrollbar-left-view', viewInnerClassName: 'vxe-card--body-scrollbar-left-inner' }), {
7187
+ default: () => getSlotVNs(leftSlot({}))
7188
+ })
7189
+ : h('div', {
7190
+ class: 'vxe-card--body-left'
7191
+ }, getSlotVNs(leftSlot({}))))
7192
+ : renderEmptyElement$1($xeCard),
7193
+ useScrollbar
7194
+ ? h(VxeScrollbar, Object.assign(Object.assign({ class: 'vxe-card--body-scrollbar-content' }, scrollbarOpts), { viewClassName: 'vxe-card--body-scrollbar-content-view' + (viewClassName ? (' ' + viewClassName) : ''), viewInnerClassName: 'vxe-card--body-scrollbar-content-inner' + (viewClassName ? (' ' + viewInnerClassName) : '') }), {
7195
+ default: () => defaultSlot ? getSlotVNs(defaultSlot({})) : []
7196
+ })
7197
+ : h('div', {
7198
+ class: 'vxe-card--body-content'
7199
+ }, defaultSlot ? getSlotVNs(defaultSlot({})) : []),
7200
+ rightSlot
7201
+ ? (useScrollbar
7202
+ ? h(VxeScrollbar, Object.assign(Object.assign({ class: 'vxe-card--body-scrollbar-right' }, scrollbarOpts), { viewClassName: 'vxe-card--body-scrollbar-right-view', viewInnerClassName: 'vxe-card--body-scrollbar-right-inner' }), {
7203
+ default: () => getSlotVNs(rightSlot({}))
7204
+ })
7205
+ : h('div', {
7206
+ class: 'vxe-card--body-right'
7207
+ }, getSlotVNs(rightSlot({}))))
7208
+ : renderEmptyElement$1($xeCard)
7209
+ ]),
7210
+ footerSlot
7211
+ ? h('div', {
7212
+ class: 'vxe-card--footer'
7213
+ }, getSlotVNs(footerSlot({})))
7214
+ : renderEmptyElement$1($xeCard),
7215
+ /**
7216
+ * 加载中
7217
+ */
7218
+ h(VxeLoading, {
7219
+ class: 'vxe-card--loading',
7220
+ modelValue: loading
7221
+ })
7222
+ ]);
7000
7223
  };
7001
- watch(() => props.name, (val) => {
7002
- itemConfig.name = val;
7003
- });
7004
- watch(() => props.url, (val) => {
7005
- itemConfig.url = val;
7006
- });
7007
- onMounted(() => {
7008
- const elem = refElem.value;
7009
- if ($xeCarousel && elem) {
7010
- assembleCarouselItem($xeCarousel, elem, itemConfig);
7011
- }
7012
- });
7013
- onUnmounted(() => {
7014
- if ($xeCarousel) {
7015
- destroyCarouselItem($xeCarousel, itemConfig);
7016
- }
7017
- });
7018
- $xeCarouselItem.renderVN = renderVN;
7019
- return $xeCarouselItem;
7224
+ $xeCard.renderVN = renderVN;
7225
+ return $xeCard;
7020
7226
  },
7021
7227
  render() {
7022
7228
  return this.renderVN();
7023
7229
  }
7024
7230
  });
7025
7231
 
7026
- const VxeCarouselItem = Object.assign({}, VxeCarouselItemComponent, {
7232
+ const VxeCard = Object.assign({}, VxeCardComponent, {
7027
7233
  install(app) {
7028
- app.component(VxeCarouselItemComponent.name, VxeCarouselItemComponent);
7234
+ app.component(VxeCardComponent.name, VxeCardComponent);
7029
7235
  }
7030
7236
  });
7031
- dynamicApp.use(VxeCarouselItem);
7032
- VxeUI.component(VxeCarouselItemComponent);
7033
- const CarouselItem = VxeCarouselItem;
7034
-
7035
- function enNodeValue(nodeid) {
7036
- return XEUtils.eqNull(nodeid) ? '' : encodeURIComponent(`${nodeid}`);
7037
- }
7038
- function deNodeValue(nodeid) {
7039
- return nodeid ? decodeURIComponent(`${nodeid}`) : nodeid;
7040
- }
7041
-
7042
- // 跨列表拖拽
7043
- const crossListDragRowInfo = reactive({
7044
- row: null
7045
- });
7046
- function getCrossListDragRowInfo() {
7047
- return crossListDragRowInfo;
7048
- }
7049
-
7050
- const rowMoveCls = 'row--drag-move';
7051
- /**
7052
- * 上下拖拽
7053
- */
7054
- function moveRowAnimateToTb(elemList, offsetTop) {
7055
- XEUtils.arrayEach(elemList, trEl => {
7056
- trEl.style.transform = `translateY(${offsetTop}px)`;
7057
- });
7058
- requestAnimationFrame(() => {
7059
- XEUtils.arrayEach(elemList, trEl => {
7060
- addClass(trEl, rowMoveCls);
7061
- trEl.style.transform = '';
7062
- });
7063
- });
7064
- }
7065
- function clearRowAnimate(elem, clss) {
7066
- setTimeout(() => {
7067
- if (elem) {
7068
- XEUtils.arrayEach(elem.querySelectorAll(clss.map(cls => `${cls}.${rowMoveCls}`).join(',')), elem => removeClass(elem, rowMoveCls));
7069
- }
7070
- }, 500);
7071
- }
7072
-
7073
- function getItemCacheObj$1(item) {
7074
- return {
7075
- item,
7076
- index: -1,
7077
- $index: -1,
7078
- _index: -1
7079
- };
7080
- }
7237
+ dynamicApp.use(VxeCard);
7238
+ VxeUI.component(VxeCardComponent);
7239
+ const Card = VxeCard;
7081
7240
 
7082
- const { warnLog: warnLog$h, errLog: errLog$j } = createComponentLog('tree');
7083
- function getRowKeyByField(row, keyField) {
7084
- return row ? ('' + (row[keyField] || '')) : '';
7085
- }
7086
- function getRowIdByField(row, keyField) {
7087
- if (!row) {
7088
- return '';
7089
- }
7090
- const rowKey = getRowKeyByField(row, keyField);
7091
- return enModelValue(rowKey);
7092
- }
7093
- function createReactData$n() {
7094
- return {
7095
- scrollYLoad: false,
7096
- bodyHeight: 0,
7097
- headHeight: 0,
7098
- footHeight: 0,
7099
- customHeight: 0,
7100
- customMaxHeight: 0,
7101
- parentHeight: 0,
7102
- topSpaceHeight: 0,
7103
- rowList: [],
7104
- selectRadioRow: null,
7105
- currRowFlag: 1,
7106
- updateCheckboxFlag: 1,
7107
- isAllChecked: false,
7108
- isAllIndeterminate: false,
7109
- insertRowFlag: 1,
7110
- removeRowFlag: 1,
7111
- dragRow: null,
7112
- dragTipText: '',
7113
- isCrossDragRow: false
7114
- };
7115
- }
7116
- function createInternalData$m() {
7117
- return {
7118
- resizeObserver: undefined,
7119
- fullData: [],
7120
- afterList: [],
7121
- fullKeyMaps: {},
7122
- rowMaps: {},
7123
- lastScrollLeft: 0,
7124
- lastScrollTop: 0,
7125
- scrollYStore: {
7126
- startIndex: 0,
7127
- endIndex: 0,
7128
- visibleSize: 0,
7129
- offsetSize: 0,
7130
- rowHeight: 0
7131
- },
7132
- currentRow: null,
7133
- selectCheckboxMaps: {},
7134
- insertRowMaps: {},
7135
- removeRowMaps: {}
7136
- // prevDragRow: null,
7137
- // prevDragPos: ''
7138
- };
7139
- }
7140
- let crossListDragRowObj = null;
7141
- var VxeListComponent = defineVxeComponent({
7142
- name: 'VxeList',
7241
+ var VxeCarouselComponent = defineVxeComponent({
7242
+ name: 'VxeCarousel',
7143
7243
  props: {
7144
- data: Array,
7145
- height: [Number, String],
7146
- maxHeight: [Number, String],
7244
+ modelValue: [String, Number],
7245
+ options: Array,
7147
7246
  loading: Boolean,
7148
- className: [String, Function],
7149
- size: {
7150
- type: String,
7151
- default: () => getConfig$4().list.size || getConfig$4().size
7247
+ height: {
7248
+ type: [Number, String],
7249
+ default: () => getConfig$4().carousel.height
7152
7250
  },
7153
- autoResize: {
7154
- type: Boolean,
7155
- default: () => getConfig$4().list.autoResize
7251
+ width: {
7252
+ type: [Number, String],
7253
+ default: () => getConfig$4().carousel.width
7156
7254
  },
7157
- syncResize: [Boolean, String, Number],
7158
- showSeq: {
7255
+ autoPlay: {
7159
7256
  type: Boolean,
7160
- default: () => getConfig$4().list.showSeq
7257
+ default: () => getConfig$4().carousel.autoPlay
7161
7258
  },
7162
- showRadio: {
7259
+ interval: {
7260
+ type: [Number, String],
7261
+ default: () => getConfig$4().carousel.interval
7262
+ },
7263
+ loop: {
7163
7264
  type: Boolean,
7164
- default: () => getConfig$4().list.showRadio
7265
+ default: () => getConfig$4().carousel.loop
7165
7266
  },
7166
- checkRowKey: [String, Number],
7167
- radioConfig: Object,
7168
- showCheckbox: {
7267
+ vertical: {
7169
7268
  type: Boolean,
7170
- default: () => getConfig$4().list.showCheckbox
7269
+ default: () => getConfig$4().carousel.vertical
7171
7270
  },
7172
- checkRowKeys: Array,
7173
- checkboxConfig: Object,
7174
- rowConfig: Object,
7175
- dragConfig: Object,
7176
- menuConfig: Object,
7177
- virtualYConfig: Object,
7178
- scrollY: Object
7271
+ showIndicators: {
7272
+ type: Boolean,
7273
+ default: () => getConfig$4().carousel.showIndicators
7274
+ }
7179
7275
  },
7180
7276
  emits: [
7181
- 'update:checkRowKey',
7182
- 'update:checkRowKeys',
7183
- 'row-click',
7184
- 'row-dblclick',
7185
- 'current-change',
7186
- 'radio-change',
7187
- 'checkbox-change',
7188
- 'checkbox-all',
7189
- 'scroll',
7190
- 'row-dragstart',
7191
- 'row-dragover',
7192
- 'row-dragend',
7193
- 'row-remove-dragend',
7194
- 'row-insert-dragend',
7195
- 'row-menu',
7196
- 'menu-click'
7277
+ 'update:modelValue',
7278
+ 'change'
7197
7279
  ],
7198
7280
  setup(props, context) {
7199
- const { slots, emit } = context;
7281
+ const { emit, slots } = context;
7200
7282
  const xID = XEUtils.uniqueId();
7201
- const browseObj = XEUtils.browse();
7202
- const { computeSize } = useSize(props);
7203
- const reactData = reactive(createReactData$n());
7204
- const internalData = createInternalData$m();
7205
- const crossListDragRowInfo = getCrossListDragRowInfo();
7206
7283
  const refElem = ref();
7207
- const refHeaderElem = ref();
7208
- const refFooterElem = ref();
7209
- const refVirtualWrapper = ref();
7210
- const refVirtualBody = ref();
7211
- const refDragRowLineElem = ref();
7212
- const refDragTipElem = ref();
7284
+ const refWrapperElem = ref();
7285
+ const reactData = reactive({
7286
+ activeName: '',
7287
+ staticItems: [],
7288
+ itemWidth: 0,
7289
+ itemHeight: 0
7290
+ });
7291
+ const internalData = {
7292
+ apTimeout: undefined,
7293
+ stopFlag: false
7294
+ };
7213
7295
  const refMaps = {
7214
7296
  refElem
7215
7297
  };
7216
- const $xeList = {
7298
+ const computeListStyle = computed(() => {
7299
+ const { vertical, options } = props;
7300
+ const { activeName, itemWidth, itemHeight, staticItems } = reactData;
7301
+ const list = (staticItems && staticItems.length ? staticItems : options) || [];
7302
+ const activeIndex = Math.max(0, XEUtils.findIndexOf(list, item => item.name === activeName));
7303
+ const stys = {};
7304
+ if (vertical) {
7305
+ stys.transform = `translateY(-${activeIndex * itemHeight}px)`;
7306
+ }
7307
+ else {
7308
+ stys.width = `${itemWidth * list.length}px`;
7309
+ stys.transform = `translateX(-${activeIndex * itemWidth}px)`;
7310
+ }
7311
+ return stys;
7312
+ });
7313
+ const computeMaps = {};
7314
+ const $xeCarousel = {
7217
7315
  xID,
7218
7316
  props,
7219
7317
  context,
7220
7318
  reactData,
7221
7319
  internalData,
7222
- getRefMaps: () => refMaps
7320
+ getRefMaps: () => refMaps,
7321
+ getComputeMaps: () => computeMaps
7223
7322
  };
7224
- const computeRowOpts = computed(() => {
7225
- return Object.assign({}, getConfig$4().list.rowConfig, props.rowConfig);
7226
- });
7227
- const computeDragOpts = computed(() => {
7228
- return Object.assign({}, getConfig$4().list.dragConfig, props.dragConfig);
7229
- });
7230
- const computeSYOpts = computed(() => {
7231
- return Object.assign({}, getConfig$4().list.virtualYConfig || getConfig$4().list.scrollY, props.virtualYConfig || props.scrollY);
7232
- });
7233
- const computeKeyField = computed(() => {
7234
- const rowOpts = computeRowOpts.value;
7235
- const { keyField } = rowOpts;
7236
- return keyField || '';
7237
- });
7238
- const computeIsDrag = computed(() => {
7239
- const { dragConfig } = props;
7240
- const dragOpts = computeDragOpts.value;
7241
- return dragConfig && isEnableConf(dragOpts);
7242
- });
7243
- const computeRowHeight = computed(() => {
7244
- const rowOpts = computeRowOpts.value;
7245
- const { height } = rowOpts;
7246
- return height;
7247
- });
7248
- const computeRadioOpts = computed(() => {
7249
- return Object.assign({ showIcon: true }, getConfig$4().list.radioConfig, props.radioConfig);
7250
- });
7251
- const computeCheckboxOpts = computed(() => {
7252
- return Object.assign({ showIcon: true }, getConfig$4().list.checkboxConfig, props.checkboxConfig);
7253
- });
7254
- const computeMenuOpts = computed(() => {
7255
- return Object.assign({}, getConfig$4().list.menuConfig, props.menuConfig);
7256
- });
7257
- const computeWrapperStyles = computed(() => {
7258
- const rowHeight = computeRowHeight.value;
7259
- const style = {};
7260
- if (rowHeight) {
7261
- style['--vxe-ui-list-row-height'] = toCssUnit(rowHeight);
7262
- }
7263
- return style;
7264
- });
7265
- const computeVirtualStyles = computed(() => {
7266
- const { height, maxHeight } = props;
7267
- const { customHeight, customMaxHeight, headHeight, footHeight } = reactData;
7268
- const style = {};
7269
- if (height) {
7270
- style.height = toCssUnit(Math.max(20, customHeight - headHeight - footHeight));
7271
- }
7272
- else if (maxHeight) {
7273
- style.height = 'auto';
7274
- style.maxHeight = toCssUnit(Math.max(20, customMaxHeight - headHeight - footHeight));
7275
- }
7276
- return style;
7277
- });
7278
- const dispatchEvent = (type, params, evnt) => {
7279
- emit(type, createEvent$1(evnt, { $list: $xeList }, params));
7323
+ const updateStyle = () => {
7324
+ nextTick(() => {
7325
+ const wrapperElem = refWrapperElem.value;
7326
+ if (wrapperElem) {
7327
+ reactData.itemWidth = wrapperElem.clientWidth;
7328
+ reactData.itemHeight = wrapperElem.clientHeight;
7329
+ }
7330
+ });
7280
7331
  };
7281
- const emitCheckboxMode = (value) => {
7282
- emit('update:checkRowKeys', value);
7332
+ const clickItemEvent = (evnt, item) => {
7333
+ const value = item.name;
7334
+ reactData.activeName = item.name;
7335
+ emit('update:modelValue', value);
7336
+ emit('change', { value }, evnt);
7337
+ updateStyle();
7283
7338
  };
7284
- const emitRadioMode = (value) => {
7285
- emit('update:checkRowKey', value);
7339
+ const initDefaultActive = (list) => {
7340
+ let activeName = null;
7341
+ if (list && list.length) {
7342
+ let validVal = false;
7343
+ activeName = props.modelValue;
7344
+ list.forEach((item) => {
7345
+ if (activeName === item.name) {
7346
+ validVal = true;
7347
+ }
7348
+ });
7349
+ if (!validVal) {
7350
+ activeName = list[0].name;
7351
+ emit('update:modelValue', activeName);
7352
+ }
7353
+ }
7354
+ reactData.activeName = activeName;
7286
7355
  };
7287
- const getRowId = (row) => {
7288
- const keyField = computeKeyField.value;
7289
- return getRowIdByField(row, keyField);
7356
+ const dispatchEvent = (type, params, evnt) => {
7357
+ emit(type, createEvent$1(evnt, { $carousel: $xeCarousel }, params));
7290
7358
  };
7291
- const calcTableHeight = (key) => {
7292
- const { parentHeight } = reactData;
7293
- const val = props[key];
7294
- let num = 0;
7295
- if (val) {
7296
- if (val === '100%' || val === 'auto') {
7297
- num = parentHeight;
7359
+ const handlePrevNext = (isNext) => {
7360
+ const { options, loop } = props;
7361
+ const { activeName, staticItems } = reactData;
7362
+ const list = (staticItems && staticItems.length ? staticItems : options) || [];
7363
+ const index = Math.max(0, XEUtils.findIndexOf(list, item => item.name === activeName));
7364
+ if (index > -1) {
7365
+ let item = null;
7366
+ if (isNext) {
7367
+ if (index < list.length - 1) {
7368
+ item = list[index + 1];
7369
+ }
7370
+ else {
7371
+ if (loop) {
7372
+ item = list[0];
7373
+ }
7374
+ }
7298
7375
  }
7299
7376
  else {
7300
- if (isScale(val)) {
7301
- num = Math.floor((XEUtils.toInteger(val) || 1) / 100 * parentHeight);
7377
+ if (index > 0) {
7378
+ item = list[index - 1];
7302
7379
  }
7303
7380
  else {
7304
- num = XEUtils.toNumber(val);
7381
+ if (loop) {
7382
+ item = list[list.length - 1];
7383
+ }
7305
7384
  }
7306
- num = Math.max(40, num);
7385
+ }
7386
+ if (item) {
7387
+ const name = item.name;
7388
+ const value = name;
7389
+ reactData.activeName = name;
7390
+ emit('update:modelValue', value);
7391
+ return true;
7392
+ }
7393
+ }
7394
+ return false;
7395
+ };
7396
+ const carouselMethods = {
7397
+ dispatchEvent,
7398
+ prev() {
7399
+ if (handlePrevNext(false)) {
7400
+ handleAutoPlay();
7401
+ }
7402
+ return nextTick();
7403
+ },
7404
+ next() {
7405
+ if (handlePrevNext(true)) {
7406
+ handleAutoPlay();
7407
+ }
7408
+ return nextTick();
7409
+ }
7410
+ };
7411
+ const prevEvent = (evnt) => {
7412
+ if (handlePrevNext(false)) {
7413
+ const value = reactData.activeName;
7414
+ emit('change', { value }, evnt);
7415
+ }
7416
+ };
7417
+ const nextEvent = (evnt) => {
7418
+ if (handlePrevNext(true)) {
7419
+ const value = reactData.activeName;
7420
+ emit('change', { value }, evnt);
7421
+ }
7422
+ };
7423
+ const stopAutoPlay = () => {
7424
+ const { apTimeout } = internalData;
7425
+ internalData.stopFlag = true;
7426
+ if (apTimeout) {
7427
+ clearTimeout(apTimeout);
7428
+ internalData.apTimeout = undefined;
7429
+ }
7430
+ };
7431
+ const handleAutoPlay = () => {
7432
+ const { autoPlay, interval } = props;
7433
+ const { stopFlag } = internalData;
7434
+ stopAutoPlay();
7435
+ if (autoPlay) {
7436
+ internalData.stopFlag = false;
7437
+ internalData.apTimeout = setTimeout(() => {
7438
+ if (!stopFlag) {
7439
+ handlePrevNext(true);
7440
+ }
7441
+ }, XEUtils.toNumber(interval) || 300);
7442
+ }
7443
+ };
7444
+ const mouseenterEvent = () => {
7445
+ stopAutoPlay();
7446
+ };
7447
+ const mouseleaveEvent = () => {
7448
+ handleAutoPlay();
7449
+ };
7450
+ const carouselPrivateMethods = {};
7451
+ const callSlot = (slotFunc, params) => {
7452
+ if (slotFunc) {
7453
+ if (XEUtils.isString(slotFunc)) {
7454
+ slotFunc = slots[slotFunc] || null;
7455
+ }
7456
+ if (XEUtils.isFunction(slotFunc)) {
7457
+ return getSlotVNs(slotFunc(params));
7458
+ }
7459
+ }
7460
+ return [];
7461
+ };
7462
+ Object.assign($xeCarousel, carouselMethods, carouselPrivateMethods);
7463
+ const renderItemWrapper = (list) => {
7464
+ const { height } = props;
7465
+ const { activeName } = reactData;
7466
+ const listStyle = computeListStyle.value;
7467
+ return h('div', {
7468
+ class: 'vxe-carousel--list',
7469
+ style: listStyle
7470
+ }, list.map(item => {
7471
+ const { name, url, slots } = item;
7472
+ const defaultSlot = slots ? slots.default : null;
7473
+ return h('div', {
7474
+ key: `${name}`,
7475
+ class: ['vxe-carousel--item-inner', {
7476
+ 'is--active': activeName === name
7477
+ }],
7478
+ style: height
7479
+ ? {
7480
+ height: toCssUnit(height)
7481
+ }
7482
+ : null
7483
+ }, defaultSlot
7484
+ ? callSlot(defaultSlot, {})
7485
+ : [
7486
+ h('img', {
7487
+ class: 'vxe-carousel--item-img',
7488
+ src: url
7489
+ })
7490
+ ]);
7491
+ }));
7492
+ };
7493
+ const renderIndicators = (list) => {
7494
+ const { activeName } = reactData;
7495
+ return h('div', {
7496
+ class: 'vxe-carousel--indicators'
7497
+ }, list.map((item) => {
7498
+ const { name } = item;
7499
+ return h('div', {
7500
+ key: `${name}`,
7501
+ class: ['vxe-carousel--indicators-item', {
7502
+ 'is--active': activeName === name
7503
+ }],
7504
+ onClick(evnt) {
7505
+ clickItemEvent(evnt, item);
7506
+ }
7507
+ });
7508
+ }));
7509
+ };
7510
+ const renderVN = () => {
7511
+ const { loading, height, width, showIndicators, vertical, options } = props;
7512
+ const { staticItems } = reactData;
7513
+ const defaultSlot = slots.default;
7514
+ const list = (staticItems && staticItems.length ? staticItems : options) || [];
7515
+ return h('div', {
7516
+ ref: refElem,
7517
+ class: ['vxe-carousel', `is--${vertical ? 'vertical' : 'horizontal'}`],
7518
+ style: width
7519
+ ? {
7520
+ width: toCssUnit(width)
7521
+ }
7522
+ : null,
7523
+ onMouseenter: mouseenterEvent,
7524
+ onMouseleave: mouseleaveEvent
7525
+ }, [
7526
+ h('div', {
7527
+ class: 'vxe-carousel--slots'
7528
+ }, defaultSlot ? defaultSlot({}) : []),
7529
+ h('div', {
7530
+ ref: refWrapperElem,
7531
+ class: 'vxe-carousel--item-wrapper',
7532
+ style: height
7533
+ ? {
7534
+ height: toCssUnit(height)
7535
+ }
7536
+ : null
7537
+ }, [
7538
+ renderItemWrapper(list)
7539
+ ]),
7540
+ showIndicators ? renderIndicators(list) : renderEmptyElement$1($xeCarousel),
7541
+ h('div', {
7542
+ class: 'vxe-carousel--btn-wrapper'
7543
+ }, [
7544
+ h('div', {
7545
+ class: 'vxe-carousel--previous-btn',
7546
+ onClick: prevEvent
7547
+ }, [
7548
+ h('i', {
7549
+ class: vertical ? getIcon$2().CAROUSEL_VERTICAL_PREVIOUS : getIcon$2().CAROUSEL_HORIZONTAL_PREVIOUS
7550
+ })
7551
+ ]),
7552
+ h('div', {
7553
+ class: 'vxe-carousel--next-btn',
7554
+ onClick: nextEvent
7555
+ }, [
7556
+ h('i', {
7557
+ class: vertical ? getIcon$2().CAROUSEL_VERTICAL_NEXT : getIcon$2().CAROUSEL_HORIZONTAL_NEXT
7558
+ })
7559
+ ])
7560
+ ]),
7561
+ /**
7562
+ * 加载中
7563
+ */
7564
+ h(VxeLoading, {
7565
+ class: 'vxe-carousel--loading',
7566
+ modelValue: loading
7567
+ })
7568
+ ]);
7569
+ };
7570
+ const optsFlag = ref(0);
7571
+ watch(() => props.options ? props.options.length : -1, () => {
7572
+ optsFlag.value++;
7573
+ });
7574
+ watch(() => props.options, () => {
7575
+ optsFlag.value++;
7576
+ });
7577
+ watch(optsFlag, () => {
7578
+ initDefaultActive(props.options);
7579
+ });
7580
+ const stFlag = ref(0);
7581
+ watch(() => reactData.staticItems ? reactData.staticItems.length : -1, () => {
7582
+ stFlag.value++;
7583
+ });
7584
+ watch(() => reactData.staticItems, () => {
7585
+ stFlag.value++;
7586
+ });
7587
+ watch(stFlag, () => {
7588
+ initDefaultActive(reactData.staticItems);
7589
+ });
7590
+ watch(() => props.autoPlay, () => {
7591
+ handleAutoPlay();
7592
+ });
7593
+ initDefaultActive(reactData.staticItems.length ? reactData.staticItems : props.options);
7594
+ onMounted(() => {
7595
+ handleAutoPlay();
7596
+ updateStyle();
7597
+ });
7598
+ onUnmounted(() => {
7599
+ stopAutoPlay();
7600
+ });
7601
+ provide('$xeCarousel', $xeCarousel);
7602
+ $xeCarousel.renderVN = renderVN;
7603
+ return $xeCarousel;
7604
+ },
7605
+ render() {
7606
+ return this.renderVN();
7607
+ }
7608
+ });
7609
+
7610
+ const VxeCarousel = Object.assign({}, VxeCarouselComponent, {
7611
+ install(app) {
7612
+ app.component(VxeCarouselComponent.name, VxeCarouselComponent);
7613
+ }
7614
+ });
7615
+ dynamicApp.use(VxeCarousel);
7616
+ VxeUI.component(VxeCarouselComponent);
7617
+ const Carousel = VxeCarousel;
7618
+
7619
+ function assembleCarouselItem($xeCarousel, elem, itemConfig) {
7620
+ const staticItems = $xeCarousel.reactData.staticItems;
7621
+ const parentElem = elem.parentNode;
7622
+ if (parentElem) {
7623
+ staticItems.splice(XEUtils.arrayIndexOf(parentElem.children, elem), 0, itemConfig);
7624
+ }
7625
+ $xeCarousel.reactData.staticItems = staticItems.slice(0);
7626
+ }
7627
+ function destroyCarouselItem($xeCarousel, itemConfig) {
7628
+ const staticItems = $xeCarousel.reactData.staticItems;
7629
+ const index = XEUtils.findIndexOf(staticItems, item => item.id === itemConfig.id);
7630
+ if (index > -1) {
7631
+ staticItems.splice(index, 1);
7632
+ }
7633
+ $xeCarousel.reactData.staticItems = staticItems.slice(0);
7634
+ }
7635
+
7636
+ var VxeCarouselItemComponent = defineVxeComponent({
7637
+ name: 'VxeCarouselItem',
7638
+ props: {
7639
+ name: [String, Number],
7640
+ className: String,
7641
+ url: String
7642
+ },
7643
+ emits: [],
7644
+ setup(props, context) {
7645
+ const { slots, emit } = context;
7646
+ const $xeCarousel = inject('$xeCarousel', null);
7647
+ const xID = XEUtils.uniqueId();
7648
+ const refElem = ref();
7649
+ const reactData = reactive({});
7650
+ const itemConfig = reactive({
7651
+ id: xID,
7652
+ name: props.name,
7653
+ url: props.url,
7654
+ className: props.className,
7655
+ slots
7656
+ });
7657
+ const refMaps = {
7658
+ refElem
7659
+ };
7660
+ const computeMaps = {};
7661
+ const $xeCarouselItem = {
7662
+ xID,
7663
+ props,
7664
+ context,
7665
+ reactData,
7666
+ getRefMaps: () => refMaps,
7667
+ getComputeMaps: () => computeMaps
7668
+ };
7669
+ const dispatchEvent = (type, params, evnt) => {
7670
+ emit(type, createEvent$1(evnt, { $carouselItem: $xeCarouselItem }, params));
7671
+ };
7672
+ const carouselItemMethods = {
7673
+ dispatchEvent
7674
+ };
7675
+ const carouselItemPrivateMethods = {};
7676
+ Object.assign($xeCarouselItem, carouselItemMethods, carouselItemPrivateMethods);
7677
+ const renderVN = () => {
7678
+ return h('div', {
7679
+ ref: refElem
7680
+ });
7681
+ };
7682
+ watch(() => props.name, (val) => {
7683
+ itemConfig.name = val;
7684
+ });
7685
+ watch(() => props.url, (val) => {
7686
+ itemConfig.url = val;
7687
+ });
7688
+ onMounted(() => {
7689
+ const elem = refElem.value;
7690
+ if ($xeCarousel && elem) {
7691
+ assembleCarouselItem($xeCarousel, elem, itemConfig);
7692
+ }
7693
+ });
7694
+ onUnmounted(() => {
7695
+ if ($xeCarousel) {
7696
+ destroyCarouselItem($xeCarousel, itemConfig);
7697
+ }
7698
+ });
7699
+ $xeCarouselItem.renderVN = renderVN;
7700
+ return $xeCarouselItem;
7701
+ },
7702
+ render() {
7703
+ return this.renderVN();
7704
+ }
7705
+ });
7706
+
7707
+ const VxeCarouselItem = Object.assign({}, VxeCarouselItemComponent, {
7708
+ install(app) {
7709
+ app.component(VxeCarouselItemComponent.name, VxeCarouselItemComponent);
7710
+ }
7711
+ });
7712
+ dynamicApp.use(VxeCarouselItem);
7713
+ VxeUI.component(VxeCarouselItemComponent);
7714
+ const CarouselItem = VxeCarouselItem;
7715
+
7716
+ function enNodeValue(nodeid) {
7717
+ return XEUtils.eqNull(nodeid) ? '' : encodeURIComponent(`${nodeid}`);
7718
+ }
7719
+ function deNodeValue(nodeid) {
7720
+ return nodeid ? decodeURIComponent(`${nodeid}`) : nodeid;
7721
+ }
7722
+
7723
+ // 跨列表拖拽
7724
+ const crossListDragRowInfo = reactive({
7725
+ row: null
7726
+ });
7727
+ function getCrossListDragRowInfo() {
7728
+ return crossListDragRowInfo;
7729
+ }
7730
+
7731
+ const rowMoveCls = 'row--drag-move';
7732
+ /**
7733
+ * 上下拖拽
7734
+ */
7735
+ function moveRowAnimateToTb(elemList, offsetTop) {
7736
+ XEUtils.arrayEach(elemList, trEl => {
7737
+ trEl.style.transform = `translateY(${offsetTop}px)`;
7738
+ });
7739
+ requestAnimationFrame(() => {
7740
+ XEUtils.arrayEach(elemList, trEl => {
7741
+ addClass(trEl, rowMoveCls);
7742
+ trEl.style.transform = '';
7743
+ });
7744
+ });
7745
+ }
7746
+ function clearRowAnimate(elem, clss) {
7747
+ setTimeout(() => {
7748
+ if (elem) {
7749
+ XEUtils.arrayEach(elem.querySelectorAll(clss.map(cls => `${cls}.${rowMoveCls}`).join(',')), elem => removeClass(elem, rowMoveCls));
7750
+ }
7751
+ }, 500);
7752
+ }
7753
+
7754
+ function getItemCacheObj$1(item) {
7755
+ return {
7756
+ item,
7757
+ index: -1,
7758
+ $index: -1,
7759
+ _index: -1
7760
+ };
7761
+ }
7762
+
7763
+ const { warnLog: warnLog$h, errLog: errLog$j } = createComponentLog('tree');
7764
+ function getRowKeyByField(row, keyField) {
7765
+ return row ? ('' + (row[keyField] || '')) : '';
7766
+ }
7767
+ function getRowIdByField(row, keyField) {
7768
+ if (!row) {
7769
+ return '';
7770
+ }
7771
+ const rowKey = getRowKeyByField(row, keyField);
7772
+ return enModelValue(rowKey);
7773
+ }
7774
+ function createReactData$m() {
7775
+ return {
7776
+ scrollYLoad: false,
7777
+ bodyHeight: 0,
7778
+ headHeight: 0,
7779
+ footHeight: 0,
7780
+ customHeight: 0,
7781
+ customMaxHeight: 0,
7782
+ parentHeight: 0,
7783
+ topSpaceHeight: 0,
7784
+ rowList: [],
7785
+ selectRadioRow: null,
7786
+ currRowFlag: 1,
7787
+ updateCheckboxFlag: 1,
7788
+ isAllChecked: false,
7789
+ isAllIndeterminate: false,
7790
+ insertRowFlag: 1,
7791
+ removeRowFlag: 1,
7792
+ dragRow: null,
7793
+ dragTipText: '',
7794
+ isCrossDragRow: false
7795
+ };
7796
+ }
7797
+ function createInternalData$l() {
7798
+ return {
7799
+ resizeObserver: undefined,
7800
+ fullData: [],
7801
+ afterList: [],
7802
+ fullKeyMaps: {},
7803
+ rowMaps: {},
7804
+ lastScrollLeft: 0,
7805
+ lastScrollTop: 0,
7806
+ scrollYStore: {
7807
+ startIndex: 0,
7808
+ endIndex: 0,
7809
+ visibleSize: 0,
7810
+ offsetSize: 0,
7811
+ rowHeight: 0
7812
+ },
7813
+ currentRow: null,
7814
+ selectCheckboxMaps: {},
7815
+ insertRowMaps: {},
7816
+ removeRowMaps: {}
7817
+ // prevDragRow: null,
7818
+ // prevDragPos: ''
7819
+ };
7820
+ }
7821
+ let crossListDragRowObj = null;
7822
+ var VxeListComponent = defineVxeComponent({
7823
+ name: 'VxeList',
7824
+ props: {
7825
+ data: Array,
7826
+ height: [Number, String],
7827
+ maxHeight: [Number, String],
7828
+ loading: Boolean,
7829
+ className: [String, Function],
7830
+ size: {
7831
+ type: String,
7832
+ default: () => getConfig$4().list.size || getConfig$4().size
7833
+ },
7834
+ autoResize: {
7835
+ type: Boolean,
7836
+ default: () => getConfig$4().list.autoResize
7837
+ },
7838
+ syncResize: [Boolean, String, Number],
7839
+ showSeq: {
7840
+ type: Boolean,
7841
+ default: () => getConfig$4().list.showSeq
7842
+ },
7843
+ showRadio: {
7844
+ type: Boolean,
7845
+ default: () => getConfig$4().list.showRadio
7846
+ },
7847
+ checkRowKey: [String, Number],
7848
+ radioConfig: Object,
7849
+ showCheckbox: {
7850
+ type: Boolean,
7851
+ default: () => getConfig$4().list.showCheckbox
7852
+ },
7853
+ checkRowKeys: Array,
7854
+ checkboxConfig: Object,
7855
+ rowConfig: Object,
7856
+ dragConfig: Object,
7857
+ menuConfig: Object,
7858
+ virtualYConfig: Object,
7859
+ scrollY: Object
7860
+ },
7861
+ emits: [
7862
+ 'update:checkRowKey',
7863
+ 'update:checkRowKeys',
7864
+ 'row-click',
7865
+ 'row-dblclick',
7866
+ 'current-change',
7867
+ 'radio-change',
7868
+ 'checkbox-change',
7869
+ 'checkbox-all',
7870
+ 'scroll',
7871
+ 'row-dragstart',
7872
+ 'row-dragover',
7873
+ 'row-dragend',
7874
+ 'row-remove-dragend',
7875
+ 'row-insert-dragend',
7876
+ 'row-menu',
7877
+ 'menu-click'
7878
+ ],
7879
+ setup(props, context) {
7880
+ const { slots, emit } = context;
7881
+ const xID = XEUtils.uniqueId();
7882
+ const browseObj = XEUtils.browse();
7883
+ const { computeSize } = useSize(props);
7884
+ const reactData = reactive(createReactData$m());
7885
+ const internalData = createInternalData$l();
7886
+ const crossListDragRowInfo = getCrossListDragRowInfo();
7887
+ const refElem = ref();
7888
+ const refHeaderElem = ref();
7889
+ const refFooterElem = ref();
7890
+ const refVirtualWrapper = ref();
7891
+ const refVirtualBody = ref();
7892
+ const refDragRowLineElem = ref();
7893
+ const refDragTipElem = ref();
7894
+ const refMaps = {
7895
+ refElem
7896
+ };
7897
+ const $xeList = {
7898
+ xID,
7899
+ props,
7900
+ context,
7901
+ reactData,
7902
+ internalData,
7903
+ getRefMaps: () => refMaps
7904
+ };
7905
+ const computeRowOpts = computed(() => {
7906
+ return Object.assign({}, getConfig$4().list.rowConfig, props.rowConfig);
7907
+ });
7908
+ const computeDragOpts = computed(() => {
7909
+ return Object.assign({}, getConfig$4().list.dragConfig, props.dragConfig);
7910
+ });
7911
+ const computeSYOpts = computed(() => {
7912
+ return Object.assign({}, getConfig$4().list.virtualYConfig || getConfig$4().list.scrollY, props.virtualYConfig || props.scrollY);
7913
+ });
7914
+ const computeKeyField = computed(() => {
7915
+ const rowOpts = computeRowOpts.value;
7916
+ const { keyField } = rowOpts;
7917
+ return keyField || '';
7918
+ });
7919
+ const computeIsDrag = computed(() => {
7920
+ const { dragConfig } = props;
7921
+ const dragOpts = computeDragOpts.value;
7922
+ return dragConfig && isEnableConf(dragOpts);
7923
+ });
7924
+ const computeRowHeight = computed(() => {
7925
+ const rowOpts = computeRowOpts.value;
7926
+ const { height } = rowOpts;
7927
+ return height;
7928
+ });
7929
+ const computeRadioOpts = computed(() => {
7930
+ return Object.assign({ showIcon: true }, getConfig$4().list.radioConfig, props.radioConfig);
7931
+ });
7932
+ const computeCheckboxOpts = computed(() => {
7933
+ return Object.assign({ showIcon: true }, getConfig$4().list.checkboxConfig, props.checkboxConfig);
7934
+ });
7935
+ const computeMenuOpts = computed(() => {
7936
+ return Object.assign({}, getConfig$4().list.menuConfig, props.menuConfig);
7937
+ });
7938
+ const computeWrapperStyles = computed(() => {
7939
+ const rowHeight = computeRowHeight.value;
7940
+ const style = {};
7941
+ if (rowHeight) {
7942
+ style['--vxe-ui-list-row-height'] = toCssUnit(rowHeight);
7943
+ }
7944
+ return style;
7945
+ });
7946
+ const computeVirtualStyles = computed(() => {
7947
+ const { height, maxHeight } = props;
7948
+ const { customHeight, customMaxHeight, headHeight, footHeight } = reactData;
7949
+ const style = {};
7950
+ if (height) {
7951
+ style.height = toCssUnit(Math.max(20, customHeight - headHeight - footHeight));
7952
+ }
7953
+ else if (maxHeight) {
7954
+ style.height = 'auto';
7955
+ style.maxHeight = toCssUnit(Math.max(20, customMaxHeight - headHeight - footHeight));
7956
+ }
7957
+ return style;
7958
+ });
7959
+ const dispatchEvent = (type, params, evnt) => {
7960
+ emit(type, createEvent$1(evnt, { $list: $xeList }, params));
7961
+ };
7962
+ const emitCheckboxMode = (value) => {
7963
+ emit('update:checkRowKeys', value);
7964
+ };
7965
+ const emitRadioMode = (value) => {
7966
+ emit('update:checkRowKey', value);
7967
+ };
7968
+ const getRowId = (row) => {
7969
+ const keyField = computeKeyField.value;
7970
+ return getRowIdByField(row, keyField);
7971
+ };
7972
+ const calcTableHeight = (key) => {
7973
+ const { parentHeight } = reactData;
7974
+ const val = props[key];
7975
+ let num = 0;
7976
+ if (val) {
7977
+ if (val === '100%' || val === 'auto') {
7978
+ num = parentHeight;
7979
+ }
7980
+ else {
7981
+ if (isScale(val)) {
7982
+ num = Math.floor((XEUtils.toInteger(val) || 1) / 100 * parentHeight);
7983
+ }
7984
+ else {
7985
+ num = XEUtils.toNumber(val);
7986
+ }
7987
+ num = Math.max(40, num);
7307
7988
  }
7308
7989
  }
7309
7990
  return num;
@@ -7445,8 +8126,12 @@ var VxeListComponent = defineVxeComponent({
7445
8126
  const recalculate = () => {
7446
8127
  const el = refElem.value;
7447
8128
  if (el) {
7448
- const parentEl = el.parentElement;
8129
+ let parentEl = el.parentElement;
7449
8130
  let parentHeight = 0;
8131
+ // 如果是虚拟滚动条
8132
+ if (parentEl && hasClass(parentEl, 'vxe-scrollbar--view-inner')) {
8133
+ parentEl = parentEl.parentElement;
8134
+ }
7450
8135
  if (parentEl) {
7451
8136
  const parentStyle = getComputedStyle(parentEl);
7452
8137
  parentHeight = parentEl.clientHeight - Math.ceil(XEUtils.toNumber(parentStyle.paddingLeft) + XEUtils.toNumber(parentStyle.paddingRight));
@@ -9164,8 +9849,8 @@ var VxeListComponent = defineVxeComponent({
9164
9849
  resizeObserver.disconnect();
9165
9850
  }
9166
9851
  globalEvents$1.off($xeList, 'resize');
9167
- XEUtils.assign(reactData, createReactData$n());
9168
- XEUtils.assign(internalData, createInternalData$m());
9852
+ XEUtils.assign(reactData, createReactData$m());
9853
+ XEUtils.assign(internalData, createInternalData$l());
9169
9854
  });
9170
9855
  $xeList.renderVN = renderVN;
9171
9856
  return $xeList;
@@ -11965,7 +12650,7 @@ const Input = VxeInput;
11965
12650
  function getNodeUniqueId$1() {
11966
12651
  return XEUtils.uniqueId('node_');
11967
12652
  }
11968
- function createReactData$m() {
12653
+ function createReactData$l() {
11969
12654
  return {
11970
12655
  initialized: false,
11971
12656
  searchValue: '',
@@ -11988,7 +12673,7 @@ function createReactData$m() {
11988
12673
  lazyOptFlag: 1
11989
12674
  };
11990
12675
  }
11991
- function createInternalData$l() {
12676
+ function createInternalData$k() {
11992
12677
  return {
11993
12678
  // hpTimeout: undefined,
11994
12679
  listVirtualYOpts: {
@@ -12116,8 +12801,8 @@ var VxeCascaderComponent = defineVxeComponent({
12116
12801
  const refInpSearch = ref();
12117
12802
  const refChunkWrapper = ref();
12118
12803
  const refOptionPanel = ref();
12119
- const reactData = reactive(createReactData$m());
12120
- const internalData = createInternalData$l();
12804
+ const reactData = reactive(createReactData$l());
12805
+ const internalData = createInternalData$k();
12121
12806
  const refMaps = {
12122
12807
  refElem
12123
12808
  };
@@ -13718,8 +14403,8 @@ var VxeCascaderComponent = defineVxeComponent({
13718
14403
  globalEvents$1.off($xeCascader, 'blur');
13719
14404
  globalEvents$1.off($xeCascader, 'resize');
13720
14405
  globalEvents$1.off($xeCascader, 'scroll');
13721
- XEUtils.assign(reactData, createReactData$m());
13722
- XEUtils.assign(internalData, createInternalData$l());
14406
+ XEUtils.assign(reactData, createReactData$l());
14407
+ XEUtils.assign(internalData, createInternalData$k());
13723
14408
  });
13724
14409
  provide('$xeCascader', $xeCascader);
13725
14410
  $xeCascader.renderVN = renderVN;
@@ -14123,10 +14808,10 @@ dynamicApp.use(VxeCheckboxButton);
14123
14808
  VxeUI.component(VxeCheckboxButtonComponent);
14124
14809
  const CheckboxButton = VxeCheckboxButton;
14125
14810
 
14126
- function createReactData$l() {
14811
+ function createReactData$k() {
14127
14812
  return {};
14128
14813
  }
14129
- function createInternalData$k() {
14814
+ function createInternalData$j() {
14130
14815
  return {
14131
14816
  // isLoaded: false
14132
14817
  };
@@ -14170,8 +14855,8 @@ var VxeCheckboxGroupComponent = defineVxeComponent({
14170
14855
  const $xeForm = inject('$xeForm', null);
14171
14856
  const formItemInfo = inject('xeFormItemInfo', null);
14172
14857
  const xID = XEUtils.uniqueId();
14173
- const reactData = reactive(createReactData$l());
14174
- const internalData = createInternalData$k();
14858
+ const reactData = reactive(createReactData$k());
14859
+ const internalData = createInternalData$j();
14175
14860
  const computeIsReadonly = computed(() => {
14176
14861
  const { readonly } = props;
14177
14862
  if (readonly === null) {
@@ -14344,8 +15029,8 @@ var VxeCheckboxGroupComponent = defineVxeComponent({
14344
15029
  });
14345
15030
  });
14346
15031
  onUnmounted(() => {
14347
- XEUtils.assign(reactData, createReactData$l());
14348
- XEUtils.assign(internalData, createInternalData$k());
15032
+ XEUtils.assign(reactData, createReactData$k());
15033
+ XEUtils.assign(internalData, createInternalData$j());
14349
15034
  });
14350
15035
  provide('$xeCheckboxGroup', $xeCheckboxGroup);
14351
15036
  $xeCheckboxGroup.renderVN = renderVN;
@@ -14498,7 +15183,7 @@ dynamicApp.use(VxeCol);
14498
15183
  VxeUI.component(VxeColComponent);
14499
15184
  const Col = VxeCol;
14500
15185
 
14501
- function createReactData$k() {
15186
+ function createReactData$j() {
14502
15187
  return {
14503
15188
  staticPanes: [],
14504
15189
  cachePaneMaps: {},
@@ -14506,7 +15191,7 @@ function createReactData$k() {
14506
15191
  openKeyFlag: 0
14507
15192
  };
14508
15193
  }
14509
- function createInternalData$j() {
15194
+ function createInternalData$i() {
14510
15195
  return {
14511
15196
  // esTime: null,
14512
15197
  activeKeyMaps: {},
@@ -14543,8 +15228,8 @@ var VxeCollapseComponent = defineVxeComponent({
14543
15228
  const xID = XEUtils.uniqueId();
14544
15229
  const { computeSize } = useSize(props);
14545
15230
  const refElem = ref();
14546
- const reactData = reactive(createReactData$k());
14547
- const internalData = createInternalData$j();
15231
+ const reactData = reactive(createReactData$j());
15232
+ const internalData = createInternalData$i();
14548
15233
  const refMaps = {
14549
15234
  refElem
14550
15235
  };
@@ -14823,8 +15508,8 @@ var VxeCollapseComponent = defineVxeComponent({
14823
15508
  if (esTime) {
14824
15509
  clearTimeout(esTime);
14825
15510
  }
14826
- XEUtils.assign(reactData, createReactData$k());
14827
- XEUtils.assign(internalData, createInternalData$j());
15511
+ XEUtils.assign(reactData, createReactData$j());
15512
+ XEUtils.assign(internalData, createInternalData$i());
14828
15513
  });
14829
15514
  provide('$xeCollapse', $xeCollapse);
14830
15515
  $xeCollapse.renderVN = renderVN;
@@ -17606,12 +18291,12 @@ VxeUI.color = {
17606
18291
  };
17607
18292
  const ColorPicker = VxeColorPicker;
17608
18293
 
17609
- function createInternalData$i() {
18294
+ function createInternalData$h() {
17610
18295
  return {
17611
18296
  // leaveTime: null
17612
18297
  };
17613
18298
  }
17614
- function createReactData$j() {
18299
+ function createReactData$i() {
17615
18300
  return {
17616
18301
  visible: false,
17617
18302
  activeOption: null,
@@ -17666,8 +18351,8 @@ var VxeContextMenuComponent = defineVxeComponent({
17666
18351
  const xID = XEUtils.uniqueId();
17667
18352
  const refElem = ref();
17668
18353
  const { computeSize } = useSize(props);
17669
- const internalData = createInternalData$i();
17670
- const reactData = reactive(createReactData$j());
18354
+ const internalData = createInternalData$h();
18355
+ const reactData = reactive(createReactData$i());
17671
18356
  const refMaps = {
17672
18357
  refElem
17673
18358
  };
@@ -18222,8 +18907,8 @@ var VxeContextMenuComponent = defineVxeComponent({
18222
18907
  globalEvents$1.off($xeContextMenu, 'keydown');
18223
18908
  globalEvents$1.off($xeContextMenu, 'mousedown');
18224
18909
  globalEvents$1.off($xeContextMenu, 'blur');
18225
- XEUtils.assign(reactData, createReactData$j());
18226
- XEUtils.assign(internalData, createInternalData$i());
18910
+ XEUtils.assign(reactData, createReactData$i());
18911
+ XEUtils.assign(internalData, createInternalData$h());
18227
18912
  });
18228
18913
  $xeContextMenu.renderVN = renderVN;
18229
18914
  return $xeContextMenu;
@@ -20553,7 +21238,7 @@ const parseInputKayMaps = {};
20553
21238
  inputMaskedKeys.forEach(key => {
20554
21239
  parseInputKayMaps[key] = true;
20555
21240
  });
20556
- function createReactData$i() {
21241
+ function createReactData$h() {
20557
21242
  return {
20558
21243
  initialized: false,
20559
21244
  panelIndex: 0,
@@ -20566,7 +21251,7 @@ function createReactData$i() {
20566
21251
  labelFlag: 0
20567
21252
  };
20568
21253
  }
20569
- function createInternalData$h() {
21254
+ function createInternalData$g() {
20570
21255
  return {
20571
21256
  // hpTimeout: undefined,
20572
21257
  // fsTimeout: undefined,
@@ -20718,8 +21403,8 @@ var VxeDatePickerComponent = defineVxeComponent({
20718
21403
  const formItemInfo = inject('xeFormItemInfo', null);
20719
21404
  const xID = XEUtils.uniqueId();
20720
21405
  const { computeSize } = useSize(props);
20721
- const reactData = reactive(createReactData$i());
20722
- const internalData = createInternalData$h();
21406
+ const reactData = reactive(createReactData$h());
21407
+ const internalData = createInternalData$g();
20723
21408
  const defaultFuncProps = {
20724
21409
  parseInputMethod: getConfig$4().datePicker.parseInputMethod,
20725
21410
  festivalMethod: getConfig$4().datePicker.festivalMethod,
@@ -22173,8 +22858,8 @@ var VxeDatePickerComponent = defineVxeComponent({
22173
22858
  globalEvents$1.off($xeDatePicker, 'blur');
22174
22859
  globalEvents$1.off($xeDatePicker, 'resize');
22175
22860
  globalEvents$1.off($xeDatePicker, 'scroll');
22176
- XEUtils.assign(reactData, createReactData$i());
22177
- XEUtils.assign(internalData, createInternalData$h());
22861
+ XEUtils.assign(reactData, createReactData$h());
22862
+ XEUtils.assign(internalData, createInternalData$g());
22178
22863
  });
22179
22864
  provide('$xeDatePicker', $xeDatePicker);
22180
22865
  $xeDatePicker.renderVN = renderVN;
@@ -22195,7 +22880,7 @@ VxeUI.component(VxeDatePickerComponent);
22195
22880
  const DatePicker = VxeDatePicker;
22196
22881
 
22197
22882
  const { errLog: errLog$e } = createComponentLog('date-range-picker');
22198
- function createReactData$h() {
22883
+ function createReactData$g() {
22199
22884
  return {
22200
22885
  initialized: false,
22201
22886
  panelIndex: 0,
@@ -22210,7 +22895,7 @@ function createReactData$h() {
22210
22895
  paneEndVal: []
22211
22896
  };
22212
22897
  }
22213
- function createInternalData$g() {
22898
+ function createInternalData$f() {
22214
22899
  return {
22215
22900
  // selectStatus: false
22216
22901
  // hpTimeout: undefined
@@ -22360,8 +23045,8 @@ var VxeDateRangePickerComponent = defineVxeComponent({
22360
23045
  const formItemInfo = inject('xeFormItemInfo', null);
22361
23046
  const xID = XEUtils.uniqueId();
22362
23047
  const { computeSize } = useSize(props);
22363
- const reactData = reactive(createReactData$h());
22364
- const internalData = createInternalData$g();
23048
+ const reactData = reactive(createReactData$g());
23049
+ const internalData = createInternalData$f();
22365
23050
  const defaultFuncProps = {
22366
23051
  festivalMethod: getConfig$4().dateRangePicker.festivalMethod,
22367
23052
  disabledMethod: getConfig$4().dateRangePicker.disabledMethod
@@ -23692,8 +24377,8 @@ var VxeDateRangePickerComponent = defineVxeComponent({
23692
24377
  globalEvents$1.off($xeDateRangePicker, 'blur');
23693
24378
  globalEvents$1.off($xeDateRangePicker, 'resize');
23694
24379
  globalEvents$1.off($xeDateRangePicker, 'scroll');
23695
- XEUtils.assign(reactData, createReactData$h());
23696
- XEUtils.assign(internalData, createInternalData$g());
24380
+ XEUtils.assign(reactData, createReactData$g());
24381
+ XEUtils.assign(internalData, createInternalData$f());
23697
24382
  });
23698
24383
  provide('$xeDateRangePicker', $xeDateRangePicker);
23699
24384
  $xeDateRangePicker.renderVN = renderVN;
@@ -26017,7 +26702,7 @@ function checkRuleStatus(rule, data, val) {
26017
26702
  }
26018
26703
  return true;
26019
26704
  }
26020
- function createReactData$g() {
26705
+ function createReactData$f() {
26021
26706
  return {
26022
26707
  collapseAll: false,
26023
26708
  staticItems: [],
@@ -26025,7 +26710,7 @@ function createReactData$g() {
26025
26710
  itemWidth: 0
26026
26711
  };
26027
26712
  }
26028
- function createInternalData$f() {
26713
+ function createInternalData$e() {
26029
26714
  return {
26030
26715
  meTimeout: undefined,
26031
26716
  stTimeout: undefined,
@@ -26135,8 +26820,8 @@ var VxeFormComponent = defineVxeComponent({
26135
26820
  const $xeGrid = inject('$xeGrid', null);
26136
26821
  const xID = XEUtils.uniqueId();
26137
26822
  const { computeSize } = useSize(props);
26138
- const reactData = reactive(createReactData$g());
26139
- const internalData = createInternalData$f();
26823
+ const reactData = reactive(createReactData$f());
26824
+ const internalData = createInternalData$e();
26140
26825
  const refElem = ref();
26141
26826
  const refTooltip = ref();
26142
26827
  const computeValidOpts = computed(() => {
@@ -26860,8 +27545,8 @@ var VxeFormComponent = defineVxeComponent({
26860
27545
  });
26861
27546
  onUnmounted(() => {
26862
27547
  globalEvents$1.off($xeForm, 'resize');
26863
- XEUtils.assign(reactData, createReactData$g());
26864
- XEUtils.assign(internalData, createInternalData$f());
27548
+ XEUtils.assign(reactData, createReactData$f());
27549
+ XEUtils.assign(internalData, createInternalData$e());
26865
27550
  });
26866
27551
  reactData.collapseAll = !!props.collapseStatus;
26867
27552
  if (props.items) {
@@ -26988,7 +27673,7 @@ dynamicApp.use(VxeFormItem);
26988
27673
  VxeUI.component(VxeFormItemComponent);
26989
27674
  const FormItem = VxeFormItem;
26990
27675
 
26991
- function createReactData$f() {
27676
+ function createReactData$e() {
26992
27677
  return {
26993
27678
  initialized: false,
26994
27679
  selectIcon: '',
@@ -27002,7 +27687,7 @@ function createReactData$f() {
27002
27687
  iconList: []
27003
27688
  };
27004
27689
  }
27005
- function createInternalData$e() {
27690
+ function createInternalData$d() {
27006
27691
  return {
27007
27692
  fullList: []
27008
27693
  // hpTimeout: undefined
@@ -27065,8 +27750,8 @@ var VxeIconPickerComponent = defineVxeComponent({
27065
27750
  const formItemInfo = inject('xeFormItemInfo', null);
27066
27751
  const xID = XEUtils.uniqueId();
27067
27752
  const { computeSize } = useSize(props);
27068
- const reactData = reactive(createReactData$f());
27069
- const internalData = createInternalData$e();
27753
+ const reactData = reactive(createReactData$e());
27754
+ const internalData = createInternalData$d();
27070
27755
  const refElem = ref();
27071
27756
  const refInput = ref();
27072
27757
  const refOptionPanel = ref();
@@ -27676,8 +28361,8 @@ var VxeIconPickerComponent = defineVxeComponent({
27676
28361
  globalEvents$1.off($xeIconPicker, 'blur');
27677
28362
  globalEvents$1.off($xeIconPicker, 'resize');
27678
28363
  globalEvents$1.off($xeIconPicker, 'scroll');
27679
- XEUtils.assign(reactData, createReactData$f());
27680
- XEUtils.assign(internalData, createInternalData$e());
28364
+ XEUtils.assign(reactData, createReactData$e());
28365
+ XEUtils.assign(internalData, createInternalData$d());
27681
28366
  });
27682
28367
  provide('$xeIconPicker', $xeIconPicker);
27683
28368
  $xeIconPicker.renderVN = renderVN;
@@ -28342,1115 +29027,464 @@ const openPreviewImage = (options) => {
28342
29027
  height: '100%',
28343
29028
  showHeader: false,
28344
29029
  showFooter: false,
28345
- padding: false,
28346
- escClosable: opts.escClosable,
28347
- zIndex,
28348
- className: 'vxe-image-preview-popup-wrapper',
28349
- slots: {
28350
- default() {
28351
- return h(VxeImagePreviewComponent, {
28352
- modelValue: activeIndex,
28353
- urlList,
28354
- urlField: opts.urlField,
28355
- marginSize: opts.marginSize,
28356
- maskClosable: opts.maskClosable,
28357
- toolbarConfig: opts.toolbarConfig,
28358
- showPrintButton: opts.showPrintButton,
28359
- showDownloadButton: opts.showDownloadButton,
28360
- beforeDownloadMethod: opts.beforeDownloadMethod,
28361
- downloadMethod: opts.downloadMethod,
28362
- onClose() {
28363
- VxeUI.modal.close(modalId);
28364
- },
28365
- onChange(eventParams) {
28366
- if (change) {
28367
- change.call(this, eventParams);
28368
- }
28369
- },
28370
- onRotate(eventParams) {
28371
- if (rotate) {
28372
- rotate.call(this, eventParams);
28373
- }
28374
- }
28375
- });
28376
- }
28377
- }
28378
- });
28379
- }
28380
- return Promise.resolve();
28381
- };
28382
-
28383
- function createInternalData$d() {
28384
- return {
28385
- // dgTime: 0,
28386
- // mdTime: 0
28387
- };
28388
- }
28389
- function createReactData$e() {
28390
- return {};
28391
- }
28392
- var VxeImageComponent = defineVxeComponent({
28393
- name: 'VxeImage',
28394
- props: {
28395
- src: [String, Array],
28396
- alt: [String, Number],
28397
- loading: String,
28398
- title: [String, Number],
28399
- width: [String, Number],
28400
- height: [String, Number],
28401
- minWidth: [String, Number],
28402
- minHeight: [String, Number],
28403
- maxWidth: [String, Number],
28404
- maxHeight: [String, Number],
28405
- circle: Boolean,
28406
- draggable: {
28407
- type: Boolean,
28408
- default: () => getConfig$4().image.draggable
28409
- },
28410
- zIndex: Number,
28411
- maskClosable: {
28412
- type: Boolean,
28413
- default: () => getConfig$4().image.maskClosable
28414
- },
28415
- toolbarConfig: Object,
28416
- showPreview: {
28417
- type: Boolean,
28418
- default: () => getConfig$4().image.showPreview
28419
- },
28420
- showPrintButton: {
28421
- type: Boolean,
28422
- default: () => getConfig$4().image.showPrintButton
28423
- },
28424
- showDownloadButton: {
28425
- type: Boolean,
28426
- default: () => getConfig$4().image.showDownloadButton
28427
- },
28428
- size: {
28429
- type: String,
28430
- default: () => getConfig$4().image.size || getConfig$4().size
28431
- },
28432
- getThumbnailUrlMethod: Function
28433
- },
28434
- emits: [
28435
- 'click',
28436
- 'change',
28437
- 'rotate',
28438
- 'dragstart',
28439
- 'drag',
28440
- 'dragend'
28441
- ],
28442
- setup(props, context) {
28443
- const { emit } = context;
28444
- const xID = XEUtils.uniqueId();
28445
- const $xeImageGroup = inject('$xeImageGroup', null);
28446
- const refElem = ref();
28447
- const { computeSize } = useSize(props);
28448
- const internalData = createInternalData$d();
28449
- const reactData = reactive(createReactData$e());
28450
- const refMaps = {
28451
- refElem
28452
- };
28453
- const computeWrapperStyle = computed(() => {
28454
- const { width, height, circle } = props;
28455
- const stys = {};
28456
- if (circle) {
28457
- // 圆形只能生效一个
28458
- if (width) {
28459
- stys.width = toCssUnit(width);
28460
- stys.height = toCssUnit(width);
28461
- }
28462
- else if (height) {
28463
- stys.width = toCssUnit(height);
28464
- stys.height = toCssUnit(height);
28465
- }
28466
- }
28467
- else {
28468
- if (width) {
28469
- stys.width = toCssUnit(width);
28470
- }
28471
- if (height) {
28472
- stys.height = toCssUnit(height);
28473
- }
28474
- }
28475
- return stys;
28476
- });
28477
- const computeImgStyle = computed(() => {
28478
- const { width, height, minWidth, minHeight, maxHeight, maxWidth } = props;
28479
- const stys = {};
28480
- if (width && height) {
28481
- stys.maxWidth = toCssUnit(width);
28482
- stys.maxHeight = toCssUnit(height);
28483
- }
28484
- else {
28485
- if (width) {
28486
- stys.width = toCssUnit(width);
28487
- }
28488
- if (height) {
28489
- stys.height = toCssUnit(height);
28490
- }
28491
- if (minWidth) {
28492
- stys.minWidth = toCssUnit(minWidth);
28493
- }
28494
- if (minHeight) {
28495
- stys.minHeight = toCssUnit(minHeight);
28496
- }
28497
- if (maxWidth) {
28498
- stys.maxWidth = toCssUnit(maxWidth);
28499
- }
28500
- if (maxHeight) {
28501
- stys.maxHeight = toCssUnit(maxHeight);
28502
- }
28503
- }
28504
- return stys;
28505
- });
28506
- const computeImgList = computed(() => {
28507
- const { src } = props;
28508
- if (src) {
28509
- return (XEUtils.isArray(src) ? src : [src]).map(item => {
28510
- if (XEUtils.isString(item)) {
28511
- return {
28512
- url: item,
28513
- alt: ''
28514
- };
28515
- }
28516
- return {
28517
- url: item.url,
28518
- alt: item.alt
28519
- };
28520
- });
28521
- }
28522
- return [];
28523
- });
28524
- const computeImgItem = computed(() => {
28525
- const imgList = computeImgList.value;
28526
- return imgList[0];
28527
- });
28528
- const computeImgUrl = computed(() => {
28529
- const imgItem = computeImgItem.value;
28530
- return imgItem ? `${imgItem.url || ''}` : '';
28531
- });
28532
- const computeImgThumbnailUrl = computed(() => {
28533
- const getThumbnailUrlFn = props.getThumbnailUrlMethod || getConfig$4().image.getThumbnailUrlMethod;
28534
- const imgUrl = computeImgUrl.value;
28535
- return getThumbnailUrlFn ? getThumbnailUrlFn({ url: imgUrl, $image: $xeImage }) : '';
28536
- });
28537
- const computeMaps = {
28538
- computeSize
28539
- };
28540
- const $xeImage = {
28541
- xID,
28542
- props,
28543
- context,
28544
- reactData,
28545
- internalData,
28546
- getRefMaps: () => refMaps,
28547
- getComputeMaps: () => computeMaps
28548
- };
28549
- const dispatchEvent = (type, params, evnt) => {
28550
- emit(type, createEvent$1(evnt, { $image: $xeImage }, params));
28551
- };
28552
- const imageMethods = {
28553
- dispatchEvent
28554
- };
28555
- const clickEvent = (evnt) => {
28556
- const { showPreview, toolbarConfig, showPrintButton, showDownloadButton, maskClosable, zIndex } = props;
28557
- const { mdTime, dgTime } = internalData;
28558
- if (mdTime && dgTime && dgTime > mdTime) {
28559
- return;
28560
- }
28561
- const imgList = computeImgList.value;
28562
- const imgUrl = computeImgUrl.value;
28563
- if ($xeImageGroup) {
28564
- $xeImageGroup.handleClickImgEvent(evnt, { url: imgUrl });
28565
- }
28566
- else {
28567
- if (showPreview && imgUrl) {
28568
- openPreviewImage({
28569
- urlList: imgList,
28570
- toolbarConfig,
28571
- showPrintButton,
28572
- showDownloadButton,
28573
- maskClosable,
28574
- zIndex,
28575
- events: {
28576
- change(eventParams) {
28577
- dispatchEvent('change', eventParams, eventParams.$event);
28578
- },
28579
- rotate(eventParams) {
28580
- dispatchEvent('rotate', eventParams, eventParams.$event);
28581
- }
28582
- }
28583
- });
28584
- }
28585
- dispatchEvent('click', { url: imgUrl }, evnt);
28586
- }
28587
- };
28588
- const mousedownEvent = () => {
28589
- internalData.mdTime = Date.now();
28590
- };
28591
- const handleDragstartEvent = (evnt) => {
28592
- internalData.dgTime = Date.now();
28593
- dispatchEvent('dragstart', {}, evnt);
28594
- };
28595
- const handleDragEvent = (evnt) => {
28596
- dispatchEvent(evnt.type, {}, evnt);
28597
- };
28598
- const imagePrivateMethods = {};
28599
- Object.assign($xeImage, imageMethods, imagePrivateMethods);
28600
- const renderVN = () => {
28601
- const { alt, loading, circle, draggable } = props;
28602
- const wrapperStyle = computeWrapperStyle.value;
28603
- const imgStyle = computeImgStyle.value;
28604
- const imgUrl = computeImgUrl.value;
28605
- const imgThumbnailUrl = computeImgThumbnailUrl.value;
28606
- const vSize = computeSize.value;
28607
- let imgDrag;
28608
- if (!XEUtils.eqNull(draggable)) {
28609
- imgDrag = !!(draggable === true || draggable === 'true');
28610
- }
28611
- return h('div', {
28612
- class: ['vxe-image', {
28613
- [`size--${vSize}`]: vSize,
28614
- 'is--circle': circle
28615
- }],
28616
- style: wrapperStyle
28617
- }, [
28618
- h('img', {
28619
- ref: refElem,
28620
- class: 'vxe-image-img',
28621
- src: imgThumbnailUrl || imgUrl,
28622
- alt,
28623
- loading,
28624
- draggable: imgDrag,
28625
- style: imgStyle,
28626
- onMousedown: mousedownEvent,
28627
- onClick: clickEvent,
28628
- onDragstart: handleDragstartEvent,
28629
- onDrag: handleDragEvent,
28630
- onDragend: handleDragEvent
28631
- })
28632
- ]);
28633
- };
28634
- onBeforeUnmount(() => {
28635
- XEUtils.assign(reactData, createReactData$e());
28636
- XEUtils.assign(internalData, createInternalData$d());
28637
- });
28638
- $xeImage.renderVN = renderVN;
28639
- return $xeImage;
28640
- },
28641
- render() {
28642
- return this.renderVN();
28643
- }
28644
- });
28645
-
28646
- const VxeImage = Object.assign({}, VxeImageComponent, {
28647
- install(app) {
28648
- app.component(VxeImageComponent.name, VxeImageComponent);
28649
- }
28650
- });
28651
- dynamicApp.use(VxeImage);
28652
- VxeUI.component(VxeImageComponent);
28653
- const Image$1 = VxeImage;
28654
-
28655
- var VxeImageGroupComponent = defineVxeComponent({
28656
- name: 'VxeImageGroup',
28657
- props: {
28658
- urlList: [Array, String],
28659
- showPreview: {
28660
- type: Boolean,
28661
- default: () => getConfig$4().imageGroup.showPreview
28662
- },
28663
- imageStyle: Object,
28664
- zIndex: Number,
28665
- size: {
28666
- type: String,
28667
- default: () => getConfig$4().imageGroup.size || getConfig$4().size
28668
- },
28669
- toolbarConfig: Object,
28670
- showPrintButton: {
28671
- type: Boolean,
28672
- default: () => getConfig$4().imageGroup.showPrintButton
28673
- },
28674
- showDownloadButton: {
28675
- type: Boolean,
28676
- default: () => getConfig$4().imageGroup.showDownloadButton
28677
- },
28678
- getThumbnailUrlMethod: Function
28679
- },
28680
- emits: [
28681
- 'click',
28682
- 'change',
28683
- 'rotate'
28684
- ],
28685
- setup(props, context) {
28686
- const { emit } = context;
28687
- const xID = XEUtils.uniqueId();
28688
- const { computeSize } = useSize(props);
28689
- const computeImgList = computed(() => {
28690
- const { urlList } = props;
28691
- if (urlList) {
28692
- return (XEUtils.isArray(urlList) ? urlList : [urlList]).map(item => {
28693
- if (XEUtils.isString(item)) {
28694
- return {
28695
- url: item,
28696
- alt: ''
28697
- };
28698
- }
28699
- return {
28700
- url: item.url,
28701
- alt: item.alt
28702
- };
28703
- });
28704
- }
28705
- return [];
28706
- });
28707
- const computeImgStyleOpts = computed(() => {
28708
- return Object.assign({}, getConfig$4().imageGroup.imageStyle, props.imageStyle);
28709
- });
28710
- const computeGetThumbnailUrlMethod = computed(() => {
28711
- return props.getThumbnailUrlMethod || getConfig$4().imageGroup.getThumbnailUrlMethod;
28712
- });
28713
- const computeMaps = {
28714
- computeSize
28715
- };
28716
- const $xeImageGroup = {
28717
- xID,
28718
- props,
28719
- context,
28720
- getComputeMaps: () => computeMaps
28721
- };
28722
- const imageGroupMethods = {
28723
- dispatchEvent(type, params, evnt) {
28724
- emit(type, createEvent$1(evnt, { $imageGroup: $xeImageGroup }, params));
28725
- }
28726
- };
28727
- const imageGroupPrivateMethods = {
28728
- handleClickImgEvent(evnt, params) {
28729
- const { showPreview, toolbarConfig, showPrintButton, showDownloadButton, zIndex } = props;
28730
- const { url } = params;
28731
- const imgList = computeImgList.value;
28732
- if (showPreview && url) {
28733
- openPreviewImage({
28734
- activeIndex: Math.max(0, XEUtils.findIndexOf(imgList, item => item.url === url)),
28735
- urlList: imgList,
28736
- toolbarConfig,
28737
- showPrintButton,
28738
- showDownloadButton,
28739
- zIndex,
28740
- events: {
28741
- change(eventParams) {
28742
- $xeImageGroup.dispatchEvent('change', eventParams, eventParams.$event);
28743
- },
28744
- rotate(eventParams) {
28745
- $xeImageGroup.dispatchEvent('rotate', eventParams, eventParams.$event);
29030
+ padding: false,
29031
+ escClosable: opts.escClosable,
29032
+ zIndex,
29033
+ className: 'vxe-image-preview-popup-wrapper',
29034
+ slots: {
29035
+ default() {
29036
+ return h(VxeImagePreviewComponent, {
29037
+ modelValue: activeIndex,
29038
+ urlList,
29039
+ urlField: opts.urlField,
29040
+ marginSize: opts.marginSize,
29041
+ maskClosable: opts.maskClosable,
29042
+ toolbarConfig: opts.toolbarConfig,
29043
+ showPrintButton: opts.showPrintButton,
29044
+ showDownloadButton: opts.showDownloadButton,
29045
+ beforeDownloadMethod: opts.beforeDownloadMethod,
29046
+ downloadMethod: opts.downloadMethod,
29047
+ onClose() {
29048
+ VxeUI.modal.close(modalId);
29049
+ },
29050
+ onChange(eventParams) {
29051
+ if (change) {
29052
+ change.call(this, eventParams);
29053
+ }
29054
+ },
29055
+ onRotate(eventParams) {
29056
+ if (rotate) {
29057
+ rotate.call(this, eventParams);
28746
29058
  }
28747
29059
  }
28748
29060
  });
28749
29061
  }
28750
- $xeImageGroup.dispatchEvent('click', { url, urlList: imgList }, evnt);
28751
29062
  }
28752
- };
28753
- Object.assign($xeImageGroup, imageGroupMethods, imageGroupPrivateMethods);
28754
- const renderVN = () => {
28755
- const imgList = computeImgList.value;
28756
- const vSize = computeSize.value;
28757
- const imgStyleOpts = computeImgStyleOpts.value;
28758
- const getThumbnailUrlMethod = computeGetThumbnailUrlMethod.value;
28759
- return h('div', {
28760
- class: ['vxe-image-group', {
28761
- [`size--${vSize}`]: vSize
28762
- }]
28763
- }, imgList
28764
- ? imgList.map((item, index) => {
28765
- return h(VxeImageComponent, {
28766
- key: index,
28767
- src: item.url,
28768
- alt: item.alt,
28769
- width: imgStyleOpts.width,
28770
- height: imgStyleOpts.height,
28771
- getThumbnailUrlMethod
28772
- });
28773
- })
28774
- : []);
28775
- };
28776
- $xeImageGroup.renderVN = renderVN;
28777
- provide('$xeImageGroup', $xeImageGroup);
28778
- return $xeImageGroup;
28779
- },
28780
- render() {
28781
- return this.renderVN();
28782
- }
28783
- });
28784
-
28785
- const VxeImageGroup = Object.assign({}, VxeImageGroupComponent, {
28786
- install(app) {
28787
- app.component(VxeImageGroupComponent.name, VxeImageGroupComponent);
28788
- }
28789
- });
28790
- dynamicApp.use(VxeImageGroup);
28791
- VxeUI.component(VxeImageGroupComponent);
28792
- const ImageGroup = VxeImageGroup;
28793
-
28794
- const VxeImagePreview = Object.assign(VxeImagePreviewComponent, {
28795
- install(app) {
28796
- app.component(VxeImagePreviewComponent.name, VxeImagePreviewComponent);
28797
- }
28798
- });
28799
- VxeUI.previewImage = openPreviewImage;
28800
- dynamicApp.use(VxeImagePreview);
28801
- VxeUI.component(VxeImagePreviewComponent);
28802
- const ImagePreview = VxeImagePreview;
28803
-
28804
- /**
28805
- * 计算滚动条滑块的长度
28806
- */
28807
- function getThumbSize(viewportSize, contentSize, trackSize) {
28808
- if (contentSize <= viewportSize) {
28809
- return 0;
28810
- }
28811
- const ratio = viewportSize / contentSize;
28812
- const ideal = trackSize * ratio;
28813
- return Math.max(20, Math.min(ideal, trackSize));
28814
- }
28815
- /**
28816
- * 计算滚动条滑块的偏移位置
28817
- */
28818
- function getThumbOffsetSize(offsetSize, viewportSize, contentSize, trackSize, thumbSize) {
28819
- const maxScroll = contentSize - viewportSize;
28820
- if (maxScroll <= 0) {
28821
- return 0;
28822
- }
28823
- const maxThumbOffset = trackSize - thumbSize;
28824
- if (maxThumbOffset <= 0) {
28825
- return 0;
28826
- }
28827
- const clamped = Math.min(Math.max(offsetSize, 0), maxScroll);
28828
- const ratio = clamped / maxScroll;
28829
- return ratio * maxThumbOffset;
28830
- }
28831
- /**
28832
- * 根据点击轨道的位置,计算滑块的偏移位置
28833
- */
28834
- function getScrollFromClick(clickPosition, viewportSize, contentSize, trackSize, thumbSize) {
28835
- const maxThumbOffset = trackSize - thumbSize;
28836
- const maxScroll = contentSize - viewportSize;
28837
- if (maxScroll <= 0 || maxThumbOffset <= 0) {
28838
- return 0;
28839
- }
28840
- let thumbOffset = clickPosition - thumbSize / 2;
28841
- thumbOffset = Math.min(Math.max(thumbOffset, 0), maxThumbOffset);
28842
- const scrollOffset = (thumbOffset / maxThumbOffset) * maxScroll;
28843
- return scrollOffset;
28844
- }
28845
- /**
28846
- * 拖拽 thumb 时,根据鼠标位置计算滑块的偏移位置
28847
- */
28848
- function getScrollFromDrag(pointerPosition, dragOffset, viewportSize, contentSize, trackSize, thumbSize) {
28849
- const maxScroll = contentSize - viewportSize;
28850
- const maxThumbOffset = trackSize - thumbSize;
28851
- if (maxScroll <= 0 || maxThumbOffset <= 0) {
28852
- return 0;
29063
+ });
28853
29064
  }
28854
- let thumbOffset = pointerPosition - dragOffset;
28855
- thumbOffset = Math.min(Math.max(thumbOffset, 0), maxThumbOffset);
28856
- return (thumbOffset / maxThumbOffset) * maxScroll;
28857
- }
29065
+ return Promise.resolve();
29066
+ };
28858
29067
 
28859
- const { getConfig: getConfig$2, createEvent, domUtils, globalResize, globalEvents, renderEmptyElement } = VxeUI;
28860
- function createReactData$d() {
28861
- return {
28862
- yThumbHeight: 0,
28863
- xThumbWidth: 0
28864
- };
28865
- }
28866
29068
  function createInternalData$c() {
28867
29069
  return {
28868
- // resizeObserver: undefined,
28869
- // isThumbDrag: false,
28870
- thumbDragOffset: 0,
28871
- yThumbTop: 0,
28872
- xThumbLeft: 0,
28873
- lastScrollTop: 0,
28874
- lastScrollLeft: 0
29070
+ // dgTime: 0,
29071
+ // mdTime: 0
28875
29072
  };
28876
29073
  }
28877
- var VxeScrollbarComponent = defineVxeComponent({
28878
- name: 'VxeScrollbar',
29074
+ function createReactData$d() {
29075
+ return {};
29076
+ }
29077
+ var VxeImageComponent = defineVxeComponent({
29078
+ name: 'VxeImage',
28879
29079
  props: {
28880
- id: [String, Number],
29080
+ src: [String, Array],
29081
+ alt: [String, Number],
29082
+ loading: String,
29083
+ title: [String, Number],
28881
29084
  width: [String, Number],
28882
29085
  height: [String, Number],
28883
29086
  minWidth: [String, Number],
28884
29087
  minHeight: [String, Number],
28885
29088
  maxWidth: [String, Number],
28886
29089
  maxHeight: [String, Number],
28887
- loading: Boolean,
28888
- native: {
29090
+ circle: Boolean,
29091
+ draggable: {
28889
29092
  type: Boolean,
28890
- default: () => getConfig$2().scrollbar.native
29093
+ default: () => getConfig$4().image.draggable
28891
29094
  },
28892
- padding: {
29095
+ zIndex: Number,
29096
+ maskClosable: {
28893
29097
  type: Boolean,
28894
- default: () => getConfig$2().scrollbar.padding
29098
+ default: () => getConfig$4().image.maskClosable
28895
29099
  },
28896
- xConfig: Object,
28897
- yConfig: Object,
28898
- className: {
28899
- type: String,
28900
- default: () => getConfig$2().scrollbar.className
29100
+ toolbarConfig: Object,
29101
+ showPreview: {
29102
+ type: Boolean,
29103
+ default: () => getConfig$4().image.showPreview
28901
29104
  },
28902
- viewAttrs: {
28903
- type: Object,
28904
- default: () => getConfig$2().scrollbar.viewAttrs
29105
+ showPrintButton: {
29106
+ type: Boolean,
29107
+ default: () => getConfig$4().image.showPrintButton
28905
29108
  },
28906
- viewClassName: {
28907
- type: String,
28908
- default: () => getConfig$2().scrollbar.viewClassName
29109
+ showDownloadButton: {
29110
+ type: Boolean,
29111
+ default: () => getConfig$4().image.showDownloadButton
28909
29112
  },
28910
- viewInnerClassName: {
29113
+ size: {
28911
29114
  type: String,
28912
- default: () => getConfig$2().scrollbar.viewInnerClassName
28913
- },
28914
- autoResize: {
28915
- type: Boolean,
28916
- default: () => getConfig$2().scrollbar.autoResize
29115
+ default: () => getConfig$4().image.size || getConfig$4().size
28917
29116
  },
28918
- syncResize: [Boolean, String, Number]
29117
+ getThumbnailUrlMethod: Function
28919
29118
  },
28920
29119
  emits: [
28921
- 'scroll',
28922
- 'scroll-boundary'
29120
+ 'click',
29121
+ 'change',
29122
+ 'rotate',
29123
+ 'dragstart',
29124
+ 'drag',
29125
+ 'dragend'
28923
29126
  ],
28924
29127
  setup(props, context) {
28925
- const { emit, slots } = context;
29128
+ const { emit } = context;
28926
29129
  const xID = XEUtils.uniqueId();
29130
+ const $xeImageGroup = inject('$xeImageGroup', null);
28927
29131
  const refElem = ref();
28928
- const refViewElem = ref();
28929
- const refViewInnerElem = ref();
28930
- const refTrackXElem = ref();
28931
- const refTrackYElem = ref();
28932
- const refThumbXElem = ref();
28933
- const refThumbYElem = ref();
28934
- const reactData = reactive(createReactData$d());
29132
+ const { computeSize } = useSize(props);
28935
29133
  const internalData = createInternalData$c();
28936
- const computeWrapperStyle = computed(() => {
28937
- const { width, height, minWidth, minHeight, maxWidth, maxHeight } = props;
28938
- const xOpts = computeXOpts.value;
28939
- const yOpts = computeYOpts.value;
28940
- const stys = {};
28941
- if (width) {
28942
- stys.width = toCssUnit(width);
28943
- }
28944
- if (height) {
28945
- stys.height = toCssUnit(height);
28946
- }
28947
- if (minWidth) {
28948
- stys.minWidth = toCssUnit(minWidth);
28949
- }
28950
- if (minHeight) {
28951
- stys.minHeight = toCssUnit(minHeight);
28952
- }
28953
- if (maxWidth) {
28954
- stys.maxWidth = toCssUnit(maxWidth);
28955
- }
28956
- if (maxHeight) {
28957
- stys.maxHeight = toCssUnit(maxHeight);
28958
- }
28959
- if (yOpts.width) {
28960
- stys['--vxe-ui-scrollbar-y-width'] = toCssUnit(yOpts.width);
28961
- }
28962
- if (xOpts.height) {
28963
- stys['--vxe-ui-scrollbar-x-height'] = toCssUnit(xOpts.height);
28964
- }
28965
- return stys;
28966
- });
28967
- const computeWrapperClss = computed(() => {
28968
- const { native, className, padding } = props;
28969
- const { yThumbHeight, xThumbWidth } = reactData;
28970
- const xOpts = computeXOpts.value;
28971
- const yOpts = computeYOpts.value;
28972
- const xToTop = computeXToTop.value;
28973
- const yToLeft = computeYToLeft.value;
28974
- return domUtils.buildClass([
28975
- 'vxe-scrollbar',
28976
- `ov-x--${xOpts.visible || 'visible'}`,
28977
- `ov-y--${yOpts.visible || 'visible'}`,
28978
- `sx-pos--${xToTop ? 'top' : 'bottom'}`,
28979
- `sy-pos--${yToLeft ? 'left' : 'right'}`,
28980
- native ? 'is--native' : 'is--virtual',
28981
- className
28982
- ], {
28983
- 'is--padding': padding,
28984
- 'ov-x--auto-hide': xOpts.autoHide,
28985
- 'ov-y--auto-hide': yOpts.autoHide,
28986
- 'overflow-y': yThumbHeight,
28987
- 'overflow-x': xThumbWidth
28988
- });
28989
- });
28990
- const computeViewClss = computed(() => {
28991
- const { viewClassName } = props;
28992
- return domUtils.buildClass([
28993
- 'vxe-scrollbar--view',
28994
- viewClassName
28995
- ]);
28996
- });
28997
- const computeViewInnerClss = computed(() => {
28998
- const { viewInnerClassName } = props;
28999
- return domUtils.buildClass([
29000
- 'vxe-scrollbar--view-inner',
29001
- viewInnerClassName
29002
- ]);
29003
- });
29004
- const computeXOpts = computed(() => {
29005
- return Object.assign({}, getConfig$2().scrollbar.xConfig, props.xConfig);
29006
- });
29007
- const computeYOpts = computed(() => {
29008
- return Object.assign({}, getConfig$2().scrollbar.yConfig, props.yConfig);
29009
- });
29010
- const computeXToTop = computed(() => {
29011
- const xOpts = computeXOpts.value;
29012
- return xOpts.position === 'top';
29013
- });
29014
- const computeYToLeft = computed(() => {
29015
- const yOpts = computeYOpts.value;
29016
- return yOpts.position === 'left';
29017
- });
29134
+ const reactData = reactive(createReactData$d());
29018
29135
  const refMaps = {
29019
29136
  refElem
29020
29137
  };
29021
- const computeMaps = {};
29022
- const $xeScrollbar = {
29023
- xID,
29024
- props,
29025
- context,
29026
- reactData,
29027
- internalData,
29028
- getRefMaps: () => refMaps,
29029
- getComputeMaps: () => computeMaps
29030
- };
29031
- const dispatchEvent = (type, params, evnt) => {
29032
- emit(type, createEvent(evnt, { $scrollbar: $xeScrollbar }, params));
29033
- };
29034
- const scrollbarMethods = {
29035
- dispatchEvent,
29036
- scrollTo(left, top) {
29037
- const viewEl = refViewElem.value;
29038
- if (viewEl) {
29039
- if (XEUtils.isNumber(left)) {
29040
- viewEl.scrollTo(left, top || 0);
29041
- }
29042
- else {
29043
- viewEl.scrollTo(left);
29044
- }
29045
- }
29046
- },
29047
- scrollIntoView() {
29048
- const viewEl = refViewElem.value;
29049
- if (viewEl) {
29050
- viewEl.scrollIntoView();
29051
- }
29052
- },
29053
- setScrollTop(top) {
29054
- const viewEl = refViewElem.value;
29055
- if (viewEl) {
29056
- viewEl.scrollTop = top;
29057
- }
29058
- },
29059
- setScrollLeft(left) {
29060
- const viewEl = refViewElem.value;
29061
- if (viewEl) {
29062
- viewEl.scrollLeft = left;
29063
- }
29064
- },
29065
- getScrollTop() {
29066
- const viewEl = refViewElem.value;
29067
- if (viewEl) {
29068
- return viewEl.scrollTop;
29069
- }
29070
- return 0;
29071
- },
29072
- getScrollLeft() {
29073
- const viewEl = refViewElem.value;
29074
- if (viewEl) {
29075
- return viewEl.scrollLeft;
29076
- }
29077
- return 0;
29078
- },
29079
- clearScroll() {
29080
- const viewEl = refViewElem.value;
29081
- if (viewEl) {
29082
- viewEl.scrollTop = 0;
29083
- viewEl.scrollLeft = 0;
29084
- }
29085
- },
29086
- recalculate() {
29087
- updateThumbSize();
29088
- updateThumbOffset();
29089
- return nextTick();
29090
- }
29091
- };
29092
- const updateThumbSize = () => {
29093
- const viewEl = refViewElem.value;
29094
- if (!viewEl) {
29095
- return;
29096
- }
29097
- const trackXEl = refTrackXElem.value;
29098
- const xThumbWidth = trackXEl ? getThumbSize(viewEl.clientWidth, viewEl.scrollWidth, trackXEl.clientWidth) : 0;
29099
- const thumbXElem = refThumbXElem.value;
29100
- if (thumbXElem) {
29101
- thumbXElem.style.width = xThumbWidth + 'px';
29102
- }
29103
- reactData.xThumbWidth = xThumbWidth;
29104
- const trackYEl = refTrackYElem.value;
29105
- const yThumbHeight = trackYEl ? getThumbSize(viewEl.clientHeight, viewEl.scrollHeight, trackYEl.clientHeight) : 0;
29106
- const thumbYElem = refThumbYElem.value;
29107
- if (thumbYElem) {
29108
- thumbYElem.style.height = yThumbHeight + 'px';
29109
- }
29110
- reactData.yThumbHeight = yThumbHeight;
29111
- };
29112
- const updateThumbOffset = () => {
29113
- const viewEl = refViewElem.value;
29114
- if (!viewEl) {
29115
- return;
29116
- }
29117
- const { xThumbWidth, yThumbHeight } = reactData;
29118
- const trackXEl = refTrackXElem.value;
29119
- const thumbXElem = refThumbXElem.value;
29120
- const xThumbLeft = trackXEl && xThumbWidth ? getThumbOffsetSize(viewEl.scrollLeft, viewEl.clientWidth, viewEl.scrollWidth, trackXEl.clientWidth, xThumbWidth) : 0;
29121
- internalData.xThumbLeft = xThumbLeft;
29122
- if (thumbXElem && xThumbWidth) {
29123
- thumbXElem.style.width = xThumbWidth + 'px';
29124
- thumbXElem.style.transform = `translateX(${xThumbLeft}px)`;
29125
- }
29126
- const trackYEl = refTrackYElem.value;
29127
- const thumbYElem = refThumbYElem.value;
29128
- const yThumbTop = trackYEl && yThumbHeight ? getThumbOffsetSize(viewEl.scrollTop, viewEl.clientHeight, viewEl.scrollHeight, trackYEl.clientHeight, yThumbHeight) : 0;
29129
- internalData.yThumbTop = yThumbTop;
29130
- if (thumbYElem && yThumbHeight) {
29131
- thumbYElem.style.height = yThumbHeight + 'px';
29132
- thumbYElem.style.transform = `translateY(${yThumbTop}px)`;
29133
- }
29134
- };
29135
- const scrollEvent = (evnt) => {
29136
- const { xThumbWidth, yThumbHeight } = reactData;
29137
- const { lastScrollTop, lastScrollLeft } = internalData;
29138
- const xOpts = computeXOpts.value;
29139
- const yOpts = computeYOpts.value;
29140
- const viewEl = evnt.currentTarget;
29141
- const { scrollTop, scrollLeft, clientWidth, clientHeight, scrollHeight, scrollWidth } = viewEl;
29142
- let direction = '';
29143
- let isTopBoundary = false;
29144
- let isBottomBoundary = false;
29145
- let isLeftBoundary = false;
29146
- let isRightBoundary = false;
29147
- if (lastScrollTop !== scrollTop) {
29148
- const yThreshold = XEUtils.toNumber(yOpts.threshold) || 1;
29149
- if (lastScrollTop < scrollTop) {
29150
- direction = 'bottom';
29151
- if (yThumbHeight > 0 && scrollTop + clientHeight >= scrollHeight - yThreshold) {
29152
- isBottomBoundary = true;
29153
- }
29138
+ const computeWrapperStyle = computed(() => {
29139
+ const { width, height, circle } = props;
29140
+ const stys = {};
29141
+ if (circle) {
29142
+ // 圆形只能生效一个
29143
+ if (width) {
29144
+ stys.width = toCssUnit(width);
29145
+ stys.height = toCssUnit(width);
29154
29146
  }
29155
- else {
29156
- direction = 'top';
29157
- if (yThumbHeight > 0 && scrollTop <= yThreshold) {
29158
- isTopBoundary = true;
29159
- }
29147
+ else if (height) {
29148
+ stys.width = toCssUnit(height);
29149
+ stys.height = toCssUnit(height);
29160
29150
  }
29161
29151
  }
29162
- if (lastScrollLeft !== scrollLeft) {
29163
- const xThreshold = XEUtils.toNumber(xOpts.threshold) || 1;
29164
- if (lastScrollLeft < scrollLeft) {
29165
- direction = 'right';
29166
- if (xThumbWidth > 0 && scrollLeft + clientWidth >= scrollWidth - xThreshold) {
29167
- isRightBoundary = true;
29168
- }
29169
- }
29170
- else {
29171
- direction = 'left';
29172
- if (xThumbWidth > 0 && scrollLeft <= xThreshold) {
29173
- isLeftBoundary = true;
29174
- }
29152
+ else {
29153
+ if (width) {
29154
+ stys.width = toCssUnit(width);
29155
+ }
29156
+ if (height) {
29157
+ stys.height = toCssUnit(height);
29175
29158
  }
29176
29159
  }
29177
- updateThumbOffset();
29178
- internalData.lastScrollTop = scrollTop;
29179
- internalData.lastScrollLeft = scrollLeft;
29180
- if (isBottomBoundary || isTopBoundary || isRightBoundary || isLeftBoundary) {
29181
- dispatchEvent('scroll-boundary', {
29182
- direction: direction,
29183
- isTop: isTopBoundary,
29184
- isBottom: isBottomBoundary,
29185
- isLeft: isLeftBoundary,
29186
- isRight: isRightBoundary,
29187
- scrollTop: scrollTop,
29188
- scrollLeft: scrollLeft,
29189
- clientWidth: clientWidth,
29190
- clientHeight: clientHeight,
29191
- scrollHeight: scrollHeight,
29192
- scrollWidth: scrollWidth
29193
- }, evnt);
29194
- }
29195
- dispatchEvent('scroll', {
29196
- direction: direction,
29197
- isTop: yThumbHeight > 0 && scrollTop <= 0,
29198
- isBottom: yThumbHeight > 0 && scrollTop + clientHeight >= scrollHeight,
29199
- isLeft: xThumbWidth > 0 && scrollLeft <= 0,
29200
- isRight: xThumbWidth > 0 && scrollLeft + clientWidth >= scrollWidth,
29201
- scrollTop: scrollTop,
29202
- scrollLeft: scrollLeft,
29203
- clientWidth: clientWidth,
29204
- clientHeight: clientHeight,
29205
- scrollHeight: scrollHeight,
29206
- scrollWidth: scrollWidth
29207
- }, evnt);
29208
- };
29209
- const clickTrackXEvent = (evnt) => {
29210
- const trackEl = evnt.currentTarget;
29211
- if (trackEl !== evnt.target) {
29212
- return;
29213
- }
29214
- const viewEl = refViewElem.value;
29215
- if (!viewEl) {
29216
- return;
29160
+ return stys;
29161
+ });
29162
+ const computeImgStyle = computed(() => {
29163
+ const { width, height, minWidth, minHeight, maxHeight, maxWidth } = props;
29164
+ const stys = {};
29165
+ if (width && height) {
29166
+ stys.maxWidth = toCssUnit(width);
29167
+ stys.maxHeight = toCssUnit(height);
29217
29168
  }
29218
- const { xThumbWidth } = reactData;
29219
- const trackRect = trackEl.getBoundingClientRect();
29220
- viewEl.scrollTo({
29221
- left: getScrollFromClick(evnt.clientX - trackRect.left, viewEl.clientWidth, viewEl.scrollWidth, trackEl.clientWidth, xThumbWidth),
29222
- behavior: 'auto'
29223
- });
29224
- };
29225
- const clickTrackYEvent = (evnt) => {
29226
- const trackEl = evnt.currentTarget;
29227
- if (trackEl !== evnt.target) {
29228
- return;
29169
+ else {
29170
+ if (width) {
29171
+ stys.width = toCssUnit(width);
29172
+ }
29173
+ if (height) {
29174
+ stys.height = toCssUnit(height);
29175
+ }
29176
+ if (minWidth) {
29177
+ stys.minWidth = toCssUnit(minWidth);
29178
+ }
29179
+ if (minHeight) {
29180
+ stys.minHeight = toCssUnit(minHeight);
29181
+ }
29182
+ if (maxWidth) {
29183
+ stys.maxWidth = toCssUnit(maxWidth);
29184
+ }
29185
+ if (maxHeight) {
29186
+ stys.maxHeight = toCssUnit(maxHeight);
29187
+ }
29229
29188
  }
29230
- const viewEl = refViewElem.value;
29231
- if (!viewEl) {
29232
- return;
29189
+ return stys;
29190
+ });
29191
+ const computeImgList = computed(() => {
29192
+ const { src } = props;
29193
+ if (src) {
29194
+ return (XEUtils.isArray(src) ? src : [src]).map(item => {
29195
+ if (XEUtils.isString(item)) {
29196
+ return {
29197
+ url: item,
29198
+ alt: ''
29199
+ };
29200
+ }
29201
+ return {
29202
+ url: item.url,
29203
+ alt: item.alt
29204
+ };
29205
+ });
29233
29206
  }
29234
- const { yThumbHeight } = reactData;
29235
- const trackRect = trackEl.getBoundingClientRect();
29236
- viewEl.scrollTo({
29237
- top: getScrollFromClick(evnt.clientY - trackRect.top, viewEl.clientHeight, viewEl.scrollHeight, trackEl.clientHeight, yThumbHeight),
29238
- behavior: 'auto'
29239
- });
29207
+ return [];
29208
+ });
29209
+ const computeImgItem = computed(() => {
29210
+ const imgList = computeImgList.value;
29211
+ return imgList[0];
29212
+ });
29213
+ const computeImgUrl = computed(() => {
29214
+ const imgItem = computeImgItem.value;
29215
+ return imgItem ? `${imgItem.url || ''}` : '';
29216
+ });
29217
+ const computeImgThumbnailUrl = computed(() => {
29218
+ const getThumbnailUrlFn = props.getThumbnailUrlMethod || getConfig$4().image.getThumbnailUrlMethod;
29219
+ const imgUrl = computeImgUrl.value;
29220
+ return getThumbnailUrlFn ? getThumbnailUrlFn({ url: imgUrl, $image: $xeImage }) : '';
29221
+ });
29222
+ const computeMaps = {
29223
+ computeSize
29240
29224
  };
29241
- const pointerdownThumbXEvent = (evnt) => {
29242
- const thumbEl = evnt.currentTarget;
29243
- internalData.isThumbDrag = true;
29244
- thumbEl.setPointerCapture(evnt.pointerId);
29245
- const viewEl = refViewElem.value;
29246
- if (!viewEl) {
29247
- return;
29248
- }
29249
- const { xThumbWidth } = reactData;
29250
- const trackEl = thumbEl.parentElement;
29251
- const trackRect = trackEl.getBoundingClientRect();
29252
- const pointerPosition = evnt.clientX - trackRect.left;
29253
- // 记录 thumb 的偏移
29254
- const thumbOffset = getThumbOffsetSize(viewEl.scrollLeft, viewEl.clientWidth, viewEl.scrollWidth, trackEl.clientWidth, xThumbWidth);
29255
- internalData.thumbDragOffset = pointerPosition - thumbOffset;
29225
+ const $xeImage = {
29226
+ xID,
29227
+ props,
29228
+ context,
29229
+ reactData,
29230
+ internalData,
29231
+ getRefMaps: () => refMaps,
29232
+ getComputeMaps: () => computeMaps
29256
29233
  };
29257
- const pointermoveThumbXEvent = (evnt) => {
29258
- const thumbEl = evnt.currentTarget;
29259
- if (!thumbEl.hasPointerCapture(evnt.pointerId)) {
29260
- return;
29261
- }
29262
- const { isThumbDrag, thumbDragOffset } = internalData;
29263
- if (isThumbDrag) {
29264
- const viewEl = refViewElem.value;
29265
- if (!viewEl) {
29266
- return;
29267
- }
29268
- const { xThumbWidth } = reactData;
29269
- const thumbEl = evnt.currentTarget;
29270
- const trackEl = thumbEl.parentElement;
29271
- const trackRect = trackEl.getBoundingClientRect();
29272
- // 更新偏移
29273
- viewEl.scrollLeft = getScrollFromDrag(evnt.clientX - trackRect.left, thumbDragOffset, viewEl.clientWidth, viewEl.scrollWidth, trackEl.clientWidth, xThumbWidth);
29274
- }
29234
+ const dispatchEvent = (type, params, evnt) => {
29235
+ emit(type, createEvent$1(evnt, { $image: $xeImage }, params));
29275
29236
  };
29276
- const cleatPointerThumbEvent = (evnt) => {
29277
- const thumbEl = evnt.currentTarget;
29278
- thumbEl.releasePointerCapture(evnt.pointerId);
29279
- internalData.isThumbDrag = false;
29237
+ const imageMethods = {
29238
+ dispatchEvent
29280
29239
  };
29281
- const pointerdownThumbYEvent = (evnt) => {
29282
- const thumbEl = evnt.currentTarget;
29283
- internalData.isThumbDrag = true;
29284
- thumbEl.setPointerCapture(evnt.pointerId);
29285
- const viewEl = refViewElem.value;
29286
- if (!viewEl) {
29240
+ const clickEvent = (evnt) => {
29241
+ const { showPreview, toolbarConfig, showPrintButton, showDownloadButton, maskClosable, zIndex } = props;
29242
+ const { mdTime, dgTime } = internalData;
29243
+ if (mdTime && dgTime && dgTime > mdTime) {
29287
29244
  return;
29288
29245
  }
29289
- const { yThumbHeight } = reactData;
29290
- const trackEl = thumbEl.parentElement;
29291
- const trackRect = trackEl.getBoundingClientRect();
29292
- const pointerPosition = evnt.clientY - trackRect.top;
29293
- // 记录 thumb 的偏移
29294
- const thumbOffset = getThumbOffsetSize(viewEl.scrollTop, viewEl.clientHeight, viewEl.scrollHeight, trackEl.clientHeight, yThumbHeight);
29295
- internalData.thumbDragOffset = pointerPosition - thumbOffset;
29296
- };
29297
- const pointermoveThumbYEvent = (evnt) => {
29298
- const thumbEl = evnt.currentTarget;
29299
- if (!thumbEl.hasPointerCapture(evnt.pointerId)) {
29300
- return;
29246
+ const imgList = computeImgList.value;
29247
+ const imgUrl = computeImgUrl.value;
29248
+ if ($xeImageGroup) {
29249
+ $xeImageGroup.handleClickImgEvent(evnt, { url: imgUrl });
29301
29250
  }
29302
- const { isThumbDrag, thumbDragOffset } = internalData;
29303
- if (isThumbDrag) {
29304
- const viewEl = refViewElem.value;
29305
- if (!viewEl) {
29306
- return;
29251
+ else {
29252
+ if (showPreview && imgUrl) {
29253
+ openPreviewImage({
29254
+ urlList: imgList,
29255
+ toolbarConfig,
29256
+ showPrintButton,
29257
+ showDownloadButton,
29258
+ maskClosable,
29259
+ zIndex,
29260
+ events: {
29261
+ change(eventParams) {
29262
+ dispatchEvent('change', eventParams, eventParams.$event);
29263
+ },
29264
+ rotate(eventParams) {
29265
+ dispatchEvent('rotate', eventParams, eventParams.$event);
29266
+ }
29267
+ }
29268
+ });
29307
29269
  }
29308
- const { yThumbHeight } = reactData;
29309
- const thumbEl = evnt.currentTarget;
29310
- const trackEl = thumbEl.parentElement;
29311
- const trackRect = trackEl.getBoundingClientRect();
29312
- // 更新偏移
29313
- viewEl.scrollTop = getScrollFromDrag(evnt.clientY - trackRect.top, thumbDragOffset, viewEl.clientHeight, viewEl.scrollHeight, trackEl.clientHeight, yThumbHeight);
29270
+ dispatchEvent('click', { url: imgUrl }, evnt);
29314
29271
  }
29315
29272
  };
29316
- const scrollbarPrivateMethods = {};
29317
- Object.assign($xeScrollbar, scrollbarMethods, scrollbarPrivateMethods);
29273
+ const mousedownEvent = () => {
29274
+ internalData.mdTime = Date.now();
29275
+ };
29276
+ const handleDragstartEvent = (evnt) => {
29277
+ internalData.dgTime = Date.now();
29278
+ dispatchEvent('dragstart', {}, evnt);
29279
+ };
29280
+ const handleDragEvent = (evnt) => {
29281
+ dispatchEvent(evnt.type, {}, evnt);
29282
+ };
29283
+ const imagePrivateMethods = {};
29284
+ Object.assign($xeImage, imageMethods, imagePrivateMethods);
29318
29285
  const renderVN = () => {
29319
- const { id, native, loading, viewAttrs } = props;
29286
+ const { alt, loading, circle, draggable } = props;
29320
29287
  const wrapperStyle = computeWrapperStyle.value;
29321
- const wrapperClss = computeWrapperClss.value;
29322
- const viewClss = computeViewClss.value;
29323
- const viewInnerClss = computeViewInnerClss.value;
29324
- const xOpts = computeXOpts.value;
29325
- const yOpts = computeYOpts.value;
29326
- const defaultSlot = slots.default;
29288
+ const imgStyle = computeImgStyle.value;
29289
+ const imgUrl = computeImgUrl.value;
29290
+ const imgThumbnailUrl = computeImgThumbnailUrl.value;
29291
+ const vSize = computeSize.value;
29292
+ let imgDrag;
29293
+ if (!XEUtils.eqNull(draggable)) {
29294
+ imgDrag = !!(draggable === true || draggable === 'true');
29295
+ }
29327
29296
  return h('div', {
29328
- ref: refElem,
29329
- id: id || null,
29330
- class: wrapperClss,
29297
+ class: ['vxe-image', {
29298
+ [`size--${vSize}`]: vSize,
29299
+ 'is--circle': circle
29300
+ }],
29331
29301
  style: wrapperStyle
29332
29302
  }, [
29333
- h('div', Object.assign({ ref: refViewElem, class: viewClss, onScroll: scrollEvent }, viewAttrs), [
29334
- h('div', {
29335
- key: 'vi',
29336
- ref: refViewInnerElem,
29337
- class: viewInnerClss
29338
- }, defaultSlot ? defaultSlot({}) : [])
29339
- ]),
29340
- native || xOpts.visible === 'hidden'
29341
- ? renderEmptyElement($xeScrollbar)
29342
- : h('div', {
29343
- ref: refTrackXElem,
29344
- class: 'vxe-scrollbar--track-x',
29345
- onClick: clickTrackXEvent
29346
- }, [
29347
- h('div', {
29348
- ref: refThumbXElem,
29349
- class: 'vxe-scrollbar--thumb-x',
29350
- onPointerdown: pointerdownThumbXEvent,
29351
- onPointermove: pointermoveThumbXEvent,
29352
- onPointerup: cleatPointerThumbEvent,
29353
- onPointercancel: cleatPointerThumbEvent,
29354
- onLostpointercapture: cleatPointerThumbEvent
29355
- })
29356
- ]),
29357
- native || yOpts.visible === 'hidden'
29358
- ? renderEmptyElement($xeScrollbar)
29359
- : h('div', {
29360
- ref: refTrackYElem,
29361
- class: 'vxe-scrollbar--track-y',
29362
- onClick: clickTrackYEvent
29363
- }, [
29364
- h('div', {
29365
- ref: refThumbYElem,
29366
- class: 'vxe-scrollbar--thumb-y',
29367
- onPointerdown: pointerdownThumbYEvent,
29368
- onPointermove: pointermoveThumbYEvent,
29369
- onPointerup: cleatPointerThumbEvent,
29370
- onPointercancel: cleatPointerThumbEvent,
29371
- onLostpointercapture: cleatPointerThumbEvent
29372
- })
29373
- ]),
29374
- h(VxeLoading, {
29375
- class: 'vxe-scrollbar--loading',
29376
- modelValue: loading
29303
+ h('img', {
29304
+ ref: refElem,
29305
+ class: 'vxe-image-img',
29306
+ src: imgThumbnailUrl || imgUrl,
29307
+ alt,
29308
+ loading,
29309
+ draggable: imgDrag,
29310
+ style: imgStyle,
29311
+ onMousedown: mousedownEvent,
29312
+ onClick: clickEvent,
29313
+ onDragstart: handleDragstartEvent,
29314
+ onDrag: handleDragEvent,
29315
+ onDragend: handleDragEvent
29377
29316
  })
29378
29317
  ]);
29379
29318
  };
29380
- const reFlag = ref(0);
29381
- watch(() => props.height, () => {
29382
- reFlag.value++;
29383
- });
29384
- watch(() => props.width, () => {
29385
- reFlag.value++;
29386
- });
29387
- watch(() => props.minHeight, () => {
29388
- reFlag.value++;
29389
- });
29390
- watch(() => props.minWidth, () => {
29391
- reFlag.value++;
29392
- });
29393
- watch(() => props.maxHeight, () => {
29394
- reFlag.value++;
29395
- });
29396
- watch(() => props.maxWidth, () => {
29397
- reFlag.value++;
29398
- });
29399
- watch(() => props.native, () => {
29400
- reFlag.value++;
29401
- });
29402
- watch(() => props.syncResize, () => {
29403
- reFlag.value++;
29404
- });
29405
- watch(reFlag, () => {
29406
- $xeScrollbar.recalculate();
29319
+ onBeforeUnmount(() => {
29320
+ XEUtils.assign(reactData, createReactData$d());
29321
+ XEUtils.assign(internalData, createInternalData$c());
29407
29322
  });
29408
- onMounted(() => {
29409
- const { autoResize } = props;
29410
- const viewEl = refViewElem.value;
29411
- const viewInnerEl = refViewInnerElem.value;
29412
- if (autoResize) {
29413
- const resizeObserver = globalResize.create(() => {
29414
- if (props.autoResize) {
29415
- reFlag.value++;
29323
+ $xeImage.renderVN = renderVN;
29324
+ return $xeImage;
29325
+ },
29326
+ render() {
29327
+ return this.renderVN();
29328
+ }
29329
+ });
29330
+
29331
+ const VxeImage = Object.assign({}, VxeImageComponent, {
29332
+ install(app) {
29333
+ app.component(VxeImageComponent.name, VxeImageComponent);
29334
+ }
29335
+ });
29336
+ dynamicApp.use(VxeImage);
29337
+ VxeUI.component(VxeImageComponent);
29338
+ const Image$1 = VxeImage;
29339
+
29340
+ var VxeImageGroupComponent = defineVxeComponent({
29341
+ name: 'VxeImageGroup',
29342
+ props: {
29343
+ urlList: [Array, String],
29344
+ showPreview: {
29345
+ type: Boolean,
29346
+ default: () => getConfig$4().imageGroup.showPreview
29347
+ },
29348
+ imageStyle: Object,
29349
+ zIndex: Number,
29350
+ size: {
29351
+ type: String,
29352
+ default: () => getConfig$4().imageGroup.size || getConfig$4().size
29353
+ },
29354
+ toolbarConfig: Object,
29355
+ showPrintButton: {
29356
+ type: Boolean,
29357
+ default: () => getConfig$4().imageGroup.showPrintButton
29358
+ },
29359
+ showDownloadButton: {
29360
+ type: Boolean,
29361
+ default: () => getConfig$4().imageGroup.showDownloadButton
29362
+ },
29363
+ getThumbnailUrlMethod: Function
29364
+ },
29365
+ emits: [
29366
+ 'click',
29367
+ 'change',
29368
+ 'rotate'
29369
+ ],
29370
+ setup(props, context) {
29371
+ const { emit } = context;
29372
+ const xID = XEUtils.uniqueId();
29373
+ const { computeSize } = useSize(props);
29374
+ const computeImgList = computed(() => {
29375
+ const { urlList } = props;
29376
+ if (urlList) {
29377
+ return (XEUtils.isArray(urlList) ? urlList : [urlList]).map(item => {
29378
+ if (XEUtils.isString(item)) {
29379
+ return {
29380
+ url: item,
29381
+ alt: ''
29382
+ };
29416
29383
  }
29384
+ return {
29385
+ url: item.url,
29386
+ alt: item.alt
29387
+ };
29417
29388
  });
29418
- if (viewEl) {
29419
- resizeObserver.observe(viewEl);
29420
- }
29421
- if (viewInnerEl) {
29422
- resizeObserver.observe(viewInnerEl);
29423
- }
29424
- internalData.resizeObserver = resizeObserver;
29425
29389
  }
29426
- reFlag.value++;
29427
- globalEvents.on($xeScrollbar, 'resize', () => {
29428
- reFlag.value++;
29429
- });
29390
+ return [];
29430
29391
  });
29431
- onBeforeUnmount(() => {
29432
- const { resizeObserver } = internalData;
29433
- if (resizeObserver) {
29434
- resizeObserver.disconnect();
29435
- }
29436
- globalEvents.off($xeScrollbar, 'resize');
29392
+ const computeImgStyleOpts = computed(() => {
29393
+ return Object.assign({}, getConfig$4().imageGroup.imageStyle, props.imageStyle);
29437
29394
  });
29438
- $xeScrollbar.renderVN = renderVN;
29439
- return $xeScrollbar;
29395
+ const computeGetThumbnailUrlMethod = computed(() => {
29396
+ return props.getThumbnailUrlMethod || getConfig$4().imageGroup.getThumbnailUrlMethod;
29397
+ });
29398
+ const computeMaps = {
29399
+ computeSize
29400
+ };
29401
+ const $xeImageGroup = {
29402
+ xID,
29403
+ props,
29404
+ context,
29405
+ getComputeMaps: () => computeMaps
29406
+ };
29407
+ const imageGroupMethods = {
29408
+ dispatchEvent(type, params, evnt) {
29409
+ emit(type, createEvent$1(evnt, { $imageGroup: $xeImageGroup }, params));
29410
+ }
29411
+ };
29412
+ const imageGroupPrivateMethods = {
29413
+ handleClickImgEvent(evnt, params) {
29414
+ const { showPreview, toolbarConfig, showPrintButton, showDownloadButton, zIndex } = props;
29415
+ const { url } = params;
29416
+ const imgList = computeImgList.value;
29417
+ if (showPreview && url) {
29418
+ openPreviewImage({
29419
+ activeIndex: Math.max(0, XEUtils.findIndexOf(imgList, item => item.url === url)),
29420
+ urlList: imgList,
29421
+ toolbarConfig,
29422
+ showPrintButton,
29423
+ showDownloadButton,
29424
+ zIndex,
29425
+ events: {
29426
+ change(eventParams) {
29427
+ $xeImageGroup.dispatchEvent('change', eventParams, eventParams.$event);
29428
+ },
29429
+ rotate(eventParams) {
29430
+ $xeImageGroup.dispatchEvent('rotate', eventParams, eventParams.$event);
29431
+ }
29432
+ }
29433
+ });
29434
+ }
29435
+ $xeImageGroup.dispatchEvent('click', { url, urlList: imgList }, evnt);
29436
+ }
29437
+ };
29438
+ Object.assign($xeImageGroup, imageGroupMethods, imageGroupPrivateMethods);
29439
+ const renderVN = () => {
29440
+ const imgList = computeImgList.value;
29441
+ const vSize = computeSize.value;
29442
+ const imgStyleOpts = computeImgStyleOpts.value;
29443
+ const getThumbnailUrlMethod = computeGetThumbnailUrlMethod.value;
29444
+ return h('div', {
29445
+ class: ['vxe-image-group', {
29446
+ [`size--${vSize}`]: vSize
29447
+ }]
29448
+ }, imgList
29449
+ ? imgList.map((item, index) => {
29450
+ return h(VxeImageComponent, {
29451
+ key: index,
29452
+ src: item.url,
29453
+ alt: item.alt,
29454
+ width: imgStyleOpts.width,
29455
+ height: imgStyleOpts.height,
29456
+ getThumbnailUrlMethod
29457
+ });
29458
+ })
29459
+ : []);
29460
+ };
29461
+ $xeImageGroup.renderVN = renderVN;
29462
+ provide('$xeImageGroup', $xeImageGroup);
29463
+ return $xeImageGroup;
29440
29464
  },
29441
29465
  render() {
29442
29466
  return this.renderVN();
29443
29467
  }
29444
29468
  });
29445
29469
 
29446
- const VxeScrollbar = Object.assign({}, VxeScrollbarComponent, {
29470
+ const VxeImageGroup = Object.assign({}, VxeImageGroupComponent, {
29447
29471
  install(app) {
29448
- app.component(VxeScrollbarComponent.name, VxeScrollbarComponent);
29472
+ app.component(VxeImageGroupComponent.name, VxeImageGroupComponent);
29449
29473
  }
29450
29474
  });
29451
- dynamicApp.use(VxeScrollbar);
29452
- VxeUI.component(VxeScrollbarComponent);
29453
- const Scrollbar = VxeScrollbar;
29475
+ dynamicApp.use(VxeImageGroup);
29476
+ VxeUI.component(VxeImageGroupComponent);
29477
+ const ImageGroup = VxeImageGroup;
29478
+
29479
+ const VxeImagePreview = Object.assign(VxeImagePreviewComponent, {
29480
+ install(app) {
29481
+ app.component(VxeImagePreviewComponent.name, VxeImagePreviewComponent);
29482
+ }
29483
+ });
29484
+ VxeUI.previewImage = openPreviewImage;
29485
+ dynamicApp.use(VxeImagePreview);
29486
+ VxeUI.component(VxeImagePreviewComponent);
29487
+ const ImagePreview = VxeImagePreview;
29454
29488
 
29455
29489
  var VxeLayoutAsideComponent = defineVxeComponent({
29456
29490
  name: 'VxeLayoutAside',
@@ -40943,6 +40977,11 @@ var VxeTabsComponent = defineVxeComponent({
40943
40977
  type: String,
40944
40978
  default: () => getConfig$4().tabs.size || getConfig$4().size
40945
40979
  },
40980
+ useScrollbar: {
40981
+ type: Boolean,
40982
+ default: () => getConfig$4().tabs.useScrollbar
40983
+ },
40984
+ scrollbarConfig: Object,
40946
40985
  // 已废弃
40947
40986
  beforeCloseMethod: Function
40948
40987
  },
@@ -41038,6 +41077,9 @@ var VxeTabsComponent = defineVxeComponent({
41038
41077
  const computeParentTabsResizeFlag = computed(() => {
41039
41078
  return $xeParentTabs ? $xeParentTabs.reactData.resizeFlag : null;
41040
41079
  });
41080
+ const computeScrollbarOpts = computed(() => {
41081
+ return Object.assign({}, getConfig$4().tabs.scrollbarConfig, props.scrollbarConfig);
41082
+ });
41041
41083
  const computeMaps = {};
41042
41084
  const $xeTabs = {
41043
41085
  xID,
@@ -41613,17 +41655,27 @@ var VxeTabsComponent = defineVxeComponent({
41613
41655
  ]);
41614
41656
  };
41615
41657
  const renderTabPane = (item) => {
41658
+ const { useScrollbar } = props;
41616
41659
  const { initNames, activeName } = reactData;
41617
41660
  const { name, slots } = item;
41618
41661
  const defaultSlot = slots ? slots.default : null;
41619
- return name && initNames.includes(name)
41620
- ? h('div', {
41621
- key: `${name}`,
41622
- class: ['vxe-tabs-pane--item', {
41623
- 'is--visible': activeName === name
41624
- }]
41625
- }, defaultSlot ? callSlot(defaultSlot, { name }) : [])
41626
- : renderEmptyElement$1($xeTabs);
41662
+ const scrollbarOpts = computeScrollbarOpts.value;
41663
+ const { viewClassName, viewInnerClassName } = scrollbarOpts;
41664
+ if (name && initNames.includes(name)) {
41665
+ return useScrollbar
41666
+ ? h(VxeScrollbar, Object.assign(Object.assign({ key: `${name}`, class: ['vxe-tabs-pane--scrollbar-item', {
41667
+ 'is--visible': activeName === name
41668
+ }] }, scrollbarOpts), { viewClassName: 'vxe-tabs-pane--scrollbar-item-view' + (viewClassName ? (' ' + viewClassName) : ''), viewInnerClassName: 'vxe-tabs-pane--scrollbar-item-inner' + (viewClassName ? (' ' + viewInnerClassName) : '') }), {
41669
+ default: () => defaultSlot ? callSlot(defaultSlot, { name }) : []
41670
+ })
41671
+ : h('div', {
41672
+ key: `${name}`,
41673
+ class: ['vxe-tabs-pane--item', {
41674
+ 'is--visible': activeName === name
41675
+ }]
41676
+ }, defaultSlot ? callSlot(defaultSlot, { name }) : []);
41677
+ }
41678
+ return renderEmptyElement$1($xeTabs);
41627
41679
  };
41628
41680
  const renderTabContent = (tabList) => {
41629
41681
  const { destroyOnClose } = props;
@@ -43950,11 +44002,15 @@ var VxeTreeComponent = defineVxeComponent({
43950
44002
  const { rowHeight } = scrollYStore;
43951
44003
  const el = refElem.value;
43952
44004
  if (el && el.clientWidth && el.clientHeight) {
43953
- const parentEl = getParentElem();
44005
+ let parentEl = getParentElem();
43954
44006
  const headerWrapperEl = refHeaderWrapperElem.value;
43955
44007
  const footerWrapperEl = refFooterWrapperElem.value;
43956
44008
  const headHeight = headerWrapperEl ? headerWrapperEl.clientHeight : 0;
43957
44009
  const footHeight = footerWrapperEl ? footerWrapperEl.clientHeight : 0;
44010
+ // 如果是虚拟滚动条
44011
+ if (parentEl && hasClass(parentEl, 'vxe-scrollbar--view-inner')) {
44012
+ parentEl = parentEl.parentElement;
44013
+ }
43958
44014
  if (parentEl) {
43959
44015
  const parentPaddingSize = getPaddingTopBottomSize(parentEl);
43960
44016
  reactData.parentHeight = Math.max(headHeight + footHeight + rowHeight, parentEl.clientHeight - parentPaddingSize - headHeight - footHeight);