Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ng2-dnd

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng2-dnd - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

17

bundles/ng2-dnd.js

@@ -254,2 +254,4 @@ System.registerDynamic("src/dnd.draggable", ["angular2/core", "./dnd.component", "./dnd.config", "./dnd.service"], true, function($__require, exports, module) {

this._sortableDataService = _sortableDataService;
this.onDragSuccessCallback = new core_1.EventEmitter();
this.onDropSuccessCallback = new core_1.EventEmitter();
this.dropZones = this._sortableContainer.dropZones;

@@ -277,2 +279,4 @@ this.dragEnabled = true;

this._sortableDataService.markSortable(this._elem);
this._dragDropService.dragData = this.dragData;
this._dragDropService.onDragSuccessCallback = this.onDragSuccessCallback;
};

@@ -290,2 +294,4 @@ SortableComponent.prototype._onDragOverCallback = function(event) {

this._sortableDataService.markSortable(null);
this._dragDropService.dragData = null;
this._dragDropService.onDragSuccessCallback = null;
};

@@ -302,5 +308,16 @@ SortableComponent.prototype._onDragEnterCallback = function(event) {

};
SortableComponent.prototype._onDropCallback = function(event) {
if (this.onDropSuccessCallback) {
this.onDropSuccessCallback.emit(this._dragDropService.dragData);
}
if (this._dragDropService.onDragSuccessCallback) {
this._dragDropService.onDragSuccessCallback.emit(this._dragDropService.dragData);
}
};
__decorate([core_1.Input('sortableIndex'), __metadata('design:type', Number)], SortableComponent.prototype, "index", void 0);
__decorate([core_1.Input("dragEnabled"), __metadata('design:type', Boolean), __metadata('design:paramtypes', [Boolean])], SortableComponent.prototype, "draggable", null);
__decorate([core_1.Input("dropEnabled"), __metadata('design:type', Boolean), __metadata('design:paramtypes', [Boolean])], SortableComponent.prototype, "droppable", null);
__decorate([core_1.Input(), __metadata('design:type', Object)], SortableComponent.prototype, "dragData", void 0);
__decorate([core_1.Output("onDragSuccess"), __metadata('design:type', core_1.EventEmitter)], SortableComponent.prototype, "onDragSuccessCallback", void 0);
__decorate([core_1.Output("onDropSuccess"), __metadata('design:type', core_1.EventEmitter)], SortableComponent.prototype, "onDropSuccessCallback", void 0);
SortableComponent = __decorate([core_1.Directive({selector: '[dnd-sortable]'}), __metadata('design:paramtypes', [core_1.ElementRef, dnd_service_1.DragDropService, dnd_config_1.DragDropConfig, SortableContainer, dnd_service_1.DragDropSortableService])], SortableComponent);

@@ -307,0 +324,0 @@ return SortableComponent;

2

bundles/ng2-dnd.min.js

@@ -1,2 +0,2 @@

System.registerDynamic("src/dnd.draggable",["angular2/core","./dnd.component","./dnd.config","./dnd.service"],!0,function(e,t,r){var a=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var a in t)t.hasOwnProperty(a)&&(e[a]=t[a]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},n=this&&this.__decorate||function(e,t,r,a){var n,o=arguments.length,i=3>o?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,a);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(i=(3>o?n(i):o>3?n(t,r,i):n(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},i=e("angular2/core"),s=e("./dnd.component"),c=e("./dnd.config"),l=e("./dnd.service"),d=function(e){function t(t,r,a){e.call(this,t,r,a),this.onDragSuccessCallback=new i.EventEmitter,this._defaultCursor=this._elem.style.cursor,this.dragEnabled=!0}return a(t,e),Object.defineProperty(t.prototype,"draggable",{set:function(e){this.dragEnabled=!!e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dropzones",{set:function(e){this.dropZones=e},enumerable:!0,configurable:!0}),t.prototype._onDragStartCallback=function(e){this._dragDropService.dragData=this.dragData,this._dragDropService.onDragSuccessCallback=this.onDragSuccessCallback,this._elem.classList.add(this._config.onDragStartClass)},t.prototype._onDragEndCallback=function(e){this._dragDropService.dragData=null,this._dragDropService.onDragSuccessCallback=null,this._elem.classList.remove(this._config.onDragStartClass)},n([i.Input("dragEnabled"),o("design:type",Boolean),o("design:paramtypes",[Boolean])],t.prototype,"draggable",null),n([i.Input(),o("design:type",Object)],t.prototype,"dragData",void 0),n([i.Output("onDragSuccess"),o("design:type",i.EventEmitter)],t.prototype,"onDragSuccessCallback",void 0),n([i.Input("dropZones"),o("design:type",Array),o("design:paramtypes",[Array])],t.prototype,"dropzones",null),t=n([i.Directive({selector:"[dnd-draggable]"}),o("design:paramtypes",[i.ElementRef,l.DragDropService,c.DragDropConfig])],t)}(s.AbstractComponent);return t.DraggableComponent=d,r.exports}),System.registerDynamic("src/dnd.droppable",["angular2/core","./dnd.component","./dnd.config","./dnd.service"],!0,function(e,t,r){var a=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var a in t)t.hasOwnProperty(a)&&(e[a]=t[a]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},n=this&&this.__decorate||function(e,t,r,a){var n,o=arguments.length,i=3>o?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,a);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(i=(3>o?n(i):o>3?n(t,r,i):n(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},i=e("angular2/core"),s=e("./dnd.component"),c=e("./dnd.config"),l=e("./dnd.service"),d=function(e){function t(t,r,a){e.call(this,t,r,a),this.onDropSuccessCallback=new i.EventEmitter,this.dropEnabled=!0}return a(t,e),Object.defineProperty(t.prototype,"droppable",{set:function(e){this.dropEnabled=!!e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dropzones",{set:function(e){this.dropZones=e},enumerable:!0,configurable:!0}),t.prototype._onDragEnterCallback=function(e){this._elem.classList.add(this._config.onDragEnterClass)},t.prototype._onDragOverCallback=function(e){this._elem.classList.add(this._config.onDragOverClass)},t.prototype._onDragLeaveCallback=function(e){this._elem.classList.remove(this._config.onDragOverClass),this._elem.classList.remove(this._config.onDragEnterClass)},t.prototype._onDropCallback=function(e){this.onDropSuccessCallback&&this.onDropSuccessCallback.emit(this._dragDropService.dragData),this._dragDropService.onDragSuccessCallback&&this._dragDropService.onDragSuccessCallback.emit(this._dragDropService.dragData),this._elem.classList.remove(this._config.onDragOverClass),this._elem.classList.remove(this._config.onDragEnterClass)},n([i.Input("dropEnabled"),o("design:type",Boolean),o("design:paramtypes",[Boolean])],t.prototype,"droppable",null),n([i.Output("onDropSuccess"),o("design:type",i.EventEmitter)],t.prototype,"onDropSuccessCallback",void 0),n([i.Input("dropZones"),o("design:type",Array),o("design:paramtypes",[Array])],t.prototype,"dropzones",null),t=n([i.Directive({selector:"[dnd-droppable]"}),o("design:paramtypes",[i.ElementRef,l.DragDropService,c.DragDropConfig])],t)}(s.AbstractComponent);return t.DroppableComponent=d,r.exports}),System.registerDynamic("src/dnd.sortable",["angular2/core","./dnd.component","./dnd.config","./dnd.service"],!0,function(e,t,r){var a=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var a in t)t.hasOwnProperty(a)&&(e[a]=t[a]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},n=this&&this.__decorate||function(e,t,r,a){var n,o=arguments.length,i=3>o?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,a);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(i=(3>o?n(i):o>3?n(t,r,i):n(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},i=e("angular2/core"),s=e("./dnd.component"),c=e("./dnd.config"),l=e("./dnd.service"),d=function(e){function t(t,r,a,n){e.call(this,t,r,a),this._sortableDataService=n,this._sortableData=[],this.dragEnabled=!1}return a(t,e),Object.defineProperty(t.prototype,"draggable",{set:function(e){this.dragEnabled=!!e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sortableData",{get:function(){return this._sortableData},set:function(e){this._sortableData=e,this.dropEnabled=0===this._sortableData.length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dropzones",{set:function(e){this.dropZones=e},enumerable:!0,configurable:!0}),t.prototype._onDragEnterCallback=function(e){var t=this._sortableDataService.sortableData[this._sortableDataService.index];-1===this._sortableData.indexOf(t)&&(this._sortableDataService.sortableData.splice(this._sortableDataService.index,1),this._sortableData.push(t),this._sortableDataService.sortableData=this._sortableData,this._sortableDataService.index=0)},n([i.Input("dragEnabled"),o("design:type",Boolean),o("design:paramtypes",[Boolean])],t.prototype,"draggable",null),n([i.Input(),o("design:type",Array),o("design:paramtypes",[Array])],t.prototype,"sortableData",null),n([i.Input("dropZones"),o("design:type",Array),o("design:paramtypes",[Array])],t.prototype,"dropzones",null),t=n([i.Directive({selector:"[dnd-sortable-container]"}),o("design:paramtypes",[i.ElementRef,l.DragDropService,c.DragDropConfig,l.DragDropSortableService])],t)}(s.AbstractComponent);t.SortableContainer=d;var p=function(e){function t(t,r,a,n,o){e.call(this,t,r,a),this._sortableContainer=n,this._sortableDataService=o,this.dropZones=this._sortableContainer.dropZones,this.dragEnabled=!0,this.dropEnabled=!0}return a(t,e),Object.defineProperty(t.prototype,"draggable",{set:function(e){this.dragEnabled=!!e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"droppable",{set:function(e){this.dropEnabled=!!e},enumerable:!0,configurable:!0}),t.prototype._onDragStartCallback=function(e){this._sortableDataService.sortableData=this._sortableContainer.sortableData,this._sortableDataService.index=this.index,this._sortableDataService.markSortable(this._elem)},t.prototype._onDragOverCallback=function(e){this._elem!=this._sortableDataService.elem&&(this._sortableDataService.sortableData=this._sortableContainer.sortableData,this._sortableDataService.index=this.index,this._sortableDataService.markSortable(this._elem))},t.prototype._onDragEndCallback=function(e){this._sortableDataService.sortableData=null,this._sortableDataService.index=null,this._sortableDataService.markSortable(null)},t.prototype._onDragEnterCallback=function(e){if(this._sortableDataService.markSortable(this._elem),this.index!==this._sortableDataService.index||this._sortableDataService.sortableData!=this._sortableContainer.sortableData){var t=this._sortableDataService.sortableData[this._sortableDataService.index];this._sortableDataService.sortableData.splice(this._sortableDataService.index,1),this._sortableContainer.sortableData.splice(this.index,0,t),this._sortableDataService.sortableData=this._sortableContainer.sortableData,this._sortableDataService.index=this.index}},n([i.Input("sortableIndex"),o("design:type",Number)],t.prototype,"index",void 0),n([i.Input("dragEnabled"),o("design:type",Boolean),o("design:paramtypes",[Boolean])],t.prototype,"draggable",null),n([i.Input("dropEnabled"),o("design:type",Boolean),o("design:paramtypes",[Boolean])],t.prototype,"droppable",null),t=n([i.Directive({selector:"[dnd-sortable]"}),o("design:paramtypes",[i.ElementRef,l.DragDropService,c.DragDropConfig,d,l.DragDropSortableService])],t)}(s.AbstractComponent);return t.SortableComponent=p,r.exports}),System.registerDynamic("src/dnd.config",["angular2/core"],!0,function(e,t,r){var a=this&&this.__decorate||function(e,t,r,a){var n,o=arguments.length,i=3>o?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,a);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(i=(3>o?n(i):o>3?n(t,r,i):n(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},o=e("angular2/core"),i=function(){function e(e){this.name=e}return e.COPY=new e("copy"),e.LINK=new e("link"),e.MOVE=new e("move"),e.NONE=new e("none"),e=a([o.Injectable(),n("design:paramtypes",[String])],e)}();t.DataTransferEffect=i;var s=function(){function e(e,t,r){void 0===t&&(t=0),void 0===r&&(r=0),this.imageElement=e,this.x_offset=t,this.y_offset=r}return e=a([o.Injectable(),n("design:paramtypes",[HTMLElement,Number,Number])],e)}();t.DragImage=s;var c=function(){function e(){this.onDragStartClass="dnd-drag-start",this.onDragEnterClass="dnd-drag-enter",this.onDragOverClass="dnd-drag-over",this.onSortableDragClass="dnd-sortable-drag",this.dragEffect=i.MOVE,this.dropEffect=i.MOVE,this.dragCursor="move"}return e=a([o.Injectable(),n("design:paramtypes",[])],e)}();return t.DragDropConfig=c,r.exports}),System.registerDynamic("src/dnd.service",["angular2/core","angular2/src/facade/lang","./dnd.config"],!0,function(e,t,r){var a=this&&this.__decorate||function(e,t,r,a){var n,o=arguments.length,i=3>o?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,a);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(i=(3>o?n(i):o>3?n(t,r,i):n(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},o=e("angular2/core"),i=e("angular2/src/facade/lang"),s=e("./dnd.config"),c=function(){function e(){this.allowedDropZones=[]}return e=a([o.Injectable(),n("design:paramtypes",[])],e)}();t.DragDropService=c;var l=function(){function e(e){this._config=e}return Object.defineProperty(e.prototype,"elem",{get:function(){return this._elem},enumerable:!0,configurable:!0}),e.prototype.markSortable=function(e){i.isPresent(this._elem)&&this._elem.classList.remove(this._config.onSortableDragClass),i.isPresent(e)&&(this._elem=e,this._elem.classList.add(this._config.onSortableDragClass))},e=a([o.Injectable(),n("design:paramtypes",[s.DragDropConfig])],e)}();return t.DragDropSortableService=l,r.exports}),System.registerDynamic("src/dnd.component",["angular2/core","./dnd.config","./dnd.service"],!0,function(e,t,r){var a=this&&this.__decorate||function(e,t,r,a){var n,o=arguments.length,i=3>o?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,a);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(i=(3>o?n(i):o>3?n(t,r,i):n(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},o=e("angular2/core"),i=e("angular2/core"),s=e("./dnd.config"),c=e("./dnd.service"),l=function(){function e(e,t,r){var a=this;this._dragDropService=t,this._config=r,this._dragEnabled=!1,this.dropEnabled=!1,this.dropZones=[],this._elem=e.nativeElement,this.dragEnabled=!0,this._elem.ondragenter=function(e){a._onDragEnter(e)},this._elem.ondragover=function(e){a._onDragOver(e),null!=e.dataTransfer&&(e.dataTransfer.dropEffect=a._config.dropEffect.name)},this._elem.ondragleave=function(e){a._onDragLeave(e)},this._elem.ondrop=function(e){a._onDrop(e)},this._elem.ondragstart=function(e){if(a._onDragStart(e),null!=e.dataTransfer&&(e.dataTransfer.effectAllowed=a._config.dragEffect.name,e.dataTransfer.setData("text/html",""),null!=a._config.dragImage)){var t=a._config.dragImage;e.dataTransfer.setDragImage(t.imageElement,t.x_offset,t.y_offset)}},this._elem.ondragend=function(e){a._onDragEnd(e)},this._elem.ontouchstart=function(e){a._onDragStart(e)},this._elem.ontouchend=function(e){a._onDragEnd(e)}}return Object.defineProperty(e.prototype,"dragEnabled",{get:function(){return this._dragEnabled},set:function(e){this._dragEnabled=!!e,this._elem.draggable=this._dragEnabled,null!=this._config.dragCursor&&(this._elem.style.cursor=this._dragEnabled?this._config.dragCursor:this._defaultCursor)},enumerable:!0,configurable:!0}),e.prototype._onDragEnter=function(e){this._isDropAllowed&&(e.preventDefault(),this._onDragEnterCallback(e))},e.prototype._onDragOver=function(e){this._isDropAllowed&&(e.preventDefault(),this._onDragOverCallback(e))},e.prototype._onDragLeave=function(e){this._isDropAllowed&&(e.preventDefault(),this._onDragLeaveCallback(e))},e.prototype._onDrop=function(e){this._isDropAllowed&&(e.preventDefault(),this._onDropCallback(e))},Object.defineProperty(e.prototype,"_isDropAllowed",{get:function(){if(this.dropEnabled){if(0===this.dropZones.length&&0===this._dragDropService.allowedDropZones.length)return!0;for(var e=0;e<this._dragDropService.allowedDropZones.length;e++){var t=this._dragDropService.allowedDropZones[e];if(-1!==this.dropZones.indexOf(t))return!0}}return!1},enumerable:!0,configurable:!0}),e.prototype._onDragStart=function(e){this._dragEnabled&&(this._dragDropService.allowedDropZones=this.dropZones,this._onDragStartCallback(e))},e.prototype._onDragEnd=function(e){this._dragDropService.allowedDropZones=[],this._onDragEndCallback(e)},e.prototype._onDragEnterCallback=function(e){},e.prototype._onDragOverCallback=function(e){},e.prototype._onDragLeaveCallback=function(e){},e.prototype._onDropCallback=function(e){},e.prototype._onDragStartCallback=function(e){},e.prototype._onDragEndCallback=function(e){},e=a([o.Injectable(),n("design:paramtypes",[i.ElementRef,c.DragDropService,s.DragDropConfig])],e)}();return t.AbstractComponent=l,r.exports}),System.registerDynamic("ng2-dnd",["./src/dnd.config","./src/dnd.service","./src/dnd.draggable","./src/dnd.droppable","./src/dnd.sortable","./src/dnd.component"],!0,function(e,t,r){"use strict";function a(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}var n=e("./src/dnd.config"),o=e("./src/dnd.service"),i=e("./src/dnd.draggable"),s=e("./src/dnd.droppable"),c=e("./src/dnd.sortable");return a(e("./src/dnd.component")),a(e("./src/dnd.config")),a(e("./src/dnd.service")),a(e("./src/dnd.draggable")),a(e("./src/dnd.droppable")),a(e("./src/dnd.sortable")),t.DND_PROVIDERS=[n.DragDropConfig,o.DragDropService,o.DragDropSortableService],t.DND_DIRECTIVES=[i.DraggableComponent,s.DroppableComponent,c.SortableContainer,c.SortableComponent],r.exports});
System.registerDynamic("src/dnd.draggable",["angular2/core","./dnd.component","./dnd.config","./dnd.service"],!0,function(e,t,r){var a=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var a in t)t.hasOwnProperty(a)&&(e[a]=t[a]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},o=this&&this.__decorate||function(e,t,r,a){var o,n=arguments.length,i=3>n?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,a);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(3>n?o(i):n>3?o(t,r,i):o(t,r))||i);return n>3&&i&&Object.defineProperty(t,r,i),i},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},i=e("angular2/core"),s=e("./dnd.component"),c=e("./dnd.config"),l=e("./dnd.service"),d=function(e){function t(t,r,a){e.call(this,t,r,a),this.onDragSuccessCallback=new i.EventEmitter,this._defaultCursor=this._elem.style.cursor,this.dragEnabled=!0}return a(t,e),Object.defineProperty(t.prototype,"draggable",{set:function(e){this.dragEnabled=!!e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dropzones",{set:function(e){this.dropZones=e},enumerable:!0,configurable:!0}),t.prototype._onDragStartCallback=function(e){this._dragDropService.dragData=this.dragData,this._dragDropService.onDragSuccessCallback=this.onDragSuccessCallback,this._elem.classList.add(this._config.onDragStartClass)},t.prototype._onDragEndCallback=function(e){this._dragDropService.dragData=null,this._dragDropService.onDragSuccessCallback=null,this._elem.classList.remove(this._config.onDragStartClass)},o([i.Input("dragEnabled"),n("design:type",Boolean),n("design:paramtypes",[Boolean])],t.prototype,"draggable",null),o([i.Input(),n("design:type",Object)],t.prototype,"dragData",void 0),o([i.Output("onDragSuccess"),n("design:type",i.EventEmitter)],t.prototype,"onDragSuccessCallback",void 0),o([i.Input("dropZones"),n("design:type",Array),n("design:paramtypes",[Array])],t.prototype,"dropzones",null),t=o([i.Directive({selector:"[dnd-draggable]"}),n("design:paramtypes",[i.ElementRef,l.DragDropService,c.DragDropConfig])],t)}(s.AbstractComponent);return t.DraggableComponent=d,r.exports}),System.registerDynamic("src/dnd.droppable",["angular2/core","./dnd.component","./dnd.config","./dnd.service"],!0,function(e,t,r){var a=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var a in t)t.hasOwnProperty(a)&&(e[a]=t[a]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},o=this&&this.__decorate||function(e,t,r,a){var o,n=arguments.length,i=3>n?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,a);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(3>n?o(i):n>3?o(t,r,i):o(t,r))||i);return n>3&&i&&Object.defineProperty(t,r,i),i},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},i=e("angular2/core"),s=e("./dnd.component"),c=e("./dnd.config"),l=e("./dnd.service"),d=function(e){function t(t,r,a){e.call(this,t,r,a),this.onDropSuccessCallback=new i.EventEmitter,this.dropEnabled=!0}return a(t,e),Object.defineProperty(t.prototype,"droppable",{set:function(e){this.dropEnabled=!!e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dropzones",{set:function(e){this.dropZones=e},enumerable:!0,configurable:!0}),t.prototype._onDragEnterCallback=function(e){this._elem.classList.add(this._config.onDragEnterClass)},t.prototype._onDragOverCallback=function(e){this._elem.classList.add(this._config.onDragOverClass)},t.prototype._onDragLeaveCallback=function(e){this._elem.classList.remove(this._config.onDragOverClass),this._elem.classList.remove(this._config.onDragEnterClass)},t.prototype._onDropCallback=function(e){this.onDropSuccessCallback&&this.onDropSuccessCallback.emit(this._dragDropService.dragData),this._dragDropService.onDragSuccessCallback&&this._dragDropService.onDragSuccessCallback.emit(this._dragDropService.dragData),this._elem.classList.remove(this._config.onDragOverClass),this._elem.classList.remove(this._config.onDragEnterClass)},o([i.Input("dropEnabled"),n("design:type",Boolean),n("design:paramtypes",[Boolean])],t.prototype,"droppable",null),o([i.Output("onDropSuccess"),n("design:type",i.EventEmitter)],t.prototype,"onDropSuccessCallback",void 0),o([i.Input("dropZones"),n("design:type",Array),n("design:paramtypes",[Array])],t.prototype,"dropzones",null),t=o([i.Directive({selector:"[dnd-droppable]"}),n("design:paramtypes",[i.ElementRef,l.DragDropService,c.DragDropConfig])],t)}(s.AbstractComponent);return t.DroppableComponent=d,r.exports}),System.registerDynamic("src/dnd.sortable",["angular2/core","./dnd.component","./dnd.config","./dnd.service"],!0,function(e,t,r){var a=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var a in t)t.hasOwnProperty(a)&&(e[a]=t[a]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},o=this&&this.__decorate||function(e,t,r,a){var o,n=arguments.length,i=3>n?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,a);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(3>n?o(i):n>3?o(t,r,i):o(t,r))||i);return n>3&&i&&Object.defineProperty(t,r,i),i},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},i=e("angular2/core"),s=e("./dnd.component"),c=e("./dnd.config"),l=e("./dnd.service"),d=function(e){function t(t,r,a,o){e.call(this,t,r,a),this._sortableDataService=o,this._sortableData=[],this.dragEnabled=!1}return a(t,e),Object.defineProperty(t.prototype,"draggable",{set:function(e){this.dragEnabled=!!e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sortableData",{get:function(){return this._sortableData},set:function(e){this._sortableData=e,this.dropEnabled=0===this._sortableData.length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dropzones",{set:function(e){this.dropZones=e},enumerable:!0,configurable:!0}),t.prototype._onDragEnterCallback=function(e){var t=this._sortableDataService.sortableData[this._sortableDataService.index];-1===this._sortableData.indexOf(t)&&(this._sortableDataService.sortableData.splice(this._sortableDataService.index,1),this._sortableData.push(t),this._sortableDataService.sortableData=this._sortableData,this._sortableDataService.index=0)},o([i.Input("dragEnabled"),n("design:type",Boolean),n("design:paramtypes",[Boolean])],t.prototype,"draggable",null),o([i.Input(),n("design:type",Array),n("design:paramtypes",[Array])],t.prototype,"sortableData",null),o([i.Input("dropZones"),n("design:type",Array),n("design:paramtypes",[Array])],t.prototype,"dropzones",null),t=o([i.Directive({selector:"[dnd-sortable-container]"}),n("design:paramtypes",[i.ElementRef,l.DragDropService,c.DragDropConfig,l.DragDropSortableService])],t)}(s.AbstractComponent);t.SortableContainer=d;var p=function(e){function t(t,r,a,o,n){e.call(this,t,r,a),this._sortableContainer=o,this._sortableDataService=n,this.onDragSuccessCallback=new i.EventEmitter,this.onDropSuccessCallback=new i.EventEmitter,this.dropZones=this._sortableContainer.dropZones,this.dragEnabled=!0,this.dropEnabled=!0}return a(t,e),Object.defineProperty(t.prototype,"draggable",{set:function(e){this.dragEnabled=!!e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"droppable",{set:function(e){this.dropEnabled=!!e},enumerable:!0,configurable:!0}),t.prototype._onDragStartCallback=function(e){this._sortableDataService.sortableData=this._sortableContainer.sortableData,this._sortableDataService.index=this.index,this._sortableDataService.markSortable(this._elem),this._dragDropService.dragData=this.dragData,this._dragDropService.onDragSuccessCallback=this.onDragSuccessCallback},t.prototype._onDragOverCallback=function(e){this._elem!=this._sortableDataService.elem&&(this._sortableDataService.sortableData=this._sortableContainer.sortableData,this._sortableDataService.index=this.index,this._sortableDataService.markSortable(this._elem))},t.prototype._onDragEndCallback=function(e){this._sortableDataService.sortableData=null,this._sortableDataService.index=null,this._sortableDataService.markSortable(null),this._dragDropService.dragData=null,this._dragDropService.onDragSuccessCallback=null},t.prototype._onDragEnterCallback=function(e){if(this._sortableDataService.markSortable(this._elem),this.index!==this._sortableDataService.index||this._sortableDataService.sortableData!=this._sortableContainer.sortableData){var t=this._sortableDataService.sortableData[this._sortableDataService.index];this._sortableDataService.sortableData.splice(this._sortableDataService.index,1),this._sortableContainer.sortableData.splice(this.index,0,t),this._sortableDataService.sortableData=this._sortableContainer.sortableData,this._sortableDataService.index=this.index}},t.prototype._onDropCallback=function(e){this.onDropSuccessCallback&&this.onDropSuccessCallback.emit(this._dragDropService.dragData),this._dragDropService.onDragSuccessCallback&&this._dragDropService.onDragSuccessCallback.emit(this._dragDropService.dragData)},o([i.Input("sortableIndex"),n("design:type",Number)],t.prototype,"index",void 0),o([i.Input("dragEnabled"),n("design:type",Boolean),n("design:paramtypes",[Boolean])],t.prototype,"draggable",null),o([i.Input("dropEnabled"),n("design:type",Boolean),n("design:paramtypes",[Boolean])],t.prototype,"droppable",null),o([i.Input(),n("design:type",Object)],t.prototype,"dragData",void 0),o([i.Output("onDragSuccess"),n("design:type",i.EventEmitter)],t.prototype,"onDragSuccessCallback",void 0),o([i.Output("onDropSuccess"),n("design:type",i.EventEmitter)],t.prototype,"onDropSuccessCallback",void 0),t=o([i.Directive({selector:"[dnd-sortable]"}),n("design:paramtypes",[i.ElementRef,l.DragDropService,c.DragDropConfig,d,l.DragDropSortableService])],t)}(s.AbstractComponent);return t.SortableComponent=p,r.exports}),System.registerDynamic("src/dnd.config",["angular2/core"],!0,function(e,t,r){var a=this&&this.__decorate||function(e,t,r,a){var o,n=arguments.length,i=3>n?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,a);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(3>n?o(i):n>3?o(t,r,i):o(t,r))||i);return n>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},n=e("angular2/core"),i=function(){function e(e){this.name=e}return e.COPY=new e("copy"),e.LINK=new e("link"),e.MOVE=new e("move"),e.NONE=new e("none"),e=a([n.Injectable(),o("design:paramtypes",[String])],e)}();t.DataTransferEffect=i;var s=function(){function e(e,t,r){void 0===t&&(t=0),void 0===r&&(r=0),this.imageElement=e,this.x_offset=t,this.y_offset=r}return e=a([n.Injectable(),o("design:paramtypes",[HTMLElement,Number,Number])],e)}();t.DragImage=s;var c=function(){function e(){this.onDragStartClass="dnd-drag-start",this.onDragEnterClass="dnd-drag-enter",this.onDragOverClass="dnd-drag-over",this.onSortableDragClass="dnd-sortable-drag",this.dragEffect=i.MOVE,this.dropEffect=i.MOVE,this.dragCursor="move"}return e=a([n.Injectable(),o("design:paramtypes",[])],e)}();return t.DragDropConfig=c,r.exports}),System.registerDynamic("src/dnd.service",["angular2/core","angular2/src/facade/lang","./dnd.config"],!0,function(e,t,r){var a=this&&this.__decorate||function(e,t,r,a){var o,n=arguments.length,i=3>n?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,a);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(3>n?o(i):n>3?o(t,r,i):o(t,r))||i);return n>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},n=e("angular2/core"),i=e("angular2/src/facade/lang"),s=e("./dnd.config"),c=function(){function e(){this.allowedDropZones=[]}return e=a([n.Injectable(),o("design:paramtypes",[])],e)}();t.DragDropService=c;var l=function(){function e(e){this._config=e}return Object.defineProperty(e.prototype,"elem",{get:function(){return this._elem},enumerable:!0,configurable:!0}),e.prototype.markSortable=function(e){i.isPresent(this._elem)&&this._elem.classList.remove(this._config.onSortableDragClass),i.isPresent(e)&&(this._elem=e,this._elem.classList.add(this._config.onSortableDragClass))},e=a([n.Injectable(),o("design:paramtypes",[s.DragDropConfig])],e)}();return t.DragDropSortableService=l,r.exports}),System.registerDynamic("src/dnd.component",["angular2/core","./dnd.config","./dnd.service"],!0,function(e,t,r){var a=this&&this.__decorate||function(e,t,r,a){var o,n=arguments.length,i=3>n?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,a);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(3>n?o(i):n>3?o(t,r,i):o(t,r))||i);return n>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},n=e("angular2/core"),i=e("angular2/core"),s=e("./dnd.config"),c=e("./dnd.service"),l=function(){function e(e,t,r){var a=this;this._dragDropService=t,this._config=r,this._dragEnabled=!1,this.dropEnabled=!1,this.dropZones=[],this._elem=e.nativeElement,this.dragEnabled=!0,this._elem.ondragenter=function(e){a._onDragEnter(e)},this._elem.ondragover=function(e){a._onDragOver(e),null!=e.dataTransfer&&(e.dataTransfer.dropEffect=a._config.dropEffect.name)},this._elem.ondragleave=function(e){a._onDragLeave(e)},this._elem.ondrop=function(e){a._onDrop(e)},this._elem.ondragstart=function(e){if(a._onDragStart(e),null!=e.dataTransfer&&(e.dataTransfer.effectAllowed=a._config.dragEffect.name,e.dataTransfer.setData("text/html",""),null!=a._config.dragImage)){var t=a._config.dragImage;e.dataTransfer.setDragImage(t.imageElement,t.x_offset,t.y_offset)}},this._elem.ondragend=function(e){a._onDragEnd(e)},this._elem.ontouchstart=function(e){a._onDragStart(e)},this._elem.ontouchend=function(e){a._onDragEnd(e)}}return Object.defineProperty(e.prototype,"dragEnabled",{get:function(){return this._dragEnabled},set:function(e){this._dragEnabled=!!e,this._elem.draggable=this._dragEnabled,null!=this._config.dragCursor&&(this._elem.style.cursor=this._dragEnabled?this._config.dragCursor:this._defaultCursor)},enumerable:!0,configurable:!0}),e.prototype._onDragEnter=function(e){this._isDropAllowed&&(e.preventDefault(),this._onDragEnterCallback(e))},e.prototype._onDragOver=function(e){this._isDropAllowed&&(e.preventDefault(),this._onDragOverCallback(e))},e.prototype._onDragLeave=function(e){this._isDropAllowed&&(e.preventDefault(),this._onDragLeaveCallback(e))},e.prototype._onDrop=function(e){this._isDropAllowed&&(e.preventDefault(),this._onDropCallback(e))},Object.defineProperty(e.prototype,"_isDropAllowed",{get:function(){if(this.dropEnabled){if(0===this.dropZones.length&&0===this._dragDropService.allowedDropZones.length)return!0;for(var e=0;e<this._dragDropService.allowedDropZones.length;e++){var t=this._dragDropService.allowedDropZones[e];if(-1!==this.dropZones.indexOf(t))return!0}}return!1},enumerable:!0,configurable:!0}),e.prototype._onDragStart=function(e){this._dragEnabled&&(this._dragDropService.allowedDropZones=this.dropZones,this._onDragStartCallback(e))},e.prototype._onDragEnd=function(e){this._dragDropService.allowedDropZones=[],this._onDragEndCallback(e)},e.prototype._onDragEnterCallback=function(e){},e.prototype._onDragOverCallback=function(e){},e.prototype._onDragLeaveCallback=function(e){},e.prototype._onDropCallback=function(e){},e.prototype._onDragStartCallback=function(e){},e.prototype._onDragEndCallback=function(e){},e=a([n.Injectable(),o("design:paramtypes",[i.ElementRef,c.DragDropService,s.DragDropConfig])],e)}();return t.AbstractComponent=l,r.exports}),System.registerDynamic("ng2-dnd",["./src/dnd.config","./src/dnd.service","./src/dnd.draggable","./src/dnd.droppable","./src/dnd.sortable","./src/dnd.component"],!0,function(e,t,r){"use strict";function a(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}var o=e("./src/dnd.config"),n=e("./src/dnd.service"),i=e("./src/dnd.draggable"),s=e("./src/dnd.droppable"),c=e("./src/dnd.sortable");return a(e("./src/dnd.component")),a(e("./src/dnd.config")),a(e("./src/dnd.service")),a(e("./src/dnd.draggable")),a(e("./src/dnd.droppable")),a(e("./src/dnd.sortable")),t.DND_PROVIDERS=[o.DragDropConfig,n.DragDropService,n.DragDropSortableService],t.DND_DIRECTIVES=[i.DraggableComponent,s.DroppableComponent,c.SortableContainer,c.SortableComponent],r.exports});
//# sourceMappingURL=bundles/ng2-dnd.min.js.map

@@ -66,3 +66,3 @@ {

"dependencies": {},
"version": "1.1.1"
"version": "1.1.2"
}

@@ -1,2 +0,2 @@

import { ElementRef } from 'angular2/core';
import { EventEmitter, ElementRef } from 'angular2/core';
import { AbstractComponent } from './dnd.component';

@@ -20,2 +20,16 @@ import { DragDropConfig } from './dnd.config';

droppable: boolean;
/**
* The data that has to be dragged. It can be any JS object
*/
dragData: any;
/**
* Callback function called when the drag action ends with a valid drop action.
* It is activated after the on-drop-success callback
*/
onDragSuccessCallback: EventEmitter<any>;
/**
* Callback function called when the drop action completes correctly.
* It is activated before the on-drag-success callback.
*/
onDropSuccessCallback: EventEmitter<any>;
constructor(elemRef: ElementRef, _dragDropService: DragDropService, _config: DragDropConfig, _sortableContainer: SortableContainer, _sortableDataService: DragDropSortableService);

@@ -26,2 +40,3 @@ _onDragStartCallback(event: Event): void;

_onDragEnterCallback(event: Event): void;
_onDropCallback(event: Event): void;
}

@@ -99,2 +99,12 @@ // Copyright (C) 2016 Sergey Akopkokhyants

this._sortableDataService = _sortableDataService;
/**
* Callback function called when the drag action ends with a valid drop action.
* It is activated after the on-drop-success callback
*/
this.onDragSuccessCallback = new core_1.EventEmitter();
/**
* Callback function called when the drop action completes correctly.
* It is activated before the on-drag-success callback.
*/
this.onDropSuccessCallback = new core_1.EventEmitter();
this.dropZones = this._sortableContainer.dropZones;

@@ -123,2 +133,5 @@ this.dragEnabled = true;

this._sortableDataService.markSortable(this._elem);
// Add dragData
this._dragDropService.dragData = this.dragData;
this._dragDropService.onDragSuccessCallback = this.onDragSuccessCallback;
};

@@ -138,2 +151,5 @@ SortableComponent.prototype._onDragOverCallback = function (event) {

this._sortableDataService.markSortable(null);
// Add dragGata
this._dragDropService.dragData = null;
this._dragDropService.onDragSuccessCallback = null;
};

@@ -155,2 +171,12 @@ SortableComponent.prototype._onDragEnterCallback = function (event) {

};
SortableComponent.prototype._onDropCallback = function (event) {
if (this.onDropSuccessCallback) {
// console.log('onDropCallback.onDropSuccessCallback.dragData', this._dragDropService.dragData);
this.onDropSuccessCallback.emit(this._dragDropService.dragData);
}
if (this._dragDropService.onDragSuccessCallback) {
// console.log('onDropCallback.onDragSuccessCallback.dragData', this._dragDropService.dragData);
this._dragDropService.onDragSuccessCallback.emit(this._dragDropService.dragData);
}
};
__decorate([

@@ -170,2 +196,14 @@ core_1.Input('sortableIndex'),

], SortableComponent.prototype, "droppable", null);
__decorate([
core_1.Input(),
__metadata('design:type', Object)
], SortableComponent.prototype, "dragData", void 0);
__decorate([
core_1.Output("onDragSuccess"),
__metadata('design:type', core_1.EventEmitter)
], SortableComponent.prototype, "onDragSuccessCallback", void 0);
__decorate([
core_1.Output("onDropSuccess"),
__metadata('design:type', core_1.EventEmitter)
], SortableComponent.prototype, "onDropSuccessCallback", void 0);
SortableComponent = __decorate([

@@ -172,0 +210,0 @@ core_1.Directive({ selector: '[dnd-sortable]' }),

@@ -70,2 +70,19 @@ // Copyright (C) 2016 Sergey Akopkokhyants

}
/**
* The data that has to be dragged. It can be any JS object
*/
@Input() dragData: any;
/**
* Callback function called when the drag action ends with a valid drop action.
* It is activated after the on-drop-success callback
*/
@Output("onDragSuccess") onDragSuccessCallback: EventEmitter<any> = new EventEmitter<any>();
/**
* Callback function called when the drop action completes correctly.
* It is activated before the on-drag-success callback.
*/
@Output("onDropSuccess") onDropSuccessCallback: EventEmitter<any> = new EventEmitter<any>();

@@ -85,2 +102,5 @@ constructor(elemRef: ElementRef, _dragDropService: DragDropService, _config:DragDropConfig, private _sortableContainer: SortableContainer, private _sortableDataService: DragDropSortableService) {

this._sortableDataService.markSortable(this._elem);
// Add dragData
this._dragDropService.dragData = this.dragData;
this._dragDropService.onDragSuccessCallback = this.onDragSuccessCallback;
}

@@ -102,2 +122,5 @@

this._sortableDataService.markSortable(null);
// Add dragGata
this._dragDropService.dragData = null;
this._dragDropService.onDragSuccessCallback = null;
}

@@ -120,2 +143,13 @@

}
_onDropCallback (event: Event) {
if (this.onDropSuccessCallback) {
// console.log('onDropCallback.onDropSuccessCallback.dragData', this._dragDropService.dragData);
this.onDropSuccessCallback.emit(this._dragDropService.dragData);
}
if (this._dragDropService.onDragSuccessCallback) {
// console.log('onDropCallback.onDragSuccessCallback.dragData', this._dragDropService.dragData);
this._dragDropService.onDragSuccessCallback.emit(this._dragDropService.dragData);
}
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc