@acorex/components 21.0.1-next.0 → 21.0.1-next.2

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.
Files changed (230) hide show
  1. package/accordion/index.d.ts +1 -0
  2. package/action-sheet/index.d.ts +41 -19
  3. package/button-group/index.d.ts +4 -6
  4. package/chips/index.d.ts +8 -3
  5. package/collapse/index.d.ts +6 -4
  6. package/data-table/index.d.ts +253 -4
  7. package/dialog/index.d.ts +19 -15
  8. package/dropdown/index.d.ts +3 -4
  9. package/fesm2022/acorex-components-accordion.mjs +13 -8
  10. package/fesm2022/acorex-components-accordion.mjs.map +1 -1
  11. package/fesm2022/acorex-components-action-sheet.mjs +141 -93
  12. package/fesm2022/acorex-components-action-sheet.mjs.map +1 -1
  13. package/fesm2022/acorex-components-alert.mjs +6 -6
  14. package/fesm2022/acorex-components-alert.mjs.map +1 -1
  15. package/fesm2022/acorex-components-aspect-ratio.mjs.map +1 -1
  16. package/fesm2022/acorex-components-audio-wave.mjs +4 -5
  17. package/fesm2022/acorex-components-audio-wave.mjs.map +1 -1
  18. package/fesm2022/acorex-components-autocomplete.mjs.map +1 -1
  19. package/fesm2022/acorex-components-avatar.mjs +3 -3
  20. package/fesm2022/acorex-components-avatar.mjs.map +1 -1
  21. package/fesm2022/acorex-components-badge.mjs +3 -3
  22. package/fesm2022/acorex-components-badge.mjs.map +1 -1
  23. package/fesm2022/acorex-components-bottom-navigation.mjs +2 -2
  24. package/fesm2022/acorex-components-bottom-navigation.mjs.map +1 -1
  25. package/fesm2022/acorex-components-breadcrumbs.mjs +2 -2
  26. package/fesm2022/acorex-components-breadcrumbs.mjs.map +1 -1
  27. package/fesm2022/acorex-components-button-group.mjs +11 -15
  28. package/fesm2022/acorex-components-button-group.mjs.map +1 -1
  29. package/fesm2022/acorex-components-button.mjs +5 -5
  30. package/fesm2022/acorex-components-button.mjs.map +1 -1
  31. package/fesm2022/acorex-components-calendar.mjs +4 -4
  32. package/fesm2022/acorex-components-calendar.mjs.map +1 -1
  33. package/fesm2022/acorex-components-check-box.mjs +3 -3
  34. package/fesm2022/acorex-components-check-box.mjs.map +1 -1
  35. package/fesm2022/acorex-components-chips.mjs +8 -6
  36. package/fesm2022/acorex-components-chips.mjs.map +1 -1
  37. package/fesm2022/acorex-components-circular-progress.mjs +4 -6
  38. package/fesm2022/acorex-components-circular-progress.mjs.map +1 -1
  39. package/fesm2022/acorex-components-code-editor.mjs.map +1 -1
  40. package/fesm2022/acorex-components-collapse.mjs +10 -13
  41. package/fesm2022/acorex-components-collapse.mjs.map +1 -1
  42. package/fesm2022/acorex-components-color-box.mjs +2 -2
  43. package/fesm2022/acorex-components-color-box.mjs.map +1 -1
  44. package/fesm2022/acorex-components-color-palette.mjs +2 -2
  45. package/fesm2022/acorex-components-color-palette.mjs.map +1 -1
  46. package/fesm2022/acorex-components-command.mjs +2 -2
  47. package/fesm2022/acorex-components-command.mjs.map +1 -1
  48. package/fesm2022/acorex-components-comment.mjs +8 -8
  49. package/fesm2022/acorex-components-comment.mjs.map +1 -1
  50. package/fesm2022/acorex-components-conversation.mjs +2 -2
  51. package/fesm2022/acorex-components-conversation.mjs.map +1 -1
  52. package/fesm2022/acorex-components-conversation2.mjs +2 -2
  53. package/fesm2022/acorex-components-conversation2.mjs.map +1 -1
  54. package/fesm2022/acorex-components-cron-job.mjs.map +1 -1
  55. package/fesm2022/acorex-components-data-list.mjs.map +1 -1
  56. package/fesm2022/acorex-components-data-pager.mjs +2 -2
  57. package/fesm2022/acorex-components-data-pager.mjs.map +1 -1
  58. package/fesm2022/acorex-components-data-table.mjs +452 -16
  59. package/fesm2022/acorex-components-data-table.mjs.map +1 -1
  60. package/fesm2022/acorex-components-datetime-box.mjs +2 -2
  61. package/fesm2022/acorex-components-datetime-box.mjs.map +1 -1
  62. package/fesm2022/acorex-components-datetime-input.mjs +2 -2
  63. package/fesm2022/acorex-components-datetime-input.mjs.map +1 -1
  64. package/fesm2022/acorex-components-datetime-picker.mjs +8 -2
  65. package/fesm2022/acorex-components-datetime-picker.mjs.map +1 -1
  66. package/fesm2022/acorex-components-decorators.mjs +13 -20
  67. package/fesm2022/acorex-components-decorators.mjs.map +1 -1
  68. package/fesm2022/acorex-components-dialog.mjs +67 -47
  69. package/fesm2022/acorex-components-dialog.mjs.map +1 -1
  70. package/fesm2022/acorex-components-drawer-legacy.mjs.map +1 -1
  71. package/fesm2022/acorex-components-drawer.mjs +7 -6
  72. package/fesm2022/acorex-components-drawer.mjs.map +1 -1
  73. package/fesm2022/acorex-components-dropdown-button.mjs +2 -2
  74. package/fesm2022/acorex-components-dropdown-button.mjs.map +1 -1
  75. package/fesm2022/acorex-components-dropdown.mjs +3 -9
  76. package/fesm2022/acorex-components-dropdown.mjs.map +1 -1
  77. package/fesm2022/acorex-components-editor.mjs +4 -4
  78. package/fesm2022/acorex-components-editor.mjs.map +1 -1
  79. package/fesm2022/acorex-components-file-explorer.mjs.map +1 -1
  80. package/fesm2022/acorex-components-flow-chart.mjs.map +1 -1
  81. package/fesm2022/acorex-components-form.mjs +9 -17
  82. package/fesm2022/acorex-components-form.mjs.map +1 -1
  83. package/fesm2022/acorex-components-grid-layout-builder.mjs +5 -4
  84. package/fesm2022/acorex-components-grid-layout-builder.mjs.map +1 -1
  85. package/fesm2022/acorex-components-image-editor.mjs +18 -18
  86. package/fesm2022/acorex-components-image-editor.mjs.map +1 -1
  87. package/fesm2022/acorex-components-image.mjs +2 -2
  88. package/fesm2022/acorex-components-image.mjs.map +1 -1
  89. package/fesm2022/acorex-components-json-viewer.mjs +2 -2
  90. package/fesm2022/acorex-components-json-viewer.mjs.map +1 -1
  91. package/fesm2022/acorex-components-kanban.mjs +4 -6
  92. package/fesm2022/acorex-components-kanban.mjs.map +1 -1
  93. package/fesm2022/acorex-components-kbd.mjs +7 -25
  94. package/fesm2022/acorex-components-kbd.mjs.map +1 -1
  95. package/fesm2022/acorex-components-label.mjs +2 -2
  96. package/fesm2022/acorex-components-label.mjs.map +1 -1
  97. package/fesm2022/acorex-components-list.mjs +2 -2
  98. package/fesm2022/acorex-components-list.mjs.map +1 -1
  99. package/fesm2022/acorex-components-loading-dialog.mjs +73 -36
  100. package/fesm2022/acorex-components-loading-dialog.mjs.map +1 -1
  101. package/fesm2022/acorex-components-loading.mjs +8 -8
  102. package/fesm2022/acorex-components-loading.mjs.map +1 -1
  103. package/fesm2022/acorex-components-map.mjs +2 -2
  104. package/fesm2022/acorex-components-map.mjs.map +1 -1
  105. package/fesm2022/acorex-components-media-viewer.mjs +10 -10
  106. package/fesm2022/acorex-components-media-viewer.mjs.map +1 -1
  107. package/fesm2022/acorex-components-menu.mjs +27 -6
  108. package/fesm2022/acorex-components-menu.mjs.map +1 -1
  109. package/fesm2022/{acorex-components-modal-acorex-components-modal-BnUdtPke.mjs → acorex-components-modal-acorex-components-modal-Bmoz9DL5.mjs} +29 -5
  110. package/fesm2022/acorex-components-modal-acorex-components-modal-Bmoz9DL5.mjs.map +1 -0
  111. package/fesm2022/{acorex-components-modal-modal-content.component-Cgq-wx_m.mjs → acorex-components-modal-modal-content.component-CSJU1vRi.mjs} +5 -7
  112. package/fesm2022/acorex-components-modal-modal-content.component-CSJU1vRi.mjs.map +1 -0
  113. package/fesm2022/acorex-components-modal.mjs +1 -1
  114. package/fesm2022/acorex-components-navbar.mjs +3 -3
  115. package/fesm2022/acorex-components-navbar.mjs.map +1 -1
  116. package/fesm2022/acorex-components-notification.mjs +374 -246
  117. package/fesm2022/acorex-components-notification.mjs.map +1 -1
  118. package/fesm2022/acorex-components-number-box-legacy.mjs +2 -2
  119. package/fesm2022/acorex-components-number-box-legacy.mjs.map +1 -1
  120. package/fesm2022/acorex-components-number-box.mjs +6 -7
  121. package/fesm2022/acorex-components-number-box.mjs.map +1 -1
  122. package/fesm2022/acorex-components-otp.mjs +2 -2
  123. package/fesm2022/acorex-components-otp.mjs.map +1 -1
  124. package/fesm2022/acorex-components-page.mjs.map +1 -1
  125. package/fesm2022/acorex-components-paint.mjs +19 -14
  126. package/fesm2022/acorex-components-paint.mjs.map +1 -1
  127. package/fesm2022/acorex-components-password-box.mjs +4 -4
  128. package/fesm2022/acorex-components-password-box.mjs.map +1 -1
  129. package/fesm2022/acorex-components-pdf-reader.mjs +2 -2
  130. package/fesm2022/acorex-components-pdf-reader.mjs.map +1 -1
  131. package/fesm2022/acorex-components-phone-box.mjs +2 -2
  132. package/fesm2022/acorex-components-phone-box.mjs.map +1 -1
  133. package/fesm2022/acorex-components-picker.mjs +6 -6
  134. package/fesm2022/acorex-components-picker.mjs.map +1 -1
  135. package/fesm2022/acorex-components-popover.mjs +136 -175
  136. package/fesm2022/acorex-components-popover.mjs.map +1 -1
  137. package/fesm2022/acorex-components-popup.mjs +308 -105
  138. package/fesm2022/acorex-components-popup.mjs.map +1 -1
  139. package/fesm2022/acorex-components-progress-bar.mjs +3 -5
  140. package/fesm2022/acorex-components-progress-bar.mjs.map +1 -1
  141. package/fesm2022/acorex-components-qrcode.mjs +2 -2
  142. package/fesm2022/acorex-components-qrcode.mjs.map +1 -1
  143. package/fesm2022/acorex-components-query-builder.mjs +2 -2
  144. package/fesm2022/acorex-components-query-builder.mjs.map +1 -1
  145. package/fesm2022/acorex-components-radio.mjs +2 -2
  146. package/fesm2022/acorex-components-radio.mjs.map +1 -1
  147. package/fesm2022/acorex-components-rail-navigation.mjs +25 -27
  148. package/fesm2022/acorex-components-rail-navigation.mjs.map +1 -1
  149. package/fesm2022/acorex-components-range-slider.mjs +3 -3
  150. package/fesm2022/acorex-components-range-slider.mjs.map +1 -1
  151. package/fesm2022/acorex-components-rate-picker.mjs +29 -14
  152. package/fesm2022/acorex-components-rate-picker.mjs.map +1 -1
  153. package/fesm2022/acorex-components-rest-api-generator.mjs.map +1 -1
  154. package/fesm2022/acorex-components-result.mjs +2 -2
  155. package/fesm2022/acorex-components-result.mjs.map +1 -1
  156. package/fesm2022/acorex-components-routing-progress.mjs +2 -2
  157. package/fesm2022/acorex-components-routing-progress.mjs.map +1 -1
  158. package/fesm2022/acorex-components-rrule.mjs.map +1 -1
  159. package/fesm2022/acorex-components-scheduler-picker.mjs +2 -2
  160. package/fesm2022/acorex-components-scheduler-picker.mjs.map +1 -1
  161. package/fesm2022/acorex-components-scheduler.mjs +18 -18
  162. package/fesm2022/acorex-components-scheduler.mjs.map +1 -1
  163. package/fesm2022/acorex-components-scss.mjs.map +1 -1
  164. package/fesm2022/acorex-components-search-box.mjs +3 -9
  165. package/fesm2022/acorex-components-search-box.mjs.map +1 -1
  166. package/fesm2022/acorex-components-select-box.mjs +2 -4
  167. package/fesm2022/acorex-components-select-box.mjs.map +1 -1
  168. package/fesm2022/acorex-components-selection-list-2.mjs +4 -4
  169. package/fesm2022/acorex-components-selection-list-2.mjs.map +1 -1
  170. package/fesm2022/acorex-components-selection-list.mjs +2 -2
  171. package/fesm2022/acorex-components-selection-list.mjs.map +1 -1
  172. package/fesm2022/acorex-components-side-menu.mjs +14 -63
  173. package/fesm2022/acorex-components-side-menu.mjs.map +1 -1
  174. package/fesm2022/acorex-components-skeleton.mjs +2 -2
  175. package/fesm2022/acorex-components-skeleton.mjs.map +1 -1
  176. package/fesm2022/acorex-components-slider.mjs +5 -5
  177. package/fesm2022/acorex-components-slider.mjs.map +1 -1
  178. package/fesm2022/acorex-components-sliding-item.mjs +2 -2
  179. package/fesm2022/acorex-components-sliding-item.mjs.map +1 -1
  180. package/fesm2022/acorex-components-step-wizard.mjs +2 -2
  181. package/fesm2022/acorex-components-step-wizard.mjs.map +1 -1
  182. package/fesm2022/acorex-components-switch.mjs +4 -4
  183. package/fesm2022/acorex-components-switch.mjs.map +1 -1
  184. package/fesm2022/acorex-components-tabs.mjs +2 -2
  185. package/fesm2022/acorex-components-tabs.mjs.map +1 -1
  186. package/fesm2022/acorex-components-tag-box.mjs +2 -2
  187. package/fesm2022/acorex-components-tag-box.mjs.map +1 -1
  188. package/fesm2022/acorex-components-tag.mjs +3 -3
  189. package/fesm2022/acorex-components-tag.mjs.map +1 -1
  190. package/fesm2022/acorex-components-text-area.mjs +2 -2
  191. package/fesm2022/acorex-components-text-area.mjs.map +1 -1
  192. package/fesm2022/acorex-components-text-box.mjs +2 -2
  193. package/fesm2022/acorex-components-text-box.mjs.map +1 -1
  194. package/fesm2022/acorex-components-time-duration.mjs.map +1 -1
  195. package/fesm2022/acorex-components-time-line.mjs +4 -4
  196. package/fesm2022/acorex-components-time-line.mjs.map +1 -1
  197. package/fesm2022/acorex-components-toast.mjs +233 -125
  198. package/fesm2022/acorex-components-toast.mjs.map +1 -1
  199. package/fesm2022/acorex-components-toolbar.mjs +2 -2
  200. package/fesm2022/acorex-components-toolbar.mjs.map +1 -1
  201. package/fesm2022/acorex-components-tooltip.mjs +12 -12
  202. package/fesm2022/acorex-components-tooltip.mjs.map +1 -1
  203. package/fesm2022/acorex-components-tree-view-legacy.mjs.map +1 -1
  204. package/fesm2022/acorex-components-tree-view.mjs.map +1 -1
  205. package/fesm2022/acorex-components-uploader.mjs +6 -6
  206. package/fesm2022/acorex-components-uploader.mjs.map +1 -1
  207. package/fesm2022/acorex-components-video-player.mjs +2 -2
  208. package/fesm2022/acorex-components-video-player.mjs.map +1 -1
  209. package/fesm2022/acorex-components-wysiwyg.mjs +12 -12
  210. package/fesm2022/acorex-components-wysiwyg.mjs.map +1 -1
  211. package/fesm2022/acorex-components.mjs.map +1 -1
  212. package/grid-layout-builder/index.d.ts +2 -1
  213. package/kbd/index.d.ts +7 -13
  214. package/loading/index.d.ts +1 -1
  215. package/loading-dialog/index.d.ts +31 -15
  216. package/menu/index.d.ts +4 -0
  217. package/modal/index.d.ts +7 -0
  218. package/notification/index.d.ts +47 -28
  219. package/number-box/index.d.ts +1 -1
  220. package/package.json +7 -7
  221. package/paint/index.d.ts +6 -1
  222. package/popover/index.d.ts +20 -27
  223. package/popup/index.d.ts +103 -27
  224. package/rate-picker/index.d.ts +15 -5
  225. package/side-menu/index.d.ts +2 -9
  226. package/slider/index.d.ts +2 -2
  227. package/toast/index.d.ts +24 -18
  228. package/tooltip/index.d.ts +2 -2
  229. package/fesm2022/acorex-components-modal-acorex-components-modal-BnUdtPke.mjs.map +0 -1
  230. package/fesm2022/acorex-components-modal-modal-content.component-Cgq-wx_m.mjs.map +0 -1
@@ -2,13 +2,333 @@ import { MXBaseComponent, AXClosableComponent, AXComponent } from '@acorex/cdk/c
2
2
  import { AXButtonComponent } from '@acorex/components/button';
3
3
  import { AXDecoratorCloseButtonComponent } from '@acorex/components/decorators';
4
4
  import { AXLoadingComponent } from '@acorex/components/loading';
5
- import { AXTranslatorPipe, AXTranslationService } from '@acorex/core/translation';
6
- import { DIALOG_DATA, DialogRef, Dialog } from '@angular/cdk/dialog';
7
- import { TemplatePortal, ComponentPortal, CdkPortalOutlet } from '@angular/cdk/portal';
8
- import { AsyncPipe } from '@angular/common';
5
+ import { AXTranslationService, AXTranslatorPipe } from '@acorex/core/translation';
6
+ import { NgTemplateOutlet, NgComponentOutlet, AsyncPipe } from '@angular/common';
9
7
  import * as i0 from '@angular/core';
10
- import { inject, signal, TemplateRef, ViewEncapsulation, ChangeDetectionStrategy, Component, InjectionToken, NgModule, Injectable } from '@angular/core';
11
- import { GlobalPositionStrategy } from '@angular/cdk/overlay';
8
+ import { InjectionToken, inject, signal, Injectable, input, computed, TemplateRef, ViewEncapsulation, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
9
+ import { AXOverlayService } from '@acorex/cdk/overlay';
10
+
11
+ const AX_NOTIFICATION_CONFIG = new InjectionToken('AX_NOTIFICATION_CONFIG', {
12
+ providedIn: 'root',
13
+ factory: () => AXNotificationDefaultConfig,
14
+ });
15
+ const AXNotificationDefaultConfig = {
16
+ gap: 5,
17
+ timeOut: 2500,
18
+ timeOutProgress: true,
19
+ closeButton: true,
20
+ location: 'top-end',
21
+ limit: 3,
22
+ pauseOnHover: true,
23
+ };
24
+ function notificationConfig(config = {}) {
25
+ const result = {
26
+ ...AXNotificationDefaultConfig,
27
+ ...config,
28
+ };
29
+ return result;
30
+ }
31
+
32
+ let notificationIdCounter = 0;
33
+ class AXNotificationService {
34
+ constructor() {
35
+ this.overlayService = inject(AXOverlayService);
36
+ this.translationService = inject(AXTranslationService);
37
+ this.defaultConfig = inject(AX_NOTIFICATION_CONFIG);
38
+ this.activeNotifications = signal([], ...(ngDevMode ? [{ debugName: "activeNotifications" }] : []));
39
+ this.reservedNotifications = signal([], ...(ngDevMode ? [{ debugName: "reservedNotifications" }] : []));
40
+ this.notificationCounterRef = signal(null, ...(ngDevMode ? [{ debugName: "notificationCounterRef" }] : []));
41
+ this.moreNotificationsColor = signal('primary', ...(ngDevMode ? [{ debugName: "moreNotificationsColor" }] : []));
42
+ this.moreNotificationsLocation = signal('bottom-center', ...(ngDevMode ? [{ debugName: "moreNotificationsLocation" }] : []));
43
+ this.reserveCounter = signal(0, ...(ngDevMode ? [{ debugName: "reserveCounter" }] : []));
44
+ }
45
+ show(config) {
46
+ config = { ...this.defaultConfig, ...config };
47
+ this.moreNotificationsColor.set(config.color);
48
+ this.moreNotificationsLocation.set(config.location);
49
+ if (this.defaultConfig.limit > 0 && this.activeNotifications().length >= this.defaultConfig.limit) {
50
+ const reservedRef = {
51
+ close: () => {
52
+ console.warn('Reserved notification cannot be closed until it is displayed.');
53
+ },
54
+ };
55
+ this.reservedNotifications.update((prev) => [...prev, { config, reservedRef }]);
56
+ this.handleReservedNotificationCounter();
57
+ return reservedRef;
58
+ }
59
+ return this.displayNotification(config);
60
+ }
61
+ displayNotification(config) {
62
+ const gap = this.defaultConfig.gap;
63
+ const notificationData = {
64
+ buttons: config.buttons,
65
+ icon: config.icon,
66
+ title: config.title,
67
+ content: config.content,
68
+ location: config.location,
69
+ closeButton: config.closeButton ?? true,
70
+ color: config.color,
71
+ timeOut: config.timeOut,
72
+ timeOutProgress: config.timeOutProgress ?? true,
73
+ pauseOnHover: config.pauseOnHover,
74
+ };
75
+ const notificationId = `notification-${++notificationIdCounter}`;
76
+ let internalRef;
77
+ const closeNotification = () => {
78
+ if (internalRef) {
79
+ internalRef.overlayRef.dispose();
80
+ this.activeNotifications.set(this.activeNotifications().filter((n) => n.id !== internalRef.id));
81
+ this.handleShowReservedNotification();
82
+ this.handleReservedNotificationCounter();
83
+ setTimeout(() => {
84
+ this.reposition(config.location, gap);
85
+ });
86
+ }
87
+ };
88
+ this.overlayService
89
+ .create(AXNotificationComponent, {
90
+ inputs: {
91
+ config: notificationData,
92
+ onClose: closeNotification,
93
+ },
94
+ centered: false,
95
+ panelClass: ['ax-animate-animated', 'ax-animate-fadeIn', 'ax-animate-faster'],
96
+ onDispose: () => {
97
+ // Clean up when disposed externally
98
+ const currentNotifications = this.activeNotifications();
99
+ if (internalRef && currentNotifications.find((n) => n.id === internalRef.id)) {
100
+ this.activeNotifications.set(currentNotifications.filter((n) => n.id !== internalRef.id));
101
+ this.handleShowReservedNotification();
102
+ this.handleReservedNotificationCounter();
103
+ }
104
+ },
105
+ })
106
+ .then((overlayRef) => {
107
+ internalRef = {
108
+ id: notificationId,
109
+ overlayRef,
110
+ config: notificationData,
111
+ close: closeNotification,
112
+ };
113
+ // Position the notification BEFORE adding to activeNotifications
114
+ this.positionNotification(overlayRef.overlayElement, config.location, gap);
115
+ this.activeNotifications.update((prev) => [...prev, internalRef]);
116
+ this.handleReservedNotificationCounter();
117
+ });
118
+ return {
119
+ close: () => {
120
+ closeNotification();
121
+ },
122
+ };
123
+ }
124
+ hideAll() {
125
+ this.reserveCounter.set(0);
126
+ this.reservedNotifications.set([]);
127
+ // Close all active notifications
128
+ this.activeNotifications().forEach((notification) => {
129
+ notification.overlayRef.dispose();
130
+ });
131
+ this.activeNotifications.set([]);
132
+ // Close counter notification if exists
133
+ const counterRef = this.notificationCounterRef();
134
+ if (counterRef) {
135
+ counterRef.overlayRef.dispose();
136
+ this.notificationCounterRef.set(null);
137
+ }
138
+ this.handleReservedNotificationCounter();
139
+ }
140
+ handleShowReservedNotification() {
141
+ if (this.activeNotifications().length > this.defaultConfig.limit - 1)
142
+ return;
143
+ if (!this.reservedNotifications().length)
144
+ return;
145
+ const reserved = this.reservedNotifications()[0];
146
+ this.reservedNotifications.update((prev) => prev.slice(1));
147
+ const displayedRef = this.displayNotification(reserved.config);
148
+ this.handleReservedNotificationCounter();
149
+ reserved.reservedRef.close = displayedRef.close;
150
+ }
151
+ handleReservedNotificationCounter() {
152
+ const reservedCount = this.reservedNotifications().length;
153
+ if (reservedCount === this.reserveCounter())
154
+ return;
155
+ this.reserveCounter.set(reservedCount);
156
+ if (reservedCount === 0 && this.notificationCounterRef() !== null) {
157
+ this.notificationCounterRef().close();
158
+ this.notificationCounterRef.set(null);
159
+ return;
160
+ }
161
+ if (reservedCount > 0) {
162
+ if (this.notificationCounterRef() !== null) {
163
+ this.notificationCounterRef().close();
164
+ this.notificationCounterRef.set(null);
165
+ }
166
+ this.createReservedCounterNotification();
167
+ }
168
+ }
169
+ async createReservedCounterNotification() {
170
+ const gap = this.defaultConfig.gap;
171
+ const opt = {
172
+ closeButton: false,
173
+ color: this.moreNotificationsColor(),
174
+ location: this.moreNotificationsLocation(),
175
+ title: await this.translationService.translateAsync('@acorex:common.notifications.more', {
176
+ params: { number: this.reserveCounter() },
177
+ }),
178
+ timeOutProgress: false,
179
+ };
180
+ const notificationId = `notification-counter-${++notificationIdCounter}`;
181
+ let counterInternalRef;
182
+ const closeCounter = () => {
183
+ if (counterInternalRef) {
184
+ counterInternalRef.overlayRef.dispose();
185
+ if (this.notificationCounterRef()?.id === counterInternalRef.id) {
186
+ this.notificationCounterRef.set(null);
187
+ }
188
+ }
189
+ };
190
+ const overlayRef = await this.overlayService.create(AXNotificationComponent, {
191
+ inputs: {
192
+ config: opt,
193
+ onClose: closeCounter,
194
+ },
195
+ centered: false,
196
+ panelClass: ['ax-animate-animated', 'ax-animate-fadeIn', 'ax-animate-faster'],
197
+ });
198
+ counterInternalRef = {
199
+ id: notificationId,
200
+ overlayRef,
201
+ config: opt,
202
+ close: closeCounter,
203
+ };
204
+ this.notificationCounterRef.set(counterInternalRef);
205
+ // Position the counter notification
206
+ this.positionNotification(overlayRef.overlayElement, opt.location, gap);
207
+ }
208
+ positionNotification(element, location, gap) {
209
+ if (!element)
210
+ return;
211
+ const pos = this.getPosition(location) + gap;
212
+ // Override the centered overlay container styles for notification positioning
213
+ element.style.width = 'max-content';
214
+ element.style.height = 'auto';
215
+ element.style.display = 'block';
216
+ element.style.alignItems = '';
217
+ element.style.justifyContent = '';
218
+ // Reset all positioning styles
219
+ element.style.top = '';
220
+ element.style.bottom = '';
221
+ element.style.left = '';
222
+ element.style.right = '';
223
+ element.style.transform = '';
224
+ // Apply position based on location
225
+ switch (location) {
226
+ case 'bottom-center':
227
+ element.style.bottom = pos + 'px';
228
+ element.style.left = '50%';
229
+ element.style.transform = 'translateX(-50%)';
230
+ break;
231
+ case 'bottom-end':
232
+ element.style.bottom = pos + 'px';
233
+ element.style.right = gap + 'px';
234
+ break;
235
+ case 'bottom-start':
236
+ element.style.bottom = pos + 'px';
237
+ element.style.left = gap + 'px';
238
+ break;
239
+ case 'top-center':
240
+ element.style.top = pos + 'px';
241
+ element.style.left = '50%';
242
+ element.style.transform = 'translateX(-50%)';
243
+ break;
244
+ case 'top-end':
245
+ element.style.top = pos + 'px';
246
+ element.style.right = gap + 'px';
247
+ break;
248
+ case 'top-start':
249
+ element.style.top = pos + 'px';
250
+ element.style.left = gap + 'px';
251
+ break;
252
+ case 'center-start':
253
+ element.style.top = '50%';
254
+ element.style.left = gap + 'px';
255
+ element.style.transform = 'translateY(-50%)';
256
+ break;
257
+ case 'center-end':
258
+ element.style.top = '50%';
259
+ element.style.right = gap + 'px';
260
+ element.style.transform = 'translateY(-50%)';
261
+ break;
262
+ }
263
+ }
264
+ reposition(notificationLocation, gap) {
265
+ const list = this.activeNotifications().filter((n) => n.config?.location === notificationLocation);
266
+ list.forEach((notification, index) => {
267
+ const element = notification.overlayRef.overlayElement;
268
+ if (!element)
269
+ return;
270
+ const pos = this.getRepositionPosition(index, gap, list, notificationLocation);
271
+ this.applyRepositionPosition(element, notificationLocation, pos, gap);
272
+ });
273
+ }
274
+ getRepositionPosition(index, gap, list, notificationLocation) {
275
+ if (index === 0)
276
+ return gap;
277
+ const previousNotification = list[index - 1];
278
+ const previousElement = previousNotification.overlayRef.overlayElement;
279
+ if (!previousElement)
280
+ return gap;
281
+ if (notificationLocation.split('-')[0] === 'bottom') {
282
+ return window.innerHeight - previousElement.offsetTop + gap;
283
+ }
284
+ return previousElement.offsetTop + previousElement.offsetHeight + gap;
285
+ }
286
+ applyRepositionPosition(element, location, pos, gap) {
287
+ // Reset transform if needed, then apply position
288
+ const isVerticalCenter = location === 'center-start' || location === 'center-end';
289
+ const isHorizontalCenter = location === 'bottom-center' || location === 'top-center';
290
+ if (location.startsWith('bottom')) {
291
+ element.style.bottom = pos + 'px';
292
+ element.style.top = '';
293
+ if (isHorizontalCenter) {
294
+ element.style.transform = 'translateX(-50%)';
295
+ }
296
+ }
297
+ else if (location.startsWith('top')) {
298
+ element.style.top = pos + 'px';
299
+ element.style.bottom = '';
300
+ if (isHorizontalCenter) {
301
+ element.style.transform = 'translateX(-50%)';
302
+ }
303
+ }
304
+ else if (isVerticalCenter) {
305
+ element.style.top = pos + 'px';
306
+ element.style.bottom = '';
307
+ element.style.transform = '';
308
+ }
309
+ }
310
+ getPosition(location) {
311
+ const list = this.activeNotifications().filter((n) => n.config?.location === location);
312
+ if (list.length === 0)
313
+ return 0;
314
+ const lastNotification = list[list.length - 1];
315
+ const element = lastNotification.overlayRef.overlayElement;
316
+ if (!element)
317
+ return 0;
318
+ if (location.split('-')[0] === 'bottom') {
319
+ return window.innerHeight - element.offsetTop;
320
+ }
321
+ return element.offsetTop + element.offsetHeight;
322
+ }
323
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXNotificationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
324
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXNotificationService, providedIn: 'root' }); }
325
+ }
326
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXNotificationService, decorators: [{
327
+ type: Injectable,
328
+ args: [{
329
+ providedIn: 'root',
330
+ }]
331
+ }] });
12
332
 
13
333
  /**
14
334
  * The Button is a component which detects user interaction and triggers a corresponding event
@@ -18,20 +338,37 @@ import { GlobalPositionStrategy } from '@angular/cdk/overlay';
18
338
  class AXNotificationComponent extends MXBaseComponent {
19
339
  constructor() {
20
340
  super(...arguments);
21
- this.config = inject(DIALOG_DATA);
22
- this.dialogRef = inject(DialogRef);
341
+ /** Notification configuration data */
342
+ this.config = input.required(...(ngDevMode ? [{ debugName: "config" }] : []));
343
+ /** @internal Callback function to close the notification */
344
+ this.onClose = input(...(ngDevMode ? [undefined, { debugName: "onClose" }] : []));
345
+ this.notificationService = inject(AXNotificationService);
23
346
  this.isPaused = signal(false, ...(ngDevMode ? [{ debugName: "isPaused" }] : []));
24
347
  this.remainingTime = signal(0, ...(ngDevMode ? [{ debugName: "remainingTime" }] : []));
25
348
  this.transitionDuration = signal(150, ...(ngDevMode ? [{ debugName: "transitionDuration" }] : []));
349
+ /** Template content if config.content is a TemplateRef */
350
+ this.templateContent = computed(() => {
351
+ const content = this.config().content;
352
+ return content instanceof TemplateRef ? content : null;
353
+ }, ...(ngDevMode ? [{ debugName: "templateContent" }] : []));
354
+ /** Component content if config.content is a component Type */
355
+ this.componentContent = computed(() => {
356
+ const content = this.config().content;
357
+ return typeof content === 'function' ? content : null;
358
+ }, ...(ngDevMode ? [{ debugName: "componentContent" }] : []));
359
+ /** String content if config.content is a string */
360
+ this.stringContent = computed(() => {
361
+ const content = this.config().content;
362
+ return typeof content === 'string' ? content : '';
363
+ }, ...(ngDevMode ? [{ debugName: "stringContent" }] : []));
26
364
  }
27
365
  ngOnInit() {
28
366
  super.ngOnInit();
29
- this._initContent();
30
367
  this._initIcon();
31
- this.remainingTime.set(this.config.timeOut);
368
+ this.remainingTime.set(this.config().timeOut);
32
369
  this._handleTimeOut();
33
370
  this.getHostElement().addEventListener('pointerenter', () => {
34
- if (!this.config.pauseOnHover)
371
+ if (!this.config().pauseOnHover)
35
372
  return;
36
373
  if (this.isPaused())
37
374
  return;
@@ -40,7 +377,7 @@ class AXNotificationComponent extends MXBaseComponent {
40
377
  this.pauseAnimation();
41
378
  });
42
379
  this.getHostElement().addEventListener('pointerleave', () => {
43
- if (!this.config.pauseOnHover)
380
+ if (!this.config().pauseOnHover)
44
381
  return;
45
382
  if (!this.isPaused())
46
383
  return;
@@ -53,7 +390,7 @@ class AXNotificationComponent extends MXBaseComponent {
53
390
  clearInterval(this.intervalId);
54
391
  }
55
392
  _handleTimeOut() {
56
- if (this.config.timeOut) {
393
+ if (this.config().timeOut) {
57
394
  this.intervalId = setInterval(() => {
58
395
  this.remainingTime.update((prev) => prev - this.transitionDuration());
59
396
  if (this.remainingTime() <= 0) {
@@ -64,18 +401,9 @@ class AXNotificationComponent extends MXBaseComponent {
64
401
  }
65
402
  }
66
403
  /** @ignore */
67
- _initContent() {
68
- if (this.config.content instanceof TemplateRef) {
69
- this._selectedPortal = new TemplatePortal(this.config.content, this.getViewContainer());
70
- }
71
- else if (typeof this.config.content === 'function') {
72
- this._selectedPortal = new ComponentPortal(this.config.content);
73
- }
74
- }
75
- /** @ignore */
76
404
  _initIcon() {
77
- if (!this.config.icon) {
78
- switch (this.config.color) {
405
+ if (!this.config().icon) {
406
+ switch (this.config().color) {
79
407
  case 'success':
80
408
  this._icon = 'ax-icon ax-icon-check-circle';
81
409
  break;
@@ -86,12 +414,12 @@ class AXNotificationComponent extends MXBaseComponent {
86
414
  this._icon = 'ax-icon ax-icon-warning';
87
415
  break;
88
416
  default:
89
- this._icon = this.config.icon || 'ax-icon ax-icon-info';
417
+ this._icon = this.config().icon || 'ax-icon ax-icon-info';
90
418
  break;
91
419
  }
92
420
  }
93
421
  else {
94
- this._icon = this.config.icon;
422
+ this._icon = this.config().icon;
95
423
  }
96
424
  }
97
425
  /** @ignore */
@@ -101,55 +429,43 @@ class AXNotificationComponent extends MXBaseComponent {
101
429
  }
102
430
  }
103
431
  /**
104
- * Closes the dialog and provides the component and HTML element for reference.
432
+ * Closes the notification.
105
433
  */
106
434
  close() {
107
- this.dialogRef.close({
108
- component: this,
109
- htmlElement: this.getHostElement(),
110
- });
435
+ const closeCallback = this.onClose();
436
+ if (closeCallback) {
437
+ closeCallback();
438
+ }
439
+ }
440
+ /**
441
+ * Closes all notifications.
442
+ */
443
+ closeAll() {
444
+ this.notificationService.hideAll();
111
445
  }
112
446
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXNotificationComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
113
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: AXNotificationComponent, isStandalone: true, selector: "ax-notification", providers: [
447
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: AXNotificationComponent, isStandalone: true, selector: "ax-notification", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, onClose: { classPropertyName: "onClose", publicName: "onClose", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "\"ax-\" + config().color" } }, providers: [
114
448
  { provide: AXClosableComponent, useExisting: AXNotificationComponent },
115
449
  { provide: AXComponent, useExisting: AXNotificationComponent },
116
- ], usesInheritance: true, ngImport: i0, template: "<span class=\"ax-notification-icon ax-icon-solid {{ _icon }} ax-{{ this.config.color }}\"></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\n class=\"ax-xs\"\n [text]=\"button.text | translate | async\"\n [color]=\"'ax-' + button.color\"\n [look]=\"'ax-' + button.look\"\n [disabled]=\"button.disabled\"\n (onClick)=\"_handleButtonClick(button)\"\n >\n @if (button.loading) {\n <ax-loading></ax-loading>\n }\n </ax-button>\n }\n </div>\n }\n</div>\n@if (config.closeButton) {\n <ax-close-button></ax-close-button>\n}\n@if (config.timeOutProgress && config.timeOut && remainingTime()) {\n <div\n [class]=\"'ax-notification-progress ax-' + this.config.color\"\n [style.transition-duration]=\"transitionDuration()\"\n [style.width]=\"(remainingTime() * 100) / config.timeOut + '%'\"\n ></div>\n}\n", styles: ["@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-font-weight:initial;--tw-leading:initial;--tw-duration:initial;--tw-ease:initial}}}@layer components{ax-notification{border-radius:var(--radius-lg,.5rem);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-border-lightest,rgba(var(--ax-sys-color-border-lightest-surface)));background-color:var(--color-lightest,rgba(var(--ax-sys-color-lightest-surface)));width:98vw;padding:calc(var(--spacing,.25rem)*4);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25/.875)));--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);display:flex;position:relative;overflow:hidden}ax-notification:where(.dark,.dark *){background-color:var(--color-darkest,rgba(var(--ax-sys-color-darkest-surface)))}@media (min-width:768px){ax-notification{width:calc(var(--spacing,.25rem)*96)}}ax-notification .ax-notification-icon{color:var(--ax-comp-bg);padding-inline-end:calc(var(--spacing,.25rem)*3)}ax-notification .ax-notification-content{--tw-font-weight:var(--font-weight-normal,400);font-weight:var(--font-weight-normal,400);color:var(--color-on-surface,rgba(var(--ax-sys-color-on-surface)));flex-direction:column;flex:1;justify-content:center;display:flex}ax-notification .ax-notification-content .ax-notification-title{--tw-leading:calc(var(--spacing,.25rem)*5);line-height:calc(var(--spacing,.25rem)*5);--tw-font-weight:var(--font-weight-medium,500);font-weight:var(--font-weight-medium,500)}ax-notification .ax-notification-content .ax-notification-buttons{margin-top:calc(var(--spacing,.25rem)*3);gap:calc(var(--spacing,.25rem)*3);display:flex}ax-notification .ax-notification-progress{inset-inline-start:calc(var(--spacing,.25rem)*0);inset-inline-end:calc(var(--spacing,.25rem)*0);bottom:calc(var(--spacing,.25rem)*0);height:calc(var(--spacing,.25rem)*1);background-color:var(--ax-comp-bg);width:100%;transition-property:width;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function,cubic-bezier(.4,0,.2,1)));transition-duration:var(--tw-duration,var(--default-transition-duration,.15s));--tw-duration:.3s;--tw-ease:linear;transition-duration:.3s;transition-timing-function:linear;position:absolute}ax-notification .ax-notification-icon,ax-notification .ax-icon-close{max-width:fit-content;font-size:var(--text-xl,1.25rem)!important;line-height:var(--tw-leading,var(--text-xl--line-height,calc(1.75/1.25)))!important;align-items:flex-start!important}}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-font-weight{syntax:\"*\";inherits:false}@property --tw-leading{syntax:\"*\";inherits:false}@property --tw-duration{syntax:\"*\";inherits:false}@property --tw-ease{syntax:\"*\";inherits:false}\n/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "component", type: AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "component", type: AXLoadingComponent, selector: "ax-loading", inputs: ["visible", "type", "context"], outputs: ["visibleChange"] }, { kind: "component", type: AXDecoratorCloseButtonComponent, selector: "ax-close-button", inputs: ["closeAll", "icon"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
450
+ ], usesInheritance: true, ngImport: i0, template: "<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 (templateContent()) {\n <ng-container *ngTemplateOutlet=\"templateContent()\"></ng-container>\n } @else if (componentContent()) {\n <ng-container *ngComponentOutlet=\"componentContent()\"></ng-container>\n } @else {\n <div>{{ stringContent() | translate | async }}</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\n class=\"ax-xs\"\n [text]=\"button.text | translate | async\"\n [color]=\"button.color\"\n [look]=\"button.look\"\n [disabled]=\"button.disabled\"\n (onClick)=\"_handleButtonClick(button)\"\n >\n @if (button.loading) {\n <ax-loading></ax-loading>\n }\n </ax-button>\n }\n </div>\n }\n</div>\n@if (config().closeButton) {\n <ax-close-button></ax-close-button>\n}\n@if (config().timeOutProgress && config().timeOut && remainingTime()) {\n <div\n class=\"ax-notification-progress\"\n [style.transition-duration]=\"transitionDuration()\"\n [style.width]=\"(remainingTime() * 100) / config().timeOut + '%'\"\n ></div>\n}\n", styles: ["ax-notification.ax-default{--ax-comp-notification-icon-text-color: var(--ax-sys-color-on-lightest-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-surface)}.ax-dark ax-notification.ax-default{--ax-comp-notification-icon-text-color: var(--ax-sys-color-on-darkest-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-lightest-surface)}ax-notification.ax-primary{--ax-comp-notification-icon-text-color: var(--ax-sys-color-primary-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-primary-surface)}ax-notification.ax-secondary{--ax-comp-notification-icon-text-color: var(--ax-sys-color-secondary-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-secondary-surface)}ax-notification.ax-success{--ax-comp-notification-icon-text-color: var(--ax-sys-color-success-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-success-surface)}ax-notification.ax-warning{--ax-comp-notification-icon-text-color: var(--ax-sys-color-warning-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-warning-surface)}ax-notification.ax-danger{--ax-comp-notification-icon-text-color: var(--ax-sys-color-danger-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-danger-surface)}ax-notification.ax-accent1{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent1-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent1-surface)}ax-notification.ax-accent2{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent2-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent2-surface)}ax-notification.ax-accent3{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent3-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent3-surface)}ax-notification.ax-accent4{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent4-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent4-surface)}ax-notification.ax-accent5{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent5-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent5-surface)}ax-notification.ax-accent6{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent6-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent6-surface)}ax-notification.ax-accent7{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent7-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent7-surface)}ax-notification{position:relative;display:flex;width:98vw;overflow:hidden;padding:1rem;--ax-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--ax-shadow-colored: 0 10px 15px -3px var(--ax-shadow-color), 0 4px 6px -4px var(--ax-shadow-color);box-shadow:var(--ax-ring-offset-shadow, 0 0 rgba(0, 0, 0, 0)),var(--ax-ring-shadow, 0 0 rgba(0, 0, 0, 0)),var(--ax-shadow);background-color:rgba(var(--ax-comp-notification-bg-color, var(--ax-sys-color-lightest-surface)));font-size:var(--ax-comp-notification-font-size, .875rem);line-height:var(--ax-comp-notification-line-height, 1.25rem);border-width:var(--ax-comp-notification-border-width, 1px);border-color:rgba(var(--ax-comp-notification-border-color, var(--ax-sys-color-border-lightest-surface)));border-radius:var(--ax-comp-notification-border-radius, var(--ax-sys-border-radius))}@media (min-width: 768px){ax-notification{width:24rem}}ax-notification .ax-notification-icon,ax-notification .ax-icon-close{font-size:1.25rem;line-height:1.75rem;max-width:fit-content;align-items:flex-start}ax-notification .ax-notification-icon{color:rgba(var(--ax-comp-notification-icon-text-color));padding-inline-end:.75rem}ax-notification .ax-notification-content{display:flex;flex:1 1 0%;flex-direction:column;font-weight:400;justify-content:center;color:rgba(var(--ax-comp-notification-text-color, var(--ax-sys-color-on-surface)))}ax-notification .ax-notification-content .ax-notification-title{font-weight:500;line-height:1.5}ax-notification .ax-notification-content .ax-notification-buttons{margin-top:.75rem;display:flex;gap:.75rem}ax-notification .ax-notification-progress{width:100%;bottom:0;height:.25rem;position:absolute;inset-inline-end:0px;inset-inline-start:0px;transition-property:width;transition-timing-function:linear;transition-duration:var(--ax-sys-transition-duration);background-color:rgba(var(--ax-comp-notification-progress-bg-color, 255, 255, 255, .46))}.ax-dark ax-notification{--ax-comp-notification-bg-color: var(--ax-sys-color-darkest-surface);--ax-comp-notification-border-color: var(--ax-sys-color-border-darkest-surface)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"], exportAs: ["ngComponentOutlet"] }, { kind: "component", type: AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "component", type: AXLoadingComponent, selector: "ax-loading", inputs: ["visible", "type", "context"], outputs: ["visibleChange"] }, { kind: "component", type: AXDecoratorCloseButtonComponent, selector: "ax-close-button", inputs: ["closeAll", "icon"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
117
451
  }
118
452
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXNotificationComponent, decorators: [{
119
453
  type: Component,
120
- args: [{ selector: 'ax-notification', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
454
+ args: [{ selector: 'ax-notification', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
455
+ '[class]': '"ax-" + config().color',
456
+ }, providers: [
121
457
  { provide: AXClosableComponent, useExisting: AXNotificationComponent },
122
458
  { provide: AXComponent, useExisting: AXNotificationComponent },
123
459
  ], imports: [
124
- CdkPortalOutlet,
460
+ NgTemplateOutlet,
461
+ NgComponentOutlet,
125
462
  AXButtonComponent,
126
463
  AXLoadingComponent,
127
464
  AXDecoratorCloseButtonComponent,
128
465
  AsyncPipe,
129
466
  AXTranslatorPipe,
130
- ], template: "<span class=\"ax-notification-icon ax-icon-solid {{ _icon }} ax-{{ this.config.color }}\"></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\n class=\"ax-xs\"\n [text]=\"button.text | translate | async\"\n [color]=\"'ax-' + button.color\"\n [look]=\"'ax-' + button.look\"\n [disabled]=\"button.disabled\"\n (onClick)=\"_handleButtonClick(button)\"\n >\n @if (button.loading) {\n <ax-loading></ax-loading>\n }\n </ax-button>\n }\n </div>\n }\n</div>\n@if (config.closeButton) {\n <ax-close-button></ax-close-button>\n}\n@if (config.timeOutProgress && config.timeOut && remainingTime()) {\n <div\n [class]=\"'ax-notification-progress ax-' + this.config.color\"\n [style.transition-duration]=\"transitionDuration()\"\n [style.width]=\"(remainingTime() * 100) / config.timeOut + '%'\"\n ></div>\n}\n", styles: ["@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-font-weight:initial;--tw-leading:initial;--tw-duration:initial;--tw-ease:initial}}}@layer components{ax-notification{border-radius:var(--radius-lg,.5rem);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-border-lightest,rgba(var(--ax-sys-color-border-lightest-surface)));background-color:var(--color-lightest,rgba(var(--ax-sys-color-lightest-surface)));width:98vw;padding:calc(var(--spacing,.25rem)*4);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25/.875)));--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);display:flex;position:relative;overflow:hidden}ax-notification:where(.dark,.dark *){background-color:var(--color-darkest,rgba(var(--ax-sys-color-darkest-surface)))}@media (min-width:768px){ax-notification{width:calc(var(--spacing,.25rem)*96)}}ax-notification .ax-notification-icon{color:var(--ax-comp-bg);padding-inline-end:calc(var(--spacing,.25rem)*3)}ax-notification .ax-notification-content{--tw-font-weight:var(--font-weight-normal,400);font-weight:var(--font-weight-normal,400);color:var(--color-on-surface,rgba(var(--ax-sys-color-on-surface)));flex-direction:column;flex:1;justify-content:center;display:flex}ax-notification .ax-notification-content .ax-notification-title{--tw-leading:calc(var(--spacing,.25rem)*5);line-height:calc(var(--spacing,.25rem)*5);--tw-font-weight:var(--font-weight-medium,500);font-weight:var(--font-weight-medium,500)}ax-notification .ax-notification-content .ax-notification-buttons{margin-top:calc(var(--spacing,.25rem)*3);gap:calc(var(--spacing,.25rem)*3);display:flex}ax-notification .ax-notification-progress{inset-inline-start:calc(var(--spacing,.25rem)*0);inset-inline-end:calc(var(--spacing,.25rem)*0);bottom:calc(var(--spacing,.25rem)*0);height:calc(var(--spacing,.25rem)*1);background-color:var(--ax-comp-bg);width:100%;transition-property:width;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function,cubic-bezier(.4,0,.2,1)));transition-duration:var(--tw-duration,var(--default-transition-duration,.15s));--tw-duration:.3s;--tw-ease:linear;transition-duration:.3s;transition-timing-function:linear;position:absolute}ax-notification .ax-notification-icon,ax-notification .ax-icon-close{max-width:fit-content;font-size:var(--text-xl,1.25rem)!important;line-height:var(--tw-leading,var(--text-xl--line-height,calc(1.75/1.25)))!important;align-items:flex-start!important}}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-font-weight{syntax:\"*\";inherits:false}@property --tw-leading{syntax:\"*\";inherits:false}@property --tw-duration{syntax:\"*\";inherits:false}@property --tw-ease{syntax:\"*\";inherits:false}\n/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */\n"] }]
131
- }] });
132
-
133
- const AX_NOTIFICATION_CONFIG = new InjectionToken('AX_NOTIFICATION_CONFIG', {
134
- providedIn: 'root',
135
- factory: () => AXNotificationDefaultConfig,
136
- });
137
- const AXNotificationDefaultConfig = {
138
- gap: 5,
139
- timeOut: 2500,
140
- timeOutProgress: true,
141
- closeButton: true,
142
- location: 'top-end',
143
- limit: 3,
144
- pauseOnHover: true,
145
- };
146
- function notificationConfig(config = {}) {
147
- const result = {
148
- ...AXNotificationDefaultConfig,
149
- ...config,
150
- };
151
- return result;
152
- }
467
+ ], template: "<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 (templateContent()) {\n <ng-container *ngTemplateOutlet=\"templateContent()\"></ng-container>\n } @else if (componentContent()) {\n <ng-container *ngComponentOutlet=\"componentContent()\"></ng-container>\n } @else {\n <div>{{ stringContent() | translate | async }}</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\n class=\"ax-xs\"\n [text]=\"button.text | translate | async\"\n [color]=\"button.color\"\n [look]=\"button.look\"\n [disabled]=\"button.disabled\"\n (onClick)=\"_handleButtonClick(button)\"\n >\n @if (button.loading) {\n <ax-loading></ax-loading>\n }\n </ax-button>\n }\n </div>\n }\n</div>\n@if (config().closeButton) {\n <ax-close-button></ax-close-button>\n}\n@if (config().timeOutProgress && config().timeOut && remainingTime()) {\n <div\n class=\"ax-notification-progress\"\n [style.transition-duration]=\"transitionDuration()\"\n [style.width]=\"(remainingTime() * 100) / config().timeOut + '%'\"\n ></div>\n}\n", styles: ["ax-notification.ax-default{--ax-comp-notification-icon-text-color: var(--ax-sys-color-on-lightest-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-surface)}.ax-dark ax-notification.ax-default{--ax-comp-notification-icon-text-color: var(--ax-sys-color-on-darkest-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-lightest-surface)}ax-notification.ax-primary{--ax-comp-notification-icon-text-color: var(--ax-sys-color-primary-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-primary-surface)}ax-notification.ax-secondary{--ax-comp-notification-icon-text-color: var(--ax-sys-color-secondary-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-secondary-surface)}ax-notification.ax-success{--ax-comp-notification-icon-text-color: var(--ax-sys-color-success-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-success-surface)}ax-notification.ax-warning{--ax-comp-notification-icon-text-color: var(--ax-sys-color-warning-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-warning-surface)}ax-notification.ax-danger{--ax-comp-notification-icon-text-color: var(--ax-sys-color-danger-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-danger-surface)}ax-notification.ax-accent1{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent1-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent1-surface)}ax-notification.ax-accent2{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent2-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent2-surface)}ax-notification.ax-accent3{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent3-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent3-surface)}ax-notification.ax-accent4{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent4-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent4-surface)}ax-notification.ax-accent5{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent5-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent5-surface)}ax-notification.ax-accent6{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent6-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent6-surface)}ax-notification.ax-accent7{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent7-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent7-surface)}ax-notification{position:relative;display:flex;width:98vw;overflow:hidden;padding:1rem;--ax-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--ax-shadow-colored: 0 10px 15px -3px var(--ax-shadow-color), 0 4px 6px -4px var(--ax-shadow-color);box-shadow:var(--ax-ring-offset-shadow, 0 0 rgba(0, 0, 0, 0)),var(--ax-ring-shadow, 0 0 rgba(0, 0, 0, 0)),var(--ax-shadow);background-color:rgba(var(--ax-comp-notification-bg-color, var(--ax-sys-color-lightest-surface)));font-size:var(--ax-comp-notification-font-size, .875rem);line-height:var(--ax-comp-notification-line-height, 1.25rem);border-width:var(--ax-comp-notification-border-width, 1px);border-color:rgba(var(--ax-comp-notification-border-color, var(--ax-sys-color-border-lightest-surface)));border-radius:var(--ax-comp-notification-border-radius, var(--ax-sys-border-radius))}@media (min-width: 768px){ax-notification{width:24rem}}ax-notification .ax-notification-icon,ax-notification .ax-icon-close{font-size:1.25rem;line-height:1.75rem;max-width:fit-content;align-items:flex-start}ax-notification .ax-notification-icon{color:rgba(var(--ax-comp-notification-icon-text-color));padding-inline-end:.75rem}ax-notification .ax-notification-content{display:flex;flex:1 1 0%;flex-direction:column;font-weight:400;justify-content:center;color:rgba(var(--ax-comp-notification-text-color, var(--ax-sys-color-on-surface)))}ax-notification .ax-notification-content .ax-notification-title{font-weight:500;line-height:1.5}ax-notification .ax-notification-content .ax-notification-buttons{margin-top:.75rem;display:flex;gap:.75rem}ax-notification .ax-notification-progress{width:100%;bottom:0;height:.25rem;position:absolute;inset-inline-end:0px;inset-inline-start:0px;transition-property:width;transition-timing-function:linear;transition-duration:var(--ax-sys-transition-duration);background-color:rgba(var(--ax-comp-notification-progress-bg-color, 255, 255, 255, .46))}.ax-dark ax-notification{--ax-comp-notification-bg-color: var(--ax-sys-color-darkest-surface);--ax-comp-notification-border-color: var(--ax-sys-color-border-darkest-surface)}\n"] }]
468
+ }], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], onClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "onClose", required: false }] }] } });
153
469
 
154
470
  class AXNotificationModule {
155
471
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXNotificationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
@@ -164,194 +480,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
164
480
  }]
165
481
  }] });
166
482
 
167
- class AXNotificationService {
168
- constructor() {
169
- this.dialog = inject(Dialog);
170
- this.translationService = inject(AXTranslationService);
171
- this.defaultConfig = inject(AX_NOTIFICATION_CONFIG);
172
- this.activeNotifications = [];
173
- this.reservedNotifications = [];
174
- this.notificationCounterElement = null;
175
- this.moreNotificationsColor = 'primary';
176
- this.moreNotificationsLocation = 'bottom-center';
177
- this.reserveCounter = 0;
178
- }
179
- show(config) {
180
- config = { ...this.defaultConfig, ...config };
181
- this.moreNotificationsColor = config.color;
182
- this.moreNotificationsLocation = config.location;
183
- if (this.defaultConfig.limit > 0 && this.activeNotifications.length >= this.defaultConfig.limit) {
184
- const reservedRef = {
185
- close: () => {
186
- console.warn('Reserved notification cannot be closed until it is displayed.');
187
- },
188
- };
189
- this.reservedNotifications.push({ config, reservedRef });
190
- this.handleReservedNotificationCounter();
191
- return reservedRef;
192
- }
193
- return this.displayNotification(config);
194
- }
195
- displayNotification(config) {
196
- const gap = this.defaultConfig.gap;
197
- const pos = this.getPosition(config.location) + gap + 'px';
198
- const positionStrategy = this.getPositionStrategy(new GlobalPositionStrategy(), config.location, pos, gap);
199
- const dialogRef = this.dialog.open(AXNotificationComponent, {
200
- data: config,
201
- autoFocus: '__no_element__',
202
- restoreFocus: false,
203
- role: 'dialog',
204
- ariaModal: true,
205
- closeOnNavigation: true,
206
- closeOnDestroy: true,
207
- hasBackdrop: false,
208
- panelClass: ['animate-fadeIn', 'animate-faster'],
209
- positionStrategy,
210
- });
211
- this.activeNotifications.push(dialogRef.id);
212
- this.handleReservedNotificationCounter();
213
- const notificationRef = dialogRef.componentInstance;
214
- dialogRef.closed.subscribe(() => {
215
- this.activeNotifications = this.activeNotifications.filter((id) => id !== dialogRef.id);
216
- this.handleShowReservedNotification();
217
- this.handleReservedNotificationCounter();
218
- setTimeout(() => {
219
- this.reposition(config.location, gap);
220
- }, 0);
221
- });
222
- return {
223
- close: () => {
224
- notificationRef.close();
225
- },
226
- };
227
- }
228
- hideAll() {
229
- this.dialog.closeAll();
230
- this.reserveCounter = 0;
231
- this.reservedNotifications = [];
232
- this.activeNotifications = [];
233
- this.handleReservedNotificationCounter();
234
- }
235
- handleShowReservedNotification() {
236
- if (this.activeNotifications.length > this.defaultConfig.limit - 1)
237
- return;
238
- if (!this.reservedNotifications.length)
239
- return;
240
- const { config, reservedRef } = this.reservedNotifications.shift();
241
- const displayedRef = this.displayNotification(config);
242
- this.handleReservedNotificationCounter();
243
- reservedRef.close = displayedRef.close;
244
- }
245
- handleReservedNotificationCounter() {
246
- const reservedCount = this.reservedNotifications.length;
247
- if (reservedCount === this.reserveCounter)
248
- return;
249
- this.reserveCounter = reservedCount;
250
- if (reservedCount === 0 && this.notificationCounterElement !== null) {
251
- this.notificationCounterElement.close();
252
- return;
253
- }
254
- if (reservedCount > 0) {
255
- if (this.notificationCounterElement !== null) {
256
- this.notificationCounterElement.close();
257
- }
258
- this.createReservedCounternotification();
259
- }
260
- }
261
- async createReservedCounternotification() {
262
- const opt = {
263
- closeButton: false,
264
- color: this.moreNotificationsColor,
265
- location: this.moreNotificationsLocation,
266
- title: await this.translationService.translateAsync('@acorex:common.notifications.more', {
267
- params: { number: this.reserveCounter },
268
- }),
269
- timeOutProgress: false,
270
- };
271
- const gap = this.defaultConfig.gap;
272
- const pos = this.getPosition(opt.location) + gap + 'px';
273
- const positionStrategy = this.getPositionStrategy(new GlobalPositionStrategy(), opt.location, pos, gap);
274
- const dialogRef = this.dialog.open(AXNotificationComponent, {
275
- data: opt,
276
- autoFocus: '__no_element__',
277
- restoreFocus: true,
278
- role: 'dialog',
279
- ariaModal: true,
280
- closeOnNavigation: true,
281
- closeOnDestroy: true,
282
- hasBackdrop: false,
283
- panelClass: ['animate-fadeIn', 'animate-faster'],
284
- positionStrategy,
285
- });
286
- this.notificationCounterElement = dialogRef.componentInstance;
287
- }
288
- reposition(notificationLocation, gap) {
289
- const list = this.dialog.openDialogs
290
- .map((c) => c.componentInstance)
291
- .filter((c) => c.config?.location == notificationLocation);
292
- list.forEach((element, index) => {
293
- const pos = this.getRepositionPosition(index, gap, list, notificationLocation);
294
- this.getPositionStrategy(element.dialogRef.config.positionStrategy, notificationLocation, pos, gap).apply();
295
- });
296
- }
297
- getRepositionPosition(index, gap, list, notificationLocation) {
298
- if (index === 0)
299
- return gap + 'px';
300
- const previouseElement = list[index - 1];
301
- if (notificationLocation.split('-')[0] == 'bottom') {
302
- return window.innerHeight - previouseElement.getHostElement().offsetTop + gap + 'px';
303
- }
304
- return previouseElement.getHostElement().offsetTop + previouseElement.getHostElement().offsetHeight + gap + 'px';
305
- }
306
- getPosition(location) {
307
- const list = this.dialog.openDialogs
308
- .map((c) => c.componentInstance)
309
- .filter((c) => c.config.location == location);
310
- if (list.length == 0)
311
- return 0;
312
- if (location.split('-')[0] == 'bottom') {
313
- return window.innerHeight - list[list.length - 1].getHostElement().offsetTop;
314
- }
315
- return list[list.length - 1].getHostElement().offsetTop + list[list.length - 1].getHostElement().offsetHeight;
316
- }
317
- getPositionStrategy(positionStrategy, location, pos, gap) {
318
- switch (location) {
319
- case 'bottom-center':
320
- return positionStrategy.bottom(pos).centerHorizontally();
321
- break;
322
- case 'bottom-end':
323
- return positionStrategy.bottom(pos).right(gap + 'px');
324
- break;
325
- case 'bottom-start':
326
- return positionStrategy.bottom(pos).left(gap + 'px');
327
- break;
328
- case 'top-center':
329
- return positionStrategy.top(pos).centerHorizontally();
330
- break;
331
- case 'top-end':
332
- return positionStrategy.top(pos).right(gap + 'px');
333
- break;
334
- case 'top-start':
335
- return positionStrategy.top(pos).left(gap + 'px');
336
- break;
337
- case 'center-start':
338
- return positionStrategy.centerVertically().left(gap + 'px');
339
- break;
340
- case 'center-end':
341
- return positionStrategy.centerVertically().right(gap + 'px');
342
- break;
343
- }
344
- }
345
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXNotificationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
346
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXNotificationService, providedIn: 'root' }); }
347
- }
348
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXNotificationService, decorators: [{
349
- type: Injectable,
350
- args: [{
351
- providedIn: 'root',
352
- }]
353
- }] });
354
-
355
483
  /**
356
484
  * Generated bundle index. Do not edit.
357
485
  */