[6a3a178] | 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 | */
|
---|
| 8 | import { NgZone, OnDestroy } from '@angular/core';
|
---|
| 9 | import { Observable, Subject } from 'rxjs';
|
---|
| 10 | /**
|
---|
| 11 | * Service that keeps track of all the drag item and drop container
|
---|
| 12 | * instances, and manages global event listeners on the `document`.
|
---|
| 13 | * @docs-private
|
---|
| 14 | */
|
---|
[fa375fe] | 15 | import * as ɵngcc0 from '@angular/core';
|
---|
[6a3a178] | 16 | export declare class DragDropRegistry<I extends {
|
---|
| 17 | isDragging(): boolean;
|
---|
| 18 | }, C> implements OnDestroy {
|
---|
| 19 | private _ngZone;
|
---|
| 20 | private _document;
|
---|
| 21 | /** Registered drop container instances. */
|
---|
| 22 | private _dropInstances;
|
---|
| 23 | /** Registered drag item instances. */
|
---|
| 24 | private _dragInstances;
|
---|
| 25 | /** Drag item instances that are currently being dragged. */
|
---|
| 26 | private _activeDragInstances;
|
---|
| 27 | /** Keeps track of the event listeners that we've bound to the `document`. */
|
---|
| 28 | private _globalListeners;
|
---|
| 29 | /**
|
---|
| 30 | * Predicate function to check if an item is being dragged. Moved out into a property,
|
---|
| 31 | * because it'll be called a lot and we don't want to create a new function every time.
|
---|
| 32 | */
|
---|
| 33 | private _draggingPredicate;
|
---|
| 34 | /**
|
---|
| 35 | * Emits the `touchmove` or `mousemove` events that are dispatched
|
---|
| 36 | * while the user is dragging a drag item instance.
|
---|
| 37 | */
|
---|
| 38 | readonly pointerMove: Subject<TouchEvent | MouseEvent>;
|
---|
| 39 | /**
|
---|
| 40 | * Emits the `touchend` or `mouseup` events that are dispatched
|
---|
| 41 | * while the user is dragging a drag item instance.
|
---|
| 42 | */
|
---|
| 43 | readonly pointerUp: Subject<TouchEvent | MouseEvent>;
|
---|
| 44 | /**
|
---|
| 45 | * Emits when the viewport has been scrolled while the user is dragging an item.
|
---|
| 46 | * @deprecated To be turned into a private member. Use the `scrolled` method instead.
|
---|
| 47 | * @breaking-change 13.0.0
|
---|
| 48 | */
|
---|
| 49 | readonly scroll: Subject<Event>;
|
---|
| 50 | constructor(_ngZone: NgZone, _document: any);
|
---|
| 51 | /** Adds a drop container to the registry. */
|
---|
| 52 | registerDropContainer(drop: C): void;
|
---|
| 53 | /** Adds a drag item instance to the registry. */
|
---|
| 54 | registerDragItem(drag: I): void;
|
---|
| 55 | /** Removes a drop container from the registry. */
|
---|
| 56 | removeDropContainer(drop: C): void;
|
---|
| 57 | /** Removes a drag item instance from the registry. */
|
---|
| 58 | removeDragItem(drag: I): void;
|
---|
| 59 | /**
|
---|
| 60 | * Starts the dragging sequence for a drag instance.
|
---|
| 61 | * @param drag Drag instance which is being dragged.
|
---|
| 62 | * @param event Event that initiated the dragging.
|
---|
| 63 | */
|
---|
| 64 | startDragging(drag: I, event: TouchEvent | MouseEvent): void;
|
---|
| 65 | /** Stops dragging a drag item instance. */
|
---|
| 66 | stopDragging(drag: I): void;
|
---|
| 67 | /** Gets whether a drag item instance is currently being dragged. */
|
---|
| 68 | isDragging(drag: I): boolean;
|
---|
| 69 | /**
|
---|
| 70 | * Gets a stream that will emit when any element on the page is scrolled while an item is being
|
---|
| 71 | * dragged.
|
---|
| 72 | * @param shadowRoot Optional shadow root that the current dragging sequence started from.
|
---|
| 73 | * Top-level listeners won't pick up events coming from the shadow DOM so this parameter can
|
---|
| 74 | * be used to include an additional top-level listener at the shadow root level.
|
---|
| 75 | */
|
---|
| 76 | scrolled(shadowRoot?: DocumentOrShadowRoot | null): Observable<Event>;
|
---|
| 77 | ngOnDestroy(): void;
|
---|
| 78 | /**
|
---|
| 79 | * Event listener that will prevent the default browser action while the user is dragging.
|
---|
| 80 | * @param event Event whose default action should be prevented.
|
---|
| 81 | */
|
---|
| 82 | private _preventDefaultWhileDragging;
|
---|
| 83 | /** Event listener for `touchmove` that is bound even if no dragging is happening. */
|
---|
| 84 | private _persistentTouchmoveListener;
|
---|
| 85 | /** Clears out the global event listeners from the `document`. */
|
---|
| 86 | private _clearGlobalListeners;
|
---|
[fa375fe] | 87 | static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<DragDropRegistry<any, any>, never>;
|
---|
[6a3a178] | 88 | }
|
---|
[fa375fe] | 89 |
|
---|
| 90 | //# sourceMappingURL=drag-drop-registry.d.ts.map |
---|