@formio/js 5.0.0-rc.19 → 5.0.0-rc.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (370) hide show
  1. package/README.md +1 -1
  2. package/dist/formio.builder.css +14 -22
  3. package/dist/formio.builder.min.css +1 -1
  4. package/dist/formio.embed.css +1 -40
  5. package/dist/formio.embed.js +2 -90
  6. package/dist/formio.embed.min.css +1 -1
  7. package/dist/formio.embed.min.js +1 -1
  8. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  9. package/dist/formio.form.css +10 -2
  10. package/dist/formio.form.js +1267 -1103
  11. package/dist/formio.form.min.css +1 -1
  12. package/dist/formio.form.min.js +1 -1
  13. package/dist/formio.form.min.js.LICENSE.txt +3 -8
  14. package/dist/formio.full.css +14 -22
  15. package/dist/formio.full.js +1302 -1127
  16. package/dist/formio.full.min.css +1 -1
  17. package/dist/formio.full.min.js +1 -1
  18. package/dist/formio.full.min.js.LICENSE.txt +3 -8
  19. package/dist/formio.js +713 -626
  20. package/dist/formio.min.js +1 -1
  21. package/dist/formio.min.js.LICENSE.txt +2 -7
  22. package/dist/formio.utils.js +220 -13
  23. package/dist/formio.utils.min.js +1 -1
  24. package/dist/formio.utils.min.js.LICENSE.txt +2 -7
  25. package/lib/cjs/CDN.d.ts +1 -0
  26. package/lib/cjs/CDN.js +2 -1
  27. package/lib/cjs/Element.js +7 -2
  28. package/lib/cjs/Embed.d.ts +21 -1
  29. package/lib/cjs/Embed.js +211 -308
  30. package/lib/cjs/Form.d.ts +9 -6
  31. package/lib/cjs/Form.js +53 -11
  32. package/lib/cjs/PDF.d.ts +11 -3
  33. package/lib/cjs/PDF.js +4 -5
  34. package/lib/cjs/PDFBuilder.js +2 -3
  35. package/lib/cjs/Webform.d.ts +10 -13
  36. package/lib/cjs/Webform.js +46 -125
  37. package/lib/cjs/WebformBuilder.d.ts +6 -1
  38. package/lib/cjs/WebformBuilder.js +105 -65
  39. package/lib/cjs/Wizard.d.ts +8 -5
  40. package/lib/cjs/Wizard.js +12 -12
  41. package/lib/cjs/WizardBuilder.d.ts +6 -4
  42. package/lib/cjs/WizardBuilder.js +20 -3
  43. package/lib/cjs/addons/FormioAddon.d.ts +1 -1
  44. package/lib/cjs/addons/FormioAddon.js +1 -2
  45. package/lib/cjs/components/_classes/component/Component.d.ts +24 -8
  46. package/lib/cjs/components/_classes/component/Component.js +44 -14
  47. package/lib/cjs/components/_classes/input/Input.d.ts +1 -1
  48. package/lib/cjs/components/_classes/input/Input.js +1 -2
  49. package/lib/cjs/components/_classes/list/ListComponent.d.ts +4 -0
  50. package/lib/cjs/components/_classes/list/ListComponent.js +43 -6
  51. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +1 -0
  52. package/lib/cjs/components/_classes/multivalue/Multivalue.js +10 -4
  53. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +5 -2
  54. package/lib/cjs/components/_classes/nested/NestedComponent.js +9 -10
  55. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -0
  56. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +4 -0
  57. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
  58. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +4 -0
  59. package/lib/cjs/components/address/Address.d.ts +8 -0
  60. package/lib/cjs/components/address/Address.js +5 -0
  61. package/lib/cjs/components/button/Button.d.ts +1 -0
  62. package/lib/cjs/components/button/Button.js +5 -3
  63. package/lib/cjs/components/checkbox/Checkbox.d.ts +41 -0
  64. package/lib/cjs/components/checkbox/Checkbox.js +32 -5
  65. package/lib/cjs/components/columns/Columns.d.ts +2 -0
  66. package/lib/cjs/components/columns/Columns.js +4 -0
  67. package/lib/cjs/components/container/Container.d.ts +1 -0
  68. package/lib/cjs/components/container/Container.js +4 -0
  69. package/lib/cjs/components/content/Content.d.ts +2 -0
  70. package/lib/cjs/components/content/Content.js +4 -2
  71. package/lib/cjs/components/currency/editForm/Currency.edit.data.d.ts +14 -2
  72. package/lib/cjs/components/currency/editForm/Currency.edit.data.js +4 -0
  73. package/lib/cjs/components/currency/editForm/Currency.edit.display.js +4 -0
  74. package/lib/cjs/components/datagrid/DataGrid.d.ts +1 -0
  75. package/lib/cjs/components/datagrid/DataGrid.js +8 -1
  76. package/lib/cjs/components/datamap/DataMap.d.ts +1 -0
  77. package/lib/cjs/components/datamap/DataMap.js +4 -0
  78. package/lib/cjs/components/datetime/DateTime.d.ts +23 -0
  79. package/lib/cjs/components/datetime/DateTime.js +20 -1
  80. package/lib/cjs/components/day/Day.d.ts +22 -1
  81. package/lib/cjs/components/day/Day.js +20 -6
  82. package/lib/cjs/components/day/fixtures/comp3.js +2 -2
  83. package/lib/cjs/components/editgrid/EditGrid.d.ts +4 -3
  84. package/lib/cjs/components/editgrid/EditGrid.js +11 -6
  85. package/lib/cjs/components/editgrid/fixtures/comp-with-custom-default-value.d.ts +190 -0
  86. package/lib/cjs/components/editgrid/fixtures/comp-with-custom-default-value.js +227 -0
  87. package/lib/cjs/components/editgrid/fixtures/comp15.d.ts +54 -0
  88. package/lib/cjs/components/editgrid/fixtures/comp15.js +51 -0
  89. package/lib/cjs/components/editgrid/fixtures/index.d.ts +3 -1
  90. package/lib/cjs/components/editgrid/fixtures/index.js +5 -1
  91. package/lib/cjs/components/fieldset/Fieldset.d.ts +2 -0
  92. package/lib/cjs/components/fieldset/Fieldset.js +4 -0
  93. package/lib/cjs/components/file/File.d.ts +28 -6
  94. package/lib/cjs/components/file/File.js +40 -15
  95. package/lib/cjs/components/file/editForm/File.edit.file.d.ts +62 -0
  96. package/lib/cjs/components/file/editForm/File.edit.file.js +29 -2
  97. package/lib/cjs/components/form/Form.d.ts +4 -0
  98. package/lib/cjs/components/form/Form.js +12 -10
  99. package/lib/cjs/components/hidden/Hidden.d.ts +1 -0
  100. package/lib/cjs/components/hidden/Hidden.js +1 -0
  101. package/lib/cjs/components/html/HTML.d.ts +2 -0
  102. package/lib/cjs/components/html/HTML.js +4 -0
  103. package/lib/cjs/components/number/Number.d.ts +24 -1
  104. package/lib/cjs/components/number/Number.js +18 -6
  105. package/lib/cjs/components/panel/Panel.d.ts +1 -0
  106. package/lib/cjs/components/panel/Panel.js +3 -0
  107. package/lib/cjs/components/phonenumber/PhoneNumber.form.js +9 -0
  108. package/lib/cjs/components/radio/Radio.d.ts +24 -3
  109. package/lib/cjs/components/radio/Radio.js +89 -18
  110. package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +2 -1
  111. package/lib/cjs/components/recaptcha/ReCaptcha.js +7 -5
  112. package/lib/cjs/components/resource/Resource.d.ts +7 -0
  113. package/lib/cjs/components/resource/Resource.js +0 -1
  114. package/lib/cjs/components/resource/editForm/Resource.edit.display.js +1 -1
  115. package/lib/cjs/components/select/Select.d.ts +25 -5
  116. package/lib/cjs/components/select/Select.js +51 -51
  117. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +37 -0
  118. package/lib/cjs/components/selectboxes/SelectBoxes.js +60 -25
  119. package/lib/cjs/components/selectboxes/fixtures/comp4.d.ts +30 -27
  120. package/lib/cjs/components/selectboxes/fixtures/comp4.js +47 -32
  121. package/lib/cjs/components/selectboxes/fixtures/comp6.d.ts +14 -0
  122. package/lib/cjs/components/selectboxes/fixtures/comp6.js +15 -0
  123. package/lib/cjs/components/selectboxes/fixtures/index.d.ts +2 -1
  124. package/lib/cjs/components/selectboxes/fixtures/index.js +3 -1
  125. package/lib/cjs/components/signature/Signature.d.ts +22 -1
  126. package/lib/cjs/components/signature/Signature.js +16 -3
  127. package/lib/cjs/components/survey/Survey.d.ts +21 -0
  128. package/lib/cjs/components/survey/Survey.js +9 -0
  129. package/lib/cjs/components/table/Table.d.ts +2 -0
  130. package/lib/cjs/components/table/Table.js +4 -0
  131. package/lib/cjs/components/tabs/Tabs.d.ts +2 -0
  132. package/lib/cjs/components/tabs/Tabs.js +4 -0
  133. package/lib/cjs/components/tags/Tags.d.ts +21 -0
  134. package/lib/cjs/components/tags/Tags.js +11 -0
  135. package/lib/cjs/components/textarea/TextArea.d.ts +3 -2
  136. package/lib/cjs/components/textarea/TextArea.js +4 -5
  137. package/lib/cjs/components/textarea/fixtures/comp4.d.ts +30 -0
  138. package/lib/cjs/components/textarea/fixtures/comp4.js +27 -0
  139. package/lib/cjs/components/textarea/fixtures/index.d.ts +2 -1
  140. package/lib/cjs/components/textarea/fixtures/index.js +3 -1
  141. package/lib/cjs/components/textfield/TextField.d.ts +22 -0
  142. package/lib/cjs/components/textfield/TextField.js +11 -3
  143. package/lib/cjs/components/time/Time.d.ts +11 -0
  144. package/lib/cjs/components/time/Time.js +6 -1
  145. package/lib/cjs/components/tree/Tree.d.ts +5 -4
  146. package/lib/cjs/components/tree/Tree.form.js +5 -0
  147. package/lib/cjs/components/tree/Tree.js +8 -9
  148. package/lib/cjs/components/tree/editForm/Tree.edit.display.d.ts +9 -0
  149. package/lib/cjs/components/tree/editForm/Tree.edit.display.js +12 -0
  150. package/lib/cjs/components/well/Well.d.ts +2 -0
  151. package/lib/cjs/components/well/Well.js +4 -0
  152. package/lib/cjs/formio.embed.d.ts +2 -1
  153. package/lib/cjs/formio.embed.js +96 -1
  154. package/lib/cjs/formio.form.d.ts +4 -3
  155. package/lib/cjs/formio.form.js +17 -8
  156. package/lib/cjs/licenses/Licenses.d.ts +7 -0
  157. package/lib/cjs/licenses/Licenses.js +22 -0
  158. package/lib/cjs/licenses/index.d.ts +2 -0
  159. package/lib/cjs/licenses/index.js +7 -0
  160. package/lib/cjs/providers/Providers.d.ts +31 -11
  161. package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +2 -2
  162. package/lib/cjs/providers/address/GoogleAddressProvider.js +2 -3
  163. package/lib/cjs/providers/processor/fileProcessor.d.ts +1 -1
  164. package/lib/cjs/providers/processor/fileProcessor.js +1 -5
  165. package/lib/cjs/providers/storage/azure.d.ts +10 -1
  166. package/lib/cjs/providers/storage/azure.js +7 -2
  167. package/lib/cjs/providers/storage/base64.d.ts +2 -2
  168. package/lib/cjs/providers/storage/base64.js +2 -6
  169. package/lib/cjs/providers/storage/dropbox.d.ts +2 -2
  170. package/lib/cjs/providers/storage/dropbox.js +2 -6
  171. package/lib/cjs/providers/storage/googleDrive.d.ts +3 -2
  172. package/lib/cjs/providers/storage/googleDrive.js +6 -6
  173. package/lib/cjs/providers/storage/indexeddb.d.ts +3 -3
  174. package/lib/cjs/providers/storage/indexeddb.js +9 -13
  175. package/lib/cjs/providers/storage/s3.d.ts +11 -1
  176. package/lib/cjs/providers/storage/s3.js +5 -2
  177. package/lib/cjs/providers/storage/uploadAdapter.js +1 -5
  178. package/lib/cjs/providers/storage/url.d.ts +2 -2
  179. package/lib/cjs/providers/storage/url.js +12 -8
  180. package/lib/cjs/providers/storage/xhr.d.ts +1 -1
  181. package/lib/cjs/providers/storage/xhr.js +1 -2
  182. package/lib/cjs/templates/index.d.ts +226 -1
  183. package/lib/cjs/utils/Evaluator.js +4 -33
  184. package/lib/cjs/utils/i18n.d.ts +16 -0
  185. package/lib/cjs/utils/i18n.js +88 -0
  186. package/lib/cjs/utils/utils.d.ts +11 -1
  187. package/lib/cjs/utils/utils.js +29 -10
  188. package/lib/cjs/validator/Validator.d.ts +30 -2
  189. package/lib/cjs/validator/Validator.js +32 -9
  190. package/lib/cjs/validator/rules/Select.js +1 -2
  191. package/lib/cjs/validator/rules/Unique.d.ts +1 -1
  192. package/lib/cjs/validator/rules/Unique.js +1 -2
  193. package/lib/cjs/widgets/CalendarWidget.d.ts +1 -0
  194. package/lib/cjs/widgets/InputWidget.d.ts +1 -1
  195. package/lib/cjs/widgets/InputWidget.js +1 -2
  196. package/lib/mjs/CDN.d.ts +1 -0
  197. package/lib/mjs/CDN.js +2 -1
  198. package/lib/mjs/Element.js +6 -2
  199. package/lib/mjs/Embed.d.ts +21 -1
  200. package/lib/mjs/Embed.js +208 -319
  201. package/lib/mjs/Form.d.ts +9 -6
  202. package/lib/mjs/Form.js +53 -11
  203. package/lib/mjs/PDF.d.ts +11 -3
  204. package/lib/mjs/PDF.js +4 -5
  205. package/lib/mjs/PDFBuilder.js +2 -3
  206. package/lib/mjs/Webform.d.ts +10 -13
  207. package/lib/mjs/Webform.js +46 -128
  208. package/lib/mjs/WebformBuilder.d.ts +6 -1
  209. package/lib/mjs/WebformBuilder.js +103 -65
  210. package/lib/mjs/Wizard.d.ts +8 -5
  211. package/lib/mjs/Wizard.js +12 -12
  212. package/lib/mjs/WizardBuilder.d.ts +6 -4
  213. package/lib/mjs/WizardBuilder.js +20 -3
  214. package/lib/mjs/addons/FormioAddon.d.ts +1 -1
  215. package/lib/mjs/addons/FormioAddon.js +1 -2
  216. package/lib/mjs/components/_classes/component/Component.d.ts +24 -8
  217. package/lib/mjs/components/_classes/component/Component.js +44 -14
  218. package/lib/mjs/components/_classes/input/Input.d.ts +1 -1
  219. package/lib/mjs/components/_classes/input/Input.js +1 -2
  220. package/lib/mjs/components/_classes/list/ListComponent.d.ts +4 -0
  221. package/lib/mjs/components/_classes/list/ListComponent.js +43 -5
  222. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +1 -0
  223. package/lib/mjs/components/_classes/multivalue/Multivalue.js +10 -4
  224. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +5 -2
  225. package/lib/mjs/components/_classes/nested/NestedComponent.js +9 -10
  226. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -0
  227. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +4 -0
  228. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
  229. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +4 -0
  230. package/lib/mjs/components/address/Address.d.ts +8 -0
  231. package/lib/mjs/components/address/Address.js +5 -0
  232. package/lib/mjs/components/button/Button.d.ts +1 -0
  233. package/lib/mjs/components/button/Button.js +6 -4
  234. package/lib/mjs/components/checkbox/Checkbox.d.ts +41 -0
  235. package/lib/mjs/components/checkbox/Checkbox.js +36 -5
  236. package/lib/mjs/components/columns/Columns.d.ts +2 -0
  237. package/lib/mjs/components/columns/Columns.js +4 -0
  238. package/lib/mjs/components/container/Container.d.ts +1 -0
  239. package/lib/mjs/components/container/Container.js +5 -1
  240. package/lib/mjs/components/content/Content.d.ts +2 -0
  241. package/lib/mjs/components/content/Content.js +4 -2
  242. package/lib/mjs/components/currency/editForm/Currency.edit.data.d.ts +14 -2
  243. package/lib/mjs/components/currency/editForm/Currency.edit.data.js +4 -0
  244. package/lib/mjs/components/currency/editForm/Currency.edit.display.js +4 -0
  245. package/lib/mjs/components/datagrid/DataGrid.d.ts +1 -0
  246. package/lib/mjs/components/datagrid/DataGrid.js +8 -1
  247. package/lib/mjs/components/datamap/DataMap.d.ts +1 -0
  248. package/lib/mjs/components/datamap/DataMap.js +5 -1
  249. package/lib/mjs/components/datetime/DateTime.d.ts +23 -0
  250. package/lib/mjs/components/datetime/DateTime.js +27 -1
  251. package/lib/mjs/components/day/Day.d.ts +22 -1
  252. package/lib/mjs/components/day/Day.js +24 -7
  253. package/lib/mjs/components/day/fixtures/comp3.js +2 -2
  254. package/lib/mjs/components/editgrid/EditGrid.d.ts +4 -3
  255. package/lib/mjs/components/editgrid/EditGrid.js +11 -6
  256. package/lib/mjs/components/editgrid/fixtures/comp-with-custom-default-value.d.ts +190 -0
  257. package/lib/mjs/components/editgrid/fixtures/comp-with-custom-default-value.js +225 -0
  258. package/lib/mjs/components/editgrid/fixtures/comp15.d.ts +54 -0
  259. package/lib/mjs/components/editgrid/fixtures/comp15.js +49 -0
  260. package/lib/mjs/components/editgrid/fixtures/index.d.ts +3 -1
  261. package/lib/mjs/components/editgrid/fixtures/index.js +3 -1
  262. package/lib/mjs/components/fieldset/Fieldset.d.ts +2 -0
  263. package/lib/mjs/components/fieldset/Fieldset.js +4 -0
  264. package/lib/mjs/components/file/File.d.ts +28 -6
  265. package/lib/mjs/components/file/File.js +44 -16
  266. package/lib/mjs/components/file/editForm/File.edit.file.d.ts +62 -0
  267. package/lib/mjs/components/file/editForm/File.edit.file.js +29 -2
  268. package/lib/mjs/components/form/Form.d.ts +4 -0
  269. package/lib/mjs/components/form/Form.js +13 -11
  270. package/lib/mjs/components/hidden/Hidden.d.ts +1 -0
  271. package/lib/mjs/components/hidden/Hidden.js +1 -0
  272. package/lib/mjs/components/html/HTML.d.ts +2 -0
  273. package/lib/mjs/components/html/HTML.js +4 -0
  274. package/lib/mjs/components/number/Number.d.ts +24 -1
  275. package/lib/mjs/components/number/Number.js +23 -7
  276. package/lib/mjs/components/panel/Panel.d.ts +1 -0
  277. package/lib/mjs/components/panel/Panel.js +3 -0
  278. package/lib/mjs/components/phonenumber/PhoneNumber.form.js +9 -0
  279. package/lib/mjs/components/radio/Radio.d.ts +24 -3
  280. package/lib/mjs/components/radio/Radio.js +93 -19
  281. package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +2 -1
  282. package/lib/mjs/components/recaptcha/ReCaptcha.js +7 -5
  283. package/lib/mjs/components/resource/Resource.d.ts +7 -0
  284. package/lib/mjs/components/resource/Resource.js +0 -1
  285. package/lib/mjs/components/resource/editForm/Resource.edit.display.js +1 -1
  286. package/lib/mjs/components/select/Select.d.ts +25 -5
  287. package/lib/mjs/components/select/Select.js +55 -52
  288. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +37 -0
  289. package/lib/mjs/components/selectboxes/SelectBoxes.js +63 -25
  290. package/lib/mjs/components/selectboxes/fixtures/comp4.d.ts +30 -27
  291. package/lib/mjs/components/selectboxes/fixtures/comp4.js +47 -32
  292. package/lib/mjs/components/selectboxes/fixtures/comp6.d.ts +14 -0
  293. package/lib/mjs/components/selectboxes/fixtures/comp6.js +13 -0
  294. package/lib/mjs/components/selectboxes/fixtures/index.d.ts +2 -1
  295. package/lib/mjs/components/selectboxes/fixtures/index.js +2 -1
  296. package/lib/mjs/components/signature/Signature.d.ts +22 -1
  297. package/lib/mjs/components/signature/Signature.js +19 -3
  298. package/lib/mjs/components/survey/Survey.d.ts +21 -0
  299. package/lib/mjs/components/survey/Survey.js +13 -1
  300. package/lib/mjs/components/table/Table.d.ts +2 -0
  301. package/lib/mjs/components/table/Table.js +4 -0
  302. package/lib/mjs/components/tabs/Tabs.d.ts +2 -0
  303. package/lib/mjs/components/tabs/Tabs.js +4 -0
  304. package/lib/mjs/components/tags/Tags.d.ts +21 -0
  305. package/lib/mjs/components/tags/Tags.js +14 -0
  306. package/lib/mjs/components/textarea/TextArea.d.ts +3 -2
  307. package/lib/mjs/components/textarea/TextArea.js +4 -5
  308. package/lib/mjs/components/textarea/fixtures/comp4.d.ts +30 -0
  309. package/lib/mjs/components/textarea/fixtures/comp4.js +25 -0
  310. package/lib/mjs/components/textarea/fixtures/index.d.ts +2 -1
  311. package/lib/mjs/components/textarea/fixtures/index.js +2 -1
  312. package/lib/mjs/components/textfield/TextField.d.ts +22 -0
  313. package/lib/mjs/components/textfield/TextField.js +14 -3
  314. package/lib/mjs/components/time/Time.d.ts +11 -0
  315. package/lib/mjs/components/time/Time.js +12 -1
  316. package/lib/mjs/components/tree/Tree.d.ts +5 -4
  317. package/lib/mjs/components/tree/Tree.form.js +5 -0
  318. package/lib/mjs/components/tree/Tree.js +8 -9
  319. package/lib/mjs/components/tree/editForm/Tree.edit.display.d.ts +9 -0
  320. package/lib/mjs/components/tree/editForm/Tree.edit.display.js +10 -0
  321. package/lib/mjs/components/well/Well.d.ts +2 -0
  322. package/lib/mjs/components/well/Well.js +4 -0
  323. package/lib/mjs/formio.embed.d.ts +2 -1
  324. package/lib/mjs/formio.embed.js +96 -2
  325. package/lib/mjs/formio.form.d.ts +4 -3
  326. package/lib/mjs/formio.form.js +16 -8
  327. package/lib/mjs/licenses/Licenses.d.ts +7 -0
  328. package/lib/mjs/licenses/Licenses.js +17 -0
  329. package/lib/mjs/licenses/index.d.ts +2 -0
  330. package/lib/mjs/licenses/index.js +2 -0
  331. package/lib/mjs/providers/Providers.d.ts +31 -11
  332. package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +2 -2
  333. package/lib/mjs/providers/address/GoogleAddressProvider.js +2 -3
  334. package/lib/mjs/providers/processor/fileProcessor.d.ts +1 -1
  335. package/lib/mjs/providers/processor/fileProcessor.js +1 -2
  336. package/lib/mjs/providers/storage/azure.d.ts +10 -1
  337. package/lib/mjs/providers/storage/azure.js +7 -2
  338. package/lib/mjs/providers/storage/base64.d.ts +2 -2
  339. package/lib/mjs/providers/storage/base64.js +2 -3
  340. package/lib/mjs/providers/storage/dropbox.d.ts +2 -2
  341. package/lib/mjs/providers/storage/dropbox.js +2 -3
  342. package/lib/mjs/providers/storage/googleDrive.d.ts +3 -2
  343. package/lib/mjs/providers/storage/googleDrive.js +6 -3
  344. package/lib/mjs/providers/storage/indexeddb.d.ts +3 -3
  345. package/lib/mjs/providers/storage/indexeddb.js +9 -10
  346. package/lib/mjs/providers/storage/s3.d.ts +11 -1
  347. package/lib/mjs/providers/storage/s3.js +5 -2
  348. package/lib/mjs/providers/storage/uploadAdapter.js +1 -2
  349. package/lib/mjs/providers/storage/url.d.ts +2 -2
  350. package/lib/mjs/providers/storage/url.js +12 -5
  351. package/lib/mjs/providers/storage/xhr.d.ts +1 -1
  352. package/lib/mjs/providers/storage/xhr.js +1 -2
  353. package/lib/mjs/templates/index.d.ts +226 -1
  354. package/lib/mjs/utils/Evaluator.js +4 -33
  355. package/lib/mjs/utils/i18n.d.ts +16 -0
  356. package/lib/mjs/utils/i18n.js +81 -0
  357. package/lib/mjs/utils/utils.d.ts +11 -1
  358. package/lib/mjs/utils/utils.js +27 -9
  359. package/lib/mjs/validator/Validator.d.ts +30 -2
  360. package/lib/mjs/validator/Validator.js +31 -9
  361. package/lib/mjs/validator/rules/Select.js +1 -2
  362. package/lib/mjs/validator/rules/Unique.d.ts +1 -1
  363. package/lib/mjs/validator/rules/Unique.js +1 -2
  364. package/lib/mjs/widgets/CalendarWidget.d.ts +1 -0
  365. package/lib/mjs/widgets/InputWidget.d.ts +1 -1
  366. package/lib/mjs/widgets/InputWidget.js +1 -2
  367. package/package.json +18 -15
  368. package/types/index.d.ts +1 -0
  369. package/types/licenses.d.ts +7 -0
  370. package/types/utils.d.ts +2 -0
package/lib/cjs/Form.js CHANGED
@@ -31,7 +31,6 @@ const Formio_1 = require("./Formio");
31
31
  const displays_1 = __importDefault(require("./displays"));
32
32
  const templates_1 = __importDefault(require("./templates"));
33
33
  const FormioUtils = __importStar(require("./utils/utils"));
34
- const native_promise_only_1 = __importDefault(require("native-promise-only"));
35
34
  class Form extends Element_1.default {
36
35
  /**
37
36
  * Creates an easy to use interface for embedding webforms, pdfs, and wizards into your application.
@@ -45,7 +44,7 @@ class Form extends Element_1.default {
45
44
  * @param {boolean} options.template - Provides a way to inject custom logic into the creation of every element rendered within the form.
46
45
  *
47
46
  * @example
48
- * import Form from 'formiojs/Form';
47
+ * import Form from '@formio/js/Form';
49
48
  * const form = new Form(document.getElementById('formio'), 'https://examples.form.io/example');
50
49
  * form.build();
51
50
  */
@@ -58,7 +57,7 @@ class Form extends Element_1.default {
58
57
  if (this.options.useSessionToken) {
59
58
  Formio_1.Formio.useSessionToken(this.options);
60
59
  }
61
- this.ready = new native_promise_only_1.default((resolve, reject) => {
60
+ this.ready = new Promise((resolve, reject) => {
62
61
  this.readyResolve = resolve;
63
62
  this.readyReject = reject;
64
63
  });
@@ -89,6 +88,47 @@ class Form extends Element_1.default {
89
88
  }
90
89
  this.display = '';
91
90
  }
91
+ createElement(tag, attrs, children) {
92
+ const element = document.createElement(tag);
93
+ for (const attr in attrs) {
94
+ if (attrs.hasOwnProperty(attr)) {
95
+ element.setAttribute(attr, attrs[attr]);
96
+ }
97
+ }
98
+ (children || []).forEach(child => {
99
+ element.appendChild(this.createElement(child.tag, child.attrs, child.children));
100
+ });
101
+ return element;
102
+ }
103
+ set loading(load) {
104
+ if (!this.element || this.options.noLoader) {
105
+ return;
106
+ }
107
+ if (load) {
108
+ if (this.loader) {
109
+ return;
110
+ }
111
+ this.loader = this.createElement('div', {
112
+ 'class': 'formio-loader'
113
+ }, [{
114
+ tag: 'div',
115
+ attrs: {
116
+ class: 'loader-wrapper'
117
+ },
118
+ children: [{
119
+ tag: 'div',
120
+ attrs: {
121
+ class: 'loader text-center'
122
+ }
123
+ }]
124
+ }]);
125
+ this.element.appendChild(this.loader);
126
+ }
127
+ else if (this.loader) {
128
+ this.element.removeChild(this.loader);
129
+ this.loader = null;
130
+ }
131
+ }
92
132
  /**
93
133
  * Create a new form instance provided the display of the form.
94
134
  *
@@ -144,6 +184,7 @@ class Form extends Element_1.default {
144
184
  if (typeof formParam === 'string') {
145
185
  const formio = new Formio_1.Formio(formParam);
146
186
  let error;
187
+ this.loading = true;
147
188
  result = this.getSubmission(formio, this.options)
148
189
  .catch((err) => {
149
190
  error = err;
@@ -159,6 +200,7 @@ class Form extends Element_1.default {
159
200
  if (error) {
160
201
  form = this.errorForm(error);
161
202
  }
203
+ this.loading = false;
162
204
  this.instance = this.instance || this.create(form.display);
163
205
  this.instance.url = formParam;
164
206
  this.instance.nosubmit = false;
@@ -191,7 +233,7 @@ class Form extends Element_1.default {
191
233
  if (formio.submissionId) {
192
234
  return formio.loadSubmission(null, opts);
193
235
  }
194
- return native_promise_only_1.default.resolve();
236
+ return Promise.resolve();
195
237
  }
196
238
  /**
197
239
  * Returns the loaded forms JSON.
@@ -209,7 +251,7 @@ class Form extends Element_1.default {
209
251
  */
210
252
  setDisplay(display) {
211
253
  if ((this.display === display) && this.instance) {
212
- return native_promise_only_1.default.resolve(this.instance);
254
+ return Promise.resolve(this.instance);
213
255
  }
214
256
  this.form.display = display;
215
257
  this.instance.destroy();
@@ -224,7 +266,7 @@ class Form extends Element_1.default {
224
266
  }
225
267
  }
226
268
  static embed(embed) {
227
- return new native_promise_only_1.default((resolve) => {
269
+ return new Promise((resolve) => {
228
270
  if (!embed || !embed.src) {
229
271
  resolve();
230
272
  }
@@ -271,10 +313,10 @@ class Form extends Element_1.default {
271
313
  */
272
314
  build() {
273
315
  if (!this.instance) {
274
- return native_promise_only_1.default.reject('Form not ready. Use form.ready promise');
316
+ return Promise.reject('Form not ready. Use form.ready promise');
275
317
  }
276
318
  if (!this.element) {
277
- return native_promise_only_1.default.reject('No DOM element for form.');
319
+ return Promise.reject('No DOM element for form.');
278
320
  }
279
321
  // Add temporary loader.
280
322
  const template = (this.options && this.options.template) ? this.options.template : 'bootstrap';
@@ -291,9 +333,9 @@ class Form extends Element_1.default {
291
333
  }
292
334
  render() {
293
335
  if (!this.instance) {
294
- return native_promise_only_1.default.reject('Form not ready. Use form.ready promise');
336
+ return Promise.reject('Form not ready. Use form.ready promise');
295
337
  }
296
- return native_promise_only_1.default.resolve(this.instance.render())
338
+ return Promise.resolve(this.instance.render())
297
339
  .then((param) => {
298
340
  this.emit('render', param);
299
341
  return param;
@@ -301,7 +343,7 @@ class Form extends Element_1.default {
301
343
  }
302
344
  attach(element) {
303
345
  if (!this.instance) {
304
- return native_promise_only_1.default.reject('Form not ready. Use form.ready promise');
346
+ return Promise.reject('Form not ready. Use form.ready promise');
305
347
  }
306
348
  if (this.element) {
307
349
  delete this.element.component;
package/lib/cjs/PDF.d.ts CHANGED
@@ -4,9 +4,10 @@ export default class PDF extends Webform {
4
4
  init(): void;
5
5
  submitButton: any;
6
6
  attachComponents(element: any, components: any, container: any): Promise<void>;
7
- iframeReady: any;
8
- iframeReadyResolve: any;
9
- iframeReadyReject: any;
7
+ attach(element: any): Promise<void>;
8
+ iframeReady: Promise<any> | undefined;
9
+ iframeReadyResolve: ((value: any) => void) | undefined;
10
+ iframeReadyReject: ((reason?: any) => void) | undefined;
10
11
  iframeElement: any;
11
12
  /**
12
13
  * Get the submission from the iframe.
@@ -14,6 +15,13 @@ export default class PDF extends Webform {
14
15
  * @return {Promise<any>}
15
16
  */
16
17
  getSubmission(): Promise<any>;
18
+ /**
19
+ * Ensure we have the submission from the iframe before we submit the form.
20
+ *
21
+ * @param options
22
+ * @return {*}
23
+ */
24
+ submitForm(options?: {}): any;
17
25
  getSrc(): string;
18
26
  setForm(form: any, flags?: {}): any;
19
27
  /**
package/lib/cjs/PDF.js CHANGED
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const native_promise_only_1 = __importDefault(require("native-promise-only"));
7
6
  const Formio_1 = require("./Formio");
8
7
  const Webform_1 = __importDefault(require("./Webform"));
9
8
  const utils_1 = require("./utils/utils");
@@ -61,7 +60,7 @@ class PDF extends Webform_1.default {
61
60
  }
62
61
  redraw() {
63
62
  this.postMessage({ name: 'redraw' });
64
- return this.builderMode ? native_promise_only_1.default.resolve() : super.redraw();
63
+ return this.builderMode ? Promise.resolve() : super.redraw();
65
64
  }
66
65
  destroy(all = false) {
67
66
  if (this.iframeElement) {
@@ -74,7 +73,7 @@ class PDF extends Webform_1.default {
74
73
  if (this.attached && this.builderMode && this.component.components) {
75
74
  this.destroyComponents();
76
75
  this.addComponents();
77
- return native_promise_only_1.default.resolve();
76
+ return Promise.resolve();
78
77
  }
79
78
  this.postMessage({ name: 'redraw' });
80
79
  return super.rebuild();
@@ -99,7 +98,7 @@ class PDF extends Webform_1.default {
99
98
  this.submitButton.refs = Object.assign({}, this.refs);
100
99
  this.submitButton.attachButton();
101
100
  // Reset the iframeReady promise.
102
- this.iframeReady = new native_promise_only_1.default((resolve, reject) => {
101
+ this.iframeReady = new Promise((resolve, reject) => {
103
102
  this.iframeReadyResolve = resolve;
104
103
  this.iframeReadyReject = reject;
105
104
  });
@@ -148,7 +147,7 @@ class PDF extends Webform_1.default {
148
147
  * @return {Promise<any>}
149
148
  */
150
149
  getSubmission() {
151
- return new native_promise_only_1.default((resolve) => {
150
+ return new Promise((resolve) => {
152
151
  this.once('iframe-submission', resolve);
153
152
  this.postMessage({ name: 'getSubmission' });
154
153
  });
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const lodash_1 = __importDefault(require("lodash"));
7
- const native_promise_only_1 = __importDefault(require("native-promise-only"));
8
7
  const Formio_1 = require("./Formio");
9
8
  const WebformBuilder_1 = __importDefault(require("./WebformBuilder"));
10
9
  const utils_1 = require("./utils/utils");
@@ -157,7 +156,7 @@ class PDFBuilder extends WebformBuilder_1.default {
157
156
  this.refs.hiddenFileInputElement.value = '';
158
157
  });
159
158
  }
160
- return native_promise_only_1.default.resolve();
159
+ return Promise.resolve();
161
160
  }
162
161
  // Normal PDF Builder
163
162
  return super.attach(element).then(() => {
@@ -417,7 +416,7 @@ class PDFBuilder extends WebformBuilder_1.default {
417
416
  if (!this.dropEvent) {
418
417
  // a 'drop' event may not be emited in the chrome browser when using a Mac, therefore an additional check has been added
419
418
  // eslint-disable-next-line no-undef
420
- if (!this.dropEmitted && (0, utils_1.getBrowserInfo)().chrome && globalThis.navigator.userAgentData.platform === 'macOS' && iframeRect.left < e.clientX && iframeRect.top < e.clientY) {
419
+ if (!this.dropEmitted && ((0, utils_1.getBrowserInfo)().chrome || (0, utils_1.getBrowserInfo)().edge) && globalThis.navigator.userAgentData.platform === 'macOS' && iframeRect.left < e.clientX && iframeRect.top < e.clientY) {
421
420
  this.dropEvent = e;
422
421
  this.dropEvent.dataTransfer.effectAllowed = 'all';
423
422
  this.dropEmitted = true;
@@ -65,7 +65,7 @@ declare class Webform extends NestedDataComponent {
65
65
  * @type {Promise}
66
66
  *
67
67
  * @example
68
- * import Webform from 'formiojs/Webform';
68
+ * import Webform from '@formio/js/Webform';
69
69
  * let form = new Webform(document.getElementById('formio'));
70
70
  * form.formReady.then(() => {
71
71
  * console.log('The form is ready!');
@@ -90,7 +90,7 @@ declare class Webform extends NestedDataComponent {
90
90
  * @type {Promise}
91
91
  *
92
92
  * @example
93
- * import Webform from 'formiojs/Webform';
93
+ * import Webform from '@formio/js/Webform';
94
94
  * let form = new Webform(document.getElementById('formio'));
95
95
  * form.submissionReady.then(() => {
96
96
  * console.log('The submission is ready!');
@@ -132,11 +132,6 @@ declare class Webform extends NestedDataComponent {
132
132
  * @return {*}
133
133
  */
134
134
  addLanguage(code: any, lang: any, active?: boolean): any;
135
- /**
136
- * Perform the localization initialization.
137
- * @returns {*}
138
- */
139
- localize(): any;
140
135
  keyboardCatchableElement(element: any): boolean;
141
136
  executeShortcuts: (event: any) => void;
142
137
  /**
@@ -145,7 +140,7 @@ declare class Webform extends NestedDataComponent {
145
140
  * @param {string} value - The value of the form embed url.
146
141
  *
147
142
  * @example
148
- * import Webform from 'formiojs/Webform';
143
+ * import Webform from '@formio/js/Webform';
149
144
  * let form = new Webform(document.getElementById('formio'));
150
145
  * form.formReady.then(() => {
151
146
  * console.log('The form is formReady!');
@@ -212,7 +207,7 @@ declare class Webform extends NestedDataComponent {
212
207
  * Sets the JSON schema for the form to be rendered.
213
208
  *
214
209
  * @example
215
- * import Webform from 'formiojs/Webform';
210
+ * import Webform from '@formio/js/Webform';
216
211
  * let form = new Webform(document.getElementById('formio'));
217
212
  * form.setForm({
218
213
  * components: [
@@ -262,7 +257,7 @@ declare class Webform extends NestedDataComponent {
262
257
  * Sets the submission of a form.
263
258
  *
264
259
  * @example
265
- * import Webform from 'formiojs/Webform';
260
+ * import Webform from '@formio/js/Webform';
266
261
  * let form = new Webform(document.getElementById('formio'));
267
262
  * form.src = 'https://examples.form.io/example';
268
263
  * form.submission = {data: {
@@ -308,6 +303,8 @@ declare class Webform extends NestedDataComponent {
308
303
  build(element: any): Promise<any>;
309
304
  getClassName(): string;
310
305
  render(): any;
306
+ redraw(): Promise<void> | Promise<boolean>;
307
+ attach(element: any): Promise<boolean>;
311
308
  hasRequiredFields(): boolean;
312
309
  /**
313
310
  * Sets a new alert to display in the error dialog of the form.
@@ -365,17 +362,17 @@ declare class Webform extends NestedDataComponent {
365
362
  */
366
363
  cancel(noconfirm: any): boolean;
367
364
  setMetadata(submission: any): void;
368
- submitForm(options?: {}): any;
365
+ submitForm(options?: {}): Promise<any>;
369
366
  setServerErrors(error: any): void;
370
367
  serverErrors: any;
371
- executeSubmit(options: any): any;
368
+ executeSubmit(options: any): Promise<object>;
372
369
  submissionInProcess: boolean | undefined;
373
370
  clearServerErrors(): void;
374
371
  /**
375
372
  * Submits the form.
376
373
  *
377
374
  * @example
378
- * import Webform from 'formiojs/Webform';
375
+ * import Webform from '@formio/js/Webform';
379
376
  * let form = new Webform(document.getElementById('formio'));
380
377
  * form.src = 'https://examples.form.io/example';
381
378
  * form.submission = {data: {
@@ -9,7 +9,6 @@ const compare_versions_1 = require("compare-versions");
9
9
  const EventEmitter_1 = __importDefault(require("./EventEmitter"));
10
10
  const i18n_1 = __importDefault(require("./i18n"));
11
11
  const Formio_1 = require("./Formio");
12
- const native_promise_only_1 = __importDefault(require("native-promise-only"));
13
12
  const Components_1 = __importDefault(require("./components/Components"));
14
13
  const NestedDataComponent_1 = __importDefault(require("./components/_classes/nesteddata/NestedDataComponent"));
15
14
  const utils_1 = require("./utils/utils");
@@ -100,42 +99,6 @@ class Webform extends NestedDataComponent_1.default {
100
99
  if (this.options.baseUrl) {
101
100
  Formio_1.Formio.setBaseUrl(this.options.baseUrl);
102
101
  }
103
- /**
104
- * The i18n configuration for this component.
105
- */
106
- let i18n = i18n_1.default;
107
- if (options && options.i18n && !options.i18nReady) {
108
- // Support legacy way of doing translations.
109
- if (options.i18n.resources) {
110
- i18n = options.i18n;
111
- }
112
- else {
113
- lodash_1.default.each(options.i18n, (lang, code) => {
114
- if (code === 'options') {
115
- lodash_1.default.merge(i18n, lang);
116
- }
117
- else if (!i18n.resources[code]) {
118
- // extend the default translations (validations, buttons etc.) in case they are not in the options.
119
- i18n.resources[code] = { translation: lodash_1.default.assign((0, utils_1.fastCloneDeep)(i18n_1.default.resources.en.translation), lang) };
120
- }
121
- else {
122
- lodash_1.default.assign(i18n.resources[code].translation, lang);
123
- }
124
- });
125
- }
126
- options.i18n = i18n;
127
- options.i18nReady = true;
128
- }
129
- if (options && options.i18n) {
130
- this.options.i18n = options.i18n;
131
- }
132
- else {
133
- this.options.i18n = i18n;
134
- }
135
- // Set the language.
136
- if (this.options.language) {
137
- this.options.i18n.lng = this.options.language;
138
- }
139
102
  /**
140
103
  * The type of this element.
141
104
  * @type {string}
@@ -200,14 +163,14 @@ class Webform extends NestedDataComponent_1.default {
200
163
  * @type {Promise}
201
164
  *
202
165
  * @example
203
- * import Webform from 'formiojs/Webform';
166
+ * import Webform from '@formio/js/Webform';
204
167
  * let form = new Webform(document.getElementById('formio'));
205
168
  * form.formReady.then(() => {
206
169
  * console.log('The form is ready!');
207
170
  * });
208
171
  * form.src = 'https://examples.form.io/example';
209
172
  */
210
- this.formReady = new native_promise_only_1.default((resolve, reject) => {
173
+ this.formReady = new Promise((resolve, reject) => {
211
174
  /**
212
175
  * Called when the formReady state of this form has been resolved.
213
176
  *
@@ -226,14 +189,14 @@ class Webform extends NestedDataComponent_1.default {
226
189
  * @type {Promise}
227
190
  *
228
191
  * @example
229
- * import Webform from 'formiojs/Webform';
192
+ * import Webform from '@formio/js/Webform';
230
193
  * let form = new Webform(document.getElementById('formio'));
231
194
  * form.submissionReady.then(() => {
232
195
  * console.log('The submission is ready!');
233
196
  * });
234
197
  * form.src = 'https://examples.form.io/example/submission/234234234234234243';
235
198
  */
236
- this.submissionReady = new native_promise_only_1.default((resolve, reject) => {
199
+ this.submissionReady = new Promise((resolve, reject) => {
237
200
  /**
238
201
  * Called when the formReady state of this form has been resolved.
239
202
  *
@@ -249,9 +212,7 @@ class Webform extends NestedDataComponent_1.default {
249
212
  });
250
213
  this.shortcuts = [];
251
214
  // Set language after everything is established.
252
- this.localize().then(() => {
253
- this.language = this.options.language;
254
- });
215
+ this.language = this.i18next.language;
255
216
  // See if we need to restore the draft from a user.
256
217
  if (this.options.saveDraft && !this.options.skipDraftRestore) {
257
218
  const user = Formio_1.Formio.getUser();
@@ -285,32 +246,17 @@ class Webform extends NestedDataComponent_1.default {
285
246
  if (!this.i18next) {
286
247
  return;
287
248
  }
288
- let cleanupThis = this;
289
- if (!cleanupThis) {
290
- return;
291
- }
292
- cleanupThis.options.language = lang;
293
- if (cleanupThis.i18next.language === lang) {
294
- cleanupThis = null;
295
- return;
296
- }
297
- try {
298
- cleanupThis.i18next.changeLanguage(lang, (err) => {
299
- if (err) {
300
- cleanupThis = null;
301
- return;
302
- }
303
- if (cleanupThis) {
304
- cleanupThis.rebuild();
305
- cleanupThis.emit('languageChanged');
306
- cleanupThis = null;
307
- }
308
- });
309
- }
310
- catch (err) {
311
- cleanupThis = null;
249
+ this.options.language = lang;
250
+ if (this.i18next.language === lang) {
312
251
  return;
313
252
  }
253
+ this.i18next.changeLanguage(lang, (err) => {
254
+ if (err) {
255
+ return;
256
+ }
257
+ this.rebuild();
258
+ this.emit('languageChanged');
259
+ });
314
260
  }
315
261
  get componentComponents() {
316
262
  return this.form.components;
@@ -335,45 +281,6 @@ class Webform extends NestedDataComponent_1.default {
335
281
  }
336
282
  }
337
283
  }
338
- /**
339
- * Perform the localization initialization.
340
- * @returns {*}
341
- */
342
- localize() {
343
- if (!this.i18next) {
344
- return native_promise_only_1.default.resolve(null);
345
- }
346
- if (this.i18next.initialized) {
347
- return native_promise_only_1.default.resolve(this.i18next);
348
- }
349
- this.i18next.initialized = true;
350
- let cleanupThis = this;
351
- return new native_promise_only_1.default((resolve, reject) => {
352
- try {
353
- if (!cleanupThis) {
354
- return;
355
- }
356
- cleanupThis.i18next.init(Object.assign(Object.assign({}, cleanupThis.options.i18n), { compatibilityJSON: 'v3' }), (err) => {
357
- if (!cleanupThis) {
358
- reject(new Error('Lost reference to `this` while initializing i18next.'));
359
- }
360
- // Get language but remove any ;q=1 that might exist on it.
361
- cleanupThis.options.language = cleanupThis.i18next.language.split(';')[0];
362
- if (err) {
363
- cleanupThis = null;
364
- return reject(err);
365
- }
366
- const i18next = cleanupThis.i18next;
367
- cleanupThis = null;
368
- resolve(i18next);
369
- });
370
- }
371
- catch (err) {
372
- cleanupThis = null;
373
- return reject(err);
374
- }
375
- });
376
- }
377
284
  keyboardCatchableElement(element) {
378
285
  if (element.nodeName === 'TEXTAREA') {
379
286
  return false;
@@ -458,7 +365,7 @@ class Webform extends NestedDataComponent_1.default {
458
365
  this.formReadyReject(err);
459
366
  });
460
367
  }
461
- return native_promise_only_1.default.resolve();
368
+ return Promise.resolve();
462
369
  }
463
370
  /**
464
371
  * Set the Form source, which is typically the Form.io embed URL.
@@ -466,7 +373,7 @@ class Webform extends NestedDataComponent_1.default {
466
373
  * @param {string} value - The value of the form embed url.
467
374
  *
468
375
  * @example
469
- * import Webform from 'formiojs/Webform';
376
+ * import Webform from '@formio/js/Webform';
470
377
  * let form = new Webform(document.getElementById('formio'));
471
378
  * form.formReady.then(() => {
472
379
  * console.log('The form is formReady!');
@@ -571,7 +478,7 @@ class Webform extends NestedDataComponent_1.default {
571
478
  * Sets the JSON schema for the form to be rendered.
572
479
  *
573
480
  * @example
574
- * import Webform from 'formiojs/Webform';
481
+ * import Webform from '@formio/js/Webform';
575
482
  * let form = new Webform(document.getElementById('formio'));
576
483
  * form.setForm({
577
484
  * components: [
@@ -608,7 +515,7 @@ class Webform extends NestedDataComponent_1.default {
608
515
  try {
609
516
  // Do not set the form again if it has been already set
610
517
  if (isFormAlreadySet && JSON.stringify(this._form) === JSON.stringify(form)) {
611
- return native_promise_only_1.default.resolve();
518
+ return Promise.resolve();
612
519
  }
613
520
  // Create the form.
614
521
  this._form = (flags === null || flags === void 0 ? void 0 : flags.keepAsReference) ? form : lodash_1.default.cloneDeep(form);
@@ -616,13 +523,13 @@ class Webform extends NestedDataComponent_1.default {
616
523
  this.onSetForm(lodash_1.default.cloneDeep(this._form), form);
617
524
  }
618
525
  if ((_c = (_b = this.parent) === null || _b === void 0 ? void 0 : _b.component) === null || _c === void 0 ? void 0 : _c.modalEdit) {
619
- return native_promise_only_1.default.resolve();
526
+ return Promise.resolve();
620
527
  }
621
528
  }
622
529
  catch (err) {
623
530
  console.warn(err);
624
531
  // If provided form is not a valid JSON object, do not set it too
625
- return native_promise_only_1.default.resolve();
532
+ return Promise.resolve();
626
533
  }
627
534
  // Allow the form to provide component overrides.
628
535
  if (form && form.settings && form.settings.components) {
@@ -659,7 +566,7 @@ class Webform extends NestedDataComponent_1.default {
659
566
  }
660
567
  }
661
568
  this.initialized = false;
662
- const rebuild = this.rebuild() || native_promise_only_1.default.resolve();
569
+ const rebuild = this.rebuild() || Promise.resolve();
663
570
  return rebuild.then(() => {
664
571
  this.emit('formLoad', form);
665
572
  this.triggerRecaptcha();
@@ -705,7 +612,7 @@ class Webform extends NestedDataComponent_1.default {
705
612
  * Sets the submission of a form.
706
613
  *
707
614
  * @example
708
- * import Webform from 'formiojs/Webform';
615
+ * import Webform from '@formio/js/Webform';
709
616
  * let form = new Webform(document.getElementById('formio'));
710
617
  * form.src = 'https://examples.form.io/example';
711
618
  * form.submission = {data: {
@@ -812,7 +719,10 @@ class Webform extends NestedDataComponent_1.default {
812
719
  }
813
720
  setValue(submission, flags = {}) {
814
721
  if (!submission || !submission.data) {
815
- submission = { data: {} };
722
+ submission = {
723
+ data: {},
724
+ metadata: submission.metadata,
725
+ };
816
726
  }
817
727
  // Metadata needs to be available before setValue
818
728
  this._submission.metadata = submission.metadata || {};
@@ -846,7 +756,14 @@ class Webform extends NestedDataComponent_1.default {
846
756
  * Build the form.
847
757
  */
848
758
  init() {
849
- this._submission = this._submission || { data: {} };
759
+ if (this.options.submission) {
760
+ const submission = lodash_1.default.extend({}, this.options.submission);
761
+ this._submission = submission;
762
+ this._data = submission.data;
763
+ }
764
+ else {
765
+ this._submission = this._submission || { data: {} };
766
+ }
850
767
  // Remove any existing components.
851
768
  if (this.components && this.components.length) {
852
769
  this.destroyComponents();
@@ -927,7 +844,7 @@ class Webform extends NestedDataComponent_1.default {
927
844
  redraw() {
928
845
  // Don't bother if we have not built yet.
929
846
  if (!this.element) {
930
- return native_promise_only_1.default.resolve();
847
+ return Promise.resolve();
931
848
  }
932
849
  this.clear();
933
850
  this.setContent(this.element, this.render());
@@ -1301,7 +1218,7 @@ class Webform extends NestedDataComponent_1.default {
1301
1218
  }
1302
1219
  submitForm(options = {}) {
1303
1220
  this.clearServerErrors();
1304
- return new native_promise_only_1.default((resolve, reject) => {
1221
+ return new Promise((resolve, reject) => {
1305
1222
  // Read-only forms should never submit.
1306
1223
  if (this.options.readOnly) {
1307
1224
  return resolve({
@@ -1325,6 +1242,9 @@ class Webform extends NestedDataComponent_1.default {
1325
1242
  return reject();
1326
1243
  }
1327
1244
  this.everyComponent((comp) => {
1245
+ if (submission._vnote && comp.type === 'form' && comp.component.reference) {
1246
+ lodash_1.default.get(submission.data, comp.path, {})._vnote = submission._vnote;
1247
+ }
1328
1248
  const { persistent } = comp.component;
1329
1249
  if (persistent === 'client-only') {
1330
1250
  lodash_1.default.unset(submission.data, comp.path);
@@ -1402,7 +1322,7 @@ class Webform extends NestedDataComponent_1.default {
1402
1322
  })
1403
1323
  .catch((err) => {
1404
1324
  this.submissionInProcess = false;
1405
- return native_promise_only_1.default.reject(this.onSubmissionError(err));
1325
+ return Promise.reject(this.onSubmissionError(err));
1406
1326
  });
1407
1327
  }
1408
1328
  clearServerErrors() {
@@ -1422,7 +1342,7 @@ class Webform extends NestedDataComponent_1.default {
1422
1342
  * Submits the form.
1423
1343
  *
1424
1344
  * @example
1425
- * import Webform from 'formiojs/Webform';
1345
+ * import Webform from '@formio/js/Webform';
1426
1346
  * let form = new Webform(document.getElementById('formio'));
1427
1347
  * form.src = 'https://examples.form.io/example';
1428
1348
  * form.submission = {data: {
@@ -1469,10 +1389,11 @@ class Webform extends NestedDataComponent_1.default {
1469
1389
  this.emit('requestDone');
1470
1390
  this.setAlert('success', '<p> Success </p>');
1471
1391
  }).catch((e) => {
1472
- this.showErrors(`${e.statusText ? e.statusText : ''} ${e.status ? e.status : e}`);
1473
- this.emit('error', `${e.statusText ? e.statusText : ''} ${e.status ? e.status : e}`);
1474
- console.error(`${e.statusText ? e.statusText : ''} ${e.status ? e.status : e}`);
1475
- this.setAlert('danger', `<p> ${e.statusText ? e.statusText : ''} ${e.status ? e.status : e} </p>`);
1392
+ const message = `${e.statusText ? e.statusText : ''} ${e.status ? e.status : e}`;
1393
+ this.emit('error', message);
1394
+ console.error(message);
1395
+ this.setAlert('danger', `<p> ${message} </p>`);
1396
+ return Promise.reject(this.onSubmissionError(e));
1476
1397
  });
1477
1398
  }
1478
1399
  else {