UNPKG

@dbg-riskit/angular-view

Version:

51 lines (50 loc) 3 kB
import { Type } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { DialogData as LoaderConfig, LoaderComponent } from './loader.component'; import { DialogButton, DialogConfig as MessageDialogConfig, DialogType } from './message.dialog.component'; import { DialogData as ProgressLoaderConfig, ProgressLoaderComponent } from './progress.loader.component'; import * as i0 from "@angular/core"; export interface DialogConfig<T> { /** Custom class for the overlay pane. */ readonly panelClass?: string; /** Whether the dialog has a backdrop. */ readonly hasBackdrop?: boolean; /** Custom class for the backdrop, */ readonly backdropClass?: string; /** Whether the user can use escape or clicking outside to close a modal. */ readonly disableClose?: boolean; readonly data?: T; } export interface DialogComponent<T, R = unknown> { readonly dialogData: T; } export declare class DialogService { readonly dialog: MatDialog; constructor(dialog: MatDialog); showWarnDialog(message: string, note?: string): DialogComponent<MessageDialogConfig<unknown>, unknown>; showWarnQuestionDialog(destroyCallback: () => void, destructiveButtonLabel: string, message: string, note?: string): DialogComponent<MessageDialogConfig<boolean>, boolean>; showErrorDialog(message: string, note?: string): DialogComponent<MessageDialogConfig<unknown>, unknown>; showInfoDialog(message: string, note?: string): DialogComponent<MessageDialogConfig<unknown>, unknown>; showSuccessDialog(message: string, note?: string): DialogComponent<MessageDialogConfig<unknown>, unknown>; showQuestionDialog<R>(buttons: Array<DialogButton<R>>, answerCallback: (value?: R) => void, message: string, note?: string): DialogComponent<MessageDialogConfig<R>, R>; showMessageDialog<R>(config: { dialogType: DialogType; buttons?: Array<DialogButton<R>>; answerCallback?: (value?: R) => void; config?: DialogConfig<undefined>; title?: string; message: string; note?: string; icon?: string; }): DialogComponent<MessageDialogConfig<R>, R>; showLoaderDialog(title: string): LoaderComponent; showLoaderDialog(data: LoaderConfig): LoaderComponent; showProgressLoaderDialog(title: string): ProgressLoaderComponent; showProgressLoaderDialog(data: ProgressLoaderConfig): ProgressLoaderComponent; showDialog<T extends DialogComponent<D, R>, D, R>(dialogClass: Type<T>): T; showDialog<T extends DialogComponent<D, R>, D, R>(dialogClass: Type<T>, config?: DialogConfig<D>): T; showDialog<T extends DialogComponent<D, R>, D, R>(dialogClass: Type<T>, callback?: (result?: R) => void): T; showDialog<T extends DialogComponent<D, R>, D, R>(dialogClass: Type<T>, config?: DialogConfig<D>, callback?: (result?: R) => void): T; static ɵfac: i0.ɵɵFactoryDeclaration<DialogService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<DialogService>; }