import { CommonModule } from "@angular/common"; import { Component, ModuleWithProviders, NgModule } from "@angular/core"; import { DefaultNoComponentGlobalConfig, GlobalConfig, Toast, TOAST_CONFIG } from "ngx-toastr"; @Component({ selector: "[toast-component2]", template: ` @if (options().closeButton) { }
@if (title()) {
{{ title() }} @if (duplicatesCount) { [{{ duplicatesCount + 1 }}] }
} @if (message() && options().enableHtml) {
} @if (message() && !options().enableHtml) {
{{ message() }}
}
@if (options().progressBar) {
} `, styles: ` :host { &.toast-in { animation: toast-animation var(--animation-duration) var(--animation-easing); } &.toast-out { animation: toast-animation var(--animation-duration) var(--animation-easing) reverse forwards; } } @keyframes toast-animation { from { opacity: 0; } to { opacity: 1; } } `, preserveWhitespaces: false, standalone: false, }) export class BitwardenToast extends Toast {} export const BitwardenToastGlobalConfig: GlobalConfig = { ...DefaultNoComponentGlobalConfig, toastComponent: BitwardenToast, }; @NgModule({ imports: [CommonModule], declarations: [BitwardenToast], exports: [BitwardenToast], }) export class BitwardenToastModule { static forRoot(config: Partial = {}): ModuleWithProviders { return { ngModule: BitwardenToastModule, providers: [ { provide: TOAST_CONFIG, useValue: { default: BitwardenToastGlobalConfig, config: config, }, }, ], }; } }