source: trip-planner-front/node_modules/@angular/cdk/esm2015/drag-drop/drag-drop-registry.js@ bdd6491

Last change on this file since bdd6491 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 31.6 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { Injectable, NgZone, Inject } from '@angular/core';
9import { DOCUMENT } from '@angular/common';
10import { normalizePassiveListenerOptions } from '@angular/cdk/platform';
11import { merge, Observable, Subject } from 'rxjs';
12import * as i0 from "@angular/core";
13import * as i1 from "@angular/common";
14/** Event options that can be used to bind an active, capturing event. */
15const activeCapturingEventOptions = normalizePassiveListenerOptions({
16 passive: false,
17 capture: true
18});
19/**
20 * Service that keeps track of all the drag item and drop container
21 * instances, and manages global event listeners on the `document`.
22 * @docs-private
23 */
24// Note: this class is generic, rather than referencing CdkDrag and CdkDropList directly, in order
25// to avoid circular imports. If we were to reference them here, importing the registry into the
26// classes that are registering themselves will introduce a circular import.
27export class DragDropRegistry {
28 constructor(_ngZone, _document) {
29 this._ngZone = _ngZone;
30 /** Registered drop container instances. */
31 this._dropInstances = new Set();
32 /** Registered drag item instances. */
33 this._dragInstances = new Set();
34 /** Drag item instances that are currently being dragged. */
35 this._activeDragInstances = [];
36 /** Keeps track of the event listeners that we've bound to the `document`. */
37 this._globalListeners = new Map();
38 /**
39 * Predicate function to check if an item is being dragged. Moved out into a property,
40 * because it'll be called a lot and we don't want to create a new function every time.
41 */
42 this._draggingPredicate = (item) => item.isDragging();
43 /**
44 * Emits the `touchmove` or `mousemove` events that are dispatched
45 * while the user is dragging a drag item instance.
46 */
47 this.pointerMove = new Subject();
48 /**
49 * Emits the `touchend` or `mouseup` events that are dispatched
50 * while the user is dragging a drag item instance.
51 */
52 this.pointerUp = new Subject();
53 /**
54 * Emits when the viewport has been scrolled while the user is dragging an item.
55 * @deprecated To be turned into a private member. Use the `scrolled` method instead.
56 * @breaking-change 13.0.0
57 */
58 this.scroll = new Subject();
59 /**
60 * Event listener that will prevent the default browser action while the user is dragging.
61 * @param event Event whose default action should be prevented.
62 */
63 this._preventDefaultWhileDragging = (event) => {
64 if (this._activeDragInstances.length > 0) {
65 event.preventDefault();
66 }
67 };
68 /** Event listener for `touchmove` that is bound even if no dragging is happening. */
69 this._persistentTouchmoveListener = (event) => {
70 if (this._activeDragInstances.length > 0) {
71 // Note that we only want to prevent the default action after dragging has actually started.
72 // Usually this is the same time at which the item is added to the `_activeDragInstances`,
73 // but it could be pushed back if the user has set up a drag delay or threshold.
74 if (this._activeDragInstances.some(this._draggingPredicate)) {
75 event.preventDefault();
76 }
77 this.pointerMove.next(event);
78 }
79 };
80 this._document = _document;
81 }
82 /** Adds a drop container to the registry. */
83 registerDropContainer(drop) {
84 if (!this._dropInstances.has(drop)) {
85 this._dropInstances.add(drop);
86 }
87 }
88 /** Adds a drag item instance to the registry. */
89 registerDragItem(drag) {
90 this._dragInstances.add(drag);
91 // The `touchmove` event gets bound once, ahead of time, because WebKit
92 // won't preventDefault on a dynamically-added `touchmove` listener.
93 // See https://bugs.webkit.org/show_bug.cgi?id=184250.
94 if (this._dragInstances.size === 1) {
95 this._ngZone.runOutsideAngular(() => {
96 // The event handler has to be explicitly active,
97 // because newer browsers make it passive by default.
98 this._document.addEventListener('touchmove', this._persistentTouchmoveListener, activeCapturingEventOptions);
99 });
100 }
101 }
102 /** Removes a drop container from the registry. */
103 removeDropContainer(drop) {
104 this._dropInstances.delete(drop);
105 }
106 /** Removes a drag item instance from the registry. */
107 removeDragItem(drag) {
108 this._dragInstances.delete(drag);
109 this.stopDragging(drag);
110 if (this._dragInstances.size === 0) {
111 this._document.removeEventListener('touchmove', this._persistentTouchmoveListener, activeCapturingEventOptions);
112 }
113 }
114 /**
115 * Starts the dragging sequence for a drag instance.
116 * @param drag Drag instance which is being dragged.
117 * @param event Event that initiated the dragging.
118 */
119 startDragging(drag, event) {
120 // Do not process the same drag twice to avoid memory leaks and redundant listeners
121 if (this._activeDragInstances.indexOf(drag) > -1) {
122 return;
123 }
124 this._activeDragInstances.push(drag);
125 if (this._activeDragInstances.length === 1) {
126 const isTouchEvent = event.type.startsWith('touch');
127 // We explicitly bind __active__ listeners here, because newer browsers will default to
128 // passive ones for `mousemove` and `touchmove`. The events need to be active, because we
129 // use `preventDefault` to prevent the page from scrolling while the user is dragging.
130 this._globalListeners
131 .set(isTouchEvent ? 'touchend' : 'mouseup', {
132 handler: (e) => this.pointerUp.next(e),
133 options: true
134 })
135 .set('scroll', {
136 handler: (e) => this.scroll.next(e),
137 // Use capturing so that we pick up scroll changes in any scrollable nodes that aren't
138 // the document. See https://github.com/angular/components/issues/17144.
139 options: true
140 })
141 // Preventing the default action on `mousemove` isn't enough to disable text selection
142 // on Safari so we need to prevent the selection event as well. Alternatively this can
143 // be done by setting `user-select: none` on the `body`, however it has causes a style
144 // recalculation which can be expensive on pages with a lot of elements.
145 .set('selectstart', {
146 handler: this._preventDefaultWhileDragging,
147 options: activeCapturingEventOptions
148 });
149 // We don't have to bind a move event for touch drag sequences, because
150 // we already have a persistent global one bound from `registerDragItem`.
151 if (!isTouchEvent) {
152 this._globalListeners.set('mousemove', {
153 handler: (e) => this.pointerMove.next(e),
154 options: activeCapturingEventOptions
155 });
156 }
157 this._ngZone.runOutsideAngular(() => {
158 this._globalListeners.forEach((config, name) => {
159 this._document.addEventListener(name, config.handler, config.options);
160 });
161 });
162 }
163 }
164 /** Stops dragging a drag item instance. */
165 stopDragging(drag) {
166 const index = this._activeDragInstances.indexOf(drag);
167 if (index > -1) {
168 this._activeDragInstances.splice(index, 1);
169 if (this._activeDragInstances.length === 0) {
170 this._clearGlobalListeners();
171 }
172 }
173 }
174 /** Gets whether a drag item instance is currently being dragged. */
175 isDragging(drag) {
176 return this._activeDragInstances.indexOf(drag) > -1;
177 }
178 /**
179 * Gets a stream that will emit when any element on the page is scrolled while an item is being
180 * dragged.
181 * @param shadowRoot Optional shadow root that the current dragging sequence started from.
182 * Top-level listeners won't pick up events coming from the shadow DOM so this parameter can
183 * be used to include an additional top-level listener at the shadow root level.
184 */
185 scrolled(shadowRoot) {
186 const streams = [this.scroll];
187 if (shadowRoot && shadowRoot !== this._document) {
188 // Note that this is basically the same as `fromEvent` from rjxs, but we do it ourselves,
189 // because we want to guarantee that the event is bound outside of the `NgZone`. With
190 // `fromEvent` it'll only happen if the subscription is outside the `NgZone`.
191 streams.push(new Observable((observer) => {
192 return this._ngZone.runOutsideAngular(() => {
193 const eventOptions = true;
194 const callback = (event) => {
195 if (this._activeDragInstances.length) {
196 observer.next(event);
197 }
198 };
199 shadowRoot.addEventListener('scroll', callback, eventOptions);
200 return () => {
201 shadowRoot.removeEventListener('scroll', callback, eventOptions);
202 };
203 });
204 }));
205 }
206 return merge(...streams);
207 }
208 ngOnDestroy() {
209 this._dragInstances.forEach(instance => this.removeDragItem(instance));
210 this._dropInstances.forEach(instance => this.removeDropContainer(instance));
211 this._clearGlobalListeners();
212 this.pointerMove.complete();
213 this.pointerUp.complete();
214 }
215 /** Clears out the global event listeners from the `document`. */
216 _clearGlobalListeners() {
217 this._globalListeners.forEach((config, name) => {
218 this._document.removeEventListener(name, config.handler, config.options);
219 });
220 this._globalListeners.clear();
221 }
222}
223DragDropRegistry.ɵprov = i0.ɵɵdefineInjectable({ factory: function DragDropRegistry_Factory() { return new DragDropRegistry(i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i1.DOCUMENT)); }, token: DragDropRegistry, providedIn: "root" });
224DragDropRegistry.decorators = [
225 { type: Injectable, args: [{ providedIn: 'root' },] }
226];
227DragDropRegistry.ctorParameters = () => [
228 { type: NgZone },
229 { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
230];
231//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHJhZy1kcm9wLXJlZ2lzdHJ5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZ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