@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/mjs/Form.js CHANGED
@@ -3,7 +3,6 @@ import { Formio } from './Formio';
3
3
  import Displays from './displays';
4
4
  import templates from './templates';
5
5
  import * as FormioUtils from './utils/utils';
6
- import NativePromise from 'native-promise-only';
7
6
  export default class Form extends Element {
8
7
  /**
9
8
  * Creates an easy to use interface for embedding webforms, pdfs, and wizards into your application.
@@ -17,7 +16,7 @@ export default class Form extends Element {
17
16
  * @param {boolean} options.template - Provides a way to inject custom logic into the creation of every element rendered within the form.
18
17
  *
19
18
  * @example
20
- * import Form from 'formiojs/Form';
19
+ * import Form from '@formio/js/Form';
21
20
  * const form = new Form(document.getElementById('formio'), 'https://examples.form.io/example');
22
21
  * form.build();
23
22
  */
@@ -30,7 +29,7 @@ export default class Form extends Element {
30
29
  if (this.options.useSessionToken) {
31
30
  Formio.useSessionToken(this.options);
32
31
  }
33
- this.ready = new NativePromise((resolve, reject) => {
32
+ this.ready = new Promise((resolve, reject) => {
34
33
  this.readyResolve = resolve;
35
34
  this.readyReject = reject;
36
35
  });
@@ -61,6 +60,47 @@ export default class Form extends Element {
61
60
  }
62
61
  this.display = '';
63
62
  }
63
+ createElement(tag, attrs, children) {
64
+ const element = document.createElement(tag);
65
+ for (const attr in attrs) {
66
+ if (attrs.hasOwnProperty(attr)) {
67
+ element.setAttribute(attr, attrs[attr]);
68
+ }
69
+ }
70
+ (children || []).forEach(child => {
71
+ element.appendChild(this.createElement(child.tag, child.attrs, child.children));
72
+ });
73
+ return element;
74
+ }
75
+ set loading(load) {
76
+ if (!this.element || this.options.noLoader) {
77
+ return;
78
+ }
79
+ if (load) {
80
+ if (this.loader) {
81
+ return;
82
+ }
83
+ this.loader = this.createElement('div', {
84
+ 'class': 'formio-loader'
85
+ }, [{
86
+ tag: 'div',
87
+ attrs: {
88
+ class: 'loader-wrapper'
89
+ },
90
+ children: [{
91
+ tag: 'div',
92
+ attrs: {
93
+ class: 'loader text-center'
94
+ }
95
+ }]
96
+ }]);
97
+ this.element.appendChild(this.loader);
98
+ }
99
+ else if (this.loader) {
100
+ this.element.removeChild(this.loader);
101
+ this.loader = null;
102
+ }
103
+ }
64
104
  /**
65
105
  * Create a new form instance provided the display of the form.
66
106
  *
@@ -116,6 +156,7 @@ export default class Form extends Element {
116
156
  if (typeof formParam === 'string') {
117
157
  const formio = new Formio(formParam);
118
158
  let error;
159
+ this.loading = true;
119
160
  result = this.getSubmission(formio, this.options)
120
161
  .catch((err) => {
121
162
  error = err;
@@ -131,6 +172,7 @@ export default class Form extends Element {
131
172
  if (error) {
132
173
  form = this.errorForm(error);
133
174
  }
175
+ this.loading = false;
134
176
  this.instance = this.instance || this.create(form.display);
135
177
  this.instance.url = formParam;
136
178
  this.instance.nosubmit = false;
@@ -163,7 +205,7 @@ export default class Form extends Element {
163
205
  if (formio.submissionId) {
164
206
  return formio.loadSubmission(null, opts);
165
207
  }
166
- return NativePromise.resolve();
208
+ return Promise.resolve();
167
209
  }
168
210
  /**
169
211
  * Returns the loaded forms JSON.
@@ -181,7 +223,7 @@ export default class Form extends Element {
181
223
  */
182
224
  setDisplay(display) {
183
225
  if ((this.display === display) && this.instance) {
184
- return NativePromise.resolve(this.instance);
226
+ return Promise.resolve(this.instance);
185
227
  }
186
228
  this.form.display = display;
187
229
  this.instance.destroy();
@@ -196,7 +238,7 @@ export default class Form extends Element {
196
238
  }
197
239
  }
198
240
  static embed(embed) {
199
- return new NativePromise((resolve) => {
241
+ return new Promise((resolve) => {
200
242
  if (!embed || !embed.src) {
201
243
  resolve();
202
244
  }
@@ -243,10 +285,10 @@ export default class Form extends Element {
243
285
  */
244
286
  build() {
245
287
  if (!this.instance) {
246
- return NativePromise.reject('Form not ready. Use form.ready promise');
288
+ return Promise.reject('Form not ready. Use form.ready promise');
247
289
  }
248
290
  if (!this.element) {
249
- return NativePromise.reject('No DOM element for form.');
291
+ return Promise.reject('No DOM element for form.');
250
292
  }
251
293
  // Add temporary loader.
252
294
  const template = (this.options && this.options.template) ? this.options.template : 'bootstrap';
@@ -263,9 +305,9 @@ export default class Form extends Element {
263
305
  }
264
306
  render() {
265
307
  if (!this.instance) {
266
- return NativePromise.reject('Form not ready. Use form.ready promise');
308
+ return Promise.reject('Form not ready. Use form.ready promise');
267
309
  }
268
- return NativePromise.resolve(this.instance.render())
310
+ return Promise.resolve(this.instance.render())
269
311
  .then((param) => {
270
312
  this.emit('render', param);
271
313
  return param;
@@ -273,7 +315,7 @@ export default class Form extends Element {
273
315
  }
274
316
  attach(element) {
275
317
  if (!this.instance) {
276
- return NativePromise.reject('Form not ready. Use form.ready promise');
318
+ return Promise.reject('Form not ready. Use form.ready promise');
277
319
  }
278
320
  if (this.element) {
279
321
  delete this.element.component;
package/lib/mjs/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/mjs/PDF.js CHANGED
@@ -1,4 +1,3 @@
1
- import NativePromise from 'native-promise-only';
2
1
  import { Formio } from './Formio';
3
2
  import Webform from './Webform';
4
3
  import { fastCloneDeep, eachComponent } from './utils/utils';
@@ -56,7 +55,7 @@ export default class PDF extends Webform {
56
55
  }
57
56
  redraw() {
58
57
  this.postMessage({ name: 'redraw' });
59
- return this.builderMode ? NativePromise.resolve() : super.redraw();
58
+ return this.builderMode ? Promise.resolve() : super.redraw();
60
59
  }
61
60
  destroy(all = false) {
62
61
  if (this.iframeElement) {
@@ -69,7 +68,7 @@ export default class PDF extends Webform {
69
68
  if (this.attached && this.builderMode && this.component.components) {
70
69
  this.destroyComponents();
71
70
  this.addComponents();
72
- return NativePromise.resolve();
71
+ return Promise.resolve();
73
72
  }
74
73
  this.postMessage({ name: 'redraw' });
75
74
  return super.rebuild();
@@ -94,7 +93,7 @@ export default class PDF extends Webform {
94
93
  this.submitButton.refs = { ...this.refs };
95
94
  this.submitButton.attachButton();
96
95
  // Reset the iframeReady promise.
97
- this.iframeReady = new NativePromise((resolve, reject) => {
96
+ this.iframeReady = new Promise((resolve, reject) => {
98
97
  this.iframeReadyResolve = resolve;
99
98
  this.iframeReadyReject = reject;
100
99
  });
@@ -143,7 +142,7 @@ export default class PDF extends Webform {
143
142
  * @return {Promise<any>}
144
143
  */
145
144
  getSubmission() {
146
- return new NativePromise((resolve) => {
145
+ return new Promise((resolve) => {
147
146
  this.once('iframe-submission', resolve);
148
147
  this.postMessage({ name: 'getSubmission' });
149
148
  });
@@ -1,5 +1,4 @@
1
1
  import _ from 'lodash';
2
- import NativePromise from 'native-promise-only';
3
2
  import { Formio } from './Formio';
4
3
  import WebformBuilder from './WebformBuilder';
5
4
  import { fastCloneDeep, getElementRect, getBrowserInfo } from './utils/utils';
@@ -152,7 +151,7 @@ export default class PDFBuilder extends WebformBuilder {
152
151
  this.refs.hiddenFileInputElement.value = '';
153
152
  });
154
153
  }
155
- return NativePromise.resolve();
154
+ return Promise.resolve();
156
155
  }
157
156
  // Normal PDF Builder
158
157
  return super.attach(element).then(() => {
@@ -411,7 +410,7 @@ export default class PDFBuilder extends WebformBuilder {
411
410
  if (!this.dropEvent) {
412
411
  // a 'drop' event may not be emited in the chrome browser when using a Mac, therefore an additional check has been added
413
412
  // eslint-disable-next-line no-undef
414
- if (!this.dropEmitted && getBrowserInfo().chrome && globalThis.navigator.userAgentData.platform === 'macOS' && iframeRect.left < e.clientX && iframeRect.top < e.clientY) {
413
+ if (!this.dropEmitted && (getBrowserInfo().chrome || getBrowserInfo().edge) && globalThis.navigator.userAgentData.platform === 'macOS' && iframeRect.left < e.clientX && iframeRect.top < e.clientY) {
415
414
  this.dropEvent = e;
416
415
  this.dropEvent.dataTransfer.effectAllowed = 'all';
417
416
  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: {
@@ -4,7 +4,6 @@ import { compareVersions } from 'compare-versions';
4
4
  import EventEmitter from './EventEmitter';
5
5
  import i18nDefaults from './i18n';
6
6
  import { Formio } from './Formio';
7
- import NativePromise from 'native-promise-only';
8
7
  import Components from './components/Components';
9
8
  import NestedDataComponent from './components/_classes/nesteddata/NestedDataComponent';
10
9
  import { fastCloneDeep, currentTimezone, unescapeHTML, getStringFromComponentPath, searchComponents, convertStringToHTMLElement, getArrayFromComponentPath } from './utils/utils';
@@ -68,42 +67,6 @@ export default class Webform extends NestedDataComponent {
68
67
  if (this.options.baseUrl) {
69
68
  Formio.setBaseUrl(this.options.baseUrl);
70
69
  }
71
- /**
72
- * The i18n configuration for this component.
73
- */
74
- let i18n = i18nDefaults;
75
- if (options && options.i18n && !options.i18nReady) {
76
- // Support legacy way of doing translations.
77
- if (options.i18n.resources) {
78
- i18n = options.i18n;
79
- }
80
- else {
81
- _.each(options.i18n, (lang, code) => {
82
- if (code === 'options') {
83
- _.merge(i18n, lang);
84
- }
85
- else if (!i18n.resources[code]) {
86
- // extend the default translations (validations, buttons etc.) in case they are not in the options.
87
- i18n.resources[code] = { translation: _.assign(fastCloneDeep(i18nDefaults.resources.en.translation), lang) };
88
- }
89
- else {
90
- _.assign(i18n.resources[code].translation, lang);
91
- }
92
- });
93
- }
94
- options.i18n = i18n;
95
- options.i18nReady = true;
96
- }
97
- if (options && options.i18n) {
98
- this.options.i18n = options.i18n;
99
- }
100
- else {
101
- this.options.i18n = i18n;
102
- }
103
- // Set the language.
104
- if (this.options.language) {
105
- this.options.i18n.lng = this.options.language;
106
- }
107
70
  /**
108
71
  * The type of this element.
109
72
  * @type {string}
@@ -168,14 +131,14 @@ export default class Webform extends NestedDataComponent {
168
131
  * @type {Promise}
169
132
  *
170
133
  * @example
171
- * import Webform from 'formiojs/Webform';
134
+ * import Webform from '@formio/js/Webform';
172
135
  * let form = new Webform(document.getElementById('formio'));
173
136
  * form.formReady.then(() => {
174
137
  * console.log('The form is ready!');
175
138
  * });
176
139
  * form.src = 'https://examples.form.io/example';
177
140
  */
178
- this.formReady = new NativePromise((resolve, reject) => {
141
+ this.formReady = new Promise((resolve, reject) => {
179
142
  /**
180
143
  * Called when the formReady state of this form has been resolved.
181
144
  *
@@ -194,14 +157,14 @@ export default class Webform extends NestedDataComponent {
194
157
  * @type {Promise}
195
158
  *
196
159
  * @example
197
- * import Webform from 'formiojs/Webform';
160
+ * import Webform from '@formio/js/Webform';
198
161
  * let form = new Webform(document.getElementById('formio'));
199
162
  * form.submissionReady.then(() => {
200
163
  * console.log('The submission is ready!');
201
164
  * });
202
165
  * form.src = 'https://examples.form.io/example/submission/234234234234234243';
203
166
  */
204
- this.submissionReady = new NativePromise((resolve, reject) => {
167
+ this.submissionReady = new Promise((resolve, reject) => {
205
168
  /**
206
169
  * Called when the formReady state of this form has been resolved.
207
170
  *
@@ -217,9 +180,7 @@ export default class Webform extends NestedDataComponent {
217
180
  });
218
181
  this.shortcuts = [];
219
182
  // Set language after everything is established.
220
- this.localize().then(() => {
221
- this.language = this.options.language;
222
- });
183
+ this.language = this.i18next.language;
223
184
  // See if we need to restore the draft from a user.
224
185
  if (this.options.saveDraft && !this.options.skipDraftRestore) {
225
186
  const user = Formio.getUser();
@@ -253,32 +214,17 @@ export default class Webform extends NestedDataComponent {
253
214
  if (!this.i18next) {
254
215
  return;
255
216
  }
256
- let cleanupThis = this;
257
- if (!cleanupThis) {
258
- return;
259
- }
260
- cleanupThis.options.language = lang;
261
- if (cleanupThis.i18next.language === lang) {
262
- cleanupThis = null;
263
- return;
264
- }
265
- try {
266
- cleanupThis.i18next.changeLanguage(lang, (err) => {
267
- if (err) {
268
- cleanupThis = null;
269
- return;
270
- }
271
- if (cleanupThis) {
272
- cleanupThis.rebuild();
273
- cleanupThis.emit('languageChanged');
274
- cleanupThis = null;
275
- }
276
- });
277
- }
278
- catch (err) {
279
- cleanupThis = null;
217
+ this.options.language = lang;
218
+ if (this.i18next.language === lang) {
280
219
  return;
281
220
  }
221
+ this.i18next.changeLanguage(lang, (err) => {
222
+ if (err) {
223
+ return;
224
+ }
225
+ this.rebuild();
226
+ this.emit('languageChanged');
227
+ });
282
228
  }
283
229
  get componentComponents() {
284
230
  return this.form.components;
@@ -303,48 +249,6 @@ export default class Webform extends NestedDataComponent {
303
249
  }
304
250
  }
305
251
  }
306
- /**
307
- * Perform the localization initialization.
308
- * @returns {*}
309
- */
310
- localize() {
311
- if (!this.i18next) {
312
- return NativePromise.resolve(null);
313
- }
314
- if (this.i18next.initialized) {
315
- return NativePromise.resolve(this.i18next);
316
- }
317
- this.i18next.initialized = true;
318
- let cleanupThis = this;
319
- return new NativePromise((resolve, reject) => {
320
- try {
321
- if (!cleanupThis) {
322
- return;
323
- }
324
- cleanupThis.i18next.init({
325
- ...cleanupThis.options.i18n,
326
- ...{ compatibilityJSON: 'v3' }
327
- }, (err) => {
328
- if (!cleanupThis) {
329
- reject(new Error('Lost reference to `this` while initializing i18next.'));
330
- }
331
- // Get language but remove any ;q=1 that might exist on it.
332
- cleanupThis.options.language = cleanupThis.i18next.language.split(';')[0];
333
- if (err) {
334
- cleanupThis = null;
335
- return reject(err);
336
- }
337
- const i18next = cleanupThis.i18next;
338
- cleanupThis = null;
339
- resolve(i18next);
340
- });
341
- }
342
- catch (err) {
343
- cleanupThis = null;
344
- return reject(err);
345
- }
346
- });
347
- }
348
252
  keyboardCatchableElement(element) {
349
253
  if (element.nodeName === 'TEXTAREA') {
350
254
  return false;
@@ -456,7 +360,7 @@ export default class Webform extends NestedDataComponent {
456
360
  this.formReadyReject(err);
457
361
  });
458
362
  }
459
- return NativePromise.resolve();
363
+ return Promise.resolve();
460
364
  }
461
365
  /**
462
366
  * Set the Form source, which is typically the Form.io embed URL.
@@ -464,7 +368,7 @@ export default class Webform extends NestedDataComponent {
464
368
  * @param {string} value - The value of the form embed url.
465
369
  *
466
370
  * @example
467
- * import Webform from 'formiojs/Webform';
371
+ * import Webform from '@formio/js/Webform';
468
372
  * let form = new Webform(document.getElementById('formio'));
469
373
  * form.formReady.then(() => {
470
374
  * console.log('The form is formReady!');
@@ -569,7 +473,7 @@ export default class Webform extends NestedDataComponent {
569
473
  * Sets the JSON schema for the form to be rendered.
570
474
  *
571
475
  * @example
572
- * import Webform from 'formiojs/Webform';
476
+ * import Webform from '@formio/js/Webform';
573
477
  * let form = new Webform(document.getElementById('formio'));
574
478
  * form.setForm({
575
479
  * components: [
@@ -605,7 +509,7 @@ export default class Webform extends NestedDataComponent {
605
509
  try {
606
510
  // Do not set the form again if it has been already set
607
511
  if (isFormAlreadySet && JSON.stringify(this._form) === JSON.stringify(form)) {
608
- return NativePromise.resolve();
512
+ return Promise.resolve();
609
513
  }
610
514
  // Create the form.
611
515
  this._form = flags?.keepAsReference ? form : _.cloneDeep(form);
@@ -613,13 +517,13 @@ export default class Webform extends NestedDataComponent {
613
517
  this.onSetForm(_.cloneDeep(this._form), form);
614
518
  }
615
519
  if (this.parent?.component?.modalEdit) {
616
- return NativePromise.resolve();
520
+ return Promise.resolve();
617
521
  }
618
522
  }
619
523
  catch (err) {
620
524
  console.warn(err);
621
525
  // If provided form is not a valid JSON object, do not set it too
622
- return NativePromise.resolve();
526
+ return Promise.resolve();
623
527
  }
624
528
  // Allow the form to provide component overrides.
625
529
  if (form && form.settings && form.settings.components) {
@@ -656,7 +560,7 @@ export default class Webform extends NestedDataComponent {
656
560
  }
657
561
  }
658
562
  this.initialized = false;
659
- const rebuild = this.rebuild() || NativePromise.resolve();
563
+ const rebuild = this.rebuild() || Promise.resolve();
660
564
  return rebuild.then(() => {
661
565
  this.emit('formLoad', form);
662
566
  this.triggerRecaptcha();
@@ -702,7 +606,7 @@ export default class Webform extends NestedDataComponent {
702
606
  * Sets the submission of a form.
703
607
  *
704
608
  * @example
705
- * import Webform from 'formiojs/Webform';
609
+ * import Webform from '@formio/js/Webform';
706
610
  * let form = new Webform(document.getElementById('formio'));
707
611
  * form.src = 'https://examples.form.io/example';
708
612
  * form.submission = {data: {
@@ -815,7 +719,10 @@ export default class Webform extends NestedDataComponent {
815
719
  }
816
720
  setValue(submission, flags = {}) {
817
721
  if (!submission || !submission.data) {
818
- submission = { data: {} };
722
+ submission = {
723
+ data: {},
724
+ metadata: submission.metadata,
725
+ };
819
726
  }
820
727
  // Metadata needs to be available before setValue
821
728
  this._submission.metadata = submission.metadata || {};
@@ -849,7 +756,14 @@ export default class Webform extends NestedDataComponent {
849
756
  * Build the form.
850
757
  */
851
758
  init() {
852
- this._submission = this._submission || { data: {} };
759
+ if (this.options.submission) {
760
+ const submission = _.extend({}, this.options.submission);
761
+ this._submission = submission;
762
+ this._data = submission.data;
763
+ }
764
+ else {
765
+ this._submission = this._submission || { data: {} };
766
+ }
853
767
  // Remove any existing components.
854
768
  if (this.components && this.components.length) {
855
769
  this.destroyComponents();
@@ -930,7 +844,7 @@ export default class Webform extends NestedDataComponent {
930
844
  redraw() {
931
845
  // Don't bother if we have not built yet.
932
846
  if (!this.element) {
933
- return NativePromise.resolve();
847
+ return Promise.resolve();
934
848
  }
935
849
  this.clear();
936
850
  this.setContent(this.element, this.render());
@@ -1303,7 +1217,7 @@ export default class Webform extends NestedDataComponent {
1303
1217
  }
1304
1218
  submitForm(options = {}) {
1305
1219
  this.clearServerErrors();
1306
- return new NativePromise((resolve, reject) => {
1220
+ return new Promise((resolve, reject) => {
1307
1221
  // Read-only forms should never submit.
1308
1222
  if (this.options.readOnly) {
1309
1223
  return resolve({
@@ -1327,6 +1241,9 @@ export default class Webform extends NestedDataComponent {
1327
1241
  return reject();
1328
1242
  }
1329
1243
  this.everyComponent((comp) => {
1244
+ if (submission._vnote && comp.type === 'form' && comp.component.reference) {
1245
+ _.get(submission.data, comp.path, {})._vnote = submission._vnote;
1246
+ }
1330
1247
  const { persistent } = comp.component;
1331
1248
  if (persistent === 'client-only') {
1332
1249
  _.unset(submission.data, comp.path);
@@ -1404,7 +1321,7 @@ export default class Webform extends NestedDataComponent {
1404
1321
  })
1405
1322
  .catch((err) => {
1406
1323
  this.submissionInProcess = false;
1407
- return NativePromise.reject(this.onSubmissionError(err));
1324
+ return Promise.reject(this.onSubmissionError(err));
1408
1325
  });
1409
1326
  }
1410
1327
  clearServerErrors() {
@@ -1423,7 +1340,7 @@ export default class Webform extends NestedDataComponent {
1423
1340
  * Submits the form.
1424
1341
  *
1425
1342
  * @example
1426
- * import Webform from 'formiojs/Webform';
1343
+ * import Webform from '@formio/js/Webform';
1427
1344
  * let form = new Webform(document.getElementById('formio'));
1428
1345
  * form.src = 'https://examples.form.io/example';
1429
1346
  * form.submission = {data: {
@@ -1470,10 +1387,11 @@ export default class Webform extends NestedDataComponent {
1470
1387
  this.emit('requestDone');
1471
1388
  this.setAlert('success', '<p> Success </p>');
1472
1389
  }).catch((e) => {
1473
- this.showErrors(`${e.statusText ? e.statusText : ''} ${e.status ? e.status : e}`);
1474
- this.emit('error', `${e.statusText ? e.statusText : ''} ${e.status ? e.status : e}`);
1475
- console.error(`${e.statusText ? e.statusText : ''} ${e.status ? e.status : e}`);
1476
- this.setAlert('danger', `<p> ${e.statusText ? e.statusText : ''} ${e.status ? e.status : e} </p>`);
1390
+ const message = `${e.statusText ? e.statusText : ''} ${e.status ? e.status : e}`;
1391
+ this.emit('error', message);
1392
+ console.error(message);
1393
+ this.setAlert('danger', `<p> ${message} </p>`);
1394
+ return Promise.reject(this.onSubmissionError(e));
1477
1395
  });
1478
1396
  }
1479
1397
  else {