ngx-gem-spaas
Version:
This library contains services, components, images and styles to provide a unified look and way-of-working throughout GEM SPaaS.
64 lines (63 loc) • 2.97 kB
TypeScript
import { NgZone } from '@angular/core';
import { MatSnackBar } from '@angular/material/snack-bar';
import { Observable } from 'rxjs';
import * as i0 from "@angular/core";
export declare class SnackbarService {
snackbar: MatSnackBar;
private zone;
private confirm$;
private readonly sbConfig;
private readonly DEF_DURATION;
private duration;
static getConfirmId(type: string): string;
constructor(snackbar: MatSnackBar, zone: NgZone);
/**
* Shows a Material snackbar.
*
* @param message the message to show in the snackbar
* @param action (optional) the message to show in the snackbar action button. When no action is provided, the button
* will not show
* @param append (optional, default true) specifies whether to append the new snackbar message to the previous one
* if a previous snackbar is still active
* @param duration (optional) set a one-time specific duration in milliseconds, just for this snackbar instance
*/
message(message: string, action?: string, append?: boolean, duration?: number): void;
/**
* Shows a Material snackbar as an error (red background).
*
* @param message the message to show in the snackbar
* @param action (optional) the message to show in the snackbar action button. When no action is provided, the button
* will not show
* @param append (optional, default true) specifies whether to append the new snackbar message to the previous one
* if a previous snackbar is still active
* @param duration (optional) set a one-time specific duration in milliseconds, just for this snackbar instance
*/
error(message: string, action?: string, append?: boolean, duration?: number): void;
private open;
/**
* Shows a Material snackbar which awaits confirmation.
*
* @param message the message to show in the snackbar
* @param action the message to show in the snackbar action button. When no action is provided, the button
* will show "Got it"
* @param confirmId a unique identifier by which you can recognise the confirmation response
* that you get when listening to "onNewConfirm". Use static method "SnackbarService.getConfirmId" to get a unique id.
* @param duration (optional) set a one-time specific duration in milliseconds, just for this snackbar instance
*/
confirm(message: string, action: string | undefined, confirmId: string, duration?: number): void;
/**
* Set the global duration for all snackbars
*
* @param ms duration in milliseconds
*/
setDuration(ms: number): void;
/**
* Reset the global duration for all snackbars to default (6000)
*/
resetDuration(): void;
private newConfirm;
onNewConfirm(): Observable<string>;
close(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<SnackbarService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<SnackbarService>;
}