ngx-drag-drop
Advanced tools
Comparing version 2.0.0-rc.3 to 2.0.0-rc.4
@@ -23,13 +23,15 @@ (function (global, factory) { | ||
function getWellKnownMimeType(event) { | ||
var /** @type {?} */ types = event.dataTransfer.types; | ||
// IE 9 workaround. | ||
if (!types) { | ||
return MSIE_MIME_TYPE; | ||
} | ||
for (var /** @type {?} */ i = 0; i < types.length; i++) { | ||
if (types[i] === MSIE_MIME_TYPE | ||
|| types[i] === JSON_MIME_TYPE | ||
|| mimeTypeIsCustom(types[i])) { | ||
return types[i]; | ||
if (event.dataTransfer) { | ||
var /** @type {?} */ types = event.dataTransfer.types; | ||
// IE 9 workaround. | ||
if (!types) { | ||
return MSIE_MIME_TYPE; | ||
} | ||
for (var /** @type {?} */ i = 0; i < types.length; i++) { | ||
if (types[i] === MSIE_MIME_TYPE | ||
|| types[i] === JSON_MIME_TYPE | ||
|| mimeTypeIsCustom(types[i])) { | ||
return types[i]; | ||
} | ||
} | ||
} | ||
@@ -94,3 +96,4 @@ return null; | ||
function filterEffects(effects, allowed) { | ||
if (allowed === "all") { | ||
if (allowed === "all" | ||
|| allowed === "uninitialized") { | ||
return effects; | ||
@@ -204,4 +207,4 @@ } | ||
function getDropEffect(event, effectAllowed) { | ||
var /** @type {?} */ effects = DROP_EFFECTS; | ||
effects = filterEffects(effects, /** @type {?} */ (event.dataTransfer.effectAllowed)); | ||
var /** @type {?} */ dataTransferEffectAllowed = (event.dataTransfer) ? /** @type {?} */ (event.dataTransfer.effectAllowed) : "uninitialized"; | ||
var /** @type {?} */ effects = filterEffects(DROP_EFFECTS, dataTransferEffectAllowed); | ||
if (_dndState.isDragging === true) { | ||
@@ -208,0 +211,0 @@ effects = filterEffects(effects, _dndState.effectAllowed); |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/common"],t):t(e["ngx-drag-drop"]={},e.ng.core,e.ng.common)}(this,function(e,t,n){"use strict";function r(e){return e.substr(0,y.length)===y}function d(e){var t=e.dataTransfer.types;if(!t)return b;for(var n=0;n<t.length;n++)if(t[n]===b||t[n]===E||r(t[n]))return t[n];return null}function a(e,t,n){var r=y+(t.type?"-"+t.type:""),d=JSON.stringify(t);try{e.dataTransfer.setData(r,d)}catch(i){try{e.dataTransfer.setData(E,d)}catch(i){var a=o(D,n);e.dataTransfer.effectAllowed=a[0],e.dataTransfer.setData(b,d)}}}function i(e,t){var n=d(e);return!0===t?null!==n&&r(n)?JSON.parse(e.dataTransfer.getData(n)):{}:JSON.parse(e.dataTransfer.getData(n))}function o(e,t){return"all"===t?e:e.filter(function(e){return-1!==t.toLowerCase().indexOf(e)})}function s(e,t){for(var n=t;n.parentNode!==e;){if(!n.parentNode)return null;n=n.parentNode}return n}function l(e,t,n){var r=t.getBoundingClientRect();return n?e.clientX<r.left+r.width/2:e.clientY<r.top+r.height/2}function f(e,t){var n=window.getComputedStyle(t),r=parseFloat(n.paddingTop)||0,d=parseFloat(n.paddingLeft)||0,a=parseFloat(n.borderTopWidth)||0,i=parseFloat(n.borderLeftWidth)||0;return{x:e.offsetX+d+i,y:e.offsetY+r+a}}function p(e,t,n){var r=n(e,t)||{x:0,y:0};e.dataTransfer.setDragImage(t,r.x,r.y)}function g(e,t,n){R.isDragging=!0,R.dropEffect="none",R.effectAllowed=t,R.type=n,e.dataTransfer.effectAllowed=t}function u(){R.isDragging=!1,R.dropEffect=undefined,R.effectAllowed=undefined,R.type=undefined}function c(e,t){!0===R.isDragging&&(R.dropEffect=t),e.dataTransfer.dropEffect=t}function h(e,t){var n=D;return n=o(n,e.dataTransfer.effectAllowed),!0===R.isDragging&&(n=o(n,R.effectAllowed)),t&&(n=o(n,t)),0===n.length?"none":e.ctrlKey&&-1!==n.indexOf("copy")?"copy":e.altKey&&-1!==n.indexOf("link")?"link":n[0]}function v(e){if(!0===R.isDragging)return R.type;var t=d(e);return null===t?undefined:t===b||t===E?undefined:t.substr(y.length+1)||undefined}function m(){return!1===R.isDragging}var D=["move","copy","link"],y="application/x-dnd",E="application/json",b="Text",R={isDragging:!1,dropEffect:"none",effectAllowed:"all",type:undefined},C=R,I=function(){function e(e,t){e.registerDragImage(t)}return e}();I.decorators=[{type:t.Directive,args:[{selector:"[dndDragImageRef]"}]}],I.ctorParameters=function(){return[{type:w},{type:t.ElementRef}]};var w=function(){function e(e,n){this.elementRef=e,this.renderer=n,this.dndEffectAllowed="copy",this.dndDraggingClass="dndDragging",this.dndDraggingSourceClass="dndDraggingSource",this.dndDraggableDisabledClass="dndDraggableDisabled",this.dndDragImageOffsetFunction=f,this.dndStart=new t.EventEmitter,this.dndEnd=new t.EventEmitter,this.dndMoved=new t.EventEmitter,this.dndCopied=new t.EventEmitter,this.dndLinked=new t.EventEmitter,this.dndCanceled=new t.EventEmitter,this.draggable=!0}return Object.defineProperty(e.prototype,"dndDisableIf",{set:function(e){this.draggable=!e,this.draggable?this.renderer.removeClass(this.elementRef.nativeElement,this.dndDraggableDisabledClass):this.renderer.addClass(this.elementRef.nativeElement,this.dndDraggableDisabledClass)},enumerable:!0,configurable:!0}),e.prototype.onDragStart=function(e){var t=this;if(!1===this.draggable)return!1;if("undefined"!=typeof this.dndHandle&&"undefined"==typeof e._dndUsingHandle)return!1;g(e,this.dndEffectAllowed,this.dndType),a(e,{data:this.dndDraggable,type:this.dndType},C.effectAllowed),this.determineDragImage(),this.renderer.addClass(this.dragImage,this.dndDraggingClass),"undefined"==typeof this.dndDragImageElementRef&&"undefined"==typeof e._dndUsingHandle||p(e,this.dragImage,this.dndDragImageOffsetFunction);var n=this.renderer.listen(this.elementRef.nativeElement,"drag",function(){t.renderer.addClass(t.elementRef.nativeElement,t.dndDraggingSourceClass),n()});this.dndStart.emit(e),e.stopPropagation()},e.prototype.onDragEnd=function(e){var t,n=this;switch(C.dropEffect){case"copy":t=this.dndCopied;break;case"link":t=this.dndLinked;break;case"move":t=this.dndMoved;break;default:t=this.dndCanceled}t.emit(e),this.dndEnd.emit(e),u(),this.renderer.removeClass(this.dragImage,this.dndDraggingClass),window.setTimeout(function(){n.renderer.removeClass(n.elementRef.nativeElement,n.dndDraggingSourceClass)},0),e.stopPropagation()},e.prototype.registerDragHandle=function(e){this.dndHandle=e},e.prototype.registerDragImage=function(e){this.dndDragImageElementRef=e},e.prototype.determineDragImage=function(){"undefined"!=typeof this.dndDragImageElementRef?this.dragImage=this.dndDragImageElementRef.nativeElement:this.dragImage=this.elementRef.nativeElement},e}();w.decorators=[{type:t.Directive,args:[{selector:"[dndDraggable]"}]}],w.ctorParameters=function(){return[{type:t.ElementRef},{type:t.Renderer2}]},w.propDecorators={dndDraggable:[{type:t.Input}],dndEffectAllowed:[{type:t.Input}],dndType:[{type:t.Input}],dndDraggingClass:[{type:t.Input}],dndDraggingSourceClass:[{type:t.Input}],dndDraggableDisabledClass:[{type:t.Input}],dndDragImageOffsetFunction:[{type:t.Input}],dndStart:[{type:t.Output}],dndEnd:[{type:t.Output}],dndMoved:[{type:t.Output}],dndCopied:[{type:t.Output}],dndLinked:[{type:t.Output}],dndCanceled:[{type:t.Output}],draggable:[{type:t.HostBinding,args:["attr.draggable"]}],dndDisableIf:[{type:t.Input}],onDragStart:[{type:t.HostListener,args:["dragstart",["$event"]]}],onDragEnd:[{type:t.HostListener,args:["dragend",["$event"]]}]};var A=function(){function e(e){this.elementRef=e}return e}();A.decorators=[{type:t.Directive,args:[{selector:"[dndPlaceholderRef]"}]}],A.ctorParameters=function(){return[{type:t.ElementRef}]};var O=function(){function e(e,n,r){var d=this;this.ngZone=e,this.elementRef=n,this.renderer=r,this.dndAllowExternal=!1,this.dndHorizontal=!1,this.dndDragoverClass="dndDragover",this.dndDropzoneDisabledClass="dndDropzoneDisabled",this.dndDragover=new t.EventEmitter,this.dndDrop=new t.EventEmitter,this.placeholder=null,this.disabled=!1,this.dragEnterEventHandler=function(e){return d.onDragEnter(e)},this.dragOverEventHandler=function(e){return d.onDragOver(e)},this.dragLeaveEventHandler=function(e){return d.onDragLeave(e)}}return Object.defineProperty(e.prototype,"dndDisableIf",{set:function(e){this.disabled=!!e,this.disabled?this.renderer.addClass(this.elementRef.nativeElement,this.dndDropzoneDisabledClass):this.renderer.removeClass(this.elementRef.nativeElement,this.dndDropzoneDisabledClass)},enumerable:!0,configurable:!0}),e.prototype.ngAfterViewInit=function(){var e=this;this.placeholder=this.tryGetPlaceholder(),this.removePlaceholderFromDOM(),this.ngZone.runOutsideAngular(function(){e.elementRef.nativeElement.addEventListener("dragenter",e.dragEnterEventHandler),e.elementRef.nativeElement.addEventListener("dragover",e.dragOverEventHandler),e.elementRef.nativeElement.addEventListener("dragleave",e.dragLeaveEventHandler)})},e.prototype.ngOnDestroy=function(){this.elementRef.nativeElement.removeEventListener("dragenter",this.dragEnterEventHandler),this.elementRef.nativeElement.removeEventListener("dragover",this.dragOverEventHandler),this.elementRef.nativeElement.removeEventListener("dragleave",this.dragLeaveEventHandler)},e.prototype.onDragEnter=function(e){if(!0!==e._dndDropzoneActive){if("undefined"==typeof e._dndDropzoneActive){var t=document.elementFromPoint(e.clientX,e.clientY);this.elementRef.nativeElement.contains(t)&&(e._dndDropzoneActive=!0)}var n=v(e);!1!==this.isDropAllowed(n)&&e.preventDefault()}else this.cleanupDragoverState()},e.prototype.onDragOver=function(e){if(!e.defaultPrevented){var t=v(e);if(!1!==this.isDropAllowed(t)){this.checkAndUpdatePlaceholderPosition(e);var n=h(e,this.dndEffectAllowed);"none"!==n?(e.preventDefault(),c(e,n),this.dndDragover.emit(e),this.renderer.addClass(this.elementRef.nativeElement,this.dndDragoverClass)):this.cleanupDragoverState()}}},e.prototype.onDrop=function(e){try{var t=v(e);if(!1===this.isDropAllowed(t))return;var n=i(e,m());if(!1===this.isDropAllowed(n.type))return;e.preventDefault();var r=h(e);if(c(e,r),"none"===r)return;var d=this.getPlaceholderIndex();this.dndDrop.emit({event:e,dropEffect:r,isExternal:m(),data:n.data,index:d,type:t}),e.stopPropagation()}finally{this.cleanupDragoverState()}},e.prototype.onDragLeave=function(e){if("undefined"==typeof e._dndDropzoneActive){var t=document.elementFromPoint(e.clientX,e.clientY);if(this.elementRef.nativeElement.contains(t))return void(e._dndDropzoneActive=!0)}this.cleanupDragoverState(),c(e,"none")},e.prototype.isDropAllowed=function(e){if(!0===this.disabled)return!1;if(!0===m()&&!1===this.dndAllowExternal)return!1;if(!this.dndDropzone)return!0;if(!e)return!0;if(!1===Array.isArray(this.dndDropzone))throw new Error("dndDropzone: bound value to [dndDropzone] must be an array!");return-1!==this.dndDropzone.indexOf(e)},e.prototype.tryGetPlaceholder=function(){return"undefined"!=typeof this.dndPlaceholderRef?this.dndPlaceholderRef.elementRef.nativeElement:this.elementRef.nativeElement.querySelector("[dndPlaceholderRef]")},e.prototype.removePlaceholderFromDOM=function(){null!==this.placeholder&&null!==this.placeholder.parentNode&&this.placeholder.parentNode.removeChild(this.placeholder)},e.prototype.checkAndUpdatePlaceholderPosition=function(e){if(null!==this.placeholder){this.placeholder.parentNode!==this.elementRef.nativeElement&&this.renderer.appendChild(this.elementRef.nativeElement,this.placeholder);var t=s(this.elementRef.nativeElement,e.target);null!==t&&t!==this.placeholder&&(l(e,t,this.dndHorizontal)?t.previousSibling!==this.placeholder&&this.renderer.insertBefore(this.elementRef.nativeElement,this.placeholder,t):t.nextSibling!==this.placeholder&&this.renderer.insertBefore(this.elementRef.nativeElement,this.placeholder,t.nextSibling))}},e.prototype.getPlaceholderIndex=function(){if(null===this.placeholder)return undefined;var e=this.elementRef.nativeElement;return Array.prototype.indexOf.call(e.children,this.placeholder)},e.prototype.cleanupDragoverState=function(){this.renderer.removeClass(this.elementRef.nativeElement,this.dndDragoverClass),this.removePlaceholderFromDOM()},e}();O.decorators=[{type:t.Directive,args:[{selector:"[dndDropzone]"}]}],O.ctorParameters=function(){return[{type:t.NgZone},{type:t.ElementRef},{type:t.Renderer2}]},O.propDecorators={dndDropzone:[{type:t.Input}],dndEffectAllowed:[{type:t.Input}],dndAllowExternal:[{type:t.Input}],dndHorizontal:[{type:t.Input}],dndDragoverClass:[{type:t.Input}],dndDropzoneDisabledClass:[{type:t.Input}],dndDragover:[{type:t.Output}],dndDrop:[{type:t.Output}],dndPlaceholderRef:[{type:t.ContentChild,args:[A]}],dndDisableIf:[{type:t.Input}],onDrop:[{type:t.HostListener,args:["drop",["$event"]]}]};var P=function(){function e(e){this.draggable=!0,e.registerDragHandle(this)}return e.prototype.onDragEvent=function(e){e._dndUsingHandle=!0},e}();P.decorators=[{type:t.Directive,args:[{selector:"[dndHandle]"}]}],P.ctorParameters=function(){return[{type:w}]},P.propDecorators={draggable:[{type:t.HostBinding,args:["attr.draggable"]}],onDragEvent:[{type:t.HostListener,args:["dragstart",["$event"]]},{type:t.HostListener,args:["dragend",["$event"]]}]};var H=function(){function e(){}return e}();H.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule],declarations:[w,O,P,A,I],exports:[w,O,P,A,I]}]}],H.ctorParameters=function(){return[]},e.DndDragImageRefDirective=I,e.DndDraggableDirective=w,e.DndPlaceholderRefDirective=A,e.DndDropzoneDirective=O,e.DndHandleDirective=P,e.DndModule=H,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/common"],t):t(e["ngx-drag-drop"]={},e.ng.core,e.ng.common)}(this,function(e,t,n){"use strict";function r(e){return e.substr(0,y.length)===y}function d(e){if(e.dataTransfer){var t=e.dataTransfer.types;if(!t)return b;for(var n=0;n<t.length;n++)if(t[n]===b||t[n]===E||r(t[n]))return t[n]}return null}function a(e,t,n){var r=y+(t.type?"-"+t.type:""),d=JSON.stringify(t);try{e.dataTransfer.setData(r,d)}catch(i){try{e.dataTransfer.setData(E,d)}catch(i){var a=o(D,n);e.dataTransfer.effectAllowed=a[0],e.dataTransfer.setData(b,d)}}}function i(e,t){var n=d(e);return!0===t?null!==n&&r(n)?JSON.parse(e.dataTransfer.getData(n)):{}:JSON.parse(e.dataTransfer.getData(n))}function o(e,t){return"all"===t||"uninitialized"===t?e:e.filter(function(e){return-1!==t.toLowerCase().indexOf(e)})}function s(e,t){for(var n=t;n.parentNode!==e;){if(!n.parentNode)return null;n=n.parentNode}return n}function l(e,t,n){var r=t.getBoundingClientRect();return n?e.clientX<r.left+r.width/2:e.clientY<r.top+r.height/2}function f(e,t){var n=window.getComputedStyle(t),r=parseFloat(n.paddingTop)||0,d=parseFloat(n.paddingLeft)||0,a=parseFloat(n.borderTopWidth)||0,i=parseFloat(n.borderLeftWidth)||0;return{x:e.offsetX+d+i,y:e.offsetY+r+a}}function p(e,t,n){var r=n(e,t)||{x:0,y:0};e.dataTransfer.setDragImage(t,r.x,r.y)}function g(e,t,n){R.isDragging=!0,R.dropEffect="none",R.effectAllowed=t,R.type=n,e.dataTransfer.effectAllowed=t}function u(){R.isDragging=!1,R.dropEffect=undefined,R.effectAllowed=undefined,R.type=undefined}function c(e,t){!0===R.isDragging&&(R.dropEffect=t),e.dataTransfer.dropEffect=t}function h(e,t){var n=e.dataTransfer?e.dataTransfer.effectAllowed:"uninitialized",r=o(D,n);return!0===R.isDragging&&(r=o(r,R.effectAllowed)),t&&(r=o(r,t)),0===r.length?"none":e.ctrlKey&&-1!==r.indexOf("copy")?"copy":e.altKey&&-1!==r.indexOf("link")?"link":r[0]}function v(e){if(!0===R.isDragging)return R.type;var t=d(e);return null===t?undefined:t===b||t===E?undefined:t.substr(y.length+1)||undefined}function m(){return!1===R.isDragging}var D=["move","copy","link"],y="application/x-dnd",E="application/json",b="Text",R={isDragging:!1,dropEffect:"none",effectAllowed:"all",type:undefined},C=R,I=function(){function e(e,t){e.registerDragImage(t)}return e}();I.decorators=[{type:t.Directive,args:[{selector:"[dndDragImageRef]"}]}],I.ctorParameters=function(){return[{type:w},{type:t.ElementRef}]};var w=function(){function e(e,n){this.elementRef=e,this.renderer=n,this.dndEffectAllowed="copy",this.dndDraggingClass="dndDragging",this.dndDraggingSourceClass="dndDraggingSource",this.dndDraggableDisabledClass="dndDraggableDisabled",this.dndDragImageOffsetFunction=f,this.dndStart=new t.EventEmitter,this.dndEnd=new t.EventEmitter,this.dndMoved=new t.EventEmitter,this.dndCopied=new t.EventEmitter,this.dndLinked=new t.EventEmitter,this.dndCanceled=new t.EventEmitter,this.draggable=!0}return Object.defineProperty(e.prototype,"dndDisableIf",{set:function(e){this.draggable=!e,this.draggable?this.renderer.removeClass(this.elementRef.nativeElement,this.dndDraggableDisabledClass):this.renderer.addClass(this.elementRef.nativeElement,this.dndDraggableDisabledClass)},enumerable:!0,configurable:!0}),e.prototype.onDragStart=function(e){var t=this;if(!1===this.draggable)return!1;if("undefined"!=typeof this.dndHandle&&"undefined"==typeof e._dndUsingHandle)return!1;g(e,this.dndEffectAllowed,this.dndType),a(e,{data:this.dndDraggable,type:this.dndType},C.effectAllowed),this.determineDragImage(),this.renderer.addClass(this.dragImage,this.dndDraggingClass),"undefined"==typeof this.dndDragImageElementRef&&"undefined"==typeof e._dndUsingHandle||p(e,this.dragImage,this.dndDragImageOffsetFunction);var n=this.renderer.listen(this.elementRef.nativeElement,"drag",function(){t.renderer.addClass(t.elementRef.nativeElement,t.dndDraggingSourceClass),n()});this.dndStart.emit(e),e.stopPropagation()},e.prototype.onDragEnd=function(e){var t,n=this;switch(C.dropEffect){case"copy":t=this.dndCopied;break;case"link":t=this.dndLinked;break;case"move":t=this.dndMoved;break;default:t=this.dndCanceled}t.emit(e),this.dndEnd.emit(e),u(),this.renderer.removeClass(this.dragImage,this.dndDraggingClass),window.setTimeout(function(){n.renderer.removeClass(n.elementRef.nativeElement,n.dndDraggingSourceClass)},0),e.stopPropagation()},e.prototype.registerDragHandle=function(e){this.dndHandle=e},e.prototype.registerDragImage=function(e){this.dndDragImageElementRef=e},e.prototype.determineDragImage=function(){"undefined"!=typeof this.dndDragImageElementRef?this.dragImage=this.dndDragImageElementRef.nativeElement:this.dragImage=this.elementRef.nativeElement},e}();w.decorators=[{type:t.Directive,args:[{selector:"[dndDraggable]"}]}],w.ctorParameters=function(){return[{type:t.ElementRef},{type:t.Renderer2}]},w.propDecorators={dndDraggable:[{type:t.Input}],dndEffectAllowed:[{type:t.Input}],dndType:[{type:t.Input}],dndDraggingClass:[{type:t.Input}],dndDraggingSourceClass:[{type:t.Input}],dndDraggableDisabledClass:[{type:t.Input}],dndDragImageOffsetFunction:[{type:t.Input}],dndStart:[{type:t.Output}],dndEnd:[{type:t.Output}],dndMoved:[{type:t.Output}],dndCopied:[{type:t.Output}],dndLinked:[{type:t.Output}],dndCanceled:[{type:t.Output}],draggable:[{type:t.HostBinding,args:["attr.draggable"]}],dndDisableIf:[{type:t.Input}],onDragStart:[{type:t.HostListener,args:["dragstart",["$event"]]}],onDragEnd:[{type:t.HostListener,args:["dragend",["$event"]]}]};var A=function(){function e(e){this.elementRef=e}return e}();A.decorators=[{type:t.Directive,args:[{selector:"[dndPlaceholderRef]"}]}],A.ctorParameters=function(){return[{type:t.ElementRef}]};var O=function(){function e(e,n,r){var d=this;this.ngZone=e,this.elementRef=n,this.renderer=r,this.dndAllowExternal=!1,this.dndHorizontal=!1,this.dndDragoverClass="dndDragover",this.dndDropzoneDisabledClass="dndDropzoneDisabled",this.dndDragover=new t.EventEmitter,this.dndDrop=new t.EventEmitter,this.placeholder=null,this.disabled=!1,this.dragEnterEventHandler=function(e){return d.onDragEnter(e)},this.dragOverEventHandler=function(e){return d.onDragOver(e)},this.dragLeaveEventHandler=function(e){return d.onDragLeave(e)}}return Object.defineProperty(e.prototype,"dndDisableIf",{set:function(e){this.disabled=!!e,this.disabled?this.renderer.addClass(this.elementRef.nativeElement,this.dndDropzoneDisabledClass):this.renderer.removeClass(this.elementRef.nativeElement,this.dndDropzoneDisabledClass)},enumerable:!0,configurable:!0}),e.prototype.ngAfterViewInit=function(){var e=this;this.placeholder=this.tryGetPlaceholder(),this.removePlaceholderFromDOM(),this.ngZone.runOutsideAngular(function(){e.elementRef.nativeElement.addEventListener("dragenter",e.dragEnterEventHandler),e.elementRef.nativeElement.addEventListener("dragover",e.dragOverEventHandler),e.elementRef.nativeElement.addEventListener("dragleave",e.dragLeaveEventHandler)})},e.prototype.ngOnDestroy=function(){this.elementRef.nativeElement.removeEventListener("dragenter",this.dragEnterEventHandler),this.elementRef.nativeElement.removeEventListener("dragover",this.dragOverEventHandler),this.elementRef.nativeElement.removeEventListener("dragleave",this.dragLeaveEventHandler)},e.prototype.onDragEnter=function(e){if(!0!==e._dndDropzoneActive){if("undefined"==typeof e._dndDropzoneActive){var t=document.elementFromPoint(e.clientX,e.clientY);this.elementRef.nativeElement.contains(t)&&(e._dndDropzoneActive=!0)}var n=v(e);!1!==this.isDropAllowed(n)&&e.preventDefault()}else this.cleanupDragoverState()},e.prototype.onDragOver=function(e){if(!e.defaultPrevented){var t=v(e);if(!1!==this.isDropAllowed(t)){this.checkAndUpdatePlaceholderPosition(e);var n=h(e,this.dndEffectAllowed);"none"!==n?(e.preventDefault(),c(e,n),this.dndDragover.emit(e),this.renderer.addClass(this.elementRef.nativeElement,this.dndDragoverClass)):this.cleanupDragoverState()}}},e.prototype.onDrop=function(e){try{var t=v(e);if(!1===this.isDropAllowed(t))return;var n=i(e,m());if(!1===this.isDropAllowed(n.type))return;e.preventDefault();var r=h(e);if(c(e,r),"none"===r)return;var d=this.getPlaceholderIndex();this.dndDrop.emit({event:e,dropEffect:r,isExternal:m(),data:n.data,index:d,type:t}),e.stopPropagation()}finally{this.cleanupDragoverState()}},e.prototype.onDragLeave=function(e){if("undefined"==typeof e._dndDropzoneActive){var t=document.elementFromPoint(e.clientX,e.clientY);if(this.elementRef.nativeElement.contains(t))return void(e._dndDropzoneActive=!0)}this.cleanupDragoverState(),c(e,"none")},e.prototype.isDropAllowed=function(e){if(!0===this.disabled)return!1;if(!0===m()&&!1===this.dndAllowExternal)return!1;if(!this.dndDropzone)return!0;if(!e)return!0;if(!1===Array.isArray(this.dndDropzone))throw new Error("dndDropzone: bound value to [dndDropzone] must be an array!");return-1!==this.dndDropzone.indexOf(e)},e.prototype.tryGetPlaceholder=function(){return"undefined"!=typeof this.dndPlaceholderRef?this.dndPlaceholderRef.elementRef.nativeElement:this.elementRef.nativeElement.querySelector("[dndPlaceholderRef]")},e.prototype.removePlaceholderFromDOM=function(){null!==this.placeholder&&null!==this.placeholder.parentNode&&this.placeholder.parentNode.removeChild(this.placeholder)},e.prototype.checkAndUpdatePlaceholderPosition=function(e){if(null!==this.placeholder){this.placeholder.parentNode!==this.elementRef.nativeElement&&this.renderer.appendChild(this.elementRef.nativeElement,this.placeholder);var t=s(this.elementRef.nativeElement,e.target);null!==t&&t!==this.placeholder&&(l(e,t,this.dndHorizontal)?t.previousSibling!==this.placeholder&&this.renderer.insertBefore(this.elementRef.nativeElement,this.placeholder,t):t.nextSibling!==this.placeholder&&this.renderer.insertBefore(this.elementRef.nativeElement,this.placeholder,t.nextSibling))}},e.prototype.getPlaceholderIndex=function(){if(null===this.placeholder)return undefined;var e=this.elementRef.nativeElement;return Array.prototype.indexOf.call(e.children,this.placeholder)},e.prototype.cleanupDragoverState=function(){this.renderer.removeClass(this.elementRef.nativeElement,this.dndDragoverClass),this.removePlaceholderFromDOM()},e}();O.decorators=[{type:t.Directive,args:[{selector:"[dndDropzone]"}]}],O.ctorParameters=function(){return[{type:t.NgZone},{type:t.ElementRef},{type:t.Renderer2}]},O.propDecorators={dndDropzone:[{type:t.Input}],dndEffectAllowed:[{type:t.Input}],dndAllowExternal:[{type:t.Input}],dndHorizontal:[{type:t.Input}],dndDragoverClass:[{type:t.Input}],dndDropzoneDisabledClass:[{type:t.Input}],dndDragover:[{type:t.Output}],dndDrop:[{type:t.Output}],dndPlaceholderRef:[{type:t.ContentChild,args:[A]}],dndDisableIf:[{type:t.Input}],onDrop:[{type:t.HostListener,args:["drop",["$event"]]}]};var P=function(){function e(e){this.draggable=!0,e.registerDragHandle(this)}return e.prototype.onDragEvent=function(e){e._dndUsingHandle=!0},e}();P.decorators=[{type:t.Directive,args:[{selector:"[dndHandle]"}]}],P.ctorParameters=function(){return[{type:w}]},P.propDecorators={draggable:[{type:t.HostBinding,args:["attr.draggable"]}],onDragEvent:[{type:t.HostListener,args:["dragstart",["$event"]]},{type:t.HostListener,args:["dragend",["$event"]]}]};var H=function(){function e(){}return e}();H.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule],declarations:[w,O,P,A,I],exports:[w,O,P,A,I]}]}],H.ctorParameters=function(){return[]},e.DndDragImageRefDirective=I,e.DndDraggableDirective=w,e.DndPlaceholderRefDirective=A,e.DndDropzoneDirective=O,e.DndHandleDirective=P,e.DndModule=H,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ngx-drag-drop.umd.min.js.map |
export declare type DropEffect = "move" | "copy" | "link" | "none"; | ||
export declare type EffectAllowed = DropEffect | "copyMove" | "copyLink" | "linkMove" | "all"; | ||
export declare type EffectAllowed = DropEffect | "copyMove" | "copyLink" | "linkMove" | "all" | "uninitialized"; |
@@ -19,13 +19,15 @@ import { ContentChild, Directive, ElementRef, EventEmitter, HostBinding, HostListener, Input, NgModule, NgZone, Output, Renderer2 } from '@angular/core'; | ||
function getWellKnownMimeType(event) { | ||
var /** @type {?} */ types = event.dataTransfer.types; | ||
// IE 9 workaround. | ||
if (!types) { | ||
return MSIE_MIME_TYPE; | ||
} | ||
for (var /** @type {?} */ i = 0; i < types.length; i++) { | ||
if (types[i] === MSIE_MIME_TYPE | ||
|| types[i] === JSON_MIME_TYPE | ||
|| mimeTypeIsCustom(types[i])) { | ||
return types[i]; | ||
if (event.dataTransfer) { | ||
var /** @type {?} */ types = event.dataTransfer.types; | ||
// IE 9 workaround. | ||
if (!types) { | ||
return MSIE_MIME_TYPE; | ||
} | ||
for (var /** @type {?} */ i = 0; i < types.length; i++) { | ||
if (types[i] === MSIE_MIME_TYPE | ||
|| types[i] === JSON_MIME_TYPE | ||
|| mimeTypeIsCustom(types[i])) { | ||
return types[i]; | ||
} | ||
} | ||
} | ||
@@ -90,3 +92,4 @@ return null; | ||
function filterEffects(effects, allowed) { | ||
if (allowed === "all") { | ||
if (allowed === "all" | ||
|| allowed === "uninitialized") { | ||
return effects; | ||
@@ -200,4 +203,4 @@ } | ||
function getDropEffect(event, effectAllowed) { | ||
var /** @type {?} */ effects = DROP_EFFECTS; | ||
effects = filterEffects(effects, /** @type {?} */ (event.dataTransfer.effectAllowed)); | ||
var /** @type {?} */ dataTransferEffectAllowed = (event.dataTransfer) ? /** @type {?} */ (event.dataTransfer.effectAllowed) : "uninitialized"; | ||
var /** @type {?} */ effects = filterEffects(DROP_EFFECTS, dataTransferEffectAllowed); | ||
if (_dndState.isDragging === true) { | ||
@@ -204,0 +207,0 @@ effects = filterEffects(effects, _dndState.effectAllowed); |
@@ -20,13 +20,15 @@ import { ContentChild, Directive, ElementRef, EventEmitter, HostBinding, HostListener, Input, NgModule, NgZone, Output, Renderer2 } from '@angular/core'; | ||
function getWellKnownMimeType(event) { | ||
const /** @type {?} */ types = event.dataTransfer.types; | ||
// IE 9 workaround. | ||
if (!types) { | ||
return MSIE_MIME_TYPE; | ||
} | ||
for (let /** @type {?} */ i = 0; i < types.length; i++) { | ||
if (types[i] === MSIE_MIME_TYPE | ||
|| types[i] === JSON_MIME_TYPE | ||
|| mimeTypeIsCustom(types[i])) { | ||
return types[i]; | ||
if (event.dataTransfer) { | ||
const /** @type {?} */ types = event.dataTransfer.types; | ||
// IE 9 workaround. | ||
if (!types) { | ||
return MSIE_MIME_TYPE; | ||
} | ||
for (let /** @type {?} */ i = 0; i < types.length; i++) { | ||
if (types[i] === MSIE_MIME_TYPE | ||
|| types[i] === JSON_MIME_TYPE | ||
|| mimeTypeIsCustom(types[i])) { | ||
return types[i]; | ||
} | ||
} | ||
} | ||
@@ -91,3 +93,4 @@ return null; | ||
function filterEffects(effects, allowed) { | ||
if (allowed === "all") { | ||
if (allowed === "all" | ||
|| allowed === "uninitialized") { | ||
return effects; | ||
@@ -202,4 +205,4 @@ } | ||
function getDropEffect(event, effectAllowed) { | ||
let /** @type {?} */ effects = DROP_EFFECTS; | ||
effects = filterEffects(effects, /** @type {?} */ (event.dataTransfer.effectAllowed)); | ||
const /** @type {?} */ dataTransferEffectAllowed = (event.dataTransfer) ? /** @type {?} */ (event.dataTransfer.effectAllowed) : "uninitialized"; | ||
let /** @type {?} */ effects = filterEffects(DROP_EFFECTS, dataTransferEffectAllowed); | ||
if (_dndState.isDragging === true) { | ||
@@ -206,0 +209,0 @@ effects = filterEffects(effects, _dndState.effectAllowed); |
@@ -1,1 +0,1 @@ | ||
{"name":"ngx-drag-drop","version":"2.0.0-rc.3","description":"Angular directives using the native HTML Drag And Drop API","repository":{"type":"git","url":"https://github.com/reppners/ngx-drag-drop.git"},"homepage":"https://reppners.github.io/ngx-drag-drop/","author":{"name":"Stefan Steinhart","email":"stefanreppner@googlemail.com"},"license":"MIT","keywords":["angular","html","drag","drop","dragdrop","dragndrop","dnd","directive","touch"],"main":"bundles/ngx-drag-drop.umd.js","scripts":{"ng":"ng","start":"npm run build:lib && ng serve --disable-host-check --host 0.0.0.0","workaround":"rm -rf node_modules/ngx-drag-drop && cp -R dist node_modules/ngx-drag-drop","build:docs":"ng build --prod","build:lib":"ng-packagr -p ng-package.json && npm run workaround","publish:stable":"npm publish dist","publish:next":"npm publish dist --tag next","test":"ng test","lint":"ng lint","e2e":"ng e2e"},"devDependencies":{"@angular/animations":"^5.2.0","@angular/cdk":"^5.0.4","@angular/cli":"^1.6.4","@angular/common":"^5.2.0","@angular/compiler":"^5.2.0","@angular/compiler-cli":"^5.2.0","@angular/core":"^5.2.0","@angular/flex-layout":"5.0.0-beta.15","@angular/forms":"^5.2.0","@angular/http":"^5.2.0","@angular/material":"^5.0.4","@angular/platform-browser":"^5.2.0","@angular/platform-browser-dynamic":"^5.2.0","@angular/router":"^5.2.0","@types/jasmine":"2.5.38","@types/node":"~6.0.60","codelyzer":"^4.0.2","core-js":"^2.5.3","hammerjs":"^2.0.8","jasmine-core":"~2.5.2","jasmine-spec-reporter":"~3.2.0","karma":"~1.4.1","karma-chrome-launcher":"~2.1.1","karma-cli":"~1.0.1","karma-coverage-istanbul-reporter":"^0.2.0","karma-jasmine":"~1.1.0","karma-jasmine-html-reporter":"^0.2.2","mobile-drag-drop":"^2.1.0","ng-packagr":"^1.6.0","protractor":"~5.1.0","run-sequence":"^1.2.2","rxjs":"^5.5.6","ts-node":"~2.0.0","tslint":"^5.9.1","typescript":"^2.6.2","zone.js":"^0.8.20"},"peerDependencies":{"@angular/core":"^4.0.0 || ^5.0.0 || ^6.0.0"},"engines":{"node":">=8.9.0"},"module":"ngx-drag-drop.es5.js","es2015":"ngx-drag-drop.js","typings":"ngx-drag-drop.d.ts","metadata":"ngx-drag-drop.metadata.json"} | ||
{"name":"ngx-drag-drop","version":"2.0.0-rc.4","description":"Angular directives using the native HTML Drag And Drop API","repository":{"type":"git","url":"https://github.com/reppners/ngx-drag-drop.git"},"homepage":"https://reppners.github.io/ngx-drag-drop/","author":{"name":"Stefan Steinhart","email":"stefanreppner@googlemail.com"},"license":"MIT","keywords":["angular","html","drag","drop","dragdrop","dragndrop","dnd","directive","touch"],"main":"bundles/ngx-drag-drop.umd.js","scripts":{"ng":"ng","start":"npm run build:lib && ng serve --disable-host-check --host 0.0.0.0","workaround":"rm -rf node_modules/ngx-drag-drop && cp -R dist node_modules/ngx-drag-drop","build:docs":"ng build --prod","build:lib":"ng-packagr -p ng-package.json && npm run workaround","publish:stable":"npm publish dist","publish:next":"npm publish dist --tag next","test":"ng test","lint":"ng lint","e2e":"ng e2e"},"devDependencies":{"@angular/animations":"^5.2.0","@angular/cdk":"^5.0.4","@angular/cli":"^1.6.4","@angular/common":"^5.2.0","@angular/compiler":"^5.2.0","@angular/compiler-cli":"^5.2.0","@angular/core":"^5.2.0","@angular/flex-layout":"5.0.0-beta.15","@angular/forms":"^5.2.0","@angular/http":"^5.2.0","@angular/material":"^5.0.4","@angular/platform-browser":"^5.2.0","@angular/platform-browser-dynamic":"^5.2.0","@angular/router":"^5.2.0","@types/jasmine":"2.5.38","@types/node":"~6.0.60","codelyzer":"^4.0.2","core-js":"^2.5.3","hammerjs":"^2.0.8","jasmine-core":"~2.5.2","jasmine-spec-reporter":"~3.2.0","karma":"~1.4.1","karma-chrome-launcher":"~2.1.1","karma-cli":"~1.0.1","karma-coverage-istanbul-reporter":"^0.2.0","karma-jasmine":"~1.1.0","karma-jasmine-html-reporter":"^0.2.2","mobile-drag-drop":"^2.1.0","ng-packagr":"^1.6.0","protractor":"~5.1.0","run-sequence":"^1.2.2","rxjs":"^5.5.6","ts-node":"~2.0.0","tslint":"^5.9.1","typescript":"^2.6.2","zone.js":"^0.8.20"},"peerDependencies":{"@angular/core":"^4.0.0 || ^5.0.0 || ^6.0.0"},"engines":{"node":">=8.9.0"},"module":"ngx-drag-drop.es5.js","es2015":"ngx-drag-drop.js","typings":"ngx-drag-drop.d.ts","metadata":"ngx-drag-drop.metadata.json"} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
340885
2642