turnilo
Version:
Business intelligence, data exploration and visualization web application for Druid, formerly known as Swiv and Pivot
3 lines • 9.25 kB
JavaScript
/*! For license information please see dnd-js.df8447523b31875b6e4d.js.LICENSE.txt */
(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{664:function(t,e){var i;!function(t){function e(t){if(!l){var e=function(t){var e=t.target;do{if(!1!==e.draggable&&e.getAttribute&&"true"===e.getAttribute("draggable"))return e}while((e=e.parentNode)&&e!==document.body)}(t);if(e)try{l=new x(t,f,e,i)}catch(e){throw i(f,t,3),e}}}function i(t,e,i){if(0===i&&t.defaultActionOverride)try{t.defaultActionOverride(e)}catch(t){}l=null}function n(t){return 0===t.length?0:t.reduce((function(t,e){return e+t}),0)/t.length}function s(t){return t&&t.tagName}function r(t,e){for(var i=0;i<t.changedTouches.length;i++){if(t.changedTouches[i].identifier===e)return!0}return!1}function o(t,e,i){for(var s=[],r=[],o=0;o<e.touches.length;o++){var h=e.touches[o];s.push(h[t+"X"]),r.push(h[t+"Y"])}i.x=n(s),i.y=n(r)}function h(t){var e=t.cloneNode(!0);return function t(e,i){if(1===e.nodeType){for(var n=getComputedStyle(e),s=0;s<n.length;s++){var r=n[s];i.style.setProperty(r,n.getPropertyValue(r),n.getPropertyPriority(r))}i.style.pointerEvents="none",i.removeAttribute("id"),i.removeAttribute("class"),i.removeAttribute("draggable")}if(e.hasChildNodes())for(s=0;s<e.childNodes.length;s++)t(e.childNodes[s],i.childNodes[s])}(t,e),e.style.position="absolute",e.style.left="0px",e.style.top="0px",e.style.zIndex="999999",e.classList.add(y),e.classList.add(C),e}function a(t,e,i,n,s){void 0===s&&(s=!0);var r=e.x,o=e.y;n&&(r+=n.x,o+=n.y),s&&(r-=parseInt(t.offsetWidth,10)/2,o-=parseInt(t.offsetHeight,10)/2);for(var h="translate3d("+r+"px,"+o+"px, 0)",a=0;a<v.length;a++){var d=v[a]+"transform";t.style[d]=h+" "+i[a]}}function d(t,e){return t?t===p[0]?g[0]:0===t.indexOf(p[1])||t===p[7]?g[1]:0===t.indexOf(p[4])?g[3]:t===p[6]?g[2]:g[1]:3===e.nodeType&&"A"===e.tagName?g[3]:g[1]}function c(t,e,i,n,s,r,o){void 0===r&&(r=!0),void 0===o&&(o=null);var h=function(t,e,i,n,s,r,o){void 0===o&&(o=null);var h=e.changedTouches[0],a=new Event(i,{bubbles:!0,cancelable:n});a.dataTransfer=r,a.relatedTarget=o,a.screenX=h.screenX,a.screenY=h.screenY,a.clientX=h.clientX,a.clientY=h.clientY,a.pageX=h.pageX,a.pageY=h.pageY;var d=t.getBoundingClientRect();return a.offsetX=a.clientX-d.left,a.offsetY=a.clientY-d.top,a}(e,i,t,r,document.defaultView,s,o),a=!e.dispatchEvent(h);return n.g=0,a}function u(t,e){if(!t||t===p[7])return e;if(e===g[1]){if(0===t.indexOf(g[1]))return g[1]}else if(e===g[3]){if(0===t.indexOf(g[3])||t.indexOf("Link")>-1)return g[3]}else if(e===g[2]&&(0===t.indexOf(g[2])||t.indexOf("Move")>-1))return g[2];return g[0]}var f={iterationInterval:150};t.Initialize=function(t){if(t&&Object.keys(t).forEach((function(e){f[e]=t[e]})),!f.forceApply){var i=function(){var t={dragEvents:"ondragstart"in document.documentElement,draggable:"draggable"in document.documentElement,touchEvents:"ontouchstart"in document.documentElement,userAgentSupportingNativeDnD:void 0},e=!!window.chrome||/chrome/i.test(navigator.userAgent);return t.userAgentSupportingNativeDnD=!(/iPad|iPhone|iPod|Android/.test(navigator.userAgent)||e&&t.touchEvents),t}();if(i.userAgentSupportingNativeDnD&&i.draggable&&i.dragEvents)return}document.addEventListener("touchstart",e)};var l,p=["none","copy","copyLink","copyMove","link","linkMove","move","all"],g=["none","copy","move","link"],v=["","-webkit-"],m="dnd-poly-",y=m+"drag-image",b=m+"snapback",C=m+"icon",x=function(){function t(t,e,i,n){this.h=t,this.i=e,this.j=i,this.k=n,this.l=0,this.m=null,this.o=null,this.p=t,this.q=t.changedTouches[0],this.s=this.t.bind(this),this.u=this.v.bind(this),document.addEventListener("touchmove",this.s),document.addEventListener("touchend",this.u),document.addEventListener("touchcancel",this.u)}return t.prototype.A=function(){var t=this;this.l=1,this.B=g[0],this.C={D:{},F:void 0,g:3,G:[]},this.H={x:null,y:null},this.I={x:null,y:null};var e=this.j;if(this.J=new O(this.C,(function(i,n,s){e=i,"number"!=typeof n&&"number"!=typeof s||(t.K={x:n||0,y:s||0})})),this.C.g=2,this.J.dropEffect=g[0],c("dragstart",this.j,this.p,this.C,this.J))return this.l=3,this.L(),!1;if(o("page",this.p,this.I),this.M=h(e),this.N=function(t){return v.map((function(e){var i=t.style[e+"transform"];return i&&"none"!==i?i.replace(/translate\(\D*\d+[^,]*,\D*\d+[^,]*\)\s*/g,""):""}))}(this.M),!this.K)if(this.i.dragImageOffset)this.K={x:this.i.dragImageOffset.x,y:this.i.dragImageOffset.y};else if(this.i.dragImageCenterOnTouch)this.K={x:0,y:0};else{var i=e.getBoundingClientRect(),n=getComputedStyle(e);this.K={x:i.left-this.q.clientX-parseInt(n.marginLeft,10),y:i.top-this.q.clientY-parseInt(n.marginTop,10)}}return a(this.M,this.I,this.N,this.K,this.i.dragImageCenterOnTouch),document.body.appendChild(this.M),this.O=setInterval((function(){t.P||(t.P=!0,t.R(),t.P=!1)}),this.i.iterationInterval),!0},t.prototype.L=function(){this.O&&(clearInterval(this.O),this.O=null),document.removeEventListener("touchmove",this.s),document.removeEventListener("touchend",this.u),document.removeEventListener("touchcancel",this.u),this.M&&(this.M.parentNode.removeChild(this.M),this.M=null),this.k(this.i,this.p,this.l)},t.prototype.t=function(t){var e=this;if(!1!==r(t,this.q.identifier)){if(this.p=t,0===this.l){var i=1===t.touches.length;if(this.i.dragStartConditionOverride){try{i=this.i.dragStartConditionOverride(t)}catch(t){}if("boolean"!=typeof i)return}return i?void(!0===this.A()&&(this.h.preventDefault(),t.preventDefault())):void this.L()}t.preventDefault(),o("client",t,this.H),o("page",t,this.I);if(this.i.dragImageTranslateOverride)try{if(this.i.dragImageTranslateOverride(t,{x:this.H.x,y:this.H.y},this.m,(function(t,i){e.M&&(e.H.x+=t,e.H.y+=i,e.I.x+=t,e.I.y+=i,a(e.M,e.I,e.N,e.K,e.i.dragImageCenterOnTouch))})))return}catch(t){}a(this.M,this.I,this.N,this.K,this.i.dragImageCenterOnTouch)}},t.prototype.v=function(t){if(!1!==r(t,this.q.identifier)){if(this.i.dragImageTranslateOverride)try{this.i.dragImageTranslateOverride(void 0,void 0,void 0,(function(){}))}catch(t){}if(0===this.l)return void this.L();t.preventDefault(),this.l="touchcancel"===t.type?3:2}},t.prototype.R=function(){var t=this,e=this.B;this.C.g=3,this.J.dropEffect=g[0];var i=c("drag",this.j,this.p,this.C,this.J);if(i&&(this.B=g[0]),i||2===this.l||3===this.l)return this.S(this.l)?void function(t,e,i,n){var s=getComputedStyle(t);if("hidden"!==s.visibility&&"none"!==s.display){var r=t.getBoundingClientRect(),o={x:r.left,y:r.top};o.x+=document.body.scrollLeft||document.documentElement.scrollLeft,o.y+=document.body.scrollTop||document.documentElement.scrollTop,o.x-=parseInt(s.marginLeft,10),o.y-=parseInt(s.marginTop,10),e.classList.add(b);var h=getComputedStyle(e),d=parseFloat(h.transitionDuration),c=parseFloat(h.transitionDelay),u=Math.round(1e3*(d+c));a(e,o,i,void 0,!1),setTimeout(n,u)}else n()}(this.j,this.M,this.N,(function(){t.T()})):void this.T();var n=document.elementFromPoint(this.H.x,this.H.y),r=this.o;n!==this.m&&n!==this.o&&(this.m=n,null!==this.o&&(this.C.g=3,this.J.dropEffect=g[0],c("dragexit",this.o,this.p,this.C,this.J,!1)),null===this.m?this.o=this.m:(this.C.g=3,this.J.dropEffect=d(this.C.F,this.j),c("dragenter",this.m,this.p,this.C,this.J)?(this.o=this.m,this.B=u(this.J.effectAllowed,this.J.dropEffect)):this.m!==document.body&&(this.o=document.body))),r!==this.o&&s(r)&&(this.C.g=3,this.J.dropEffect=g[0],c("dragleave",r,this.p,this.C,this.J,!1,this.o)),s(this.o)&&(this.C.g=3,this.J.dropEffect=d(this.C.F,this.j),!1===c("dragover",this.o,this.p,this.C,this.J)?this.B=g[0]:this.B=u(this.J.effectAllowed,this.J.dropEffect)),e!==this.B&&this.M.classList.remove(m+e);var o=m+this.B;!1===this.M.classList.contains(o)&&this.M.classList.add(o)},t.prototype.S=function(t){var e=this.B===g[0]||null===this.o||3===t;return e?s(this.o)&&(this.C.g=3,this.J.dropEffect=g[0],c("dragleave",this.o,this.p,this.C,this.J,!1)):s(this.o)&&(this.C.g=1,this.J.dropEffect=this.B,!0===c("drop",this.o,this.p,this.C,this.J)?this.B=this.J.dropEffect:this.B=g[0]),e},t.prototype.T=function(){this.C.g=3,this.J.dropEffect=this.B,c("dragend",this.j,this.p,this.C,this.J,!1),this.l=2,this.L()},t}(),O=function(){function t(t,e){this.U=t,this.V=e,this.W=g[0]}return Object.defineProperty(t.prototype,"types",{get:function(){if(0!==this.U.g)return Object.freeze(this.U.G)},enumerable:!0,configurable:!0}),t.prototype.setData=function(t,e){if(2===this.U.g){if(t.indexOf(" ")>-1)throw new Error("illegal arg: type contains space");this.U.D[t]=e,-1===this.U.G.indexOf(t)&&this.U.G.push(t)}},t.prototype.getData=function(t){if(1===this.U.g||2===this.U.g)return this.U.D[t]||""},t.prototype.clearData=function(t){if(2===this.U.g){if(t&&this.U.D[t]){delete this.U.D[t];var e=this.U.G.indexOf(t);return void(e>-1&&this.U.G.splice(e,1))}this.U.D={},this.U.G=[]}},t.prototype.setDragImage=function(t,e,i){2===this.U.g&&this.V(t,e,i)},Object.defineProperty(t.prototype,"effectAllowed",{get:function(){return this.U.F},set:function(t){2===this.U.g&&p.indexOf(t)>-1&&(this.U.F=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dropEffect",{get:function(){return this.W},set:function(t){0!==this.U.g&&p.indexOf(t)>-1&&(this.W=t)},enumerable:!0,configurable:!0}),t}()}(i||(i={})),t.exports=i}}]);
//# sourceMappingURL=dnd-js.df8447523b31875b6e4d.js.map