UNPKG

@ziflow/ngx-simple-modal

Version:

A simple unopinionated framework to implement simple modal based behaviour in angular (v2+) projects.

75 lines (74 loc) 2.03 kB
import { ElementRef } from '@angular/core'; import { Observable, BehaviorSubject } from 'rxjs'; import { SimpleModalOptions } from './simple-modal-options'; import * as i0 from "@angular/core"; export interface OnDestroyLike { ngOnDestroy(): void; [key: string]: any; } /** * Abstract modal * @template T - modal data; * @template T1 - modal result */ export declare abstract class SimpleModalComponent<T, T1> { /** * Observer to return result from modal */ private observer; /** * Dialog result * @type {T1} */ result: T1; /** * Dialog wrapper (modal placeholder) */ wrapper: ElementRef; /** * ref of options for this component */ options: SimpleModalOptions; /** * ready$ is when all animations and focusing have comleted */ _ready$: BehaviorSubject<boolean>; /** * Callback to the holders close function */ private closerCallback; /** * Constructor */ constructor(); /** * Maps your object passed in the creation to fields in your own Dialog classes * @param {T} data */ mapDataObject(data: T): void; /** * Setup observer * @return {Observable<T1>} */ setupObserver(): Observable<T1>; /** * Defines what happens when close is called - default this * will just call the default remove modal process. If overriden * must include * @param callback */ onClosing(callback: (component: SimpleModalComponent<any, any>) => Promise<any>): void; /** * Closes modal */ close(): Promise<any>; /** * keypress binding ngx way * @param evt */ onKeydownHandler(evt: KeyboardEvent): void; get ready$(): Observable<boolean>; markAsReady(): void; static ɵfac: i0.ɵɵFactoryDeclaration<SimpleModalComponent<any, any>, never>; static ɵcmp: i0.ɵɵComponentDeclaration<SimpleModalComponent<any, any>, "ng-component", never, {}, {}, never, never, false, never>; }