@sdcorejs/angular 22.3.1 → 22.3.3

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 (386) hide show
  1. package/assets/STYLE-GUIDE.md +25 -5
  2. package/assets/THEME.md +289 -5
  3. package/assets/licenses/tiptap-oss-NOTICES.txt +332 -0
  4. package/assets/scss/ckeditor5.scss +2 -88
  5. package/assets/scss/core/_control.scss +39 -0
  6. package/assets/scss/core/form.scss +444 -45
  7. package/assets/scss/core/view.scss +24 -0
  8. package/assets/scss/editor-content.scss +173 -0
  9. package/assets/scss/sd-core.scss +1 -0
  10. package/assets/scss/themes/_component-tokens.scss +123 -32
  11. package/assets/scss/themes/_material-tokens.scss +112 -0
  12. package/assets/scss/themes/_presets.scss +25 -0
  13. package/assets/scss/themes/_scales.scss +10 -0
  14. package/assets/scss/themes/_semantic.scss +13 -0
  15. package/assets/scss/themes/default.scss +8 -2
  16. package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs +5 -5
  17. package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs.map +1 -1
  18. package/fesm2022/sdcorejs-angular-components-avatar.mjs +166 -11
  19. package/fesm2022/sdcorejs-angular-components-avatar.mjs.map +1 -1
  20. package/fesm2022/sdcorejs-angular-components-badge.mjs +590 -24
  21. package/fesm2022/sdcorejs-angular-components-badge.mjs.map +1 -1
  22. package/fesm2022/sdcorejs-angular-components-button.mjs +35 -3
  23. package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
  24. package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs +5 -20
  25. package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs.map +1 -1
  26. package/fesm2022/sdcorejs-angular-components-data-state.mjs +1 -1
  27. package/fesm2022/sdcorejs-angular-components-data-state.mjs.map +1 -1
  28. package/fesm2022/sdcorejs-angular-components-editor-engine.mjs +1906 -0
  29. package/fesm2022/sdcorejs-angular-components-editor-engine.mjs.map +1 -0
  30. package/fesm2022/sdcorejs-angular-components-editor.mjs +461 -757
  31. package/fesm2022/sdcorejs-angular-components-editor.mjs.map +1 -1
  32. package/fesm2022/sdcorejs-angular-components-file-explorer.mjs +69 -37
  33. package/fesm2022/sdcorejs-angular-components-file-explorer.mjs.map +1 -1
  34. package/fesm2022/sdcorejs-angular-components-form-generic.mjs +2195 -1182
  35. package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
  36. package/fesm2022/sdcorejs-angular-components-history.mjs +5 -2
  37. package/fesm2022/sdcorejs-angular-components-history.mjs.map +1 -1
  38. package/fesm2022/sdcorejs-angular-components-image-editor.mjs +1 -1
  39. package/fesm2022/sdcorejs-angular-components-image-editor.mjs.map +1 -1
  40. package/fesm2022/sdcorejs-angular-components-import-excel.mjs +21 -6
  41. package/fesm2022/sdcorejs-angular-components-import-excel.mjs.map +1 -1
  42. package/fesm2022/sdcorejs-angular-components-inform.mjs +1 -1
  43. package/fesm2022/sdcorejs-angular-components-inform.mjs.map +1 -1
  44. package/fesm2022/sdcorejs-angular-components-kanban.mjs +12 -2
  45. package/fesm2022/sdcorejs-angular-components-kanban.mjs.map +1 -1
  46. package/fesm2022/sdcorejs-angular-components-mini-editor.mjs +182 -284
  47. package/fesm2022/sdcorejs-angular-components-mini-editor.mjs.map +1 -1
  48. package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs +1 -316
  49. package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs.map +1 -1
  50. package/fesm2022/sdcorejs-angular-components-modal.mjs +2 -2
  51. package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
  52. package/fesm2022/sdcorejs-angular-components-operator.mjs +274 -44
  53. package/fesm2022/sdcorejs-angular-components-operator.mjs.map +1 -1
  54. package/fesm2022/sdcorejs-angular-components-query-bar.mjs +12 -12
  55. package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
  56. package/fesm2022/sdcorejs-angular-components-query-builder.mjs +1 -1
  57. package/fesm2022/sdcorejs-angular-components-query-builder.mjs.map +1 -1
  58. package/fesm2022/sdcorejs-angular-components-section.mjs +17 -5
  59. package/fesm2022/sdcorejs-angular-components-section.mjs.map +1 -1
  60. package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +2 -2
  61. package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
  62. package/fesm2022/sdcorejs-angular-components-splitter.mjs.map +1 -1
  63. package/fesm2022/sdcorejs-angular-components-tab-router.mjs +574 -95
  64. package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
  65. package/fesm2022/sdcorejs-angular-components-table.mjs +1034 -119
  66. package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
  67. package/fesm2022/sdcorejs-angular-components-tree.mjs +1 -1
  68. package/fesm2022/sdcorejs-angular-components-tree.mjs.map +1 -1
  69. package/fesm2022/sdcorejs-angular-components-upload-file.mjs +932 -174
  70. package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
  71. package/fesm2022/sdcorejs-angular-components-view.mjs +2 -2
  72. package/fesm2022/sdcorejs-angular-components-view.mjs.map +1 -1
  73. package/fesm2022/sdcorejs-angular-components-window.mjs +498 -0
  74. package/fesm2022/sdcorejs-angular-components-window.mjs.map +1 -0
  75. package/fesm2022/sdcorejs-angular-components.mjs +1 -0
  76. package/fesm2022/sdcorejs-angular-components.mjs.map +1 -1
  77. package/fesm2022/sdcorejs-angular-configurations.mjs.map +1 -1
  78. package/fesm2022/sdcorejs-angular-directives.mjs +18 -1
  79. package/fesm2022/sdcorejs-angular-directives.mjs.map +1 -1
  80. package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs +20 -2
  81. package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs.map +1 -1
  82. package/fesm2022/sdcorejs-angular-forms-checkbox.mjs +2 -2
  83. package/fesm2022/sdcorejs-angular-forms-checkbox.mjs.map +1 -1
  84. package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs +483 -126
  85. package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs.map +1 -1
  86. package/fesm2022/sdcorejs-angular-forms-chip.mjs +437 -122
  87. package/fesm2022/sdcorejs-angular-forms-chip.mjs.map +1 -1
  88. package/fesm2022/sdcorejs-angular-forms-date-range.mjs +86 -13
  89. package/fesm2022/sdcorejs-angular-forms-date-range.mjs.map +1 -1
  90. package/fesm2022/sdcorejs-angular-forms-date.mjs +81 -18
  91. package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
  92. package/fesm2022/sdcorejs-angular-forms-datetime.mjs +79 -16
  93. package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
  94. package/fesm2022/sdcorejs-angular-forms-directives.mjs +90 -2
  95. package/fesm2022/sdcorejs-angular-forms-directives.mjs.map +1 -1
  96. package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs +2 -2
  97. package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs.map +1 -1
  98. package/fesm2022/sdcorejs-angular-forms-input-color.mjs +1 -1
  99. package/fesm2022/sdcorejs-angular-forms-input-color.mjs.map +1 -1
  100. package/fesm2022/sdcorejs-angular-forms-input-number.mjs +63 -6
  101. package/fesm2022/sdcorejs-angular-forms-input-number.mjs.map +1 -1
  102. package/fesm2022/sdcorejs-angular-forms-input.mjs +60 -7
  103. package/fesm2022/sdcorejs-angular-forms-input.mjs.map +1 -1
  104. package/fesm2022/sdcorejs-angular-forms-models.mjs +88 -5
  105. package/fesm2022/sdcorejs-angular-forms-models.mjs.map +1 -1
  106. package/fesm2022/sdcorejs-angular-forms-radio.mjs +2 -2
  107. package/fesm2022/sdcorejs-angular-forms-radio.mjs.map +1 -1
  108. package/fesm2022/sdcorejs-angular-forms-segmented.mjs +5 -4
  109. package/fesm2022/sdcorejs-angular-forms-segmented.mjs.map +1 -1
  110. package/fesm2022/sdcorejs-angular-forms-select.mjs +95 -33
  111. package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
  112. package/fesm2022/sdcorejs-angular-forms-switch.mjs +2 -2
  113. package/fesm2022/sdcorejs-angular-forms-switch.mjs.map +1 -1
  114. package/fesm2022/sdcorejs-angular-forms-textarea.mjs +16 -3
  115. package/fesm2022/sdcorejs-angular-forms-textarea.mjs.map +1 -1
  116. package/fesm2022/sdcorejs-angular-forms-time.mjs +2 -2
  117. package/fesm2022/sdcorejs-angular-forms-time.mjs.map +1 -1
  118. package/fesm2022/sdcorejs-angular-forms-tree-select.mjs +1 -1
  119. package/fesm2022/sdcorejs-angular-forms-tree-select.mjs.map +1 -1
  120. package/fesm2022/sdcorejs-angular-i18n.mjs +1745 -22
  121. package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
  122. package/fesm2022/sdcorejs-angular-interceptors.mjs +1 -1
  123. package/fesm2022/sdcorejs-angular-interceptors.mjs.map +1 -1
  124. package/fesm2022/sdcorejs-angular-modules-generic-generic-configuration.page-SJIWI1dX.mjs +509 -0
  125. package/fesm2022/sdcorejs-angular-modules-generic-generic-configuration.page-SJIWI1dX.mjs.map +1 -0
  126. package/fesm2022/sdcorejs-angular-modules-generic-generic-form-host.page-BPhMLVbv.mjs +232 -0
  127. package/fesm2022/sdcorejs-angular-modules-generic-generic-form-host.page-BPhMLVbv.mjs.map +1 -0
  128. package/fesm2022/sdcorejs-angular-modules-generic-generic-list.page-aGhowe9Y.mjs +294 -0
  129. package/fesm2022/sdcorejs-angular-modules-generic-generic-list.page-aGhowe9Y.mjs.map +1 -0
  130. package/fesm2022/sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-N8_oGpqD.mjs +1556 -0
  131. package/fesm2022/sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-N8_oGpqD.mjs.map +1 -0
  132. package/fesm2022/sdcorejs-angular-modules-generic.mjs +2 -0
  133. package/fesm2022/sdcorejs-angular-modules-generic.mjs.map +1 -0
  134. package/fesm2022/sdcorejs-angular-modules-icon.mjs +96 -3
  135. package/fesm2022/sdcorejs-angular-modules-icon.mjs.map +1 -1
  136. package/fesm2022/sdcorejs-angular-modules-layout.mjs +2178 -38
  137. package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
  138. package/fesm2022/sdcorejs-angular-modules-pattern-api-error-BBWwQ6h2.mjs +23 -0
  139. package/fesm2022/sdcorejs-angular-modules-pattern-api-error-BBWwQ6h2.mjs.map +1 -0
  140. package/fesm2022/sdcorejs-angular-modules-pattern-approval-inbox-BMwD6_FC.mjs +16 -0
  141. package/fesm2022/sdcorejs-angular-modules-pattern-approval-inbox-BMwD6_FC.mjs.map +1 -0
  142. package/fesm2022/sdcorejs-angular-modules-pattern-base-api.service-Cfmr0L_5.mjs +51 -0
  143. package/fesm2022/sdcorejs-angular-modules-pattern-base-api.service-Cfmr0L_5.mjs.map +1 -0
  144. package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-C7-itJqB.mjs +134 -0
  145. package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-C7-itJqB.mjs.map +1 -0
  146. package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CxgmaNod.mjs +132 -0
  147. package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CxgmaNod.mjs.map +1 -0
  148. package/fesm2022/sdcorejs-angular-modules-pattern-create.component-C2GdGhkJ.mjs +100 -0
  149. package/fesm2022/sdcorejs-angular-modules-pattern-create.component-C2GdGhkJ.mjs.map +1 -0
  150. package/fesm2022/sdcorejs-angular-modules-pattern-create.component-CzJh4LMR.mjs +119 -0
  151. package/fesm2022/sdcorejs-angular-modules-pattern-create.component-CzJh4LMR.mjs.map +1 -0
  152. package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DIivNX4o.mjs +469 -0
  153. package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DIivNX4o.mjs.map +1 -0
  154. package/fesm2022/sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs +18 -0
  155. package/fesm2022/sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs.map +1 -0
  156. package/fesm2022/sdcorejs-angular-modules-pattern-customer.service-B0nhFd_M.mjs +67 -0
  157. package/fesm2022/sdcorejs-angular-modules-pattern-customer.service-B0nhFd_M.mjs.map +1 -0
  158. package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-D1dqsKX0.mjs +152 -0
  159. package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-D1dqsKX0.mjs.map +1 -0
  160. package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-Dkmm0a2Y.mjs +479 -0
  161. package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-Dkmm0a2Y.mjs.map +1 -0
  162. package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-WK0AcxNJ.mjs +175 -0
  163. package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-WK0AcxNJ.mjs.map +1 -0
  164. package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-yJ5fPyYU.mjs +92 -0
  165. package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-yJ5fPyYU.mjs.map +1 -0
  166. package/fesm2022/sdcorejs-angular-modules-pattern-flow.component-BvhEMUgY.mjs +533 -0
  167. package/fesm2022/sdcorejs-angular-modules-pattern-flow.component-BvhEMUgY.mjs.map +1 -0
  168. package/fesm2022/sdcorejs-angular-modules-pattern-form-api-errors-Ydotvlyc.mjs +64 -0
  169. package/fesm2022/sdcorejs-angular-modules-pattern-form-api-errors-Ydotvlyc.mjs.map +1 -0
  170. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-D8-WXUAE.mjs +92 -0
  171. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-D8-WXUAE.mjs.map +1 -0
  172. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-DHTxzjRN.mjs +242 -0
  173. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-DHTxzjRN.mjs.map +1 -0
  174. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-cxNRkeRU.mjs +179 -0
  175. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-cxNRkeRU.mjs.map +1 -0
  176. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-CTgHdGeQ.mjs +72 -0
  177. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-CTgHdGeQ.mjs.map +1 -0
  178. package/fesm2022/sdcorejs-angular-modules-pattern-index.component-D1zWXyN6.mjs +100 -0
  179. package/fesm2022/sdcorejs-angular-modules-pattern-index.component-D1zWXyN6.mjs.map +1 -0
  180. package/fesm2022/sdcorejs-angular-modules-pattern-lines-form.component-BK__9Mzb.mjs +541 -0
  181. package/fesm2022/sdcorejs-angular-modules-pattern-lines-form.component-BK__9Mzb.mjs.map +1 -0
  182. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-1Xn1WaAP.mjs +647 -0
  183. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-1Xn1WaAP.mjs.map +1 -0
  184. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-B6Ndq542.mjs +120 -0
  185. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-B6Ndq542.mjs.map +1 -0
  186. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-Bv_l7vnz.mjs +73 -0
  187. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-Bv_l7vnz.mjs.map +1 -0
  188. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CaXgC8wK.mjs +172 -0
  189. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CaXgC8wK.mjs.map +1 -0
  190. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-ChwTb4BU.mjs +118 -0
  191. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-ChwTb4BU.mjs.map +1 -0
  192. package/fesm2022/sdcorejs-angular-modules-pattern-mock-backend.factory-DKK3NmbN.mjs +1069 -0
  193. package/fesm2022/sdcorejs-angular-modules-pattern-mock-backend.factory-DKK3NmbN.mjs.map +1 -0
  194. package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-BpLQaYP5.mjs +186 -0
  195. package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-BpLQaYP5.mjs.map +1 -0
  196. package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-BrejHvB2.mjs +97 -0
  197. package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-BrejHvB2.mjs.map +1 -0
  198. package/fesm2022/sdcorejs-angular-modules-pattern-product.model-BoHLJ8vf.mjs +12 -0
  199. package/fesm2022/sdcorejs-angular-modules-pattern-product.model-BoHLJ8vf.mjs.map +1 -0
  200. package/fesm2022/sdcorejs-angular-modules-pattern-product.service-GSlXwL2Z.mjs +49 -0
  201. package/fesm2022/sdcorejs-angular-modules-pattern-product.service-GSlXwL2Z.mjs.map +1 -0
  202. package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-DPBwMafn.mjs +301 -0
  203. package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-DPBwMafn.mjs.map +1 -0
  204. package/fesm2022/sdcorejs-angular-modules-pattern-routes-1kifjm82.mjs +100 -0
  205. package/fesm2022/sdcorejs-angular-modules-pattern-routes-1kifjm82.mjs.map +1 -0
  206. package/fesm2022/sdcorejs-angular-modules-pattern-routes-B6z9lJYB.mjs +45 -0
  207. package/fesm2022/sdcorejs-angular-modules-pattern-routes-B6z9lJYB.mjs.map +1 -0
  208. package/fesm2022/sdcorejs-angular-modules-pattern-routes-D1fsRfRB.mjs +66 -0
  209. package/fesm2022/sdcorejs-angular-modules-pattern-routes-D1fsRfRB.mjs.map +1 -0
  210. package/fesm2022/sdcorejs-angular-modules-pattern-routes-DdCFCwxY.mjs +50 -0
  211. package/fesm2022/sdcorejs-angular-modules-pattern-routes-DdCFCwxY.mjs.map +1 -0
  212. package/fesm2022/sdcorejs-angular-modules-pattern-routes-DeThmv4f.mjs +74 -0
  213. package/fesm2022/sdcorejs-angular-modules-pattern-routes-DeThmv4f.mjs.map +1 -0
  214. package/fesm2022/sdcorejs-angular-modules-pattern-routes-bQpdxKlY.mjs +166 -0
  215. package/fesm2022/sdcorejs-angular-modules-pattern-routes-bQpdxKlY.mjs.map +1 -0
  216. package/fesm2022/sdcorejs-angular-modules-pattern-routes-h66efEeH.mjs +74 -0
  217. package/fesm2022/sdcorejs-angular-modules-pattern-routes-h66efEeH.mjs.map +1 -0
  218. package/fesm2022/sdcorejs-angular-modules-pattern-routes-t3O2L2J5.mjs +43 -0
  219. package/fesm2022/sdcorejs-angular-modules-pattern-routes-t3O2L2J5.mjs.map +1 -0
  220. package/fesm2022/sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-B6w4N6wo.mjs +413 -0
  221. package/fesm2022/sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-B6w4N6wo.mjs.map +1 -0
  222. package/fesm2022/sdcorejs-angular-modules-pattern-shell.component-BIYHlzVQ.mjs +325 -0
  223. package/fesm2022/sdcorejs-angular-modules-pattern-shell.component-BIYHlzVQ.mjs.map +1 -0
  224. package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-DKgmhJT2.mjs +146 -0
  225. package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-DKgmhJT2.mjs.map +1 -0
  226. package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-nnldn2cz.mjs +135 -0
  227. package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-nnldn2cz.mjs.map +1 -0
  228. package/fesm2022/sdcorejs-angular-modules-pattern-update.component-C0Bewuwz.mjs +129 -0
  229. package/fesm2022/sdcorejs-angular-modules-pattern-update.component-C0Bewuwz.mjs.map +1 -0
  230. package/fesm2022/sdcorejs-angular-modules-pattern-update.component-Qlh3Lm2p.mjs +360 -0
  231. package/fesm2022/sdcorejs-angular-modules-pattern-update.component-Qlh3Lm2p.mjs.map +1 -0
  232. package/fesm2022/sdcorejs-angular-modules-pattern-update.component-p9R5-eou.mjs +101 -0
  233. package/fesm2022/sdcorejs-angular-modules-pattern-update.component-p9R5-eou.mjs.map +1 -0
  234. package/fesm2022/sdcorejs-angular-modules-pattern.mjs +2 -0
  235. package/fesm2022/sdcorejs-angular-modules-pattern.mjs.map +1 -0
  236. package/fesm2022/sdcorejs-angular-modules.mjs +1 -0
  237. package/fesm2022/sdcorejs-angular-modules.mjs.map +1 -1
  238. package/fesm2022/sdcorejs-angular-pipes.mjs +27 -7
  239. package/fesm2022/sdcorejs-angular-pipes.mjs.map +1 -1
  240. package/fesm2022/sdcorejs-angular-services-confirm.mjs +1 -1
  241. package/fesm2022/sdcorejs-angular-services-confirm.mjs.map +1 -1
  242. package/fesm2022/sdcorejs-angular-services-date-time.mjs +143 -0
  243. package/fesm2022/sdcorejs-angular-services-date-time.mjs.map +1 -0
  244. package/fesm2022/sdcorejs-angular-services-storage.mjs +44 -8
  245. package/fesm2022/sdcorejs-angular-services-storage.mjs.map +1 -1
  246. package/fesm2022/sdcorejs-angular-services-unsaved-changes.mjs +104 -4
  247. package/fesm2022/sdcorejs-angular-services-unsaved-changes.mjs.map +1 -1
  248. package/fesm2022/sdcorejs-angular-services.mjs +1 -0
  249. package/fesm2022/sdcorejs-angular-services.mjs.map +1 -1
  250. package/fesm2022/sdcorejs-angular-utilities-read-state.mjs +4 -0
  251. package/fesm2022/sdcorejs-angular-utilities-read-state.mjs.map +1 -1
  252. package/fesm2022/sdcorejs-angular-utilities-theme.mjs +10 -0
  253. package/fesm2022/sdcorejs-angular-utilities-theme.mjs.map +1 -1
  254. package/modules/pattern/README.md +76 -0
  255. package/modules/pattern/docs/detail.md +237 -0
  256. package/modules/pattern/docs/drawer.md +484 -0
  257. package/modules/pattern/docs/flow.md +631 -0
  258. package/modules/pattern/docs/form.md +518 -0
  259. package/modules/pattern/docs/header-actions.md +342 -0
  260. package/modules/pattern/docs/list.md +247 -0
  261. package/modules/pattern/docs/relation.md +180 -0
  262. package/modules/pattern/docs/select.md +206 -0
  263. package/modules/pattern/docs/split.md +350 -0
  264. package/modules/pattern/docs/states.md +168 -0
  265. package/modules/pattern/features/approval/entity.resolver.ts +21 -0
  266. package/modules/pattern/features/approval/pages/detail/detail.component.ts +139 -0
  267. package/modules/pattern/features/approval/pages/list/approval-inbox.ts +7 -0
  268. package/modules/pattern/features/approval/pages/list/list.component.html +20 -0
  269. package/modules/pattern/features/approval/pages/list/list.component.ts +149 -0
  270. package/modules/pattern/features/approval/routes.ts +30 -0
  271. package/modules/pattern/features/approval/services/approval.model.ts +38 -0
  272. package/modules/pattern/features/approval/services/approval.service.ts +23 -0
  273. package/modules/pattern/features/category/components/create-side-drawer/create-side-drawer.component.ts +123 -0
  274. package/modules/pattern/features/category/components/general-information-form/general-information-form.component.ts +61 -0
  275. package/modules/pattern/features/category/components/update-side-drawer/update-side-drawer.component.ts +134 -0
  276. package/modules/pattern/features/category/entity.resolver.ts +27 -0
  277. package/modules/pattern/features/category/pages/list/list.component.html +20 -0
  278. package/modules/pattern/features/category/pages/list/list.component.ts +105 -0
  279. package/modules/pattern/features/category/routes.ts +42 -0
  280. package/modules/pattern/features/category/services/category.model.ts +39 -0
  281. package/modules/pattern/features/category/services/category.service.ts +36 -0
  282. package/modules/pattern/features/customer/components/create-side-drawer/create-side-drawer.component.ts +131 -0
  283. package/modules/pattern/features/customer/components/customer-select/customer-select.component.ts +72 -0
  284. package/modules/pattern/features/customer/components/customer-type-select/customer-type-select.component.ts +30 -0
  285. package/modules/pattern/features/customer/components/debts-view/debts-view.component.ts +28 -0
  286. package/modules/pattern/features/customer/components/detail-side-drawer/detail-side-drawer.component.ts +106 -0
  287. package/modules/pattern/features/customer/components/documents-view/documents-view.component.ts +50 -0
  288. package/modules/pattern/features/customer/components/general-information-form/general-information-form.component.ts +140 -0
  289. package/modules/pattern/features/customer/components/general-information-view/general-information-view.component.ts +39 -0
  290. package/modules/pattern/features/customer/components/orders-view/orders-view.component.ts +35 -0
  291. package/modules/pattern/features/customer/components/summary-cards/summary-cards.component.ts +101 -0
  292. package/modules/pattern/features/customer/components/update-side-drawer/update-side-drawer.component.ts +127 -0
  293. package/modules/pattern/features/customer/entity.resolver.ts +21 -0
  294. package/modules/pattern/features/customer/pages/list/list.component.html +22 -0
  295. package/modules/pattern/features/customer/pages/list/list.component.ts +113 -0
  296. package/modules/pattern/features/customer/pages/profile/profile.component.ts +120 -0
  297. package/modules/pattern/features/customer/pipes/customer-detail.pipe.ts +18 -0
  298. package/modules/pattern/features/customer/routes.ts +59 -0
  299. package/modules/pattern/features/customer/services/customer.model.ts +87 -0
  300. package/modules/pattern/features/customer/services/customer.service.ts +79 -0
  301. package/modules/pattern/features/import/components/mapping-form/mapping-form.component.ts +41 -0
  302. package/modules/pattern/features/import/components/preview-view/preview-view.component.ts +44 -0
  303. package/modules/pattern/features/import/pages/flow/flow.component.ts +269 -0
  304. package/modules/pattern/features/import/routes.ts +19 -0
  305. package/modules/pattern/features/import/services/import.model.ts +82 -0
  306. package/modules/pattern/features/import/services/import.service.ts +18 -0
  307. package/modules/pattern/features/order/components/approval-steps/approval-steps.component.ts +74 -0
  308. package/modules/pattern/features/order/components/bulk-result/bulk-result.component.ts +46 -0
  309. package/modules/pattern/features/order/components/general-information-form/general-information-form.component.ts +96 -0
  310. package/modules/pattern/features/order/components/lines-form/lines-form.component.ts +205 -0
  311. package/modules/pattern/features/order/components/lines-view/lines-view.component.ts +42 -0
  312. package/modules/pattern/features/order/components/summary-cards/summary-cards.component.ts +128 -0
  313. package/modules/pattern/features/order/entity.resolver.ts +37 -0
  314. package/modules/pattern/features/order/pages/create/create.component.ts +99 -0
  315. package/modules/pattern/features/order/pages/detail/detail.component.ts +222 -0
  316. package/modules/pattern/features/order/pages/list/list.component.html +38 -0
  317. package/modules/pattern/features/order/pages/list/list.component.ts +291 -0
  318. package/modules/pattern/features/order/pages/update/update.component.ts +119 -0
  319. package/modules/pattern/features/order/routes.ts +54 -0
  320. package/modules/pattern/features/order/services/order.model.ts +109 -0
  321. package/modules/pattern/features/order/services/order.service.ts +63 -0
  322. package/modules/pattern/features/partner/pages/create/create.component.ts +324 -0
  323. package/modules/pattern/features/partner/routes.ts +20 -0
  324. package/modules/pattern/features/partner/services/partner.model.ts +30 -0
  325. package/modules/pattern/features/partner/services/partner.service.ts +17 -0
  326. package/modules/pattern/features/product/components/general-information-form/general-information-form.component.ts +88 -0
  327. package/modules/pattern/features/product/components/product-select/product-select.component.ts +65 -0
  328. package/modules/pattern/features/product/components/product-status-select/product-status-select.component.ts +30 -0
  329. package/modules/pattern/features/product/entity.resolver.ts +21 -0
  330. package/modules/pattern/features/product/pages/create/create.component.ts +85 -0
  331. package/modules/pattern/features/product/pages/detail/detail.component.ts +53 -0
  332. package/modules/pattern/features/product/pages/list/list.component.html +30 -0
  333. package/modules/pattern/features/product/pages/list/list.component.ts +71 -0
  334. package/modules/pattern/features/product/pages/update/update.component.ts +86 -0
  335. package/modules/pattern/features/product/pipes/product-detail.pipe.ts +18 -0
  336. package/modules/pattern/features/product/routes.ts +48 -0
  337. package/modules/pattern/features/product/services/product.model.ts +38 -0
  338. package/modules/pattern/features/product/services/product.service.ts +48 -0
  339. package/modules/pattern/features/settings/pages/update/update.component.ts +227 -0
  340. package/modules/pattern/features/settings/routes.ts +24 -0
  341. package/modules/pattern/features/settings/services/settings.model.ts +18 -0
  342. package/modules/pattern/features/settings/services/settings.service.ts +15 -0
  343. package/modules/pattern/features/settings/settings.resolver.ts +8 -0
  344. package/package.json +44 -7
  345. package/types/sdcorejs-angular-components-avatar.d.ts +67 -2
  346. package/types/sdcorejs-angular-components-badge.d.ts +206 -6
  347. package/types/sdcorejs-angular-components-button.d.ts +20 -1
  348. package/types/sdcorejs-angular-components-ckeditor-styles.d.ts +3 -18
  349. package/types/sdcorejs-angular-components-editor-engine.d.ts +246 -0
  350. package/types/sdcorejs-angular-components-editor.d.ts +20 -17
  351. package/types/sdcorejs-angular-components-file-explorer.d.ts +4 -2
  352. package/types/sdcorejs-angular-components-form-generic.d.ts +246 -35
  353. package/types/sdcorejs-angular-components-mini-editor.d.ts +33 -70
  354. package/types/sdcorejs-angular-components-modal-resizable.d.ts +1 -124
  355. package/types/sdcorejs-angular-components-operator.d.ts +137 -8
  356. package/types/sdcorejs-angular-components-section.d.ts +13 -1
  357. package/types/sdcorejs-angular-components-splitter.d.ts +1 -1
  358. package/types/sdcorejs-angular-components-tab-router.d.ts +74 -19
  359. package/types/sdcorejs-angular-components-table.d.ts +210 -18
  360. package/types/sdcorejs-angular-components-upload-file.d.ts +181 -21
  361. package/types/sdcorejs-angular-components-window.d.ts +81 -0
  362. package/types/sdcorejs-angular-components.d.ts +1 -0
  363. package/types/sdcorejs-angular-configurations.d.ts +8 -1
  364. package/types/sdcorejs-angular-forms-autocomplete.d.ts +5 -0
  365. package/types/sdcorejs-angular-forms-chip-calendar.d.ts +163 -18
  366. package/types/sdcorejs-angular-forms-chip.d.ts +136 -26
  367. package/types/sdcorejs-angular-forms-date-range.d.ts +24 -2
  368. package/types/sdcorejs-angular-forms-date.d.ts +23 -2
  369. package/types/sdcorejs-angular-forms-directives.d.ts +47 -2
  370. package/types/sdcorejs-angular-forms-input-number.d.ts +23 -2
  371. package/types/sdcorejs-angular-forms-input.d.ts +23 -2
  372. package/types/sdcorejs-angular-forms-models.d.ts +38 -3
  373. package/types/sdcorejs-angular-forms-select.d.ts +32 -2
  374. package/types/sdcorejs-angular-i18n.d.ts +344 -2
  375. package/types/sdcorejs-angular-modules-generic.d.ts +316 -0
  376. package/types/sdcorejs-angular-modules-icon.d.ts +37 -6
  377. package/types/sdcorejs-angular-modules-layout.d.ts +622 -89
  378. package/types/sdcorejs-angular-modules-pattern.d.ts +50 -0
  379. package/types/sdcorejs-angular-modules.d.ts +1 -0
  380. package/types/sdcorejs-angular-pipes.d.ts +2 -0
  381. package/types/sdcorejs-angular-services-date-time.d.ts +57 -0
  382. package/types/sdcorejs-angular-services-storage.d.ts +8 -1
  383. package/types/sdcorejs-angular-services-unsaved-changes.d.ts +11 -0
  384. package/types/sdcorejs-angular-services.d.ts +1 -0
  385. package/types/sdcorejs-angular-utilities-read-state.d.ts +2 -0
  386. package/types/sdcorejs-angular-utilities-theme.d.ts +1 -1
@@ -1,18 +1,23 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Injectable, inject, Pipe, ChangeDetectorRef, Input, ChangeDetectionStrategy, Component, viewChild, input, ElementRef, HostListener, booleanAttribute, signal, ErrorHandler, Injector, afterNextRender, NgModuleFactory, createNgModule } from '@angular/core';
2
+ import { InjectionToken, Injectable, inject, Pipe, ChangeDetectorRef, input, viewChild, signal, Input, ChangeDetectionStrategy, Component, DestroyRef, output, Injector, NgZone, model, ElementRef, computed, afterNextRender, effect, untracked, booleanAttribute, ErrorHandler, NgModuleFactory, createNgModule } from '@angular/core';
3
3
  import { Router, RoutesRecognized, NavigationEnd, NavigationSkipped, NavigationCancel, NavigationError, NavigationSkippedCode, RouterOutlet, ActivatedRoute } from '@angular/router';
4
4
  import * as i1$1 from '@angular/common';
5
5
  import { CommonModule } from '@angular/common';
6
+ import { Title } from '@angular/platform-browser';
6
7
  import { MatTooltipModule } from '@angular/material/tooltip';
7
- import { BehaviorSubject, Subscription, defer, EMPTY, isObservable, lastValueFrom, Subject } from 'rxjs';
8
+ import { BehaviorSubject, Subscription, defer, EMPTY, isObservable, lastValueFrom, ReplaySubject } from 'rxjs';
8
9
  import { debounceTime, startWith, filter, map, concatMap, catchError } from 'rxjs/operators';
9
10
  import { SdNotifyService } from '@sdcorejs/angular/services/notify';
10
11
  import { SdTranslatePipe, I18nService } from '@sdcorejs/angular/i18n';
11
12
  import { Utilities } from '@sdcorejs/utils/fns';
12
- import * as i1 from '@angular/cdk/drag-drop';
13
+ import * as i1 from '@angular/cdk/a11y';
14
+ import { A11yModule } from '@angular/cdk/a11y';
15
+ import * as i2 from '@angular/cdk/drag-drop';
13
16
  import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
14
- import { SdBadge } from '@sdcorejs/angular/components/badge';
17
+ import * as i3 from '@angular/cdk/overlay';
18
+ import { OverlayModule } from '@angular/cdk/overlay';
15
19
  import { SdIcon } from '@sdcorejs/angular/modules/icon';
20
+ import { SdTooltipDirective } from '@sdcorejs/angular/directives';
16
21
 
17
22
  class SdTabBase {
18
23
  #tab;
@@ -152,6 +157,19 @@ class SdTabRouterService {
152
157
  });
153
158
  }
154
159
  };
160
+ /**
161
+ * Đóng mọi tab trừ `tab` (mặc định tab hiện tại). Outlet chạy `beforeClose` của từng tab; tab trả về false thì được
162
+ * giữ lại. Tab hiện tại nằm trong số bị đóng thì `tab` được mở.
163
+ */
164
+ closeOthers = (tab) => {
165
+ tab = tab || this.#currentTab;
166
+ if (tab) {
167
+ this.actions.next({
168
+ type: 'close-others',
169
+ tab,
170
+ });
171
+ }
172
+ };
155
173
  // Gọi hàm này để thực hiện update tab
156
174
  updateTab = (tab) => { };
157
175
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTabRouterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
@@ -164,22 +182,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
164
182
  }]
165
183
  }] });
166
184
 
167
- class SdTabDecoratorService {
168
- static tabRouterService = new BehaviorSubject(undefined);
169
- constructor() {
170
- const tabRouterService = inject(SdTabRouterService);
171
- SdTabDecoratorService.tabRouterService.next(tabRouterService);
172
- }
173
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTabDecoratorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
174
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTabDecoratorService, providedIn: 'root' });
175
- }
176
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTabDecoratorService, decorators: [{
177
- type: Injectable,
178
- args: [{
179
- providedIn: 'root',
180
- }]
181
- }], ctorParameters: () => [] });
182
-
183
185
  class SdTabInfoPipe {
184
186
  tabRouterService = inject(SdTabRouterService);
185
187
  constructor() { }
@@ -187,21 +189,7 @@ class SdTabInfoPipe {
187
189
  if (tabInfo) {
188
190
  return tabInfo;
189
191
  }
190
- const builders = this.tabRouterService.builders.getValue();
191
- const builder = builders.find(e => e.component === tab.component);
192
- if (builder) {
193
- const { url, params, queryParams, data } = tab;
194
- return {
195
- name: typeof builder.name === 'function' ? builder.name({ url, params, queryParams, data }) : builder.name,
196
- icon: typeof builder.icon === 'function' ? builder.icon({ url, params, queryParams }) : builder.icon,
197
- tooltip: typeof builder.tooltip === 'function' ? builder.tooltip({ url, params, queryParams }) : builder.tooltip,
198
- color: typeof builder.color === 'function' ? builder.color({ url, params, queryParams }) : builder.color,
199
- };
200
- }
201
- return {
202
- name: tab.url,
203
- icon: undefined,
204
- };
192
+ return sdTabInfoFromBuilders(this.tabRouterService.builders.getValue(), tab);
205
193
  }
206
194
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTabInfoPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
207
195
  static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.1.5", ngImport: i0, type: SdTabInfoPipe, isStandalone: true, name: "sdTabInfo" });
@@ -213,20 +201,66 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
213
201
  standalone: true,
214
202
  }]
215
203
  }], ctorParameters: () => [] });
204
+ /**
205
+ * Thông tin tab từ `@SdTabComponent` của component trong tab, khi màn chưa gửi gì qua `tabInfoChanges`; không có builder
206
+ * thì tên là URL. Dùng chung cho tab trên thanh và tiêu đề trình duyệt (`syncBrowserTitle`). Nội bộ, không export ra
207
+ * entry point.
208
+ */
209
+ function sdTabInfoFromBuilders(builders, tab) {
210
+ const builder = builders.find(e => e.component === tab.component);
211
+ if (builder) {
212
+ const { url, params, queryParams, data } = tab;
213
+ return {
214
+ name: typeof builder.name === 'function' ? builder.name({ url, params, queryParams, data }) : builder.name,
215
+ icon: typeof builder.icon === 'function' ? builder.icon({ url, params, queryParams }) : builder.icon,
216
+ tooltip: typeof builder.tooltip === 'function' ? builder.tooltip({ url, params, queryParams }) : builder.tooltip,
217
+ color: typeof builder.color === 'function' ? builder.color({ url, params, queryParams }) : builder.color,
218
+ };
219
+ }
220
+ return {
221
+ name: tab.url,
222
+ icon: undefined,
223
+ };
224
+ }
225
+
226
+ class SdTabDecoratorService {
227
+ static tabRouterService = new BehaviorSubject(undefined);
228
+ constructor() {
229
+ const tabRouterService = inject(SdTabRouterService);
230
+ SdTabDecoratorService.tabRouterService.next(tabRouterService);
231
+ }
232
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTabDecoratorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
233
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTabDecoratorService, providedIn: 'root' });
234
+ }
235
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTabDecoratorService, decorators: [{
236
+ type: Injectable,
237
+ args: [{
238
+ providedIn: 'root',
239
+ }]
240
+ }], ctorParameters: () => [] });
216
241
 
217
242
  class SdTabRouterItemComponent {
218
243
  cdRef = inject(ChangeDetectorRef);
219
244
  tabRouterService = inject(SdTabRouterService);
220
245
  router = inject(Router);
221
246
  tab;
222
- #subsctiption = new Subscription();
247
+ /** Tab này là điểm dừng Tab duy nhất của thanh (roving tabindex do nav chọn). */
248
+ focusable = input(false, /* @ts-ignore */
249
+ ...(ngDevMode ? [{ debugName: "focusable" }] : /* istanbul ignore next */ []));
250
+ #subscription = new Subscription();
223
251
  tabInfo;
252
+ nameRef = viewChild('name', /* @ts-ignore */
253
+ ...(ngDevMode ? [{ debugName: "nameRef" }] : /* istanbul ignore next */ []));
254
+ #truncated = signal(false, /* @ts-ignore */
255
+ ...(ngDevMode ? [{ debugName: "#truncated" }] : /* istanbul ignore next */ []));
256
+ /** Tên tab đang bị cắt (ellipsis): chỉ khi đó tooltip mới lặp lại tên. */
257
+ truncated = this.#truncated.asReadonly();
224
258
  constructor() { }
225
259
  ngOnInit() {
226
- this.#subsctiption.add(this.tabRouterService.events.pipe(debounceTime(100)).subscribe(() => {
260
+ this.#subscription.add(this.tabRouterService.events.pipe(debounceTime(100)).subscribe(() => {
227
261
  this.cdRef.markForCheck();
228
262
  }));
229
- this.#subsctiption.add(this.tab.tabInfoChanges.pipe(startWith(null)).subscribe(tabInfo => {
263
+ this.#subscription.add(this.tab.tabInfoChanges.pipe(startWith(null)).subscribe(tabInfo => {
230
264
  if (tabInfo) {
231
265
  this.tabInfo = tabInfo;
232
266
  this.cdRef.markForCheck();
@@ -234,8 +268,13 @@ class SdTabRouterItemComponent {
234
268
  }));
235
269
  }
236
270
  ngOnDestroy() {
237
- this.#subsctiption.unsubscribe();
271
+ this.#subscription.unsubscribe();
238
272
  }
273
+ // why: đo lúc chuột vào hoặc focus tới, không đo theo resize — tooltip chỉ cần biết vào đúng lúc nó sắp hiện.
274
+ measureTruncation = () => {
275
+ const el = this.nameRef()?.nativeElement;
276
+ this.#truncated.set(!!el && el.scrollWidth > el.clientWidth);
277
+ };
239
278
  onTabClick = (event) => {
240
279
  event.preventDefault();
241
280
  this.router.navigate([this.tab.url], {
@@ -243,6 +282,13 @@ class SdTabRouterItemComponent {
243
282
  state: { switchTab: true },
244
283
  });
245
284
  };
285
+ // why: Enter/Space mở tab như bấm chuột. Chỉ khi chính tab nhận phím — Enter trên nút đóng (focus được bằng chuột) đã là
286
+ // click của nút đó.
287
+ onTabKeydown = (event) => {
288
+ if (event.target !== event.currentTarget)
289
+ return;
290
+ this.onTabClick(event);
291
+ };
246
292
  close = (event) => {
247
293
  event.preventDefault();
248
294
  event.stopPropagation();
@@ -264,60 +310,426 @@ class SdTabRouterItemComponent {
264
310
  this.tabRouterService.close(this.tab);
265
311
  };
266
312
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTabRouterItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
267
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdTabRouterItemComponent, isStandalone: true, selector: "sd-tab-router-item", inputs: { tab: "tab" }, ngImport: i0, template: "<!-- why: [href] l\u00E0 thu\u1ED9c t\u00EDnh DOM ki\u1EC3u CHU\u1ED6I. B\u1EA3n c\u0169 bind `[tab.url]` \u2014 m\u1ED9t M\u1EA2NG \u2014 v\u00E0 ch\u1EC9 \"ch\u1EA1y\n \u0111\u01B0\u1EE3c\" nh\u1EDD m\u1EA3ng 1 ph\u1EA7n t\u1EED t\u1EF1 stringify l\u00FAc Angular sanitize URL. Bind th\u1EB3ng chu\u1ED7i: \u0111\u00FAng ki\u1EC3u,\n b\u1ECF m\u1ED9t slot pure-function th\u1EEBa, v\u00E0 gi\u00E1 tr\u1ECB bind kh\u1EDBp \u0111\u00FAng th\u1EE9 render ra DOM.\n why: `[title]=\"info.icon\"` ngay tr\u00EAn `[title]=\"info.name\"` \u0111\u00E3 b\u1ECB xo\u00E1 \u2014 binding ch\u1EBFt do\n copy-paste, lu\u00F4n b\u1ECB ghi \u0111\u00E8 ngay v\u00E0 b\u1EAFt sd-badge nh\u1EADn hai gi\u00E1 tr\u1ECB title m\u1ED7i l\u1EA7n CD. -->\n<a\n [href]=\"tab.url\"\n class=\"tab-router__item d-flex align-items-center gap-8\"\n [class.tab-router__item--active]=\"tab.isActive\"\n (click)=\"onTabClick($event)\"\n (mousedown)=\"onMousedown($event)\"\n (mouseup)=\"onMouseup($event)\">\n @let info = tabInfo | sdTabInfo: tab;\n @if (info) {\n <!-- why: b\u1ECF `(click)=\"onTabClick($event)\"` kh\u1ECFi <sd-badge>. N\u00F3 ch\u1EC9 t\u1ED3n t\u1EA1i v\u00EC badge lu\u00F4n\n stopPropagation, n\u00EAn click tr\u00EAn badge kh\u00F4ng bao gi\u1EDD t\u1EDBi <a> cha. Badge nay ch\u1EC9 nu\u1ED1t event\n khi th\u1EADt s\u1EF1 c\u00F3 consumer \u2192 click b\u1ECDt l\u00EAn <a> nh\u01B0 b\u00ECnh th\u01B0\u1EDDng, v\u00E0 badge kh\u00F4ng c\u00F2n ph\u1EA3i tr\u1EDF\n th\u00E0nh role=\"button\" l\u1ED3ng b\u00EAn trong m\u1ED9t <a> (interactive l\u1ED3ng interactive). -->\n <sd-badge\n style=\"overflow: hidden;white-space: nowrap;\"\n [icon]=\"info.icon\"\n [tooltip]=\"info.tooltip || info.name\"\n [title]=\"info.name\"\n [color]=\"info.color\"></sd-badge>\n <!-- why: b\u1ECF aria-hidden=\"true\" kh\u1ECFi n\u00FAt \u0111\u00F3ng \u2014 n\u00F3 l\u00E0 <button> th\u1EADt, v\u1EABn nh\u1EADn tab focus nh\u01B0ng\n screen reader kh\u00F4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c g\u00EC (n\u00FAt ch\u1EC9 c\u00F3 icon). G\u1EAFn type + aria-label i18n. -->\n <button\n type=\"button\"\n class=\"tab-router__close d-flex align-items-center justify-content-center ml-auto p-0\"\n [attr.aria-label]=\"'core.common.close' | sdTranslate\"\n (click)=\"close($event)\"\n (mousedown)=\"$event.stopPropagation()\">\n <!-- Icon thu\u1EA7n trang tr\u00ED \u2014 n\u00FAt \u0111\u00E3 c\u00F3 aria-label n\u00EAn gi\u1EEF aria-hidden \u1EDF \u0111\u00E2y l\u00E0 \u0111\u00FAng. -->\n <sd-icon aria-hidden=\"true\" fontIcon=\"close\"></sd-icon>\n </button>\n }\n</a>\n", styles: [":host{display:block;overflow:hidden;position:relative;flex:1 1 64px;max-width:240px}:host:after{content:\"\";position:absolute;right:0;top:0;bottom:0;height:16px;width:1px;background:var(--sd-tab-router-item-divider, #dde0e5);margin:auto}:host:last-child:after{content:none}:host::ng-deep .tab-router__item sd-badge .c-badge-title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:184px}.flex-1{flex:1}.tab-router__icon{background-color:var(--sd-tab-router-badge-bg, #5c6bc0);width:16px;height:16px;line-height:var(--sd-line-height-16, 16px);text-align:center;font-size:var(--sd-font-size-10, 10px);color:var(--sd-text-on-solid, #ffffff);border-radius:var(--sd-radius-2, 2px);text-transform:uppercase}.tab-router__icon sd-icon{height:10px;width:10px;font-size:var(--sd-font-size-10, 10px)}.tab-router__close{color:var(--sd-tab-router-item-text, #757575);outline:none;border:0;background:none;border-radius:50%;height:16px;width:16px}.tab-router__close:hover{background-color:#0000001f}.tab-router__close:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:1px}.tab-router__close sd-icon{font-size:var(--sd-font-size-12, 12px);height:12px;width:12px}.tab-router__item{background:var(--sd-tab-router-item-muted-bg, #f2f3f4);padding:8px;color:inherit;text-decoration:none;font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px);overflow:hidden}.tab-router__item:hover{background-color:var(--sd-tab-router-item-active-bg, #ffffff)}.tab-router__name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tab-router__item--active{border-radius:8px 8px 0 0;background-color:var(--sd-tab-router-item-active-bg, #ffffff)}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "component", type: SdBadge, selector: "sd-badge", inputs: ["type", "color", "primary", "secondary", "success", "info", "warning", "error", "fontSet", "title", "description", "tooltip", "icon", "size"], outputs: ["click"] }, { kind: "pipe", type: SdTabInfoPipe, name: "sdTabInfo" }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
313
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdTabRouterItemComponent, isStandalone: true, selector: "sd-tab-router-item", inputs: { tab: { classPropertyName: "tab", publicName: "tab", isSignal: false, isRequired: true, transformFunction: null }, focusable: { classPropertyName: "focusable", publicName: "focusable", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.sd-tab-router-item--active": "tab.isActive" } }, viewQueries: [{ propertyName: "nameRef", first: true, predicate: ["name"], descendants: true, isSignal: true }], ngImport: i0, template: "@let info = tabInfo | sdTabInfo: tab;\n<!-- why: \u0111\u1EE3t 3 \u00B7 3c (Q\u0110 11) \u2014 ph\u1EA7n t\u1EED role=\"tab\" kh\u00F4ng href. V\u1EDBi <a href>, CDK drag ch\u1EB7n mousedown (th\u1EBB link k\u00E9o \u0111\u01B0\u1EE3c\n theo ki\u1EC3u native) n\u00EAn b\u1EA5m chu\u1ED9t kh\u00F4ng focus \u0111\u01B0\u1EE3c tab, v\u00E0 menu chu\u1ED9t ph\u1EA3i c\u1EE7a tr\u00ECnh duy\u1EC7t chi\u1EBFm ch\u1ED7 menu c\u1EE7a thanh.\n tabindex do nav ch\u1ECDn (roving: c\u1EA3 thanh m\u1ED9t \u0111i\u1EC3m d\u1EEBng Tab); \u2190/\u2192/Home/End/Delete v\u00E0 menu do nav x\u1EED l\u00FD. -->\n<div\n role=\"tab\"\n class=\"tab-router__item\"\n [class.tab-router__item--active]=\"tab.isActive\"\n [class.tab-router__item--dirty]=\"info.dirty\"\n [id]=\"'sd-tab-router-tab-' + tab.key\"\n [attr.aria-selected]=\"tab.isActive\"\n [attr.aria-controls]=\"tab.key\"\n [attr.tabindex]=\"focusable() ? 0 : -1\"\n [sdTooltip]=\"info.tooltip || (truncated() ? info.name : '')\"\n (mouseenter)=\"measureTruncation()\"\n (focusin)=\"measureTruncation()\"\n (click)=\"onTabClick($event)\"\n (keydown.enter)=\"onTabKeydown($event)\"\n (keydown.space)=\"onTabKeydown($event)\"\n (mousedown)=\"onMousedown($event)\"\n (mouseup)=\"onMouseup($event)\">\n <!-- why: \u0111\u1EE3t 3 \u00B7 3a b\u1ECF sd-badge \u2014 badge \u00E9p c\u1EE1 ch\u1EEF v\u00E0 chi\u1EC1u r\u1ED9ng ri\u00EAng, v\u00E0 t\u1EF1 hi\u1EC7n ch\u1EA5m khi tab kh\u00F4ng c\u00F3 icon. -->\n @if (info.icon) {\n <sd-icon class=\"tab-router__icon c-{{ info.color || 'primary' }}\" aria-hidden=\"true\" size=\"16px\" [fontIcon]=\"info.icon\"></sd-icon>\n }\n <span #name class=\"tab-router__name\">{{ info.name }}</span>\n @if (info.dirty) {\n <span class=\"sd-visually-hidden\">{{ 'core.component.tab-router.unsaved' | sdTranslate }}</span>\n }\n <!-- why: n\u00FAt \u0111\u00F3ng l\u00E0 <button> th\u1EADt c\u00F3 nh\u00E3n i18n, nh\u01B0ng tabindex=\"-1\" \u2014 b\u00E0n ph\u00EDm \u0111\u00F3ng tab b\u1EB1ng Delete tr\u00EAn tab, n\u00EAn\n n\u00FAt kh\u00F4ng th\u00EAm \u0111i\u1EC3m d\u1EEBng Tab th\u1EE9 hai cho m\u1ED7i tab. -->\n <button\n type=\"button\"\n class=\"tab-router__close\"\n tabindex=\"-1\"\n [attr.aria-label]=\"'core.common.close' | sdTranslate\"\n (click)=\"close($event)\"\n (mousedown)=\"$event.stopPropagation()\">\n <!-- why: \u0111\u1EE3t 3 \u00B7 3d \u2014 ch\u1EA5m \"ch\u01B0a l\u01B0u\" n\u1EB1m \u1EDF ch\u1ED7 n\u00FAt \u0111\u00F3ng; hover ho\u1EB7c focus b\u00E0n ph\u00EDm th\u00EC ch\u1EA5m \u0111\u1ED5i th\u00E0nh n\u00FAt \u0111\u00F3ng. -->\n @if (info.dirty) {\n <span class=\"tab-router__dirty\" aria-hidden=\"true\"></span>\n }\n <!-- Icon thu\u1EA7n trang tr\u00ED \u2014 n\u00FAt \u0111\u00E3 c\u00F3 aria-label n\u00EAn gi\u1EEF aria-hidden \u1EDF \u0111\u00E2y l\u00E0 \u0111\u00FAng. -->\n <sd-icon aria-hidden=\"true\" size=\"14px\" fontIcon=\"close\"></sd-icon>\n </button>\n</div>\n", styles: [":host{position:relative;display:flex;flex:0 1 200px;min-width:120px}:host:after{content:\"\";position:absolute;right:0;bottom:9px;width:1px;height:16px;background:var(--sd-tab-router-item-divider);pointer-events:none}:host:last-child:after{content:none}.tab-router__item{display:flex;flex:1 1 auto;align-items:center;gap:8px;min-width:0;height:34px;padding:0 6px 0 12px;border-radius:8px 8px 0 0;box-sizing:border-box;color:var(--sd-tab-router-item-text);font-size:var(--sd-font-size-13, 13px);line-height:18px;text-decoration:none;cursor:pointer}.tab-router__item:hover{background:var(--sd-tab-router-item-hover-bg)}.tab-router__item:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.tab-router__item--active{background:var(--sd-tab-router-item-active-bg);color:var(--sd-text);font-weight:500}.tab-router__item--active:hover{background:var(--sd-tab-router-item-active-bg)}@media(forced-colors:active){.tab-router__item--active{outline:1px solid CanvasText;outline-offset:-1px}}.tab-router__icon.c-primary{color:var(--sd-primary-dark)}.tab-router__icon.c-secondary{color:var(--sd-secondary-dark)}.tab-router__icon.c-info{color:var(--sd-info-dark)}.tab-router__icon.c-success{color:var(--sd-success-dark)}.tab-router__icon.c-warning{color:var(--sd-warning-dark)}.tab-router__icon.c-error{color:var(--sd-error-dark)}.tab-router__name{flex:1 1 auto;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.tab-router__close{display:flex;flex:0 0 auto;align-items:center;justify-content:center;position:relative;width:20px;height:20px;padding:0;border:0;border-radius:6px;background:none;color:var(--sd-tab-router-item-text);cursor:pointer;opacity:0}.tab-router__close:hover{background:color-mix(in srgb,var(--sd-text) 8%,transparent)}.tab-router__close:focus-visible{opacity:1;outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.tab-router__item--active .tab-router__close,.tab-router__item:hover .tab-router__close,.tab-router__item:focus-visible .tab-router__close{opacity:1}@media(pointer:coarse){.tab-router__close{opacity:1}.tab-router__close:before{content:\"\";position:absolute;inset:-6px}}:host(.cdk-drag-preview){overflow:visible}:host(.cdk-drag-preview):after{content:none}:host(.cdk-drag-preview) .tab-router__item{border-radius:8px;background:var(--sd-surface);color:var(--sd-text);box-shadow:var(--sd-shadow-md, none);cursor:grabbing}:host(.cdk-drag-placeholder):after{opacity:0}:host(.cdk-drag-placeholder) .tab-router__item{background:color-mix(in srgb,var(--sd-primary) 12%,transparent);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--sd-primary) 35%,transparent)}:host(.cdk-drag-placeholder) .tab-router__item>*{visibility:hidden}@media(forced-colors:active){:host(.cdk-drag-placeholder) .tab-router__item{outline:1px dashed CanvasText;outline-offset:-1px}}.tab-router__dirty{position:absolute;top:50%;left:50%;width:8px;height:8px;margin:-4px 0 0 -4px;border-radius:50%;background:var(--sd-text-secondary);pointer-events:none}.tab-router__item--dirty .tab-router__close{opacity:1}.tab-router__item--dirty .tab-router__close sd-icon{opacity:0}.tab-router__item--dirty:hover .tab-router__dirty,.tab-router__item--dirty:focus-visible .tab-router__dirty,.tab-router__item--dirty .tab-router__close:focus-visible .tab-router__dirty{opacity:0}.tab-router__item--dirty:hover .tab-router__close sd-icon,.tab-router__item--dirty:focus-visible .tab-router__close sd-icon,.tab-router__item--dirty .tab-router__close:focus-visible sd-icon{opacity:1}@media(forced-colors:active){.tab-router__dirty{background:CanvasText}}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: SdTooltipDirective, selector: "[sdTooltip]", inputs: ["sdTooltip", "sdTooltipPosition", "sdTooltipDelay", "sdTooltipColor"] }, { kind: "pipe", type: SdTabInfoPipe, name: "sdTabInfo" }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
268
314
  }
269
315
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTabRouterItemComponent, decorators: [{
270
316
  type: Component,
271
- args: [{ selector: 'sd-tab-router-item', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [SdIcon, CommonModule, SdBadge, SdTabInfoPipe, SdTranslatePipe], template: "<!-- why: [href] l\u00E0 thu\u1ED9c t\u00EDnh DOM ki\u1EC3u CHU\u1ED6I. B\u1EA3n c\u0169 bind `[tab.url]` \u2014 m\u1ED9t M\u1EA2NG \u2014 v\u00E0 ch\u1EC9 \"ch\u1EA1y\n \u0111\u01B0\u1EE3c\" nh\u1EDD m\u1EA3ng 1 ph\u1EA7n t\u1EED t\u1EF1 stringify l\u00FAc Angular sanitize URL. Bind th\u1EB3ng chu\u1ED7i: \u0111\u00FAng ki\u1EC3u,\n b\u1ECF m\u1ED9t slot pure-function th\u1EEBa, v\u00E0 gi\u00E1 tr\u1ECB bind kh\u1EDBp \u0111\u00FAng th\u1EE9 render ra DOM.\n why: `[title]=\"info.icon\"` ngay tr\u00EAn `[title]=\"info.name\"` \u0111\u00E3 b\u1ECB xo\u00E1 \u2014 binding ch\u1EBFt do\n copy-paste, lu\u00F4n b\u1ECB ghi \u0111\u00E8 ngay v\u00E0 b\u1EAFt sd-badge nh\u1EADn hai gi\u00E1 tr\u1ECB title m\u1ED7i l\u1EA7n CD. -->\n<a\n [href]=\"tab.url\"\n class=\"tab-router__item d-flex align-items-center gap-8\"\n [class.tab-router__item--active]=\"tab.isActive\"\n (click)=\"onTabClick($event)\"\n (mousedown)=\"onMousedown($event)\"\n (mouseup)=\"onMouseup($event)\">\n @let info = tabInfo | sdTabInfo: tab;\n @if (info) {\n <!-- why: b\u1ECF `(click)=\"onTabClick($event)\"` kh\u1ECFi <sd-badge>. N\u00F3 ch\u1EC9 t\u1ED3n t\u1EA1i v\u00EC badge lu\u00F4n\n stopPropagation, n\u00EAn click tr\u00EAn badge kh\u00F4ng bao gi\u1EDD t\u1EDBi <a> cha. Badge nay ch\u1EC9 nu\u1ED1t event\n khi th\u1EADt s\u1EF1 c\u00F3 consumer \u2192 click b\u1ECDt l\u00EAn <a> nh\u01B0 b\u00ECnh th\u01B0\u1EDDng, v\u00E0 badge kh\u00F4ng c\u00F2n ph\u1EA3i tr\u1EDF\n th\u00E0nh role=\"button\" l\u1ED3ng b\u00EAn trong m\u1ED9t <a> (interactive l\u1ED3ng interactive). -->\n <sd-badge\n style=\"overflow: hidden;white-space: nowrap;\"\n [icon]=\"info.icon\"\n [tooltip]=\"info.tooltip || info.name\"\n [title]=\"info.name\"\n [color]=\"info.color\"></sd-badge>\n <!-- why: b\u1ECF aria-hidden=\"true\" kh\u1ECFi n\u00FAt \u0111\u00F3ng \u2014 n\u00F3 l\u00E0 <button> th\u1EADt, v\u1EABn nh\u1EADn tab focus nh\u01B0ng\n screen reader kh\u00F4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c g\u00EC (n\u00FAt ch\u1EC9 c\u00F3 icon). G\u1EAFn type + aria-label i18n. -->\n <button\n type=\"button\"\n class=\"tab-router__close d-flex align-items-center justify-content-center ml-auto p-0\"\n [attr.aria-label]=\"'core.common.close' | sdTranslate\"\n (click)=\"close($event)\"\n (mousedown)=\"$event.stopPropagation()\">\n <!-- Icon thu\u1EA7n trang tr\u00ED \u2014 n\u00FAt \u0111\u00E3 c\u00F3 aria-label n\u00EAn gi\u1EEF aria-hidden \u1EDF \u0111\u00E2y l\u00E0 \u0111\u00FAng. -->\n <sd-icon aria-hidden=\"true\" fontIcon=\"close\"></sd-icon>\n </button>\n }\n</a>\n", styles: [":host{display:block;overflow:hidden;position:relative;flex:1 1 64px;max-width:240px}:host:after{content:\"\";position:absolute;right:0;top:0;bottom:0;height:16px;width:1px;background:var(--sd-tab-router-item-divider, #dde0e5);margin:auto}:host:last-child:after{content:none}:host::ng-deep .tab-router__item sd-badge .c-badge-title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:184px}.flex-1{flex:1}.tab-router__icon{background-color:var(--sd-tab-router-badge-bg, #5c6bc0);width:16px;height:16px;line-height:var(--sd-line-height-16, 16px);text-align:center;font-size:var(--sd-font-size-10, 10px);color:var(--sd-text-on-solid, #ffffff);border-radius:var(--sd-radius-2, 2px);text-transform:uppercase}.tab-router__icon sd-icon{height:10px;width:10px;font-size:var(--sd-font-size-10, 10px)}.tab-router__close{color:var(--sd-tab-router-item-text, #757575);outline:none;border:0;background:none;border-radius:50%;height:16px;width:16px}.tab-router__close:hover{background-color:#0000001f}.tab-router__close:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:1px}.tab-router__close sd-icon{font-size:var(--sd-font-size-12, 12px);height:12px;width:12px}.tab-router__item{background:var(--sd-tab-router-item-muted-bg, #f2f3f4);padding:8px;color:inherit;text-decoration:none;font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px);overflow:hidden}.tab-router__item:hover{background-color:var(--sd-tab-router-item-active-bg, #ffffff)}.tab-router__name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tab-router__item--active{border-radius:8px 8px 0 0;background-color:var(--sd-tab-router-item-active-bg, #ffffff)}\n"] }]
317
+ args: [{ selector: 'sd-tab-router-item', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [SdIcon, CommonModule, SdTabInfoPipe, SdTooltipDirective, SdTranslatePipe], host: {
318
+ // why: nav cần biết tab nào đang mở trên chính phần tử host để ẩn vạch ngăn ở hai bên nó.
319
+ '[class.sd-tab-router-item--active]': 'tab.isActive',
320
+ }, template: "@let info = tabInfo | sdTabInfo: tab;\n<!-- why: \u0111\u1EE3t 3 \u00B7 3c (Q\u0110 11) \u2014 ph\u1EA7n t\u1EED role=\"tab\" kh\u00F4ng href. V\u1EDBi <a href>, CDK drag ch\u1EB7n mousedown (th\u1EBB link k\u00E9o \u0111\u01B0\u1EE3c\n theo ki\u1EC3u native) n\u00EAn b\u1EA5m chu\u1ED9t kh\u00F4ng focus \u0111\u01B0\u1EE3c tab, v\u00E0 menu chu\u1ED9t ph\u1EA3i c\u1EE7a tr\u00ECnh duy\u1EC7t chi\u1EBFm ch\u1ED7 menu c\u1EE7a thanh.\n tabindex do nav ch\u1ECDn (roving: c\u1EA3 thanh m\u1ED9t \u0111i\u1EC3m d\u1EEBng Tab); \u2190/\u2192/Home/End/Delete v\u00E0 menu do nav x\u1EED l\u00FD. -->\n<div\n role=\"tab\"\n class=\"tab-router__item\"\n [class.tab-router__item--active]=\"tab.isActive\"\n [class.tab-router__item--dirty]=\"info.dirty\"\n [id]=\"'sd-tab-router-tab-' + tab.key\"\n [attr.aria-selected]=\"tab.isActive\"\n [attr.aria-controls]=\"tab.key\"\n [attr.tabindex]=\"focusable() ? 0 : -1\"\n [sdTooltip]=\"info.tooltip || (truncated() ? info.name : '')\"\n (mouseenter)=\"measureTruncation()\"\n (focusin)=\"measureTruncation()\"\n (click)=\"onTabClick($event)\"\n (keydown.enter)=\"onTabKeydown($event)\"\n (keydown.space)=\"onTabKeydown($event)\"\n (mousedown)=\"onMousedown($event)\"\n (mouseup)=\"onMouseup($event)\">\n <!-- why: \u0111\u1EE3t 3 \u00B7 3a b\u1ECF sd-badge \u2014 badge \u00E9p c\u1EE1 ch\u1EEF v\u00E0 chi\u1EC1u r\u1ED9ng ri\u00EAng, v\u00E0 t\u1EF1 hi\u1EC7n ch\u1EA5m khi tab kh\u00F4ng c\u00F3 icon. -->\n @if (info.icon) {\n <sd-icon class=\"tab-router__icon c-{{ info.color || 'primary' }}\" aria-hidden=\"true\" size=\"16px\" [fontIcon]=\"info.icon\"></sd-icon>\n }\n <span #name class=\"tab-router__name\">{{ info.name }}</span>\n @if (info.dirty) {\n <span class=\"sd-visually-hidden\">{{ 'core.component.tab-router.unsaved' | sdTranslate }}</span>\n }\n <!-- why: n\u00FAt \u0111\u00F3ng l\u00E0 <button> th\u1EADt c\u00F3 nh\u00E3n i18n, nh\u01B0ng tabindex=\"-1\" \u2014 b\u00E0n ph\u00EDm \u0111\u00F3ng tab b\u1EB1ng Delete tr\u00EAn tab, n\u00EAn\n n\u00FAt kh\u00F4ng th\u00EAm \u0111i\u1EC3m d\u1EEBng Tab th\u1EE9 hai cho m\u1ED7i tab. -->\n <button\n type=\"button\"\n class=\"tab-router__close\"\n tabindex=\"-1\"\n [attr.aria-label]=\"'core.common.close' | sdTranslate\"\n (click)=\"close($event)\"\n (mousedown)=\"$event.stopPropagation()\">\n <!-- why: \u0111\u1EE3t 3 \u00B7 3d \u2014 ch\u1EA5m \"ch\u01B0a l\u01B0u\" n\u1EB1m \u1EDF ch\u1ED7 n\u00FAt \u0111\u00F3ng; hover ho\u1EB7c focus b\u00E0n ph\u00EDm th\u00EC ch\u1EA5m \u0111\u1ED5i th\u00E0nh n\u00FAt \u0111\u00F3ng. -->\n @if (info.dirty) {\n <span class=\"tab-router__dirty\" aria-hidden=\"true\"></span>\n }\n <!-- Icon thu\u1EA7n trang tr\u00ED \u2014 n\u00FAt \u0111\u00E3 c\u00F3 aria-label n\u00EAn gi\u1EEF aria-hidden \u1EDF \u0111\u00E2y l\u00E0 \u0111\u00FAng. -->\n <sd-icon aria-hidden=\"true\" size=\"14px\" fontIcon=\"close\"></sd-icon>\n </button>\n</div>\n", styles: [":host{position:relative;display:flex;flex:0 1 200px;min-width:120px}:host:after{content:\"\";position:absolute;right:0;bottom:9px;width:1px;height:16px;background:var(--sd-tab-router-item-divider);pointer-events:none}:host:last-child:after{content:none}.tab-router__item{display:flex;flex:1 1 auto;align-items:center;gap:8px;min-width:0;height:34px;padding:0 6px 0 12px;border-radius:8px 8px 0 0;box-sizing:border-box;color:var(--sd-tab-router-item-text);font-size:var(--sd-font-size-13, 13px);line-height:18px;text-decoration:none;cursor:pointer}.tab-router__item:hover{background:var(--sd-tab-router-item-hover-bg)}.tab-router__item:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.tab-router__item--active{background:var(--sd-tab-router-item-active-bg);color:var(--sd-text);font-weight:500}.tab-router__item--active:hover{background:var(--sd-tab-router-item-active-bg)}@media(forced-colors:active){.tab-router__item--active{outline:1px solid CanvasText;outline-offset:-1px}}.tab-router__icon.c-primary{color:var(--sd-primary-dark)}.tab-router__icon.c-secondary{color:var(--sd-secondary-dark)}.tab-router__icon.c-info{color:var(--sd-info-dark)}.tab-router__icon.c-success{color:var(--sd-success-dark)}.tab-router__icon.c-warning{color:var(--sd-warning-dark)}.tab-router__icon.c-error{color:var(--sd-error-dark)}.tab-router__name{flex:1 1 auto;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.tab-router__close{display:flex;flex:0 0 auto;align-items:center;justify-content:center;position:relative;width:20px;height:20px;padding:0;border:0;border-radius:6px;background:none;color:var(--sd-tab-router-item-text);cursor:pointer;opacity:0}.tab-router__close:hover{background:color-mix(in srgb,var(--sd-text) 8%,transparent)}.tab-router__close:focus-visible{opacity:1;outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.tab-router__item--active .tab-router__close,.tab-router__item:hover .tab-router__close,.tab-router__item:focus-visible .tab-router__close{opacity:1}@media(pointer:coarse){.tab-router__close{opacity:1}.tab-router__close:before{content:\"\";position:absolute;inset:-6px}}:host(.cdk-drag-preview){overflow:visible}:host(.cdk-drag-preview):after{content:none}:host(.cdk-drag-preview) .tab-router__item{border-radius:8px;background:var(--sd-surface);color:var(--sd-text);box-shadow:var(--sd-shadow-md, none);cursor:grabbing}:host(.cdk-drag-placeholder):after{opacity:0}:host(.cdk-drag-placeholder) .tab-router__item{background:color-mix(in srgb,var(--sd-primary) 12%,transparent);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--sd-primary) 35%,transparent)}:host(.cdk-drag-placeholder) .tab-router__item>*{visibility:hidden}@media(forced-colors:active){:host(.cdk-drag-placeholder) .tab-router__item{outline:1px dashed CanvasText;outline-offset:-1px}}.tab-router__dirty{position:absolute;top:50%;left:50%;width:8px;height:8px;margin:-4px 0 0 -4px;border-radius:50%;background:var(--sd-text-secondary);pointer-events:none}.tab-router__item--dirty .tab-router__close{opacity:1}.tab-router__item--dirty .tab-router__close sd-icon{opacity:0}.tab-router__item--dirty:hover .tab-router__dirty,.tab-router__item--dirty:focus-visible .tab-router__dirty,.tab-router__item--dirty .tab-router__close:focus-visible .tab-router__dirty{opacity:0}.tab-router__item--dirty:hover .tab-router__close sd-icon,.tab-router__item--dirty:focus-visible .tab-router__close sd-icon,.tab-router__item--dirty .tab-router__close:focus-visible sd-icon{opacity:1}@media(forced-colors:active){.tab-router__dirty{background:CanvasText}}\n"] }]
272
321
  }], ctorParameters: () => [], propDecorators: { tab: [{
273
322
  type: Input,
274
323
  args: [{ required: true }]
275
- }] } });
324
+ }], focusable: [{ type: i0.Input, args: [{ isSignal: true, alias: "focusable", required: false }] }], nameRef: [{ type: i0.ViewChild, args: ['name', { isSignal: true }] }] } });
276
325
 
326
+ let nextId = 0;
327
+ /** Một hàng của menu danh sách tab (đợt 3 · 3b): icon, tên và nút đóng hiện khi hover. Nội bộ, không export. */
328
+ class SdTabRouterListItemComponent {
329
+ #destroyRef = inject(DestroyRef);
330
+ tab = input.required(/* @ts-ignore */
331
+ ...(ngDevMode ? [{ debugName: "tab" }] : /* istanbul ignore next */ []));
332
+ /** Bấm vào tên: chuyển sang tab này. */
333
+ pick = output();
334
+ /** Bấm nút đóng: đóng tab này. */
335
+ closeTab = output();
336
+ tabInfo = signal(null, /* @ts-ignore */
337
+ ...(ngDevMode ? [{ debugName: "tabInfo" }] : /* istanbul ignore next */ []));
338
+ nameId = `sd-tab-router-list-item-${nextId++}`;
339
+ ngOnInit() {
340
+ // why: outlet tạo `tabInfoChanges` là ReplaySubject(1), nên hàng dựng lúc menu mở vẫn nhận tên đã gửi trước đó.
341
+ const subscription = this.tab().tabInfoChanges.subscribe(info => this.tabInfo.set(info));
342
+ this.#destroyRef.onDestroy(() => subscription.unsubscribe());
343
+ }
344
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTabRouterListItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
345
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdTabRouterListItemComponent, isStandalone: true, selector: "sd-tab-router-list-item", inputs: { tab: { classPropertyName: "tab", publicName: "tab", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { pick: "pick", closeTab: "closeTab" }, host: { attributes: { "role": "listitem" }, properties: { "class.tab-router__menu-row--active": "tab().isActive" }, classAttribute: "tab-router__menu-row" }, ngImport: i0, template: "@let _tab = tab();\n@let info = tabInfo() | sdTabInfo: _tab;\n<button type=\"button\" class=\"tab-router__menu-tab\" [attr.aria-current]=\"_tab.isActive ? 'page' : null\" (click)=\"pick.emit()\">\n @if (info.icon) {\n <sd-icon class=\"tab-router__menu-icon c-{{ info.color || 'primary' }}\" aria-hidden=\"true\" size=\"16px\" [fontIcon]=\"info.icon\"></sd-icon>\n }\n <span class=\"tab-router__menu-name\" [id]=\"nameId\">{{ info.name }}</span>\n</button>\n<!-- why: t\u00EAn l\u1EA5y t\u1EEB h\u00E0ng (aria-describedby), n\u00EAn screen reader \u0111\u1ECDc \"\u0110\u00F3ng tab, {t\u00EAn}\" thay cho m\u1ED9t lo\u1EA1t \"\u0110\u00F3ng tab\" gi\u1ED1ng nhau. -->\n<button\n type=\"button\"\n class=\"tab-router__menu-close\"\n [attr.aria-label]=\"'core.component.tab-router.close-tab' | sdTranslate\"\n [attr.aria-describedby]=\"nameId\"\n (click)=\"closeTab.emit()\">\n <sd-icon aria-hidden=\"true\" size=\"14px\" fontIcon=\"close\"></sd-icon>\n</button>\n", styles: [":host{display:flex;flex:0 0 36px;align-items:center;gap:4px;height:36px;padding:0 6px 0 0;border-radius:6px;box-sizing:border-box;color:var(--sd-text);font-size:var(--sd-font-size-13, 13px);line-height:18px}:host:hover{background:var(--sd-tab-router-nav-bg)}:host(.tab-router__menu-row--active){background:color-mix(in srgb,var(--sd-primary) 8%,transparent);font-weight:500}.tab-router__menu-tab{display:flex;flex:1 1 auto;align-items:center;gap:10px;min-width:0;height:100%;padding:0 0 0 10px;border:0;border-radius:6px;background:none;color:inherit;font:inherit;text-align:start;cursor:pointer}.tab-router__menu-tab:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.tab-router__menu-icon.c-primary{color:var(--sd-primary-dark)}.tab-router__menu-icon.c-secondary{color:var(--sd-secondary-dark)}.tab-router__menu-icon.c-info{color:var(--sd-info-dark)}.tab-router__menu-icon.c-success{color:var(--sd-success-dark)}.tab-router__menu-icon.c-warning{color:var(--sd-warning-dark)}.tab-router__menu-icon.c-error{color:var(--sd-error-dark)}.tab-router__menu-name{flex:1 1 auto;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.tab-router__menu-close{display:flex;flex:0 0 auto;align-items:center;justify-content:center;position:relative;width:20px;height:20px;padding:0;border:0;border-radius:6px;background:none;color:var(--sd-text-secondary);cursor:pointer;opacity:0}.tab-router__menu-close:hover{background:color-mix(in srgb,var(--sd-text) 8%,transparent)}.tab-router__menu-close:focus-visible{opacity:1;outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}:host(.tab-router__menu-row:hover) .tab-router__menu-close,:host(.tab-router__menu-row:focus-within) .tab-router__menu-close{opacity:1}@media(pointer:coarse){.tab-router__menu-close{opacity:1}.tab-router__menu-close:before{content:\"\";position:absolute;inset:-6px}}@media(forced-colors:active){:host(.tab-router__menu-row--active){outline:1px solid CanvasText;outline-offset:-1px}}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "pipe", type: SdTabInfoPipe, name: "sdTabInfo" }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
346
+ }
347
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTabRouterListItemComponent, decorators: [{
348
+ type: Component,
349
+ args: [{ selector: 'sd-tab-router-list-item', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [SdIcon, SdTabInfoPipe, SdTranslatePipe], host: {
350
+ role: 'listitem',
351
+ class: 'tab-router__menu-row',
352
+ '[class.tab-router__menu-row--active]': 'tab().isActive',
353
+ }, template: "@let _tab = tab();\n@let info = tabInfo() | sdTabInfo: _tab;\n<button type=\"button\" class=\"tab-router__menu-tab\" [attr.aria-current]=\"_tab.isActive ? 'page' : null\" (click)=\"pick.emit()\">\n @if (info.icon) {\n <sd-icon class=\"tab-router__menu-icon c-{{ info.color || 'primary' }}\" aria-hidden=\"true\" size=\"16px\" [fontIcon]=\"info.icon\"></sd-icon>\n }\n <span class=\"tab-router__menu-name\" [id]=\"nameId\">{{ info.name }}</span>\n</button>\n<!-- why: t\u00EAn l\u1EA5y t\u1EEB h\u00E0ng (aria-describedby), n\u00EAn screen reader \u0111\u1ECDc \"\u0110\u00F3ng tab, {t\u00EAn}\" thay cho m\u1ED9t lo\u1EA1t \"\u0110\u00F3ng tab\" gi\u1ED1ng nhau. -->\n<button\n type=\"button\"\n class=\"tab-router__menu-close\"\n [attr.aria-label]=\"'core.component.tab-router.close-tab' | sdTranslate\"\n [attr.aria-describedby]=\"nameId\"\n (click)=\"closeTab.emit()\">\n <sd-icon aria-hidden=\"true\" size=\"14px\" fontIcon=\"close\"></sd-icon>\n</button>\n", styles: [":host{display:flex;flex:0 0 36px;align-items:center;gap:4px;height:36px;padding:0 6px 0 0;border-radius:6px;box-sizing:border-box;color:var(--sd-text);font-size:var(--sd-font-size-13, 13px);line-height:18px}:host:hover{background:var(--sd-tab-router-nav-bg)}:host(.tab-router__menu-row--active){background:color-mix(in srgb,var(--sd-primary) 8%,transparent);font-weight:500}.tab-router__menu-tab{display:flex;flex:1 1 auto;align-items:center;gap:10px;min-width:0;height:100%;padding:0 0 0 10px;border:0;border-radius:6px;background:none;color:inherit;font:inherit;text-align:start;cursor:pointer}.tab-router__menu-tab:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.tab-router__menu-icon.c-primary{color:var(--sd-primary-dark)}.tab-router__menu-icon.c-secondary{color:var(--sd-secondary-dark)}.tab-router__menu-icon.c-info{color:var(--sd-info-dark)}.tab-router__menu-icon.c-success{color:var(--sd-success-dark)}.tab-router__menu-icon.c-warning{color:var(--sd-warning-dark)}.tab-router__menu-icon.c-error{color:var(--sd-error-dark)}.tab-router__menu-name{flex:1 1 auto;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.tab-router__menu-close{display:flex;flex:0 0 auto;align-items:center;justify-content:center;position:relative;width:20px;height:20px;padding:0;border:0;border-radius:6px;background:none;color:var(--sd-text-secondary);cursor:pointer;opacity:0}.tab-router__menu-close:hover{background:color-mix(in srgb,var(--sd-text) 8%,transparent)}.tab-router__menu-close:focus-visible{opacity:1;outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}:host(.tab-router__menu-row:hover) .tab-router__menu-close,:host(.tab-router__menu-row:focus-within) .tab-router__menu-close{opacity:1}@media(pointer:coarse){.tab-router__menu-close{opacity:1}.tab-router__menu-close:before{content:\"\";position:absolute;inset:-6px}}@media(forced-colors:active){:host(.tab-router__menu-row--active){outline:1px solid CanvasText;outline-offset:-1px}}\n"] }]
354
+ }], propDecorators: { tab: [{ type: i0.Input, args: [{ isSignal: true, alias: "tab", required: true }] }], pick: [{ type: i0.Output, args: ["pick"] }], closeTab: [{ type: i0.Output, args: ["closeTab"] }] } });
355
+
356
+ /** Bề rộng lớp mờ ở cạnh thanh; tab đang mở được cuộn ra khỏi vùng này. */
357
+ const FADE_WIDTH = 32;
277
358
  class SdTabRouterNavComponent {
278
- tabRouterNav = viewChild('tabRouterNav', /* @ts-ignore */
279
- ...(ngDevMode ? [{ debugName: "tabRouterNav" }] : /* istanbul ignore next */ []));
280
- tabs = input([], /* @ts-ignore */
359
+ #router = inject(Router);
360
+ #tabRouterService = inject(SdTabRouterService);
361
+ #injector = inject(Injector);
362
+ #zone = inject(NgZone);
363
+ // why: model, không phải input — kéo thả phát một mảng mới qua `tabsChange` (outlet bind `[(tabs)]`) thay vì sửa thẳng
364
+ // mảng outlet đang giữ.
365
+ tabs = model([], /* @ts-ignore */
281
366
  ...(ngDevMode ? [{ debugName: "tabs" }] : /* istanbul ignore next */ []));
282
- mode = 'default';
283
- cdRef = inject(ChangeDetectorRef);
284
367
  elementRef = inject(ElementRef);
285
- onResize() {
286
- this.checkUI();
368
+ scroller = viewChild.required('scroller', /* @ts-ignore */
369
+ ...(ngDevMode ? [{ debugName: "scroller" }] : /* istanbul ignore next */ []));
370
+ listButton = viewChild('listButton', /* @ts-ignore */
371
+ ...(ngDevMode ? [{ debugName: "listButton" }] : /* istanbul ignore next */ []));
372
+ contextMenu = viewChild('contextMenu', /* @ts-ignore */
373
+ ...(ngDevMode ? [{ debugName: "contextMenu" }] : /* istanbul ignore next */ []));
374
+ /** Tổng `min-width` của các tab vượt bề rộng thanh: thanh cuộn ngang và có nút danh sách tab. */
375
+ overflowing = signal(false, /* @ts-ignore */
376
+ ...(ngDevMode ? [{ debugName: "overflowing" }] : /* istanbul ignore next */ []));
377
+ /** Còn tab khuất ở cạnh đầu / cạnh cuối: hiện lớp mờ ở cạnh đó. */
378
+ fadeStart = signal(false, /* @ts-ignore */
379
+ ...(ngDevMode ? [{ debugName: "fadeStart" }] : /* istanbul ignore next */ []));
380
+ fadeEnd = signal(false, /* @ts-ignore */
381
+ ...(ngDevMode ? [{ debugName: "fadeEnd" }] : /* istanbul ignore next */ []));
382
+ listOpen = signal(false, /* @ts-ignore */
383
+ ...(ngDevMode ? [{ debugName: "listOpen" }] : /* istanbul ignore next */ []));
384
+ menu = signal(null, /* @ts-ignore */
385
+ ...(ngDevMode ? [{ debugName: "menu" }] : /* istanbul ignore next */ []));
386
+ /** Tab vừa nhận focus bằng phím mũi tên; `null` khi focus đã rời thanh. */
387
+ #focusKey = signal(null, /* @ts-ignore */
388
+ ...(ngDevMode ? [{ debugName: "#focusKey" }] : /* istanbul ignore next */ []));
389
+ /**
390
+ * Roving tabindex: điểm dừng Tab duy nhất của thanh. Là tab đang có focus khi người dùng di chuyển bằng phím, nếu
391
+ * không thì tab đang mở (focus vào lại thanh luôn rơi vào tab đang mở).
392
+ */
393
+ tabStopKey = computed(() => {
394
+ const tabs = this.tabs();
395
+ const key = this.#focusKey();
396
+ if (key && tabs.some(tab => tab.key === key))
397
+ return key;
398
+ return (tabs.find(tab => tab.isActive) ?? tabs[0])?.key ?? null;
399
+ }, /* @ts-ignore */
400
+ ...(ngDevMode ? [{ debugName: "tabStopKey" }] : /* istanbul ignore next */ []));
401
+ // why: menu treo dưới cả khối nút (cao bằng thanh 40px) cách 4px, mép phải thẳng mép phải nút (khối có đệm phải 6px).
402
+ listPositions = [
403
+ { originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top', offsetX: -6, offsetY: 4 },
404
+ { originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom', offsetX: -6, offsetY: -4 },
405
+ ];
406
+ /** Menu chuột phải mở bằng bàn phím: dưới tab, thẳng mép trái. */
407
+ menuAtTab = [
408
+ { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4 },
409
+ { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -4 },
410
+ ];
411
+ /** Menu chuột phải mở bằng chuột: góc trên trái tại con trỏ, lật khi chạm mép màn hình. */
412
+ #menuAtPointer = [
413
+ { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'top' },
414
+ { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' },
415
+ { originX: 'start', originY: 'top', overlayX: 'end', overlayY: 'top' },
416
+ { originX: 'start', originY: 'top', overlayX: 'end', overlayY: 'bottom' },
417
+ ];
418
+ #activeKey;
419
+ // Focus trong thanh: tab cuối cùng có focus, và focus còn ở trong thanh hay không. Khi tab đó bị gỡ khỏi DOM (đóng
420
+ // bằng Delete, menu, nút đóng) trình duyệt đưa focus về body — thanh đưa focus sang tab kế bên.
421
+ #lastFocusedKey;
422
+ #focusWithin = false;
423
+ #previousTabs = [];
424
+ constructor() {
425
+ const destroyRef = inject(DestroyRef);
426
+ afterNextRender(() => {
427
+ const scroller = this.scroller().nativeElement;
428
+ // why: scroll và wheel chạy liên tục — nghe ngoài zone, chỉ ghi signal khi giá trị đổi.
429
+ this.#zone.runOutsideAngular(() => {
430
+ scroller.addEventListener('scroll', this.#measure, { passive: true });
431
+ scroller.addEventListener('wheel', this.#onWheel, { passive: false });
432
+ });
433
+ // why: bề rộng vùng cuộn đổi (cửa sổ, sidebar, hay nút danh sách vừa hiện sau lần đo đầu) — đo lại và giữ tab đang
434
+ // mở trong tầm nhìn.
435
+ const resize = typeof ResizeObserver === 'undefined'
436
+ ? undefined
437
+ : new ResizeObserver(() => {
438
+ this.#measure();
439
+ this.#revealActive(this.tabs(), true);
440
+ });
441
+ resize?.observe(scroller);
442
+ destroyRef.onDestroy(() => {
443
+ scroller.removeEventListener('scroll', this.#measure);
444
+ scroller.removeEventListener('wheel', this.#onWheel);
445
+ resize?.disconnect();
446
+ });
447
+ });
448
+ // Danh sách tab đổi: đo lại sau khi DOM đã có tab mới, rồi cuộn tới tab đang mở nếu nó vừa đổi. Tab đang có focus
449
+ // vừa bị đóng thì focus sang tab bên phải nó, không có thì bên trái.
450
+ effect(() => {
451
+ const tabs = this.tabs();
452
+ untracked(() => {
453
+ const refocus = this.#neighbourOfClosedFocus(tabs);
454
+ afterNextRender(() => {
455
+ this.#measure();
456
+ this.#revealActive(tabs);
457
+ if (refocus)
458
+ this.#refocus(refocus);
459
+ }, { injector: this.#injector });
460
+ });
461
+ });
287
462
  }
288
- checkUI = () => {
289
- const width = this.tabRouterNav()?.nativeElement.clientWidth ?? 0;
463
+ toggleList = () => {
464
+ this.listOpen.update(open => !open);
465
+ };
466
+ closeList = (restoreFocus = true) => {
467
+ if (!this.listOpen())
468
+ return;
469
+ this.listOpen.set(false);
470
+ if (restoreFocus)
471
+ this.listButton()?.nativeElement.focus();
472
+ };
473
+ onListKeydown = (event) => {
474
+ if (event.key !== 'Escape' && event.key !== 'Esc')
475
+ return;
476
+ event.preventDefault();
477
+ this.closeList();
478
+ };
479
+ /** Chọn một tab trong menu: đóng menu (focus về nút) rồi chuyển tab như khi bấm tab trên thanh. */
480
+ pickTab = (tab) => {
481
+ this.closeList();
482
+ this.#router.navigate([tab.url], {
483
+ queryParams: tab.queryParams,
484
+ state: { switchTab: true },
485
+ });
486
+ };
487
+ closeTab = (tab) => {
488
+ this.#tabRouterService.close(tab);
489
+ };
490
+ onDrop = (event) => {
491
+ if (event.previousIndex === event.currentIndex)
492
+ return;
493
+ const tabs = [...this.tabs()];
494
+ moveItemInArray(tabs, event.previousIndex, event.currentIndex);
495
+ this.tabs.set(tabs);
496
+ };
497
+ // Bàn phím của tablist (WAI-ARIA tabs, kích hoạt thủ công): ←/→ chuyển focus (quay vòng ở hai đầu), Home/End về
498
+ // đầu/cuối, Delete đóng, Shift+F10 / phím Menu mở menu chuột phải. Enter/Space mở tab nằm trên chính tab.
499
+ onKeydown = (event) => {
500
+ const index = this.#indexOf(event.target);
290
501
  const tabs = this.tabs();
291
- if (tabs.length === 0) {
292
- this.mode = 'default';
293
- this.cdRef.markForCheck();
502
+ if (index < 0 || !tabs[index])
294
503
  return;
504
+ const last = tabs.length - 1;
505
+ let next;
506
+ switch (event.key) {
507
+ case 'ArrowRight':
508
+ next = index === last ? 0 : index + 1;
509
+ break;
510
+ case 'ArrowLeft':
511
+ next = index === 0 ? last : index - 1;
512
+ break;
513
+ case 'Home':
514
+ next = 0;
515
+ break;
516
+ case 'End':
517
+ next = last;
518
+ break;
519
+ case 'Delete':
520
+ event.preventDefault();
521
+ this.#tabRouterService.close(tabs[index]);
522
+ return;
523
+ case 'ContextMenu':
524
+ case 'F10':
525
+ if (event.key === 'F10' && !event.shiftKey)
526
+ return;
527
+ event.preventDefault();
528
+ this.#openMenuAtTab(index);
529
+ return;
530
+ default:
531
+ return;
295
532
  }
296
- const nameWidth = (width - tabs.length * 68) / tabs.length;
297
- if (nameWidth <= 20) {
298
- this.mode = 'compact';
533
+ event.preventDefault();
534
+ this.#focusTab(next);
535
+ };
536
+ onFocusin = (event) => {
537
+ const tab = this.tabs()[this.#indexOf(event.target)];
538
+ if (!tab)
539
+ return;
540
+ this.#focusKey.set(tab.key);
541
+ this.#lastFocusedKey = tab.key;
542
+ this.#focusWithin = true;
543
+ };
544
+ // why: focus rời thanh (sang phần tử khác) thì điểm dừng Tab trở về tab đang mở. `relatedTarget` null là focus về
545
+ // body — có thể vì chính tab đang focus vừa bị gỡ khỏi DOM, nên vẫn nhớ tab đó để đưa focus sang tab kế bên.
546
+ onFocusout = (event) => {
547
+ const next = event.relatedTarget;
548
+ if (next && this.scroller().nativeElement.contains(next))
549
+ return;
550
+ this.#focusKey.set(null);
551
+ if (next)
552
+ this.#focusWithin = false;
553
+ };
554
+ onContextmenu = (event) => {
555
+ const index = this.#indexOf(event.target);
556
+ const tab = this.tabs()[index];
557
+ if (!tab)
558
+ return;
559
+ event.preventDefault();
560
+ // why: Shift+F10 / phím Menu đã mở menu ở `keydown`; `contextmenu` trình duyệt phát tiếp theo không mở lại.
561
+ const open = this.menu();
562
+ if (open?.byKeyboard && open.tab.key === tab.key && event.button !== 2)
563
+ return;
564
+ if (event.button !== 2) {
565
+ this.#openMenuAtTab(index);
566
+ return;
299
567
  }
300
- else {
301
- this.mode = 'default';
568
+ this.menu.set({ tab, origin: { x: event.clientX, y: event.clientY }, positions: this.#menuAtPointer, byKeyboard: false });
569
+ };
570
+ /** Menu vừa gắn vào overlay: focus mục đầu. */
571
+ focusMenu = () => {
572
+ afterNextRender(() => this.#menuItems()[0]?.focus(), { injector: this.#injector });
573
+ };
574
+ closeMenu = (restoreFocus = true) => {
575
+ const open = this.menu();
576
+ if (!open)
577
+ return;
578
+ this.menu.set(null);
579
+ if (restoreFocus)
580
+ this.#focusTab(this.tabs().findIndex(tab => tab.key === open.tab.key));
581
+ };
582
+ // ↑/↓ (quay vòng), Home/End giữa các mục; Esc hoặc Tab đóng menu và trả focus về tab.
583
+ onMenuKeydown = (event) => {
584
+ const items = this.#menuItems();
585
+ const index = items.indexOf(document.activeElement);
586
+ let next;
587
+ switch (event.key) {
588
+ case 'ArrowDown':
589
+ next = index + 1 >= items.length ? 0 : index + 1;
590
+ break;
591
+ case 'ArrowUp':
592
+ next = index <= 0 ? items.length - 1 : index - 1;
593
+ break;
594
+ case 'Home':
595
+ next = 0;
596
+ break;
597
+ case 'End':
598
+ next = items.length - 1;
599
+ break;
600
+ case 'Escape':
601
+ case 'Esc':
602
+ case 'Tab':
603
+ event.preventDefault();
604
+ this.closeMenu();
605
+ return;
606
+ default:
607
+ return;
302
608
  }
303
- this.cdRef.markForCheck();
609
+ event.preventDefault();
610
+ items[next]?.focus();
304
611
  };
305
- onDrop = (event) => {
306
- moveItemInArray(this.tabs(), event.previousIndex, event.currentIndex);
612
+ closeFromMenu = () => {
613
+ const tab = this.menu()?.tab;
614
+ this.closeMenu();
615
+ if (tab)
616
+ this.#tabRouterService.close(tab);
617
+ };
618
+ closeOthersFromMenu = () => {
619
+ const tab = this.menu()?.tab;
620
+ this.closeMenu();
621
+ if (tab)
622
+ this.#tabRouterService.closeOthers(tab);
623
+ };
624
+ #tabElements = () => Array.from(this.scroller().nativeElement.querySelectorAll('[role="tab"]'));
625
+ // why: chỉ số của tab chứa `target` (chính tab hoặc nút đóng bên trong). Thứ tự DOM trùng thứ tự `tabs` — CDK chỉ dời
626
+ // tab bằng transform trong lúc kéo.
627
+ #indexOf = (target) => {
628
+ const tab = target instanceof Element ? target.closest('[role="tab"]') : null;
629
+ return tab ? this.#tabElements().indexOf(tab) : -1;
630
+ };
631
+ #menuItems = () => Array.from(this.contextMenu()?.nativeElement.querySelectorAll('[role="menuitem"]') ?? []);
632
+ #openMenuAtTab = (index) => {
633
+ const tab = this.tabs()[index];
634
+ const element = this.#tabElements()[index];
635
+ if (!tab || !element)
636
+ return;
637
+ this.menu.set({ tab, origin: element, positions: this.menuAtTab, byKeyboard: true });
638
+ };
639
+ #focusTab = (index) => {
640
+ const tab = this.tabs()[index];
641
+ const element = this.#tabElements()[index];
642
+ if (!tab || !element)
643
+ return;
644
+ this.#focusKey.set(tab.key);
645
+ element.focus({ preventScroll: true });
646
+ this.#reveal(element.closest('sd-tab-router-item'));
647
+ };
648
+ /** Tab đang có focus vừa bị đóng: key của tab bên phải nó còn lại, không có thì bên trái. */
649
+ #neighbourOfClosedFocus = (tabs) => {
650
+ const previous = this.#previousTabs;
651
+ this.#previousTabs = tabs;
652
+ const lost = this.#lastFocusedKey;
653
+ if (!lost || !this.#focusWithin || tabs.some(tab => tab.key === lost))
654
+ return null;
655
+ const index = previous.findIndex(tab => tab.key === lost);
656
+ if (index < 0)
657
+ return null;
658
+ const remains = (tab) => tabs.some(({ key }) => key === tab.key);
659
+ const neighbour = previous.slice(index + 1).find(remains) ?? previous.slice(0, index).reverse().find(remains);
660
+ if (!neighbour)
661
+ this.#focusWithin = false;
662
+ return neighbour?.key ?? null;
663
+ };
664
+ // why: chỉ lấy lại focus khi nó đã rơi về body (tab đang focus bị gỡ) — người dùng đã chuyển focus đi chỗ khác thì thôi.
665
+ #refocus = (key) => {
666
+ const active = document.activeElement;
667
+ if (active && active !== document.body && !this.scroller().nativeElement.contains(active))
668
+ return;
669
+ this.#focusTab(this.tabs().findIndex(tab => tab.key === key));
670
+ };
671
+ #measure = () => {
672
+ const scroller = this.scroller().nativeElement;
673
+ const max = scroller.scrollWidth - scroller.clientWidth;
674
+ const overflowing = max > 1;
675
+ this.overflowing.set(overflowing);
676
+ this.fadeStart.set(overflowing && scroller.scrollLeft > 1);
677
+ this.fadeEnd.set(overflowing && scroller.scrollLeft < max - 1);
678
+ // why: hết tràn thì nút danh sách biến mất — menu treo vào nút đó cũng phải đóng.
679
+ if (!overflowing)
680
+ this.listOpen.set(false);
681
+ };
682
+ // why: chuột thường chỉ có lăn dọc. Chỉ đổi khi thanh tràn và lăn dọc là chính (touchpad đã có lăn ngang); hết chỗ
683
+ // cuộn thì để trang nhận cú lăn.
684
+ #onWheel = (event) => {
685
+ const scroller = this.scroller().nativeElement;
686
+ if (scroller.scrollWidth - scroller.clientWidth <= 1 || Math.abs(event.deltaY) <= Math.abs(event.deltaX))
687
+ return;
688
+ const unit = event.deltaMode === WheelEvent.DOM_DELTA_LINE ? 16 : event.deltaMode === WheelEvent.DOM_DELTA_PAGE ? scroller.clientWidth : 1;
689
+ const before = scroller.scrollLeft;
690
+ scroller.scrollLeft = before + event.deltaY * unit;
691
+ if (scroller.scrollLeft !== before)
692
+ event.preventDefault();
693
+ };
694
+ // why: chỉ cuộn khi tab đang mở đổi (hoặc `force` khi vùng cuộn đổi bề rộng) — người dùng tự cuộn thanh để xem tab
695
+ // khác thì không bị kéo về.
696
+ #revealActive = (tabs, force = false) => {
697
+ const active = tabs.find(tab => tab.isActive);
698
+ if (!active || (!force && active.key === this.#activeKey))
699
+ return;
700
+ this.#activeKey = active.key;
701
+ this.#reveal(this.scroller().nativeElement.querySelector('sd-tab-router-item.sd-tab-router-item--active'));
702
+ };
703
+ /** Cuộn thanh để `item` hiện trọn, ngoài vùng lớp mờ. */
704
+ #reveal = (item) => {
705
+ const scroller = this.scroller().nativeElement;
706
+ if (!item || scroller.scrollWidth - scroller.clientWidth <= 1)
707
+ return;
708
+ const left = item.getBoundingClientRect().left - scroller.getBoundingClientRect().left + scroller.scrollLeft;
709
+ const right = left + item.offsetWidth;
710
+ if (left - FADE_WIDTH < scroller.scrollLeft) {
711
+ scroller.scrollLeft = Math.max(0, left - FADE_WIDTH);
712
+ }
713
+ else if (right + FADE_WIDTH > scroller.scrollLeft + scroller.clientWidth) {
714
+ scroller.scrollLeft = right + FADE_WIDTH - scroller.clientWidth;
715
+ }
716
+ this.#measure();
307
717
  };
308
718
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTabRouterNavComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
309
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdTabRouterNavComponent, isStandalone: true, selector: "sd-tab-router-nav", inputs: { tabs: { classPropertyName: "tabs", publicName: "tabs", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "window:resize": "onResize()" } }, viewQueries: [{ propertyName: "tabRouterNav", first: true, predicate: ["tabRouterNav"], descendants: true, isSignal: true }], ngImport: i0, template: "<div\n #tabRouterNav\n cdkDropList\n cdkDropListLockAxis=\"x\"\n cdkDropListOrientation=\"horizontal\"\n (cdkDropListDropped)=\"onDrop($event)\"\n class=\"tab-router__nav tab-router__nav--{{ mode }} d-flex align-items-center flex-nowrap\"\n [class.d-none]=\"tabs().length > 1\">\n @for (tab of tabs(); track tab.injector ?? tab.key) {\n <sd-tab-router-item [tab]=\"tab\" cdkDrag [cdkDragBoundary]=\"elementRef.nativeElement\"></sd-tab-router-item>\n }\n</div>\n", styles: [".tab-router__nav{background:var(--sd-tab-router-nav-bg, #f9f9f9);overflow:hidden}.tab-router__nav--compact::ng-deep .tab-router__name{display:none}.tab-router__nav--compact::ng-deep .tab-router__icon{margin:0!important}.tab-router__nav--compact::ng-deep .tab-router__item--active{min-width:240px}.tab-router__nav--compact::ng-deep .tab-router__item--active .tab-router__icon{margin-right:8px!important}.tab-router__nav--compact::ng-deep .tab-router__item--active .tab-router__name{display:-webkit-box}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i1.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer", "cdkDropListHasAnchor"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "component", type: SdTabRouterItemComponent, selector: "sd-tab-router-item", inputs: ["tab"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
719
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdTabRouterNavComponent, isStandalone: true, selector: "sd-tab-router-nav", inputs: { tabs: { classPropertyName: "tabs", publicName: "tabs", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { tabs: "tabsChange" }, viewQueries: [{ propertyName: "scroller", first: true, predicate: ["scroller"], descendants: true, isSignal: true }, { propertyName: "listButton", first: true, predicate: ["listButton"], descendants: true, isSignal: true }, { propertyName: "contextMenu", first: true, predicate: ["contextMenu"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _tabs = tabs();\n@let _open = listOpen();\n@let _tabStop = tabStopKey();\n@let _menu = menu();\n<div class=\"tab-router__nav\" [class.tab-router__nav--hidden]=\"_tabs.length <= 1\">\n <div class=\"tab-router__tabs\">\n <!-- why: \u0111\u1EE3t 3 \u00B7 3c \u2014 \u2190/\u2192/Home/End, Delete v\u00E0 menu chu\u1ED9t ph\u1EA3i (c\u1EA3 Shift+F10 / ph\u00EDm Menu) x\u1EED l\u00FD t\u1EA1i \u0111\u00E2y cho m\u1ECDi tab,\n n\u00EAn ch\u1EC9 nav c\u1EA7n bi\u1EBFt th\u1EE9 t\u1EF1 tab. Enter/Space m\u1EDF tab n\u1EB1m tr\u00EAn ch\u00EDnh tab. B\u1EA3n th\u00E2n tablist kh\u00F4ng nh\u1EADn focus: s\u1EF1\n ki\u1EC7n \u0111\u1EBFn t\u1EEB c\u00E1c tab (role=\"tab\", roving tabindex) b\u00EAn trong. -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div\n #scroller\n class=\"tab-router__scroller\"\n role=\"tablist\"\n cdkDropList\n cdkDropListLockAxis=\"x\"\n cdkDropListOrientation=\"horizontal\"\n (cdkDropListDropped)=\"onDrop($event)\"\n (keydown)=\"onKeydown($event)\"\n (focusin)=\"onFocusin($event)\"\n (focusout)=\"onFocusout($event)\"\n (contextmenu)=\"onContextmenu($event)\">\n @for (tab of _tabs; track tab.injector ?? tab.key) {\n <sd-tab-router-item\n [tab]=\"tab\"\n [focusable]=\"tab.key === _tabStop\"\n cdkDrag\n [cdkDragBoundary]=\"elementRef.nativeElement\"></sd-tab-router-item>\n }\n </div>\n @if (fadeStart()) {\n <span class=\"tab-router__fade tab-router__fade--start\" aria-hidden=\"true\"></span>\n }\n @if (fadeEnd()) {\n <span class=\"tab-router__fade tab-router__fade--end\" aria-hidden=\"true\"></span>\n }\n </div>\n\n @if (overflowing()) {\n <div class=\"tab-router__more\" cdkOverlayOrigin #listOrigin=\"cdkOverlayOrigin\">\n <button\n #listButton\n type=\"button\"\n class=\"tab-router__list-button\"\n [attr.aria-label]=\"'core.component.tab-router.tab-list' | sdTranslate\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"_open\"\n (click)=\"toggleList()\">\n <span class=\"tab-router__list-count\">{{ _tabs.length }}</span>\n <sd-icon aria-hidden=\"true\" size=\"18px\" fontIcon=\"expand_more\"></sd-icon>\n </button>\n </div>\n\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"listOrigin\"\n [cdkConnectedOverlayOpen]=\"_open\"\n [cdkConnectedOverlayPositions]=\"listPositions\"\n [cdkConnectedOverlayViewportMargin]=\"8\"\n [cdkConnectedOverlayPush]=\"true\"\n [cdkConnectedOverlayHasBackdrop]=\"true\"\n [cdkConnectedOverlayDisableClose]=\"true\"\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n (backdropClick)=\"closeList(false)\"\n (overlayKeydown)=\"onListKeydown($event)\">\n @let _title = 'core.component.tab-router.open-tabs' | sdTranslate: { count: _tabs.length };\n <!-- why: trap focus v\u00E0 t\u1EF1 \u0111\u01B0a focus v\u00E0o h\u00E0ng \u0111\u1EA7u khi m\u1EDF (m\u1EABu sd-avatar-group); Esc tr\u1EA3 focus v\u1EC1 n\u00FAt. -->\n <div class=\"tab-router__menu\" role=\"dialog\" [attr.aria-label]=\"_title\" cdkTrapFocus [cdkTrapFocusAutoCapture]=\"true\">\n <div class=\"tab-router__menu-title\" aria-hidden=\"true\">{{ _title }}</div>\n <div class=\"tab-router__menu-list\" role=\"list\">\n @for (tab of _tabs; track tab.injector ?? tab.key) {\n <sd-tab-router-list-item [tab]=\"tab\" (pick)=\"pickTab(tab)\" (closeTab)=\"closeTab(tab)\"></sd-tab-router-list-item>\n }\n </div>\n </div>\n </ng-template>\n }\n\n <!-- Menu chu\u1ED9t ph\u1EA3i (\u0111\u1EE3t 3 \u00B7 3c): treo t\u1EA1i con tr\u1ECF, ho\u1EB7c d\u01B0\u1EDBi tab khi m\u1EDF b\u1EB1ng b\u00E0n ph\u00EDm. Kh\u00F4ng trap focus \u2014 Tab, Esc hay\n b\u1EA5m ra ngo\u00E0i \u0111\u1EC1u \u0111\u00F3ng menu. -->\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"_menu?.origin ?? elementRef\"\n [cdkConnectedOverlayOpen]=\"!!_menu\"\n [cdkConnectedOverlayPositions]=\"_menu?.positions ?? menuAtTab\"\n [cdkConnectedOverlayViewportMargin]=\"8\"\n [cdkConnectedOverlayPush]=\"true\"\n [cdkConnectedOverlayDisableClose]=\"true\"\n (attach)=\"focusMenu()\"\n (detach)=\"menu.set(null)\"\n (overlayOutsideClick)=\"closeMenu(false)\"\n (overlayKeydown)=\"onMenuKeydown($event)\">\n <div #contextMenu class=\"tab-router__context-menu\" role=\"menu\" (contextmenu)=\"$event.preventDefault()\">\n <button type=\"button\" role=\"menuitem\" class=\"tab-router__context-item\" (click)=\"closeFromMenu()\">\n <sd-icon aria-hidden=\"true\" size=\"18px\" fontIcon=\"close\"></sd-icon>\n <span>{{ 'core.component.tab-router.close-tab' | sdTranslate }}</span>\n </button>\n <button type=\"button\" role=\"menuitem\" class=\"tab-router__context-item tab-router__context-item--plain\" (click)=\"closeOthersFromMenu()\">\n {{ 'core.component.tab-router.close-others' | sdTranslate }}\n </button>\n </div>\n </ng-template>\n</div>\n", styles: [":host{display:block}.tab-router__nav{display:flex;flex-wrap:nowrap;align-items:stretch;height:40px;box-sizing:border-box;overflow:hidden;background:var(--sd-tab-router-nav-bg);transition:height .15s ease-out}.tab-router__nav--hidden{height:0;visibility:hidden;transition:height .15s ease-out,visibility 0s .15s}@media(prefers-reduced-motion:reduce){.tab-router__nav,.tab-router__nav--hidden{transition:none}}.tab-router__tabs{position:relative;display:flex;flex:1 1 auto;min-width:0}.tab-router__scroller{display:flex;flex:1 1 auto;flex-wrap:nowrap;align-items:flex-end;min-width:0;padding:0 8px;box-sizing:border-box;overflow-x:auto;overflow-y:hidden;scrollbar-width:none}.tab-router__scroller::-webkit-scrollbar{display:none}.tab-router__fade{position:absolute;top:0;bottom:0;width:32px;pointer-events:none}.tab-router__fade--start{left:0;background:linear-gradient(90deg,var(--sd-tab-router-nav-bg),transparent)}.tab-router__fade--end{right:0;background:linear-gradient(270deg,var(--sd-tab-router-nav-bg),transparent)}.tab-router__more{display:flex;flex:0 0 auto;align-items:center;padding:0 6px 0 4px;border-left:1px solid var(--sd-tab-router-item-divider);box-sizing:border-box}.tab-router__list-button{display:flex;align-items:center;gap:2px;height:30px;padding:0 6px 0 8px;border:0;border-radius:8px;box-sizing:border-box;background:none;color:var(--sd-text);font:inherit;font-size:var(--sd-font-size-12, 12px);font-weight:500;cursor:pointer}.tab-router__list-button:hover,.tab-router__list-button[aria-expanded=true]{background:var(--sd-tab-router-item-hover-bg)}.tab-router__list-button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.tab-router__list-count{font-variant-numeric:tabular-nums}.tab-router__menu{display:flex;flex-direction:column;box-sizing:border-box;width:320px;max-width:calc(100vw - 16px);padding:6px;color:var(--sd-text);background-color:var(--sd-select-panel-bg, var(--sd-surface));border:1px solid color-mix(in srgb,var(--sd-border) 60%,var(--sd-surface));border-radius:var(--sd-panel-radius, 10px);box-shadow:var(--sd-shadow-md, none)}.tab-router__menu-title{padding:6px 10px;color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px);font-weight:500;line-height:16px}.tab-router__menu-list{display:flex;flex-direction:column;max-height:300px;overflow-y:auto}sd-tab-router-item.sd-tab-router-item--active:after,sd-tab-router-item:has(+sd-tab-router-item.sd-tab-router-item--active):after,sd-tab-router-item:hover:after,sd-tab-router-item:has(+sd-tab-router-item:hover):after{opacity:0}.cdk-drop-list-dragging sd-tab-router-item:not(.cdk-drag-placeholder),sd-tab-router-item.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}@media(prefers-reduced-motion:reduce){.cdk-drop-list-dragging sd-tab-router-item:not(.cdk-drag-placeholder),sd-tab-router-item.cdk-drag-animating{transition:none}}.tab-router__context-menu{display:flex;flex-direction:column;box-sizing:border-box;width:224px;padding:6px;color:var(--sd-text);background-color:var(--sd-select-panel-bg, var(--sd-surface));border:1px solid color-mix(in srgb,var(--sd-border) 60%,var(--sd-surface));border-radius:var(--sd-panel-radius, 10px);box-shadow:var(--sd-shadow-md, none)}.tab-router__context-item{display:flex;flex:0 0 34px;align-items:center;gap:10px;height:34px;padding:0 10px;border:0;border-radius:6px;box-sizing:border-box;background:none;color:inherit;font:inherit;font-size:var(--sd-font-size-13, 13px);line-height:18px;text-align:start;cursor:pointer}.tab-router__context-item sd-icon{color:var(--sd-text-secondary)}.tab-router__context-item:hover{background:var(--sd-tab-router-nav-bg)}.tab-router__context-item:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.tab-router__context-item--plain{padding-left:38px}\n"], dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i2.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer", "cdkDropListHasAnchor"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i2.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i3.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation", "cdkConnectedOverlayUsePopover", "cdkConnectedOverlayMatchWidth", "cdkConnectedOverlay"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i3.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdTabRouterItemComponent, selector: "sd-tab-router-item", inputs: ["tab", "focusable"] }, { kind: "component", type: SdTabRouterListItemComponent, selector: "sd-tab-router-list-item", inputs: ["tab"], outputs: ["pick", "closeTab"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
310
720
  }
311
721
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTabRouterNavComponent, decorators: [{
312
722
  type: Component,
313
- args: [{ selector: 'sd-tab-router-nav', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [CommonModule, DragDropModule, SdTabRouterItemComponent], template: "<div\n #tabRouterNav\n cdkDropList\n cdkDropListLockAxis=\"x\"\n cdkDropListOrientation=\"horizontal\"\n (cdkDropListDropped)=\"onDrop($event)\"\n class=\"tab-router__nav tab-router__nav--{{ mode }} d-flex align-items-center flex-nowrap\"\n [class.d-none]=\"tabs().length > 1\">\n @for (tab of tabs(); track tab.injector ?? tab.key) {\n <sd-tab-router-item [tab]=\"tab\" cdkDrag [cdkDragBoundary]=\"elementRef.nativeElement\"></sd-tab-router-item>\n }\n</div>\n", styles: [".tab-router__nav{background:var(--sd-tab-router-nav-bg, #f9f9f9);overflow:hidden}.tab-router__nav--compact::ng-deep .tab-router__name{display:none}.tab-router__nav--compact::ng-deep .tab-router__icon{margin:0!important}.tab-router__nav--compact::ng-deep .tab-router__item--active{min-width:240px}.tab-router__nav--compact::ng-deep .tab-router__item--active .tab-router__icon{margin-right:8px!important}.tab-router__nav--compact::ng-deep .tab-router__item--active .tab-router__name{display:-webkit-box}\n"] }]
314
- }], propDecorators: { tabRouterNav: [{ type: i0.ViewChild, args: ['tabRouterNav', { isSignal: true }] }], tabs: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabs", required: false }] }], onResize: [{
315
- type: HostListener,
316
- args: ['window:resize']
317
- }] } });
723
+ args: [{ selector: 'sd-tab-router-nav', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [A11yModule, DragDropModule, OverlayModule, SdIcon, SdTabRouterItemComponent, SdTabRouterListItemComponent, SdTranslatePipe], template: "@let _tabs = tabs();\n@let _open = listOpen();\n@let _tabStop = tabStopKey();\n@let _menu = menu();\n<div class=\"tab-router__nav\" [class.tab-router__nav--hidden]=\"_tabs.length <= 1\">\n <div class=\"tab-router__tabs\">\n <!-- why: \u0111\u1EE3t 3 \u00B7 3c \u2014 \u2190/\u2192/Home/End, Delete v\u00E0 menu chu\u1ED9t ph\u1EA3i (c\u1EA3 Shift+F10 / ph\u00EDm Menu) x\u1EED l\u00FD t\u1EA1i \u0111\u00E2y cho m\u1ECDi tab,\n n\u00EAn ch\u1EC9 nav c\u1EA7n bi\u1EBFt th\u1EE9 t\u1EF1 tab. Enter/Space m\u1EDF tab n\u1EB1m tr\u00EAn ch\u00EDnh tab. B\u1EA3n th\u00E2n tablist kh\u00F4ng nh\u1EADn focus: s\u1EF1\n ki\u1EC7n \u0111\u1EBFn t\u1EEB c\u00E1c tab (role=\"tab\", roving tabindex) b\u00EAn trong. -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div\n #scroller\n class=\"tab-router__scroller\"\n role=\"tablist\"\n cdkDropList\n cdkDropListLockAxis=\"x\"\n cdkDropListOrientation=\"horizontal\"\n (cdkDropListDropped)=\"onDrop($event)\"\n (keydown)=\"onKeydown($event)\"\n (focusin)=\"onFocusin($event)\"\n (focusout)=\"onFocusout($event)\"\n (contextmenu)=\"onContextmenu($event)\">\n @for (tab of _tabs; track tab.injector ?? tab.key) {\n <sd-tab-router-item\n [tab]=\"tab\"\n [focusable]=\"tab.key === _tabStop\"\n cdkDrag\n [cdkDragBoundary]=\"elementRef.nativeElement\"></sd-tab-router-item>\n }\n </div>\n @if (fadeStart()) {\n <span class=\"tab-router__fade tab-router__fade--start\" aria-hidden=\"true\"></span>\n }\n @if (fadeEnd()) {\n <span class=\"tab-router__fade tab-router__fade--end\" aria-hidden=\"true\"></span>\n }\n </div>\n\n @if (overflowing()) {\n <div class=\"tab-router__more\" cdkOverlayOrigin #listOrigin=\"cdkOverlayOrigin\">\n <button\n #listButton\n type=\"button\"\n class=\"tab-router__list-button\"\n [attr.aria-label]=\"'core.component.tab-router.tab-list' | sdTranslate\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"_open\"\n (click)=\"toggleList()\">\n <span class=\"tab-router__list-count\">{{ _tabs.length }}</span>\n <sd-icon aria-hidden=\"true\" size=\"18px\" fontIcon=\"expand_more\"></sd-icon>\n </button>\n </div>\n\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"listOrigin\"\n [cdkConnectedOverlayOpen]=\"_open\"\n [cdkConnectedOverlayPositions]=\"listPositions\"\n [cdkConnectedOverlayViewportMargin]=\"8\"\n [cdkConnectedOverlayPush]=\"true\"\n [cdkConnectedOverlayHasBackdrop]=\"true\"\n [cdkConnectedOverlayDisableClose]=\"true\"\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n (backdropClick)=\"closeList(false)\"\n (overlayKeydown)=\"onListKeydown($event)\">\n @let _title = 'core.component.tab-router.open-tabs' | sdTranslate: { count: _tabs.length };\n <!-- why: trap focus v\u00E0 t\u1EF1 \u0111\u01B0a focus v\u00E0o h\u00E0ng \u0111\u1EA7u khi m\u1EDF (m\u1EABu sd-avatar-group); Esc tr\u1EA3 focus v\u1EC1 n\u00FAt. -->\n <div class=\"tab-router__menu\" role=\"dialog\" [attr.aria-label]=\"_title\" cdkTrapFocus [cdkTrapFocusAutoCapture]=\"true\">\n <div class=\"tab-router__menu-title\" aria-hidden=\"true\">{{ _title }}</div>\n <div class=\"tab-router__menu-list\" role=\"list\">\n @for (tab of _tabs; track tab.injector ?? tab.key) {\n <sd-tab-router-list-item [tab]=\"tab\" (pick)=\"pickTab(tab)\" (closeTab)=\"closeTab(tab)\"></sd-tab-router-list-item>\n }\n </div>\n </div>\n </ng-template>\n }\n\n <!-- Menu chu\u1ED9t ph\u1EA3i (\u0111\u1EE3t 3 \u00B7 3c): treo t\u1EA1i con tr\u1ECF, ho\u1EB7c d\u01B0\u1EDBi tab khi m\u1EDF b\u1EB1ng b\u00E0n ph\u00EDm. Kh\u00F4ng trap focus \u2014 Tab, Esc hay\n b\u1EA5m ra ngo\u00E0i \u0111\u1EC1u \u0111\u00F3ng menu. -->\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"_menu?.origin ?? elementRef\"\n [cdkConnectedOverlayOpen]=\"!!_menu\"\n [cdkConnectedOverlayPositions]=\"_menu?.positions ?? menuAtTab\"\n [cdkConnectedOverlayViewportMargin]=\"8\"\n [cdkConnectedOverlayPush]=\"true\"\n [cdkConnectedOverlayDisableClose]=\"true\"\n (attach)=\"focusMenu()\"\n (detach)=\"menu.set(null)\"\n (overlayOutsideClick)=\"closeMenu(false)\"\n (overlayKeydown)=\"onMenuKeydown($event)\">\n <div #contextMenu class=\"tab-router__context-menu\" role=\"menu\" (contextmenu)=\"$event.preventDefault()\">\n <button type=\"button\" role=\"menuitem\" class=\"tab-router__context-item\" (click)=\"closeFromMenu()\">\n <sd-icon aria-hidden=\"true\" size=\"18px\" fontIcon=\"close\"></sd-icon>\n <span>{{ 'core.component.tab-router.close-tab' | sdTranslate }}</span>\n </button>\n <button type=\"button\" role=\"menuitem\" class=\"tab-router__context-item tab-router__context-item--plain\" (click)=\"closeOthersFromMenu()\">\n {{ 'core.component.tab-router.close-others' | sdTranslate }}\n </button>\n </div>\n </ng-template>\n</div>\n", styles: [":host{display:block}.tab-router__nav{display:flex;flex-wrap:nowrap;align-items:stretch;height:40px;box-sizing:border-box;overflow:hidden;background:var(--sd-tab-router-nav-bg);transition:height .15s ease-out}.tab-router__nav--hidden{height:0;visibility:hidden;transition:height .15s ease-out,visibility 0s .15s}@media(prefers-reduced-motion:reduce){.tab-router__nav,.tab-router__nav--hidden{transition:none}}.tab-router__tabs{position:relative;display:flex;flex:1 1 auto;min-width:0}.tab-router__scroller{display:flex;flex:1 1 auto;flex-wrap:nowrap;align-items:flex-end;min-width:0;padding:0 8px;box-sizing:border-box;overflow-x:auto;overflow-y:hidden;scrollbar-width:none}.tab-router__scroller::-webkit-scrollbar{display:none}.tab-router__fade{position:absolute;top:0;bottom:0;width:32px;pointer-events:none}.tab-router__fade--start{left:0;background:linear-gradient(90deg,var(--sd-tab-router-nav-bg),transparent)}.tab-router__fade--end{right:0;background:linear-gradient(270deg,var(--sd-tab-router-nav-bg),transparent)}.tab-router__more{display:flex;flex:0 0 auto;align-items:center;padding:0 6px 0 4px;border-left:1px solid var(--sd-tab-router-item-divider);box-sizing:border-box}.tab-router__list-button{display:flex;align-items:center;gap:2px;height:30px;padding:0 6px 0 8px;border:0;border-radius:8px;box-sizing:border-box;background:none;color:var(--sd-text);font:inherit;font-size:var(--sd-font-size-12, 12px);font-weight:500;cursor:pointer}.tab-router__list-button:hover,.tab-router__list-button[aria-expanded=true]{background:var(--sd-tab-router-item-hover-bg)}.tab-router__list-button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.tab-router__list-count{font-variant-numeric:tabular-nums}.tab-router__menu{display:flex;flex-direction:column;box-sizing:border-box;width:320px;max-width:calc(100vw - 16px);padding:6px;color:var(--sd-text);background-color:var(--sd-select-panel-bg, var(--sd-surface));border:1px solid color-mix(in srgb,var(--sd-border) 60%,var(--sd-surface));border-radius:var(--sd-panel-radius, 10px);box-shadow:var(--sd-shadow-md, none)}.tab-router__menu-title{padding:6px 10px;color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px);font-weight:500;line-height:16px}.tab-router__menu-list{display:flex;flex-direction:column;max-height:300px;overflow-y:auto}sd-tab-router-item.sd-tab-router-item--active:after,sd-tab-router-item:has(+sd-tab-router-item.sd-tab-router-item--active):after,sd-tab-router-item:hover:after,sd-tab-router-item:has(+sd-tab-router-item:hover):after{opacity:0}.cdk-drop-list-dragging sd-tab-router-item:not(.cdk-drag-placeholder),sd-tab-router-item.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}@media(prefers-reduced-motion:reduce){.cdk-drop-list-dragging sd-tab-router-item:not(.cdk-drag-placeholder),sd-tab-router-item.cdk-drag-animating{transition:none}}.tab-router__context-menu{display:flex;flex-direction:column;box-sizing:border-box;width:224px;padding:6px;color:var(--sd-text);background-color:var(--sd-select-panel-bg, var(--sd-surface));border:1px solid color-mix(in srgb,var(--sd-border) 60%,var(--sd-surface));border-radius:var(--sd-panel-radius, 10px);box-shadow:var(--sd-shadow-md, none)}.tab-router__context-item{display:flex;flex:0 0 34px;align-items:center;gap:10px;height:34px;padding:0 10px;border:0;border-radius:6px;box-sizing:border-box;background:none;color:inherit;font:inherit;font-size:var(--sd-font-size-13, 13px);line-height:18px;text-align:start;cursor:pointer}.tab-router__context-item sd-icon{color:var(--sd-text-secondary)}.tab-router__context-item:hover{background:var(--sd-tab-router-nav-bg)}.tab-router__context-item:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.tab-router__context-item--plain{padding-left:38px}\n"] }]
724
+ }], ctorParameters: () => [], propDecorators: { tabs: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabs", required: false }] }, { type: i0.Output, args: ["tabsChange"] }], scroller: [{ type: i0.ViewChild, args: ['scroller', { isSignal: true }] }], listButton: [{ type: i0.ViewChild, args: ['listButton', { isSignal: true }] }], contextMenu: [{ type: i0.ViewChild, args: ['contextMenu', { isSignal: true }] }] } });
318
725
 
319
726
  class SdTabRouterOutletComponent {
320
727
  disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
728
+ /**
729
+ * Đặt tiêu đề trình duyệt theo tab đang mở: `{tên tab} – {tên app}`, thêm "● " ở đầu khi tab `dirty`. Tên app là
730
+ * tiêu đề lúc outlet khởi tạo; tắt, `disabled` hay huỷ outlet thì trả lại tiêu đề đó. Mặc định tắt.
731
+ */
732
+ syncBrowserTitle = input(false, { ...(ngDevMode ? { debugName: "syncBrowserTitle" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
321
733
  tabRouterNav = viewChild('tabRouterNav', /* @ts-ignore */
322
734
  ...(ngDevMode ? [{ debugName: "tabRouterNav" }] : /* istanbul ignore next */ []));
323
735
  tabs = signal([], /* @ts-ignore */
@@ -328,6 +740,9 @@ class SdTabRouterOutletComponent {
328
740
  #tabRouterService = inject(SdTabRouterService);
329
741
  #sdNotifyService = inject(SdNotifyService);
330
742
  #i18n = inject(I18nService);
743
+ #title = inject(Title);
744
+ #appTitle = this.#title.getTitle();
745
+ #titleChanged = false;
331
746
  // why: @SdTabComponent KHÔNG còn đọc BehaviorSubject tĩnh này nữa (đã chuyển sang collection
332
747
  // tĩnh + drain ở constructor bên dưới). Vẫn inject để `SdTabDecoratorService.tabRouterService`
333
748
  // tiếp tục phát instance service ra cho consumer cũ. Không dùng trực tiếp ở đây.
@@ -355,10 +770,21 @@ class SdTabRouterOutletComponent {
355
770
  event instanceof NavigationCancel ||
356
771
  event instanceof NavigationError),
357
772
  // Chụp getCurrentNavigation đồng bộ vì concatMap có thể chạy sau khi Angular đã xoá navigation hiện tại.
358
- map((event) => ({
359
- event,
360
- navigationState: this.#router.getCurrentNavigation()?.extras?.state ?? {},
361
- })),
773
+ // why: route của tab cũng phải chụp ở đây. Khi hàng đợi kích hoạt còn bận (tab trước chờ nạp module lazy),
774
+ // router đã sang URL sau trước khi tác vụ của URL này chạy; đọc routerState lúc đó làm tab nhận component,
775
+ // route và tên của URL sau.
776
+ map((event) => {
777
+ const context = {
778
+ event,
779
+ navigationState: this.#router.getCurrentNavigation()?.extras?.state ?? {},
780
+ };
781
+ if (event instanceof NavigationEnd || event instanceof NavigationSkipped) {
782
+ const route = this.#getActivatedRouteSnapshot(this.#router.routerState.snapshot.root);
783
+ context.route = route;
784
+ context.activatedRoute = route ? this.#findActivatedRouteForSnapshot(this.#router.routerState.root, route) : null;
785
+ }
786
+ return context;
787
+ }),
362
788
  // Serialize: #handleEvent async (await getBestInjector). 2 nav liên tiếp
363
789
  // không await xen kẽ → tránh race đọc this.tabs() = [] khi tab đầu chưa kịp set.
364
790
  concatMap(context => defer(() => this.#handleEvent(context)).pipe(
@@ -374,11 +800,26 @@ class SdTabRouterOutletComponent {
374
800
  if (event?.type === 'close') {
375
801
  this.#closeTab(event.tab);
376
802
  }
803
+ else if (event?.type === 'close-others') {
804
+ void this.#closeOthers(event.tab);
805
+ }
377
806
  }));
378
807
  // why: @SdTabComponent chỉ ghi builder vào một collection tĩnh (không subscribe gì cả,
379
808
  // xem tab.decorator.ts). Outlet là nơi duy nhất chắc chắn có SdTabRouterService nên nó
380
809
  // drain collection đó vào service khi khởi tạo, và ngắt kết nối khi destroy.
381
810
  this.#disconnectTabBuilders = ɵsdConnectTabComponentBuilders(builder => this.#tabRouterService.addBuilder(builder));
811
+ // Đợt 3 · 3d: tiêu đề trình duyệt theo tab đang mở (tên từ `tabInfoChanges`, trước đó từ `@SdTabComponent`).
812
+ effect(onCleanup => {
813
+ const active = this.syncBrowserTitle() && !this.disabled() ? this.tabs().find(tab => tab.isActive) : undefined;
814
+ if (!active) {
815
+ untracked(() => this.#restoreTitle());
816
+ return;
817
+ }
818
+ const subscription = untracked(() => active.tabInfoChanges
819
+ .pipe(startWith(null))
820
+ .subscribe(info => this.#showTitle(info ?? sdTabInfoFromBuilders(this.#tabRouterService.builders.getValue(), active), active)));
821
+ onCleanup(() => subscription.unsubscribe());
822
+ });
382
823
  // Initial navigation có thể hoàn tất trước khi outlet subscribe router.events
383
824
  // (blocking init hoặc outlet mount muộn). Catch-up sau first render.
384
825
  afterNextRender(() => {
@@ -386,6 +827,7 @@ class SdTabRouterOutletComponent {
386
827
  });
387
828
  }
388
829
  ngOnDestroy() {
830
+ this.#restoreTitle();
389
831
  this.#subscription.unsubscribe();
390
832
  this.#pendingNavigationStates.clear();
391
833
  this.#disconnectTabBuilders?.();
@@ -396,7 +838,7 @@ class SdTabRouterOutletComponent {
396
838
  this.#activationQueue = run.catch(() => undefined);
397
839
  return run;
398
840
  };
399
- #handleEvent = async ({ event, navigationState }) => {
841
+ #handleEvent = async ({ event, navigationState, route, activatedRoute }) => {
400
842
  if (this.disabled()) {
401
843
  this.#pendingNavigationStates.clear();
402
844
  return;
@@ -425,9 +867,8 @@ class SdTabRouterOutletComponent {
425
867
  fullUrl = event.urlAfterRedirects || event.url;
426
868
  }
427
869
  await this.#scheduleActivation(async () => {
428
- const route = this.#getActivatedRouteSnapshot(this.#router.routerState.snapshot.root);
429
870
  this.#rootRoute = this.#router.routerState.root;
430
- await this.#activeRoute(fullUrl, route, state);
871
+ await this.#activeRoute(fullUrl, route ?? null, state, activatedRoute ?? null);
431
872
  });
432
873
  };
433
874
  // Bù initial navigation nếu NavigationEnd đã fire trước khi outlet subscribe.
@@ -456,21 +897,33 @@ class SdTabRouterOutletComponent {
456
897
  });
457
898
  };
458
899
  tabTrackBy = (index, tab) => tab.key;
900
+ #showTitle = (info, tab) => {
901
+ const name = info.name || sdTabInfoFromBuilders(this.#tabRouterService.builders.getValue(), tab).name;
902
+ this.#title.setTitle(`${info.dirty ? '● ' : ''}${name} – ${this.#appTitle}`);
903
+ this.#titleChanged = true;
904
+ };
905
+ #restoreTitle = () => {
906
+ if (!this.#titleChanged)
907
+ return;
908
+ this.#title.setTitle(this.#appTitle);
909
+ this.#titleChanged = false;
910
+ };
911
+ // `beforeClose` chỉ cho đóng khi trả về true; false, throw hay reject đều giữ tab lại.
912
+ #canClose = async (tab) => {
913
+ try {
914
+ const result = tab.beforeClose ? tab.beforeClose() : true;
915
+ return typeof result === 'boolean' ? result : await result;
916
+ }
917
+ catch {
918
+ return false;
919
+ }
920
+ };
459
921
  #closeTab = async (tab) => {
460
922
  if (this.disabled())
461
923
  return;
462
- if (tab.beforeClose) {
463
- let canClose;
464
- try {
465
- const result = tab.beforeClose();
466
- canClose = typeof result === 'boolean' ? result : await result;
467
- }
468
- catch {
469
- canClose = false;
470
- }
471
- if (!canClose)
472
- return;
473
- }
924
+ // why: không có `beforeClose` thì đóng ngay trong cùng lượt (không await), như trước.
925
+ if (tab.beforeClose && !(await this.#canClose(tab)))
926
+ return;
474
927
  const currentTabs = this.tabs();
475
928
  const { isActive, key: activeKey } = tab;
476
929
  if (isActive) {
@@ -489,10 +942,33 @@ class SdTabRouterOutletComponent {
489
942
  }
490
943
  else {
491
944
  this.tabs.set(currentTabs.filter(({ key }) => key !== tab.key));
492
- this.tabRouterNav()?.checkUI();
493
945
  }
494
946
  };
495
- #activeRoute = async (fullUrl, route, state = {}) => {
947
+ // Menu chuột phải "Đóng các tab khác" (đợt 3 · 3c). Hỏi `beforeClose` lần lượt từng tab (mỗi tab có thể mở hộp xác
948
+ // nhận riêng), rồi gỡ một lần những tab cho đóng. Tab đang mở nằm trong số đó thì mở `keep`.
949
+ #closeOthers = async (keep) => {
950
+ if (this.disabled())
951
+ return;
952
+ const closing = new Set();
953
+ for (const tab of this.tabs()) {
954
+ if (tab.key !== keep.key && (!tab.beforeClose || (await this.#canClose(tab))))
955
+ closing.add(tab.key);
956
+ }
957
+ if (!closing.size || this.disabled())
958
+ return;
959
+ // why: đọc lại sau các lần await — tab có thể đã đổi trong lúc chờ hộp xác nhận.
960
+ const currentTabs = this.tabs();
961
+ const kept = currentTabs.find(({ key }) => key === keep.key);
962
+ const closesActive = currentTabs.some(({ key, isActive }) => isActive && closing.has(key));
963
+ this.tabs.set(currentTabs.filter(({ key }) => !closing.has(key)));
964
+ if (closesActive && kept) {
965
+ this.#router.navigate([kept.url], {
966
+ queryParams: { ...(kept.queryParams || {}) },
967
+ state: { switchTab: true },
968
+ });
969
+ }
970
+ };
971
+ #activeRoute = async (fullUrl, route, state = {}, capturedActivatedRoute = null) => {
496
972
  if (this.disabled())
497
973
  return;
498
974
  if (!route?.component)
@@ -568,8 +1044,10 @@ class SdTabRouterOutletComponent {
568
1044
  };
569
1045
  const finalInjector = await getBestInjector(route);
570
1046
  // Refresh root sau await: lazy route tree có thể hoàn tất trong lúc resolve injector.
1047
+ // why: router có thể đã sang URL khác trong lúc await — snapshot của route này không còn trong cây mới, nên dùng
1048
+ // ActivatedRoute đã chụp lúc NavigationEnd.
571
1049
  this.#rootRoute = this.#router.routerState.root;
572
- const activatedRoute = this.#findActivatedRouteForSnapshot(this.#rootRoute, route);
1050
+ const activatedRoute = this.#findActivatedRouteForSnapshot(this.#rootRoute, route) ?? capturedActivatedRoute;
573
1051
  const sdInjector = new SdOutletInjector(activatedRoute, finalInjector);
574
1052
  const newTab = {
575
1053
  key,
@@ -580,7 +1058,9 @@ class SdTabRouterOutletComponent {
580
1058
  params,
581
1059
  queryParams,
582
1060
  data,
583
- tabInfoChanges: new Subject(),
1061
+ // why: ReplaySubject(1) (vẫn là một Subject) — danh sách tab của thanh dựng hàng khi menu mở, sau khi màn hình đã
1062
+ // gửi tên qua đây; Subject thường làm hàng đó mất tên đã đổi.
1063
+ tabInfoChanges: new ReplaySubject(1),
584
1064
  };
585
1065
  sdInjector.setTab(newTab);
586
1066
  // Tạo updatedTabs qua spread thay vì mutate (xem lý do ở for loop phía trên).
@@ -624,7 +1104,6 @@ class SdTabRouterOutletComponent {
624
1104
  this.#sdNotifyService.warning(this.#i18n.t('core.component.tab-router.too-many-tabs'));
625
1105
  }
626
1106
  }
627
- this.tabRouterNav()?.checkUI();
628
1107
  };
629
1108
  // Lần xuống deepest firstChild để lấy snapshot của route lá (route thực sự render component).
630
1109
  #getActivatedRouteSnapshot = (snapshot) => {
@@ -647,12 +1126,12 @@ class SdTabRouterOutletComponent {
647
1126
  return null;
648
1127
  };
649
1128
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTabRouterOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
650
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdTabRouterOutletComponent, isStandalone: true, selector: "sd-tab-router-outlet", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "tabRouterNav", first: true, predicate: ["tabRouterNav"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (disabled()) {\n <div class=\"tab-router__disabled-outlet\">\n <router-outlet></router-outlet>\n </div>\n} @else {\n <sd-tab-router-nav [tabs]=\"tabs()\" #tabRouterNav></sd-tab-router-nav>\n <div class=\"tab-router__list\">\n @for (tab of tabs(); track tab.injector ?? tab.key) {\n <div class=\"tab-router__pane\" [class.active]=\"tab.isActive\" [id]=\"tab.key\">\n <div class=\"tab-router__content\">\n <ng-container *ngComponentOutlet=\"tab.component; injector: tab.injector\"></ng-container>\n </div>\n </div>\n } @empty {\n <div class=\"tab-router__empty\"></div>\n }\n </div>\n}\n", styles: [":host{display:flex;flex-direction:column;width:100%;min-height:0;height:100vh}:host ::ng-deep .sd-loading{max-width:100%;max-height:100%}.tab-router__list{flex:1;min-height:0}.tab-router__disabled-outlet{flex:1;width:100%;min-height:0;overflow:auto}.tab-router__pane{display:none;position:relative;height:100%;width:100%}.tab-router__pane.active{display:block}.tab-router__content{position:absolute;inset:0;overflow:auto;height:100%;width:100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "component", type: SdTabRouterNavComponent, selector: "sd-tab-router-nav", inputs: ["tabs"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
1129
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdTabRouterOutletComponent, isStandalone: true, selector: "sd-tab-router-outlet", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, syncBrowserTitle: { classPropertyName: "syncBrowserTitle", publicName: "syncBrowserTitle", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "tabRouterNav", first: true, predicate: ["tabRouterNav"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (disabled()) {\n <div class=\"tab-router__disabled-outlet\">\n <router-outlet></router-outlet>\n </div>\n} @else {\n <sd-tab-router-nav [(tabs)]=\"tabs\" #tabRouterNav></sd-tab-router-nav>\n <div class=\"tab-router__list\">\n @for (tab of tabs(); track tab.injector ?? tab.key) {\n <div\n class=\"tab-router__pane\"\n role=\"tabpanel\"\n [class.active]=\"tab.isActive\"\n [id]=\"tab.key\"\n [attr.aria-labelledby]=\"'sd-tab-router-tab-' + tab.key\">\n <div class=\"tab-router__content\">\n <ng-container *ngComponentOutlet=\"tab.component; injector: tab.injector\"></ng-container>\n </div>\n </div>\n }\n </div>\n}\n", styles: [":host{display:flex;flex-direction:column;width:100%;min-height:0;height:100vh;height:100dvh}:host ::ng-deep .sd-loading{max-width:100%;max-height:100%}.tab-router__list{flex:1;min-height:0}.tab-router__disabled-outlet{flex:1;width:100%;min-height:0;overflow:auto}.tab-router__pane{display:none;position:relative;height:100%;width:100%}.tab-router__pane.active{display:block}.tab-router__content{position:absolute;inset:0;overflow:auto;height:100%;width:100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "component", type: SdTabRouterNavComponent, selector: "sd-tab-router-nav", inputs: ["tabs"], outputs: ["tabsChange"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
651
1130
  }
652
1131
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTabRouterOutletComponent, decorators: [{
653
1132
  type: Component,
654
- args: [{ changeDetection: ChangeDetectionStrategy.Eager, selector: 'sd-tab-router-outlet', standalone: true, imports: [CommonModule, MatTooltipModule, RouterOutlet, SdTabRouterNavComponent], template: "@if (disabled()) {\n <div class=\"tab-router__disabled-outlet\">\n <router-outlet></router-outlet>\n </div>\n} @else {\n <sd-tab-router-nav [tabs]=\"tabs()\" #tabRouterNav></sd-tab-router-nav>\n <div class=\"tab-router__list\">\n @for (tab of tabs(); track tab.injector ?? tab.key) {\n <div class=\"tab-router__pane\" [class.active]=\"tab.isActive\" [id]=\"tab.key\">\n <div class=\"tab-router__content\">\n <ng-container *ngComponentOutlet=\"tab.component; injector: tab.injector\"></ng-container>\n </div>\n </div>\n } @empty {\n <div class=\"tab-router__empty\"></div>\n }\n </div>\n}\n", styles: [":host{display:flex;flex-direction:column;width:100%;min-height:0;height:100vh}:host ::ng-deep .sd-loading{max-width:100%;max-height:100%}.tab-router__list{flex:1;min-height:0}.tab-router__disabled-outlet{flex:1;width:100%;min-height:0;overflow:auto}.tab-router__pane{display:none;position:relative;height:100%;width:100%}.tab-router__pane.active{display:block}.tab-router__content{position:absolute;inset:0;overflow:auto;height:100%;width:100%}\n"] }]
655
- }], ctorParameters: () => [], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], tabRouterNav: [{ type: i0.ViewChild, args: ['tabRouterNav', { isSignal: true }] }] } });
1133
+ args: [{ changeDetection: ChangeDetectionStrategy.Eager, selector: 'sd-tab-router-outlet', standalone: true, imports: [CommonModule, MatTooltipModule, RouterOutlet, SdTabRouterNavComponent], template: "@if (disabled()) {\n <div class=\"tab-router__disabled-outlet\">\n <router-outlet></router-outlet>\n </div>\n} @else {\n <sd-tab-router-nav [(tabs)]=\"tabs\" #tabRouterNav></sd-tab-router-nav>\n <div class=\"tab-router__list\">\n @for (tab of tabs(); track tab.injector ?? tab.key) {\n <div\n class=\"tab-router__pane\"\n role=\"tabpanel\"\n [class.active]=\"tab.isActive\"\n [id]=\"tab.key\"\n [attr.aria-labelledby]=\"'sd-tab-router-tab-' + tab.key\">\n <div class=\"tab-router__content\">\n <ng-container *ngComponentOutlet=\"tab.component; injector: tab.injector\"></ng-container>\n </div>\n </div>\n }\n </div>\n}\n", styles: [":host{display:flex;flex-direction:column;width:100%;min-height:0;height:100vh;height:100dvh}:host ::ng-deep .sd-loading{max-width:100%;max-height:100%}.tab-router__list{flex:1;min-height:0}.tab-router__disabled-outlet{flex:1;width:100%;min-height:0;overflow:auto}.tab-router__pane{display:none;position:relative;height:100%;width:100%}.tab-router__pane.active{display:block}.tab-router__content{position:absolute;inset:0;overflow:auto;height:100%;width:100%}\n"] }]
1134
+ }], ctorParameters: () => [], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], syncBrowserTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "syncBrowserTitle", required: false }] }], tabRouterNav: [{ type: i0.ViewChild, args: ['tabRouterNav', { isSignal: true }] }] } });
656
1135
  // Custom Injector cho từng tab: override ActivatedRoute thành route của TAB ĐÓ
657
1136
  // (không phải route hiện tại của router). Nếu không override, mọi tab sẽ inject ActivatedRoute
658
1137
  // của route đang active → component cũ trong tab inactive nhận data sai khi user navigate.