@acorex/components 18.12.41 → 18.12.43

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@ import { DIALOG_DATA, Dialog, DialogModule } from '@angular/cdk/dialog';
4
4
  import * as i2 from '@angular/cdk/portal';
5
5
  import { TemplatePortal, ComponentPortal, PortalModule } from '@angular/cdk/portal';
6
6
  import * as i0 from '@angular/core';
7
- import { TemplateRef, Component, ChangeDetectionStrategy, ViewEncapsulation, Inject, HostBinding, InjectionToken, inject, signal, effect, Injectable, NgModule } from '@angular/core';
7
+ import { TemplateRef, Component, ChangeDetectionStrategy, ViewEncapsulation, Inject, HostBinding, InjectionToken, inject, Injectable, NgModule } from '@angular/core';
8
8
  import * as i3 from '@acorex/components/button';
9
9
  import { AXButtonModule } from '@acorex/components/button';
10
10
  import * as i4 from '@acorex/components/loading';
@@ -14,7 +14,7 @@ import { AXDecoratorModule } from '@acorex/components/decorators';
14
14
  import * as i6 from '@angular/common';
15
15
  import { CommonModule } from '@angular/common';
16
16
  import * as i7 from '@acorex/core/translation';
17
- import { AXTranslationModule } from '@acorex/core/translation';
17
+ import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
18
18
  import { GlobalPositionStrategy } from '@angular/cdk/overlay';
19
19
 
20
20
  /**
@@ -138,39 +138,32 @@ function notificationConfig(config = {}) {
138
138
  class AXNotificationService {
139
139
  constructor() {
140
140
  this.dialog = inject(Dialog);
141
+ this.translationService = inject(AXTranslationService);
141
142
  this.defaultConfig = inject(AX_NOTIFICATION_CONFIG);
142
- this.activeNotifications = signal([]);
143
- this.reservedNotifications = signal([]);
144
- this.notificationCounterElement = signal(null);
145
- this.moreNotificationsColor = signal('primary');
146
- this.moreNotificationsLocation = signal('bottom-center');
147
- this.reserveCounter = signal(0);
148
- this.#effect = effect(() => {
149
- if (this.defaultConfig.limit <= 0)
150
- return;
151
- this.handleShowReservedNotification();
152
- this.handleShowReservedNotificationCounter();
153
- this.handleReserveCounter();
154
- }, { allowSignalWrites: true });
143
+ this.activeNotifications = [];
144
+ this.reservedNotifications = [];
145
+ this.notificationCounterElement = null;
146
+ this.moreNotificationsColor = 'primary';
147
+ this.moreNotificationsLocation = 'bottom-center';
148
+ this.reserveCounter = 0;
155
149
  }
156
- #effect;
157
150
  show(config) {
158
- config = Object.assign({
159
- closeButton: true,
160
- location: this.defaultConfig.location,
161
- }, config);
162
- this.moreNotificationsColor.set(config.color);
163
- this.moreNotificationsLocation.set(config.location);
164
- if (this.defaultConfig.limit > 0) {
165
- if (this.activeNotifications().length >= this.defaultConfig.limit) {
166
- this.reservedNotifications.update((value) => [...value, config]);
167
- return {
168
- close: () => {
169
- //TODO close reserved notification
170
- },
171
- };
172
- }
151
+ config = { ...this.defaultConfig, ...config };
152
+ this.moreNotificationsColor = config.color;
153
+ this.moreNotificationsLocation = config.location;
154
+ if (this.defaultConfig.limit > 0 && this.activeNotifications.length >= this.defaultConfig.limit) {
155
+ const reservedRef = {
156
+ close: () => {
157
+ console.warn('Reserved notification cannot be closed until it is displayed.');
158
+ },
159
+ };
160
+ this.reservedNotifications.push({ config, reservedRef });
161
+ this.handleReservedNotificationCounter();
162
+ return reservedRef;
173
163
  }
164
+ return this.displayNotification(config);
165
+ }
166
+ displayNotification(config) {
174
167
  const gap = this.defaultConfig.gap;
175
168
  const pos = this.getPosition(config.location) + gap + 'px';
176
169
  const positionStrategy = this.getPositionStrategy(new GlobalPositionStrategy(), config.location, pos, gap);
@@ -186,10 +179,13 @@ class AXNotificationService {
186
179
  panelClass: ['ax-animate-animated', 'ax-animate-fadeIn', 'ax-animate-faster'],
187
180
  positionStrategy,
188
181
  });
189
- this.activeNotifications.update((value) => [...value, dialogRef.id]);
182
+ this.activeNotifications.push(dialogRef.id);
183
+ this.handleReservedNotificationCounter();
190
184
  const notificationRef = dialogRef.componentInstance;
191
185
  dialogRef.closed.subscribe(() => {
192
- this.activeNotifications.update((value) => [...value].filter((dialogID) => dialogID !== dialogRef.id));
186
+ this.activeNotifications = this.activeNotifications.filter((id) => id !== dialogRef.id);
187
+ this.handleShowReservedNotification();
188
+ this.handleReservedNotificationCounter();
193
189
  setTimeout(() => {
194
190
  this.reposition(config.location, gap);
195
191
  }, 0);
@@ -202,40 +198,45 @@ class AXNotificationService {
202
198
  }
203
199
  hideAll() {
204
200
  this.dialog.closeAll();
201
+ this.reserveCounter = 0;
202
+ this.reservedNotifications = [];
203
+ this.activeNotifications = [];
204
+ this.handleReservedNotificationCounter();
205
205
  }
206
206
  handleShowReservedNotification() {
207
- if (this.activeNotifications().length > this.defaultConfig.limit - 1)
208
- return;
209
- if (!this.reservedNotifications().length)
207
+ if (this.activeNotifications.length > this.defaultConfig.limit - 1)
210
208
  return;
211
- this.show(this.reservedNotifications()[0]);
212
- this.reservedNotifications.update((value) => {
213
- const arr = [...value];
214
- arr.shift();
215
- return arr;
216
- });
217
- }
218
- handleShowReservedNotificationCounter() {
219
- if (this.reservedNotifications().length === this.reserveCounter())
209
+ if (!this.reservedNotifications.length)
220
210
  return;
221
- this.reserveCounter.set(this.reservedNotifications().length);
222
- if (this.notificationCounterElement() !== null)
223
- this.notificationCounterElement().close();
224
- this.createReservedCounterToast();
211
+ const { config, reservedRef } = this.reservedNotifications.shift();
212
+ const displayedRef = this.displayNotification(config);
213
+ this.handleReservedNotificationCounter();
214
+ reservedRef.close = displayedRef.close;
225
215
  }
226
- handleReserveCounter() {
227
- if (this.reserveCounter() !== 0)
216
+ handleReservedNotificationCounter() {
217
+ const reservedCount = this.reservedNotifications.length;
218
+ if (reservedCount === this.reserveCounter)
228
219
  return;
229
- if (this.notificationCounterElement() === null)
220
+ this.reserveCounter = reservedCount;
221
+ if (reservedCount === 0 && this.notificationCounterElement !== null) {
222
+ this.notificationCounterElement.close();
230
223
  return;
231
- this.notificationCounterElement().close();
224
+ }
225
+ if (reservedCount > 0) {
226
+ if (this.notificationCounterElement !== null) {
227
+ this.notificationCounterElement.close();
228
+ }
229
+ this.createReservedCounterToast();
230
+ }
232
231
  }
233
- createReservedCounterToast() {
232
+ async createReservedCounterToast() {
234
233
  const opt = {
235
234
  closeButton: false,
236
- color: this.moreNotificationsColor(),
237
- location: this.moreNotificationsLocation(),
238
- title: `And ${this.reserveCounter()} more...`,
235
+ color: this.moreNotificationsColor,
236
+ location: this.moreNotificationsLocation,
237
+ title: await this.translationService.translateAsync('more-notification', {
238
+ params: { number: this.reserveCounter },
239
+ }),
239
240
  timeOutProgress: false,
240
241
  };
241
242
  const gap = this.defaultConfig.gap;
@@ -253,7 +254,7 @@ class AXNotificationService {
253
254
  panelClass: ['ax-animate-animated', 'ax-animate-fadeIn', 'ax-animate-faster'],
254
255
  positionStrategy,
255
256
  });
256
- this.notificationCounterElement.set(dialogRef.componentInstance);
257
+ this.notificationCounterElement = dialogRef.componentInstance;
257
258
  }
258
259
  reposition(notificationLocation, gap) {
259
260
  const list = this.dialog.openDialogs
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-components-notification.mjs","sources":["../../../../libs/components/notification/src/lib/notification.component.ts","../../../../libs/components/notification/src/lib/notification.component.html","../../../../libs/components/notification/src/lib/notification.config.ts","../../../../libs/components/notification/src/lib/notification.service.ts","../../../../libs/components/notification/src/lib/notification.module.ts","../../../../libs/components/notification/src/acorex-components-notification.ts"],"sourcesContent":["import { AXClosbaleComponent, AXComponentCloseEvent, MXBaseComponent } from '@acorex/components/common';\nimport { DIALOG_DATA, DialogRef } from '@angular/cdk/dialog';\nimport { ComponentPortal, ComponentType, Portal, TemplatePortal } from '@angular/cdk/portal';\nimport {\n ChangeDetectionStrategy,\n Component,\n HostBinding,\n Inject,\n TemplateRef,\n ViewEncapsulation,\n} from '@angular/core';\nimport { AXNotificationButtonItem, AXNotificationData } from './notification.class';\n\n/**\n * The Button is a component which detects user interaction and triggers a corresponding event\n *\n * @category Components\n */\n@Component({\n selector: 'ax-notification',\n templateUrl: './notification.component.html',\n styleUrls: ['./notification.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n providers: [{ provide: AXClosbaleComponent, useExisting: AXNotificationComponent }],\n})\nexport class AXNotificationComponent extends MXBaseComponent {\n /** @ignore */\n _selectedPortal: Portal<unknown>;\n\n /** @ignore */\n _icon: string;\n\n /**\n * @ignore\n */\n constructor(\n @Inject(DIALOG_DATA)\n public config: AXNotificationData,\n public dialogRef: DialogRef<AXComponentCloseEvent>,\n ) {\n super();\n }\n\n /** @ignore */\n override ngOnInit() {\n super.ngOnInit();\n this._initContent();\n this._initIcon();\n this._handleTimeOut();\n }\n\n /** @ignore */\n private _handleTimeOut() {\n if (this.config.timeOut) {\n setTimeout(() => {\n this.close();\n }, this.config.timeOut);\n }\n }\n\n /** @ignore */\n private _initContent() {\n if (this.config.content instanceof TemplateRef) {\n this._selectedPortal = new TemplatePortal(\n this.config.content as TemplateRef<unknown>,\n this.getViewContainer(),\n );\n this.cdr.markForCheck();\n } else if (typeof this.config.content === 'function') {\n this._selectedPortal = new ComponentPortal(this.config.content as ComponentType<unknown>);\n this.cdr.markForCheck();\n }\n }\n\n /** @ignore */\n private _initIcon() {\n if (!this.config.icon) {\n switch (this.config.color) {\n case 'success':\n this._icon = 'ax-icon ax-icon-check-circle';\n break;\n case 'danger':\n this._icon = 'ax-icon ax-icon-error';\n break;\n case 'warning':\n this._icon = 'ax-icon ax-icon-warning';\n break;\n case 'info':\n this._icon = 'ax-icon ax-icon-info';\n break;\n default:\n this._icon = this.config.icon || 'ax-icon ax-icon-check-circle';\n break;\n }\n } else {\n this._icon = this.config.icon;\n }\n }\n\n /** @ignore */\n protected _handleButtonClick(button: AXNotificationButtonItem) {\n if (button.onClick) {\n button.onClick({ source: button });\n }\n }\n\n /** @ignore */\n @HostBinding('class')\n private get __hostClass(): string {\n return `ax-${this.config.color}`;\n }\n\n /**\n * Closes the dialog and provides the component and HTML element for reference.\n */\n close() {\n this.dialogRef.close({\n component: this,\n htmlElement: this.getHostElement(),\n });\n }\n}\n","<span class=\"ax-notification-icon ax-icon-solid {{ _icon }}\"></span>\n<div class=\"ax-notification-content\">\n <div class=\"ax-notification-title\">{{ config.title | translate | async }}</div>\n @if(_selectedPortal){\n <ng-template [cdkPortalOutlet]=\"_selectedPortal\"></ng-template>\n } @else{\n <div>{{ config.content }}</div>\n }\n\n @if(config.buttons?.length){\n <div class=\"ax-notification-buttons\">\n @for(button of config.buttons; track $index){\n <ax-button class=\"ax-xs\" [text]=\"button.text | translate | async\" [color]=\"button.color\" [look]=\"button.look\"\n [disabled]=\"button.disabled\" (onClick)=\"_handleButtonClick(button)\">\n @if(button.loading){\n <ax-loading></ax-loading>\n }\n </ax-button>\n }\n </div>\n }\n\n</div>\n@if(config.closeButton){\n<ax-close-button></ax-close-button>\n}\n@if(config.timeOutProgress && config.timeOut){\n<div class=\"ax-notification-progress\" [style.animation-duration.ms]=\"config.timeOut\"></div>\n}","import { AXLocation } from '@acorex/components/common';\nimport { InjectionToken } from '@angular/core';\n\nexport interface AXNotificationConfig {\n gap: number;\n timeOut: number;\n timeOutProgress: boolean;\n location: AXLocation;\n closeButton: boolean;\n limit: number;\n}\n\nexport const AX_NOTIFICATION_CONFIG = new InjectionToken<AXNotificationConfig>('AX_NOTIFICATION_CONFIG', {\n providedIn: 'root',\n factory: () => AXNotificationDefaultConfig,\n});\n\nexport const AXNotificationDefaultConfig: AXNotificationConfig = {\n gap: 5,\n timeOut: 2500,\n timeOutProgress: true,\n closeButton: true,\n location: 'top-end',\n limit: 3,\n};\n\nexport type PartialNotificationConfig = Partial<AXNotificationConfig>;\n\nexport function notificationConfig(config: PartialNotificationConfig = {}): AXNotificationConfig {\n const result = {\n ...AXNotificationDefaultConfig,\n ...config,\n };\n return result;\n}\n","import { AXLocation, AXStyleColorType } from '@acorex/components/common';\nimport { Dialog } from '@angular/cdk/dialog';\nimport { GlobalPositionStrategy } from '@angular/cdk/overlay';\nimport { Injectable, effect, inject, signal } from '@angular/core';\nimport {\n AXNotificationOptions as AXNotificationDisplayConfig,\n AXNotificationRef,\n} from './notification.class';\nimport { AXNotificationComponent } from './notification.component';\nimport { AXNotificationConfig, AX_NOTIFICATION_CONFIG } from './notification.config';\n\n@Injectable()\nexport class AXNotificationService {\n private dialog: Dialog = inject(Dialog);\n private defaultConfig: AXNotificationConfig = inject(AX_NOTIFICATION_CONFIG);\n private activeNotifications = signal<string[]>([]);\n private reservedNotifications = signal<AXNotificationDisplayConfig[]>([]);\n private notificationCounterElement = signal<AXNotificationComponent | null>(null);\n private moreNotificationsColor = signal<AXStyleColorType>('primary');\n private moreNotificationsLocation = signal<AXLocation>('bottom-center');\n private reserveCounter = signal(0);\n\n #effect = effect(\n () => {\n if (this.defaultConfig.limit <= 0) return;\n this.handleShowReservedNotification();\n this.handleShowReservedNotificationCounter();\n this.handleReserveCounter();\n },\n { allowSignalWrites: true },\n );\n\n show(config: AXNotificationDisplayConfig): AXNotificationRef {\n config = Object.assign(\n {\n closeButton: true,\n location: this.defaultConfig.location,\n },\n config,\n );\n this.moreNotificationsColor.set(config.color);\n this.moreNotificationsLocation.set(config.location);\n\n if (this.defaultConfig.limit > 0) {\n if (this.activeNotifications().length >= this.defaultConfig.limit) {\n this.reservedNotifications.update((value) => [...value, config]);\n return {\n close: () => {\n //TODO close reserved notification\n },\n };\n }\n }\n\n const gap = this.defaultConfig.gap;\n const pos = this.getPosition(config.location) + gap + 'px';\n const positionStrategy = this.getPositionStrategy(\n new GlobalPositionStrategy(),\n config.location,\n pos,\n gap,\n );\n const dialogRef = this.dialog.open(AXNotificationComponent, {\n data: config,\n autoFocus: '__no_element__',\n restoreFocus: false,\n role: 'dialog',\n ariaModal: true,\n closeOnNavigation: true,\n closeOnDestroy: true,\n hasBackdrop: false,\n panelClass: ['ax-animate-animated', 'ax-animate-fadeIn', 'ax-animate-faster'],\n positionStrategy,\n });\n\n this.activeNotifications.update((value) => [...value, dialogRef.id]);\n\n const notificationRef = dialogRef.componentInstance as AXNotificationComponent;\n dialogRef.closed.subscribe(() => {\n this.activeNotifications.update((value) => [...value].filter((dialogID) => dialogID !== dialogRef.id));\n setTimeout(() => {\n this.reposition(config.location, gap);\n }, 0);\n });\n\n return {\n close: () => {\n notificationRef.close();\n },\n };\n }\n\n hideAll() {\n this.dialog.closeAll();\n }\n\n private handleShowReservedNotification() {\n if (this.activeNotifications().length > this.defaultConfig.limit - 1) return;\n if (!this.reservedNotifications().length) return;\n\n this.show(this.reservedNotifications()[0]);\n this.reservedNotifications.update((value) => {\n const arr = [...value];\n arr.shift();\n return arr;\n });\n }\n\n private handleShowReservedNotificationCounter() {\n if (this.reservedNotifications().length === this.reserveCounter()) return;\n\n this.reserveCounter.set(this.reservedNotifications().length);\n\n if (this.notificationCounterElement() !== null) this.notificationCounterElement().close();\n\n this.createReservedCounterToast();\n }\n\n private handleReserveCounter() {\n if (this.reserveCounter() !== 0) return;\n\n if (this.notificationCounterElement() === null) return;\n\n this.notificationCounterElement().close();\n }\n\n private createReservedCounterToast() {\n const opt: AXNotificationDisplayConfig = {\n closeButton: false,\n color: this.moreNotificationsColor(),\n location: this.moreNotificationsLocation(),\n title: `And ${this.reserveCounter()} more...`,\n timeOutProgress: false,\n };\n const gap = this.defaultConfig.gap;\n const pos = this.getPosition(opt.location) + gap + 'px';\n const positionStrategy = this.getPositionStrategy(new GlobalPositionStrategy(), opt.location, pos, gap);\n const dialogRef = this.dialog.open(AXNotificationComponent, {\n data: opt,\n autoFocus: '__no_element__',\n restoreFocus: true,\n role: 'dialog',\n ariaModal: true,\n closeOnNavigation: true,\n closeOnDestroy: true,\n hasBackdrop: false,\n panelClass: ['ax-animate-animated', 'ax-animate-fadeIn', 'ax-animate-faster'],\n positionStrategy,\n });\n this.notificationCounterElement.set(dialogRef.componentInstance as AXNotificationComponent);\n }\n\n private reposition(notificationLocation: AXLocation, gap: number): void {\n const list = this.dialog.openDialogs\n .map((c) => c.componentInstance as AXNotificationComponent)\n .filter((c) => c.config?.location == notificationLocation);\n list.forEach((element, index) => {\n const pos = this.getRepositionPosition(index, gap, list, notificationLocation);\n\n this.getPositionStrategy(\n element.dialogRef.config.positionStrategy as GlobalPositionStrategy,\n notificationLocation,\n pos,\n gap,\n ).apply();\n });\n }\n\n private getRepositionPosition(\n index: number,\n gap: number,\n list: AXNotificationComponent[],\n notificationLocation: string,\n ) {\n if (index === 0) return gap + 'px';\n const previouseElement = list[index - 1];\n if (notificationLocation.split('-')[0] == 'bottom') {\n return window.innerHeight - previouseElement.getHostElement().offsetTop + gap + 'px';\n }\n return (\n previouseElement.getHostElement().offsetTop +\n previouseElement.getHostElement().offsetHeight +\n gap +\n 'px'\n );\n }\n\n private getPosition(location: string) {\n const list = this.dialog.openDialogs\n .map((c) => c.componentInstance as AXNotificationComponent)\n .filter((c) => c.config.location == location);\n if (list.length == 0) return 0;\n if (location.split('-')[0] == 'bottom') {\n return window.innerHeight - list[list.length - 1].getHostElement().offsetTop;\n }\n return (\n list[list.length - 1].getHostElement().offsetTop + list[list.length - 1].getHostElement().offsetHeight\n );\n }\n\n private getPositionStrategy(\n positionStrategy: GlobalPositionStrategy,\n location: AXLocation,\n pos: string,\n gap: number,\n ) {\n switch (location) {\n case 'bottom-center':\n return positionStrategy.bottom(pos).centerHorizontally();\n break;\n case 'bottom-end':\n return positionStrategy.bottom(pos).right(gap + 'px');\n break;\n case 'bottom-start':\n return positionStrategy.bottom(pos).left(gap + 'px');\n break;\n case 'top-center':\n return positionStrategy.top(pos).centerHorizontally();\n break;\n case 'top-end':\n return positionStrategy.top(pos).right(gap + 'px');\n break;\n case 'top-start':\n return positionStrategy.top(pos).left(gap + 'px');\n break;\n case 'center-start':\n return positionStrategy.centerVertically().left(gap + 'px');\n break;\n case 'center-end':\n return positionStrategy.centerVertically().right(gap + 'px');\n break;\n }\n }\n}\n","import { AXButtonModule } from '@acorex/components/button';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { AXLoadingModule } from '@acorex/components/loading';\nimport { AXTranslationModule } from '@acorex/core/translation';\nimport { DialogModule } from '@angular/cdk/dialog';\nimport { PortalModule } from '@angular/cdk/portal';\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { AXNotificationComponent } from './notification.component';\nimport { AXNotificationService } from './notification.service';\n\nconst COMPONENT = [AXNotificationComponent];\nconst MODULES = [CommonModule, PortalModule, AXButtonModule, DialogModule, AXLoadingModule, AXDecoratorModule, AXTranslationModule];\n\n@NgModule({\n declarations: [...COMPONENT],\n imports: [...MODULES],\n exports: [...COMPONENT],\n providers: [AXNotificationService],\n})\nexport class AXNotificationModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAaA;;;;AAIG;AASG,MAAO,uBAAwB,SAAQ,eAAe,CAAA;AAO1D;;AAEG;IACH,WAES,CAAA,MAA0B,EAC1B,SAA2C,EAAA;AAElD,QAAA,KAAK,EAAE;QAHA,IAAM,CAAA,MAAA,GAAN,MAAM;QACN,IAAS,CAAA,SAAA,GAAT,SAAS;;;IAMT,QAAQ,GAAA;QACf,KAAK,CAAC,QAAQ,EAAE;QAChB,IAAI,CAAC,YAAY,EAAE;QACnB,IAAI,CAAC,SAAS,EAAE;QAChB,IAAI,CAAC,cAAc,EAAE;;;IAIf,cAAc,GAAA;AACpB,QAAA,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YACvB,UAAU,CAAC,MAAK;gBACd,IAAI,CAAC,KAAK,EAAE;AACd,aAAC,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;;;;IAKnB,YAAY,GAAA;QAClB,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,YAAY,WAAW,EAAE;AAC9C,YAAA,IAAI,CAAC,eAAe,GAAG,IAAI,cAAc,CACvC,IAAI,CAAC,MAAM,CAAC,OAA+B,EAC3C,IAAI,CAAC,gBAAgB,EAAE,CACxB;AACD,YAAA,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE;;aAClB,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,KAAK,UAAU,EAAE;AACpD,YAAA,IAAI,CA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AAE,mBAAmB,CAAC;MAQtH,oBAAoB,CAAA;8GAApB,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAApB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,iBATd,uBAAuB,CAAA,EAAA,OAAA,EAAA,CACzB,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,mBAAmB,aAD/G,uBAAuB,CAAA,EAAA,CAAA,CAAA;AAS7B,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,EAFpB,SAAA,EAAA,CAAC,qBAAqB,CAAC,YAFrB,OAAO,CAAA,EAAA,CAAA,CAAA;;2FAIT,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBANhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,CAAC,GAAG,SAAS,CAAC;AAC5B,oBAAA,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;AACrB,oBAAA,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC;oBACvB,SAAS,EAAE,CAAC,qBAAqB,CAAC;AACnC,iBAAA;;;ACnBD;;AAEG;;;;"}
1
+ {"version":3,"file":"acorex-components-notification.mjs","sources":["../../../../libs/components/notification/src/lib/notification.component.ts","../../../../libs/components/notification/src/lib/notification.component.html","../../../../libs/components/notification/src/lib/notification.config.ts","../../../../libs/components/notification/src/lib/notification.service.ts","../../../../libs/components/notification/src/lib/notification.module.ts","../../../../libs/components/notification/src/acorex-components-notification.ts"],"sourcesContent":["import { AXClosbaleComponent, AXComponentCloseEvent, MXBaseComponent } from '@acorex/components/common';\nimport { DIALOG_DATA, DialogRef } from '@angular/cdk/dialog';\nimport { ComponentPortal, ComponentType, Portal, TemplatePortal } from '@angular/cdk/portal';\nimport {\n ChangeDetectionStrategy,\n Component,\n HostBinding,\n Inject,\n TemplateRef,\n ViewEncapsulation,\n} from '@angular/core';\nimport { AXNotificationButtonItem, AXNotificationData } from './notification.class';\n\n/**\n * The Button is a component which detects user interaction and triggers a corresponding event\n *\n * @category Components\n */\n@Component({\n selector: 'ax-notification',\n templateUrl: './notification.component.html',\n styleUrls: ['./notification.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n providers: [{ provide: AXClosbaleComponent, useExisting: AXNotificationComponent }],\n})\nexport class AXNotificationComponent extends MXBaseComponent {\n /** @ignore */\n _selectedPortal: Portal<unknown>;\n\n /** @ignore */\n _icon: string;\n\n /**\n * @ignore\n */\n constructor(\n @Inject(DIALOG_DATA)\n public config: AXNotificationData,\n public dialogRef: DialogRef<AXComponentCloseEvent>,\n ) {\n super();\n }\n\n /** @ignore */\n override ngOnInit() {\n super.ngOnInit();\n this._initContent();\n this._initIcon();\n this._handleTimeOut();\n }\n\n /** @ignore */\n private _handleTimeOut() {\n if (this.config.timeOut) {\n setTimeout(() => {\n this.close();\n }, this.config.timeOut);\n }\n }\n\n /** @ignore */\n private _initContent() {\n if (this.config.content instanceof TemplateRef) {\n this._selectedPortal = new TemplatePortal(\n this.config.content as TemplateRef<unknown>,\n this.getViewContainer(),\n );\n this.cdr.markForCheck();\n } else if (typeof this.config.content === 'function') {\n this._selectedPortal = new ComponentPortal(this.config.content as ComponentType<unknown>);\n this.cdr.markForCheck();\n }\n }\n\n /** @ignore */\n private _initIcon() {\n if (!this.config.icon) {\n switch (this.config.color) {\n case 'success':\n this._icon = 'ax-icon ax-icon-check-circle';\n break;\n case 'danger':\n this._icon = 'ax-icon ax-icon-error';\n break;\n case 'warning':\n this._icon = 'ax-icon ax-icon-warning';\n break;\n case 'info':\n this._icon = 'ax-icon ax-icon-info';\n break;\n default:\n this._icon = this.config.icon || 'ax-icon ax-icon-check-circle';\n break;\n }\n } else {\n this._icon = this.config.icon;\n }\n }\n\n /** @ignore */\n protected _handleButtonClick(button: AXNotificationButtonItem) {\n if (button.onClick) {\n button.onClick({ source: button });\n }\n }\n\n /** @ignore */\n @HostBinding('class')\n private get __hostClass(): string {\n return `ax-${this.config.color}`;\n }\n\n /**\n * Closes the dialog and provides the component and HTML element for reference.\n */\n close() {\n this.dialogRef.close({\n component: this,\n htmlElement: this.getHostElement(),\n });\n }\n}\n","<span class=\"ax-notification-icon ax-icon-solid {{ _icon }}\"></span>\n<div class=\"ax-notification-content\">\n <div class=\"ax-notification-title\">{{ config.title | translate | async }}</div>\n @if(_selectedPortal){\n <ng-template [cdkPortalOutlet]=\"_selectedPortal\"></ng-template>\n } @else{\n <div>{{ config.content }}</div>\n }\n\n @if(config.buttons?.length){\n <div class=\"ax-notification-buttons\">\n @for(button of config.buttons; track $index){\n <ax-button class=\"ax-xs\" [text]=\"button.text | translate | async\" [color]=\"button.color\" [look]=\"button.look\"\n [disabled]=\"button.disabled\" (onClick)=\"_handleButtonClick(button)\">\n @if(button.loading){\n <ax-loading></ax-loading>\n }\n </ax-button>\n }\n </div>\n }\n\n</div>\n@if(config.closeButton){\n<ax-close-button></ax-close-button>\n}\n@if(config.timeOutProgress && config.timeOut){\n<div class=\"ax-notification-progress\" [style.animation-duration.ms]=\"config.timeOut\"></div>\n}","import { AXLocation } from '@acorex/components/common';\nimport { InjectionToken } from '@angular/core';\n\nexport interface AXNotificationConfig {\n gap: number;\n timeOut: number;\n timeOutProgress: boolean;\n location: AXLocation;\n closeButton: boolean;\n limit: number;\n}\n\nexport const AX_NOTIFICATION_CONFIG = new InjectionToken<AXNotificationConfig>('AX_NOTIFICATION_CONFIG', {\n providedIn: 'root',\n factory: () => AXNotificationDefaultConfig,\n});\n\nexport const AXNotificationDefaultConfig: AXNotificationConfig = {\n gap: 5,\n timeOut: 2500,\n timeOutProgress: true,\n closeButton: true,\n location: 'top-end',\n limit: 3,\n};\n\nexport type PartialNotificationConfig = Partial<AXNotificationConfig>;\n\nexport function notificationConfig(config: PartialNotificationConfig = {}): AXNotificationConfig {\n const result = {\n ...AXNotificationDefaultConfig,\n ...config,\n };\n return result;\n}\n","import { AXLocation, AXStyleColorType } from '@acorex/components/common';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { Dialog } from '@angular/cdk/dialog';\nimport { GlobalPositionStrategy } from '@angular/cdk/overlay';\nimport { Injectable, inject } from '@angular/core';\nimport {\n AXNotificationOptions as AXNotificationDisplayConfig,\n AXNotificationRef,\n} from './notification.class';\nimport { AXNotificationComponent } from './notification.component';\nimport { AXNotificationConfig, AX_NOTIFICATION_CONFIG } from './notification.config';\n\ntype AXReservedNotifications = {\n config: AXNotificationDisplayConfig;\n reservedRef: {\n close: () => void;\n };\n};\n\n@Injectable()\nexport class AXNotificationService {\n private dialog: Dialog = inject(Dialog);\n private translationService: AXTranslationService = inject(AXTranslationService);\n private defaultConfig: AXNotificationConfig = inject(AX_NOTIFICATION_CONFIG);\n private activeNotifications: string[] = [];\n private reservedNotifications: AXReservedNotifications[] = [];\n private notificationCounterElement: AXNotificationComponent | null = null;\n private moreNotificationsColor: AXStyleColorType = 'primary';\n private moreNotificationsLocation: AXLocation = 'bottom-center';\n private reserveCounter = 0;\n\n show(config: AXNotificationDisplayConfig): AXNotificationRef {\n config = { ...this.defaultConfig, ...config };\n\n this.moreNotificationsColor = config.color;\n this.moreNotificationsLocation = config.location;\n\n if (this.defaultConfig.limit > 0 && this.activeNotifications.length >= this.defaultConfig.limit) {\n const reservedRef = {\n close: () => {\n console.warn('Reserved notification cannot be closed until it is displayed.');\n },\n };\n this.reservedNotifications.push({ config, reservedRef });\n this.handleReservedNotificationCounter();\n return reservedRef;\n }\n\n return this.displayNotification(config);\n }\n\n private displayNotification(config: AXNotificationDisplayConfig): AXNotificationRef {\n const gap = this.defaultConfig.gap;\n const pos = this.getPosition(config.location) + gap + 'px';\n const positionStrategy = this.getPositionStrategy(\n new GlobalPositionStrategy(),\n config.location,\n pos,\n gap,\n );\n\n const dialogRef = this.dialog.open(AXNotificationComponent, {\n data: config,\n autoFocus: '__no_element__',\n restoreFocus: false,\n role: 'dialog',\n ariaModal: true,\n closeOnNavigation: true,\n closeOnDestroy: true,\n hasBackdrop: false,\n panelClass: ['ax-animate-animated', 'ax-animate-fadeIn', 'ax-animate-faster'],\n positionStrategy,\n });\n\n this.activeNotifications.push(dialogRef.id);\n this.handleReservedNotificationCounter();\n\n const notificationRef = dialogRef.componentInstance as AXNotificationComponent;\n dialogRef.closed.subscribe(() => {\n this.activeNotifications = this.activeNotifications.filter((id) => id !== dialogRef.id);\n\n this.handleShowReservedNotification();\n this.handleReservedNotificationCounter();\n\n setTimeout(() => {\n this.reposition(config.location, gap);\n }, 0);\n });\n\n return {\n close: () => {\n notificationRef.close();\n },\n };\n }\n\n hideAll() {\n this.dialog.closeAll();\n this.reserveCounter = 0;\n this.reservedNotifications = [];\n this.activeNotifications = [];\n this.handleReservedNotificationCounter();\n }\n\n private handleShowReservedNotification() {\n if (this.activeNotifications.length > this.defaultConfig.limit - 1) return;\n if (!this.reservedNotifications.length) return;\n\n const { config, reservedRef } = this.reservedNotifications.shift();\n\n const displayedRef = this.displayNotification(config);\n this.handleReservedNotificationCounter();\n reservedRef.close = displayedRef.close;\n }\n\n private handleReservedNotificationCounter() {\n const reservedCount = this.reservedNotifications.length;\n\n if (reservedCount === this.reserveCounter) return;\n\n this.reserveCounter = reservedCount;\n\n if (reservedCount === 0 && this.notificationCounterElement !== null) {\n this.notificationCounterElement.close();\n return;\n }\n\n if (reservedCount > 0) {\n if (this.notificationCounterElement !== null) {\n this.notificationCounterElement.close();\n }\n this.createReservedCounterToast();\n }\n }\n\n private async createReservedCounterToast() {\n const opt: AXNotificationDisplayConfig = {\n closeButton: false,\n color: this.moreNotificationsColor,\n location: this.moreNotificationsLocation,\n title: await this.translationService.translateAsync('more-notification', {\n params: { number: this.reserveCounter },\n }),\n timeOutProgress: false,\n };\n const gap = this.defaultConfig.gap;\n const pos = this.getPosition(opt.location) + gap + 'px';\n const positionStrategy = this.getPositionStrategy(new GlobalPositionStrategy(), opt.location, pos, gap);\n const dialogRef = this.dialog.open(AXNotificationComponent, {\n data: opt,\n autoFocus: '__no_element__',\n restoreFocus: true,\n role: 'dialog',\n ariaModal: true,\n closeOnNavigation: true,\n closeOnDestroy: true,\n hasBackdrop: false,\n panelClass: ['ax-animate-animated', 'ax-animate-fadeIn', 'ax-animate-faster'],\n positionStrategy,\n });\n this.notificationCounterElement = dialogRef.componentInstance as AXNotificationComponent;\n }\n\n private reposition(notificationLocation: AXLocation, gap: number): void {\n const list = this.dialog.openDialogs\n .map((c) => c.componentInstance as AXNotificationComponent)\n .filter((c) => c.config?.location == notificationLocation);\n list.forEach((element, index) => {\n const pos = this.getRepositionPosition(index, gap, list, notificationLocation);\n\n this.getPositionStrategy(\n element.dialogRef.config.positionStrategy as GlobalPositionStrategy,\n notificationLocation,\n pos,\n gap,\n ).apply();\n });\n }\n\n private getRepositionPosition(\n index: number,\n gap: number,\n list: AXNotificationComponent[],\n notificationLocation: string,\n ) {\n if (index === 0) return gap + 'px';\n const previouseElement = list[index - 1];\n if (notificationLocation.split('-')[0] == 'bottom') {\n return window.innerHeight - previouseElement.getHostElement().offsetTop + gap + 'px';\n }\n return (\n previouseElement.getHostElement().offsetTop +\n previouseElement.getHostElement().offsetHeight +\n gap +\n 'px'\n );\n }\n\n private getPosition(location: string) {\n const list = this.dialog.openDialogs\n .map((c) => c.componentInstance as AXNotificationComponent)\n .filter((c) => c.config.location == location);\n if (list.length == 0) return 0;\n if (location.split('-')[0] == 'bottom') {\n return window.innerHeight - list[list.length - 1].getHostElement().offsetTop;\n }\n return (\n list[list.length - 1].getHostElement().offsetTop + list[list.length - 1].getHostElement().offsetHeight\n );\n }\n\n private getPositionStrategy(\n positionStrategy: GlobalPositionStrategy,\n location: AXLocation,\n pos: string,\n gap: number,\n ) {\n switch (location) {\n case 'bottom-center':\n return positionStrategy.bottom(pos).centerHorizontally();\n break;\n case 'bottom-end':\n return positionStrategy.bottom(pos).right(gap + 'px');\n break;\n case 'bottom-start':\n return positionStrategy.bottom(pos).left(gap + 'px');\n break;\n case 'top-center':\n return positionStrategy.top(pos).centerHorizontally();\n break;\n case 'top-end':\n return positionStrategy.top(pos).right(gap + 'px');\n break;\n case 'top-start':\n return positionStrategy.top(pos).left(gap + 'px');\n break;\n case 'center-start':\n return positionStrategy.centerVertically().left(gap + 'px');\n break;\n case 'center-end':\n return positionStrategy.centerVertically().right(gap + 'px');\n break;\n }\n }\n}\n","import { AXButtonModule } from '@acorex/components/button';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { AXLoadingModule } from '@acorex/components/loading';\nimport { AXTranslationModule } from '@acorex/core/translation';\nimport { DialogModule } from '@angular/cdk/dialog';\nimport { PortalModule } from '@angular/cdk/portal';\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { AXNotificationComponent } from './notification.component';\nimport { AXNotificationService } from './notification.service';\n\nconst COMPONENT = [AXNotificationComponent];\nconst MODULES = [CommonModule, PortalModule, AXButtonModule, DialogModule, AXLoadingModule, AXDecoratorModule, AXTranslationModule];\n\n@NgModule({\n declarations: [...COMPONENT],\n imports: [...MODULES],\n exports: [...COMPONENT],\n providers: [AXNotificationService],\n})\nexport class AXNotificationModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAaA;;;;AAIG;AASG,MAAO,uBAAwB,SAAQ,eAAe,CAAA;AAO1D;;AAEG;IACH,WAES,CAAA,MAA0B,EAC1B,SAA2C,EAAA;AAElD,QAAA,KAAK,EAAE;QAHA,IAAM,CAAA,MAAA,GA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AA;;2FAIT,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBANhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,CAAC,GAAG,SAAS,CAAC;AAC5B,oBAAA,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;AACrB,oBAAA,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC;oBACvB,SAAS,EAAE,CAAC,qBAAqB,CAAC;AACnC,iBAAA;;;ACnBD;;AAEG;;;;"}
@@ -2,13 +2,13 @@ import { MXBaseComponent, AXClosbaleComponent } from '@acorex/components/common'
2
2
  import * as i1 from '@angular/cdk/dialog';
3
3
  import { DIALOG_DATA, Dialog, DialogModule } from '@angular/cdk/dialog';
4
4
  import * as i0 from '@angular/core';
5
- import { Component, ChangeDetectionStrategy, ViewEncapsulation, Inject, HostBinding, InjectionToken, inject, signal, effect, Injectable, NgModule } from '@angular/core';
5
+ import { Component, ChangeDetectionStrategy, ViewEncapsulation, Inject, HostBinding, InjectionToken, inject, Injectable, NgModule } from '@angular/core';
6
6
  import * as i2 from '@acorex/components/decorators';
7
7
  import { AXDecoratorModule } from '@acorex/components/decorators';
8
8
  import * as i3 from '@angular/common';
9
9
  import { CommonModule } from '@angular/common';
10
10
  import * as i4 from '@acorex/core/translation';
11
- import { AXTranslationModule } from '@acorex/core/translation';
11
+ import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
12
12
  import { AX_GLOBAL_CONFIG } from '@acorex/core/config';
13
13
  import { set } from 'lodash-es';
14
14
  import { AXButtonModule } from '@acorex/components/button';
@@ -121,23 +121,16 @@ class AXToastService {
121
121
  constructor(scrollStrategyOptions) {
122
122
  this.scrollStrategyOptions = scrollStrategyOptions;
123
123
  this.dialog = inject(Dialog);
124
+ this.translationService = inject(AXTranslationService);
124
125
  this.defaultConfig = inject(AX_TOAST_CONFIG);
125
- this.activeToasts = signal([]);
126
- this.reservedToasts = signal([]);
127
- this.toastCounterElement = signal(null);
128
- this.moreToastsColor = signal('primary');
129
- this.moreToastsLocation = signal('bottom-center');
130
- this.reserveCounter = signal(0);
131
- this.#effect = effect(() => {
132
- if (this.defaultConfig.limit <= 0)
133
- return;
134
- this.handleShowReservedToast();
135
- this.handleShowReservedToastCounter();
136
- this.handleReserveCounter();
137
- }, { allowSignalWrites: true });
126
+ this.activeToasts = [];
127
+ this.reservedToasts = [];
128
+ this.toastCounterElement = null;
129
+ this.moreToastsColor = 'primary';
130
+ this.moreToastsLocation = 'bottom-center';
131
+ this.reserveCounter = 0;
138
132
  this.scrollStrategy = this.scrollStrategyOptions.noop();
139
133
  }
140
- #effect;
141
134
  primary(content) {
142
135
  this.show({
143
136
  timeOut: this.defaultConfig.timeOut,
@@ -174,27 +167,27 @@ class AXToastService {
174
167
  });
175
168
  }
176
169
  show(config) {
177
- const opt = Object.assign({
178
- closeButton: true,
179
- location: this.defaultConfig.location ?? 'bottom-center',
180
- }, config);
181
- this.moreToastsColor.set(opt.color);
182
- this.moreToastsLocation.set(opt.location);
183
- if (this.defaultConfig.limit > 0) {
184
- if (this.activeToasts().length >= this.defaultConfig.limit) {
185
- this.reservedToasts.update((value) => [...value, opt]);
186
- return {
187
- close: () => {
188
- //TODO close reserved toast
189
- },
190
- };
191
- }
170
+ config = { ...this.defaultConfig, ...config };
171
+ this.moreToastsColor = config.color;
172
+ this.moreToastsLocation = config.location;
173
+ if (this.defaultConfig.limit > 0 && this.activeToasts.length >= this.defaultConfig.limit) {
174
+ const reservedRef = {
175
+ close: () => {
176
+ console.warn('Reserved notification cannot be closed until it is displayed.');
177
+ },
178
+ };
179
+ this.reservedToasts.push({ config, reservedRef });
180
+ this.handleReservedToastCounter();
181
+ return reservedRef;
192
182
  }
183
+ return this.displayToast(config);
184
+ }
185
+ displayToast(config) {
193
186
  const gap = this.defaultConfig.gap;
194
- const pos = this.getPosition(opt.location) + gap + 'px';
195
- const positionStrategy = this.getPositionStrategy(new GlobalPositionStrategy(), opt.location, pos, gap);
187
+ const pos = this.getPosition(config.location) + gap + 'px';
188
+ const positionStrategy = this.getPositionStrategy(new GlobalPositionStrategy(), config.location, pos, gap);
196
189
  const dialogRef = this.dialog.open(AXToastComponent, {
197
- data: opt,
190
+ data: config,
198
191
  autoFocus: '__no_element__',
199
192
  restoreFocus: true,
200
193
  role: 'dialog',
@@ -206,12 +199,15 @@ class AXToastService {
206
199
  positionStrategy,
207
200
  scrollStrategy: this.scrollStrategy,
208
201
  });
209
- this.activeToasts.update((value) => [...value, dialogRef.id]);
202
+ this.activeToasts.push(dialogRef.id);
203
+ this.handleReservedToastCounter();
210
204
  const toastRef = dialogRef.componentInstance;
211
205
  dialogRef.closed.subscribe(() => {
212
- this.activeToasts.update((value) => [...value].filter((dialogID) => dialogID !== dialogRef.id));
206
+ this.activeToasts = this.activeToasts.filter((id) => id !== dialogRef.id);
207
+ this.handleShowReservedToast();
208
+ this.handleReservedToastCounter();
213
209
  setTimeout(() => {
214
- this.reposition(opt.location, gap);
210
+ this.reposition(config.location, gap);
215
211
  }, 0);
216
212
  });
217
213
  return {
@@ -222,40 +218,45 @@ class AXToastService {
222
218
  }
223
219
  hideAll() {
224
220
  this.dialog.closeAll();
221
+ this.reserveCounter = 0;
222
+ this.reservedToasts = [];
223
+ this.activeToasts = [];
224
+ this.handleReservedToastCounter();
225
225
  }
226
226
  handleShowReservedToast() {
227
- if (this.activeToasts().length > this.defaultConfig.limit - 1)
227
+ if (this.activeToasts.length > this.defaultConfig.limit - 1)
228
228
  return;
229
- if (!this.reservedToasts().length)
229
+ if (!this.reservedToasts.length)
230
230
  return;
231
- this.show(this.reservedToasts()[0]);
232
- this.reservedToasts.update((value) => {
233
- const toasts = [...value];
234
- toasts.shift();
235
- return toasts;
236
- });
237
- }
238
- handleShowReservedToastCounter() {
239
- if (this.reservedToasts().length === this.reserveCounter())
240
- return;
241
- this.reserveCounter.set(this.reservedToasts().length);
242
- if (this.toastCounterElement() !== null)
243
- this.toastCounterElement().close();
244
- this.createReservedCounterToast();
231
+ const { config, reservedRef } = this.reservedToasts.shift();
232
+ const displayedRef = this.displayToast(config);
233
+ this.handleReservedToastCounter();
234
+ reservedRef.close = displayedRef.close;
245
235
  }
246
- handleReserveCounter() {
247
- if (this.reserveCounter() !== 0)
236
+ handleReservedToastCounter() {
237
+ const reservedCount = this.reservedToasts.length;
238
+ if (reservedCount === this.reserveCounter)
248
239
  return;
249
- if (this.toastCounterElement() === null)
240
+ this.reserveCounter = reservedCount;
241
+ if (reservedCount === 0 && this.toastCounterElement !== null) {
242
+ this.toastCounterElement.close();
250
243
  return;
251
- this.toastCounterElement().close();
244
+ }
245
+ if (reservedCount > 0) {
246
+ if (this.toastCounterElement !== null) {
247
+ this.toastCounterElement.close();
248
+ }
249
+ this.createReservedCounterToast();
250
+ }
252
251
  }
253
- createReservedCounterToast() {
252
+ async createReservedCounterToast() {
254
253
  const opt = {
255
254
  closeButton: false,
256
- color: this.moreToastsColor(),
257
- location: this.moreToastsLocation(),
258
- title: `And ${this.reserveCounter()} more...`,
255
+ color: this.moreToastsColor,
256
+ location: this.moreToastsLocation,
257
+ title: await this.translationService.translateAsync('more-toast', {
258
+ params: { number: this.reserveCounter },
259
+ }),
259
260
  timeOutProgress: false,
260
261
  };
261
262
  const gap = this.defaultConfig.gap;
@@ -274,7 +275,7 @@ class AXToastService {
274
275
  positionStrategy,
275
276
  scrollStrategy: this.scrollStrategy,
276
277
  });
277
- this.toastCounterElement.set(dialogRef.componentInstance);
278
+ this.toastCounterElement = dialogRef.componentInstance;
278
279
  }
279
280
  reposition(toastLocation, gap) {
280
281
  const list = this.dialog.openDialogs
@@ -282,7 +283,6 @@ class AXToastService {
282
283
  .filter((c) => c.config?.location == toastLocation);
283
284
  list.forEach((element, index) => {
284
285
  const pos = this.getRepositionPosition(index, gap, list, toastLocation);
285
- console.log(index, element);
286
286
  this.getPositionStrategy(element.dialogRef.config.positionStrategy, toastLocation, pos, gap).apply();
287
287
  });
288
288
  }