@esfaenza/extensions 20.3.6 → 20.3.8
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/fesm2022/esfaenza-extensions.mjs +874 -6
- package/fesm2022/esfaenza-extensions.mjs.map +1 -1
- package/index.d.ts +407 -3
- package/package.json +2 -3
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, Optional, Inject, Injectable, Pipe,
|
|
2
|
+
import { InjectionToken, Optional, Inject, Injectable, Pipe, inject, ElementRef, Directive, createComponent, ApplicationRef, Injector, NgZone, SecurityContext, signal, computed, linkedSignal, ChangeDetectionStrategy, Component, ViewEncapsulation, NgModule, PLATFORM_ID } from '@angular/core';
|
|
3
3
|
import * as i1 from '@esfaenza/localizations';
|
|
4
4
|
import { LocalizationModule } from '@esfaenza/localizations';
|
|
5
5
|
import { first, filter, take, map } from 'rxjs/operators';
|
|
6
|
-
import { ReplaySubject,
|
|
6
|
+
import { ReplaySubject, Subject, of, filter as filter$1, take as take$1, debounceTime } from 'rxjs';
|
|
7
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
7
8
|
import * as i3 from '@angular/common';
|
|
8
|
-
import { isPlatformBrowser } from '@angular/common';
|
|
9
|
-
import { ToastrService } from 'ngx-toastr';
|
|
9
|
+
import { DOCUMENT, isPlatformBrowser } from '@angular/common';
|
|
10
10
|
import swal from 'sweetalert2';
|
|
11
11
|
import * as i2 from '@angular/router';
|
|
12
12
|
import * as XLSX from 'xlsx';
|
|
@@ -303,12 +303,876 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImpo
|
|
|
303
303
|
}]
|
|
304
304
|
}], ctorParameters: () => [{ type: DateService }] });
|
|
305
305
|
|
|
306
|
+
class ToastContainerDirective {
|
|
307
|
+
el = inject(ElementRef);
|
|
308
|
+
getContainerElement() {
|
|
309
|
+
return this.el.nativeElement;
|
|
310
|
+
}
|
|
311
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ToastContainerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
312
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.24", type: ToastContainerDirective, isStandalone: true, selector: "[toastContainer]", exportAs: ["toastContainer"], ngImport: i0 });
|
|
313
|
+
}
|
|
314
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ToastContainerDirective, decorators: [{
|
|
315
|
+
type: Directive,
|
|
316
|
+
args: [{
|
|
317
|
+
selector: '[toastContainer]',
|
|
318
|
+
exportAs: 'toastContainer',
|
|
319
|
+
standalone: true,
|
|
320
|
+
}]
|
|
321
|
+
}] });
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Everything a toast needs to launch
|
|
325
|
+
*/
|
|
326
|
+
class ToastPackage {
|
|
327
|
+
toastId;
|
|
328
|
+
config;
|
|
329
|
+
message;
|
|
330
|
+
title;
|
|
331
|
+
toastType;
|
|
332
|
+
toastRef;
|
|
333
|
+
_onTap = new Subject();
|
|
334
|
+
_onAction = new Subject();
|
|
335
|
+
constructor(toastId, config, message, title, toastType, toastRef) {
|
|
336
|
+
this.toastId = toastId;
|
|
337
|
+
this.config = config;
|
|
338
|
+
this.message = message;
|
|
339
|
+
this.title = title;
|
|
340
|
+
this.toastType = toastType;
|
|
341
|
+
this.toastRef = toastRef;
|
|
342
|
+
this.toastRef.afterClosed().subscribe(() => {
|
|
343
|
+
this._onAction.complete();
|
|
344
|
+
this._onTap.complete();
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
/** Fired on click */
|
|
348
|
+
triggerTap() {
|
|
349
|
+
this._onTap.next();
|
|
350
|
+
if (this.config.tapToDismiss) {
|
|
351
|
+
this._onTap.complete();
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
onTap() {
|
|
355
|
+
return this._onTap.asObservable();
|
|
356
|
+
}
|
|
357
|
+
/** available for use in custom toast */
|
|
358
|
+
triggerAction(action) {
|
|
359
|
+
this._onAction.next(action);
|
|
360
|
+
}
|
|
361
|
+
onAction() {
|
|
362
|
+
return this._onAction.asObservable();
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
const DefaultNoComponentGlobalConfig = {
|
|
366
|
+
maxOpened: 0,
|
|
367
|
+
autoDismiss: false,
|
|
368
|
+
newestOnTop: true,
|
|
369
|
+
preventDuplicates: false,
|
|
370
|
+
countDuplicates: false,
|
|
371
|
+
resetTimeoutOnDuplicate: false,
|
|
372
|
+
includeTitleDuplicates: false,
|
|
373
|
+
iconClasses: {
|
|
374
|
+
error: 'toast-error',
|
|
375
|
+
info: 'toast-info',
|
|
376
|
+
success: 'toast-success',
|
|
377
|
+
warning: 'toast-warning',
|
|
378
|
+
},
|
|
379
|
+
// Individual
|
|
380
|
+
closeButton: false,
|
|
381
|
+
disableTimeOut: false,
|
|
382
|
+
timeOut: 5000,
|
|
383
|
+
extendedTimeOut: 1000,
|
|
384
|
+
enableHtml: false,
|
|
385
|
+
progressBar: false,
|
|
386
|
+
toastClass: 'ngx-toastr',
|
|
387
|
+
positionClass: 'toast-top-right',
|
|
388
|
+
titleClass: 'toast-title',
|
|
389
|
+
messageClass: 'toast-message',
|
|
390
|
+
easing: 'ease-in',
|
|
391
|
+
easeTime: 300,
|
|
392
|
+
tapToDismiss: true,
|
|
393
|
+
onActivateTick: false,
|
|
394
|
+
progressAnimation: 'decreasing',
|
|
395
|
+
};
|
|
396
|
+
const TOAST_CONFIG = new InjectionToken('ToastConfig');
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* A `ComponentPortal` is a portal that instantiates some Component upon attachment.
|
|
400
|
+
*/
|
|
401
|
+
class ComponentPortal {
|
|
402
|
+
_attachedHost;
|
|
403
|
+
/** The type of the component that will be instantiated for attachment. */
|
|
404
|
+
component;
|
|
405
|
+
/**
|
|
406
|
+
* [Optional] Where the attached component should live in Angular's *logical* component tree.
|
|
407
|
+
* This is different from where the component *renders*, which is determined by the PortalHost.
|
|
408
|
+
* The origin necessary when the host is outside of the Angular application context.
|
|
409
|
+
*/
|
|
410
|
+
viewContainerRef;
|
|
411
|
+
/** Injector used for the instantiation of the component. */
|
|
412
|
+
injector;
|
|
413
|
+
constructor(component, injector) {
|
|
414
|
+
this.component = component;
|
|
415
|
+
this.injector = injector;
|
|
416
|
+
}
|
|
417
|
+
/** Attach this portal to a host. */
|
|
418
|
+
attach(host, newestOnTop) {
|
|
419
|
+
this._attachedHost = host;
|
|
420
|
+
return host.attach(this, newestOnTop);
|
|
421
|
+
}
|
|
422
|
+
/** Detach this portal from its host */
|
|
423
|
+
detach() {
|
|
424
|
+
const host = this._attachedHost;
|
|
425
|
+
if (host) {
|
|
426
|
+
this._attachedHost = undefined;
|
|
427
|
+
return host.detach();
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
/** Whether this portal is attached to a host. */
|
|
431
|
+
get isAttached() {
|
|
432
|
+
return this._attachedHost != null;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Sets the PortalHost reference without performing `attach()`. This is used directly by
|
|
436
|
+
* the PortalHost when it is performing an `attach()` or `detach()`.
|
|
437
|
+
*/
|
|
438
|
+
setAttachedHost(host) {
|
|
439
|
+
this._attachedHost = host;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Partial implementation of PortalHost that only deals with attaching a
|
|
444
|
+
* ComponentPortal
|
|
445
|
+
*/
|
|
446
|
+
class BasePortalHost {
|
|
447
|
+
/** The portal currently attached to the host. */
|
|
448
|
+
_attachedPortal;
|
|
449
|
+
/** A function that will permanently dispose this host. */
|
|
450
|
+
_disposeFn;
|
|
451
|
+
attach(portal, newestOnTop) {
|
|
452
|
+
this._attachedPortal = portal;
|
|
453
|
+
return this.attachComponentPortal(portal, newestOnTop);
|
|
454
|
+
}
|
|
455
|
+
detach() {
|
|
456
|
+
if (this._attachedPortal) {
|
|
457
|
+
this._attachedPortal.setAttachedHost();
|
|
458
|
+
}
|
|
459
|
+
this._attachedPortal = undefined;
|
|
460
|
+
if (this._disposeFn) {
|
|
461
|
+
this._disposeFn();
|
|
462
|
+
this._disposeFn = undefined;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
setDisposeFn(fn) {
|
|
466
|
+
this._disposeFn = fn;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* A PortalHost for attaching portals to an arbitrary DOM element outside of the Angular
|
|
472
|
+
* application context.
|
|
473
|
+
*
|
|
474
|
+
* This is the only part of the portal core that directly touches the DOM.
|
|
475
|
+
*/
|
|
476
|
+
class DomPortalHost extends BasePortalHost {
|
|
477
|
+
_hostDomElement;
|
|
478
|
+
_appRef;
|
|
479
|
+
constructor(_hostDomElement, _appRef) {
|
|
480
|
+
super();
|
|
481
|
+
this._hostDomElement = _hostDomElement;
|
|
482
|
+
this._appRef = _appRef;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Attach the given ComponentPortal to DOM element using the ComponentFactoryResolver.
|
|
486
|
+
* @param portal Portal to be attached
|
|
487
|
+
*/
|
|
488
|
+
attachComponentPortal(portal, newestOnTop) {
|
|
489
|
+
// If the portal specifies a ViewContainerRef, we will use that as the attachment point
|
|
490
|
+
// for the component (in terms of Angular's component tree, not rendering).
|
|
491
|
+
// When the ViewContainerRef is missing, we use the factory to create the component directly
|
|
492
|
+
// and then manually attach the ChangeDetector for that component to the application (which
|
|
493
|
+
// happens automatically when using a ViewContainer).
|
|
494
|
+
const componentRef = createComponent(portal.component, {
|
|
495
|
+
environmentInjector: this._appRef.injector,
|
|
496
|
+
elementInjector: portal.injector,
|
|
497
|
+
});
|
|
498
|
+
// When creating a component outside of a ViewContainer, we need to manually register
|
|
499
|
+
// its ChangeDetector with the application. This API is unfortunately not yet published
|
|
500
|
+
// in Angular core. The change detector must also be deregistered when the component
|
|
501
|
+
// is destroyed to prevent memory leaks.
|
|
502
|
+
this._appRef.attachView(componentRef.hostView);
|
|
503
|
+
this.setDisposeFn(() => {
|
|
504
|
+
this._appRef.detachView(componentRef.hostView);
|
|
505
|
+
componentRef.destroy();
|
|
506
|
+
});
|
|
507
|
+
// At this point the component has been instantiated, so we move it to the location in the DOM
|
|
508
|
+
// where we want it to be rendered.
|
|
509
|
+
if (newestOnTop) {
|
|
510
|
+
this._hostDomElement.insertBefore(this._getComponentRootNode(componentRef), this._hostDomElement.firstChild);
|
|
511
|
+
}
|
|
512
|
+
else {
|
|
513
|
+
this._hostDomElement.appendChild(this._getComponentRootNode(componentRef));
|
|
514
|
+
}
|
|
515
|
+
return componentRef;
|
|
516
|
+
}
|
|
517
|
+
/** Gets the root HTMLElement for an instantiated component. */
|
|
518
|
+
_getComponentRootNode(componentRef) {
|
|
519
|
+
return componentRef.hostView.rootNodes[0];
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
/** Container inside which all toasts will render. */
|
|
524
|
+
class OverlayContainer {
|
|
525
|
+
_document = inject(DOCUMENT);
|
|
526
|
+
_containerElement;
|
|
527
|
+
ngOnDestroy() {
|
|
528
|
+
if (this._containerElement && this._containerElement.parentNode) {
|
|
529
|
+
this._containerElement.parentNode.removeChild(this._containerElement);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* This method returns the overlay container element. It will lazily
|
|
534
|
+
* create the element the first time it is called to facilitate using
|
|
535
|
+
* the container in non-browser environments.
|
|
536
|
+
* @returns the container element
|
|
537
|
+
*/
|
|
538
|
+
getContainerElement() {
|
|
539
|
+
if (!this._containerElement) {
|
|
540
|
+
this._createContainer();
|
|
541
|
+
}
|
|
542
|
+
return this._containerElement;
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Create the overlay container element, which is simply a div
|
|
546
|
+
* with the 'cdk-overlay-container' class on the document body
|
|
547
|
+
* and 'aria-live="polite"'
|
|
548
|
+
*/
|
|
549
|
+
_createContainer() {
|
|
550
|
+
const container = this._document.createElement('div');
|
|
551
|
+
container.classList.add('overlay-container');
|
|
552
|
+
container.setAttribute('aria-live', 'polite');
|
|
553
|
+
this._document.body.appendChild(container);
|
|
554
|
+
this._containerElement = container;
|
|
555
|
+
}
|
|
556
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: OverlayContainer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
557
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: OverlayContainer, providedIn: 'root' });
|
|
558
|
+
}
|
|
559
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: OverlayContainer, decorators: [{
|
|
560
|
+
type: Injectable,
|
|
561
|
+
args: [{ providedIn: 'root' }]
|
|
562
|
+
}] });
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Reference to an overlay that has been created with the Overlay service.
|
|
566
|
+
* Used to manipulate or dispose of said overlay.
|
|
567
|
+
*/
|
|
568
|
+
class OverlayRef {
|
|
569
|
+
_portalHost;
|
|
570
|
+
constructor(_portalHost) {
|
|
571
|
+
this._portalHost = _portalHost;
|
|
572
|
+
}
|
|
573
|
+
attach(portal, newestOnTop = true) {
|
|
574
|
+
return this._portalHost.attach(portal, newestOnTop);
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Detaches an overlay from a portal.
|
|
578
|
+
* @returns Resolves when the overlay has been detached.
|
|
579
|
+
*/
|
|
580
|
+
detach() {
|
|
581
|
+
return this._portalHost.detach();
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* Service to create Overlays. Overlays are dynamically added pieces of floating UI, meant to be
|
|
587
|
+
* used as a low-level building building block for other components. Dialogs, tooltips, menus,
|
|
588
|
+
* selects, etc. can all be built using overlays. The service should primarily be used by authors
|
|
589
|
+
* of re-usable components rather than developers building end-user applications.
|
|
590
|
+
*
|
|
591
|
+
* An overlay *is* a PortalHost, so any kind of Portal can be loaded into one.
|
|
592
|
+
*/
|
|
593
|
+
class Overlay {
|
|
594
|
+
_overlayContainer = inject(OverlayContainer);
|
|
595
|
+
_appRef = inject(ApplicationRef);
|
|
596
|
+
_document = inject(DOCUMENT);
|
|
597
|
+
// Namespace panes by overlay container
|
|
598
|
+
_paneElements = new Map();
|
|
599
|
+
/**
|
|
600
|
+
* Creates an overlay.
|
|
601
|
+
* @returns A reference to the created overlay.
|
|
602
|
+
*/
|
|
603
|
+
create(positionClass, overlayContainer) {
|
|
604
|
+
// get existing pane if possible
|
|
605
|
+
return this._createOverlayRef(this.getPaneElement(positionClass, overlayContainer));
|
|
606
|
+
}
|
|
607
|
+
getPaneElement(positionClass = '', overlayContainer) {
|
|
608
|
+
if (!this._paneElements.get(overlayContainer)) {
|
|
609
|
+
this._paneElements.set(overlayContainer, {});
|
|
610
|
+
}
|
|
611
|
+
if (!this._paneElements.get(overlayContainer)[positionClass]) {
|
|
612
|
+
this._paneElements.get(overlayContainer)[positionClass] =
|
|
613
|
+
this._createPaneElement(positionClass, overlayContainer);
|
|
614
|
+
}
|
|
615
|
+
return this._paneElements.get(overlayContainer)[positionClass];
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* Creates the DOM element for an overlay and appends it to the overlay container.
|
|
619
|
+
* @returns Newly-created pane element
|
|
620
|
+
*/
|
|
621
|
+
_createPaneElement(positionClass, overlayContainer) {
|
|
622
|
+
const pane = this._document.createElement('div');
|
|
623
|
+
pane.id = 'toast-container';
|
|
624
|
+
pane.classList.add(positionClass);
|
|
625
|
+
pane.classList.add('toast-container');
|
|
626
|
+
if (!overlayContainer) {
|
|
627
|
+
this._overlayContainer.getContainerElement().appendChild(pane);
|
|
628
|
+
}
|
|
629
|
+
else {
|
|
630
|
+
overlayContainer.getContainerElement().appendChild(pane);
|
|
631
|
+
}
|
|
632
|
+
return pane;
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Create a DomPortalHost into which the overlay content can be loaded.
|
|
636
|
+
* @param pane The DOM element to turn into a portal host.
|
|
637
|
+
* @returns A portal host for the given DOM element.
|
|
638
|
+
*/
|
|
639
|
+
_createPortalHost(pane) {
|
|
640
|
+
return new DomPortalHost(pane, this._appRef);
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* Creates an OverlayRef for an overlay in the given DOM element.
|
|
644
|
+
* @param pane DOM element for the overlay
|
|
645
|
+
*/
|
|
646
|
+
_createOverlayRef(pane) {
|
|
647
|
+
return new OverlayRef(this._createPortalHost(pane));
|
|
648
|
+
}
|
|
649
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: Overlay, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
650
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: Overlay, providedIn: 'root' });
|
|
651
|
+
}
|
|
652
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: Overlay, decorators: [{
|
|
653
|
+
type: Injectable,
|
|
654
|
+
args: [{ providedIn: 'root' }]
|
|
655
|
+
}] });
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* Reference to a toast opened via the Toastr service.
|
|
659
|
+
*/
|
|
660
|
+
class ToastRef {
|
|
661
|
+
_overlayRef;
|
|
662
|
+
/** The instance of component opened into the toast. */
|
|
663
|
+
componentInstance;
|
|
664
|
+
/** Count of duplicates of this toast */
|
|
665
|
+
duplicatesCount = 0;
|
|
666
|
+
/** Subject for notifying the user that the toast has finished closing. */
|
|
667
|
+
_afterClosed = new Subject();
|
|
668
|
+
/** triggered when toast is activated */
|
|
669
|
+
_activate = new Subject();
|
|
670
|
+
/** notifies the toast that it should close before the timeout */
|
|
671
|
+
_manualClose = new Subject();
|
|
672
|
+
/** notifies the toast that it should reset the timeouts */
|
|
673
|
+
_resetTimeout = new Subject();
|
|
674
|
+
/** notifies the toast that it should count a duplicate toast */
|
|
675
|
+
_countDuplicate = new Subject();
|
|
676
|
+
constructor(_overlayRef) {
|
|
677
|
+
this._overlayRef = _overlayRef;
|
|
678
|
+
}
|
|
679
|
+
manualClose() {
|
|
680
|
+
this._manualClose.next();
|
|
681
|
+
this._manualClose.complete();
|
|
682
|
+
}
|
|
683
|
+
manualClosed() {
|
|
684
|
+
return this._manualClose.asObservable();
|
|
685
|
+
}
|
|
686
|
+
timeoutReset() {
|
|
687
|
+
return this._resetTimeout.asObservable();
|
|
688
|
+
}
|
|
689
|
+
countDuplicate() {
|
|
690
|
+
return this._countDuplicate.asObservable();
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Close the toast.
|
|
694
|
+
*/
|
|
695
|
+
close() {
|
|
696
|
+
this._overlayRef.detach();
|
|
697
|
+
this._afterClosed.next();
|
|
698
|
+
this._manualClose.next();
|
|
699
|
+
this._afterClosed.complete();
|
|
700
|
+
this._manualClose.complete();
|
|
701
|
+
this._activate.complete();
|
|
702
|
+
this._resetTimeout.complete();
|
|
703
|
+
this._countDuplicate.complete();
|
|
704
|
+
}
|
|
705
|
+
/** Gets an observable that is notified when the toast is finished closing. */
|
|
706
|
+
afterClosed() {
|
|
707
|
+
return this._afterClosed.asObservable();
|
|
708
|
+
}
|
|
709
|
+
isInactive() {
|
|
710
|
+
return this._activate.closed;
|
|
711
|
+
}
|
|
712
|
+
activate() {
|
|
713
|
+
this._activate.next();
|
|
714
|
+
this._activate.complete();
|
|
715
|
+
}
|
|
716
|
+
/** Gets an observable that is notified when the toast has started opening. */
|
|
717
|
+
afterActivate() {
|
|
718
|
+
return this._activate.asObservable();
|
|
719
|
+
}
|
|
720
|
+
/** Reset the toast timouts and count duplicates */
|
|
721
|
+
onDuplicate(resetTimeout, countDuplicate) {
|
|
722
|
+
if (resetTimeout) {
|
|
723
|
+
this._resetTimeout.next();
|
|
724
|
+
}
|
|
725
|
+
if (countDuplicate) {
|
|
726
|
+
this._countDuplicate.next(++this.duplicatesCount);
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
class ToastrService {
|
|
732
|
+
overlay = inject(Overlay);
|
|
733
|
+
_injector = inject(Injector);
|
|
734
|
+
sanitizer = inject(DomSanitizer);
|
|
735
|
+
ngZone = inject(NgZone);
|
|
736
|
+
toastrConfig;
|
|
737
|
+
currentlyActive = 0;
|
|
738
|
+
toasts = [];
|
|
739
|
+
overlayContainer;
|
|
740
|
+
previousToastMessage;
|
|
741
|
+
index = 0;
|
|
742
|
+
constructor() {
|
|
743
|
+
const token = inject(TOAST_CONFIG);
|
|
744
|
+
this.toastrConfig = {
|
|
745
|
+
...token.default,
|
|
746
|
+
...token.config,
|
|
747
|
+
};
|
|
748
|
+
if (token.config.iconClasses) {
|
|
749
|
+
this.toastrConfig.iconClasses = {
|
|
750
|
+
...token.default.iconClasses,
|
|
751
|
+
...token.config.iconClasses,
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
/** show toast */
|
|
756
|
+
show(message, title, override = {}, type = '') {
|
|
757
|
+
return this._preBuildNotification(type, message, title, this.applyConfig(override));
|
|
758
|
+
}
|
|
759
|
+
/** show successful toast */
|
|
760
|
+
success(message, title, override = {}) {
|
|
761
|
+
const type = this.toastrConfig.iconClasses.success || '';
|
|
762
|
+
return this._preBuildNotification(type, message, title, this.applyConfig(override));
|
|
763
|
+
}
|
|
764
|
+
/** show error toast */
|
|
765
|
+
error(message, title, override = {}) {
|
|
766
|
+
const type = this.toastrConfig.iconClasses.error || '';
|
|
767
|
+
return this._preBuildNotification(type, message, title, this.applyConfig(override));
|
|
768
|
+
}
|
|
769
|
+
/** show info toast */
|
|
770
|
+
info(message, title, override = {}) {
|
|
771
|
+
const type = this.toastrConfig.iconClasses.info || '';
|
|
772
|
+
return this._preBuildNotification(type, message, title, this.applyConfig(override));
|
|
773
|
+
}
|
|
774
|
+
/** show warning toast */
|
|
775
|
+
warning(message, title, override = {}) {
|
|
776
|
+
const type = this.toastrConfig.iconClasses.warning || '';
|
|
777
|
+
return this._preBuildNotification(type, message, title, this.applyConfig(override));
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* Remove all or a single toast by id
|
|
781
|
+
*/
|
|
782
|
+
clear(toastId) {
|
|
783
|
+
// Call every toastRef manualClose function
|
|
784
|
+
for (const toast of this.toasts) {
|
|
785
|
+
if (toastId !== undefined) {
|
|
786
|
+
if (toast.toastId === toastId) {
|
|
787
|
+
toast.toastRef.manualClose();
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
else {
|
|
792
|
+
toast.toastRef.manualClose();
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Remove and destroy a single toast by id
|
|
798
|
+
*/
|
|
799
|
+
remove(toastId) {
|
|
800
|
+
const found = this._findToast(toastId);
|
|
801
|
+
if (!found) {
|
|
802
|
+
return false;
|
|
803
|
+
}
|
|
804
|
+
found.activeToast.toastRef.close();
|
|
805
|
+
this.toasts.splice(found.index, 1);
|
|
806
|
+
this.currentlyActive = this.currentlyActive - 1;
|
|
807
|
+
if (!this.toastrConfig.maxOpened || !this.toasts.length) {
|
|
808
|
+
return false;
|
|
809
|
+
}
|
|
810
|
+
if (this.currentlyActive < this.toastrConfig.maxOpened && this.toasts[this.currentlyActive]) {
|
|
811
|
+
const p = this.toasts[this.currentlyActive].toastRef;
|
|
812
|
+
if (!p.isInactive()) {
|
|
813
|
+
this.currentlyActive = this.currentlyActive + 1;
|
|
814
|
+
p.activate();
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
return true;
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* Determines if toast message is already shown
|
|
821
|
+
*/
|
|
822
|
+
findDuplicate(title = '', message = '', resetOnDuplicate, countDuplicates) {
|
|
823
|
+
const { includeTitleDuplicates } = this.toastrConfig;
|
|
824
|
+
for (const toast of this.toasts) {
|
|
825
|
+
const hasDuplicateTitle = includeTitleDuplicates && toast.title === title;
|
|
826
|
+
if ((!includeTitleDuplicates || hasDuplicateTitle) && toast.message === message) {
|
|
827
|
+
toast.toastRef.onDuplicate(resetOnDuplicate, countDuplicates);
|
|
828
|
+
return toast;
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
return null;
|
|
832
|
+
}
|
|
833
|
+
/** create a clone of global config and apply individual settings */
|
|
834
|
+
applyConfig(override = {}) {
|
|
835
|
+
return { ...this.toastrConfig, ...override };
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Find toast object by id
|
|
839
|
+
*/
|
|
840
|
+
_findToast(toastId) {
|
|
841
|
+
for (let i = 0; i < this.toasts.length; i++) {
|
|
842
|
+
if (this.toasts[i].toastId === toastId) {
|
|
843
|
+
return { index: i, activeToast: this.toasts[i] };
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
return null;
|
|
847
|
+
}
|
|
848
|
+
/**
|
|
849
|
+
* Determines the need to run inside angular's zone then builds the toast
|
|
850
|
+
*/
|
|
851
|
+
_preBuildNotification(toastType, message, title, config) {
|
|
852
|
+
if (config.onActivateTick) {
|
|
853
|
+
return this.ngZone.run(() => this._buildNotification(toastType, message, title, config));
|
|
854
|
+
}
|
|
855
|
+
return this._buildNotification(toastType, message, title, config);
|
|
856
|
+
}
|
|
857
|
+
/**
|
|
858
|
+
* Creates and attaches toast data to component
|
|
859
|
+
* returns the active toast, or in case preventDuplicates is enabled the original/non-duplicate active toast.
|
|
860
|
+
*/
|
|
861
|
+
_buildNotification(toastType, message, title, config) {
|
|
862
|
+
if (!config.toastComponent) {
|
|
863
|
+
throw new Error('toastComponent required');
|
|
864
|
+
}
|
|
865
|
+
// max opened and auto dismiss = true
|
|
866
|
+
// if timeout = 0 resetting it would result in setting this.hideTime = Date.now(). Hence, we only want to reset timeout if there is
|
|
867
|
+
// a timeout at all
|
|
868
|
+
const duplicate = this.findDuplicate(title, message, this.toastrConfig.resetTimeoutOnDuplicate && config.timeOut > 0, this.toastrConfig.countDuplicates);
|
|
869
|
+
if (((this.toastrConfig.includeTitleDuplicates && title) || message) &&
|
|
870
|
+
this.toastrConfig.preventDuplicates &&
|
|
871
|
+
duplicate !== null) {
|
|
872
|
+
return duplicate;
|
|
873
|
+
}
|
|
874
|
+
this.previousToastMessage = message;
|
|
875
|
+
let keepInactive = false;
|
|
876
|
+
if (this.toastrConfig.maxOpened && this.currentlyActive >= this.toastrConfig.maxOpened) {
|
|
877
|
+
keepInactive = true;
|
|
878
|
+
if (this.toastrConfig.autoDismiss) {
|
|
879
|
+
this.clear(this.toasts[0].toastId);
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
const overlayRef = this.overlay.create(config.positionClass, this.overlayContainer);
|
|
883
|
+
this.index = this.index + 1;
|
|
884
|
+
let sanitizedMessage = message;
|
|
885
|
+
if (message && config.enableHtml) {
|
|
886
|
+
sanitizedMessage = this.sanitizer.sanitize(SecurityContext.HTML, message);
|
|
887
|
+
}
|
|
888
|
+
const toastRef = new ToastRef(overlayRef);
|
|
889
|
+
const toastPackage = new ToastPackage(this.index, config, sanitizedMessage, title, toastType, toastRef);
|
|
890
|
+
/** New injector that contains an instance of `ToastPackage`. */
|
|
891
|
+
const providers = [{ provide: ToastPackage, useValue: toastPackage }];
|
|
892
|
+
const toastInjector = Injector.create({ providers, parent: this._injector });
|
|
893
|
+
const component = new ComponentPortal(config.toastComponent, toastInjector);
|
|
894
|
+
const portal = overlayRef.attach(component, config.newestOnTop);
|
|
895
|
+
toastRef.componentInstance = portal.instance;
|
|
896
|
+
const ins = {
|
|
897
|
+
toastId: this.index,
|
|
898
|
+
title: title || '',
|
|
899
|
+
message: message || '',
|
|
900
|
+
toastRef,
|
|
901
|
+
onShown: toastRef.afterActivate(),
|
|
902
|
+
onHidden: toastRef.afterClosed(),
|
|
903
|
+
onTap: toastPackage.onTap(),
|
|
904
|
+
onAction: toastPackage.onAction(),
|
|
905
|
+
portal,
|
|
906
|
+
};
|
|
907
|
+
if (!keepInactive) {
|
|
908
|
+
this.currentlyActive = this.currentlyActive + 1;
|
|
909
|
+
setTimeout(() => {
|
|
910
|
+
ins.toastRef.activate();
|
|
911
|
+
});
|
|
912
|
+
}
|
|
913
|
+
this.toasts.push(ins);
|
|
914
|
+
return ins;
|
|
915
|
+
}
|
|
916
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ToastrService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
917
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ToastrService, providedIn: 'root' });
|
|
918
|
+
}
|
|
919
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ToastrService, decorators: [{
|
|
920
|
+
type: Injectable,
|
|
921
|
+
args: [{ providedIn: 'root' }]
|
|
922
|
+
}], ctorParameters: () => [] });
|
|
923
|
+
|
|
924
|
+
class TimeoutsService {
|
|
925
|
+
ngZone = inject(NgZone);
|
|
926
|
+
setInterval(func, timeout) {
|
|
927
|
+
if (this.ngZone) {
|
|
928
|
+
return this.ngZone.runOutsideAngular(() => window.setInterval(() => this.runInsideAngular(func), timeout));
|
|
929
|
+
}
|
|
930
|
+
else {
|
|
931
|
+
return window.setInterval(() => func(), timeout);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
setTimeout(func, timeout) {
|
|
935
|
+
if (this.ngZone) {
|
|
936
|
+
return this.ngZone.runOutsideAngular(() => window.setTimeout(() => this.runInsideAngular(func), timeout));
|
|
937
|
+
}
|
|
938
|
+
else {
|
|
939
|
+
return window.setTimeout(() => func(), timeout);
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
runInsideAngular(func) {
|
|
943
|
+
if (this.ngZone) {
|
|
944
|
+
this.ngZone.run(() => func());
|
|
945
|
+
}
|
|
946
|
+
else {
|
|
947
|
+
func();
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: TimeoutsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
951
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: TimeoutsService, providedIn: 'root' });
|
|
952
|
+
}
|
|
953
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: TimeoutsService, decorators: [{
|
|
954
|
+
type: Injectable,
|
|
955
|
+
args: [{ providedIn: 'root' }]
|
|
956
|
+
}] });
|
|
957
|
+
|
|
958
|
+
class ToastBase {
|
|
959
|
+
toastPackage = inject(ToastPackage);
|
|
960
|
+
toastrService = inject(ToastrService);
|
|
961
|
+
appRef = inject(ApplicationRef);
|
|
962
|
+
timeoutsService = inject(TimeoutsService);
|
|
963
|
+
duplicatesCount;
|
|
964
|
+
hideTime;
|
|
965
|
+
/** width of progress bar */
|
|
966
|
+
width = signal(-1, ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
967
|
+
state = signal('inactive', ...(ngDevMode ? [{ debugName: "state" }] : []));
|
|
968
|
+
/** hides component when waiting to be displayed */
|
|
969
|
+
displayStyle = computed(() => (this.state() === 'inactive' ? 'none' : undefined), ...(ngDevMode ? [{ debugName: "displayStyle" }] : []));
|
|
970
|
+
message = computed(() => this.toastPackage.message, ...(ngDevMode ? [{ debugName: "message" }] : []));
|
|
971
|
+
title = computed(() => this.toastPackage.title, ...(ngDevMode ? [{ debugName: "title" }] : []));
|
|
972
|
+
options = linkedSignal(() => this.toastPackage.config, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
973
|
+
originalTimeout = computed(() => this.toastPackage.config.timeOut, ...(ngDevMode ? [{ debugName: "originalTimeout" }] : []));
|
|
974
|
+
toastClasses = computed(() => `${this.toastPackage.toastType} ${this.toastPackage.config.toastClass}`, ...(ngDevMode ? [{ debugName: "toastClasses" }] : []));
|
|
975
|
+
timeout;
|
|
976
|
+
intervalId;
|
|
977
|
+
afterActivateSubscription;
|
|
978
|
+
manualClosedSubscription;
|
|
979
|
+
timeoutResetSubscription;
|
|
980
|
+
countDuplicateSubscription;
|
|
981
|
+
constructor() {
|
|
982
|
+
this.afterActivateSubscription = this.toastPackage.toastRef.afterActivate().subscribe(() => {
|
|
983
|
+
this.activateToast();
|
|
984
|
+
});
|
|
985
|
+
this.manualClosedSubscription = this.toastPackage.toastRef.manualClosed().subscribe(() => {
|
|
986
|
+
this.remove();
|
|
987
|
+
});
|
|
988
|
+
this.timeoutResetSubscription = this.toastPackage.toastRef.timeoutReset().subscribe(() => {
|
|
989
|
+
this.resetTimeout();
|
|
990
|
+
});
|
|
991
|
+
this.countDuplicateSubscription = this.toastPackage.toastRef
|
|
992
|
+
.countDuplicate()
|
|
993
|
+
.subscribe(count => {
|
|
994
|
+
this.duplicatesCount = count;
|
|
995
|
+
});
|
|
996
|
+
}
|
|
997
|
+
ngOnDestroy() {
|
|
998
|
+
this.afterActivateSubscription.unsubscribe();
|
|
999
|
+
this.manualClosedSubscription.unsubscribe();
|
|
1000
|
+
this.timeoutResetSubscription.unsubscribe();
|
|
1001
|
+
this.countDuplicateSubscription.unsubscribe();
|
|
1002
|
+
clearInterval(this.intervalId);
|
|
1003
|
+
clearTimeout(this.timeout);
|
|
1004
|
+
}
|
|
1005
|
+
/**
|
|
1006
|
+
* activates toast and sets timeout
|
|
1007
|
+
*/
|
|
1008
|
+
activateToast() {
|
|
1009
|
+
const options = this.options();
|
|
1010
|
+
this.state.set('active');
|
|
1011
|
+
if (!(options.disableTimeOut === true || options.disableTimeOut === 'timeOut') &&
|
|
1012
|
+
options.timeOut) {
|
|
1013
|
+
this.timeout = this.timeoutsService.setTimeout(() => this.remove(), options.timeOut);
|
|
1014
|
+
this.hideTime = new Date().getTime() + options.timeOut;
|
|
1015
|
+
if (options.progressBar) {
|
|
1016
|
+
this.intervalId = this.timeoutsService.setInterval(() => this.updateProgress(), 10);
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
/**
|
|
1021
|
+
* updates progress bar width
|
|
1022
|
+
*/
|
|
1023
|
+
updateProgress() {
|
|
1024
|
+
const options = this.options();
|
|
1025
|
+
if (this.width() === 0 || this.width() === 100 || !options.timeOut) {
|
|
1026
|
+
return;
|
|
1027
|
+
}
|
|
1028
|
+
const now = new Date().getTime();
|
|
1029
|
+
const remaining = this.hideTime - now;
|
|
1030
|
+
this.width.set((remaining / options.timeOut) * 100);
|
|
1031
|
+
if (options.progressAnimation === 'increasing') {
|
|
1032
|
+
this.width.update(width => 100 - width);
|
|
1033
|
+
}
|
|
1034
|
+
if (this.width() <= 0) {
|
|
1035
|
+
this.width.set(0);
|
|
1036
|
+
}
|
|
1037
|
+
if (this.width() >= 100) {
|
|
1038
|
+
this.width.set(100);
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
resetTimeout() {
|
|
1042
|
+
const options = this.options();
|
|
1043
|
+
clearTimeout(this.timeout);
|
|
1044
|
+
clearInterval(this.intervalId);
|
|
1045
|
+
this.state.set('active');
|
|
1046
|
+
this.options.update(options => ({ ...options, timeOut: this.originalTimeout() }));
|
|
1047
|
+
this.timeout = this.timeoutsService.setTimeout(() => this.remove(), this.originalTimeout());
|
|
1048
|
+
this.hideTime = new Date().getTime() + (this.originalTimeout() || 0);
|
|
1049
|
+
this.width.set(-1);
|
|
1050
|
+
if (options.progressBar)
|
|
1051
|
+
this.intervalId = this.timeoutsService.setInterval(() => this.updateProgress(), 10);
|
|
1052
|
+
}
|
|
1053
|
+
/**
|
|
1054
|
+
* tells toastrService to remove this toast after animation time
|
|
1055
|
+
*/
|
|
1056
|
+
remove() {
|
|
1057
|
+
if (this.state() === 'removed')
|
|
1058
|
+
return;
|
|
1059
|
+
clearTimeout(this.timeout);
|
|
1060
|
+
this.state.set('removed');
|
|
1061
|
+
this.timeout = this.timeoutsService.setTimeout(() => this.toastrService.remove(this.toastPackage.toastId));
|
|
1062
|
+
}
|
|
1063
|
+
tapToast() {
|
|
1064
|
+
if (this.state() === 'removed')
|
|
1065
|
+
return;
|
|
1066
|
+
this.toastPackage.triggerTap();
|
|
1067
|
+
if (this.options().tapToDismiss) {
|
|
1068
|
+
this.remove();
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
stickAround() {
|
|
1072
|
+
if (this.state() === 'removed')
|
|
1073
|
+
return;
|
|
1074
|
+
if (this.options().disableTimeOut !== 'extendedTimeOut') {
|
|
1075
|
+
clearTimeout(this.timeout);
|
|
1076
|
+
this.options.update(options => ({ ...options, timeOut: 0 }));
|
|
1077
|
+
this.hideTime = 0;
|
|
1078
|
+
// disable progressBar
|
|
1079
|
+
clearInterval(this.intervalId);
|
|
1080
|
+
this.width.set(0);
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
delayedHideToast() {
|
|
1084
|
+
const options = this.options();
|
|
1085
|
+
if (options.disableTimeOut === true ||
|
|
1086
|
+
options.disableTimeOut === 'extendedTimeOut' ||
|
|
1087
|
+
options.extendedTimeOut === 0 ||
|
|
1088
|
+
this.state() === 'removed') {
|
|
1089
|
+
return;
|
|
1090
|
+
}
|
|
1091
|
+
const extendedTimeOut = options.extendedTimeOut;
|
|
1092
|
+
this.timeout = this.timeoutsService.setTimeout(() => this.remove(), extendedTimeOut);
|
|
1093
|
+
this.options.update(options => ({ ...options, timeOut: extendedTimeOut }));
|
|
1094
|
+
this.hideTime = new Date().getTime() + (extendedTimeOut || 0);
|
|
1095
|
+
this.width.set(-1);
|
|
1096
|
+
if (options.progressBar) {
|
|
1097
|
+
this.intervalId = this.timeoutsService.setInterval(() => this.updateProgress(), 10);
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ToastBase, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1101
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: ToastBase, isStandalone: true, selector: "[toast-component]", host: { listeners: { "mouseenter": "stickAround()", "mouseleave": "delayedHideToast()", "click": "tapToast()" }, properties: { "class": "toastClasses()", "style.display": "displayStyle()" } }, ngImport: i0, template: "@let _options = options();\n\n@if (_options.closeButton) {\n <button (click)=\"remove()\" type=\"button\" class=\"toast-close-button\" aria-label=\"Close\">\n <span aria-hidden=\"true\">×</span>\n </button>\n}\n\n@if (title()) {\n <div [class]=\"_options.titleClass\" [attr.aria-label]=\"title()\">\n {{ title() }}\n\n @if (duplicatesCount) {\n <ng-container>[{{ duplicatesCount + 1 }}]</ng-container>\n }\n </div>\n}\n\n@if (message()) {\n @if (_options.enableHtml) {\n <div role=\"alert\" [class]=\"_options.messageClass\" [innerHTML]=\"message()\"></div>\n } @else {\n <div role=\"alert\" [class]=\"_options.messageClass\" [attr.aria-label]=\"message()\">\n {{ message() }}\n </div>\n }\n}\n\n@if (_options.progressBar) {\n <div>\n <div class=\"toast-progress\" [style.width]=\"width() + '%'\"></div>\n </div>\n}\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1102
|
+
}
|
|
1103
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ToastBase, decorators: [{
|
|
1104
|
+
type: Component,
|
|
1105
|
+
args: [{ selector: '[toast-component]', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1106
|
+
'[class]': 'toastClasses()',
|
|
1107
|
+
'[style.display]': 'displayStyle()',
|
|
1108
|
+
'(mouseenter)': 'stickAround()',
|
|
1109
|
+
'(mouseleave)': 'delayedHideToast()',
|
|
1110
|
+
'(click)': 'tapToast()',
|
|
1111
|
+
}, template: "@let _options = options();\n\n@if (_options.closeButton) {\n <button (click)=\"remove()\" type=\"button\" class=\"toast-close-button\" aria-label=\"Close\">\n <span aria-hidden=\"true\">×</span>\n </button>\n}\n\n@if (title()) {\n <div [class]=\"_options.titleClass\" [attr.aria-label]=\"title()\">\n {{ title() }}\n\n @if (duplicatesCount) {\n <ng-container>[{{ duplicatesCount + 1 }}]</ng-container>\n }\n </div>\n}\n\n@if (message()) {\n @if (_options.enableHtml) {\n <div role=\"alert\" [class]=\"_options.messageClass\" [innerHTML]=\"message()\"></div>\n } @else {\n <div role=\"alert\" [class]=\"_options.messageClass\" [attr.aria-label]=\"message()\">\n {{ message() }}\n </div>\n }\n}\n\n@if (_options.progressBar) {\n <div>\n <div class=\"toast-progress\" [style.width]=\"width() + '%'\"></div>\n </div>\n}\n" }]
|
|
1112
|
+
}], ctorParameters: () => [] });
|
|
1113
|
+
|
|
1114
|
+
class Toast extends ToastBase {
|
|
1115
|
+
params = { easeTime: this.toastPackage.config.easeTime, easing: 'ease-in' };
|
|
1116
|
+
elementRef = inject(ElementRef);
|
|
1117
|
+
remove() {
|
|
1118
|
+
if (this.state() === 'removed')
|
|
1119
|
+
return;
|
|
1120
|
+
clearTimeout(this.timeout);
|
|
1121
|
+
this.state.set('removed');
|
|
1122
|
+
this.elementRef.nativeElement.classList.add('toast-out');
|
|
1123
|
+
this.timeout = this.timeoutsService.setTimeout(() => this.toastrService.remove(this.toastPackage.toastId), +this.params.easeTime);
|
|
1124
|
+
}
|
|
1125
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: Toast, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1126
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: Toast, isStandalone: true, selector: "[toast-component]", host: { attributes: { "animate.enter": "toast-in" }, properties: { "style.--animation-easing": "params.easing", "style.--animation-duration": "params.easeTime + \"ms\"" }, classAttribute: "toast-host" }, usesInheritance: true, ngImport: i0, template: "@let _options = options();\n\n@if (_options.closeButton) {\n <button (click)=\"remove()\" type=\"button\" class=\"toast-close-button\" aria-label=\"Close\">\n <span aria-hidden=\"true\">×</span>\n </button>\n}\n\n@if (title()) {\n <div [class]=\"_options.titleClass\" [attr.aria-label]=\"title()\">\n {{ title() }}\n\n @if (duplicatesCount) {\n <ng-container>[{{ duplicatesCount + 1 }}]</ng-container>\n }\n </div>\n}\n\n@if (message()) {\n @if (_options.enableHtml) {\n <div role=\"alert\" [class]=\"_options.messageClass\" [innerHTML]=\"message()\"></div>\n } @else {\n <div role=\"alert\" [class]=\"_options.messageClass\" [attr.aria-label]=\"message()\">\n {{ message() }}\n </div>\n }\n}\n\n@if (_options.progressBar) {\n <div>\n <div class=\"toast-progress\" [style.width]=\"width() + '%'\"></div>\n </div>\n}\n", styles: [".toast-host.toast-in{animation:toast-animation var(--animation-duration) var(--animation-easing)}.toast-host.toast-out{animation:toast-animation var(--animation-duration) var(--animation-easing) reverse forwards}@keyframes toast-animation{0%{opacity:0}to{opacity:1}}\n", ".toast-center-center{top:50%;left:50%;transform:translate(-50%,-50%)}.toast-top-center{top:0;right:0;width:100%}.toast-bottom-center{bottom:0;right:0;width:100%}.toast-top-full-width{top:0;right:0;width:100%}.toast-bottom-full-width{bottom:0;right:0;width:100%}.toast-top-left{top:12px;left:12px}.toast-top-right{top:12px;right:12px}.toast-bottom-right{right:12px;bottom:12px}.toast-bottom-left{bottom:12px;left:12px}.toast-title{font-weight:700}.toast-message{word-wrap:break-word}.toast-message a,.toast-message label{color:#fff}.toast-message a:hover{color:#ccc;text-decoration:none}.toast-close-button{position:relative;right:-.3em;top:-.3em;float:right;font-size:20px;font-weight:700;color:#fff;text-shadow:0 1px 0 #ffffff}.toast-close-button:hover,.toast-close-button:focus{color:#000;text-decoration:none;cursor:pointer;opacity:.4}button.toast-close-button{padding:0;cursor:pointer;background:transparent;border:0}.toast-container{pointer-events:none;position:fixed;z-index:999999}.toast-container *{box-sizing:border-box}.toast-container .ngx-toastr{position:relative;overflow:hidden;margin:0 0 6px;padding:15px 15px 15px 50px;width:300px;border-radius:3px;background-position:15px center;background-repeat:no-repeat;background-size:24px;box-shadow:0 0 12px #999;color:#fff}.toast-container .ngx-toastr:hover{box-shadow:0 0 12px #000;opacity:1;cursor:pointer}.toast-info{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHZpZXdCb3g9JzAgMCA1MTIgNTEyJyB3aWR0aD0nNTEyJyBoZWlnaHQ9JzUxMic+PHBhdGggZmlsbD0ncmdiKDI1NSwyNTUsMjU1KScgZD0nTTI1NiA4QzExOS4wNDMgOCA4IDExOS4wODMgOCAyNTZjMCAxMzYuOTk3IDExMS4wNDMgMjQ4IDI0OCAyNDhzMjQ4LTExMS4wMDMgMjQ4LTI0OEM1MDQgMTE5LjA4MyAzOTIuOTU3IDggMjU2IDh6bTAgMTEwYzIzLjE5NiAwIDQyIDE4LjgwNCA0MiA0MnMtMTguODA0IDQyLTQyIDQyLTQyLTE4LjgwNC00Mi00MiAxOC44MDQtNDIgNDItNDJ6bTU2IDI1NGMwIDYuNjI3LTUuMzczIDEyLTEyIDEyaC04OGMtNi42MjcgMC0xMi01LjM3My0xMi0xMnYtMjRjMC02LjYyNyA1LjM3My0xMiAxMi0xMmgxMnYtNjRoLTEyYy02LjYyNyAwLTEyLTUuMzczLTEyLTEydi0yNGMwLTYuNjI3IDUuMzczLTEyIDEyLTEyaDY0YzYuNjI3IDAgMTIgNS4zNzMgMTIgMTJ2MTAwaDEyYzYuNjI3IDAgMTIgNS4zNzMgMTIgMTJ2MjR6Jy8+PC9zdmc+)}.toast-error{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHZpZXdCb3g9JzAgMCA1MTIgNTEyJyB3aWR0aD0nNTEyJyBoZWlnaHQ9JzUxMic+PHBhdGggZmlsbD0ncmdiKDI1NSwyNTUsMjU1KScgZD0nTTI1NiA4QzExOSA4IDggMTE5IDggMjU2czExMSAyNDggMjQ4IDI0OCAyNDgtMTExIDI0OC0yNDhTMzkzIDggMjU2IDh6bTEyMS42IDMxMy4xYzQuNyA0LjcgNC43IDEyLjMgMCAxN0wzMzggMzc3LjZjLTQuNyA0LjctMTIuMyA0LjctMTcgMEwyNTYgMzEybC02NS4xIDY1LjZjLTQuNyA0LjctMTIuMyA0LjctMTcgMEwxMzQuNCAzMzhjLTQuNy00LjctNC43LTEyLjMgMC0xN2w2NS42LTY1LTY1LjYtNjUuMWMtNC43LTQuNy00LjctMTIuMyAwLTE3bDM5LjYtMzkuNmM0LjctNC43IDEyLjMtNC43IDE3IDBsNjUgNjUuNyA2NS4xLTY1LjZjNC43LTQuNyAxMi4zLTQuNyAxNyAwbDM5LjYgMzkuNmM0LjcgNC43IDQuNyAxMi4zIDAgMTdMMzEyIDI1Nmw2NS42IDY1LjF6Jy8+PC9zdmc+)}.toast-success{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHZpZXdCb3g9JzAgMCA1MTIgNTEyJyB3aWR0aD0nNTEyJyBoZWlnaHQ9JzUxMic+PHBhdGggZmlsbD0ncmdiKDI1NSwyNTUsMjU1KScgZD0nTTE3My44OTggNDM5LjQwNGwtMTY2LjQtMTY2LjRjLTkuOTk3LTkuOTk3LTkuOTk3LTI2LjIwNiAwLTM2LjIwNGwzNi4yMDMtMzYuMjA0YzkuOTk3LTkuOTk4IDI2LjIwNy05Ljk5OCAzNi4yMDQgMEwxOTIgMzEyLjY5IDQzMi4wOTUgNzIuNTk2YzkuOTk3LTkuOTk3IDI2LjIwNy05Ljk5NyAzNi4yMDQgMGwzNi4yMDMgMzYuMjA0YzkuOTk3IDkuOTk3IDkuOTk3IDI2LjIwNiAwIDM2LjIwNGwtMjk0LjQgMjk0LjQwMWMtOS45OTggOS45OTctMjYuMjA3IDkuOTk3LTM2LjIwNC0uMDAxeicvPjwvc3ZnPg==)}.toast-warning{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHZpZXdCb3g9JzAgMCA1NzYgNTEyJyB3aWR0aD0nNTc2JyBoZWlnaHQ9JzUxMic+PHBhdGggZmlsbD0ncmdiKDI1NSwyNTUsMjU1KScgZD0nTTU2OS41MTcgNDQwLjAxM0M1ODcuOTc1IDQ3Mi4wMDcgNTY0LjgwNiA1MTIgNTI3Ljk0IDUxMkg0OC4wNTRjLTM2LjkzNyAwLTU5Ljk5OS00MC4wNTUtNDEuNTc3LTcxLjk4N0wyNDYuNDIzIDIzLjk4NWMxOC40NjctMzIuMDA5IDY0LjcyLTMxLjk1MSA4My4xNTQgMGwyMzkuOTQgNDE2LjAyOHpNMjg4IDM1NGMtMjUuNDA1IDAtNDYgMjAuNTk1LTQ2IDQ2czIwLjU5NSA0NiA0NiA0NiA0Ni0yMC41OTUgNDYtNDYtMjAuNTk1LTQ2LTQ2LTQ2em0tNDMuNjczLTE2NS4zNDZsNy40MTggMTM2Yy4zNDcgNi4zNjQgNS42MDkgMTEuMzQ2IDExLjk4MiAxMS4zNDZoNDguNTQ2YzYuMzczIDAgMTEuNjM1LTQuOTgyIDExLjk4Mi0xMS4zNDZsNy40MTgtMTM2Yy4zNzUtNi44NzQtNS4wOTgtMTIuNjU0LTExLjk4Mi0xMi42NTRoLTYzLjM4M2MtNi44ODQgMC0xMi4zNTYgNS43OC0xMS45ODEgMTIuNjU0eicvPjwvc3ZnPg==)}.toast-container.toast-top-center .ngx-toastr,.toast-container.toast-bottom-center .ngx-toastr{width:300px;margin-left:auto;margin-right:auto}.toast-container.toast-top-full-width .ngx-toastr,.toast-container.toast-bottom-full-width .ngx-toastr{width:96%;margin-left:auto;margin-right:auto}.ngx-toastr{background-color:#030303;pointer-events:auto}.toast-success{background-color:#51a351}.toast-error{background-color:#bd362f}.toast-info{background-color:#2f96b4}.toast-warning{background-color:#f89406}.toast-progress{position:absolute;left:0;bottom:0;height:4px;background-color:#000;opacity:.4}@media all and (max-width: 240px){.toast-container .ngx-toastr.div{padding:8px 8px 8px 50px;width:11em}.toast-container .toast-close-button{right:-.2em;top:-.2em}}@media all and (min-width: 241px) and (max-width: 480px){.toast-container .ngx-toastr.div{padding:8px 8px 8px 50px;width:18em}.toast-container .toast-close-button{right:-.2em;top:-.2em}}@media all and (min-width: 481px) and (max-width: 768px){.toast-container .ngx-toastr.div{padding:15px 15px 15px 50px;width:25em}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1127
|
+
}
|
|
1128
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: Toast, decorators: [{
|
|
1129
|
+
type: Component,
|
|
1130
|
+
args: [{ selector: '[toast-component]', host: {
|
|
1131
|
+
'[style.--animation-easing]': 'params.easing',
|
|
1132
|
+
'[style.--animation-duration]': 'params.easeTime + "ms"',
|
|
1133
|
+
'animate.enter': 'toast-in',
|
|
1134
|
+
'class': 'toast-host'
|
|
1135
|
+
}, encapsulation: ViewEncapsulation.None, standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "@let _options = options();\n\n@if (_options.closeButton) {\n <button (click)=\"remove()\" type=\"button\" class=\"toast-close-button\" aria-label=\"Close\">\n <span aria-hidden=\"true\">×</span>\n </button>\n}\n\n@if (title()) {\n <div [class]=\"_options.titleClass\" [attr.aria-label]=\"title()\">\n {{ title() }}\n\n @if (duplicatesCount) {\n <ng-container>[{{ duplicatesCount + 1 }}]</ng-container>\n }\n </div>\n}\n\n@if (message()) {\n @if (_options.enableHtml) {\n <div role=\"alert\" [class]=\"_options.messageClass\" [innerHTML]=\"message()\"></div>\n } @else {\n <div role=\"alert\" [class]=\"_options.messageClass\" [attr.aria-label]=\"message()\">\n {{ message() }}\n </div>\n }\n}\n\n@if (_options.progressBar) {\n <div>\n <div class=\"toast-progress\" [style.width]=\"width() + '%'\"></div>\n </div>\n}\n", styles: [".toast-host.toast-in{animation:toast-animation var(--animation-duration) var(--animation-easing)}.toast-host.toast-out{animation:toast-animation var(--animation-duration) var(--animation-easing) reverse forwards}@keyframes toast-animation{0%{opacity:0}to{opacity:1}}\n", ".toast-center-center{top:50%;left:50%;transform:translate(-50%,-50%)}.toast-top-center{top:0;right:0;width:100%}.toast-bottom-center{bottom:0;right:0;width:100%}.toast-top-full-width{top:0;right:0;width:100%}.toast-bottom-full-width{bottom:0;right:0;width:100%}.toast-top-left{top:12px;left:12px}.toast-top-right{top:12px;right:12px}.toast-bottom-right{right:12px;bottom:12px}.toast-bottom-left{bottom:12px;left:12px}.toast-title{font-weight:700}.toast-message{word-wrap:break-word}.toast-message a,.toast-message label{color:#fff}.toast-message a:hover{color:#ccc;text-decoration:none}.toast-close-button{position:relative;right:-.3em;top:-.3em;float:right;font-size:20px;font-weight:700;color:#fff;text-shadow:0 1px 0 #ffffff}.toast-close-button:hover,.toast-close-button:focus{color:#000;text-decoration:none;cursor:pointer;opacity:.4}button.toast-close-button{padding:0;cursor:pointer;background:transparent;border:0}.toast-container{pointer-events:none;position:fixed;z-index:999999}.toast-container *{box-sizing:border-box}.toast-container .ngx-toastr{position:relative;overflow:hidden;margin:0 0 6px;padding:15px 15px 15px 50px;width:300px;border-radius:3px;background-position:15px center;background-repeat:no-repeat;background-size:24px;box-shadow:0 0 12px #999;color:#fff}.toast-container .ngx-toastr:hover{box-shadow:0 0 12px #000;opacity:1;cursor:pointer}.toast-info{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHZpZXdCb3g9JzAgMCA1MTIgNTEyJyB3aWR0aD0nNTEyJyBoZWlnaHQ9JzUxMic+PHBhdGggZmlsbD0ncmdiKDI1NSwyNTUsMjU1KScgZD0nTTI1NiA4QzExOS4wNDMgOCA4IDExOS4wODMgOCAyNTZjMCAxMzYuOTk3IDExMS4wNDMgMjQ4IDI0OCAyNDhzMjQ4LTExMS4wMDMgMjQ4LTI0OEM1MDQgMTE5LjA4MyAzOTIuOTU3IDggMjU2IDh6bTAgMTEwYzIzLjE5NiAwIDQyIDE4LjgwNCA0MiA0MnMtMTguODA0IDQyLTQyIDQyLTQyLTE4LjgwNC00Mi00MiAxOC44MDQtNDIgNDItNDJ6bTU2IDI1NGMwIDYuNjI3LTUuMzczIDEyLTEyIDEyaC04OGMtNi42MjcgMC0xMi01LjM3My0xMi0xMnYtMjRjMC02LjYyNyA1LjM3My0xMiAxMi0xMmgxMnYtNjRoLTEyYy02LjYyNyAwLTEyLTUuMzczLTEyLTEydi0yNGMwLTYuNjI3IDUuMzczLTEyIDEyLTEyaDY0YzYuNjI3IDAgMTIgNS4zNzMgMTIgMTJ2MTAwaDEyYzYuNjI3IDAgMTIgNS4zNzMgMTIgMTJ2MjR6Jy8+PC9zdmc+)}.toast-error{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHZpZXdCb3g9JzAgMCA1MTIgNTEyJyB3aWR0aD0nNTEyJyBoZWlnaHQ9JzUxMic+PHBhdGggZmlsbD0ncmdiKDI1NSwyNTUsMjU1KScgZD0nTTI1NiA4QzExOSA4IDggMTE5IDggMjU2czExMSAyNDggMjQ4IDI0OCAyNDgtMTExIDI0OC0yNDhTMzkzIDggMjU2IDh6bTEyMS42IDMxMy4xYzQuNyA0LjcgNC43IDEyLjMgMCAxN0wzMzggMzc3LjZjLTQuNyA0LjctMTIuMyA0LjctMTcgMEwyNTYgMzEybC02NS4xIDY1LjZjLTQuNyA0LjctMTIuMyA0LjctMTcgMEwxMzQuNCAzMzhjLTQuNy00LjctNC43LTEyLjMgMC0xN2w2NS42LTY1LTY1LjYtNjUuMWMtNC43LTQuNy00LjctMTIuMyAwLTE3bDM5LjYtMzkuNmM0LjctNC43IDEyLjMtNC43IDE3IDBsNjUgNjUuNyA2NS4xLTY1LjZjNC43LTQuNyAxMi4zLTQuNyAxNyAwbDM5LjYgMzkuNmM0LjcgNC43IDQuNyAxMi4zIDAgMTdMMzEyIDI1Nmw2NS42IDY1LjF6Jy8+PC9zdmc+)}.toast-success{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHZpZXdCb3g9JzAgMCA1MTIgNTEyJyB3aWR0aD0nNTEyJyBoZWlnaHQ9JzUxMic+PHBhdGggZmlsbD0ncmdiKDI1NSwyNTUsMjU1KScgZD0nTTE3My44OTggNDM5LjQwNGwtMTY2LjQtMTY2LjRjLTkuOTk3LTkuOTk3LTkuOTk3LTI2LjIwNiAwLTM2LjIwNGwzNi4yMDMtMzYuMjA0YzkuOTk3LTkuOTk4IDI2LjIwNy05Ljk5OCAzNi4yMDQgMEwxOTIgMzEyLjY5IDQzMi4wOTUgNzIuNTk2YzkuOTk3LTkuOTk3IDI2LjIwNy05Ljk5NyAzNi4yMDQgMGwzNi4yMDMgMzYuMjA0YzkuOTk3IDkuOTk3IDkuOTk3IDI2LjIwNiAwIDM2LjIwNGwtMjk0LjQgMjk0LjQwMWMtOS45OTggOS45OTctMjYuMjA3IDkuOTk3LTM2LjIwNC0uMDAxeicvPjwvc3ZnPg==)}.toast-warning{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHZpZXdCb3g9JzAgMCA1NzYgNTEyJyB3aWR0aD0nNTc2JyBoZWlnaHQ9JzUxMic+PHBhdGggZmlsbD0ncmdiKDI1NSwyNTUsMjU1KScgZD0nTTU2OS41MTcgNDQwLjAxM0M1ODcuOTc1IDQ3Mi4wMDcgNTY0LjgwNiA1MTIgNTI3Ljk0IDUxMkg0OC4wNTRjLTM2LjkzNyAwLTU5Ljk5OS00MC4wNTUtNDEuNTc3LTcxLjk4N0wyNDYuNDIzIDIzLjk4NWMxOC40NjctMzIuMDA5IDY0LjcyLTMxLjk1MSA4My4xNTQgMGwyMzkuOTQgNDE2LjAyOHpNMjg4IDM1NGMtMjUuNDA1IDAtNDYgMjAuNTk1LTQ2IDQ2czIwLjU5NSA0NiA0NiA0NiA0Ni0yMC41OTUgNDYtNDYtMjAuNTk1LTQ2LTQ2LTQ2em0tNDMuNjczLTE2NS4zNDZsNy40MTggMTM2Yy4zNDcgNi4zNjQgNS42MDkgMTEuMzQ2IDExLjk4MiAxMS4zNDZoNDguNTQ2YzYuMzczIDAgMTEuNjM1LTQuOTgyIDExLjk4Mi0xMS4zNDZsNy40MTgtMTM2Yy4zNzUtNi44NzQtNS4wOTgtMTIuNjU0LTExLjk4Mi0xMi42NTRoLTYzLjM4M2MtNi44ODQgMC0xMi4zNTYgNS43OC0xMS45ODEgMTIuNjU0eicvPjwvc3ZnPg==)}.toast-container.toast-top-center .ngx-toastr,.toast-container.toast-bottom-center .ngx-toastr{width:300px;margin-left:auto;margin-right:auto}.toast-container.toast-top-full-width .ngx-toastr,.toast-container.toast-bottom-full-width .ngx-toastr{width:96%;margin-left:auto;margin-right:auto}.ngx-toastr{background-color:#030303;pointer-events:auto}.toast-success{background-color:#51a351}.toast-error{background-color:#bd362f}.toast-info{background-color:#2f96b4}.toast-warning{background-color:#f89406}.toast-progress{position:absolute;left:0;bottom:0;height:4px;background-color:#000;opacity:.4}@media all and (max-width: 240px){.toast-container .ngx-toastr.div{padding:8px 8px 8px 50px;width:11em}.toast-container .toast-close-button{right:-.2em;top:-.2em}}@media all and (min-width: 241px) and (max-width: 480px){.toast-container .ngx-toastr.div{padding:8px 8px 8px 50px;width:18em}.toast-container .toast-close-button{right:-.2em;top:-.2em}}@media all and (min-width: 481px) and (max-width: 768px){.toast-container .ngx-toastr.div{padding:15px 15px 15px 50px;width:25em}}\n"] }]
|
|
1136
|
+
}] });
|
|
1137
|
+
|
|
1138
|
+
const DefaultNoAnimationsGlobalConfig = {
|
|
1139
|
+
...DefaultNoComponentGlobalConfig,
|
|
1140
|
+
toastComponent: ToastBase,
|
|
1141
|
+
};
|
|
1142
|
+
class ToastNoAnimationModule {
|
|
1143
|
+
static forRoot(config = {}) {
|
|
1144
|
+
return {
|
|
1145
|
+
ngModule: ToastNoAnimationModule,
|
|
1146
|
+
providers: [
|
|
1147
|
+
{
|
|
1148
|
+
provide: TOAST_CONFIG,
|
|
1149
|
+
useValue: {
|
|
1150
|
+
default: DefaultNoAnimationsGlobalConfig,
|
|
1151
|
+
config,
|
|
1152
|
+
},
|
|
1153
|
+
},
|
|
1154
|
+
],
|
|
1155
|
+
};
|
|
1156
|
+
}
|
|
1157
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ToastNoAnimationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1158
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.24", ngImport: i0, type: ToastNoAnimationModule, imports: [ToastBase], exports: [ToastBase] });
|
|
1159
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ToastNoAnimationModule });
|
|
1160
|
+
}
|
|
1161
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ToastNoAnimationModule, decorators: [{
|
|
1162
|
+
type: NgModule,
|
|
1163
|
+
args: [{
|
|
1164
|
+
imports: [ToastBase],
|
|
1165
|
+
exports: [ToastBase],
|
|
1166
|
+
}]
|
|
1167
|
+
}] });
|
|
1168
|
+
|
|
306
1169
|
// Angular
|
|
307
1170
|
class ExtensionsModule {
|
|
308
1171
|
static forRoot(config) {
|
|
309
1172
|
return {
|
|
310
1173
|
ngModule: ExtensionsModule,
|
|
311
1174
|
providers: [
|
|
1175
|
+
{ provide: TOAST_CONFIG, useValue: { default: { ...DefaultNoComponentGlobalConfig, toastComponent: Toast }, config: {} } },
|
|
312
1176
|
{ provide: APPSEARCH_PREFIX, useValue: config?.appsearch_prefix || 'Hot' },
|
|
313
1177
|
{ provide: EXT_ALLOW_UTC, useValue: config?.allow_utc == null ? false : config?.allow_utc },
|
|
314
1178
|
{ provide: EXT_DEBUG_MODE, useValue: config?.debugMode || false },
|
|
@@ -316,13 +1180,17 @@ class ExtensionsModule {
|
|
|
316
1180
|
};
|
|
317
1181
|
}
|
|
318
1182
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ExtensionsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
319
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.24", ngImport: i0, type: ExtensionsModule, declarations: [LocDatePipe], imports: [LocalizationModule
|
|
1183
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.24", ngImport: i0, type: ExtensionsModule, declarations: [LocDatePipe], imports: [LocalizationModule,
|
|
1184
|
+
Toast], exports: [LocDatePipe] });
|
|
320
1185
|
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ExtensionsModule, imports: [LocalizationModule] });
|
|
321
1186
|
}
|
|
322
1187
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: ExtensionsModule, decorators: [{
|
|
323
1188
|
type: NgModule,
|
|
324
1189
|
args: [{
|
|
325
|
-
imports: [
|
|
1190
|
+
imports: [
|
|
1191
|
+
LocalizationModule,
|
|
1192
|
+
Toast
|
|
1193
|
+
],
|
|
326
1194
|
declarations: [LocDatePipe],
|
|
327
1195
|
exports: [LocDatePipe]
|
|
328
1196
|
}]
|