You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

90 lines
3.8 KiB

/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { NgZone, OnDestroy } from '@angular/core';
import { Observable, Subject } from 'rxjs';
/**
* Service that keeps track of all the drag item and drop container
* instances, and manages global event listeners on the `document`.
* @docs-private
*/
import * as ɵngcc0 from '@angular/core';
export declare class DragDropRegistry<I extends {
isDragging(): boolean;
}, C> implements OnDestroy {
private _ngZone;
private _document;
/** Registered drop container instances. */
private _dropInstances;
/** Registered drag item instances. */
private _dragInstances;
/** Drag item instances that are currently being dragged. */
private _activeDragInstances;
/** Keeps track of the event listeners that we've bound to the `document`. */
private _globalListeners;
/**
* Predicate function to check if an item is being dragged. Moved out into a property,
* because it'll be called a lot and we don't want to create a new function every time.
*/
private _draggingPredicate;
/**
* Emits the `touchmove` or `mousemove` events that are dispatched
* while the user is dragging a drag item instance.
*/
readonly pointerMove: Subject<TouchEvent | MouseEvent>;
/**
* Emits the `touchend` or `mouseup` events that are dispatched
* while the user is dragging a drag item instance.
*/
readonly pointerUp: Subject<TouchEvent | MouseEvent>;
/**
* Emits when the viewport has been scrolled while the user is dragging an item.
* @deprecated To be turned into a private member. Use the `scrolled` method instead.
* @breaking-change 13.0.0
*/
readonly scroll: Subject<Event>;
constructor(_ngZone: NgZone, _document: any);
/** Adds a drop container to the registry. */
registerDropContainer(drop: C): void;
/** Adds a drag item instance to the registry. */
registerDragItem(drag: I): void;
/** Removes a drop container from the registry. */
removeDropContainer(drop: C): void;
/** Removes a drag item instance from the registry. */
removeDragItem(drag: I): void;
/**
* Starts the dragging sequence for a drag instance.
* @param drag Drag instance which is being dragged.
* @param event Event that initiated the dragging.
*/
startDragging(drag: I, event: TouchEvent | MouseEvent): void;
/** Stops dragging a drag item instance. */
stopDragging(drag: I): void;
/** Gets whether a drag item instance is currently being dragged. */
isDragging(drag: I): boolean;
/**
* Gets a stream that will emit when any element on the page is scrolled while an item is being
* dragged.
* @param shadowRoot Optional shadow root that the current dragging sequence started from.
* Top-level listeners won't pick up events coming from the shadow DOM so this parameter can
* be used to include an additional top-level listener at the shadow root level.
*/
scrolled(shadowRoot?: DocumentOrShadowRoot | null): Observable<Event>;
ngOnDestroy(): void;
/**
* Event listener that will prevent the default browser action while the user is dragging.
* @param event Event whose default action should be prevented.
*/
private _preventDefaultWhileDragging;
/** Event listener for `touchmove` that is bound even if no dragging is happening. */
private _persistentTouchmoveListener;
/** Clears out the global event listeners from the `document`. */
private _clearGlobalListeners;
static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<DragDropRegistry<any, any>, never>;
}
//# sourceMappingURL=drag-drop-registry.d.ts.map