vxe-pc-ui 4.18.22 → 4.19.0

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 (147) hide show
  1. package/dist/all.esm.js +1138 -1062
  2. package/dist/style.css +1 -1
  3. package/dist/style.min.css +1 -1
  4. package/es/calendar/src/calendar.js +1 -1
  5. package/es/card/src/card.js +1 -1
  6. package/es/carousel/src/carousel.js +1 -1
  7. package/es/countdown/src/countdown.js +1 -1
  8. package/es/date-picker/src/date-picker.js +3 -3
  9. package/es/icon/style.css +1 -1
  10. package/es/icon-picker/src/icon-picker.js +1 -1
  11. package/es/layout-aside/src/layout-aside.js +22 -10
  12. package/es/layout-aside/style.css +2 -4
  13. package/es/layout-aside/style.min.css +1 -1
  14. package/es/layout-body/src/layout-body.js +19 -12
  15. package/es/layout-body/style.css +2 -3
  16. package/es/layout-body/style.min.css +1 -1
  17. package/es/list/src/list.js +1 -1
  18. package/es/menu/src/menu.js +10 -4
  19. package/es/menu/style.css +10 -2
  20. package/es/menu/style.min.css +1 -1
  21. package/es/scrollbar/src/scrollbar.js +61 -15
  22. package/es/scrollbar/style.css +18 -15
  23. package/es/scrollbar/style.min.css +1 -1
  24. package/es/select/src/select.js +2 -2
  25. package/es/style.css +1 -1
  26. package/es/style.min.css +1 -1
  27. package/es/tabs/src/tabs.js +1 -1
  28. package/es/text-ellipsis/style.css +29 -10
  29. package/es/text-ellipsis/style.min.css +1 -1
  30. package/es/ui/index.js +8 -2
  31. package/es/ui/src/log.js +1 -1
  32. package/es/upload/src/upload.js +1 -1
  33. package/es/upload/style.css +5 -3
  34. package/es/upload/style.min.css +1 -1
  35. package/es/vxe-layout-aside/style.css +2 -4
  36. package/es/vxe-layout-aside/style.min.css +1 -1
  37. package/es/vxe-layout-body/style.css +2 -3
  38. package/es/vxe-layout-body/style.min.css +1 -1
  39. package/es/vxe-menu/style.css +10 -2
  40. package/es/vxe-menu/style.min.css +1 -1
  41. package/es/vxe-scrollbar/style.css +18 -15
  42. package/es/vxe-scrollbar/style.min.css +1 -1
  43. package/es/vxe-text-ellipsis/style.css +29 -10
  44. package/es/vxe-text-ellipsis/style.min.css +1 -1
  45. package/es/vxe-upload/style.css +5 -3
  46. package/es/vxe-upload/style.min.css +1 -1
  47. package/lib/calendar/src/calendar.js +1 -1
  48. package/lib/calendar/src/calendar.min.js +1 -1
  49. package/lib/card/src/card.js +1 -1
  50. package/lib/card/src/card.min.js +1 -1
  51. package/lib/carousel/src/carousel.js +1 -1
  52. package/lib/carousel/src/carousel.min.js +1 -1
  53. package/lib/countdown/src/countdown.js +1 -1
  54. package/lib/countdown/src/countdown.min.js +1 -1
  55. package/lib/date-picker/src/date-picker.js +3 -3
  56. package/lib/date-picker/src/date-picker.min.js +1 -1
  57. package/lib/icon/style/style.css +1 -1
  58. package/lib/icon/style/style.min.css +1 -1
  59. package/lib/icon-picker/src/icon-picker.js +1 -1
  60. package/lib/icon-picker/src/icon-picker.min.js +1 -1
  61. package/lib/index.umd.js +1059 -952
  62. package/lib/index.umd.min.js +1 -1
  63. package/lib/layout-aside/src/layout-aside.js +29 -10
  64. package/lib/layout-aside/src/layout-aside.min.js +1 -1
  65. package/lib/layout-aside/style/style.css +2 -4
  66. package/lib/layout-aside/style/style.min.css +1 -1
  67. package/lib/layout-body/src/layout-body.js +29 -12
  68. package/lib/layout-body/src/layout-body.min.js +1 -1
  69. package/lib/layout-body/style/style.css +2 -3
  70. package/lib/layout-body/style/style.min.css +1 -1
  71. package/lib/list/src/list.js +1 -1
  72. package/lib/list/src/list.min.js +1 -1
  73. package/lib/menu/src/menu.js +11 -3
  74. package/lib/menu/src/menu.min.js +1 -1
  75. package/lib/menu/style/style.css +10 -2
  76. package/lib/menu/style/style.min.css +1 -1
  77. package/lib/scrollbar/src/scrollbar.js +66 -12
  78. package/lib/scrollbar/src/scrollbar.min.js +1 -1
  79. package/lib/scrollbar/style/style.css +18 -15
  80. package/lib/scrollbar/style/style.min.css +1 -1
  81. package/lib/select/src/select.js +2 -2
  82. package/lib/select/src/select.min.js +1 -1
  83. package/lib/style.css +1 -1
  84. package/lib/style.min.css +1 -1
  85. package/lib/tabs/src/tabs.js +1 -1
  86. package/lib/tabs/src/tabs.min.js +1 -1
  87. package/lib/text-ellipsis/style/style.css +29 -10
  88. package/lib/text-ellipsis/style/style.min.css +1 -1
  89. package/lib/ui/index.js +8 -2
  90. package/lib/ui/index.min.js +1 -1
  91. package/lib/ui/src/log.js +1 -1
  92. package/lib/ui/src/log.min.js +1 -1
  93. package/lib/upload/src/upload.js +1 -1
  94. package/lib/upload/src/upload.min.js +1 -1
  95. package/lib/upload/style/style.css +5 -3
  96. package/lib/upload/style/style.min.css +1 -1
  97. package/lib/vxe-layout-aside/style/style.css +2 -4
  98. package/lib/vxe-layout-aside/style/style.min.css +1 -1
  99. package/lib/vxe-layout-body/style/style.css +2 -3
  100. package/lib/vxe-layout-body/style/style.min.css +1 -1
  101. package/lib/vxe-menu/style/style.css +10 -2
  102. package/lib/vxe-menu/style/style.min.css +1 -1
  103. package/lib/vxe-scrollbar/style/style.css +18 -15
  104. package/lib/vxe-scrollbar/style/style.min.css +1 -1
  105. package/lib/vxe-text-ellipsis/style/style.css +29 -10
  106. package/lib/vxe-text-ellipsis/style/style.min.css +1 -1
  107. package/lib/vxe-upload/style/style.css +5 -3
  108. package/lib/vxe-upload/style/style.min.css +1 -1
  109. package/package.json +2 -2
  110. package/packages/calendar/src/calendar.ts +1 -1
  111. package/packages/card/src/card.ts +1 -1
  112. package/packages/carousel/src/carousel.ts +1 -1
  113. package/packages/countdown/src/countdown.ts +1 -1
  114. package/packages/date-picker/src/date-picker.ts +3 -3
  115. package/packages/icon-picker/src/icon-picker.ts +1 -1
  116. package/packages/layout-aside/src/layout-aside.ts +23 -10
  117. package/packages/layout-body/src/layout-body.ts +23 -12
  118. package/packages/list/src/list.ts +1 -1
  119. package/packages/menu/src/menu.ts +14 -4
  120. package/packages/scrollbar/src/scrollbar.ts +63 -11
  121. package/packages/select/src/select.ts +2 -2
  122. package/packages/tabs/src/tabs.ts +1 -1
  123. package/packages/ui/index.ts +8 -3
  124. package/packages/upload/src/upload.ts +1 -1
  125. package/styles/components/layout-aside.scss +2 -4
  126. package/styles/components/layout-body.scss +2 -3
  127. package/styles/components/menu.scss +11 -2
  128. package/styles/components/scrollbar.scss +26 -19
  129. package/styles/components/text-ellipsis.scss +23 -64
  130. package/styles/components/upload.scss +5 -3
  131. package/styles/theme/base.scss +2 -0
  132. package/types/components/layout-aside.d.ts +3 -0
  133. package/types/components/layout-body.d.ts +3 -1
  134. package/types/components/menu.d.ts +3 -0
  135. package/types/components/scrollbar.d.ts +15 -0
  136. /package/es/icon/{iconfont.1791471274739.ttf → iconfont.1791539010382.ttf} +0 -0
  137. /package/es/icon/{iconfont.1791471274739.woff → iconfont.1791539010382.woff} +0 -0
  138. /package/es/icon/{iconfont.1791471274739.woff2 → iconfont.1791539010382.woff2} +0 -0
  139. /package/es/{iconfont.1791471274739.ttf → iconfont.1791539010382.ttf} +0 -0
  140. /package/es/{iconfont.1791471274739.woff → iconfont.1791539010382.woff} +0 -0
  141. /package/es/{iconfont.1791471274739.woff2 → iconfont.1791539010382.woff2} +0 -0
  142. /package/lib/icon/style/{iconfont.1791471274739.ttf → iconfont.1791539010382.ttf} +0 -0
  143. /package/lib/icon/style/{iconfont.1791471274739.woff → iconfont.1791539010382.woff} +0 -0
  144. /package/lib/icon/style/{iconfont.1791471274739.woff2 → iconfont.1791539010382.woff2} +0 -0
  145. /package/lib/{iconfont.1791471274739.ttf → iconfont.1791539010382.ttf} +0 -0
  146. /package/lib/{iconfont.1791471274739.woff → iconfont.1791539010382.woff} +0 -0
  147. /package/lib/{iconfont.1791471274739.woff2 → iconfont.1791539010382.woff2} +0 -0
@@ -39,6 +39,7 @@ function createInternalData() {
39
39
  var _default = exports.default = (0, _comp.defineVxeComponent)({
40
40
  name: 'VxeScrollbar',
41
41
  props: {
42
+ id: [String, Number],
42
43
  width: [String, Number],
43
44
  height: [String, Number],
44
45
  minWidth: [String, Number],
@@ -52,8 +53,22 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
52
53
  },
53
54
  xConfig: Object,
54
55
  yConfig: Object,
55
- className: String,
56
- viewClassName: String,
56
+ className: {
57
+ type: String,
58
+ default: () => getConfig().scrollbar.className
59
+ },
60
+ viewAttrs: {
61
+ type: Object,
62
+ default: () => getConfig().scrollbar.viewAttrs
63
+ },
64
+ viewClassName: {
65
+ type: String,
66
+ default: () => getConfig().scrollbar.viewClassName
67
+ },
68
+ viewInnerClassName: {
69
+ type: String,
70
+ default: () => getConfig().scrollbar.viewInnerClassName
71
+ },
57
72
  autoResize: {
58
73
  type: Boolean,
59
74
  default: () => getConfig().scrollbar.autoResize
@@ -119,11 +134,17 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
119
134
  native,
120
135
  className
121
136
  } = props;
137
+ const {
138
+ yThumbHeight,
139
+ xThumbWidth
140
+ } = reactData;
122
141
  const xOpts = computeXOpts.value;
123
142
  const yOpts = computeYOpts.value;
124
143
  return domUtils.buildClass(['vxe-scrollbar', `ov-x--${xOpts.visible || 'visible'}`, `ov-y--${yOpts.visible || 'visible'}`, native ? 'is--native' : 'is--virtual', className], {
125
144
  'ov-x--auto-hide': xOpts.autoHide,
126
- 'ov-y--auto-hide': yOpts.autoHide
145
+ 'ov-y--auto-hide': yOpts.autoHide,
146
+ 'overflow-y': yThumbHeight,
147
+ 'overflow-x': xThumbWidth
127
148
  });
128
149
  });
129
150
  const computeViewClss = (0, _vue.computed)(() => {
@@ -132,6 +153,12 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
132
153
  } = props;
133
154
  return domUtils.buildClass(['vxe-scrollbar--view', viewClassName]);
134
155
  });
156
+ const computeViewInnerClss = (0, _vue.computed)(() => {
157
+ const {
158
+ viewInnerClassName
159
+ } = props;
160
+ return domUtils.buildClass(['vxe-scrollbar--view-inner', viewInnerClassName]);
161
+ });
135
162
  const computeXOpts = (0, _vue.computed)(() => {
136
163
  return Object.assign({}, getConfig().scrollbar.xConfig, props.xConfig);
137
164
  });
@@ -440,26 +467,31 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
440
467
  Object.assign($xeScrollbar, scrollbarMethods, scrollbarPrivateMethods);
441
468
  const renderVN = () => {
442
469
  const {
470
+ id,
443
471
  native,
444
- loading
472
+ loading,
473
+ viewAttrs
445
474
  } = props;
446
475
  const wrapperStyle = computeWrapperStyle.value;
447
476
  const wrapperClss = computeWrapperClss.value;
448
477
  const viewClss = computeViewClss.value;
478
+ const viewInnerClss = computeViewInnerClss.value;
449
479
  const xOpts = computeXOpts.value;
450
480
  const yOpts = computeYOpts.value;
451
481
  const defaultSlot = slots.default;
452
482
  return (0, _vue.h)('div', {
453
483
  ref: refElem,
484
+ id: id || null,
454
485
  class: wrapperClss,
455
486
  style: wrapperStyle
456
- }, [(0, _vue.h)('div', {
487
+ }, [(0, _vue.h)('div', Object.assign({
457
488
  ref: refViewElem,
458
489
  class: viewClss,
459
490
  onScroll: scrollEvent
460
- }, [(0, _vue.h)('div', {
491
+ }, viewAttrs), [(0, _vue.h)('div', {
492
+ key: 'vi',
461
493
  ref: refViewInnerElem,
462
- class: 'vxe-scrollbar--view-inner'
494
+ class: viewInnerClss
463
495
  }, defaultSlot ? defaultSlot({}) : [])]), native || xOpts.visible === 'hidden' ? renderEmptyElement($xeScrollbar) : (0, _vue.h)('div', {
464
496
  ref: refTrackXElem,
465
497
  class: 'vxe-scrollbar--track-x',
@@ -490,6 +522,24 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
490
522
  })]);
491
523
  };
492
524
  const reFlag = (0, _vue.ref)(0);
525
+ (0, _vue.watch)(() => props.height, () => {
526
+ reFlag.value++;
527
+ });
528
+ (0, _vue.watch)(() => props.width, () => {
529
+ reFlag.value++;
530
+ });
531
+ (0, _vue.watch)(() => props.minHeight, () => {
532
+ reFlag.value++;
533
+ });
534
+ (0, _vue.watch)(() => props.minWidth, () => {
535
+ reFlag.value++;
536
+ });
537
+ (0, _vue.watch)(() => props.maxHeight, () => {
538
+ reFlag.value++;
539
+ });
540
+ (0, _vue.watch)(() => props.maxWidth, () => {
541
+ reFlag.value++;
542
+ });
493
543
  (0, _vue.watch)(() => props.native, () => {
494
544
  reFlag.value++;
495
545
  });
@@ -505,19 +555,23 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
505
555
  const {
506
556
  autoResize
507
557
  } = props;
558
+ const viewEl = refViewElem.value;
508
559
  const viewInnerEl = refViewInnerElem.value;
509
- if (autoResize && viewInnerEl) {
560
+ if (autoResize) {
510
561
  const resizeObserver = globalResize.create(() => {
511
562
  if (props.autoResize) {
512
563
  reFlag.value++;
513
564
  }
514
565
  });
515
- resizeObserver.observe(viewInnerEl);
566
+ if (viewEl) {
567
+ resizeObserver.observe(viewEl);
568
+ }
569
+ if (viewInnerEl) {
570
+ resizeObserver.observe(viewInnerEl);
571
+ }
516
572
  internalData.resizeObserver = resizeObserver;
517
573
  }
518
- (0, _vue.nextTick)(() => {
519
- $xeScrollbar.recalculate();
520
- });
574
+ reFlag.value++;
521
575
  });
522
576
  (0, _vue.onBeforeUnmount)(() => {
523
577
  const {
@@ -1 +1 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_comp=require("../../ui/src/comp"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_dom=require("../../ui/src/dom"),_util=require("./util"),_loading=_interopRequireDefault(require("../../loading"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let{getConfig,createEvent,domUtils,globalResize,renderEmptyElement}=_ui.VxeUI;function createReactData(){return{yThumbHeight:0,xThumbWidth:0}}function createInternalData(){return{thumbDragOffset:0,yThumbTop:0,xThumbLeft:0,lastScrollTop:0,lastScrollLeft:0}}var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeScrollbar",props:{width:[String,Number],height:[String,Number],minWidth:[String,Number],minHeight:[String,Number],maxWidth:[String,Number],maxHeight:[String,Number],loading:Boolean,native:{type:Boolean,default:()=>getConfig().scrollbar.native},xConfig:Object,yConfig:Object,className:String,viewClassName:String,autoResize:{type:Boolean,default:()=>getConfig().scrollbar.autoResize},syncResize:[Boolean,String,Number]},emits:["scroll","scroll-boundary"],setup(s,e){let{emit:l,slots:u}=e;var t=_xeUtils.default.uniqueId();let c=(0,_vue.ref)(),h=(0,_vue.ref)(),v=(0,_vue.ref)(),d=(0,_vue.ref)(),g=(0,_vue.ref)(),m=(0,_vue.ref)(),f=(0,_vue.ref)(),p=(0,_vue.reactive)(createReactData()),_=createInternalData(),b=(0,_vue.computed)(()=>{var{width:e,height:t,minWidth:i,minHeight:l,maxWidth:r,maxHeight:o}=s,a=C.value,n=H.value,u={};return e&&(u.width=(0,_dom.toCssUnit)(e)),t&&(u.height=(0,_dom.toCssUnit)(t)),i&&(u.minWidth=(0,_dom.toCssUnit)(i)),l&&(u.minHeight=(0,_dom.toCssUnit)(l)),r&&(u.maxWidth=(0,_dom.toCssUnit)(r)),o&&(u.maxHeight=(0,_dom.toCssUnit)(o)),n.width&&(u["--vxe-ui-scrollbar-y-width"]=(0,_dom.toCssUnit)(n.width)),a.height&&(u["--vxe-ui-scrollbar-x-height"]=(0,_dom.toCssUnit)(a.height)),u}),T=(0,_vue.computed)(()=>{var{native:e,className:t}=s,i=C.value,l=H.value;return domUtils.buildClass(["vxe-scrollbar","ov-x--"+(i.visible||"visible"),"ov-y--"+(l.visible||"visible"),e?"is--native":"is--virtual",t],{"ov-x--auto-hide":i.autoHide,"ov-y--auto-hide":l.autoHide})}),x=(0,_vue.computed)(()=>{var e=s.viewClassName;return domUtils.buildClass(["vxe-scrollbar--view",e])}),C=(0,_vue.computed)(()=>Object.assign({},getConfig().scrollbar.xConfig,s.xConfig)),H=(0,_vue.computed)(()=>Object.assign({},getConfig().scrollbar.yConfig,s.yConfig)),i={refElem:c},r={},y={xID:t,props:s,context:e,reactData:p,internalData:_,getRefMaps:()=>i,getComputeMaps:()=>r},W=(e,t,i)=>{l(e,createEvent(i,{$scrollbar:y},t))};t={dispatchEvent:W,scrollTo(e,t){var i=h.value;i&&(_xeUtils.default.isNumber(e)?i.scrollTo(e,t||0):i.scrollTo(e))},scrollIntoView(){var e=h.value;e&&e.scrollIntoView()},recalculate(){return o(),S(),(0,_vue.nextTick)()}};let o=()=>{var e,t,i=h.value;i&&(t=(t=d.value)?(0,_util.getThumbSize)(i.clientWidth,i.scrollWidth,t.clientWidth):0,(e=m.value)&&(e.style.width=t+"px"),p.xThumbWidth=t,t=(e=g.value)?(0,_util.getThumbSize)(i.clientHeight,i.scrollHeight,e.clientHeight):0,(i=f.value)&&(i.style.height=t+"px"),p.yThumbHeight=t)},S=()=>{var e,t,i,l,r=h.value;r&&({xThumbWidth:t,yThumbHeight:e}=p,l=d.value,i=m.value,l=l&&t?(0,_util.getThumbOffsetSize)(r.scrollLeft,r.clientWidth,r.scrollWidth,l.clientWidth,t):0,_.xThumbLeft=l,i&&t&&(i.style.width=t+"px",i.style.transform=`translateX(${l}px)`),t=g.value,i=f.value,l=t&&e?(0,_util.getThumbOffsetSize)(r.scrollTop,r.clientHeight,r.scrollHeight,t.clientHeight,e):0,_.yThumbTop=l,i)&&e&&(i.style.height=e+"px",i.style.transform=`translateY(${l}px)`)},D=e=>{var{xThumbWidth:t,yThumbHeight:i}=p,{lastScrollTop:l,lastScrollLeft:r}=_,o=C.value,a=H.value,{scrollTop:n,scrollLeft:u,clientWidth:s,clientHeight:c,scrollHeight:h,scrollWidth:v}=e.currentTarget;let d="",g=!1,m=!1,f=!1,b=!1;l!==n&&(a=_xeUtils.default.toNumber(a.threshold)||1,l<n?(d="bottom",0<i&&h-a<=n+c&&(m=!0)):(d="top",0<i&&n<=a&&(g=!0))),r!==u&&(l=_xeUtils.default.toNumber(o.threshold)||1,r<u?(d="right",0<t&&v-l<=u+s&&(b=!0)):(d="left",0<t&&u<=l&&(f=!0))),S(),_.lastScrollTop=n,_.lastScrollLeft=u,(m||g||b||f)&&W("scroll-boundary",{direction:d,isTop:g,isBottom:m,isLeft:f,isRight:b,scrollTop:n,scrollLeft:u,clientWidth:s,clientHeight:c,scrollHeight:h,scrollWidth:v},e),W("scroll",{direction:d,isTop:0<i&&n<=0,isBottom:0<i&&h<=n+c,isLeft:0<t&&u<=0,isRight:0<t&&v<=u+s,scrollTop:n,scrollLeft:u,clientWidth:s,clientHeight:c,scrollHeight:h,scrollWidth:v},e)},R=e=>{var t,i,l,r=e.currentTarget;r===e.target&&(t=h.value)&&(i=p.xThumbWidth,l=r.getBoundingClientRect(),t.scrollTo({left:(0,_util.getScrollFromClick)(e.clientX-l.left,t.clientWidth,t.scrollWidth,r.clientWidth,i),behavior:"auto"}))},w=e=>{var t,i,l,r=e.currentTarget;r===e.target&&(t=h.value)&&(i=p.yThumbHeight,l=r.getBoundingClientRect(),t.scrollTo({top:(0,_util.getScrollFromClick)(e.clientY-l.top,t.clientHeight,t.scrollHeight,r.clientHeight,i),behavior:"auto"}))},U=e=>{var t,i,l=e.currentTarget,r=(_.isThumbDrag=!0,l.setPointerCapture(e.pointerId),h.value);r&&(t=p.xThumbWidth,i=(l=l.parentElement).getBoundingClientRect(),e=e.clientX-i.left,i=(0,_util.getThumbOffsetSize)(r.scrollLeft,r.clientWidth,r.scrollWidth,l.clientWidth,t),_.thumbDragOffset=e-i)},O=t=>{let e=t.currentTarget;if(e.hasPointerCapture(t.pointerId)){var{isThumbDrag:i,thumbDragOffset:l}=_;if(i){i=h.value;if(i){var r=p.xThumbWidth;let e=t.currentTarget;var o=e.parentElement,a=o.getBoundingClientRect();i.scrollLeft=(0,_util.getScrollFromDrag)(t.clientX-a.left,l,i.clientWidth,i.scrollWidth,o.clientWidth,r)}}}},z=e=>{e.currentTarget.releasePointerCapture(e.pointerId),_.isThumbDrag=!1},N=e=>{var t,i,l=e.currentTarget,r=(_.isThumbDrag=!0,l.setPointerCapture(e.pointerId),h.value);r&&(t=p.yThumbHeight,i=(l=l.parentElement).getBoundingClientRect(),e=e.clientY-i.top,i=(0,_util.getThumbOffsetSize)(r.scrollTop,r.clientHeight,r.scrollHeight,l.clientHeight,t),_.thumbDragOffset=e-i)},L=t=>{let e=t.currentTarget;if(e.hasPointerCapture(t.pointerId)){var{isThumbDrag:i,thumbDragOffset:l}=_;if(i){i=h.value;if(i){var r=p.yThumbHeight;let e=t.currentTarget;var o=e.parentElement,a=o.getBoundingClientRect();i.scrollTop=(0,_util.getScrollFromDrag)(t.clientY-a.top,l,i.clientHeight,i.scrollHeight,o.clientHeight,r)}}}};Object.assign(y,t,{});let a=(0,_vue.ref)(0);return(0,_vue.watch)(()=>s.native,()=>{a.value++}),(0,_vue.watch)(()=>s.syncResize,()=>{a.value++}),(0,_vue.watch)(a,()=>{y.recalculate().then(()=>{y.recalculate()})}),(0,_vue.onMounted)(()=>{var e=s.autoResize,t=v.value;e&&t&&((e=globalResize.create(()=>{s.autoResize&&a.value++})).observe(t),_.resizeObserver=e),(0,_vue.nextTick)(()=>{y.recalculate()})}),(0,_vue.onBeforeUnmount)(()=>{var e=_.resizeObserver;e&&e.disconnect()}),y.renderVN=()=>{var{native:e,loading:t}=s,i=b.value,l=T.value,r=x.value,o=C.value,a=H.value,n=u.default;return(0,_vue.h)("div",{ref:c,class:l,style:i},[(0,_vue.h)("div",{ref:h,class:r,onScroll:D},[(0,_vue.h)("div",{ref:v,class:"vxe-scrollbar--view-inner"},n?n({}):[])]),e||"hidden"===o.visible?renderEmptyElement(y):(0,_vue.h)("div",{ref:d,class:"vxe-scrollbar--track-x",onClick:R},[(0,_vue.h)("div",{ref:m,class:"vxe-scrollbar--thumb-x",onPointerdown:U,onPointermove:O,onPointerup:z,onPointercancel:z,onLostpointercapture:z})]),e||"hidden"===a.visible?renderEmptyElement(y):(0,_vue.h)("div",{ref:g,class:"vxe-scrollbar--track-y",onClick:w},[(0,_vue.h)("div",{ref:f,class:"vxe-scrollbar--thumb-y",onPointerdown:N,onPointermove:L,onPointerup:z,onPointercancel:z,onLostpointercapture:z})]),(0,_vue.h)(_loading.default,{class:"vxe-scrollbar--loading",modelValue:t})])},y},render(){return this.renderVN()}});
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_comp=require("../../ui/src/comp"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_dom=require("../../ui/src/dom"),_util=require("./util"),_loading=_interopRequireDefault(require("../../loading"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let{getConfig,createEvent,domUtils,globalResize,renderEmptyElement}=_ui.VxeUI;function createReactData(){return{yThumbHeight:0,xThumbWidth:0}}function createInternalData(){return{thumbDragOffset:0,yThumbTop:0,xThumbLeft:0,lastScrollTop:0,lastScrollLeft:0}}var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeScrollbar",props:{id:[String,Number],width:[String,Number],height:[String,Number],minWidth:[String,Number],minHeight:[String,Number],maxWidth:[String,Number],maxHeight:[String,Number],loading:Boolean,native:{type:Boolean,default:()=>getConfig().scrollbar.native},xConfig:Object,yConfig:Object,className:{type:String,default:()=>getConfig().scrollbar.className},viewAttrs:{type:Object,default:()=>getConfig().scrollbar.viewAttrs},viewClassName:{type:String,default:()=>getConfig().scrollbar.viewClassName},viewInnerClassName:{type:String,default:()=>getConfig().scrollbar.viewInnerClassName},autoResize:{type:Boolean,default:()=>getConfig().scrollbar.autoResize},syncResize:[Boolean,String,Number]},emits:["scroll","scroll-boundary"],setup(h,e){let{emit:i,slots:v}=e;var t=_xeUtils.default.uniqueId();let d=(0,_vue.ref)(),g=(0,_vue.ref)(),m=(0,_vue.ref)(),f=(0,_vue.ref)(),b=(0,_vue.ref)(),p=(0,_vue.ref)(),_=(0,_vue.ref)(),T=(0,_vue.reactive)(createReactData()),x=createInternalData(),C=(0,_vue.computed)(()=>{var{width:e,height:t,minWidth:l,minHeight:i,maxWidth:r,maxHeight:a}=h,o=w.value,u=S.value,n={};return e&&(n.width=(0,_dom.toCssUnit)(e)),t&&(n.height=(0,_dom.toCssUnit)(t)),l&&(n.minWidth=(0,_dom.toCssUnit)(l)),i&&(n.minHeight=(0,_dom.toCssUnit)(i)),r&&(n.maxWidth=(0,_dom.toCssUnit)(r)),a&&(n.maxHeight=(0,_dom.toCssUnit)(a)),u.width&&(n["--vxe-ui-scrollbar-y-width"]=(0,_dom.toCssUnit)(u.width)),o.height&&(n["--vxe-ui-scrollbar-x-height"]=(0,_dom.toCssUnit)(o.height)),n}),y=(0,_vue.computed)(()=>{var{native:e,className:t}=h,{yThumbHeight:l,xThumbWidth:i}=T,r=w.value,a=S.value;return domUtils.buildClass(["vxe-scrollbar","ov-x--"+(r.visible||"visible"),"ov-y--"+(a.visible||"visible"),e?"is--native":"is--virtual",t],{"ov-x--auto-hide":r.autoHide,"ov-y--auto-hide":a.autoHide,"overflow-y":l,"overflow-x":i})}),H=(0,_vue.computed)(()=>{var e=h.viewClassName;return domUtils.buildClass(["vxe-scrollbar--view",e])}),W=(0,_vue.computed)(()=>{var e=h.viewInnerClassName;return domUtils.buildClass(["vxe-scrollbar--view-inner",e])}),w=(0,_vue.computed)(()=>Object.assign({},getConfig().scrollbar.xConfig,h.xConfig)),S=(0,_vue.computed)(()=>Object.assign({},getConfig().scrollbar.yConfig,h.yConfig)),l={refElem:d},r={},D={xID:t,props:h,context:e,reactData:T,internalData:x,getRefMaps:()=>l,getComputeMaps:()=>r},N=(e,t,l)=>{i(e,createEvent(l,{$scrollbar:D},t))};t={dispatchEvent:N,scrollTo(e,t){var l=g.value;l&&(_xeUtils.default.isNumber(e)?l.scrollTo(e,t||0):l.scrollTo(e))},scrollIntoView(){var e=g.value;e&&e.scrollIntoView()},recalculate(){return a(),R(),(0,_vue.nextTick)()}};let a=()=>{var e,t,l=g.value;l&&(t=(t=f.value)?(0,_util.getThumbSize)(l.clientWidth,l.scrollWidth,t.clientWidth):0,(e=p.value)&&(e.style.width=t+"px"),T.xThumbWidth=t,t=(e=b.value)?(0,_util.getThumbSize)(l.clientHeight,l.scrollHeight,e.clientHeight):0,(l=_.value)&&(l.style.height=t+"px"),T.yThumbHeight=t)},R=()=>{var e,t,l,i,r=g.value;r&&({xThumbWidth:t,yThumbHeight:e}=T,i=f.value,l=p.value,i=i&&t?(0,_util.getThumbOffsetSize)(r.scrollLeft,r.clientWidth,r.scrollWidth,i.clientWidth,t):0,x.xThumbLeft=i,l&&t&&(l.style.width=t+"px",l.style.transform=`translateX(${i}px)`),t=b.value,l=_.value,i=t&&e?(0,_util.getThumbOffsetSize)(r.scrollTop,r.clientHeight,r.scrollHeight,t.clientHeight,e):0,x.yThumbTop=i,l)&&e&&(l.style.height=e+"px",l.style.transform=`translateY(${i}px)`)},O=e=>{var{xThumbWidth:t,yThumbHeight:l}=T,{lastScrollTop:i,lastScrollLeft:r}=x,a=w.value,o=S.value,{scrollTop:u,scrollLeft:n,clientWidth:s,clientHeight:c,scrollHeight:h,scrollWidth:v}=e.currentTarget;let d="",g=!1,m=!1,f=!1,b=!1;i!==u&&(o=_xeUtils.default.toNumber(o.threshold)||1,i<u?(d="bottom",0<l&&h-o<=u+c&&(m=!0)):(d="top",0<l&&u<=o&&(g=!0))),r!==n&&(i=_xeUtils.default.toNumber(a.threshold)||1,r<n?(d="right",0<t&&v-i<=n+s&&(b=!0)):(d="left",0<t&&n<=i&&(f=!0))),R(),x.lastScrollTop=u,x.lastScrollLeft=n,(m||g||b||f)&&N("scroll-boundary",{direction:d,isTop:g,isBottom:m,isLeft:f,isRight:b,scrollTop:u,scrollLeft:n,clientWidth:s,clientHeight:c,scrollHeight:h,scrollWidth:v},e),N("scroll",{direction:d,isTop:0<l&&u<=0,isBottom:0<l&&h<=u+c,isLeft:0<t&&n<=0,isRight:0<t&&v<=n+s,scrollTop:u,scrollLeft:n,clientWidth:s,clientHeight:c,scrollHeight:h,scrollWidth:v},e)},U=e=>{var t,l,i,r=e.currentTarget;r===e.target&&(t=g.value)&&(l=T.xThumbWidth,i=r.getBoundingClientRect(),t.scrollTo({left:(0,_util.getScrollFromClick)(e.clientX-i.left,t.clientWidth,t.scrollWidth,r.clientWidth,l),behavior:"auto"}))},z=e=>{var t,l,i,r=e.currentTarget;r===e.target&&(t=g.value)&&(l=T.yThumbHeight,i=r.getBoundingClientRect(),t.scrollTo({top:(0,_util.getScrollFromClick)(e.clientY-i.top,t.clientHeight,t.scrollHeight,r.clientHeight,l),behavior:"auto"}))},I=e=>{var t,l,i=e.currentTarget,r=(x.isThumbDrag=!0,i.setPointerCapture(e.pointerId),g.value);r&&(t=T.xThumbWidth,l=(i=i.parentElement).getBoundingClientRect(),e=e.clientX-l.left,l=(0,_util.getThumbOffsetSize)(r.scrollLeft,r.clientWidth,r.scrollWidth,i.clientWidth,t),x.thumbDragOffset=e-l)},L=t=>{let e=t.currentTarget;if(e.hasPointerCapture(t.pointerId)){var{isThumbDrag:l,thumbDragOffset:i}=x;if(l){l=g.value;if(l){var r=T.xThumbWidth;let e=t.currentTarget;var a=e.parentElement,o=a.getBoundingClientRect();l.scrollLeft=(0,_util.getScrollFromDrag)(t.clientX-o.left,i,l.clientWidth,l.scrollWidth,a.clientWidth,r)}}}},E=e=>{e.currentTarget.releasePointerCapture(e.pointerId),x.isThumbDrag=!1},P=e=>{var t,l,i=e.currentTarget,r=(x.isThumbDrag=!0,i.setPointerCapture(e.pointerId),g.value);r&&(t=T.yThumbHeight,l=(i=i.parentElement).getBoundingClientRect(),e=e.clientY-l.top,l=(0,_util.getThumbOffsetSize)(r.scrollTop,r.clientHeight,r.scrollHeight,i.clientHeight,t),x.thumbDragOffset=e-l)},B=t=>{let e=t.currentTarget;if(e.hasPointerCapture(t.pointerId)){var{isThumbDrag:l,thumbDragOffset:i}=x;if(l){l=g.value;if(l){var r=T.yThumbHeight;let e=t.currentTarget;var a=e.parentElement,o=a.getBoundingClientRect();l.scrollTop=(0,_util.getScrollFromDrag)(t.clientY-o.top,i,l.clientHeight,l.scrollHeight,a.clientHeight,r)}}}};Object.assign(D,t,{});let o=(0,_vue.ref)(0);return(0,_vue.watch)(()=>h.height,()=>{o.value++}),(0,_vue.watch)(()=>h.width,()=>{o.value++}),(0,_vue.watch)(()=>h.minHeight,()=>{o.value++}),(0,_vue.watch)(()=>h.minWidth,()=>{o.value++}),(0,_vue.watch)(()=>h.maxHeight,()=>{o.value++}),(0,_vue.watch)(()=>h.maxWidth,()=>{o.value++}),(0,_vue.watch)(()=>h.native,()=>{o.value++}),(0,_vue.watch)(()=>h.syncResize,()=>{o.value++}),(0,_vue.watch)(o,()=>{D.recalculate().then(()=>{D.recalculate()})}),(0,_vue.onMounted)(()=>{var e=h.autoResize,t=g.value,l=m.value;e&&(e=globalResize.create(()=>{h.autoResize&&o.value++}),t&&e.observe(t),l&&e.observe(l),x.resizeObserver=e),o.value++}),(0,_vue.onBeforeUnmount)(()=>{var e=x.resizeObserver;e&&e.disconnect()}),D.renderVN=()=>{var{id:e,native:t,loading:l,viewAttrs:i}=h,r=C.value,a=y.value,o=H.value,u=W.value,n=w.value,s=S.value,c=v.default;return(0,_vue.h)("div",{ref:d,id:e||null,class:a,style:r},[(0,_vue.h)("div",Object.assign({ref:g,class:o,onScroll:O},i),[(0,_vue.h)("div",{key:"vi",ref:m,class:u},c?c({}):[])]),t||"hidden"===n.visible?renderEmptyElement(D):(0,_vue.h)("div",{ref:f,class:"vxe-scrollbar--track-x",onClick:U},[(0,_vue.h)("div",{ref:p,class:"vxe-scrollbar--thumb-x",onPointerdown:I,onPointermove:L,onPointerup:E,onPointercancel:E,onLostpointercapture:E})]),t||"hidden"===s.visible?renderEmptyElement(D):(0,_vue.h)("div",{ref:b,class:"vxe-scrollbar--track-y",onClick:z},[(0,_vue.h)("div",{ref:_,class:"vxe-scrollbar--thumb-y",onPointerdown:P,onPointermove:B,onPointerup:E,onPointercancel:E,onLostpointercapture:E})]),(0,_vue.h)(_loading.default,{class:"vxe-scrollbar--loading",modelValue:l})])},D},render(){return this.renderVN()}});
@@ -5,8 +5,6 @@
5
5
  .vxe-scrollbar.is--virtual > .vxe-scrollbar--view {
6
6
  scrollbar-width: none;
7
7
  -ms-overflow-style: none;
8
- overflow-x: auto;
9
- overflow-y: auto;
10
8
  }
11
9
  .vxe-scrollbar.is--virtual > .vxe-scrollbar--view::-webkit-scrollbar {
12
10
  display: none;
@@ -16,24 +14,14 @@
16
14
  }
17
15
  .vxe-scrollbar.is--virtual.ov-x--auto-hide > .vxe-scrollbar--track-x {
18
16
  opacity: 0;
19
- transition: opacity 0.3s ease-in-out;
17
+ transition: opacity 0.8s ease-in-out;
20
18
  }
21
19
  .vxe-scrollbar.is--virtual.ov-y--auto-hide:hover > .vxe-scrollbar--track-y {
22
20
  opacity: 1;
23
21
  }
24
22
  .vxe-scrollbar.is--virtual.ov-y--auto-hide > .vxe-scrollbar--track-y {
25
23
  opacity: 0;
26
- transition: opacity 0.3s ease-in-out;
27
- }
28
- .vxe-scrollbar.is--native > .vxe-scrollbar--view {
29
- overflow-x: auto;
30
- overflow-y: auto;
31
- }
32
- .vxe-scrollbar.is--native.ov-x--hidden > .vxe-scrollbar--view {
33
- overflow-x: hidden;
34
- }
35
- .vxe-scrollbar.is--native.ov-y--hidden > .vxe-scrollbar--view {
36
- overflow-y: hidden;
24
+ transition: opacity 0.8s ease-in-out;
37
25
  }
38
26
  .vxe-scrollbar.is--native > .vxe-scrollbar--view::-webkit-scrollbar {
39
27
  width: var(--vxe-ui-scrollbar-y-width);
@@ -49,14 +37,23 @@
49
37
  .vxe-scrollbar.is--native > .vxe-scrollbar--view::-webkit-scrollbar-thumb:active {
50
38
  background-color: var(--vxe-ui-scrollbar-thumb-active-background-color);
51
39
  }
40
+ .vxe-scrollbar.ov-x--hidden > .vxe-scrollbar--view {
41
+ overflow-x: hidden;
42
+ }
43
+ .vxe-scrollbar.ov-y--hidden > .vxe-scrollbar--view {
44
+ overflow-y: hidden;
45
+ }
52
46
 
53
47
  .vxe-scrollbar--view {
54
48
  height: 100%;
55
49
  width: 100%;
50
+ overflow-x: auto;
51
+ overflow-y: auto;
56
52
  }
57
53
 
58
54
  .vxe-scrollbar--track-x,
59
55
  .vxe-scrollbar--track-y {
56
+ display: none;
60
57
  position: absolute;
61
58
  background-color: var(--vxe-ui-scrollbar-track-background-color);
62
59
  -webkit-user-select: none;
@@ -64,11 +61,16 @@
64
61
  user-select: none;
65
62
  }
66
63
 
64
+ .vxe-scrollbar.overflow-y > .vxe-scrollbar--track-x, .vxe-scrollbar.overflow-y > .vxe-scrollbar--track-y {
65
+ display: block;
66
+ }
67
+
67
68
  .vxe-scrollbar--track-x {
68
69
  width: 100%;
69
70
  bottom: 0;
70
71
  left: 0;
71
72
  height: var(--vxe-ui-scrollbar-x-height);
73
+ padding: var(--vxe-ui-scrollbar-track-padding) 0;
72
74
  }
73
75
 
74
76
  .vxe-scrollbar--track-y {
@@ -76,6 +78,7 @@
76
78
  right: 0;
77
79
  top: 0;
78
80
  width: var(--vxe-ui-scrollbar-y-width);
81
+ padding: 0 var(--vxe-ui-scrollbar-track-padding);
79
82
  }
80
83
 
81
84
  .vxe-scrollbar--thumb-y {
@@ -88,7 +91,7 @@
88
91
 
89
92
  .vxe-scrollbar--thumb-x,
90
93
  .vxe-scrollbar--thumb-y {
91
- border-radius: var(--vxe-ui-base-border-radius);
94
+ border-radius: var(--vxe-ui-scrollbar-thumb-border-radius);
92
95
  background-color: var(--vxe-ui-scrollbar-thumb-background-color);
93
96
  }
94
97
  .vxe-scrollbar--thumb-x:hover,
@@ -1 +1 @@
1
- .vxe-scrollbar{width:100%;position:relative}.vxe-scrollbar.is--virtual>.vxe-scrollbar--view{scrollbar-width:none;-ms-overflow-style:none;overflow-x:auto;overflow-y:auto}.vxe-scrollbar.is--virtual>.vxe-scrollbar--view::-webkit-scrollbar{display:none}.vxe-scrollbar.is--virtual.ov-x--auto-hide:hover>.vxe-scrollbar--track-x{opacity:1}.vxe-scrollbar.is--virtual.ov-x--auto-hide>.vxe-scrollbar--track-x{opacity:0;transition:opacity .3s ease-in-out}.vxe-scrollbar.is--virtual.ov-y--auto-hide:hover>.vxe-scrollbar--track-y{opacity:1}.vxe-scrollbar.is--virtual.ov-y--auto-hide>.vxe-scrollbar--track-y{opacity:0;transition:opacity .3s ease-in-out}.vxe-scrollbar.is--native>.vxe-scrollbar--view{overflow-x:auto;overflow-y:auto}.vxe-scrollbar.is--native.ov-x--hidden>.vxe-scrollbar--view{overflow-x:hidden}.vxe-scrollbar.is--native.ov-y--hidden>.vxe-scrollbar--view{overflow-y:hidden}.vxe-scrollbar.is--native>.vxe-scrollbar--view::-webkit-scrollbar{width:var(--vxe-ui-scrollbar-y-width);height:var(--vxe-ui-scrollbar-x-height)}.vxe-scrollbar.is--native>.vxe-scrollbar--view::-webkit-scrollbar-thumb{border-radius:var(--vxe-ui-base-border-radius);background-color:var(--vxe-ui-scrollbar-thumb-background-color)}.vxe-scrollbar.is--native>.vxe-scrollbar--view::-webkit-scrollbar-thumb:hover{background-color:var(--vxe-ui-scrollbar-thumb-hover-background-color)}.vxe-scrollbar.is--native>.vxe-scrollbar--view::-webkit-scrollbar-thumb:active{background-color:var(--vxe-ui-scrollbar-thumb-active-background-color)}.vxe-scrollbar--view{height:100%;width:100%}.vxe-scrollbar--track-x,.vxe-scrollbar--track-y{position:absolute;background-color:var(--vxe-ui-scrollbar-track-background-color);-webkit-user-select:none;-moz-user-select:none;user-select:none}.vxe-scrollbar--track-x{width:100%;bottom:0;left:0;height:var(--vxe-ui-scrollbar-x-height)}.vxe-scrollbar--track-y{height:100%;right:0;top:0;width:var(--vxe-ui-scrollbar-y-width)}.vxe-scrollbar--thumb-y{width:100%}.vxe-scrollbar--thumb-x{height:100%}.vxe-scrollbar--thumb-x,.vxe-scrollbar--thumb-y{border-radius:var(--vxe-ui-base-border-radius);background-color:var(--vxe-ui-scrollbar-thumb-background-color)}.vxe-scrollbar--thumb-x:hover,.vxe-scrollbar--thumb-y:hover{background-color:var(--vxe-ui-scrollbar-thumb-hover-background-color)}.vxe-scrollbar--thumb-x:active,.vxe-scrollbar--thumb-y:active{background-color:var(--vxe-ui-scrollbar-thumb-active-background-color)}
1
+ .vxe-scrollbar{width:100%;position:relative}.vxe-scrollbar.is--virtual>.vxe-scrollbar--view{scrollbar-width:none;-ms-overflow-style:none}.vxe-scrollbar.is--virtual>.vxe-scrollbar--view::-webkit-scrollbar{display:none}.vxe-scrollbar.is--virtual.ov-x--auto-hide:hover>.vxe-scrollbar--track-x{opacity:1}.vxe-scrollbar.is--virtual.ov-x--auto-hide>.vxe-scrollbar--track-x{opacity:0;transition:opacity .8s ease-in-out}.vxe-scrollbar.is--virtual.ov-y--auto-hide:hover>.vxe-scrollbar--track-y{opacity:1}.vxe-scrollbar.is--virtual.ov-y--auto-hide>.vxe-scrollbar--track-y{opacity:0;transition:opacity .8s ease-in-out}.vxe-scrollbar.is--native>.vxe-scrollbar--view::-webkit-scrollbar{width:var(--vxe-ui-scrollbar-y-width);height:var(--vxe-ui-scrollbar-x-height)}.vxe-scrollbar.is--native>.vxe-scrollbar--view::-webkit-scrollbar-thumb{border-radius:var(--vxe-ui-base-border-radius);background-color:var(--vxe-ui-scrollbar-thumb-background-color)}.vxe-scrollbar.is--native>.vxe-scrollbar--view::-webkit-scrollbar-thumb:hover{background-color:var(--vxe-ui-scrollbar-thumb-hover-background-color)}.vxe-scrollbar.is--native>.vxe-scrollbar--view::-webkit-scrollbar-thumb:active{background-color:var(--vxe-ui-scrollbar-thumb-active-background-color)}.vxe-scrollbar.ov-x--hidden>.vxe-scrollbar--view{overflow-x:hidden}.vxe-scrollbar.ov-y--hidden>.vxe-scrollbar--view{overflow-y:hidden}.vxe-scrollbar--view{height:100%;width:100%;overflow-x:auto;overflow-y:auto}.vxe-scrollbar--track-x,.vxe-scrollbar--track-y{display:none;position:absolute;background-color:var(--vxe-ui-scrollbar-track-background-color);-webkit-user-select:none;-moz-user-select:none;user-select:none}.vxe-scrollbar.overflow-y>.vxe-scrollbar--track-x,.vxe-scrollbar.overflow-y>.vxe-scrollbar--track-y{display:block}.vxe-scrollbar--track-x{width:100%;bottom:0;left:0;height:var(--vxe-ui-scrollbar-x-height);padding:var(--vxe-ui-scrollbar-track-padding) 0}.vxe-scrollbar--track-y{height:100%;right:0;top:0;width:var(--vxe-ui-scrollbar-y-width);padding:0 var(--vxe-ui-scrollbar-track-padding)}.vxe-scrollbar--thumb-y{width:100%}.vxe-scrollbar--thumb-x{height:100%}.vxe-scrollbar--thumb-x,.vxe-scrollbar--thumb-y{border-radius:var(--vxe-ui-scrollbar-thumb-border-radius);background-color:var(--vxe-ui-scrollbar-thumb-background-color)}.vxe-scrollbar--thumb-x:hover,.vxe-scrollbar--thumb-y:hover{background-color:var(--vxe-ui-scrollbar-thumb-hover-background-color)}.vxe-scrollbar--thumb-x:active,.vxe-scrollbar--thumb-y:active{background-color:var(--vxe-ui-scrollbar-thumb-active-background-color)}
@@ -12,8 +12,8 @@ var _dom = require("../../ui/src/dom");
12
12
  var _utils = require("../../ui/src/utils");
13
13
  var _vn = require("../../ui/src/vn");
14
14
  var _log = require("../../ui/src/log");
15
- var _input = _interopRequireDefault(require("../../input/src/input"));
16
- var _button = _interopRequireDefault(require("../../button/src/button"));
15
+ var _input = _interopRequireDefault(require("../../input"));
16
+ var _button = _interopRequireDefault(require("../../button"));
17
17
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
18
  const {
19
19
  errLog
@@ -1 +1 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_comp=require("../../ui/src/comp"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_dom=require("../../ui/src/dom"),_utils=require("../../ui/src/utils"),_vn=require("../../ui/src/vn"),_log=require("../../ui/src/log"),_input=_interopRequireDefault(require("../../input/src/input")),_button=_interopRequireDefault(require("../../button/src/button"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let errLog=(0,_log.createComponentLog)("select").errLog;function isOptionVisible(e){return!1!==e.visible}function getOptUniqueId(){return _xeUtils.default.uniqueId("opt_")}function createReactData(){return{initialized:!1,scrollYLoad:!1,bodyHeight:0,topSpaceHeight:0,optList:[],staticOptions:[],reactFlag:0,currentOption:null,searchValue:"",searchLoading:!1,panelIndex:0,panelStyle:{},panelPlacement:null,triggerFocusPanel:!1,visiblePanel:!1,isAniVisible:!1,isActivated:!1}}function createInternalData(){return{synchData:[],fullData:[],afterVisibleList:[],optAddMaps:{},optGroupKeyMaps:{},optFullValMaps:{},remoteValMaps:{},lastScrollLeft:0,lastScrollTop:0,scrollYStore:{startIndex:0,endIndex:0,visibleSize:0,offsetSize:0,rowHeight:0},lastScrollTime:0,hpTimeout:void 0}}var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeSelect",props:{modelValue:[String,Number,Boolean,Array],defaultConfig:Object,emptyValue:{type:[String,Number,Boolean,Array],default:()=>(0,_ui.getConfig)().select.emptyValue},clearable:{type:Boolean,default:()=>(0,_ui.getConfig)().select.clearable},placeholder:String,readonly:{type:Boolean,default:null},loading:Boolean,disabled:{type:Boolean,default:null},multiple:Boolean,multiCharOverflow:{type:[Number,String],default:()=>(0,_ui.getConfig)().select.multiCharOverflow},prefixIcon:String,allowCreate:{type:Boolean,default:()=>(0,_ui.getConfig)().select.allowCreate},placement:String,lazyOptions:Array,options:Array,optionProps:Object,optionGroups:Array,optionGroupProps:Object,optionConfig:Object,className:[String,Function],popupClassName:[String,Function],width:[String,Number],max:{type:[String,Number],default:null},showRadio:{type:Boolean,default:()=>(0,_ui.getConfig)().select.showRadio},radioConfig:Object,showCheckbox:{type:Boolean,default:()=>(0,_ui.getConfig)().select.showCheckedButton},checkboxConfig:Object,zIndex:Number,size:{type:String,default:()=>(0,_ui.getConfig)().select.size||(0,_ui.getConfig)().size},filterable:Boolean,filterMethod:Function,filterConfig:Object,remote:Boolean,remoteConfig:Object,emptyText:String,checkedClosable:{type:Boolean,default:()=>(0,_ui.getConfig)().select.checkedClosable},clearClosable:{type:Boolean,default:()=>(0,_ui.getConfig)().select.clearClosable},showCloseButton:{type:Boolean,default:()=>(0,_ui.getConfig)().select.showCloseButton},showTotalButton:{type:Boolean,default:()=>(0,_ui.getConfig)().select.showTotalButton},showCheckedButton:{type:Boolean,default:()=>(0,_ui.getConfig)().select.showCheckedButton},showClearButton:{type:Boolean,default:()=>(0,_ui.getConfig)().select.showClearButton},transfer:{type:Boolean,default:null},popupConfig:Object,virtualYConfig:Object,scrollY:Object,remoteMethod:Function,optionId:{type:String,default:()=>(0,_ui.getConfig)().select.optionId},optionKey:Boolean},emits:["update:modelValue","change","default-change","all-change","clear","blur","focus","click","scroll","visible-change"],setup(k,e){let{slots:w,emit:a}=e,n=(0,_vue.inject)("$xeModal",null),C=(0,_vue.inject)("$xeDrawer",null),E=(0,_vue.inject)("$xeTable",null),y=(0,_vue.inject)("$xeCard",null),i=(0,_vue.inject)("$xeForm",null),T=(0,_vue.inject)("xeFormItemInfo",null);var t=_xeUtils.default.uniqueId();let P=(0,_vue.ref)(),B=(0,_vue.ref)(),R=(0,_vue.ref)(),D=(0,_vue.ref)(),A=(0,_vue.ref)(),$=(0,_vue.ref)(),G=(0,_ui.useSize)(k).computeSize,M=(0,_vue.reactive)(createReactData()),U=createInternalData(),O={refElem:P},N={xID:t,props:k,context:e,reactData:M,internalData:U,getRefMaps:()=>O},X=(0,_vue.computed)(()=>{var e=k.readonly;return null===e?!!i&&i.props.readonly:e}),j=(0,_vue.computed)(()=>{var e=k.disabled;return null===e?!!i&&i.props.disabled:e}),W=(0,_vue.computed)(()=>{var e=k.transfer,t=H.value;if(_xeUtils.default.isBoolean(t.transfer))return t.transfer;if(null===e){t=(0,_ui.getConfig)().select.transfer;if(_xeUtils.default.isBoolean(t))return t;if(E||n||C||y||i)return!0}return e}),Z=(0,_vue.computed)(()=>{var e=k.placeholder;return(e=e||(0,_ui.getConfig)().select.placeholder)?(0,_utils.getFuncText)(e):(0,_ui.getI18n)("vxe.base.pleaseSelect")}),I=(0,_vue.computed)(()=>Object.assign({},k.defaultConfig)),S=(0,_vue.computed)(()=>Object.assign({},k.optionProps)),V=(0,_vue.computed)(()=>Object.assign({},k.optionGroupProps)),v=(0,_vue.computed)(()=>S.value.label||"label"),F=(0,_vue.computed)(()=>S.value.value||"value"),J=(0,_vue.computed)(()=>V.value.label||"label"),L=(0,_vue.computed)(()=>V.value.options||"options"),Q=(0,_vue.computed)(()=>{var e=z.value;return de(e)}),H=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().select.popupConfig,k.popupConfig)),ee=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().select.virtualYConfig||(0,_ui.getConfig)().select.scrollY,k.virtualYConfig||k.scrollY)),r=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().select.remoteConfig,k.remoteConfig)),te=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().select.filterConfig,k.filterConfig)),le=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().select.optionConfig,k.optionConfig)),ae=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().select.radioConfig,k.radioConfig)),ie=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().select.checkboxConfig,k.checkboxConfig)),oe=(0,_vue.computed)(()=>_xeUtils.default.toNumber(k.multiCharOverflow)),ne=(0,_vue.computed)(()=>{var e=k.width,t={};return e&&(t.width=(0,_dom.toCssUnit)(e)),t}),ue=(0,_vue.computed)(()=>{var{height:e,width:t}=H.value,l={};return t&&(l.width=(0,_dom.toCssUnit)(t)),e&&(l.height=(0,_dom.toCssUnit)(e),l.maxHeight=(0,_dom.toCssUnit)(e)),l}),z=(0,_vue.computed)(()=>{var{modelValue:e,multiple:t}=k;let l=[];return _xeUtils.default.isArray(e)?l=e:t?(0,_utils.eqEmptyValue)(e)||(l=-1<(""+e).indexOf(",")?(""+e).split(","):[e]):l=null==e?[]:[e],l}),re=(0,_vue.computed)(()=>{var e=k.remote,t=M.reactFlag,l=z.value;return(e&&t?l.map(e=>pe(e)):l.map(e=>fe(e))).join(", ")}),se=(0,_vue.computed)(()=>{var{remote:e,multiple:t}=k,l=M.reactFlag,a=oe.value,i=z.value;return e&&l?i.map(e=>pe(e)).join(", "):(e=i.map(e=>fe(e)),t&&0<a&&e.length>a?e.slice(0,a)+"...":e.join(", "))}),K=(e,t)=>e&&(_xeUtils.default.isString(e)&&(e=w[e]||null),_xeUtils.default.isFunction(e))?(0,_vn.getSlotVNs)(e(t)):[],s=(e,t,l)=>{a(e,(0,_ui.createEvent)(l,{$select:N},t))},ce=e=>{a("update:modelValue",e)},ve=e=>{ce(e),s("default-change",{value:e},null)},c=()=>le.value.keyField||k.optionId||"_X_OPTION_KEY",Y=e=>{e=e[c()];return e?encodeURIComponent(e):""},de=e=>{var{multiple:t,max:l}=k;return!(!t||!l)&&e.length>=_xeUtils.default.toNumber(l)},pe=t=>{var e=k.lazyOptions,{remoteValMaps:l,optFullValMaps:a}=U;let i=F.value;var o=v.value,l=l[t]||a[t],a=l?l.item:null;if(a)return _xeUtils.default.toValueString(a[o]);if(e){l=e.find(e=>e[i]===t);if(l)return l[o]}return t},fe=t=>{var e=k.lazyOptions,l=U.optFullValMaps;let a=F.value;var i=v.value,l=M.reactFlag?l[t]:null;if(l)return l.item[i];if(e){l=e.find(e=>e[a]===t);if(l)return l[i]}return t},d=()=>{let{remote:e,modelValue:t,filterable:l}=k,a=M.searchValue,{fullData:i,optFullValMaps:o}=U,n=v.value,u=F.value;let r=te.value.filterMethod||k.filterMethod,s=(""+(a||"")).toLowerCase(),c=[];return(c=e?i.filter(isOptionVisible):l&&r?i.filter(e=>isOptionVisible(e)&&r({$select:N,group:null,option:e,searchValue:a,value:t})):l?i.filter(e=>isOptionVisible(e)&&(!s||-1<(""+(e[n]||e[u])).toLowerCase().indexOf(s))):i.filter(isOptionVisible)).forEach((e,t)=>{e=o[e[u]];e&&(e._index=t)}),U.afterVisibleList=c,(0,_vue.nextTick)()},ge=e=>{e&&(M.currentOption=e)},_e=()=>{var e=H.value.zIndex||k.zIndex;e?M.panelIndex=_xeUtils.default.toNumber(e):M.panelIndex<(0,_utils.getLastZIndex)()&&(M.panelIndex=(0,_utils.nextZIndex)())},p=()=>{let l=k.placement,a=M.panelIndex,i=P.value,o=A.value,n=W.value,u=H.value;var e=()=>{var e=(0,_dom.updatePanelPlacement)(i,o,{placement:u.placement||l,defaultPlacement:u.defaultPlacement,teleportTo:n}),t=Object.assign(e.style,{zIndex:a});M.panelStyle=t,M.panelPlacement=e.placement};return e(),(0,_vue.nextTick)().then(e)},he=()=>{(0,_vue.nextTick)(()=>{var{isAniVisible:e,visiblePanel:t}=M,l=U.optFullValMaps,a=z.value;a.length&&e&&t&&(e=M.reactFlag?l[""+a[0]]:null)&&(M.currentOption=e.item,ze(e.item))})},f=()=>{var{loading:e,filterable:t,remote:l}=k,{fullData:a,hpTimeout:i}=U,o=j.value,n=r.value;let u=z.value;e||o||(i&&(clearTimeout(i),U.hpTimeout=void 0),M.initialized||(M.initialized=!0),M.isActivated=!0,M.isAniVisible=!0,t&&(l&&n.enabled&&(n.autoLoad&&!a.length||a.length&&n.clearOnClose)?Ae:(d(),m))(),setTimeout(()=>{M.visiblePanel=!0,Ve(),x().then(()=>{(u&&u.length?he:b)()}),p()},10),setTimeout(()=>{x().then(()=>b())},100),_e(),p(),s("visible-change",{visible:!0},null))},g=e=>{var{filterable:t,remote:l}=k,a=te.value,i=r.value;l?i.clearOnClose&&(M.searchValue=""):t&&!a.clearOnClose||(M.searchValue=""),M.searchLoading=!1,M.visiblePanel=!1,U.hpTimeout=setTimeout(()=>{M.isAniVisible=!1},350),s("visible-change",{visible:!1},e||null)},u=(e,t,l)=>{ce(t),t!==k.modelValue&&(s("change",{value:t,option:l},e),i)&&T&&i.triggerItemEvent(e,T.itemConfig.field,t)},_=(e,t)=>{U.remoteValMaps={},u(e,t,null),s("clear",{value:t},e)},me=e=>{var t=k.emptyValue,e=e.$event;_(e,t),g(e)},be=e=>{var e=e.$event,{multiple:t,max:l,checkedClosable:a}=k,i=M.optList,o=F.value;if(t){var n=z.value.slice(0);for(let e=0;e<i.length;e++){let t=i[e][o];if(de(n)){_ui.VxeUI&&_ui.VxeUI.modal.message({content:(0,_ui.getI18n)("vxe.select.overSizeErr",[l]),status:"warning"});break}n.some(e=>e===t)||n.push(t)}u(e,n,i[0]),a&&g(e),s("all-change",{value:n},e)}},xe=e=>{var{emptyValue:t,clearClosable:l}=k,e=e.$event;_(e,t),l&&g(e)},Ce=e=>{e=e.$event;g(e)},q=(t,l)=>{var e=k.multiple,a=U.remoteValMaps;let i=l[F.value];var o=a[i];if(M.visiblePanel){if(o?o.item=l:a[i]={key:Y(l),item:l,_index:-1},e){let e=[];o=z.value,a=_xeUtils.default.findIndexOf(o,e=>e===i);e=-1===a?o.concat([i]):o.filter(e=>e!==i),u(t,e,l)}else u(t,i,l),g(t);M.reactFlag++}},Ee=e=>{var t,l=M.visiblePanel,a=j.value,i=H.value.trigger;a||(a=P.value,t=A.value,M.isActivated=(0,_dom.getEventTargetNode)(e,a).flag||(0,_dom.getEventTargetNode)(e,t).flag,l&&!M.isActivated&&"manual"!==i&&g(e))},h=e=>{var t=e.disabled,e=Y(e);return!t&&!$e(e)},ye=(e,t)=>{var l=k.allowCreate,a=M.optList,{optFullValMaps:i,optAddMaps:o,afterVisibleList:n}=U,u=F.value;let r=n,s=0;if(l&&a.length&&(n=a[0],o[l=Y(n)])&&(s=1,r=[o[l]].concat(r)),!e)if(t)for(let e=0;e<r.length;e++){var c=r[e];if(h(c))return c}else for(let e=r.length-1;0<=e;e--){var v=r[e];if(h(v))return v}let d=0;a=e?i[e[u]]:null;if(-1<(d=a?a._index+s:d))if(t)for(let e=d+1;e<=r.length-1;e++){var p=r[e];if(h(p))return p}else if(0<d)for(let e=d-1;0<=e;e--){var f=r[e];if(h(f))return f}return null},Te=t=>{var{emptyValue:e,clearable:l}=k,{visiblePanel:a,currentOption:i}=M,o=j.value,n=H.value.trigger;if(!o){var o=_ui.globalEvents.hasKey(t,_ui.GLOBAL_EVENT_KEYS.TAB),u=_ui.globalEvents.hasKey(t,_ui.GLOBAL_EVENT_KEYS.ENTER),r=_ui.globalEvents.hasKey(t,_ui.GLOBAL_EVENT_KEYS.ESCAPE),s=_ui.globalEvents.hasKey(t,_ui.GLOBAL_EVENT_KEYS.ARROW_UP),c=_ui.globalEvents.hasKey(t,_ui.GLOBAL_EVENT_KEYS.ARROW_DOWN),v=_ui.globalEvents.hasKey(t,_ui.GLOBAL_EVENT_KEYS.DELETE);if(o&&(M.isActivated=!1),a){if(r||o)"manual"!==n&&g(t);else if(u)i&&(t.preventDefault(),t.stopPropagation(),q(t,i));else if(s||c){t.preventDefault();let e=ye(i,c);(e=e||ye(null,c))&&(ge(e),ze(e,c))}}else(s||c||u)&&M.isActivated&&(t.preventDefault(),f());M.isActivated&&v&&l&&_(t,e)}},Oe=e=>{var{visiblePanel:t,isActivated:l}=M,a=H.value.trigger;t&&"manual"!==a&&g(e),l&&(M.isActivated=!1),(t||l)&&(a=B.value)&&a.blur()},Ie=()=>{var e=M.visiblePanel;e&&p()},Se=()=>{var e=M.visiblePanel;e&&p()},Ve=()=>{k.filterable&&(0,_vue.nextTick)(()=>{var e=R.value;e&&e.focus()})},Le=e=>{var t=j.value,l=H.value.trigger;t||M.visiblePanel||l&&"default"!==l||(M.triggerFocusPanel=!0,f(),setTimeout(()=>{M.triggerFocusPanel=!1},500)),s("focus",{},e)},ke=e=>{var t=H.value.trigger;t&&"default"!==t||Ue(e),s("click",{triggerButton:!1,visible:M.visiblePanel},e)},we=e=>{M.isActivated=!1,s("blur",{},e)},Pe=e=>{var t=H.value.trigger;t&&"default"!==t&&"icon"!==t||Ue(e),s("click",{triggerButton:!0,visible:M.visiblePanel},e)},Be=e=>{M.searchValue=e},De=()=>{M.isActivated=!0},Ae=()=>{var{modelValue:e,remote:t}=k,l=M.searchValue,a=r.value,i=a.queryMethod||k.remoteMethod;t&&i&&a.enabled?(M.searchLoading=!0,Promise.resolve(i({$select:N,searchValue:l,value:e})).then(()=>(0,_vue.nextTick)()).catch(()=>(0,_vue.nextTick)()).finally(()=>{M.searchLoading=!1,d(),m()})):(d(),m())},Me=_xeUtils.default.debounce(Ae,350,{trailing:!0}),Ue=e=>{e=e.$event;e.preventDefault(),M.triggerFocusPanel?M.triggerFocusPanel=!1:M.visiblePanel?g(e):f()},Ne=(e,t)=>!!t.disabled||!(!Q.value||e),je=()=>{var e=M.scrollYLoad,{scrollYStore:t,afterVisibleList:l}=U;M.bodyHeight=e?l.length*t.rowHeight:0,M.topSpaceHeight=e?Math.max(t.startIndex*t.rowHeight,0):0},Fe=()=>{var{filterable:e,allowCreate:t}=k;let{scrollYLoad:l,searchValue:a}=M;var{optAddMaps:i,scrollYStore:o,afterVisibleList:n}=U;let u=v.value;var r=F.value,o=l?n.slice(o.startIndex,o.endIndex):n.slice(0);return e&&t&&a&&(o.some(e=>e[u]===a)||(n=i[a]||(0,_vue.reactive)({[c()]:a,[u]:a,[r]:a}),i[a]=n,o.unshift(n))),M.optList=o,(0,_vue.nextTick)()},m=()=>{Fe(),je()},He=()=>(0,_vue.nextTick)().then(()=>{var e=M.scrollYLoad,t=U.scrollYStore,l=$.value,a=ee.value;let i=0,o;(o=l?o||l.children[0]:o)&&(i=o.offsetHeight),i=Math.max(20,i),t.rowHeight=i,(e?(l=D.value,e=Math.max(8,l?Math.ceil(l.clientHeight/i):0),l=Math.max(0,Math.min(2,_xeUtils.default.toNumber(a.oSize))),t.offsetSize=l,t.visibleSize=e,t.endIndex=Math.max(t.startIndex,e+l,t.endIndex),m):je)()}),ze=(e,t)=>{var l,a,{optFullValMaps:i,scrollYStore:o}=U,i=i[e[F.value]];i&&(e=i.key,-1<(i=i._index))&&(l=D.value,a=A.value)&&(a=a.querySelector(`[optid='${e}']`),l)&&(a?(e=l.offsetHeight,t?Math.ceil(a.offsetTop+a.offsetHeight-l.scrollTop)>=e?l.scrollTop=a.offsetTop+a.offsetHeight-e:(a.offsetTop+1<l.scrollTop||a.offsetTop+1>l.scrollTop+l.clientHeight)&&(l.scrollTop=a.offsetTop-1):a.offsetTop+1<l.scrollTop||a.offsetTop+1>l.scrollTop+l.clientHeight?l.scrollTop=a.offsetTop-1:a.offsetTop+a.offsetHeight-l.scrollTop>e&&(l.scrollTop=a.offsetTop+a.offsetHeight-e)):l.scrollTop=t?i*o.rowHeight-l.clientHeight+o.rowHeight:i*o.rowHeight)},Ke=(e,t)=>{var l=D.value;return l&&(_xeUtils.default.isNumber(e)&&(l.scrollLeft=e),_xeUtils.default.isNumber(t))&&(l.scrollTop=t),M.scrollYLoad?new Promise(e=>{setTimeout(()=>{(0,_vue.nextTick)(()=>{e()})},50)}):(0,_vue.nextTick)()},b=()=>{let{lastScrollLeft:e,lastScrollTop:t}=U;return o().then(()=>{if(e||t)return U.lastScrollLeft=0,U.lastScrollTop=0,Ke(e,t)})},x=()=>{var e=P.value;return e&&e.clientWidth&&e.clientHeight?He():Promise.resolve()},Ye=e=>{var t=U.scrollYStore,{startIndex:l,endIndex:a,visibleSize:i,offsetSize:o,rowHeight:n}=t,e=e.target.scrollTop,e=Math.floor(e/n),n=Math.max(0,e-1-o),o=e+i+o;!(e<=l||a-i-1<=e)||l===n&&a===o||(t.startIndex=n,t.endIndex=o,m())},qe=()=>{var e=U.lastScrollTime;return!!(e&&Date.now()<e+250)},Re=e=>{var t=e.target,l=t.scrollTop,t=t.scrollLeft,a=t!==U.lastScrollLeft,i=l!==U.lastScrollTop;U.lastScrollTop=l,U.lastScrollLeft=t,M.scrollYLoad&&Ye(e),U.lastScrollTime=Date.now(),s("scroll",{scrollLeft:t,scrollTop:l,isX:a,isY:i},e)},l=t=>{(e=>{let t=L.value,l=F.value,a=c(),i={},o={},n=[],u=e=>{n.push(e);let t=Y(e);t||(t=getOptUniqueId(),e[a]=t),o[e[l]]={key:t,item:e,_index:-1}};e.forEach(e=>{u(e),e[t]&&(i[e[a]]=e)[t].forEach(u)}),U.fullData=n,U.optGroupKeyMaps=i,U.optFullValMaps=o,M.reactFlag++,d()})(t||[]);var e=k.multiple,{isLoaded:l,fullData:a,scrollYStore:i}=U,o=I.value,n=ee.value;let u=F.value;if(Object.assign(i,{startIndex:0,endIndex:1,visibleSize:0}),U.synchData=t||[],M.scrollYLoad=!!n.enabled&&-1<n.gt&&(0===n.gt||n.gt<=a.length),Fe(),!l){i=o.selectMode;if(0<t.length&&_xeUtils.default.eqNull(k.modelValue)){if("all"===i)e?(0,_vue.nextTick)(()=>{ve(t.map(e=>e[u]))}):errLog("vxe.error.notConflictProp",["default-config.selectMode=all","multiple=true"]);else if("first"===i||"last"===i){let e=_xeUtils.default[i](t);e&&(0,_vue.nextTick)(()=>{_xeUtils.default.eqNull(k.modelValue)&&ve(e[u])})}U.isLoaded=!0}}return He().then(()=>{b()})},o=()=>{var e=D.value;return e&&(e.scrollTop=0,e.scrollLeft=0),U.lastScrollTop=0,(U.lastScrollLeft=0,_vue.nextTick)()},$e=e=>{var t=U.optGroupKeyMaps;return!!t[e]};t={dispatchEvent:s,loadData:l,reloadData(e){return U.isLoaded=!1,o(),l(e)},isPanelVisible(){return M.visiblePanel},togglePanel(){return(M.visiblePanel?g:f)(),(0,_vue.nextTick)()},hidePanel(){return M.visiblePanel&&g(),(0,_vue.nextTick)()},showPanel(){return M.visiblePanel||f(),(0,_vue.nextTick)()},refreshOption(){return d(),m(),(0,_vue.nextTick)()},focus(){var e=B.value;return e&&e.blur(),M.isActivated=!0,(0,_vue.nextTick)()},blur(){var e=B.value;return e&&e.blur(),(M.isActivated=!1,_vue.nextTick)()},recalculate:x,clearScroll:o};Object.assign(N,t);let Ge=(t,l,e,a)=>{var{showIcon:i,trigger:o}=ae.value;return l||!1===i?(0,_ui.renderEmptyElement)(N):(i={},o&&"default"!==o||(i.onClick=e=>{a||l||q(e,t)}),(0,_vue.h)("div",Object.assign({key:2,class:["vxe-select-option--radio",{"is--checked":e,"is--disabled":a}]},i),[(0,_vue.h)("span",{class:["vxe-radio--icon",e?(0,_ui.getIcon)().RADIO_CHECKED:a?(0,_ui.getIcon)().RADIO_DISABLED_UNCHECKED:(0,_ui.getIcon)().RADIO_UNCHECKED]})]))},Xe=(t,l,e,a)=>{var{showIcon:i,trigger:o}=ie.value;return l||!1===i?(0,_ui.renderEmptyElement)(N):(i={},o&&"default"!==o||(i.onClick=e=>{a||l||q(e,t)}),(0,_vue.h)("div",Object.assign({key:3,class:["vxe-select-option--checkbox",{"is--checked":e,"is--disabled":a}]},i),[(0,_vue.h)("span",{class:["vxe-checkbox--icon",e?(0,_ui.getIcon)().CHECKBOX_CHECKED:a?(0,_ui.getIcon)().CHECKBOX_DISABLED_UNCHECKED:(0,_ui.getIcon)().CHECKBOX_UNCHECKED]})]))},We=e=>{let{allowCreate:g,optionKey:_,multiple:t,showRadio:l,showCheckbox:a}=k,h=M.currentOption,m=U.optAddMaps;var i=le.value;let b=v.value,x=F.value,C=J.value,E=z.value,y=ae.value,T=ie.value,{useKey:O,height:I}=i,S=w.option,V=a&&t,L=l&&!t;return e.map((t,e)=>{var{slots:l,className:a}=t,i=Y(t),o=t[x];let n=$e(i);var u=!(!g||!m[i]),r=!u&&-1<E.indexOf(o),s=u||!n||isOptionVisible(t);let c=!u&&Ne(r,t);var l=(l?l.default:null)||S,v={option:t,group:n?t:null,$select:N};let d="";var p=[];V?p.push(Xe(t,n,r,c)):L&&p.push(Ge(t,n,r,c));let f=[];f=l?K(l,v):[d=(0,_utils.getFuncText)(t[n?C:b]||o)],p.push((0,_vue.h)("div",{key:1,class:"vxe-select-option--label"},f));l={onMousedown:e=>{0===e.button&&e.stopPropagation()},onMouseenter:()=>{c||n||qe()||ge(t)}};return(V?"option"!==T.trigger:L&&"option"!==y.trigger)||(l.onClick=e=>{c||n||q(e,t)}),s?(0,_vue.h)("div",Object.assign({key:O||_?i:e,class:["vxe-select-option",a?_xeUtils.default.isFunction(a)?a(v):a:"",{"vxe-select-optgroup":n,"is--disabled":c,"is--selected":r,"is--add":u,"is--hover":h&&Y(h)===i}],optid:i,title:d||null,style:I?{height:(0,_dom.toCssUnit)(I)}:void 0},l),g?[(0,_vue.h)("div",{key:1,class:"vxe-select-option--add-label"},p),u?(0,_vue.h)("div",{key:2,class:"vxe-select-option--add-icon"},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().SELECT_ADD_OPTION})]):(0,_ui.renderEmptyElement)(N)]:p):(0,_ui.renderEmptyElement)(N)})};return(0,_vue.watch)(()=>M.staticOptions,e=>{l(e)}),(0,_vue.watch)(()=>k.options,e=>{l(e||[])}),(0,_vue.watch)(()=>k.optionGroups,e=>{l(e||[])}),(0,_vue.onMounted)(()=>{(0,_vue.nextTick)(()=>{var{options:e,optionGroups:t}=k;t?l(t):e&&l(e)}),_ui.globalEvents.on(N,"mousedown",Ee),_ui.globalEvents.on(N,"keydown",Te),_ui.globalEvents.on(N,"blur",Oe),_ui.globalEvents.on(N,"resize",Ie),_ui.globalEvents.on(N,"scroll",Se)}),(0,_vue.onUnmounted)(()=>{_ui.globalEvents.off(N,"mousedown"),_ui.globalEvents.off(N,"keydown"),_ui.globalEvents.off(N,"blur"),_ui.globalEvents.off(N,"resize"),_ui.globalEvents.off(N,"scroll"),_xeUtils.default.assign(M,createReactData()),_xeUtils.default.assign(U,createInternalData())}),(0,_vue.provide)("$xeSelect",N),N.renderVN=()=>{var{className:e,multiple:t,loading:l,filterable:a,showTotalButton:i,showCheckedButton:o,showClearButton:n,showCloseButton:u}=k,{initialized:r,isActivated:s,isAniVisible:c,optList:v,visiblePanel:d,bodyHeight:p,topSpaceHeight:f}=M,g=G.value,_=j.value,h=se.value,m=re.value,b=W.value,x=X.value,C=Z.value,E=w.default;if(x)return(0,_vue.h)("div",{ref:P,class:["vxe-select--readonly",e]},[(0,_vue.h)("div",{class:"vxe-select-slots",ref:"hideOption"},E?E({}):[]),(0,_vue.h)("span",{class:"vxe-select-label",title:m},h)]);var x=ne.value,y=z.value,T=ue.value,O=H.value,I=w.header,S=w.footer;let V=w.prefix;var L=O.appendTo,O=O.className||k.popupClassName;return(0,_vue.h)("div",{ref:P,class:["vxe-select",e?_xeUtils.default.isFunction(e)?e({$select:N}):e:"",{["size--"+g]:g,"is--visible":d,"is--disabled":_,"is--filter":a,"is--loading":l,"is--active":s}],style:x},[(0,_vue.h)("div",{class:"vxe-select-slots",ref:"hideOption"},E?E({}):[]),(0,_vue.h)(_input.default,{ref:B,clearable:k.clearable,placeholder:C,editable:!1,disabled:_,type:"text",prefixIcon:k.prefixIcon,suffixIcon:l?(0,_ui.getIcon)().SELECT_LOADED:d?(0,_ui.getIcon)().SELECT_OPEN:(0,_ui.getIcon)().SELECT_CLOSE,autoFocus:!1,title:m,modelValue:h,onClear:me,onClick:ke,onFocus:Le,onBlur:we,onSuffixClick:Pe},V?{prefix:()=>V({})}:{}),(0,_vue.h)(_vue.Teleport,{to:(0,_dom.getPopupContainer)(L),disabled:!b||!r},[(0,_vue.h)("div",{ref:A,class:["vxe-table--ignore-clear vxe-select--panel",O?_xeUtils.default.isFunction(O)?O({$select:N}):O:"",{["size--"+g]:g,"is--transfer":b,"ani--leave":!l&&c,"ani--enter":!l&&d}],placement:M.panelPlacement,style:M.panelStyle},r&&(d||c)?[(0,_vue.h)("div",{class:"vxe-select--panel-wrapper",style:T},[a?(0,_vue.h)("div",{class:"vxe-select--panel-search"},[(0,_vue.h)(_input.default,{ref:R,class:"vxe-select-search--input",modelValue:M.searchValue,type:"text",clearable:!0,disabled:!1,readonly:!1,placeholder:(0,_ui.getI18n)("vxe.select.search"),prefixIcon:(0,_ui.getIcon)().INPUT_SEARCH,"onUpdate:modelValue":Be,onFocus:De,onChange:Me,onSearch:Me})]):(0,_ui.renderEmptyElement)(N),o&&t||n||I?(0,_vue.h)("div",{class:"vxe-select--panel-header"},I?K(I,{}):[(0,_vue.h)("div",{class:"vxe-select--header-button"},[(0,_vue.h)("div",{class:"vxe-select--header-btns"},[o&&t?(0,_vue.h)(_button.default,{content:(0,_ui.getI18n)("vxe.select.allChecked"),mode:"text",onClick:be}):(0,_ui.renderEmptyElement)(N),n?(0,_vue.h)(_button.default,{content:(0,_ui.getI18n)("vxe.select.clear"),mode:"text",onClick:xe}):(0,_ui.renderEmptyElement)(N)])])]):(0,_ui.renderEmptyElement)(N),(0,_vue.h)("div",{class:"vxe-select--panel-body"},[(0,_vue.h)("div",{ref:D,class:"vxe-select-option--wrapper",onScroll:Re},[(0,_vue.h)("div",{class:"vxe-select--y-space",style:{height:p?p+"px":""}}),(0,_vue.h)("div",{ref:$,class:"vxe-select--body",style:{marginTop:f+"px"}},(()=>{var{optList:e,searchLoading:t}=M;return t?[(0,_vue.h)("div",{class:"vxe-select--search-loading"},[(0,_vue.h)("i",{class:["vxe-select--search-icon",(0,_ui.getIcon)().SELECT_LOADED]}),(0,_vue.h)("span",{class:"vxe-select--search-text"},(0,_ui.getI18n)("vxe.select.loadingText"))])]:e.length?We(e):[(0,_vue.h)("div",{class:"vxe-select--empty-placeholder"},k.emptyText||(0,_ui.getI18n)("vxe.select.emptyText"))]})())])]),S||i||u&&t?(0,_vue.h)("div",{class:"vxe-select--panel-footer"},S?K(S,{}):[(0,_vue.h)("div",{class:"vxe-select--footer-button"},[i?(0,_vue.h)("div",{class:"vxe-select--total-btns"},(0,_ui.getI18n)("vxe.select.total",[y.length,v.length])):(0,_ui.renderEmptyElement)(N),u&&t?(0,_vue.h)("div",{class:"vxe-select--oper-btns"},[(0,_vue.h)(_button.default,{content:(0,_ui.getI18n)("vxe.select.close"),mode:"text",onClick:Ce})]):(0,_ui.renderEmptyElement)(N)])]):(0,_ui.renderEmptyElement)(N)])]:[])])])},N},render(){return this.renderVN()}});
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_comp=require("../../ui/src/comp"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_dom=require("../../ui/src/dom"),_utils=require("../../ui/src/utils"),_vn=require("../../ui/src/vn"),_log=require("../../ui/src/log"),_input=_interopRequireDefault(require("../../input")),_button=_interopRequireDefault(require("../../button"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let errLog=(0,_log.createComponentLog)("select").errLog;function isOptionVisible(e){return!1!==e.visible}function getOptUniqueId(){return _xeUtils.default.uniqueId("opt_")}function createReactData(){return{initialized:!1,scrollYLoad:!1,bodyHeight:0,topSpaceHeight:0,optList:[],staticOptions:[],reactFlag:0,currentOption:null,searchValue:"",searchLoading:!1,panelIndex:0,panelStyle:{},panelPlacement:null,triggerFocusPanel:!1,visiblePanel:!1,isAniVisible:!1,isActivated:!1}}function createInternalData(){return{synchData:[],fullData:[],afterVisibleList:[],optAddMaps:{},optGroupKeyMaps:{},optFullValMaps:{},remoteValMaps:{},lastScrollLeft:0,lastScrollTop:0,scrollYStore:{startIndex:0,endIndex:0,visibleSize:0,offsetSize:0,rowHeight:0},lastScrollTime:0,hpTimeout:void 0}}var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeSelect",props:{modelValue:[String,Number,Boolean,Array],defaultConfig:Object,emptyValue:{type:[String,Number,Boolean,Array],default:()=>(0,_ui.getConfig)().select.emptyValue},clearable:{type:Boolean,default:()=>(0,_ui.getConfig)().select.clearable},placeholder:String,readonly:{type:Boolean,default:null},loading:Boolean,disabled:{type:Boolean,default:null},multiple:Boolean,multiCharOverflow:{type:[Number,String],default:()=>(0,_ui.getConfig)().select.multiCharOverflow},prefixIcon:String,allowCreate:{type:Boolean,default:()=>(0,_ui.getConfig)().select.allowCreate},placement:String,lazyOptions:Array,options:Array,optionProps:Object,optionGroups:Array,optionGroupProps:Object,optionConfig:Object,className:[String,Function],popupClassName:[String,Function],width:[String,Number],max:{type:[String,Number],default:null},showRadio:{type:Boolean,default:()=>(0,_ui.getConfig)().select.showRadio},radioConfig:Object,showCheckbox:{type:Boolean,default:()=>(0,_ui.getConfig)().select.showCheckedButton},checkboxConfig:Object,zIndex:Number,size:{type:String,default:()=>(0,_ui.getConfig)().select.size||(0,_ui.getConfig)().size},filterable:Boolean,filterMethod:Function,filterConfig:Object,remote:Boolean,remoteConfig:Object,emptyText:String,checkedClosable:{type:Boolean,default:()=>(0,_ui.getConfig)().select.checkedClosable},clearClosable:{type:Boolean,default:()=>(0,_ui.getConfig)().select.clearClosable},showCloseButton:{type:Boolean,default:()=>(0,_ui.getConfig)().select.showCloseButton},showTotalButton:{type:Boolean,default:()=>(0,_ui.getConfig)().select.showTotalButton},showCheckedButton:{type:Boolean,default:()=>(0,_ui.getConfig)().select.showCheckedButton},showClearButton:{type:Boolean,default:()=>(0,_ui.getConfig)().select.showClearButton},transfer:{type:Boolean,default:null},popupConfig:Object,virtualYConfig:Object,scrollY:Object,remoteMethod:Function,optionId:{type:String,default:()=>(0,_ui.getConfig)().select.optionId},optionKey:Boolean},emits:["update:modelValue","change","default-change","all-change","clear","blur","focus","click","scroll","visible-change"],setup(k,e){let{slots:w,emit:a}=e,n=(0,_vue.inject)("$xeModal",null),C=(0,_vue.inject)("$xeDrawer",null),E=(0,_vue.inject)("$xeTable",null),y=(0,_vue.inject)("$xeCard",null),i=(0,_vue.inject)("$xeForm",null),T=(0,_vue.inject)("xeFormItemInfo",null);var t=_xeUtils.default.uniqueId();let P=(0,_vue.ref)(),B=(0,_vue.ref)(),R=(0,_vue.ref)(),D=(0,_vue.ref)(),A=(0,_vue.ref)(),$=(0,_vue.ref)(),G=(0,_ui.useSize)(k).computeSize,M=(0,_vue.reactive)(createReactData()),U=createInternalData(),O={refElem:P},N={xID:t,props:k,context:e,reactData:M,internalData:U,getRefMaps:()=>O},X=(0,_vue.computed)(()=>{var e=k.readonly;return null===e?!!i&&i.props.readonly:e}),j=(0,_vue.computed)(()=>{var e=k.disabled;return null===e?!!i&&i.props.disabled:e}),W=(0,_vue.computed)(()=>{var e=k.transfer,t=H.value;if(_xeUtils.default.isBoolean(t.transfer))return t.transfer;if(null===e){t=(0,_ui.getConfig)().select.transfer;if(_xeUtils.default.isBoolean(t))return t;if(E||n||C||y||i)return!0}return e}),Z=(0,_vue.computed)(()=>{var e=k.placeholder;return(e=e||(0,_ui.getConfig)().select.placeholder)?(0,_utils.getFuncText)(e):(0,_ui.getI18n)("vxe.base.pleaseSelect")}),I=(0,_vue.computed)(()=>Object.assign({},k.defaultConfig)),S=(0,_vue.computed)(()=>Object.assign({},k.optionProps)),V=(0,_vue.computed)(()=>Object.assign({},k.optionGroupProps)),v=(0,_vue.computed)(()=>S.value.label||"label"),F=(0,_vue.computed)(()=>S.value.value||"value"),J=(0,_vue.computed)(()=>V.value.label||"label"),L=(0,_vue.computed)(()=>V.value.options||"options"),Q=(0,_vue.computed)(()=>{var e=z.value;return de(e)}),H=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().select.popupConfig,k.popupConfig)),ee=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().select.virtualYConfig||(0,_ui.getConfig)().select.scrollY,k.virtualYConfig||k.scrollY)),r=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().select.remoteConfig,k.remoteConfig)),te=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().select.filterConfig,k.filterConfig)),le=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().select.optionConfig,k.optionConfig)),ae=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().select.radioConfig,k.radioConfig)),ie=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().select.checkboxConfig,k.checkboxConfig)),oe=(0,_vue.computed)(()=>_xeUtils.default.toNumber(k.multiCharOverflow)),ne=(0,_vue.computed)(()=>{var e=k.width,t={};return e&&(t.width=(0,_dom.toCssUnit)(e)),t}),ue=(0,_vue.computed)(()=>{var{height:e,width:t}=H.value,l={};return t&&(l.width=(0,_dom.toCssUnit)(t)),e&&(l.height=(0,_dom.toCssUnit)(e),l.maxHeight=(0,_dom.toCssUnit)(e)),l}),z=(0,_vue.computed)(()=>{var{modelValue:e,multiple:t}=k;let l=[];return _xeUtils.default.isArray(e)?l=e:t?(0,_utils.eqEmptyValue)(e)||(l=-1<(""+e).indexOf(",")?(""+e).split(","):[e]):l=null==e?[]:[e],l}),re=(0,_vue.computed)(()=>{var e=k.remote,t=M.reactFlag,l=z.value;return(e&&t?l.map(e=>pe(e)):l.map(e=>fe(e))).join(", ")}),se=(0,_vue.computed)(()=>{var{remote:e,multiple:t}=k,l=M.reactFlag,a=oe.value,i=z.value;return e&&l?i.map(e=>pe(e)).join(", "):(e=i.map(e=>fe(e)),t&&0<a&&e.length>a?e.slice(0,a)+"...":e.join(", "))}),K=(e,t)=>e&&(_xeUtils.default.isString(e)&&(e=w[e]||null),_xeUtils.default.isFunction(e))?(0,_vn.getSlotVNs)(e(t)):[],s=(e,t,l)=>{a(e,(0,_ui.createEvent)(l,{$select:N},t))},ce=e=>{a("update:modelValue",e)},ve=e=>{ce(e),s("default-change",{value:e},null)},c=()=>le.value.keyField||k.optionId||"_X_OPTION_KEY",Y=e=>{e=e[c()];return e?encodeURIComponent(e):""},de=e=>{var{multiple:t,max:l}=k;return!(!t||!l)&&e.length>=_xeUtils.default.toNumber(l)},pe=t=>{var e=k.lazyOptions,{remoteValMaps:l,optFullValMaps:a}=U;let i=F.value;var o=v.value,l=l[t]||a[t],a=l?l.item:null;if(a)return _xeUtils.default.toValueString(a[o]);if(e){l=e.find(e=>e[i]===t);if(l)return l[o]}return t},fe=t=>{var e=k.lazyOptions,l=U.optFullValMaps;let a=F.value;var i=v.value,l=M.reactFlag?l[t]:null;if(l)return l.item[i];if(e){l=e.find(e=>e[a]===t);if(l)return l[i]}return t},d=()=>{let{remote:e,modelValue:t,filterable:l}=k,a=M.searchValue,{fullData:i,optFullValMaps:o}=U,n=v.value,u=F.value;let r=te.value.filterMethod||k.filterMethod,s=(""+(a||"")).toLowerCase(),c=[];return(c=e?i.filter(isOptionVisible):l&&r?i.filter(e=>isOptionVisible(e)&&r({$select:N,group:null,option:e,searchValue:a,value:t})):l?i.filter(e=>isOptionVisible(e)&&(!s||-1<(""+(e[n]||e[u])).toLowerCase().indexOf(s))):i.filter(isOptionVisible)).forEach((e,t)=>{e=o[e[u]];e&&(e._index=t)}),U.afterVisibleList=c,(0,_vue.nextTick)()},ge=e=>{e&&(M.currentOption=e)},_e=()=>{var e=H.value.zIndex||k.zIndex;e?M.panelIndex=_xeUtils.default.toNumber(e):M.panelIndex<(0,_utils.getLastZIndex)()&&(M.panelIndex=(0,_utils.nextZIndex)())},p=()=>{let l=k.placement,a=M.panelIndex,i=P.value,o=A.value,n=W.value,u=H.value;var e=()=>{var e=(0,_dom.updatePanelPlacement)(i,o,{placement:u.placement||l,defaultPlacement:u.defaultPlacement,teleportTo:n}),t=Object.assign(e.style,{zIndex:a});M.panelStyle=t,M.panelPlacement=e.placement};return e(),(0,_vue.nextTick)().then(e)},he=()=>{(0,_vue.nextTick)(()=>{var{isAniVisible:e,visiblePanel:t}=M,l=U.optFullValMaps,a=z.value;a.length&&e&&t&&(e=M.reactFlag?l[""+a[0]]:null)&&(M.currentOption=e.item,ze(e.item))})},f=()=>{var{loading:e,filterable:t,remote:l}=k,{fullData:a,hpTimeout:i}=U,o=j.value,n=r.value;let u=z.value;e||o||(i&&(clearTimeout(i),U.hpTimeout=void 0),M.initialized||(M.initialized=!0),M.isActivated=!0,M.isAniVisible=!0,t&&(l&&n.enabled&&(n.autoLoad&&!a.length||a.length&&n.clearOnClose)?Ae:(d(),m))(),setTimeout(()=>{M.visiblePanel=!0,Ve(),x().then(()=>{(u&&u.length?he:b)()}),p()},10),setTimeout(()=>{x().then(()=>b())},100),_e(),p(),s("visible-change",{visible:!0},null))},g=e=>{var{filterable:t,remote:l}=k,a=te.value,i=r.value;l?i.clearOnClose&&(M.searchValue=""):t&&!a.clearOnClose||(M.searchValue=""),M.searchLoading=!1,M.visiblePanel=!1,U.hpTimeout=setTimeout(()=>{M.isAniVisible=!1},350),s("visible-change",{visible:!1},e||null)},u=(e,t,l)=>{ce(t),t!==k.modelValue&&(s("change",{value:t,option:l},e),i)&&T&&i.triggerItemEvent(e,T.itemConfig.field,t)},_=(e,t)=>{U.remoteValMaps={},u(e,t,null),s("clear",{value:t},e)},me=e=>{var t=k.emptyValue,e=e.$event;_(e,t),g(e)},be=e=>{var e=e.$event,{multiple:t,max:l,checkedClosable:a}=k,i=M.optList,o=F.value;if(t){var n=z.value.slice(0);for(let e=0;e<i.length;e++){let t=i[e][o];if(de(n)){_ui.VxeUI&&_ui.VxeUI.modal.message({content:(0,_ui.getI18n)("vxe.select.overSizeErr",[l]),status:"warning"});break}n.some(e=>e===t)||n.push(t)}u(e,n,i[0]),a&&g(e),s("all-change",{value:n},e)}},xe=e=>{var{emptyValue:t,clearClosable:l}=k,e=e.$event;_(e,t),l&&g(e)},Ce=e=>{e=e.$event;g(e)},q=(t,l)=>{var e=k.multiple,a=U.remoteValMaps;let i=l[F.value];var o=a[i];if(M.visiblePanel){if(o?o.item=l:a[i]={key:Y(l),item:l,_index:-1},e){let e=[];o=z.value,a=_xeUtils.default.findIndexOf(o,e=>e===i);e=-1===a?o.concat([i]):o.filter(e=>e!==i),u(t,e,l)}else u(t,i,l),g(t);M.reactFlag++}},Ee=e=>{var t,l=M.visiblePanel,a=j.value,i=H.value.trigger;a||(a=P.value,t=A.value,M.isActivated=(0,_dom.getEventTargetNode)(e,a).flag||(0,_dom.getEventTargetNode)(e,t).flag,l&&!M.isActivated&&"manual"!==i&&g(e))},h=e=>{var t=e.disabled,e=Y(e);return!t&&!$e(e)},ye=(e,t)=>{var l=k.allowCreate,a=M.optList,{optFullValMaps:i,optAddMaps:o,afterVisibleList:n}=U,u=F.value;let r=n,s=0;if(l&&a.length&&(n=a[0],o[l=Y(n)])&&(s=1,r=[o[l]].concat(r)),!e)if(t)for(let e=0;e<r.length;e++){var c=r[e];if(h(c))return c}else for(let e=r.length-1;0<=e;e--){var v=r[e];if(h(v))return v}let d=0;a=e?i[e[u]]:null;if(-1<(d=a?a._index+s:d))if(t)for(let e=d+1;e<=r.length-1;e++){var p=r[e];if(h(p))return p}else if(0<d)for(let e=d-1;0<=e;e--){var f=r[e];if(h(f))return f}return null},Te=t=>{var{emptyValue:e,clearable:l}=k,{visiblePanel:a,currentOption:i}=M,o=j.value,n=H.value.trigger;if(!o){var o=_ui.globalEvents.hasKey(t,_ui.GLOBAL_EVENT_KEYS.TAB),u=_ui.globalEvents.hasKey(t,_ui.GLOBAL_EVENT_KEYS.ENTER),r=_ui.globalEvents.hasKey(t,_ui.GLOBAL_EVENT_KEYS.ESCAPE),s=_ui.globalEvents.hasKey(t,_ui.GLOBAL_EVENT_KEYS.ARROW_UP),c=_ui.globalEvents.hasKey(t,_ui.GLOBAL_EVENT_KEYS.ARROW_DOWN),v=_ui.globalEvents.hasKey(t,_ui.GLOBAL_EVENT_KEYS.DELETE);if(o&&(M.isActivated=!1),a){if(r||o)"manual"!==n&&g(t);else if(u)i&&(t.preventDefault(),t.stopPropagation(),q(t,i));else if(s||c){t.preventDefault();let e=ye(i,c);(e=e||ye(null,c))&&(ge(e),ze(e,c))}}else(s||c||u)&&M.isActivated&&(t.preventDefault(),f());M.isActivated&&v&&l&&_(t,e)}},Oe=e=>{var{visiblePanel:t,isActivated:l}=M,a=H.value.trigger;t&&"manual"!==a&&g(e),l&&(M.isActivated=!1),(t||l)&&(a=B.value)&&a.blur()},Ie=()=>{var e=M.visiblePanel;e&&p()},Se=()=>{var e=M.visiblePanel;e&&p()},Ve=()=>{k.filterable&&(0,_vue.nextTick)(()=>{var e=R.value;e&&e.focus()})},Le=e=>{var t=j.value,l=H.value.trigger;t||M.visiblePanel||l&&"default"!==l||(M.triggerFocusPanel=!0,f(),setTimeout(()=>{M.triggerFocusPanel=!1},500)),s("focus",{},e)},ke=e=>{var t=H.value.trigger;t&&"default"!==t||Ue(e),s("click",{triggerButton:!1,visible:M.visiblePanel},e)},we=e=>{M.isActivated=!1,s("blur",{},e)},Pe=e=>{var t=H.value.trigger;t&&"default"!==t&&"icon"!==t||Ue(e),s("click",{triggerButton:!0,visible:M.visiblePanel},e)},Be=e=>{M.searchValue=e},De=()=>{M.isActivated=!0},Ae=()=>{var{modelValue:e,remote:t}=k,l=M.searchValue,a=r.value,i=a.queryMethod||k.remoteMethod;t&&i&&a.enabled?(M.searchLoading=!0,Promise.resolve(i({$select:N,searchValue:l,value:e})).then(()=>(0,_vue.nextTick)()).catch(()=>(0,_vue.nextTick)()).finally(()=>{M.searchLoading=!1,d(),m()})):(d(),m())},Me=_xeUtils.default.debounce(Ae,350,{trailing:!0}),Ue=e=>{e=e.$event;e.preventDefault(),M.triggerFocusPanel?M.triggerFocusPanel=!1:M.visiblePanel?g(e):f()},Ne=(e,t)=>!!t.disabled||!(!Q.value||e),je=()=>{var e=M.scrollYLoad,{scrollYStore:t,afterVisibleList:l}=U;M.bodyHeight=e?l.length*t.rowHeight:0,M.topSpaceHeight=e?Math.max(t.startIndex*t.rowHeight,0):0},Fe=()=>{var{filterable:e,allowCreate:t}=k;let{scrollYLoad:l,searchValue:a}=M;var{optAddMaps:i,scrollYStore:o,afterVisibleList:n}=U;let u=v.value;var r=F.value,o=l?n.slice(o.startIndex,o.endIndex):n.slice(0);return e&&t&&a&&(o.some(e=>e[u]===a)||(n=i[a]||(0,_vue.reactive)({[c()]:a,[u]:a,[r]:a}),i[a]=n,o.unshift(n))),M.optList=o,(0,_vue.nextTick)()},m=()=>{Fe(),je()},He=()=>(0,_vue.nextTick)().then(()=>{var e=M.scrollYLoad,t=U.scrollYStore,l=$.value,a=ee.value;let i=0,o;(o=l?o||l.children[0]:o)&&(i=o.offsetHeight),i=Math.max(20,i),t.rowHeight=i,(e?(l=D.value,e=Math.max(8,l?Math.ceil(l.clientHeight/i):0),l=Math.max(0,Math.min(2,_xeUtils.default.toNumber(a.oSize))),t.offsetSize=l,t.visibleSize=e,t.endIndex=Math.max(t.startIndex,e+l,t.endIndex),m):je)()}),ze=(e,t)=>{var l,a,{optFullValMaps:i,scrollYStore:o}=U,i=i[e[F.value]];i&&(e=i.key,-1<(i=i._index))&&(l=D.value,a=A.value)&&(a=a.querySelector(`[optid='${e}']`),l)&&(a?(e=l.offsetHeight,t?Math.ceil(a.offsetTop+a.offsetHeight-l.scrollTop)>=e?l.scrollTop=a.offsetTop+a.offsetHeight-e:(a.offsetTop+1<l.scrollTop||a.offsetTop+1>l.scrollTop+l.clientHeight)&&(l.scrollTop=a.offsetTop-1):a.offsetTop+1<l.scrollTop||a.offsetTop+1>l.scrollTop+l.clientHeight?l.scrollTop=a.offsetTop-1:a.offsetTop+a.offsetHeight-l.scrollTop>e&&(l.scrollTop=a.offsetTop+a.offsetHeight-e)):l.scrollTop=t?i*o.rowHeight-l.clientHeight+o.rowHeight:i*o.rowHeight)},Ke=(e,t)=>{var l=D.value;return l&&(_xeUtils.default.isNumber(e)&&(l.scrollLeft=e),_xeUtils.default.isNumber(t))&&(l.scrollTop=t),M.scrollYLoad?new Promise(e=>{setTimeout(()=>{(0,_vue.nextTick)(()=>{e()})},50)}):(0,_vue.nextTick)()},b=()=>{let{lastScrollLeft:e,lastScrollTop:t}=U;return o().then(()=>{if(e||t)return U.lastScrollLeft=0,U.lastScrollTop=0,Ke(e,t)})},x=()=>{var e=P.value;return e&&e.clientWidth&&e.clientHeight?He():Promise.resolve()},Ye=e=>{var t=U.scrollYStore,{startIndex:l,endIndex:a,visibleSize:i,offsetSize:o,rowHeight:n}=t,e=e.target.scrollTop,e=Math.floor(e/n),n=Math.max(0,e-1-o),o=e+i+o;!(e<=l||a-i-1<=e)||l===n&&a===o||(t.startIndex=n,t.endIndex=o,m())},qe=()=>{var e=U.lastScrollTime;return!!(e&&Date.now()<e+250)},Re=e=>{var t=e.target,l=t.scrollTop,t=t.scrollLeft,a=t!==U.lastScrollLeft,i=l!==U.lastScrollTop;U.lastScrollTop=l,U.lastScrollLeft=t,M.scrollYLoad&&Ye(e),U.lastScrollTime=Date.now(),s("scroll",{scrollLeft:t,scrollTop:l,isX:a,isY:i},e)},l=t=>{(e=>{let t=L.value,l=F.value,a=c(),i={},o={},n=[],u=e=>{n.push(e);let t=Y(e);t||(t=getOptUniqueId(),e[a]=t),o[e[l]]={key:t,item:e,_index:-1}};e.forEach(e=>{u(e),e[t]&&(i[e[a]]=e)[t].forEach(u)}),U.fullData=n,U.optGroupKeyMaps=i,U.optFullValMaps=o,M.reactFlag++,d()})(t||[]);var e=k.multiple,{isLoaded:l,fullData:a,scrollYStore:i}=U,o=I.value,n=ee.value;let u=F.value;if(Object.assign(i,{startIndex:0,endIndex:1,visibleSize:0}),U.synchData=t||[],M.scrollYLoad=!!n.enabled&&-1<n.gt&&(0===n.gt||n.gt<=a.length),Fe(),!l){i=o.selectMode;if(0<t.length&&_xeUtils.default.eqNull(k.modelValue)){if("all"===i)e?(0,_vue.nextTick)(()=>{ve(t.map(e=>e[u]))}):errLog("vxe.error.notConflictProp",["default-config.selectMode=all","multiple=true"]);else if("first"===i||"last"===i){let e=_xeUtils.default[i](t);e&&(0,_vue.nextTick)(()=>{_xeUtils.default.eqNull(k.modelValue)&&ve(e[u])})}U.isLoaded=!0}}return He().then(()=>{b()})},o=()=>{var e=D.value;return e&&(e.scrollTop=0,e.scrollLeft=0),U.lastScrollTop=0,(U.lastScrollLeft=0,_vue.nextTick)()},$e=e=>{var t=U.optGroupKeyMaps;return!!t[e]};t={dispatchEvent:s,loadData:l,reloadData(e){return U.isLoaded=!1,o(),l(e)},isPanelVisible(){return M.visiblePanel},togglePanel(){return(M.visiblePanel?g:f)(),(0,_vue.nextTick)()},hidePanel(){return M.visiblePanel&&g(),(0,_vue.nextTick)()},showPanel(){return M.visiblePanel||f(),(0,_vue.nextTick)()},refreshOption(){return d(),m(),(0,_vue.nextTick)()},focus(){var e=B.value;return e&&e.blur(),M.isActivated=!0,(0,_vue.nextTick)()},blur(){var e=B.value;return e&&e.blur(),(M.isActivated=!1,_vue.nextTick)()},recalculate:x,clearScroll:o};Object.assign(N,t);let Ge=(t,l,e,a)=>{var{showIcon:i,trigger:o}=ae.value;return l||!1===i?(0,_ui.renderEmptyElement)(N):(i={},o&&"default"!==o||(i.onClick=e=>{a||l||q(e,t)}),(0,_vue.h)("div",Object.assign({key:2,class:["vxe-select-option--radio",{"is--checked":e,"is--disabled":a}]},i),[(0,_vue.h)("span",{class:["vxe-radio--icon",e?(0,_ui.getIcon)().RADIO_CHECKED:a?(0,_ui.getIcon)().RADIO_DISABLED_UNCHECKED:(0,_ui.getIcon)().RADIO_UNCHECKED]})]))},Xe=(t,l,e,a)=>{var{showIcon:i,trigger:o}=ie.value;return l||!1===i?(0,_ui.renderEmptyElement)(N):(i={},o&&"default"!==o||(i.onClick=e=>{a||l||q(e,t)}),(0,_vue.h)("div",Object.assign({key:3,class:["vxe-select-option--checkbox",{"is--checked":e,"is--disabled":a}]},i),[(0,_vue.h)("span",{class:["vxe-checkbox--icon",e?(0,_ui.getIcon)().CHECKBOX_CHECKED:a?(0,_ui.getIcon)().CHECKBOX_DISABLED_UNCHECKED:(0,_ui.getIcon)().CHECKBOX_UNCHECKED]})]))},We=e=>{let{allowCreate:g,optionKey:_,multiple:t,showRadio:l,showCheckbox:a}=k,h=M.currentOption,m=U.optAddMaps;var i=le.value;let b=v.value,x=F.value,C=J.value,E=z.value,y=ae.value,T=ie.value,{useKey:O,height:I}=i,S=w.option,V=a&&t,L=l&&!t;return e.map((t,e)=>{var{slots:l,className:a}=t,i=Y(t),o=t[x];let n=$e(i);var u=!(!g||!m[i]),r=!u&&-1<E.indexOf(o),s=u||!n||isOptionVisible(t);let c=!u&&Ne(r,t);var l=(l?l.default:null)||S,v={option:t,group:n?t:null,$select:N};let d="";var p=[];V?p.push(Xe(t,n,r,c)):L&&p.push(Ge(t,n,r,c));let f=[];f=l?K(l,v):[d=(0,_utils.getFuncText)(t[n?C:b]||o)],p.push((0,_vue.h)("div",{key:1,class:"vxe-select-option--label"},f));l={onMousedown:e=>{0===e.button&&e.stopPropagation()},onMouseenter:()=>{c||n||qe()||ge(t)}};return(V?"option"!==T.trigger:L&&"option"!==y.trigger)||(l.onClick=e=>{c||n||q(e,t)}),s?(0,_vue.h)("div",Object.assign({key:O||_?i:e,class:["vxe-select-option",a?_xeUtils.default.isFunction(a)?a(v):a:"",{"vxe-select-optgroup":n,"is--disabled":c,"is--selected":r,"is--add":u,"is--hover":h&&Y(h)===i}],optid:i,title:d||null,style:I?{height:(0,_dom.toCssUnit)(I)}:void 0},l),g?[(0,_vue.h)("div",{key:1,class:"vxe-select-option--add-label"},p),u?(0,_vue.h)("div",{key:2,class:"vxe-select-option--add-icon"},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().SELECT_ADD_OPTION})]):(0,_ui.renderEmptyElement)(N)]:p):(0,_ui.renderEmptyElement)(N)})};return(0,_vue.watch)(()=>M.staticOptions,e=>{l(e)}),(0,_vue.watch)(()=>k.options,e=>{l(e||[])}),(0,_vue.watch)(()=>k.optionGroups,e=>{l(e||[])}),(0,_vue.onMounted)(()=>{(0,_vue.nextTick)(()=>{var{options:e,optionGroups:t}=k;t?l(t):e&&l(e)}),_ui.globalEvents.on(N,"mousedown",Ee),_ui.globalEvents.on(N,"keydown",Te),_ui.globalEvents.on(N,"blur",Oe),_ui.globalEvents.on(N,"resize",Ie),_ui.globalEvents.on(N,"scroll",Se)}),(0,_vue.onUnmounted)(()=>{_ui.globalEvents.off(N,"mousedown"),_ui.globalEvents.off(N,"keydown"),_ui.globalEvents.off(N,"blur"),_ui.globalEvents.off(N,"resize"),_ui.globalEvents.off(N,"scroll"),_xeUtils.default.assign(M,createReactData()),_xeUtils.default.assign(U,createInternalData())}),(0,_vue.provide)("$xeSelect",N),N.renderVN=()=>{var{className:e,multiple:t,loading:l,filterable:a,showTotalButton:i,showCheckedButton:o,showClearButton:n,showCloseButton:u}=k,{initialized:r,isActivated:s,isAniVisible:c,optList:v,visiblePanel:d,bodyHeight:p,topSpaceHeight:f}=M,g=G.value,_=j.value,h=se.value,m=re.value,b=W.value,x=X.value,C=Z.value,E=w.default;if(x)return(0,_vue.h)("div",{ref:P,class:["vxe-select--readonly",e]},[(0,_vue.h)("div",{class:"vxe-select-slots",ref:"hideOption"},E?E({}):[]),(0,_vue.h)("span",{class:"vxe-select-label",title:m},h)]);var x=ne.value,y=z.value,T=ue.value,O=H.value,I=w.header,S=w.footer;let V=w.prefix;var L=O.appendTo,O=O.className||k.popupClassName;return(0,_vue.h)("div",{ref:P,class:["vxe-select",e?_xeUtils.default.isFunction(e)?e({$select:N}):e:"",{["size--"+g]:g,"is--visible":d,"is--disabled":_,"is--filter":a,"is--loading":l,"is--active":s}],style:x},[(0,_vue.h)("div",{class:"vxe-select-slots",ref:"hideOption"},E?E({}):[]),(0,_vue.h)(_input.default,{ref:B,clearable:k.clearable,placeholder:C,editable:!1,disabled:_,type:"text",prefixIcon:k.prefixIcon,suffixIcon:l?(0,_ui.getIcon)().SELECT_LOADED:d?(0,_ui.getIcon)().SELECT_OPEN:(0,_ui.getIcon)().SELECT_CLOSE,autoFocus:!1,title:m,modelValue:h,onClear:me,onClick:ke,onFocus:Le,onBlur:we,onSuffixClick:Pe},V?{prefix:()=>V({})}:{}),(0,_vue.h)(_vue.Teleport,{to:(0,_dom.getPopupContainer)(L),disabled:!b||!r},[(0,_vue.h)("div",{ref:A,class:["vxe-table--ignore-clear vxe-select--panel",O?_xeUtils.default.isFunction(O)?O({$select:N}):O:"",{["size--"+g]:g,"is--transfer":b,"ani--leave":!l&&c,"ani--enter":!l&&d}],placement:M.panelPlacement,style:M.panelStyle},r&&(d||c)?[(0,_vue.h)("div",{class:"vxe-select--panel-wrapper",style:T},[a?(0,_vue.h)("div",{class:"vxe-select--panel-search"},[(0,_vue.h)(_input.default,{ref:R,class:"vxe-select-search--input",modelValue:M.searchValue,type:"text",clearable:!0,disabled:!1,readonly:!1,placeholder:(0,_ui.getI18n)("vxe.select.search"),prefixIcon:(0,_ui.getIcon)().INPUT_SEARCH,"onUpdate:modelValue":Be,onFocus:De,onChange:Me,onSearch:Me})]):(0,_ui.renderEmptyElement)(N),o&&t||n||I?(0,_vue.h)("div",{class:"vxe-select--panel-header"},I?K(I,{}):[(0,_vue.h)("div",{class:"vxe-select--header-button"},[(0,_vue.h)("div",{class:"vxe-select--header-btns"},[o&&t?(0,_vue.h)(_button.default,{content:(0,_ui.getI18n)("vxe.select.allChecked"),mode:"text",onClick:be}):(0,_ui.renderEmptyElement)(N),n?(0,_vue.h)(_button.default,{content:(0,_ui.getI18n)("vxe.select.clear"),mode:"text",onClick:xe}):(0,_ui.renderEmptyElement)(N)])])]):(0,_ui.renderEmptyElement)(N),(0,_vue.h)("div",{class:"vxe-select--panel-body"},[(0,_vue.h)("div",{ref:D,class:"vxe-select-option--wrapper",onScroll:Re},[(0,_vue.h)("div",{class:"vxe-select--y-space",style:{height:p?p+"px":""}}),(0,_vue.h)("div",{ref:$,class:"vxe-select--body",style:{marginTop:f+"px"}},(()=>{var{optList:e,searchLoading:t}=M;return t?[(0,_vue.h)("div",{class:"vxe-select--search-loading"},[(0,_vue.h)("i",{class:["vxe-select--search-icon",(0,_ui.getIcon)().SELECT_LOADED]}),(0,_vue.h)("span",{class:"vxe-select--search-text"},(0,_ui.getI18n)("vxe.select.loadingText"))])]:e.length?We(e):[(0,_vue.h)("div",{class:"vxe-select--empty-placeholder"},k.emptyText||(0,_ui.getI18n)("vxe.select.emptyText"))]})())])]),S||i||u&&t?(0,_vue.h)("div",{class:"vxe-select--panel-footer"},S?K(S,{}):[(0,_vue.h)("div",{class:"vxe-select--footer-button"},[i?(0,_vue.h)("div",{class:"vxe-select--total-btns"},(0,_ui.getI18n)("vxe.select.total",[y.length,v.length])):(0,_ui.renderEmptyElement)(N),u&&t?(0,_vue.h)("div",{class:"vxe-select--oper-btns"},[(0,_vue.h)(_button.default,{content:(0,_ui.getI18n)("vxe.select.close"),mode:"text",onClick:Ce})]):(0,_ui.renderEmptyElement)(N)])]):(0,_ui.renderEmptyElement)(N)])]:[])])])},N},render(){return this.renderVN()}});