vxe-pc-ui 3.3.48 → 3.3.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/es/icon/style.css +1 -1
  2. package/es/modal/src/modal.js +2 -2
  3. package/es/number-input/src/number-input.js +1 -1
  4. package/es/style.css +1 -1
  5. package/es/style.min.css +1 -1
  6. package/es/ui/index.js +1 -1
  7. package/es/ui/src/log.js +1 -1
  8. package/es/upload/style.css +4 -0
  9. package/es/upload/style.min.css +1 -1
  10. package/es/vxe-upload/style.css +4 -0
  11. package/es/vxe-upload/style.min.css +1 -1
  12. package/lib/icon/style/style.css +1 -1
  13. package/lib/icon/style/style.min.css +1 -1
  14. package/lib/index.umd.js +5 -5
  15. package/lib/index.umd.min.js +1 -1
  16. package/lib/modal/src/modal.js +2 -2
  17. package/lib/modal/src/modal.min.js +1 -1
  18. package/lib/number-input/src/number-input.js +1 -1
  19. package/lib/number-input/src/number-input.min.js +1 -1
  20. package/lib/style.css +1 -1
  21. package/lib/style.min.css +1 -1
  22. package/lib/ui/index.js +1 -1
  23. package/lib/ui/index.min.js +1 -1
  24. package/lib/ui/src/log.js +1 -1
  25. package/lib/ui/src/log.min.js +1 -1
  26. package/lib/upload/style/style.css +4 -0
  27. package/lib/upload/style/style.min.css +1 -1
  28. package/lib/vxe-upload/style/style.css +4 -0
  29. package/lib/vxe-upload/style/style.min.css +1 -1
  30. package/package.json +1 -1
  31. package/packages/modal/src/modal.ts +2 -2
  32. package/packages/number-input/src/number-input.ts +1 -1
  33. package/styles/components/upload.scss +4 -0
  34. package/types/components/modal.d.ts +4 -4
  35. /package/es/icon/{iconfont.1735200251672.ttf → iconfont.1735275518431.ttf} +0 -0
  36. /package/es/icon/{iconfont.1735200251672.woff → iconfont.1735275518431.woff} +0 -0
  37. /package/es/icon/{iconfont.1735200251672.woff2 → iconfont.1735275518431.woff2} +0 -0
  38. /package/es/{iconfont.1735200251672.ttf → iconfont.1735275518431.ttf} +0 -0
  39. /package/es/{iconfont.1735200251672.woff → iconfont.1735275518431.woff} +0 -0
  40. /package/es/{iconfont.1735200251672.woff2 → iconfont.1735275518431.woff2} +0 -0
  41. /package/lib/icon/style/{iconfont.1735200251672.ttf → iconfont.1735275518431.ttf} +0 -0
  42. /package/lib/icon/style/{iconfont.1735200251672.woff → iconfont.1735275518431.woff} +0 -0
  43. /package/lib/icon/style/{iconfont.1735200251672.woff2 → iconfont.1735275518431.woff2} +0 -0
  44. /package/lib/{iconfont.1735200251672.ttf → iconfont.1735275518431.ttf} +0 -0
  45. /package/lib/{iconfont.1735200251672.woff → iconfont.1735275518431.woff} +0 -0
  46. /package/lib/{iconfont.1735200251672.woff2 → iconfont.1735275518431.woff2} +0 -0
@@ -431,8 +431,8 @@ var _default2 = exports.default = (0, _comp.defineVxeComponent)({
431
431
  height = props.height;
432
432
  var boxElem = $xeModal.getBox();
433
433
  if (boxElem) {
434
- boxElem.style.width = (0, _dom.toCssUnit)(width);
435
- boxElem.style.height = (0, _dom.toCssUnit)(height);
434
+ boxElem.style.width = width ? (0, _dom.toCssUnit)(width) : '';
435
+ boxElem.style.height = height ? (0, _dom.toCssUnit)(height) : '';
436
436
  }
437
437
  return $xeModal.$nextTick();
438
438
  },
@@ -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=(0,_dom.toCssUnit)(e),o.style.height=(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,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)}});
@@ -405,8 +405,8 @@ var _default2 = exports.default = (0, _comp.defineVxeComponent)({
405
405
  var formItemInfo = $xeNumberInput.formItemInfo;
406
406
  var value = (0, _utils.eqEmptyValue)(val) ? null : Number(val);
407
407
  var isChange = value !== props.value;
408
- internalData.isUM = true;
409
408
  if (isChange) {
409
+ internalData.isUM = true;
410
410
  $xeNumberInput.emitModel(value);
411
411
  }
412
412
  if (reactData.inputValue !== inputValue) {
@@ -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=void 0;var _comp=require("../../ui/src/comp"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_utils=require("../../ui/src/utils"),_dom=require("../../ui/src/dom"),_vn=require("../..//ui/src/vn"),_util=require("./util");function _interopRequireDefault(e){return e&&e.__esModule?e:{default: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 _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 n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function _iterableToArrayLimit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,u,r,a,l=[],o=!0,s=!1;try{if(r=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;o=!1}else for(;!(o=(i=r.call(n)).done)&&(l.push(i.value),l.length!==t);o=!0);}catch(e){s=!0,u=e}finally{try{if(!o&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw u}}return l}}function _arrayWithHoles(e){if(Array.isArray(e))return e}var handleNumberString=function(e){return _xeUtils.default.eqNull(e)?"":"".concat(e)},_default2=exports.default=(0,_comp.defineVxeComponent)({name:"VxeNumberInput",mixins:[_ui.globalMixins.sizeMixin],model:{prop:"value",event:"modelValue"},props:{value:[String,Number],immediate:{type:Boolean,default:!0},name:String,type:{type:String,default:"number"},clearable:{type:Boolean,default:function(){return(0,_ui.getConfig)().numberInput.clearable}},readonly:{type:Boolean,default:null},disabled:{type:Boolean,default:null},placeholder:String,maxLength:[String,Number],autoComplete:{type:String,default:"off"},align:String,form:String,className:String,size:{type:String,default:function(){return(0,_ui.getConfig)().numberInput.size||(0,_ui.getConfig)().size}},multiple:Boolean,min:{type:[String,Number],default:null},max:{type:[String,Number],default:null},step:[String,Number],exponential:{type:Boolean,default:function(){return(0,_ui.getConfig)().numberInput.exponential}},showCurrency:{type:Boolean,default:function(){return(0,_ui.getConfig)().numberInput.showCurrency}},currencySymbol:{type:String,default:function(){return(0,_ui.getConfig)().numberInput.currencySymbol}},controls:{type:Boolean,default:function(){return(0,_ui.getConfig)().numberInput.controls}},digits:{type:[String,Number],default:null},autoFill:{type:Boolean,default:function(){return(0,_ui.getConfig)().numberInput.autoFill}},prefixIcon:String,suffixIcon:String,maxlength:[String,Number],autocomplete:String},inject:{$xeForm:{default:null},formItemInfo:{from:"xeFormItemInfo",default:null}},data:function(){return{xID:_xeUtils.default.uniqueId(),reactData:{isFocus:!1,isActivated:!1,inputValue:""},internalData:{}}},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},computeDigitsValue:function(){var e=this.type,t=this.digits;return null===t&&null===(t=(0,_ui.getConfig)().numberInput.digits)&&"amount"===e&&(t=2),_xeUtils.default.toInteger(t)||1},computeDecimalsType:function(){var e=this.type;return"float"===e||"amount"===e},computeStepValue:function(){var e=this.type,t=this.computeDigitsValue,n=this.computeDecimalsType,i=this.step;return"integer"===e?_xeUtils.default.toInteger(i)||1:n?_xeUtils.default.toNumber(i)||1/Math.pow(10,t):_xeUtils.default.toNumber(i)||1},computeIsClearable:function(){return this.clearable},computeInputReadonly:function(){var e=this.multiple;return this.computeFormReadonly||e},computeInpPlaceholder:function(){var e=this.placeholder;return(e=e||(0,_ui.getConfig)().numberInput.placeholder)?(0,_utils.getFuncText)(e):(0,_ui.getI18n)("vxe.base.pleaseInput")},computeInpMaxLength:function(){var e=this.maxLength,t=this.maxlength;return _xeUtils.default.toNumber(e||t)||16},computeInpImmediate:function(){return this.immediate},computeNumValue:function(){var e=this.reactData,t=this.type,e=e.inputValue;return"integer"===t?_xeUtils.default.toInteger((0,_util.handleNumber)(e)):_xeUtils.default.toNumber((0,_util.handleNumber)(e))},computeNumLabel:function(){var e=this.reactData,t=this.type,n=this.showCurrency,i=this.currencySymbol,u=this.autoFill,e=e.inputValue,r=this.computeDigitsValue;return"amount"===t?(t=_xeUtils.default.commafy(_xeUtils.default.toNumber(e),{digits:r}),!u&&(u=(r=_slicedToArray(t.split("."),2))[0],r=r[1])&&(t=(r=r.replace(/0+$/,""))?[u,".",r].join(""):u),n?"".concat(i||(0,_ui.getI18n)("vxe.numberInput.currencySymbol")||"").concat(t):t):_xeUtils.default.toString(e)},computeIsDisabledSubtractNumber:function(){var e=this.reactData,t=this.min,e=e.inputValue,n=this.computeNumValue;return!(!e&&0!==e||null===t)&&n<=_xeUtils.default.toNumber(t)},computeIsDisabledAddNumber:function(){var e=this.reactData,t=this.max,e=e.inputValue,n=this.computeNumValue;return!(!e&&0!==e||null===t)&&n>=_xeUtils.default.toNumber(t)}}),methods:{dispatchEvent:function(e,t,n){this.$emit(e,(0,_ui.createEvent)(n,{$numberInput:this},t))},emitModel:function(e){var t=this._events;t&&t.modelValue?this.$emit("modelValue",e):this.$emit("model-value",e)},focus:function(){var e=this.reactData,t=this.$refs.refInputTarget;return e.isActivated=!0,t.focus(),this.$nextTick()},blur:function(){var e=this.reactData;return this.$refs.refInputTarget.blur(),e.isActivated=!1,this.$nextTick()},select:function(){var e=this.reactData;return this.$refs.refInputTarget.select(),e.isActivated=!1,this.$nextTick()},getNumberValue:function(e){var t=this.exponential,n=this.autoFill,i=this.computeInpMaxLength,u=this.computeDigitsValue,r="";return this.computeDecimalsType?(r=(0,_util.toFloatValueFixed)(e,u),n||(r=handleNumberString(_xeUtils.default.toNumber(r)))):r=handleNumberString(e),!t||e!==r&&handleNumberString(e).toLowerCase()!==_xeUtils.default.toNumber(r).toExponential()?r.slice(0,i):e},triggerEvent:function(e){var t=this.reactData.inputValue;this.dispatchEvent(e.type,{value:t},e)},handleChange:function(e,t,n){var i=this,u=i,r=i.reactData,a=i.internalData,l=i.$xeForm,o=i.formItemInfo,e=(0,_utils.eqEmptyValue)(e)?null:Number(e),u=e!==u.value;a.isUM=!0,u&&i.emitModel(e),r.inputValue!==t&&i.$nextTick(function(){r.inputValue=t||""}),i.dispatchEvent("input",{value:e},n),u&&(i.dispatchEvent("change",{value:e},n),l)&&o&&l.triggerItemEvent(n,o.itemConfig.field,e)},emitInputEvent:function(e,t){var n=this.reactData,i=this.computeInpImmediate,u=e===(0,_utils.eqEmptyValue)(e)?null:_xeUtils.default.toNumber(e);n.inputValue=e,i?this.handleChange(u,e,t):this.dispatchEvent("input",{value:u},t)},inputEvent:function(e){var t=e.target.value;this.emitInputEvent(t,e)},changeEvent:function(e){this.computeInpImmediate||this.triggerEvent(e)},focusEvent:function(e){var t=this.reactData,n=t.inputValue;t.inputValue=(0,_utils.eqEmptyValue)(n)?"":"".concat(_xeUtils.default.toNumber(n)),t.isFocus=!0,t.isActivated=!0,this.triggerEvent(e)},clickPrefixEvent:function(e){var t=this.reactData;this.computeIsDisabled||(t=t.inputValue,this.dispatchEvent("prefix-click",{value:t},e))},clearValueEvent:function(e,t){this.focus(),this.handleChange(null,"",e),this.dispatchEvent("clear",{value:t},e)},clickSuffixEvent:function(e){var t=this.reactData;this.computeIsDisabled||(t=t.inputValue,this.dispatchEvent("suffix-click",{value:t},e))},updateModel:function(e){var t,n=this.reactData,i=this.autoFill,u=n.inputValue,r=this.computeDigitsValue,a=this.computeDecimalsType;(0,_utils.eqEmptyValue)(e)?n.inputValue="":(t="".concat(e),a&&(t=(0,_util.toFloatValueFixed)(e,r),i||(t="".concat(_xeUtils.default.toNumber(t)))),t!==u&&(n.inputValue=t))},initValue:function(){var e,t,n=this,i=n.reactData,u=n.autoFill,r=i.inputValue;n.computeDecimalsType&&r&&(e="",t=null,r&&(e=(0,_util.toFloatValueFixed)(r,n.computeDigitsValue),t=_xeUtils.default.toNumber(e),u||(e="".concat(t))),r!==t?n.handleChange(t,e,{type:"init"}):i.inputValue=e)},validMaxNum:function(e){return null===this.max||_xeUtils.default.toNumber(e)<=_xeUtils.default.toNumber(this.max)},validMinNum:function(e){return null===this.min||_xeUtils.default.toNumber(e)>=_xeUtils.default.toNumber(this.min)},afterCheckValue:function(){var e,t,n=this,i=n.reactData,u=n.type,r=n.min,a=n.max,l=n.exponential,i=i.inputValue;n.computeInputReadonly||((0,_utils.eqEmptyValue)(i)?(e=null,t=i,!r&&0!==r||(e=_xeUtils.default.toNumber(r),t="".concat(e)),n.handleChange(e,"".concat(t||""),{type:"check"})):(i||r||a)&&(e="integer"===u?_xeUtils.default.toInteger((0,_util.handleNumber)(i)):_xeUtils.default.toNumber((0,_util.handleNumber)(i)),n.validMinNum(e)?n.validMaxNum(e)||(e=a):e=r,l&&(t=handleNumberString(i).toLowerCase())===_xeUtils.default.toNumber(e).toExponential()&&(e=t),u=n.getNumberValue(e),n.handleChange((0,_utils.eqEmptyValue)(u)?null:Number(u),u,{type:"check"})))},blurEvent:function(e){var t=this,n=t.reactData,i=t.$xeForm,u=t.formItemInfo,r=n.inputValue,a=t.computeInpImmediate,l=r?Number(r):null;a||t.handleChange(l,handleNumberString(r),e),t.afterCheckValue(),n.isFocus=!1,n.isActivated=!1,t.dispatchEvent("blur",{value:l},e),i&&u&&i.triggerItemEvent(e,u.itemConfig.field,l)},numberChange:function(e,t){var n=this,i=n.reactData,u=n.min,r=n.max,i=i.inputValue,a=n.computeStepValue,i="integer"===n.type?_xeUtils.default.toInteger((0,_util.handleNumber)(i)):_xeUtils.default.toNumber((0,_util.handleNumber)(i)),e=e?_xeUtils.default.add(i,a):_xeUtils.default.subtract(i,a),i=n.validMinNum(e)?n.validMaxNum(e)?e:r:u;n.emitInputEvent(n.getNumberValue(i),t)},numberNextEvent:function(e){var t=this,n=t.reactData,i=t.computeIsDisabled,u=t.computeFormReadonly,r=t.computeIsDisabledSubtractNumber;t.numberStopDown(),i||u||r||t.numberChange(!1,e),n.isActivated=!0,t.dispatchEvent("next-number",{value:n.inputValue},e)},numberDownNextEvent:function(e){var t=this;t.internalData.dnTimeout=window.setTimeout(function(){t.numberNextEvent(e),t.numberDownNextEvent(e)},60)},numberPrevEvent:function(e){var t=this,n=t.reactData,i=t.computeIsDisabled,u=t.computeFormReadonly,r=t.computeIsDisabledAddNumber;t.numberStopDown(),i||u||r||t.numberChange(!0,e),n.isActivated=!0,t.dispatchEvent("prev-number",{value:n.inputValue},e)},numberKeydownEvent:function(e){var t=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_UP),n=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_DOWN);(t||n)&&(e.preventDefault(),t?this.numberPrevEvent(e):this.numberNextEvent(e))},keydownEvent:function(e){var t=this.exponential,n=this.controls,i=e.ctrlKey,u=e.shiftKey,r=e.altKey,a=e.keyCode,l=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ESCAPE),o=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_UP),s=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_DOWN);i||u||r||!(_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.SPACEBAR)||(!t||69!==a)&&65<=a&&a<=90||186<=a&&a<=188||191<=a)||e.preventDefault(),l?this.afterCheckValue():(o||s)&&n&&this.numberKeydownEvent(e),this.triggerEvent(e)},keyupEvent:function(e){this.triggerEvent(e)},numberStopDown:function(){var e=this.internalData,t=e.dnTimeout;t&&(clearTimeout(t),e.dnTimeout=void 0)},numberDownPrevEvent:function(e){var t=this;t.internalData.dnTimeout=window.setTimeout(function(){t.numberPrevEvent(e),t.numberDownPrevEvent(e)},60)},numberMousedownEvent:function(e){var t,n=this,i=n.internalData;n.numberStopDown(),0===e.button&&((t=(0,_dom.hasClass)(e.currentTarget,"is--prev"))?n.numberPrevEvent(e):n.numberNextEvent(e),i.dnTimeout=window.setTimeout(function(){t?n.numberDownPrevEvent(e):n.numberDownNextEvent(e)},500))},wheelEvent:function(e){var t=this,n=t.reactData;t.controls&&n.isActivated&&(e.stopPropagation(),e.preventDefault(),0<(n=e.deltaY)?t.numberNextEvent(e):n<0&&t.numberPrevEvent(e)),t.triggerEvent(e)},clickEvent:function(e){this.triggerEvent(e)},handleGlobalMousedownEvent:function(e){var t=this,n=t.reactData,i=n.isActivated,u=t.$refs.refElem,r=t.$refs.refInputPanel,a=t.computeInpImmediate;!t.computeIsDisabled&&i&&(n.isActivated=(0,_dom.getEventTargetNode)(e,u).flag||(0,_dom.getEventTargetNode)(e,r).flag,n.isActivated||(a||(u=(i=n.inputValue)?Number(i):null,t.handleChange(u,handleNumberString(i),e)),t.afterCheckValue()))},handleGlobalKeydownEvent:function(e){var t,n,i,u=this,r=u.reactData,a=u.clearable;u.computeIsDisabled||(t=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.TAB),n=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.DELETE),i=r.isActivated,t&&(i&&u.afterCheckValue(),r.isActivated=i=!1),n&&a&&i&&u.clearValueEvent(e,null))},handleGlobalBlurEvent:function(){this.reactData.isActivated&&this.afterCheckValue()},renderNumberIcon:function(e){var t=this,n=t.computeIsDisabledAddNumber,i=t.computeIsDisabledSubtractNumber;return e("div",{class:"vxe-input--control-icon"},[e("div",{class:"vxe-input--number-icon"},[e("div",{class:["vxe-input--number-btn is--prev",{"is--disabled":n}],on:{mousedown:t.numberMousedownEvent,mouseup:t.numberStopDown,mouseleave:t.numberStopDown}},[e("i",{class:(0,_ui.getIcon)().NUMBER_INPUT_PREV_NUM})]),e("div",{class:["vxe-input--number-btn is--next",{"is--disabled":i}],on:{mousedown:t.numberMousedownEvent,mouseup:t.numberStopDown,mouseleave:t.numberStopDown}},[e("i",{class:(0,_ui.getIcon)().NUMBER_INPUT_NEXT_NUM})])])])},renderPrefixIcon:function(e){var t=this.$scopedSlots,n=this.prefixIcon,t=t.prefix;return t||n?e("div",{class:"vxe-number-input--prefix",on:{click:this.clickPrefixEvent}},[e("div",{class:"vxe-number-input--prefix-icon"},t?(0,_vn.getSlotVNs)(t({})):[e("i",{class:n})])]):null},renderSuffixIcon:function(e){var t=this,n=t.$scopedSlots,i=t.suffixIcon,u=t.reactData.inputValue,n=n.suffix,r=t.computeIsClearable;return e("div",{class:["vxe-number-input--suffix",{"is--clear":r&&!t.computeIsDisabled&&!(""===u||_xeUtils.default.eqNull(u))}]},[r?e("div",{class:"vxe-number-input--clear-icon",on:{click:t.clearValueEvent}},[e("i",{class:(0,_ui.getIcon)().INPUT_CLEAR})]):(0,_ui.renderEmptyElement)(t),t.renderExtraSuffixIcon(e),n||i?e("div",{class:"vxe-number-input--suffix-icon",on:{click:t.clickSuffixEvent}},n?(0,_vn.getSlotVNs)(n({})):[e("i",{class:i})]):(0,_ui.renderEmptyElement)(t)])},renderExtraSuffixIcon:function(e){return this.controls?this.renderNumberIcon(e):(0,_ui.renderEmptyElement)(this)},renderVN:function(e){var t,n,i,u,r,a,l=this,o=l.reactData,s=l.className,c=l.controls,m=l.type,p=l.align,d=l.name,f=l.autocomplete,v=l.autoComplete,h=o.inputValue,b=o.isFocus,o=o.isActivated,_=l.computeSize,y=l.computeIsDisabled,g=l.computeNumLabel;return l.computeFormReadonly?e("div",{ref:"refElem",class:["vxe-number-input--readonly","type--".concat(m),s]},g):(t=l.computeInputReadonly,n=l.computeInpMaxLength,i=l.computeInpPlaceholder,u=l.computeIsClearable,r=l.renderPrefixIcon(e),a=l.renderSuffixIcon(e),e("div",{ref:"refElem",class:["vxe-number-input","type--".concat(m),s,_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},"size--".concat(_),_),"is--".concat(p),p),"is--controls",c),"is--prefix",!!r),"is--suffix",!!a),"is--disabled",y),"is--active",o),"show--clear",u&&!y&&!(""===h||_xeUtils.default.eqNull(h)))],attrs:{spellcheck:!1}},[r||(0,_ui.renderEmptyElement)(l),e("div",{class:"vxe-number-input--wrapper"},[e("input",{ref:"refInputTarget",class:"vxe-number-input--inner",domProps:{value:b||"amount"!==m?h:g},attrs:{name:d,type:"text",placeholder:i,maxlength:n,readonly:t,disabled:y,autocomplete:v||f},on:{keydown:l.keydownEvent,keyup:l.keyupEvent,wheel:l.wheelEvent,click:l.clickEvent,input:l.inputEvent,change:l.changeEvent,focus:l.focusEvent,blur:l.blurEvent}})]),a||(0,_ui.renderEmptyElement)(l)]))}},watch:{value:function(e){var t=this.internalData;t.isUM||this.updateModel(e),t.isUM=!1},type:function(){var e=this.reactData;Object.assign(e,{inputValue:this.value}),this.initValue()}},created:function(){this.reactData.inputValue=this.value,this.initValue()},mounted:function(){var e=this;_ui.globalEvents.on(e,"mousedown",e.handleGlobalMousedownEvent),_ui.globalEvents.on(e,"keydown",e.handleGlobalKeydownEvent),_ui.globalEvents.on(e,"blur",e.handleGlobalBlurEvent)},beforeDestroy:function(){var e=this;e.reactData.isFocus=!1,e.numberStopDown(),e.afterCheckValue(),_ui.globalEvents.off(e,"mousedown"),_ui.globalEvents.off(e,"keydown"),_ui.globalEvents.off(e,"blur")},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=void 0;var _comp=require("../../ui/src/comp"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_utils=require("../../ui/src/utils"),_dom=require("../../ui/src/dom"),_vn=require("../..//ui/src/vn"),_util=require("./util");function _interopRequireDefault(e){return e&&e.__esModule?e:{default: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 _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 n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function _iterableToArrayLimit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,u,r,a,l=[],o=!0,s=!1;try{if(r=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;o=!1}else for(;!(o=(i=r.call(n)).done)&&(l.push(i.value),l.length!==t);o=!0);}catch(e){s=!0,u=e}finally{try{if(!o&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw u}}return l}}function _arrayWithHoles(e){if(Array.isArray(e))return e}var handleNumberString=function(e){return _xeUtils.default.eqNull(e)?"":"".concat(e)},_default2=exports.default=(0,_comp.defineVxeComponent)({name:"VxeNumberInput",mixins:[_ui.globalMixins.sizeMixin],model:{prop:"value",event:"modelValue"},props:{value:[String,Number],immediate:{type:Boolean,default:!0},name:String,type:{type:String,default:"number"},clearable:{type:Boolean,default:function(){return(0,_ui.getConfig)().numberInput.clearable}},readonly:{type:Boolean,default:null},disabled:{type:Boolean,default:null},placeholder:String,maxLength:[String,Number],autoComplete:{type:String,default:"off"},align:String,form:String,className:String,size:{type:String,default:function(){return(0,_ui.getConfig)().numberInput.size||(0,_ui.getConfig)().size}},multiple:Boolean,min:{type:[String,Number],default:null},max:{type:[String,Number],default:null},step:[String,Number],exponential:{type:Boolean,default:function(){return(0,_ui.getConfig)().numberInput.exponential}},showCurrency:{type:Boolean,default:function(){return(0,_ui.getConfig)().numberInput.showCurrency}},currencySymbol:{type:String,default:function(){return(0,_ui.getConfig)().numberInput.currencySymbol}},controls:{type:Boolean,default:function(){return(0,_ui.getConfig)().numberInput.controls}},digits:{type:[String,Number],default:null},autoFill:{type:Boolean,default:function(){return(0,_ui.getConfig)().numberInput.autoFill}},prefixIcon:String,suffixIcon:String,maxlength:[String,Number],autocomplete:String},inject:{$xeForm:{default:null},formItemInfo:{from:"xeFormItemInfo",default:null}},data:function(){return{xID:_xeUtils.default.uniqueId(),reactData:{isFocus:!1,isActivated:!1,inputValue:""},internalData:{}}},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},computeDigitsValue:function(){var e=this.type,t=this.digits;return null===t&&null===(t=(0,_ui.getConfig)().numberInput.digits)&&"amount"===e&&(t=2),_xeUtils.default.toInteger(t)||1},computeDecimalsType:function(){var e=this.type;return"float"===e||"amount"===e},computeStepValue:function(){var e=this.type,t=this.computeDigitsValue,n=this.computeDecimalsType,i=this.step;return"integer"===e?_xeUtils.default.toInteger(i)||1:n?_xeUtils.default.toNumber(i)||1/Math.pow(10,t):_xeUtils.default.toNumber(i)||1},computeIsClearable:function(){return this.clearable},computeInputReadonly:function(){var e=this.multiple;return this.computeFormReadonly||e},computeInpPlaceholder:function(){var e=this.placeholder;return(e=e||(0,_ui.getConfig)().numberInput.placeholder)?(0,_utils.getFuncText)(e):(0,_ui.getI18n)("vxe.base.pleaseInput")},computeInpMaxLength:function(){var e=this.maxLength,t=this.maxlength;return _xeUtils.default.toNumber(e||t)||16},computeInpImmediate:function(){return this.immediate},computeNumValue:function(){var e=this.reactData,t=this.type,e=e.inputValue;return"integer"===t?_xeUtils.default.toInteger((0,_util.handleNumber)(e)):_xeUtils.default.toNumber((0,_util.handleNumber)(e))},computeNumLabel:function(){var e=this.reactData,t=this.type,n=this.showCurrency,i=this.currencySymbol,u=this.autoFill,e=e.inputValue,r=this.computeDigitsValue;return"amount"===t?(t=_xeUtils.default.commafy(_xeUtils.default.toNumber(e),{digits:r}),!u&&(u=(r=_slicedToArray(t.split("."),2))[0],r=r[1])&&(t=(r=r.replace(/0+$/,""))?[u,".",r].join(""):u),n?"".concat(i||(0,_ui.getI18n)("vxe.numberInput.currencySymbol")||"").concat(t):t):_xeUtils.default.toString(e)},computeIsDisabledSubtractNumber:function(){var e=this.reactData,t=this.min,e=e.inputValue,n=this.computeNumValue;return!(!e&&0!==e||null===t)&&n<=_xeUtils.default.toNumber(t)},computeIsDisabledAddNumber:function(){var e=this.reactData,t=this.max,e=e.inputValue,n=this.computeNumValue;return!(!e&&0!==e||null===t)&&n>=_xeUtils.default.toNumber(t)}}),methods:{dispatchEvent:function(e,t,n){this.$emit(e,(0,_ui.createEvent)(n,{$numberInput:this},t))},emitModel:function(e){var t=this._events;t&&t.modelValue?this.$emit("modelValue",e):this.$emit("model-value",e)},focus:function(){var e=this.reactData,t=this.$refs.refInputTarget;return e.isActivated=!0,t.focus(),this.$nextTick()},blur:function(){var e=this.reactData;return this.$refs.refInputTarget.blur(),e.isActivated=!1,this.$nextTick()},select:function(){var e=this.reactData;return this.$refs.refInputTarget.select(),e.isActivated=!1,this.$nextTick()},getNumberValue:function(e){var t=this.exponential,n=this.autoFill,i=this.computeInpMaxLength,u=this.computeDigitsValue,r="";return this.computeDecimalsType?(r=(0,_util.toFloatValueFixed)(e,u),n||(r=handleNumberString(_xeUtils.default.toNumber(r)))):r=handleNumberString(e),!t||e!==r&&handleNumberString(e).toLowerCase()!==_xeUtils.default.toNumber(r).toExponential()?r.slice(0,i):e},triggerEvent:function(e){var t=this.reactData.inputValue;this.dispatchEvent(e.type,{value:t},e)},handleChange:function(e,t,n){var i=this,u=i,r=i.reactData,a=i.internalData,l=i.$xeForm,o=i.formItemInfo,e=(0,_utils.eqEmptyValue)(e)?null:Number(e),u=e!==u.value;u&&(a.isUM=!0,i.emitModel(e)),r.inputValue!==t&&i.$nextTick(function(){r.inputValue=t||""}),i.dispatchEvent("input",{value:e},n),u&&(i.dispatchEvent("change",{value:e},n),l)&&o&&l.triggerItemEvent(n,o.itemConfig.field,e)},emitInputEvent:function(e,t){var n=this.reactData,i=this.computeInpImmediate,u=e===(0,_utils.eqEmptyValue)(e)?null:_xeUtils.default.toNumber(e);n.inputValue=e,i?this.handleChange(u,e,t):this.dispatchEvent("input",{value:u},t)},inputEvent:function(e){var t=e.target.value;this.emitInputEvent(t,e)},changeEvent:function(e){this.computeInpImmediate||this.triggerEvent(e)},focusEvent:function(e){var t=this.reactData,n=t.inputValue;t.inputValue=(0,_utils.eqEmptyValue)(n)?"":"".concat(_xeUtils.default.toNumber(n)),t.isFocus=!0,t.isActivated=!0,this.triggerEvent(e)},clickPrefixEvent:function(e){var t=this.reactData;this.computeIsDisabled||(t=t.inputValue,this.dispatchEvent("prefix-click",{value:t},e))},clearValueEvent:function(e,t){this.focus(),this.handleChange(null,"",e),this.dispatchEvent("clear",{value:t},e)},clickSuffixEvent:function(e){var t=this.reactData;this.computeIsDisabled||(t=t.inputValue,this.dispatchEvent("suffix-click",{value:t},e))},updateModel:function(e){var t,n=this.reactData,i=this.autoFill,u=n.inputValue,r=this.computeDigitsValue,a=this.computeDecimalsType;(0,_utils.eqEmptyValue)(e)?n.inputValue="":(t="".concat(e),a&&(t=(0,_util.toFloatValueFixed)(e,r),i||(t="".concat(_xeUtils.default.toNumber(t)))),t!==u&&(n.inputValue=t))},initValue:function(){var e,t,n=this,i=n.reactData,u=n.autoFill,r=i.inputValue;n.computeDecimalsType&&r&&(e="",t=null,r&&(e=(0,_util.toFloatValueFixed)(r,n.computeDigitsValue),t=_xeUtils.default.toNumber(e),u||(e="".concat(t))),r!==t?n.handleChange(t,e,{type:"init"}):i.inputValue=e)},validMaxNum:function(e){return null===this.max||_xeUtils.default.toNumber(e)<=_xeUtils.default.toNumber(this.max)},validMinNum:function(e){return null===this.min||_xeUtils.default.toNumber(e)>=_xeUtils.default.toNumber(this.min)},afterCheckValue:function(){var e,t,n=this,i=n.reactData,u=n.type,r=n.min,a=n.max,l=n.exponential,i=i.inputValue;n.computeInputReadonly||((0,_utils.eqEmptyValue)(i)?(e=null,t=i,!r&&0!==r||(e=_xeUtils.default.toNumber(r),t="".concat(e)),n.handleChange(e,"".concat(t||""),{type:"check"})):(i||r||a)&&(e="integer"===u?_xeUtils.default.toInteger((0,_util.handleNumber)(i)):_xeUtils.default.toNumber((0,_util.handleNumber)(i)),n.validMinNum(e)?n.validMaxNum(e)||(e=a):e=r,l&&(t=handleNumberString(i).toLowerCase())===_xeUtils.default.toNumber(e).toExponential()&&(e=t),u=n.getNumberValue(e),n.handleChange((0,_utils.eqEmptyValue)(u)?null:Number(u),u,{type:"check"})))},blurEvent:function(e){var t=this,n=t.reactData,i=t.$xeForm,u=t.formItemInfo,r=n.inputValue,a=t.computeInpImmediate,l=r?Number(r):null;a||t.handleChange(l,handleNumberString(r),e),t.afterCheckValue(),n.isFocus=!1,n.isActivated=!1,t.dispatchEvent("blur",{value:l},e),i&&u&&i.triggerItemEvent(e,u.itemConfig.field,l)},numberChange:function(e,t){var n=this,i=n.reactData,u=n.min,r=n.max,i=i.inputValue,a=n.computeStepValue,i="integer"===n.type?_xeUtils.default.toInteger((0,_util.handleNumber)(i)):_xeUtils.default.toNumber((0,_util.handleNumber)(i)),e=e?_xeUtils.default.add(i,a):_xeUtils.default.subtract(i,a),i=n.validMinNum(e)?n.validMaxNum(e)?e:r:u;n.emitInputEvent(n.getNumberValue(i),t)},numberNextEvent:function(e){var t=this,n=t.reactData,i=t.computeIsDisabled,u=t.computeFormReadonly,r=t.computeIsDisabledSubtractNumber;t.numberStopDown(),i||u||r||t.numberChange(!1,e),n.isActivated=!0,t.dispatchEvent("next-number",{value:n.inputValue},e)},numberDownNextEvent:function(e){var t=this;t.internalData.dnTimeout=window.setTimeout(function(){t.numberNextEvent(e),t.numberDownNextEvent(e)},60)},numberPrevEvent:function(e){var t=this,n=t.reactData,i=t.computeIsDisabled,u=t.computeFormReadonly,r=t.computeIsDisabledAddNumber;t.numberStopDown(),i||u||r||t.numberChange(!0,e),n.isActivated=!0,t.dispatchEvent("prev-number",{value:n.inputValue},e)},numberKeydownEvent:function(e){var t=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_UP),n=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_DOWN);(t||n)&&(e.preventDefault(),t?this.numberPrevEvent(e):this.numberNextEvent(e))},keydownEvent:function(e){var t=this.exponential,n=this.controls,i=e.ctrlKey,u=e.shiftKey,r=e.altKey,a=e.keyCode,l=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ESCAPE),o=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_UP),s=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_DOWN);i||u||r||!(_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.SPACEBAR)||(!t||69!==a)&&65<=a&&a<=90||186<=a&&a<=188||191<=a)||e.preventDefault(),l?this.afterCheckValue():(o||s)&&n&&this.numberKeydownEvent(e),this.triggerEvent(e)},keyupEvent:function(e){this.triggerEvent(e)},numberStopDown:function(){var e=this.internalData,t=e.dnTimeout;t&&(clearTimeout(t),e.dnTimeout=void 0)},numberDownPrevEvent:function(e){var t=this;t.internalData.dnTimeout=window.setTimeout(function(){t.numberPrevEvent(e),t.numberDownPrevEvent(e)},60)},numberMousedownEvent:function(e){var t,n=this,i=n.internalData;n.numberStopDown(),0===e.button&&((t=(0,_dom.hasClass)(e.currentTarget,"is--prev"))?n.numberPrevEvent(e):n.numberNextEvent(e),i.dnTimeout=window.setTimeout(function(){t?n.numberDownPrevEvent(e):n.numberDownNextEvent(e)},500))},wheelEvent:function(e){var t=this,n=t.reactData;t.controls&&n.isActivated&&(e.stopPropagation(),e.preventDefault(),0<(n=e.deltaY)?t.numberNextEvent(e):n<0&&t.numberPrevEvent(e)),t.triggerEvent(e)},clickEvent:function(e){this.triggerEvent(e)},handleGlobalMousedownEvent:function(e){var t=this,n=t.reactData,i=n.isActivated,u=t.$refs.refElem,r=t.$refs.refInputPanel,a=t.computeInpImmediate;!t.computeIsDisabled&&i&&(n.isActivated=(0,_dom.getEventTargetNode)(e,u).flag||(0,_dom.getEventTargetNode)(e,r).flag,n.isActivated||(a||(u=(i=n.inputValue)?Number(i):null,t.handleChange(u,handleNumberString(i),e)),t.afterCheckValue()))},handleGlobalKeydownEvent:function(e){var t,n,i,u=this,r=u.reactData,a=u.clearable;u.computeIsDisabled||(t=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.TAB),n=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.DELETE),i=r.isActivated,t&&(i&&u.afterCheckValue(),r.isActivated=i=!1),n&&a&&i&&u.clearValueEvent(e,null))},handleGlobalBlurEvent:function(){this.reactData.isActivated&&this.afterCheckValue()},renderNumberIcon:function(e){var t=this,n=t.computeIsDisabledAddNumber,i=t.computeIsDisabledSubtractNumber;return e("div",{class:"vxe-input--control-icon"},[e("div",{class:"vxe-input--number-icon"},[e("div",{class:["vxe-input--number-btn is--prev",{"is--disabled":n}],on:{mousedown:t.numberMousedownEvent,mouseup:t.numberStopDown,mouseleave:t.numberStopDown}},[e("i",{class:(0,_ui.getIcon)().NUMBER_INPUT_PREV_NUM})]),e("div",{class:["vxe-input--number-btn is--next",{"is--disabled":i}],on:{mousedown:t.numberMousedownEvent,mouseup:t.numberStopDown,mouseleave:t.numberStopDown}},[e("i",{class:(0,_ui.getIcon)().NUMBER_INPUT_NEXT_NUM})])])])},renderPrefixIcon:function(e){var t=this.$scopedSlots,n=this.prefixIcon,t=t.prefix;return t||n?e("div",{class:"vxe-number-input--prefix",on:{click:this.clickPrefixEvent}},[e("div",{class:"vxe-number-input--prefix-icon"},t?(0,_vn.getSlotVNs)(t({})):[e("i",{class:n})])]):null},renderSuffixIcon:function(e){var t=this,n=t.$scopedSlots,i=t.suffixIcon,u=t.reactData.inputValue,n=n.suffix,r=t.computeIsClearable;return e("div",{class:["vxe-number-input--suffix",{"is--clear":r&&!t.computeIsDisabled&&!(""===u||_xeUtils.default.eqNull(u))}]},[r?e("div",{class:"vxe-number-input--clear-icon",on:{click:t.clearValueEvent}},[e("i",{class:(0,_ui.getIcon)().INPUT_CLEAR})]):(0,_ui.renderEmptyElement)(t),t.renderExtraSuffixIcon(e),n||i?e("div",{class:"vxe-number-input--suffix-icon",on:{click:t.clickSuffixEvent}},n?(0,_vn.getSlotVNs)(n({})):[e("i",{class:i})]):(0,_ui.renderEmptyElement)(t)])},renderExtraSuffixIcon:function(e){return this.controls?this.renderNumberIcon(e):(0,_ui.renderEmptyElement)(this)},renderVN:function(e){var t,n,i,u,r,a,l=this,o=l.reactData,s=l.className,c=l.controls,m=l.type,p=l.align,d=l.name,f=l.autocomplete,v=l.autoComplete,h=o.inputValue,b=o.isFocus,o=o.isActivated,_=l.computeSize,y=l.computeIsDisabled,g=l.computeNumLabel;return l.computeFormReadonly?e("div",{ref:"refElem",class:["vxe-number-input--readonly","type--".concat(m),s]},g):(t=l.computeInputReadonly,n=l.computeInpMaxLength,i=l.computeInpPlaceholder,u=l.computeIsClearable,r=l.renderPrefixIcon(e),a=l.renderSuffixIcon(e),e("div",{ref:"refElem",class:["vxe-number-input","type--".concat(m),s,_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},"size--".concat(_),_),"is--".concat(p),p),"is--controls",c),"is--prefix",!!r),"is--suffix",!!a),"is--disabled",y),"is--active",o),"show--clear",u&&!y&&!(""===h||_xeUtils.default.eqNull(h)))],attrs:{spellcheck:!1}},[r||(0,_ui.renderEmptyElement)(l),e("div",{class:"vxe-number-input--wrapper"},[e("input",{ref:"refInputTarget",class:"vxe-number-input--inner",domProps:{value:b||"amount"!==m?h:g},attrs:{name:d,type:"text",placeholder:i,maxlength:n,readonly:t,disabled:y,autocomplete:v||f},on:{keydown:l.keydownEvent,keyup:l.keyupEvent,wheel:l.wheelEvent,click:l.clickEvent,input:l.inputEvent,change:l.changeEvent,focus:l.focusEvent,blur:l.blurEvent}})]),a||(0,_ui.renderEmptyElement)(l)]))}},watch:{value:function(e){var t=this.internalData;t.isUM||this.updateModel(e),t.isUM=!1},type:function(){var e=this.reactData;Object.assign(e,{inputValue:this.value}),this.initValue()}},created:function(){this.reactData.inputValue=this.value,this.initValue()},mounted:function(){var e=this;_ui.globalEvents.on(e,"mousedown",e.handleGlobalMousedownEvent),_ui.globalEvents.on(e,"keydown",e.handleGlobalKeydownEvent),_ui.globalEvents.on(e,"blur",e.handleGlobalBlurEvent)},beforeDestroy:function(){var e=this;e.reactData.isFocus=!1,e.numberStopDown(),e.afterCheckValue(),_ui.globalEvents.off(e,"mousedown"),_ui.globalEvents.off(e,"keydown"),_ui.globalEvents.off(e,"blur")},render:function(e){return this.renderVN(e)}});