@acorex/components 18.12.42 → 18.12.43

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,45 +1,39 @@
1
+ import { AXTranslationService } from '@acorex/core/translation';
1
2
  import { Dialog } from '@angular/cdk/dialog';
2
3
  import { GlobalPositionStrategy } from '@angular/cdk/overlay';
3
- import { Injectable, effect, inject, signal } from '@angular/core';
4
+ import { Injectable, inject } from '@angular/core';
4
5
  import { AXNotificationComponent } from './notification.component';
5
6
  import { AX_NOTIFICATION_CONFIG } from './notification.config';
6
7
  import * as i0 from "@angular/core";
7
8
  export class AXNotificationService {
8
9
  constructor() {
9
10
  this.dialog = inject(Dialog);
11
+ this.translationService = inject(AXTranslationService);
10
12
  this.defaultConfig = inject(AX_NOTIFICATION_CONFIG);
11
- this.activeNotifications = signal([]);
12
- this.reservedNotifications = signal([]);
13
- this.notificationCounterElement = signal(null);
14
- this.moreNotificationsColor = signal('primary');
15
- this.moreNotificationsLocation = signal('bottom-center');
16
- this.reserveCounter = signal(0);
17
- this.#effect = effect(() => {
18
- if (this.defaultConfig.limit <= 0)
19
- return;
20
- this.handleShowReservedNotification();
21
- this.handleShowReservedNotificationCounter();
22
- this.handleReserveCounter();
23
- }, { allowSignalWrites: true });
13
+ this.activeNotifications = [];
14
+ this.reservedNotifications = [];
15
+ this.notificationCounterElement = null;
16
+ this.moreNotificationsColor = 'primary';
17
+ this.moreNotificationsLocation = 'bottom-center';
18
+ this.reserveCounter = 0;
24
19
  }
25
- #effect;
26
20
  show(config) {
27
- config = Object.assign({
28
- closeButton: true,
29
- location: this.defaultConfig.location,
30
- }, config);
31
- this.moreNotificationsColor.set(config.color);
32
- this.moreNotificationsLocation.set(config.location);
33
- if (this.defaultConfig.limit > 0) {
34
- if (this.activeNotifications().length >= this.defaultConfig.limit) {
35
- this.reservedNotifications.update((value) => [...value, config]);
36
- return {
37
- close: () => {
38
- //TODO close reserved notification
39
- },
40
- };
41
- }
21
+ config = { ...this.defaultConfig, ...config };
22
+ this.moreNotificationsColor = config.color;
23
+ this.moreNotificationsLocation = config.location;
24
+ if (this.defaultConfig.limit > 0 && this.activeNotifications.length >= this.defaultConfig.limit) {
25
+ const reservedRef = {
26
+ close: () => {
27
+ console.warn('Reserved notification cannot be closed until it is displayed.');
28
+ },
29
+ };
30
+ this.reservedNotifications.push({ config, reservedRef });
31
+ this.handleReservedNotificationCounter();
32
+ return reservedRef;
42
33
  }
34
+ return this.displayNotification(config);
35
+ }
36
+ displayNotification(config) {
43
37
  const gap = this.defaultConfig.gap;
44
38
  const pos = this.getPosition(config.location) + gap + 'px';
45
39
  const positionStrategy = this.getPositionStrategy(new GlobalPositionStrategy(), config.location, pos, gap);
@@ -55,10 +49,13 @@ export class AXNotificationService {
55
49
  panelClass: ['ax-animate-animated', 'ax-animate-fadeIn', 'ax-animate-faster'],
56
50
  positionStrategy,
57
51
  });
58
- this.activeNotifications.update((value) => [...value, dialogRef.id]);
52
+ this.activeNotifications.push(dialogRef.id);
53
+ this.handleReservedNotificationCounter();
59
54
  const notificationRef = dialogRef.componentInstance;
60
55
  dialogRef.closed.subscribe(() => {
61
- this.activeNotifications.update((value) => [...value].filter((dialogID) => dialogID !== dialogRef.id));
56
+ this.activeNotifications = this.activeNotifications.filter((id) => id !== dialogRef.id);
57
+ this.handleShowReservedNotification();
58
+ this.handleReservedNotificationCounter();
62
59
  setTimeout(() => {
63
60
  this.reposition(config.location, gap);
64
61
  }, 0);
@@ -71,40 +68,45 @@ export class AXNotificationService {
71
68
  }
72
69
  hideAll() {
73
70
  this.dialog.closeAll();
71
+ this.reserveCounter = 0;
72
+ this.reservedNotifications = [];
73
+ this.activeNotifications = [];
74
+ this.handleReservedNotificationCounter();
74
75
  }
75
76
  handleShowReservedNotification() {
76
- if (this.activeNotifications().length > this.defaultConfig.limit - 1)
77
- return;
78
- if (!this.reservedNotifications().length)
77
+ if (this.activeNotifications.length > this.defaultConfig.limit - 1)
79
78
  return;
80
- this.show(this.reservedNotifications()[0]);
81
- this.reservedNotifications.update((value) => {
82
- const arr = [...value];
83
- arr.shift();
84
- return arr;
85
- });
86
- }
87
- handleShowReservedNotificationCounter() {
88
- if (this.reservedNotifications().length === this.reserveCounter())
79
+ if (!this.reservedNotifications.length)
89
80
  return;
90
- this.reserveCounter.set(this.reservedNotifications().length);
91
- if (this.notificationCounterElement() !== null)
92
- this.notificationCounterElement().close();
93
- this.createReservedCounterToast();
81
+ const { config, reservedRef } = this.reservedNotifications.shift();
82
+ const displayedRef = this.displayNotification(config);
83
+ this.handleReservedNotificationCounter();
84
+ reservedRef.close = displayedRef.close;
94
85
  }
95
- handleReserveCounter() {
96
- if (this.reserveCounter() !== 0)
86
+ handleReservedNotificationCounter() {
87
+ const reservedCount = this.reservedNotifications.length;
88
+ if (reservedCount === this.reserveCounter)
97
89
  return;
98
- if (this.notificationCounterElement() === null)
90
+ this.reserveCounter = reservedCount;
91
+ if (reservedCount === 0 && this.notificationCounterElement !== null) {
92
+ this.notificationCounterElement.close();
99
93
  return;
100
- this.notificationCounterElement().close();
94
+ }
95
+ if (reservedCount > 0) {
96
+ if (this.notificationCounterElement !== null) {
97
+ this.notificationCounterElement.close();
98
+ }
99
+ this.createReservedCounterToast();
100
+ }
101
101
  }
102
- createReservedCounterToast() {
102
+ async createReservedCounterToast() {
103
103
  const opt = {
104
104
  closeButton: false,
105
- color: this.moreNotificationsColor(),
106
- location: this.moreNotificationsLocation(),
107
- title: `And ${this.reserveCounter()} more...`,
105
+ color: this.moreNotificationsColor,
106
+ location: this.moreNotificationsLocation,
107
+ title: await this.translationService.translateAsync('more-notification', {
108
+ params: { number: this.reserveCounter },
109
+ }),
108
110
  timeOutProgress: false,
109
111
  };
110
112
  const gap = this.defaultConfig.gap;
@@ -122,7 +124,7 @@ export class AXNotificationService {
122
124
  panelClass: ['ax-animate-animated', 'ax-animate-fadeIn', 'ax-animate-faster'],
123
125
  positionStrategy,
124
126
  });
125
- this.notificationCounterElement.set(dialogRef.componentInstance);
127
+ this.notificationCounterElement = dialogRef.componentInstance;
126
128
  }
127
129
  reposition(notificationLocation, gap) {
128
130
  const list = this.dialog.openDialogs
@@ -190,4 +192,4 @@ export class AXNotificationService {
190
192
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXNotificationService, decorators: [{
191
193
  type: Injectable
192
194
  }] });
193
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm90aWZpY2F0aW9uLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9saWJzL2NvbXBvbmVudHMvbm90aWZpY2F0aW9uL3NyYy9saWIvbm90aWZpY2F0aW9uLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLE1BQU0sRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQzdDLE9BQU8sRUFBRSxzQkFBc0IsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQzlELE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxFQUFFLE1BQU0sRUFBRSxNQUFNLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFLbkUsT0FBTyxFQUFFLHVCQUF1QixFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFDbkUsT0FBTyxFQUF3QixzQkFBc0IsRUFBRSxNQUFNLHVCQUF1QixDQUFDOztBQUdyRixNQUFNLE9BQU8scUJBQXFCO0lBRGxDO1FBRVUsV0FBTSxHQUFXLE1BQU0sQ0FBQyxNQUFNLENBQUMsQ0FBQztRQUNoQyxrQkFBYSxHQUF5QixNQUFNLENBQUMsc0JBQXNCLENBQUMsQ0FBQztRQUNyRSx3QkFBbUIsR0FBRyxNQUFNLENBQVcsRUFBRSxDQUFDLENBQUM7UUFDM0MsMEJBQXFCLEdBQUcsTUFBTSxDQUFnQyxFQUFFLENBQUMsQ0FBQztRQUNsRSwrQkFBMEIsR0FBRyxNQUFNLENB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cbiAgICBsb2NhdGlvbjogQVhMb2NhdGlvbixcbiAgICBwb3M6IHN0cmluZyxcbiAgICBnYXA6IG51bWJlcixcbiAgKSB7XG4gICAgc3dpdGNoIChsb2NhdGlvbikge1xuICAgICAgY2FzZSAnYm90dG9tLWNlbnRlcic6XG4gICAgICAgIHJldHVybiBwb3NpdGlvblN0cmF0ZWd5LmJvdHRvbShwb3MpLmNlbnRlckhvcml6b250YWxseSgpO1xuICAgICAgICBicmVhaztcbiAgICAgIGNhc2UgJ2JvdHRvbS1lbmQnOlxuICAgICAgICByZXR1cm4gcG9zaXRpb25TdHJhdGVneS5ib3R0b20ocG9zKS5yaWdodChnYXAgKyAncHgnKTtcbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlICdib3R0b20tc3RhcnQnOlxuICAgICAgICByZXR1cm4gcG9zaXRpb25TdHJhdGVneS5ib3R0b20ocG9zKS5sZWZ0KGdhcCArICdweCcpO1xuICAgICAgICBicmVhaztcbiAgICAgIGNhc2UgJ3RvcC1jZW50ZXInOlxuICAgICAgICByZXR1cm4gcG9zaXRpb25TdHJhdGVneS50b3AocG9zKS5jZW50ZXJIb3Jpem9udGFsbHkoKTtcbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlICd0b3AtZW5kJzpcbiAgICAgICAgcmV0dXJuIHBvc2l0aW9uU3RyYXRlZ3kudG9wKHBvcykucmlnaHQoZ2FwICsgJ3B4Jyk7XG4gICAgICAgIGJyZWFrO1xuICAgICAgY2FzZSAndG9wLXN0YXJ0JzpcbiAgICAgICAgcmV0dXJuIHBvc2l0aW9uU3RyYXRlZ3kudG9wKHBvcykubGVmdChnYXAgKyAncHgnKTtcbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlICdjZW50ZXItc3RhcnQnOlxuICAgICAgICByZXR1cm4gcG9zaXRpb25TdHJhdGVneS5jZW50ZXJWZXJ0aWNhbGx5KCkubGVmdChnYXAgKyAncHgnKTtcbiAgICAgICAgYnJlYWs7XG4gICAgIC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N0Lmxlbmd0aCA9PSAwKSByZXR1cm4gMDtcbiAgICBpZiAobG9jYXRpb24uc3BsaXQoJy0nKVswXSA9PSAnYm90dG9tJykge1xuICAgICAgcmV0dXJuIHdpbmRvdy5pbm5lckhlaWdodCAtIGxpc3RbbGlzdC5sZW5ndGggLSAxXS5nZXRIb3N0RWxlbWVudCgpLm9mZnNldFRvcDtcbiAgICB9XG4gICAgcmV0dXJuIChcbiAgICAgIGxpc3RbbGlzdC5sZW5ndGggLSAxXS5nZXRIb3N0RWxlbWVudCgpLm9mZnNldFRvcCArIGxpc3RbbGlzdC5sZW5ndGggLSAxXS5nZXRIb3N0RWxlbWVudCgpLm9mZnNldEhlaWdodFxuICAgICk7XG4gIH1cblxuICBwcml2YXRlIGdldFBvc2l0aW9uU3RyYXRlZ3koXG4gICAgcG9zaXRpb25TdHJhdGVneTogR2xvYmFsUG9zaXRpb25TdHJhdGVneSxcbiAgICBsb2NhdGlvbjogQVhMb2NhdGlvbixcbiAgICBwb3M6IHN0cmluZyxcbiAgICBnYXA6IG51bWJlcixcbiAgKSB7XG4gICAgc3dpdGNoIChsb2NhdGlvbikge1xuICAgICAgY2FzZSAnYm90dG9tLWNlbnRlcic6XG4gICAgICAgIHJldHVybiBwb3NpdGlvblN0cmF0ZWd5LmJvdHRvbShwb3MpLmNlbnRlckhvcml6b250YWxseSgpO1xuICAgICAgICBicmVhaztcbiAgICAgIGNhc2UgJ2JvdHRvbS1lbmQnOlxuICAgICAgICByZXR1cm4gcG9zaXRpb25TdHJhdGVneS5ib3R0b20ocG9zKS5yaWdodChnYXAgKyAncHgnKTtcbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlICdib3R0b20tc3RhcnQnOlxuICAgICAgICByZXR1cm4gcG9zaXRpb25TdHJhdGVneS5ib3R0b20ocG9zKS5sZWZ0KGdhcCArICdweCcpO1xuICAgICAgICBicmVhaztcbiAgICAgIGNhc2UgJ3RvcC1jZW50ZXInOlxuICAgICAgICByZXR1cm4gcG9zaXRpb25TdHJhdGVneS50b3AocG9zKS5jZW50ZXJIb3Jpem9udGFsbHkoKTtcbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlICd0b3AtZW5kJzpcbiAgICAgICAgcmV0dXJuIHBvc2l0aW9uU3RyYXRlZ3kudG9wKHBvcykucmlnaHQoZ2FwICsgJ3B4Jyk7XG4gICAgICAgIGJyZWFrO1xuICAgICAgY2FzZSAndG9wLXN0YXJ0JzpcbiAgICAgICAgcmV0dXJuIHBvc2l0aW9uU3RyYXRlZ3kudG9wKHBvcykubGVmdChnYXAgKyAncHgnKTtcbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlICdjZW50ZXItc3RhcnQnOlxuICAgICAgICByZXR1cm4gcG9zaXRpb25TdHJhdGVneS5jZW50ZXJWZXJ0aWNhbGx5KCkubGVmdChnYXAgKyAncHgnKTtcbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlICdjZW50ZXItZW5kJzpcbiAgICAgICAgcmV0dXJuIHBvc2l0aW9uU3RyYXRlZ3kuY2VudGVyVmVydGljYWxseSgpLnJpZ2h0KGdhcCArICdweCcpO1xuICAgICAgICBicmVhaztcbiAgICB9XG4gIH1cbn1cbiJdfQ==
@@ -1,6 +1,7 @@
1
+ import { AXTranslationService } from '@acorex/core/translation';
1
2
  import { Dialog } from '@angular/cdk/dialog';
2
3
  import { GlobalPositionStrategy, ScrollStrategyOptions } from '@angular/cdk/overlay';
3
- import { Injectable, effect, inject, signal } from '@angular/core';
4
+ import { Injectable, inject } from '@angular/core';
4
5
  import { AXToastComponent } from './toast.component';
5
6
  import { AX_TOAST_CONFIG } from './toast.config';
6
7
  import * as i0 from "@angular/core";
@@ -9,23 +10,16 @@ export class AXToastService {
9
10
  constructor(scrollStrategyOptions) {
10
11
  this.scrollStrategyOptions = scrollStrategyOptions;
11
12
  this.dialog = inject(Dialog);
13
+ this.translationService = inject(AXTranslationService);
12
14
  this.defaultConfig = inject(AX_TOAST_CONFIG);
13
- this.activeToasts = signal([]);
14
- this.reservedToasts = signal([]);
15
- this.toastCounterElement = signal(null);
16
- this.moreToastsColor = signal('primary');
17
- this.moreToastsLocation = signal('bottom-center');
18
- this.reserveCounter = signal(0);
19
- this.#effect = effect(() => {
20
- if (this.defaultConfig.limit <= 0)
21
- return;
22
- this.handleShowReservedToast();
23
- this.handleShowReservedToastCounter();
24
- this.handleReserveCounter();
25
- }, { allowSignalWrites: true });
15
+ this.activeToasts = [];
16
+ this.reservedToasts = [];
17
+ this.toastCounterElement = null;
18
+ this.moreToastsColor = 'primary';
19
+ this.moreToastsLocation = 'bottom-center';
20
+ this.reserveCounter = 0;
26
21
  this.scrollStrategy = this.scrollStrategyOptions.noop();
27
22
  }
28
- #effect;
29
23
  primary(content) {
30
24
  this.show({
31
25
  timeOut: this.defaultConfig.timeOut,
@@ -62,27 +56,27 @@ export class AXToastService {
62
56
  });
63
57
  }
64
58
  show(config) {
65
- const opt = Object.assign({
66
- closeButton: true,
67
- location: this.defaultConfig.location ?? 'bottom-center',
68
- }, config);
69
- this.moreToastsColor.set(opt.color);
70
- this.moreToastsLocation.set(opt.location);
71
- if (this.defaultConfig.limit > 0) {
72
- if (this.activeToasts().length >= this.defaultConfig.limit) {
73
- this.reservedToasts.update((value) => [...value, opt]);
74
- return {
75
- close: () => {
76
- //TODO close reserved toast
77
- },
78
- };
79
- }
59
+ config = { ...this.defaultConfig, ...config };
60
+ this.moreToastsColor = config.color;
61
+ this.moreToastsLocation = config.location;
62
+ if (this.defaultConfig.limit > 0 && this.activeToasts.length >= this.defaultConfig.limit) {
63
+ const reservedRef = {
64
+ close: () => {
65
+ console.warn('Reserved notification cannot be closed until it is displayed.');
66
+ },
67
+ };
68
+ this.reservedToasts.push({ config, reservedRef });
69
+ this.handleReservedToastCounter();
70
+ return reservedRef;
80
71
  }
72
+ return this.displayToast(config);
73
+ }
74
+ displayToast(config) {
81
75
  const gap = this.defaultConfig.gap;
82
- const pos = this.getPosition(opt.location) + gap + 'px';
83
- const positionStrategy = this.getPositionStrategy(new GlobalPositionStrategy(), opt.location, pos, gap);
76
+ const pos = this.getPosition(config.location) + gap + 'px';
77
+ const positionStrategy = this.getPositionStrategy(new GlobalPositionStrategy(), config.location, pos, gap);
84
78
  const dialogRef = this.dialog.open(AXToastComponent, {
85
- data: opt,
79
+ data: config,
86
80
  autoFocus: '__no_element__',
87
81
  restoreFocus: true,
88
82
  role: 'dialog',
@@ -94,12 +88,15 @@ export class AXToastService {
94
88
  positionStrategy,
95
89
  scrollStrategy: this.scrollStrategy,
96
90
  });
97
- this.activeToasts.update((value) => [...value, dialogRef.id]);
91
+ this.activeToasts.push(dialogRef.id);
92
+ this.handleReservedToastCounter();
98
93
  const toastRef = dialogRef.componentInstance;
99
94
  dialogRef.closed.subscribe(() => {
100
- this.activeToasts.update((value) => [...value].filter((dialogID) => dialogID !== dialogRef.id));
95
+ this.activeToasts = this.activeToasts.filter((id) => id !== dialogRef.id);
96
+ this.handleShowReservedToast();
97
+ this.handleReservedToastCounter();
101
98
  setTimeout(() => {
102
- this.reposition(opt.location, gap);
99
+ this.reposition(config.location, gap);
103
100
  }, 0);
104
101
  });
105
102
  return {
@@ -110,40 +107,45 @@ export class AXToastService {
110
107
  }
111
108
  hideAll() {
112
109
  this.dialog.closeAll();
110
+ this.reserveCounter = 0;
111
+ this.reservedToasts = [];
112
+ this.activeToasts = [];
113
+ this.handleReservedToastCounter();
113
114
  }
114
115
  handleShowReservedToast() {
115
- if (this.activeToasts().length > this.defaultConfig.limit - 1)
116
+ if (this.activeToasts.length > this.defaultConfig.limit - 1)
116
117
  return;
117
- if (!this.reservedToasts().length)
118
+ if (!this.reservedToasts.length)
118
119
  return;
119
- this.show(this.reservedToasts()[0]);
120
- this.reservedToasts.update((value) => {
121
- const toasts = [...value];
122
- toasts.shift();
123
- return toasts;
124
- });
125
- }
126
- handleShowReservedToastCounter() {
127
- if (this.reservedToasts().length === this.reserveCounter())
128
- return;
129
- this.reserveCounter.set(this.reservedToasts().length);
130
- if (this.toastCounterElement() !== null)
131
- this.toastCounterElement().close();
132
- this.createReservedCounterToast();
133
- }
134
- handleReserveCounter() {
135
- if (this.reserveCounter() !== 0)
120
+ const { config, reservedRef } = this.reservedToasts.shift();
121
+ const displayedRef = this.displayToast(config);
122
+ this.handleReservedToastCounter();
123
+ reservedRef.close = displayedRef.close;
124
+ }
125
+ handleReservedToastCounter() {
126
+ const reservedCount = this.reservedToasts.length;
127
+ if (reservedCount === this.reserveCounter)
136
128
  return;
137
- if (this.toastCounterElement() === null)
129
+ this.reserveCounter = reservedCount;
130
+ if (reservedCount === 0 && this.toastCounterElement !== null) {
131
+ this.toastCounterElement.close();
138
132
  return;
139
- this.toastCounterElement().close();
133
+ }
134
+ if (reservedCount > 0) {
135
+ if (this.toastCounterElement !== null) {
136
+ this.toastCounterElement.close();
137
+ }
138
+ this.createReservedCounterToast();
139
+ }
140
140
  }
141
- createReservedCounterToast() {
141
+ async createReservedCounterToast() {
142
142
  const opt = {
143
143
  closeButton: false,
144
- color: this.moreToastsColor(),
145
- location: this.moreToastsLocation(),
146
- title: `And ${this.reserveCounter()} more...`,
144
+ color: this.moreToastsColor,
145
+ location: this.moreToastsLocation,
146
+ title: await this.translationService.translateAsync('more-toast', {
147
+ params: { number: this.reserveCounter },
148
+ }),
147
149
  timeOutProgress: false,
148
150
  };
149
151
  const gap = this.defaultConfig.gap;
@@ -162,7 +164,7 @@ export class AXToastService {
162
164
  positionStrategy,
163
165
  scrollStrategy: this.scrollStrategy,
164
166
  });
165
- this.toastCounterElement.set(dialogRef.componentInstance);
167
+ this.toastCounterElement = dialogRef.componentInstance;
166
168
  }
167
169
  reposition(toastLocation, gap) {
168
170
  const list = this.dialog.openDialogs
@@ -170,7 +172,6 @@ export class AXToastService {
170
172
  .filter((c) => c.config?.location == toastLocation);
171
173
  list.forEach((element, index) => {
172
174
  const pos = this.getRepositionPosition(index, gap, list, toastLocation);
173
- console.log(index, element);
174
175
  this.getPositionStrategy(element.dialogRef.config.positionStrategy, toastLocation, pos, gap).apply();
175
176
  });
176
177
  }
@@ -231,4 +232,4 @@ export class AXToastService {
231
232
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXToastService, decorators: [{
232
233
  type: Injectable
233
234
  }], ctorParameters: () => [{ type: i1.ScrollStrategyOptions }] });
234
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9hc3Quc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvY29tcG9uZW50cy90b2FzdC9zcmMvbGliL3RvYXN0LnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLE1BQU0sRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQzdDLE9BQU8sRUFBRSxzQkFBc0IsRUFBa0IscUJBQXFCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUNyRyxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sRUFBRSxNQUFNLEVBQUUsTUFBTSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBRW5FLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ3JELE9BQU8sRUFBaUIsZUFBZSxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7OztBQUdoRSxNQUFNLE9BQU8sY0FBYztJQVl6QixZQUE2QixxQkFBNEM7UUFBNUMsMEJBQXFCLEdBQXJCLHFCQUFxQixDQUF1QjtRQVhqRSxXQUFNLEdBQVcsTUFBTSxDQUFDLE1BQU0sQ0FBQyxDQUFDO1FBQ2hDLGtCQUFhLEdBQWtCLE1BQU0sQ0FBQyxlQUFlLENBQUMsQ0FBQztRQUN2RCxpQkFBWSxHQUFHLE1BQU0sQ0FBVyxFQUFFLENBQUMsQ0FBQztRQUNwQyxtQkFB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