@formio/js 5.0.0-dev.5641.6eb7b96 → 5.0.0-dev.5642.afd813e

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 (455) hide show
  1. package/Changelog.md +0 -37
  2. package/dist/formio.embed.js +1 -1
  3. package/dist/formio.embed.min.js +1 -1
  4. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  5. package/dist/formio.form.js +1189 -608
  6. package/dist/formio.form.min.js +1 -1
  7. package/dist/formio.form.min.js.LICENSE.txt +5 -3
  8. package/dist/formio.full.js +913 -652
  9. package/dist/formio.full.min.js +1 -1
  10. package/dist/formio.full.min.js.LICENSE.txt +5 -3
  11. package/dist/formio.js +18 -18
  12. package/dist/formio.min.js +1 -1
  13. package/dist/formio.min.js.LICENSE.txt +1 -1
  14. package/dist/formio.utils.js +494 -1831
  15. package/dist/formio.utils.min.js +1 -1
  16. package/dist/formio.utils.min.js.LICENSE.txt +4 -10
  17. package/lib/cjs/CDN.d.ts +0 -1
  18. package/lib/cjs/CDN.js +3 -6
  19. package/lib/cjs/Element.d.ts +96 -86
  20. package/lib/cjs/Element.js +78 -68
  21. package/lib/cjs/Embed.d.ts +1 -1
  22. package/lib/cjs/Embed.js +12 -52
  23. package/lib/cjs/Form.d.ts +36 -365
  24. package/lib/cjs/Form.js +64 -50
  25. package/lib/cjs/FormBuilder.d.ts +2 -187
  26. package/lib/cjs/FormBuilder.js +8 -30
  27. package/lib/cjs/PDF.d.ts +13 -11
  28. package/lib/cjs/PDF.js +8 -6
  29. package/lib/cjs/Webform.d.ts +139 -180
  30. package/lib/cjs/Webform.js +296 -309
  31. package/lib/cjs/WebformBuilder.d.ts +14 -16
  32. package/lib/cjs/WebformBuilder.js +10 -11
  33. package/lib/cjs/Wizard.d.ts +21 -31
  34. package/lib/cjs/Wizard.js +20 -43
  35. package/lib/cjs/WizardBuilder.d.ts +1 -1
  36. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +5 -8
  37. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +3 -6
  38. package/lib/cjs/components/Components.d.ts +4 -4
  39. package/lib/cjs/components/Components.js +3 -3
  40. package/lib/cjs/components/_classes/component/Component.d.ts +269 -502
  41. package/lib/cjs/components/_classes/component/Component.form.d.ts +3 -6
  42. package/lib/cjs/components/_classes/component/Component.form.js +0 -5
  43. package/lib/cjs/components/_classes/component/Component.js +189 -433
  44. package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +8 -0
  45. package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +2 -2
  46. package/lib/cjs/components/_classes/component/editForm/utils.js +2 -2
  47. package/lib/cjs/components/_classes/field/Field.d.ts +2 -11
  48. package/lib/cjs/components/_classes/field/Field.js +1 -13
  49. package/lib/cjs/components/_classes/input/Input.d.ts +3 -4
  50. package/lib/cjs/components/_classes/input/Input.js +2 -2
  51. package/lib/cjs/components/_classes/list/ListComponent.d.ts +2 -2
  52. package/lib/cjs/components/_classes/list/ListComponent.form.d.ts +3 -6
  53. package/lib/cjs/components/_classes/list/ListComponent.form.js +0 -5
  54. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +12 -43
  55. package/lib/cjs/components/_classes/multivalue/Multivalue.js +3 -37
  56. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +67 -163
  57. package/lib/cjs/components/_classes/nested/NestedComponent.form.d.ts +3 -6
  58. package/lib/cjs/components/_classes/nested/NestedComponent.form.js +0 -5
  59. package/lib/cjs/components/_classes/nested/NestedComponent.js +54 -175
  60. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -2
  61. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  62. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -7
  63. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +3 -2
  64. package/lib/cjs/components/address/Address.d.ts +2 -4
  65. package/lib/cjs/components/address/Address.form.d.ts +3 -6
  66. package/lib/cjs/components/address/Address.form.js +0 -5
  67. package/lib/cjs/components/button/Button.d.ts +12 -3
  68. package/lib/cjs/components/button/Button.form.d.ts +3 -6
  69. package/lib/cjs/components/button/Button.form.js +0 -5
  70. package/lib/cjs/components/button/Button.js +0 -5
  71. package/lib/cjs/components/checkbox/Checkbox.d.ts +27 -4
  72. package/lib/cjs/components/checkbox/Checkbox.form.d.ts +3 -6
  73. package/lib/cjs/components/checkbox/Checkbox.form.js +0 -5
  74. package/lib/cjs/components/columns/Columns.d.ts +2 -3
  75. package/lib/cjs/components/columns/Columns.form.d.ts +3 -6
  76. package/lib/cjs/components/columns/Columns.form.js +0 -5
  77. package/lib/cjs/components/columns/Columns.js +1 -1
  78. package/lib/cjs/components/container/Container.form.d.ts +3 -6
  79. package/lib/cjs/components/container/Container.form.js +0 -5
  80. package/lib/cjs/components/content/Content.d.ts +1 -2
  81. package/lib/cjs/components/content/Content.form.d.ts +3 -6
  82. package/lib/cjs/components/content/Content.form.js +0 -5
  83. package/lib/cjs/components/currency/Currency.form.d.ts +3 -6
  84. package/lib/cjs/components/currency/Currency.form.js +0 -5
  85. package/lib/cjs/components/currency/Currency.js +2 -1
  86. package/lib/cjs/components/datagrid/DataGrid.d.ts +7 -8
  87. package/lib/cjs/components/datagrid/DataGrid.form.d.ts +3 -6
  88. package/lib/cjs/components/datagrid/DataGrid.form.js +0 -5
  89. package/lib/cjs/components/datagrid/DataGrid.js +5 -5
  90. package/lib/cjs/components/datamap/DataMap.d.ts +0 -1
  91. package/lib/cjs/components/datamap/DataMap.form.d.ts +3 -6
  92. package/lib/cjs/components/datamap/DataMap.form.js +0 -5
  93. package/lib/cjs/components/datetime/DateTime.d.ts +14 -0
  94. package/lib/cjs/components/datetime/DateTime.form.d.ts +3 -6
  95. package/lib/cjs/components/datetime/DateTime.form.js +0 -5
  96. package/lib/cjs/components/datetime/editForm/DateTime.edit.date.js +2 -2
  97. package/lib/cjs/components/day/Day.d.ts +48 -22
  98. package/lib/cjs/components/day/Day.form.d.ts +3 -6
  99. package/lib/cjs/components/day/Day.form.js +0 -5
  100. package/lib/cjs/components/day/Day.js +20 -15
  101. package/lib/cjs/components/editgrid/EditGrid.d.ts +3 -7
  102. package/lib/cjs/components/editgrid/EditGrid.form.d.ts +3 -6
  103. package/lib/cjs/components/editgrid/EditGrid.form.js +0 -5
  104. package/lib/cjs/components/editgrid/EditGrid.js +3 -3
  105. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +5 -2
  106. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.templates.js +9 -6
  107. package/lib/cjs/components/email/Email.form.d.ts +3 -6
  108. package/lib/cjs/components/email/Email.form.js +0 -5
  109. package/lib/cjs/components/fieldset/Fieldset.form.d.ts +3 -6
  110. package/lib/cjs/components/fieldset/Fieldset.form.js +0 -5
  111. package/lib/cjs/components/file/File.d.ts +22 -9
  112. package/lib/cjs/components/file/File.form.d.ts +3 -6
  113. package/lib/cjs/components/file/File.form.js +0 -5
  114. package/lib/cjs/components/file/File.js +1 -2
  115. package/lib/cjs/components/form/Form.d.ts +20 -31
  116. package/lib/cjs/components/form/Form.form.d.ts +3 -6
  117. package/lib/cjs/components/form/Form.form.js +0 -5
  118. package/lib/cjs/components/form/Form.js +14 -17
  119. package/lib/cjs/components/hidden/Hidden.d.ts +11 -1
  120. package/lib/cjs/components/hidden/Hidden.form.d.ts +3 -6
  121. package/lib/cjs/components/hidden/Hidden.form.js +0 -5
  122. package/lib/cjs/components/hidden/Hidden.js +2 -1
  123. package/lib/cjs/components/html/HTML.d.ts +1 -2
  124. package/lib/cjs/components/html/HTML.form.d.ts +3 -6
  125. package/lib/cjs/components/html/HTML.form.js +0 -5
  126. package/lib/cjs/components/number/Number.d.ts +17 -3
  127. package/lib/cjs/components/number/Number.form.d.ts +3 -6
  128. package/lib/cjs/components/number/Number.form.js +0 -5
  129. package/lib/cjs/components/number/Number.js +2 -1
  130. package/lib/cjs/components/panel/Panel.form.d.ts +3 -6
  131. package/lib/cjs/components/panel/Panel.form.js +0 -5
  132. package/lib/cjs/components/panel/Panel.js +1 -0
  133. package/lib/cjs/components/password/Password.form.d.ts +3 -6
  134. package/lib/cjs/components/password/Password.form.js +0 -5
  135. package/lib/cjs/components/phonenumber/PhoneNumber.form.d.ts +3 -6
  136. package/lib/cjs/components/phonenumber/PhoneNumber.form.js +0 -5
  137. package/lib/cjs/components/radio/Radio.d.ts +26 -3
  138. package/lib/cjs/components/radio/Radio.form.d.ts +3 -6
  139. package/lib/cjs/components/radio/Radio.form.js +0 -5
  140. package/lib/cjs/components/radio/Radio.js +4 -3
  141. package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +1 -1
  142. package/lib/cjs/components/recaptcha/ReCaptcha.form.d.ts +3 -6
  143. package/lib/cjs/components/recaptcha/ReCaptcha.form.js +0 -5
  144. package/lib/cjs/components/select/Select.d.ts +39 -16
  145. package/lib/cjs/components/select/Select.form.d.ts +3 -6
  146. package/lib/cjs/components/select/Select.form.js +0 -5
  147. package/lib/cjs/components/select/Select.js +16 -13
  148. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +17 -2
  149. package/lib/cjs/components/selectboxes/SelectBoxes.form.d.ts +3 -6
  150. package/lib/cjs/components/selectboxes/SelectBoxes.form.js +0 -5
  151. package/lib/cjs/components/selectboxes/SelectBoxes.js +9 -7
  152. package/lib/cjs/components/signature/Signature.d.ts +14 -1
  153. package/lib/cjs/components/signature/Signature.form.d.ts +3 -6
  154. package/lib/cjs/components/signature/Signature.form.js +0 -5
  155. package/lib/cjs/components/survey/Survey.d.ts +15 -3
  156. package/lib/cjs/components/survey/Survey.form.d.ts +3 -6
  157. package/lib/cjs/components/survey/Survey.form.js +0 -5
  158. package/lib/cjs/components/table/Table.d.ts +1 -2
  159. package/lib/cjs/components/table/Table.form.d.ts +3 -6
  160. package/lib/cjs/components/table/Table.form.js +0 -5
  161. package/lib/cjs/components/tabs/Tabs.d.ts +4 -4
  162. package/lib/cjs/components/tabs/Tabs.form.d.ts +3 -6
  163. package/lib/cjs/components/tabs/Tabs.form.js +0 -5
  164. package/lib/cjs/components/tabs/Tabs.js +2 -1
  165. package/lib/cjs/components/tags/Tags.d.ts +14 -0
  166. package/lib/cjs/components/tags/Tags.form.d.ts +3 -6
  167. package/lib/cjs/components/tags/Tags.form.js +0 -5
  168. package/lib/cjs/components/textarea/TextArea.d.ts +9 -4
  169. package/lib/cjs/components/textarea/TextArea.form.d.ts +3 -6
  170. package/lib/cjs/components/textarea/TextArea.form.js +0 -5
  171. package/lib/cjs/components/textarea/TextArea.js +2 -2
  172. package/lib/cjs/components/textfield/TextField.d.ts +30 -14
  173. package/lib/cjs/components/textfield/TextField.form.d.ts +3 -6
  174. package/lib/cjs/components/textfield/TextField.form.js +0 -5
  175. package/lib/cjs/components/textfield/TextField.js +17 -14
  176. package/lib/cjs/components/time/Time.form.d.ts +3 -6
  177. package/lib/cjs/components/time/Time.form.js +0 -5
  178. package/lib/cjs/components/unknown/Unknown.form.d.ts +34 -5
  179. package/lib/cjs/components/unknown/Unknown.form.js +0 -4
  180. package/lib/cjs/components/url/Url.form.d.ts +3 -6
  181. package/lib/cjs/components/url/Url.form.js +0 -5
  182. package/lib/cjs/components/well/Well.form.d.ts +3 -6
  183. package/lib/cjs/components/well/Well.form.js +0 -5
  184. package/lib/cjs/formio.embed.d.ts +2 -1
  185. package/lib/cjs/formio.embed.js +100 -2
  186. package/lib/cjs/formio.form.d.ts +4 -11
  187. package/lib/cjs/formio.form.js +5 -13
  188. package/lib/cjs/providers/Providers.d.ts +5 -36
  189. package/lib/cjs/providers/Providers.js +0 -29
  190. package/lib/cjs/providers/address/AddressProvider.d.ts +12 -131
  191. package/lib/cjs/providers/address/AddressProvider.js +2 -88
  192. package/lib/cjs/providers/address/AzureAddressProvider.d.ts +1 -48
  193. package/lib/cjs/providers/address/AzureAddressProvider.js +0 -37
  194. package/lib/cjs/providers/address/CustomAddressProvider.d.ts +4 -27
  195. package/lib/cjs/providers/address/CustomAddressProvider.js +0 -34
  196. package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +6 -130
  197. package/lib/cjs/providers/address/GoogleAddressProvider.js +0 -72
  198. package/lib/cjs/providers/address/NominatimAddressProvider.d.ts +7 -32
  199. package/lib/cjs/providers/address/NominatimAddressProvider.js +0 -33
  200. package/lib/cjs/providers/address/index.d.ts +1 -3
  201. package/lib/cjs/providers/processor/fileProcessor.d.ts +1 -7
  202. package/lib/cjs/providers/processor/fileProcessor.js +0 -6
  203. package/lib/cjs/providers/storage/azure.d.ts +13 -6
  204. package/lib/cjs/providers/storage/azure.js +0 -5
  205. package/lib/cjs/providers/storage/base64.d.ts +6 -5
  206. package/lib/cjs/providers/storage/base64.js +0 -4
  207. package/lib/cjs/providers/storage/dropbox.d.ts +4 -6
  208. package/lib/cjs/providers/storage/dropbox.js +0 -5
  209. package/lib/cjs/providers/storage/googleDrive.d.ts +5 -7
  210. package/lib/cjs/providers/storage/googleDrive.js +0 -6
  211. package/lib/cjs/providers/storage/indexeddb.d.ts +7 -5
  212. package/lib/cjs/providers/storage/indexeddb.js +0 -4
  213. package/lib/cjs/providers/storage/s3.d.ts +20 -6
  214. package/lib/cjs/providers/storage/s3.js +0 -5
  215. package/lib/cjs/providers/storage/url.d.ts +7 -6
  216. package/lib/cjs/providers/storage/url.js +0 -10
  217. package/lib/cjs/providers/storage/util.d.ts +1 -24
  218. package/lib/cjs/providers/storage/util.js +0 -18
  219. package/lib/cjs/templates/Templates.d.ts +0 -1
  220. package/lib/cjs/utils/Evaluator.d.ts +3 -6
  221. package/lib/cjs/utils/Evaluator.js +20 -11
  222. package/lib/cjs/utils/builder.d.ts +7 -9
  223. package/lib/cjs/utils/builder.js +5 -10
  224. package/lib/cjs/utils/calendarUtils.d.ts +13 -7
  225. package/lib/cjs/utils/calendarUtils.js +17 -10
  226. package/lib/cjs/utils/formUtils.d.ts +171 -43
  227. package/lib/cjs/utils/formUtils.js +569 -38
  228. package/lib/cjs/utils/utils.d.ts +221 -367
  229. package/lib/cjs/utils/utils.js +228 -335
  230. package/lib/cjs/widgets/CalendarWidget.d.ts +10 -9
  231. package/lib/cjs/widgets/CalendarWidget.js +11 -9
  232. package/lib/mjs/CDN.d.ts +0 -1
  233. package/lib/mjs/CDN.js +3 -6
  234. package/lib/mjs/Element.d.ts +96 -86
  235. package/lib/mjs/Element.js +78 -68
  236. package/lib/mjs/Embed.d.ts +1 -1
  237. package/lib/mjs/Embed.js +12 -52
  238. package/lib/mjs/Form.d.ts +36 -365
  239. package/lib/mjs/Form.js +57 -140
  240. package/lib/mjs/FormBuilder.d.ts +2 -187
  241. package/lib/mjs/FormBuilder.js +8 -32
  242. package/lib/mjs/PDF.d.ts +13 -11
  243. package/lib/mjs/PDF.js +8 -6
  244. package/lib/mjs/Webform.d.ts +139 -180
  245. package/lib/mjs/Webform.js +308 -321
  246. package/lib/mjs/WebformBuilder.d.ts +14 -16
  247. package/lib/mjs/WebformBuilder.js +10 -11
  248. package/lib/mjs/Wizard.d.ts +21 -31
  249. package/lib/mjs/Wizard.js +19 -42
  250. package/lib/mjs/WizardBuilder.d.ts +1 -1
  251. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +5 -8
  252. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +3 -6
  253. package/lib/mjs/components/Components.d.ts +4 -4
  254. package/lib/mjs/components/Components.js +3 -3
  255. package/lib/mjs/components/_classes/component/Component.d.ts +269 -502
  256. package/lib/mjs/components/_classes/component/Component.form.d.ts +3 -6
  257. package/lib/mjs/components/_classes/component/Component.form.js +0 -5
  258. package/lib/mjs/components/_classes/component/Component.js +189 -433
  259. package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +8 -0
  260. package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +1 -1
  261. package/lib/mjs/components/_classes/component/editForm/utils.js +1 -1
  262. package/lib/mjs/components/_classes/field/Field.d.ts +2 -11
  263. package/lib/mjs/components/_classes/field/Field.js +1 -13
  264. package/lib/mjs/components/_classes/input/Input.d.ts +3 -4
  265. package/lib/mjs/components/_classes/input/Input.js +2 -2
  266. package/lib/mjs/components/_classes/list/ListComponent.d.ts +2 -2
  267. package/lib/mjs/components/_classes/list/ListComponent.form.d.ts +3 -6
  268. package/lib/mjs/components/_classes/list/ListComponent.form.js +0 -5
  269. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +12 -43
  270. package/lib/mjs/components/_classes/multivalue/Multivalue.js +3 -37
  271. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +67 -163
  272. package/lib/mjs/components/_classes/nested/NestedComponent.form.d.ts +3 -6
  273. package/lib/mjs/components/_classes/nested/NestedComponent.form.js +0 -5
  274. package/lib/mjs/components/_classes/nested/NestedComponent.js +54 -175
  275. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -2
  276. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  277. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -7
  278. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +3 -2
  279. package/lib/mjs/components/address/Address.d.ts +2 -4
  280. package/lib/mjs/components/address/Address.form.d.ts +3 -6
  281. package/lib/mjs/components/address/Address.form.js +0 -5
  282. package/lib/mjs/components/button/Button.d.ts +12 -3
  283. package/lib/mjs/components/button/Button.form.d.ts +3 -6
  284. package/lib/mjs/components/button/Button.form.js +0 -5
  285. package/lib/mjs/components/button/Button.js +0 -5
  286. package/lib/mjs/components/checkbox/Checkbox.d.ts +27 -4
  287. package/lib/mjs/components/checkbox/Checkbox.form.d.ts +3 -6
  288. package/lib/mjs/components/checkbox/Checkbox.form.js +0 -5
  289. package/lib/mjs/components/columns/Columns.d.ts +2 -3
  290. package/lib/mjs/components/columns/Columns.form.d.ts +3 -6
  291. package/lib/mjs/components/columns/Columns.form.js +0 -5
  292. package/lib/mjs/components/columns/Columns.js +1 -1
  293. package/lib/mjs/components/container/Container.form.d.ts +3 -6
  294. package/lib/mjs/components/container/Container.form.js +0 -5
  295. package/lib/mjs/components/content/Content.d.ts +1 -2
  296. package/lib/mjs/components/content/Content.form.d.ts +3 -6
  297. package/lib/mjs/components/content/Content.form.js +0 -5
  298. package/lib/mjs/components/currency/Currency.form.d.ts +3 -6
  299. package/lib/mjs/components/currency/Currency.form.js +0 -5
  300. package/lib/mjs/components/currency/Currency.js +2 -1
  301. package/lib/mjs/components/datagrid/DataGrid.d.ts +7 -8
  302. package/lib/mjs/components/datagrid/DataGrid.form.d.ts +3 -6
  303. package/lib/mjs/components/datagrid/DataGrid.form.js +0 -5
  304. package/lib/mjs/components/datagrid/DataGrid.js +5 -5
  305. package/lib/mjs/components/datamap/DataMap.d.ts +0 -1
  306. package/lib/mjs/components/datamap/DataMap.form.d.ts +3 -6
  307. package/lib/mjs/components/datamap/DataMap.form.js +0 -5
  308. package/lib/mjs/components/datetime/DateTime.d.ts +14 -0
  309. package/lib/mjs/components/datetime/DateTime.form.d.ts +3 -6
  310. package/lib/mjs/components/datetime/DateTime.form.js +0 -5
  311. package/lib/mjs/components/datetime/editForm/DateTime.edit.date.js +1 -1
  312. package/lib/mjs/components/day/Day.d.ts +48 -22
  313. package/lib/mjs/components/day/Day.form.d.ts +3 -6
  314. package/lib/mjs/components/day/Day.form.js +0 -5
  315. package/lib/mjs/components/day/Day.js +20 -15
  316. package/lib/mjs/components/editgrid/EditGrid.d.ts +3 -7
  317. package/lib/mjs/components/editgrid/EditGrid.form.d.ts +3 -6
  318. package/lib/mjs/components/editgrid/EditGrid.form.js +0 -5
  319. package/lib/mjs/components/editgrid/EditGrid.js +3 -3
  320. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
  321. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.templates.js +1 -1
  322. package/lib/mjs/components/email/Email.form.d.ts +3 -6
  323. package/lib/mjs/components/email/Email.form.js +0 -5
  324. package/lib/mjs/components/fieldset/Fieldset.form.d.ts +3 -6
  325. package/lib/mjs/components/fieldset/Fieldset.form.js +0 -5
  326. package/lib/mjs/components/file/File.d.ts +22 -9
  327. package/lib/mjs/components/file/File.form.d.ts +3 -6
  328. package/lib/mjs/components/file/File.form.js +0 -5
  329. package/lib/mjs/components/file/File.js +1 -2
  330. package/lib/mjs/components/form/Form.d.ts +20 -31
  331. package/lib/mjs/components/form/Form.form.d.ts +3 -6
  332. package/lib/mjs/components/form/Form.form.js +0 -5
  333. package/lib/mjs/components/form/Form.js +12 -15
  334. package/lib/mjs/components/hidden/Hidden.d.ts +11 -1
  335. package/lib/mjs/components/hidden/Hidden.form.d.ts +3 -6
  336. package/lib/mjs/components/hidden/Hidden.form.js +0 -5
  337. package/lib/mjs/components/hidden/Hidden.js +2 -1
  338. package/lib/mjs/components/html/HTML.d.ts +1 -2
  339. package/lib/mjs/components/html/HTML.form.d.ts +3 -6
  340. package/lib/mjs/components/html/HTML.form.js +0 -5
  341. package/lib/mjs/components/number/Number.d.ts +17 -3
  342. package/lib/mjs/components/number/Number.form.d.ts +3 -6
  343. package/lib/mjs/components/number/Number.form.js +0 -5
  344. package/lib/mjs/components/number/Number.js +2 -1
  345. package/lib/mjs/components/panel/Panel.form.d.ts +3 -6
  346. package/lib/mjs/components/panel/Panel.form.js +0 -5
  347. package/lib/mjs/components/panel/Panel.js +1 -0
  348. package/lib/mjs/components/password/Password.form.d.ts +3 -6
  349. package/lib/mjs/components/password/Password.form.js +0 -5
  350. package/lib/mjs/components/phonenumber/PhoneNumber.form.d.ts +3 -6
  351. package/lib/mjs/components/phonenumber/PhoneNumber.form.js +0 -5
  352. package/lib/mjs/components/radio/Radio.d.ts +26 -3
  353. package/lib/mjs/components/radio/Radio.form.d.ts +3 -6
  354. package/lib/mjs/components/radio/Radio.form.js +0 -5
  355. package/lib/mjs/components/radio/Radio.js +4 -3
  356. package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +1 -1
  357. package/lib/mjs/components/recaptcha/ReCaptcha.form.d.ts +3 -6
  358. package/lib/mjs/components/recaptcha/ReCaptcha.form.js +0 -5
  359. package/lib/mjs/components/select/Select.d.ts +39 -16
  360. package/lib/mjs/components/select/Select.form.d.ts +3 -6
  361. package/lib/mjs/components/select/Select.form.js +0 -5
  362. package/lib/mjs/components/select/Select.js +17 -14
  363. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +17 -2
  364. package/lib/mjs/components/selectboxes/SelectBoxes.form.d.ts +3 -6
  365. package/lib/mjs/components/selectboxes/SelectBoxes.form.js +0 -5
  366. package/lib/mjs/components/selectboxes/SelectBoxes.js +9 -7
  367. package/lib/mjs/components/signature/Signature.d.ts +14 -1
  368. package/lib/mjs/components/signature/Signature.form.d.ts +3 -6
  369. package/lib/mjs/components/signature/Signature.form.js +0 -5
  370. package/lib/mjs/components/survey/Survey.d.ts +15 -3
  371. package/lib/mjs/components/survey/Survey.form.d.ts +3 -6
  372. package/lib/mjs/components/survey/Survey.form.js +0 -5
  373. package/lib/mjs/components/table/Table.d.ts +1 -2
  374. package/lib/mjs/components/table/Table.form.d.ts +3 -6
  375. package/lib/mjs/components/table/Table.form.js +0 -5
  376. package/lib/mjs/components/tabs/Tabs.d.ts +4 -4
  377. package/lib/mjs/components/tabs/Tabs.form.d.ts +3 -6
  378. package/lib/mjs/components/tabs/Tabs.form.js +0 -5
  379. package/lib/mjs/components/tabs/Tabs.js +2 -1
  380. package/lib/mjs/components/tags/Tags.d.ts +14 -0
  381. package/lib/mjs/components/tags/Tags.form.d.ts +3 -6
  382. package/lib/mjs/components/tags/Tags.form.js +0 -5
  383. package/lib/mjs/components/textarea/TextArea.d.ts +9 -4
  384. package/lib/mjs/components/textarea/TextArea.form.d.ts +3 -6
  385. package/lib/mjs/components/textarea/TextArea.form.js +0 -5
  386. package/lib/mjs/components/textarea/TextArea.js +2 -2
  387. package/lib/mjs/components/textfield/TextField.d.ts +30 -14
  388. package/lib/mjs/components/textfield/TextField.form.d.ts +3 -6
  389. package/lib/mjs/components/textfield/TextField.form.js +0 -5
  390. package/lib/mjs/components/textfield/TextField.js +17 -14
  391. package/lib/mjs/components/time/Time.form.d.ts +3 -6
  392. package/lib/mjs/components/time/Time.form.js +0 -5
  393. package/lib/mjs/components/unknown/Unknown.form.d.ts +34 -5
  394. package/lib/mjs/components/unknown/Unknown.form.js +0 -4
  395. package/lib/mjs/components/url/Url.form.d.ts +3 -6
  396. package/lib/mjs/components/url/Url.form.js +0 -5
  397. package/lib/mjs/components/well/Well.form.d.ts +3 -6
  398. package/lib/mjs/components/well/Well.form.js +0 -5
  399. package/lib/mjs/formio.embed.d.ts +2 -1
  400. package/lib/mjs/formio.embed.js +99 -2
  401. package/lib/mjs/formio.form.d.ts +4 -11
  402. package/lib/mjs/formio.form.js +3 -10
  403. package/lib/mjs/providers/Providers.d.ts +5 -36
  404. package/lib/mjs/providers/Providers.js +0 -29
  405. package/lib/mjs/providers/address/AddressProvider.d.ts +12 -131
  406. package/lib/mjs/providers/address/AddressProvider.js +2 -88
  407. package/lib/mjs/providers/address/AzureAddressProvider.d.ts +1 -48
  408. package/lib/mjs/providers/address/AzureAddressProvider.js +0 -37
  409. package/lib/mjs/providers/address/CustomAddressProvider.d.ts +4 -27
  410. package/lib/mjs/providers/address/CustomAddressProvider.js +0 -34
  411. package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +6 -130
  412. package/lib/mjs/providers/address/GoogleAddressProvider.js +0 -72
  413. package/lib/mjs/providers/address/NominatimAddressProvider.d.ts +7 -32
  414. package/lib/mjs/providers/address/NominatimAddressProvider.js +0 -33
  415. package/lib/mjs/providers/address/index.d.ts +1 -3
  416. package/lib/mjs/providers/processor/fileProcessor.d.ts +1 -7
  417. package/lib/mjs/providers/processor/fileProcessor.js +0 -6
  418. package/lib/mjs/providers/storage/azure.d.ts +13 -6
  419. package/lib/mjs/providers/storage/azure.js +0 -5
  420. package/lib/mjs/providers/storage/base64.d.ts +6 -5
  421. package/lib/mjs/providers/storage/base64.js +0 -4
  422. package/lib/mjs/providers/storage/dropbox.d.ts +4 -6
  423. package/lib/mjs/providers/storage/dropbox.js +0 -5
  424. package/lib/mjs/providers/storage/googleDrive.d.ts +5 -7
  425. package/lib/mjs/providers/storage/googleDrive.js +0 -6
  426. package/lib/mjs/providers/storage/indexeddb.d.ts +7 -5
  427. package/lib/mjs/providers/storage/indexeddb.js +0 -4
  428. package/lib/mjs/providers/storage/s3.d.ts +20 -6
  429. package/lib/mjs/providers/storage/s3.js +0 -5
  430. package/lib/mjs/providers/storage/url.d.ts +7 -6
  431. package/lib/mjs/providers/storage/url.js +0 -10
  432. package/lib/mjs/providers/storage/util.d.ts +1 -24
  433. package/lib/mjs/providers/storage/util.js +0 -18
  434. package/lib/mjs/templates/Templates.d.ts +0 -1
  435. package/lib/mjs/utils/Evaluator.d.ts +3 -6
  436. package/lib/mjs/utils/Evaluator.js +20 -9
  437. package/lib/mjs/utils/builder.d.ts +7 -9
  438. package/lib/mjs/utils/builder.js +5 -10
  439. package/lib/mjs/utils/calendarUtils.d.ts +13 -7
  440. package/lib/mjs/utils/calendarUtils.js +17 -10
  441. package/lib/mjs/utils/formUtils.d.ts +171 -43
  442. package/lib/mjs/utils/formUtils.js +554 -6
  443. package/lib/mjs/utils/utils.d.ts +221 -367
  444. package/lib/mjs/utils/utils.js +222 -329
  445. package/lib/mjs/widgets/CalendarWidget.d.ts +10 -9
  446. package/lib/mjs/widgets/CalendarWidget.js +11 -9
  447. package/package.json +22 -22
  448. package/embed.d.ts +0 -1
  449. package/form.d.ts +0 -1
  450. package/lib/cjs/InlineEmbed.d.ts +0 -7
  451. package/lib/cjs/InlineEmbed.js +0 -116
  452. package/lib/mjs/InlineEmbed.d.ts +0 -7
  453. package/lib/mjs/InlineEmbed.js +0 -112
  454. package/sdk.d.ts +0 -1
  455. package/utils.d.ts +0 -1
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const lodash_1 = __importDefault(require("lodash"));
7
7
  const moment_1 = __importDefault(require("moment"));
8
8
  const compare_versions_1 = require("compare-versions");
9
+ const core_1 = require("@formio/core");
9
10
  const EventEmitter_1 = __importDefault(require("./EventEmitter"));
10
11
  const i18n_1 = __importDefault(require("./i18n"));
11
12
  const Formio_1 = require("./Formio");
@@ -17,32 +18,22 @@ const formUtils_1 = require("./utils/formUtils");
17
18
  Formio_1.Formio.forms = {};
18
19
  // Allow people to register components.
19
20
  Formio_1.Formio.registerComponent = Components_1.default.setComponent;
20
- /**
21
- *
22
- * @param {any} icons - The icons to use.
23
- * @returns {any} - The icon set.
24
- */
25
21
  function getIconSet(icons) {
26
- if (icons === "fontawesome") {
27
- return "fa";
22
+ if (icons === 'fontawesome') {
23
+ return 'fa';
28
24
  }
29
- return icons || "";
25
+ return icons || '';
30
26
  }
31
- /**
32
- *
33
- * @param {any} options - The options to get.
34
- * @returns {any} - The options.
35
- */
36
27
  function getOptions(options) {
37
28
  options = lodash_1.default.defaults(options, {
38
29
  submitOnEnter: false,
39
- iconset: getIconSet(options && options.icons ? options.icons : Formio_1.Formio.icons),
30
+ iconset: getIconSet((options && options.icons) ? options.icons : Formio_1.Formio.icons),
40
31
  i18next: null,
41
32
  saveDraft: false,
42
33
  alwaysDirty: false,
43
34
  saveDraftThrottle: 5000,
44
- display: "form",
45
- cdnUrl: Formio_1.Formio.cdn.baseUrl,
35
+ display: 'form',
36
+ cdnUrl: Formio_1.Formio.cdn.baseUrl
46
37
  });
47
38
  if (!options.events) {
48
39
  options.events = new EventEmitter_1.default();
@@ -62,36 +53,36 @@ function getOptions(options) {
62
53
  * @typedef {{[key: string]: JSON}} JSONObject
63
54
  */
64
55
  /**
65
- * @typedef {object} FormioHooks
66
- * @property {Function} [beforeSubmit] - A function that is called before the form is submitted.
67
- * @property {Function} [beforeCancel] - A function that is called before the form is canceled.
68
- * @property {Function} [beforeNext] - A function that is called before moving to the next page in a multi-page form.
69
- * @property {Function} [beforePrev] - A function that is called before moving to the previous page in a multi-page form.
70
- * @property {Function} [attachComponent] - A function that is called when a component is attached to the form.
71
- * @property {Function} [setDataValue] - A function that is called when setting the value of a data component.
72
- * @property {Function} [addComponents] - A function that is called when adding multiple components to the form.
73
- * @property {Function} [addComponent] - A function that is called when adding a single component to the form.
74
- * @property {Function} [customValidation] - A function that is called for custom validation of the form.
75
- * @property {Function} [attachWebform] - A function that is called when attaching a webform to the form.
56
+ * @typedef {Object} FormioHooks
57
+ * @property {function} [beforeSubmit]
58
+ * @property {function} [beforeCancel]
59
+ * @property {function} [beforeNext]
60
+ * @property {function} [beforePrev]
61
+ * @property {function} [attachComponent]
62
+ * @property {function} [setDataValue]
63
+ * @property {function} [addComponents]
64
+ * @property {function} [addComponent]
65
+ * @property {function} [customValidation]
66
+ * @property {function} [attachWebform]
76
67
  */
77
68
  /**
78
- * @typedef {object} SanitizeConfig
79
- * @property {string[]} [addAttr] - The attributes to add.
80
- * @property {string[]} [addTags] - The tags to add.
81
- * @property {string[]} [allowedAttrs] - The allowed attributes.
82
- * @property {string[]} [allowedTags] - The allowed tags.
83
- * @property {string[]} [allowedUriRegex] - The allowed URI regex.
84
- * @property {string[]} [addUriSafeAttr] - The URI safe attributes.
69
+ * @typedef {Object} SanitizeConfig
70
+ * @property {string[]} [addAttr]
71
+ * @property {string[]} [addTags]
72
+ * @property {string[]} [allowedAttrs]
73
+ * @property {string[]} [allowedTags]
74
+ * @property {string[]} [allowedUriRegex]
75
+ * @property {string[]} [addUriSafeAttr]
85
76
  */
86
77
  /**
87
- * @typedef {object} ButtonSettings
88
- * @property {boolean} [showPrevious] - Show the "Previous" button.
89
- * @property {boolean} [showNext] - Show the "Next" button.
90
- * @property {boolean} [showCancel] - Show the "Cancel" button.
91
- * @property {boolean} [showSubmit] - Show the "Submit" button.
78
+ * @typedef {Object} ButtonSettings
79
+ * @property {boolean} [showPrevious]
80
+ * @property {boolean} [showNext]
81
+ * @property {boolean} [showCancel]
82
+ * @property {boolean} [showSubmit]
92
83
  */
93
84
  /**
94
- * @typedef {object} FormOptions
85
+ * @typedef {Object} FormOptions
95
86
  * @property {boolean} [saveDraft] - Enable the save draft feature.
96
87
  * @property {number} [saveDraftThrottle] - The throttle for the save draft feature.
97
88
  * @property {boolean} [readOnly] - Set this form to readOnly.
@@ -109,7 +100,7 @@ function getOptions(options) {
109
100
  * @property {string} [componentErrorClass] - The error class for components.
110
101
  * @property {any} [templates] - The templates for this form.
111
102
  * @property {string} [iconset] - The iconset for this form.
112
- * @property {import('@formio/core').Component[]} [components] - The components for this form.
103
+ * @property {Component[]} [components] - The components for this form.
113
104
  * @property {{[key: string]: boolean}} [disabled] - Disabled components for this form.
114
105
  * @property {boolean} [showHiddenFields] - Show hidden fields.
115
106
  * @property {{[key: string]: boolean}} [hide] - Hidden components for this form.
@@ -126,28 +117,30 @@ function getOptions(options) {
126
117
  * @property {boolean} [sanitize] - Sanitize the form.
127
118
  * @property {SanitizeConfig} [sanitizeConfig] - The sanitize configuration for this form.
128
119
  * @property {ButtonSettings} [buttonSettings] - The button settings for this form.
129
- * @property {object} [breadcrumbSettings] - The breadcrumb settings for this form.
120
+ * @property {Object} [breadCrumbSettings] - The breadcrumb settings for this form.
130
121
  * @property {boolean} [allowPrevious] - Allow the previous button (for Wizard forms).
131
122
  * @property {string[]} [wizardButtonOrder] - The order of the buttons (for Wizard forms).
132
123
  * @property {boolean} [showCheckboxBackground] - Show the checkbox background.
133
- * @property {boolean} [inputsOnly] - Only show inputs in the form and no labels.
134
- * @property {boolean} [building] - If we are in the process of building the form.
135
124
  * @property {number} [zoom] - The zoom for PDF forms.
136
125
  */
126
+ /**
127
+ * Renders a Form.io form within the webpage.
128
+ */
137
129
  class Webform extends NestedDataComponent_1.default {
138
130
  /**
139
131
  * Creates a new Form instance.
140
- * @param {HTMLElement | object | import('Form').FormOptions} [elementOrOptions] - The DOM element to render this form within or the options to create this form instance.
141
- * @param {import('Form').FormOptions} [options] - The options to create a new form instance.
132
+ *
133
+ * @param {HTMLElement | Object | FormOptions} [elementOrOptions] - The DOM element to render this form within or the options to create this form instance.
134
+ * @param {FormOptions} [options] - The options to create a new form instance.
142
135
  */
143
- constructor(elementOrOptions, options = undefined) {
136
+ constructor(elementOrOptions, options) {
144
137
  let element, formOptions;
145
138
  if (elementOrOptions instanceof HTMLElement || options) {
146
139
  element = elementOrOptions;
147
- formOptions = options || {};
140
+ formOptions = options;
148
141
  }
149
142
  else {
150
- formOptions = elementOrOptions || {};
143
+ formOptions = elementOrOptions;
151
144
  }
152
145
  super(null, getOptions(formOptions));
153
146
  this.executeShortcuts = (event) => {
@@ -157,15 +150,15 @@ class Webform extends NestedDataComponent_1.default {
157
150
  }
158
151
  const ctrl = event.ctrlKey || event.metaKey;
159
152
  const keyCode = event.keyCode;
160
- let char = "";
153
+ let char = '';
161
154
  if (65 <= keyCode && keyCode <= 90) {
162
155
  char = String.fromCharCode(keyCode);
163
156
  }
164
157
  else if (keyCode === 13) {
165
- char = "Enter";
158
+ char = 'Enter';
166
159
  }
167
160
  else if (keyCode === 27) {
168
- char = "Esc";
161
+ char = 'Esc';
169
162
  }
170
163
  lodash_1.default.each(this.shortcuts, (shortcut) => {
171
164
  if (shortcut.ctrl && !ctrl) {
@@ -188,12 +181,12 @@ class Webform extends NestedDataComponent_1.default {
188
181
  * The type of this element.
189
182
  * @type {string}
190
183
  */
191
- this.type = "form";
192
- this._src = "";
184
+ this.type = 'form';
185
+ this._src = '';
193
186
  this._loading = false;
194
187
  this._form = {};
195
188
  this.draftEnabled = false;
196
- this.savingDraft = false;
189
+ this.savingDraft = true;
197
190
  if (this.options.saveDraftThrottle) {
198
191
  this.triggerSaveDraft = lodash_1.default.throttle(this.saveDraft.bind(this), this.options.saveDraftThrottle);
199
192
  }
@@ -207,11 +200,13 @@ class Webform extends NestedDataComponent_1.default {
207
200
  this.nosubmit = false;
208
201
  /**
209
202
  * Determines if the form has tried to be submitted, error or not.
203
+ *
210
204
  * @type {boolean}
211
205
  */
212
206
  this.submitted = false;
213
207
  /**
214
208
  * Determines if the form is being submitted at the moment.
209
+ *
215
210
  * @type {boolean}
216
211
  */
217
212
  this.submitting = false;
@@ -243,6 +238,7 @@ class Webform extends NestedDataComponent_1.default {
243
238
  /**
244
239
  * Promise that executes when the form is ready and rendered.
245
240
  * @type {Promise}
241
+ *
246
242
  * @example
247
243
  * import Webform from '@formio/js/Webform';
248
244
  * let form = new Webform(document.getElementById('formio'));
@@ -254,18 +250,21 @@ class Webform extends NestedDataComponent_1.default {
254
250
  this.formReady = new Promise((resolve, reject) => {
255
251
  /**
256
252
  * Called when the formReady state of this form has been resolved.
257
- * @type {Function}
253
+ *
254
+ * @type {function}
258
255
  */
259
256
  this.formReadyResolve = resolve;
260
257
  /**
261
258
  * Called when this form could not load and is rejected.
262
- * @type {Function}
259
+ *
260
+ * @type {function}
263
261
  */
264
262
  this.formReadyReject = reject;
265
263
  });
266
264
  /**
267
265
  * Promise that executes when the submission is ready and rendered.
268
266
  * @type {Promise}
267
+ *
269
268
  * @example
270
269
  * import Webform from '@formio/js/Webform';
271
270
  * let form = new Webform(document.getElementById('formio'));
@@ -277,12 +276,14 @@ class Webform extends NestedDataComponent_1.default {
277
276
  this.submissionReady = new Promise((resolve, reject) => {
278
277
  /**
279
278
  * Called when the formReady state of this form has been resolved.
280
- * @type {Function}
279
+ *
280
+ * @type {function}
281
281
  */
282
282
  this.submissionReadyResolve = resolve;
283
283
  /**
284
284
  * Called when this form could not load and is rejected.
285
- * @type {Function}
285
+ *
286
+ * @type {function}
286
287
  */
287
288
  this.submissionReadyReject = reject;
288
289
  });
@@ -291,19 +292,20 @@ class Webform extends NestedDataComponent_1.default {
291
292
  this.language = this.i18next.language;
292
293
  // See if we need to restore the draft from a user.
293
294
  if (this.options.saveDraft) {
294
- if (this.options.skipDraftRestore) {
295
- this.draftEnabled = true;
296
- this.savingDraft = false;
297
- }
298
- else {
299
- this.formReady.then(() => {
295
+ this.formReady.then(() => {
296
+ if (!this.options.skipDraftRestore) {
300
297
  const user = Formio_1.Formio.getUser();
301
298
  // Only restore a draft if the submission isn't explicitly set.
302
299
  if (user && !this.submissionSet) {
303
300
  this.restoreDraft(user._id);
304
301
  }
305
- });
306
- }
302
+ }
303
+ else {
304
+ // Enable drafts
305
+ this.draftEnabled = true;
306
+ this.savingDraft = false;
307
+ }
308
+ });
307
309
  }
308
310
  this.component.clearOnHide = false;
309
311
  // Ensure the root is set to this component.
@@ -322,7 +324,9 @@ class Webform extends NestedDataComponent_1.default {
322
324
  }
323
325
  /**
324
326
  * Sets the language for this form.
325
- * @param {string} lang - The language to use (e.g. 'en', 'sp', etc.)
327
+ *
328
+ * @param lang
329
+ * @return {Promise}
326
330
  */
327
331
  set language(lang) {
328
332
  if (!this.i18next) {
@@ -337,7 +341,7 @@ class Webform extends NestedDataComponent_1.default {
337
341
  return;
338
342
  }
339
343
  this.rebuild();
340
- this.emit("languageChanged");
344
+ this.emit('languageChanged');
341
345
  });
342
346
  }
343
347
  get componentComponents() {
@@ -348,25 +352,31 @@ class Webform extends NestedDataComponent_1.default {
348
352
  }
349
353
  /**
350
354
  * Add a language for translations
351
- * @param {string} code - The language code for the language being added.
352
- * @param {object} lang - The language translations.
353
- * @param {boolean} [active] - If this language should be set as the active language.
355
+ *
356
+ * @param code
357
+ * @param lang
358
+ * @param active
359
+ * @return {*}
354
360
  */
355
361
  addLanguage(code, lang, active = false) {
356
362
  if (this.i18next) {
357
363
  var translations = lodash_1.default.assign((0, utils_1.fastCloneDeep)(i18n_1.default.resources.en.translation), lang);
358
- this.i18next.addResourceBundle(code, "translation", translations, true, true);
364
+ this.i18next.addResourceBundle(code, 'translation', translations, true, true);
359
365
  if (active) {
360
366
  this.language = code;
361
367
  }
362
368
  }
363
369
  }
364
370
  keyboardCatchableElement(element) {
365
- if (element.nodeName === "TEXTAREA") {
371
+ if (element.nodeName === 'TEXTAREA') {
366
372
  return false;
367
373
  }
368
- if (element.nodeName === "INPUT") {
369
- return ["text", "email", "password"].indexOf(element.type) === -1;
374
+ if (element.nodeName === 'INPUT') {
375
+ return [
376
+ 'text',
377
+ 'email',
378
+ 'password'
379
+ ].indexOf(element.type) === -1;
370
380
  }
371
381
  return true;
372
382
  }
@@ -375,21 +385,21 @@ class Webform extends NestedDataComponent_1.default {
375
385
  return;
376
386
  }
377
387
  shortcut = lodash_1.default.capitalize(shortcut);
378
- if (shortcut === "Enter" || shortcut === "Esc") {
388
+ if (shortcut === 'Enter' || shortcut === 'Esc') {
379
389
  // Restrict Enter and Esc only for buttons
380
- if (element.tagName !== "BUTTON") {
390
+ if (element.tagName !== 'BUTTON') {
381
391
  return;
382
392
  }
383
393
  this.shortcuts.push({
384
394
  shortcut,
385
- element,
395
+ element
386
396
  });
387
397
  }
388
398
  else {
389
399
  this.shortcuts.push({
390
400
  ctrl: true,
391
401
  shortcut,
392
- element,
402
+ element
393
403
  });
394
404
  }
395
405
  }
@@ -399,27 +409,24 @@ class Webform extends NestedDataComponent_1.default {
399
409
  }
400
410
  lodash_1.default.remove(this.shortcuts, {
401
411
  shortcut,
402
- element,
412
+ element
403
413
  });
404
414
  }
405
415
  /**
406
416
  * Get the embed source of the form.
407
- * @returns {string} - The source of the form.
417
+ *
418
+ * @returns {string}
408
419
  */
409
420
  get src() {
410
421
  return this._src;
411
422
  }
412
423
  /**
413
424
  * Loads the submission if applicable.
414
- * @returns {Promise} - The promise that is triggered when the submission is loaded.
415
425
  */
416
426
  loadSubmission() {
417
427
  this.loadingSubmission = true;
418
428
  if (this.formio.submissionId) {
419
- this.onSubmission = this.formio
420
- .loadSubmission()
421
- .then((submission) => this.setSubmission(submission), (err) => this.submissionReadyReject(err))
422
- .catch((err) => this.submissionReadyReject(err));
429
+ this.onSubmission = this.formio.loadSubmission().then((submission) => this.setSubmission(submission), (err) => this.submissionReadyReject(err)).catch((err) => this.submissionReadyReject(err));
423
430
  }
424
431
  else {
425
432
  this.submissionReadyResolve();
@@ -428,21 +435,18 @@ class Webform extends NestedDataComponent_1.default {
428
435
  }
429
436
  /**
430
437
  * Set the src of the form renderer.
431
- * @param {string} value - The source value to set.
432
- * @param {any} options - The options to set.
433
- * @returns {Promise} - The promise that is triggered when the form is set.
438
+ *
439
+ * @param value
440
+ * @param options
434
441
  */
435
442
  setSrc(value, options) {
436
443
  if (this.setUrl(value, options)) {
437
444
  this.nosubmit = false;
438
- return this.formio
439
- .loadForm({ params: { live: 1 } })
440
- .then((form) => {
445
+ return this.formio.loadForm({ params: { live: 1 } }).then((form) => {
441
446
  const setForm = this.setForm(form);
442
447
  this.loadSubmission();
443
448
  return setForm;
444
- })
445
- .catch((err) => {
449
+ }).catch((err) => {
446
450
  console.warn(err);
447
451
  this.formReadyReject(err);
448
452
  });
@@ -451,7 +455,9 @@ class Webform extends NestedDataComponent_1.default {
451
455
  }
452
456
  /**
453
457
  * Set the Form source, which is typically the Form.io embed URL.
458
+ *
454
459
  * @param {string} value - The value of the form embed url.
460
+ *
455
461
  * @example
456
462
  * import Webform from '@formio/js/Webform';
457
463
  * let form = new Webform(document.getElementById('formio'));
@@ -465,25 +471,28 @@ class Webform extends NestedDataComponent_1.default {
465
471
  }
466
472
  /**
467
473
  * Get the embed source of the form.
468
- * @returns {string} - returns the source of the form.
474
+ *
475
+ * @returns {string}
469
476
  */
470
477
  get url() {
471
478
  return this._src;
472
479
  }
473
480
  /**
474
481
  * Sets the url of the form renderer.
475
- * @param {string} value - The value to set the url to.
476
- * @param {any} options - The options to set.
477
- * @returns {boolean} - TRUE means the url was set, FALSE otherwise.
482
+ *
483
+ * @param value
484
+ * @param options
478
485
  */
479
486
  setUrl(value, options) {
480
- if (!value || typeof value !== "string" || value === this._src) {
487
+ if (!value ||
488
+ (typeof value !== 'string') ||
489
+ (value === this._src)) {
481
490
  return false;
482
491
  }
483
492
  this._src = value;
484
493
  this.nosubmit = true;
485
494
  this.formio = this.options.formio = new Formio_1.Formio(value, options);
486
- if (this.type === "form") {
495
+ if (this.type === 'form') {
487
496
  // Set the options source so this can be passed to other components.
488
497
  this.options.src = value;
489
498
  }
@@ -491,6 +500,7 @@ class Webform extends NestedDataComponent_1.default {
491
500
  }
492
501
  /**
493
502
  * Set the form source but don't initialize the form and submission from the url.
503
+ *
494
504
  * @param {string} value - The value of the form embed url.
495
505
  */
496
506
  set url(value) {
@@ -498,6 +508,7 @@ class Webform extends NestedDataComponent_1.default {
498
508
  }
499
509
  /**
500
510
  * Called when both the form and submission have been loaded.
511
+ *
501
512
  * @returns {Promise} - The promise to trigger when both form and submission have loaded.
502
513
  */
503
514
  get ready() {
@@ -509,6 +520,7 @@ class Webform extends NestedDataComponent_1.default {
509
520
  }
510
521
  /**
511
522
  * Returns if this form is loading.
523
+ *
512
524
  * @returns {boolean} - TRUE means the form is loading, FALSE otherwise.
513
525
  */
514
526
  get loading() {
@@ -516,17 +528,18 @@ class Webform extends NestedDataComponent_1.default {
516
528
  }
517
529
  /**
518
530
  * Set the loading state for this form, and also show the loader spinner.
531
+ *
519
532
  * @param {boolean} loading - If this form should be "loading" or not.
520
533
  */
521
534
  set loading(loading) {
522
535
  if (this._loading !== loading) {
523
536
  this._loading = loading;
524
537
  if (!this.loader && loading) {
525
- this.loader = this.ce("div", {
526
- class: "loader-wrapper",
538
+ this.loader = this.ce('div', {
539
+ class: 'loader-wrapper'
527
540
  });
528
- const spinner = this.ce("div", {
529
- class: "loader text-center",
541
+ const spinner = this.ce('div', {
542
+ class: 'loader text-center'
530
543
  });
531
544
  this.loader.appendChild(spinner);
532
545
  }
@@ -549,6 +562,7 @@ class Webform extends NestedDataComponent_1.default {
549
562
  }
550
563
  /**
551
564
  * Sets the JSON schema for the form to be rendered.
565
+ *
552
566
  * @example
553
567
  * import Webform from '@formio/js/Webform';
554
568
  * let form = new Webform(document.getElementById('formio'));
@@ -576,11 +590,12 @@ class Webform extends NestedDataComponent_1.default {
576
590
  * }
577
591
  * ]
578
592
  * });
579
- * @param {object} form - The JSON schema of the form @see https://examples.form.io/example for an example JSON schema.
580
- * @param {any} flags - Any flags to apply when setting the form.
581
- * @returns {Promise} - The promise that is triggered when the form is set.
593
+ *
594
+ * @param {Object} form - The JSON schema of the form @see https://examples.form.io/example for an example JSON schema.
595
+ * @param flags
596
+ * @returns {*}
582
597
  */
583
- setForm(form, flags = {}) {
598
+ setForm(form, flags) {
584
599
  var _a, _b, _c;
585
600
  const isFormAlreadySet = this._form && ((_a = this._form.components) === null || _a === void 0 ? void 0 : _a.length);
586
601
  try {
@@ -611,19 +626,17 @@ class Webform extends NestedDataComponent_1.default {
611
626
  }
612
627
  // Use the sanitize config from the form settings or the global sanitize config if it is not provided in the options
613
628
  if (!this.options.sanitizeConfig && !this.builderMode) {
614
- this.options.sanitizeConfig =
615
- lodash_1.default.get(form, "settings.sanitizeConfig") ||
616
- lodash_1.default.get(form, "globalSettings.sanitizeConfig");
629
+ this.options.sanitizeConfig = lodash_1.default.get(form, 'settings.sanitizeConfig') || lodash_1.default.get(form, 'globalSettings.sanitizeConfig');
617
630
  }
618
- if ("schema" in form && (0, compare_versions_1.compareVersions)(form.schema, "1.x") > 0) {
631
+ if ('schema' in form && (0, compare_versions_1.compareVersions)(form.schema, '1.x') > 0) {
619
632
  this.ready.then(() => {
620
- this.setAlert("alert alert-danger", "Form schema is for a newer version, please upgrade your renderer. Some functionality may not work.");
633
+ this.setAlert('alert alert-danger', 'Form schema is for a newer version, please upgrade your renderer. Some functionality may not work.');
621
634
  });
622
635
  }
623
636
  // See if they pass a module, and evaluate it if so.
624
637
  if (form && form.module) {
625
638
  let formModule = null;
626
- if (typeof form.module === "string") {
639
+ if (typeof form.module === 'string') {
627
640
  try {
628
641
  formModule = this.evaluate(`return ${form.module}`);
629
642
  }
@@ -645,7 +658,7 @@ class Webform extends NestedDataComponent_1.default {
645
658
  this.initialized = false;
646
659
  const rebuild = this.rebuild() || Promise.resolve();
647
660
  return rebuild.then(() => {
648
- this.emit("formLoad", form);
661
+ this.emit('formLoad', form);
649
662
  this.triggerCaptcha();
650
663
  // Make sure to trigger onChange after a render event occurs to speed up form rendering.
651
664
  setTimeout(() => {
@@ -657,33 +670,37 @@ class Webform extends NestedDataComponent_1.default {
657
670
  }
658
671
  /**
659
672
  * Gets the form object.
660
- * @returns {object} - The form JSON schema.
673
+ *
674
+ * @returns {Object} - The form JSON schema.
661
675
  */
662
676
  get form() {
663
677
  if (!this._form) {
664
678
  this._form = {
665
- components: [],
679
+ components: []
666
680
  };
667
681
  }
668
682
  return this._form;
669
683
  }
670
684
  /**
671
685
  * Sets the form value.
686
+ *
672
687
  * @alias setForm
673
- * @param {object} form - The form schema object.
688
+ * @param {Object} form - The form schema object.
674
689
  */
675
690
  set form(form) {
676
691
  this.setForm(form);
677
692
  }
678
693
  /**
679
694
  * Returns the submission object that was set within this form.
680
- * @returns {object} - The submission object.
695
+ *
696
+ * @returns {Object}
681
697
  */
682
698
  get submission() {
683
699
  return this.getValue();
684
700
  }
685
701
  /**
686
702
  * Sets the submission of a form.
703
+ *
687
704
  * @example
688
705
  * import Webform from '@formio/js/Webform';
689
706
  * let form = new Webform(document.getElementById('formio'));
@@ -693,118 +710,115 @@ class Webform extends NestedDataComponent_1.default {
693
710
  * lastName: 'Smith',
694
711
  * email: 'joe@example.com'
695
712
  * }};
696
- * @param {object} submission - The Form.io submission object.
713
+ *
714
+ * @param {Object} submission - The Form.io submission object.
697
715
  */
698
716
  set submission(submission) {
699
717
  this.setSubmission(submission);
700
718
  }
701
719
  /**
702
720
  * Sets a submission and returns the promise when it is ready.
703
- * @param {any} submission - The submission to set.
704
- * @param {any} flags - Any flags to apply when setting the submission.
705
- * @returns {Promise} - The promise that is triggered when the submission is set.
721
+ * @param submission
722
+ * @param flags
723
+ * @return {Promise.<TResult>}
706
724
  */
707
725
  setSubmission(submission, flags = {}) {
708
- flags = Object.assign(Object.assign({}, flags), { fromSubmission: lodash_1.default.has(flags, "fromSubmission") ? flags.fromSubmission : true });
709
- return (this.onSubmission = this.formReady
710
- .then((resolveFlags) => {
726
+ flags = Object.assign(Object.assign({}, flags), { fromSubmission: lodash_1.default.has(flags, 'fromSubmission') ? flags.fromSubmission : true });
727
+ return this.onSubmission = this.formReady.then((resolveFlags) => {
711
728
  if (resolveFlags) {
712
729
  flags = Object.assign(Object.assign({}, flags), resolveFlags);
713
730
  }
714
731
  this.submissionSet = true;
715
732
  this.triggerChange(flags);
716
- this.emit("beforeSetSubmission", submission);
733
+ this.emit('beforeSetSubmission', submission);
717
734
  this.setValue(submission, flags);
718
735
  return this.submissionReadyResolve(submission);
719
- }, (err) => this.submissionReadyReject(err))
720
- .catch((err) => this.submissionReadyReject(err)));
736
+ }, (err) => this.submissionReadyReject(err)).catch((err) => this.submissionReadyReject(err));
721
737
  }
722
738
  handleDraftError(errName, errDetails, restoreDraft) {
723
- const errorMessage = lodash_1.default.trim(`${this.t(errName)} ${errDetails || ""}`);
739
+ const errorMessage = lodash_1.default.trim(`${this.t(errName)} ${errDetails || ''}`);
724
740
  console.warn(errorMessage);
725
- this.emit(restoreDraft ? "restoreDraftError" : "saveDraftError", errDetails || errorMessage);
741
+ this.emit(restoreDraft ? 'restoreDraftError' : 'saveDraftError', errDetails || errorMessage);
726
742
  }
743
+ /**
744
+ * Saves a submission draft.
745
+ */
727
746
  saveDraft() {
728
747
  if (!this.draftEnabled) {
729
748
  return;
730
749
  }
731
750
  if (!this.formio) {
732
- this.handleDraftError("saveDraftInstanceError");
751
+ this.handleDraftError('saveDraftInstanceError');
733
752
  return;
734
753
  }
735
754
  if (!Formio_1.Formio.getUser()) {
736
- this.handleDraftError("saveDraftAuthError");
755
+ this.handleDraftError('saveDraftAuthError');
737
756
  return;
738
757
  }
739
758
  const draft = (0, utils_1.fastCloneDeep)(this.submission);
740
- draft.state = "draft";
759
+ draft.state = 'draft';
741
760
  if (!this.savingDraft && !this.submitting) {
742
- this.emit("saveDraftBegin");
761
+ this.emit('saveDraftBegin');
743
762
  this.savingDraft = true;
744
- this.formio
745
- .saveSubmission(draft)
746
- .then((sub) => {
763
+ this.formio.saveSubmission(draft).then((sub) => {
747
764
  // Set id to submission to avoid creating new draft submission
748
765
  this.submission._id = sub._id;
749
766
  this.savingDraft = false;
750
- this.emit("saveDraft", sub);
767
+ this.emit('saveDraft', sub);
751
768
  })
752
- .catch((err) => {
769
+ .catch(err => {
753
770
  this.savingDraft = false;
754
- this.handleDraftError("saveDraftError", err);
771
+ this.handleDraftError('saveDraftError', err);
755
772
  });
756
773
  }
757
774
  }
758
775
  /**
759
776
  * Restores a draft submission based on the user who is authenticated.
760
- * @param {string} userId - The user id where we need to restore the draft from.
777
+ *
778
+ * @param {userId} - The user id where we need to restore the draft from.
761
779
  */
762
780
  restoreDraft(userId) {
763
781
  const formio = this.formio || this.options.formio;
764
782
  if (!formio) {
765
- this.handleDraftError("restoreDraftInstanceError", null, true);
783
+ this.handleDraftError('restoreDraftInstanceError', null, true);
766
784
  return;
767
785
  }
768
786
  this.savingDraft = true;
769
- formio
770
- .loadSubmissions({
787
+ formio.loadSubmissions({
771
788
  params: {
772
789
  state: 'draft',
773
790
  owner: userId,
774
791
  sort: '-created'
775
- },
776
- })
777
- .then((submissions) => {
792
+ }
793
+ }).then(submissions => {
778
794
  if (submissions.length > 0 && !this.options.skipDraftRestore) {
779
795
  const draft = (0, utils_1.fastCloneDeep)(submissions[0]);
780
796
  return this.setSubmission(draft).then(() => {
781
797
  this.draftEnabled = true;
782
798
  this.savingDraft = false;
783
- this.emit("restoreDraft", draft);
799
+ this.emit('restoreDraft', draft);
784
800
  });
785
801
  }
786
802
  // Enable drafts so that we can keep track of changes.
787
803
  this.draftEnabled = true;
788
804
  this.savingDraft = false;
789
- this.emit("restoreDraft", null);
805
+ this.emit('restoreDraft', null);
790
806
  })
791
- .catch((err) => {
807
+ .catch(err => {
792
808
  this.draftEnabled = true;
793
809
  this.savingDraft = false;
794
- this.handleDraftError("restoreDraftError", err, true);
810
+ this.handleDraftError('restoreDraftError', err, true);
795
811
  });
796
812
  }
797
813
  get schema() {
798
- const schema = (0, utils_1.fastCloneDeep)(lodash_1.default.omit(this._form, ["components"]));
814
+ const schema = (0, utils_1.fastCloneDeep)(lodash_1.default.omit(this._form, ['components']));
799
815
  schema.components = [];
800
816
  this.eachComponent((component) => schema.components.push(component.schema));
801
817
  return schema;
802
818
  }
803
819
  mergeData(_this, _that) {
804
820
  lodash_1.default.mergeWith(_this, _that, (thisValue, thatValue) => {
805
- if (Array.isArray(thisValue) &&
806
- Array.isArray(thatValue) &&
807
- thisValue.length !== thatValue.length) {
821
+ if (Array.isArray(thisValue) && Array.isArray(thatValue) && thisValue.length !== thatValue.length) {
808
822
  return thatValue;
809
823
  }
810
824
  });
@@ -817,7 +831,9 @@ class Webform extends NestedDataComponent_1.default {
817
831
  };
818
832
  }
819
833
  // Metadata needs to be available before setValue
820
- this._submission.metadata = submission.metadata ? lodash_1.default.cloneDeep(submission.metadata) : {};
834
+ this._submission.metadata = submission.metadata
835
+ ? lodash_1.default.cloneDeep(submission.metadata)
836
+ : {};
821
837
  this.editing = !!submission._id;
822
838
  // Set the timezone in the options if available.
823
839
  if (!this.options.submissionTimezone &&
@@ -846,7 +862,6 @@ class Webform extends NestedDataComponent_1.default {
846
862
  }
847
863
  /**
848
864
  * Build the form.
849
- * @returns {Promise} - The promise that is triggered when the form is built.
850
865
  */
851
866
  init() {
852
867
  if (this.options.submission) {
@@ -868,31 +883,28 @@ class Webform extends NestedDataComponent_1.default {
868
883
  else {
869
884
  this.component = this.form;
870
885
  }
871
- this.component.type = "form";
886
+ this.component.type = 'form';
872
887
  this.component.input = false;
873
888
  this.addComponents();
874
- this.on("submitButton", (options) => {
875
- this.submit(false, options).catch((e) => {
889
+ this.on('submitButton', options => {
890
+ this.submit(false, options).catch(e => {
876
891
  options.instance.loading = false;
877
892
  return e !== false && e !== undefined && console.log(e);
878
893
  });
879
894
  }, true);
880
- this.on("checkValidity", (data) => this.validate(data, { dirty: true, process: "change" }), true);
881
- this.on("requestUrl", (args) => this.submitUrl(args.url, args.headers), true);
882
- this.on("resetForm", () => this.resetValue(), true);
883
- this.on("deleteSubmission", () => this.deleteSubmission(), true);
884
- this.on("refreshData", () => this.updateValue(), true);
895
+ this.on('checkValidity', (data) => this.validate(data, { dirty: true, process: 'change' }), true);
896
+ this.on('requestUrl', (args) => (this.submitUrl(args.url, args.headers)), true);
897
+ this.on('resetForm', () => this.resetValue(), true);
898
+ this.on('deleteSubmission', () => this.deleteSubmission(), true);
899
+ this.on('refreshData', () => this.updateValue(), true);
885
900
  this.executeFormController();
886
901
  return this.formReady;
887
902
  }
888
903
  executeFormController() {
889
904
  // If no controller value or
890
905
  // hidden and set to clearOnHide (Don't calculate a value for a hidden field set to clear when hidden)
891
- if (!this.form ||
892
- !this.form.controller ||
893
- ((!this.visible || this.component.hidden) &&
894
- this.component.clearOnHide &&
895
- !this.rootPristine)) {
906
+ if (!this.form || !this.form.controller
907
+ || ((!this.visible || this.component.hidden) && this.component.clearOnHide && !this.rootPristine)) {
896
908
  return false;
897
909
  }
898
910
  this.formReady.then(() => {
@@ -902,23 +914,20 @@ class Webform extends NestedDataComponent_1.default {
902
914
  });
903
915
  });
904
916
  }
905
- /**
906
- *
907
- */
908
917
  teardown() {
909
- this.emit("formDelete", this.id);
918
+ this.emit('formDelete', this.id);
910
919
  delete Formio_1.Formio.forms[this.id];
911
920
  delete this.executeShortcuts;
912
921
  delete this.triggerSaveDraft;
913
922
  super.teardown();
914
923
  }
915
924
  destroy(all = false) {
916
- this.off("submitButton");
917
- this.off("checkValidity");
918
- this.off("requestUrl");
919
- this.off("resetForm");
920
- this.off("deleteSubmission");
921
- this.off("refreshData");
925
+ this.off('submitButton');
926
+ this.off('checkValidity');
927
+ this.off('requestUrl');
928
+ this.off('resetForm');
929
+ this.off('deleteSubmission');
930
+ this.off('refreshData');
922
931
  return super.destroy(all);
923
932
  }
924
933
  build(element) {
@@ -931,17 +940,17 @@ class Webform extends NestedDataComponent_1.default {
931
940
  return this.ready;
932
941
  }
933
942
  getClassName() {
934
- let classes = "formio-form";
943
+ let classes = 'formio-form';
935
944
  if (this.options.readOnly) {
936
- classes += " formio-read-only";
945
+ classes += ' formio-read-only';
937
946
  }
938
947
  return classes;
939
948
  }
940
949
  render() {
941
- return super.render(this.renderTemplate("webform", {
950
+ return super.render(this.renderTemplate('webform', {
942
951
  classes: this.getClassName(),
943
952
  children: this.renderComponents(),
944
- }), this.builderMode ? "builder" : "form", true);
953
+ }), this.builderMode ? 'builder' : 'form', true);
945
954
  }
946
955
  redraw() {
947
956
  // Don't bother if we have not built yet.
@@ -954,13 +963,13 @@ class Webform extends NestedDataComponent_1.default {
954
963
  }
955
964
  attach(element) {
956
965
  this.setElement(element);
957
- this.loadRefs(element, { webform: "single" });
966
+ this.loadRefs(element, { webform: 'single' });
958
967
  const childPromise = this.attachComponents(this.refs.webform);
959
- this.addEventListener(document, "keydown", this.executeShortcuts);
968
+ this.addEventListener(document, 'keydown', this.executeShortcuts);
960
969
  this.currentForm = this;
961
- this.hook("attachWebform", element, this);
970
+ this.hook('attachWebform', element, this);
962
971
  return childPromise.then(() => {
963
- this.emit("render", this.element);
972
+ this.emit('render', this.element);
964
973
  return this.setValue(this._submission, {
965
974
  noUpdateEvent: true,
966
975
  });
@@ -977,23 +986,24 @@ class Webform extends NestedDataComponent_1.default {
977
986
  return result;
978
987
  }
979
988
  resetValue() {
980
- lodash_1.default.each(this.getComponents(), (comp) => comp.resetValue());
989
+ lodash_1.default.each(this.getComponents(), (comp) => (comp.resetValue()));
981
990
  this.setPristine(true);
982
991
  this.onChange({ resetValue: true });
983
992
  }
984
993
  /**
985
994
  * Sets a new alert to display in the error dialog of the form.
995
+ *
986
996
  * @param {string} type - The type of alert to display. "danger", "success", "warning", etc.
987
997
  * @param {string} message - The message to show in the alert.
988
- * @param {object} options - The options for the alert.
998
+ * @param {Object} options
989
999
  */
990
1000
  setAlert(type, message, options) {
991
1001
  if (!type && this.submitted) {
992
1002
  if (this.alert) {
993
1003
  if (this.refs.errorRef && this.refs.errorRef.length) {
994
- this.refs.errorRef.forEach((el) => {
995
- this.removeEventListener(el, "click");
996
- this.removeEventListener(el, "keypress");
1004
+ this.refs.errorRef.forEach(el => {
1005
+ this.removeEventListener(el, 'click');
1006
+ this.removeEventListener(el, 'keypress');
997
1007
  });
998
1008
  }
999
1009
  this.removeChild(this.alert);
@@ -1003,16 +1013,16 @@ class Webform extends NestedDataComponent_1.default {
1003
1013
  }
1004
1014
  if (this.options.noAlerts) {
1005
1015
  if (!message) {
1006
- this.emit("error", false);
1016
+ this.emit('error', false);
1007
1017
  }
1008
1018
  return;
1009
1019
  }
1010
1020
  if (this.alert) {
1011
1021
  try {
1012
1022
  if (this.refs.errorRef && this.refs.errorRef.length) {
1013
- this.refs.errorRef.forEach((el) => {
1014
- this.removeEventListener(el, "click");
1015
- this.removeEventListener(el, "keypress");
1023
+ this.refs.errorRef.forEach(el => {
1024
+ this.removeEventListener(el, 'click');
1025
+ this.removeEventListener(el, 'keypress');
1016
1026
  });
1017
1027
  }
1018
1028
  this.removeChild(this.alert);
@@ -1030,21 +1040,21 @@ class Webform extends NestedDataComponent_1.default {
1030
1040
  const templateOptions = {
1031
1041
  message: message instanceof HTMLElement ? message.outerHTML : message,
1032
1042
  attrs: attrs,
1033
- type,
1043
+ type
1034
1044
  };
1035
- this.alert = (0, utils_1.convertStringToHTMLElement)(this.renderTemplate("alert", templateOptions), `#${attrs.id}`);
1045
+ this.alert = (0, utils_1.convertStringToHTMLElement)(this.renderTemplate('alert', templateOptions), `#${attrs.id}`);
1036
1046
  }
1037
1047
  if (!this.alert) {
1038
1048
  return;
1039
1049
  }
1040
- this.loadRefs(this.alert, { errorRef: "multiple" });
1050
+ this.loadRefs(this.alert, { errorRef: 'multiple' });
1041
1051
  if (this.refs.errorRef && this.refs.errorRef.length) {
1042
- this.refs.errorRef.forEach((el) => {
1043
- this.addEventListener(el, "click", (e) => {
1052
+ this.refs.errorRef.forEach(el => {
1053
+ this.addEventListener(el, 'click', (e) => {
1044
1054
  const key = e.currentTarget.dataset.componentKey;
1045
1055
  this.focusOnComponent(key);
1046
1056
  });
1047
- this.addEventListener(el, "keydown", (e) => {
1057
+ this.addEventListener(el, 'keydown', (e) => {
1048
1058
  if (e.keyCode === 13) {
1049
1059
  e.preventDefault();
1050
1060
  const key = e.currentTarget.dataset.componentKey;
@@ -1057,7 +1067,9 @@ class Webform extends NestedDataComponent_1.default {
1057
1067
  }
1058
1068
  /**
1059
1069
  * Focus on selected component.
1070
+ *
1060
1071
  * @param {string} key - The key of selected component.
1072
+ * @returns {*}
1061
1073
  */
1062
1074
  focusOnComponent(key) {
1063
1075
  if (key) {
@@ -1069,16 +1081,11 @@ class Webform extends NestedDataComponent_1.default {
1069
1081
  }
1070
1082
  /**
1071
1083
  * Show the errors of this form within the alert dialog.
1072
- * @param {object} error - An optional additional error to display along with the component errors.
1084
+ *
1085
+ * @param {Object} error - An optional additional error to display along with the component errors.
1073
1086
  * @returns {*}
1074
1087
  */
1075
1088
  /* eslint-disable no-unused-vars */
1076
- /**
1077
- *
1078
- * @param {Array} errors - An array of errors to display.
1079
- * @param {boolean} triggerEvent - Whether or not to trigger the error event.
1080
- * @returns {void|Array} - The errors that were set.
1081
- */
1082
1089
  showErrors(errors, triggerEvent) {
1083
1090
  this.loading = false;
1084
1091
  if (!Array.isArray(errors)) {
@@ -1115,47 +1122,43 @@ class Webform extends NestedDataComponent_1.default {
1115
1122
  });
1116
1123
  const displayedErrors = [];
1117
1124
  if (errors.length) {
1118
- errors = lodash_1.default.uniqBy(errors, (error) => error.message);
1125
+ errors = lodash_1.default.uniqBy(errors, error => error.message);
1119
1126
  const createListItem = (message, index) => {
1120
1127
  var _a, _b, _c;
1121
1128
  const err = errors[index];
1122
1129
  const messageFromIndex = !lodash_1.default.isUndefined(index) && errors && errors[index];
1123
- const keyOrPath = (messageFromIndex === null || messageFromIndex === void 0 ? void 0 : messageFromIndex.formattedKeyOrPath) ||
1124
- (messageFromIndex === null || messageFromIndex === void 0 ? void 0 : messageFromIndex.path) ||
1125
- ((_a = messageFromIndex === null || messageFromIndex === void 0 ? void 0 : messageFromIndex.context) === null || _a === void 0 ? void 0 : _a.path) ||
1126
- (((_b = err.context) === null || _b === void 0 ? void 0 : _b.component) && ((_c = err.context) === null || _c === void 0 ? void 0 : _c.component.key)) ||
1127
- (err.component && err.component.key) ||
1128
- (err.fromServer && err.path);
1129
- const formattedKeyOrPath = keyOrPath ? (0, utils_1.getStringFromComponentPath)(keyOrPath) : "";
1130
- if (typeof err !== "string" && !err.formattedKeyOrPath) {
1130
+ const keyOrPath = ((messageFromIndex === null || messageFromIndex === void 0 ? void 0 : messageFromIndex.formattedKeyOrPath) || (messageFromIndex === null || messageFromIndex === void 0 ? void 0 : messageFromIndex.path) || ((_a = messageFromIndex === null || messageFromIndex === void 0 ? void 0 : messageFromIndex.context) === null || _a === void 0 ? void 0 : _a.path)) || (((_b = err.context) === null || _b === void 0 ? void 0 : _b.component) && ((_c = err.context) === null || _c === void 0 ? void 0 : _c.component.key)) || (err.component && err.component.key) || err.fromServer && err.path;
1131
+ const formattedKeyOrPath = keyOrPath ? (0, utils_1.getStringFromComponentPath)(keyOrPath) : '';
1132
+ if (typeof err !== 'string' && !err.formattedKeyOrPath) {
1131
1133
  err.formattedKeyOrPath = formattedKeyOrPath;
1132
1134
  }
1133
1135
  return {
1134
1136
  message: (0, utils_1.unescapeHTML)(message),
1135
- keyOrPath: formattedKeyOrPath,
1137
+ keyOrPath: formattedKeyOrPath
1136
1138
  };
1137
1139
  };
1138
1140
  errors.forEach(({ message, context, fromServer, component }, index) => {
1139
1141
  const text = !(component === null || component === void 0 ? void 0 : component.label) || (context === null || context === void 0 ? void 0 : context.hasLabel) || fromServer
1140
- ? this.t("alertMessage", { message: this.t(message) })
1141
- : this.t("alertMessageWithLabel", {
1142
+ ? this.t('alertMessage', { message: this.t(message) })
1143
+ : this.t('alertMessageWithLabel', {
1142
1144
  label: this.t(component === null || component === void 0 ? void 0 : component.label),
1143
1145
  message: this.t(message),
1144
1146
  });
1145
1147
  displayedErrors.push(createListItem(text, index));
1146
1148
  });
1147
1149
  }
1148
- const errorsList = this.renderTemplate("errorsList", { errors: displayedErrors });
1149
- this.root.setAlert("danger", errorsList);
1150
+ const errorsList = this.renderTemplate('errorsList', { errors: displayedErrors });
1151
+ this.root.setAlert('danger', errorsList);
1150
1152
  if (triggerEvent) {
1151
- this.emit("error", errors);
1153
+ this.emit('error', errors);
1152
1154
  }
1153
1155
  return errors;
1154
1156
  }
1155
1157
  /* eslint-enable no-unused-vars */
1156
1158
  /**
1157
1159
  * Called when the submission has completed, or if the submission needs to be sent to an external library.
1158
- * @param {object} submission - The submission object.
1160
+ *
1161
+ * @param {Object} submission - The submission object.
1159
1162
  * @param {boolean} saved - Whether or not this submission was saved to the server.
1160
1163
  * @returns {object} - The submission object.
1161
1164
  */
@@ -1167,25 +1170,25 @@ class Webform extends NestedDataComponent_1.default {
1167
1170
  // We want to return the submitted submission and setValue will mutate the submission so cloneDeep it here.
1168
1171
  this.setValue((0, utils_1.fastCloneDeep)(submission), {
1169
1172
  noValidate: true,
1170
- noCheck: true,
1173
+ noCheck: true
1171
1174
  });
1172
- this.setAlert("success", `<p>${this.t("complete")}</p>`);
1175
+ this.setAlert('success', `<p>${this.t('complete')}</p>`);
1173
1176
  // Cancel triggered saveDraft to prevent overriding the submitted state
1174
1177
  if (this.draftEnabled && ((_a = this.triggerSaveDraft) === null || _a === void 0 ? void 0 : _a.cancel)) {
1175
1178
  this.triggerSaveDraft.cancel();
1176
1179
  }
1177
- this.emit("submit", submission, saved);
1180
+ this.emit('submit', submission, saved);
1178
1181
  if (saved) {
1179
- this.emit("submitDone", submission);
1182
+ this.emit('submitDone', submission);
1180
1183
  }
1181
1184
  return submission;
1182
1185
  }
1183
1186
  normalizeError(error) {
1184
1187
  if (error) {
1185
- if (typeof error === "object" && "details" in error) {
1188
+ if (typeof error === 'object' && 'details' in error) {
1186
1189
  error = error.details;
1187
1190
  }
1188
- if (typeof error === "string") {
1191
+ if (typeof error === 'string') {
1189
1192
  error = { message: error };
1190
1193
  }
1191
1194
  }
@@ -1193,17 +1196,17 @@ class Webform extends NestedDataComponent_1.default {
1193
1196
  }
1194
1197
  /**
1195
1198
  * Called when an error occurs during the submission.
1196
- * @param {object} error - The error that occured.
1197
- * @returns {Array} errors - All errors.
1199
+ *
1200
+ * @param {Object} error - The error that occured.
1198
1201
  */
1199
1202
  onSubmissionError(error) {
1200
1203
  error = this.normalizeError(error);
1201
1204
  this.submitting = false;
1202
1205
  this.setPristine(false);
1203
- this.emit("submitError", error || this.errors);
1206
+ this.emit('submitError', error || this.errors);
1204
1207
  // Allow for silent cancellations (no error message, no submit button error state)
1205
1208
  if (error && error.silent) {
1206
- this.emit("change", { isValid: true }, { silent: true });
1209
+ this.emit('change', { isValid: true }, { silent: true });
1207
1210
  return false;
1208
1211
  }
1209
1212
  const errors = this.showErrors(error, true);
@@ -1214,10 +1217,9 @@ class Webform extends NestedDataComponent_1.default {
1214
1217
  }
1215
1218
  /**
1216
1219
  * Trigger the change event for this form.
1217
- * @param {any} flags - The flags to set on this change event.
1218
- * @param {any} changed - The changed object which reflects the changes in the form.
1219
- * @param {boolean} modified - Whether or not the form has been modified.
1220
- * @param {any} changes - The changes that have occured in the form.
1220
+ *
1221
+ * @param changed
1222
+ * @param flags
1221
1223
  */
1222
1224
  onChange(flags, changed, modified, changes) {
1223
1225
  flags = flags || {};
@@ -1230,17 +1232,13 @@ class Webform extends NestedDataComponent_1.default {
1230
1232
  this.pristine = false;
1231
1233
  }
1232
1234
  this.checkData(value.data, flags);
1233
- const shouldValidate = !flags.noValidate ||
1234
- flags.fromIFrame ||
1235
- (flags.fromSubmission && this.rootPristine && this.pristine && flags.changed);
1236
- const errors = shouldValidate
1237
- ? this.validate(value.data, Object.assign(Object.assign({}, flags), { process: "change" }))
1238
- : [];
1235
+ const shouldValidate = !flags.noValidate || flags.fromIFrame || (flags.fromSubmission && this.rootPristine && this.pristine && flags.changed);
1236
+ const errors = shouldValidate ? this.validate(value.data, Object.assign(Object.assign({}, flags), { process: 'change' })) : [];
1239
1237
  value.isValid = errors.length === 0;
1240
1238
  this.loading = false;
1241
1239
  if (this.submitted) {
1242
1240
  // show server errors while they are not cleaned/fixed
1243
- const nonComponentServerErrors = lodash_1.default.filter(this.serverErrors || [], (err) => !err.component && !err.path);
1241
+ const nonComponentServerErrors = lodash_1.default.filter(this.serverErrors || [], err => !err.component && !err.path);
1244
1242
  this.showErrors(nonComponentServerErrors.length ? nonComponentServerErrors : errors);
1245
1243
  }
1246
1244
  // See if we need to save the draft of the form.
@@ -1248,39 +1246,38 @@ class Webform extends NestedDataComponent_1.default {
1248
1246
  this.triggerSaveDraft();
1249
1247
  }
1250
1248
  if (!flags || !flags.noEmit) {
1251
- this.emit("change", value, flags, modified);
1249
+ this.emit('change', value, flags, modified);
1252
1250
  isChangeEventEmitted = true;
1253
1251
  }
1254
1252
  // The form is initialized after the first change event occurs.
1255
1253
  if (isChangeEventEmitted && !this.initialized) {
1256
- this.emit("initialized");
1254
+ this.emit('initialized');
1257
1255
  this.initialized = true;
1258
1256
  }
1259
1257
  }
1260
1258
  /**
1261
1259
  * Send a delete request to the server.
1262
- * @returns {Promise} - The promise that is triggered when the delete is complete.
1263
1260
  */
1264
1261
  deleteSubmission() {
1265
- return this.formio.deleteSubmission().then(() => {
1266
- this.emit("submissionDeleted", this.submission);
1262
+ return this.formio.deleteSubmission()
1263
+ .then(() => {
1264
+ this.emit('submissionDeleted', this.submission);
1267
1265
  this.resetValue();
1268
1266
  });
1269
1267
  }
1270
1268
  /**
1271
1269
  * Cancels the submission.
1272
- * @param {boolean} noconfirm - Whether or not to confirm the cancellation.
1270
+ *
1273
1271
  * @alias reset
1274
- * @returns {boolean} - TRUE means the submission was cancelled, FALSE otherwise.
1275
1272
  */
1276
1273
  cancel(noconfirm) {
1277
- const shouldReset = this.hook("beforeCancel", true);
1278
- if (shouldReset && (noconfirm || confirm(this.t("confirmCancel")))) {
1274
+ const shouldReset = this.hook('beforeCancel', true);
1275
+ if (shouldReset && (noconfirm || confirm(this.t('confirmCancel')))) {
1279
1276
  this.resetValue();
1280
1277
  return true;
1281
1278
  }
1282
1279
  else {
1283
- this.emit("cancelSubmit");
1280
+ this.emit('cancelSubmit');
1284
1281
  return false;
1285
1282
  }
1286
1283
  }
@@ -1288,14 +1285,14 @@ class Webform extends NestedDataComponent_1.default {
1288
1285
  // Add in metadata about client submitting the form
1289
1286
  submission.metadata = submission.metadata || {};
1290
1287
  lodash_1.default.defaults(submission.metadata, {
1291
- timezone: lodash_1.default.get(this, "_submission.metadata.timezone", (0, utils_1.currentTimezone)()),
1292
- offset: parseInt(lodash_1.default.get(this, "_submission.metadata.offset", (0, moment_1.default)().utcOffset()), 10),
1288
+ timezone: lodash_1.default.get(this, '_submission.metadata.timezone', (0, utils_1.currentTimezone)()),
1289
+ offset: parseInt(lodash_1.default.get(this, '_submission.metadata.offset', (0, moment_1.default)().utcOffset()), 10),
1293
1290
  origin: document.location.origin,
1294
1291
  referrer: document.referrer,
1295
1292
  browserName: navigator.appName,
1296
1293
  userAgent: navigator.userAgent,
1297
1294
  pathName: window.location.pathname,
1298
- onLine: navigator.onLine,
1295
+ onLine: navigator.onLine
1299
1296
  });
1300
1297
  }
1301
1298
  submitForm(options = {}) {
@@ -1305,31 +1302,30 @@ class Webform extends NestedDataComponent_1.default {
1305
1302
  if (this.options.readOnly) {
1306
1303
  return resolve({
1307
1304
  submission: this.submission,
1308
- saved: false,
1305
+ saved: false
1309
1306
  });
1310
1307
  }
1311
1308
  const submission = (0, utils_1.fastCloneDeep)(this.submission || {});
1312
1309
  this.setMetadata(submission);
1313
- submission.state = options.state || submission.state || "submitted";
1314
- const isDraft = submission.state === "draft";
1315
- this.hook("beforeSubmit", Object.assign(Object.assign({}, submission), { component: options.component }), (err, data) => {
1310
+ submission.state = options.state || submission.state || 'submitted';
1311
+ const isDraft = (submission.state === 'draft');
1312
+ this.hook('beforeSubmit', Object.assign(Object.assign({}, submission), { component: options.component }), (err, data) => {
1316
1313
  var _a;
1317
1314
  if (err) {
1318
1315
  return reject(err);
1319
1316
  }
1320
- submission._vnote = data && data._vnote ? data._vnote : "";
1317
+ submission._vnote = data && data._vnote ? data._vnote : '';
1321
1318
  try {
1322
1319
  if (!isDraft && !options.noValidate) {
1323
1320
  if (!submission.data) {
1324
- return reject("Invalid Submission");
1321
+ return reject('Invalid Submission');
1325
1322
  }
1326
1323
  const errors = this.validate(submission.data, {
1327
1324
  dirty: true,
1328
1325
  silentCheck: false,
1329
- process: "submit",
1326
+ process: 'submit'
1330
1327
  });
1331
- if (errors.length ||
1332
- ((_a = options.beforeSubmitResults) === null || _a === void 0 ? void 0 : _a.some((result) => result.status === "rejected"))) {
1328
+ if (errors.length || ((_a = options.beforeSubmitResults) === null || _a === void 0 ? void 0 : _a.some((result) => result.status === 'rejected'))) {
1333
1329
  return reject(errors);
1334
1330
  }
1335
1331
  }
@@ -1338,20 +1334,20 @@ class Webform extends NestedDataComponent_1.default {
1338
1334
  console.error(err);
1339
1335
  }
1340
1336
  this.everyComponent((comp) => {
1341
- if (submission._vnote && comp.type === "form" && comp.component.reference) {
1337
+ if (submission._vnote && comp.type === 'form' && comp.component.reference) {
1342
1338
  lodash_1.default.get(submission.data, comp.path, {})._vnote = submission._vnote;
1343
1339
  }
1344
1340
  const { persistent } = comp.component;
1345
- if (persistent === "client-only") {
1341
+ if (persistent === 'client-only') {
1346
1342
  lodash_1.default.unset(submission.data, comp.path);
1347
1343
  }
1348
1344
  });
1349
- this.hook("customValidation", Object.assign(Object.assign({}, submission), { component: options.component }), (err) => {
1345
+ this.hook('customValidation', Object.assign(Object.assign({}, submission), { component: options.component }), (err) => {
1350
1346
  if (err) {
1351
1347
  // If string is returned, cast to object.
1352
- if (typeof err === "string") {
1348
+ if (typeof err === 'string') {
1353
1349
  err = {
1354
- message: err,
1350
+ message: err
1355
1351
  };
1356
1352
  }
1357
1353
  // Ensure err is an array.
@@ -1361,10 +1357,7 @@ class Webform extends NestedDataComponent_1.default {
1361
1357
  this.loading = true;
1362
1358
  // Use the form action to submit the form if available.
1363
1359
  if (this._form && this._form.action) {
1364
- const method = submission.data._id &&
1365
- this._form.action.includes(submission.data._id)
1366
- ? "PUT"
1367
- : "POST";
1360
+ const method = (submission.data._id && this._form.action.includes(submission.data._id)) ? 'PUT' : 'POST';
1368
1361
  return Formio_1.Formio.makeStaticRequest(this._form.action, method, submission, this.formio ? this.formio.options : {})
1369
1362
  .then((result) => resolve({
1370
1363
  submission: result,
@@ -1383,9 +1376,7 @@ class Webform extends NestedDataComponent_1.default {
1383
1376
  });
1384
1377
  }
1385
1378
  // If this is an actionUrl, then make sure to save the action and not the submission.
1386
- const submitMethod = submitFormio.actionUrl
1387
- ? "saveAction"
1388
- : "saveSubmission";
1379
+ const submitMethod = submitFormio.actionUrl ? 'saveAction' : 'saveSubmission';
1389
1380
  submitFormio[submitMethod](submission)
1390
1381
  .then((result) => resolve({
1391
1382
  submission: result,
@@ -1401,15 +1392,13 @@ class Webform extends NestedDataComponent_1.default {
1401
1392
  }
1402
1393
  setServerErrors(error) {
1403
1394
  if (error.details) {
1404
- this.serverErrors = error.details
1405
- .filter((err) => (err.level ? err.level === "error" : err))
1406
- .map((err) => {
1395
+ this.serverErrors = error.details.filter((err) => err.level ? err.level === 'error' : err).map((err) => {
1407
1396
  err.fromServer = true;
1408
1397
  return err;
1409
1398
  });
1410
1399
  }
1411
- else if (typeof error === "string") {
1412
- this.serverErrors = [{ fromServer: true, level: "error", message: error }];
1400
+ else if (typeof error === 'string') {
1401
+ this.serverErrors = [{ fromServer: true, level: 'error', message: error }];
1413
1402
  }
1414
1403
  }
1415
1404
  executeSubmit(options) {
@@ -1441,6 +1430,7 @@ class Webform extends NestedDataComponent_1.default {
1441
1430
  }
1442
1431
  /**
1443
1432
  * Submits the form.
1433
+ *
1444
1434
  * @example
1445
1435
  * import Webform from '@formio/js/Webform';
1446
1436
  * let form = new Webform(document.getElementById('formio'));
@@ -1453,11 +1443,12 @@ class Webform extends NestedDataComponent_1.default {
1453
1443
  * form.submit().then((submission) => {
1454
1444
  * console.log(submission);
1455
1445
  * });
1446
+ *
1456
1447
  * @param {boolean} before - If this submission occured from the before handlers.
1457
- * @param {any} options - The options to use when submitting this form.
1448
+ *
1458
1449
  * @returns {Promise} - A promise when the form is done submitting.
1459
1450
  */
1460
- submit(before = false, options = {}) {
1451
+ submit(before, options = {}) {
1461
1452
  this.submissionInProcess = true;
1462
1453
  if (!before) {
1463
1454
  return this.beforeSubmit(options).then(() => this.executeSubmit(options));
@@ -1468,41 +1459,37 @@ class Webform extends NestedDataComponent_1.default {
1468
1459
  }
1469
1460
  submitUrl(URL, headers) {
1470
1461
  if (!URL) {
1471
- return console.warn("Missing URL argument");
1462
+ return console.warn('Missing URL argument');
1472
1463
  }
1473
1464
  const submission = this.submission || {};
1474
1465
  const API_URL = URL;
1475
1466
  const settings = {
1476
- method: "POST",
1477
- headers: {},
1467
+ method: 'POST',
1468
+ headers: {}
1478
1469
  };
1479
1470
  if (headers && headers.length > 0) {
1480
1471
  headers.map((e) => {
1481
- if (e.header !== "" && e.value !== "") {
1472
+ if (e.header !== '' && e.value !== '') {
1482
1473
  settings.headers[e.header] = this.interpolate(e.value, submission);
1483
1474
  }
1484
1475
  });
1485
1476
  }
1486
1477
  if (API_URL && settings) {
1487
- Formio_1.Formio.makeStaticRequest(API_URL, settings.method, submission, {
1488
- headers: settings.headers,
1489
- })
1490
- .then(() => {
1491
- this.emit("requestDone");
1492
- this.setAlert("success", "<p> Success </p>");
1493
- })
1494
- .catch((e) => {
1495
- const message = `${e.statusText ? e.statusText : ""} ${e.status ? e.status : e}`;
1496
- this.emit("error", message);
1478
+ Formio_1.Formio.makeStaticRequest(API_URL, settings.method, submission, { headers: settings.headers }).then(() => {
1479
+ this.emit('requestDone');
1480
+ this.setAlert('success', '<p> Success </p>');
1481
+ }).catch((e) => {
1482
+ const message = `${e.statusText ? e.statusText : ''} ${e.status ? e.status : e}`;
1483
+ this.emit('error', message);
1497
1484
  console.error(message);
1498
- this.setAlert("danger", `<p> ${message} </p>`);
1485
+ this.setAlert('danger', `<p> ${message} </p>`);
1499
1486
  return Promise.reject(this.onSubmissionError(e));
1500
1487
  });
1501
1488
  }
1502
1489
  else {
1503
- this.emit("error", "You should add a URL to this button.");
1504
- this.setAlert("warning", "You should add a URL to this button.");
1505
- return console.warn("You should add a URL to this button.");
1490
+ this.emit('error', 'You should add a URL to this button.');
1491
+ this.setAlert('warning', 'You should add a URL to this button.');
1492
+ return console.warn('You should add a URL to this button.');
1506
1493
  }
1507
1494
  }
1508
1495
  triggerCaptcha() {
@@ -1521,7 +1508,7 @@ class Webform extends NestedDataComponent_1.default {
1521
1508
  }
1522
1509
  set nosubmit(value) {
1523
1510
  this._nosubmit = !!value;
1524
- this.emit("nosubmit", this._nosubmit);
1511
+ this.emit('nosubmit', this._nosubmit);
1525
1512
  }
1526
1513
  get nosubmit() {
1527
1514
  return this._nosubmit || false;