UNPKG

@igor2017/sat-popover

Version:
93 lines 4.36 kB
import { ElementRef, NgZone, OnDestroy, ViewContainerRef } from '@angular/core'; import { Overlay, OverlayRef } from '@angular/cdk/overlay'; import { Directionality } from '@angular/cdk/bidi'; import { Subject } from 'rxjs'; import { SatPopover } from './popover.component'; import { SatPopoverOpenOptions } from './types'; import * as i0 from "@angular/core"; export declare class SatPopoverAnchoringService implements OnDestroy { private _overlay; private _ngZone; private _dir; /** Emits when the popover is opened. */ popoverOpened: Subject<void>; /** Emits when the popover is closed. */ popoverClosed: Subject<void>; /** Reference to the overlay containing the popover component. */ _overlayRef: OverlayRef; /** Reference to the target popover. */ private _popover; /** Reference to the view container for the popover template. */ private _viewContainerRef; /** Reference to the anchor element. */ private _anchor; /** Reference to a template portal where the overlay will be attached. */ private _portal; /** Single subscription to notifications service events. */ private _notificationsSubscription; /** Single subscription to position changes. */ private _positionChangeSubscription; /** Whether the popover is presently open. */ private _popoverOpen; /** Emits when the service is destroyed. */ private _onDestroy; constructor(_overlay: Overlay, _ngZone: NgZone, _dir: Directionality); ngOnDestroy(): void; /** Anchor a popover instance to a view and connection element. */ anchor(popover: SatPopover, viewContainerRef: ViewContainerRef, anchor: ElementRef | HTMLElement): void; /** Gets whether the popover is presently open. */ isPopoverOpen(): boolean; /** Toggles the popover between the open and closed states. */ togglePopover(): void; /** Opens the popover. */ openPopover(options?: SatPopoverOpenOptions): void; /** Closes the popover. */ closePopover(value?: any): void; /** TODO: implement when the overlay's position can be dynamically changed */ repositionPopover(): void; /** TODO: when the overlay's position can be dynamically changed, do not destroy */ updatePopoverConfig(): void; /** Realign the popover to the anchor. */ realignPopoverToAnchor(): void; /** Get a reference to the anchor element. */ getAnchorElement(): HTMLElement; /** Apply behavior properties on the popover based on the open options. */ private _applyOpenOptions; /** Create an overlay to be attached to the portal. */ private _createOverlay; /** Removes the popover from the DOM. Does NOT update open state. */ private _destroyPopover; /** * Destroys the popover immediately if it is closed, or waits until it * has been closed to destroy it. */ private _destroyPopoverOnceClosed; /** Close popover when backdrop is clicked. */ private _subscribeToBackdrop; /** Close popover when escape keydown event occurs. */ private _subscribeToEscape; /** Set state back to closed when detached. */ private _subscribeToDetachments; /** Save the opened state of the popover and emit. */ private _saveOpenedState; /** Save the closed state of the popover and emit. */ private _saveClosedState; /** Gets the text direction of the containing app. */ private _getDirection; /** Create and return a config for creating the overlay. */ private _getOverlayConfig; /** * Listen to changes in the position of the overlay and set the correct alignment classes, * ensuring that the animation origin is correct, even with a fallback position. */ private _subscribeToPositionChanges; /** Map a scroll strategy string type to an instance of a scroll strategy. */ private _getScrollStrategyInstance; /** Create and return a position strategy based on config provided to the component instance. */ private _getPositionStrategy; /** Get fallback positions based around target alignments. */ private _getFallbacks; static ɵfac: i0.ɵɵFactoryDeclaration<SatPopoverAnchoringService, [null, null, { optional: true; }]>; static ɵprov: i0.ɵɵInjectableDeclaration<SatPopoverAnchoringService>; } //# sourceMappingURL=popover-anchoring.service.d.ts.map