[59329aa] | 1 | import { NgModule, Directive, HostListener, Input, Output, EventEmitter } from '@angular/core';
|
---|
| 2 | import { CommonModule } from '@angular/common';
|
---|
| 3 | import { DomHandler } from 'primeng/dom';
|
---|
| 4 | import * as i0 from "@angular/core";
|
---|
| 5 | export class Draggable {
|
---|
| 6 | constructor(el, zone) {
|
---|
| 7 | this.el = el;
|
---|
| 8 | this.zone = zone;
|
---|
| 9 | this.onDragStart = new EventEmitter();
|
---|
| 10 | this.onDragEnd = new EventEmitter();
|
---|
| 11 | this.onDrag = new EventEmitter();
|
---|
| 12 | }
|
---|
| 13 | get pDraggableDisabled() {
|
---|
| 14 | return this._pDraggableDisabled;
|
---|
| 15 | }
|
---|
| 16 | set pDraggableDisabled(_pDraggableDisabled) {
|
---|
| 17 | this._pDraggableDisabled = _pDraggableDisabled;
|
---|
| 18 | if (this._pDraggableDisabled) {
|
---|
| 19 | this.unbindMouseListeners();
|
---|
| 20 | }
|
---|
| 21 | else {
|
---|
| 22 | this.el.nativeElement.draggable = true;
|
---|
| 23 | this.bindMouseListeners();
|
---|
| 24 | }
|
---|
| 25 | }
|
---|
| 26 | ngAfterViewInit() {
|
---|
| 27 | if (!this.pDraggableDisabled) {
|
---|
| 28 | this.el.nativeElement.draggable = true;
|
---|
| 29 | this.bindMouseListeners();
|
---|
| 30 | }
|
---|
| 31 | }
|
---|
| 32 | bindDragListener() {
|
---|
| 33 | if (!this.dragListener) {
|
---|
| 34 | this.zone.runOutsideAngular(() => {
|
---|
| 35 | this.dragListener = this.drag.bind(this);
|
---|
| 36 | this.el.nativeElement.addEventListener('drag', this.dragListener);
|
---|
| 37 | });
|
---|
| 38 | }
|
---|
| 39 | }
|
---|
| 40 | unbindDragListener() {
|
---|
| 41 | if (this.dragListener) {
|
---|
| 42 | this.zone.runOutsideAngular(() => {
|
---|
| 43 | this.el.nativeElement.removeEventListener('drag', this.dragListener);
|
---|
| 44 | this.dragListener = null;
|
---|
| 45 | });
|
---|
| 46 | }
|
---|
| 47 | }
|
---|
| 48 | bindMouseListeners() {
|
---|
| 49 | if (!this.mouseDownListener && !this.mouseUpListener) {
|
---|
| 50 | this.zone.runOutsideAngular(() => {
|
---|
| 51 | this.mouseDownListener = this.mousedown.bind(this);
|
---|
| 52 | this.mouseUpListener = this.mouseup.bind(this);
|
---|
| 53 | this.el.nativeElement.addEventListener('mousedown', this.mouseDownListener);
|
---|
| 54 | this.el.nativeElement.addEventListener('mouseup', this.mouseUpListener);
|
---|
| 55 | });
|
---|
| 56 | }
|
---|
| 57 | }
|
---|
| 58 | unbindMouseListeners() {
|
---|
| 59 | if (this.mouseDownListener && this.mouseUpListener) {
|
---|
| 60 | this.zone.runOutsideAngular(() => {
|
---|
| 61 | this.el.nativeElement.removeEventListener('mousedown', this.mouseDownListener);
|
---|
| 62 | this.el.nativeElement.removeEventListener('mouseup', this.mouseUpListener);
|
---|
| 63 | this.mouseDownListener = null;
|
---|
| 64 | this.mouseUpListener = null;
|
---|
| 65 | });
|
---|
| 66 | }
|
---|
| 67 | }
|
---|
| 68 | drag(event) {
|
---|
| 69 | this.onDrag.emit(event);
|
---|
| 70 | }
|
---|
| 71 | dragStart(event) {
|
---|
| 72 | if (this.allowDrag() && !this.pDraggableDisabled) {
|
---|
| 73 | if (this.dragEffect) {
|
---|
| 74 | event.dataTransfer.effectAllowed = this.dragEffect;
|
---|
| 75 | }
|
---|
| 76 | event.dataTransfer.setData('text', this.scope);
|
---|
| 77 | this.onDragStart.emit(event);
|
---|
| 78 | this.bindDragListener();
|
---|
| 79 | }
|
---|
| 80 | else {
|
---|
| 81 | event.preventDefault();
|
---|
| 82 | }
|
---|
| 83 | }
|
---|
| 84 | dragEnd(event) {
|
---|
| 85 | this.onDragEnd.emit(event);
|
---|
| 86 | this.unbindDragListener();
|
---|
| 87 | }
|
---|
| 88 | mousedown(event) {
|
---|
| 89 | this.handle = event.target;
|
---|
| 90 | }
|
---|
| 91 | mouseup(event) {
|
---|
| 92 | this.handle = null;
|
---|
| 93 | }
|
---|
| 94 | allowDrag() {
|
---|
| 95 | if (this.dragHandle && this.handle)
|
---|
| 96 | return DomHandler.matches(this.handle, this.dragHandle);
|
---|
| 97 | else
|
---|
| 98 | return true;
|
---|
| 99 | }
|
---|
| 100 | ngOnDestroy() {
|
---|
| 101 | this.unbindDragListener();
|
---|
| 102 | this.unbindMouseListeners();
|
---|
| 103 | }
|
---|
| 104 | }
|
---|
| 105 | 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 });
|
---|
| 106 | 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 });
|
---|
| 107 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Draggable, decorators: [{
|
---|
| 108 | type: Directive,
|
---|
| 109 | args: [{
|
---|
| 110 | selector: '[pDraggable]',
|
---|
| 111 | host: {
|
---|
| 112 | 'class': 'p-element'
|
---|
| 113 | }
|
---|
| 114 | }]
|
---|
| 115 | }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { scope: [{
|
---|
| 116 | type: Input,
|
---|
| 117 | args: ['pDraggable']
|
---|
| 118 | }], dragEffect: [{
|
---|
| 119 | type: Input
|
---|
| 120 | }], dragHandle: [{
|
---|
| 121 | type: Input
|
---|
| 122 | }], onDragStart: [{
|
---|
| 123 | type: Output
|
---|
| 124 | }], onDragEnd: [{
|
---|
| 125 | type: Output
|
---|
| 126 | }], onDrag: [{
|
---|
| 127 | type: Output
|
---|
| 128 | }], pDraggableDisabled: [{
|
---|
| 129 | type: Input
|
---|
| 130 | }], dragStart: [{
|
---|
| 131 | type: HostListener,
|
---|
| 132 | args: ['dragstart', ['$event']]
|
---|
| 133 | }], dragEnd: [{
|
---|
| 134 | type: HostListener,
|
---|
| 135 | args: ['dragend', ['$event']]
|
---|
| 136 | }] } });
|
---|
| 137 | export class Droppable {
|
---|
| 138 | constructor(el, zone) {
|
---|
| 139 | this.el = el;
|
---|
| 140 | this.zone = zone;
|
---|
| 141 | this.onDragEnter = new EventEmitter();
|
---|
| 142 | this.onDragLeave = new EventEmitter();
|
---|
| 143 | this.onDrop = new EventEmitter();
|
---|
| 144 | }
|
---|
| 145 | ngAfterViewInit() {
|
---|
| 146 | if (!this.pDroppableDisabled) {
|
---|
| 147 | this.bindDragOverListener();
|
---|
| 148 | }
|
---|
| 149 | }
|
---|
| 150 | bindDragOverListener() {
|
---|
| 151 | if (!this.dragOverListener) {
|
---|
| 152 | this.zone.runOutsideAngular(() => {
|
---|
| 153 | this.dragOverListener = this.dragOver.bind(this);
|
---|
| 154 | this.el.nativeElement.addEventListener('dragover', this.dragOverListener);
|
---|
| 155 | });
|
---|
| 156 | }
|
---|
| 157 | }
|
---|
| 158 | unbindDragOverListener() {
|
---|
| 159 | if (this.dragOverListener) {
|
---|
| 160 | this.zone.runOutsideAngular(() => {
|
---|
| 161 | this.el.nativeElement.removeEventListener('dragover', this.dragOverListener);
|
---|
| 162 | this.dragOverListener = null;
|
---|
| 163 | });
|
---|
| 164 | }
|
---|
| 165 | }
|
---|
| 166 | dragOver(event) {
|
---|
| 167 | event.preventDefault();
|
---|
| 168 | }
|
---|
| 169 | drop(event) {
|
---|
| 170 | if (this.allowDrop(event)) {
|
---|
| 171 | DomHandler.removeClass(this.el.nativeElement, 'p-draggable-enter');
|
---|
| 172 | event.preventDefault();
|
---|
| 173 | this.onDrop.emit(event);
|
---|
| 174 | }
|
---|
| 175 | }
|
---|
| 176 | dragEnter(event) {
|
---|
| 177 | event.preventDefault();
|
---|
| 178 | if (this.dropEffect) {
|
---|
| 179 | event.dataTransfer.dropEffect = this.dropEffect;
|
---|
| 180 | }
|
---|
| 181 | DomHandler.addClass(this.el.nativeElement, 'p-draggable-enter');
|
---|
| 182 | this.onDragEnter.emit(event);
|
---|
| 183 | }
|
---|
| 184 | dragLeave(event) {
|
---|
| 185 | event.preventDefault();
|
---|
| 186 | DomHandler.removeClass(this.el.nativeElement, 'p-draggable-enter');
|
---|
| 187 | this.onDragLeave.emit(event);
|
---|
| 188 | }
|
---|
| 189 | allowDrop(event) {
|
---|
| 190 | let dragScope = event.dataTransfer.getData('text');
|
---|
| 191 | if (typeof (this.scope) == "string" && dragScope == this.scope) {
|
---|
| 192 | return true;
|
---|
| 193 | }
|
---|
| 194 | else if (this.scope instanceof Array) {
|
---|
| 195 | for (let j = 0; j < this.scope.length; j++) {
|
---|
| 196 | if (dragScope == this.scope[j]) {
|
---|
| 197 | return true;
|
---|
| 198 | }
|
---|
| 199 | }
|
---|
| 200 | }
|
---|
| 201 | return false;
|
---|
| 202 | }
|
---|
| 203 | ngOnDestroy() {
|
---|
| 204 | this.unbindDragOverListener();
|
---|
| 205 | }
|
---|
| 206 | }
|
---|
| 207 | 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 });
|
---|
| 208 | 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 });
|
---|
| 209 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Droppable, decorators: [{
|
---|
| 210 | type: Directive,
|
---|
| 211 | args: [{
|
---|
| 212 | selector: '[pDroppable]',
|
---|
| 213 | host: {
|
---|
| 214 | 'class': 'p-element'
|
---|
| 215 | }
|
---|
| 216 | }]
|
---|
| 217 | }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { scope: [{
|
---|
| 218 | type: Input,
|
---|
| 219 | args: ['pDroppable']
|
---|
| 220 | }], pDroppableDisabled: [{
|
---|
| 221 | type: Input
|
---|
| 222 | }], dropEffect: [{
|
---|
| 223 | type: Input
|
---|
| 224 | }], onDragEnter: [{
|
---|
| 225 | type: Output
|
---|
| 226 | }], onDragLeave: [{
|
---|
| 227 | type: Output
|
---|
| 228 | }], onDrop: [{
|
---|
| 229 | type: Output
|
---|
| 230 | }], drop: [{
|
---|
| 231 | type: HostListener,
|
---|
| 232 | args: ['drop', ['$event']]
|
---|
| 233 | }], dragEnter: [{
|
---|
| 234 | type: HostListener,
|
---|
| 235 | args: ['dragenter', ['$event']]
|
---|
| 236 | }], dragLeave: [{
|
---|
| 237 | type: HostListener,
|
---|
| 238 | args: ['dragleave', ['$event']]
|
---|
| 239 | }] } });
|
---|
| 240 | export class DragDropModule {
|
---|
| 241 | }
|
---|
| 242 | DragDropModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: DragDropModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
---|
| 243 | DragDropModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: DragDropModule, declarations: [Draggable, Droppable], imports: [CommonModule], exports: [Draggable, Droppable] });
|
---|
| 244 | DragDropModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: DragDropModule, imports: [[CommonModule]] });
|
---|
| 245 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: DragDropModule, decorators: [{
|
---|
| 246 | type: NgModule,
|
---|
| 247 | args: [{
|
---|
| 248 | imports: [CommonModule],
|
---|
| 249 | exports: [Draggable, Droppable],
|
---|
| 250 | declarations: [Draggable, Droppable]
|
---|
| 251 | }]
|
---|
| 252 | }] });
|
---|
| 253 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHJhZ2Ryb3AuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvYXBwL2NvbXBvbmVudHMvZHJhZ2Ryb3AvZHJhZ2Ryb3AudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFDLFFBQVEsRUFBQyxTQUFTLEVBQW9DLFlBQVksRUFBQyxLQUFLLEVBQUMsTUFBTSxFQUFDLFlBQVksRUFBUSxNQUFNLGVBQWUsQ0FBQztBQUNsSSxPQUFPLEVBQUMsWUFBWSxFQUFDLE1BQU0saUJBQWlCLENBQUM7QUFDN0MsT0FBTyxFQUFDLFVBQVUsRUFBQyxNQUFNLGFBQWEsQ0FBQzs7QUFRdkMsTUFBTSxPQUFPLFNBQVM7SUF3QmxCLFlBQW1CLEVBQWMsRUFBUyxJQUFZO1FBQW5DLE9BQUUsR0FBRixFQUFFLENBQVk7UUFBUyxTQUFJLEdBQUosSUFBSSxDQUFRO1FBaEI1QyxnQkFBVyxHQUFzQixJQUFJLFlBQVksRUFBRSxDQUFDO1FBRXBELGNBQVMsR0FBc0IsSUFBSSxZQUFZLEVBQUUsQ0FBQztRQUVsRCxXQUFNLEdBQXNCLElBQUksWUFBWSxFQUFFLENBQUM7SUFZQSxDQUFDO0lBRTFELElBQWEsa0JBQWtCO1FBQzNCLE9BQU8sSUFBSSxDQUFD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