@sd-angular/core 19.0.0-beta.99 → 19.0.4

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 (412) hide show
  1. package/README.md +9 -11
  2. package/assets/images/coming-soon.svg +23 -0
  3. package/assets/images/data-empty.svg +21 -0
  4. package/assets/images/expired.svg +22 -0
  5. package/assets/images/file-error.svg +28 -0
  6. package/assets/images/filter-empty.svg +20 -0
  7. package/assets/images/filter-required.svg +21 -0
  8. package/assets/images/forbidden.svg +15 -0
  9. package/assets/images/image-error.svg +27 -0
  10. package/assets/images/maintenance.svg +23 -0
  11. package/assets/images/not-found.svg +20 -0
  12. package/assets/images/offline.svg +20 -0
  13. package/assets/images/submitted.svg +18 -0
  14. package/assets/images/success.svg +18 -0
  15. package/assets/images/unauthorized.svg +22 -0
  16. package/assets/images/unknown-error.svg +18 -0
  17. package/assets/scss/README.md +433 -353
  18. package/assets/scss/core/_inline-edit.scss +105 -0
  19. package/assets/scss/core/form.scss +58 -1
  20. package/assets/scss/core/image.scss +35 -0
  21. package/assets/scss/core/utilities/_base.scss +6 -6
  22. package/assets/scss/core/utilities/_grid.scss +4 -3
  23. package/assets/scss/core/utilities/_index.scss +1 -1
  24. package/assets/scss/core/utilities/_sizing.scss +2 -2
  25. package/assets/scss/sd-core.scss +1 -2
  26. package/components/autoid-inspector/src/autoid-inspector.component.d.ts +18 -0
  27. package/components/autoid-inspector/src/models/autoid-element.model.d.ts +45 -1
  28. package/components/autoid-inspector/src/models/autoid-export-format.model.d.ts +19 -0
  29. package/components/autoid-inspector/src/services/autoid-export.service.d.ts +10 -2
  30. package/components/autoid-inspector/src/services/autoid-scanner.service.d.ts +26 -3
  31. package/components/badge/src/badge.component.d.ts +20 -3
  32. package/components/button/src/button.component.d.ts +3 -3
  33. package/components/ckeditor-styles/index.d.ts +1 -0
  34. package/components/ckeditor-styles/src/ckeditor-styles.component.d.ts +25 -0
  35. package/components/form-generic/src/components/form-builder/form-builder.component.d.ts +13 -15
  36. package/components/form-generic/src/components/form-render/form-render.component.d.ts +1 -2
  37. package/components/form-generic/src/components/sd-feel-expression/sd-feel-expression.component.d.ts +1 -2
  38. package/components/form-generic/src/models/form-generic-component.model.d.ts +5 -6
  39. package/components/form-generic/src/models/form-generic-expression.model.d.ts +1 -1
  40. package/components/history/models/history.model.d.ts +2 -2
  41. package/components/index.d.ts +2 -0
  42. package/components/inform/index.d.ts +2 -0
  43. package/components/inform/src/inform-action.directive.d.ts +9 -0
  44. package/components/inform/src/inform.component.d.ts +59 -0
  45. package/components/modal/src/modal.component.d.ts +2 -1
  46. package/components/modal-resizable/index.d.ts +1 -0
  47. package/components/modal-resizable/src/modal-resizable.component.d.ts +29 -0
  48. package/components/operator/index.d.ts +1 -0
  49. package/components/operator/src/operator.component.d.ts +34 -0
  50. package/components/query-bar/index.d.ts +2 -0
  51. package/components/query-bar/src/components/actions-bar/actions-bar.component.d.ts +28 -0
  52. package/components/query-bar/src/components/build-chip/build-chip.component.d.ts +67 -0
  53. package/components/query-bar/src/components/chip-popover/chip-popover.component.d.ts +73 -0
  54. package/components/query-bar/src/components/field-picker/field-picker.component.d.ts +37 -0
  55. package/components/query-bar/src/components/inline-chip/inline-chip.component.d.ts +76 -0
  56. package/components/query-bar/src/components/inline-value-chip/inline-value-chip.component.d.ts +67 -0
  57. package/components/query-bar/src/components/popover-chip/popover-chip.component.d.ts +35 -0
  58. package/components/query-bar/src/components/saved-filters-menu/saved-filters-menu.component.d.ts +39 -0
  59. package/components/query-bar/src/query-bar.component.d.ts +137 -0
  60. package/components/query-bar/src/query-bar.model.d.ts +136 -0
  61. package/components/query-builder/index.d.ts +2 -0
  62. package/components/query-builder/src/query-builder.component.d.ts +98 -22
  63. package/components/query-builder/src/query-builder.model.d.ts +118 -0
  64. package/components/query-builder/src/query-builder.serializer.d.ts +32 -0
  65. package/components/section/src/section.component.d.ts +3 -3
  66. package/components/side-drawer/src/side-drawer.component.d.ts +1 -2
  67. package/components/stepper/index.d.ts +2 -0
  68. package/components/stepper/src/step.component.d.ts +17 -0
  69. package/components/stepper/src/stepper.component.d.ts +32 -0
  70. package/components/tab/index.d.ts +2 -0
  71. package/components/tab/src/tab-group.component.d.ts +36 -0
  72. package/components/tab/src/tab.component.d.ts +13 -0
  73. package/components/tab-router/src/decorators/tab.decorator.d.ts +2 -2
  74. package/components/tab-router/src/models/tab-router.model.d.ts +2 -2
  75. package/components/table/index.d.ts +1 -0
  76. package/components/table/src/components/column-title/column-title.component.d.ts +1 -1
  77. package/components/table/src/components/config/config.component.d.ts +3 -1
  78. package/components/table/src/components/desktop-cell/desktop-cell.component.d.ts +3 -3
  79. package/components/table/src/components/filter/column-filter/column-filter.component.d.ts +3 -7
  80. package/components/table/src/components/selector-action/selector-action.component.d.ts +3 -1
  81. package/components/table/src/configurations/table.configuration.d.ts +3 -3
  82. package/components/table/src/directives/index.d.ts +1 -0
  83. package/components/table/src/directives/sd-table-cell-def.directive.d.ts +12 -4
  84. package/components/table/src/directives/sd-table-column-filter-def.directive.d.ts +12 -4
  85. package/components/table/src/directives/sd-table-expand-def.directive.d.ts +10 -4
  86. package/components/table/src/directives/sd-table-filter-def.directive.d.ts +3 -3
  87. package/components/table/src/directives/sd-table-footer-def.directive.d.ts +12 -4
  88. package/components/table/src/directives/sd-table-group-def.directive.d.ts +44 -0
  89. package/components/table/src/directives/sd-table-title-def.directive.d.ts +10 -4
  90. package/components/table/src/models/index.d.ts +1 -0
  91. package/components/table/src/models/table-column.model.d.ts +13 -13
  92. package/components/table/src/models/table-command.model.d.ts +3 -2
  93. package/components/table/src/models/table-item.model.d.ts +19 -4
  94. package/components/table/src/models/table-option-export.model.d.ts +3 -3
  95. package/components/table/src/models/table-option-group.model.d.ts +19 -2
  96. package/components/table/src/models/table-option-selector.model.d.ts +17 -1
  97. package/components/table/src/models/table-option-tree.model.d.ts +96 -8
  98. package/components/table/src/models/table-option.model.d.ts +11 -2
  99. package/components/table/src/pipes/sd-group.pipe.d.ts +15 -1
  100. package/components/table/src/services/table-filter/table-filter.model.d.ts +9 -9
  101. package/components/table/src/services/table-filter/table-filter.service.d.ts +2 -2
  102. package/components/table/src/services/tree/tree.util.d.ts +43 -2
  103. package/components/table/src/table.component.d.ts +37 -13
  104. package/components/upload-file/src/upload-file.component.d.ts +2 -0
  105. package/components/view/src/view.component.d.ts +35 -1
  106. package/directives/src/sd-desktop.directive.d.ts +2 -4
  107. package/directives/src/sd-mobile.directive.d.ts +2 -4
  108. package/fesm2022/sd-angular-core-components-anchor.mjs +75 -49
  109. package/fesm2022/sd-angular-core-components-anchor.mjs.map +1 -1
  110. package/fesm2022/sd-angular-core-components-autoid-inspector.mjs +254 -29
  111. package/fesm2022/sd-angular-core-components-autoid-inspector.mjs.map +1 -1
  112. package/fesm2022/sd-angular-core-components-avatar.mjs +2 -2
  113. package/fesm2022/sd-angular-core-components-avatar.mjs.map +1 -1
  114. package/fesm2022/sd-angular-core-components-badge.mjs +18 -3
  115. package/fesm2022/sd-angular-core-components-badge.mjs.map +1 -1
  116. package/fesm2022/sd-angular-core-components-button.mjs +3 -5
  117. package/fesm2022/sd-angular-core-components-button.mjs.map +1 -1
  118. package/fesm2022/sd-angular-core-components-ckeditor-styles.mjs +38 -0
  119. package/fesm2022/sd-angular-core-components-ckeditor-styles.mjs.map +1 -0
  120. package/fesm2022/sd-angular-core-components-document-builder.mjs +10 -8
  121. package/fesm2022/sd-angular-core-components-document-builder.mjs.map +1 -1
  122. package/fesm2022/sd-angular-core-components-editor.mjs +3 -2
  123. package/fesm2022/sd-angular-core-components-editor.mjs.map +1 -1
  124. package/fesm2022/sd-angular-core-components-form-generic.mjs +153 -243
  125. package/fesm2022/sd-angular-core-components-form-generic.mjs.map +1 -1
  126. package/fesm2022/sd-angular-core-components-history.mjs +3 -2
  127. package/fesm2022/sd-angular-core-components-history.mjs.map +1 -1
  128. package/fesm2022/sd-angular-core-components-inform.mjs +190 -0
  129. package/fesm2022/sd-angular-core-components-inform.mjs.map +1 -0
  130. package/fesm2022/sd-angular-core-components-mini-editor.mjs +4 -3
  131. package/fesm2022/sd-angular-core-components-mini-editor.mjs.map +1 -1
  132. package/fesm2022/sd-angular-core-components-modal-resizable.mjs +158 -0
  133. package/fesm2022/sd-angular-core-components-modal-resizable.mjs.map +1 -0
  134. package/fesm2022/sd-angular-core-components-modal.mjs +2 -2
  135. package/fesm2022/sd-angular-core-components-modal.mjs.map +1 -1
  136. package/fesm2022/sd-angular-core-components-operator.mjs +77 -0
  137. package/fesm2022/sd-angular-core-components-operator.mjs.map +1 -0
  138. package/fesm2022/sd-angular-core-components-preview.mjs +4 -4
  139. package/fesm2022/sd-angular-core-components-preview.mjs.map +1 -1
  140. package/fesm2022/sd-angular-core-components-query-bar.mjs +1384 -0
  141. package/fesm2022/sd-angular-core-components-query-bar.mjs.map +1 -0
  142. package/fesm2022/sd-angular-core-components-query-builder.mjs +669 -57
  143. package/fesm2022/sd-angular-core-components-query-builder.mjs.map +1 -1
  144. package/fesm2022/sd-angular-core-components-quick-action.mjs +2 -2
  145. package/fesm2022/sd-angular-core-components-quick-action.mjs.map +1 -1
  146. package/fesm2022/sd-angular-core-components-section.mjs +2 -4
  147. package/fesm2022/sd-angular-core-components-section.mjs.map +1 -1
  148. package/fesm2022/sd-angular-core-components-side-drawer.mjs +3 -5
  149. package/fesm2022/sd-angular-core-components-side-drawer.mjs.map +1 -1
  150. package/fesm2022/sd-angular-core-components-splitter.mjs +5 -2
  151. package/fesm2022/sd-angular-core-components-splitter.mjs.map +1 -1
  152. package/fesm2022/sd-angular-core-components-stepper.mjs +138 -0
  153. package/fesm2022/sd-angular-core-components-stepper.mjs.map +1 -0
  154. package/fesm2022/sd-angular-core-components-tab-router.mjs +3 -3
  155. package/fesm2022/sd-angular-core-components-tab-router.mjs.map +1 -1
  156. package/fesm2022/sd-angular-core-components-tab.mjs +143 -0
  157. package/fesm2022/sd-angular-core-components-tab.mjs.map +1 -0
  158. package/fesm2022/sd-angular-core-components-table.mjs +577 -225
  159. package/fesm2022/sd-angular-core-components-table.mjs.map +1 -1
  160. package/fesm2022/sd-angular-core-components-upload-file.mjs +36 -25
  161. package/fesm2022/sd-angular-core-components-upload-file.mjs.map +1 -1
  162. package/fesm2022/sd-angular-core-components-view.mjs +44 -9
  163. package/fesm2022/sd-angular-core-components-view.mjs.map +1 -1
  164. package/fesm2022/sd-angular-core-components.mjs +2 -0
  165. package/fesm2022/sd-angular-core-components.mjs.map +1 -1
  166. package/fesm2022/sd-angular-core-directives.mjs +19 -21
  167. package/fesm2022/sd-angular-core-directives.mjs.map +1 -1
  168. package/fesm2022/sd-angular-core-forms-autocomplete.mjs +45 -16
  169. package/fesm2022/sd-angular-core-forms-autocomplete.mjs.map +1 -1
  170. package/fesm2022/sd-angular-core-forms-checkbox.mjs +97 -87
  171. package/fesm2022/sd-angular-core-forms-checkbox.mjs.map +1 -1
  172. package/fesm2022/sd-angular-core-forms-chip-calendar.mjs +92 -61
  173. package/fesm2022/sd-angular-core-forms-chip-calendar.mjs.map +1 -1
  174. package/fesm2022/sd-angular-core-forms-chip.mjs +89 -52
  175. package/fesm2022/sd-angular-core-forms-chip.mjs.map +1 -1
  176. package/fesm2022/sd-angular-core-forms-date-range.mjs +63 -10
  177. package/fesm2022/sd-angular-core-forms-date-range.mjs.map +1 -1
  178. package/fesm2022/sd-angular-core-forms-date.mjs +39 -15
  179. package/fesm2022/sd-angular-core-forms-date.mjs.map +1 -1
  180. package/fesm2022/sd-angular-core-forms-datetime.mjs +33 -14
  181. package/fesm2022/sd-angular-core-forms-datetime.mjs.map +1 -1
  182. package/fesm2022/sd-angular-core-forms-directives.mjs +18 -24
  183. package/fesm2022/sd-angular-core-forms-directives.mjs.map +1 -1
  184. package/fesm2022/sd-angular-core-forms-inline-text.mjs +167 -0
  185. package/fesm2022/sd-angular-core-forms-inline-text.mjs.map +1 -0
  186. package/fesm2022/sd-angular-core-forms-input-color.mjs +119 -0
  187. package/fesm2022/sd-angular-core-forms-input-color.mjs.map +1 -0
  188. package/fesm2022/sd-angular-core-forms-input-number.mjs +73 -15
  189. package/fesm2022/sd-angular-core-forms-input-number.mjs.map +1 -1
  190. package/fesm2022/sd-angular-core-forms-input.mjs +86 -29
  191. package/fesm2022/sd-angular-core-forms-input.mjs.map +1 -1
  192. package/fesm2022/sd-angular-core-forms-models.mjs +44 -2
  193. package/fesm2022/sd-angular-core-forms-models.mjs.map +1 -1
  194. package/fesm2022/sd-angular-core-forms-radio.mjs +130 -175
  195. package/fesm2022/sd-angular-core-forms-radio.mjs.map +1 -1
  196. package/fesm2022/sd-angular-core-forms-select.mjs +66 -23
  197. package/fesm2022/sd-angular-core-forms-select.mjs.map +1 -1
  198. package/fesm2022/sd-angular-core-forms-switch.mjs +95 -98
  199. package/fesm2022/sd-angular-core-forms-switch.mjs.map +1 -1
  200. package/fesm2022/sd-angular-core-forms-textarea.mjs +33 -12
  201. package/fesm2022/sd-angular-core-forms-textarea.mjs.map +1 -1
  202. package/fesm2022/sd-angular-core-i18n.mjs +65 -0
  203. package/fesm2022/sd-angular-core-i18n.mjs.map +1 -1
  204. package/fesm2022/sd-angular-core-modules-auth.mjs +4 -4
  205. package/fesm2022/sd-angular-core-modules-auth.mjs.map +1 -1
  206. package/fesm2022/sd-angular-core-modules-authom.mjs +1 -1
  207. package/fesm2022/sd-angular-core-modules-authom.mjs.map +1 -1
  208. package/fesm2022/sd-angular-core-modules-layout.mjs +23 -23
  209. package/fesm2022/sd-angular-core-modules-layout.mjs.map +1 -1
  210. package/fesm2022/sd-angular-core-modules-permission.mjs +3 -3
  211. package/fesm2022/sd-angular-core-modules-permission.mjs.map +1 -1
  212. package/fesm2022/sd-angular-core-pipes.mjs +2 -2
  213. package/fesm2022/sd-angular-core-pipes.mjs.map +1 -1
  214. package/fesm2022/sd-angular-core-services-api.mjs +3 -3
  215. package/fesm2022/sd-angular-core-services-api.mjs.map +1 -1
  216. package/fesm2022/sd-angular-core-services-cache.mjs +3 -2
  217. package/fesm2022/sd-angular-core-services-cache.mjs.map +1 -1
  218. package/fesm2022/sd-angular-core-services-confirm.mjs +1 -1
  219. package/fesm2022/sd-angular-core-services-confirm.mjs.map +1 -1
  220. package/fesm2022/sd-angular-core-services-excel.mjs +6 -5
  221. package/fesm2022/sd-angular-core-services-excel.mjs.map +1 -1
  222. package/fesm2022/sd-angular-core-services-notify.mjs +43 -12
  223. package/fesm2022/sd-angular-core-services-notify.mjs.map +1 -1
  224. package/fesm2022/sd-angular-core-services-storage.mjs +2 -2
  225. package/fesm2022/sd-angular-core-services-storage.mjs.map +1 -1
  226. package/fesm2022/sd-angular-core-utilities-models.mjs.map +1 -1
  227. package/forms/autocomplete/src/autocomplete.component.d.ts +24 -10
  228. package/forms/checkbox/src/checkbox.component.d.ts +21 -20
  229. package/forms/chip/src/chip.component.d.ts +25 -20
  230. package/forms/chip-calendar/src/chip-calendar.component.d.ts +27 -22
  231. package/forms/date/src/date.component.d.ts +23 -9
  232. package/forms/date-range/src/date-range.component.d.ts +28 -5
  233. package/forms/datetime/src/datetime.component.d.ts +21 -8
  234. package/forms/directives/src/item-def.directive.d.ts +10 -5
  235. package/forms/directives/src/label-def.directive.d.ts +3 -2
  236. package/forms/directives/src/suffix-def.directive.d.ts +3 -2
  237. package/forms/directives/src/view-def.directive.d.ts +9 -9
  238. package/forms/inline-text/index.d.ts +1 -0
  239. package/forms/inline-text/src/inline-text.component.d.ts +76 -0
  240. package/forms/input/src/input.component.d.ts +31 -13
  241. package/forms/input-color/index.d.ts +1 -0
  242. package/forms/input-color/src/input-color.component.d.ts +34 -0
  243. package/forms/input-number/src/input-number.component.d.ts +25 -9
  244. package/forms/models/index.d.ts +1 -0
  245. package/forms/models/src/sd-custom-validator.model.d.ts +13 -1
  246. package/forms/models/src/sd-viewed.d.ts +38 -0
  247. package/forms/radio/src/radio.component.d.ts +37 -38
  248. package/forms/select/src/select.component.d.ts +36 -14
  249. package/forms/switch/src/switch.component.d.ts +22 -23
  250. package/forms/textarea/src/textarea.component.d.ts +18 -8
  251. package/i18n/src/en.d.ts +11 -0
  252. package/modules/auth/configurations/auth.configuration.d.ts +4 -4
  253. package/modules/layout/configurations/layout.configuration.d.ts +3 -3
  254. package/modules/permission/src/configurations/permission.configuration.d.ts +3 -3
  255. package/package.json +77 -41
  256. package/sd-angular-core-19.0.4.tgz +0 -0
  257. package/services/confirm/src/lib/components/dialog-confirm/dialog-confirm.component.d.ts +3 -3
  258. package/services/confirm/src/lib/confirm.service.d.ts +9 -9
  259. package/services/notify/src/components/toast/toast.component.d.ts +16 -1
  260. package/services/notify/src/notify.model.d.ts +17 -0
  261. package/utilities/models/src/icon.model.d.ts +1 -1
  262. package/assets/scss/bootstrap-4.6.2/_alert.scss +0 -52
  263. package/assets/scss/bootstrap-4.6.2/_badge.scss +0 -54
  264. package/assets/scss/bootstrap-4.6.2/_breadcrumb.scss +0 -42
  265. package/assets/scss/bootstrap-4.6.2/_button-group.scss +0 -163
  266. package/assets/scss/bootstrap-4.6.2/_buttons.scss +0 -142
  267. package/assets/scss/bootstrap-4.6.2/_card.scss +0 -286
  268. package/assets/scss/bootstrap-4.6.2/_carousel.scss +0 -200
  269. package/assets/scss/bootstrap-4.6.2/_close.scss +0 -40
  270. package/assets/scss/bootstrap-4.6.2/_code.scss +0 -48
  271. package/assets/scss/bootstrap-4.6.2/_custom-forms.scss +0 -526
  272. package/assets/scss/bootstrap-4.6.2/_dropdown.scss +0 -192
  273. package/assets/scss/bootstrap-4.6.2/_forms.scss +0 -347
  274. package/assets/scss/bootstrap-4.6.2/_functions.scss +0 -190
  275. package/assets/scss/bootstrap-4.6.2/_grid.scss +0 -73
  276. package/assets/scss/bootstrap-4.6.2/_images.scss +0 -42
  277. package/assets/scss/bootstrap-4.6.2/_input-group.scss +0 -211
  278. package/assets/scss/bootstrap-4.6.2/_jumbotron.scss +0 -17
  279. package/assets/scss/bootstrap-4.6.2/_list-group.scss +0 -154
  280. package/assets/scss/bootstrap-4.6.2/_media.scss +0 -8
  281. package/assets/scss/bootstrap-4.6.2/_mixins.scss +0 -47
  282. package/assets/scss/bootstrap-4.6.2/_modal.scss +0 -240
  283. package/assets/scss/bootstrap-4.6.2/_nav.scss +0 -125
  284. package/assets/scss/bootstrap-4.6.2/_navbar.scss +0 -332
  285. package/assets/scss/bootstrap-4.6.2/_pagination.scss +0 -74
  286. package/assets/scss/bootstrap-4.6.2/_popover.scss +0 -170
  287. package/assets/scss/bootstrap-4.6.2/_print.scss +0 -132
  288. package/assets/scss/bootstrap-4.6.2/_progress.scss +0 -47
  289. package/assets/scss/bootstrap-4.6.2/_reboot.scss +0 -484
  290. package/assets/scss/bootstrap-4.6.2/_root.scss +0 -19
  291. package/assets/scss/bootstrap-4.6.2/_spinners.scss +0 -65
  292. package/assets/scss/bootstrap-4.6.2/_tables.scss +0 -185
  293. package/assets/scss/bootstrap-4.6.2/_toasts.scss +0 -46
  294. package/assets/scss/bootstrap-4.6.2/_tooltip.scss +0 -115
  295. package/assets/scss/bootstrap-4.6.2/_transitions.scss +0 -26
  296. package/assets/scss/bootstrap-4.6.2/_type.scss +0 -125
  297. package/assets/scss/bootstrap-4.6.2/_utilities.scss +0 -18
  298. package/assets/scss/bootstrap-4.6.2/_variables.scss +0 -1150
  299. package/assets/scss/bootstrap-4.6.2/bootstrap-grid.scss +0 -30
  300. package/assets/scss/bootstrap-4.6.2/bootstrap-reboot.scss +0 -12
  301. package/assets/scss/bootstrap-4.6.2/bootstrap.scss +0 -44
  302. package/assets/scss/bootstrap-4.6.2/mixins/_alert.scss +0 -13
  303. package/assets/scss/bootstrap-4.6.2/mixins/_background-variant.scss +0 -23
  304. package/assets/scss/bootstrap-4.6.2/mixins/_badge.scss +0 -17
  305. package/assets/scss/bootstrap-4.6.2/mixins/_border-radius.scss +0 -76
  306. package/assets/scss/bootstrap-4.6.2/mixins/_box-shadow.scss +0 -20
  307. package/assets/scss/bootstrap-4.6.2/mixins/_breakpoints.scss +0 -123
  308. package/assets/scss/bootstrap-4.6.2/mixins/_buttons.scss +0 -110
  309. package/assets/scss/bootstrap-4.6.2/mixins/_caret.scss +0 -62
  310. package/assets/scss/bootstrap-4.6.2/mixins/_clearfix.scss +0 -7
  311. package/assets/scss/bootstrap-4.6.2/mixins/_deprecate.scss +0 -10
  312. package/assets/scss/bootstrap-4.6.2/mixins/_float.scss +0 -14
  313. package/assets/scss/bootstrap-4.6.2/mixins/_forms.scss +0 -195
  314. package/assets/scss/bootstrap-4.6.2/mixins/_gradients.scss +0 -45
  315. package/assets/scss/bootstrap-4.6.2/mixins/_grid-framework.scss +0 -80
  316. package/assets/scss/bootstrap-4.6.2/mixins/_grid.scss +0 -69
  317. package/assets/scss/bootstrap-4.6.2/mixins/_hover.scss +0 -37
  318. package/assets/scss/bootstrap-4.6.2/mixins/_image.scss +0 -36
  319. package/assets/scss/bootstrap-4.6.2/mixins/_list-group.scss +0 -21
  320. package/assets/scss/bootstrap-4.6.2/mixins/_lists.scss +0 -7
  321. package/assets/scss/bootstrap-4.6.2/mixins/_nav-divider.scss +0 -11
  322. package/assets/scss/bootstrap-4.6.2/mixins/_pagination.scss +0 -22
  323. package/assets/scss/bootstrap-4.6.2/mixins/_reset-text.scss +0 -17
  324. package/assets/scss/bootstrap-4.6.2/mixins/_resize.scss +0 -6
  325. package/assets/scss/bootstrap-4.6.2/mixins/_screen-reader.scss +0 -34
  326. package/assets/scss/bootstrap-4.6.2/mixins/_size.scss +0 -7
  327. package/assets/scss/bootstrap-4.6.2/mixins/_table-row.scss +0 -39
  328. package/assets/scss/bootstrap-4.6.2/mixins/_text-emphasis.scss +0 -17
  329. package/assets/scss/bootstrap-4.6.2/mixins/_text-hide.scss +0 -11
  330. package/assets/scss/bootstrap-4.6.2/mixins/_text-truncate.scss +0 -8
  331. package/assets/scss/bootstrap-4.6.2/mixins/_transition.scss +0 -26
  332. package/assets/scss/bootstrap-4.6.2/mixins/_visibility.scss +0 -8
  333. package/assets/scss/bootstrap-4.6.2/utilities/_align.scss +0 -8
  334. package/assets/scss/bootstrap-4.6.2/utilities/_background.scss +0 -19
  335. package/assets/scss/bootstrap-4.6.2/utilities/_borders.scss +0 -75
  336. package/assets/scss/bootstrap-4.6.2/utilities/_clearfix.scss +0 -3
  337. package/assets/scss/bootstrap-4.6.2/utilities/_display.scss +0 -26
  338. package/assets/scss/bootstrap-4.6.2/utilities/_embed.scss +0 -39
  339. package/assets/scss/bootstrap-4.6.2/utilities/_flex.scss +0 -51
  340. package/assets/scss/bootstrap-4.6.2/utilities/_float.scss +0 -11
  341. package/assets/scss/bootstrap-4.6.2/utilities/_interactions.scss +0 -5
  342. package/assets/scss/bootstrap-4.6.2/utilities/_overflow.scss +0 -5
  343. package/assets/scss/bootstrap-4.6.2/utilities/_position.scss +0 -32
  344. package/assets/scss/bootstrap-4.6.2/utilities/_screenreaders.scss +0 -11
  345. package/assets/scss/bootstrap-4.6.2/utilities/_shadows.scss +0 -6
  346. package/assets/scss/bootstrap-4.6.2/utilities/_sizing.scss +0 -20
  347. package/assets/scss/bootstrap-4.6.2/utilities/_spacing.scss +0 -73
  348. package/assets/scss/bootstrap-4.6.2/utilities/_stretched-link.scss +0 -19
  349. package/assets/scss/bootstrap-4.6.2/utilities/_text.scss +0 -72
  350. package/assets/scss/bootstrap-4.6.2/utilities/_visibility.scss +0 -13
  351. package/assets/scss/bootstrap-4.6.2/vendor/_rfs.scss +0 -228
  352. package/assets/scss/core/bootstrap.scss +0 -13
  353. package/components/table/index.d.ts.map +0 -1
  354. package/components/table/sd-angular-core-components-table.d.ts.map +0 -1
  355. package/components/table/src/components/column-title/column-title.component.d.ts.map +0 -1
  356. package/components/table/src/components/command/desktop-command.component.d.ts.map +0 -1
  357. package/components/table/src/components/command/pipes/command.pipe.d.ts.map +0 -1
  358. package/components/table/src/components/command/pipes/filter.pipe.d.ts.map +0 -1
  359. package/components/table/src/components/config/config.component.d.ts.map +0 -1
  360. package/components/table/src/components/desktop-cell/desktop-cell.component.d.ts.map +0 -1
  361. package/components/table/src/components/desktop-cell/view/view.component.d.ts.map +0 -1
  362. package/components/table/src/components/filter/column-filter/column-filter.component.d.ts.map +0 -1
  363. package/components/table/src/components/filter/external-filter/external-filter.component.d.ts.map +0 -1
  364. package/components/table/src/components/filter/index.d.ts.map +0 -1
  365. package/components/table/src/components/filter/mobile-filter/mobile-filter.component.d.ts.map +0 -1
  366. package/components/table/src/components/index.d.ts.map +0 -1
  367. package/components/table/src/components/popup-export/popup-export.component.d.ts.map +0 -1
  368. package/components/table/src/components/selector-action/action-filter.pipe.d.ts.map +0 -1
  369. package/components/table/src/components/selector-action/selector-action.component.d.ts.map +0 -1
  370. package/components/table/src/configurations/index.d.ts.map +0 -1
  371. package/components/table/src/configurations/table.configuration.d.ts.map +0 -1
  372. package/components/table/src/directives/index.d.ts.map +0 -1
  373. package/components/table/src/directives/sd-column-resize.directive.d.ts.map +0 -1
  374. package/components/table/src/directives/sd-table-cell-def.directive.d.ts.map +0 -1
  375. package/components/table/src/directives/sd-table-column-filter-def.directive.d.ts.map +0 -1
  376. package/components/table/src/directives/sd-table-expand-def.directive.d.ts.map +0 -1
  377. package/components/table/src/directives/sd-table-filter-def.directive.d.ts.map +0 -1
  378. package/components/table/src/directives/sd-table-footer-def.directive.d.ts.map +0 -1
  379. package/components/table/src/directives/sd-table-title-def.directive.d.ts.map +0 -1
  380. package/components/table/src/directives/sticky-shadow.directive.d.ts.map +0 -1
  381. package/components/table/src/models/index.d.ts.map +0 -1
  382. package/components/table/src/models/table-column.model.d.ts.map +0 -1
  383. package/components/table/src/models/table-command.model.d.ts.map +0 -1
  384. package/components/table/src/models/table-item.model.d.ts.map +0 -1
  385. package/components/table/src/models/table-option-config.model.d.ts.map +0 -1
  386. package/components/table/src/models/table-option-expand.model.d.ts.map +0 -1
  387. package/components/table/src/models/table-option-export.model.d.ts.map +0 -1
  388. package/components/table/src/models/table-option-group.model.d.ts.map +0 -1
  389. package/components/table/src/models/table-option-paginate.model.d.ts.map +0 -1
  390. package/components/table/src/models/table-option-reload.model.d.ts.map +0 -1
  391. package/components/table/src/models/table-option-selector.model.d.ts.map +0 -1
  392. package/components/table/src/models/table-option-sort.model.d.ts.map +0 -1
  393. package/components/table/src/models/table-option-style.model.d.ts.map +0 -1
  394. package/components/table/src/models/table-option-tree.model.d.ts.map +0 -1
  395. package/components/table/src/models/table-option.model.d.ts.map +0 -1
  396. package/components/table/src/pipes/filter-values.pipe.d.ts.map +0 -1
  397. package/components/table/src/pipes/index.d.ts.map +0 -1
  398. package/components/table/src/pipes/sd-group.pipe.d.ts.map +0 -1
  399. package/components/table/src/pipes/sd-tree.pipe.d.ts.map +0 -1
  400. package/components/table/src/pipes/selection-disabled.pipe.d.ts.map +0 -1
  401. package/components/table/src/pipes/selection-visible-select-all.pipe.d.ts.map +0 -1
  402. package/components/table/src/pipes/selection-visible.pipe.d.ts.map +0 -1
  403. package/components/table/src/services/column-width.util.d.ts.map +0 -1
  404. package/components/table/src/services/config.service.d.ts.map +0 -1
  405. package/components/table/src/services/index.d.ts.map +0 -1
  406. package/components/table/src/services/table-export/table-export.service.d.ts.map +0 -1
  407. package/components/table/src/services/table-filter/table-filter.model.d.ts.map +0 -1
  408. package/components/table/src/services/table-filter/table-filter.service.d.ts.map +0 -1
  409. package/components/table/src/services/table-format/table-format.service.d.ts.map +0 -1
  410. package/components/table/src/services/tree/tree.util.d.ts.map +0 -1
  411. package/components/table/src/table.component.d.ts.map +0 -1
  412. package/sd-angular-core-19.0.0-beta.99.tgz +0 -0
@@ -1,6 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, Injectable } from '@angular/core';
3
- import { SdUtilities, DateUtilities } from '@sd-angular/core/utilities/extensions';
3
+ import { DateUtilities } from '@sd-angular/core/utilities/extensions';
4
+ import { BrowserUtilities } from '@sdcorejs/utils/fns';
4
5
  import { I18nService } from '@sd-angular/core/i18n';
5
6
 
6
7
  class SdExcelService {
@@ -194,7 +195,7 @@ class SdExcelService {
194
195
  }
195
196
  }
196
197
  const file = await workbook.xlsx.writeBuffer();
197
- SdUtilities.downloadBlob(new Blob([file], {
198
+ BrowserUtilities.downloadBlob(new Blob([file], {
198
199
  type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
199
200
  }), fileName);
200
201
  };
@@ -214,7 +215,7 @@ class SdExcelService {
214
215
  // Prepend UTF-8 BOM () để Excel mở đúng encoding cho tiếng Việt có dấu.
215
216
  // Dùng CRLF vì Excel trên Windows ưu tiên, macOS Excel cũng chấp nhận.
216
217
  const csv = '' + [headerLine, ...dataLines].join('\r\n');
217
- SdUtilities.downloadBlob(new Blob([csv], { type: 'text/csv;charset=utf-8;' }), filename);
218
+ BrowserUtilities.downloadBlob(new Blob([csv], { type: 'text/csv;charset=utf-8;' }), filename);
218
219
  };
219
220
  export = async (option) => {
220
221
  const { columns, items, fileName, sheets } = option;
@@ -290,7 +291,7 @@ class SdExcelService {
290
291
  });
291
292
  });
292
293
  const file = await workbook.xlsx.writeBuffer();
293
- SdUtilities.downloadBlob(new Blob([file], {
294
+ BrowserUtilities.downloadBlob(new Blob([file], {
294
295
  type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
295
296
  }), fileName);
296
297
  };
@@ -314,7 +315,7 @@ class SdExcelService {
314
315
  };
315
316
  upload = async () => {
316
317
  try {
317
- const fileResult = await SdUtilities.upload({
318
+ const fileResult = await BrowserUtilities.upload({
318
319
  extensions: ['xlsx'],
319
320
  maxSizeInMb: 10,
320
321
  });
@@ -1 +1 @@
1
- {"version":3,"file":"sd-angular-core-services-excel.mjs","sources":["../../../projects/sd-angular/services/excel/src/lib/excel.service.ts","../../../projects/sd-angular/services/excel/sd-angular-core-services-excel.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\r\nimport type { CellValue, Style } from 'exceljs';\r\n// import hash from 'object-hash';\r\nimport { DateUtilities, SdUtilities } from '@sd-angular/core/utilities/extensions';\r\nimport { I18nService } from '@sd-angular/core/i18n';\r\nimport { SdExcelExportOption, SdExcelTemplate } from './excel.model';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class SdExcelService {\r\n readonly #i18n = inject(I18nService);\r\n #fieldStyle: Partial<Style> = {\r\n border: {\r\n bottom: { style: 'thin' },\r\n left: { style: 'thin' },\r\n right: { style: 'thin' },\r\n },\r\n alignment: {\r\n vertical: 'middle',\r\n horizontal: 'center',\r\n wrapText: true,\r\n },\r\n font: {\r\n bold: true,\r\n size: 11,\r\n color: { argb: '000000' },\r\n },\r\n fill: {\r\n type: 'pattern',\r\n pattern: 'solid',\r\n fgColor: {\r\n argb: 'FAFAFA',\r\n },\r\n },\r\n };\r\n #titleColor = 'FFFFFF';\r\n #titleFgColor = '143180';\r\n #titleStyle: Partial<Style> = {\r\n border: {\r\n bottom: { style: 'thin' },\r\n left: { style: 'thin' },\r\n right: { style: 'thin' },\r\n },\r\n alignment: {\r\n vertical: 'middle',\r\n horizontal: 'center',\r\n wrapText: true,\r\n },\r\n font: {\r\n bold: true,\r\n size: 11,\r\n color: { argb: this.#titleColor },\r\n },\r\n fill: {\r\n type: 'pattern',\r\n pattern: 'solid',\r\n fgColor: {\r\n argb: this.#titleFgColor,\r\n },\r\n },\r\n };\r\n\r\n #requiredStyle: Partial<Style> = {\r\n border: {\r\n bottom: { style: 'thin' },\r\n left: { style: 'thin' },\r\n right: { style: 'thin' },\r\n },\r\n alignment: {\r\n vertical: 'middle',\r\n horizontal: 'center',\r\n wrapText: true,\r\n },\r\n font: {\r\n italic: true,\r\n size: 11,\r\n color: { argb: 'FFFFFF' },\r\n },\r\n fill: {\r\n type: 'pattern',\r\n pattern: 'solid',\r\n fgColor: {\r\n argb: 'FF1744',\r\n },\r\n },\r\n };\r\n\r\n #descriptionStyle: Partial<Style> = {\r\n border: {\r\n bottom: { style: 'thin' },\r\n left: { style: 'thin' },\r\n right: { style: 'thin' },\r\n },\r\n alignment: {\r\n wrapText: true,\r\n },\r\n font: {\r\n italic: true,\r\n size: 9,\r\n color: { argb: '000000' },\r\n },\r\n fill: {\r\n type: 'pattern',\r\n pattern: 'solid',\r\n fgColor: {\r\n argb: 'CFD8DC',\r\n },\r\n },\r\n };\r\n\r\n #cellStyle: Partial<Style> = {\r\n alignment: {\r\n vertical: 'middle',\r\n wrapText: true,\r\n },\r\n };\r\n\r\n constructor() {}\r\n\r\n // exceljs là CJS module — khi dynamic import từ ESM, named export `Workbook`\r\n // có thể nằm trên `mod.Workbook` hoặc bị bọc trong `mod.default.Workbook` tuỳ bundler.\r\n // Helper này chuẩn hoá cả hai trường hợp.\r\n async #loadWorkbook(): Promise<new () => import('exceljs').Workbook> {\r\n const mod: any = await import('exceljs');\r\n return mod.Workbook ?? mod.default?.Workbook;\r\n }\r\n\r\n generateTemplate = async (template: SdExcelTemplate) => {\r\n const { fileName, columns, sheets } = template;\r\n if (!Array.isArray(columns)) {\r\n throw new Error('Excel template columns must be an array');\r\n }\r\n for (const [idx, column] of columns.entries()) {\r\n if (!column.field) {\r\n throw new Error(`Column ${idx + 1}: Field is required`);\r\n }\r\n if (!column.title) {\r\n throw new Error(`Column ${idx + 1}: Title is required`);\r\n }\r\n }\r\n const hasDescription = columns.some(column => column.description);\r\n const Workbook = await this.#loadWorkbook();\r\n const workbook = new Workbook();\r\n const firstSheet = workbook.addWorksheet('template'); // Lấy ra sheet đầu tiên\r\n columns.forEach((column, index) => {\r\n const { required, fill, fontColor } = column;\r\n const cellField = firstSheet.getCell(1, index + 1);\r\n const cellTitle = firstSheet.getCell(2, index + 1);\r\n const cellDescription = firstSheet.getCell(3, index + 1);\r\n let width = 120;\r\n if (column.width && column.width.endsWith('px')) {\r\n width = +column.width.replace('px', '');\r\n }\r\n firstSheet.getColumn(index + 1).width = width / 7 || 20;\r\n cellField.style = this.#fieldStyle;\r\n if (required) {\r\n cellField.style = this.#requiredStyle;\r\n } else {\r\n cellField.style = this.#fieldStyle;\r\n }\r\n cellTitle.style = {\r\n ...this.#titleStyle,\r\n font: {\r\n ...this.#titleStyle?.font,\r\n color: {\r\n ...this.#titleStyle?.font?.color,\r\n argb: fontColor || this.#titleStyle?.font?.color?.argb,\r\n },\r\n },\r\n fill: {\r\n type: 'pattern',\r\n pattern: 'solid',\r\n fgColor: {\r\n argb: fill || this.#titleFgColor,\r\n },\r\n },\r\n };\r\n cellField.value = column.field;\r\n cellTitle.value = column.title;\r\n if (hasDescription) {\r\n cellDescription.style = this.#descriptionStyle;\r\n cellDescription.value = column.description || '';\r\n }\r\n });\r\n if (sheets?.length) {\r\n for (const sheet of sheets) {\r\n if (sheet.name && Array.isArray(sheet.items) && Array.isArray(sheet.headers)) {\r\n const newSheet = workbook.addWorksheet(sheet.name);\r\n sheet.headers.forEach((header, index) => {\r\n newSheet.getColumn(index + 1).width = 30;\r\n newSheet.getCell(1, index + 1).style = this.#titleStyle;\r\n newSheet.getCell(1, index + 1).value = header.value;\r\n newSheet.getCell(2, index + 1).style = this.#titleStyle;\r\n newSheet.getCell(2, index + 1).value = header.display || header.value;\r\n });\r\n sheet.items.forEach((item, idx1) => {\r\n sheet.headers.forEach((header, idx2) => {\r\n newSheet.getCell(3 + idx1, 1 + idx2).value = item[header.value];\r\n newSheet.getCell(3 + idx1, 1 + idx2).style = this.#cellStyle;\r\n });\r\n });\r\n }\r\n }\r\n }\r\n const file = await workbook.xlsx.writeBuffer();\r\n SdUtilities.downloadBlob(\r\n new Blob([file], {\r\n type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\r\n }),\r\n fileName\r\n );\r\n };\r\n\r\n exportCSV = async (option: SdExcelExportOption): Promise<void> => {\r\n const { columns, items, fileName } = option;\r\n const filename = `${fileName || 'CSV'}_${DateUtilities.toFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss')}.csv`;\r\n\r\n // Escape CSV cell: bọc trong dấu \" nếu chứa dấu phẩy / xuống dòng / dấu ngoặc kép.\r\n // Dấu \" bên trong được nhân đôi theo chuẩn RFC 4180.\r\n const escape = (v: unknown): string => {\r\n if (v == null) return '';\r\n const s = String(v);\r\n return /[\",\\n\\r]/.test(s) ? `\"${s.replace(/\"/g, '\"\"')}\"` : s;\r\n };\r\n\r\n const headerLine = columns.map(c => escape(c.title)).join(',');\r\n const dataLines = items.map(item =>\r\n columns.map(c => escape((item as Record<string, unknown>)[c.field])).join(','),\r\n );\r\n\r\n // Prepend UTF-8 BOM () để Excel mở đúng encoding cho tiếng Việt có dấu.\r\n // Dùng CRLF vì Excel trên Windows ưu tiên, macOS Excel cũng chấp nhận.\r\n const csv = '' + [headerLine, ...dataLines].join('\\r\\n');\r\n\r\n SdUtilities.downloadBlob(\r\n new Blob([csv], { type: 'text/csv;charset=utf-8;' }),\r\n filename,\r\n );\r\n };\r\n\r\n export = async (option: SdExcelExportOption) => {\r\n const { columns, items, fileName, sheets } = option;\r\n let hasDescription = false;\r\n for (const [idx, column] of columns.entries()) {\r\n if (!column.field) {\r\n throw new Error(`Column ${idx + 1}: Field is required`);\r\n }\r\n if (!column.title) {\r\n throw new Error(`Column ${idx + 1}: Title is required`);\r\n }\r\n if (column.description) {\r\n hasDescription = true;\r\n }\r\n }\r\n const Workbook = await this.#loadWorkbook();\r\n const workbook = new Workbook(); //await XlsxPopulate.fromBlankAsync(); // Đọc file sau khi đã download\r\n const firstSheet = workbook.addWorksheet('data'); // Lấy ra sheet đầu tiên\r\n columns.forEach((column, index) => {\r\n let width = 120;\r\n if (column.width && column.width.endsWith('px')) {\r\n width = +column.width.replace('px', '');\r\n }\r\n firstSheet.getColumn(index + 1).width = width / 7 || 20;\r\n firstSheet.getCell(1, index + 1).style = this.#fieldStyle;\r\n if (column.required) {\r\n firstSheet.getCell(2, index + 1).style = this.#requiredStyle;\r\n } else {\r\n firstSheet.getCell(2, index + 1).style = this.#titleStyle;\r\n }\r\n firstSheet.getCell(1, index + 1).value = column.field;\r\n firstSheet.getCell(2, index + 1).value = column.title;\r\n if (hasDescription) {\r\n firstSheet.getCell(3, index + 1).style = this.#descriptionStyle;\r\n firstSheet.getCell(3, index + 1).value = column.description || '';\r\n }\r\n });\r\n if (sheets?.length) {\r\n for (const sheet of sheets) {\r\n if (sheet.name && Array.isArray(sheet.items) && Array.isArray(sheet.headers)) {\r\n const newSheet = workbook.addWorksheet(sheet.name);\r\n sheet.headers.forEach((header, index) => {\r\n newSheet.getColumn(index + 1).width = 30;\r\n newSheet.getCell(1, index + 1).style = this.#titleStyle;\r\n newSheet.getCell(1, index + 1).value = header.value;\r\n newSheet.getCell(2, index + 1).style = this.#titleStyle;\r\n newSheet.getCell(2, index + 1).value = header.display || header.value;\r\n });\r\n sheet.items.forEach((item, idx1) => {\r\n sheet.headers.forEach((header, idx2) => {\r\n newSheet.getCell(3 + idx1, 1 + idx2).value = item[header.value];\r\n newSheet.getCell(3 + idx1, 1 + idx2).style = this.#cellStyle;\r\n });\r\n });\r\n }\r\n }\r\n }\r\n\r\n const fromRow = hasDescription ? 4 : 3;\r\n items.forEach((e, idx1) => {\r\n columns.forEach((column, idx2) => {\r\n if (typeof e[column.field] === 'number') {\r\n // Format mặc định với kiểu số\r\n firstSheet.getCell(fromRow + idx1, 1 + idx2).value = +e[column.field];\r\n firstSheet.getCell(fromRow + idx1, 1 + idx2).numFmt = '#';\r\n } else {\r\n firstSheet.getCell(fromRow + idx1, 1 + idx2).value = e[column.field];\r\n }\r\n firstSheet.getCell(fromRow + idx1, 1 + idx2).style = {\r\n ...this.#cellStyle,\r\n };\r\n });\r\n });\r\n const file = await workbook.xlsx.writeBuffer();\r\n SdUtilities.downloadBlob(\r\n new Blob([file], {\r\n type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\r\n }),\r\n fileName\r\n );\r\n };\r\n\r\n // Helper để lấy giá trị text chuẩn từ ô Excel (xử lý RichText, Formula, Hyperlink)\r\n #getCellValue = (value: CellValue): string | number | null | undefined | boolean | Date => {\r\n if (value && typeof value === 'object') {\r\n // Xử lý Rich Text (vd: ô bôi đậm)\r\n if ('richText' in value) {\r\n return value.richText.map(t => t.text).join('');\r\n }\r\n // Xử lý Hyperlink\r\n if ('text' in value) {\r\n return value.text as string; // hoặc value.result nếu là công thức\r\n }\r\n // Xử lý Formula\r\n if ('result' in value) {\r\n return value.result as any;\r\n }\r\n }\r\n return value as any;\r\n };\r\n upload = async (): Promise<{ items: Record<string, any>[]; file: File | null }> => {\r\n try {\r\n const fileResult = await SdUtilities.upload({\r\n extensions: ['xlsx'],\r\n maxSizeInMb: 10,\r\n });\r\n\r\n // Chuẩn hóa file đầu vào (nếu upload trả về mảng thì lấy phần tử đầu)\r\n const file = Array.isArray(fileResult) ? fileResult[0] : fileResult;\r\n\r\n if (!file) {\r\n return { items: [], file: null };\r\n }\r\n\r\n return await this.parse(file);\r\n } catch (error) {\r\n console.error('Upload error:', error);\r\n throw error; // Hoặc return { items: [], file: null } tùy logic nghiệp vụ\r\n }\r\n };\r\n parse = async (file: File): Promise<{ items: Record<string, any>[]; file: File | null }> => {\r\n return new Promise((resolve, reject) => {\r\n const reader = new FileReader();\r\n reader.onload = async e => {\r\n try {\r\n const buffer = e.target?.result as ArrayBuffer;\r\n if (!buffer) {\r\n throw new Error(this.#i18n.t('core.excel.cannot-read-file'));\r\n }\r\n\r\n const Workbook = await this.#loadWorkbook();\r\n const wb = new Workbook();\r\n await wb.xlsx.load(buffer);\r\n\r\n const sheet = wb.worksheets[0];\r\n if (!sheet) {\r\n throw new Error(this.#i18n.t('core.excel.no-sheet'));\r\n }\r\n\r\n const items: Record<string, any>[] = [];\r\n\r\n // Lấy row Header (Row 1)\r\n const headerRow = sheet.getRow(1);\r\n // Map: Column Index (bắt đầu từ 1) -> Tên trường (Key)\r\n const headerMap: Record<number, string> = {};\r\n\r\n // Duyệt qua các ô có dữ liệu thực tế của dòng Header\r\n headerRow.eachCell((cell, colNumber) => {\r\n const cellValue = this.#getCellValue(cell.value);\r\n if (cellValue) {\r\n // Ép kiểu về string và trim để làm key\r\n headerMap[colNumber] = String(cellValue).trim();\r\n }\r\n });\r\n\r\n // Duyệt dữ liệu từ dòng 2 trở đi\r\n sheet.eachRow((row, rowIndex) => {\r\n if (rowIndex <= 1 || !row.hasValues) return;\r\n\r\n const item: Record<string, any> = {};\r\n\r\n // Chỉ duyệt qua các cột đã định nghĩa trong headerMap\r\n // Cách này an toàn hơn là duyệt mảng values\r\n Object.keys(headerMap).forEach(colKey => {\r\n const colNumber = Number(colKey);\r\n const fieldKey = headerMap[colNumber];\r\n\r\n // Lấy giá trị ô tại cột tương ứng\r\n const rawValue = this.#getCellValue(row.getCell(colNumber).value);\r\n\r\n let finalValue = rawValue;\r\n\r\n // Xử lý string: trim\r\n if (typeof finalValue === 'string') {\r\n finalValue = finalValue.trim();\r\n }\r\n\r\n // Xử lý các keyword đặc biệt\r\n if (finalValue === '' || finalValue === undefined) {\r\n finalValue = null;\r\n } else if (finalValue === 'SET_NULL') {\r\n finalValue = null;\r\n } else if (finalValue === 'SET_EMPTY') {\r\n finalValue = '';\r\n }\r\n\r\n item[fieldKey] = finalValue;\r\n });\r\n\r\n // Chỉ push nếu item có dữ liệu (tùy chọn)\r\n if (Object.keys(item).length > 0) {\r\n items.push(item);\r\n }\r\n });\r\n\r\n resolve({ items, file });\r\n } catch (err) {\r\n reject(err);\r\n }\r\n };\r\n\r\n reader.onerror = error => reject(error);\r\n reader.readAsArrayBuffer(file);\r\n });\r\n };\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAUa,cAAc,CAAA;AAChB,IAAA,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC;AACpC,IAAA,WAAW,GAAmB;AAC5B,QAAA,MAAM,EAAE;AACN,YAAA,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;AACzB,YAAA,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;AACvB,YAAA,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;AACzB,SAAA;AACD,QAAA,SAAS,EAAE;AACT,YAAA,QAAQ,EAAE,QAAQ;AAClB,YAAA,UAAU,EAAE,QAAQ;AACpB,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;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,IAAI,CAAC,IAAI,CAAC;wBAClB;AACF,oBAAA,CAAC,CAAC;AAEF,oBAAA,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;gBAC1B;gBAAE,OAAO,GAAG,EAAE;oBACZ,MAAM,CAAC,GAAG,CAAC;gBACb;AACF,YAAA,CAAC;YAED,MAAM,CAAC,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC;AACvC,YAAA,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC;AAChC,QAAA,CAAC,CAAC;AACJ,IAAA,CAAC;wGAlbU,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAd,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,cAFb,MAAM,EAAA,CAAA;;4FAEP,cAAc,EAAA,UAAA,EAAA,CAAA;kBAH1B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACTD;;AAEG;;;;"}
1
+ {"version":3,"file":"sd-angular-core-services-excel.mjs","sources":["../../../projects/sd-angular/services/excel/src/lib/excel.service.ts","../../../projects/sd-angular/services/excel/sd-angular-core-services-excel.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\r\nimport type { CellValue, Style } from 'exceljs';\r\n// import hash from 'object-hash';\r\nimport { DateUtilities } from '@sd-angular/core/utilities/extensions';\r\nimport { BrowserUtilities } from '@sdcorejs/utils/fns';\r\nimport { I18nService } from '@sd-angular/core/i18n';\r\nimport { SdExcelExportOption, SdExcelTemplate } from './excel.model';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class SdExcelService {\r\n readonly #i18n = inject(I18nService);\r\n #fieldStyle: Partial<Style> = {\r\n border: {\r\n bottom: { style: 'thin' },\r\n left: { style: 'thin' },\r\n right: { style: 'thin' },\r\n },\r\n alignment: {\r\n vertical: 'middle',\r\n horizontal: 'center',\r\n wrapText: true,\r\n },\r\n font: {\r\n bold: true,\r\n size: 11,\r\n color: { argb: '000000' },\r\n },\r\n fill: {\r\n type: 'pattern',\r\n pattern: 'solid',\r\n fgColor: {\r\n argb: 'FAFAFA',\r\n },\r\n },\r\n };\r\n #titleColor = 'FFFFFF';\r\n #titleFgColor = '143180';\r\n #titleStyle: Partial<Style> = {\r\n border: {\r\n bottom: { style: 'thin' },\r\n left: { style: 'thin' },\r\n right: { style: 'thin' },\r\n },\r\n alignment: {\r\n vertical: 'middle',\r\n horizontal: 'center',\r\n wrapText: true,\r\n },\r\n font: {\r\n bold: true,\r\n size: 11,\r\n color: { argb: this.#titleColor },\r\n },\r\n fill: {\r\n type: 'pattern',\r\n pattern: 'solid',\r\n fgColor: {\r\n argb: this.#titleFgColor,\r\n },\r\n },\r\n };\r\n\r\n #requiredStyle: Partial<Style> = {\r\n border: {\r\n bottom: { style: 'thin' },\r\n left: { style: 'thin' },\r\n right: { style: 'thin' },\r\n },\r\n alignment: {\r\n vertical: 'middle',\r\n horizontal: 'center',\r\n wrapText: true,\r\n },\r\n font: {\r\n italic: true,\r\n size: 11,\r\n color: { argb: 'FFFFFF' },\r\n },\r\n fill: {\r\n type: 'pattern',\r\n pattern: 'solid',\r\n fgColor: {\r\n argb: 'FF1744',\r\n },\r\n },\r\n };\r\n\r\n #descriptionStyle: Partial<Style> = {\r\n border: {\r\n bottom: { style: 'thin' },\r\n left: { style: 'thin' },\r\n right: { style: 'thin' },\r\n },\r\n alignment: {\r\n wrapText: true,\r\n },\r\n font: {\r\n italic: true,\r\n size: 9,\r\n color: { argb: '000000' },\r\n },\r\n fill: {\r\n type: 'pattern',\r\n pattern: 'solid',\r\n fgColor: {\r\n argb: 'CFD8DC',\r\n },\r\n },\r\n };\r\n\r\n #cellStyle: Partial<Style> = {\r\n alignment: {\r\n vertical: 'middle',\r\n wrapText: true,\r\n },\r\n };\r\n\r\n constructor() {}\r\n\r\n // exceljs là CJS module — khi dynamic import từ ESM, named export `Workbook`\r\n // có thể nằm trên `mod.Workbook` hoặc bị bọc trong `mod.default.Workbook` tuỳ bundler.\r\n // Helper này chuẩn hoá cả hai trường hợp.\r\n async #loadWorkbook(): Promise<new () => import('exceljs').Workbook> {\r\n const mod: any = await import('exceljs');\r\n return mod.Workbook ?? mod.default?.Workbook;\r\n }\r\n\r\n generateTemplate = async (template: SdExcelTemplate) => {\r\n const { fileName, columns, sheets } = template;\r\n if (!Array.isArray(columns)) {\r\n throw new Error('Excel template columns must be an array');\r\n }\r\n for (const [idx, column] of columns.entries()) {\r\n if (!column.field) {\r\n throw new Error(`Column ${idx + 1}: Field is required`);\r\n }\r\n if (!column.title) {\r\n throw new Error(`Column ${idx + 1}: Title is required`);\r\n }\r\n }\r\n const hasDescription = columns.some(column => column.description);\r\n const Workbook = await this.#loadWorkbook();\r\n const workbook = new Workbook();\r\n const firstSheet = workbook.addWorksheet('template'); // Lấy ra sheet đầu tiên\r\n columns.forEach((column, index) => {\r\n const { required, fill, fontColor } = column;\r\n const cellField = firstSheet.getCell(1, index + 1);\r\n const cellTitle = firstSheet.getCell(2, index + 1);\r\n const cellDescription = firstSheet.getCell(3, index + 1);\r\n let width = 120;\r\n if (column.width && column.width.endsWith('px')) {\r\n width = +column.width.replace('px', '');\r\n }\r\n firstSheet.getColumn(index + 1).width = width / 7 || 20;\r\n cellField.style = this.#fieldStyle;\r\n if (required) {\r\n cellField.style = this.#requiredStyle;\r\n } else {\r\n cellField.style = this.#fieldStyle;\r\n }\r\n cellTitle.style = {\r\n ...this.#titleStyle,\r\n font: {\r\n ...this.#titleStyle?.font,\r\n color: {\r\n ...this.#titleStyle?.font?.color,\r\n argb: fontColor || this.#titleStyle?.font?.color?.argb,\r\n },\r\n },\r\n fill: {\r\n type: 'pattern',\r\n pattern: 'solid',\r\n fgColor: {\r\n argb: fill || this.#titleFgColor,\r\n },\r\n },\r\n };\r\n cellField.value = column.field;\r\n cellTitle.value = column.title;\r\n if (hasDescription) {\r\n cellDescription.style = this.#descriptionStyle;\r\n cellDescription.value = column.description || '';\r\n }\r\n });\r\n if (sheets?.length) {\r\n for (const sheet of sheets) {\r\n if (sheet.name && Array.isArray(sheet.items) && Array.isArray(sheet.headers)) {\r\n const newSheet = workbook.addWorksheet(sheet.name);\r\n sheet.headers.forEach((header, index) => {\r\n newSheet.getColumn(index + 1).width = 30;\r\n newSheet.getCell(1, index + 1).style = this.#titleStyle;\r\n newSheet.getCell(1, index + 1).value = header.value;\r\n newSheet.getCell(2, index + 1).style = this.#titleStyle;\r\n newSheet.getCell(2, index + 1).value = header.display || header.value;\r\n });\r\n sheet.items.forEach((item, idx1) => {\r\n sheet.headers.forEach((header, idx2) => {\r\n newSheet.getCell(3 + idx1, 1 + idx2).value = item[header.value];\r\n newSheet.getCell(3 + idx1, 1 + idx2).style = this.#cellStyle;\r\n });\r\n });\r\n }\r\n }\r\n }\r\n const file = await workbook.xlsx.writeBuffer();\r\n BrowserUtilities.downloadBlob(\r\n new Blob([file], {\r\n type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\r\n }),\r\n fileName\r\n );\r\n };\r\n\r\n exportCSV = async (option: SdExcelExportOption): Promise<void> => {\r\n const { columns, items, fileName } = option;\r\n const filename = `${fileName || 'CSV'}_${DateUtilities.toFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss')}.csv`;\r\n\r\n // Escape CSV cell: bọc trong dấu \" nếu chứa dấu phẩy / xuống dòng / dấu ngoặc kép.\r\n // Dấu \" bên trong được nhân đôi theo chuẩn RFC 4180.\r\n const escape = (v: unknown): string => {\r\n if (v == null) return '';\r\n const s = String(v);\r\n return /[\",\\n\\r]/.test(s) ? `\"${s.replace(/\"/g, '\"\"')}\"` : s;\r\n };\r\n\r\n const headerLine = columns.map(c => escape(c.title)).join(',');\r\n const dataLines = items.map(item =>\r\n columns.map(c => escape((item as Record<string, unknown>)[c.field])).join(','),\r\n );\r\n\r\n // Prepend UTF-8 BOM () để Excel mở đúng encoding cho tiếng Việt có dấu.\r\n // Dùng CRLF vì Excel trên Windows ưu tiên, macOS Excel cũng chấp nhận.\r\n const csv = '' + [headerLine, ...dataLines].join('\\r\\n');\r\n\r\n BrowserUtilities.downloadBlob(\r\n new Blob([csv], { type: 'text/csv;charset=utf-8;' }),\r\n filename,\r\n );\r\n };\r\n\r\n export = async (option: SdExcelExportOption) => {\r\n const { columns, items, fileName, sheets } = option;\r\n let hasDescription = false;\r\n for (const [idx, column] of columns.entries()) {\r\n if (!column.field) {\r\n throw new Error(`Column ${idx + 1}: Field is required`);\r\n }\r\n if (!column.title) {\r\n throw new Error(`Column ${idx + 1}: Title is required`);\r\n }\r\n if (column.description) {\r\n hasDescription = true;\r\n }\r\n }\r\n const Workbook = await this.#loadWorkbook();\r\n const workbook = new Workbook(); //await XlsxPopulate.fromBlankAsync(); // Đọc file sau khi đã download\r\n const firstSheet = workbook.addWorksheet('data'); // Lấy ra sheet đầu tiên\r\n columns.forEach((column, index) => {\r\n let width = 120;\r\n if (column.width && column.width.endsWith('px')) {\r\n width = +column.width.replace('px', '');\r\n }\r\n firstSheet.getColumn(index + 1).width = width / 7 || 20;\r\n firstSheet.getCell(1, index + 1).style = this.#fieldStyle;\r\n if (column.required) {\r\n firstSheet.getCell(2, index + 1).style = this.#requiredStyle;\r\n } else {\r\n firstSheet.getCell(2, index + 1).style = this.#titleStyle;\r\n }\r\n firstSheet.getCell(1, index + 1).value = column.field;\r\n firstSheet.getCell(2, index + 1).value = column.title;\r\n if (hasDescription) {\r\n firstSheet.getCell(3, index + 1).style = this.#descriptionStyle;\r\n firstSheet.getCell(3, index + 1).value = column.description || '';\r\n }\r\n });\r\n if (sheets?.length) {\r\n for (const sheet of sheets) {\r\n if (sheet.name && Array.isArray(sheet.items) && Array.isArray(sheet.headers)) {\r\n const newSheet = workbook.addWorksheet(sheet.name);\r\n sheet.headers.forEach((header, index) => {\r\n newSheet.getColumn(index + 1).width = 30;\r\n newSheet.getCell(1, index + 1).style = this.#titleStyle;\r\n newSheet.getCell(1, index + 1).value = header.value;\r\n newSheet.getCell(2, index + 1).style = this.#titleStyle;\r\n newSheet.getCell(2, index + 1).value = header.display || header.value;\r\n });\r\n sheet.items.forEach((item, idx1) => {\r\n sheet.headers.forEach((header, idx2) => {\r\n newSheet.getCell(3 + idx1, 1 + idx2).value = item[header.value];\r\n newSheet.getCell(3 + idx1, 1 + idx2).style = this.#cellStyle;\r\n });\r\n });\r\n }\r\n }\r\n }\r\n\r\n const fromRow = hasDescription ? 4 : 3;\r\n items.forEach((e, idx1) => {\r\n columns.forEach((column, idx2) => {\r\n if (typeof e[column.field] === 'number') {\r\n // Format mặc định với kiểu số\r\n firstSheet.getCell(fromRow + idx1, 1 + idx2).value = +e[column.field];\r\n firstSheet.getCell(fromRow + idx1, 1 + idx2).numFmt = '#';\r\n } else {\r\n firstSheet.getCell(fromRow + idx1, 1 + idx2).value = e[column.field];\r\n }\r\n firstSheet.getCell(fromRow + idx1, 1 + idx2).style = {\r\n ...this.#cellStyle,\r\n };\r\n });\r\n });\r\n const file = await workbook.xlsx.writeBuffer();\r\n BrowserUtilities.downloadBlob(\r\n new Blob([file], {\r\n type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\r\n }),\r\n fileName\r\n );\r\n };\r\n\r\n // Helper để lấy giá trị text chuẩn từ ô Excel (xử lý RichText, Formula, Hyperlink)\r\n #getCellValue = (value: CellValue): string | number | null | undefined | boolean | Date => {\r\n if (value && typeof value === 'object') {\r\n // Xử lý Rich Text (vd: ô bôi đậm)\r\n if ('richText' in value) {\r\n return value.richText.map(t => t.text).join('');\r\n }\r\n // Xử lý Hyperlink\r\n if ('text' in value) {\r\n return value.text as string; // hoặc value.result nếu là công thức\r\n }\r\n // Xử lý Formula\r\n if ('result' in value) {\r\n return value.result as any;\r\n }\r\n }\r\n return value as any;\r\n };\r\n upload = async (): Promise<{ items: Record<string, any>[]; file: File | null }> => {\r\n try {\r\n const fileResult = await BrowserUtilities.upload({\r\n extensions: ['xlsx'],\r\n maxSizeInMb: 10,\r\n });\r\n\r\n // Chuẩn hóa file đầu vào (nếu upload trả về mảng thì lấy phần tử đầu)\r\n const file = Array.isArray(fileResult) ? fileResult[0] : fileResult;\r\n\r\n if (!file) {\r\n return { items: [], file: null };\r\n }\r\n\r\n return await this.parse(file);\r\n } catch (error) {\r\n console.error('Upload error:', error);\r\n throw error; // Hoặc return { items: [], file: null } tùy logic nghiệp vụ\r\n }\r\n };\r\n parse = async (file: File): Promise<{ items: Record<string, any>[]; file: File | null }> => {\r\n return new Promise((resolve, reject) => {\r\n const reader = new FileReader();\r\n reader.onload = async e => {\r\n try {\r\n const buffer = e.target?.result as ArrayBuffer;\r\n if (!buffer) {\r\n throw new Error(this.#i18n.t('core.excel.cannot-read-file'));\r\n }\r\n\r\n const Workbook = await this.#loadWorkbook();\r\n const wb = new Workbook();\r\n await wb.xlsx.load(buffer);\r\n\r\n const sheet = wb.worksheets[0];\r\n if (!sheet) {\r\n throw new Error(this.#i18n.t('core.excel.no-sheet'));\r\n }\r\n\r\n const items: Record<string, any>[] = [];\r\n\r\n // Lấy row Header (Row 1)\r\n const headerRow = sheet.getRow(1);\r\n // Map: Column Index (bắt đầu từ 1) -> Tên trường (Key)\r\n const headerMap: Record<number, string> = {};\r\n\r\n // Duyệt qua các ô có dữ liệu thực tế của dòng Header\r\n headerRow.eachCell((cell, colNumber) => {\r\n const cellValue = this.#getCellValue(cell.value);\r\n if (cellValue) {\r\n // Ép kiểu về string và trim để làm key\r\n headerMap[colNumber] = String(cellValue).trim();\r\n }\r\n });\r\n\r\n // Duyệt dữ liệu từ dòng 2 trở đi\r\n sheet.eachRow((row, rowIndex) => {\r\n if (rowIndex <= 1 || !row.hasValues) return;\r\n\r\n const item: Record<string, any> = {};\r\n\r\n // Chỉ duyệt qua các cột đã định nghĩa trong headerMap\r\n // Cách này an toàn hơn là duyệt mảng values\r\n Object.keys(headerMap).forEach(colKey => {\r\n const colNumber = Number(colKey);\r\n const fieldKey = headerMap[colNumber];\r\n\r\n // Lấy giá trị ô tại cột tương ứng\r\n const rawValue = this.#getCellValue(row.getCell(colNumber).value);\r\n\r\n let finalValue = rawValue;\r\n\r\n // Xử lý string: trim\r\n if (typeof finalValue === 'string') {\r\n finalValue = finalValue.trim();\r\n }\r\n\r\n // Xử lý các keyword đặc biệt\r\n if (finalValue === '' || finalValue === undefined) {\r\n finalValue = null;\r\n } else if (finalValue === 'SET_NULL') {\r\n finalValue = null;\r\n } else if (finalValue === 'SET_EMPTY') {\r\n finalValue = '';\r\n }\r\n\r\n item[fieldKey] = finalValue;\r\n });\r\n\r\n // Chỉ push nếu item có dữ liệu (tùy chọn)\r\n if (Object.keys(item).length > 0) {\r\n items.push(item);\r\n }\r\n });\r\n\r\n resolve({ items, file });\r\n } catch (err) {\r\n reject(err);\r\n }\r\n };\r\n\r\n reader.onerror = error => reject(error);\r\n reader.readAsArrayBuffer(file);\r\n });\r\n };\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAWa,cAAc,CAAA;AAChB,IAAA,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC;AACpC,IAAA,WAAW,GAAmB;AAC5B,QAAA,MAAM,EAAE;AACN,YAAA,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;AACzB,YAAA,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;AACvB,YAAA,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;AACzB,SAAA;AACD,QAAA,SAAS,EAAE;AACT,YAAA,QAAQ,EAAE,QAAQ;AAClB,YAAA,UAAU,EAAE,QAAQ;AACpB,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,IAAI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BAAA,CAAC,CAAC;AAEF,oBAAA,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;gBAC1B;gBAAE,OAAO,GAAG,EAAE;oBACZ,MAAM,CAAC,GAAG,CAAC;gBACb;AACF,YAAA,CAAC;YAED,MAAM,CAAC,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC;AACvC,YAAA,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC;AAChC,QAAA,CAAC,CAAC;AACJ,IAAA,CAAC;wGAlbU,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAd,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,cAFb,MAAM,EAAA,CAAA;;4FAEP,cAAc,EAAA,UAAA,EAAA,CAAA;kBAH1B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACVD;;AAEG;;;;"}
@@ -1,12 +1,14 @@
1
1
  import { CommonModule, DOCUMENT } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
- import { signal, HostListener, Input, Component, createComponent, Inject, Injectable } from '@angular/core';
4
- import { SdUtilities } from '@sd-angular/core/utilities';
3
+ import { signal, SecurityContext, HostListener, Input, Component, createComponent, Inject, Injectable } from '@angular/core';
4
+ import { Utilities } from '@sdcorejs/utils/fns';
5
5
  import { trigger, transition, style, animate } from '@angular/animations';
6
6
  import { TranslatePipe } from '@sd-angular/core/i18n';
7
+ import * as i2 from '@angular/platform-browser';
7
8
 
8
9
  class ToastComponent {
9
10
  notifyService;
11
+ sanitizer;
10
12
  data;
11
13
  isExpanded = signal(false);
12
14
  MAX_SHOW = 2;
@@ -14,8 +16,22 @@ class ToastComponent {
14
16
  timer;
15
17
  start;
16
18
  remaining;
17
- constructor(notifyService) {
19
+ constructor(notifyService, sanitizer) {
18
20
  this.notifyService = notifyService;
21
+ this.sanitizer = sanitizer;
22
+ }
23
+ /**
24
+ * Sanitize HTML tường minh trước khi render qua `[innerHTML]` — strip
25
+ * `<script>`, event handler (`on*`), `javascript:` URL. Chỉ chạy ở nhánh
26
+ * `data.html === true`; nhánh mặc định render text (auto-escape) nên không
27
+ * có sink này. // why: phơi rõ việc sanitize cho review/scanner bảo mật.
28
+ */
29
+ sanitizeHtml(value) {
30
+ return this.sanitizer.sanitize(SecurityContext.HTML, value) ?? '';
31
+ }
32
+ /** Message ở dạng chuỗi đơn (chỉ dùng khi !isMultiMessage). */
33
+ get singleMessage() {
34
+ return this.data.message;
19
35
  }
20
36
  ngOnInit() {
21
37
  // Khởi tạo thời gian còn lại bằng duration ban đầu
@@ -73,8 +89,16 @@ class ToastComponent {
73
89
  get hasMore() {
74
90
  return this.isMultiMessage && this.messages.length > this.MAX_SHOW;
75
91
  }
76
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ToastComponent, deps: [{ token: SdNotifyService }], target: i0.ɵɵFactoryTarget.Component });
77
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: ToastComponent, isStandalone: true, selector: "toast", inputs: { data: "data" }, host: { listeners: { "mouseenter": "pauseTimer()", "mouseleave": "resumeTimer()" }, properties: { "@toastAnimation": "true", "class": "\"bg-white sd-toast\"" } }, ngImport: i0, template: "<div class=\"sd-toast__bar\" [class]=\"'bg-' + data.type\"></div>\r\n\r\n<div class=\"sd-toast__icon\" [class]=\"'text-' + data.type\">\r\n @switch (data.type) {\r\n @case ('success') {\r\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z\"/></svg>\r\n }\r\n @case ('info') {\r\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z\"/></svg>\r\n }\r\n @case ('warning') {\r\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z\"/></svg>\r\n }\r\n @case ('error') {\r\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z\"/></svg>\r\n }\r\n }\r\n</div>\r\n\r\n<div class=\"sd-toast__content\">\r\n <div class=\"sd-toast__header\">\r\n <strong class=\"sd-toast__title\">{{ data.title || ('core.notify.type.' + data.type | translate) }}</strong>\r\n <button class=\"sd-toast__close\" (click)=\"close()\">\u2715</button>\r\n </div>\r\n\r\n <div class=\"sd-toast__body\">\r\n @if (!isMultiMessage) {\r\n <div [innerHTML]=\"data.message\"></div>\r\n } \r\n @else {\r\n <ul class=\"msg-list\">\r\n @for (msg of displayMessages; track msg) {\r\n <li [innerHTML]=\"'- ' + msg\"></li>\r\n }\r\n </ul>\r\n\r\n @if (hasMore) {\r\n <button type=\"button\" \r\n class=\"toggle-more btn-link\" \r\n [class]=\"'text-' + data.type\" \r\n (click)=\"toggleExpand()\">\r\n {{ isExpanded() ? ('core.notify.show-less' | translate) : ('core.notify.show-more' | translate: { count: restCount }) }}\r\n </button>\r\n }\r\n }\r\n </div>\r\n\r\n @if (data.actionLabel) {\r\n <div class=\"sd-toast__actions\">\r\n <button class=\"btn-action\" \r\n [class]=\"'bg-' + data.type + '-light text-' + data.type\"\r\n (click)=\"onActionClick()\">\r\n {{ data.actionLabel }}\r\n </button>\r\n </div>\r\n }\r\n</div>", styles: ["@charset \"UTF-8\";:host{display:flex;width:350px;border-radius:8px;box-shadow:0 4px 12px #00000026;margin-bottom:12px;overflow:hidden;position:relative;font-family:Roboto,sans-serif;pointer-events:auto}.sd-toast__bar{width:6px;flex-shrink:0}.sd-toast__icon{padding:12px 0 0 12px;flex-shrink:0}.sd-toast__icon svg{width:24px;height:24px}.sd-toast__content{flex-grow:1;padding:12px;display:flex;flex-direction:column}.sd-toast__header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:4px}.sd-toast__title{font-size:16px;font-weight:600}.sd-toast__close{background:none;border:none;font-size:16px;cursor:pointer;line-height:1;padding:0;opacity:.5;transition:opacity .2s}.sd-toast__close:hover{opacity:1}.sd-toast__body{font-size:14px;line-height:1.4;word-break:break-word}.sd-toast__actions{display:flex;justify-content:flex-end;margin-top:8px}.msg-list{padding-left:0;list-style:none;margin:0}.toggle-more{background:none;border:none;padding:0;font:inherit;cursor:pointer;font-size:13px;margin-top:4px;font-weight:500;text-align:left}.toggle-more:hover{text-decoration:underline}.toggle-more:focus-visible{outline:2px solid currentColor;outline-offset:2px}.btn-action{border:none;padding:6px 12px;border-radius:4px;font-weight:600;cursor:pointer;font-size:13px;transition:filter .2s}.btn-action:hover{filter:brightness(.95)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: TranslatePipe, name: "translate" }], animations: [
92
+ /** autoid theo loại toast để E2E chọn trực tiếp, vd `services-notify-toast-success`. */
93
+ get autoId() {
94
+ return `services-notify-toast-${this.data.type}`;
95
+ }
96
+ /** Gộp message (mảng nối ' | ') để phơi ra data-message cho E2E. */
97
+ get dataMessage() {
98
+ return Array.isArray(this.data.message) ? this.data.message.join(' | ') : this.data.message;
99
+ }
100
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ToastComponent, deps: [{ token: SdNotifyService }, { token: i2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
101
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: ToastComponent, isStandalone: true, selector: "toast", inputs: { data: "data" }, host: { listeners: { "mouseenter": "pauseTimer()", "mouseleave": "resumeTimer()" }, properties: { "@toastAnimation": "true", "class": "\"bg-white sd-toast\"", "attr.data-autoid": "autoId", "attr.data-type": "data.type", "attr.data-title": "data.title ?? null", "attr.data-message": "dataMessage" } }, ngImport: i0, template: "<div class=\"sd-toast__bar\" [class]=\"'bg-' + data.type\"></div>\r\n\r\n<div class=\"sd-toast__icon\" [class]=\"'text-' + data.type\">\r\n @switch (data.type) {\r\n @case ('success') {\r\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z\"/></svg>\r\n }\r\n @case ('info') {\r\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z\"/></svg>\r\n }\r\n @case ('warning') {\r\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z\"/></svg>\r\n }\r\n @case ('error') {\r\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z\"/></svg>\r\n }\r\n }\r\n</div>\r\n\r\n<div class=\"sd-toast__content\">\r\n <div class=\"sd-toast__header\">\r\n <strong class=\"sd-toast__title\">{{ data.title || ('core.notify.type.' + data.type | translate) }}</strong>\r\n <button class=\"sd-toast__close\" (click)=\"close()\">\u2715</button>\r\n </div>\r\n\r\n <div class=\"sd-toast__body\">\r\n @if (!isMultiMessage) {\r\n <!-- why: m\u1EB7c \u0111\u1ECBnh render TEXT (auto-escape) \u2014 an to\u00E0n. Ch\u1EC9 render HTML\r\n (\u0111\u00E3 sanitize) khi data.html=true. -->\r\n @if (data.html) {\r\n <div [innerHTML]=\"sanitizeHtml(singleMessage)\"></div>\r\n } @else {\r\n <div>{{ singleMessage }}</div>\r\n }\r\n }\r\n @else {\r\n <ul class=\"msg-list\">\r\n @for (msg of displayMessages; track msg) {\r\n @if (data.html) {\r\n <li [innerHTML]=\"sanitizeHtml('- ' + msg)\"></li>\r\n } @else {\r\n <li>{{ '- ' + msg }}</li>\r\n }\r\n }\r\n </ul>\r\n\r\n @if (hasMore) {\r\n <button type=\"button\" \r\n class=\"toggle-more btn-link\" \r\n [class]=\"'text-' + data.type\" \r\n (click)=\"toggleExpand()\">\r\n {{ isExpanded() ? ('core.notify.show-less' | translate) : ('core.notify.show-more' | translate: { count: restCount }) }}\r\n </button>\r\n }\r\n }\r\n </div>\r\n\r\n @if (data.actionLabel) {\r\n <div class=\"sd-toast__actions\">\r\n <button class=\"btn-action\" \r\n [class]=\"'bg-' + data.type + '-light text-' + data.type\"\r\n (click)=\"onActionClick()\">\r\n {{ data.actionLabel }}\r\n </button>\r\n </div>\r\n }\r\n</div>", styles: ["@charset \"UTF-8\";:host{display:flex;width:350px;border-radius:8px;box-shadow:0 4px 12px #00000026;margin-bottom:12px;overflow:hidden;position:relative;font-family:Roboto,sans-serif;pointer-events:auto}.sd-toast__bar{width:6px;flex-shrink:0}.sd-toast__icon{padding:12px 0 0 12px;flex-shrink:0}.sd-toast__icon svg{width:24px;height:24px}.sd-toast__content{flex-grow:1;padding:12px;display:flex;flex-direction:column}.sd-toast__header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:4px}.sd-toast__title{font-size:16px;font-weight:600}.sd-toast__close{background:none;border:none;font-size:16px;cursor:pointer;line-height:1;padding:0;opacity:.5;transition:opacity .2s}.sd-toast__close:hover{opacity:1}.sd-toast__body{font-size:14px;line-height:1.4;word-break:break-word}.sd-toast__actions{display:flex;justify-content:flex-end;margin-top:8px}.msg-list{padding-left:0;list-style:none;margin:0}.toggle-more{background:none;border:none;padding:0;font:inherit;cursor:pointer;font-size:13px;margin-top:4px;font-weight:500;text-align:left}.toggle-more:hover{text-decoration:underline}.toggle-more:focus-visible{outline:2px solid currentColor;outline-offset:2px}.btn-action{border:none;padding:6px 12px;border-radius:4px;font-weight:600;cursor:pointer;font-size:13px;transition:filter .2s}.btn-action:hover{filter:brightness(.95)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: TranslatePipe, name: "translate" }], animations: [
78
102
  trigger('toastAnimation', [
79
103
  transition(':enter', [
80
104
  style({ transform: 'translateX(100%)', opacity: 0 }),
@@ -100,9 +124,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
100
124
  ])
101
125
  ], host: {
102
126
  '[@toastAnimation]': 'true',
103
- '[class]': '"bg-white sd-toast"'
104
- }, template: "<div class=\"sd-toast__bar\" [class]=\"'bg-' + data.type\"></div>\r\n\r\n<div class=\"sd-toast__icon\" [class]=\"'text-' + data.type\">\r\n @switch (data.type) {\r\n @case ('success') {\r\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z\"/></svg>\r\n }\r\n @case ('info') {\r\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z\"/></svg>\r\n }\r\n @case ('warning') {\r\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z\"/></svg>\r\n }\r\n @case ('error') {\r\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z\"/></svg>\r\n }\r\n }\r\n</div>\r\n\r\n<div class=\"sd-toast__content\">\r\n <div class=\"sd-toast__header\">\r\n <strong class=\"sd-toast__title\">{{ data.title || ('core.notify.type.' + data.type | translate) }}</strong>\r\n <button class=\"sd-toast__close\" (click)=\"close()\">\u2715</button>\r\n </div>\r\n\r\n <div class=\"sd-toast__body\">\r\n @if (!isMultiMessage) {\r\n <div [innerHTML]=\"data.message\"></div>\r\n } \r\n @else {\r\n <ul class=\"msg-list\">\r\n @for (msg of displayMessages; track msg) {\r\n <li [innerHTML]=\"'- ' + msg\"></li>\r\n }\r\n </ul>\r\n\r\n @if (hasMore) {\r\n <button type=\"button\" \r\n class=\"toggle-more btn-link\" \r\n [class]=\"'text-' + data.type\" \r\n (click)=\"toggleExpand()\">\r\n {{ isExpanded() ? ('core.notify.show-less' | translate) : ('core.notify.show-more' | translate: { count: restCount }) }}\r\n </button>\r\n }\r\n }\r\n </div>\r\n\r\n @if (data.actionLabel) {\r\n <div class=\"sd-toast__actions\">\r\n <button class=\"btn-action\" \r\n [class]=\"'bg-' + data.type + '-light text-' + data.type\"\r\n (click)=\"onActionClick()\">\r\n {{ data.actionLabel }}\r\n </button>\r\n </div>\r\n }\r\n</div>", styles: ["@charset \"UTF-8\";:host{display:flex;width:350px;border-radius:8px;box-shadow:0 4px 12px #00000026;margin-bottom:12px;overflow:hidden;position:relative;font-family:Roboto,sans-serif;pointer-events:auto}.sd-toast__bar{width:6px;flex-shrink:0}.sd-toast__icon{padding:12px 0 0 12px;flex-shrink:0}.sd-toast__icon svg{width:24px;height:24px}.sd-toast__content{flex-grow:1;padding:12px;display:flex;flex-direction:column}.sd-toast__header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:4px}.sd-toast__title{font-size:16px;font-weight:600}.sd-toast__close{background:none;border:none;font-size:16px;cursor:pointer;line-height:1;padding:0;opacity:.5;transition:opacity .2s}.sd-toast__close:hover{opacity:1}.sd-toast__body{font-size:14px;line-height:1.4;word-break:break-word}.sd-toast__actions{display:flex;justify-content:flex-end;margin-top:8px}.msg-list{padding-left:0;list-style:none;margin:0}.toggle-more{background:none;border:none;padding:0;font:inherit;cursor:pointer;font-size:13px;margin-top:4px;font-weight:500;text-align:left}.toggle-more:hover{text-decoration:underline}.toggle-more:focus-visible{outline:2px solid currentColor;outline-offset:2px}.btn-action{border:none;padding:6px 12px;border-radius:4px;font-weight:600;cursor:pointer;font-size:13px;transition:filter .2s}.btn-action:hover{filter:brightness(.95)}\n"] }]
105
- }], ctorParameters: () => [{ type: SdNotifyService }], propDecorators: { data: [{
127
+ '[class]': '"bg-white sd-toast"',
128
+ // E2E hooks đọc bởi sd-autoid-inspector: autoid theo loại + state type/title/message.
129
+ '[attr.data-autoid]': 'autoId',
130
+ '[attr.data-type]': 'data.type',
131
+ '[attr.data-title]': 'data.title ?? null',
132
+ '[attr.data-message]': 'dataMessage'
133
+ }, template: "<div class=\"sd-toast__bar\" [class]=\"'bg-' + data.type\"></div>\r\n\r\n<div class=\"sd-toast__icon\" [class]=\"'text-' + data.type\">\r\n @switch (data.type) {\r\n @case ('success') {\r\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z\"/></svg>\r\n }\r\n @case ('info') {\r\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z\"/></svg>\r\n }\r\n @case ('warning') {\r\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z\"/></svg>\r\n }\r\n @case ('error') {\r\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z\"/></svg>\r\n }\r\n }\r\n</div>\r\n\r\n<div class=\"sd-toast__content\">\r\n <div class=\"sd-toast__header\">\r\n <strong class=\"sd-toast__title\">{{ data.title || ('core.notify.type.' + data.type | translate) }}</strong>\r\n <button class=\"sd-toast__close\" (click)=\"close()\">\u2715</button>\r\n </div>\r\n\r\n <div class=\"sd-toast__body\">\r\n @if (!isMultiMessage) {\r\n <!-- why: m\u1EB7c \u0111\u1ECBnh render TEXT (auto-escape) \u2014 an to\u00E0n. Ch\u1EC9 render HTML\r\n (\u0111\u00E3 sanitize) khi data.html=true. -->\r\n @if (data.html) {\r\n <div [innerHTML]=\"sanitizeHtml(singleMessage)\"></div>\r\n } @else {\r\n <div>{{ singleMessage }}</div>\r\n }\r\n }\r\n @else {\r\n <ul class=\"msg-list\">\r\n @for (msg of displayMessages; track msg) {\r\n @if (data.html) {\r\n <li [innerHTML]=\"sanitizeHtml('- ' + msg)\"></li>\r\n } @else {\r\n <li>{{ '- ' + msg }}</li>\r\n }\r\n }\r\n </ul>\r\n\r\n @if (hasMore) {\r\n <button type=\"button\" \r\n class=\"toggle-more btn-link\" \r\n [class]=\"'text-' + data.type\" \r\n (click)=\"toggleExpand()\">\r\n {{ isExpanded() ? ('core.notify.show-less' | translate) : ('core.notify.show-more' | translate: { count: restCount }) }}\r\n </button>\r\n }\r\n }\r\n </div>\r\n\r\n @if (data.actionLabel) {\r\n <div class=\"sd-toast__actions\">\r\n <button class=\"btn-action\" \r\n [class]=\"'bg-' + data.type + '-light text-' + data.type\"\r\n (click)=\"onActionClick()\">\r\n {{ data.actionLabel }}\r\n </button>\r\n </div>\r\n }\r\n</div>", styles: ["@charset \"UTF-8\";:host{display:flex;width:350px;border-radius:8px;box-shadow:0 4px 12px #00000026;margin-bottom:12px;overflow:hidden;position:relative;font-family:Roboto,sans-serif;pointer-events:auto}.sd-toast__bar{width:6px;flex-shrink:0}.sd-toast__icon{padding:12px 0 0 12px;flex-shrink:0}.sd-toast__icon svg{width:24px;height:24px}.sd-toast__content{flex-grow:1;padding:12px;display:flex;flex-direction:column}.sd-toast__header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:4px}.sd-toast__title{font-size:16px;font-weight:600}.sd-toast__close{background:none;border:none;font-size:16px;cursor:pointer;line-height:1;padding:0;opacity:.5;transition:opacity .2s}.sd-toast__close:hover{opacity:1}.sd-toast__body{font-size:14px;line-height:1.4;word-break:break-word}.sd-toast__actions{display:flex;justify-content:flex-end;margin-top:8px}.msg-list{padding-left:0;list-style:none;margin:0}.toggle-more{background:none;border:none;padding:0;font:inherit;cursor:pointer;font-size:13px;margin-top:4px;font-weight:500;text-align:left}.toggle-more:hover{text-decoration:underline}.toggle-more:focus-visible{outline:2px solid currentColor;outline-offset:2px}.btn-action{border:none;padding:6px 12px;border-radius:4px;font-weight:600;cursor:pointer;font-size:13px;transition:filter .2s}.btn-action:hover{filter:brightness(.95)}\n"] }]
134
+ }], ctorParameters: () => [{ type: SdNotifyService }, { type: i2.DomSanitizer }], propDecorators: { data: [{
106
135
  type: Input,
107
136
  args: [{ required: true }]
108
137
  }], pauseTimer: [{
@@ -189,13 +218,14 @@ class SdNotifyService {
189
218
  // Private helpers
190
219
  #addImmediate(type, message, option) {
191
220
  const newToast = {
192
- id: SdUtilities.generateUuid(),
221
+ id: Utilities.generateUuid(),
193
222
  type,
194
223
  message,
195
224
  title: option?.title,
196
225
  duration: option?.duration ?? this.#DEFAULT_SUCCESS_DURATION,
197
226
  actionLabel: option?.actionLabel,
198
- onAction: option?.onAction
227
+ onAction: option?.onAction,
228
+ html: option?.html
199
229
  };
200
230
  this.toasts.update((current) => {
201
231
  const updated = [newToast, ...current];
@@ -227,13 +257,14 @@ class SdNotifyService {
227
257
  const title = option?.title ?? typeLabel;
228
258
  const finalTitle = messages.length > 1 ? `${title} (${messages.length})` : title;
229
259
  const newToast = {
230
- id: SdUtilities.generateUuid(),
260
+ id: Utilities.generateUuid(),
231
261
  type,
232
262
  message: messages.length === 1 ? messages[0] : messages,
233
263
  title: finalTitle,
234
264
  duration: option?.duration ?? this.#DEFAULT_BUFFERED_DURATION,
235
265
  actionLabel: option?.actionLabel,
236
- onAction: option?.onAction
266
+ onAction: option?.onAction,
267
+ html: option?.html
237
268
  };
238
269
  this.toasts.update((current) => {
239
270
  const updated = [newToast, ...current];
@@ -1 +1 @@
1
- {"version":3,"file":"sd-angular-core-services-notify.mjs","sources":["../../../projects/sd-angular/services/notify/src/components/toast/toast.component.ts","../../../projects/sd-angular/services/notify/src/components/toast/toast.component.html","../../../projects/sd-angular/services/notify/src/components/toast-container.component.ts","../../../projects/sd-angular/services/notify/src/notify.service.ts","../../../projects/sd-angular/services/notify/sd-angular-core-services-notify.ts"],"sourcesContent":["import { Component, Input, signal, HostListener, OnInit, OnDestroy } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { animate, style, transition, trigger } from '@angular/animations';\r\nimport { TranslatePipe } from '@sd-angular/core/i18n';\r\nimport { ToastData } from '../../notify.model';\r\nimport { SdNotifyService } from '../../notify.service';\r\n\r\n@Component({\r\n selector: 'toast',\r\n standalone: true,\r\n imports: [CommonModule, TranslatePipe],\r\n templateUrl: './toast.component.html',\r\n styleUrls: ['./toast.component.scss'],\r\n animations: [\r\n trigger('toastAnimation', [\r\n transition(':enter', [\r\n style({ transform: 'translateX(100%)', opacity: 0 }),\r\n animate('300ms ease-out', style({ transform: 'translateX(0)', opacity: 1 }))\r\n ]),\r\n transition(':leave', [\r\n animate('200ms ease-in', style({ transform: 'translateX(100%)', opacity: 0 }))\r\n ])\r\n ])\r\n ],\r\n host: {\r\n '[@toastAnimation]': 'true',\r\n '[class]': '\"bg-white sd-toast\"'\r\n }\r\n})\r\nexport class ToastComponent implements OnInit, OnDestroy {\r\n @Input({ required: true }) data!: ToastData;\r\n \r\n isExpanded = signal(false);\r\n readonly MAX_SHOW = 2;\r\n\r\n // --- Logic Timer ---\r\n private timer: any;\r\n private start!: number;\r\n private remaining!: number;\r\n\r\n constructor(private notifyService: SdNotifyService) {}\r\n\r\n ngOnInit() {\r\n // Khởi tạo thời gian còn lại bằng duration ban đầu\r\n this.remaining = this.data.duration;\r\n // Bắt đầu đếm ngược ngay khi hiện ra\r\n this.resumeTimer();\r\n }\r\n\r\n ngOnDestroy() {\r\n clearTimeout(this.timer);\r\n }\r\n\r\n // --- Logic Pause/Resume ---\r\n\r\n @HostListener('mouseenter')\r\n pauseTimer() {\r\n if (this.timer) {\r\n // Xóa timer hiện tại\r\n clearTimeout(this.timer);\r\n this.timer = null;\r\n // Tính toán thời gian đã trôi qua để trừ đi\r\n this.remaining -= Date.now() - this.start;\r\n }\r\n }\r\n\r\n @HostListener('mouseleave')\r\n resumeTimer() {\r\n // Chỉ chạy tiếp nếu còn thời gian và timer chưa chạy\r\n if (this.remaining > 0 && !this.timer) {\r\n this.start = Date.now();\r\n this.timer = setTimeout(() => {\r\n this.close();\r\n }, this.remaining);\r\n }\r\n }\r\n\r\n // --- Logic cũ ---\r\n\r\n close() {\r\n this.notifyService.remove(this.data.id);\r\n }\r\n\r\n onActionClick() {\r\n this.data.onAction?.();\r\n }\r\n\r\n toggleExpand() {\r\n this.isExpanded.update(v => !v);\r\n }\r\n\r\n get isMultiMessage(): boolean {\r\n return Array.isArray(this.data.message);\r\n }\r\n\r\n get messages(): string[] {\r\n return this.data.message as string[];\r\n }\r\n\r\n get displayMessages(): string[] {\r\n const msgs = this.messages;\r\n if (this.isExpanded()) return msgs;\r\n return msgs.slice(0, this.MAX_SHOW);\r\n }\r\n\r\n get restCount(): number {\r\n return this.messages.length - this.MAX_SHOW;\r\n }\r\n\r\n get hasMore(): boolean {\r\n return this.isMultiMessage && this.messages.length > this.MAX_SHOW;\r\n }\r\n}","<div class=\"sd-toast__bar\" [class]=\"'bg-' + data.type\"></div>\r\n\r\n<div class=\"sd-toast__icon\" [class]=\"'text-' + data.type\">\r\n @switch (data.type) {\r\n @case ('success') {\r\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z\"/></svg>\r\n }\r\n @case ('info') {\r\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z\"/></svg>\r\n }\r\n @case ('warning') {\r\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z\"/></svg>\r\n }\r\n @case ('error') {\r\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z\"/></svg>\r\n }\r\n }\r\n</div>\r\n\r\n<div class=\"sd-toast__content\">\r\n <div class=\"sd-toast__header\">\r\n <strong class=\"sd-toast__title\">{{ data.title || ('core.notify.type.' + data.type | translate) }}</strong>\r\n <button class=\"sd-toast__close\" (click)=\"close()\">✕</button>\r\n </div>\r\n\r\n <div class=\"sd-toast__body\">\r\n @if (!isMultiMessage) {\r\n <div [innerHTML]=\"data.message\"></div>\r\n } \r\n @else {\r\n <ul class=\"msg-list\">\r\n @for (msg of displayMessages; track msg) {\r\n <li [innerHTML]=\"'- ' + msg\"></li>\r\n }\r\n </ul>\r\n\r\n @if (hasMore) {\r\n <button type=\"button\" \r\n class=\"toggle-more btn-link\" \r\n [class]=\"'text-' + data.type\" \r\n (click)=\"toggleExpand()\">\r\n {{ isExpanded() ? ('core.notify.show-less' | translate) : ('core.notify.show-more' | translate: { count: restCount }) }}\r\n </button>\r\n }\r\n }\r\n </div>\r\n\r\n @if (data.actionLabel) {\r\n <div class=\"sd-toast__actions\">\r\n <button class=\"btn-action\" \r\n [class]=\"'bg-' + data.type + '-light text-' + data.type\"\r\n (click)=\"onActionClick()\">\r\n {{ data.actionLabel }}\r\n </button>\r\n </div>\r\n }\r\n</div>","import { Component, signal, WritableSignal } from '@angular/core';\r\nimport { ToastData } from '../notify.model';\r\nimport { ToastComponent } from './toast/toast.component';\r\n\r\n@Component({\r\n selector: 'toast-container',\r\n standalone: true,\r\n imports: [ToastComponent],\r\n template: `\r\n <div class=\"toast-container\">\r\n @for (toast of toasts(); track toast.id) {\r\n <toast [data]=\"toast\"> </toast>\r\n }\r\n </div>\r\n `,\r\n styles: [\r\n `\r\n .toast-container {\r\n position: fixed;\r\n top: 20px;\r\n right: 20px;\r\n z-index: 9999;\r\n display: flex;\r\n flex-direction: column;\r\n pointer-events: none; /* Cho phép click xuyên qua vùng trống */\r\n }\r\n sd-toast {\r\n pointer-events: auto; /* Bật lại click cho toast */\r\n }\r\n `,\r\n ],\r\n})\r\nexport class ToastContainerComponent {\r\n toasts: WritableSignal<ToastData[]> = signal([]);\r\n}\r\n","import { DOCUMENT } from '@angular/common';\r\nimport {\r\n ApplicationRef,\r\n createComponent,\r\n EnvironmentInjector,\r\n Inject,\r\n Injectable,\r\n signal\r\n} from '@angular/core';\r\nimport { SdUtilities } from '@sd-angular/core/utilities';\r\nimport { ToastContainerComponent } from './components/toast-container.component';\r\nimport { NotifyOption, ToastData, ToastType } from './notify.model';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class SdNotifyService {\r\n readonly toasts = signal<ToastData[]>([]);\r\n\r\n // Constants\r\n readonly #DEBOUNCE_TIME = 500;\r\n readonly #DEFAULT_SUCCESS_DURATION = 3000;\r\n readonly #DEFAULT_BUFFERED_DURATION = 5000;\r\n readonly #MAX_TOASTS = 5;\r\n\r\n // State\r\n #buffer: Record<string, string[]> = {};\r\n #timers: Record<string, ReturnType<typeof setTimeout> | null> = {};\r\n\r\n constructor(\r\n private appRef: ApplicationRef,\r\n private injector: EnvironmentInjector,\r\n @Inject(DOCUMENT) private document: Document\r\n ) {\r\n this.#initContainer();\r\n }\r\n\r\n #initContainer() {\r\n const componentRef = createComponent(ToastContainerComponent, {\r\n environmentInjector: this.injector,\r\n });\r\n componentRef.instance.toasts = this.toasts;\r\n this.appRef.attachView(componentRef.hostView);\r\n const domElem = (componentRef.hostView as any).rootNodes[0] as HTMLElement;\r\n this.document.body.appendChild(domElem);\r\n }\r\n\r\n // Public API\r\n success(message: string, option?: NotifyOption) {\r\n this.#addImmediate('success', message, option);\r\n }\r\n\r\n info(message: string, option?: NotifyOption) {\r\n this.#addImmediate('info', message, option);\r\n }\r\n\r\n warning(message: string | string[], option?: NotifyOption) {\r\n this.#addToBuffer('warning', message, option);\r\n }\r\n\r\n error(message: string | string[], option?: NotifyOption) {\r\n this.#addToBuffer('error', message, option);\r\n }\r\n\r\n remove(id: string) {\r\n this.toasts.update((current) => current.filter((t) => t.id !== id));\r\n }\r\n\r\n clearAll() {\r\n this.toasts.set([]);\r\n this.#clearAllTimers();\r\n }\r\n\r\n clearByType(type: ToastType) {\r\n this.toasts.update((current) => current.filter((t) => t.type !== type));\r\n }\r\n\r\n // Private helpers\r\n #addImmediate(type: ToastType, message: string, option?: NotifyOption) {\r\n const newToast: ToastData = {\r\n id: SdUtilities.generateUuid(),\r\n type,\r\n message,\r\n title: option?.title,\r\n duration: option?.duration ?? this.#DEFAULT_SUCCESS_DURATION,\r\n actionLabel: option?.actionLabel,\r\n onAction: option?.onAction\r\n };\r\n\r\n this.toasts.update((current) => {\r\n const updated = [newToast, ...current];\r\n return updated.slice(0, this.#MAX_TOASTS);\r\n });\r\n }\r\n\r\n #addToBuffer(type: ToastType, message: string | string[], option?: NotifyOption) {\r\n if (!this.#buffer[type]) {\r\n this.#buffer[type] = [];\r\n }\r\n \r\n const msgs = Array.isArray(message) ? message : [message];\r\n this.#buffer[type].push(...msgs);\r\n\r\n // Clear existing timer and set new one\r\n if (this.#timers[type]) {\r\n clearTimeout(this.#timers[type]!);\r\n }\r\n\r\n this.#timers[type] = setTimeout(() => {\r\n this.#flushBuffer(type, option);\r\n }, this.#DEBOUNCE_TIME);\r\n }\r\n\r\n #flushBuffer(type: ToastType, option?: NotifyOption) {\r\n const messages = [...new Set(this.#buffer[type])];\r\n \r\n // Cleanup\r\n this.#buffer[type] = [];\r\n this.#timers[type] = null;\r\n\r\n if (messages.length === 0) return;\r\n\r\n const typeLabel = type === 'error' ? 'Error' : 'Warning';\r\n const title = option?.title ?? typeLabel;\r\n const finalTitle = messages.length > 1 ? `${title} (${messages.length})` : title;\r\n\r\n const newToast: ToastData = {\r\n id: SdUtilities.generateUuid(),\r\n type,\r\n message: messages.length === 1 ? messages[0] : messages, \r\n title: finalTitle,\r\n duration: option?.duration ?? this.#DEFAULT_BUFFERED_DURATION,\r\n actionLabel: option?.actionLabel,\r\n onAction: option?.onAction\r\n };\r\n\r\n this.toasts.update((current) => {\r\n const updated = [newToast, ...current];\r\n return updated.slice(0, this.#MAX_TOASTS);\r\n });\r\n }\r\n\r\n #clearAllTimers() {\r\n Object.values(this.#timers).forEach(timer => {\r\n if (timer) clearTimeout(timer);\r\n });\r\n this.#timers = {};\r\n }\r\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.SdNotifyService"],"mappings":";;;;;;;MA6Ba,cAAc,CAAA;AAWL,IAAA,aAAA;AAVO,IAAA,IAAI;AAE/B,IAAA,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC;IACjB,QAAQ,GAAG,CAAC;;AA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AW;YAChC,QAAQ,EAAE,MAAM,EAAE;SACnB;QAED,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,KAAI;YAC7B,MAAM,OAAO,GAAG,CAAC,QAAQ,EAAE,GAAG,OAAO,CAAC;YACtC,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC;AAC3C,QAAA,CAAC,CAAC;IACJ;IAEA,eAAe,GAAA;AACb,QAAA,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,IAAG;AAC1C,YAAA,IAAI,KAAK;gBAAE,YAAY,CAAC,KAAK,CAAC;AAChC,QAAA,CAAC,CAAC;AACF,QAAA,IAAI,CAAC,OAAO,GAAG,EAAE;IACnB;AAnIW,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,mFAgBhB,QAAQ,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAhBP,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,cAFd,MAAM,EAAA,CAAA;;4FAEP,eAAe,EAAA,UAAA,EAAA,CAAA;kBAH3B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;0BAiBI,MAAM;2BAAC,QAAQ;;;AChCpB;;AAEG;;;;"}
1
+ {"version":3,"file":"sd-angular-core-services-notify.mjs","sources":["../../../projects/sd-angular/services/notify/src/components/toast/toast.component.ts","../../../projects/sd-angular/services/notify/src/components/toast/toast.component.html","../../../projects/sd-angular/services/notify/src/components/toast-container.component.ts","../../../projects/sd-angular/services/notify/src/notify.service.ts","../../../projects/sd-angular/services/notify/sd-angular-core-services-notify.ts"],"sourcesContent":["import { Component, Input, signal, HostListener, OnInit, OnDestroy, SecurityContext } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { DomSanitizer } from '@angular/platform-browser';\r\nimport { animate, style, transition, trigger } from '@angular/animations';\r\nimport { TranslatePipe } from '@sd-angular/core/i18n';\r\nimport { ToastData } from '../../notify.model';\r\nimport { SdNotifyService } from '../../notify.service';\r\n\r\n@Component({\r\n selector: 'toast',\r\n standalone: true,\r\n imports: [CommonModule, TranslatePipe],\r\n templateUrl: './toast.component.html',\r\n styleUrls: ['./toast.component.scss'],\r\n animations: [\r\n trigger('toastAnimation', [\r\n transition(':enter', [\r\n style({ transform: 'translateX(100%)', opacity: 0 }),\r\n animate('300ms ease-out', style({ transform: 'translateX(0)', opacity: 1 }))\r\n ]),\r\n transition(':leave', [\r\n animate('200ms ease-in', style({ transform: 'translateX(100%)', opacity: 0 }))\r\n ])\r\n ])\r\n ],\r\n host: {\r\n '[@toastAnimation]': 'true',\r\n '[class]': '\"bg-white sd-toast\"',\r\n // E2E hooks đọc bởi sd-autoid-inspector: autoid theo loại + state type/title/message.\r\n '[attr.data-autoid]': 'autoId',\r\n '[attr.data-type]': 'data.type',\r\n '[attr.data-title]': 'data.title ?? null',\r\n '[attr.data-message]': 'dataMessage'\r\n }\r\n})\r\nexport class ToastComponent implements OnInit, OnDestroy {\r\n @Input({ required: true }) data!: ToastData;\r\n \r\n isExpanded = signal(false);\r\n readonly MAX_SHOW = 2;\r\n\r\n // --- Logic Timer ---\r\n private timer: any;\r\n private start!: number;\r\n private remaining!: number;\r\n\r\n constructor(\r\n private notifyService: SdNotifyService,\r\n private sanitizer: DomSanitizer\r\n ) {}\r\n\r\n /**\r\n * Sanitize HTML tường minh trước khi render qua `[innerHTML]` — strip\r\n * `<script>`, event handler (`on*`), `javascript:` URL. Chỉ chạy ở nhánh\r\n * `data.html === true`; nhánh mặc định render text (auto-escape) nên không\r\n * có sink này. // why: phơi rõ việc sanitize cho review/scanner bảo mật.\r\n */\r\n sanitizeHtml(value: string): string {\r\n return this.sanitizer.sanitize(SecurityContext.HTML, value) ?? '';\r\n }\r\n\r\n /** Message ở dạng chuỗi đơn (chỉ dùng khi !isMultiMessage). */\r\n get singleMessage(): string {\r\n return this.data.message as string;\r\n }\r\n\r\n ngOnInit() {\r\n // Khởi tạo thời gian còn lại bằng duration ban đầu\r\n this.remaining = this.data.duration;\r\n // Bắt đầu đếm ngược ngay khi hiện ra\r\n this.resumeTimer();\r\n }\r\n\r\n ngOnDestroy() {\r\n clearTimeout(this.timer);\r\n }\r\n\r\n // --- Logic Pause/Resume ---\r\n\r\n @HostListener('mouseenter')\r\n pauseTimer() {\r\n if (this.timer) {\r\n // Xóa timer hiện tại\r\n clearTimeout(this.timer);\r\n this.timer = null;\r\n // Tính toán thời gian đã trôi qua để trừ đi\r\n this.remaining -= Date.now() - this.start;\r\n }\r\n }\r\n\r\n @HostListener('mouseleave')\r\n resumeTimer() {\r\n // Chỉ chạy tiếp nếu còn thời gian và timer chưa chạy\r\n if (this.remaining > 0 && !this.timer) {\r\n this.start = Date.now();\r\n this.timer = setTimeout(() => {\r\n this.close();\r\n }, this.remaining);\r\n }\r\n }\r\n\r\n // --- Logic cũ ---\r\n\r\n close() {\r\n this.notifyService.remove(this.data.id);\r\n }\r\n\r\n onActionClick() {\r\n this.data.onAction?.();\r\n }\r\n\r\n toggleExpand() {\r\n this.isExpanded.update(v => !v);\r\n }\r\n\r\n get isMultiMessage(): boolean {\r\n return Array.isArray(this.data.message);\r\n }\r\n\r\n get messages(): string[] {\r\n return this.data.message as string[];\r\n }\r\n\r\n get displayMessages(): string[] {\r\n const msgs = this.messages;\r\n if (this.isExpanded()) return msgs;\r\n return msgs.slice(0, this.MAX_SHOW);\r\n }\r\n\r\n get restCount(): number {\r\n return this.messages.length - this.MAX_SHOW;\r\n }\r\n\r\n get hasMore(): boolean {\r\n return this.isMultiMessage && this.messages.length > this.MAX_SHOW;\r\n }\r\n\r\n /** autoid theo loại toast để E2E chọn trực tiếp, vd `services-notify-toast-success`. */\r\n get autoId(): string {\r\n return `services-notify-toast-${this.data.type}`;\r\n }\r\n\r\n /** Gộp message (mảng nối ' | ') để phơi ra data-message cho E2E. */\r\n get dataMessage(): string {\r\n return Array.isArray(this.data.message) ? this.data.message.join(' | ') : this.data.message;\r\n }\r\n}","<div class=\"sd-toast__bar\" [class]=\"'bg-' + data.type\"></div>\r\n\r\n<div class=\"sd-toast__icon\" [class]=\"'text-' + data.type\">\r\n @switch (data.type) {\r\n @case ('success') {\r\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z\"/></svg>\r\n }\r\n @case ('info') {\r\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z\"/></svg>\r\n }\r\n @case ('warning') {\r\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z\"/></svg>\r\n }\r\n @case ('error') {\r\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z\"/></svg>\r\n }\r\n }\r\n</div>\r\n\r\n<div class=\"sd-toast__content\">\r\n <div class=\"sd-toast__header\">\r\n <strong class=\"sd-toast__title\">{{ data.title || ('core.notify.type.' + data.type | translate) }}</strong>\r\n <button class=\"sd-toast__close\" (click)=\"close()\">✕</button>\r\n </div>\r\n\r\n <div class=\"sd-toast__body\">\r\n @if (!isMultiMessage) {\r\n <!-- why: mặc định render TEXT (auto-escape) — an toàn. Chỉ render HTML\r\n (đã sanitize) khi data.html=true. -->\r\n @if (data.html) {\r\n <div [innerHTML]=\"sanitizeHtml(singleMessage)\"></div>\r\n } @else {\r\n <div>{{ singleMessage }}</div>\r\n }\r\n }\r\n @else {\r\n <ul class=\"msg-list\">\r\n @for (msg of displayMessages; track msg) {\r\n @if (data.html) {\r\n <li [innerHTML]=\"sanitizeHtml('- ' + msg)\"></li>\r\n } @else {\r\n <li>{{ '- ' + msg }}</li>\r\n }\r\n }\r\n </ul>\r\n\r\n @if (hasMore) {\r\n <button type=\"button\" \r\n class=\"toggle-more btn-link\" \r\n [class]=\"'text-' + data.type\" \r\n (click)=\"toggleExpand()\">\r\n {{ isExpanded() ? ('core.notify.show-less' | translate) : ('core.notify.show-more' | translate: { count: restCount }) }}\r\n </button>\r\n }\r\n }\r\n </div>\r\n\r\n @if (data.actionLabel) {\r\n <div class=\"sd-toast__actions\">\r\n <button class=\"btn-action\" \r\n [class]=\"'bg-' + data.type + '-light text-' + data.type\"\r\n (click)=\"onActionClick()\">\r\n {{ data.actionLabel }}\r\n </button>\r\n </div>\r\n }\r\n</div>","import { Component, signal, WritableSignal } from '@angular/core';\r\nimport { ToastData } from '../notify.model';\r\nimport { ToastComponent } from './toast/toast.component';\r\n\r\n@Component({\r\n selector: 'toast-container',\r\n standalone: true,\r\n imports: [ToastComponent],\r\n template: `\r\n <div class=\"toast-container\">\r\n @for (toast of toasts(); track toast.id) {\r\n <toast [data]=\"toast\"> </toast>\r\n }\r\n </div>\r\n `,\r\n styles: [\r\n `\r\n .toast-container {\r\n position: fixed;\r\n top: 20px;\r\n right: 20px;\r\n z-index: 9999;\r\n display: flex;\r\n flex-direction: column;\r\n pointer-events: none; /* Cho phép click xuyên qua vùng trống */\r\n }\r\n sd-toast {\r\n pointer-events: auto; /* Bật lại click cho toast */\r\n }\r\n `,\r\n ],\r\n})\r\nexport class ToastContainerComponent {\r\n toasts: WritableSignal<ToastData[]> = signal([]);\r\n}\r\n","import { DOCUMENT } from '@angular/common';\r\nimport {\r\n ApplicationRef,\r\n createComponent,\r\n EnvironmentInjector,\r\n Inject,\r\n Injectable,\r\n signal\r\n} from '@angular/core';\r\nimport { Utilities } from '@sdcorejs/utils/fns';\r\nimport { ToastContainerComponent } from './components/toast-container.component';\r\nimport { NotifyOption, ToastData, ToastType } from './notify.model';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class SdNotifyService {\r\n readonly toasts = signal<ToastData[]>([]);\r\n\r\n // Constants\r\n readonly #DEBOUNCE_TIME = 500;\r\n readonly #DEFAULT_SUCCESS_DURATION = 3000;\r\n readonly #DEFAULT_BUFFERED_DURATION = 5000;\r\n readonly #MAX_TOASTS = 5;\r\n\r\n // State\r\n #buffer: Record<string, string[]> = {};\r\n #timers: Record<string, ReturnType<typeof setTimeout> | null> = {};\r\n\r\n constructor(\r\n private appRef: ApplicationRef,\r\n private injector: EnvironmentInjector,\r\n @Inject(DOCUMENT) private document: Document\r\n ) {\r\n this.#initContainer();\r\n }\r\n\r\n #initContainer() {\r\n const componentRef = createComponent(ToastContainerComponent, {\r\n environmentInjector: this.injector,\r\n });\r\n componentRef.instance.toasts = this.toasts;\r\n this.appRef.attachView(componentRef.hostView);\r\n const domElem = (componentRef.hostView as any).rootNodes[0] as HTMLElement;\r\n this.document.body.appendChild(domElem);\r\n }\r\n\r\n // Public API\r\n success(message: string, option?: NotifyOption) {\r\n this.#addImmediate('success', message, option);\r\n }\r\n\r\n info(message: string, option?: NotifyOption) {\r\n this.#addImmediate('info', message, option);\r\n }\r\n\r\n warning(message: string | string[], option?: NotifyOption) {\r\n this.#addToBuffer('warning', message, option);\r\n }\r\n\r\n error(message: string | string[], option?: NotifyOption) {\r\n this.#addToBuffer('error', message, option);\r\n }\r\n\r\n remove(id: string) {\r\n this.toasts.update((current) => current.filter((t) => t.id !== id));\r\n }\r\n\r\n clearAll() {\r\n this.toasts.set([]);\r\n this.#clearAllTimers();\r\n }\r\n\r\n clearByType(type: ToastType) {\r\n this.toasts.update((current) => current.filter((t) => t.type !== type));\r\n }\r\n\r\n // Private helpers\r\n #addImmediate(type: ToastType, message: string, option?: NotifyOption) {\r\n const newToast: ToastData = {\r\n id: Utilities.generateUuid(),\r\n type,\r\n message,\r\n title: option?.title,\r\n duration: option?.duration ?? this.#DEFAULT_SUCCESS_DURATION,\r\n actionLabel: option?.actionLabel,\r\n onAction: option?.onAction,\r\n html: option?.html\r\n };\r\n\r\n this.toasts.update((current) => {\r\n const updated = [newToast, ...current];\r\n return updated.slice(0, this.#MAX_TOASTS);\r\n });\r\n }\r\n\r\n #addToBuffer(type: ToastType, message: string | string[], option?: NotifyOption) {\r\n if (!this.#buffer[type]) {\r\n this.#buffer[type] = [];\r\n }\r\n \r\n const msgs = Array.isArray(message) ? message : [message];\r\n this.#buffer[type].push(...msgs);\r\n\r\n // Clear existing timer and set new one\r\n if (this.#timers[type]) {\r\n clearTimeout(this.#timers[type]!);\r\n }\r\n\r\n this.#timers[type] = setTimeout(() => {\r\n this.#flushBuffer(type, option);\r\n }, this.#DEBOUNCE_TIME);\r\n }\r\n\r\n #flushBuffer(type: ToastType, option?: NotifyOption) {\r\n const messages = [...new Set(this.#buffer[type])];\r\n \r\n // Cleanup\r\n this.#buffer[type] = [];\r\n this.#timers[type] = null;\r\n\r\n if (messages.length === 0) return;\r\n\r\n const typeLabel = type === 'error' ? 'Error' : 'Warning';\r\n const title = option?.title ?? typeLabel;\r\n const finalTitle = messages.length > 1 ? `${title} (${messages.length})` : title;\r\n\r\n const newToast: ToastData = {\r\n id: Utilities.generateUuid(),\r\n type,\r\n message: messages.length === 1 ? messages[0] : messages, \r\n title: finalTitle,\r\n duration: option?.duration ?? this.#DEFAULT_BUFFERED_DURATION,\r\n actionLabel: option?.actionLabel,\r\n onAction: option?.onAction,\r\n html: option?.html\r\n };\r\n\r\n this.toasts.update((current) => {\r\n const updated = [newToast, ...current];\r\n return updated.slice(0, this.#MAX_TOASTS);\r\n });\r\n }\r\n\r\n #clearAllTimers() {\r\n Object.values(this.#timers).forEach(timer => {\r\n if (timer) clearTimeout(timer);\r\n });\r\n this.#timers = {};\r\n }\r\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.SdNotifyService"],"mappings":";;;;;;;;MAmCa,cAAc,CAAA;AAYf,IAAA,aAAA;AACA,IAAA,SAAA;AAZiB,IAAA,IAAI;AAE/B,IAAA,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC;IACjB,QAAQ,GAAG,CAAC;;AAGb,IAAA,KAAK;AACL,IAAA,KAAK;AACL,IAAA,SAAS;IAEjB,WAAA,CACU,aAA8B,EAC9B,SAAuB,EAAA;QADvB,IAAA,CAAA,aAAa,GAAb,aAAa;QACb,IAAA,CAAA,SAAS,GAAT,SAAS;IAChB;AAEH;;;;;AAKG;AACH,IAAA,YAAY,CAAC,KAAa,EAAA;AACxB,QAAA,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE;IACnE;;AAGA,IAAA,IAAI,aAAa,GAAA;AACf,QAAA,OAAO,IAAI,CAAC,IAAI,CAAC,OAAiB;IACpC;IAEA,QAAQ,GAAA;;QAEN,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ;;QAEnC,IAAI,CAAC,WAAW,EAAE;IACpB;IAEA,WAAW,GAAA;AACT,QAAA,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;IAC1B;;IAKA,UAAU,GAAA;AACR,QAAA,IAAI,IAAI,CAAC,KAAK,EAAE;;AAEd,YAAA,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;AACxB,YAAA,IAAI,CAAC,KAAK,GAAG,IAAI;;YAEjB,IAAI,CAAC,SAAS,IAAI,IAAI,C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Optional, Injectable } from '@angular/core';
3
- import { SdUtilities } from '@sd-angular/core/utilities';
3
+ import { Utilities } from '@sdcorejs/utils/fns';
4
4
  import { BehaviorSubject } from 'rxjs';
5
5
  import { map } from 'rxjs/operators';
6
6
 
@@ -24,7 +24,7 @@ class SdStorageService {
24
24
  hashKey = key;
25
25
  }
26
26
  else if (typeof key === 'object') {
27
- hashKey = SdUtilities.hash(key);
27
+ hashKey = Utilities.hash(key);
28
28
  }
29
29
  else {
30
30
  throw new Error('Invalid key type');
@@ -1 +1 @@
1
- {"version":3,"file":"sd-angular-core-services-storage.mjs","sources":["../../../projects/sd-angular/services/storage/src/storage.model.ts","../../../projects/sd-angular/services/storage/src/storage.service.ts","../../../projects/sd-angular/services/storage/sd-angular-core-services-storage.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\r\nimport { BehaviorSubject, Observable } from 'rxjs';\r\n\r\nexport interface SdStorageOption<T = any> {\r\n type?: 'session';\r\n default?: T;\r\n args?: Record<string, any>;\r\n}\r\n\r\nexport interface SdStorage<T = any> {\r\n get: () => T;\r\n set: (data: T) => void;\r\n // Ghi vào storage nhưng KHÔNG emit subject. Dùng cho thay đổi UI-only\r\n // (vd: column width) để tránh re-trigger các subscriber gây reload data.\r\n setSilent: (data: T) => void;\r\n has: () => boolean;\r\n remove: () => void;\r\n subject: BehaviorSubject<T>;\r\n observer: Observable<T>;\r\n}\r\n\r\nexport interface ISdStorageConfiguration {\r\n key?: (key: string) => string;\r\n}\r\n\r\nexport const SD_STORAGE_CONFIG = new InjectionToken<ISdStorageConfiguration>('storage.configuration');\r\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport { Inject, Injectable, Optional } from '@angular/core';\r\nimport { SdUtilities } from '@sd-angular/core/utilities';\r\nimport { BehaviorSubject } from 'rxjs';\r\nimport { map } from 'rxjs/operators';\r\nimport { ISdStorageConfiguration, SD_STORAGE_CONFIG, SdStorage, SdStorageOption } from './storage.model';\r\n\r\ninterface StorageCacheEntry<T> {\r\n data: T;\r\n createdOn: Date;\r\n}\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class SdStorageService {\r\n // Dùng Map để quản lý bộ nhớ tốt hơn Record\r\n #memoryCache = new Map<string, StorageCacheEntry<any>>();\r\n #subjects = new Map<string, BehaviorSubject<any>>();\r\n\r\n constructor(\r\n @Inject(SD_STORAGE_CONFIG)\r\n @Optional()\r\n private configuration: ISdStorageConfiguration\r\n ) {}\r\n\r\n create<T = any>(key: string | object, option?: SdStorageOption<T>): SdStorage<T> {\r\n if (!key) throw new Error('Key is required');\r\n\r\n // 1. Xử lý Key\r\n let hashKey: string;\r\n if (typeof key === 'string') {\r\n hashKey = key;\r\n } else if (typeof key === 'object') {\r\n hashKey = SdUtilities.hash(key);\r\n } else {\r\n throw new Error('Invalid key type');\r\n }\r\n\r\n if (this.configuration?.key) {\r\n hashKey = this.configuration.key(hashKey);\r\n }\r\n\r\n // 2. Init Subject: Đọc dữ liệu từ Storage ngay lập tức để Subject có giá trị đúng\r\n if (!this.#subjects.has(hashKey)) {\r\n const existingData = this.#internalGet<T>(hashKey, option);\r\n // Fix Type: as T | undefined\r\n this.#subjects.set(hashKey, new BehaviorSubject<T | undefined>(existingData ?? option?.default));\r\n }\r\n\r\n const subject = this.#subjects.get(hashKey)!;\r\n\r\n // 3. Define Helpers\r\n const get = () => {\r\n const val = this.#internalGet<T>(hashKey, option);\r\n return (val ?? option?.default) as T;\r\n };\r\n\r\n const set = (data: T) => {\r\n this.#internalSet(hashKey, data, option);\r\n subject.next(data);\r\n };\r\n\r\n const setSilent = (data: T) => {\r\n this.#internalSet(hashKey, data, option);\r\n // Cố tình KHÔNG gọi subject.next — consumer dùng kênh riêng để thông báo\r\n };\r\n\r\n const has = () => {\r\n return this.#internalGet<T>(hashKey, option) !== undefined;\r\n };\r\n\r\n const remove = () => {\r\n this.#internalRemove(hashKey, option);\r\n subject.next(undefined);\r\n };\r\n\r\n // Hàm dọn dẹp bộ nhớ (quan trọng)\r\n const destroy = () => {\r\n subject.complete();\r\n this.#subjects.delete(hashKey);\r\n this.#memoryCache.delete(hashKey);\r\n };\r\n\r\n return {\r\n get,\r\n set,\r\n setSilent,\r\n has,\r\n remove,\r\n // @ts-ignore: Bổ sung vào interface nếu cần\r\n destroy,\r\n subject: subject,\r\n observer: subject.asObservable().pipe(map(() => get())),\r\n };\r\n }\r\n\r\n // --- PRIVATE CORE LOGIC ---\r\n\r\n /**\r\n * Helper xác định loại Storage đang dùng\r\n */\r\n #getStorage(option?: SdStorageOption<any>): Storage {\r\n return option?.type === 'session' ? sessionStorage : localStorage;\r\n }\r\n\r\n /**\r\n * Đọc dữ liệu: Memory -> Storage -> Parse\r\n */\r\n #internalGet<T>(key: string, option?: SdStorageOption<T>): T | undefined {\r\n // 1. Check Memory (Nhanh nhất)\r\n let entry = this.#memoryCache.get(key);\r\n\r\n // 2. Check Storage (Nếu memory chưa có hoặc mới F5)\r\n if (!entry) {\r\n const storage = this.#getStorage(option);\r\n const raw = storage.getItem(key);\r\n if (raw) {\r\n try {\r\n const parsed = JSON.parse(raw);\r\n // Convert string date back to Date object nếu cần\r\n entry = {\r\n data: parsed.data,\r\n createdOn: new Date(parsed.createdOn)\r\n };\r\n // Sync ngược vào RAM\r\n this.#memoryCache.set(key, entry);\r\n } catch (e) {\r\n console.warn('Storage parse error', e);\r\n this.#internalRemove(key, option); // Dữ liệu lỗi -> Xóa\r\n }\r\n }\r\n }\r\n\r\n if (!entry) return undefined;\r\n\r\n return this.#deepClone(entry.data);\r\n }\r\n\r\n /**\r\n * Ghi dữ liệu: Memory -> Storage\r\n */\r\n #internalSet<T>(key: string, data: T, option?: SdStorageOption<T>): void {\r\n const clonedData = this.#deepClone(data);\r\n\r\n const entry: StorageCacheEntry<T> = {\r\n data: clonedData,\r\n createdOn: new Date(),\r\n };\r\n\r\n // 1. Lưu Memory\r\n this.#memoryCache.set(key, entry);\r\n\r\n // 2. Lưu Storage\r\n const storage = this.#getStorage(option);\r\n try {\r\n storage.setItem(key, JSON.stringify(entry));\r\n } catch (e) {\r\n console.error('Storage quota exceeded', e);\r\n }\r\n }\r\n\r\n /**\r\n * Xóa dữ liệu\r\n */\r\n #internalRemove(key: string, option?: SdStorageOption<any>): void {\r\n this.#memoryCache.delete(key);\r\n const storage = this.#getStorage(option);\r\n storage.removeItem(key);\r\n }\r\n\r\n /**\r\n * Deep Clone an toàn\r\n */\r\n #deepClone<T>(val: T): T {\r\n if (val === undefined || val === null) return val;\r\n return JSON.parse(JSON.stringify(val));\r\n }\r\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAyBa,iBAAiB,GAAG,IAAI,cAAc,CAA0B,uBAAuB;;ACzBpG;MAea,gBAAgB,CAAA;AAQjB,IAAA,aAAA;;AANV,IAAA,YAAY,GAAG,IAAI,GAAG,EAAkC;AACxD,IAAA,SAAS,GAAG,IAAI,GAAG,EAAgC;AAEnD,IAAA,WAAA,CAGU,aAAsC,EAAA;QAAtC,IAAA,CAAA,aAAa,GAAb,aAAa;IACpB;IAEH,MAAM,CAAU,GAAoB,EAAE,MAA2B,EAAA;AAC/D,QAAA,IAAI,CAAC,GAAG;AAAE,YAAA,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC;;AAG5C,QAAA,IAAI,OAAe;AACnB,QAAA,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YAC3B,OAAO,GAAG,GAAG;QACf;AAAO,aAAA,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;AAClC,YAAA,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC;QACjC;aAAO;AACL,YAAA,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC;QACrC;AAEA,QAAA,IAAI,IAAI,CAAC,aAAa,EAAE,GAAG,EAAE;YAC3B,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC;QAC3C;;QAGA,IAAI,CAAC,IAAI,C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gB,kBAMjB,iBAAiB,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AANhB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,cAFf,MAAM,EAAA,CAAA;;4FAEP,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAH5B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;0BAOI,MAAM;2BAAC,iBAAiB;;0BACxB;;;ACtBL;;AAEG;;;;"}
1
+ {"version":3,"file":"sd-angular-core-services-storage.mjs","sources":["../../../projects/sd-angular/services/storage/src/storage.model.ts","../../../projects/sd-angular/services/storage/src/storage.service.ts","../../../projects/sd-angular/services/storage/sd-angular-core-services-storage.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\r\nimport { BehaviorSubject, Observable } from 'rxjs';\r\n\r\nexport interface SdStorageOption<T = any> {\r\n type?: 'session';\r\n default?: T;\r\n args?: Record<string, any>;\r\n}\r\n\r\nexport interface SdStorage<T = any> {\r\n get: () => T;\r\n set: (data: T) => void;\r\n // Ghi vào storage nhưng KHÔNG emit subject. Dùng cho thay đổi UI-only\r\n // (vd: column width) để tránh re-trigger các subscriber gây reload data.\r\n setSilent: (data: T) => void;\r\n has: () => boolean;\r\n remove: () => void;\r\n subject: BehaviorSubject<T>;\r\n observer: Observable<T>;\r\n}\r\n\r\nexport interface ISdStorageConfiguration {\r\n key?: (key: string) => string;\r\n}\r\n\r\nexport const SD_STORAGE_CONFIG = new InjectionToken<ISdStorageConfiguration>('storage.configuration');\r\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport { Inject, Injectable, Optional } from '@angular/core';\r\nimport { Utilities } from '@sdcorejs/utils/fns';\r\nimport { BehaviorSubject } from 'rxjs';\r\nimport { map } from 'rxjs/operators';\r\nimport { ISdStorageConfiguration, SD_STORAGE_CONFIG, SdStorage, SdStorageOption } from './storage.model';\r\n\r\ninterface StorageCacheEntry<T> {\r\n data: T;\r\n createdOn: Date;\r\n}\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class SdStorageService {\r\n // Dùng Map để quản lý bộ nhớ tốt hơn Record\r\n #memoryCache = new Map<string, StorageCacheEntry<any>>();\r\n #subjects = new Map<string, BehaviorSubject<any>>();\r\n\r\n constructor(\r\n @Inject(SD_STORAGE_CONFIG)\r\n @Optional()\r\n private configuration: ISdStorageConfiguration\r\n ) {}\r\n\r\n create<T = any>(key: string | object, option?: SdStorageOption<T>): SdStorage<T> {\r\n if (!key) throw new Error('Key is required');\r\n\r\n // 1. Xử lý Key\r\n let hashKey: string;\r\n if (typeof key === 'string') {\r\n hashKey = key;\r\n } else if (typeof key === 'object') {\r\n hashKey = Utilities.hash(key);\r\n } else {\r\n throw new Error('Invalid key type');\r\n }\r\n\r\n if (this.configuration?.key) {\r\n hashKey = this.configuration.key(hashKey);\r\n }\r\n\r\n // 2. Init Subject: Đọc dữ liệu từ Storage ngay lập tức để Subject có giá trị đúng\r\n if (!this.#subjects.has(hashKey)) {\r\n const existingData = this.#internalGet<T>(hashKey, option);\r\n // Fix Type: as T | undefined\r\n this.#subjects.set(hashKey, new BehaviorSubject<T | undefined>(existingData ?? option?.default));\r\n }\r\n\r\n const subject = this.#subjects.get(hashKey)!;\r\n\r\n // 3. Define Helpers\r\n const get = () => {\r\n const val = this.#internalGet<T>(hashKey, option);\r\n return (val ?? option?.default) as T;\r\n };\r\n\r\n const set = (data: T) => {\r\n this.#internalSet(hashKey, data, option);\r\n subject.next(data);\r\n };\r\n\r\n const setSilent = (data: T) => {\r\n this.#internalSet(hashKey, data, option);\r\n // Cố tình KHÔNG gọi subject.next — consumer dùng kênh riêng để thông báo\r\n };\r\n\r\n const has = () => {\r\n return this.#internalGet<T>(hashKey, option) !== undefined;\r\n };\r\n\r\n const remove = () => {\r\n this.#internalRemove(hashKey, option);\r\n subject.next(undefined);\r\n };\r\n\r\n // Hàm dọn dẹp bộ nhớ (quan trọng)\r\n const destroy = () => {\r\n subject.complete();\r\n this.#subjects.delete(hashKey);\r\n this.#memoryCache.delete(hashKey);\r\n };\r\n\r\n return {\r\n get,\r\n set,\r\n setSilent,\r\n has,\r\n remove,\r\n // @ts-ignore: Bổ sung vào interface nếu cần\r\n destroy,\r\n subject: subject,\r\n observer: subject.asObservable().pipe(map(() => get())),\r\n };\r\n }\r\n\r\n // --- PRIVATE CORE LOGIC ---\r\n\r\n /**\r\n * Helper xác định loại Storage đang dùng\r\n */\r\n #getStorage(option?: SdStorageOption<any>): Storage {\r\n return option?.type === 'session' ? sessionStorage : localStorage;\r\n }\r\n\r\n /**\r\n * Đọc dữ liệu: Memory -> Storage -> Parse\r\n */\r\n #internalGet<T>(key: string, option?: SdStorageOption<T>): T | undefined {\r\n // 1. Check Memory (Nhanh nhất)\r\n let entry = this.#memoryCache.get(key);\r\n\r\n // 2. Check Storage (Nếu memory chưa có hoặc mới F5)\r\n if (!entry) {\r\n const storage = this.#getStorage(option);\r\n const raw = storage.getItem(key);\r\n if (raw) {\r\n try {\r\n const parsed = JSON.parse(raw);\r\n // Convert string date back to Date object nếu cần\r\n entry = {\r\n data: parsed.data,\r\n createdOn: new Date(parsed.createdOn)\r\n };\r\n // Sync ngược vào RAM\r\n this.#memoryCache.set(key, entry);\r\n } catch (e) {\r\n console.warn('Storage parse error', e);\r\n this.#internalRemove(key, option); // Dữ liệu lỗi -> Xóa\r\n }\r\n }\r\n }\r\n\r\n if (!entry) return undefined;\r\n\r\n return this.#deepClone(entry.data);\r\n }\r\n\r\n /**\r\n * Ghi dữ liệu: Memory -> Storage\r\n */\r\n #internalSet<T>(key: string, data: T, option?: SdStorageOption<T>): void {\r\n const clonedData = this.#deepClone(data);\r\n\r\n const entry: StorageCacheEntry<T> = {\r\n data: clonedData,\r\n createdOn: new Date(),\r\n };\r\n\r\n // 1. Lưu Memory\r\n this.#memoryCache.set(key, entry);\r\n\r\n // 2. Lưu Storage\r\n const storage = this.#getStorage(option);\r\n try {\r\n storage.setItem(key, JSON.stringify(entry));\r\n } catch (e) {\r\n console.error('Storage quota exceeded', e);\r\n }\r\n }\r\n\r\n /**\r\n * Xóa dữ liệu\r\n */\r\n #internalRemove(key: string, option?: SdStorageOption<any>): void {\r\n this.#memoryCache.delete(key);\r\n const storage = this.#getStorage(option);\r\n storage.removeItem(key);\r\n }\r\n\r\n /**\r\n * Deep Clone an toàn\r\n */\r\n #deepClone<T>(val: T): T {\r\n if (val === undefined || val === null) return val;\r\n return JSON.parse(JSON.stringify(val));\r\n }\r\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAyBa,iBAAiB,GAAG,IAAI,cAAc,CAA0B,uBAAuB;;ACzBpG;MAea,gBAAgB,CAAA;AAQjB,IAAA,aAAA;;AANV,IAAA,YAAY,GAAG,IAAI,GAAG,EAAkC;AACxD,IAAA,SAAS,GAAG,IAAI,GAAG,EAAgC;AAEnD,IAAA,WAAA,CAGU,aAAsC,EAAA;QAAtC,IAAA,CAAA,aAAa,GAAb,aAAa;IACpB;IAEH,MAAM,CAAU,GAAoB,EAAE,MAA2B,EAAA;AAC/D,QAAA,IAAI,CAAC,GAAG;AAAE,YAAA,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC;;AAG5C,QAAA,IAAI,OAAe;AACnB,QAAA,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YAC3B,OAAO,GAAG,GAAG;QACf;AAAO,aAAA,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;AAClC,YAAA,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC;QAC/B;aAAO;AACL,YAAA,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC;QACrC;AAE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AAlKW,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,kBAMjB,iBAAiB,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AANhB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,cAFf,MAAM,EAAA,CAAA;;4FAEP,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAH5B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;0BAOI,MAAM;2BAAC,iBAAiB;;0BACxB;;;ACtBL;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"sd-angular-core-utilities-models.mjs","sources":["../../../projects/sd-angular/utilities/models/src/icon.model.ts","../../../projects/sd-angular/utilities/models/src/pattern.model.ts","../../../projects/sd-angular/utilities/models/src/empty.model.ts","../../../projects/sd-angular/utilities/models/src/maybe-async.model.ts","../../../projects/sd-angular/utilities/models/src/operator.model.ts","../../../projects/sd-angular/utilities/models/sd-angular-core-utilities-models.ts"],"sourcesContent":["export type MaterialIconFontSet = 'material-icons' | 'material-icons-outlined' | 'material-icons-round' | 'material-icons-sharp' | 'material-symbols-outlined';\nexport const DefaultMaterialIconFontSet: MaterialIconFontSet = 'material-icons-outlined';\n","import type { ValidationPatternType, ValidationPattern } from '@sdcorejs/utils/models';\nimport { VALIDATION_PATTERNS } from '@sdcorejs/utils/constants';\nimport { StringUtilities } from '@sdcorejs/utils/fns';\nexport type { ValidationPatternType, ValidationPattern };\nexport { VALIDATION_PATTERNS };\n\n/**\n * @deprecated Use {@link ValidationPatternType} from `@sdcorejs/utils/models` instead.\n * Note: member names changed — PHONE_VN → VN_PHONE, IDVN → VN_ID, IDVN_OR_PASSPORT → VN_ID_OR_PASSPORT.\n */\nexport type SdPatternType = 'EMAIL' | 'PHONE' | 'PHONE_VN' | 'IDVN' | 'PASSPORT' | 'IDVN_OR_PASSPORT' | 'TIME';\n\n/**\n * @deprecated Use {@link ValidationPattern} from `@sdcorejs/utils/models` instead.\n * Note: `regex` field renamed to `pattern` to align with Angular `Validators.pattern()`.\n */\nexport interface SdPatternCommon {\n type: SdPatternType;\n name: string;\n regex: string;\n errorMessage: string;\n}\n\n// `name` và `errorMessage` chứa i18n KEY (không phải chuỗi đã dịch).\n/** @deprecated Use `VALIDATION_PATTERNS` from `@sdcorejs/utils/constants` instead. */\nexport const SdPatternCommons: SdPatternCommon[] = [\n { type: 'EMAIL', name: 'core.validator.email.name', regex: StringUtilities.REGEX_EMAIL, errorMessage: 'core.validator.email.error' },\n { type: 'PHONE', name: 'core.validator.phone.name', regex: StringUtilities.REGEX_PHONE, errorMessage: 'core.validator.phone.error' },\n { type: 'PHONE_VN', name: 'core.validator.phone-vn.name', regex: StringUtilities.REGEX_VN_PHONE, errorMessage: 'core.validator.phone-vn.error' },\n { type: 'IDVN', name: 'core.validator.cccd.name', regex: StringUtilities.REGEX_VN_ID, errorMessage: 'core.validator.cccd.error' },\n { type: 'PASSPORT', name: 'core.validator.passport.name', regex: StringUtilities.REGEX_PASSPORT, errorMessage: 'core.validator.passport.error' },\n { type: 'IDVN_OR_PASSPORT', name: 'core.validator.id-vn.name', regex: StringUtilities.REGEX_VN_ID_OR_PASSPORT, errorMessage: 'core.validator.id-vn.error' },\n { type: 'TIME', name: 'core.validator.time.name', regex: StringUtilities.REGEX_TIME, errorMessage: 'core.validator.time.error' },\n];\n","import { EMPTY_STR } from '@sdcorejs/utils/constants';\nexport { EMPTY_STR };\n\n/** @deprecated Use {@link EMPTY_STR} from `@sdcorejs/utils/constants` instead */\nexport const SD_EMPTY_STR = EMPTY_STR;\n","import type { MaybeAsync } from '@sdcorejs/utils/models';\nimport { resolveMaybeAsync, normalizeAsync } from '@sdcorejs/utils/models';\nexport type { MaybeAsync };\nexport { resolveMaybeAsync, normalizeAsync };\n\n/** @deprecated Use {@link MaybeAsync} from `@sdcorejs/utils/models` instead */\nexport type SdMaybeAsync<T> = MaybeAsync<T>;\n/** @deprecated Use {@link resolveMaybeAsync} from `@sdcorejs/utils/models` instead */\nexport const SdResolveMaybeAsync = resolveMaybeAsync;\n/** @deprecated Use {@link normalizeAsync} from `@sdcorejs/utils/models` instead */\nexport const SdNormalizeAsync = normalizeAsync;\n","import type { Operator, OperatorHasData, OperatorNoData } from '@sdcorejs/utils/models';\nexport type { Operator, OperatorHasData, OperatorNoData };\n\n/** @deprecated Use {@link Operator} from `@sdcorejs/utils/models` instead */\nexport type SdOperator = Operator;\n/** @deprecated Use {@link OperatorHasData} from `@sdcorejs/utils/models` instead */\nexport type SdOperatorHasData = OperatorHasData;\n/** @deprecated Use {@link OperatorNoData} from `@sdcorejs/utils/models` instead */\nexport type SdOperatorNoData = OperatorNoData;\n\n// `display` chứa i18n KEY (không phải chuỗi đã dịch).\n// Consumer phải gọi i18n.t(display) trước khi render ra UI.\n// @deprecated Use `OPERATORS` from `@sdcorejs/utils/constants` instead.\n// Note: OPERATORS has translated display labels; SdOperators uses i18n keys.\nexport const SdOperators: {\n value: Operator;\n symbol?: string;\n display: string;\n}[] = [\n { value: 'EQUAL', symbol: '=', display: 'core.operator.equal.display' },\n { value: 'NOT_EQUAL', symbol: '≠', display: 'core.operator.not-equal.display' },\n { value: 'GREATER_THAN', symbol: '>', display: 'core.operator.greater-than.display' },\n { value: 'LESS_THAN', symbol: '<', display: 'core.operator.less-than.display' },\n { value: 'GREATER_OR_EQUAL', symbol: '≥', display: 'core.operator.greater-or-equal.display' },\n { value: 'LESS_OR_EQUAL', symbol: '≤', display: 'core.operator.less-or-equal.display' },\n { value: 'CONTAIN', symbol: 'join_inner', display: 'core.operator.contain.display' },\n { value: 'NOT_CONTAIN', symbol: 'join', display: 'core.operator.not-contain.display' },\n { value: 'START_WITH', symbol: 'line_start_circle', display: 'core.operator.start-with.display' },\n { value: 'END_WITH', symbol: 'line_end_circle', display: 'core.operator.end-with.display' },\n { value: 'IN', symbol: 'checklist_rtl', display: 'core.operator.in.display' },\n { value: 'NOT_IN', symbol: 'event_list', display: 'core.operator.not-in.display' },\n { value: 'NULL', symbol: 'motion_photos_off', display: 'core.operator.null.display' },\n { value: 'NOT_NULL', symbol: 'adjust', display: 'core.operator.not-null.display' },\n];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AACO,MAAM,0BAA0B,GAAwB;;ACsB/D;AACA;AACO,MAAM,gBAAgB,GAAsB;AACjD,IAAA,EAAE,IAAI,EAAE,OAAO,EAAa,IAAI,EAAE,2BAA2B,EAAK,KAAK,EAAE,eAAe,CAAC,WAAW,EAAc,YAAY,EAAE,4BAA4B,EAAE;AAC9J,IAAA,EAAE,IAAI,EAAE,OAAO,EAAa,IAAI,EAAE,2BAA2B,EAAK,KAAK,EAAE,eAAe,CAAC,WAAW,EAAc,YAAY,EAAE,4BAA4B,EAAE;AAC9J,IAAA,EAAE,IAAI,EAAE,UAAU,EAAU,IAAI,EAAE,8BAA8B,EAAE,KAAK,EAAE,eAAe,CAAC,cAAc,EAAW,YAAY,EAAE,+BAA+B,EAAE;AACjK,IAAA,EAAE,IAAI,EAAE,MAAM,EAAc,IAAI,EAAE,0BAA0B,EAAM,KAAK,EAAE,eAAe,CAAC,WAAW,EAAc,YAAY,EAAE,2BAA2B,EAAE;AAC7J,IAAA,EAAE,IAAI,EAAE,UAAU,EAAU,IAAI,EAAE,8BAA8B,EAAE,KAAK,EAAE,eAAe,CAAC,cAAc,EAAW,YAAY,EAAE,+BAA+B,EAAE;AACjK,IAAA,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE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AgC,EAAE;IACrG,EAAE,KAAK,EAAE,IAAI,EAAgB,MAAM,EAAE,eAAe,EAAM,OAAO,EAAE,0BAA0B,EAAE;IAC/F,EAAE,KAAK,EAAE,QAAQ,EAAY,MAAM,EAAE,YAAY,EAAS,OAAO,EAAE,8BAA8B,EAAE;IACnG,EAAE,KAAK,EAAE,MAAM,EAAc,MAAM,EAAE,mBAAmB,EAAE,OAAO,EAAE,4BAA4B,EAAE;IACjG,EAAE,KAAK,EAAE,UAAU,EAAU,MAAM,EAAE,QAAQ,EAAa,OAAO,EAAE,gCAAgC,EAAE;;;AChCvG;;AAEG;;;;"}
1
+ {"version":3,"file":"sd-angular-core-utilities-models.mjs","sources":["../../../projects/sd-angular/utilities/models/src/icon.model.ts","../../../projects/sd-angular/utilities/models/src/pattern.model.ts","../../../projects/sd-angular/utilities/models/src/empty.model.ts","../../../projects/sd-angular/utilities/models/src/maybe-async.model.ts","../../../projects/sd-angular/utilities/models/src/operator.model.ts","../../../projects/sd-angular/utilities/models/sd-angular-core-utilities-models.ts"],"sourcesContent":["export type MaterialIconFontSet = 'material-icons' | 'material-icons-outlined' | 'material-icons-round' | 'material-icons-sharp';\nexport const DefaultMaterialIconFontSet: MaterialIconFontSet = 'material-icons-outlined';\n","import type { ValidationPatternType, ValidationPattern } from '@sdcorejs/utils/models';\nimport { VALIDATION_PATTERNS } from '@sdcorejs/utils/constants';\nimport { StringUtilities } from '@sdcorejs/utils/fns';\nexport type { ValidationPatternType, ValidationPattern };\nexport { VALIDATION_PATTERNS };\n\n/**\n * @deprecated Use {@link ValidationPatternType} from `@sdcorejs/utils/models` instead.\n * Note: member names changed — PHONE_VN → VN_PHONE, IDVN → VN_ID, IDVN_OR_PASSPORT → VN_ID_OR_PASSPORT.\n */\nexport type SdPatternType = 'EMAIL' | 'PHONE' | 'PHONE_VN' | 'IDVN' | 'PASSPORT' | 'IDVN_OR_PASSPORT' | 'TIME';\n\n/**\n * @deprecated Use {@link ValidationPattern} from `@sdcorejs/utils/models` instead.\n * Note: `regex` field renamed to `pattern` to align with Angular `Validators.pattern()`.\n */\nexport interface SdPatternCommon {\n type: SdPatternType;\n name: string;\n regex: string;\n errorMessage: string;\n}\n\n// `name` và `errorMessage` chứa i18n KEY (không phải chuỗi đã dịch).\n/** @deprecated Use `VALIDATION_PATTERNS` from `@sdcorejs/utils/constants` instead. */\nexport const SdPatternCommons: SdPatternCommon[] = [\n { type: 'EMAIL', name: 'core.validator.email.name', regex: StringUtilities.REGEX_EMAIL, errorMessage: 'core.validator.email.error' },\n { type: 'PHONE', name: 'core.validator.phone.name', regex: StringUtilities.REGEX_PHONE, errorMessage: 'core.validator.phone.error' },\n { type: 'PHONE_VN', name: 'core.validator.phone-vn.name', regex: StringUtilities.REGEX_VN_PHONE, errorMessage: 'core.validator.phone-vn.error' },\n { type: 'IDVN', name: 'core.validator.cccd.name', regex: StringUtilities.REGEX_VN_ID, errorMessage: 'core.validator.cccd.error' },\n { type: 'PASSPORT', name: 'core.validator.passport.name', regex: StringUtilities.REGEX_PASSPORT, errorMessage: 'core.validator.passport.error' },\n { type: 'IDVN_OR_PASSPORT', name: 'core.validator.id-vn.name', regex: StringUtilities.REGEX_VN_ID_OR_PASSPORT, errorMessage: 'core.validator.id-vn.error' },\n { type: 'TIME', name: 'core.validator.time.name', regex: StringUtilities.REGEX_TIME, errorMessage: 'core.validator.time.error' },\n];\n","import { EMPTY_STR } from '@sdcorejs/utils/constants';\nexport { EMPTY_STR };\n\n/** @deprecated Use {@link EMPTY_STR} from `@sdcorejs/utils/constants` instead */\nexport const SD_EMPTY_STR = EMPTY_STR;\n","import type { MaybeAsync } from '@sdcorejs/utils/models';\nimport { resolveMaybeAsync, normalizeAsync } from '@sdcorejs/utils/models';\nexport type { MaybeAsync };\nexport { resolveMaybeAsync, normalizeAsync };\n\n/** @deprecated Use {@link MaybeAsync} from `@sdcorejs/utils/models` instead */\nexport type SdMaybeAsync<T> = MaybeAsync<T>;\n/** @deprecated Use {@link resolveMaybeAsync} from `@sdcorejs/utils/models` instead */\nexport const SdResolveMaybeAsync = resolveMaybeAsync;\n/** @deprecated Use {@link normalizeAsync} from `@sdcorejs/utils/models` instead */\nexport const SdNormalizeAsync = normalizeAsync;\n","import type { Operator, OperatorHasData, OperatorNoData } from '@sdcorejs/utils/models';\nexport type { Operator, OperatorHasData, OperatorNoData };\n\n/** @deprecated Use {@link Operator} from `@sdcorejs/utils/models` instead */\nexport type SdOperator = Operator;\n/** @deprecated Use {@link OperatorHasData} from `@sdcorejs/utils/models` instead */\nexport type SdOperatorHasData = OperatorHasData;\n/** @deprecated Use {@link OperatorNoData} from `@sdcorejs/utils/models` instead */\nexport type SdOperatorNoData = OperatorNoData;\n\n// `display` chứa i18n KEY (không phải chuỗi đã dịch).\n// Consumer phải gọi i18n.t(display) trước khi render ra UI.\n// @deprecated Use `OPERATORS` from `@sdcorejs/utils/constants` instead.\n// Note: OPERATORS has translated display labels; SdOperators uses i18n keys.\nexport const SdOperators: {\n value: Operator;\n symbol?: string;\n display: string;\n}[] = [\n { value: 'EQUAL', symbol: '=', display: 'core.operator.equal.display' },\n { value: 'NOT_EQUAL', symbol: '≠', display: 'core.operator.not-equal.display' },\n { value: 'GREATER_THAN', symbol: '>', display: 'core.operator.greater-than.display' },\n { value: 'LESS_THAN', symbol: '<', display: 'core.operator.less-than.display' },\n { value: 'GREATER_OR_EQUAL', symbol: '≥', display: 'core.operator.greater-or-equal.display' },\n { value: 'LESS_OR_EQUAL', symbol: '≤', display: 'core.operator.less-or-equal.display' },\n { value: 'CONTAIN', symbol: 'join_inner', display: 'core.operator.contain.display' },\n { value: 'NOT_CONTAIN', symbol: 'join', display: 'core.operator.not-contain.display' },\n { value: 'START_WITH', symbol: 'line_start_circle', display: 'core.operator.start-with.display' },\n { value: 'END_WITH', symbol: 'line_end_circle', display: 'core.operator.end-with.display' },\n { value: 'IN', symbol: 'checklist_rtl', display: 'core.operator.in.display' },\n { value: 'NOT_IN', symbol: 'event_list', display: 'core.operator.not-in.display' },\n { value: 'NULL', symbol: 'motion_photos_off', display: 'core.operator.null.display' },\n { value: 'NOT_NULL', symbol: 'adjust', display: 'core.operator.not-null.display' },\n];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AACO,MAAM,0BAA0B,GAAwB;;ACsB/D;AACA;AACO,MAAM,gBAAgB,GAAsB;AACjD,IAAA,EAAE,IAAI,EAAE,OAAO,EAAa,IAAI,EAAE,2BAA2B,EAAK,KAAK,EAAE,eAAe,CAAC,WAAW,EAAc,YAAY,EAAE,4BAA4B,EAAE;AAC9J,IAAA,EAAE,IAAI,EAAE,OAAO,EAAa,IAAI,EAAE,2BAA2B,EAAK,KAAK,EAAE,eAAe,CAAC,WAAW,EAAc,YAAY,EAAE,4BAA4B,EAAE;AAC9J,IAAA,EAAE,IAAI,EAAE,UAAU,EAAU,IAAI,EAAE,8BAA8B,EAAE,KAAK,EAAE,eAAe,CAAC,cAAc,EAAW,YAAY,EAAE,+BAA+B,EAAE;AACjK,IAAA,EAAE,IAAI,EAAE,MAAM,EAAc,IAAI,EAAE,0BAA0B,EAAM,KAAK,EAAE,eAAe,CAAC,WAAW,EAAc,YAAY,EAAE,2BAA2B,EAAE;AAC7J,IAAA,EAAE,IAAI,EAAE,UAAU,EAAU,IAAI,EAAE,8BAA8B,EAAE,KAAK,EAAE,eAAe,CAAC,cAAc,EAAW,YAAY,EAAE,+BAA+B,EAAE;AACjK,IAAA,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,2BAA2B,EAAI,KAAK,EAAE,eAAe,CAAC,uBAAuB,EAAE,YAAY,EAAE,4BAA4B,EAAE;AAC7J,IAAA,EAAE,IAAI,EAAE,MAAM,EAAc,IAAI,EAAE,0BAA0B,EAAM,KAAK,EAAE,eAAe,CAAC,UAAU,EAAe,YAAY,EAAE,2BAA2B,EAAE;;;AC7B/J;AACO,MAAM,YAAY,GAAG;;ACG5B;AACO,MAAM,mBAAmB,GAA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