vxe-table 3.4.12 → 3.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +3 -1
- package/README.md +3 -1
- package/README.zh-TW.md +3 -1
- package/lib/edit/src/mixin.js +9 -1
- package/lib/edit/src/mixin.min.js +1 -1
- package/lib/export/src/mixin.js +15 -10
- package/lib/export/src/mixin.min.js +1 -1
- package/lib/footer/src/footer.js +11 -0
- package/lib/footer/src/footer.min.js +1 -1
- package/lib/form/src/form.js +2 -1
- package/lib/form/src/form.min.js +1 -1
- package/lib/grid/src/grid.js +4 -1
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/header/src/header.js +12 -0
- package/lib/header/src/header.min.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.umd.js +99 -24
- package/lib/index.umd.min.js +1 -1
- package/lib/modal/src/modal.js +1 -1
- package/lib/modal/src/modal.min.js +1 -1
- package/lib/pulldown/src/pulldown.js +13 -0
- package/lib/pulldown/src/pulldown.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/src/body.js +24 -5
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/methods.js +11 -5
- package/lib/table/src/methods.min.js +1 -1
- package/lib/tools/src/utils.js +1 -0
- package/lib/tools/src/utils.min.js +1 -1
- package/package.json +4 -4
- package/packages/edit/src/mixin.js +1 -1
- package/packages/export/src/mixin.js +16 -9
- package/packages/footer/src/footer.js +10 -0
- package/packages/form/src/form.js +2 -1
- package/packages/grid/src/grid.js +2 -1
- package/packages/header/src/header.js +11 -0
- package/packages/modal/src/modal.js +1 -1
- package/packages/pulldown/src/pulldown.js +12 -0
- package/packages/table/src/body.js +41 -7
- package/packages/table/src/methods.js +5 -5
- package/packages/tools/src/utils.js +1 -0
- package/styles/button.scss +4 -4
- package/styles/modal.scss +14 -13
- package/styles/table.scss +4 -4
- package/styles/variable.scss +8 -0
package/lib/modal/src/modal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.msgQueue=exports.default=exports.allActivedModals=void 0;var _conf=_interopRequireDefault(require("../../v-x-e-table/src/conf")),_size=_interopRequireDefault(require("../../mixins/size")),_xeUtils=_interopRequireDefault(require("xe-utils")),_tools=require("../../tools");function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_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(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(o="Object"===o&&t.constructor?t.constructor.name:o)||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var o=0,i=new Array(e);o<e;o++)i[o]=t[o];return i}function _iterableToArrayLimit(t,e){var o=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=o){var i,n,s=[],l=!0,a=!1;try{for(o=o.call(t);!(l=(i=o.next()).done)&&(s.push(i.value),!e||s.length!==e);l=!0);}catch(t){a=!0,n=t}finally{try{l||null==o.return||o.return()}finally{if(a)throw n}}return s}}function _arrayWithHoles(t){if(Array.isArray(t))return t}function _defineProperty(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}var allActivedModals=[];exports.allActivedModals=allActivedModals;var msgQueue=[];exports.msgQueue=msgQueue;var _default2={name:"VxeModal",mixins:[_size.default],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 _conf.default.modal.top}},position:[String,Object],title:String,duration:{type:[Number,String],default:function(){return _conf.default.modal.duration}},message:[String,Function],content:[String,Function],cancelButtonText:{type:String,default:function(){return _conf.default.modal.cancelButtonText}},confirmButtonText:{type:String,default:function(){return _conf.default.modal.confirmButtonText}},lockView:{type:Boolean,default:function(){return _conf.default.modal.lockView}},lockScroll:Boolean,mask:{type:Boolean,default:function(){return _conf.default.modal.mask}},maskClosable:{type:Boolean,default:function(){return _conf.default.modal.maskClosable}},escClosable:{type:Boolean,default:function(){return _conf.default.modal.escClosable}},resize:{type:Boolean,default:function(){return _conf.default.modal.resize}},showHeader:{type:Boolean,default:function(){return _conf.default.modal.showHeader}},showFooter:{type:Boolean,default:function(){return _conf.default.modal.showFooter}},showZoom:{type:Boolean,default:null},showClose:{type:Boolean,default:function(){return _conf.default.modal.showClose}},dblclickZoom:{type:Boolean,default:function(){return _conf.default.modal.dblclickZoom}},width:[Number,String],height:[Number,String],minWidth:{type:[Number,String],default:function(){return _conf.default.modal.minWidth}},minHeight:{type:[Number,String],default:function(){return _conf.default.modal.minHeight}},zIndex:Number,marginSize:{type:[Number,String],default:function(){return _conf.default.modal.marginSize}},fullscreen:Boolean,draggable:{type:Boolean,default:function(){return _conf.default.modal.draggable}},remember:{type:Boolean,default:function(){return _conf.default.modal.remember}},destroyOnClose:{type:Boolean,default:function(){return _conf.default.modal.destroyOnClose}},showTitleOverflow:{type:Boolean,default:function(){return _conf.default.modal.showTitleOverflow}},transfer:{type:Boolean,default:function(){return _conf.default.modal.transfer}},storage:{type:Boolean,default:function(){return _conf.default.modal.storage}},storageKey:{type:String,default:function(){return _conf.default.modal.storageKey}},animat:{type:Boolean,default:function(){return _conf.default.modal.animat}},size:{type:String,default:function(){return _conf.default.modal.size||_conf.default.size}},beforeHideMethod:{type:Function,default:function(){return _conf.default.modal.beforeHideMethod}},slots:Object,events:Object},data:function(){return{inited:!1,visible:!1,contentVisible:!1,modalTop:0,modalZindex:0,zoomLocat:null,firstOpen:!1}},computed:{isMsg:function(){return"message"===this.type}},watch:{width:function(){this.recalculate()},height:function(){this.recalculate()},value:function(t){this[t?"open":"close"]("model")}},created:function(){this.storage&&!this.id&&_tools.UtilTools.error("vxe.error.reqProp",["modal.id"])},mounted:function(){var t=this.$listeners,e=this.events,o=void 0===e?{}:e;this.value&&this.open(),this.recalculate(),this.escClosable&&_tools.GlobalEvent.on(this,"keydown",this.handleGlobalKeydownEvent);e="inserted",e={type:e,$modal:this,$event:{type:e}};t.inserted?this.$emit("inserted",e):o.inserted&&o.inserted.call(this,e)},beforeDestroy:function(){var t=this.$el;_tools.GlobalEvent.off(this,"keydown"),this.removeMsgQueue(),t.parentNode===document.body&&t.parentNode.removeChild(t)},render:function(e){var o=this,t=this._e,i=this.$scopedSlots,n=this.slots,s=void 0===n?{}:n,l=this.inited,a=this.vSize,r=this.className,c=this.type,u=this.resize,d=this.showClose,f=this.showZoom,h=this.animat,m=this.draggable,p=this.loading,v=this.status,g=this.iconStatus,x=this.showFooter,y=this.zoomLocat,b=this.modalTop,_=this.dblclickZoom,w=this.contentVisible,S=this.visible,z=this.title,T=this.lockScroll,k=this.lockView,$=this.mask,B=this.isMsg,M=this.showTitleOverflow,N=this.destroyOnClose,O=this.content||this.message,L=i.default||s.default,P=i.footer||s.footer,n=i.header||s.header,i=i.title||s.title,s={};return m&&(s.mousedown=this.mousedownEvent),f&&_&&"modal"===c&&(s.dblclick=this.toggleZoomEvent),e("div",{class:["vxe-modal--wrapper","type--".concat(c),r||"",(_defineProperty(r={},"size--".concat(a),a),_defineProperty(r,"status--".concat(v),v),_defineProperty(r,"is--animat",h),_defineProperty(r,"lock--scroll",T),_defineProperty(r,"lock--view",k),_defineProperty(r,"is--resize",u),_defineProperty(r,"is--mask",$),_defineProperty(r,"is--maximize",y),_defineProperty(r,"is--visible",w),_defineProperty(r,"is--active",S),_defineProperty(r,"is--loading",p),r)],style:{zIndex:this.modalZindex,top:b?"".concat(b,"px"):null},on:{click:this.selfClickEvent}},[e("div",{class:"vxe-modal--box",on:{mousedown:this.boxMousedownEvent},ref:"modalBox"},[this.showHeader?e("div",{class:["vxe-modal--header",{"is--drag":m,"is--ellipsis":!B&&M}],on:s},n?!l||N&&!S?[]:n.call(this,{$modal:this},e):[i?i.call(this,{$modal:this},e):e("span",{class:"vxe-modal--title"},z?_tools.UtilTools.getFuncText(z):_conf.default.i18n("vxe.alert.title")),f?e("i",{class:["vxe-modal--zoom-btn","trigger--btn",y?_conf.default.icon.MODAL_ZOOM_OUT:_conf.default.icon.MODAL_ZOOM_IN],attrs:{title:_conf.default.i18n("vxe.modal.zoom".concat(y?"Out":"In"))},on:{click:this.toggleZoomEvent}}):t(),d?e("i",{class:["vxe-modal--close-btn","trigger--btn",_conf.default.icon.MODAL_CLOSE],attrs:{title:_conf.default.i18n("vxe.modal.close")},on:{click:this.closeEvent}}):t()]):null,e("div",{class:"vxe-modal--body"},[v?e("div",{class:"vxe-modal--status-wrapper"},[e("i",{class:["vxe-modal--status-icon",g||_conf.default.icon["MODAL_".concat(v).toLocaleUpperCase()]]})]):null,e("div",{class:"vxe-modal--content"},L?!l||N&&!S?[]:L.call(this,{$modal:this},e):_tools.UtilTools.getFuncText(O)),B?null:e("div",{class:["vxe-loading",{"is--visible":p}]},[e("div",{class:"vxe-loading--spinner"})])]),x?e("div",{class:"vxe-modal--footer"},P?!l||N&&!S?[]:P.call(this,{$modal:this},e):["confirm"===c?e("vxe-button",{ref:"cancelBtn",on:{click:this.cancelEvent}},this.cancelButtonText||_conf.default.i18n("vxe.button.cancel")):null,e("vxe-button",{ref:"confirmBtn",props:{status:"primary"},on:{click:this.confirmEvent}},this.confirmButtonText||_conf.default.i18n("vxe.button.confirm"))]):null,!B&&u?e("span",{class:"vxe-modal--resize"},["wl","wr","swst","sest","st","swlb","selb","sb"].map(function(t){return e("span",{class:"".concat(t,"-resize"),attrs:{type:t},on:{mousedown:o.dragEvent}})})):null])])},methods:{recalculate:function(){var t=this.width,e=this.height,o=this.getBox();return o.style.width=t?isNaN(t)?t:"".concat(t,"px"):null,o.style.height=e?isNaN(e)?e:"".concat(e,"px"):null,this.$nextTick()},selfClickEvent:function(t){this.maskClosable&&t.target===this.$el&&this.close("mask")},updateZindex:function(){var t=this.zIndex,e=this.modalZindex;t?this.modalZindex=t:e<_tools.UtilTools.getLastZIndex()&&(this.modalZindex=_tools.UtilTools.nextZIndex())},closeEvent:function(t){var e=this.events,o=void 0===e?{}:e,e="close",t={type:e,$modal:this,$event:t};o[e]?o[e].call(this,t):this.$emit(e,t),this.close(e)},confirmEvent:function(t){var e=this.events,o=void 0===e?{}:e,e="confirm",t={type:e,$modal:this,$event:t};o[e]?o[e].call(this,t):this.$emit(e,t),this.close(e)},cancelEvent:function(t){var e=this.events,o=void 0===e?{}:e,e="cancel",t={type:e,$modal:this,$event:t};o[e]?o[e].call(this,t):this.$emit(e,t),this.close(e)},open:function(){var o=this,e=this.$refs,t=this.events,i=void 0===t?{}:t,n=this.inited,s=this.duration,l=this.visible,t=this.isMsg,a=this.remember,r=this.showFooter;n||(this.inited=!0,this.transfer&&document.body.appendChild(this.$el)),l||(a||this.recalculate(),this.visible=!0,this.contentVisible=!1,this.updateZindex(),allActivedModals.push(this),setTimeout(function(){o.contentVisible=!0,o.$nextTick(function(){!r||(t=e.confirmBtn||e.cancelBtn)&&t.focus();var t={type:"",$modal:o};i.show?i.show.call(o,t):(o.$emit("input",!0),o.$emit("show",t))})},10),t?(this.addMsgQueue(),-1!==s&&setTimeout(function(){return o.close("close")},_xeUtils.default.toNumber(s))):this.$nextTick(function(){var t=o.firstOpen,e=o.fullscreen;a&&t||o.updatePosition().then(function(){setTimeout(function(){return o.updatePosition()},20)}),t||(o.firstOpen=!0,o.hasPosStorage()?o.restorePosStorage():e&&o.$nextTick(function(){return o.maximize()}))}))},addMsgQueue:function(){-1===msgQueue.indexOf(this)&&msgQueue.push(this),this.updateStyle()},removeMsgQueue:function(){var e=this;-1<msgQueue.indexOf(this)&&_xeUtils.default.remove(msgQueue,function(t){return t===e}),this.updateStyle()},updateStyle:function(){this.$nextTick(function(){var e=0;msgQueue.forEach(function(t){e+=_xeUtils.default.toNumber(t.top),t.modalTop=e,e+=t.$refs.modalBox.clientHeight})})},updatePosition:function(){var u=this;return this.$nextTick().then(function(){var t=u.marginSize,e=u.position,o=u.getBox(),i=document.documentElement.clientWidth||document.body.clientWidth,n=document.documentElement.clientHeight||document.body.clientHeight,s="center"===e,l=s?{top:e,left:e}:Object.assign({},e),a=l.top,r=l.left,c=s||"center"===a,e="",l="",l=r&&!(s||"center"===r)?isNaN(r)?r:"".concat(r,"px"):"".concat(Math.max(t,i/2-o.offsetWidth/2),"px"),e=a&&!c?isNaN(a)?a:"".concat(a,"px"):"".concat(Math.max(t,n/2-o.offsetHeight/2),"px");o.style.top=e,o.style.left=l})},close:function(t){var e=this,o=this.events,i=void 0===o?{}:o,n=this.remember,s=this.visible,l=this.isMsg,o=this.beforeHideMethod,a={type:t,$modal:this};s&&Promise.resolve(o?o(a):null).then(function(t){_xeUtils.default.isError(t)||(l&&e.removeMsgQueue(),e.contentVisible=!1,n||(e.zoomLocat=null),_xeUtils.default.remove(allActivedModals,function(t){return t===e}),e.$emit("before-hide",a),setTimeout(function(){e.visible=!1,i.hide?i.hide.call(e,a):(e.$emit("input",!1),e.$emit("hide",a))},200))}).catch(function(t){return t})},handleGlobalKeydownEvent:function(t){var e,o=this;27===t.keyCode&&((e=_xeUtils.default.max(allActivedModals,function(t){return t.modalZindex}))&&setTimeout(function(){e===o&&e.escClosable&&o.close("exit")},10))},getBox:function(){return this.$refs.modalBox},isMaximized:function(){return!!this.zoomLocat},maximize:function(){var n=this;return this.$nextTick().then(function(){var t,e,o,i;n.zoomLocat||(t=n.marginSize,e=n.getBox(),o=(i=_tools.DomTools.getDomNode()).visibleHeight,i=i.visibleWidth,n.zoomLocat={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:"".concat(t,"px"),left:"".concat(t,"px"),width:"".concat(i-2*t,"px"),height:"".concat(o-2*t,"px")}),n.savePosStorage())})},revert:function(){var o=this;return this.$nextTick().then(function(){var t,e=o.zoomLocat;e&&(t=o.getBox(),o.zoomLocat=null,Object.assign(t.style,{top:"".concat(e.top,"px"),left:"".concat(e.left,"px"),width:"".concat(e.width,"px"),height:"".concat(e.height,"px")}),o.savePosStorage())})},zoom:function(){var t=this;return this[this.zoomLocat?"revert":"maximize"]().then(function(){return t.isMaximized()})},toggleZoomEvent:function(t){var e=this,o=this.$listeners,i=this.zoomLocat,n=this.events,s=void 0===n?{}:n,l={type:i?"revert":"max",$modal:this,$event:t};return this.zoom().then(function(){o.zoom?e.$emit("zoom",l):s.zoom&&s.zoom.call(e,l)})},getPosition:function(){if(!this.isMsg){var t=this.getBox();if(t)return{top:t.offsetTop,left:t.offsetLeft}}return null},setPosition:function(t,e){var o;return this.isMsg||(o=this.getBox(),_xeUtils.default.isNumber(t)&&(o.style.top="".concat(t,"px")),_xeUtils.default.isNumber(e)&&(o.style.left="".concat(e,"px"))),this.$nextTick()},boxMousedownEvent:function(){var e=this.modalZindex;allActivedModals.some(function(t){return t.visible&&t.modalZindex>e})&&this.updateZindex()},mousedownEvent:function(t){var e,o,n,s,l,a,i=this,r=this.remember,c=this.storage,u=this.marginSize,d=this.zoomLocat,f=this.getBox();d||0!==t.button||_tools.DomTools.getEventTargetNode(t,f,"trigger--btn").flag||(t.preventDefault(),e=document.onmousemove,o=document.onmouseup,n=t.clientX-f.offsetLeft,s=t.clientY-f.offsetTop,t=_tools.DomTools.getDomNode(),l=t.visibleHeight,a=t.visibleWidth,document.onmousemove=function(t){t.preventDefault();var e=f.offsetWidth,o=f.offsetHeight,i=a-e-u-1,e=l-o-u-1,o=t.clientX-n,t=t.clientY-s;(t=e<t?e:t)<u&&(t=u),f.style.left="".concat(o=(o=i<o?i:o)<u?u:o,"px"),f.style.top="".concat(t,"px")},document.onmouseup=function(){document.onmousemove=e,document.onmouseup=o,r&&c&&i.$nextTick(function(){i.savePosStorage()})})},dragEvent:function(t){var s=this;t.preventDefault();var l=this.$listeners,a=this.marginSize,e=this.events,r=void 0===e?{}:e,c=this.remember,u=this.storage,e=_tools.DomTools.getDomNode(),d=e.visibleHeight,f=e.visibleWidth,h=t.target.getAttribute("type"),m=_xeUtils.default.toNumber(this.minWidth),p=_xeUtils.default.toNumber(this.minHeight),v=f,g=d,x=this.getBox(),o=document.onmousemove,i=document.onmouseup,y=x.clientWidth,b=x.clientHeight,_=t.clientX,w=t.clientY,S=x.offsetTop,z=x.offsetLeft,T={type:"resize",$modal:this};document.onmousemove=function(t){var e,o,i,n;switch(t.preventDefault(),h){case"wl":i=(e=_-t.clientX)+y,a<z-e&&m<i&&(x.style.width="".concat(i<v?i:v,"px"),x.style.left="".concat(z-e,"px"));break;case"swst":e=_-t.clientX,o=w-t.clientY,i=e+y,n=o+b,a<z-e&&m<i&&(x.style.width="".concat(i<v?i:v,"px"),x.style.left="".concat(z-e,"px")),a<S-o&&p<n&&(x.style.height="".concat(n<g?n:g,"px"),x.style.top="".concat(S-o,"px"));break;case"swlb":e=_-t.clientX,o=t.clientY-w,i=e+y,n=o+b,a<z-e&&m<i&&(x.style.width="".concat(i<v?i:v,"px"),x.style.left="".concat(z-e,"px")),S+n+a<d&&p<n&&(x.style.height="".concat(n<g?n:g,"px"));break;case"st":o=w-t.clientY,n=b+o,a<S-o&&p<n&&(x.style.height="".concat(n<g?n:g,"px"),x.style.top="".concat(S-o,"px"));break;case"wr":e=t.clientX-_,z+(i=e+y)+a<f&&m<i&&(x.style.width="".concat(i<v?i:v,"px"));break;case"sest":e=t.clientX-_,n=(o=w-t.clientY)+b,z+(i=e+y)+a<f&&m<i&&(x.style.width="".concat(i<v?i:v,"px")),a<S-o&&p<n&&(x.style.height="".concat(n<g?n:g,"px"),x.style.top="".concat(S-o,"px"));break;case"selb":e=t.clientX-_,n=(o=t.clientY-w)+b,z+(i=e+y)+a<f&&m<i&&(x.style.width="".concat(i<v?i:v,"px")),S+n+a<d&&p<n&&(x.style.height="".concat(n<g?n:g,"px"));break;case"sb":o=t.clientY-w,S+(n=o+b)+a<d&&p<n&&(x.style.height="".concat(n<g?n:g,"px"))}x.className=x.className.replace(/\s?is--drag/,"")+" is--drag",c&&u&&s.savePosStorage(),l.zoom?s.$emit("zoom",T):r.zoom&&r.zoom.call(s,T)},document.onmouseup=function(){s.zoomLocat=null,document.onmousemove=o,document.onmouseup=i,setTimeout(function(){x.className=x.className.replace(/\s?is--drag/,"")},50)}},getStorageMap:function(t){var e=_conf.default.version,t=_xeUtils.default.toStringJSON(localStorage.getItem(t));return t&&t._v===e?t:{_v:e}},hasPosStorage:function(){var t=this.id,e=this.remember,o=this.storage,i=this.storageKey;return!!(e&&o&&this.getStorageMap(i)[t])},restorePosStorage:function(){var t,e,o,i,n,s=this.id,l=this.remember,a=this.storage,r=this.storageKey;l&&a&&((i=this.getStorageMap(r)[s])&&(t=this.getBox(),e=(n=_slicedToArray(i.split(","),8))[0],o=n[1],l=n[2],a=n[3],r=n[4],s=n[5],i=n[6],n=n[7],e&&(t.style.left="".concat(e,"px")),o&&(t.style.top="".concat(o,"px")),l&&(t.style.width="".concat(l,"px")),a&&(t.style.height="".concat(a,"px")),r&&s&&(this.zoomLocat={left:r,top:s,width:i,height:n})))},savePosStorage:function(){var t=this.id,e=this.remember,o=this.storage,i=this.storageKey,n=this.zoomLocat;e&&o&&(e=this.getBox(),(o=this.getStorageMap(i))[t]=[e.style.left,e.style.top,e.style.width,e.style.height].concat(n?[n.left,n.top,n.width,n.height]:[]).map(function(t){return t?_xeUtils.default.toNumber(t):""}).join(","),localStorage.setItem(i,_xeUtils.default.toJSONString(o)))}}};exports.default=_default2;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.msgQueue=exports.default=exports.allActivedModals=void 0;var _conf=_interopRequireDefault(require("../../v-x-e-table/src/conf")),_size=_interopRequireDefault(require("../../mixins/size")),_xeUtils=_interopRequireDefault(require("xe-utils")),_tools=require("../../tools");function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_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(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(o="Object"===o&&t.constructor?t.constructor.name:o)||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var o=0,i=new Array(e);o<e;o++)i[o]=t[o];return i}function _iterableToArrayLimit(t,e){var o=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=o){var i,n,s=[],l=!0,a=!1;try{for(o=o.call(t);!(l=(i=o.next()).done)&&(s.push(i.value),!e||s.length!==e);l=!0);}catch(t){a=!0,n=t}finally{try{l||null==o.return||o.return()}finally{if(a)throw n}}return s}}function _arrayWithHoles(t){if(Array.isArray(t))return t}function _defineProperty(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}var allActivedModals=[];exports.allActivedModals=allActivedModals;var msgQueue=[];exports.msgQueue=msgQueue;var _default2={name:"VxeModal",mixins:[_size.default],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 _conf.default.modal.top}},position:[String,Object],title:String,duration:{type:[Number,String],default:function(){return _conf.default.modal.duration}},message:[String,Function],content:[String,Function],cancelButtonText:{type:String,default:function(){return _conf.default.modal.cancelButtonText}},confirmButtonText:{type:String,default:function(){return _conf.default.modal.confirmButtonText}},lockView:{type:Boolean,default:function(){return _conf.default.modal.lockView}},lockScroll:Boolean,mask:{type:Boolean,default:function(){return _conf.default.modal.mask}},maskClosable:{type:Boolean,default:function(){return _conf.default.modal.maskClosable}},escClosable:{type:Boolean,default:function(){return _conf.default.modal.escClosable}},resize:{type:Boolean,default:function(){return _conf.default.modal.resize}},showHeader:{type:Boolean,default:function(){return _conf.default.modal.showHeader}},showFooter:{type:Boolean,default:function(){return _conf.default.modal.showFooter}},showZoom:{type:Boolean,default:null},showClose:{type:Boolean,default:function(){return _conf.default.modal.showClose}},dblclickZoom:{type:Boolean,default:function(){return _conf.default.modal.dblclickZoom}},width:[Number,String],height:[Number,String],minWidth:{type:[Number,String],default:function(){return _conf.default.modal.minWidth}},minHeight:{type:[Number,String],default:function(){return _conf.default.modal.minHeight}},zIndex:Number,marginSize:{type:[Number,String],default:function(){return _conf.default.modal.marginSize}},fullscreen:Boolean,draggable:{type:Boolean,default:function(){return _conf.default.modal.draggable}},remember:{type:Boolean,default:function(){return _conf.default.modal.remember}},destroyOnClose:{type:Boolean,default:function(){return _conf.default.modal.destroyOnClose}},showTitleOverflow:{type:Boolean,default:function(){return _conf.default.modal.showTitleOverflow}},transfer:{type:Boolean,default:function(){return _conf.default.modal.transfer}},storage:{type:Boolean,default:function(){return _conf.default.modal.storage}},storageKey:{type:String,default:function(){return _conf.default.modal.storageKey}},animat:{type:Boolean,default:function(){return _conf.default.modal.animat}},size:{type:String,default:function(){return _conf.default.modal.size||_conf.default.size}},beforeHideMethod:{type:Function,default:function(){return _conf.default.modal.beforeHideMethod}},slots:Object,events:Object},data:function(){return{inited:!1,visible:!1,contentVisible:!1,modalTop:0,modalZindex:0,zoomLocat:null,firstOpen:!1}},computed:{isMsg:function(){return"message"===this.type}},watch:{width:function(){this.recalculate()},height:function(){this.recalculate()},value:function(t){this[t?"open":"close"]("model")}},created:function(){this.storage&&!this.id&&_tools.UtilTools.error("vxe.error.reqProp",["modal.id"])},mounted:function(){var t=this.$listeners,e=this.events,o=void 0===e?{}:e;this.value&&this.open(),this.recalculate(),this.escClosable&&_tools.GlobalEvent.on(this,"keydown",this.handleGlobalKeydownEvent);e="inserted",e={type:e,$modal:this,$event:{type:e}};t.inserted?this.$emit("inserted",e):o.inserted&&o.inserted.call(this,e)},beforeDestroy:function(){var t=this.$el;_tools.GlobalEvent.off(this,"keydown"),this.removeMsgQueue(),t.parentNode===document.body&&t.parentNode.removeChild(t)},render:function(e){var o=this,t=this._e,i=this.$scopedSlots,n=this.slots,s=void 0===n?{}:n,l=this.inited,a=this.vSize,r=this.className,c=this.type,u=this.resize,d=this.showClose,f=this.showZoom,h=this.animat,m=this.draggable,p=this.loading,v=this.status,g=this.iconStatus,x=this.showFooter,y=this.zoomLocat,b=this.modalTop,_=this.dblclickZoom,w=this.contentVisible,S=this.visible,z=this.title,T=this.lockScroll,k=this.lockView,$=this.mask,B=this.isMsg,M=this.showTitleOverflow,N=this.destroyOnClose,O=this.content||this.message,L=i.default||s.default,P=i.footer||s.footer,n=i.header||s.header,i=i.title||s.title,s={};return m&&(s.mousedown=this.mousedownEvent),f&&_&&"modal"===c&&(s.dblclick=this.toggleZoomEvent),e("div",{class:["vxe-modal--wrapper","type--".concat(c),r||"",(_defineProperty(r={},"size--".concat(a),a),_defineProperty(r,"status--".concat(v),v),_defineProperty(r,"is--animat",h),_defineProperty(r,"lock--scroll",T),_defineProperty(r,"lock--view",k),_defineProperty(r,"is--resize",u),_defineProperty(r,"is--mask",$),_defineProperty(r,"is--maximize",y),_defineProperty(r,"is--visible",w),_defineProperty(r,"is--active",S),_defineProperty(r,"is--loading",p),r)],style:{zIndex:this.modalZindex,top:b?"".concat(b,"px"):null},on:{click:this.selfClickEvent}},[e("div",{class:"vxe-modal--box",on:{mousedown:this.boxMousedownEvent},ref:"modalBox"},[this.showHeader?e("div",{class:["vxe-modal--header",{"is--drag":m,"is--ellipsis":!B&&M}],on:s},n?!l||N&&!S?[]:n.call(this,{$modal:this},e):[i?i.call(this,{$modal:this},e):e("span",{class:"vxe-modal--title"},z?_tools.UtilTools.getFuncText(z):_conf.default.i18n("vxe.alert.title")),f?e("i",{class:["vxe-modal--zoom-btn","trigger--btn",y?_conf.default.icon.MODAL_ZOOM_OUT:_conf.default.icon.MODAL_ZOOM_IN],attrs:{title:_conf.default.i18n("vxe.modal.zoom".concat(y?"Out":"In"))},on:{click:this.toggleZoomEvent}}):t(),d?e("i",{class:["vxe-modal--close-btn","trigger--btn",_conf.default.icon.MODAL_CLOSE],attrs:{title:_conf.default.i18n("vxe.modal.close")},on:{click:this.closeEvent}}):t()]):null,e("div",{class:"vxe-modal--body"},[v?e("div",{class:"vxe-modal--status-wrapper"},[e("i",{class:["vxe-modal--status-icon",g||_conf.default.icon["MODAL_".concat(v).toLocaleUpperCase()]]})]):null,e("div",{class:"vxe-modal--content"},L?!l||N&&!S?[]:L.call(this,{$modal:this},e):_tools.UtilTools.getFuncText(O)),B?null:e("div",{class:["vxe-loading",{"is--visible":p}]},[e("div",{class:"vxe-loading--spinner"})])]),x?e("div",{class:"vxe-modal--footer"},P?!l||N&&!S?[]:P.call(this,{$modal:this},e):["confirm"===c?e("vxe-button",{ref:"cancelBtn",on:{click:this.cancelEvent}},this.cancelButtonText||_conf.default.i18n("vxe.button.cancel")):null,e("vxe-button",{ref:"confirmBtn",props:{status:"primary"},on:{click:this.confirmEvent}},this.confirmButtonText||_conf.default.i18n("vxe.button.confirm"))]):null,!B&&u?e("span",{class:"vxe-modal--resize"},["wl","wr","swst","sest","st","swlb","selb","sb"].map(function(t){return e("span",{class:"".concat(t,"-resize"),attrs:{type:t},on:{mousedown:o.dragEvent}})})):null])])},methods:{recalculate:function(){var t=this.width,e=this.height,o=this.getBox();return o.style.width=t?isNaN(t)?t:"".concat(t,"px"):null,o.style.height=e?isNaN(e)?e:"".concat(e,"px"):null,this.$nextTick()},selfClickEvent:function(t){this.maskClosable&&t.target===this.$el&&this.close("mask")},updateZindex:function(){var t=this.zIndex,e=this.modalZindex;t?this.modalZindex=t:e<_tools.UtilTools.getLastZIndex()&&(this.modalZindex=_tools.UtilTools.nextZIndex())},closeEvent:function(t){var e=this.events,o=void 0===e?{}:e,e="close",t={type:e,$modal:this,$event:t};o[e]?o[e].call(this,t):this.$emit(e,t),this.close(e)},confirmEvent:function(t){var e=this.events,o=void 0===e?{}:e,e="confirm",t={type:e,$modal:this,$event:t};o[e]?o[e].call(this,t):this.$emit(e,t),this.close(e)},cancelEvent:function(t){var e=this.events,o=void 0===e?{}:e,e="cancel",t={type:e,$modal:this,$event:t};o[e]?o[e].call(this,t):this.$emit(e,t),this.close(e)},open:function(){var o=this,e=this.$refs,t=this.events,i=void 0===t?{}:t,n=this.inited,s=this.duration,l=this.visible,t=this.isMsg,a=this.remember,r=this.showFooter;n||(this.inited=!0,this.transfer&&document.body.appendChild(this.$el)),l||(a||this.recalculate(),this.visible=!0,this.contentVisible=!1,this.updateZindex(),allActivedModals.push(this),setTimeout(function(){o.contentVisible=!0,o.$nextTick(function(){!r||(t=e.confirmBtn||e.cancelBtn)&&t.focus();var t={type:"",$modal:o};i.show?i.show.call(o,t):(o.$emit("input",!0),o.$emit("show",t))})},10),t?(this.addMsgQueue(),-1!==s&&setTimeout(function(){return o.close("close")},_xeUtils.default.toNumber(s))):this.$nextTick(function(){var t=o.firstOpen,e=o.fullscreen;a&&t||o.updatePosition().then(function(){setTimeout(function(){return o.updatePosition()},20)}),t||(o.firstOpen=!0,o.hasPosStorage()?o.restorePosStorage():e&&o.$nextTick(function(){return o.maximize()}))}))},addMsgQueue:function(){-1===msgQueue.indexOf(this)&&msgQueue.push(this),this.updateStyle()},removeMsgQueue:function(){var e=this;-1<msgQueue.indexOf(this)&&_xeUtils.default.remove(msgQueue,function(t){return t===e}),this.updateStyle()},updateStyle:function(){this.$nextTick(function(){var e=0;msgQueue.forEach(function(t){e+=_xeUtils.default.toNumber(t.top),t.modalTop=e,e+=t.$refs.modalBox.clientHeight})})},updatePosition:function(){var u=this;return this.$nextTick().then(function(){var t=u.marginSize,e=u.position,o=u.getBox(),i=document.documentElement.clientWidth||document.body.clientWidth,n=document.documentElement.clientHeight||document.body.clientHeight,s="center"===e,l=s?{top:e,left:e}:Object.assign({},e),a=l.top,r=l.left,c=s||"center"===a,e="",l="",l=r&&!(s||"center"===r)?isNaN(r)?r:"".concat(r,"px"):"".concat(Math.max(t,i/2-o.offsetWidth/2),"px"),e=a&&!c?isNaN(a)?a:"".concat(a,"px"):"".concat(Math.max(t,n/2-o.offsetHeight/2),"px");o.style.top=e,o.style.left=l})},close:function(t){var e=this,o=this.events,i=void 0===o?{}:o,n=this.remember,s=this.visible,l=this.isMsg,o=this.beforeHideMethod,a={type:t,$modal:this};s&&Promise.resolve(o?o(a):null).then(function(t){_xeUtils.default.isError(t)||(l&&e.removeMsgQueue(),e.contentVisible=!1,n||(e.zoomLocat=null),_xeUtils.default.remove(allActivedModals,function(t){return t===e}),e.$emit("before-hide",a),setTimeout(function(){e.visible=!1,i.hide?i.hide.call(e,a):(e.$emit("input",!1),e.$emit("hide",a))},200))}).catch(function(t){return t})},handleGlobalKeydownEvent:function(t){var e,o=this;27===t.keyCode&&((e=_xeUtils.default.max(allActivedModals,function(t){return t.modalZindex}))&&setTimeout(function(){e===o&&e.escClosable&&o.close("exit")},10))},getBox:function(){return this.$refs.modalBox},isMaximized:function(){return!!this.zoomLocat},maximize:function(){var n=this;return this.$nextTick().then(function(){var t,e,o,i;n.zoomLocat||(t=Math.max(0,n.marginSize),e=n.getBox(),o=(i=_tools.DomTools.getDomNode()).visibleHeight,i=i.visibleWidth,n.zoomLocat={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:"".concat(t,"px"),left:"".concat(t,"px"),width:"".concat(i-2*t,"px"),height:"".concat(o-2*t,"px")}),n.savePosStorage())})},revert:function(){var o=this;return this.$nextTick().then(function(){var t,e=o.zoomLocat;e&&(t=o.getBox(),o.zoomLocat=null,Object.assign(t.style,{top:"".concat(e.top,"px"),left:"".concat(e.left,"px"),width:"".concat(e.width,"px"),height:"".concat(e.height,"px")}),o.savePosStorage())})},zoom:function(){var t=this;return this[this.zoomLocat?"revert":"maximize"]().then(function(){return t.isMaximized()})},toggleZoomEvent:function(t){var e=this,o=this.$listeners,i=this.zoomLocat,n=this.events,s=void 0===n?{}:n,l={type:i?"revert":"max",$modal:this,$event:t};return this.zoom().then(function(){o.zoom?e.$emit("zoom",l):s.zoom&&s.zoom.call(e,l)})},getPosition:function(){if(!this.isMsg){var t=this.getBox();if(t)return{top:t.offsetTop,left:t.offsetLeft}}return null},setPosition:function(t,e){var o;return this.isMsg||(o=this.getBox(),_xeUtils.default.isNumber(t)&&(o.style.top="".concat(t,"px")),_xeUtils.default.isNumber(e)&&(o.style.left="".concat(e,"px"))),this.$nextTick()},boxMousedownEvent:function(){var e=this.modalZindex;allActivedModals.some(function(t){return t.visible&&t.modalZindex>e})&&this.updateZindex()},mousedownEvent:function(t){var e,o,n,s,l,a,i=this,r=this.remember,c=this.storage,u=this.marginSize,d=this.zoomLocat,f=this.getBox();d||0!==t.button||_tools.DomTools.getEventTargetNode(t,f,"trigger--btn").flag||(t.preventDefault(),e=document.onmousemove,o=document.onmouseup,n=t.clientX-f.offsetLeft,s=t.clientY-f.offsetTop,t=_tools.DomTools.getDomNode(),l=t.visibleHeight,a=t.visibleWidth,document.onmousemove=function(t){t.preventDefault();var e=f.offsetWidth,o=f.offsetHeight,i=a-e-u-1,e=l-o-u-1,o=t.clientX-n,t=t.clientY-s;(t=e<t?e:t)<u&&(t=u),f.style.left="".concat(o=(o=i<o?i:o)<u?u:o,"px"),f.style.top="".concat(t,"px")},document.onmouseup=function(){document.onmousemove=e,document.onmouseup=o,r&&c&&i.$nextTick(function(){i.savePosStorage()})})},dragEvent:function(t){var s=this;t.preventDefault();var l=this.$listeners,a=this.marginSize,e=this.events,r=void 0===e?{}:e,c=this.remember,u=this.storage,e=_tools.DomTools.getDomNode(),d=e.visibleHeight,f=e.visibleWidth,h=t.target.getAttribute("type"),m=_xeUtils.default.toNumber(this.minWidth),p=_xeUtils.default.toNumber(this.minHeight),v=f,g=d,x=this.getBox(),o=document.onmousemove,i=document.onmouseup,y=x.clientWidth,b=x.clientHeight,_=t.clientX,w=t.clientY,S=x.offsetTop,z=x.offsetLeft,T={type:"resize",$modal:this};document.onmousemove=function(t){var e,o,i,n;switch(t.preventDefault(),h){case"wl":i=(e=_-t.clientX)+y,a<z-e&&m<i&&(x.style.width="".concat(i<v?i:v,"px"),x.style.left="".concat(z-e,"px"));break;case"swst":e=_-t.clientX,o=w-t.clientY,i=e+y,n=o+b,a<z-e&&m<i&&(x.style.width="".concat(i<v?i:v,"px"),x.style.left="".concat(z-e,"px")),a<S-o&&p<n&&(x.style.height="".concat(n<g?n:g,"px"),x.style.top="".concat(S-o,"px"));break;case"swlb":e=_-t.clientX,o=t.clientY-w,i=e+y,n=o+b,a<z-e&&m<i&&(x.style.width="".concat(i<v?i:v,"px"),x.style.left="".concat(z-e,"px")),S+n+a<d&&p<n&&(x.style.height="".concat(n<g?n:g,"px"));break;case"st":o=w-t.clientY,n=b+o,a<S-o&&p<n&&(x.style.height="".concat(n<g?n:g,"px"),x.style.top="".concat(S-o,"px"));break;case"wr":e=t.clientX-_,z+(i=e+y)+a<f&&m<i&&(x.style.width="".concat(i<v?i:v,"px"));break;case"sest":e=t.clientX-_,n=(o=w-t.clientY)+b,z+(i=e+y)+a<f&&m<i&&(x.style.width="".concat(i<v?i:v,"px")),a<S-o&&p<n&&(x.style.height="".concat(n<g?n:g,"px"),x.style.top="".concat(S-o,"px"));break;case"selb":e=t.clientX-_,n=(o=t.clientY-w)+b,z+(i=e+y)+a<f&&m<i&&(x.style.width="".concat(i<v?i:v,"px")),S+n+a<d&&p<n&&(x.style.height="".concat(n<g?n:g,"px"));break;case"sb":o=t.clientY-w,S+(n=o+b)+a<d&&p<n&&(x.style.height="".concat(n<g?n:g,"px"))}x.className=x.className.replace(/\s?is--drag/,"")+" is--drag",c&&u&&s.savePosStorage(),l.zoom?s.$emit("zoom",T):r.zoom&&r.zoom.call(s,T)},document.onmouseup=function(){s.zoomLocat=null,document.onmousemove=o,document.onmouseup=i,setTimeout(function(){x.className=x.className.replace(/\s?is--drag/,"")},50)}},getStorageMap:function(t){var e=_conf.default.version,t=_xeUtils.default.toStringJSON(localStorage.getItem(t));return t&&t._v===e?t:{_v:e}},hasPosStorage:function(){var t=this.id,e=this.remember,o=this.storage,i=this.storageKey;return!!(e&&o&&this.getStorageMap(i)[t])},restorePosStorage:function(){var t,e,o,i,n,s=this.id,l=this.remember,a=this.storage,r=this.storageKey;l&&a&&((i=this.getStorageMap(r)[s])&&(t=this.getBox(),e=(n=_slicedToArray(i.split(","),8))[0],o=n[1],l=n[2],a=n[3],r=n[4],s=n[5],i=n[6],n=n[7],e&&(t.style.left="".concat(e,"px")),o&&(t.style.top="".concat(o,"px")),l&&(t.style.width="".concat(l,"px")),a&&(t.style.height="".concat(a,"px")),r&&s&&(this.zoomLocat={left:r,top:s,width:i,height:n})))},savePosStorage:function(){var t=this.id,e=this.remember,o=this.storage,i=this.storageKey,n=this.zoomLocat;e&&o&&(e=this.getBox(),(o=this.getStorageMap(i))[t]=[e.style.left,e.style.top,e.style.width,e.style.height].concat(n?[n.left,n.top,n.width,n.height]:[]).map(function(t){return t?_xeUtils.default.toNumber(t):""}).join(","),localStorage.setItem(i,_xeUtils.default.toJSONString(o)))}}};exports.default=_default2;
|
|
@@ -19,6 +19,7 @@ var _default2 = {
|
|
|
19
19
|
name: 'VxePulldown',
|
|
20
20
|
mixins: [_size.default],
|
|
21
21
|
props: {
|
|
22
|
+
value: Boolean,
|
|
22
23
|
disabled: Boolean,
|
|
23
24
|
placement: String,
|
|
24
25
|
size: {
|
|
@@ -42,6 +43,15 @@ var _default2 = {
|
|
|
42
43
|
isActivated: false
|
|
43
44
|
};
|
|
44
45
|
},
|
|
46
|
+
watch: {
|
|
47
|
+
value: function value(_value) {
|
|
48
|
+
if (_value) {
|
|
49
|
+
this.showPanel();
|
|
50
|
+
} else {
|
|
51
|
+
this.hidePanel();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
45
55
|
created: function created() {
|
|
46
56
|
_tools.GlobalEvent.on(this, 'mousewheel', this.handleGlobalMousewheelEvent);
|
|
47
57
|
|
|
@@ -186,6 +196,8 @@ var _default2 = {
|
|
|
186
196
|
setTimeout(function () {
|
|
187
197
|
_this.visiblePanel = true;
|
|
188
198
|
|
|
199
|
+
_this.$emit('update:input', true);
|
|
200
|
+
|
|
189
201
|
_this.updatePlacement();
|
|
190
202
|
|
|
191
203
|
setTimeout(function () {
|
|
@@ -207,6 +219,7 @@ var _default2 = {
|
|
|
207
219
|
var _this2 = this;
|
|
208
220
|
|
|
209
221
|
this.visiblePanel = false;
|
|
222
|
+
this.$emit('update:input', false);
|
|
210
223
|
return new Promise(function (resolve) {
|
|
211
224
|
if (_this2.animatVisible) {
|
|
212
225
|
_this2.hidePanelTimeout = setTimeout(function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _conf=_interopRequireDefault(require("../../v-x-e-table/src/conf")),_size=_interopRequireDefault(require("../../mixins/size")),_tools=require("../../tools");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var _default2={name:"VxePulldown",mixins:[_size.default],props:{disabled:Boolean,placement:String,size:{type:String,default:function(){return _conf.default.size}},destroyOnClose:Boolean,transfer:Boolean},data:function(){return{inited:!1,panelIndex:0,panelStyle:null,panelPlacement:null,currentValue:null,visiblePanel:!1,animatVisible:!1,isActivated:!1}},created:function(){_tools.GlobalEvent.on(this,"mousewheel",this.handleGlobalMousewheelEvent),_tools.GlobalEvent.on(this,"mousedown",this.handleGlobalMousedownEvent),_tools.GlobalEvent.on(this,"blur",this.handleGlobalBlurEvent)},beforeDestroy:function(){var e=this.$refs.panel;e&&e.parentNode&&e.parentNode.removeChild(e)},destroyed:function(){_tools.GlobalEvent.off(this,"mousewheel"),_tools.GlobalEvent.off(this,"mousedown"),_tools.GlobalEvent.off(this,"blur")},render:function(e){var t=this.$scopedSlots,i=this.inited,n=this.vSize,l=this.destroyOnClose,o=this.transfer,s=this.isActivated,a=this.disabled,r=this.animatVisible,d=this.visiblePanel,u=this.panelStyle,h=this.panelPlacement,c=t.default,f=t.dropdown;return e("div",{class:["vxe-pulldown",(_defineProperty(t={},"size--".concat(n),n),_defineProperty(t,"is--visivle",d),_defineProperty(t,"is--disabled",a),_defineProperty(t,"is--active",s),t)]},[e("div",{ref:"content",class:"vxe-pulldown--content"},c?c.call(this,{$pulldown:this},e):[]),e("div",{ref:"panel",class:["vxe-table--ignore-clear vxe-pulldown--panel",(_defineProperty(c={},"size--".concat(n),n),_defineProperty(c,"is--transfer",o),_defineProperty(c,"animat--leave",r),_defineProperty(c,"animat--enter",d),c)],attrs:{placement:h},style:u},f?[e("div",{class:"vxe-pulldown--wrapper"},!i||l&&!d&&!r?[]:f.call(this,{$pulldown:this},e))]:[])])},methods:{handleGlobalMousewheelEvent:function(e){var t=this.$refs,i=this.disabled,n=this.visiblePanel;i||n&&(_tools.DomTools.getEventTargetNode(e,t.panel).flag?this.updatePlacement():(this.hidePanel(),this.$emit("hide-panel",{$event:e})))},handleGlobalMousedownEvent:function(e){var t=this.$refs,i=this.$el,n=this.disabled,l=this.visiblePanel;n||(this.isActivated=_tools.DomTools.getEventTargetNode(e,i).flag||_tools.DomTools.getEventTargetNode(e,t.panel).flag,l&&!this.isActivated&&(this.hidePanel(),this.$emit("hide-panel",{$event:e})))},handleGlobalBlurEvent:function(e){this.visiblePanel&&(this.isActivated=!1,this.hidePanel(),this.$emit("hide-panel",{$event:e}))},updateZindex:function(){this.panelIndex<_tools.UtilTools.getLastZIndex()&&(this.panelIndex=_tools.UtilTools.nextZIndex())},isPanelVisible:function(){return this.visiblePanel},togglePanel:function(){return this.visiblePanel?this.hidePanel():this.showPanel()},showPanel:function(){var t=this;return this.inited||(this.inited=!0,this.transfer&&document.body.appendChild(this.$refs.panel)),new Promise(function(e){t.disabled?e(t.$nextTick()):(clearTimeout(t.hidePanelTimeout),t.isActivated=!0,t.animatVisible=!0,setTimeout(function(){t.visiblePanel=!0,t.updatePlacement(),setTimeout(function(){e(t.updatePlacement())},40)},10),t.updateZindex())})},hidePanel:function(){var t=this;return this.visiblePanel=!1,new Promise(function(e){t.animatVisible?t.hidePanelTimeout=setTimeout(function(){t.animatVisible=!1,e(t.$nextTick())},350):e(t.$nextTick())})},updatePlacement:function(){var c=this;return this.$nextTick().then(function(){var e,t,i,n,l,o,s,a,r=c.$refs,d=c.transfer,u=c.placement,h=c.panelIndex;return c.visiblePanel&&(a=r.panel,o=r.content,a&&o&&(e=o.offsetHeight,t=o.offsetWidth,i=a.offsetHeight,n=a.offsetWidth,l={zIndex:h},r=(s=_tools.DomTools.getAbsolutePos(o)).boundingTop,a=s.boundingLeft,h=s.visibleHeight,o=s.visibleWidth,s="bottom",d?(d=r+e,"top"===u?(s="top",d=r-i):u||(h<d+i+5&&(s="top",d=r-i),d<5&&(s="bottom",d=r+e)),o<(a=a)+n+5&&(a-=a+n+5-o),a<5&&(a=5),Object.assign(l,{left:"".concat(a,"px"),top:"".concat(d,"px"),minWidth:"".concat(t,"px")})):"top"===u?(s="top",l.bottom="".concat(e,"px")):u||h<r+e+i&&5<r-e-i&&(s="top",l.bottom="".concat(e,"px")),c.panelStyle=l,c.panelPlacement=s)),c.$nextTick()})}}};exports.default=_default2;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _conf=_interopRequireDefault(require("../../v-x-e-table/src/conf")),_size=_interopRequireDefault(require("../../mixins/size")),_tools=require("../../tools");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var _default2={name:"VxePulldown",mixins:[_size.default],props:{value:Boolean,disabled:Boolean,placement:String,size:{type:String,default:function(){return _conf.default.size}},destroyOnClose:Boolean,transfer:Boolean},data:function(){return{inited:!1,panelIndex:0,panelStyle:null,panelPlacement:null,currentValue:null,visiblePanel:!1,animatVisible:!1,isActivated:!1}},watch:{value:function(e){e?this.showPanel():this.hidePanel()}},created:function(){_tools.GlobalEvent.on(this,"mousewheel",this.handleGlobalMousewheelEvent),_tools.GlobalEvent.on(this,"mousedown",this.handleGlobalMousedownEvent),_tools.GlobalEvent.on(this,"blur",this.handleGlobalBlurEvent)},beforeDestroy:function(){var e=this.$refs.panel;e&&e.parentNode&&e.parentNode.removeChild(e)},destroyed:function(){_tools.GlobalEvent.off(this,"mousewheel"),_tools.GlobalEvent.off(this,"mousedown"),_tools.GlobalEvent.off(this,"blur")},render:function(e){var t=this.$scopedSlots,i=this.inited,n=this.vSize,l=this.destroyOnClose,o=this.transfer,s=this.isActivated,a=this.disabled,r=this.animatVisible,d=this.visiblePanel,u=this.panelStyle,h=this.panelPlacement,c=t.default,f=t.dropdown;return e("div",{class:["vxe-pulldown",(_defineProperty(t={},"size--".concat(n),n),_defineProperty(t,"is--visivle",d),_defineProperty(t,"is--disabled",a),_defineProperty(t,"is--active",s),t)]},[e("div",{ref:"content",class:"vxe-pulldown--content"},c?c.call(this,{$pulldown:this},e):[]),e("div",{ref:"panel",class:["vxe-table--ignore-clear vxe-pulldown--panel",(_defineProperty(c={},"size--".concat(n),n),_defineProperty(c,"is--transfer",o),_defineProperty(c,"animat--leave",r),_defineProperty(c,"animat--enter",d),c)],attrs:{placement:h},style:u},f?[e("div",{class:"vxe-pulldown--wrapper"},!i||l&&!d&&!r?[]:f.call(this,{$pulldown:this},e))]:[])])},methods:{handleGlobalMousewheelEvent:function(e){var t=this.$refs,i=this.disabled,n=this.visiblePanel;i||n&&(_tools.DomTools.getEventTargetNode(e,t.panel).flag?this.updatePlacement():(this.hidePanel(),this.$emit("hide-panel",{$event:e})))},handleGlobalMousedownEvent:function(e){var t=this.$refs,i=this.$el,n=this.disabled,l=this.visiblePanel;n||(this.isActivated=_tools.DomTools.getEventTargetNode(e,i).flag||_tools.DomTools.getEventTargetNode(e,t.panel).flag,l&&!this.isActivated&&(this.hidePanel(),this.$emit("hide-panel",{$event:e})))},handleGlobalBlurEvent:function(e){this.visiblePanel&&(this.isActivated=!1,this.hidePanel(),this.$emit("hide-panel",{$event:e}))},updateZindex:function(){this.panelIndex<_tools.UtilTools.getLastZIndex()&&(this.panelIndex=_tools.UtilTools.nextZIndex())},isPanelVisible:function(){return this.visiblePanel},togglePanel:function(){return this.visiblePanel?this.hidePanel():this.showPanel()},showPanel:function(){var t=this;return this.inited||(this.inited=!0,this.transfer&&document.body.appendChild(this.$refs.panel)),new Promise(function(e){t.disabled?e(t.$nextTick()):(clearTimeout(t.hidePanelTimeout),t.isActivated=!0,t.animatVisible=!0,setTimeout(function(){t.visiblePanel=!0,t.$emit("update:input",!0),t.updatePlacement(),setTimeout(function(){e(t.updatePlacement())},40)},10),t.updateZindex())})},hidePanel:function(){var t=this;return this.visiblePanel=!1,this.$emit("update:input",!1),new Promise(function(e){t.animatVisible?t.hidePanelTimeout=setTimeout(function(){t.animatVisible=!1,e(t.$nextTick())},350):e(t.$nextTick())})},updatePlacement:function(){var c=this;return this.$nextTick().then(function(){var e,t,i,n,l,o,s,a,r=c.$refs,d=c.transfer,u=c.placement,h=c.panelIndex;return c.visiblePanel&&(a=r.panel,o=r.content,a&&o&&(e=o.offsetHeight,t=o.offsetWidth,i=a.offsetHeight,n=a.offsetWidth,l={zIndex:h},r=(s=_tools.DomTools.getAbsolutePos(o)).boundingTop,a=s.boundingLeft,h=s.visibleHeight,o=s.visibleWidth,s="bottom",d?(d=r+e,"top"===u?(s="top",d=r-i):u||(h<d+i+5&&(s="top",d=r-i),d<5&&(s="bottom",d=r+e)),o<(a=a)+n+5&&(a-=a+n+5-o),a<5&&(a=5),Object.assign(l,{left:"".concat(a,"px"),top:"".concat(d,"px"),minWidth:"".concat(t,"px")})):"top"===u?(s="top",l.bottom="".concat(e,"px")):u||h<r+e+i&&5<r-e-i&&(s="top",l.bottom="".concat(e,"px")),c.panelStyle=l,c.panelPlacement=s)),c.$nextTick()})}}};exports.default=_default2;
|