import { NgModule, Directive, HostListener, Input, Output, EventEmitter } from '@angular/core'; import { CommonModule } from '@angular/common'; import { DomHandler } from 'primeng/dom'; import * as i0 from "@angular/core"; export class Draggable { constructor(el, zone) { this.el = el; this.zone = zone; this.onDragStart = new EventEmitter(); this.onDragEnd = new EventEmitter(); this.onDrag = new EventEmitter(); } get pDraggableDisabled() { return this._pDraggableDisabled; } set pDraggableDisabled(_pDraggableDisabled) { this._pDraggableDisabled = _pDraggableDisabled; if (this._pDraggableDisabled) { this.unbindMouseListeners(); } else { this.el.nativeElement.draggable = true; this.bindMouseListeners(); } } ngAfterViewInit() { if (!this.pDraggableDisabled) { this.el.nativeElement.draggable = true; this.bindMouseListeners(); } } bindDragListener() { if (!this.dragListener) { this.zone.runOutsideAngular(() => { this.dragListener = this.drag.bind(this); this.el.nativeElement.addEventListener('drag', this.dragListener); }); } } unbindDragListener() { if (this.dragListener) { this.zone.runOutsideAngular(() => { this.el.nativeElement.removeEventListener('drag', this.dragListener); this.dragListener = null; }); } } bindMouseListeners() { if (!this.mouseDownListener && !this.mouseUpListener) { this.zone.runOutsideAngular(() => { this.mouseDownListener = this.mousedown.bind(this); this.mouseUpListener = this.mouseup.bind(this); this.el.nativeElement.addEventListener('mousedown', this.mouseDownListener); this.el.nativeElement.addEventListener('mouseup', this.mouseUpListener); }); } } unbindMouseListeners() { if (this.mouseDownListener && this.mouseUpListener) { this.zone.runOutsideAngular(() => { this.el.nativeElement.removeEventListener('mousedown', this.mouseDownListener); this.el.nativeElement.removeEventListener('mouseup', this.mouseUpListener); this.mouseDownListener = null; this.mouseUpListener = null; }); } } drag(event) { this.onDrag.emit(event); } dragStart(event) { if (this.allowDrag() && !this.pDraggableDisabled) { if (this.dragEffect) { event.dataTransfer.effectAllowed = this.dragEffect; } event.dataTransfer.setData('text', this.scope); this.onDragStart.emit(event); this.bindDragListener(); } else { event.preventDefault(); } } dragEnd(event) { this.onDragEnd.emit(event); this.unbindDragListener(); } mousedown(event) { this.handle = event.target; } mouseup(event) { this.handle = null; } allowDrag() { if (this.dragHandle && this.handle) return DomHandler.matches(this.handle, this.dragHandle); else return true; } ngOnDestroy() { this.unbindDragListener(); this.unbindMouseListeners(); } } Draggable.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Draggable, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); Draggable.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.0", type: Draggable, selector: "[pDraggable]", inputs: { scope: ["pDraggable", "scope"], dragEffect: "dragEffect", dragHandle: "dragHandle", pDraggableDisabled: "pDraggableDisabled" }, outputs: { onDragStart: "onDragStart", onDragEnd: "onDragEnd", onDrag: "onDrag" }, host: { listeners: { "dragstart": "dragStart($event)", "dragend": "dragEnd($event)" }, classAttribute: "p-element" }, ngImport: i0 }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Draggable, decorators: [{ type: Directive, args: [{ selector: '[pDraggable]', host: { 'class': 'p-element' } }] }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { scope: [{ type: Input, args: ['pDraggable'] }], dragEffect: [{ type: Input }], dragHandle: [{ type: Input }], onDragStart: [{ type: Output }], onDragEnd: [{ type: Output }], onDrag: [{ type: Output }], pDraggableDisabled: [{ type: Input }], dragStart: [{ type: HostListener, args: ['dragstart', ['$event']] }], dragEnd: [{ type: HostListener, args: ['dragend', ['$event']] }] } }); export class Droppable { constructor(el, zone) { this.el = el; this.zone = zone; this.onDragEnter = new EventEmitter(); this.onDragLeave = new EventEmitter(); this.onDrop = new EventEmitter(); } ngAfterViewInit() { if (!this.pDroppableDisabled) { this.bindDragOverListener(); } } bindDragOverListener() { if (!this.dragOverListener) { this.zone.runOutsideAngular(() => { this.dragOverListener = this.dragOver.bind(this); this.el.nativeElement.addEventListener('dragover', this.dragOverListener); }); } } unbindDragOverListener() { if (this.dragOverListener) { this.zone.runOutsideAngular(() => { this.el.nativeElement.removeEventListener('dragover', this.dragOverListener); this.dragOverListener = null; }); } } dragOver(event) { event.preventDefault(); } drop(event) { if (this.allowDrop(event)) { DomHandler.removeClass(this.el.nativeElement, 'p-draggable-enter'); event.preventDefault(); this.onDrop.emit(event); } } dragEnter(event) { event.preventDefault(); if (this.dropEffect) { event.dataTransfer.dropEffect = this.dropEffect; } DomHandler.addClass(this.el.nativeElement, 'p-draggable-enter'); this.onDragEnter.emit(event); } dragLeave(event) { event.preventDefault(); DomHandler.removeClass(this.el.nativeElement, 'p-draggable-enter'); this.onDragLeave.emit(event); } allowDrop(event) { let dragScope = event.dataTransfer.getData('text'); if (typeof (this.scope) == "string" && dragScope == this.scope) { return true; } else if (this.scope instanceof Array) { for (let j = 0; j < this.scope.length; j++) { if (dragScope == this.scope[j]) { return true; } } } return false; } ngOnDestroy() { this.unbindDragOverListener(); } } Droppable.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Droppable, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); Droppable.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.0", type: Droppable, selector: "[pDroppable]", inputs: { scope: ["pDroppable", "scope"], pDroppableDisabled: "pDroppableDisabled", dropEffect: "dropEffect" }, outputs: { onDragEnter: "onDragEnter", onDragLeave: "onDragLeave", onDrop: "onDrop" }, host: { listeners: { "drop": "drop($event)", "dragenter": "dragEnter($event)", "dragleave": "dragLeave($event)" }, classAttribute: "p-element" }, ngImport: i0 }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Droppable, decorators: [{ type: Directive, args: [{ selector: '[pDroppable]', host: { 'class': 'p-element' } }] }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { scope: [{ type: Input, args: ['pDroppable'] }], pDroppableDisabled: [{ type: Input }], dropEffect: [{ type: Input }], onDragEnter: [{ type: Output }], onDragLeave: [{ type: Output }], onDrop: [{ type: Output }], drop: [{ type: HostListener, args: ['drop', ['$event']] }], dragEnter: [{ type: HostListener, args: ['dragenter', ['$event']] }], dragLeave: [{ type: HostListener, args: ['dragleave', ['$event']] }] } }); export class DragDropModule { } DragDropModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: DragDropModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); DragDropModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: DragDropModule, declarations: [Draggable, Droppable], imports: [CommonModule], exports: [Draggable, Droppable] }); DragDropModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: DragDropModule, imports: [[CommonModule]] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: DragDropModule, decorators: [{ type: NgModule, args: [{ imports: [CommonModule], exports: [Draggable, Droppable], declarations: [Draggable, Droppable] }] }] }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHJhZ2Ryb3AuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvYXBwL2NvbXBvbmVudHMvZHJhZ2Ryb3AvZHJhZ2Ryb3AudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFDLFFBQVEsRUFBQyxTQUFTLEVBQW9DLFlBQVksRUFBQyxLQUFLLEVBQUMsTUFBTSxFQUFDLFlBQVksRUFBUSxNQUFNLGVBQWUsQ0FBQztBQUNsSSxPQUFPLEVBQUMsWUFBWSxFQUFDLE1BQU0saUJBQWlCLENBQUM7QUFDN0MsT0FBTyxFQUFDLFVBQVUsRUFBQyx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