@tft/crispr-forms 18.0.2 → 20.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 (303) hide show
  1. package/README.md +111 -112
  2. package/fesm2022/tft-crispr-forms-autocomplete-field.component-jdr2Hr6I.mjs +95 -0
  3. package/fesm2022/tft-crispr-forms-autocomplete-field.component-jdr2Hr6I.mjs.map +1 -0
  4. package/fesm2022/tft-crispr-forms-index-BHv9E1Y2.mjs +36 -0
  5. package/fesm2022/tft-crispr-forms-index-BHv9E1Y2.mjs.map +1 -0
  6. package/fesm2022/tft-crispr-forms-index-BIhGbdgn.mjs +68 -0
  7. package/fesm2022/tft-crispr-forms-index-BIhGbdgn.mjs.map +1 -0
  8. package/fesm2022/tft-crispr-forms-index-BQFuEW6x.mjs +40 -0
  9. package/fesm2022/tft-crispr-forms-index-BQFuEW6x.mjs.map +1 -0
  10. package/fesm2022/tft-crispr-forms-index-BWsxn34Q.mjs +2 -0
  11. package/fesm2022/tft-crispr-forms-index-BWsxn34Q.mjs.map +1 -0
  12. package/fesm2022/tft-crispr-forms-index-Bh8kDfe4.mjs +39 -0
  13. package/fesm2022/tft-crispr-forms-index-Bh8kDfe4.mjs.map +1 -0
  14. package/fesm2022/tft-crispr-forms-index-C9gYJRzb.mjs +182 -0
  15. package/fesm2022/tft-crispr-forms-index-C9gYJRzb.mjs.map +1 -0
  16. package/fesm2022/tft-crispr-forms-index-ClPQl_5D.mjs +137 -0
  17. package/fesm2022/tft-crispr-forms-index-ClPQl_5D.mjs.map +1 -0
  18. package/fesm2022/tft-crispr-forms-index-DCRLl0jR.mjs +190 -0
  19. package/fesm2022/tft-crispr-forms-index-DCRLl0jR.mjs.map +1 -0
  20. package/fesm2022/tft-crispr-forms-index-Dx-HIAiX.mjs +39 -0
  21. package/fesm2022/tft-crispr-forms-index-Dx-HIAiX.mjs.map +1 -0
  22. package/fesm2022/tft-crispr-forms-index-Dyx5SqHu.mjs +88 -0
  23. package/fesm2022/tft-crispr-forms-index-Dyx5SqHu.mjs.map +1 -0
  24. package/fesm2022/tft-crispr-forms-index-LX0Bvkjk.mjs +73 -0
  25. package/fesm2022/tft-crispr-forms-index-LX0Bvkjk.mjs.map +1 -0
  26. package/fesm2022/tft-crispr-forms-index-UAYeTe3L.mjs +17 -0
  27. package/fesm2022/tft-crispr-forms-index-UAYeTe3L.mjs.map +1 -0
  28. package/fesm2022/tft-crispr-forms-index-UvEVbwnf.mjs +41 -0
  29. package/fesm2022/tft-crispr-forms-index-UvEVbwnf.mjs.map +1 -0
  30. package/fesm2022/tft-crispr-forms-index-joNvlmny.mjs +61 -0
  31. package/fesm2022/tft-crispr-forms-index-joNvlmny.mjs.map +1 -0
  32. package/fesm2022/tft-crispr-forms-index-kjMTlZoq.mjs +24 -0
  33. package/fesm2022/tft-crispr-forms-index-kjMTlZoq.mjs.map +1 -0
  34. package/fesm2022/tft-crispr-forms.mjs +206 -175
  35. package/fesm2022/tft-crispr-forms.mjs.map +1 -1
  36. package/package.json +3 -5
  37. package/tft-crispr-forms-20.0.0.tgz +0 -0
  38. package/types/tft-crispr-forms.d.ts +887 -0
  39. package/esm2022/public-api.mjs +0 -4
  40. package/esm2022/src/index.mjs +0 -2
  41. package/esm2022/src/lib/crispr-forms.module.mjs +0 -55
  42. package/esm2022/src/lib/display-field.directive.mjs +0 -52
  43. package/esm2022/src/lib/field-component-map.const.mjs +0 -29
  44. package/esm2022/src/lib/field.directive.mjs +0 -69
  45. package/esm2022/src/lib/form/form.component.mjs +0 -62
  46. package/esm2022/src/lib/form-group-list/form-group-list.component.mjs +0 -97
  47. package/esm2022/src/lib/form-group-list/index.mjs +0 -2
  48. package/esm2022/src/lib/pipes/crispr-pipes.module.mjs +0 -24
  49. package/esm2022/src/lib/pipes/initial-control-value.pipe.mjs +0 -20
  50. package/esm2022/src/lib/public_api.mjs +0 -4
  51. package/esm2022/src/lib/sub-group/index.mjs +0 -3
  52. package/esm2022/src/lib/sub-group/sub-group.component.mjs +0 -20
  53. package/esm2022/src/lib/sub-group/sub-group.module.mjs +0 -42
  54. package/esm2022/src/lib/ui/autocomplete-chiplist-field/autocomplete-chiplist-field.component.mjs +0 -138
  55. package/esm2022/src/lib/ui/autocomplete-chiplist-field/index.mjs +0 -2
  56. package/esm2022/src/lib/ui/autocomplete-chiplist-field/public-api.mjs +0 -2
  57. package/esm2022/src/lib/ui/autocomplete-field/autocomplete-field.component.mjs +0 -95
  58. package/esm2022/src/lib/ui/autocomplete-field/index.mjs +0 -2
  59. package/esm2022/src/lib/ui/autocomplete-field/public-api.mjs +0 -2
  60. package/esm2022/src/lib/ui/button/button.component.mjs +0 -52
  61. package/esm2022/src/lib/ui/button/index.mjs +0 -2
  62. package/esm2022/src/lib/ui/button/public-api.mjs +0 -2
  63. package/esm2022/src/lib/ui/checkbox-field/checkbox-field.component.mjs +0 -42
  64. package/esm2022/src/lib/ui/checkbox-field/index.mjs +0 -2
  65. package/esm2022/src/lib/ui/checkbox-field/public-api.mjs +0 -2
  66. package/esm2022/src/lib/ui/datepicker-field/datepicker-field.component.mjs +0 -66
  67. package/esm2022/src/lib/ui/datepicker-field/index.mjs +0 -2
  68. package/esm2022/src/lib/ui/datepicker-field/public-api.mjs +0 -2
  69. package/esm2022/src/lib/ui/divider/divider.component.mjs +0 -25
  70. package/esm2022/src/lib/ui/divider/index.mjs +0 -2
  71. package/esm2022/src/lib/ui/divider/public-api.mjs +0 -2
  72. package/esm2022/src/lib/ui/field-container/field-container.component.mjs +0 -59
  73. package/esm2022/src/lib/ui/field-container/index.mjs +0 -2
  74. package/esm2022/src/lib/ui/field-container/public-api.mjs +0 -2
  75. package/esm2022/src/lib/ui/file-dropzone/file-dropzone.directive.mjs +0 -40
  76. package/esm2022/src/lib/ui/file-dropzone/index.mjs +0 -2
  77. package/esm2022/src/lib/ui/file-dropzone/public-api.mjs +0 -2
  78. package/esm2022/src/lib/ui/file-upload-field/file-upload-field.component.mjs +0 -107
  79. package/esm2022/src/lib/ui/file-upload-field/index.mjs +0 -2
  80. package/esm2022/src/lib/ui/file-upload-field/public-api.mjs +0 -2
  81. package/esm2022/src/lib/ui/heading/heading.component.mjs +0 -27
  82. package/esm2022/src/lib/ui/heading/index.mjs +0 -2
  83. package/esm2022/src/lib/ui/heading/public-api.mjs +0 -2
  84. package/esm2022/src/lib/ui/image-upload-field/image-upload-field.component.mjs +0 -184
  85. package/esm2022/src/lib/ui/image-upload-field/index.mjs +0 -2
  86. package/esm2022/src/lib/ui/image-upload-field/public-api.mjs +0 -2
  87. package/esm2022/src/lib/ui/index.mjs +0 -2
  88. package/esm2022/src/lib/ui/info/index.mjs +0 -2
  89. package/esm2022/src/lib/ui/info/info.component.mjs +0 -23
  90. package/esm2022/src/lib/ui/info/public-api.mjs +0 -2
  91. package/esm2022/src/lib/ui/input-field/index.mjs +0 -2
  92. package/esm2022/src/lib/ui/input-field/input-field.component.mjs +0 -43
  93. package/esm2022/src/lib/ui/input-field/public-api.mjs +0 -2
  94. package/esm2022/src/lib/ui/map/index.mjs +0 -2
  95. package/esm2022/src/lib/ui/map/map-field.component.mjs +0 -22
  96. package/esm2022/src/lib/ui/map/public-api.mjs +0 -2
  97. package/esm2022/src/lib/ui/option/index.mjs +0 -2
  98. package/esm2022/src/lib/ui/option/option.component.mjs +0 -16
  99. package/esm2022/src/lib/ui/option/public-api.mjs +0 -2
  100. package/esm2022/src/lib/ui/public-api.mjs +0 -8
  101. package/esm2022/src/lib/ui/radio-field/index.mjs +0 -2
  102. package/esm2022/src/lib/ui/radio-field/public-api.mjs +0 -2
  103. package/esm2022/src/lib/ui/radio-field/radio-field.component.mjs +0 -39
  104. package/esm2022/src/lib/ui/select-field/index.mjs +0 -2
  105. package/esm2022/src/lib/ui/select-field/public-api.mjs +0 -2
  106. package/esm2022/src/lib/ui/select-field/select-field.component.mjs +0 -73
  107. package/esm2022/src/lib/ui/selected-file/index.mjs +0 -2
  108. package/esm2022/src/lib/ui/selected-file/public-api.mjs +0 -2
  109. package/esm2022/src/lib/ui/selected-file/selected-file.component.mjs +0 -26
  110. package/esm2022/src/lib/ui/slider-field/index.mjs +0 -2
  111. package/esm2022/src/lib/ui/slider-field/public-api.mjs +0 -2
  112. package/esm2022/src/lib/ui/slider-field/slider-field.component.mjs +0 -46
  113. package/esm2022/src/lib/ui/textarea-field/index.mjs +0 -2
  114. package/esm2022/src/lib/ui/textarea-field/public-api.mjs +0 -2
  115. package/esm2022/src/lib/ui/textarea-field/textarea-field.component.mjs +0 -42
  116. package/esm2022/src/lib/ui/unit-conversion-field/index.mjs +0 -2
  117. package/esm2022/src/lib/ui/unit-conversion-field/public-api.mjs +0 -2
  118. package/esm2022/src/lib/ui/unit-conversion-field/unit-conversion-field.component.mjs +0 -86
  119. package/esm2022/src/lib/utils/abstracts/autocomplete-field.abstract.mjs +0 -30
  120. package/esm2022/src/lib/utils/abstracts/crispr-control.mixin.mjs +0 -27
  121. package/esm2022/src/lib/utils/abstracts/crispr-display-field.abstract.mjs +0 -14
  122. package/esm2022/src/lib/utils/abstracts/crispr-field.abstract.mjs +0 -19
  123. package/esm2022/src/lib/utils/abstracts/index.mjs +0 -5
  124. package/esm2022/src/lib/utils/functions/buildFormGroupFromConfig.mjs +0 -28
  125. package/esm2022/src/lib/utils/functions/callOptionsIfFunction.mjs +0 -4
  126. package/esm2022/src/lib/utils/functions/createControlForType.mjs +0 -19
  127. package/esm2022/src/lib/utils/functions/filterOptionsByLabel.mjs +0 -11
  128. package/esm2022/src/lib/utils/functions/image-compression.helpers.mjs +0 -50
  129. package/esm2022/src/lib/utils/functions/index.mjs +0 -8
  130. package/esm2022/src/lib/utils/functions/isControlConfig.mjs +0 -7
  131. package/esm2022/src/lib/utils/functions/observablifyOptions.mjs +0 -29
  132. package/esm2022/src/lib/utils/index.mjs +0 -2
  133. package/esm2022/src/lib/utils/models/autocomplete-chiplist-field.config.mjs +0 -2
  134. package/esm2022/src/lib/utils/models/autocomplete-field.config.mjs +0 -2
  135. package/esm2022/src/lib/utils/models/button.config.mjs +0 -2
  136. package/esm2022/src/lib/utils/models/checkbox-field.config.mjs +0 -2
  137. package/esm2022/src/lib/utils/models/crispr-field.config.mjs +0 -24
  138. package/esm2022/src/lib/utils/models/datepicker-field.config.mjs +0 -2
  139. package/esm2022/src/lib/utils/models/divider.config.mjs +0 -2
  140. package/esm2022/src/lib/utils/models/file-upload-field.config.mjs +0 -2
  141. package/esm2022/src/lib/utils/models/form-group-list.config.mjs +0 -2
  142. package/esm2022/src/lib/utils/models/heading.config.mjs +0 -3
  143. package/esm2022/src/lib/utils/models/image-upload-field.config.mjs +0 -2
  144. package/esm2022/src/lib/utils/models/index.mjs +0 -19
  145. package/esm2022/src/lib/utils/models/input-field.config.mjs +0 -2
  146. package/esm2022/src/lib/utils/models/map-field.config.mjs +0 -2
  147. package/esm2022/src/lib/utils/models/radio-field.config.mjs +0 -2
  148. package/esm2022/src/lib/utils/models/select-field.config.mjs +0 -2
  149. package/esm2022/src/lib/utils/models/slider-field.config.mjs +0 -2
  150. package/esm2022/src/lib/utils/models/textarea-field.config.mjs +0 -2
  151. package/esm2022/src/lib/utils/models/unit-conversion-field.config.mjs +0 -2
  152. package/esm2022/src/lib/utils/operators/form.operators.mjs +0 -24
  153. package/esm2022/src/lib/utils/operators/index.mjs +0 -2
  154. package/esm2022/src/lib/utils/public-api.mjs +0 -5
  155. package/esm2022/tft-crispr-forms.mjs +0 -5
  156. package/fesm2022/tft-crispr-forms-index-3_zzaLSn.mjs +0 -37
  157. package/fesm2022/tft-crispr-forms-index-3_zzaLSn.mjs.map +0 -1
  158. package/fesm2022/tft-crispr-forms-index-BC1uV7T_.mjs +0 -19
  159. package/fesm2022/tft-crispr-forms-index-BC1uV7T_.mjs.map +0 -1
  160. package/fesm2022/tft-crispr-forms-index-BHUGuVwS.mjs +0 -55
  161. package/fesm2022/tft-crispr-forms-index-BHUGuVwS.mjs.map +0 -1
  162. package/fesm2022/tft-crispr-forms-index-CAFXSHea.mjs +0 -58
  163. package/fesm2022/tft-crispr-forms-index-CAFXSHea.mjs.map +0 -1
  164. package/fesm2022/tft-crispr-forms-index-CN1GmYGC.mjs +0 -91
  165. package/fesm2022/tft-crispr-forms-index-CN1GmYGC.mjs.map +0 -1
  166. package/fesm2022/tft-crispr-forms-index-CvnyvJJ_.mjs +0 -73
  167. package/fesm2022/tft-crispr-forms-index-CvnyvJJ_.mjs.map +0 -1
  168. package/fesm2022/tft-crispr-forms-index-DKwMd-o-.mjs +0 -185
  169. package/fesm2022/tft-crispr-forms-index-DKwMd-o-.mjs.map +0 -1
  170. package/fesm2022/tft-crispr-forms-index-De3tRDbo.mjs +0 -49
  171. package/fesm2022/tft-crispr-forms-index-De3tRDbo.mjs.map +0 -1
  172. package/fesm2022/tft-crispr-forms-index-DiNlBPaX.mjs +0 -35
  173. package/fesm2022/tft-crispr-forms-index-DiNlBPaX.mjs.map +0 -1
  174. package/fesm2022/tft-crispr-forms-index-DkkAr7Yr.mjs +0 -102
  175. package/fesm2022/tft-crispr-forms-index-DkkAr7Yr.mjs.map +0 -1
  176. package/fesm2022/tft-crispr-forms-index-DseuVavm.mjs +0 -49
  177. package/fesm2022/tft-crispr-forms-index-DseuVavm.mjs.map +0 -1
  178. package/fesm2022/tft-crispr-forms-index-T4Ook6pV.mjs +0 -51
  179. package/fesm2022/tft-crispr-forms-index-T4Ook6pV.mjs.map +0 -1
  180. package/fesm2022/tft-crispr-forms-index-cdo59qhx.mjs +0 -142
  181. package/fesm2022/tft-crispr-forms-index-cdo59qhx.mjs.map +0 -1
  182. package/fesm2022/tft-crispr-forms-index-kJUZksiq.mjs +0 -49
  183. package/fesm2022/tft-crispr-forms-index-kJUZksiq.mjs.map +0 -1
  184. package/fesm2022/tft-crispr-forms-index-xbMIxY3P.mjs +0 -81
  185. package/fesm2022/tft-crispr-forms-index-xbMIxY3P.mjs.map +0 -1
  186. package/index.d.ts +0 -5
  187. package/public-api.d.ts +0 -3
  188. package/src/index.d.ts +0 -1
  189. package/src/lib/crispr-forms.module.d.ts +0 -16
  190. package/src/lib/display-field.directive.d.ts +0 -23
  191. package/src/lib/field-component-map.const.d.ts +0 -44
  192. package/src/lib/field.directive.d.ts +0 -24
  193. package/src/lib/form/form.component.d.ts +0 -19
  194. package/src/lib/form-group-list/form-group-list.component.d.ts +0 -40
  195. package/src/lib/form-group-list/index.d.ts +0 -1
  196. package/src/lib/pipes/crispr-pipes.module.d.ts +0 -8
  197. package/src/lib/pipes/initial-control-value.pipe.d.ts +0 -10
  198. package/src/lib/public_api.d.ts +0 -3
  199. package/src/lib/sub-group/index.d.ts +0 -2
  200. package/src/lib/sub-group/sub-group.component.d.ts +0 -24
  201. package/src/lib/sub-group/sub-group.module.d.ts +0 -12
  202. package/src/lib/ui/autocomplete-chiplist-field/autocomplete-chiplist-field.component.d.ts +0 -36
  203. package/src/lib/ui/autocomplete-chiplist-field/index.d.ts +0 -1
  204. package/src/lib/ui/autocomplete-chiplist-field/public-api.d.ts +0 -1
  205. package/src/lib/ui/autocomplete-field/autocomplete-field.component.d.ts +0 -25
  206. package/src/lib/ui/autocomplete-field/index.d.ts +0 -1
  207. package/src/lib/ui/autocomplete-field/public-api.d.ts +0 -1
  208. package/src/lib/ui/button/button.component.d.ts +0 -15
  209. package/src/lib/ui/button/index.d.ts +0 -1
  210. package/src/lib/ui/button/public-api.d.ts +0 -1
  211. package/src/lib/ui/checkbox-field/checkbox-field.component.d.ts +0 -23
  212. package/src/lib/ui/checkbox-field/index.d.ts +0 -1
  213. package/src/lib/ui/checkbox-field/public-api.d.ts +0 -1
  214. package/src/lib/ui/datepicker-field/datepicker-field.component.d.ts +0 -32
  215. package/src/lib/ui/datepicker-field/index.d.ts +0 -1
  216. package/src/lib/ui/datepicker-field/public-api.d.ts +0 -1
  217. package/src/lib/ui/divider/divider.component.d.ts +0 -9
  218. package/src/lib/ui/divider/index.d.ts +0 -1
  219. package/src/lib/ui/divider/public-api.d.ts +0 -1
  220. package/src/lib/ui/field-container/field-container.component.d.ts +0 -24
  221. package/src/lib/ui/field-container/index.d.ts +0 -1
  222. package/src/lib/ui/field-container/public-api.d.ts +0 -1
  223. package/src/lib/ui/file-dropzone/file-dropzone.directive.d.ts +0 -10
  224. package/src/lib/ui/file-dropzone/index.d.ts +0 -1
  225. package/src/lib/ui/file-dropzone/public-api.d.ts +0 -1
  226. package/src/lib/ui/file-upload-field/file-upload-field.component.d.ts +0 -39
  227. package/src/lib/ui/file-upload-field/index.d.ts +0 -1
  228. package/src/lib/ui/file-upload-field/public-api.d.ts +0 -1
  229. package/src/lib/ui/heading/heading.component.d.ts +0 -8
  230. package/src/lib/ui/heading/index.d.ts +0 -1
  231. package/src/lib/ui/heading/public-api.d.ts +0 -1
  232. package/src/lib/ui/image-upload-field/image-upload-field.component.d.ts +0 -50
  233. package/src/lib/ui/image-upload-field/index.d.ts +0 -1
  234. package/src/lib/ui/image-upload-field/public-api.d.ts +0 -1
  235. package/src/lib/ui/index.d.ts +0 -1
  236. package/src/lib/ui/info/index.d.ts +0 -1
  237. package/src/lib/ui/info/info.component.d.ts +0 -7
  238. package/src/lib/ui/info/public-api.d.ts +0 -1
  239. package/src/lib/ui/input-field/index.d.ts +0 -1
  240. package/src/lib/ui/input-field/input-field.component.d.ts +0 -24
  241. package/src/lib/ui/input-field/public-api.d.ts +0 -1
  242. package/src/lib/ui/map/index.d.ts +0 -1
  243. package/src/lib/ui/map/map-field.component.d.ts +0 -23
  244. package/src/lib/ui/map/public-api.d.ts +0 -1
  245. package/src/lib/ui/option/index.d.ts +0 -1
  246. package/src/lib/ui/option/option.component.d.ts +0 -7
  247. package/src/lib/ui/option/public-api.d.ts +0 -1
  248. package/src/lib/ui/public-api.d.ts +0 -7
  249. package/src/lib/ui/radio-field/index.d.ts +0 -1
  250. package/src/lib/ui/radio-field/public-api.d.ts +0 -1
  251. package/src/lib/ui/radio-field/radio-field.component.d.ts +0 -25
  252. package/src/lib/ui/select-field/index.d.ts +0 -1
  253. package/src/lib/ui/select-field/public-api.d.ts +0 -1
  254. package/src/lib/ui/select-field/select-field.component.d.ts +0 -34
  255. package/src/lib/ui/selected-file/index.d.ts +0 -1
  256. package/src/lib/ui/selected-file/public-api.d.ts +0 -1
  257. package/src/lib/ui/selected-file/selected-file.component.d.ts +0 -10
  258. package/src/lib/ui/slider-field/index.d.ts +0 -1
  259. package/src/lib/ui/slider-field/public-api.d.ts +0 -1
  260. package/src/lib/ui/slider-field/slider-field.component.d.ts +0 -24
  261. package/src/lib/ui/textarea-field/index.d.ts +0 -1
  262. package/src/lib/ui/textarea-field/public-api.d.ts +0 -1
  263. package/src/lib/ui/textarea-field/textarea-field.component.d.ts +0 -23
  264. package/src/lib/ui/unit-conversion-field/index.d.ts +0 -1
  265. package/src/lib/ui/unit-conversion-field/public-api.d.ts +0 -1
  266. package/src/lib/ui/unit-conversion-field/unit-conversion-field.component.d.ts +0 -38
  267. package/src/lib/utils/abstracts/autocomplete-field.abstract.d.ts +0 -28
  268. package/src/lib/utils/abstracts/crispr-control.mixin.d.ts +0 -16
  269. package/src/lib/utils/abstracts/crispr-display-field.abstract.d.ts +0 -22
  270. package/src/lib/utils/abstracts/crispr-field.abstract.d.ts +0 -11
  271. package/src/lib/utils/abstracts/index.d.ts +0 -4
  272. package/src/lib/utils/functions/buildFormGroupFromConfig.d.ts +0 -9
  273. package/src/lib/utils/functions/callOptionsIfFunction.d.ts +0 -3
  274. package/src/lib/utils/functions/createControlForType.d.ts +0 -9
  275. package/src/lib/utils/functions/filterOptionsByLabel.d.ts +0 -7
  276. package/src/lib/utils/functions/image-compression.helpers.d.ts +0 -5
  277. package/src/lib/utils/functions/index.d.ts +0 -7
  278. package/src/lib/utils/functions/isControlConfig.d.ts +0 -5
  279. package/src/lib/utils/functions/observablifyOptions.d.ts +0 -12
  280. package/src/lib/utils/index.d.ts +0 -1
  281. package/src/lib/utils/models/autocomplete-chiplist-field.config.d.ts +0 -20
  282. package/src/lib/utils/models/autocomplete-field.config.d.ts +0 -14
  283. package/src/lib/utils/models/button.config.d.ts +0 -17
  284. package/src/lib/utils/models/checkbox-field.config.d.ts +0 -6
  285. package/src/lib/utils/models/crispr-field.config.d.ts +0 -98
  286. package/src/lib/utils/models/datepicker-field.config.d.ts +0 -20
  287. package/src/lib/utils/models/divider.config.d.ts +0 -5
  288. package/src/lib/utils/models/file-upload-field.config.d.ts +0 -33
  289. package/src/lib/utils/models/form-group-list.config.d.ts +0 -18
  290. package/src/lib/utils/models/heading.config.d.ts +0 -6
  291. package/src/lib/utils/models/image-upload-field.config.d.ts +0 -54
  292. package/src/lib/utils/models/index.d.ts +0 -18
  293. package/src/lib/utils/models/input-field.config.d.ts +0 -16
  294. package/src/lib/utils/models/map-field.config.d.ts +0 -5
  295. package/src/lib/utils/models/radio-field.config.d.ts +0 -6
  296. package/src/lib/utils/models/select-field.config.d.ts +0 -21
  297. package/src/lib/utils/models/slider-field.config.d.ts +0 -11
  298. package/src/lib/utils/models/textarea-field.config.d.ts +0 -5
  299. package/src/lib/utils/models/unit-conversion-field.config.d.ts +0 -30
  300. package/src/lib/utils/operators/form.operators.d.ts +0 -1
  301. package/src/lib/utils/operators/index.d.ts +0 -1
  302. package/src/lib/utils/public-api.d.ts +0 -4
  303. package/tft-crispr-forms-18.0.2.tgz +0 -0
@@ -1,58 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Component, ChangeDetectionStrategy } from '@angular/core';
3
- import * as i2$1 from '@angular/forms';
4
- import { ReactiveFormsModule } from '@angular/forms';
5
- import { map, startWith } from 'rxjs/operators';
6
- import * as i1 from '@angular/common';
7
- import { CommonModule } from '@angular/common';
8
- import * as i2 from '@angular/material/button';
9
- import { MatButtonModule } from '@angular/material/button';
10
- import * as i3 from '@angular/material/icon';
11
- import { MatIconModule } from '@angular/material/icon';
12
- import * as i3$1 from '@angular/material/tooltip';
13
- import { MatTooltipModule } from '@angular/material/tooltip';
14
- import * as i7 from '@tft/form-validation-handler';
15
- import { FormValidationHandlerModule } from '@tft/form-validation-handler';
16
- import { CrisprFieldComponent } from './tft-crispr-forms.mjs';
17
- import 'rxjs';
18
- import '@angular/material/form-field';
19
- import '@angular/material/input';
20
- import '@angular/material/progress-bar';
21
-
22
- class ButtonComponent extends CrisprFieldComponent {
23
- constructor() {
24
- super(...arguments);
25
- this.defaultConfig = {
26
- buttonType: 'raised',
27
- type: 'submit',
28
- };
29
- }
30
- get matButtonClass() {
31
- return this.config.buttonType ? `mat-${this.config.buttonType}-button` : '';
32
- }
33
- ngOnInit() {
34
- super.ngOnInit();
35
- this.formValid$ = this.group.statusChanges.pipe(map((status) => status === 'VALID'), startWith(this.group.valid));
36
- }
37
- handleClick(group, event) {
38
- if (this.config.callback) {
39
- this.config.callback(group, event);
40
- }
41
- }
42
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: ButtonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
43
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.3", type: ButtonComponent, isStandalone: true, selector: "crispr-button", usesInheritance: true, ngImport: i0, template: "<button\n [formGroup]=\"group\"\n mat-button\n [ngClass]=\"matButtonClass\"\n [color]=\"config.color\"\n [disabled]=\"config.disabledOnInvalidForm && !(formValid$ | async)\"\n [type]=\"config.type\"\n (click)=\"handleClick(group, $event)\"\n [matTooltip]=\"config.info?.content\"\n [matTooltipPosition]=\"config.info?.tooltipPosition || 'below'\">\n {{ config.label }}\n <mat-icon *ngIf=\"config.icon\">\n {{ config.icon}}\n </mat-icon>\n</button>\n\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormValidationHandlerModule }, { kind: "directive", type: i7.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true }); }
44
- }
45
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: ButtonComponent, decorators: [{
46
- type: Component,
47
- args: [{ selector: 'crispr-button', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
48
- CommonModule,
49
- MatButtonModule,
50
- MatIconModule,
51
- MatTooltipModule,
52
- ReactiveFormsModule,
53
- FormValidationHandlerModule,
54
- ], template: "<button\n [formGroup]=\"group\"\n mat-button\n [ngClass]=\"matButtonClass\"\n [color]=\"config.color\"\n [disabled]=\"config.disabledOnInvalidForm && !(formValid$ | async)\"\n [type]=\"config.type\"\n (click)=\"handleClick(group, $event)\"\n [matTooltip]=\"config.info?.content\"\n [matTooltipPosition]=\"config.info?.tooltipPosition || 'below'\">\n {{ config.label }}\n <mat-icon *ngIf=\"config.icon\">\n {{ config.icon}}\n </mat-icon>\n</button>\n\n" }]
55
- }] });
56
-
57
- export { ButtonComponent };
58
- //# sourceMappingURL=tft-crispr-forms-index-CAFXSHea.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tft-crispr-forms-index-CAFXSHea.mjs","sources":["../../../../libs/crispr-forms/src/lib/ui/button/button.component.ts","../../../../libs/crispr-forms/src/lib/ui/button/button.component.html"],"sourcesContent":["import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';\nimport { ReactiveFormsModule, FormGroup } from '@angular/forms';\nimport { Observable } from 'rxjs';\nimport { map, startWith } from 'rxjs/operators';\nimport { CommonModule } from '@angular/common';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatTooltipModule } from '@angular/material/tooltip';\nimport { FormValidationHandlerModule } from '@tft/form-validation-handler';\n// eslint-disable-next-line @nx/enforce-module-boundaries\nimport { CrisprFieldComponent, ButtonConfig } from '../../utils';\n\n@Component({\n selector: 'crispr-button',\n templateUrl: './button.component.html',\n styleUrls: ['./button.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n CommonModule,\n MatButtonModule,\n MatIconModule,\n MatTooltipModule,\n ReactiveFormsModule,\n FormValidationHandlerModule,\n ],\n})\nexport class ButtonComponent\n extends CrisprFieldComponent<ButtonConfig>\n implements OnInit\n{\n group: FormGroup;\n defaultConfig: Partial<ButtonConfig> = {\n buttonType: 'raised',\n type: 'submit',\n };\n formValid$: Observable<boolean>;\n\n get matButtonClass() {\n return this.config.buttonType ? `mat-${this.config.buttonType}-button` : '';\n }\n\n ngOnInit() {\n super.ngOnInit();\n this.formValid$ = this.group.statusChanges.pipe(\n map((status) => status === 'VALID'),\n startWith(this.group.valid)\n );\n }\n\n handleClick(group: FormGroup, event: MouseEvent) {\n if (this.config.callback) {\n this.config.callback(group, event);\n }\n }\n}\n","<button\n [formGroup]=\"group\"\n mat-button\n [ngClass]=\"matButtonClass\"\n [color]=\"config.color\"\n [disabled]=\"config.disabledOnInvalidForm && !(formValid$ | async)\"\n [type]=\"config.type\"\n (click)=\"handleClick(group, $event)\"\n [matTooltip]=\"config.info?.content\"\n [matTooltipPosition]=\"config.info?.tooltipPosition || 'below'\">\n {{ config.label }}\n <mat-icon *ngIf=\"config.icon\">\n {{ config.icon}}\n </mat-icon>\n</button>\n\n"],"names":["i4","i6"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2BM,MAAO,eACX,SAAQ,oBAAkC,CAAA;AAhB5C,IAAA,WAAA,GAAA;;AAoBE,QAAA,IAAA,CAAA,aAAa,GAA0B;AACrC,YAAA,UAAU,EAAE,QAAQ;AACpB,YAAA,IAAI,EAAE,QAAQ;SACf,CAAC;AAoBH,KAAA;AAjBC,IAAA,IAAI,cAAc,GAAA;AAChB,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,GAAG,CAAA,IAAA,EAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAA,OAAA,CAAS,GAAG,EAAE,CAAC;KAC7E;IAED,QAAQ,GAAA;QACN,KAAK,CAAC,QAAQ,EAAE,CAAC;AACjB,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAC7C,GAAG,CAAC,CAAC,MAAM,KAAK,MAAM,KAAK,OAAO,CAAC,EACnC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAC5B,CAAC;KACH;IAED,WAAW,CAAC,KAAgB,EAAE,KAAiB,EAAA;AAC7C,QAAA,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;YACxB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;SACpC;KACF;8GA3BU,eAAe,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;AAAf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EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,gBAAgB,EAChB,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAAA,IAAA,CAAA,UAAA,EAAA,QAAA,EAAA,cAAA,EAAA,MAAA,EAAA,CAAA,oBAAA,EAAA,4BAAA,EAAA,oBAAA,EAAA,qBAAA,EAAA,qBAAA,EAAA,yBAAA,EAAA,YAAA,EAAA,iBAAA,CAAA,EAAA,QAAA,EAAA,CAAA,YAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,mBAAmB,+UACnB,2BAA2B,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAAC,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,eAAe,EAAA,UAAA,EAAA,CAAA;kBAf3B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,eAAe,mBAGR,uBAAuB,CAAC,MAAM,EAAA,UAAA,EACnC,IAAI,EACP,OAAA,EAAA;wBACP,YAAY;wBACZ,eAAe;wBACf,aAAa;wBACb,gBAAgB;wBAChB,mBAAmB;wBACnB,2BAA2B;AAC5B,qBAAA,EAAA,QAAA,EAAA,odAAA,EAAA,CAAA;;;;;"}
@@ -1,91 +0,0 @@
1
- import * as i1 from '@angular/common';
2
- import { CommonModule } from '@angular/common';
3
- import * as i0 from '@angular/core';
4
- import { Component, ChangeDetectionStrategy } from '@angular/core';
5
- import * as i2 from '@angular/forms';
6
- import { FormControl, ReactiveFormsModule } from '@angular/forms';
7
- import * as i4$1 from '@angular/material/core';
8
- import { MatOptionModule } from '@angular/material/core';
9
- import * as i5 from '@angular/material/input';
10
- import { MatInputModule } from '@angular/material/input';
11
- import * as i4 from '@angular/material/select';
12
- import { MatSelectModule } from '@angular/material/select';
13
- import { combineLatest } from 'rxjs';
14
- import { startWith } from 'rxjs/operators';
15
- import { O as OptionComponent } from './tft-crispr-forms-index-BC1uV7T_.mjs';
16
- import * as i7 from '@tft/form-validation-handler';
17
- import { FormValidationHandlerModule } from '@tft/form-validation-handler';
18
- import { crisprControlMixin, CrisprFieldComponent, observablifyOptions, InfoComponent, FieldContainerComponent } from './tft-crispr-forms.mjs';
19
- import * as i3 from '@angular/material/form-field';
20
- import '@angular/material/button';
21
- import '@angular/material/icon';
22
- import '@angular/material/tooltip';
23
- import '@angular/material/progress-bar';
24
-
25
- /* eslint-disable @nx/enforce-module-boundaries */
26
- const defaultConfig = {};
27
- const UnitConversionFieldMixin = crisprControlMixin(CrisprFieldComponent);
28
- class UnitConversionFieldComponent extends UnitConversionFieldMixin {
29
- constructor() {
30
- super(...arguments);
31
- this.defaultConfig = defaultConfig;
32
- this.displayValueControl = new FormControl();
33
- this.unitSelectControl = new FormControl();
34
- }
35
- ngOnInit() {
36
- super.ngOnInit();
37
- // TODO: Validators need work. validation is tricky because the input needs to be validated against but the validator will compare against the controls value
38
- // this.displayValueControl.setValidators(this.config.validators);
39
- const controlValuePipeline = [
40
- this.displayValueControl.valueChanges.pipe(startWith(this.displayValueControl.value)),
41
- ];
42
- // setup all required pieces when showing a field for selecting units
43
- if (this.config.showUnitSelect) {
44
- this.unitOptions$ = observablifyOptions(this.config.selectableUnits, this.group);
45
- controlValuePipeline.push(this.unitSelectControl.valueChanges.pipe(startWith(this.config?.initialDisplayUnit || null)));
46
- this.unitSelectControl.setValue(this.config?.initialDisplayUnit || null);
47
- }
48
- this.transformationSubscription = combineLatest(controlValuePipeline).subscribe(([displayValue, unitValue]) => {
49
- const computedValue = this.config.storedValueConversion(displayValue, unitValue);
50
- this.control.setValue(computedValue);
51
- });
52
- }
53
- ngOnDestroy() {
54
- this.transformationSubscription.unsubscribe();
55
- }
56
- setInitialDisplayValue(storedValue, unit) {
57
- const initialDisplayValue = this.config.initialDisplayValueConversion(storedValue || null, unit);
58
- this.displayValueControl.setValue(initialDisplayValue);
59
- }
60
- /**
61
- * We override the 'setControlValue' we inherited from crisprControlMixin and add our custom logic,
62
- * This function gets called onInit because were object oriented. it's so great, so great that I'm
63
- * typing a paragraph to explain what the hell is going on...
64
- * @param value the initial value for the control passed down from the form components input
65
- */
66
- setControlValue(value) {
67
- const initialUnitValue = this.config.showUnitSelect
68
- ? this.config?.initialDisplayUnit
69
- : null;
70
- this.setInitialDisplayValue(value, initialUnitValue);
71
- }
72
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: UnitConversionFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
73
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.3", type: UnitConversionFieldComponent, isStandalone: true, selector: "crispr-unit-conversion-field", usesInheritance: true, ngImport: i0, template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <mat-form-field\n [style.width.%]=\"config.showUnitSelect ? 60 : 100\"\n class=\"number-field\"\n [color]=\"config.color\"\n [appearance]=\"config.appearance\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n <input\n type=\"number\"\n matInput\n [formControl]=\"displayValueControl\"\n [placeholder]=\"config.placeholder\"\n [min]=\"config.min\"\n [max]=\"config.max\"\n [step]=\"config.step\"\n [autofocus]=\"config.autofocus\">\n <span *ngIf=\"config.fieldSuffix\" matSuffix>{{config.fieldSuffix}}</span>\n <crispr-info\n matSuffix\n *ngIf=\"config.info\"\n [info]=\"config.info\">\n </crispr-info>\n </mat-form-field>\n\n <mat-form-field\n *ngIf=\"config.showUnitSelect\"\n [color]=\"config.color\"\n [appearance]=\"config.appearance\"\n [formGroup]=\"group\"\n class=\"unit-field\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n <mat-select\n #selectField\n [formControl]=\"unitSelectControl\">\n\n <mat-option\n *ngFor=\"let option of unitOptions$ | async\"\n [value]=\"option.value\">\n <crispr-option [option]=\"option\">\n </crispr-option>\n </mat-option>\n\n </mat-select>\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: [".unit-field{width:40%;margin-left:16px}:host ::ng-deep .field-container{display:flex}\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: InfoComponent, selector: "crispr-info", inputs: ["info"] }, { kind: "component", type: OptionComponent, selector: "crispr-option", inputs: ["option"] }, { 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.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { 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.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i2.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { 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: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i4.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i4$1.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatOptionModule }, { 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 }); }
74
- }
75
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: UnitConversionFieldComponent, decorators: [{
76
- type: Component,
77
- args: [{ selector: 'crispr-unit-conversion-field', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
78
- CommonModule,
79
- InfoComponent,
80
- OptionComponent,
81
- ReactiveFormsModule,
82
- FieldContainerComponent,
83
- MatInputModule,
84
- MatSelectModule,
85
- MatOptionModule,
86
- FormValidationHandlerModule,
87
- ], template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <mat-form-field\n [style.width.%]=\"config.showUnitSelect ? 60 : 100\"\n class=\"number-field\"\n [color]=\"config.color\"\n [appearance]=\"config.appearance\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n <input\n type=\"number\"\n matInput\n [formControl]=\"displayValueControl\"\n [placeholder]=\"config.placeholder\"\n [min]=\"config.min\"\n [max]=\"config.max\"\n [step]=\"config.step\"\n [autofocus]=\"config.autofocus\">\n <span *ngIf=\"config.fieldSuffix\" matSuffix>{{config.fieldSuffix}}</span>\n <crispr-info\n matSuffix\n *ngIf=\"config.info\"\n [info]=\"config.info\">\n </crispr-info>\n </mat-form-field>\n\n <mat-form-field\n *ngIf=\"config.showUnitSelect\"\n [color]=\"config.color\"\n [appearance]=\"config.appearance\"\n [formGroup]=\"group\"\n class=\"unit-field\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n <mat-select\n #selectField\n [formControl]=\"unitSelectControl\">\n\n <mat-option\n *ngFor=\"let option of unitOptions$ | async\"\n [value]=\"option.value\">\n <crispr-option [option]=\"option\">\n </crispr-option>\n </mat-option>\n\n </mat-select>\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: [".unit-field{width:40%;margin-left:16px}:host ::ng-deep .field-container{display:flex}\n"] }]
88
- }] });
89
-
90
- export { UnitConversionFieldComponent };
91
- //# sourceMappingURL=tft-crispr-forms-index-CN1GmYGC.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tft-crispr-forms-index-CN1GmYGC.mjs","sources":["../../../../libs/crispr-forms/src/lib/ui/unit-conversion-field/unit-conversion-field.component.ts","../../../../libs/crispr-forms/src/lib/ui/unit-conversion-field/unit-conversion-field.component.html"],"sourcesContent":["/* eslint-disable @nx/enforce-module-boundaries */\nimport { CommonModule } from '@angular/common';\nimport {\n Component,\n OnInit,\n ChangeDetectionStrategy,\n OnDestroy,\n} from '@angular/core';\nimport { ReactiveFormsModule, FormControl } from '@angular/forms';\nimport { MatOptionModule } from '@angular/material/core';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatSelectModule } from '@angular/material/select';\nimport { combineLatest, Observable, Subscription } from 'rxjs';\nimport { startWith } from 'rxjs/operators';\nimport { OptionComponent } from '../option';\nimport { FormValidationHandlerModule } from '@tft/form-validation-handler';\nimport { FieldContainerComponent } from '../field-container';\nimport { InfoComponent } from '../info';\nimport {\n crisprControlMixin,\n CrisprFieldComponent,\n observablifyOptions,\n SelectOption,\n UnitConversionFieldConfig,\n} from '../../utils';\n\nconst defaultConfig: Partial<UnitConversionFieldConfig> = {};\nconst UnitConversionFieldMixin =\n crisprControlMixin<UnitConversionFieldConfig>(CrisprFieldComponent);\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'crispr-unit-conversion-field',\n templateUrl: './unit-conversion-field.component.html',\n styleUrls: ['./unit-conversion-field.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n CommonModule,\n InfoComponent,\n OptionComponent,\n ReactiveFormsModule,\n FieldContainerComponent,\n MatInputModule,\n MatSelectModule,\n MatOptionModule,\n FormValidationHandlerModule,\n ],\n})\nexport class UnitConversionFieldComponent\n extends UnitConversionFieldMixin\n implements OnInit, OnDestroy\n{\n defaultConfig = defaultConfig;\n\n displayValueControl = new FormControl();\n unitSelectControl = new FormControl();\n unitOptions$: Observable<SelectOption[]>;\n\n transformationSubscription: Subscription;\n\n ngOnInit() {\n super.ngOnInit();\n // TODO: Validators need work. validation is tricky because the input needs to be validated against but the validator will compare against the controls value\n // this.displayValueControl.setValidators(this.config.validators);\n\n const controlValuePipeline: Observable<string>[] = [\n this.displayValueControl.valueChanges.pipe(\n startWith(this.displayValueControl.value)\n ),\n ];\n // setup all required pieces when showing a field for selecting units\n if (this.config.showUnitSelect) {\n this.unitOptions$ = observablifyOptions(\n this.config.selectableUnits,\n this.group\n );\n controlValuePipeline.push(\n this.unitSelectControl.valueChanges.pipe(\n startWith(this.config?.initialDisplayUnit || null)\n )\n );\n this.unitSelectControl.setValue(this.config?.initialDisplayUnit || null);\n }\n\n this.transformationSubscription = combineLatest(\n controlValuePipeline\n ).subscribe(([displayValue, unitValue]) => {\n const computedValue = this.config.storedValueConversion(\n displayValue,\n unitValue\n );\n this.control.setValue(computedValue);\n });\n }\n\n ngOnDestroy() {\n this.transformationSubscription.unsubscribe();\n }\n\n setInitialDisplayValue(storedValue: any, unit: unknown) {\n const initialDisplayValue = this.config.initialDisplayValueConversion(\n storedValue || null,\n unit\n );\n this.displayValueControl.setValue(initialDisplayValue);\n }\n\n /**\n * We override the 'setControlValue' we inherited from crisprControlMixin and add our custom logic,\n * This function gets called onInit because were object oriented. it's so great, so great that I'm\n * typing a paragraph to explain what the hell is going on...\n * @param value the initial value for the control passed down from the form components input\n */\n setControlValue(value) {\n const initialUnitValue = this.config.showUnitSelect\n ? this.config?.initialDisplayUnit\n : null;\n this.setInitialDisplayValue(value, initialUnitValue);\n }\n}\n","<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <mat-form-field\n [style.width.%]=\"config.showUnitSelect ? 60 : 100\"\n class=\"number-field\"\n [color]=\"config.color\"\n [appearance]=\"config.appearance\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n <input\n type=\"number\"\n matInput\n [formControl]=\"displayValueControl\"\n [placeholder]=\"config.placeholder\"\n [min]=\"config.min\"\n [max]=\"config.max\"\n [step]=\"config.step\"\n [autofocus]=\"config.autofocus\">\n <span *ngIf=\"config.fieldSuffix\" matSuffix>{{config.fieldSuffix}}</span>\n <crispr-info\n matSuffix\n *ngIf=\"config.info\"\n [info]=\"config.info\">\n </crispr-info>\n </mat-form-field>\n\n <mat-form-field\n *ngIf=\"config.showUnitSelect\"\n [color]=\"config.color\"\n [appearance]=\"config.appearance\"\n [formGroup]=\"group\"\n class=\"unit-field\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n <mat-select\n #selectField\n [formControl]=\"unitSelectControl\">\n\n <mat-option\n *ngFor=\"let option of unitOptions$ | async\"\n [value]=\"option.value\">\n <crispr-option [option]=\"option\">\n </crispr-option>\n </mat-option>\n\n </mat-select>\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":["i3","i4","i5","i6"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AA0BA,MAAM,aAAa,GAAuC,EAAE,CAAC;AAC7D,MAAM,wBAAwB,GAC5B,kBAAkB,CAA4B,oBAAoB,CAAC,CAAC;AAqBhE,MAAO,4BACX,SAAQ,wBAAwB,CAAA;AApBlC,IAAA,WAAA,GAAA;;QAuBE,IAAa,CAAA,aAAA,GAAG,aAAa,CAAC;AAE9B,QAAA,IAAA,CAAA,mBAAmB,GAAG,IAAI,WAAW,EAAE,CAAC;AACxC,QAAA,IAAA,CAAA,iBAAiB,GAAG,IAAI,WAAW,EAAE,CAAC;AAgEvC,KAAA;IA3DC,QAAQ,GAAA;QACN,KAAK,CAAC,QAAQ,EAAE,CAAC;;;AAIjB,QAAA,MAAM,oBAAoB,GAAyB;AACjD,YAAA,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,IAAI,CACxC,SAAS,CAAC,IAAI,CAAC,mBAAmB,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AA,QAAA,EAAA,CAAA,WAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAAC,IAAA,CAAA,SAAA,EAAA,QAAA,EAAA,YAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,IAAA,EAAA,UAAA,CAAA,EAAA,OAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,QAAA,EAAA,CAAA,WAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,eAAe,8BACf,2BAA2B,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,sBAAA,EAAA,QAAA,EAAA,kCAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,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,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBAnBxC,SAAS;AAEE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,8BAA8B,mBAGvB,uBAAuB,CAAC,MAAM,EAAA,UAAA,EACnC,IAAI,EACP,OAAA,EAAA;wBACP,YAAY;wBACZ,aAAa;wBACb,eAAe;wBACf,mBAAmB;wBACnB,uBAAuB;wBACvB,cAAc;wBACd,eAAe;wBACf,eAAe;wBACf,2BAA2B;AAC5B,qBAAA,EAAA,QAAA,EAAA,mgDAAA,EAAA,MAAA,EAAA,CAAA,yFAAA,CAAA,EAAA,CAAA;;;;;"}
@@ -1,73 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Component, ChangeDetectionStrategy } from '@angular/core';
3
- import * as i2 from '@angular/material/datepicker';
4
- import { MatDatepickerModule } from '@angular/material/datepicker';
5
- import { MatDateFnsModule } from '@angular/material-date-fns-adapter';
6
- import { of } from 'rxjs';
7
- import * as i6 from '@angular/cdk/portal';
8
- import { ComponentPortal, PortalModule } from '@angular/cdk/portal';
9
- import * as i3 from '@angular/material/form-field';
10
- import { MatFormFieldModule } from '@angular/material/form-field';
11
- import * as i1 from '@angular/common';
12
- import { CommonModule } from '@angular/common';
13
- import * as i2$1 from '@angular/forms';
14
- import { ReactiveFormsModule } from '@angular/forms';
15
- import * as i5 from '@angular/material/input';
16
- import { MatInputModule } from '@angular/material/input';
17
- import * as i7 from '@tft/form-validation-handler';
18
- import { FormValidationHandlerModule } from '@tft/form-validation-handler';
19
- import { crisprControlMixin, CrisprFieldComponent, FieldContainerComponent } from './tft-crispr-forms.mjs';
20
- import 'rxjs/operators';
21
- import '@angular/material/button';
22
- import '@angular/material/icon';
23
- import '@angular/material/tooltip';
24
- import '@angular/material/progress-bar';
25
-
26
- /* eslint-disable @nx/enforce-module-boundaries */
27
- const defaultConfig = {
28
- startView: 'month',
29
- };
30
- const DatepickerFieldMixin = crisprControlMixin(CrisprFieldComponent);
31
- class DatepickerFieldComponent extends DatepickerFieldMixin {
32
- constructor() {
33
- super(...arguments);
34
- this.defaultConfig = defaultConfig;
35
- }
36
- ngOnInit() {
37
- super.ngOnInit();
38
- this.startAt$ =
39
- this.config.startAt instanceof Date
40
- ? of(this.config.startAt)
41
- : this.config.startAt instanceof Function
42
- ? this.config.startAt(this.group)
43
- : of(null);
44
- this.dateClass = this.config?.cellClassFunction || null;
45
- this.dateClass$ = this.config.dateClass
46
- ? this.config?.dateClass(this.group)
47
- : of(() => '');
48
- }
49
- ngAfterContentInit() {
50
- if (this.config.datepickerActions) {
51
- this.calendarFooterPortal = new ComponentPortal(this.config.datepickerActions);
52
- }
53
- }
54
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: DatepickerFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
55
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.3", type: DatepickerFieldComponent, isStandalone: true, selector: "crispr-datepicker-field", usesInheritance: true, ngImport: i0, template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <mat-form-field\n [color]=\"config.color\"\n [appearance]=\"config.appearance\"\n [formGroup]=\"group\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n <input\n matInput\n [formControlName]=\"config.controlName\"\n [min]=\"config.min\"\n [max]=\"config.max\"\n [matDatepicker]=\"picker\"\n [matDatepickerFilter]=\"config.datepickerFilter\">\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker\n [touchUi]=\"config.touchUi\"\n [startView]=\"config.startView\"\n [startAt]=\"startAt$ | async\"\n [dateClass]=\"dateClass || (dateClass$ | async)\"\n #picker>\n <mat-datepicker-actions *ngIf=\"calendarFooterPortal\">\n <ng-template [cdkPortalOutlet]=\"calendarFooterPortal\"></ng-template>\n </mat-datepicker-actions>\n </mat-datepicker>\n\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n</crispr-field-container>\n\n", styles: [""], 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: MatDatepickerModule }, { kind: "component", type: i2.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i2.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i2.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "component", type: i2.MatDatepickerActions, selector: "mat-datepicker-actions, mat-date-range-picker-actions" }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$1.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$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { 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: "ngmodule", type: MatDateFnsModule }, { kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i6.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { 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 }); }
56
- }
57
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: DatepickerFieldComponent, decorators: [{
58
- type: Component,
59
- args: [{ selector: 'crispr-datepicker-field', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
60
- CommonModule,
61
- FieldContainerComponent,
62
- MatDatepickerModule,
63
- MatFormFieldModule,
64
- ReactiveFormsModule,
65
- MatInputModule,
66
- MatDateFnsModule,
67
- PortalModule,
68
- FormValidationHandlerModule,
69
- ], template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <mat-form-field\n [color]=\"config.color\"\n [appearance]=\"config.appearance\"\n [formGroup]=\"group\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n <input\n matInput\n [formControlName]=\"config.controlName\"\n [min]=\"config.min\"\n [max]=\"config.max\"\n [matDatepicker]=\"picker\"\n [matDatepickerFilter]=\"config.datepickerFilter\">\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker\n [touchUi]=\"config.touchUi\"\n [startView]=\"config.startView\"\n [startAt]=\"startAt$ | async\"\n [dateClass]=\"dateClass || (dateClass$ | async)\"\n #picker>\n <mat-datepicker-actions *ngIf=\"calendarFooterPortal\">\n <ng-template [cdkPortalOutlet]=\"calendarFooterPortal\"></ng-template>\n </mat-datepicker-actions>\n </mat-datepicker>\n\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n</crispr-field-container>\n\n" }]
70
- }] });
71
-
72
- export { DatepickerFieldComponent };
73
- //# sourceMappingURL=tft-crispr-forms-index-CvnyvJJ_.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tft-crispr-forms-index-CvnyvJJ_.mjs","sources":["../../../../libs/crispr-forms/src/lib/ui/datepicker-field/datepicker-field.component.ts","../../../../libs/crispr-forms/src/lib/ui/datepicker-field/datepicker-field.component.html"],"sourcesContent":["/* eslint-disable @nx/enforce-module-boundaries */\nimport {\n Component,\n OnInit,\n ChangeDetectionStrategy,\n AfterContentInit,\n} from '@angular/core';\nimport {\n MatCalendarCellClassFunction,\n MatDatepickerModule,\n} from '@angular/material/datepicker';\nimport { MatDateFnsModule } from '@angular/material-date-fns-adapter';\nimport { Observable, of } from 'rxjs';\nimport { ComponentPortal, Portal, PortalModule } from '@angular/cdk/portal';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { CommonModule } from '@angular/common';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { MatInputModule } from '@angular/material/input';\nimport { FormValidationHandlerModule } from '@tft/form-validation-handler';\nimport { FieldContainerComponent } from '../field-container';\nimport {\n crisprControlMixin,\n CrisprFieldComponent,\n DatepickerFieldConfig,\n} from '../../utils';\n\nconst defaultConfig: Partial<DatepickerFieldConfig> = {\n startView: 'month',\n};\nconst DatepickerFieldMixin =\n crisprControlMixin<DatepickerFieldConfig>(CrisprFieldComponent);\n\n@Component({\n selector: 'crispr-datepicker-field',\n templateUrl: './datepicker-field.component.html',\n styleUrls: ['./datepicker-field.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n CommonModule,\n FieldContainerComponent,\n MatDatepickerModule,\n MatFormFieldModule,\n ReactiveFormsModule,\n MatInputModule,\n MatDateFnsModule,\n PortalModule,\n FormValidationHandlerModule,\n ],\n})\nexport class DatepickerFieldComponent\n extends DatepickerFieldMixin\n implements OnInit, AfterContentInit\n{\n defaultConfig = defaultConfig;\n\n dateClass: MatCalendarCellClassFunction<Date>;\n dateClass$: Observable<MatCalendarCellClassFunction<Date>>;\n startAt$: Observable<Date>;\n\n /** A portal containing the footer component type for this calendar. */\n calendarFooterPortal: Portal<any>;\n\n ngOnInit() {\n super.ngOnInit();\n this.startAt$ =\n this.config.startAt instanceof Date\n ? of(this.config.startAt)\n : this.config.startAt instanceof Function\n ? this.config.startAt(this.group)\n : of(null);\n this.dateClass = this.config?.cellClassFunction || null;\n this.dateClass$ = this.config.dateClass\n ? this.config?.dateClass(this.group)\n : of(() => '');\n }\n\n ngAfterContentInit() {\n if (this.config.datepickerActions) {\n this.calendarFooterPortal = new ComponentPortal(\n this.config.datepickerActions\n );\n }\n }\n\n // handleSelectedChange(event, picker: MatDatepicker<unknown>) {\n // console.log({event, picker})\n // if(this.config.selectedChange) {\n // this.config.selectedChange(event, picker);\n // }\n // }\n}\n","<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <mat-form-field\n [color]=\"config.color\"\n [appearance]=\"config.appearance\"\n [formGroup]=\"group\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n <input\n matInput\n [formControlName]=\"config.controlName\"\n [min]=\"config.min\"\n [max]=\"config.max\"\n [matDatepicker]=\"picker\"\n [matDatepickerFilter]=\"config.datepickerFilter\">\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker\n [touchUi]=\"config.touchUi\"\n [startView]=\"config.startView\"\n [startAt]=\"startAt$ | async\"\n [dateClass]=\"dateClass || (dateClass$ | async)\"\n #picker>\n <mat-datepicker-actions *ngIf=\"calendarFooterPortal\">\n <ng-template [cdkPortalOutlet]=\"calendarFooterPortal\"></ng-template>\n </mat-datepicker-actions>\n </mat-datepicker>\n\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n</crispr-field-container>\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AA0BA,MAAM,aAAa,GAAmC;AACpD,IAAA,SAAS,EAAE,OAAO;CACnB,CAAC;AACF,MAAM,oBAAoB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AA,QAAA,EAAA,sCAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,mBAAA,EAAA,IAAA,EAAA,CAAA,CAAA,EAAA;;2FAGlB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBAlBpC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,yBAAyB,mBAGlB,uBAAuB,CAAC,MAAM,EAAA,UAAA,EACnC,IAAI,EACP,OAAA,EAAA;wBACP,YAAY;wBACZ,uBAAuB;wBACvB,mBAAmB;wBACnB,kBAAkB;wBAClB,mBAAmB;wBACnB,cAAc;wBACd,gBAAgB;wBAChB,YAAY;wBACZ,2BAA2B;AAC5B,qBAAA,EAAA,QAAA,EAAA,mnCAAA,EAAA,CAAA;;;;;"}
@@ -1,185 +0,0 @@
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$2 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 * as i2$1 from '@angular/platform-browser';
16
- import imageCompression from 'browser-image-compression';
17
- import { Subject, combineLatest, of } from 'rxjs';
18
- import { shareReplay, switchMap, map, tap, startWith } from 'rxjs/operators';
19
- import * as i7 from '@tft/form-validation-handler';
20
- import { FormValidationHandlerModule } from '@tft/form-validation-handler';
21
- import { crisprControlMixin, CrisprFieldComponent, convertBytesToMb, FieldContainerComponent, SelectedFileComponent, FileDropzoneDirective } from './tft-crispr-forms.mjs';
22
- import '@angular/material/tooltip';
23
- import '@angular/material/progress-bar';
24
-
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: "18.1.3", 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: "18.1.3", 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: "18.1.3", 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']
182
- }] } });
183
-
184
- export { ImageUploadFieldComponent };
185
- //# sourceMappingURL=tft-crispr-forms-index-DKwMd-o-.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tft-crispr-forms-index-DKwMd-o-.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;AACpC,YAAA,yBAAyB,EAAE,GAAG;AAC9B,YAAA,YAAY,EAAE,IAAI;SACnB,CAAC;AAEM,QAAA,IAAA,CAAA,qBAAqB,GAAG,IAAI,OAAO,EAAe,CAAC;QAC3D,IAAe,CAAA,eAAA,GAAG,IAAI,CAAC,qBAAqB;AACzC,aAAA,YAAY,EAAE;AACd,aAAA,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;AAMxB,QAAA,IAAA,CAAA,eAAe,GA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