Comparing version 1.6.3 to 1.6.4
System.registerDynamic("src/dnd.draggable", ["@angular/core", "./dnd.component", "./dnd.config", "./dnd.service"], true, function($__require, exports, module) { | ||
"use strict"; | ||
; | ||
@@ -84,3 +85,3 @@ var define, | ||
return DraggableComponent; | ||
})(dnd_component_1.AbstractComponent); | ||
}(dnd_component_1.AbstractComponent)); | ||
exports.DraggableComponent = DraggableComponent; | ||
@@ -91,2 +92,3 @@ return module.exports; | ||
System.registerDynamic("src/dnd.droppable", ["@angular/core", "./dnd.component", "./dnd.config", "./dnd.service"], true, function($__require, exports, module) { | ||
"use strict"; | ||
; | ||
@@ -158,38 +160,46 @@ var define, | ||
DroppableComponent.prototype._onDragEnterCallback = function(event) { | ||
this._elem.classList.add(this._config.onDragEnterClass); | ||
this.onDragEnter.emit({ | ||
dragData: this._dragDropService.dragData, | ||
mouseEvent: event | ||
}); | ||
if (this._dragDropService.isDragged) { | ||
this._elem.classList.add(this._config.onDragEnterClass); | ||
this.onDragEnter.emit({ | ||
dragData: this._dragDropService.dragData, | ||
mouseEvent: event | ||
}); | ||
} | ||
}; | ||
DroppableComponent.prototype._onDragOverCallback = function(event) { | ||
this._elem.classList.add(this._config.onDragOverClass); | ||
this.onDragOver.emit({ | ||
dragData: this._dragDropService.dragData, | ||
mouseEvent: event | ||
}); | ||
if (this._dragDropService.isDragged) { | ||
this._elem.classList.add(this._config.onDragOverClass); | ||
this.onDragOver.emit({ | ||
dragData: this._dragDropService.dragData, | ||
mouseEvent: event | ||
}); | ||
} | ||
}; | ||
; | ||
DroppableComponent.prototype._onDragLeaveCallback = function(event) { | ||
this._elem.classList.remove(this._config.onDragOverClass); | ||
this._elem.classList.remove(this._config.onDragEnterClass); | ||
this.onDragLeave.emit({ | ||
dragData: this._dragDropService.dragData, | ||
mouseEvent: event | ||
}); | ||
if (this._dragDropService.isDragged) { | ||
this._elem.classList.remove(this._config.onDragOverClass); | ||
this._elem.classList.remove(this._config.onDragEnterClass); | ||
this.onDragLeave.emit({ | ||
dragData: this._dragDropService.dragData, | ||
mouseEvent: event | ||
}); | ||
} | ||
}; | ||
; | ||
DroppableComponent.prototype._onDropCallback = function(event) { | ||
this.onDropSuccess.emit({ | ||
dragData: this._dragDropService.dragData, | ||
mouseEvent: event | ||
}); | ||
if (this._dragDropService.onDragSuccessCallback) { | ||
this._dragDropService.onDragSuccessCallback.emit({ | ||
if (this._dragDropService.isDragged) { | ||
this.onDropSuccess.emit({ | ||
dragData: this._dragDropService.dragData, | ||
mouseEvent: event | ||
}); | ||
if (this._dragDropService.onDragSuccessCallback) { | ||
this._dragDropService.onDragSuccessCallback.emit({ | ||
dragData: this._dragDropService.dragData, | ||
mouseEvent: event | ||
}); | ||
} | ||
this._elem.classList.remove(this._config.onDragOverClass); | ||
this._elem.classList.remove(this._config.onDragEnterClass); | ||
} | ||
this._elem.classList.remove(this._config.onDragOverClass); | ||
this._elem.classList.remove(this._config.onDragEnterClass); | ||
}; | ||
@@ -205,3 +215,3 @@ __decorate([core_2.Input("dropEnabled"), __metadata('design:type', Boolean), __metadata('design:paramtypes', [Boolean])], DroppableComponent.prototype, "droppable", null); | ||
return DroppableComponent; | ||
})(dnd_component_1.AbstractComponent); | ||
}(dnd_component_1.AbstractComponent)); | ||
exports.DroppableComponent = DroppableComponent; | ||
@@ -212,2 +222,3 @@ return module.exports; | ||
System.registerDynamic("src/dnd.sortable", ["@angular/core", "./dnd.component", "./dnd.config", "./dnd.service"], true, function($__require, exports, module) { | ||
"use strict"; | ||
; | ||
@@ -281,10 +292,12 @@ var define, | ||
SortableContainer.prototype._onDragEnterCallback = function(event) { | ||
var item = this._sortableDataService.sortableData[this._sortableDataService.index]; | ||
if (this._sortableData.indexOf(item) === -1) { | ||
this._sortableDataService.sortableData.splice(this._sortableDataService.index, 1); | ||
this._sortableData.push(item); | ||
this._sortableDataService.sortableData = this._sortableData; | ||
this._sortableDataService.index = 0; | ||
if (this._sortableDataService.isDragged) { | ||
var item = this._sortableDataService.sortableData[this._sortableDataService.index]; | ||
if (this._sortableData.indexOf(item) === -1) { | ||
this._sortableDataService.sortableData.splice(this._sortableDataService.index, 1); | ||
this._sortableData.push(item); | ||
this._sortableDataService.sortableData = this._sortableData; | ||
this._sortableDataService.index = 0; | ||
} | ||
this.detectChanges(); | ||
} | ||
this.detectChanges(); | ||
}; | ||
@@ -296,3 +309,3 @@ __decorate([core_2.Input("dragEnabled"), __metadata('design:type', Boolean), __metadata('design:paramtypes', [Boolean])], SortableContainer.prototype, "draggable", null); | ||
return SortableContainer; | ||
})(dnd_component_1.AbstractComponent); | ||
}(dnd_component_1.AbstractComponent)); | ||
exports.SortableContainer = SortableContainer; | ||
@@ -336,2 +349,3 @@ var SortableComponent = (function(_super) { | ||
SortableComponent.prototype._onDragStartCallback = function(event) { | ||
this._sortableDataService.isDragged = true; | ||
this._sortableDataService.sortableData = this._sortableContainer.sortableData; | ||
@@ -345,3 +359,3 @@ this._sortableDataService.index = this.index; | ||
SortableComponent.prototype._onDragOverCallback = function(event) { | ||
if (this._elem != this._sortableDataService.elem) { | ||
if (this._sortableDataService.isDragged && this._elem != this._sortableDataService.elem) { | ||
this._sortableDataService.sortableData = this._sortableContainer.sortableData; | ||
@@ -354,2 +368,3 @@ this._sortableDataService.index = this.index; | ||
SortableComponent.prototype._onDragEndCallback = function(event) { | ||
this._sortableDataService.isDragged = false; | ||
this._sortableDataService.sortableData = null; | ||
@@ -364,17 +379,21 @@ this._sortableDataService.index = null; | ||
SortableComponent.prototype._onDragEnterCallback = function(event) { | ||
this._sortableDataService.markSortable(this._elem); | ||
if ((this.index !== this._sortableDataService.index) || (this._sortableDataService.sortableData != this._sortableContainer.sortableData)) { | ||
var item = this._sortableDataService.sortableData[this._sortableDataService.index]; | ||
this._sortableDataService.sortableData.splice(this._sortableDataService.index, 1); | ||
this._sortableContainer.sortableData.splice(this.index, 0, item); | ||
this._sortableDataService.sortableData = this._sortableContainer.sortableData; | ||
this._sortableDataService.index = this.index; | ||
if (this._sortableDataService.isDragged) { | ||
this._sortableDataService.markSortable(this._elem); | ||
if ((this.index !== this._sortableDataService.index) || (this._sortableDataService.sortableData != this._sortableContainer.sortableData)) { | ||
var item = this._sortableDataService.sortableData[this._sortableDataService.index]; | ||
this._sortableDataService.sortableData.splice(this._sortableDataService.index, 1); | ||
this._sortableContainer.sortableData.splice(this.index, 0, item); | ||
this._sortableDataService.sortableData = this._sortableContainer.sortableData; | ||
this._sortableDataService.index = this.index; | ||
} | ||
} | ||
}; | ||
SortableComponent.prototype._onDropCallback = function(event) { | ||
this.onDropSuccessCallback.emit(this._dragDropService.dragData); | ||
if (this._dragDropService.onDragSuccessCallback) { | ||
this._dragDropService.onDragSuccessCallback.emit(this._dragDropService.dragData); | ||
if (this._sortableDataService.isDragged) { | ||
this.onDropSuccessCallback.emit(this._dragDropService.dragData); | ||
if (this._dragDropService.onDragSuccessCallback) { | ||
this._dragDropService.onDragSuccessCallback.emit(this._dragDropService.dragData); | ||
} | ||
this._sortableContainer.detectChanges(); | ||
} | ||
this._sortableContainer.detectChanges(); | ||
}; | ||
@@ -393,3 +412,3 @@ __decorate([core_2.Input('sortableIndex'), __metadata('design:type', Number)], SortableComponent.prototype, "index", void 0); | ||
return SortableComponent; | ||
})(dnd_component_1.AbstractComponent); | ||
}(dnd_component_1.AbstractComponent)); | ||
exports.SortableComponent = SortableComponent; | ||
@@ -400,2 +419,3 @@ return module.exports; | ||
System.registerDynamic("src/dnd.config", ["@angular/core"], true, function($__require, exports, module) { | ||
"use strict"; | ||
; | ||
@@ -432,3 +452,3 @@ var define, | ||
return DataTransferEffect; | ||
})(); | ||
}()); | ||
exports.DataTransferEffect = DataTransferEffect; | ||
@@ -449,3 +469,3 @@ var DragImage = (function() { | ||
return DragImage; | ||
})(); | ||
}()); | ||
exports.DragImage = DragImage; | ||
@@ -464,3 +484,3 @@ var DragDropConfig = (function() { | ||
return DragDropConfig; | ||
})(); | ||
}()); | ||
exports.DragDropConfig = DragDropConfig; | ||
@@ -471,2 +491,3 @@ return module.exports; | ||
System.registerDynamic("src/dnd.service", ["@angular/core", "@angular/common/src/facade/lang", "./dnd.config"], true, function($__require, exports, module) { | ||
"use strict"; | ||
; | ||
@@ -501,3 +522,3 @@ var define, | ||
return DragDropService; | ||
})(); | ||
}()); | ||
exports.DragDropService = DragDropService; | ||
@@ -526,3 +547,3 @@ var DragDropSortableService = (function() { | ||
return DragDropSortableService; | ||
})(); | ||
}()); | ||
exports.DragDropSortableService = DragDropSortableService; | ||
@@ -533,2 +554,3 @@ return module.exports; | ||
System.registerDynamic("src/dnd.component", ["@angular/core", "./dnd.config", "./dnd.service"], true, function($__require, exports, module) { | ||
"use strict"; | ||
; | ||
@@ -686,3 +708,3 @@ var define, | ||
return AbstractComponent; | ||
})(); | ||
}()); | ||
exports.AbstractComponent = AbstractComponent; | ||
@@ -689,0 +711,0 @@ return module.exports; |
@@ -1,2 +0,2 @@ | ||
System.registerDynamic("src/dnd.draggable",["@angular/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("@angular/core"),s=e("@angular/core"),c=e("./dnd.component"),l=e("./dnd.config"),d=e("./dnd.service"),p=function(e){function t(t,r,a,o){e.call(this,t,r,a,o),this.onDragSuccessCallback=new s.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}),Object.defineProperty(t.prototype,"effectallowed",{set:function(e){this.effectAllowed=e},enumerable:!0,configurable:!0}),t.prototype._onDragStartCallback=function(e){this._dragDropService.isDragged=!0,this._dragDropService.dragData=this.dragData,this._dragDropService.onDragSuccessCallback=this.onDragSuccessCallback,this._elem.classList.add(this._config.onDragStartClass)},t.prototype._onDragEndCallback=function(e){this._dragDropService.isDragged=!1,this._dragDropService.dragData=null,this._dragDropService.onDragSuccessCallback=null,this._elem.classList.remove(this._config.onDragStartClass)},o([s.Input("dragEnabled"),n("design:type",Boolean),n("design:paramtypes",[Boolean])],t.prototype,"draggable",null),o([s.Input(),n("design:type",Object)],t.prototype,"dragData",void 0),o([s.Output("onDragSuccess"),n("design:type",s.EventEmitter)],t.prototype,"onDragSuccessCallback",void 0),o([s.Input("dropZones"),n("design:type",Array),n("design:paramtypes",[Array])],t.prototype,"dropzones",null),o([s.Input("effectAllowed"),n("design:type",String),n("design:paramtypes",[String])],t.prototype,"effectallowed",null),t=o([s.Directive({selector:"[dnd-draggable]"}),n("design:paramtypes",[s.ElementRef,d.DragDropService,l.DragDropConfig,i.ChangeDetectorRef])],t)}(c.AbstractComponent);return t.DraggableComponent=p,r.exports}),System.registerDynamic("src/dnd.droppable",["@angular/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("@angular/core"),s=e("@angular/core"),c=e("./dnd.component"),l=e("./dnd.config"),d=e("./dnd.service"),p=function(e){function t(t,r,a,o){e.call(this,t,r,a,o),this.onDropSuccess=new s.EventEmitter,this.onDragEnter=new s.EventEmitter,this.onDragOver=new s.EventEmitter,this.onDragLeave=new s.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}),Object.defineProperty(t.prototype,"effectallowed",{set:function(e){this.effectAllowed=e},enumerable:!0,configurable:!0}),t.prototype._onDragEnterCallback=function(e){this._elem.classList.add(this._config.onDragEnterClass),this.onDragEnter.emit({dragData:this._dragDropService.dragData,mouseEvent:e})},t.prototype._onDragOverCallback=function(e){this._elem.classList.add(this._config.onDragOverClass),this.onDragOver.emit({dragData:this._dragDropService.dragData,mouseEvent:e})},t.prototype._onDragLeaveCallback=function(e){this._elem.classList.remove(this._config.onDragOverClass),this._elem.classList.remove(this._config.onDragEnterClass),this.onDragLeave.emit({dragData:this._dragDropService.dragData,mouseEvent:e})},t.prototype._onDropCallback=function(e){this.onDropSuccess.emit({dragData:this._dragDropService.dragData,mouseEvent:e}),this._dragDropService.onDragSuccessCallback&&this._dragDropService.onDragSuccessCallback.emit({dragData:this._dragDropService.dragData,mouseEvent:e}),this._elem.classList.remove(this._config.onDragOverClass),this._elem.classList.remove(this._config.onDragEnterClass)},o([s.Input("dropEnabled"),n("design:type",Boolean),n("design:paramtypes",[Boolean])],t.prototype,"droppable",null),o([s.Output(),n("design:type",s.EventEmitter)],t.prototype,"onDropSuccess",void 0),o([s.Output(),n("design:type",s.EventEmitter)],t.prototype,"onDragEnter",void 0),o([s.Output(),n("design:type",s.EventEmitter)],t.prototype,"onDragOver",void 0),o([s.Output(),n("design:type",s.EventEmitter)],t.prototype,"onDragLeave",void 0),o([s.Input("dropZones"),n("design:type",Array),n("design:paramtypes",[Array])],t.prototype,"dropzones",null),o([s.Input("effectAllowed"),n("design:type",String),n("design:paramtypes",[String])],t.prototype,"effectallowed",null),t=o([s.Directive({selector:"[dnd-droppable]"}),n("design:paramtypes",[s.ElementRef,d.DragDropService,l.DragDropConfig,i.ChangeDetectorRef])],t)}(c.AbstractComponent);return t.DroppableComponent=p,r.exports}),System.registerDynamic("src/dnd.sortable",["@angular/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("@angular/core"),s=e("@angular/core"),c=e("./dnd.component"),l=e("./dnd.config"),d=e("./dnd.service"),p=function(e){function t(t,r,a,o,n){e.call(this,t,r,a,o),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),this.detectChanges()},o([s.Input("dragEnabled"),n("design:type",Boolean),n("design:paramtypes",[Boolean])],t.prototype,"draggable",null),o([s.Input(),n("design:type",Array),n("design:paramtypes",[Array])],t.prototype,"sortableData",null),o([s.Input("dropZones"),n("design:type",Array),n("design:paramtypes",[Array])],t.prototype,"dropzones",null),t=o([s.Directive({selector:"[dnd-sortable-container]"}),n("design:paramtypes",[s.ElementRef,d.DragDropService,l.DragDropConfig,i.ChangeDetectorRef,d.DragDropSortableService])],t)}(c.AbstractComponent);t.SortableContainer=p;var g=function(e){function t(t,r,a,o,n,i){e.call(this,t,r,a,i),this._sortableContainer=o,this._sortableDataService=n,this.onDragSuccessCallback=new s.EventEmitter,this.onDragStartCallback=new s.EventEmitter,this.onDragOverCallback=new s.EventEmitter,this.onDragEndCallback=new s.EventEmitter,this.onDropSuccessCallback=new s.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}),Object.defineProperty(t.prototype,"effectallowed",{set:function(e){this.effectAllowed=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.isDragged=!0,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),this.onDragOverCallback.emit(this._dragDropService.dragData))},t.prototype._onDragEndCallback=function(e){this._sortableDataService.sortableData=null,this._sortableDataService.index=null,this._sortableDataService.markSortable(null),this._dragDropService.isDragged=!1,this._dragDropService.dragData=null,this._dragDropService.onDragSuccessCallback=null,this.onDragEndCallback.emit(this._dragDropService.dragData)},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.emit(this._dragDropService.dragData),this._dragDropService.onDragSuccessCallback&&this._dragDropService.onDragSuccessCallback.emit(this._dragDropService.dragData),this._sortableContainer.detectChanges()},o([s.Input("sortableIndex"),n("design:type",Number)],t.prototype,"index",void 0),o([s.Input("dragEnabled"),n("design:type",Boolean),n("design:paramtypes",[Boolean])],t.prototype,"draggable",null),o([s.Input("dropEnabled"),n("design:type",Boolean),n("design:paramtypes",[Boolean])],t.prototype,"droppable",null),o([s.Input(),n("design:type",Object)],t.prototype,"dragData",void 0),o([s.Input("effectAllowed"),n("design:type",String),n("design:paramtypes",[String])],t.prototype,"effectallowed",null),o([s.Output("onDragSuccess"),n("design:type",s.EventEmitter)],t.prototype,"onDragSuccessCallback",void 0),o([s.Output("onDragStart"),n("design:type",s.EventEmitter)],t.prototype,"onDragStartCallback",void 0),o([s.Output("onDragOver"),n("design:type",s.EventEmitter)],t.prototype,"onDragOverCallback",void 0),o([s.Output("onDragEnd"),n("design:type",s.EventEmitter)],t.prototype,"onDragEndCallback",void 0),o([s.Output("onDropSuccess"),n("design:type",s.EventEmitter)],t.prototype,"onDropSuccessCallback",void 0),t=o([s.Directive({selector:"[dnd-sortable]"}),n("design:paramtypes",[s.ElementRef,d.DragDropService,l.DragDropConfig,p,d.DragDropSortableService,i.ChangeDetectorRef])],t)}(c.AbstractComponent);return t.SortableComponent=g,r.exports}),System.registerDynamic("src/dnd.config",["@angular/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("@angular/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",["@angular/core","@angular/common/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("@angular/core"),i=e("@angular/common/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",["@angular/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("@angular/core"),i=e("@angular/core"),s=e("./dnd.config"),c=e("./dnd.service"),l=function(){function e(e,t,r,a){var o=this;this._dragDropService=t,this._config=r,this._cdr=a,this._dragEnabled=!1,this.dropEnabled=!1,this.dropZones=[],this._elem=e.nativeElement,this.dragEnabled=!0,this._elem.ondragenter=function(e){o._onDragEnter(e)},this._elem.ondragover=function(e){return o._onDragOver(e),null!=e.dataTransfer&&(e.dataTransfer.dropEffect=o._config.dropEffect.name),!1},this._elem.ondragleave=function(e){o._onDragLeave(e)},this._elem.ondrop=function(e){o._onDrop(e)},this._elem.ondragstart=function(e){if(o._onDragStart(e),null!=e.dataTransfer&&(e.dataTransfer.effectAllowed=o.effectAllowed||o._config.dragEffect.name,e.dataTransfer.setData("text",""),null!=o._config.dragImage)){var t=o._config.dragImage;e.dataTransfer.setDragImage(t.imageElement,t.x_offset,t.y_offset)}},this._elem.ondragend=function(e){o._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.detectChanges=function(){var e=this;setTimeout(function(){e._cdr.detectChanges()},250)},e.prototype._onDragEnter=function(e){this._isDropAllowed&&this._onDragEnterCallback(e)},e.prototype._onDragOver=function(e){this._isDropAllowed&&(e.preventDefault&&e.preventDefault(),this._onDragOverCallback(e))},e.prototype._onDragLeave=function(e){this._isDropAllowed&&this._onDragLeaveCallback(e)},e.prototype._onDrop=function(e){this._isDropAllowed&&(e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),this._onDropCallback(e),this.detectChanges())},Object.defineProperty(e.prototype,"_isDropAllowed",{get:function(){if(this._dragDropService.isDragged&&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,n.ChangeDetectorRef])],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}); | ||
System.registerDynamic("src/dnd.draggable",["@angular/core","./dnd.component","./dnd.config","./dnd.service"],!0,function(e,t,r){"use strict";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("@angular/core"),s=e("@angular/core"),c=e("./dnd.component"),l=e("./dnd.config"),d=e("./dnd.service"),p=function(e){function t(t,r,a,o){e.call(this,t,r,a,o),this.onDragSuccessCallback=new s.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}),Object.defineProperty(t.prototype,"effectallowed",{set:function(e){this.effectAllowed=e},enumerable:!0,configurable:!0}),t.prototype._onDragStartCallback=function(e){this._dragDropService.isDragged=!0,this._dragDropService.dragData=this.dragData,this._dragDropService.onDragSuccessCallback=this.onDragSuccessCallback,this._elem.classList.add(this._config.onDragStartClass)},t.prototype._onDragEndCallback=function(e){this._dragDropService.isDragged=!1,this._dragDropService.dragData=null,this._dragDropService.onDragSuccessCallback=null,this._elem.classList.remove(this._config.onDragStartClass)},o([s.Input("dragEnabled"),n("design:type",Boolean),n("design:paramtypes",[Boolean])],t.prototype,"draggable",null),o([s.Input(),n("design:type",Object)],t.prototype,"dragData",void 0),o([s.Output("onDragSuccess"),n("design:type",s.EventEmitter)],t.prototype,"onDragSuccessCallback",void 0),o([s.Input("dropZones"),n("design:type",Array),n("design:paramtypes",[Array])],t.prototype,"dropzones",null),o([s.Input("effectAllowed"),n("design:type",String),n("design:paramtypes",[String])],t.prototype,"effectallowed",null),t=o([s.Directive({selector:"[dnd-draggable]"}),n("design:paramtypes",[s.ElementRef,d.DragDropService,l.DragDropConfig,i.ChangeDetectorRef])],t)}(c.AbstractComponent);return t.DraggableComponent=p,r.exports}),System.registerDynamic("src/dnd.droppable",["@angular/core","./dnd.component","./dnd.config","./dnd.service"],!0,function(e,t,r){"use strict";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("@angular/core"),s=e("@angular/core"),c=e("./dnd.component"),l=e("./dnd.config"),d=e("./dnd.service"),p=function(e){function t(t,r,a,o){e.call(this,t,r,a,o),this.onDropSuccess=new s.EventEmitter,this.onDragEnter=new s.EventEmitter,this.onDragOver=new s.EventEmitter,this.onDragLeave=new s.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}),Object.defineProperty(t.prototype,"effectallowed",{set:function(e){this.effectAllowed=e},enumerable:!0,configurable:!0}),t.prototype._onDragEnterCallback=function(e){this._dragDropService.isDragged&&(this._elem.classList.add(this._config.onDragEnterClass),this.onDragEnter.emit({dragData:this._dragDropService.dragData,mouseEvent:e}))},t.prototype._onDragOverCallback=function(e){this._dragDropService.isDragged&&(this._elem.classList.add(this._config.onDragOverClass),this.onDragOver.emit({dragData:this._dragDropService.dragData,mouseEvent:e}))},t.prototype._onDragLeaveCallback=function(e){this._dragDropService.isDragged&&(this._elem.classList.remove(this._config.onDragOverClass),this._elem.classList.remove(this._config.onDragEnterClass),this.onDragLeave.emit({dragData:this._dragDropService.dragData,mouseEvent:e}))},t.prototype._onDropCallback=function(e){this._dragDropService.isDragged&&(this.onDropSuccess.emit({dragData:this._dragDropService.dragData,mouseEvent:e}),this._dragDropService.onDragSuccessCallback&&this._dragDropService.onDragSuccessCallback.emit({dragData:this._dragDropService.dragData,mouseEvent:e}),this._elem.classList.remove(this._config.onDragOverClass),this._elem.classList.remove(this._config.onDragEnterClass))},o([s.Input("dropEnabled"),n("design:type",Boolean),n("design:paramtypes",[Boolean])],t.prototype,"droppable",null),o([s.Output(),n("design:type",s.EventEmitter)],t.prototype,"onDropSuccess",void 0),o([s.Output(),n("design:type",s.EventEmitter)],t.prototype,"onDragEnter",void 0),o([s.Output(),n("design:type",s.EventEmitter)],t.prototype,"onDragOver",void 0),o([s.Output(),n("design:type",s.EventEmitter)],t.prototype,"onDragLeave",void 0),o([s.Input("dropZones"),n("design:type",Array),n("design:paramtypes",[Array])],t.prototype,"dropzones",null),o([s.Input("effectAllowed"),n("design:type",String),n("design:paramtypes",[String])],t.prototype,"effectallowed",null),t=o([s.Directive({selector:"[dnd-droppable]"}),n("design:paramtypes",[s.ElementRef,d.DragDropService,l.DragDropConfig,i.ChangeDetectorRef])],t)}(c.AbstractComponent);return t.DroppableComponent=p,r.exports}),System.registerDynamic("src/dnd.sortable",["@angular/core","./dnd.component","./dnd.config","./dnd.service"],!0,function(e,t,r){"use strict";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("@angular/core"),s=e("@angular/core"),c=e("./dnd.component"),l=e("./dnd.config"),d=e("./dnd.service"),p=function(e){function t(t,r,a,o,n){e.call(this,t,r,a,o),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){if(this._sortableDataService.isDragged){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),this.detectChanges()}},o([s.Input("dragEnabled"),n("design:type",Boolean),n("design:paramtypes",[Boolean])],t.prototype,"draggable",null),o([s.Input(),n("design:type",Array),n("design:paramtypes",[Array])],t.prototype,"sortableData",null),o([s.Input("dropZones"),n("design:type",Array),n("design:paramtypes",[Array])],t.prototype,"dropzones",null),t=o([s.Directive({selector:"[dnd-sortable-container]"}),n("design:paramtypes",[s.ElementRef,d.DragDropService,l.DragDropConfig,i.ChangeDetectorRef,d.DragDropSortableService])],t)}(c.AbstractComponent);t.SortableContainer=p;var g=function(e){function t(t,r,a,o,n,i){e.call(this,t,r,a,i),this._sortableContainer=o,this._sortableDataService=n,this.onDragSuccessCallback=new s.EventEmitter,this.onDragStartCallback=new s.EventEmitter,this.onDragOverCallback=new s.EventEmitter,this.onDragEndCallback=new s.EventEmitter,this.onDropSuccessCallback=new s.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}),Object.defineProperty(t.prototype,"effectallowed",{set:function(e){this.effectAllowed=e},enumerable:!0,configurable:!0}),t.prototype._onDragStartCallback=function(e){this._sortableDataService.isDragged=!0,this._sortableDataService.sortableData=this._sortableContainer.sortableData,this._sortableDataService.index=this.index,this._sortableDataService.markSortable(this._elem),this._dragDropService.isDragged=!0,this._dragDropService.dragData=this.dragData,this._dragDropService.onDragSuccessCallback=this.onDragSuccessCallback},t.prototype._onDragOverCallback=function(e){this._sortableDataService.isDragged&&this._elem!=this._sortableDataService.elem&&(this._sortableDataService.sortableData=this._sortableContainer.sortableData,this._sortableDataService.index=this.index,this._sortableDataService.markSortable(this._elem),this.onDragOverCallback.emit(this._dragDropService.dragData))},t.prototype._onDragEndCallback=function(e){this._sortableDataService.isDragged=!1,this._sortableDataService.sortableData=null,this._sortableDataService.index=null,this._sortableDataService.markSortable(null),this._dragDropService.isDragged=!1,this._dragDropService.dragData=null,this._dragDropService.onDragSuccessCallback=null,this.onDragEndCallback.emit(this._dragDropService.dragData)},t.prototype._onDragEnterCallback=function(e){if(this._sortableDataService.isDragged&&(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._sortableDataService.isDragged&&(this.onDropSuccessCallback.emit(this._dragDropService.dragData),this._dragDropService.onDragSuccessCallback&&this._dragDropService.onDragSuccessCallback.emit(this._dragDropService.dragData),this._sortableContainer.detectChanges())},o([s.Input("sortableIndex"),n("design:type",Number)],t.prototype,"index",void 0),o([s.Input("dragEnabled"),n("design:type",Boolean),n("design:paramtypes",[Boolean])],t.prototype,"draggable",null),o([s.Input("dropEnabled"),n("design:type",Boolean),n("design:paramtypes",[Boolean])],t.prototype,"droppable",null),o([s.Input(),n("design:type",Object)],t.prototype,"dragData",void 0),o([s.Input("effectAllowed"),n("design:type",String),n("design:paramtypes",[String])],t.prototype,"effectallowed",null),o([s.Output("onDragSuccess"),n("design:type",s.EventEmitter)],t.prototype,"onDragSuccessCallback",void 0),o([s.Output("onDragStart"),n("design:type",s.EventEmitter)],t.prototype,"onDragStartCallback",void 0),o([s.Output("onDragOver"),n("design:type",s.EventEmitter)],t.prototype,"onDragOverCallback",void 0),o([s.Output("onDragEnd"),n("design:type",s.EventEmitter)],t.prototype,"onDragEndCallback",void 0),o([s.Output("onDropSuccess"),n("design:type",s.EventEmitter)],t.prototype,"onDropSuccessCallback",void 0),t=o([s.Directive({selector:"[dnd-sortable]"}),n("design:paramtypes",[s.ElementRef,d.DragDropService,l.DragDropConfig,p,d.DragDropSortableService,i.ChangeDetectorRef])],t)}(c.AbstractComponent);return t.SortableComponent=g,r.exports}),System.registerDynamic("src/dnd.config",["@angular/core"],!0,function(e,t,r){"use strict";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("@angular/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",["@angular/core","@angular/common/src/facade/lang","./dnd.config"],!0,function(e,t,r){"use strict";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("@angular/core"),i=e("@angular/common/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",["@angular/core","./dnd.config","./dnd.service"],!0,function(e,t,r){"use strict";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("@angular/core"),i=e("@angular/core"),s=e("./dnd.config"),c=e("./dnd.service"),l=function(){function e(e,t,r,a){var o=this;this._dragDropService=t,this._config=r,this._cdr=a,this._dragEnabled=!1,this.dropEnabled=!1,this.dropZones=[],this._elem=e.nativeElement,this.dragEnabled=!0,this._elem.ondragenter=function(e){o._onDragEnter(e)},this._elem.ondragover=function(e){return o._onDragOver(e),null!=e.dataTransfer&&(e.dataTransfer.dropEffect=o._config.dropEffect.name),!1},this._elem.ondragleave=function(e){o._onDragLeave(e)},this._elem.ondrop=function(e){o._onDrop(e)},this._elem.ondragstart=function(e){if(o._onDragStart(e),null!=e.dataTransfer&&(e.dataTransfer.effectAllowed=o.effectAllowed||o._config.dragEffect.name,e.dataTransfer.setData("text",""),null!=o._config.dragImage)){var t=o._config.dragImage;e.dataTransfer.setDragImage(t.imageElement,t.x_offset,t.y_offset)}},this._elem.ondragend=function(e){o._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.detectChanges=function(){var e=this;setTimeout(function(){e._cdr.detectChanges()},250)},e.prototype._onDragEnter=function(e){this._isDropAllowed&&this._onDragEnterCallback(e)},e.prototype._onDragOver=function(e){this._isDropAllowed&&(e.preventDefault&&e.preventDefault(),this._onDragOverCallback(e))},e.prototype._onDragLeave=function(e){this._isDropAllowed&&this._onDragLeaveCallback(e)},e.prototype._onDrop=function(e){this._isDropAllowed&&(e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),this._onDropCallback(e),this.detectChanges())},Object.defineProperty(e.prototype,"_isDropAllowed",{get:function(){if(this._dragDropService.isDragged&&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,n.ChangeDetectorRef])],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 |
@@ -37,3 +37,3 @@ { | ||
"es6-shim": "~0.35.0", | ||
"reflect-metadata": "0.1.3", | ||
"reflect-metadata": "0.1.2", | ||
"rxjs": "5.0.0-beta.6", | ||
@@ -51,7 +51,6 @@ "zone.js": "~0.6.12" | ||
"semantic-release": "^4.3.5", | ||
"systemjs": "~0.19.6", | ||
"systemjs-builder": "^0.15.6", | ||
"tsd": "^0.6.5", | ||
"typescript": "~1.7.3", | ||
"typings": "^0.6.8", | ||
"systemjs": "^0.19.27", | ||
"systemjs-builder": "^0.15.16", | ||
"typescript": "^1.8.7", | ||
"typings": "^0.8.1", | ||
"uglify-js": "^2.6.2" | ||
@@ -64,3 +63,3 @@ }, | ||
}, | ||
"version": "1.6.3" | ||
"version": "1.6.4" | ||
} |
// Copyright (C) 2016 Sergey Akopkokhyants | ||
// This project is licensed under the terms of the MIT license. | ||
// https://github.com/akserg/ng2-dnd | ||
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
@@ -182,4 +183,4 @@ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
return AbstractComponent; | ||
})(); | ||
}()); | ||
exports.AbstractComponent = AbstractComponent; | ||
//# sourceMappingURL=dnd.component.js.map |
// Copyright (C) 2016 Sergey Akopkokhyants | ||
// This project is licensed under the terms of the MIT license. | ||
// https://github.com/akserg/ng2-dnd | ||
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
@@ -27,3 +28,3 @@ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
return DataTransferEffect; | ||
})(); | ||
}()); | ||
exports.DataTransferEffect = DataTransferEffect; | ||
@@ -43,3 +44,3 @@ var DragImage = (function () { | ||
return DragImage; | ||
})(); | ||
}()); | ||
exports.DragImage = DragImage; | ||
@@ -61,4 +62,4 @@ var DragDropConfig = (function () { | ||
return DragDropConfig; | ||
})(); | ||
}()); | ||
exports.DragDropConfig = DragDropConfig; | ||
//# sourceMappingURL=dnd.config.js.map |
// Copyright (C) 2016 Sergey Akopkokhyants | ||
// This project is licensed under the terms of the MIT license. | ||
// https://github.com/akserg/ng2-dnd | ||
"use strict"; | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
@@ -96,4 +97,4 @@ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
return DraggableComponent; | ||
})(dnd_component_1.AbstractComponent); | ||
}(dnd_component_1.AbstractComponent)); | ||
exports.DraggableComponent = DraggableComponent; | ||
//# sourceMappingURL=dnd.draggable.js.map |
// Copyright (C) 2016 Sergey Akopkokhyants | ||
// This project is licensed under the terms of the MIT license. | ||
// https://github.com/akserg/ng2-dnd | ||
"use strict"; | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
@@ -59,23 +60,31 @@ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
DroppableComponent.prototype._onDragEnterCallback = function (event) { | ||
this._elem.classList.add(this._config.onDragEnterClass); | ||
this.onDragEnter.emit({ dragData: this._dragDropService.dragData, mouseEvent: event }); | ||
if (this._dragDropService.isDragged) { | ||
this._elem.classList.add(this._config.onDragEnterClass); | ||
this.onDragEnter.emit({ dragData: this._dragDropService.dragData, mouseEvent: event }); | ||
} | ||
}; | ||
DroppableComponent.prototype._onDragOverCallback = function (event) { | ||
this._elem.classList.add(this._config.onDragOverClass); | ||
this.onDragOver.emit({ dragData: this._dragDropService.dragData, mouseEvent: event }); | ||
if (this._dragDropService.isDragged) { | ||
this._elem.classList.add(this._config.onDragOverClass); | ||
this.onDragOver.emit({ dragData: this._dragDropService.dragData, mouseEvent: event }); | ||
} | ||
}; | ||
; | ||
DroppableComponent.prototype._onDragLeaveCallback = function (event) { | ||
this._elem.classList.remove(this._config.onDragOverClass); | ||
this._elem.classList.remove(this._config.onDragEnterClass); | ||
this.onDragLeave.emit({ dragData: this._dragDropService.dragData, mouseEvent: event }); | ||
if (this._dragDropService.isDragged) { | ||
this._elem.classList.remove(this._config.onDragOverClass); | ||
this._elem.classList.remove(this._config.onDragEnterClass); | ||
this.onDragLeave.emit({ dragData: this._dragDropService.dragData, mouseEvent: event }); | ||
} | ||
}; | ||
; | ||
DroppableComponent.prototype._onDropCallback = function (event) { | ||
this.onDropSuccess.emit({ dragData: this._dragDropService.dragData, mouseEvent: event }); | ||
if (this._dragDropService.onDragSuccessCallback) { | ||
this._dragDropService.onDragSuccessCallback.emit({ dragData: this._dragDropService.dragData, mouseEvent: event }); | ||
if (this._dragDropService.isDragged) { | ||
this.onDropSuccess.emit({ dragData: this._dragDropService.dragData, mouseEvent: event }); | ||
if (this._dragDropService.onDragSuccessCallback) { | ||
this._dragDropService.onDragSuccessCallback.emit({ dragData: this._dragDropService.dragData, mouseEvent: event }); | ||
} | ||
this._elem.classList.remove(this._config.onDragOverClass); | ||
this._elem.classList.remove(this._config.onDragEnterClass); | ||
} | ||
this._elem.classList.remove(this._config.onDragOverClass); | ||
this._elem.classList.remove(this._config.onDragEnterClass); | ||
}; | ||
@@ -118,4 +127,4 @@ __decorate([ | ||
return DroppableComponent; | ||
})(dnd_component_1.AbstractComponent); | ||
}(dnd_component_1.AbstractComponent)); | ||
exports.DroppableComponent = DroppableComponent; | ||
//# sourceMappingURL=dnd.droppable.js.map |
@@ -45,25 +45,33 @@ // Copyright (C) 2016 Sergey Akopkokhyants | ||
_onDragEnterCallback(event: MouseEvent) { | ||
this._elem.classList.add(this._config.onDragEnterClass); | ||
this.onDragEnter.emit({dragData: this._dragDropService.dragData, mouseEvent: event}); | ||
if (this._dragDropService.isDragged) { | ||
this._elem.classList.add(this._config.onDragEnterClass); | ||
this.onDragEnter.emit({dragData: this._dragDropService.dragData, mouseEvent: event}); | ||
} | ||
} | ||
_onDragOverCallback (event: MouseEvent) { | ||
this._elem.classList.add(this._config.onDragOverClass); | ||
this.onDragOver.emit({dragData: this._dragDropService.dragData, mouseEvent: event}); | ||
if (this._dragDropService.isDragged) { | ||
this._elem.classList.add(this._config.onDragOverClass); | ||
this.onDragOver.emit({dragData: this._dragDropService.dragData, mouseEvent: event}); | ||
} | ||
}; | ||
_onDragLeaveCallback (event: MouseEvent) { | ||
this._elem.classList.remove(this._config.onDragOverClass); | ||
this._elem.classList.remove(this._config.onDragEnterClass); | ||
this.onDragLeave.emit({dragData: this._dragDropService.dragData, mouseEvent: event}); | ||
if (this._dragDropService.isDragged) { | ||
this._elem.classList.remove(this._config.onDragOverClass); | ||
this._elem.classList.remove(this._config.onDragEnterClass); | ||
this.onDragLeave.emit({dragData: this._dragDropService.dragData, mouseEvent: event}); | ||
} | ||
}; | ||
_onDropCallback (event: MouseEvent) { | ||
this.onDropSuccess.emit({dragData: this._dragDropService.dragData, mouseEvent: event}); | ||
if (this._dragDropService.onDragSuccessCallback) { | ||
this._dragDropService.onDragSuccessCallback.emit({dragData: this._dragDropService.dragData, mouseEvent: event}); | ||
if (this._dragDropService.isDragged) { | ||
this.onDropSuccess.emit({dragData: this._dragDropService.dragData, mouseEvent: event}); | ||
if (this._dragDropService.onDragSuccessCallback) { | ||
this._dragDropService.onDragSuccessCallback.emit({dragData: this._dragDropService.dragData, mouseEvent: event}); | ||
} | ||
this._elem.classList.remove(this._config.onDragOverClass); | ||
this._elem.classList.remove(this._config.onDragEnterClass); | ||
} | ||
this._elem.classList.remove(this._config.onDragOverClass); | ||
this._elem.classList.remove(this._config.onDragEnterClass); | ||
} | ||
} |
@@ -17,2 +17,3 @@ import { EventEmitter } from '@angular/core'; | ||
sortableData: Array<any>; | ||
isDragged: boolean; | ||
private _elem; | ||
@@ -19,0 +20,0 @@ elem: HTMLElement; |
// Copyright (C) 2016 Sergey Akopkokhyants | ||
// This project is licensed under the terms of the MIT license. | ||
// https://github.com/akserg/ng2-dnd | ||
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
@@ -25,3 +26,3 @@ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
return DragDropService; | ||
})(); | ||
}()); | ||
exports.DragDropService = DragDropService; | ||
@@ -53,4 +54,4 @@ var DragDropSortableService = (function () { | ||
return DragDropSortableService; | ||
})(); | ||
}()); | ||
exports.DragDropSortableService = DragDropSortableService; | ||
//# sourceMappingURL=dnd.service.js.map |
@@ -27,2 +27,3 @@ // Copyright (C) 2016 Sergey Akopkokhyants | ||
sortableData: Array<any>; | ||
isDragged: boolean; | ||
@@ -29,0 +30,0 @@ private _elem: HTMLElement; |
// Copyright (C) 2016 Sergey Akopkokhyants | ||
// This project is licensed under the terms of the MIT license. | ||
// https://github.com/akserg/ng2-dnd | ||
"use strict"; | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
@@ -59,16 +60,18 @@ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
SortableContainer.prototype._onDragEnterCallback = function (event) { | ||
var item = this._sortableDataService.sortableData[this._sortableDataService.index]; | ||
// Check does element exist in sortableData of this Container | ||
if (this._sortableData.indexOf(item) === -1) { | ||
// Let's add it | ||
// console.log('Container._onDragEnterCallback. drag node [' + this._sortableDataService.index.toString() + '] over parent node'); | ||
// Remove item from previouse list | ||
this._sortableDataService.sortableData.splice(this._sortableDataService.index, 1); | ||
// Add item to new list | ||
this._sortableData.push(item); | ||
this._sortableDataService.sortableData = this._sortableData; | ||
this._sortableDataService.index = 0; | ||
if (this._sortableDataService.isDragged) { | ||
var item = this._sortableDataService.sortableData[this._sortableDataService.index]; | ||
// Check does element exist in sortableData of this Container | ||
if (this._sortableData.indexOf(item) === -1) { | ||
// Let's add it | ||
// console.log('Container._onDragEnterCallback. drag node [' + this._sortableDataService.index.toString() + '] over parent node'); | ||
// Remove item from previouse list | ||
this._sortableDataService.sortableData.splice(this._sortableDataService.index, 1); | ||
// Add item to new list | ||
this._sortableData.push(item); | ||
this._sortableDataService.sortableData = this._sortableData; | ||
this._sortableDataService.index = 0; | ||
} | ||
// Refresh changes in properties of container component | ||
this.detectChanges(); | ||
} | ||
// Refresh changes in properties of container component | ||
this.detectChanges(); | ||
}; | ||
@@ -95,3 +98,3 @@ __decorate([ | ||
return SortableContainer; | ||
})(dnd_component_1.AbstractComponent); | ||
}(dnd_component_1.AbstractComponent)); | ||
exports.SortableContainer = SortableContainer; | ||
@@ -140,2 +143,3 @@ var SortableComponent = (function (_super) { | ||
// console.log('_onDragStartCallback. dragging elem with index ' + this.index); | ||
this._sortableDataService.isDragged = true; | ||
this._sortableDataService.sortableData = this._sortableContainer.sortableData; | ||
@@ -152,3 +156,3 @@ this._sortableDataService.index = this.index; | ||
SortableComponent.prototype._onDragOverCallback = function (event) { | ||
if (this._elem != this._sortableDataService.elem) { | ||
if (this._sortableDataService.isDragged && this._elem != this._sortableDataService.elem) { | ||
// console.log('_onDragOverCallback. dragging elem with index ' + this.index); | ||
@@ -163,2 +167,3 @@ this._sortableDataService.sortableData = this._sortableContainer.sortableData; | ||
// console.log('_onDragEndCallback. end dragging elem with index ' + this.index); | ||
this._sortableDataService.isDragged = false; | ||
this._sortableDataService.sortableData = null; | ||
@@ -175,25 +180,29 @@ this._sortableDataService.index = null; | ||
SortableComponent.prototype._onDragEnterCallback = function (event) { | ||
this._sortableDataService.markSortable(this._elem); | ||
if ((this.index !== this._sortableDataService.index) || | ||
(this._sortableDataService.sortableData != this._sortableContainer.sortableData)) { | ||
// console.log('Component._onDragEnterCallback. drag node [' + this.index + '] over node [' + this._sortableDataService.index + ']'); | ||
// Get item | ||
var item = this._sortableDataService.sortableData[this._sortableDataService.index]; | ||
// Remove item from previouse list | ||
this._sortableDataService.sortableData.splice(this._sortableDataService.index, 1); | ||
// Add item to new list | ||
this._sortableContainer.sortableData.splice(this.index, 0, item); | ||
this._sortableDataService.sortableData = this._sortableContainer.sortableData; | ||
this._sortableDataService.index = this.index; | ||
if (this._sortableDataService.isDragged) { | ||
this._sortableDataService.markSortable(this._elem); | ||
if ((this.index !== this._sortableDataService.index) || | ||
(this._sortableDataService.sortableData != this._sortableContainer.sortableData)) { | ||
// console.log('Component._onDragEnterCallback. drag node [' + this.index + '] over node [' + this._sortableDataService.index + ']'); | ||
// Get item | ||
var item = this._sortableDataService.sortableData[this._sortableDataService.index]; | ||
// Remove item from previouse list | ||
this._sortableDataService.sortableData.splice(this._sortableDataService.index, 1); | ||
// Add item to new list | ||
this._sortableContainer.sortableData.splice(this.index, 0, item); | ||
this._sortableDataService.sortableData = this._sortableContainer.sortableData; | ||
this._sortableDataService.index = this.index; | ||
} | ||
} | ||
}; | ||
SortableComponent.prototype._onDropCallback = function (event) { | ||
// 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); | ||
if (this._sortableDataService.isDragged) { | ||
// 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); | ||
} | ||
// Refresh changes in properties of container component | ||
this._sortableContainer.detectChanges(); | ||
} | ||
// Refresh changes in properties of container component | ||
this._sortableContainer.detectChanges(); | ||
}; | ||
@@ -248,4 +257,4 @@ __decorate([ | ||
return SortableComponent; | ||
})(dnd_component_1.AbstractComponent); | ||
}(dnd_component_1.AbstractComponent)); | ||
exports.SortableComponent = SortableComponent; | ||
//# sourceMappingURL=dnd.sortable.js.map |
@@ -20,3 +20,3 @@ // Copyright (C) 2016 Sergey Akopkokhyants | ||
} | ||
private _sortableData: Array<any> = []; | ||
@@ -40,3 +40,3 @@ | ||
private _sortableDataService: DragDropSortableService) { | ||
super(elemRef, dragDropService, config, cdr); | ||
@@ -47,16 +47,18 @@ this.dragEnabled = false; | ||
_onDragEnterCallback(event: Event) { | ||
let item:any = this._sortableDataService.sortableData[this._sortableDataService.index]; | ||
// Check does element exist in sortableData of this Container | ||
if (this._sortableData.indexOf(item) === -1) { | ||
// Let's add it | ||
// console.log('Container._onDragEnterCallback. drag node [' + this._sortableDataService.index.toString() + '] over parent node'); | ||
// Remove item from previouse list | ||
this._sortableDataService.sortableData.splice(this._sortableDataService.index, 1); | ||
// Add item to new list | ||
this._sortableData.push(item); | ||
this._sortableDataService.sortableData = this._sortableData; | ||
this._sortableDataService.index = 0; | ||
if (this._sortableDataService.isDragged) { | ||
let item:any = this._sortableDataService.sortableData[this._sortableDataService.index]; | ||
// Check does element exist in sortableData of this Container | ||
if (this._sortableData.indexOf(item) === -1) { | ||
// Let's add it | ||
// console.log('Container._onDragEnterCallback. drag node [' + this._sortableDataService.index.toString() + '] over parent node'); | ||
// Remove item from previouse list | ||
this._sortableDataService.sortableData.splice(this._sortableDataService.index, 1); | ||
// Add item to new list | ||
this._sortableData.push(item); | ||
this._sortableDataService.sortableData = this._sortableData; | ||
this._sortableDataService.index = 0; | ||
} | ||
// Refresh changes in properties of container component | ||
this.detectChanges(); | ||
} | ||
// Refresh changes in properties of container component | ||
this.detectChanges(); | ||
} | ||
@@ -69,3 +71,3 @@ } | ||
@Input('sortableIndex') index: number; | ||
@Input("dragEnabled") set draggable(value:boolean) { | ||
@@ -78,3 +80,3 @@ this.dragEnabled = !!value; | ||
} | ||
/** | ||
@@ -84,7 +86,7 @@ * The data that has to be dragged. It can be any JS object | ||
@Input() dragData: any; | ||
@Input("effectAllowed") set effectallowed(value: string) { | ||
this.effectAllowed = value; | ||
} | ||
/** | ||
@@ -95,3 +97,3 @@ * Callback function called when the drag action ends with a valid drop action. | ||
@Output("onDragSuccess") onDragSuccessCallback: EventEmitter<any> = new EventEmitter<any>(); | ||
@Output("onDragStart") onDragStartCallback: EventEmitter<any> = new EventEmitter<any>(); | ||
@@ -102,7 +104,7 @@ @Output("onDragOver") onDragOverCallback: EventEmitter<any> = new EventEmitter<any>(); | ||
constructor(elemRef: ElementRef, dragDropService: DragDropService, config:DragDropConfig, | ||
private _sortableContainer: SortableContainer, | ||
private _sortableDataService: DragDropSortableService, | ||
constructor(elemRef: ElementRef, dragDropService: DragDropService, config:DragDropConfig, | ||
private _sortableContainer: SortableContainer, | ||
private _sortableDataService: DragDropSortableService, | ||
cdr:ChangeDetectorRef) { | ||
super(elemRef, dragDropService, config, cdr); | ||
@@ -117,2 +119,3 @@ | ||
// console.log('_onDragStartCallback. dragging elem with index ' + this.index); | ||
this._sortableDataService.isDragged = true; | ||
this._sortableDataService.sortableData = this._sortableContainer.sortableData; | ||
@@ -130,3 +133,3 @@ this._sortableDataService.index = this.index; | ||
_onDragOverCallback(event: Event) { | ||
if (this._elem != this._sortableDataService.elem) { | ||
if (this._sortableDataService.isDragged && this._elem != this._sortableDataService.elem) { | ||
// console.log('_onDragOverCallback. dragging elem with index ' + this.index); | ||
@@ -142,2 +145,3 @@ this._sortableDataService.sortableData = this._sortableContainer.sortableData; | ||
// console.log('_onDragEndCallback. end dragging elem with index ' + this.index); | ||
this._sortableDataService.isDragged = false; | ||
this._sortableDataService.sortableData = null; | ||
@@ -155,27 +159,31 @@ this._sortableDataService.index = null; | ||
_onDragEnterCallback(event: Event) { | ||
this._sortableDataService.markSortable(this._elem); | ||
if ((this.index !== this._sortableDataService.index) || | ||
(this._sortableDataService.sortableData != this._sortableContainer.sortableData)) { | ||
// console.log('Component._onDragEnterCallback. drag node [' + this.index + '] over node [' + this._sortableDataService.index + ']'); | ||
// Get item | ||
let item:any = this._sortableDataService.sortableData[this._sortableDataService.index]; | ||
// Remove item from previouse list | ||
this._sortableDataService.sortableData.splice(this._sortableDataService.index, 1); | ||
// Add item to new list | ||
this._sortableContainer.sortableData.splice(this.index, 0, item); | ||
this._sortableDataService.sortableData = this._sortableContainer.sortableData; | ||
this._sortableDataService.index = this.index; | ||
if (this._sortableDataService.isDragged) { | ||
this._sortableDataService.markSortable(this._elem); | ||
if ((this.index !== this._sortableDataService.index) || | ||
(this._sortableDataService.sortableData != this._sortableContainer.sortableData)) { | ||
// console.log('Component._onDragEnterCallback. drag node [' + this.index + '] over node [' + this._sortableDataService.index + ']'); | ||
// Get item | ||
let item:any = this._sortableDataService.sortableData[this._sortableDataService.index]; | ||
// Remove item from previouse list | ||
this._sortableDataService.sortableData.splice(this._sortableDataService.index, 1); | ||
// Add item to new list | ||
this._sortableContainer.sortableData.splice(this.index, 0, item); | ||
this._sortableDataService.sortableData = this._sortableContainer.sortableData; | ||
this._sortableDataService.index = this.index; | ||
} | ||
} | ||
} | ||
_onDropCallback (event: Event) { | ||
// 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); | ||
if (this._sortableDataService.isDragged) { | ||
// 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); | ||
} | ||
// Refresh changes in properties of container component | ||
this._sortableContainer.detectChanges(); | ||
} | ||
// Refresh changes in properties of container component | ||
this._sortableContainer.detectChanges(); | ||
} | ||
} |
@@ -12,16 +12,7 @@ { | ||
}, | ||
"files": [ | ||
"typings/browser.d.ts", | ||
"ng2-dnd.ts", | ||
"./src/dnd.config.ts", | ||
"./src/dnd.service.ts", | ||
"./src/dnd.component.ts", | ||
"./src/dnd.draggable.ts", | ||
"./src/dnd.droppable.ts", | ||
"./src/dnd.sortable.ts", | ||
"./tests/dnd.component.factory.ts", | ||
"./tests/dnd.with.draggable.data.spec.ts", | ||
"./tests/dnd.without.draggable.data.spec.ts", | ||
"./tests/dnd.sortable.spec.ts" | ||
"exclude": [ | ||
"node_modules", | ||
"typings/main.d.ts", | ||
"typings/main" | ||
] | ||
} |
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
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
13
2458
183592
+ Addedreflect-metadata@0.1.2(transitive)
- Removedreflect-metadata@0.1.3(transitive)
Updatedreflect-metadata@0.1.2