@tft/crispr-forms 14.0.1-rc.0 → 14.0.1

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 (407) hide show
  1. package/esm2020/public-api.mjs +5 -0
  2. package/esm2020/src/index.mjs +2 -0
  3. package/esm2020/src/lib/crispr-forms.module.mjs +57 -0
  4. package/esm2020/src/lib/field-component-map.const.mjs +27 -0
  5. package/esm2020/src/lib/field.directive.mjs +69 -0
  6. package/esm2020/src/lib/form/form.component.mjs +63 -0
  7. package/esm2020/src/lib/form-group-list/form-group-list.component.mjs +93 -0
  8. package/esm2020/src/lib/form-group-list/index.mjs +2 -0
  9. package/esm2020/{lib → src/lib}/pipes/crispr-pipes.module.mjs +1 -1
  10. package/esm2020/src/lib/pipes/initial-control-value.pipe.mjs +21 -0
  11. package/esm2020/src/lib/public_api.mjs +3 -0
  12. package/esm2020/src/lib/sub-group/index.mjs +3 -0
  13. package/esm2020/src/lib/sub-group/sub-group.component.mjs +21 -0
  14. package/esm2020/src/lib/sub-group/sub-group.module.mjs +42 -0
  15. package/esm2020/tft-crispr-forms.mjs +2 -2
  16. package/esm2020/ui/autocomplete-chiplist-field/autocomplete-chiplist-field.component.mjs +130 -0
  17. package/esm2020/ui/autocomplete-chiplist-field/public-api.mjs +2 -0
  18. package/esm2020/ui/autocomplete-chiplist-field/tft-crispr-forms-ui-autocomplete-chiplist-field.mjs +5 -0
  19. package/esm2020/ui/autocomplete-field/autocomplete-field.component.mjs +93 -0
  20. package/esm2020/ui/autocomplete-field/public-api.mjs +2 -0
  21. package/esm2020/ui/autocomplete-field/tft-crispr-forms-ui-autocomplete-field.mjs +5 -0
  22. package/esm2020/ui/button/button.component.mjs +49 -0
  23. package/esm2020/ui/button/public-api.mjs +2 -0
  24. package/esm2020/ui/button/tft-crispr-forms-ui-button.mjs +5 -0
  25. package/esm2020/ui/checkbox-field/checkbox-field.component.mjs +42 -0
  26. package/esm2020/ui/checkbox-field/public-api.mjs +2 -0
  27. package/esm2020/ui/checkbox-field/tft-crispr-forms-ui-checkbox-field.mjs +5 -0
  28. package/esm2020/ui/datepicker-field/datepicker-field.component.mjs +63 -0
  29. package/esm2020/ui/datepicker-field/public-api.mjs +2 -0
  30. package/esm2020/ui/datepicker-field/tft-crispr-forms-ui-datepicker-field.mjs +5 -0
  31. package/esm2020/ui/divider/divider.component.mjs +28 -0
  32. package/esm2020/ui/divider/public-api.mjs +2 -0
  33. package/esm2020/ui/divider/tft-crispr-forms-ui-divider.mjs +5 -0
  34. package/esm2020/ui/field-container/field-container.component.mjs +58 -0
  35. package/esm2020/ui/field-container/public-api.mjs +2 -0
  36. package/esm2020/ui/field-container/tft-crispr-forms-ui-field-container.mjs +5 -0
  37. package/esm2020/ui/file-dropzone/file-dropzone.directive.mjs +40 -0
  38. package/esm2020/ui/file-dropzone/public-api.mjs +2 -0
  39. package/esm2020/ui/file-dropzone/tft-crispr-forms-ui-file-dropzone.mjs +5 -0
  40. package/esm2020/ui/file-upload-field/file-upload-field.component.mjs +108 -0
  41. package/esm2020/ui/file-upload-field/public-api.mjs +2 -0
  42. package/esm2020/ui/file-upload-field/tft-crispr-forms-ui-file-upload-field.mjs +5 -0
  43. package/esm2020/ui/heading/heading.component.mjs +31 -0
  44. package/esm2020/ui/heading/public-api.mjs +2 -0
  45. package/esm2020/ui/heading/tft-crispr-forms-ui-heading.mjs +5 -0
  46. package/esm2020/ui/image-upload-field/image-upload-field.component.mjs +179 -0
  47. package/esm2020/ui/image-upload-field/public-api.mjs +2 -0
  48. package/esm2020/ui/image-upload-field/tft-crispr-forms-ui-image-upload-field.mjs +5 -0
  49. package/esm2020/ui/info/info.component.mjs +23 -0
  50. package/esm2020/ui/info/public-api.mjs +2 -0
  51. package/esm2020/ui/info/tft-crispr-forms-ui-info.mjs +5 -0
  52. package/esm2020/ui/input-field/input-field.component.mjs +41 -0
  53. package/esm2020/ui/input-field/public-api.mjs +2 -0
  54. package/esm2020/ui/input-field/tft-crispr-forms-ui-input-field.mjs +5 -0
  55. package/esm2020/ui/option/option.component.mjs +19 -0
  56. package/esm2020/ui/option/public-api.mjs +2 -0
  57. package/esm2020/ui/option/tft-crispr-forms-ui-option.mjs +5 -0
  58. package/esm2020/ui/public-api.mjs +7 -0
  59. package/esm2020/ui/radio-field/public-api.mjs +2 -0
  60. package/esm2020/ui/radio-field/radio-field.component.mjs +39 -0
  61. package/esm2020/ui/radio-field/tft-crispr-forms-ui-radio-field.mjs +5 -0
  62. package/esm2020/ui/select-field/public-api.mjs +2 -0
  63. package/esm2020/ui/select-field/select-field.component.mjs +73 -0
  64. package/esm2020/ui/select-field/tft-crispr-forms-ui-select-field.mjs +5 -0
  65. package/esm2020/ui/selected-file/public-api.mjs +2 -0
  66. package/esm2020/ui/selected-file/selected-file.component.mjs +26 -0
  67. package/esm2020/ui/selected-file/tft-crispr-forms-ui-selected-file.mjs +5 -0
  68. package/esm2020/ui/slider-field/public-api.mjs +2 -0
  69. package/esm2020/ui/slider-field/slider-field.component.mjs +44 -0
  70. package/esm2020/ui/slider-field/tft-crispr-forms-ui-slider-field.mjs +5 -0
  71. package/esm2020/ui/textarea-field/public-api.mjs +2 -0
  72. package/esm2020/ui/textarea-field/textarea-field.component.mjs +42 -0
  73. package/esm2020/ui/textarea-field/tft-crispr-forms-ui-textarea-field.mjs +5 -0
  74. package/esm2020/ui/tft-crispr-forms-ui.mjs +5 -0
  75. package/esm2020/ui/unit-conversion-field/public-api.mjs +2 -0
  76. package/esm2020/ui/unit-conversion-field/tft-crispr-forms-ui-unit-conversion-field.mjs +5 -0
  77. package/esm2020/ui/unit-conversion-field/unit-conversion-field.component.mjs +84 -0
  78. package/esm2020/utils/abstracts/autocomplete-field.abstract.mjs +30 -0
  79. package/esm2020/utils/abstracts/crispr-control.mixin.mjs +27 -0
  80. package/esm2020/utils/abstracts/crispr-field.abstract.mjs +20 -0
  81. package/esm2020/utils/abstracts/index.mjs +4 -0
  82. package/esm2020/utils/functions/buildFormGroupFromConfig.mjs +28 -0
  83. package/esm2020/utils/functions/callOptionsIfFunction.mjs +4 -0
  84. package/esm2020/utils/functions/createControlForType.mjs +19 -0
  85. package/esm2020/utils/functions/filterOptionsByLabel.mjs +11 -0
  86. package/esm2020/utils/functions/image-compression.helpers.mjs +50 -0
  87. package/esm2020/utils/functions/index.mjs +8 -0
  88. package/esm2020/utils/functions/isControlConfig.mjs +7 -0
  89. package/esm2020/utils/functions/observablifyOptions.mjs +29 -0
  90. package/esm2020/utils/models/autocomplete-chiplist-field.config.mjs +2 -0
  91. package/esm2020/utils/models/autocomplete-field.config.mjs +2 -0
  92. package/esm2020/utils/models/button.config.mjs +2 -0
  93. package/esm2020/utils/models/checkbox-field.config.mjs +2 -0
  94. package/esm2020/utils/models/crispr-field.config.mjs +23 -0
  95. package/esm2020/utils/models/datepicker-field.config.mjs +2 -0
  96. package/esm2020/utils/models/divider.config.mjs +2 -0
  97. package/esm2020/utils/models/file-upload-field.config.mjs +2 -0
  98. package/esm2020/utils/models/form-group-list.config.mjs +2 -0
  99. package/esm2020/utils/models/heading.config.mjs +3 -0
  100. package/esm2020/utils/models/image-upload-field.config.mjs +2 -0
  101. package/esm2020/utils/models/index.mjs +18 -0
  102. package/esm2020/utils/models/input-field.config.mjs +2 -0
  103. package/esm2020/utils/models/radio-field.config.mjs +2 -0
  104. package/esm2020/utils/models/select-field.config.mjs +2 -0
  105. package/esm2020/utils/models/slider-field.config.mjs +2 -0
  106. package/esm2020/utils/models/textarea-field.config.mjs +2 -0
  107. package/esm2020/utils/models/unit-conversion-field.config.mjs +2 -0
  108. package/esm2020/utils/operators/form.operators.mjs +24 -0
  109. package/esm2020/utils/operators/index.mjs +2 -0
  110. package/esm2020/utils/public-api.mjs +5 -0
  111. package/esm2020/utils/tft-crispr-forms-utils.mjs +5 -0
  112. package/fesm2015/tft-crispr-forms-ui-autocomplete-chiplist-field.mjs +138 -0
  113. package/fesm2015/tft-crispr-forms-ui-autocomplete-chiplist-field.mjs.map +1 -0
  114. package/fesm2015/tft-crispr-forms-ui-autocomplete-field.mjs +101 -0
  115. package/fesm2015/tft-crispr-forms-ui-autocomplete-field.mjs.map +1 -0
  116. package/fesm2015/tft-crispr-forms-ui-button.mjs +55 -0
  117. package/fesm2015/tft-crispr-forms-ui-button.mjs.map +1 -0
  118. package/fesm2015/tft-crispr-forms-ui-checkbox-field.mjs +49 -0
  119. package/fesm2015/tft-crispr-forms-ui-checkbox-field.mjs.map +1 -0
  120. package/fesm2015/tft-crispr-forms-ui-datepicker-field.mjs +71 -0
  121. package/fesm2015/tft-crispr-forms-ui-datepicker-field.mjs.map +1 -0
  122. package/fesm2015/tft-crispr-forms-ui-divider.mjs +34 -0
  123. package/fesm2015/tft-crispr-forms-ui-divider.mjs.map +1 -0
  124. package/fesm2015/tft-crispr-forms-ui-field-container.mjs +64 -0
  125. package/fesm2015/tft-crispr-forms-ui-field-container.mjs.map +1 -0
  126. package/fesm2015/tft-crispr-forms-ui-file-dropzone.mjs +47 -0
  127. package/fesm2015/tft-crispr-forms-ui-file-dropzone.mjs.map +1 -0
  128. package/fesm2015/tft-crispr-forms-ui-file-upload-field.mjs +117 -0
  129. package/fesm2015/tft-crispr-forms-ui-file-upload-field.mjs.map +1 -0
  130. package/fesm2015/tft-crispr-forms-ui-heading.mjs +37 -0
  131. package/fesm2015/tft-crispr-forms-ui-heading.mjs.map +1 -0
  132. package/fesm2015/tft-crispr-forms-ui-image-upload-field.mjs +182 -0
  133. package/fesm2015/tft-crispr-forms-ui-image-upload-field.mjs.map +1 -0
  134. package/fesm2015/tft-crispr-forms-ui-info.mjs +30 -0
  135. package/fesm2015/tft-crispr-forms-ui-info.mjs.map +1 -0
  136. package/fesm2015/tft-crispr-forms-ui-input-field.mjs +48 -0
  137. package/fesm2015/tft-crispr-forms-ui-input-field.mjs.map +1 -0
  138. package/fesm2015/tft-crispr-forms-ui-option.mjs +26 -0
  139. package/fesm2015/tft-crispr-forms-ui-option.mjs.map +1 -0
  140. package/fesm2015/tft-crispr-forms-ui-radio-field.mjs +46 -0
  141. package/fesm2015/tft-crispr-forms-ui-radio-field.mjs.map +1 -0
  142. package/fesm2015/tft-crispr-forms-ui-select-field.mjs +81 -0
  143. package/fesm2015/tft-crispr-forms-ui-select-field.mjs.map +1 -0
  144. package/fesm2015/tft-crispr-forms-ui-selected-file.mjs +33 -0
  145. package/fesm2015/tft-crispr-forms-ui-selected-file.mjs.map +1 -0
  146. package/fesm2015/tft-crispr-forms-ui-slider-field.mjs +51 -0
  147. package/fesm2015/tft-crispr-forms-ui-slider-field.mjs.map +1 -0
  148. package/fesm2015/tft-crispr-forms-ui-textarea-field.mjs +49 -0
  149. package/fesm2015/tft-crispr-forms-ui-textarea-field.mjs.map +1 -0
  150. package/fesm2015/tft-crispr-forms-ui-unit-conversion-field.mjs +93 -0
  151. package/fesm2015/tft-crispr-forms-ui-unit-conversion-field.mjs.map +1 -0
  152. package/fesm2015/tft-crispr-forms-ui.mjs +12 -0
  153. package/fesm2015/tft-crispr-forms-ui.mjs.map +1 -0
  154. package/fesm2015/tft-crispr-forms-utils.mjs +270 -0
  155. package/fesm2015/tft-crispr-forms-utils.mjs.map +1 -0
  156. package/fesm2015/tft-crispr-forms.mjs +131 -2128
  157. package/fesm2015/tft-crispr-forms.mjs.map +1 -1
  158. package/fesm2020/tft-crispr-forms-ui-autocomplete-chiplist-field.mjs +137 -0
  159. package/fesm2020/tft-crispr-forms-ui-autocomplete-chiplist-field.mjs.map +1 -0
  160. package/fesm2020/tft-crispr-forms-ui-autocomplete-field.mjs +100 -0
  161. package/fesm2020/tft-crispr-forms-ui-autocomplete-field.mjs.map +1 -0
  162. package/fesm2020/tft-crispr-forms-ui-button.mjs +55 -0
  163. package/fesm2020/tft-crispr-forms-ui-button.mjs.map +1 -0
  164. package/fesm2020/tft-crispr-forms-ui-checkbox-field.mjs +49 -0
  165. package/fesm2020/tft-crispr-forms-ui-checkbox-field.mjs.map +1 -0
  166. package/fesm2020/tft-crispr-forms-ui-datepicker-field.mjs +70 -0
  167. package/fesm2020/tft-crispr-forms-ui-datepicker-field.mjs.map +1 -0
  168. package/fesm2020/tft-crispr-forms-ui-divider.mjs +34 -0
  169. package/fesm2020/tft-crispr-forms-ui-divider.mjs.map +1 -0
  170. package/fesm2020/tft-crispr-forms-ui-field-container.mjs +65 -0
  171. package/fesm2020/tft-crispr-forms-ui-field-container.mjs.map +1 -0
  172. package/fesm2020/tft-crispr-forms-ui-file-dropzone.mjs +47 -0
  173. package/fesm2020/tft-crispr-forms-ui-file-dropzone.mjs.map +1 -0
  174. package/fesm2020/tft-crispr-forms-ui-file-upload-field.mjs +115 -0
  175. package/fesm2020/tft-crispr-forms-ui-file-upload-field.mjs.map +1 -0
  176. package/fesm2020/tft-crispr-forms-ui-heading.mjs +37 -0
  177. package/fesm2020/tft-crispr-forms-ui-heading.mjs.map +1 -0
  178. package/fesm2020/tft-crispr-forms-ui-image-upload-field.mjs +185 -0
  179. package/fesm2020/tft-crispr-forms-ui-image-upload-field.mjs.map +1 -0
  180. package/fesm2020/tft-crispr-forms-ui-info.mjs +30 -0
  181. package/fesm2020/tft-crispr-forms-ui-info.mjs.map +1 -0
  182. package/fesm2020/tft-crispr-forms-ui-input-field.mjs +48 -0
  183. package/fesm2020/tft-crispr-forms-ui-input-field.mjs.map +1 -0
  184. package/fesm2020/tft-crispr-forms-ui-option.mjs +26 -0
  185. package/fesm2020/tft-crispr-forms-ui-option.mjs.map +1 -0
  186. package/fesm2020/tft-crispr-forms-ui-radio-field.mjs +46 -0
  187. package/fesm2020/tft-crispr-forms-ui-radio-field.mjs.map +1 -0
  188. package/fesm2020/tft-crispr-forms-ui-select-field.mjs +80 -0
  189. package/fesm2020/tft-crispr-forms-ui-select-field.mjs.map +1 -0
  190. package/fesm2020/tft-crispr-forms-ui-selected-file.mjs +33 -0
  191. package/fesm2020/tft-crispr-forms-ui-selected-file.mjs.map +1 -0
  192. package/fesm2020/tft-crispr-forms-ui-slider-field.mjs +51 -0
  193. package/fesm2020/tft-crispr-forms-ui-slider-field.mjs.map +1 -0
  194. package/fesm2020/tft-crispr-forms-ui-textarea-field.mjs +49 -0
  195. package/fesm2020/tft-crispr-forms-ui-textarea-field.mjs.map +1 -0
  196. package/fesm2020/tft-crispr-forms-ui-unit-conversion-field.mjs +91 -0
  197. package/fesm2020/tft-crispr-forms-ui-unit-conversion-field.mjs.map +1 -0
  198. package/fesm2020/tft-crispr-forms-ui.mjs +12 -0
  199. package/fesm2020/tft-crispr-forms-ui.mjs.map +1 -0
  200. package/fesm2020/tft-crispr-forms-utils.mjs +269 -0
  201. package/fesm2020/tft-crispr-forms-utils.mjs.map +1 -0
  202. package/fesm2020/tft-crispr-forms.mjs +129 -2119
  203. package/fesm2020/tft-crispr-forms.mjs.map +1 -1
  204. package/index.d.ts +5 -1
  205. package/package.json +179 -4
  206. package/public-api.d.ts +3 -0
  207. package/src/index.d.ts +1 -0
  208. package/src/lib/crispr-forms.module.d.ts +15 -0
  209. package/src/lib/field-component-map.const.d.ts +42 -0
  210. package/{lib → src/lib}/field.directive.d.ts +4 -10
  211. package/{lib → src/lib}/form/form.component.d.ts +2 -12
  212. package/{lib → src/lib}/form-group-list/form-group-list.component.d.ts +12 -14
  213. package/{lib → src/lib}/form-group-list/index.d.ts +0 -1
  214. package/{lib → src/lib}/pipes/crispr-pipes.module.d.ts +0 -0
  215. package/{lib → src/lib}/pipes/initial-control-value.pipe.d.ts +1 -1
  216. package/src/lib/public_api.d.ts +2 -0
  217. package/{lib → src/lib}/sub-group/index.d.ts +0 -0
  218. package/{lib → src/lib}/sub-group/sub-group.component.d.ts +11 -13
  219. package/{lib → src/lib}/sub-group/sub-group.module.d.ts +2 -2
  220. package/tft-crispr-forms-14.0.1.tgz +0 -0
  221. package/ui/README.md +3 -0
  222. package/{lib/material → ui}/autocomplete-chiplist-field/autocomplete-chiplist-field.component.d.ts +2 -18
  223. package/ui/autocomplete-chiplist-field/index.d.ts +5 -0
  224. package/ui/autocomplete-chiplist-field/public-api.d.ts +1 -0
  225. package/{lib/material → ui}/autocomplete-field/autocomplete-field.component.d.ts +2 -16
  226. package/ui/autocomplete-field/index.d.ts +5 -0
  227. package/ui/autocomplete-field/public-api.d.ts +1 -0
  228. package/ui/button/button.component.d.ts +15 -0
  229. package/ui/button/index.d.ts +5 -0
  230. package/ui/button/public-api.d.ts +1 -0
  231. package/ui/checkbox-field/checkbox-field.component.d.ts +21 -0
  232. package/ui/checkbox-field/index.d.ts +5 -0
  233. package/ui/checkbox-field/public-api.d.ts +1 -0
  234. package/ui/datepicker-field/datepicker-field.component.d.ts +30 -0
  235. package/ui/datepicker-field/index.d.ts +5 -0
  236. package/ui/datepicker-field/public-api.d.ts +1 -0
  237. package/ui/divider/divider.component.d.ts +9 -0
  238. package/ui/divider/index.d.ts +5 -0
  239. package/ui/divider/public-api.d.ts +1 -0
  240. package/{lib → ui}/field-container/field-container.component.d.ts +2 -9
  241. package/ui/field-container/index.d.ts +5 -0
  242. package/{lib/field-container/index.d.ts → ui/field-container/public-api.d.ts} +0 -0
  243. package/{lib/material/file-upload → ui/file-dropzone}/file-dropzone.directive.d.ts +1 -1
  244. package/ui/file-dropzone/index.d.ts +5 -0
  245. package/{lib/material/file-upload/index.d.ts → ui/file-dropzone/public-api.d.ts} +0 -1
  246. package/ui/file-upload-field/file-upload-field.component.d.ts +37 -0
  247. package/ui/file-upload-field/index.d.ts +5 -0
  248. package/ui/file-upload-field/public-api.d.ts +1 -0
  249. package/ui/heading/heading.component.d.ts +8 -0
  250. package/ui/heading/index.d.ts +5 -0
  251. package/ui/heading/public-api.d.ts +1 -0
  252. package/ui/image-upload-field/image-upload-field.component.d.ts +48 -0
  253. package/ui/image-upload-field/index.d.ts +5 -0
  254. package/{lib/material/image-upload-field/index.d.ts → ui/image-upload-field/public-api.d.ts} +0 -0
  255. package/ui/index.d.ts +5 -0
  256. package/ui/info/index.d.ts +5 -0
  257. package/ui/info/info.component.d.ts +7 -0
  258. package/ui/info/public-api.d.ts +1 -0
  259. package/ui/input-field/index.d.ts +5 -0
  260. package/ui/input-field/input-field.component.d.ts +22 -0
  261. package/ui/input-field/public-api.d.ts +1 -0
  262. package/ui/option/index.d.ts +5 -0
  263. package/ui/option/option.component.d.ts +7 -0
  264. package/{lib/material/option/index.d.ts → ui/option/public-api.d.ts} +0 -0
  265. package/ui/public-api.d.ts +5 -0
  266. package/ui/radio-field/index.d.ts +5 -0
  267. package/ui/radio-field/public-api.d.ts +1 -0
  268. package/ui/radio-field/radio-field.component.d.ts +23 -0
  269. package/ui/select-field/index.d.ts +5 -0
  270. package/ui/select-field/public-api.d.ts +1 -0
  271. package/ui/select-field/select-field.component.d.ts +32 -0
  272. package/ui/selected-file/index.d.ts +5 -0
  273. package/ui/selected-file/public-api.d.ts +1 -0
  274. package/ui/selected-file/selected-file.component.d.ts +10 -0
  275. package/ui/slider-field/index.d.ts +5 -0
  276. package/ui/slider-field/public-api.d.ts +1 -0
  277. package/ui/slider-field/slider-field.component.d.ts +25 -0
  278. package/ui/textarea-field/index.d.ts +5 -0
  279. package/ui/textarea-field/public-api.d.ts +1 -0
  280. package/ui/textarea-field/textarea-field.component.d.ts +21 -0
  281. package/ui/unit-conversion-field/index.d.ts +5 -0
  282. package/ui/unit-conversion-field/public-api.d.ts +1 -0
  283. package/ui/unit-conversion-field/unit-conversion-field.component.d.ts +36 -0
  284. package/utils/README.md +3 -0
  285. package/{lib → utils}/abstracts/autocomplete-field.abstract.d.ts +0 -0
  286. package/{lib → utils}/abstracts/crispr-control.mixin.d.ts +0 -0
  287. package/{lib → utils}/abstracts/crispr-field.abstract.d.ts +1 -1
  288. package/{lib → utils}/abstracts/index.d.ts +0 -0
  289. package/utils/functions/buildFormGroupFromConfig.d.ts +9 -0
  290. package/utils/functions/callOptionsIfFunction.d.ts +3 -0
  291. package/utils/functions/createControlForType.d.ts +9 -0
  292. package/utils/functions/filterOptionsByLabel.d.ts +7 -0
  293. package/utils/functions/image-compression.helpers.d.ts +5 -0
  294. package/utils/functions/index.d.ts +7 -0
  295. package/utils/functions/isControlConfig.d.ts +5 -0
  296. package/utils/functions/observablifyOptions.d.ts +12 -0
  297. package/utils/index.d.ts +5 -0
  298. package/{lib → utils}/models/autocomplete-chiplist-field.config.d.ts +2 -1
  299. package/{lib → utils}/models/autocomplete-field.config.d.ts +1 -2
  300. package/{lib → utils}/models/button.config.d.ts +0 -0
  301. package/{lib → utils}/models/checkbox-field.config.d.ts +1 -2
  302. package/{lib → utils}/models/crispr-field.config.d.ts +1 -10
  303. package/{lib → utils}/models/datepicker-field.config.d.ts +1 -2
  304. package/{lib → utils}/models/divider.config.d.ts +1 -1
  305. package/{lib → utils}/models/file-upload-field.config.d.ts +9 -4
  306. package/{lib → utils}/models/form-group-list.config.d.ts +1 -2
  307. package/{lib → utils}/models/heading.config.d.ts +1 -2
  308. package/{lib → utils}/models/image-upload-field.config.d.ts +2 -1
  309. package/{lib → utils}/models/index.d.ts +0 -0
  310. package/{lib → utils}/models/input-field.config.d.ts +1 -2
  311. package/{lib → utils}/models/radio-field.config.d.ts +0 -0
  312. package/{lib → utils}/models/select-field.config.d.ts +1 -2
  313. package/{lib → utils}/models/slider-field.config.d.ts +1 -2
  314. package/{lib → utils}/models/textarea-field.config.d.ts +1 -2
  315. package/{lib → utils}/models/unit-conversion-field.config.d.ts +1 -2
  316. package/{lib → utils/operators}/form.operators.d.ts +0 -0
  317. package/utils/operators/index.d.ts +1 -0
  318. package/utils/public-api.d.ts +4 -0
  319. package/esm2020/index.mjs +0 -2
  320. package/esm2020/lib/abstracts/autocomplete-field.abstract.mjs +0 -30
  321. package/esm2020/lib/abstracts/crispr-control.mixin.mjs +0 -27
  322. package/esm2020/lib/abstracts/crispr-field.abstract.mjs +0 -17
  323. package/esm2020/lib/abstracts/index.mjs +0 -4
  324. package/esm2020/lib/crispr-forms.module.mjs +0 -65
  325. package/esm2020/lib/field-component-map.const.mjs +0 -28
  326. package/esm2020/lib/field-container/field-container.component.mjs +0 -83
  327. package/esm2020/lib/field-container/index.mjs +0 -2
  328. package/esm2020/lib/field.directive.mjs +0 -88
  329. package/esm2020/lib/form/form.component.mjs +0 -88
  330. package/esm2020/lib/form-group-list/form-group-list.component.mjs +0 -77
  331. package/esm2020/lib/form-group-list/form-group-list.module.mjs +0 -52
  332. package/esm2020/lib/form-group-list/index.mjs +0 -3
  333. package/esm2020/lib/form.helpers.mjs +0 -190
  334. package/esm2020/lib/form.operators.mjs +0 -24
  335. package/esm2020/lib/material/autocomplete-chiplist-field/autocomplete-chiplist-field.component.mjs +0 -165
  336. package/esm2020/lib/material/autocomplete-field/autocomplete-field.component.mjs +0 -124
  337. package/esm2020/lib/material/button/button.component.mjs +0 -70
  338. package/esm2020/lib/material/checkbox-field/checkbox-field.component.mjs +0 -69
  339. package/esm2020/lib/material/datepicker-field/datepicker-field.component.mjs +0 -91
  340. package/esm2020/lib/material/divider/divider.component.mjs +0 -46
  341. package/esm2020/lib/material/file-upload/file-dropzone.directive.mjs +0 -39
  342. package/esm2020/lib/material/file-upload/file-upload.component.mjs +0 -143
  343. package/esm2020/lib/material/file-upload/index.mjs +0 -3
  344. package/esm2020/lib/material/heading/heading.component.mjs +0 -52
  345. package/esm2020/lib/material/image-upload-field/image-compression.helpers.mjs +0 -4
  346. package/esm2020/lib/material/image-upload-field/image-upload-field.component.mjs +0 -263
  347. package/esm2020/lib/material/image-upload-field/index.mjs +0 -2
  348. package/esm2020/lib/material/index.mjs +0 -18
  349. package/esm2020/lib/material/info/info.component.mjs +0 -44
  350. package/esm2020/lib/material/input-field/input-field.component.mjs +0 -66
  351. package/esm2020/lib/material/material.module.mjs +0 -96
  352. package/esm2020/lib/material/option/index.mjs +0 -2
  353. package/esm2020/lib/material/option/option.component.mjs +0 -39
  354. package/esm2020/lib/material/radio-field/radio-field.component.mjs +0 -60
  355. package/esm2020/lib/material/select-field/select-field.component.mjs +0 -108
  356. package/esm2020/lib/material/selected-file/selected-file.component.mjs +0 -45
  357. package/esm2020/lib/material/slider-field/slider-field.component.mjs +0 -69
  358. package/esm2020/lib/material/textarea-field/textarea-field.component.mjs +0 -67
  359. package/esm2020/lib/material/unit-conversion-field/unit-conversion-field.component.mjs +0 -115
  360. package/esm2020/lib/models/autocomplete-chiplist-field.config.mjs +0 -2
  361. package/esm2020/lib/models/autocomplete-field.config.mjs +0 -2
  362. package/esm2020/lib/models/button.config.mjs +0 -2
  363. package/esm2020/lib/models/checkbox-field.config.mjs +0 -2
  364. package/esm2020/lib/models/crispr-field.config.mjs +0 -23
  365. package/esm2020/lib/models/datepicker-field.config.mjs +0 -2
  366. package/esm2020/lib/models/divider.config.mjs +0 -2
  367. package/esm2020/lib/models/file-upload-field.config.mjs +0 -2
  368. package/esm2020/lib/models/form-group-list.config.mjs +0 -2
  369. package/esm2020/lib/models/heading.config.mjs +0 -3
  370. package/esm2020/lib/models/image-upload-field.config.mjs +0 -2
  371. package/esm2020/lib/models/index.mjs +0 -18
  372. package/esm2020/lib/models/input-field.config.mjs +0 -2
  373. package/esm2020/lib/models/radio-field.config.mjs +0 -2
  374. package/esm2020/lib/models/select-field.config.mjs +0 -2
  375. package/esm2020/lib/models/slider-field.config.mjs +0 -2
  376. package/esm2020/lib/models/textarea-field.config.mjs +0 -2
  377. package/esm2020/lib/models/unit-conversion-field.config.mjs +0 -2
  378. package/esm2020/lib/pipes/initial-control-value.pipe.mjs +0 -20
  379. package/esm2020/lib/public_api.mjs +0 -10
  380. package/esm2020/lib/sub-group/index.mjs +0 -3
  381. package/esm2020/lib/sub-group/sub-group.component.mjs +0 -20
  382. package/esm2020/lib/sub-group/sub-group.module.mjs +0 -43
  383. package/lib/crispr-forms.module.d.ts +0 -16
  384. package/lib/field-component-map.const.d.ts +0 -28
  385. package/lib/form-group-list/form-group-list.module.d.ts +0 -15
  386. package/lib/form.helpers.d.ts +0 -88
  387. package/lib/material/button/button.component.d.ts +0 -26
  388. package/lib/material/checkbox-field/checkbox-field.component.d.ts +0 -34
  389. package/lib/material/datepicker-field/datepicker-field.component.d.ts +0 -45
  390. package/lib/material/divider/divider.component.d.ts +0 -17
  391. package/lib/material/file-upload/file-upload.component.d.ts +0 -54
  392. package/lib/material/heading/heading.component.d.ts +0 -17
  393. package/lib/material/image-upload-field/image-compression.helpers.d.ts +0 -1
  394. package/lib/material/image-upload-field/image-upload-field.component.d.ts +0 -68
  395. package/lib/material/index.d.ts +0 -17
  396. package/lib/material/info/info.component.d.ts +0 -15
  397. package/lib/material/input-field/input-field.component.d.ts +0 -35
  398. package/lib/material/material.module.d.ts +0 -26
  399. package/lib/material/option/option.component.d.ts +0 -14
  400. package/lib/material/radio-field/radio-field.component.d.ts +0 -35
  401. package/lib/material/select-field/select-field.component.d.ts +0 -48
  402. package/lib/material/selected-file/selected-file.component.d.ts +0 -17
  403. package/lib/material/slider-field/slider-field.component.d.ts +0 -38
  404. package/lib/material/textarea-field/textarea-field.component.d.ts +0 -35
  405. package/lib/material/unit-conversion-field/unit-conversion-field.component.d.ts +0 -52
  406. package/lib/public_api.d.ts +0 -9
  407. package/tft-crispr-forms-14.0.1-rc.0.tgz +0 -0
@@ -1,2045 +1,114 @@
1
- import { of, combineLatest, from, isObservable, BehaviorSubject, Subject } from 'rxjs';
2
- import * as i4 from '@angular/forms';
3
- import { FormGroup, FormArray, FormControl, ReactiveFormsModule } from '@angular/forms';
4
- import { map, startWith, debounceTime, distinctUntilChanged, switchMap, shareReplay, tap } from 'rxjs/operators';
5
1
  import * as i0 from '@angular/core';
6
- import { Directive, Component, ChangeDetectionStrategy, Input, NgModule, ViewChild, EventEmitter, Output, HostListener, Optional, Self, Pipe } from '@angular/core';
7
- import * as i6 from '@angular/material/input';
8
- import { MatInputModule } from '@angular/material/input';
2
+ import { Directive, Input, Pipe, NgModule, EventEmitter, Component, Output, ViewChild, ChangeDetectionStrategy } from '@angular/core';
9
3
  import * as i1 from '@angular/common';
10
4
  import { CommonModule } from '@angular/common';
11
- import * as i5 from '@angular/material/form-field';
12
- import { MatFormFieldModule } from '@angular/material/form-field';
13
- import * as i3 from '@angular/material/icon';
14
- import { MatIconModule } from '@angular/material/icon';
15
- import * as i3$1 from '@angular/material/tooltip';
16
- import { MatTooltipModule } from '@angular/material/tooltip';
17
- import * as i6$1 from '@angular/material/select';
18
- import { MatSelectModule } from '@angular/material/select';
19
- import * as i4$1 from '@angular/material/checkbox';
20
- import { MatCheckboxModule } from '@angular/material/checkbox';
21
- import { __awaiter } from 'tslib';
22
- import * as i7 from '@angular/material/core';
23
- import { MatOptionModule } from '@angular/material/core';
24
- import * as i6$2 from '@angular/material/autocomplete';
25
- import { MatAutocompleteTrigger, MatAutocompleteModule } from '@angular/material/autocomplete';
26
- import { ENTER } from '@angular/cdk/keycodes';
27
- import * as i10 from '@angular/material/chips';
28
- import { MatChipsModule } from '@angular/material/chips';
29
- import * as i5$1 from '@angular/material/slider';
30
- import { MatSliderModule } from '@angular/material/slider';
31
- import * as i2 from '@angular/material/button';
32
- import { MatButtonModule } from '@angular/material/button';
33
- import * as i3$2 from '@angular/material/datepicker';
34
- import { MatDatepickerModule } from '@angular/material/datepicker';
35
- import { MatDateFnsModule } from '@angular/material-date-fns-adapter';
36
- import * as i7$1 from '@angular/cdk/portal';
37
- import { ComponentPortal, PortalModule } from '@angular/cdk/portal';
38
- import * as i2$1 from '@angular/material/divider';
39
- import { MatDividerModule } from '@angular/material/divider';
40
- import * as i4$2 from '@angular/material/radio';
41
- import { MatRadioModule } from '@angular/material/radio';
42
- import imageCompression from 'browser-image-compression';
43
- import * as i9 from '@tft/form-validation-handler';
44
- import { FormValidationHandlerModule } from '@tft/form-validation-handler';
45
- import * as i2$2 from '@angular/material/progress-bar';
46
- import { MatProgressBarModule } from '@angular/material/progress-bar';
47
- import * as i2$3 from '@angular/platform-browser';
48
-
49
- const DEFAULT_EMPTY_OPTIONS_MESSAGE = 'No Items';
50
-
51
- // export type ControlType = keyof typeof FIELD_COMPONENTS;
52
- var ControlType;
53
- (function (ControlType) {
54
- ControlType["AUTOCOMPLETE"] = "autocomplete";
55
- ControlType["AUTOCOMPLETE_CHIPLIST"] = "autocompleteChiplist";
56
- ControlType["BUTTON"] = "button";
57
- ControlType["CHECKBOX"] = "checkbox";
58
- ControlType["CUSTOM"] = "custom";
59
- ControlType["DATEPICKER"] = "datepicker";
60
- ControlType["DIVIDER"] = "divider";
61
- ControlType["FILE_UPLOAD"] = "fileUpload";
62
- ControlType["HEADING"] = "heading";
63
- ControlType["INPUT"] = "input";
64
- ControlType["IMAGE_UPLOAD"] = "imageUpload";
65
- ControlType["GROUP_LIST"] = "groupList";
66
- ControlType["RADIO"] = "radio";
67
- ControlType["SELECT"] = "select";
68
- ControlType["SLIDER"] = "slider";
69
- ControlType["SUB_GROUP"] = "subGroup";
70
- ControlType["TEXTAREA"] = "textarea";
71
- ControlType["UNIT_CONVERSION"] = "unitConversion";
72
- })(ControlType || (ControlType = {}));
73
-
74
- ;
75
-
76
- function valueIn(values) {
77
- return map((value) => {
78
- if (value) {
79
- return values.some(v => {
80
- if (isRegex(v)) {
81
- const trimmedStringForRegex = v.substr(1, v.length - 2);
82
- const regex = new RegExp(trimmedStringForRegex);
83
- return regex.test(value);
84
- }
85
- else {
86
- return v === value;
87
- }
88
- });
89
- }
90
- else {
91
- return false;
92
- }
93
- });
94
- }
95
- function isRegex(string) {
96
- return string.startsWith('/') && string.endsWith('/');
97
- }
98
-
99
- /**
100
- * Watches a single control for a list of values, returns true when field value matches any value in list
101
- * unless an evaluate method is found on config, in which case that method is run on the returned boolean value
102
- * @param group the direct parent of the field we want to watch
103
- * @param config
104
- */
105
- function checkControlForValues(group, config) {
106
- // check that all the pieces we need are available
107
- if (config && config.controlName && Array.isArray(config.values)) {
108
- return getValueChanges(group, config.controlName).pipe(
109
- // return a boolean, true if value is in the values being watch for, otherwise false
110
- valueIn(config.values), map((isValueInValues) => {
111
- // since we can only check if the value is in the list of watched values, the evaluate function gives us
112
- // a chance to make other decisions based on if the boolean returned, e.g. return true if value not in watched values
113
- if (config.evaluate && config.evaluate instanceof Function) {
114
- return config.evaluate(isValueInValues);
115
- }
116
- else {
117
- return isValueInValues;
118
- }
119
- }));
120
- }
121
- else {
122
- //
123
- return of(true);
124
- }
125
- }
126
- /**
127
- * Watches a list of fields for individual lists of values returning true when any field contains one
128
- * of the values being watched for, or optionally running a function on the array of resolved booleans
129
- * from the listed fields and returning a boolean
130
- * @param group the form group that has the fields to watch as direct descendants
131
- * @param config the configuration to use when calling the function
132
- */
133
- function checkControlsForValues(group, config) {
134
- // if no config is passed we just want to show the field, so we return an observable of true
135
- if (!config || !config.watchConfigs) {
136
- return of(true);
137
- }
138
- // we run checkControlForValues on every control in the list of WatchConfigs creating
139
- // an array of Observable watching fields for values
140
- const fieldTriggers = config.watchConfigs.map(watchConfig => {
141
- // resolves a boolean, true when field value matches a watched value, otherwise false
142
- return checkControlForValues(group, watchConfig);
143
- });
144
- return combineLatest(fieldTriggers).pipe(startWith([true]), map((booleans) => {
145
- // if the user passed an evaluate function use it
146
- if (config.evaluate && config.evaluate instanceof Function) {
147
- return config.evaluate(booleans);
148
- }
149
- else { // otherwise we return true if any of the watched fields resolve to true
150
- return booleans.some(bool => bool);
151
- }
152
- }));
153
- }
154
- /**
155
- * Watches values on an array of fields, computing their values as they change
156
- * @param group the group to get the fields from, for now it can only be the parent of the computed field
157
- * @param computeFieldsConfig the configuration that drives the computation, holds the names to watch and the
158
- * computation function that get called against the array of values
159
- */
160
- function computeValueFromFields(group, computeFieldsConfig) {
161
- // TODO: better checking
162
- const { controlNamesToWatch } = computeFieldsConfig;
163
- //creates an observable listener for each control in the controlNamesToWatch array
164
- return combineLatest(controlNamesToWatch.map(controlNameToWatch => getValueChanges(group, controlNameToWatch))).pipe(
165
- // each time a watched field values changes a new array of the latest field values is pipe through to the
166
- // compute callback. Which runs the users logic on the values to compute this fields value
167
- map(valuesArray => computeFieldsConfig.computeCallback(valuesArray)));
168
- }
169
- /**
170
- * A simple wrapper for doing error checking around getting the valueChanges observable from a control on a form group
171
- * @param group the form group we want to pull the observable from
172
- * @param controlName the name of the control who's value we want to subscribe to
173
- */
174
- function getValueChanges(group, controlName) {
175
- const control = group.get(controlName);
176
- if (!control) {
177
- throw new Error(`No control with controlName ${controlName}`);
178
- }
179
- return control.valueChanges;
180
- }
181
- /**
182
- * TODO: move to utils library after library is built
183
- * Allows developer to pass an array of operators into the pipe of an Observable.
184
- * Useful for creating function with a variable amount of operators to be run
185
- * @param observable the observable to pass the operators to
186
- * @param operators array of operators to pipe
187
- */
188
- function pipeOperatorsIntoObservable(observable, operators) {
189
- try {
190
- return operators.reduce((obs, op) => {
191
- return obs.pipe(op);
192
- }, observable);
193
- }
194
- catch (_a) {
195
- console.error('Unable to pipe operators into observable');
196
- return of(null);
197
- }
198
- }
199
- function callOptionsIfFunction(options, parentGroup, searchString) {
200
- return options instanceof Function ? options(parentGroup, searchString) : options;
201
- }
202
- /**
203
- * The user can give us select options as an array, a function that resolves to a promise,
204
- * or an observable. This functions consumes any of those and returns an observable that
205
- * resolves an array of options
206
- *
207
- * @param options the options passed in from the config
208
- * @param emptyMessageOption the message to display when the array is empty
209
- */
210
- function observablifyOptions(options, parentGroup, searchString) {
211
- const calledOptions = callOptionsIfFunction(options, parentGroup, searchString);
212
- // if options are a promise
213
- const observableOptions = calledOptions instanceof Promise
214
- // convert to observable
215
- ? from(calledOptions)
216
- // if array that isn't empty
217
- : Array.isArray(calledOptions) && calledOptions.length
218
- // convert to observable
219
- ? of(calledOptions)
220
- // if observable
221
- : isObservable(calledOptions)
222
- // return it
223
- ? calledOptions
224
- // else an empty array
225
- : of([]);
226
- return observableOptions;
227
- }
228
- /**
229
- * Determines if the field config is for a form control (not a divider, heading or other non-control field)
230
- * */
231
- function isControlConfig(fieldConfig) {
232
- return 'controlName' in fieldConfig;
233
- }
234
- /**
235
- * builds out form group based on config
236
- * @param config a configuration for a form group
237
- * @param value an object of initial values to pass in
238
- * @param group the form group to modify and build out
239
- */
240
- function buildFormGroupFromConfig(config, value = null, group = new FormGroup({})) {
241
- config.fields.forEach((controlConfig) => {
242
- var _a;
243
- if (isControlConfig(controlConfig)) {
244
- // then add a control to the group using the controlName from configuration
245
- const { controlName } = controlConfig;
246
- if (group.get(controlName)) {
247
- group.removeControl(controlName);
248
- }
249
- // if there's a value object and it has a non-null/undefined value for this field use it.
250
- // Otherwise, default to null
251
- const controlValue = (_a = (value && value[controlName])) !== null && _a !== void 0 ? _a : null;
252
- const control = createControlForType(controlConfig, controlValue);
253
- group.addControl(controlName, control);
254
- }
255
- });
256
- group.setValidators(config.validators);
257
- return group;
258
- }
259
- /**
260
- * Analyze the config and build a form control to spec. Notice we don't use FormBuilder here
261
- * as we want to keep this function pure.
262
- * @param controlConfig the configuration object for the control to build
263
- * @param value an initial value to use if passed in
264
- */
265
- function createControlForType(controlConfig, value = null) {
266
- // build form control out based on the control type
267
- const control = controlConfig.controlType === ControlType.SUB_GROUP
268
- ? buildFormGroupFromConfig(controlConfig, value)
269
- : controlConfig.controlType === ControlType.GROUP_LIST
270
- ? new FormArray([], controlConfig.validators)
271
- : new FormControl(value || null, controlConfig.validators);
272
- return control;
273
- }
274
- /**
275
- * A basic filter function that filters the search string against the label of the options object
276
- * @param options the array of options to filter
277
- * @param searchString the string from the input
278
- */
279
- function filterOptionsByLabel(options, searchString) {
280
- return options.filter(option => {
281
- return option.label && option.label.toLowerCase().includes(searchString.toLowerCase());
282
- });
283
- }
284
-
285
- function crisprControlMixin(BaseClass) {
286
- return class extends BaseClass {
287
- set value(value) {
288
- this.setControlValue(value);
289
- this._value = value;
290
- }
291
- get value() {
292
- return this._value;
293
- }
294
- ngOnInit() {
295
- super.ngOnInit();
296
- this.control = this.group.get(this.config.controlName);
297
- this.setControlValue(this.value);
298
- // setTimeouts are ugly but this seems to be the only way to get the computed field to compute initial values
299
- setTimeout(() => {
300
- this.control.updateValueAndValidity();
301
- });
302
- }
303
- setControlValue(value) {
304
- if (value && this.control && this.config.controlType !== ControlType.SUB_GROUP) {
305
- this.control.setValue(value);
306
- }
307
- }
308
- };
309
- }
310
-
311
- // eslint-disable-next-line @angular-eslint/directive-class-suffix
312
- class CrisprFieldComponent {
313
- ngOnInit() {
314
- this.applyDefaultConfig();
315
- }
316
- applyDefaultConfig() {
317
- this.config = this.defaultConfig ? Object.assign(Object.assign({}, this.defaultConfig), this.config) : this.config;
318
- }
319
- }
320
- CrisprFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
321
- CrisprFieldComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.1", type: CrisprFieldComponent, ngImport: i0 });
322
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprFieldComponent, decorators: [{
323
- type: Directive
324
- }] });
325
-
326
- const AbstractAutocompleteFieldMixin = crisprControlMixin(CrisprFieldComponent);
327
- // eslint-disable-next-line @angular-eslint/directive-class-suffix
328
- class AbstractAutocompleteComponent extends AbstractAutocompleteFieldMixin {
329
- constructor() {
330
- super(...arguments);
331
- // we need a separate control for the UI because of the way the material autocomplete chiplist works
332
- this.autocompleteInputControl = new FormControl('');
333
- }
334
- ngOnInit() {
335
- super.ngOnInit();
336
- this.group.addControl(this.config.controlName, new FormControl());
337
- // filter options by the search string using either the default filter function or one passed in through config
338
- this.options$ = this.autocompleteInputControl.valueChanges.pipe(
339
- // this is needed to have the options panel to open on focus
340
- startWith(''), debounceTime(this.config.typeDebounceTime), map((searchText) => typeof searchText === 'string' ? searchText === null || searchText === void 0 ? void 0 : searchText.trim() : ''), distinctUntilChanged(), switchMap((searchText) => observablifyOptions(this.config.options, this.group, searchText)), shareReplay(1));
341
- }
342
- }
343
- AbstractAutocompleteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: AbstractAutocompleteComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive });
344
- AbstractAutocompleteComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.1", type: AbstractAutocompleteComponent, usesInheritance: true, ngImport: i0 });
345
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: AbstractAutocompleteComponent, decorators: [{
346
- type: Directive
347
- }] });
348
-
349
- class InfoComponent {
350
- }
351
- InfoComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: InfoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
352
- InfoComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: InfoComponent, selector: "crispr-info", inputs: { info: "info" }, ngImport: i0, template: "<mat-icon\n *ngIf=\"info\"\n [matTooltip]=\"info.content\"\n [matTooltipPosition]=\"info.tooltipPosition || 'below'\"\n matSuffix>\n {{info.iconName || 'info'}}\n</mat-icon>\n", styles: [":host mat-icon{font-size:1.2em;width:1em;height:1em;opacity:.8;margin-right:0}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
353
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: InfoComponent, decorators: [{
354
- type: Component,
355
- args: [{ selector: 'crispr-info', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-icon\n *ngIf=\"info\"\n [matTooltip]=\"info.content\"\n [matTooltipPosition]=\"info.tooltipPosition || 'below'\"\n matSuffix>\n {{info.iconName || 'info'}}\n</mat-icon>\n", styles: [":host mat-icon{font-size:1.2em;width:1em;height:1em;opacity:.8;margin-right:0}\n"] }]
356
- }], propDecorators: { info: [{
357
- type: Input
358
- }] } });
359
- class InfoModule {
360
- }
361
- InfoModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: InfoModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
362
- InfoModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: InfoModule, declarations: [InfoComponent], imports: [CommonModule,
363
- MatIconModule,
364
- MatTooltipModule], exports: [InfoComponent] });
365
- InfoModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: InfoModule, imports: [CommonModule,
366
- MatIconModule,
367
- MatTooltipModule] });
368
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: InfoModule, decorators: [{
369
- type: NgModule,
370
- args: [{
371
- imports: [
372
- CommonModule,
373
- MatIconModule,
374
- MatTooltipModule
375
- ],
376
- exports: [
377
- InfoComponent
378
- ],
379
- declarations: [
380
- InfoComponent
381
- ]
382
- }]
383
- }] });
384
-
385
- const defaultConfig$8 = {
386
- typographyClass: 'mat-h3'
387
- };
388
- class HeadingComponent extends CrisprFieldComponent {
389
- constructor() {
390
- super(...arguments);
391
- this.defaultConfig = defaultConfig$8;
392
- }
393
- }
394
- HeadingComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: HeadingComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
395
- HeadingComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: HeadingComponent, selector: "crispr-heading", inputs: { config: "config" }, usesInheritance: true, ngImport: i0, template: " <label\n *ngIf=\"!!config?.label\"\n [ngClass]=\"config.typographyClass\">\n {{ config.label }}\n <crispr-info\n *ngIf=\"config.info\"\n matSuffix\n [info]=\"config.info\">\n </crispr-info>\n </label>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.MatSuffix, selector: "[matSuffix]" }, { kind: "component", type: InfoComponent, selector: "crispr-info", inputs: ["info"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
396
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: HeadingComponent, decorators: [{
397
- type: Component,
398
- args: [{ selector: 'crispr-heading', changeDetection: ChangeDetectionStrategy.OnPush, template: " <label\n *ngIf=\"!!config?.label\"\n [ngClass]=\"config.typographyClass\">\n {{ config.label }}\n <crispr-info\n *ngIf=\"config.info\"\n matSuffix\n [info]=\"config.info\">\n </crispr-info>\n </label>\n", styles: [":host{display:block}\n"] }]
399
- }], propDecorators: { config: [{
400
- type: Input
401
- }] } });
402
- class HeadingModule {
403
- }
404
- HeadingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: HeadingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
405
- HeadingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: HeadingModule, declarations: [HeadingComponent], imports: [CommonModule,
406
- MatFormFieldModule,
407
- InfoModule], exports: [HeadingComponent] });
408
- HeadingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: HeadingModule, imports: [CommonModule,
409
- MatFormFieldModule,
410
- InfoModule] });
411
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: HeadingModule, decorators: [{
412
- type: NgModule,
413
- args: [{
414
- imports: [
415
- CommonModule,
416
- MatFormFieldModule,
417
- InfoModule
418
- ],
419
- exports: [
420
- HeadingComponent
421
- ],
422
- declarations: [
423
- HeadingComponent
424
- ]
425
- }]
426
- }] });
427
-
428
- class FieldContainerComponent {
429
- constructor() {
430
- // boolean whether field-container is inline
431
- this.inlineField = false;
432
- this.subs = [];
433
- }
434
- ngOnInit() {
435
- this.disabled$ = this.connectDisabledCallback(this.group, this.config);
436
- // we tried moving this into afterViewChecked and afterContentChecked lifecycle hooks without any luck
437
- if (this.config.computeValue) {
438
- this.subs.push(this.config.computeValue(this.group).pipe(distinctUntilChanged(), tap(computedValue => this.group.get(this.config.controlName).setValue(computedValue))).subscribe());
439
- }
440
- else if (this.config.computeFieldConfig) {
441
- console.warn(`computeFieldConfig property is deprecated, please use computeValue. Example here: https://stackblitz.com/github/nayfin/tft-documentation?file=src%2Fapp%2Fcrispr-forms-demo%2Ffeatures%2Fcomputed-field%2Fcomputed-field.component.ts`);
442
- this.subs.push(computeValueFromFields(this.group, this.config.computeFieldConfig).pipe(distinctUntilChanged(), tap(computedValue => this.group.get(this.config.controlName).setValue(computedValue))).subscribe());
443
- }
444
- }
445
- ngOnDestroy() {
446
- this.subs.forEach(sub => sub.unsubscribe);
447
- }
448
- /**
449
- * Connects user defined disabledCallback function to the the view, so that the control is enabled/disabled
450
- * appropriately. It also will hide disabled fields in the UI unless `hideDisabled` is set to
451
- * false in the controls config
452
- * @param group used to get valueChanges from control
453
- * @param config configuration object used to
454
- */
455
- connectDisabledCallback(group, config = null) {
456
- const control = group.get(config.controlName);
457
- // If the disabled$ function exists on the field config then call it with the disabledCallbackConfig
458
- // as a parameter otherwise return an observable of true.
459
- return (config === null || config === void 0 ? void 0 : config.disabledCallback) && config.disabledCallback instanceof Function
460
- ? config.disabledCallback(group, config.disabledCallbackConfig || null).pipe(
461
- // This enables/disables when callback conditions are met
462
- tap((shouldDisable) => shouldDisable ? control.disable() : control.enable()))
463
- : of(false);
464
- }
465
- }
466
- FieldContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: FieldContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
467
- FieldContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: FieldContainerComponent, selector: "crispr-field-container", inputs: { config: "config", group: "group", inlineField: "inlineField" }, ngImport: i0, template: "<div\n *ngIf=\"(disabled$ | async) ? !config.hideDisabled : true\"\n [ngClass]=\"config.classes\"\n [class.inline-field]=\"inlineField\"\n class=\"field-container\">\n\n <crispr-heading\n *ngIf=\"config.heading\"\n [config]=\"config.heading\">\n </crispr-heading>\n\n <ng-content>\n </ng-content>\n\n</div>\n", styles: ["::ng-deep mat-form-field.mat-form-field{display:block;padding:.25em 0}.inline-field{display:inline-block}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: HeadingComponent, selector: "crispr-heading", inputs: ["config"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
468
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: FieldContainerComponent, decorators: [{
469
- type: Component,
470
- args: [{ selector: 'crispr-field-container', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n *ngIf=\"(disabled$ | async) ? !config.hideDisabled : true\"\n [ngClass]=\"config.classes\"\n [class.inline-field]=\"inlineField\"\n class=\"field-container\">\n\n <crispr-heading\n *ngIf=\"config.heading\"\n [config]=\"config.heading\">\n </crispr-heading>\n\n <ng-content>\n </ng-content>\n\n</div>\n", styles: ["::ng-deep mat-form-field.mat-form-field{display:block;padding:.25em 0}.inline-field{display:inline-block}\n"] }]
471
- }], propDecorators: { config: [{
472
- type: Input
473
- }], group: [{
474
- type: Input
475
- }], inlineField: [{
476
- type: Input
477
- }] } });
478
- class FieldContainerModule {
479
- }
480
- FieldContainerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: FieldContainerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
481
- FieldContainerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: FieldContainerModule, declarations: [FieldContainerComponent], imports: [CommonModule,
482
- HeadingModule], exports: [FieldContainerComponent] });
483
- FieldContainerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: FieldContainerModule, imports: [CommonModule,
484
- HeadingModule] });
485
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: FieldContainerModule, decorators: [{
486
- type: NgModule,
487
- args: [{
488
- imports: [
489
- CommonModule,
490
- HeadingModule,
491
- ],
492
- exports: [
493
- FieldContainerComponent
494
- ],
495
- declarations: [
496
- FieldContainerComponent
497
- ]
498
- }]
499
- }] });
500
-
501
- const InputFieldMixin = crisprControlMixin(CrisprFieldComponent);
502
- class InputFieldComponent extends InputFieldMixin {
503
- constructor() {
504
- super();
505
- this.defaultConfig = { inputType: 'text' };
506
- }
507
- ngOnInit() {
508
- super.ngOnInit();
509
- }
510
- }
511
- InputFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: InputFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
512
- InputFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: InputFieldComponent, selector: "crispr-input-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>\n {{config.label}}\n </mat-label>\n <input\n [type]=\"config.inputType\"\n matInput\n [placeholder]=\"config.placeholder\"\n [formControlName]=\"config.controlName\"\n [min]=\"config.min\"\n [max]=\"config.max\"\n [maxlength]=\"config.maxLength\"\n [step]=\"config.step\"\n [autofocus]=\"config.autofocus\"\n [pattern]=\"config.pattern\"\n [spellcheck]=\"config.spellcheck\"\n [autocomplete]=\"config.autoComplete\"\n [autocapitalize]=\"config.autoCapitalize\">\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\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n\n\n</crispr-field-container>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: InfoComponent, selector: "crispr-info", inputs: ["info"] }, { kind: "directive", type: i4.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: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i4.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { kind: "component", type: i5.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i5.MatLabel, selector: "mat-label" }, { kind: "directive", type: i5.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i6.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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
513
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: InputFieldComponent, decorators: [{
514
- type: Component,
515
- args: [{ selector: 'crispr-input-field', changeDetection: ChangeDetectionStrategy.OnPush, 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>\n {{config.label}}\n </mat-label>\n <input\n [type]=\"config.inputType\"\n matInput\n [placeholder]=\"config.placeholder\"\n [formControlName]=\"config.controlName\"\n [min]=\"config.min\"\n [max]=\"config.max\"\n [maxlength]=\"config.maxLength\"\n [step]=\"config.step\"\n [autofocus]=\"config.autofocus\"\n [pattern]=\"config.pattern\"\n [spellcheck]=\"config.spellcheck\"\n [autocomplete]=\"config.autoComplete\"\n [autocapitalize]=\"config.autoCapitalize\">\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\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n\n\n</crispr-field-container>\n" }]
516
- }], ctorParameters: function () { return []; } });
517
- class InputFieldModule {
518
- }
519
- InputFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: InputFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
520
- InputFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: InputFieldModule, declarations: [InputFieldComponent], imports: [CommonModule,
521
- InfoModule,
522
- ReactiveFormsModule,
523
- FieldContainerModule,
524
- MatFormFieldModule,
525
- MatInputModule], exports: [InputFieldComponent] });
526
- InputFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: InputFieldModule, imports: [CommonModule,
527
- InfoModule,
528
- ReactiveFormsModule,
529
- FieldContainerModule,
530
- MatFormFieldModule,
531
- MatInputModule] });
532
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: InputFieldModule, decorators: [{
533
- type: NgModule,
534
- args: [{
535
- imports: [
536
- CommonModule,
537
- InfoModule,
538
- ReactiveFormsModule,
539
- FieldContainerModule,
540
- MatFormFieldModule,
541
- MatInputModule,
542
- ],
543
- exports: [
544
- InputFieldComponent
545
- ],
546
- declarations: [
547
- InputFieldComponent
548
- ]
549
- }]
550
- }] });
551
-
552
- const FIELD_COMPONENTS = {
553
- groupList: Promise.resolve().then(function () { return index$1; }).then(({ FormGroupListComponent }) => FormGroupListComponent),
554
- subGroup: Promise.resolve().then(function () { return index; }).then(({ SubGroupComponent }) => SubGroupComponent),
555
- button: Promise.resolve().then(function () { return index$2; }).then(({ ButtonComponent }) => ButtonComponent),
556
- input: Promise.resolve().then(function () { return index$2; }).then(({ InputFieldComponent }) => InputFieldComponent),
557
- select: Promise.resolve().then(function () { return index$2; }).then(({ SelectFieldComponent }) => SelectFieldComponent),
558
- radio: Promise.resolve().then(function () { return index$2; }).then(({ RadioFieldComponent }) => RadioFieldComponent),
559
- autocomplete: Promise.resolve().then(function () { return index$2; }).then(({ AutocompleteFieldComponent }) => AutocompleteFieldComponent),
560
- autocompleteChiplist: Promise.resolve().then(function () { return index$2; }).then(({ AutocompleteChiplistFieldComponent }) => AutocompleteChiplistFieldComponent),
561
- textarea: Promise.resolve().then(function () { return index$2; }).then(({ TextareaFieldComponent }) => TextareaFieldComponent),
562
- checkbox: Promise.resolve().then(function () { return index$2; }).then(({ CheckboxFieldComponent }) => CheckboxFieldComponent),
563
- slider: Promise.resolve().then(function () { return index$2; }).then(({ SliderFieldComponent }) => SliderFieldComponent),
564
- datepicker: Promise.resolve().then(function () { return index$2; }).then(({ DatepickerFieldComponent }) => DatepickerFieldComponent),
565
- fileUpload: Promise.resolve().then(function () { return index$2; }).then(({ FileUploadFieldComponent }) => FileUploadFieldComponent),
566
- imageUpload: Promise.resolve().then(function () { return index$2; }).then(({ ImageUploadFieldComponent }) => ImageUploadFieldComponent),
567
- heading: Promise.resolve().then(function () { return index$2; }).then(({ HeadingComponent }) => HeadingComponent),
568
- divider: Promise.resolve().then(function () { return index$2; }).then(({ DividerComponent }) => DividerComponent),
569
- unitConversion: Promise.resolve().then(function () { return index$2; }).then(({ UnitConversionFieldComponent }) => UnitConversionFieldComponent)
570
- };
571
- function isControlComponent(component) {
572
- return component && isControlConfig(component.config) && 'value' in component; // || component.config.controlType === ControlType.BUTTON;
573
- }
574
- function isControlOrButtonComponent(component) {
575
- return isControlComponent(component) || component.config.controlType === ControlType.BUTTON;
576
- }
577
-
578
- class CrisprFieldDirective {
579
- constructor(container, renderer, cdr) {
580
- this.container = container;
581
- this.renderer = renderer;
582
- this.cdr = cdr;
583
- }
584
- set value(value) {
585
- this._value = value;
586
- // This is needed to keep the group list from resetting control values to the initial input value
587
- this.updateComponentValue(value);
588
- }
589
- ;
590
- get value() {
591
- return this._value;
592
- }
593
- ngOnInit() {
594
- return __awaiter(this, void 0, void 0, function* () {
595
- /**
596
- * create component and set values from config on its instance
597
- */
598
- const component = this.config.component || (yield FIELD_COMPONENTS[this.config.controlType]);
599
- const componentRef = this.container.createComponent(component);
600
- this.component = componentRef.instance;
601
- this.component.config = this.config;
602
- if (isControlOrButtonComponent(this.component)) {
603
- this.component.group = this.group;
604
- }
605
- this.updateComponentValue(this.value);
606
- // adds any config classes to the dynamically generated component
607
- // doing this here keeps us from having to extend a base component into each field component individually
608
- if (!this.config.classes)
609
- return;
610
- this.config.classes.forEach((klass) => {
611
- // check for passing multiple classes in one array element
612
- if (klass.includes(' ')) {
613
- throw Error(`Improperly formatted class. '${klass}' cannot contain spaces.`);
614
- }
615
- else {
616
- this.renderer.addClass(componentRef.location.nativeElement, klass);
617
- }
618
- });
619
- });
620
- }
621
- updateComponentValue(value) {
622
- if (isControlComponent(this.component)) {
623
- this.component.value = value;
624
- // SubGroups won't populate without this detectChanges
625
- this.cdr.detectChanges();
626
- }
627
- }
628
- }
629
- CrisprFieldDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprFieldDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
630
- CrisprFieldDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.1", type: CrisprFieldDirective, selector: "[crisprField]", inputs: { config: "config", group: "group", value: "value" }, ngImport: i0 });
631
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprFieldDirective, decorators: [{
632
- type: Directive,
633
- args: [{
634
- selector: '[crisprField]'
635
- }]
636
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { config: [{
637
- type: Input
638
- }], group: [{
639
- type: Input
640
- }], value: [{
641
- type: Input
642
- }] } });
643
- class CrisprFieldModule {
644
- }
645
- CrisprFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
646
- CrisprFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: CrisprFieldModule, declarations: [CrisprFieldDirective], imports: [CommonModule], exports: [CrisprFieldDirective] });
647
- CrisprFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprFieldModule, imports: [CommonModule] });
648
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprFieldModule, decorators: [{
649
- type: NgModule,
650
- args: [{
651
- imports: [
652
- CommonModule,
653
- ],
654
- exports: [
655
- CrisprFieldDirective
656
- ],
657
- declarations: [
658
- CrisprFieldDirective
659
- ]
660
- }]
661
- }] });
662
-
663
- class OptionComponent {
664
- }
665
- OptionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: OptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
666
- OptionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: OptionComponent, selector: "crispr-option", inputs: { option: "option" }, ngImport: i0, template: "<div>\n <img\n *ngIf=\"option.imageUrl\"\n [src]=\"option.imageUrl\"\n alt=\"image of {{option.label}}\"\n style=\"vertical-align:middle;\"\n aria-hidden\n height=\"25\"/>\n {{option.label}}\n</div>\n\n<crispr-info *ngIf=\"option.info as info\" [info]=\"info\">\n\n</crispr-info>\n", styles: [":host{display:flex;justify-content:space-between}:host img{margin-right:4px}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: InfoComponent, selector: "crispr-info", inputs: ["info"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
667
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: OptionComponent, decorators: [{
668
- type: Component,
669
- args: [{ selector: 'crispr-option', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div>\n <img\n *ngIf=\"option.imageUrl\"\n [src]=\"option.imageUrl\"\n alt=\"image of {{option.label}}\"\n style=\"vertical-align:middle;\"\n aria-hidden\n height=\"25\"/>\n {{option.label}}\n</div>\n\n<crispr-info *ngIf=\"option.info as info\" [info]=\"info\">\n\n</crispr-info>\n", styles: [":host{display:flex;justify-content:space-between}:host img{margin-right:4px}\n"] }]
670
- }], propDecorators: { option: [{
671
- type: Input
672
- }] } });
673
- class OptionModule {
674
- }
675
- OptionModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: OptionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
676
- OptionModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: OptionModule, declarations: [OptionComponent], imports: [CommonModule,
677
- InfoModule], exports: [OptionComponent] });
678
- OptionModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: OptionModule, imports: [CommonModule,
679
- InfoModule] });
680
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: OptionModule, decorators: [{
681
- type: NgModule,
682
- args: [{
683
- imports: [
684
- CommonModule,
685
- InfoModule,
686
- ],
687
- exports: [
688
- OptionComponent
689
- ],
690
- declarations: [
691
- OptionComponent
692
- ]
693
- }]
694
- }] });
695
-
696
- const SelectFieldMixin = crisprControlMixin(CrisprFieldComponent);
697
- class SelectFieldComponent extends SelectFieldMixin {
698
- constructor() {
699
- super(...arguments);
700
- this.defaultConfig = {
701
- enableToggleAll: false,
702
- color: 'primary'
703
- };
704
- this.allSelected = false;
705
- }
706
- ngOnInit() {
707
- super.ngOnInit();
708
- // options$ can be passed as an array, promise that resolves array, or observable that resolves array
709
- // this functions accounts for all possibilities and converts to observable that resolves array
710
- this.options$ = observablifyOptions(this.config.options, this.group);
711
- }
712
- ngAfterViewInit() {
713
- var _a, _b;
714
- if (this.config.multiple
715
- && this.config.enableToggleAll
716
- && ((_a = this.selectField.options) === null || _a === void 0 ? void 0 : _a.length) === ((_b = this.value) === null || _b === void 0 ? void 0 : _b.length)) {
717
- this.allSelected = true;
718
- }
719
- }
720
- toggleAll(isSelected) {
721
- if (isSelected) {
722
- this.selectField.options.forEach(option => option.deselect());
723
- }
724
- else {
725
- this.selectField.options.forEach(option => option.select());
726
- }
727
- this.allSelected = !this.allSelected;
728
- }
729
- }
730
- SelectFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: SelectFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
731
- SelectFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: SelectFieldComponent, selector: "crispr-select-field", viewQueries: [{ propertyName: "selectField", first: true, predicate: ["selectField"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n\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 <mat-select\n #selectField\n [formControlName]=\"config.controlName\"\n [placeholder]=\"config.placeholder\"\n [multiple]=\"config.multiple\">\n\n <mat-checkbox\n [color]=\"config.color\"\n [checked]=\"allSelected\"\n *ngIf=\"config?.multiple && config.enableToggleAll\"\n (click)=\"toggleAll(allSelected)\">\n Select All\n </mat-checkbox>\n <mat-option\n *ngFor=\"let option of options$ | async\"\n [value]=\"option.value\">\n <crispr-option [option]=\"option\">\n </crispr-option>\n </mat-option>\n\n </mat-select>\n\n <span *ngIf=\"config.fieldSuffix\" matSuffix>{{config.fieldSuffix}}</span>\n <crispr-info\n *ngIf=\"config.info\"\n matSuffix\n [info]=\"config.info\">\n </crispr-info>\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: ["mat-checkbox{display:block;padding:16px}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: InfoComponent, selector: "crispr-info", inputs: ["info"] }, { kind: "component", type: OptionComponent, selector: "crispr-option", inputs: ["option"] }, { kind: "component", type: i4$1.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "component", type: i5.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i5.MatLabel, selector: "mat-label" }, { kind: "directive", type: i5.MatSuffix, selector: "[matSuffix]" }, { kind: "component", type: i6$1.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i7.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
732
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: SelectFieldComponent, decorators: [{
733
- type: Component,
734
- args: [{ selector: 'crispr-select-field', changeDetection: ChangeDetectionStrategy.OnPush, template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n\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 <mat-select\n #selectField\n [formControlName]=\"config.controlName\"\n [placeholder]=\"config.placeholder\"\n [multiple]=\"config.multiple\">\n\n <mat-checkbox\n [color]=\"config.color\"\n [checked]=\"allSelected\"\n *ngIf=\"config?.multiple && config.enableToggleAll\"\n (click)=\"toggleAll(allSelected)\">\n Select All\n </mat-checkbox>\n <mat-option\n *ngFor=\"let option of options$ | async\"\n [value]=\"option.value\">\n <crispr-option [option]=\"option\">\n </crispr-option>\n </mat-option>\n\n </mat-select>\n\n <span *ngIf=\"config.fieldSuffix\" matSuffix>{{config.fieldSuffix}}</span>\n <crispr-info\n *ngIf=\"config.info\"\n matSuffix\n [info]=\"config.info\">\n </crispr-info>\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: ["mat-checkbox{display:block;padding:16px}\n"] }]
735
- }], propDecorators: { selectField: [{
736
- type: ViewChild,
737
- args: ['selectField']
738
- }] } });
739
- class SelectFieldModule {
740
- }
741
- SelectFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: SelectFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
742
- SelectFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: SelectFieldModule, declarations: [SelectFieldComponent], imports: [CommonModule,
743
- InfoModule,
744
- OptionModule,
745
- MatCheckboxModule,
746
- MatSelectModule,
747
- ReactiveFormsModule,
748
- CrisprFieldModule,
749
- FieldContainerModule,
750
- MatFormFieldModule], exports: [SelectFieldComponent] });
751
- SelectFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: SelectFieldModule, imports: [CommonModule,
752
- InfoModule,
753
- OptionModule,
754
- MatCheckboxModule,
755
- MatSelectModule,
756
- ReactiveFormsModule,
757
- CrisprFieldModule,
758
- FieldContainerModule,
759
- MatFormFieldModule] });
760
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: SelectFieldModule, decorators: [{
761
- type: NgModule,
762
- args: [{
763
- imports: [
764
- CommonModule,
765
- InfoModule,
766
- OptionModule,
767
- MatCheckboxModule,
768
- MatSelectModule,
769
- ReactiveFormsModule,
770
- CrisprFieldModule,
771
- FieldContainerModule,
772
- MatFormFieldModule,
773
- ],
774
- exports: [
775
- SelectFieldComponent
776
- ],
777
- declarations: [
778
- SelectFieldComponent
779
- ]
780
- }]
781
- }] });
782
-
783
- const defaultConfig$7 = {
784
- autoActiveFirstOption: true,
785
- typeDebounceTime: 500,
786
- emptyOptionsMessage: DEFAULT_EMPTY_OPTIONS_MESSAGE
787
- };
788
- class AutocompleteFieldComponent extends AbstractAutocompleteComponent {
789
- constructor() {
790
- super(...arguments);
791
- this.defaultConfig = defaultConfig$7;
792
- }
793
- ngOnInit() {
794
- super.ngOnInit();
795
- this.clearFieldSubscription = this.autocompleteInputControl.valueChanges.subscribe((text) => {
796
- if (typeof text === 'string' && (text === null || text === void 0 ? void 0 : text.trim()) === '') {
797
- this.control.setValue(null);
798
- }
799
- });
800
- }
801
- ngOnDestroy() {
802
- this.clearFieldSubscription.unsubscribe();
803
- }
804
- setControlValue(value) {
805
- if (this.control && value) {
806
- // sets the initial value on the control if one is passed
807
- this.control.setValue(value.value || '');
808
- this.autocompleteInputControl.setValue(value.label || '');
809
- }
810
- }
811
- /**
812
- * The material autocomplete defaults to displaying the options value instead of its label.
813
- * We only have the value from the selected option to work with, so we have to pass the options
814
- * through a function called in the template and return the function that the material displayWith
815
- * input is expecting.
816
- * @param options the array of options to search for option with corresponding value
817
- */
818
- displayLabel(options) {
819
- if (this.config.displayWith) {
820
- return this.config.displayWith(options);
821
- }
822
- return (value) => {
823
- var _a;
824
- const label = !!options && Array.isArray(options)
825
- ? (_a = options.find((option) => JSON.stringify(option.value) === JSON.stringify(value))) === null || _a === void 0 ? void 0 : _a.label : value;
826
- return label;
827
- };
828
- }
829
- handleSelect(event) {
830
- this.control.setValue(event.option.value);
831
- this.autoInputRef.nativeElement.blur();
832
- }
833
- }
834
- AutocompleteFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: AutocompleteFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
835
- AutocompleteFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: AutocompleteFieldComponent, selector: "crispr-autocomplete-field", viewQueries: [{ propertyName: "autoInput", first: true, predicate: ["autoInput"], descendants: true, read: MatAutocompleteTrigger }, { propertyName: "autoInputRef", first: true, predicate: ["autoInput"], descendants: true }], usesInheritance: true, ngImport: i0, template: "\n<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n\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\n <input class=\"hidden-error-directive-anchor\" [formControlName]=\"config.controlName\" type=\"text\"/>\n\n <input\n matInput\n [formControl]=\"autocompleteInputControl\"\n [placeholder]=\"config.placeholder\"\n [matAutocomplete]=\"auto\"\n role=\"textbox\"\n type=\"textbox\"\n autocapitalize=\"off\"\n autocorrect=\"off\"\n spellcheck=\"false\"\n #autoInput>\n\n <span *ngIf=\"config.fieldSuffix\" matSuffix>{{config.fieldSuffix}}</span>\n <crispr-info\n *ngIf=\"config.info\"\n matSuffix\n [info]=\"config.info \">\n </crispr-info>\n\n <mat-autocomplete\n #auto=\"matAutocomplete\"\n [autoActiveFirstOption]=\"config.autoActiveFirstOption\"\n (optionSelected)=\"handleSelect($event)\"\n [displayWith]=\"displayLabel(options$ | async)\">\n\n <ng-container *ngIf=\"options$ | async as options; else emptyOption\">\n <ng-container *ngIf=\"options.length > 0; else emptyOption\">\n <mat-option\n *ngFor=\"let option of options\"\n [value]=\"option.value\">\n <crispr-option [option]=\"option\"></crispr-option>\n </mat-option>\n </ng-container>\n\n </ng-container>\n <ng-template #emptyOption>\n <mat-option disabled=\"true\">\n {{config.emptyOptionsMessage}}\n </mat-option>\n </ng-template>\n\n </mat-autocomplete>\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", styles: [".hidden-error-directive-anchor{display:none}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: InfoComponent, selector: "crispr-info", inputs: ["info"] }, { kind: "component", type: OptionComponent, selector: "crispr-option", inputs: ["option"] }, { kind: "directive", type: i4.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: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { kind: "component", type: i6$2.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i6$2.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { kind: "component", type: i7.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i5.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i5.MatLabel, selector: "mat-label" }, { kind: "directive", type: i5.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i6.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: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
836
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: AutocompleteFieldComponent, decorators: [{
837
- type: Component,
838
- args: [{ selector: 'crispr-autocomplete-field', changeDetection: ChangeDetectionStrategy.OnPush, template: "\n<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n\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\n <input class=\"hidden-error-directive-anchor\" [formControlName]=\"config.controlName\" type=\"text\"/>\n\n <input\n matInput\n [formControl]=\"autocompleteInputControl\"\n [placeholder]=\"config.placeholder\"\n [matAutocomplete]=\"auto\"\n role=\"textbox\"\n type=\"textbox\"\n autocapitalize=\"off\"\n autocorrect=\"off\"\n spellcheck=\"false\"\n #autoInput>\n\n <span *ngIf=\"config.fieldSuffix\" matSuffix>{{config.fieldSuffix}}</span>\n <crispr-info\n *ngIf=\"config.info\"\n matSuffix\n [info]=\"config.info \">\n </crispr-info>\n\n <mat-autocomplete\n #auto=\"matAutocomplete\"\n [autoActiveFirstOption]=\"config.autoActiveFirstOption\"\n (optionSelected)=\"handleSelect($event)\"\n [displayWith]=\"displayLabel(options$ | async)\">\n\n <ng-container *ngIf=\"options$ | async as options; else emptyOption\">\n <ng-container *ngIf=\"options.length > 0; else emptyOption\">\n <mat-option\n *ngFor=\"let option of options\"\n [value]=\"option.value\">\n <crispr-option [option]=\"option\"></crispr-option>\n </mat-option>\n </ng-container>\n\n </ng-container>\n <ng-template #emptyOption>\n <mat-option disabled=\"true\">\n {{config.emptyOptionsMessage}}\n </mat-option>\n </ng-template>\n\n </mat-autocomplete>\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", styles: [".hidden-error-directive-anchor{display:none}\n"] }]
839
- }], propDecorators: { autoInput: [{
840
- type: ViewChild,
841
- args: ['autoInput', { read: MatAutocompleteTrigger }]
842
- }], autoInputRef: [{
843
- type: ViewChild,
844
- args: ['autoInput']
845
- }] } });
846
- class AutocompleteFieldModule {
847
- }
848
- AutocompleteFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: AutocompleteFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
849
- AutocompleteFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: AutocompleteFieldModule, declarations: [AutocompleteFieldComponent], imports: [CommonModule,
850
- InfoModule,
851
- OptionModule,
852
- ReactiveFormsModule,
853
- FieldContainerModule,
854
- MatAutocompleteModule,
855
- MatInputModule,
856
- MatOptionModule], exports: [AutocompleteFieldComponent] });
857
- AutocompleteFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: AutocompleteFieldModule, imports: [CommonModule,
858
- InfoModule,
859
- OptionModule,
860
- ReactiveFormsModule,
861
- FieldContainerModule,
862
- MatAutocompleteModule,
863
- MatInputModule,
864
- MatOptionModule] });
865
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: AutocompleteFieldModule, decorators: [{
866
- type: NgModule,
867
- args: [{
868
- imports: [
869
- CommonModule,
870
- InfoModule,
871
- OptionModule,
872
- ReactiveFormsModule,
873
- FieldContainerModule,
874
- MatAutocompleteModule,
875
- MatInputModule,
876
- MatOptionModule,
877
- ],
878
- exports: [
879
- AutocompleteFieldComponent
880
- ],
881
- declarations: [
882
- AutocompleteFieldComponent
883
- ]
884
- }]
885
- }] });
886
-
887
- const defaultConfig$6 = {
888
- chipsSelectable: true,
889
- areChipsRemovable: true,
890
- tabToSelect: true,
891
- autoActiveFirstOption: true,
892
- imageUrlParam: 'image',
893
- typeDebounceTime: 500,
894
- allowDuplicates: false,
895
- duplicateCompareFunction: (chip, option) => chip.value === option.value,
896
- separatorKeyCodes: [ENTER],
897
- emptyOptionsMessage: DEFAULT_EMPTY_OPTIONS_MESSAGE,
898
- };
899
- class AutocompleteChiplistFieldComponent extends AbstractAutocompleteComponent {
900
- constructor() {
901
- super(...arguments);
902
- this.defaultConfig = defaultConfig$6;
903
- this.chips$ = new BehaviorSubject([]);
904
- this.controlValue$ = this.chips$.pipe(tap(chips => {
905
- this.control.setValue(chips.map(chip => chip.value));
906
- }));
907
- }
908
- ngOnInit() {
909
- super.ngOnInit();
910
- this.remainingOptions$ = combineLatest([
911
- this.chips$,
912
- this.options$
913
- ]).pipe(map(([chips, options]) => {
914
- return this.config.allowDuplicates
915
- ? options
916
- : options === null || options === void 0 ? void 0 : options.filter(option => {
917
- return !chips.some(chip => this.config.duplicateCompareFunction(chip, option));
918
- });
919
- }));
920
- }
921
- setControlValue(value) {
922
- if (value) {
923
- this.chips$.next(value);
924
- }
925
- }
926
- // handles mat selecting
927
- handleSelect(event) {
928
- const selectedOption = event.option.value;
929
- this.chips$.next([...this.chips$.value, selectedOption]);
930
- this.chipInputRef.nativeElement.value = '';
931
- this.autocompleteInputControl.setValue('');
932
- // setTimeout needed because the panel thinks it's still open at this point
933
- setTimeout(() => this.chipInput.openPanel());
934
- }
935
- /**
936
- * To follow ARIA standards we want to select the active option on blur.
937
- * matChipInputAddOnBlur should do this but it causes buggy behaviour
938
- * @param event blur event that triggers the handle blur
939
- */
940
- handleTab(_event) {
941
- if (this.chipInput.activeOption && (this.config.tabToSelect || this.config.addChipOnBlur)) {
942
- const chip = this.chipInput.activeOption.value;
943
- this.chips$.next([...this.chips$.value, chip]);
944
- }
945
- }
946
- /**
947
- * Handles selection via key tokens passed through separatorKeyCodes propert
948
- * NOTE: If TAB is used focus does not move on to next component
949
- * @param event
950
- */
951
- handleTokenEnd(event) {
952
- var _a;
953
- if (this.chipInput.activeOption) {
954
- this.chipInput.activeOption.select();
955
- }
956
- (_a = event.chipInput) === null || _a === void 0 ? void 0 : _a.clear();
957
- }
958
- mapToLabel(option) {
959
- return option ? option.label : '';
960
- }
961
- removeChip(removedChip) {
962
- const remainingChips = this.chips$.value.filter(chip => chip !== removedChip);
963
- this.chips$.next(remainingChips);
964
- }
965
- }
966
- AutocompleteChiplistFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: AutocompleteChiplistFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
967
- AutocompleteChiplistFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: AutocompleteChiplistFieldComponent, selector: "crispr-autocomplete-chiplist-field", viewQueries: [{ propertyName: "chipInput", first: true, predicate: ["autoInput"], descendants: true, read: MatAutocompleteTrigger }, { propertyName: "chipInputRef", first: true, predicate: ["autoInput"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n\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\n <mat-chip-list\n #chipList>\n <mat-chip\n class=\"refinement-chip\"\n *ngFor=\"let chip of controlValue$ | async\"\n [selectable]=\"config.chipsSelectable\"\n [removable]=\"config.areChipsRemovable\"\n (removed)=\"removeChip(chip)\">\n <span *ngIf=\"chip.imageUrl as imageUrl\" class=\"image-container\">\n <img [src]=\"imageUrl\" alt=\"image of {{chip.label}}\">\n </span>\n {{chip.label}}\n <mat-icon\n matChipRemove\n *ngIf=\"config.areChipsRemovable\">\n cancel\n </mat-icon>\n </mat-chip>\n <input class=\"hidden-error-directive-anchor\" [formControlName]=\"config.controlName\" type=\"text\"/>\n\n <input\n matInput\n [formControl]=\"autocompleteInputControl\"\n [placeholder]=\"config.placeholder\"\n [matChipInputFor]=\"chipList\"\n [matAutocomplete]=\"auto\"\n (keydown.tab)=\"handleTab($event)\"\n [matChipInputSeparatorKeyCodes]=\"config.separatorKeyCodes\"\n (matChipInputTokenEnd)=\"handleTokenEnd($event)\"\n role=\"searchbox\"\n type=\"text\"\n autocapitalize=\"off\"\n autocorrect=\"off\"\n spellcheck=\"false\"\n #autoInput/>\n <span *ngIf=\"config.fieldSuffix\" matSuffix>{{config.fieldSuffix}}</span>\n <crispr-info\n *ngIf=\"config.info\"\n matSuffix\n [info]=\"config.info \">\n </crispr-info>\n\n </mat-chip-list>\n <mat-autocomplete\n #auto=\"matAutocomplete\"\n [autoActiveFirstOption]=\"this.config.autoActiveFirstOption\"\n (optionSelected)=\"handleSelect($event)\"\n [displayWith]=\"mapToLabel\">\n <ng-container *ngIf=\"remainingOptions$ | async as remainingOptions; else emptyOption\">\n <ng-container *ngIf=\"remainingOptions.length > 0; else emptyOption\">\n <mat-option\n *ngFor=\"let option of remainingOptions$ | async\"\n [value]=\"option\">\n <crispr-option [option]=\"option\"></crispr-option>\n </mat-option>\n </ng-container>\n\n </ng-container>\n <ng-template #emptyOption>\n <mat-option disabled=\"true\">\n {{config.emptyOptionsMessage}}\n </mat-option>\n </ng-template>\n </mat-autocomplete>\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", styles: [".refinement-chip .image-container{width:26px;height:26px;border-radius:50%;overflow:hidden;margin:-2px 4px -2px -8px}.refinement-chip .image-container img{width:100%;height:100%;object-fit:cover}.hidden-error-directive-anchor{display:none}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: InfoComponent, selector: "crispr-info", inputs: ["info"] }, { kind: "component", type: OptionComponent, selector: "crispr-option", inputs: ["option"] }, { kind: "directive", type: i4.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: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { kind: "component", type: i6$2.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i6$2.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { kind: "component", type: i7.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i5.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i5.MatLabel, selector: "mat-label" }, { kind: "directive", type: i5.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i6.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: i10.MatChipList, selector: "mat-chip-list", inputs: ["role", "aria-describedby", "errorStateMatcher", "multiple", "compareWith", "value", "required", "placeholder", "disabled", "aria-orientation", "selectable", "tabIndex"], outputs: ["change", "valueChange"], exportAs: ["matChipList"] }, { kind: "directive", type: i10.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["color", "disableRipple", "tabIndex", "role", "selected", "value", "selectable", "disabled", "removable"], outputs: ["selectionChange", "destroyed", "removed"], exportAs: ["matChip"] }, { kind: "directive", type: i10.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: i10.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
968
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: AutocompleteChiplistFieldComponent, decorators: [{
969
- type: Component,
970
- args: [{ selector: 'crispr-autocomplete-chiplist-field', changeDetection: ChangeDetectionStrategy.OnPush, template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n\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\n <mat-chip-list\n #chipList>\n <mat-chip\n class=\"refinement-chip\"\n *ngFor=\"let chip of controlValue$ | async\"\n [selectable]=\"config.chipsSelectable\"\n [removable]=\"config.areChipsRemovable\"\n (removed)=\"removeChip(chip)\">\n <span *ngIf=\"chip.imageUrl as imageUrl\" class=\"image-container\">\n <img [src]=\"imageUrl\" alt=\"image of {{chip.label}}\">\n </span>\n {{chip.label}}\n <mat-icon\n matChipRemove\n *ngIf=\"config.areChipsRemovable\">\n cancel\n </mat-icon>\n </mat-chip>\n <input class=\"hidden-error-directive-anchor\" [formControlName]=\"config.controlName\" type=\"text\"/>\n\n <input\n matInput\n [formControl]=\"autocompleteInputControl\"\n [placeholder]=\"config.placeholder\"\n [matChipInputFor]=\"chipList\"\n [matAutocomplete]=\"auto\"\n (keydown.tab)=\"handleTab($event)\"\n [matChipInputSeparatorKeyCodes]=\"config.separatorKeyCodes\"\n (matChipInputTokenEnd)=\"handleTokenEnd($event)\"\n role=\"searchbox\"\n type=\"text\"\n autocapitalize=\"off\"\n autocorrect=\"off\"\n spellcheck=\"false\"\n #autoInput/>\n <span *ngIf=\"config.fieldSuffix\" matSuffix>{{config.fieldSuffix}}</span>\n <crispr-info\n *ngIf=\"config.info\"\n matSuffix\n [info]=\"config.info \">\n </crispr-info>\n\n </mat-chip-list>\n <mat-autocomplete\n #auto=\"matAutocomplete\"\n [autoActiveFirstOption]=\"this.config.autoActiveFirstOption\"\n (optionSelected)=\"handleSelect($event)\"\n [displayWith]=\"mapToLabel\">\n <ng-container *ngIf=\"remainingOptions$ | async as remainingOptions; else emptyOption\">\n <ng-container *ngIf=\"remainingOptions.length > 0; else emptyOption\">\n <mat-option\n *ngFor=\"let option of remainingOptions$ | async\"\n [value]=\"option\">\n <crispr-option [option]=\"option\"></crispr-option>\n </mat-option>\n </ng-container>\n\n </ng-container>\n <ng-template #emptyOption>\n <mat-option disabled=\"true\">\n {{config.emptyOptionsMessage}}\n </mat-option>\n </ng-template>\n </mat-autocomplete>\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", styles: [".refinement-chip .image-container{width:26px;height:26px;border-radius:50%;overflow:hidden;margin:-2px 4px -2px -8px}.refinement-chip .image-container img{width:100%;height:100%;object-fit:cover}.hidden-error-directive-anchor{display:none}\n"] }]
971
- }], propDecorators: { chipInput: [{
972
- type: ViewChild,
973
- args: ['autoInput', { read: MatAutocompleteTrigger }]
974
- }], chipInputRef: [{
975
- type: ViewChild,
976
- args: ['autoInput']
977
- }] } });
978
- class AutocompleteChiplistFieldModule {
979
- }
980
- AutocompleteChiplistFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: AutocompleteChiplistFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
981
- AutocompleteChiplistFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: AutocompleteChiplistFieldModule, declarations: [AutocompleteChiplistFieldComponent], imports: [CommonModule,
982
- InfoModule,
983
- OptionModule,
984
- ReactiveFormsModule,
985
- FieldContainerModule,
986
- MatAutocompleteModule,
987
- MatInputModule,
988
- MatOptionModule,
989
- MatChipsModule,
990
- MatIconModule], exports: [AutocompleteChiplistFieldComponent] });
991
- AutocompleteChiplistFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: AutocompleteChiplistFieldModule, imports: [CommonModule,
992
- InfoModule,
993
- OptionModule,
994
- ReactiveFormsModule,
995
- FieldContainerModule,
996
- MatAutocompleteModule,
997
- MatInputModule,
998
- MatOptionModule,
999
- MatChipsModule,
1000
- MatIconModule] });
1001
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: AutocompleteChiplistFieldModule, decorators: [{
1002
- type: NgModule,
1003
- args: [{
1004
- imports: [
1005
- CommonModule,
1006
- InfoModule,
1007
- OptionModule,
1008
- ReactiveFormsModule,
1009
- FieldContainerModule,
1010
- MatAutocompleteModule,
1011
- MatInputModule,
1012
- MatOptionModule,
1013
- MatChipsModule,
1014
- MatIconModule
1015
- ],
1016
- exports: [
1017
- AutocompleteChiplistFieldComponent
1018
- ],
1019
- declarations: [
1020
- AutocompleteChiplistFieldComponent
1021
- ]
1022
- }]
1023
- }] });
1024
-
1025
- const defaultConfig$5 = {
1026
- labelPosition: 'after',
1027
- inline: false
1028
- };
1029
- const CheckboxFieldMixin = crisprControlMixin(CrisprFieldComponent);
1030
- class CheckboxFieldComponent extends CheckboxFieldMixin {
1031
- constructor() {
1032
- super(...arguments);
1033
- this.defaultConfig = defaultConfig$5;
1034
- }
1035
- ngOnInit() {
1036
- super.ngOnInit();
1037
- }
1038
- }
1039
- CheckboxFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CheckboxFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1040
- CheckboxFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: CheckboxFieldComponent, selector: "crispr-checkbox-field", usesInheritance: true, ngImport: i0, template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\"\n [inlineField]=\"config.inline\">\n <div\n [formGroup]=\"group\">\n <mat-checkbox\n [color]=\"config.color\"\n [labelPosition]=\"config.labelPosition\"\n [formControlName]=\"config.controlName\">\n {{config.label}}\n <crispr-info\n matSuffix *ngIf=\"config.info\"\n [info]=\"config.info\">\n </crispr-info>\n </mat-checkbox>\n </div>\n</crispr-field-container>\n", styles: ["mat-checkbox{height:42px}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: InfoComponent, selector: "crispr-info", inputs: ["info"] }, { kind: "component", type: i4$1.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
1041
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CheckboxFieldComponent, decorators: [{
1042
- type: Component,
1043
- args: [{ selector: 'crispr-checkbox-field', changeDetection: ChangeDetectionStrategy.OnPush, template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\"\n [inlineField]=\"config.inline\">\n <div\n [formGroup]=\"group\">\n <mat-checkbox\n [color]=\"config.color\"\n [labelPosition]=\"config.labelPosition\"\n [formControlName]=\"config.controlName\">\n {{config.label}}\n <crispr-info\n matSuffix *ngIf=\"config.info\"\n [info]=\"config.info\">\n </crispr-info>\n </mat-checkbox>\n </div>\n</crispr-field-container>\n", styles: ["mat-checkbox{height:42px}\n"] }]
1044
- }] });
1045
- class CheckboxFieldModule {
1046
- }
1047
- CheckboxFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CheckboxFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1048
- CheckboxFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: CheckboxFieldModule, declarations: [CheckboxFieldComponent], imports: [CommonModule,
1049
- InfoModule,
1050
- MatCheckboxModule,
1051
- ReactiveFormsModule,
1052
- CrisprFieldModule,
1053
- FieldContainerModule], exports: [CheckboxFieldComponent] });
1054
- CheckboxFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CheckboxFieldModule, imports: [CommonModule,
1055
- InfoModule,
1056
- MatCheckboxModule,
1057
- ReactiveFormsModule,
1058
- CrisprFieldModule,
1059
- FieldContainerModule] });
1060
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CheckboxFieldModule, decorators: [{
1061
- type: NgModule,
1062
- args: [{
1063
- imports: [
1064
- CommonModule,
1065
- InfoModule,
1066
- MatCheckboxModule,
1067
- ReactiveFormsModule,
1068
- CrisprFieldModule,
1069
- FieldContainerModule
1070
- ],
1071
- exports: [
1072
- CheckboxFieldComponent
1073
- ],
1074
- declarations: [
1075
- CheckboxFieldComponent
1076
- ]
1077
- }]
1078
- }] });
1079
-
1080
- const defaultConfig$4 = { rows: 5 };
1081
- const TextareaFieldMixin = crisprControlMixin(CrisprFieldComponent);
1082
- class TextareaFieldComponent extends TextareaFieldMixin {
1083
- constructor() {
1084
- super(...arguments);
1085
- this.defaultConfig = defaultConfig$4;
1086
- }
1087
- ngOnInit() {
1088
- super.ngOnInit();
1089
- }
1090
- }
1091
- TextareaFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: TextareaFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1092
- TextareaFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: TextareaFieldComponent, selector: "crispr-textarea-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 <textarea\n [rows]=\"config.rows\"\n matInput\n [placeholder]=\"config.placeholder\"\n [formControlName]=\"config.controlName\">\n </textarea>\n <span *ngIf=\"config.fieldSuffix\" matSuffix>{{config.fieldSuffix}}</span>\n <crispr-info\n *ngIf=\"config.info\"\n matSuffix\n [info]=\"config.info\">\n </crispr-info>\n\n <mat-hint *ngIf=\"config.hint && control.valid\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n\n</crispr-field-container>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: InfoComponent, selector: "crispr-info", inputs: ["info"] }, { kind: "directive", type: i4.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: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { kind: "component", type: i5.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i5.MatLabel, selector: "mat-label" }, { kind: "directive", type: i5.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i6.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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
1093
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: TextareaFieldComponent, decorators: [{
1094
- type: Component,
1095
- args: [{ selector: 'crispr-textarea-field', changeDetection: ChangeDetectionStrategy.OnPush, 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 <textarea\n [rows]=\"config.rows\"\n matInput\n [placeholder]=\"config.placeholder\"\n [formControlName]=\"config.controlName\">\n </textarea>\n <span *ngIf=\"config.fieldSuffix\" matSuffix>{{config.fieldSuffix}}</span>\n <crispr-info\n *ngIf=\"config.info\"\n matSuffix\n [info]=\"config.info\">\n </crispr-info>\n\n <mat-hint *ngIf=\"config.hint && control.valid\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n\n</crispr-field-container>\n" }]
1096
- }] });
1097
- class TextareaFieldModule {
1098
- }
1099
- TextareaFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: TextareaFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1100
- TextareaFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: TextareaFieldModule, declarations: [TextareaFieldComponent], imports: [CommonModule,
1101
- InfoModule,
1102
- ReactiveFormsModule,
1103
- FieldContainerModule,
1104
- MatFormFieldModule,
1105
- MatInputModule], exports: [TextareaFieldComponent] });
1106
- TextareaFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: TextareaFieldModule, imports: [CommonModule,
1107
- InfoModule,
1108
- ReactiveFormsModule,
1109
- FieldContainerModule,
1110
- MatFormFieldModule,
1111
- MatInputModule] });
1112
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: TextareaFieldModule, decorators: [{
1113
- type: NgModule,
1114
- args: [{
1115
- imports: [
1116
- CommonModule,
1117
- InfoModule,
1118
- ReactiveFormsModule,
1119
- FieldContainerModule,
1120
- MatFormFieldModule,
1121
- MatInputModule,
1122
- ],
1123
- exports: [
1124
- TextareaFieldComponent
1125
- ],
1126
- declarations: [
1127
- TextareaFieldComponent
1128
- ]
1129
- }]
1130
- }] });
1131
-
1132
- const defaultConfig$3 = { displayLimits: true };
1133
- const SliderFieldMixin = crisprControlMixin(CrisprFieldComponent);
1134
- class SliderFieldComponent extends SliderFieldMixin {
1135
- constructor() {
1136
- super();
1137
- this.defaultConfig = defaultConfig$3;
1138
- }
1139
- get flexDirection() {
1140
- return this.config.vertical ? 'column' : 'row';
1141
- }
1142
- ngOnInit() {
1143
- super.ngOnInit();
1144
- }
1145
- }
1146
- SliderFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: SliderFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1147
- SliderFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: SliderFieldComponent, selector: "crispr-slider-field", usesInheritance: true, ngImport: i0, template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <div\n [formGroup]=\"group\">\n <label *ngIf=\"config.label\">\n {{config.label}}\n <crispr-info\n *ngIf=\"config.info\"\n [info]=\"config.info\">\n </crispr-info>\n </label>\n <div class=\"slider-container\"\n [ngStyle]=\"{'flex-direction': flexDirection}\">\n <span *ngIf=\"config.displayLimits\">\n {{config.min}}\n </span>\n <mat-slider\n class=\"example-margin\"\n [formControlName]=\"config.controlName\"\n [invert]=\"config.invert\"\n [max]=\"config.max\"\n [min]=\"config.min\"\n [step]=\"config.step\"\n [thumbLabel]=\"config.thumbLabel\"\n [tickInterval]=\"config.tickInterval\"\n [vertical]=\"config.vertical\">\n </mat-slider>\n <span *ngIf=\"config.displayLimits\">\n {{config.max}}\n </span>\n </div>\n\n </div>\n</crispr-field-container>\n\n", styles: [".slider-container{display:flex;align-items:center}.slider-container .mat-slider-horizontal{width:100%}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: InfoComponent, selector: "crispr-info", inputs: ["info"] }, { kind: "component", type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i5$1.MatSlider, selector: "mat-slider", inputs: ["disabled", "color", "tabIndex", "invert", "max", "min", "step", "thumbLabel", "tickInterval", "value", "displayWith", "valueText", "vertical"], outputs: ["change", "input", "valueChange"], exportAs: ["matSlider"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
1148
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: SliderFieldComponent, decorators: [{
1149
- type: Component,
1150
- args: [{ selector: 'crispr-slider-field', changeDetection: ChangeDetectionStrategy.OnPush, template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <div\n [formGroup]=\"group\">\n <label *ngIf=\"config.label\">\n {{config.label}}\n <crispr-info\n *ngIf=\"config.info\"\n [info]=\"config.info\">\n </crispr-info>\n </label>\n <div class=\"slider-container\"\n [ngStyle]=\"{'flex-direction': flexDirection}\">\n <span *ngIf=\"config.displayLimits\">\n {{config.min}}\n </span>\n <mat-slider\n class=\"example-margin\"\n [formControlName]=\"config.controlName\"\n [invert]=\"config.invert\"\n [max]=\"config.max\"\n [min]=\"config.min\"\n [step]=\"config.step\"\n [thumbLabel]=\"config.thumbLabel\"\n [tickInterval]=\"config.tickInterval\"\n [vertical]=\"config.vertical\">\n </mat-slider>\n <span *ngIf=\"config.displayLimits\">\n {{config.max}}\n </span>\n </div>\n\n </div>\n</crispr-field-container>\n\n", styles: [".slider-container{display:flex;align-items:center}.slider-container .mat-slider-horizontal{width:100%}\n"] }]
1151
- }], ctorParameters: function () { return []; } });
1152
- class SliderFieldModule {
1153
- }
1154
- SliderFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: SliderFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1155
- SliderFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: SliderFieldModule, declarations: [SliderFieldComponent], imports: [CommonModule,
1156
- InfoModule,
1157
- OptionModule,
1158
- FieldContainerModule,
1159
- ReactiveFormsModule,
1160
- MatSliderModule], exports: [SliderFieldComponent] });
1161
- SliderFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: SliderFieldModule, imports: [CommonModule,
1162
- InfoModule,
1163
- OptionModule,
1164
- FieldContainerModule,
1165
- ReactiveFormsModule,
1166
- MatSliderModule] });
1167
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: SliderFieldModule, decorators: [{
1168
- type: NgModule,
1169
- args: [{
1170
- imports: [
1171
- CommonModule,
1172
- InfoModule,
1173
- OptionModule,
1174
- FieldContainerModule,
1175
- ReactiveFormsModule,
1176
- MatSliderModule
1177
- ],
1178
- exports: [
1179
- SliderFieldComponent
1180
- ],
1181
- declarations: [
1182
- SliderFieldComponent
1183
- ]
1184
- }]
1185
- }] });
1186
-
1187
- class ButtonComponent extends CrisprFieldComponent {
1188
- constructor() {
1189
- super(...arguments);
1190
- this.defaultConfig = { buttonType: 'raised', type: 'submit' };
1191
- }
1192
- get matButtonClass() {
1193
- return this.config.buttonType ? `mat-${this.config.buttonType}-button` : '';
1194
- }
1195
- ngOnInit() {
1196
- super.ngOnInit();
1197
- this.formValid$ = this.group.statusChanges.pipe(map(status => status === 'VALID'), startWith(this.group.valid));
1198
- }
1199
- handleClick(group, event) {
1200
- if (this.config.callback) {
1201
- this.config.callback(group, event);
1202
- }
1203
- }
1204
- }
1205
- ButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: ButtonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1206
- ButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: ButtonComponent, 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: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.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: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
1207
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: ButtonComponent, decorators: [{
1208
- type: Component,
1209
- args: [{ selector: 'crispr-button', changeDetection: ChangeDetectionStrategy.OnPush, 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" }]
1210
- }] });
1211
- class ButtonModule {
1212
- }
1213
- ButtonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: ButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1214
- ButtonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: ButtonModule, declarations: [ButtonComponent], imports: [CommonModule,
1215
- MatButtonModule,
1216
- MatIconModule,
1217
- MatTooltipModule,
1218
- ReactiveFormsModule], exports: [ButtonComponent] });
1219
- ButtonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: ButtonModule, imports: [CommonModule,
1220
- MatButtonModule,
1221
- MatIconModule,
1222
- MatTooltipModule,
1223
- ReactiveFormsModule] });
1224
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: ButtonModule, decorators: [{
1225
- type: NgModule,
1226
- args: [{
1227
- imports: [
1228
- CommonModule,
1229
- MatButtonModule,
1230
- MatIconModule,
1231
- MatTooltipModule,
1232
- ReactiveFormsModule,
1233
- ],
1234
- exports: [
1235
- ButtonComponent
1236
- ],
1237
- declarations: [
1238
- ButtonComponent
1239
- ]
1240
- }]
1241
- }] });
1242
-
1243
- const defaultConfig$2 = {
1244
- startView: 'month',
1245
- };
1246
- const DatepickerFieldMixin = crisprControlMixin(CrisprFieldComponent);
1247
- class DatepickerFieldComponent extends DatepickerFieldMixin {
1248
- constructor() {
1249
- super(...arguments);
1250
- this.defaultConfig = defaultConfig$2;
1251
- }
1252
- ngOnInit() {
1253
- var _a, _b;
1254
- super.ngOnInit();
1255
- this.startAt$ = this.config.startAt instanceof Date
1256
- ? of(this.config.startAt)
1257
- : this.config.startAt instanceof Function
1258
- ? this.config.startAt(this.group)
1259
- : of(null);
1260
- this.dateClass = ((_a = this.config) === null || _a === void 0 ? void 0 : _a.cellClassFunction) || null;
1261
- this.dateClass$ = this.config.dateClass ? (_b = this.config) === null || _b === void 0 ? void 0 : _b.dateClass(this.group) : of(() => '');
1262
- }
1263
- ngAfterContentInit() {
1264
- if (this.config.datepickerActions) {
1265
- this.calendarFooterPortal = new ComponentPortal(this.config.datepickerActions);
1266
- }
1267
- }
1268
- }
1269
- DatepickerFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DatepickerFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1270
- DatepickerFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: DatepickerFieldComponent, 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: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { kind: "component", type: i3$2.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i3$2.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i3$2.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "component", type: i3$2.MatDatepickerActions, selector: "mat-datepicker-actions, mat-date-range-picker-actions" }, { kind: "component", type: i5.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i5.MatLabel, selector: "mat-label" }, { kind: "directive", type: i5.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i4.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: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i6.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: "directive", type: i7$1.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
1271
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DatepickerFieldComponent, decorators: [{
1272
- type: Component,
1273
- args: [{ selector: 'crispr-datepicker-field', changeDetection: ChangeDetectionStrategy.OnPush, 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" }]
1274
- }] });
1275
- class DatepickerFieldModule {
1276
- }
1277
- DatepickerFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DatepickerFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1278
- DatepickerFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: DatepickerFieldModule, declarations: [DatepickerFieldComponent], imports: [CommonModule,
1279
- FieldContainerModule,
1280
- MatDatepickerModule,
1281
- MatFormFieldModule,
1282
- ReactiveFormsModule,
1283
- MatInputModule,
1284
- MatDateFnsModule,
1285
- PortalModule], exports: [DatepickerFieldComponent] });
1286
- DatepickerFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DatepickerFieldModule, imports: [CommonModule,
1287
- FieldContainerModule,
1288
- MatDatepickerModule,
1289
- MatFormFieldModule,
1290
- ReactiveFormsModule,
1291
- MatInputModule,
1292
- MatDateFnsModule,
1293
- PortalModule] });
1294
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DatepickerFieldModule, decorators: [{
1295
- type: NgModule,
1296
- args: [{
1297
- imports: [
1298
- CommonModule,
1299
- FieldContainerModule,
1300
- MatDatepickerModule,
1301
- MatFormFieldModule,
1302
- ReactiveFormsModule,
1303
- MatInputModule,
1304
- MatDateFnsModule,
1305
- PortalModule
1306
- ],
1307
- exports: [
1308
- DatepickerFieldComponent
1309
- ],
1310
- declarations: [
1311
- DatepickerFieldComponent
1312
- ]
1313
- }]
1314
- }] });
1315
-
1316
- class DividerComponent extends CrisprFieldComponent {
1317
- constructor() {
1318
- super(...arguments);
1319
- // TODO: pull in type after configs are better organized
1320
- this.defaultConfig = {};
1321
- }
1322
- ngOnInit() {
1323
- super.ngOnInit();
1324
- }
1325
- }
1326
- DividerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DividerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1327
- DividerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: DividerComponent, selector: "crispr-divider", usesInheritance: true, ngImport: i0, template: "<mat-divider [ngClass]=\"config.classes\"></mat-divider>", styles: [":host{display:block;padding:1em 0}::ng-deep .mat-divider.mat-divider-horizontal{position:relative}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: i2$1.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }], preserveWhitespaces: true });
1328
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DividerComponent, decorators: [{
1329
- type: Component,
1330
- args: [{ selector: 'crispr-divider', template: "<mat-divider [ngClass]=\"config.classes\"></mat-divider>", styles: [":host{display:block;padding:1em 0}::ng-deep .mat-divider.mat-divider-horizontal{position:relative}\n"] }]
1331
- }] });
1332
- class DividerModule {
1333
- }
1334
- DividerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DividerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1335
- DividerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: DividerModule, declarations: [DividerComponent], imports: [CommonModule,
1336
- MatDividerModule], exports: [DividerComponent] });
1337
- DividerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DividerModule, imports: [CommonModule,
1338
- MatDividerModule] });
1339
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DividerModule, decorators: [{
1340
- type: NgModule,
1341
- args: [{
1342
- imports: [
1343
- CommonModule,
1344
- MatDividerModule
1345
- ],
1346
- exports: [
1347
- DividerComponent
1348
- ],
1349
- declarations: [
1350
- DividerComponent
1351
- ]
1352
- }]
1353
- }] });
1354
-
1355
- const RadioFieldMixin = crisprControlMixin(CrisprFieldComponent);
1356
- class RadioFieldComponent extends RadioFieldMixin {
1357
- constructor() {
1358
- super(...arguments);
1359
- this.defaultConfig = {};
1360
- }
1361
- ngOnInit() {
1362
- super.ngOnInit();
1363
- // options$ can be passed as an array, promise that resolves array, or observable that resolves array
1364
- // this functions accounts for all possibilities and converts to observable that resolves array
1365
- this.options$ = observablifyOptions(this.config.options, this.group);
1366
- }
1367
- }
1368
- RadioFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RadioFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1369
- RadioFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: RadioFieldComponent, selector: "crispr-radio-field", usesInheritance: true, ngImport: i0, template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n\n <mat-radio-group\n [formControl]=\"control\"\n [color]=\"config.color\">\n <mat-radio-button class=\"example-radio-button\" *ngFor=\"let option of options$ | async\" [value]=\"option.value\">\n {{option.label}}\n </mat-radio-button>\n </mat-radio-group>\n</crispr-field-container>\n", styles: ["mat-radio-button{padding:12px}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { kind: "directive", type: i4$2.MatRadioGroup, selector: "mat-radio-group", exportAs: ["matRadioGroup"] }, { kind: "component", type: i4$2.MatRadioButton, selector: "mat-radio-button", inputs: ["disableRipple", "tabIndex"], exportAs: ["matRadioButton"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
1370
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RadioFieldComponent, decorators: [{
1371
- type: Component,
1372
- args: [{ selector: 'crispr-radio-field', changeDetection: ChangeDetectionStrategy.OnPush, template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n\n <mat-radio-group\n [formControl]=\"control\"\n [color]=\"config.color\">\n <mat-radio-button class=\"example-radio-button\" *ngFor=\"let option of options$ | async\" [value]=\"option.value\">\n {{option.label}}\n </mat-radio-button>\n </mat-radio-group>\n</crispr-field-container>\n", styles: ["mat-radio-button{padding:12px}\n"] }]
1373
- }] });
1374
- class RadioFieldModule {
1375
- }
1376
- RadioFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RadioFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1377
- RadioFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: RadioFieldModule, declarations: [RadioFieldComponent], imports: [CommonModule,
1378
- ReactiveFormsModule,
1379
- FieldContainerModule,
1380
- MatRadioModule], exports: [RadioFieldComponent] });
1381
- RadioFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RadioFieldModule, imports: [CommonModule,
1382
- ReactiveFormsModule,
1383
- FieldContainerModule,
1384
- MatRadioModule] });
1385
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RadioFieldModule, decorators: [{
1386
- type: NgModule,
1387
- args: [{
1388
- imports: [
1389
- CommonModule,
1390
- ReactiveFormsModule,
1391
- FieldContainerModule,
1392
- MatRadioModule,
1393
- ],
1394
- exports: [
1395
- RadioFieldComponent
1396
- ],
1397
- declarations: [
1398
- RadioFieldComponent
1399
- ]
1400
- }]
1401
- }] });
5
+ import * as i2 from '@angular/forms';
6
+ import { FormGroup, ReactiveFormsModule } from '@angular/forms';
7
+ import * as i3$1 from '@tft/form-validation-handler';
8
+ import { FormValidationHandlerModule } from '@tft/form-validation-handler';
9
+ import { __awaiter } from 'tslib';
10
+ import { isControlConfig, ControlType, buildFormGroupFromConfig, crisprControlMixin, CrisprFieldComponent, createControlForType } from '@tft/crispr-forms/utils';
11
+ export * from '@tft/crispr-forms/utils';
12
+ import * as i2$1 from '@angular/material/button';
13
+ import { MatButtonModule } from '@angular/material/button';
14
+ import * as i3$2 from '@angular/material/icon';
15
+ import { MatIconModule } from '@angular/material/icon';
16
+ import * as i3 from '@tft/crispr-forms/ui';
17
+ import { FieldContainerComponent } from '@tft/crispr-forms/ui';
18
+ export * from '@tft/crispr-forms/ui';
1402
19
 
1403
- const defaultConfig$1 = {};
1404
- const UnitConversionFieldMixin = crisprControlMixin(CrisprFieldComponent);
1405
- class UnitConversionFieldComponent extends UnitConversionFieldMixin {
1406
- constructor() {
1407
- super(...arguments);
1408
- this.defaultConfig = defaultConfig$1;
1409
- this.displayValueControl = new FormControl();
1410
- this.unitSelectControl = new FormControl();
1411
- }
1412
- ngOnInit() {
1413
- var _a, _b;
1414
- super.ngOnInit();
1415
- // TODO: Validators need work. validation is tricky because the input needs to be validated against but the validator will compare against the controls value
1416
- // this.displayValueControl.setValidators(this.config.validators);
1417
- const controlValuePipeline = [
1418
- this.displayValueControl.valueChanges.pipe(startWith(this.displayValueControl.value))
1419
- ];
1420
- // setup all required pieces when showing a field for selecting units
1421
- if (this.config.showUnitSelect) {
1422
- this.unitOptions$ = observablifyOptions(this.config.selectableUnits, this.group);
1423
- controlValuePipeline.push(this.unitSelectControl.valueChanges.pipe(startWith(((_a = this.config) === null || _a === void 0 ? void 0 : _a.initialDisplayUnit) || null)));
1424
- this.unitSelectControl.setValue(((_b = this.config) === null || _b === void 0 ? void 0 : _b.initialDisplayUnit) || null);
1425
- }
1426
- this.transformationSubscription = combineLatest(controlValuePipeline).subscribe(([displayValue, unitValue]) => {
1427
- const computedValue = this.config.storedValueConversion(displayValue, unitValue);
1428
- this.control.setValue(computedValue);
1429
- });
1430
- }
1431
- ngOnDestroy() {
1432
- this.transformationSubscription.unsubscribe();
1433
- }
1434
- setInitialDisplayValue(storedValue, unit) {
1435
- const initialDisplayValue = this.config.initialDisplayValueConversion(storedValue || null, unit);
1436
- this.displayValueControl.setValue(initialDisplayValue);
1437
- }
1438
- /**
1439
- * We override the 'setControlValue' we inherited from crisprControlMixin and add our custom logic,
1440
- * This function gets called onInit because were object oriented. it's so great, so great that I'm
1441
- * typing a paragraph to explain what the hell is going on...
1442
- * @param value the initial value for the control passed down from the form components input
1443
- */
1444
- setControlValue(value) {
1445
- var _a;
1446
- const initialUnitValue = this.config.showUnitSelect ? (_a = this.config) === null || _a === void 0 ? void 0 : _a.initialDisplayUnit : null;
1447
- this.setInitialDisplayValue(value, initialUnitValue);
1448
- }
1449
- }
1450
- UnitConversionFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: UnitConversionFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1451
- UnitConversionFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: UnitConversionFieldComponent, 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: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: InfoComponent, selector: "crispr-info", inputs: ["info"] }, { kind: "component", type: OptionComponent, selector: "crispr-option", inputs: ["option"] }, { kind: "directive", type: i4.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: i4.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i4.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { kind: "component", type: i5.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i5.MatLabel, selector: "mat-label" }, { kind: "directive", type: i5.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i6.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: i6$1.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i7.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
1452
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: UnitConversionFieldComponent, decorators: [{
1453
- type: Component,
1454
- args: [{ selector: 'crispr-unit-conversion-field', changeDetection: ChangeDetectionStrategy.OnPush, 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"] }]
1455
- }] });
1456
- class UnitConversionFieldModule {
20
+ const FIELD_COMPONENTS = {
21
+ groupList: () => Promise.resolve().then(function () { return index$1; }).then(({ FormGroupListComponent }) => FormGroupListComponent),
22
+ subGroup: () => Promise.resolve().then(function () { return index; }).then(({ SubGroupComponent }) => SubGroupComponent),
23
+ button: () => import('@tft/crispr-forms/ui/button').then(({ ButtonComponent }) => ButtonComponent),
24
+ input: () => import('@tft/crispr-forms/ui/input-field').then(({ InputFieldComponent }) => InputFieldComponent),
25
+ select: () => import('@tft/crispr-forms/ui/select-field').then(({ SelectFieldComponent }) => SelectFieldComponent),
26
+ radio: () => import('@tft/crispr-forms/ui/radio-field').then(({ RadioFieldComponent }) => RadioFieldComponent),
27
+ autocomplete: () => import('@tft/crispr-forms/ui/autocomplete-field').then(({ AutocompleteFieldComponent }) => AutocompleteFieldComponent),
28
+ autocompleteChiplist: () => import('@tft/crispr-forms/ui/autocomplete-chiplist-field').then(({ AutocompleteChiplistFieldComponent }) => AutocompleteChiplistFieldComponent),
29
+ textarea: () => import('@tft/crispr-forms/ui/textarea-field').then(({ TextareaFieldComponent }) => TextareaFieldComponent),
30
+ checkbox: () => import('@tft/crispr-forms/ui/checkbox-field').then(({ CheckboxFieldComponent }) => CheckboxFieldComponent),
31
+ slider: () => import('@tft/crispr-forms/ui/slider-field').then(({ SliderFieldComponent }) => SliderFieldComponent),
32
+ datepicker: () => import('@tft/crispr-forms/ui/datepicker-field').then(({ DatepickerFieldComponent }) => DatepickerFieldComponent),
33
+ fileUpload: () => import('@tft/crispr-forms/ui/file-upload-field').then(({ FileUploadFieldComponent }) => FileUploadFieldComponent),
34
+ imageUpload: () => import('@tft/crispr-forms/ui/image-upload-field').then(({ ImageUploadFieldComponent }) => ImageUploadFieldComponent),
35
+ heading: () => import('@tft/crispr-forms/ui').then(({ HeadingComponent }) => HeadingComponent),
36
+ divider: () => import('@tft/crispr-forms/ui/divider').then(({ DividerComponent }) => DividerComponent),
37
+ unitConversion: () => import('@tft/crispr-forms/ui/unit-conversion-field').then(({ UnitConversionFieldComponent }) => UnitConversionFieldComponent)
38
+ };
39
+ function isControlComponent(component) {
40
+ return component && isControlConfig(component.config) && 'value' in component; // || component.config.controlType === ControlType.BUTTON;
1457
41
  }
1458
- UnitConversionFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: UnitConversionFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1459
- UnitConversionFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: UnitConversionFieldModule, declarations: [UnitConversionFieldComponent], imports: [CommonModule,
1460
- InfoModule,
1461
- OptionModule,
1462
- ReactiveFormsModule,
1463
- FieldContainerModule,
1464
- MatInputModule,
1465
- MatSelectModule,
1466
- MatOptionModule], exports: [UnitConversionFieldComponent] });
1467
- UnitConversionFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: UnitConversionFieldModule, imports: [CommonModule,
1468
- InfoModule,
1469
- OptionModule,
1470
- ReactiveFormsModule,
1471
- FieldContainerModule,
1472
- MatInputModule,
1473
- MatSelectModule,
1474
- MatOptionModule] });
1475
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: UnitConversionFieldModule, decorators: [{
1476
- type: NgModule,
1477
- args: [{
1478
- imports: [
1479
- CommonModule,
1480
- InfoModule,
1481
- OptionModule,
1482
- ReactiveFormsModule,
1483
- FieldContainerModule,
1484
- MatInputModule,
1485
- MatSelectModule,
1486
- MatOptionModule,
1487
- ],
1488
- exports: [
1489
- UnitConversionFieldComponent
1490
- ],
1491
- declarations: [
1492
- UnitConversionFieldComponent
1493
- ]
1494
- }]
1495
- }] });
42
+ function isControlOrButtonComponent(component) {
43
+ return isControlComponent(component) || component.config.controlType === ControlType.BUTTON;
44
+ }
1496
45
 
1497
- class FileDropzoneDirective {
1498
- constructor() {
1499
- this.fileDrop = new EventEmitter();
1500
- this.crisprFileDropzone = true;
1501
- }
1502
- onDrop($event) {
1503
- if (this.crisprFileDropzone) {
1504
- $event.preventDefault();
1505
- this.fileDrop.emit($event.dataTransfer.files);
1506
- }
46
+ class CrisprFieldDirective {
47
+ constructor(container, renderer, cdr) {
48
+ this.container = container;
49
+ this.renderer = renderer;
50
+ this.cdr = cdr;
1507
51
  }
1508
- // Prevents DOM from trying to open file in browser
1509
- onDragOver($event) {
1510
- if (this.crisprFileDropzone) {
1511
- $event.preventDefault();
1512
- }
52
+ set value(value) {
53
+ this._value = value;
54
+ // This is needed to keep the group list from resetting control values to the initial input value
55
+ this.updateComponentValue(value);
1513
56
  }
1514
- }
1515
- FileDropzoneDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: FileDropzoneDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1516
- FileDropzoneDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.1", type: FileDropzoneDirective, selector: "[crisprFileDropzone]", inputs: { crisprFileDropzone: "crisprFileDropzone" }, outputs: { fileDrop: "fileDrop" }, host: { listeners: { "drop": "onDrop($event)", "dragover": "onDragOver($event)" } }, ngImport: i0 });
1517
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: FileDropzoneDirective, decorators: [{
1518
- type: Directive,
1519
- args: [{
1520
- selector: '[crisprFileDropzone]'
1521
- }]
1522
- }], propDecorators: { fileDrop: [{
1523
- type: Output
1524
- }], crisprFileDropzone: [{
1525
- type: Input
1526
- }], onDrop: [{
1527
- type: HostListener,
1528
- args: ['drop', ['$event']]
1529
- }], onDragOver: [{
1530
- type: HostListener,
1531
- args: ['dragover', ['$event']]
1532
- }] } });
1533
-
1534
- class SelectedFileComponent {
1535
- }
1536
- SelectedFileComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: SelectedFileComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1537
- SelectedFileComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: SelectedFileComponent, selector: "crispr-selected-file", inputs: { fileName: "fileName", progress: "progress", showProgress: "showProgress", color: "color" }, ngImport: i0, template: "<h3 class=\"mat-h3\">{{ fileName }}</h3>\n<mat-progress-bar\n *ngIf=\"showProgress\"\n mode=\"determinate\"\n [color]=\"color\"\n [value]=\"progress\">\n</mat-progress-bar>\n", styles: ["mat-progress-bar{margin-bottom:8px}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$2.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }], preserveWhitespaces: true });
1538
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: SelectedFileComponent, decorators: [{
1539
- type: Component,
1540
- args: [{ selector: 'crispr-selected-file', template: "<h3 class=\"mat-h3\">{{ fileName }}</h3>\n<mat-progress-bar\n *ngIf=\"showProgress\"\n mode=\"determinate\"\n [color]=\"color\"\n [value]=\"progress\">\n</mat-progress-bar>\n", styles: ["mat-progress-bar{margin-bottom:8px}\n"] }]
1541
- }], propDecorators: { fileName: [{
1542
- type: Input
1543
- }], progress: [{
1544
- type: Input
1545
- }], showProgress: [{
1546
- type: Input
1547
- }], color: [{
1548
- type: Input
1549
- }] } });
1550
- class SelectedFileModule {
1551
- }
1552
- SelectedFileModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: SelectedFileModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1553
- SelectedFileModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: SelectedFileModule, declarations: [SelectedFileComponent], imports: [CommonModule,
1554
- MatProgressBarModule], exports: [SelectedFileComponent] });
1555
- SelectedFileModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: SelectedFileModule, imports: [CommonModule,
1556
- MatProgressBarModule] });
1557
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: SelectedFileModule, decorators: [{
1558
- type: NgModule,
1559
- args: [{
1560
- imports: [
1561
- CommonModule,
1562
- MatProgressBarModule
1563
- ],
1564
- exports: [
1565
- SelectedFileComponent
1566
- ],
1567
- declarations: [
1568
- SelectedFileComponent
1569
- ]
1570
- }]
1571
- }] });
1572
-
1573
- const FileUploadFieldMixin = crisprControlMixin(CrisprFieldComponent);
1574
- class FileUploadFieldComponent extends FileUploadFieldMixin {
1575
- // ngControl: NgControl = null;
1576
- constructor(ngControl) {
1577
- super();
1578
- this.ngControl = ngControl;
1579
- this.defaultConfig = {
1580
- allowMultipleFiles: false,
1581
- acceptedTypes: '*.*',
1582
- dropZoneText: 'DROP FILE HERE',
1583
- selectFilesButtonType: 'button',
1584
- selectButtonText: 'SELECT',
1585
- showClearFilesButton: true,
1586
- clearFilesButtonText: 'CLEAR',
1587
- uploadButtonText: 'UPLOAD',
1588
- uploadButtonType: 'button',
1589
- showUploadProgress: false,
1590
- disableOnUpload: true
1591
- };
1592
- this.isUploaded = false;
1593
- this.fileProgress = [];
1594
- if (this.ngControl != null) {
1595
- // Setting the value accessor directly (instead of using
1596
- // the providers) to avoid running into a circular import.
1597
- ngControl.valueAccessor = this;
1598
- }
57
+ ;
58
+ get value() {
59
+ return this._value;
1599
60
  }
1600
61
  ngOnInit() {
1601
- super.ngOnInit();
1602
- this.disabled$ = this.config.disabledCallback
1603
- ? this.config.disabledCallback(this.group, this.config)
1604
- : of(false);
1605
- }
1606
- filesChanged(files) {
1607
- if (files && files.length > 0) {
1608
- this.selectedFiles = files;
1609
- this.control.patchValue(files);
1610
- }
1611
- }
1612
- uploadFiles() {
1613
- if (this.selectedFiles && this.config.uploadFiles) {
1614
- this.isUploaded = true;
1615
- this.config.uploadFiles(this.group, this.selectedFiles, this);
1616
- }
1617
- }
1618
- resetFileInput() {
1619
- this.fileInputRef.nativeElement.value = '';
1620
- this.control.patchValue(null);
1621
- this.isUploaded = false;
1622
- }
1623
- writeValue(value) {
1624
- // clear file input
1625
- // this.host.nativeElement.value = '';
1626
- // this.file = null;
1627
- }
1628
- registerOnChange(fn) {
1629
- this.onChange = fn;
1630
- }
1631
- registerOnTouched(fn) {
1632
- }
1633
- }
1634
- FileUploadFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: FileUploadFieldComponent, deps: [{ token: i4.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component });
1635
- FileUploadFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: FileUploadFieldComponent, 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-form-field .mat-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: "directive", type: i0.forwardRef(function () { return i1.NgForOf; }), selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i0.forwardRef(function () { return i1.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i0.forwardRef(function () { return FieldContainerComponent; }), selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { kind: "directive", type: i0.forwardRef(function () { return i4.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: i0.forwardRef(function () { return i4.NgControlStatus; }), selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i0.forwardRef(function () { return i4.NgControlStatusGroup; }), selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i0.forwardRef(function () { return i4.FormGroupDirective; }), selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i0.forwardRef(function () { return i4.FormControlName; }), selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i0.forwardRef(function () { return i3.MatIcon; }), selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i0.forwardRef(function () { return i2.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: "component", type: i0.forwardRef(function () { return i5.MatFormField; }), selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i0.forwardRef(function () { return i5.MatHint; }), selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i0.forwardRef(function () { return i5.MatLabel; }), selector: "mat-label" }, { kind: "directive", type: i0.forwardRef(function () { return i6.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: i0.forwardRef(function () { return SelectedFileComponent; }), selector: "crispr-selected-file", inputs: ["fileName", "progress", "showProgress", "color"] }, { kind: "directive", type: i0.forwardRef(function () { return i9.ControlErrorsDirective; }), selector: "[formControl], [formControlName]" }, { kind: "directive", type: i0.forwardRef(function () { return i9.ControlErrorContainerDirective; }), selector: "[controlErrorContainer], [formGroup]" }, { kind: "directive", type: i0.forwardRef(function () { return FileDropzoneDirective; }), selector: "[crisprFileDropzone]", inputs: ["crisprFileDropzone"], outputs: ["fileDrop"] }, { kind: "pipe", type: i0.forwardRef(function () { return i1.AsyncPipe; }), name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
1636
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: FileUploadFieldComponent, decorators: [{
1637
- type: Component,
1638
- args: [{ selector: 'crispr-file-upload-field', changeDetection: ChangeDetectionStrategy.OnPush, 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-form-field .mat-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"] }]
1639
- }], ctorParameters: function () {
1640
- return [{ type: i4.NgControl, decorators: [{
1641
- type: Optional
1642
- }, {
1643
- type: Self
1644
- }] }];
1645
- }, propDecorators: { fileInputRef: [{
1646
- type: ViewChild,
1647
- args: ['fileInput']
1648
- }] } });
1649
- class FileUploadFieldModule {
1650
- }
1651
- FileUploadFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: FileUploadFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1652
- FileUploadFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: FileUploadFieldModule, declarations: [FileUploadFieldComponent, FileDropzoneDirective], imports: [CommonModule,
1653
- FieldContainerModule,
1654
- ReactiveFormsModule,
1655
- MatIconModule,
1656
- MatButtonModule,
1657
- MatFormFieldModule,
1658
- MatInputModule,
1659
- SelectedFileModule,
1660
- FormValidationHandlerModule], exports: [FileUploadFieldComponent, FileDropzoneDirective] });
1661
- FileUploadFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: FileUploadFieldModule, imports: [CommonModule,
1662
- FieldContainerModule,
1663
- ReactiveFormsModule,
1664
- MatIconModule,
1665
- MatButtonModule,
1666
- MatFormFieldModule,
1667
- MatInputModule,
1668
- SelectedFileModule,
1669
- FormValidationHandlerModule] });
1670
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: FileUploadFieldModule, decorators: [{
1671
- type: NgModule,
1672
- args: [{
1673
- imports: [
1674
- CommonModule,
1675
- FieldContainerModule,
1676
- ReactiveFormsModule,
1677
- MatIconModule,
1678
- MatButtonModule,
1679
- MatFormFieldModule,
1680
- MatInputModule,
1681
- SelectedFileModule,
1682
- FormValidationHandlerModule,
1683
- ],
1684
- exports: [
1685
- FileUploadFieldComponent,
1686
- FileDropzoneDirective
1687
- ],
1688
- declarations: [
1689
- FileUploadFieldComponent,
1690
- FileDropzoneDirective
1691
- ]
1692
- }]
1693
- }] });
1694
-
1695
- function convertBytesToMb(bytes) {
1696
- return bytes / 1048576;
1697
- }
1698
-
1699
- const ImageUploadFieldMixin = crisprControlMixin(CrisprFieldComponent);
1700
- class ImageUploadFieldComponent extends ImageUploadFieldMixin {
1701
- constructor(ngControl, domSanitizer, cdr) {
1702
- super();
1703
- this.ngControl = ngControl;
1704
- this.domSanitizer = domSanitizer;
1705
- this.cdr = cdr;
1706
- this.defaultConfig = {
1707
- // allowMultipleFiles: false,
1708
- acceptedTypes: 'image/*',
1709
- dropZoneText: 'DROP FILE HERE',
1710
- selectFilesButtonType: 'button',
1711
- selectButtonText: 'SELECT',
1712
- showClearFilesButton: true,
1713
- clearFilesButtonText: 'CLEAR',
1714
- resetFilesButtonText: 'RESET',
1715
- imagePreviewHeight: '250px',
1716
- compressImage: false,
1717
- targetCompressedImageFileSizeMb: .4,
1718
- minCompressionThresholdMb: .6,
1719
- useWebWorker: true,
1720
- };
1721
- this.inputImageFileSubject = new Subject();
1722
- this.inputImageFile$ = this.inputImageFileSubject.asObservable().pipe(shareReplay(1));
1723
- this.compressedFile$ = this.inputImageFile$.pipe(switchMap((file) => __awaiter(this, void 0, void 0, function* () {
1724
- if (!file || !(file instanceof File))
1725
- return null;
1726
- const { compressImage, targetCompressedImageFileSizeMb, minCompressionThresholdMb, maxWidthOrHeight, useWebWorker } = this.config;
1727
- const fileSizeMb = convertBytesToMb(file.size);
1728
- const shouldCompress = compressImage
1729
- && targetCompressedImageFileSizeMb < fileSizeMb
1730
- && minCompressionThresholdMb < fileSizeMb;
1731
- if (shouldCompress) {
1732
- const options = Object.assign(Object.assign({}, (maxWidthOrHeight ? { maxWidthOrHeight } : { maxSizeMB: targetCompressedImageFileSizeMb })), { useWebWorker, maxIterations: 30, onProgress: (progress) => {
1733
- this.progress = progress;
1734
- this.cdr.detectChanges();
1735
- } });
1736
- return yield imageCompression(file, options);
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ /**
64
+ * create component and set values from config on its instance
65
+ */
66
+ const component = this.config.component || (yield FIELD_COMPONENTS[this.config.controlType]());
67
+ const componentRef = this.container.createComponent(component);
68
+ this.component = componentRef.instance;
69
+ this.component.config = this.config;
70
+ if (isControlOrButtonComponent(this.component)) {
71
+ this.component.group = this.group;
1737
72
  }
1738
- else
1739
- return file;
1740
- })), map((compressedFile) => {
1741
- if (!compressedFile)
1742
- return compressedFile;
1743
- const { type, name, lastModified } = compressedFile;
1744
- return new File([compressedFile], this.config.fileName || name, {
1745
- type,
1746
- lastModified
73
+ this.updateComponentValue(this.value);
74
+ // adds any config classes to the dynamically generated component
75
+ // doing this here keeps us from having to extend a base component into each field component individually
76
+ if (!this.config.classes)
77
+ return;
78
+ this.config.classes.forEach((klass) => {
79
+ // check for passing multiple classes in one array element
80
+ if (klass.includes(' ')) {
81
+ throw Error(`Improperly formatted class. '${klass}' cannot contain spaces.`);
82
+ }
83
+ else {
84
+ this.renderer.addClass(componentRef.location.nativeElement, klass);
85
+ }
1747
86
  });
1748
- }), tap(file => {
1749
- // only set the value if there is a file because resetToInitialValue sets the control value
1750
- // to initial value and clears the compressed image, so setting it to null here would undo that
1751
- if (file) {
1752
- this.control.setValue(file);
1753
- }
1754
- if (file || this.value) {
1755
- this.control.markAsTouched();
1756
- setTimeout(() => {
1757
- this.cdr.detectChanges();
1758
- }, 100);
1759
- }
1760
- }), shareReplay(1));
1761
- this.compressedImageUrlString$ = this.compressedFile$.pipe(switchMap((file) => __awaiter(this, void 0, void 0, function* () {
1762
- if (!file)
1763
- return null;
1764
- const compressedStringImage = yield imageCompression.getDataUrlFromFile(file);
1765
- return this.domSanitizer.bypassSecurityTrustResourceUrl(compressedStringImage);
1766
- })), shareReplay(1));
1767
- this.isUploaded = false;
1768
- if (this.ngControl != null) {
1769
- // Setting the value accessor directly (instead of using
1770
- // the providers) to avoid running into a circular import.
1771
- ngControl.valueAccessor = this;
1772
- }
1773
- }
1774
- ngOnInit() {
1775
- super.ngOnInit();
1776
- this.imageSrcUrl$ = combineLatest([
1777
- this.compressedImageUrlString$.pipe(startWith(null)),
1778
- this.control.valueChanges.pipe(startWith(this.value), map((controlValue) => {
1779
- var _a, _b;
1780
- if (!controlValue)
1781
- return null;
1782
- if (controlValue instanceof File)
1783
- return null;
1784
- return ((_b = (_a = this.config).mapInputValueToUrl) === null || _b === void 0 ? void 0 : _b.call(_a, controlValue)) || controlValue;
1785
- }))
1786
- ]).pipe(map(([compressedImageUrlString, controlUrl]) => {
1787
- return compressedImageUrlString || controlUrl || null;
1788
- }));
1789
- this.disabled$ = this.config.disabledCallback
1790
- ? this.config.disabledCallback(this.group, this.config)
1791
- : of(false);
87
+ });
1792
88
  }
1793
- filesChanged(files) {
1794
- if (files && files.length > 0) {
1795
- const imageFile = files[0];
1796
- // We clear the control here so that it is invalid while compressing
1797
- // the input pipeline will take care of resetting it
1798
- this.control.patchValue(null);
1799
- // this.control.setErrors({compressing: {loadingMessage: 'Please wait while file compresses'}});
1800
- this.control.markAsTouched();
1801
- this.inputImageFileSubject.next(imageFile);
89
+ updateComponentValue(value) {
90
+ if (isControlComponent(this.component)) {
91
+ this.component.value = value;
92
+ // SubGroups won't populate without this detectChanges
93
+ this.cdr.detectChanges();
1802
94
  }
1803
95
  }
1804
- clearFileInput() {
1805
- this.inputImageFileSubject.next(null);
1806
- this.fileInputRef.nativeElement.value = '';
1807
- this.control.patchValue(null);
1808
- this.control.markAsTouched();
1809
- this.isUploaded = false;
1810
- }
1811
- resetToInitialValue(initialValue) {
1812
- this.inputImageFileSubject.next(null);
1813
- this.control.patchValue(initialValue);
1814
- this.isUploaded = false;
1815
- }
1816
- writeValue(value) { }
1817
- registerOnChange(fn) {
1818
- this.onChange = fn;
1819
- }
1820
- registerOnTouched(fn) { }
1821
- }
1822
- ImageUploadFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: ImageUploadFieldComponent, deps: [{ token: i4.NgControl, optional: true, self: true }, { token: i2$3.DomSanitizer }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1823
- ImageUploadFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: ImageUploadFieldComponent, 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: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { kind: "directive", type: i4.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: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i2.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: "component", type: i5.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i5.MatLabel, selector: "mat-label" }, { kind: "directive", type: i6.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: "directive", type: i9.ControlErrorsDirective, selector: "[formControl], [formControlName]" }, { kind: "directive", type: i9.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
1824
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: ImageUploadFieldComponent, decorators: [{
1825
- type: Component,
1826
- args: [{ selector: 'crispr-image-upload-field', changeDetection: ChangeDetectionStrategy.OnPush, 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"] }]
1827
- }], ctorParameters: function () {
1828
- return [{ type: i4.NgControl, decorators: [{
1829
- type: Optional
1830
- }, {
1831
- type: Self
1832
- }] }, { type: i2$3.DomSanitizer }, { type: i0.ChangeDetectorRef }];
1833
- }, propDecorators: { fileInputRef: [{
1834
- type: ViewChild,
1835
- args: ['fileInput']
1836
- }] } });
1837
- class ImageUploadFieldModule {
1838
- }
1839
- ImageUploadFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: ImageUploadFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1840
- ImageUploadFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: ImageUploadFieldModule, declarations: [ImageUploadFieldComponent], imports: [CommonModule,
1841
- FieldContainerModule,
1842
- ReactiveFormsModule,
1843
- MatIconModule,
1844
- MatButtonModule,
1845
- MatFormFieldModule,
1846
- MatInputModule,
1847
- SelectedFileModule,
1848
- FileUploadFieldModule,
1849
- FormValidationHandlerModule], exports: [ImageUploadFieldComponent] });
1850
- ImageUploadFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: ImageUploadFieldModule, imports: [CommonModule,
1851
- FieldContainerModule,
1852
- ReactiveFormsModule,
1853
- MatIconModule,
1854
- MatButtonModule,
1855
- MatFormFieldModule,
1856
- MatInputModule,
1857
- SelectedFileModule,
1858
- FileUploadFieldModule,
1859
- FormValidationHandlerModule] });
1860
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: ImageUploadFieldModule, decorators: [{
1861
- type: NgModule,
1862
- args: [{
1863
- imports: [
1864
- CommonModule,
1865
- FieldContainerModule,
1866
- ReactiveFormsModule,
1867
- MatIconModule,
1868
- MatButtonModule,
1869
- MatFormFieldModule,
1870
- MatInputModule,
1871
- SelectedFileModule,
1872
- FileUploadFieldModule,
1873
- FormValidationHandlerModule
1874
- ],
1875
- exports: [
1876
- ImageUploadFieldComponent
1877
- ],
1878
- declarations: [
1879
- ImageUploadFieldComponent
1880
- ]
1881
- }]
1882
- }] });
1883
- function maxFileSizeValidator(maxFileSize) {
1884
- return (control) => {
1885
- const controlValue = control.value;
1886
- if (!(controlValue instanceof File)) {
1887
- return null;
1888
- }
1889
- const actualFileSize = +convertBytesToMb(controlValue.size).toPrecision(3);
1890
- if (maxFileSize > actualFileSize)
1891
- return null;
1892
- return { maxFileSize: { maxFileSize, actualFileSize } };
1893
- };
1894
- }
1895
- function allowedFileExtValidator(allowedFileExtensions, onlyAllowFiles = true) {
1896
- return (control) => {
1897
- const controlValue = control.value;
1898
- const isFile = controlValue instanceof File;
1899
- if (!onlyAllowFiles && !isFile)
1900
- return null;
1901
- const actualExtension = isFile ? controlValue.name.split('.').pop().toLocaleLowerCase() : 'Not a file';
1902
- const isAllowedExtension = allowedFileExtensions.includes(actualExtension);
1903
- if (isAllowedExtension) {
1904
- return null;
1905
- }
1906
- return { allowedExtension: { allowedFileExtensions, actualExtension } };
1907
- };
1908
- }
1909
- function allowedFileType(matchExp) {
1910
- return (formControl) => {
1911
- const value = formControl.value;
1912
- if (!(value instanceof File))
1913
- return null;
1914
- const type = value.type;
1915
- const matches = type.match(matchExp);
1916
- if (!type || !(matches === null || matches === void 0 ? void 0 : matches.length)) {
1917
- return {
1918
- allowedFileType: {
1919
- actualType: type,
1920
- allowedTypeExp: matchExp
1921
- }
1922
- };
1923
- }
1924
- else {
1925
- return null;
1926
- }
1927
- };
1928
- }
1929
-
1930
- // TODO: Should we import UI library?
1931
- // Will the tree shaker shake the unused modules?
1932
- class MaterialModule {
1933
96
  }
1934
- MaterialModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: MaterialModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1935
- MaterialModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: MaterialModule, imports: [CommonModule,
1936
- ReactiveFormsModule,
1937
- FormValidationHandlerModule,
1938
- InfoModule,
1939
- CheckboxFieldModule,
1940
- SelectFieldModule,
1941
- AutocompleteFieldModule,
1942
- AutocompleteChiplistFieldModule,
1943
- DatepickerFieldModule,
1944
- InputFieldModule,
1945
- FileUploadFieldModule,
1946
- RadioFieldModule,
1947
- SliderFieldModule,
1948
- TextareaFieldModule,
1949
- UnitConversionFieldModule,
1950
- ButtonModule,
1951
- DividerModule,
1952
- HeadingModule,
1953
- FieldContainerModule,
1954
- OptionModule] });
1955
- MaterialModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: MaterialModule, imports: [CommonModule,
1956
- ReactiveFormsModule,
1957
- FormValidationHandlerModule,
1958
- InfoModule,
1959
- CheckboxFieldModule,
1960
- SelectFieldModule,
1961
- AutocompleteFieldModule,
1962
- AutocompleteChiplistFieldModule,
1963
- DatepickerFieldModule,
1964
- InputFieldModule,
1965
- FileUploadFieldModule,
1966
- RadioFieldModule,
1967
- SliderFieldModule,
1968
- TextareaFieldModule,
1969
- UnitConversionFieldModule,
1970
- ButtonModule,
1971
- DividerModule,
1972
- HeadingModule,
1973
- FieldContainerModule,
1974
- OptionModule] });
1975
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: MaterialModule, decorators: [{
1976
- type: NgModule,
97
+ CrisprFieldDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprFieldDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
98
+ CrisprFieldDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.1", type: CrisprFieldDirective, isStandalone: true, selector: "[crisprField]", inputs: { config: "config", group: "group", value: "value" }, ngImport: i0 });
99
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprFieldDirective, decorators: [{
100
+ type: Directive,
1977
101
  args: [{
1978
- imports: [
1979
- CommonModule,
1980
- ReactiveFormsModule,
1981
- FormValidationHandlerModule,
1982
- InfoModule,
1983
- CheckboxFieldModule,
1984
- SelectFieldModule,
1985
- AutocompleteFieldModule,
1986
- AutocompleteChiplistFieldModule,
1987
- DatepickerFieldModule,
1988
- InputFieldModule,
1989
- FileUploadFieldModule,
1990
- RadioFieldModule,
1991
- SliderFieldModule,
1992
- TextareaFieldModule,
1993
- UnitConversionFieldModule,
1994
- ButtonModule,
1995
- DividerModule,
1996
- HeadingModule,
1997
- FieldContainerModule,
1998
- OptionModule,
1999
- ],
102
+ selector: '[crisprField]',
103
+ standalone: true
2000
104
  }]
2001
- }] });
2002
-
2003
- var index$2 = /*#__PURE__*/Object.freeze({
2004
- __proto__: null,
2005
- InputFieldComponent: InputFieldComponent,
2006
- InputFieldModule: InputFieldModule,
2007
- SelectFieldComponent: SelectFieldComponent,
2008
- SelectFieldModule: SelectFieldModule,
2009
- AutocompleteFieldComponent: AutocompleteFieldComponent,
2010
- AutocompleteFieldModule: AutocompleteFieldModule,
2011
- AutocompleteChiplistFieldComponent: AutocompleteChiplistFieldComponent,
2012
- AutocompleteChiplistFieldModule: AutocompleteChiplistFieldModule,
2013
- CheckboxFieldComponent: CheckboxFieldComponent,
2014
- CheckboxFieldModule: CheckboxFieldModule,
2015
- TextareaFieldComponent: TextareaFieldComponent,
2016
- TextareaFieldModule: TextareaFieldModule,
2017
- SliderFieldComponent: SliderFieldComponent,
2018
- SliderFieldModule: SliderFieldModule,
2019
- ButtonComponent: ButtonComponent,
2020
- ButtonModule: ButtonModule,
2021
- DatepickerFieldComponent: DatepickerFieldComponent,
2022
- DatepickerFieldModule: DatepickerFieldModule,
2023
- HeadingComponent: HeadingComponent,
2024
- HeadingModule: HeadingModule,
2025
- DividerComponent: DividerComponent,
2026
- DividerModule: DividerModule,
2027
- RadioFieldComponent: RadioFieldComponent,
2028
- RadioFieldModule: RadioFieldModule,
2029
- UnitConversionFieldComponent: UnitConversionFieldComponent,
2030
- UnitConversionFieldModule: UnitConversionFieldModule,
2031
- ImageUploadFieldComponent: ImageUploadFieldComponent,
2032
- ImageUploadFieldModule: ImageUploadFieldModule,
2033
- maxFileSizeValidator: maxFileSizeValidator,
2034
- allowedFileExtValidator: allowedFileExtValidator,
2035
- allowedFileType: allowedFileType,
2036
- FileDropzoneDirective: FileDropzoneDirective,
2037
- FileUploadFieldComponent: FileUploadFieldComponent,
2038
- FileUploadFieldModule: FileUploadFieldModule,
2039
- MaterialModule: MaterialModule,
2040
- OptionComponent: OptionComponent,
2041
- OptionModule: OptionModule
2042
- });
105
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { config: [{
106
+ type: Input
107
+ }], group: [{
108
+ type: Input
109
+ }], value: [{
110
+ type: Input
111
+ }] } });
2043
112
 
2044
113
  class InitialControlValuePipe {
2045
114
  // TODO: does changing any to unknown break anything?
@@ -2100,10 +169,16 @@ class CrisprFormComponent {
2100
169
  }
2101
170
  }
2102
171
  CrisprFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2103
- CrisprFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: CrisprFormComponent, selector: "crispr-form", inputs: { config: "config", form: "form", value: "value" }, outputs: { submitted: "submitted", valueChanges: "valueChanges", statusChanges: "statusChanges" }, viewQueries: [{ propertyName: "submitTrigger", first: true, predicate: ["submitTrigger"], descendants: true }], ngImport: i0, template: "<form\n class=\"crispr-form\"\n [ngClass]=\"config.classes\"\n [formGroup]=\"form\"\n (ngSubmit)=\"handleSubmit()\"\n [autocomplete]=\"config.autocomplete || 'off'\"\n [errorDictionary]=\"config.errorDictionary\"\n #ngFormElement=\"ngForm\">\n\n <ng-container\n *ngFor=\"let field of config.fields;\"\n crisprField\n [value]=\"value | initialControlValue : field\"\n [config]=\"field\"\n [group]=\"form\">\n </ng-container>\n <!-- Hidden button, programmatically clicked when crispr form triggerSubmit function called.\n Uses a hidden button with type=\"submit\" because it will trigger both native form submit event\n (which the error handler has to listen for) and ngSubmit event -->\n <button #submitTrigger class=\"submit-trigger\" type=\"submit\">\n </button>\n</form>\n", styles: [".submit-trigger{display:none}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: CrisprFieldDirective, selector: "[crisprField]", inputs: ["config", "group", "value"] }, { kind: "directive", type: i4.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i9.ControlErrorsFormDirective, selector: "form", inputs: ["errorDictionary"] }, { kind: "directive", type: i9.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }, { kind: "pipe", type: InitialControlValuePipe, name: "initialControlValue" }], preserveWhitespaces: true });
172
+ CrisprFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: CrisprFormComponent, isStandalone: true, selector: "crispr-form", inputs: { config: "config", form: "form", value: "value" }, outputs: { submitted: "submitted", valueChanges: "valueChanges", statusChanges: "statusChanges" }, viewQueries: [{ propertyName: "submitTrigger", first: true, predicate: ["submitTrigger"], descendants: true }], ngImport: i0, template: "<form\n class=\"crispr-form\"\n [ngClass]=\"config.classes\"\n [formGroup]=\"form\"\n (ngSubmit)=\"handleSubmit()\"\n [autocomplete]=\"config.autocomplete || 'off'\"\n [errorDictionary]=\"config.errorDictionary\"\n #ngFormElement=\"ngForm\">\n\n <ng-container\n *ngFor=\"let field of config.fields;\"\n crisprField\n [value]=\"value | initialControlValue : field\"\n [config]=\"field\"\n [group]=\"form\">\n </ng-container>\n <!-- Hidden button, programmatically clicked when crispr form triggerSubmit function called.\n Uses a hidden button with type=\"submit\" because it will trigger both native form submit event\n (which the error handler has to listen for) and ngSubmit event -->\n <button #submitTrigger class=\"submit-trigger\" type=\"submit\">\n </button>\n</form>\n", styles: [".submit-trigger{display:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: CrisprFieldDirective, selector: "[crisprField]", inputs: ["config", "group", "value"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { 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: "ngmodule", type: FormValidationHandlerModule }, { kind: "directive", type: i3$1.ControlErrorsFormDirective, selector: "form", inputs: ["errorDictionary"] }, { kind: "directive", type: i3$1.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }, { kind: "ngmodule", type: CrisprPipesModule }, { kind: "pipe", type: InitialControlValuePipe, name: "initialControlValue" }], preserveWhitespaces: true });
2104
173
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprFormComponent, decorators: [{
2105
174
  type: Component,
2106
- args: [{ selector: 'crispr-form', template: "<form\n class=\"crispr-form\"\n [ngClass]=\"config.classes\"\n [formGroup]=\"form\"\n (ngSubmit)=\"handleSubmit()\"\n [autocomplete]=\"config.autocomplete || 'off'\"\n [errorDictionary]=\"config.errorDictionary\"\n #ngFormElement=\"ngForm\">\n\n <ng-container\n *ngFor=\"let field of config.fields;\"\n crisprField\n [value]=\"value | initialControlValue : field\"\n [config]=\"field\"\n [group]=\"form\">\n </ng-container>\n <!-- Hidden button, programmatically clicked when crispr form triggerSubmit function called.\n Uses a hidden button with type=\"submit\" because it will trigger both native form submit event\n (which the error handler has to listen for) and ngSubmit event -->\n <button #submitTrigger class=\"submit-trigger\" type=\"submit\">\n </button>\n</form>\n", styles: [".submit-trigger{display:none}\n"] }]
175
+ args: [{ selector: 'crispr-form', standalone: true, imports: [
176
+ CommonModule,
177
+ CrisprFieldDirective,
178
+ ReactiveFormsModule,
179
+ FormValidationHandlerModule,
180
+ CrisprPipesModule
181
+ ], template: "<form\n class=\"crispr-form\"\n [ngClass]=\"config.classes\"\n [formGroup]=\"form\"\n (ngSubmit)=\"handleSubmit()\"\n [autocomplete]=\"config.autocomplete || 'off'\"\n [errorDictionary]=\"config.errorDictionary\"\n #ngFormElement=\"ngForm\">\n\n <ng-container\n *ngFor=\"let field of config.fields;\"\n crisprField\n [value]=\"value | initialControlValue : field\"\n [config]=\"field\"\n [group]=\"form\">\n </ng-container>\n <!-- Hidden button, programmatically clicked when crispr form triggerSubmit function called.\n Uses a hidden button with type=\"submit\" because it will trigger both native form submit event\n (which the error handler has to listen for) and ngSubmit event -->\n <button #submitTrigger class=\"submit-trigger\" type=\"submit\">\n </button>\n</form>\n", styles: [".submit-trigger{display:none}\n"] }]
2107
182
  }], propDecorators: { config: [{
2108
183
  type: Input
2109
184
  }], form: [{
@@ -2119,38 +194,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImpor
2119
194
  }], submitTrigger: [{
2120
195
  type: ViewChild,
2121
196
  args: ['submitTrigger']
2122
- }] } });
2123
- class CrisprFormModule {
2124
- }
2125
- CrisprFormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2126
- CrisprFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: CrisprFormModule, declarations: [CrisprFormComponent], imports: [CommonModule,
2127
- CrisprFieldModule,
2128
- ReactiveFormsModule,
2129
- FormValidationHandlerModule,
2130
- CrisprPipesModule], exports: [CrisprFormComponent] });
2131
- CrisprFormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprFormModule, imports: [CommonModule,
2132
- CrisprFieldModule,
2133
- ReactiveFormsModule,
2134
- FormValidationHandlerModule,
2135
- CrisprPipesModule] });
2136
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprFormModule, decorators: [{
2137
- type: NgModule,
2138
- args: [{
2139
- imports: [
2140
- CommonModule,
2141
- CrisprFieldModule,
2142
- ReactiveFormsModule,
2143
- FormValidationHandlerModule,
2144
- CrisprPipesModule
2145
- ],
2146
- exports: [
2147
- CrisprFormComponent
2148
- ],
2149
- declarations: [
2150
- CrisprFormComponent
2151
- ]
2152
- }]
2153
- }] });
197
+ }] } });
2154
198
 
2155
199
  const defaultConfig = {
2156
200
  addButtonLabel: 'ADD ITEM',
@@ -2211,57 +255,24 @@ class FormGroupListComponent extends FormGroupListMixin {
2211
255
  }
2212
256
  }
2213
257
  FormGroupListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: FormGroupListComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2214
- FormGroupListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: FormGroupListComponent, selector: "crispr-form-group-list", usesInheritance: true, ngImport: i0, template: "\n<crispr-field-container\n [config]=\"config\"\n [group]=\"group\"\n [formGroup]=\"group\">\n\n <div [formArrayName]=\"config.controlName\">\n <!-- Don't add trackBy function, it confuses the state of the array -->\n <div *ngFor=\"let con of control?.controls; let i = index;\">\n <!-- TODO: use content projection to allow custom item label component -->\n <div class=\"item-header\">\n <span class=\"mat-h2\"> {{ config.itemLabelBuilder ? config.itemLabelBuilder(i) : 'Item ' + (i + 1) }} </span>\n <button\n mat-icon-button\n type=\"button\"\n *ngIf=\"i + 1 > config.minListLength\">\n <mat-icon (click)=\"clickDelete(i)\">delete</mat-icon>\n </button>\n </div>\n <div\n [formGroup]=\"con\">\n <!-- TODO: if chiplists didn't need to have labels mixed in with their values we could use [value]=\"control.value\" below -->\n <ng-container\n *ngFor=\"let field of config.itemConfig.fields;\"\n crisprField\n [value]=\"blockValue ? null : value && value[i] | initialControlValue : field\"\n [config]=\"field\"\n [group]=\"con\">\n </ng-container>\n </div>\n </div>\n </div>\n <div class=\"group-footer\">\n <button\n type=\"button\"\n class=\"add\"\n mat-raised-button\n [color]=\"config.addButtonColor\"\n (click)=\"clickAdd()\">\n {{config.addItemLabel || config.addButtonLabel}}\n </button>\n </div>\n\n</crispr-field-container>\n", styles: [".item-header{display:flex;justify-content:space-between}.group-footer{display:flex;justify-content:flex-end}.group-footer button.add{margin-bottom:16px}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.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: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: CrisprFieldDirective, selector: "[crisprField]", inputs: ["config", "group", "value"] }, { kind: "directive", type: i9.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }, { kind: "pipe", type: InitialControlValuePipe, name: "initialControlValue" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
258
+ FormGroupListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: FormGroupListComponent, isStandalone: true, selector: "crispr-form-group-list", usesInheritance: true, ngImport: i0, template: "\n<crispr-field-container\n [config]=\"config\"\n [group]=\"group\"\n [formGroup]=\"group\">\n\n <div [formArrayName]=\"config.controlName\">\n <!-- Don't add trackBy function, it confuses the state of the array -->\n <div *ngFor=\"let con of control?.controls; let i = index;\">\n <!-- TODO: use content projection to allow custom item label component -->\n <div class=\"item-header\">\n <span class=\"mat-h2\"> {{ config.itemLabelBuilder ? config.itemLabelBuilder(i) : 'Item ' + (i + 1) }} </span>\n <button\n mat-icon-button\n type=\"button\"\n *ngIf=\"i + 1 > config.minListLength\">\n <mat-icon (click)=\"clickDelete(i)\">delete</mat-icon>\n </button>\n </div>\n <div\n [formGroup]=\"con\">\n <!-- TODO: if chiplists didn't need to have labels mixed in with their values we could use [value]=\"control.value\" below -->\n <ng-container\n *ngFor=\"let field of config.itemConfig.fields;\"\n crisprField\n [value]=\"blockValue ? null : value && value[i] | initialControlValue : field\"\n [config]=\"field\"\n [group]=\"con\">\n </ng-container>\n </div>\n </div>\n </div>\n <div class=\"group-footer\">\n <button\n type=\"button\"\n class=\"add\"\n mat-raised-button\n [color]=\"config.addButtonColor\"\n (click)=\"clickAdd()\">\n {{config.addItemLabel || config.addButtonLabel}}\n </button>\n </div>\n\n</crispr-field-container>\n", styles: [".item-header{display:flex;justify-content:space-between}.group-footer{display:flex;justify-content:flex-end}.group-footer button.add{margin-bottom:16px}\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: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2$1.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: MatIconModule }, { kind: "component", type: i3$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { 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.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: CrisprFieldDirective, selector: "[crisprField]", inputs: ["config", "group", "value"] }, { kind: "ngmodule", type: CrisprPipesModule }, { kind: "pipe", type: InitialControlValuePipe, name: "initialControlValue" }, { kind: "ngmodule", type: FormValidationHandlerModule }, { kind: "directive", type: i3$1.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
2215
259
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: FormGroupListComponent, decorators: [{
2216
260
  type: Component,
2217
- args: [{ selector: 'crispr-form-group-list', changeDetection: ChangeDetectionStrategy.OnPush, template: "\n<crispr-field-container\n [config]=\"config\"\n [group]=\"group\"\n [formGroup]=\"group\">\n\n <div [formArrayName]=\"config.controlName\">\n <!-- Don't add trackBy function, it confuses the state of the array -->\n <div *ngFor=\"let con of control?.controls; let i = index;\">\n <!-- TODO: use content projection to allow custom item label component -->\n <div class=\"item-header\">\n <span class=\"mat-h2\"> {{ config.itemLabelBuilder ? config.itemLabelBuilder(i) : 'Item ' + (i + 1) }} </span>\n <button\n mat-icon-button\n type=\"button\"\n *ngIf=\"i + 1 > config.minListLength\">\n <mat-icon (click)=\"clickDelete(i)\">delete</mat-icon>\n </button>\n </div>\n <div\n [formGroup]=\"con\">\n <!-- TODO: if chiplists didn't need to have labels mixed in with their values we could use [value]=\"control.value\" below -->\n <ng-container\n *ngFor=\"let field of config.itemConfig.fields;\"\n crisprField\n [value]=\"blockValue ? null : value && value[i] | initialControlValue : field\"\n [config]=\"field\"\n [group]=\"con\">\n </ng-container>\n </div>\n </div>\n </div>\n <div class=\"group-footer\">\n <button\n type=\"button\"\n class=\"add\"\n mat-raised-button\n [color]=\"config.addButtonColor\"\n (click)=\"clickAdd()\">\n {{config.addItemLabel || config.addButtonLabel}}\n </button>\n </div>\n\n</crispr-field-container>\n", styles: [".item-header{display:flex;justify-content:space-between}.group-footer{display:flex;justify-content:flex-end}.group-footer button.add{margin-bottom:16px}\n"] }]
2218
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
2219
-
2220
- class FormGroupListModule {
2221
- }
2222
- FormGroupListModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: FormGroupListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2223
- FormGroupListModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: FormGroupListModule, declarations: [FormGroupListComponent], imports: [CommonModule,
2224
- MatButtonModule,
2225
- MatIconModule,
2226
- FieldContainerModule,
2227
- ReactiveFormsModule,
2228
- CrisprFieldModule,
2229
- CrisprPipesModule,
2230
- FormValidationHandlerModule], exports: [FormGroupListComponent] });
2231
- FormGroupListModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: FormGroupListModule, imports: [CommonModule,
2232
- MatButtonModule,
2233
- MatIconModule,
2234
- FieldContainerModule,
2235
- ReactiveFormsModule,
2236
- CrisprFieldModule,
2237
- CrisprPipesModule,
2238
- FormValidationHandlerModule] });
2239
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: FormGroupListModule, decorators: [{
2240
- type: NgModule,
2241
- args: [{
2242
- imports: [
261
+ args: [{ selector: 'crispr-form-group-list', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
2243
262
  CommonModule,
2244
263
  MatButtonModule,
2245
264
  MatIconModule,
2246
- FieldContainerModule,
265
+ FieldContainerComponent,
2247
266
  ReactiveFormsModule,
2248
- CrisprFieldModule,
267
+ CrisprFieldDirective,
2249
268
  CrisprPipesModule,
2250
269
  FormValidationHandlerModule
2251
- ],
2252
- exports: [
2253
- FormGroupListComponent
2254
- ],
2255
- declarations: [
2256
- FormGroupListComponent
2257
- ]
2258
- }]
2259
- }] });
270
+ ], template: "\n<crispr-field-container\n [config]=\"config\"\n [group]=\"group\"\n [formGroup]=\"group\">\n\n <div [formArrayName]=\"config.controlName\">\n <!-- Don't add trackBy function, it confuses the state of the array -->\n <div *ngFor=\"let con of control?.controls; let i = index;\">\n <!-- TODO: use content projection to allow custom item label component -->\n <div class=\"item-header\">\n <span class=\"mat-h2\"> {{ config.itemLabelBuilder ? config.itemLabelBuilder(i) : 'Item ' + (i + 1) }} </span>\n <button\n mat-icon-button\n type=\"button\"\n *ngIf=\"i + 1 > config.minListLength\">\n <mat-icon (click)=\"clickDelete(i)\">delete</mat-icon>\n </button>\n </div>\n <div\n [formGroup]=\"con\">\n <!-- TODO: if chiplists didn't need to have labels mixed in with their values we could use [value]=\"control.value\" below -->\n <ng-container\n *ngFor=\"let field of config.itemConfig.fields;\"\n crisprField\n [value]=\"blockValue ? null : value && value[i] | initialControlValue : field\"\n [config]=\"field\"\n [group]=\"con\">\n </ng-container>\n </div>\n </div>\n </div>\n <div class=\"group-footer\">\n <button\n type=\"button\"\n class=\"add\"\n mat-raised-button\n [color]=\"config.addButtonColor\"\n (click)=\"clickAdd()\">\n {{config.addItemLabel || config.addButtonLabel}}\n </button>\n </div>\n\n</crispr-field-container>\n", styles: [".item-header{display:flex;justify-content:space-between}.group-footer{display:flex;justify-content:flex-end}.group-footer button.add{margin-bottom:16px}\n"] }]
271
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
2260
272
 
2261
273
  var index$1 = /*#__PURE__*/Object.freeze({
2262
274
  __proto__: null,
2263
- FormGroupListComponent: FormGroupListComponent,
2264
- FormGroupListModule: FormGroupListModule
275
+ FormGroupListComponent: FormGroupListComponent
2265
276
  });
2266
277
 
2267
278
  const FormGroupMixin = crisprControlMixin(CrisprFieldComponent);
@@ -2271,7 +282,7 @@ class SubGroupComponent extends FormGroupMixin {
2271
282
  }
2272
283
  }
2273
284
  SubGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: SubGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2274
- SubGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: SubGroupComponent, selector: "crispr-sub-group", usesInheritance: true, ngImport: i0, template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <ng-container\n *ngFor=\"let fieldConfig of config.fields;\"\n crisprField\n [value]=\"value | initialControlValue : fieldConfig\"\n [config]=\"fieldConfig\"\n [group]=\"control\">\n </ng-container>\n</crispr-field-container>\n\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: CrisprFieldDirective, selector: "[crisprField]", inputs: ["config", "group", "value"] }, { kind: "component", type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { kind: "pipe", type: InitialControlValuePipe, name: "initialControlValue" }], preserveWhitespaces: true });
285
+ SubGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: SubGroupComponent, selector: "crispr-sub-group", usesInheritance: true, ngImport: i0, template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <ng-container\n *ngFor=\"let fieldConfig of config.fields;\"\n crisprField\n [value]=\"value | initialControlValue : fieldConfig\"\n [config]=\"fieldConfig\"\n [group]=\"control\">\n </ng-container>\n</crispr-field-container>\n\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: CrisprFieldDirective, selector: "[crisprField]", inputs: ["config", "group", "value"] }, { kind: "component", type: i3.FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { kind: "pipe", type: InitialControlValuePipe, name: "initialControlValue" }], preserveWhitespaces: true });
2275
286
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: SubGroupComponent, decorators: [{
2276
287
  type: Component,
2277
288
  args: [{ selector: 'crispr-sub-group', template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <ng-container\n *ngFor=\"let fieldConfig of config.fields;\"\n crisprField\n [value]=\"value | initialControlValue : fieldConfig\"\n [config]=\"fieldConfig\"\n [group]=\"control\">\n </ng-container>\n</crispr-field-container>\n\n" }]
@@ -2281,14 +292,13 @@ class SubGroupModule {
2281
292
  }
2282
293
  SubGroupModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: SubGroupModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2283
294
  SubGroupModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: SubGroupModule, declarations: [SubGroupComponent], imports: [CommonModule,
2284
- CrisprFieldModule,
2285
- FieldContainerModule,
295
+ CrisprFieldDirective,
296
+ FieldContainerComponent,
2286
297
  CrisprPipesModule,
2287
298
  // TODO: Does this need to be here?
2288
299
  FormValidationHandlerModule], exports: [SubGroupComponent] });
2289
300
  SubGroupModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: SubGroupModule, imports: [CommonModule,
2290
- CrisprFieldModule,
2291
- FieldContainerModule,
301
+ FieldContainerComponent,
2292
302
  CrisprPipesModule,
2293
303
  // TODO: Does this need to be here?
2294
304
  FormValidationHandlerModule] });
@@ -2297,8 +307,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImpor
2297
307
  args: [{
2298
308
  imports: [
2299
309
  CommonModule,
2300
- CrisprFieldModule,
2301
- FieldContainerModule,
310
+ CrisprFieldDirective,
311
+ FieldContainerComponent,
2302
312
  CrisprPipesModule,
2303
313
  // TODO: Does this need to be here?
2304
314
  FormValidationHandlerModule
@@ -2324,27 +334,21 @@ CrisprFormsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", versio
2324
334
  CrisprFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: CrisprFormsModule, imports: [CommonModule,
2325
335
  ReactiveFormsModule,
2326
336
  FormValidationHandlerModule,
2327
- FormGroupListModule,
2328
- FieldContainerModule,
2329
- CrisprFieldModule,
337
+ FormGroupListComponent,
338
+ FieldContainerComponent,
339
+ CrisprFieldDirective,
2330
340
  SubGroupModule,
2331
- MaterialModule,
2332
341
  CrisprPipesModule,
2333
- CrisprFormModule], exports: [CrisprFormModule,
2334
- FieldContainerModule,
2335
- MaterialModule] });
342
+ CrisprFormComponent], exports: [CrisprFormComponent,
343
+ FieldContainerComponent] });
2336
344
  CrisprFormsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprFormsModule, imports: [CommonModule,
2337
345
  ReactiveFormsModule,
2338
346
  FormValidationHandlerModule,
2339
- FormGroupListModule,
2340
- FieldContainerModule,
2341
- CrisprFieldModule,
347
+ FormGroupListComponent,
348
+ FieldContainerComponent,
2342
349
  SubGroupModule,
2343
- MaterialModule,
2344
350
  CrisprPipesModule,
2345
- CrisprFormModule, CrisprFormModule,
2346
- FieldContainerModule,
2347
- MaterialModule] });
351
+ CrisprFormComponent] });
2348
352
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprFormsModule, decorators: [{
2349
353
  type: NgModule,
2350
354
  args: [{
@@ -2352,18 +356,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImpor
2352
356
  CommonModule,
2353
357
  ReactiveFormsModule,
2354
358
  FormValidationHandlerModule,
2355
- FormGroupListModule,
2356
- FieldContainerModule,
2357
- CrisprFieldModule,
359
+ FormGroupListComponent,
360
+ FieldContainerComponent,
361
+ CrisprFieldDirective,
2358
362
  SubGroupModule,
2359
- MaterialModule,
2360
363
  CrisprPipesModule,
2361
- CrisprFormModule
364
+ CrisprFormComponent
2362
365
  ],
2363
366
  exports: [
2364
- CrisprFormModule,
2365
- FieldContainerModule,
2366
- MaterialModule
367
+ CrisprFormComponent,
368
+ FieldContainerComponent,
369
+ // MaterialModule
2367
370
  ]
2368
371
  }]
2369
372
  }] });
@@ -2372,5 +375,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImpor
2372
375
  * Generated bundle index. Do not edit.
2373
376
  */
2374
377
 
2375
- export { AbstractAutocompleteComponent, AutocompleteChiplistFieldComponent, AutocompleteChiplistFieldModule, AutocompleteFieldComponent, AutocompleteFieldModule, ButtonComponent, ButtonModule, CheckboxFieldComponent, CheckboxFieldModule, ControlType, CrisprFieldComponent, CrisprFormComponent, CrisprFormModule, CrisprFormsModule, DEFAULT_EMPTY_OPTIONS_MESSAGE, DatepickerFieldComponent, DatepickerFieldModule, DividerComponent, DividerModule, FieldContainerComponent, FieldContainerModule, FileDropzoneDirective, FileUploadFieldComponent, FileUploadFieldModule, HeadingComponent, HeadingModule, ImageUploadFieldComponent, ImageUploadFieldModule, InputFieldComponent, InputFieldModule, MaterialModule, OptionComponent, OptionModule, RadioFieldComponent, RadioFieldModule, SelectFieldComponent, SelectFieldModule, SliderFieldComponent, SliderFieldModule, TextareaFieldComponent, TextareaFieldModule, UnitConversionFieldComponent, UnitConversionFieldModule, allowedFileExtValidator, allowedFileType, buildFormGroupFromConfig, callOptionsIfFunction, checkControlForValues, checkControlsForValues, computeValueFromFields, createControlForType, crisprControlMixin, filterOptionsByLabel, isControlConfig, maxFileSizeValidator, observablifyOptions };
378
+ export { CrisprFormComponent, CrisprFormsModule };
2376
379
  //# sourceMappingURL=tft-crispr-forms.mjs.map