@sdcorejs/angular 20.3.1 → 20.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (386) hide show
  1. package/assets/STYLE-GUIDE.md +25 -5
  2. package/assets/THEME.md +289 -5
  3. package/assets/licenses/tiptap-oss-NOTICES.txt +332 -0
  4. package/assets/scss/ckeditor5.scss +2 -88
  5. package/assets/scss/core/_control.scss +39 -0
  6. package/assets/scss/core/form.scss +444 -45
  7. package/assets/scss/core/view.scss +24 -0
  8. package/assets/scss/editor-content.scss +173 -0
  9. package/assets/scss/sd-core.scss +1 -0
  10. package/assets/scss/themes/_component-tokens.scss +123 -32
  11. package/assets/scss/themes/_material-tokens.scss +112 -0
  12. package/assets/scss/themes/_presets.scss +25 -0
  13. package/assets/scss/themes/_scales.scss +10 -0
  14. package/assets/scss/themes/_semantic.scss +13 -0
  15. package/assets/scss/themes/default.scss +8 -2
  16. package/components/avatar/index.d.ts +67 -2
  17. package/components/badge/index.d.ts +206 -6
  18. package/components/button/index.d.ts +20 -1
  19. package/components/ckeditor-styles/index.d.ts +3 -18
  20. package/components/editor/index.d.ts +20 -17
  21. package/components/editor-engine/index.d.ts +246 -0
  22. package/components/file-explorer/index.d.ts +4 -2
  23. package/components/form-generic/index.d.ts +246 -35
  24. package/components/index.d.ts +1 -0
  25. package/components/mini-editor/index.d.ts +33 -70
  26. package/components/modal-resizable/index.d.ts +1 -124
  27. package/components/operator/index.d.ts +137 -8
  28. package/components/section/index.d.ts +13 -1
  29. package/components/splitter/index.d.ts +1 -1
  30. package/components/tab-router/index.d.ts +74 -19
  31. package/components/table/index.d.ts +210 -18
  32. package/components/upload-file/index.d.ts +181 -21
  33. package/components/window/index.d.ts +81 -0
  34. package/configurations/index.d.ts +8 -1
  35. package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs +5 -5
  36. package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs.map +1 -1
  37. package/fesm2022/sdcorejs-angular-components-avatar.mjs +142 -11
  38. package/fesm2022/sdcorejs-angular-components-avatar.mjs.map +1 -1
  39. package/fesm2022/sdcorejs-angular-components-badge.mjs +548 -24
  40. package/fesm2022/sdcorejs-angular-components-badge.mjs.map +1 -1
  41. package/fesm2022/sdcorejs-angular-components-button.mjs +33 -3
  42. package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
  43. package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs +5 -20
  44. package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs.map +1 -1
  45. package/fesm2022/sdcorejs-angular-components-data-state.mjs +1 -1
  46. package/fesm2022/sdcorejs-angular-components-data-state.mjs.map +1 -1
  47. package/fesm2022/sdcorejs-angular-components-editor-engine.mjs +1872 -0
  48. package/fesm2022/sdcorejs-angular-components-editor-engine.mjs.map +1 -0
  49. package/fesm2022/sdcorejs-angular-components-editor.mjs +457 -756
  50. package/fesm2022/sdcorejs-angular-components-editor.mjs.map +1 -1
  51. package/fesm2022/sdcorejs-angular-components-file-explorer.mjs +68 -37
  52. package/fesm2022/sdcorejs-angular-components-file-explorer.mjs.map +1 -1
  53. package/fesm2022/sdcorejs-angular-components-form-generic.mjs +2118 -1159
  54. package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
  55. package/fesm2022/sdcorejs-angular-components-history.mjs +5 -2
  56. package/fesm2022/sdcorejs-angular-components-history.mjs.map +1 -1
  57. package/fesm2022/sdcorejs-angular-components-image-editor.mjs +1 -1
  58. package/fesm2022/sdcorejs-angular-components-image-editor.mjs.map +1 -1
  59. package/fesm2022/sdcorejs-angular-components-import-excel.mjs +21 -6
  60. package/fesm2022/sdcorejs-angular-components-import-excel.mjs.map +1 -1
  61. package/fesm2022/sdcorejs-angular-components-inform.mjs +1 -1
  62. package/fesm2022/sdcorejs-angular-components-inform.mjs.map +1 -1
  63. package/fesm2022/sdcorejs-angular-components-kanban.mjs +12 -2
  64. package/fesm2022/sdcorejs-angular-components-kanban.mjs.map +1 -1
  65. package/fesm2022/sdcorejs-angular-components-mini-editor.mjs +177 -283
  66. package/fesm2022/sdcorejs-angular-components-mini-editor.mjs.map +1 -1
  67. package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs +1 -308
  68. package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs.map +1 -1
  69. package/fesm2022/sdcorejs-angular-components-modal.mjs +2 -2
  70. package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
  71. package/fesm2022/sdcorejs-angular-components-operator.mjs +262 -43
  72. package/fesm2022/sdcorejs-angular-components-operator.mjs.map +1 -1
  73. package/fesm2022/sdcorejs-angular-components-query-bar.mjs +12 -12
  74. package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
  75. package/fesm2022/sdcorejs-angular-components-query-builder.mjs +1 -1
  76. package/fesm2022/sdcorejs-angular-components-query-builder.mjs.map +1 -1
  77. package/fesm2022/sdcorejs-angular-components-section.mjs +17 -5
  78. package/fesm2022/sdcorejs-angular-components-section.mjs.map +1 -1
  79. package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +2 -2
  80. package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
  81. package/fesm2022/sdcorejs-angular-components-splitter.mjs.map +1 -1
  82. package/fesm2022/sdcorejs-angular-components-tab-router.mjs +559 -94
  83. package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
  84. package/fesm2022/sdcorejs-angular-components-table.mjs +1001 -119
  85. package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
  86. package/fesm2022/sdcorejs-angular-components-tree.mjs +1 -1
  87. package/fesm2022/sdcorejs-angular-components-tree.mjs.map +1 -1
  88. package/fesm2022/sdcorejs-angular-components-upload-file.mjs +887 -174
  89. package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
  90. package/fesm2022/sdcorejs-angular-components-view.mjs +2 -2
  91. package/fesm2022/sdcorejs-angular-components-view.mjs.map +1 -1
  92. package/fesm2022/sdcorejs-angular-components-window.mjs +486 -0
  93. package/fesm2022/sdcorejs-angular-components-window.mjs.map +1 -0
  94. package/fesm2022/sdcorejs-angular-components.mjs +1 -0
  95. package/fesm2022/sdcorejs-angular-components.mjs.map +1 -1
  96. package/fesm2022/sdcorejs-angular-configurations.mjs.map +1 -1
  97. package/fesm2022/sdcorejs-angular-directives.mjs +18 -1
  98. package/fesm2022/sdcorejs-angular-directives.mjs.map +1 -1
  99. package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs +20 -2
  100. package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs.map +1 -1
  101. package/fesm2022/sdcorejs-angular-forms-checkbox.mjs +2 -2
  102. package/fesm2022/sdcorejs-angular-forms-checkbox.mjs.map +1 -1
  103. package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs +463 -125
  104. package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs.map +1 -1
  105. package/fesm2022/sdcorejs-angular-forms-chip.mjs +422 -122
  106. package/fesm2022/sdcorejs-angular-forms-chip.mjs.map +1 -1
  107. package/fesm2022/sdcorejs-angular-forms-date-range.mjs +79 -13
  108. package/fesm2022/sdcorejs-angular-forms-date-range.mjs.map +1 -1
  109. package/fesm2022/sdcorejs-angular-forms-date.mjs +75 -18
  110. package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
  111. package/fesm2022/sdcorejs-angular-forms-datetime.mjs +79 -16
  112. package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
  113. package/fesm2022/sdcorejs-angular-forms-directives.mjs +82 -2
  114. package/fesm2022/sdcorejs-angular-forms-directives.mjs.map +1 -1
  115. package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs +2 -2
  116. package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs.map +1 -1
  117. package/fesm2022/sdcorejs-angular-forms-input-color.mjs +1 -1
  118. package/fesm2022/sdcorejs-angular-forms-input-color.mjs.map +1 -1
  119. package/fesm2022/sdcorejs-angular-forms-input-number.mjs +56 -6
  120. package/fesm2022/sdcorejs-angular-forms-input-number.mjs.map +1 -1
  121. package/fesm2022/sdcorejs-angular-forms-input.mjs +54 -7
  122. package/fesm2022/sdcorejs-angular-forms-input.mjs.map +1 -1
  123. package/fesm2022/sdcorejs-angular-forms-models.mjs +88 -5
  124. package/fesm2022/sdcorejs-angular-forms-models.mjs.map +1 -1
  125. package/fesm2022/sdcorejs-angular-forms-radio.mjs +2 -2
  126. package/fesm2022/sdcorejs-angular-forms-radio.mjs.map +1 -1
  127. package/fesm2022/sdcorejs-angular-forms-segmented.mjs +5 -4
  128. package/fesm2022/sdcorejs-angular-forms-segmented.mjs.map +1 -1
  129. package/fesm2022/sdcorejs-angular-forms-select.mjs +87 -33
  130. package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
  131. package/fesm2022/sdcorejs-angular-forms-switch.mjs +2 -2
  132. package/fesm2022/sdcorejs-angular-forms-switch.mjs.map +1 -1
  133. package/fesm2022/sdcorejs-angular-forms-textarea.mjs +16 -3
  134. package/fesm2022/sdcorejs-angular-forms-textarea.mjs.map +1 -1
  135. package/fesm2022/sdcorejs-angular-forms-time.mjs +2 -2
  136. package/fesm2022/sdcorejs-angular-forms-time.mjs.map +1 -1
  137. package/fesm2022/sdcorejs-angular-forms-tree-select.mjs +1 -1
  138. package/fesm2022/sdcorejs-angular-forms-tree-select.mjs.map +1 -1
  139. package/fesm2022/sdcorejs-angular-i18n.mjs +1745 -22
  140. package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
  141. package/fesm2022/sdcorejs-angular-interceptors.mjs +1 -1
  142. package/fesm2022/sdcorejs-angular-interceptors.mjs.map +1 -1
  143. package/fesm2022/sdcorejs-angular-modules-generic-generic-configuration.page-D_1BxDC9.mjs +478 -0
  144. package/fesm2022/sdcorejs-angular-modules-generic-generic-configuration.page-D_1BxDC9.mjs.map +1 -0
  145. package/fesm2022/sdcorejs-angular-modules-generic-generic-form-host.page-CgH8Qi25.mjs +214 -0
  146. package/fesm2022/sdcorejs-angular-modules-generic-generic-form-host.page-CgH8Qi25.mjs.map +1 -0
  147. package/fesm2022/sdcorejs-angular-modules-generic-generic-list.page-CyCGqW9W.mjs +277 -0
  148. package/fesm2022/sdcorejs-angular-modules-generic-generic-list.page-CyCGqW9W.mjs.map +1 -0
  149. package/fesm2022/sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-DTmU8Te4.mjs +1556 -0
  150. package/fesm2022/sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-DTmU8Te4.mjs.map +1 -0
  151. package/fesm2022/sdcorejs-angular-modules-generic.mjs +2 -0
  152. package/fesm2022/sdcorejs-angular-modules-generic.mjs.map +1 -0
  153. package/fesm2022/sdcorejs-angular-modules-icon.mjs +96 -3
  154. package/fesm2022/sdcorejs-angular-modules-icon.mjs.map +1 -1
  155. package/fesm2022/sdcorejs-angular-modules-layout.mjs +2055 -37
  156. package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
  157. package/fesm2022/sdcorejs-angular-modules-pattern-api-error-BBWwQ6h2.mjs +23 -0
  158. package/fesm2022/sdcorejs-angular-modules-pattern-api-error-BBWwQ6h2.mjs.map +1 -0
  159. package/fesm2022/sdcorejs-angular-modules-pattern-approval-inbox-BMwD6_FC.mjs +16 -0
  160. package/fesm2022/sdcorejs-angular-modules-pattern-approval-inbox-BMwD6_FC.mjs.map +1 -0
  161. package/fesm2022/sdcorejs-angular-modules-pattern-base-api.service-BubUwgBK.mjs +51 -0
  162. package/fesm2022/sdcorejs-angular-modules-pattern-base-api.service-BubUwgBK.mjs.map +1 -0
  163. package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-C9WQdsEi.mjs +131 -0
  164. package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-C9WQdsEi.mjs.map +1 -0
  165. package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-s7ZXoakT.mjs +130 -0
  166. package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-s7ZXoakT.mjs.map +1 -0
  167. package/fesm2022/sdcorejs-angular-modules-pattern-create.component-BxfQux1Q.mjs +99 -0
  168. package/fesm2022/sdcorejs-angular-modules-pattern-create.component-BxfQux1Q.mjs.map +1 -0
  169. package/fesm2022/sdcorejs-angular-modules-pattern-create.component-D4GrcahQ.mjs +460 -0
  170. package/fesm2022/sdcorejs-angular-modules-pattern-create.component-D4GrcahQ.mjs.map +1 -0
  171. package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DlYVJqHo.mjs +118 -0
  172. package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DlYVJqHo.mjs.map +1 -0
  173. package/fesm2022/sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs +18 -0
  174. package/fesm2022/sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs.map +1 -0
  175. package/fesm2022/sdcorejs-angular-modules-pattern-customer.service-Bfx6_CmA.mjs +66 -0
  176. package/fesm2022/sdcorejs-angular-modules-pattern-customer.service-Bfx6_CmA.mjs.map +1 -0
  177. package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-3PUIy1Vi.mjs +148 -0
  178. package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-3PUIy1Vi.mjs.map +1 -0
  179. package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-CbYMo3D1.mjs +172 -0
  180. package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-CbYMo3D1.mjs.map +1 -0
  181. package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-awjgX7ph.mjs +90 -0
  182. package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-awjgX7ph.mjs.map +1 -0
  183. package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-c__NdSt3.mjs +467 -0
  184. package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-c__NdSt3.mjs.map +1 -0
  185. package/fesm2022/sdcorejs-angular-modules-pattern-flow.component-Bjvq6wJz.mjs +514 -0
  186. package/fesm2022/sdcorejs-angular-modules-pattern-flow.component-Bjvq6wJz.mjs.map +1 -0
  187. package/fesm2022/sdcorejs-angular-modules-pattern-form-api-errors-FwmYVkag.mjs +61 -0
  188. package/fesm2022/sdcorejs-angular-modules-pattern-form-api-errors-FwmYVkag.mjs.map +1 -0
  189. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-BRsdOwWy.mjs +87 -0
  190. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-BRsdOwWy.mjs.map +1 -0
  191. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-DalxHa8D.mjs +232 -0
  192. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-DalxHa8D.mjs.map +1 -0
  193. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-pqT7lnS6.mjs +170 -0
  194. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-pqT7lnS6.mjs.map +1 -0
  195. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-kdEZ9s7K.mjs +70 -0
  196. package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-kdEZ9s7K.mjs.map +1 -0
  197. package/fesm2022/sdcorejs-angular-modules-pattern-index.component-DZXPZuM4.mjs +100 -0
  198. package/fesm2022/sdcorejs-angular-modules-pattern-index.component-DZXPZuM4.mjs.map +1 -0
  199. package/fesm2022/sdcorejs-angular-modules-pattern-lines-form.component-BjMOON6K.mjs +522 -0
  200. package/fesm2022/sdcorejs-angular-modules-pattern-lines-form.component-BjMOON6K.mjs.map +1 -0
  201. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-Bf9QWXBp.mjs +115 -0
  202. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-Bf9QWXBp.mjs.map +1 -0
  203. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CuDjsIzi.mjs +118 -0
  204. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CuDjsIzi.mjs.map +1 -0
  205. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-DkVrMSPZ.mjs +164 -0
  206. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-DkVrMSPZ.mjs.map +1 -0
  207. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-DkxheDVz.mjs +629 -0
  208. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-DkxheDVz.mjs.map +1 -0
  209. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-E8rkFCkK.mjs +71 -0
  210. package/fesm2022/sdcorejs-angular-modules-pattern-list.component-E8rkFCkK.mjs.map +1 -0
  211. package/fesm2022/sdcorejs-angular-modules-pattern-mock-backend.factory-DgmM-wTI.mjs +1069 -0
  212. package/fesm2022/sdcorejs-angular-modules-pattern-mock-backend.factory-DgmM-wTI.mjs.map +1 -0
  213. package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-BpLQaYP5.mjs +186 -0
  214. package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-BpLQaYP5.mjs.map +1 -0
  215. package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-BrejHvB2.mjs +97 -0
  216. package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-BrejHvB2.mjs.map +1 -0
  217. package/fesm2022/sdcorejs-angular-modules-pattern-product.model-BoHLJ8vf.mjs +12 -0
  218. package/fesm2022/sdcorejs-angular-modules-pattern-product.model-BoHLJ8vf.mjs.map +1 -0
  219. package/fesm2022/sdcorejs-angular-modules-pattern-product.service-C3coYwmZ.mjs +48 -0
  220. package/fesm2022/sdcorejs-angular-modules-pattern-product.service-C3coYwmZ.mjs.map +1 -0
  221. package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-YsWsrKWJ.mjs +297 -0
  222. package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-YsWsrKWJ.mjs.map +1 -0
  223. package/fesm2022/sdcorejs-angular-modules-pattern-routes-9ujH01cX.mjs +74 -0
  224. package/fesm2022/sdcorejs-angular-modules-pattern-routes-9ujH01cX.mjs.map +1 -0
  225. package/fesm2022/sdcorejs-angular-modules-pattern-routes-BfpsCkim.mjs +45 -0
  226. package/fesm2022/sdcorejs-angular-modules-pattern-routes-BfpsCkim.mjs.map +1 -0
  227. package/fesm2022/sdcorejs-angular-modules-pattern-routes-C7b5dRrJ.mjs +165 -0
  228. package/fesm2022/sdcorejs-angular-modules-pattern-routes-C7b5dRrJ.mjs.map +1 -0
  229. package/fesm2022/sdcorejs-angular-modules-pattern-routes-CGeqkySv.mjs +66 -0
  230. package/fesm2022/sdcorejs-angular-modules-pattern-routes-CGeqkySv.mjs.map +1 -0
  231. package/fesm2022/sdcorejs-angular-modules-pattern-routes-DoBxGoRE.mjs +74 -0
  232. package/fesm2022/sdcorejs-angular-modules-pattern-routes-DoBxGoRE.mjs.map +1 -0
  233. package/fesm2022/sdcorejs-angular-modules-pattern-routes-dBuQqYkO.mjs +43 -0
  234. package/fesm2022/sdcorejs-angular-modules-pattern-routes-dBuQqYkO.mjs.map +1 -0
  235. package/fesm2022/sdcorejs-angular-modules-pattern-routes-quSIwMOx.mjs +50 -0
  236. package/fesm2022/sdcorejs-angular-modules-pattern-routes-quSIwMOx.mjs.map +1 -0
  237. package/fesm2022/sdcorejs-angular-modules-pattern-routes-rR-MpQFh.mjs +99 -0
  238. package/fesm2022/sdcorejs-angular-modules-pattern-routes-rR-MpQFh.mjs.map +1 -0
  239. package/fesm2022/sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-LQNpFSmN.mjs +406 -0
  240. package/fesm2022/sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-LQNpFSmN.mjs.map +1 -0
  241. package/fesm2022/sdcorejs-angular-modules-pattern-shell.component-CcmrUIvP.mjs +317 -0
  242. package/fesm2022/sdcorejs-angular-modules-pattern-shell.component-CcmrUIvP.mjs.map +1 -0
  243. package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-Cq72tG9h.mjs +143 -0
  244. package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-Cq72tG9h.mjs.map +1 -0
  245. package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-xFbutFLY.mjs +132 -0
  246. package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-xFbutFLY.mjs.map +1 -0
  247. package/fesm2022/sdcorejs-angular-modules-pattern-update.component-CsfGgGJb.mjs +128 -0
  248. package/fesm2022/sdcorejs-angular-modules-pattern-update.component-CsfGgGJb.mjs.map +1 -0
  249. package/fesm2022/sdcorejs-angular-modules-pattern-update.component-DYPI_CRD.mjs +100 -0
  250. package/fesm2022/sdcorejs-angular-modules-pattern-update.component-DYPI_CRD.mjs.map +1 -0
  251. package/fesm2022/sdcorejs-angular-modules-pattern-update.component-lHmdUXWT.mjs +357 -0
  252. package/fesm2022/sdcorejs-angular-modules-pattern-update.component-lHmdUXWT.mjs.map +1 -0
  253. package/fesm2022/sdcorejs-angular-modules-pattern.mjs +2 -0
  254. package/fesm2022/sdcorejs-angular-modules-pattern.mjs.map +1 -0
  255. package/fesm2022/sdcorejs-angular-modules.mjs +1 -0
  256. package/fesm2022/sdcorejs-angular-modules.mjs.map +1 -1
  257. package/fesm2022/sdcorejs-angular-pipes.mjs +27 -7
  258. package/fesm2022/sdcorejs-angular-pipes.mjs.map +1 -1
  259. package/fesm2022/sdcorejs-angular-services-confirm.mjs +1 -1
  260. package/fesm2022/sdcorejs-angular-services-confirm.mjs.map +1 -1
  261. package/fesm2022/sdcorejs-angular-services-date-time.mjs +143 -0
  262. package/fesm2022/sdcorejs-angular-services-date-time.mjs.map +1 -0
  263. package/fesm2022/sdcorejs-angular-services-storage.mjs +44 -8
  264. package/fesm2022/sdcorejs-angular-services-storage.mjs.map +1 -1
  265. package/fesm2022/sdcorejs-angular-services-unsaved-changes.mjs +104 -4
  266. package/fesm2022/sdcorejs-angular-services-unsaved-changes.mjs.map +1 -1
  267. package/fesm2022/sdcorejs-angular-services.mjs +1 -0
  268. package/fesm2022/sdcorejs-angular-services.mjs.map +1 -1
  269. package/fesm2022/sdcorejs-angular-utilities-read-state.mjs +4 -0
  270. package/fesm2022/sdcorejs-angular-utilities-read-state.mjs.map +1 -1
  271. package/fesm2022/sdcorejs-angular-utilities-theme.mjs +10 -0
  272. package/fesm2022/sdcorejs-angular-utilities-theme.mjs.map +1 -1
  273. package/forms/autocomplete/index.d.ts +5 -0
  274. package/forms/chip/index.d.ts +136 -26
  275. package/forms/chip-calendar/index.d.ts +163 -18
  276. package/forms/date/index.d.ts +23 -2
  277. package/forms/date-range/index.d.ts +24 -2
  278. package/forms/directives/index.d.ts +47 -2
  279. package/forms/input/index.d.ts +23 -2
  280. package/forms/input-number/index.d.ts +23 -2
  281. package/forms/models/index.d.ts +38 -3
  282. package/forms/select/index.d.ts +32 -2
  283. package/i18n/index.d.ts +344 -2
  284. package/modules/generic/index.d.ts +316 -0
  285. package/modules/icon/index.d.ts +37 -6
  286. package/modules/index.d.ts +1 -0
  287. package/modules/layout/index.d.ts +622 -89
  288. package/modules/pattern/README.md +76 -0
  289. package/modules/pattern/docs/detail.md +237 -0
  290. package/modules/pattern/docs/drawer.md +484 -0
  291. package/modules/pattern/docs/flow.md +631 -0
  292. package/modules/pattern/docs/form.md +518 -0
  293. package/modules/pattern/docs/header-actions.md +342 -0
  294. package/modules/pattern/docs/list.md +247 -0
  295. package/modules/pattern/docs/relation.md +180 -0
  296. package/modules/pattern/docs/select.md +206 -0
  297. package/modules/pattern/docs/split.md +350 -0
  298. package/modules/pattern/docs/states.md +168 -0
  299. package/modules/pattern/features/approval/entity.resolver.ts +21 -0
  300. package/modules/pattern/features/approval/pages/detail/detail.component.ts +139 -0
  301. package/modules/pattern/features/approval/pages/list/approval-inbox.ts +7 -0
  302. package/modules/pattern/features/approval/pages/list/list.component.html +20 -0
  303. package/modules/pattern/features/approval/pages/list/list.component.ts +149 -0
  304. package/modules/pattern/features/approval/routes.ts +30 -0
  305. package/modules/pattern/features/approval/services/approval.model.ts +38 -0
  306. package/modules/pattern/features/approval/services/approval.service.ts +23 -0
  307. package/modules/pattern/features/category/components/create-side-drawer/create-side-drawer.component.ts +123 -0
  308. package/modules/pattern/features/category/components/general-information-form/general-information-form.component.ts +61 -0
  309. package/modules/pattern/features/category/components/update-side-drawer/update-side-drawer.component.ts +134 -0
  310. package/modules/pattern/features/category/entity.resolver.ts +27 -0
  311. package/modules/pattern/features/category/pages/list/list.component.html +20 -0
  312. package/modules/pattern/features/category/pages/list/list.component.ts +105 -0
  313. package/modules/pattern/features/category/routes.ts +42 -0
  314. package/modules/pattern/features/category/services/category.model.ts +39 -0
  315. package/modules/pattern/features/category/services/category.service.ts +36 -0
  316. package/modules/pattern/features/customer/components/create-side-drawer/create-side-drawer.component.ts +131 -0
  317. package/modules/pattern/features/customer/components/customer-select/customer-select.component.ts +72 -0
  318. package/modules/pattern/features/customer/components/customer-type-select/customer-type-select.component.ts +30 -0
  319. package/modules/pattern/features/customer/components/debts-view/debts-view.component.ts +28 -0
  320. package/modules/pattern/features/customer/components/detail-side-drawer/detail-side-drawer.component.ts +106 -0
  321. package/modules/pattern/features/customer/components/documents-view/documents-view.component.ts +50 -0
  322. package/modules/pattern/features/customer/components/general-information-form/general-information-form.component.ts +140 -0
  323. package/modules/pattern/features/customer/components/general-information-view/general-information-view.component.ts +39 -0
  324. package/modules/pattern/features/customer/components/orders-view/orders-view.component.ts +35 -0
  325. package/modules/pattern/features/customer/components/summary-cards/summary-cards.component.ts +101 -0
  326. package/modules/pattern/features/customer/components/update-side-drawer/update-side-drawer.component.ts +127 -0
  327. package/modules/pattern/features/customer/entity.resolver.ts +21 -0
  328. package/modules/pattern/features/customer/pages/list/list.component.html +22 -0
  329. package/modules/pattern/features/customer/pages/list/list.component.ts +113 -0
  330. package/modules/pattern/features/customer/pages/profile/profile.component.ts +120 -0
  331. package/modules/pattern/features/customer/pipes/customer-detail.pipe.ts +18 -0
  332. package/modules/pattern/features/customer/routes.ts +59 -0
  333. package/modules/pattern/features/customer/services/customer.model.ts +87 -0
  334. package/modules/pattern/features/customer/services/customer.service.ts +79 -0
  335. package/modules/pattern/features/import/components/mapping-form/mapping-form.component.ts +41 -0
  336. package/modules/pattern/features/import/components/preview-view/preview-view.component.ts +44 -0
  337. package/modules/pattern/features/import/pages/flow/flow.component.ts +269 -0
  338. package/modules/pattern/features/import/routes.ts +19 -0
  339. package/modules/pattern/features/import/services/import.model.ts +82 -0
  340. package/modules/pattern/features/import/services/import.service.ts +18 -0
  341. package/modules/pattern/features/order/components/approval-steps/approval-steps.component.ts +74 -0
  342. package/modules/pattern/features/order/components/bulk-result/bulk-result.component.ts +46 -0
  343. package/modules/pattern/features/order/components/general-information-form/general-information-form.component.ts +96 -0
  344. package/modules/pattern/features/order/components/lines-form/lines-form.component.ts +205 -0
  345. package/modules/pattern/features/order/components/lines-view/lines-view.component.ts +42 -0
  346. package/modules/pattern/features/order/components/summary-cards/summary-cards.component.ts +128 -0
  347. package/modules/pattern/features/order/entity.resolver.ts +37 -0
  348. package/modules/pattern/features/order/pages/create/create.component.ts +99 -0
  349. package/modules/pattern/features/order/pages/detail/detail.component.ts +222 -0
  350. package/modules/pattern/features/order/pages/list/list.component.html +38 -0
  351. package/modules/pattern/features/order/pages/list/list.component.ts +291 -0
  352. package/modules/pattern/features/order/pages/update/update.component.ts +119 -0
  353. package/modules/pattern/features/order/routes.ts +54 -0
  354. package/modules/pattern/features/order/services/order.model.ts +109 -0
  355. package/modules/pattern/features/order/services/order.service.ts +63 -0
  356. package/modules/pattern/features/partner/pages/create/create.component.ts +324 -0
  357. package/modules/pattern/features/partner/routes.ts +20 -0
  358. package/modules/pattern/features/partner/services/partner.model.ts +30 -0
  359. package/modules/pattern/features/partner/services/partner.service.ts +17 -0
  360. package/modules/pattern/features/product/components/general-information-form/general-information-form.component.ts +88 -0
  361. package/modules/pattern/features/product/components/product-select/product-select.component.ts +65 -0
  362. package/modules/pattern/features/product/components/product-status-select/product-status-select.component.ts +30 -0
  363. package/modules/pattern/features/product/entity.resolver.ts +21 -0
  364. package/modules/pattern/features/product/pages/create/create.component.ts +85 -0
  365. package/modules/pattern/features/product/pages/detail/detail.component.ts +53 -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.ts +86 -0
  369. package/modules/pattern/features/product/pipes/product-detail.pipe.ts +18 -0
  370. package/modules/pattern/features/product/routes.ts +48 -0
  371. package/modules/pattern/features/product/services/product.model.ts +38 -0
  372. package/modules/pattern/features/product/services/product.service.ts +48 -0
  373. package/modules/pattern/features/settings/pages/update/update.component.ts +227 -0
  374. package/modules/pattern/features/settings/routes.ts +24 -0
  375. package/modules/pattern/features/settings/services/settings.model.ts +18 -0
  376. package/modules/pattern/features/settings/services/settings.service.ts +15 -0
  377. package/modules/pattern/features/settings/settings.resolver.ts +8 -0
  378. package/modules/pattern/index.d.ts +50 -0
  379. package/package.json +45 -8
  380. package/pipes/index.d.ts +2 -0
  381. package/services/date-time/index.d.ts +57 -0
  382. package/services/index.d.ts +1 -0
  383. package/services/storage/index.d.ts +8 -1
  384. package/services/unsaved-changes/index.d.ts +11 -0
  385. package/utilities/read-state/index.d.ts +2 -0
  386. package/utilities/theme/index.d.ts +1 -1
@@ -3,196 +3,23 @@ import { InjectionToken, inject, DestroyRef, ChangeDetectorRef, input, booleanAt
3
3
  import { Utilities } from '@sdcorejs/utils/fns';
4
4
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
5
  import { NgForm, FormGroup } from '@angular/forms';
6
- import * as i2 from '@angular/material/form-field';
6
+ import * as i1 from '@angular/material/form-field';
7
7
  import { MatFormFieldModule } from '@angular/material/form-field';
8
- import * as i3 from '@angular/material/tooltip';
8
+ import * as i2 from '@angular/material/tooltip';
9
9
  import { MatTooltipModule } from '@angular/material/tooltip';
10
- import * as i1 from '@ckeditor/ckeditor5-angular';
11
- import { CKEditorModule } from '@ckeditor/ckeditor5-angular';
12
- import { Plugin, FileRepository, Image, ImageResize, ImageUpload, ImageStyle, ImageToolbar, ClassicEditor, Essentials, FontColor, FontSize, Paragraph, Bold, Italic, Underline, List, Undo, Widget, Alignment } from 'ckeditor5';
13
- import { Subject } from 'rxjs';
14
- import { debounceTime } from 'rxjs/operators';
10
+ import { SdEditorSurface } from '@sdcorejs/angular/components/editor-engine';
11
+ export { SdEditorImportError } from '@sdcorejs/angular/components/editor-engine';
15
12
  import { SdNotifyService } from '@sdcorejs/angular/services';
16
13
  import { I18nService } from '@sdcorejs/angular/i18n';
17
14
  import { sdIsEmpty } from '@sdcorejs/angular/utilities/data-state';
18
15
  import { sdSanitizeEditorHtml } from '@sdcorejs/angular/utilities/extensions';
19
- import { SdFormControl, ɵsdFormControlConnector as _sdFormControlConnector, HandleSdCustomValidator } from '@sdcorejs/angular/forms/models';
20
- import { SdCKEditorStyles } from '@sdcorejs/angular/components/ckeditor-styles';
21
16
  import { SdLabel } from '@sdcorejs/angular/forms/label';
22
17
  import { SdIcon } from '@sdcorejs/angular/modules/icon';
18
+ import { parse } from 'parse5';
19
+ import { SdFormControl, ɵsdFormControlConnector as _sdFormControlConnector, HandleSdCustomValidator } from '@sdcorejs/angular/forms/models';
23
20
 
24
21
  const SD_EDITOR_CONFIGURATION = new InjectionToken('sd.editor.configuration');
25
22
 
26
- // Dựa vào file để detect định dạng thay vì chỉ check tên
27
- // Tránh user gửi file không đúng, ví dụ file docx nhưng đổi tên thành ảnh docx.jpg
28
- const detectFormatFromBytes = async (file) => {
29
- const buffer = await file.slice(0, 12).arrayBuffer();
30
- const b = new Uint8Array(buffer);
31
- if (b[0] === 0xff && b[1] === 0xd8 && b[2] === 0xff)
32
- return 'jpg';
33
- if (b[0] === 0x89 && b[1] === 0x50 && b[2] === 0x4e && b[3] === 0x47)
34
- return 'png';
35
- if (b[0] === 0x52 && b[1] === 0x49 && b[2] === 0x46 && b[3] === 0x46 && b[8] === 0x57)
36
- return 'webp';
37
- if (b[0] === 0x47 && b[1] === 0x49 && b[2] === 0x46 && b[3] === 0x38)
38
- return 'gif';
39
- if (b[4] === 0x66 && b[5] === 0x74 && b[6] === 0x79 && b[7] === 0x70) {
40
- const brand = String.fromCharCode(b[8], b[9], b[10], b[11]);
41
- if (brand === 'avif')
42
- return 'avif';
43
- if (brand.startsWith('hei'))
44
- return 'heic';
45
- }
46
- return '';
47
- };
48
- const getImageInfo = async (file) => {
49
- const sizeMB = file.size / (1024 * 1024);
50
- const loadDimensions = new Promise(resolve => {
51
- const url = URL.createObjectURL(file);
52
- const img = new window.Image();
53
- img.onload = () => {
54
- URL.revokeObjectURL(url);
55
- resolve({ width: img.naturalWidth, height: img.naturalHeight });
56
- };
57
- img.onerror = () => {
58
- URL.revokeObjectURL(url);
59
- resolve({ width: 0, height: 0 });
60
- };
61
- img.src = url;
62
- });
63
- const [format, { width, height }] = await Promise.all([detectFormatFromBytes(file), loadDimensions]);
64
- return { width, height, sizeMB, format };
65
- };
66
- // Helper: gọi i18n.t khi có service; nếu thiếu thì trả empty (Angular wrapper luôn truyền i18n)
67
- const tr = (i18n, key, params) => i18n?.t(key, params) ?? '';
68
- const validateImageFile = async (file, validation, onWarning, i18n) => {
69
- const { width, height, sizeMB, format } = await getImageInfo(file);
70
- if (validation.allowedFormats !== undefined) {
71
- const normalizedFormats = validation.allowedFormats.map((f) => {
72
- const fmt = f.replace(/^\./, '').toLowerCase();
73
- return fmt === 'jpeg' ? 'jpg' : fmt;
74
- });
75
- if (!normalizedFormats.includes(format)) {
76
- const allowed = normalizedFormats.join(', ');
77
- onWarning?.(tr(i18n, 'core.component.editor.image.invalid-format', { format, allowed }));
78
- return false;
79
- }
80
- }
81
- if (validation.maxSizeMB !== undefined && sizeMB > validation.maxSizeMB) {
82
- const sizeMBFixed = sizeMB.toFixed(2);
83
- onWarning?.(tr(i18n, 'core.component.editor.image.size-exceeded', { sizeMB: sizeMBFixed, maxSizeMB: validation.maxSizeMB }));
84
- return false;
85
- }
86
- if (validation.minWidth !== undefined && width < validation.minWidth) {
87
- onWarning?.(tr(i18n, 'core.component.editor.image.min-width', { width, min: validation.minWidth }));
88
- return false;
89
- }
90
- if (validation.minHeight !== undefined && height < validation.minHeight) {
91
- onWarning?.(tr(i18n, 'core.component.editor.image.min-height', { height, min: validation.minHeight }));
92
- return false;
93
- }
94
- if (validation.maxWidth !== undefined && width > validation.maxWidth) {
95
- onWarning?.(tr(i18n, 'core.component.editor.image.max-width', { width, max: validation.maxWidth }));
96
- return false;
97
- }
98
- if (validation.maxHeight !== undefined && height > validation.maxHeight) {
99
- onWarning?.(tr(i18n, 'core.component.editor.image.max-height', { height, max: validation.maxHeight }));
100
- return false;
101
- }
102
- return true;
103
- };
104
- const validateAndGetFile = async (loader, validation, onWarning, i18n) => {
105
- const file = (await loader.file);
106
- if (!file) {
107
- throw new Error('No file found');
108
- }
109
- if (validation) {
110
- const valid = await validateImageFile(file, validation, onWarning, i18n);
111
- if (!valid) {
112
- throw new Error('Image validation failed');
113
- }
114
- }
115
- return file;
116
- };
117
-
118
- const getBatchConfig = (option) => {
119
- const imageConfig = option?.imageConfig;
120
- return {
121
- batchSize: Math.max(1, imageConfig?.batchSize ?? 2),
122
- maxConcurrent: Math.max(1, imageConfig?.maxConcurrentUploads ?? 2),
123
- };
124
- };
125
- const getActiveBlobUrls = (editor) => {
126
- const urls = new Set();
127
- const root = editor.model.document.getRoot();
128
- if (!root)
129
- return urls;
130
- for (const item of editor.model.createRangeIn(root).getItems()) {
131
- if (item.is('element', 'imageBlock') || item.is('element', 'imageInline')) {
132
- const src = item.getAttribute('src');
133
- if (src?.startsWith('blob:'))
134
- urls.add(src);
135
- }
136
- }
137
- return urls;
138
- };
139
- const filterActivePendingFiles = (pendingFiles, activeBlobUrls) => {
140
- const toUpload = [];
141
- for (const [blobUrl, file] of pendingFiles) {
142
- if (activeBlobUrls.has(blobUrl)) {
143
- toUpload.push([blobUrl, file]);
144
- }
145
- else {
146
- URL.revokeObjectURL(blobUrl);
147
- pendingFiles.delete(blobUrl);
148
- }
149
- }
150
- return toUpload;
151
- };
152
- const runBatchUploads = async (toUpload, uploadFn, batchSize, maxConcurrent) => {
153
- const batches = [];
154
- for (let i = 0; i < toUpload.length; i += batchSize) {
155
- batches.push(toUpload.slice(i, i + batchSize));
156
- }
157
- const replacements = new Map();
158
- const failedBatches = [];
159
- let head = 0;
160
- const runWorker = async () => {
161
- while (head < batches.length) {
162
- const batch = batches[head++];
163
- try {
164
- const details = await uploadFn(batch.map(([, file]) => file));
165
- if (details.length !== batch.length) {
166
- throw new Error(`API returned ${details.length} results for ${batch.length} files`);
167
- }
168
- batch.forEach(([blobUrl], idx) => {
169
- replacements.set(blobUrl, details[idx]);
170
- URL.revokeObjectURL(blobUrl);
171
- });
172
- }
173
- catch {
174
- failedBatches.push(batch);
175
- }
176
- }
177
- };
178
- await Promise.all(Array.from({ length: Math.min(maxConcurrent, batches.length) }, runWorker));
179
- return { replacements, failedBatches };
180
- };
181
- const applyReplacementsToEditor = (editor, replacements) => {
182
- if (replacements.size === 0)
183
- return;
184
- editor.model.change(writer => {
185
- const root = editor.model.document.getRoot();
186
- for (const item of editor.model.createRangeIn(root).getItems()) {
187
- if (!item.is('element', 'imageBlock') && !item.is('element', 'imageInline'))
188
- continue;
189
- const detail = replacements.get(item.getAttribute('src'));
190
- if (detail)
191
- writer.setAttribute('src', detail.cdn, item);
192
- }
193
- });
194
- };
195
-
196
23
  const parseStyle = (style) => {
197
24
  const map = new Map();
198
25
  for (const decl of style.split(';')) {
@@ -210,6 +37,20 @@ const serializeStyle = (map) => [...map.entries()].map(([k, v]) => `${k}:${v}`).
210
37
  const countTextLength = (content) => {
211
38
  if (!content)
212
39
  return 0;
40
+ // The same standards-based HTML tree and UTF-16 text counting on the server.
41
+ if (typeof DOMParser === 'undefined') {
42
+ const document = parse(content, { scriptingEnabled: false });
43
+ const html = document.childNodes.find(node => node.nodeName === 'html');
44
+ const body = html && 'childNodes' in html ? html.childNodes.find(node => node.nodeName === 'body') : undefined;
45
+ const count = (node) => {
46
+ if ('tagName' in node && (node.tagName === 'img' || node.tagName === 'figure'))
47
+ return 0;
48
+ if (node.nodeName === '#text' && 'value' in node)
49
+ return node.value.length;
50
+ return 'childNodes' in node ? node.childNodes.reduce((length, child) => length + count(child), 0) : 0;
51
+ };
52
+ return body ? count(body) : 0;
53
+ }
213
54
  const doc = new DOMParser().parseFromString(content, 'text/html');
214
55
  doc.querySelectorAll('img, figure').forEach(el => el.remove());
215
56
  return doc.body.textContent?.length ?? 0;
@@ -320,364 +161,310 @@ const imageClassesToInlineStyles = (html) => {
320
161
  return doc.body.innerHTML;
321
162
  };
322
163
 
323
- class UploadQueue {
324
- #queue = [];
325
- #running = 0;
326
- maxConcurrent;
327
- constructor(maxConcurrent) {
328
- this.maxConcurrent = maxConcurrent;
329
- }
330
- async run(task) {
331
- if (this.#running >= this.maxConcurrent) {
332
- await new Promise(resolve => {
333
- this.#queue.push(resolve);
334
- });
335
- }
336
- this.#running++;
337
- try {
338
- return await task();
339
- }
340
- finally {
341
- this.#running--;
342
- this.#queue.shift()?.();
343
- }
164
+ const detectFormatFromBytes = async (file) => {
165
+ const b = new Uint8Array(await file.slice(0, 12).arrayBuffer());
166
+ if (b[0] === 0xff && b[1] === 0xd8 && b[2] === 0xff)
167
+ return 'jpg';
168
+ if ([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a].every((v, i) => b[i] === v))
169
+ return 'png';
170
+ if (String.fromCharCode(...b.slice(0, 4)) === 'RIFF' && String.fromCharCode(...b.slice(8, 12)) === 'WEBP')
171
+ return 'webp';
172
+ if (['GIF87a', 'GIF89a'].includes(String.fromCharCode(...b.slice(0, 6))))
173
+ return 'gif';
174
+ if (String.fromCharCode(...b.slice(4, 8)) === 'ftyp') {
175
+ const brand = String.fromCharCode(...b.slice(8, 12));
176
+ if (['avif', 'avis'].includes(brand))
177
+ return 'avif';
178
+ if (['heic', 'heix', 'hevc', 'hevx'].includes(brand))
179
+ return 'heic';
344
180
  }
345
- }
346
- class BatchUploadScheduler {
347
- #pending = [];
348
- #timer = null;
349
- #batchSize;
350
- #uploadFn;
351
- #queue;
352
- constructor(batchSize, uploadFn, queue) {
353
- this.#batchSize = batchSize;
354
- this.#uploadFn = uploadFn;
355
- this.#queue = queue;
181
+ return '';
182
+ };
183
+ const loadDimensions = (file, signal) => new Promise((resolve, reject) => {
184
+ if (signal?.aborted) {
185
+ reject(new Error('Image validation cancelled'));
186
+ return;
356
187
  }
357
- enqueue(file) {
358
- return new Promise((resolve, reject) => {
359
- this.#pending.push({ file, resolve, reject });
360
- if (this.#timer) {
361
- clearTimeout(this.#timer);
362
- }
363
- if (this.#pending.length >= this.#batchSize) {
364
- this.#timer = null;
365
- this.#flush();
366
- }
367
- else {
368
- this.#timer = setTimeout(() => this.#flush(), 50);
369
- }
370
- });
188
+ const url = URL.createObjectURL(file);
189
+ const img = new Image();
190
+ const finish = (dimensions) => {
191
+ clearTimeout(timer);
192
+ signal?.removeEventListener('abort', abort);
193
+ img.onload = img.onerror = null;
194
+ img.src = '';
195
+ URL.revokeObjectURL(url);
196
+ if (dimensions)
197
+ resolve(dimensions);
198
+ else
199
+ reject(new Error('Image validation cancelled'));
200
+ };
201
+ const abort = () => finish();
202
+ const timer = setTimeout(() => finish({ width: 0, height: 0 }), 15000);
203
+ signal?.addEventListener('abort', abort, { once: true });
204
+ img.onload = () => finish({ width: img.naturalWidth, height: img.naturalHeight });
205
+ img.onerror = () => finish({ width: 0, height: 0 });
206
+ img.src = url;
207
+ });
208
+ const validateAndGetFile = async (loader, validation = {}, onWarning, i18n, signal) => {
209
+ const file = await loader.file;
210
+ if (!file)
211
+ throw new Error('No file found');
212
+ const warn = (key, params) => onWarning?.(i18n?.t(key, params) ?? '');
213
+ const format = await detectFormatFromBytes(file);
214
+ const allowed = validation.allowedFormats?.map(value => {
215
+ const normalized = value.replace(/^\./, '').toLowerCase();
216
+ return normalized === 'jpeg' ? 'jpg' : normalized;
217
+ });
218
+ if (!format || (allowed && !allowed.includes(format))) {
219
+ warn('core.component.editor.image.invalid-format', { format, allowed: allowed?.join(', ') ?? 'jpg, png, webp, gif, avif, heic' });
220
+ throw new Error('Image validation failed');
371
221
  }
372
- destroy() {
373
- if (this.#timer !== null) {
374
- clearTimeout(this.#timer);
375
- this.#timer = null;
222
+ const sizeMB = file.size / (1024 * 1024);
223
+ if (validation.maxSizeMB !== undefined && sizeMB > validation.maxSizeMB) {
224
+ warn('core.component.editor.image.size-exceeded', { sizeMB: sizeMB.toFixed(2), maxSizeMB: validation.maxSizeMB });
225
+ throw new Error('Image validation failed');
226
+ }
227
+ const { width, height } = await loadDimensions(file, signal);
228
+ if (!width || !height) {
229
+ warn('core.component.editor.image.invalid-format', { format, allowed: allowed?.join(', ') ?? format });
230
+ throw new Error('Image validation failed');
231
+ }
232
+ const checks = [
233
+ [validation.minWidth, width, true, 'min-width', 'min'],
234
+ [validation.minHeight, height, true, 'min-height', 'min'],
235
+ [validation.maxWidth, width, false, 'max-width', 'max'],
236
+ [validation.maxHeight, height, false, 'max-height', 'max'],
237
+ ];
238
+ for (const [limit, actual, minimum, key, param] of checks) {
239
+ if (limit !== undefined && (minimum ? actual < limit : actual > limit)) {
240
+ warn(`core.component.editor.image.${key}`, { width, height, [param]: limit });
241
+ throw new Error('Image validation failed');
376
242
  }
377
- this.#pending.splice(0).forEach(p => p.reject(new Error('Upload cancelled')));
378
243
  }
379
- #flush() {
380
- this.#timer = null;
381
- const all = this.#pending.splice(0);
382
- if (all.length === 0) {
244
+ return file;
245
+ };
246
+
247
+ const positiveInteger = (value, fallback) => Number.isFinite(value) ? Math.max(1, Math.floor(value)) : fallback;
248
+ /** Per-component file queue. Invalidating work ignores callbacks; it cannot cancel an app's API request. */
249
+ class SdEditorUploadManager {
250
+ engine;
251
+ configuration;
252
+ warning;
253
+ i18n;
254
+ #pending = new Map();
255
+ #validations = new Set();
256
+ #generation = 0;
257
+ #destroyed = false;
258
+ #running;
259
+ #runningGeneration = -1;
260
+ #immediateTimer;
261
+ #nextImmediate = false;
262
+ constructor(engine, configuration, warning = () => { }, i18n) {
263
+ this.engine = engine;
264
+ this.configuration = configuration;
265
+ this.warning = warning;
266
+ this.i18n = i18n;
267
+ }
268
+ async selectFiles(files) {
269
+ if (this.#destroyed || !this.configuration().uploadFn)
270
+ return;
271
+ const config = this.configuration();
272
+ const generation = this.#generation;
273
+ const maximum = config.maxImagesPerSelection;
274
+ if (maximum !== undefined && files.length > Math.max(0, Math.floor(maximum))) {
275
+ this.warning(this.i18n?.t('core.component.editor.image.max-per-selection', { max: maximum }) ?? '');
383
276
  return;
384
277
  }
385
- for (let i = 0; i < all.length; i += this.#batchSize) {
386
- const batch = all.slice(i, i + this.#batchSize);
387
- this.#queue
388
- .run(() => this.#uploadFn(batch.map(p => p.file)))
389
- .then(details => {
390
- batch.forEach((p, idx) => {
391
- if (details && details[idx]) {
392
- p.resolve(details[idx]);
393
- }
394
- else {
395
- p.reject(new Error('Upload failed: Missing details from server'));
396
- }
397
- });
398
- })
399
- .catch(err => {
400
- batch.forEach(p => p.reject(err));
401
- });
402
- }
403
- }
404
- }
405
- class DeferredImageUploadAdapter {
406
- #loader;
407
- #pendingFiles;
408
- #imageMetaMap;
409
- #validation;
410
- #onWarning;
411
- #i18n;
412
- #lazyLoad;
413
- #currentBlobUrl = null;
414
- constructor(loader, pendingFiles, imageMetaMap, options) {
415
- this.#loader = loader;
416
- this.#pendingFiles = pendingFiles;
417
- this.#imageMetaMap = imageMetaMap;
418
- this.#validation = options.validation;
419
- this.#onWarning = options.onWarning;
420
- this.#i18n = options.i18n;
421
- this.#lazyLoad = options.lazyLoad;
422
- }
423
- upload = async () => {
424
- const file = await validateAndGetFile(this.#loader, this.#validation, this.#onWarning, this.#i18n);
425
- if (!file)
426
- throw new Error('Image validation failed');
427
- this.#currentBlobUrl = URL.createObjectURL(file);
428
- this.#pendingFiles.set(this.#currentBlobUrl, file);
429
- this.#imageMetaMap.set(this.#currentBlobUrl, { fileName: file.name, lazyLoad: this.#lazyLoad });
430
- return { default: this.#currentBlobUrl };
431
- };
432
- abort() {
433
- if (this.#currentBlobUrl) {
434
- URL.revokeObjectURL(this.#currentBlobUrl);
435
- this.#pendingFiles.delete(this.#currentBlobUrl);
436
- this.#imageMetaMap.delete(this.#currentBlobUrl);
437
- }
438
- }
439
- }
440
- class ImmediateImageUploadAdapter {
441
- #loader;
442
- #validation;
443
- #onWarning;
444
- #i18n;
445
- #scheduler;
446
- #imageMetaMap;
447
- #lazyLoad;
448
- constructor(loader, scheduler, imageMetaMap, options) {
449
- this.#loader = loader;
450
- this.#scheduler = scheduler;
451
- this.#imageMetaMap = imageMetaMap;
452
- this.#validation = options.validation;
453
- this.#onWarning = options.onWarning;
454
- this.#i18n = options.i18n;
455
- this.#lazyLoad = options.lazyLoad;
456
- }
457
- upload = async () => {
458
- const file = await validateAndGetFile(this.#loader, this.#validation, this.#onWarning, this.#i18n);
459
- if (!file)
460
- throw new Error('Image validation failed');
461
- const detail = await this.#scheduler.enqueue(file);
462
- this.#imageMetaMap.set(detail.cdn, {
463
- name: detail.name,
464
- fileName: file.name,
465
- idOrKey: detail.idOrKey,
466
- lazyLoad: this.#lazyLoad,
467
- });
468
- return { default: detail.cdn };
469
- };
470
- abort() { }
471
- }
472
- class EditorImageUploadPlugin extends Plugin {
473
- pendingFiles = new Map();
474
- uploadQueue;
475
- #batchScheduler;
476
- #imageMetaMap = new Map();
477
- setMeta(cdnUrl, meta) {
478
- this.#imageMetaMap.set(cdnUrl, { name: meta.name, idOrKey: meta.idOrKey, lazyLoad: meta.lazyLoad });
479
- }
480
- static get pluginName() {
481
- return 'EditorImageUploadPlugin';
482
- }
483
- static get requires() {
484
- return [FileRepository, Image, ImageResize, ImageUpload, ImageStyle, ImageToolbar];
485
- }
486
- init() {
487
- const editor = this.editor;
488
- const getOption = editor.config.get('getOption');
489
- const maxConcurrent = getOption?.()?.imageConfig?.maxConcurrentUploads ?? 2;
490
- this.uploadQueue = new UploadQueue(maxConcurrent);
491
- this.#registerSchemaAndConverters();
492
- this.#listenForSrcChanges();
493
- editor.editing.view.document.on('clipboardInput', (evt, data) => {
494
- const dataTransfer = data.dataTransfer;
495
- if (!dataTransfer)
278
+ for (const file of files) {
279
+ if (!this.#isCurrent(generation))
496
280
  return;
497
- const hasImageFiles = Array.from(dataTransfer.files ?? []).some(f => f.type.startsWith('image/'));
498
- const hasImageInHtml = /<img[\s>]/i.test(dataTransfer.getData('text/html') ?? '');
499
- if (hasImageFiles || hasImageInHtml) {
500
- evt.stop();
501
- }
502
- }, { priority: 'highest' });
503
- const uploadImageCommand = editor.commands.get('uploadImage');
504
- if (uploadImageCommand) {
505
- uploadImageCommand.on('execute', (evt, args) => {
506
- const options = args[0] || {};
507
- const option = getOption?.();
508
- const maxPerSelection = option?.imageConfig?.maxImagesPerSelection;
509
- if (maxPerSelection !== undefined) {
510
- const files = Array.isArray(options?.file) ? options.file : options?.file ? [options.file] : [];
511
- if (files.length > maxPerSelection) {
512
- // Angular wrapper luôn truyền _i18n; nếu thiếu thì warning sẽ là chuỗi rỗng (i18n service tự log missing key)
513
- const msg = option?._i18n?.t('core.component.editor.image.max-per-selection', { max: maxPerSelection }) ?? '';
514
- option?.onWarning?.(msg);
515
- evt.stop();
516
- }
281
+ const validation = new AbortController();
282
+ this.#validations.add(validation);
283
+ try {
284
+ await validateAndGetFile({ file }, config.validation, this.warning, this.i18n, validation.signal);
285
+ if (!this.#isCurrent(generation))
286
+ return;
287
+ const src = URL.createObjectURL(file);
288
+ this.#pending.set(src, file);
289
+ try {
290
+ this.engine.insertImage({ src, alt: file.name, loading: config.lazyLoad === false ? 'eager' : 'lazy' });
517
291
  }
518
- }, { priority: 'high' });
519
- }
520
- editor.once('ready', () => {
521
- const notification = editor.plugins.get('Notification');
522
- notification?.on('show:warning', (evt) => {
523
- evt.stop();
524
- }, { priority: 'highest' });
525
- });
526
- editor.plugins.get('FileRepository').createUploadAdapter = (loader) => {
527
- const option = getOption?.();
528
- const imageConfig = option?.imageConfig;
529
- const uploadMode = imageConfig?.uploadMode ?? 'deferred';
530
- const validation = imageConfig?.validation;
531
- const onWarning = option?.onWarning;
532
- const i18n = option?._i18n;
533
- const lazyLoad = imageConfig?.lazyLoad ?? true;
534
- if (uploadMode === 'deferred') {
535
- return new DeferredImageUploadAdapter(loader, this.pendingFiles, this.#imageMetaMap, { validation, onWarning, i18n, lazyLoad });
536
- }
537
- if (!this.#batchScheduler) {
538
- const uploadFn = option?.uploadFn;
539
- if (uploadFn) {
540
- const batchSize = imageConfig?.batchSize ?? 2;
541
- this.#batchScheduler = new BatchUploadScheduler(batchSize, uploadFn, this.uploadQueue);
292
+ catch (error) {
293
+ this.#release(src);
294
+ throw error;
542
295
  }
543
296
  }
544
- if (!this.#batchScheduler) {
545
- throw new Error('No upload function configured');
297
+ catch {
298
+ // Validation already reports a localized warning. An invalidated local decode is silent.
546
299
  }
547
- return new ImmediateImageUploadAdapter(loader, this.#batchScheduler, this.#imageMetaMap, { validation, onWarning, i18n, lazyLoad });
548
- };
549
- }
550
- destroy() {
551
- super.destroy();
552
- this.#batchScheduler?.destroy();
553
- for (const blobUrl of this.pendingFiles.keys()) {
554
- URL.revokeObjectURL(blobUrl);
555
- }
556
- this.pendingFiles.clear();
557
- this.#imageMetaMap.clear();
558
- }
559
- #registerSchemaAndConverters() {
560
- const editor = this.editor;
561
- const schema = editor.model.schema;
562
- for (const type of ['imageBlock', 'imageInline']) {
563
- if (schema.isRegistered(type)) {
564
- schema.extend(type, { allowAttributes: ['loading', 'imageId'] });
300
+ finally {
301
+ this.#validations.delete(validation);
565
302
  }
566
303
  }
567
- // Downcast: model → HTML view
568
- editor.conversion.for('downcast').add((dispatcher) => {
569
- for (const [modelAttr, htmlAttr] of [
570
- ['loading', 'loading'],
571
- ['imageId', 'id'],
572
- ]) {
573
- const handleAttribute = (isBlock) => (evt, data, conversionApi) => {
574
- if (!conversionApi.consumable.consume(data.item, evt.name))
575
- return;
576
- const viewElement = conversionApi.mapper.toViewElement(data.item);
577
- const viewImg = isBlock ? this.#findImg(viewElement) : viewElement;
578
- if (!viewImg)
579
- return;
580
- if (data.attributeNewValue != null) {
581
- conversionApi.writer.setAttribute(htmlAttr, String(data.attributeNewValue), viewImg);
582
- }
583
- else {
584
- conversionApi.writer.removeAttribute(htmlAttr, viewImg);
585
- }
586
- };
587
- dispatcher.on(`attribute:${modelAttr}:imageBlock`, handleAttribute(true));
588
- dispatcher.on(`attribute:${modelAttr}:imageInline`, handleAttribute(false));
304
+ if (this.#isCurrent(generation) && config.uploadMode === 'immediate')
305
+ this.#scheduleImmediate();
306
+ }
307
+ /** Snapshot only files still present; later insertions remain pending for a later deferred call. */
308
+ upload() {
309
+ if (this.#running) {
310
+ if (this.#runningGeneration === this.#generation)
311
+ return this.#running;
312
+ // An app callback remains in flight after invalidation. Await it to keep the
313
+ // concurrency bound, then submit the new generation's own snapshot.
314
+ return this.#running.catch(() => { }).then(() => this.upload());
315
+ }
316
+ const running = this.#uploadSnapshot();
317
+ this.#running = running;
318
+ this.#runningGeneration = this.#generation;
319
+ void running
320
+ .finally(() => {
321
+ if (this.#running !== running)
322
+ return;
323
+ this.#running = undefined;
324
+ if (this.#nextImmediate && !this.#destroyed) {
325
+ this.#nextImmediate = false;
326
+ this.#scheduleImmediate();
589
327
  }
590
- });
591
- // Upcast: HTML → model
592
- editor.conversion.for('upcast').add((dispatcher) => {
593
- dispatcher.on('element:figure', (_evt, data, conversionApi) => {
594
- if (!data.viewItem.hasClass('image'))
595
- return;
596
- const modelElement = data.modelRange?.start?.nodeAfter;
597
- if (!modelElement)
598
- return;
599
- const viewImg = this.#findImg(data.viewItem);
600
- if (!viewImg)
601
- return;
602
- this.#transferHtmlAttrsToModel(viewImg, modelElement, conversionApi);
603
- }, { priority: 'low' });
604
- dispatcher.on('element:img', (_evt, data, conversionApi) => {
605
- const modelElement = data.modelRange?.start?.nodeAfter;
606
- if (!modelElement)
607
- return;
608
- this.#transferHtmlAttrsToModel(data.viewItem, modelElement, conversionApi);
609
- }, { priority: 'low' });
610
- });
611
- }
612
- #listenForSrcChanges() {
613
- const editor = this.editor;
614
- editor.model.document.on('change', () => {
615
- const changes = editor.model.document.differ.getChanges();
616
- const updates = [];
617
- for (const change of changes) {
618
- if (change.type !== 'attribute' || change.attributeKey !== 'src')
619
- continue;
620
- const newSrc = change.attributeNewValue;
621
- const meta = this.#imageMetaMap.get(newSrc);
622
- if (!meta)
328
+ })
329
+ .catch(() => { });
330
+ return running;
331
+ }
332
+ async #uploadSnapshot() {
333
+ const config = this.configuration();
334
+ const uploadFn = config.uploadFn;
335
+ if (!uploadFn)
336
+ throw new Error('No upload function configured for image upload');
337
+ if (this.#destroyed)
338
+ return;
339
+ this.pruneRemoved();
340
+ const generation = this.#generation;
341
+ const entries = [...this.#pending.entries()];
342
+ const batchSize = positiveInteger(config.batchSize, 2);
343
+ const concurrency = positiveInteger(config.maxConcurrentUploads, 2);
344
+ const batches = [];
345
+ for (let i = 0; i < entries.length; i += batchSize)
346
+ batches.push(entries.slice(i, i + batchSize));
347
+ let head = 0;
348
+ let failures = 0;
349
+ const worker = async () => {
350
+ while (head < batches.length && this.#isCurrent(generation)) {
351
+ const batch = batches[head++].filter(([src, file]) => this.#pending.get(src) === file && this.engine.activeImageSources().has(src));
352
+ if (!batch.length)
623
353
  continue;
624
- const node = change.range?.start?.nodeAfter;
625
- if (node?.is('element')) {
626
- updates.push({ element: node, meta });
627
- this.#imageMetaMap.delete(newSrc);
628
- }
629
- }
630
- if (updates.length === 0)
631
- return;
632
- editor.model.enqueueChange('transparent', (writer) => {
633
- for (const { element, meta } of updates) {
634
- if (meta.name || meta.fileName) {
635
- writer.setAttribute('alt', meta.name || this.#generateAlt(meta.fileName), element);
636
- }
637
- if (meta.lazyLoad) {
638
- writer.setAttribute('loading', 'lazy', element);
639
- }
640
- if (meta.idOrKey) {
641
- writer.setAttribute('imageId', meta.idOrKey, element);
354
+ try {
355
+ const results = await uploadFn(batch.map(([, file]) => file));
356
+ if (!this.#isCurrent(generation))
357
+ return;
358
+ if (!Array.isArray(results) || results.length !== batch.length)
359
+ throw new Error('Image upload result cardinality does not match the submitted files');
360
+ // Validate the whole batch before applying any result; failed batches remain retryable.
361
+ const attributes = results.map((detail, i) => this.#resultAttributes(detail, batch[i][1], config));
362
+ for (const [index, [src, file]] of batch.entries()) {
363
+ if (!this.#isCurrent(generation))
364
+ return;
365
+ if (this.#pending.get(src) !== file)
366
+ continue;
367
+ if (!this.engine.activeImageSources().has(src)) {
368
+ this.#release(src);
369
+ continue;
370
+ }
371
+ let replaced = false;
372
+ try {
373
+ replaced = this.engine.replaceImage(src, attributes[index]);
374
+ }
375
+ catch {
376
+ /* Keep the active file retryable. */
377
+ }
378
+ if (replaced || !this.engine.activeImageSources().has(src))
379
+ this.#release(src);
380
+ else
381
+ failures++;
642
382
  }
643
383
  }
384
+ catch {
385
+ if (this.#isCurrent(generation))
386
+ failures += batch.filter(([src, file]) => this.#pending.get(src) === file && this.engine.activeImageSources().has(src)).length;
387
+ }
388
+ }
389
+ };
390
+ await Promise.all(Array.from({ length: Math.min(concurrency, batches.length) }, worker));
391
+ if (this.#isCurrent(generation)) {
392
+ this.pruneRemoved();
393
+ if (failures)
394
+ throw new Error(`Upload failed for ${failures} image(s)`);
395
+ }
396
+ }
397
+ #resultAttributes(detail, file, config) {
398
+ if (!detail ||
399
+ typeof detail.cdn !== 'string' ||
400
+ !detail.cdn.trim() ||
401
+ /^blob:/i.test(detail.cdn.trim()) ||
402
+ typeof detail.idOrKey !== 'string' ||
403
+ (detail.name !== undefined && typeof detail.name !== 'string'))
404
+ throw new Error('Invalid image upload metadata');
405
+ const image = document.implementation.createHTMLDocument().createElement('img');
406
+ image.setAttribute('src', detail.cdn);
407
+ if (sdSanitizeEditorHtml(image.outerHTML) !== image.outerHTML)
408
+ throw new Error('Unsafe image upload URL');
409
+ return { src: detail.cdn, id: detail.idOrKey, alt: detail.name ?? file.name, loading: config.lazyLoad === false ? 'eager' : 'lazy' };
410
+ }
411
+ #scheduleImmediate() {
412
+ if (this.#destroyed)
413
+ return;
414
+ if (this.#running) {
415
+ this.#nextImmediate = true;
416
+ return;
417
+ }
418
+ if (this.#immediateTimer !== undefined)
419
+ clearTimeout(this.#immediateTimer);
420
+ const ready = this.#pending.size >= positiveInteger(this.configuration().batchSize, 2);
421
+ this.#immediateTimer = setTimeout(() => {
422
+ this.#immediateTimer = undefined;
423
+ void this.upload().catch(() => {
424
+ if (!this.#destroyed)
425
+ this.warning(this.i18n?.t('core.component.editor.image.upload-failed') ?? '');
644
426
  });
645
- });
427
+ }, ready ? 0 : 50);
646
428
  }
647
- #findImg(viewElement) {
648
- if (!viewElement)
649
- return null;
650
- if (viewElement.is?.('element', 'img'))
651
- return viewElement;
652
- for (const child of viewElement.getChildren?.() ?? []) {
653
- if (child.is?.('element', 'img'))
654
- return child;
655
- }
656
- return null;
429
+ pruneRemoved() {
430
+ if (this.#destroyed)
431
+ return;
432
+ const active = this.engine.activeImageSources();
433
+ for (const src of this.#pending.keys())
434
+ if (!active.has(src))
435
+ this.#release(src);
436
+ }
437
+ invalidateWork() {
438
+ this.#generation++;
439
+ for (const validation of this.#validations)
440
+ validation.abort();
441
+ this.#validations.clear();
442
+ if (this.#immediateTimer !== undefined)
443
+ clearTimeout(this.#immediateTimer);
444
+ this.#immediateTimer = undefined;
445
+ this.#nextImmediate = false;
446
+ }
447
+ invalidateSource() {
448
+ this.invalidateWork();
449
+ for (const src of this.#pending.keys())
450
+ this.#release(src);
657
451
  }
658
- #transferHtmlAttrsToModel(viewImg, modelElement, conversionApi) {
659
- const schema = this.editor.model.schema;
660
- if (viewImg.hasAttribute('loading') && schema.checkAttribute(modelElement, 'loading')) {
661
- conversionApi.writer.setAttribute('loading', viewImg.getAttribute('loading'), modelElement);
662
- }
663
- if (viewImg.hasAttribute('id') && schema.checkAttribute(modelElement, 'imageId')) {
664
- conversionApi.writer.setAttribute('imageId', viewImg.getAttribute('id'), modelElement);
452
+ destroy() {
453
+ if (!this.#destroyed) {
454
+ this.invalidateSource();
455
+ this.#destroyed = true;
665
456
  }
666
457
  }
667
- #generateAlt(fileName) {
668
- if (!fileName)
669
- return 'Image';
670
- const nameWithoutExt = fileName.replace(/\.[^.]+$/, '');
671
- const result = nameWithoutExt
672
- .replace(/[-_.]+/g, ' ')
673
- .replace(/\s+/g, ' ')
674
- .trim();
675
- return result || 'Image';
458
+ #release(src) {
459
+ if (this.#pending.delete(src))
460
+ URL.revokeObjectURL(src);
461
+ }
462
+ #isCurrent(generation) {
463
+ return !this.#destroyed && generation === this.#generation;
676
464
  }
677
465
  }
678
466
 
679
467
  class SdEditor {
680
- // Injected
681
468
  #destroyRef = inject(DestroyRef);
682
469
  #cdRef = inject(ChangeDetectorRef);
683
470
  #uploadConfig = inject(SD_EDITOR_CONFIGURATION, { optional: true });
@@ -757,180 +544,182 @@ class SdEditor {
757
544
  return this.inlineError();
758
545
  return undefined;
759
546
  }
760
- Editor = ClassicEditor;
761
- #editor;
762
- #contentChangeSubject = new Subject();
763
- editorConfig = computed(() => {
764
- const opt = this.option();
765
- const uploadFn = this.#buildUploadFn();
766
- const enableImageUpload = !!uploadFn;
767
- const plugins = [Essentials, FontColor, FontSize, Paragraph, Bold, Italic, Underline, List, Undo, Widget, Alignment];
768
- if (enableImageUpload)
769
- plugins.push(EditorImageUploadPlugin);
770
- const toolbarItems = [
771
- 'bold',
772
- 'italic',
773
- 'underline',
774
- '|',
775
- 'fontSize',
776
- 'fontColor',
777
- '|',
778
- 'alignment:left',
779
- 'alignment:center',
780
- 'alignment:right',
781
- 'alignment:justify',
782
- '|',
783
- 'bulletedList',
784
- 'numberedList',
785
- ];
786
- if (enableImageUpload)
787
- toolbarItems.push('|', 'uploadImage');
788
- const config = {
789
- licenseKey: 'GPL',
790
- getOption: () => ({
791
- ...opt,
792
- uploadFn,
793
- onWarning: (msg) => this.#notifyService.warning(msg),
794
- // Truyền i18n service xuống CKEditor plugin (ngoài DI tree) để dịch warning messages
795
- _i18n: this.#i18n,
796
- }),
797
- plugins,
798
- toolbar: { items: toolbarItems, shouldNotGroupWhenFull: true },
799
- placeholder: this.placeholder(),
800
- fontColor: { columns: 5, documentColors: 10, colorPicker: { format: 'hex' } },
801
- fontSize: { options: [10, 11, 12, 14, 16, 18, 20], supportAllValues: true },
802
- };
803
- if (enableImageUpload) {
804
- config.image = {
805
- resizeUnit: '%',
806
- resizeOptions: [
807
- { name: 'resizeImage:100', value: '100', label: '100%' },
808
- { name: 'resizeImage:75', value: '75', label: '75%' },
809
- { name: 'resizeImage:50', value: '50', label: '50%' },
810
- { name: 'resizeImage:25', value: '25', label: '25%' },
811
- { name: 'resizeImage:original', value: null, label: 'Original' },
812
- ],
813
- toolbar: ['resizeImage', '|', 'imageStyle:alignBlockLeft', 'imageStyle:alignCenter', 'imageStyle:alignBlockRight'],
814
- };
815
- }
816
- return config;
817
- }, ...(ngDevMode ? [{ debugName: "editorConfig" }] : []));
547
+ sdImportWarning = output();
548
+ #diagnostics = signal([], ...(ngDevMode ? [{ debugName: "#diagnostics" }] : []));
549
+ importDiagnostics = this.#diagnostics.asReadonly();
550
+ surfaceContent = signal('', ...(ngDevMode ? [{ debugName: "surfaceContent" }] : []));
551
+ uploadEnabled = computed(() => !!this.#buildUploadFn(), ...(ngDevMode ? [{ debugName: "uploadEnabled" }] : []));
552
+ descriptionId = computed(() => `sd-editor-description-${Utilities.generateUuid()}`, ...(ngDevMode ? [{ debugName: "descriptionId" }] : []));
553
+ #engine;
554
+ #uploads;
555
+ #timer;
556
+ #pending;
557
+ #deadline;
558
+ #composing = false;
559
+ #destroyed = false;
818
560
  constructor() {
819
561
  this.#validateDuplicateConfigKeys();
820
- this.#setupEffects();
821
- this.#setupSubscriptions();
822
- this.#setupDestroy();
823
- }
824
- onReady = (editor) => {
825
- this.#editor = editor;
826
- const currentValue = this.valueModel();
827
- if (currentValue) {
828
- this.#setToEditor(currentValue);
829
- }
830
- if (this.formControl.disabled) {
831
- editor.enableReadOnlyMode('sd-editor');
832
- }
833
- if (this.readonly()) {
834
- editor.enableReadOnlyMode('sd-editor-readonly');
835
- }
836
- editor.model.document.registerPostFixer(writer => {
837
- let changed = false;
838
- for (const change of editor.model.document.differ.getChanges()) {
839
- if (change.type === 'insert' && (change.name === 'imageBlock' || change.name === 'imageInline')) {
840
- const element = change.position.nodeAfter;
841
- if (element && !element.hasAttribute('resizedWidth')) {
842
- writer.setAttribute('resizedWidth', '100%', element);
843
- changed = true;
844
- }
845
- }
846
- }
847
- return changed;
562
+ effect(() => {
563
+ const disabled = this.disabled();
564
+ if (disabled)
565
+ this.formControl.disable({ emitEvent: false });
566
+ else
567
+ this.formControl.enable({ emitEvent: false });
568
+ if (disabled)
569
+ this.#cancelWork();
570
+ });
571
+ effect(() => {
572
+ if (this.readonly())
573
+ this.#cancelWork();
574
+ });
575
+ effect(() => this.#setExternalContent(this.valueModel() ?? ''));
576
+ effect(() => {
577
+ this.required();
578
+ this.maxlength();
579
+ this.inlineError();
580
+ this.validator();
581
+ this.#updateValidators();
582
+ });
583
+ this.formControl.valueChanges.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((value) => {
584
+ const normalized = value ?? '';
585
+ this.#setExternalContent(normalized);
586
+ this.valueModel.set(normalized);
848
587
  });
849
- editor.model.document.on('change:data', () => this.#contentChangeSubject.next(editor.getData()));
850
- editor.editing.view.document.on('focus', evt => this.sdFocus.emit(evt.domEvent));
851
- editor.editing.view.document.on('blur', evt => {
852
- this.sdBlur.emit(evt.domEvent);
853
- this.formControl.markAsTouched();
588
+ this.formControl.statusChanges.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
589
+ if (this.formControl.disabled)
590
+ this.#cancelWork();
854
591
  this.#cdRef.markForCheck();
855
592
  });
856
- };
857
- focusEditor = () => this.#editor?.editing?.view?.focus?.();
858
- /**
859
- * Xử lý tải lên các file và trả về nội dung dữ liệu cuối cùng.
860
- * * @description
861
- * - Đối với các file upload chế độ 'deferred' (chỉ xử lý khi submit), cần @ViewChild component và gọi hàm upload() này.
862
- * - Hỗ trợ two-way binding.
863
- * - Hàm hỗ trợ trả ra data cuối cùng.
864
- * * @returns {Promise<string>} Nội dung cuối cùng được trích xuất từ sd-editor.
865
- */
866
- upload = async () => {
867
- await this.#uploadImages();
868
- return this.#getFromEditor();
869
- };
870
- // Editor Content
871
- #setToEditor(html) {
872
- this.#editor?.setData?.(this.#normalizeHtmlForEditor(html));
593
+ this.formControl.sdChanges.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => this.#cdRef.markForCheck());
594
+ this.#destroyRef.onDestroy(() => {
595
+ this.#destroyed = true;
596
+ this.#cancelCadence();
597
+ this.#uploads?.destroy();
598
+ this.#engine = undefined; // Surface owns engine destruction exactly once.
599
+ });
873
600
  }
874
- #getFromEditor() {
875
- // why: `upload()` trả HTML cuối cùng cho consumer lưu — cùng bộ lọc với luồng soạn thảo (D-032).
876
- return this.#editor ? sdSanitizeEditorHtml(this.#normalizeEditorToHtml(this.#editor.getData())) : '';
601
+ onEngineReady(engine) {
602
+ this.#cancelCadence();
603
+ this.#composing = false;
604
+ this.#uploads?.destroy();
605
+ this.#engine = engine;
606
+ this.#uploads = new SdEditorUploadManager(engine, () => ({ ...this.option().imageConfig, uploadFn: this.#buildUploadFn() }), message => this.#notifyService.warning(message), this.#i18n);
607
+ }
608
+ onSourceChange() {
609
+ this.#cancelCadence();
610
+ if (this.formControl.disabled || this.readonly())
611
+ this.#uploads?.invalidateWork();
612
+ else
613
+ this.#uploads?.invalidateSource();
614
+ }
615
+ onSurfaceChange(value) {
616
+ if (this.#destroyed || this.formControl.disabled || this.readonly())
617
+ return;
618
+ this.#uploads?.pruneRemoved();
619
+ this.#clearTimer();
620
+ this.#pending = value;
621
+ // Composition pauses an existing deadline; its final document replaces only
622
+ // the pending value. An ordinary edit starts a new 100ms debounce deadline.
623
+ if (!this.#composing || this.#deadline === undefined)
624
+ this.#deadline = Date.now() + 100;
625
+ if (!this.#composing)
626
+ this.#schedulePending();
627
+ }
628
+ onCompositionChange(composing) {
629
+ this.#composing = composing;
630
+ this.#clearTimer();
631
+ if (!composing)
632
+ this.#schedulePending();
633
+ }
634
+ #schedulePending() {
635
+ if (this.#pending === undefined || this.#deadline === undefined || this.#composing || this.#destroyed)
636
+ return;
637
+ this.#timer = setTimeout(() => {
638
+ this.#timer = undefined;
639
+ const value = this.#pending;
640
+ this.#pending = undefined;
641
+ this.#deadline = undefined;
642
+ if (value !== undefined && !this.#destroyed && !this.#composing && !this.formControl.disabled && !this.readonly())
643
+ this.#onEditorUserInput(value);
644
+ }, Math.max(0, this.#deadline - Date.now()));
645
+ }
646
+ onSurfaceFocus(event) {
647
+ this.sdFocus.emit(event);
648
+ }
649
+ onSurfaceBlur(event) {
650
+ this.sdBlur.emit(event);
651
+ this.formControl.markAsTouched();
652
+ this.#cdRef.markForCheck();
653
+ }
654
+ onDiagnostics(diagnostics) {
655
+ this.#diagnostics.set(diagnostics);
656
+ this.sdImportWarning.emit(diagnostics);
657
+ }
658
+ async onFilesSelected(files) {
659
+ if (this.formControl.disabled || this.readonly())
660
+ return;
661
+ await this.#uploads?.selectFiles(files);
877
662
  }
878
- // Normalize HTML từ bên ngoài -> format CKEditor.
879
- #normalizeHtmlForEditor = (html) => {
880
- if (!html) {
881
- return '';
882
- }
883
- let result = html;
884
- result = imageInlineStylesToClasses(result);
885
- return result;
663
+ focusEditor = () => {
664
+ if (!this.formControl.disabled)
665
+ this.#engine?.focus();
886
666
  };
887
- // Normalize HTML từ CKEditor → format HTML.
888
- #normalizeEditorToHtml = (html) => {
889
- if (!html) {
890
- return '';
667
+ upload = async () => {
668
+ if ((this.option().imageConfig?.uploadMode ?? 'deferred') === 'deferred') {
669
+ if (!this.#buildUploadFn())
670
+ throw new Error('No upload function configured for image upload');
671
+ await this.#uploads?.upload();
891
672
  }
892
- let result = html;
893
- result = imageClassesToInlineStyles(result);
894
- return result;
673
+ return this.#engine?.getHtml() ?? '';
895
674
  };
896
- // Xử lý binding 2 chiều
897
- #onModelSignalChange(html) {
898
- const v = html ?? '';
899
- if (this.formControl.value === v) {
675
+ #clearTimer() {
676
+ if (this.#timer !== undefined)
677
+ clearTimeout(this.#timer);
678
+ this.#timer = undefined;
679
+ }
680
+ #cancelCadence() {
681
+ this.#clearTimer();
682
+ this.#pending = undefined;
683
+ this.#deadline = undefined;
684
+ }
685
+ #cancelWork() {
686
+ this.#cancelCadence();
687
+ this.#uploads?.invalidateWork();
688
+ }
689
+ #setExternalContent(value) {
690
+ if (this.formControl.value !== value)
691
+ this.formControl.setValue(value, { emitEvent: false });
692
+ this._textLength.set(countTextLength(value));
693
+ this.formControl.updateValueAndValidity({ emitEvent: false });
694
+ if (this.#isCurrentContent(value))
900
695
  return;
696
+ this.#cancelCadence();
697
+ this.#uploads?.invalidateSource();
698
+ this.surfaceContent.set(value);
699
+ this.#engine?.setContent(value);
700
+ }
701
+ #isCurrentContent(value) {
702
+ if (!this.#engine)
703
+ return value === this.surfaceContent();
704
+ try {
705
+ return value === this.#engine.getContent();
901
706
  }
902
- this.formControl.setValue(v, { emitEvent: false });
903
- this._textLength.set(countTextLength(v));
904
- if (this.#editor) {
905
- this.#setToEditor(v);
707
+ catch {
708
+ return false;
906
709
  }
907
710
  }
908
- // Xử lý khi user soạn thảo
909
711
  #onEditorUserInput(rawHtml) {
910
- const normalized = imageClassesToInlineStyles(rawHtml);
911
- // why: HTML này đi thẳng vào form value, model và `sdChange`. Nội dung nạp từ ngoài (hoặc dán vào) có
912
- // thể mang `javascript:`, `on*`, `data:text/html` — lọc theo allowlist (D-032) trước khi phát ra.
913
- const out = sdSanitizeEditorHtml(normalized);
914
- this._textLength.set(countTextLength(out));
915
- if (this.formControl.value !== out) {
916
- this.formControl.setValue(out, { emitEvent: false });
917
- // why: bộ lọc đã sửa nội dung so với dữ liệu nạp vào — đánh dấu dirty để consumer biết cần lưu lại.
918
- if (out !== normalized)
712
+ const value = sdSanitizeEditorHtml(rawHtml);
713
+ this._textLength.set(countTextLength(value));
714
+ if (this.formControl.value !== value) {
715
+ this.formControl.setValue(value, { emitEvent: false });
716
+ if (value !== rawHtml)
919
717
  this.formControl.markAsDirty();
920
718
  }
921
719
  this.formControl.updateValueAndValidity({ emitEvent: false });
922
720
  this.formControl.sdChanges.next(true);
923
- this.valueModel.set(out);
924
- this.sdChange.emit(out);
925
- }
926
- // Xử lý nếu dev sử dụng form và set trực tiếp data
927
- #onFormGroupExternalChange(html) {
928
- const v = html ?? '';
929
- this.valueModel.set(v);
930
- this._textLength.set(countTextLength(v));
931
- if (this.#editor) {
932
- this.#setToEditor(v);
933
- }
721
+ this.valueModel.set(value);
722
+ this.sdChange.emit(value);
934
723
  }
935
724
  // Validators
936
725
  #requiredValidator() {
@@ -966,94 +755,6 @@ class SdEditor {
966
755
  this.formControl.setAsyncValidators(asyncValidators.length ? asyncValidators : null);
967
756
  this.formControl.updateValueAndValidity({ emitEvent: false });
968
757
  }
969
- // Setup
970
- #setupEffects() {
971
- // Lắng nghe disabled
972
- effect(() => {
973
- if (this.disabled()) {
974
- this.formControl.disable({ emitEvent: false });
975
- }
976
- else {
977
- this.formControl.enable({ emitEvent: false });
978
- }
979
- });
980
- // Lắng nghe readonly
981
- effect(() => {
982
- if (!this.#editor) {
983
- return;
984
- }
985
- if (this.readonly()) {
986
- this.#editor.enableReadOnlyMode('sd-editor-readonly');
987
- }
988
- else {
989
- this.#editor.disableReadOnlyMode('sd-editor-readonly');
990
- }
991
- });
992
- // Lắng nghe binđing 2 chiều model
993
- effect(() => this.#onModelSignalChange(this.valueModel()));
994
- // Lắng nghe validators
995
- effect(() => {
996
- this.required();
997
- this.maxlength();
998
- this.inlineError();
999
- this.validator();
1000
- this.#updateValidators();
1001
- });
1002
- }
1003
- #setupSubscriptions() {
1004
- // Đăng ký nếu dev sử dụng form để set data trực tiếp từ bên ngoài vào
1005
- this.formControl.valueChanges
1006
- .pipe(takeUntilDestroyed(this.#destroyRef))
1007
- .subscribe((val) => this.#onFormGroupExternalChange(val));
1008
- this.formControl.sdChanges.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => this.#cdRef.markForCheck());
1009
- // Đăng ký user gõ trong editor
1010
- this.#contentChangeSubject
1011
- .pipe(debounceTime(100), takeUntilDestroyed(this.#destroyRef))
1012
- .subscribe(rawHtml => this.#onEditorUserInput(rawHtml));
1013
- }
1014
- #setupDestroy() {
1015
- this.#destroyRef.onDestroy(() => {
1016
- this.#editor?.destroy?.();
1017
- });
1018
- }
1019
- // Helpers
1020
- #uploadImages = async () => {
1021
- const uploadMode = this.option()?.imageConfig?.uploadMode ?? 'deferred';
1022
- // Early return nếu không phải 'deferred' mode.
1023
- // Nếu trước đó là mode "deferred" mà mong muốn chuyển sang mode "immediate", dev chưa cần refactor code phía caller mà không ảnh hưởng đến logic.
1024
- if (uploadMode !== 'deferred')
1025
- return;
1026
- const uploadFn = this.#buildUploadFn();
1027
- if (!uploadFn) {
1028
- throw new Error('No upload function configured for image upload');
1029
- }
1030
- const plugin = this.#editor?.plugins?.get(EditorImageUploadPlugin);
1031
- if (!plugin || plugin.pendingFiles.size === 0)
1032
- return;
1033
- const { batchSize, maxConcurrent } = getBatchConfig(this.option());
1034
- const activeBlobUrls = this.#editor ? getActiveBlobUrls(this.#editor) : new Set();
1035
- const toUpload = filterActivePendingFiles(plugin.pendingFiles, activeBlobUrls);
1036
- // Capture trước await để tránh race condition: ảnh được chèn trong lúc chờ API
1037
- const processedBlobUrls = new Set(toUpload.map(([blobUrl]) => blobUrl));
1038
- const { replacements, failedBatches } = await runBatchUploads(toUpload, uploadFn, batchSize, maxConcurrent);
1039
- if (this.#editor) {
1040
- const lazyLoad = this.option()?.imageConfig?.lazyLoad ?? true;
1041
- for (const detail of replacements.values()) {
1042
- plugin.setMeta(detail.cdn, { name: detail.name, idOrKey: detail.idOrKey, lazyLoad });
1043
- }
1044
- applyReplacementsToEditor(this.#editor, replacements);
1045
- }
1046
- // Chỉ xóa đúng các entries đã được xử lý
1047
- for (const blobUrl of processedBlobUrls) {
1048
- plugin.pendingFiles.delete(blobUrl);
1049
- }
1050
- for (const [blobUrl, file] of failedBatches.flat()) {
1051
- plugin.pendingFiles.set(blobUrl, file);
1052
- }
1053
- if (failedBatches.length > 0) {
1054
- throw new Error(`Upload failed for ${failedBatches.flat().length} image(s)`);
1055
- }
1056
- };
1057
758
  #getConfigurations = () => {
1058
759
  const config = this.#uploadConfig;
1059
760
  if (!config) {
@@ -1088,12 +789,12 @@ class SdEditor {
1088
789
  return this.option()?.imageConfig?.uploadFn ?? this.#getSelectedConfig()?.upload;
1089
790
  };
1090
791
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdEditor, deps: [], target: i0.ɵɵFactoryTarget.Component });
1091
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: SdEditor, isStandalone: true, selector: "sd-editor", inputs: { option: { classPropertyName: "option", publicName: "option", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, maxlength: { classPropertyName: "maxlength", publicName: "maxlength", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, helperText: { classPropertyName: "helperText", publicName: "helperText", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, hideInlineError: { classPropertyName: "hideInlineError", publicName: "hideInlineError", isSignal: true, isRequired: false, transformFunction: null }, inlineError: { classPropertyName: "inlineError", publicName: "inlineError", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, validator: { classPropertyName: "validator", publicName: "validator", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, key: { classPropertyName: "key", publicName: "key", isSignal: true, isRequired: false, transformFunction: null }, autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, valueModel: { classPropertyName: "valueModel", publicName: "model", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueModel: "modelChange", sdChange: "sdChange", sdBlur: "sdBlur", sdFocus: "sdFocus" }, ngImport: i0, template: "<sd-ckeditor-styles />\r\n@let _label = label();\r\n@let _helperText = helperText();\r\n@let _hideInlineError = hideInlineError();\r\n@let _errorMessage = errorMessage;\r\n@let _required = required();\r\n@let _maxLength = maxlength();\r\n@let _showCounter = !!_maxLength && !formControl.disabled && !_hideInlineError;\r\n\r\n@if (_label) {\r\n <sd-label [label]=\"_label\" [required]=\"_required\" [helperText]=\"_helperText\"></sd-label>\r\n}\r\n\r\n<div\r\n class=\"sd-editor\"\r\n [class.sd-editor--readonly]=\"readonly()\"\r\n [class.sd-editor--error]=\"formControl.invalid && formControl.touched\"\r\n [class.has-counter]=\"_showCounter\"\r\n [style.--sd-editor-content-min-height]=\"height()\"\r\n [style.--sd-editor-content-max-height]=\"maxHeight()\"\r\n [attr.data-autoId]=\"autoId()\"\r\n [attr.data-disabled]=\"dataDisabled()\"\r\n [attr.data-empty]=\"dataEmpty()\">\r\n <ckeditor [editor]=\"Editor\" [config]=\"editorConfig()\" [disabled]=\"formControl.disabled\" (ready)=\"onReady($event)\"></ckeditor>\r\n\r\n @if (_showCounter) {\r\n <div class=\"sd-editor-counter-row\">\r\n <span class=\"sd-editor-counter\" [class.sd-editor-counter--over]=\"isOverLimit()\"> {{ _textLength() }}/{{ _maxLength }} </span>\r\n </div>\r\n }\r\n\r\n @if (_hideInlineError && _errorMessage && formControl.touched) {\r\n <sd-icon 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\">{{ _errorMessage }}</span>\r\r\n }\r\n</div>\r\n\r\n<div class=\"sd-editor-footer\">\r\n @if (!_hideInlineError && _errorMessage && formControl.touched) {\r\n <mat-error>{{ _errorMessage }}</mat-error>\r\n }\r\n</div>\r\n", styles: [".sd-editor{display:flex;flex-direction:column;width:100%;position:relative}.sd-editor-counter-row{display:flex;justify-content:flex-end;align-items:center;padding:4px 12px;border:1px solid var(--ck-color-base-border);border-top:none}.sd-editor-footer{min-height:20px;margin-top:4px}.sd-editor-footer mat-error{font-size:var(--sd-font-size-12, 12px);color:var(--mdc-theme-error, #f44336)}.sd-error-icon{position:absolute;right:8px;bottom:8px;z-index:2;color:var(--mdc-theme-error, #f44336);height:20px;width:20px;font-size:var(--sd-font-size-20, 20px);cursor:default}.sd-editor--readonly :host ::ng-deep .ck-editor__editable{background:#0000000a;cursor:default}.sd-editor-counter{font-size:var(--sd-font-size-12, 12px);color:#0009}.sd-editor-counter--over{color:var(--mdc-theme-error, #f44336)}::ng-deep .ck-powered-by,::ng-deep .ck-powered-by-balloon{display:none!important}:host ::ng-deep ckeditor,:host ::ng-deep .ck-editor{display:flex;flex-direction:column}:host ::ng-deep .ck-editor{--ck-content-font-size: 14px;--ck-content-line-height: 1.5}:host ::ng-deep .ck-editor__main{overflow:visible}:host ::ng-deep .ck-editor__editable{min-height:var(--sd-editor-content-min-height, 200px)!important;max-height:var(--sd-editor-content-max-height, none)!important;padding:24px!important;overflow-y:auto!important;border:1px solid var(--ck-color-base-border)!important}:host ::ng-deep .ck-editor__editable.ck-focused{box-shadow:none!important}:host ::ng-deep .sd-editor.has-counter .ck-editor__editable{border-bottom:none!important}:host ::ng-deep .sd-editor--error .ck-editor__editable,:host ::ng-deep .sd-editor--error .ck-toolbar{border-color:var(--mdc-theme-error, #f44336)!important}:host ::ng-deep .sd-editor--error.has-counter .sd-editor-counter-row{border-color:var(--mdc-theme-error, #f44336)}:host ::ng-deep .ck-content p{margin-bottom:var(--ck-spacing-large);text-indent:0}:host ::ng-deep .ck-content ul,:host ::ng-deep .ck-content ol{margin-left:0!important;padding-left:20px!important}\n", ":host ::ng-deep .ck-content img{max-width:100%!important;height:auto!important;object-fit:contain}:host ::ng-deep .ck-content figure.image{position:relative;display:block;width:fit-content;max-width:100%;margin:0 auto;overflow:visible}:host ::ng-deep .ck-content figure.image:hover{z-index:99999!important}:host ::ng-deep .ck-content figure.image.image-style-align-left{float:left;margin:0 1em 0 0}:host ::ng-deep .ck-content figure.image.image-style-align-left[style*=\"width:100\"]{float:none;margin:0 auto 0 0}:host ::ng-deep .ck-content figure.image.image-style-align-right{float:right;margin:0 0 0 1em}:host ::ng-deep .ck-content figure.image.image-style-align-right[style*=\"width:100\"]{float:none;margin:0 0 0 auto}:host ::ng-deep .ck-content figure.image.image-style-block-align-left{margin:0 auto 0 0}:host ::ng-deep .ck-content figure.image.image-style-block-align-right{margin:0 0 0 auto}:host ::ng-deep .ck-content figure.image .ck-progress-bar{position:absolute;bottom:0;left:0;width:30%!important;height:3px;background:var(--sd-primary, #005cbb);border-radius:var(--sd-radius-2, 2px);z-index:10;pointer-events:none;animation:sd-progress-indeterminate 1.4s ease-in-out infinite}:host ::ng-deep .ck-content figure.image:has(.ck-progress-bar){overflow:hidden}:host ::ng-deep .ck-content figure.image:has(.ck-progress-bar) img{filter:blur(1px) brightness(.85);transition:filter var(--sd-duration-slow, .3s) ease}:host ::ng-deep .ck-content figure.image:has(.ck-progress-bar):after{content:\"\";position:absolute;inset:0;display:flex;align-items:center;justify-content:center;z-index:9;background:#ffffff40;border-radius:inherit}:host ::ng-deep .ck-content figure.image:has(.ck-progress-bar):before{content:\"\";position:absolute;top:50%;left:50%;width:28px;height:28px;margin:-14px 0 0 -14px;border:3px solid rgba(255,255,255,.5);border-top-color:var(--sd-primary, #005cbb);border-radius:50%;animation:sd-spinner .75s linear infinite;z-index:11;pointer-events:none}@keyframes sd-spinner{to{transform:rotate(360deg)}}@keyframes sd-progress-indeterminate{0%{left:-30%}to{left:100%}}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CKEditorModule }, { kind: "component", type: i1.CKEditorComponent, selector: "ckeditor", inputs: ["editor", "config", "data", "tagName", "watchdog", "editorWatchdogConfig", "disableWatchdog", "disableTwoWayDataBinding", "disabled"], outputs: ["ready", "change", "blur", "focus", "error"] }, { kind: "component", type: SdLabel, selector: "sd-label", inputs: ["label", "description", "required", "helperText", "for", "labelId"] }, { kind: "component", type: SdCKEditorStyles, selector: "sd-ckeditor-styles" }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "directive", type: i2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i3.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
792
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: SdEditor, isStandalone: true, selector: "sd-editor", inputs: { option: { classPropertyName: "option", publicName: "option", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, maxlength: { classPropertyName: "maxlength", publicName: "maxlength", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, helperText: { classPropertyName: "helperText", publicName: "helperText", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, hideInlineError: { classPropertyName: "hideInlineError", publicName: "hideInlineError", isSignal: true, isRequired: false, transformFunction: null }, inlineError: { classPropertyName: "inlineError", publicName: "inlineError", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, validator: { classPropertyName: "validator", publicName: "validator", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, key: { classPropertyName: "key", publicName: "key", isSignal: true, isRequired: false, transformFunction: null }, autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, valueModel: { classPropertyName: "valueModel", publicName: "model", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueModel: "modelChange", sdChange: "sdChange", sdBlur: "sdBlur", sdFocus: "sdFocus", sdImportWarning: "sdImportWarning" }, ngImport: i0, template: "@let _label = label();\n@let _helperText = helperText();\n@let _hideInlineError = hideInlineError();\n@let _errorMessage = errorMessage;\n@let _required = required();\n@let _maxLength = maxlength();\n@let _showCounter = !!_maxLength && !formControl.disabled && !_hideInlineError;\n\n@if (_label) {\n <sd-label [label]=\"_label\" [required]=\"_required\" [helperText]=\"_helperText\"></sd-label>\n}\n\n<div\n class=\"sd-editor\"\n [class.sd-editor--readonly]=\"readonly()\"\n [class.sd-editor--error]=\"formControl.invalid && formControl.touched\"\n [class.has-counter]=\"_showCounter\"\n [style.--sd-editor-content-min-height]=\"height()\"\n [style.--sd-editor-content-max-height]=\"maxHeight()\"\n [attr.data-autoId]=\"autoId()\"\n [attr.data-disabled]=\"dataDisabled()\"\n [attr.data-empty]=\"dataEmpty()\">\n <sd-editor-surface\n variant=\"full\"\n [content]=\"surfaceContent()\"\n [editable]=\"!formControl.disabled && !readonly()\"\n [disabled]=\"formControl.disabled\"\n [readonly]=\"readonly()\"\n [placeholder]=\"placeholder()\"\n [height]=\"height()\"\n [maxHeight]=\"maxHeight()\"\n [uploadEnabled]=\"uploadEnabled()\"\n [label]=\"label()\"\n [describedBy]=\"helperText() || (_errorMessage && formControl.touched) ? descriptionId() : undefined\"\n [invalid]=\"formControl.invalid && formControl.touched\"\n (engineReady)=\"onEngineReady($event)\"\n (sourceChange)=\"onSourceChange()\"\n (change)=\"onSurfaceChange($event)\"\n (compositionChange)=\"onCompositionChange($event)\"\n (focus)=\"onSurfaceFocus($event)\"\n (blur)=\"onSurfaceBlur($event)\"\n (diagnostics)=\"onDiagnostics($event)\"\n (filesSelected)=\"onFilesSelected($event)\" />\n\n @if (_showCounter) {\n <div class=\"sd-editor-counter-row\">\n <span class=\"sd-editor-counter\" [class.sd-editor-counter--over]=\"isOverLimit()\"> {{ _textLength() }}/{{ _maxLength }} </span>\n </div>\n }\n\n @if (_hideInlineError && _errorMessage && formControl.touched) {\n <sd-icon class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\n }\n @if (_hideInlineError && _errorMessage && formControl.touched) {\n <span class=\"sd-visually-hidden\">{{ _errorMessage }}</span>\n }\n</div>\n\n<div class=\"sd-editor-footer\">\n @if (!_hideInlineError && _errorMessage && formControl.touched) {\n <mat-error>{{ _errorMessage }}</mat-error>\n }\n</div>\n\n@if (_helperText || (_errorMessage && formControl.touched)) {\n <span class=\"sd-visually-hidden\" [id]=\"descriptionId()\">{{ _helperText }} {{ formControl.touched ? _errorMessage : '' }}</span>\n}\n", styles: [".sd-editor{display:flex;flex-direction:column;width:100%;position:relative}.sd-editor-counter-row{display:flex;justify-content:flex-end;padding:4px 12px;border:1px solid var(--sd-border-color, #d1d5db);border-top:none}.sd-editor-counter{font-size:var(--sd-font-size-12, 12px);color:var(--sd-text-muted, #666)}.sd-editor-counter--over{color:var(--mdc-theme-error, #f44336)}.sd-editor-footer{min-height:20px;margin-top:4px}.sd-editor-footer mat-error{font-size:var(--sd-font-size-12, 12px);color:var(--mdc-theme-error, #f44336)}.sd-error-icon{position:absolute;right:8px;bottom:8px;z-index:2;color:var(--mdc-theme-error, #f44336);height:20px;width:20px;font-size:var(--sd-font-size-20, 20px)}.sd-visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdEditorSurface, selector: "sd-editor-surface", inputs: ["content", "format", "variant", "editable", "disabled", "readonly", "placeholder", "mentionFeeds", "uploadEnabled", "height", "maxHeight", "label", "describedBy", "invalid", "id"], outputs: ["engineReady", "change", "focus", "blur", "diagnostics", "sourceChange", "formatChange", "compositionChange", "mentionSelected", "filesSelected"] }, { kind: "component", type: SdLabel, selector: "sd-label", inputs: ["label", "description", "required", "helperText", "for", "labelId"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "directive", type: i1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i2.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1092
793
  }
1093
794
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdEditor, decorators: [{
1094
795
  type: Component,
1095
- args: [{ selector: 'sd-editor', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon, CKEditorModule, SdLabel, SdCKEditorStyles, MatFormFieldModule, MatTooltipModule], template: "<sd-ckeditor-styles />\r\n@let _label = label();\r\n@let _helperText = helperText();\r\n@let _hideInlineError = hideInlineError();\r\n@let _errorMessage = errorMessage;\r\n@let _required = required();\r\n@let _maxLength = maxlength();\r\n@let _showCounter = !!_maxLength && !formControl.disabled && !_hideInlineError;\r\n\r\n@if (_label) {\r\n <sd-label [label]=\"_label\" [required]=\"_required\" [helperText]=\"_helperText\"></sd-label>\r\n}\r\n\r\n<div\r\n class=\"sd-editor\"\r\n [class.sd-editor--readonly]=\"readonly()\"\r\n [class.sd-editor--error]=\"formControl.invalid && formControl.touched\"\r\n [class.has-counter]=\"_showCounter\"\r\n [style.--sd-editor-content-min-height]=\"height()\"\r\n [style.--sd-editor-content-max-height]=\"maxHeight()\"\r\n [attr.data-autoId]=\"autoId()\"\r\n [attr.data-disabled]=\"dataDisabled()\"\r\n [attr.data-empty]=\"dataEmpty()\">\r\n <ckeditor [editor]=\"Editor\" [config]=\"editorConfig()\" [disabled]=\"formControl.disabled\" (ready)=\"onReady($event)\"></ckeditor>\r\n\r\n @if (_showCounter) {\r\n <div class=\"sd-editor-counter-row\">\r\n <span class=\"sd-editor-counter\" [class.sd-editor-counter--over]=\"isOverLimit()\"> {{ _textLength() }}/{{ _maxLength }} </span>\r\n </div>\r\n }\r\n\r\n @if (_hideInlineError && _errorMessage && formControl.touched) {\r\n <sd-icon 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\">{{ _errorMessage }}</span>\r\r\n }\r\n</div>\r\n\r\n<div class=\"sd-editor-footer\">\r\n @if (!_hideInlineError && _errorMessage && formControl.touched) {\r\n <mat-error>{{ _errorMessage }}</mat-error>\r\n }\r\n</div>\r\n", styles: [".sd-editor{display:flex;flex-direction:column;width:100%;position:relative}.sd-editor-counter-row{display:flex;justify-content:flex-end;align-items:center;padding:4px 12px;border:1px solid var(--ck-color-base-border);border-top:none}.sd-editor-footer{min-height:20px;margin-top:4px}.sd-editor-footer mat-error{font-size:var(--sd-font-size-12, 12px);color:var(--mdc-theme-error, #f44336)}.sd-error-icon{position:absolute;right:8px;bottom:8px;z-index:2;color:var(--mdc-theme-error, #f44336);height:20px;width:20px;font-size:var(--sd-font-size-20, 20px);cursor:default}.sd-editor--readonly :host ::ng-deep .ck-editor__editable{background:#0000000a;cursor:default}.sd-editor-counter{font-size:var(--sd-font-size-12, 12px);color:#0009}.sd-editor-counter--over{color:var(--mdc-theme-error, #f44336)}::ng-deep .ck-powered-by,::ng-deep .ck-powered-by-balloon{display:none!important}:host ::ng-deep ckeditor,:host ::ng-deep .ck-editor{display:flex;flex-direction:column}:host ::ng-deep .ck-editor{--ck-content-font-size: 14px;--ck-content-line-height: 1.5}:host ::ng-deep .ck-editor__main{overflow:visible}:host ::ng-deep .ck-editor__editable{min-height:var(--sd-editor-content-min-height, 200px)!important;max-height:var(--sd-editor-content-max-height, none)!important;padding:24px!important;overflow-y:auto!important;border:1px solid var(--ck-color-base-border)!important}:host ::ng-deep .ck-editor__editable.ck-focused{box-shadow:none!important}:host ::ng-deep .sd-editor.has-counter .ck-editor__editable{border-bottom:none!important}:host ::ng-deep .sd-editor--error .ck-editor__editable,:host ::ng-deep .sd-editor--error .ck-toolbar{border-color:var(--mdc-theme-error, #f44336)!important}:host ::ng-deep .sd-editor--error.has-counter .sd-editor-counter-row{border-color:var(--mdc-theme-error, #f44336)}:host ::ng-deep .ck-content p{margin-bottom:var(--ck-spacing-large);text-indent:0}:host ::ng-deep .ck-content ul,:host ::ng-deep .ck-content ol{margin-left:0!important;padding-left:20px!important}\n", ":host ::ng-deep .ck-content img{max-width:100%!important;height:auto!important;object-fit:contain}:host ::ng-deep .ck-content figure.image{position:relative;display:block;width:fit-content;max-width:100%;margin:0 auto;overflow:visible}:host ::ng-deep .ck-content figure.image:hover{z-index:99999!important}:host ::ng-deep .ck-content figure.image.image-style-align-left{float:left;margin:0 1em 0 0}:host ::ng-deep .ck-content figure.image.image-style-align-left[style*=\"width:100\"]{float:none;margin:0 auto 0 0}:host ::ng-deep .ck-content figure.image.image-style-align-right{float:right;margin:0 0 0 1em}:host ::ng-deep .ck-content figure.image.image-style-align-right[style*=\"width:100\"]{float:none;margin:0 0 0 auto}:host ::ng-deep .ck-content figure.image.image-style-block-align-left{margin:0 auto 0 0}:host ::ng-deep .ck-content figure.image.image-style-block-align-right{margin:0 0 0 auto}:host ::ng-deep .ck-content figure.image .ck-progress-bar{position:absolute;bottom:0;left:0;width:30%!important;height:3px;background:var(--sd-primary, #005cbb);border-radius:var(--sd-radius-2, 2px);z-index:10;pointer-events:none;animation:sd-progress-indeterminate 1.4s ease-in-out infinite}:host ::ng-deep .ck-content figure.image:has(.ck-progress-bar){overflow:hidden}:host ::ng-deep .ck-content figure.image:has(.ck-progress-bar) img{filter:blur(1px) brightness(.85);transition:filter var(--sd-duration-slow, .3s) ease}:host ::ng-deep .ck-content figure.image:has(.ck-progress-bar):after{content:\"\";position:absolute;inset:0;display:flex;align-items:center;justify-content:center;z-index:9;background:#ffffff40;border-radius:inherit}:host ::ng-deep .ck-content figure.image:has(.ck-progress-bar):before{content:\"\";position:absolute;top:50%;left:50%;width:28px;height:28px;margin:-14px 0 0 -14px;border:3px solid rgba(255,255,255,.5);border-top-color:var(--sd-primary, #005cbb);border-radius:50%;animation:sd-spinner .75s linear infinite;z-index:11;pointer-events:none}@keyframes sd-spinner{to{transform:rotate(360deg)}}@keyframes sd-progress-indeterminate{0%{left:-30%}to{left:100%}}\n"] }]
1096
- }], ctorParameters: () => [], propDecorators: { option: [{ type: i0.Input, args: [{ isSignal: true, alias: "option", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }], maxlength: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxlength", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], helperText: [{ type: i0.Input, args: [{ isSignal: true, alias: "helperText", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], hideInlineError: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideInlineError", required: false }] }], inlineError: [{ type: i0.Input, args: [{ isSignal: true, alias: "inlineError", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], validator: [{ type: i0.Input, args: [{ isSignal: true, alias: "validator", required: false }] }], form: [{ type: i0.Input, args: [{ isSignal: true, alias: "form", required: false }] }], key: [{ type: i0.Input, args: [{ isSignal: true, alias: "key", required: false }] }], autoIdInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], valueModel: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: false }] }, { type: i0.Output, args: ["modelChange"] }], sdChange: [{ type: i0.Output, args: ["sdChange"] }], sdBlur: [{ type: i0.Output, args: ["sdBlur"] }], sdFocus: [{ type: i0.Output, args: ["sdFocus"] }] } });
796
+ args: [{ selector: 'sd-editor', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon, SdEditorSurface, SdLabel, MatFormFieldModule, MatTooltipModule], template: "@let _label = label();\n@let _helperText = helperText();\n@let _hideInlineError = hideInlineError();\n@let _errorMessage = errorMessage;\n@let _required = required();\n@let _maxLength = maxlength();\n@let _showCounter = !!_maxLength && !formControl.disabled && !_hideInlineError;\n\n@if (_label) {\n <sd-label [label]=\"_label\" [required]=\"_required\" [helperText]=\"_helperText\"></sd-label>\n}\n\n<div\n class=\"sd-editor\"\n [class.sd-editor--readonly]=\"readonly()\"\n [class.sd-editor--error]=\"formControl.invalid && formControl.touched\"\n [class.has-counter]=\"_showCounter\"\n [style.--sd-editor-content-min-height]=\"height()\"\n [style.--sd-editor-content-max-height]=\"maxHeight()\"\n [attr.data-autoId]=\"autoId()\"\n [attr.data-disabled]=\"dataDisabled()\"\n [attr.data-empty]=\"dataEmpty()\">\n <sd-editor-surface\n variant=\"full\"\n [content]=\"surfaceContent()\"\n [editable]=\"!formControl.disabled && !readonly()\"\n [disabled]=\"formControl.disabled\"\n [readonly]=\"readonly()\"\n [placeholder]=\"placeholder()\"\n [height]=\"height()\"\n [maxHeight]=\"maxHeight()\"\n [uploadEnabled]=\"uploadEnabled()\"\n [label]=\"label()\"\n [describedBy]=\"helperText() || (_errorMessage && formControl.touched) ? descriptionId() : undefined\"\n [invalid]=\"formControl.invalid && formControl.touched\"\n (engineReady)=\"onEngineReady($event)\"\n (sourceChange)=\"onSourceChange()\"\n (change)=\"onSurfaceChange($event)\"\n (compositionChange)=\"onCompositionChange($event)\"\n (focus)=\"onSurfaceFocus($event)\"\n (blur)=\"onSurfaceBlur($event)\"\n (diagnostics)=\"onDiagnostics($event)\"\n (filesSelected)=\"onFilesSelected($event)\" />\n\n @if (_showCounter) {\n <div class=\"sd-editor-counter-row\">\n <span class=\"sd-editor-counter\" [class.sd-editor-counter--over]=\"isOverLimit()\"> {{ _textLength() }}/{{ _maxLength }} </span>\n </div>\n }\n\n @if (_hideInlineError && _errorMessage && formControl.touched) {\n <sd-icon class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\n }\n @if (_hideInlineError && _errorMessage && formControl.touched) {\n <span class=\"sd-visually-hidden\">{{ _errorMessage }}</span>\n }\n</div>\n\n<div class=\"sd-editor-footer\">\n @if (!_hideInlineError && _errorMessage && formControl.touched) {\n <mat-error>{{ _errorMessage }}</mat-error>\n }\n</div>\n\n@if (_helperText || (_errorMessage && formControl.touched)) {\n <span class=\"sd-visually-hidden\" [id]=\"descriptionId()\">{{ _helperText }} {{ formControl.touched ? _errorMessage : '' }}</span>\n}\n", styles: [".sd-editor{display:flex;flex-direction:column;width:100%;position:relative}.sd-editor-counter-row{display:flex;justify-content:flex-end;padding:4px 12px;border:1px solid var(--sd-border-color, #d1d5db);border-top:none}.sd-editor-counter{font-size:var(--sd-font-size-12, 12px);color:var(--sd-text-muted, #666)}.sd-editor-counter--over{color:var(--mdc-theme-error, #f44336)}.sd-editor-footer{min-height:20px;margin-top:4px}.sd-editor-footer mat-error{font-size:var(--sd-font-size-12, 12px);color:var(--mdc-theme-error, #f44336)}.sd-error-icon{position:absolute;right:8px;bottom:8px;z-index:2;color:var(--mdc-theme-error, #f44336);height:20px;width:20px;font-size:var(--sd-font-size-20, 20px)}.sd-visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}\n"] }]
797
+ }], ctorParameters: () => [], propDecorators: { option: [{ type: i0.Input, args: [{ isSignal: true, alias: "option", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }], maxlength: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxlength", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], helperText: [{ type: i0.Input, args: [{ isSignal: true, alias: "helperText", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], hideInlineError: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideInlineError", required: false }] }], inlineError: [{ type: i0.Input, args: [{ isSignal: true, alias: "inlineError", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], validator: [{ type: i0.Input, args: [{ isSignal: true, alias: "validator", required: false }] }], form: [{ type: i0.Input, args: [{ isSignal: true, alias: "form", required: false }] }], key: [{ type: i0.Input, args: [{ isSignal: true, alias: "key", required: false }] }], autoIdInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], valueModel: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: false }] }, { type: i0.Output, args: ["modelChange"] }], sdChange: [{ type: i0.Output, args: ["sdChange"] }], sdBlur: [{ type: i0.Output, args: ["sdBlur"] }], sdFocus: [{ type: i0.Output, args: ["sdFocus"] }], sdImportWarning: [{ type: i0.Output, args: ["sdImportWarning"] }] } });
1097
798
 
1098
799
  /**
1099
800
  * Generated bundle index. Do not edit.