toast-message-display 18.0.6 → 20.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +114 -810
- package/fesm2022/toast-message-display.mjs +243 -188
- package/fesm2022/toast-message-display.mjs.map +1 -1
- package/package.json +9 -7
- package/toast-message-display-20.0.0.tgz +0 -0
- package/types/toast-message-display.d.ts +68 -53
- package/toast-message-display-18.0.6.tgz +0 -0
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, inject, Pipe,
|
|
3
|
-
import {
|
|
4
|
-
import { ReactiveFormsModule } from '@angular/forms';
|
|
2
|
+
import { Injectable, inject, Pipe, input, output, computed, Optional, Inject, ViewEncapsulation, Component, signal, makeEnvironmentProviders, effect } from '@angular/core';
|
|
3
|
+
import { MatSnackBar, MAT_SNACK_BAR_DATA, MatSnackBarModule } from '@angular/material/snack-bar';
|
|
5
4
|
import * as i1 from '@angular/material/icon';
|
|
6
5
|
import { MatIconModule } from '@angular/material/icon';
|
|
7
|
-
import { MatSnackBar, MAT_SNACK_BAR_DATA, MatSnackBarModule } from '@angular/material/snack-bar';
|
|
8
6
|
import * as i2 from '@angular/material/button';
|
|
9
7
|
import { MatButtonModule } from '@angular/material/button';
|
|
8
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
9
|
+
import { TitleCasePipe } from '@angular/common';
|
|
10
|
+
import * as i1$1 from '@angular/forms';
|
|
11
|
+
import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
|
|
12
|
+
import * as i2$1 from '@angular/material/toolbar';
|
|
10
13
|
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
14
|
+
import * as i5 from '@angular/material/menu';
|
|
11
15
|
import { MatMenuModule } from '@angular/material/menu';
|
|
16
|
+
import * as i6 from '@angular/material/radio';
|
|
12
17
|
import { MatRadioModule } from '@angular/material/radio';
|
|
18
|
+
import * as i7 from '@angular/material/divider';
|
|
13
19
|
import { MatDividerModule } from '@angular/material/divider';
|
|
14
|
-
import { DomSanitizer } from '@angular/platform-browser';
|
|
15
|
-
import { take } from 'rxjs/operators';
|
|
16
20
|
|
|
17
21
|
var ToastColors;
|
|
18
22
|
(function (ToastColors) {
|
|
@@ -68,10 +72,10 @@ class ColorConversionService {
|
|
|
68
72
|
parseInt(result[3], 16)
|
|
69
73
|
] : [];
|
|
70
74
|
}
|
|
71
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
72
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
75
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: ColorConversionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
76
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: ColorConversionService, providedIn: 'root' }); }
|
|
73
77
|
}
|
|
74
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
78
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: ColorConversionService, decorators: [{
|
|
75
79
|
type: Injectable,
|
|
76
80
|
args: [{
|
|
77
81
|
providedIn: 'root'
|
|
@@ -158,10 +162,10 @@ class TextColorService {
|
|
|
158
162
|
}
|
|
159
163
|
return ctx?.fillStyle;
|
|
160
164
|
}
|
|
161
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
162
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
165
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: TextColorService, deps: [{ token: ColorConversionService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
166
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: TextColorService, providedIn: 'root' }); }
|
|
163
167
|
}
|
|
164
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
168
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: TextColorService, decorators: [{
|
|
165
169
|
type: Injectable,
|
|
166
170
|
args: [{
|
|
167
171
|
providedIn: 'root'
|
|
@@ -175,75 +179,50 @@ class SafeHtmlPipe {
|
|
|
175
179
|
transform(html) {
|
|
176
180
|
return this.sanitizer.bypassSecurityTrustHtml(html);
|
|
177
181
|
}
|
|
178
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
179
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
182
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: SafeHtmlPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
183
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.0.1", ngImport: i0, type: SafeHtmlPipe, isStandalone: true, name: "safeHtml" }); }
|
|
180
184
|
}
|
|
181
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
185
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: SafeHtmlPipe, decorators: [{
|
|
182
186
|
type: Pipe,
|
|
183
187
|
args: [{
|
|
184
|
-
name: 'safeHtml'
|
|
185
|
-
standalone: false
|
|
188
|
+
name: 'safeHtml'
|
|
186
189
|
}]
|
|
187
190
|
}] });
|
|
188
191
|
|
|
189
192
|
class ToastUIComponent {
|
|
190
193
|
constructor(data) {
|
|
191
194
|
this.data = data;
|
|
192
|
-
this.
|
|
193
|
-
|
|
195
|
+
this.options = input(ToastDisplay.adapt(), /* @ts-ignore */
|
|
196
|
+
...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
197
|
+
this.close = output();
|
|
194
198
|
this.textColorService = inject(TextColorService);
|
|
195
199
|
this.snackBar = inject(MatSnackBar);
|
|
196
|
-
this.
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
--toast-bg-color: ${this.color};
|
|
205
|
-
--toast-text-color: ${this.textColor};
|
|
206
|
-
`);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
else {
|
|
210
|
-
document.documentElement.style.setProperty('--toast-bg-color', this.color);
|
|
211
|
-
document.documentElement.style.setProperty('--toast-text-color', this.textColor);
|
|
212
|
-
const hostElement = document.querySelector('.mat-snack-bar-container');
|
|
213
|
-
if (hostElement) {
|
|
214
|
-
hostElement.style.backgroundColor = this.color;
|
|
215
|
-
hostElement.style.color = this.textColor;
|
|
216
|
-
const actionButton = hostElement.querySelector('.mat-button, .mat-snack-bar-action');
|
|
217
|
-
if (actionButton) {
|
|
218
|
-
actionButton.style.color = this.textColor;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
get color() {
|
|
224
|
-
return this.options.color || '#2196f3';
|
|
225
|
-
}
|
|
226
|
-
get textColor() {
|
|
227
|
-
return this.textColorService.textColorForBgColor(this.color, '#FFFFFF', '#000000');
|
|
200
|
+
this.displayOptions = computed(() => {
|
|
201
|
+
return this.data ? ToastDisplay.adapt(this.data) : this.options();
|
|
202
|
+
}, /* @ts-ignore */
|
|
203
|
+
...(ngDevMode ? [{ debugName: "displayOptions" }] : /* istanbul ignore next */ []));
|
|
204
|
+
this.color = computed(() => this.displayOptions().color || '#2196f3', /* @ts-ignore */
|
|
205
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
206
|
+
this.textColor = computed(() => this.textColorService.textColorForBgColor(this.color(), '#FFFFFF', '#000000'), /* @ts-ignore */
|
|
207
|
+
...(ngDevMode ? [{ debugName: "textColor" }] : /* istanbul ignore next */ []));
|
|
228
208
|
}
|
|
229
209
|
onCloseToast(options) {
|
|
230
210
|
this.snackBar.dismiss();
|
|
231
|
-
|
|
211
|
+
if (options)
|
|
212
|
+
this.close.emit(options);
|
|
232
213
|
}
|
|
233
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
234
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
214
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: ToastUIComponent, deps: [{ token: MAT_SNACK_BAR_DATA, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
215
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: ToastUIComponent, isStandalone: true, selector: "app-toast-ui", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close" }, ngImport: i0, template: "<div\n class=\"toast-grid-container\"\n [class.has-icon]=\"displayOptions().icon\"\n [class.has-action]=\"displayOptions().action\"\n >\n @if (displayOptions().icon) {\n <mat-icon\n class=\"toast-icon\"\n [style.color]=\"textColor()\"\n >\n {{ displayOptions().icon }}\n </mat-icon>\n }\n\n <div\n class=\"toast-message\"\n [style.color]=\"textColor()\"\n [innerHTML]=\"displayOptions().message | safeHtml\"\n >\n </div>\n\n @if (displayOptions().action) {\n <button\n class=\"toast-action-button\"\n mat-button\n (click)=\"onCloseToast(displayOptions())\"\n [style.color]=\"textColor()\"\n >\n @if (displayOptions().action !== '-') {\n {{ displayOptions().action }}\n } @else {\n <mat-icon>close</mat-icon>\n }\n </button>\n }\n</div>\n", styles: [".mat-mdc-snack-bar-container{--mat-snackbar-container-color: var(--toast-bg-color, #fff);--mat-mdc-snack-bar-button-color: var(--toast-text-color, #fff);--mat-snackbar-supporting-text-color: var(--toast-text-color, #000)}.mat-mdc-snack-bar-container .mdc-snackbar__surface{max-width:100%!important;width:100%}.mat-mdc-snackbar-surface{padding-right:0}.cdk-overlay-pane{width:100%}.cdk-overlay-container{position:fixed;top:0;left:0;width:100%;z-index:1000}.toast-grid-container{display:grid;grid-template-columns:1fr}.toast-grid-container.has-action{grid-template-columns:1fr auto}.toast-grid-container.has-icon{grid-template-columns:minmax(0,44px) 1fr}.toast-grid-container.has-icon.has-action{grid-template-columns:minmax(0,44px) 1fr auto}.toast-grid-container>*{display:inline-flex;overflow:hidden;align-items:center}.toast-icon{margin-top:.25rem;grid-column:1;display:flex;align-items:center;justify-content:center;max-width:44px;overflow:hidden}.toast-message{word-wrap:break-word;overflow-wrap:break-word;white-space:normal;flex-grow:1}.toast-action-button{justify-self:end}\n"], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "pipe", type: SafeHtmlPipe, name: "safeHtml" }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
235
216
|
}
|
|
236
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
217
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: ToastUIComponent, decorators: [{
|
|
237
218
|
type: Component,
|
|
238
|
-
args: [{ selector: 'app-toast-ui', encapsulation: ViewEncapsulation.None,
|
|
219
|
+
args: [{ selector: 'app-toast-ui', encapsulation: ViewEncapsulation.None, imports: [MatIconModule, MatButtonModule, SafeHtmlPipe], template: "<div\n class=\"toast-grid-container\"\n [class.has-icon]=\"displayOptions().icon\"\n [class.has-action]=\"displayOptions().action\"\n >\n @if (displayOptions().icon) {\n <mat-icon\n class=\"toast-icon\"\n [style.color]=\"textColor()\"\n >\n {{ displayOptions().icon }}\n </mat-icon>\n }\n\n <div\n class=\"toast-message\"\n [style.color]=\"textColor()\"\n [innerHTML]=\"displayOptions().message | safeHtml\"\n >\n </div>\n\n @if (displayOptions().action) {\n <button\n class=\"toast-action-button\"\n mat-button\n (click)=\"onCloseToast(displayOptions())\"\n [style.color]=\"textColor()\"\n >\n @if (displayOptions().action !== '-') {\n {{ displayOptions().action }}\n } @else {\n <mat-icon>close</mat-icon>\n }\n </button>\n }\n</div>\n", styles: [".mat-mdc-snack-bar-container{--mat-snackbar-container-color: var(--toast-bg-color, #fff);--mat-mdc-snack-bar-button-color: var(--toast-text-color, #fff);--mat-snackbar-supporting-text-color: var(--toast-text-color, #000)}.mat-mdc-snack-bar-container .mdc-snackbar__surface{max-width:100%!important;width:100%}.mat-mdc-snackbar-surface{padding-right:0}.cdk-overlay-pane{width:100%}.cdk-overlay-container{position:fixed;top:0;left:0;width:100%;z-index:1000}.toast-grid-container{display:grid;grid-template-columns:1fr}.toast-grid-container.has-action{grid-template-columns:1fr auto}.toast-grid-container.has-icon{grid-template-columns:minmax(0,44px) 1fr}.toast-grid-container.has-icon.has-action{grid-template-columns:minmax(0,44px) 1fr auto}.toast-grid-container>*{display:inline-flex;overflow:hidden;align-items:center}.toast-icon{margin-top:.25rem;grid-column:1;display:flex;align-items:center;justify-content:center;max-width:44px;overflow:hidden}.toast-message{word-wrap:break-word;overflow-wrap:break-word;white-space:normal;flex-grow:1}.toast-action-button{justify-self:end}\n"] }]
|
|
239
220
|
}], ctorParameters: () => [{ type: ToastDisplay, decorators: [{
|
|
221
|
+
type: Optional
|
|
222
|
+
}, {
|
|
240
223
|
type: Inject,
|
|
241
224
|
args: [MAT_SNACK_BAR_DATA]
|
|
242
|
-
}] }], propDecorators: { close: [{
|
|
243
|
-
type: Output
|
|
244
|
-
}], options: [{
|
|
245
|
-
type: Input
|
|
246
|
-
}] } });
|
|
225
|
+
}] }], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], close: [{ type: i0.Output, args: ["close"] }] } });
|
|
247
226
|
|
|
248
227
|
var HorizontalAlignment;
|
|
249
228
|
(function (HorizontalAlignment) {
|
|
@@ -258,17 +237,6 @@ var VerticalAlignment;
|
|
|
258
237
|
VerticalAlignment["BOTTOM"] = "bottom";
|
|
259
238
|
})(VerticalAlignment || (VerticalAlignment = {}));
|
|
260
239
|
|
|
261
|
-
class ToastMessage {
|
|
262
|
-
constructor(error = '', action = '', icon = 'error') {
|
|
263
|
-
this.error = error;
|
|
264
|
-
this.action = action;
|
|
265
|
-
this.icon = icon;
|
|
266
|
-
}
|
|
267
|
-
static adapt(item) {
|
|
268
|
-
return new ToastMessage(item?.error, item?.action, item?.icon);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
240
|
class ToastOptions {
|
|
273
241
|
constructor(duration, horizontalPosition = HorizontalAlignment.CENTER, verticalPosition = VerticalAlignment.TOP, data) {
|
|
274
242
|
this.duration = duration;
|
|
@@ -282,24 +250,97 @@ class ToastOptions {
|
|
|
282
250
|
}
|
|
283
251
|
}
|
|
284
252
|
|
|
253
|
+
class ToastMessageDisplayService {
|
|
254
|
+
constructor() {
|
|
255
|
+
this.snackBar = inject(MatSnackBar);
|
|
256
|
+
this.toastQueue = signal([], /* @ts-ignore */
|
|
257
|
+
...(ngDevMode ? [{ debugName: "toastQueue" }] : /* istanbul ignore next */ []));
|
|
258
|
+
this.isToastVisible = signal(false, /* @ts-ignore */
|
|
259
|
+
...(ngDevMode ? [{ debugName: "isToastVisible" }] : /* istanbul ignore next */ []));
|
|
260
|
+
this.defaultDuration = 3;
|
|
261
|
+
}
|
|
262
|
+
toastMessage(options = ToastDisplay.adapt(), duration, vertical) {
|
|
263
|
+
this.toastQueue.update(queue => [...queue, { options, duration, vertical }]);
|
|
264
|
+
this.showNextToast();
|
|
265
|
+
}
|
|
266
|
+
showNextToast() {
|
|
267
|
+
if (this.isToastVisible() || this.toastQueue().length === 0)
|
|
268
|
+
return;
|
|
269
|
+
const queue = this.toastQueue();
|
|
270
|
+
const { options, duration, vertical } = queue[0];
|
|
271
|
+
this.toastQueue.set(queue.slice(1));
|
|
272
|
+
const vertPosition = (vertical) ? vertical : 'top';
|
|
273
|
+
const durationDismiss = (!options.action) ? this.defaultDuration : duration;
|
|
274
|
+
const displayOptions = ToastOptions.adapt({
|
|
275
|
+
duration: durationDismiss,
|
|
276
|
+
horizontalPosition: 'center',
|
|
277
|
+
verticalPosition: vertPosition,
|
|
278
|
+
data: options,
|
|
279
|
+
});
|
|
280
|
+
this.isToastVisible.set(true);
|
|
281
|
+
this.snackBarRef = this.snackBar.openFromComponent(ToastUIComponent, displayOptions);
|
|
282
|
+
if (this.snackBarRef) {
|
|
283
|
+
this.snackBarRef
|
|
284
|
+
.afterDismissed()
|
|
285
|
+
.subscribe(() => {
|
|
286
|
+
this.isToastVisible.set(false);
|
|
287
|
+
this.showNextToast();
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
console.error('Snackbar reference is undefined. Unable to subscribe to dismissal event.');
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: ToastMessageDisplayService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
295
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: ToastMessageDisplayService, providedIn: 'root' }); }
|
|
296
|
+
}
|
|
297
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: ToastMessageDisplayService, decorators: [{
|
|
298
|
+
type: Injectable,
|
|
299
|
+
args: [{
|
|
300
|
+
providedIn: 'root'
|
|
301
|
+
}]
|
|
302
|
+
}] });
|
|
303
|
+
|
|
304
|
+
function provideToast() {
|
|
305
|
+
return makeEnvironmentProviders([
|
|
306
|
+
ToastMessageDisplayService
|
|
307
|
+
]);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
class ToastMessage {
|
|
311
|
+
constructor(error = '', action = '', icon = 'error') {
|
|
312
|
+
this.error = error;
|
|
313
|
+
this.action = action;
|
|
314
|
+
this.icon = icon;
|
|
315
|
+
}
|
|
316
|
+
static adapt(item) {
|
|
317
|
+
return new ToastMessage(item?.error, item?.action, item?.icon);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
285
321
|
class ToastMessageInlineComponent {
|
|
286
322
|
constructor() {
|
|
287
|
-
this.close =
|
|
323
|
+
this.close = output();
|
|
288
324
|
this.textColorService = inject(TextColorService);
|
|
289
325
|
this.toastList = [];
|
|
290
326
|
this.dismissToasts = [];
|
|
291
|
-
this.
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
327
|
+
this.toast = input(null, /* @ts-ignore */
|
|
328
|
+
...(ngDevMode ? [{ debugName: "toast" }] : /* istanbul ignore next */ []));
|
|
329
|
+
this.duration = input(-1, /* @ts-ignore */
|
|
330
|
+
...(ngDevMode ? [{ debugName: "duration" }] : /* istanbul ignore next */ []));
|
|
331
|
+
this.position = input(VerticalAlignment.TOP, /* @ts-ignore */
|
|
332
|
+
...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
|
|
333
|
+
effect(() => {
|
|
334
|
+
const value = this.toast();
|
|
335
|
+
if (!value)
|
|
336
|
+
return;
|
|
337
|
+
const toast = ToastDisplay.adapt(value);
|
|
338
|
+
if (!toast.action) {
|
|
339
|
+
this.dismissToasts.push(toast);
|
|
340
|
+
this.expireTime(toast, this.duration());
|
|
341
|
+
}
|
|
342
|
+
this.toastList.push(toast);
|
|
343
|
+
});
|
|
303
344
|
}
|
|
304
345
|
get option() {
|
|
305
346
|
return (this.toastList.length > 0) ? this.toastList[0] : null;
|
|
@@ -312,7 +353,8 @@ class ToastMessageInlineComponent {
|
|
|
312
353
|
}
|
|
313
354
|
onCloseToast(toast) {
|
|
314
355
|
this.toastList = this.toastList.filter(item => item.id !== toast?.id);
|
|
315
|
-
|
|
356
|
+
if (toast)
|
|
357
|
+
this.close.emit(toast);
|
|
316
358
|
}
|
|
317
359
|
expireTime(toast, duration) {
|
|
318
360
|
if (duration <= 0)
|
|
@@ -324,118 +366,131 @@ class ToastMessageInlineComponent {
|
|
|
324
366
|
this.dismissToasts = this.dismissToasts.filter(t => t.id !== toast.id);
|
|
325
367
|
this.toastList = this.toastList.filter(t => t.id !== toast.id);
|
|
326
368
|
}
|
|
327
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
328
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
369
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: ToastMessageInlineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
370
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: ToastMessageInlineComponent, isStandalone: true, selector: "app-toast-message-display-inline", inputs: { toast: { classPropertyName: "toast", publicName: "toast", isSignal: true, isRequired: false, transformFunction: null }, duration: { classPropertyName: "duration", publicName: "duration", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close" }, ngImport: i0, template: "<div class=\"toast-inline-list\" [class.position-bottom]=\"position() === 'bottom'\">\n @for (toast of toastList; track toast) {\n <div [style.background-color]=\"toast.color\" class=\"inline\">\n <app-toast-ui\n [options]=\"toast\"\n class=\"toast-inline-item\"\n (close)=\"onCloseToast(toast)\"\n ></app-toast-ui>\n </div>\n }\n</div>\n", styles: [".toast-inline-list{display:flex;flex-direction:column;gap:.5rem}.toast-inline-list.position-bottom{flex-direction:column-reverse}.toast-inline-item{flex:1}.inline{padding:.75rem;border-radius:.25rem}\n"], dependencies: [{ kind: "component", type: ToastUIComponent, selector: "app-toast-ui", inputs: ["options"], outputs: ["close"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "ngmodule", type: MatButtonModule }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
329
371
|
}
|
|
330
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
372
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: ToastMessageInlineComponent, decorators: [{
|
|
331
373
|
type: Component,
|
|
332
|
-
args: [{ selector: 'app-toast-message-display-inline',
|
|
333
|
-
}], propDecorators: { close: [{
|
|
334
|
-
type: Output
|
|
335
|
-
}], toast: [{
|
|
336
|
-
type: Input
|
|
337
|
-
}], duration: [{
|
|
338
|
-
type: Input
|
|
339
|
-
}], position: [{
|
|
340
|
-
type: Input
|
|
341
|
-
}] } });
|
|
374
|
+
args: [{ selector: 'app-toast-message-display-inline', encapsulation: ViewEncapsulation.None, imports: [ToastUIComponent, MatIconModule, MatButtonModule, SafeHtmlPipe], template: "<div class=\"toast-inline-list\" [class.position-bottom]=\"position() === 'bottom'\">\n @for (toast of toastList; track toast) {\n <div [style.background-color]=\"toast.color\" class=\"inline\">\n <app-toast-ui\n [options]=\"toast\"\n class=\"toast-inline-item\"\n (close)=\"onCloseToast(toast)\"\n ></app-toast-ui>\n </div>\n }\n</div>\n", styles: [".toast-inline-list{display:flex;flex-direction:column;gap:.5rem}.toast-inline-list.position-bottom{flex-direction:column-reverse}.toast-inline-item{flex:1}.inline{padding:.75rem;border-radius:.25rem}\n"] }]
|
|
375
|
+
}], ctorParameters: () => [], propDecorators: { close: [{ type: i0.Output, args: ["close"] }], toast: [{ type: i0.Input, args: [{ isSignal: true, alias: "toast", required: false }] }], duration: [{ type: i0.Input, args: [{ isSignal: true, alias: "duration", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }] } });
|
|
342
376
|
|
|
343
|
-
class
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
377
|
+
class ToastDemoComponent {
|
|
378
|
+
constructor() {
|
|
379
|
+
this.random = () => {
|
|
380
|
+
const typedArray = new Uint8Array(1);
|
|
381
|
+
const randomValue = crypto.getRandomValues(typedArray)[0];
|
|
382
|
+
const randomFloat = randomValue / Math.pow(2, 8);
|
|
383
|
+
return randomFloat;
|
|
384
|
+
};
|
|
385
|
+
this.randomNumber = (min, max) => {
|
|
386
|
+
return Math.floor(this.random() * max) + min;
|
|
387
|
+
};
|
|
388
|
+
this.fb = inject(FormBuilder);
|
|
389
|
+
this.toastMessageDisplayService = inject(ToastMessageDisplayService);
|
|
390
|
+
this.type = 'Basic';
|
|
391
|
+
this.position = this.fb.control('top');
|
|
392
|
+
this.icons = [
|
|
393
|
+
'favorite_border',
|
|
394
|
+
'dashboard',
|
|
395
|
+
'event',
|
|
396
|
+
'paid',
|
|
397
|
+
'notifications',
|
|
398
|
+
'movie_filter',
|
|
399
|
+
];
|
|
400
|
+
this.toastSamples = [
|
|
401
|
+
{
|
|
402
|
+
message: `This is a simple toast message. This is a <span style="font-size: 22px">simple toast message</span>. This is a simple toast message. This is a simple toast message`,
|
|
403
|
+
color: ToastColors.ERROR,
|
|
404
|
+
action: "Ok"
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
message: 'Sample message',
|
|
408
|
+
color: ToastColors.INFO,
|
|
409
|
+
icon: this.icons[0]
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
message: 'Sample message',
|
|
413
|
+
color: ToastColors.WARN,
|
|
414
|
+
icon: this.icons[1]
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
message: `This is a simple toast message. This is a <span style="font-size: 22px">simple toast message</span>. This is a simple toast message. This is a simple toast message`,
|
|
418
|
+
color: ToastColors.NOTIFY,
|
|
419
|
+
icon: this.icons[2],
|
|
420
|
+
action: "Dismiss"
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
message: 'Sample message',
|
|
424
|
+
color: ToastColors.GENERAL,
|
|
425
|
+
action: "Dismiss"
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
message: `This is a simple toast message. This is a <span style="font-size: 22px">simple toast message</span>. This is a simple toast message. This is a simple toast message`,
|
|
429
|
+
color: ToastColors.SUCCESS,
|
|
430
|
+
action: "-"
|
|
431
|
+
},
|
|
432
|
+
];
|
|
433
|
+
}
|
|
434
|
+
onSelectType(type) {
|
|
435
|
+
this.type = type;
|
|
436
|
+
}
|
|
437
|
+
onBasic(type, icon, action) {
|
|
438
|
+
switch (type) {
|
|
439
|
+
case 'ERROR':
|
|
440
|
+
this.presentToast(ToastColors.ERROR, icon, action);
|
|
441
|
+
break;
|
|
442
|
+
case 'INFO':
|
|
443
|
+
this.presentToast(ToastColors.INFO, icon, action);
|
|
444
|
+
break;
|
|
445
|
+
case 'WARN':
|
|
446
|
+
this.presentToast(ToastColors.WARN, icon, action);
|
|
447
|
+
break;
|
|
448
|
+
case 'NOTIFY':
|
|
449
|
+
this.presentToast(ToastColors.NOTIFY, icon, action);
|
|
450
|
+
break;
|
|
451
|
+
case 'GENERAL':
|
|
452
|
+
this.presentToast(ToastColors.GENERAL, icon, action);
|
|
453
|
+
break;
|
|
454
|
+
default:
|
|
455
|
+
this.presentToast(ToastColors.SUCCESS, icon, action);
|
|
456
|
+
break;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
presentToast(color, icon, action) {
|
|
460
|
+
const options = ToastDisplay.adapt({
|
|
461
|
+
message: `This is a simple toast message. <span style="font-size: 22px">simple toast message</span>. This is a simple toast message. This is a simple toast message`,
|
|
462
|
+
color,
|
|
463
|
+
icon,
|
|
464
|
+
action
|
|
465
|
+
});
|
|
466
|
+
const toastPosition = (this.position.value === 'top') ? VerticalAlignment.TOP : VerticalAlignment.BOTTOM;
|
|
467
|
+
this.toastMessageDisplayService.toastMessage(options, -1, toastPosition);
|
|
468
|
+
}
|
|
469
|
+
onInline() {
|
|
470
|
+
const pick = this.randomNumber(0, this.toastSamples.length - 1);
|
|
471
|
+
this.pickToastSample = this.toastSamples[pick];
|
|
472
|
+
}
|
|
473
|
+
onClosedToast(toast) {
|
|
474
|
+
console.log(toast);
|
|
475
|
+
}
|
|
476
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: ToastDemoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
477
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: ToastDemoComponent, isStandalone: true, selector: "app-toast-display-demo", ngImport: i0, template: "<mat-toolbar class=\"demo-toolbar\">\n <div>Toast Message Demo</div>\n <div class=\"demo-toolbar-title\">\n <button\n mat-stroked-button\n [matMenuTriggerFor]=\"menu\"\n matIconPrefix\n >\n {{ type | titlecase }}\n <mat-icon>layers</mat-icon>\n </button>\n </div>\n</mat-toolbar>\n\n<mat-menu #menu=\"matMenu\">\n <button\n mat-menu-item\n (click)=\"onSelectType('basic')\"\n >\n Basic\n </button>\n <button\n mat-menu-item\n (click)=\"onSelectType('icon')\"\n >\n Icon\n </button>\n <button\n mat-menu-item\n (click)=\"onSelectType('action')\"\n >\n Action\n </button>\n</mat-menu>\n\n<div class=\"demo-container\">\n <span>\n @switch (type) {\n @case ('icon') {\n <div>\n <div class=\"demo-section\">\n <h3 class=\"demo-title\">Toast with Icon</h3>\n <div class=\"demo-button-row\">\n <button\n mat-stroked-button\n (click)=\"onBasic('SUCCESS', 'favorite_border')\"\n >\n Icon - SUCCESS\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('ERROR', 'dashboard')\"\n >\n Icon - ERROR\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('INFO', 'event')\"\n >\n Icon - INFO\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('WARN', 'paid')\"\n >\n Icon - WARN\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('WARN', 'notifications')\"\n >\n Icon - NOTIFY\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('WARN', 'movie_filter')\"\n >\n Icon - GENERAL\n </button>\n </div>\n </div>\n </div>\n }\n @case ('action') {\n <div>\n <div class=\"demo-section\">\n <h3 class=\"demo-title\">Toast with Icon and Action</h3>\n <div class=\"demo-button-row\">\n <button\n mat-stroked-button\n (click)=\"onBasic('SUCCESS', 'favorite_border', 'Dismiss')\"\n >\n Action - SUCCESS\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('ERROR', 'dashboard', 'Dismiss')\"\n >\n Action - ERROR\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('INFO', 'event', 'Dismiss')\"\n >\n Action - INFO\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('WARN', 'paid', 'Dismiss')\"\n >\n Action - WARN\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('NOTIFY', 'notifications', 'Dismiss')\"\n >\n Action - NOTIFY\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('GENERAL', 'movie_filter', 'Dismiss')\"\n >\n Action - GENERAL\n </button>\n </div>\n </div>\n </div>\n }\n @default {\n <div>\n <div class=\"demo-section\">\n <h3 class=\"demo-title\">Basic Toast</h3>\n <div class=\"demo-button-row\">\n <button\n mat-stroked-button\n (click)=\"onBasic('SUCCESS')\"\n >\n Basic - SUCCESS\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('ERROR')\"\n >\n Basic - ERROR\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('INFO')\"\n >\n Basic - INFO\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('WARN')\"\n >\n Basic - WARN\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('NOTIFY')\"\n >\n Basic - NOTIFY\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('GENERAL')\"\n >\n Basic - GENERAL\n </button>\n </div>\n </div>\n </div>\n }\n }\n </span>\n <div class=\"demo-position-controls\">\n <mat-radio-group [formControl]=\"position\" class=\"demo-radio-group\">\n <mat-radio-button value=\"top\">Top Position</mat-radio-button>\n <mat-radio-button value=\"bottom\">Bottom Position</mat-radio-button>\n </mat-radio-group>\n </div>\n</div>\n\n<div class=\"demo-divider\">\n <mat-divider></mat-divider>\n</div>\n\n<div class=\"demo-container\">\n <button mat-stroked-button (click)=\"onInline()\" class=\"demo-inline-button\">\n Add Inline Toast Message\n </button>\n <app-toast-message-display-inline\n [toast]=\"pickToastSample\"\n [duration]=\"5\"\n (close)=\"onClosedToast($event)\"\n ></app-toast-message-display-inline>\n</div>\n", styles: [".bold{font-size:22px;font-weight:700}.demo-toolbar{display:flex}.demo-toolbar-title{flex:1;text-align:end}.demo-container{margin:1rem}.demo-section{display:flex;gap:1rem;flex-direction:column}.demo-title{flex:1;margin-bottom:0}.demo-button-row{display:flex;gap:.5rem}.demo-position-controls{display:flex;margin-top:1rem}.demo-radio-group{display:flex;gap:2rem}.demo-divider{margin-top:1rem;margin-bottom:1rem}.demo-inline-button{margin-bottom:2rem}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatToolbarModule }, { kind: "component", type: i2$1.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i5.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i5.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i5.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "ngmodule", type: MatRadioModule }, { kind: "directive", type: i6.MatRadioGroup, selector: "mat-radio-group", inputs: ["color", "name", "labelPosition", "value", "selected", "disabled", "required", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioGroup"] }, { kind: "component", type: i6.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }, { kind: "ngmodule", type: MatSnackBarModule }, { kind: "ngmodule", type: MatDividerModule }, { kind: "component", type: i7.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "component", type: ToastMessageInlineComponent, selector: "app-toast-message-display-inline", inputs: ["toast", "duration", "position"], outputs: ["close"] }, { kind: "pipe", type: TitleCasePipe, name: "titlecase" }] }); }
|
|
366
478
|
}
|
|
367
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
368
|
-
type:
|
|
369
|
-
args: [{
|
|
370
|
-
|
|
371
|
-
CommonModule,
|
|
479
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: ToastDemoComponent, decorators: [{
|
|
480
|
+
type: Component,
|
|
481
|
+
args: [{ selector: 'app-toast-display-demo', imports: [
|
|
482
|
+
TitleCasePipe,
|
|
372
483
|
ReactiveFormsModule,
|
|
484
|
+
MatToolbarModule,
|
|
373
485
|
MatIconModule,
|
|
374
|
-
MatSnackBarModule,
|
|
375
486
|
MatButtonModule,
|
|
376
|
-
MatToolbarModule,
|
|
377
487
|
MatMenuModule,
|
|
378
488
|
MatRadioModule,
|
|
489
|
+
MatSnackBarModule,
|
|
379
490
|
MatDividerModule,
|
|
380
|
-
],
|
|
381
|
-
declarations: [
|
|
382
|
-
SafeHtmlPipe,
|
|
383
|
-
ToastUIComponent,
|
|
384
491
|
ToastMessageInlineComponent,
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
ToastUIComponent,
|
|
388
|
-
ToastMessageInlineComponent,
|
|
389
|
-
],
|
|
390
|
-
}]
|
|
391
|
-
}] });
|
|
392
|
-
|
|
393
|
-
class ToastMessageDisplayService {
|
|
394
|
-
constructor() {
|
|
395
|
-
this.snackBar = inject(MatSnackBar);
|
|
396
|
-
this.toastQueue = [];
|
|
397
|
-
this.isToastVisible = false;
|
|
398
|
-
this.defaultDuration = 3;
|
|
399
|
-
}
|
|
400
|
-
toastMessage(options = ToastDisplay.adapt(), duration, vertical) {
|
|
401
|
-
this.toastQueue.push({ options, duration, vertical });
|
|
402
|
-
this.showNextToast();
|
|
403
|
-
}
|
|
404
|
-
showNextToast() {
|
|
405
|
-
if (this.isToastVisible || this.toastQueue.length === 0)
|
|
406
|
-
return;
|
|
407
|
-
const { options, duration, vertical } = this.toastQueue.shift();
|
|
408
|
-
const vertPosition = (vertical) ? vertical : 'top';
|
|
409
|
-
const durationDismiss = (!options.action) ? this.defaultDuration : duration;
|
|
410
|
-
const displayOptions = ToastOptions.adapt({
|
|
411
|
-
duration: durationDismiss,
|
|
412
|
-
horizontalPosition: 'center',
|
|
413
|
-
verticalPosition: vertPosition,
|
|
414
|
-
data: options,
|
|
415
|
-
});
|
|
416
|
-
this.isToastVisible = true;
|
|
417
|
-
this.snackBarRef = this.snackBar.openFromComponent(ToastUIComponent, displayOptions);
|
|
418
|
-
if (this.snackBarRef) {
|
|
419
|
-
this.snackBarRef
|
|
420
|
-
.afterDismissed()
|
|
421
|
-
.pipe(take(1))
|
|
422
|
-
.subscribe(() => {
|
|
423
|
-
this.isToastVisible = false;
|
|
424
|
-
this.showNextToast();
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
else {
|
|
428
|
-
console.error('Snackbar reference is undefined. Unable to subscribe to dismissal event.');
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ToastMessageDisplayService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
432
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ToastMessageDisplayService, providedIn: 'root' }); }
|
|
433
|
-
}
|
|
434
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ToastMessageDisplayService, decorators: [{
|
|
435
|
-
type: Injectable,
|
|
436
|
-
args: [{
|
|
437
|
-
providedIn: 'root'
|
|
438
|
-
}]
|
|
492
|
+
SafeHtmlPipe
|
|
493
|
+
], template: "<mat-toolbar class=\"demo-toolbar\">\n <div>Toast Message Demo</div>\n <div class=\"demo-toolbar-title\">\n <button\n mat-stroked-button\n [matMenuTriggerFor]=\"menu\"\n matIconPrefix\n >\n {{ type | titlecase }}\n <mat-icon>layers</mat-icon>\n </button>\n </div>\n</mat-toolbar>\n\n<mat-menu #menu=\"matMenu\">\n <button\n mat-menu-item\n (click)=\"onSelectType('basic')\"\n >\n Basic\n </button>\n <button\n mat-menu-item\n (click)=\"onSelectType('icon')\"\n >\n Icon\n </button>\n <button\n mat-menu-item\n (click)=\"onSelectType('action')\"\n >\n Action\n </button>\n</mat-menu>\n\n<div class=\"demo-container\">\n <span>\n @switch (type) {\n @case ('icon') {\n <div>\n <div class=\"demo-section\">\n <h3 class=\"demo-title\">Toast with Icon</h3>\n <div class=\"demo-button-row\">\n <button\n mat-stroked-button\n (click)=\"onBasic('SUCCESS', 'favorite_border')\"\n >\n Icon - SUCCESS\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('ERROR', 'dashboard')\"\n >\n Icon - ERROR\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('INFO', 'event')\"\n >\n Icon - INFO\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('WARN', 'paid')\"\n >\n Icon - WARN\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('WARN', 'notifications')\"\n >\n Icon - NOTIFY\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('WARN', 'movie_filter')\"\n >\n Icon - GENERAL\n </button>\n </div>\n </div>\n </div>\n }\n @case ('action') {\n <div>\n <div class=\"demo-section\">\n <h3 class=\"demo-title\">Toast with Icon and Action</h3>\n <div class=\"demo-button-row\">\n <button\n mat-stroked-button\n (click)=\"onBasic('SUCCESS', 'favorite_border', 'Dismiss')\"\n >\n Action - SUCCESS\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('ERROR', 'dashboard', 'Dismiss')\"\n >\n Action - ERROR\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('INFO', 'event', 'Dismiss')\"\n >\n Action - INFO\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('WARN', 'paid', 'Dismiss')\"\n >\n Action - WARN\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('NOTIFY', 'notifications', 'Dismiss')\"\n >\n Action - NOTIFY\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('GENERAL', 'movie_filter', 'Dismiss')\"\n >\n Action - GENERAL\n </button>\n </div>\n </div>\n </div>\n }\n @default {\n <div>\n <div class=\"demo-section\">\n <h3 class=\"demo-title\">Basic Toast</h3>\n <div class=\"demo-button-row\">\n <button\n mat-stroked-button\n (click)=\"onBasic('SUCCESS')\"\n >\n Basic - SUCCESS\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('ERROR')\"\n >\n Basic - ERROR\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('INFO')\"\n >\n Basic - INFO\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('WARN')\"\n >\n Basic - WARN\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('NOTIFY')\"\n >\n Basic - NOTIFY\n </button>\n <button\n mat-stroked-button\n (click)=\"onBasic('GENERAL')\"\n >\n Basic - GENERAL\n </button>\n </div>\n </div>\n </div>\n }\n }\n </span>\n <div class=\"demo-position-controls\">\n <mat-radio-group [formControl]=\"position\" class=\"demo-radio-group\">\n <mat-radio-button value=\"top\">Top Position</mat-radio-button>\n <mat-radio-button value=\"bottom\">Bottom Position</mat-radio-button>\n </mat-radio-group>\n </div>\n</div>\n\n<div class=\"demo-divider\">\n <mat-divider></mat-divider>\n</div>\n\n<div class=\"demo-container\">\n <button mat-stroked-button (click)=\"onInline()\" class=\"demo-inline-button\">\n Add Inline Toast Message\n </button>\n <app-toast-message-display-inline\n [toast]=\"pickToastSample\"\n [duration]=\"5\"\n (close)=\"onClosedToast($event)\"\n ></app-toast-message-display-inline>\n</div>\n", styles: [".bold{font-size:22px;font-weight:700}.demo-toolbar{display:flex}.demo-toolbar-title{flex:1;text-align:end}.demo-container{margin:1rem}.demo-section{display:flex;gap:1rem;flex-direction:column}.demo-title{flex:1;margin-bottom:0}.demo-button-row{display:flex;gap:.5rem}.demo-position-controls{display:flex;margin-top:1rem}.demo-radio-group{display:flex;gap:2rem}.demo-divider{margin-top:1rem;margin-bottom:1rem}.demo-inline-button{margin-bottom:2rem}\n"] }]
|
|
439
494
|
}] });
|
|
440
495
|
|
|
441
496
|
/*
|
|
@@ -446,5 +501,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
446
501
|
* Generated bundle index. Do not edit.
|
|
447
502
|
*/
|
|
448
503
|
|
|
449
|
-
export { HorizontalAlignment, ToastColors, ToastDisplay, ToastMessage,
|
|
504
|
+
export { HorizontalAlignment, ToastColors, ToastDemoComponent, ToastDisplay, ToastMessage, ToastMessageDisplayService, ToastMessageInlineComponent, ToastOptions, ToastUIComponent, VerticalAlignment, provideToast };
|
|
450
505
|
//# sourceMappingURL=toast-message-display.mjs.map
|