@formio/js 5.0.0-rc.26 → 5.0.0-rc.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (360) hide show
  1. package/dist/fonts/bootstrap-icons.woff +0 -0
  2. package/dist/fonts/bootstrap-icons.woff2 +0 -0
  3. package/dist/formio.embed.js +1 -1
  4. package/dist/formio.embed.min.js +1 -1
  5. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  6. package/dist/formio.form.js +710 -689
  7. package/dist/formio.form.min.js +1 -1
  8. package/dist/formio.form.min.js.LICENSE.txt +2 -2
  9. package/dist/formio.full.css +100 -3
  10. package/dist/formio.full.js +715 -727
  11. package/dist/formio.full.min.css +2 -2
  12. package/dist/formio.full.min.js +1 -1
  13. package/dist/formio.full.min.js.LICENSE.txt +2 -2
  14. package/dist/formio.js +659 -264
  15. package/dist/formio.min.js +1 -1
  16. package/dist/formio.min.js.LICENSE.txt +2 -2
  17. package/dist/formio.utils.js +29 -8
  18. package/dist/formio.utils.min.js +1 -1
  19. package/dist/formio.utils.min.js.LICENSE.txt +2 -2
  20. package/lib/cjs/Embed.d.ts +2 -1
  21. package/lib/cjs/Embed.js +20 -7
  22. package/lib/cjs/PDF.js +2 -2
  23. package/lib/cjs/Webform.d.ts +3 -5
  24. package/lib/cjs/Webform.js +59 -81
  25. package/lib/cjs/WebformBuilder.d.ts +1 -1
  26. package/lib/cjs/WebformBuilder.js +27 -10
  27. package/lib/cjs/Wizard.d.ts +2 -0
  28. package/lib/cjs/Wizard.js +37 -26
  29. package/lib/cjs/WizardBuilder.d.ts +1 -0
  30. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +1 -2
  31. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +11 -12
  32. package/lib/cjs/addons/index.d.ts +1 -0
  33. package/lib/cjs/addons/index.js +5 -1
  34. package/lib/cjs/components/Components.d.ts +7 -0
  35. package/lib/cjs/components/Components.js +30 -0
  36. package/lib/cjs/components/_classes/component/Component.d.ts +57 -27
  37. package/lib/cjs/components/_classes/component/Component.js +193 -119
  38. package/lib/cjs/components/_classes/component/editForm/Component.edit.addons.d.ts +8 -0
  39. package/lib/cjs/components/_classes/component/editForm/Component.edit.addons.js +31 -1
  40. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +28 -11
  41. package/lib/cjs/components/_classes/nested/NestedComponent.js +88 -57
  42. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +4 -3
  43. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +17 -4
  44. package/lib/cjs/components/builder.js +0 -2
  45. package/lib/cjs/components/button/Button.js +2 -1
  46. package/lib/cjs/components/columns/Columns.d.ts +1 -0
  47. package/lib/cjs/components/columns/Columns.js +2 -3
  48. package/lib/cjs/components/columns/editForm/Columns.edit.display.d.ts +30 -1
  49. package/lib/cjs/components/columns/editForm/Columns.edit.display.js +23 -1
  50. package/lib/cjs/components/container/Container.d.ts +1 -0
  51. package/lib/cjs/components/container/Container.js +2 -6
  52. package/lib/cjs/components/content/Content.d.ts +1 -0
  53. package/lib/cjs/components/content/Content.js +1 -0
  54. package/lib/cjs/components/datagrid/DataGrid.d.ts +0 -8
  55. package/lib/cjs/components/datagrid/DataGrid.js +9 -26
  56. package/lib/cjs/components/datamap/DataMap.js +2 -1
  57. package/lib/cjs/components/datetime/DateTime.js +0 -2
  58. package/lib/cjs/components/day/Day.js +2 -3
  59. package/lib/cjs/components/editgrid/EditGrid.d.ts +8 -4
  60. package/lib/cjs/components/editgrid/EditGrid.js +96 -73
  61. package/lib/cjs/components/email/Email.js +0 -1
  62. package/lib/cjs/components/file/File.js +1 -1
  63. package/lib/cjs/components/file/fixtures/comp3.d.ts +29 -0
  64. package/lib/cjs/components/file/fixtures/comp3.js +31 -0
  65. package/lib/cjs/components/form/Form.d.ts +2 -6
  66. package/lib/cjs/components/form/Form.js +43 -14
  67. package/lib/cjs/components/index.d.ts +0 -2
  68. package/lib/cjs/components/index.js +0 -2
  69. package/lib/cjs/components/number/Number.d.ts +1 -2
  70. package/lib/cjs/components/number/Number.js +5 -6
  71. package/lib/cjs/components/panel/Panel.d.ts +0 -1
  72. package/lib/cjs/components/panel/Panel.js +2 -9
  73. package/lib/cjs/components/panel/editForm/Panel.edit.display.d.ts +6 -38
  74. package/lib/cjs/components/panel/editForm/Panel.edit.display.js +3 -16
  75. package/lib/cjs/components/phonenumber/PhoneNumber.js +17 -0
  76. package/lib/cjs/components/radio/Radio.js +0 -2
  77. package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +1 -1
  78. package/lib/cjs/components/recaptcha/ReCaptcha.js +2 -2
  79. package/lib/cjs/components/select/Select.js +3 -2
  80. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +1 -2
  81. package/lib/cjs/components/selectboxes/SelectBoxes.js +7 -6
  82. package/lib/cjs/components/table/editForm/Table.edit.display.d.ts +31 -2
  83. package/lib/cjs/components/table/editForm/Table.edit.display.js +22 -0
  84. package/lib/cjs/components/tabs/editForm/Tabs.edit.display.d.ts +30 -2
  85. package/lib/cjs/components/tabs/editForm/Tabs.edit.display.js +22 -0
  86. package/lib/cjs/components/textfield/TextField.js +20 -6
  87. package/lib/cjs/components/time/Time.js +0 -6
  88. package/lib/cjs/components/url/Url.js +0 -1
  89. package/lib/cjs/components/well/editForm/Well.edit.display.d.ts +25 -2
  90. package/lib/cjs/components/well/editForm/Well.edit.display.js +18 -0
  91. package/lib/cjs/formio.embed.js +5 -3
  92. package/lib/cjs/formio.form.d.ts +1 -7
  93. package/lib/cjs/formio.form.js +2 -38
  94. package/lib/cjs/index.d.ts +2 -1
  95. package/lib/cjs/index.js +2 -1
  96. package/lib/cjs/providers/Providers.d.ts +0 -4
  97. package/lib/cjs/providers/storage/azure.d.ts +0 -2
  98. package/lib/cjs/providers/storage/azure.js +1 -6
  99. package/lib/cjs/providers/storage/googleDrive.d.ts +0 -1
  100. package/lib/cjs/providers/storage/googleDrive.js +0 -4
  101. package/lib/cjs/providers/storage/s3.d.ts +0 -1
  102. package/lib/cjs/providers/storage/s3.js +0 -4
  103. package/lib/cjs/translations/en.d.ts +5 -0
  104. package/lib/cjs/translations/en.js +5 -0
  105. package/lib/cjs/utils/formUtils.js +1 -0
  106. package/lib/cjs/utils/utils.d.ts +2 -1
  107. package/lib/cjs/utils/utils.js +27 -9
  108. package/lib/mjs/Embed.d.ts +2 -1
  109. package/lib/mjs/Embed.js +20 -7
  110. package/lib/mjs/PDF.js +2 -2
  111. package/lib/mjs/Webform.d.ts +3 -5
  112. package/lib/mjs/Webform.js +58 -82
  113. package/lib/mjs/WebformBuilder.d.ts +1 -1
  114. package/lib/mjs/WebformBuilder.js +28 -7
  115. package/lib/mjs/Wizard.d.ts +2 -0
  116. package/lib/mjs/Wizard.js +36 -27
  117. package/lib/mjs/WizardBuilder.d.ts +1 -0
  118. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +1 -2
  119. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +11 -12
  120. package/lib/mjs/addons/index.d.ts +1 -0
  121. package/lib/mjs/addons/index.js +5 -1
  122. package/lib/mjs/components/Components.d.ts +7 -0
  123. package/lib/mjs/components/Components.js +29 -0
  124. package/lib/mjs/components/_classes/component/Component.d.ts +57 -27
  125. package/lib/mjs/components/_classes/component/Component.js +191 -118
  126. package/lib/mjs/components/_classes/component/editForm/Component.edit.addons.d.ts +8 -0
  127. package/lib/mjs/components/_classes/component/editForm/Component.edit.addons.js +31 -1
  128. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +28 -11
  129. package/lib/mjs/components/_classes/nested/NestedComponent.js +88 -57
  130. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +4 -3
  131. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +18 -5
  132. package/lib/mjs/components/builder.js +0 -2
  133. package/lib/mjs/components/button/Button.js +2 -1
  134. package/lib/mjs/components/columns/Columns.d.ts +1 -0
  135. package/lib/mjs/components/columns/Columns.js +2 -3
  136. package/lib/mjs/components/columns/editForm/Columns.edit.display.d.ts +30 -1
  137. package/lib/mjs/components/columns/editForm/Columns.edit.display.js +23 -1
  138. package/lib/mjs/components/container/Container.d.ts +1 -0
  139. package/lib/mjs/components/container/Container.js +2 -6
  140. package/lib/mjs/components/content/Content.d.ts +1 -0
  141. package/lib/mjs/components/content/Content.js +1 -0
  142. package/lib/mjs/components/datagrid/DataGrid.d.ts +0 -8
  143. package/lib/mjs/components/datagrid/DataGrid.js +9 -26
  144. package/lib/mjs/components/datamap/DataMap.js +2 -1
  145. package/lib/mjs/components/datetime/DateTime.js +0 -2
  146. package/lib/mjs/components/day/Day.js +2 -3
  147. package/lib/mjs/components/editgrid/EditGrid.d.ts +8 -4
  148. package/lib/mjs/components/editgrid/EditGrid.js +97 -76
  149. package/lib/mjs/components/email/Email.js +0 -1
  150. package/lib/mjs/components/file/File.js +1 -1
  151. package/lib/mjs/components/file/fixtures/comp3.d.ts +29 -0
  152. package/lib/mjs/components/file/fixtures/comp3.js +29 -0
  153. package/lib/mjs/components/form/Form.d.ts +2 -6
  154. package/lib/mjs/components/form/Form.js +45 -14
  155. package/lib/mjs/components/index.d.ts +0 -2
  156. package/lib/mjs/components/index.js +0 -2
  157. package/lib/mjs/components/number/Number.d.ts +1 -2
  158. package/lib/mjs/components/number/Number.js +4 -5
  159. package/lib/mjs/components/panel/Panel.d.ts +0 -1
  160. package/lib/mjs/components/panel/Panel.js +3 -9
  161. package/lib/mjs/components/panel/editForm/Panel.edit.display.d.ts +6 -38
  162. package/lib/mjs/components/panel/editForm/Panel.edit.display.js +3 -16
  163. package/lib/mjs/components/phonenumber/PhoneNumber.js +17 -0
  164. package/lib/mjs/components/radio/Radio.js +0 -2
  165. package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +1 -1
  166. package/lib/mjs/components/recaptcha/ReCaptcha.js +2 -2
  167. package/lib/mjs/components/select/Select.js +3 -2
  168. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +1 -2
  169. package/lib/mjs/components/selectboxes/SelectBoxes.js +7 -6
  170. package/lib/mjs/components/table/editForm/Table.edit.display.d.ts +31 -2
  171. package/lib/mjs/components/table/editForm/Table.edit.display.js +22 -0
  172. package/lib/mjs/components/tabs/editForm/Tabs.edit.display.d.ts +30 -2
  173. package/lib/mjs/components/tabs/editForm/Tabs.edit.display.js +22 -0
  174. package/lib/mjs/components/textfield/TextField.js +20 -6
  175. package/lib/mjs/components/time/Time.js +0 -6
  176. package/lib/mjs/components/url/Url.js +0 -1
  177. package/lib/mjs/components/well/editForm/Well.edit.display.d.ts +25 -2
  178. package/lib/mjs/components/well/editForm/Well.edit.display.js +18 -0
  179. package/lib/mjs/formio.embed.js +5 -3
  180. package/lib/mjs/formio.form.d.ts +1 -7
  181. package/lib/mjs/formio.form.js +2 -32
  182. package/lib/mjs/index.d.ts +2 -1
  183. package/lib/mjs/index.js +1 -1
  184. package/lib/mjs/providers/Providers.d.ts +0 -4
  185. package/lib/mjs/providers/storage/azure.d.ts +0 -2
  186. package/lib/mjs/providers/storage/azure.js +1 -6
  187. package/lib/mjs/providers/storage/googleDrive.d.ts +0 -1
  188. package/lib/mjs/providers/storage/googleDrive.js +0 -4
  189. package/lib/mjs/providers/storage/s3.d.ts +0 -1
  190. package/lib/mjs/providers/storage/s3.js +0 -4
  191. package/lib/mjs/translations/en.d.ts +5 -0
  192. package/lib/mjs/translations/en.js +5 -0
  193. package/lib/mjs/utils/formUtils.js +1 -0
  194. package/lib/mjs/utils/utils.d.ts +2 -1
  195. package/lib/mjs/utils/utils.js +24 -7
  196. package/package.json +6 -6
  197. package/lib/cjs/components/tree/Node.d.ts +0 -55
  198. package/lib/cjs/components/tree/Node.js +0 -185
  199. package/lib/cjs/components/tree/Tree.d.ts +0 -48
  200. package/lib/cjs/components/tree/Tree.form.d.ts +0 -3
  201. package/lib/cjs/components/tree/Tree.form.js +0 -21
  202. package/lib/cjs/components/tree/Tree.js +0 -383
  203. package/lib/cjs/components/tree/editForm/Tree.edit.data.d.ts +0 -5
  204. package/lib/cjs/components/tree/editForm/Tree.edit.data.js +0 -9
  205. package/lib/cjs/components/tree/editForm/Tree.edit.display.d.ts +0 -9
  206. package/lib/cjs/components/tree/editForm/Tree.edit.display.js +0 -12
  207. package/lib/cjs/components/tree/fixtures/comp1.d.ts +0 -23
  208. package/lib/cjs/components/tree/fixtures/comp1.js +0 -24
  209. package/lib/cjs/components/tree/fixtures/comp2.d.ts +0 -116
  210. package/lib/cjs/components/tree/fixtures/comp2.js +0 -82
  211. package/lib/cjs/components/tree/fixtures/comp3.d.ts +0 -24
  212. package/lib/cjs/components/tree/fixtures/comp3.js +0 -25
  213. package/lib/cjs/components/tree/fixtures/comp4.d.ts +0 -42
  214. package/lib/cjs/components/tree/fixtures/comp4.js +0 -47
  215. package/lib/cjs/components/tree/fixtures/index.d.ts +0 -5
  216. package/lib/cjs/components/tree/fixtures/index.js +0 -14
  217. package/lib/cjs/validator/Rules.d.ts +0 -53
  218. package/lib/cjs/validator/Rules.js +0 -22
  219. package/lib/cjs/validator/Validator.d.ts +0 -228
  220. package/lib/cjs/validator/Validator.js +0 -1113
  221. package/lib/cjs/validator/conjunctions/index.d.ts +0 -7
  222. package/lib/cjs/validator/conjunctions/index.js +0 -18
  223. package/lib/cjs/validator/operators/index.d.ts +0 -7
  224. package/lib/cjs/validator/operators/index.js +0 -18
  225. package/lib/cjs/validator/quickRules/index.d.ts +0 -7
  226. package/lib/cjs/validator/quickRules/index.js +0 -18
  227. package/lib/cjs/validator/rules/Custom.d.ts +0 -5
  228. package/lib/cjs/validator/rules/Custom.js +0 -30
  229. package/lib/cjs/validator/rules/Date.d.ts +0 -5
  230. package/lib/cjs/validator/rules/Date.js +0 -25
  231. package/lib/cjs/validator/rules/Day.d.ts +0 -5
  232. package/lib/cjs/validator/rules/Day.js +0 -58
  233. package/lib/cjs/validator/rules/Email.d.ts +0 -5
  234. package/lib/cjs/validator/rules/Email.js +0 -24
  235. package/lib/cjs/validator/rules/JSON.d.ts +0 -5
  236. package/lib/cjs/validator/rules/JSON.js +0 -29
  237. package/lib/cjs/validator/rules/Mask.d.ts +0 -5
  238. package/lib/cjs/validator/rules/Mask.js +0 -32
  239. package/lib/cjs/validator/rules/Max.d.ts +0 -5
  240. package/lib/cjs/validator/rules/Max.js +0 -21
  241. package/lib/cjs/validator/rules/MaxDate.d.ts +0 -5
  242. package/lib/cjs/validator/rules/MaxDate.js +0 -34
  243. package/lib/cjs/validator/rules/MaxLength.d.ts +0 -5
  244. package/lib/cjs/validator/rules/MaxLength.js +0 -20
  245. package/lib/cjs/validator/rules/MaxWords.d.ts +0 -5
  246. package/lib/cjs/validator/rules/MaxWords.js +0 -20
  247. package/lib/cjs/validator/rules/MaxYear.d.ts +0 -5
  248. package/lib/cjs/validator/rules/MaxYear.js +0 -22
  249. package/lib/cjs/validator/rules/Min.d.ts +0 -5
  250. package/lib/cjs/validator/rules/Min.js +0 -21
  251. package/lib/cjs/validator/rules/MinDate.d.ts +0 -5
  252. package/lib/cjs/validator/rules/MinDate.js +0 -30
  253. package/lib/cjs/validator/rules/MinLength.d.ts +0 -5
  254. package/lib/cjs/validator/rules/MinLength.js +0 -20
  255. package/lib/cjs/validator/rules/MinWords.d.ts +0 -5
  256. package/lib/cjs/validator/rules/MinWords.js +0 -20
  257. package/lib/cjs/validator/rules/MinYear.d.ts +0 -5
  258. package/lib/cjs/validator/rules/MinYear.js +0 -22
  259. package/lib/cjs/validator/rules/Pattern.d.ts +0 -5
  260. package/lib/cjs/validator/rules/Pattern.js +0 -20
  261. package/lib/cjs/validator/rules/Required.d.ts +0 -5
  262. package/lib/cjs/validator/rules/Required.js +0 -17
  263. package/lib/cjs/validator/rules/Rule.d.ts +0 -7
  264. package/lib/cjs/validator/rules/Rule.js +0 -12
  265. package/lib/cjs/validator/rules/Select.d.ts +0 -5
  266. package/lib/cjs/validator/rules/Select.js +0 -95
  267. package/lib/cjs/validator/rules/Time.d.ts +0 -5
  268. package/lib/cjs/validator/rules/Time.js +0 -19
  269. package/lib/cjs/validator/rules/Unique.d.ts +0 -5
  270. package/lib/cjs/validator/rules/Unique.js +0 -69
  271. package/lib/cjs/validator/rules/Url.d.ts +0 -5
  272. package/lib/cjs/validator/rules/Url.js +0 -23
  273. package/lib/cjs/validator/rules/index.d.ts +0 -47
  274. package/lib/cjs/validator/rules/index.js +0 -51
  275. package/lib/cjs/validator/transformers/index.d.ts +0 -7
  276. package/lib/cjs/validator/transformers/index.js +0 -18
  277. package/lib/cjs/validator/valueSources/index.d.ts +0 -7
  278. package/lib/cjs/validator/valueSources/index.js +0 -18
  279. package/lib/mjs/components/tree/Node.d.ts +0 -55
  280. package/lib/mjs/components/tree/Node.js +0 -179
  281. package/lib/mjs/components/tree/Tree.d.ts +0 -48
  282. package/lib/mjs/components/tree/Tree.form.d.ts +0 -3
  283. package/lib/mjs/components/tree/Tree.form.js +0 -15
  284. package/lib/mjs/components/tree/Tree.js +0 -384
  285. package/lib/mjs/components/tree/editForm/Tree.edit.data.d.ts +0 -5
  286. package/lib/mjs/components/tree/editForm/Tree.edit.data.js +0 -7
  287. package/lib/mjs/components/tree/editForm/Tree.edit.display.d.ts +0 -9
  288. package/lib/mjs/components/tree/editForm/Tree.edit.display.js +0 -10
  289. package/lib/mjs/components/tree/fixtures/comp1.d.ts +0 -23
  290. package/lib/mjs/components/tree/fixtures/comp1.js +0 -22
  291. package/lib/mjs/components/tree/fixtures/comp2.d.ts +0 -116
  292. package/lib/mjs/components/tree/fixtures/comp2.js +0 -80
  293. package/lib/mjs/components/tree/fixtures/comp3.d.ts +0 -24
  294. package/lib/mjs/components/tree/fixtures/comp3.js +0 -23
  295. package/lib/mjs/components/tree/fixtures/comp4.d.ts +0 -42
  296. package/lib/mjs/components/tree/fixtures/comp4.js +0 -45
  297. package/lib/mjs/components/tree/fixtures/index.d.ts +0 -5
  298. package/lib/mjs/components/tree/fixtures/index.js +0 -5
  299. package/lib/mjs/validator/Rules.d.ts +0 -53
  300. package/lib/mjs/validator/Rules.js +0 -17
  301. package/lib/mjs/validator/Validator.d.ts +0 -228
  302. package/lib/mjs/validator/Validator.js +0 -1103
  303. package/lib/mjs/validator/conjunctions/index.d.ts +0 -7
  304. package/lib/mjs/validator/conjunctions/index.js +0 -16
  305. package/lib/mjs/validator/operators/index.d.ts +0 -7
  306. package/lib/mjs/validator/operators/index.js +0 -16
  307. package/lib/mjs/validator/quickRules/index.d.ts +0 -7
  308. package/lib/mjs/validator/quickRules/index.js +0 -16
  309. package/lib/mjs/validator/rules/Custom.d.ts +0 -5
  310. package/lib/mjs/validator/rules/Custom.js +0 -21
  311. package/lib/mjs/validator/rules/Date.d.ts +0 -5
  312. package/lib/mjs/validator/rules/Date.js +0 -16
  313. package/lib/mjs/validator/rules/Day.d.ts +0 -5
  314. package/lib/mjs/validator/rules/Day.js +0 -49
  315. package/lib/mjs/validator/rules/Email.d.ts +0 -5
  316. package/lib/mjs/validator/rules/Email.js +0 -15
  317. package/lib/mjs/validator/rules/JSON.d.ts +0 -5
  318. package/lib/mjs/validator/rules/JSON.js +0 -20
  319. package/lib/mjs/validator/rules/Mask.d.ts +0 -5
  320. package/lib/mjs/validator/rules/Mask.js +0 -23
  321. package/lib/mjs/validator/rules/Max.d.ts +0 -5
  322. package/lib/mjs/validator/rules/Max.js +0 -12
  323. package/lib/mjs/validator/rules/MaxDate.d.ts +0 -5
  324. package/lib/mjs/validator/rules/MaxDate.js +0 -25
  325. package/lib/mjs/validator/rules/MaxLength.d.ts +0 -5
  326. package/lib/mjs/validator/rules/MaxLength.js +0 -11
  327. package/lib/mjs/validator/rules/MaxWords.d.ts +0 -5
  328. package/lib/mjs/validator/rules/MaxWords.js +0 -11
  329. package/lib/mjs/validator/rules/MaxYear.d.ts +0 -5
  330. package/lib/mjs/validator/rules/MaxYear.js +0 -13
  331. package/lib/mjs/validator/rules/Min.d.ts +0 -5
  332. package/lib/mjs/validator/rules/Min.js +0 -12
  333. package/lib/mjs/validator/rules/MinDate.d.ts +0 -5
  334. package/lib/mjs/validator/rules/MinDate.js +0 -21
  335. package/lib/mjs/validator/rules/MinLength.d.ts +0 -5
  336. package/lib/mjs/validator/rules/MinLength.js +0 -11
  337. package/lib/mjs/validator/rules/MinWords.d.ts +0 -5
  338. package/lib/mjs/validator/rules/MinWords.js +0 -11
  339. package/lib/mjs/validator/rules/MinYear.d.ts +0 -5
  340. package/lib/mjs/validator/rules/MinYear.js +0 -13
  341. package/lib/mjs/validator/rules/Pattern.d.ts +0 -5
  342. package/lib/mjs/validator/rules/Pattern.js +0 -11
  343. package/lib/mjs/validator/rules/Required.d.ts +0 -5
  344. package/lib/mjs/validator/rules/Required.js +0 -8
  345. package/lib/mjs/validator/rules/Rule.d.ts +0 -7
  346. package/lib/mjs/validator/rules/Rule.js +0 -9
  347. package/lib/mjs/validator/rules/Select.d.ts +0 -5
  348. package/lib/mjs/validator/rules/Select.js +0 -86
  349. package/lib/mjs/validator/rules/Time.d.ts +0 -5
  350. package/lib/mjs/validator/rules/Time.js +0 -10
  351. package/lib/mjs/validator/rules/Unique.d.ts +0 -5
  352. package/lib/mjs/validator/rules/Unique.js +0 -60
  353. package/lib/mjs/validator/rules/Url.d.ts +0 -5
  354. package/lib/mjs/validator/rules/Url.js +0 -14
  355. package/lib/mjs/validator/rules/index.d.ts +0 -47
  356. package/lib/mjs/validator/rules/index.js +0 -46
  357. package/lib/mjs/validator/transformers/index.d.ts +0 -7
  358. package/lib/mjs/validator/transformers/index.js +0 -16
  359. package/lib/mjs/validator/valueSources/index.d.ts +0 -7
  360. package/lib/mjs/validator/valueSources/index.js +0 -16
@@ -8,6 +8,7 @@ const DataGrid_1 = __importDefault(require("../datagrid/DataGrid"));
8
8
  const lodash_1 = __importDefault(require("lodash"));
9
9
  const eventemitter3_1 = __importDefault(require("eventemitter3"));
10
10
  const utils_1 = require("../../utils/utils");
11
+ const Components_1 = require("../Components");
11
12
  class DataMapComponent extends DataGrid_1.default {
12
13
  static schema(...extend) {
13
14
  return Component_1.default.schema({
@@ -240,7 +241,7 @@ class DataMapComponent extends DataGrid_1.default {
240
241
  delete dataValue[key];
241
242
  const comp = components[this.valueKey];
242
243
  comp.component.key = newKey;
243
- comp.path = this.calculateComponentPath(comp);
244
+ comp.path = Components_1.Components.calculateComponentPath(comp);
244
245
  key = newKey;
245
246
  });
246
247
  const valueComponent = lodash_1.default.clone(this.component.valueComponent);
@@ -104,8 +104,6 @@ class DateTimeComponent extends Input_1.default {
104
104
  /* eslint-disable camelcase */
105
105
  this.component.widget = Object.assign({ type: 'calendar', timezone, displayInTimezone: lodash_1.default.get(this.component, 'displayInTimezone', 'viewer'), locale: this.options.language, useLocaleSettings: lodash_1.default.get(this.component, 'useLocaleSettings', false), allowInput: lodash_1.default.get(this.component, 'allowInput', true), mode: 'single', enableTime: lodash_1.default.get(this.component, 'enableTime', true), noCalendar: !lodash_1.default.get(this.component, 'enableDate', true), format: this.component.format, hourIncrement: lodash_1.default.get(this.component, 'timePicker.hourStep', 1), minuteIncrement: lodash_1.default.get(this.component, 'timePicker.minuteStep', 5), time_24hr: time24hr, readOnly: this.options.readOnly, minDate: lodash_1.default.get(this.component, 'datePicker.minDate'), disabledDates: lodash_1.default.get(this.component, 'datePicker.disable'), disableWeekends: lodash_1.default.get(this.component, 'datePicker.disableWeekends'), disableWeekdays: lodash_1.default.get(this.component, 'datePicker.disableWeekdays'), disableFunction: lodash_1.default.get(this.component, 'datePicker.disableFunction'), maxDate: lodash_1.default.get(this.component, 'datePicker.maxDate') }, customOptions);
106
106
  /* eslint-enable camelcase */
107
- // Add the validators date.
108
- this.validators.push('date');
109
107
  }
110
108
  get defaultSchema() {
111
109
  return DateTimeComponent.schema();
@@ -51,10 +51,10 @@ class DayComponent extends Field_1.default {
51
51
  return (0, utils_1.getComponentSavedTypes)(schema) || [utils_1.componentValueTypes.string];
52
52
  }
53
53
  constructor(component, options, data) {
54
- if (component.maxDate) {
54
+ if (component.maxDate && component.maxDate.indexOf('moment(') === -1) {
55
55
  component.maxDate = (0, moment_1.default)(component.maxDate, 'YYYY-MM-DD').toISOString();
56
56
  }
57
- if (component.minDate) {
57
+ if (component.minDate && component.minDate.indexOf('moment(') === -1) {
58
58
  component.minDate = (0, moment_1.default)(component.minDate, 'YYYY-MM-DD').toISOString();
59
59
  }
60
60
  super(component, options, data);
@@ -211,7 +211,6 @@ class DayComponent extends Field_1.default {
211
211
  }
212
212
  init() {
213
213
  super.init();
214
- this.validators = this.validators.concat(['day', 'maxDate', 'minDate', 'minYear', 'maxYear']);
215
214
  const minYear = this.component.fields.year.minYear;
216
215
  const maxYear = this.component.fields.year.maxYear;
217
216
  this.component.maxYear = maxYear;
@@ -83,12 +83,16 @@ export default class EditGridComponent extends NestedArrayComponent {
83
83
  removeRow(rowIndex: any, modified: any): void;
84
84
  createRowComponents(row: any, rowIndex: any, recreatePartially: any): any;
85
85
  hasOpenRows(): any;
86
+ getAttachedData(data?: null): any;
86
87
  shouldValidateDraft(editRow: any): any;
87
88
  shouldValidateRow(editRow: any, dirty: any): any;
88
- validateRow(editRow: any, dirty: any, forceSilentCheck: any): boolean;
89
- showRowErrorAlerts(editRow: any, valid: any): void;
90
- checkValidity(data: any, dirty: any, row: any, silentCheck: any): boolean;
91
- checkComponentValidity(data: any, dirty: any, row: any, options?: {}): boolean;
89
+ validateRow(editRow: any, dirty: any, forceSilentCheck: any): any;
90
+ showRowErrorAlerts(editRow: any, errors: any): void;
91
+ /**
92
+ * Return that this component processes its own validation.
93
+ */
94
+ get processOwnValidation(): boolean;
95
+ setRowInvalid(ref: any, index: any): void;
92
96
  changeState(changed: any, flags: any): void;
93
97
  openWhenEmpty(): void;
94
98
  restoreRowContext(editRow: any, flags?: {}): void;
@@ -4,11 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const lodash_1 = __importDefault(require("lodash"));
7
+ const core_1 = require("@formio/core");
8
+ const components_1 = require("@formio/bootstrap/components");
7
9
  const NestedArrayComponent_1 = __importDefault(require("../_classes/nestedarray/NestedArrayComponent"));
8
10
  const Component_1 = __importDefault(require("../_classes/component/Component"));
9
11
  const Alert_1 = __importDefault(require("../alert/Alert"));
10
12
  const utils_1 = require("../../utils/utils");
11
- const components_1 = require("@formio/bootstrap/components");
12
13
  const EditRowState = {
13
14
  New: 'new',
14
15
  Editing: 'editing',
@@ -87,7 +88,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
87
88
  {% if (!instance.options.readOnly && !instance.disabled) { %}
88
89
  <div class="col-sm-2">
89
90
  <div class="btn-group pull-right">
90
- <button class="btn btn-default btn-light btn-sm editRow"><i class="{{ iconClass('edit') }}"></i></button>
91
+ <button class="btn btn-default btn-light btn-sm editRow"><i class="{{ iconClass('pen-fill') }}"></i></button>
91
92
  {% if (!instance.hasRemoveButtons || instance.hasRemoveButtons()) { %}
92
93
  <button class="btn btn-danger btn-sm removeRow"><i class="{{ iconClass('trash') }}"></i></button>
93
94
  {% } %}
@@ -108,7 +109,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
108
109
  {% if (!instance.options.readOnly && !instance.disabled) { %}
109
110
  <td class="editgrid-table-column">
110
111
  <div class="btn-group">
111
- <button class="btn btn-default btn-light btn-sm editRow" aria-label="{{ t('Edit row') }}"><i class="{{ iconClass('edit') }}"></i></button>
112
+ <button class="btn btn-default btn-light btn-sm editRow" aria-label="{{ t('Edit row') }}"><i class="{{ iconClass('pen-fill') }}"></i></button>
112
113
  {% if (!instance.hasRemoveButtons || instance.hasRemoveButtons()) { %}
113
114
  <button class="btn btn-danger btn-sm removeRow" aria-label="{{ t('Remove row') }}"><i class="{{ iconClass('trash') }}"></i></button>
114
115
  {% } %}
@@ -440,11 +441,10 @@ class EditGridComponent extends NestedArrayComponent_1.default {
440
441
  this.editRow(rowIndex).then(() => {
441
442
  var _a;
442
443
  if (this.component.rowDrafts) {
443
- this.validateRow(editRow, false);
444
- const hasErrors = editRow.errors && !!editRow.errors.length;
445
- const shouldShowRowErrorsAlert = this.component.modal && hasErrors && ((_a = this.root) === null || _a === void 0 ? void 0 : _a.submitted);
444
+ const errors = this.validateRow(editRow, false);
445
+ const shouldShowRowErrorsAlert = this.component.modal && errors.length && ((_a = this.root) === null || _a === void 0 ? void 0 : _a.submitted);
446
446
  if (shouldShowRowErrorsAlert) {
447
- this.alert.showErrors(editRow.errors, false);
447
+ this.alert.showErrors(errors, false);
448
448
  editRow.alerts = true;
449
449
  }
450
450
  }
@@ -615,7 +615,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
615
615
  component: this.component,
616
616
  row: editRow,
617
617
  });
618
- this.checkRow('checkData', null, {}, editRow.data, editRow.components);
618
+ this.processRow('checkData', null, {}, editRow.data, editRow.components);
619
619
  if (this.component.modal) {
620
620
  this.addRowModal(rowIndex);
621
621
  }
@@ -662,13 +662,14 @@ class EditGridComponent extends NestedArrayComponent_1.default {
662
662
  if (!this.component.rowDrafts) {
663
663
  editRow.components.forEach((comp) => comp.setPristine(false));
664
664
  }
665
- if (this.validateRow(editRow, true) || this.component.rowDrafts) {
665
+ const errors = this.validateRow(editRow, true);
666
+ if (!errors.length || this.component.rowDrafts) {
666
667
  editRow.willBeSaved = true;
667
668
  dialog.close();
668
669
  this.saveRow(rowIndex, true);
669
670
  }
670
671
  else {
671
- this.alert.showErrors(editRow.errors, false);
672
+ this.alert.showErrors(errors, false);
672
673
  editRow.alerts = true;
673
674
  }
674
675
  },
@@ -794,9 +795,9 @@ class EditGridComponent extends NestedArrayComponent_1.default {
794
795
  if (!this.component.rowDrafts) {
795
796
  editRow.components.forEach((comp) => comp.setPristine(false));
796
797
  }
797
- const isRowValid = this.validateRow(editRow, true);
798
+ const errors = this.validateRow(editRow, true);
798
799
  if (!this.component.rowDrafts) {
799
- if (!isRowValid) {
800
+ if (errors.length) {
800
801
  return false;
801
802
  }
802
803
  }
@@ -822,7 +823,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
822
823
  }
823
824
  }
824
825
  }
825
- editRow.state = this.component.rowDrafts && !isRowValid ? EditRowState.Draft : EditRowState.Saved;
826
+ editRow.state = this.component.rowDrafts && errors.length ? EditRowState.Draft : EditRowState.Saved;
826
827
  editRow.backup = null;
827
828
  this.updateValue();
828
829
  this.emit('editGridSaveRow', {
@@ -931,15 +932,9 @@ class EditGridComponent extends NestedArrayComponent_1.default {
931
932
  return;
932
933
  }
933
934
  const editRow = this.editRows[rowIndex];
934
- if (editRow === null || editRow === void 0 ? void 0 : editRow.alerts) {
935
- this.checkData(null, Object.assign(Object.assign({}, flags), { changed,
936
- rowIndex }), this.data);
937
- }
938
- else if (editRow) {
939
- // If drafts allowed, perform validation silently if there was no attempt to submit a form
940
- const silentCheck = this.component.rowDrafts && !this.shouldValidateDraft(editRow);
941
- this.checkRow('checkData', null, Object.assign(Object.assign({}, flags), { changed,
942
- silentCheck }), editRow.data, editRow.components, silentCheck);
935
+ if (editRow) {
936
+ this.processRow('checkData', null, Object.assign(Object.assign({}, flags), { changed }), editRow.data, editRow.components);
937
+ this.validateRow(editRow, false);
943
938
  }
944
939
  if (this.variableTypeComponentsIndexes.length) {
945
940
  this.checkRowVariableTypeComponents(editRow, rowIndex);
@@ -955,6 +950,11 @@ class EditGridComponent extends NestedArrayComponent_1.default {
955
950
  hasOpenRows() {
956
951
  return this.editRows.some(row => this.isOpen(row));
957
952
  }
953
+ getAttachedData(data = null) {
954
+ const ourData = (0, utils_1.fastCloneDeep)(data || this._data || this.rootValue);
955
+ lodash_1.default.set(ourData, this.key, this.editRows.map((row) => row.data));
956
+ return ourData;
957
+ }
958
958
  shouldValidateDraft(editRow) {
959
959
  var _a, _b;
960
960
  // Draft rows should be validated only when there was an attempt to submit a form
@@ -966,48 +966,65 @@ class EditGridComponent extends NestedArrayComponent_1.default {
966
966
  }
967
967
  shouldValidateRow(editRow, dirty) {
968
968
  return this.shouldValidateDraft(editRow) ||
969
+ editRow.state === EditRowState.New ||
969
970
  editRow.state === EditRowState.Editing ||
970
971
  editRow.alerts ||
971
972
  dirty;
972
973
  }
973
974
  validateRow(editRow, dirty, forceSilentCheck) {
974
975
  var _a;
975
- let valid = true;
976
- const errorsSnapshot = [...this.errors];
976
+ editRow.errors = [];
977
977
  if (this.shouldValidateRow(editRow, dirty)) {
978
- editRow.components.forEach(comp => {
979
- const silentCheck = (this.component.rowDrafts && !this.shouldValidateDraft(editRow)) || forceSilentCheck;
980
- valid &= comp.checkValidity(null, dirty, null, silentCheck);
981
- });
978
+ const silentCheck = (this.component.rowDrafts && !this.shouldValidateDraft(editRow)) || forceSilentCheck;
979
+ const rootValue = (0, utils_1.fastCloneDeep)(this.rootValue);
980
+ const editGridValue = lodash_1.default.get(rootValue, this.path, []);
981
+ editGridValue[editRow.rowIndex] = editRow.data;
982
+ lodash_1.default.set(rootValue, this.path, editGridValue);
983
+ editRow.errors = (0, core_1.processSync)({
984
+ components: (0, utils_1.fastCloneDeep)(this.component.components).map((component) => {
985
+ component.parentPath = `${this.path}[${editRow.rowIndex}]`;
986
+ return component;
987
+ }),
988
+ data: rootValue,
989
+ row: editRow.data,
990
+ process: 'validateRow',
991
+ instances: this.componentsMap,
992
+ scope: { errors: [] },
993
+ processors: [
994
+ (context) => this.validationProcessor(context, { dirty, silentCheck })
995
+ ]
996
+ }).errors;
982
997
  }
998
+ // TODO: this is essentially running its own custom validation and should be moved into a validation rule
983
999
  if (this.component.validate && this.component.validate.row) {
984
- valid = this.evaluate(this.component.validate.row, {
985
- valid,
1000
+ const valid = this.evaluate(this.component.validate.row, {
1001
+ valid: (editRow.length === 0),
986
1002
  row: editRow.data
987
1003
  }, 'valid', true);
988
1004
  if (valid.toString() !== 'true') {
989
- editRow.error = valid;
990
- valid = false;
991
- }
992
- else {
993
- editRow.error = null;
1005
+ editRow.errors.push({
1006
+ type: 'error',
1007
+ rowError: true,
1008
+ message: valid.toString()
1009
+ });
994
1010
  }
995
1011
  if (valid === null) {
996
- valid = `Invalid row validation for ${this.key}`;
1012
+ editRow.errors.push({
1013
+ type: 'error',
1014
+ message: `Invalid row validation for ${this.key}`
1015
+ });
997
1016
  }
998
1017
  }
999
- editRow.errors = !valid ? this.errors.filter((err) => !errorsSnapshot.includes(err)) : null;
1000
1018
  if (!this.component.rowDrafts || ((_a = this.root) === null || _a === void 0 ? void 0 : _a.submitted)) {
1001
- this.showRowErrorAlerts(editRow, !!valid);
1019
+ this.showRowErrorAlerts(editRow, editRow.errors);
1002
1020
  }
1003
- return !!valid;
1021
+ return editRow.errors;
1004
1022
  }
1005
- showRowErrorAlerts(editRow, valid) {
1006
- var _a;
1023
+ showRowErrorAlerts(editRow, errors) {
1007
1024
  if (editRow.alerts) {
1008
1025
  if (this.alert) {
1009
- if (((_a = editRow.errors) === null || _a === void 0 ? void 0 : _a.length) && !valid) {
1010
- this.alert.showErrors(editRow.errors, false);
1026
+ if (errors.length) {
1027
+ this.alert.showErrors(errors, false);
1011
1028
  editRow.alerts = true;
1012
1029
  }
1013
1030
  else {
@@ -1016,40 +1033,35 @@ class EditGridComponent extends NestedArrayComponent_1.default {
1016
1033
  }
1017
1034
  }
1018
1035
  }
1019
- checkValidity(data, dirty, row, silentCheck) {
1020
- data = data || this.rootValue;
1021
- row = row || this.data;
1022
- if (!this.checkCondition(row, data)) {
1023
- this.setCustomValidity('');
1024
- return true;
1025
- }
1026
- return this.checkComponentValidity(data, dirty, row, { silentCheck });
1036
+ /**
1037
+ * Return that this component processes its own validation.
1038
+ */
1039
+ get processOwnValidation() {
1040
+ return true;
1027
1041
  }
1028
- checkComponentValidity(data, dirty, row, options = {}) {
1029
- var _a, _b, _c;
1042
+ checkComponentValidity(data, dirty, row, options = {}, errors = []) {
1043
+ var _a, _b;
1030
1044
  const { silentCheck } = options;
1031
- const errorsLength = this.errors.length;
1032
- const superValid = super.checkComponentValidity(data, dirty, row, options);
1045
+ const superValid = super.checkComponentValidity(data, dirty, row, options, errors);
1033
1046
  // If super tells us that component invalid and there is no need to update alerts, just return false
1034
1047
  if (!superValid && (!this.alert && !this.hasOpenRows())) {
1035
1048
  return false;
1036
1049
  }
1037
- if (this.shouldSkipValidation(data, dirty, row)) {
1038
- return true;
1039
- }
1040
- let rowsValid = true;
1041
1050
  let rowsEditing = false;
1051
+ const allRowErrors = [];
1042
1052
  this.editRows.forEach((editRow, index) => {
1043
1053
  // Trigger all errors on the row.
1044
- const rowValid = this.validateRow(editRow, dirty, silentCheck);
1045
- rowsValid &= rowValid;
1054
+ const rowErrors = this.validateRow(editRow, dirty, silentCheck);
1055
+ errors.push(...rowErrors);
1056
+ allRowErrors.push(...rowErrors);
1046
1057
  if (this.rowRefs) {
1047
1058
  const rowContainer = this.rowRefs[index];
1048
1059
  if (rowContainer) {
1049
1060
  const errorContainer = rowContainer.querySelector('.editgrid-row-error');
1050
- if (!rowValid && errorContainer && (!this.component.rowDrafts || this.shouldValidateDraft(editRow))) {
1061
+ if (rowErrors.length && errorContainer && (!this.component.rowDrafts || this.shouldValidateDraft(editRow))) {
1062
+ const rowError = rowErrors.find(error => error.rowError);
1051
1063
  this.addClass(errorContainer, 'help-block');
1052
- errorContainer.textContent = this.t(this.errorMessage('invalidRowError'));
1064
+ errorContainer.textContent = this.t(rowError ? rowError.message : this.errorMessage('invalidRowError'));
1053
1065
  }
1054
1066
  else if (errorContainer) {
1055
1067
  errorContainer.textContent = '';
@@ -1059,10 +1071,9 @@ class EditGridComponent extends NestedArrayComponent_1.default {
1059
1071
  // If this is a dirty check, and any rows are still editing, we need to throw validation error.
1060
1072
  rowsEditing |= (dirty && this.isOpen(editRow));
1061
1073
  });
1062
- if (!rowsValid) {
1063
- if (!silentCheck && (!this.component.rowDrafts || ((_a = this.root) === null || _a === void 0 ? void 0 : _a.submitted))) {
1074
+ if (allRowErrors.length) {
1075
+ if (!silentCheck && (dirty || this.dirty) && (!this.component.rowDrafts || ((_a = this.root) === null || _a === void 0 ? void 0 : _a.submitted))) {
1064
1076
  this.setCustomValidity(this.t(this.errorMessage('invalidRowsError')), dirty);
1065
- // Delete this class, because otherwise all the components inside EditGrid will has red border even if they are valid
1066
1077
  this.removeClass(this.element, 'has-error');
1067
1078
  }
1068
1079
  return false;
@@ -1072,15 +1083,28 @@ class EditGridComponent extends NestedArrayComponent_1.default {
1072
1083
  return false;
1073
1084
  }
1074
1085
  const message = this.invalid || this.invalidMessage(data, dirty);
1075
- if (((_b = this.errors) === null || _b === void 0 ? void 0 : _b.length) !== errorsLength && ((_c = this.root) === null || _c === void 0 ? void 0 : _c.submitted) && !message) {
1076
- this.setCustomValidity(message, dirty);
1077
- this.root.showErrors();
1086
+ if (allRowErrors.length && ((_b = this.root) === null || _b === void 0 ? void 0 : _b.submitted) && !message) {
1087
+ this._errors = this.setCustomValidity(message, dirty);
1088
+ errors.push(...this._errors);
1089
+ this.root.showErrors([message]);
1078
1090
  }
1079
1091
  else {
1080
- this.setCustomValidity(message, dirty);
1092
+ this._errors = this.setCustomValidity(message, dirty);
1093
+ errors.push(...this._errors);
1081
1094
  }
1082
1095
  return superValid;
1083
1096
  }
1097
+ setRowInvalid(ref, index) {
1098
+ const editRow = this.editRows[index];
1099
+ const errorContainer = ref.querySelector('.editgrid-row-error');
1100
+ if (errorContainer && (!this.component.rowDrafts || this.shouldValidateDraft(editRow))) {
1101
+ this.addClass(errorContainer, 'help-block');
1102
+ errorContainer.textContent = this.t(this.errorMessage('invalidRowError'));
1103
+ }
1104
+ else if (errorContainer) {
1105
+ errorContainer.textContent = '';
1106
+ }
1107
+ }
1084
1108
  changeState(changed, flags) {
1085
1109
  if (changed || (flags.resetValue && this.component.modalEdit)) {
1086
1110
  this.rebuild();
@@ -1102,7 +1126,6 @@ class EditGridComponent extends NestedArrayComponent_1.default {
1102
1126
  }
1103
1127
  }
1104
1128
  const changed = this.hasChanged(value, this.dataValue);
1105
- flags.noValidate = !changed;
1106
1129
  if (this.parent) {
1107
1130
  this.parent.checkComponentConditions();
1108
1131
  }
@@ -1115,7 +1138,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
1115
1138
  this.restoreRowContext(editRow, flags);
1116
1139
  editRow.state = EditRowState.Saved;
1117
1140
  editRow.backup = null;
1118
- editRow.error = null;
1141
+ editRow.errors = [];
1119
1142
  }
1120
1143
  else {
1121
1144
  this.editRows[rowIndex] = {
@@ -1123,7 +1146,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
1123
1146
  data: row,
1124
1147
  state: EditRowState.Saved,
1125
1148
  backup: null,
1126
- error: null,
1149
+ errors: [],
1127
1150
  };
1128
1151
  }
1129
1152
  });
@@ -28,7 +28,6 @@ class EmailComponent extends TextField_1.default {
28
28
  }
29
29
  init() {
30
30
  super.init();
31
- this.validators.push('email');
32
31
  }
33
32
  get defaultSchema() {
34
33
  return EmailComponent.schema();
@@ -283,7 +283,7 @@ class FileComponent extends Field_1.default {
283
283
  }
284
284
  deleteFile(fileInfo) {
285
285
  const { options = {} } = this.component;
286
- if (fileInfo && (['url', 'indexeddb', 's3', 'googledrive', 'azure'].includes(this.component.storage))) {
286
+ if (fileInfo && (['url', 'indexeddb'].includes(this.component.storage))) {
287
287
  const { fileService } = this;
288
288
  if (fileService && typeof fileService.deleteFile === 'function') {
289
289
  fileService.deleteFile(fileInfo, options);
@@ -0,0 +1,29 @@
1
+ declare namespace _default {
2
+ const type: string;
3
+ const display: string;
4
+ const components: ({
5
+ label: string;
6
+ tableView: boolean;
7
+ storage: string;
8
+ webcam: boolean;
9
+ fileTypes: {
10
+ label: string;
11
+ value: string;
12
+ }[];
13
+ key: string;
14
+ type: string;
15
+ input: boolean;
16
+ disableOnInvalid?: undefined;
17
+ } | {
18
+ type: string;
19
+ label: string;
20
+ key: string;
21
+ disableOnInvalid: boolean;
22
+ input: boolean;
23
+ tableView: boolean;
24
+ storage?: undefined;
25
+ webcam?: undefined;
26
+ fileTypes?: undefined;
27
+ })[];
28
+ }
29
+ export default _default;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ type: 'form',
5
+ display: 'form',
6
+ components: [
7
+ {
8
+ label: 'Upload',
9
+ tableView: false,
10
+ storage: 'base64',
11
+ webcam: false,
12
+ fileTypes: [
13
+ {
14
+ label: '',
15
+ value: ''
16
+ }
17
+ ],
18
+ key: 'file',
19
+ type: 'file',
20
+ input: true
21
+ },
22
+ {
23
+ type: 'button',
24
+ label: 'Submit',
25
+ key: 'submit',
26
+ disableOnInvalid: true,
27
+ input: true,
28
+ tableView: false
29
+ }
30
+ ],
31
+ };
@@ -25,10 +25,6 @@ export default class FormComponent extends Component {
25
25
  getSubOptions(options?: {}): {};
26
26
  render(): any;
27
27
  asString(value: any): any;
28
- /**
29
- * Prints out the value of form components as a datagrid value.
30
- */
31
- getValueAsString(value: any): any;
32
28
  attach(element: any): Promise<any>;
33
29
  get hasLoadedForm(): any;
34
30
  get isRevisionChanged(): any;
@@ -54,7 +50,7 @@ export default class FormComponent extends Component {
54
50
  loadSubForm(fromAttach: any): any;
55
51
  subFormLoading: boolean | undefined;
56
52
  get subFormData(): any;
57
- checkComponentValidity(data: any, dirty: any, row: any, options: any): any;
53
+ checkComponentValidity(data: any, dirty: any, row: any, options: any, errors?: any[]): any;
58
54
  checkComponentConditions(data: any, flags: any, row: any): any;
59
55
  calculateValue(data: any, flags: any, row: any): any;
60
56
  setPristine(pristine: any): void;
@@ -74,7 +70,7 @@ export default class FormComponent extends Component {
74
70
  *
75
71
  * @return {*}
76
72
  */
77
- submitSubForm(rejectOnError: any): any;
73
+ submitSubForm(): any;
78
74
  /**
79
75
  * Submit the form before the next page is triggered.
80
76
  */
@@ -143,7 +143,6 @@ class FormComponent extends Component_1.default {
143
143
  }
144
144
  }
145
145
  getSubOptions(options = {}) {
146
- options.parentPath = `${this.path}.data.`;
147
146
  options.events = this.createEmitter();
148
147
  // Make sure to not show the submit button in wizards in the nested forms.
149
148
  lodash_1.default.set(options, 'buttonSettings.showSubmit', false);
@@ -192,6 +191,12 @@ class FormComponent extends Component_1.default {
192
191
  if (this.options.onChange) {
193
192
  options.onChange = this.options.onChange;
194
193
  }
194
+ if (this.options.preview) {
195
+ options.preview = this.options.preview;
196
+ }
197
+ if (this.options.inEditGrid) {
198
+ options.inEditGrid = this.options.inEditGrid;
199
+ }
195
200
  return options;
196
201
  }
197
202
  render() {
@@ -207,7 +212,7 @@ class FormComponent extends Component_1.default {
207
212
  /**
208
213
  * Prints out the value of form components as a datagrid value.
209
214
  */
210
- getValueAsString(value) {
215
+ getValueAsString(value, options) {
211
216
  if (!value) {
212
217
  return 'No data provided';
213
218
  }
@@ -217,6 +222,30 @@ class FormComponent extends Component_1.default {
217
222
  if (!value.data || !Object.keys(value.data).length) {
218
223
  return 'No data provided';
219
224
  }
225
+ if (options === null || options === void 0 ? void 0 : options.email) {
226
+ let result = (`
227
+ <table border="1" style="width:100%">
228
+ <tbody>
229
+ `);
230
+ this.everyComponent((component) => {
231
+ if (component.isInputComponent && component.visible && !component.skipInEmail) {
232
+ result += (`
233
+ <tr>
234
+ <th style="padding: 5px 10px;">${component.label}</th>
235
+ <td style="width:100%;padding:5px 10px;">${component.getView(component.dataValue, options)}</td>
236
+ </tr>
237
+ `);
238
+ }
239
+ }, Object.assign(Object.assign({}, options), { fromRoot: true }));
240
+ result += (`
241
+ </tbody>
242
+ </table>
243
+ `);
244
+ return result;
245
+ }
246
+ if (lodash_1.default.isEmpty(value)) {
247
+ return '';
248
+ }
220
249
  return '[Complex Data]';
221
250
  }
222
251
  attach(element) {
@@ -389,11 +418,12 @@ class FormComponent extends Component_1.default {
389
418
  * Load the subform.
390
419
  */
391
420
  loadSubForm(fromAttach) {
421
+ var _a;
392
422
  if (this.builderMode || this.isHidden() || (this.isSubFormLazyLoad() && !fromAttach)) {
393
423
  return Promise.resolve();
394
424
  }
395
425
  if (this.hasLoadedForm && !this.isRevisionChanged &&
396
- !(this.options.pdf && this.useOriginalRevision && lodash_1.default.isNull(this.subForm) && !this.subFormLoading)) {
426
+ !(this.options.pdf && ((_a = this.component) === null || _a === void 0 ? void 0 : _a.useOriginalRevision) && lodash_1.default.isNull(this.subForm) && !this.subFormLoading)) {
397
427
  // Pass config down to sub forms.
398
428
  if (this.root && this.root.form && this.root.form.config && !this.formObj.config) {
399
429
  this.formObj.config = this.root.form.config;
@@ -405,6 +435,9 @@ class FormComponent extends Component_1.default {
405
435
  return (new Formio_1.Formio(this.formSrc)).loadForm({ params: { live: 1 } })
406
436
  .then((formObj) => {
407
437
  this.formObj = formObj;
438
+ if (this.options.pdf && this.component.useOriginalRevision) {
439
+ this.formObj.display = 'form';
440
+ }
408
441
  this.subFormLoading = false;
409
442
  return formObj;
410
443
  })
@@ -419,13 +452,13 @@ class FormComponent extends Component_1.default {
419
452
  var _a;
420
453
  return ((_a = this.dataValue) === null || _a === void 0 ? void 0 : _a.data) || {};
421
454
  }
422
- checkComponentValidity(data, dirty, row, options) {
455
+ checkComponentValidity(data, dirty, row, options, errors = []) {
423
456
  options = options || {};
424
457
  const silentCheck = options.silentCheck || false;
425
458
  if (this.subForm) {
426
- return this.subForm.checkValidity(this.subFormData, dirty, null, silentCheck);
459
+ return this.subForm.checkValidity(this.subFormData, dirty, null, silentCheck, errors);
427
460
  }
428
- return super.checkComponentValidity(data, dirty, row, options);
461
+ return super.checkComponentValidity(data, dirty, row, options, errors);
429
462
  }
430
463
  checkComponentConditions(data, flags, row) {
431
464
  const visible = super.checkComponentConditions(data, flags, row);
@@ -484,7 +517,7 @@ class FormComponent extends Component_1.default {
484
517
  *
485
518
  * @return {*}
486
519
  */
487
- submitSubForm(rejectOnError) {
520
+ submitSubForm() {
488
521
  // If we wish to submit the form on next page, then do that here.
489
522
  if (this.shouldSubmit) {
490
523
  return this.subFormReady.then(() => {
@@ -492,6 +525,7 @@ class FormComponent extends Component_1.default {
492
525
  return this.dataValue;
493
526
  }
494
527
  this.subForm.nosubmit = false;
528
+ this.subForm.submitted = true;
495
529
  return this.subForm.submitForm().then(result => {
496
530
  this.subForm.loading = false;
497
531
  this.subForm.showAllErrors = false;
@@ -499,13 +533,8 @@ class FormComponent extends Component_1.default {
499
533
  return this.dataValue;
500
534
  }).catch(err => {
501
535
  this.subForm.showAllErrors = true;
502
- if (rejectOnError) {
503
- this.subForm.onSubmissionError(err);
504
- return Promise.reject(err);
505
- }
506
- else {
507
- return {};
508
- }
536
+ this.subForm.onSubmissionError(err);
537
+ return Promise.reject(err);
509
538
  });
510
539
  });
511
540
  }