vxe-table 3.8.12 → 3.8.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/lib/filter/src/mixin.js +19 -14
- package/lib/filter/src/mixin.min.js +1 -1
- package/lib/filter/src/panel.js +1 -1
- package/lib/filter/src/panel.min.js +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.umd.js +68 -59
- package/lib/index.umd.min.js +1 -1
- package/lib/modal/src/modal.js +33 -33
- package/lib/modal/src/modal.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/src/methods.js +13 -9
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/style/style.css +2 -1
- package/lib/table/style/style.min.css +1 -1
- package/lib/tools/log.js +1 -1
- package/lib/tools/log.min.js +1 -1
- package/lib/v-x-e-table/index.js +1 -1
- package/lib/v-x-e-table/index.min.js +1 -1
- package/lib/vxe-table/style/style.css +2 -1
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +1 -1
- package/packages/filter/src/mixin.js +17 -14
- package/packages/filter/src/panel.js +1 -1
- package/packages/modal/src/modal.js +36 -36
- package/packages/table/src/methods.js +13 -9
- package/styles/table.scss +2 -1
- /package/lib/icon/style/{iconfont.1721008774130.ttf → iconfont.1721119959483.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1721008774130.woff → iconfont.1721119959483.woff} +0 -0
- /package/lib/icon/style/{iconfont.1721008774130.woff2 → iconfont.1721119959483.woff2} +0 -0
- /package/lib/{iconfont.1721008774130.ttf → iconfont.1721119959483.ttf} +0 -0
- /package/lib/{iconfont.1721008774130.woff → iconfont.1721119959483.woff} +0 -0
- /package/lib/{iconfont.1721008774130.woff2 → iconfont.1721119959483.woff2} +0 -0
package/lib/modal/src/modal.js
CHANGED
|
@@ -230,12 +230,12 @@ var _default2 = exports.default = {
|
|
|
230
230
|
},
|
|
231
231
|
data: function data() {
|
|
232
232
|
return {
|
|
233
|
-
|
|
233
|
+
initialized: false,
|
|
234
234
|
visible: false,
|
|
235
235
|
contentVisible: false,
|
|
236
236
|
modalTop: 0,
|
|
237
237
|
modalZindex: 0,
|
|
238
|
-
|
|
238
|
+
revertLocat: null,
|
|
239
239
|
firstOpen: true
|
|
240
240
|
};
|
|
241
241
|
},
|
|
@@ -301,7 +301,7 @@ var _default2 = exports.default = {
|
|
|
301
301
|
$scopedSlots = this.$scopedSlots,
|
|
302
302
|
_this$slots = this.slots,
|
|
303
303
|
slots = _this$slots === void 0 ? {} : _this$slots,
|
|
304
|
-
|
|
304
|
+
initialized = this.initialized,
|
|
305
305
|
vSize = this.vSize,
|
|
306
306
|
className = this.className,
|
|
307
307
|
type = this.type,
|
|
@@ -314,7 +314,7 @@ var _default2 = exports.default = {
|
|
|
314
314
|
status = this.status,
|
|
315
315
|
iconStatus = this.iconStatus,
|
|
316
316
|
showFooter = this.showFooter,
|
|
317
|
-
|
|
317
|
+
revertLocat = this.revertLocat,
|
|
318
318
|
modalTop = this.modalTop,
|
|
319
319
|
dblclickZoom = this.dblclickZoom,
|
|
320
320
|
contentVisible = this.contentVisible,
|
|
@@ -342,7 +342,7 @@ var _default2 = exports.default = {
|
|
|
342
342
|
headerOns.dblclick = this.toggleZoomEvent;
|
|
343
343
|
}
|
|
344
344
|
return h('div', {
|
|
345
|
-
class: ['vxe-modal--wrapper', "type--".concat(type), className || '', (_ref = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ref, "size--".concat(vSize), vSize), "status--".concat(status), status), 'is--animat', animat), 'lock--scroll', lockScroll), 'lock--view', lockView), 'is--resize', resize), 'is--mask', mask), 'is--maximize',
|
|
345
|
+
class: ['vxe-modal--wrapper', "type--".concat(type), className || '', (_ref = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ref, "size--".concat(vSize), vSize), "status--".concat(status), status), 'is--animat', animat), 'lock--scroll', lockScroll), 'lock--view', lockView), 'is--resize', resize), 'is--mask', mask), 'is--maximize', revertLocat), 'is--visible', contentVisible), 'is--active', visible), _defineProperty(_ref, 'is--loading', loading))],
|
|
346
346
|
style: {
|
|
347
347
|
zIndex: this.modalZindex,
|
|
348
348
|
top: modalTop ? "".concat(modalTop, "px") : null
|
|
@@ -362,7 +362,7 @@ var _default2 = exports.default = {
|
|
|
362
362
|
'is--ellipsis': !isMsg && showTitleOverflow
|
|
363
363
|
}],
|
|
364
364
|
on: headerOns
|
|
365
|
-
}, headerSlot ? !
|
|
365
|
+
}, headerSlot ? !initialized || destroyOnClose && !visible ? [] : (0, _vn.getSlotVNs)(headerSlot.call(this, {
|
|
366
366
|
$modal: this
|
|
367
367
|
}, h)) : [h('div', {
|
|
368
368
|
class: 'vxe-modal--header-title'
|
|
@@ -375,9 +375,9 @@ var _default2 = exports.default = {
|
|
|
375
375
|
}, (0, _vn.getSlotVNs)(cornerSlot({
|
|
376
376
|
$modal: this
|
|
377
377
|
}))) : _e(), showZoom ? h('i', {
|
|
378
|
-
class: ['vxe-modal--zoom-btn', 'trigger--btn',
|
|
378
|
+
class: ['vxe-modal--zoom-btn', 'trigger--btn', revertLocat ? _conf.default.icon.MODAL_ZOOM_OUT : _conf.default.icon.MODAL_ZOOM_IN],
|
|
379
379
|
attrs: {
|
|
380
|
-
title: _conf.default.i18n("vxe.modal.zoom".concat(
|
|
380
|
+
title: _conf.default.i18n("vxe.modal.zoom".concat(revertLocat ? 'Out' : 'In'))
|
|
381
381
|
},
|
|
382
382
|
on: {
|
|
383
383
|
click: this.toggleZoomEvent
|
|
@@ -398,7 +398,7 @@ var _default2 = exports.default = {
|
|
|
398
398
|
class: ['vxe-modal--status-icon', iconStatus || _conf.default.icon["MODAL_".concat(status).toLocaleUpperCase()]]
|
|
399
399
|
})]) : null, h('div', {
|
|
400
400
|
class: 'vxe-modal--content'
|
|
401
|
-
}, defaultSlot ? !
|
|
401
|
+
}, defaultSlot ? !initialized || destroyOnClose && !visible ? [] : (0, _vn.getSlotVNs)(defaultSlot.call(this, {
|
|
402
402
|
$modal: this
|
|
403
403
|
}, h)) : (0, _utils.getFuncText)(content)),
|
|
404
404
|
/**
|
|
@@ -411,7 +411,7 @@ var _default2 = exports.default = {
|
|
|
411
411
|
}
|
|
412
412
|
}) : null]), showFooter ? h('div', {
|
|
413
413
|
class: 'vxe-modal--footer'
|
|
414
|
-
}, footerSlot ? !
|
|
414
|
+
}, footerSlot ? !initialized || destroyOnClose && !visible ? [] : (0, _vn.getSlotVNs)(footerSlot.call(this, {
|
|
415
415
|
$modal: this
|
|
416
416
|
}, h)) : [_xeUtils.default.isBoolean(showCancelButton) ? showCancelButton : type === 'confirm' ? h('vxe-button', {
|
|
417
417
|
key: 1,
|
|
@@ -519,14 +519,14 @@ var _default2 = exports.default = {
|
|
|
519
519
|
var $refs = this.$refs,
|
|
520
520
|
_this$events5 = this.events,
|
|
521
521
|
events = _this$events5 === void 0 ? {} : _this$events5,
|
|
522
|
-
|
|
522
|
+
initialized = this.initialized,
|
|
523
523
|
duration = this.duration,
|
|
524
524
|
visible = this.visible,
|
|
525
525
|
isMsg = this.isMsg,
|
|
526
526
|
remember = this.remember,
|
|
527
527
|
showFooter = this.showFooter;
|
|
528
|
-
if (!
|
|
529
|
-
this.
|
|
528
|
+
if (!initialized) {
|
|
529
|
+
this.initialized = true;
|
|
530
530
|
if (this.transfer) {
|
|
531
531
|
document.body.appendChild(this.$el);
|
|
532
532
|
}
|
|
@@ -677,7 +677,7 @@ var _default2 = exports.default = {
|
|
|
677
677
|
}
|
|
678
678
|
_this5.contentVisible = false;
|
|
679
679
|
if (!remember) {
|
|
680
|
-
_this5.
|
|
680
|
+
_this5.revertLocat = null;
|
|
681
681
|
}
|
|
682
682
|
_xeUtils.default.remove(allActivedModals, function (item) {
|
|
683
683
|
return item === _this5;
|
|
@@ -719,18 +719,18 @@ var _default2 = exports.default = {
|
|
|
719
719
|
return this.$refs.modalBox;
|
|
720
720
|
},
|
|
721
721
|
isMaximized: function isMaximized() {
|
|
722
|
-
return !!this.
|
|
722
|
+
return !!this.revertLocat;
|
|
723
723
|
},
|
|
724
724
|
maximize: function maximize() {
|
|
725
725
|
var _this7 = this;
|
|
726
726
|
return this.$nextTick().then(function () {
|
|
727
|
-
if (!_this7.
|
|
727
|
+
if (!_this7.revertLocat) {
|
|
728
728
|
var marginSize = Math.max(0, _this7.marginSize);
|
|
729
729
|
var modalBoxElem = _this7.getBox();
|
|
730
730
|
var _DomTools$getDomNode = _dom.default.getDomNode(),
|
|
731
731
|
visibleHeight = _DomTools$getDomNode.visibleHeight,
|
|
732
732
|
visibleWidth = _DomTools$getDomNode.visibleWidth;
|
|
733
|
-
_this7.
|
|
733
|
+
_this7.revertLocat = {
|
|
734
734
|
top: modalBoxElem.offsetTop,
|
|
735
735
|
left: modalBoxElem.offsetLeft,
|
|
736
736
|
width: modalBoxElem.offsetWidth + (modalBoxElem.style.width ? 0 : 1),
|
|
@@ -749,15 +749,15 @@ var _default2 = exports.default = {
|
|
|
749
749
|
revert: function revert() {
|
|
750
750
|
var _this8 = this;
|
|
751
751
|
return this.$nextTick().then(function () {
|
|
752
|
-
var
|
|
753
|
-
if (
|
|
752
|
+
var revertLocat = _this8.revertLocat;
|
|
753
|
+
if (revertLocat) {
|
|
754
754
|
var modalBoxElem = _this8.getBox();
|
|
755
|
-
_this8.
|
|
755
|
+
_this8.revertLocat = null;
|
|
756
756
|
Object.assign(modalBoxElem.style, {
|
|
757
|
-
top: "".concat(
|
|
758
|
-
left: "".concat(
|
|
759
|
-
width: "".concat(
|
|
760
|
-
height: "".concat(
|
|
757
|
+
top: "".concat(revertLocat.top, "px"),
|
|
758
|
+
left: "".concat(revertLocat.left, "px"),
|
|
759
|
+
width: "".concat(revertLocat.width, "px"),
|
|
760
|
+
height: "".concat(revertLocat.height, "px")
|
|
761
761
|
});
|
|
762
762
|
_this8.savePosStorage();
|
|
763
763
|
}
|
|
@@ -765,18 +765,18 @@ var _default2 = exports.default = {
|
|
|
765
765
|
},
|
|
766
766
|
zoom: function zoom() {
|
|
767
767
|
var _this9 = this;
|
|
768
|
-
return this[this.
|
|
768
|
+
return this[this.revertLocat ? 'revert' : 'maximize']().then(function () {
|
|
769
769
|
return _this9.isMaximized();
|
|
770
770
|
});
|
|
771
771
|
},
|
|
772
772
|
toggleZoomEvent: function toggleZoomEvent(evnt) {
|
|
773
773
|
var _this10 = this;
|
|
774
774
|
var $listeners = this.$listeners,
|
|
775
|
-
|
|
775
|
+
revertLocat = this.revertLocat,
|
|
776
776
|
_this$events7 = this.events,
|
|
777
777
|
events = _this$events7 === void 0 ? {} : _this$events7;
|
|
778
778
|
var params = {
|
|
779
|
-
type:
|
|
779
|
+
type: revertLocat ? 'revert' : 'max',
|
|
780
780
|
$modal: this,
|
|
781
781
|
$event: evnt
|
|
782
782
|
};
|
|
@@ -825,9 +825,9 @@ var _default2 = exports.default = {
|
|
|
825
825
|
var remember = this.remember,
|
|
826
826
|
storage = this.storage,
|
|
827
827
|
marginSize = this.marginSize,
|
|
828
|
-
|
|
828
|
+
revertLocat = this.revertLocat;
|
|
829
829
|
var modalBoxElem = this.getBox();
|
|
830
|
-
if (!
|
|
830
|
+
if (!revertLocat && evnt.button === 0 && !_dom.default.getEventTargetNode(evnt, modalBoxElem, 'trigger--btn').flag) {
|
|
831
831
|
evnt.preventDefault();
|
|
832
832
|
var domMousemove = document.onmousemove;
|
|
833
833
|
var domMouseup = document.onmouseup;
|
|
@@ -1035,7 +1035,7 @@ var _default2 = exports.default = {
|
|
|
1035
1035
|
}
|
|
1036
1036
|
};
|
|
1037
1037
|
document.onmouseup = function () {
|
|
1038
|
-
_this12.
|
|
1038
|
+
_this12.revertLocat = null;
|
|
1039
1039
|
document.onmousemove = domMousemove;
|
|
1040
1040
|
document.onmouseup = domMouseup;
|
|
1041
1041
|
setTimeout(function () {
|
|
@@ -1089,7 +1089,7 @@ var _default2 = exports.default = {
|
|
|
1089
1089
|
modalBoxElem.style.height = "".concat(height, "px");
|
|
1090
1090
|
}
|
|
1091
1091
|
if (zoomLeft && zoomTop) {
|
|
1092
|
-
this.
|
|
1092
|
+
this.revertLocat = {
|
|
1093
1093
|
left: zoomLeft,
|
|
1094
1094
|
top: zoomTop,
|
|
1095
1095
|
width: zoomWidth,
|
|
@@ -1104,11 +1104,11 @@ var _default2 = exports.default = {
|
|
|
1104
1104
|
remember = this.remember,
|
|
1105
1105
|
storage = this.storage,
|
|
1106
1106
|
storageKey = this.storageKey,
|
|
1107
|
-
|
|
1107
|
+
revertLocat = this.revertLocat;
|
|
1108
1108
|
if (remember && storage) {
|
|
1109
1109
|
var modalBoxElem = this.getBox();
|
|
1110
1110
|
var posStorageMap = this.getStorageMap(storageKey);
|
|
1111
|
-
posStorageMap[id] = [modalBoxElem.style.left, modalBoxElem.style.top, modalBoxElem.style.width, modalBoxElem.style.height].concat(
|
|
1111
|
+
posStorageMap[id] = [modalBoxElem.style.left, modalBoxElem.style.top, modalBoxElem.style.width, modalBoxElem.style.height].concat(revertLocat ? [revertLocat.left, revertLocat.top, revertLocat.width, revertLocat.height] : []).map(function (val) {
|
|
1112
1112
|
return val ? _xeUtils.default.toNumber(val) : '';
|
|
1113
1113
|
}).join(',');
|
|
1114
1114
|
localStorage.setItem(storageKey, _xeUtils.default.toJSONString(posStorageMap));
|
|
@@ -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")),_utils=_interopRequireWildcard(require("../../tools/utils")),_dom=_interopRequireDefault(require("../../tools/dom")),_event=require("../../tools/event"),_log=require("../../tools/log"),_vn=require("../../tools/vn"),_index=_interopRequireDefault(require("../../loading/index"));function _getRequireWildcardCache(t){var e,o;return"function"!=typeof WeakMap?null:(e=new WeakMap,o=new WeakMap,(_getRequireWildcardCache=function(t){return t?o:e})(t))}function _interopRequireWildcard(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!=_typeof(t)&&"function"!=typeof t)return{default:t};e=_getRequireWildcardCache(e);if(e&&e.has(t))return e.get(t);var o,i,n={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(o in t)"default"!==o&&{}.hasOwnProperty.call(t,o)&&((i=s?Object.getOwnPropertyDescriptor(t,o):null)&&(i.get||i.set)?Object.defineProperty(n,o,i):n[o]=t[o]);return n.default=t,e&&e.set(t,n),n}function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(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){var o;if(t)return"string"==typeof t?_arrayLikeToArray(t,e):"Map"===(o="Object"===(o=Object.prototype.toString.call(t).slice(8,-1))&&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,a=[],r=!0,c=!1;try{if(s=(o=o.call(t)).next,0===e){if(Object(o)!==o)return;r=!1}else for(;!(r=(i=s.call(o)).done)&&(a.push(i.value),a.length!==e);r=!0);}catch(t){c=!0,n=t}finally{try{if(!r&&null!=o.return&&(l=o.return(),Object(l)!==l))return}finally{if(c)throw n}}return a}}function _arrayWithHoles(t){if(Array.isArray(t))return t}function _defineProperty(t,e,o){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"==_typeof(t)?t:t+""}function _toPrimitive(t,e){if("object"!=_typeof(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=_typeof(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}var allActivedModals=exports.allActivedModals=[],msgQueue=exports.msgQueue=[],_default2=exports.default={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],showCancelButton:{type:Boolean,default:null},cancelButtonText:{type:String,default:function(){return _conf.default.modal.cancelButtonText}},showConfirmButton:{type:Boolean,default:function(){return _conf.default.modal.showConfirmButton}},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:!0}},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&&(0,_log.errLog)("vxe.error.reqProp",["modal.id"])},mounted:function(){var t=this.$listeners,e=this.events,e=void 0===e?{}:e,o=(this.value&&this.open(),this.recalculate(),this.escClosable&&_event.GlobalEvent.on(this,"keydown",this.handleGlobalKeydownEvent),"inserted"),o={type:o,$modal:this,$event:{type:o}};t.inserted?this.$emit("inserted",o):e.inserted&&e.inserted.call(this,o)},beforeDestroy:function(){var t=this.$el;_event.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,n=void 0===n?{}:n,s=this.inited,l=this.vSize,a=this.className,r=this.type,c=this.resize,u=this.showClose,d=this.showZoom,f=this.animat,h=this.draggable,m=this.loading,p=this.status,v=this.iconStatus,g=this.showFooter,y=this.zoomLocat,x=this.modalTop,_=this.dblclickZoom,b=this.contentVisible,w=this.visible,S=this.title,z=this.lockScroll,k=this.lockView,B=this.mask,$=this.isMsg,N=this.showTitleOverflow,T=this.destroyOnClose,M=this.showCancelButton,O=this.showConfirmButton,A=this.content||this.message,P=i.default||n.default,L=i.footer||n.footer,C=i.header||n.header,E=i.title||n.title,i=i.corner||n.corner,n={};return h&&(n.mousedown=this.mousedownEvent),d&&_&&"modal"===r&&(n.dblclick=this.toggleZoomEvent),e("div",{class:["vxe-modal--wrapper","type--".concat(r),a||"",(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_={},"size--".concat(l),l),"status--".concat(p),p),"is--animat",f),"lock--scroll",z),"lock--view",k),"is--resize",c),"is--mask",B),"is--maximize",y),"is--visible",b),"is--active",w),_defineProperty(_,"is--loading",m))],style:{zIndex:this.modalZindex,top:x?"".concat(x,"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--draggable":h,"is--ellipsis":!$&&N}],on:n},C?!s||T&&!w?[]:(0,_vn.getSlotVNs)(C.call(this,{$modal:this},e)):[e("div",{class:"vxe-modal--header-title"},E?(0,_vn.getSlotVNs)(E.call(this,{$modal:this},e)):S?(0,_utils.getFuncText)(S):_conf.default.i18n("vxe.alert.title")),e("div",{class:"vxe-modal--header-right"},[i?e("span",{class:"vxe-modal--corner-wrapper"},(0,_vn.getSlotVNs)(i({$modal:this}))):t(),d?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(),u?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"},[p?e("div",{class:"vxe-modal--status-wrapper"},[e("i",{class:["vxe-modal--status-icon",v||_conf.default.icon["MODAL_".concat(p).toLocaleUpperCase()]]})]):null,e("div",{class:"vxe-modal--content"},P?!s||T&&!w?[]:(0,_vn.getSlotVNs)(P.call(this,{$modal:this},e)):(0,_utils.getFuncText)(A)),$?null:e(_index.default,{class:"vxe-modal--loading",props:{value:m}})]),g?e("div",{class:"vxe-modal--footer"},L?!s||T&&!w?[]:(0,_vn.getSlotVNs)(L.call(this,{$modal:this},e)):[_xeUtils.default.isBoolean(M)?M:"confirm"===r?e("vxe-button",{key:1,ref:"cancelBtn",on:{click:this.cancelEvent}},this.cancelButtonText||_conf.default.i18n("vxe.button.cancel")):null,_xeUtils.default.isBoolean(O)?O:"confirm"===r||"alert"===r?e("vxe-button",{key:2,ref:"confirmBtn",props:{status:"primary"},on:{click:this.confirmEvent}},this.confirmButtonText||_conf.default.i18n("vxe.button.confirm")):null]):null,!$&&c?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<_utils.default.getLastZIndex()&&(this.modalZindex=_utils.default.nextZIndex())},closeEvent:function(t){var e=this.events,e=void 0===e?{}:e,o="close",t={type:o,$modal:this,$event:t};e[o]?e[o].call(this,t):this.$emit(o,t),this.close(o)},confirmEvent:function(t){var e=this.events,e=void 0===e?{}:e,o="confirm",t={type:o,$modal:this,$event:t};e[o]?e[o].call(this,t):this.$emit(o,t),this.close(o)},cancelEvent:function(t){var e=this.events,e=void 0===e?{}:e,o="cancel",t={type:o,$modal:this,$event:t};e[o]?e[o].call(this,t):this.$emit(o,t),this.close(o)},open:function(){var o=this,e=this.$refs,t=this.events,i=void 0===t?{}:t,t=this.inited,n=this.duration,s=this.visible,l=this.isMsg,a=this.remember,r=this.showFooter;t||(this.inited=!0,this.transfer&&document.body.appendChild(this.$el)),s||(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),l?(this.addMsgQueue(),-1!==n&&setTimeout(function(){return o.close("close")},_xeUtils.default.toNumber(n))):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=!1,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,e=s?{top:e,left:e}:Object.assign({},e),l=e.top,e=e.left,a=s||"center"===l,r="",c="",c=e&&!(s||"center"===e)?isNaN(e)?e:"".concat(e,"px"):"".concat(Math.max(t,i/2-o.offsetWidth/2),"px"),r=l&&!a?isNaN(l)?l:"".concat(l,"px"):"".concat(Math.max(t,n/2-o.offsetHeight/2),"px");o.style.top=r,o.style.left=c})},close:function(t){var e=this,o=this.events,i=void 0===o?{}:o,n=this.remember,o=this.visible,s=this.isMsg,l=this.beforeHideMethod,a={type:t,$modal:this};o&&Promise.resolve(l?l(a):null).then(function(t){_xeUtils.default.isError(t)||(s&&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=_dom.default.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,s,l,a,r,c=this,i=this.remember,n=this.storage,u=this.marginSize,d=this.zoomLocat,f=this.getBox();d||0!==t.button||_dom.default.getEventTargetNode(t,f,"trigger--btn").flag||(t.preventDefault(),e=document.onmousemove,o=document.onmouseup,s=t.clientX-f.offsetLeft,l=t.clientY-f.offsetTop,d=_dom.default.getDomNode(),a=d.visibleHeight,r=d.visibleWidth,document.onmousemove=function(t){t.preventDefault();var e=f.offsetWidth,o=f.offsetHeight,e=r-e-u-1,o=a-o-u-1,i=t.clientX-s,n=t.clientY-l;(n=o<n?o:n)<u&&(n=u),f.style.left="".concat(i=(i=e<i?e:i)<u?u:i,"px"),f.style.top="".concat(n,"px"),f.className=f.className.replace(/\s?is--drag/,"")+" is--drag",c.$emit("move",{type:"move",$event:t})},document.onmouseup=function(){document.onmousemove=e,document.onmouseup=o,i&&n&&c.$nextTick(function(){c.savePosStorage()}),setTimeout(function(){f.className=f.className.replace(/\s?is--drag/,"")},50)})},dragEvent:function(t){var s=this,l=(t.preventDefault(),this.$listeners),a=this.marginSize,e=this.events,r=void 0===e?{}:e,c=this.remember,u=this.storage,e=_dom.default.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,y=this.getBox(),o=document.onmousemove,i=document.onmouseup,x=y.clientWidth,_=y.clientHeight,b=t.clientX,w=t.clientY,S=y.offsetTop,z=y.offsetLeft,k={type:"resize",$modal:this};document.onmousemove=function(t){var e,o,i,n;switch(t.preventDefault(),h){case"wl":i=(e=b-t.clientX)+x,a<z-e&&m<i&&(y.style.width="".concat(i<v?i:v,"px"),y.style.left="".concat(z-e,"px"));break;case"swst":e=b-t.clientX,o=w-t.clientY,i=e+x,n=o+_,a<z-e&&m<i&&(y.style.width="".concat(i<v?i:v,"px"),y.style.left="".concat(z-e,"px")),a<S-o&&p<n&&(y.style.height="".concat(n<g?n:g,"px"),y.style.top="".concat(S-o,"px"));break;case"swlb":e=b-t.clientX,o=t.clientY-w,i=e+x,n=o+_,a<z-e&&m<i&&(y.style.width="".concat(i<v?i:v,"px"),y.style.left="".concat(z-e,"px")),S+n+a<d&&p<n&&(y.style.height="".concat(n<g?n:g,"px"));break;case"st":o=w-t.clientY,n=_+o,a<S-o&&p<n&&(y.style.height="".concat(n<g?n:g,"px"),y.style.top="".concat(S-o,"px"));break;case"wr":e=t.clientX-b,z+(i=e+x)+a<f&&m<i&&(y.style.width="".concat(i<v?i:v,"px"));break;case"sest":e=t.clientX-b,n=(o=w-t.clientY)+_,z+(i=e+x)+a<f&&m<i&&(y.style.width="".concat(i<v?i:v,"px")),a<S-o&&p<n&&(y.style.height="".concat(n<g?n:g,"px"),y.style.top="".concat(S-o,"px"));break;case"selb":e=t.clientX-b,n=(o=t.clientY-w)+_,z+(i=e+x)+a<f&&m<i&&(y.style.width="".concat(i<v?i:v,"px")),S+n+a<d&&p<n&&(y.style.height="".concat(n<g?n:g,"px"));break;case"sb":o=t.clientY-w,S+(n=o+_)+a<d&&p<n&&(y.style.height="".concat(n<g?n:g,"px"))}y.className=y.className.replace(/\s?is--drag/,"")+" is--drag",c&&u&&s.savePosStorage(),l.resize?s.$emit("resize",k):r.resize&&r.resize.call(s,k)},document.onmouseup=function(){s.zoomLocat=null,document.onmousemove=o,document.onmouseup=i,setTimeout(function(){y.className=y.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&&(l=this.getStorageMap(r)[s])&&(a=this.getBox(),s=(r=_slicedToArray(l.split(","),8))[0],l=r[1],t=r[2],e=r[3],o=r[4],i=r[5],n=r[6],r=r[7],s&&(a.style.left="".concat(s,"px")),l&&(a.style.top="".concat(l,"px")),t&&(a.style.width="".concat(t,"px")),e&&(a.style.height="".concat(e,"px")),o)&&i&&(this.zoomLocat={left:o,top:i,width:n,height:r})},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)))}}};
|
|
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")),_utils=_interopRequireWildcard(require("../../tools/utils")),_dom=_interopRequireDefault(require("../../tools/dom")),_event=require("../../tools/event"),_log=require("../../tools/log"),_vn=require("../../tools/vn"),_index=_interopRequireDefault(require("../../loading/index"));function _getRequireWildcardCache(t){var e,o;return"function"!=typeof WeakMap?null:(e=new WeakMap,o=new WeakMap,(_getRequireWildcardCache=function(t){return t?o:e})(t))}function _interopRequireWildcard(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!=_typeof(t)&&"function"!=typeof t)return{default:t};e=_getRequireWildcardCache(e);if(e&&e.has(t))return e.get(t);var o,i,n={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(o in t)"default"!==o&&{}.hasOwnProperty.call(t,o)&&((i=s?Object.getOwnPropertyDescriptor(t,o):null)&&(i.get||i.set)?Object.defineProperty(n,o,i):n[o]=t[o]);return n.default=t,e&&e.set(t,n),n}function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(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){var o;if(t)return"string"==typeof t?_arrayLikeToArray(t,e):"Map"===(o="Object"===(o=Object.prototype.toString.call(t).slice(8,-1))&&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,r=[],a=!0,c=!1;try{if(s=(o=o.call(t)).next,0===e){if(Object(o)!==o)return;a=!1}else for(;!(a=(i=s.call(o)).done)&&(r.push(i.value),r.length!==e);a=!0);}catch(t){c=!0,n=t}finally{try{if(!a&&null!=o.return&&(l=o.return(),Object(l)!==l))return}finally{if(c)throw n}}return r}}function _arrayWithHoles(t){if(Array.isArray(t))return t}function _defineProperty(t,e,o){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"==_typeof(t)?t:t+""}function _toPrimitive(t,e){if("object"!=_typeof(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=_typeof(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}var allActivedModals=exports.allActivedModals=[],msgQueue=exports.msgQueue=[],_default2=exports.default={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],showCancelButton:{type:Boolean,default:null},cancelButtonText:{type:String,default:function(){return _conf.default.modal.cancelButtonText}},showConfirmButton:{type:Boolean,default:function(){return _conf.default.modal.showConfirmButton}},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{initialized:!1,visible:!1,contentVisible:!1,modalTop:0,modalZindex:0,revertLocat:null,firstOpen:!0}},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&&(0,_log.errLog)("vxe.error.reqProp",["modal.id"])},mounted:function(){var t=this.$listeners,e=this.events,e=void 0===e?{}:e,o=(this.value&&this.open(),this.recalculate(),this.escClosable&&_event.GlobalEvent.on(this,"keydown",this.handleGlobalKeydownEvent),"inserted"),o={type:o,$modal:this,$event:{type:o}};t.inserted?this.$emit("inserted",o):e.inserted&&e.inserted.call(this,o)},beforeDestroy:function(){var t=this.$el;_event.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,n=void 0===n?{}:n,s=this.initialized,l=this.vSize,r=this.className,a=this.type,c=this.resize,u=this.showClose,d=this.showZoom,f=this.animat,h=this.draggable,m=this.loading,p=this.status,v=this.iconStatus,g=this.showFooter,y=this.revertLocat,x=this.modalTop,_=this.dblclickZoom,b=this.contentVisible,w=this.visible,S=this.title,k=this.lockScroll,B=this.lockView,$=this.mask,N=this.isMsg,T=this.showTitleOverflow,z=this.destroyOnClose,M=this.showCancelButton,O=this.showConfirmButton,A=this.content||this.message,P=i.default||n.default,L=i.footer||n.footer,C=i.header||n.header,E=i.title||n.title,i=i.corner||n.corner,n={};return h&&(n.mousedown=this.mousedownEvent),d&&_&&"modal"===a&&(n.dblclick=this.toggleZoomEvent),e("div",{class:["vxe-modal--wrapper","type--".concat(a),r||"",(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_={},"size--".concat(l),l),"status--".concat(p),p),"is--animat",f),"lock--scroll",k),"lock--view",B),"is--resize",c),"is--mask",$),"is--maximize",y),"is--visible",b),"is--active",w),_defineProperty(_,"is--loading",m))],style:{zIndex:this.modalZindex,top:x?"".concat(x,"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--draggable":h,"is--ellipsis":!N&&T}],on:n},C?!s||z&&!w?[]:(0,_vn.getSlotVNs)(C.call(this,{$modal:this},e)):[e("div",{class:"vxe-modal--header-title"},E?(0,_vn.getSlotVNs)(E.call(this,{$modal:this},e)):S?(0,_utils.getFuncText)(S):_conf.default.i18n("vxe.alert.title")),e("div",{class:"vxe-modal--header-right"},[i?e("span",{class:"vxe-modal--corner-wrapper"},(0,_vn.getSlotVNs)(i({$modal:this}))):t(),d?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(),u?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"},[p?e("div",{class:"vxe-modal--status-wrapper"},[e("i",{class:["vxe-modal--status-icon",v||_conf.default.icon["MODAL_".concat(p).toLocaleUpperCase()]]})]):null,e("div",{class:"vxe-modal--content"},P?!s||z&&!w?[]:(0,_vn.getSlotVNs)(P.call(this,{$modal:this},e)):(0,_utils.getFuncText)(A)),N?null:e(_index.default,{class:"vxe-modal--loading",props:{value:m}})]),g?e("div",{class:"vxe-modal--footer"},L?!s||z&&!w?[]:(0,_vn.getSlotVNs)(L.call(this,{$modal:this},e)):[_xeUtils.default.isBoolean(M)?M:"confirm"===a?e("vxe-button",{key:1,ref:"cancelBtn",on:{click:this.cancelEvent}},this.cancelButtonText||_conf.default.i18n("vxe.button.cancel")):null,_xeUtils.default.isBoolean(O)?O:"confirm"===a||"alert"===a?e("vxe-button",{key:2,ref:"confirmBtn",props:{status:"primary"},on:{click:this.confirmEvent}},this.confirmButtonText||_conf.default.i18n("vxe.button.confirm")):null]):null,!N&&c?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<_utils.default.getLastZIndex()&&(this.modalZindex=_utils.default.nextZIndex())},closeEvent:function(t){var e=this.events,e=void 0===e?{}:e,o="close",t={type:o,$modal:this,$event:t};e[o]?e[o].call(this,t):this.$emit(o,t),this.close(o)},confirmEvent:function(t){var e=this.events,e=void 0===e?{}:e,o="confirm",t={type:o,$modal:this,$event:t};e[o]?e[o].call(this,t):this.$emit(o,t),this.close(o)},cancelEvent:function(t){var e=this.events,e=void 0===e?{}:e,o="cancel",t={type:o,$modal:this,$event:t};e[o]?e[o].call(this,t):this.$emit(o,t),this.close(o)},open:function(){var o=this,e=this.$refs,t=this.events,i=void 0===t?{}:t,t=this.initialized,n=this.duration,s=this.visible,l=this.isMsg,r=this.remember,a=this.showFooter;t||(this.initialized=!0,this.transfer&&document.body.appendChild(this.$el)),s||(r||this.recalculate(),this.visible=!0,this.contentVisible=!1,this.updateZindex(),allActivedModals.push(this),setTimeout(function(){o.contentVisible=!0,o.$nextTick(function(){a&&(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),l?(this.addMsgQueue(),-1!==n&&setTimeout(function(){return o.close("close")},_xeUtils.default.toNumber(n))):this.$nextTick(function(){var t=o.firstOpen,e=o.fullscreen;r&&!t||o.updatePosition().then(function(){setTimeout(function(){return o.updatePosition()},20)}),t&&(o.firstOpen=!1,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,e=s?{top:e,left:e}:Object.assign({},e),l=e.top,e=e.left,r=s||"center"===l,a="",c="",c=e&&!(s||"center"===e)?isNaN(e)?e:"".concat(e,"px"):"".concat(Math.max(t,i/2-o.offsetWidth/2),"px"),a=l&&!r?isNaN(l)?l:"".concat(l,"px"):"".concat(Math.max(t,n/2-o.offsetHeight/2),"px");o.style.top=a,o.style.left=c})},close:function(t){var e=this,o=this.events,i=void 0===o?{}:o,n=this.remember,o=this.visible,s=this.isMsg,l=this.beforeHideMethod,r={type:t,$modal:this};o&&Promise.resolve(l?l(r):null).then(function(t){_xeUtils.default.isError(t)||(s&&e.removeMsgQueue(),e.contentVisible=!1,n||(e.revertLocat=null),_xeUtils.default.remove(allActivedModals,function(t){return t===e}),e.$emit("before-hide",r),setTimeout(function(){e.visible=!1,i.hide?i.hide.call(e,r):(e.$emit("input",!1),e.$emit("hide",r))},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.revertLocat},maximize:function(){var n=this;return this.$nextTick().then(function(){var t,e,o,i;n.revertLocat||(t=Math.max(0,n.marginSize),e=n.getBox(),o=(i=_dom.default.getDomNode()).visibleHeight,i=i.visibleWidth,n.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:"".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.revertLocat;e&&(t=o.getBox(),o.revertLocat=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.revertLocat?"revert":"maximize"]().then(function(){return t.isMaximized()})},toggleZoomEvent:function(t){var e=this,o=this.$listeners,i=this.revertLocat,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,s,l,r,a,c=this,i=this.remember,n=this.storage,u=this.marginSize,d=this.revertLocat,f=this.getBox();d||0!==t.button||_dom.default.getEventTargetNode(t,f,"trigger--btn").flag||(t.preventDefault(),e=document.onmousemove,o=document.onmouseup,s=t.clientX-f.offsetLeft,l=t.clientY-f.offsetTop,d=_dom.default.getDomNode(),r=d.visibleHeight,a=d.visibleWidth,document.onmousemove=function(t){t.preventDefault();var e=f.offsetWidth,o=f.offsetHeight,e=a-e-u-1,o=r-o-u-1,i=t.clientX-s,n=t.clientY-l;(n=o<n?o:n)<u&&(n=u),f.style.left="".concat(i=(i=e<i?e:i)<u?u:i,"px"),f.style.top="".concat(n,"px"),f.className=f.className.replace(/\s?is--drag/,"")+" is--drag",c.$emit("move",{type:"move",$event:t})},document.onmouseup=function(){document.onmousemove=e,document.onmouseup=o,i&&n&&c.$nextTick(function(){c.savePosStorage()}),setTimeout(function(){f.className=f.className.replace(/\s?is--drag/,"")},50)})},dragEvent:function(t){var s=this,l=(t.preventDefault(),this.$listeners),r=this.marginSize,e=this.events,a=void 0===e?{}:e,c=this.remember,u=this.storage,e=_dom.default.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,y=this.getBox(),o=document.onmousemove,i=document.onmouseup,x=y.clientWidth,_=y.clientHeight,b=t.clientX,w=t.clientY,S=y.offsetTop,k=y.offsetLeft,B={type:"resize",$modal:this};document.onmousemove=function(t){var e,o,i,n;switch(t.preventDefault(),h){case"wl":i=(e=b-t.clientX)+x,r<k-e&&m<i&&(y.style.width="".concat(i<v?i:v,"px"),y.style.left="".concat(k-e,"px"));break;case"swst":e=b-t.clientX,o=w-t.clientY,i=e+x,n=o+_,r<k-e&&m<i&&(y.style.width="".concat(i<v?i:v,"px"),y.style.left="".concat(k-e,"px")),r<S-o&&p<n&&(y.style.height="".concat(n<g?n:g,"px"),y.style.top="".concat(S-o,"px"));break;case"swlb":e=b-t.clientX,o=t.clientY-w,i=e+x,n=o+_,r<k-e&&m<i&&(y.style.width="".concat(i<v?i:v,"px"),y.style.left="".concat(k-e,"px")),S+n+r<d&&p<n&&(y.style.height="".concat(n<g?n:g,"px"));break;case"st":o=w-t.clientY,n=_+o,r<S-o&&p<n&&(y.style.height="".concat(n<g?n:g,"px"),y.style.top="".concat(S-o,"px"));break;case"wr":e=t.clientX-b,k+(i=e+x)+r<f&&m<i&&(y.style.width="".concat(i<v?i:v,"px"));break;case"sest":e=t.clientX-b,n=(o=w-t.clientY)+_,k+(i=e+x)+r<f&&m<i&&(y.style.width="".concat(i<v?i:v,"px")),r<S-o&&p<n&&(y.style.height="".concat(n<g?n:g,"px"),y.style.top="".concat(S-o,"px"));break;case"selb":e=t.clientX-b,n=(o=t.clientY-w)+_,k+(i=e+x)+r<f&&m<i&&(y.style.width="".concat(i<v?i:v,"px")),S+n+r<d&&p<n&&(y.style.height="".concat(n<g?n:g,"px"));break;case"sb":o=t.clientY-w,S+(n=o+_)+r<d&&p<n&&(y.style.height="".concat(n<g?n:g,"px"))}y.className=y.className.replace(/\s?is--drag/,"")+" is--drag",c&&u&&s.savePosStorage(),l.resize?s.$emit("resize",B):a.resize&&a.resize.call(s,B)},document.onmouseup=function(){s.revertLocat=null,document.onmousemove=o,document.onmouseup=i,setTimeout(function(){y.className=y.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,r=this.storage,a=this.storageKey;l&&r&&(l=this.getStorageMap(a)[s])&&(r=this.getBox(),s=(a=_slicedToArray(l.split(","),8))[0],l=a[1],t=a[2],e=a[3],o=a[4],i=a[5],n=a[6],a=a[7],s&&(r.style.left="".concat(s,"px")),l&&(r.style.top="".concat(l,"px")),t&&(r.style.width="".concat(t,"px")),e&&(r.style.height="".concat(e,"px")),o)&&i&&(this.revertLocat={left:o,top:i,width:n,height:a})},savePosStorage:function(){var t=this.id,e=this.remember,o=this.storage,i=this.storageKey,n=this.revertLocat;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)))}}};
|