@sdcorejs/angular 19.3.2 → 19.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 (399) hide show
  1. package/assets/THEME.md +58 -6
  2. package/assets/scss/core/form.scss +291 -3
  3. package/assets/scss/themes/_component-tokens.scss +35 -6
  4. package/components/badge/index.d.ts +1 -0
  5. package/components/badge/src/badge.model.d.ts +19 -0
  6. package/components/section/index.d.ts +1 -0
  7. package/components/section/src/section-registry.d.ts +11 -0
  8. package/components/splitter/index.d.ts +1 -1
  9. package/components/tab-router/src/actions/tab-router.action.d.ts +1 -1
  10. package/components/tab-router/src/components/tab-router-item/tab-router-item.component.d.ts +4 -2
  11. package/components/tab-router/src/components/tab-router-nav/tab-router-nav.component.d.ts +31 -3
  12. package/components/tab-router/src/components/tab-router-outlet/tab-router-outlet.component.d.ts +6 -1
  13. package/components/tab-router/src/models/tab-router.model.d.ts +5 -0
  14. package/components/tab-router/src/pipes/tab-info.pipe.d.ts +7 -0
  15. package/components/tab-router/src/services/tab-router.service.d.ts +5 -0
  16. package/components/table/index.d.ts +2 -0
  17. package/components/table/src/components/filter/external-filter/external-filter.component.d.ts +5 -1
  18. package/components/table/src/components/mobile-cards/mobile-cards.component.d.ts +4 -0
  19. package/components/table/src/configurations/index.d.ts +1 -0
  20. package/components/table/src/configurations/table-layout.d.ts +16 -0
  21. package/components/table/src/configurations/table.configuration.d.ts +3 -1
  22. package/components/table/src/models/index.d.ts +1 -0
  23. package/components/table/src/models/table-column.model.d.ts +3 -10
  24. package/components/table/src/models/table-item.model.d.ts +4 -1
  25. package/components/table/src/models/table-option-loading.model.d.ts +42 -0
  26. package/components/table/src/models/table-option.model.d.ts +6 -0
  27. package/components/table/src/services/table-filter/table-filter.model.d.ts +5 -0
  28. package/components/table/src/services/table-loading/table-loading.util.d.ts +91 -0
  29. package/components/table/src/services/tree/tree.util.d.ts +2 -0
  30. package/components/table/src/table.component.d.ts +23 -0
  31. package/components/upload-file/src/components/file-type-icon/file-type-icon.component.d.ts +15 -0
  32. package/components/upload-file/src/components/preview/preview.component.d.ts +88 -10
  33. package/components/upload-file/src/configurations/upload-file.configuration.d.ts +1 -1
  34. package/components/upload-file/src/helpers/file-type.d.ts +25 -0
  35. package/components/upload-file/src/pipes/file-meta.pipe.d.ts +9 -0
  36. package/components/upload-file/src/pipes/file-reason.pipe.d.ts +11 -0
  37. package/components/upload-file/src/pipes/index.d.ts +2 -0
  38. package/components/upload-file/src/upload-file.component.d.ts +89 -8
  39. package/fesm2022/sdcorejs-angular-components-badge.mjs +2 -2
  40. package/fesm2022/sdcorejs-angular-components-badge.mjs.map +1 -1
  41. package/fesm2022/sdcorejs-angular-components-form-generic.mjs +3 -3
  42. package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
  43. package/fesm2022/sdcorejs-angular-components-section.mjs +15 -3
  44. package/fesm2022/sdcorejs-angular-components-section.mjs.map +1 -1
  45. package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +2 -2
  46. package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
  47. package/fesm2022/sdcorejs-angular-components-splitter.mjs.map +1 -1
  48. package/fesm2022/sdcorejs-angular-components-tab-router.mjs +390 -75
  49. package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
  50. package/fesm2022/sdcorejs-angular-components-table.mjs +443 -15
  51. package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
  52. package/fesm2022/sdcorejs-angular-components-upload-file.mjs +886 -173
  53. package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
  54. package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs +7 -2
  55. package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs.map +1 -1
  56. package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs +5 -2
  57. package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs.map +1 -1
  58. package/fesm2022/sdcorejs-angular-forms-chip.mjs +421 -121
  59. package/fesm2022/sdcorejs-angular-forms-chip.mjs.map +1 -1
  60. package/fesm2022/sdcorejs-angular-forms-date-range.mjs +4 -0
  61. package/fesm2022/sdcorejs-angular-forms-date-range.mjs.map +1 -1
  62. package/fesm2022/sdcorejs-angular-forms-date.mjs +4 -0
  63. package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
  64. package/fesm2022/sdcorejs-angular-forms-datetime.mjs +4 -0
  65. package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
  66. package/fesm2022/sdcorejs-angular-forms-input-number.mjs +17 -2
  67. package/fesm2022/sdcorejs-angular-forms-input-number.mjs.map +1 -1
  68. package/fesm2022/sdcorejs-angular-forms-input.mjs +4 -0
  69. package/fesm2022/sdcorejs-angular-forms-input.mjs.map +1 -1
  70. package/fesm2022/sdcorejs-angular-forms-select.mjs +26 -20
  71. package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
  72. package/fesm2022/sdcorejs-angular-forms-textarea.mjs +14 -1
  73. package/fesm2022/sdcorejs-angular-forms-textarea.mjs.map +1 -1
  74. package/fesm2022/sdcorejs-angular-i18n.mjs +210 -0
  75. package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
  76. package/fesm2022/{sdcorejs-angular-modules-generic-generic-configuration.page-BFxO3eHX.mjs → sdcorejs-angular-modules-generic-generic-configuration.page-Bk3PrEf3.mjs} +3 -3
  77. package/fesm2022/{sdcorejs-angular-modules-generic-generic-configuration.page-BFxO3eHX.mjs.map → sdcorejs-angular-modules-generic-generic-configuration.page-Bk3PrEf3.mjs.map} +1 -1
  78. package/fesm2022/{sdcorejs-angular-modules-generic-generic-form-host.page-Csy2fShj.mjs → sdcorejs-angular-modules-generic-generic-form-host.page-CwUegGgG.mjs} +3 -3
  79. package/fesm2022/{sdcorejs-angular-modules-generic-generic-form-host.page-Csy2fShj.mjs.map → sdcorejs-angular-modules-generic-generic-form-host.page-CwUegGgG.mjs.map} +1 -1
  80. package/fesm2022/{sdcorejs-angular-modules-generic-generic-list.page-BIIxNR6k.mjs → sdcorejs-angular-modules-generic-generic-list.page-lF2trhfp.mjs} +3 -3
  81. package/fesm2022/{sdcorejs-angular-modules-generic-generic-list.page-BIIxNR6k.mjs.map → sdcorejs-angular-modules-generic-generic-list.page-lF2trhfp.mjs.map} +1 -1
  82. package/fesm2022/{sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-DjDsau9C.mjs → sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-BbmeOduc.mjs} +4 -4
  83. package/fesm2022/{sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-DjDsau9C.mjs.map → sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-BbmeOduc.mjs.map} +1 -1
  84. package/fesm2022/sdcorejs-angular-modules-generic.mjs +1 -1
  85. package/fesm2022/sdcorejs-angular-modules-layout.mjs +265 -10
  86. package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
  87. package/fesm2022/sdcorejs-angular-modules-pattern-api-error-BBWwQ6h2.mjs +23 -0
  88. package/fesm2022/sdcorejs-angular-modules-pattern-api-error-BBWwQ6h2.mjs.map +1 -0
  89. package/fesm2022/sdcorejs-angular-modules-pattern-approval-inbox-BMwD6_FC.mjs +16 -0
  90. package/fesm2022/sdcorejs-angular-modules-pattern-approval-inbox-BMwD6_FC.mjs.map +1 -0
  91. package/fesm2022/sdcorejs-angular-modules-pattern-base-api.service-CVEKaR8U.mjs +51 -0
  92. package/fesm2022/sdcorejs-angular-modules-pattern-base-api.service-CVEKaR8U.mjs.map +1 -0
  93. package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-BqHybMk0.mjs +130 -0
  94. package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-BqHybMk0.mjs.map +1 -0
  95. package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CND3d2zl.mjs +131 -0
  96. package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CND3d2zl.mjs.map +1 -0
  97. package/fesm2022/sdcorejs-angular-modules-pattern-create.component-BbDoQccI.mjs +99 -0
  98. package/fesm2022/sdcorejs-angular-modules-pattern-create.component-BbDoQccI.mjs.map +1 -0
  99. package/fesm2022/sdcorejs-angular-modules-pattern-create.component-CB_wJIP8.mjs +460 -0
  100. package/fesm2022/sdcorejs-angular-modules-pattern-create.component-CB_wJIP8.mjs.map +1 -0
  101. package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DlP4BrhU.mjs +118 -0
  102. package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DlP4BrhU.mjs.map +1 -0
  103. package/fesm2022/sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs +18 -0
  104. package/fesm2022/sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs.map +1 -0
  105. package/fesm2022/sdcorejs-angular-modules-pattern-customer.service-VAMePx_q.mjs +66 -0
  106. package/fesm2022/sdcorejs-angular-modules-pattern-customer.service-VAMePx_q.mjs.map +1 -0
  107. package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-BD79VR0c.mjs +148 -0
  108. package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-BD79VR0c.mjs.map +1 -0
  109. package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-B1rFhbOc.mjs +172 -0
  110. package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-B1rFhbOc.mjs.map +1 -0
  111. package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-BhCjw6ZL.mjs +467 -0
  112. package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-BhCjw6ZL.mjs.map +1 -0
  113. package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-CnL2FzCx.mjs +90 -0
  114. package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-CnL2FzCx.mjs.map +1 -0
  115. package/fesm2022/sdcorejs-angular-modules-pattern-flow.component-BeH-NYvE.mjs +514 -0
  116. package/fesm2022/sdcorejs-angular-modules-pattern-flow.component-BeH-NYvE.mjs.map +1 -0
  117. package/fesm2022/sdcorejs-angular-modules-pattern-form-api-errors-DpnYSG2j.mjs +61 -0
  118. package/fesm2022/sdcorejs-angular-modules-pattern-form-api-errors-DpnYSG2j.mjs.map +1 -0
  119. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-1bi0JZdf.mjs +170 -0
  120. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-1bi0JZdf.mjs.map +1 -0
  121. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-D6eKR2cq.mjs +87 -0
  122. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-D6eKR2cq.mjs.map +1 -0
  123. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-FcJS3Nbd.mjs +232 -0
  124. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-FcJS3Nbd.mjs.map +1 -0
  125. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-BA-3FR1J.mjs +70 -0
  126. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-BA-3FR1J.mjs.map +1 -0
  127. package/fesm2022/sdcorejs-angular-modules-pattern-index.component-BAZLCVci.mjs +100 -0
  128. package/fesm2022/sdcorejs-angular-modules-pattern-index.component-BAZLCVci.mjs.map +1 -0
  129. package/fesm2022/sdcorejs-angular-modules-pattern-lines-form.component-ikk0cK1M.mjs +522 -0
  130. package/fesm2022/sdcorejs-angular-modules-pattern-lines-form.component-ikk0cK1M.mjs.map +1 -0
  131. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-Cex41xzy.mjs +164 -0
  132. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-Cex41xzy.mjs.map +1 -0
  133. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-D643jEmo.mjs +629 -0
  134. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-D643jEmo.mjs.map +1 -0
  135. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-DTWHhNNl.mjs +71 -0
  136. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-DTWHhNNl.mjs.map +1 -0
  137. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-YJUJsrIZ.mjs +115 -0
  138. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-YJUJsrIZ.mjs.map +1 -0
  139. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-qH-YO6wP.mjs +118 -0
  140. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-qH-YO6wP.mjs.map +1 -0
  141. package/fesm2022/sdcorejs-angular-modules-pattern-mock-backend.factory-S0Vuy6Oc.mjs +1069 -0
  142. package/fesm2022/sdcorejs-angular-modules-pattern-mock-backend.factory-S0Vuy6Oc.mjs.map +1 -0
  143. package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-BpLQaYP5.mjs +186 -0
  144. package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-BpLQaYP5.mjs.map +1 -0
  145. package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-BrejHvB2.mjs +97 -0
  146. package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-BrejHvB2.mjs.map +1 -0
  147. package/fesm2022/sdcorejs-angular-modules-pattern-product.model-BoHLJ8vf.mjs +12 -0
  148. package/fesm2022/sdcorejs-angular-modules-pattern-product.model-BoHLJ8vf.mjs.map +1 -0
  149. package/fesm2022/sdcorejs-angular-modules-pattern-product.service-Ba73HPGG.mjs +48 -0
  150. package/fesm2022/sdcorejs-angular-modules-pattern-product.service-Ba73HPGG.mjs.map +1 -0
  151. package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-CBlN7eEn.mjs +295 -0
  152. package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-CBlN7eEn.mjs.map +1 -0
  153. package/fesm2022/sdcorejs-angular-modules-pattern-routes-BvzFafUW.mjs +74 -0
  154. package/fesm2022/sdcorejs-angular-modules-pattern-routes-BvzFafUW.mjs.map +1 -0
  155. package/fesm2022/sdcorejs-angular-modules-pattern-routes-C3uWi8JZ.mjs +165 -0
  156. package/fesm2022/sdcorejs-angular-modules-pattern-routes-C3uWi8JZ.mjs.map +1 -0
  157. package/fesm2022/sdcorejs-angular-modules-pattern-routes-C5ELCTEw.mjs +74 -0
  158. package/fesm2022/sdcorejs-angular-modules-pattern-routes-C5ELCTEw.mjs.map +1 -0
  159. package/fesm2022/sdcorejs-angular-modules-pattern-routes-ClQwnO4h.mjs +50 -0
  160. package/fesm2022/sdcorejs-angular-modules-pattern-routes-ClQwnO4h.mjs.map +1 -0
  161. package/fesm2022/sdcorejs-angular-modules-pattern-routes-DTUxYZ6g.mjs +66 -0
  162. package/fesm2022/sdcorejs-angular-modules-pattern-routes-DTUxYZ6g.mjs.map +1 -0
  163. package/fesm2022/sdcorejs-angular-modules-pattern-routes-DpCuYBlL.mjs +99 -0
  164. package/fesm2022/sdcorejs-angular-modules-pattern-routes-DpCuYBlL.mjs.map +1 -0
  165. package/fesm2022/sdcorejs-angular-modules-pattern-routes-DwZWxmJf.mjs +45 -0
  166. package/fesm2022/sdcorejs-angular-modules-pattern-routes-DwZWxmJf.mjs.map +1 -0
  167. package/fesm2022/sdcorejs-angular-modules-pattern-routes-ydOZduls.mjs +43 -0
  168. package/fesm2022/sdcorejs-angular-modules-pattern-routes-ydOZduls.mjs.map +1 -0
  169. package/fesm2022/sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-D3B5I9hg.mjs +406 -0
  170. package/fesm2022/sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-D3B5I9hg.mjs.map +1 -0
  171. package/fesm2022/sdcorejs-angular-modules-pattern-shell.component-BW-i6BHg.mjs +317 -0
  172. package/fesm2022/sdcorejs-angular-modules-pattern-shell.component-BW-i6BHg.mjs.map +1 -0
  173. package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-By1mYFa_.mjs +132 -0
  174. package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-By1mYFa_.mjs.map +1 -0
  175. package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-DwcyKb4j.mjs +143 -0
  176. package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-DwcyKb4j.mjs.map +1 -0
  177. package/fesm2022/sdcorejs-angular-modules-pattern-update.component-BBR8360C.mjs +100 -0
  178. package/fesm2022/sdcorejs-angular-modules-pattern-update.component-BBR8360C.mjs.map +1 -0
  179. package/fesm2022/sdcorejs-angular-modules-pattern-update.component-CAtqPgIH.mjs +357 -0
  180. package/fesm2022/sdcorejs-angular-modules-pattern-update.component-CAtqPgIH.mjs.map +1 -0
  181. package/fesm2022/sdcorejs-angular-modules-pattern-update.component-DjMChf6s.mjs +128 -0
  182. package/fesm2022/sdcorejs-angular-modules-pattern-update.component-DjMChf6s.mjs.map +1 -0
  183. package/fesm2022/sdcorejs-angular-modules-pattern.mjs +2 -0
  184. package/fesm2022/sdcorejs-angular-modules-pattern.mjs.map +1 -0
  185. package/fesm2022/sdcorejs-angular-services-unsaved-changes.mjs +104 -4
  186. package/fesm2022/sdcorejs-angular-services-unsaved-changes.mjs.map +1 -1
  187. package/forms/chip/src/chip.component.d.ts +135 -19
  188. package/forms/chip/src/index.d.ts +0 -1
  189. package/i18n/src/en.d.ts +42 -0
  190. package/modules/layout/components/index.d.ts +2 -0
  191. package/modules/layout/components/page/page-form-leave.guard.d.ts +9 -0
  192. package/modules/layout/components/page/page.component.d.ts +38 -2
  193. package/modules/layout/components/page-list/page-list.component.d.ts +42 -0
  194. package/modules/layout/components/shared/context-switcher/context-switcher.component.d.ts +1 -1
  195. package/modules/pattern/README.md +76 -0
  196. package/modules/pattern/configurations/pattern.configuration.d.ts +30 -0
  197. package/modules/pattern/configurations/provide-sd-patterns.d.ts +19 -0
  198. package/modules/pattern/core/mock-api/mock-api.interceptor.d.ts +8 -0
  199. package/modules/pattern/core/mock-api/mock-api.model.d.ts +62 -0
  200. package/modules/pattern/core/mock-api/mock-api.state.d.ts +36 -0
  201. package/modules/pattern/core/mock-api/mock-backend.d.ts +18 -0
  202. package/modules/pattern/core/mock-api/mock-backend.factory.d.ts +3 -0
  203. package/modules/pattern/core/mock-api/prng.d.ts +4 -0
  204. package/modules/pattern/core/mock-api/resources/approval.resource.d.ts +14 -0
  205. package/modules/pattern/core/mock-api/resources/category.resource.d.ts +9 -0
  206. package/modules/pattern/core/mock-api/resources/customer.resource.d.ts +22 -0
  207. package/modules/pattern/core/mock-api/resources/index.d.ts +3 -0
  208. package/modules/pattern/core/mock-api/resources/names.d.ts +5 -0
  209. package/modules/pattern/core/mock-api/resources/order.resource.d.ts +44 -0
  210. package/modules/pattern/core/mock-api/resources/partner.resource.d.ts +16 -0
  211. package/modules/pattern/core/mock-api/resources/product.resource.d.ts +13 -0
  212. package/modules/pattern/core/mock-api/resources/settings.resource.d.ts +18 -0
  213. package/modules/pattern/core/pattern-shell/catalog/pattern-catalog.d.ts +22 -0
  214. package/modules/pattern/core/pattern-shell/index/index.component.d.ts +9 -0
  215. package/modules/pattern/core/pattern-shell/settings/pattern-settings.store.d.ts +57 -0
  216. package/modules/pattern/core/pattern-shell/settings/settings-button.component.d.ts +44 -0
  217. package/modules/pattern/core/pattern-shell/shell/pattern-source-viewer.d.ts +8 -0
  218. package/modules/pattern/core/pattern-shell/shell/shell.component.d.ts +13 -0
  219. package/modules/pattern/core/pattern-shell/source/pattern-source.generated.d.ts +1 -0
  220. package/modules/pattern/core/pattern-shell/source/source-drawer.component.d.ts +27 -0
  221. package/modules/pattern/core/pattern-shell/toolbar/toolbar.component.d.ts +24 -0
  222. package/modules/pattern/core/permission/pattern-permission.d.ts +15 -0
  223. package/modules/pattern/core/permission/pattern-role.store.d.ts +13 -0
  224. package/modules/pattern/core/session-state.d.ts +4 -0
  225. package/modules/pattern/docs/detail.md +237 -0
  226. package/modules/pattern/docs/drawer.md +484 -0
  227. package/modules/pattern/docs/flow.md +631 -0
  228. package/modules/pattern/docs/form.md +518 -0
  229. package/modules/pattern/docs/header-actions.md +342 -0
  230. package/modules/pattern/docs/list.md +247 -0
  231. package/modules/pattern/docs/relation.md +180 -0
  232. package/modules/pattern/docs/select.md +206 -0
  233. package/modules/pattern/docs/split.md +350 -0
  234. package/modules/pattern/docs/states.md +168 -0
  235. package/modules/pattern/features/approval/entity.resolver.d.ts +4 -0
  236. package/modules/pattern/features/approval/entity.resolver.ts +21 -0
  237. package/modules/pattern/features/approval/pages/detail/detail.component.d.ts +13 -0
  238. package/modules/pattern/features/approval/pages/detail/detail.component.ts +139 -0
  239. package/modules/pattern/features/approval/pages/list/approval-inbox.d.ts +7 -0
  240. package/modules/pattern/features/approval/pages/list/approval-inbox.ts +7 -0
  241. package/modules/pattern/features/approval/pages/list/list.component.d.ts +26 -0
  242. package/modules/pattern/features/approval/pages/list/list.component.html +20 -0
  243. package/modules/pattern/features/approval/pages/list/list.component.ts +149 -0
  244. package/modules/pattern/features/approval/routes.d.ts +3 -0
  245. package/modules/pattern/features/approval/routes.ts +30 -0
  246. package/modules/pattern/features/approval/services/approval.model.d.ts +37 -0
  247. package/modules/pattern/features/approval/services/approval.model.ts +38 -0
  248. package/modules/pattern/features/approval/services/approval.service.d.ts +12 -0
  249. package/modules/pattern/features/approval/services/approval.service.ts +23 -0
  250. package/modules/pattern/features/category/components/create-side-drawer/create-side-drawer.component.d.ts +23 -0
  251. package/modules/pattern/features/category/components/create-side-drawer/create-side-drawer.component.ts +123 -0
  252. package/modules/pattern/features/category/components/general-information-form/general-information-form.component.d.ts +20 -0
  253. package/modules/pattern/features/category/components/general-information-form/general-information-form.component.ts +61 -0
  254. package/modules/pattern/features/category/components/update-side-drawer/update-side-drawer.component.d.ts +23 -0
  255. package/modules/pattern/features/category/components/update-side-drawer/update-side-drawer.component.ts +134 -0
  256. package/modules/pattern/features/category/entity.resolver.d.ts +6 -0
  257. package/modules/pattern/features/category/entity.resolver.ts +27 -0
  258. package/modules/pattern/features/category/pages/list/list.component.d.ts +17 -0
  259. package/modules/pattern/features/category/pages/list/list.component.html +20 -0
  260. package/modules/pattern/features/category/pages/list/list.component.ts +105 -0
  261. package/modules/pattern/features/category/routes.d.ts +3 -0
  262. package/modules/pattern/features/category/routes.ts +42 -0
  263. package/modules/pattern/features/category/services/category.model.d.ts +34 -0
  264. package/modules/pattern/features/category/services/category.model.ts +39 -0
  265. package/modules/pattern/features/category/services/category.service.d.ts +17 -0
  266. package/modules/pattern/features/category/services/category.service.ts +36 -0
  267. package/modules/pattern/features/customer/components/create-side-drawer/create-side-drawer.component.d.ts +24 -0
  268. package/modules/pattern/features/customer/components/create-side-drawer/create-side-drawer.component.ts +131 -0
  269. package/modules/pattern/features/customer/components/customer-select/customer-select.component.d.ts +20 -0
  270. package/modules/pattern/features/customer/components/customer-select/customer-select.component.ts +72 -0
  271. package/modules/pattern/features/customer/components/customer-type-select/customer-type-select.component.d.ts +20 -0
  272. package/modules/pattern/features/customer/components/customer-type-select/customer-type-select.component.ts +30 -0
  273. package/modules/pattern/features/customer/components/debts-view/debts-view.component.d.ts +11 -0
  274. package/modules/pattern/features/customer/components/debts-view/debts-view.component.ts +28 -0
  275. package/modules/pattern/features/customer/components/detail-side-drawer/detail-side-drawer.component.d.ts +20 -0
  276. package/modules/pattern/features/customer/components/detail-side-drawer/detail-side-drawer.component.ts +106 -0
  277. package/modules/pattern/features/customer/components/documents-view/documents-view.component.d.ts +14 -0
  278. package/modules/pattern/features/customer/components/documents-view/documents-view.component.ts +50 -0
  279. package/modules/pattern/features/customer/components/general-information-form/general-information-form.component.d.ts +33 -0
  280. package/modules/pattern/features/customer/components/general-information-form/general-information-form.component.ts +140 -0
  281. package/modules/pattern/features/customer/components/general-information-view/general-information-view.component.d.ts +9 -0
  282. package/modules/pattern/features/customer/components/general-information-view/general-information-view.component.ts +39 -0
  283. package/modules/pattern/features/customer/components/orders-view/orders-view.component.d.ts +11 -0
  284. package/modules/pattern/features/customer/components/orders-view/orders-view.component.ts +35 -0
  285. package/modules/pattern/features/customer/components/summary-cards/summary-cards.component.d.ts +22 -0
  286. package/modules/pattern/features/customer/components/summary-cards/summary-cards.component.ts +101 -0
  287. package/modules/pattern/features/customer/components/update-side-drawer/update-side-drawer.component.d.ts +24 -0
  288. package/modules/pattern/features/customer/components/update-side-drawer/update-side-drawer.component.ts +127 -0
  289. package/modules/pattern/features/customer/entity.resolver.d.ts +4 -0
  290. package/modules/pattern/features/customer/entity.resolver.ts +21 -0
  291. package/modules/pattern/features/customer/pages/list/list.component.d.ts +19 -0
  292. package/modules/pattern/features/customer/pages/list/list.component.html +22 -0
  293. package/modules/pattern/features/customer/pages/list/list.component.ts +113 -0
  294. package/modules/pattern/features/customer/pages/profile/profile.component.d.ts +31 -0
  295. package/modules/pattern/features/customer/pages/profile/profile.component.ts +120 -0
  296. package/modules/pattern/features/customer/pipes/customer-detail.pipe.d.ts +14 -0
  297. package/modules/pattern/features/customer/pipes/customer-detail.pipe.ts +18 -0
  298. package/modules/pattern/features/customer/routes.d.ts +6 -0
  299. package/modules/pattern/features/customer/routes.ts +59 -0
  300. package/modules/pattern/features/customer/services/customer.model.d.ts +77 -0
  301. package/modules/pattern/features/customer/services/customer.model.ts +87 -0
  302. package/modules/pattern/features/customer/services/customer.service.d.ts +24 -0
  303. package/modules/pattern/features/customer/services/customer.service.ts +79 -0
  304. package/modules/pattern/features/import/components/mapping-form/mapping-form.component.d.ts +21 -0
  305. package/modules/pattern/features/import/components/mapping-form/mapping-form.component.ts +41 -0
  306. package/modules/pattern/features/import/components/preview-view/preview-view.component.d.ts +10 -0
  307. package/modules/pattern/features/import/components/preview-view/preview-view.component.ts +44 -0
  308. package/modules/pattern/features/import/pages/flow/flow.component.d.ts +43 -0
  309. package/modules/pattern/features/import/pages/flow/flow.component.ts +269 -0
  310. package/modules/pattern/features/import/routes.d.ts +2 -0
  311. package/modules/pattern/features/import/routes.ts +19 -0
  312. package/modules/pattern/features/import/services/import.model.d.ts +38 -0
  313. package/modules/pattern/features/import/services/import.model.ts +82 -0
  314. package/modules/pattern/features/import/services/import.service.d.ts +15 -0
  315. package/modules/pattern/features/import/services/import.service.ts +18 -0
  316. package/modules/pattern/features/order/components/approval-steps/approval-steps.component.d.ts +9 -0
  317. package/modules/pattern/features/order/components/approval-steps/approval-steps.component.ts +74 -0
  318. package/modules/pattern/features/order/components/bulk-result/bulk-result.component.d.ts +22 -0
  319. package/modules/pattern/features/order/components/bulk-result/bulk-result.component.ts +46 -0
  320. package/modules/pattern/features/order/components/general-information-form/general-information-form.component.d.ts +30 -0
  321. package/modules/pattern/features/order/components/general-information-form/general-information-form.component.ts +96 -0
  322. package/modules/pattern/features/order/components/lines-form/lines-form.component.d.ts +33 -0
  323. package/modules/pattern/features/order/components/lines-form/lines-form.component.ts +205 -0
  324. package/modules/pattern/features/order/components/lines-view/lines-view.component.d.ts +12 -0
  325. package/modules/pattern/features/order/components/lines-view/lines-view.component.ts +42 -0
  326. package/modules/pattern/features/order/components/summary-cards/summary-cards.component.d.ts +25 -0
  327. package/modules/pattern/features/order/components/summary-cards/summary-cards.component.ts +128 -0
  328. package/modules/pattern/features/order/entity.resolver.d.ts +9 -0
  329. package/modules/pattern/features/order/entity.resolver.ts +37 -0
  330. package/modules/pattern/features/order/pages/create/create.component.d.ts +16 -0
  331. package/modules/pattern/features/order/pages/create/create.component.ts +99 -0
  332. package/modules/pattern/features/order/pages/detail/detail.component.d.ts +26 -0
  333. package/modules/pattern/features/order/pages/detail/detail.component.ts +222 -0
  334. package/modules/pattern/features/order/pages/list/list.component.d.ts +29 -0
  335. package/modules/pattern/features/order/pages/list/list.component.html +38 -0
  336. package/modules/pattern/features/order/pages/list/list.component.ts +291 -0
  337. package/modules/pattern/features/order/pages/update/update.component.d.ts +20 -0
  338. package/modules/pattern/features/order/pages/update/update.component.ts +119 -0
  339. package/modules/pattern/features/order/routes.d.ts +7 -0
  340. package/modules/pattern/features/order/routes.ts +54 -0
  341. package/modules/pattern/features/order/services/order.model.d.ts +106 -0
  342. package/modules/pattern/features/order/services/order.model.ts +109 -0
  343. package/modules/pattern/features/order/services/order.service.d.ts +25 -0
  344. package/modules/pattern/features/order/services/order.service.ts +63 -0
  345. package/modules/pattern/features/partner/pages/create/create.component.d.ts +41 -0
  346. package/modules/pattern/features/partner/pages/create/create.component.ts +324 -0
  347. package/modules/pattern/features/partner/routes.d.ts +2 -0
  348. package/modules/pattern/features/partner/routes.ts +20 -0
  349. package/modules/pattern/features/partner/services/partner.model.d.ts +30 -0
  350. package/modules/pattern/features/partner/services/partner.model.ts +30 -0
  351. package/modules/pattern/features/partner/services/partner.service.d.ts +13 -0
  352. package/modules/pattern/features/partner/services/partner.service.ts +17 -0
  353. package/modules/pattern/features/product/components/general-information-form/general-information-form.component.d.ts +23 -0
  354. package/modules/pattern/features/product/components/general-information-form/general-information-form.component.ts +88 -0
  355. package/modules/pattern/features/product/components/product-select/product-select.component.d.ts +20 -0
  356. package/modules/pattern/features/product/components/product-select/product-select.component.ts +65 -0
  357. package/modules/pattern/features/product/components/product-status-select/product-status-select.component.d.ts +22 -0
  358. package/modules/pattern/features/product/components/product-status-select/product-status-select.component.ts +30 -0
  359. package/modules/pattern/features/product/entity.resolver.d.ts +4 -0
  360. package/modules/pattern/features/product/entity.resolver.ts +21 -0
  361. package/modules/pattern/features/product/pages/create/create.component.d.ts +15 -0
  362. package/modules/pattern/features/product/pages/create/create.component.ts +85 -0
  363. package/modules/pattern/features/product/pages/detail/detail.component.d.ts +10 -0
  364. package/modules/pattern/features/product/pages/detail/detail.component.ts +53 -0
  365. package/modules/pattern/features/product/pages/list/list.component.d.ts +15 -0
  366. package/modules/pattern/features/product/pages/list/list.component.html +30 -0
  367. package/modules/pattern/features/product/pages/list/list.component.ts +71 -0
  368. package/modules/pattern/features/product/pages/update/update.component.d.ts +16 -0
  369. package/modules/pattern/features/product/pages/update/update.component.ts +86 -0
  370. package/modules/pattern/features/product/pipes/product-detail.pipe.d.ts +14 -0
  371. package/modules/pattern/features/product/pipes/product-detail.pipe.ts +18 -0
  372. package/modules/pattern/features/product/routes.d.ts +3 -0
  373. package/modules/pattern/features/product/routes.ts +48 -0
  374. package/modules/pattern/features/product/services/product.model.d.ts +34 -0
  375. package/modules/pattern/features/product/services/product.model.ts +38 -0
  376. package/modules/pattern/features/product/services/product.service.d.ts +17 -0
  377. package/modules/pattern/features/product/services/product.service.ts +48 -0
  378. package/modules/pattern/features/settings/pages/update/update.component.d.ts +26 -0
  379. package/modules/pattern/features/settings/pages/update/update.component.ts +227 -0
  380. package/modules/pattern/features/settings/routes.d.ts +3 -0
  381. package/modules/pattern/features/settings/routes.ts +24 -0
  382. package/modules/pattern/features/settings/services/settings.model.d.ts +17 -0
  383. package/modules/pattern/features/settings/services/settings.model.ts +18 -0
  384. package/modules/pattern/features/settings/services/settings.service.d.ts +10 -0
  385. package/modules/pattern/features/settings/services/settings.service.ts +15 -0
  386. package/modules/pattern/features/settings/settings.resolver.d.ts +4 -0
  387. package/modules/pattern/features/settings/settings.resolver.ts +8 -0
  388. package/modules/pattern/index.d.ts +3 -0
  389. package/modules/pattern/routes.d.ts +6 -0
  390. package/modules/pattern/services/base-api.service.d.ts +16 -0
  391. package/modules/pattern/utils/api-error.d.ts +4 -0
  392. package/modules/pattern/utils/focus-first-invalid.d.ts +5 -0
  393. package/modules/pattern/utils/form-api-errors.d.ts +16 -0
  394. package/modules/pattern/utils/resource-url.d.ts +2 -0
  395. package/package.json +13 -9
  396. package/services/unsaved-changes/src/unsaved-changes.adapters.d.ts +9 -0
  397. package/services/unsaved-changes/src/unsaved-changes.model.d.ts +2 -0
  398. package/forms/chip/src/pipes/index.d.ts +0 -1
  399. package/forms/chip/src/pipes/removable-chip.pipe.d.ts +0 -8
@@ -1,18 +1,16 @@
1
- import * as i0 from '@angular/core';
2
- import { Pipe, inject, ChangeDetectorRef, input, computed, booleanAttribute, model, output, viewChild, contentChild, effect, ChangeDetectionStrategy, Component } from '@angular/core';
3
- import { ENTER, COMMA } from '@angular/cdk/keycodes';
4
1
  import * as i1 from '@angular/common';
5
2
  import { CommonModule } from '@angular/common';
3
+ import * as i0 from '@angular/core';
4
+ import { inject, ChangeDetectorRef, ElementRef, DestroyRef, input, computed, booleanAttribute, model, output, viewChild, viewChildren, contentChild, signal, effect, isDevMode, afterRenderEffect, untracked, ChangeDetectionStrategy, Component } from '@angular/core';
5
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
6
6
  import { Utilities } from '@sdcorejs/utils/fns';
7
7
  import * as i2 from '@angular/forms';
8
- import { NgForm, FormGroup, FormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
9
- import { MatAutocompleteModule } from '@angular/material/autocomplete';
8
+ import { FormGroupDirective, NgForm, FormGroup, FormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
10
9
  import * as i5 from '@angular/material/chips';
11
- import { MatChipsModule } from '@angular/material/chips';
10
+ import { MatChipGrid, MatChipsModule } from '@angular/material/chips';
12
11
  import { MatFormFieldModule } from '@angular/material/form-field';
13
12
  import * as i3 from '@angular/material/input';
14
13
  import { MatInputModule } from '@angular/material/input';
15
- import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
16
14
  import * as i4 from '@angular/material/tooltip';
17
15
  import { MatTooltipModule } from '@angular/material/tooltip';
18
16
  import { SdView } from '@sdcorejs/angular/components/view';
@@ -21,45 +19,43 @@ import { SdLabel } from '@sdcorejs/angular/forms/label';
21
19
  import { ɵsdTimerScope as _sdTimerScope, sdFormControlState, sdViewedTransform, sdViewedInline, SdFormControl, ɵsdFormControlConnector as _sdFormControlConnector } from '@sdcorejs/angular/forms/models';
22
20
  import { I18nService } from '@sdcorejs/angular/i18n';
23
21
  import { sdIsEmpty, sdSerializeDataValue } from '@sdcorejs/angular/utilities/data-state';
24
- import { Subscription } from 'rxjs';
25
22
  import { SdIcon } from '@sdcorejs/angular/modules/icon';
26
23
 
27
- class SdRemovableChipPipe {
28
- constructor() { }
29
- transform(item, removable) {
30
- if (typeof removable === 'boolean') {
31
- return removable;
32
- }
33
- return removable(item);
34
- }
35
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdRemovableChipPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
36
- static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.21", ngImport: i0, type: SdRemovableChipPipe, isStandalone: true, name: "sdRemovableChip" });
37
- }
38
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdRemovableChipPipe, decorators: [{
39
- type: Pipe,
40
- args: [{
41
- name: 'sdRemovableChip',
42
- }]
43
- }], ctorParameters: () => [] });
44
-
45
- class SdChipErrorStateMatcher {
46
- formControl;
47
- constructor(formControl) {
48
- this.formControl = formControl;
49
- }
50
- isErrorState(control, form) {
51
- const isSubmitted = form && form.submitted;
52
- return !!(this.formControl?.invalid && (this.formControl?.dirty || this.formControl?.touched || isSubmitted));
53
- }
54
- }
24
+ /** Items that never become a chip; `0` and `false` still do (A2). */
25
+ const isChipItem = (item) => item !== null && item !== undefined && item !== '';
26
+ /** Keys that commit the typed text by default (`KeyboardEvent.key`). */
27
+ const DEFAULT_SEPARATORS = ['Enter', ','];
28
+ /** Default `chipTransform`: the text without surrounding spaces. */
29
+ const trimChip = (raw) => raw.trim();
30
+ /** Character a separator key stands for in pasted text; key names other than Enter / Tab have none. */
31
+ const separatorChar = (key) => (key === 'Enter' ? '\n' : key === 'Tab' ? '\t' : key.length === 1 ? key : null);
32
+ /** Duplicate highlight (B3), the same 1.4s as the review. */
33
+ const DUPLICATE_FLASH_MS = 1400;
34
+ /**
35
+ * Icon sizes by field size: chip ✕ / lock and the clear button (C1). why: the chip icons are one step below the handoff
36
+ * table (14 / 16 / 18px), as on `<sd-chip-calendar>` (chosen 2026-10-23: 16px looked heavy in a 24px chip), so both chip
37
+ * fields look the same.
38
+ */
39
+ const CHIP_ICONS = {
40
+ sm: { chip: '12px', clear: '16px' },
41
+ md: { chip: '14px', clear: '18px' },
42
+ lg: { chip: '16px', clear: '20px' },
43
+ };
55
44
  class SdChip {
56
45
  #ref = inject(ChangeDetectorRef);
57
46
  #i18n = inject(I18nService);
58
- // why: blur hoãn 150ms rồi gọi #ref.detectChanges(). Gỡ chip / đổi route trong 150ms đó là
59
- // đủ để detectChanges() chạy trên view đã destroy → ViewDestroyedError. Scope handle theo
60
- // DestroyRef để timer bị clear cùng lúc view tháo.
47
+ // why: lỗi phải hiện khi form cha đã submit dù field chưa chạm (A5). NgForm / FormGroupDirective tổ tiên
48
+ // giữ cờ `submitted`; MatInput cũng lấy đúng hai directive này cho ErrorStateMatcher.
49
+ #parentForm = inject(FormGroupDirective, { optional: true }) ?? inject(NgForm, { optional: true });
50
+ #host = inject(ElementRef).nativeElement;
51
+ /** why: id ổn định của lỗi (`<mat-error>` hoặc chữ ẩn của `hideInlineError`) để ô nhập trỏ `aria-describedby` sang (A8). */
52
+ errorId = `sd-chip-error-${Utilities.generateUuid()}`;
53
+ // why: blur hoãn 150ms, focus 100ms. Gỡ chip / đổi route trong khoảng đó thì timer chạy trên view đã destroy (từng
54
+ // gọi detectChanges() → ViewDestroyedError, giờ vẫn focus một ô nhập đã tháo). Scope handle theo DestroyRef để timer
55
+ // bị clear cùng lúc view tháo.
61
56
  #timers = _sdTimerScope();
62
- #subscription = new Subscription();
57
+ #destroyRef = inject(DestroyRef);
58
+ /** Control name when `name` is not set. */
63
59
  #name = Utilities.generateUuid();
64
60
  // Signals - inputs (accept null|undefined at boundary, transform to canonical)
65
61
  autoIdInput = input(undefined, {
@@ -130,13 +126,43 @@ class SdChip {
130
126
  });
131
127
  hideInlineError = input(false, { transform: booleanAttribute });
132
128
  required = input(false, { transform: booleanAttribute });
129
+ /** Fewest chips; > 0 adds `Validators.minLength`. Replaces `min`. */
130
+ minCount = input(undefined, {
131
+ transform: (v) => v ?? undefined,
132
+ });
133
+ /** Most chips; > 0 adds `Validators.maxLength` (for a model set from outside) and stops adding once reached. Replaces `max`. */
134
+ maxCount = input(undefined, {
135
+ transform: (v) => v ?? undefined,
136
+ });
137
+ /** @deprecated Use `minCount`; `minCount` wins when both are set. */
133
138
  min = input(0, {
134
139
  transform: (v) => v ?? 0,
135
140
  });
141
+ /** @deprecated Use `maxCount`; `maxCount` wins when both are set. */
136
142
  max = input(0, {
137
143
  transform: (v) => v ?? 0,
138
144
  });
145
+ /** `false` keeps the field read-only for typing: the input stays (mat-chip-grid needs it) but is read-only and out of the Tab order. */
139
146
  addable = input(true, { transform: booleanAttribute });
147
+ /** Leaving the field turns the typed text into a chip. `false` drops the text instead, as before. */
148
+ addOnBlur = input(true, { transform: booleanAttribute });
149
+ /** Keys that commit the typed text (`KeyboardEvent.key`). A paste also splits on these characters, new lines and tabs. */
150
+ separators = input(DEFAULT_SEPARATORS, {
151
+ transform: (v) => v ?? DEFAULT_SEPARATORS,
152
+ });
153
+ /** Normalises typed or pasted text before it is compared and stored; `null` or `''` drops it. Default: trim. */
154
+ chipTransform = input(trimChip, {
155
+ transform: (v) => v ?? trimChip,
156
+ });
157
+ /**
158
+ * Checks a normalised value: an i18n key (or the message itself) when it is refused, else `null`. A refused value does
159
+ * not become a chip; its text stays in the input and the message shows under the field.
160
+ */
161
+ chipValidator = input(null);
162
+ /** Shows a button that removes every chip `removable` allows. Off by default, like `clearable` of `<sd-date>`. */
163
+ clearable = input(false, { transform: booleanAttribute });
164
+ /** Chips shown while the field is not focused; the rest fold into “+N”. `null` shows them all. `2` suits `<sd-table>` cells. */
165
+ maxVisible = input(null);
140
166
  disabled = input(false, { transform: booleanAttribute });
141
167
  /** Display mode: `false` edit · `true` static view · `'inline'` interactive (disabled `'inline'` → static). */
142
168
  viewed = input(false, { transform: sdViewedTransform });
@@ -153,23 +179,37 @@ class SdChip {
153
179
  sdChange = output();
154
180
  // Template properties
155
181
  input = viewChild('input');
182
+ chipGrid = viewChild(MatChipGrid);
183
+ // why: query signal không đặt được trên field ES private (#).
184
+ chipTextElements = viewChildren('chipTextEl');
156
185
  sdViewDef = contentChild(SdViewDefDirective);
157
186
  sdLabelDef = contentChild(SdLabelDefDirective);
158
187
  sdLabelTemplate = contentChild('sdLabel');
159
188
  sdValueTemplate = contentChild('sdValue');
160
189
  // Local states
161
190
  #isBlurring = false;
162
- isFocused = false;
191
+ /** The field is being edited: the `sdViewDef` face gives way to the field. A signal, so OnPush redraws without `detectChanges()` (D1). */
192
+ isFocused = signal(false);
163
193
  #inputControl = new FormControl();
164
194
  #formControl = new SdFormControl();
195
+ /**
196
+ * Control of `mat-chip-grid` only. why: the grid is a ControlValueAccessor that writes the text of the rendered chips
197
+ * into its control on blur, after a timeout (numbers became strings, a form reset was undone). It still needs an
198
+ * ngControl to work out its error state on every check, so it gets this one; nothing reads its value.
199
+ */
200
+ gridControl = new FormControl(null);
165
201
  // why: `min`/`max` chỉ là validator do CHÍNH component sở hữu; `required` đi qua option riêng
166
202
  // của connector. Connector add/remove đúng phần này (addValidators/removeValidators) nên
167
203
  // validator do consumer tự gắn vào `formControl` public KHÔNG bị xoá — trước đây
168
204
  // `clearValidators()` + `setValidators()` thổi bay tất cả mỗi lần input đổi.
205
+ /** `minCount`, else the deprecated `min`. */
206
+ effectiveMinCount = computed(() => this.minCount() ?? this.min() ?? 0);
207
+ /** `maxCount`, else the deprecated `max`. */
208
+ effectiveMaxCount = computed(() => this.maxCount() ?? this.max() ?? 0);
169
209
  #validators = computed(() => {
170
210
  const validators = [];
171
- const min = this.min();
172
- const max = this.max();
211
+ const min = this.effectiveMinCount();
212
+ const max = this.effectiveMaxCount();
173
213
  if (min > 0)
174
214
  validators.push(Validators.minLength(min));
175
215
  if (max > 0)
@@ -184,15 +224,72 @@ class SdChip {
184
224
  required: this.required,
185
225
  });
186
226
  #matcher;
187
- separatorKeysCodes = [ENTER, COMMA];
188
- selectable = true;
227
+ /** why: phím tách do `separators` + onInputKeydown xử lý, nên Material không nhận phím nào. */
228
+ noSeparatorKeys = [];
229
+ /**
230
+ * Items rendered as chips: every value except `null`, `undefined` and `''`, so `0` shows (A2). Display only: the
231
+ * model is never rewritten. why: exact duplicates are dropped too, because the chips are tracked by value.
232
+ */
233
+ chips = computed(() => {
234
+ const value = this.#state().value;
235
+ return Array.isArray(value) ? [...new Set(value.filter(isChipItem))] : [];
236
+ });
237
+ /** Focus is in the input or on a chip; “+N” only folds chips while it is not (B7). */
238
+ #focusWithin = signal(false);
239
+ /** Message of a typed or pasted value that `chipValidator` refused; it shows under the field until the text changes (B4). */
240
+ inputError = signal(null);
241
+ /** Last polite announcement; a new id re-renders the text so a repeated message is read again. */
242
+ liveMessage = signal(null);
243
+ #liveId = 0;
244
+ /** Chip that the typed value duplicates, highlighted for 1.4s (B3). */
245
+ duplicateChip = signal(null);
246
+ /** Text of the chips that the 240px limit cuts; only they get a tooltip (B7). */
247
+ truncatedChips = signal(new Set());
248
+ #warnedDeprecated = false;
249
+ /** `maxCount` reached: typing and pasting add nothing more (B3). */
250
+ full = computed(() => {
251
+ const max = this.effectiveMaxCount();
252
+ return max > 0 && this.chips().length >= max;
253
+ });
254
+ /** Chips on screen: all while the field has focus, else at most `maxVisible` (B7). */
255
+ visibleChips = computed(() => {
256
+ const chips = this.chips();
257
+ const max = this.maxVisible();
258
+ if (this.#focusWithin() || max === null || max === undefined || max < 0 || chips.length <= max)
259
+ return chips;
260
+ return chips.slice(0, max);
261
+ });
262
+ /** Chips folded into “+N”. */
263
+ hiddenCount = computed(() => this.chips().length - this.visibleChips().length);
264
+ /** At least one chip may be removed, so the clear button has something to do (B6). */
265
+ hasRemovable = computed(() => {
266
+ void this.removable();
267
+ return this.chips().some(chip => this.isRemovable(chip));
268
+ });
269
+ /**
270
+ * Placeholder: “Đã đủ …” once full, else the input, else “Nhập rồi nhấn Enter” — never the label (B5). None when not
271
+ * addable, or while chips are folded into “+N”: nobody types then, and the input only fills the rest of the line (C1).
272
+ */
273
+ effectivePlaceholder = computed(() => {
274
+ if (!this.addable() || this.hiddenCount() > 0)
275
+ return null;
276
+ if (this.full())
277
+ return this.#i18n.t('core.form.chip.full', { max: this.effectiveMaxCount() });
278
+ return this.placeholder() || this.#i18n.t('core.form.chip.placeholder');
279
+ });
280
+ clearLabel = computed(() => this.#i18n.t('core.form.chip.clear'));
281
+ /** Tooltip of the lock on a chip that `removable` keeps (C3). */
282
+ lockedLabel = computed(() => this.#i18n.t('core.form.chip.locked'));
283
+ /** Sizes of the chip ✕ / lock and of the clear-button icon for the current `size` (C1). */
284
+ iconSizes = computed(() => CHIP_ICONS[this.size() === 'sm' || this.size() === 'lg' ? this.size() : 'md']);
285
+ moreLabel = computed(() => this.#i18n.t('core.form.chip.more', { count: this.hiddenCount() }));
189
286
  constructor() {
190
287
  // Update model
191
288
  effect(() => {
192
289
  const values = this.model();
193
- if (Array.isArray(values)) {
194
- this.#formControl.setValue(values);
195
- }
290
+ // why: `null` / `undefined` từ cha phải xoá chip và đưa control về `[]`; trước đây control giữ mảng cũ và
291
+ // vẫn gửi nó đi khi submit (A4).
292
+ this.#formControl.setValue(Array.isArray(values) ? values : []);
196
293
  });
197
294
  // Handle disabled state
198
295
  effect(() => {
@@ -200,19 +297,43 @@ class SdChip {
200
297
  if (isDisabled) {
201
298
  this.#formControl.disable();
202
299
  this.#inputControl.disable();
300
+ this.gridControl.disable();
203
301
  }
204
302
  else {
205
303
  this.#formControl.enable();
206
304
  this.#inputControl.enable();
305
+ this.gridControl.enable();
207
306
  }
208
307
  });
308
+ // why: `[required]` trên mat-chip-grid khớp selector `[required][formControl]` của RequiredValidator, nên
309
+ // `gridControl` sẽ invalid khi rỗng và MatChipInput gắn aria-invalid="true" lúc field chưa chạm. Gán thẳng thuộc
310
+ // tính của grid: mat-form-field vẫn hiện dấu * và ô nhập vẫn có aria-required.
311
+ effect(() => {
312
+ const grid = this.chipGrid();
313
+ if (grid)
314
+ grid.required = this.required();
315
+ });
209
316
  effect(() => {
210
- const nameVal = this.name();
211
- if (nameVal) {
212
- this.#name = nameVal;
317
+ if ((this.min() > 0 || this.max() > 0) && !this.#warnedDeprecated && isDevMode()) {
318
+ this.#warnedDeprecated = true;
319
+ console.warn('[sd-chip] `min` / `max` are deprecated; use `minCount` / `maxCount`.');
213
320
  }
214
321
  });
215
- this.#matcher = new SdChipErrorStateMatcher(this.#formControl);
322
+ // why: chữ chip dừng ở 240px rồi cắt "…" (B7); chỉ chip thật sự bị cắt mới cần tooltip, và chỉ đo được sau khi vẽ.
323
+ afterRenderEffect(() => {
324
+ const cut = new Set();
325
+ for (const { nativeElement } of this.chipTextElements()) {
326
+ if (nativeElement.scrollWidth > nativeElement.clientWidth)
327
+ cut.add(nativeElement.dataset['chip'] ?? '');
328
+ }
329
+ const current = untracked(this.truncatedChips);
330
+ if (cut.size !== current.size || [...cut].some(text => !current.has(text)))
331
+ this.truncatedChips.set(cut);
332
+ });
333
+ // why: `submitted` của form cha không phải signal; submit phải vẽ lại lỗi dưới OnPush.
334
+ this.#parentForm?.ngSubmit.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => this.#ref.markForCheck());
335
+ this.#formControl.sdChanges.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => this.#ref.markForCheck());
336
+ this.#matcher = { isErrorState: (_control, form) => !!this.inputError() || this.#errorGate(form) };
216
337
  }
217
338
  get formControl() {
218
339
  return this.#formControl;
@@ -229,8 +350,8 @@ class SdChip {
229
350
  errorMessage = computed(() => {
230
351
  void this.#state();
231
352
  void this.required();
232
- const min = this.min();
233
- const max = this.max();
353
+ const min = this.effectiveMinCount();
354
+ const max = this.effectiveMaxCount();
234
355
  const errors = this.#formControl.errors;
235
356
  if (!errors)
236
357
  return undefined;
@@ -245,32 +366,219 @@ class SdChip {
245
366
  get matcher() {
246
367
  return this.#matcher;
247
368
  }
248
- ngAfterViewInit() {
249
- this.#subscription.add(this.#formControl.sdChanges.subscribe(() => {
250
- this.#ref.markForCheck();
251
- }));
369
+ /**
370
+ * The one place that decides whether the error shows (A5): the `ErrorStateMatcher` of the chip grid and the input,
371
+ * `<mat-error>`, the `hideInlineError` icon and `aria-invalid` all read it. Invalid and touched, or the parent form
372
+ * was submitted; a field that is only dirty shows nothing.
373
+ */
374
+ isErrorShown() {
375
+ return !!this.inputError() || (!!this.errorMessage() && this.#errorGate());
252
376
  }
253
- ngOnDestroy() {
254
- this.#subscription.unsubscribe();
377
+ /** Text under the field: the `chipValidator` message of the typed value first, else the form error. */
378
+ errorText = computed(() => this.inputError() ?? this.errorMessage());
379
+ #errorGate(form) {
380
+ const control = this.#formControl;
381
+ return control.invalid && (control.touched || !!(form ?? this.#parentForm)?.submitted);
255
382
  }
256
- #add = (event) => {
257
- const value = (event.value ?? '').toString().trim();
258
- const values = this.#formControl.value ?? [];
259
- if (value && this.addable() && !values.includes(value)) {
260
- // why: PHẢI tạo mảng MỚI. `values` chính là mảng của consumer (model đi thẳng vào
261
- // formControl), nên `push` vừa sửa trộm mảng của họ, vừa giữ nguyên reference —
262
- // `model()` dùng equality Object.is nên `model.set(sameRef)` KHÔNG phát `modelChange`,
263
- // làm `[(model)]` lệch âm thầm.
264
- const next = [...values, value];
265
- this.#formControl.setValue(next);
266
- this.model.set(next);
267
- this.sdChange.emit(next);
383
+ /** Whether `item` may be removed, per `removable`; applied on every removal path (A1). */
384
+ isRemovable(item) {
385
+ const removable = this.removable();
386
+ return typeof removable === 'function' ? !!removable(item) : removable;
387
+ }
388
+ /** Accessible name of the ✕ button of a chip (A6). */
389
+ removeLabel(item) {
390
+ return this.#i18n.t('core.form.chip.remove', { value: String(item) });
391
+ }
392
+ /** Accessible name of a chip that `removable` keeps: its text plus “, Không xoá được” (C3). A removable chip keeps its text. */
393
+ chipLabel(item) {
394
+ return this.isRemovable(item) ? null : `${String(item)}, ${this.lockedLabel()}`;
395
+ }
396
+ /** Text of a chip, also its key for `truncatedChips`. */
397
+ chipText(item) {
398
+ return String(item);
399
+ }
400
+ /** A separator key (`separators`) commits the typed text; the key itself is not typed (B2 / separators). */
401
+ onInputKeydown(event) {
402
+ if (event.isComposing || !this.separators().includes(event.key))
403
+ return;
404
+ event.preventDefault();
405
+ this.#commitText(this.input()?.nativeElement.value ?? '');
406
+ }
407
+ /** The refused-value message goes as soon as the text changes (B4). */
408
+ onInputText() {
409
+ if (this.inputError())
410
+ this.inputError.set(null);
411
+ }
412
+ /**
413
+ * A paste that holds a separator, a new line or a tab becomes several chips in one change (B2). Duplicates are
414
+ * skipped, refused values and values past `maxCount` stay in the input, and the result is announced. A paste with
415
+ * no separator is left to the browser.
416
+ */
417
+ onPaste(event) {
418
+ if (!this.addable())
419
+ return;
420
+ const text = event.clipboardData?.getData('text') ?? '';
421
+ const chars = new Set(['\n', '\r', '\t']);
422
+ for (const key of this.separators()) {
423
+ const char = separatorChar(key);
424
+ if (char)
425
+ chars.add(char);
426
+ }
427
+ const parts = text.split(new RegExp(`[${[...chars].map(char => char.replace(/[\\\]^-]/g, '\\$&')).join('')}]`));
428
+ if (parts.length < 2)
429
+ return;
430
+ event.preventDefault();
431
+ const next = [...this.#currentValues()];
432
+ const max = this.effectiveMaxCount();
433
+ const kept = [];
434
+ let added = 0;
435
+ let skipped = 0;
436
+ let overflow = false;
437
+ let error = null;
438
+ for (const raw of parts) {
439
+ const value = this.#normalise(raw);
440
+ if (value === null)
441
+ continue;
442
+ if (next.some(item => String(item) === String(value))) {
443
+ skipped++;
444
+ continue;
445
+ }
446
+ const refused = this.#refusal(value);
447
+ if (refused || (max > 0 && next.length >= max)) {
448
+ if (refused)
449
+ error ??= refused;
450
+ else
451
+ overflow = true;
452
+ kept.push(raw.trim());
453
+ continue;
454
+ }
455
+ next.push(value);
456
+ added++;
457
+ }
458
+ if (added)
459
+ this.#commit(next);
460
+ this.#setInputText(kept.join(', '));
461
+ this.inputError.set(error);
462
+ const notes = [this.#i18n.t('core.form.chip.added', { count: added })];
463
+ if (skipped)
464
+ notes.push(this.#i18n.t('core.form.chip.skipped', { count: skipped }));
465
+ if (overflow)
466
+ notes.push(this.#i18n.t('core.form.chip.full', { max }));
467
+ this.#announce(notes.join(' · '));
468
+ }
469
+ /** Backspace / Delete on a chip that `removable` keeps says why nothing happened (A1, B3). */
470
+ onChipKeydown(event, item) {
471
+ if ((event.key === 'Backspace' || event.key === 'Delete') && !this.isRemovable(item)) {
472
+ this.#announce(this.#i18n.t('core.form.chip.locked'));
473
+ }
474
+ }
475
+ /** “+N” moves focus to the input, where every chip shows (B7). */
476
+ onMoreClick(event) {
477
+ event.stopPropagation();
478
+ this.#focus();
479
+ }
480
+ /** Focus entering the input or a chip unfolds “+N”; focus on the “+N” button itself does not (B7). */
481
+ onFocusIn(event) {
482
+ const target = event.target;
483
+ if (target?.classList.contains('sd-chip__more'))
484
+ return;
485
+ this.#focusWithin.set(true);
486
+ }
487
+ /**
488
+ * Marks the field touched once focus leaves it; moving between the input and the chips does not count.
489
+ * why: `mat-chip-grid` is no longer bound to the control. As a ControlValueAccessor it wrote the text of the rendered
490
+ * chips back into the control on blur (numbers became strings, a form reset was undone), so the component marks
491
+ * touched itself, like the grid did.
492
+ */
493
+ onFocusOut(event) {
494
+ const next = event.relatedTarget;
495
+ if (next && this.#host.contains(next))
496
+ return;
497
+ this.#focusWithin.set(false);
498
+ this.#formConnector.markAsTouched();
499
+ this.#ref.markForCheck();
500
+ }
501
+ #add = (event) => this.#commitText(event.value ?? '');
502
+ /**
503
+ * Typed text → chip (a separator key, blur, or `onAdd`): normalise, then a duplicate flashes the chip it repeats, a full
504
+ * field says so, a refused value stays in the input with its message, and anything else is added in one change.
505
+ */
506
+ #commitText(raw) {
507
+ if (!this.addable())
508
+ return;
509
+ const value = this.#normalise(String(raw));
510
+ if (value === null) {
511
+ this.#setInputText('');
512
+ return;
513
+ }
514
+ const values = this.#currentValues();
515
+ // why: so trùng theo chuỗi — model `[1]` và chữ "1" vừa gõ là một chip (A3).
516
+ const existing = values.find(item => String(item) === String(value));
517
+ if (existing !== undefined) {
518
+ this.#flashDuplicate(existing);
519
+ this.#announce(this.#i18n.t('core.form.chip.duplicate', { value: String(value) }));
520
+ this.#setInputText('');
521
+ return;
522
+ }
523
+ if (this.full()) {
524
+ this.#announce(this.#i18n.t('core.form.chip.full', { max: this.effectiveMaxCount() }));
525
+ return;
268
526
  }
527
+ const refused = this.#refusal(value);
528
+ if (refused) {
529
+ this.inputError.set(refused);
530
+ return;
531
+ }
532
+ // why: PHẢI tạo mảng MỚI. `values` chính là mảng của consumer (model đi thẳng vào formControl), nên `push` vừa sửa
533
+ // trộm mảng của họ, vừa giữ nguyên reference — `model()` dùng equality Object.is nên `model.set(sameRef)` KHÔNG phát
534
+ // `modelChange`, làm `[(model)]` lệch âm thầm.
535
+ this.#commit([...values, value]);
536
+ this.#setInputText('');
537
+ }
538
+ /** `chipTransform` of the text; `null`, `undefined` or `''` means nothing to add. */
539
+ #normalise(raw) {
540
+ const value = this.chipTransform()(raw);
541
+ return value === null || value === undefined || value === '' ? null : value;
542
+ }
543
+ /** Message of `chipValidator` for `value`, translated when it is a key, else `null`. */
544
+ #refusal(value) {
545
+ const result = this.chipValidator()?.(value) ?? null;
546
+ if (!result)
547
+ return null;
548
+ // why: I18nService.t trả lại chính chuỗi kèm cảnh báo khi không có key; app hay trả thẳng câu thông báo.
549
+ return result in this.#i18n.messages() ? this.#i18n.t(result) : result;
550
+ }
551
+ #currentValues() {
552
+ const value = this.#formControl.value;
553
+ return Array.isArray(value) ? value : [];
554
+ }
555
+ /** Every user change ends here: one new array, written once to the control, the model and `sdChange`. */
556
+ #commit(next) {
557
+ this.inputError.set(null);
558
+ // why: người dùng sửa thì control của form phải dirty trước khi nhận giá trị, như value accessor của Angular;
559
+ // ô gõ là inputControl nên control của chip không tự dirty.
560
+ this.#formControl.markAsDirty();
561
+ this.#formControl.setValue(next);
562
+ this.model.set(next);
563
+ this.sdChange.emit(next);
564
+ this.#ref.markForCheck();
565
+ }
566
+ #setInputText(text) {
269
567
  const inputEl = this.input();
270
568
  if (inputEl)
271
- inputEl.nativeElement.value = '';
272
- this.#inputControl.setValue('');
273
- };
569
+ inputEl.nativeElement.value = text;
570
+ this.#inputControl.setValue(text);
571
+ }
572
+ #announce(text) {
573
+ this.liveMessage.set({ id: ++this.#liveId, text });
574
+ }
575
+ #flashDuplicate(item) {
576
+ this.duplicateChip.set(item);
577
+ this.#timers.schedule(() => {
578
+ if (this.duplicateChip() === item)
579
+ this.duplicateChip.set(null);
580
+ }, DUPLICATE_FLASH_MS);
581
+ }
274
582
  #clickChip = ($event, item) => {
275
583
  $event.stopPropagation();
276
584
  $event.stopImmediatePropagation();
@@ -280,9 +588,11 @@ class SdChip {
280
588
  };
281
589
  #remove = (item) => {
282
590
  const values = this.#formControl.value ?? [];
283
- if (typeof item === 'string' || typeof item === 'number') {
591
+ // why: `removable` áp cho mọi đường xoá, kể cả Backspace / Delete trên chip mà Material vẫn phát `(removed)` (A1).
592
+ if ((typeof item === 'string' || typeof item === 'number') && this.isRemovable(item)) {
284
593
  // why: `filter` đã trả mảng mới nên reference đổi → `model.set` phát `modelChange`.
285
594
  const next = values.filter(value => item !== value);
595
+ this.#formControl.markAsDirty();
286
596
  this.#formControl.setValue(next);
287
597
  this.model.set(next);
288
598
  this.sdChange.emit(next);
@@ -290,83 +600,74 @@ class SdChip {
290
600
  this.#inputControl.setValue('');
291
601
  this.#focus();
292
602
  };
293
- #select = (event) => {
294
- const item = event.option.value;
295
- const values = this.#formControl.value ?? [];
296
- if (item) {
297
- if (typeof item === 'string' || typeof item === 'number') {
298
- if (!values.includes(item)) {
299
- // why: giống #add — mảng mới, không `push` lên mảng của consumer.
300
- const next = [...values, item];
301
- this.#formControl.setValue(next);
302
- this.model.set(next);
303
- this.sdChange.emit(next);
304
- }
305
- }
306
- const inputEl = this.input();
307
- if (inputEl)
308
- inputEl.nativeElement.value = '';
309
- this.#inputControl.setValue('', {
310
- emitEvent: false,
311
- });
312
- }
313
- };
603
+ // why: focus không còn xoá chữ đang gõ (B1).
314
604
  #onFocus = () => {
315
- this.isFocused = true;
605
+ this.isFocused.set(true);
316
606
  this.#isBlurring = false;
317
- this.#inputControl.setValue('');
318
607
  };
319
608
  #onBlur = () => {
320
609
  this.#isBlurring = true;
321
- // why: vẫn 150ms như cũ (cửa sổ để click vào chip/option huỷ blur) — chỉ scope handle
322
- // theo DestroyRef.
610
+ // why: vẫn 150ms như cũ (cửa sổ để click vào chip/option huỷ blur) — chỉ scope handle theo DestroyRef. Chữ đang gõ
611
+ // thành chip qua `matChipInputAddOnBlur`; chỉ khi `[addOnBlur]="false"` mới bỏ chữ như trước (B1).
323
612
  this.#timers.schedule(() => {
324
613
  if (this.#isBlurring) {
325
- this.isFocused = false;
326
- this.#inputControl.setValue('', {
327
- emitEvent: false,
328
- });
329
- this.#ref.detectChanges();
614
+ this.isFocused.set(false);
615
+ if (!this.addOnBlur())
616
+ this.#setInputText('');
330
617
  }
331
618
  }, 150);
332
619
  };
333
620
  #onClick = () => {
334
621
  if (this.sdViewDef()?.templateRef) {
335
- if (!this.#formControl.disabled && !this.isFocused) {
622
+ if (!this.#formControl.disabled && !this.isFocused()) {
336
623
  this.#focus();
337
624
  }
338
625
  }
339
626
  };
340
627
  #focus = () => {
341
- this.isFocused = true;
628
+ this.isFocused.set(true);
342
629
  this.#isBlurring = false;
343
630
  // why: vẫn 100ms như cũ — chỉ scope handle theo DestroyRef.
344
631
  this.#timers.schedule(() => {
345
- if (this.isFocused) {
632
+ if (this.isFocused()) {
346
633
  this.input()?.nativeElement?.focus();
347
634
  }
348
635
  }, 100);
349
636
  };
637
+ /** Removes every chip `removable` allows; locked chips stay. One change, none when nothing goes (B6). */
350
638
  #clear = ($event) => {
351
639
  $event?.stopPropagation();
352
- this.#inputControl.setValue('');
353
- this.#formControl.setValue([]);
354
- this.model.set(this.#formControl.value);
355
- this.sdChange.emit(this.#formControl.value);
356
- this.#ref.detectChanges();
640
+ this.#setInputText('');
641
+ this.inputError.set(null);
642
+ const values = this.#currentValues();
643
+ const kept = values.filter(value => !this.isRemovable(value));
644
+ if (kept.length !== values.length)
645
+ this.#commit(kept);
646
+ // why: nút vừa bấm ẩn đi (visibility) khi không còn chip nào bỏ được, nên focus trên nó sẽ mất; đưa về ô nhập.
647
+ if ($event)
648
+ this.#focus();
649
+ this.#ref.markForCheck();
357
650
  };
358
651
  // Public method to expose private methods for template
359
652
  onAdd = (event) => this.#add(event);
360
653
  onClickChip = (event, item) => this.#clickChip(event, item);
361
654
  onRemove = (item) => this.#remove(item);
362
- onSelect = (event) => this.#select(event);
363
655
  onFocus = () => this.#onFocus();
364
656
  onBlur = () => this.#onBlur();
365
657
  onClick = () => this.#onClick();
658
+ /**
659
+ * why: khi `sdViewDef` đang hiển thị thì bên trong không còn phần tử nào focus được, nên phần tử view là lối vào
660
+ * duy nhất để chuyển sang chế độ sửa. Bàn phím phải mở được y hệt chuột → Enter/Space chạy chung handler;
661
+ * preventDefault chặn Space cuộn trang (A7).
662
+ */
663
+ onViewKeydown = (event) => {
664
+ event.preventDefault();
665
+ this.#onClick();
666
+ };
366
667
  focus = () => this.#focus();
367
668
  onClear = ($event) => this.#clear($event);
368
669
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdChip, deps: [], target: i0.ɵɵFactoryTarget.Component });
369
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SdChip, isStandalone: true, selector: "sd-chip", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, labelPlacement: { classPropertyName: "labelPlacement", publicName: "labelPlacement", isSignal: true, isRequired: false, transformFunction: null }, floatLabel: { classPropertyName: "floatLabel", publicName: "floatLabel", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, removable: { classPropertyName: "removable", publicName: "removable", isSignal: true, isRequired: false, transformFunction: null }, hideInlineError: { classPropertyName: "hideInlineError", publicName: "hideInlineError", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, addable: { classPropertyName: "addable", publicName: "addable", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, viewed: { classPropertyName: "viewed", publicName: "viewed", isSignal: true, isRequired: false, transformFunction: null }, hyperlink: { classPropertyName: "hyperlink", publicName: "hyperlink", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { model: "modelChange", sdChange: "sdChange" }, host: { properties: { "class.sd-has-label": "!!label()", "class.sd-viewed": "isViewed()", "class.sd-label-top": "labelPlacement() === 'top'" } }, queries: [{ propertyName: "sdViewDef", first: true, predicate: SdViewDefDirective, descendants: true, isSignal: true }, { propertyName: "sdLabelDef", first: true, predicate: SdLabelDefDirective, descendants: true, isSignal: true }, { propertyName: "sdLabelTemplate", first: true, predicate: ["sdLabel"], descendants: true, isSignal: true }, { propertyName: "sdValueTemplate", first: true, predicate: ["sdValue"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _label = label();\r\n@let _appearance = appearance();\r\n@let _required = required();\r\n@let _isViewed = isViewed();\r\n@let _hideInlineError = hideInlineError();\r\n@let _sdViewDef = sdViewDef();\r\n@let _labelTemplate = (sdLabelTemplate() ?? sdLabelDef()?.templateRef) || undefined;\r\n@let _valueTemplate = (sdValueTemplate() ?? _sdViewDef?.templateRef) || undefined;\r\n@let _errorMessage = errorMessage();\r\n@let _size = size();\r\n@let _removable = removable();\r\n@let _labelTop = labelPlacement() === 'top';\r\n\r\n@if (_isViewed) {\r\n <sd-view\r\n [label]=\"_label\"\r\n [labelTemplate]=\"_labelTemplate\"\r\n [value]=\"formControl.value\"\r\n [display]=\"formControl.value\"\r\n [hyperlink]=\"hyperlink()\"\r\n [valueTemplate]=\"_valueTemplate\">\r\n </sd-view>\r\n} @else {\r\n @if ((!_appearance || _labelTop) && _labelTemplate) {\r\n <ng-container *ngTemplateOutlet=\"_labelTemplate\"></ng-container>\r\n }\r\n @if ((!_appearance || _labelTop) && _label && !_labelTemplate) {\r\n <sd-label [label]=\"_label\" [required]=\"_required\" [for]=\"_labelTop ? inputId : null\"></sd-label>\r\n }\r\n\r\n <div\r\n class=\"d-flex align-items-center\"\r\n [class.sd-view]=\"!!_sdViewDef?.templateRef\"\r\n [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\"\r\n (keydown.enter)=\"onClick()\"\r\n tabindex=\"0\"\r\n (click)=\"onClick()\">\r\n @if (_sdViewDef?.templateRef && !isFocused) {\r\n <ng-container *ngTemplateOutlet=\"_sdViewDef!.templateRef; context: { value: formControl.value }\"></ng-container>\r\n } @else {\r\n <mat-form-field\r\n [class.sd-md]=\"_size === 'md'\"\r\n [class.sd-sm]=\"_size === 'sm'\"\r\n [class.hide-inline-error]=\"_hideInlineError\"\r\n [class.sd-label-top]=\"_labelTop\"\r\n [appearance]=\"_appearance\"\r\n [floatLabel]=\"floatLabel()\">\r\n @if (_appearance && _label && !_labelTop) {\r\n <mat-label>{{ _label }}</mat-label>\r\n }\r\n <mat-chip-grid [formControl]=\"formControl\" #chipList [class.sd-md]=\"_size === 'md'\" [class.sd-sm]=\"_size === 'sm'\">\r\n @for (item of formControl.value; track $index) {\r\n @if (item) {\r\n <mat-chip-row\r\n [class.sd-md]=\"_size === 'md'\"\r\n [class.sd-sm]=\"_size === 'sm'\"\r\n [removable]=\"_removable\"\r\n (removed)=\"onRemove(item)\"\r\n [disabled]=\"inputControl.disabled\"\r\n (click)=\"onClickChip($event, item)\">\r\n <span>{{ item }}</span>\r\n @if (!inputControl.disabled && item | sdRemovableChip: _removable) {\r\n <sd-icon matChipRemove name=\"cancel\"></sd-icon>\r\n }\r\n </mat-chip-row>\r\n }\r\n }\r\n <input\r\n class=\"sd-chip-input\"\r\n [formControl]=\"inputControl\"\r\n [id]=\"inputId\"\r\n [placeholder]=\"placeholder() || (_labelTop ? '' : _label)\"\r\n [matChipInputFor]=\"chipList\"\r\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\r\n (matChipInputTokenEnd)=\"onAdd($event)\"\r\n autocomplete=\"off\"\r\n [errorStateMatcher]=\"matcher\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [required]=\"_required\"\r\n matInput\r\n [attr.data-autoId]=\"autoId()\"\r\n [attr.data-disabled]=\"dataDisabled()\"\r\n [attr.data-empty]=\"dataEmpty()\"\r\n [attr.data-value]=\"dataValue()\"\r\n [attr.data-count]=\"dataCount()\"\r\n [attr.data-required]=\"dataRequired()\"\r\n [attr.data-error-message]=\"dataErrorMessage()\"\r\n #input />\r\n </mat-chip-grid>\r\n @if (_hideInlineError && _errorMessage && formControl.touched) {\r\n <sd-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\n }\r\n @if (_hideInlineError && _errorMessage && formControl.touched) {\r\n <span class=\"sd-visually-hidden\" matSuffix>{{ _errorMessage }}</span>\r\r\n }\r\n\r\n @if (!_hideInlineError && _errorMessage && formControl.touched) {\r\n <mat-error>{{ _errorMessage }}</mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n </div>\r\n}\r\n", styles: [":host{display:block}:host(.sd-has-label){padding-top:4px}:host(.sd-label-top){padding-top:0}:host(.sd-viewed){padding-top:0}.sd-chip-input{margin-top:0!important}:host ::ng-deep .mat-mdc-form-field.no-padding-wrapper .mat-mdc-text-field-wrapper{padding-bottom:0}:host ::ng-deep mat-form-field.c-md .mat-mdc-standard-chip{padding:7px 10px;min-height:26px}:host ::ng-deep mat-form-field.c-md .mat-mdc-standard-chip .mat-mdc-chip-trailing-icon{padding:7px 7px 7px 10px}:host ::ng-deep .mat-mdc-chip-row.sd-sm{--mdc-chip-label-text-size: 12px;--mdc-chip-container-height: 20px}:host ::ng-deep .mat-mdc-chip-set.sd-md{margin-top:10px}:host ::ng-deep .mat-mdc-chip-set.sd-sm{margin-top:2px}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:var(--sd-chip-bg, #ebecf0)}\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: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "ngmodule", type: MatAutocompleteModule }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i5.MatChipGrid, selector: "mat-chip-grid", inputs: ["disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "directive", type: i5.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: i5.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i5.MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["editable"], outputs: ["edited"] }, { kind: "component", type: SdLabel, selector: "sd-label", inputs: ["label", "description", "required", "helperText", "for", "labelId"] }, { kind: "component", type: SdView, selector: "sd-view", inputs: ["label", "value", "display", "hyperlink", "labelTemplate", "valueTemplate", "selectedItems"] }, { kind: "pipe", type: SdRemovableChipPipe, name: "sdRemovableChip" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
670
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SdChip, isStandalone: true, selector: "sd-chip", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, labelPlacement: { classPropertyName: "labelPlacement", publicName: "labelPlacement", isSignal: true, isRequired: false, transformFunction: null }, floatLabel: { classPropertyName: "floatLabel", publicName: "floatLabel", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, removable: { classPropertyName: "removable", publicName: "removable", isSignal: true, isRequired: false, transformFunction: null }, hideInlineError: { classPropertyName: "hideInlineError", publicName: "hideInlineError", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, minCount: { classPropertyName: "minCount", publicName: "minCount", isSignal: true, isRequired: false, transformFunction: null }, maxCount: { classPropertyName: "maxCount", publicName: "maxCount", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, addable: { classPropertyName: "addable", publicName: "addable", isSignal: true, isRequired: false, transformFunction: null }, addOnBlur: { classPropertyName: "addOnBlur", publicName: "addOnBlur", isSignal: true, isRequired: false, transformFunction: null }, separators: { classPropertyName: "separators", publicName: "separators", isSignal: true, isRequired: false, transformFunction: null }, chipTransform: { classPropertyName: "chipTransform", publicName: "chipTransform", isSignal: true, isRequired: false, transformFunction: null }, chipValidator: { classPropertyName: "chipValidator", publicName: "chipValidator", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, maxVisible: { classPropertyName: "maxVisible", publicName: "maxVisible", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, viewed: { classPropertyName: "viewed", publicName: "viewed", isSignal: true, isRequired: false, transformFunction: null }, hyperlink: { classPropertyName: "hyperlink", publicName: "hyperlink", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { model: "modelChange", sdChange: "sdChange" }, host: { listeners: { "focusin": "onFocusIn($event)", "focusout": "onFocusOut($event)" }, properties: { "class.sd-has-label": "!!label()", "class.sd-viewed": "isViewed()", "class.sd-label-top": "labelPlacement() === 'top'" } }, queries: [{ propertyName: "sdViewDef", first: true, predicate: SdViewDefDirective, descendants: true, isSignal: true }, { propertyName: "sdLabelDef", first: true, predicate: SdLabelDefDirective, descendants: true, isSignal: true }, { propertyName: "sdLabelTemplate", first: true, predicate: ["sdLabel"], descendants: true, isSignal: true }, { propertyName: "sdValueTemplate", first: true, predicate: ["sdValue"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true, isSignal: true }, { propertyName: "chipGrid", first: true, predicate: MatChipGrid, descendants: true, isSignal: true }, { propertyName: "chipTextElements", predicate: ["chipTextEl"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _label = label();\r\n@let _appearance = appearance();\r\n@let _required = required();\r\n@let _isViewed = isViewed();\r\n@let _hideInlineError = hideInlineError();\r\n@let _sdViewDef = sdViewDef();\r\n@let _labelTemplate = (sdLabelTemplate() ?? sdLabelDef()?.templateRef) || undefined;\r\n@let _valueTemplate = (sdValueTemplate() ?? _sdViewDef?.templateRef) || undefined;\r\n@let _errorMessage = errorText();\r\n@let _size = size();\r\n@let _labelTop = labelPlacement() === 'top';\r\n@let _icons = iconSizes();\r\n<!-- why: m\u1ED9t c\u1ED5ng duy nh\u1EA5t cho <mat-error>, ch\u1EEF l\u1ED7i \u1EA9n v\u00E0 aria-invalid (A5). -->\r\n@let _errorVisible = isErrorShown();\r\n@let _viewTemplate = _sdViewDef?.templateRef;\r\n\r\n@if (_isViewed) {\r\n <sd-view\r\n [label]=\"_label\"\r\n [labelTemplate]=\"_labelTemplate\"\r\n [value]=\"formControl.value\"\r\n [display]=\"formControl.value\"\r\n [hyperlink]=\"hyperlink()\"\r\n [valueTemplate]=\"_valueTemplate\">\r\n </sd-view>\r\n} @else {\r\n <!-- why: nh\u00E3n r\u1EDDi (`labelPlacement=\"top\"`) l\u00E0 ch\u1ED7 duy nh\u1EA5t d\u00F9ng `#sdLabel` / `sdLabelDef` khi s\u1EEDa, nh\u01B0 sd-date v\u00E0\r\n sd-select; nh\u00E3n n\u1ED5i l\u00E0 <mat-label> ch\u1EEF (D1). -->\r\n @if (_labelTop && _labelTemplate) {\r\n <ng-container *ngTemplateOutlet=\"_labelTemplate\"></ng-container>\r\n }\r\n @if (_labelTop && _label && !_labelTemplate) {\r\n <sd-label [label]=\"_label\" [required]=\"_required\" [for]=\"_labelTop ? inputId : null\"></sd-label>\r\n }\r\n\r\n <!-- why: div ch\u1EC9 l\u00E0 h\u1ED9p layout: kh\u00F4ng role, kh\u00F4ng t\u00EAn, kh\u00F4ng n\u1EB1m trong th\u1EE9 t\u1EF1 Tab (A7). Khi sdViewDef \u0111ang hi\u1EC3n th\u1ECB\r\n th\u00EC b\u00EAn trong kh\u00F4ng c\u00F3 ph\u1EA7n t\u1EED focus \u0111\u01B0\u1EE3c n\u00E0o, n\u00EAn ch\u00EDnh ph\u1EA7n t\u1EED view nh\u1EADn role=\"button\" + tabindex=\"0\" +\r\n Enter/Space; disabled th\u00EC r\u00FAt kh\u1ECFi th\u1EE9 t\u1EF1 Tab. -->\r\n <div\r\n class=\"d-flex align-items-center\"\r\n [class.sd-view]=\"!!_viewTemplate\"\r\n [class.c-focused]=\"isFocused()\"\r\n [class.c-disabled]=\"formControl.disabled\">\r\n @if (_viewTemplate && !isFocused()) {\r\n <!-- why: KH\u00D4NG \u0111\u1EB7t aria-label \u2014 n\u1ED9i dung sdViewDef ch\u00EDnh l\u00E0 nh\u00E3n nh\u00ECn th\u1EA5y \u0111\u01B0\u1EE3c. -->\r\n <div\r\n class=\"sd-chip__view-trigger\"\r\n role=\"button\"\r\n [attr.tabindex]=\"formControl.disabled ? null : 0\"\r\n [attr.aria-disabled]=\"formControl.disabled ? 'true' : null\"\r\n (click)=\"onClick()\"\r\n (keydown.enter)=\"onViewKeydown($event)\"\r\n (keydown.space)=\"onViewKeydown($event)\">\r\n <ng-container *ngTemplateOutlet=\"_viewTemplate; context: { value: formControl.value }\"></ng-container>\r\n </div>\r\n } @else {\r\n <!-- why: `.sd-chip-field` nh\u1EADn mixin sd-chip-row() c\u1EE7a core/form.scss \u2014 thang chip, chip kho\u00E1, \u201C+N\u201D, n\u00FAt b\u1ECF h\u1EBFt d\u00F9ng\r\n chung v\u1EDBi sd-chip-calendar (C1, C2). -->\r\n <mat-form-field\r\n class=\"sd-chip-field\"\r\n [class.sd-md]=\"_size === 'md'\"\r\n [class.sd-sm]=\"_size === 'sm'\"\r\n [class.sd-lg]=\"_size === 'lg'\"\r\n [class.sd-chip-field--folded]=\"hiddenCount() > 0\"\r\n [class.hide-inline-error]=\"_hideInlineError\"\r\n [class.sd-label-top]=\"_labelTop\"\r\n [appearance]=\"_appearance\"\r\n [floatLabel]=\"floatLabel()\">\r\n @if (_label && !_labelTop) {\r\n <mat-label>{{ _label }}</mat-label>\r\n }\r\n <!-- why: grid n\u1ED1i `gridControl` ri\u00EAng, kh\u00F4ng ph\u1EA3i `formControl`: l\u00E0 ControlValueAccessor, khi blur n\u00F3 ghi text c\u1EE7a\r\n c\u00E1c chip \u0111ang render v\u00E0o control (s\u1ED1 th\u00E0nh chu\u1ED7i, reset b\u1ECB \u0111\u00E8 l\u1EA1i). V\u1EABn c\u1EA7n m\u1ED9t ngControl \u0111\u1EC3 grid t\u1EF1 t\u00EDnh\r\n errorState m\u1ED7i l\u1EA7n check; matcher c\u1EE7a sd-chip quy\u1EBFt \u0111\u1ECBnh vi\u1EC1n \u0111\u1ECF (A5). `required` g\u00E1n trong component, xem\r\n `chipGrid`. -->\r\n <mat-chip-grid [formControl]=\"gridControl\" #chipList [errorStateMatcher]=\"matcher\">\r\n <!-- why: chips() gi\u1EEF c\u1EA3 0 v\u00E0 track theo gi\u00E1 tr\u1ECB, n\u00EAn xo\u00E1 m\u1ED9t chip kh\u00F4ng d\u1EF1ng l\u1EA1i c\u00E1c chip sau n\u00F3 (A2).\r\n `[removable]` nh\u1EADn boolean c\u1EE7a t\u1EEBng chip: predicate truy\u1EC1n th\u1EB3ng lu\u00F4n truthy v\u00E0 Backspace / Delete v\u1EABn\r\n xo\u00E1 chip kho\u00E1 (A1). Khi kh\u00F4ng focus ch\u1EC9 hi\u1EC7n `maxVisible` chip, ph\u1EA7n d\u01B0 g\u1ED9p v\u00E0o \u201C+N\u201D (B7). Chip kho\u00E1 c\u00F3 n\u1EC1n\r\n ri\u00EAng, icon kho\u00E1 v\u00E0 t\u00EAn n\u1ED1i \u201C, kh\u00F4ng xo\u00E1 \u0111\u01B0\u1EE3c\u201D (C3). -->\r\n @for (item of visibleChips(); track item) {\r\n @let _removable = isRemovable(item);\r\n @let _text = chipText(item);\r\n <mat-chip-row\r\n class=\"sd-chip__chip\"\r\n [class.sd-chip__chip--locked]=\"!_removable\"\r\n [class.sd-chip__chip--duplicate]=\"duplicateChip() === item\"\r\n [removable]=\"_removable\"\r\n [aria-label]=\"chipLabel(item)\"\r\n (removed)=\"onRemove(item)\"\r\n (keydown)=\"onChipKeydown($event, item)\"\r\n [disabled]=\"inputControl.disabled\"\r\n (click)=\"onClickChip($event, item)\">\r\n <span\r\n #chipTextEl\r\n class=\"sd-chip__chip-text\"\r\n [attr.data-chip]=\"_text\"\r\n [matTooltip]=\"_text\"\r\n [matTooltipDisabled]=\"!truncatedChips().has(_text)\"\r\n >{{ item }}</span\r\n >\r\n <!-- why: m\u1ED7i kh\u1ED1i @if m\u1ED9t ph\u1EA7n t\u1EED g\u1ED1c, \u0111\u1EC3 \u2715 \u0111\u01B0\u1EE3c chi\u1EBFu v\u00E0o \u00F4 trailing c\u1EE7a mat-chip-row ([matChipRemove]). -->\r\n @if (!inputControl.disabled && _removable) {\r\n <sd-icon matChipRemove name=\"close\" [size]=\"_icons.chip\" [ariaLabel]=\"removeLabel(item)\"></sd-icon>\r\n }\r\n @if (!inputControl.disabled && !_removable) {\r\n <sd-icon class=\"sd-chip__lock\" name=\"lock\" [size]=\"_icons.chip\" [matTooltip]=\"lockedLabel()\"></sd-icon>\r\n }\r\n </mat-chip-row>\r\n }\r\n @if (hiddenCount() > 0) {\r\n <button\r\n type=\"button\"\r\n class=\"sd-chip__more\"\r\n [attr.aria-label]=\"moreLabel()\"\r\n [attr.data-autoid]=\"autoId() ? autoId() + '-more' : null\"\r\n (click)=\"onMoreClick($event)\">\r\n +{{ hiddenCount() }}\r\n </button>\r\n }\r\n <!-- why: ph\u00EDm t\u00E1ch so theo `KeyboardEvent.key` trong onInputKeydown (keyCode c\u1EE7a `;` kh\u00E1c nhau theo b\u1ED1 c\u1EE5c b\u00E0n ph\u00EDm),\r\n n\u00EAn Material kh\u00F4ng nh\u1EADn ph\u00EDm n\u00E0o; n\u00F3 ch\u1EC9 c\u00F2n ph\u00E1t matChipInputTokenEnd khi blur (`addOnBlur`). `addable` false\r\n v\u1EABn gi\u1EEF \u00F4 nh\u1EADp v\u00EC mat-chip-grid c\u1EA7n matChipInputFor, nh\u01B0ng ch\u1EC9 \u0111\u1ECDc v\u00E0 ra kh\u1ECFi th\u1EE9 t\u1EF1 Tab. -->\r\n <input\r\n class=\"sd-chip-input\"\r\n [formControl]=\"inputControl\"\r\n [id]=\"inputId\"\r\n [placeholder]=\"effectivePlaceholder()\"\r\n [readonly]=\"!addable()\"\r\n [attr.tabindex]=\"addable() ? null : -1\"\r\n [matChipInputFor]=\"chipList\"\r\n [matChipInputSeparatorKeyCodes]=\"noSeparatorKeys\"\r\n [matChipInputAddOnBlur]=\"addOnBlur()\"\r\n (matChipInputTokenEnd)=\"onAdd($event)\"\r\n (keydown)=\"onInputKeydown($event)\"\r\n (input)=\"onInputText()\"\r\n (paste)=\"onPaste($event)\"\r\n autocomplete=\"off\"\r\n [errorStateMatcher]=\"matcher\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [required]=\"_required\"\r\n matInput\r\n [attr.data-autoId]=\"autoId()\"\r\n [attr.data-disabled]=\"dataDisabled()\"\r\n [attr.data-empty]=\"dataEmpty()\"\r\n [attr.data-value]=\"dataValue()\"\r\n [attr.data-count]=\"dataCount()\"\r\n [attr.data-required]=\"dataRequired()\"\r\n [attr.data-error-message]=\"dataErrorMessage()\"\r\n [attr.aria-invalid]=\"_errorVisible ? 'true' : 'false'\"\r\n [attr.aria-describedby]=\"_hideInlineError && _errorVisible ? errorId : null\"\r\n #input />\r\n </mat-chip-grid>\r\n <!-- why: icon v\u00E0 ch\u1EEF l\u1ED7i \u1EA9n chung m\u1ED9t ph\u1EA7n t\u1EED g\u1ED1c matSuffix, n\u00EAn m\u1ED9t kh\u1ED1i @if \u0111\u1EE7 cho c\u1EA3 hai v\u00E0 v\u1EABn \u0111\u01B0\u1EE3c chi\u1EBFu\r\n v\u00E0o v\u00F9ng suffix. Ch\u1EEF \u1EA9n c\u00F3 id \u0111\u1EC3 \u00F4 nh\u1EADp tr\u1ECF aria-describedby sang (A8); v\u1EDBi <mat-error> th\u00EC\r\n mat-form-field t\u1EF1 n\u1ED1i. -->\r\n @if (_hideInlineError && _errorVisible) {\r\n <span matSuffix class=\"sd-chip__error-suffix\">\r\n <sd-icon class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\r\n <span class=\"sd-visually-hidden\" [id]=\"errorId\">{{ _errorMessage }}</span>\r\n </span>\r\n }\r\n <!-- why: n\u00FAt b\u1ECF h\u1EBFt nh\u01B0 `.sd-clear-btn` c\u1EE7a sd-date (hi\u1EC7n khi hover / focus-within). Lu\u00F4n gi\u1EEF ch\u1ED7: khi kh\u00F4ng c\u00F2n chip\r\n n\u00E0o b\u1ECF \u0111\u01B0\u1EE3c th\u00EC ch\u1EC9 \u1EA9n b\u1EB1ng visibility, kh\u00F4ng g\u1EE1 kh\u1ECFi DOM, \u0111\u1EC3 field kh\u00F4ng nh\u1EA3y (B6). -->\r\n @if (clearable() && !formControl.disabled && !_required) {\r\n @let _canClear = hasRemovable();\r\n <button\r\n type=\"button\"\r\n matSuffix\r\n class=\"sd-clear-btn sd-chip__clear sd-chip__suffix\"\r\n [class.sd-hover]=\"_canClear\"\r\n [class.sd-chip__clear--empty]=\"!_canClear\"\r\n [attr.aria-label]=\"clearLabel()\"\r\n [attr.data-autoid]=\"autoId() ? autoId() + '-clear' : null\"\r\n (click)=\"onClear($event)\">\r\n <sd-icon name=\"close\" [size]=\"_icons.clear\"></sd-icon>\r\n </button>\r\n }\r\n\r\n @if (!_hideInlineError && _errorVisible) {\r\n <mat-error [id]=\"errorId\">{{ _errorMessage }}</mat-error>\r\n }\r\n @if (effectiveMaxCount() > 0) {\r\n <mat-hint align=\"end\" class=\"sd-chip__counter\" [class.sd-chip__counter--full]=\"full()\">\r\n {{ chips().length }}/{{ effectiveMaxCount() }}\r\n </mat-hint>\r\n }\r\n </mat-form-field>\r\n }\r\n </div>\r\n <!-- why: v\u00F9ng live lu\u00F4n c\u00F3 m\u1EB7t \u0111\u1EC3 screen reader \u0111\u1ECDc \u201C\u0111\u00E3 c\u00F3\u201D, \u201C\u0111\u00E3 \u0111\u1EE7\u201D, k\u1EBFt qu\u1EA3 d\u00E1n v\u00E0 \u201Ckh\u00F4ng xo\u00E1 \u0111\u01B0\u1EE3c\u201D ngay khi ch\u00FAng\r\n xu\u1EA5t hi\u1EC7n (B2, B3); id m\u1EDBi d\u1EF1ng l\u1EA1i ch\u1EEF \u0111\u1EC3 c\u00E2u l\u1EB7p l\u1EA1i v\u1EABn \u0111\u01B0\u1EE3c \u0111\u1ECDc. -->\r\n @let _live = liveMessage();\r\n <span class=\"sd-visually-hidden sd-chip__live\" aria-live=\"polite\">\r\n @for (message of _live ? [_live] : []; track message.id) {\r\n <span>{{ message.text }}</span>\r\n }\r\n </span>\r\n}\r\n", styles: [":host{display:block}:host(.sd-has-label){padding-top:4px}:host(.sd-label-top){padding-top:0}:host(.sd-viewed){padding-top:0}.sd-chip__chip-text{display:block;min-width:0;max-width:240px;overflow:hidden;text-overflow:ellipsis}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:var(--sd-chip-bg)}.sd-chip__view-trigger{display:flex;align-items:center;width:100%;cursor:pointer}.sd-chip__view-trigger:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px}.sd-chip__view-trigger[aria-disabled=true]{cursor:default}.sd-chip__error-suffix{display:inline-flex;align-items:center}.sd-chip__clear--empty{visibility:hidden}@media(pointer:coarse){.sd-chip__clear.sd-hover{visibility:visible}}.sd-chip__counter--full{color:var(--sd-warning)}\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: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i5.MatChipGrid, selector: "mat-chip-grid", inputs: ["disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "directive", type: i5.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: i5.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i5.MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["editable"], outputs: ["edited"] }, { kind: "component", type: SdLabel, selector: "sd-label", inputs: ["label", "description", "required", "helperText", "for", "labelId"] }, { kind: "component", type: SdView, selector: "sd-view", inputs: ["label", "value", "display", "hyperlink", "labelTemplate", "valueTemplate", "selectedItems"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
370
671
  }
371
672
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdChip, decorators: [{
372
673
  type: Component,
@@ -374,6 +675,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
374
675
  '[class.sd-has-label]': '!!label()',
375
676
  '[class.sd-viewed]': 'isViewed()',
376
677
  '[class.sd-label-top]': "labelPlacement() === 'top'",
678
+ '(focusin)': 'onFocusIn($event)',
679
+ '(focusout)': 'onFocusOut($event)',
377
680
  }, imports: [
378
681
  SdIcon,
379
682
  CommonModule,
@@ -382,18 +685,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
382
685
  MatInputModule,
383
686
  MatTooltipModule,
384
687
  MatFormFieldModule,
385
- MatAutocompleteModule,
386
- MatProgressSpinnerModule,
387
688
  MatChipsModule,
388
689
  SdLabel,
389
690
  SdView,
390
- SdRemovableChipPipe,
391
- ], template: "@let _label = label();\r\n@let _appearance = appearance();\r\n@let _required = required();\r\n@let _isViewed = isViewed();\r\n@let _hideInlineError = hideInlineError();\r\n@let _sdViewDef = sdViewDef();\r\n@let _labelTemplate = (sdLabelTemplate() ?? sdLabelDef()?.templateRef) || undefined;\r\n@let _valueTemplate = (sdValueTemplate() ?? _sdViewDef?.templateRef) || undefined;\r\n@let _errorMessage = errorMessage();\r\n@let _size = size();\r\n@let _removable = removable();\r\n@let _labelTop = labelPlacement() === 'top';\r\n\r\n@if (_isViewed) {\r\n <sd-view\r\n [label]=\"_label\"\r\n [labelTemplate]=\"_labelTemplate\"\r\n [value]=\"formControl.value\"\r\n [display]=\"formControl.value\"\r\n [hyperlink]=\"hyperlink()\"\r\n [valueTemplate]=\"_valueTemplate\">\r\n </sd-view>\r\n} @else {\r\n @if ((!_appearance || _labelTop) && _labelTemplate) {\r\n <ng-container *ngTemplateOutlet=\"_labelTemplate\"></ng-container>\r\n }\r\n @if ((!_appearance || _labelTop) && _label && !_labelTemplate) {\r\n <sd-label [label]=\"_label\" [required]=\"_required\" [for]=\"_labelTop ? inputId : null\"></sd-label>\r\n }\r\n\r\n <div\r\n class=\"d-flex align-items-center\"\r\n [class.sd-view]=\"!!_sdViewDef?.templateRef\"\r\n [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\"\r\n (keydown.enter)=\"onClick()\"\r\n tabindex=\"0\"\r\n (click)=\"onClick()\">\r\n @if (_sdViewDef?.templateRef && !isFocused) {\r\n <ng-container *ngTemplateOutlet=\"_sdViewDef!.templateRef; context: { value: formControl.value }\"></ng-container>\r\n } @else {\r\n <mat-form-field\r\n [class.sd-md]=\"_size === 'md'\"\r\n [class.sd-sm]=\"_size === 'sm'\"\r\n [class.hide-inline-error]=\"_hideInlineError\"\r\n [class.sd-label-top]=\"_labelTop\"\r\n [appearance]=\"_appearance\"\r\n [floatLabel]=\"floatLabel()\">\r\n @if (_appearance && _label && !_labelTop) {\r\n <mat-label>{{ _label }}</mat-label>\r\n }\r\n <mat-chip-grid [formControl]=\"formControl\" #chipList [class.sd-md]=\"_size === 'md'\" [class.sd-sm]=\"_size === 'sm'\">\r\n @for (item of formControl.value; track $index) {\r\n @if (item) {\r\n <mat-chip-row\r\n [class.sd-md]=\"_size === 'md'\"\r\n [class.sd-sm]=\"_size === 'sm'\"\r\n [removable]=\"_removable\"\r\n (removed)=\"onRemove(item)\"\r\n [disabled]=\"inputControl.disabled\"\r\n (click)=\"onClickChip($event, item)\">\r\n <span>{{ item }}</span>\r\n @if (!inputControl.disabled && item | sdRemovableChip: _removable) {\r\n <sd-icon matChipRemove name=\"cancel\"></sd-icon>\r\n }\r\n </mat-chip-row>\r\n }\r\n }\r\n <input\r\n class=\"sd-chip-input\"\r\n [formControl]=\"inputControl\"\r\n [id]=\"inputId\"\r\n [placeholder]=\"placeholder() || (_labelTop ? '' : _label)\"\r\n [matChipInputFor]=\"chipList\"\r\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\r\n (matChipInputTokenEnd)=\"onAdd($event)\"\r\n autocomplete=\"off\"\r\n [errorStateMatcher]=\"matcher\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [required]=\"_required\"\r\n matInput\r\n [attr.data-autoId]=\"autoId()\"\r\n [attr.data-disabled]=\"dataDisabled()\"\r\n [attr.data-empty]=\"dataEmpty()\"\r\n [attr.data-value]=\"dataValue()\"\r\n [attr.data-count]=\"dataCount()\"\r\n [attr.data-required]=\"dataRequired()\"\r\n [attr.data-error-message]=\"dataErrorMessage()\"\r\n #input />\r\n </mat-chip-grid>\r\n @if (_hideInlineError && _errorMessage && formControl.touched) {\r\n <sd-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\n }\r\n @if (_hideInlineError && _errorMessage && formControl.touched) {\r\n <span class=\"sd-visually-hidden\" matSuffix>{{ _errorMessage }}</span>\r\r\n }\r\n\r\n @if (!_hideInlineError && _errorMessage && formControl.touched) {\r\n <mat-error>{{ _errorMessage }}</mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n </div>\r\n}\r\n", styles: [":host{display:block}:host(.sd-has-label){padding-top:4px}:host(.sd-label-top){padding-top:0}:host(.sd-viewed){padding-top:0}.sd-chip-input{margin-top:0!important}:host ::ng-deep .mat-mdc-form-field.no-padding-wrapper .mat-mdc-text-field-wrapper{padding-bottom:0}:host ::ng-deep mat-form-field.c-md .mat-mdc-standard-chip{padding:7px 10px;min-height:26px}:host ::ng-deep mat-form-field.c-md .mat-mdc-standard-chip .mat-mdc-chip-trailing-icon{padding:7px 7px 7px 10px}:host ::ng-deep .mat-mdc-chip-row.sd-sm{--mdc-chip-label-text-size: 12px;--mdc-chip-container-height: 20px}:host ::ng-deep .mat-mdc-chip-set.sd-md{margin-top:10px}:host ::ng-deep .mat-mdc-chip-set.sd-sm{margin-top:2px}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:var(--sd-chip-bg, #ebecf0)}\n"] }]
691
+ ], template: "@let _label = label();\r\n@let _appearance = appearance();\r\n@let _required = required();\r\n@let _isViewed = isViewed();\r\n@let _hideInlineError = hideInlineError();\r\n@let _sdViewDef = sdViewDef();\r\n@let _labelTemplate = (sdLabelTemplate() ?? sdLabelDef()?.templateRef) || undefined;\r\n@let _valueTemplate = (sdValueTemplate() ?? _sdViewDef?.templateRef) || undefined;\r\n@let _errorMessage = errorText();\r\n@let _size = size();\r\n@let _labelTop = labelPlacement() === 'top';\r\n@let _icons = iconSizes();\r\n<!-- why: m\u1ED9t c\u1ED5ng duy nh\u1EA5t cho <mat-error>, ch\u1EEF l\u1ED7i \u1EA9n v\u00E0 aria-invalid (A5). -->\r\n@let _errorVisible = isErrorShown();\r\n@let _viewTemplate = _sdViewDef?.templateRef;\r\n\r\n@if (_isViewed) {\r\n <sd-view\r\n [label]=\"_label\"\r\n [labelTemplate]=\"_labelTemplate\"\r\n [value]=\"formControl.value\"\r\n [display]=\"formControl.value\"\r\n [hyperlink]=\"hyperlink()\"\r\n [valueTemplate]=\"_valueTemplate\">\r\n </sd-view>\r\n} @else {\r\n <!-- why: nh\u00E3n r\u1EDDi (`labelPlacement=\"top\"`) l\u00E0 ch\u1ED7 duy nh\u1EA5t d\u00F9ng `#sdLabel` / `sdLabelDef` khi s\u1EEDa, nh\u01B0 sd-date v\u00E0\r\n sd-select; nh\u00E3n n\u1ED5i l\u00E0 <mat-label> ch\u1EEF (D1). -->\r\n @if (_labelTop && _labelTemplate) {\r\n <ng-container *ngTemplateOutlet=\"_labelTemplate\"></ng-container>\r\n }\r\n @if (_labelTop && _label && !_labelTemplate) {\r\n <sd-label [label]=\"_label\" [required]=\"_required\" [for]=\"_labelTop ? inputId : null\"></sd-label>\r\n }\r\n\r\n <!-- why: div ch\u1EC9 l\u00E0 h\u1ED9p layout: kh\u00F4ng role, kh\u00F4ng t\u00EAn, kh\u00F4ng n\u1EB1m trong th\u1EE9 t\u1EF1 Tab (A7). Khi sdViewDef \u0111ang hi\u1EC3n th\u1ECB\r\n th\u00EC b\u00EAn trong kh\u00F4ng c\u00F3 ph\u1EA7n t\u1EED focus \u0111\u01B0\u1EE3c n\u00E0o, n\u00EAn ch\u00EDnh ph\u1EA7n t\u1EED view nh\u1EADn role=\"button\" + tabindex=\"0\" +\r\n Enter/Space; disabled th\u00EC r\u00FAt kh\u1ECFi th\u1EE9 t\u1EF1 Tab. -->\r\n <div\r\n class=\"d-flex align-items-center\"\r\n [class.sd-view]=\"!!_viewTemplate\"\r\n [class.c-focused]=\"isFocused()\"\r\n [class.c-disabled]=\"formControl.disabled\">\r\n @if (_viewTemplate && !isFocused()) {\r\n <!-- why: KH\u00D4NG \u0111\u1EB7t aria-label \u2014 n\u1ED9i dung sdViewDef ch\u00EDnh l\u00E0 nh\u00E3n nh\u00ECn th\u1EA5y \u0111\u01B0\u1EE3c. -->\r\n <div\r\n class=\"sd-chip__view-trigger\"\r\n role=\"button\"\r\n [attr.tabindex]=\"formControl.disabled ? null : 0\"\r\n [attr.aria-disabled]=\"formControl.disabled ? 'true' : null\"\r\n (click)=\"onClick()\"\r\n (keydown.enter)=\"onViewKeydown($event)\"\r\n (keydown.space)=\"onViewKeydown($event)\">\r\n <ng-container *ngTemplateOutlet=\"_viewTemplate; context: { value: formControl.value }\"></ng-container>\r\n </div>\r\n } @else {\r\n <!-- why: `.sd-chip-field` nh\u1EADn mixin sd-chip-row() c\u1EE7a core/form.scss \u2014 thang chip, chip kho\u00E1, \u201C+N\u201D, n\u00FAt b\u1ECF h\u1EBFt d\u00F9ng\r\n chung v\u1EDBi sd-chip-calendar (C1, C2). -->\r\n <mat-form-field\r\n class=\"sd-chip-field\"\r\n [class.sd-md]=\"_size === 'md'\"\r\n [class.sd-sm]=\"_size === 'sm'\"\r\n [class.sd-lg]=\"_size === 'lg'\"\r\n [class.sd-chip-field--folded]=\"hiddenCount() > 0\"\r\n [class.hide-inline-error]=\"_hideInlineError\"\r\n [class.sd-label-top]=\"_labelTop\"\r\n [appearance]=\"_appearance\"\r\n [floatLabel]=\"floatLabel()\">\r\n @if (_label && !_labelTop) {\r\n <mat-label>{{ _label }}</mat-label>\r\n }\r\n <!-- why: grid n\u1ED1i `gridControl` ri\u00EAng, kh\u00F4ng ph\u1EA3i `formControl`: l\u00E0 ControlValueAccessor, khi blur n\u00F3 ghi text c\u1EE7a\r\n c\u00E1c chip \u0111ang render v\u00E0o control (s\u1ED1 th\u00E0nh chu\u1ED7i, reset b\u1ECB \u0111\u00E8 l\u1EA1i). V\u1EABn c\u1EA7n m\u1ED9t ngControl \u0111\u1EC3 grid t\u1EF1 t\u00EDnh\r\n errorState m\u1ED7i l\u1EA7n check; matcher c\u1EE7a sd-chip quy\u1EBFt \u0111\u1ECBnh vi\u1EC1n \u0111\u1ECF (A5). `required` g\u00E1n trong component, xem\r\n `chipGrid`. -->\r\n <mat-chip-grid [formControl]=\"gridControl\" #chipList [errorStateMatcher]=\"matcher\">\r\n <!-- why: chips() gi\u1EEF c\u1EA3 0 v\u00E0 track theo gi\u00E1 tr\u1ECB, n\u00EAn xo\u00E1 m\u1ED9t chip kh\u00F4ng d\u1EF1ng l\u1EA1i c\u00E1c chip sau n\u00F3 (A2).\r\n `[removable]` nh\u1EADn boolean c\u1EE7a t\u1EEBng chip: predicate truy\u1EC1n th\u1EB3ng lu\u00F4n truthy v\u00E0 Backspace / Delete v\u1EABn\r\n xo\u00E1 chip kho\u00E1 (A1). Khi kh\u00F4ng focus ch\u1EC9 hi\u1EC7n `maxVisible` chip, ph\u1EA7n d\u01B0 g\u1ED9p v\u00E0o \u201C+N\u201D (B7). Chip kho\u00E1 c\u00F3 n\u1EC1n\r\n ri\u00EAng, icon kho\u00E1 v\u00E0 t\u00EAn n\u1ED1i \u201C, kh\u00F4ng xo\u00E1 \u0111\u01B0\u1EE3c\u201D (C3). -->\r\n @for (item of visibleChips(); track item) {\r\n @let _removable = isRemovable(item);\r\n @let _text = chipText(item);\r\n <mat-chip-row\r\n class=\"sd-chip__chip\"\r\n [class.sd-chip__chip--locked]=\"!_removable\"\r\n [class.sd-chip__chip--duplicate]=\"duplicateChip() === item\"\r\n [removable]=\"_removable\"\r\n [aria-label]=\"chipLabel(item)\"\r\n (removed)=\"onRemove(item)\"\r\n (keydown)=\"onChipKeydown($event, item)\"\r\n [disabled]=\"inputControl.disabled\"\r\n (click)=\"onClickChip($event, item)\">\r\n <span\r\n #chipTextEl\r\n class=\"sd-chip__chip-text\"\r\n [attr.data-chip]=\"_text\"\r\n [matTooltip]=\"_text\"\r\n [matTooltipDisabled]=\"!truncatedChips().has(_text)\"\r\n >{{ item }}</span\r\n >\r\n <!-- why: m\u1ED7i kh\u1ED1i @if m\u1ED9t ph\u1EA7n t\u1EED g\u1ED1c, \u0111\u1EC3 \u2715 \u0111\u01B0\u1EE3c chi\u1EBFu v\u00E0o \u00F4 trailing c\u1EE7a mat-chip-row ([matChipRemove]). -->\r\n @if (!inputControl.disabled && _removable) {\r\n <sd-icon matChipRemove name=\"close\" [size]=\"_icons.chip\" [ariaLabel]=\"removeLabel(item)\"></sd-icon>\r\n }\r\n @if (!inputControl.disabled && !_removable) {\r\n <sd-icon class=\"sd-chip__lock\" name=\"lock\" [size]=\"_icons.chip\" [matTooltip]=\"lockedLabel()\"></sd-icon>\r\n }\r\n </mat-chip-row>\r\n }\r\n @if (hiddenCount() > 0) {\r\n <button\r\n type=\"button\"\r\n class=\"sd-chip__more\"\r\n [attr.aria-label]=\"moreLabel()\"\r\n [attr.data-autoid]=\"autoId() ? autoId() + '-more' : null\"\r\n (click)=\"onMoreClick($event)\">\r\n +{{ hiddenCount() }}\r\n </button>\r\n }\r\n <!-- why: ph\u00EDm t\u00E1ch so theo `KeyboardEvent.key` trong onInputKeydown (keyCode c\u1EE7a `;` kh\u00E1c nhau theo b\u1ED1 c\u1EE5c b\u00E0n ph\u00EDm),\r\n n\u00EAn Material kh\u00F4ng nh\u1EADn ph\u00EDm n\u00E0o; n\u00F3 ch\u1EC9 c\u00F2n ph\u00E1t matChipInputTokenEnd khi blur (`addOnBlur`). `addable` false\r\n v\u1EABn gi\u1EEF \u00F4 nh\u1EADp v\u00EC mat-chip-grid c\u1EA7n matChipInputFor, nh\u01B0ng ch\u1EC9 \u0111\u1ECDc v\u00E0 ra kh\u1ECFi th\u1EE9 t\u1EF1 Tab. -->\r\n <input\r\n class=\"sd-chip-input\"\r\n [formControl]=\"inputControl\"\r\n [id]=\"inputId\"\r\n [placeholder]=\"effectivePlaceholder()\"\r\n [readonly]=\"!addable()\"\r\n [attr.tabindex]=\"addable() ? null : -1\"\r\n [matChipInputFor]=\"chipList\"\r\n [matChipInputSeparatorKeyCodes]=\"noSeparatorKeys\"\r\n [matChipInputAddOnBlur]=\"addOnBlur()\"\r\n (matChipInputTokenEnd)=\"onAdd($event)\"\r\n (keydown)=\"onInputKeydown($event)\"\r\n (input)=\"onInputText()\"\r\n (paste)=\"onPaste($event)\"\r\n autocomplete=\"off\"\r\n [errorStateMatcher]=\"matcher\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [required]=\"_required\"\r\n matInput\r\n [attr.data-autoId]=\"autoId()\"\r\n [attr.data-disabled]=\"dataDisabled()\"\r\n [attr.data-empty]=\"dataEmpty()\"\r\n [attr.data-value]=\"dataValue()\"\r\n [attr.data-count]=\"dataCount()\"\r\n [attr.data-required]=\"dataRequired()\"\r\n [attr.data-error-message]=\"dataErrorMessage()\"\r\n [attr.aria-invalid]=\"_errorVisible ? 'true' : 'false'\"\r\n [attr.aria-describedby]=\"_hideInlineError && _errorVisible ? errorId : null\"\r\n #input />\r\n </mat-chip-grid>\r\n <!-- why: icon v\u00E0 ch\u1EEF l\u1ED7i \u1EA9n chung m\u1ED9t ph\u1EA7n t\u1EED g\u1ED1c matSuffix, n\u00EAn m\u1ED9t kh\u1ED1i @if \u0111\u1EE7 cho c\u1EA3 hai v\u00E0 v\u1EABn \u0111\u01B0\u1EE3c chi\u1EBFu\r\n v\u00E0o v\u00F9ng suffix. Ch\u1EEF \u1EA9n c\u00F3 id \u0111\u1EC3 \u00F4 nh\u1EADp tr\u1ECF aria-describedby sang (A8); v\u1EDBi <mat-error> th\u00EC\r\n mat-form-field t\u1EF1 n\u1ED1i. -->\r\n @if (_hideInlineError && _errorVisible) {\r\n <span matSuffix class=\"sd-chip__error-suffix\">\r\n <sd-icon class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\r\n <span class=\"sd-visually-hidden\" [id]=\"errorId\">{{ _errorMessage }}</span>\r\n </span>\r\n }\r\n <!-- why: n\u00FAt b\u1ECF h\u1EBFt nh\u01B0 `.sd-clear-btn` c\u1EE7a sd-date (hi\u1EC7n khi hover / focus-within). Lu\u00F4n gi\u1EEF ch\u1ED7: khi kh\u00F4ng c\u00F2n chip\r\n n\u00E0o b\u1ECF \u0111\u01B0\u1EE3c th\u00EC ch\u1EC9 \u1EA9n b\u1EB1ng visibility, kh\u00F4ng g\u1EE1 kh\u1ECFi DOM, \u0111\u1EC3 field kh\u00F4ng nh\u1EA3y (B6). -->\r\n @if (clearable() && !formControl.disabled && !_required) {\r\n @let _canClear = hasRemovable();\r\n <button\r\n type=\"button\"\r\n matSuffix\r\n class=\"sd-clear-btn sd-chip__clear sd-chip__suffix\"\r\n [class.sd-hover]=\"_canClear\"\r\n [class.sd-chip__clear--empty]=\"!_canClear\"\r\n [attr.aria-label]=\"clearLabel()\"\r\n [attr.data-autoid]=\"autoId() ? autoId() + '-clear' : null\"\r\n (click)=\"onClear($event)\">\r\n <sd-icon name=\"close\" [size]=\"_icons.clear\"></sd-icon>\r\n </button>\r\n }\r\n\r\n @if (!_hideInlineError && _errorVisible) {\r\n <mat-error [id]=\"errorId\">{{ _errorMessage }}</mat-error>\r\n }\r\n @if (effectiveMaxCount() > 0) {\r\n <mat-hint align=\"end\" class=\"sd-chip__counter\" [class.sd-chip__counter--full]=\"full()\">\r\n {{ chips().length }}/{{ effectiveMaxCount() }}\r\n </mat-hint>\r\n }\r\n </mat-form-field>\r\n }\r\n </div>\r\n <!-- why: v\u00F9ng live lu\u00F4n c\u00F3 m\u1EB7t \u0111\u1EC3 screen reader \u0111\u1ECDc \u201C\u0111\u00E3 c\u00F3\u201D, \u201C\u0111\u00E3 \u0111\u1EE7\u201D, k\u1EBFt qu\u1EA3 d\u00E1n v\u00E0 \u201Ckh\u00F4ng xo\u00E1 \u0111\u01B0\u1EE3c\u201D ngay khi ch\u00FAng\r\n xu\u1EA5t hi\u1EC7n (B2, B3); id m\u1EDBi d\u1EF1ng l\u1EA1i ch\u1EEF \u0111\u1EC3 c\u00E2u l\u1EB7p l\u1EA1i v\u1EABn \u0111\u01B0\u1EE3c \u0111\u1ECDc. -->\r\n @let _live = liveMessage();\r\n <span class=\"sd-visually-hidden sd-chip__live\" aria-live=\"polite\">\r\n @for (message of _live ? [_live] : []; track message.id) {\r\n <span>{{ message.text }}</span>\r\n }\r\n </span>\r\n}\r\n", styles: [":host{display:block}:host(.sd-has-label){padding-top:4px}:host(.sd-label-top){padding-top:0}:host(.sd-viewed){padding-top:0}.sd-chip__chip-text{display:block;min-width:0;max-width:240px;overflow:hidden;text-overflow:ellipsis}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:var(--sd-chip-bg)}.sd-chip__view-trigger{display:flex;align-items:center;width:100%;cursor:pointer}.sd-chip__view-trigger:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px}.sd-chip__view-trigger[aria-disabled=true]{cursor:default}.sd-chip__error-suffix{display:inline-flex;align-items:center}.sd-chip__clear--empty{visibility:hidden}@media(pointer:coarse){.sd-chip__clear.sd-hover{visibility:visible}}.sd-chip__counter--full{color:var(--sd-warning)}\n"] }]
392
692
  }], ctorParameters: () => [] });
393
693
 
394
694
  /**
395
695
  * Generated bundle index. Do not edit.
396
696
  */
397
697
 
398
- export { SdChip, SdRemovableChipPipe };
698
+ export { SdChip };
399
699
  //# sourceMappingURL=sdcorejs-angular-forms-chip.mjs.map