UNPKG

sgc-share-lib

Version:

Share the basics Models for create custom SGC UI Components. This library implements the basic data structure used to describe SGC graphics components.

86 lines (85 loc) 3.62 kB
import { MatDialog, MatDialogRef } from '@angular/material/dialog'; import { MatSnackBar } from '@angular/material/snack-bar'; import * as i0 from "@angular/core"; export declare class NotificationService { private readonly snackBar; dialog: MatDialog; constructor(snackBar: MatSnackBar, dialog: MatDialog); /** * Presents a toast displaying the message with a green background * @param message Message to display * @example * this.notificationService.success("confirm oked"); */ success(message: string): void; /** * Presents a toast displaying the message with a red background * @param message Message to display * @example * this.notificationService.error("confirm canceled"); */ error(message: string): void; /** * Shows a confirmation modal, presenting the user with * an OK and Cancel button. * @param message Body of the modal * @param okCallback Optional function to call when the user clicks Ok * @param title Optional modal title * @param cancelCallback Option function to call when the user clicks Cancel * @example * //displays a success or error message depending on what button is clicked. * this.notificationService.confirmation( * 'it will be gone forever', //message body * () => { //okCallback this.notificationService.success("confirm oked"); }, 'Are you sure?', //title () => { //cancelCallback this.notificationService.error("confirm canceled"); }); */ confirmation(message: string, title: string | undefined, okCallback: () => void, cancelCallback?: () => any): void; /** * Shows a modal, presenting the user with an OK button. * @param message Body of the modal * @param okCallback Optional function to call when the user clicks Ok * @param title Optional modal title * @example * //displays a success when the Ok button is clicked. * this.notificationService.alert("an alert", "notice", () => { this.notificationService.success("alert oked"); }); */ alert(message: string, title?: string, okCallback?: () => void): void; /** * Displays a toast with provided message * @param message Message to display * @param action Action text, e.g. Close, Done, etc * @param className Optional extra css class to apply * @param duration Optional number of SECONDS to display the notification for */ openSnackBar(message: string, action: string, className?: string, duration?: number): void; static ɵfac: i0.ɵɵFactoryDeclaration<NotificationService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<NotificationService>; } export interface DialogData { message: string; title: string; } export declare class ConfirmationDialog { dialogRef: MatDialogRef<ConfirmationDialog>; data: DialogData; constructor(dialogRef: MatDialogRef<ConfirmationDialog>, data: DialogData); onNoClick(): void; onYesClick(): void; static ɵfac: i0.ɵɵFactoryDeclaration<ConfirmationDialog, never>; static ɵcmp: i0.ɵɵComponentDeclaration<ConfirmationDialog, "ng-component", never, {}, {}, never, never, false, never>; } export declare class AlertDialog { dialogRef: MatDialogRef<AlertDialog>; data: DialogData; constructor(dialogRef: MatDialogRef<AlertDialog>, data: DialogData); onYesClick(): void; static ɵfac: i0.ɵɵFactoryDeclaration<AlertDialog, never>; static ɵcmp: i0.ɵɵComponentDeclaration<AlertDialog, "ng-component", never, {}, {}, never, never, false, never>; }