UNPKG

ngx-tree-dnd

Version:

Angular 7 support tree with drag-and-drop sortable data tree. It`s fast and smart.

2 lines 23.8 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs"),require("@angular/forms"),require("@angular/common"),require("@fortawesome/angular-fontawesome"),require("@fortawesome/fontawesome-svg-core"),require("@fortawesome/free-solid-svg-icons")):"function"==typeof define&&define.amd?define("ngx-tree-dnd",["exports","@angular/core","rxjs","@angular/forms","@angular/common","@fortawesome/angular-fontawesome","@fortawesome/fontawesome-svg-core","@fortawesome/free-solid-svg-icons"],t):t(e["ngx-tree-dnd"]={},e.ng.core,e.rxjs,e.ng.forms,e.ng.common,null,null,null)}(this,function(e,n,i,t,o,r,s,a){"use strict";function v(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}var l=function(){function e(){this.treeStorage=[],this.onDragStart=new i.Subject,this.onDragEnter=new i.Subject,this.onDragLeave=new i.Subject,this.onDrop=new i.Subject,this.onDrag=new i.Subject,this.onAllowDrop=new i.Subject,this.onDragEnd=new i.Subject,this.onAddItem=new i.Subject,this.onRenameItem=new i.Subject,this.onStartRenameItem=new i.Subject,this.onFinishRenameItem=new i.Subject,this.onStartDeleteItem=new i.Subject,this.onFinishDeleteItem=new i.Subject,this.onCancelDeleteItem=new i.Subject,this.config=new i.BehaviorSubject(null),this.defaulConfig={showActionButtons:!0,showAddButtons:!0,showRenameButtons:!0,showDeleteButtons:!0,showRootActionButtons:!0,enableExpandButtons:!0,enableDragging:!0,rootTitle:"Root",validationText:"Enter valid name",minCharacterLength:1,setItemsAsLinks:!1,setFontSize:16,setIconSize:14}}return e.prototype.getLocalData=function(t){var n=this;return new i.Observable(function(e){n.treeStorage=t,n.treeStorage&&null!==n.treeStorage||(n.treeStorage=JSON.parse("[]")),e.next(n.treeStorage)})},e.prototype.elementFinder=function(e,t,n){var i,o;try{for(var r=v(e),s=r.next();!s.done;s=r.next()){var a=s.value;if(a.id===t){this.findingResults={foundItem:a,itemsList:e},n&&(this.findingResults.parentItem=n);break}0<a.childrens.length&&this.elementFinder(a.childrens,t,a)}}catch(l){i={error:l}}finally{try{s&&!s.done&&(o=r["return"])&&o.call(r)}finally{if(i)throw i.error}}},e.prototype.addNewItem=function(e,t,n){var i=1;if(n&&0!==n.childrens.length){var o=n.childrens.length-1;i=n.childrens[o].options.position+1}var r={id:e,name:t,options:{position:i,edit:!0},childrens:[]};null!=n?(this.elementFinder(this.treeStorage,n?n.id:null),this.findingResults&&this.findingResults.foundItem.childrens.push(r)):this.treeStorage.push(r);var s={element:r,parent:n?this.findingResults.foundItem:"root"};this.onAddItem.next(s),this.clearAction()},e.prototype.deleteItem=function(e){this.elementFinder(this.treeStorage,e);var t,n={element:this.findingResults.foundItem,parent:this.findingResults.parentItem||"root"};if(this.onStartDeleteItem.next(n),t=this.findingResults.foundItem.name?"Do you really want to delete '"+this.findingResults.foundItem.name+"'?":"Cancel creating a new item?",confirm(t)){this.onFinishDeleteItem.next(n);var i=this.findingResults.itemsList.indexOf(this.findingResults.foundItem);this.findingResults.itemsList.splice(i,1)}else this.onCancelDeleteItem.next(n);this.clearAction()},e.prototype.startRenameItem=function(e){this.elementFinder(this.treeStorage,e.id);var t={element:this.findingResults.foundItem,parent:this.findingResults.parentItem||"root"};this.onStartRenameItem.next(t)},e.prototype.finishRenameItem=function(e,t){this.elementFinder(this.treeStorage,t),this.findingResults.foundItem.name=e,this.findingResults.foundItem.options.edit=!1;var n={element:this.findingResults.foundItem,parent:this.findingResults.parentItem||"root"};this.onFinishRenameItem.next(n),this.clearAction()},e.prototype.startDragging=function(e){this.switchDropButton(!0,this.treeStorage),this.onDragStart.next(e)},e.prototype.onDragProcess=function(e){this.onDrag.next(e)},e.prototype.dragEndAction=function(e){this.removeDestenationBorders(this.treeStorage),this.switchDropButton(!1,this.treeStorage),this.onDragEnd.next(e)},e.prototype.enterDropZone=function(e){this.onDragEnter.next(e)},e.prototype.onDragOver=function(e){var t=e.target;if(t&&t.id!==this.isDragging.id){var n=e.event.toElement.offsetHeight/2;e.event.offsetY<n?(t.options.destenationBottom=!1,t.options.destenationTop=!0):(t.options.destenationBottom=!0,t.options.destenationTop=!1),this.onAllowDrop.next(e)}},e.prototype.leaveDropZone=function(e){this.removeDestenationBorders(this.treeStorage),this.onDragLeave.next(e)},e.prototype.onDropItem=function(e){if(e.target){var t=e.event.toElement.offsetHeight/2;e.event.offsetY<t?this.changeItemPosition(e.target,"up"):this.changeItemPosition(e.target,"down"),this.onDrop.next(e)}else{var n=parseInt(e.event.target.getAttribute("data-id"),null);this.elementFinder(this.treeStorage,this.isDragging.id);var i=this.findingResults.itemsList.indexOf(this.findingResults.foundItem),o=this.findingResults.itemsList.splice(i,1)[0];this.elementFinder(this.treeStorage,n),this.findingResults.foundItem.childrens.push(o),e.target=this.findingResults.foundItem,this.onDrop.next(e)}this.removeDestenationBorders(this.treeStorage),this.switchDropButton(!1,this.treeStorage),this.clearAction()},e.prototype.changeItemPosition=function(f,h){var g=this;setTimeout(function(){var e,t,n,i;g.elementFinder(g.treeStorage,g.isDragging.id);var o=g.findingResults.itemsList.indexOf(g.findingResults.foundItem),r=g.findingResults.itemsList.splice(o,1)[0],s=f.options.position;if(g.elementFinder(g.treeStorage,f.id),"up"===h)try{for(var a=v(g.findingResults.itemsList),l=a.next();!l.done;l=a.next()){(u=l.value).options.position>=s&&(u.options.position=u.options.position+1,r.options.position=s)}}catch(p){e={error:p}}finally{try{l&&!l.done&&(t=a["return"])&&t.call(a)}finally{if(e)throw e.error}}else try{for(var c=v(g.findingResults.itemsList),d=c.next();!d.done;d=c.next()){var u;(u=d.value).options.position<=s&&(u.options.position=u.options.position-1)}}catch(m){n={error:m}}finally{try{d&&!d.done&&(i=c["return"])&&i.call(c)}finally{if(n)throw n.error}}r.options.position=s,g.findingResults.itemsList.push(r),g.sortTree()})},e.prototype.getItemPosition=function(e){this.elementFinder(this.treeStorage,e.id);var t=this.findingResults.itemsList.indexOf(this.findingResults.foundItem);return++t},e.prototype.sortTree=function(){this.sortElements(this.treeStorage)},e.prototype.sortElements=function(e){var t,n;e.sort(this.compate);try{for(var i=v(e),o=i.next();!o.done;o=i.next()){var r=o.value;0<r.childrens.length&&this.sortElements(r.childrens)}}catch(s){t={error:s}}finally{try{o&&!o.done&&(n=i["return"])&&n.call(i)}finally{if(t)throw t.error}}},e.prototype.compate=function(e,t){return e.options.position<t.options.position?-1:e.options.position>t.options.position?1:0},e.prototype.clearAction=function(){this.findingResults=null},e.prototype.removeDestenationBorders=function(e){var t,n;try{for(var i=v(e),o=i.next();!o.done;o=i.next()){var r=o.value;r.options.destenationBottom=!1,r.options.destenationTop=!1,0<r.childrens.length&&this.removeDestenationBorders(r.childrens)}}catch(s){t={error:s}}finally{try{o&&!o.done&&(n=i["return"])&&n.call(i)}finally{if(t)throw t.error}}},e.prototype.switchDropButton=function(e,t){var n,i;try{for(var o=v(t),r=o.next();!r.done;r=o.next()){var s=r.value;s.options.showActionButtons=!e,s.id!==this.isDragging.id&&(s.options.showDropChildZone=e),0<s.childrens.length&&this.switchDropButton(e,s.childrens)}}catch(a){n={error:a}}finally{try{r&&!r.done&&(i=o["return"])&&i.call(o)}finally{if(n)throw n.error}}},e.decorators=[{type:n.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[]},e.ngInjectableDef=n.defineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}(),c=function(){function e(e,t){this.treeService=e,this.fb=t,this.userConfig={showActionButtons:!0,showAddButtons:!0,showRenameButtons:!0,showDeleteButtons:!0,showRootActionButtons:!0,enableExpandButtons:!0,enableDragging:!0,rootTitle:"Root",options:{edit:!1},validationText:"Enter valid name",minCharacterLength:1,setItemsAsLinks:!1,setFontSize:16,setIconSize:14},this.ondragstart=new n.EventEmitter,this.ondragenter=new n.EventEmitter,this.ondragleave=new n.EventEmitter,this.ondrop=new n.EventEmitter,this.onallowdrop=new n.EventEmitter,this.ondragend=new n.EventEmitter,this.onadditem=new n.EventEmitter,this.onStartRenameItem=new n.EventEmitter,this.onFinishRenameItem=new n.EventEmitter,this.onStartDeleteItem=new n.EventEmitter,this.onFinishDeleteItem=new n.EventEmitter,this.onCancelDeleteItem=new n.EventEmitter,this.enableSubscribers(),this.createForm()}return Object.defineProperty(e.prototype,"config",{set:function(e){Object.seal(this.userConfig);try{this.setConfig(e),this.treeService.config.next(this.userConfig)}catch(t){console.log("Config is invalid! Default configuragion will be appeared"),this.treeService.config.next(this.treeService.defaulConfig)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"treeData",{set:function(e){this.getTreeData(e)},enumerable:!0,configurable:!0}),e.prototype.setConfig=function(e){var t,n;try{for(var i=v(Object.keys(e)),o=i.next();!o.done;o=i.next()){var r=o.value;this.setValue(r,e)}}catch(s){t={error:s}}finally{try{o&&!o.done&&(n=i["return"])&&n.call(i)}finally{if(t)throw t.error}}this.renameForm.patchValue({name:this.userConfig.rootTitle})},e.prototype.setValue=function(e,t){this.userConfig[e]=t[e]},e.prototype.enableSubscribers=function(){var t=this;this.treeService.onDrop.subscribe(function(e){t.ondrop.emit(e)}),this.treeService.onDragStart.subscribe(function(e){t.ondragstart.emit(e)}),this.treeService.onAllowDrop.subscribe(function(e){t.onallowdrop.emit(e)}),this.treeService.onDragEnd.subscribe(function(e){t.ondragend.emit(e)}),this.treeService.onAddItem.subscribe(function(e){t.onadditem.emit(e)}),this.treeService.onStartRenameItem.subscribe(function(e){t.onStartRenameItem.emit(e)}),this.treeService.onFinishRenameItem.subscribe(function(e){t.onFinishRenameItem.emit(e)}),this.treeService.onStartDeleteItem.subscribe(function(e){t.onStartDeleteItem.emit(e)}),this.treeService.onFinishDeleteItem.subscribe(function(e){t.onFinishDeleteItem.emit(e)}),this.treeService.onCancelDeleteItem.subscribe(function(e){t.onCancelDeleteItem.emit(e)}),this.treeService.onDragEnter.subscribe(function(e){t.ondragenter.emit(e)}),this.treeService.onDragLeave.subscribe(function(e){t.ondragleave.emit(e)})},e.prototype.getTreeData=function(e){var t=this;this.treeService.getLocalData(e).subscribe(function(e){t.treeView=e,setTimeout(function(){t.treeService.sortTree()})},function(e){console.log(e)})},e.prototype.createForm=function(){this.renameForm=this.fb.group({name:[this.userConfig.rootTitle||"",[t.Validators.required,t.Validators.minLength(this.userConfig.minCharacterLength)]]})},e.prototype.enableRootRenameMode=function(){this.userConfig.options.edit=!0},e.prototype.submitAdd=function(e){var t=""+(new Date).getFullYear()+(new Date).getDay()+(new Date).getTime(),n=parseInt(t,null);this.treeService.addNewItem(n,e,null)},e.prototype.submitRootRename=function(){this.renameForm.valid?(this.showError=!1,this.userConfig.rootTitle=this.renameForm.value.name,this.userConfig.options.edit=!1):this.showError=!0},e.prototype.ngAfterViewInit=function(){},e.decorators=[{type:n.Component,args:[{selector:"lib-ngx-tree-component",template:"<div id='threeWrapper' *ngIf=\"treeView\" [style.font-size.px]='userConfig.setFontSize'>\n <div class='root-title d-inline-flex pos-relative' *ngIf=\"!userConfig.options.edit;else onEdit\">\n <div class='root-text'>\n {{userConfig.rootTitle}}\n </div>\n \n <div class='d-flex buttons-bar' *ngIf=\"userConfig.showActionButtons && userConfig.showRootActionButtons\">\n <div class='d-flex'>\n <button class=\"tree-btn add-btn\" *ngIf=\"userConfig.showAddButtons\" (click)=\"submitAdd(null)\">\n <fa-icon icon=\"plus\" [style.font-size.px]='userConfig.setIconSize'></fa-icon>\n </button>\n </div>\n <div class='d-flex'>\n <button class=\"tree-btn edit-btn\" *ngIf=\"userConfig.showRenameButtons\" (click)=\"enableRootRenameMode()\">\n <fa-icon icon=\"edit\" [style.font-size.px]='userConfig.setIconSize'></fa-icon>\n </button>\n </div>\n </div>\n </div>\n <ng-template #onEdit>\n <div class='d-inline-flex'>\n <form [formGroup]=\"renameForm\" class='d-flex' (submit)='submitRootRename()'>\n <input type=\"text\" class='input-rename' formControlName=\"name\" libAutoFocus=\"true\" [style.font-size.px]='userConfig.setFontSize'>\n </form>\n <div class='d-flex'>\n <button class='tree-btn submit-btn' (click)='submitRootRename()'>\n <fa-icon icon=\"check\" [style.font-size.px]='userConfig.setIconSize'></fa-icon>\n </button>\n <div class='error-edit-wrap' *ngIf=\"showError\">\n {{userConfig.validationText}}\n </div>\n </div>\n </div>\n </ng-template>\n <div class='tree-child'>\n <div class=\"tree-content-main\">\n <lib-ngx-tree-children [setItem]=\"clild\" *ngFor='let clild of treeView'></lib-ngx-tree-children>\n </div>\n </div>\n </div>"}]}],e.ctorParameters=function(){return[{type:l},{type:t.FormBuilder}]},e.propDecorators={ondragstart:[{type:n.Output}],ondragenter:[{type:n.Output}],ondragleave:[{type:n.Output}],ondrop:[{type:n.Output}],onallowdrop:[{type:n.Output}],ondragend:[{type:n.Output}],onadditem:[{type:n.Output}],onStartRenameItem:[{type:n.Output}],onFinishRenameItem:[{type:n.Output}],onStartDeleteItem:[{type:n.Output}],onFinishDeleteItem:[{type:n.Output}],onCancelDeleteItem:[{type:n.Output}],config:[{type:n.Input}],treeData:[{type:n.Input}]},e}(),d=function(){function e(e,t){this.treeService=e,this.fb=t}return Object.defineProperty(e.prototype,"setItem",{set:function(e){this.element=e,this.itemOptions={href:"#",hidden:!1,hideChildrens:!1,position:this.treeService.getItemPosition(this.element),draggable:!0,edit:!1,showActionButtons:!0,currentlyDragging:!1,destenationTop:!1,destenationBottom:!1,disabled:!1,showExpandButton:!0,showDeleteButton:!0},this.element.options&&this.setOptions(this.element.options),this.element.options=this.itemOptions,this.enableSubscribers(),this.createForm()},enumerable:!0,configurable:!0}),e.prototype.enableSubscribers=function(){var t=this;this.treeService.config.subscribe(function(e){t.config=null!==e?e:t.treeService.defaulConfig,t.element.options.draggable&&(t.element.options.draggable=t.config.enableDragging)})},e.prototype.setOptions=function(e){var t,n;try{for(var i=v(Object.keys(e)),o=i.next();!o.done;o=i.next()){var r=o.value;this.setValue(r,e)}}catch(s){t={error:s}}finally{try{o&&!o.done&&(n=i["return"])&&n.call(i)}finally{if(t)throw t.error}}},e.prototype.setValue=function(e,t){this.itemOptions[e]=t[e]},e.prototype.createForm=function(){this.renameForm=this.fb.group({name:[this.element.name||"",[t.Validators.required,t.Validators.minLength(this.config.minCharacterLength)]]})},e.prototype.enableRenameMode=function(e){e.options.edit=!0,this.treeService.startRenameItem(e)},e.prototype.submitAdd=function(e,t){var n=""+(new Date).getFullYear()+(new Date).getDay()+(new Date).getTime(),i=parseInt(n,null);this.treeService.addNewItem(i,e,t),this.element.options.hideChildrens=!1},e.prototype.submitRename=function(e){this.renameForm.valid?(this.showError=!1,this.treeService.finishRenameItem(this.renameForm.value.name,e.id),this.element.options.edit=!1):this.showError=!0},e.prototype.onSubmitDelete=function(e){this.element.options.edit?null===e.name?this.treeService.deleteItem(e.id):this.element.options.edit=!1:this.treeService.deleteItem(e.id)},e.prototype.ngAfterViewInit=function(){},e.decorators=[{type:n.Component,args:[{selector:"lib-ngx-tree-children",template:"<div class='tree-child' id={{element.id}} libDragElement [draggableValue]='element.options.draggable' [item]='element' [ngClass]=\"{disabled : element.options.disabled}\">\n <div *ngIf=\"element && element.options\" class='d-flex'>\n <div *ngIf='config' [ngClass]=\"{hidden : element.options.hidden}\">\n <div class='tree-title d-inline-flex pos-relative' [ngClass]=\"{destenationTop : element.options.destenationTop, destenationBottom: element.options.destenationBottom}\" *ngIf=\"!element.options.edit;else onEdit\">\n <div *ngIf=\"!config.setItemsAsLinks; else link\" [ngClass]=\"{addOpacity : element.options.currentlyDragging}\" libDropElement\n [item]='element' class='draggable-item'>\n {{element.name}}\n </div>\n <ng-template #link>\n <div [ngClass]=\"{addOpacity : element.options.currentlyDragging}\" libDropElement\n [item]='element' class='draggable-item'>\n <a [href]=\"element.options.href\" class='tree-link'>{{element.name}}</a>\n </div>\n </ng-template>\n <div class='d-flex buttons-bar' *ngIf=\"config.showActionButtons && element.options.showActionButtons && !element.options.disabled\">\n <div class='d-flex'>\n <button class=\"tree-btn add-btn\" *ngIf=\"config.showAddButtons\" (click)=\"submitAdd(null, element)\">\n <fa-icon icon=\"plus\" [style.font-size.px]='config.setIconSize'></fa-icon>\n </button>\n </div>\n <div class='d-flex'>\n <button class=\"tree-btn edit-btn\" *ngIf=\"config.showRenameButtons\" (click)=\"enableRenameMode(element)\">\n <fa-icon icon=\"edit\" [style.font-size.px]='config.setIconSize'></fa-icon>\n </button>\n </div>\n <div class='d-flex'>\n <button class=\"tree-btn delete-btn\" *ngIf=\"config.showDeleteButtons && element.options.showDeleteButton\" (click)=\"onSubmitDelete( element )\">\n <fa-icon icon=\"times\" [style.font-size.px]='config.setIconSize'></fa-icon>\n </button>\n </div>\n </div>\n <div class='child-drop-place' [attr.data-id]='element.id' libDropElement *ngIf='element.options.showDropChildZone && !element.options.disabled'>\n <fa-icon icon=\"arrow-down\" [style.font-size.px]='config.setIconSize'></fa-icon>\n </div>\n <div class='show-hide-switch' *ngIf=\"config.enableExpandButtons && element.options.showExpandButton && element.childrens.length > 0 && !element.options.disabled\">\n <div *ngIf=\"element.options.hideChildrens; else visible\">\n <button class='tree-btn show-btn' (click)='element.options.hideChildrens = false'>\n <fa-icon icon=\"plus\" [style.font-size.px]='config.setIconSize'></fa-icon>\n </button>\n </div>\n <ng-template #visible>\n <button class='tree-btn hide-btn' (click)='element.options.hideChildrens = true'>\n <fa-icon icon=\"minus\" [style.font-size.px]='config.setIconSize'></fa-icon>\n </button>\n </ng-template>\n </div>\n </div>\n <ng-template #onEdit>\n <div class='tree-title d-inline-flex'>\n <form [formGroup]=\"renameForm\" class='d-flex' (submit)='submitRename(element)'>\n <input type=\"text\" class='input-rename' formControlName=\"name\" libAutoFocus=\"true\" [style.font-size.px]='config.setFontSize'>\n </form>\n <div class='d-flex'>\n <button class='tree-btn submit-btn' (click)='submitRename(element)'>\n <fa-icon icon=\"check\" [style.font-size.px]='config.setIconSize'></fa-icon>\n </button>\n <button class='tree-btn delete-btn' (click)='onSubmitDelete(element)'>\n <fa-icon icon=\"times\" [style.font-size.px]='config.setIconSize'></fa-icon>\n </button>\n <div class='error-edit-wrap' *ngIf=\"showError\">\n {{config.validationText}}\n </div>\n </div>\n </div>\n </ng-template>\n <div class=\"tree-content\" *ngIf=\"element.childrens && !element.options.hideChildrens\">\n <lib-ngx-tree-children [setItem]=\"child\" *ngFor='let child of element.childrens'></lib-ngx-tree-children>\n </div>\n </div>\n </div>\n</div>\n"}]}],e.ctorParameters=function(){return[{type:l},{type:t.FormBuilder}]},e.propDecorators={setItem:[{type:n.Input}]},e}(),u=function(){function e(e){this.el=e,this.focus=!0}return e.prototype.ngOnInit=function(){var e=this;this.focus&&window.setTimeout(function(){e.el.nativeElement.focus()})},Object.defineProperty(e.prototype,"autofocus",{set:function(e){this.focus=!1!==e},enumerable:!0,configurable:!0}),e.decorators=[{type:n.Directive,args:[{selector:"[libAutoFocus]"}]}],e.ctorParameters=function(){return[{type:n.ElementRef}]},e.propDecorators={autofocus:[{type:n.Input}]},e}(),p=function(){function e(e,t){this.el=e,this.treeService=t}return Object.defineProperty(e.prototype,"draggable",{get:function(){return this.draggableValue},enumerable:!0,configurable:!0}),e.prototype.onDragStart=function(e){var t={event:e,target:this.item};this.treeService.isDragging=this.item,this.treeService.lastExpandState=this.item.options.hideChildrens,this.item.options.hideChildrens=!0,this.item.options.currentlyDragging=!0,this.treeService.startDragging(t),e.stopPropagation()},e.prototype.onDrag=function(e){var t={event:e,target:this.item};this.treeService.onDragProcess(t)},e.prototype.onDragEnd=function(e){var t={event:e,target:this.item};this.item.options.hideChildrens=this.treeService.lastExpandState,this.item.options.currentlyDragging=!1,this.treeService.dragEndAction(t),e.stopPropagation()},e.decorators=[{type:n.Directive,args:[{selector:"[libDragElement]"}]}],e.ctorParameters=function(){return[{type:n.ElementRef},{type:l}]},e.propDecorators={item:[{type:n.Input}],draggableValue:[{type:n.Input}],draggable:[{type:n.HostBinding,args:["draggable"]}],onDragStart:[{type:n.HostListener,args:["dragstart",["$event"]]}],onDrag:[{type:n.HostListener,args:["drag",["$event"]]}],onDragEnd:[{type:n.HostListener,args:["dragend",["$event"]]}]},e}(),m=function(){function e(e,t){this.el=e,this.treeService=t,this.drop=new n.EventEmitter}return e.prototype.onDragOver=function(e){var t={event:e,target:this.item};this.treeService.onDragOver(t),e.preventDefault()},e.prototype.onDrop=function(e){var t=this.treeService.isDragging,n={event:e,target:this.item};t.options.hideChildrens=this.treeService.lastExpandState,t.options.currentlyDragging=!1,t!==n.target&&this.treeService.onDropItem(n),e.preventDefault()},e.prototype.onDragEnter=function(e){var t={event:e,target:this.item};this.treeService.enterDropZone(t)},e.prototype.onDragLeave=function(e){var t={event:e,target:this.item};this.treeService.leaveDropZone(t)},e.decorators=[{type:n.Directive,args:[{selector:"[libDropElement]"}]}],e.ctorParameters=function(){return[{type:n.ElementRef},{type:l}]},e.propDecorators={item:[{type:n.Input}],drop:[{type:n.Output}],onDragOver:[{type:n.HostListener,args:["dragover",["$event"]]}],onDrop:[{type:n.HostListener,args:["drop",["$event"]]}],onDragEnter:[{type:n.HostListener,args:["dragenter",["$event"]]}],onDragLeave:[{type:n.HostListener,args:["dragleave",["$event"]]}]},e}();s.library.add(a.faCoffee,a.faPlus,a.faEdit,a.faMinus,a.faTimes,a.faCheck,a.faArrowDown);var f=function(){function e(){}return e.decorators=[{type:n.NgModule,args:[{imports:[o.CommonModule,t.ReactiveFormsModule,r.FontAwesomeModule],declarations:[u,p,m,c,d],exports:[u,p,m,c,d]}]}],e}();e.NgxTreeService=l,e.NgxTreeParentComponent=c,e.NgxTreeChildrenComponent=d,e.AutoFocusDirective=u,e.DragElementsDirective=p,e.DropElementsDirective=m,e.NgxTreeDndModule=f,Object.defineProperty(e,"__esModule",{value:!0})}); //# sourceMappingURL=ngx-tree-dnd.umd.min.js.map