UNPKG

@ng-matero/extensions

Version:
62 lines (61 loc) 2.83 kB
import { Overlay } from '@angular/cdk/overlay'; import { ComponentType } from '@angular/cdk/portal'; import { InjectionToken, Injector, OnDestroy, TemplateRef } from '@angular/core'; import { Observable, Subject } from 'rxjs'; import { MtxDrawerConfig } from './drawer-config'; import { MtxDrawerRef } from './drawer-ref'; import * as i0 from "@angular/core"; /** Injection token that can be used to access the data that was passed in to a drawer. */ export declare const MTX_DRAWER_DATA: InjectionToken<any>; /** Injection token that can be used to specify default drawer options. */ export declare const MTX_DRAWER_DEFAULT_OPTIONS: InjectionToken<MtxDrawerConfig<any>>; /** * Service to trigger Material Design bottom sheets. */ export declare class MtxDrawer implements OnDestroy { private _overlay; private _parentDrawer; private _defaultOptions?; private readonly _openDrawersAtThisLevel; private readonly _afterAllDismissedAtThisLevel; private readonly _afterOpenedAtThisLevel; private _dialog; /** Keeps track of the currently-open dialogs. */ get openDrawers(): MtxDrawerRef<any>[]; /** Stream that emits when a drawer has been opened. */ get afterOpened(): Subject<MtxDrawerRef<any>>; private _getAfterAllDismissed; /** * Stream that emits when all open drawer have finished closing. * Will emit on subscribe if there are no open drawers to begin with. */ readonly afterAllDismissed: Observable<void>; constructor(_overlay: Overlay, injector: Injector, _parentDrawer: MtxDrawer, _defaultOptions?: MtxDrawerConfig | undefined); /** * Opens a drawer containing the given component. * @param component Type of the component to load into the drawer. * @param config Extra configuration options. * @returns Reference to the newly-opened drawer. */ open<T, D = any, R = any>(component: ComponentType<T>, config?: MtxDrawerConfig<D>): MtxDrawerRef<T, R>; /** * Opens a drawer containing the given template. * @param template TemplateRef to instantiate as the drawer content. * @param config Extra configuration options. * @returns Reference to the newly-opened drawer. */ open<T, D = any, R = any>(template: TemplateRef<T>, config?: MtxDrawerConfig<D>): MtxDrawerRef<T, R>; /** * Dismisses all of the currently-open drawers. */ dismissAll(): void; /** * Finds an open drawer by its id. * @param id ID to use when looking up the drawer. */ getDrawerById(id: string): MtxDrawerRef<any> | undefined; ngOnDestroy(): void; private _dismissDrawers; static ɵfac: i0.ɵɵFactoryDeclaration<MtxDrawer, [null, null, { optional: true; skipSelf: true; }, { optional: true; }]>; static ɵprov: i0.ɵɵInjectableDeclaration<MtxDrawer>; }