@formio/js 5.0.0-rc.18 → 5.0.0-rc.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (325) 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 -2
  5. package/dist/formio.embed.js +2 -2
  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 +333 -361
  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 +353 -370
  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 +208 -121
  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.js +1 -1
  26. package/lib/cjs/Element.js +7 -2
  27. package/lib/cjs/Embed.js +1 -1
  28. package/lib/cjs/Form.d.ts +8 -5
  29. package/lib/cjs/Form.js +52 -10
  30. package/lib/cjs/PDF.d.ts +11 -3
  31. package/lib/cjs/PDF.js +4 -5
  32. package/lib/cjs/PDFBuilder.js +2 -3
  33. package/lib/cjs/Webform.d.ts +4 -7
  34. package/lib/cjs/Webform.js +40 -119
  35. package/lib/cjs/WebformBuilder.d.ts +6 -1
  36. package/lib/cjs/WebformBuilder.js +104 -64
  37. package/lib/cjs/Wizard.d.ts +8 -5
  38. package/lib/cjs/Wizard.js +14 -14
  39. package/lib/cjs/WizardBuilder.d.ts +6 -4
  40. package/lib/cjs/WizardBuilder.js +20 -3
  41. package/lib/cjs/addons/FormioAddon.d.ts +1 -1
  42. package/lib/cjs/addons/FormioAddon.js +1 -2
  43. package/lib/cjs/components/_classes/component/Component.d.ts +17 -8
  44. package/lib/cjs/components/_classes/component/Component.js +52 -18
  45. package/lib/cjs/components/_classes/input/Input.d.ts +1 -1
  46. package/lib/cjs/components/_classes/input/Input.js +1 -2
  47. package/lib/cjs/components/_classes/list/ListComponent.d.ts +4 -0
  48. package/lib/cjs/components/_classes/list/ListComponent.js +43 -6
  49. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +1 -0
  50. package/lib/cjs/components/_classes/multivalue/Multivalue.js +10 -4
  51. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +5 -2
  52. package/lib/cjs/components/_classes/nested/NestedComponent.js +11 -12
  53. package/lib/cjs/components/address/Address.d.ts +8 -0
  54. package/lib/cjs/components/button/Button.js +2 -3
  55. package/lib/cjs/components/checkbox/Checkbox.d.ts +13 -0
  56. package/lib/cjs/components/checkbox/Checkbox.js +17 -5
  57. package/lib/cjs/components/columns/Columns.d.ts +1 -0
  58. package/lib/cjs/components/columns/Columns.js +1 -0
  59. package/lib/cjs/components/container/Container.d.ts +1 -0
  60. package/lib/cjs/components/container/Container.js +1 -0
  61. package/lib/cjs/components/content/Content.d.ts +1 -0
  62. package/lib/cjs/components/content/Content.js +1 -2
  63. package/lib/cjs/components/currency/editForm/Currency.edit.data.d.ts +14 -2
  64. package/lib/cjs/components/currency/editForm/Currency.edit.data.js +4 -0
  65. package/lib/cjs/components/currency/editForm/Currency.edit.display.js +4 -0
  66. package/lib/cjs/components/datagrid/DataGrid.d.ts +1 -0
  67. package/lib/cjs/components/datagrid/DataGrid.js +8 -1
  68. package/lib/cjs/components/datamap/DataMap.js +1 -0
  69. package/lib/cjs/components/datetime/DateTime.d.ts +4 -0
  70. package/lib/cjs/components/datetime/DateTime.js +21 -1
  71. package/lib/cjs/components/day/Day.d.ts +1 -1
  72. package/lib/cjs/components/day/Day.js +22 -6
  73. package/lib/cjs/components/day/fixtures/comp3.js +2 -2
  74. package/lib/cjs/components/editgrid/EditGrid.d.ts +4 -3
  75. package/lib/cjs/components/editgrid/EditGrid.js +11 -6
  76. package/lib/cjs/components/editgrid/fixtures/comp-with-custom-default-value.d.ts +190 -0
  77. package/lib/cjs/components/editgrid/fixtures/comp-with-custom-default-value.js +227 -0
  78. package/lib/cjs/components/editgrid/fixtures/comp15.d.ts +54 -0
  79. package/lib/cjs/components/editgrid/fixtures/comp15.js +51 -0
  80. package/lib/cjs/components/editgrid/fixtures/index.d.ts +3 -1
  81. package/lib/cjs/components/editgrid/fixtures/index.js +5 -1
  82. package/lib/cjs/components/fieldset/Fieldset.d.ts +1 -0
  83. package/lib/cjs/components/fieldset/Fieldset.js +1 -0
  84. package/lib/cjs/components/file/File.d.ts +7 -5
  85. package/lib/cjs/components/file/File.js +26 -9
  86. package/lib/cjs/components/file/editForm/File.edit.file.d.ts +62 -0
  87. package/lib/cjs/components/file/editForm/File.edit.file.js +29 -2
  88. package/lib/cjs/components/form/Form.d.ts +3 -0
  89. package/lib/cjs/components/form/Form.js +9 -10
  90. package/lib/cjs/components/hidden/Hidden.d.ts +1 -0
  91. package/lib/cjs/components/hidden/Hidden.js +1 -0
  92. package/lib/cjs/components/html/HTML.d.ts +1 -0
  93. package/lib/cjs/components/html/HTML.js +1 -0
  94. package/lib/cjs/components/number/Number.d.ts +5 -1
  95. package/lib/cjs/components/number/Number.js +24 -7
  96. package/lib/cjs/components/phonenumber/PhoneNumber.form.js +9 -0
  97. package/lib/cjs/components/radio/Radio.d.ts +5 -3
  98. package/lib/cjs/components/radio/Radio.js +59 -18
  99. package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +1 -1
  100. package/lib/cjs/components/recaptcha/ReCaptcha.js +4 -5
  101. package/lib/cjs/components/resource/Resource.d.ts +7 -0
  102. package/lib/cjs/components/resource/Resource.js +0 -1
  103. package/lib/cjs/components/resource/editForm/Resource.edit.display.js +1 -1
  104. package/lib/cjs/components/select/Select.d.ts +7 -5
  105. package/lib/cjs/components/select/Select.js +15 -49
  106. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +12 -0
  107. package/lib/cjs/components/selectboxes/SelectBoxes.js +53 -25
  108. package/lib/cjs/components/selectboxes/fixtures/comp4.d.ts +30 -27
  109. package/lib/cjs/components/selectboxes/fixtures/comp4.js +47 -32
  110. package/lib/cjs/components/selectboxes/fixtures/comp6.d.ts +14 -0
  111. package/lib/cjs/components/selectboxes/fixtures/comp6.js +15 -0
  112. package/lib/cjs/components/selectboxes/fixtures/index.d.ts +2 -1
  113. package/lib/cjs/components/selectboxes/fixtures/index.js +3 -1
  114. package/lib/cjs/components/signature/Signature.d.ts +1 -1
  115. package/lib/cjs/components/signature/Signature.js +8 -3
  116. package/lib/cjs/components/survey/Survey.js +3 -0
  117. package/lib/cjs/components/table/Table.d.ts +1 -0
  118. package/lib/cjs/components/table/Table.js +1 -0
  119. package/lib/cjs/components/tabs/Tabs.d.ts +1 -0
  120. package/lib/cjs/components/tabs/Tabs.js +1 -0
  121. package/lib/cjs/components/tags/Tags.js +3 -0
  122. package/lib/cjs/components/textarea/TextArea.d.ts +3 -2
  123. package/lib/cjs/components/textarea/TextArea.js +4 -5
  124. package/lib/cjs/components/textarea/fixtures/comp4.d.ts +30 -0
  125. package/lib/cjs/components/textarea/fixtures/comp4.js +27 -0
  126. package/lib/cjs/components/textarea/fixtures/index.d.ts +2 -1
  127. package/lib/cjs/components/textarea/fixtures/index.js +3 -1
  128. package/lib/cjs/components/textfield/TextField.d.ts +1 -0
  129. package/lib/cjs/components/textfield/TextField.js +5 -3
  130. package/lib/cjs/components/time/Time.d.ts +4 -0
  131. package/lib/cjs/components/time/Time.js +6 -1
  132. package/lib/cjs/components/tree/Tree.d.ts +5 -4
  133. package/lib/cjs/components/tree/Tree.form.js +5 -0
  134. package/lib/cjs/components/tree/Tree.js +8 -9
  135. package/lib/cjs/components/tree/editForm/Tree.edit.display.d.ts +9 -0
  136. package/lib/cjs/components/tree/editForm/Tree.edit.display.js +12 -0
  137. package/lib/cjs/components/well/Well.d.ts +1 -0
  138. package/lib/cjs/components/well/Well.js +1 -0
  139. package/lib/cjs/providers/Providers.d.ts +31 -11
  140. package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +2 -2
  141. package/lib/cjs/providers/address/GoogleAddressProvider.js +2 -3
  142. package/lib/cjs/providers/processor/fileProcessor.d.ts +1 -1
  143. package/lib/cjs/providers/processor/fileProcessor.js +1 -5
  144. package/lib/cjs/providers/storage/azure.d.ts +10 -1
  145. package/lib/cjs/providers/storage/azure.js +7 -2
  146. package/lib/cjs/providers/storage/base64.d.ts +2 -2
  147. package/lib/cjs/providers/storage/base64.js +2 -6
  148. package/lib/cjs/providers/storage/dropbox.d.ts +2 -2
  149. package/lib/cjs/providers/storage/dropbox.js +2 -6
  150. package/lib/cjs/providers/storage/googleDrive.d.ts +3 -2
  151. package/lib/cjs/providers/storage/googleDrive.js +6 -6
  152. package/lib/cjs/providers/storage/indexeddb.d.ts +3 -3
  153. package/lib/cjs/providers/storage/indexeddb.js +9 -13
  154. package/lib/cjs/providers/storage/s3.d.ts +11 -1
  155. package/lib/cjs/providers/storage/s3.js +5 -2
  156. package/lib/cjs/providers/storage/uploadAdapter.js +1 -5
  157. package/lib/cjs/providers/storage/url.d.ts +2 -2
  158. package/lib/cjs/providers/storage/url.js +12 -8
  159. package/lib/cjs/providers/storage/xhr.d.ts +1 -1
  160. package/lib/cjs/providers/storage/xhr.js +1 -2
  161. package/lib/cjs/templates/index.d.ts +226 -1
  162. package/lib/cjs/utils/Evaluator.js +4 -33
  163. package/lib/cjs/utils/i18n.d.ts +16 -0
  164. package/lib/cjs/utils/i18n.js +88 -0
  165. package/lib/cjs/utils/utils.d.ts +1 -1
  166. package/lib/cjs/utils/utils.js +8 -9
  167. package/lib/cjs/validator/Validator.d.ts +30 -2
  168. package/lib/cjs/validator/Validator.js +32 -9
  169. package/lib/cjs/validator/rules/Select.js +1 -2
  170. package/lib/cjs/validator/rules/Unique.d.ts +1 -1
  171. package/lib/cjs/validator/rules/Unique.js +1 -2
  172. package/lib/cjs/widgets/CalendarWidget.d.ts +1 -0
  173. package/lib/cjs/widgets/InputWidget.d.ts +1 -1
  174. package/lib/cjs/widgets/InputWidget.js +1 -2
  175. package/lib/mjs/CDN.js +1 -1
  176. package/lib/mjs/Element.js +6 -2
  177. package/lib/mjs/Embed.js +4 -1
  178. package/lib/mjs/Form.d.ts +8 -5
  179. package/lib/mjs/Form.js +52 -10
  180. package/lib/mjs/PDF.d.ts +11 -3
  181. package/lib/mjs/PDF.js +4 -5
  182. package/lib/mjs/PDFBuilder.js +2 -3
  183. package/lib/mjs/Webform.d.ts +4 -7
  184. package/lib/mjs/Webform.js +40 -122
  185. package/lib/mjs/WebformBuilder.d.ts +6 -1
  186. package/lib/mjs/WebformBuilder.js +102 -64
  187. package/lib/mjs/Wizard.d.ts +8 -5
  188. package/lib/mjs/Wizard.js +14 -14
  189. package/lib/mjs/WizardBuilder.d.ts +6 -4
  190. package/lib/mjs/WizardBuilder.js +20 -3
  191. package/lib/mjs/addons/FormioAddon.d.ts +1 -1
  192. package/lib/mjs/addons/FormioAddon.js +1 -2
  193. package/lib/mjs/components/_classes/component/Component.d.ts +17 -8
  194. package/lib/mjs/components/_classes/component/Component.js +52 -18
  195. package/lib/mjs/components/_classes/input/Input.d.ts +1 -1
  196. package/lib/mjs/components/_classes/input/Input.js +1 -2
  197. package/lib/mjs/components/_classes/list/ListComponent.d.ts +4 -0
  198. package/lib/mjs/components/_classes/list/ListComponent.js +43 -5
  199. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +1 -0
  200. package/lib/mjs/components/_classes/multivalue/Multivalue.js +10 -4
  201. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +5 -2
  202. package/lib/mjs/components/_classes/nested/NestedComponent.js +11 -12
  203. package/lib/mjs/components/address/Address.d.ts +8 -0
  204. package/lib/mjs/components/button/Button.js +2 -3
  205. package/lib/mjs/components/checkbox/Checkbox.d.ts +13 -0
  206. package/lib/mjs/components/checkbox/Checkbox.js +21 -5
  207. package/lib/mjs/components/columns/Columns.d.ts +1 -0
  208. package/lib/mjs/components/columns/Columns.js +1 -0
  209. package/lib/mjs/components/container/Container.d.ts +1 -0
  210. package/lib/mjs/components/container/Container.js +1 -0
  211. package/lib/mjs/components/content/Content.d.ts +1 -0
  212. package/lib/mjs/components/content/Content.js +1 -2
  213. package/lib/mjs/components/currency/editForm/Currency.edit.data.d.ts +14 -2
  214. package/lib/mjs/components/currency/editForm/Currency.edit.data.js +4 -0
  215. package/lib/mjs/components/currency/editForm/Currency.edit.display.js +4 -0
  216. package/lib/mjs/components/datagrid/DataGrid.d.ts +1 -0
  217. package/lib/mjs/components/datagrid/DataGrid.js +8 -1
  218. package/lib/mjs/components/datamap/DataMap.js +1 -0
  219. package/lib/mjs/components/datetime/DateTime.d.ts +4 -0
  220. package/lib/mjs/components/datetime/DateTime.js +28 -1
  221. package/lib/mjs/components/day/Day.d.ts +1 -1
  222. package/lib/mjs/components/day/Day.js +25 -6
  223. package/lib/mjs/components/day/fixtures/comp3.js +2 -2
  224. package/lib/mjs/components/editgrid/EditGrid.d.ts +4 -3
  225. package/lib/mjs/components/editgrid/EditGrid.js +11 -6
  226. package/lib/mjs/components/editgrid/fixtures/comp-with-custom-default-value.d.ts +190 -0
  227. package/lib/mjs/components/editgrid/fixtures/comp-with-custom-default-value.js +225 -0
  228. package/lib/mjs/components/editgrid/fixtures/comp15.d.ts +54 -0
  229. package/lib/mjs/components/editgrid/fixtures/comp15.js +49 -0
  230. package/lib/mjs/components/editgrid/fixtures/index.d.ts +3 -1
  231. package/lib/mjs/components/editgrid/fixtures/index.js +3 -1
  232. package/lib/mjs/components/fieldset/Fieldset.d.ts +1 -0
  233. package/lib/mjs/components/fieldset/Fieldset.js +1 -0
  234. package/lib/mjs/components/file/File.d.ts +7 -5
  235. package/lib/mjs/components/file/File.js +29 -9
  236. package/lib/mjs/components/file/editForm/File.edit.file.d.ts +62 -0
  237. package/lib/mjs/components/file/editForm/File.edit.file.js +29 -2
  238. package/lib/mjs/components/form/Form.d.ts +3 -0
  239. package/lib/mjs/components/form/Form.js +9 -10
  240. package/lib/mjs/components/hidden/Hidden.d.ts +1 -0
  241. package/lib/mjs/components/hidden/Hidden.js +1 -0
  242. package/lib/mjs/components/html/HTML.d.ts +1 -0
  243. package/lib/mjs/components/html/HTML.js +1 -0
  244. package/lib/mjs/components/number/Number.d.ts +5 -1
  245. package/lib/mjs/components/number/Number.js +24 -7
  246. package/lib/mjs/components/phonenumber/PhoneNumber.form.js +9 -0
  247. package/lib/mjs/components/radio/Radio.d.ts +5 -3
  248. package/lib/mjs/components/radio/Radio.js +59 -18
  249. package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +1 -1
  250. package/lib/mjs/components/recaptcha/ReCaptcha.js +4 -5
  251. package/lib/mjs/components/resource/Resource.d.ts +7 -0
  252. package/lib/mjs/components/resource/Resource.js +0 -1
  253. package/lib/mjs/components/resource/editForm/Resource.edit.display.js +1 -1
  254. package/lib/mjs/components/select/Select.d.ts +7 -5
  255. package/lib/mjs/components/select/Select.js +18 -49
  256. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +12 -0
  257. package/lib/mjs/components/selectboxes/SelectBoxes.js +56 -25
  258. package/lib/mjs/components/selectboxes/fixtures/comp4.d.ts +30 -27
  259. package/lib/mjs/components/selectboxes/fixtures/comp4.js +47 -32
  260. package/lib/mjs/components/selectboxes/fixtures/comp6.d.ts +14 -0
  261. package/lib/mjs/components/selectboxes/fixtures/comp6.js +13 -0
  262. package/lib/mjs/components/selectboxes/fixtures/index.d.ts +2 -1
  263. package/lib/mjs/components/selectboxes/fixtures/index.js +2 -1
  264. package/lib/mjs/components/signature/Signature.d.ts +1 -1
  265. package/lib/mjs/components/signature/Signature.js +11 -3
  266. package/lib/mjs/components/survey/Survey.js +6 -0
  267. package/lib/mjs/components/table/Table.d.ts +1 -0
  268. package/lib/mjs/components/table/Table.js +1 -0
  269. package/lib/mjs/components/tabs/Tabs.d.ts +1 -0
  270. package/lib/mjs/components/tabs/Tabs.js +1 -0
  271. package/lib/mjs/components/tags/Tags.js +6 -0
  272. package/lib/mjs/components/textarea/TextArea.d.ts +3 -2
  273. package/lib/mjs/components/textarea/TextArea.js +4 -5
  274. package/lib/mjs/components/textarea/fixtures/comp4.d.ts +30 -0
  275. package/lib/mjs/components/textarea/fixtures/comp4.js +25 -0
  276. package/lib/mjs/components/textarea/fixtures/index.d.ts +2 -1
  277. package/lib/mjs/components/textarea/fixtures/index.js +2 -1
  278. package/lib/mjs/components/textfield/TextField.d.ts +1 -0
  279. package/lib/mjs/components/textfield/TextField.js +8 -3
  280. package/lib/mjs/components/time/Time.d.ts +4 -0
  281. package/lib/mjs/components/time/Time.js +12 -1
  282. package/lib/mjs/components/tree/Tree.d.ts +5 -4
  283. package/lib/mjs/components/tree/Tree.form.js +5 -0
  284. package/lib/mjs/components/tree/Tree.js +8 -9
  285. package/lib/mjs/components/tree/editForm/Tree.edit.display.d.ts +9 -0
  286. package/lib/mjs/components/tree/editForm/Tree.edit.display.js +10 -0
  287. package/lib/mjs/components/well/Well.d.ts +1 -0
  288. package/lib/mjs/components/well/Well.js +1 -0
  289. package/lib/mjs/providers/Providers.d.ts +31 -11
  290. package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +2 -2
  291. package/lib/mjs/providers/address/GoogleAddressProvider.js +2 -3
  292. package/lib/mjs/providers/processor/fileProcessor.d.ts +1 -1
  293. package/lib/mjs/providers/processor/fileProcessor.js +1 -2
  294. package/lib/mjs/providers/storage/azure.d.ts +10 -1
  295. package/lib/mjs/providers/storage/azure.js +7 -2
  296. package/lib/mjs/providers/storage/base64.d.ts +2 -2
  297. package/lib/mjs/providers/storage/base64.js +2 -3
  298. package/lib/mjs/providers/storage/dropbox.d.ts +2 -2
  299. package/lib/mjs/providers/storage/dropbox.js +2 -3
  300. package/lib/mjs/providers/storage/googleDrive.d.ts +3 -2
  301. package/lib/mjs/providers/storage/googleDrive.js +6 -3
  302. package/lib/mjs/providers/storage/indexeddb.d.ts +3 -3
  303. package/lib/mjs/providers/storage/indexeddb.js +9 -10
  304. package/lib/mjs/providers/storage/s3.d.ts +11 -1
  305. package/lib/mjs/providers/storage/s3.js +5 -2
  306. package/lib/mjs/providers/storage/uploadAdapter.js +1 -2
  307. package/lib/mjs/providers/storage/url.d.ts +2 -2
  308. package/lib/mjs/providers/storage/url.js +12 -5
  309. package/lib/mjs/providers/storage/xhr.d.ts +1 -1
  310. package/lib/mjs/providers/storage/xhr.js +1 -2
  311. package/lib/mjs/templates/index.d.ts +226 -1
  312. package/lib/mjs/utils/Evaluator.js +4 -33
  313. package/lib/mjs/utils/i18n.d.ts +16 -0
  314. package/lib/mjs/utils/i18n.js +81 -0
  315. package/lib/mjs/utils/utils.d.ts +1 -1
  316. package/lib/mjs/utils/utils.js +8 -9
  317. package/lib/mjs/validator/Validator.d.ts +30 -2
  318. package/lib/mjs/validator/Validator.js +31 -9
  319. package/lib/mjs/validator/rules/Select.js +1 -2
  320. package/lib/mjs/validator/rules/Unique.d.ts +1 -1
  321. package/lib/mjs/validator/rules/Unique.js +1 -2
  322. package/lib/mjs/widgets/CalendarWidget.d.ts +1 -0
  323. package/lib/mjs/widgets/InputWidget.d.ts +1 -1
  324. package/lib/mjs/widgets/InputWidget.js +1 -2
  325. package/package.json +24 -25
@@ -10,14 +10,9 @@
10
10
  * MIT licensed
11
11
  */
12
12
 
13
- /*! @license DOMPurify 3.0.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.3/LICENSE */
13
+ /*! @license DOMPurify 3.0.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.5/LICENSE */
14
14
 
15
- /*! Native Promise Only
16
- v0.8.1 (c) Kyle Simpson
17
- MIT License: http://getify.mit-license.org
18
- */
19
-
20
- /*! formiojs v5.0.0-rc.18 | https://unpkg.com/formiojs@5.0.0-rc.18/LICENSE.txt */
15
+ /*! formiojs v5.0.0-rc.20 | https://unpkg.com/formiojs@5.0.0-rc.20/LICENSE.txt */
21
16
 
22
17
  /**
23
18
  * @license
package/lib/cjs/CDN.js CHANGED
@@ -13,7 +13,7 @@ class CDN {
13
13
  'bootstrap': '4.6.2',
14
14
  'ckeditor': '19.0.0',
15
15
  'flatpickr': '4.6.8',
16
- 'flatpickr-formio': '4.6.13-formio.2',
16
+ 'flatpickr-formio': '4.6.13-formio.3',
17
17
  'font-awesome': '4.7.0',
18
18
  'grid': 'latest',
19
19
  'moment-timezone': 'latest',
@@ -29,7 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
29
  const EventEmitter_1 = __importDefault(require("./EventEmitter"));
30
30
  const Formio_1 = require("./Formio");
31
31
  const FormioUtils = __importStar(require("./utils/utils"));
32
- const i18next_1 = __importDefault(require("i18next"));
32
+ const i18n_1 = require("./utils/i18n");
33
33
  const lodash_1 = __importDefault(require("lodash"));
34
34
  const moment_1 = __importDefault(require("moment"));
35
35
  const vanilla_text_mask_1 = __importDefault(require("@formio/vanilla-text-mask"));
@@ -38,6 +38,7 @@ const vanilla_text_mask_1 = __importDefault(require("@formio/vanilla-text-mask")
38
38
  */
39
39
  class Element {
40
40
  constructor(options) {
41
+ var _a;
41
42
  /**
42
43
  * The options for this component.
43
44
  * @type {{}}
@@ -62,7 +63,11 @@ class Element {
62
63
  */
63
64
  this.eventHandlers = [];
64
65
  // Use the i18next that is passed in, otherwise use the global version.
65
- this.i18next = this.options.i18next || i18next_1.default;
66
+ this.options.i18n = this.options.i18n || {};
67
+ if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.language) {
68
+ this.options.i18n.language = this.options.language;
69
+ }
70
+ this.options.i18next = this.i18next = this.options.i18next || i18n_1.I18n.init(this.options.i18n);
66
71
  /**
67
72
  * An instance of the EventEmitter class to handle the emitting and registration of events.
68
73
  *
package/lib/cjs/Embed.js CHANGED
@@ -211,7 +211,7 @@ function embed(config = {}) {
211
211
  debug('Creating form', form, config.config);
212
212
  isReady.then(() => {
213
213
  Formio.license = true;
214
- Formio.createForm(formElement, form, config.config).then((instance) => {
214
+ Formio.createForm(formElement, form, Object.assign(Object.assign({}, config.config), { noLoader: true })).then((instance) => {
215
215
  const submitDone = (submission) => {
216
216
  debug('Submision Complete', submission);
217
217
  let returnUrl = config.redirect;
package/lib/cjs/Form.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export default class Form extends Element {
2
- static embed(embed: any): any;
2
+ static embed(embed: any): Promise<any>;
3
3
  /**
4
4
  * Creates an easy to use interface for embedding webforms, pdfs, and wizards into your application.
5
5
  *
@@ -17,13 +17,16 @@ export default class Form extends Element {
17
17
  * form.build();
18
18
  */
19
19
  constructor(...args: any[]);
20
- ready: any;
21
- readyResolve: any;
22
- readyReject: any;
20
+ ready: Promise<any>;
21
+ readyResolve: (value: any) => void;
22
+ readyReject: (reason?: any) => void;
23
23
  instance: any;
24
24
  element: any;
25
25
  options: any;
26
26
  display: string;
27
+ createElement(tag: any, attrs: any, children: any): any;
28
+ set loading(arg: any);
29
+ loader: any;
27
30
  /**
28
31
  * Create a new form instance provided the display of the form.
29
32
  *
@@ -84,7 +87,7 @@ export default class Form extends Element {
84
87
  * @return {Promise<T>}
85
88
  */
86
89
  build(): Promise<T>;
87
- render(): any;
90
+ render(): Promise<any>;
88
91
  attach(element: any): any;
89
92
  }
90
93
  import Element from './Element';
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.
@@ -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;
@@ -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
  /**
@@ -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,10 +362,10 @@ 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
  /**
@@ -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}
@@ -207,7 +170,7 @@ class Webform extends NestedDataComponent_1.default {
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
  *
@@ -233,7 +196,7 @@ class Webform extends NestedDataComponent_1.default {
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.
@@ -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();
@@ -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() {
@@ -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 {