@formio/angular 7.0.0 → 7.5.0-rc.1-dev.1060.2e45ec8

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 (398) hide show
  1. package/.dockerignore +5 -0
  2. package/.editorconfig +13 -0
  3. package/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
  4. package/.github/ISSUE_TEMPLATE/custom-components-support-request.md +15 -0
  5. package/.github/ISSUE_TEMPLATE/question.md +8 -0
  6. package/.github/pull_request_template.md +35 -0
  7. package/.github/workflows/repo.yml +145 -0
  8. package/.travis.yml +4 -0
  9. package/.yo-rc.json +7 -0
  10. package/CHANGELOG.md +1153 -0
  11. package/Dockerfile +20 -0
  12. package/LICENSE +21 -0
  13. package/README.md +204 -13
  14. package/angular.json +38 -0
  15. package/bs-config.json +11 -0
  16. package/package.json +54 -57
  17. package/projects/angular-formio/README.md +24 -0
  18. package/projects/angular-formio/auth/ng-package.json +5 -0
  19. package/projects/angular-formio/auth/src/auth.component.html +11 -0
  20. package/projects/angular-formio/auth/src/auth.component.ts +5 -0
  21. package/projects/angular-formio/auth/src/auth.config.ts +72 -0
  22. package/projects/angular-formio/auth/src/auth.module.ts +33 -0
  23. package/projects/angular-formio/auth/src/auth.routes.ts +34 -0
  24. package/projects/angular-formio/auth/src/auth.service.ts +221 -0
  25. package/{auth/index.d.ts → projects/angular-formio/auth/src/index.ts} +1 -2
  26. package/projects/angular-formio/auth/src/login/login.component.html +1 -0
  27. package/projects/angular-formio/auth/src/login/login.component.ts +11 -0
  28. package/projects/angular-formio/auth/src/public_api.ts +5 -0
  29. package/projects/angular-formio/auth/src/register/register.component.html +1 -0
  30. package/projects/angular-formio/auth/src/register/register.component.ts +11 -0
  31. package/projects/angular-formio/auth/src/resetpass/resetpass.component.html +1 -0
  32. package/projects/angular-formio/auth/src/resetpass/resetpass.component.ts +8 -0
  33. package/projects/angular-formio/embed/ng-package.json +5 -0
  34. package/projects/angular-formio/embed/src/app.service.ts +59 -0
  35. package/projects/angular-formio/embed/src/builder.component.ts +19 -0
  36. package/projects/angular-formio/embed/src/embed.module.ts +23 -0
  37. package/projects/angular-formio/embed/src/formio.component.ts +27 -0
  38. package/projects/angular-formio/embed/src/index.ts +6 -0
  39. package/projects/angular-formio/grid/ng-package.json +5 -0
  40. package/projects/angular-formio/grid/src/GridBodyComponent.ts +80 -0
  41. package/projects/angular-formio/grid/src/GridFooterComponent.ts +25 -0
  42. package/projects/angular-formio/grid/src/GridHeaderComponent.ts +25 -0
  43. package/projects/angular-formio/grid/src/form/FormGridBody.component.html +22 -0
  44. package/projects/angular-formio/grid/src/form/FormGridBody.component.scss +4 -0
  45. package/projects/angular-formio/grid/src/form/FormGridBody.component.ts +46 -0
  46. package/projects/angular-formio/grid/src/form/FormGridFooter.component.html +21 -0
  47. package/projects/angular-formio/grid/src/form/FormGridFooter.component.ts +23 -0
  48. package/projects/angular-formio/grid/src/form/FormGridHeader.component.html +18 -0
  49. package/projects/angular-formio/grid/src/form/FormGridHeader.component.ts +24 -0
  50. package/projects/angular-formio/grid/src/form/index.ts +8 -0
  51. package/projects/angular-formio/grid/src/form/time-since.pipe.ts +31 -0
  52. package/projects/angular-formio/grid/src/grid.component.html +18 -0
  53. package/projects/angular-formio/grid/src/grid.component.scss +9 -0
  54. package/projects/angular-formio/grid/src/grid.component.ts +242 -0
  55. package/projects/angular-formio/grid/src/grid.footer.scss +14 -0
  56. package/projects/angular-formio/grid/src/grid.module.ts +49 -0
  57. package/projects/angular-formio/grid/src/grid.service.ts +16 -0
  58. package/{grid/index.d.ts → projects/angular-formio/grid/src/index.ts} +0 -1
  59. package/projects/angular-formio/grid/src/public_api.ts +5 -0
  60. package/projects/angular-formio/grid/src/submission/SubmissionGridBody.component.html +7 -0
  61. package/projects/angular-formio/grid/src/submission/SubmissionGridBody.component.ts +39 -0
  62. package/projects/angular-formio/grid/src/submission/SubmissionGridFooter.component.html +18 -0
  63. package/projects/angular-formio/grid/src/submission/SubmissionGridFooter.component.ts +20 -0
  64. package/projects/angular-formio/grid/src/submission/SubmissionGridHeader.component.html +11 -0
  65. package/projects/angular-formio/grid/src/submission/SubmissionGridHeader.component.ts +72 -0
  66. package/{grid/submission/index.d.ts → projects/angular-formio/grid/src/submission/index.ts} +4 -6
  67. package/projects/angular-formio/grid/src/types/grid-column.ts +7 -0
  68. package/projects/angular-formio/grid/src/types/grid-footer-positions.ts +5 -0
  69. package/projects/angular-formio/grid/src/types/grid-header.ts +14 -0
  70. package/projects/angular-formio/karma.conf.js +32 -0
  71. package/projects/angular-formio/manager/ng-package.json +5 -0
  72. package/projects/angular-formio/manager/src/create/create.component.ts +11 -0
  73. package/projects/angular-formio/manager/src/delete/delete.component.html +6 -0
  74. package/projects/angular-formio/manager/src/delete/delete.component.ts +37 -0
  75. package/projects/angular-formio/manager/src/edit/edit.component.html +19 -0
  76. package/projects/angular-formio/manager/src/edit/edit.component.ts +110 -0
  77. package/projects/angular-formio/manager/src/form/form.component.html +32 -0
  78. package/projects/angular-formio/manager/src/form/form.component.ts +73 -0
  79. package/projects/angular-formio/manager/src/form-manager.config.ts +31 -0
  80. package/projects/angular-formio/manager/src/form-manager.module.ts +54 -0
  81. package/projects/angular-formio/manager/src/form-manager.routes.ts +75 -0
  82. package/projects/angular-formio/manager/src/form-manager.service.ts +190 -0
  83. package/projects/angular-formio/manager/src/index/index.component.html +14 -0
  84. package/projects/angular-formio/manager/src/index/index.component.scss +22 -0
  85. package/projects/angular-formio/manager/src/index/index.component.ts +100 -0
  86. package/{manager/index.d.ts → projects/angular-formio/manager/src/index.ts} +0 -1
  87. package/projects/angular-formio/manager/src/public_api.ts +5 -0
  88. package/projects/angular-formio/manager/src/submission/delete/delete.component.html +6 -0
  89. package/projects/angular-formio/manager/src/submission/delete/delete.component.ts +26 -0
  90. package/projects/angular-formio/manager/src/submission/edit/edit.component.html +7 -0
  91. package/projects/angular-formio/manager/src/submission/edit/edit.component.ts +18 -0
  92. package/projects/angular-formio/manager/src/submission/index/index.component.html +1 -0
  93. package/projects/angular-formio/manager/src/submission/index/index.component.ts +18 -0
  94. package/projects/angular-formio/manager/src/submission/submission/submission.component.html +8 -0
  95. package/projects/angular-formio/manager/src/submission/submission/submission.component.ts +24 -0
  96. package/projects/angular-formio/manager/src/submission/view/view.component.html +7 -0
  97. package/projects/angular-formio/manager/src/submission/view/view.component.ts +9 -0
  98. package/projects/angular-formio/manager/src/view/view.component.html +11 -0
  99. package/projects/angular-formio/manager/src/view/view.component.ts +44 -0
  100. package/projects/angular-formio/ng-package.json +7 -0
  101. package/projects/angular-formio/package.json +37 -0
  102. package/projects/angular-formio/resource/ng-package.json +5 -0
  103. package/projects/angular-formio/resource/src/create/create.component.html +13 -0
  104. package/projects/angular-formio/resource/src/create/create.component.scss +3 -0
  105. package/projects/angular-formio/resource/src/create/create.component.ts +37 -0
  106. package/projects/angular-formio/resource/src/delete/delete.component.html +5 -0
  107. package/projects/angular-formio/resource/src/delete/delete.component.ts +24 -0
  108. package/projects/angular-formio/resource/src/edit/edit.component.html +7 -0
  109. package/projects/angular-formio/resource/src/edit/edit.component.ts +35 -0
  110. package/projects/angular-formio/resource/src/index/index.component.html +10 -0
  111. package/projects/angular-formio/resource/src/index/index.component.ts +64 -0
  112. package/projects/angular-formio/resource/src/index.js +24 -0
  113. package/{resource/index.d.ts → projects/angular-formio/resource/src/index.ts} +0 -1
  114. package/projects/angular-formio/resource/src/public_api.ts +5 -0
  115. package/projects/angular-formio/resource/src/resource.component.html +7 -0
  116. package/projects/angular-formio/resource/src/resource.component.ts +48 -0
  117. package/projects/angular-formio/resource/src/resource.config.ts +17 -0
  118. package/projects/angular-formio/resource/src/resource.module.ts +43 -0
  119. package/projects/angular-formio/resource/src/resource.routes.ts +43 -0
  120. package/projects/angular-formio/resource/src/resource.service.ts +258 -0
  121. package/projects/angular-formio/resource/src/resources.service.ts +24 -0
  122. package/projects/angular-formio/resource/src/view/view.component.html +6 -0
  123. package/projects/angular-formio/resource/src/view/view.component.ts +19 -0
  124. package/projects/angular-formio/src/FormioBaseComponent.ts +554 -0
  125. package/projects/angular-formio/src/components/alerts/formio.alerts.component.html +3 -0
  126. package/projects/angular-formio/src/components/alerts/formio.alerts.component.ts +19 -0
  127. package/projects/angular-formio/src/components/alerts/formio.alerts.ts +21 -0
  128. package/projects/angular-formio/src/components/alerts/parse-html-content.pipe.ts +15 -0
  129. package/projects/angular-formio/src/components/formbuilder/formbuilder.component.html +1 -0
  130. package/projects/angular-formio/src/components/formbuilder/formbuilder.component.ts +213 -0
  131. package/projects/angular-formio/src/components/formio/formio.component.html +8 -0
  132. package/projects/angular-formio/src/components/formio/formio.component.ts +33 -0
  133. package/projects/angular-formio/src/components/formioreport/formioreport.component.html +8 -0
  134. package/projects/angular-formio/src/components/formioreport/formioreport.component.ts +95 -0
  135. package/projects/angular-formio/src/components/loader/formio.loader.component.html +3 -0
  136. package/projects/angular-formio/src/components/loader/formio.loader.component.scss +26 -0
  137. package/projects/angular-formio/src/components/loader/formio.loader.component.ts +10 -0
  138. package/{core.d.ts → projects/angular-formio/src/core.ts} +12 -2
  139. package/projects/angular-formio/src/custom-tags.service.ts +9 -0
  140. package/projects/angular-formio/src/formio-promise.service.ts +36 -0
  141. package/projects/angular-formio/src/formio.common.ts +91 -0
  142. package/projects/angular-formio/src/formio.config.ts +26 -0
  143. package/projects/angular-formio/src/formio.module.ts +38 -0
  144. package/projects/angular-formio/src/formio.service.ts +57 -0
  145. package/projects/angular-formio/src/formio.utils.ts +23 -0
  146. package/{index.d.ts → projects/angular-formio/src/index.ts} +0 -1
  147. package/projects/angular-formio/src/public-api.ts +5 -0
  148. package/projects/angular-formio/src/test.ts +28 -0
  149. package/projects/angular-formio/src/types/alerts-position.ts +6 -0
  150. package/projects/angular-formio/src/types/formio-metadata.ts +10 -0
  151. package/projects/angular-formio/src/types/formio-submission.ts +20 -0
  152. package/projects/angular-formio/tsconfig.lib.json +27 -0
  153. package/projects/angular-formio/tsconfig.lib.prod.json +8 -0
  154. package/projects/angular-formio/tsconfig.spec.json +17 -0
  155. package/projects/angular-formio/tslint.json +17 -0
  156. package/tsconfig.json +39 -0
  157. package/tslint.json +140 -0
  158. package/FormioBaseComponent.d.ts +0 -93
  159. package/FormioBaseComponent.d.ts.map +0 -1
  160. package/auth/auth.component.d.ts +0 -6
  161. package/auth/auth.component.d.ts.map +0 -1
  162. package/auth/auth.config.d.ts +0 -63
  163. package/auth/auth.config.d.ts.map +0 -1
  164. package/auth/auth.module.d.ts +0 -17
  165. package/auth/auth.module.d.ts.map +0 -1
  166. package/auth/auth.routes.d.ts +0 -4
  167. package/auth/auth.routes.d.ts.map +0 -1
  168. package/auth/auth.service.d.ts +0 -41
  169. package/auth/auth.service.d.ts.map +0 -1
  170. package/auth/formio-angular-auth.d.ts.map +0 -1
  171. package/auth/index.d.ts.map +0 -1
  172. package/auth/login/login.component.d.ts +0 -10
  173. package/auth/login/login.component.d.ts.map +0 -1
  174. package/auth/register/register.component.d.ts +0 -10
  175. package/auth/register/register.component.d.ts.map +0 -1
  176. package/auth/resetpass/resetpass.component.d.ts +0 -9
  177. package/auth/resetpass/resetpass.component.d.ts.map +0 -1
  178. package/components/alerts/formio.alerts.component.d.ts +0 -12
  179. package/components/alerts/formio.alerts.component.d.ts.map +0 -1
  180. package/components/alerts/formio.alerts.d.ts +0 -12
  181. package/components/alerts/formio.alerts.d.ts.map +0 -1
  182. package/components/alerts/parse-html-content.pipe.d.ts +0 -8
  183. package/components/alerts/parse-html-content.pipe.d.ts.map +0 -1
  184. package/components/formbuilder/formbuilder.component.d.ts +0 -37
  185. package/components/formbuilder/formbuilder.component.d.ts.map +0 -1
  186. package/components/formio/formio.component.d.ts +0 -15
  187. package/components/formio/formio.component.d.ts.map +0 -1
  188. package/components/formioreport/formioreport.component.d.ts +0 -20
  189. package/components/formioreport/formioreport.component.d.ts.map +0 -1
  190. package/components/loader/formio.loader.component.d.ts +0 -7
  191. package/components/loader/formio.loader.component.d.ts.map +0 -1
  192. package/core.d.ts.map +0 -1
  193. package/custom-tags.service.d.ts +0 -8
  194. package/custom-tags.service.d.ts.map +0 -1
  195. package/esm2022/FormioBaseComponent.mjs +0 -583
  196. package/esm2022/auth/auth.component.mjs +0 -12
  197. package/esm2022/auth/auth.config.mjs +0 -21
  198. package/esm2022/auth/auth.module.mjs +0 -46
  199. package/esm2022/auth/auth.routes.mjs +0 -32
  200. package/esm2022/auth/auth.service.mjs +0 -199
  201. package/esm2022/auth/formio-angular-auth.mjs +0 -5
  202. package/esm2022/auth/index.mjs +0 -9
  203. package/esm2022/auth/login/login.component.mjs +0 -20
  204. package/esm2022/auth/register/register.component.mjs +0 -20
  205. package/esm2022/auth/resetpass/resetpass.component.mjs +0 -17
  206. package/esm2022/components/alerts/formio.alerts.component.mjs +0 -28
  207. package/esm2022/components/alerts/formio.alerts.mjs +0 -13
  208. package/esm2022/components/alerts/parse-html-content.pipe.mjs +0 -19
  209. package/esm2022/components/formbuilder/formbuilder.component.mjs +0 -202
  210. package/esm2022/components/formio/formio.component.mjs +0 -43
  211. package/esm2022/components/formioreport/formioreport.component.mjs +0 -86
  212. package/esm2022/components/loader/formio.loader.component.mjs +0 -15
  213. package/esm2022/core.mjs +0 -18
  214. package/esm2022/custom-tags.service.mjs +0 -14
  215. package/esm2022/formio-angular.mjs +0 -5
  216. package/esm2022/formio-promise.service.mjs +0 -36
  217. package/esm2022/formio.common.mjs +0 -11
  218. package/esm2022/formio.config.mjs +0 -29
  219. package/esm2022/formio.module.mjs +0 -59
  220. package/esm2022/formio.service.mjs +0 -62
  221. package/esm2022/formio.utils.mjs +0 -21
  222. package/esm2022/grid/GridBodyComponent.mjs +0 -89
  223. package/esm2022/grid/GridFooterComponent.mjs +0 -44
  224. package/esm2022/grid/GridHeaderComponent.mjs +0 -34
  225. package/esm2022/grid/form/FormGridBody.component.mjs +0 -63
  226. package/esm2022/grid/form/FormGridFooter.component.mjs +0 -26
  227. package/esm2022/grid/form/FormGridHeader.component.mjs +0 -27
  228. package/esm2022/grid/form/index.mjs +0 -9
  229. package/esm2022/grid/form/time-since.pipe.mjs +0 -37
  230. package/esm2022/grid/formio-angular-grid.mjs +0 -5
  231. package/esm2022/grid/grid.component.mjs +0 -257
  232. package/esm2022/grid/grid.module.mjs +0 -79
  233. package/esm2022/grid/grid.service.mjs +0 -18
  234. package/esm2022/grid/index.mjs +0 -13
  235. package/esm2022/grid/submission/SubmissionGridBody.component.mjs +0 -43
  236. package/esm2022/grid/submission/SubmissionGridFooter.component.mjs +0 -23
  237. package/esm2022/grid/submission/SubmissionGridHeader.component.mjs +0 -63
  238. package/esm2022/grid/submission/index.mjs +0 -9
  239. package/esm2022/grid/types/grid-column.mjs +0 -2
  240. package/esm2022/grid/types/grid-footer-positions.mjs +0 -7
  241. package/esm2022/grid/types/grid-header.mjs +0 -6
  242. package/esm2022/index.mjs +0 -3
  243. package/esm2022/manager/create/create.component.mjs +0 -18
  244. package/esm2022/manager/delete/delete.component.mjs +0 -42
  245. package/esm2022/manager/edit/edit.component.mjs +0 -125
  246. package/esm2022/manager/form/form.component.mjs +0 -80
  247. package/esm2022/manager/form-manager.config.mjs +0 -18
  248. package/esm2022/manager/form-manager.module.mjs +0 -83
  249. package/esm2022/manager/form-manager.routes.mjs +0 -74
  250. package/esm2022/manager/form-manager.service.mjs +0 -185
  251. package/esm2022/manager/formio-angular-manager.mjs +0 -5
  252. package/esm2022/manager/index/index.component.mjs +0 -108
  253. package/esm2022/manager/index.mjs +0 -16
  254. package/esm2022/manager/submission/delete/delete.component.mjs +0 -32
  255. package/esm2022/manager/submission/edit/edit.component.mjs +0 -25
  256. package/esm2022/manager/submission/index/index.component.mjs +0 -25
  257. package/esm2022/manager/submission/submission/submission.component.mjs +0 -29
  258. package/esm2022/manager/submission/view/view.component.mjs +0 -17
  259. package/esm2022/manager/view/view.component.mjs +0 -52
  260. package/esm2022/resource/create/create.component.mjs +0 -43
  261. package/esm2022/resource/delete/delete.component.mjs +0 -29
  262. package/esm2022/resource/edit/edit.component.mjs +0 -42
  263. package/esm2022/resource/formio-angular-resource.mjs +0 -5
  264. package/esm2022/resource/index/index.component.mjs +0 -69
  265. package/esm2022/resource/index.mjs +0 -12
  266. package/esm2022/resource/resource.component.mjs +0 -46
  267. package/esm2022/resource/resource.config.mjs +0 -13
  268. package/esm2022/resource/resource.module.mjs +0 -62
  269. package/esm2022/resource/resource.routes.mjs +0 -42
  270. package/esm2022/resource/resource.service.mjs +0 -229
  271. package/esm2022/resource/resources.service.mjs +0 -25
  272. package/esm2022/resource/view/view.component.mjs +0 -25
  273. package/esm2022/types/alerts-position.mjs +0 -8
  274. package/esm2022/types/formio-metadata.mjs +0 -2
  275. package/esm2022/types/formio-submission.mjs +0 -6
  276. package/fesm2022/formio-angular-auth.mjs +0 -345
  277. package/fesm2022/formio-angular-auth.mjs.map +0 -1
  278. package/fesm2022/formio-angular-grid.mjs +0 -771
  279. package/fesm2022/formio-angular-grid.mjs.map +0 -1
  280. package/fesm2022/formio-angular-manager.mjs +0 -822
  281. package/fesm2022/formio-angular-manager.mjs.map +0 -1
  282. package/fesm2022/formio-angular-resource.mjs +0 -571
  283. package/fesm2022/formio-angular-resource.mjs.map +0 -1
  284. package/fesm2022/formio-angular.mjs +0 -1186
  285. package/fesm2022/formio-angular.mjs.map +0 -1
  286. package/formio-angular.d.ts.map +0 -1
  287. package/formio-promise.service.d.ts +0 -16
  288. package/formio-promise.service.d.ts.map +0 -1
  289. package/formio.common.d.ts +0 -73
  290. package/formio.common.d.ts.map +0 -1
  291. package/formio.config.d.ts +0 -20
  292. package/formio.config.d.ts.map +0 -1
  293. package/formio.module.d.ts +0 -15
  294. package/formio.module.d.ts.map +0 -1
  295. package/formio.service.d.ts +0 -18
  296. package/formio.service.d.ts.map +0 -1
  297. package/formio.utils.d.ts +0 -2
  298. package/formio.utils.d.ts.map +0 -1
  299. package/grid/GridBodyComponent.d.ts +0 -35
  300. package/grid/GridBodyComponent.d.ts.map +0 -1
  301. package/grid/GridFooterComponent.d.ts +0 -20
  302. package/grid/GridFooterComponent.d.ts.map +0 -1
  303. package/grid/GridHeaderComponent.d.ts +0 -16
  304. package/grid/GridHeaderComponent.d.ts.map +0 -1
  305. package/grid/form/FormGridBody.component.d.ts +0 -19
  306. package/grid/form/FormGridBody.component.d.ts.map +0 -1
  307. package/grid/form/FormGridFooter.component.d.ts +0 -10
  308. package/grid/form/FormGridFooter.component.d.ts.map +0 -1
  309. package/grid/form/FormGridHeader.component.d.ts +0 -11
  310. package/grid/form/FormGridHeader.component.d.ts.map +0 -1
  311. package/grid/form/index.d.ts +0 -10
  312. package/grid/form/index.d.ts.map +0 -1
  313. package/grid/form/time-since.pipe.d.ts +0 -8
  314. package/grid/form/time-since.pipe.d.ts.map +0 -1
  315. package/grid/formio-angular-grid.d.ts.map +0 -1
  316. package/grid/grid.component.d.ts +0 -59
  317. package/grid/grid.component.d.ts.map +0 -1
  318. package/grid/grid.module.d.ts +0 -23
  319. package/grid/grid.module.d.ts.map +0 -1
  320. package/grid/grid.service.d.ts +0 -10
  321. package/grid/grid.service.d.ts.map +0 -1
  322. package/grid/index.d.ts.map +0 -1
  323. package/grid/submission/SubmissionGridBody.component.d.ts +0 -19
  324. package/grid/submission/SubmissionGridBody.component.d.ts.map +0 -1
  325. package/grid/submission/SubmissionGridFooter.component.d.ts +0 -10
  326. package/grid/submission/SubmissionGridFooter.component.d.ts.map +0 -1
  327. package/grid/submission/SubmissionGridHeader.component.d.ts +0 -30
  328. package/grid/submission/SubmissionGridHeader.component.d.ts.map +0 -1
  329. package/grid/submission/index.d.ts.map +0 -1
  330. package/grid/types/grid-column.d.ts +0 -7
  331. package/grid/types/grid-column.d.ts.map +0 -1
  332. package/grid/types/grid-footer-positions.d.ts +0 -6
  333. package/grid/types/grid-footer-positions.d.ts.map +0 -1
  334. package/grid/types/grid-header.d.ts +0 -13
  335. package/grid/types/grid-header.d.ts.map +0 -1
  336. package/index.d.ts.map +0 -1
  337. package/manager/create/create.component.d.ts +0 -9
  338. package/manager/create/create.component.d.ts.map +0 -1
  339. package/manager/delete/delete.component.d.ts +0 -18
  340. package/manager/delete/delete.component.d.ts.map +0 -1
  341. package/manager/edit/edit.component.d.ts +0 -31
  342. package/manager/edit/edit.component.d.ts.map +0 -1
  343. package/manager/form/form.component.d.ts +0 -29
  344. package/manager/form/form.component.d.ts.map +0 -1
  345. package/manager/form-manager.config.d.ts +0 -30
  346. package/manager/form-manager.config.d.ts.map +0 -1
  347. package/manager/form-manager.module.d.ts +0 -28
  348. package/manager/form-manager.module.d.ts.map +0 -1
  349. package/manager/form-manager.routes.d.ts +0 -4
  350. package/manager/form-manager.routes.d.ts.map +0 -1
  351. package/manager/form-manager.service.d.ts +0 -37
  352. package/manager/form-manager.service.d.ts.map +0 -1
  353. package/manager/formio-angular-manager.d.ts.map +0 -1
  354. package/manager/index/index.component.d.ts +0 -28
  355. package/manager/index/index.component.d.ts.map +0 -1
  356. package/manager/index.d.ts.map +0 -1
  357. package/manager/submission/delete/delete.component.d.ts +0 -16
  358. package/manager/submission/delete/delete.component.d.ts.map +0 -1
  359. package/manager/submission/edit/edit.component.d.ts +0 -13
  360. package/manager/submission/edit/edit.component.d.ts.map +0 -1
  361. package/manager/submission/index/index.component.d.ts +0 -13
  362. package/manager/submission/index/index.component.d.ts.map +0 -1
  363. package/manager/submission/submission/submission.component.d.ts +0 -15
  364. package/manager/submission/submission/submission.component.d.ts.map +0 -1
  365. package/manager/submission/view/view.component.d.ts +0 -9
  366. package/manager/submission/view/view.component.d.ts.map +0 -1
  367. package/manager/view/view.component.d.ts +0 -24
  368. package/manager/view/view.component.d.ts.map +0 -1
  369. package/resource/create/create.component.d.ts +0 -19
  370. package/resource/create/create.component.d.ts.map +0 -1
  371. package/resource/delete/delete.component.d.ts +0 -14
  372. package/resource/delete/delete.component.d.ts.map +0 -1
  373. package/resource/edit/edit.component.d.ts +0 -22
  374. package/resource/edit/edit.component.d.ts.map +0 -1
  375. package/resource/formio-angular-resource.d.ts.map +0 -1
  376. package/resource/index/index.component.d.ts +0 -23
  377. package/resource/index/index.component.d.ts.map +0 -1
  378. package/resource/index.d.ts.map +0 -1
  379. package/resource/resource.component.d.ts +0 -24
  380. package/resource/resource.component.d.ts.map +0 -1
  381. package/resource/resource.config.d.ts +0 -17
  382. package/resource/resource.config.d.ts.map +0 -1
  383. package/resource/resource.module.d.ts +0 -20
  384. package/resource/resource.module.d.ts.map +0 -1
  385. package/resource/resource.routes.d.ts +0 -4
  386. package/resource/resource.routes.d.ts.map +0 -1
  387. package/resource/resource.service.d.ts +0 -52
  388. package/resource/resource.service.d.ts.map +0 -1
  389. package/resource/resources.service.d.ts +0 -16
  390. package/resource/resources.service.d.ts.map +0 -1
  391. package/resource/view/view.component.d.ts +0 -16
  392. package/resource/view/view.component.d.ts.map +0 -1
  393. package/types/alerts-position.d.ts +0 -7
  394. package/types/alerts-position.d.ts.map +0 -1
  395. package/types/formio-metadata.d.ts +0 -11
  396. package/types/formio-metadata.d.ts.map +0 -1
  397. package/types/formio-submission.d.ts +0 -19
  398. package/types/formio-submission.d.ts.map +0 -1
@@ -0,0 +1,554 @@
1
+ import { Component, ElementRef, EventEmitter, Input, NgZone, OnChanges, OnDestroy, OnInit, Optional, Output, ViewChild } from '@angular/core';
2
+ import { FormioService } from './formio.service';
3
+ import { FormioAlerts } from './components/alerts/formio.alerts';
4
+ import { FormioAppConfig } from './formio.config';
5
+ import { FormioError, FormioForm, FormioOptions, FormioRefreshValue } from './formio.common';
6
+ import { assign, get, isEmpty } from 'lodash';
7
+ import { CustomTagsService } from './custom-tags.service';
8
+ import { Utils } from '@formio/js';
9
+ import { AlertsPosition } from './types/alerts-position';
10
+ const { Evaluator, fastCloneDeep } = Utils;
11
+
12
+ @Component({
13
+ template: ''
14
+ })
15
+ export class FormioBaseComponent implements OnInit, OnChanges, OnDestroy {
16
+ @Input() form?: FormioForm;
17
+ @Input() submission?: any = {};
18
+ @Input() src?: string;
19
+ @Input() url?: string;
20
+ @Input() service?: FormioService;
21
+ @Input() options?: FormioOptions;
22
+ @Input() noeval ? = Evaluator.noeval;
23
+ @Input() formioOptions?: any;
24
+ @Input() renderOptions?: any;
25
+ @Input() readOnly ? = false;
26
+ @Input() viewOnly ? = false;
27
+ @Input() hideLoading ? = false;
28
+ @Input() hideComponents?: string[];
29
+ @Input() refresh?: EventEmitter<FormioRefreshValue>;
30
+ @Input() error?: EventEmitter<any>;
31
+ @Input() success?: EventEmitter<object>;
32
+ @Input() submitDone?: EventEmitter<object>;
33
+ @Input() language?: EventEmitter<string>;
34
+ @Input() hooks?: any = {};
35
+ @Input() renderer?: any;
36
+ @Input() watchSubmissionErrors ? = false;
37
+ @Input() dataTableActions? : any = []
38
+ @Output() render = new EventEmitter<object>();
39
+ @Output() customEvent = new EventEmitter<object>();
40
+ @Output() fileUploadingStatus = new EventEmitter<string>();
41
+ @Output() submit = new EventEmitter<object>();
42
+ @Output() prevPage = new EventEmitter<object>();
43
+ @Output() nextPage = new EventEmitter<object>();
44
+ @Output() beforeSubmit = new EventEmitter<object>();
45
+ @Output() rowAdd = new EventEmitter<any>();
46
+ @Output() rowAdded = new EventEmitter<any>();
47
+ @Output() rowEdit = new EventEmitter<any>();
48
+ @Output() rowEdited = new EventEmitter<any>();
49
+ @Output() rowDelete = new EventEmitter<any>();
50
+ @Output() rowClick = new EventEmitter<any>();
51
+ @Output() rowSelectChange = new EventEmitter<any>();
52
+ @Output() page = new EventEmitter<any>();
53
+ @Output() changeItemsPerPage = new EventEmitter<any>();
54
+ @Output() change = new EventEmitter<object>();
55
+ @Output() invalid = new EventEmitter<boolean>();
56
+ @Output() errorChange = new EventEmitter<any>();
57
+ @Output() formLoad = new EventEmitter<any>();
58
+ @Output() submissionLoad = new EventEmitter<any>();
59
+ @Output() ready = new EventEmitter<FormioBaseComponent>();
60
+ @ViewChild('formio', { static: true }) formioElement?: ElementRef<any>;
61
+
62
+ public AlertsPosition = AlertsPosition;
63
+ public formio: any;
64
+ public initialized = false;
65
+ public alerts = new FormioAlerts();
66
+ public formioReady: Promise<any>;
67
+
68
+ private formioReadyResolve: any;
69
+ private submitting = false;
70
+ private submissionSuccess = false;
71
+ public isLoading: boolean;
72
+ public noAlerts: boolean;
73
+ public label: string;
74
+
75
+ constructor(
76
+ public ngZone: NgZone,
77
+ @Optional() public config: FormioAppConfig,
78
+ @Optional() public customTags?: CustomTagsService,
79
+ ) {
80
+ this.isLoading = true;
81
+ this.formioReady = new Promise((ready) => {
82
+ this.formioReadyResolve = ready;
83
+ });
84
+ }
85
+
86
+ getRenderer() {
87
+ return this.renderer;
88
+ }
89
+
90
+ getRendererOptions() {
91
+ const extraTags = this.customTags ? this.customTags.tags : [];
92
+ return assign({}, {
93
+ icons: get(this.config, 'icons', 'fontawesome'),
94
+ noAlerts: get(this.options, 'noAlerts', true),
95
+ readOnly: this.readOnly,
96
+ viewAsHtml: this.viewOnly,
97
+ ...(this.viewOnly && { renderMode: "html" }),
98
+ i18n: get(this.options, 'i18n', null),
99
+ fileService: get(this.options, 'fileService', null),
100
+ hooks: this.hooks,
101
+ sanitizeConfig: {
102
+ addTags: extraTags
103
+ },
104
+ dataTableActions: this.dataTableActions
105
+ }, this.renderOptions || {});
106
+ }
107
+
108
+ createRenderer() {
109
+ const Renderer = this.getRenderer();
110
+ const form = (new Renderer(
111
+ this.formioElement ? this.formioElement.nativeElement : null,
112
+ this.form,
113
+ this.getRendererOptions()
114
+ ));
115
+ return form.instance;
116
+ }
117
+
118
+ setFormUrl(url) {
119
+ this.formio.setUrl(url, this.formioOptions || {});
120
+ }
121
+
122
+ setForm(form: FormioForm) {
123
+ this.form = form;
124
+ if (this.formio) {
125
+ this.formio.destroy();
126
+ }
127
+
128
+ if (this.form.title) {
129
+ this.label = this.form.title;
130
+ } else if (this.form.components && this.form.components[0]) {
131
+ this.label = this.form.components[0].label;
132
+ }
133
+
134
+ // Clear out the element to render the new form.
135
+ if (this.formioElement && this.formioElement.nativeElement) {
136
+ this.formioElement.nativeElement.innerHTML = '';
137
+ }
138
+ this.formio = this.createRenderer();
139
+
140
+ if(!this.formio) {
141
+ return;
142
+ }
143
+ this.formio.setSubmission(this.submission, {
144
+ fromSubmission: false
145
+ });
146
+ if (this.renderOptions && this.renderOptions.validateOnInit) {
147
+ this.formio.setValue(this.submission, {validateOnInit: true});
148
+ }
149
+ if (this.url) {
150
+ this.setFormUrl(this.url);
151
+ }
152
+ if (this.src) {
153
+ this.setFormUrl(this.src);
154
+ }
155
+ this.formio.nosubmit = true;
156
+ this.attachFormEvents();
157
+
158
+ return this.formio.ready.then(() => {
159
+ this.ngZone.run(() => {
160
+ this.isLoading = false;
161
+ this.ready.emit(this);
162
+ this.formioReadyResolve(this.formio);
163
+ if (this.formio.submissionReady) {
164
+ this.formio.submissionReady.then((submission) => {
165
+ this.submissionLoad.emit(submission);
166
+ });
167
+ }
168
+ });
169
+ return this.formio;
170
+ });
171
+ }
172
+
173
+ attachFormEvents() {
174
+ this.formio.on('prevPage', (data: any) => this.ngZone.run(() => this.onPrevPage(data)));
175
+ this.formio.on('nextPage', (data: any) => this.ngZone.run(() => this.onNextPage(data)));
176
+ this.formio.on('change', (value: any, flags: any, isModified: boolean) => this.ngZone.run(() => this.onChange(value, flags, isModified)));
177
+ this.formio.on('rowAdd', (component: any) => this.ngZone.run(() => this.rowAdd.emit(component)));
178
+ this.formio.on('rowAdded', (data: any, component: any) => this.ngZone.run(() => this.rowAdded.emit({component, row: data})));
179
+ this.formio.on('rowEdit', (data: any, rowIndex: number, index: number, component: any) => this.ngZone.run(() => this.rowEdit.emit({component, row: data, rowIndex, index})));
180
+ this.formio.on('rowEdited', (data: any, rowIndex: number, component: any) => this.ngZone.run(() => this.rowEdited.emit({component, row: data, rowIndex})));
181
+ this.formio.on('rowDelete', (data: any, rowIndex: number, index: number, component: any) => this.ngZone.run(() => this.rowDelete.emit({component, row: data, rowIndex, index})));
182
+ this.formio.on('rowClick', (row: any, rowIndex: number, index: number,component: any) => this.ngZone.run(() => this.rowClick.emit({component, row, rowIndex, index})));
183
+ this.formio.on('rowSelectChange', (selectedRows: any[], component: any) => this.ngZone.run(() => this.rowSelectChange.emit({selectedRows, component})));
184
+ this.formio.on('page', (currentPage: number, component: any) => this.ngZone.run(() => this.page.emit({currentPage, component})));
185
+ this.formio.on('changeItemsPerPage', (itemsPerPage:number) => this.ngZone.run(() => this.changeItemsPerPage.emit({itemsPerPage})));
186
+ this.formio.on('customEvent', (event: any) =>
187
+ this.ngZone.run(() => this.customEvent.emit(event))
188
+ );
189
+
190
+ ['fileUploadingStart', 'fileUploadingEnd'].forEach((eventName, index) => {
191
+ const status = !!index ? 'end' : 'start';
192
+ this.formio.on(eventName, () =>
193
+ this.ngZone.run(() => this.fileUploadingStatus.emit(status))
194
+ );
195
+ });
196
+
197
+ this.formio.on('submit', (submission: any, saved: boolean) =>
198
+ this.ngZone.run(() => this.submitForm(submission, saved))
199
+ );
200
+ this.formio.on('error', (err: any) => this.ngZone.run(() => {
201
+ this.submissionSuccess = false;
202
+ return this.onError(err);
203
+ }));
204
+ this.formio.on('render', () => this.ngZone.run(() => this.render.emit()));
205
+ this.formio.on('formLoad', (loadedForm: any) =>
206
+ this.ngZone.run(() => this.formLoad.emit(loadedForm))
207
+ );
208
+ }
209
+
210
+ initialize() {
211
+ if (this.initialized) {
212
+ return;
213
+ }
214
+
215
+ const extraTags = this.customTags ? this.customTags.tags : [];
216
+ const defaultOptions: FormioOptions = {
217
+ errors: {
218
+ message: 'Please fix the following errors before submitting.'
219
+ },
220
+ alerts: {
221
+ submitMessage: 'Submission Complete.'
222
+ },
223
+ disableAlerts: false,
224
+ hooks: {
225
+ beforeSubmit: null
226
+ },
227
+ sanitizeConfig: {
228
+ addTags: extraTags
229
+ },
230
+ alertsPosition: AlertsPosition.top,
231
+ };
232
+ this.options = Object.assign(defaultOptions, this.options);
233
+ if (this.options.disableAlerts) {
234
+ this.options.alertsPosition = AlertsPosition.none;
235
+ }
236
+ this.initialized = true;
237
+ }
238
+
239
+ ngOnInit() {
240
+ Evaluator.noeval = this.noeval;
241
+ this.initialize();
242
+
243
+ if (this.language) {
244
+ if (typeof this.language === 'string') {
245
+ this.formio.language = this.language;
246
+ } else {
247
+ this.language.subscribe((lang: string) => {
248
+ this.formio.language = lang;
249
+ });
250
+ }
251
+ }
252
+
253
+ if (this.refresh) {
254
+ this.refresh.subscribe((refresh: FormioRefreshValue) =>
255
+ this.onRefresh(refresh)
256
+ );
257
+ }
258
+
259
+ if (this.error) {
260
+ this.error.subscribe((err: any) => this.onError(err));
261
+ }
262
+
263
+ if (this.success) {
264
+ this.success.subscribe((message: string) => {
265
+ this.alerts.setAlert({
266
+ type: 'success',
267
+ message: message || get(this.options, 'alerts.submitMessage')
268
+ });
269
+ });
270
+ }
271
+
272
+ if (this.submitDone) {
273
+ this.submitDone.subscribe((submission: object) => {
274
+ this.formio.emit('submitDone', submission);
275
+ });
276
+ }
277
+
278
+ if (this.src) {
279
+ if (!this.service) {
280
+ this.service = new FormioService(this.src);
281
+ }
282
+ this.isLoading = true;
283
+ this.setFormFromSrc();
284
+ }
285
+ if (this.url && !this.service) {
286
+ this.service = new FormioService(this.url);
287
+ }
288
+ }
289
+
290
+ setFormFromSrc() {
291
+ this.service.loadForm({ params: { live: 1 } }).subscribe(
292
+ (form: FormioForm) => {
293
+ if (form && form.components) {
294
+ this.ngZone.runOutsideAngular(() => {
295
+ this.setForm(form);
296
+ });
297
+ }
298
+
299
+ // if a submission is also provided.
300
+ if (
301
+ isEmpty(this.submission) &&
302
+ this.service &&
303
+ this.service.formio.submissionId
304
+ ) {
305
+ this.service.loadSubmission().subscribe(
306
+ (submission: any) => {
307
+ if (this.readOnly) {
308
+ this.formio.options.readOnly = true;
309
+ }
310
+ this.submission = this.formio.submission = submission;
311
+ },
312
+ err => this.onError(err)
313
+ );
314
+ }
315
+ },
316
+ err => this.onError(err)
317
+ );
318
+ }
319
+
320
+ ngOnDestroy() {
321
+ if (this.formio) {
322
+ this.formio.destroy();
323
+ }
324
+ }
325
+
326
+ onRefresh(refresh: FormioRefreshValue) {
327
+ this.formioReady.then(() => {
328
+ if (refresh.form) {
329
+ this.formio.setForm(refresh.form).then(() => {
330
+ if (refresh.submission) {
331
+ this.formio.setSubmission(refresh.submission);
332
+ }
333
+ });
334
+ } else if (refresh.submission) {
335
+ this.formio.setSubmission(refresh.submission);
336
+ } else {
337
+ switch (refresh.property) {
338
+ case 'submission':
339
+ this.formio.submission = refresh.value;
340
+ break;
341
+ case 'form':
342
+ this.formio.form = refresh.value;
343
+ break;
344
+ }
345
+ }
346
+ });
347
+ }
348
+
349
+ ngOnChanges(changes: any) {
350
+ Evaluator.noeval = this.noeval;
351
+ this.initialize();
352
+
353
+ if (changes.form && changes.form.currentValue) {
354
+ this.ngZone.runOutsideAngular(() => {
355
+ this.setForm(changes.form.currentValue);
356
+ });
357
+ }
358
+
359
+ this.formioReady.then(() => {
360
+ if (changes.submission && changes.submission.currentValue) {
361
+ this.formio.setSubmission(changes.submission.currentValue, {
362
+ fromSubmission: !changes.submission.firstChange
363
+ });
364
+ }
365
+
366
+ if (changes.hideComponents && changes.hideComponents.currentValue) {
367
+ const hiddenComponents = changes.hideComponents.currentValue;
368
+ this.formio.options.hide = hiddenComponents;
369
+ this.formio.everyComponent((component) => {
370
+ component.options.hide = hiddenComponents;
371
+ if (hiddenComponents.includes(component.component.key)) {
372
+ component.visible = false;
373
+ }
374
+ });
375
+ }
376
+ });
377
+ }
378
+
379
+ onPrevPage(data: any) {
380
+ this.alerts.setAlerts([]);
381
+ this.prevPage.emit(data);
382
+ }
383
+
384
+ onNextPage(data: any) {
385
+ this.alerts.setAlerts([]);
386
+ this.nextPage.emit(data);
387
+ }
388
+
389
+ onSubmit(submission: any, saved: boolean, noemit?: boolean) {
390
+ this.submitting = false;
391
+ this.submissionSuccess = true;
392
+
393
+ this.formio.setValue(fastCloneDeep(submission), {
394
+ noValidate: true,
395
+ noCheck: true
396
+ });
397
+
398
+ if (saved) {
399
+ this.formio.emit('submitDone', submission);
400
+ }
401
+ if (!noemit) {
402
+ this.submit.emit(submission);
403
+ }
404
+ if (!this.success) {
405
+ this.alerts.setAlert({
406
+ type: 'success',
407
+ message: get(this.options, 'alerts.submitMessage')
408
+ });
409
+ }
410
+ }
411
+
412
+ onError(err: any) {
413
+ this.alerts.setAlerts([]);
414
+ this.submitting = false;
415
+ this.isLoading = false;
416
+
417
+ if (!err) {
418
+ return;
419
+ }
420
+
421
+ // Make sure it is an array.
422
+ const errors = Array.isArray(err) ? err : [err];
423
+
424
+ // Emit these errors again.
425
+ this.errorChange.emit(errors);
426
+
427
+ if (err.silent) {
428
+ return;
429
+ }
430
+
431
+ if (this.formio && errors.length) {
432
+ this.formio.emit('submitError', errors);
433
+ }
434
+
435
+ // Iterate through each one and set the alerts array.
436
+ errors.forEach((error: any) => {
437
+ const {
438
+ message,
439
+ paths,
440
+ } = error
441
+ ? error.details
442
+ ? {
443
+ message: error.details.map((detail) => detail.message),
444
+ paths: error.details.map((detail) => detail.path),
445
+ }
446
+ : {
447
+ message: error.message || error.toString(),
448
+ paths: error.path ? [error.path] : [],
449
+ }
450
+ : {
451
+ message: '',
452
+ paths: [],
453
+ };
454
+
455
+ let shouldErrorDisplay = true;
456
+
457
+ if (this.formio) {
458
+ paths.forEach((path, index) => {
459
+ const component = this.formio.getComponent(path);
460
+ if (component) {
461
+ const components = Array.isArray(component) ? component : [component];
462
+ const messageText = Array.isArray(message) ? message[index] : message;
463
+ components.forEach((comp) => comp.setCustomValidity(messageText, true));
464
+ this.alerts.addAlert({
465
+ type: 'danger',
466
+ message: message[index],
467
+ component,
468
+ });
469
+ shouldErrorDisplay = false;
470
+ }
471
+ });
472
+
473
+ if ((window as any).VPAT_ENABLED) {
474
+ if (typeof error ==='string' && this.formio.components) {
475
+ this.formio.components.forEach((comp) => {
476
+ if (comp && comp.type !== 'button') {
477
+ comp.setCustomValidity(message, true);
478
+ }
479
+ });
480
+ }
481
+ }
482
+
483
+ if (!this.noAlerts) {
484
+ this.formio.showErrors();
485
+ }
486
+ }
487
+
488
+ if (shouldErrorDisplay) {
489
+ this.alerts.addAlert({
490
+ type: 'danger',
491
+ message,
492
+ component: error.component,
493
+ });
494
+ }
495
+ });
496
+ }
497
+
498
+ focusOnComponet(key: any) {
499
+ if (this.formio) {
500
+ this.formio.focusOnComponent(key);
501
+ }
502
+ }
503
+
504
+ submitExecute(submission: object, saved = false) {
505
+ if (this.service && !this.url && !saved) {
506
+ this.service
507
+ .saveSubmission(submission)
508
+ .subscribe(
509
+ (sub: {}) => this.onSubmit(sub, true),
510
+ err => this.onError(err)
511
+ );
512
+ } else {
513
+ this.onSubmit(submission, false);
514
+ }
515
+ }
516
+
517
+ submitForm(submission: any, saved = false) {
518
+ // Keep double submits from occurring...
519
+ if (this.submitting) {
520
+ return;
521
+ }
522
+ this.formio.setMetadata(submission);
523
+ this.submissionSuccess = false;
524
+ this.submitting = true;
525
+ this.beforeSubmit.emit(submission);
526
+
527
+ // if they provide a beforeSubmit hook, then allow them to alter the submission asynchronously
528
+ // or even provide a custom Error method.
529
+ const beforeSubmit = get(this.options, 'hooks.beforeSubmit');
530
+ if (beforeSubmit) {
531
+ beforeSubmit(submission, (err: FormioError, sub: object) => {
532
+ if (err) {
533
+ this.onError(err);
534
+ return;
535
+ }
536
+ this.submitExecute(sub, saved);
537
+ });
538
+ } else {
539
+ this.submitExecute(submission, saved);
540
+ }
541
+ }
542
+
543
+ onChange(value: any, flags: any, isModified: boolean) {
544
+ if (this.watchSubmissionErrors && !this.submissionSuccess) {
545
+ const errors = get(this, 'formio.errors', []);
546
+ const alerts = get(this, 'alerts.alerts', []);
547
+ const submitted = get(this, 'formio.submitted', false);
548
+ if (submitted && (errors.length || alerts.length)) {
549
+ this.onError(errors);
550
+ }
551
+ }
552
+ return this.change.emit({...value, flags, isModified});
553
+ }
554
+ }
@@ -0,0 +1,3 @@
1
+ <div *ngFor="let alert of alerts.alerts" class="alert alert-{{ alert.type }}" role="alert" (click)="getComponent($event, alert)">
2
+ {{alert.message | parseHtmlContent}}
3
+ </div>
@@ -0,0 +1,19 @@
1
+ import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
2
+ import { FormioAlerts } from './formio.alerts';
3
+
4
+ @Component({
5
+ selector: 'formio-alerts',
6
+ templateUrl: './formio.alerts.component.html'
7
+ })
8
+ export class FormioAlertsComponent implements OnInit {
9
+ @Input() alerts: FormioAlerts;
10
+ @Output() focusComponent = new EventEmitter<object>();
11
+ ngOnInit() {
12
+ if (!this.alerts) {
13
+ this.alerts = new FormioAlerts();
14
+ }
15
+ }
16
+ getComponent (event, alert) {
17
+ this.focusComponent.emit(alert.component.key);
18
+ }
19
+ }
@@ -0,0 +1,21 @@
1
+ export interface FormioAlert {
2
+ type: string;
3
+ message: string;
4
+ component?: any;
5
+ }
6
+
7
+ export class FormioAlerts {
8
+ public alerts: FormioAlert[] = [];
9
+
10
+ setAlert(alert: FormioAlert) {
11
+ this.alerts = [alert];
12
+ }
13
+
14
+ addAlert(alert: FormioAlert) {
15
+ this.alerts.push(alert);
16
+ }
17
+
18
+ setAlerts(alerts: FormioAlert[]) {
19
+ this.alerts = alerts;
20
+ }
21
+ }
@@ -0,0 +1,15 @@
1
+ import { Pipe, PipeTransform } from '@angular/core';
2
+
3
+ @Pipe({ name: 'parseHtmlContent', pure: false })
4
+ export class ParseHtmlContentPipe implements PipeTransform {
5
+
6
+ /*
7
+ Some messages that are come from formiojs have hex codes. So the main aim of this pipe is transform this messages to html.
8
+ And then render in template.
9
+ */
10
+ transform(content) {
11
+ const parsedContent = new DOMParser().parseFromString(content, 'text/html').body.childNodes[0];
12
+
13
+ return parsedContent?.textContent;
14
+ }
15
+ }