UNPKG

5.81 kBTypeScriptView Raw
1import { AnimationEvent } from '@angular/animations';
2import { ConfigurableFocusTrapFactory, FocusMonitor, FocusOrigin } from '@angular/cdk/a11y';
3import { BasePortalOutlet, CdkPortalOutlet, ComponentPortal, DomPortal, TemplatePortal } from '@angular/cdk/portal';
4import { ChangeDetectorRef, ComponentRef, ElementRef, EmbeddedViewRef, EventEmitter } from '@angular/core';
5import { CovalentSideSheetConfig } from './side-sheet.config';
6import * as i0 from "@angular/core";
7export declare function _getFocusedElementPierceShadowDom(): HTMLElement | null;
8/**
9 * Base class for the `CovalentSideSheetContainer`. The base class does not implement
10 * animations as these are left to implementers of the side-sheet container.
11 */
12export declare abstract class _CovalentSideSheetContainerBase extends BasePortalOutlet {
13 protected _elementRef: ElementRef;
14 protected _focusTrapFactory: ConfigurableFocusTrapFactory;
15 protected _changeDetectorRef: ChangeDetectorRef;
16 /** The side-sheet configuration. */
17 _config: CovalentSideSheetConfig;
18 private _focusMonitor?;
19 protected _document: Document;
20 /** The portal outlet inside of this container into which the side-sheet content will be loaded. */
21 _portalOutlet: CdkPortalOutlet;
22 /** The class that traps and manages focus within the side-sheet. */
23 private _focusTrap;
24 /** Emits when an animation state changes. */
25 _animationStateChanged: EventEmitter<{
26 state: 'opened' | 'opening' | 'closing' | 'closed';
27 totalTime: number;
28 }>;
29 /** Element that was focused before the side-sheet was opened. Save this to restore upon close. */
30 private _elementFocusedBeforeSideSheetWasOpened;
31 /**
32 * Type of interaction that led to the side-sheet being closed. This is used to determine
33 * whether the focus style will be applied when returning focus to its original location
34 * after the side-sheet is closed.
35 */
36 _closeInteractionType: FocusOrigin | null;
37 /** ID of the element that should be considered as the side-sheet's label. */
38 _ariaLabelledBy: string | null;
39 /** ID for the container DOM element. */
40 _id: string;
41 constructor(_elementRef: ElementRef, _focusTrapFactory: ConfigurableFocusTrapFactory, _changeDetectorRef: ChangeDetectorRef, _document: any,
42 /** The side-sheet configuration. */
43 _config: CovalentSideSheetConfig, _focusMonitor?: FocusMonitor | undefined);
44 /** Starts the side-sheet exit animation. */
45 abstract _startExitAnimation(): void;
46 /** Initializes the side-sheet container with the attached content. */
47 _initializeWithAttachedContent(): void;
48 /**
49 * Attach a ComponentPortal as content to this side-sheet container.
50 * @param portal Portal to be attached as the side-sheet content.
51 */
52 attachComponentPortal<T>(portal: ComponentPortal<T>): ComponentRef<T>;
53 /**
54 * Attach a TemplatePortal as content to this side-sheet container.
55 * @param portal Portal to be attached as the side-sheet content.
56 */
57 attachTemplatePortal<C>(portal: TemplatePortal<C>): EmbeddedViewRef<C>;
58 /**
59 * Attaches a DOM portal to the side-sheet container.
60 * @param portal Portal to be attached.
61 * @deprecated To be turned into a method.
62 */
63 attachDomPortal: (portal: DomPortal) => void;
64 /** Moves focus back into the side-sheet if it was moved out. */
65 _recaptureFocus(): void;
66 /**
67 * Moves the focus inside the focus trap. When autoFocus is not set to 'side-sheet', if focus
68 * cannot be moved then focus will go to the side-sheet container.
69 */
70 protected _trapFocus(): void;
71 /** Restores focus to the element that was focused before the side-sheet opened. */
72 protected _restoreFocus(): void;
73 /** Sets up the focus trap. */
74 private _setupFocusTrap;
75 /** Captures the element that was focused before the side-sheet was opened. */
76 private _capturePreviouslyFocusedElement;
77 /** Focuses the side-sheet container. */
78 private _focusSideSheetContainer;
79 /** Returns whether focus is inside the side-sheet. */
80 private _containsFocus;
81 static ɵfac: i0.ɵɵFactoryDeclaration<_CovalentSideSheetContainerBase, [null, null, null, { optional: true; }, null, null]>;
82 static ɵdir: i0.ɵɵDirectiveDeclaration<_CovalentSideSheetContainerBase, never, never, {}, {}, never, never, false, never>;
83}
84/**
85 * Internal component that wraps the generated side-sheet content.
86 * This animation below is the only reason for duplicating most of the Material dialog code
87 */
88export declare class CovalentSideSheetContainerComponent extends _CovalentSideSheetContainerBase {
89 /** State of the side-sheet animation. */
90 _state: 'void' | 'enter' | 'exit';
91 tdSideSheetContainerClass: boolean;
92 tabIndex: number;
93 arialModal: boolean;
94 idAttr: string;
95 roleAttr: import("@angular/material/dialog").DialogRole | undefined;
96 arialLabelByAttr: string | null;
97 arialDescribeByAttr: string | null;
98 arialLabelAttr: string | null | undefined;
99 get sideSheetAnimationState(): "enter" | "void" | "exit";
100 onAnimateStart($event: AnimationEvent): void;
101 onAnimateDone($event: AnimationEvent): void;
102 /** Callback, invoked whenever an animation on the host completes. */
103 _onAnimationDone({ toState, totalTime }: AnimationEvent): void;
104 /** Callback, invoked when an animation on the host starts. */
105 _onAnimationStart({ toState, totalTime }: AnimationEvent): void;
106 /** Starts the side-sheet exit animation. */
107 _startExitAnimation(): void;
108 static ɵfac: i0.ɵɵFactoryDeclaration<CovalentSideSheetContainerComponent, never>;
109 static ɵcmp: i0.ɵɵComponentDeclaration<CovalentSideSheetContainerComponent, "td-side-sheet-container", never, {}, {}, never, never, false, never>;
110}