import { AnimationEvent } from '@angular/animations'; import { ConfigurableFocusTrapFactory, FocusMonitor, FocusOrigin } from '@angular/cdk/a11y'; import { BasePortalOutlet, CdkPortalOutlet, ComponentPortal, TemplatePortal } from '@angular/cdk/portal'; import { ChangeDetectorRef, ComponentRef, ElementRef, EmbeddedViewRef, EventEmitter } from '@angular/core'; import { SafeAny } from '@ngx-simple/core/types'; import { SimDialogConfig } from './dialog-config'; export declare class SimDialogComponent extends BasePortalOutlet { private _elementRef; private _focusTrapFactory; private _changeDetectorRef; config: SimDialogConfig; private _focusMonitor?; /** 当动画状态改变时发出 */ _animationStateChanged: EventEmitter; _closeInteractionType: FocusOrigin | null; /** 该容器内部的门户插槽,对话框内容将被加载到其中 */ _portalOutlet: CdkPortalOutlet; /** 对话动画的状态 */ state: 'void' | 'enter' | 'exit'; /** 容器DOM元素的ID */ id: string; private _document; /** 在Dialog中捕获和管理焦点的类 */ private _focusTrap; /** 在打开对话框之前聚焦的元素。 保存此元素方便在关闭时恢复 */ private _elementFocusedBeforeDialogWasOpened; constructor(_elementRef: ElementRef, _focusTrapFactory: ConfigurableFocusTrapFactory, _changeDetectorRef: ChangeDetectorRef, _document: SafeAny, config: SimDialogConfig, _focusMonitor?: FocusMonitor); /** * 将ComponentPortal作为内容附加到此对话框容器 * @param portal 将门户附加为对话框内容 */ attachComponentPortal(portal: ComponentPortal): ComponentRef; /** * 将TemplatePortal作为内容附加到此对话框容器 * @param portal 将门户附加为对话框内容 */ attachTemplatePortal(portal: TemplatePortal): EmbeddedViewRef; /** 如果焦点被移出对话框,则将焦点移回到对话框中 */ _recaptureFocus(): void; /** 每当宿主上动画开始时调用 */ onAnimationStart(event: AnimationEvent): void; /** 每当宿主上动画完成时调用 */ onAnimationDone(event: AnimationEvent): void; /** 启动对话框退出动画. */ startExitAnimation(): void; /** 将焦点移动到焦点陷阱内 */ private _trapFocus; /** 将焦点恢复到对话框打开之前已聚焦的元素上 */ private _restoreFocus; /** * 设置焦点动态并保存对对话框打开前焦点元素的引用 */ private _setupFocusTrap; /** 返回焦点是否在对话框内 */ private _containsFocus; }