@formio/js 5.2.3 → 5.2.4-rc.0

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