vxe-pc-ui 3.3.56 → 3.3.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/icon/style.css +1 -1
- package/es/modal/src/modal.js +38 -4
- package/es/select/src/select.js +28 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.umd.js +69 -7
- package/lib/index.umd.min.js +1 -1
- package/lib/modal/src/modal.js +38 -4
- package/lib/modal/src/modal.min.js +1 -1
- package/lib/select/src/select.js +29 -1
- package/lib/select/src/select.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +4 -4
- package/packages/modal/src/modal.ts +38 -4
- package/packages/select/src/select.ts +29 -1
- package/types/components/column.d.ts +7 -5
- package/types/components/form-item.d.ts +6 -6
- package/types/components/modal.d.ts +9 -3
- package/types/components/select.d.ts +8 -0
- package/types/components/table-plugins/extend-cell-area.d.ts +2 -2
- package/types/components/table.d.ts +74 -54
- package/types/components/toolbar.d.ts +3 -3
- package/types/ui/commands.d.ts +1 -1
- package/types/ui/interceptor.d.ts +4 -4
- package/types/ui/menus.d.ts +3 -4
- package/types/ui/renderer.d.ts +21 -19
- /package/es/icon/{iconfont.1735618294204.ttf → iconfont.1735657369485.ttf} +0 -0
- /package/es/icon/{iconfont.1735618294204.woff → iconfont.1735657369485.woff} +0 -0
- /package/es/icon/{iconfont.1735618294204.woff2 → iconfont.1735657369485.woff2} +0 -0
- /package/es/{iconfont.1735618294204.ttf → iconfont.1735657369485.ttf} +0 -0
- /package/es/{iconfont.1735618294204.woff → iconfont.1735657369485.woff} +0 -0
- /package/es/{iconfont.1735618294204.woff2 → iconfont.1735657369485.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1735618294204.ttf → iconfont.1735657369485.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1735618294204.woff → iconfont.1735657369485.woff} +0 -0
- /package/lib/icon/style/{iconfont.1735618294204.woff2 → iconfont.1735657369485.woff2} +0 -0
- /package/lib/{iconfont.1735618294204.ttf → iconfont.1735657369485.ttf} +0 -0
- /package/lib/{iconfont.1735618294204.woff → iconfont.1735657369485.woff} +0 -0
- /package/lib/{iconfont.1735618294204.woff2 → iconfont.1735657369485.woff2} +0 -0
package/lib/modal/src/modal.js
CHANGED
|
@@ -414,14 +414,32 @@ var _default2 = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
414
414
|
},
|
|
415
415
|
minimize: function minimize() {
|
|
416
416
|
var $xeModal = this;
|
|
417
|
+
var reactData = $xeModal.reactData;
|
|
418
|
+
if (!reactData.visible) {
|
|
419
|
+
return Promise.resolve({
|
|
420
|
+
status: false
|
|
421
|
+
});
|
|
422
|
+
}
|
|
417
423
|
return $xeModal.handleMinimize();
|
|
418
424
|
},
|
|
419
425
|
maximize: function maximize() {
|
|
420
426
|
var $xeModal = this;
|
|
427
|
+
var reactData = $xeModal.reactData;
|
|
428
|
+
if (!reactData.visible) {
|
|
429
|
+
return Promise.resolve({
|
|
430
|
+
status: false
|
|
431
|
+
});
|
|
432
|
+
}
|
|
421
433
|
return $xeModal.handleMaximize();
|
|
422
434
|
},
|
|
423
435
|
revert: function revert() {
|
|
424
436
|
var $xeModal = this;
|
|
437
|
+
var reactData = $xeModal.reactData;
|
|
438
|
+
if (!reactData.visible) {
|
|
439
|
+
return Promise.resolve({
|
|
440
|
+
status: false
|
|
441
|
+
});
|
|
442
|
+
}
|
|
425
443
|
return $xeModal.handleRevert();
|
|
426
444
|
},
|
|
427
445
|
recalculate: function recalculate() {
|
|
@@ -710,18 +728,24 @@ var _default2 = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
710
728
|
content: (0, _ui.getI18n)('vxe.modal.miniMaxSize', [minimizeMaxSize])
|
|
711
729
|
});
|
|
712
730
|
}
|
|
713
|
-
return
|
|
731
|
+
return Promise.resolve({
|
|
732
|
+
status: false
|
|
733
|
+
});
|
|
714
734
|
}
|
|
715
735
|
reactData.prevZoomStatus = prevZoomStatus;
|
|
716
736
|
reactData.zoomStatus = 'minimize';
|
|
717
737
|
return $xeModal.$nextTick().then(function () {
|
|
718
738
|
var boxElem = $xeModal.getBox();
|
|
719
739
|
if (!boxElem) {
|
|
720
|
-
return
|
|
740
|
+
return {
|
|
741
|
+
status: false
|
|
742
|
+
};
|
|
721
743
|
}
|
|
722
744
|
var headerEl = $xeModal.$refs.refHeaderElem;
|
|
723
745
|
if (!headerEl) {
|
|
724
|
-
return
|
|
746
|
+
return {
|
|
747
|
+
status: false
|
|
748
|
+
};
|
|
725
749
|
}
|
|
726
750
|
var _getDomNode = (0, _dom.getDomNode)(),
|
|
727
751
|
visibleHeight = _getDomNode.visibleHeight;
|
|
@@ -771,6 +795,9 @@ var _default2 = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
771
795
|
height: "".concat(headerEl.offsetHeight, "px")
|
|
772
796
|
});
|
|
773
797
|
$xeModal.savePosStorage();
|
|
798
|
+
return {
|
|
799
|
+
status: true
|
|
800
|
+
};
|
|
774
801
|
});
|
|
775
802
|
},
|
|
776
803
|
handleMaximize: function handleMaximize() {
|
|
@@ -1001,8 +1028,15 @@ var _default2 = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
1001
1028
|
});
|
|
1002
1029
|
}
|
|
1003
1030
|
$xeModal.savePosStorage();
|
|
1004
|
-
return $xeModal.$nextTick()
|
|
1031
|
+
return $xeModal.$nextTick().then(function () {
|
|
1032
|
+
return {
|
|
1033
|
+
status: true
|
|
1034
|
+
};
|
|
1035
|
+
});
|
|
1005
1036
|
}
|
|
1037
|
+
return {
|
|
1038
|
+
status: false
|
|
1039
|
+
};
|
|
1006
1040
|
});
|
|
1007
1041
|
},
|
|
1008
1042
|
handleZoom: function handleZoom(type) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.allActiveModals=void 0;var _comp=require("../../ui/src/comp"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_dom=require("../../ui/src/dom"),_utils=require("../../ui/src/utils"),_button=_interopRequireDefault(require("../../button/src/button")),_index=_interopRequireDefault(require("../../loading/index")),_vn=require("../../ui/src/vn"),_log=require("../../ui/src/log");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _defineProperty(e,t,o){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var o=e[Symbol.toPrimitive];if(void 0===o)return("string"===t?String:Number)(e);o=o.call(e,t||"default");if("object"!=_typeof(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var o;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(o="Object"===(o={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:o)||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,i=Array(t);o<t;o++)i[o]=e[o];return i}function _iterableToArrayLimit(e,t){var o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i,n,a,l,r=[],s=!0,u=!1;try{if(a=(o=o.call(e)).next,0===t){if(Object(o)!==o)return;s=!1}else for(;!(s=(i=a.call(o)).done)&&(r.push(i.value),r.length!==t);s=!0);}catch(e){u=!0,n=e}finally{try{if(!s&&null!=o.return&&(l=o.return(),Object(l)!==l))return}finally{if(u)throw n}}return r}}function _arrayWithHoles(e){if(Array.isArray(e))return e}var allActiveModals=exports.allActiveModals=[],msgQueue=[],notifyQueue=[],lockScrollAttrKey="data-vxe-lock-scroll",lockScrollCssWidthKey="--vxe-ui-modal-lock-scroll-view-width",_default2=exports.default=(0,_comp.defineVxeComponent)({name:"VxeModal",mixins:[_ui.globalMixins.sizeMixin,_ui.globalMixins.permissionMixin],props:{value:Boolean,id:String,type:{type:String,default:"modal"},loading:{type:Boolean,default:null},status:String,iconStatus:String,className:String,top:{type:[Number,String],default:function(){return(0,_ui.getConfig)().modal.top}},position:[String,Object],title:String,duration:{type:[Number,String],default:function(){return(0,_ui.getConfig)().modal.duration}},content:[Number,String],showCancelButton:{type:Boolean,default:null},cancelButtonText:{type:String,default:function(){return(0,_ui.getConfig)().modal.cancelButtonText}},showConfirmButton:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.showConfirmButton}},confirmButtonText:{type:String,default:function(){return(0,_ui.getConfig)().modal.confirmButtonText}},lockView:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.lockView}},lockScroll:Boolean,mask:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.mask}},maskClosable:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.maskClosable}},escClosable:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.escClosable}},cancelClosable:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.cancelClosable}},confirmClosable:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.confirmClosable}},resize:Boolean,showHeader:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.showHeader}},showFooter:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.showFooter}},showZoom:Boolean,zoomConfig:Object,showMaximize:{type:Boolean,default:function(){return(0,_utils.handleBooleanDefaultValue)((0,_ui.getConfig)().modal.showMaximize)}},showMinimize:{type:Boolean,default:function(){return(0,_utils.handleBooleanDefaultValue)((0,_ui.getConfig)().modal.showMinimize)}},showClose:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.showClose}},dblclickZoom:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.dblclickZoom}},width:[Number,String],height:[Number,String],minWidth:{type:[Number,String],default:function(){return(0,_ui.getConfig)().modal.minWidth}},minHeight:{type:[Number,String],default:function(){return(0,_ui.getConfig)().modal.minHeight}},zIndex:Number,marginSize:{type:[Number,String],default:function(){return(0,_ui.getConfig)().modal.marginSize}},fullscreen:Boolean,draggable:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.draggable}},remember:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.remember}},destroyOnClose:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.destroyOnClose}},showTitleOverflow:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.showTitleOverflow}},transfer:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.transfer}},storage:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.storage}},storageKey:{type:String,default:function(){return(0,_ui.getConfig)().modal.storageKey}},padding:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.padding}},size:{type:String,default:function(){return(0,_ui.getConfig)().modal.size||(0,_ui.getConfig)().size}},beforeHideMethod:Function,slots:Object,message:[Number,String],animat:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.animat}}},provide:function(){return{$xeModal:this}},data:function(){return{xID:_xeUtils.default.uniqueId(),reactData:{initialized:!1,visible:!1,contentVisible:!1,modalTop:0,modalZindex:0,prevZoomStatus:"",zoomStatus:"",revertLocat:null,prevLocat:null,firstOpen:!0},internalData:{msgTimeout:void 0}}},computed:Object.assign(Object.assign({},{}),{computeIsMsg:function(){return"message"===this.type||"notification"===this.type},computeIsMinimizeStatus:function(){return"minimize"===this.reactData.zoomStatus},computeIsMaximizeStatus:function(){return"maximize"===this.reactData.zoomStatus},computeZoomOpts:function(){return Object.assign({},(0,_ui.getConfig)().modal.zoomConfig,this.zoomConfig)}}),watch:{width:function(){this.recalculate()},height:function(){this.recalculate()},value:function(e){e?this.openModal():this.closeModal("model")}},methods:{dispatchEvent:function(e,t,o){this.$emit(e,(0,_ui.createEvent)(o,{$modal:this},t))},emitModel:function(e){var t=this._events;this.$emit("input",e),t&&t.modelValue?this.$emit("modelValue",e):this.$emit("model-value",e)},callSlot:function(e,t,o){var i=this.$scopedSlots;return e&&(_xeUtils.default.isString(e)&&(e=i[e]||null),_xeUtils.default.isFunction(e))?(0,_vn.getSlotVNs)(e.call(this,t,o)):[]},open:function(){return this.openModal()},close:function(){return this.closeModal("close")},getBox:function(){return this.$refs.refModalBox},getPosition:function(){if(!this.computeIsMsg){var e=this.getBox();if(e)return{top:e.offsetTop,left:e.offsetLeft}}return null},setPosition:function(e,t){var o;return this.computeIsMsg||(o=this.getBox())&&(_xeUtils.default.isNumber(e)&&(o.style.top="".concat(e,"px")),_xeUtils.default.isNumber(t))&&(o.style.left="".concat(t,"px")),this.$nextTick()},isMinimized:function(){return"minimize"===this.reactData.zoomStatus},isMaximized:function(){return"maximize"===this.reactData.zoomStatus},zoom:function(){return this.handleZoom()},minimize:function(){return this.handleMinimize()},maximize:function(){return this.handleMaximize()},revert:function(){return this.handleRevert()},recalculate:function(){var e=this.width,t=this.height,o=this.getBox();return o&&(o.style.width=e?(0,_dom.toCssUnit)(e):"",o.style.height=t?(0,_dom.toCssUnit)(t):""),this.$nextTick()},updateZindex:function(){var e=this.reactData,t=this.zIndex,o=e.modalZindex;t?e.modalZindex=t:o<(0,_utils.getLastZIndex)()&&(e.modalZindex=(0,_utils.nextZIndex)())},updatePosition:function(){var c=this,d=c;return c.$nextTick().then(function(){var e,t,o,i,n,a,l,r=d.position,s=_xeUtils.default.toNumber(d.marginSize),u=c.getBox();u&&(e=document.documentElement.clientWidth||document.body.clientWidth,t=document.documentElement.clientHeight||document.body.clientHeight,o="center"===r,i=(r=_xeUtils.default.isString(r)?{top:r,left:r}:Object.assign({},r)).top,n=o||"center"===i,a=l="",a=(r=r.left)&&!(o||"center"===r)?isNaN(r)?r:"".concat(r,"px"):"".concat(Math.max(s,e/2-u.offsetWidth/2),"px"),l=i&&!n?isNaN(i)?i:"".concat(i,"px"):"".concat(Math.max(s,t/2-u.offsetHeight/2),"px"),u.style.top=l,u.style.left=a)})},updateStyle:function(){var t=this;this.$nextTick(function(){var e=t.type,o=0;("notification"===e?notifyQueue:msgQueue).forEach(function(e){var t=e.getBox();t&&(o+=_xeUtils.default.toNumber(e.top),e.reactData.modalTop=o,o+=t.clientHeight)})})},removeMsgQueue:function(){var t=this,e="notification"===t.type?notifyQueue:msgQueue;-1<e.indexOf(t)&&_xeUtils.default.remove(e,function(e){return e===t}),t.updateStyle()},closeModal:function(e){var t=this,o=t.reactData,i=t.remember,n=o.visible,a=t.computeIsMsg,l=t.beforeHideMethod||(0,_ui.getConfig)().modal.beforeHideMethod,r={type:e};return n&&Promise.resolve(l?l(r):null).then(function(e){_xeUtils.default.isError(e)||(a&&t.removeMsgQueue(),o.contentVisible=!1,i||t.handleRevert(),_xeUtils.default.remove(allActiveModals,function(e){return e===t}),t.dispatchEvent("before-hide",r,null),setTimeout(function(){o.visible=!1,t.emitModel(!1),t.dispatchEvent("hide",r,null)},200),t.removeBodyLockScroll())}).catch(function(e){return e}),t.$nextTick()},closeEvent:function(e){var t="close";this.dispatchEvent(t,{type:t},e),this.closeModal(t)},confirmEvent:function(e){var t=this.confirmClosable,o="confirm";this.dispatchEvent(o,{type:o},e),t&&this.closeModal(o)},cancelEvent:function(e){var t=this.cancelClosable,o="cancel";this.dispatchEvent(o,{type:o},e),t&&this.closeModal(o)},getStorageMap:function(e){var t=(0,_ui.getConfig)().version,e=_xeUtils.default.toStringJSON(localStorage.getItem(e)||"");return e&&e._v===t?e:{_v:t}},hasPosStorage:function(){var e=this.id,t=this.remember,o=this.storage,i=this.storageKey;return!!(e&&t&&o&&this.getStorageMap(i)[e])},restorePosStorage:function(){var e,t,o,i,n,a=this.reactData,l=this.id,r=this.remember,s=this.storage,u=this.storageKey;l&&r&&s&&(r=this.getStorageMap(u)[l])&&(s=this.getBox(),l=(u=_slicedToArray(r.split(","),8))[0],r=u[1],e=u[2],t=u[3],o=u[4],i=u[5],n=u[6],u=u[7],s&&(l&&(s.style.left="".concat(l,"px")),r&&(s.style.top="".concat(r,"px")),e&&(s.style.width="".concat(e,"px")),t)&&(s.style.height="".concat(t,"px")),o)&&i&&(a.revertLocat={left:o,top:i,width:n,height:u})},addMsgQueue:function(){var e="notification"===this.type?notifyQueue:msgQueue;-1===e.indexOf(this)&&e.push(this),this.updateStyle()},savePosStorage:function(){var e=this.reactData,t=this.id,o=this.remember,i=this.storage,n=this.storageKey,e=e.revertLocat;t&&o&&i&&(o=this.getBox())&&((i=this.getStorageMap(n))[t]=[o.style.left,o.style.top,o.style.width,o.style.height].concat(e?[e.left,e.top,e.width,e.height]:[]).map(function(e){return e?_xeUtils.default.toNumber(e):""}).join(","),localStorage.setItem(n,_xeUtils.default.toJSONString(i)))},handleMinimize:function(){var r=this,s=r.reactData,e=r.computeZoomOpts,t=e.minimizeLayout,o=e.minimizeMaxSize,u=e.minimizeHorizontalOffset,c=e.minimizeVerticalOffset,d=e.minimizeOffsetMethod,m="horizontal"===t,f=s.zoomStatus,i=[],n=[],p=(allActiveModals.forEach(function(e){e.xID!==r.xID&&"modal"===e.type&&"minimize"===e.reactData.zoomStatus&&("horizontal"===e.computeZoomOpts.minimizeLayout?i:n).push(e)}),m?i:n);return o&&o<=p.length?(_ui.VxeUI.modal&&_ui.VxeUI.modal.message({status:"error",content:(0,_ui.getI18n)("vxe.modal.miniMaxSize",[o])}),r.$nextTick()):(s.prevZoomStatus=f,s.zoomStatus="minimize",r.$nextTick().then(function(){var e,t,o,i,n,a,l=r.getBox();l&&(e=r.$refs.refHeaderElem)&&(a=(0,_dom.getDomNode)().visibleHeight,f||(s.revertLocat={top:l.offsetTop,left:l.offsetLeft,width:l.offsetWidth+(l.style.width?0:1),height:l.offsetHeight+(l.style.height?0:1)}),o=_xeUtils.default[m?"max":"min"](p,function(e){e=e.getBox();return e?_xeUtils.default.toNumber(e.style[m?"left":"top"]):0}),a=a-e.offsetHeight-16,n=16,o&&(o=o.getBox())&&(t=_xeUtils.default.toNumber(o.style.left),o=_xeUtils.default.toNumber(o.style.top),i={},i=m?Object.assign({},u):Object.assign({},c),n=t+_xeUtils.default.toNumber(i.left),a=o+_xeUtils.default.toNumber(i.top),d)&&(i=d({$modal:r,left:n,top:a}),n=_xeUtils.default.toNumber(i.left),a=_xeUtils.default.toNumber(i.top)),Object.assign(l.style,{top:"".concat(a,"px"),left:"".concat(n,"px"),width:"200px",height:"".concat(e.offsetHeight,"px")}),r.savePosStorage())}))},handleMaximize:function(){var t=this,o=t.reactData,i=o.zoomStatus;return o.prevZoomStatus=i,o.zoomStatus="maximize",t.$nextTick().then(function(){var e=t.getBox();e&&(i||(o.revertLocat={top:e.offsetTop,left:e.offsetLeft,width:e.offsetWidth+(e.style.width?0:1),height:e.offsetHeight+(e.style.height?0:1)}),Object.assign(e.style,{top:"0",left:"0",width:"100%",height:"100%"})),t.savePosStorage()})},handleMsgAutoClose:function(){var e=this,t=e.internalData,o=e.duration;-1!==o&&(t.msgTimeout=setTimeout(function(){return e.closeModal("close")},_xeUtils.default.toNumber(o)))},removeBodyLockScroll:function(){var t=this.xID,e=document.documentElement,o=e.getAttribute(lockScrollAttrKey);o&&((o=o.split(",").filter(function(e){return e!==t})).length?e.setAttribute(lockScrollAttrKey,o.join(",")):(e.removeAttribute(lockScrollAttrKey),e.style.removeProperty(lockScrollCssWidthKey)))},addBodyLockScroll:function(){var e,t=this.xID,o=this.lockScroll,i=this.computeIsMsg;o&&!i&&(o=document.documentElement,i=document.body.clientWidth,(e=(e=o.getAttribute(lockScrollAttrKey))?e.split(","):[]).includes(t)||(e.push(t),o.setAttribute(lockScrollAttrKey,e.join(","))),o.style.setProperty(lockScrollCssWidthKey,"".concat(i,"px")))},openModal:function(){var o=this,i=o,n=o.reactData,a=i.remember,l=i.showFooter,e=n.initialized,t=n.visible,r=o.computeIsMsg;return e||(n.initialized=!0,this.transfer&&(e=o.$refs.refElem,document.body.appendChild(e))),t||(o.addBodyLockScroll(),n.visible=!0,n.contentVisible=!1,o.updateZindex(),allActiveModals.push(o),a||o.$nextTick(function(){o.recalculate()}),setTimeout(function(){n.contentVisible=!0,o.$nextTick(function(){l&&(e=o.$refs.refConfirmBtn,t=o.$refs.refCancelBtn,e=e||t)&&e.focus();var e,t={type:""};o.emitModel(!0),o.dispatchEvent("show",t,null)})},10),r?(o.addMsgQueue(),o.handleMsgAutoClose()):o.$nextTick(function(){var e=i.fullscreen,t=n.firstOpen;a&&!t||o.updatePosition().then(function(){setTimeout(function(){return o.updatePosition()},20)}),t&&(n.firstOpen=!1,o.hasPosStorage())?o.restorePosStorage():e&&o.$nextTick(function(){return o.handleMaximize()})})),o.$nextTick()},selfClickEvent:function(e){var t=this.$refs.refElem;this.maskClosable&&e.target===t&&this.closeModal("mask")},selfMouseoverEvent:function(){var e=this.internalData,t=e.msgTimeout;t&&this.computeIsMsg&&(clearTimeout(t),e.msgTimeout=void 0)},selfMouseoutEvent:function(){this.internalData.msgTimeout||this.computeIsMsg&&this.handleMsgAutoClose()},handleGlobalKeydownEvent:function(e){var t,o=this;_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ESCAPE)&&(t=_xeUtils.default.max(allActiveModals,function(e){return e.reactData.modalZindex}))&&setTimeout(function(){t===o&&t.escClosable&&(o.dispatchEvent("close",{type:"exit"},e),o.closeModal("exit"))},10)},handleRevert:function(){var o=this,i=o.reactData;return i.prevZoomStatus=i.zoomStatus,i.zoomStatus="",o.$nextTick().then(function(){var e,t=i.revertLocat;if(t)return e=o.getBox(),i.revertLocat=null,e&&Object.assign(e.style,{top:"".concat(t.top,"px"),left:"".concat(t.left,"px"),width:"".concat(t.width,"px"),height:"".concat(t.height,"px")}),o.savePosStorage(),o.$nextTick()})},handleZoom:function(t){var o=this,e=o.reactData,i=e.zoomStatus;return new Promise(function(e){if(t)return"maximize"===t?void e(o.handleMaximize()):"minimize"===t?void e(o.handleMinimize()):void e(o.handleRevert());e(i?o.handleRevert():o.handleMaximize())}).then(function(){return e.zoomStatus||"revert"})},toggleZoomMinEvent:function(t){var o=this,e=o.reactData,i=e.zoomStatus;return o.handleZoom("minimize"===i?e.prevZoomStatus||"revert":"minimize").then(function(e){o.dispatchEvent("zoom",{type:e},t)})},toggleZoomMaxEvent:function(t){var o=this;return o.handleZoom().then(function(e){o.dispatchEvent("zoom",{type:e},t)})},boxMousedownEvent:function(){var t=this.reactData.modalZindex;allActiveModals.some(function(e){return e.reactData.visible&&e.reactData.modalZindex>t})&&this.updateZindex()},mousedownEvent:function(e){var t,o,a,l,r,s,u=this,i=u.reactData,n=u.remember,c=u.storage,i=i.zoomStatus,d=_xeUtils.default.toNumber(u.marginSize),m=u.getBox();m&&"maximize"!==i&&0===e.button&&!(0,_dom.getEventTargetNode)(e,m,"trigger--btn").flag&&(e.preventDefault(),t=document.onmousemove,o=document.onmouseup,a=e.clientX-m.offsetLeft,l=e.clientY-m.offsetTop,i=(0,_dom.getDomNode)(),r=i.visibleHeight,s=i.visibleWidth,document.onmousemove=function(e){e.preventDefault();var t=m.offsetWidth,o=m.offsetHeight,t=s-t-d-1,o=r-o-d-1,i=e.clientX-a,n=e.clientY-l;(n=o<n?o:n)<d&&(n=d),m.style.left="".concat(i=(i=t<i?t:i)<d?d:i,"px"),m.style.top="".concat(n,"px"),m.className=m.className.replace(/\s?is--drag/,"")+" is--drag",u.$emit("move",(0,_ui.createEvent)(e,{type:"move"}))},document.onmouseup=function(){document.onmousemove=t,document.onmouseup=o,n&&c&&u.$nextTick(function(){u.savePosStorage()}),setTimeout(function(){m.className=m.className.replace(/\s?is--drag/,"")},50)})},dragEvent:function(e){var a=this,t=a,o=a.reactData,l=(e.preventDefault(),t.remember),r=t.storage,i=(0,_dom.getDomNode)(),s=i.visibleHeight,u=i.visibleWidth,c=_xeUtils.default.toNumber(t.marginSize),d=e.target.getAttribute("type"),m=_xeUtils.default.toNumber(t.minWidth),f=_xeUtils.default.toNumber(t.minHeight),p=u,h=s,g=a.getBox(),n=document.onmousemove,v=document.onmouseup,y=g.clientWidth,x=g.clientHeight,_=e.clientX,b=e.clientY,S=g.offsetTop,M=g.offsetLeft,z={type:"resize"};document.onmousemove=function(e){var t,o,i,n;switch(e.preventDefault(),d){case"wl":i=(t=_-e.clientX)+y,c<M-t&&m<i&&(g.style.width="".concat(i<p?i:p,"px"),g.style.left="".concat(M-t,"px"));break;case"swst":i=(t=_-e.clientX)+y,n=(o=b-e.clientY)+x,c<M-t&&m<i&&(g.style.width="".concat(i<p?i:p,"px"),g.style.left="".concat(M-t,"px")),c<S-o&&f<n&&(g.style.height="".concat(n<h?n:h,"px"),g.style.top="".concat(S-o,"px"));break;case"swlb":i=(t=_-e.clientX)+y,n=(o=e.clientY-b)+x,c<M-t&&m<i&&(g.style.width="".concat(i<p?i:p,"px"),g.style.left="".concat(M-t,"px")),S+n+c<s&&f<n&&(g.style.height="".concat(n<h?n:h,"px"));break;case"st":o=b-e.clientY,n=x+o,c<S-o&&f<n&&(g.style.height="".concat(n<h?n:h,"px"),g.style.top="".concat(S-o,"px"));break;case"wr":t=e.clientX-_,M+(i=t+y)+c<u&&m<i&&(g.style.width="".concat(i<p?i:p,"px"));break;case"sest":t=e.clientX-_,n=(o=b-e.clientY)+x,M+(i=t+y)+c<u&&m<i&&(g.style.width="".concat(i<p?i:p,"px")),c<S-o&&f<n&&(g.style.height="".concat(n<h?n:h,"px"),g.style.top="".concat(S-o,"px"));break;case"selb":t=e.clientX-_,n=(o=e.clientY-b)+x,M+(i=t+y)+c<u&&m<i&&(g.style.width="".concat(i<p?i:p,"px")),S+n+c<s&&f<n&&(g.style.height="".concat(n<h?n:h,"px"));break;case"sb":o=e.clientY-b,S+(n=o+x)+c<s&&f<n&&(g.style.height="".concat(n<h?n:h,"px"))}g.className=g.className.replace(/\s?is--drag/,"")+" is--drag",l&&r&&a.savePosStorage(),a.dispatchEvent("resize",z,e)},document.onmouseup=function(){o.revertLocat=null,document.onmousemove=n,document.onmouseup=v,setTimeout(function(){g.className=g.className.replace(/\s?is--drag/,"")},50)}},renderTitles:function(e){var t=this,o=t.$scopedSlots,i=t.slots,i=void 0===i?{}:i,n=t.showClose,a=t.showZoom,l=t.showMaximize,r=t.showMinimize,s=t.title,u=t.reactData.zoomStatus,c=o.title||i.title,o=o.corner||i.corner,i=t.computeIsMinimizeStatus;return[e("div",{class:"vxe-modal--header-title"},c?t.callSlot(c,{$modal:t,minimized:i,maximized:t.computeIsMaximizeStatus},e):s?(0,_utils.getFuncText)(s):(0,_ui.getI18n)("vxe.alert.title")),e("div",{class:"vxe-modal--header-right"},[o&&!i?e("div",{class:"vxe-modal--corner-wrapper"},t.callSlot(o,{$modal:t},e)):(0,_ui.renderEmptyElement)(t),(_xeUtils.default.isBoolean(r)?r:a)?e("div",{class:["vxe-modal--zoom-btn","trigger--btn"],attrs:{title:(0,_ui.getI18n)("vxe.modal.zoom".concat("minimize"===u?"Out":"Min"))},on:{click:t.toggleZoomMinEvent}},[e("i",{class:"minimize"===u?(0,_ui.getIcon)().MODAL_ZOOM_REVERT:(0,_ui.getIcon)().MODAL_ZOOM_MIN})]):(0,_ui.renderEmptyElement)(t),(_xeUtils.default.isBoolean(l)?l:a)&&"minimize"!==u?e("div",{class:["vxe-modal--zoom-btn","trigger--btn"],attrs:{title:(0,_ui.getI18n)("vxe.modal.zoom".concat("maximize"===u?"Out":"In"))},on:{click:t.toggleZoomMaxEvent}},[e("i",{class:"maximize"===u?(0,_ui.getIcon)().MODAL_ZOOM_OUT:(0,_ui.getIcon)().MODAL_ZOOM_IN})]):(0,_ui.renderEmptyElement)(t),n?e("div",{class:["vxe-modal--close-btn","trigger--btn"],attrs:{title:(0,_ui.getI18n)("vxe.modal.close")},on:{click:t.closeEvent}},[e("i",{class:(0,_ui.getIcon)().MODAL_CLOSE})]):(0,_ui.renderEmptyElement)(t)])]},renderHeader:function(e){var t=this,o=t,i=t.$scopedSlots,n=o.slots,a=o.showZoom,l=o.showMaximize,r=t.computeIsMsg,i=i.header||(void 0===n?{}:n).header;return o.showHeader?(n={},o.draggable&&(n.mousedown=t.mousedownEvent),(_xeUtils.default.isBoolean(l)?l:a)&&o.dblclickZoom&&"modal"===o.type&&(n.dblclick=t.toggleZoomMaxEvent),e("div",{ref:"refHeaderElem",class:["vxe-modal--header",{"is--ellipsis":!r&&o.showTitleOverflow}],on:n},i?t.callSlot(i,{$modal:t},e):t.renderTitles(e))):(0,_ui.renderEmptyElement)(t)},renderBody:function(e){var t=this,o=t,i=t.$scopedSlots,n=o.slots,n=void 0===n?{}:n,a=o.status,l=o.iconStatus,r=o.content||o.message,s=t.computeIsMsg,u=i.default||n.default,c=i.left||n.left,i=i.right||n.right,n=[];return s||!a&&!l||n.push(e("div",{class:"vxe-modal--status-wrapper"},[e("i",{class:["vxe-modal--status-icon",l||(0,_ui.getIcon)()["MODAL_".concat(a).toLocaleUpperCase()]]})])),n.push(e("div",{class:"vxe-modal--content"},u?t.callSlot(u,{$modal:t},e):(0,_utils.getFuncText)(r))),e("div",{class:"vxe-modal--body"},[c?e("div",{class:"vxe-modal--body-left"},t.callSlot(c,{$modal:t},e)):(0,_ui.renderEmptyElement)(t),e("div",{class:"vxe-modal--body-default"},n),i?e("div",{class:"vxe-modal--body-right"},t.callSlot(i,{$modal:t},e)):(0,_ui.renderEmptyElement)(t),s?(0,_ui.renderEmptyElement)(t):e(_index.default,{class:"vxe-modal--loading",props:{value:o.loading}})])},renderDefaultFooter:function(e){var t=this,o=t,i=t.$scopedSlots,n=o.slots,n=void 0===n?{}:n,a=o.showCancelButton,l=o.showConfirmButton,r=o.type,s=o.loading,u=i.leftfoot||n.leftfoot,i=i.rightfoot||n.rightfoot,n=[];return(_xeUtils.default.isBoolean(a)?a:"confirm"===r)&&n.push(e(_button.default,{key:1,ref:"refCancelBtn",props:{content:o.cancelButtonText||(0,_ui.getI18n)("vxe.button.cancel")},on:{click:t.cancelEvent}})),(_xeUtils.default.isBoolean(l)?l:"confirm"===r||"alert"===r)&&n.push(e(_button.default,{key:2,ref:"refConfirmBtn",props:{status:"primary",loading:s,content:o.confirmButtonText||(0,_ui.getI18n)("vxe.button.confirm")},on:{click:t.confirmEvent}})),e("div",{class:"vxe-modal--footer-wrapper"},[e("div",{class:"vxe-modal--footer-left"},u?t.callSlot(u,{$modal:t},e):[]),e("div",{class:"vxe-modal--footer-right"},i?t.callSlot(i,{$modal:t},e):n)])},renderFooter:function(e){var t=this,o=t.$scopedSlots,i=t.slots,o=o.footer||(void 0===i?{}:i).footer;return t.showFooter?e("div",{class:"vxe-modal--footer"},o?t.callSlot(o,{$modal:t},e):[t.renderDefaultFooter(e)]):(0,_ui.renderEmptyElement)(t)},renderVN:function(t){var o=this,e=o.$scopedSlots,i=o.reactData,n=o.slots,a=o.className,l=o.type,r=o.animat,s=o.draggable,u=o.iconStatus,c=o.position,d=o.loading,m=o.destroyOnClose,f=o.status,p=o.lockScroll,h=o.padding,g=o.lockView,v=o.mask,y=o.resize,x=i.initialized,_=i.modalTop,b=i.contentVisible,S=i.visible,M=i.zoomStatus,e=e.aside||(void 0===n?{}:n).aside,n=o.computeSize,z=o.computeIsMsg,w=o.computeIsMinimizeStatus,E={};return z&&(E.mouseover=o.selfMouseoverEvent,E.mouseout=o.selfMouseoutEvent),t("div",{ref:"refElem",class:["vxe-modal--wrapper","type--".concat(l),"zoom--".concat(M||"revert"),a||"",c?"pos--".concat(c):"",(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(l={},"size--".concat(n),n),"status--".concat(f),f),"is--padding",h),"is--animat",r),"lock--scroll",p),"lock--view",g),"is--draggable",s),"is--resize",y),"is--mask",v),"is--visible",b),_defineProperty(_defineProperty(l,"is--active",S),"is--loading",d))],style:{zIndex:i.modalZindex,top:_?"".concat(_,"px"):null},on:Object.assign(Object.assign({},E),{click:o.selfClickEvent})},x?[t("div",{ref:"refModalBox",class:"vxe-modal--box",on:{mousedown:o.boxMousedownEvent}},[!z&&!e||w?(0,_ui.renderEmptyElement)(o):t("div",{class:"vxe-modal--aside"},e?o.callSlot(e,{$modal:o},t):[f||u?t("div",{class:"vxe-modal--status-wrapper"},[t("i",{class:["vxe-modal--status-icon",u||(0,_ui.getIcon)()["MODAL_".concat(f).toLocaleUpperCase()]]})]):(0,_ui.renderEmptyElement)(o)]),t("div",{class:"vxe-modal--container"},!i.initialized||m&&!i.visible?[]:[o.renderHeader(t),o.renderBody(t),o.renderFooter(t),!z&&y?t("span",{class:"vxe-modal--resize"},["wl","wr","swst","sest","st","swlb","selb","sb"].map(function(e){return t("span",{class:"".concat(e,"-resize"),attrs:{type:e},on:{mousedown:o.dragEvent}})})):(0,_ui.renderEmptyElement)(o)])])]:[])}},mounted:function(){var e=this,t=e.$scopedSlots,o=e;"development"===process.env.NODE_ENV&&"modal"===o.type&&o.showFooter&&!(o.showConfirmButton||o.showCancelButton||t.footer)&&(0,_log.warnLog)("vxe.modal.footPropErr"),e.$nextTick(function(){o.storage&&!o.id&&(0,_log.errLog)("vxe.error.reqProp",["modal.id"]),o.value&&e.openModal(),e.recalculate()}),o.escClosable&&_ui.globalEvents.on(e,"keydown",e.handleGlobalKeydownEvent)},beforeDestroy:function(){var e=this.$refs.refElem;e&&e.parentNode&&e.parentNode.removeChild(e),_ui.globalEvents.off(this,"keydown"),this.removeMsgQueue(),this.removeBodyLockScroll()},render:function(e){return this.renderVN(e)}});
|
|
1
|
+
function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.allActiveModals=void 0;var _comp=require("../../ui/src/comp"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_dom=require("../../ui/src/dom"),_utils=require("../../ui/src/utils"),_button=_interopRequireDefault(require("../../button/src/button")),_index=_interopRequireDefault(require("../../loading/index")),_vn=require("../../ui/src/vn"),_log=require("../../ui/src/log");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _defineProperty(e,t,o){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var o=e[Symbol.toPrimitive];if(void 0===o)return("string"===t?String:Number)(e);o=o.call(e,t||"default");if("object"!=_typeof(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var o;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(o="Object"===(o={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:o)||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,i=Array(t);o<t;o++)i[o]=e[o];return i}function _iterableToArrayLimit(e,t){var o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i,n,a,r,l=[],s=!0,u=!1;try{if(a=(o=o.call(e)).next,0===t){if(Object(o)!==o)return;s=!1}else for(;!(s=(i=a.call(o)).done)&&(l.push(i.value),l.length!==t);s=!0);}catch(e){u=!0,n=e}finally{try{if(!s&&null!=o.return&&(r=o.return(),Object(r)!==r))return}finally{if(u)throw n}}return l}}function _arrayWithHoles(e){if(Array.isArray(e))return e}var allActiveModals=exports.allActiveModals=[],msgQueue=[],notifyQueue=[],lockScrollAttrKey="data-vxe-lock-scroll",lockScrollCssWidthKey="--vxe-ui-modal-lock-scroll-view-width",_default2=exports.default=(0,_comp.defineVxeComponent)({name:"VxeModal",mixins:[_ui.globalMixins.sizeMixin,_ui.globalMixins.permissionMixin],props:{value:Boolean,id:String,type:{type:String,default:"modal"},loading:{type:Boolean,default:null},status:String,iconStatus:String,className:String,top:{type:[Number,String],default:function(){return(0,_ui.getConfig)().modal.top}},position:[String,Object],title:String,duration:{type:[Number,String],default:function(){return(0,_ui.getConfig)().modal.duration}},content:[Number,String],showCancelButton:{type:Boolean,default:null},cancelButtonText:{type:String,default:function(){return(0,_ui.getConfig)().modal.cancelButtonText}},showConfirmButton:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.showConfirmButton}},confirmButtonText:{type:String,default:function(){return(0,_ui.getConfig)().modal.confirmButtonText}},lockView:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.lockView}},lockScroll:Boolean,mask:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.mask}},maskClosable:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.maskClosable}},escClosable:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.escClosable}},cancelClosable:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.cancelClosable}},confirmClosable:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.confirmClosable}},resize:Boolean,showHeader:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.showHeader}},showFooter:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.showFooter}},showZoom:Boolean,zoomConfig:Object,showMaximize:{type:Boolean,default:function(){return(0,_utils.handleBooleanDefaultValue)((0,_ui.getConfig)().modal.showMaximize)}},showMinimize:{type:Boolean,default:function(){return(0,_utils.handleBooleanDefaultValue)((0,_ui.getConfig)().modal.showMinimize)}},showClose:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.showClose}},dblclickZoom:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.dblclickZoom}},width:[Number,String],height:[Number,String],minWidth:{type:[Number,String],default:function(){return(0,_ui.getConfig)().modal.minWidth}},minHeight:{type:[Number,String],default:function(){return(0,_ui.getConfig)().modal.minHeight}},zIndex:Number,marginSize:{type:[Number,String],default:function(){return(0,_ui.getConfig)().modal.marginSize}},fullscreen:Boolean,draggable:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.draggable}},remember:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.remember}},destroyOnClose:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.destroyOnClose}},showTitleOverflow:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.showTitleOverflow}},transfer:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.transfer}},storage:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.storage}},storageKey:{type:String,default:function(){return(0,_ui.getConfig)().modal.storageKey}},padding:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.padding}},size:{type:String,default:function(){return(0,_ui.getConfig)().modal.size||(0,_ui.getConfig)().size}},beforeHideMethod:Function,slots:Object,message:[Number,String],animat:{type:Boolean,default:function(){return(0,_ui.getConfig)().modal.animat}}},provide:function(){return{$xeModal:this}},data:function(){return{xID:_xeUtils.default.uniqueId(),reactData:{initialized:!1,visible:!1,contentVisible:!1,modalTop:0,modalZindex:0,prevZoomStatus:"",zoomStatus:"",revertLocat:null,prevLocat:null,firstOpen:!0},internalData:{msgTimeout:void 0}}},computed:Object.assign(Object.assign({},{}),{computeIsMsg:function(){return"message"===this.type||"notification"===this.type},computeIsMinimizeStatus:function(){return"minimize"===this.reactData.zoomStatus},computeIsMaximizeStatus:function(){return"maximize"===this.reactData.zoomStatus},computeZoomOpts:function(){return Object.assign({},(0,_ui.getConfig)().modal.zoomConfig,this.zoomConfig)}}),watch:{width:function(){this.recalculate()},height:function(){this.recalculate()},value:function(e){e?this.openModal():this.closeModal("model")}},methods:{dispatchEvent:function(e,t,o){this.$emit(e,(0,_ui.createEvent)(o,{$modal:this},t))},emitModel:function(e){var t=this._events;this.$emit("input",e),t&&t.modelValue?this.$emit("modelValue",e):this.$emit("model-value",e)},callSlot:function(e,t,o){var i=this.$scopedSlots;return e&&(_xeUtils.default.isString(e)&&(e=i[e]||null),_xeUtils.default.isFunction(e))?(0,_vn.getSlotVNs)(e.call(this,t,o)):[]},open:function(){return this.openModal()},close:function(){return this.closeModal("close")},getBox:function(){return this.$refs.refModalBox},getPosition:function(){if(!this.computeIsMsg){var e=this.getBox();if(e)return{top:e.offsetTop,left:e.offsetLeft}}return null},setPosition:function(e,t){var o;return this.computeIsMsg||(o=this.getBox())&&(_xeUtils.default.isNumber(e)&&(o.style.top="".concat(e,"px")),_xeUtils.default.isNumber(t))&&(o.style.left="".concat(t,"px")),this.$nextTick()},isMinimized:function(){return"minimize"===this.reactData.zoomStatus},isMaximized:function(){return"maximize"===this.reactData.zoomStatus},zoom:function(){return this.handleZoom()},minimize:function(){return this.reactData.visible?this.handleMinimize():Promise.resolve({status:!1})},maximize:function(){return this.reactData.visible?this.handleMaximize():Promise.resolve({status:!1})},revert:function(){return this.reactData.visible?this.handleRevert():Promise.resolve({status:!1})},recalculate:function(){var e=this.width,t=this.height,o=this.getBox();return o&&(o.style.width=e?(0,_dom.toCssUnit)(e):"",o.style.height=t?(0,_dom.toCssUnit)(t):""),this.$nextTick()},updateZindex:function(){var e=this.reactData,t=this.zIndex,o=e.modalZindex;t?e.modalZindex=t:o<(0,_utils.getLastZIndex)()&&(e.modalZindex=(0,_utils.nextZIndex)())},updatePosition:function(){var c=this,d=c;return c.$nextTick().then(function(){var e,t,o,i,n,a,r,l=d.position,s=_xeUtils.default.toNumber(d.marginSize),u=c.getBox();u&&(e=document.documentElement.clientWidth||document.body.clientWidth,t=document.documentElement.clientHeight||document.body.clientHeight,o="center"===l,i=(l=_xeUtils.default.isString(l)?{top:l,left:l}:Object.assign({},l)).top,n=o||"center"===i,a=r="",a=(l=l.left)&&!(o||"center"===l)?isNaN(l)?l:"".concat(l,"px"):"".concat(Math.max(s,e/2-u.offsetWidth/2),"px"),r=i&&!n?isNaN(i)?i:"".concat(i,"px"):"".concat(Math.max(s,t/2-u.offsetHeight/2),"px"),u.style.top=r,u.style.left=a)})},updateStyle:function(){var t=this;this.$nextTick(function(){var e=t.type,o=0;("notification"===e?notifyQueue:msgQueue).forEach(function(e){var t=e.getBox();t&&(o+=_xeUtils.default.toNumber(e.top),e.reactData.modalTop=o,o+=t.clientHeight)})})},removeMsgQueue:function(){var t=this,e="notification"===t.type?notifyQueue:msgQueue;-1<e.indexOf(t)&&_xeUtils.default.remove(e,function(e){return e===t}),t.updateStyle()},closeModal:function(e){var t=this,o=t.reactData,i=t.remember,n=o.visible,a=t.computeIsMsg,r=t.beforeHideMethod||(0,_ui.getConfig)().modal.beforeHideMethod,l={type:e};return n&&Promise.resolve(r?r(l):null).then(function(e){_xeUtils.default.isError(e)||(a&&t.removeMsgQueue(),o.contentVisible=!1,i||t.handleRevert(),_xeUtils.default.remove(allActiveModals,function(e){return e===t}),t.dispatchEvent("before-hide",l,null),setTimeout(function(){o.visible=!1,t.emitModel(!1),t.dispatchEvent("hide",l,null)},200),t.removeBodyLockScroll())}).catch(function(e){return e}),t.$nextTick()},closeEvent:function(e){var t="close";this.dispatchEvent(t,{type:t},e),this.closeModal(t)},confirmEvent:function(e){var t=this.confirmClosable,o="confirm";this.dispatchEvent(o,{type:o},e),t&&this.closeModal(o)},cancelEvent:function(e){var t=this.cancelClosable,o="cancel";this.dispatchEvent(o,{type:o},e),t&&this.closeModal(o)},getStorageMap:function(e){var t=(0,_ui.getConfig)().version,e=_xeUtils.default.toStringJSON(localStorage.getItem(e)||"");return e&&e._v===t?e:{_v:t}},hasPosStorage:function(){var e=this.id,t=this.remember,o=this.storage,i=this.storageKey;return!!(e&&t&&o&&this.getStorageMap(i)[e])},restorePosStorage:function(){var e,t,o,i,n,a=this.reactData,r=this.id,l=this.remember,s=this.storage,u=this.storageKey;r&&l&&s&&(l=this.getStorageMap(u)[r])&&(s=this.getBox(),r=(u=_slicedToArray(l.split(","),8))[0],l=u[1],e=u[2],t=u[3],o=u[4],i=u[5],n=u[6],u=u[7],s&&(r&&(s.style.left="".concat(r,"px")),l&&(s.style.top="".concat(l,"px")),e&&(s.style.width="".concat(e,"px")),t)&&(s.style.height="".concat(t,"px")),o)&&i&&(a.revertLocat={left:o,top:i,width:n,height:u})},addMsgQueue:function(){var e="notification"===this.type?notifyQueue:msgQueue;-1===e.indexOf(this)&&e.push(this),this.updateStyle()},savePosStorage:function(){var e=this.reactData,t=this.id,o=this.remember,i=this.storage,n=this.storageKey,e=e.revertLocat;t&&o&&i&&(o=this.getBox())&&((i=this.getStorageMap(n))[t]=[o.style.left,o.style.top,o.style.width,o.style.height].concat(e?[e.left,e.top,e.width,e.height]:[]).map(function(e){return e?_xeUtils.default.toNumber(e):""}).join(","),localStorage.setItem(n,_xeUtils.default.toJSONString(i)))},handleMinimize:function(){var l=this,s=l.reactData,e=l.computeZoomOpts,t=e.minimizeLayout,o=e.minimizeMaxSize,u=e.minimizeHorizontalOffset,c=e.minimizeVerticalOffset,d=e.minimizeOffsetMethod,m="horizontal"===t,f=s.zoomStatus,i=[],n=[],h=(allActiveModals.forEach(function(e){e.xID!==l.xID&&"modal"===e.type&&"minimize"===e.reactData.zoomStatus&&("horizontal"===e.computeZoomOpts.minimizeLayout?i:n).push(e)}),m?i:n);return o&&o<=h.length?(_ui.VxeUI.modal&&_ui.VxeUI.modal.message({status:"error",content:(0,_ui.getI18n)("vxe.modal.miniMaxSize",[o])}),Promise.resolve({status:!1})):(s.prevZoomStatus=f,s.zoomStatus="minimize",l.$nextTick().then(function(){var e,t,o,i,n,a,r=l.getBox();return r&&(e=l.$refs.refHeaderElem)?(a=(0,_dom.getDomNode)().visibleHeight,f||(s.revertLocat={top:r.offsetTop,left:r.offsetLeft,width:r.offsetWidth+(r.style.width?0:1),height:r.offsetHeight+(r.style.height?0:1)}),o=_xeUtils.default[m?"max":"min"](h,function(e){e=e.getBox();return e?_xeUtils.default.toNumber(e.style[m?"left":"top"]):0}),a=a-e.offsetHeight-16,n=16,o&&(o=o.getBox())&&(t=_xeUtils.default.toNumber(o.style.left),o=_xeUtils.default.toNumber(o.style.top),i={},i=m?Object.assign({},u):Object.assign({},c),n=t+_xeUtils.default.toNumber(i.left),a=o+_xeUtils.default.toNumber(i.top),d)&&(i=d({$modal:l,left:n,top:a}),n=_xeUtils.default.toNumber(i.left),a=_xeUtils.default.toNumber(i.top)),Object.assign(r.style,{top:"".concat(a,"px"),left:"".concat(n,"px"),width:"200px",height:"".concat(e.offsetHeight,"px")}),l.savePosStorage(),{status:!0}):{status:!1}}))},handleMaximize:function(){var t=this,o=t.reactData,i=o.zoomStatus;return o.prevZoomStatus=i,o.zoomStatus="maximize",t.$nextTick().then(function(){var e=t.getBox();e&&(i||(o.revertLocat={top:e.offsetTop,left:e.offsetLeft,width:e.offsetWidth+(e.style.width?0:1),height:e.offsetHeight+(e.style.height?0:1)}),Object.assign(e.style,{top:"0",left:"0",width:"100%",height:"100%"})),t.savePosStorage()})},handleMsgAutoClose:function(){var e=this,t=e.internalData,o=e.duration;-1!==o&&(t.msgTimeout=setTimeout(function(){return e.closeModal("close")},_xeUtils.default.toNumber(o)))},removeBodyLockScroll:function(){var t=this.xID,e=document.documentElement,o=e.getAttribute(lockScrollAttrKey);o&&((o=o.split(",").filter(function(e){return e!==t})).length?e.setAttribute(lockScrollAttrKey,o.join(",")):(e.removeAttribute(lockScrollAttrKey),e.style.removeProperty(lockScrollCssWidthKey)))},addBodyLockScroll:function(){var e,t=this.xID,o=this.lockScroll,i=this.computeIsMsg;o&&!i&&(o=document.documentElement,i=document.body.clientWidth,(e=(e=o.getAttribute(lockScrollAttrKey))?e.split(","):[]).includes(t)||(e.push(t),o.setAttribute(lockScrollAttrKey,e.join(","))),o.style.setProperty(lockScrollCssWidthKey,"".concat(i,"px")))},openModal:function(){var o=this,i=o,n=o.reactData,a=i.remember,r=i.showFooter,e=n.initialized,t=n.visible,l=o.computeIsMsg;return e||(n.initialized=!0,this.transfer&&(e=o.$refs.refElem,document.body.appendChild(e))),t||(o.addBodyLockScroll(),n.visible=!0,n.contentVisible=!1,o.updateZindex(),allActiveModals.push(o),a||o.$nextTick(function(){o.recalculate()}),setTimeout(function(){n.contentVisible=!0,o.$nextTick(function(){r&&(e=o.$refs.refConfirmBtn,t=o.$refs.refCancelBtn,e=e||t)&&e.focus();var e,t={type:""};o.emitModel(!0),o.dispatchEvent("show",t,null)})},10),l?(o.addMsgQueue(),o.handleMsgAutoClose()):o.$nextTick(function(){var e=i.fullscreen,t=n.firstOpen;a&&!t||o.updatePosition().then(function(){setTimeout(function(){return o.updatePosition()},20)}),t&&(n.firstOpen=!1,o.hasPosStorage())?o.restorePosStorage():e&&o.$nextTick(function(){return o.handleMaximize()})})),o.$nextTick()},selfClickEvent:function(e){var t=this.$refs.refElem;this.maskClosable&&e.target===t&&this.closeModal("mask")},selfMouseoverEvent:function(){var e=this.internalData,t=e.msgTimeout;t&&this.computeIsMsg&&(clearTimeout(t),e.msgTimeout=void 0)},selfMouseoutEvent:function(){this.internalData.msgTimeout||this.computeIsMsg&&this.handleMsgAutoClose()},handleGlobalKeydownEvent:function(e){var t,o=this;_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ESCAPE)&&(t=_xeUtils.default.max(allActiveModals,function(e){return e.reactData.modalZindex}))&&setTimeout(function(){t===o&&t.escClosable&&(o.dispatchEvent("close",{type:"exit"},e),o.closeModal("exit"))},10)},handleRevert:function(){var o=this,i=o.reactData;return i.prevZoomStatus=i.zoomStatus,i.zoomStatus="",o.$nextTick().then(function(){var e,t=i.revertLocat;return t?(e=o.getBox(),i.revertLocat=null,e&&Object.assign(e.style,{top:"".concat(t.top,"px"),left:"".concat(t.left,"px"),width:"".concat(t.width,"px"),height:"".concat(t.height,"px")}),o.savePosStorage(),o.$nextTick().then(function(){return{status:!0}})):{status:!1}})},handleZoom:function(t){var o=this,e=o.reactData,i=e.zoomStatus;return new Promise(function(e){if(t)return"maximize"===t?void e(o.handleMaximize()):"minimize"===t?void e(o.handleMinimize()):void e(o.handleRevert());e(i?o.handleRevert():o.handleMaximize())}).then(function(){return e.zoomStatus||"revert"})},toggleZoomMinEvent:function(t){var o=this,e=o.reactData,i=e.zoomStatus;return o.handleZoom("minimize"===i?e.prevZoomStatus||"revert":"minimize").then(function(e){o.dispatchEvent("zoom",{type:e},t)})},toggleZoomMaxEvent:function(t){var o=this;return o.handleZoom().then(function(e){o.dispatchEvent("zoom",{type:e},t)})},boxMousedownEvent:function(){var t=this.reactData.modalZindex;allActiveModals.some(function(e){return e.reactData.visible&&e.reactData.modalZindex>t})&&this.updateZindex()},mousedownEvent:function(e){var t,o,a,r,l,s,u=this,i=u.reactData,n=u.remember,c=u.storage,i=i.zoomStatus,d=_xeUtils.default.toNumber(u.marginSize),m=u.getBox();m&&"maximize"!==i&&0===e.button&&!(0,_dom.getEventTargetNode)(e,m,"trigger--btn").flag&&(e.preventDefault(),t=document.onmousemove,o=document.onmouseup,a=e.clientX-m.offsetLeft,r=e.clientY-m.offsetTop,i=(0,_dom.getDomNode)(),l=i.visibleHeight,s=i.visibleWidth,document.onmousemove=function(e){e.preventDefault();var t=m.offsetWidth,o=m.offsetHeight,t=s-t-d-1,o=l-o-d-1,i=e.clientX-a,n=e.clientY-r;(n=o<n?o:n)<d&&(n=d),m.style.left="".concat(i=(i=t<i?t:i)<d?d:i,"px"),m.style.top="".concat(n,"px"),m.className=m.className.replace(/\s?is--drag/,"")+" is--drag",u.$emit("move",(0,_ui.createEvent)(e,{type:"move"}))},document.onmouseup=function(){document.onmousemove=t,document.onmouseup=o,n&&c&&u.$nextTick(function(){u.savePosStorage()}),setTimeout(function(){m.className=m.className.replace(/\s?is--drag/,"")},50)})},dragEvent:function(e){var a=this,t=a,o=a.reactData,r=(e.preventDefault(),t.remember),l=t.storage,i=(0,_dom.getDomNode)(),s=i.visibleHeight,u=i.visibleWidth,c=_xeUtils.default.toNumber(t.marginSize),d=e.target.getAttribute("type"),m=_xeUtils.default.toNumber(t.minWidth),f=_xeUtils.default.toNumber(t.minHeight),h=u,p=s,g=a.getBox(),n=document.onmousemove,v=document.onmouseup,y=g.clientWidth,x=g.clientHeight,_=e.clientX,b=e.clientY,S=g.offsetTop,M=g.offsetLeft,z={type:"resize"};document.onmousemove=function(e){var t,o,i,n;switch(e.preventDefault(),d){case"wl":i=(t=_-e.clientX)+y,c<M-t&&m<i&&(g.style.width="".concat(i<h?i:h,"px"),g.style.left="".concat(M-t,"px"));break;case"swst":i=(t=_-e.clientX)+y,n=(o=b-e.clientY)+x,c<M-t&&m<i&&(g.style.width="".concat(i<h?i:h,"px"),g.style.left="".concat(M-t,"px")),c<S-o&&f<n&&(g.style.height="".concat(n<p?n:p,"px"),g.style.top="".concat(S-o,"px"));break;case"swlb":i=(t=_-e.clientX)+y,n=(o=e.clientY-b)+x,c<M-t&&m<i&&(g.style.width="".concat(i<h?i:h,"px"),g.style.left="".concat(M-t,"px")),S+n+c<s&&f<n&&(g.style.height="".concat(n<p?n:p,"px"));break;case"st":o=b-e.clientY,n=x+o,c<S-o&&f<n&&(g.style.height="".concat(n<p?n:p,"px"),g.style.top="".concat(S-o,"px"));break;case"wr":t=e.clientX-_,M+(i=t+y)+c<u&&m<i&&(g.style.width="".concat(i<h?i:h,"px"));break;case"sest":t=e.clientX-_,n=(o=b-e.clientY)+x,M+(i=t+y)+c<u&&m<i&&(g.style.width="".concat(i<h?i:h,"px")),c<S-o&&f<n&&(g.style.height="".concat(n<p?n:p,"px"),g.style.top="".concat(S-o,"px"));break;case"selb":t=e.clientX-_,n=(o=e.clientY-b)+x,M+(i=t+y)+c<u&&m<i&&(g.style.width="".concat(i<h?i:h,"px")),S+n+c<s&&f<n&&(g.style.height="".concat(n<p?n:p,"px"));break;case"sb":o=e.clientY-b,S+(n=o+x)+c<s&&f<n&&(g.style.height="".concat(n<p?n:p,"px"))}g.className=g.className.replace(/\s?is--drag/,"")+" is--drag",r&&l&&a.savePosStorage(),a.dispatchEvent("resize",z,e)},document.onmouseup=function(){o.revertLocat=null,document.onmousemove=n,document.onmouseup=v,setTimeout(function(){g.className=g.className.replace(/\s?is--drag/,"")},50)}},renderTitles:function(e){var t=this,o=t.$scopedSlots,i=t.slots,i=void 0===i?{}:i,n=t.showClose,a=t.showZoom,r=t.showMaximize,l=t.showMinimize,s=t.title,u=t.reactData.zoomStatus,c=o.title||i.title,o=o.corner||i.corner,i=t.computeIsMinimizeStatus;return[e("div",{class:"vxe-modal--header-title"},c?t.callSlot(c,{$modal:t,minimized:i,maximized:t.computeIsMaximizeStatus},e):s?(0,_utils.getFuncText)(s):(0,_ui.getI18n)("vxe.alert.title")),e("div",{class:"vxe-modal--header-right"},[o&&!i?e("div",{class:"vxe-modal--corner-wrapper"},t.callSlot(o,{$modal:t},e)):(0,_ui.renderEmptyElement)(t),(_xeUtils.default.isBoolean(l)?l:a)?e("div",{class:["vxe-modal--zoom-btn","trigger--btn"],attrs:{title:(0,_ui.getI18n)("vxe.modal.zoom".concat("minimize"===u?"Out":"Min"))},on:{click:t.toggleZoomMinEvent}},[e("i",{class:"minimize"===u?(0,_ui.getIcon)().MODAL_ZOOM_REVERT:(0,_ui.getIcon)().MODAL_ZOOM_MIN})]):(0,_ui.renderEmptyElement)(t),(_xeUtils.default.isBoolean(r)?r:a)&&"minimize"!==u?e("div",{class:["vxe-modal--zoom-btn","trigger--btn"],attrs:{title:(0,_ui.getI18n)("vxe.modal.zoom".concat("maximize"===u?"Out":"In"))},on:{click:t.toggleZoomMaxEvent}},[e("i",{class:"maximize"===u?(0,_ui.getIcon)().MODAL_ZOOM_OUT:(0,_ui.getIcon)().MODAL_ZOOM_IN})]):(0,_ui.renderEmptyElement)(t),n?e("div",{class:["vxe-modal--close-btn","trigger--btn"],attrs:{title:(0,_ui.getI18n)("vxe.modal.close")},on:{click:t.closeEvent}},[e("i",{class:(0,_ui.getIcon)().MODAL_CLOSE})]):(0,_ui.renderEmptyElement)(t)])]},renderHeader:function(e){var t=this,o=t,i=t.$scopedSlots,n=o.slots,a=o.showZoom,r=o.showMaximize,l=t.computeIsMsg,i=i.header||(void 0===n?{}:n).header;return o.showHeader?(n={},o.draggable&&(n.mousedown=t.mousedownEvent),(_xeUtils.default.isBoolean(r)?r:a)&&o.dblclickZoom&&"modal"===o.type&&(n.dblclick=t.toggleZoomMaxEvent),e("div",{ref:"refHeaderElem",class:["vxe-modal--header",{"is--ellipsis":!l&&o.showTitleOverflow}],on:n},i?t.callSlot(i,{$modal:t},e):t.renderTitles(e))):(0,_ui.renderEmptyElement)(t)},renderBody:function(e){var t=this,o=t,i=t.$scopedSlots,n=o.slots,n=void 0===n?{}:n,a=o.status,r=o.iconStatus,l=o.content||o.message,s=t.computeIsMsg,u=i.default||n.default,c=i.left||n.left,i=i.right||n.right,n=[];return s||!a&&!r||n.push(e("div",{class:"vxe-modal--status-wrapper"},[e("i",{class:["vxe-modal--status-icon",r||(0,_ui.getIcon)()["MODAL_".concat(a).toLocaleUpperCase()]]})])),n.push(e("div",{class:"vxe-modal--content"},u?t.callSlot(u,{$modal:t},e):(0,_utils.getFuncText)(l))),e("div",{class:"vxe-modal--body"},[c?e("div",{class:"vxe-modal--body-left"},t.callSlot(c,{$modal:t},e)):(0,_ui.renderEmptyElement)(t),e("div",{class:"vxe-modal--body-default"},n),i?e("div",{class:"vxe-modal--body-right"},t.callSlot(i,{$modal:t},e)):(0,_ui.renderEmptyElement)(t),s?(0,_ui.renderEmptyElement)(t):e(_index.default,{class:"vxe-modal--loading",props:{value:o.loading}})])},renderDefaultFooter:function(e){var t=this,o=t,i=t.$scopedSlots,n=o.slots,n=void 0===n?{}:n,a=o.showCancelButton,r=o.showConfirmButton,l=o.type,s=o.loading,u=i.leftfoot||n.leftfoot,i=i.rightfoot||n.rightfoot,n=[];return(_xeUtils.default.isBoolean(a)?a:"confirm"===l)&&n.push(e(_button.default,{key:1,ref:"refCancelBtn",props:{content:o.cancelButtonText||(0,_ui.getI18n)("vxe.button.cancel")},on:{click:t.cancelEvent}})),(_xeUtils.default.isBoolean(r)?r:"confirm"===l||"alert"===l)&&n.push(e(_button.default,{key:2,ref:"refConfirmBtn",props:{status:"primary",loading:s,content:o.confirmButtonText||(0,_ui.getI18n)("vxe.button.confirm")},on:{click:t.confirmEvent}})),e("div",{class:"vxe-modal--footer-wrapper"},[e("div",{class:"vxe-modal--footer-left"},u?t.callSlot(u,{$modal:t},e):[]),e("div",{class:"vxe-modal--footer-right"},i?t.callSlot(i,{$modal:t},e):n)])},renderFooter:function(e){var t=this,o=t.$scopedSlots,i=t.slots,o=o.footer||(void 0===i?{}:i).footer;return t.showFooter?e("div",{class:"vxe-modal--footer"},o?t.callSlot(o,{$modal:t},e):[t.renderDefaultFooter(e)]):(0,_ui.renderEmptyElement)(t)},renderVN:function(t){var o=this,e=o.$scopedSlots,i=o.reactData,n=o.slots,a=o.className,r=o.type,l=o.animat,s=o.draggable,u=o.iconStatus,c=o.position,d=o.loading,m=o.destroyOnClose,f=o.status,h=o.lockScroll,p=o.padding,g=o.lockView,v=o.mask,y=o.resize,x=i.initialized,_=i.modalTop,b=i.contentVisible,S=i.visible,M=i.zoomStatus,e=e.aside||(void 0===n?{}:n).aside,n=o.computeSize,z=o.computeIsMsg,w=o.computeIsMinimizeStatus,E={};return z&&(E.mouseover=o.selfMouseoverEvent,E.mouseout=o.selfMouseoutEvent),t("div",{ref:"refElem",class:["vxe-modal--wrapper","type--".concat(r),"zoom--".concat(M||"revert"),a||"",c?"pos--".concat(c):"",(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(r={},"size--".concat(n),n),"status--".concat(f),f),"is--padding",p),"is--animat",l),"lock--scroll",h),"lock--view",g),"is--draggable",s),"is--resize",y),"is--mask",v),"is--visible",b),_defineProperty(_defineProperty(r,"is--active",S),"is--loading",d))],style:{zIndex:i.modalZindex,top:_?"".concat(_,"px"):null},on:Object.assign(Object.assign({},E),{click:o.selfClickEvent})},x?[t("div",{ref:"refModalBox",class:"vxe-modal--box",on:{mousedown:o.boxMousedownEvent}},[!z&&!e||w?(0,_ui.renderEmptyElement)(o):t("div",{class:"vxe-modal--aside"},e?o.callSlot(e,{$modal:o},t):[f||u?t("div",{class:"vxe-modal--status-wrapper"},[t("i",{class:["vxe-modal--status-icon",u||(0,_ui.getIcon)()["MODAL_".concat(f).toLocaleUpperCase()]]})]):(0,_ui.renderEmptyElement)(o)]),t("div",{class:"vxe-modal--container"},!i.initialized||m&&!i.visible?[]:[o.renderHeader(t),o.renderBody(t),o.renderFooter(t),!z&&y?t("span",{class:"vxe-modal--resize"},["wl","wr","swst","sest","st","swlb","selb","sb"].map(function(e){return t("span",{class:"".concat(e,"-resize"),attrs:{type:e},on:{mousedown:o.dragEvent}})})):(0,_ui.renderEmptyElement)(o)])])]:[])}},mounted:function(){var e=this,t=e.$scopedSlots,o=e;"development"===process.env.NODE_ENV&&"modal"===o.type&&o.showFooter&&!(o.showConfirmButton||o.showCancelButton||t.footer)&&(0,_log.warnLog)("vxe.modal.footPropErr"),e.$nextTick(function(){o.storage&&!o.id&&(0,_log.errLog)("vxe.error.reqProp",["modal.id"]),o.value&&e.openModal(),e.recalculate()}),o.escClosable&&_ui.globalEvents.on(e,"keydown",e.handleGlobalKeydownEvent)},beforeDestroy:function(){var e=this.$refs.refElem;e&&e.parentNode&&e.parentNode.removeChild(e),_ui.globalEvents.off(this,"keydown"),this.removeMsgQueue(),this.removeBodyLockScroll()},render:function(e){return this.renderVN(e)}});
|
package/lib/select/src/select.js
CHANGED
|
@@ -31,6 +31,7 @@ var _default2 = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
31
31
|
},
|
|
32
32
|
props: {
|
|
33
33
|
value: [String, Number, Boolean, Array],
|
|
34
|
+
defaultConfig: Object,
|
|
34
35
|
clearable: Boolean,
|
|
35
36
|
placeholder: String,
|
|
36
37
|
readonly: {
|
|
@@ -217,6 +218,11 @@ var _default2 = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
217
218
|
}
|
|
218
219
|
return (0, _ui.getI18n)('vxe.base.pleaseSelect');
|
|
219
220
|
},
|
|
221
|
+
computeDefaultOpts: function computeDefaultOpts() {
|
|
222
|
+
var $xeSelect = this;
|
|
223
|
+
var props = $xeSelect;
|
|
224
|
+
return Object.assign({}, props.defaultConfig);
|
|
225
|
+
},
|
|
220
226
|
computePropsOpts: function computePropsOpts() {
|
|
221
227
|
var $xeSelect = this;
|
|
222
228
|
var props = $xeSelect;
|
|
@@ -1209,12 +1215,16 @@ var _default2 = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
1209
1215
|
*/
|
|
1210
1216
|
loadData: function loadData(datas) {
|
|
1211
1217
|
var $xeSelect = this;
|
|
1218
|
+
var props = $xeSelect;
|
|
1212
1219
|
var reactData = $xeSelect.reactData;
|
|
1213
1220
|
var internalData = $xeSelect.internalData;
|
|
1214
1221
|
$xeSelect.cacheItemMap(datas || []);
|
|
1215
|
-
var
|
|
1222
|
+
var isLoaded = internalData.isLoaded,
|
|
1223
|
+
fullData = internalData.fullData,
|
|
1216
1224
|
scrollYStore = internalData.scrollYStore;
|
|
1225
|
+
var defaultOpts = $xeSelect.computeDefaultOpts;
|
|
1217
1226
|
var sYOpts = $xeSelect.computeSYOpts;
|
|
1227
|
+
var valueField = $xeSelect.computeValueField;
|
|
1218
1228
|
Object.assign(scrollYStore, {
|
|
1219
1229
|
startIndex: 0,
|
|
1220
1230
|
endIndex: 1,
|
|
@@ -1224,12 +1234,30 @@ var _default2 = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
1224
1234
|
// 如果gt为0,则总是启用
|
|
1225
1235
|
reactData.scrollYLoad = !!sYOpts.enabled && sYOpts.gt > -1 && (sYOpts.gt === 0 || sYOpts.gt <= fullData.length);
|
|
1226
1236
|
$xeSelect.handleData();
|
|
1237
|
+
if (!isLoaded) {
|
|
1238
|
+
var selectMode = defaultOpts.selectMode;
|
|
1239
|
+
if (datas.length > 0 && _xeUtils.default.eqNull(props.value)) {
|
|
1240
|
+
if (selectMode === 'first' || selectMode === 'last') {
|
|
1241
|
+
var selectItem = _xeUtils.default[selectMode](datas);
|
|
1242
|
+
if (selectItem) {
|
|
1243
|
+
$xeSelect.$nextTick(function () {
|
|
1244
|
+
if (_xeUtils.default.eqNull(props.value)) {
|
|
1245
|
+
$xeSelect.emitModel(selectItem[valueField]);
|
|
1246
|
+
}
|
|
1247
|
+
});
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
internalData.isLoaded = true;
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1227
1253
|
return $xeSelect.computeScrollLoad().then(function () {
|
|
1228
1254
|
$xeSelect.refreshScroll();
|
|
1229
1255
|
});
|
|
1230
1256
|
},
|
|
1231
1257
|
reloadData: function reloadData(datas) {
|
|
1232
1258
|
var $xeSelect = this;
|
|
1259
|
+
var internalData = $xeSelect.internalData;
|
|
1260
|
+
internalData.isLoaded = false;
|
|
1233
1261
|
$xeSelect.clearScroll();
|
|
1234
1262
|
return $xeSelect.loadData(datas);
|
|
1235
1263
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _comp=require("../../ui/src/comp"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_dom=require("../../ui/src/dom"),_utils=require("../../ui/src/utils"),_input=_interopRequireDefault(require("../../input/src/input")),_vn=require("../../ui/src/vn");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);n=n.call(e,t||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}function isOptionVisible(e){return!1!==e.visible}function getOptUniqueId(){return _xeUtils.default.uniqueId("opt_")}var _default2=exports.default=(0,_comp.defineVxeComponent)({name:"VxeSelect",mixins:[_ui.globalMixins.sizeMixin],model:{prop:"value",event:"modelValue"},props:{value:[String,Number,Boolean,Array],clearable:Boolean,placeholder:String,readonly:{type:Boolean,default:null},loading:Boolean,disabled:{type:Boolean,default:null},multiple:Boolean,multiCharOverflow:{type:[Number,String],default:function(){return(0,_ui.getConfig)().select.multiCharOverflow}},prefixIcon:String,placement:String,options:Array,optionProps:Object,optionGroups:Array,optionGroupProps:Object,optionConfig:Object,className:[String,Function],popupClassName:[String,Function],max:{type:[String,Number],default:null},size:{type:String,default:function(){return(0,_ui.getConfig)().select.size||(0,_ui.getConfig)().size}},filterable:Boolean,filterMethod:Function,remote:Boolean,remoteMethod:Function,emptyText:String,transfer:{type:Boolean,default:null},scrollY:Object,optionId:{type:String,default:function(){return(0,_ui.getConfig)().select.optionId}},optionKey:Boolean},inject:{$xeModal:{default:null},$xeDrawer:{default:null},$xeTable:{default:null},$xeForm:{default:null},formItemInfo:{from:"xeFormItemInfo",default:null}},provide:function(){return{$xeSelect:this}},data:function(){return{xID:_xeUtils.default.uniqueId(),reactData:{initialized:!1,scrollYLoad:!1,bodyHeight:0,topSpaceHeight:0,optList:[],afterVisibleList:[],staticOptions:[],reactFlag:0,currentOption:null,searchValue:"",searchLoading:!1,panelIndex:0,panelStyle:{},panelPlacement:null,triggerFocusPanel:!1,visiblePanel:!1,isAniVisible:!1,isActivated:!1},internalData:{synchData:[],fullData:[],optGroupKeyMaps:{},optFullValMaps:{},remoteValMaps:{},lastScrollLeft:0,lastScrollTop:0,scrollYStore:{startIndex:0,endIndex:0,visibleSize:0,offsetSize:0,rowHeight:0},lastScrollTime:0,hpTimeout:void 0}}},computed:Object.assign(Object.assign({},{}),{computeFormReadonly:function(){var e=this.$xeForm,t=this.readonly;return null===t?!!e&&e.readonly:t},computeIsDisabled:function(){var e=this.$xeForm,t=this.disabled;return null===t?!!e&&e.disabled:t},computeBtnTransfer:function(){var e=this,t=e.$xeTable,n=e.$xeModal,i=e.$xeDrawer,a=e.$xeForm,e=e.transfer;if(null===e){var l=(0,_ui.getConfig)().select.transfer;if(_xeUtils.default.isBoolean(l))return l;if(t||n||i||a)return!0}return e},computeInpPlaceholder:function(){var e=this.placeholder;return(e=e||(0,_ui.getConfig)().select.placeholder)?(0,_utils.getFuncText)(e):(0,_ui.getI18n)("vxe.base.pleaseSelect")},computePropsOpts:function(){return Object.assign({},this.optionProps)},computeGroupPropsOpts:function(){return Object.assign({},this.optionGroupProps)},computeLabelField:function(){return this.computePropsOpts.label||"label"},computeValueField:function(){return this.computePropsOpts.value||"value"},computeGroupLabelField:function(){return this.computeGroupPropsOpts.label||"label"},computeGroupOptionsField:function(){return this.computeGroupPropsOpts.options||"options"},computeIsMaximize:function(){var e=this.value,t=this.multiple,n=this.max;return!(!t||!n)&&(_xeUtils.default.isArray(e)?e.length:_xeUtils.default.eqNull(e)?0:1)>=_xeUtils.default.toNumber(n)},computeSYOpts:function(){return Object.assign({},(0,_ui.getConfig)().select.scrollY,this.scrollY)},computeOptionOpts:function(){return Object.assign({},(0,_ui.getConfig)().select.optionConfig,this.optionConfig)},computeIsGroup:function(){return this.reactData.fullGroupList.some(function(e){return e.options&&e.options.length})},computeMultiMaxCharNum:function(){return _xeUtils.default.toNumber(this.multiCharOverflow)},computeSelectLabel:function(){var t=this,e=t.value,n=t.remote,i=t.multiple,a=t.computeMultiMaxCharNum;return _xeUtils.default.eqNull(e)?"":(e=_xeUtils.default.isArray(e)?e:[e],(n?e.map(function(e){return t.getRemoteSelectLabel(e)}):e.map(function(e){e=t.getSelectLabel(e);return i&&0<a&&e.length>a?"".concat(e.substring(0,a),"..."):e})).join(", "))}}),methods:{dispatchEvent:function(e,t,n){this.$emit(e,(0,_ui.createEvent)(n,{$select:this},t))},emitModel:function(e){var t=this._events;t&&t.modelValue?this.$emit("modelValue",e):this.$emit("model-value",e)},isPanelVisible:function(){return this.reactData.visiblePanel},togglePanel:function(){return this.reactData.visiblePanel?this.hideOptionPanel():this.showOptionPanel(),this.$nextTick()},hidePanel:function(){return this.reactData.visiblePanel&&this.hideOptionPanel(),this.$nextTick()},showPanel:function(){return this.reactData.visiblePanel||this.showOptionPanel(),this.$nextTick()},focus:function(){var e=this.reactData,t=this.$refs.refInput;return e.isActivated=!0,t.blur(),this.$nextTick()},blur:function(){var e=this.reactData;return this.$refs.refInput.blur(),e.isActivated=!1,this.$nextTick()},callSlot:function(e,t,n){var i=this.$scopedSlots;return e&&(_xeUtils.default.isString(e)&&(e=i[e]||null),_xeUtils.default.isFunction(e))?(0,_vn.getSlotVNs)(e.call(this,t,n)):[]},getOptKey:function(){return this.computeOptionOpts.keyField||this.optionId||"_X_OPTION_KEY"},getOptId:function(e){e=e[this.getOptKey()];return e?encodeURIComponent(e):""},getRemoteSelectLabel:function(e){var t=this.internalData.remoteValMaps,n=this.computeLabelField,t=t[e],t=t?t.item:null;return _xeUtils.default.toValueString(t?t[n]:e)},getSelectLabel:function(e){var t=this.reactData,n=this.internalData.optFullValMaps,i=this.computeLabelField,t=t.reactFlag?n[e]:null;return t?t.item[i]:_xeUtils.default.toValueString(e)},getOptkey:function(){return this.computeOptionOpts.keyField||this.optionId||"_X_OPTION_KEY"},getOptid:function(e){e=e[this.getOptkey()];return e?encodeURIComponent(e):""},handleOption:function(){var e=this,t=e.reactData,n=e.internalData,i=e.filterable,a=e.filterMethod,l=t.searchValue,o=n.fullData,r=n.optFullValMaps,s=e.computeLabelField,c=e.computeValueField,u="".concat(l||"").toLowerCase(),n=[];return(n=i&&a?o.filter(function(e){return isOptionVisible(e)&&a({group:null,option:e,searchValue:u})}):i?o.filter(function(e){return isOptionVisible(e)&&(!u||-1<"".concat(e[s]).toLowerCase().indexOf(u))}):o.filter(isOptionVisible)).forEach(function(e,t){e=r[e[c]];e&&(e._index=t)}),t.afterVisibleList=n,e.$nextTick()},refreshOption:function(){return this.handleOption(),this.updateYData(),this.$nextTick()},cacheItemMap:function(e){function t(e){u.push(e);var t=n.getOptId(e);t||(t=getOptUniqueId(),e[r]=t),c[e[o]]={key:t,item:e,_index:-1}}var n=this,i=n.reactData,a=n.internalData,l=n.computeGroupOptionsField,o=n.computeValueField,r=n.getOptKey(),s={},c={},u=[];e.forEach(function(e){t(e),e[l]&&(s[e[r]]=e)[l].forEach(t)}),a.fullData=u,a.optGroupKeyMaps=s,a.optFullValMaps=c,i.reactFlag++,n.handleOption()},setCurrentOption:function(e){var t=this.reactData;e&&(t.currentOption=e)},scrollToOption:function(i,a){var l=this;return l.$nextTick().then(function(){var e,t,n;i&&(e=l.$refs.refOptionWrapper,t=l.$refs.refOptionPanel.querySelector("[optid='".concat(l.getOptid(i),"']")),e)&&t&&(n=e.offsetHeight,a?t.offsetTop+t.offsetHeight-e.scrollTop>n&&(e.scrollTop=t.offsetTop+t.offsetHeight-n):(t.offsetTop+5<e.scrollTop||t.offsetTop+5>e.scrollTop+e.clientHeight)&&(e.scrollTop=t.offsetTop-5))})},updateZindex:function(){var e=this.reactData;e.panelIndex<(0,_utils.getLastZIndex)()&&(e.panelIndex=(0,_utils.nextZIndex)())},updateZIndex:function(){var e=this.reactData;e.panelIndex<(0,_utils.getLastZIndex)()&&(e.panelIndex=(0,_utils.nextZIndex)())},updatePlacement:function(){var f=this,d=f,h=f.reactData;return f.$nextTick().then(function(){var e,t,n,i,a,l,o,r=d.placement,s=h.panelIndex,c=f.$refs.refElem,u=f.$refs.refOptionPanel,p=f.computeBtnTransfer;if(u&&c)return e=c.offsetHeight,t=c.offsetWidth,n=u.offsetHeight,u=u.offsetWidth,s={zIndex:s},i=(c=(0,_dom.getAbsolutePos)(c)).boundingTop,a=c.visibleHeight,l=c.visibleWidth,o="bottom",p?(p=i+e,"top"===r?(o="top",p=i-n):r||(a<p+n+5&&(o="top",p=i-n),p<5&&(o="bottom",p=i+e)),l<(c=c.boundingLeft)+u+5&&(c-=c+u+5-l),c<5&&(c=5),Object.assign(s,{left:"".concat(c,"px"),top:"".concat(p,"px"),minWidth:"".concat(t,"px")})):"top"===r?(o="top",s.bottom="".concat(e,"px")):r||a<i+e+n&&5<i-e-n&&(o="top",s.bottom="".concat(e,"px")),h.panelStyle=s,h.panelPlacement=o,f.$nextTick()})},showOptionPanel:function(){var e=this,t=e.reactData,n=e.internalData,i=e.loading,a=e.filterable,l=n.hpTimeout;i||e.computeIsDisabled||(l&&(clearTimeout(l),n.hpTimeout=void 0),t.initialized||(t.initialized=!0,i=e.computeBtnTransfer,l=e.$refs.refOptionPanel,i&&l&&document.body.appendChild(l)),t.isActivated=!0,t.isAniVisible=!0,a&&(e.handleOption(),e.updateYData()),setTimeout(function(){t.visiblePanel=!0,e.handleFocusSearch(),e.recalculate().then(function(){return e.refreshScroll()})},10),setTimeout(function(){e.recalculate().then(function(){return e.refreshScroll()})},100),e.updateZIndex(),e.updatePlacement())},hideOptionPanel:function(){var e=this.reactData,t=this.internalData;e.searchValue="",e.searchLoading=!1,e.visiblePanel=!1,t.hpTimeout=window.setTimeout(function(){e.isAniVisible=!1},350)},changeEvent:function(e,t){var n=this,i=n,a=n.$xeForm,l=n.formItemInfo;n.emitModel(t),t!==i.value&&(n.dispatchEvent("change",{value:t},e),a)&&l&&a.triggerItemEvent(e,l.itemConfig.field,t)},clearValueEvent:function(e,t){this.internalData.remoteValMaps={},this.changeEvent(e,t),this.dispatchEvent("clear",{value:t},e)},clearEvent:function(e,t){this.clearValueEvent(t,null),this.hideOptionPanel()},changeOptionEvent:function(e,t){var n=this,i=n.reactData,a=n.value,l=n.multiple,o=n.internalData.remoteValMaps,r=t[n.computeValueField],s=o[r];s?s.item=t:o[r]={key:n.getOptId(t),item:t,_index:-1},l?(s=[],o=_xeUtils.default.eqNull(a)?[]:_xeUtils.default.isArray(a)?a:[a],s=-1===_xeUtils.default.findIndexOf(o,function(e){return e===r})?o.concat([r]):o.filter(function(e){return e!==r}),n.changeEvent(e,s)):(n.changeEvent(e,r),n.hideOptionPanel()),i.reactFlag++},handleGlobalMousewheelEvent:function(e){var t=this,n=t.reactData.visiblePanel;t.computeIsDisabled||n&&(n=t.$refs.refOptionPanel,(0,_dom.getEventTargetNode)(e,n).flag?t.updatePlacement():t.hideOptionPanel())},handleGlobalMousedownEvent:function(e){var t,n,i=this,a=i.reactData,l=a.visiblePanel;i.computeIsDisabled||(t=i.$refs.refElem,n=i.$refs.refOptionPanel,a.isActivated=(0,_dom.getEventTargetNode)(e,t).flag||(0,_dom.getEventTargetNode)(e,n).flag,l&&!a.isActivated&&i.hideOptionPanel())},validOffsetOption:function(e){var t=e.disabled,e=this.getOptId(e);return!t&&!this.hasOptGroupById(e)},findOffsetOption:function(e,t){var n=this,i=n.reactData.afterVisibleList,a=n.internalData.optFullValMaps,l=n.computeValueField;if(!e)for(var o=0;o<i.length-1;o++){var r=i[o];if(n.validOffsetOption(r))return r}a=a[e[l]];if(a){e=a._index;if(-1<e)if(t)for(var s=e+1;s<=i.length-1;s++){var c=i[s];if(n.validOffsetOption(c))return c}else if(0<e)for(var u=e-1;0<=u;u--){var p=i[u];if(n.validOffsetOption(p))return p}}return null},handleGlobalKeydownEvent:function(e){var t,n,i,a,l,o,r,s=this,c=s.reactData,u=s.clearable,p=c.visiblePanel,f=c.currentOption;s.computeIsDisabled||(t=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.TAB),n=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ENTER),i=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ESCAPE),a=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_UP),l=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_DOWN),o=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.DELETE),r=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.SPACEBAR),t&&(c.isActivated=!1),p?i||t?s.hideOptionPanel():n?(e.preventDefault(),e.stopPropagation(),s.changeOptionEvent(e,f)):a||l?(e.preventDefault(),(p=s.findOffsetOption(f,l))&&(s.setCurrentOption(p),s.handleScrollToOption(p,l))):r&&e.preventDefault():(a||l||n||r)&&c.isActivated&&(e.preventDefault(),s.showOptionPanel()),c.isActivated&&o&&u&&s.clearValueEvent(e,null))},handleGlobalBlurEvent:function(){this.hideOptionPanel()},handleFocusSearch:function(){var t=this;t.filterable&&t.$nextTick(function(){var e=t.$refs.refInpSearch;e&&e.focus()})},focusEvent:function(e){var t=this.reactData;this.computeIsDisabled||t.visiblePanel||(t.triggerFocusPanel=!0,this.showOptionPanel(),setTimeout(function(){t.triggerFocusPanel=!1},150)),this.dispatchEvent("focus",{},e)},clickEvent:function(e){this.togglePanelEvent(e),this.dispatchEvent("click",{},e)},blurEvent:function(e){this.reactData.isActivated=!1,this.dispatchEvent("blur",{},e)},modelSearchEvent:function(e){this.reactData.searchValue=e},focusSearchEvent:function(){this.reactData.isActivated=!0},handleSearchEvent:function(){var e=this,t=e.reactData,n=e.remote,i=e.remoteMethod,a=t.searchValue;n&&i?(t.searchLoading=!0,Promise.resolve(i({searchValue:a})).then(function(){return e.$nextTick()}).catch(function(){return e.$nextTick()}).finally(function(){t.searchLoading=!1,e.handleOption(),e.updateYData()})):(e.handleOption(),e.updateYData())},triggerSearchEvent:_xeUtils.default.debounce(function(){this.handleSearchEvent()},350,{trailing:!0}),togglePanelEvent:function(e){var t=this.reactData;e.$event.preventDefault(),t.triggerFocusPanel?t.triggerFocusPanel=!1:t.visiblePanel?this.hideOptionPanel():this.showOptionPanel()},checkOptionDisabled:function(e,t,n){return!!t.disabled||!(!n||!n.disabled)||!(!this.computeIsMaximize||e)},updateYSpace:function(){var e=this.reactData,t=this.internalData,n=e.scrollYLoad,t=t.scrollYStore;e.bodyHeight=n?e.afterVisibleList.length*t.rowHeight:0,e.topSpaceHeight=n?Math.max(t.startIndex*t.rowHeight,0):0},handleData:function(){var e=this.reactData,t=this.internalData,n=e.scrollYLoad,i=e.afterVisibleList,t=t.scrollYStore;return e.optList=n?i.slice(t.startIndex,t.endIndex):i.slice(0),this.$nextTick()},updateYData:function(){this.handleData(),this.updateYSpace()},computeScrollLoad:function(){var o=this,r=o.reactData,s=o.internalData;return o.$nextTick().then(function(){var e,t=r.scrollYLoad,n=s.scrollYStore,i=o.$refs.refVirtualBody,a=o.computeSYOpts,l=0;(e=i?(e=a.sItem?i.querySelector(a.sItem):e)||i.children[0]:e)&&(l=e.offsetHeight),l=Math.max(20,l),n.rowHeight=l,t?(i=o.$refs.refVirtualWrapper,e=Math.max(8,i?Math.ceil(i.clientHeight/l):0),t=Math.max(0,Math.min(2,_xeUtils.default.toNumber(a.oSize))),n.offsetSize=t,n.visibleSize=e,n.endIndex=Math.max(n.startIndex,e+t,n.endIndex),o.updateYData()):o.updateYSpace()})},handleScrollToOption:function(e,t){var n,i=this,a=i.reactData,l=i.internalData,a=a.scrollYLoad,o=l.optFullValMaps,l=l.scrollYStore,o=o[e[i.computeValueField]];o&&(e=o.key,-1<(o=o._index))&&(n=i.$refs.refVirtualWrapper,i=i.$refs.refOptionPanel.querySelector("[optid='".concat(e,"']")),n)&&(i?(e=n.offsetHeight,t?i.offsetTop+i.offsetHeight-n.scrollTop>e&&(n.scrollTop=i.offsetTop+i.offsetHeight-e):(i.offsetTop+1<n.scrollTop||i.offsetTop+1>n.scrollTop+n.clientHeight)&&(n.scrollTop=i.offsetTop-1)):a&&(n.scrollTop=t?o*l.rowHeight-n.clientHeight+l.rowHeight:o*l.rowHeight))},scrollTo:function(e,t){var n=this,i=n.reactData,a=n.$refs.refVirtualWrapper;return a&&(_xeUtils.default.isNumber(e)&&(a.scrollLeft=e),_xeUtils.default.isNumber(t))&&(a.scrollTop=t),i.scrollYLoad?new Promise(function(e){setTimeout(function(){n.$nextTick(function(){e()})},50)}):n.$nextTick()},refreshScroll:function(){var e=this,t=e.internalData,n=t.lastScrollLeft,i=t.lastScrollTop;return e.clearScroll().then(function(){if(n||i)return t.lastScrollLeft=0,t.lastScrollTop=0,e.scrollTo(n,i)})},recalculate:function(){var e=this.$refs.refElem;return e&&e.clientWidth&&e.clientHeight?this.computeScrollLoad():Promise.resolve()},loadYData:function(e){var t=this.internalData.scrollYStore,n=t.startIndex,i=t.endIndex,a=t.visibleSize,l=t.offsetSize,e=e.target.scrollTop,e=Math.floor(e/t.rowHeight),o=Math.max(0,e-1-l),l=e+a+l;!(e<=n||i-a-1<=e)||n===o&&i===l||(t.startIndex=o,t.endIndex=l,this.updateYData())},isVMScrollProcess:function(){var e=this.internalData.lastScrollTime;return!!(e&&Date.now()<e+250)},scrollEvent:function(e){var t=this.reactData,n=this.internalData,i=e.target,a=i.scrollTop,i=i.scrollLeft,l=i!==n.lastScrollLeft,o=a!==n.lastScrollTop;n.lastScrollTop=a,n.lastScrollLeft=i,t.scrollYLoad&&this.loadYData(e),n.lastScrollTime=Date.now(),this.dispatchEvent("scroll",{scrollLeft:i,scrollTop:a,isX:l,isY:o},e)},loadData:function(e){var t=this,n=t.reactData,i=t.internalData,a=(t.cacheItemMap(e||[]),i.fullData),l=i.scrollYStore,o=t.computeSYOpts;return Object.assign(l,{startIndex:0,endIndex:1,visibleSize:0}),i.synchData=e||[],n.scrollYLoad=!!o.enabled&&-1<o.gt&&(0===o.gt||o.gt<=a.length),t.handleData(),t.computeScrollLoad().then(function(){t.refreshScroll()})},reloadData:function(e){return this.clearScroll(),this.loadData(e)},clearScroll:function(){var e=this.internalData,t=this.$refs.refVirtualWrapper;return t&&(t.scrollTop=0,t.scrollLeft=0),e.lastScrollTop=0,e.lastScrollLeft=0,this.$nextTick()},hasOptGroupById:function(e){return!!this.internalData.optGroupKeyMaps[e]},renderOption:function(u,e,p){var f=this,t=f.$scopedSlots,d=f.optionKey,h=f.value,v=f.reactData.currentOption,m=f.computeLabelField,g=f.computeValueField,b=f.computeGroupLabelField,x=f.computeOptionOpts.useKey,_=t.option;return e.map(function(t,e){var n=t.slots,i=t.className,a=f.getOptId(t),l=t[g],o=f.hasOptGroupById(a),l=_xeUtils.default.isArray(h)?-1<h.indexOf(l):h===l,r=!o||isOptionVisible(t),s=f.checkOptionDisabled(l,t,p),n=n?n.default:null,c={option:t,group:null,$select:f};return r?u("div",{key:x||d?a:e,class:["vxe-select-option",i?_xeUtils.default.isFunction(i)?i(c):i:"",{"vxe-select-optgroup":o,"is--disabled":s,"is--selected":l,"is--hover":v&&f.getOptId(v)===a}],attrs:{optid:a},on:{mousedown:function(e){0===e.button&&e.stopPropagation()},click:function(e){s||o||f.changeOptionEvent(e,t)},mouseenter:function(){s||o||f.isVMScrollProcess()||f.setCurrentOption(t)}}},_?f.callSlot(_,c,u):n?f.callSlot(n,c,u):(0,_utils.getFuncText)(t[o?b:m])):(0,_ui.renderEmptyElement)(f)})},renderOpts:function(e){var t=this.reactData,n=t.optList;return t.searchLoading?[e("div",{class:"vxe-select--search-loading"},[e("i",{class:["vxe-select--search-icon",(0,_ui.getIcon)().SELECT_LOADED]}),e("span",{class:"vxe-select--search-text"},(0,_ui.getI18n)("vxe.select.loadingText"))])]:n.length?this.renderOption(e,n):[e("div",{class:"vxe-select--empty-placeholder"},this.emptyText||(0,_ui.getI18n)("vxe.select.emptyText"))]},renderVN:function(e){var t=this,n=t,i=t.$scopedSlots,a=t.reactData,l=n.className,o=n.popupClassName,r=n.loading,s=n.filterable,c=a.initialized,u=a.isActivated,p=a.isAniVisible,f=a.visiblePanel,d=a.bodyHeight,h=a.topSpaceHeight,v=t.computeSize,m=t.computeIsDisabled,g=t.computeSelectLabel,b=t.computeBtnTransfer,x=t.computeInpPlaceholder,_=i.default,O=i.header,S=i.footer,E=i.prefix;return t.computeFormReadonly?e("div",{ref:"refElem",class:["vxe-select--readonly",l]},[e("div",{class:"vxe-select-slots",ref:"hideOption"},_?t.callSlot(_,{},e):[]),e("span",{class:"vxe-select-label"},g)]):e("div",{ref:"refElem",class:["vxe-select",l?_xeUtils.default.isFunction(l)?l({$select:t}):l:"",_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},"size--".concat(v),v),"is--visible",f),"is--disabled",m),"is--filter",s),"is--loading",r),"is--active",u)]},[e("div",{class:"vxe-select-slots",ref:"hideOption"},_?_.call(t,{}):[]),e(_input.default,{ref:"refInput",props:{clearable:n.clearable,placeholder:x,readonly:!0,disabled:m,type:"text",prefixIcon:n.prefixIcon,suffixIcon:r?(0,_ui.getIcon)().SELECT_LOADED:f?(0,_ui.getIcon)().SELECT_OPEN:(0,_ui.getIcon)().SELECT_CLOSE,value:g},on:{clear:t.clearEvent,click:t.clickEvent,focus:t.focusEvent,blur:t.blurEvent,"suffix-click":t.togglePanelEvent},scopedSlots:E?{prefix:function(){return E({})}}:{}}),e("div",{ref:"refOptionPanel",class:["vxe-table--ignore-clear vxe-select--panel",o?_xeUtils.default.isFunction(o)?o({$select:t}):o:"",_defineProperty(_defineProperty(_defineProperty(_defineProperty({},"size--".concat(v),v),"is--transfer",b),"ani--leave",!r&&p),"ani--enter",!r&&f)],attrs:{placement:a.panelPlacement},style:a.panelStyle},c&&(f||p)?[e("div",{class:"vxe-select--panel-wrapper"},[s?e("div",{class:"vxe-select--panel-search"},[e(_input.default,{ref:"refInpSearch",class:"vxe-select-search--input",props:{value:a.searchValue,clearable:!0,disabled:!1,readonly:!1,placeholder:(0,_ui.getI18n)("vxe.select.search"),prefixIcon:(0,_ui.getIcon)().INPUT_SEARCH},on:{"model-value":t.modelSearchEvent,focus:t.focusSearchEvent,change:t.triggerSearchEvent,search:t.triggerSearchEvent}})]):(0,_ui.renderEmptyElement)(t),O?e("div",{class:"vxe-select--panel-header"},t.callSlot(O,{},e)):(0,_ui.renderEmptyElement)(t),e("div",{class:"vxe-select--panel-body"},[e("div",{ref:"refVirtualWrapper",class:"vxe-select-option--wrapper",on:{scroll:t.scrollEvent}},[e("div",{class:"vxe-select--y-space",style:{height:d?"".concat(d,"px"):""}}),e("div",{ref:"refVirtualBody",class:"vxe-select--body",style:{marginTop:h?"".concat(h,"px"):""}},t.renderOpts(e))])]),S?e("div",{class:"vxe-select--panel-footer"},t.callSlot(S,{},e)):(0,_ui.renderEmptyElement)(t)])]:[])])}},watch:{"reactData.staticOptions":function(e){this.loadData(e)},options:function(e){this.loadData(e)},optionGroups:function(e){this.loadData(e)}},mounted:function(){var n=this,i=n;n.$nextTick(function(){var e=i.options,t=i.optionGroups;t?n.loadData(t):e&&n.loadData(e)}),_ui.globalEvents.on(n,"mousewheel",n.handleGlobalMousewheelEvent),_ui.globalEvents.on(n,"mousedown",n.handleGlobalMousedownEvent),_ui.globalEvents.on(n,"keydown",n.handleGlobalKeydownEvent),_ui.globalEvents.on(n,"blur",n.handleGlobalBlurEvent)},beforeDestroy:function(){var e=this,t=e.$refs.refOptionPanel;t&&t.parentNode&&t.parentNode.removeChild(t),_ui.globalEvents.off(e,"mousewheel"),_ui.globalEvents.off(e,"mousedown"),_ui.globalEvents.off(e,"keydown"),_ui.globalEvents.off(e,"blur")},render:function(e){return this.renderVN(e)}});
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _comp=require("../../ui/src/comp"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_dom=require("../../ui/src/dom"),_utils=require("../../ui/src/utils"),_input=_interopRequireDefault(require("../../input/src/input")),_vn=require("../../ui/src/vn");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _defineProperty(e,t,i){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0===i)return("string"===t?String:Number)(e);i=i.call(e,t||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}function isOptionVisible(e){return!1!==e.visible}function getOptUniqueId(){return _xeUtils.default.uniqueId("opt_")}var _default2=exports.default=(0,_comp.defineVxeComponent)({name:"VxeSelect",mixins:[_ui.globalMixins.sizeMixin],model:{prop:"value",event:"modelValue"},props:{value:[String,Number,Boolean,Array],defaultConfig:Object,clearable:Boolean,placeholder:String,readonly:{type:Boolean,default:null},loading:Boolean,disabled:{type:Boolean,default:null},multiple:Boolean,multiCharOverflow:{type:[Number,String],default:function(){return(0,_ui.getConfig)().select.multiCharOverflow}},prefixIcon:String,placement:String,options:Array,optionProps:Object,optionGroups:Array,optionGroupProps:Object,optionConfig:Object,className:[String,Function],popupClassName:[String,Function],max:{type:[String,Number],default:null},size:{type:String,default:function(){return(0,_ui.getConfig)().select.size||(0,_ui.getConfig)().size}},filterable:Boolean,filterMethod:Function,remote:Boolean,remoteMethod:Function,emptyText:String,transfer:{type:Boolean,default:null},scrollY:Object,optionId:{type:String,default:function(){return(0,_ui.getConfig)().select.optionId}},optionKey:Boolean},inject:{$xeModal:{default:null},$xeDrawer:{default:null},$xeTable:{default:null},$xeForm:{default:null},formItemInfo:{from:"xeFormItemInfo",default:null}},provide:function(){return{$xeSelect:this}},data:function(){return{xID:_xeUtils.default.uniqueId(),reactData:{initialized:!1,scrollYLoad:!1,bodyHeight:0,topSpaceHeight:0,optList:[],afterVisibleList:[],staticOptions:[],reactFlag:0,currentOption:null,searchValue:"",searchLoading:!1,panelIndex:0,panelStyle:{},panelPlacement:null,triggerFocusPanel:!1,visiblePanel:!1,isAniVisible:!1,isActivated:!1},internalData:{synchData:[],fullData:[],optGroupKeyMaps:{},optFullValMaps:{},remoteValMaps:{},lastScrollLeft:0,lastScrollTop:0,scrollYStore:{startIndex:0,endIndex:0,visibleSize:0,offsetSize:0,rowHeight:0},lastScrollTime:0,hpTimeout:void 0}}},computed:Object.assign(Object.assign({},{}),{computeFormReadonly:function(){var e=this.$xeForm,t=this.readonly;return null===t?!!e&&e.readonly:t},computeIsDisabled:function(){var e=this.$xeForm,t=this.disabled;return null===t?!!e&&e.disabled:t},computeBtnTransfer:function(){var e=this,t=e.$xeTable,i=e.$xeModal,n=e.$xeDrawer,a=e.$xeForm,e=e.transfer;if(null===e){var l=(0,_ui.getConfig)().select.transfer;if(_xeUtils.default.isBoolean(l))return l;if(t||i||n||a)return!0}return e},computeInpPlaceholder:function(){var e=this.placeholder;return(e=e||(0,_ui.getConfig)().select.placeholder)?(0,_utils.getFuncText)(e):(0,_ui.getI18n)("vxe.base.pleaseSelect")},computeDefaultOpts:function(){return Object.assign({},this.defaultConfig)},computePropsOpts:function(){return Object.assign({},this.optionProps)},computeGroupPropsOpts:function(){return Object.assign({},this.optionGroupProps)},computeLabelField:function(){return this.computePropsOpts.label||"label"},computeValueField:function(){return this.computePropsOpts.value||"value"},computeGroupLabelField:function(){return this.computeGroupPropsOpts.label||"label"},computeGroupOptionsField:function(){return this.computeGroupPropsOpts.options||"options"},computeIsMaximize:function(){var e=this.value,t=this.multiple,i=this.max;return!(!t||!i)&&(_xeUtils.default.isArray(e)?e.length:_xeUtils.default.eqNull(e)?0:1)>=_xeUtils.default.toNumber(i)},computeSYOpts:function(){return Object.assign({},(0,_ui.getConfig)().select.scrollY,this.scrollY)},computeOptionOpts:function(){return Object.assign({},(0,_ui.getConfig)().select.optionConfig,this.optionConfig)},computeIsGroup:function(){return this.reactData.fullGroupList.some(function(e){return e.options&&e.options.length})},computeMultiMaxCharNum:function(){return _xeUtils.default.toNumber(this.multiCharOverflow)},computeSelectLabel:function(){var t=this,e=t.value,i=t.remote,n=t.multiple,a=t.computeMultiMaxCharNum;return _xeUtils.default.eqNull(e)?"":(e=_xeUtils.default.isArray(e)?e:[e],(i?e.map(function(e){return t.getRemoteSelectLabel(e)}):e.map(function(e){e=t.getSelectLabel(e);return n&&0<a&&e.length>a?"".concat(e.substring(0,a),"..."):e})).join(", "))}}),methods:{dispatchEvent:function(e,t,i){this.$emit(e,(0,_ui.createEvent)(i,{$select:this},t))},emitModel:function(e){var t=this._events;t&&t.modelValue?this.$emit("modelValue",e):this.$emit("model-value",e)},isPanelVisible:function(){return this.reactData.visiblePanel},togglePanel:function(){return this.reactData.visiblePanel?this.hideOptionPanel():this.showOptionPanel(),this.$nextTick()},hidePanel:function(){return this.reactData.visiblePanel&&this.hideOptionPanel(),this.$nextTick()},showPanel:function(){return this.reactData.visiblePanel||this.showOptionPanel(),this.$nextTick()},focus:function(){var e=this.reactData,t=this.$refs.refInput;return e.isActivated=!0,t.blur(),this.$nextTick()},blur:function(){var e=this.reactData;return this.$refs.refInput.blur(),e.isActivated=!1,this.$nextTick()},callSlot:function(e,t,i){var n=this.$scopedSlots;return e&&(_xeUtils.default.isString(e)&&(e=n[e]||null),_xeUtils.default.isFunction(e))?(0,_vn.getSlotVNs)(e.call(this,t,i)):[]},getOptKey:function(){return this.computeOptionOpts.keyField||this.optionId||"_X_OPTION_KEY"},getOptId:function(e){e=e[this.getOptKey()];return e?encodeURIComponent(e):""},getRemoteSelectLabel:function(e){var t=this.internalData.remoteValMaps,i=this.computeLabelField,t=t[e],t=t?t.item:null;return _xeUtils.default.toValueString(t?t[i]:e)},getSelectLabel:function(e){var t=this.reactData,i=this.internalData.optFullValMaps,n=this.computeLabelField,t=t.reactFlag?i[e]:null;return t?t.item[n]:_xeUtils.default.toValueString(e)},getOptkey:function(){return this.computeOptionOpts.keyField||this.optionId||"_X_OPTION_KEY"},getOptid:function(e){e=e[this.getOptkey()];return e?encodeURIComponent(e):""},handleOption:function(){var e=this,t=e.reactData,i=e.internalData,n=e.filterable,a=e.filterMethod,l=t.searchValue,o=i.fullData,r=i.optFullValMaps,s=e.computeLabelField,c=e.computeValueField,u="".concat(l||"").toLowerCase(),i=[];return(i=n&&a?o.filter(function(e){return isOptionVisible(e)&&a({group:null,option:e,searchValue:u})}):n?o.filter(function(e){return isOptionVisible(e)&&(!u||-1<"".concat(e[s]).toLowerCase().indexOf(u))}):o.filter(isOptionVisible)).forEach(function(e,t){e=r[e[c]];e&&(e._index=t)}),t.afterVisibleList=i,e.$nextTick()},refreshOption:function(){return this.handleOption(),this.updateYData(),this.$nextTick()},cacheItemMap:function(e){function t(e){u.push(e);var t=i.getOptId(e);t||(t=getOptUniqueId(),e[r]=t),c[e[o]]={key:t,item:e,_index:-1}}var i=this,n=i.reactData,a=i.internalData,l=i.computeGroupOptionsField,o=i.computeValueField,r=i.getOptKey(),s={},c={},u=[];e.forEach(function(e){t(e),e[l]&&(s[e[r]]=e)[l].forEach(t)}),a.fullData=u,a.optGroupKeyMaps=s,a.optFullValMaps=c,n.reactFlag++,i.handleOption()},setCurrentOption:function(e){var t=this.reactData;e&&(t.currentOption=e)},scrollToOption:function(n,a){var l=this;return l.$nextTick().then(function(){var e,t,i;n&&(e=l.$refs.refOptionWrapper,t=l.$refs.refOptionPanel.querySelector("[optid='".concat(l.getOptid(n),"']")),e)&&t&&(i=e.offsetHeight,a?t.offsetTop+t.offsetHeight-e.scrollTop>i&&(e.scrollTop=t.offsetTop+t.offsetHeight-i):(t.offsetTop+5<e.scrollTop||t.offsetTop+5>e.scrollTop+e.clientHeight)&&(e.scrollTop=t.offsetTop-5))})},updateZindex:function(){var e=this.reactData;e.panelIndex<(0,_utils.getLastZIndex)()&&(e.panelIndex=(0,_utils.nextZIndex)())},updateZIndex:function(){var e=this.reactData;e.panelIndex<(0,_utils.getLastZIndex)()&&(e.panelIndex=(0,_utils.nextZIndex)())},updatePlacement:function(){var f=this,d=f,h=f.reactData;return f.$nextTick().then(function(){var e,t,i,n,a,l,o,r=d.placement,s=h.panelIndex,c=f.$refs.refElem,u=f.$refs.refOptionPanel,p=f.computeBtnTransfer;if(u&&c)return e=c.offsetHeight,t=c.offsetWidth,i=u.offsetHeight,u=u.offsetWidth,s={zIndex:s},n=(c=(0,_dom.getAbsolutePos)(c)).boundingTop,a=c.visibleHeight,l=c.visibleWidth,o="bottom",p?(p=n+e,"top"===r?(o="top",p=n-i):r||(a<p+i+5&&(o="top",p=n-i),p<5&&(o="bottom",p=n+e)),l<(c=c.boundingLeft)+u+5&&(c-=c+u+5-l),c<5&&(c=5),Object.assign(s,{left:"".concat(c,"px"),top:"".concat(p,"px"),minWidth:"".concat(t,"px")})):"top"===r?(o="top",s.bottom="".concat(e,"px")):r||a<n+e+i&&5<n-e-i&&(o="top",s.bottom="".concat(e,"px")),h.panelStyle=s,h.panelPlacement=o,f.$nextTick()})},showOptionPanel:function(){var e=this,t=e.reactData,i=e.internalData,n=e.loading,a=e.filterable,l=i.hpTimeout;n||e.computeIsDisabled||(l&&(clearTimeout(l),i.hpTimeout=void 0),t.initialized||(t.initialized=!0,n=e.computeBtnTransfer,l=e.$refs.refOptionPanel,n&&l&&document.body.appendChild(l)),t.isActivated=!0,t.isAniVisible=!0,a&&(e.handleOption(),e.updateYData()),setTimeout(function(){t.visiblePanel=!0,e.handleFocusSearch(),e.recalculate().then(function(){return e.refreshScroll()})},10),setTimeout(function(){e.recalculate().then(function(){return e.refreshScroll()})},100),e.updateZIndex(),e.updatePlacement())},hideOptionPanel:function(){var e=this.reactData,t=this.internalData;e.searchValue="",e.searchLoading=!1,e.visiblePanel=!1,t.hpTimeout=window.setTimeout(function(){e.isAniVisible=!1},350)},changeEvent:function(e,t){var i=this,n=i,a=i.$xeForm,l=i.formItemInfo;i.emitModel(t),t!==n.value&&(i.dispatchEvent("change",{value:t},e),a)&&l&&a.triggerItemEvent(e,l.itemConfig.field,t)},clearValueEvent:function(e,t){this.internalData.remoteValMaps={},this.changeEvent(e,t),this.dispatchEvent("clear",{value:t},e)},clearEvent:function(e,t){this.clearValueEvent(t,null),this.hideOptionPanel()},changeOptionEvent:function(e,t){var i=this,n=i.reactData,a=i.value,l=i.multiple,o=i.internalData.remoteValMaps,r=t[i.computeValueField],s=o[r];s?s.item=t:o[r]={key:i.getOptId(t),item:t,_index:-1},l?(s=[],o=_xeUtils.default.eqNull(a)?[]:_xeUtils.default.isArray(a)?a:[a],s=-1===_xeUtils.default.findIndexOf(o,function(e){return e===r})?o.concat([r]):o.filter(function(e){return e!==r}),i.changeEvent(e,s)):(i.changeEvent(e,r),i.hideOptionPanel()),n.reactFlag++},handleGlobalMousewheelEvent:function(e){var t=this,i=t.reactData.visiblePanel;t.computeIsDisabled||i&&(i=t.$refs.refOptionPanel,(0,_dom.getEventTargetNode)(e,i).flag?t.updatePlacement():t.hideOptionPanel())},handleGlobalMousedownEvent:function(e){var t,i,n=this,a=n.reactData,l=a.visiblePanel;n.computeIsDisabled||(t=n.$refs.refElem,i=n.$refs.refOptionPanel,a.isActivated=(0,_dom.getEventTargetNode)(e,t).flag||(0,_dom.getEventTargetNode)(e,i).flag,l&&!a.isActivated&&n.hideOptionPanel())},validOffsetOption:function(e){var t=e.disabled,e=this.getOptId(e);return!t&&!this.hasOptGroupById(e)},findOffsetOption:function(e,t){var i=this,n=i.reactData.afterVisibleList,a=i.internalData.optFullValMaps,l=i.computeValueField;if(!e)for(var o=0;o<n.length-1;o++){var r=n[o];if(i.validOffsetOption(r))return r}a=a[e[l]];if(a){e=a._index;if(-1<e)if(t)for(var s=e+1;s<=n.length-1;s++){var c=n[s];if(i.validOffsetOption(c))return c}else if(0<e)for(var u=e-1;0<=u;u--){var p=n[u];if(i.validOffsetOption(p))return p}}return null},handleGlobalKeydownEvent:function(e){var t,i,n,a,l,o,r,s=this,c=s.reactData,u=s.clearable,p=c.visiblePanel,f=c.currentOption;s.computeIsDisabled||(t=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.TAB),i=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ENTER),n=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ESCAPE),a=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_UP),l=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_DOWN),o=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.DELETE),r=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.SPACEBAR),t&&(c.isActivated=!1),p?n||t?s.hideOptionPanel():i?(e.preventDefault(),e.stopPropagation(),s.changeOptionEvent(e,f)):a||l?(e.preventDefault(),(p=s.findOffsetOption(f,l))&&(s.setCurrentOption(p),s.handleScrollToOption(p,l))):r&&e.preventDefault():(a||l||i||r)&&c.isActivated&&(e.preventDefault(),s.showOptionPanel()),c.isActivated&&o&&u&&s.clearValueEvent(e,null))},handleGlobalBlurEvent:function(){this.hideOptionPanel()},handleFocusSearch:function(){var t=this;t.filterable&&t.$nextTick(function(){var e=t.$refs.refInpSearch;e&&e.focus()})},focusEvent:function(e){var t=this.reactData;this.computeIsDisabled||t.visiblePanel||(t.triggerFocusPanel=!0,this.showOptionPanel(),setTimeout(function(){t.triggerFocusPanel=!1},150)),this.dispatchEvent("focus",{},e)},clickEvent:function(e){this.togglePanelEvent(e),this.dispatchEvent("click",{},e)},blurEvent:function(e){this.reactData.isActivated=!1,this.dispatchEvent("blur",{},e)},modelSearchEvent:function(e){this.reactData.searchValue=e},focusSearchEvent:function(){this.reactData.isActivated=!0},handleSearchEvent:function(){var e=this,t=e.reactData,i=e.remote,n=e.remoteMethod,a=t.searchValue;i&&n?(t.searchLoading=!0,Promise.resolve(n({searchValue:a})).then(function(){return e.$nextTick()}).catch(function(){return e.$nextTick()}).finally(function(){t.searchLoading=!1,e.handleOption(),e.updateYData()})):(e.handleOption(),e.updateYData())},triggerSearchEvent:_xeUtils.default.debounce(function(){this.handleSearchEvent()},350,{trailing:!0}),togglePanelEvent:function(e){var t=this.reactData;e.$event.preventDefault(),t.triggerFocusPanel?t.triggerFocusPanel=!1:t.visiblePanel?this.hideOptionPanel():this.showOptionPanel()},checkOptionDisabled:function(e,t,i){return!!t.disabled||!(!i||!i.disabled)||!(!this.computeIsMaximize||e)},updateYSpace:function(){var e=this.reactData,t=this.internalData,i=e.scrollYLoad,t=t.scrollYStore;e.bodyHeight=i?e.afterVisibleList.length*t.rowHeight:0,e.topSpaceHeight=i?Math.max(t.startIndex*t.rowHeight,0):0},handleData:function(){var e=this.reactData,t=this.internalData,i=e.scrollYLoad,n=e.afterVisibleList,t=t.scrollYStore;return e.optList=i?n.slice(t.startIndex,t.endIndex):n.slice(0),this.$nextTick()},updateYData:function(){this.handleData(),this.updateYSpace()},computeScrollLoad:function(){var o=this,r=o.reactData,s=o.internalData;return o.$nextTick().then(function(){var e,t=r.scrollYLoad,i=s.scrollYStore,n=o.$refs.refVirtualBody,a=o.computeSYOpts,l=0;(e=n?(e=a.sItem?n.querySelector(a.sItem):e)||n.children[0]:e)&&(l=e.offsetHeight),l=Math.max(20,l),i.rowHeight=l,t?(n=o.$refs.refVirtualWrapper,e=Math.max(8,n?Math.ceil(n.clientHeight/l):0),t=Math.max(0,Math.min(2,_xeUtils.default.toNumber(a.oSize))),i.offsetSize=t,i.visibleSize=e,i.endIndex=Math.max(i.startIndex,e+t,i.endIndex),o.updateYData()):o.updateYSpace()})},handleScrollToOption:function(e,t){var i,n=this,a=n.reactData,l=n.internalData,a=a.scrollYLoad,o=l.optFullValMaps,l=l.scrollYStore,o=o[e[n.computeValueField]];o&&(e=o.key,-1<(o=o._index))&&(i=n.$refs.refVirtualWrapper,n=n.$refs.refOptionPanel.querySelector("[optid='".concat(e,"']")),i)&&(n?(e=i.offsetHeight,t?n.offsetTop+n.offsetHeight-i.scrollTop>e&&(i.scrollTop=n.offsetTop+n.offsetHeight-e):(n.offsetTop+1<i.scrollTop||n.offsetTop+1>i.scrollTop+i.clientHeight)&&(i.scrollTop=n.offsetTop-1)):a&&(i.scrollTop=t?o*l.rowHeight-i.clientHeight+l.rowHeight:o*l.rowHeight))},scrollTo:function(e,t){var i=this,n=i.reactData,a=i.$refs.refVirtualWrapper;return a&&(_xeUtils.default.isNumber(e)&&(a.scrollLeft=e),_xeUtils.default.isNumber(t))&&(a.scrollTop=t),n.scrollYLoad?new Promise(function(e){setTimeout(function(){i.$nextTick(function(){e()})},50)}):i.$nextTick()},refreshScroll:function(){var e=this,t=e.internalData,i=t.lastScrollLeft,n=t.lastScrollTop;return e.clearScroll().then(function(){if(i||n)return t.lastScrollLeft=0,t.lastScrollTop=0,e.scrollTo(i,n)})},recalculate:function(){var e=this.$refs.refElem;return e&&e.clientWidth&&e.clientHeight?this.computeScrollLoad():Promise.resolve()},loadYData:function(e){var t=this.internalData.scrollYStore,i=t.startIndex,n=t.endIndex,a=t.visibleSize,l=t.offsetSize,e=e.target.scrollTop,e=Math.floor(e/t.rowHeight),o=Math.max(0,e-1-l),l=e+a+l;!(e<=i||n-a-1<=e)||i===o&&n===l||(t.startIndex=o,t.endIndex=l,this.updateYData())},isVMScrollProcess:function(){var e=this.internalData.lastScrollTime;return!!(e&&Date.now()<e+250)},scrollEvent:function(e){var t=this.reactData,i=this.internalData,n=e.target,a=n.scrollTop,n=n.scrollLeft,l=n!==i.lastScrollLeft,o=a!==i.lastScrollTop;i.lastScrollTop=a,i.lastScrollLeft=n,t.scrollYLoad&&this.loadYData(e),i.lastScrollTime=Date.now(),this.dispatchEvent("scroll",{scrollLeft:n,scrollTop:a,isX:l,isY:o},e)},loadData:function(e){var t,i=this,n=i,a=i.reactData,l=i.internalData,o=(i.cacheItemMap(e||[]),l.isLoaded),r=l.fullData,s=l.scrollYStore,c=i.computeDefaultOpts,u=i.computeSYOpts,p=i.computeValueField;return Object.assign(s,{startIndex:0,endIndex:1,visibleSize:0}),l.synchData=e||[],a.scrollYLoad=!!u.enabled&&-1<u.gt&&(0===u.gt||u.gt<=r.length),i.handleData(),o||(s=c.selectMode,0<e.length&&_xeUtils.default.eqNull(n.value)&&("first"!==s&&"last"!==s||(t=_xeUtils.default[s](e))&&i.$nextTick(function(){_xeUtils.default.eqNull(n.value)&&i.emitModel(t[p])}),l.isLoaded=!0)),i.computeScrollLoad().then(function(){i.refreshScroll()})},reloadData:function(e){return this.internalData.isLoaded=!1,this.clearScroll(),this.loadData(e)},clearScroll:function(){var e=this.internalData,t=this.$refs.refVirtualWrapper;return t&&(t.scrollTop=0,t.scrollLeft=0),e.lastScrollTop=0,e.lastScrollLeft=0,this.$nextTick()},hasOptGroupById:function(e){return!!this.internalData.optGroupKeyMaps[e]},renderOption:function(u,e,p){var f=this,t=f.$scopedSlots,d=f.optionKey,h=f.value,v=f.reactData.currentOption,m=f.computeLabelField,g=f.computeValueField,b=f.computeGroupLabelField,x=f.computeOptionOpts.useKey,_=t.option;return e.map(function(t,e){var i=t.slots,n=t.className,a=f.getOptId(t),l=t[g],o=f.hasOptGroupById(a),l=_xeUtils.default.isArray(h)?-1<h.indexOf(l):h===l,r=!o||isOptionVisible(t),s=f.checkOptionDisabled(l,t,p),i=i?i.default:null,c={option:t,group:null,$select:f};return r?u("div",{key:x||d?a:e,class:["vxe-select-option",n?_xeUtils.default.isFunction(n)?n(c):n:"",{"vxe-select-optgroup":o,"is--disabled":s,"is--selected":l,"is--hover":v&&f.getOptId(v)===a}],attrs:{optid:a},on:{mousedown:function(e){0===e.button&&e.stopPropagation()},click:function(e){s||o||f.changeOptionEvent(e,t)},mouseenter:function(){s||o||f.isVMScrollProcess()||f.setCurrentOption(t)}}},_?f.callSlot(_,c,u):i?f.callSlot(i,c,u):(0,_utils.getFuncText)(t[o?b:m])):(0,_ui.renderEmptyElement)(f)})},renderOpts:function(e){var t=this.reactData,i=t.optList;return t.searchLoading?[e("div",{class:"vxe-select--search-loading"},[e("i",{class:["vxe-select--search-icon",(0,_ui.getIcon)().SELECT_LOADED]}),e("span",{class:"vxe-select--search-text"},(0,_ui.getI18n)("vxe.select.loadingText"))])]:i.length?this.renderOption(e,i):[e("div",{class:"vxe-select--empty-placeholder"},this.emptyText||(0,_ui.getI18n)("vxe.select.emptyText"))]},renderVN:function(e){var t=this,i=t,n=t.$scopedSlots,a=t.reactData,l=i.className,o=i.popupClassName,r=i.loading,s=i.filterable,c=a.initialized,u=a.isActivated,p=a.isAniVisible,f=a.visiblePanel,d=a.bodyHeight,h=a.topSpaceHeight,v=t.computeSize,m=t.computeIsDisabled,g=t.computeSelectLabel,b=t.computeBtnTransfer,x=t.computeInpPlaceholder,_=n.default,O=n.header,S=n.footer,E=n.prefix;return t.computeFormReadonly?e("div",{ref:"refElem",class:["vxe-select--readonly",l]},[e("div",{class:"vxe-select-slots",ref:"hideOption"},_?t.callSlot(_,{},e):[]),e("span",{class:"vxe-select-label"},g)]):e("div",{ref:"refElem",class:["vxe-select",l?_xeUtils.default.isFunction(l)?l({$select:t}):l:"",_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},"size--".concat(v),v),"is--visible",f),"is--disabled",m),"is--filter",s),"is--loading",r),"is--active",u)]},[e("div",{class:"vxe-select-slots",ref:"hideOption"},_?_.call(t,{}):[]),e(_input.default,{ref:"refInput",props:{clearable:i.clearable,placeholder:x,readonly:!0,disabled:m,type:"text",prefixIcon:i.prefixIcon,suffixIcon:r?(0,_ui.getIcon)().SELECT_LOADED:f?(0,_ui.getIcon)().SELECT_OPEN:(0,_ui.getIcon)().SELECT_CLOSE,value:g},on:{clear:t.clearEvent,click:t.clickEvent,focus:t.focusEvent,blur:t.blurEvent,"suffix-click":t.togglePanelEvent},scopedSlots:E?{prefix:function(){return E({})}}:{}}),e("div",{ref:"refOptionPanel",class:["vxe-table--ignore-clear vxe-select--panel",o?_xeUtils.default.isFunction(o)?o({$select:t}):o:"",_defineProperty(_defineProperty(_defineProperty(_defineProperty({},"size--".concat(v),v),"is--transfer",b),"ani--leave",!r&&p),"ani--enter",!r&&f)],attrs:{placement:a.panelPlacement},style:a.panelStyle},c&&(f||p)?[e("div",{class:"vxe-select--panel-wrapper"},[s?e("div",{class:"vxe-select--panel-search"},[e(_input.default,{ref:"refInpSearch",class:"vxe-select-search--input",props:{value:a.searchValue,clearable:!0,disabled:!1,readonly:!1,placeholder:(0,_ui.getI18n)("vxe.select.search"),prefixIcon:(0,_ui.getIcon)().INPUT_SEARCH},on:{"model-value":t.modelSearchEvent,focus:t.focusSearchEvent,change:t.triggerSearchEvent,search:t.triggerSearchEvent}})]):(0,_ui.renderEmptyElement)(t),O?e("div",{class:"vxe-select--panel-header"},t.callSlot(O,{},e)):(0,_ui.renderEmptyElement)(t),e("div",{class:"vxe-select--panel-body"},[e("div",{ref:"refVirtualWrapper",class:"vxe-select-option--wrapper",on:{scroll:t.scrollEvent}},[e("div",{class:"vxe-select--y-space",style:{height:d?"".concat(d,"px"):""}}),e("div",{ref:"refVirtualBody",class:"vxe-select--body",style:{marginTop:h?"".concat(h,"px"):""}},t.renderOpts(e))])]),S?e("div",{class:"vxe-select--panel-footer"},t.callSlot(S,{},e)):(0,_ui.renderEmptyElement)(t)])]:[])])}},watch:{"reactData.staticOptions":function(e){this.loadData(e)},options:function(e){this.loadData(e)},optionGroups:function(e){this.loadData(e)}},mounted:function(){var i=this,n=i;i.$nextTick(function(){var e=n.options,t=n.optionGroups;t?i.loadData(t):e&&i.loadData(e)}),_ui.globalEvents.on(i,"mousewheel",i.handleGlobalMousewheelEvent),_ui.globalEvents.on(i,"mousedown",i.handleGlobalMousedownEvent),_ui.globalEvents.on(i,"keydown",i.handleGlobalKeydownEvent),_ui.globalEvents.on(i,"blur",i.handleGlobalBlurEvent)},beforeDestroy:function(){var e=this,t=e.$refs.refOptionPanel;t&&t.parentNode&&t.parentNode.removeChild(t),_ui.globalEvents.off(e,"mousewheel"),_ui.globalEvents.off(e,"mousedown"),_ui.globalEvents.off(e,"keydown"),_ui.globalEvents.off(e,"blur")},render:function(e){return this.renderVN(e)}});
|