UNPKG

@covalent/core

Version:

Core Teradata UI Platform for layouts, icons, custom components and themes. This should be added as a dependency for any project that wants to use layouts, icons and themes for Angular Material.

262 lines (254 loc) 14 kB
import * as i0 from '@angular/core'; import { ElementRef, ChangeDetectorRef, EventEmitter, ComponentRef, EmbeddedViewRef, OnInit, OnChanges, SimpleChanges, OnDestroy, Injector, Type, InjectionToken, TemplateRef } from '@angular/core'; import * as _angular_material_dialog_d_hlN3f_Hk from '@angular/material/dialog.d-hlN3f-Hk'; import { AnimationEvent } from '@angular/animations'; import { ConfigurableFocusTrapFactory, FocusOrigin } from '@angular/cdk/a11y'; import { BasePortalOutlet, CdkPortalOutlet, ComponentPortal, TemplatePortal, DomPortal, ComponentType } from '@angular/cdk/portal'; import { MatDialogConfig, MatDialogRef, MatDialogContainer } from '@angular/material/dialog'; import { OverlayRef, Overlay } from '@angular/cdk/overlay'; declare enum SubPageMode { pushed = "pushed", shifted = "shifted", none = "none" } declare class CovalentSideSheetConfig<D = any> extends MatDialogConfig<D> { subPageMode?: string; } /** * Base class for the `CovalentSideSheetContainer`. The base class does not implement * animations as these are left to implementers of the side-sheet container. */ declare abstract class _CovalentSideSheetContainerBase extends BasePortalOutlet { protected _elementRef: ElementRef<any>; protected _focusTrapFactory: ConfigurableFocusTrapFactory; protected _changeDetectorRef: ChangeDetectorRef; _config: CovalentSideSheetConfig<any>; private _focusMonitor; protected _document: Document | null; /** The portal outlet inside of this container into which the side-sheet content will be loaded. */ _portalOutlet: CdkPortalOutlet; /** The class that traps and manages focus within the side-sheet. */ private _focusTrap; /** Emits when an animation state changes. */ _animationStateChanged: EventEmitter<{ state: "opened" | "opening" | "closing" | "closed"; totalTime: number; }>; /** Element that was focused before the side-sheet was opened. Save this to restore upon close. */ private _elementFocusedBeforeSideSheetWasOpened; /** * Type of interaction that led to the side-sheet being closed. This is used to determine * whether the focus style will be applied when returning focus to its original location * after the side-sheet is closed. */ _closeInteractionType: FocusOrigin | null; /** ID of the element that should be considered as the side-sheet's label. */ _ariaLabelledBy: string | null; /** ID for the container DOM element. */ _id: string; constructor(); /** Starts the side-sheet exit animation. */ abstract _startExitAnimation(): void; /** Initializes the side-sheet container with the attached content. */ _initializeWithAttachedContent(): void; /** * Attach a ComponentPortal as content to this side-sheet container. * @param portal Portal to be attached as the side-sheet content. */ attachComponentPortal<T>(portal: ComponentPortal<T>): ComponentRef<T>; /** * Attach a TemplatePortal as content to this side-sheet container. * @param portal Portal to be attached as the side-sheet content. */ attachTemplatePortal<C>(portal: TemplatePortal<C>): EmbeddedViewRef<C>; /** * Attaches a DOM portal to the side-sheet container. * @param portal Portal to be attached. * @deprecated To be turned into a method. */ attachDomPortal: (portal: DomPortal) => void; /** Moves focus back into the side-sheet if it was moved out. */ _recaptureFocus(): void; /** * Moves the focus inside the focus trap. When autoFocus is not set to 'side-sheet', if focus * cannot be moved then focus will go to the side-sheet container. */ protected _trapFocus(): void; /** Restores focus to the element that was focused before the side-sheet opened. */ protected _restoreFocus(): void; /** Sets up the focus trap. */ private _setupFocusTrap; /** Captures the element that was focused before the side-sheet was opened. */ private _capturePreviouslyFocusedElement; /** Focuses the side-sheet container. */ private _focusSideSheetContainer; /** Returns whether focus is inside the side-sheet. */ private _containsFocus; static ɵfac: i0.ɵɵFactoryDeclaration<_CovalentSideSheetContainerBase, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<_CovalentSideSheetContainerBase, never, never, {}, {}, never, never, true, never>; } /** * Internal component that wraps the generated side-sheet content. * This animation below is the only reason for duplicating most of the Material dialog code */ declare class CovalentSideSheetContainerComponent extends _CovalentSideSheetContainerBase { /** State of the side-sheet animation. */ _state: 'void' | 'enter' | 'exit'; tdSideSheetContainerClass: boolean; tabIndex: number; arialModal: boolean; idAttr: string; roleAttr: _angular_material_dialog_d_hlN3f_Hk.D | undefined; arialLabelByAttr: string | null; arialDescribeByAttr: string | null; arialLabelAttr: string | null | undefined; get sideSheetAnimationState(): "enter" | "void" | "exit"; onAnimateStart($event: AnimationEvent): void; onAnimateDone($event: AnimationEvent): void; /** Callback, invoked whenever an animation on the host completes. */ _onAnimationDone({ toState, totalTime }: AnimationEvent): void; /** Callback, invoked when an animation on the host starts. */ _onAnimationStart({ toState, totalTime }: AnimationEvent): void; /** Starts the side-sheet exit animation. */ _startExitAnimation(): void; static ɵfac: i0.ɵɵFactoryDeclaration<CovalentSideSheetContainerComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<CovalentSideSheetContainerComponent, "td-side-sheet-container", never, {}, {}, never, never, true, never>; } declare class CovalentSideSheetRef<T, R = any> extends MatDialogRef<T, R> { overlayRef: OverlayRef; config: CovalentSideSheetConfig; _containerInstance: MatDialogContainer; readonly id: string; constructor(overlayRef: OverlayRef, config: CovalentSideSheetConfig, _containerInstance: MatDialogContainer, id?: string); } declare function _closeSideSheetVia<R>(ref: CovalentSideSheetRef<R>, interactionType: FocusOrigin, result?: R): void; /** * Button that will close the current dialog. */ declare class CovalentSideSheetCloseDirective implements OnInit, OnChanges { dialogRef: CovalentSideSheetRef<any, any> | null; private _elementRef; private _dialog; /** Screenreader label for the button. */ ariaLabel?: string; /** Default to "button" to prevents accidental form submits. */ type: 'submit' | 'button' | 'reset'; /** Dialog close input. */ dialogResult: any; _CovalentSideSheetClose: any; onClick($event: MouseEvent): void; ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; _onButtonClick(event: MouseEvent): void; static ɵfac: i0.ɵɵFactoryDeclaration<CovalentSideSheetCloseDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<CovalentSideSheetCloseDirective, "[td-side-sheet-close], [CovalentSideSheetClose]", ["CovalentSideSheetClose"], { "ariaLabel": { "alias": "aria-label"; "required": false; }; "type": { "alias": "type"; "required": false; }; "dialogResult": { "alias": "td-side-sheet-close"; "required": false; }; "_CovalentSideSheetClose": { "alias": "CovalentSideSheetClose"; "required": false; }; }, {}, never, never, true, never>; } /** * Title of a side sheet element. Stays fixed to the top of the side sheet when scrolling. */ declare class CovalentSideSheetTitleDirective implements OnInit { private _dialogRef; private _elementRef; private _dialog; /** Unique id for the dialog title. If none is supplied, it will be auto-generated. */ id: string; tdSideSheetTitle: boolean; idAttr: string; ngOnInit(): void; static ɵfac: i0.ɵɵFactoryDeclaration<CovalentSideSheetTitleDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<CovalentSideSheetTitleDirective, "[td-side-sheet-title], [CovalentSideSheetTitle]", ["CovalentSideSheetTitle"], { "id": { "alias": "id"; "required": false; }; }, {}, never, never, true, never>; } /** * Scrollable content container of a dialog. */ declare class CovalentSideSheetContentDirective { tdSideSheetContent: boolean; static ɵfac: i0.ɵɵFactoryDeclaration<CovalentSideSheetContentDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<CovalentSideSheetContentDirective, "[td-side-sheet-content], td-side-sheet-content, [CovalentSideSheetContent]", never, {}, {}, never, never, true, never>; } /** * Container for the bottom action buttons in a dialog. * Stays fixed to the bottom when scrolling. */ declare class CovalentSideSheetActionsDirective { tdSideSheetActions: boolean; static ɵfac: i0.ɵɵFactoryDeclaration<CovalentSideSheetActionsDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<CovalentSideSheetActionsDirective, "[td-side-sheet-actions], td-side-sheet-actions, [CovalentSideSheetActions]", never, {}, {}, never, never, true, never>; } /** * Container for the wrapper part of the dialog */ declare class CovalentSideSheetWrapperDirective { tdSideSheetWrapper: boolean; static ɵfac: i0.ɵɵFactoryDeclaration<CovalentSideSheetWrapperDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<CovalentSideSheetWrapperDirective, "[td-side-sheet-wrapper], td-side-sheet-wrapper, [CovalentSideSheetWrapper]", never, {}, {}, never, never, true, never>; } /** * @deprecated This module is deprecated and will be removed in future versions. * Please migrate to using standalone components as soon as possible. */ declare class CovalentSideSheetModule { static ɵfac: i0.ɵɵFactoryDeclaration<CovalentSideSheetModule, never>; static ɵmod: i0.ɵɵNgModuleDeclaration<CovalentSideSheetModule, never, [typeof CovalentSideSheetContainerComponent, typeof CovalentSideSheetActionsDirective, typeof CovalentSideSheetCloseDirective, typeof CovalentSideSheetContentDirective, typeof CovalentSideSheetTitleDirective, typeof CovalentSideSheetWrapperDirective], [typeof CovalentSideSheetActionsDirective, typeof CovalentSideSheetCloseDirective, typeof CovalentSideSheetContentDirective, typeof CovalentSideSheetTitleDirective, typeof CovalentSideSheetWrapperDirective]>; static ɵinj: i0.ɵɵInjectorDeclaration<CovalentSideSheetModule>; } declare class _CovalentSideSheetBase<C extends _CovalentSideSheetContainerBase> implements OnDestroy { private _overlay; private _injector; private _defaultOptions; private _parentSideSheet; private _sideSheetRefConstructor; private _sideSheetContainerType; private _sideSheetDataToken; private _openSideSheetsAtThisLevel; private readonly _afterAllClosedAtThisLevel; private readonly _afterOpenedAtThisLevel; private _animationStateSubscriptions; private defaultSidebarConfig; constructor(_overlay: Overlay, _injector: Injector, _defaultOptions: CovalentSideSheetConfig | undefined, _parentSideSheet: _CovalentSideSheetBase<C> | undefined, _sideSheetRefConstructor: Type<CovalentSideSheetRef<any>>, _sideSheetContainerType: Type<C>, _sideSheetDataToken: InjectionToken<unknown>); /** Keeps track of the currently-open side-sheets. */ get openSideSheets(): CovalentSideSheetRef<unknown>[]; open<T, D = unknown, R = unknown>(componentOrTemplateRef: ComponentType<T> | TemplateRef<T>, config?: CovalentSideSheetConfig<D>): CovalentSideSheetRef<T, R>; ngOnDestroy(): void; /** * Closes all of the currently-open side-sheets. */ closeAll(): void; private _createOverlay; /** * Attaches a container to a side-sheets's already-created overlay. * @param overlay Reference to the side-sheet's underlying overlay. * @param config The side-sheet configuration. * @returns A promise resolving to a ComponentRef for the attached container. */ private _attachSideSheetContainer; /** * Attaches the user-provided component to the already-created side sheet container. * @param componentOrTemplateRef The type of component being loaded into the side-sheet, * or a TemplateRef to instantiate as the content. * @param dialogContainer Reference to the wrapping side-sheet container. * @param overlayRef Reference to the overlay in which the side-sheet resides. * @param config The side-sheet configuration. * @returns A promise resolving to the CovalentSideSheetRef that should be returned to the user. */ private _attachSideSheetContent; private _createInjector; /** * Removes a side sheet from the array of open side sheets. * @param sideSheetRef Side Sheet to be removed. */ private _removeOpenSideSheet; /** Closes all of the side-sheet in an array. */ private _closeSideSheets; static ɵfac: i0.ɵɵFactoryDeclaration<_CovalentSideSheetBase<any>, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<_CovalentSideSheetBase<any>, never, never, {}, {}, never, never, true, never>; } /** * Service to open Covalent Design side-sheet. */ declare class CovalentSideSheet extends _CovalentSideSheetBase<CovalentSideSheetContainerComponent> { constructor(overlay: Overlay, injector: Injector, defaultOptions: CovalentSideSheetConfig, parentSideSheet: CovalentSideSheet); static ɵfac: i0.ɵɵFactoryDeclaration<CovalentSideSheet, [null, null, { optional: true; }, { optional: true; skipSelf: true; }]>; static ɵprov: i0.ɵɵInjectableDeclaration<CovalentSideSheet>; } export { CovalentSideSheet, CovalentSideSheetActionsDirective, CovalentSideSheetCloseDirective, CovalentSideSheetConfig, CovalentSideSheetContentDirective, CovalentSideSheetModule, CovalentSideSheetRef, CovalentSideSheetTitleDirective, CovalentSideSheetWrapperDirective, SubPageMode, _CovalentSideSheetBase, _closeSideSheetVia };