@acorex/components 21.0.1-next.3 → 21.0.1-next.30

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 (255) hide show
  1. package/accordion/index.d.ts +0 -1
  2. package/action-sheet/index.d.ts +116 -34
  3. package/button-group/index.d.ts +6 -4
  4. package/chips/index.d.ts +3 -8
  5. package/collapse/index.d.ts +4 -6
  6. package/command/index.d.ts +8 -1
  7. package/conversation2/README.md +71 -31
  8. package/conversation2/index.d.ts +36 -35
  9. package/data-table/index.d.ts +4 -253
  10. package/datetime-picker/index.d.ts +1 -1
  11. package/dialog/index.d.ts +18 -14
  12. package/dropdown/index.d.ts +3 -8
  13. package/fesm2022/acorex-components-accordion.mjs +16 -21
  14. package/fesm2022/acorex-components-accordion.mjs.map +1 -1
  15. package/fesm2022/acorex-components-action-sheet.mjs +284 -118
  16. package/fesm2022/acorex-components-action-sheet.mjs.map +1 -1
  17. package/fesm2022/acorex-components-alert.mjs +13 -13
  18. package/fesm2022/acorex-components-alert.mjs.map +1 -1
  19. package/fesm2022/acorex-components-aspect-ratio.mjs +3 -3
  20. package/fesm2022/acorex-components-aspect-ratio.mjs.map +1 -1
  21. package/fesm2022/acorex-components-audio-wave.mjs +11 -10
  22. package/fesm2022/acorex-components-audio-wave.mjs.map +1 -1
  23. package/fesm2022/acorex-components-autocomplete.mjs +7 -7
  24. package/fesm2022/acorex-components-autocomplete.mjs.map +1 -1
  25. package/fesm2022/acorex-components-avatar.mjs +12 -12
  26. package/fesm2022/acorex-components-avatar.mjs.map +1 -1
  27. package/fesm2022/acorex-components-badge.mjs +9 -9
  28. package/fesm2022/acorex-components-badge.mjs.map +1 -1
  29. package/fesm2022/acorex-components-bottom-navigation.mjs +11 -11
  30. package/fesm2022/acorex-components-bottom-navigation.mjs.map +1 -1
  31. package/fesm2022/acorex-components-breadcrumbs.mjs +11 -11
  32. package/fesm2022/acorex-components-breadcrumbs.mjs.map +1 -1
  33. package/fesm2022/acorex-components-button-group.mjs +23 -19
  34. package/fesm2022/acorex-components-button-group.mjs.map +1 -1
  35. package/fesm2022/acorex-components-button.mjs +18 -18
  36. package/fesm2022/acorex-components-button.mjs.map +1 -1
  37. package/fesm2022/acorex-components-calendar.mjs +17 -17
  38. package/fesm2022/acorex-components-calendar.mjs.map +1 -1
  39. package/fesm2022/acorex-components-check-box.mjs +10 -10
  40. package/fesm2022/acorex-components-check-box.mjs.map +1 -1
  41. package/fesm2022/acorex-components-chips.mjs +12 -14
  42. package/fesm2022/acorex-components-chips.mjs.map +1 -1
  43. package/fesm2022/acorex-components-circular-progress.mjs +12 -10
  44. package/fesm2022/acorex-components-circular-progress.mjs.map +1 -1
  45. package/fesm2022/acorex-components-code-editor.mjs +10 -10
  46. package/fesm2022/acorex-components-code-editor.mjs.map +1 -1
  47. package/fesm2022/acorex-components-collapse.mjs +22 -19
  48. package/fesm2022/acorex-components-collapse.mjs.map +1 -1
  49. package/fesm2022/acorex-components-color-box.mjs +9 -9
  50. package/fesm2022/acorex-components-color-box.mjs.map +1 -1
  51. package/fesm2022/acorex-components-color-palette.mjs +30 -30
  52. package/fesm2022/acorex-components-color-palette.mjs.map +1 -1
  53. package/fesm2022/acorex-components-command.mjs +17 -11
  54. package/fesm2022/acorex-components-command.mjs.map +1 -1
  55. package/fesm2022/acorex-components-comment.mjs +32 -32
  56. package/fesm2022/acorex-components-comment.mjs.map +1 -1
  57. package/fesm2022/acorex-components-conversation.mjs +51 -51
  58. package/fesm2022/acorex-components-conversation.mjs.map +1 -1
  59. package/fesm2022/acorex-components-conversation2.mjs +309 -303
  60. package/fesm2022/acorex-components-conversation2.mjs.map +1 -1
  61. package/fesm2022/acorex-components-cron-job.mjs +46 -46
  62. package/fesm2022/acorex-components-cron-job.mjs.map +1 -1
  63. package/fesm2022/acorex-components-data-list.mjs +3 -3
  64. package/fesm2022/acorex-components-data-list.mjs.map +1 -1
  65. package/fesm2022/acorex-components-data-pager.mjs +33 -33
  66. package/fesm2022/acorex-components-data-pager.mjs.map +1 -1
  67. package/fesm2022/acorex-components-data-table.mjs +50 -486
  68. package/fesm2022/acorex-components-data-table.mjs.map +1 -1
  69. package/fesm2022/acorex-components-datetime-box.mjs +9 -9
  70. package/fesm2022/acorex-components-datetime-box.mjs.map +1 -1
  71. package/fesm2022/acorex-components-datetime-input.mjs +9 -9
  72. package/fesm2022/acorex-components-datetime-input.mjs.map +1 -1
  73. package/fesm2022/acorex-components-datetime-picker.mjs +40 -38
  74. package/fesm2022/acorex-components-datetime-picker.mjs.map +1 -1
  75. package/fesm2022/acorex-components-decorators.mjs +43 -36
  76. package/fesm2022/acorex-components-decorators.mjs.map +1 -1
  77. package/fesm2022/acorex-components-dialog.mjs +75 -54
  78. package/fesm2022/acorex-components-dialog.mjs.map +1 -1
  79. package/fesm2022/acorex-components-drawer-legacy.mjs +13 -13
  80. package/fesm2022/acorex-components-drawer-legacy.mjs.map +1 -1
  81. package/fesm2022/acorex-components-drawer.mjs +15 -16
  82. package/fesm2022/acorex-components-drawer.mjs.map +1 -1
  83. package/fesm2022/acorex-components-dropdown-button.mjs +9 -9
  84. package/fesm2022/acorex-components-dropdown-button.mjs.map +1 -1
  85. package/fesm2022/acorex-components-dropdown.mjs +25 -28
  86. package/fesm2022/acorex-components-dropdown.mjs.map +1 -1
  87. package/fesm2022/acorex-components-editor.mjs +11 -11
  88. package/fesm2022/acorex-components-editor.mjs.map +1 -1
  89. package/fesm2022/acorex-components-file-explorer.mjs +25 -25
  90. package/fesm2022/acorex-components-file-explorer.mjs.map +1 -1
  91. package/fesm2022/acorex-components-flow-chart.mjs +16 -16
  92. package/fesm2022/acorex-components-flow-chart.mjs.map +1 -1
  93. package/fesm2022/acorex-components-form.mjs +48 -42
  94. package/fesm2022/acorex-components-form.mjs.map +1 -1
  95. package/fesm2022/acorex-components-grid-layout-builder.mjs +13 -14
  96. package/fesm2022/acorex-components-grid-layout-builder.mjs.map +1 -1
  97. package/fesm2022/acorex-components-image-editor.mjs +44 -44
  98. package/fesm2022/acorex-components-image-editor.mjs.map +1 -1
  99. package/fesm2022/acorex-components-image.mjs +9 -9
  100. package/fesm2022/acorex-components-image.mjs.map +1 -1
  101. package/fesm2022/acorex-components-json-viewer.mjs +8 -8
  102. package/fesm2022/acorex-components-json-viewer.mjs.map +1 -1
  103. package/fesm2022/acorex-components-kanban.mjs +140 -13
  104. package/fesm2022/acorex-components-kanban.mjs.map +1 -1
  105. package/fesm2022/acorex-components-kbd.mjs +29 -11
  106. package/fesm2022/acorex-components-kbd.mjs.map +1 -1
  107. package/fesm2022/acorex-components-label.mjs +9 -9
  108. package/fesm2022/acorex-components-label.mjs.map +1 -1
  109. package/fesm2022/acorex-components-list.mjs +9 -9
  110. package/fesm2022/acorex-components-list.mjs.map +1 -1
  111. package/fesm2022/acorex-components-loading-dialog.mjs +82 -45
  112. package/fesm2022/acorex-components-loading-dialog.mjs.map +1 -1
  113. package/fesm2022/acorex-components-loading.mjs +23 -23
  114. package/fesm2022/acorex-components-loading.mjs.map +1 -1
  115. package/fesm2022/acorex-components-map.mjs +14 -14
  116. package/fesm2022/acorex-components-map.mjs.map +1 -1
  117. package/fesm2022/acorex-components-media-viewer.mjs +72 -54
  118. package/fesm2022/acorex-components-media-viewer.mjs.map +1 -1
  119. package/fesm2022/acorex-components-menu.mjs +43 -22
  120. package/fesm2022/acorex-components-menu.mjs.map +1 -1
  121. package/fesm2022/{acorex-components-modal-acorex-components-modal-CXXcFToK.mjs → acorex-components-modal-acorex-components-modal-BajlPo_n.mjs} +47 -23
  122. package/fesm2022/acorex-components-modal-acorex-components-modal-BajlPo_n.mjs.map +1 -0
  123. package/fesm2022/{acorex-components-modal-modal-content.component-B4rhHeEz.mjs → acorex-components-modal-modal-content.component-BVrBX4Qf.mjs} +9 -7
  124. package/fesm2022/acorex-components-modal-modal-content.component-BVrBX4Qf.mjs.map +1 -0
  125. package/fesm2022/acorex-components-modal.mjs +1 -1
  126. package/fesm2022/acorex-components-navbar.mjs +9 -9
  127. package/fesm2022/acorex-components-navbar.mjs.map +1 -1
  128. package/fesm2022/acorex-components-notification.mjs +381 -260
  129. package/fesm2022/acorex-components-notification.mjs.map +1 -1
  130. package/fesm2022/acorex-components-number-box-legacy.mjs +9 -9
  131. package/fesm2022/acorex-components-number-box-legacy.mjs.map +1 -1
  132. package/fesm2022/acorex-components-number-box.mjs +9 -9
  133. package/fesm2022/acorex-components-number-box.mjs.map +1 -1
  134. package/fesm2022/acorex-components-otp.mjs +9 -9
  135. package/fesm2022/acorex-components-otp.mjs.map +1 -1
  136. package/fesm2022/acorex-components-page.mjs +10 -10
  137. package/fesm2022/acorex-components-page.mjs.map +1 -1
  138. package/fesm2022/acorex-components-paint.mjs +34 -39
  139. package/fesm2022/acorex-components-paint.mjs.map +1 -1
  140. package/fesm2022/acorex-components-password-box.mjs +13 -13
  141. package/fesm2022/acorex-components-password-box.mjs.map +1 -1
  142. package/fesm2022/acorex-components-pdf-reader.mjs +8 -8
  143. package/fesm2022/acorex-components-pdf-reader.mjs.map +1 -1
  144. package/fesm2022/acorex-components-phone-box.mjs +88 -47
  145. package/fesm2022/acorex-components-phone-box.mjs.map +1 -1
  146. package/fesm2022/acorex-components-picker.mjs +19 -18
  147. package/fesm2022/acorex-components-picker.mjs.map +1 -1
  148. package/fesm2022/acorex-components-popover.mjs +213 -197
  149. package/fesm2022/acorex-components-popover.mjs.map +1 -1
  150. package/fesm2022/acorex-components-popup.mjs +308 -113
  151. package/fesm2022/acorex-components-popup.mjs.map +1 -1
  152. package/fesm2022/acorex-components-progress-bar.mjs +11 -9
  153. package/fesm2022/acorex-components-progress-bar.mjs.map +1 -1
  154. package/fesm2022/acorex-components-qrcode.mjs +9 -9
  155. package/fesm2022/acorex-components-qrcode.mjs.map +1 -1
  156. package/fesm2022/acorex-components-query-builder.mjs +8 -8
  157. package/fesm2022/acorex-components-query-builder.mjs.map +1 -1
  158. package/fesm2022/acorex-components-radio.mjs +9 -9
  159. package/fesm2022/acorex-components-radio.mjs.map +1 -1
  160. package/fesm2022/acorex-components-rail-navigation.mjs +38 -36
  161. package/fesm2022/acorex-components-rail-navigation.mjs.map +1 -1
  162. package/fesm2022/acorex-components-range-slider.mjs +10 -10
  163. package/fesm2022/acorex-components-range-slider.mjs.map +1 -1
  164. package/fesm2022/acorex-components-rate-picker.mjs +20 -35
  165. package/fesm2022/acorex-components-rate-picker.mjs.map +1 -1
  166. package/fesm2022/acorex-components-rest-api-generator.mjs +22 -22
  167. package/fesm2022/acorex-components-rest-api-generator.mjs.map +1 -1
  168. package/fesm2022/acorex-components-result.mjs +8 -8
  169. package/fesm2022/acorex-components-result.mjs.map +1 -1
  170. package/fesm2022/acorex-components-routing-progress.mjs +8 -8
  171. package/fesm2022/acorex-components-routing-progress.mjs.map +1 -1
  172. package/fesm2022/acorex-components-rrule.mjs +9 -9
  173. package/fesm2022/acorex-components-rrule.mjs.map +1 -1
  174. package/fesm2022/acorex-components-scheduler-picker.mjs +56 -56
  175. package/fesm2022/acorex-components-scheduler-picker.mjs.map +1 -1
  176. package/fesm2022/acorex-components-scheduler.mjs +43 -43
  177. package/fesm2022/acorex-components-scheduler.mjs.map +1 -1
  178. package/fesm2022/acorex-components-scss.mjs +4 -4
  179. package/fesm2022/acorex-components-scss.mjs.map +1 -1
  180. package/fesm2022/acorex-components-search-box.mjs +16 -10
  181. package/fesm2022/acorex-components-search-box.mjs.map +1 -1
  182. package/fesm2022/acorex-components-select-box.mjs +11 -9
  183. package/fesm2022/acorex-components-select-box.mjs.map +1 -1
  184. package/fesm2022/acorex-components-selection-list-2.mjs +11 -11
  185. package/fesm2022/acorex-components-selection-list-2.mjs.map +1 -1
  186. package/fesm2022/acorex-components-selection-list.mjs +9 -9
  187. package/fesm2022/acorex-components-selection-list.mjs.map +1 -1
  188. package/fesm2022/acorex-components-side-menu.mjs +74 -25
  189. package/fesm2022/acorex-components-side-menu.mjs.map +1 -1
  190. package/fesm2022/acorex-components-skeleton.mjs +8 -8
  191. package/fesm2022/acorex-components-skeleton.mjs.map +1 -1
  192. package/fesm2022/acorex-components-slider.mjs +12 -12
  193. package/fesm2022/acorex-components-slider.mjs.map +1 -1
  194. package/fesm2022/acorex-components-sliding-item.mjs +14 -14
  195. package/fesm2022/acorex-components-sliding-item.mjs.map +1 -1
  196. package/fesm2022/acorex-components-step-wizard.mjs +14 -14
  197. package/fesm2022/acorex-components-step-wizard.mjs.map +1 -1
  198. package/fesm2022/acorex-components-switch.mjs +14 -14
  199. package/fesm2022/acorex-components-switch.mjs.map +1 -1
  200. package/fesm2022/acorex-components-tabs.mjs +15 -15
  201. package/fesm2022/acorex-components-tabs.mjs.map +1 -1
  202. package/fesm2022/acorex-components-tag-box.mjs +9 -9
  203. package/fesm2022/acorex-components-tag-box.mjs.map +1 -1
  204. package/fesm2022/acorex-components-tag.mjs +9 -9
  205. package/fesm2022/acorex-components-tag.mjs.map +1 -1
  206. package/fesm2022/acorex-components-text-area.mjs +9 -9
  207. package/fesm2022/acorex-components-text-area.mjs.map +1 -1
  208. package/fesm2022/acorex-components-text-box.mjs +14 -12
  209. package/fesm2022/acorex-components-text-box.mjs.map +1 -1
  210. package/fesm2022/acorex-components-time-duration.mjs +18 -20
  211. package/fesm2022/acorex-components-time-duration.mjs.map +1 -1
  212. package/fesm2022/acorex-components-time-line.mjs +12 -12
  213. package/fesm2022/acorex-components-time-line.mjs.map +1 -1
  214. package/fesm2022/acorex-components-toast.mjs +239 -131
  215. package/fesm2022/acorex-components-toast.mjs.map +1 -1
  216. package/fesm2022/acorex-components-toolbar.mjs +8 -8
  217. package/fesm2022/acorex-components-toolbar.mjs.map +1 -1
  218. package/fesm2022/acorex-components-tooltip.mjs +67 -67
  219. package/fesm2022/acorex-components-tooltip.mjs.map +1 -1
  220. package/fesm2022/acorex-components-tree-view-legacy.mjs +16 -12
  221. package/fesm2022/acorex-components-tree-view-legacy.mjs.map +1 -1
  222. package/fesm2022/acorex-components-tree-view.mjs +26 -11
  223. package/fesm2022/acorex-components-tree-view.mjs.map +1 -1
  224. package/fesm2022/acorex-components-uploader.mjs +16 -16
  225. package/fesm2022/acorex-components-uploader.mjs.map +1 -1
  226. package/fesm2022/acorex-components-video-player.mjs +8 -8
  227. package/fesm2022/acorex-components-video-player.mjs.map +1 -1
  228. package/fesm2022/acorex-components-wysiwyg.mjs +42 -42
  229. package/fesm2022/acorex-components-wysiwyg.mjs.map +1 -1
  230. package/fesm2022/acorex-components.mjs.map +1 -1
  231. package/form/index.d.ts +2 -1
  232. package/grid-layout-builder/index.d.ts +1 -2
  233. package/kanban/index.d.ts +62 -4
  234. package/kbd/index.d.ts +13 -7
  235. package/loading/index.d.ts +1 -1
  236. package/loading-dialog/index.d.ts +31 -15
  237. package/media-viewer/index.d.ts +2 -1
  238. package/menu/index.d.ts +4 -0
  239. package/modal/index.d.ts +7 -0
  240. package/notification/index.d.ts +47 -32
  241. package/package.json +3 -3
  242. package/paint/index.d.ts +1 -6
  243. package/phone-box/index.d.ts +12 -7
  244. package/popover/index.d.ts +32 -30
  245. package/popup/index.d.ts +100 -27
  246. package/rate-picker/index.d.ts +5 -15
  247. package/side-menu/index.d.ts +9 -2
  248. package/slider/index.d.ts +2 -2
  249. package/time-duration/index.d.ts +0 -1
  250. package/toast/index.d.ts +24 -18
  251. package/tooltip/index.d.ts +4 -9
  252. package/tree-view/index.d.ts +11 -0
  253. package/tree-view-legacy/index.d.ts +1 -0
  254. package/fesm2022/acorex-components-modal-acorex-components-modal-CXXcFToK.mjs.map +0 -1
  255. package/fesm2022/acorex-components-modal-modal-content.component-B4rhHeEz.mjs.map +0 -1
@@ -2,144 +2,11 @@ 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, HostBinding, ViewEncapsulation, ChangeDetectionStrategy, Component, InjectionToken, NgModule, Injectable } from '@angular/core';
11
- import { GlobalPositionStrategy } from '@angular/cdk/overlay';
12
-
13
- /**
14
- * The Button is a component which detects user interaction and triggers a corresponding event
15
- *
16
- * @category Components
17
- */
18
- class AXNotificationComponent extends MXBaseComponent {
19
- constructor() {
20
- super(...arguments);
21
- this.config = inject(DIALOG_DATA);
22
- this.dialogRef = inject(DialogRef);
23
- this.isPaused = signal(false, ...(ngDevMode ? [{ debugName: "isPaused" }] : []));
24
- this.remainingTime = signal(0, ...(ngDevMode ? [{ debugName: "remainingTime" }] : []));
25
- this.transitionDuration = signal(150, ...(ngDevMode ? [{ debugName: "transitionDuration" }] : []));
26
- }
27
- ngOnInit() {
28
- super.ngOnInit();
29
- this._initContent();
30
- this._initIcon();
31
- this.remainingTime.set(this.config.timeOut);
32
- this._handleTimeOut();
33
- this.getHostElement().addEventListener('pointerenter', () => {
34
- if (!this.config.pauseOnHover)
35
- return;
36
- if (this.isPaused())
37
- return;
38
- // Only pause if not already paused
39
- this.isPaused.set(true);
40
- this.pauseAnimation();
41
- });
42
- this.getHostElement().addEventListener('pointerleave', () => {
43
- if (!this.config.pauseOnHover)
44
- return;
45
- if (!this.isPaused())
46
- return;
47
- // Only resume if paused
48
- this.isPaused.set(false);
49
- this._handleTimeOut();
50
- });
51
- }
52
- pauseAnimation() {
53
- clearInterval(this.intervalId);
54
- }
55
- _handleTimeOut() {
56
- if (this.config.timeOut) {
57
- this.intervalId = setInterval(() => {
58
- this.remainingTime.update((prev) => prev - this.transitionDuration());
59
- if (this.remainingTime() <= 0) {
60
- clearInterval(this.intervalId);
61
- this.close();
62
- }
63
- }, this.transitionDuration());
64
- }
65
- }
66
- /** @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
- _initIcon() {
77
- if (!this.config.icon) {
78
- switch (this.config.color) {
79
- case 'success':
80
- this._icon = 'ax-icon ax-icon-check-circle';
81
- break;
82
- case 'danger':
83
- this._icon = 'ax-icon ax-icon-error';
84
- break;
85
- case 'warning':
86
- this._icon = 'ax-icon ax-icon-warning';
87
- break;
88
- default:
89
- this._icon = this.config.icon || 'ax-icon ax-icon-info';
90
- break;
91
- }
92
- }
93
- else {
94
- this._icon = this.config.icon;
95
- }
96
- }
97
- /** @ignore */
98
- get _stringContent() {
99
- return typeof this.config.content === 'string' ? this.config.content : '';
100
- }
101
- /** @ignore */
102
- _handleButtonClick(button) {
103
- if (button.onClick) {
104
- button.onClick({ source: button });
105
- }
106
- }
107
- /** @ignore */
108
- get __hostClass() {
109
- return `ax-${this.config.color}`;
110
- }
111
- /**
112
- * Closes the dialog and provides the component and HTML element for reference.
113
- */
114
- close() {
115
- this.dialogRef.close({
116
- component: this,
117
- htmlElement: this.getHostElement(),
118
- });
119
- }
120
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXNotificationComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
121
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: AXNotificationComponent, isStandalone: true, selector: "ax-notification", host: { properties: { "class": "this.__hostClass" } }, providers: [
122
- { provide: AXClosableComponent, useExisting: AXNotificationComponent },
123
- { provide: AXComponent, useExisting: AXNotificationComponent },
124
- ], 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 (_selectedPortal) {\n <ng-template [cdkPortalOutlet]=\"_selectedPortal\"></ng-template>\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: 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 }); }
125
- }
126
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXNotificationComponent, decorators: [{
127
- type: Component,
128
- args: [{ selector: 'ax-notification', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
129
- { provide: AXClosableComponent, useExisting: AXNotificationComponent },
130
- { provide: AXComponent, useExisting: AXNotificationComponent },
131
- ], imports: [
132
- CdkPortalOutlet,
133
- AXButtonComponent,
134
- AXLoadingComponent,
135
- AXDecoratorCloseButtonComponent,
136
- AsyncPipe,
137
- AXTranslatorPipe,
138
- ], 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 (_selectedPortal) {\n <ng-template [cdkPortalOutlet]=\"_selectedPortal\"></ng-template>\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"] }]
139
- }], propDecorators: { __hostClass: [{
140
- type: HostBinding,
141
- args: ['class']
142
- }] } });
8
+ import { InjectionToken, inject, signal, Injectable, input, computed, TemplateRef, ViewEncapsulation, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
9
+ import { AXOverlayService } from '@acorex/cdk/overlay';
143
10
 
144
11
  const AX_NOTIFICATION_CONFIG = new InjectionToken('AX_NOTIFICATION_CONFIG', {
145
12
  providedIn: 'root',
@@ -162,42 +29,30 @@ function notificationConfig(config = {}) {
162
29
  return result;
163
30
  }
164
31
 
165
- class AXNotificationModule {
166
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXNotificationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
167
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.15", ngImport: i0, type: AXNotificationModule, imports: [AXNotificationComponent], exports: [AXNotificationComponent] }); }
168
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXNotificationModule, imports: [AXNotificationComponent] }); }
169
- }
170
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXNotificationModule, decorators: [{
171
- type: NgModule,
172
- args: [{
173
- imports: [AXNotificationComponent],
174
- exports: [AXNotificationComponent],
175
- }]
176
- }] });
177
-
32
+ let notificationIdCounter = 0;
178
33
  class AXNotificationService {
179
34
  constructor() {
180
- this.dialog = inject(Dialog);
35
+ this.overlayService = inject(AXOverlayService);
181
36
  this.translationService = inject(AXTranslationService);
182
37
  this.defaultConfig = inject(AX_NOTIFICATION_CONFIG);
183
- this.activeNotifications = [];
184
- this.reservedNotifications = [];
185
- this.notificationCounterElement = null;
186
- this.moreNotificationsColor = 'primary';
187
- this.moreNotificationsLocation = 'bottom-center';
188
- this.reserveCounter = 0;
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" }] : []));
189
44
  }
190
45
  show(config) {
191
46
  config = { ...this.defaultConfig, ...config };
192
- this.moreNotificationsColor = config.color;
193
- this.moreNotificationsLocation = config.location;
194
- if (this.defaultConfig.limit > 0 && this.activeNotifications.length >= this.defaultConfig.limit) {
47
+ this.moreNotificationsColor.set(config.color);
48
+ this.moreNotificationsLocation.set(config.location);
49
+ if (this.defaultConfig.limit > 0 && this.activeNotifications().length >= this.defaultConfig.limit) {
195
50
  const reservedRef = {
196
51
  close: () => {
197
52
  console.warn('Reserved notification cannot be closed until it is displayed.');
198
53
  },
199
54
  };
200
- this.reservedNotifications.push({ config, reservedRef });
55
+ this.reservedNotifications.update((prev) => [...prev, { config, reservedRef }]);
201
56
  this.handleReservedNotificationCounter();
202
57
  return reservedRef;
203
58
  }
@@ -205,164 +60,430 @@ class AXNotificationService {
205
60
  }
206
61
  displayNotification(config) {
207
62
  const gap = this.defaultConfig.gap;
208
- const pos = this.getPosition(config.location) + gap + 'px';
209
- const positionStrategy = this.getPositionStrategy(new GlobalPositionStrategy(), config.location, pos, gap);
210
- const dialogRef = this.dialog.open(AXNotificationComponent, {
211
- data: config,
212
- autoFocus: '__no_element__',
213
- restoreFocus: false,
214
- role: 'dialog',
215
- ariaModal: true,
216
- closeOnNavigation: true,
217
- closeOnDestroy: true,
218
- hasBackdrop: false,
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,
219
95
  panelClass: ['ax-animate-animated', 'ax-animate-fadeIn', 'ax-animate-faster'],
220
- positionStrategy,
221
- });
222
- this.activeNotifications.push(dialogRef.id);
223
- this.handleReservedNotificationCounter();
224
- const notificationRef = dialogRef.componentInstance;
225
- dialogRef.closed.subscribe(() => {
226
- this.activeNotifications = this.activeNotifications.filter((id) => id !== dialogRef.id);
227
- this.handleShowReservedNotification();
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]);
228
116
  this.handleReservedNotificationCounter();
229
- setTimeout(() => {
230
- this.reposition(config.location, gap);
231
- }, 0);
232
117
  });
233
118
  return {
234
119
  close: () => {
235
- notificationRef.close();
120
+ closeNotification();
236
121
  },
237
122
  };
238
123
  }
239
124
  hideAll() {
240
- this.dialog.closeAll();
241
- this.reserveCounter = 0;
242
- this.reservedNotifications = [];
243
- this.activeNotifications = [];
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
+ }
244
138
  this.handleReservedNotificationCounter();
245
139
  }
246
140
  handleShowReservedNotification() {
247
- if (this.activeNotifications.length > this.defaultConfig.limit - 1)
141
+ if (this.activeNotifications().length > this.defaultConfig.limit - 1)
248
142
  return;
249
- if (!this.reservedNotifications.length)
143
+ if (!this.reservedNotifications().length)
250
144
  return;
251
- const { config, reservedRef } = this.reservedNotifications.shift();
252
- const displayedRef = this.displayNotification(config);
145
+ const reserved = this.reservedNotifications()[0];
146
+ this.reservedNotifications.update((prev) => prev.slice(1));
147
+ const displayedRef = this.displayNotification(reserved.config);
253
148
  this.handleReservedNotificationCounter();
254
- reservedRef.close = displayedRef.close;
149
+ reserved.reservedRef.close = displayedRef.close;
255
150
  }
256
151
  handleReservedNotificationCounter() {
257
- const reservedCount = this.reservedNotifications.length;
258
- if (reservedCount === this.reserveCounter)
152
+ const reservedCount = this.reservedNotifications().length;
153
+ if (reservedCount === this.reserveCounter())
259
154
  return;
260
- this.reserveCounter = reservedCount;
261
- if (reservedCount === 0 && this.notificationCounterElement !== null) {
262
- this.notificationCounterElement.close();
155
+ this.reserveCounter.set(reservedCount);
156
+ if (reservedCount === 0 && this.notificationCounterRef() !== null) {
157
+ this.notificationCounterRef().close();
158
+ this.notificationCounterRef.set(null);
263
159
  return;
264
160
  }
265
161
  if (reservedCount > 0) {
266
- if (this.notificationCounterElement !== null) {
267
- this.notificationCounterElement.close();
162
+ if (this.notificationCounterRef() !== null) {
163
+ this.notificationCounterRef().close();
164
+ this.notificationCounterRef.set(null);
268
165
  }
269
- this.createReservedCounternotification();
166
+ this.createReservedCounterNotification();
270
167
  }
271
168
  }
272
- async createReservedCounternotification() {
169
+ async createReservedCounterNotification() {
170
+ const gap = this.defaultConfig.gap;
273
171
  const opt = {
274
172
  closeButton: false,
275
- color: this.moreNotificationsColor,
276
- location: this.moreNotificationsLocation,
173
+ color: this.moreNotificationsColor(),
174
+ location: this.moreNotificationsLocation(),
277
175
  title: await this.translationService.translateAsync('@acorex:common.notifications.more', {
278
- params: { number: this.reserveCounter },
176
+ params: { number: this.reserveCounter() },
279
177
  }),
280
178
  timeOutProgress: false,
281
179
  };
282
- const gap = this.defaultConfig.gap;
283
- const pos = this.getPosition(opt.location) + gap + 'px';
284
- const positionStrategy = this.getPositionStrategy(new GlobalPositionStrategy(), opt.location, pos, gap);
285
- const dialogRef = this.dialog.open(AXNotificationComponent, {
286
- data: opt,
287
- autoFocus: '__no_element__',
288
- restoreFocus: true,
289
- role: 'dialog',
290
- ariaModal: true,
291
- closeOnNavigation: true,
292
- closeOnDestroy: true,
293
- hasBackdrop: false,
180
+ const notificationId = `notification-counter-${++notificationIdCounter}`;
181
+ const overlayRef = await this.overlayService.create(AXNotificationComponent, {
182
+ inputs: {
183
+ config: opt,
184
+ onClose: () => {
185
+ const currentCounterRef = this.notificationCounterRef();
186
+ if (currentCounterRef) {
187
+ currentCounterRef.overlayRef.dispose();
188
+ if (currentCounterRef.id === notificationId) {
189
+ this.notificationCounterRef.set(null);
190
+ }
191
+ }
192
+ },
193
+ },
194
+ centered: false,
294
195
  panelClass: ['ax-animate-animated', 'ax-animate-fadeIn', 'ax-animate-faster'],
295
- positionStrategy,
296
- });
297
- this.notificationCounterElement = dialogRef.componentInstance;
298
- }
299
- reposition(notificationLocation, gap) {
300
- const list = this.dialog.openDialogs
301
- .map((c) => c.componentInstance)
302
- .filter((c) => c.config?.location == notificationLocation);
303
- list.forEach((element, index) => {
304
- const pos = this.getRepositionPosition(index, gap, list, notificationLocation);
305
- this.getPositionStrategy(element.dialogRef.config.positionStrategy, notificationLocation, pos, gap).apply();
306
196
  });
197
+ const counterInternalRef = {
198
+ id: notificationId,
199
+ overlayRef,
200
+ config: opt,
201
+ close: () => {
202
+ counterInternalRef.overlayRef.dispose();
203
+ if (this.notificationCounterRef()?.id === counterInternalRef.id) {
204
+ this.notificationCounterRef.set(null);
205
+ }
206
+ },
207
+ };
208
+ this.notificationCounterRef.set(counterInternalRef);
209
+ // Position the counter notification
210
+ this.positionNotification(overlayRef.overlayElement, opt.location, gap);
307
211
  }
308
- getRepositionPosition(index, gap, list, notificationLocation) {
309
- if (index === 0)
310
- return gap + 'px';
311
- const previouseElement = list[index - 1];
312
- if (notificationLocation.split('-')[0] == 'bottom') {
313
- return window.innerHeight - previouseElement.getHostElement().offsetTop + gap + 'px';
314
- }
315
- return previouseElement.getHostElement().offsetTop + previouseElement.getHostElement().offsetHeight + gap + 'px';
316
- }
317
- getPosition(location) {
318
- const list = this.dialog.openDialogs
319
- .map((c) => c.componentInstance)
320
- .filter((c) => c.config.location == location);
321
- if (list.length == 0)
322
- return 0;
323
- if (location.split('-')[0] == 'bottom') {
324
- return window.innerHeight - list[list.length - 1].getHostElement().offsetTop;
325
- }
326
- return list[list.length - 1].getHostElement().offsetTop + list[list.length - 1].getHostElement().offsetHeight;
327
- }
328
- getPositionStrategy(positionStrategy, location, pos, gap) {
212
+ positionNotification(element, location, gap) {
213
+ if (!element)
214
+ return;
215
+ const pos = this.getPosition(location) + gap;
216
+ // Override the centered overlay container styles for notification positioning
217
+ element.style.width = 'max-content';
218
+ element.style.height = 'auto';
219
+ element.style.display = 'block';
220
+ element.style.alignItems = '';
221
+ element.style.justifyContent = '';
222
+ // Reset all positioning styles
223
+ element.style.top = '';
224
+ element.style.bottom = '';
225
+ element.style.left = '';
226
+ element.style.right = '';
227
+ element.style.transform = '';
228
+ // Apply position based on location
329
229
  switch (location) {
330
230
  case 'bottom-center':
331
- return positionStrategy.bottom(pos).centerHorizontally();
231
+ element.style.bottom = pos + 'px';
232
+ element.style.left = '50%';
233
+ element.style.transform = 'translateX(-50%)';
332
234
  break;
333
235
  case 'bottom-end':
334
- return positionStrategy.bottom(pos).right(gap + 'px');
236
+ element.style.bottom = pos + 'px';
237
+ element.style.right = gap + 'px';
335
238
  break;
336
239
  case 'bottom-start':
337
- return positionStrategy.bottom(pos).left(gap + 'px');
240
+ element.style.bottom = pos + 'px';
241
+ element.style.left = gap + 'px';
338
242
  break;
339
243
  case 'top-center':
340
- return positionStrategy.top(pos).centerHorizontally();
244
+ element.style.top = pos + 'px';
245
+ element.style.left = '50%';
246
+ element.style.transform = 'translateX(-50%)';
341
247
  break;
342
248
  case 'top-end':
343
- return positionStrategy.top(pos).right(gap + 'px');
249
+ element.style.top = pos + 'px';
250
+ element.style.right = gap + 'px';
344
251
  break;
345
252
  case 'top-start':
346
- return positionStrategy.top(pos).left(gap + 'px');
253
+ element.style.top = pos + 'px';
254
+ element.style.left = gap + 'px';
347
255
  break;
348
256
  case 'center-start':
349
- return positionStrategy.centerVertically().left(gap + 'px');
257
+ element.style.top = '50%';
258
+ element.style.left = gap + 'px';
259
+ element.style.transform = 'translateY(-50%)';
350
260
  break;
351
261
  case 'center-end':
352
- return positionStrategy.centerVertically().right(gap + 'px');
262
+ element.style.top = '50%';
263
+ element.style.right = gap + 'px';
264
+ element.style.transform = 'translateY(-50%)';
353
265
  break;
354
266
  }
355
267
  }
356
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXNotificationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
357
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXNotificationService, providedIn: 'root' }); }
268
+ reposition(notificationLocation, gap) {
269
+ const list = this.activeNotifications().filter((n) => n.config?.location === notificationLocation);
270
+ list.forEach((notification, index) => {
271
+ const element = notification.overlayRef.overlayElement;
272
+ if (!element)
273
+ return;
274
+ const pos = this.getRepositionPosition(index, gap, list, notificationLocation);
275
+ this.applyRepositionPosition(element, notificationLocation, pos, gap);
276
+ });
277
+ }
278
+ getRepositionPosition(index, gap, list, notificationLocation) {
279
+ if (index === 0)
280
+ return gap;
281
+ const previousNotification = list[index - 1];
282
+ const previousElement = previousNotification.overlayRef.overlayElement;
283
+ if (!previousElement)
284
+ return gap;
285
+ if (notificationLocation.split('-')[0] === 'bottom') {
286
+ return window.innerHeight - previousElement.offsetTop + gap;
287
+ }
288
+ return previousElement.offsetTop + previousElement.offsetHeight + gap;
289
+ }
290
+ applyRepositionPosition(element, location, pos, gap) {
291
+ // Reset transform if needed, then apply position
292
+ const isVerticalCenter = location === 'center-start' || location === 'center-end';
293
+ const isHorizontalCenter = location === 'bottom-center' || location === 'top-center';
294
+ if (location.startsWith('bottom')) {
295
+ element.style.bottom = pos + 'px';
296
+ element.style.top = '';
297
+ if (isHorizontalCenter) {
298
+ element.style.transform = 'translateX(-50%)';
299
+ }
300
+ }
301
+ else if (location.startsWith('top')) {
302
+ element.style.top = pos + 'px';
303
+ element.style.bottom = '';
304
+ if (isHorizontalCenter) {
305
+ element.style.transform = 'translateX(-50%)';
306
+ }
307
+ }
308
+ else if (isVerticalCenter) {
309
+ element.style.top = pos + 'px';
310
+ element.style.bottom = '';
311
+ element.style.transform = '';
312
+ }
313
+ }
314
+ getPosition(location) {
315
+ const list = this.activeNotifications().filter((n) => n.config?.location === location);
316
+ if (list.length === 0)
317
+ return 0;
318
+ const lastNotification = list[list.length - 1];
319
+ const element = lastNotification.overlayRef.overlayElement;
320
+ if (!element)
321
+ return 0;
322
+ if (location.split('-')[0] === 'bottom') {
323
+ return window.innerHeight - element.offsetTop;
324
+ }
325
+ return element.offsetTop + element.offsetHeight;
326
+ }
327
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXNotificationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
328
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXNotificationService, providedIn: 'root' }); }
358
329
  }
359
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXNotificationService, decorators: [{
330
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXNotificationService, decorators: [{
360
331
  type: Injectable,
361
332
  args: [{
362
333
  providedIn: 'root',
363
334
  }]
364
335
  }] });
365
336
 
337
+ /**
338
+ * The Button is a component which detects user interaction and triggers a corresponding event
339
+ *
340
+ * @category Components
341
+ */
342
+ class AXNotificationComponent extends MXBaseComponent {
343
+ constructor() {
344
+ super(...arguments);
345
+ /** Notification configuration data */
346
+ this.config = input.required(...(ngDevMode ? [{ debugName: "config" }] : []));
347
+ /** @internal Callback function to close the notification */
348
+ this.onClose = input(...(ngDevMode ? [undefined, { debugName: "onClose" }] : []));
349
+ this.notificationService = inject(AXNotificationService);
350
+ this.isPaused = signal(false, ...(ngDevMode ? [{ debugName: "isPaused" }] : []));
351
+ this.remainingTime = signal(0, ...(ngDevMode ? [{ debugName: "remainingTime" }] : []));
352
+ this.transitionDuration = signal(150, ...(ngDevMode ? [{ debugName: "transitionDuration" }] : []));
353
+ /** Template content if config.content is a TemplateRef */
354
+ this.templateContent = computed(() => {
355
+ const content = this.config().content;
356
+ return content instanceof TemplateRef ? content : null;
357
+ }, ...(ngDevMode ? [{ debugName: "templateContent" }] : []));
358
+ /** Component content if config.content is a component Type */
359
+ this.componentContent = computed(() => {
360
+ const content = this.config().content;
361
+ return typeof content === 'function' ? content : null;
362
+ }, ...(ngDevMode ? [{ debugName: "componentContent" }] : []));
363
+ /** String content if config.content is a string */
364
+ this.stringContent = computed(() => {
365
+ const content = this.config().content;
366
+ return typeof content === 'string' ? content : '';
367
+ }, ...(ngDevMode ? [{ debugName: "stringContent" }] : []));
368
+ }
369
+ ngOnInit() {
370
+ super.ngOnInit();
371
+ this._initIcon();
372
+ this.remainingTime.set(this.config().timeOut);
373
+ this._handleTimeOut();
374
+ this.getHostElement().addEventListener('pointerenter', () => {
375
+ if (!this.config().pauseOnHover)
376
+ return;
377
+ if (this.isPaused())
378
+ return;
379
+ // Only pause if not already paused
380
+ this.isPaused.set(true);
381
+ this.pauseAnimation();
382
+ });
383
+ this.getHostElement().addEventListener('pointerleave', () => {
384
+ if (!this.config().pauseOnHover)
385
+ return;
386
+ if (!this.isPaused())
387
+ return;
388
+ // Only resume if paused
389
+ this.isPaused.set(false);
390
+ this._handleTimeOut();
391
+ });
392
+ }
393
+ pauseAnimation() {
394
+ clearInterval(this.intervalId);
395
+ }
396
+ _handleTimeOut() {
397
+ if (this.config().timeOut) {
398
+ this.intervalId = setInterval(() => {
399
+ this.remainingTime.update((prev) => prev - this.transitionDuration());
400
+ if (this.remainingTime() <= 0) {
401
+ clearInterval(this.intervalId);
402
+ this.close();
403
+ }
404
+ }, this.transitionDuration());
405
+ }
406
+ }
407
+ /** @ignore */
408
+ _initIcon() {
409
+ if (!this.config().icon) {
410
+ switch (this.config().color) {
411
+ case 'success':
412
+ this._icon = 'ax-icon ax-icon-check-circle';
413
+ break;
414
+ case 'danger':
415
+ this._icon = 'ax-icon ax-icon-error';
416
+ break;
417
+ case 'warning':
418
+ this._icon = 'ax-icon ax-icon-warning';
419
+ break;
420
+ default:
421
+ this._icon = this.config().icon || 'ax-icon ax-icon-info';
422
+ break;
423
+ }
424
+ }
425
+ else {
426
+ this._icon = this.config().icon;
427
+ }
428
+ }
429
+ /** @ignore */
430
+ _handleButtonClick(button) {
431
+ if (button.onClick) {
432
+ button.onClick({ source: button });
433
+ }
434
+ }
435
+ /**
436
+ * Closes the notification.
437
+ */
438
+ close() {
439
+ const closeCallback = this.onClose();
440
+ if (closeCallback) {
441
+ closeCallback();
442
+ }
443
+ }
444
+ /**
445
+ * Closes all notifications.
446
+ */
447
+ closeAll() {
448
+ this.notificationService.hideAll();
449
+ }
450
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXNotificationComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
451
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", 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: [
452
+ { provide: AXClosableComponent, useExisting: AXNotificationComponent },
453
+ { provide: AXComponent, useExisting: AXNotificationComponent },
454
+ ], 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 (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]=\"'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", 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 }); }
455
+ }
456
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXNotificationComponent, decorators: [{
457
+ type: Component,
458
+ args: [{ selector: 'ax-notification', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
459
+ '[class]': '"ax-" + config().color',
460
+ }, providers: [
461
+ { provide: AXClosableComponent, useExisting: AXNotificationComponent },
462
+ { provide: AXComponent, useExisting: AXNotificationComponent },
463
+ ], imports: [
464
+ NgTemplateOutlet,
465
+ NgComponentOutlet,
466
+ AXButtonComponent,
467
+ AXLoadingComponent,
468
+ AXDecoratorCloseButtonComponent,
469
+ AsyncPipe,
470
+ AXTranslatorPipe,
471
+ ], 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 (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]=\"'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" }]
472
+ }], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], onClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "onClose", required: false }] }] } });
473
+
474
+ class AXNotificationModule {
475
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXNotificationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
476
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: AXNotificationModule, imports: [AXNotificationComponent], exports: [AXNotificationComponent] }); }
477
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXNotificationModule, imports: [AXNotificationComponent] }); }
478
+ }
479
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXNotificationModule, decorators: [{
480
+ type: NgModule,
481
+ args: [{
482
+ imports: [AXNotificationComponent],
483
+ exports: [AXNotificationComponent],
484
+ }]
485
+ }] });
486
+
366
487
  /**
367
488
  * Generated bundle index. Do not edit.
368
489
  */