import * as i0 from '@angular/core'; import { ViewContainerRef, ComponentFactoryResolver, ElementRef, ComponentRef, EmbeddedViewRef, InjectionToken, OnDestroy, Injector, TemplateRef } from '@angular/core'; import * as i1 from '@angular/cdk/overlay'; import { ScrollStrategy, FlexibleConnectedPositionStrategy, Overlay, FlexibleConnectedPositionStrategyOrigin, OriginConnectionPosition, OverlayConnectionPosition, OverlayRef } from '@angular/cdk/overlay'; import * as i2 from '@angular/cdk/a11y'; import { ConfigurableFocusTrapFactory } from '@angular/cdk/a11y'; import * as i3 from '@angular/cdk/portal'; import { BasePortalOutlet, CdkPortalOutlet, ComponentPortal, TemplatePortal, DomPortal, ComponentType } from '@angular/cdk/portal'; import * as i4 from '@angular/router'; import { Router } from '@angular/router'; import { Observable } from 'rxjs'; import { Directionality, Direction } from '@angular/cdk/bidi'; import * as _angular_cdk_overlay_module_d_C2CxnwqT from '@angular/cdk/overlay-module.d-C2CxnwqT'; /** * Interface for any kind of button that should be active while * an overlay is open. */ declare abstract class NxTriggerButton { /** Applies active styles to the button. */ abstract setTriggerActive(): void; /** Applies or unsets inactive styles to the button. */ abstract setTriggerInactive(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** The ARIA role of the overlay. */ type NxOverlayRole = string; type NxOverlayDirection = NxOverlayVerticalDirection | NxOverlayHorizontalDirection; declare type NxOverlayVerticalDirection = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end'; declare type NxOverlayHorizontalDirection = 'left' | 'right'; type NxOverlayFallbackOrientation = 'vertical' | 'horizontal' | 'clockwise'; declare const VERTICAL_DIRECTIONS: NxOverlayDirection[]; declare const HORIZONTAL_DIRECTIONS: NxOverlayDirection[]; declare const CLOCKWISE_DIRECTIONS: NxOverlayDirection[]; declare const BASE_OFFSET = 0; /** * Configuration for opening a overlay with the NxDialogService. */ declare class NxOverlayConfig { /** * Where the attached component should live in Angular's *logical* component tree. * This affects what is available for injection and the change detection order for the * component instantiated inside of the overlay. This does not affect where the overlay * content will be rendered. */ viewContainerRef?: ViewContainerRef; /** ID for the overlay. If omitted, a unique one will be generated. */ id?: string; /** The ARIA role of the overlay element. */ role?: NxOverlayRole | null; /** Custom class for the overlay pane. */ panelClass?: string | string[]; /** Whether the overlay has a backdrop. */ hasBackdrop?: boolean; /** Custom class for the backdrop. */ backdropClass?: string; /** Whether the user can use escape or clicking on the backdrop to close the overlay. */ closeOnClickOutside?: boolean; /** Width of the overlay. */ width?: number | string; /** Height of the overlay. */ height?: number | string; /** Min-width of the overlay. If a number is provided, assumes pixel units. */ minWidth?: number | string; /** Min-height of the overlay. If a number is provided, assumes pixel units. */ minHeight?: number | string; /** Max-width of the overlay. If a number is provided, assumes pixel units. Defaults to 100vw. */ maxWidth?: number | string; /** Max-height of the overlay. If a number is provided, assumes pixel units. */ maxHeight?: number | string; /** The distance from the trigger to the overlay in pixels. */ offset?: number; /** Position overrides. */ direction?: NxOverlayDirection; /** The fallbacks that are chosen. */ fallbackOrientation?: NxOverlayFallbackOrientation; /** ID of the element that describes the overlay. */ ariaDescribedBy?: string | null; /** ID of the element that labels the overlay. */ ariaLabelledBy?: string | null; /** Aria label to assign to the overlay element. */ ariaLabel?: string | null; /** Whether the overlay should focus the first focusable element on open. */ autoFocus?: boolean; /** * Whether the overlay should restore focus to the * previously-focused element, after it's closed. */ restoreFocus?: boolean; /** Scroll strategy to be used for the overlay. */ scrollStrategy?: ScrollStrategy; /** Scroll strategy to be used for the overlay. */ positionStrategy?: FlexibleConnectedPositionStrategy; /** * Whether the overlay should close when the user goes backwards/forwards in history. * Note that this usually doesn't include clicking on links (unless the user is using * the `HashLocationStrategy`). */ closeOnNavigation?: boolean; /** * Alternate `ComponentFactoryResolver` to use when resolving the associated component. * @deprecated No longer used. */ componentFactoryResolver?: ComponentFactoryResolver; triggerButton?: NxTriggerButton; /** Margin between the overlay and the viewport edges. */ viewportMargin?: number; } /** * Throws an exception for the case when a ComponentPortal is * attached to a DomPortalOutlet without an origin. * @docs-private */ declare function throwNxOverlayContentAlreadyAttachedError(): void; /** * Internal component that wraps user-provided overlay content. */ declare class NxOverlayContainerComponent extends BasePortalOutlet { private readonly _elementRef; private readonly _focusTrapFactory; private readonly _document; /** The overlay configuration. */ readonly _config: NxOverlayConfig; /** The portal outlet inside of this container into which the overlay content will be loaded. */ _portalOutlet: CdkPortalOutlet; /** The class that traps and manages focus within the overlay. */ private _focusTrap; /** Element that was focused before the overlay was opened. Save this to restore upon close. */ private _elementFocusedBeforeDialogWasOpened; /** ID of the element that should be considered as the overlay's label. */ _ariaLabelledBy: string | null; /** ID for the container DOM element. */ _id: string; constructor(_elementRef: ElementRef, _focusTrapFactory: ConfigurableFocusTrapFactory, _document: Document | null, /** The overlay configuration. */ _config: NxOverlayConfig); get elementRef(): ElementRef; /** * Attach a ComponentPortal as content to this overlay container. * @param portal Portal to be attached as the overlay content. */ attachComponentPortal(portal: ComponentPortal): ComponentRef; /** * Attach a TemplatePortal as content to this overlay container. * @param portal Portal to be attached as the overlay content. */ attachTemplatePortal(portal: TemplatePortal): EmbeddedViewRef; /** * Attaches a DOM portal to the overlay container. * @param portal Portal to be attached. * @deprecated To be turned into a method when changed in the CDK. */ attachDomPortal: (portal: DomPortal) => void; /** Moves the focus inside the focus trap. */ private _trapFocus; /** Restores focus to the element that was focused before the overlay opened. */ restoreFocus(): void; /** Saves a reference to the element that was focused before the overlay was opened. */ private _savePreviouslyFocusedElement; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class NxOverlayModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } /** * Creates an error to be thrown if the user provided an invalid popover direction. * @docs-private */ declare function getNxOverlayInvalidDirectionError(direction: string): Error; declare const OVERLAY_POSITIONS: { [key in NxOverlayDirection]: (isRtl: boolean) => OverlayConnectionPosition; }; declare const ORIGIN_POSITIONS: { [key in NxOverlayDirection]: (arg0: boolean) => OriginConnectionPosition; }; declare class NxOverlayPositionBuilder { private readonly _overlay; private readonly _dir; constructor(_overlay: Overlay, _dir: Directionality | null); createPositionStrategy(element: FlexibleConnectedPositionStrategyOrigin, config: NxOverlayConfig): _angular_cdk_overlay_module_d_C2CxnwqT.b; /** * Returns the origin position based on the user's direction preference. */ getOrigin(direction: NxOverlayDirection | undefined): OriginConnectionPosition; /** Returns the overlay position based on the user's direction preference */ getOverlayPosition(direction: NxOverlayDirection | undefined): OverlayConnectionPosition; /** Returns the overlay offset required by the user's direction preference */ getOffset(direction: NxOverlayDirection | undefined, config: NxOverlayConfig): { offsetY: number; offsetX?: undefined; } | { offsetX: number; offsetY?: undefined; }; /** * Returns an array of fallback positions for popover, following the algoritm: * 1) Slightly alternate preferred position if applicable. I.e. for 'top' try 'top-start' and 'top-end' positioning. * 2) Try the opposite position, i.e. for 'top' try 'bottom'. * 3) Slightly alternate opposite position, i.e. 'bottom-start', 'bottom-end'. * 4) All remaining positions from positions list. */ private _getFallbackPositions; /** Takes the defined fallback orders and adjusts it for the requested direction */ private _getFallbackOrder; private _splitDirection; get isRtl(): boolean; /** Returns the opposite position, using angular position naming: top, bottom, start, end, center */ private _getInversePosition; /** Resolve the fallback order to all possible direction. For top and bottom we want to add the start and end positions. */ private _resolveFallbacks; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** Injection token that determines the scroll handling while a overlay is open. */ declare const NX_OVERLAY_SCROLL_STRATEGY: InjectionToken<() => ScrollStrategy>; /** @docs-private */ declare function NX_OVERLAY_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay): () => ScrollStrategy; /** @docs-private */ declare const NX_OVERLAY_SCROLL_STRATEGY_PROVIDER: { provide: InjectionToken<() => ScrollStrategy>; useFactory: typeof NX_OVERLAY_SCROLL_STRATEGY_PROVIDER_FACTORY; deps: (typeof Overlay)[]; }; /** Possible states of the lifecycle of a overlay. */ declare enum NxOverlayState { OPEN = 0, CLOSED = 1 } declare class NxOverlayService implements OnDestroy { private readonly _overlay; private readonly _injector; private readonly _router; private readonly _positionBuilder; private readonly _parentOverlayService; private readonly _dir; private readonly _defaultScrollStrategyFactory; private readonly _afterAllClosedAtThisLevel; private readonly _afterOpenedAtThisLevel; private readonly _openOverlaysAtThisLevel; /** Strategy factory that will be used to handle scrolling while an overlay panel is open. */ private readonly _scrollStrategyFactory; constructor(_overlay: Overlay, _injector: Injector, _router: Router, _positionBuilder: NxOverlayPositionBuilder, _parentOverlayService: NxOverlayService | null, _dir: Directionality | null, _defaultScrollStrategyFactory: () => ScrollStrategy); /** Keeps track of the currently-open overlays. */ get openOverlays(): NxOverlayRef[]; /** The text direction of the containing app. */ get dir(): Direction; /** * Opens a panel containing the given component and attaches it to an element. * @param componentOrTemplateRef Type of the component to load into the dialog, or a TemplateRef to instantiate as the panel content. * @param origin Reference element for positioning. * @param config Extra configuration options. * @returns Reference to the newly-opened panel. */ open(componentOrTemplateRef: ComponentType | TemplateRef, origin: FlexibleConnectedPositionStrategyOrigin, config?: NxOverlayConfig): NxOverlayRef; /** * Finds an open overlay by its id. * @param id ID to use when looking up the overlay. */ getOverlayById(id: string): NxOverlayRef | undefined; ngOnDestroy(): void; /** * Creates the overlay into which the overlay will be loaded. * @param config The overlay configuration. * @returns A promise resolving to the OverlayRef for the created overlay. */ private _createOverlay; /** * Creates a CDK overlay configuration from the overlay service config. * @param overlayConfig The nx overlay service configuration. * @returns The CDK overlay configuration. */ private _getOverlayConfig; get isRtl(): boolean; /** * Attaches an NxOverlayContainer to the already-created overlay. * @param cdkOverlay Reference to the dialog's underlying overlay. * @param config The overlay configuration. * @returns A promise resolving to a ComponentRef for the attached container. */ private _attachOverlayContainer; /** * Attaches the user-provided component to the already-created NxOverlayContainer. * @param componentOrTemplateRef The type of component being loaded into the dialog, or a TemplateRef to instantiate as the content. * @param overlayContainer Reference to the wrapping NxOverlayContainer. * @param cdkOverlayRef Reference to the overlay in which the overlay resides. * @param config The overlay configuration. * @returns A promise resolving to the NxOverlayRef that should be returned to the user. */ private _attachOverlayContent; /** * Creates a custom injector to be used inside the overlay. This allows a component loaded inside * of a overlay to close itself and, optionally, to return a value. * @param config Config object that is used to construct the overlay. * @param overlayRef Reference to the overlay. * @param overlayContainer Overlay container element that wraps all of the contents. * @returns The custom injector that can be used inside the overlay. */ private _createInjector; /** * Removes a overlay from the array of open overlays. * @param overlayRef Overlay to be removed. */ private _removeOpenOverlay; /** Closes all of the overlays in an array. */ private _closeOverlays; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * Reference to a overlay opened via the NxDialogService. */ declare class NxOverlayRef { private readonly _overlayRef; readonly _containerInstance: NxOverlayContainerComponent; readonly origin: FlexibleConnectedPositionStrategyOrigin; private readonly _router; readonly id: string; /** The instance of component opened into the overlay. */ componentInstance: T; /** Whether the user is allowed to close the overlay. */ closeOnClickOutside?: boolean; /** Subject for notifying the user that the overlay has finished opening. */ private readonly _afterOpened; /** Subject for notifying the user that the overlay has finished closing. */ private readonly _afterClosed; /** Subject for notifying the user that the overlay has started closing. */ private readonly _beforeClosed; private readonly _documentClickObservable; /** Result to be passed to afterClosed. */ private _result?; /** Current state of the overlay. */ private _state; constructor(_overlayRef: OverlayRef, _containerInstance: NxOverlayContainerComponent, origin: FlexibleConnectedPositionStrategyOrigin, _router: Router, id?: string); waitForClose(): void; /** * Close the overlay. * @param overlayResult Optional result to return to the overlay opener. */ close(overlayResult?: R): void; /** * Gets an observable that is notified when the overlay is finished opening. */ afterOpened(): Observable; /** * Gets an observable that is notified when the overlay is finished closing. */ afterClosed(): Observable; /** * Gets an observable that is notified when the overlay has started closing. */ beforeClosed(): Observable; /** * Gets an observable that emits when the overlay's backdrop has been clicked. */ backdropClick(): Observable; /** * Gets an observable that emits when keydown events are targeted on the overlay. */ keydownEvents(): Observable; /** Add a CSS class or an array of classes to the overlay pane. */ addPanelClass(classes: string | string[]): this; /** Remove a CSS class or an array of classes from the overlay pane. */ removePanelClass(classes: string | string[]): this; /** Gets the current state of the overlay's lifecycle. */ getState(): NxOverlayState; } export { BASE_OFFSET, CLOCKWISE_DIRECTIONS, HORIZONTAL_DIRECTIONS, NX_OVERLAY_SCROLL_STRATEGY, NX_OVERLAY_SCROLL_STRATEGY_PROVIDER, NX_OVERLAY_SCROLL_STRATEGY_PROVIDER_FACTORY, NxOverlayConfig, NxOverlayContainerComponent, NxOverlayModule, NxOverlayPositionBuilder, NxOverlayRef, NxOverlayService, NxOverlayState, NxTriggerButton, ORIGIN_POSITIONS, OVERLAY_POSITIONS, VERTICAL_DIRECTIONS, getNxOverlayInvalidDirectionError, throwNxOverlayContentAlreadyAttachedError }; export type { NxOverlayDirection, NxOverlayFallbackOrientation, NxOverlayHorizontalDirection, NxOverlayRole, NxOverlayVerticalDirection };