@sdcorejs/angular 19.3.4 → 19.3.6

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 (343) hide show
  1. package/assets/STYLE-GUIDE.md +78 -1
  2. package/assets/THEME.md +45 -3
  3. package/assets/scss/core/_popover-panel.scss +90 -0
  4. package/assets/scss/core/form.scss +5 -2
  5. package/assets/scss/core/utilities/_grid.scss +15 -0
  6. package/assets/scss/core/utilities/_sizing.scss +4 -0
  7. package/assets/scss/themes/_component-tokens.scss +9 -4
  8. package/assets/scss/themes/_semantic.scss +6 -5
  9. package/components/anchor/src/components/anchor/anchor.component.d.ts +6 -1
  10. package/components/button/src/button-item.component.d.ts +7 -1
  11. package/components/calendar/index.d.ts +12 -0
  12. package/components/calendar/src/calendar-edge-scroll.d.ts +27 -0
  13. package/components/calendar/src/calendar-format.d.ts +51 -0
  14. package/components/calendar/src/calendar-host.d.ts +33 -0
  15. package/components/calendar/src/calendar-loader.d.ts +18 -0
  16. package/components/calendar/src/calendar-move.d.ts +189 -0
  17. package/components/calendar/src/calendar.component.d.ts +325 -0
  18. package/components/calendar/src/calendar.configuration.d.ts +24 -0
  19. package/components/calendar/src/calendar.model.d.ts +121 -0
  20. package/components/calendar/src/calendar.templates.d.ts +65 -0
  21. package/components/calendar/src/calendar.utils.d.ts +242 -0
  22. package/components/card/index.d.ts +3 -0
  23. package/components/card/src/card-actions.directive.d.ts +13 -0
  24. package/components/card/src/card-group.component.d.ts +32 -1
  25. package/components/card/src/card.component.d.ts +71 -5
  26. package/components/card/src/card.configuration.d.ts +20 -0
  27. package/components/card/src/card.format.d.ts +50 -0
  28. package/components/card/src/card.model.d.ts +83 -0
  29. package/components/card/src/card.utils.d.ts +5 -0
  30. package/components/file-explorer/src/file-explorer.utils.d.ts +1 -4
  31. package/components/index.d.ts +3 -1
  32. package/components/kanban/src/kanban-card-outlet.d.ts +16 -0
  33. package/components/kanban/src/kanban-loader.d.ts +45 -0
  34. package/components/kanban/src/kanban.component.d.ts +97 -37
  35. package/components/kanban/src/kanban.model.d.ts +93 -37
  36. package/components/kanban/src/kanban.utils.d.ts +38 -5
  37. package/components/modal/src/modal.component.d.ts +15 -1
  38. package/components/query-bar/index.d.ts +1 -0
  39. package/components/query-bar/src/components/actions-bar/actions-bar.component.d.ts +6 -2
  40. package/components/query-bar/src/components/chip-popover/chip-popover.component.d.ts +26 -22
  41. package/components/query-bar/src/components/field-picker/field-picker.component.d.ts +52 -31
  42. package/components/query-bar/src/components/inline-chip/inline-chip.component.d.ts +20 -1
  43. package/components/query-bar/src/components/inline-value-chip/inline-value-chip.component.d.ts +5 -1
  44. package/components/query-bar/src/components/panel/query-panel.d.ts +110 -0
  45. package/components/query-bar/src/components/popover-chip/popover-chip.component.d.ts +15 -8
  46. package/components/query-bar/src/components/saved-filters-menu/saved-filters-menu.component.d.ts +35 -18
  47. package/components/query-bar/src/components/saved-filters-menu/saved-filters-storage.d.ts +13 -0
  48. package/components/query-bar/src/query-bar-chip-text.d.ts +27 -0
  49. package/components/query-bar/src/query-bar-filter.d.ts +8 -0
  50. package/components/query-bar/src/query-bar.component.d.ts +62 -7
  51. package/components/query-bar/src/query-bar.model.d.ts +2 -0
  52. package/components/quick-action/index.d.ts +2 -0
  53. package/components/quick-action/src/selection-bar/selection-bar.component.d.ts +39 -0
  54. package/components/quick-action/src/selection-bar/selection-bar.model.d.ts +24 -0
  55. package/components/scheduler/index.d.ts +4 -0
  56. package/components/scheduler/src/scheduler.component.d.ts +345 -0
  57. package/components/scheduler/src/scheduler.model.d.ts +123 -0
  58. package/components/scheduler/src/scheduler.templates.d.ts +76 -0
  59. package/components/scheduler/src/scheduler.utils.d.ts +99 -0
  60. package/components/tab/src/tab-group.component.d.ts +6 -1
  61. package/components/tab-router/src/utils/tab-activated-route.d.ts +17 -0
  62. package/components/table/src/components/config/config.component.d.ts +69 -1
  63. package/components/table/src/components/filter/mobile-filter/mobile-field-sheet.component.d.ts +35 -0
  64. package/components/table/src/components/filter/mobile-filter/mobile-filter-field.component.d.ts +64 -0
  65. package/components/table/src/components/filter/mobile-filter/mobile-filter-summary.d.ts +11 -0
  66. package/components/table/src/components/filter/mobile-filter/mobile-filter.component.d.ts +47 -15
  67. package/components/table/src/components/filter/quick-search/quick-search.component.d.ts +3 -1
  68. package/components/table/src/components/mobile-cards/mobile-card-data.component.d.ts +45 -0
  69. package/components/table/src/components/mobile-cards/mobile-cards.component.d.ts +13 -1
  70. package/components/table/src/components/mobile-sheet/mobile-sheet.d.ts +35 -0
  71. package/components/table/src/components/mobile-sort/mobile-sort-sheet.component.d.ts +36 -0
  72. package/components/table/src/components/mobile-toolbar/mobile-filter-chips.component.d.ts +49 -0
  73. package/components/table/src/components/mobile-toolbar/mobile-tools-sheet.component.d.ts +48 -0
  74. package/components/table/src/components/mobile-toolbar/pull-refresh.component.d.ts +21 -0
  75. package/components/table/src/components/selector-action/action-filter.pipe.d.ts +3 -24
  76. package/components/table/src/components/selector-action/selector-action.component.d.ts +0 -10
  77. package/components/table/src/configurations/table.configuration.d.ts +53 -2
  78. package/components/table/src/models/index.d.ts +1 -0
  79. package/components/table/src/models/table-mobile.model.d.ts +55 -0
  80. package/components/table/src/models/table-option.model.d.ts +17 -1
  81. package/components/table/src/services/config-custom.util.d.ts +11 -3
  82. package/components/table/src/services/config.service.d.ts +0 -2
  83. package/components/table/src/services/mobile/mobile-view.util.d.ts +77 -0
  84. package/components/table/src/services/table-export/table-export.service.d.ts +2 -0
  85. package/components/table/src/services/table-filter/table-filter-callbacks.util.d.ts +25 -0
  86. package/components/table/src/services/table-filter/table-filter.model.d.ts +21 -2
  87. package/components/table/src/services/table-filter/table-mobile-filter.util.d.ts +54 -0
  88. package/components/table/src/services/table-filter/table-query-bar.util.d.ts +21 -1
  89. package/components/table/src/services/table-query-params/table-query-params.util.d.ts +48 -0
  90. package/components/table/src/table.component.d.ts +78 -11
  91. package/components/timeline/index.d.ts +3 -0
  92. package/components/timeline/src/timeline.component.d.ts +95 -0
  93. package/components/timeline/src/timeline.model.d.ts +82 -0
  94. package/components/timeline/src/timeline.templates.d.ts +28 -0
  95. package/components/timeline/src/timeline.utils.d.ts +41 -0
  96. package/components/tree/index.d.ts +1 -0
  97. package/components/tree/src/tree-empty-def.directive.d.ts +13 -0
  98. package/components/tree/src/tree.component.d.ts +79 -5
  99. package/components/tree/src/tree.model.d.ts +29 -0
  100. package/directives/src/sd-scroll-pointer.service.d.ts +18 -0
  101. package/directives/src/sd-scroll.directive.d.ts +4 -2
  102. package/fesm2022/sdcorejs-angular-components-anchor.mjs +61 -2
  103. package/fesm2022/sdcorejs-angular-components-anchor.mjs.map +1 -1
  104. package/fesm2022/sdcorejs-angular-components-button.mjs +13 -5
  105. package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
  106. package/fesm2022/sdcorejs-angular-components-calendar.mjs +2481 -0
  107. package/fesm2022/sdcorejs-angular-components-calendar.mjs.map +1 -0
  108. package/fesm2022/sdcorejs-angular-components-card.mjs +485 -22
  109. package/fesm2022/sdcorejs-angular-components-card.mjs.map +1 -1
  110. package/fesm2022/sdcorejs-angular-components-editor-engine.mjs +1 -1
  111. package/fesm2022/sdcorejs-angular-components-editor-engine.mjs.map +1 -1
  112. package/fesm2022/sdcorejs-angular-components-file-explorer.mjs +4 -18
  113. package/fesm2022/sdcorejs-angular-components-file-explorer.mjs.map +1 -1
  114. package/fesm2022/sdcorejs-angular-components-form-generic.mjs +7 -7
  115. package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
  116. package/fesm2022/sdcorejs-angular-components-import-excel.mjs +1 -1
  117. package/fesm2022/sdcorejs-angular-components-import-excel.mjs.map +1 -1
  118. package/fesm2022/sdcorejs-angular-components-kanban.mjs +832 -153
  119. package/fesm2022/sdcorejs-angular-components-kanban.mjs.map +1 -1
  120. package/fesm2022/sdcorejs-angular-components-modal.mjs +66 -13
  121. package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
  122. package/fesm2022/sdcorejs-angular-components-query-bar.mjs +1469 -357
  123. package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
  124. package/fesm2022/sdcorejs-angular-components-quick-action.mjs +68 -2
  125. package/fesm2022/sdcorejs-angular-components-quick-action.mjs.map +1 -1
  126. package/fesm2022/sdcorejs-angular-components-scheduler.mjs +1934 -0
  127. package/fesm2022/sdcorejs-angular-components-scheduler.mjs.map +1 -0
  128. package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +2 -2
  129. package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
  130. package/fesm2022/sdcorejs-angular-components-tab-router.mjs +126 -26
  131. package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
  132. package/fesm2022/sdcorejs-angular-components-tab.mjs +30 -1
  133. package/fesm2022/sdcorejs-angular-components-tab.mjs.map +1 -1
  134. package/fesm2022/sdcorejs-angular-components-table.mjs +5943 -3666
  135. package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
  136. package/fesm2022/sdcorejs-angular-components-timeline.mjs +473 -0
  137. package/fesm2022/sdcorejs-angular-components-timeline.mjs.map +1 -0
  138. package/fesm2022/sdcorejs-angular-components-tree.mjs +596 -35
  139. package/fesm2022/sdcorejs-angular-components-tree.mjs.map +1 -1
  140. package/fesm2022/sdcorejs-angular-components-upload-file.mjs +2 -4
  141. package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
  142. package/fesm2022/sdcorejs-angular-components.mjs +3 -1
  143. package/fesm2022/sdcorejs-angular-components.mjs.map +1 -1
  144. package/fesm2022/sdcorejs-angular-directives.mjs +109 -22
  145. package/fesm2022/sdcorejs-angular-directives.mjs.map +1 -1
  146. package/fesm2022/sdcorejs-angular-forms-date.mjs +140 -42
  147. package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
  148. package/fesm2022/sdcorejs-angular-forms-datetime.mjs +70 -21
  149. package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
  150. package/fesm2022/sdcorejs-angular-forms-directives.mjs +4 -3
  151. package/fesm2022/sdcorejs-angular-forms-directives.mjs.map +1 -1
  152. package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs +1 -1
  153. package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs.map +1 -1
  154. package/fesm2022/sdcorejs-angular-forms-select.mjs +23 -4
  155. package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
  156. package/fesm2022/sdcorejs-angular-forms-tree-select.mjs +1 -1
  157. package/fesm2022/sdcorejs-angular-forms-tree-select.mjs.map +1 -1
  158. package/fesm2022/sdcorejs-angular-i18n.mjs +812 -52
  159. package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
  160. package/fesm2022/{sdcorejs-angular-modules-generic-generic-configuration.page-Bk3PrEf3.mjs → sdcorejs-angular-modules-generic-generic-configuration.page-DHrM12Z3.mjs} +3 -3
  161. package/fesm2022/{sdcorejs-angular-modules-generic-generic-configuration.page-Bk3PrEf3.mjs.map → sdcorejs-angular-modules-generic-generic-configuration.page-DHrM12Z3.mjs.map} +1 -1
  162. package/fesm2022/{sdcorejs-angular-modules-generic-generic-form-host.page-CwUegGgG.mjs → sdcorejs-angular-modules-generic-generic-form-host.page-f7ysKltl.mjs} +2 -2
  163. package/fesm2022/{sdcorejs-angular-modules-generic-generic-form-host.page-CwUegGgG.mjs.map → sdcorejs-angular-modules-generic-generic-form-host.page-f7ysKltl.mjs.map} +1 -1
  164. package/fesm2022/{sdcorejs-angular-modules-generic-generic-list.page-lF2trhfp.mjs → sdcorejs-angular-modules-generic-generic-list.page-BdGxuquq.mjs} +3 -3
  165. package/fesm2022/{sdcorejs-angular-modules-generic-generic-list.page-lF2trhfp.mjs.map → sdcorejs-angular-modules-generic-generic-list.page-BdGxuquq.mjs.map} +1 -1
  166. package/fesm2022/{sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-BbmeOduc.mjs → sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-DtPfIB97.mjs} +4 -4
  167. package/fesm2022/{sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-BbmeOduc.mjs.map → sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-DtPfIB97.mjs.map} +1 -1
  168. package/fesm2022/sdcorejs-angular-modules-generic.mjs +1 -1
  169. package/fesm2022/sdcorejs-angular-modules-layout.mjs +17 -8
  170. package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
  171. package/fesm2022/{sdcorejs-angular-modules-pattern-base-api.service-DK33LxHm.mjs → sdcorejs-angular-modules-pattern-base-api.service-Bj3iKGg_.mjs} +2 -2
  172. package/fesm2022/{sdcorejs-angular-modules-pattern-base-api.service-DK33LxHm.mjs.map → sdcorejs-angular-modules-pattern-base-api.service-Bj3iKGg_.mjs.map} +1 -1
  173. package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-CPwGkrNk.mjs → sdcorejs-angular-modules-pattern-create.component-C27vASfj.mjs} +11 -7
  174. package/fesm2022/sdcorejs-angular-modules-pattern-create.component-C27vASfj.mjs.map +1 -0
  175. package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-VCbA_FkZ.mjs → sdcorejs-angular-modules-pattern-create.component-C63mUjRM.mjs} +2 -2
  176. package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-VCbA_FkZ.mjs.map → sdcorejs-angular-modules-pattern-create.component-C63mUjRM.mjs.map} +1 -1
  177. package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-Bi2tMFHf.mjs → sdcorejs-angular-modules-pattern-create.component-DYn8jkTD.mjs} +2 -2
  178. package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-Bi2tMFHf.mjs.map → sdcorejs-angular-modules-pattern-create.component-DYn8jkTD.mjs.map} +1 -1
  179. package/fesm2022/{sdcorejs-angular-modules-pattern-customer.service-CehsdBRP.mjs → sdcorejs-angular-modules-pattern-customer.service-BNVk2VIb.mjs} +2 -2
  180. package/fesm2022/{sdcorejs-angular-modules-pattern-customer.service-CehsdBRP.mjs.map → sdcorejs-angular-modules-pattern-customer.service-BNVk2VIb.mjs.map} +1 -1
  181. package/fesm2022/{sdcorejs-angular-modules-pattern-detail.component-5kI7wGdX.mjs → sdcorejs-angular-modules-pattern-detail.component-Bh8UD7ft.mjs} +57 -54
  182. package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-Bh8UD7ft.mjs.map +1 -0
  183. package/fesm2022/{sdcorejs-angular-modules-pattern-detail.component-CjAy-B9K.mjs → sdcorejs-angular-modules-pattern-detail.component-S7x8j9i5.mjs} +2 -2
  184. package/fesm2022/{sdcorejs-angular-modules-pattern-detail.component-CjAy-B9K.mjs.map → sdcorejs-angular-modules-pattern-detail.component-S7x8j9i5.mjs.map} +1 -1
  185. package/fesm2022/{sdcorejs-angular-modules-pattern-flow.component-DObN_wCR.mjs → sdcorejs-angular-modules-pattern-flow.component-CHtskh2X.mjs} +3 -3
  186. package/fesm2022/{sdcorejs-angular-modules-pattern-flow.component-DObN_wCR.mjs.map → sdcorejs-angular-modules-pattern-flow.component-CHtskh2X.mjs.map} +1 -1
  187. package/fesm2022/{sdcorejs-angular-modules-pattern-index.component-TTrWCXIT.mjs → sdcorejs-angular-modules-pattern-index.component-W8icBRPe.mjs} +2 -2
  188. package/fesm2022/{sdcorejs-angular-modules-pattern-index.component-TTrWCXIT.mjs.map → sdcorejs-angular-modules-pattern-index.component-W8icBRPe.mjs.map} +1 -1
  189. package/fesm2022/{sdcorejs-angular-modules-pattern-lines-table-form.component-B1qePLfk.mjs → sdcorejs-angular-modules-pattern-lines-table-form.component-DEwUiNkq.mjs} +5 -5
  190. package/fesm2022/{sdcorejs-angular-modules-pattern-lines-table-form.component-B1qePLfk.mjs.map → sdcorejs-angular-modules-pattern-lines-table-form.component-DEwUiNkq.mjs.map} +1 -1
  191. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-8m-QmfUX.mjs +501 -0
  192. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-8m-QmfUX.mjs.map +1 -0
  193. package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-W9vY7HrT.mjs → sdcorejs-angular-modules-pattern-list.component-BDEm2v0W.mjs} +3 -3
  194. package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-W9vY7HrT.mjs.map → sdcorejs-angular-modules-pattern-list.component-BDEm2v0W.mjs.map} +1 -1
  195. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-BgwTyRhE.mjs +506 -0
  196. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-BgwTyRhE.mjs.map +1 -0
  197. package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-CJ38CJXg.mjs → sdcorejs-angular-modules-pattern-list.component-BhFkL7tX.mjs} +30 -39
  198. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-BhFkL7tX.mjs.map +1 -0
  199. package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-BY5gjtNS.mjs → sdcorejs-angular-modules-pattern-list.component-j7ZFxvlG.mjs} +3 -3
  200. package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-BY5gjtNS.mjs.map → sdcorejs-angular-modules-pattern-list.component-j7ZFxvlG.mjs.map} +1 -1
  201. package/fesm2022/{sdcorejs-angular-modules-pattern-mock-backend.factory-CI0H_5a4.mjs → sdcorejs-angular-modules-pattern-mock-backend.factory-CPAV_J3j.mjs} +2 -2
  202. package/fesm2022/{sdcorejs-angular-modules-pattern-mock-backend.factory-CI0H_5a4.mjs.map → sdcorejs-angular-modules-pattern-mock-backend.factory-CPAV_J3j.mjs.map} +1 -1
  203. package/fesm2022/{sdcorejs-angular-modules-pattern-pattern-source-viewer-BqHwKfoc.mjs → sdcorejs-angular-modules-pattern-pattern-source-viewer-DuhyXsGn.mjs} +4 -22
  204. package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-DuhyXsGn.mjs.map +1 -0
  205. package/fesm2022/{sdcorejs-angular-modules-pattern-pattern-source.generated-CIiLOizq.mjs → sdcorejs-angular-modules-pattern-pattern-source.generated-bfpj85ke.mjs} +26 -27
  206. package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-bfpj85ke.mjs.map +1 -0
  207. package/fesm2022/{sdcorejs-angular-modules-pattern-product.service-D829aEk5.mjs → sdcorejs-angular-modules-pattern-product.service-B9Dc2NUr.mjs} +2 -2
  208. package/fesm2022/{sdcorejs-angular-modules-pattern-product.service-D829aEk5.mjs.map → sdcorejs-angular-modules-pattern-product.service-B9Dc2NUr.mjs.map} +1 -1
  209. package/fesm2022/{sdcorejs-angular-modules-pattern-profile.component-BEFVmSSj.mjs → sdcorejs-angular-modules-pattern-profile.component-097Hf7Bc.mjs} +24 -14
  210. package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-097Hf7Bc.mjs.map +1 -0
  211. package/fesm2022/{sdcorejs-angular-modules-pattern-routes-B-TJUSV_.mjs → sdcorejs-angular-modules-pattern-routes-CahNEP9-.mjs} +5 -5
  212. package/fesm2022/{sdcorejs-angular-modules-pattern-routes-B-TJUSV_.mjs.map → sdcorejs-angular-modules-pattern-routes-CahNEP9-.mjs.map} +1 -1
  213. package/fesm2022/sdcorejs-angular-modules-pattern-routes-CjfWGMvJ.mjs +65 -0
  214. package/fesm2022/sdcorejs-angular-modules-pattern-routes-CjfWGMvJ.mjs.map +1 -0
  215. package/fesm2022/{sdcorejs-angular-modules-pattern-routes-1kDb9T7_.mjs → sdcorejs-angular-modules-pattern-routes-DeE5hp5x.mjs} +4 -4
  216. package/fesm2022/{sdcorejs-angular-modules-pattern-routes-1kDb9T7_.mjs.map → sdcorejs-angular-modules-pattern-routes-DeE5hp5x.mjs.map} +1 -1
  217. package/fesm2022/sdcorejs-angular-modules-pattern-routes-Di2ceIlM.mjs +56 -0
  218. package/fesm2022/sdcorejs-angular-modules-pattern-routes-Di2ceIlM.mjs.map +1 -0
  219. package/fesm2022/{sdcorejs-angular-modules-pattern-routes-B6z7KO0P.mjs → sdcorejs-angular-modules-pattern-routes-MEcCUESx.mjs} +3 -3
  220. package/fesm2022/{sdcorejs-angular-modules-pattern-routes-B6z7KO0P.mjs.map → sdcorejs-angular-modules-pattern-routes-MEcCUESx.mjs.map} +1 -1
  221. package/fesm2022/{sdcorejs-angular-modules-pattern-routes-DVlcUUzh.mjs → sdcorejs-angular-modules-pattern-routes-hKorxavO.mjs} +3 -3
  222. package/fesm2022/{sdcorejs-angular-modules-pattern-routes-DVlcUUzh.mjs.map → sdcorejs-angular-modules-pattern-routes-hKorxavO.mjs.map} +1 -1
  223. package/fesm2022/{sdcorejs-angular-modules-pattern-routes-DS39vgzU.mjs → sdcorejs-angular-modules-pattern-routes-sJfnmrVg.mjs} +3 -3
  224. package/fesm2022/{sdcorejs-angular-modules-pattern-routes-DS39vgzU.mjs.map → sdcorejs-angular-modules-pattern-routes-sJfnmrVg.mjs.map} +1 -1
  225. package/fesm2022/{sdcorejs-angular-modules-pattern-routes-DxWDWUdo.mjs → sdcorejs-angular-modules-pattern-routes-ygWsDRk9.mjs} +8 -8
  226. package/fesm2022/{sdcorejs-angular-modules-pattern-routes-DxWDWUdo.mjs.map → sdcorejs-angular-modules-pattern-routes-ygWsDRk9.mjs.map} +1 -1
  227. package/fesm2022/{sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-nV5dVFx2.mjs → sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-C5IG0tkk.mjs} +12 -12
  228. package/fesm2022/{sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-nV5dVFx2.mjs.map → sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-C5IG0tkk.mjs.map} +1 -1
  229. package/fesm2022/{sdcorejs-angular-modules-pattern-shell.component-0rRaWsuo.mjs → sdcorejs-angular-modules-pattern-shell.component-BPgXiYkB.mjs} +4 -4
  230. package/fesm2022/{sdcorejs-angular-modules-pattern-shell.component-0rRaWsuo.mjs.map → sdcorejs-angular-modules-pattern-shell.component-BPgXiYkB.mjs.map} +1 -1
  231. package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-DF0pm6_f.mjs +480 -0
  232. package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-DF0pm6_f.mjs.map +1 -0
  233. package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-DkAcDmsZ.mjs → sdcorejs-angular-modules-pattern-update.component-BXBxoTdB.mjs} +2 -2
  234. package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-DkAcDmsZ.mjs.map → sdcorejs-angular-modules-pattern-update.component-BXBxoTdB.mjs.map} +1 -1
  235. package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-BmsOgENL.mjs → sdcorejs-angular-modules-pattern-update.component-DS253vcu.mjs} +2 -2
  236. package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-BmsOgENL.mjs.map → sdcorejs-angular-modules-pattern-update.component-DS253vcu.mjs.map} +1 -1
  237. package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-DPZ_ucNB.mjs → sdcorejs-angular-modules-pattern-update.component-OOYioclV.mjs} +9 -6
  238. package/fesm2022/sdcorejs-angular-modules-pattern-update.component-OOYioclV.mjs.map +1 -0
  239. package/fesm2022/sdcorejs-angular-modules-pattern.mjs +1 -1
  240. package/fesm2022/sdcorejs-angular-services-confirm.mjs +171 -158
  241. package/fesm2022/sdcorejs-angular-services-confirm.mjs.map +1 -1
  242. package/fesm2022/sdcorejs-angular-services-excel.mjs +34 -0
  243. package/fesm2022/sdcorejs-angular-services-excel.mjs.map +1 -1
  244. package/fesm2022/sdcorejs-angular-services-query-params.mjs +226 -0
  245. package/fesm2022/sdcorejs-angular-services-query-params.mjs.map +1 -0
  246. package/fesm2022/sdcorejs-angular-utilities-extensions.mjs +24 -1
  247. package/fesm2022/sdcorejs-angular-utilities-extensions.mjs.map +1 -1
  248. package/forms/date/src/date.component.d.ts +2 -0
  249. package/forms/directives/src/search-field.component.d.ts +1 -1
  250. package/i18n/src/en.d.ts +159 -9
  251. package/modules/layout/components/page-list/page-list.component.d.ts +2 -1
  252. package/modules/pattern/README.md +5 -4
  253. package/modules/pattern/docs/detail.md +18 -9
  254. package/modules/pattern/docs/drawer.md +185 -83
  255. package/modules/pattern/docs/header-actions.md +1 -1
  256. package/modules/pattern/docs/list.md +3 -3
  257. package/modules/pattern/docs/states.md +1 -1
  258. package/modules/pattern/features/category/components/create-side-drawer/create-side-drawer.component.d.ts +6 -4
  259. package/modules/pattern/features/category/components/create-side-drawer/create-side-drawer.component.ts +12 -16
  260. package/modules/pattern/features/category/components/update-side-drawer/update-side-drawer.component.d.ts +13 -5
  261. package/modules/pattern/features/category/components/update-side-drawer/update-side-drawer.component.ts +58 -29
  262. package/modules/pattern/features/category/pages/list/list.component.d.ts +15 -3
  263. package/modules/pattern/features/category/pages/list/list.component.html +11 -3
  264. package/modules/pattern/features/category/pages/list/list.component.ts +36 -10
  265. package/modules/pattern/features/category/routes.d.ts +4 -1
  266. package/modules/pattern/features/category/routes.ts +5 -22
  267. package/modules/pattern/features/customer/components/create-side-drawer/create-side-drawer.component.d.ts +6 -5
  268. package/modules/pattern/features/customer/components/create-side-drawer/create-side-drawer.component.ts +7 -11
  269. package/modules/pattern/features/customer/components/detail-side-drawer/detail-side-drawer.component.d.ts +20 -8
  270. package/modules/pattern/features/customer/components/detail-side-drawer/detail-side-drawer.component.ts +70 -27
  271. package/modules/pattern/features/customer/components/summary-cards/summary-cards.component.d.ts +5 -3
  272. package/modules/pattern/features/customer/components/summary-cards/summary-cards.component.ts +9 -53
  273. package/modules/pattern/features/customer/components/update-side-drawer/update-side-drawer.component.d.ts +18 -7
  274. package/modules/pattern/features/customer/components/update-side-drawer/update-side-drawer.component.ts +53 -19
  275. package/modules/pattern/features/customer/entity.resolver.d.ts +1 -1
  276. package/modules/pattern/features/customer/entity.resolver.ts +1 -1
  277. package/modules/pattern/features/customer/pages/list/list.component.d.ts +21 -3
  278. package/modules/pattern/features/customer/pages/list/list.component.html +18 -3
  279. package/modules/pattern/features/customer/pages/list/list.component.ts +43 -16
  280. package/modules/pattern/features/customer/pages/profile/profile.component.d.ts +5 -2
  281. package/modules/pattern/features/customer/pages/profile/profile.component.ts +17 -8
  282. package/modules/pattern/features/customer/routes.d.ts +3 -2
  283. package/modules/pattern/features/customer/routes.ts +6 -27
  284. package/modules/pattern/features/order/components/approval-steps/approval-steps.component.d.ts +11 -3
  285. package/modules/pattern/features/order/components/approval-steps/approval-steps.component.ts +37 -56
  286. package/modules/pattern/features/order/components/summary-cards/summary-cards.component.d.ts +7 -4
  287. package/modules/pattern/features/order/components/summary-cards/summary-cards.component.ts +14 -76
  288. package/modules/pattern/features/order/pages/create/create.component.d.ts +1 -1
  289. package/modules/pattern/features/order/pages/create/create.component.ts +7 -3
  290. package/modules/pattern/features/order/pages/detail/detail.component.ts +1 -1
  291. package/modules/pattern/features/order/pages/update/update.component.d.ts +1 -1
  292. package/modules/pattern/features/order/pages/update/update.component.ts +5 -2
  293. package/package.json +36 -24
  294. package/services/confirm/src/lib/components/dialog-confirm/dialog-confirm.component.d.ts +6 -1
  295. package/services/confirm/src/lib/confirm.service.d.ts +23 -12
  296. package/services/confirm/src/public-api.d.ts +0 -1
  297. package/services/excel/src/lib/excel.model.d.ts +29 -0
  298. package/services/excel/src/lib/excel.service.d.ts +30 -0
  299. package/services/query-params/index.d.ts +1 -0
  300. package/services/query-params/src/query-param-sync.d.ts +63 -0
  301. package/utilities/extensions/index.d.ts +1 -0
  302. package/utilities/extensions/src/format-bytes.d.ts +8 -0
  303. package/components/history/index.d.ts +0 -1
  304. package/components/history/models/history.model.d.ts +0 -13
  305. package/components/history/pipes/view-date.pipe.d.ts +0 -9
  306. package/components/history/src/history.component.d.ts +0 -7
  307. package/fesm2022/sdcorejs-angular-components-history.mjs +0 -54
  308. package/fesm2022/sdcorejs-angular-components-history.mjs.map +0 -1
  309. package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-B1BUBiag.mjs +0 -145
  310. package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-B1BUBiag.mjs.map +0 -1
  311. package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-B27ZX8Co.mjs +0 -144
  312. package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-B27ZX8Co.mjs.map +0 -1
  313. package/fesm2022/sdcorejs-angular-modules-pattern-create.component-CPwGkrNk.mjs.map +0 -1
  314. package/fesm2022/sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs +0 -18
  315. package/fesm2022/sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs.map +0 -1
  316. package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-CPhLTiyx.mjs +0 -148
  317. package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-CPhLTiyx.mjs.map +0 -1
  318. package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-5kI7wGdX.mjs.map +0 -1
  319. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-D6eKR2cq.mjs +0 -87
  320. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-D6eKR2cq.mjs.map +0 -1
  321. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-FcJS3Nbd.mjs +0 -232
  322. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-FcJS3Nbd.mjs.map +0 -1
  323. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-BA-3FR1J.mjs +0 -70
  324. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-BA-3FR1J.mjs.map +0 -1
  325. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CJ38CJXg.mjs.map +0 -1
  326. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CdgPtSjJ.mjs +0 -164
  327. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CdgPtSjJ.mjs.map +0 -1
  328. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-DKIwrluh.mjs +0 -118
  329. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-DKIwrluh.mjs.map +0 -1
  330. package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-BqHwKfoc.mjs.map +0 -1
  331. package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-CIiLOizq.mjs.map +0 -1
  332. package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-BEFVmSSj.mjs.map +0 -1
  333. package/fesm2022/sdcorejs-angular-modules-pattern-routes-r9CTj-8C.mjs +0 -74
  334. package/fesm2022/sdcorejs-angular-modules-pattern-routes-r9CTj-8C.mjs.map +0 -1
  335. package/fesm2022/sdcorejs-angular-modules-pattern-routes-xI1XYRo6.mjs +0 -99
  336. package/fesm2022/sdcorejs-angular-modules-pattern-routes-xI1XYRo6.mjs.map +0 -1
  337. package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-6uH7sDEg.mjs +0 -143
  338. package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-6uH7sDEg.mjs.map +0 -1
  339. package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-DglN2sS_.mjs +0 -132
  340. package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-DglN2sS_.mjs.map +0 -1
  341. package/fesm2022/sdcorejs-angular-modules-pattern-update.component-DPZ_ucNB.mjs.map +0 -1
  342. package/modules/pattern/features/category/entity.resolver.d.ts +0 -6
  343. package/modules/pattern/features/category/entity.resolver.ts +0 -27
@@ -1 +1 @@
1
- {"version":3,"file":"sdcorejs-angular-services-confirm.mjs","sources":["../../../projects/sdcorejs-angular/services/confirm/src/lib/components/dialog-confirm/dialog-confirm.component.ts","../../../projects/sdcorejs-angular/services/confirm/src/lib/components/dialog-confirm/dialog-confirm.component.html","../../../projects/sdcorejs-angular/services/confirm/src/lib/confirm.service.ts","../../../projects/sdcorejs-angular/services/confirm/src/public-api.ts","../../../projects/sdcorejs-angular/services/confirm/sdcorejs-angular-services-confirm.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, inject } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';\nimport { SdButton } from '@sdcorejs/angular/components/button';\nimport { SdDate } from '@sdcorejs/angular/forms/date';\nimport { SdDatetime } from '@sdcorejs/angular/forms/datetime';\nimport { SdRadio } from '@sdcorejs/angular/forms/radio';\nimport { SdSelect } from '@sdcorejs/angular/forms/select';\nimport { SdTextarea } from '@sdcorejs/angular/forms/textarea';\nimport { Color } from '@sdcorejs/utils/models';\nimport { Utilities } from '@sdcorejs/utils/fns';\nimport { SD_ICON_CONFIGURATION, SdIcon, type SdIconShape } from '@sdcorejs/angular/modules/icon';\n\nexport interface DialogData {\n icon?: string;\n iconShape?: SdIconShape;\n title?: string;\n message?: string;\n yesTitle?: string;\n noTitle?: string;\n yesButtonColor?: Color;\n noButtonColor?: Color;\n input?: {\n label?: string;\n placeholder?: string;\n minlength?: number;\n maxlength?: number;\n required?: boolean;\n defaultValue?: string;\n };\n date?: {\n required?: boolean;\n placeholder?: string;\n defaultValue?: string | Date;\n min?: string | Date;\n max?: string | Date;\n };\n datetime?: {\n required?: boolean;\n placeholder?: string;\n defaultValue?: string | Date;\n min?: string | Date;\n max?: string | Date;\n showSeconds?: boolean;\n };\n radio?: {\n required?: boolean;\n defaultValue?: string | number;\n items: any[];\n valueField: string;\n displayField: string;\n display?: 'row' | 'column';\n };\n select?: {\n required?: boolean;\n defaultValue?: string | number | (string | number)[];\n items: any[];\n valueField: string;\n displayField: string;\n placeholder?: string;\n multiple?: boolean;\n };\n}\n\n@Component({\n selector: 'sd-dialog-confirm',\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: 'dialog-confirm.component.html',\n styleUrl: './dialog-confirm.component.scss',\n imports: [SdIcon, CommonModule, FormsModule, MatDialogModule, SdButton, SdDate, SdDatetime, SdRadio, SdSelect, SdTextarea],\n})\nexport class DialogConfirmComponent {\n value: any;\n required = false;\n id = `I${Utilities.generateUuid()}`;\n public readonly dialogRef = inject(MatDialogRef<DialogConfirmComponent>);\n public readonly data = inject<DialogData>(MAT_DIALOG_DATA);\n\n readonly iconTone = this.data.yesButtonColor || 'primary';\n readonly iconShape: SdIconShape = this.data.iconShape ?? inject(SD_ICON_CONFIGURATION).defaultShape;\n readonly resolvedIcon =\n this.data.icon?.trim() ||\n (this.iconTone === 'error'\n ? 'delete'\n : this.iconTone === 'warning'\n ? 'warning_amber'\n : this.data.input\n ? 'edit_note'\n : this.data.date || this.data.datetime\n ? 'today'\n : this.data.radio || this.data.select\n ? 'list'\n : 'check_circle');\n readonly hasFields = !!(this.data.input || this.data.date || this.data.radio || this.data.datetime || this.data.select);\n\n constructor() {\n if (this.data?.input) {\n this.value = this.data?.input?.defaultValue ?? '';\n this.required = this.data?.input?.required || false;\n }\n if (this.data?.date) {\n this.value = this.data?.date?.defaultValue ?? '';\n this.required = this.data?.date?.required || false;\n }\n if (this.data?.datetime) {\n this.value = this.data?.datetime?.defaultValue ?? '';\n this.required = this.data?.datetime?.required || false;\n }\n if (this.data?.radio) {\n this.value = this.data?.radio?.defaultValue ?? '';\n this.required = this.data?.radio?.required || false;\n }\n if (this.data?.select) {\n this.value = this.data?.select?.defaultValue ?? (this.data?.select?.multiple ? [] : null);\n this.required = this.data?.select?.required || false;\n }\n }\n\n onCancel = () => {\n this.dialogRef.close({ action: 'CANCEL', value: null });\n };\n\n onAccept = () => {\n // Always return an object with action and value for consistency\n if (this.data?.radio || this.data?.input || this.data?.date || this.data?.datetime || this.data?.select) {\n this.dialogRef.close({ action: 'ACCEPT', value: this.value });\n } else {\n this.dialogRef.close({ action: 'ACCEPT', value: null });\n }\n };\n}\n","<div mat-dialog-content class=\"sd-dialog-confirm__content\" [class.sd-dialog-confirm__content--radio]=\"data.radio\">\n <div class=\"sd-dialog-confirm__header\">\n <span class=\"sd-dialog-confirm__icon\" aria-hidden=\"true\" [attr.data-icon]=\"resolvedIcon\" [attr.data-tone]=\"iconTone\" [attr.data-icon-shape]=\"iconShape\">\n <sd-icon [name]=\"resolvedIcon\" size=\"22px\"></sd-icon>\n </span>\n <div class=\"sd-dialog-confirm__copy\">\n <h2 mat-dialog-title class=\"sd-dialog-confirm__title\" [innerHtml]=\"data.title || 'Confirm'\"></h2>\n @if (data.message) {\n <div class=\"sd-dialog-confirm__message\" [innerHtml]=\"data.message\"></div>\n }\n </div>\n </div>\n @if (hasFields) {\n <div class=\"sd-dialog-confirm__fields\">\n @if (data.input) {\n <sd-textarea\n [label]=\"data.input.label\"\n [placeholder]=\"data.input.placeholder\"\n [(model)]=\"value\"\n [rows]=\"3\"\n [required]=\"data.input.required\"\n [maxlength]=\"data.input.maxlength!\" />\n }\n @if (data.select) {\n <sd-select\n [placeholder]=\"data.select.placeholder\"\n [items]=\"data.select.items\"\n [valueField]=\"data.select.valueField\"\n [displayField]=\"data.select.displayField\"\n [multiple]=\"data.select.multiple\"\n [(model)]=\"value\"\n [required]=\"data.select.required\">\n </sd-select>\n }\n @if (data.date) {\n <sd-date\n [placeholder]=\"data.date.placeholder\"\n [(model)]=\"value\"\n type=\"date\"\n [min]=\"data.date.min!\"\n [max]=\"data.date.max!\"\n [required]=\"data.date.required\">\n </sd-date>\n }\n @if (data.datetime) {\n <sd-datetime\n [placeholder]=\"data.datetime.placeholder\"\n [(model)]=\"value\"\n [min]=\"data.datetime.min!\"\n [max]=\"data.datetime.max!\"\n [showSeconds]=\"data.datetime.showSeconds\"\n [required]=\"data.datetime.required\">\n </sd-datetime>\n }\n @if (data.radio) {\n <sd-radio\n [items]=\"data.radio.items\"\n [valueField]=\"data.radio.valueField\"\n [displayField]=\"data.radio.displayField\"\n [display]=\"data.radio.display || 'column'\"\n [(model)]=\"value\"\n [required]=\"data.radio.required\">\n </sd-radio>\n }\n </div>\n }\n</div>\n<div mat-dialog-actions align=\"end\" class=\"sd-dialog-confirm__actions\">\n @if (data.noTitle) {\n <sd-button\n data-confirm-cancel\n size=\"sm\"\n type=\"light\"\n htmlType=\"button\"\n [color]=\"data.noButtonColor || 'secondary'\"\n [title]=\"data.noTitle\"\n (click)=\"onCancel()\"></sd-button>\n }\n @if (data.yesTitle) {\n <sd-button\n data-confirm-accept\n size=\"sm\"\n type=\"fill\"\n htmlType=\"button\"\n [color]=\"data.yesButtonColor || 'primary'\"\n [disabled]=\"\n required &&\n (value === undefined ||\n value === null ||\n value === '' ||\n (data.input && !value.trim()) ||\n (value.length !== undefined && value.length === 0))\n \"\n [title]=\"data.yesTitle\"\n (click)=\"onAccept()\"></sd-button>\n }\n</div>\n","import { inject, Injectable } from '@angular/core';\nimport { MatDialog } from '@angular/material/dialog';\nimport { Observable } from 'rxjs';\nimport { DialogConfirmComponent } from './components/dialog-confirm/dialog-confirm.component';\nimport { Color } from '@sdcorejs/utils/models';\nimport { I18nService } from '@sdcorejs/angular/i18n';\nimport type { SdIconShape } from '@sdcorejs/angular/modules/icon';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SdConfirmService {\n private dialog = inject(MatDialog);\n\n readonly #i18n = inject(I18nService);\n\n /** Inserted by Angular inject() migration for backwards compatibility */\n constructor(...args: unknown[]);\n\n constructor() {}\n\n /**\n * Biến `afterClosed()` của dialog thành một Promise LUÔN settle.\n *\n * why: cả 6 API trước đây đều viết `if (result) { ...ACCEPT/CANCEL... }`, nên MỌI đường đóng\n * dialog không đi qua hai nút — phím ESC, click backdrop (khi `disableBackdropClose: false`),\n * hoặc `dialogRef.close()` gọi từ code — cho `result` là `undefined` và promise KHÔNG BAO GIỜ\n * settle. Closure của caller (cùng mọi thứ nó giữ) bị ghim lại đến hết phiên, và `await` đứng im\n * mãi mãi. Đóng-không-chọn về ngữ nghĩa chính là huỷ, nên nó reject `'CANCEL'` — đúng nhánh mà\n * consumer vốn đã bắt.\n */\n #settleOnClose = <TValue>(afterClosed: Observable<{ action?: 'ACCEPT' | 'CANCEL'; value?: TValue } | undefined>): Promise<TValue> =>\n new Promise<TValue>((resolve, reject) => {\n afterClosed.subscribe(result => {\n if (result?.action === 'ACCEPT') resolve(result.value as TValue);\n else reject(result?.action ?? 'CANCEL');\n });\n });\n\n confirm = (\n message: string,\n option: {\n title?: string;\n icon?: string;\n /** Hình nền ô icon; bỏ trống thì dùng `defaultShape` của `provideSdIcon`. */\n iconShape?: SdIconShape;\n yesTitle?: string;\n noTitle?: string;\n yesButtonColor?: Color;\n noButtonColor?: Color;\n width?: string;\n disableBackdropClose?: boolean;\n } = {}\n ) => {\n const dialogRef = this.dialog.open(DialogConfirmComponent, {\n width: option?.width || '440px',\n panelClass: 'sd-confirm-panel',\n maxWidth: 'calc(100vw - 32px)',\n maxHeight: 'calc(100dvh - 32px)',\n autoFocus: '[data-confirm-cancel] button',\n disableClose: option?.disableBackdropClose ?? true,\n data: {\n icon: option?.icon,\n iconShape: option?.iconShape,\n title: option?.title || this.#i18n.t('core.confirm.title'),\n message,\n yesTitle: option?.yesTitle || this.#i18n.t('core.confirm.yes'),\n noTitle: option?.noTitle || this.#i18n.t('core.confirm.no'),\n noButtonColor: option?.noButtonColor || 'secondary',\n yesButtonColor: option?.yesButtonColor || 'primary',\n },\n });\n return this.#settleOnClose(dialogRef.afterClosed());\n };\n\n withInput = (\n message?: string,\n option?: {\n title?: string;\n icon?: string;\n /** Hình nền ô icon; bỏ trống thì dùng `defaultShape` của `provideSdIcon`. */\n iconShape?: SdIconShape;\n yesTitle?: string;\n noTitle?: string;\n required?: boolean;\n maxlength?: number;\n label?: string;\n placeholder?: string;\n yesButtonColor?: Color;\n noButtonColor?: Color;\n defaultValue?: string;\n disableBackdropClose?: boolean;\n }\n ): Promise<string> => {\n const dialogRef = this.dialog.open(DialogConfirmComponent, {\n width: '440px',\n panelClass: 'sd-confirm-panel',\n maxWidth: 'calc(100vw - 32px)',\n maxHeight: 'calc(100dvh - 32px)',\n autoFocus: 'textarea',\n disableClose: option?.disableBackdropClose ?? true,\n data: {\n icon: option?.icon,\n iconShape: option?.iconShape,\n title: option?.title || this.#i18n.t('core.confirm.title'),\n message,\n yesTitle: option?.yesTitle || this.#i18n.t('core.confirm.yes-short'),\n noTitle: option?.noTitle || this.#i18n.t('core.confirm.no-short'),\n noButtonColor: option?.noButtonColor || 'secondary',\n yesButtonColor: option?.yesButtonColor || 'primary',\n input: {\n label: option?.label,\n placeholder: option?.placeholder,\n maxlength: option?.maxlength || 255,\n required: option?.required,\n defaultValue: option?.defaultValue || '',\n },\n },\n });\n return this.#settleOnClose(dialogRef.afterClosed());\n };\n\n withRadio = (\n message?: string,\n option?: {\n title?: string;\n icon?: string;\n /** Hình nền ô icon; bỏ trống thì dùng `defaultShape` của `provideSdIcon`. */\n iconShape?: SdIconShape;\n yesTitle?: string;\n noTitle?: string;\n required?: boolean;\n yesButtonColor?: Color;\n noButtonColor?: Color;\n defaultValue?: string | number;\n items: any[];\n valueField: string;\n displayField: string;\n display?: 'row' | 'column';\n disableBackdropClose?: boolean;\n }\n ): Promise<string> => {\n const dialogRef = this.dialog.open(DialogConfirmComponent, {\n width: '440px',\n panelClass: 'sd-confirm-panel',\n maxWidth: 'calc(100vw - 32px)',\n maxHeight: 'calc(100dvh - 32px)',\n autoFocus: 'first-tabbable',\n disableClose: option?.disableBackdropClose ?? true,\n data: {\n icon: option?.icon,\n iconShape: option?.iconShape,\n title: option?.title || this.#i18n.t('core.confirm.title'),\n message,\n yesTitle: option?.yesTitle || this.#i18n.t('core.confirm.yes-short'),\n noTitle: option?.noTitle || this.#i18n.t('core.confirm.no-short'),\n noButtonColor: option?.noButtonColor || 'secondary',\n yesButtonColor: option?.yesButtonColor || 'primary',\n radio: {\n items: option?.items || [],\n valueField: option?.valueField || 'value',\n displayField: option?.displayField || 'label',\n display: option?.display || 'row',\n required: option?.required,\n defaultValue: option?.defaultValue,\n },\n },\n });\n return this.#settleOnClose(dialogRef.afterClosed());\n };\n\n withSelect = (\n message?: string,\n option?: {\n title?: string;\n icon?: string;\n /** Hình nền ô icon; bỏ trống thì dùng `defaultShape` của `provideSdIcon`. */\n iconShape?: SdIconShape;\n yesTitle?: string;\n noTitle?: string;\n required?: boolean;\n yesButtonColor?: Color;\n noButtonColor?: Color;\n defaultValue?: string | number | (string | number)[];\n items: any[];\n valueField: string;\n displayField: string;\n placeholder?: string;\n multiple?: boolean;\n disableBackdropClose?: boolean;\n }\n ): Promise<string | number | (string | number)[]> => {\n const dialogRef = this.dialog.open(DialogConfirmComponent, {\n width: '440px',\n panelClass: 'sd-confirm-panel',\n maxWidth: 'calc(100vw - 32px)',\n maxHeight: 'calc(100dvh - 32px)',\n autoFocus: 'first-tabbable',\n disableClose: option?.disableBackdropClose ?? true,\n data: {\n icon: option?.icon,\n iconShape: option?.iconShape,\n title: option?.title || this.#i18n.t('core.confirm.title'),\n message,\n yesTitle: option?.yesTitle || this.#i18n.t('core.confirm.yes-short'),\n noTitle: option?.noTitle || this.#i18n.t('core.confirm.no-short'),\n noButtonColor: option?.noButtonColor || 'secondary',\n yesButtonColor: option?.yesButtonColor || 'primary',\n select: {\n items: option?.items || [],\n valueField: option?.valueField || 'value',\n displayField: option?.displayField || 'label',\n placeholder: option?.placeholder,\n multiple: option?.multiple,\n required: option?.required,\n defaultValue: option?.defaultValue,\n },\n },\n });\n return this.#settleOnClose(dialogRef.afterClosed());\n };\n\n withDate = (\n message?: string,\n option?: {\n title?: string;\n icon?: string;\n /** Hình nền ô icon; bỏ trống thì dùng `defaultShape` của `provideSdIcon`. */\n iconShape?: SdIconShape;\n\n yesTitle?: string;\n noTitle?: string;\n required?: boolean;\n yesButtonColor?: Color;\n noButtonColor?: Color;\n defaultValue?: string | Date;\n placeholder?: string;\n min?: string | Date;\n max?: string | Date;\n disableBackdropClose?: boolean;\n }\n ): Promise<string | Date> => {\n const dialogRef = this.dialog.open(DialogConfirmComponent, {\n width: '440px',\n panelClass: 'sd-confirm-panel',\n maxWidth: 'calc(100vw - 32px)',\n maxHeight: 'calc(100dvh - 32px)',\n autoFocus: 'first-tabbable',\n disableClose: option?.disableBackdropClose ?? true,\n data: {\n icon: option?.icon,\n iconShape: option?.iconShape,\n title: option?.title || this.#i18n.t('core.confirm.title'),\n message,\n yesTitle: option?.yesTitle || this.#i18n.t('core.confirm.yes-short'),\n noTitle: option?.noTitle || this.#i18n.t('core.confirm.no-short'),\n noButtonColor: option?.noButtonColor || 'secondary',\n yesButtonColor: option?.yesButtonColor || 'primary',\n date: {\n placeholder: option?.placeholder,\n required: option?.required,\n defaultValue: option?.defaultValue || '',\n min: option?.min,\n max: option?.max,\n },\n },\n });\n return this.#settleOnClose(dialogRef.afterClosed());\n };\n\n withDatetime = (\n message?: string,\n option?: {\n title?: string;\n icon?: string;\n /** Hình nền ô icon; bỏ trống thì dùng `defaultShape` của `provideSdIcon`. */\n iconShape?: SdIconShape;\n\n yesTitle?: string;\n noTitle?: string;\n required?: boolean;\n yesButtonColor?: Color;\n noButtonColor?: Color;\n defaultValue?: string | Date;\n placeholder?: string;\n min?: string | Date;\n max?: string | Date;\n showSeconds?: boolean;\n disableBackdropClose?: boolean;\n }\n ): Promise<string | Date> => {\n const dialogRef = this.dialog.open(DialogConfirmComponent, {\n width: '440px',\n panelClass: 'sd-confirm-panel',\n maxWidth: 'calc(100vw - 32px)',\n maxHeight: 'calc(100dvh - 32px)',\n autoFocus: 'first-tabbable',\n disableClose: option?.disableBackdropClose ?? true,\n data: {\n icon: option?.icon,\n iconShape: option?.iconShape,\n title: option?.title || this.#i18n.t('core.confirm.title'),\n message,\n yesTitle: option?.yesTitle || this.#i18n.t('core.confirm.yes-short'),\n noTitle: option?.noTitle || this.#i18n.t('core.confirm.no-short'),\n noButtonColor: option?.noButtonColor || 'secondary',\n yesButtonColor: option?.yesButtonColor || 'primary',\n datetime: {\n placeholder: option?.placeholder,\n required: option?.required,\n defaultValue: option?.defaultValue || '',\n min: option?.min,\n max: option?.max,\n showSeconds: option?.showSeconds,\n },\n },\n });\n return this.#settleOnClose(dialogRef.afterClosed());\n };\n}\n","/*\n * Public API Surface of superdev-angular-core\n */\n\nexport * from './lib/components/dialog-confirm/dialog-confirm.component';\nexport * from './lib/confirm.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CAAC,CAAC,CAAC,uBAAuB,CAAC;AACjE,gBAAA,aAAa,EAAE,MAAM,EAAE,aAAa,IAAI,WAAW;AACnD,gBAAA,cAAc,EAAE,MAAM,EAAE,cAAc,IAAI,SAAS;AACnD,gBAAA,QAAQ,EAAE;oBACR,WAAW,EAAE,MAAM,EAAE,WAAW;oBAChC,QAAQ,EAAE,MAAM,EAAE,QAAQ;AAC1B,oBAAA,YAAY,EAAE,MAAM,EAAE,YAAY,IAAI,EAAE;oBACxC,GAAG,EAAE,MAAM,EAAE,GAAG;oBAChB,GAAG,EAAE,MAAM,EAAE,GAAG;oBAChB,WAAW,EAAE,MAAM,EAAE,WAAW;AACjC,iBAAA;AACF,aAAA;AACF,SAAA,CAAC;QACF,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;AACrD,IAAA,CAAC;wGAnTU,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAhB,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;;;ACVD;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"sdcorejs-angular-services-confirm.mjs","sources":["../../../projects/sdcorejs-angular/services/confirm/src/lib/components/dialog-confirm/dialog-confirm.component.ts","../../../projects/sdcorejs-angular/services/confirm/src/lib/components/dialog-confirm/dialog-confirm.component.html","../../../projects/sdcorejs-angular/services/confirm/src/lib/confirm.service.ts","../../../projects/sdcorejs-angular/services/confirm/src/public-api.ts","../../../projects/sdcorejs-angular/services/confirm/sdcorejs-angular-services-confirm.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, inject } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { MatBottomSheetRef, MAT_BOTTOM_SHEET_DATA } from '@angular/material/bottom-sheet';\nimport { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';\nimport { SdButton } from '@sdcorejs/angular/components/button';\nimport { SdDate } from '@sdcorejs/angular/forms/date';\nimport { SdDatetime } from '@sdcorejs/angular/forms/datetime';\nimport { SdRadio } from '@sdcorejs/angular/forms/radio';\nimport { SdSelect } from '@sdcorejs/angular/forms/select';\nimport { SdTextarea } from '@sdcorejs/angular/forms/textarea';\nimport { Color } from '@sdcorejs/utils/models';\nimport { Utilities } from '@sdcorejs/utils/fns';\nimport { SD_ICON_CONFIGURATION, SdIcon, type SdIconShape } from '@sdcorejs/angular/modules/icon';\n\nexport interface DialogData {\n icon?: string;\n iconShape?: SdIconShape;\n title?: string;\n message?: string;\n yesTitle?: string;\n noTitle?: string;\n yesButtonColor?: Color;\n noButtonColor?: Color;\n input?: {\n label?: string;\n placeholder?: string;\n minlength?: number;\n maxlength?: number;\n required?: boolean;\n defaultValue?: string;\n };\n date?: {\n required?: boolean;\n placeholder?: string;\n defaultValue?: string | Date;\n min?: string | Date;\n max?: string | Date;\n };\n datetime?: {\n required?: boolean;\n placeholder?: string;\n defaultValue?: string | Date;\n min?: string | Date;\n max?: string | Date;\n showSeconds?: boolean;\n };\n radio?: {\n required?: boolean;\n defaultValue?: string | number;\n items: any[];\n valueField: string;\n displayField: string;\n display?: 'row' | 'column';\n };\n select?: {\n required?: boolean;\n defaultValue?: string | number | (string | number)[];\n items: any[];\n valueField: string;\n displayField: string;\n placeholder?: string;\n multiple?: boolean;\n };\n}\n\n@Component({\n selector: 'sd-dialog-confirm',\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: 'dialog-confirm.component.html',\n styleUrl: './dialog-confirm.component.scss',\n imports: [SdIcon, CommonModule, FormsModule, MatDialogModule, SdButton, SdDate, SdDatetime, SdRadio, SdSelect, SdTextarea],\n host: { '[class.sd-dialog-confirm--sheet]': 'isBottomSheet' },\n})\nexport class DialogConfirmComponent {\n value: any;\n required = false;\n id = `I${Utilities.generateUuid()}`;\n // why: cùng một component chạy trong MatDialog hoặc MatBottomSheet nên cả hai ref đều là tùy chọn. SdConfirmService\n // quyết định kiểu hiển thị; component chỉ dùng ref đang có.\n public readonly dialogRef = inject(MatDialogRef<DialogConfirmComponent>, { optional: true });\n readonly #bottomSheetRef = inject(MatBottomSheetRef<DialogConfirmComponent>, { optional: true });\n /** `true` when opened in a bottom sheet; selects the stacked mobile action layout. */\n public readonly isBottomSheet = !!this.#bottomSheetRef;\n public readonly data: DialogData =\n (this.isBottomSheet\n ? inject<DialogData>(MAT_BOTTOM_SHEET_DATA, { optional: true })\n : inject<DialogData>(MAT_DIALOG_DATA, { optional: true })) ?? {};\n\n readonly iconTone = this.data.yesButtonColor || 'primary';\n readonly iconShape: SdIconShape = this.data.iconShape ?? inject(SD_ICON_CONFIGURATION).defaultShape;\n readonly resolvedIcon =\n this.data.icon?.trim() ||\n (this.iconTone === 'error'\n ? 'delete'\n : this.iconTone === 'warning'\n ? 'warning_amber'\n : this.data.input\n ? 'edit_note'\n : this.data.date || this.data.datetime\n ? 'today'\n : this.data.radio || this.data.select\n ? 'list'\n : 'check_circle');\n readonly hasFields = !!(this.data.input || this.data.date || this.data.radio || this.data.datetime || this.data.select);\n\n constructor() {\n if (this.data?.input) {\n this.value = this.data?.input?.defaultValue ?? '';\n this.required = this.data?.input?.required || false;\n }\n if (this.data?.date) {\n this.value = this.data?.date?.defaultValue ?? '';\n this.required = this.data?.date?.required || false;\n }\n if (this.data?.datetime) {\n this.value = this.data?.datetime?.defaultValue ?? '';\n this.required = this.data?.datetime?.required || false;\n }\n if (this.data?.radio) {\n this.value = this.data?.radio?.defaultValue ?? '';\n this.required = this.data?.radio?.required || false;\n }\n if (this.data?.select) {\n this.value = this.data?.select?.defaultValue ?? (this.data?.select?.multiple ? [] : null);\n this.required = this.data?.select?.required || false;\n }\n }\n\n /** Accept stays disabled while a required field is empty (a whitespace-only input counts as empty). */\n get acceptDisabled(): boolean {\n const value = this.value;\n return (\n this.required &&\n (value === undefined ||\n value === null ||\n value === '' ||\n (!!this.data.input && !value.trim()) ||\n (value.length !== undefined && value.length === 0))\n );\n }\n\n #close(result: { action: 'ACCEPT' | 'CANCEL'; value: unknown }): void {\n if (this.#bottomSheetRef) {\n this.#bottomSheetRef.dismiss(result);\n } else {\n this.dialogRef?.close(result);\n }\n }\n\n onCancel = () => {\n this.#close({ action: 'CANCEL', value: null });\n };\n\n onAccept = () => {\n // Always return an object with action and value for consistency\n if (this.data?.radio || this.data?.input || this.data?.date || this.data?.datetime || this.data?.select) {\n this.#close({ action: 'ACCEPT', value: this.value });\n } else {\n this.#close({ action: 'ACCEPT', value: null });\n }\n };\n}\n","<ng-template #body>\n <div class=\"sd-dialog-confirm__header\">\n <span class=\"sd-dialog-confirm__icon\" aria-hidden=\"true\" [attr.data-icon]=\"resolvedIcon\" [attr.data-tone]=\"iconTone\" [attr.data-icon-shape]=\"iconShape\">\n <sd-icon [name]=\"resolvedIcon\" size=\"22px\"></sd-icon>\n </span>\n <div class=\"sd-dialog-confirm__copy\">\n @if (isBottomSheet) {\n <h2 class=\"sd-dialog-confirm__title\" [innerHtml]=\"data.title || 'Confirm'\"></h2>\n } @else {\n <h2 mat-dialog-title class=\"sd-dialog-confirm__title\" [innerHtml]=\"data.title || 'Confirm'\"></h2>\n }\n @if (data.message) {\n <div class=\"sd-dialog-confirm__message\" [innerHtml]=\"data.message\"></div>\n }\n </div>\n </div>\n @if (hasFields) {\n <div class=\"sd-dialog-confirm__fields\">\n @if (data.input) {\n <sd-textarea\n [label]=\"data.input.label\"\n [placeholder]=\"data.input.placeholder\"\n [(model)]=\"value\"\n [rows]=\"3\"\n [required]=\"data.input.required\"\n [maxlength]=\"data.input.maxlength!\" />\n }\n @if (data.select) {\n <sd-select\n [placeholder]=\"data.select.placeholder\"\n [items]=\"data.select.items\"\n [valueField]=\"data.select.valueField\"\n [displayField]=\"data.select.displayField\"\n [multiple]=\"data.select.multiple\"\n [(model)]=\"value\"\n [required]=\"data.select.required\">\n </sd-select>\n }\n @if (data.date) {\n <sd-date\n [placeholder]=\"data.date.placeholder\"\n [(model)]=\"value\"\n type=\"date\"\n [min]=\"data.date.min!\"\n [max]=\"data.date.max!\"\n [required]=\"data.date.required\">\n </sd-date>\n }\n @if (data.datetime) {\n <sd-datetime\n [placeholder]=\"data.datetime.placeholder\"\n [(model)]=\"value\"\n [min]=\"data.datetime.min!\"\n [max]=\"data.datetime.max!\"\n [showSeconds]=\"data.datetime.showSeconds\"\n [required]=\"data.datetime.required\">\n </sd-datetime>\n }\n @if (data.radio) {\n <sd-radio\n [items]=\"data.radio.items\"\n [valueField]=\"data.radio.valueField\"\n [displayField]=\"data.radio.displayField\"\n [display]=\"data.radio.display || 'column'\"\n [(model)]=\"value\"\n [required]=\"data.radio.required\">\n </sd-radio>\n }\n </div>\n }\n</ng-template>\n\n@if (isBottomSheet) {\n <!-- why: bottom sheet không có MatDialogRef nên không dùng directive mat-dialog-*; nút chính đứng trên, full-width, cao 48px. -->\n <div class=\"sd-dialog-confirm__content sd-dialog-confirm__content--sheet\" [class.sd-dialog-confirm__content--radio]=\"data.radio\">\n <ng-container [ngTemplateOutlet]=\"body\" />\n </div>\n <div class=\"sd-dialog-confirm__actions sd-dialog-confirm__actions--sheet\">\n @if (data.yesTitle) {\n <sd-button\n data-confirm-accept\n block\n size=\"lg\"\n type=\"fill\"\n htmlType=\"button\"\n [color]=\"data.yesButtonColor || 'primary'\"\n [disabled]=\"acceptDisabled\"\n [title]=\"data.yesTitle\"\n (click)=\"onAccept()\"></sd-button>\n }\n @if (data.noTitle) {\n <sd-button\n data-confirm-cancel\n block\n size=\"lg\"\n type=\"light\"\n htmlType=\"button\"\n [color]=\"data.noButtonColor || 'secondary'\"\n [title]=\"data.noTitle\"\n (click)=\"onCancel()\"></sd-button>\n }\n </div>\n} @else {\n <div mat-dialog-content class=\"sd-dialog-confirm__content\" [class.sd-dialog-confirm__content--radio]=\"data.radio\">\n <ng-container [ngTemplateOutlet]=\"body\" />\n </div>\n <div mat-dialog-actions align=\"end\" class=\"sd-dialog-confirm__actions\">\n @if (data.noTitle) {\n <sd-button\n data-confirm-cancel\n size=\"sm\"\n type=\"light\"\n htmlType=\"button\"\n [color]=\"data.noButtonColor || 'secondary'\"\n [title]=\"data.noTitle\"\n (click)=\"onCancel()\"></sd-button>\n }\n @if (data.yesTitle) {\n <sd-button\n data-confirm-accept\n size=\"sm\"\n type=\"fill\"\n htmlType=\"button\"\n [color]=\"data.yesButtonColor || 'primary'\"\n [disabled]=\"acceptDisabled\"\n [title]=\"data.yesTitle\"\n (click)=\"onAccept()\"></sd-button>\n }\n </div>\n}\n","import { inject, Injectable } from '@angular/core';\nimport { MatBottomSheet } from '@angular/material/bottom-sheet';\nimport { MatDialog } from '@angular/material/dialog';\nimport { Observable } from 'rxjs';\nimport { DialogConfirmComponent, DialogData } from './components/dialog-confirm/dialog-confirm.component';\nimport { BrowserUtilities } from '@sdcorejs/utils/fns';\nimport { Color } from '@sdcorejs/utils/models';\nimport { I18nService } from '@sdcorejs/angular/i18n';\nimport type { SdIconShape } from '@sdcorejs/angular/modules/icon';\n\n/** Options shared by every `SdConfirmService` method. */\ninterface SdConfirmDisplayOption {\n /** Force the presentation. Omitted: a bottom sheet on mobile, a dialog on desktop. */\n view?: 'dialog' | 'bottom-sheet';\n /**\n * Allow closing by a backdrop click or the Esc key. Omitted = `false`. When passed, it decides and\n * `disableBackdropClose` is ignored. Closing this way rejects the promise with `'CANCEL'`.\n */\n enableBackdropClose?: boolean;\n /**\n * Block closing by a backdrop click and the Esc key. Default `true`.\n * @deprecated Use `enableBackdropClose` (the opposite meaning). Only applies when `enableBackdropClose` is omitted.\n */\n disableBackdropClose?: boolean;\n}\n\nconst BOTTOM_SHEET_PANEL_CLASS = 'sd-confirm-bottom-sheet';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SdConfirmService {\n private dialog = inject(MatDialog);\n readonly #bottomSheet = inject(MatBottomSheet);\n // why: đọc một lần, cùng nguồn nhận diện mobile với sd-modal để hai nơi chọn kiểu hiển thị giống nhau.\n readonly #isMobile = BrowserUtilities.isMobile();\n\n readonly #i18n = inject(I18nService);\n\n /** Inserted by Angular inject() migration for backwards compatibility */\n constructor(...args: unknown[]);\n\n constructor() {}\n\n /**\n * Biến `afterClosed()` của dialog thành một Promise LUÔN settle.\n *\n * why: cả 6 API trước đây đều viết `if (result) { ...ACCEPT/CANCEL... }`, nên MỌI đường đóng\n * dialog không đi qua hai nút — phím ESC, click backdrop (khi `disableBackdropClose: false`),\n * hoặc `dialogRef.close()` gọi từ code — cho `result` là `undefined` và promise KHÔNG BAO GIỜ\n * settle. Closure của caller (cùng mọi thứ nó giữ) bị ghim lại đến hết phiên, và `await` đứng im\n * mãi mãi. Đóng-không-chọn về ngữ nghĩa chính là huỷ, nên nó reject `'CANCEL'` — đúng nhánh mà\n * consumer vốn đã bắt.\n */\n #settleOnClose = <TValue>(afterClosed: Observable<{ action?: 'ACCEPT' | 'CANCEL'; value?: TValue } | undefined>): Promise<TValue> =>\n new Promise<TValue>((resolve, reject) => {\n afterClosed.subscribe(result => {\n if (result?.action === 'ACCEPT') resolve(result.value as TValue);\n else reject(result?.action ?? 'CANCEL');\n });\n });\n\n /**\n * Đường mở duy nhất của cả 6 API: chọn dialog hay bottom sheet, tính quyền đóng bằng nền/Esc rồi trả về stream đóng\n * để `#settleOnClose` biến thành Promise.\n *\n * why: mỗi API trước đây tự gọi `dialog.open` với cùng một khối cấu hình. Gom lại để kiểu hiển thị và quy tắc cờ\n * (`enableBackdropClose` thắng `disableBackdropClose`) không thể lệch nhau giữa các API.\n */\n #open(option: SdConfirmDisplayOption | undefined, width: string, autoFocus: string, data: DialogData): Observable<any> {\n const closeAllowed = option?.enableBackdropClose ?? option?.disableBackdropClose === false;\n const disableClose = !closeAllowed;\n const view = option?.view ?? (this.#isMobile ? 'bottom-sheet' : 'dialog');\n\n if (view === 'bottom-sheet') {\n return this.#bottomSheet\n .open(DialogConfirmComponent, {\n panelClass: BOTTOM_SHEET_PANEL_CLASS,\n // why: tiêu đề cho phép HTML (innerHtml) nhưng tên cho trình đọc màn hình phải là text thuần.\n ariaLabel: (data.title ?? '').replace(/<[^>]*>/g, '').trim(),\n autoFocus,\n disableClose,\n data,\n })\n .afterDismissed();\n }\n return this.dialog\n .open(DialogConfirmComponent, {\n width,\n panelClass: 'sd-confirm-panel',\n maxWidth: 'calc(100vw - 32px)',\n maxHeight: 'calc(100dvh - 32px)',\n autoFocus,\n disableClose,\n data,\n })\n .afterClosed();\n }\n\n confirm = (\n message: string,\n option: SdConfirmDisplayOption & {\n title?: string;\n icon?: string;\n /** Hình nền ô icon; bỏ trống thì dùng `defaultShape` của `provideSdIcon`. */\n iconShape?: SdIconShape;\n yesTitle?: string;\n noTitle?: string;\n yesButtonColor?: Color;\n noButtonColor?: Color;\n /** Dialog width. Not applied to the bottom sheet, which is always full-width. */\n width?: string;\n } = {}\n ) => {\n return this.#settleOnClose(\n this.#open(option, option?.width || '440px', '[data-confirm-cancel] button', {\n icon: option?.icon,\n iconShape: option?.iconShape,\n title: option?.title || this.#i18n.t('core.confirm.title'),\n message,\n yesTitle: option?.yesTitle || this.#i18n.t('core.confirm.yes'),\n noTitle: option?.noTitle || this.#i18n.t('core.confirm.no'),\n noButtonColor: option?.noButtonColor || 'secondary',\n yesButtonColor: option?.yesButtonColor || 'primary',\n })\n );\n };\n\n withInput = (\n message?: string,\n option?: SdConfirmDisplayOption & {\n title?: string;\n icon?: string;\n /** Hình nền ô icon; bỏ trống thì dùng `defaultShape` của `provideSdIcon`. */\n iconShape?: SdIconShape;\n yesTitle?: string;\n noTitle?: string;\n required?: boolean;\n maxlength?: number;\n label?: string;\n placeholder?: string;\n yesButtonColor?: Color;\n noButtonColor?: Color;\n defaultValue?: string;\n }\n ): Promise<string> => {\n return this.#settleOnClose(\n this.#open(option, '440px', 'textarea', {\n icon: option?.icon,\n iconShape: option?.iconShape,\n title: option?.title || this.#i18n.t('core.confirm.title'),\n message,\n yesTitle: option?.yesTitle || this.#i18n.t('core.confirm.yes-short'),\n noTitle: option?.noTitle || this.#i18n.t('core.confirm.no-short'),\n noButtonColor: option?.noButtonColor || 'secondary',\n yesButtonColor: option?.yesButtonColor || 'primary',\n input: {\n label: option?.label,\n placeholder: option?.placeholder,\n maxlength: option?.maxlength || 255,\n required: option?.required,\n defaultValue: option?.defaultValue || '',\n },\n })\n );\n };\n\n withRadio = (\n message?: string,\n option?: SdConfirmDisplayOption & {\n title?: string;\n icon?: string;\n /** Hình nền ô icon; bỏ trống thì dùng `defaultShape` của `provideSdIcon`. */\n iconShape?: SdIconShape;\n yesTitle?: string;\n noTitle?: string;\n required?: boolean;\n yesButtonColor?: Color;\n noButtonColor?: Color;\n defaultValue?: string | number;\n items: any[];\n valueField: string;\n displayField: string;\n display?: 'row' | 'column';\n }\n ): Promise<string> => {\n return this.#settleOnClose(\n this.#open(option, '440px', 'first-tabbable', {\n icon: option?.icon,\n iconShape: option?.iconShape,\n title: option?.title || this.#i18n.t('core.confirm.title'),\n message,\n yesTitle: option?.yesTitle || this.#i18n.t('core.confirm.yes-short'),\n noTitle: option?.noTitle || this.#i18n.t('core.confirm.no-short'),\n noButtonColor: option?.noButtonColor || 'secondary',\n yesButtonColor: option?.yesButtonColor || 'primary',\n radio: {\n items: option?.items || [],\n valueField: option?.valueField || 'value',\n displayField: option?.displayField || 'label',\n display: option?.display || 'row',\n required: option?.required,\n defaultValue: option?.defaultValue,\n },\n })\n );\n };\n\n withSelect = (\n message?: string,\n option?: SdConfirmDisplayOption & {\n title?: string;\n icon?: string;\n /** Hình nền ô icon; bỏ trống thì dùng `defaultShape` của `provideSdIcon`. */\n iconShape?: SdIconShape;\n yesTitle?: string;\n noTitle?: string;\n required?: boolean;\n yesButtonColor?: Color;\n noButtonColor?: Color;\n defaultValue?: string | number | (string | number)[];\n items: any[];\n valueField: string;\n displayField: string;\n placeholder?: string;\n multiple?: boolean;\n }\n ): Promise<string | number | (string | number)[]> => {\n return this.#settleOnClose(\n this.#open(option, '440px', 'first-tabbable', {\n icon: option?.icon,\n iconShape: option?.iconShape,\n title: option?.title || this.#i18n.t('core.confirm.title'),\n message,\n yesTitle: option?.yesTitle || this.#i18n.t('core.confirm.yes-short'),\n noTitle: option?.noTitle || this.#i18n.t('core.confirm.no-short'),\n noButtonColor: option?.noButtonColor || 'secondary',\n yesButtonColor: option?.yesButtonColor || 'primary',\n select: {\n items: option?.items || [],\n valueField: option?.valueField || 'value',\n displayField: option?.displayField || 'label',\n placeholder: option?.placeholder,\n multiple: option?.multiple,\n required: option?.required,\n defaultValue: option?.defaultValue,\n },\n })\n );\n };\n\n withDate = (\n message?: string,\n option?: SdConfirmDisplayOption & {\n title?: string;\n icon?: string;\n /** Hình nền ô icon; bỏ trống thì dùng `defaultShape` của `provideSdIcon`. */\n iconShape?: SdIconShape;\n\n yesTitle?: string;\n noTitle?: string;\n required?: boolean;\n yesButtonColor?: Color;\n noButtonColor?: Color;\n defaultValue?: string | Date;\n placeholder?: string;\n min?: string | Date;\n max?: string | Date;\n }\n ): Promise<string | Date> => {\n return this.#settleOnClose(\n this.#open(option, '440px', 'first-tabbable', {\n icon: option?.icon,\n iconShape: option?.iconShape,\n title: option?.title || this.#i18n.t('core.confirm.title'),\n message,\n yesTitle: option?.yesTitle || this.#i18n.t('core.confirm.yes-short'),\n noTitle: option?.noTitle || this.#i18n.t('core.confirm.no-short'),\n noButtonColor: option?.noButtonColor || 'secondary',\n yesButtonColor: option?.yesButtonColor || 'primary',\n date: {\n placeholder: option?.placeholder,\n required: option?.required,\n defaultValue: option?.defaultValue || '',\n min: option?.min,\n max: option?.max,\n },\n })\n );\n };\n\n withDatetime = (\n message?: string,\n option?: SdConfirmDisplayOption & {\n title?: string;\n icon?: string;\n /** Hình nền ô icon; bỏ trống thì dùng `defaultShape` của `provideSdIcon`. */\n iconShape?: SdIconShape;\n\n yesTitle?: string;\n noTitle?: string;\n required?: boolean;\n yesButtonColor?: Color;\n noButtonColor?: Color;\n defaultValue?: string | Date;\n placeholder?: string;\n min?: string | Date;\n max?: string | Date;\n showSeconds?: boolean;\n }\n ): Promise<string | Date> => {\n return this.#settleOnClose(\n this.#open(option, '440px', 'first-tabbable', {\n icon: option?.icon,\n iconShape: option?.iconShape,\n title: option?.title || this.#i18n.t('core.confirm.title'),\n message,\n yesTitle: option?.yesTitle || this.#i18n.t('core.confirm.yes-short'),\n noTitle: option?.noTitle || this.#i18n.t('core.confirm.no-short'),\n noButtonColor: option?.noButtonColor || 'secondary',\n yesButtonColor: option?.yesButtonColor || 'primary',\n datetime: {\n placeholder: option?.placeholder,\n required: option?.required,\n defaultValue: option?.defaultValue || '',\n min: option?.min,\n max: option?.max,\n showSeconds: option?.showSeconds,\n },\n })\n );\n };\n}\n","/*\n * Public API Surface of superdev-angular-core\n */\n\n// why: DialogConfirmComponent và DialogData là chi tiết nội bộ của SdConfirmService; consumer chỉ dùng service.\nexport * from './lib/confirm.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;MA0Ea,sBAAsB,CAAA;AACjC,IAAA,KAAK;IACL,QAAQ,GAAG,KAAK;AAChB,IAAA,EAAE,GAAG,CAAA,CAAA,EAAI,SAAS,CAAC,YAAY,EAAE,EAAE;;;AAGnB,IAAA,SAAS,GAAG,MAAM,EAAC,YAAoC,GAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACnF,IAAA,eAAe,GAAG,MAAM,EAAC,iBAAyC,GAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;AAEhF,IAAA,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC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AAC,KAAK,CAAC,CAAC,CAAC,wBAAwB,CAAC;AACpE,YAAA,OAAO,EAAE,MAAM,EAAE,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,uBAAuB,CAAC;AACjE,YAAA,aAAa,EAAE,MAAM,EAAE,aAAa,IAAI,WAAW;AACnD,YAAA,cAAc,EAAE,MAAM,EAAE,cAAc,IAAI,SAAS;AACnD,YAAA,QAAQ,EAAE;gBACR,WAAW,EAAE,MAAM,EAAE,WAAW;gBAChC,QAAQ,EAAE,MAAM,EAAE,QAAQ;AAC1B,gBAAA,YAAY,EAAE,MAAM,EAAE,YAAY,IAAI,EAAE;gBACxC,GAAG,EAAE,MAAM,EAAE,GAAG;gBAChB,GAAG,EAAE,MAAM,EAAE,GAAG;gBAChB,WAAW,EAAE,MAAM,EAAE,WAAW;AACjC,aAAA;AACF,SAAA,CAAC,CACH;AACH,IAAA,CAAC;wGA5SU,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAhB,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;;;AC9BD;;AAEG;AAEH;;ACJA;;AAEG;;;;"}
@@ -225,6 +225,36 @@ class SdExcelService {
225
225
  const csv = '\uFEFF' + [headerLine, ...dataLines].join('\r\n');
226
226
  BrowserUtilities.downloadBlob(new Blob([csv], { type: 'text/csv;charset=utf-8;' }), filename);
227
227
  };
228
+ /**
229
+ * Serializes tabular values to an XLSX workbook and starts a browser download.
230
+ * The main `data` sheet contains field keys, titles, optional descriptions,
231
+ * then data. This browser API lazily loads ExcelJS; it does not mutate rows or
232
+ * column options and does not convert application timezones.
233
+ *
234
+ * @param option Columns, rows, optional filename and additional sheets. Each
235
+ * column requires a nonempty field and title. Empty columns/rows are allowed.
236
+ * A nonempty `column.numFmt` applies only to number/Date data cells in the main
237
+ * sheet; omitted or empty formats preserve existing behavior. Strings stay
238
+ * text and are neutralized for spreadsheet formula injection. Nullish data
239
+ * values remain blank. ExcelJS handles Date serialization in the 1900 system;
240
+ * the caller owns valid serials, date ranges and timezone conversion.
241
+ * @returns A promise resolving after serialization and the download trigger,
242
+ * not after the user saves the file. There is no cancellation or timeout API.
243
+ * @throws Rejects if a column lacks its field/title, or if loading ExcelJS,
244
+ * serialization or the browser download helper fails.
245
+ * @example
246
+ * ```ts
247
+ * import { inject } from '@angular/core';
248
+ * import { SdExcelService } from '@sdcorejs/angular/services/excel';
249
+ * // Inside an Angular injection context:
250
+ * const excel = inject(SdExcelService);
251
+ * await excel.export({
252
+ * columns: [{ field: 'day', title: 'Day', numFmt: 'dd/mm/yyyy' }],
253
+ * items: [{ day: 46323 }],
254
+ * fileName: 'dates.xlsx',
255
+ * }); // Excel displays a date cell as 28/10/2026.
256
+ * ```
257
+ */
228
258
  export = async (option) => {
229
259
  const { columns, items, fileName, sheets } = option;
230
260
  let hasDescription = false;
@@ -299,6 +329,10 @@ class SdExcelService {
299
329
  cell.value = neutralizeSpreadsheetFormula(raw);
300
330
  cell.style = { ...this.#cellStyle };
301
331
  }
332
+ // Apply the explicit format last so styling cannot replace it; never parse text as dates.
333
+ if (column.numFmt && (typeof raw === 'number' || raw instanceof Date)) {
334
+ cell.numFmt = column.numFmt;
335
+ }
302
336
  });
303
337
  });
304
338
  const file = await workbook.xlsx.writeBuffer();
@@ -1 +1 @@
1
- {"version":3,"file":"sdcorejs-angular-services-excel.mjs","sources":["../../../projects/sdcorejs-angular/services/excel/src/lib/spreadsheet-formula-injection.util.ts","../../../projects/sdcorejs-angular/services/excel/src/lib/excel.service.ts","../../../projects/sdcorejs-angular/services/excel/sdcorejs-angular-services-excel.ts"],"sourcesContent":["const DANGEROUS_SPREADSHEET_FORMULA_PREFIX = /^[=+\\-@\\t\\r\\n]/;\n\n/**\n * Prefix spreadsheet formula-like strings so exported files treat them as text.\n */\nexport function neutralizeSpreadsheetFormula(value: string): string;\nexport function neutralizeSpreadsheetFormula<T>(value: T): T;\nexport function neutralizeSpreadsheetFormula(value: unknown): unknown {\n if (typeof value !== 'string' || value === '' || value.startsWith(\"'\")) {\n return value;\n }\n\n return DANGEROUS_SPREADSHEET_FORMULA_PREFIX.test(value) ? `'${value}` : value;\n}\n","import { inject, Injectable } from '@angular/core';\nimport type { CellValue, Style } from 'exceljs';\n// import hash from 'object-hash';\nimport { DateUtilities } from '@sdcorejs/utils/fns';\nimport { BrowserUtilities } from '@sdcorejs/utils/fns';\nimport { FilePickerCancelledError } from '@sdcorejs/utils/errors';\nimport { I18nService } from '@sdcorejs/angular/i18n';\nimport { SdExcelExportOption, SdExcelTemplate } from './excel.model';\nimport { neutralizeSpreadsheetFormula } from './spreadsheet-formula-injection.util';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SdExcelService {\n readonly #i18n = inject(I18nService);\n #fieldStyle: Partial<Style> = {\n border: {\n bottom: { style: 'thin' },\n left: { style: 'thin' },\n right: { style: 'thin' },\n },\n alignment: {\n vertical: 'middle',\n horizontal: 'center',\n wrapText: true,\n },\n font: {\n bold: true,\n size: 11,\n color: { argb: '000000' },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: 'FAFAFA',\n },\n },\n };\n #titleColor = 'FFFFFF';\n #titleFgColor = '143180';\n #titleStyle: Partial<Style> = {\n border: {\n bottom: { style: 'thin' },\n left: { style: 'thin' },\n right: { style: 'thin' },\n },\n alignment: {\n vertical: 'middle',\n horizontal: 'center',\n wrapText: true,\n },\n font: {\n bold: true,\n size: 11,\n color: { argb: this.#titleColor },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: this.#titleFgColor,\n },\n },\n };\n\n #requiredStyle: Partial<Style> = {\n border: {\n bottom: { style: 'thin' },\n left: { style: 'thin' },\n right: { style: 'thin' },\n },\n alignment: {\n vertical: 'middle',\n horizontal: 'center',\n wrapText: true,\n },\n font: {\n italic: true,\n size: 11,\n color: { argb: 'FFFFFF' },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: 'FF1744',\n },\n },\n };\n\n #descriptionStyle: Partial<Style> = {\n border: {\n bottom: { style: 'thin' },\n left: { style: 'thin' },\n right: { style: 'thin' },\n },\n alignment: {\n wrapText: true,\n },\n font: {\n italic: true,\n size: 9,\n color: { argb: '000000' },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: 'CFD8DC',\n },\n },\n };\n\n #cellStyle: Partial<Style> = {\n alignment: {\n vertical: 'middle',\n wrapText: true,\n },\n };\n\n constructor() {}\n\n // exceljs là CJS module — khi dynamic import từ ESM, named export `Workbook`\n // có thể nằm trên `mod.Workbook` hoặc bị bọc trong `mod.default.Workbook` tuỳ bundler.\n // Helper này chuẩn hoá cả hai trường hợp.\n async #loadWorkbook(): Promise<new () => import('exceljs').Workbook> {\n const mod: any = await import('exceljs');\n return mod.Workbook ?? mod.default?.Workbook;\n }\n\n generateTemplate = async (template: SdExcelTemplate) => {\n const { fileName, columns, sheets } = template;\n if (!Array.isArray(columns)) {\n throw new Error('Excel template columns must be an array');\n }\n for (const [idx, column] of columns.entries()) {\n if (!column.field) {\n throw new Error(`Column ${idx + 1}: Field is required`);\n }\n if (!column.title) {\n throw new Error(`Column ${idx + 1}: Title is required`);\n }\n }\n const hasDescription = columns.some(column => column.description);\n const Workbook = await this.#loadWorkbook();\n const workbook = new Workbook();\n const firstSheet = workbook.addWorksheet('template'); // Lấy ra sheet đầu tiên\n columns.forEach((column, index) => {\n const { required, fill, fontColor } = column;\n const cellField = firstSheet.getCell(1, index + 1);\n const cellTitle = firstSheet.getCell(2, index + 1);\n const cellDescription = firstSheet.getCell(3, index + 1);\n let width = 120;\n if (column.width && column.width.endsWith('px')) {\n width = +column.width.replace('px', '');\n }\n firstSheet.getColumn(index + 1).width = width / 7 || 20;\n cellField.style = this.#fieldStyle;\n if (required) {\n cellField.style = this.#requiredStyle;\n } else {\n cellField.style = this.#fieldStyle;\n }\n cellTitle.style = {\n ...this.#titleStyle,\n font: {\n ...this.#titleStyle?.font,\n color: {\n ...this.#titleStyle?.font?.color,\n argb: fontColor || this.#titleStyle?.font?.color?.argb,\n },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: fill || this.#titleFgColor,\n },\n },\n };\n cellField.value = neutralizeSpreadsheetFormula(column.field);\n cellTitle.value = neutralizeSpreadsheetFormula(column.title);\n if (hasDescription) {\n cellDescription.style = this.#descriptionStyle;\n cellDescription.value = neutralizeSpreadsheetFormula(column.description || '');\n }\n });\n if (sheets?.length) {\n for (const sheet of sheets) {\n if (sheet.name && Array.isArray(sheet.items) && Array.isArray(sheet.headers)) {\n const newSheet = workbook.addWorksheet(sheet.name);\n sheet.headers.forEach((header, index) => {\n newSheet.getColumn(index + 1).width = 30;\n newSheet.getCell(1, index + 1).style = this.#titleStyle;\n newSheet.getCell(1, index + 1).value = neutralizeSpreadsheetFormula(header.value);\n newSheet.getCell(2, index + 1).style = this.#titleStyle;\n newSheet.getCell(2, index + 1).value = neutralizeSpreadsheetFormula(header.display || header.value);\n });\n sheet.items.forEach((item, idx1) => {\n sheet.headers.forEach((header, idx2) => {\n newSheet.getCell(3 + idx1, 1 + idx2).value = neutralizeSpreadsheetFormula(item[header.value]) as CellValue;\n newSheet.getCell(3 + idx1, 1 + idx2).style = this.#cellStyle;\n });\n });\n }\n }\n }\n const file = await workbook.xlsx.writeBuffer();\n BrowserUtilities.downloadBlob(\n new Blob([file], {\n type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n }),\n fileName\n );\n };\n\n exportCSV = async (option: SdExcelExportOption): Promise<void> => {\n const { columns, items, fileName } = option;\n const filename = `${fileName || 'CSV'}_${DateUtilities.toFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss')}.csv`;\n\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.\n // Dấu \" bên trong được nhân đôi theo chuẩn RFC 4180.\n const escape = (v: unknown): string => {\n if (v == null) return '';\n const s = typeof v === 'string' ? neutralizeSpreadsheetFormula(v) : String(v);\n return /[\",\\n\\r]/.test(s) ? `\"${s.replace(/\"/g, '\"\"')}\"` : s;\n };\n\n const headerLine = columns.map(c => escape(c.title)).join(',');\n const dataLines = items.map(item => columns.map(c => escape((item as Record<string, unknown>)[c.field])).join(','));\n\n // Prepend UTF-8 BOM so Excel opens Vietnamese text with the correct encoding.\n // Dùng CRLF vì Excel trên Windows ưu tiên, macOS Excel cũng chấp nhận.\n const csv = '\\uFEFF' + [headerLine, ...dataLines].join('\\r\\n');\n\n BrowserUtilities.downloadBlob(new Blob([csv], { type: 'text/csv;charset=utf-8;' }), filename);\n };\n\n export = async (option: SdExcelExportOption) => {\n const { columns, items, fileName, sheets } = option;\n let hasDescription = false;\n for (const [idx, column] of columns.entries()) {\n if (!column.field) {\n throw new Error(`Column ${idx + 1}: Field is required`);\n }\n if (!column.title) {\n throw new Error(`Column ${idx + 1}: Title is required`);\n }\n if (column.description) {\n hasDescription = true;\n }\n }\n const Workbook = await this.#loadWorkbook();\n const workbook = new Workbook(); //await XlsxPopulate.fromBlankAsync(); // Đọc file sau khi đã download\n const firstSheet = workbook.addWorksheet('data'); // Lấy ra sheet đầu tiên\n columns.forEach((column, index) => {\n let width = 120;\n if (column.width && column.width.endsWith('px')) {\n width = +column.width.replace('px', '');\n }\n firstSheet.getColumn(index + 1).width = width / 7 || 20;\n firstSheet.getCell(1, index + 1).style = this.#fieldStyle;\n if (column.required) {\n firstSheet.getCell(2, index + 1).style = this.#requiredStyle;\n } else {\n firstSheet.getCell(2, index + 1).style = this.#titleStyle;\n }\n firstSheet.getCell(1, index + 1).value = neutralizeSpreadsheetFormula(column.field);\n firstSheet.getCell(2, index + 1).value = neutralizeSpreadsheetFormula(column.title);\n if (hasDescription) {\n firstSheet.getCell(3, index + 1).style = this.#descriptionStyle;\n firstSheet.getCell(3, index + 1).value = neutralizeSpreadsheetFormula(column.description || '');\n }\n });\n if (sheets?.length) {\n for (const sheet of sheets) {\n if (sheet.name && Array.isArray(sheet.items) && Array.isArray(sheet.headers)) {\n const newSheet = workbook.addWorksheet(sheet.name);\n sheet.headers.forEach((header, index) => {\n newSheet.getColumn(index + 1).width = 30;\n newSheet.getCell(1, index + 1).style = this.#titleStyle;\n newSheet.getCell(1, index + 1).value = neutralizeSpreadsheetFormula(header.value);\n newSheet.getCell(2, index + 1).style = this.#titleStyle;\n newSheet.getCell(2, index + 1).value = neutralizeSpreadsheetFormula(header.display || header.value);\n });\n sheet.items.forEach((item, idx1) => {\n sheet.headers.forEach((header, idx2) => {\n newSheet.getCell(3 + idx1, 1 + idx2).value = neutralizeSpreadsheetFormula(item[header.value]) as CellValue;\n newSheet.getCell(3 + idx1, 1 + idx2).style = this.#cellStyle;\n });\n });\n }\n }\n }\n\n const fromRow = hasDescription ? 4 : 3;\n items.forEach((e, idx1) => {\n columns.forEach((column, idx2) => {\n const cell = firstSheet.getCell(fromRow + idx1, 1 + idx2);\n const raw = e[column.field];\n if (typeof raw === 'number') {\n cell.value = +raw;\n // why: gán `cell.style` THAY THẾ toàn bộ object style (exceljs), nên numFmt phải nằm\n // trong cùng object — bản cũ set `cell.numFmt = '#'` TRƯỚC rồi gán style đè → numFmt\n // chưa từng có tác dụng. '#' cũng là format lỗi: 0 hiển thị ô TRỐNG và phần thập phân\n // bị làm tròn hiển thị → số nguyên dùng '0', số thập phân giữ General.\n cell.style = Number.isInteger(raw) ? { ...this.#cellStyle, numFmt: '0' } : { ...this.#cellStyle };\n } else {\n cell.value = neutralizeSpreadsheetFormula(raw) as CellValue;\n cell.style = { ...this.#cellStyle };\n }\n });\n });\n const file = await workbook.xlsx.writeBuffer();\n BrowserUtilities.downloadBlob(\n new Blob([file], {\n type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n }),\n fileName\n );\n };\n\n // Helper để lấy giá trị text chuẩn từ ô Excel (xử lý RichText, Formula, Hyperlink)\n #getCellValue = (value: CellValue): string | number | null | undefined | boolean | Date => {\n if (value && typeof value === 'object') {\n // Xử lý Rich Text (vd: ô bôi đậm)\n if ('richText' in value) {\n return value.richText.map(t => t.text).join('');\n }\n // Xử lý Hyperlink\n if ('text' in value) {\n return value.text as string; // hoặc value.result nếu là công thức\n }\n // Xử lý Formula\n if ('result' in value) {\n return value.result as any;\n }\n }\n return value as any;\n };\n upload = async (): Promise<{ items: Record<string, any>[]; file: File | null }> => {\n try {\n const fileResult = await BrowserUtilities.upload({\n extensions: ['xlsx'],\n maxSizeInMb: 10,\n });\n\n // Chuẩn hóa file đầu vào (nếu upload trả về mảng thì lấy phần tử đầu)\n const file = Array.isArray(fileResult) ? fileResult[0] : fileResult;\n\n if (!file) {\n return { items: [], file: null };\n }\n\n return await this.parse(file);\n } catch (error) {\n // why: từ `@sdcorejs/utils` 1.2, huỷ/timeout hộp chọn file reject `FilePickerCancelledError` thay vì\n // resolve `null`. Huỷ không phải lỗi — giữ nguyên kết quả rỗng như trước.\n if (error instanceof FilePickerCancelledError) return { items: [], file: null };\n console.error('Upload error:', error);\n throw error; // Hoặc return { items: [], file: null } tùy logic nghiệp vụ\n }\n };\n parse = async (file: File): Promise<{ items: Record<string, any>[]; file: File | null }> => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = async e => {\n try {\n const buffer = e.target?.result as ArrayBuffer;\n if (!buffer) {\n throw new Error(this.#i18n.t('core.excel.cannot-read-file'));\n }\n\n const Workbook = await this.#loadWorkbook();\n const wb = new Workbook();\n await wb.xlsx.load(buffer);\n\n const sheet = wb.worksheets[0];\n if (!sheet) {\n throw new Error(this.#i18n.t('core.excel.no-sheet'));\n }\n\n const items: Record<string, any>[] = [];\n\n // Lấy row Header (Row 1)\n const headerRow = sheet.getRow(1);\n // Map: Column Index (bắt đầu từ 1) -> Tên trường (Key)\n const headerMap: Record<number, string> = {};\n\n // Duyệt qua các ô có dữ liệu thực tế của dòng Header\n headerRow.eachCell((cell, colNumber) => {\n const cellValue = this.#getCellValue(cell.value);\n if (cellValue) {\n // Ép kiểu về string và trim để làm key\n headerMap[colNumber] = String(cellValue).trim();\n }\n });\n\n // Duyệt dữ liệu từ dòng 2 trở đi\n sheet.eachRow((row, rowIndex) => {\n if (rowIndex <= 1 || !row.hasValues) return;\n\n const item: Record<string, any> = {};\n\n // Chỉ duyệt qua các cột đã định nghĩa trong headerMap\n // Cách này an toàn hơn là duyệt mảng values\n Object.keys(headerMap).forEach(colKey => {\n const colNumber = Number(colKey);\n const fieldKey = headerMap[colNumber];\n\n // Lấy giá trị ô tại cột tương ứng\n const rawValue = this.#getCellValue(row.getCell(colNumber).value);\n\n let finalValue = rawValue;\n\n // Xử lý string: trim\n if (typeof finalValue === 'string') {\n finalValue = finalValue.trim();\n }\n\n // Xử lý các keyword đặc biệt\n if (finalValue === '' || finalValue === undefined) {\n finalValue = null;\n } else if (finalValue === 'SET_NULL') {\n finalValue = null;\n } else if (finalValue === 'SET_EMPTY') {\n finalValue = '';\n }\n\n item[fieldKey] = finalValue;\n });\n\n // Chỉ push nếu item có dữ liệu (tùy chọn)\n if (Object.keys(item).length > 0) {\n items.push(item);\n }\n });\n\n resolve({ items, file });\n } catch (err) {\n reject(err);\n }\n };\n\n reader.onerror = error => reject(error);\n reader.readAsArrayBuffer(file);\n });\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA,MAAM,oCAAoC,GAAG,gBAAgB;AAOvD,SAAU,4BAA4B,CAAC,KAAc,EAAA;AACzD,IAAA,IAAI,OAAO,KAAK,KAA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;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;wGAnbU,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;;;ACZD;;AAEG;;;;"}
1
+ {"version":3,"file":"sdcorejs-angular-services-excel.mjs","sources":["../../../projects/sdcorejs-angular/services/excel/src/lib/spreadsheet-formula-injection.util.ts","../../../projects/sdcorejs-angular/services/excel/src/lib/excel.service.ts","../../../projects/sdcorejs-angular/services/excel/sdcorejs-angular-services-excel.ts"],"sourcesContent":["const DANGEROUS_SPREADSHEET_FORMULA_PREFIX = /^[=+\\-@\\t\\r\\n]/;\n\n/**\n * Prefix spreadsheet formula-like strings so exported files treat them as text.\n */\nexport function neutralizeSpreadsheetFormula(value: string): string;\nexport function neutralizeSpreadsheetFormula<T>(value: T): T;\nexport function neutralizeSpreadsheetFormula(value: unknown): unknown {\n if (typeof value !== 'string' || value === '' || value.startsWith(\"'\")) {\n return value;\n }\n\n return DANGEROUS_SPREADSHEET_FORMULA_PREFIX.test(value) ? `'${value}` : value;\n}\n","import { inject, Injectable } from '@angular/core';\nimport type { CellValue, Style } from 'exceljs';\n// import hash from 'object-hash';\nimport { DateUtilities } from '@sdcorejs/utils/fns';\nimport { BrowserUtilities } from '@sdcorejs/utils/fns';\nimport { FilePickerCancelledError } from '@sdcorejs/utils/errors';\nimport { I18nService } from '@sdcorejs/angular/i18n';\nimport { SdExcelExportOption, SdExcelTemplate } from './excel.model';\nimport { neutralizeSpreadsheetFormula } from './spreadsheet-formula-injection.util';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SdExcelService {\n readonly #i18n = inject(I18nService);\n #fieldStyle: Partial<Style> = {\n border: {\n bottom: { style: 'thin' },\n left: { style: 'thin' },\n right: { style: 'thin' },\n },\n alignment: {\n vertical: 'middle',\n horizontal: 'center',\n wrapText: true,\n },\n font: {\n bold: true,\n size: 11,\n color: { argb: '000000' },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: 'FAFAFA',\n },\n },\n };\n #titleColor = 'FFFFFF';\n #titleFgColor = '143180';\n #titleStyle: Partial<Style> = {\n border: {\n bottom: { style: 'thin' },\n left: { style: 'thin' },\n right: { style: 'thin' },\n },\n alignment: {\n vertical: 'middle',\n horizontal: 'center',\n wrapText: true,\n },\n font: {\n bold: true,\n size: 11,\n color: { argb: this.#titleColor },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: this.#titleFgColor,\n },\n },\n };\n\n #requiredStyle: Partial<Style> = {\n border: {\n bottom: { style: 'thin' },\n left: { style: 'thin' },\n right: { style: 'thin' },\n },\n alignment: {\n vertical: 'middle',\n horizontal: 'center',\n wrapText: true,\n },\n font: {\n italic: true,\n size: 11,\n color: { argb: 'FFFFFF' },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: 'FF1744',\n },\n },\n };\n\n #descriptionStyle: Partial<Style> = {\n border: {\n bottom: { style: 'thin' },\n left: { style: 'thin' },\n right: { style: 'thin' },\n },\n alignment: {\n wrapText: true,\n },\n font: {\n italic: true,\n size: 9,\n color: { argb: '000000' },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: 'CFD8DC',\n },\n },\n };\n\n #cellStyle: Partial<Style> = {\n alignment: {\n vertical: 'middle',\n wrapText: true,\n },\n };\n\n constructor() {}\n\n // exceljs là CJS module — khi dynamic import từ ESM, named export `Workbook`\n // có thể nằm trên `mod.Workbook` hoặc bị bọc trong `mod.default.Workbook` tuỳ bundler.\n // Helper này chuẩn hoá cả hai trường hợp.\n async #loadWorkbook(): Promise<new () => import('exceljs').Workbook> {\n const mod: any = await import('exceljs');\n return mod.Workbook ?? mod.default?.Workbook;\n }\n\n generateTemplate = async (template: SdExcelTemplate) => {\n const { fileName, columns, sheets } = template;\n if (!Array.isArray(columns)) {\n throw new Error('Excel template columns must be an array');\n }\n for (const [idx, column] of columns.entries()) {\n if (!column.field) {\n throw new Error(`Column ${idx + 1}: Field is required`);\n }\n if (!column.title) {\n throw new Error(`Column ${idx + 1}: Title is required`);\n }\n }\n const hasDescription = columns.some(column => column.description);\n const Workbook = await this.#loadWorkbook();\n const workbook = new Workbook();\n const firstSheet = workbook.addWorksheet('template'); // Lấy ra sheet đầu tiên\n columns.forEach((column, index) => {\n const { required, fill, fontColor } = column;\n const cellField = firstSheet.getCell(1, index + 1);\n const cellTitle = firstSheet.getCell(2, index + 1);\n const cellDescription = firstSheet.getCell(3, index + 1);\n let width = 120;\n if (column.width && column.width.endsWith('px')) {\n width = +column.width.replace('px', '');\n }\n firstSheet.getColumn(index + 1).width = width / 7 || 20;\n cellField.style = this.#fieldStyle;\n if (required) {\n cellField.style = this.#requiredStyle;\n } else {\n cellField.style = this.#fieldStyle;\n }\n cellTitle.style = {\n ...this.#titleStyle,\n font: {\n ...this.#titleStyle?.font,\n color: {\n ...this.#titleStyle?.font?.color,\n argb: fontColor || this.#titleStyle?.font?.color?.argb,\n },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: fill || this.#titleFgColor,\n },\n },\n };\n cellField.value = neutralizeSpreadsheetFormula(column.field);\n cellTitle.value = neutralizeSpreadsheetFormula(column.title);\n if (hasDescription) {\n cellDescription.style = this.#descriptionStyle;\n cellDescription.value = neutralizeSpreadsheetFormula(column.description || '');\n }\n });\n if (sheets?.length) {\n for (const sheet of sheets) {\n if (sheet.name && Array.isArray(sheet.items) && Array.isArray(sheet.headers)) {\n const newSheet = workbook.addWorksheet(sheet.name);\n sheet.headers.forEach((header, index) => {\n newSheet.getColumn(index + 1).width = 30;\n newSheet.getCell(1, index + 1).style = this.#titleStyle;\n newSheet.getCell(1, index + 1).value = neutralizeSpreadsheetFormula(header.value);\n newSheet.getCell(2, index + 1).style = this.#titleStyle;\n newSheet.getCell(2, index + 1).value = neutralizeSpreadsheetFormula(header.display || header.value);\n });\n sheet.items.forEach((item, idx1) => {\n sheet.headers.forEach((header, idx2) => {\n newSheet.getCell(3 + idx1, 1 + idx2).value = neutralizeSpreadsheetFormula(item[header.value]) as CellValue;\n newSheet.getCell(3 + idx1, 1 + idx2).style = this.#cellStyle;\n });\n });\n }\n }\n }\n const file = await workbook.xlsx.writeBuffer();\n BrowserUtilities.downloadBlob(\n new Blob([file], {\n type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n }),\n fileName\n );\n };\n\n exportCSV = async (option: SdExcelExportOption): Promise<void> => {\n const { columns, items, fileName } = option;\n const filename = `${fileName || 'CSV'}_${DateUtilities.toFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss')}.csv`;\n\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.\n // Dấu \" bên trong được nhân đôi theo chuẩn RFC 4180.\n const escape = (v: unknown): string => {\n if (v == null) return '';\n const s = typeof v === 'string' ? neutralizeSpreadsheetFormula(v) : String(v);\n return /[\",\\n\\r]/.test(s) ? `\"${s.replace(/\"/g, '\"\"')}\"` : s;\n };\n\n const headerLine = columns.map(c => escape(c.title)).join(',');\n const dataLines = items.map(item => columns.map(c => escape((item as Record<string, unknown>)[c.field])).join(','));\n\n // Prepend UTF-8 BOM so Excel opens Vietnamese text with the correct encoding.\n // Dùng CRLF vì Excel trên Windows ưu tiên, macOS Excel cũng chấp nhận.\n const csv = '\\uFEFF' + [headerLine, ...dataLines].join('\\r\\n');\n\n BrowserUtilities.downloadBlob(new Blob([csv], { type: 'text/csv;charset=utf-8;' }), filename);\n };\n\n /**\n * Serializes tabular values to an XLSX workbook and starts a browser download.\n * The main `data` sheet contains field keys, titles, optional descriptions,\n * then data. This browser API lazily loads ExcelJS; it does not mutate rows or\n * column options and does not convert application timezones.\n *\n * @param option Columns, rows, optional filename and additional sheets. Each\n * column requires a nonempty field and title. Empty columns/rows are allowed.\n * A nonempty `column.numFmt` applies only to number/Date data cells in the main\n * sheet; omitted or empty formats preserve existing behavior. Strings stay\n * text and are neutralized for spreadsheet formula injection. Nullish data\n * values remain blank. ExcelJS handles Date serialization in the 1900 system;\n * the caller owns valid serials, date ranges and timezone conversion.\n * @returns A promise resolving after serialization and the download trigger,\n * not after the user saves the file. There is no cancellation or timeout API.\n * @throws Rejects if a column lacks its field/title, or if loading ExcelJS,\n * serialization or the browser download helper fails.\n * @example\n * ```ts\n * import { inject } from '@angular/core';\n * import { SdExcelService } from '@sdcorejs/angular/services/excel';\n * // Inside an Angular injection context:\n * const excel = inject(SdExcelService);\n * await excel.export({\n * columns: [{ field: 'day', title: 'Day', numFmt: 'dd/mm/yyyy' }],\n * items: [{ day: 46323 }],\n * fileName: 'dates.xlsx',\n * }); // Excel displays a date cell as 28/10/2026.\n * ```\n */\n export = async (option: SdExcelExportOption) => {\n const { columns, items, fileName, sheets } = option;\n let hasDescription = false;\n for (const [idx, column] of columns.entries()) {\n if (!column.field) {\n throw new Error(`Column ${idx + 1}: Field is required`);\n }\n if (!column.title) {\n throw new Error(`Column ${idx + 1}: Title is required`);\n }\n if (column.description) {\n hasDescription = true;\n }\n }\n const Workbook = await this.#loadWorkbook();\n const workbook = new Workbook(); //await XlsxPopulate.fromBlankAsync(); // Đọc file sau khi đã download\n const firstSheet = workbook.addWorksheet('data'); // Lấy ra sheet đầu tiên\n columns.forEach((column, index) => {\n let width = 120;\n if (column.width && column.width.endsWith('px')) {\n width = +column.width.replace('px', '');\n }\n firstSheet.getColumn(index + 1).width = width / 7 || 20;\n firstSheet.getCell(1, index + 1).style = this.#fieldStyle;\n if (column.required) {\n firstSheet.getCell(2, index + 1).style = this.#requiredStyle;\n } else {\n firstSheet.getCell(2, index + 1).style = this.#titleStyle;\n }\n firstSheet.getCell(1, index + 1).value = neutralizeSpreadsheetFormula(column.field);\n firstSheet.getCell(2, index + 1).value = neutralizeSpreadsheetFormula(column.title);\n if (hasDescription) {\n firstSheet.getCell(3, index + 1).style = this.#descriptionStyle;\n firstSheet.getCell(3, index + 1).value = neutralizeSpreadsheetFormula(column.description || '');\n }\n });\n if (sheets?.length) {\n for (const sheet of sheets) {\n if (sheet.name && Array.isArray(sheet.items) && Array.isArray(sheet.headers)) {\n const newSheet = workbook.addWorksheet(sheet.name);\n sheet.headers.forEach((header, index) => {\n newSheet.getColumn(index + 1).width = 30;\n newSheet.getCell(1, index + 1).style = this.#titleStyle;\n newSheet.getCell(1, index + 1).value = neutralizeSpreadsheetFormula(header.value);\n newSheet.getCell(2, index + 1).style = this.#titleStyle;\n newSheet.getCell(2, index + 1).value = neutralizeSpreadsheetFormula(header.display || header.value);\n });\n sheet.items.forEach((item, idx1) => {\n sheet.headers.forEach((header, idx2) => {\n newSheet.getCell(3 + idx1, 1 + idx2).value = neutralizeSpreadsheetFormula(item[header.value]) as CellValue;\n newSheet.getCell(3 + idx1, 1 + idx2).style = this.#cellStyle;\n });\n });\n }\n }\n }\n\n const fromRow = hasDescription ? 4 : 3;\n items.forEach((e, idx1) => {\n columns.forEach((column, idx2) => {\n const cell = firstSheet.getCell(fromRow + idx1, 1 + idx2);\n const raw = e[column.field];\n if (typeof raw === 'number') {\n cell.value = +raw;\n // why: gán `cell.style` THAY THẾ toàn bộ object style (exceljs), nên numFmt phải nằm\n // trong cùng object — bản cũ set `cell.numFmt = '#'` TRƯỚC rồi gán style đè → numFmt\n // chưa từng có tác dụng. '#' cũng là format lỗi: 0 hiển thị ô TRỐNG và phần thập phân\n // bị làm tròn hiển thị → số nguyên dùng '0', số thập phân giữ General.\n cell.style = Number.isInteger(raw) ? { ...this.#cellStyle, numFmt: '0' } : { ...this.#cellStyle };\n } else {\n cell.value = neutralizeSpreadsheetFormula(raw) as CellValue;\n cell.style = { ...this.#cellStyle };\n }\n // Apply the explicit format last so styling cannot replace it; never parse text as dates.\n if (column.numFmt && (typeof raw === 'number' || raw instanceof Date)) {\n cell.numFmt = column.numFmt;\n }\n });\n });\n const file = await workbook.xlsx.writeBuffer();\n BrowserUtilities.downloadBlob(\n new Blob([file], {\n type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n }),\n fileName\n );\n };\n\n // Helper để lấy giá trị text chuẩn từ ô Excel (xử lý RichText, Formula, Hyperlink)\n #getCellValue = (value: CellValue): string | number | null | undefined | boolean | Date => {\n if (value && typeof value === 'object') {\n // Xử lý Rich Text (vd: ô bôi đậm)\n if ('richText' in value) {\n return value.richText.map(t => t.text).join('');\n }\n // Xử lý Hyperlink\n if ('text' in value) {\n return value.text as string; // hoặc value.result nếu là công thức\n }\n // Xử lý Formula\n if ('result' in value) {\n return value.result as any;\n }\n }\n return value as any;\n };\n upload = async (): Promise<{ items: Record<string, any>[]; file: File | null }> => {\n try {\n const fileResult = await BrowserUtilities.upload({\n extensions: ['xlsx'],\n maxSizeInMb: 10,\n });\n\n // Chuẩn hóa file đầu vào (nếu upload trả về mảng thì lấy phần tử đầu)\n const file = Array.isArray(fileResult) ? fileResult[0] : fileResult;\n\n if (!file) {\n return { items: [], file: null };\n }\n\n return await this.parse(file);\n } catch (error) {\n // why: từ `@sdcorejs/utils` 1.2, huỷ/timeout hộp chọn file reject `FilePickerCancelledError` thay vì\n // resolve `null`. Huỷ không phải lỗi — giữ nguyên kết quả rỗng như trước.\n if (error instanceof FilePickerCancelledError) return { items: [], file: null };\n console.error('Upload error:', error);\n throw error; // Hoặc return { items: [], file: null } tùy logic nghiệp vụ\n }\n };\n parse = async (file: File): Promise<{ items: Record<string, any>[]; file: File | null }> => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = async e => {\n try {\n const buffer = e.target?.result as ArrayBuffer;\n if (!buffer) {\n throw new Error(this.#i18n.t('core.excel.cannot-read-file'));\n }\n\n const Workbook = await this.#loadWorkbook();\n const wb = new Workbook();\n await wb.xlsx.load(buffer);\n\n const sheet = wb.worksheets[0];\n if (!sheet) {\n throw new Error(this.#i18n.t('core.excel.no-sheet'));\n }\n\n const items: Record<string, any>[] = [];\n\n // Lấy row Header (Row 1)\n const headerRow = sheet.getRow(1);\n // Map: Column Index (bắt đầu từ 1) -> Tên trường (Key)\n const headerMap: Record<number, string> = {};\n\n // Duyệt qua các ô có dữ liệu thực tế của dòng Header\n headerRow.eachCell((cell, colNumber) => {\n const cellValue = this.#getCellValue(cell.value);\n if (cellValue) {\n // Ép kiểu về string và trim để làm key\n headerMap[colNumber] = String(cellValue).trim();\n }\n });\n\n // Duyệt dữ liệu từ dòng 2 trở đi\n sheet.eachRow((row, rowIndex) => {\n if (rowIndex <= 1 || !row.hasValues) return;\n\n const item: Record<string, any> = {};\n\n // Chỉ duyệt qua các cột đã định nghĩa trong headerMap\n // Cách này an toàn hơn là duyệt mảng values\n Object.keys(headerMap).forEach(colKey => {\n const colNumber = Number(colKey);\n const fieldKey = headerMap[colNumber];\n\n // Lấy giá trị ô tại cột tương ứng\n const rawValue = this.#getCellValue(row.getCell(colNumber).value);\n\n let finalValue = rawValue;\n\n // Xử lý string: trim\n if (typeof finalValue === 'string') {\n finalValue = finalValue.trim();\n }\n\n // Xử lý các keyword đặc biệt\n if (finalValue === '' || finalValue === undefined) {\n finalValue = null;\n } else if (finalValue === 'SET_NULL') {\n finalValue = null;\n } else if (finalValue === 'SET_EMPTY') {\n finalValue = '';\n }\n\n item[fieldKey] = finalValue;\n });\n\n // Chỉ push nếu item có dữ liệu (tùy chọn)\n if (Object.keys(item).length > 0) {\n items.push(item);\n }\n });\n\n resolve({ items, file });\n } catch (err) {\n reject(err);\n }\n };\n\n reader.onerror = error => reject(error);\n reader.readAsArrayBuffer(file);\n });\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA,MAAM,oCAAoC,GAAG,gBAAgB;AAOvD,SAAU,4BAA4B,CAAC,KAAc,EAAA;AACzD,IAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;AACtE,QAAA,OAAO,KAAK;IACd;AAEA,IAAA,OAAO,oCAAoC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAA,CAAA,EAAI,KAAK,CAAA,CAAE,GAAG,KAAK;AAC/E;;MCAa,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;AACV,YAAA,IAAI,EAAE,EAAE;AACR,YAAA,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AAC1B,SAAA;AACD,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,SAAS;AACf,YAAA,OAAO,EAAE,OAAO;AAChB,YAAA,OAAO,EAAE;AACP,gBAAA,IAAI,EAAE,QAAQ;AACf,aAA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AAU,EAAE;gCACpC,UAAU,GAAG,IAAI;4BACnB;AAAO,iCAAA,IAAI,UAAU,KAAK,WAAW,EAAE;gCACrC,UAAU,GAAG,EAAE;4BACjB;AAEA,4BAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,UAAU;AAC7B,wBAAA,CAAC,CAAC;;wBAGF,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;AAChC,4BAAA,KAAK,CAAC,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;wGArdU,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;;;ACZD;;AAEG;;;;"}
@@ -0,0 +1,226 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, Injectable, DestroyRef, signal, effect, untracked } from '@angular/core';
3
+ import { NavigationEnd, NavigationCancel, NavigationError, NavigationSkipped, Router, ActivatedRoute } from '@angular/router';
4
+ import { merge, timer, NEVER } from 'rxjs';
5
+ import { filter, take, map, startWith, distinctUntilChanged } from 'rxjs/operators';
6
+
7
+ const isNavigationDone = (event) => event instanceof NavigationEnd ||
8
+ event instanceof NavigationCancel ||
9
+ event instanceof NavigationError ||
10
+ event instanceof NavigationSkipped;
11
+ /** Hàng đợi ghi dùng chung cho cả app: một navigation cho mọi param ghi trong cùng lượt. */
12
+ class ɵSdQueryParamWriter {
13
+ #router = inject(Router, { optional: true });
14
+ #pending = new Map();
15
+ #scheduled = false;
16
+ #waiting = false;
17
+ queue(owner, route, name, value) {
18
+ if (!this.#router)
19
+ return;
20
+ this.#pending.set(name, { value, route, owner });
21
+ this.#schedule();
22
+ }
23
+ cancel(owner) {
24
+ for (const [name, write] of this.#pending) {
25
+ if (write.owner === owner)
26
+ this.#pending.delete(name);
27
+ }
28
+ }
29
+ #schedule() {
30
+ if (this.#scheduled)
31
+ return;
32
+ this.#scheduled = true;
33
+ queueMicrotask(() => {
34
+ this.#scheduled = false;
35
+ this.#flush();
36
+ });
37
+ }
38
+ #flush() {
39
+ const router = this.#router;
40
+ if (!router || !this.#pending.size)
41
+ return;
42
+ // why: navigate() lúc router đang chạy một navigation khác sẽ huỷ navigation đó (vd người dùng vừa bấm menu).
43
+ // Chờ nó xong rồi xét lại: route của component có thể đã không còn trên màn hình. Chờ sự kiện kết thúc navigation
44
+ // (không poll liên tục — một guard hỏi xác nhận có thể giữ navigation rất lâu); 100ms là lưới an toàn cho trường hợp
45
+ // sự kiện đó đã phát trước khi navigation được dọn.
46
+ if (router.getCurrentNavigation()) {
47
+ if (!this.#waiting) {
48
+ this.#waiting = true;
49
+ merge(router.events.pipe(filter(isNavigationDone)), timer(100))
50
+ .pipe(take(1))
51
+ .subscribe(() => {
52
+ this.#waiting = false;
53
+ this.#schedule();
54
+ });
55
+ }
56
+ return;
57
+ }
58
+ const current = router.parseUrl(router.url).queryParamMap;
59
+ const queryParams = {};
60
+ let changed = false;
61
+ for (const [name, write] of this.#pending) {
62
+ if (write.route && !isRouteActive(router, write.route.snapshot))
63
+ continue;
64
+ if (current.get(name) === write.value)
65
+ continue;
66
+ queryParams[name] = write.value;
67
+ changed = true;
68
+ }
69
+ this.#pending.clear();
70
+ if (!changed)
71
+ return;
72
+ void router.navigate([], { queryParams, queryParamsHandling: 'merge', replaceUrl: true, preserveFragment: true });
73
+ }
74
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ɵSdQueryParamWriter, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
75
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ɵSdQueryParamWriter, providedIn: 'root' });
76
+ }
77
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ɵSdQueryParamWriter, decorators: [{
78
+ type: Injectable,
79
+ args: [{ providedIn: 'root' }]
80
+ }] });
81
+ /** Snapshot nằm trong cây router state hiện tại: route đó đang hiển thị (không phải tab nền hay trang đã rời). */
82
+ const isRouteActive = (router, snapshot) => {
83
+ const stack = [router.routerState.snapshot.root];
84
+ while (stack.length) {
85
+ const node = stack.pop();
86
+ if (node === snapshot)
87
+ return true;
88
+ stack.push(...node.children);
89
+ }
90
+ return false;
91
+ };
92
+ /**
93
+ * Tạo binding đọc/ghi query param cho component hiện tại. Gọi trong injection context. Ghi đang chờ bị huỷ khi
94
+ * component huỷ; ghi của route không còn hiển thị bị bỏ.
95
+ */
96
+ const ɵsdQueryParamSync = () => {
97
+ const router = inject(Router, { optional: true });
98
+ const route = inject(ActivatedRoute, { optional: true });
99
+ const writer = inject(ɵSdQueryParamWriter);
100
+ const owner = {};
101
+ let destroyed = false;
102
+ inject(DestroyRef).onDestroy(() => {
103
+ destroyed = true;
104
+ writer.cancel(owner);
105
+ });
106
+ // why: Router là `providedIn: 'root'` nên luôn inject được, kể cả app không gọi `provideRouter`. Không có route nào
107
+ // thì coi như app không dùng router: ghi URL lúc đó chỉ sinh navigation vô nghĩa.
108
+ if (!router || !router.config.length) {
109
+ return { available: false, value: () => null, changes: () => NEVER, write: () => undefined };
110
+ }
111
+ const value = (name) => route ? route.snapshot.queryParamMap.get(name) : router.parseUrl(router.url).queryParamMap.get(name);
112
+ const changes = (name) => (route
113
+ ? route.queryParamMap.pipe(map(params => params.get(name)))
114
+ : router.events.pipe(filter(event => event instanceof NavigationEnd), startWith(null), map(() => router.parseUrl(router.url).queryParamMap.get(name)))).pipe(distinctUntilChanged());
115
+ return {
116
+ available: true,
117
+ value,
118
+ changes,
119
+ write: (name, next) => {
120
+ if (!destroyed)
121
+ writer.queue(owner, route, name, next);
122
+ },
123
+ };
124
+ };
125
+ /**
126
+ * Nối state của component với query param `<prefix>-<autoId>` khi `syncQueryParams` bật. Gọi trong injection context.
127
+ *
128
+ * - URL có param khác state (lúc mở hay đổi từ ngoài) → `apply`.
129
+ * - State đổi → ghi (mặc định thì xoá param). Lần URL đổi do chính binding này ghi không bị áp dụng lại.
130
+ * - Param biến mất (vd bấm menu không có query) → giữ state và ghi lại.
131
+ * - Bật mà thiếu `autoId` → không làm gì, cảnh báo một lần (chỉ khi app có route).
132
+ */
133
+ const ɵsdQueryParamState = (options) => {
134
+ const sync = ɵsdQueryParamSync();
135
+ const value = signal(undefined);
136
+ // why: giá trị mình đã ghi nhưng URL chưa phản hồi. URL phát lại đúng giá trị đó là "tiếng vọng", không phải thay đổi
137
+ // từ ngoài — áp dụng lại sẽ giật state về giá trị cũ khi người dùng thao tác nhanh hơn navigation. Ghi có thể bị gộp
138
+ // hoặc bỏ (route không hiển thị), nên khi URL đã khớp state thì danh sách này được xoá.
139
+ const echoes = [];
140
+ let processed;
141
+ // State lúc `apply` báo đích chưa có; `undefined` khi không có giá trị nào đang chờ.
142
+ let pendingState;
143
+ let warned = false;
144
+ const name = () => {
145
+ if (!options.enabled() || !sync.available)
146
+ return null;
147
+ const autoId = options.autoId();
148
+ if (!autoId) {
149
+ if (!warned) {
150
+ warned = true;
151
+ console.warn(`[${options.selector}] syncQueryParams needs autoId: the state is not written to the URL.`);
152
+ }
153
+ return null;
154
+ }
155
+ return `${options.prefix}-${autoId}`;
156
+ };
157
+ effect(onCleanup => {
158
+ const param = name();
159
+ value.set(undefined);
160
+ processed = undefined;
161
+ pendingState = undefined;
162
+ echoes.length = 0;
163
+ if (!param)
164
+ return;
165
+ const subscription = sync.changes(param).subscribe(next => value.set(next));
166
+ onCleanup(() => subscription.unsubscribe());
167
+ });
168
+ effect(() => {
169
+ const param = untracked(name);
170
+ const current = value();
171
+ // why: thoát trước khi đọc state — bảng tắt sync không phải serialize state mỗi lần lọc.
172
+ if (!param || current === undefined)
173
+ return;
174
+ const ready = options.ready ? options.ready() : true;
175
+ const state = options.state();
176
+ if (!ready)
177
+ return;
178
+ untracked(() => {
179
+ if (current !== processed) {
180
+ const echo = echoes.lastIndexOf(current);
181
+ if (echo >= 0) {
182
+ echoes.splice(0, echo + 1);
183
+ }
184
+ else if (current !== null && current !== state) {
185
+ // Đang chờ đích mà người dùng đã tự đổi state: bỏ giá trị chờ, ghi state.
186
+ if (pendingState === undefined || pendingState === state) {
187
+ const result = options.apply(current);
188
+ if (options.state() !== state) {
189
+ // Đã áp dụng: state đổi và effect chạy lại.
190
+ processed = current;
191
+ pendingState = undefined;
192
+ return;
193
+ }
194
+ if (result === false) {
195
+ pendingState = state;
196
+ return;
197
+ }
198
+ }
199
+ }
200
+ processed = current;
201
+ pendingState = undefined;
202
+ }
203
+ if (state === current) {
204
+ echoes.length = 0;
205
+ return;
206
+ }
207
+ if (echoes[echoes.length - 1] !== state) {
208
+ echoes.push(state);
209
+ sync.write(param, state);
210
+ }
211
+ });
212
+ });
213
+ return {
214
+ value: () => {
215
+ const param = untracked(name);
216
+ return param ? sync.value(param) : null;
217
+ },
218
+ };
219
+ };
220
+
221
+ /**
222
+ * Generated bundle index. Do not edit.
223
+ */
224
+
225
+ export { ɵSdQueryParamWriter, ɵsdQueryParamState, ɵsdQueryParamSync };
226
+ //# sourceMappingURL=sdcorejs-angular-services-query-params.mjs.map