moodle_local_treestudyplan/amd/build/vue-easy-dnd.min.js

3 lines
37 KiB
JavaScript

define("local_treestudyplan/vue-easy-dnd",["exports","./reflect-metadata","./vue-property-decorator"],(function(_exports,_reflectMetadata,_vuePropertyDecorator){function _typeof(obj){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}function __decorate(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"===("undefined"==typeof Reflect?"undefined":_typeof(Reflect))&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r}function __metadata(metadataKey,metadataValue){if("object"===("undefined"==typeof Reflect?"undefined":_typeof(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(metadataKey,metadataValue)}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.ReorderEvent=_exports.InsertEvent=_exports.DropMixin=_exports.DropMask=_exports.DropList=_exports.Drop=_exports.DragMixin=_exports.DragImagesManager=_exports.DragAwareMixin=_exports.Drag=_exports.DnDEvent=void 0,_exports.createDragImage=createDragImage,_exports.dnd=void 0;var DnD=function(){this.inProgress=!1,this.type=null,this.data=null,this.source=null,this.top=null,this.position=null,this.eventBus=new _vuePropertyDecorator.Vue,this.sourceListeners=null,this.success=null};DnD.prototype.startDrag=function(source,event,x,y,type,data){this.type=type,this.data=data,this.source=source,this.position={x:x,y:y},this.top=null,this.sourceListeners=source.$listeners,this.inProgress=!0,this.emit(event,"dragstart"),this.emit(event,"dragtopchanged",{previousTop:null})},DnD.prototype.stopDrag=function(event){this.success=null!==this.top&&this.top.compatibleMode&&this.top.dropAllowed,null!==this.top&&this.emit(event,"drop"),this.emit(event,"dragend"),this.inProgress=!1,this.data=null,this.source=null,this.position=null,this.success=null},DnD.prototype.mouseMove=function(event,comp){if(this.inProgress){var prevent=!1,previousTop=this.top;null===comp||comp.isDropMask?(this.top=null,prevent=!0):comp.candidate(this.type,this.data,this.source)&&(this.top=comp,prevent=!0),prevent&&event.stopPropagation(),this.top!==previousTop&&this.emit(event.detail.native,"dragtopchanged",{previousTop:previousTop}),this.position={x:event.detail.x,y:event.detail.y},this.emit(event.detail.native,"dragpositionchanged")}},DnD.prototype.emit=function(native,event,data){this.eventBus.$emit(event,Object.assign({},{type:this.type,data:this.data,top:this.top,source:this.source,position:this.position,success:this.success,native:native},data))},DnD.prototype.on=function(event,callback){this.eventBus.$on(event,callback)},DnD.prototype.off=function(event,callback){this.eventBus.$off(event,callback)};var dnd=new DnD;_exports.dnd=dnd,_exports.dnd=dnd=_vuePropertyDecorator.Vue.observable(dnd);var DragAwareMixin=function(Vue){function DragAwareMixin(){Vue.apply(this,arguments)}Vue&&(DragAwareMixin.__proto__=Vue),DragAwareMixin.prototype=Object.create(Vue&&Vue.prototype),DragAwareMixin.prototype.constructor=DragAwareMixin;var prototypeAccessors={dragInProgress:{configurable:!0},dragData:{configurable:!0},dragType:{configurable:!0},dragPosition:{configurable:!0},dragSource:{configurable:!0},dragTop:{configurable:!0}};return prototypeAccessors.dragInProgress.get=function(){return dnd.inProgress},prototypeAccessors.dragData.get=function(){return dnd.data},prototypeAccessors.dragType.get=function(){return dnd.type},prototypeAccessors.dragPosition.get=function(){return dnd.position},prototypeAccessors.dragSource.get=function(){return dnd.source},prototypeAccessors.dragTop.get=function(){return dnd.top},Object.defineProperties(DragAwareMixin.prototype,prototypeAccessors),DragAwareMixin}(_vuePropertyDecorator.Vue),DragAwareMixin$1=DragAwareMixin=__decorate([(0,_vuePropertyDecorator.Component)({name:"DragAwareMixin"})],DragAwareMixin);function createDragImage(el){var clone=function(el){var clone=el.cloneNode(!0);copyStyle(el,clone);for(var vSrcElements=el.getElementsByTagName("*"),vDstElements=clone.getElementsByTagName("*"),i=vSrcElements.length;i--;){copyStyle(vSrcElements[i],vDstElements[i])}return clone}(el);return clone.style.position="fixed",clone.style.margin="0",clone.style["z-index"]="1000",clone.style.transition="opacity 0.2s",clone}function copyStyle(src,destination){var computedStyle=window.getComputedStyle(src);Array.from(computedStyle).forEach((function(key){destination.style.setProperty(key,computedStyle.getPropertyValue(key),computedStyle.getPropertyPriority(key))})),destination.style.pointerEvents="none"}_exports.DragAwareMixin=DragAwareMixin$1;var DragMixin=function(DragAwareMixin){function DragMixin(){DragAwareMixin.apply(this,arguments),this.isDrag=!0,this.mouseIn=null}DragAwareMixin&&(DragMixin.__proto__=DragAwareMixin),DragMixin.prototype=Object.create(DragAwareMixin&&DragAwareMixin.prototype),DragMixin.prototype.constructor=DragMixin;var prototypeAccessors={dragIn:{configurable:!0},cssClasses:{configurable:!0},currentDropMode:{configurable:!0}};return DragMixin.prototype.created=function(){this.reEmit("dragstart"),this.reEmit("dragend")},DragMixin.prototype.reEmit=function(eventName){var this$1$1=this;dnd.on(eventName,(function(ev){ev.source===this$1$1&&this$1$1.$emit(eventName,ev)}))},DragMixin.prototype.mounted=function(){var initialUserSelect,comp=this,el=this.$el,dragStarted=!1,downEvent=null,startPosition=null;function onMouseEnter(){comp.mouseIn=!0}function onMouseLeave(){comp.mouseIn=!1}function noop(e){e.stopPropagation(),e.preventDefault()}function onMouseDown(e){if(!comp.disabled&&null===downEvent){if(initialUserSelect=document.body.style.userSelect,document.documentElement.style.userSelect="none",dragStarted=!1,"mousedown"===(downEvent=e).type){var mouse=event;startPosition={x:mouse.clientX,y:mouse.clientY}}else{var touch=event;startPosition={x:touch.touches[0].clientX,y:touch.touches[0].clientY}}document.addEventListener("mousemove",onMouseMove),document.addEventListener("touchmove",onMouseMove,{passive:!1}),document.addEventListener("easy-dnd-move",onEasyDnDMove),document.addEventListener("mouseup",onMouseUp),document.addEventListener("touchend",onMouseUp),document.addEventListener("selectstart",noop),e.stopPropagation()}}function onMouseMove(e){if(null!==downEvent&&("touchstart"!==downEvent.type||"mousemove"!==e.type)){var target,x,y;if("touchmove"===e.type){var touch=e;x=touch.touches[0].clientX,y=touch.touches[0].clientY,target=document.elementFromPoint(x,y)}else{var mouse=e;x=mouse.clientX,y=mouse.clientY,target=mouse.target}var dist=Math.sqrt(Math.pow(startPosition.x-x,2)+Math.pow(startPosition.y-y,2));if(!dragStarted&&dist>comp.delta&&(dragStarted=!0,dnd.startDrag(comp,downEvent,startPosition.x,startPosition.y,comp.type,comp.data),document.documentElement.classList.add("drag-in-progress")),dragStarted){var custom=new CustomEvent("easy-dnd-move",{bubbles:!0,cancelable:!0,detail:{x:x,y:y,native:e}});target.dispatchEvent(custom)}e.preventDefault()}}function onEasyDnDMove(e){dnd.mouseMove(e,null)}function onMouseUp(e){"touchstart"===downEvent.type&&"mouseup"===e.type||(downEvent=null,setTimeout((function(){dragStarted&&(document.documentElement.classList.remove("drag-in-progress"),dnd.stopDrag(e)),document.removeEventListener("mousemove",onMouseMove),document.removeEventListener("touchmove",onMouseMove),document.removeEventListener("easy-dnd-move",onEasyDnDMove),document.removeEventListener("mouseup",onMouseUp),document.removeEventListener("touchend",onMouseUp),document.removeEventListener("selectstart",noop),document.documentElement.style.userSelect=initialUserSelect}),0))}this.handle&&(el=this.$el.querySelectorAll(this.handle)),!function(el){return"item"in el}(el)?(el.addEventListener("mousedown",onMouseDown),el.addEventListener("touchstart",onMouseDown),el.addEventListener("mouseenter",onMouseEnter),el.addEventListener("mouseleave",onMouseLeave)):el.forEach((function(element){element.addEventListener("mousedown",onMouseDown),element.addEventListener("touchstart",onMouseDown),element.addEventListener("mouseenter",onMouseEnter),element.addEventListener("mouseleave",onMouseLeave)}))},prototypeAccessors.dragIn.get=function(){return!this.dragInProgress&&this.mouseIn},prototypeAccessors.cssClasses.get=function(){return this.disabled?{}:{"drag-source":this.dragInProgress&&this.dragSource===this,"drag-in":this.dragIn,"drag-out":!this.dragIn,"drag-mode-copy":"copy"===this.currentDropMode,"drag-mode-cut":"cut"===this.currentDropMode,"drag-mode-reordering":"reordering"===this.currentDropMode}},prototypeAccessors.currentDropMode.get=function(){return this.dragInProgress&&this.dragSource===this&&this.dragTop&&this.dragTop.dropAllowed?this.dragTop.reordering?"reordering":this.dragTop.mode:null},DragMixin.prototype.createDragImage=function(selfTransform){var image;if(this.$scopedSlots["drag-image"]){var el=this.$refs["drag-image"];image=1!==el.childElementCount?createDragImage(el):createDragImage(el.children.item(0))}else(image=createDragImage(this.$el)).style.transform=selfTransform;return image.__opacity=this.dragImageOpacity,image},Object.defineProperties(DragMixin.prototype,prototypeAccessors),DragMixin}(DragAwareMixin$1);__decorate([(0,_vuePropertyDecorator.Prop)({default:null,type:null}),__metadata("design:type",String)],DragMixin.prototype,"type",void 0),__decorate([(0,_vuePropertyDecorator.Prop)({default:null,type:null}),__metadata("design:type",Object)],DragMixin.prototype,"data",void 0),__decorate([(0,_vuePropertyDecorator.Prop)({default:.7,type:Number}),__metadata("design:type",Object)],DragMixin.prototype,"dragImageOpacity",void 0),__decorate([(0,_vuePropertyDecorator.Prop)({default:!1,type:Boolean}),__metadata("design:type",Boolean)],DragMixin.prototype,"disabled",void 0),__decorate([(0,_vuePropertyDecorator.Prop)({default:!1,type:Boolean}),__metadata("design:type",Boolean)],DragMixin.prototype,"goBack",void 0),__decorate([(0,_vuePropertyDecorator.Prop)({required:!1,type:String}),__metadata("design:type",String)],DragMixin.prototype,"handle",void 0),__decorate([(0,_vuePropertyDecorator.Prop)({type:Number,default:3}),__metadata("design:type",Number)],DragMixin.prototype,"delta",void 0);var DragMixin$1=DragMixin=__decorate([(0,_vuePropertyDecorator.Component)({name:"DragMixin"})],DragMixin);_exports.DragMixin=DragMixin$1;var Drag=function(DragMixin){function Drag(){DragMixin.apply(this,arguments)}return DragMixin&&(Drag.__proto__=DragMixin),Drag.prototype=Object.create(DragMixin&&DragMixin.prototype),Drag.prototype.constructor=Drag,Drag}(DragMixin$1);__decorate([(0,_vuePropertyDecorator.Prop)({default:"div",type:[String,Object,Function]}),__metadata("design:type",Object)],Drag.prototype,"tag",void 0);var script=Drag=__decorate([(0,_vuePropertyDecorator.Component)({name:"Drag"})],Drag);var HEAD,normalizeComponent_1=function(template,style,script,scopeId,isFunctionalTemplate,moduleIdentifier,shadowMode,createInjector,createInjectorSSR,createInjectorShadow){"boolean"!=typeof shadowMode&&(createInjectorSSR=createInjector,createInjector=shadowMode,shadowMode=!1);var hook,options="function"==typeof script?script.options:script;if(template&&template.render&&(options.render=template.render,options.staticRenderFns=template.staticRenderFns,options._compiled=!0,isFunctionalTemplate&&(options.functional=!0)),scopeId&&(options._scopeId=scopeId),moduleIdentifier?(hook=function(context){(context=context||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(context=__VUE_SSR_CONTEXT__),style&&style.call(this,createInjectorSSR(context)),context&&context._registeredComponents&&context._registeredComponents.add(moduleIdentifier)},options._ssrRegister=hook):style&&(hook=shadowMode?function(){style.call(this,createInjectorShadow(this.$root.$options.shadowRoot))}:function(context){style.call(this,createInjector(context))}),hook)if(options.functional){var originalRender=options.render;options.render=function(h,context){return hook.call(context),originalRender(h,context)}}else{var existing=options.beforeCreate;options.beforeCreate=existing?[].concat(existing,hook):[hook]}return script},isOldIE="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());var styles={};var browser=function(context){return function(id,style){return function(id,css){var group=isOldIE?css.media||"default":id,style=styles[group]||(styles[group]={ids:new Set,styles:[]});if(!style.ids.has(id)){style.ids.add(id);var code=css.source;if(css.map&&(code+="\n/*# sourceURL="+css.map.sources[0]+" */",code+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(css.map))))+" */"),style.element||(style.element=document.createElement("style"),style.element.type="text/css",css.media&&style.element.setAttribute("media",css.media),void 0===HEAD&&(HEAD=document.head||document.getElementsByTagName("head")[0]),HEAD.appendChild(style.element)),"styleSheet"in style.element)style.styles.push(code),style.element.styleSheet.cssText=style.styles.filter(Boolean).join("\n");else{var index=style.ids.size-1,textNode=document.createTextNode(code),nodes=style.element.childNodes;nodes[index]&&style.element.removeChild(nodes[index]),nodes.length?style.element.insertBefore(textNode,nodes[index]):style.element.appendChild(textNode)}}}(id,style)}},Drag$1=normalizeComponent_1({render:function(){var _vm=this,_h=_vm.$createElement,_c=_vm._self._c||_h;return _c(_vm.tag,_vm._g(_vm._b({tag:"component",class:_vm.cssClasses,style:{cursor:_vm.disabled||_vm.handle?null:"grab"},scopedSlots:_vm._u([_vm._l(_vm.$scopedSlots,(function(_,slot){return{key:slot,fn:function(scope){return[_vm._t(slot,null,null,scope)]}}}))],null,!0)},"component",_vm.$attrs,!1),_vm.$listeners),[_vm._t("default"),_vm._v(" "),_vm._v(" "),_c("div",{ref:"drag-image",staticClass:"__drag-image"},[_vm._t("drag-image")],2)],2)},staticRenderFns:[]},(function(inject){inject&&(inject("data-v-15f89b5d_0",{source:".drop-allowed.drop-in *{cursor:inherit!important}.drop-forbidden.drop-in,.drop-forbidden.drop-in *{cursor:no-drop!important}",map:void 0,media:void 0}),inject("data-v-15f89b5d_1",{source:"html.drag-in-progress *{cursor:grabbing!important}",map:void 0,media:void 0}),inject("data-v-15f89b5d_2",{source:".__drag-image[data-v-15f89b5d]{position:fixed;top:-10000px;left:-10000px;will-change:left,top}",map:void 0,media:void 0}))}),script,"data-v-15f89b5d",!1,undefined,browser,void 0);_exports.Drag=Drag$1;var DropMixin=function(DragAwareMixin){function DropMixin(){DragAwareMixin.call(this),this.isDrop=!0}DragAwareMixin&&(DropMixin.__proto__=DragAwareMixin),DropMixin.prototype=Object.create(DragAwareMixin&&DragAwareMixin.prototype),DropMixin.prototype.constructor=DropMixin;var prototypeAccessors={compatibleMode:{configurable:!0},dropIn:{configurable:!0},typeAllowed:{configurable:!0},dropAllowed:{configurable:!0},cssClasses:{configurable:!0},cssStyle:{configurable:!0}};return DropMixin.prototype.effectiveAcceptsType=function(type){return null===this.acceptsType||("string"==typeof this.acceptsType?this.acceptsType===type:"object"===_typeof(this.acceptsType)&&Array.isArray(this.acceptsType)?this.acceptsType.includes(type):this.acceptsType(type))},DropMixin.prototype.effectiveAcceptsData=function(data,type){return this.acceptsData(data,type)},DropMixin.prototype.created=function(){dnd.on("dragpositionchanged",this.onDragPositionChanged),dnd.on("dragtopchanged",this.onDragTopChanged),dnd.on("drop",this.onDrop)},DropMixin.prototype.destroyed=function(){dnd.off("dragpositionchanged",this.onDragPositionChanged),dnd.off("dragtopchanged",this.onDragTopChanged),dnd.off("drop",this.onDrop)},DropMixin.prototype.onDragPositionChanged=function(event){this===event.top&&this.$emit("dragover",event)},DropMixin.prototype.onDragTopChanged=function(event){this===event.top&&this.$emit("dragenter",event),this===event.previousTop&&this.$emit("dragleave",event)},DropMixin.prototype.onDrop=function(event){this.dropIn&&this.compatibleMode&&this.dropAllowed&&this.doDrop(event)},DropMixin.prototype.doDrop=function(event){this.$emit("drop",event),event.source.$emit(this.mode,event)},DropMixin.prototype.mounted=function(){var el=this.$el,comp=this;el.addEventListener("easy-dnd-move",(function(e){dnd.mouseMove(e,comp)}))},prototypeAccessors.compatibleMode.get=function(){return this.dragInProgress?"copy"===this.mode||dnd.sourceListeners.hasOwnProperty(this.mode):null},prototypeAccessors.dropIn.get=function(){return this.dragInProgress?this.dragTop===this:null},prototypeAccessors.typeAllowed.get=function(){return this.dragInProgress?this.effectiveAcceptsType(this.dragType):null},prototypeAccessors.dropAllowed.get=function(){return this.dragInProgress&&this.typeAllowed?this.compatibleMode&&this.effectiveAcceptsData(this.dragData,this.dragType):null},prototypeAccessors.cssClasses.get=function(){var clazz={"dnd-drop":!0};return null!==this.dropIn&&(clazz=Object.assign({},clazz,{"drop-in":this.dropIn,"drop-out":!this.dropIn})),null!==this.typeAllowed&&(clazz=Object.assign({},clazz,{"type-allowed":this.typeAllowed,"type-forbidden":!this.typeAllowed})),null!==this.dropAllowed&&(clazz=Object.assign({},clazz,{"drop-allowed":this.dropAllowed,"drop-forbidden":!this.dropAllowed})),clazz},prototypeAccessors.cssStyle.get=function(){return this.dropAllowed&&this.dropIn?{cursor:this.cursor+" !important"}:{cursor:"inherit"}},DropMixin.prototype.candidate=function(type,data,source){return this.effectiveAcceptsType(type)},DropMixin.prototype.createDragImage=function(){var image;if(this.$refs["drag-image"]){var el=this.$refs["drag-image"];(image=1!==el.childElementCount?createDragImage(el):createDragImage(el.children.item(0))).__opacity=this.dragImageOpacity}else image="source";return image},Object.defineProperties(DropMixin.prototype,prototypeAccessors),DropMixin}(DragAwareMixin$1);__decorate([(0,_vuePropertyDecorator.Prop)({default:function(){return function(){return!0}},type:[String,Array,Function]}),__metadata("design:type",Object)],DropMixin.prototype,"acceptsType",void 0),__decorate([(0,_vuePropertyDecorator.Prop)({default:function(){return!0},type:Function}),__metadata("design:type",Object)],DropMixin.prototype,"acceptsData",void 0),__decorate([(0,_vuePropertyDecorator.Prop)({default:"pointer"}),__metadata("design:type",String)],DropMixin.prototype,"cursor",void 0),__decorate([(0,_vuePropertyDecorator.Prop)({default:"copy"}),__metadata("design:type",String)],DropMixin.prototype,"mode",void 0),__decorate([(0,_vuePropertyDecorator.Prop)({default:.7,type:Number}),__metadata("design:type",Object)],DropMixin.prototype,"dragImageOpacity",void 0);var DropMixin$1=DropMixin=__decorate([(0,_vuePropertyDecorator.Component)({name:"DropMixin"}),__metadata("design:paramtypes",[])],DropMixin);_exports.DropMixin=DropMixin$1;var Drop=function(DropMixin){function Drop(){DropMixin.apply(this,arguments)}DropMixin&&(Drop.__proto__=DropMixin),Drop.prototype=Object.create(DropMixin&&DropMixin.prototype),Drop.prototype.constructor=Drop;var prototypeAccessors={showDragImage:{configurable:!0}};return prototypeAccessors.showDragImage.get=function(){return this.dragInProgress&&this.typeAllowed&&this.$scopedSlots["drag-image"]},Object.defineProperties(Drop.prototype,prototypeAccessors),Drop}(DropMixin$1);__decorate([(0,_vuePropertyDecorator.Prop)({default:"div",type:[String,Object,Function]}),__metadata("design:type",Object)],Drop.prototype,"tag",void 0);var Drop$1=normalizeComponent_1({render:function(){var _vm=this,_h=_vm.$createElement,_c=_vm._self._c||_h;return _c(_vm.tag,_vm._g(_vm._b({tag:"component",class:_vm.cssClasses,style:_vm.cssStyle,scopedSlots:_vm._u([_vm._l(_vm.$scopedSlots,(function(_,slot){return{key:slot,fn:function(scope){return[_vm._t(slot,null,null,scope)]}}}))],null,!0)},"component",_vm.$attrs,!1),_vm.$listeners),[_vm._t("default"),_vm._v(" "),_vm._v(" "),_vm.showDragImage?_c("div",{ref:"drag-image",staticClass:"__drag-image"},[_vm._t("drag-image",null,{type:_vm.dragType,data:_vm.dragData})],2):_vm._e()],2)},staticRenderFns:[]},(function(inject){inject&&(inject("data-v-4eedfece_0",{source:".drop-allowed.drop-in *{cursor:inherit!important}.drop-forbidden.drop-in,.drop-forbidden.drop-in *{cursor:no-drop!important}",map:void 0,media:void 0}),inject("data-v-4eedfece_1",{source:".__drag-image[data-v-4eedfece]{position:fixed;top:-10000px;left:-10000px;will-change:left,top}",map:void 0,media:void 0}))}),Drop=__decorate([(0,_vuePropertyDecorator.Component)({name:"Drop"})],Drop),"data-v-4eedfece",!1,undefined,browser,void 0);_exports.Drop=Drop$1;var DropMask=function(DragAwareMixin){function DropMask(){DragAwareMixin.apply(this,arguments),this.isDropMask=!0}return DragAwareMixin&&(DropMask.__proto__=DragAwareMixin),DropMask.prototype=Object.create(DragAwareMixin&&DragAwareMixin.prototype),DropMask.prototype.constructor=DropMask,DropMask.prototype.mounted=function(){var el=this.$el,comp=this;el.addEventListener("easy-dnd-move",(function(e){dnd.mouseMove(e,comp)}))},DropMask.prototype.createDragImage=function(){return"source"},DropMask}(DragAwareMixin$1);__decorate([(0,_vuePropertyDecorator.Prop)({default:"div",type:[String,Object,Function]}),__metadata("design:type",Object)],DropMask.prototype,"tag",void 0);var DropMask$1=normalizeComponent_1({render:function(){var _vm=this,_h=_vm.$createElement;return(_vm._self._c||_h)(_vm.tag,_vm._g(_vm._b({tag:"component",scopedSlots:_vm._u([_vm._l(_vm.$scopedSlots,(function(_,slot){return{key:slot,fn:function(scope){return[_vm._t(slot,null,null,scope)]}}}))],null,!0)},"component",_vm.$attrs,!1),_vm.$listeners),[_vm._t("default")],2)},staticRenderFns:[]},undefined,DropMask=__decorate([(0,_vuePropertyDecorator.Component)({name:"DropMask"})],DropMask),undefined,!1,undefined,void 0,void 0);_exports.DropMask=DropMask$1;var DragImagesManager=function(Vue){function DragImagesManager(){Vue.call(this),this.selfTransform=null,this.clones=null,this.source=null,this.sourcePos=null,this.sourceClone=null,dnd.on("dragstart",this.onDragStart),dnd.on("dragtopchanged",this.onDragTopChanged),dnd.on("dragpositionchanged",this.onDragPositionChanged),dnd.on("dragend",this.onDragEnd)}return Vue&&(DragImagesManager.__proto__=Vue),DragImagesManager.prototype=Object.create(Vue&&Vue.prototype),DragImagesManager.prototype.constructor=DragImagesManager,DragImagesManager.prototype.onDragStart=function(event){this.sourcePos={x:event.source.$el.getBoundingClientRect().left,y:event.source.$el.getBoundingClientRect().top},this.selfTransform="translate(-"+(event.position.x-this.sourcePos.x)+"px, -"+(event.position.y-this.sourcePos.y)+"px)",this.clones=new Map,this.source=event.source},DragImagesManager.prototype.onDragEnd=function(event){var this$1$1=this;Vue.nextTick((function(){if(!event.success&&this$1$1.source.goBack){var img=this$1$1.switch(null);window.requestAnimationFrame((function(){img.style.transition="all 0.5s",window.requestAnimationFrame((function(){img.style.left=this$1$1.sourcePos.x+"px",img.style.top=this$1$1.sourcePos.y+"px",img.style.transform="translate(0,0)";img.addEventListener("transitionend",(function handler(){this$1$1.cleanUp(),img.removeEventListener("transitionend",handler)}))}))}))}else this$1$1.cleanUp()}))},DragImagesManager.prototype.cleanUp=function(){this.clones.forEach((function(clone){clone.remove()})),null!==this.sourceClone&&this.sourceClone.remove(),this.selfTransform=null,this.clones=null,this.source=null,this.sourceClone=null,this.sourcePos=null},DragImagesManager.prototype.onDragTopChanged=function(event){this.switch(event.top)},DragImagesManager.prototype.switch=function(top){var activeClone;if(this.clones.forEach((function(clone){clone.style.opacity="0"})),this.sourceClone&&(this.sourceClone.style.opacity="0"),null===top)activeClone=this.getSourceClone();else{if(!this.clones.has(top)){var clone=top.createDragImage(this.selfTransform);"source"===clone?clone=this.getSourceClone():null!==clone&&(clone.style.opacity="0",document.body.append(clone)),this.clones.set(top,clone)}activeClone=this.clones.get(top)}return null!==activeClone&&(activeClone.offsetWidth,activeClone.style.opacity=activeClone.__opacity,activeClone.style.visibility="visible"),activeClone},DragImagesManager.prototype.getSourceClone=function(){return null===this.sourceClone&&(this.sourceClone=this.source.createDragImage(this.selfTransform),this.sourceClone.style.opacity="0",document.body.append(this.sourceClone)),this.sourceClone},DragImagesManager.prototype.onDragPositionChanged=function(event){this.clones.forEach((function(clone){clone.style.left=dnd.position.x+"px",clone.style.top=dnd.position.y+"px"})),this.sourceClone&&(this.sourceClone.style.left=dnd.position.x+"px",this.sourceClone.style.top=dnd.position.y+"px")},DragImagesManager}(_vuePropertyDecorator.Vue);_exports.DragImagesManager=DragImagesManager,_exports.DragImagesManager=DragImagesManager=__decorate([(0,_vuePropertyDecorator.Component)({name:"DragImagesManager"}),__metadata("design:paramtypes",[])],DragImagesManager),new DragImagesManager;var DragFeedback=function(Vue){function DragFeedback(){Vue.apply(this,arguments)}return Vue&&(DragFeedback.__proto__=Vue),DragFeedback.prototype=Object.create(Vue&&Vue.prototype),DragFeedback.prototype.constructor=DragFeedback,DragFeedback}(_vuePropertyDecorator.Vue),DragFeedback$1=normalizeComponent_1({render:function(){var _h=this.$createElement;return(this._self._c||_h)("div",{staticClass:"DragFeedback"},[this._t("default")],2)},staticRenderFns:[]},undefined,DragFeedback=__decorate([(0,_vuePropertyDecorator.Component)({name:"DragFeedback"})],DragFeedback),"data-v-0589f3cb",!1,undefined,void 0,void 0),Grid=function(collection,upToIndex,row,fromIndex){this.magnets=[];for(var index=0,i=0,list=collection;i<list.length;i+=1){var child=list[i];if(index>upToIndex)break;var rect=child.getBoundingClientRect(),hasNestedDrop=child.classList.contains("dnd-drop")||child.getElementsByClassName("dnd-drop").length>0,horizontal=null;if(hasNestedDrop){if("auto"===row)throw new Error("Easy-DnD error : a drop list is missing one of these attributes : 'row' or 'column'.");horizontal="row"===row}null===fromIndex?this.magnets.push(hasNestedDrop?this.before(rect,horizontal):this.center(rect)):this.magnets.push(hasNestedDrop?(fromIndex<index?this.after:this.before)(rect,horizontal):this.center(rect)),index++}};Grid.prototype.center=function(rect){return{x:rect.left+rect.width/2,y:rect.top+rect.height/2}},Grid.prototype.before=function(rect,horizontal){return horizontal?{x:rect.left,y:rect.top+rect.height/2}:{x:rect.left+rect.width/2,y:rect.top}},Grid.prototype.after=function(rect,horizontal){return horizontal?{x:rect.left+rect.width,y:rect.top+rect.height/2}:{x:rect.left+rect.width/2,y:rect.top+rect.height}},Grid.prototype.closestIndex=function(position){for(var minDist=999999,index=-1,i=0;i<this.magnets.length;i++){var magnet=this.magnets[i],dist=Math.sqrt(Math.pow(magnet.x-position.x,2)+Math.pow(magnet.y-position.y,2));dist<minDist&&(minDist=dist,index=i)}return index};_exports.DnDEvent=function(){};var ReorderEvent=function(from,to){this.from=from,this.to=to};_exports.ReorderEvent=ReorderEvent,ReorderEvent.prototype.apply=function(array){var tmp=array[this.from];array.splice(this.from,1),array.splice(this.to,0,tmp)};var InsertEvent=function(type,data,index){this.type=type,this.data=data,this.index=index};_exports.InsertEvent=InsertEvent;var DropList=function(DropMixin){function DropList(){DropMixin.apply(this,arguments),this.grid=null,this.forbiddenKeys=[],this.feedbackKey=null,this.fromIndex=null}DropMixin&&(DropList.__proto__=DropMixin),DropList.prototype=Object.create(DropMixin&&DropMixin.prototype),DropList.prototype.constructor=DropList;var prototypeAccessors={rootTag:{configurable:!0},rootProps:{configurable:!0},rootListeners:{configurable:!0},direction:{configurable:!0},reordering:{configurable:!0},closestIndex:{configurable:!0},dropAllowed:{configurable:!0},itemsBeforeFeedback:{configurable:!0},itemsAfterFeedback:{configurable:!0},itemsBeforeReorderingFeedback:{configurable:!0},itemsAfterReorderingFeedback:{configurable:!0},reorderedItems:{configurable:!0},clazz:{configurable:!0},style:{configurable:!0},showDragFeedback:{configurable:!0},showInsertingDragImage:{configurable:!0},showReorderingDragImage:{configurable:!0},hasReorderingFeedback:{configurable:!0}};return prototypeAccessors.rootTag.get=function(){return this.noAnimations?this.tag?this.tag:"div":"transition-group"},prototypeAccessors.rootProps.get=function(){return this.noAnimations?this.$attrs:{tag:this.tag,duration:{enter:0,leave:0},css:!1}},prototypeAccessors.rootListeners.get=function(){return this.noAnimations?this.$listeners:{}},DropList.prototype.created=function(){dnd.on("dragstart",this.onDragStart),dnd.on("dragend",this.onDragEnd)},prototypeAccessors.direction.get=function(){return this.row?"row":this.column?"column":"auto"},DropList.prototype.destroyed=function(){dnd.off("dragstart",this.onDragStart),dnd.off("dragend",this.onDragEnd)},DropList.prototype.onDragStart=function(event){var this$1$1=this;this.candidate(dnd.type,dnd.data,dnd.source)&&(this.reordering?(this.fromIndex=Array.prototype.indexOf.call(event.source.$el.parentElement.children,event.source.$el),this.grid=this.computeReorderingGrid()):this.$nextTick((function(){this$1$1.grid=this$1$1.computeInsertingGrid(),this$1$1.feedbackKey=this$1$1.computeFeedbackKey(),this$1$1.forbiddenKeys=this$1$1.computeForbiddenKeys()})))},DropList.prototype.onDragEnd=function(){this.fromIndex=null,this.feedbackKey=null,this.forbiddenKeys=null,this.grid=null},prototypeAccessors.reordering.get=function(){return dnd.inProgress?dnd.source.$el.parentElement===this.$el&&this.$listeners.hasOwnProperty("reorder"):null},prototypeAccessors.closestIndex.get=function(){return this.grid?this.grid.closestIndex(dnd.position):null},prototypeAccessors.dropAllowed.get=function(){return this.dragInProgress?this.reordering?this.items.length>1:!!DropMixin.options.computed.dropAllowed.get.call(this)&&(null!==this.forbiddenKeys&&null!==this.feedbackKey?!this.forbiddenKeys.includes(this.feedbackKey):null):null},prototypeAccessors.itemsBeforeFeedback.get=function(){return 0===this.closestIndex?[]:this.items.slice(0,this.closestIndex)},prototypeAccessors.itemsAfterFeedback.get=function(){return this.closestIndex===this.items.length?[]:this.items.slice(this.closestIndex)},prototypeAccessors.itemsBeforeReorderingFeedback.get=function(){return this.closestIndex<=this.fromIndex?this.items.slice(0,this.closestIndex):this.items.slice(0,this.closestIndex+1)},prototypeAccessors.itemsAfterReorderingFeedback.get=function(){return this.closestIndex<=this.fromIndex?this.items.slice(this.closestIndex):this.items.slice(this.closestIndex+1)},prototypeAccessors.reorderedItems.get=function(){var toIndex=this.closestIndex,reordered=[].concat(this.items),temp=reordered[this.fromIndex];return reordered.splice(this.fromIndex,1),reordered.splice(toIndex,0,temp),reordered},prototypeAccessors.clazz.get=function(){return Object.assign({},{"drop-list":!0,reordering:!0===this.reordering,inserting:!1===this.reordering},!1===this.reordering?this.cssClasses:{"dnd-drop":!0})},prototypeAccessors.style.get=function(){return Object.assign({},!1===this.reordering?this.cssStyle:{})},prototypeAccessors.showDragFeedback.get=function(){return this.dragInProgress&&this.typeAllowed&&!this.reordering},prototypeAccessors.showInsertingDragImage.get=function(){return this.dragInProgress&&this.typeAllowed&&!this.reordering&&this.$scopedSlots.hasOwnProperty("drag-image")},prototypeAccessors.showReorderingDragImage.get=function(){return this.dragInProgress&&this.reordering&&this.$scopedSlots.hasOwnProperty("reordering-drag-image")},DropList.prototype.doDrop=function(event){this.reordering?this.fromIndex!==this.closestIndex&&this.$emit("reorder",new ReorderEvent(this.fromIndex,this.closestIndex)):(DropMixin.options.methods.doDrop.call(this,event),this.$emit("insert",new InsertEvent(event.type,event.data,this.closestIndex)))},DropList.prototype.candidate=function(type,data,source){for(var ref,i=arguments.length,argsArray=Array(i);i--;)argsArray[i]=arguments[i];return(ref=DropMixin.options.methods.candidate).call.apply(ref,[this].concat(argsArray))&&(this.$listeners.hasOwnProperty("insert")||this.$listeners.hasOwnProperty("drop"))||this.reordering},DropList.prototype.computeForbiddenKeys=function(){return(this.noAnimations?[]:this.$children[0].$vnode.context.$children[0].$slots.default).map((function(vn){return vn.key})).filter((function(k){return void 0!==k&&"drag-image"!==k&&"drag-feedback"!==k}))},DropList.prototype.computeFeedbackKey=function(){return this.$refs.feedback.$slots.default[0].key},prototypeAccessors.hasReorderingFeedback.get=function(){return this.$scopedSlots.hasOwnProperty("reordering-feedback")},DropList.prototype.computeInsertingGrid=function(){var feedbackParent=this.$refs.feedback.$el;0==feedbackParent.children.length&&console.warn("Feedback template has no children",$feedbackParent,this);var clone=feedbackParent.children[0].cloneNode(!0),tg=this.$el;tg.children.length>this.items.length?tg.insertBefore(clone,tg.children[this.items.length]):tg.append(clone);var grid=new Grid(tg.children,this.items.length,this.direction,null);return clone.remove(),grid},DropList.prototype.computeReorderingGrid=function(){var tg=this.$el;return new Grid(tg.children,this.items.length-1,this.direction,this.fromIndex)},DropList.prototype.createDragImage=function(){var image;if(this.$refs["drag-image"]){var el=this.$refs["drag-image"],clone=(1!==el.childElementCount?el:el.children.item(0)).cloneNode(!0);this.$el.append(clone),image=createDragImage(clone),clone.remove(),image.__opacity=this.dragImageOpacity}else image="source";return image},Object.defineProperties(DropList.prototype,prototypeAccessors),DropList}(DropMixin$1);__decorate([(0,_vuePropertyDecorator.Prop)({default:"div",type:[String,Object,Function]}),__metadata("design:type",Object)],DropList.prototype,"tag",void 0),__decorate([(0,_vuePropertyDecorator.Prop)(),__metadata("design:type",Array)],DropList.prototype,"items",void 0),__decorate([(0,_vuePropertyDecorator.Prop)({default:null}),__metadata("design:type",Boolean)],DropList.prototype,"row",void 0),__decorate([(0,_vuePropertyDecorator.Prop)({default:null,type:Boolean}),__metadata("design:type",Boolean)],DropList.prototype,"column",void 0),__decorate([(0,_vuePropertyDecorator.Prop)({default:!1,type:Boolean}),__metadata("design:type",Boolean)],DropList.prototype,"noAnimations",void 0);var DropList$1=normalizeComponent_1({render:function(){var _vm=this,_h=_vm.$createElement,_c=_vm._self._c||_h;return _c(_vm.rootTag,_vm._g(_vm._b({tag:"component",class:_vm.clazz,style:_vm.style},"component",_vm.rootProps,!1),_vm.rootListeners),[_vm.dropIn&&_vm.dropAllowed?[_vm.reordering?[_vm.hasReorderingFeedback?[_vm._l(_vm.itemsBeforeReorderingFeedback,(function(item){return _vm._t("item",null,{item:item})})),_vm._v(" "),_vm._t("reordering-feedback",null,{item:_vm.items[_vm.fromIndex]}),_vm._v(" "),_vm._l(_vm.itemsAfterReorderingFeedback,(function(item){return _vm._t("item",null,{item:item})}))]:[_vm._l(_vm.reorderedItems,(function(item,index){return _vm._t("item",null,{item:item,reorder:index===_vm.closestIndex})}))]]:[_vm._l(_vm.itemsBeforeFeedback,(function(item){return _vm._t("item",null,{item:item,reorder:!1})})),_vm._v(" "),_vm._t("feedback",null,{data:_vm.dragData,type:_vm.dragType}),_vm._v(" "),_vm._l(_vm.itemsAfterFeedback,(function(item){return _vm._t("item",null,{item:item,reorder:!1})}))]]:[_vm._l(_vm.items,(function(item){return _vm._t("item",null,{item:item,reorder:!1})}))],_vm._v(" "),_vm.showDragFeedback?_c("drag-feedback",{key:"drag-feedback",ref:"feedback",staticClass:"__feedback"},[_vm._t("feedback",null,{data:_vm.dragData,type:_vm.dragType})],2):_vm._e(),_vm._v(" "),_vm.showInsertingDragImage?_c("div",{key:"inserting-drag-image",ref:"drag-image",staticClass:"__drag-image"},[_vm._t("drag-image",null,{type:_vm.dragType,data:_vm.dragData})],2):_vm._e(),_vm._v(" "),_vm.showReorderingDragImage?_c("div",{key:"reordering-drag-image",ref:"drag-image",staticClass:"__drag-image"},[_vm._t("reordering-drag-image",null,{item:_vm.items[_vm.fromIndex]})],2):_vm._e(),_vm._v(" "),_c("div",{key:"drop-list-content"},[_vm._t("default")],2)],2)},staticRenderFns:[]},(function(inject){inject&&(inject("data-v-56f28757_0",{source:".drop-list[data-v-56f28757]>*{transition:transform .2s}.__feedback[data-v-56f28757]{display:none}.__drag-image[data-v-56f28757]{position:fixed;top:-10000px;left:-10000px;will-change:left,top}",map:void 0,media:void 0}),inject("data-v-56f28757_1",{source:".drop-allowed.drop-in *{cursor:inherit!important}.drop-forbidden.drop-in,.drop-forbidden.drop-in *{cursor:no-drop!important}",map:void 0,media:void 0}))}),DropList=__decorate([(0,_vuePropertyDecorator.Component)({components:{DragFeedback:DragFeedback$1},name:"DropList"})],DropList),"data-v-56f28757",!1,undefined,browser,void 0);_exports.DropList=DropList$1}));
//# sourceMappingURL=vue-easy-dnd.min.js.map