@angular-mdc/web
Version:
43 lines (42 loc) • 2.01 kB
TypeScript
import { ComponentRef, ElementRef, EmbeddedViewRef } from '@angular/core';
import { FocusTrapFactory } from '@angular/cdk/a11y';
import { BasePortalOutlet, ComponentPortal, CdkPortalOutlet, TemplatePortal } from '@angular/cdk/portal';
import { Subject } from 'rxjs';
import { MdcDialogConfig } from './dialog-config';
/**
* Throws an exception for the case when a ComponentPortal is
* attached to a DomPortalOutlet without an origin.
*/
export declare function throwMdcDialogContentAlreadyAttachedError(): void;
export declare class MdcDialogPortal extends BasePortalOutlet {
private _elementRef;
private _focusTrapFactory;
private _document;
_config: MdcDialogConfig;
_portalOutlet: CdkPortalOutlet;
/** The class that traps and manages focus within the dialog. */
private _focusTrap;
/** Element that was focused before the dialog was opened. Save this to restore upon close. */
private _elementFocusedBeforeDialogWasOpened;
/** A subject emitting after the dialog exits the view. */
_afterExit: Subject<void>;
/** ID for the container DOM element. */
_id: string;
/**
* Attach a ComponentPortal as content to this dialog container.
* @param portal Portal to be attached as the dialog content.
*/
attachComponentPortal<T>(portal: ComponentPortal<T>): ComponentRef<T>;
/**
* Attach a TemplatePortal as content to this dialog container.
* @param portal Portal to be attached as the dialog content.
*/
attachTemplatePortal<C>(portal: TemplatePortal<C>): EmbeddedViewRef<C>;
constructor(_elementRef: ElementRef, _focusTrapFactory: FocusTrapFactory, _document: any, _config: MdcDialogConfig);
/** Moves the focus inside the focus trap. */
trapFocus(): void;
/** Restores focus to the element that was focused before the dialog opened. */
restoreFocus(): void;
/** Saves a reference to the element that was focused before the dialog was opened. */
private _savePreviouslyFocusedElement;
}