From 0e8a72de506b19a84d5e96cbfd007337186303b0 Mon Sep 17 00:00:00 2001 From: Piotr Nalepa Date: Wed, 28 Jun 2017 10:59:29 +0200 Subject: [PATCH] Updated DragsterJS meta --- README.md | 4 ++++ dragster-comment.js | 4 ++-- dragster.es6.js | 4 ++-- dragster.js | 4 ++-- dragster.min.js | 4 ++-- dragster.min.js.gz | Bin 3076 -> 3077 bytes dragster.style.css | 4 ++-- package.json | 2 +- 8 files changed, 15 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index e28d5e1..ef8f0d8 100644 --- a/README.md +++ b/README.md @@ -160,3 +160,7 @@ After drop callback. List of methods ready to be used by any webdeveloper: ### update Updates a reference to draggable elements. For example, when user adds a new element to any of droppable regions then running `update` method makes a new element draggable as well. +### updateRegions +Updates regions references and attaches event listeners to them +### destroy +Removes all event listeners related to DragsterJS diff --git a/dragster-comment.js b/dragster-comment.js index 2f31266..fde860c 100644 --- a/dragster-comment.js +++ b/dragster-comment.js @@ -1,5 +1,5 @@ /*@preserve - * Dragster - drag'n'drop library v1.6.0 + * Dragster - drag'n'drop library v1.6.2 * https://github.com/sunpietro/dragster * * Copyright 2015-2017 Piotr Nalepa @@ -8,5 +8,5 @@ * Released under the MIT license * https://github.com/sunpietro/dragster/blob/master/LICENSE * - * Date: 2017-05-06T22:30Z + * Date: 2017-06-28T22:30Z */ diff --git a/dragster.es6.js b/dragster.es6.js index 0dae93c..36fc90e 100644 --- a/dragster.es6.js +++ b/dragster.es6.js @@ -1,5 +1,5 @@ /*@preserve - * Dragster - drag'n'drop library v1.6.0 + * Dragster - drag'n'drop library v1.6.2 * https://github.com/sunpietro/dragster * * Copyright 2015-2017 Piotr Nalepa @@ -8,7 +8,7 @@ * Released under the MIT license * https://github.com/sunpietro/dragster/blob/master/LICENSE * - * Date: 2017-05-06T22:30Z + * Date: 2017-06-28T22:30Z */ //jshint ignore:line var Dragster = function (params) { diff --git a/dragster.js b/dragster.js index 5554e39..f3abbaa 100644 --- a/dragster.js +++ b/dragster.js @@ -1,5 +1,5 @@ /*@preserve - * Dragster - drag'n'drop library v1.6.0 + * Dragster - drag'n'drop library v1.6.2 * https://github.com/sunpietro/dragster * * Copyright 2015-2017 Piotr Nalepa @@ -8,7 +8,7 @@ * Released under the MIT license * https://github.com/sunpietro/dragster/blob/master/LICENSE * - * Date: 2017-05-06T22:30Z + * Date: 2017-06-28T22:30Z */ //jshint ignore:line ;(function (root, moduleName, factory) { diff --git a/dragster.min.js b/dragster.min.js index e3824ea..6aa71ef 100644 --- a/dragster.min.js +++ b/dragster.min.js @@ -1,5 +1,5 @@ /*@preserve - * Dragster - drag'n'drop library v1.6.0 + * Dragster - drag'n'drop library v1.6.2 * https://github.com/sunpietro/dragster * * Copyright 2015-2017 Piotr Nalepa @@ -8,6 +8,6 @@ * Released under the MIT license * https://github.com/sunpietro/dragster/blob/master/LICENSE * - * Date: 2017-05-06T22:30Z + * Date: 2017-06-28T22:30Z */ !function(e,t,n){"use strict";"function"==typeof define&&define.amd?define(t,n):"object"==typeof exports?exports=module.exports=n():e[t]=n()}(this,"Dragster",function(){"use strict";var e=function(e){var t,n,o,r,a,s,d,l,i,c,m,u,g,p,f,h,v,E,L,w,y,C,b,D,B,T,H,M,N,P,R,S,I,A="dragster-",O="is-dragging",Y="is-drag-over",x=A+"draggable",X=A+"drag-region",q=A+"drop-placeholder",F=A+"temp",U=F+"-container",j=A+"is-hidden",k=A+"replacable",z="touchstart",J="touchmove",W="touchend",G="mousedown",K="mousemove",Q="mouseup",V="top",Z="bottom",$="px",_="div",ee=!1,te=!0,ne=null,oe=function(){},re={elementSelector:".dragster-block",regionSelector:".dragster-region",dragHandleCssClass:ee,dragOnlyRegionCssClass:A+"region--drag-only",replaceElements:ee,updateRegionsHeight:te,minimumRegionHeight:60,onBeforeDragStart:oe,onAfterDragStart:oe,onBeforeDragMove:oe,onAfterDragMove:oe,onBeforeDragEnd:oe,onAfterDragEnd:oe,onAfterDragDrop:oe,scrollWindowOnDrag:ee,dragOnlyRegionsEnabled:ee,cloneElements:ee,wrapDraggableElements:te,shadowElementUnderMouse:ee},ae={top:ee,bottom:ee},se={drag:{node:ne},drop:{node:ne},shadow:{node:ne,top:0,left:0},placeholder:{node:ne,position:ne},dropped:ne,clonedFrom:ne,clonedTo:ne},de={},le=window.innerHeight,ie=Math.floor(65536*(1+Math.random())).toString(16);for(t in e)e.hasOwnProperty(t)&&(re[t]=e[t]);return C=function(){return[].slice.call(document.querySelectorAll(re.elementSelector))},b=function(){return[].slice.call(document.querySelectorAll(re.regionSelector))},D=function(e){return re.wrapDraggableElements===ee?(console.warn("You have disabled the default behavior of wrapping the draggable elements. If you want Dragster.js to work properly you still will have to do this manually.\n\nMore info: https://github.com/sunpietro/dragster/blob/master/README.md#user-content-wrapdraggableelements---boolean"),ee):void e.forEach(function(e){var t=f(),n=e.parentNode;return n.classList.contains(x)?ee:(n.insertBefore(t,e),n.removeChild(e),void t.appendChild(e))})},l=C(),n=b(),re.replaceElements&&(s=document.createElement(_),s.classList.add(j),s.classList.add(U),document.body.appendChild(s)),o=function(e,t){var n=e.parentNode;if(n&&(!e.classList||!e.classList.contains(X)||e.classList.contains(re.dragOnlyRegionCssClass)))return t(e)?e:t(n)?n:o(n,t)},L=function(e){var t=[].slice.call(document.getElementsByClassName(e));t.forEach(function(e){e.dataset.dragsterId===ie&&e.parentNode.removeChild(e)})},w=function(e,t){t&&(n.forEach(function(e){e.removeEventListener(t,i.mousemove)}),document.body.removeEventListener(t,i.mousemove)),e&&e.classList.remove(O),[].slice.call(document.getElementsByClassName(x)).forEach(function(e){e.firstChild||e.parentNode.removeChild(e)}),L(q),L(F),B()},y=function(){[].slice.call(document.getElementsByClassName(k)).forEach(function(e){e.classList.remove(k)})},f=function(){var e=document.createElement(_);return e.classList.add(x),e.dataset.dragsterId=ie,e},v=function(){var e=document.createElement(_);return e.classList.add(q),e.dataset.dragsterId=ie,e},h=function(){var e=document.createElement(_);return e.classList.add(F),e.classList.add(j),e.style.position="fixed",e.dataset.dragsterId=ie,document.body.appendChild(e),e},g=function(e,t){if(e&&e.parentNode){var n=re.wrapDraggableElements===ee?e:e.nextSibling;e.parentNode.insertBefore(t,n)}},p=function(e,t){e&&e.parentNode&&e.parentNode.insertBefore(t,e)},m=function(e){return e.classList&&e.classList.contains(x)&&e.dataset.dragsterId===ie},c=function(e){return e.classList&&e.classList.contains(q)},u=function(e){return e.classList&&e.classList.contains(re.dragOnlyRegionCssClass)},B=function(){if(re.updateRegionsHeight){var e=[].slice.call(document.getElementsByClassName(X));e.forEach(function(e){var t=[].slice.call(e.querySelectorAll(re.elementSelector)),n=re.minimumRegionHeight;t.length&&(t.forEach(function(e){var t=window.getComputedStyle(e);n+=e.offsetHeight+parseInt(t.marginTop,10)+parseInt(t.marginBottom,10)}),e.style.height=n+$)})}},M=function(e,t){w(d,e),w(d,t)},i={mousedown:function(e){if(re.dragHandleCssClass&&("string"!=typeof re.dragHandleCssClass||!e.target.classList.contains(re.dragHandleCssClass)))return ee;var t,s,l,c=e.type===z,u=e.changedTouches?e.changedTouches[0]:e;return de=JSON.parse(JSON.stringify(se)),e.dragster=de,re.onBeforeDragStart(e)===ee||3===e.which?ee:(e.preventDefault(),(d=o(e.target,m))?(s=c?J:K,l=c?W:Q,n.forEach(function(e){e.addEventListener(s,i.mousemove,ee),e.addEventListener(l,i.mouseup,ee)}),document.body.addEventListener(s,i.mousemove,ee),document.body.addEventListener(l,i.mouseup,ee),t=d.getBoundingClientRect(),R=t.left-u.clientX,S=t.top-u.clientY,r=h(),r.innerHTML=d.innerHTML,r.style.width=t.width+$,r.style.height=t.height+$,r.dataset.dragsterId=ie,a=r.getBoundingClientRect(),d.classList.add(O),de.drag.node=d,de.shadow.node=r,e.dragster=de,void re.onAfterDragStart(e)):ee)},mousemove:function(e){if(e.dragster=de,re.onBeforeDragMove(e)===ee||!a)return ee;e.preventDefault();var t=e.changedTouches?e.changedTouches[0]:e,n=t.view?t.view.pageXOffset:0,s=t.view?t.view.pageYOffset:0,l=t.clientY+s,i=t.clientX+n,c=document.elementFromPoint(t.clientX,t.clientY),g=o(c,m),p=re.shadowElementUnderMouse?t.clientY+S:t.clientY,f=re.shadowElementUnderMouse?i+R:i-a.width/2,h=de.drag.node&&de.drag.node.dataset,v=!(!g||!o(g,u)),L=c.dataset.dragsterId===ie,w=c.classList.contains(X)&&L,y=c.classList.contains(re.dragOnlyRegionCssClass)&&L,C=c.classList.contains(q),b=c.getElementsByClassName(x).length>0,D=c.getElementsByClassName(q).length>0;clearTimeout(E),r.style.top=p+$,r.style.left=f+$,r.classList.remove(j),de.shadow.top=p,de.shadow.left=f,h||w||C?g&&g!==d&&!v?(P.removePlaceholders(),P.addPlaceholderOnTarget(g,l,s)):!w||y||b||D?w&&!y&&b&&!D&&(P.removePlaceholders(),P.addPlaceholderInRegionBelowTargets(c)):(P.removePlaceholders(),P.addPlaceholderInRegion(c)):P.removePlaceholders(),re.scrollWindowOnDrag&&T(e),B(),re.onAfterDragMove(e)},mouseup:function(e){e.dragster=de;var t,n,r,a,s,l=e.type===z,i=l?J:K,c=l?W:Q;return re.onBeforeDragEnd(e)===ee?(M(i,c),ee):(t=re.replaceElements?k:q,n=document.getElementsByClassName(t)[0],a=!(!d||!o(d,u)),s=re.cloneElements&&a,E=setTimeout(M,200),y(),d&&n?(r=o(n,m),r=r||n,d!==r&&(re.replaceElements||s?re.replaceElements&&!s?(e.dragster=N.replaceElements(e.dragster,r),re.onAfterDragDrop(e)):!re.replaceElements&&s&&(e.dragster=N.cloneElements(e.dragster,n,r),re.onAfterDragDrop(e)):(e.dragster=N.moveElement(e.dragster,n,r),re.onAfterDragDrop(e)),r.classList.remove(Y)),M(i,c),void re.onAfterDragEnd(e)):(M(i,c),ee))}},P={addPlaceholderOnTarget:function(e,t,n){var o=e.getBoundingClientRect(),r=v(),a=o.height/2;y(),re.replaceElements?e.classList.add(k):t-n-o.topGcXtrTVbZfaKH7~F76nuazUyaH01PQ5Ms! zS;7-~yCYZqKRZ1-xwtvWPB?Z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