@formio/js 5.2.4-rc.0 → 5.2.5

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 (512) hide show
  1. package/dist/formio.builder.css +50 -161
  2. package/dist/formio.builder.min.css +1 -1
  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.css +49 -158
  7. package/dist/formio.form.js +108 -152
  8. package/dist/formio.form.min.css +1 -1
  9. package/dist/formio.form.min.js +1 -1
  10. package/dist/formio.form.min.js.LICENSE.txt +1 -1
  11. package/dist/formio.full.css +50 -161
  12. package/dist/formio.full.js +227 -401
  13. package/dist/formio.full.min.css +1 -1
  14. package/dist/formio.full.min.js +1 -1
  15. package/dist/formio.full.min.js.LICENSE.txt +1 -1
  16. package/dist/formio.js +18 -51
  17. package/dist/formio.min.js +1 -1
  18. package/dist/formio.min.js.LICENSE.txt +1 -1
  19. package/dist/formio.utils.js +14 -47
  20. package/dist/formio.utils.min.js +1 -1
  21. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  22. package/lib/cjs/CDN.js +12 -12
  23. package/lib/cjs/Element.d.ts +2 -3
  24. package/lib/cjs/Element.js +26 -29
  25. package/lib/cjs/Embed.js +42 -75
  26. package/lib/cjs/EventEmitter.js +1 -1
  27. package/lib/cjs/Form.d.ts +341 -371
  28. package/lib/cjs/Form.js +39 -153
  29. package/lib/cjs/FormBuilder.d.ts +3 -3
  30. package/lib/cjs/FormBuilder.js +3 -2
  31. package/lib/cjs/Formio.js +23 -26
  32. package/lib/cjs/InlineEmbed.js +17 -23
  33. package/lib/cjs/PDF.d.ts +0 -1
  34. package/lib/cjs/PDF.js +15 -18
  35. package/lib/cjs/PDFBuilder.js +36 -51
  36. package/lib/cjs/Webform.d.ts +366 -8
  37. package/lib/cjs/Webform.js +238 -177
  38. package/lib/cjs/WebformBuilder.js +152 -221
  39. package/lib/cjs/Wizard.js +65 -95
  40. package/lib/cjs/WizardBuilder.js +19 -27
  41. package/lib/cjs/addons/FormioAddon.js +1 -1
  42. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.form.js +57 -59
  43. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +16 -24
  44. package/lib/cjs/addons/index.js +3 -3
  45. package/lib/cjs/components/Components.js +4 -0
  46. package/lib/cjs/components/_classes/component/Component.form.js +11 -11
  47. package/lib/cjs/components/_classes/component/Component.js +198 -309
  48. package/lib/cjs/components/_classes/component/editForm/Component.edit.addons.js +4 -2
  49. package/lib/cjs/components/_classes/component/editForm/Component.edit.api.js +5 -5
  50. package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +11 -9
  51. package/lib/cjs/components/_classes/component/editForm/Component.edit.data.d.ts +0 -37
  52. package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +25 -39
  53. package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +29 -47
  54. package/lib/cjs/components/_classes/component/editForm/Component.edit.layout.js +9 -9
  55. package/lib/cjs/components/_classes/component/editForm/Component.edit.logic.js +7 -5
  56. package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +34 -37
  57. package/lib/cjs/components/_classes/component/editForm/utils.js +16 -12
  58. package/lib/cjs/components/_classes/componentModal/ComponentModal.js +6 -6
  59. package/lib/cjs/components/_classes/field/Field.js +1 -7
  60. package/lib/cjs/components/_classes/input/Input.js +26 -30
  61. package/lib/cjs/components/_classes/list/ListComponent.form.js +1 -1
  62. package/lib/cjs/components/_classes/list/ListComponent.js +18 -27
  63. package/lib/cjs/components/_classes/list/editForm/ListComponent.edit.data.js +9 -36
  64. package/lib/cjs/components/_classes/multivalue/Multivalue.js +13 -32
  65. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +1 -1
  66. package/lib/cjs/components/_classes/nested/NestedComponent.form.js +3 -3
  67. package/lib/cjs/components/_classes/nested/NestedComponent.js +75 -67
  68. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +14 -19
  69. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +17 -19
  70. package/lib/cjs/components/address/Address.d.ts +0 -1
  71. package/lib/cjs/components/address/Address.js +52 -57
  72. package/lib/cjs/components/address/editForm/Address.edit.data.js +2 -2
  73. package/lib/cjs/components/address/editForm/Address.edit.display.js +2 -2
  74. package/lib/cjs/components/address/editForm/Address.edit.provider.js +11 -53
  75. package/lib/cjs/components/alert/Alert.js +15 -21
  76. package/lib/cjs/components/button/Button.form.js +1 -1
  77. package/lib/cjs/components/button/Button.js +47 -64
  78. package/lib/cjs/components/button/editForm/Button.edit.display.js +9 -49
  79. package/lib/cjs/components/checkbox/Checkbox.d.ts +1 -1
  80. package/lib/cjs/components/checkbox/Checkbox.form.js +3 -3
  81. package/lib/cjs/components/checkbox/Checkbox.js +20 -28
  82. package/lib/cjs/components/checkbox/editForm/Checkbox.edit.data.js +1 -1
  83. package/lib/cjs/components/checkbox/editForm/Checkbox.edit.display.js +3 -13
  84. package/lib/cjs/components/checkbox/editForm/Checkbox.edit.validation.js +2 -2
  85. package/lib/cjs/components/columns/Columns.form.js +1 -1
  86. package/lib/cjs/components/columns/Columns.js +12 -24
  87. package/lib/cjs/components/columns/editForm/Columns.edit.display.js +17 -17
  88. package/lib/cjs/components/container/Container.form.js +2 -2
  89. package/lib/cjs/components/container/Container.js +4 -6
  90. package/lib/cjs/components/container/editForm/Container.edit.data.js +3 -3
  91. package/lib/cjs/components/container/editForm/Container.edit.display.js +4 -4
  92. package/lib/cjs/components/content/Content.form.js +2 -4
  93. package/lib/cjs/components/content/Content.js +8 -10
  94. package/lib/cjs/components/content/editForm/Content.edit.display.js +10 -10
  95. package/lib/cjs/components/currency/Currency.form.js +3 -3
  96. package/lib/cjs/components/currency/Currency.js +10 -19
  97. package/lib/cjs/components/currency/editForm/Currency.edit.data.js +5 -5
  98. package/lib/cjs/components/currency/editForm/Currency.edit.display.js +8 -8
  99. package/lib/cjs/components/datagrid/DataGrid.form.js +3 -3
  100. package/lib/cjs/components/datagrid/DataGrid.js +42 -92
  101. package/lib/cjs/components/datagrid/editForm/DataGrid.edit.data.js +1 -1
  102. package/lib/cjs/components/datagrid/editForm/DataGrid.edit.display.js +14 -14
  103. package/lib/cjs/components/datagrid/editForm/DataGrid.edit.validation.js +3 -3
  104. package/lib/cjs/components/datamap/DataMap.form.js +2 -2
  105. package/lib/cjs/components/datamap/DataMap.js +35 -46
  106. package/lib/cjs/components/datamap/editForm/DataMap.edit.data.js +1 -1
  107. package/lib/cjs/components/datamap/editForm/DataMap.edit.display.js +8 -8
  108. package/lib/cjs/components/datetime/DateTime.form.js +5 -5
  109. package/lib/cjs/components/datetime/DateTime.js +15 -30
  110. package/lib/cjs/components/datetime/editForm/DateTime.edit.data.js +3 -4
  111. package/lib/cjs/components/datetime/editForm/DateTime.edit.date.js +10 -10
  112. package/lib/cjs/components/datetime/editForm/DateTime.edit.display.js +17 -22
  113. package/lib/cjs/components/datetime/editForm/DateTime.edit.time.js +5 -5
  114. package/lib/cjs/components/datetime/editForm/DateTime.edit.validation.js +3 -3
  115. package/lib/cjs/components/day/Day.form.js +5 -5
  116. package/lib/cjs/components/day/Day.js +58 -147
  117. package/lib/cjs/components/day/editForm/Day.edit.day.js +9 -13
  118. package/lib/cjs/components/day/editForm/Day.edit.display.js +7 -7
  119. package/lib/cjs/components/day/editForm/Day.edit.month.js +8 -12
  120. package/lib/cjs/components/day/editForm/Day.edit.validation.js +7 -7
  121. package/lib/cjs/components/day/editForm/Day.edit.year.js +8 -8
  122. package/lib/cjs/components/editgrid/EditGrid.form.js +2 -2
  123. package/lib/cjs/components/editgrid/EditGrid.js +96 -142
  124. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.data.js +2 -2
  125. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +2 -7
  126. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.templates.js +16 -16
  127. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.validation.js +3 -3
  128. package/lib/cjs/components/email/Email.js +4 -4
  129. package/lib/cjs/components/email/editForm/Email.edit.display.js +3 -3
  130. package/lib/cjs/components/email/editForm/Email.edit.validation.js +6 -6
  131. package/lib/cjs/components/fieldset/Fieldset.form.js +1 -1
  132. package/lib/cjs/components/fieldset/Fieldset.js +2 -2
  133. package/lib/cjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -8
  134. package/lib/cjs/components/file/File.form.js +4 -4
  135. package/lib/cjs/components/file/File.js +90 -131
  136. package/lib/cjs/components/file/editForm/File.edit.display.js +5 -9
  137. package/lib/cjs/components/file/editForm/File.edit.file.js +53 -97
  138. package/lib/cjs/components/file/editForm/File.edit.validation.js +2 -2
  139. package/lib/cjs/components/form/Form.form.js +3 -3
  140. package/lib/cjs/components/form/Form.js +58 -68
  141. package/lib/cjs/components/form/editForm/Form.edit.data.js +3 -1
  142. package/lib/cjs/components/form/editForm/Form.edit.display.js +7 -6
  143. package/lib/cjs/components/form/editForm/Form.edit.form.js +9 -11
  144. package/lib/cjs/components/hidden/Hidden.form.js +4 -4
  145. package/lib/cjs/components/hidden/Hidden.js +2 -2
  146. package/lib/cjs/components/hidden/editForm/Hidden.edit.data.js +3 -3
  147. package/lib/cjs/components/hidden/editForm/Hidden.edit.display.js +10 -10
  148. package/lib/cjs/components/html/HTML.js +17 -23
  149. package/lib/cjs/components/html/editForm/HTML.edit.display.js +17 -17
  150. package/lib/cjs/components/html/editForm/HTML.edit.logic.js +2 -2
  151. package/lib/cjs/components/number/Number.form.js +3 -3
  152. package/lib/cjs/components/number/Number.js +11 -27
  153. package/lib/cjs/components/number/editForm/Number.edit.data.js +3 -3
  154. package/lib/cjs/components/number/editForm/Number.edit.display.js +4 -4
  155. package/lib/cjs/components/number/editForm/Number.edit.validation.js +9 -9
  156. package/lib/cjs/components/panel/Panel.form.js +1 -1
  157. package/lib/cjs/components/panel/Panel.js +2 -2
  158. package/lib/cjs/components/panel/editForm/Panel.edit.conditional.js +7 -5
  159. package/lib/cjs/components/panel/editForm/Panel.edit.display.js +29 -55
  160. package/lib/cjs/components/password/Password.form.js +3 -3
  161. package/lib/cjs/components/password/Password.js +2 -5
  162. package/lib/cjs/components/password/editForm/Password.edit.data.js +11 -11
  163. package/lib/cjs/components/password/editForm/Password.edit.display.js +3 -3
  164. package/lib/cjs/components/password/editForm/Password.edit.validation.js +3 -3
  165. package/lib/cjs/components/phonenumber/PhoneNumber.form.js +8 -8
  166. package/lib/cjs/components/phonenumber/PhoneNumber.js +3 -3
  167. package/lib/cjs/components/phonenumber/editForm/PhoneNumber.edit.validation.js +6 -6
  168. package/lib/cjs/components/radio/Radio.form.js +3 -3
  169. package/lib/cjs/components/radio/Radio.js +32 -58
  170. package/lib/cjs/components/radio/editForm/Radio.edit.data.js +9 -23
  171. package/lib/cjs/components/radio/editForm/Radio.edit.display.js +6 -6
  172. package/lib/cjs/components/radio/editForm/Radio.edit.validation.js +2 -2
  173. package/lib/cjs/components/recaptcha/ReCaptcha.form.js +5 -5
  174. package/lib/cjs/components/recaptcha/ReCaptcha.js +10 -10
  175. package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +24 -24
  176. package/lib/cjs/components/select/Select.form.js +3 -3
  177. package/lib/cjs/components/select/Select.js +140 -235
  178. package/lib/cjs/components/select/editForm/Select.edit.data.d.ts +1 -1
  179. package/lib/cjs/components/select/editForm/Select.edit.data.js +57 -191
  180. package/lib/cjs/components/select/editForm/Select.edit.display.js +2 -2
  181. package/lib/cjs/components/select/editForm/Select.edit.validation.js +4 -4
  182. package/lib/cjs/components/selectboxes/SelectBoxes.form.js +3 -3
  183. package/lib/cjs/components/selectboxes/SelectBoxes.js +16 -29
  184. package/lib/cjs/components/selectboxes/editForm/SelectBoxes.edit.validation.js +5 -5
  185. package/lib/cjs/components/signature/Signature.form.js +3 -3
  186. package/lib/cjs/components/signature/Signature.js +17 -26
  187. package/lib/cjs/components/signature/editForm/Signature.edit.display.js +10 -19
  188. package/lib/cjs/components/survey/Survey.form.js +3 -3
  189. package/lib/cjs/components/survey/Survey.js +17 -30
  190. package/lib/cjs/components/survey/editForm/Survey.edit.data.js +11 -23
  191. package/lib/cjs/components/survey/editForm/Survey.edit.display.js +1 -1
  192. package/lib/cjs/components/survey/editForm/Survey.edit.validation.js +1 -1
  193. package/lib/cjs/components/table/Table.form.js +1 -1
  194. package/lib/cjs/components/table/Table.js +7 -8
  195. package/lib/cjs/components/table/editForm/Table.edit.display.js +22 -22
  196. package/lib/cjs/components/tabs/Tabs.form.js +1 -1
  197. package/lib/cjs/components/tabs/Tabs.js +10 -27
  198. package/lib/cjs/components/tabs/editForm/Tabs.edit.display.js +17 -21
  199. package/lib/cjs/components/tags/Tags.form.js +1 -1
  200. package/lib/cjs/components/tags/Tags.js +12 -28
  201. package/lib/cjs/components/tags/editForm/Tags.edit.data.js +7 -7
  202. package/lib/cjs/components/textarea/TextArea.form.js +2 -2
  203. package/lib/cjs/components/textarea/TextArea.js +45 -63
  204. package/lib/cjs/components/textarea/editForm/TextArea.edit.display.js +72 -96
  205. package/lib/cjs/components/textarea/editForm/TextArea.edit.validation.js +3 -3
  206. package/lib/cjs/components/textfield/TextField.form.js +3 -3
  207. package/lib/cjs/components/textfield/TextField.js +21 -32
  208. package/lib/cjs/components/textfield/editForm/TextField.edit.data.js +13 -15
  209. package/lib/cjs/components/textfield/editForm/TextField.edit.display.js +21 -31
  210. package/lib/cjs/components/textfield/editForm/TextField.edit.validation.js +6 -6
  211. package/lib/cjs/components/time/Time.js +10 -17
  212. package/lib/cjs/components/time/editForm/Time.edit.display.js +2 -2
  213. package/lib/cjs/components/unknown/Unknown.form.js +5 -5
  214. package/lib/cjs/components/unknown/Unknown.js +2 -2
  215. package/lib/cjs/components/unknown/editForm/Unknown.edit.display.js +3 -3
  216. package/lib/cjs/components/url/Url.form.js +3 -3
  217. package/lib/cjs/components/url/Url.js +2 -2
  218. package/lib/cjs/components/url/editForm/Url.edit.display.js +3 -3
  219. package/lib/cjs/components/url/editForm/Url.edit.validation.js +1 -1
  220. package/lib/cjs/components/well/Well.form.js +1 -1
  221. package/lib/cjs/components/well/Well.js +2 -2
  222. package/lib/cjs/components/well/editForm/Well.edit.display.js +10 -10
  223. package/lib/cjs/formio.form.d.ts +1 -2
  224. package/lib/cjs/formio.form.js +12 -38
  225. package/lib/cjs/i18n.d.ts +0 -4
  226. package/lib/cjs/i18n.js +3 -7
  227. package/lib/cjs/package.json +1 -1
  228. package/lib/cjs/pdf.image.d.ts +2 -0
  229. package/lib/cjs/pdf.image.js +94 -0
  230. package/lib/cjs/providers/address/AddressProvider.js +5 -8
  231. package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +3 -3
  232. package/lib/cjs/providers/address/GoogleAddressProvider.js +13 -24
  233. package/lib/cjs/providers/processor/fileProcessor.js +1 -3
  234. package/lib/cjs/providers/storage/azure.js +2 -5
  235. package/lib/cjs/providers/storage/dropbox.js +5 -4
  236. package/lib/cjs/providers/storage/googleDrive.js +4 -3
  237. package/lib/cjs/providers/storage/index.js +1 -1
  238. package/lib/cjs/providers/storage/indexeddb.js +6 -16
  239. package/lib/cjs/providers/storage/s3.js +6 -17
  240. package/lib/cjs/providers/storage/uploadAdapter.js +11 -17
  241. package/lib/cjs/providers/storage/url.js +11 -13
  242. package/lib/cjs/providers/storage/xhr.js +9 -17
  243. package/lib/cjs/templates/index.js +1 -1
  244. package/lib/cjs/translations/en.d.ts +2 -0
  245. package/lib/cjs/translations/en.js +9 -7
  246. package/lib/cjs/utils/ChoicesWrapper.js +2 -2
  247. package/lib/cjs/utils/builder.js +7 -31
  248. package/lib/cjs/utils/calendarUtils.js +5 -7
  249. package/lib/cjs/utils/conditionOperators/ConditionOperator.js +1 -1
  250. package/lib/cjs/utils/conditionOperators/DateGreaterThan.js +4 -12
  251. package/lib/cjs/utils/conditionOperators/IsEmptyValue.js +1 -3
  252. package/lib/cjs/utils/conditionOperators/IsEqualTo.js +6 -10
  253. package/lib/cjs/utils/conditionOperators/index.js +1 -1
  254. package/lib/cjs/utils/formUtils.js +1 -1
  255. package/lib/cjs/utils/i18n.js +1 -7
  256. package/lib/cjs/utils/index.d.ts +1 -2
  257. package/lib/cjs/utils/index.js +2 -2
  258. package/lib/cjs/utils/jsonlogic/operators.d.ts +1 -0
  259. package/lib/cjs/utils/jsonlogic/operators.js +265 -0
  260. package/lib/cjs/utils/utils.d.ts +1 -10
  261. package/lib/cjs/utils/utils.js +92 -175
  262. package/lib/cjs/widgets/CalendarWidget.js +49 -66
  263. package/lib/cjs/widgets/InputWidget.js +4 -6
  264. package/lib/cjs/widgets/index.js +1 -1
  265. package/lib/mjs/CDN.js +12 -12
  266. package/lib/mjs/Element.d.ts +2 -3
  267. package/lib/mjs/Element.js +23 -29
  268. package/lib/mjs/Embed.js +43 -77
  269. package/lib/mjs/EventEmitter.js +1 -1
  270. package/lib/mjs/Form.d.ts +341 -371
  271. package/lib/mjs/Form.js +126 -142
  272. package/lib/mjs/FormBuilder.d.ts +3 -3
  273. package/lib/mjs/FormBuilder.js +3 -2
  274. package/lib/mjs/Formio.js +23 -26
  275. package/lib/mjs/InlineEmbed.js +17 -23
  276. package/lib/mjs/PDF.d.ts +0 -1
  277. package/lib/mjs/PDF.js +15 -18
  278. package/lib/mjs/PDFBuilder.js +36 -51
  279. package/lib/mjs/Webform.d.ts +366 -8
  280. package/lib/mjs/Webform.js +251 -184
  281. package/lib/mjs/WebformBuilder.js +151 -224
  282. package/lib/mjs/Wizard.js +64 -94
  283. package/lib/mjs/WizardBuilder.js +19 -27
  284. package/lib/mjs/addons/FormioAddon.js +1 -1
  285. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.form.js +57 -59
  286. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +16 -24
  287. package/lib/mjs/addons/index.js +3 -3
  288. package/lib/mjs/components/Components.js +4 -0
  289. package/lib/mjs/components/_classes/component/Component.form.js +11 -11
  290. package/lib/mjs/components/_classes/component/Component.js +194 -313
  291. package/lib/mjs/components/_classes/component/editForm/Component.edit.addons.js +4 -2
  292. package/lib/mjs/components/_classes/component/editForm/Component.edit.api.js +5 -5
  293. package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +11 -9
  294. package/lib/mjs/components/_classes/component/editForm/Component.edit.data.d.ts +0 -37
  295. package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +25 -39
  296. package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +29 -47
  297. package/lib/mjs/components/_classes/component/editForm/Component.edit.layout.js +9 -9
  298. package/lib/mjs/components/_classes/component/editForm/Component.edit.logic.js +7 -5
  299. package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +34 -37
  300. package/lib/mjs/components/_classes/component/editForm/utils.js +16 -12
  301. package/lib/mjs/components/_classes/componentModal/ComponentModal.js +2 -2
  302. package/lib/mjs/components/_classes/field/Field.js +2 -8
  303. package/lib/mjs/components/_classes/input/Input.js +23 -27
  304. package/lib/mjs/components/_classes/list/ListComponent.form.js +1 -1
  305. package/lib/mjs/components/_classes/list/ListComponent.js +18 -27
  306. package/lib/mjs/components/_classes/list/editForm/ListComponent.edit.data.js +9 -36
  307. package/lib/mjs/components/_classes/multivalue/Multivalue.js +13 -32
  308. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +1 -1
  309. package/lib/mjs/components/_classes/nested/NestedComponent.form.js +3 -3
  310. package/lib/mjs/components/_classes/nested/NestedComponent.js +33 -41
  311. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +15 -20
  312. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +17 -19
  313. package/lib/mjs/components/address/Address.d.ts +0 -1
  314. package/lib/mjs/components/address/Address.js +49 -60
  315. package/lib/mjs/components/address/editForm/Address.edit.data.js +2 -2
  316. package/lib/mjs/components/address/editForm/Address.edit.display.js +2 -2
  317. package/lib/mjs/components/address/editForm/Address.edit.provider.js +11 -53
  318. package/lib/mjs/components/alert/Alert.js +16 -22
  319. package/lib/mjs/components/button/Button.form.js +1 -1
  320. package/lib/mjs/components/button/Button.js +42 -65
  321. package/lib/mjs/components/button/editForm/Button.edit.display.js +9 -49
  322. package/lib/mjs/components/checkbox/Checkbox.d.ts +1 -1
  323. package/lib/mjs/components/checkbox/Checkbox.form.js +3 -3
  324. package/lib/mjs/components/checkbox/Checkbox.js +21 -29
  325. package/lib/mjs/components/checkbox/editForm/Checkbox.edit.data.js +1 -1
  326. package/lib/mjs/components/checkbox/editForm/Checkbox.edit.display.js +3 -13
  327. package/lib/mjs/components/checkbox/editForm/Checkbox.edit.validation.js +2 -2
  328. package/lib/mjs/components/columns/Columns.form.js +1 -1
  329. package/lib/mjs/components/columns/Columns.js +12 -24
  330. package/lib/mjs/components/columns/editForm/Columns.edit.display.js +17 -17
  331. package/lib/mjs/components/container/Container.form.js +2 -2
  332. package/lib/mjs/components/container/Container.js +4 -6
  333. package/lib/mjs/components/container/editForm/Container.edit.data.js +3 -3
  334. package/lib/mjs/components/container/editForm/Container.edit.display.js +4 -4
  335. package/lib/mjs/components/content/Content.form.js +2 -4
  336. package/lib/mjs/components/content/Content.js +8 -10
  337. package/lib/mjs/components/content/editForm/Content.edit.display.js +10 -10
  338. package/lib/mjs/components/currency/Currency.form.js +3 -3
  339. package/lib/mjs/components/currency/Currency.js +10 -19
  340. package/lib/mjs/components/currency/editForm/Currency.edit.data.js +5 -5
  341. package/lib/mjs/components/currency/editForm/Currency.edit.display.js +8 -8
  342. package/lib/mjs/components/datagrid/DataGrid.form.js +3 -3
  343. package/lib/mjs/components/datagrid/DataGrid.js +41 -92
  344. package/lib/mjs/components/datagrid/editForm/DataGrid.edit.data.js +1 -1
  345. package/lib/mjs/components/datagrid/editForm/DataGrid.edit.display.js +14 -14
  346. package/lib/mjs/components/datagrid/editForm/DataGrid.edit.validation.js +3 -3
  347. package/lib/mjs/components/datamap/DataMap.form.js +2 -2
  348. package/lib/mjs/components/datamap/DataMap.js +33 -46
  349. package/lib/mjs/components/datamap/editForm/DataMap.edit.data.js +1 -1
  350. package/lib/mjs/components/datamap/editForm/DataMap.edit.display.js +8 -8
  351. package/lib/mjs/components/datetime/DateTime.form.js +5 -5
  352. package/lib/mjs/components/datetime/DateTime.js +16 -31
  353. package/lib/mjs/components/datetime/editForm/DateTime.edit.data.js +3 -4
  354. package/lib/mjs/components/datetime/editForm/DateTime.edit.date.js +10 -10
  355. package/lib/mjs/components/datetime/editForm/DateTime.edit.display.js +17 -22
  356. package/lib/mjs/components/datetime/editForm/DateTime.edit.time.js +5 -5
  357. package/lib/mjs/components/datetime/editForm/DateTime.edit.validation.js +3 -3
  358. package/lib/mjs/components/day/Day.form.js +5 -5
  359. package/lib/mjs/components/day/Day.js +58 -148
  360. package/lib/mjs/components/day/editForm/Day.edit.day.js +9 -13
  361. package/lib/mjs/components/day/editForm/Day.edit.display.js +7 -7
  362. package/lib/mjs/components/day/editForm/Day.edit.month.js +8 -12
  363. package/lib/mjs/components/day/editForm/Day.edit.validation.js +7 -7
  364. package/lib/mjs/components/day/editForm/Day.edit.year.js +8 -8
  365. package/lib/mjs/components/editgrid/EditGrid.form.js +2 -2
  366. package/lib/mjs/components/editgrid/EditGrid.js +92 -140
  367. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.data.js +2 -2
  368. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +2 -7
  369. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.templates.js +16 -16
  370. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.validation.js +3 -3
  371. package/lib/mjs/components/email/Email.js +4 -4
  372. package/lib/mjs/components/email/editForm/Email.edit.display.js +3 -3
  373. package/lib/mjs/components/email/editForm/Email.edit.validation.js +6 -6
  374. package/lib/mjs/components/fieldset/Fieldset.form.js +1 -1
  375. package/lib/mjs/components/fieldset/Fieldset.js +2 -2
  376. package/lib/mjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -8
  377. package/lib/mjs/components/file/File.form.js +4 -4
  378. package/lib/mjs/components/file/File.js +89 -136
  379. package/lib/mjs/components/file/editForm/File.edit.display.js +5 -9
  380. package/lib/mjs/components/file/editForm/File.edit.file.js +53 -97
  381. package/lib/mjs/components/file/editForm/File.edit.validation.js +2 -2
  382. package/lib/mjs/components/form/Form.form.js +3 -3
  383. package/lib/mjs/components/form/Form.js +55 -68
  384. package/lib/mjs/components/form/editForm/Form.edit.data.js +3 -1
  385. package/lib/mjs/components/form/editForm/Form.edit.display.js +7 -6
  386. package/lib/mjs/components/form/editForm/Form.edit.form.js +8 -10
  387. package/lib/mjs/components/hidden/Hidden.form.js +4 -4
  388. package/lib/mjs/components/hidden/Hidden.js +2 -2
  389. package/lib/mjs/components/hidden/editForm/Hidden.edit.data.js +3 -3
  390. package/lib/mjs/components/hidden/editForm/Hidden.edit.display.js +10 -10
  391. package/lib/mjs/components/html/HTML.js +17 -23
  392. package/lib/mjs/components/html/editForm/HTML.edit.display.js +17 -17
  393. package/lib/mjs/components/html/editForm/HTML.edit.logic.js +2 -2
  394. package/lib/mjs/components/number/Number.form.js +3 -3
  395. package/lib/mjs/components/number/Number.js +12 -28
  396. package/lib/mjs/components/number/editForm/Number.edit.data.js +3 -3
  397. package/lib/mjs/components/number/editForm/Number.edit.display.js +4 -4
  398. package/lib/mjs/components/number/editForm/Number.edit.validation.js +9 -9
  399. package/lib/mjs/components/panel/Panel.form.js +1 -1
  400. package/lib/mjs/components/panel/Panel.js +2 -2
  401. package/lib/mjs/components/panel/editForm/Panel.edit.conditional.js +8 -6
  402. package/lib/mjs/components/panel/editForm/Panel.edit.display.js +29 -55
  403. package/lib/mjs/components/password/Password.form.js +3 -3
  404. package/lib/mjs/components/password/Password.js +2 -5
  405. package/lib/mjs/components/password/editForm/Password.edit.data.js +11 -11
  406. package/lib/mjs/components/password/editForm/Password.edit.display.js +3 -3
  407. package/lib/mjs/components/password/editForm/Password.edit.validation.js +3 -3
  408. package/lib/mjs/components/phonenumber/PhoneNumber.form.js +8 -8
  409. package/lib/mjs/components/phonenumber/PhoneNumber.js +3 -3
  410. package/lib/mjs/components/phonenumber/editForm/PhoneNumber.edit.validation.js +6 -6
  411. package/lib/mjs/components/radio/Radio.form.js +3 -3
  412. package/lib/mjs/components/radio/Radio.js +30 -59
  413. package/lib/mjs/components/radio/editForm/Radio.edit.data.js +9 -23
  414. package/lib/mjs/components/radio/editForm/Radio.edit.display.js +6 -6
  415. package/lib/mjs/components/radio/editForm/Radio.edit.validation.js +2 -2
  416. package/lib/mjs/components/recaptcha/ReCaptcha.form.js +5 -5
  417. package/lib/mjs/components/recaptcha/ReCaptcha.js +8 -10
  418. package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +24 -24
  419. package/lib/mjs/components/select/Select.form.js +3 -3
  420. package/lib/mjs/components/select/Select.js +145 -240
  421. package/lib/mjs/components/select/editForm/Select.edit.data.d.ts +1 -1
  422. package/lib/mjs/components/select/editForm/Select.edit.data.js +57 -191
  423. package/lib/mjs/components/select/editForm/Select.edit.display.js +2 -2
  424. package/lib/mjs/components/select/editForm/Select.edit.validation.js +4 -4
  425. package/lib/mjs/components/selectboxes/SelectBoxes.form.js +3 -3
  426. package/lib/mjs/components/selectboxes/SelectBoxes.js +16 -30
  427. package/lib/mjs/components/selectboxes/editForm/SelectBoxes.edit.validation.js +5 -5
  428. package/lib/mjs/components/signature/Signature.form.js +3 -3
  429. package/lib/mjs/components/signature/Signature.js +16 -26
  430. package/lib/mjs/components/signature/editForm/Signature.edit.display.js +10 -19
  431. package/lib/mjs/components/survey/Survey.form.js +3 -3
  432. package/lib/mjs/components/survey/Survey.js +17 -30
  433. package/lib/mjs/components/survey/editForm/Survey.edit.data.js +11 -23
  434. package/lib/mjs/components/survey/editForm/Survey.edit.display.js +1 -1
  435. package/lib/mjs/components/survey/editForm/Survey.edit.validation.js +1 -1
  436. package/lib/mjs/components/table/Table.form.js +1 -1
  437. package/lib/mjs/components/table/Table.js +6 -8
  438. package/lib/mjs/components/table/editForm/Table.edit.display.js +22 -22
  439. package/lib/mjs/components/tabs/Tabs.form.js +1 -1
  440. package/lib/mjs/components/tabs/Tabs.js +9 -27
  441. package/lib/mjs/components/tabs/editForm/Tabs.edit.display.js +17 -21
  442. package/lib/mjs/components/tags/Tags.form.js +1 -1
  443. package/lib/mjs/components/tags/Tags.js +12 -28
  444. package/lib/mjs/components/tags/editForm/Tags.edit.data.js +7 -7
  445. package/lib/mjs/components/textarea/TextArea.form.js +2 -2
  446. package/lib/mjs/components/textarea/TextArea.js +51 -75
  447. package/lib/mjs/components/textarea/editForm/TextArea.edit.display.js +72 -96
  448. package/lib/mjs/components/textarea/editForm/TextArea.edit.validation.js +3 -3
  449. package/lib/mjs/components/textfield/TextField.form.js +3 -3
  450. package/lib/mjs/components/textfield/TextField.js +23 -34
  451. package/lib/mjs/components/textfield/editForm/TextField.edit.data.js +13 -15
  452. package/lib/mjs/components/textfield/editForm/TextField.edit.display.js +21 -31
  453. package/lib/mjs/components/textfield/editForm/TextField.edit.validation.js +6 -6
  454. package/lib/mjs/components/time/Time.js +10 -17
  455. package/lib/mjs/components/time/editForm/Time.edit.display.js +2 -2
  456. package/lib/mjs/components/unknown/Unknown.form.js +5 -5
  457. package/lib/mjs/components/unknown/Unknown.js +2 -2
  458. package/lib/mjs/components/unknown/editForm/Unknown.edit.display.js +3 -3
  459. package/lib/mjs/components/url/Url.form.js +3 -3
  460. package/lib/mjs/components/url/Url.js +2 -2
  461. package/lib/mjs/components/url/editForm/Url.edit.display.js +3 -3
  462. package/lib/mjs/components/url/editForm/Url.edit.validation.js +1 -1
  463. package/lib/mjs/components/well/Well.form.js +1 -1
  464. package/lib/mjs/components/well/Well.js +2 -2
  465. package/lib/mjs/components/well/editForm/Well.edit.display.js +10 -10
  466. package/lib/mjs/formio.form.d.ts +1 -2
  467. package/lib/mjs/formio.form.js +8 -10
  468. package/lib/mjs/i18n.d.ts +0 -4
  469. package/lib/mjs/i18n.js +3 -7
  470. package/lib/mjs/package.json +1 -1
  471. package/lib/mjs/pdf.image.d.ts +2 -0
  472. package/lib/mjs/pdf.image.js +94 -0
  473. package/lib/mjs/providers/address/AddressProvider.js +5 -8
  474. package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +3 -3
  475. package/lib/mjs/providers/address/GoogleAddressProvider.js +13 -24
  476. package/lib/mjs/providers/processor/fileProcessor.js +1 -3
  477. package/lib/mjs/providers/storage/azure.js +2 -5
  478. package/lib/mjs/providers/storage/dropbox.js +5 -4
  479. package/lib/mjs/providers/storage/googleDrive.js +4 -3
  480. package/lib/mjs/providers/storage/index.js +1 -1
  481. package/lib/mjs/providers/storage/indexeddb.js +6 -16
  482. package/lib/mjs/providers/storage/s3.js +8 -19
  483. package/lib/mjs/providers/storage/uploadAdapter.js +11 -17
  484. package/lib/mjs/providers/storage/url.js +11 -13
  485. package/lib/mjs/providers/storage/xhr.js +9 -17
  486. package/lib/mjs/templates/index.js +1 -1
  487. package/lib/mjs/translations/en.d.ts +2 -0
  488. package/lib/mjs/translations/en.js +9 -7
  489. package/lib/mjs/utils/ChoicesWrapper.js +2 -2
  490. package/lib/mjs/utils/builder.js +7 -31
  491. package/lib/mjs/utils/calendarUtils.js +5 -7
  492. package/lib/mjs/utils/conditionOperators/ConditionOperator.js +1 -1
  493. package/lib/mjs/utils/conditionOperators/DateGreaterThan.js +5 -16
  494. package/lib/mjs/utils/conditionOperators/IsEmptyValue.js +1 -3
  495. package/lib/mjs/utils/conditionOperators/IsEqualTo.js +6 -10
  496. package/lib/mjs/utils/conditionOperators/index.js +1 -1
  497. package/lib/mjs/utils/formUtils.js +2 -2
  498. package/lib/mjs/utils/i18n.js +1 -7
  499. package/lib/mjs/utils/index.d.ts +1 -2
  500. package/lib/mjs/utils/index.js +3 -3
  501. package/lib/mjs/utils/jsonlogic/operators.d.ts +1 -0
  502. package/lib/mjs/utils/jsonlogic/operators.js +262 -0
  503. package/lib/mjs/utils/utils.d.ts +1 -10
  504. package/lib/mjs/utils/utils.js +91 -178
  505. package/lib/mjs/widgets/CalendarWidget.js +50 -67
  506. package/lib/mjs/widgets/InputWidget.js +4 -6
  507. package/lib/mjs/widgets/index.js +1 -1
  508. package/package.json +3 -3
  509. package/lib/cjs/translations/de.d.ts +0 -80
  510. package/lib/cjs/translations/de.js +0 -81
  511. package/lib/mjs/translations/de.d.ts +0 -80
  512. package/lib/mjs/translations/de.js +0 -79
@@ -27,10 +27,10 @@ Formio_1.Formio.registerComponent = Components_1.default.setComponent;
27
27
  * @returns {any} - The icon set.
28
28
  */
29
29
  function getIconSet(icons) {
30
- if (icons === 'fontawesome') {
31
- return 'fa';
30
+ if (icons === "fontawesome") {
31
+ return "fa";
32
32
  }
33
- return icons || '';
33
+ return icons || "";
34
34
  }
35
35
  /**
36
36
  *
@@ -45,7 +45,7 @@ function getOptions(options) {
45
45
  saveDraft: false,
46
46
  alwaysDirty: false,
47
47
  saveDraftThrottle: 5000,
48
- display: 'form',
48
+ display: "form",
49
49
  cdnUrl: Formio_1.Formio.cdn.baseUrl,
50
50
  });
51
51
  if (!options.events) {
@@ -54,8 +54,89 @@ function getOptions(options) {
54
54
  return options;
55
55
  }
56
56
  /**
57
- * Webform class for rendering forms with full component support.
58
- * @property {import('./Form.js').FormOptions} options - The options for this Webform instance.
57
+ * Represents a JSON value.
58
+ * @typedef {(string | number | boolean | null | JSONArray | JSONObject)} JSON
59
+ */
60
+ /**
61
+ * Represents a JSON array.
62
+ * @typedef {Array<JSON>} JSONArray
63
+ */
64
+ /**
65
+ * Represents a JSON object.
66
+ * @typedef {{[key: string]: JSON}} JSONObject
67
+ */
68
+ /**
69
+ * @typedef {object} FormioHooks
70
+ * @property {Function} [beforeSubmit] - A function that is called before the form is submitted.
71
+ * @property {Function} [beforeCancel] - A function that is called before the form is canceled.
72
+ * @property {Function} [beforeNext] - A function that is called before moving to the next page in a multi-page form.
73
+ * @property {Function} [beforePrev] - A function that is called before moving to the previous page in a multi-page form.
74
+ * @property {Function} [attachComponent] - A function that is called when a component is attached to the form.
75
+ * @property {Function} [setDataValue] - A function that is called when setting the value of a data component.
76
+ * @property {Function} [addComponents] - A function that is called when adding multiple components to the form.
77
+ * @property {Function} [addComponent] - A function that is called when adding a single component to the form.
78
+ * @property {Function} [customValidation] - A function that is called for custom validation of the form.
79
+ * @property {Function} [attachWebform] - A function that is called when attaching a webform to the form.
80
+ */
81
+ /**
82
+ * @typedef {object} SanitizeConfig
83
+ * @property {string[]} [addAttr] - The attributes to add.
84
+ * @property {string[]} [addTags] - The tags to add.
85
+ * @property {string[]} [allowedAttrs] - The allowed attributes.
86
+ * @property {string[]} [allowedTags] - The allowed tags.
87
+ * @property {string[]} [allowedUriRegex] - The allowed URI regex.
88
+ * @property {string[]} [addUriSafeAttr] - The URI safe attributes.
89
+ */
90
+ /**
91
+ * @typedef {object} ButtonSettings
92
+ * @property {boolean} [showPrevious] - Show the "Previous" button.
93
+ * @property {boolean} [showNext] - Show the "Next" button.
94
+ * @property {boolean} [showCancel] - Show the "Cancel" button.
95
+ * @property {boolean} [showSubmit] - Show the "Submit" button.
96
+ */
97
+ /**
98
+ * @typedef {object} FormOptions
99
+ * @property {boolean} [saveDraft] - Enable the save draft feature.
100
+ * @property {number} [saveDraftThrottle] - The throttle for the save draft feature.
101
+ * @property {boolean} [readOnly] - Set this form to readOnly.
102
+ * @property {boolean} [noAlerts] - Disable the alerts dialog.
103
+ * @property {{[key: string]: string}} [i18n] - The translation file for this rendering.
104
+ * @property {string} [template] - Custom logic for creation of elements.
105
+ * @property {boolean} [noDefaults] - Exclude default values from the settings.
106
+ * @property {any} [fileService] - The file service for this form.
107
+ * @property {EventEmitter} [events] - The EventEmitter for this form.
108
+ * @property {string} [language] - The language to render this form in.
109
+ * @property {{[key: string]: string}} [i18next] - The i18next configuration for this form.
110
+ * @property {boolean} [viewAsHtml] - View the form as raw HTML.
111
+ * @property {'form' | 'html' | 'flat' | 'builder' | 'pdf'} [renderMode] - The render mode for this form.
112
+ * @property {boolean} [highlightErrors] - Highlight any errors on the form.
113
+ * @property {string} [componentErrorClass] - The error class for components.
114
+ * @property {any} [templates] - The templates for this form.
115
+ * @property {string} [iconset] - The iconset for this form.
116
+ * @property {import('@formio/core').Component[]} [components] - The components for this form.
117
+ * @property {{[key: string]: boolean}} [disabled] - Disabled components for this form.
118
+ * @property {boolean} [showHiddenFields] - Show hidden fields.
119
+ * @property {{[key: string]: boolean}} [hide] - Hidden components for this form.
120
+ * @property {{[key: string]: boolean}} [show] - Components to show for this form.
121
+ * @property {Formio} [formio] - The Formio instance for this form.
122
+ * @property {string} [decimalSeparator] - The decimal separator for this form.
123
+ * @property {string} [thousandsSeparator] - The thousands separator for this form.
124
+ * @property {FormioHooks} [hooks] - The hooks for this form.
125
+ * @property {boolean} [alwaysDirty] - Always be dirty.
126
+ * @property {boolean} [skipDraftRestore] - Skip restoring a draft.
127
+ * @property {'form' | 'wizard' | 'pdf'} [display] - The display for this form.
128
+ * @property {string} [cdnUrl] - The CDN url for this form.
129
+ * @property {boolean} [flatten] - Flatten the form.
130
+ * @property {boolean} [sanitize] - Sanitize the form.
131
+ * @property {SanitizeConfig} [sanitizeConfig] - The sanitize configuration for this form.
132
+ * @property {ButtonSettings} [buttonSettings] - The button settings for this form.
133
+ * @property {object} [breadcrumbSettings] - The breadcrumb settings for this form.
134
+ * @property {boolean} [allowPrevious] - Allow the previous button (for Wizard forms).
135
+ * @property {string[]} [wizardButtonOrder] - The order of the buttons (for Wizard forms).
136
+ * @property {boolean} [showCheckboxBackground] - Show the checkbox background.
137
+ * @property {boolean} [inputsOnly] - Only show inputs in the form and no labels.
138
+ * @property {boolean} [building] - If we are in the process of building the form.
139
+ * @property {number} [zoom] - The zoom for PDF forms.
59
140
  */
60
141
  class Webform extends NestedDataComponent_1.default {
61
142
  /**
@@ -80,15 +161,15 @@ class Webform extends NestedDataComponent_1.default {
80
161
  }
81
162
  const ctrl = event.ctrlKey || event.metaKey;
82
163
  const keyCode = event.keyCode;
83
- let char = '';
164
+ let char = "";
84
165
  if (65 <= keyCode && keyCode <= 90) {
85
166
  char = String.fromCharCode(keyCode);
86
167
  }
87
168
  else if (keyCode === 13) {
88
- char = 'Enter';
169
+ char = "Enter";
89
170
  }
90
171
  else if (keyCode === 27) {
91
- char = 'Esc';
172
+ char = "Esc";
92
173
  }
93
174
  lodash_1.default.each(this.shortcuts, (shortcut) => {
94
175
  if (shortcut.ctrl && !ctrl) {
@@ -111,8 +192,8 @@ class Webform extends NestedDataComponent_1.default {
111
192
  * The type of this element.
112
193
  * @type {string}
113
194
  */
114
- this.type = 'form';
115
- this._src = '';
195
+ this.type = "form";
196
+ this._src = "";
116
197
  this._loading = false;
117
198
  this._form = {};
118
199
  this.draftEnabled = false;
@@ -234,6 +315,7 @@ class Webform extends NestedDataComponent_1.default {
234
315
  this.localRoot = this;
235
316
  this.root.dragulaLib = dragula_1.default;
236
317
  }
318
+ /* eslint-enable max-statements */
237
319
  get language() {
238
320
  return this.options.language;
239
321
  }
@@ -260,7 +342,7 @@ class Webform extends NestedDataComponent_1.default {
260
342
  return;
261
343
  }
262
344
  this.rebuild();
263
- this.emit('languageChanged');
345
+ this.emit("languageChanged");
264
346
  });
265
347
  }
266
348
  get componentComponents() {
@@ -286,22 +368,18 @@ class Webform extends NestedDataComponent_1.default {
286
368
  addLanguage(code, lang, active = false) {
287
369
  if (this.i18next) {
288
370
  var translations = lodash_1.default.assign((0, utils_1.fastCloneDeep)(i18n_1.default.resources.en.translation), lang);
289
- this.i18next.addResourceBundle(code, 'translation', translations, true, true);
371
+ this.i18next.addResourceBundle(code, "translation", translations, true, true);
290
372
  if (active) {
291
373
  this.language = code;
292
374
  }
293
375
  }
294
376
  }
295
377
  keyboardCatchableElement(element) {
296
- if (element.nodeName === 'TEXTAREA') {
378
+ if (element.nodeName === "TEXTAREA") {
297
379
  return false;
298
380
  }
299
- if (element.nodeName === 'INPUT') {
300
- return ([
301
- 'text',
302
- 'email',
303
- 'password',
304
- ].indexOf(element.type) === -1);
381
+ if (element.nodeName === "INPUT") {
382
+ return ["text", "email", "password"].indexOf(element.type) === -1;
305
383
  }
306
384
  return true;
307
385
  }
@@ -310,9 +388,9 @@ class Webform extends NestedDataComponent_1.default {
310
388
  return;
311
389
  }
312
390
  shortcut = lodash_1.default.capitalize(shortcut);
313
- if (shortcut === 'Enter' || shortcut === 'Esc') {
391
+ if (shortcut === "Enter" || shortcut === "Esc") {
314
392
  // Restrict Enter and Esc only for buttons
315
- if (element.tagName !== 'BUTTON') {
393
+ if (element.tagName !== "BUTTON") {
316
394
  return;
317
395
  }
318
396
  this.shortcuts.push({
@@ -412,13 +490,13 @@ class Webform extends NestedDataComponent_1.default {
412
490
  * @returns {boolean} - TRUE means the url was set, FALSE otherwise.
413
491
  */
414
492
  setUrl(value, options) {
415
- if (!value || typeof value !== 'string' || value === this._src) {
493
+ if (!value || typeof value !== "string" || value === this._src) {
416
494
  return false;
417
495
  }
418
496
  this._src = value;
419
497
  this.nosubmit = true;
420
498
  this.formio = this.options.formio = new Formio_1.Formio(value, options);
421
- if (this.type === 'form') {
499
+ if (this.type === "form") {
422
500
  // Set the options source so this can be passed to other components.
423
501
  this.options.src = value;
424
502
  }
@@ -457,14 +535,15 @@ class Webform extends NestedDataComponent_1.default {
457
535
  if (this._loading !== loading) {
458
536
  this._loading = loading;
459
537
  if (!this.loader && loading) {
460
- this.loader = this.ce('div', {
461
- class: 'loader-wrapper',
538
+ this.loader = this.ce("div", {
539
+ class: "loader-wrapper",
462
540
  });
463
- const spinner = this.ce('div', {
464
- class: 'loader text-center',
541
+ const spinner = this.ce("div", {
542
+ class: "loader text-center",
465
543
  });
466
544
  this.loader.appendChild(spinner);
467
545
  }
546
+ /* eslint-disable max-depth */
468
547
  if (this.loader) {
469
548
  try {
470
549
  if (loading) {
@@ -474,10 +553,11 @@ class Webform extends NestedDataComponent_1.default {
474
553
  this.removeChildFrom(this.loader, this.wrapper);
475
554
  }
476
555
  }
477
- catch (ignoreErr) {
478
- // ignore
556
+ catch (err) {
557
+ // ingore
479
558
  }
480
559
  }
560
+ /* eslint-enable max-depth */
481
561
  }
482
562
  }
483
563
  /**
@@ -544,17 +624,18 @@ class Webform extends NestedDataComponent_1.default {
544
624
  // Use the sanitize config from the form settings or the global sanitize config if it is not provided in the options
545
625
  if (!this.options.sanitizeConfig && !this.builderMode) {
546
626
  this.options.sanitizeConfig =
547
- lodash_1.default.get(form, 'settings.sanitizeConfig') || lodash_1.default.get(form, 'globalSettings.sanitizeConfig');
627
+ lodash_1.default.get(form, "settings.sanitizeConfig") ||
628
+ lodash_1.default.get(form, "globalSettings.sanitizeConfig");
548
629
  }
549
- if ('schema' in form && (0, compare_versions_1.compareVersions)(form.schema, '1.x') > 0) {
630
+ if ("schema" in form && (0, compare_versions_1.compareVersions)(form.schema, "1.x") > 0) {
550
631
  this.ready.then(() => {
551
- this.setAlert('alert alert-danger', 'Form schema is for a newer version, please upgrade your renderer. Some functionality may not work.');
632
+ this.setAlert("alert alert-danger", "Form schema is for a newer version, please upgrade your renderer. Some functionality may not work.");
552
633
  });
553
634
  }
554
635
  // See if they pass a module, and evaluate it if so.
555
636
  if (form && form.module) {
556
637
  let formModule = null;
557
- if (typeof form.module === 'string') {
638
+ if (typeof form.module === "string") {
558
639
  try {
559
640
  formModule = this.evaluate(`return ${form.module}`);
560
641
  }
@@ -638,8 +719,9 @@ class Webform extends NestedDataComponent_1.default {
638
719
  * @returns {void}
639
720
  */
640
721
  onSetSubmission(submission, flags = {}) {
722
+ var _a;
641
723
  this.submissionSet = true;
642
- this.triggerChange(flags);
724
+ (_a = this.triggerChange) === null || _a === void 0 ? void 0 : _a.call(this, flags);
643
725
  this.emit('beforeSetSubmission', submission);
644
726
  this.setValue(submission, flags);
645
727
  }
@@ -650,7 +732,7 @@ class Webform extends NestedDataComponent_1.default {
650
732
  * @returns {Promise} - The promise that is triggered when the submission is set.
651
733
  */
652
734
  setSubmission(submission, flags = {}) {
653
- flags = Object.assign(Object.assign({}, flags), { fromSubmission: lodash_1.default.has(flags, 'fromSubmission') ? flags.fromSubmission : true });
735
+ flags = Object.assign(Object.assign({}, flags), { fromSubmission: lodash_1.default.has(flags, "fromSubmission") ? flags.fromSubmission : true });
654
736
  return (this.onSubmission = this.formReady
655
737
  .then((resolveFlags) => {
656
738
  if (resolveFlags) {
@@ -662,9 +744,9 @@ class Webform extends NestedDataComponent_1.default {
662
744
  .catch((err) => this.submissionReadyReject(err)));
663
745
  }
664
746
  handleDraftError(errName, errDetails, restoreDraft) {
665
- const errorMessage = lodash_1.default.trim(`${this.t(errName)} ${errDetails || ''}`);
747
+ const errorMessage = lodash_1.default.trim(`${this.t(errName)} ${errDetails || ""}`);
666
748
  console.warn(errorMessage);
667
- this.emit(restoreDraft ? 'restoreDraftError' : 'saveDraftError', errDetails || errorMessage);
749
+ this.emit(restoreDraft ? "restoreDraftError" : "saveDraftError", errDetails || errorMessage);
668
750
  }
669
751
  saveDraft() {
670
752
  var _a;
@@ -672,17 +754,17 @@ class Webform extends NestedDataComponent_1.default {
672
754
  return;
673
755
  }
674
756
  if (!this.formio) {
675
- this.handleDraftError('saveDraftInstanceError');
757
+ this.handleDraftError("saveDraftInstanceError");
676
758
  return;
677
759
  }
678
760
  if (!Formio_1.Formio.getUser()) {
679
- this.handleDraftError('saveDraftAuthError');
761
+ this.handleDraftError("saveDraftAuthError");
680
762
  return;
681
763
  }
682
764
  const draft = (0, utils_1.fastCloneDeep)(this.submission);
683
- draft.state = 'draft';
765
+ draft.state = "draft";
684
766
  if (!this.savingDraft && !this.submitting) {
685
- this.emit('saveDraftBegin');
767
+ this.emit("saveDraftBegin");
686
768
  this.savingDraft = true;
687
769
  this.formio
688
770
  .saveSubmission(draft)
@@ -690,11 +772,11 @@ class Webform extends NestedDataComponent_1.default {
690
772
  // Set id to submission to avoid creating new draft submission
691
773
  this.submission._id = sub._id;
692
774
  this.savingDraft = false;
693
- this.emit('saveDraft', sub);
775
+ this.emit("saveDraft", sub);
694
776
  })
695
777
  .catch((err) => {
696
778
  this.savingDraft = false;
697
- this.handleDraftError('saveDraftError', err);
779
+ this.handleDraftError("saveDraftError", err);
698
780
  });
699
781
  }
700
782
  }
@@ -705,7 +787,7 @@ class Webform extends NestedDataComponent_1.default {
705
787
  restoreDraft(userId) {
706
788
  const formio = this.formio || this.options.formio;
707
789
  if (!formio) {
708
- this.handleDraftError('restoreDraftInstanceError', null, true);
790
+ this.handleDraftError("restoreDraftInstanceError", null, true);
709
791
  return;
710
792
  }
711
793
  this.savingDraft = true;
@@ -714,7 +796,7 @@ class Webform extends NestedDataComponent_1.default {
714
796
  params: {
715
797
  state: 'draft',
716
798
  owner: userId,
717
- sort: '-created',
799
+ sort: '-created'
718
800
  },
719
801
  })
720
802
  .then((submissions) => {
@@ -723,24 +805,22 @@ class Webform extends NestedDataComponent_1.default {
723
805
  return this.setSubmission(draft).then(() => {
724
806
  this.draftEnabled = true;
725
807
  this.savingDraft = false;
726
- this.emit('restoreDraft', draft);
808
+ this.emit("restoreDraft", draft);
727
809
  });
728
810
  }
729
811
  // Enable drafts so that we can keep track of changes.
730
812
  this.draftEnabled = true;
731
813
  this.savingDraft = false;
732
- this.emit('restoreDraft', null);
814
+ this.emit("restoreDraft", null);
733
815
  })
734
816
  .catch((err) => {
735
817
  this.draftEnabled = true;
736
818
  this.savingDraft = false;
737
- this.handleDraftError('restoreDraftError', err, true);
819
+ this.handleDraftError("restoreDraftError", err, true);
738
820
  });
739
821
  }
740
822
  get schema() {
741
- const schema = (0, utils_1.fastCloneDeep)(lodash_1.default.omit(this._form, [
742
- 'components',
743
- ]));
823
+ const schema = (0, utils_1.fastCloneDeep)(lodash_1.default.omit(this._form, ["components"]));
744
824
  schema.components = [];
745
825
  this.eachComponent((component) => schema.components.push(component.schema));
746
826
  return schema;
@@ -764,7 +844,9 @@ class Webform extends NestedDataComponent_1.default {
764
844
  this._submission.metadata = submission.metadata ? lodash_1.default.cloneDeep(submission.metadata) : {};
765
845
  this.editing = !!submission._id;
766
846
  // Set the timezone in the options if available.
767
- if (!this.options.submissionTimezone && submission.metadata && submission.metadata.timezone) {
847
+ if (!this.options.submissionTimezone &&
848
+ submission.metadata &&
849
+ submission.metadata.timezone) {
768
850
  this.options.submissionTimezone = submission.metadata.timezone;
769
851
  }
770
852
  const changed = super.setValue(submission.data, flags);
@@ -813,20 +895,20 @@ class Webform extends NestedDataComponent_1.default {
813
895
  else {
814
896
  this.component = this.form;
815
897
  }
816
- this.component.type = 'form';
898
+ this.component.type = "form";
817
899
  this.component.input = false;
818
900
  this.addComponents();
819
- this.on('submitButton', (options) => {
901
+ this.on("submitButton", (options) => {
820
902
  this.submit(false, options).catch((e) => {
821
903
  options.instance.loading = false;
822
904
  return e !== false && e !== undefined && console.log(e);
823
905
  });
824
906
  }, true);
825
- this.on('checkValidity', (data) => this.validate(data, { dirty: true, process: 'change' }), true);
826
- this.on('requestUrl', (args) => this.submitUrl(args.url, args.headers), true);
827
- this.on('resetForm', () => this.resetValue(), true);
828
- this.on('deleteSubmission', () => this.deleteSubmission(), true);
829
- this.on('refreshData', () => this.updateValue(), true);
907
+ this.on("checkValidity", (data) => this.validate(data, { dirty: true, process: "change" }), true);
908
+ this.on("requestUrl", (args) => this.submitUrl(args.url, args.headers), true);
909
+ this.on("resetForm", () => this.resetValue(), true);
910
+ this.on("deleteSubmission", () => this.deleteSubmission(), true);
911
+ this.on("refreshData", () => this.updateValue(), true);
830
912
  this.executeFormController();
831
913
  return this.formReady;
832
914
  }
@@ -835,7 +917,9 @@ class Webform extends NestedDataComponent_1.default {
835
917
  // hidden and set to clearOnHide (Don't calculate a value for a hidden field set to clear when hidden)
836
918
  if (!this.form ||
837
919
  !this.form.controller ||
838
- ((!this.visible || this.component.hidden) && this.component.clearOnHide && !this.rootPristine)) {
920
+ ((!this.visible || this.component.hidden) &&
921
+ this.component.clearOnHide &&
922
+ !this.rootPristine)) {
839
923
  return false;
840
924
  }
841
925
  this.formReady.then(() => {
@@ -849,19 +933,19 @@ class Webform extends NestedDataComponent_1.default {
849
933
  *
850
934
  */
851
935
  teardown() {
852
- this.emit('formDelete', this.id);
936
+ this.emit("formDelete", this.id);
853
937
  delete Formio_1.Formio.forms[this.id];
854
938
  delete this.executeShortcuts;
855
939
  delete this.triggerSaveDraft;
856
940
  super.teardown();
857
941
  }
858
942
  destroy(all = false) {
859
- this.off('submitButton');
860
- this.off('checkValidity');
861
- this.off('requestUrl');
862
- this.off('resetForm');
863
- this.off('deleteSubmission');
864
- this.off('refreshData');
943
+ this.off("submitButton");
944
+ this.off("checkValidity");
945
+ this.off("requestUrl");
946
+ this.off("resetForm");
947
+ this.off("deleteSubmission");
948
+ this.off("refreshData");
865
949
  return super.destroy(all);
866
950
  }
867
951
  build(element) {
@@ -874,17 +958,17 @@ class Webform extends NestedDataComponent_1.default {
874
958
  return this.ready;
875
959
  }
876
960
  getClassName() {
877
- let classes = 'formio-form';
961
+ let classes = "formio-form";
878
962
  if (this.options.readOnly) {
879
- classes += ' formio-read-only';
963
+ classes += " formio-read-only";
880
964
  }
881
965
  return classes;
882
966
  }
883
967
  render() {
884
- return super.render(this.renderTemplate('webform', {
968
+ return super.render(this.renderTemplate("webform", {
885
969
  classes: this.getClassName(),
886
970
  children: this.renderComponents(),
887
- }), this.builderMode ? 'builder' : 'form', true);
971
+ }), this.builderMode ? "builder" : "form", true);
888
972
  }
889
973
  redraw() {
890
974
  // Don't bother if we have not built yet.
@@ -897,13 +981,13 @@ class Webform extends NestedDataComponent_1.default {
897
981
  }
898
982
  attach(element) {
899
983
  this.setElement(element);
900
- this.loadRefs(element, { webform: 'single' });
984
+ this.loadRefs(element, { webform: "single" });
901
985
  const childPromise = this.attachComponents(this.refs.webform);
902
- this.addEventListener(document, 'keydown', this.executeShortcuts);
986
+ this.addEventListener(document, "keydown", this.executeShortcuts);
903
987
  this.currentForm = this;
904
- this.hook('attachWebform', element, this);
988
+ this.hook("attachWebform", element, this);
905
989
  return childPromise.then(() => {
906
- this.emit('render', this.element);
990
+ this.emit("render", this.element);
907
991
  return this.setValue(this._submission, {
908
992
  noUpdateEvent: true,
909
993
  });
@@ -935,8 +1019,8 @@ class Webform extends NestedDataComponent_1.default {
935
1019
  if (this.alert) {
936
1020
  if (this.refs.errorRef && this.refs.errorRef.length) {
937
1021
  this.refs.errorRef.forEach((el) => {
938
- this.removeEventListener(el, 'click');
939
- this.removeEventListener(el, 'keypress');
1022
+ this.removeEventListener(el, "click");
1023
+ this.removeEventListener(el, "keypress");
940
1024
  });
941
1025
  }
942
1026
  this.removeChild(this.alert);
@@ -946,7 +1030,7 @@ class Webform extends NestedDataComponent_1.default {
946
1030
  }
947
1031
  if (this.options.noAlerts) {
948
1032
  if (!message) {
949
- this.emit('error', false);
1033
+ this.emit("error", false);
950
1034
  }
951
1035
  return;
952
1036
  }
@@ -954,14 +1038,14 @@ class Webform extends NestedDataComponent_1.default {
954
1038
  try {
955
1039
  if (this.refs.errorRef && this.refs.errorRef.length) {
956
1040
  this.refs.errorRef.forEach((el) => {
957
- this.removeEventListener(el, 'click');
958
- this.removeEventListener(el, 'keypress');
1041
+ this.removeEventListener(el, "click");
1042
+ this.removeEventListener(el, "keypress");
959
1043
  });
960
1044
  }
961
1045
  this.removeChild(this.alert);
962
1046
  this.alert = null;
963
1047
  }
964
- catch (ignoreErr) {
1048
+ catch (err) {
965
1049
  // ignore
966
1050
  }
967
1051
  }
@@ -975,19 +1059,19 @@ class Webform extends NestedDataComponent_1.default {
975
1059
  attrs: attrs,
976
1060
  type,
977
1061
  };
978
- this.alert = (0, utils_1.convertStringToHTMLElement)(this.renderTemplate('alert', templateOptions), `#${attrs.id}`);
1062
+ this.alert = (0, utils_1.convertStringToHTMLElement)(this.renderTemplate("alert", templateOptions), `#${attrs.id}`);
979
1063
  }
980
1064
  if (!this.alert) {
981
1065
  return;
982
1066
  }
983
- this.loadRefs(this.alert, { errorRef: 'multiple' });
1067
+ this.loadRefs(this.alert, { errorRef: "multiple" });
984
1068
  if (this.refs.errorRef && this.refs.errorRef.length) {
985
1069
  this.refs.errorRef.forEach((el) => {
986
- this.addEventListener(el, 'click', (e) => {
1070
+ this.addEventListener(el, "click", (e) => {
987
1071
  const key = e.currentTarget.dataset.componentKey;
988
1072
  this.focusOnComponent(key);
989
1073
  });
990
- this.addEventListener(el, 'keydown', (e) => {
1074
+ this.addEventListener(el, "keydown", (e) => {
991
1075
  if (e.keyCode === 13) {
992
1076
  e.preventDefault();
993
1077
  const key = e.currentTarget.dataset.componentKey;
@@ -1010,18 +1094,12 @@ class Webform extends NestedDataComponent_1.default {
1010
1094
  }
1011
1095
  }
1012
1096
  }
1013
- /**
1014
- * @returns {boolean} - Whether or not the draft submission is being edited
1015
- */
1016
- isDraftEdit() {
1017
- var _a;
1018
- return this.submitted && ((_a = this.submission) === null || _a === void 0 ? void 0 : _a.state) === 'draft';
1019
- }
1020
1097
  /**
1021
1098
  * Show the errors of this form within the alert dialog.
1022
1099
  * @param {object} error - An optional additional error to display along with the component errors.
1023
1100
  * @returns {*}
1024
1101
  */
1102
+ /* eslint-disable no-unused-vars */
1025
1103
  /**
1026
1104
  *
1027
1105
  * @param {Array} errors - An array of errors to display.
@@ -1029,15 +1107,12 @@ class Webform extends NestedDataComponent_1.default {
1029
1107
  * @returns {void|Array} - The errors that were set.
1030
1108
  */
1031
1109
  showErrors(errors, triggerEvent) {
1110
+ var _a;
1032
1111
  this.loading = false;
1033
1112
  if (!Array.isArray(errors)) {
1034
- errors = [
1035
- errors,
1036
- ];
1113
+ errors = [errors];
1037
1114
  }
1038
- if (Array.isArray(this.errors) &&
1039
- // do not show components validation errors in alert for draft submission
1040
- !this.isDraftEdit()) {
1115
+ if (Array.isArray(this.errors)) {
1041
1116
  errors = lodash_1.default.union(errors, this.errors);
1042
1117
  }
1043
1118
  errors = errors.concat(this.customErrors).filter((err) => !!err);
@@ -1066,14 +1141,7 @@ class Webform extends NestedDataComponent_1.default {
1066
1141
  }
1067
1142
  const displayedErrors = [];
1068
1143
  if (errors.length) {
1069
- errors = lodash_1.default.uniqBy(errors, (error) => {
1070
- var _a, _b;
1071
- return [
1072
- error.message,
1073
- (_a = error.component) === null || _a === void 0 ? void 0 : _a.id,
1074
- (_b = error.context) === null || _b === void 0 ? void 0 : _b.path,
1075
- ].join();
1076
- });
1144
+ errors = lodash_1.default.uniqBy(errors, (error) => { var _a, _b; return [error.message, (_a = error.component) === null || _a === void 0 ? void 0 : _a.id, (_b = error.context) === null || _b === void 0 ? void 0 : _b.path].join(); });
1077
1145
  const createListItem = (message, index) => {
1078
1146
  var _a, _b, _c;
1079
1147
  const err = errors[index];
@@ -1084,8 +1152,8 @@ class Webform extends NestedDataComponent_1.default {
1084
1152
  (((_b = err.context) === null || _b === void 0 ? void 0 : _b.component) && ((_c = err.context) === null || _c === void 0 ? void 0 : _c.component.key)) ||
1085
1153
  (err.component && err.component.key) ||
1086
1154
  (err.fromServer && err.path);
1087
- const formattedKeyOrPath = keyOrPath ? (0, utils_1.getStringFromComponentPath)(keyOrPath) : '';
1088
- if (typeof err !== 'string' && !err.formattedKeyOrPath) {
1155
+ const formattedKeyOrPath = keyOrPath ? (0, utils_1.getStringFromComponentPath)(keyOrPath) : "";
1156
+ if (typeof err !== "string" && !err.formattedKeyOrPath) {
1089
1157
  err.formattedKeyOrPath = formattedKeyOrPath;
1090
1158
  }
1091
1159
  return {
@@ -1095,18 +1163,22 @@ class Webform extends NestedDataComponent_1.default {
1095
1163
  };
1096
1164
  errors.forEach(({ message, context, fromServer, component }, index) => {
1097
1165
  const text = !(component === null || component === void 0 ? void 0 : component.label) || (context === null || context === void 0 ? void 0 : context.hasLabel) || fromServer
1098
- ? this.t(message)
1099
- : `${this.t(component === null || component === void 0 ? void 0 : component.label)}: ${this.t(message)}`;
1166
+ ? this.t("alertMessage", { message: this.t(message) })
1167
+ : this.t("alertMessageWithLabel", {
1168
+ label: this.t(component === null || component === void 0 ? void 0 : component.label),
1169
+ message: this.t(message),
1170
+ });
1100
1171
  displayedErrors.push(createListItem(text, index));
1101
1172
  });
1102
1173
  }
1103
- const errorsList = this.renderTemplate('errorsList', { errors: displayedErrors });
1104
- this.root.setAlert('danger', errorsList);
1174
+ const errorsList = this.renderTemplate("errorsList", { errors: displayedErrors });
1175
+ (_a = this.root) === null || _a === void 0 ? void 0 : _a.setAlert("danger", errorsList);
1105
1176
  if (triggerEvent) {
1106
- this.emit('error', errors);
1177
+ this.emit("error", errors);
1107
1178
  }
1108
1179
  return errors;
1109
1180
  }
1181
+ /* eslint-enable no-unused-vars */
1110
1182
  /**
1111
1183
  * Called when the submission has completed, or if the submission needs to be sent to an external library.
1112
1184
  * @param {object} submission - The submission object.
@@ -1123,23 +1195,23 @@ class Webform extends NestedDataComponent_1.default {
1123
1195
  noValidate: true,
1124
1196
  noCheck: true,
1125
1197
  });
1126
- this.setAlert('success', `<p>${this.t('complete')}</p>`);
1198
+ this.setAlert("success", `<p>${this.t("complete")}</p>`);
1127
1199
  // Cancel triggered saveDraft to prevent overriding the submitted state
1128
1200
  if (this.draftEnabled && ((_a = this.triggerSaveDraft) === null || _a === void 0 ? void 0 : _a.cancel)) {
1129
1201
  this.triggerSaveDraft.cancel();
1130
1202
  }
1131
- this.emit('submit', submission, saved);
1203
+ this.emit("submit", submission, saved);
1132
1204
  if (saved) {
1133
- this.emit('submitDone', submission);
1205
+ this.emit("submitDone", submission);
1134
1206
  }
1135
1207
  return submission;
1136
1208
  }
1137
1209
  normalizeError(error) {
1138
1210
  if (error) {
1139
- if (typeof error === 'object' && 'details' in error) {
1211
+ if (typeof error === "object" && "details" in error) {
1140
1212
  error = error.details;
1141
1213
  }
1142
- if (typeof error === 'string') {
1214
+ if (typeof error === "string") {
1143
1215
  error = { message: error };
1144
1216
  }
1145
1217
  }
@@ -1154,10 +1226,10 @@ class Webform extends NestedDataComponent_1.default {
1154
1226
  error = this.normalizeError(error);
1155
1227
  this.submitting = false;
1156
1228
  this.setPristine(false);
1157
- this.emit('submitError', error || this.errors);
1229
+ this.emit("submitError", error || this.errors);
1158
1230
  // Allow for silent cancellations (no error message, no submit button error state)
1159
1231
  if (error && error.silent) {
1160
- this.emit('change', { isValid: true }, { silent: true });
1232
+ this.emit("change", { isValid: true }, { silent: true });
1161
1233
  return false;
1162
1234
  }
1163
1235
  const errors = this.showErrors(error, true);
@@ -1196,31 +1268,24 @@ class Webform extends NestedDataComponent_1.default {
1196
1268
  const errors = shouldValidate
1197
1269
  ? this.validate(value.data, Object.assign(Object.assign({}, flags), { noValidate: false, process: 'change' }))
1198
1270
  : [];
1199
- value.isValid = (errors || []).filter((err) => !err.fromServer).length === 0;
1271
+ value.isValid = (errors || []).filter(err => !err.fromServer).length === 0;
1200
1272
  this.loading = false;
1201
1273
  if (this.submitted) {
1202
1274
  // show server errors while they are not cleaned/fixed
1203
1275
  const nonComponentServerErrors = lodash_1.default.filter(this.serverErrors || [], (err) => !err.component && !err.path);
1204
- if (this.isDraftEdit()) {
1205
- if (nonComponentServerErrors.length) {
1206
- this.showErrors(nonComponentServerErrors);
1207
- }
1208
- }
1209
- else {
1210
- this.showErrors(nonComponentServerErrors.length ? nonComponentServerErrors : errors);
1211
- }
1276
+ this.showErrors(nonComponentServerErrors.length ? nonComponentServerErrors : errors);
1212
1277
  }
1213
1278
  // See if we need to save the draft of the form.
1214
1279
  if (modified && this.options.saveDraft) {
1215
1280
  this.triggerSaveDraft();
1216
1281
  }
1217
1282
  if (!flags || !flags.noEmit) {
1218
- this.emit('change', value, flags, modified);
1283
+ this.emit("change", value, flags, modified);
1219
1284
  isChangeEventEmitted = true;
1220
1285
  }
1221
1286
  // The form is initialized after the first change event occurs.
1222
1287
  if (isChangeEventEmitted && !this.initialized) {
1223
- this.emit('initialized');
1288
+ this.emit("initialized");
1224
1289
  this.initialized = true;
1225
1290
  }
1226
1291
  }
@@ -1230,7 +1295,7 @@ class Webform extends NestedDataComponent_1.default {
1230
1295
  */
1231
1296
  deleteSubmission() {
1232
1297
  return this.formio.deleteSubmission().then(() => {
1233
- this.emit('submissionDeleted', this.submission);
1298
+ this.emit("submissionDeleted", this.submission);
1234
1299
  this.resetValue();
1235
1300
  });
1236
1301
  }
@@ -1241,13 +1306,13 @@ class Webform extends NestedDataComponent_1.default {
1241
1306
  * @returns {boolean} - TRUE means the submission was cancelled, FALSE otherwise.
1242
1307
  */
1243
1308
  cancel(noconfirm) {
1244
- const shouldReset = this.hook('beforeCancel', true);
1245
- if (shouldReset && (noconfirm || confirm(this.t('confirmCancel')))) {
1309
+ const shouldReset = this.hook("beforeCancel", true);
1310
+ if (shouldReset && (noconfirm || confirm(this.t("confirmCancel")))) {
1246
1311
  this.resetValue();
1247
1312
  return true;
1248
1313
  }
1249
1314
  else {
1250
- this.emit('cancelSubmit');
1315
+ this.emit("cancelSubmit");
1251
1316
  return false;
1252
1317
  }
1253
1318
  }
@@ -1255,8 +1320,8 @@ class Webform extends NestedDataComponent_1.default {
1255
1320
  // Add in metadata about client submitting the form
1256
1321
  submission.metadata = submission.metadata || {};
1257
1322
  lodash_1.default.defaults(submission.metadata, {
1258
- timezone: lodash_1.default.get(this, '_submission.metadata.timezone', (0, utils_1.currentTimezone)()),
1259
- offset: parseInt(lodash_1.default.get(this, '_submission.metadata.offset', (0, moment_1.default)().utcOffset()), 10),
1323
+ timezone: lodash_1.default.get(this, "_submission.metadata.timezone", (0, utils_1.currentTimezone)()),
1324
+ offset: parseInt(lodash_1.default.get(this, "_submission.metadata.offset", (0, moment_1.default)().utcOffset()), 10),
1260
1325
  origin: document.location.origin,
1261
1326
  referrer: document.referrer,
1262
1327
  browserName: navigator.appName,
@@ -1277,27 +1342,27 @@ class Webform extends NestedDataComponent_1.default {
1277
1342
  }
1278
1343
  const submission = (0, utils_1.fastCloneDeep)(this.submission || {});
1279
1344
  this.setMetadata(submission);
1280
- submission.state = options.state || submission.state || 'submitted';
1281
- const isDraft = submission.state === 'draft';
1282
- this.hook('beforeSubmit', Object.assign(Object.assign({}, submission), { component: options.component }), (err, data) => {
1345
+ submission.state = options.state || submission.state || "submitted";
1346
+ const isDraft = submission.state === "draft";
1347
+ this.hook("beforeSubmit", Object.assign(Object.assign({}, submission), { component: options.component }), (err, data) => {
1283
1348
  var _a;
1284
1349
  if (err) {
1285
1350
  return reject(err);
1286
1351
  }
1287
- submission._vnote = data && data._vnote ? data._vnote : '';
1352
+ submission._vnote = data && data._vnote ? data._vnote : "";
1288
1353
  try {
1289
1354
  if (!isDraft && !options.noValidate) {
1290
1355
  if (!submission.data) {
1291
- return reject('Invalid Submission');
1356
+ return reject("Invalid Submission");
1292
1357
  }
1293
1358
  const errors = this.validate(submission.data, {
1294
1359
  local,
1295
1360
  dirty: true,
1296
1361
  silentCheck: false,
1297
- process: 'submit',
1362
+ process: "submit",
1298
1363
  });
1299
1364
  if (errors.length ||
1300
- ((_a = options.beforeSubmitResults) === null || _a === void 0 ? void 0 : _a.some((result) => result.status === 'rejected'))) {
1365
+ ((_a = options.beforeSubmitResults) === null || _a === void 0 ? void 0 : _a.some((result) => result.status === "rejected"))) {
1301
1366
  return reject(errors);
1302
1367
  }
1303
1368
  }
@@ -1307,37 +1372,33 @@ class Webform extends NestedDataComponent_1.default {
1307
1372
  }
1308
1373
  this.everyComponent((comp) => {
1309
1374
  var _a, _b;
1310
- if (submission._vnote && comp.type === 'form' && comp.component.reference) {
1311
- lodash_1.default.get(submission.data, local ? (_a = comp.paths) === null || _a === void 0 ? void 0 : _a.localDataPath : comp.path, {})._vnote =
1312
- submission._vnote;
1375
+ if (submission._vnote && comp.type === "form" && comp.component.reference) {
1376
+ lodash_1.default.get(submission.data, local ? (_a = comp.paths) === null || _a === void 0 ? void 0 : _a.localDataPath : comp.path, {})._vnote = submission._vnote;
1313
1377
  }
1314
1378
  const { persistent } = comp.component;
1315
- if (persistent === 'client-only') {
1379
+ if (persistent === "client-only") {
1316
1380
  lodash_1.default.unset(submission.data, local ? (_b = comp.paths) === null || _b === void 0 ? void 0 : _b.localDataPath : comp.path);
1317
1381
  }
1318
1382
  });
1319
- this.hook('customValidation', Object.assign(Object.assign({}, submission), { component: options.component }), (err) => {
1383
+ this.hook("customValidation", Object.assign(Object.assign({}, submission), { component: options.component }), (err) => {
1320
1384
  if (err) {
1321
1385
  // If string is returned, cast to object.
1322
- if (typeof err === 'string') {
1386
+ if (typeof err === "string") {
1323
1387
  err = {
1324
1388
  message: err,
1325
1389
  };
1326
1390
  }
1327
1391
  // Ensure err is an array.
1328
- err = Array.isArray(err)
1329
- ? err
1330
- : [
1331
- err,
1332
- ];
1392
+ err = Array.isArray(err) ? err : [err];
1333
1393
  return reject(err);
1334
1394
  }
1335
1395
  this.loading = true;
1336
1396
  // Use the form action to submit the form if available.
1337
1397
  if (this._form && this._form.action) {
1338
- const method = submission.data._id && this._form.action.includes(submission.data._id)
1339
- ? 'PUT'
1340
- : 'POST';
1398
+ const method = submission.data._id &&
1399
+ this._form.action.includes(submission.data._id)
1400
+ ? "PUT"
1401
+ : "POST";
1341
1402
  return Formio_1.Formio.makeStaticRequest(this._form.action, method, submission, this.formio ? this.formio.options : {})
1342
1403
  .then((result) => resolve({
1343
1404
  submission: result,
@@ -1356,7 +1417,9 @@ class Webform extends NestedDataComponent_1.default {
1356
1417
  });
1357
1418
  }
1358
1419
  // If this is an actionUrl, then make sure to save the action and not the submission.
1359
- const submitMethod = submitFormio.actionUrl ? 'saveAction' : 'saveSubmission';
1420
+ const submitMethod = submitFormio.actionUrl
1421
+ ? "saveAction"
1422
+ : "saveSubmission";
1360
1423
  submitFormio[submitMethod](submission)
1361
1424
  .then((result) => resolve({
1362
1425
  submission: result,
@@ -1373,16 +1436,14 @@ class Webform extends NestedDataComponent_1.default {
1373
1436
  setServerErrors(error) {
1374
1437
  if (error.details) {
1375
1438
  this.serverErrors = error.details
1376
- .filter((err) => (err.level ? err.level === 'error' : err))
1439
+ .filter((err) => (err.level ? err.level === "error" : err))
1377
1440
  .map((err) => {
1378
1441
  err.fromServer = true;
1379
1442
  return err;
1380
1443
  });
1381
1444
  }
1382
- else if (typeof error === 'string') {
1383
- this.serverErrors = [
1384
- { fromServer: true, level: 'error', message: error },
1385
- ];
1445
+ else if (typeof error === "string") {
1446
+ this.serverErrors = [{ fromServer: true, level: "error", message: error }];
1386
1447
  }
1387
1448
  }
1388
1449
  executeSubmit(options) {
@@ -1441,17 +1502,17 @@ class Webform extends NestedDataComponent_1.default {
1441
1502
  }
1442
1503
  submitUrl(URL, headers) {
1443
1504
  if (!URL) {
1444
- return console.warn('Missing URL argument');
1505
+ return console.warn("Missing URL argument");
1445
1506
  }
1446
1507
  const submission = this.submission || {};
1447
1508
  const API_URL = URL;
1448
1509
  const settings = {
1449
- method: 'POST',
1510
+ method: "POST",
1450
1511
  headers: {},
1451
1512
  };
1452
1513
  if (headers && headers.length > 0) {
1453
1514
  headers.map((e) => {
1454
- if (e.header !== '' && e.value !== '') {
1515
+ if (e.header !== "" && e.value !== "") {
1455
1516
  settings.headers[e.header] = this.interpolate(e.value, submission);
1456
1517
  }
1457
1518
  });
@@ -1461,21 +1522,21 @@ class Webform extends NestedDataComponent_1.default {
1461
1522
  headers: settings.headers,
1462
1523
  })
1463
1524
  .then(() => {
1464
- this.emit('requestDone');
1465
- this.setAlert('success', '<p> Success </p>');
1525
+ this.emit("requestDone");
1526
+ this.setAlert("success", "<p> Success </p>");
1466
1527
  })
1467
1528
  .catch((e) => {
1468
- const message = `${e.statusText ? e.statusText : ''} ${e.status ? e.status : e}`;
1469
- this.emit('error', message);
1529
+ const message = `${e.statusText ? e.statusText : ""} ${e.status ? e.status : e}`;
1530
+ this.emit("error", message);
1470
1531
  console.error(message);
1471
- this.setAlert('danger', `<p> ${message} </p>`);
1532
+ this.setAlert("danger", `<p> ${message} </p>`);
1472
1533
  return Promise.reject(this.onSubmissionError(e));
1473
1534
  });
1474
1535
  }
1475
1536
  else {
1476
- this.emit('error', 'You should add a URL to this button.');
1477
- this.setAlert('warning', 'You should add a URL to this button.');
1478
- return console.warn('You should add a URL to this button.');
1537
+ this.emit("error", "You should add a URL to this button.");
1538
+ this.setAlert("warning", "You should add a URL to this button.");
1539
+ return console.warn("You should add a URL to this button.");
1479
1540
  }
1480
1541
  }
1481
1542
  triggerCaptcha(components = null) {
@@ -1497,7 +1558,7 @@ class Webform extends NestedDataComponent_1.default {
1497
1558
  }
1498
1559
  set nosubmit(value) {
1499
1560
  this._nosubmit = !!value;
1500
- this.emit('nosubmit', this._nosubmit);
1561
+ this.emit("nosubmit", this._nosubmit);
1501
1562
  }
1502
1563
  get nosubmit() {
1503
1564
  return this._nosubmit || false;