UNPKG

@alfresco/adf-core

Version:
76 lines (75 loc) 3.76 kB
import { MatSnackBar, MatSnackBarRef, MatSnackBarConfig } from '@angular/material/snack-bar'; import { TranslationService } from '../../translation/translation.service'; import { Subject } from 'rxjs'; import { NotificationModel } from '../models/notification.model'; import type { SnackBarData } from '../../snackbar-content/snack-bar-data'; import * as i0 from "@angular/core"; export declare class NotificationService { private snackBar; private translationService; notifications$: Subject<NotificationModel>; constructor(snackBar: MatSnackBar, translationService: TranslationService); /** * Opens a SnackBar notification to show a message. * * @param message The message (or resource key) to show. * @param config Time before notification disappears after being shown or MatSnackBarConfig object * @param interpolateArgs The interpolation parameters to add for the translation * @returns Information/control object for the SnackBar */ openSnackMessage(message: string, config?: number | MatSnackBarConfig<Omit<SnackBarData, 'actionLabel' | 'message'>>, interpolateArgs?: any): MatSnackBarRef<any>; /** * Opens a SnackBar notification with a message and a response button. * * @param message The message (or resource key) to show. * @param action Caption for the response button * @param config Time before notification disappears after being shown or MatSnackBarConfig object * @param interpolateArgs The interpolation parameters to add for the translation * @returns Information/control object for the SnackBar */ openSnackMessageAction(message: string, action: string, config?: number | MatSnackBarConfig<Omit<SnackBarData, 'actionLabel' | 'message'>>, interpolateArgs?: any): MatSnackBarRef<any>; /** * Rase error message * * @param message Text message or translation key for the message. * @param action Action name * @param interpolateArgs The interpolation parameters to add for the translation * @param showAction True if action should be visible, false if not. Default: true. * @returns snackbar reference */ showError(message: string, action?: string, interpolateArgs?: any, showAction?: boolean): MatSnackBarRef<any>; /** * Rase info message * * @param message Text message or translation key for the message. * @param action Action name * @param interpolateArgs The interpolation parameters to add for the translation * @param showAction True if action should be visible, false if not. Default: true. * @returns snackbar reference */ showInfo(message: string, action?: string, interpolateArgs?: any, showAction?: boolean): MatSnackBarRef<any>; /** * Rase warning message * * @param message Text message or translation key for the message. * @param action Action name * @param interpolateArgs The interpolation parameters to add for the translation * @param showAction True if action should be visible, false if not. Default: true. * @returns snackbar reference */ showWarning(message: string, action?: string, interpolateArgs?: any, showAction?: boolean): MatSnackBarRef<any>; /** * dismiss the notification snackbar */ dismissSnackMessageAction(): void; /** * Push new notification to Notification History * * @param notification - Notification model to be pushed. */ pushToNotificationHistory(notification: NotificationModel): void; private dispatchNotification; private getNotificationCreator; static ɵfac: i0.ɵɵFactoryDeclaration<NotificationService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<NotificationService>; }