envelope/core/static/js/gridstack-all.js

3 lines
72 KiB
JavaScript
Raw Normal View History

2022-10-12 06:22:22 +00:00
/*! For license information please see gridstack-all.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.GridStack=t():e.GridStack=t()}(self,(function(){return(()=>{"use strict";var e={427:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DDBaseImplement=void 0,t.DDBaseImplement=class{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(e,t){this._eventRegister[e]=t}off(e){delete this._eventRegister[e]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(e,t){if(!this.disabled&&this._eventRegister&&this._eventRegister[e])return this._eventRegister[e](t)}}},186:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DDDraggable=void 0;const s=i(939),o=i(593),n=i(427),r=i(635);class l extends n.DDBaseImplement{constructor(e,t={}){super(),this.el=e,this.option=t;let i=t.handle.substring(1);this.dragEl=e.classList.contains(i)?e:e.querySelector(t.handle)||e,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this.enable()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){!1!==this.disabled&&(super.enable(),this.dragEl.addEventListener("mousedown",this._mouseDown),r.isTouch&&(this.dragEl.addEventListener("touchstart",r.touchstart),this.dragEl.addEventListener("pointerdown",r.pointerdown)),this.el.classList.remove("ui-draggable-disabled"),this.el.classList.add("ui-draggable"))}disable(e=!1){!0!==this.disabled&&(super.disable(),this.dragEl.removeEventListener("mousedown",this._mouseDown),r.isTouch&&(this.dragEl.removeEventListener("touchstart",r.touchstart),this.dragEl.removeEventListener("pointerdown",r.pointerdown)),this.el.classList.remove("ui-draggable"),e||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragging&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(e){return Object.keys(e).forEach((t=>this.option[t]=e[t])),this}_mouseDown(e){if(s.DDManager.mouseHandled)return;if(0!==e.button)return!0;let t=this.option.handle.substring(1),i=e.target;for(;i&&!i.classList.contains(t);)i=i.parentElement;return i?(this.mouseDownEvent=e,delete this.dragging,delete s.DDManager.dragElement,delete s.DDManager.dropElement,document.addEventListener("mousemove",this._mouseMove,!0),document.addEventListener("mouseup",this._mouseUp,!0),r.isTouch&&(this.dragEl.addEventListener("touchmove",r.touchmove),this.dragEl.addEventListener("touchend",r.touchend)),e.preventDefault(),s.DDManager.mouseHandled=!0,!0):void 0}_mouseMove(e){var t;let i=this.mouseDownEvent;if(this.dragging){this._dragFollow(e);const t=o.Utils.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(t,this.ui()),this.triggerEvent("drag",t)}else if(Math.abs(e.x-i.x)+Math.abs(e.y-i.y)>3){this.dragging=!0,s.DDManager.dragElement=this;let i=null===(t=this.el.gridstackNode)||void 0===t?void 0:t.grid;i?s.DDManager.dropElement=i.el.ddElement.ddDroppable:delete s.DDManager.dropElement,this.helper=this._createHelper(e),this._setupHelperContainmentStyle(),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment);const n=o.Utils.initEvent(e,{target:this.el,type:"dragstart"});this._setupHelperStyle(e),this.option.start&&this.option.start(n,this.ui()),this.triggerEvent("dragstart",n)}return e.preventDefault(),!0}_mouseUp(e){var t;if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),r.isTouch&&(this.dragEl.removeEventListener("touchmove",r.touchmove,!0),this.dragEl.removeEventListener("touchend",r.touchend,!0)),this.dragging){delete this.dragging,(null===(t=s.DDManager.dropElement)||void 0===t?void 0:t.el)===this.el.parentElement&&delete s.DDManager.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper===this.el?this._removeHelperStyle():this.helper.remove();const i=o.Utils.initEvent(e,{target:this.el,type:"dragstop"});this.opt
//# sourceMappingURL=gridstack-all.js.map