@tft/crispr-forms 12.2.20 → 13.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 (342) hide show
  1. package/README.md +9 -69
  2. package/esm2020/index.mjs +2 -0
  3. package/esm2020/lib/abstracts/autocomplete-field.abstract.mjs +30 -0
  4. package/esm2020/lib/abstracts/crispr-control.mixin.mjs +27 -0
  5. package/esm2020/lib/abstracts/crispr-field.abstract.mjs +17 -0
  6. package/esm2020/lib/abstracts/index.mjs +4 -0
  7. package/esm2020/lib/crispr-forms.module.mjs +66 -0
  8. package/esm2020/lib/field-component-map.const.mjs +25 -0
  9. package/esm2020/lib/field-container/field-container.component.mjs +85 -0
  10. package/esm2020/lib/field-container/index.mjs +2 -0
  11. package/esm2020/lib/field.directive.mjs +77 -0
  12. package/esm2020/lib/form/form.component.mjs +54 -0
  13. package/esm2020/lib/form-group-list/form-group-list.component.mjs +51 -0
  14. package/esm2020/lib/form-group-list/form-group-list.module.mjs +54 -0
  15. package/esm2020/lib/form-group-list/index.mjs +3 -0
  16. package/esm2020/lib/form.helpers.mjs +185 -0
  17. package/esm2020/lib/form.operators.mjs +24 -0
  18. package/esm2020/lib/material/autocomplete-chiplist-field/autocomplete-chiplist-field.component.mjs +111 -0
  19. package/esm2020/lib/material/autocomplete-field/autocomplete-field.component.mjs +70 -0
  20. package/esm2020/lib/material/button/button.component.mjs +35 -0
  21. package/esm2020/lib/material/checkbox-field/checkbox-field.component.mjs +31 -0
  22. package/esm2020/lib/material/datepicker-field/datepicker-field.component.mjs +45 -0
  23. package/esm2020/lib/material/divider/divider.component.mjs +22 -0
  24. package/esm2020/lib/material/file-upload/file-dropzone.directive.mjs +39 -0
  25. package/esm2020/lib/material/file-upload/file-upload.component.mjs +145 -0
  26. package/esm2020/lib/material/file-upload/index.mjs +3 -0
  27. package/esm2020/lib/material/heading/heading.component.mjs +54 -0
  28. package/esm2020/lib/material/image-upload-field/image-compression.helpers.mjs +4 -0
  29. package/esm2020/lib/material/image-upload-field/image-upload-field.component.mjs +213 -0
  30. package/esm2020/lib/material/image-upload-field/index.mjs +2 -0
  31. package/esm2020/lib/material/index.mjs +18 -0
  32. package/esm2020/lib/material/info/info.component.mjs +46 -0
  33. package/esm2020/lib/material/input-field/input-field.component.mjs +27 -0
  34. package/esm2020/lib/material/material.module.mjs +200 -0
  35. package/esm2020/lib/material/option/index.mjs +2 -0
  36. package/esm2020/lib/material/option/option.component.mjs +14 -0
  37. package/esm2020/lib/material/radio-field/radio-field.component.mjs +29 -0
  38. package/esm2020/lib/material/select-field/select-field.component.mjs +58 -0
  39. package/esm2020/lib/material/selected-file/selected-file.component.mjs +47 -0
  40. package/esm2020/lib/material/slider-field/slider-field.component.mjs +30 -0
  41. package/esm2020/lib/material/textarea-field/textarea-field.component.mjs +28 -0
  42. package/esm2020/lib/material/unit-conversion-field/unit-conversion-field.component.mjs +69 -0
  43. package/esm2020/lib/models/autocomplete-chiplist-field.config.mjs +2 -0
  44. package/esm2020/lib/models/autocomplete-field.config.mjs +2 -0
  45. package/esm2020/lib/models/button.config.mjs +2 -0
  46. package/esm2020/lib/models/checkbox-field.config.mjs +2 -0
  47. package/esm2020/lib/models/crispr-field.config.mjs +23 -0
  48. package/esm2020/lib/models/datepicker-field.config.mjs +2 -0
  49. package/esm2020/lib/models/divider.config.mjs +2 -0
  50. package/esm2020/lib/models/file-upload-field.config.mjs +2 -0
  51. package/esm2020/lib/models/form-group-list.config.mjs +2 -0
  52. package/esm2020/lib/models/heading.config.mjs +3 -0
  53. package/esm2020/lib/models/image-upload-field.config.mjs +2 -0
  54. package/esm2020/lib/models/index.mjs +18 -0
  55. package/esm2020/lib/models/input-field.config.mjs +2 -0
  56. package/esm2020/lib/models/radio-field.config.mjs +2 -0
  57. package/esm2020/lib/models/select-field.config.mjs +2 -0
  58. package/esm2020/lib/models/slider-field.config.mjs +2 -0
  59. package/esm2020/lib/models/textarea-field.config.mjs +2 -0
  60. package/esm2020/lib/models/unit-conversion-field.config.mjs +2 -0
  61. package/esm2020/lib/pipes/crispr-pipes.module.mjs +26 -0
  62. package/esm2020/lib/pipes/initial-control-value.pipe.mjs +20 -0
  63. package/esm2020/lib/public_api.mjs +10 -0
  64. package/esm2020/lib/sub-group/index.mjs +3 -0
  65. package/esm2020/lib/sub-group/sub-group.component.mjs +20 -0
  66. package/esm2020/lib/sub-group/sub-group.module.mjs +45 -0
  67. package/esm2020/tft-crispr-forms.mjs +5 -0
  68. package/fesm2015/tft-crispr-forms.mjs +1883 -0
  69. package/fesm2015/tft-crispr-forms.mjs.map +1 -0
  70. package/fesm2020/tft-crispr-forms.mjs +1875 -0
  71. package/fesm2020/tft-crispr-forms.mjs.map +1 -0
  72. package/lib/abstracts/autocomplete-field.abstract.d.ts +4 -1
  73. package/lib/abstracts/crispr-control.mixin.d.ts +1 -1
  74. package/lib/abstracts/crispr-field.abstract.d.ts +4 -1
  75. package/lib/crispr-forms.module.d.ts +14 -0
  76. package/lib/field-component-map.const.d.ts +21 -20
  77. package/lib/field-container/field-container.component.d.ts +11 -1
  78. package/lib/field-container/index.d.ts +1 -0
  79. package/lib/field.directive.d.ts +14 -5
  80. package/lib/form/form.component.d.ts +6 -1
  81. package/lib/form-group-list/form-group-list.component.d.ts +4 -1
  82. package/lib/form-group-list/form-group-list.module.d.ts +15 -0
  83. package/lib/form-group-list/index.d.ts +2 -0
  84. package/lib/form.helpers.d.ts +1 -1
  85. package/lib/material/autocomplete-chiplist-field/autocomplete-chiplist-field.component.d.ts +3 -0
  86. package/lib/material/autocomplete-field/autocomplete-field.component.d.ts +4 -1
  87. package/lib/material/button/button.component.d.ts +3 -0
  88. package/lib/material/checkbox-field/checkbox-field.component.d.ts +3 -0
  89. package/lib/material/datepicker-field/datepicker-field.component.d.ts +3 -0
  90. package/lib/material/divider/divider.component.d.ts +3 -0
  91. package/lib/material/file-upload/file-dropzone.directive.d.ts +3 -0
  92. package/lib/material/file-upload/file-upload.component.d.ts +20 -2
  93. package/lib/material/file-upload/index.d.ts +2 -0
  94. package/lib/material/heading/heading.component.d.ts +12 -1
  95. package/lib/material/image-upload-field/image-compression.helpers.d.ts +1 -0
  96. package/lib/material/image-upload-field/image-upload-field.component.d.ts +63 -0
  97. package/lib/material/image-upload-field/index.d.ts +1 -0
  98. package/lib/material/index.d.ts +4 -1
  99. package/lib/material/info/info.component.d.ts +12 -1
  100. package/lib/material/input-field/input-field.component.d.ts +3 -0
  101. package/lib/material/material.module.d.ts +42 -0
  102. package/lib/material/option/index.d.ts +1 -0
  103. package/lib/material/option/option.component.d.ts +3 -0
  104. package/lib/material/radio-field/radio-field.component.d.ts +3 -0
  105. package/lib/material/select-field/select-field.component.d.ts +3 -0
  106. package/lib/material/selected-file/selected-file.component.d.ts +10 -0
  107. package/lib/material/slider-field/slider-field.component.d.ts +3 -0
  108. package/lib/material/textarea-field/textarea-field.component.d.ts +3 -0
  109. package/lib/material/unit-conversion-field/unit-conversion-field.component.d.ts +3 -0
  110. package/lib/models/autocomplete-field.config.d.ts +2 -1
  111. package/lib/models/button.config.d.ts +3 -2
  112. package/lib/models/crispr-field.config.d.ts +8 -7
  113. package/lib/models/file-upload-field.config.d.ts +3 -2
  114. package/lib/models/image-upload-field.config.d.ts +47 -0
  115. package/lib/models/index.d.ts +2 -0
  116. package/lib/models/input-field.config.d.ts +1 -1
  117. package/lib/models/radio-field.config.d.ts +1 -1
  118. package/lib/models/unit-conversion-field.config.d.ts +0 -1
  119. package/lib/pipes/crispr-pipes.module.d.ts +8 -0
  120. package/lib/pipes/initial-control-value.pipe.d.ts +3 -0
  121. package/lib/public_api.d.ts +1 -0
  122. package/lib/sub-group/index.d.ts +2 -0
  123. package/lib/sub-group/sub-group.component.d.ts +3 -0
  124. package/lib/sub-group/sub-group.module.d.ts +12 -0
  125. package/package.json +30 -15
  126. package/tft-crispr-forms-13.0.1.tgz +0 -0
  127. package/tft-crispr-forms.d.ts +1 -25
  128. package/bundles/tft-crispr-forms.umd.js +0 -1719
  129. package/bundles/tft-crispr-forms.umd.js.map +0 -1
  130. package/esm2015/index.js +0 -2
  131. package/esm2015/index.js.map +0 -1
  132. package/esm2015/index.metadata.json +0 -1
  133. package/esm2015/lib/abstracts/autocomplete-field.abstract.js +0 -27
  134. package/esm2015/lib/abstracts/autocomplete-field.abstract.js.map +0 -1
  135. package/esm2015/lib/abstracts/autocomplete-field.abstract.metadata.json +0 -1
  136. package/esm2015/lib/abstracts/crispr-control.mixin.js +0 -27
  137. package/esm2015/lib/abstracts/crispr-control.mixin.js.map +0 -1
  138. package/esm2015/lib/abstracts/crispr-control.mixin.metadata.json +0 -1
  139. package/esm2015/lib/abstracts/crispr-field.abstract.js +0 -14
  140. package/esm2015/lib/abstracts/crispr-field.abstract.js.map +0 -1
  141. package/esm2015/lib/abstracts/crispr-field.abstract.metadata.json +0 -1
  142. package/esm2015/lib/abstracts/index.js +0 -4
  143. package/esm2015/lib/abstracts/index.js.map +0 -1
  144. package/esm2015/lib/abstracts/index.metadata.json +0 -1
  145. package/esm2015/lib/crispr-forms.module.js +0 -41
  146. package/esm2015/lib/crispr-forms.module.js.map +0 -1
  147. package/esm2015/lib/crispr-forms.module.metadata.json +0 -1
  148. package/esm2015/lib/crispr-forms.module.ngfactory.js.map +0 -1
  149. package/esm2015/lib/field-component-map.const.js +0 -28
  150. package/esm2015/lib/field-component-map.const.js.map +0 -1
  151. package/esm2015/lib/field-component-map.const.metadata.json +0 -1
  152. package/esm2015/lib/field-container/field-container.component.js +0 -57
  153. package/esm2015/lib/field-container/field-container.component.js.map +0 -1
  154. package/esm2015/lib/field-container/field-container.component.metadata.json +0 -1
  155. package/esm2015/lib/field-container/field-container.component.ngfactory.js.map +0 -1
  156. package/esm2015/lib/field-container/field-container.component.scss.shim.ngstyle.js.map +0 -1
  157. package/esm2015/lib/field.directive.js +0 -55
  158. package/esm2015/lib/field.directive.js.map +0 -1
  159. package/esm2015/lib/field.directive.metadata.json +0 -1
  160. package/esm2015/lib/field.directive.ngfactory.js.map +0 -1
  161. package/esm2015/lib/form/form.component.js +0 -40
  162. package/esm2015/lib/form/form.component.js.map +0 -1
  163. package/esm2015/lib/form/form.component.metadata.json +0 -1
  164. package/esm2015/lib/form/form.component.ngfactory.js.map +0 -1
  165. package/esm2015/lib/form/form.component.scss.shim.ngstyle.js.map +0 -1
  166. package/esm2015/lib/form-group-list/form-group-list.component.js +0 -44
  167. package/esm2015/lib/form-group-list/form-group-list.component.js.map +0 -1
  168. package/esm2015/lib/form-group-list/form-group-list.component.metadata.json +0 -1
  169. package/esm2015/lib/form-group-list/form-group-list.component.ngfactory.js.map +0 -1
  170. package/esm2015/lib/form-group-list/form-group-list.component.scss.shim.ngstyle.js.map +0 -1
  171. package/esm2015/lib/form.helpers.js +0 -186
  172. package/esm2015/lib/form.helpers.js.map +0 -1
  173. package/esm2015/lib/form.helpers.metadata.json +0 -1
  174. package/esm2015/lib/form.operators.js +0 -24
  175. package/esm2015/lib/form.operators.js.map +0 -1
  176. package/esm2015/lib/form.operators.metadata.json +0 -1
  177. package/esm2015/lib/material/autocomplete-chiplist-field/autocomplete-chiplist-field.component.js +0 -101
  178. package/esm2015/lib/material/autocomplete-chiplist-field/autocomplete-chiplist-field.component.js.map +0 -1
  179. package/esm2015/lib/material/autocomplete-chiplist-field/autocomplete-chiplist-field.component.metadata.json +0 -1
  180. package/esm2015/lib/material/autocomplete-chiplist-field/autocomplete-chiplist-field.component.ngfactory.js.map +0 -1
  181. package/esm2015/lib/material/autocomplete-chiplist-field/autocomplete-chiplist-field.component.scss.shim.ngstyle.js.map +0 -1
  182. package/esm2015/lib/material/autocomplete-field/autocomplete-field.component.js +0 -57
  183. package/esm2015/lib/material/autocomplete-field/autocomplete-field.component.js.map +0 -1
  184. package/esm2015/lib/material/autocomplete-field/autocomplete-field.component.metadata.json +0 -1
  185. package/esm2015/lib/material/autocomplete-field/autocomplete-field.component.ngfactory.js.map +0 -1
  186. package/esm2015/lib/material/autocomplete-field/autocomplete-field.component.scss.shim.ngstyle.js.map +0 -1
  187. package/esm2015/lib/material/button/button.component.js +0 -30
  188. package/esm2015/lib/material/button/button.component.js.map +0 -1
  189. package/esm2015/lib/material/button/button.component.metadata.json +0 -1
  190. package/esm2015/lib/material/button/button.component.ngfactory.js.map +0 -1
  191. package/esm2015/lib/material/button/button.component.scss.shim.ngstyle.js.map +0 -1
  192. package/esm2015/lib/material/checkbox-field/checkbox-field.component.js +0 -25
  193. package/esm2015/lib/material/checkbox-field/checkbox-field.component.js.map +0 -1
  194. package/esm2015/lib/material/checkbox-field/checkbox-field.component.metadata.json +0 -1
  195. package/esm2015/lib/material/checkbox-field/checkbox-field.component.ngfactory.js.map +0 -1
  196. package/esm2015/lib/material/checkbox-field/checkbox-field.component.scss.shim.ngstyle.js.map +0 -1
  197. package/esm2015/lib/material/datepicker-field/datepicker-field.component.js +0 -45
  198. package/esm2015/lib/material/datepicker-field/datepicker-field.component.js.map +0 -1
  199. package/esm2015/lib/material/datepicker-field/datepicker-field.component.metadata.json +0 -1
  200. package/esm2015/lib/material/datepicker-field/datepicker-field.component.ngfactory.js.map +0 -1
  201. package/esm2015/lib/material/datepicker-field/datepicker-field.component.scss.shim.ngstyle.js.map +0 -1
  202. package/esm2015/lib/material/divider/divider.component.js +0 -20
  203. package/esm2015/lib/material/divider/divider.component.js.map +0 -1
  204. package/esm2015/lib/material/divider/divider.component.metadata.json +0 -1
  205. package/esm2015/lib/material/divider/divider.component.ngfactory.js.map +0 -1
  206. package/esm2015/lib/material/divider/divider.component.scss.shim.ngstyle.js.map +0 -1
  207. package/esm2015/lib/material/file-upload/file-dropzone.directive.js +0 -31
  208. package/esm2015/lib/material/file-upload/file-dropzone.directive.js.map +0 -1
  209. package/esm2015/lib/material/file-upload/file-dropzone.directive.metadata.json +0 -1
  210. package/esm2015/lib/material/file-upload/file-dropzone.directive.ngfactory.js.map +0 -1
  211. package/esm2015/lib/material/file-upload/file-upload.component.js +0 -80
  212. package/esm2015/lib/material/file-upload/file-upload.component.js.map +0 -1
  213. package/esm2015/lib/material/file-upload/file-upload.component.metadata.json +0 -1
  214. package/esm2015/lib/material/file-upload/file-upload.component.ngfactory.js.map +0 -1
  215. package/esm2015/lib/material/file-upload/file-upload.component.scss.shim.ngstyle.js.map +0 -1
  216. package/esm2015/lib/material/heading/heading.component.js +0 -23
  217. package/esm2015/lib/material/heading/heading.component.js.map +0 -1
  218. package/esm2015/lib/material/heading/heading.component.metadata.json +0 -1
  219. package/esm2015/lib/material/heading/heading.component.ngfactory.js.map +0 -1
  220. package/esm2015/lib/material/heading/heading.component.scss.shim.ngstyle.js.map +0 -1
  221. package/esm2015/lib/material/index.js +0 -15
  222. package/esm2015/lib/material/index.js.map +0 -1
  223. package/esm2015/lib/material/index.metadata.json +0 -1
  224. package/esm2015/lib/material/info/info.component.js +0 -15
  225. package/esm2015/lib/material/info/info.component.js.map +0 -1
  226. package/esm2015/lib/material/info/info.component.metadata.json +0 -1
  227. package/esm2015/lib/material/info/info.component.ngfactory.js.map +0 -1
  228. package/esm2015/lib/material/info/info.component.scss.shim.ngstyle.js.map +0 -1
  229. package/esm2015/lib/material/input-field/input-field.component.js +0 -22
  230. package/esm2015/lib/material/input-field/input-field.component.js.map +0 -1
  231. package/esm2015/lib/material/input-field/input-field.component.metadata.json +0 -1
  232. package/esm2015/lib/material/input-field/input-field.component.ngfactory.js.map +0 -1
  233. package/esm2015/lib/material/input-field/input-field.component.scss.shim.ngstyle.js.map +0 -1
  234. package/esm2015/lib/material/material.module.js +0 -107
  235. package/esm2015/lib/material/material.module.js.map +0 -1
  236. package/esm2015/lib/material/material.module.metadata.json +0 -1
  237. package/esm2015/lib/material/material.module.ngfactory.js.map +0 -1
  238. package/esm2015/lib/material/option/option.component.js +0 -15
  239. package/esm2015/lib/material/option/option.component.js.map +0 -1
  240. package/esm2015/lib/material/option/option.component.metadata.json +0 -1
  241. package/esm2015/lib/material/option/option.component.ngfactory.js.map +0 -1
  242. package/esm2015/lib/material/option/option.component.scss.shim.ngstyle.js.map +0 -1
  243. package/esm2015/lib/material/radio-field/radio-field.component.js +0 -25
  244. package/esm2015/lib/material/radio-field/radio-field.component.js.map +0 -1
  245. package/esm2015/lib/material/radio-field/radio-field.component.metadata.json +0 -1
  246. package/esm2015/lib/material/radio-field/radio-field.component.ngfactory.js.map +0 -1
  247. package/esm2015/lib/material/radio-field/radio-field.component.scss.shim.ngstyle.js.map +0 -1
  248. package/esm2015/lib/material/select-field/select-field.component.js +0 -50
  249. package/esm2015/lib/material/select-field/select-field.component.js.map +0 -1
  250. package/esm2015/lib/material/select-field/select-field.component.metadata.json +0 -1
  251. package/esm2015/lib/material/select-field/select-field.component.ngfactory.js.map +0 -1
  252. package/esm2015/lib/material/select-field/select-field.component.scss.shim.ngstyle.js.map +0 -1
  253. package/esm2015/lib/material/selected-file/selected-file.component.js +0 -17
  254. package/esm2015/lib/material/selected-file/selected-file.component.js.map +0 -1
  255. package/esm2015/lib/material/selected-file/selected-file.component.metadata.json +0 -1
  256. package/esm2015/lib/material/selected-file/selected-file.component.ngfactory.js.map +0 -1
  257. package/esm2015/lib/material/selected-file/selected-file.component.scss.shim.ngstyle.js.map +0 -1
  258. package/esm2015/lib/material/slider-field/slider-field.component.js +0 -26
  259. package/esm2015/lib/material/slider-field/slider-field.component.js.map +0 -1
  260. package/esm2015/lib/material/slider-field/slider-field.component.metadata.json +0 -1
  261. package/esm2015/lib/material/slider-field/slider-field.component.ngfactory.js.map +0 -1
  262. package/esm2015/lib/material/slider-field/slider-field.component.scss.shim.ngstyle.js.map +0 -1
  263. package/esm2015/lib/material/textarea-field/textarea-field.component.js +0 -22
  264. package/esm2015/lib/material/textarea-field/textarea-field.component.js.map +0 -1
  265. package/esm2015/lib/material/textarea-field/textarea-field.component.metadata.json +0 -1
  266. package/esm2015/lib/material/textarea-field/textarea-field.component.ngfactory.js.map +0 -1
  267. package/esm2015/lib/material/textarea-field/textarea-field.component.scss.shim.ngstyle.js.map +0 -1
  268. package/esm2015/lib/material/unit-conversion-field/unit-conversion-field.component.js +0 -63
  269. package/esm2015/lib/material/unit-conversion-field/unit-conversion-field.component.js.map +0 -1
  270. package/esm2015/lib/material/unit-conversion-field/unit-conversion-field.component.metadata.json +0 -1
  271. package/esm2015/lib/material/unit-conversion-field/unit-conversion-field.component.ngfactory.js.map +0 -1
  272. package/esm2015/lib/material/unit-conversion-field/unit-conversion-field.component.scss.shim.ngstyle.js.map +0 -1
  273. package/esm2015/lib/models/autocomplete-chiplist-field.config.js +0 -2
  274. package/esm2015/lib/models/autocomplete-chiplist-field.config.js.map +0 -1
  275. package/esm2015/lib/models/autocomplete-chiplist-field.config.metadata.json +0 -1
  276. package/esm2015/lib/models/autocomplete-field.config.js +0 -2
  277. package/esm2015/lib/models/autocomplete-field.config.js.map +0 -1
  278. package/esm2015/lib/models/autocomplete-field.config.metadata.json +0 -1
  279. package/esm2015/lib/models/button.config.js +0 -2
  280. package/esm2015/lib/models/button.config.js.map +0 -1
  281. package/esm2015/lib/models/button.config.metadata.json +0 -1
  282. package/esm2015/lib/models/checkbox-field.config.js +0 -2
  283. package/esm2015/lib/models/checkbox-field.config.js.map +0 -1
  284. package/esm2015/lib/models/checkbox-field.config.metadata.json +0 -1
  285. package/esm2015/lib/models/crispr-field.config.js +0 -22
  286. package/esm2015/lib/models/crispr-field.config.js.map +0 -1
  287. package/esm2015/lib/models/crispr-field.config.metadata.json +0 -1
  288. package/esm2015/lib/models/datepicker-field.config.js +0 -2
  289. package/esm2015/lib/models/datepicker-field.config.js.map +0 -1
  290. package/esm2015/lib/models/datepicker-field.config.metadata.json +0 -1
  291. package/esm2015/lib/models/divider.config.js +0 -2
  292. package/esm2015/lib/models/divider.config.js.map +0 -1
  293. package/esm2015/lib/models/divider.config.metadata.json +0 -1
  294. package/esm2015/lib/models/file-upload-field.config.js +0 -2
  295. package/esm2015/lib/models/file-upload-field.config.js.map +0 -1
  296. package/esm2015/lib/models/file-upload-field.config.metadata.json +0 -1
  297. package/esm2015/lib/models/form-group-list.config.js +0 -2
  298. package/esm2015/lib/models/form-group-list.config.js.map +0 -1
  299. package/esm2015/lib/models/form-group-list.config.metadata.json +0 -1
  300. package/esm2015/lib/models/heading.config.js +0 -3
  301. package/esm2015/lib/models/heading.config.js.map +0 -1
  302. package/esm2015/lib/models/heading.config.metadata.json +0 -1
  303. package/esm2015/lib/models/index.js +0 -16
  304. package/esm2015/lib/models/index.js.map +0 -1
  305. package/esm2015/lib/models/index.metadata.json +0 -1
  306. package/esm2015/lib/models/input-field.config.js +0 -2
  307. package/esm2015/lib/models/input-field.config.js.map +0 -1
  308. package/esm2015/lib/models/input-field.config.metadata.json +0 -1
  309. package/esm2015/lib/models/radio-field.config.js +0 -2
  310. package/esm2015/lib/models/radio-field.config.js.map +0 -1
  311. package/esm2015/lib/models/radio-field.config.metadata.json +0 -1
  312. package/esm2015/lib/models/select-field.config.js +0 -2
  313. package/esm2015/lib/models/select-field.config.js.map +0 -1
  314. package/esm2015/lib/models/select-field.config.metadata.json +0 -1
  315. package/esm2015/lib/models/slider-field.config.js +0 -2
  316. package/esm2015/lib/models/slider-field.config.js.map +0 -1
  317. package/esm2015/lib/models/slider-field.config.metadata.json +0 -1
  318. package/esm2015/lib/models/textarea-field.config.js +0 -2
  319. package/esm2015/lib/models/textarea-field.config.js.map +0 -1
  320. package/esm2015/lib/models/textarea-field.config.metadata.json +0 -1
  321. package/esm2015/lib/models/unit-conversion-field.config.js +0 -2
  322. package/esm2015/lib/models/unit-conversion-field.config.js.map +0 -1
  323. package/esm2015/lib/models/unit-conversion-field.config.metadata.json +0 -1
  324. package/esm2015/lib/pipes/initial-control-value.pipe.js +0 -16
  325. package/esm2015/lib/pipes/initial-control-value.pipe.js.map +0 -1
  326. package/esm2015/lib/pipes/initial-control-value.pipe.metadata.json +0 -1
  327. package/esm2015/lib/pipes/initial-control-value.pipe.ngfactory.js.map +0 -1
  328. package/esm2015/lib/public_api.js +0 -9
  329. package/esm2015/lib/public_api.js.map +0 -1
  330. package/esm2015/lib/public_api.metadata.json +0 -1
  331. package/esm2015/lib/sub-group/sub-group.component.js +0 -17
  332. package/esm2015/lib/sub-group/sub-group.component.js.map +0 -1
  333. package/esm2015/lib/sub-group/sub-group.component.metadata.json +0 -1
  334. package/esm2015/lib/sub-group/sub-group.component.ngfactory.js.map +0 -1
  335. package/esm2015/lib/sub-group/sub-group.component.scss.shim.ngstyle.js.map +0 -1
  336. package/esm2015/tft-crispr-forms.js +0 -30
  337. package/esm2015/tft-crispr-forms.js.map +0 -1
  338. package/esm2015/tft-crispr-forms.metadata.json +0 -1
  339. package/fesm2015/tft-crispr-forms.js +0 -1263
  340. package/fesm2015/tft-crispr-forms.js.map +0 -1
  341. package/tft-crispr-forms-12.2.20.tgz +0 -0
  342. package/tft-crispr-forms.metadata.json +0 -1
@@ -1 +0,0 @@
1
- [{"__symbolic":"module","version":4,"metadata":{"FIELD_COMPONENTS":{"button":{"__symbolic":"reference","module":"./material","name":"ButtonComponent","line":11,"character":10},"input":{"__symbolic":"reference","module":"./material","name":"InputFieldComponent","line":12,"character":9},"select":{"__symbolic":"reference","module":"./material","name":"SelectFieldComponent","line":13,"character":10},"radio":{"__symbolic":"reference","module":"./material","name":"RadioFieldComponent","line":14,"character":9},"subGroup":{"__symbolic":"reference","module":"./sub-group/sub-group.component","name":"SubGroupComponent","line":15,"character":12},"groupList":{"__symbolic":"reference","module":"./form-group-list/form-group-list.component","name":"FormGroupListComponent","line":16,"character":13},"autocomplete":{"__symbolic":"reference","module":"./material","name":"AutocompleteFieldComponent","line":17,"character":16},"autocompleteChiplist":{"__symbolic":"reference","module":"./material","name":"AutocompleteChiplistFieldComponent","line":18,"character":24},"textarea":{"__symbolic":"reference","module":"./material","name":"TextareaFieldComponent","line":19,"character":12},"checkbox":{"__symbolic":"reference","module":"./material","name":"CheckboxFieldComponent","line":20,"character":12},"slider":{"__symbolic":"reference","module":"./material","name":"SliderFieldComponent","line":21,"character":10},"datepicker":{"__symbolic":"reference","module":"./material","name":"DatepickerFieldComponent","line":22,"character":14},"fileUpload":{"__symbolic":"reference","module":"./material","name":"FileUploadComponent","line":23,"character":14},"heading":{"__symbolic":"reference","module":"./material","name":"HeadingComponent","line":24,"character":11},"divider":{"__symbolic":"reference","module":"./material","name":"DividerComponent","line":25,"character":11},"unitConversion":{"__symbolic":"reference","module":"./material","name":"UnitConversionFieldComponent","line":26,"character":18}},"isControlComponent":{"__symbolic":"function","parameters":["component"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"call","expression":{"__symbolic":"reference","module":"./form.helpers","name":"isControlConfig","line":30,"character":9},"arguments":[{"__symbolic":"select","expression":{"__symbolic":"reference","name":"component"},"member":"config"}]},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"select","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"component"},"member":"config"},"member":"controlType"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"./models","name":"ControlType","line":30,"character":79},"member":"BUTTON"}}}},"CrisprControlComponent":{"__symbolic":"interface"},"ComponentKeys":{"__symbolic":"interface"},"CrisprFieldComponent":{"__symbolic":"interface"}}}]
@@ -1,57 +0,0 @@
1
- import { Component, Input, ChangeDetectionStrategy } from '@angular/core';
2
- import { of } from 'rxjs';
3
- import { FormGroup } from '@angular/forms';
4
- import { tap, distinctUntilChanged } from 'rxjs/operators';
5
- import { computeValueFromFields } from '../form.helpers';
6
- export class FieldContainerComponent {
7
- constructor() {
8
- // boolean whether field-container is inline
9
- this.inlineField = false;
10
- this.subs = [];
11
- }
12
- ngOnInit() {
13
- this.disabled$ = this.connectDisabledCallback(this.group, this.config);
14
- // we tried moving this into afterViewChecked and afterContentChecked lifecycle hooks without any luck
15
- if (this.config.computeValue) {
16
- this.subs.push(this.config.computeValue(this.group).pipe(distinctUntilChanged(), tap(computedValue => this.group.get(this.config.controlName).setValue(computedValue))).subscribe());
17
- }
18
- else if (this.config.computeFieldConfig) {
19
- 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`);
20
- this.subs.push(computeValueFromFields(this.group, this.config.computeFieldConfig).pipe(distinctUntilChanged(), tap(computedValue => this.group.get(this.config.controlName).setValue(computedValue))).subscribe());
21
- }
22
- }
23
- ngOnDestroy() {
24
- this.subs.forEach(sub => sub.unsubscribe);
25
- }
26
- /**
27
- * Connects user defined disabledCallback function to the the view, so that the control is enabled/disabled
28
- * appropriately. It also keeps the form will hide disabled fields in the UI unless `hideDisabled` is set to
29
- * false in the controls config
30
- * @param group used to get valueChanges from control
31
- * @param config configuration object used to
32
- */
33
- connectDisabledCallback(group, config = null) {
34
- const control = group.get(config.controlName);
35
- // If the disabled$ function exists on the field config then call it with the disabledCallbackConfig
36
- // as a parameter otherwise return an observable of true.
37
- return (config === null || config === void 0 ? void 0 : config.disabledCallback) && config.disabledCallback instanceof Function
38
- ? config.disabledCallback(group, config.disabledCallbackConfig || null).pipe(
39
- // This enables/disables when callback conditions are met
40
- tap((shouldDisable) => shouldDisable ? control.disable() : control.enable()))
41
- : of(false);
42
- }
43
- }
44
- FieldContainerComponent.decorators = [
45
- { type: Component, args: [{
46
- selector: 'crispr-field-container',
47
- 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",
48
- changeDetection: ChangeDetectionStrategy.OnPush,
49
- styles: ["::ng-deep mat-form-field.mat-form-field{display:block}.inline-field{display:inline-block}"]
50
- },] }
51
- ];
52
- FieldContainerComponent.propDecorators = {
53
- config: [{ type: Input }],
54
- group: [{ type: Input }],
55
- inlineField: [{ type: Input }]
56
- };
57
- //# sourceMappingURL=field-container.component.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"field-container.component.js","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,IAAI,CACrE,oBAAoB,EAAE,EACtB,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CACtF,CAAC,SAAS,EAAE,CACd,CAAC;SACH;IACH,CAAC;IAED,WAAW;QACT,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC5C,CAAC;IACD;;;;;;OAMG;IACH,uBAAuB,CAAC,KAAgB,EAAE,SAA8B,IAAI;QAC1E,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAC9C,oGAAoG;QACpG,yDAAyD;QACzD,OAAO,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,gBAAgB,KAAI,MAAM,CAAC,gBAAgB,YAAY,QAAQ;YAC5E,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,sBAAsB,IAAI,IAAI,CAAC,CAAC,IAAI;YAC1E,yDAAyD;YACzD,GAAG,CAAC,CAAC,aAAa,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAC7E;YACD,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IAChB,CAAC;;;YA3DF,SAAS,SAAC;gBACT,QAAQ,EAAE,wBAAwB;gBAClC,8UAA+C;gBAE/C,eAAe,EAAE,uBAAuB,CAAC,MAAM;;aAChD;;;qBAGE,KAAK;oBAEL,KAAK;0BAEL,KAAK","sourcesContent":["import { Component, OnInit, Input, ChangeDetectionStrategy, OnDestroy } from '@angular/core';\nimport { CrisprControlConfig } from '../models';\nimport { Observable, of, Subscription } from 'rxjs';\nimport { FormGroup } from '@angular/forms';\nimport { tap, distinctUntilChanged } from 'rxjs/operators';\nimport { computeValueFromFields } from '../form.helpers';\n\n@Component({\n selector: 'crispr-field-container',\n templateUrl: './field-container.component.html',\n styleUrls: ['./field-container.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class FieldContainerComponent implements OnInit, OnDestroy {\n // the configuration object for the field\n @Input() config: CrisprControlConfig;\n // the parent formGroup\n @Input() group: FormGroup;\n // boolean whether field-container is inline\n @Input() inlineField = false;\n // used to determine whether or not field should be shown\n disabled$: Observable<boolean>;\n\n subs: Subscription[] = [];\n\n ngOnInit() {\n this.disabled$ = this.connectDisabledCallback(this.group, this.config);\n // we tried moving this into afterViewChecked and afterContentChecked lifecycle hooks without any luck\n if (this.config.computeValue) {\n this.subs.push(\n this.config.computeValue(this.group).pipe(\n distinctUntilChanged(),\n tap(computedValue => this.group.get(this.config.controlName).setValue(computedValue))\n ).subscribe(),\n );\n } else if (this.config.computeFieldConfig) {\n 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`)\n this.subs.push(\n computeValueFromFields(this.group, this.config.computeFieldConfig).pipe(\n distinctUntilChanged(),\n tap(computedValue => this.group.get(this.config.controlName).setValue(computedValue))\n ).subscribe(),\n );\n }\n }\n\n ngOnDestroy(): void {\n this.subs.forEach(sub => sub.unsubscribe);\n }\n /**\n * Connects user defined disabledCallback function to the the view, so that the control is enabled/disabled\n * appropriately. It also keeps the form will hide disabled fields in the UI unless `hideDisabled` is set to\n * false in the controls config\n * @param group used to get valueChanges from control\n * @param config configuration object used to\n */\n connectDisabledCallback(group: FormGroup, config: CrisprControlConfig = null) {\n const control = group.get(config.controlName);\n // If the disabled$ function exists on the field config then call it with the disabledCallbackConfig\n // as a parameter otherwise return an observable of true.\n return config?.disabledCallback && config.disabledCallback instanceof Function\n ? config.disabledCallback(group, config.disabledCallbackConfig || null).pipe(\n // This enables/disables when callback conditions are met\n tap((shouldDisable) => shouldDisable ? control.disable() : control.enable())\n )\n : of(false);\n }\n}\n"]}
@@ -1 +0,0 @@
1
- [{"__symbolic":"module","version":4,"metadata":{"FieldContainerComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":7,"character":1},"arguments":[{"selector":"crispr-field-container","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy","line":11,"character":19},"member":"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}.inline-field{display:inline-block}"]}]}],"members":{"config":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":15,"character":3}}]}],"group":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":17,"character":3}}]}],"inlineField":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":19,"character":3}}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"connectDisabledCallback":[{"__symbolic":"method"}]}}}}]
@@ -1 +0,0 @@
1
- {"version":3,"file":"field-container.component.ngfactory.js","sourceRoot":"","sources":["../../../../../../libs/crispr-forms/src/lib/field-container/field-container.component.ngfactory.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"field-container.component.scss.shim.ngstyle.js","sourceRoot":"","sources":["../../../../../../libs/crispr-forms/src/lib/field-container/field-container.component.scss.shim.ngstyle.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
@@ -1,55 +0,0 @@
1
- import { Directive, Input, ComponentFactoryResolver, ViewContainerRef, Renderer2 } from '@angular/core';
2
- import { FormGroup } from '@angular/forms';
3
- import { FIELD_COMPONENTS, isControlComponent } from './field-component-map.const';
4
- export class CrisprFieldDirective {
5
- constructor(resolver, container, renderer) {
6
- this.resolver = resolver;
7
- this.container = container;
8
- this.renderer = renderer;
9
- }
10
- ngOnInit() {
11
- /**
12
- * create component and set values from config on its instance
13
- */
14
- const component = this.config.component || FIELD_COMPONENTS[this.config.controlType];
15
- const factory = this.resolver.resolveComponentFactory(component);
16
- const componentRef = this.container.createComponent(factory);
17
- this.component = componentRef.instance;
18
- this.component.config = this.config;
19
- if (isControlComponent(this.component)) {
20
- this.component.group = this.group;
21
- if ('value' in this.component) {
22
- this.component.value = this.value;
23
- }
24
- }
25
- // adds any config classes to the dynamically generated component
26
- // doing this here keeps us from having to extend a base component into each field component individually
27
- if (!this.config.classes)
28
- return;
29
- this.config.classes.forEach((klass) => {
30
- // check for passing multiple classes in one array element
31
- if (klass.includes(' ')) {
32
- throw Error(`Improperly formatted class. '${klass}' cannot contain spaces.`);
33
- }
34
- else {
35
- this.renderer.addClass(componentRef.location.nativeElement, klass);
36
- }
37
- });
38
- }
39
- }
40
- CrisprFieldDirective.decorators = [
41
- { type: Directive, args: [{
42
- selector: '[crisprField]'
43
- },] }
44
- ];
45
- CrisprFieldDirective.ctorParameters = () => [
46
- { type: ComponentFactoryResolver },
47
- { type: ViewContainerRef },
48
- { type: Renderer2 }
49
- ];
50
- CrisprFieldDirective.propDecorators = {
51
- config: [{ type: Input }],
52
- group: [{ type: Input }],
53
- value: [{ type: Input }]
54
- };
55
- //# sourceMappingURL=field.directive.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file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AO;YAAE,OAAO;QAChC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACpC,0DAA0D;YAC1D,IAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBACtB,MAAM,KAAK,CAAC,gCAAgC,KAAK,0BAA0B,CAAC,CAAC;aAC9E;iBAAM;gBACL,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;aACpE;QACH,CAAC,CAAC,CAAC;IACL,CAAC;;;YA3CF,SAAS,SAAC;gBACT,QAAQ,EAAE,eAAe;aAC1B;;;YAP0B,wBAAwB;YAAE,gBAAgB;YAAU,SAAS;;;qBAUrF,KAAK;oBACL,KAAK;oBACL,KAAK","sourcesContent":["import { Directive, Input, ComponentFactoryResolver, ViewContainerRef, OnInit, Renderer2 } from '@angular/core';\nimport { FormGroup } from '@angular/forms';\nimport { AnyFieldConfig, ControlValue } from './models';\nimport { CrisprFieldComponent , FIELD_COMPONENTS, isControlComponent } from './field-component-map.const';\n\n@Directive({\n selector: '[crisprField]'\n})\nexport class CrisprFieldDirective implements OnInit {\n\n @Input() config: AnyFieldConfig;\n @Input() group: FormGroup;\n @Input() value: ControlValue | any[];\n component: CrisprFieldComponent;\n\n constructor(\n private resolver: ComponentFactoryResolver,\n private container: ViewContainerRef,\n private renderer: Renderer2\n ) {}\n\n ngOnInit() {\n /**\n * create component and set values from config on its instance\n */\n const component = this.config.component || FIELD_COMPONENTS[this.config.controlType];\n const factory = this.resolver.resolveComponentFactory<CrisprFieldComponent>(component);\n const componentRef = this.container.createComponent(factory);\n\n this.component = componentRef.instance;\n this.component.config = this.config;\n if ( isControlComponent(this.component)) {\n this.component.group = this.group;\n if ('value' in this.component) {\n this.component.value = this.value;\n }\n }\n // adds any config classes to the dynamically generated component\n // doing this here keeps us from having to extend a base component into each field component individually\n if(!this.config.classes) return;\n this.config.classes.forEach((klass) => {\n // check for passing multiple classes in one array element\n if(klass.includes(' ')) {\n throw Error(`Improperly formatted class. '${klass}' cannot contain spaces.`);\n } else {\n this.renderer.addClass(componentRef.location.nativeElement, klass);\n }\n });\n }\n}\n"]}
@@ -1 +0,0 @@
1
- [{"__symbolic":"module","version":4,"metadata":{"CrisprFieldDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":5,"character":1},"arguments":[{"selector":"[crisprField]"}]}],"members":{"config":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":10,"character":3}}]}],"group":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":11,"character":3}}]}],"value":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":12,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ComponentFactoryResolver","line":16,"character":22},{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":17,"character":23},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2","line":18,"character":22}]}],"ngOnInit":[{"__symbolic":"method"}]}}}}]
@@ -1 +0,0 @@
1
- {"version":3,"file":"field.directive.ngfactory.js","sourceRoot":"","sources":["../../../../../libs/crispr-forms/src/lib/field.directive.ngfactory.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
@@ -1,40 +0,0 @@
1
- import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy } from '@angular/core';
2
- import { FormGroup } from '@angular/forms';
3
- import { buildFormGroupFromConfig } from '../form.helpers';
4
- import { Observable } from 'rxjs';
5
- export class CrisprFormComponent {
6
- constructor() {
7
- this.form = new FormGroup({});
8
- this.value = null;
9
- this.submitted = new EventEmitter();
10
- // proxy value and status change events through to consuming component
11
- this.valueChanges = this.form.valueChanges;
12
- this.statusChanges = this.form.statusChanges;
13
- this.subs = [];
14
- }
15
- ngOnInit() {
16
- // build out the form, note that we pass in the form as the third argument and the function modifies it
17
- buildFormGroupFromConfig(this.config, this.value, this.form);
18
- }
19
- handleSubmit() {
20
- this.form.markAllAsTouched();
21
- this.submitted.emit(this.form);
22
- }
23
- }
24
- CrisprFormComponent.decorators = [
25
- { type: Component, args: [{
26
- selector: 'crispr-form',
27
- 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\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\n</form>\n",
28
- changeDetection: ChangeDetectionStrategy.OnPush,
29
- styles: [""]
30
- },] }
31
- ];
32
- CrisprFormComponent.propDecorators = {
33
- config: [{ type: Input }],
34
- form: [{ type: Input }],
35
- value: [{ type: Input }],
36
- submitted: [{ type: Output }],
37
- valueChanges: [{ type: Output }],
38
- statusChanges: [{ type: Output }]
39
- };
40
- //# sourceMappingURL=form.component.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"form.component.js","sourceRoot":"","sources":["../../../../../../libs/crispr-forms/src/lib/form/form.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAU,MAAM,EAAE,YAAY,EAAE,uBAAuB,EAAa,MAAM,eAAe,CAAC;AACnH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAgB,UAAU,EAAE,MAAM,MAAM,CAAC;AAOhD,MAAM,OAAO,mBAAmB;IANhC;QASW,SAAI,GAAc,IAAI,SAAS,CAAC,EAAE,CAAC,CAAC;QACpC,UAAK,GAAsB,IAAI,CAAC;QAE/B,cAAS,GAAG,IAAI,YAAY,EAAa,CAAC;QACpD,sEAAsE;QAC5D,iBAAY,GAAoB,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;QACvD,kBAAa,GAAuB,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC;QAEtE,SAAI,GAAmB,EAAE,CAAC;IAW5B,CAAC;IATC,QAAQ;QACN,uGAAuG;QACvG,wBAAwB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/D,CAAC;IAED,YAAY;QACV,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC7B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;;;YA3BF,SAAS,SAAC;gBACT,QAAQ,EAAE,aAAa;gBAEvB,2bAAkC;gBAClC,eAAe,EAAE,uBAAuB,CAAC,MAAM;;aAChD;;;qBAGE,KAAK;mBACL,KAAK;oBACL,KAAK;wBAEL,MAAM;2BAEN,MAAM;4BACN,MAAM","sourcesContent":["import { Component, Input, OnInit, Output, EventEmitter, ChangeDetectionStrategy, OnDestroy } from '@angular/core';\nimport { FormGroup } from '@angular/forms';\nimport { ControlGroupValue, ControlValue, FormConfig } from '../models';\nimport { buildFormGroupFromConfig } from '../form.helpers';\nimport { Subscription, Observable } from 'rxjs';\n@Component({\n selector: 'crispr-form',\n styleUrls: ['form.component.scss'],\n templateUrl: 'form.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class CrisprFormComponent implements OnInit {\n // if no form has been passed in by consuming component, we create an empty group to build out\n @Input() config: FormConfig;\n @Input() form: FormGroup = new FormGroup({});\n @Input() value: ControlGroupValue = null;\n\n @Output() submitted = new EventEmitter<FormGroup>();\n // proxy value and status change events through to consuming component\n @Output() valueChanges: Observable<any> = this.form.valueChanges;\n @Output() statusChanges: Observable<string> = this.form.statusChanges;\n\n subs: Subscription[] = [];\n\n ngOnInit() {\n // build out the form, note that we pass in the form as the third argument and the function modifies it\n buildFormGroupFromConfig(this.config, this.value, this.form);\n }\n\n handleSubmit() {\n this.form.markAllAsTouched();\n this.submitted.emit(this.form);\n }\n}\n"]}
@@ -1 +0,0 @@
1
- [{"__symbolic":"module","version":4,"metadata":{"CrisprFormComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":5,"character":1},"arguments":[{"selector":"crispr-form","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy","line":9,"character":19},"member":"OnPush"},"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\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\n</form>\n","styles":[""]}]}],"members":{"config":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":13,"character":3}}]}],"form":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":14,"character":3}}]}],"value":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":15,"character":3}}]}],"submitted":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":17,"character":3}}]}],"valueChanges":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":19,"character":3}}]}],"statusChanges":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":20,"character":3}}]}],"ngOnInit":[{"__symbolic":"method"}],"handleSubmit":[{"__symbolic":"method"}]}}}}]
@@ -1 +0,0 @@
1
- {"version":3,"file":"form.component.ngfactory.js","sourceRoot":"","sources":["../../../../../../libs/crispr-forms/src/lib/form/form.component.ngfactory.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"form.component.scss.shim.ngstyle.js","sourceRoot":"","sources":["../../../../../../libs/crispr-forms/src/lib/form/form.component.scss.shim.ngstyle.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
@@ -1,44 +0,0 @@
1
- import { Component, ChangeDetectionStrategy } from '@angular/core';
2
- import { createControlForType } from '../form.helpers';
3
- import { CrisprFieldComponent, crisprControlMixin } from '../abstracts';
4
- const defaultConfig = {
5
- addButtonLabel: 'ADD ITEM',
6
- minListLength: 1,
7
- };
8
- const FormGroupListMixin = crisprControlMixin(CrisprFieldComponent);
9
- export class FormGroupListComponent extends FormGroupListMixin {
10
- constructor() {
11
- super(...arguments);
12
- this.defaultConfig = defaultConfig;
13
- }
14
- ngOnInit() {
15
- super.ngOnInit();
16
- // TODO: this is required to ngFor of controls in template, must be a better way
17
- this.formArray = this.control;
18
- }
19
- setControlValue(values) {
20
- if (this.control) {
21
- if ((values === null || values === void 0 ? void 0 : values.length) > 0) {
22
- values.forEach(value => this.addGroup(value));
23
- }
24
- else if (this.config.displayInitialItem) {
25
- this.addGroup();
26
- }
27
- }
28
- }
29
- addGroup(value = null) {
30
- this.control.push(createControlForType(this.config.itemConfig, value));
31
- }
32
- deleteGroup(index) {
33
- this.control.removeAt(index);
34
- }
35
- }
36
- FormGroupListComponent.decorators = [
37
- { type: Component, args: [{
38
- selector: 'crispr-form-group-list',
39
- template: "\n<crispr-field-container\n [config]=\"config\"\n [group]=\"group\"\n [formGroup]=\"group\">\n\n <div [formArrayName]=\"config.controlName\">\n <!-- TODO: add sortBy function -->\n <div *ngFor=\"let control of formArray?.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\" *ngIf=\"config.itemLabelBuilder\"> {{ config.itemLabelBuilder(i) }} </span>\n <button\n mat-icon-button\n *ngIf=\"i + 1 > config.minListLength\">\n <mat-icon (click)=\"deleteGroup(i)\">delete</mat-icon>\n </button>\n </div>\n <div\n [formGroupName]=\"i\">\n <ng-container\n *ngFor=\"let field of config.itemConfig.fields;\"\n crisprField\n [config]=\"field\"\n [value]=\"value && value[i] | initialControlValue : field\"\n [group]=\"control\">\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)=\"addGroup()\">\n {{config.addItemLabel || config.addButtonLabel}}\n </button>\n </div>\n\n</crispr-field-container>\n",
40
- changeDetection: ChangeDetectionStrategy.OnPush,
41
- styles: [".item-header{display:flex;justify-content:space-between}.group-footer{display:flex;justify-content:flex-end}.group-footer button.add{margin-bottom:16px}"]
42
- },] }
43
- ];
44
- //# sourceMappingURL=form-group-list.component.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"form-group-list.component.js","sourceRoot":"","sources":["../../../../../../libs/crispr-forms/src/lib/form-group-list/form-group-list.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAU,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAI3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAExE,MAAM,aAAa,GAAiC;IAClD,cAAc,EAAE,UAAU;IAC1B,aAAa,EAAE,CAAC;CACjB,CAAC;AAEF,MAAM,kBAAkB,GAAG,kBAAkB,CAAsB,oBAAoB,CAAC,CAAC;AAOzF,MAAM,OAAO,sBAAuB,SAAQ,kBAAkB;IAN9D;;QAOE,kBAAa,GAAG,aAAa,CAAA;IA8B/B,CAAC;IAvBC,QAAQ;QACN,KAAK,CAAC,QAAQ,EAAE,CAAC;QACjB,gFAAgF;QAChF,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,OAAoB,CAAC;IAC7C,CAAC;IAED,eAAe,CAAC,MAAa;QAC3B,IAAG,IAAI,CAAC,OAAO,EAAE;YACf,IAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,IAAG,CAAC,EAAE;gBACrB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;aAC/C;iBAAM,IAAI,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE;gBACzC,IAAI,CAAC,QAAQ,EAAE,CAAA;aAChB;SACF;IACH,CAAC;IAED,QAAQ,CAAC,KAAK,GAAG,IAAI;QACnB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;IACzE,CAAC;IAED,WAAW,CAAC,KAAa;QACvB,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;;;YApCF,SAAS,SAAC;gBACT,QAAQ,EAAE,wBAAwB;gBAClC,qzCAA+C;gBAE/C,eAAe,EAAE,uBAAuB,CAAC,MAAM;;aAChD","sourcesContent":["import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';\nimport { FormGroup, FormArray } from '@angular/forms';\n\nimport { FormGroupListConfig } from '../models';\nimport { createControlForType } from '../form.helpers';\nimport { CrisprFieldComponent, crisprControlMixin } from '../abstracts';\n\nconst defaultConfig: Partial<FormGroupListConfig> = {\n addButtonLabel: 'ADD ITEM',\n minListLength: 1,\n};\n\nconst FormGroupListMixin = crisprControlMixin<FormGroupListConfig>(CrisprFieldComponent);\n@Component({\n selector: 'crispr-form-group-list',\n templateUrl: './form-group-list.component.html',\n styleUrls: ['./form-group-list.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class FormGroupListComponent extends FormGroupListMixin implements OnInit {\n defaultConfig = defaultConfig\n group: FormGroup;\n control: FormArray;\n _value: any[]\n // value: any[]; // TODO: not sure how to strongly type this yet\n formArray: FormArray;\n\n ngOnInit() {\n super.ngOnInit();\n // TODO: this is required to ngFor of controls in template, must be a better way\n this.formArray = this.control as FormArray;\n }\n\n setControlValue(values: any[]) {\n if(this.control) {\n if(values?.length > 0) {\n values.forEach(value => this.addGroup(value));\n } else if (this.config.displayInitialItem) {\n this.addGroup()\n }\n }\n }\n\n addGroup(value = null) {\n this.control.push(createControlForType(this.config.itemConfig, value));\n }\n\n deleteGroup(index: number) {\n this.control.removeAt(index);\n }\n}\n\n\n"]}
@@ -1 +0,0 @@
1
- [{"__symbolic":"module","version":4,"metadata":{"FormGroupListComponent":{"__symbolic":"class","extends":{"__symbolic":"error","message":"Symbol reference expected","line":19,"character":44},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":13,"character":1},"arguments":[{"selector":"crispr-form-group-list","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy","line":17,"character":19},"member":"OnPush"},"template":"\n<crispr-field-container\n [config]=\"config\"\n [group]=\"group\"\n [formGroup]=\"group\">\n\n <div [formArrayName]=\"config.controlName\">\n <!-- TODO: add sortBy function -->\n <div *ngFor=\"let control of formArray?.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\" *ngIf=\"config.itemLabelBuilder\"> {{ config.itemLabelBuilder(i) }} </span>\n <button\n mat-icon-button\n *ngIf=\"i + 1 > config.minListLength\">\n <mat-icon (click)=\"deleteGroup(i)\">delete</mat-icon>\n </button>\n </div>\n <div\n [formGroupName]=\"i\">\n <ng-container\n *ngFor=\"let field of config.itemConfig.fields;\"\n crisprField\n [config]=\"field\"\n [value]=\"value && value[i] | initialControlValue : field\"\n [group]=\"control\">\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)=\"addGroup()\">\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}"]}]}],"members":{"ngOnInit":[{"__symbolic":"method"}],"setControlValue":[{"__symbolic":"method"}],"addGroup":[{"__symbolic":"method"}],"deleteGroup":[{"__symbolic":"method"}]}}}}]
@@ -1 +0,0 @@
1
- {"version":3,"file":"form-group-list.component.ngfactory.js","sourceRoot":"","sources":["../../../../../../libs/crispr-forms/src/lib/form-group-list/form-group-list.component.ngfactory.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"form-group-list.component.scss.shim.ngstyle.js","sourceRoot":"","sources":["../../../../../../libs/crispr-forms/src/lib/form-group-list/form-group-list.component.scss.shim.ngstyle.ts"],"names":[],"mappings":"","sourcesContent":["import * as i0 from '@angular/core';\ni0.ComponentFactory;\n"]}
@@ -1,186 +0,0 @@
1
- import { ControlType } from './models';
2
- import { from, of, isObservable, combineLatest } from 'rxjs';
3
- import { FormGroup, FormArray, FormControl } from '@angular/forms';
4
- import { valueIn } from './form.operators';
5
- import { map, startWith } from 'rxjs/operators';
6
- /**
7
- * Watches a single control for a list of values, returns true when field value matches any value in list
8
- * unless an evaluate method is found on config, in which case that method is run on the returned boolean value
9
- * @param group the direct parent of the field we want to watch
10
- * @param config
11
- */
12
- export function checkControlForValues(group, config) {
13
- // check that all the pieces we need are available
14
- if (config && config.controlName && Array.isArray(config.values)) {
15
- return getValueChanges(group, config.controlName).pipe(
16
- // return a boolean, true if value is in the values being watch for, otherwise false
17
- valueIn(config.values), map((isValueInValues) => {
18
- // since we can only check if the value is in the list of watched values, the evaluate function gives us
19
- // a chance to make other decisions based on if the boolean returned, e.g. return true if value not in watched values
20
- if (config.evaluate && config.evaluate instanceof Function) {
21
- return config.evaluate(isValueInValues);
22
- }
23
- else {
24
- return isValueInValues;
25
- }
26
- }));
27
- }
28
- else {
29
- //
30
- return of(true);
31
- }
32
- }
33
- /**
34
- * Watches a list of fields for individual lists of values returning true when any field contains one
35
- * of the values being watched for, or optionally running a function on the array of resolved booleans
36
- * from the listed fields and returning a boolean
37
- * @param group the form group that has the fields to watch as direct descendants
38
- * @param config the configuration to use when calling the function
39
- */
40
- export function checkControlsForValues(group, config) {
41
- // if no config is passed we just want to show the field, so we return an observable of true
42
- if (!config || !config.watchConfigs) {
43
- return of(true);
44
- }
45
- // we run checkControlForValues on every control in the list of WatchConfigs creating
46
- // an array of Observable watching fields for values
47
- const fieldTriggers = config.watchConfigs.map(watchConfig => {
48
- // resolves a boolean, true when field value matches a watched value, otherwise false
49
- return checkControlForValues(group, watchConfig);
50
- });
51
- return combineLatest(fieldTriggers).pipe(startWith([true]), map((booleans) => {
52
- // if the user passed an evaluate function use it
53
- if (config.evaluate && config.evaluate instanceof Function) {
54
- return config.evaluate(booleans);
55
- }
56
- else { // otherwise we return true if any of the watched fields resolve to true
57
- return booleans.some(bool => bool);
58
- }
59
- }));
60
- }
61
- /**
62
- * Watches values on an array of fields, computing their values as they change
63
- * @param group the group to get the fields from, for now it can only be the parent of the computed field
64
- * @param computeFieldsConfig the configuration that drives the computation, holds the names to watch and the
65
- * computation function that get called against the array of values
66
- */
67
- export function computeValueFromFields(group, computeFieldsConfig) {
68
- // TODO: better checking
69
- const { controlNamesToWatch } = computeFieldsConfig;
70
- //creates an observable listener for each control in the controlNamesToWatch array
71
- return combineLatest(controlNamesToWatch.map(controlNameToWatch => getValueChanges(group, controlNameToWatch))).pipe(
72
- // each time a watched field values changes a new array of the latest field values is pipe through to the
73
- // compute callback. Which runs the users logic on the values to compute this fields value
74
- map(valuesArray => computeFieldsConfig.computeCallback(valuesArray)));
75
- }
76
- /**
77
- * A simple wrapper for doing error checking around getting the valueChanges observable from a control on a form group
78
- * @param group the form group we want to pull the observable from
79
- * @param controlName the name of the control who's value we want to subscribe to
80
- */
81
- function getValueChanges(group, controlName) {
82
- const control = group.get(controlName);
83
- if (!control) {
84
- throw new Error(`No control with controlName ${controlName}`);
85
- }
86
- return control.valueChanges;
87
- }
88
- /**
89
- * TODO: move to utils library after library is built
90
- * Allows developer to pass an array of operators into the pipe of an Observable.
91
- * Useful for creating function with a variable amount of operators to be run
92
- * @param observable the observable to pass the operators to
93
- * @param operators array of operators to pipe
94
- */
95
- function pipeOperatorsIntoObservable(observable, operators) {
96
- try {
97
- return operators.reduce((obs, op) => {
98
- return obs.pipe(op);
99
- }, observable);
100
- }
101
- catch (_a) {
102
- console.error('Unable to pipe operators into observable');
103
- return of(null);
104
- }
105
- }
106
- export function callOptionsIfFunction(options, parentGroup, searchString) {
107
- return options instanceof Function ? options(parentGroup, searchString) : options;
108
- }
109
- /**
110
- * The user can give us select options as an array, a function that resolves to a promise,
111
- * or an observable. This functions consumes any of those and returns an observable that
112
- * resolves an array of options
113
- *
114
- * @param options the options passed in from the config
115
- * @param emptyMessageOption the message to display when the array is empty
116
- */
117
- export function observablifyOptions(options, parentGroup, searchString) {
118
- const calledOptions = callOptionsIfFunction(options, parentGroup, searchString);
119
- // if options are a promise
120
- return calledOptions instanceof Promise
121
- // convert to observable
122
- ? from(calledOptions)
123
- // if array that isn't empty
124
- : Array.isArray(calledOptions) && calledOptions.length
125
- // convert to observable
126
- ? of(calledOptions)
127
- // if observable
128
- : isObservable(calledOptions)
129
- // return it
130
- ? calledOptions
131
- // else an empty array
132
- : of([]);
133
- }
134
- /**
135
- * Determines if the field config is for a form control (not a divider, heading or other non-control field)
136
- * */
137
- export function isControlConfig(fieldConfig) {
138
- return 'controlName' in fieldConfig;
139
- }
140
- /**
141
- * builds out form group based on config
142
- * @param config a configuration for a form group
143
- * @param value an object of initial values to pass in
144
- * @param group the form group to modify and build out
145
- */
146
- export function buildFormGroupFromConfig(config, value = null, group = new FormGroup({})) {
147
- config.fields.forEach((controlConfig) => {
148
- var _a;
149
- if (isControlConfig(controlConfig)) {
150
- // then add a control to the group using the controlName from configuration
151
- const { controlName } = controlConfig;
152
- // if there's a value object and it has a non-null/undefined value for this field use it.
153
- // Otherwise, default to null
154
- const controlValue = (_a = (value && value[controlName])) !== null && _a !== void 0 ? _a : null;
155
- group.addControl(controlName, createControlForType(controlConfig, controlValue));
156
- }
157
- });
158
- group.setValidators(config.validators);
159
- return group;
160
- }
161
- /**
162
- * Analyze the config and build a form control to spec. Notice we don't use FormBuilder here
163
- * as we want to keep this function pure.
164
- * @param controlConfig the configuration object for the control to build
165
- * @param value an initial value to use if passed in
166
- */
167
- export function createControlForType(controlConfig, value = null) {
168
- // build form control out based on the control type
169
- const control = controlConfig.controlType === ControlType.SUB_GROUP
170
- ? buildFormGroupFromConfig(controlConfig, value)
171
- : controlConfig.controlType === ControlType.GROUP_LIST
172
- ? new FormArray([], controlConfig.validators)
173
- : new FormControl(value || null, controlConfig.validators);
174
- return control;
175
- }
176
- /**
177
- * A basic filter function that filters the search string against the label of the options object
178
- * @param options the array of options to filter
179
- * @param searchString the string from the input
180
- */
181
- export function filterOptionsByLabel(options, searchString) {
182
- return options.filter(option => {
183
- return option.label && option.label.toLowerCase().includes(searchString.toLowerCase());
184
- });
185
- }
186
- //# sourceMappingURL=form.helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"form.helpers.js","sourceRoot":"","sources":["../../../../../libs/crispr-forms/src/lib/form.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,WAAW,EAOZ,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,IAAI,EAE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CAAC,EAAE;QAC7B,OAAO,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC;IACzF,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n SelectOption,\n AnyFieldConfig,\n FormConfig,\n ControlType,\n FormGroupListConfig,\n CrisprControlConfig,\n OptionsType,\n AutocompleteOptionsCallback,\n CrisprFieldConfig,\n ControlValue\n} from './models';\nimport {\n from,\n Observable,\n of,\n isObservable,\n combineLatest,\n OperatorFunction\n} from 'rxjs';\nimport { FormGroup, FormArray, FormControl } from '@angular/forms';\nimport { valueIn } from './form.operators';\nimport { map, startWith } from 'rxjs/operators';\n\n/**\n * DYNAMIC FORM UTILS: a collection of pure/mostly pure functions that are useful both internally and for\n * developing the consuming app.\n *\n * They are sorted by use case: building out the form object; helper functions to use with the disabled$ function;\n * helper functions to use with the compute field function; and other logic shared between components\n */\n\n/**\n * Required configuration to use with checkControlForValues function\n */\nexport interface CheckControlConfig {\n // the control name to watch\n controlName: string;\n // the values to watch for\n values: string[];\n // the function to run on the boolean returned by the watcher\n evaluate?: (isValueInValues: boolean) => boolean;\n}\n\n/**\n* Watches a single control for a list of values, returns true when field value matches any value in list\n* unless an evaluate method is found on config, in which case that method is run on the returned boolean value\n* @param group the direct parent of the field we want to watch\n* @param config\n*/\nexport function checkControlForValues(group: FormGroup, config: CheckControlConfig): Observable<boolean> {\n // check that all the pieces we need are available\n if (config && config.controlName && Array.isArray(config.values)) {\n return getValueChanges(group, config.controlName).pipe(\n // return a boolean, true if value is in the values being watch for, otherwise false\n valueIn(config.values),\n map((isValueInValues: boolean) => {\n // since we can only check if the value is in the list of watched values, the evaluate function gives us\n // a chance to make other decisions based on if the boolean returned, e.g. return true if value not in watched values\n if ( config.evaluate && config.evaluate instanceof Function ) {\n return config.evaluate(isValueInValues);\n } else { return isValueInValues; }\n })\n );\n } else {\n //\n return of(true);\n }\n}\n\n/**\n * The required configuration for running the checkControlsForValues function.\n */\nexport interface CheckControlsConfig {\n // an array of controls to watch and the values to check for\n watchConfigs: CheckControlConfig[];\n // the function to run against the array of current field valueIn responses\n evaluate?: ( bools: boolean[] ) => boolean;\n}\n\n/**\n * Watches a list of fields for individual lists of values returning true when any field contains one\n * of the values being watched for, or optionally running a function on the array of resolved booleans\n * from the listed fields and returning a boolean\n * @param group the form group that has the fields to watch as direct descendants\n * @param config the configuration to use when calling the function\n */\nexport function checkControlsForValues(group: FormGroup, config: CheckControlsConfig): Observable<any> {\n // if no config is passed we just want to show the field, so we return an observable of true\n if (!config || !config.watchConfigs) { return of(true); }\n // we run checkControlForValues on every control in the list of WatchConfigs creating\n // an array of Observable watching fields for values\n const fieldTriggers = config.watchConfigs.map(watchConfig => {\n // resolves a boolean, true when field value matches a watched value, otherwise false\n return checkControlForValues(group, watchConfig);\n });\n\n return combineLatest(\n fieldTriggers\n ).pipe(\n startWith([true]),\n map((booleans: boolean[]) => {\n // if the user passed an evaluate function use it\n if (config.evaluate && config.evaluate instanceof Function) {\n return config.evaluate(booleans);\n } else { // otherwise we return true if any of the watched fields resolve to true\n return booleans.some(bool => bool);\n }\n })\n );\n}\n\n/**\n * The required configuration when running the computeValue function\n */\nexport interface ComputeFieldConfig<T = any, RT = any> {\n // array of control names who's values we want to watch\n controlNamesToWatch: string[];\n // the function we want to call on the array of watched values to compute the value of the control we\n computeCallback: (\n values: (T)[]\n ) => RT;\n}\n\n/**\n * Watches values on an array of fields, computing their values as they change\n * @param group the group to get the fields from, for now it can only be the parent of the computed field\n * @param computeFieldsConfig the configuration that drives the computation, holds the names to watch and the\n * computation function that get called against the array of values\n */\nexport function computeValueFromFields(group: FormGroup, computeFieldsConfig: ComputeFieldConfig): Observable<any> {\n // TODO: better checking\n const { controlNamesToWatch } = computeFieldsConfig;\n //creates an observable listener for each control in the controlNamesToWatch array\n return combineLatest(\n controlNamesToWatch.map(controlNameToWatch => getValueChanges(group, controlNameToWatch))\n ).pipe(\n // each time a watched field values changes a new array of the latest field values is pipe through to the\n // compute callback. Which runs the users logic on the values to compute this fields value\n map(valuesArray => computeFieldsConfig.computeCallback(valuesArray)),\n );\n}\n\n/**\n * A simple wrapper for doing error checking around getting the valueChanges observable from a control on a form group\n * @param group the form group we want to pull the observable from\n * @param controlName the name of the control who's value we want to subscribe to\n */\nfunction getValueChanges(group: FormGroup, controlName: string) {\n const control = group.get(controlName);\n if (!control) {\n throw new Error(`No control with controlName ${controlName}`, );\n }\n return control.valueChanges;\n}\n/**\n * TODO: move to utils library after library is built\n * Allows developer to pass an array of operators into the pipe of an Observable.\n * Useful for creating function with a variable amount of operators to be run\n * @param observable the observable to pass the operators to\n * @param operators array of operators to pipe\n */\nfunction pipeOperatorsIntoObservable(observable: Observable<any>, operators: OperatorFunction<any, any>[]) {\n try {\n return operators.reduce((obs: Observable<{}>, op: OperatorFunction<{}, {}>) => {\n return obs.pipe(op);\n }, observable);\n } catch {\n console.error('Unable to pipe operators into observable');\n return of(null);\n }\n}\n\n\nexport function callOptionsIfFunction(\n options: OptionsType | AutocompleteOptionsCallback,\n parentGroup?: FormGroup,\n searchString?: string\n): OptionsType {\n return options instanceof Function ? options(parentGroup, searchString) : options;\n}\n/**\n * The user can give us select options as an array, a function that resolves to a promise,\n * or an observable. This functions consumes any of those and returns an observable that\n * resolves an array of options\n *\n * @param options the options passed in from the config\n * @param emptyMessageOption the message to display when the array is empty\n */\nexport function observablifyOptions(\n options: OptionsType,\n parentGroup: FormGroup,\n searchString?: string,\n): Observable<SelectOption[]> {\n const calledOptions = callOptionsIfFunction(options, parentGroup, searchString);\n // if options are a promise\n return calledOptions instanceof Promise\n // convert to observable\n ? from(calledOptions)\n // if array that isn't empty\n : Array.isArray(calledOptions) && calledOptions.length\n // convert to observable\n ? of(calledOptions)\n // if observable\n : isObservable(calledOptions)\n // return it\n ? calledOptions\n // else an empty array\n : of([]);\n}\n\n/**\n * Determines if the field config is for a form control (not a divider, heading or other non-control field)\n * */\nexport function isControlConfig(fieldConfig: CrisprFieldConfig): fieldConfig is CrisprControlConfig {\n return 'controlName' in fieldConfig;\n}\n/**\n * builds out form group based on config\n * @param config a configuration for a form group\n * @param value an object of initial values to pass in\n * @param group the form group to modify and build out\n */\nexport function buildFormGroupFromConfig(config: FormConfig, value = null, group: FormGroup = new FormGroup({}) ) {\n config.fields.forEach( (controlConfig: AnyFieldConfig) => {\n if (isControlConfig(controlConfig)) {\n // then add a control to the group using the controlName from configuration\n const {controlName} = controlConfig;\n // if there's a value object and it has a non-null/undefined value for this field use it.\n // Otherwise, default to null\n const controlValue = (value && value[controlName]) ?? null;\n group.addControl(controlName, createControlForType(controlConfig, controlValue));\n }\n });\n group.setValidators(config.validators);\n return group;\n}\n\n/**\n * Analyze the config and build a form control to spec. Notice we don't use FormBuilder here\n * as we want to keep this function pure.\n * @param controlConfig the configuration object for the control to build\n * @param value an initial value to use if passed in\n */\nexport function createControlForType(controlConfig: AnyFieldConfig, value: ControlValue = null) {\n // build form control out based on the control type\n const control = controlConfig.controlType === ControlType.SUB_GROUP\n ? buildFormGroupFromConfig(controlConfig as FormConfig, value)\n : controlConfig.controlType === ControlType.GROUP_LIST\n ? new FormArray([], (controlConfig as FormGroupListConfig).validators)\n : new FormControl(\n value || null,\n (controlConfig as CrisprControlConfig).validators\n );\n\n return control;\n}\n\n/**\n * A basic filter function that filters the search string against the label of the options object\n * @param options the array of options to filter\n * @param searchString the string from the input\n */\nexport function filterOptionsByLabel(options: SelectOption[], searchString: string) {\n return options.filter(option => {\n return option.label && option.label.toLowerCase().includes(searchString.toLowerCase());\n });\n}\n"]}
@@ -1 +0,0 @@
1
- [{"__symbolic":"module","version":4,"metadata":{"CheckControlConfig":{"__symbolic":"interface"},"checkControlForValues":{"__symbolic":"function"},"CheckControlsConfig":{"__symbolic":"interface"},"checkControlsForValues":{"__symbolic":"function"},"ComputeFieldConfig":{"__symbolic":"interface"},"computeValueFromFields":{"__symbolic":"function"},"callOptionsIfFunction":{"__symbolic":"function","parameters":["options","parentGroup","searchString"],"value":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"instanceof","left":{"__symbolic":"reference","name":"options"},"right":{"__symbolic":"reference","name":"Function"}},"thenExpression":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"options"},"arguments":[{"__symbolic":"reference","name":"parentGroup"},{"__symbolic":"reference","name":"searchString"}]},"elseExpression":{"__symbolic":"reference","name":"options"}}},"observablifyOptions":{"__symbolic":"function"},"isControlConfig":{"__symbolic":"function","parameters":["fieldConfig"],"value":{"__symbolic":"binop","operator":"in","left":"controlName","right":{"__symbolic":"reference","name":"fieldConfig"}}},"buildFormGroupFromConfig":{"__symbolic":"function"},"createControlForType":{"__symbolic":"function"},"filterOptionsByLabel":{"__symbolic":"function","parameters":["options","searchString"],"value":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"options"},"member":"filter"},"arguments":[{"__symbolic":"error","message":"Lambda not supported","line":264,"character":24}]}}}}]
@@ -1,24 +0,0 @@
1
- import { map } from 'rxjs/operators';
2
- export function valueIn(values) {
3
- return map((value) => {
4
- if (value) {
5
- return values.some(v => {
6
- if (isRegex(v)) {
7
- const trimmedStringForRegex = v.substr(1, v.length - 2);
8
- const regex = new RegExp(trimmedStringForRegex);
9
- return regex.test(value);
10
- }
11
- else {
12
- return v === value;
13
- }
14
- });
15
- }
16
- else {
17
- return false;
18
- }
19
- });
20
- }
21
- function isRegex(string) {
22
- return string.startsWith('/') && string.endsWith('/');
23
- }
24
- //# sourceMappingURL=form.operators.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"form.operators.js","sourceRoot":"","sources":["../../../../../libs/crispr-forms/src/lib/form.operators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErC,MAAM,UAAU,OAAO,CAAE,MAAgB;IACvC,OAAO,GAAG,CAAE,CAAC,KAAa,EAAE,EAAE;QAC5B,IAAI,KAAK,EAAE;YACT,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;gBACrB,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE;oBACd,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;oBACxD,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,qBAAqB,CAAC,CAAC;oBAChD,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;iBAC1B;qBAAM;oBACL,OAAO,CAAC,KAAK,KAAK,CAAC;iBACpB;YACH,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,OAAO,KAAK,CAAC;SACd;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,OAAO,CAAC,MAAc;IAC7B,OAAO,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import { map } from 'rxjs/operators';\n\nexport function valueIn (values: string[]) {\n return map( (value: string) => {\n if (value) {\n return values.some(v => {\n if (isRegex(v)) {\n const trimmedStringForRegex = v.substr(1, v.length - 2);\n const regex = new RegExp(trimmedStringForRegex);\n return regex.test(value);\n } else {\n return v === value;\n }\n });\n } else {\n return false;\n }\n });\n}\n\nfunction isRegex(string: string) {\n return string.startsWith('/') && string.endsWith('/');\n}\n"]}
@@ -1 +0,0 @@
1
- [{"__symbolic":"module","version":4,"metadata":{"valueIn":{"__symbolic":"function","parameters":["values"],"value":{"__symbolic":"call","expression":{"__symbolic":"reference","module":"rxjs/operators","name":"map","line":3,"character":9},"arguments":[{"__symbolic":"error","message":"Lambda not supported","line":3,"character":14}]}}}}]