igniteui-angular
Version:
Ignite UI for Angular is a dependency-free Angular toolkit for building modern web apps
241 lines (240 loc) • 9.85 kB
TypeScript
import { ApplicationRef, ElementRef, EventEmitter, NgZone, OnDestroy, Type, ViewContainerRef } from '@angular/core';
import { PlatformUtil } from '../../core/utils';
import { IgxOverlayOutletDirective } from '../../directives/toggle/toggle.directive';
import { AnimationService } from '../animation/animation';
import { AbsolutePosition, OffsetMode, OverlayAnimationEventArgs, OverlayCancelableEventArgs, OverlayClosingEventArgs, OverlayCreateSettings, OverlayEventArgs, OverlayInfo, OverlaySettings, Point, RelativePosition, RelativePositionStrategy } from './utilities';
import * as i0 from "@angular/core";
/**
* [Documentation](https://www.infragistics.com/products/ignite-ui-angular/angular/components/overlay-main)
* The overlay service allows users to show components on overlay div above all other elements in the page.
*/
export declare class IgxOverlayService implements OnDestroy {
private _appRef;
private document;
private _zone;
protected platformUtil: PlatformUtil;
private animationService;
/**
* Emitted just before the overlay content starts to open.
* ```typescript
* opening(event: OverlayCancelableEventArgs){
* const opening = event;
* }
* ```
*/
opening: EventEmitter<OverlayCancelableEventArgs>;
/**
* Emitted after the overlay content is opened and all animations are finished.
* ```typescript
* opened(event: OverlayEventArgs){
* const opened = event;
* }
* ```
*/
opened: EventEmitter<OverlayEventArgs>;
/**
* Emitted just before the overlay content starts to close.
* ```typescript
* closing(event: OverlayCancelableEventArgs){
* const closing = event;
* }
* ```
*/
closing: EventEmitter<OverlayClosingEventArgs>;
/**
* Emitted after the overlay content is closed and all animations are finished.
* ```typescript
* closed(event: OverlayEventArgs){
* const closed = event;
* }
* ```
*/
closed: EventEmitter<OverlayEventArgs>;
/**
* Emitted before the content is appended to the overlay.
* ```typescript
* contentAppending(event: OverlayEventArgs){
* const contentAppending = event;
* }
* ```
*/
contentAppending: EventEmitter<OverlayEventArgs>;
/**
* Emitted after the content is appended to the overlay, and before animations are started.
* ```typescript
* contentAppended(event: OverlayEventArgs){
* const contentAppended = event;
* }
* ```
*/
contentAppended: EventEmitter<OverlayEventArgs>;
/**
* Emitted just before the overlay animation start.
* ```typescript
* animationStarting(event: OverlayAnimationEventArgs){
* const animationStarting = event;
* }
* ```
*/
animationStarting: EventEmitter<OverlayAnimationEventArgs>;
private _componentId;
private _overlayInfos;
private _overlayElement;
private _document;
private _keyPressEventListener;
private destroy$;
private _cursorStyleIsSet;
private _cursorOriginalValue;
private _defaultSettings;
constructor(_appRef: ApplicationRef, document: any, _zone: NgZone, platformUtil: PlatformUtil, animationService: AnimationService);
/**
* Creates overlay settings with global or container position strategy and preset position settings
*
* @param position Preset position settings. Default position is 'center'
* @param outlet The outlet container to attach the overlay to
* @returns Non-modal overlay settings based on Global or Container position strategy and the provided position.
*/
static createAbsoluteOverlaySettings(position?: AbsolutePosition, outlet?: IgxOverlayOutletDirective | ElementRef): OverlaySettings;
/**
* Creates overlay settings with auto, connected or elastic position strategy and preset position settings
*
* @param target Attaching target for the component to show
* @param strategy The relative position strategy to be applied to the overlay settings. Default is Auto positioning strategy.
* @param position Preset position settings. By default the element is positioned below the target, left aligned.
* @returns Non-modal overlay settings based on the provided target, strategy and position.
*/
static createRelativeOverlaySettings(target: Point | HTMLElement, position?: RelativePosition, strategy?: RelativePositionStrategy): OverlaySettings;
private static createAbsolutePositionSettings;
private static createRelativePositionSettings;
private static createPositionStrategy;
/**
* Generates Id. Provide this Id when call `show(id)` method
*
* @param component ElementRef to show in overlay
* @param settings (optional): Display settings for the overlay, such as positioning and scroll/close behavior.
* @returns Id of the created overlay. Valid until `detach` is called.
*/
attach(element: ElementRef, settings?: OverlaySettings): string;
/**
* Generates Id. Provide this Id when call `show(id)` method
*
* Note created instance is in root scope, prefer the `viewContainerRef` overload when local injection context is needed.
*
* @param component Component Type to show in overlay
* @param settings (optional): Create settings for the overlay, such as positioning and scroll/close behavior.
* Includes also an optional `Injector` to add to the created dynamic component's injectors.
* @returns Id of the created overlay. Valid until `detach` is called.
*/
attach(component: Type<any>, settings?: OverlayCreateSettings): string;
/**
* Generates an Id. Provide this Id when calling the `show(id)` method
*
* @param component Component Type to show in overlay
* @param viewContainerRef Reference to the container where created component's host view will be inserted
* @param settings (optional): Display settings for the overlay, such as positioning and scroll/close behavior.
*/
attach(component: Type<any>, viewContainerRef: ViewContainerRef, settings?: OverlaySettings): string;
/**
* Remove overlay with the provided id.
*
* @param id Id of the overlay to remove
* ```typescript
* this.overlay.detach(id);
* ```
*/
detach(id: string): void;
/**
* Remove all the overlays.
* ```typescript
* this.overlay.detachAll();
* ```
*/
detachAll(): void;
/**
* Shows the overlay for provided id.
*
* @param id Id to show overlay for
* @param settings Display settings for the overlay, such as positioning and scroll/close behavior.
*/
show(id: string, settings?: OverlaySettings): void;
/**
* Hides the component with the ID provided as a parameter.
* ```typescript
* this.overlay.hide(id);
* ```
*/
hide(id: string, event?: Event): void;
/**
* Hides all the components and the overlay.
* ```typescript
* this.overlay.hideAll();
* ```
*/
hideAll(): void;
/**
* Repositions the component with ID provided as a parameter.
*
* @param id Id to reposition overlay for
* ```typescript
* this.overlay.reposition(id);
* ```
*/
reposition(id: string): void;
/**
* Offsets the content along the corresponding axis by the provided amount with optional offsetMode that determines whether to add (by default) or set the offset values
*
* @param id Id to offset overlay for
* @param deltaX Amount of offset in horizontal direction
* @param deltaY Amount of offset in vertical direction
* @param offsetMode Determines whether to add (by default) or set the offset values with OffsetMode.Add and OffsetMode.Set
* ```typescript
* this.overlay.setOffset(id, deltaX, deltaY, offsetMode);
* ```
*/
setOffset(id: string, deltaX: number, deltaY: number, offsetMode?: OffsetMode): void;
/** @hidden */
repositionAll: () => void;
/** @hidden */
ngOnDestroy(): void;
/** @hidden @internal */
getOverlayById(id: string): OverlayInfo;
private _hide;
/**
* Creates overlayInfo. Sets the info's `elementRef`, `componentRef`and `settings`. Also
* initialize info's `ngZone`, `transformX` and `transformY`.
* @param component ElementRef or Type. If type is provided dynamic component will be created
* @param viewContainerRefOrSettings (optional): If ElementRef is provided for `component` this
* parameter is OverlaySettings. Otherwise it could be ViewContainerRef or OverlayCreateSettings and will be
* used when dynamic component is created.
* @param settings (optional): OverlaySettings when `ViewContainerRef` is provided.
* @returns OverlayInfo
*/
private getOverlayInfo;
private placeElementHook;
private moveElementToOverlay;
private getWrapperElement;
private getContentElement;
private getOverlayElement;
private updateSize;
private closeDone;
private cleanUp;
private playOpenAnimation;
private playCloseAnimation;
private applyAnimationParams;
private documentClicked;
private addOutsideClickListener;
private removeOutsideClickListener;
private addResizeHandler;
private removeResizeHandler;
private addCloseOnEscapeListener;
private removeCloseOnEscapeListener;
private addModalClasses;
private removeModalClasses;
private buildAnimationPlayers;
private openAnimationDone;
private closeAnimationDone;
private finishAnimations;
private getComponentSize;
static ɵfac: i0.ɵɵFactoryDeclaration<IgxOverlayService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<IgxOverlayService>;
}