@tft/crispr-forms 14.0.2 → 17.0.0

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 (490) hide show
  1. package/esm2022/public-api.mjs +4 -0
  2. package/{esm2020 → esm2022}/src/index.mjs +1 -1
  3. package/esm2022/src/lib/crispr-forms.module.mjs +55 -0
  4. package/esm2022/src/lib/display-field.directive.mjs +52 -0
  5. package/esm2022/src/lib/field-component-map.const.mjs +28 -0
  6. package/esm2022/src/lib/field.directive.mjs +69 -0
  7. package/esm2022/src/lib/form/form.component.mjs +62 -0
  8. package/esm2022/src/lib/form-group-list/form-group-list.component.mjs +97 -0
  9. package/{esm2020 → esm2022}/src/lib/form-group-list/index.mjs +1 -1
  10. package/{esm2020 → esm2022}/src/lib/pipes/crispr-pipes.module.mjs +24 -24
  11. package/esm2022/src/lib/pipes/initial-control-value.pipe.mjs +20 -0
  12. package/{esm2020 → esm2022}/src/lib/public_api.mjs +2 -2
  13. package/{esm2020 → esm2022}/src/lib/sub-group/index.mjs +2 -2
  14. package/esm2022/src/lib/sub-group/sub-group.component.mjs +20 -0
  15. package/esm2022/src/lib/sub-group/sub-group.module.mjs +42 -0
  16. package/esm2022/src/lib/ui/autocomplete-chiplist-field/autocomplete-chiplist-field.component.mjs +138 -0
  17. package/esm2022/src/lib/ui/autocomplete-chiplist-field/index.mjs +2 -0
  18. package/esm2022/src/lib/ui/autocomplete-chiplist-field/public-api.mjs +2 -0
  19. package/esm2022/src/lib/ui/autocomplete-field/autocomplete-field.component.mjs +95 -0
  20. package/esm2022/src/lib/ui/autocomplete-field/index.mjs +2 -0
  21. package/esm2022/src/lib/ui/autocomplete-field/public-api.mjs +2 -0
  22. package/esm2022/src/lib/ui/button/button.component.mjs +52 -0
  23. package/esm2022/src/lib/ui/button/index.mjs +2 -0
  24. package/esm2022/src/lib/ui/button/public-api.mjs +2 -0
  25. package/esm2022/src/lib/ui/checkbox-field/checkbox-field.component.mjs +42 -0
  26. package/esm2022/src/lib/ui/checkbox-field/index.mjs +2 -0
  27. package/esm2022/src/lib/ui/checkbox-field/public-api.mjs +2 -0
  28. package/esm2022/src/lib/ui/datepicker-field/datepicker-field.component.mjs +66 -0
  29. package/esm2022/src/lib/ui/datepicker-field/index.mjs +2 -0
  30. package/esm2022/src/lib/ui/datepicker-field/public-api.mjs +2 -0
  31. package/esm2022/src/lib/ui/divider/divider.component.mjs +25 -0
  32. package/esm2022/src/lib/ui/divider/index.mjs +2 -0
  33. package/esm2022/src/lib/ui/divider/public-api.mjs +2 -0
  34. package/esm2022/src/lib/ui/field-container/field-container.component.mjs +59 -0
  35. package/esm2022/src/lib/ui/field-container/index.mjs +2 -0
  36. package/esm2022/src/lib/ui/field-container/public-api.mjs +2 -0
  37. package/esm2022/src/lib/ui/file-dropzone/file-dropzone.directive.mjs +40 -0
  38. package/esm2022/src/lib/ui/file-dropzone/index.mjs +2 -0
  39. package/esm2022/src/lib/ui/file-dropzone/public-api.mjs +2 -0
  40. package/esm2022/src/lib/ui/file-upload-field/file-upload-field.component.mjs +107 -0
  41. package/esm2022/src/lib/ui/file-upload-field/index.mjs +2 -0
  42. package/esm2022/src/lib/ui/file-upload-field/public-api.mjs +2 -0
  43. package/esm2022/src/lib/ui/heading/heading.component.mjs +27 -0
  44. package/esm2022/src/lib/ui/heading/index.mjs +2 -0
  45. package/esm2022/src/lib/ui/heading/public-api.mjs +2 -0
  46. package/esm2022/src/lib/ui/image-upload-field/image-upload-field.component.mjs +184 -0
  47. package/esm2022/src/lib/ui/image-upload-field/index.mjs +2 -0
  48. package/esm2022/src/lib/ui/image-upload-field/public-api.mjs +2 -0
  49. package/esm2022/src/lib/ui/index.mjs +2 -0
  50. package/esm2022/src/lib/ui/info/index.mjs +2 -0
  51. package/esm2022/src/lib/ui/info/info.component.mjs +23 -0
  52. package/esm2022/src/lib/ui/info/public-api.mjs +2 -0
  53. package/esm2022/src/lib/ui/input-field/index.mjs +2 -0
  54. package/esm2022/src/lib/ui/input-field/input-field.component.mjs +43 -0
  55. package/esm2022/src/lib/ui/input-field/public-api.mjs +2 -0
  56. package/esm2022/src/lib/ui/option/index.mjs +2 -0
  57. package/esm2022/src/lib/ui/option/option.component.mjs +16 -0
  58. package/esm2022/src/lib/ui/option/public-api.mjs +2 -0
  59. package/esm2022/src/lib/ui/public-api.mjs +7 -0
  60. package/esm2022/src/lib/ui/radio-field/index.mjs +2 -0
  61. package/esm2022/src/lib/ui/radio-field/public-api.mjs +2 -0
  62. package/esm2022/src/lib/ui/radio-field/radio-field.component.mjs +39 -0
  63. package/esm2022/src/lib/ui/select-field/index.mjs +2 -0
  64. package/esm2022/src/lib/ui/select-field/public-api.mjs +2 -0
  65. package/esm2022/src/lib/ui/select-field/select-field.component.mjs +73 -0
  66. package/esm2022/src/lib/ui/selected-file/index.mjs +2 -0
  67. package/esm2022/src/lib/ui/selected-file/public-api.mjs +2 -0
  68. package/esm2022/src/lib/ui/selected-file/selected-file.component.mjs +26 -0
  69. package/esm2022/src/lib/ui/slider-field/index.mjs +2 -0
  70. package/esm2022/src/lib/ui/slider-field/public-api.mjs +2 -0
  71. package/esm2022/src/lib/ui/slider-field/slider-field.component.mjs +46 -0
  72. package/esm2022/src/lib/ui/textarea-field/index.mjs +2 -0
  73. package/esm2022/src/lib/ui/textarea-field/public-api.mjs +2 -0
  74. package/esm2022/src/lib/ui/textarea-field/textarea-field.component.mjs +42 -0
  75. package/esm2022/src/lib/ui/unit-conversion-field/index.mjs +2 -0
  76. package/esm2022/src/lib/ui/unit-conversion-field/public-api.mjs +2 -0
  77. package/esm2022/src/lib/ui/unit-conversion-field/unit-conversion-field.component.mjs +86 -0
  78. package/esm2022/src/lib/utils/abstracts/autocomplete-field.abstract.mjs +30 -0
  79. package/esm2022/src/lib/utils/abstracts/crispr-control.mixin.mjs +27 -0
  80. package/esm2022/src/lib/utils/abstracts/crispr-display-field.abstract.mjs +14 -0
  81. package/esm2022/src/lib/utils/abstracts/crispr-field.abstract.mjs +19 -0
  82. package/esm2022/src/lib/utils/abstracts/index.mjs +5 -0
  83. package/esm2022/src/lib/utils/functions/buildFormGroupFromConfig.mjs +28 -0
  84. package/esm2022/src/lib/utils/functions/callOptionsIfFunction.mjs +4 -0
  85. package/esm2022/src/lib/utils/functions/createControlForType.mjs +19 -0
  86. package/esm2022/src/lib/utils/functions/filterOptionsByLabel.mjs +11 -0
  87. package/esm2022/src/lib/utils/functions/image-compression.helpers.mjs +50 -0
  88. package/esm2022/src/lib/utils/functions/index.mjs +8 -0
  89. package/esm2022/src/lib/utils/functions/isControlConfig.mjs +7 -0
  90. package/esm2022/src/lib/utils/functions/observablifyOptions.mjs +29 -0
  91. package/esm2022/src/lib/utils/index.mjs +2 -0
  92. package/esm2022/src/lib/utils/models/autocomplete-chiplist-field.config.mjs +2 -0
  93. package/esm2022/src/lib/utils/models/autocomplete-field.config.mjs +2 -0
  94. package/esm2022/src/lib/utils/models/button.config.mjs +2 -0
  95. package/esm2022/src/lib/utils/models/checkbox-field.config.mjs +2 -0
  96. package/esm2022/src/lib/utils/models/crispr-field.config.mjs +23 -0
  97. package/esm2022/src/lib/utils/models/datepicker-field.config.mjs +2 -0
  98. package/esm2022/src/lib/utils/models/divider.config.mjs +2 -0
  99. package/esm2022/src/lib/utils/models/file-upload-field.config.mjs +2 -0
  100. package/esm2022/src/lib/utils/models/form-group-list.config.mjs +2 -0
  101. package/esm2022/src/lib/utils/models/heading.config.mjs +3 -0
  102. package/esm2022/src/lib/utils/models/image-upload-field.config.mjs +2 -0
  103. package/esm2022/src/lib/utils/models/index.mjs +18 -0
  104. package/esm2022/src/lib/utils/models/input-field.config.mjs +2 -0
  105. package/esm2022/src/lib/utils/models/radio-field.config.mjs +2 -0
  106. package/esm2022/src/lib/utils/models/select-field.config.mjs +2 -0
  107. package/esm2022/src/lib/utils/models/slider-field.config.mjs +2 -0
  108. package/esm2022/src/lib/utils/models/textarea-field.config.mjs +2 -0
  109. package/esm2022/src/lib/utils/models/unit-conversion-field.config.mjs +2 -0
  110. package/esm2022/src/lib/utils/operators/form.operators.mjs +24 -0
  111. package/esm2022/src/lib/utils/operators/index.mjs +2 -0
  112. package/esm2022/src/lib/utils/public-api.mjs +5 -0
  113. package/esm2022/src/lib/utils/tft-crispr-forms-src-lib-utils.mjs +5 -0
  114. package/{esm2020 → esm2022}/tft-crispr-forms.mjs +4 -4
  115. package/fesm2022/tft-crispr-forms-index-2dAn0905.mjs +19 -0
  116. package/fesm2022/tft-crispr-forms-index-2dAn0905.mjs.map +1 -0
  117. package/fesm2022/tft-crispr-forms-index-76UuF0AI.mjs +36 -0
  118. package/fesm2022/tft-crispr-forms-index-76UuF0AI.mjs.map +1 -0
  119. package/{fesm2020/tft-crispr-forms-ui-image-upload-field.mjs → fesm2022/tft-crispr-forms-index-BXwiulEX.mjs} +169 -169
  120. package/fesm2022/tft-crispr-forms-index-BXwiulEX.mjs.map +1 -0
  121. package/fesm2022/tft-crispr-forms-index-BfR4XbYi.mjs +110 -0
  122. package/fesm2022/tft-crispr-forms-index-BfR4XbYi.mjs.map +1 -0
  123. package/fesm2022/tft-crispr-forms-index-C5X0mk3N.mjs +49 -0
  124. package/fesm2022/tft-crispr-forms-index-C5X0mk3N.mjs.map +1 -0
  125. package/fesm2022/tft-crispr-forms-index-CFUop3Cq.mjs +80 -0
  126. package/fesm2022/tft-crispr-forms-index-CFUop3Cq.mjs.map +1 -0
  127. package/fesm2022/tft-crispr-forms-index-CFdMVgM0.mjs +91 -0
  128. package/fesm2022/tft-crispr-forms-index-CFdMVgM0.mjs.map +1 -0
  129. package/fesm2022/tft-crispr-forms-index-CZdi06Jj.mjs +49 -0
  130. package/fesm2022/tft-crispr-forms-index-CZdi06Jj.mjs.map +1 -0
  131. package/fesm2022/tft-crispr-forms-index-C_I9vjqf.mjs +57 -0
  132. package/fesm2022/tft-crispr-forms-index-C_I9vjqf.mjs.map +1 -0
  133. package/fesm2022/tft-crispr-forms-index-DE8VOdBd.mjs +102 -0
  134. package/fesm2022/tft-crispr-forms-index-DE8VOdBd.mjs.map +1 -0
  135. package/fesm2022/tft-crispr-forms-index-OLo2t0tl.mjs +48 -0
  136. package/fesm2022/tft-crispr-forms-index-OLo2t0tl.mjs.map +1 -0
  137. package/fesm2022/tft-crispr-forms-index-OT7kkOgd.mjs +50 -0
  138. package/fesm2022/tft-crispr-forms-index-OT7kkOgd.mjs.map +1 -0
  139. package/fesm2022/tft-crispr-forms-index-Ukk3WgS2.mjs +54 -0
  140. package/fesm2022/tft-crispr-forms-index-Ukk3WgS2.mjs.map +1 -0
  141. package/fesm2022/tft-crispr-forms-index-rRi6OMY6.mjs +142 -0
  142. package/fesm2022/tft-crispr-forms-index-rRi6OMY6.mjs.map +1 -0
  143. package/fesm2022/tft-crispr-forms-index-xAaInTLg.mjs +73 -0
  144. package/fesm2022/tft-crispr-forms-index-xAaInTLg.mjs.map +1 -0
  145. package/{fesm2020/tft-crispr-forms-utils.mjs → fesm2022/tft-crispr-forms-src-lib-utils.mjs} +242 -243
  146. package/fesm2022/tft-crispr-forms-src-lib-utils.mjs.map +1 -0
  147. package/fesm2022/tft-crispr-forms.mjs +848 -0
  148. package/fesm2022/tft-crispr-forms.mjs.map +1 -0
  149. package/index.d.ts +5 -5
  150. package/package.json +13 -191
  151. package/public-api.d.ts +3 -3
  152. package/src/index.d.ts +1 -1
  153. package/src/lib/crispr-forms.module.d.ts +16 -16
  154. package/src/lib/display-field.directive.d.ts +23 -23
  155. package/src/lib/field-component-map.const.d.ts +42 -42
  156. package/src/lib/field.directive.d.ts +24 -24
  157. package/src/lib/form/form.component.d.ts +19 -19
  158. package/src/lib/form-group-list/form-group-list.component.d.ts +40 -38
  159. package/src/lib/form-group-list/index.d.ts +1 -1
  160. package/src/lib/pipes/crispr-pipes.module.d.ts +8 -8
  161. package/src/lib/pipes/initial-control-value.pipe.d.ts +10 -10
  162. package/src/lib/public_api.d.ts +2 -2
  163. package/src/lib/sub-group/index.d.ts +2 -2
  164. package/src/lib/sub-group/sub-group.component.d.ts +24 -22
  165. package/src/lib/sub-group/sub-group.module.d.ts +12 -12
  166. package/{ui → src/lib/ui}/autocomplete-chiplist-field/autocomplete-chiplist-field.component.d.ts +36 -33
  167. package/src/lib/ui/autocomplete-chiplist-field/index.d.ts +1 -0
  168. package/{ui → src/lib/ui}/autocomplete-chiplist-field/public-api.d.ts +1 -1
  169. package/{ui → src/lib/ui}/autocomplete-field/autocomplete-field.component.d.ts +25 -25
  170. package/src/lib/ui/autocomplete-field/index.d.ts +1 -0
  171. package/{ui → src/lib/ui}/autocomplete-field/public-api.d.ts +1 -1
  172. package/{ui → src/lib/ui}/button/button.component.d.ts +15 -15
  173. package/src/lib/ui/button/index.d.ts +1 -0
  174. package/{ui → src/lib/ui}/button/public-api.d.ts +1 -1
  175. package/src/lib/ui/checkbox-field/checkbox-field.component.d.ts +23 -0
  176. package/src/lib/ui/checkbox-field/index.d.ts +1 -0
  177. package/{ui → src/lib/ui}/checkbox-field/public-api.d.ts +1 -1
  178. package/{ui → src/lib/ui}/datepicker-field/datepicker-field.component.d.ts +32 -30
  179. package/src/lib/ui/datepicker-field/index.d.ts +1 -0
  180. package/{ui → src/lib/ui}/datepicker-field/public-api.d.ts +1 -1
  181. package/{ui → src/lib/ui}/divider/divider.component.d.ts +9 -9
  182. package/src/lib/ui/divider/index.d.ts +1 -0
  183. package/{ui → src/lib/ui}/divider/public-api.d.ts +1 -1
  184. package/{ui → src/lib/ui}/field-container/field-container.component.d.ts +24 -24
  185. package/src/lib/ui/field-container/index.d.ts +1 -0
  186. package/{ui → src/lib/ui}/field-container/public-api.d.ts +1 -1
  187. package/{ui → src/lib/ui}/file-dropzone/file-dropzone.directive.d.ts +10 -10
  188. package/src/lib/ui/file-dropzone/index.d.ts +1 -0
  189. package/{ui → src/lib/ui}/file-dropzone/public-api.d.ts +1 -1
  190. package/{ui → src/lib/ui}/file-upload-field/file-upload-field.component.d.ts +39 -37
  191. package/src/lib/ui/file-upload-field/index.d.ts +1 -0
  192. package/{ui → src/lib/ui}/file-upload-field/public-api.d.ts +1 -1
  193. package/{ui → src/lib/ui}/heading/heading.component.d.ts +8 -8
  194. package/src/lib/ui/heading/index.d.ts +1 -0
  195. package/{ui → src/lib/ui}/heading/public-api.d.ts +1 -1
  196. package/{ui → src/lib/ui}/image-upload-field/image-upload-field.component.d.ts +50 -48
  197. package/src/lib/ui/image-upload-field/index.d.ts +1 -0
  198. package/{ui → src/lib/ui}/image-upload-field/public-api.d.ts +1 -1
  199. package/src/lib/ui/index.d.ts +1 -0
  200. package/src/lib/ui/info/index.d.ts +1 -0
  201. package/{ui → src/lib/ui}/info/info.component.d.ts +7 -7
  202. package/{ui → src/lib/ui}/info/public-api.d.ts +1 -1
  203. package/src/lib/ui/input-field/index.d.ts +1 -0
  204. package/src/lib/ui/input-field/input-field.component.d.ts +24 -0
  205. package/{ui → src/lib/ui}/input-field/public-api.d.ts +1 -1
  206. package/src/lib/ui/option/index.d.ts +1 -0
  207. package/{ui → src/lib/ui}/option/option.component.d.ts +7 -7
  208. package/{ui → src/lib/ui}/option/public-api.d.ts +1 -1
  209. package/src/lib/ui/public-api.d.ts +6 -0
  210. package/src/lib/ui/radio-field/index.d.ts +1 -0
  211. package/{ui → src/lib/ui}/radio-field/public-api.d.ts +1 -1
  212. package/src/lib/ui/radio-field/radio-field.component.d.ts +25 -0
  213. package/src/lib/ui/select-field/index.d.ts +1 -0
  214. package/{ui → src/lib/ui}/select-field/public-api.d.ts +1 -1
  215. package/{ui → src/lib/ui}/select-field/select-field.component.d.ts +34 -32
  216. package/src/lib/ui/selected-file/index.d.ts +1 -0
  217. package/{ui → src/lib/ui}/selected-file/public-api.d.ts +1 -1
  218. package/{ui → src/lib/ui}/selected-file/selected-file.component.d.ts +10 -10
  219. package/src/lib/ui/slider-field/index.d.ts +1 -0
  220. package/{ui → src/lib/ui}/slider-field/public-api.d.ts +1 -1
  221. package/src/lib/ui/slider-field/slider-field.component.d.ts +24 -0
  222. package/src/lib/ui/textarea-field/index.d.ts +1 -0
  223. package/{ui → src/lib/ui}/textarea-field/public-api.d.ts +1 -1
  224. package/src/lib/ui/textarea-field/textarea-field.component.d.ts +23 -0
  225. package/src/lib/ui/unit-conversion-field/index.d.ts +1 -0
  226. package/{ui → src/lib/ui}/unit-conversion-field/public-api.d.ts +1 -1
  227. package/{ui → src/lib/ui}/unit-conversion-field/unit-conversion-field.component.d.ts +38 -36
  228. package/{utils → src/lib/utils}/abstracts/autocomplete-field.abstract.d.ts +28 -28
  229. package/{utils → src/lib/utils}/abstracts/crispr-control.mixin.d.ts +16 -16
  230. package/{utils → src/lib/utils}/abstracts/crispr-display-field.abstract.d.ts +22 -22
  231. package/{utils → src/lib/utils}/abstracts/crispr-field.abstract.d.ts +11 -11
  232. package/{utils → src/lib/utils}/abstracts/index.d.ts +4 -4
  233. package/{utils → src/lib/utils}/functions/buildFormGroupFromConfig.d.ts +9 -9
  234. package/{utils → src/lib/utils}/functions/callOptionsIfFunction.d.ts +3 -3
  235. package/{utils → src/lib/utils}/functions/createControlForType.d.ts +9 -9
  236. package/{utils → src/lib/utils}/functions/filterOptionsByLabel.d.ts +7 -7
  237. package/{utils → src/lib/utils}/functions/image-compression.helpers.d.ts +5 -5
  238. package/{utils → src/lib/utils}/functions/index.d.ts +7 -7
  239. package/{utils → src/lib/utils}/functions/isControlConfig.d.ts +5 -5
  240. package/{utils → src/lib/utils}/functions/observablifyOptions.d.ts +12 -12
  241. package/{ui → src/lib/utils}/index.d.ts +5 -5
  242. package/{utils → src/lib/utils}/models/autocomplete-chiplist-field.config.d.ts +20 -20
  243. package/{utils → src/lib/utils}/models/autocomplete-field.config.d.ts +14 -14
  244. package/{utils → src/lib/utils}/models/button.config.d.ts +17 -17
  245. package/{utils → src/lib/utils}/models/checkbox-field.config.d.ts +6 -6
  246. package/{utils → src/lib/utils}/models/crispr-field.config.d.ts +97 -94
  247. package/{utils → src/lib/utils}/models/datepicker-field.config.d.ts +20 -20
  248. package/{utils → src/lib/utils}/models/divider.config.d.ts +5 -5
  249. package/{utils → src/lib/utils}/models/file-upload-field.config.d.ts +33 -33
  250. package/{utils → src/lib/utils}/models/form-group-list.config.d.ts +18 -18
  251. package/{utils → src/lib/utils}/models/heading.config.d.ts +6 -6
  252. package/{utils → src/lib/utils}/models/image-upload-field.config.d.ts +54 -54
  253. package/{utils → src/lib/utils}/models/index.d.ts +17 -17
  254. package/{utils → src/lib/utils}/models/input-field.config.d.ts +16 -16
  255. package/{utils → src/lib/utils}/models/radio-field.config.d.ts +6 -6
  256. package/{utils → src/lib/utils}/models/select-field.config.d.ts +21 -21
  257. package/{utils → src/lib/utils}/models/slider-field.config.d.ts +11 -13
  258. package/{utils → src/lib/utils}/models/textarea-field.config.d.ts +5 -5
  259. package/{utils → src/lib/utils}/models/unit-conversion-field.config.d.ts +30 -30
  260. package/{utils → src/lib/utils}/operators/form.operators.d.ts +1 -1
  261. package/{utils → src/lib/utils}/operators/index.d.ts +1 -1
  262. package/{utils → src/lib/utils}/public-api.d.ts +4 -4
  263. package/tft-crispr-forms-17.0.0.tgz +0 -0
  264. package/esm2020/public-api.mjs +0 -5
  265. package/esm2020/src/lib/crispr-forms.module.mjs +0 -60
  266. package/esm2020/src/lib/display-field.directive.mjs +0 -53
  267. package/esm2020/src/lib/field-component-map.const.mjs +0 -27
  268. package/esm2020/src/lib/field.directive.mjs +0 -69
  269. package/esm2020/src/lib/form/form.component.mjs +0 -63
  270. package/esm2020/src/lib/form-group-list/form-group-list.component.mjs +0 -99
  271. package/esm2020/src/lib/pipes/initial-control-value.pipe.mjs +0 -21
  272. package/esm2020/src/lib/sub-group/sub-group.component.mjs +0 -21
  273. package/esm2020/src/lib/sub-group/sub-group.module.mjs +0 -42
  274. package/esm2020/ui/autocomplete-chiplist-field/autocomplete-chiplist-field.component.mjs +0 -130
  275. package/esm2020/ui/autocomplete-chiplist-field/public-api.mjs +0 -2
  276. package/esm2020/ui/autocomplete-chiplist-field/tft-crispr-forms-ui-autocomplete-chiplist-field.mjs +0 -5
  277. package/esm2020/ui/autocomplete-field/autocomplete-field.component.mjs +0 -93
  278. package/esm2020/ui/autocomplete-field/public-api.mjs +0 -2
  279. package/esm2020/ui/autocomplete-field/tft-crispr-forms-ui-autocomplete-field.mjs +0 -5
  280. package/esm2020/ui/button/button.component.mjs +0 -49
  281. package/esm2020/ui/button/public-api.mjs +0 -2
  282. package/esm2020/ui/button/tft-crispr-forms-ui-button.mjs +0 -5
  283. package/esm2020/ui/checkbox-field/checkbox-field.component.mjs +0 -42
  284. package/esm2020/ui/checkbox-field/public-api.mjs +0 -2
  285. package/esm2020/ui/checkbox-field/tft-crispr-forms-ui-checkbox-field.mjs +0 -5
  286. package/esm2020/ui/datepicker-field/datepicker-field.component.mjs +0 -63
  287. package/esm2020/ui/datepicker-field/public-api.mjs +0 -2
  288. package/esm2020/ui/datepicker-field/tft-crispr-forms-ui-datepicker-field.mjs +0 -5
  289. package/esm2020/ui/divider/divider.component.mjs +0 -28
  290. package/esm2020/ui/divider/public-api.mjs +0 -2
  291. package/esm2020/ui/divider/tft-crispr-forms-ui-divider.mjs +0 -5
  292. package/esm2020/ui/field-container/field-container.component.mjs +0 -58
  293. package/esm2020/ui/field-container/public-api.mjs +0 -2
  294. package/esm2020/ui/field-container/tft-crispr-forms-ui-field-container.mjs +0 -5
  295. package/esm2020/ui/file-dropzone/file-dropzone.directive.mjs +0 -40
  296. package/esm2020/ui/file-dropzone/public-api.mjs +0 -2
  297. package/esm2020/ui/file-dropzone/tft-crispr-forms-ui-file-dropzone.mjs +0 -5
  298. package/esm2020/ui/file-upload-field/file-upload-field.component.mjs +0 -108
  299. package/esm2020/ui/file-upload-field/public-api.mjs +0 -2
  300. package/esm2020/ui/file-upload-field/tft-crispr-forms-ui-file-upload-field.mjs +0 -5
  301. package/esm2020/ui/heading/heading.component.mjs +0 -31
  302. package/esm2020/ui/heading/public-api.mjs +0 -2
  303. package/esm2020/ui/heading/tft-crispr-forms-ui-heading.mjs +0 -5
  304. package/esm2020/ui/image-upload-field/image-upload-field.component.mjs +0 -179
  305. package/esm2020/ui/image-upload-field/public-api.mjs +0 -2
  306. package/esm2020/ui/image-upload-field/tft-crispr-forms-ui-image-upload-field.mjs +0 -5
  307. package/esm2020/ui/info/info.component.mjs +0 -23
  308. package/esm2020/ui/info/public-api.mjs +0 -2
  309. package/esm2020/ui/info/tft-crispr-forms-ui-info.mjs +0 -5
  310. package/esm2020/ui/input-field/input-field.component.mjs +0 -41
  311. package/esm2020/ui/input-field/public-api.mjs +0 -2
  312. package/esm2020/ui/input-field/tft-crispr-forms-ui-input-field.mjs +0 -5
  313. package/esm2020/ui/option/option.component.mjs +0 -19
  314. package/esm2020/ui/option/public-api.mjs +0 -2
  315. package/esm2020/ui/option/tft-crispr-forms-ui-option.mjs +0 -5
  316. package/esm2020/ui/public-api.mjs +0 -7
  317. package/esm2020/ui/radio-field/public-api.mjs +0 -2
  318. package/esm2020/ui/radio-field/radio-field.component.mjs +0 -39
  319. package/esm2020/ui/radio-field/tft-crispr-forms-ui-radio-field.mjs +0 -5
  320. package/esm2020/ui/select-field/public-api.mjs +0 -2
  321. package/esm2020/ui/select-field/select-field.component.mjs +0 -73
  322. package/esm2020/ui/select-field/tft-crispr-forms-ui-select-field.mjs +0 -5
  323. package/esm2020/ui/selected-file/public-api.mjs +0 -2
  324. package/esm2020/ui/selected-file/selected-file.component.mjs +0 -26
  325. package/esm2020/ui/selected-file/tft-crispr-forms-ui-selected-file.mjs +0 -5
  326. package/esm2020/ui/slider-field/public-api.mjs +0 -2
  327. package/esm2020/ui/slider-field/slider-field.component.mjs +0 -44
  328. package/esm2020/ui/slider-field/tft-crispr-forms-ui-slider-field.mjs +0 -5
  329. package/esm2020/ui/textarea-field/public-api.mjs +0 -2
  330. package/esm2020/ui/textarea-field/textarea-field.component.mjs +0 -42
  331. package/esm2020/ui/textarea-field/tft-crispr-forms-ui-textarea-field.mjs +0 -5
  332. package/esm2020/ui/tft-crispr-forms-ui.mjs +0 -5
  333. package/esm2020/ui/unit-conversion-field/public-api.mjs +0 -2
  334. package/esm2020/ui/unit-conversion-field/tft-crispr-forms-ui-unit-conversion-field.mjs +0 -5
  335. package/esm2020/ui/unit-conversion-field/unit-conversion-field.component.mjs +0 -84
  336. package/esm2020/utils/abstracts/autocomplete-field.abstract.mjs +0 -30
  337. package/esm2020/utils/abstracts/crispr-control.mixin.mjs +0 -27
  338. package/esm2020/utils/abstracts/crispr-display-field.abstract.mjs +0 -14
  339. package/esm2020/utils/abstracts/crispr-field.abstract.mjs +0 -20
  340. package/esm2020/utils/abstracts/index.mjs +0 -5
  341. package/esm2020/utils/functions/buildFormGroupFromConfig.mjs +0 -28
  342. package/esm2020/utils/functions/callOptionsIfFunction.mjs +0 -4
  343. package/esm2020/utils/functions/createControlForType.mjs +0 -19
  344. package/esm2020/utils/functions/filterOptionsByLabel.mjs +0 -11
  345. package/esm2020/utils/functions/image-compression.helpers.mjs +0 -50
  346. package/esm2020/utils/functions/index.mjs +0 -8
  347. package/esm2020/utils/functions/isControlConfig.mjs +0 -7
  348. package/esm2020/utils/functions/observablifyOptions.mjs +0 -29
  349. package/esm2020/utils/models/autocomplete-chiplist-field.config.mjs +0 -2
  350. package/esm2020/utils/models/autocomplete-field.config.mjs +0 -2
  351. package/esm2020/utils/models/button.config.mjs +0 -2
  352. package/esm2020/utils/models/checkbox-field.config.mjs +0 -2
  353. package/esm2020/utils/models/crispr-field.config.mjs +0 -23
  354. package/esm2020/utils/models/datepicker-field.config.mjs +0 -2
  355. package/esm2020/utils/models/divider.config.mjs +0 -2
  356. package/esm2020/utils/models/file-upload-field.config.mjs +0 -2
  357. package/esm2020/utils/models/form-group-list.config.mjs +0 -2
  358. package/esm2020/utils/models/heading.config.mjs +0 -3
  359. package/esm2020/utils/models/image-upload-field.config.mjs +0 -2
  360. package/esm2020/utils/models/index.mjs +0 -18
  361. package/esm2020/utils/models/input-field.config.mjs +0 -2
  362. package/esm2020/utils/models/radio-field.config.mjs +0 -2
  363. package/esm2020/utils/models/select-field.config.mjs +0 -2
  364. package/esm2020/utils/models/slider-field.config.mjs +0 -2
  365. package/esm2020/utils/models/textarea-field.config.mjs +0 -2
  366. package/esm2020/utils/models/unit-conversion-field.config.mjs +0 -2
  367. package/esm2020/utils/operators/form.operators.mjs +0 -24
  368. package/esm2020/utils/operators/index.mjs +0 -2
  369. package/esm2020/utils/public-api.mjs +0 -5
  370. package/esm2020/utils/tft-crispr-forms-utils.mjs +0 -5
  371. package/fesm2015/tft-crispr-forms-ui-autocomplete-chiplist-field.mjs +0 -138
  372. package/fesm2015/tft-crispr-forms-ui-autocomplete-chiplist-field.mjs.map +0 -1
  373. package/fesm2015/tft-crispr-forms-ui-autocomplete-field.mjs +0 -101
  374. package/fesm2015/tft-crispr-forms-ui-autocomplete-field.mjs.map +0 -1
  375. package/fesm2015/tft-crispr-forms-ui-button.mjs +0 -55
  376. package/fesm2015/tft-crispr-forms-ui-button.mjs.map +0 -1
  377. package/fesm2015/tft-crispr-forms-ui-checkbox-field.mjs +0 -49
  378. package/fesm2015/tft-crispr-forms-ui-checkbox-field.mjs.map +0 -1
  379. package/fesm2015/tft-crispr-forms-ui-datepicker-field.mjs +0 -71
  380. package/fesm2015/tft-crispr-forms-ui-datepicker-field.mjs.map +0 -1
  381. package/fesm2015/tft-crispr-forms-ui-divider.mjs +0 -34
  382. package/fesm2015/tft-crispr-forms-ui-divider.mjs.map +0 -1
  383. package/fesm2015/tft-crispr-forms-ui-field-container.mjs +0 -64
  384. package/fesm2015/tft-crispr-forms-ui-field-container.mjs.map +0 -1
  385. package/fesm2015/tft-crispr-forms-ui-file-dropzone.mjs +0 -47
  386. package/fesm2015/tft-crispr-forms-ui-file-dropzone.mjs.map +0 -1
  387. package/fesm2015/tft-crispr-forms-ui-file-upload-field.mjs +0 -117
  388. package/fesm2015/tft-crispr-forms-ui-file-upload-field.mjs.map +0 -1
  389. package/fesm2015/tft-crispr-forms-ui-heading.mjs +0 -37
  390. package/fesm2015/tft-crispr-forms-ui-heading.mjs.map +0 -1
  391. package/fesm2015/tft-crispr-forms-ui-image-upload-field.mjs +0 -182
  392. package/fesm2015/tft-crispr-forms-ui-image-upload-field.mjs.map +0 -1
  393. package/fesm2015/tft-crispr-forms-ui-info.mjs +0 -30
  394. package/fesm2015/tft-crispr-forms-ui-info.mjs.map +0 -1
  395. package/fesm2015/tft-crispr-forms-ui-input-field.mjs +0 -48
  396. package/fesm2015/tft-crispr-forms-ui-input-field.mjs.map +0 -1
  397. package/fesm2015/tft-crispr-forms-ui-option.mjs +0 -26
  398. package/fesm2015/tft-crispr-forms-ui-option.mjs.map +0 -1
  399. package/fesm2015/tft-crispr-forms-ui-radio-field.mjs +0 -46
  400. package/fesm2015/tft-crispr-forms-ui-radio-field.mjs.map +0 -1
  401. package/fesm2015/tft-crispr-forms-ui-select-field.mjs +0 -81
  402. package/fesm2015/tft-crispr-forms-ui-select-field.mjs.map +0 -1
  403. package/fesm2015/tft-crispr-forms-ui-selected-file.mjs +0 -33
  404. package/fesm2015/tft-crispr-forms-ui-selected-file.mjs.map +0 -1
  405. package/fesm2015/tft-crispr-forms-ui-slider-field.mjs +0 -51
  406. package/fesm2015/tft-crispr-forms-ui-slider-field.mjs.map +0 -1
  407. package/fesm2015/tft-crispr-forms-ui-textarea-field.mjs +0 -49
  408. package/fesm2015/tft-crispr-forms-ui-textarea-field.mjs.map +0 -1
  409. package/fesm2015/tft-crispr-forms-ui-unit-conversion-field.mjs +0 -93
  410. package/fesm2015/tft-crispr-forms-ui-unit-conversion-field.mjs.map +0 -1
  411. package/fesm2015/tft-crispr-forms-ui.mjs +0 -12
  412. package/fesm2015/tft-crispr-forms-ui.mjs.map +0 -1
  413. package/fesm2015/tft-crispr-forms-utils.mjs +0 -280
  414. package/fesm2015/tft-crispr-forms-utils.mjs.map +0 -1
  415. package/fesm2015/tft-crispr-forms.mjs +0 -438
  416. package/fesm2015/tft-crispr-forms.mjs.map +0 -1
  417. package/fesm2020/tft-crispr-forms-ui-autocomplete-chiplist-field.mjs +0 -137
  418. package/fesm2020/tft-crispr-forms-ui-autocomplete-chiplist-field.mjs.map +0 -1
  419. package/fesm2020/tft-crispr-forms-ui-autocomplete-field.mjs +0 -100
  420. package/fesm2020/tft-crispr-forms-ui-autocomplete-field.mjs.map +0 -1
  421. package/fesm2020/tft-crispr-forms-ui-button.mjs +0 -55
  422. package/fesm2020/tft-crispr-forms-ui-button.mjs.map +0 -1
  423. package/fesm2020/tft-crispr-forms-ui-checkbox-field.mjs +0 -49
  424. package/fesm2020/tft-crispr-forms-ui-checkbox-field.mjs.map +0 -1
  425. package/fesm2020/tft-crispr-forms-ui-datepicker-field.mjs +0 -70
  426. package/fesm2020/tft-crispr-forms-ui-datepicker-field.mjs.map +0 -1
  427. package/fesm2020/tft-crispr-forms-ui-divider.mjs +0 -34
  428. package/fesm2020/tft-crispr-forms-ui-divider.mjs.map +0 -1
  429. package/fesm2020/tft-crispr-forms-ui-field-container.mjs +0 -65
  430. package/fesm2020/tft-crispr-forms-ui-field-container.mjs.map +0 -1
  431. package/fesm2020/tft-crispr-forms-ui-file-dropzone.mjs +0 -47
  432. package/fesm2020/tft-crispr-forms-ui-file-dropzone.mjs.map +0 -1
  433. package/fesm2020/tft-crispr-forms-ui-file-upload-field.mjs +0 -115
  434. package/fesm2020/tft-crispr-forms-ui-file-upload-field.mjs.map +0 -1
  435. package/fesm2020/tft-crispr-forms-ui-heading.mjs +0 -37
  436. package/fesm2020/tft-crispr-forms-ui-heading.mjs.map +0 -1
  437. package/fesm2020/tft-crispr-forms-ui-image-upload-field.mjs.map +0 -1
  438. package/fesm2020/tft-crispr-forms-ui-info.mjs +0 -30
  439. package/fesm2020/tft-crispr-forms-ui-info.mjs.map +0 -1
  440. package/fesm2020/tft-crispr-forms-ui-input-field.mjs +0 -48
  441. package/fesm2020/tft-crispr-forms-ui-input-field.mjs.map +0 -1
  442. package/fesm2020/tft-crispr-forms-ui-option.mjs +0 -26
  443. package/fesm2020/tft-crispr-forms-ui-option.mjs.map +0 -1
  444. package/fesm2020/tft-crispr-forms-ui-radio-field.mjs +0 -46
  445. package/fesm2020/tft-crispr-forms-ui-radio-field.mjs.map +0 -1
  446. package/fesm2020/tft-crispr-forms-ui-select-field.mjs +0 -80
  447. package/fesm2020/tft-crispr-forms-ui-select-field.mjs.map +0 -1
  448. package/fesm2020/tft-crispr-forms-ui-selected-file.mjs +0 -33
  449. package/fesm2020/tft-crispr-forms-ui-selected-file.mjs.map +0 -1
  450. package/fesm2020/tft-crispr-forms-ui-slider-field.mjs +0 -51
  451. package/fesm2020/tft-crispr-forms-ui-slider-field.mjs.map +0 -1
  452. package/fesm2020/tft-crispr-forms-ui-textarea-field.mjs +0 -49
  453. package/fesm2020/tft-crispr-forms-ui-textarea-field.mjs.map +0 -1
  454. package/fesm2020/tft-crispr-forms-ui-unit-conversion-field.mjs +0 -91
  455. package/fesm2020/tft-crispr-forms-ui-unit-conversion-field.mjs.map +0 -1
  456. package/fesm2020/tft-crispr-forms-ui.mjs +0 -12
  457. package/fesm2020/tft-crispr-forms-ui.mjs.map +0 -1
  458. package/fesm2020/tft-crispr-forms-utils.mjs.map +0 -1
  459. package/fesm2020/tft-crispr-forms.mjs +0 -434
  460. package/fesm2020/tft-crispr-forms.mjs.map +0 -1
  461. package/tft-crispr-forms-14.0.2.tgz +0 -0
  462. package/ui/README.md +0 -3
  463. package/ui/autocomplete-chiplist-field/index.d.ts +0 -5
  464. package/ui/autocomplete-field/index.d.ts +0 -5
  465. package/ui/button/index.d.ts +0 -5
  466. package/ui/checkbox-field/checkbox-field.component.d.ts +0 -21
  467. package/ui/checkbox-field/index.d.ts +0 -5
  468. package/ui/datepicker-field/index.d.ts +0 -5
  469. package/ui/divider/index.d.ts +0 -5
  470. package/ui/field-container/index.d.ts +0 -5
  471. package/ui/file-dropzone/index.d.ts +0 -5
  472. package/ui/file-upload-field/index.d.ts +0 -5
  473. package/ui/heading/index.d.ts +0 -5
  474. package/ui/image-upload-field/index.d.ts +0 -5
  475. package/ui/info/index.d.ts +0 -5
  476. package/ui/input-field/index.d.ts +0 -5
  477. package/ui/input-field/input-field.component.d.ts +0 -22
  478. package/ui/option/index.d.ts +0 -5
  479. package/ui/public-api.d.ts +0 -5
  480. package/ui/radio-field/index.d.ts +0 -5
  481. package/ui/radio-field/radio-field.component.d.ts +0 -23
  482. package/ui/select-field/index.d.ts +0 -5
  483. package/ui/selected-file/index.d.ts +0 -5
  484. package/ui/slider-field/index.d.ts +0 -5
  485. package/ui/slider-field/slider-field.component.d.ts +0 -25
  486. package/ui/textarea-field/index.d.ts +0 -5
  487. package/ui/textarea-field/textarea-field.component.d.ts +0 -21
  488. package/ui/unit-conversion-field/index.d.ts +0 -5
  489. package/utils/index.d.ts +0 -5
  490. /package/{utils → src/lib/utils}/README.md +0 -0
@@ -1,185 +1,185 @@
1
- import * as i3 from '@angular/common';
1
+ import * as i1 from '@angular/common';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
4
  import { Component, ChangeDetectionStrategy, Optional, Self, ViewChild } from '@angular/core';
5
- import * as i1 from '@angular/forms';
5
+ import * as i2 from '@angular/forms';
6
6
  import { ReactiveFormsModule } from '@angular/forms';
7
- import * as i5 from '@angular/material/button';
7
+ import * as i2$2 from '@angular/material/button';
8
8
  import { MatButtonModule } from '@angular/material/button';
9
- import * as i6 from '@angular/material/form-field';
9
+ import * as i3$1 from '@angular/material/form-field';
10
10
  import { MatFormFieldModule } from '@angular/material/form-field';
11
- import * as i4 from '@angular/material/icon';
11
+ import * as i3 from '@angular/material/icon';
12
12
  import { MatIconModule } from '@angular/material/icon';
13
- import * as i7 from '@angular/material/input';
13
+ import * as i5 from '@angular/material/input';
14
14
  import { MatInputModule } from '@angular/material/input';
15
- import * as i2 from '@angular/platform-browser';
15
+ import * as i2$1 from '@angular/platform-browser';
16
16
  import imageCompression from 'browser-image-compression';
17
17
  import { Subject, combineLatest, of } from 'rxjs';
18
18
  import { shareReplay, switchMap, map, tap, startWith } from 'rxjs/operators';
19
- import * as i8 from '@tft/form-validation-handler';
19
+ import * as i7 from '@tft/form-validation-handler';
20
20
  import { FormValidationHandlerModule } from '@tft/form-validation-handler';
21
- import { FileDropzoneDirective } from '@tft/crispr-forms/ui/file-dropzone';
22
- import { SelectedFileComponent } from '@tft/crispr-forms/ui/selected-file';
23
- import { FieldContainerComponent } from '@tft/crispr-forms/ui/field-container';
24
- import { crisprControlMixin, CrisprFieldComponent, convertBytesToMb } from '@tft/crispr-forms/utils';
21
+ import { crisprControlMixin, CrisprFieldComponent, convertBytesToMb, FieldContainerComponent, SelectedFileComponent, FileDropzoneDirective } from './tft-crispr-forms.mjs';
22
+ import '@angular/material/progress-bar';
23
+ import '@angular/material/tooltip';
25
24
 
26
- /* eslint-disable @nrwl/nx/enforce-module-boundaries */
27
- const ImageUploadFieldMixin = crisprControlMixin(CrisprFieldComponent);
28
- class ImageUploadFieldComponent extends ImageUploadFieldMixin {
29
- constructor(ngControl, domSanitizer, cdr) {
30
- super();
31
- this.ngControl = ngControl;
32
- this.domSanitizer = domSanitizer;
33
- this.cdr = cdr;
34
- this.defaultConfig = {
35
- // allowMultipleFiles: false,
36
- acceptedTypes: 'image/*',
37
- dropZoneText: 'DROP FILE HERE',
38
- selectFilesButtonType: 'button',
39
- selectButtonText: 'SELECT',
40
- showClearFilesButton: true,
41
- clearFilesButtonText: 'CLEAR',
42
- resetFilesButtonText: 'RESET',
43
- imagePreviewHeight: '250px',
44
- compressImage: false,
45
- targetCompressedImageFileSizeMb: .4,
46
- minCompressionThresholdMb: .6,
47
- useWebWorker: true,
48
- };
49
- this.inputImageFileSubject = new Subject();
50
- this.inputImageFile$ = this.inputImageFileSubject.asObservable().pipe(shareReplay(1));
51
- this.compressedFile$ = this.inputImageFile$.pipe(switchMap(async (file) => {
52
- if (!file || !(file instanceof File))
53
- return null;
54
- const { compressImage, targetCompressedImageFileSizeMb, minCompressionThresholdMb, maxWidthOrHeight, useWebWorker } = this.config;
55
- const fileSizeMb = convertBytesToMb(file.size);
56
- const shouldCompress = compressImage
57
- && targetCompressedImageFileSizeMb < fileSizeMb
58
- && minCompressionThresholdMb < fileSizeMb;
59
- if (shouldCompress) {
60
- const options = {
61
- // Use maxWidthOrHeight if it was provided, else use target compressed size
62
- ...(maxWidthOrHeight ? { maxWidthOrHeight } : { maxSizeMB: targetCompressedImageFileSizeMb }),
63
- useWebWorker,
64
- maxIterations: 30,
65
- onProgress: (progress) => {
66
- this.progress = progress;
67
- this.cdr.detectChanges();
68
- }
69
- };
70
- return await imageCompression(file, options);
71
- }
72
- else
73
- return file;
74
- }), map((compressedFile) => {
75
- if (!compressedFile)
76
- return compressedFile;
77
- const { type, name, lastModified } = compressedFile;
78
- return new File([compressedFile], this.config.fileName || name, {
79
- type,
80
- lastModified
81
- });
82
- }), tap(file => {
83
- // only set the value if there is a file because resetToInitialValue sets the control value
84
- // to initial value and clears the compressed image, so setting it to null here would undo that
85
- if (file) {
86
- this.control.setValue(file);
87
- }
88
- if (file || this.value) {
89
- this.control.markAsTouched();
90
- setTimeout(() => {
91
- this.cdr.detectChanges();
92
- }, 100);
93
- }
94
- }), shareReplay(1));
95
- this.compressedImageUrlString$ = this.compressedFile$.pipe(switchMap(async (file) => {
96
- if (!file)
97
- return null;
98
- const compressedStringImage = await imageCompression.getDataUrlFromFile(file);
99
- return this.domSanitizer.bypassSecurityTrustResourceUrl(compressedStringImage);
100
- }), shareReplay(1));
101
- this.isUploaded = false;
102
- if (this.ngControl != null) {
103
- // Setting the value accessor directly (instead of using
104
- // the providers) to avoid running into a circular import.
105
- ngControl.valueAccessor = this;
106
- }
107
- }
108
- ngOnInit() {
109
- super.ngOnInit();
110
- this.imageSrcUrl$ = combineLatest([
111
- this.compressedImageUrlString$.pipe(startWith(null)),
112
- this.control.valueChanges.pipe(startWith(this.value), map((controlValue) => {
113
- if (!controlValue)
114
- return null;
115
- if (controlValue instanceof File)
116
- return null;
117
- return this.config.mapInputValueToUrl?.(controlValue) || controlValue;
118
- }))
119
- ]).pipe(map(([compressedImageUrlString, controlUrl]) => {
120
- return compressedImageUrlString || controlUrl || null;
121
- }));
122
- this.disabled$ = this.config.disabledCallback
123
- ? this.config.disabledCallback(this.group)
124
- : of(false);
125
- }
126
- filesChanged(files) {
127
- if (files && files.length > 0) {
128
- const imageFile = files[0];
129
- // We clear the control here so that it is invalid while compressing
130
- // the input pipeline will take care of resetting it
131
- this.control.patchValue(null);
132
- // this.control.setErrors({compressing: {loadingMessage: 'Please wait while file compresses'}});
133
- this.control.markAsTouched();
134
- this.inputImageFileSubject.next(imageFile);
135
- }
136
- }
137
- clearFileInput() {
138
- this.inputImageFileSubject.next(null);
139
- this.fileInputRef.nativeElement.value = '';
140
- this.control.patchValue(null);
141
- this.control.markAsTouched();
142
- this.isUploaded = false;
143
- }
144
- resetToInitialValue(initialValue) {
145
- this.inputImageFileSubject.next(null);
146
- this.control.patchValue(initialValue);
147
- this.isUploaded = false;
148
- }
149
- writeValue(value) { }
150
- registerOnChange(fn) {
151
- this.onChange = fn;
152
- }
153
- registerOnTouched(fn) { }
154
- }
155
- ImageUploadFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: ImageUploadFieldComponent, deps: [{ token: i1.NgControl, optional: true, self: true }, { token: i2.DomSanitizer }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
156
- ImageUploadFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: ImageUploadFieldComponent, isStandalone: true, selector: "crispr-image-upload-field", viewQueries: [{ propertyName: "fileInputRef", first: true, predicate: ["fileInput"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n\n <mat-form-field floatLabel=\"always\"\n [color]=\"config.color\"\n [appearance]=\"config.appearance\"\n [formGroup]=\"group\">\n <mat-label>{{config.label}}</mat-label>\n <input [formControlName]=\"config.controlName\" matInput type=\"text\"/>\n <input\n #fileInput\n type=\"file\"\n [accept]=\"config.acceptedTypes\"\n (change)=\"filesChanged($event.target.files)\"/>\n <div class=\"ui-container\">\n\n <div class=\"image-preview\" [style.height]=\"config.imagePreviewHeight\">\n <crispr-selected-file\n *ngIf=\"(progress < 100) && inputImageFile$ | async as file; else dropzoneOrPreview\"\n [color]=\"config.color === 'primary' ? 'accent' : 'primary'\"\n [fileName]=\"'Compressing: ' + file.name\"\n [showProgress]=\"true\"\n [progress]=\"progress\">\n </crispr-selected-file>\n\n <ng-template #dropzoneOrPreview>\n <!-- <img *ngIf=\"(initialUrlString$ | async) as initialUrlString;\" [src]=\"initialUrlString\" alt=\"\"> -->\n <img *ngIf=\"imageSrcUrl$ | async as srcUrl; else noImage\" [src]=\"srcUrl\" alt=\"\">\n <ng-template #noImage>\n <div class=\"drop-container\"\n [crisprFileDropzone]=\"!(disabled$ | async)\"\n (fileDrop)=\"filesChanged($event)\">\n <mat-icon class=\"drop-icon\" inline=\"true\">cloud_upload</mat-icon>\n <h2 class=\"mat-h2\">{{config.dropZoneText}}</h2>\n </div>\n </ng-template>\n\n </ng-template>\n </div>\n\n\n\n <!-- </ng-template> -->\n <div class=\"button-container\" *ngIf=\"true\">\n\n <button\n mat-button\n (click)=\"clearFileInput()\"\n type=\"button\"\n [disabled]=\"(disabled$ | async)\"\n aria-label=\"Remove Selected File(s)\">\n <mat-icon>delete</mat-icon>\n {{config.clearFilesButtonText}}\n </button>\n\n <button\n *ngIf=\"value\"\n mat-button\n (click)=\"resetToInitialValue(value)\"\n type=\"button\"\n [disabled]=\"(disabled$ | async)\"\n aria-label=\"Remove Selected File(s)\">\n <mat-icon>replay</mat-icon>\n {{config.resetFilesButtonText}}\n </button>\n\n <button\n mat-button\n type=\"button\"\n color=\"primary\"\n [disabled]=\"(disabled$ | async)\"\n (click)=\"fileInput.click()\"\n [attr.aria-label]=\"config.controlName\">\n <mat-icon>\n camera\n </mat-icon>\n SELECT\n </button>\n </div>\n </div>\n\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n\n</crispr-field-container>\n", styles: [":host ::ng-deep .mat-form-field .mat-form-field-infix{padding-top:0}:host ::ng-deep .mat-form-field .mat-button-wrapper{display:flex;flex-direction:column;align-items:center;padding-top:8px}:host .ui-container{display:flex;flex-direction:column}:host .ui-container .image-preview{display:flex;flex-direction:column;align-content:space-between;justify-content:center;align-items:center;margin:8px 0;flex-grow:1}:host .ui-container .image-preview crispr-selected-file{width:100%}:host .ui-container .image-preview .drop-container{display:flex;box-sizing:border-box;flex-direction:column;align-items:center;border:3px dashed gray;height:100%;width:100%;align-content:center;justify-content:center;border-radius:8px}:host .ui-container .image-preview .drop-container .drop-icon{height:32px;width:32px;font-size:36px}:host .ui-container .image-preview .drop-container .mat-h2{margin:0}:host .ui-container .image-preview img{height:inherit;max-width:100%}:host .ui-container .button-container{display:flex;flex-direction:var(--image-upload-button-container-direction);justify-content:flex-end}:host .ui-container .button-container button{margin-left:8px}:host input{position:absolute;max-height:0;visibility:hidden}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "component", type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i5.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i6.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i7.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: SelectedFileComponent, selector: "crispr-selected-file", inputs: ["fileName", "progress", "showProgress", "color"] }, { kind: "directive", type: FileDropzoneDirective, selector: "[crisprFileDropzone]", inputs: ["crisprFileDropzone"], outputs: ["fileDrop"] }, { kind: "ngmodule", type: FormValidationHandlerModule }, { kind: "directive", type: i8.ControlErrorsDirective, selector: "[formControl], [formControlName]" }, { kind: "directive", type: i8.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
157
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: ImageUploadFieldComponent, decorators: [{
158
- type: Component,
159
- args: [{ selector: 'crispr-image-upload-field', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
160
- CommonModule,
161
- FieldContainerComponent,
162
- ReactiveFormsModule,
163
- MatIconModule,
164
- MatButtonModule,
165
- MatFormFieldModule,
166
- MatInputModule,
167
- SelectedFileComponent,
168
- FileDropzoneDirective,
169
- FormValidationHandlerModule
170
- ], template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n\n <mat-form-field floatLabel=\"always\"\n [color]=\"config.color\"\n [appearance]=\"config.appearance\"\n [formGroup]=\"group\">\n <mat-label>{{config.label}}</mat-label>\n <input [formControlName]=\"config.controlName\" matInput type=\"text\"/>\n <input\n #fileInput\n type=\"file\"\n [accept]=\"config.acceptedTypes\"\n (change)=\"filesChanged($event.target.files)\"/>\n <div class=\"ui-container\">\n\n <div class=\"image-preview\" [style.height]=\"config.imagePreviewHeight\">\n <crispr-selected-file\n *ngIf=\"(progress < 100) && inputImageFile$ | async as file; else dropzoneOrPreview\"\n [color]=\"config.color === 'primary' ? 'accent' : 'primary'\"\n [fileName]=\"'Compressing: ' + file.name\"\n [showProgress]=\"true\"\n [progress]=\"progress\">\n </crispr-selected-file>\n\n <ng-template #dropzoneOrPreview>\n <!-- <img *ngIf=\"(initialUrlString$ | async) as initialUrlString;\" [src]=\"initialUrlString\" alt=\"\"> -->\n <img *ngIf=\"imageSrcUrl$ | async as srcUrl; else noImage\" [src]=\"srcUrl\" alt=\"\">\n <ng-template #noImage>\n <div class=\"drop-container\"\n [crisprFileDropzone]=\"!(disabled$ | async)\"\n (fileDrop)=\"filesChanged($event)\">\n <mat-icon class=\"drop-icon\" inline=\"true\">cloud_upload</mat-icon>\n <h2 class=\"mat-h2\">{{config.dropZoneText}}</h2>\n </div>\n </ng-template>\n\n </ng-template>\n </div>\n\n\n\n <!-- </ng-template> -->\n <div class=\"button-container\" *ngIf=\"true\">\n\n <button\n mat-button\n (click)=\"clearFileInput()\"\n type=\"button\"\n [disabled]=\"(disabled$ | async)\"\n aria-label=\"Remove Selected File(s)\">\n <mat-icon>delete</mat-icon>\n {{config.clearFilesButtonText}}\n </button>\n\n <button\n *ngIf=\"value\"\n mat-button\n (click)=\"resetToInitialValue(value)\"\n type=\"button\"\n [disabled]=\"(disabled$ | async)\"\n aria-label=\"Remove Selected File(s)\">\n <mat-icon>replay</mat-icon>\n {{config.resetFilesButtonText}}\n </button>\n\n <button\n mat-button\n type=\"button\"\n color=\"primary\"\n [disabled]=\"(disabled$ | async)\"\n (click)=\"fileInput.click()\"\n [attr.aria-label]=\"config.controlName\">\n <mat-icon>\n camera\n </mat-icon>\n SELECT\n </button>\n </div>\n </div>\n\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n\n</crispr-field-container>\n", styles: [":host ::ng-deep .mat-form-field .mat-form-field-infix{padding-top:0}:host ::ng-deep .mat-form-field .mat-button-wrapper{display:flex;flex-direction:column;align-items:center;padding-top:8px}:host .ui-container{display:flex;flex-direction:column}:host .ui-container .image-preview{display:flex;flex-direction:column;align-content:space-between;justify-content:center;align-items:center;margin:8px 0;flex-grow:1}:host .ui-container .image-preview crispr-selected-file{width:100%}:host .ui-container .image-preview .drop-container{display:flex;box-sizing:border-box;flex-direction:column;align-items:center;border:3px dashed gray;height:100%;width:100%;align-content:center;justify-content:center;border-radius:8px}:host .ui-container .image-preview .drop-container .drop-icon{height:32px;width:32px;font-size:36px}:host .ui-container .image-preview .drop-container .mat-h2{margin:0}:host .ui-container .image-preview img{height:inherit;max-width:100%}:host .ui-container .button-container{display:flex;flex-direction:var(--image-upload-button-container-direction);justify-content:flex-end}:host .ui-container .button-container button{margin-left:8px}:host input{position:absolute;max-height:0;visibility:hidden}\n"] }]
171
- }], ctorParameters: function () { return [{ type: i1.NgControl, decorators: [{
172
- type: Optional
173
- }, {
174
- type: Self
175
- }] }, { type: i2.DomSanitizer }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { fileInputRef: [{
176
- type: ViewChild,
177
- args: ['fileInput']
25
+ /* eslint-disable @nx/enforce-module-boundaries */
26
+ const ImageUploadFieldMixin = crisprControlMixin(CrisprFieldComponent);
27
+ class ImageUploadFieldComponent extends ImageUploadFieldMixin {
28
+ constructor(ngControl, domSanitizer, cdr) {
29
+ super();
30
+ this.ngControl = ngControl;
31
+ this.domSanitizer = domSanitizer;
32
+ this.cdr = cdr;
33
+ this.defaultConfig = {
34
+ // allowMultipleFiles: false,
35
+ acceptedTypes: 'image/*',
36
+ dropZoneText: 'DROP FILE HERE',
37
+ selectFilesButtonType: 'button',
38
+ selectButtonText: 'SELECT',
39
+ showClearFilesButton: true,
40
+ clearFilesButtonText: 'CLEAR',
41
+ resetFilesButtonText: 'RESET',
42
+ imagePreviewHeight: '250px',
43
+ compressImage: false,
44
+ targetCompressedImageFileSizeMb: 0.4,
45
+ minCompressionThresholdMb: 0.6,
46
+ useWebWorker: true,
47
+ };
48
+ this.inputImageFileSubject = new Subject();
49
+ this.inputImageFile$ = this.inputImageFileSubject
50
+ .asObservable()
51
+ .pipe(shareReplay(1));
52
+ this.compressedFile$ = this.inputImageFile$.pipe(switchMap(async (file) => {
53
+ if (!file || !(file instanceof File))
54
+ return null;
55
+ const { compressImage, targetCompressedImageFileSizeMb, minCompressionThresholdMb, maxWidthOrHeight, useWebWorker, } = this.config;
56
+ const fileSizeMb = convertBytesToMb(file.size);
57
+ const shouldCompress = compressImage &&
58
+ targetCompressedImageFileSizeMb < fileSizeMb &&
59
+ minCompressionThresholdMb < fileSizeMb;
60
+ if (shouldCompress) {
61
+ const options = {
62
+ // Use maxWidthOrHeight if it was provided, else use target compressed size
63
+ ...(maxWidthOrHeight
64
+ ? { maxWidthOrHeight }
65
+ : { maxSizeMB: targetCompressedImageFileSizeMb }),
66
+ useWebWorker,
67
+ maxIterations: 30,
68
+ onProgress: (progress) => {
69
+ this.progress = progress;
70
+ this.cdr.detectChanges();
71
+ },
72
+ };
73
+ return await imageCompression(file, options);
74
+ }
75
+ else
76
+ return file;
77
+ }), map((compressedFile) => {
78
+ if (!compressedFile)
79
+ return compressedFile;
80
+ const { type, name, lastModified } = compressedFile;
81
+ return new File([compressedFile], this.config.fileName || name, {
82
+ type,
83
+ lastModified,
84
+ });
85
+ }), tap((file) => {
86
+ // only set the value if there is a file because resetToInitialValue sets the control value
87
+ // to initial value and clears the compressed image, so setting it to null here would undo that
88
+ if (file) {
89
+ this.control.setValue(file);
90
+ }
91
+ if (file || this.value) {
92
+ this.control.markAsTouched();
93
+ setTimeout(() => {
94
+ this.cdr.detectChanges();
95
+ }, 100);
96
+ }
97
+ }), shareReplay(1));
98
+ this.compressedImageUrlString$ = this.compressedFile$.pipe(switchMap(async (file) => {
99
+ if (!file)
100
+ return null;
101
+ const compressedStringImage = await imageCompression.getDataUrlFromFile(file);
102
+ return this.domSanitizer.bypassSecurityTrustResourceUrl(compressedStringImage);
103
+ }), shareReplay(1));
104
+ this.isUploaded = false;
105
+ if (this.ngControl != null) {
106
+ // Setting the value accessor directly (instead of using
107
+ // the providers) to avoid running into a circular import.
108
+ ngControl.valueAccessor = this;
109
+ }
110
+ }
111
+ ngOnInit() {
112
+ super.ngOnInit();
113
+ this.imageSrcUrl$ = combineLatest([
114
+ this.compressedImageUrlString$.pipe(startWith(null)),
115
+ this.control.valueChanges.pipe(startWith(this.value), map((controlValue) => {
116
+ if (!controlValue)
117
+ return null;
118
+ if (controlValue instanceof File)
119
+ return null;
120
+ return (this.config.mapInputValueToUrl?.(controlValue) ||
121
+ controlValue);
122
+ })),
123
+ ]).pipe(map(([compressedImageUrlString, controlUrl]) => {
124
+ return compressedImageUrlString || controlUrl || null;
125
+ }));
126
+ this.disabled$ = this.config.disabledCallback
127
+ ? this.config.disabledCallback(this.group)
128
+ : of(false);
129
+ }
130
+ filesChanged(files) {
131
+ if (files && files.length > 0) {
132
+ const imageFile = files[0];
133
+ // We clear the control here so that it is invalid while compressing
134
+ // the input pipeline will take care of resetting it
135
+ this.control.patchValue(null);
136
+ // this.control.setErrors({compressing: {loadingMessage: 'Please wait while file compresses'}});
137
+ this.control.markAsTouched();
138
+ this.inputImageFileSubject.next(imageFile);
139
+ }
140
+ }
141
+ clearFileInput() {
142
+ this.inputImageFileSubject.next(null);
143
+ this.fileInputRef.nativeElement.value = '';
144
+ this.control.patchValue(null);
145
+ this.control.markAsTouched();
146
+ this.isUploaded = false;
147
+ }
148
+ resetToInitialValue(initialValue) {
149
+ this.inputImageFileSubject.next(null);
150
+ this.control.patchValue(initialValue);
151
+ this.isUploaded = false;
152
+ }
153
+ writeValue(value) { }
154
+ registerOnChange(fn) {
155
+ this.onChange = fn;
156
+ }
157
+ registerOnTouched(fn) { }
158
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.9", ngImport: i0, type: ImageUploadFieldComponent, deps: [{ token: i2.NgControl, optional: true, self: true }, { token: i2$1.DomSanitizer }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
159
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.9", type: ImageUploadFieldComponent, isStandalone: true, selector: "crispr-image-upload-field", viewQueries: [{ propertyName: "fileInputRef", first: true, predicate: ["fileInput"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n\n <mat-form-field floatLabel=\"always\"\n [color]=\"config.color\"\n [appearance]=\"config.appearance\"\n [formGroup]=\"group\">\n <mat-label>{{config.label}}</mat-label>\n <input [formControlName]=\"config.controlName\" matInput type=\"text\"/>\n <input\n #fileInput\n type=\"file\"\n [accept]=\"config.acceptedTypes\"\n (change)=\"filesChanged($event.target.files)\"/>\n <div class=\"ui-container\">\n\n <div class=\"image-preview\" [style.height]=\"config.imagePreviewHeight\">\n <crispr-selected-file\n *ngIf=\"(progress < 100) && inputImageFile$ | async as file; else dropzoneOrPreview\"\n [color]=\"config.color === 'primary' ? 'accent' : 'primary'\"\n [fileName]=\"'Compressing: ' + file.name\"\n [showProgress]=\"true\"\n [progress]=\"progress\">\n </crispr-selected-file>\n\n <ng-template #dropzoneOrPreview>\n <!-- <img *ngIf=\"(initialUrlString$ | async) as initialUrlString;\" [src]=\"initialUrlString\" alt=\"\"> -->\n <img *ngIf=\"imageSrcUrl$ | async as srcUrl; else noImage\" [src]=\"srcUrl\" alt=\"\">\n <ng-template #noImage>\n <div class=\"drop-container\"\n [crisprFileDropzone]=\"!(disabled$ | async)\"\n (fileDrop)=\"filesChanged($event)\">\n <mat-icon class=\"drop-icon\" inline=\"true\">cloud_upload</mat-icon>\n <h2 class=\"mat-h2\">{{config.dropZoneText}}</h2>\n </div>\n </ng-template>\n\n </ng-template>\n </div>\n\n\n\n <!-- </ng-template> -->\n <div class=\"button-container\" *ngIf=\"true\">\n\n <button\n mat-button\n (click)=\"clearFileInput()\"\n type=\"button\"\n [disabled]=\"(disabled$ | async)\"\n aria-label=\"Remove Selected File(s)\">\n <mat-icon>delete</mat-icon>\n {{config.clearFilesButtonText}}\n </button>\n\n <button\n *ngIf=\"value\"\n mat-button\n (click)=\"resetToInitialValue(value)\"\n type=\"button\"\n [disabled]=\"(disabled$ | async)\"\n aria-label=\"Remove Selected File(s)\">\n <mat-icon>replay</mat-icon>\n {{config.resetFilesButtonText}}\n </button>\n\n <button\n mat-button\n type=\"button\"\n color=\"primary\"\n [disabled]=\"(disabled$ | async)\"\n (click)=\"fileInput.click()\"\n [attr.aria-label]=\"config.controlName\">\n <mat-icon>\n camera\n </mat-icon>\n SELECT\n </button>\n </div>\n </div>\n\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n\n</crispr-field-container>\n", styles: [":host ::ng-deep .mat-mdc-form-field .mat-mdc-form-field-infix{padding-top:0}:host ::ng-deep .mat-mdc-form-field .mat-button-wrapper{display:flex;flex-direction:column;align-items:center;padding-top:8px}:host .ui-container{display:flex;flex-direction:column}:host .ui-container .image-preview{display:flex;flex-direction:column;align-content:space-between;justify-content:center;align-items:center;margin:8px 0;flex-grow:1}:host .ui-container .image-preview crispr-selected-file{width:100%}:host .ui-container .image-preview .drop-container{display:flex;box-sizing:border-box;flex-direction:column;align-items:center;border:3px dashed gray;height:100%;width:100%;align-content:center;justify-content:center;border-radius:8px}:host .ui-container .image-preview .drop-container .drop-icon{height:32px;width:32px;font-size:36px}:host .ui-container .image-preview .drop-container .mat-h2{margin:0}:host .ui-container .image-preview img{height:inherit;max-width:100%}:host .ui-container .button-container{display:flex;flex-direction:var(--image-upload-button-container-direction);justify-content:flex-end}:host .ui-container .button-container button{margin-left:8px}:host input{position:absolute;max-height:0;visibility:hidden}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "component", type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2$2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: SelectedFileComponent, selector: "crispr-selected-file", inputs: ["fileName", "progress", "showProgress", "color"] }, { kind: "directive", type: FileDropzoneDirective, selector: "[crisprFileDropzone]", inputs: ["crisprFileDropzone"], outputs: ["fileDrop"] }, { kind: "ngmodule", type: FormValidationHandlerModule }, { kind: "directive", type: i7.ControlErrorsDirective, selector: "[formControl], [formControlName]" }, { kind: "directive", type: i7.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true }); }
160
+ }
161
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.9", ngImport: i0, type: ImageUploadFieldComponent, decorators: [{
162
+ type: Component,
163
+ args: [{ selector: 'crispr-image-upload-field', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
164
+ CommonModule,
165
+ FieldContainerComponent,
166
+ ReactiveFormsModule,
167
+ MatIconModule,
168
+ MatButtonModule,
169
+ MatFormFieldModule,
170
+ MatInputModule,
171
+ SelectedFileComponent,
172
+ FileDropzoneDirective,
173
+ FormValidationHandlerModule,
174
+ ], template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n\n <mat-form-field floatLabel=\"always\"\n [color]=\"config.color\"\n [appearance]=\"config.appearance\"\n [formGroup]=\"group\">\n <mat-label>{{config.label}}</mat-label>\n <input [formControlName]=\"config.controlName\" matInput type=\"text\"/>\n <input\n #fileInput\n type=\"file\"\n [accept]=\"config.acceptedTypes\"\n (change)=\"filesChanged($event.target.files)\"/>\n <div class=\"ui-container\">\n\n <div class=\"image-preview\" [style.height]=\"config.imagePreviewHeight\">\n <crispr-selected-file\n *ngIf=\"(progress < 100) && inputImageFile$ | async as file; else dropzoneOrPreview\"\n [color]=\"config.color === 'primary' ? 'accent' : 'primary'\"\n [fileName]=\"'Compressing: ' + file.name\"\n [showProgress]=\"true\"\n [progress]=\"progress\">\n </crispr-selected-file>\n\n <ng-template #dropzoneOrPreview>\n <!-- <img *ngIf=\"(initialUrlString$ | async) as initialUrlString;\" [src]=\"initialUrlString\" alt=\"\"> -->\n <img *ngIf=\"imageSrcUrl$ | async as srcUrl; else noImage\" [src]=\"srcUrl\" alt=\"\">\n <ng-template #noImage>\n <div class=\"drop-container\"\n [crisprFileDropzone]=\"!(disabled$ | async)\"\n (fileDrop)=\"filesChanged($event)\">\n <mat-icon class=\"drop-icon\" inline=\"true\">cloud_upload</mat-icon>\n <h2 class=\"mat-h2\">{{config.dropZoneText}}</h2>\n </div>\n </ng-template>\n\n </ng-template>\n </div>\n\n\n\n <!-- </ng-template> -->\n <div class=\"button-container\" *ngIf=\"true\">\n\n <button\n mat-button\n (click)=\"clearFileInput()\"\n type=\"button\"\n [disabled]=\"(disabled$ | async)\"\n aria-label=\"Remove Selected File(s)\">\n <mat-icon>delete</mat-icon>\n {{config.clearFilesButtonText}}\n </button>\n\n <button\n *ngIf=\"value\"\n mat-button\n (click)=\"resetToInitialValue(value)\"\n type=\"button\"\n [disabled]=\"(disabled$ | async)\"\n aria-label=\"Remove Selected File(s)\">\n <mat-icon>replay</mat-icon>\n {{config.resetFilesButtonText}}\n </button>\n\n <button\n mat-button\n type=\"button\"\n color=\"primary\"\n [disabled]=\"(disabled$ | async)\"\n (click)=\"fileInput.click()\"\n [attr.aria-label]=\"config.controlName\">\n <mat-icon>\n camera\n </mat-icon>\n SELECT\n </button>\n </div>\n </div>\n\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n\n</crispr-field-container>\n", styles: [":host ::ng-deep .mat-mdc-form-field .mat-mdc-form-field-infix{padding-top:0}:host ::ng-deep .mat-mdc-form-field .mat-button-wrapper{display:flex;flex-direction:column;align-items:center;padding-top:8px}:host .ui-container{display:flex;flex-direction:column}:host .ui-container .image-preview{display:flex;flex-direction:column;align-content:space-between;justify-content:center;align-items:center;margin:8px 0;flex-grow:1}:host .ui-container .image-preview crispr-selected-file{width:100%}:host .ui-container .image-preview .drop-container{display:flex;box-sizing:border-box;flex-direction:column;align-items:center;border:3px dashed gray;height:100%;width:100%;align-content:center;justify-content:center;border-radius:8px}:host .ui-container .image-preview .drop-container .drop-icon{height:32px;width:32px;font-size:36px}:host .ui-container .image-preview .drop-container .mat-h2{margin:0}:host .ui-container .image-preview img{height:inherit;max-width:100%}:host .ui-container .button-container{display:flex;flex-direction:var(--image-upload-button-container-direction);justify-content:flex-end}:host .ui-container .button-container button{margin-left:8px}:host input{position:absolute;max-height:0;visibility:hidden}\n"] }]
175
+ }], ctorParameters: () => [{ type: i2.NgControl, decorators: [{
176
+ type: Optional
177
+ }, {
178
+ type: Self
179
+ }] }, { type: i2$1.DomSanitizer }, { type: i0.ChangeDetectorRef }], propDecorators: { fileInputRef: [{
180
+ type: ViewChild,
181
+ args: ['fileInput']
178
182
  }] } });
179
183
 
180
- /**
181
- * Generated bundle index. Do not edit.
182
- */
183
-
184
184
  export { ImageUploadFieldComponent };
185
- //# sourceMappingURL=tft-crispr-forms-ui-image-upload-field.mjs.map
185
+ //# sourceMappingURL=tft-crispr-forms-index-BXwiulEX.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tft-crispr-forms-index-BXwiulEX.mjs","sources":["../../../../libs/crispr-forms/src/lib/ui/image-upload-field/image-upload-field.component.ts","../../../../libs/crispr-forms/src/lib/ui/image-upload-field/image-upload-field.component.html"],"sourcesContent":["/* eslint-disable @nx/enforce-module-boundaries */\nimport { CommonModule } from '@angular/common';\nimport {\n Component,\n ElementRef,\n ViewChild,\n OnInit,\n ChangeDetectionStrategy,\n Optional,\n Self,\n ChangeDetectorRef,\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n NgControl,\n ReactiveFormsModule,\n} from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatInputModule } from '@angular/material/input';\nimport { DomSanitizer } from '@angular/platform-browser';\nimport imageCompression from 'browser-image-compression';\nimport { combineLatest, Observable, of, Subject } from 'rxjs';\nimport { map, shareReplay, startWith, switchMap, tap } from 'rxjs/operators';\nimport { FormValidationHandlerModule } from '@tft/form-validation-handler';\nimport { FileDropzoneDirective } from '../file-dropzone';\nimport { SelectedFileComponent } from '../selected-file';\nimport { FieldContainerComponent } from '../field-container';\nimport {\n crisprControlMixin,\n CrisprFieldComponent,\n convertBytesToMb,\n ImageUploadFieldConfig,\n} from '../../utils';\n\nconst ImageUploadFieldMixin =\n crisprControlMixin<ImageUploadFieldConfig>(CrisprFieldComponent);\n\n@Component({\n selector: 'crispr-image-upload-field',\n templateUrl: './image-upload-field.component.html',\n styleUrls: ['./image-upload-field.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n CommonModule,\n FieldContainerComponent,\n ReactiveFormsModule,\n MatIconModule,\n MatButtonModule,\n MatFormFieldModule,\n MatInputModule,\n SelectedFileComponent,\n FileDropzoneDirective,\n FormValidationHandlerModule,\n ],\n})\nexport class ImageUploadFieldComponent\n extends ImageUploadFieldMixin\n implements OnInit, ControlValueAccessor\n{\n onChange: () => void;\n\n defaultConfig: Partial<ImageUploadFieldConfig> = {\n // allowMultipleFiles: false,\n acceptedTypes: 'image/*',\n dropZoneText: 'DROP FILE HERE',\n selectFilesButtonType: 'button',\n selectButtonText: 'SELECT',\n showClearFilesButton: true,\n clearFilesButtonText: 'CLEAR',\n resetFilesButtonText: 'RESET',\n imagePreviewHeight: '250px',\n compressImage: false,\n targetCompressedImageFileSizeMb: 0.4,\n minCompressionThresholdMb: 0.6,\n useWebWorker: true,\n };\n\n private inputImageFileSubject = new Subject<File | null>();\n inputImageFile$ = this.inputImageFileSubject\n .asObservable()\n .pipe(shareReplay(1));\n /**\n * the compression progress\n */\n progress: number | undefined;\n\n compressedFile$: Observable<File> = this.inputImageFile$.pipe(\n switchMap(async (file) => {\n if (!file || !(file instanceof File)) return null;\n const {\n compressImage,\n targetCompressedImageFileSizeMb,\n minCompressionThresholdMb,\n maxWidthOrHeight,\n useWebWorker,\n } = this.config;\n const fileSizeMb = convertBytesToMb(file.size);\n const shouldCompress =\n compressImage &&\n targetCompressedImageFileSizeMb < fileSizeMb &&\n minCompressionThresholdMb < fileSizeMb;\n if (shouldCompress) {\n const options = {\n // Use maxWidthOrHeight if it was provided, else use target compressed size\n ...(maxWidthOrHeight\n ? { maxWidthOrHeight }\n : { maxSizeMB: targetCompressedImageFileSizeMb }),\n useWebWorker,\n maxIterations: 30,\n onProgress: (progress: number) => {\n this.progress = progress;\n this.cdr.detectChanges();\n },\n };\n return await imageCompression(file, options);\n } else return file;\n }),\n map((compressedFile: File) => {\n if (!compressedFile) return compressedFile;\n const { type, name, lastModified } = compressedFile;\n return new File([compressedFile], this.config.fileName || name, {\n type,\n lastModified,\n });\n }),\n tap((file) => {\n // only set the value if there is a file because resetToInitialValue sets the control value\n // to initial value and clears the compressed image, so setting it to null here would undo that\n if (file) {\n this.control.setValue(file);\n }\n if (file || this.value) {\n this.control.markAsTouched();\n setTimeout(() => {\n this.cdr.detectChanges();\n }, 100);\n }\n }),\n shareReplay(1)\n );\n\n compressedImageUrlString$: Observable<string | null> =\n this.compressedFile$.pipe(\n switchMap(async (file) => {\n if (!file) return null;\n const compressedStringImage = await imageCompression.getDataUrlFromFile(\n file\n );\n return this.domSanitizer.bypassSecurityTrustResourceUrl(\n compressedStringImage\n ) as string;\n }),\n shareReplay(1)\n );\n\n // This is what is displayed by the image preview\n imageSrcUrl$: Observable<string | null>;\n\n @ViewChild('fileInput') fileInputRef: ElementRef;\n\n selectedFiles: FileList;\n\n isUploaded = false;\n\n disabled$: Observable<boolean>;\n\n constructor(\n @Optional() @Self() public ngControl: NgControl,\n private domSanitizer: DomSanitizer,\n private cdr: ChangeDetectorRef\n ) {\n super();\n if (this.ngControl != null) {\n // Setting the value accessor directly (instead of using\n // the providers) to avoid running into a circular import.\n ngControl.valueAccessor = this;\n }\n }\n\n ngOnInit() {\n super.ngOnInit();\n this.imageSrcUrl$ = combineLatest([\n this.compressedImageUrlString$.pipe(startWith(null)),\n this.control.valueChanges.pipe(\n startWith(this.value),\n map((controlValue): string => {\n if (!controlValue) return null;\n if (controlValue instanceof File) return null;\n return (\n this.config.mapInputValueToUrl?.(controlValue) ||\n (controlValue as string)\n );\n })\n ),\n ]).pipe(\n map(([compressedImageUrlString, controlUrl]) => {\n return compressedImageUrlString || controlUrl || null;\n })\n );\n this.disabled$ = this.config.disabledCallback\n ? this.config.disabledCallback(this.group)\n : of(false);\n }\n\n filesChanged(files: FileList): void {\n if (files && files.length > 0) {\n const imageFile = files[0];\n // We clear the control here so that it is invalid while compressing\n // the input pipeline will take care of resetting it\n this.control.patchValue(null);\n // this.control.setErrors({compressing: {loadingMessage: 'Please wait while file compresses'}});\n this.control.markAsTouched();\n this.inputImageFileSubject.next(imageFile);\n }\n }\n\n clearFileInput(): void {\n this.inputImageFileSubject.next(null);\n this.fileInputRef.nativeElement.value = '';\n this.control.patchValue(null);\n this.control.markAsTouched();\n this.isUploaded = false;\n }\n\n resetToInitialValue(initialValue: string): void {\n this.inputImageFileSubject.next(null);\n this.control.patchValue(initialValue);\n this.isUploaded = false;\n }\n\n writeValue(value: null) {}\n\n registerOnChange(fn: () => void) {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void) {}\n}\n","<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n\n <mat-form-field floatLabel=\"always\"\n [color]=\"config.color\"\n [appearance]=\"config.appearance\"\n [formGroup]=\"group\">\n <mat-label>{{config.label}}</mat-label>\n <input [formControlName]=\"config.controlName\" matInput type=\"text\"/>\n <input\n #fileInput\n type=\"file\"\n [accept]=\"config.acceptedTypes\"\n (change)=\"filesChanged($event.target.files)\"/>\n <div class=\"ui-container\">\n\n <div class=\"image-preview\" [style.height]=\"config.imagePreviewHeight\">\n <crispr-selected-file\n *ngIf=\"(progress < 100) && inputImageFile$ | async as file; else dropzoneOrPreview\"\n [color]=\"config.color === 'primary' ? 'accent' : 'primary'\"\n [fileName]=\"'Compressing: ' + file.name\"\n [showProgress]=\"true\"\n [progress]=\"progress\">\n </crispr-selected-file>\n\n <ng-template #dropzoneOrPreview>\n <!-- <img *ngIf=\"(initialUrlString$ | async) as initialUrlString;\" [src]=\"initialUrlString\" alt=\"\"> -->\n <img *ngIf=\"imageSrcUrl$ | async as srcUrl; else noImage\" [src]=\"srcUrl\" alt=\"\">\n <ng-template #noImage>\n <div class=\"drop-container\"\n [crisprFileDropzone]=\"!(disabled$ | async)\"\n (fileDrop)=\"filesChanged($event)\">\n <mat-icon class=\"drop-icon\" inline=\"true\">cloud_upload</mat-icon>\n <h2 class=\"mat-h2\">{{config.dropZoneText}}</h2>\n </div>\n </ng-template>\n\n </ng-template>\n </div>\n\n\n\n <!-- </ng-template> -->\n <div class=\"button-container\" *ngIf=\"true\">\n\n <button\n mat-button\n (click)=\"clearFileInput()\"\n type=\"button\"\n [disabled]=\"(disabled$ | async)\"\n aria-label=\"Remove Selected File(s)\">\n <mat-icon>delete</mat-icon>\n {{config.clearFilesButtonText}}\n </button>\n\n <button\n *ngIf=\"value\"\n mat-button\n (click)=\"resetToInitialValue(value)\"\n type=\"button\"\n [disabled]=\"(disabled$ | async)\"\n aria-label=\"Remove Selected File(s)\">\n <mat-icon>replay</mat-icon>\n {{config.resetFilesButtonText}}\n </button>\n\n <button\n mat-button\n type=\"button\"\n color=\"primary\"\n [disabled]=\"(disabled$ | async)\"\n (click)=\"fileInput.click()\"\n [attr.aria-label]=\"config.controlName\">\n <mat-icon>\n camera\n </mat-icon>\n SELECT\n </button>\n </div>\n </div>\n\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n\n</crispr-field-container>\n"],"names":["i1","i2","i5","i6","i8"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAoCA,MAAM,qBAAqB,GACzB,kBAAkB,CAAyB,oBAAoB,CAAC,CAAC;AAqB7D,MAAO,yBACX,SAAQ,qBAAqB,CAAA;AA8G7B,IAAA,WAAA,CAC6B,SAAoB,EACvC,YAA0B,EAC1B,GAAsB,EAAA;AAE9B,QAAA,KAAK,EAAE,CAAC;QAJmB,IAAS,CAAA,SAAA,GAAT,SAAS,CAAW;QACvC,IAAY,CAAA,YAAA,GAAZ,YAAY,CAAc;QAC1B,IAAG,CAAA,GAAA,GAAH,GAAG,CAAmB;AA5GhC,QAAA,IAAA,CAAA,aAAa,GAAoC;;AAE/C,YAAA,aAAa,EAAE,SAAS;AACxB,YAAA,YAAY,EAAE,gBAAgB;AAC9B,YAAA,qBAAqB,EAAE,QAAQ;AAC/B,YAAA,gBAAgB,EAAE,QAAQ;AAC1B,YAAA,oBAAoB,EAAE,IAAI;AAC1B,YAAA,oBAAoB,EAAE,OAAO;AAC7B,YAAA,oBAAoB,EAAE,OAAO;AAC7B,YAAA,kBAAkB,EAAE,OAAO;AAC3B,YAAA,aAAa,EAAE,KAAK;AACpB,YAAA,+BAA+B,EAAE,GAAG;AACp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AAA,QAAA,EAAA,kCAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAAA,EAAA,CAAA,8BAAA,EAAA,QAAA,EAAA,sCAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,mBAAA,EAAA,IAAA,EAAA,CAAA,CAAA,EAAA;;2FAGlB,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBAnBrC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,2BAA2B,mBAGpB,uBAAuB,CAAC,MAAM,EAAA,UAAA,EACnC,IAAI,EACP,OAAA,EAAA;wBACP,YAAY;wBACZ,uBAAuB;wBACvB,mBAAmB;wBACnB,aAAa;wBACb,eAAe;wBACf,kBAAkB;wBAClB,cAAc;wBACd,qBAAqB;wBACrB,qBAAqB;wBACrB,2BAA2B;AAC5B,qBAAA,EAAA,QAAA,EAAA,i2FAAA,EAAA,MAAA,EAAA,CAAA,ysCAAA,CAAA,EAAA,CAAA;;0BAkHE,QAAQ;;0BAAI,IAAI;sGATK,YAAY,EAAA,CAAA;sBAAnC,SAAS;uBAAC,WAAW,CAAA;;;;;"}
@@ -0,0 +1,110 @@
1
+ import * as i1 from '@angular/common';
2
+ import { CommonModule } from '@angular/common';
3
+ import * as i0 from '@angular/core';
4
+ import { Component, ChangeDetectionStrategy, Optional, Self, ViewChild } from '@angular/core';
5
+ import * as i2 from '@angular/forms';
6
+ import { ReactiveFormsModule } from '@angular/forms';
7
+ import * as i2$1 from '@angular/material/button';
8
+ import { MatButtonModule } from '@angular/material/button';
9
+ import * as i3$1 from '@angular/material/form-field';
10
+ import { MatFormFieldModule } from '@angular/material/form-field';
11
+ import * as i3 from '@angular/material/icon';
12
+ import { MatIconModule } from '@angular/material/icon';
13
+ import * as i5 from '@angular/material/input';
14
+ import { MatInputModule } from '@angular/material/input';
15
+ import { of } from 'rxjs';
16
+ import { crisprControlMixin, CrisprFieldComponent, FieldContainerComponent, SelectedFileComponent, FileDropzoneDirective } from './tft-crispr-forms.mjs';
17
+ import * as i7 from '@tft/form-validation-handler';
18
+ import { FormValidationHandlerModule } from '@tft/form-validation-handler';
19
+ import 'rxjs/operators';
20
+ import '@angular/material/progress-bar';
21
+ import '@angular/material/tooltip';
22
+
23
+ /* eslint-disable @nx/enforce-module-boundaries */
24
+ const FileUploadFieldMixin = crisprControlMixin(CrisprFieldComponent);
25
+ class FileUploadFieldComponent extends FileUploadFieldMixin {
26
+ // ngControl: NgControl = null;
27
+ constructor(ngControl) {
28
+ super();
29
+ this.ngControl = ngControl;
30
+ this.defaultConfig = {
31
+ allowMultipleFiles: false,
32
+ acceptedTypes: '*.*',
33
+ dropZoneText: 'DROP FILE HERE',
34
+ selectFilesButtonType: 'button',
35
+ selectButtonText: 'SELECT',
36
+ showClearFilesButton: true,
37
+ clearFilesButtonText: 'CLEAR',
38
+ uploadButtonText: 'UPLOAD',
39
+ uploadButtonType: 'button',
40
+ showUploadProgress: false,
41
+ disableOnUpload: true,
42
+ };
43
+ this.isUploaded = false;
44
+ this.fileProgress = [];
45
+ if (this.ngControl != null) {
46
+ // Setting the value accessor directly (instead of using
47
+ // the providers) to avoid running into a circular import.
48
+ ngControl.valueAccessor = this;
49
+ }
50
+ }
51
+ ngOnInit() {
52
+ super.ngOnInit();
53
+ this.disabled$ = this.config.disabledCallback
54
+ ? this.config.disabledCallback(this.group)
55
+ : of(false);
56
+ }
57
+ filesChanged(files) {
58
+ if (files && files.length > 0) {
59
+ this.selectedFiles = files;
60
+ this.control.patchValue(files);
61
+ }
62
+ }
63
+ uploadFiles() {
64
+ if (this.selectedFiles && this.config.uploadFiles) {
65
+ this.isUploaded = true;
66
+ this.config.uploadFiles(this.group, this.selectedFiles, this);
67
+ }
68
+ }
69
+ resetFileInput() {
70
+ this.fileInputRef.nativeElement.value = '';
71
+ this.control.patchValue(null);
72
+ this.isUploaded = false;
73
+ }
74
+ writeValue(value) {
75
+ // clear file input
76
+ // this.host.nativeElement.value = '';
77
+ // this.file = null;
78
+ }
79
+ registerOnChange(fn) {
80
+ this.onChange = fn;
81
+ }
82
+ registerOnTouched(fn) { }
83
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.9", ngImport: i0, type: FileUploadFieldComponent, deps: [{ token: i2.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component }); }
84
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.9", type: FileUploadFieldComponent, isStandalone: true, selector: "crispr-file-upload-field", viewQueries: [{ propertyName: "fileInputRef", first: true, predicate: ["fileInput"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <mat-form-field floatLabel=\"always\"\n [color]=\"config.color\"\n appearance=\"outline\"\n [crisprFileDropzone]=\"!(disabled$ | async) && !(config.disableOnUpload && isUploaded)\"\n [formGroup]=\"group\"\n (fileDrop)=\"filesChanged($event)\">\n\n <input [formControlName]=\"config.controlName\" matInput type=\"text\"/>\n <input\n #fileInput\n type=\"file\"\n style=\"display: none\"\n [accept]=\"config.acceptedTypes\"\n [multiple]=\"config.allowMultipleFiles\"\n (change)=\"filesChanged($event.target.files)\"/>\n <mat-label>{{config.label}}</mat-label>\n\n <div *ngIf=\"!(selectedFiles?.length > 0); else selectedFileList\" class=\"drop-info\">\n <mat-icon class=\"drop-icon\" inline=\"true\">cloud_upload</mat-icon>\n <h2 class=\"mat-h2\">{{config.dropZoneText}}</h2>\n or\n <button\n mat-raised-button\n type=\"button\"\n color=\"primary\"\n [disabled]=\"(disabled$ | async) || config.disableOnUpload && isUploaded\"\n (click)=\"fileInput.click()\"\n [attr.aria-label]=\"config.controlName\">\n {{config.selectButtonText}}\n </button>\n </div>\n <ng-template #selectedFileList>\n <div class=\"selected-files-container\">\n <div class=\"selected-files-list\">\n <crispr-selected-file\n *ngFor=\"let file of selectedFiles; let i = index;\"\n [color]=\"config.color === 'primary' ? 'accent' : 'primary'\"\n [fileName]=\"file.name\"\n [showProgress]=\"config.showUploadProgress\"\n [progress]=\"fileProgress && (fileProgress[i] | async)\">\n </crispr-selected-file>\n </div>\n\n </div>\n </ng-template>\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n </mat-form-field>\n <div class=\"button-container\" *ngIf=\"selectedFiles?.length > 0\">\n\n <button\n mat-button\n (click)=\"resetFileInput()\"\n type=\"button\"\n [disabled]=\"(disabled$ | async) || (config.disableOnUpload && isUploaded)\"\n aria-label=\"Remove Selected File(s)\">\n {{config.clearFilesButtonText}}\n <mat-icon>delete</mat-icon>\n </button>\n\n <button\n *ngIf=\"!!config.uploadFiles\"\n mat-raised-button\n type=\"button\"\n color=\"accent\"\n class=\"file-input-button\"\n [disabled]=\"(disabled$ | async) || (config.disableOnUpload && isUploaded)\"\n (click)=\"uploadFiles()\"\n [attr.aria-label]=\"config.uploadButtonText\">\n {{ config.uploadButtonText }}\n </button>\n\n </div>\n</crispr-field-container>\n", styles: [":host ::ng-deep .mat-mdc-form-field .mat-mdc-form-field-infix{padding-top:0;display:flex;justify-content:center}:host .drop-info{display:flex;flex-direction:column;align-items:center}:host .drop-info .drop-icon{font-size:36px}:host .drop-info .mat-h2{margin:0}:host .button-container{display:flex;justify-content:flex-end;margin-top:-16px}:host .button-container button{margin-left:8px}:host .selected-files-container{width:100%}:host [matInput]{position:absolute;max-height:0;visibility:hidden}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "component", type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2$1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: SelectedFileComponent, selector: "crispr-selected-file", inputs: ["fileName", "progress", "showProgress", "color"] }, { kind: "ngmodule", type: FormValidationHandlerModule }, { kind: "directive", type: i7.ControlErrorsDirective, selector: "[formControl], [formControlName]" }, { kind: "directive", type: i7.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }, { kind: "directive", type: FileDropzoneDirective, selector: "[crisprFileDropzone]", inputs: ["crisprFileDropzone"], outputs: ["fileDrop"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true }); }
85
+ }
86
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.9", ngImport: i0, type: FileUploadFieldComponent, decorators: [{
87
+ type: Component,
88
+ args: [{ selector: 'crispr-file-upload-field', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
89
+ CommonModule,
90
+ FieldContainerComponent,
91
+ ReactiveFormsModule,
92
+ MatIconModule,
93
+ MatButtonModule,
94
+ MatFormFieldModule,
95
+ MatInputModule,
96
+ SelectedFileComponent,
97
+ FormValidationHandlerModule,
98
+ FileDropzoneDirective,
99
+ ], template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <mat-form-field floatLabel=\"always\"\n [color]=\"config.color\"\n appearance=\"outline\"\n [crisprFileDropzone]=\"!(disabled$ | async) && !(config.disableOnUpload && isUploaded)\"\n [formGroup]=\"group\"\n (fileDrop)=\"filesChanged($event)\">\n\n <input [formControlName]=\"config.controlName\" matInput type=\"text\"/>\n <input\n #fileInput\n type=\"file\"\n style=\"display: none\"\n [accept]=\"config.acceptedTypes\"\n [multiple]=\"config.allowMultipleFiles\"\n (change)=\"filesChanged($event.target.files)\"/>\n <mat-label>{{config.label}}</mat-label>\n\n <div *ngIf=\"!(selectedFiles?.length > 0); else selectedFileList\" class=\"drop-info\">\n <mat-icon class=\"drop-icon\" inline=\"true\">cloud_upload</mat-icon>\n <h2 class=\"mat-h2\">{{config.dropZoneText}}</h2>\n or\n <button\n mat-raised-button\n type=\"button\"\n color=\"primary\"\n [disabled]=\"(disabled$ | async) || config.disableOnUpload && isUploaded\"\n (click)=\"fileInput.click()\"\n [attr.aria-label]=\"config.controlName\">\n {{config.selectButtonText}}\n </button>\n </div>\n <ng-template #selectedFileList>\n <div class=\"selected-files-container\">\n <div class=\"selected-files-list\">\n <crispr-selected-file\n *ngFor=\"let file of selectedFiles; let i = index;\"\n [color]=\"config.color === 'primary' ? 'accent' : 'primary'\"\n [fileName]=\"file.name\"\n [showProgress]=\"config.showUploadProgress\"\n [progress]=\"fileProgress && (fileProgress[i] | async)\">\n </crispr-selected-file>\n </div>\n\n </div>\n </ng-template>\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n </mat-form-field>\n <div class=\"button-container\" *ngIf=\"selectedFiles?.length > 0\">\n\n <button\n mat-button\n (click)=\"resetFileInput()\"\n type=\"button\"\n [disabled]=\"(disabled$ | async) || (config.disableOnUpload && isUploaded)\"\n aria-label=\"Remove Selected File(s)\">\n {{config.clearFilesButtonText}}\n <mat-icon>delete</mat-icon>\n </button>\n\n <button\n *ngIf=\"!!config.uploadFiles\"\n mat-raised-button\n type=\"button\"\n color=\"accent\"\n class=\"file-input-button\"\n [disabled]=\"(disabled$ | async) || (config.disableOnUpload && isUploaded)\"\n (click)=\"uploadFiles()\"\n [attr.aria-label]=\"config.uploadButtonText\">\n {{ config.uploadButtonText }}\n </button>\n\n </div>\n</crispr-field-container>\n", styles: [":host ::ng-deep .mat-mdc-form-field .mat-mdc-form-field-infix{padding-top:0;display:flex;justify-content:center}:host .drop-info{display:flex;flex-direction:column;align-items:center}:host .drop-info .drop-icon{font-size:36px}:host .drop-info .mat-h2{margin:0}:host .button-container{display:flex;justify-content:flex-end;margin-top:-16px}:host .button-container button{margin-left:8px}:host .selected-files-container{width:100%}:host [matInput]{position:absolute;max-height:0;visibility:hidden}\n"] }]
100
+ }], ctorParameters: () => [{ type: i2.NgControl, decorators: [{
101
+ type: Optional
102
+ }, {
103
+ type: Self
104
+ }] }], propDecorators: { fileInputRef: [{
105
+ type: ViewChild,
106
+ args: ['fileInput']
107
+ }] } });
108
+
109
+ export { FileUploadFieldComponent };
110
+ //# sourceMappingURL=tft-crispr-forms-index-BfR4XbYi.mjs.map