From b0bf34864adf7a7723f96fb0a0d56f8721f39e80 Mon Sep 17 00:00:00 2001 From: PMKuipers Date: Mon, 21 Aug 2023 22:04:51 +0200 Subject: [PATCH] Preparing new vue-easy-dnd library --- .../vue-easy-dnd/vue-easy-dnd.esm.min.js | 3 + .../vue-easy-dnd/vue-easy-dnd.esm.min.js.map | 1 + amd/src/vue-easy-dnd/vue-easy-dnd.esm.js | 1841 +++++++++++++++++ thirdpartylibs.xml | 50 + 4 files changed, 1895 insertions(+) create mode 100644 amd/build/vue-easy-dnd/vue-easy-dnd.esm.min.js create mode 100644 amd/build/vue-easy-dnd/vue-easy-dnd.esm.min.js.map create mode 100644 amd/src/vue-easy-dnd/vue-easy-dnd.esm.js create mode 100644 thirdpartylibs.xml diff --git a/amd/build/vue-easy-dnd/vue-easy-dnd.esm.min.js b/amd/build/vue-easy-dnd/vue-easy-dnd.esm.min.js new file mode 100644 index 0000000..744dfed --- /dev/null +++ b/amd/build/vue-easy-dnd/vue-easy-dnd.esm.min.js @@ -0,0 +1,3 @@ +define("local_treestudyplan/vue-easy-dnd/vue-easy-dnd.esm",["exports","vue"],(function(_exports,_vue){function _toConsumableArray(arr){return function(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}(arr)||function(iter){if("undefined"!=typeof Symbol&&null!=iter[Symbol.iterator]||null!=iter["@@iterator"])return Array.from(iter)}(arr)||_unsupportedIterableToArray(arr)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}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 _slicedToArray(arr,i){return function(arr){if(Array.isArray(arr))return arr}(arr)||function(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null==_i)return;var _s,_e,_arr=[],_n=!0,_d=!1;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!i||_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{_n||null==_i.return||_i.return()}finally{if(_d)throw _e}}return _arr}(arr,i)||_unsupportedIterableToArray(arr,i)||function(){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 _createForOfIteratorHelper(o,allowArrayLike){var it="undefined"!=typeof Symbol&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&"number"==typeof o.length){it&&(o=it);var i=0,F=function(){};return{s:F,n:function(){return i>=o.length?{done:!0}:{done:!1,value:o[i++]}},e:function(_e2){throw _e2},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var err,normalCompletion=!0,didErr=!1;return{s:function(){it=it.call(o)},n:function(){var step=it.next();return normalCompletion=step.done,step},e:function(_e3){didErr=!0,err=_e3},f:function(){try{normalCompletion||null==it.return||it.return()}finally{if(didErr)throw err}}}}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i>>0,1):n.set(t,[]))},emit:function(t,e){var i=n.get(t);i&&i.slice().map((function(n){n(e)})),(i=n.get("*"))&&i.slice().map((function(n){n(t,e)}))}}),_defineProperty(this,"success",null)}return _createClass(DnD,[{key:"startDrag",value: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.inProgress=!0,this.emit(event,"dragstart"),this.emit(event,"dragtopchanged",{previousTop:null})}},{key:"resetVariables",value:function(){this.inProgress=!1,this.data=null,this.source=null,this.position=null,this.success=null}},{key:"stopDrag",value: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.resetVariables()}},{key:"cancelDrag",value:function(event){this.success=!1,this.emit(event,"dragend"),this.resetVariables()}},{key:"mouseMove",value: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")}}},{key:"emit",value:function(native,event){var data=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.eventBus.emit(event,_objectSpread({type:this.type,data:this.data,top:this.top,source:this.source,position:this.position,success:this.success,native:native},data))}},{key:"on",value:function(event,callback){this.eventBus.on(event,callback)}},{key:"off",value:function(event,callback){this.eventBus.off(event,callback)}}]),DnD}(),dnd=(0,_vue.reactive)(new DnD);_exports.dnd=dnd;var DragAwareMixin={data:function(){return{isDropMask:!1}},computed:{dragInProgress:function(){return dnd.inProgress},dragData:function(){return dnd.data},dragType:function(){return dnd.type},dragPosition:function(){return dnd.position},dragSource:function(){return dnd.source},dragTop:function(){return dnd.top}}};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 _step,computedStyle=window.getComputedStyle(src),_iterator=_createForOfIteratorHelper(computedStyle);try{for(_iterator.s();!(_step=_iterator.n()).done;){var key=_step.value;if("width"===key){var width="border-box"===computedStyle.getPropertyValue("box-sizing")?src.clientWidth:src.clientWidth-parseFloat(computedStyle.paddingLeft)-parseFloat(computedStyle.paddingRight);destination.style.setProperty("width",width+"px")}else if("height"===key){var height="border-box"===computedStyle.getPropertyValue("box-sizing")?src.clientHeight:src.clientHeight-parseFloat(computedStyle.paddingTop)-parseFloat(computedStyle.paddingBottom);destination.style.setProperty("height",height+"px")}else destination.style.setProperty(key,computedStyle.getPropertyValue(key),computedStyle.getPropertyPriority(key))}}catch(err){_iterator.e(err)}finally{_iterator.f()}destination.style.pointerEvents="none"}_exports.DragAwareMixin=DragAwareMixin;var regex=/(auto|scroll)/,style=function(node,prop){return getComputedStyle(node,null).getPropertyValue(prop)},scrollparent=function scrollparent(node){return node&&node!==document.body?function(node){return regex.test(style(node,"overflow")+style(node,"overflow-y")+style(node,"overflow-x"))}(node)?node:scrollparent(node.parentNode):document.body},timer=null;function cancelScrollAction(){clearTimeout(timer)}function performEdgeScroll(event,container,clientX,clientY,edgeSize){if(!container||!edgeSize)return cancelScrollAction(),!1;var rect=container.getBoundingClientRect(),isBody=container===document.body,viewportX=clientX-rect.left,viewportY=clientY-rect.top;isBody&&(viewportX=clientX,viewportY=clientY);var viewportWidth=rect.width,viewportHeight=rect.height;isBody&&(viewportWidth=document.documentElement.clientWidth,viewportHeight=document.documentElement.clientHeight);var edgeTop=edgeSize,edgeLeft=edgeSize,edgeBottom=viewportHeight-edgeSize,edgeRight=viewportWidth-edgeSize,isInLeftEdge=viewportXedgeRight,isInTopEdge=viewportYedgeBottom;if(!(isInLeftEdge||isInRightEdge||isInTopEdge||isInBottomEdge))return cancelScrollAction(),!1;var documentWidth=Math.max(container.scrollWidth,container.offsetWidth,container.clientWidth),documentHeight=Math.max(container.scrollHeight,container.offsetHeight,container.clientHeight),maxScrollX=documentWidth-viewportWidth,maxScrollY=documentHeight-viewportHeight;return function checkForWindowScroll(){cancelScrollAction(),function(){var currentScrollX=container.scrollLeft,currentScrollY=container.scrollTop;isBody&&(currentScrollX=window.pageXOffset,currentScrollY=window.pageYOffset);var canScrollUp=currentScrollY>0,canScrollDown=currentScrollY0,canScrollRight=currentScrollX0&&window.navigator&&window.navigator.vibrate&&window.navigator.vibrate(this.vibration)},onMouseDown:function(e){var _this=this,target=null,goodButton=!1;if("mousedown"===e.type){var mouse=e;target=e.target,goodButton=1===mouse.buttons}else{target=e.touches[0].target,goodButton=!0}if(!this.disabled&&null===this.downEvent&&goodButton&&(!target.matches(".dnd-no-drag, .dnd-no-drag *")&&(!this.handle||target.matches(this.handle+", "+this.handle+" *")))){if(this.scrollContainer=scrollparent(target),this.initialUserSelect=document.body.style.userSelect,document.documentElement.style.userSelect="none",this.dragStarted=!1,this.downEvent=e,"mousedown"===this.downEvent.type){var _mouse=e;this.startPosition={x:_mouse.clientX,y:_mouse.clientY}}else{var _touch=e;this.startPosition={x:_touch.touches[0].clientX,y:_touch.touches[0].clientY}}this.delay?(this.dragInitialised=!1,clearTimeout(this.delayTimer),this.delayTimer=setTimeout((function(){_this.dragInitialised=!0,_this.performVibration()}),this.delay)):(this.dragInitialised=!0,this.performVibration()),document.addEventListener("click",this.onMouseClick,!0),document.addEventListener("mouseup",this.onMouseUp),document.addEventListener("touchend",this.onMouseUp),document.addEventListener("selectstart",this.onSelectStart),document.addEventListener("keyup",this.onKeyUp),setTimeout((function(){document.addEventListener("mousemove",_this.onMouseMove),document.addEventListener("touchmove",_this.onMouseMove,{passive:!1}),document.addEventListener("easy-dnd-move",_this.onEasyDnDMove)}),0),e.stopPropagation()}},onMouseClick:function(e){if(this.ignoreNextClick)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),this.ignoreNextClick=!1,!1},onMouseMove:function(e){if(null!==this.downEvent&&("touchstart"!==this.downEvent.type||"mousemove"!==e.type)){var target=null,x=null,y=null;if("touchmove"===e.type){var touch=e;if(x=touch.touches[0].clientX,y=touch.touches[0].clientY,!(target=document.elementFromPoint(x,y)))return}else{var mouse=e;x=mouse.clientX,y=mouse.clientY,target=mouse.target}var dist=Math.sqrt(Math.pow(this.startPosition.x-x,2)+Math.pow(this.startPosition.y-y,2));if(!this.dragStarted&&dist>this.delta&&(this.dragInitialised?(this.ignoreNextClick=!0,this.dragStarted=!0,dnd.startDrag(this,this.downEvent,this.startPosition.x,this.startPosition.y,this.type,this.data),document.documentElement.classList.add("drag-in-progress")):clearTimeout(this.delayTimer)),this.dragStarted){var currEdgeSize=this.dragTop&&void 0!==this.dragTop.$props.scrollingEdgeSize?this.dragTop.$props.scrollingEdgeSize:this.scrollingEdgeSize;if(currEdgeSize)performEdgeScroll(0,this.dragTop?scrollparent(this.dragTop.$el):this.scrollContainer,x,y,currEdgeSize);else cancelScrollAction();var custom=new CustomEvent("easy-dnd-move",{bubbles:!0,cancelable:!0,detail:{x:x,y:y,native:e}});target.dispatchEvent(custom)}this.dragInitialised&&e.cancelable&&e.preventDefault()}},onEasyDnDMove:function(e){dnd.mouseMove(e,null)},onMouseUp:function(e){var _this2=this;"touchstart"===this.downEvent.type&&"mouseup"===e.type||setTimeout((function(){_this2.cancelDragActions(),_this2.dragStarted&&dnd.stopDrag(e),_this2.finishDrag()}),0)},onKeyUp:function(e){var _this3=this;"Escape"===e.key&&(this.cancelDragActions(),setTimeout((function(){dnd.cancelDrag(e),_this3.finishDrag()}),0))},cancelDragActions:function(){this.dragInitialised=!1,clearTimeout(this.delayTimer),cancelScrollAction()},finishDrag:function(){this.downEvent=null,this.scrollContainer=null,this.dragStarted&&document.documentElement.classList.remove("drag-in-progress"),document.removeEventListener("click",this.onMouseClick,!0),document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("touchmove",this.onMouseMove),document.removeEventListener("easy-dnd-move",this.onEasyDnDMove),document.removeEventListener("mouseup",this.onMouseUp),document.removeEventListener("touchend",this.onMouseUp),document.removeEventListener("selectstart",this.onSelectStart),document.removeEventListener("keyup",this.onKeyUp),document.documentElement.style.userSelect=this.initialUserSelect},dndDragStart:function(ev){ev.source===this&&this.$emit("dragstart",ev)},dndDragEnd:function(ev){ev.source===this&&this.$emit("dragend",ev)},createDragImage:function(selfTransform){var image;if(this.$slots["drag-image"]){var el=this.$refs["drag-image"]||document.createElement("div");image=1!==el.childElementCount?_createDragImage(el):_createDragImage(el.children.item(0))}else(image=_createDragImage(this.$el)).style.transform=selfTransform;return this.dragClass&&image.classList.add(this.dragClass),image.classList.add("dnd-ghost"),image.__opacity=this.dragImageOpacity,image}},created:function(){dnd.on("dragstart",this.dndDragStart),dnd.on("dragend",this.dndDragEnd)},mounted:function(){this.$el.addEventListener("mousedown",this.onMouseDown),this.$el.addEventListener("touchstart",this.onMouseDown)},beforeUnmount:function(){dnd.off("dragstart",this.dndDragStart),dnd.off("dragend",this.dndDragEnd),this.$el.removeEventListener("mousedown",this.onMouseDown),this.$el.removeEventListener("touchstart",this.onMouseDown)}};_exports.DragMixin=DragMixin;var script$4={name:"Drag",mixins:[DragMixin],props:{tag:{type:[String,Object,Function],default:"div"}},computed:{dynamicSlots:function(){return Object.entries(this.$slots).filter((function(_ref){var key=_slicedToArray(_ref,1)[0];return"drag-image"!==key&&"default"!==key}))}}};_exports.Drag=script$4;var _hoisted_1$2={key:0,ref:"drag-image",class:"__drag-image"};function _dropAllowed(inst){return inst.dragInProgress&&inst.typeAllowed?inst.compatibleMode&&inst.effectiveAcceptsData(inst.dragData,inst.dragType):null}function _doDrop(inst,event){inst.$emit("drop",event),event.source.$emit(inst.mode,event)}function _candidate(inst,type){return inst.effectiveAcceptsType(type)}script$4.render=function(_ctx,_cache,$props,$setup,$data,$options){return(0,_vue.openBlock)(),(0,_vue.createBlock)((0,_vue.resolveDynamicComponent)($props.tag),{class:(0,_vue.normalizeClass)(_ctx.cssClasses)},(0,_vue.createSlots)({default:(0,_vue.withCtx)((function(){return[(0,_vue.renderSlot)(_ctx.$slots,"default",(0,_vue.normalizeProps)((0,_vue.guardReactiveProps)(_ctx.$slots.default||{}))),_ctx.dragInitialised?((0,_vue.openBlock)(),(0,_vue.createElementBlock)("div",_hoisted_1$2,[(0,_vue.renderSlot)(_ctx.$slots,"drag-image")],512)):(0,_vue.createCommentVNode)("v-if",!0)]})),_:2},[(0,_vue.renderList)($options.dynamicSlots,(function(_ref3){var _ref4=_slicedToArray(_ref3,2),slot=_ref4[0],args=_ref4[1];return{name:slot,fn:(0,_vue.withCtx)((function(){return[(0,_vue.renderSlot)(_ctx.$slots,slot,(0,_vue.normalizeProps)((0,_vue.guardReactiveProps)(args)))]}))}}))]),1032,["class"])},script$4.__scopeId="data-v-f87407ce";var DropMixin={mixins:[DragAwareMixin],props:{acceptsType:{type:[String,Array,Function],default:null},acceptsData:{type:Function,default:function(){return!0}},mode:{type:String,default:"copy"},dragImageOpacity:{type:Number,default:.7}},emits:["dragover","dragenter","dragleave","dragend","drop"],data:function(){return{isDrop:!0}},computed:{compatibleMode:function(){return!!this.dragInProgress||null},dropIn:function(){return this.dragInProgress?this.dragTop===this:null},typeAllowed:function(){return this.dragInProgress?this.effectiveAcceptsType(this.dragType):null},dropAllowed:function(){return _dropAllowed(this)},cssClasses:function(){var clazz={"dnd-drop":!0};return null!==this.dropIn&&(clazz["drop-in"]=this.dropIn,clazz["drop-out"]=!this.dropIn),null!==this.typeAllowed&&(clazz["type-allowed"]=this.typeAllowed,clazz["type-forbidden"]=!this.typeAllowed),null!==this.dropAllowed&&(clazz["drop-allowed"]=this.dropAllowed,clazz["drop-forbidden"]=!this.dropAllowed),clazz}},methods:{effectiveAcceptsType:function(type){return null===this.acceptsType||("string"==typeof this.acceptsType||"number"==typeof this.acceptsType?this.acceptsType===type:"object"===_typeof(this.acceptsType)&&Array.isArray(this.acceptsType)?this.acceptsType.includes(type):this.acceptsType(type))},effectiveAcceptsData:function(data,type){return this.acceptsData(data,type)},onDragPositionChanged:function(event){this===event.top&&this.$emit("dragover",event)},onDragTopChanged:function(event){this===event.top&&this.$emit("dragenter",event),this===event.previousTop&&this.$emit("dragleave",event)},onDragEnd:function(event){this===event.top&&this.$emit("dragend",event)},onDrop:function(event){this.dropIn&&this.compatibleMode&&this.dropAllowed&&this.doDrop(event)},doDrop:function(event){_doDrop(this,event)},candidate:function(type){return _candidate(this,type)},createDragImage:function(){var image="source";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,image.classList.add("dnd-ghost")}return image},onDnDMove:function(e){dnd.mouseMove(e,this)}},created:function(){dnd.on("dragpositionchanged",this.onDragPositionChanged),dnd.on("dragtopchanged",this.onDragTopChanged),dnd.on("drop",this.onDrop),dnd.on("dragend",this.onDragEnd)},mounted:function(){this.$el.addEventListener("easy-dnd-move",this.onDnDMove)},beforeUnmount:function(){this.$el.removeEventListener("easy-dnd-move",this.onDnDMove),dnd.off("dragpositionchanged",this.onDragPositionChanged),dnd.off("dragtopchanged",this.onDragTopChanged),dnd.off("drop",this.onDrop),dnd.off("dragend",this.onDragEnd)}};_exports.DropMixin=DropMixin;var script$3={name:"Drop",mixins:[DropMixin],props:{tag:{type:[String,Object,Function],default:"div"}},computed:{dynamicSlots:function(){return Object.entries(this.$slots).filter((function(_ref5){var key=_slicedToArray(_ref5,1)[0];return"drag-image"!==key&&"default"!==key}))},showDragImage:function(){return this.dragInProgress&&this.typeAllowed&&!!this.$slots["drag-image"]}}};_exports.Drop=script$3;var _hoisted_1$1={key:0,ref:"drag-image",class:"__drag-image"};script$3.render=function(_ctx,_cache,$props,$setup,$data,$options){return(0,_vue.openBlock)(),(0,_vue.createBlock)((0,_vue.resolveDynamicComponent)($props.tag),{class:(0,_vue.normalizeClass)(_ctx.cssClasses)},(0,_vue.createSlots)({default:(0,_vue.withCtx)((function(){return[(0,_vue.renderSlot)(_ctx.$slots,"default",(0,_vue.normalizeProps)((0,_vue.guardReactiveProps)(_ctx.$slots.default||{}))),$options.showDragImage?((0,_vue.openBlock)(),(0,_vue.createElementBlock)("div",_hoisted_1$1,[(0,_vue.renderSlot)(_ctx.$slots,"drag-image",{type:_ctx.dragType,data:_ctx.dragData})],512)):(0,_vue.createCommentVNode)("v-if",!0)]})),_:2},[(0,_vue.renderList)($options.dynamicSlots,(function(_ref7){var _ref8=_slicedToArray(_ref7,2),slot=_ref8[0],args=_ref8[1];return{name:slot,fn:(0,_vue.withCtx)((function(){return[(0,_vue.renderSlot)(_ctx.$slots,slot,(0,_vue.normalizeProps)((0,_vue.guardReactiveProps)(args)))]}))}}))]),1032,["class"])},script$3.__scopeId="data-v-12a39e52";var script$2={name:"DropMask",mixins:[DragAwareMixin],props:{tag:{type:[String,Object,Function],default:"div"}},data:function(){return{isDropMask:!0}},mounted:function(){this.$el.addEventListener("easy-dnd-move",this.onDndMove)},beforeUnmount:function(){this.$el.removeEventListener("easy-dnd-move",this.onDndMove)},methods:{createDragImage:function(){return"source"},onDndMove:function(e){dnd.mouseMove(e,this)}}};_exports.DropMask=script$2,script$2.render=function(_ctx,_cache,$props,$setup,$data,$options){return(0,_vue.openBlock)(),(0,_vue.createBlock)((0,_vue.resolveDynamicComponent)($props.tag),null,(0,_vue.createSlots)({_:2},[(0,_vue.renderList)(_ctx.$slots,(function(args,slot){return{name:slot,fn:(0,_vue.withCtx)((function(){return[(0,_vue.renderSlot)(_ctx.$slots,slot,(0,_vue.normalizeProps)((0,_vue.guardReactiveProps)(args)))]}))}}))]),1024)};var script$1={name:"DragFeedback"};_exports.DragFeedback=script$1;var _hoisted_1={class:"DragFeedback"};script$1.render=function(_ctx,_cache,$props,$setup,$data,$options){return(0,_vue.openBlock)(),(0,_vue.createElementBlock)("div",_hoisted_1,[(0,_vue.renderSlot)(_ctx.$slots,"default")])};var Grid=function(){function Grid(collection,upToIndex,direction,fromIndex){_classCallCheck(this,Grid),_defineProperty(this,"reference",void 0),_defineProperty(this,"referenceOriginalPosition",void 0),_defineProperty(this,"magnets",[]),this.reference=collection.item(0).parentNode,this.referenceOriginalPosition={x:this.reference.getBoundingClientRect().left-this.reference.scrollLeft,y:this.reference.getBoundingClientRect().top-this.reference.scrollTop};var _step2,index=0,_iterator2=_createForOfIteratorHelper(collection);try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var child=_step2.value;if(index>upToIndex)break;var rect=child.getBoundingClientRect(),hasNestedDrop=child.classList.contains("dnd-drop")||child.getElementsByClassName("dnd-drop").length>0,horizontal=!1;if(hasNestedDrop){if("auto"===direction)throw"Easy-DnD error : a drop list is missing one of these attributes : 'row' or 'column'.";horizontal="row"===direction}null===fromIndex?this.magnets.push(hasNestedDrop?this.before(rect,horizontal):this.center(rect)):this.magnets.push(hasNestedDrop?(fromIndex1:!!_dropAllowed(this)&&(null===this.forbiddenKeys||null===this.feedbackKey||!this.forbiddenKeys.includes(this.feedbackKey)):null},itemsBeforeFeedback:function(){return 0===this.closestIndex?[]:this.items.slice(0,this.closestIndex)},itemsAfterFeedback:function(){return this.closestIndex===this.items.length?[]:this.items.slice(this.closestIndex)},itemsBeforeReorderingFeedback:function(){return this.closestIndex<=this.fromIndex?this.items.slice(0,this.closestIndex):this.items.slice(0,this.closestIndex+1)},itemsAfterReorderingFeedback:function(){return this.closestIndex<=this.fromIndex?this.items.slice(this.closestIndex):this.items.slice(this.closestIndex+1)},reorderedItems:function(){var toIndex=this.closestIndex,reordered=_toConsumableArray(this.items),temp=reordered[this.fromIndex];return reordered.splice(this.fromIndex,1),reordered.splice(toIndex,0,temp),reordered},clazz:function(){return _objectSpread({"drop-list":!0,reordering:!0===this.reordering,inserting:!1===this.reordering},!1===this.reordering?this.cssClasses:{"dnd-drop":!0})},showDragFeedback:function(){return this.dragInProgress&&this.typeAllowed&&!this.reordering},showInsertingDragImage:function(){return this.dragInProgress&&this.typeAllowed&&!this.reordering&&!!this.$slots["drag-image"]},showReorderingDragImage:function(){return this.dragInProgress&&this.reordering&&!!this.$slots["reordering-drag-image"]},hasReorderingFeedback:function(){return!!this.$slots["reordering-feedback"]},hasEmptySlot:function(){return!!this.$slots.empty}},created:function(){dnd.on("dragstart",this.onDragStart),dnd.on("dragend",this.onDragEnd)},beforeUnmount:function(){dnd.off("dragstart",this.onDragStart),dnd.off("dragend",this.onDragEnd)},methods:{refresh:function(){var _this4=this;this.$nextTick((function(){_this4.grid=_this4.computeInsertingGrid(),_this4.feedbackKey=_this4.computeFeedbackKey(),_this4.forbiddenKeys=_this4.computeForbiddenKeys()}))},onDragStart:function(event){this.candidate(dnd.type)&&(this.reordering?(this.fromIndex=Array.prototype.indexOf.call(event.source.$el.parentElement.children,event.source.$el),this.grid=this.computeReorderingGrid()):this.refresh())},onDragEnd:function(){this.fromIndex=null,this.feedbackKey=null,this.forbiddenKeys=null,this.grid=null},doDrop:function(event){this.reordering?this.fromIndex!==this.closestIndex&&this.$emit("reorder",new ReorderEvent(this.fromIndex,this.closestIndex)):(_doDrop(this,event),this.$emit("insert",new InsertEvent(event.type,event.data,this.closestIndex)))},candidate:function(type){return _candidate(this,type)||this.reordering},computeForbiddenKeys:function(){return(this.noAnimations?[]:this.$refs.component.$slots.default()).map((function(vn){return vn.key})).filter((function(k){return!!k&&"drag-image"!==k&&"drag-feedback"!==k}))},computeFeedbackKey:function(){return this.$refs.feedback.$slots.default()[0].key},computeInsertingGrid:function(){if(this.$refs.feedback.$el.children.length<1)return null;var clone=this.$refs.feedback.$el.children[0].cloneNode(!0),tg=this.$el;tg.children.length>this.items.length?tg.insertBefore(clone,tg.children[this.items.length]):tg.appendChild(clone);var grid=new Grid(tg.children,this.items.length,this.direction,null);return tg.removeChild(clone),grid},computeReorderingGrid:function(){return new Grid(this.$el.children,this.items.length-1,this.direction,this.fromIndex)},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),tg=this.$el;tg.appendChild(clone),image=_createDragImage(clone),tg.removeChild(clone),image.__opacity=this.dragImageOpacity,image.classList.add("dnd-ghost")}else image="source";return image}},render:function(){var _this5=this;if(!this.$slots.item)throw'The "Item" slot must be defined to use DropList';if(!this.$slots.feedback)throw'The "Feedback" slot must be defined to use DropList';var defaultArr=[];if(this.dropIn&&this.dropAllowed)if(this.reordering)if(this.hasReorderingFeedback){var itemsReorderingBefore=this.itemsBeforeReorderingFeedback.map((function(item,index){return _this5.$slots.item({item:item,index:index,reorder:!1})[0]}));itemsReorderingBefore.length>0&&(defaultArr=defaultArr.concat(itemsReorderingBefore)),defaultArr.push(this.$slots["reordering-feedback"]({key:"reordering-feedback",item:this.items[this.fromIndex]})[0]);var itemsReorderingAfter=this.itemsAfterReorderingFeedback.map((function(item,index){return _this5.$slots.item({item:item,index:_this5.itemsBeforeReorderingFeedback.length+index,reorder:!1})[0]}));itemsReorderingAfter.length>0&&(defaultArr=defaultArr.concat(itemsReorderingAfter))}else{var reorderedItems=this.reorderedItems.map((function(item,index){return _this5.$slots.item({item:item,index:index,reorder:index===_this5.closestIndex})[0]}));reorderedItems.length>0&&(defaultArr=defaultArr.concat(reorderedItems))}else{var itemsBefore=this.itemsBeforeFeedback.map((function(item,index){return _this5.$slots.item({item:item,index:index,reorder:!1})[0]}));itemsBefore.length>0&&(defaultArr=defaultArr.concat(itemsBefore)),defaultArr.push(this.$slots.feedback({key:"drag-feedback",data:this.dragData,type:this.dragType})[0]);var itemsAfter=this.itemsAfterFeedback.map((function(item,index){return _this5.$slots.item({item:item,index:_this5.itemsBeforeFeedback.length+index,reorder:!1})[0]}));itemsAfter.length>0&&(defaultArr=defaultArr.concat(itemsAfter))}else{var defaultItems=this.items.map((function(item,index){return _this5.$slots.item({item:item,index:index,reorder:!1})[0]}));defaultItems.length>0?defaultArr=defaultArr.concat(defaultItems):this.hasEmptySlot&&defaultArr.push(this.$slots.empty()[0])}return this.showDragFeedback&&defaultArr.push((0,_vue.h)(script$1,{class:"__feedback",ref:"feedback",key:"drag-feedback"},{default:function(){return _this5.$slots.feedback({type:_this5.dragType,data:_this5.dragData})[0]}})),this.showReorderingDragImage&&defaultArr.push((0,_vue.h)("div",{class:"__drag-image",ref:"drag-image",key:"reordering-drag-image"},{default:function(){return _this5.$slots["reordering-drag-image"]({item:_this5.items[_this5.fromIndex]})[0]}})),this.showInsertingDragImage&&defaultArr.push((0,_vue.h)("div",{class:"__drag-image",ref:"drag-image",key:"inserting-drag-image"},{default:function(){return _this5.$slots["drag-image"]({type:_this5.dragType,data:_this5.dragData})[0]}})),(0,_vue.h)(this.rootTag,_objectSpread({ref:"component",class:this.clazz},this.rootProps),{default:function(){return defaultArr}})}};_exports.DropList=script,script.__scopeId="data-v-230f65e3";var DragImagesManager=function(){function DragImagesManager(){_classCallCheck(this,DragImagesManager),_defineProperty(this,"selfTransform",null),_defineProperty(this,"clones",null),_defineProperty(this,"source",null),_defineProperty(this,"sourcePos",null),_defineProperty(this,"sourceClone",null),dnd.on("dragstart",this.onDragStart.bind(this)),dnd.on("dragtopchanged",this.onDragTopChanged.bind(this)),dnd.on("dragpositionchanged",this.onDragPositionChanged.bind(this)),dnd.on("dragend",this.onDragEnd.bind(this))}return _createClass(DragImagesManager,[{key:"onDragStart",value:function(event){this.cleanUp(),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}},{key:"onDragEnd",value:function(event){var _this6=this;(0,_vue.nextTick)().then((function(){if(!event.success&&_this6.source&&_this6.source.goBack){var img=_this6.switch(null);window.requestAnimationFrame((function(){img.style.transition="all 0.5s",window.requestAnimationFrame((function(){img.style.left=_this6.sourcePos.x+"px",img.style.top=_this6.sourcePos.y+"px",img.style.transform="translate(0,0)";img.addEventListener("transitionend",(function handler(){_this6.cleanUp(),img.removeEventListener("transitionend",handler)}))}))}))}else _this6.cleanUp()}))}},{key:"cleanUp",value:function(){this.clones&&this.clones.forEach((function(clone){clone.parentNode===document.body&&document.body.removeChild(clone)})),null!==this.sourceClone&&this.sourceClone.parentNode===document.body&&document.body.removeChild(this.sourceClone),this.selfTransform=null,this.clones=null,this.source=null,this.sourceClone=null,this.sourcePos=null}},{key:"onDragTopChanged",value:function(event){this.switch(event.top)}},{key:"switch",value: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.appendChild(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}},{key:"getSourceClone",value:function(){return null===this.sourceClone&&(this.sourceClone=this.source.createDragImage(this.selfTransform),this.sourceClone.style.opacity="0",document.body.appendChild(this.sourceClone)),this.sourceClone}},{key:"onDragPositionChanged",value:function(){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}();_exports.DragImagesManager=DragImagesManager,new DragImagesManager})); + +//# sourceMappingURL=vue-easy-dnd.esm.min.js.map \ No newline at end of file diff --git a/amd/build/vue-easy-dnd/vue-easy-dnd.esm.min.js.map b/amd/build/vue-easy-dnd/vue-easy-dnd.esm.min.js.map new file mode 100644 index 0000000..6d73e21 --- /dev/null +++ b/amd/build/vue-easy-dnd/vue-easy-dnd.esm.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"vue-easy-dnd.esm.min.js","sources":["../../src/vue-easy-dnd/vue-easy-dnd.esm.js"],"sourcesContent":["import { reactive, openBlock, createBlock, resolveDynamicComponent, normalizeClass, createSlots, withCtx, renderSlot, normalizeProps, guardReactiveProps, createElementBlock, createCommentVNode, renderList, TransitionGroup, h, nextTick } from 'vue';\n\nfunction mitt(n){return {all:n=n||new Map,on:function(t,e){var i=n.get(t);i?i.push(e):n.set(t,[e]);},off:function(t,e){var i=n.get(t);i&&(e?i.splice(i.indexOf(e)>>>0,1):n.set(t,[]));},emit:function(t,e){var i=n.get(t);i&&i.slice().map(function(n){n(e);}),(i=n.get(\"*\"))&&i.slice().map(function(n){n(t,e);});}}}\n\n/**\r\n * This is the class of the global object that holds the state of the drag and drop during its progress. It emits events\r\n * reporting its state evolution during the progress of the drag and drop. Its data is reactive and listeners can be\r\n * attached to it using the method on.\r\n */\r\nclass DnD {\r\n\r\n inProgress = false;\r\n type = null;\r\n data = null;\r\n source = null;\r\n top = null;\r\n position = null;\r\n eventBus = mitt();\r\n success = null;\r\n\r\n startDrag (source, event, x, y, type, data) {\r\n this.type = type;\r\n this.data = data;\r\n this.source = source;\r\n this.position = { x, y };\r\n this.top = null;\r\n this.inProgress = true;\r\n this.emit(event, 'dragstart');\r\n this.emit(event, 'dragtopchanged', { previousTop: null });\r\n }\r\n\r\n resetVariables () {\r\n this.inProgress = false;\r\n this.data = null;\r\n this.source = null;\r\n this.position = null;\r\n this.success = null;\r\n }\r\n\r\n stopDrag (event) {\r\n this.success = this.top !== null && this.top['compatibleMode'] && this.top['dropAllowed'];\r\n if (this.top !== null) {\r\n this.emit(event, 'drop');\r\n }\r\n this.emit(event, 'dragend');\r\n this.resetVariables();\r\n }\r\n\r\n cancelDrag (event) {\r\n this.success = false;\r\n this.emit(event, 'dragend');\r\n this.resetVariables();\r\n }\r\n\r\n mouseMove (event, comp) {\r\n if (this.inProgress) {\r\n let prevent = false;\r\n const previousTop = this.top;\r\n if (comp === null) {\r\n // The mouse move event reached the top of the document without hitting a drop component.\r\n this.top = null;\r\n prevent = true;\r\n }\r\n else if (comp['isDropMask']) {\r\n // The mouse move event bubbled until it reached a drop mask.\r\n this.top = null;\r\n prevent = true;\r\n }\r\n else if (comp['candidate'](this.type, this.data, this.source)) {\r\n // The mouse move event bubbled until it reached a drop component that participates in the current drag operation.\r\n this.top = comp;\r\n prevent = true;\r\n }\r\n\r\n if (prevent) {\r\n // We prevent the mouse move event from bubbling further up the tree because it reached the foremost drop component and that component is all that matters.\r\n event.stopPropagation();\r\n }\r\n if (this.top !== previousTop) {\r\n this.emit(event.detail.native, 'dragtopchanged', { previousTop: previousTop });\r\n }\r\n this.position = {\r\n x: event.detail.x,\r\n y: event.detail.y\r\n };\r\n this.emit(event.detail.native, 'dragpositionchanged');\r\n }\r\n }\r\n\r\n emit (native, event, data = {}) {\r\n this.eventBus.emit(event, {\r\n type: this.type,\r\n data: this.data,\r\n top: this.top,\r\n source: this.source,\r\n position: this.position,\r\n success: this.success,\r\n native,\r\n ...data\r\n });\r\n }\r\n\r\n on (event, callback) {\r\n this.eventBus.on(event, callback);\r\n }\r\n\r\n off (event, callback) {\r\n this.eventBus.off(event, callback);\r\n }\r\n}\r\n\r\nconst dnd = reactive(new DnD());\n\nvar DragAwareMixin = {\r\n data () {\r\n return {\r\n isDropMask: false\r\n };\r\n },\r\n computed: {\r\n dragInProgress () {\r\n return dnd.inProgress;\r\n },\r\n dragData () {\r\n return dnd.data;\r\n },\r\n dragType () {\r\n return dnd.type;\r\n },\r\n dragPosition () {\r\n return dnd.position;\r\n },\r\n dragSource () {\r\n return dnd.source;\r\n },\r\n dragTop () {\r\n return dnd.top;\r\n }\r\n }\r\n};\n\n/**\r\n * This files contains the primitives required to create drag images from HTML elements that serve as models. A snapshot\r\n * of the computed styles of the model elements is taken when creating the drag image, so that it will look the same as\r\n * the model, no matter where the drag images is grafted into the DOM.\r\n */\r\n\r\n/**\r\n * Creates a drag image using the given element as model.\r\n */\r\nfunction createDragImage (el) {\r\n const clone = deepClone(el);\r\n clone.style.position = 'fixed';\r\n clone.style.margin = '0';\r\n clone.style['z-index'] = '1000';\r\n clone.style.transition = 'opacity 0.2s';\r\n return clone;\r\n}\r\n\r\n/**\r\n * Clones the given element and all its descendants.\r\n */\r\nfunction deepClone (el) {\r\n const clone = el.cloneNode(true);\r\n copyStyle(el, clone);\r\n const vSrcElements = el.getElementsByTagName('*');\r\n const vDstElements = clone.getElementsByTagName('*');\r\n for (let i = vSrcElements.length; i--;) {\r\n const vSrcElement = vSrcElements[i];\r\n const vDstElement = vDstElements[i];\r\n copyStyle(vSrcElement, vDstElement);\r\n }\r\n return clone;\r\n}\r\n\r\n/**\r\n * Copy the computed styles from src to destination.\r\n */\r\nfunction copyStyle (src, destination) {\r\n const computedStyle = window.getComputedStyle(src);\r\n for (const key of computedStyle) {\r\n if (key === 'width') {\r\n // IE11\r\n const width = computedStyle.getPropertyValue('box-sizing') === 'border-box' ?\r\n src.clientWidth :\r\n src.clientWidth - parseFloat(computedStyle.paddingLeft) - parseFloat(computedStyle.paddingRight);\r\n destination.style.setProperty('width', width + 'px');\r\n }\r\n else if (key === 'height') {\r\n // IE11\r\n const height = computedStyle.getPropertyValue('box-sizing') === 'border-box' ?\r\n src.clientHeight :\r\n src.clientHeight - parseFloat(computedStyle.paddingTop) - parseFloat(computedStyle.paddingBottom);\r\n destination.style.setProperty('height', height + 'px');\r\n }\r\n else {\r\n destination.style.setProperty(key, computedStyle.getPropertyValue(key), computedStyle.getPropertyPriority(key));\r\n }\r\n }\r\n destination.style.pointerEvents = 'none';\r\n}\n\n// Forked from https://gist.github.com/gre/296291b8ce0d8fe6e1c3ea4f1d1c5c3b\r\nconst regex = /(auto|scroll)/;\r\n\r\nconst style = (node, prop) =>\r\n getComputedStyle(node, null).getPropertyValue(prop);\r\n\r\nconst scroll = (node) =>\r\n regex.test(\r\n style(node, 'overflow') +\r\n style(node, 'overflow-y') +\r\n style(node, 'overflow-x'));\r\n\r\nconst scrollparent = (node) =>\r\n !node || node===document.body\r\n ? document.body\r\n : scroll(node)\r\n ? node\r\n : scrollparent(node.parentNode);\n\n// Forked from https://github.com/bennadel/JavaScript-Demos/blob/master/demos/window-edge-scrolling/index.htm\r\n// Code was altered to work with scrollable containers\r\n\r\nvar timer = null;\r\n\r\nfunction cancelScrollAction () {\r\n clearTimeout(timer);\r\n}\r\n\r\nfunction performEdgeScroll (event, container, clientX, clientY, edgeSize) {\r\n if (!container || !edgeSize) {\r\n cancelScrollAction();\r\n return false;\r\n }\r\n \r\n // NOTE: Much of the information here, with regard to document dimensions,\r\n // viewport dimensions, and window scrolling is derived from JavaScript.info.\r\n // I am consuming it here primarily as NOTE TO SELF.\r\n // --\r\n // Read More: https://javascript.info/size-and-scroll-window\r\n // --\r\n // CAUTION: The viewport and document dimensions can all be CACHED and then\r\n // recalculated on window-resize events (for the most part). I am keeping it\r\n // all here in the mousemove event handler to remove as many of the moving\r\n // parts as possible and keep the demo as simple as possible.\r\n \r\n // Get the viewport-relative coordinates of the mousemove event.\r\n var rect = container.getBoundingClientRect();\r\n var isBody = container === document.body;\r\n \r\n var viewportX = clientX - rect.left;\r\n var viewportY = clientY - rect.top;\r\n if (isBody) {\r\n viewportX = clientX;\r\n viewportY = clientY;\r\n }\r\n \r\n // Get the viewport dimensions.\r\n var viewportWidth = rect.width;\r\n var viewportHeight = rect.height;\r\n if (isBody) {\r\n viewportWidth = document.documentElement.clientWidth;\r\n viewportHeight = document.documentElement.clientHeight;\r\n }\r\n \r\n // Next, we need to determine if the mouse is within the \"edge\" of the\r\n // viewport, which may require scrolling the window. To do this, we need to\r\n // calculate the boundaries of the edge in the viewport (these coordinates\r\n // are relative to the viewport grid system).\r\n var edgeTop = edgeSize;\r\n var edgeLeft = edgeSize;\r\n var edgeBottom = ( viewportHeight - edgeSize );\r\n var edgeRight = ( viewportWidth - edgeSize );\r\n \r\n var isInLeftEdge = ( viewportX < edgeLeft );\r\n var isInRightEdge = ( viewportX > edgeRight );\r\n var isInTopEdge = ( viewportY < edgeTop );\r\n var isInBottomEdge = ( viewportY > edgeBottom );\r\n \r\n // If the mouse is not in the viewport edge, there's no need to calculate\r\n // anything else.\r\n if (!(isInLeftEdge || isInRightEdge || isInTopEdge || isInBottomEdge)) {\r\n cancelScrollAction();\r\n return false;\r\n }\r\n \r\n // If we made it this far, the user's mouse is located within the edge of the\r\n // viewport. As such, we need to check to see if scrolling needs to be done.\r\n \r\n // Get the document dimensions.\r\n var documentWidth = Math.max(\r\n container.scrollWidth,\r\n container.offsetWidth,\r\n container.clientWidth\r\n );\r\n var documentHeight = Math.max(\r\n container.scrollHeight,\r\n container.offsetHeight,\r\n container.clientHeight\r\n );\r\n \r\n // Calculate the maximum scroll offset in each direction. Since you can only\r\n // scroll the overflow portion of the document, the maximum represents the\r\n // length of the document that is NOT in the viewport.\r\n var maxScrollX = (documentWidth - viewportWidth);\r\n var maxScrollY = (documentHeight - viewportHeight);\r\n \r\n // As we examine the mousemove event, we want to adjust the window scroll in\r\n // immediate response to the event; but, we also want to continue adjusting\r\n // the window scroll if the user rests their mouse in the edge boundary. To\r\n // do this, we'll invoke the adjustment logic immediately. Then, we'll setup\r\n // a timer that continues to invoke the adjustment logic while the window can\r\n // still be scrolled in a particular direction.\r\n (function checkForWindowScroll () {\r\n cancelScrollAction();\r\n \r\n if (adjustWindowScroll()) {\r\n timer = setTimeout( checkForWindowScroll, 30 );\r\n }\r\n })();\r\n \r\n // Adjust the window scroll based on the user's mouse position. Returns True\r\n // or False depending on whether or not the window scroll was changed.\r\n function adjustWindowScroll () {\r\n // Get the current scroll position of the document.\r\n var currentScrollX = container.scrollLeft;\r\n var currentScrollY = container.scrollTop;\r\n if (isBody) {\r\n currentScrollX = window.pageXOffset;\r\n currentScrollY = window.pageYOffset;\r\n }\r\n \r\n // Determine if the window can be scrolled in any particular direction.\r\n var canScrollUp = (currentScrollY > 0);\r\n var canScrollDown = (currentScrollY < maxScrollY);\r\n var canScrollLeft = (currentScrollX > 0);\r\n var canScrollRight = (currentScrollX < maxScrollX);\r\n \r\n // Since we can potentially scroll in two directions at the same time,\r\n // let's keep track of the next scroll, starting with the current scroll.\r\n // Each of these values can then be adjusted independently in the logic\r\n // below.\r\n var nextScrollX = currentScrollX;\r\n var nextScrollY = currentScrollY;\r\n \r\n // As we examine the mouse position within the edge, we want to make the\r\n // incremental scroll changes more \"intense\" the closer that the user\r\n // gets the viewport edge. As such, we'll calculate the percentage that\r\n // the user has made it \"through the edge\" when calculating the delta.\r\n // Then, that use that percentage to back-off from the \"max\" step value.\r\n var maxStep = 50;\r\n \r\n // Should we scroll left?\r\n if (isInLeftEdge && canScrollLeft) {\r\n const intensity = ((edgeLeft - viewportX) / edgeSize);\r\n nextScrollX = (nextScrollX - (maxStep * intensity));\r\n }\r\n // Should we scroll right?\r\n else if (isInRightEdge && canScrollRight) {\r\n const intensity = ((viewportX - edgeRight) / edgeSize);\r\n nextScrollX = (nextScrollX + (maxStep * intensity));\r\n }\r\n \r\n // Should we scroll up?\r\n if (isInTopEdge && canScrollUp) {\r\n const intensity = ((edgeTop - viewportY) / edgeSize);\r\n nextScrollY = (nextScrollY - (maxStep * intensity));\r\n }\r\n // Should we scroll down?\r\n else if (isInBottomEdge && canScrollDown) {\r\n const intensity = ((viewportY - edgeBottom) / edgeSize);\r\n nextScrollY = (nextScrollY + (maxStep * intensity));\r\n }\r\n \r\n // Sanitize invalid maximums. An invalid scroll offset won't break the\r\n // subsequent .scrollTo() call; however, it will make it harder to\r\n // determine if the .scrollTo() method should have been called in the\r\n // first place.\r\n nextScrollX = Math.max(0, Math.min(maxScrollX, nextScrollX));\r\n nextScrollY = Math.max(0, Math.min(maxScrollY, nextScrollY));\r\n \r\n if (\r\n (nextScrollX !== currentScrollX) ||\r\n (nextScrollY !== currentScrollY)\r\n ) {\r\n (isBody ? window : container).scrollTo(nextScrollX, nextScrollY);\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n \r\n return true;\r\n}\n\nvar DragMixin = {\r\n mixins: [DragAwareMixin],\r\n props: {\r\n type: {\r\n type: String,\r\n default: null\r\n },\r\n data: {\r\n default: null\r\n },\r\n dragImageOpacity: {\r\n type: Number,\r\n default: 0.7\r\n },\r\n disabled: {\r\n type: Boolean,\r\n default: false\r\n },\r\n goBack: {\r\n type: Boolean,\r\n default: false\r\n },\r\n handle: {\r\n type: String,\r\n default: null\r\n },\r\n delta: {\r\n type: Number,\r\n default: 0\r\n },\r\n delay: {\r\n type: Number,\r\n default: 0\r\n },\r\n dragClass: {\r\n type: String,\r\n default: null\r\n },\r\n vibration: {\r\n type: Number,\r\n default: 0\r\n },\r\n scrollingEdgeSize: {\r\n type: Number,\r\n default: 100\r\n }\r\n },\r\n emits: ['dragstart', 'dragend', 'cut', 'copy'],\r\n data () {\r\n return {\r\n dragInitialised: false,\r\n dragStarted: false,\r\n ignoreNextClick: false,\r\n initialUserSelect: null,\r\n downEvent: null,\r\n startPosition: null,\r\n delayTimer: null,\r\n scrollContainer: null\r\n };\r\n },\r\n computed: {\r\n cssClasses () {\r\n const clazz = {\r\n 'dnd-drag': true\r\n };\r\n if (!this.disabled) {\r\n return {\r\n ...clazz,\r\n 'drag-source': this.dragInProgress && this.dragSource === this,\r\n 'drag-mode-copy': this.currentDropMode === 'copy',\r\n 'drag-mode-cut': this.currentDropMode === 'cut',\r\n 'drag-mode-reordering': this.currentDropMode === 'reordering',\r\n 'drag-no-handle': !this.handle\r\n };\r\n }\r\n else {\r\n return clazz;\r\n }\r\n },\r\n currentDropMode () {\r\n if (this.dragInProgress && this.dragSource === this) {\r\n if (this.dragTop && this.dragTop['dropAllowed']) {\r\n if (this.dragTop['reordering']) {\r\n return 'reordering';\r\n }\r\n else {\r\n return this.dragTop['mode'];\r\n }\r\n }\r\n else {\r\n return null;\r\n }\r\n }\r\n else {\r\n return null;\r\n }\r\n }\r\n },\r\n methods: {\r\n onSelectStart (e) {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n },\r\n performVibration () {\r\n // If browser can perform vibration and user has defined a vibration, perform it\r\n if (this.vibration > 0 && window.navigator && window.navigator.vibrate) {\r\n window.navigator.vibrate(this.vibration);\r\n }\r\n },\r\n onMouseDown (e) {\r\n let target = null;\r\n let goodButton = false;\r\n if (e.type === 'mousedown') {\r\n const mouse = e;\r\n target = e.target;\r\n goodButton = mouse.buttons === 1;\r\n }\r\n else {\r\n const touch = e;\r\n target = touch.touches[0].target;\r\n goodButton = true;\r\n }\r\n\r\n if (this.disabled || this.downEvent !== null || !goodButton) {\r\n return;\r\n }\r\n\r\n // Check that the target element is eligible for starting a drag\r\n // Includes checking against the handle selector\r\n // or whether the element contains 'dnd-no-drag' class (which should disable dragging from that\r\n // sub-element of a draggable parent)\r\n const goodTarget = !target.matches('.dnd-no-drag, .dnd-no-drag *') &&\r\n (\r\n !this.handle ||\r\n target.matches(this.handle + ', ' + this.handle + ' *')\r\n );\r\n\r\n if (!goodTarget) {\r\n return;\r\n }\r\n\r\n this.scrollContainer = scrollparent(target);\r\n this.initialUserSelect = document.body.style.userSelect;\r\n document.documentElement.style.userSelect = 'none'; // Permet au drag de se poursuivre normalement même\r\n // quand on quitte un élémént avec overflow: hidden.\r\n this.dragStarted = false;\r\n this.downEvent = e;\r\n if (this.downEvent.type === 'mousedown') {\r\n const mouse = e;\r\n this.startPosition = {\r\n x: mouse.clientX,\r\n y: mouse.clientY\r\n };\r\n }\r\n else {\r\n const touch = e;\r\n this.startPosition = {\r\n x: touch.touches[0].clientX,\r\n y: touch.touches[0].clientY\r\n };\r\n }\r\n\r\n if (this.delay) {\r\n this.dragInitialised = false;\r\n clearTimeout(this.delayTimer);\r\n this.delayTimer = setTimeout(() => {\r\n this.dragInitialised = true;\r\n this.performVibration();\r\n }, this.delay);\r\n }\r\n else {\r\n this.dragInitialised = true;\r\n this.performVibration();\r\n }\r\n\r\n document.addEventListener('click', this.onMouseClick, true);\r\n document.addEventListener('mouseup', this.onMouseUp);\r\n document.addEventListener('touchend', this.onMouseUp);\r\n document.addEventListener('selectstart', this.onSelectStart);\r\n document.addEventListener('keyup', this.onKeyUp);\r\n\r\n setTimeout(() => {\r\n document.addEventListener('mousemove', this.onMouseMove);\r\n document.addEventListener('touchmove', this.onMouseMove, { passive: false });\r\n document.addEventListener('easy-dnd-move', this.onEasyDnDMove);\r\n }, 0);\r\n\r\n // Prevents event from bubbling to ancestor drag components and initiate several drags at the same time\r\n e.stopPropagation();\r\n },\r\n // Prevent the user from accidentally causing a click event\r\n // if they have just attempted a drag event\r\n onMouseClick (e) {\r\n if (this.ignoreNextClick) {\r\n e.preventDefault();\r\n e.stopPropagation && e.stopPropagation();\r\n e.stopImmediatePropagation && e.stopImmediatePropagation();\r\n this.ignoreNextClick = false;\r\n return false;\r\n }\r\n },\r\n onMouseMove (e) {\r\n // We ignore the mousemove event that follows touchend :\r\n if (this.downEvent === null) return;\r\n\r\n // On touch devices, we ignore fake mouse events and deal with touch events only.\r\n if (this.downEvent.type === 'touchstart' && e.type === 'mousemove') return;\r\n\r\n // Find out event target and pointer position :\r\n let target = null;\r\n let x = null;\r\n let y = null;\r\n if (e.type === 'touchmove') {\r\n const touch = e;\r\n x = touch.touches[0].clientX;\r\n y = touch.touches[0].clientY;\r\n target = document.elementFromPoint(x, y);\r\n if (!target) {\r\n // Mouse going off screen. Ignore event.\r\n return;\r\n }\r\n }\r\n else {\r\n const mouse = e;\r\n x = mouse.clientX;\r\n y = mouse.clientY;\r\n target = mouse.target;\r\n }\r\n\r\n // Distance between current event and start position :\r\n const dist = Math.sqrt(Math.pow(this.startPosition.x - x, 2) + Math.pow(this.startPosition.y - y, 2));\r\n\r\n // If the drag has not begun yet and distance from initial point is greater than delta, we start the drag :\r\n if (!this.dragStarted && dist > this.delta) {\r\n // If they have dragged greater than the delta before the delay period has ended,\r\n // It means that they attempted to perform another action (such as scrolling) on the page\r\n if (!this.dragInitialised) {\r\n clearTimeout(this.delayTimer);\r\n }\r\n else {\r\n this.ignoreNextClick = true;\r\n this.dragStarted = true;\r\n dnd.startDrag(this, this.downEvent, this.startPosition.x, this.startPosition.y, this.type, this.data);\r\n document.documentElement.classList.add('drag-in-progress');\r\n }\r\n }\r\n\r\n // Dispatch custom easy-dnd-move event :\r\n if (this.dragStarted) {\r\n // If cursor/touch is at edge of container, perform scroll if available\r\n // If this.dragTop is defined, it means they are dragging on top of another DropList/EasyDnd component\r\n // if dropTop is a DropList, use the scrollingEdgeSize of that container if it exists, otherwise use the scrollingEdgeSize of the Drag component\r\n const currEdgeSize = this.dragTop && this.dragTop.$props.scrollingEdgeSize !== undefined ?\r\n this.dragTop.$props.scrollingEdgeSize :\r\n this.scrollingEdgeSize;\r\n\r\n if (currEdgeSize) {\r\n const currScrollContainer = this.dragTop ? scrollparent(this.dragTop.$el) : this.scrollContainer;\r\n performEdgeScroll(e, currScrollContainer, x, y, currEdgeSize);\r\n }\r\n else {\r\n cancelScrollAction();\r\n }\r\n\r\n const custom = new CustomEvent('easy-dnd-move', {\r\n bubbles: true,\r\n cancelable: true,\r\n detail: {\r\n x,\r\n y,\r\n native: e\r\n }\r\n });\r\n target.dispatchEvent(custom);\r\n }\r\n\r\n // Prevent scroll on touch devices if they were performing a drag\r\n if (this.dragInitialised && e.cancelable) {\r\n e.preventDefault();\r\n }\r\n },\r\n onEasyDnDMove (e) {\r\n dnd.mouseMove(e, null);\r\n },\r\n onMouseUp (e) {\r\n // On touch devices, we ignore fake mouse events and deal with touch events only.\r\n if (this.downEvent.type === 'touchstart' && e.type === 'mouseup') return;\r\n\r\n // This delay makes sure that when the click event that results from the mouseup is produced, the drag is\r\n // still in progress. So by checking the flag dnd.inProgress, one can tell apart true clicks from drag and\r\n // drop artefacts.\r\n setTimeout(() => {\r\n this.cancelDragActions();\r\n\r\n if (this.dragStarted) {\r\n dnd.stopDrag(e);\r\n }\r\n this.finishDrag();\r\n }, 0);\r\n },\r\n onKeyUp (e) {\r\n // If ESC is pressed, cancel the drag\r\n if (e.key === 'Escape') {\r\n this.cancelDragActions();\r\n\r\n setTimeout(() => {\r\n dnd.cancelDrag(e);\r\n this.finishDrag();\r\n }, 0);\r\n }\r\n },\r\n cancelDragActions () {\r\n this.dragInitialised = false;\r\n clearTimeout(this.delayTimer);\r\n cancelScrollAction();\r\n },\r\n finishDrag () {\r\n this.downEvent = null;\r\n this.scrollContainer = null;\r\n\r\n if (this.dragStarted) {\r\n document.documentElement.classList.remove('drag-in-progress');\r\n }\r\n document.removeEventListener('click', this.onMouseClick, true);\r\n document.removeEventListener('mousemove', this.onMouseMove);\r\n document.removeEventListener('touchmove', this.onMouseMove);\r\n document.removeEventListener('easy-dnd-move', this.onEasyDnDMove);\r\n document.removeEventListener('mouseup', this.onMouseUp);\r\n document.removeEventListener('touchend', this.onMouseUp);\r\n document.removeEventListener('selectstart', this.onSelectStart);\r\n document.removeEventListener('keyup', this.onKeyUp);\r\n document.documentElement.style.userSelect = this.initialUserSelect;\r\n },\r\n dndDragStart (ev) {\r\n if (ev.source === this) {\r\n this.$emit('dragstart', ev);\r\n }\r\n },\r\n dndDragEnd (ev) {\r\n if (ev.source === this) {\r\n this.$emit('dragend', ev);\r\n }\r\n },\r\n createDragImage (selfTransform) {\r\n let image;\r\n if (this.$slots['drag-image']) {\r\n const el = this.$refs['drag-image'] || document.createElement('div');\r\n if (el.childElementCount !== 1) {\r\n image = createDragImage(el);\r\n }\r\n else {\r\n image = createDragImage(el.children.item(0));\r\n }\r\n }\r\n else {\r\n image = createDragImage(this.$el);\r\n image.style.transform = selfTransform;\r\n }\r\n\r\n if (this.dragClass) {\r\n image.classList.add(this.dragClass);\r\n }\r\n image.classList.add('dnd-ghost');\r\n image['__opacity'] = this.dragImageOpacity;\r\n return image;\r\n }\r\n },\r\n created () {\r\n dnd.on('dragstart', this.dndDragStart);\r\n dnd.on('dragend', this.dndDragEnd);\r\n },\r\n mounted () {\r\n this.$el.addEventListener('mousedown', this.onMouseDown);\r\n this.$el.addEventListener('touchstart', this.onMouseDown);\r\n },\r\n beforeUnmount () {\r\n dnd.off('dragstart', this.dndDragStart);\r\n dnd.off('dragend', this.dndDragEnd);\r\n\r\n this.$el.removeEventListener('mousedown', this.onMouseDown);\r\n this.$el.removeEventListener('touchstart', this.onMouseDown);\r\n }\r\n};\n\nvar script$4 = {\r\n name: 'Drag',\r\n mixins: [DragMixin],\r\n props: {\r\n /**\r\n * Tag to be used as root of this component. Defaults to div.\r\n */\r\n tag: {\r\n type: [String, Object, Function],\r\n default: 'div'\r\n }\r\n },\r\n computed: {\r\n dynamicSlots () {\r\n return Object.entries(this.$slots).filter(([key]) => key !== 'drag-image' && key !== 'default');\r\n }\r\n }\r\n};\n\nconst _hoisted_1$2 = {\n key: 0,\n ref: \"drag-image\",\n class: \"__drag-image\"\n};\n\nfunction render$3(_ctx, _cache, $props, $setup, $data, $options) {\n return (openBlock(), createBlock(resolveDynamicComponent($props.tag), {\n class: normalizeClass(_ctx.cssClasses)\n }, createSlots({\n default: withCtx(() => [\n renderSlot(_ctx.$slots, \"default\", normalizeProps(guardReactiveProps(_ctx.$slots['default'] || {}))),\n (_ctx.dragInitialised)\n ? (openBlock(), createElementBlock(\"div\", _hoisted_1$2, [\n renderSlot(_ctx.$slots, \"drag-image\")\n ], 512 /* NEED_PATCH */))\n : createCommentVNode(\"v-if\", true)\n ]),\n _: 2 /* DYNAMIC */\n }, [\n renderList($options.dynamicSlots, ([slot, args]) => {\n return {\n name: slot,\n fn: withCtx(() => [\n renderSlot(_ctx.$slots, slot, normalizeProps(guardReactiveProps(args)))\n ])\n }\n })\n ]), 1032 /* PROPS, DYNAMIC_SLOTS */, [\"class\"]))\n}\n\nscript$4.render = render$3;\nscript$4.__scopeId = \"data-v-f87407ce\";\n\nfunction dropAllowed (inst) {\r\n if (inst.dragInProgress && inst.typeAllowed) {\r\n return inst.compatibleMode && inst.effectiveAcceptsData(inst.dragData, inst.dragType);\r\n }\r\n return null;\r\n}\r\n\r\nfunction doDrop (inst, event) {\r\n inst.$emit('drop', event);\r\n event.source.$emit(inst.mode, event);\r\n}\r\n\r\nfunction candidate (inst, type) {\r\n return inst.effectiveAcceptsType(type);\r\n}\r\n\r\nvar DropMixin = {\r\n mixins: [DragAwareMixin],\r\n props: {\r\n acceptsType: {\r\n type: [String, Array, Function],\r\n default: null\r\n },\r\n acceptsData: {\r\n type: Function,\r\n default: () => {\r\n return true;\r\n }\r\n },\r\n mode: {\r\n type: String,\r\n default: 'copy'\r\n },\r\n dragImageOpacity: {\r\n type: Number,\r\n default: 0.7\r\n }\r\n },\r\n emits: ['dragover', 'dragenter', 'dragleave', 'dragend', 'drop'],\r\n data () {\r\n return {\r\n isDrop: true\r\n };\r\n },\r\n computed: {\r\n compatibleMode () {\r\n return this.dragInProgress ? true : null;\r\n },\r\n dropIn () {\r\n if (this.dragInProgress) {\r\n return this.dragTop === this;\r\n }\r\n return null;\r\n },\r\n typeAllowed () {\r\n if (this.dragInProgress) {\r\n return this.effectiveAcceptsType(this.dragType);\r\n }\r\n return null;\r\n },\r\n dropAllowed () {\r\n return dropAllowed(this);\r\n },\r\n cssClasses () {\r\n const clazz = {\r\n 'dnd-drop': true\r\n };\r\n if (this.dropIn !== null) {\r\n clazz['drop-in'] = this.dropIn;\r\n clazz['drop-out'] = !this.dropIn;\r\n }\r\n if (this.typeAllowed !== null) {\r\n clazz['type-allowed'] = this.typeAllowed;\r\n clazz['type-forbidden'] = !this.typeAllowed;\r\n }\r\n if (this.dropAllowed !== null) {\r\n clazz['drop-allowed'] = this.dropAllowed;\r\n clazz['drop-forbidden'] = !this.dropAllowed;\r\n }\r\n return clazz;\r\n }\r\n },\r\n methods: {\r\n effectiveAcceptsType (type) {\r\n if (this.acceptsType === null) {\r\n return true;\r\n }\r\n else if (typeof (this.acceptsType) === 'string' || typeof(this.acceptsType) === 'number') {\r\n return this.acceptsType === type;\r\n }\r\n else if (typeof (this.acceptsType) === 'object' && Array.isArray(this.acceptsType)) {\r\n return this.acceptsType.includes(type);\r\n }\r\n else {\r\n return this.acceptsType(type);\r\n }\r\n },\r\n effectiveAcceptsData (data, type) {\r\n return this.acceptsData(data, type);\r\n },\r\n onDragPositionChanged (event) {\r\n if (this === event.top) {\r\n this.$emit('dragover', event);\r\n }\r\n },\r\n onDragTopChanged (event) {\r\n if (this === event.top) {\r\n this.$emit('dragenter', event);\r\n }\r\n if (this === event.previousTop) {\r\n this.$emit('dragleave', event);\r\n }\r\n },\r\n onDragEnd (event) {\r\n if (this === event.top) {\r\n this.$emit('dragend', event);\r\n }\r\n },\r\n onDrop (event) {\r\n if (this.dropIn && this.compatibleMode && this.dropAllowed) {\r\n this.doDrop(event);\r\n }\r\n },\r\n doDrop (event) {\r\n doDrop(this, event);\r\n },\r\n /**\r\n * Returns true if the current drop area participates in the current drag operation.\r\n */\r\n candidate (type) {\r\n return candidate(this, type);\r\n },\r\n createDragImage () {\r\n let image = 'source';\r\n if (this.$refs['drag-image']) {\r\n const el = this.$refs['drag-image'];\r\n if (el.childElementCount !== 1) {\r\n image = createDragImage(el);\r\n }\r\n else {\r\n image = createDragImage(el.children.item(0));\r\n }\r\n image['__opacity'] = this.dragImageOpacity;\r\n image.classList.add('dnd-ghost');\r\n }\r\n return image;\r\n },\r\n onDnDMove (e) {\r\n dnd.mouseMove(e, this);\r\n }\r\n },\r\n created () {\r\n dnd.on('dragpositionchanged', this.onDragPositionChanged);\r\n dnd.on('dragtopchanged', this.onDragTopChanged);\r\n dnd.on('drop', this.onDrop);\r\n dnd.on('dragend', this.onDragEnd);\r\n },\r\n mounted () {\r\n this.$el.addEventListener('easy-dnd-move', this.onDnDMove);\r\n },\r\n beforeUnmount () {\r\n this.$el.removeEventListener('easy-dnd-move', this.onDnDMove);\r\n\r\n dnd.off('dragpositionchanged', this.onDragPositionChanged);\r\n dnd.off('dragtopchanged', this.onDragTopChanged);\r\n dnd.off('drop', this.onDrop);\r\n dnd.off('dragend', this.onDragEnd);\r\n }\r\n};\n\nvar script$3 = {\r\n name: 'Drop',\r\n mixins: [DropMixin],\r\n props: {\r\n tag: {\r\n type: [String, Object, Function],\r\n default: 'div'\r\n }\r\n },\r\n computed: {\r\n dynamicSlots () {\r\n return Object.entries(this.$slots).filter(([key]) => key !== 'drag-image' && key !== 'default');\r\n },\r\n showDragImage () {\r\n return this.dragInProgress && this.typeAllowed && !!this.$slots['drag-image'];\r\n }\r\n }\r\n};\n\nconst _hoisted_1$1 = {\n key: 0,\n ref: \"drag-image\",\n class: \"__drag-image\"\n};\n\nfunction render$2(_ctx, _cache, $props, $setup, $data, $options) {\n return (openBlock(), createBlock(resolveDynamicComponent($props.tag), {\n class: normalizeClass(_ctx.cssClasses)\n }, createSlots({\n default: withCtx(() => [\n renderSlot(_ctx.$slots, \"default\", normalizeProps(guardReactiveProps(_ctx.$slots['default'] || {}))),\n ($options.showDragImage)\n ? (openBlock(), createElementBlock(\"div\", _hoisted_1$1, [\n renderSlot(_ctx.$slots, \"drag-image\", {\n type: _ctx.dragType,\n data: _ctx.dragData\n })\n ], 512 /* NEED_PATCH */))\n : createCommentVNode(\"v-if\", true)\n ]),\n _: 2 /* DYNAMIC */\n }, [\n renderList($options.dynamicSlots, ([slot, args]) => {\n return {\n name: slot,\n fn: withCtx(() => [\n renderSlot(_ctx.$slots, slot, normalizeProps(guardReactiveProps(args)))\n ])\n }\n })\n ]), 1032 /* PROPS, DYNAMIC_SLOTS */, [\"class\"]))\n}\n\nscript$3.render = render$2;\nscript$3.__scopeId = \"data-v-12a39e52\";\n\nvar script$2 = {\r\n name: 'DropMask',\r\n mixins: [DragAwareMixin],\r\n props: {\r\n tag: {\r\n type: [String, Object, Function],\r\n default: 'div'\r\n }\r\n },\r\n data () {\r\n return {\r\n isDropMask: true\r\n };\r\n },\r\n mounted () {\r\n this.$el.addEventListener('easy-dnd-move', this.onDndMove);\r\n },\r\n beforeUnmount () {\r\n this.$el.removeEventListener('easy-dnd-move', this.onDndMove);\r\n },\r\n methods: {\r\n createDragImage () {\r\n return 'source';\r\n },\r\n onDndMove (e) {\r\n dnd.mouseMove(e, this);\r\n }\r\n }\r\n};\n\nfunction render$1(_ctx, _cache, $props, $setup, $data, $options) {\n return (openBlock(), createBlock(resolveDynamicComponent($props.tag), null, createSlots({ _: 2 /* DYNAMIC */ }, [\n renderList(_ctx.$slots, (args, slot) => {\n return {\n name: slot,\n fn: withCtx(() => [\n renderSlot(_ctx.$slots, slot, normalizeProps(guardReactiveProps(args)))\n ])\n }\n })\n ]), 1024 /* DYNAMIC_SLOTS */))\n}\n\nscript$2.render = render$1;\n\nvar script$1 = {\r\n name: 'DragFeedback'\r\n};\n\nconst _hoisted_1 = { class: \"DragFeedback\" };\n\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return (openBlock(), createElementBlock(\"div\", _hoisted_1, [\n renderSlot(_ctx.$slots, \"default\")\n ]))\n}\n\nscript$1.render = render;\n\nclass Grid {\r\n reference;\r\n referenceOriginalPosition;\r\n magnets = [];\r\n\r\n constructor (collection, upToIndex, direction, fromIndex) {\r\n this.reference = collection.item(0).parentNode;\r\n this.referenceOriginalPosition = {\r\n x: this.reference.getBoundingClientRect().left - this.reference.scrollLeft,\r\n y: this.reference.getBoundingClientRect().top - this.reference.scrollTop,\r\n };\r\n let index = 0;\r\n for (const child of collection) {\r\n if (index > upToIndex) break;\r\n const rect = child.getBoundingClientRect();\r\n const hasNestedDrop = child.classList.contains('dnd-drop') || child.getElementsByClassName('dnd-drop').length > 0;\r\n let horizontal = false;\r\n if (hasNestedDrop) {\r\n if (direction === 'auto') {\r\n // Auto mode not supported for now. Row or column must be defined explicitly if there are nested drop lists.\r\n throw 'Easy-DnD error : a drop list is missing one of these attributes : \\'row\\' or \\'column\\'.';\r\n }\r\n else {\r\n horizontal = direction === 'row';\r\n }\r\n }\r\n if (fromIndex === null) {\r\n // Inserting mode.\r\n this.magnets.push(hasNestedDrop ? this.before(rect, horizontal) : this.center(rect));\r\n }\r\n else {\r\n // Reordering mode.\r\n this.magnets.push(hasNestedDrop ? (\r\n fromIndex < index ? this.after : this.before\r\n )(rect, horizontal) : this.center(rect));\r\n }\r\n // Debug : show magnets :\r\n //document.body.insertAdjacentHTML(\"beforeend\", \"
\")\r\n index++;\r\n }\r\n }\r\n\r\n /**\r\n * Returns the center of the rectangle.\r\n */\r\n center (rect) {\r\n return {\r\n x: rect.left + rect.width / 2,\r\n y: rect.top + rect.height / 2\r\n };\r\n }\r\n\r\n /**\r\n * When horizontal is true / false, returns middle of the left / top side of the rectangle.\r\n */\r\n before (rect, horizontal) {\r\n return horizontal ? {\r\n x: rect.left,\r\n y: rect.top + rect.height / 2\r\n } : {\r\n x: rect.left + rect.width / 2,\r\n y: rect.top\r\n };\r\n }\r\n\r\n /**\r\n * When horizontal is true / false, returns middle of the right / bottom side of the rectangle.\r\n */\r\n after (rect, horizontal) {\r\n return horizontal ? {\r\n x: rect.left + rect.width,\r\n y: rect.top + rect.height / 2\r\n } : {\r\n x: rect.left + rect.width / 2,\r\n y: rect.top + rect.height\r\n };\r\n }\r\n\r\n /**\r\n * In case the user scrolls during the drag, the position of the magnets are not what they used to be when the drag\r\n * started. A correction must be applied that takes into account the amount of scroll. This correction is the\r\n * difference between the current position of the parent element and its position when the drag started.\r\n */\r\n correction () {\r\n return {\r\n x: this.reference.getBoundingClientRect().left - this.reference.scrollLeft - this.referenceOriginalPosition.x,\r\n y: this.reference.getBoundingClientRect().top - this.reference.scrollTop - this.referenceOriginalPosition.y,\r\n };\r\n }\r\n\r\n closestIndex (position) {\r\n const x = position.x - this.correction().x;\r\n const y = position.y - this.correction().y;\r\n let minDist = 999999;\r\n let index = -1;\r\n for (let i = 0; i < this.magnets.length; i++) {\r\n const magnet = this.magnets[i];\r\n const dist = Math.sqrt(Math.pow(magnet.x - x, 2) + Math.pow(magnet.y - y, 2));\r\n if (dist < minDist) {\r\n minDist = dist;\r\n index = i;\r\n }\r\n }\r\n return index;\r\n }\r\n}\n\nclass DnDEvent {\r\n type;\r\n data;\r\n top;\r\n previousTop;\r\n source;\r\n position;\r\n success;\r\n native;\r\n}\r\n\r\nclass ReorderEvent {\r\n from;\r\n to;\r\n \r\n constructor (from, to) {\r\n this.from = from;\r\n this.to = to;\r\n }\r\n\r\n apply (array) {\r\n const temp = array[this.from];\r\n array.splice(this.from, 1);\r\n array.splice(this.to, 0, temp);\r\n }\r\n\r\n}\r\n\r\nclass InsertEvent {\r\n type;\r\n data;\r\n index;\r\n \r\n constructor (type, data, index) {\r\n this.type = type;\r\n this.data = data;\r\n this.index = index;\r\n }\r\n}\n\nvar script = {\r\n name: 'DropList',\r\n mixins: [DropMixin],\r\n props: {\r\n tag: {\r\n type: [String, Object, Function],\r\n default: 'div'\r\n },\r\n items: {\r\n type: Array,\r\n required: true\r\n },\r\n row: {\r\n type: Boolean,\r\n default: false\r\n },\r\n column: {\r\n type: Boolean,\r\n default: false\r\n },\r\n noAnimations: {\r\n type: Boolean,\r\n default: false\r\n },\r\n scrollingEdgeSize: {\r\n type: Number,\r\n default: undefined\r\n }\r\n },\r\n emits: ['reorder', 'insert'],\r\n data () {\r\n return {\r\n grid: null,\r\n forbiddenKeys: [],\r\n feedbackKey: null,\r\n fromIndex: null\r\n };\r\n },\r\n computed: {\r\n rootTag () {\r\n if (this.noAnimations) {\r\n return this.tag;\r\n }\r\n return TransitionGroup;\r\n },\r\n rootProps () {\r\n if (this.noAnimations) {\r\n return {};\r\n }\r\n\r\n return {\r\n tag: this.tag,\r\n css: false\r\n };\r\n },\r\n direction () {\r\n // todo - rewrite this logic\r\n if (this.row) return 'row';\r\n if (this.column) return 'column';\r\n return 'auto';\r\n },\r\n reordering () {\r\n if (dnd.inProgress) {\r\n return dnd.source.$el.parentElement === this.$el;\r\n }\r\n return null;\r\n },\r\n closestIndex () {\r\n if (this.grid) {\r\n return this.grid.closestIndex(dnd.position);\r\n }\r\n return null;\r\n },\r\n dropAllowed () {\r\n if (this.dragInProgress) {\r\n if (this.reordering) {\r\n return this.items.length > 1;\r\n }\r\n else {\r\n // todo - eventually refactor so that this isn't necessary\r\n if (!dropAllowed(this)) {\r\n return false;\r\n }\r\n\r\n if (this.forbiddenKeys !== null && this.feedbackKey !== null) {\r\n return !this.forbiddenKeys.includes(this.feedbackKey);\r\n }\r\n\r\n return true;\r\n }\r\n }\r\n\r\n return null;\r\n },\r\n itemsBeforeFeedback () {\r\n if (this.closestIndex === 0) {\r\n return [];\r\n }\r\n return this.items.slice(0, this.closestIndex);\r\n },\r\n itemsAfterFeedback () {\r\n if (this.closestIndex === this.items.length) {\r\n return [];\r\n }\r\n return this.items.slice(this.closestIndex);\r\n },\r\n itemsBeforeReorderingFeedback () {\r\n if (this.closestIndex <= this.fromIndex) {\r\n return this.items.slice(0, this.closestIndex);\r\n }\r\n return this.items.slice(0, this.closestIndex + 1);\r\n },\r\n itemsAfterReorderingFeedback () {\r\n if (this.closestIndex <= this.fromIndex) {\r\n return this.items.slice(this.closestIndex);\r\n }\r\n return this.items.slice(this.closestIndex + 1);\r\n },\r\n reorderedItems () {\r\n const toIndex = this.closestIndex;\r\n const reordered = [...this.items];\r\n const temp = reordered[this.fromIndex];\r\n\r\n reordered.splice(this.fromIndex, 1);\r\n reordered.splice(toIndex, 0, temp);\r\n return reordered;\r\n },\r\n clazz () {\r\n return {\r\n 'drop-list': true,\r\n 'reordering': this.reordering === true,\r\n 'inserting': this.reordering === false,\r\n ...(this.reordering === false ? this.cssClasses : { 'dnd-drop': true })\r\n };\r\n },\r\n showDragFeedback () {\r\n return this.dragInProgress && this.typeAllowed && !this.reordering;\r\n },\r\n showInsertingDragImage () {\r\n return this.dragInProgress && this.typeAllowed && !this.reordering && !!this.$slots['drag-image'];\r\n },\r\n showReorderingDragImage () {\r\n return this.dragInProgress && this.reordering && !!this.$slots['reordering-drag-image'];\r\n },\r\n hasReorderingFeedback () {\r\n return !!this.$slots['reordering-feedback'];\r\n },\r\n hasEmptySlot () {\r\n return !!this.$slots['empty'];\r\n }\r\n },\r\n created () {\r\n dnd.on('dragstart', this.onDragStart);\r\n dnd.on('dragend', this.onDragEnd);\r\n },\r\n beforeUnmount () {\r\n dnd.off('dragstart', this.onDragStart);\r\n dnd.off('dragend', this.onDragEnd);\r\n },\r\n methods: {\r\n // Presence of feedback node in the DOM and of keys in the virtual DOM required => delayed until what\r\n // depends on drag data has been processed.\r\n refresh () {\r\n this.$nextTick(() => {\r\n this.grid = this.computeInsertingGrid();\r\n this.feedbackKey = this.computeFeedbackKey();\r\n this.forbiddenKeys = this.computeForbiddenKeys();\r\n });\r\n },\r\n onDragStart (event) {\r\n if (this.candidate(dnd.type)) {\r\n if (this.reordering) {\r\n this.fromIndex = Array.prototype.indexOf.call(event.source.$el.parentElement.children, event.source.$el);\r\n this.grid = this.computeReorderingGrid();\r\n }\r\n else {\r\n this.refresh();\r\n }\r\n }\r\n },\r\n onDragEnd () {\r\n this.fromIndex = null;\r\n this.feedbackKey = null;\r\n this.forbiddenKeys = null;\r\n this.grid = null;\r\n },\r\n doDrop (event) {\r\n if (this.reordering) {\r\n if (this.fromIndex !== this.closestIndex) {\r\n this.$emit('reorder', new ReorderEvent(\r\n this.fromIndex,\r\n this.closestIndex\r\n ));\r\n }\r\n }\r\n else {\r\n // todo - eventually remove the need for this\r\n doDrop(this, event);\r\n this.$emit('insert', new InsertEvent(\r\n event.type,\r\n event.data,\r\n this.closestIndex\r\n ));\r\n }\r\n },\r\n candidate (type) {\r\n return candidate(this, type) || this.reordering;\r\n },\r\n computeForbiddenKeys () {\r\n return (this.noAnimations ? [] : this.$refs.component.$slots['default']())\r\n .map(vn => vn.key)\r\n .filter(k => !!k && k !== 'drag-image' && k !== 'drag-feedback');\r\n },\r\n computeFeedbackKey () {\r\n return this.$refs['feedback']['$slots']['default']()[0]['key'];\r\n },\r\n computeInsertingGrid () {\r\n if (this.$refs.feedback.$el.children.length < 1) {\r\n return null;\r\n }\r\n\r\n const feedback = this.$refs.feedback.$el.children[0];\r\n const clone = feedback.cloneNode(true);\r\n const tg = this.$el;\r\n if (tg.children.length > this.items.length) {\r\n tg.insertBefore(clone, tg.children[this.items.length]);\r\n }\r\n else {\r\n tg.appendChild(clone);\r\n }\r\n const grid = new Grid(tg.children, this.items.length, this.direction, null);\r\n tg.removeChild(clone);\r\n return grid;\r\n },\r\n computeReorderingGrid () {\r\n return new Grid(this.$el.children, this.items.length - 1, this.direction, this.fromIndex);\r\n },\r\n createDragImage () {\r\n let image;\r\n if (this.$refs['drag-image']) {\r\n const el = this.$refs['drag-image'];\r\n let model;\r\n if (el.childElementCount !== 1) {\r\n model = el;\r\n }\r\n else {\r\n model = el.children.item(0);\r\n }\r\n const clone = model.cloneNode(true);\r\n const tg = this.$el;\r\n tg.appendChild(clone);\r\n image = createDragImage(clone);\r\n tg.removeChild(clone);\r\n image['__opacity'] = this.dragImageOpacity;\r\n image.classList.add('dnd-ghost');\r\n }\r\n else {\r\n image = 'source';\r\n }\r\n return image;\r\n }\r\n },\r\n render () {\r\n if (!this.$slots['item']) {\r\n throw 'The \"Item\" slot must be defined to use DropList';\r\n }\r\n\r\n if (!this.$slots['feedback']) {\r\n throw 'The \"Feedback\" slot must be defined to use DropList';\r\n }\r\n\r\n let defaultArr = [];\r\n if (this.dropIn && this.dropAllowed) {\r\n if (this.reordering) {\r\n if (this.hasReorderingFeedback) {\r\n const itemsReorderingBefore = this.itemsBeforeReorderingFeedback.map((item, index) => {\r\n return this.$slots['item']({\r\n item: item,\r\n index: index,\r\n reorder: false\r\n })[0];\r\n });\r\n if (itemsReorderingBefore.length > 0) {\r\n defaultArr = defaultArr.concat(itemsReorderingBefore);\r\n }\r\n\r\n defaultArr.push(this.$slots['reordering-feedback']({\r\n key: 'reordering-feedback',\r\n item: this.items[this.fromIndex]\r\n })[0]);\r\n\r\n const itemsReorderingAfter = this.itemsAfterReorderingFeedback.map((item, index) => {\r\n return this.$slots['item']({\r\n item: item,\r\n index: this.itemsBeforeReorderingFeedback.length + index,\r\n reorder: false\r\n })[0];\r\n });\r\n if (itemsReorderingAfter.length > 0) {\r\n defaultArr = defaultArr.concat(itemsReorderingAfter);\r\n }\r\n }\r\n else {\r\n const reorderedItems = this.reorderedItems.map((item, index) => {\r\n return this.$slots['item']({\r\n item: item,\r\n index: index,\r\n reorder: index === this.closestIndex\r\n })[0];\r\n });\r\n if (reorderedItems.length > 0) {\r\n defaultArr = defaultArr.concat(reorderedItems);\r\n }\r\n }\r\n }\r\n else {\r\n const itemsBefore = this.itemsBeforeFeedback.map((item, index) => {\r\n return this.$slots['item']({\r\n item: item,\r\n index: index,\r\n reorder: false\r\n })[0];\r\n });\r\n if (itemsBefore.length > 0) {\r\n defaultArr = defaultArr.concat(itemsBefore);\r\n }\r\n\r\n defaultArr.push(this.$slots['feedback']({\r\n key: 'drag-feedback',\r\n data: this.dragData,\r\n type: this.dragType\r\n })[0]);\r\n\r\n const itemsAfter = this.itemsAfterFeedback.map((item, index) => {\r\n return this.$slots['item']({\r\n item: item,\r\n index: this.itemsBeforeFeedback.length + index,\r\n reorder: false\r\n })[0];\r\n });\r\n if (itemsAfter.length > 0) {\r\n defaultArr = defaultArr.concat(itemsAfter);\r\n }\r\n }\r\n }\r\n else {\r\n const defaultItems = this.items.map((item, index) => {\r\n return this.$slots['item']({\r\n item: item,\r\n index: index,\r\n reorder: false\r\n })[0];\r\n });\r\n\r\n if (defaultItems.length > 0) {\r\n defaultArr = defaultArr.concat(defaultItems);\r\n }\r\n else if (this.hasEmptySlot) {\r\n defaultArr.push(this.$slots['empty']()[0]);\r\n }\r\n }\r\n\r\n if (this.showDragFeedback) {\r\n defaultArr.push(h(\r\n script$1,\r\n {\r\n class: '__feedback',\r\n ref: 'feedback',\r\n key: 'drag-feedback'\r\n },\r\n {\r\n default: () => this.$slots['feedback']({\r\n type: this.dragType,\r\n data: this.dragData\r\n })[0]\r\n }\r\n ));\r\n }\r\n\r\n if (this.showReorderingDragImage) {\r\n defaultArr.push(h(\r\n 'div',\r\n {\r\n class: '__drag-image',\r\n ref: 'drag-image',\r\n key: 'reordering-drag-image'\r\n },\r\n {\r\n default: () => this.$slots['reordering-drag-image']({\r\n item: this.items[this.fromIndex]\r\n })[0]\r\n }\r\n ));\r\n }\r\n\r\n if (this.showInsertingDragImage) {\r\n defaultArr.push(h(\r\n 'div',\r\n {\r\n class: '__drag-image',\r\n ref: 'drag-image',\r\n key: 'inserting-drag-image'\r\n },\r\n {\r\n default: () => this.$slots['drag-image']({\r\n type: this.dragType,\r\n data: this.dragData\r\n })[0]\r\n }\r\n ));\r\n }\r\n\r\n return h(\r\n this.rootTag,\r\n {\r\n ref: 'component',\r\n class: this.clazz,\r\n ...this.rootProps\r\n },\r\n {\r\n default: () => defaultArr\r\n }\r\n );\r\n }\r\n};\n\nscript.__scopeId = \"data-v-230f65e3\";\n\n/**\r\n * This class reacts to drag events emitted by the dnd object to manage a sequence of drag images and fade from one to the\r\n * other as the drag progresses.\r\n */\r\nclass DragImagesManager {\r\n\r\n selfTransform = null;\r\n clones = null;\r\n source = null;\r\n sourcePos = null;\r\n sourceClone = null;\r\n\r\n constructor () {\r\n dnd.on('dragstart', this.onDragStart.bind(this));\r\n dnd.on('dragtopchanged', this.onDragTopChanged.bind(this));\r\n dnd.on('dragpositionchanged', this.onDragPositionChanged.bind(this));\r\n dnd.on('dragend', this.onDragEnd.bind(this));\r\n }\r\n\r\n onDragStart (event) {\r\n // If go-back=true and it is still animating while they attempt another drag,\r\n // it will bug out. Best to clean up any existing elements on the page before\r\n // attempting to start the next animation\r\n this.cleanUp();\r\n\r\n this.sourcePos = {\r\n x: event.source.$el.getBoundingClientRect().left,\r\n y: event.source.$el.getBoundingClientRect().top\r\n };\r\n this.selfTransform = 'translate(-' + (event.position.x - this.sourcePos.x) + 'px, -' + (event.position.y - this.sourcePos.y) + 'px)';\r\n this.clones = new Map();\r\n this.source = event.source;\r\n }\r\n\r\n onDragEnd (event) {\r\n nextTick()\r\n .then(() => {\r\n if (!event.success && this.source && this.source['goBack']) {\r\n // Restore the drag image that is active when hovering outside any drop zone :\r\n const img = this.switch(null);\r\n \r\n // Move it back to its original place :\r\n window.requestAnimationFrame(() => {\r\n img.style.transition = 'all 0.5s';\r\n window.requestAnimationFrame(() => {\r\n img.style.left = this.sourcePos.x + 'px';\r\n img.style.top = this.sourcePos.y + 'px';\r\n img.style.transform = 'translate(0,0)';\r\n const handler = () => {\r\n this.cleanUp();\r\n img.removeEventListener('transitionend', handler);\r\n };\r\n img.addEventListener('transitionend', handler);\r\n });\r\n });\r\n }\r\n else {\r\n this.cleanUp();\r\n }\r\n });\r\n }\r\n\r\n cleanUp () {\r\n if (this.clones) {\r\n this.clones.forEach((clone) => {\r\n if (clone.parentNode === document.body) {\r\n document.body.removeChild(clone);\r\n }\r\n });\r\n }\r\n if (this.sourceClone !== null) {\r\n if (this.sourceClone.parentNode === document.body) {\r\n document.body.removeChild(this.sourceClone);\r\n }\r\n }\r\n this.selfTransform = null;\r\n this.clones = null;\r\n this.source = null;\r\n this.sourceClone = null;\r\n this.sourcePos = null;\r\n }\r\n\r\n onDragTopChanged (event) {\r\n this.switch(event.top);\r\n }\r\n\r\n switch (top) {\r\n this.clones.forEach(clone => {\r\n clone.style.opacity = '0';\r\n });\r\n if (this.sourceClone) {\r\n this.sourceClone.style.opacity = '0';\r\n }\r\n\r\n let activeClone;\r\n if (top === null) {\r\n activeClone = this.getSourceClone();\r\n }\r\n else {\r\n if (!this.clones.has(top)) {\r\n let clone = top['createDragImage'](this.selfTransform);\r\n if (clone === 'source') {\r\n clone = this.getSourceClone();\r\n }\r\n else if (clone !== null) {\r\n clone.style.opacity = '0';\r\n document.body.appendChild(clone);\r\n }\r\n this.clones.set(top, clone);\r\n }\r\n activeClone = this.clones.get(top);\r\n }\r\n\r\n if (activeClone !== null) {\r\n activeClone.offsetWidth; // Forces browser reflow\r\n activeClone.style.opacity = activeClone['__opacity'];\r\n activeClone.style.visibility = 'visible';\r\n }\r\n\r\n return activeClone;\r\n }\r\n\r\n getSourceClone () {\r\n if (this.sourceClone === null) {\r\n this.sourceClone = this.source['createDragImage'](this.selfTransform);\r\n this.sourceClone.style.opacity = '0';\r\n document.body.appendChild(this.sourceClone);\r\n }\r\n return this.sourceClone;\r\n }\r\n\r\n onDragPositionChanged () {\r\n this.clones.forEach((clone) => {\r\n clone.style.left = dnd.position.x + 'px';\r\n clone.style.top = dnd.position.y + 'px';\r\n });\r\n if (this.sourceClone) {\r\n this.sourceClone.style.left = dnd.position.x + 'px';\r\n this.sourceClone.style.top = dnd.position.y + 'px';\r\n }\r\n }\r\n\r\n}\r\n\r\nnew DragImagesManager();\n\nexport { DnDEvent, script$4 as Drag, DragAwareMixin, script$1 as DragFeedback, DragImagesManager, DragMixin, script$3 as Drop, script as DropList, script$2 as DropMask, DropMixin, InsertEvent, ReorderEvent, createDragImage, dnd };\n"],"names":["DnD","n","all","Map","on","t","e","i","get","push","set","off","splice","indexOf","emit","slice","map","source","event","x","y","type","data","position","top","inProgress","previousTop","success","this","resetVariables","comp","prevent","stopPropagation","detail","native","eventBus","callback","dnd","DragAwareMixin","isDropMask","computed","dragInProgress","dragData","dragType","dragPosition","dragSource","dragTop","createDragImage","el","clone","cloneNode","copyStyle","vSrcElements","getElementsByTagName","vDstElements","length","deepClone","style","margin","transition","src","destination","computedStyle","window","getComputedStyle","key","width","getPropertyValue","clientWidth","parseFloat","paddingLeft","paddingRight","setProperty","height","clientHeight","paddingTop","paddingBottom","getPropertyPriority","pointerEvents","regex","node","prop","scrollparent","document","body","test","scroll","parentNode","timer","cancelScrollAction","clearTimeout","performEdgeScroll","container","clientX","clientY","edgeSize","rect","getBoundingClientRect","isBody","viewportX","left","viewportY","viewportWidth","viewportHeight","documentElement","edgeTop","edgeLeft","edgeBottom","edgeRight","isInLeftEdge","isInRightEdge","isInTopEdge","isInBottomEdge","documentWidth","Math","max","scrollWidth","offsetWidth","documentHeight","scrollHeight","offsetHeight","maxScrollX","maxScrollY","checkForWindowScroll","currentScrollX","scrollLeft","currentScrollY","scrollTop","pageXOffset","pageYOffset","canScrollUp","canScrollDown","canScrollLeft","canScrollRight","nextScrollX","nextScrollY","maxStep","min","scrollTo","adjustWindowScroll","setTimeout","DragMixin","mixins","props","String","default","dragImageOpacity","Number","disabled","Boolean","goBack","handle","delta","delay","dragClass","vibration","scrollingEdgeSize","emits","dragInitialised","dragStarted","ignoreNextClick","initialUserSelect","downEvent","startPosition","delayTimer","scrollContainer","cssClasses","clazz","currentDropMode","methods","onSelectStart","preventDefault","performVibration","navigator","vibrate","onMouseDown","target","goodButton","mouse","buttons","touches","matches","userSelect","touch","_this","addEventListener","onMouseClick","onMouseUp","onKeyUp","onMouseMove","passive","onEasyDnDMove","stopImmediatePropagation","elementFromPoint","dist","sqrt","pow","startDrag","classList","add","currEdgeSize","undefined","$props","$el","custom","CustomEvent","bubbles","cancelable","dispatchEvent","mouseMove","_this2","cancelDragActions","stopDrag","finishDrag","cancelDrag","_this3","remove","removeEventListener","dndDragStart","ev","$emit","dndDragEnd","selfTransform","image","$slots","$refs","createElement","childElementCount","children","item","transform","created","mounted","beforeUnmount","script$4","name","tag","Object","Function","dynamicSlots","entries","filter","_hoisted_1$2","ref","class","dropAllowed","inst","typeAllowed","compatibleMode","effectiveAcceptsData","doDrop","mode","candidate","effectiveAcceptsType","render","_ctx","_cache","$setup","$data","$options","_","slot","args","fn","__scopeId","DropMixin","acceptsType","Array","acceptsData","isDrop","dropIn","_typeof","isArray","includes","onDragPositionChanged","onDragTopChanged","onDragEnd","onDrop","onDnDMove","script$3","showDragImage","_hoisted_1$1","script$2","onDndMove","script$1","_hoisted_1","Grid","collection","upToIndex","direction","fromIndex","reference","referenceOriginalPosition","index","child","hasNestedDrop","contains","getElementsByClassName","horizontal","magnets","before","center","after","correction","minDist","magnet","DnDEvent","ReorderEvent","from","to","array","temp","InsertEvent","script","items","required","row","column","noAnimations","grid","forbiddenKeys","feedbackKey","rootTag","TransitionGroup","rootProps","css","reordering","parentElement","closestIndex","itemsBeforeFeedback","itemsAfterFeedback","itemsBeforeReorderingFeedback","itemsAfterReorderingFeedback","reorderedItems","toIndex","reordered","showDragFeedback","showInsertingDragImage","showReorderingDragImage","hasReorderingFeedback","hasEmptySlot","onDragStart","refresh","$nextTick","_this4","computeInsertingGrid","computeFeedbackKey","computeForbiddenKeys","prototype","call","computeReorderingGrid","component","vn","k","feedback","tg","insertBefore","appendChild","removeChild","defaultArr","itemsReorderingBefore","_this5","reorder","concat","itemsReorderingAfter","itemsBefore","itemsAfter","defaultItems","DragImagesManager","bind","cleanUp","sourcePos","clones","then","_this6","img","switch","requestAnimationFrame","handler","forEach","sourceClone","activeClone","opacity","getSourceClone","has","visibility"],"mappings":"orJASMA,kCAPQC,+DASG,+BACN,kCACA,oCACE,iCACH,sCACK,sCAdS,CAACC,IAAID,EAAEA,GAAG,IAAIE,IAAIC,GAAG,SAASC,EAAEC,OAAOC,EAAEN,EAAEO,IAAIH,GAAGE,EAAEA,EAAEE,KAAKH,GAAGL,EAAES,IAAIL,EAAE,CAACC,KAAMK,IAAI,SAASN,EAAEC,OAAOC,EAAEN,EAAEO,IAAIH,GAAGE,IAAID,EAAEC,EAAEK,OAAOL,EAAEM,QAAQP,KAAK,EAAE,GAAGL,EAAES,IAAIL,EAAE,MAAOS,KAAK,SAAST,EAAEC,OAAOC,EAAEN,EAAEO,IAAIH,GAAGE,GAAGA,EAAEQ,QAAQC,KAAI,SAASf,GAAGA,EAAEK,OAAOC,EAAEN,EAAEO,IAAI,OAAOD,EAAEQ,QAAQC,KAAI,SAASf,GAAGA,EAAEI,EAAEC,wCAgB/R,sDAEV,SAAWW,OAAQC,MAAOC,EAAGC,EAAGC,KAAMC,WAC/BD,KAAOA,UACPC,KAAOA,UACPL,OAASA,YACTM,SAAW,CAAEJ,EAAAA,EAAGC,EAAAA,QAChBI,IAAM,UACNC,YAAa,OACbX,KAAKI,MAAO,kBACZJ,KAAKI,MAAO,iBAAkB,CAAEQ,YAAa,qCAGpD,gBACOD,YAAa,OACbH,KAAO,UACPL,OAAS,UACTM,SAAW,UACXI,QAAU,6BAGjB,SAAUT,YACHS,QAAuB,OAAbC,KAAKJ,KAAgBI,KAAKJ,IAAL,gBAA8BI,KAAKJ,IAAL,YACjD,OAAbI,KAAKJ,UACFV,KAAKI,MAAO,aAEdJ,KAAKI,MAAO,gBACZW,2CAGP,SAAYX,YACLS,SAAU,OACVb,KAAKI,MAAO,gBACZW,0CAGP,SAAWX,MAAOY,SACZF,KAAKH,WAAY,KACfM,SAAU,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AAMqU,QAAU,OAEpBlW,KAAKgW,mBACFA,YAAYnU,MAAMqU,QAAU,KAIvB,OAARtW,IACFqW,YAAcjW,KAAKmW,qBAEhB,KACEnW,KAAKwV,OAAOY,IAAIxW,KAAM,KACrByB,MAAQzB,IAAG,gBAAoBI,KAAKkM,eAC1B,WAAV7K,MACFA,MAAQrB,KAAKmW,iBAEI,OAAV9U,QACPA,MAAMQ,MAAMqU,QAAU,IACtB3S,SAASC,KAAKiR,YAAYpT,aAEvBmU,OAAO1W,IAAIc,IAAKyB,OAEvB4U,YAAcjW,KAAKwV,OAAO5W,IAAIgB,YAGZ,OAAhBqW,cACFA,YAAYxQ,YACZwQ,YAAYpU,MAAMqU,QAAUD,YAAW,UACvCA,YAAYpU,MAAMwU,WAAa,WAG1BJ,0CAGT,kBAC2B,OAArBjW,KAAKgW,mBACFA,YAAchW,KAAKX,OAAL,gBAA+BW,KAAKkM,oBAClD8J,YAAYnU,MAAMqU,QAAU,IACjC3S,SAASC,KAAKiR,YAAYzU,KAAKgW,cAE1BhW,KAAKgW,iDAGd,gBACOR,OAAOO,SAAQ,SAAC1U,OACnBA,MAAMQ,MAAM2C,KAAO/D,IAAId,SAASJ,EAAI,KACpC8B,MAAMQ,MAAMjC,IAAMa,IAAId,SAASH,EAAI,QAEjCQ,KAAKgW,mBACFA,YAAYnU,MAAM2C,KAAO/D,IAAId,SAASJ,EAAI,UAC1CyW,YAAYnU,MAAMjC,IAAMa,IAAId,SAASH,EAAI,gFAMlD4V"} \ No newline at end of file diff --git a/amd/src/vue-easy-dnd/vue-easy-dnd.esm.js b/amd/src/vue-easy-dnd/vue-easy-dnd.esm.js new file mode 100644 index 0000000..5b16ae8 --- /dev/null +++ b/amd/src/vue-easy-dnd/vue-easy-dnd.esm.js @@ -0,0 +1,1841 @@ +import { reactive, openBlock, createBlock, resolveDynamicComponent, normalizeClass, createSlots, withCtx, renderSlot, normalizeProps, guardReactiveProps, createElementBlock, createCommentVNode, renderList, TransitionGroup, h, nextTick } from 'vue'; + +function mitt(n){return {all:n=n||new Map,on:function(t,e){var i=n.get(t);i?i.push(e):n.set(t,[e]);},off:function(t,e){var i=n.get(t);i&&(e?i.splice(i.indexOf(e)>>>0,1):n.set(t,[]));},emit:function(t,e){var i=n.get(t);i&&i.slice().map(function(n){n(e);}),(i=n.get("*"))&&i.slice().map(function(n){n(t,e);});}}} + +/** + * This is the class of the global object that holds the state of the drag and drop during its progress. It emits events + * reporting its state evolution during the progress of the drag and drop. Its data is reactive and listeners can be + * attached to it using the method on. + */ +class DnD { + + inProgress = false; + type = null; + data = null; + source = null; + top = null; + position = null; + eventBus = mitt(); + success = null; + + startDrag (source, event, x, y, type, data) { + this.type = type; + this.data = data; + this.source = source; + this.position = { x, y }; + this.top = null; + this.inProgress = true; + this.emit(event, 'dragstart'); + this.emit(event, 'dragtopchanged', { previousTop: null }); + } + + resetVariables () { + this.inProgress = false; + this.data = null; + this.source = null; + this.position = null; + this.success = null; + } + + stopDrag (event) { + this.success = this.top !== null && this.top['compatibleMode'] && this.top['dropAllowed']; + if (this.top !== null) { + this.emit(event, 'drop'); + } + this.emit(event, 'dragend'); + this.resetVariables(); + } + + cancelDrag (event) { + this.success = false; + this.emit(event, 'dragend'); + this.resetVariables(); + } + + mouseMove (event, comp) { + if (this.inProgress) { + let prevent = false; + const previousTop = this.top; + if (comp === null) { + // The mouse move event reached the top of the document without hitting a drop component. + this.top = null; + prevent = true; + } + else if (comp['isDropMask']) { + // The mouse move event bubbled until it reached a drop mask. + this.top = null; + prevent = true; + } + else if (comp['candidate'](this.type, this.data, this.source)) { + // The mouse move event bubbled until it reached a drop component that participates in the current drag operation. + this.top = comp; + prevent = true; + } + + if (prevent) { + // We prevent the mouse move event from bubbling further up the tree because it reached the foremost drop component and that component is all that matters. + event.stopPropagation(); + } + if (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'); + } + } + + emit (native, event, data = {}) { + this.eventBus.emit(event, { + type: this.type, + data: this.data, + top: this.top, + source: this.source, + position: this.position, + success: this.success, + native, + ...data + }); + } + + on (event, callback) { + this.eventBus.on(event, callback); + } + + off (event, callback) { + this.eventBus.off(event, callback); + } +} + +const dnd = reactive(new DnD()); + +var DragAwareMixin = { + data () { + return { + isDropMask: false + }; + }, + computed: { + dragInProgress () { + return dnd.inProgress; + }, + dragData () { + return dnd.data; + }, + dragType () { + return dnd.type; + }, + dragPosition () { + return dnd.position; + }, + dragSource () { + return dnd.source; + }, + dragTop () { + return dnd.top; + } + } +}; + +/** + * This files contains the primitives required to create drag images from HTML elements that serve as models. A snapshot + * of the computed styles of the model elements is taken when creating the drag image, so that it will look the same as + * the model, no matter where the drag images is grafted into the DOM. + */ + +/** + * Creates a drag image using the given element as model. + */ +function createDragImage (el) { + const clone = deepClone(el); + clone.style.position = 'fixed'; + clone.style.margin = '0'; + clone.style['z-index'] = '1000'; + clone.style.transition = 'opacity 0.2s'; + return clone; +} + +/** + * Clones the given element and all its descendants. + */ +function deepClone (el) { + const clone = el.cloneNode(true); + copyStyle(el, clone); + const vSrcElements = el.getElementsByTagName('*'); + const vDstElements = clone.getElementsByTagName('*'); + for (let i = vSrcElements.length; i--;) { + const vSrcElement = vSrcElements[i]; + const vDstElement = vDstElements[i]; + copyStyle(vSrcElement, vDstElement); + } + return clone; +} + +/** + * Copy the computed styles from src to destination. + */ +function copyStyle (src, destination) { + const computedStyle = window.getComputedStyle(src); + for (const key of computedStyle) { + if (key === 'width') { + // IE11 + const width = computedStyle.getPropertyValue('box-sizing') === 'border-box' ? + src.clientWidth : + src.clientWidth - parseFloat(computedStyle.paddingLeft) - parseFloat(computedStyle.paddingRight); + destination.style.setProperty('width', width + 'px'); + } + else if (key === 'height') { + // IE11 + const height = computedStyle.getPropertyValue('box-sizing') === 'border-box' ? + src.clientHeight : + src.clientHeight - parseFloat(computedStyle.paddingTop) - parseFloat(computedStyle.paddingBottom); + destination.style.setProperty('height', height + 'px'); + } + else { + destination.style.setProperty(key, computedStyle.getPropertyValue(key), computedStyle.getPropertyPriority(key)); + } + } + destination.style.pointerEvents = 'none'; +} + +// Forked from https://gist.github.com/gre/296291b8ce0d8fe6e1c3ea4f1d1c5c3b +const regex = /(auto|scroll)/; + +const style = (node, prop) => + getComputedStyle(node, null).getPropertyValue(prop); + +const scroll = (node) => + regex.test( + style(node, 'overflow') + + style(node, 'overflow-y') + + style(node, 'overflow-x')); + +const scrollparent = (node) => + !node || node===document.body + ? document.body + : scroll(node) + ? node + : scrollparent(node.parentNode); + +// Forked from https://github.com/bennadel/JavaScript-Demos/blob/master/demos/window-edge-scrolling/index.htm +// Code was altered to work with scrollable containers + +var timer = null; + +function cancelScrollAction () { + clearTimeout(timer); +} + +function performEdgeScroll (event, container, clientX, clientY, edgeSize) { + if (!container || !edgeSize) { + cancelScrollAction(); + return false; + } + + // NOTE: Much of the information here, with regard to document dimensions, + // viewport dimensions, and window scrolling is derived from JavaScript.info. + // I am consuming it here primarily as NOTE TO SELF. + // -- + // Read More: https://javascript.info/size-and-scroll-window + // -- + // CAUTION: The viewport and document dimensions can all be CACHED and then + // recalculated on window-resize events (for the most part). I am keeping it + // all here in the mousemove event handler to remove as many of the moving + // parts as possible and keep the demo as simple as possible. + + // Get the viewport-relative coordinates of the mousemove event. + var rect = container.getBoundingClientRect(); + var isBody = container === document.body; + + var viewportX = clientX - rect.left; + var viewportY = clientY - rect.top; + if (isBody) { + viewportX = clientX; + viewportY = clientY; + } + + // Get the viewport dimensions. + var viewportWidth = rect.width; + var viewportHeight = rect.height; + if (isBody) { + viewportWidth = document.documentElement.clientWidth; + viewportHeight = document.documentElement.clientHeight; + } + + // Next, we need to determine if the mouse is within the "edge" of the + // viewport, which may require scrolling the window. To do this, we need to + // calculate the boundaries of the edge in the viewport (these coordinates + // are relative to the viewport grid system). + var edgeTop = edgeSize; + var edgeLeft = edgeSize; + var edgeBottom = ( viewportHeight - edgeSize ); + var edgeRight = ( viewportWidth - edgeSize ); + + var isInLeftEdge = ( viewportX < edgeLeft ); + var isInRightEdge = ( viewportX > edgeRight ); + var isInTopEdge = ( viewportY < edgeTop ); + var isInBottomEdge = ( viewportY > edgeBottom ); + + // If the mouse is not in the viewport edge, there's no need to calculate + // anything else. + if (!(isInLeftEdge || isInRightEdge || isInTopEdge || isInBottomEdge)) { + cancelScrollAction(); + return false; + } + + // If we made it this far, the user's mouse is located within the edge of the + // viewport. As such, we need to check to see if scrolling needs to be done. + + // Get the document dimensions. + var documentWidth = Math.max( + container.scrollWidth, + container.offsetWidth, + container.clientWidth + ); + var documentHeight = Math.max( + container.scrollHeight, + container.offsetHeight, + container.clientHeight + ); + + // Calculate the maximum scroll offset in each direction. Since you can only + // scroll the overflow portion of the document, the maximum represents the + // length of the document that is NOT in the viewport. + var maxScrollX = (documentWidth - viewportWidth); + var maxScrollY = (documentHeight - viewportHeight); + + // As we examine the mousemove event, we want to adjust the window scroll in + // immediate response to the event; but, we also want to continue adjusting + // the window scroll if the user rests their mouse in the edge boundary. To + // do this, we'll invoke the adjustment logic immediately. Then, we'll setup + // a timer that continues to invoke the adjustment logic while the window can + // still be scrolled in a particular direction. + (function checkForWindowScroll () { + cancelScrollAction(); + + if (adjustWindowScroll()) { + timer = setTimeout( checkForWindowScroll, 30 ); + } + })(); + + // Adjust the window scroll based on the user's mouse position. Returns True + // or False depending on whether or not the window scroll was changed. + function adjustWindowScroll () { + // Get the current scroll position of the document. + var currentScrollX = container.scrollLeft; + var currentScrollY = container.scrollTop; + if (isBody) { + currentScrollX = window.pageXOffset; + currentScrollY = window.pageYOffset; + } + + // Determine if the window can be scrolled in any particular direction. + var canScrollUp = (currentScrollY > 0); + var canScrollDown = (currentScrollY < maxScrollY); + var canScrollLeft = (currentScrollX > 0); + var canScrollRight = (currentScrollX < maxScrollX); + + // Since we can potentially scroll in two directions at the same time, + // let's keep track of the next scroll, starting with the current scroll. + // Each of these values can then be adjusted independently in the logic + // below. + var nextScrollX = currentScrollX; + var nextScrollY = currentScrollY; + + // As we examine the mouse position within the edge, we want to make the + // incremental scroll changes more "intense" the closer that the user + // gets the viewport edge. As such, we'll calculate the percentage that + // the user has made it "through the edge" when calculating the delta. + // Then, that use that percentage to back-off from the "max" step value. + var maxStep = 50; + + // Should we scroll left? + if (isInLeftEdge && canScrollLeft) { + const intensity = ((edgeLeft - viewportX) / edgeSize); + nextScrollX = (nextScrollX - (maxStep * intensity)); + } + // Should we scroll right? + else if (isInRightEdge && canScrollRight) { + const intensity = ((viewportX - edgeRight) / edgeSize); + nextScrollX = (nextScrollX + (maxStep * intensity)); + } + + // Should we scroll up? + if (isInTopEdge && canScrollUp) { + const intensity = ((edgeTop - viewportY) / edgeSize); + nextScrollY = (nextScrollY - (maxStep * intensity)); + } + // Should we scroll down? + else if (isInBottomEdge && canScrollDown) { + const intensity = ((viewportY - edgeBottom) / edgeSize); + nextScrollY = (nextScrollY + (maxStep * intensity)); + } + + // Sanitize invalid maximums. An invalid scroll offset won't break the + // subsequent .scrollTo() call; however, it will make it harder to + // determine if the .scrollTo() method should have been called in the + // first place. + nextScrollX = Math.max(0, Math.min(maxScrollX, nextScrollX)); + nextScrollY = Math.max(0, Math.min(maxScrollY, nextScrollY)); + + if ( + (nextScrollX !== currentScrollX) || + (nextScrollY !== currentScrollY) + ) { + (isBody ? window : container).scrollTo(nextScrollX, nextScrollY); + return true; + } + else { + return false; + } + } + + return true; +} + +var DragMixin = { + mixins: [DragAwareMixin], + props: { + type: { + type: String, + default: null + }, + data: { + default: null + }, + dragImageOpacity: { + type: Number, + default: 0.7 + }, + disabled: { + type: Boolean, + default: false + }, + goBack: { + type: Boolean, + default: false + }, + handle: { + type: String, + default: null + }, + delta: { + type: Number, + default: 0 + }, + delay: { + type: Number, + default: 0 + }, + dragClass: { + type: String, + default: null + }, + vibration: { + type: Number, + default: 0 + }, + scrollingEdgeSize: { + type: Number, + default: 100 + } + }, + emits: ['dragstart', 'dragend', 'cut', 'copy'], + data () { + return { + dragInitialised: false, + dragStarted: false, + ignoreNextClick: false, + initialUserSelect: null, + downEvent: null, + startPosition: null, + delayTimer: null, + scrollContainer: null + }; + }, + computed: { + cssClasses () { + const clazz = { + 'dnd-drag': true + }; + if (!this.disabled) { + return { + ...clazz, + 'drag-source': this.dragInProgress && this.dragSource === this, + 'drag-mode-copy': this.currentDropMode === 'copy', + 'drag-mode-cut': this.currentDropMode === 'cut', + 'drag-mode-reordering': this.currentDropMode === 'reordering', + 'drag-no-handle': !this.handle + }; + } + else { + return clazz; + } + }, + currentDropMode () { + if (this.dragInProgress && this.dragSource === this) { + if (this.dragTop && this.dragTop['dropAllowed']) { + if (this.dragTop['reordering']) { + return 'reordering'; + } + else { + return this.dragTop['mode']; + } + } + else { + return null; + } + } + else { + return null; + } + } + }, + methods: { + onSelectStart (e) { + e.stopPropagation(); + e.preventDefault(); + }, + performVibration () { + // If browser can perform vibration and user has defined a vibration, perform it + if (this.vibration > 0 && window.navigator && window.navigator.vibrate) { + window.navigator.vibrate(this.vibration); + } + }, + onMouseDown (e) { + let target = null; + let goodButton = false; + if (e.type === 'mousedown') { + const mouse = e; + target = e.target; + goodButton = mouse.buttons === 1; + } + else { + const touch = e; + target = touch.touches[0].target; + goodButton = true; + } + + if (this.disabled || this.downEvent !== null || !goodButton) { + return; + } + + // Check that the target element is eligible for starting a drag + // Includes checking against the handle selector + // or whether the element contains 'dnd-no-drag' class (which should disable dragging from that + // sub-element of a draggable parent) + const goodTarget = !target.matches('.dnd-no-drag, .dnd-no-drag *') && + ( + !this.handle || + target.matches(this.handle + ', ' + this.handle + ' *') + ); + + if (!goodTarget) { + return; + } + + this.scrollContainer = scrollparent(target); + this.initialUserSelect = document.body.style.userSelect; + document.documentElement.style.userSelect = 'none'; // Permet au drag de se poursuivre normalement même + // quand on quitte un élémént avec overflow: hidden. + this.dragStarted = false; + this.downEvent = e; + if (this.downEvent.type === 'mousedown') { + const mouse = e; + this.startPosition = { + x: mouse.clientX, + y: mouse.clientY + }; + } + else { + const touch = e; + this.startPosition = { + x: touch.touches[0].clientX, + y: touch.touches[0].clientY + }; + } + + if (this.delay) { + this.dragInitialised = false; + clearTimeout(this.delayTimer); + this.delayTimer = setTimeout(() => { + this.dragInitialised = true; + this.performVibration(); + }, this.delay); + } + else { + this.dragInitialised = true; + this.performVibration(); + } + + document.addEventListener('click', this.onMouseClick, true); + document.addEventListener('mouseup', this.onMouseUp); + document.addEventListener('touchend', this.onMouseUp); + document.addEventListener('selectstart', this.onSelectStart); + document.addEventListener('keyup', this.onKeyUp); + + setTimeout(() => { + document.addEventListener('mousemove', this.onMouseMove); + document.addEventListener('touchmove', this.onMouseMove, { passive: false }); + document.addEventListener('easy-dnd-move', this.onEasyDnDMove); + }, 0); + + // Prevents event from bubbling to ancestor drag components and initiate several drags at the same time + e.stopPropagation(); + }, + // Prevent the user from accidentally causing a click event + // if they have just attempted a drag event + onMouseClick (e) { + if (this.ignoreNextClick) { + e.preventDefault(); + e.stopPropagation && e.stopPropagation(); + e.stopImmediatePropagation && e.stopImmediatePropagation(); + this.ignoreNextClick = false; + return false; + } + }, + onMouseMove (e) { + // We ignore the mousemove event that follows touchend : + if (this.downEvent === null) return; + + // On touch devices, we ignore fake mouse events and deal with touch events only. + if (this.downEvent.type === 'touchstart' && e.type === 'mousemove') return; + + // Find out event target and pointer position : + let target = null; + let x = null; + let y = null; + if (e.type === 'touchmove') { + const touch = e; + x = touch.touches[0].clientX; + y = touch.touches[0].clientY; + target = document.elementFromPoint(x, y); + if (!target) { + // Mouse going off screen. Ignore event. + return; + } + } + else { + const mouse = e; + x = mouse.clientX; + y = mouse.clientY; + target = mouse.target; + } + + // Distance between current event and start position : + const dist = Math.sqrt(Math.pow(this.startPosition.x - x, 2) + Math.pow(this.startPosition.y - y, 2)); + + // If the drag has not begun yet and distance from initial point is greater than delta, we start the drag : + if (!this.dragStarted && dist > this.delta) { + // If they have dragged greater than the delta before the delay period has ended, + // It means that they attempted to perform another action (such as scrolling) on the page + if (!this.dragInitialised) { + clearTimeout(this.delayTimer); + } + else { + this.ignoreNextClick = true; + this.dragStarted = true; + dnd.startDrag(this, this.downEvent, this.startPosition.x, this.startPosition.y, this.type, this.data); + document.documentElement.classList.add('drag-in-progress'); + } + } + + // Dispatch custom easy-dnd-move event : + if (this.dragStarted) { + // If cursor/touch is at edge of container, perform scroll if available + // If this.dragTop is defined, it means they are dragging on top of another DropList/EasyDnd component + // if dropTop is a DropList, use the scrollingEdgeSize of that container if it exists, otherwise use the scrollingEdgeSize of the Drag component + const currEdgeSize = this.dragTop && this.dragTop.$props.scrollingEdgeSize !== undefined ? + this.dragTop.$props.scrollingEdgeSize : + this.scrollingEdgeSize; + + if (currEdgeSize) { + const currScrollContainer = this.dragTop ? scrollparent(this.dragTop.$el) : this.scrollContainer; + performEdgeScroll(e, currScrollContainer, x, y, currEdgeSize); + } + else { + cancelScrollAction(); + } + + const custom = new CustomEvent('easy-dnd-move', { + bubbles: true, + cancelable: true, + detail: { + x, + y, + native: e + } + }); + target.dispatchEvent(custom); + } + + // Prevent scroll on touch devices if they were performing a drag + if (this.dragInitialised && e.cancelable) { + e.preventDefault(); + } + }, + onEasyDnDMove (e) { + dnd.mouseMove(e, null); + }, + onMouseUp (e) { + // On touch devices, we ignore fake mouse events and deal with touch events only. + if (this.downEvent.type === 'touchstart' && e.type === 'mouseup') return; + + // This delay makes sure that when the click event that results from the mouseup is produced, the drag is + // still in progress. So by checking the flag dnd.inProgress, one can tell apart true clicks from drag and + // drop artefacts. + setTimeout(() => { + this.cancelDragActions(); + + if (this.dragStarted) { + dnd.stopDrag(e); + } + this.finishDrag(); + }, 0); + }, + onKeyUp (e) { + // If ESC is pressed, cancel the drag + if (e.key === 'Escape') { + this.cancelDragActions(); + + setTimeout(() => { + dnd.cancelDrag(e); + this.finishDrag(); + }, 0); + } + }, + cancelDragActions () { + this.dragInitialised = false; + clearTimeout(this.delayTimer); + cancelScrollAction(); + }, + finishDrag () { + this.downEvent = null; + this.scrollContainer = null; + + if (this.dragStarted) { + document.documentElement.classList.remove('drag-in-progress'); + } + document.removeEventListener('click', this.onMouseClick, true); + document.removeEventListener('mousemove', this.onMouseMove); + document.removeEventListener('touchmove', this.onMouseMove); + document.removeEventListener('easy-dnd-move', this.onEasyDnDMove); + document.removeEventListener('mouseup', this.onMouseUp); + document.removeEventListener('touchend', this.onMouseUp); + document.removeEventListener('selectstart', this.onSelectStart); + document.removeEventListener('keyup', this.onKeyUp); + document.documentElement.style.userSelect = this.initialUserSelect; + }, + dndDragStart (ev) { + if (ev.source === this) { + this.$emit('dragstart', ev); + } + }, + dndDragEnd (ev) { + if (ev.source === this) { + this.$emit('dragend', ev); + } + }, + createDragImage (selfTransform) { + let image; + if (this.$slots['drag-image']) { + const el = this.$refs['drag-image'] || document.createElement('div'); + if (el.childElementCount !== 1) { + image = createDragImage(el); + } + else { + image = createDragImage(el.children.item(0)); + } + } + else { + image = createDragImage(this.$el); + image.style.transform = selfTransform; + } + + if (this.dragClass) { + image.classList.add(this.dragClass); + } + image.classList.add('dnd-ghost'); + image['__opacity'] = this.dragImageOpacity; + return image; + } + }, + created () { + dnd.on('dragstart', this.dndDragStart); + dnd.on('dragend', this.dndDragEnd); + }, + mounted () { + this.$el.addEventListener('mousedown', this.onMouseDown); + this.$el.addEventListener('touchstart', this.onMouseDown); + }, + beforeUnmount () { + dnd.off('dragstart', this.dndDragStart); + dnd.off('dragend', this.dndDragEnd); + + this.$el.removeEventListener('mousedown', this.onMouseDown); + this.$el.removeEventListener('touchstart', this.onMouseDown); + } +}; + +var script$4 = { + name: 'Drag', + mixins: [DragMixin], + props: { + /** + * Tag to be used as root of this component. Defaults to div. + */ + tag: { + type: [String, Object, Function], + default: 'div' + } + }, + computed: { + dynamicSlots () { + return Object.entries(this.$slots).filter(([key]) => key !== 'drag-image' && key !== 'default'); + } + } +}; + +const _hoisted_1$2 = { + key: 0, + ref: "drag-image", + class: "__drag-image" +}; + +function render$3(_ctx, _cache, $props, $setup, $data, $options) { + return (openBlock(), createBlock(resolveDynamicComponent($props.tag), { + class: normalizeClass(_ctx.cssClasses) + }, createSlots({ + default: withCtx(() => [ + renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(_ctx.$slots['default'] || {}))), + (_ctx.dragInitialised) + ? (openBlock(), createElementBlock("div", _hoisted_1$2, [ + renderSlot(_ctx.$slots, "drag-image") + ], 512 /* NEED_PATCH */)) + : createCommentVNode("v-if", true) + ]), + _: 2 /* DYNAMIC */ + }, [ + renderList($options.dynamicSlots, ([slot, args]) => { + return { + name: slot, + fn: withCtx(() => [ + renderSlot(_ctx.$slots, slot, normalizeProps(guardReactiveProps(args))) + ]) + } + }) + ]), 1032 /* PROPS, DYNAMIC_SLOTS */, ["class"])) +} + +script$4.render = render$3; +script$4.__scopeId = "data-v-f87407ce"; + +function dropAllowed (inst) { + if (inst.dragInProgress && inst.typeAllowed) { + return inst.compatibleMode && inst.effectiveAcceptsData(inst.dragData, inst.dragType); + } + return null; +} + +function doDrop (inst, event) { + inst.$emit('drop', event); + event.source.$emit(inst.mode, event); +} + +function candidate (inst, type) { + return inst.effectiveAcceptsType(type); +} + +var DropMixin = { + mixins: [DragAwareMixin], + props: { + acceptsType: { + type: [String, Array, Function], + default: null + }, + acceptsData: { + type: Function, + default: () => { + return true; + } + }, + mode: { + type: String, + default: 'copy' + }, + dragImageOpacity: { + type: Number, + default: 0.7 + } + }, + emits: ['dragover', 'dragenter', 'dragleave', 'dragend', 'drop'], + data () { + return { + isDrop: true + }; + }, + computed: { + compatibleMode () { + return this.dragInProgress ? true : null; + }, + dropIn () { + if (this.dragInProgress) { + return this.dragTop === this; + } + return null; + }, + typeAllowed () { + if (this.dragInProgress) { + return this.effectiveAcceptsType(this.dragType); + } + return null; + }, + dropAllowed () { + return dropAllowed(this); + }, + cssClasses () { + const clazz = { + 'dnd-drop': true + }; + if (this.dropIn !== null) { + clazz['drop-in'] = this.dropIn; + clazz['drop-out'] = !this.dropIn; + } + if (this.typeAllowed !== null) { + clazz['type-allowed'] = this.typeAllowed; + clazz['type-forbidden'] = !this.typeAllowed; + } + if (this.dropAllowed !== null) { + clazz['drop-allowed'] = this.dropAllowed; + clazz['drop-forbidden'] = !this.dropAllowed; + } + return clazz; + } + }, + methods: { + effectiveAcceptsType (type) { + if (this.acceptsType === null) { + return true; + } + else if (typeof (this.acceptsType) === 'string' || typeof(this.acceptsType) === 'number') { + return this.acceptsType === type; + } + else if (typeof (this.acceptsType) === 'object' && Array.isArray(this.acceptsType)) { + return this.acceptsType.includes(type); + } + else { + return this.acceptsType(type); + } + }, + effectiveAcceptsData (data, type) { + return this.acceptsData(data, type); + }, + onDragPositionChanged (event) { + if (this === event.top) { + this.$emit('dragover', event); + } + }, + onDragTopChanged (event) { + if (this === event.top) { + this.$emit('dragenter', event); + } + if (this === event.previousTop) { + this.$emit('dragleave', event); + } + }, + onDragEnd (event) { + if (this === event.top) { + this.$emit('dragend', event); + } + }, + onDrop (event) { + if (this.dropIn && this.compatibleMode && this.dropAllowed) { + this.doDrop(event); + } + }, + doDrop (event) { + doDrop(this, event); + }, + /** + * Returns true if the current drop area participates in the current drag operation. + */ + candidate (type) { + return candidate(this, type); + }, + createDragImage () { + let image = 'source'; + if (this.$refs['drag-image']) { + const el = this.$refs['drag-image']; + if (el.childElementCount !== 1) { + image = createDragImage(el); + } + else { + image = createDragImage(el.children.item(0)); + } + image['__opacity'] = this.dragImageOpacity; + image.classList.add('dnd-ghost'); + } + return image; + }, + onDnDMove (e) { + dnd.mouseMove(e, this); + } + }, + created () { + dnd.on('dragpositionchanged', this.onDragPositionChanged); + dnd.on('dragtopchanged', this.onDragTopChanged); + dnd.on('drop', this.onDrop); + dnd.on('dragend', this.onDragEnd); + }, + mounted () { + this.$el.addEventListener('easy-dnd-move', this.onDnDMove); + }, + beforeUnmount () { + this.$el.removeEventListener('easy-dnd-move', this.onDnDMove); + + dnd.off('dragpositionchanged', this.onDragPositionChanged); + dnd.off('dragtopchanged', this.onDragTopChanged); + dnd.off('drop', this.onDrop); + dnd.off('dragend', this.onDragEnd); + } +}; + +var script$3 = { + name: 'Drop', + mixins: [DropMixin], + props: { + tag: { + type: [String, Object, Function], + default: 'div' + } + }, + computed: { + dynamicSlots () { + return Object.entries(this.$slots).filter(([key]) => key !== 'drag-image' && key !== 'default'); + }, + showDragImage () { + return this.dragInProgress && this.typeAllowed && !!this.$slots['drag-image']; + } + } +}; + +const _hoisted_1$1 = { + key: 0, + ref: "drag-image", + class: "__drag-image" +}; + +function render$2(_ctx, _cache, $props, $setup, $data, $options) { + return (openBlock(), createBlock(resolveDynamicComponent($props.tag), { + class: normalizeClass(_ctx.cssClasses) + }, createSlots({ + default: withCtx(() => [ + renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(_ctx.$slots['default'] || {}))), + ($options.showDragImage) + ? (openBlock(), createElementBlock("div", _hoisted_1$1, [ + renderSlot(_ctx.$slots, "drag-image", { + type: _ctx.dragType, + data: _ctx.dragData + }) + ], 512 /* NEED_PATCH */)) + : createCommentVNode("v-if", true) + ]), + _: 2 /* DYNAMIC */ + }, [ + renderList($options.dynamicSlots, ([slot, args]) => { + return { + name: slot, + fn: withCtx(() => [ + renderSlot(_ctx.$slots, slot, normalizeProps(guardReactiveProps(args))) + ]) + } + }) + ]), 1032 /* PROPS, DYNAMIC_SLOTS */, ["class"])) +} + +script$3.render = render$2; +script$3.__scopeId = "data-v-12a39e52"; + +var script$2 = { + name: 'DropMask', + mixins: [DragAwareMixin], + props: { + tag: { + type: [String, Object, Function], + default: 'div' + } + }, + data () { + return { + isDropMask: true + }; + }, + mounted () { + this.$el.addEventListener('easy-dnd-move', this.onDndMove); + }, + beforeUnmount () { + this.$el.removeEventListener('easy-dnd-move', this.onDndMove); + }, + methods: { + createDragImage () { + return 'source'; + }, + onDndMove (e) { + dnd.mouseMove(e, this); + } + } +}; + +function render$1(_ctx, _cache, $props, $setup, $data, $options) { + return (openBlock(), createBlock(resolveDynamicComponent($props.tag), null, createSlots({ _: 2 /* DYNAMIC */ }, [ + renderList(_ctx.$slots, (args, slot) => { + return { + name: slot, + fn: withCtx(() => [ + renderSlot(_ctx.$slots, slot, normalizeProps(guardReactiveProps(args))) + ]) + } + }) + ]), 1024 /* DYNAMIC_SLOTS */)) +} + +script$2.render = render$1; + +var script$1 = { + name: 'DragFeedback' +}; + +const _hoisted_1 = { class: "DragFeedback" }; + +function render(_ctx, _cache, $props, $setup, $data, $options) { + return (openBlock(), createElementBlock("div", _hoisted_1, [ + renderSlot(_ctx.$slots, "default") + ])) +} + +script$1.render = render; + +class Grid { + reference; + referenceOriginalPosition; + magnets = []; + + constructor (collection, upToIndex, direction, fromIndex) { + this.reference = collection.item(0).parentNode; + this.referenceOriginalPosition = { + x: this.reference.getBoundingClientRect().left - this.reference.scrollLeft, + y: this.reference.getBoundingClientRect().top - this.reference.scrollTop, + }; + let index = 0; + for (const child of collection) { + if (index > upToIndex) break; + const rect = child.getBoundingClientRect(); + const hasNestedDrop = child.classList.contains('dnd-drop') || child.getElementsByClassName('dnd-drop').length > 0; + let horizontal = false; + if (hasNestedDrop) { + if (direction === 'auto') { + // Auto mode not supported for now. Row or column must be defined explicitly if there are nested drop lists. + throw 'Easy-DnD error : a drop list is missing one of these attributes : \'row\' or \'column\'.'; + } + else { + horizontal = direction === 'row'; + } + } + if (fromIndex === null) { + // Inserting mode. + this.magnets.push(hasNestedDrop ? this.before(rect, horizontal) : this.center(rect)); + } + else { + // Reordering mode. + this.magnets.push(hasNestedDrop ? ( + fromIndex < index ? this.after : this.before + )(rect, horizontal) : this.center(rect)); + } + // Debug : show magnets : + //document.body.insertAdjacentHTML("beforeend", "
") + index++; + } + } + + /** + * Returns the center of the rectangle. + */ + center (rect) { + return { + x: rect.left + rect.width / 2, + y: rect.top + rect.height / 2 + }; + } + + /** + * When horizontal is true / false, returns middle of the left / top side of the rectangle. + */ + before (rect, horizontal) { + return horizontal ? { + x: rect.left, + y: rect.top + rect.height / 2 + } : { + x: rect.left + rect.width / 2, + y: rect.top + }; + } + + /** + * When horizontal is true / false, returns middle of the right / bottom side of the rectangle. + */ + after (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 + }; + } + + /** + * In case the user scrolls during the drag, the position of the magnets are not what they used to be when the drag + * started. A correction must be applied that takes into account the amount of scroll. This correction is the + * difference between the current position of the parent element and its position when the drag started. + */ + correction () { + return { + x: this.reference.getBoundingClientRect().left - this.reference.scrollLeft - this.referenceOriginalPosition.x, + y: this.reference.getBoundingClientRect().top - this.reference.scrollTop - this.referenceOriginalPosition.y, + }; + } + + closestIndex (position) { + const x = position.x - this.correction().x; + const y = position.y - this.correction().y; + let minDist = 999999; + let index = -1; + for (let i = 0; i < this.magnets.length; i++) { + const magnet = this.magnets[i]; + const dist = Math.sqrt(Math.pow(magnet.x - x, 2) + Math.pow(magnet.y - y, 2)); + if (dist < minDist) { + minDist = dist; + index = i; + } + } + return index; + } +} + +class DnDEvent { + type; + data; + top; + previousTop; + source; + position; + success; + native; +} + +class ReorderEvent { + from; + to; + + constructor (from, to) { + this.from = from; + this.to = to; + } + + apply (array) { + const temp = array[this.from]; + array.splice(this.from, 1); + array.splice(this.to, 0, temp); + } + +} + +class InsertEvent { + type; + data; + index; + + constructor (type, data, index) { + this.type = type; + this.data = data; + this.index = index; + } +} + +var script = { + name: 'DropList', + mixins: [DropMixin], + props: { + tag: { + type: [String, Object, Function], + default: 'div' + }, + items: { + type: Array, + required: true + }, + row: { + type: Boolean, + default: false + }, + column: { + type: Boolean, + default: false + }, + noAnimations: { + type: Boolean, + default: false + }, + scrollingEdgeSize: { + type: Number, + default: undefined + } + }, + emits: ['reorder', 'insert'], + data () { + return { + grid: null, + forbiddenKeys: [], + feedbackKey: null, + fromIndex: null + }; + }, + computed: { + rootTag () { + if (this.noAnimations) { + return this.tag; + } + return TransitionGroup; + }, + rootProps () { + if (this.noAnimations) { + return {}; + } + + return { + tag: this.tag, + css: false + }; + }, + direction () { + // todo - rewrite this logic + if (this.row) return 'row'; + if (this.column) return 'column'; + return 'auto'; + }, + reordering () { + if (dnd.inProgress) { + return dnd.source.$el.parentElement === this.$el; + } + return null; + }, + closestIndex () { + if (this.grid) { + return this.grid.closestIndex(dnd.position); + } + return null; + }, + dropAllowed () { + if (this.dragInProgress) { + if (this.reordering) { + return this.items.length > 1; + } + else { + // todo - eventually refactor so that this isn't necessary + if (!dropAllowed(this)) { + return false; + } + + if (this.forbiddenKeys !== null && this.feedbackKey !== null) { + return !this.forbiddenKeys.includes(this.feedbackKey); + } + + return true; + } + } + + return null; + }, + itemsBeforeFeedback () { + if (this.closestIndex === 0) { + return []; + } + return this.items.slice(0, this.closestIndex); + }, + itemsAfterFeedback () { + if (this.closestIndex === this.items.length) { + return []; + } + return this.items.slice(this.closestIndex); + }, + itemsBeforeReorderingFeedback () { + if (this.closestIndex <= this.fromIndex) { + return this.items.slice(0, this.closestIndex); + } + return this.items.slice(0, this.closestIndex + 1); + }, + itemsAfterReorderingFeedback () { + if (this.closestIndex <= this.fromIndex) { + return this.items.slice(this.closestIndex); + } + return this.items.slice(this.closestIndex + 1); + }, + reorderedItems () { + const toIndex = this.closestIndex; + const reordered = [...this.items]; + const temp = reordered[this.fromIndex]; + + reordered.splice(this.fromIndex, 1); + reordered.splice(toIndex, 0, temp); + return reordered; + }, + clazz () { + return { + 'drop-list': true, + 'reordering': this.reordering === true, + 'inserting': this.reordering === false, + ...(this.reordering === false ? this.cssClasses : { 'dnd-drop': true }) + }; + }, + showDragFeedback () { + return this.dragInProgress && this.typeAllowed && !this.reordering; + }, + showInsertingDragImage () { + return this.dragInProgress && this.typeAllowed && !this.reordering && !!this.$slots['drag-image']; + }, + showReorderingDragImage () { + return this.dragInProgress && this.reordering && !!this.$slots['reordering-drag-image']; + }, + hasReorderingFeedback () { + return !!this.$slots['reordering-feedback']; + }, + hasEmptySlot () { + return !!this.$slots['empty']; + } + }, + created () { + dnd.on('dragstart', this.onDragStart); + dnd.on('dragend', this.onDragEnd); + }, + beforeUnmount () { + dnd.off('dragstart', this.onDragStart); + dnd.off('dragend', this.onDragEnd); + }, + methods: { + // Presence of feedback node in the DOM and of keys in the virtual DOM required => delayed until what + // depends on drag data has been processed. + refresh () { + this.$nextTick(() => { + this.grid = this.computeInsertingGrid(); + this.feedbackKey = this.computeFeedbackKey(); + this.forbiddenKeys = this.computeForbiddenKeys(); + }); + }, + onDragStart (event) { + if (this.candidate(dnd.type)) { + if (this.reordering) { + this.fromIndex = Array.prototype.indexOf.call(event.source.$el.parentElement.children, event.source.$el); + this.grid = this.computeReorderingGrid(); + } + else { + this.refresh(); + } + } + }, + onDragEnd () { + this.fromIndex = null; + this.feedbackKey = null; + this.forbiddenKeys = null; + this.grid = null; + }, + doDrop (event) { + if (this.reordering) { + if (this.fromIndex !== this.closestIndex) { + this.$emit('reorder', new ReorderEvent( + this.fromIndex, + this.closestIndex + )); + } + } + else { + // todo - eventually remove the need for this + doDrop(this, event); + this.$emit('insert', new InsertEvent( + event.type, + event.data, + this.closestIndex + )); + } + }, + candidate (type) { + return candidate(this, type) || this.reordering; + }, + computeForbiddenKeys () { + return (this.noAnimations ? [] : this.$refs.component.$slots['default']()) + .map(vn => vn.key) + .filter(k => !!k && k !== 'drag-image' && k !== 'drag-feedback'); + }, + computeFeedbackKey () { + return this.$refs['feedback']['$slots']['default']()[0]['key']; + }, + computeInsertingGrid () { + if (this.$refs.feedback.$el.children.length < 1) { + return null; + } + + const feedback = this.$refs.feedback.$el.children[0]; + const clone = feedback.cloneNode(true); + const tg = this.$el; + if (tg.children.length > this.items.length) { + tg.insertBefore(clone, tg.children[this.items.length]); + } + else { + tg.appendChild(clone); + } + const grid = new Grid(tg.children, this.items.length, this.direction, null); + tg.removeChild(clone); + return grid; + }, + computeReorderingGrid () { + return new Grid(this.$el.children, this.items.length - 1, this.direction, this.fromIndex); + }, + createDragImage () { + let image; + if (this.$refs['drag-image']) { + const el = this.$refs['drag-image']; + let model; + if (el.childElementCount !== 1) { + model = el; + } + else { + model = el.children.item(0); + } + const clone = model.cloneNode(true); + const tg = this.$el; + tg.appendChild(clone); + image = createDragImage(clone); + tg.removeChild(clone); + image['__opacity'] = this.dragImageOpacity; + image.classList.add('dnd-ghost'); + } + else { + image = 'source'; + } + return image; + } + }, + render () { + if (!this.$slots['item']) { + throw 'The "Item" slot must be defined to use DropList'; + } + + if (!this.$slots['feedback']) { + throw 'The "Feedback" slot must be defined to use DropList'; + } + + let defaultArr = []; + if (this.dropIn && this.dropAllowed) { + if (this.reordering) { + if (this.hasReorderingFeedback) { + const itemsReorderingBefore = this.itemsBeforeReorderingFeedback.map((item, index) => { + return this.$slots['item']({ + item: item, + index: index, + reorder: false + })[0]; + }); + if (itemsReorderingBefore.length > 0) { + defaultArr = defaultArr.concat(itemsReorderingBefore); + } + + defaultArr.push(this.$slots['reordering-feedback']({ + key: 'reordering-feedback', + item: this.items[this.fromIndex] + })[0]); + + const itemsReorderingAfter = this.itemsAfterReorderingFeedback.map((item, index) => { + return this.$slots['item']({ + item: item, + index: this.itemsBeforeReorderingFeedback.length + index, + reorder: false + })[0]; + }); + if (itemsReorderingAfter.length > 0) { + defaultArr = defaultArr.concat(itemsReorderingAfter); + } + } + else { + const reorderedItems = this.reorderedItems.map((item, index) => { + return this.$slots['item']({ + item: item, + index: index, + reorder: index === this.closestIndex + })[0]; + }); + if (reorderedItems.length > 0) { + defaultArr = defaultArr.concat(reorderedItems); + } + } + } + else { + const itemsBefore = this.itemsBeforeFeedback.map((item, index) => { + return this.$slots['item']({ + item: item, + index: index, + reorder: false + })[0]; + }); + if (itemsBefore.length > 0) { + defaultArr = defaultArr.concat(itemsBefore); + } + + defaultArr.push(this.$slots['feedback']({ + key: 'drag-feedback', + data: this.dragData, + type: this.dragType + })[0]); + + const itemsAfter = this.itemsAfterFeedback.map((item, index) => { + return this.$slots['item']({ + item: item, + index: this.itemsBeforeFeedback.length + index, + reorder: false + })[0]; + }); + if (itemsAfter.length > 0) { + defaultArr = defaultArr.concat(itemsAfter); + } + } + } + else { + const defaultItems = this.items.map((item, index) => { + return this.$slots['item']({ + item: item, + index: index, + reorder: false + })[0]; + }); + + if (defaultItems.length > 0) { + defaultArr = defaultArr.concat(defaultItems); + } + else if (this.hasEmptySlot) { + defaultArr.push(this.$slots['empty']()[0]); + } + } + + if (this.showDragFeedback) { + defaultArr.push(h( + script$1, + { + class: '__feedback', + ref: 'feedback', + key: 'drag-feedback' + }, + { + default: () => this.$slots['feedback']({ + type: this.dragType, + data: this.dragData + })[0] + } + )); + } + + if (this.showReorderingDragImage) { + defaultArr.push(h( + 'div', + { + class: '__drag-image', + ref: 'drag-image', + key: 'reordering-drag-image' + }, + { + default: () => this.$slots['reordering-drag-image']({ + item: this.items[this.fromIndex] + })[0] + } + )); + } + + if (this.showInsertingDragImage) { + defaultArr.push(h( + 'div', + { + class: '__drag-image', + ref: 'drag-image', + key: 'inserting-drag-image' + }, + { + default: () => this.$slots['drag-image']({ + type: this.dragType, + data: this.dragData + })[0] + } + )); + } + + return h( + this.rootTag, + { + ref: 'component', + class: this.clazz, + ...this.rootProps + }, + { + default: () => defaultArr + } + ); + } +}; + +script.__scopeId = "data-v-230f65e3"; + +/** + * This class reacts to drag events emitted by the dnd object to manage a sequence of drag images and fade from one to the + * other as the drag progresses. + */ +class DragImagesManager { + + selfTransform = null; + clones = null; + source = null; + sourcePos = null; + sourceClone = null; + + constructor () { + dnd.on('dragstart', this.onDragStart.bind(this)); + dnd.on('dragtopchanged', this.onDragTopChanged.bind(this)); + dnd.on('dragpositionchanged', this.onDragPositionChanged.bind(this)); + dnd.on('dragend', this.onDragEnd.bind(this)); + } + + onDragStart (event) { + // If go-back=true and it is still animating while they attempt another drag, + // it will bug out. Best to clean up any existing elements on the page before + // attempting to start the next animation + this.cleanUp(); + + 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; + } + + onDragEnd (event) { + nextTick() + .then(() => { + if (!event.success && this.source && this.source['goBack']) { + // Restore the drag image that is active when hovering outside any drop zone : + const img = this.switch(null); + + // Move it back to its original place : + window.requestAnimationFrame(() => { + img.style.transition = 'all 0.5s'; + window.requestAnimationFrame(() => { + img.style.left = this.sourcePos.x + 'px'; + img.style.top = this.sourcePos.y + 'px'; + img.style.transform = 'translate(0,0)'; + const handler = () => { + this.cleanUp(); + img.removeEventListener('transitionend', handler); + }; + img.addEventListener('transitionend', handler); + }); + }); + } + else { + this.cleanUp(); + } + }); + } + + cleanUp () { + if (this.clones) { + this.clones.forEach((clone) => { + if (clone.parentNode === document.body) { + document.body.removeChild(clone); + } + }); + } + if (this.sourceClone !== null) { + if (this.sourceClone.parentNode === document.body) { + document.body.removeChild(this.sourceClone); + } + } + this.selfTransform = null; + this.clones = null; + this.source = null; + this.sourceClone = null; + this.sourcePos = null; + } + + onDragTopChanged (event) { + this.switch(event.top); + } + + switch (top) { + this.clones.forEach(clone => { + clone.style.opacity = '0'; + }); + if (this.sourceClone) { + this.sourceClone.style.opacity = '0'; + } + + let activeClone; + if (top === null) { + activeClone = this.getSourceClone(); + } + else { + if (!this.clones.has(top)) { + let clone = top['createDragImage'](this.selfTransform); + if (clone === 'source') { + clone = this.getSourceClone(); + } + else if (clone !== null) { + clone.style.opacity = '0'; + document.body.appendChild(clone); + } + this.clones.set(top, clone); + } + activeClone = this.clones.get(top); + } + + if (activeClone !== null) { + activeClone.offsetWidth; // Forces browser reflow + activeClone.style.opacity = activeClone['__opacity']; + activeClone.style.visibility = 'visible'; + } + + return activeClone; + } + + getSourceClone () { + if (this.sourceClone === null) { + this.sourceClone = this.source['createDragImage'](this.selfTransform); + this.sourceClone.style.opacity = '0'; + document.body.appendChild(this.sourceClone); + } + return this.sourceClone; + } + + onDragPositionChanged () { + this.clones.forEach((clone) => { + clone.style.left = dnd.position.x + 'px'; + clone.style.top = dnd.position.y + 'px'; + }); + if (this.sourceClone) { + this.sourceClone.style.left = dnd.position.x + 'px'; + this.sourceClone.style.top = dnd.position.y + 'px'; + } + } + +} + +new DragImagesManager(); + +export { DnDEvent, script$4 as Drag, DragAwareMixin, script$1 as DragFeedback, DragImagesManager, DragMixin, script$3 as Drop, script as DropList, script$2 as DropMask, DropMixin, InsertEvent, ReorderEvent, createDragImage, dnd }; diff --git a/thirdpartylibs.xml b/thirdpartylibs.xml new file mode 100644 index 0000000..19fa81b --- /dev/null +++ b/thirdpartylibs.xml @@ -0,0 +1,50 @@ + + + + + amd/src/bootstrap-vue/ + Bootstrap-Vue.js + Vue components for Bootstrap + 2.23.0 + MIT + https://github.com/bootstrap-vue/bootstrap-vue + + 2016-2023 - BootstrapVue + + + + amd/src/portal-vue/ + Portal-Vue.js + A Portal Component for Vue, to render DOM outside of a component, anywhere in the document. + 2.1.7 + MIT + https://github.com/linusborg/portal-vue + + 2021 Thorsten Lünborg + + + + amd/src/vue-easy-dnd/ + Vue-Easy-DnD + A drag and drop implementation for Vue that uses only standard mouse events instead of the HTML5 drag and drop API + 2.1.3 + MIT + https://github.com/rlemaigre/Easy-DnD + + 2019 Régis Lemaigre + + + +