@formio/js 5.0.0-rc.53 → 5.0.0-rc.55

Sign up to get free protection for your applications and to get access to all the features.
Files changed (350) hide show
  1. package/dist/formio.embed.js +1 -1
  2. package/dist/formio.embed.min.js +1 -1
  3. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  4. package/dist/formio.form.js +563 -563
  5. package/dist/formio.form.min.js +1 -1
  6. package/dist/formio.form.min.js.LICENSE.txt +3 -3
  7. package/dist/formio.full.js +606 -606
  8. package/dist/formio.full.min.js +1 -1
  9. package/dist/formio.full.min.js.LICENSE.txt +3 -3
  10. package/dist/formio.js +3 -3
  11. package/dist/formio.min.js +1 -1
  12. package/dist/formio.min.js.LICENSE.txt +1 -1
  13. package/dist/formio.utils.js +16 -16
  14. package/dist/formio.utils.min.js +1 -1
  15. package/dist/formio.utils.min.js.LICENSE.txt +3 -3
  16. package/embed.d.ts +1 -0
  17. package/form.d.ts +1 -0
  18. package/lib/cjs/Element.d.ts +3 -2
  19. package/lib/cjs/Element.js +4 -3
  20. package/lib/cjs/Form.d.ts +99 -36
  21. package/lib/cjs/Form.js +23 -18
  22. package/lib/cjs/InlineEmbed.d.ts +7 -0
  23. package/lib/cjs/InlineEmbed.js +109 -0
  24. package/lib/cjs/PDF.d.ts +8 -7
  25. package/lib/cjs/PDF.js +6 -5
  26. package/lib/cjs/Webform.d.ts +0 -3
  27. package/lib/cjs/Webform.js +18 -15
  28. package/lib/cjs/WebformBuilder.d.ts +15 -14
  29. package/lib/cjs/WebformBuilder.js +11 -10
  30. package/lib/cjs/Wizard.d.ts +0 -11
  31. package/lib/cjs/Wizard.js +16 -14
  32. package/lib/cjs/WizardBuilder.d.ts +1 -1
  33. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +2 -2
  34. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.form.d.ts +2 -2
  35. package/lib/cjs/addons/index.d.ts +2 -2
  36. package/lib/cjs/components/Components.d.ts +6 -5
  37. package/lib/cjs/components/Components.js +2 -1
  38. package/lib/cjs/components/_classes/component/Component.form.d.ts +4 -5
  39. package/lib/cjs/components/_classes/component/Component.form.js +3 -2
  40. package/lib/cjs/components/_classes/component/Component.js +3 -2
  41. package/lib/cjs/components/_classes/component/editForm/Component.edit.addons.d.ts +2 -2
  42. package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.d.ts +1 -1
  43. package/lib/cjs/components/_classes/component/editForm/Component.edit.data.d.ts +1 -1
  44. package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.d.ts +1 -1
  45. package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +2 -2
  46. package/lib/cjs/components/_classes/component/editForm/utils.d.ts +1 -1
  47. package/lib/cjs/components/_classes/component/editForm/utils.js +2 -2
  48. package/lib/cjs/components/_classes/list/ListComponent.d.ts +2 -2
  49. package/lib/cjs/components/_classes/list/ListComponent.form.d.ts +4 -4
  50. package/lib/cjs/components/_classes/list/ListComponent.form.js +3 -3
  51. package/lib/cjs/components/_classes/nested/NestedComponent.form.d.ts +4 -5
  52. package/lib/cjs/components/_classes/nested/NestedComponent.form.js +3 -2
  53. package/lib/cjs/components/_classes/nested/NestedComponent.js +0 -2
  54. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -1
  55. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +1 -1
  56. package/lib/cjs/components/address/Address.form.d.ts +4 -5
  57. package/lib/cjs/components/address/Address.form.js +3 -2
  58. package/lib/cjs/components/button/Button.form.d.ts +4 -5
  59. package/lib/cjs/components/button/Button.form.js +3 -2
  60. package/lib/cjs/components/button/Button.js +3 -2
  61. package/lib/cjs/components/checkbox/Checkbox.form.d.ts +4 -5
  62. package/lib/cjs/components/checkbox/Checkbox.form.js +3 -2
  63. package/lib/cjs/components/checkbox/Checkbox.js +2 -9
  64. package/lib/cjs/components/checkbox/fixtures/comp5.d.ts +34 -0
  65. package/lib/cjs/components/checkbox/fixtures/comp5.js +55 -0
  66. package/lib/cjs/components/checkbox/fixtures/index.d.ts +2 -1
  67. package/lib/cjs/components/checkbox/fixtures/index.js +3 -1
  68. package/lib/cjs/components/columns/Columns.d.ts +1 -1
  69. package/lib/cjs/components/columns/Columns.form.d.ts +4 -5
  70. package/lib/cjs/components/columns/Columns.form.js +3 -2
  71. package/lib/cjs/components/columns/Columns.js +1 -1
  72. package/lib/cjs/components/container/Container.form.d.ts +4 -5
  73. package/lib/cjs/components/container/Container.form.js +3 -2
  74. package/lib/cjs/components/content/Content.form.d.ts +4 -5
  75. package/lib/cjs/components/content/Content.form.js +3 -2
  76. package/lib/cjs/components/currency/Currency.form.d.ts +4 -5
  77. package/lib/cjs/components/currency/Currency.form.js +3 -2
  78. package/lib/cjs/components/currency/Currency.js +1 -1
  79. package/lib/cjs/components/datagrid/DataGrid.d.ts +4 -4
  80. package/lib/cjs/components/datagrid/DataGrid.form.d.ts +4 -5
  81. package/lib/cjs/components/datagrid/DataGrid.form.js +3 -2
  82. package/lib/cjs/components/datagrid/DataGrid.js +4 -4
  83. package/lib/cjs/components/datamap/DataMap.form.d.ts +4 -5
  84. package/lib/cjs/components/datamap/DataMap.form.js +3 -2
  85. package/lib/cjs/components/datetime/DateTime.form.d.ts +4 -5
  86. package/lib/cjs/components/datetime/DateTime.form.js +3 -2
  87. package/lib/cjs/components/datetime/editForm/DateTime.edit.date.d.ts +1 -1
  88. package/lib/cjs/components/datetime/editForm/DateTime.edit.date.js +2 -2
  89. package/lib/cjs/components/day/Day.d.ts +18 -23
  90. package/lib/cjs/components/day/Day.form.d.ts +4 -5
  91. package/lib/cjs/components/day/Day.form.js +3 -2
  92. package/lib/cjs/components/day/Day.js +15 -14
  93. package/lib/cjs/components/editgrid/EditGrid.d.ts +4 -3
  94. package/lib/cjs/components/editgrid/EditGrid.form.d.ts +4 -5
  95. package/lib/cjs/components/editgrid/EditGrid.form.js +3 -2
  96. package/lib/cjs/components/editgrid/EditGrid.js +3 -3
  97. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +2 -5
  98. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.templates.d.ts +1 -1
  99. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.templates.js +6 -9
  100. package/lib/cjs/components/email/Email.form.d.ts +4 -5
  101. package/lib/cjs/components/email/Email.form.js +3 -2
  102. package/lib/cjs/components/fieldset/Fieldset.form.d.ts +4 -5
  103. package/lib/cjs/components/fieldset/Fieldset.form.js +3 -2
  104. package/lib/cjs/components/file/File.form.d.ts +4 -5
  105. package/lib/cjs/components/file/File.form.js +3 -2
  106. package/lib/cjs/components/form/Form.d.ts +23 -20
  107. package/lib/cjs/components/form/Form.form.d.ts +4 -5
  108. package/lib/cjs/components/form/Form.form.js +3 -2
  109. package/lib/cjs/components/form/Form.js +18 -11
  110. package/lib/cjs/components/form/editForm/Form.edit.data.d.ts +1 -1
  111. package/lib/cjs/components/form/fixtures/comp7.d.ts +36 -0
  112. package/lib/cjs/components/form/fixtures/comp7.js +37 -0
  113. package/lib/cjs/components/form/fixtures/comp8.d.ts +26 -0
  114. package/lib/cjs/components/form/fixtures/comp8.js +29 -0
  115. package/lib/cjs/components/form/fixtures/index.d.ts +3 -1
  116. package/lib/cjs/components/form/fixtures/index.js +5 -1
  117. package/lib/cjs/components/hidden/Hidden.form.d.ts +4 -5
  118. package/lib/cjs/components/hidden/Hidden.form.js +3 -2
  119. package/lib/cjs/components/hidden/Hidden.js +1 -1
  120. package/lib/cjs/components/html/HTML.form.d.ts +4 -5
  121. package/lib/cjs/components/html/HTML.form.js +3 -2
  122. package/lib/cjs/components/number/Number.d.ts +1 -1
  123. package/lib/cjs/components/number/Number.form.d.ts +4 -5
  124. package/lib/cjs/components/number/Number.form.js +3 -2
  125. package/lib/cjs/components/number/Number.js +1 -1
  126. package/lib/cjs/components/panel/Panel.form.d.ts +4 -5
  127. package/lib/cjs/components/panel/Panel.form.js +3 -2
  128. package/lib/cjs/components/panel/editForm/Panel.edit.conditional.d.ts +1 -1
  129. package/lib/cjs/components/password/Password.form.d.ts +4 -5
  130. package/lib/cjs/components/password/Password.form.js +3 -2
  131. package/lib/cjs/components/phonenumber/PhoneNumber.form.d.ts +4 -5
  132. package/lib/cjs/components/phonenumber/PhoneNumber.form.js +3 -2
  133. package/lib/cjs/components/radio/Radio.form.d.ts +4 -3
  134. package/lib/cjs/components/radio/Radio.form.js +3 -2
  135. package/lib/cjs/components/recaptcha/ReCaptcha.form.d.ts +3 -4
  136. package/lib/cjs/components/recaptcha/ReCaptcha.form.js +2 -1
  137. package/lib/cjs/components/select/Select.d.ts +2 -2
  138. package/lib/cjs/components/select/Select.form.d.ts +4 -3
  139. package/lib/cjs/components/select/Select.form.js +3 -2
  140. package/lib/cjs/components/select/Select.js +1 -1
  141. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +2 -8
  142. package/lib/cjs/components/selectboxes/SelectBoxes.form.d.ts +4 -3
  143. package/lib/cjs/components/selectboxes/SelectBoxes.form.js +3 -2
  144. package/lib/cjs/components/selectboxes/SelectBoxes.js +7 -6
  145. package/lib/cjs/components/signature/Signature.form.d.ts +4 -5
  146. package/lib/cjs/components/signature/Signature.form.js +3 -2
  147. package/lib/cjs/components/survey/Survey.form.d.ts +4 -5
  148. package/lib/cjs/components/survey/Survey.form.js +3 -2
  149. package/lib/cjs/components/table/Table.form.d.ts +4 -5
  150. package/lib/cjs/components/table/Table.form.js +3 -2
  151. package/lib/cjs/components/tabs/Tabs.d.ts +2 -2
  152. package/lib/cjs/components/tabs/Tabs.form.d.ts +4 -5
  153. package/lib/cjs/components/tabs/Tabs.form.js +3 -2
  154. package/lib/cjs/components/tabs/Tabs.js +1 -1
  155. package/lib/cjs/components/tags/Tags.form.d.ts +4 -5
  156. package/lib/cjs/components/tags/Tags.form.js +3 -2
  157. package/lib/cjs/components/textarea/TextArea.d.ts +3 -3
  158. package/lib/cjs/components/textarea/TextArea.form.d.ts +4 -5
  159. package/lib/cjs/components/textarea/TextArea.form.js +3 -2
  160. package/lib/cjs/components/textarea/TextArea.js +2 -2
  161. package/lib/cjs/components/textfield/TextField.d.ts +12 -19
  162. package/lib/cjs/components/textfield/TextField.form.d.ts +4 -5
  163. package/lib/cjs/components/textfield/TextField.form.js +3 -2
  164. package/lib/cjs/components/textfield/TextField.js +13 -12
  165. package/lib/cjs/components/time/Time.form.d.ts +4 -5
  166. package/lib/cjs/components/time/Time.form.js +3 -2
  167. package/lib/cjs/components/unknown/Unknown.form.d.ts +3 -35
  168. package/lib/cjs/components/unknown/Unknown.form.js +2 -1
  169. package/lib/cjs/components/url/Url.form.d.ts +4 -5
  170. package/lib/cjs/components/url/Url.form.js +3 -2
  171. package/lib/cjs/components/well/Well.form.d.ts +4 -5
  172. package/lib/cjs/components/well/Well.form.js +3 -2
  173. package/lib/cjs/formio.embed.d.ts +1 -2
  174. package/lib/cjs/formio.embed.js +2 -100
  175. package/lib/cjs/formio.form.js +2 -2
  176. package/lib/cjs/utils/Evaluator.d.ts +0 -1
  177. package/lib/cjs/utils/Evaluator.js +2 -5
  178. package/lib/cjs/utils/formUtils.d.ts +1 -1
  179. package/lib/cjs/utils/utils.d.ts +106 -83
  180. package/lib/cjs/utils/utils.js +96 -140
  181. package/lib/cjs/widgets/CalendarWidget.d.ts +8 -7
  182. package/lib/cjs/widgets/CalendarWidget.js +8 -7
  183. package/lib/mjs/Element.d.ts +3 -2
  184. package/lib/mjs/Element.js +4 -3
  185. package/lib/mjs/Form.d.ts +99 -36
  186. package/lib/mjs/Form.js +43 -38
  187. package/lib/mjs/InlineEmbed.d.ts +7 -0
  188. package/lib/mjs/InlineEmbed.js +105 -0
  189. package/lib/mjs/PDF.d.ts +8 -7
  190. package/lib/mjs/PDF.js +6 -5
  191. package/lib/mjs/Webform.d.ts +0 -3
  192. package/lib/mjs/Webform.js +18 -15
  193. package/lib/mjs/WebformBuilder.d.ts +15 -14
  194. package/lib/mjs/WebformBuilder.js +11 -10
  195. package/lib/mjs/Wizard.d.ts +0 -11
  196. package/lib/mjs/Wizard.js +14 -12
  197. package/lib/mjs/WizardBuilder.d.ts +1 -1
  198. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +2 -2
  199. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.form.d.ts +2 -2
  200. package/lib/mjs/addons/index.d.ts +2 -2
  201. package/lib/mjs/components/Components.d.ts +6 -5
  202. package/lib/mjs/components/Components.js +2 -1
  203. package/lib/mjs/components/_classes/component/Component.form.d.ts +4 -5
  204. package/lib/mjs/components/_classes/component/Component.form.js +3 -2
  205. package/lib/mjs/components/_classes/component/Component.js +3 -2
  206. package/lib/mjs/components/_classes/component/editForm/Component.edit.addons.d.ts +2 -2
  207. package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.d.ts +1 -1
  208. package/lib/mjs/components/_classes/component/editForm/Component.edit.data.d.ts +1 -1
  209. package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.d.ts +1 -1
  210. package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +1 -1
  211. package/lib/mjs/components/_classes/component/editForm/utils.d.ts +1 -1
  212. package/lib/mjs/components/_classes/component/editForm/utils.js +1 -1
  213. package/lib/mjs/components/_classes/list/ListComponent.d.ts +2 -2
  214. package/lib/mjs/components/_classes/list/ListComponent.form.d.ts +4 -4
  215. package/lib/mjs/components/_classes/list/ListComponent.form.js +3 -3
  216. package/lib/mjs/components/_classes/nested/NestedComponent.form.d.ts +4 -5
  217. package/lib/mjs/components/_classes/nested/NestedComponent.form.js +3 -2
  218. package/lib/mjs/components/_classes/nested/NestedComponent.js +0 -2
  219. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -1
  220. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +1 -1
  221. package/lib/mjs/components/address/Address.form.d.ts +4 -5
  222. package/lib/mjs/components/address/Address.form.js +3 -2
  223. package/lib/mjs/components/button/Button.form.d.ts +4 -5
  224. package/lib/mjs/components/button/Button.form.js +3 -2
  225. package/lib/mjs/components/button/Button.js +3 -2
  226. package/lib/mjs/components/checkbox/Checkbox.form.d.ts +4 -5
  227. package/lib/mjs/components/checkbox/Checkbox.form.js +3 -2
  228. package/lib/mjs/components/checkbox/Checkbox.js +2 -9
  229. package/lib/mjs/components/checkbox/fixtures/comp5.d.ts +34 -0
  230. package/lib/mjs/components/checkbox/fixtures/comp5.js +53 -0
  231. package/lib/mjs/components/checkbox/fixtures/index.d.ts +2 -1
  232. package/lib/mjs/components/checkbox/fixtures/index.js +2 -1
  233. package/lib/mjs/components/columns/Columns.d.ts +1 -1
  234. package/lib/mjs/components/columns/Columns.form.d.ts +4 -5
  235. package/lib/mjs/components/columns/Columns.form.js +3 -2
  236. package/lib/mjs/components/columns/Columns.js +1 -1
  237. package/lib/mjs/components/container/Container.form.d.ts +4 -5
  238. package/lib/mjs/components/container/Container.form.js +3 -2
  239. package/lib/mjs/components/content/Content.form.d.ts +4 -5
  240. package/lib/mjs/components/content/Content.form.js +3 -2
  241. package/lib/mjs/components/currency/Currency.form.d.ts +4 -5
  242. package/lib/mjs/components/currency/Currency.form.js +3 -2
  243. package/lib/mjs/components/currency/Currency.js +1 -1
  244. package/lib/mjs/components/datagrid/DataGrid.d.ts +4 -4
  245. package/lib/mjs/components/datagrid/DataGrid.form.d.ts +4 -5
  246. package/lib/mjs/components/datagrid/DataGrid.form.js +3 -2
  247. package/lib/mjs/components/datagrid/DataGrid.js +4 -4
  248. package/lib/mjs/components/datamap/DataMap.form.d.ts +4 -5
  249. package/lib/mjs/components/datamap/DataMap.form.js +3 -2
  250. package/lib/mjs/components/datetime/DateTime.form.d.ts +4 -5
  251. package/lib/mjs/components/datetime/DateTime.form.js +3 -2
  252. package/lib/mjs/components/datetime/editForm/DateTime.edit.date.d.ts +1 -1
  253. package/lib/mjs/components/datetime/editForm/DateTime.edit.date.js +1 -1
  254. package/lib/mjs/components/day/Day.d.ts +18 -23
  255. package/lib/mjs/components/day/Day.form.d.ts +4 -5
  256. package/lib/mjs/components/day/Day.form.js +3 -2
  257. package/lib/mjs/components/day/Day.js +15 -14
  258. package/lib/mjs/components/editgrid/EditGrid.d.ts +4 -3
  259. package/lib/mjs/components/editgrid/EditGrid.form.d.ts +4 -5
  260. package/lib/mjs/components/editgrid/EditGrid.form.js +3 -2
  261. package/lib/mjs/components/editgrid/EditGrid.js +3 -3
  262. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
  263. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.templates.d.ts +1 -1
  264. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.templates.js +1 -1
  265. package/lib/mjs/components/email/Email.form.d.ts +4 -5
  266. package/lib/mjs/components/email/Email.form.js +3 -2
  267. package/lib/mjs/components/fieldset/Fieldset.form.d.ts +4 -5
  268. package/lib/mjs/components/fieldset/Fieldset.form.js +3 -2
  269. package/lib/mjs/components/file/File.form.d.ts +4 -5
  270. package/lib/mjs/components/file/File.form.js +3 -2
  271. package/lib/mjs/components/form/Form.d.ts +23 -20
  272. package/lib/mjs/components/form/Form.form.d.ts +4 -5
  273. package/lib/mjs/components/form/Form.form.js +3 -2
  274. package/lib/mjs/components/form/Form.js +18 -11
  275. package/lib/mjs/components/form/editForm/Form.edit.data.d.ts +1 -1
  276. package/lib/mjs/components/form/fixtures/comp7.d.ts +36 -0
  277. package/lib/mjs/components/form/fixtures/comp7.js +35 -0
  278. package/lib/mjs/components/form/fixtures/comp8.d.ts +26 -0
  279. package/lib/mjs/components/form/fixtures/comp8.js +27 -0
  280. package/lib/mjs/components/form/fixtures/index.d.ts +3 -1
  281. package/lib/mjs/components/form/fixtures/index.js +3 -1
  282. package/lib/mjs/components/hidden/Hidden.form.d.ts +4 -5
  283. package/lib/mjs/components/hidden/Hidden.form.js +3 -2
  284. package/lib/mjs/components/hidden/Hidden.js +1 -1
  285. package/lib/mjs/components/html/HTML.form.d.ts +4 -5
  286. package/lib/mjs/components/html/HTML.form.js +3 -2
  287. package/lib/mjs/components/number/Number.d.ts +1 -1
  288. package/lib/mjs/components/number/Number.form.d.ts +4 -5
  289. package/lib/mjs/components/number/Number.form.js +3 -2
  290. package/lib/mjs/components/number/Number.js +1 -1
  291. package/lib/mjs/components/panel/Panel.form.d.ts +4 -5
  292. package/lib/mjs/components/panel/Panel.form.js +3 -2
  293. package/lib/mjs/components/panel/editForm/Panel.edit.conditional.d.ts +1 -1
  294. package/lib/mjs/components/password/Password.form.d.ts +4 -5
  295. package/lib/mjs/components/password/Password.form.js +3 -2
  296. package/lib/mjs/components/phonenumber/PhoneNumber.form.d.ts +4 -5
  297. package/lib/mjs/components/phonenumber/PhoneNumber.form.js +3 -2
  298. package/lib/mjs/components/radio/Radio.form.d.ts +4 -3
  299. package/lib/mjs/components/radio/Radio.form.js +3 -2
  300. package/lib/mjs/components/recaptcha/ReCaptcha.form.d.ts +3 -4
  301. package/lib/mjs/components/recaptcha/ReCaptcha.form.js +2 -1
  302. package/lib/mjs/components/select/Select.d.ts +2 -2
  303. package/lib/mjs/components/select/Select.form.d.ts +4 -3
  304. package/lib/mjs/components/select/Select.form.js +3 -2
  305. package/lib/mjs/components/select/Select.js +1 -1
  306. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +2 -8
  307. package/lib/mjs/components/selectboxes/SelectBoxes.form.d.ts +4 -3
  308. package/lib/mjs/components/selectboxes/SelectBoxes.form.js +3 -2
  309. package/lib/mjs/components/selectboxes/SelectBoxes.js +7 -6
  310. package/lib/mjs/components/signature/Signature.form.d.ts +4 -5
  311. package/lib/mjs/components/signature/Signature.form.js +3 -2
  312. package/lib/mjs/components/survey/Survey.form.d.ts +4 -5
  313. package/lib/mjs/components/survey/Survey.form.js +3 -2
  314. package/lib/mjs/components/table/Table.form.d.ts +4 -5
  315. package/lib/mjs/components/table/Table.form.js +3 -2
  316. package/lib/mjs/components/tabs/Tabs.d.ts +2 -2
  317. package/lib/mjs/components/tabs/Tabs.form.d.ts +4 -5
  318. package/lib/mjs/components/tabs/Tabs.form.js +3 -2
  319. package/lib/mjs/components/tabs/Tabs.js +1 -1
  320. package/lib/mjs/components/tags/Tags.form.d.ts +4 -5
  321. package/lib/mjs/components/tags/Tags.form.js +3 -2
  322. package/lib/mjs/components/textarea/TextArea.d.ts +3 -3
  323. package/lib/mjs/components/textarea/TextArea.form.d.ts +4 -5
  324. package/lib/mjs/components/textarea/TextArea.form.js +3 -2
  325. package/lib/mjs/components/textarea/TextArea.js +2 -2
  326. package/lib/mjs/components/textfield/TextField.d.ts +12 -19
  327. package/lib/mjs/components/textfield/TextField.form.d.ts +4 -5
  328. package/lib/mjs/components/textfield/TextField.form.js +3 -2
  329. package/lib/mjs/components/textfield/TextField.js +13 -12
  330. package/lib/mjs/components/time/Time.form.d.ts +4 -5
  331. package/lib/mjs/components/time/Time.form.js +3 -2
  332. package/lib/mjs/components/unknown/Unknown.form.d.ts +3 -35
  333. package/lib/mjs/components/unknown/Unknown.form.js +2 -1
  334. package/lib/mjs/components/url/Url.form.d.ts +4 -5
  335. package/lib/mjs/components/url/Url.form.js +3 -2
  336. package/lib/mjs/components/well/Well.form.d.ts +4 -5
  337. package/lib/mjs/components/well/Well.form.js +3 -2
  338. package/lib/mjs/formio.embed.d.ts +1 -2
  339. package/lib/mjs/formio.embed.js +2 -99
  340. package/lib/mjs/formio.form.js +1 -1
  341. package/lib/mjs/utils/Evaluator.d.ts +0 -1
  342. package/lib/mjs/utils/Evaluator.js +1 -4
  343. package/lib/mjs/utils/formUtils.d.ts +1 -1
  344. package/lib/mjs/utils/utils.d.ts +106 -83
  345. package/lib/mjs/utils/utils.js +96 -140
  346. package/lib/mjs/widgets/CalendarWidget.d.ts +8 -7
  347. package/lib/mjs/widgets/CalendarWidget.js +8 -7
  348. package/package.json +12 -11
  349. package/sdk.d.ts +1 -0
  350. package/utils.d.ts +1 -0
@@ -18,11 +18,11 @@
18
18
  * MIT licensed
19
19
  */
20
20
 
21
- /*! @license DOMPurify 3.1.2 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.2/LICENSE */
22
-
23
21
  /*! @license DOMPurify 3.1.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.1.3/LICENSE */
24
22
 
25
- /*! formiojs v5.0.0-rc.53 | https://unpkg.com/formiojs@5.0.0-rc.53/LICENSE.txt */
23
+ /*! @license DOMPurify 3.1.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.4/LICENSE */
24
+
25
+ /*! formiojs v5.0.0-rc.55 | https://unpkg.com/formiojs@5.0.0-rc.55/LICENSE.txt */
26
26
 
27
27
  /**
28
28
  * @license
package/embed.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './lib/cjs/InlineEmbed';
package/form.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './lib/cjs/formio.form';
@@ -233,10 +233,11 @@ export default class Element {
233
233
  * @param {string|Function|object} func - The function or string to evaluate.
234
234
  * @param {object} args - The arguments to pass to the evaluation.
235
235
  * @param {string} ret - The name of the variable within the evaluation context to return.
236
- * @param {boolean} tokenize - Determines if it should replace all {{ }} token references with actual data.
236
+ * @param {boolean} interpolate - Determines if it should replace all {{ }} token references with actual data.
237
+ * @param {import('@formio/core').EvaluatorOptions} options - The options to pass to the evaluation.
237
238
  * @returns {*} - The result of the evaluation.
238
239
  */
239
- evaluate(func: string | Function | object, args: object, ret: string, tokenize: boolean): any;
240
+ evaluate(func: string | Function | object, args: object, ret: string, interpolate: boolean, options?: import('@formio/core').EvaluatorOptions): any;
240
241
  /**
241
242
  * Allow for options to hook into the functionality of this renderer.
242
243
  * @returns {*} - The result of the hook function.
@@ -563,11 +563,12 @@ class Element {
563
563
  * @param {string|Function|object} func - The function or string to evaluate.
564
564
  * @param {object} args - The arguments to pass to the evaluation.
565
565
  * @param {string} ret - The name of the variable within the evaluation context to return.
566
- * @param {boolean} tokenize - Determines if it should replace all {{ }} token references with actual data.
566
+ * @param {boolean} interpolate - Determines if it should replace all {{ }} token references with actual data.
567
+ * @param {import('@formio/core').EvaluatorOptions} options - The options to pass to the evaluation.
567
568
  * @returns {*} - The result of the evaluation.
568
569
  */
569
- evaluate(func, args, ret, tokenize) {
570
- return FormioUtils.evaluate(func, this.evalContext(args), ret, tokenize);
570
+ evaluate(func, args, ret, interpolate, options = {}) {
571
+ return FormioUtils.evaluate(func, this.evalContext(args), ret, interpolate, options);
571
572
  }
572
573
  /**
573
574
  * Allow for options to hook into the functionality of this renderer.
package/lib/cjs/Form.d.ts CHANGED
@@ -15,32 +15,32 @@ export default class Form extends Element {
15
15
  */
16
16
  /**
17
17
  * @typedef {object} FormioHooks
18
- * @property {Function} [beforeSubmit]
19
- * @property {Function} [beforeCancel]
20
- * @property {Function} [beforeNext]
21
- * @property {Function} [beforePrev]
22
- * @property {Function} [attachComponent]
23
- * @property {Function} [setDataValue]
24
- * @property {Function} [addComponents]
25
- * @property {Function} [addComponent]
26
- * @property {Function} [customValidation]
27
- * @property {Function} [attachWebform]
18
+ * @property {Function} [beforeSubmit] - Called before a submission is made.
19
+ * @property {Function} [beforeCancel] - Called before a cancel is made.
20
+ * @property {Function} [beforeNext] - Called before the next page is navigated to.
21
+ * @property {Function} [beforePrev] - Called before the previous page is navigated to.
22
+ * @property {Function} [attachComponent] - Called when a component is attached.
23
+ * @property {Function} [setDataValue] - Called when a data value is set.
24
+ * @property {Function} [addComponents] - Called when components are added.
25
+ * @property {Function} [addComponent] - Called when a component is added.
26
+ * @property {Function} [customValidation] - Called when a custom validation is made.
27
+ * @property {Function} [attachWebform] - Called when a webform is attached.
28
28
  */
29
29
  /**
30
30
  * @typedef {object} SanitizeConfig
31
- * @property {string[]} [addAttr]
32
- * @property {string[]} [addTags]
33
- * @property {string[]} [allowedAttrs]
34
- * @property {string[]} [allowedTags]
35
- * @property {string[]} [allowedUriRegex]
36
- * @property {string[]} [addUriSafeAttr]
31
+ * @property {string[]} [addAttr] - The html attributes to allow with sanitization.
32
+ * @property {string[]} [addTags] - The html tags to allow with sanitization.
33
+ * @property {string[]} [allowedAttrs] - The html attributes to allow with sanitization.
34
+ * @property {string[]} [allowedTags] - The html tags to allow with sanitization.
35
+ * @property {string[]} [allowedUriRegex] - The regex for allowed URIs.
36
+ * @property {string[]} [addUriSafeAttr] - The URI attributes to allow with sanitization.
37
37
  */
38
38
  /**
39
39
  * @typedef {object} ButtonSettings
40
- * @property {boolean} [showPrevious]
41
- * @property {boolean} [showNext]
42
- * @property {boolean} [showCancel]
43
- * @property {boolean} [showSubmit]
40
+ * @property {boolean} [showPrevious] - Show the previous button in wizard forms.
41
+ * @property {boolean} [showNext] - Show the next button in wizard forms.
42
+ * @property {boolean} [showCancel] - Show the cancel button in wizard forms.
43
+ * @property {boolean} [showSubmit] - Show the submit button in wizard forms.
44
44
  */
45
45
  /**
46
46
  * @typedef {object} FormOptions
@@ -212,15 +212,45 @@ export default class Form extends Element {
212
212
  * - The hooks for this form.
213
213
  */
214
214
  hooks?: {
215
+ /**
216
+ * - Called before a submission is made.
217
+ */
215
218
  beforeSubmit?: Function | undefined;
219
+ /**
220
+ * - Called before a cancel is made.
221
+ */
216
222
  beforeCancel?: Function | undefined;
223
+ /**
224
+ * - Called before the next page is navigated to.
225
+ */
217
226
  beforeNext?: Function | undefined;
227
+ /**
228
+ * - Called before the previous page is navigated to.
229
+ */
218
230
  beforePrev?: Function | undefined;
231
+ /**
232
+ * - Called when a component is attached.
233
+ */
219
234
  attachComponent?: Function | undefined;
235
+ /**
236
+ * - Called when a data value is set.
237
+ */
220
238
  setDataValue?: Function | undefined;
239
+ /**
240
+ * - Called when components are added.
241
+ */
221
242
  addComponents?: Function | undefined;
243
+ /**
244
+ * - Called when a component is added.
245
+ */
222
246
  addComponent?: Function | undefined;
247
+ /**
248
+ * - Called when a custom validation is made.
249
+ */
223
250
  customValidation?: Function | undefined;
251
+ /**
252
+ * - Called when a webform is attached.
253
+ */
224
254
  attachWebform?: Function | undefined;
225
255
  } | undefined;
226
256
  /**
@@ -251,20 +281,50 @@ export default class Form extends Element {
251
281
  * - The sanitize configuration for this form.
252
282
  */
253
283
  sanitizeConfig?: {
284
+ /**
285
+ * - The html attributes to allow with sanitization.
286
+ */
254
287
  addAttr?: string[] | undefined;
288
+ /**
289
+ * - The html tags to allow with sanitization.
290
+ */
255
291
  addTags?: string[] | undefined;
292
+ /**
293
+ * - The html attributes to allow with sanitization.
294
+ */
256
295
  allowedAttrs?: string[] | undefined;
296
+ /**
297
+ * - The html tags to allow with sanitization.
298
+ */
257
299
  allowedTags?: string[] | undefined;
300
+ /**
301
+ * - The regex for allowed URIs.
302
+ */
258
303
  allowedUriRegex?: string[] | undefined;
304
+ /**
305
+ * - The URI attributes to allow with sanitization.
306
+ */
259
307
  addUriSafeAttr?: string[] | undefined;
260
308
  } | undefined;
261
309
  /**
262
310
  * - The button settings for this form.
263
311
  */
264
312
  buttonSettings?: {
313
+ /**
314
+ * - Show the previous button in wizard forms.
315
+ */
265
316
  showPrevious?: boolean | undefined;
317
+ /**
318
+ * - Show the next button in wizard forms.
319
+ */
266
320
  showNext?: boolean | undefined;
321
+ /**
322
+ * - Show the cancel button in wizard forms.
323
+ */
267
324
  showCancel?: boolean | undefined;
325
+ /**
326
+ * - Show the submit button in wizard forms.
327
+ */
268
328
  showSubmit?: boolean | undefined;
269
329
  } | undefined;
270
330
  /**
@@ -300,13 +360,13 @@ export default class Form extends Element {
300
360
  /**
301
361
  * Create a new form instance provided the display of the form.
302
362
  * @param {string} display - The display of the form, either "wizard", "form", or "pdf"
303
- * @returns {*}
363
+ * @returns {Webform|Wizard|PDF} - The new form instance for the display.
304
364
  */
305
- create(display: string): any;
365
+ create(display: string): Webform | Wizard | PDF;
306
366
  /**
307
367
  * Sets the form. Either as JSON or a URL to a form JSON schema.
308
368
  * @param {string|object} formParam - Either the form JSON or the URL of the form json.
309
- * @returns {*}
369
+ * @returns {void}
310
370
  */
311
371
  set form(formParam: object);
312
372
  /**
@@ -332,35 +392,38 @@ export default class Form extends Element {
332
392
  /**
333
393
  * Check Subdirectories path and provide correct options
334
394
  * @param {string} url - The the URL of the form json.
335
- * @param {form} object - The form json.
336
- * @param form
395
+ * @param {import('@formio/core').Form} form - The form json.
337
396
  * @returns {object} The initial options with base and project.
338
397
  */
339
- getFormInitOptions(url: string, form: any): object;
340
- setForm(formParam: any): any;
398
+ getFormInitOptions(url: string, form: import('@formio/core').Form): object;
399
+ /**
400
+ * Sets the form to the JSON schema of a form.
401
+ * @param {import('@formio/core').Form} formParam - The form JSON to set this form to.
402
+ * @returns {Promise<Webform|Wizard|PDF>} - The webform instance that was created.
403
+ */
404
+ setForm(formParam: import('@formio/core').Form): Promise<Webform | Wizard | PDF>;
341
405
  _form: any;
342
406
  getSubmission(formio: any, opts: any): any;
343
407
  /**
344
408
  * Changes the display of the form.
345
409
  * @param {string} display - The display to set this form. Either "wizard", "form", or "pdf"
346
- * @returns {Promise<T>}
410
+ * @returns {Promise<Webform|Wizard|PDF>} - The form instance that was created after changing the display.
347
411
  */
348
- setDisplay(display: string): Promise<T>;
412
+ setDisplay(display: string): Promise<Webform | Wizard | PDF>;
349
413
  empty(): void;
350
414
  /**
351
415
  * Sanitize an html string.
352
- * @param string
353
- * @param dirty
354
- * @param forceSanitize
355
- * @returns {*}
416
+ * @param {string} dirty - The dirty html string to sanitize.
417
+ * @param {boolean} forceSanitize - If the string should be force sanitized.
418
+ * @returns {string} - The sanitized html string.
356
419
  */
357
- sanitize(dirty: any, forceSanitize: any): any;
420
+ sanitize(dirty: string, forceSanitize: boolean): string;
358
421
  setContent(element: any, content: any, forceSanitize: any): boolean;
359
422
  /**
360
423
  * Build a new form.
361
- * @returns {Promise<T>}
424
+ * @returns {Promise<Webform|Wizard|PDF>} - The form instance that was created.
362
425
  */
363
- build(): Promise<T>;
426
+ build(): Promise<Webform | Wizard | PDF>;
364
427
  render(): Promise<any>;
365
428
  attach(element: any): any;
366
429
  }
package/lib/cjs/Form.js CHANGED
@@ -120,7 +120,7 @@ class Form extends Element_1.default {
120
120
  /**
121
121
  * Create a new form instance provided the display of the form.
122
122
  * @param {string} display - The display of the form, either "wizard", "form", or "pdf"
123
- * @returns {*}
123
+ * @returns {Webform|Wizard|PDF} - The new form instance for the display.
124
124
  */
125
125
  create(display) {
126
126
  if (this.options && (this.options.flatten || this.options.renderMode === 'flat')) {
@@ -138,7 +138,7 @@ class Form extends Element_1.default {
138
138
  /**
139
139
  * Sets the form. Either as JSON or a URL to a form JSON schema.
140
140
  * @param {string|object} formParam - Either the form JSON or the URL of the form json.
141
- * @returns {*}
141
+ * @returns {void}
142
142
  */
143
143
  set form(formParam) {
144
144
  this.setForm(formParam);
@@ -167,8 +167,7 @@ class Form extends Element_1.default {
167
167
  /**
168
168
  * Check Subdirectories path and provide correct options
169
169
  * @param {string} url - The the URL of the form json.
170
- * @param {form} object - The form json.
171
- * @param form
170
+ * @param {import('@formio/core').Form} form - The form json.
172
171
  * @returns {object} The initial options with base and project.
173
172
  */
174
173
  getFormInitOptions(url, form) {
@@ -194,6 +193,11 @@ class Form extends Element_1.default {
194
193
  }
195
194
  return {};
196
195
  }
196
+ /**
197
+ * Sets the form to the JSON schema of a form.
198
+ * @param {import('@formio/core').Form} formParam - The form JSON to set this form to.
199
+ * @returns {Promise<Webform|Wizard|PDF>} - The webform instance that was created.
200
+ */
197
201
  setForm(formParam) {
198
202
  let result;
199
203
  formParam = formParam || this.form;
@@ -262,7 +266,7 @@ class Form extends Element_1.default {
262
266
  /**
263
267
  * Changes the display of the form.
264
268
  * @param {string} display - The display to set this form. Either "wizard", "form", or "pdf"
265
- * @returns {Promise<T>}
269
+ * @returns {Promise<Webform|Wizard|PDF>} - The form instance that was created after changing the display.
266
270
  */
267
271
  setDisplay(display) {
268
272
  if ((this.display === display) && this.instance) {
@@ -303,10 +307,9 @@ class Form extends Element_1.default {
303
307
  }
304
308
  /**
305
309
  * Sanitize an html string.
306
- * @param string
307
- * @param dirty
308
- * @param forceSanitize
309
- * @returns {*}
310
+ * @param {string} dirty - The dirty html string to sanitize.
311
+ * @param {boolean} forceSanitize - If the string should be force sanitized.
312
+ * @returns {string} - The sanitized html string.
310
313
  */
311
314
  sanitize(dirty, forceSanitize) {
312
315
  // If Sanitize is turned off
@@ -324,7 +327,7 @@ class Form extends Element_1.default {
324
327
  }
325
328
  /**
326
329
  * Build a new form.
327
- * @returns {Promise<T>}
330
+ * @returns {Promise<Webform|Wizard|PDF>} - The form instance that was created.
328
331
  */
329
332
  build() {
330
333
  if (!this.instance) {
@@ -380,14 +383,16 @@ exports.default = Form;
380
383
  // Allow simple embedding.
381
384
  Formio_1.Formio.embedForm = (embed) => Form.embed(embed);
382
385
  /**
383
- * Factory that creates a new form based on the form parameters.
384
- * @param element {HMTLElement} - The HTML Element to add this form to.
385
- * @param form {string|Object} - The src of the form, or a form object.
386
- * @param options {Object} - The options to create this form.
387
- * @param {...any} args
388
- * @returns {Promise} - When the form is instance is ready.
386
+ * Creates an easy to use interface for embedding webforms, pdfs, and wizards into your application.
387
+ * @param {object} elementOrForm - The DOM element you wish to render this form within, or the form definition.
388
+ * @param {object | string | FormOptions} formOrOptions - A Form JSON schema, the URL of a hosted form, or the form options.
389
+ * @param {FormOptions} [options] - The options to create a new form instance.
390
+ * @returns {Promise<Webform|Wizard|PDF>} - The form instance that was created.
391
+ * @example
392
+ * import { Formio } from '@formio/js';
393
+ * Formio.createForm(document.getElementById('formio'), 'https://examples.form.io/example');
389
394
  */
390
- Formio_1.Formio.createForm = (...args) => {
391
- return (new Form(...args)).ready;
395
+ Formio_1.Formio.createForm = (elementOrForm, formOrOptions, options) => {
396
+ return (new Form(elementOrForm, formOrOptions, options)).ready;
392
397
  };
393
398
  Formio_1.Formio.Form = Form;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Inline embed a form within a webpage.
3
+ * @param {*} config - Configuration to configure how the inline embed is rendered.
4
+ */
5
+ export function embed(config?: any): void;
6
+ export { Formio };
7
+ import { Formio } from './Embed';
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Formio = exports.embed = void 0;
4
+ const Embed_1 = require("./Embed");
5
+ Object.defineProperty(exports, "Formio", { enumerable: true, get: function () { return Embed_1.Formio; } });
6
+ /**
7
+ * Inline embed a form within a webpage.
8
+ * @param {*} config - Configuration to configure how the inline embed is rendered.
9
+ */
10
+ function embed(config = {}) {
11
+ const scripts = document.getElementsByTagName('script');
12
+ config = Object.assign({}, window.FormioConfig || {}, config);
13
+ let thisScript = null;
14
+ let i = scripts.length;
15
+ const scriptName = config.scriptName || 'formio.embed.';
16
+ while (i--) {
17
+ if (scripts[i].src && (scripts[i].src.indexOf(scriptName) !== -1)) {
18
+ thisScript = scripts[i];
19
+ break;
20
+ }
21
+ }
22
+ if (thisScript) {
23
+ const query = {};
24
+ const queryString = thisScript.src.replace(/^[^?]+\??/, '');
25
+ queryString.replace(/\?/g, '&').split('&').forEach((item) => {
26
+ query[item.split('=')[0]] = item.split('=')[1] && decodeURIComponent(item.split('=')[1]);
27
+ });
28
+ let scriptSrc = thisScript.src.replace(/^([^?]+).*/, '$1').split('/');
29
+ scriptSrc.pop();
30
+ if (config.formioPath) {
31
+ config.formioPath(scriptSrc);
32
+ }
33
+ scriptSrc = scriptSrc.join('/');
34
+ const debug = (query.debug === 'true' || query.debug === '1');
35
+ const renderer = debug ? 'formio.form' : 'formio.form.min';
36
+ Embed_1.Formio.config = Object.assign({
37
+ script: query.script || (`${config.updatePath ? config.updatePath() : scriptSrc}/${renderer}.js`),
38
+ style: query.styles || (`${config.updatePath ? config.updatePath() : scriptSrc}/${renderer}.css`),
39
+ cdn: query.cdn,
40
+ class: (query.class || 'formio-form-wrapper'),
41
+ src: query.src,
42
+ form: null,
43
+ submission: null,
44
+ project: query.project,
45
+ base: query.base || 'https://api.form.io',
46
+ submit: query.submit,
47
+ includeLibs: (query.libs === 'true' || query.libs === '1'),
48
+ template: query.template,
49
+ debug: debug,
50
+ config: {},
51
+ redirect: (query.return || query.redirect),
52
+ embedCSS: (`${config.updatePath ? config.updatePath() : scriptSrc}/formio.embed.css`),
53
+ success: query.success || 'Thank you for your submission!',
54
+ before: null,
55
+ after: null
56
+ }, config);
57
+ const form = (Embed_1.Formio.config.form || Embed_1.Formio.config.src);
58
+ if (form) {
59
+ Embed_1.Formio.debug('Embedding Configuration', config);
60
+ if (Embed_1.Formio.config.addPremiumLib) {
61
+ Embed_1.Formio.config.addPremiumLib(Embed_1.Formio.config, scriptSrc);
62
+ }
63
+ // The id for this embedded form.
64
+ Embed_1.Formio.config.id = `formio-${Math.random().toString(36).substring(7)}`;
65
+ Embed_1.Formio.debug('Creating form element');
66
+ const element = Embed_1.Formio.createElement('div', {
67
+ 'id': Embed_1.Formio.config.id,
68
+ class: Embed_1.Formio.config.class
69
+ });
70
+ // insertAfter doesn't exist, but effect is identical.
71
+ thisScript.parentNode.insertBefore(element, thisScript.parentNode.firstElementChild.nextSibling);
72
+ Embed_1.Formio.createForm(element, form, Embed_1.Formio.config.config).then((instance) => {
73
+ if (Embed_1.Formio.config.submit) {
74
+ instance.nosubmit = true;
75
+ }
76
+ // Configure a redirect.
77
+ instance.on('submit', (submission) => {
78
+ Embed_1.Formio.debug("on('submit')", submission);
79
+ if (Embed_1.Formio.config.submit) {
80
+ Embed_1.Formio.debug(`Sending submission to ${Embed_1.Formio.config.submit}`);
81
+ const headers = {
82
+ 'content-type': 'application/json'
83
+ };
84
+ const token = Embed_1.Formio.FormioClass.getToken();
85
+ if (token) {
86
+ headers['x-jwt-token'] = token;
87
+ }
88
+ Embed_1.Formio.FormioClass.fetch(Embed_1.Formio.config.submit, {
89
+ body: JSON.stringify(submission),
90
+ headers: headers,
91
+ method: 'POST',
92
+ mode: 'cors',
93
+ })
94
+ .then(resp => resp.json())
95
+ .then(submission => Embed_1.Formio.submitDone(instance, submission));
96
+ }
97
+ else {
98
+ Embed_1.Formio.submitDone(instance, submission);
99
+ }
100
+ });
101
+ });
102
+ }
103
+ }
104
+ else {
105
+ // Show an error if the script cannot be found.
106
+ document.write('<span>Could not locate the Embedded form.</span>');
107
+ }
108
+ }
109
+ exports.embed = embed;
package/lib/cjs/PDF.d.ts CHANGED
@@ -11,23 +11,24 @@ export default class PDF extends Webform {
11
11
  iframeElement: any;
12
12
  /**
13
13
  * Get the submission from the iframe.
14
- * @returns {Promise<any>}
14
+ * @returns {Promise<any>} - The submission from the iframe.
15
15
  */
16
16
  getSubmission(): Promise<any>;
17
17
  /**
18
18
  * Ensure we have the submission from the iframe before we submit the form.
19
- * @param options
20
- * @returns {*}
19
+ * @param {any} options - The options for submission.
20
+ * @returns {Promise<any>} - Resolves when the form is submitted.
21
21
  */
22
- submitForm(options?: {}): any;
22
+ submitForm(options?: any): Promise<any>;
23
23
  getSrc(): string;
24
24
  setForm(form: any, flags?: {}): Promise<void>;
25
25
  /**
26
26
  * Set's the value of this form component.
27
- * @param submission
28
- * @param flags
27
+ * @param {import('@formio/core').Submission} submission - The submission JSON to set the value of this form.
28
+ * @param {any} flags - The flags to use when setting the submission.
29
+ * @returns {boolean} - If the value changed or not.
29
30
  */
30
- setValue(submission: any, flags?: {}): boolean;
31
+ setValue(submission: import('@formio/core').Submission, flags?: any): boolean;
31
32
  postMessage(message: any): void;
32
33
  iframeFormSetUp: boolean | undefined;
33
34
  focusOnComponent(key: any): void;
package/lib/cjs/PDF.js CHANGED
@@ -143,7 +143,7 @@ class PDF extends Webform_1.default {
143
143
  }
144
144
  /**
145
145
  * Get the submission from the iframe.
146
- * @returns {Promise<any>}
146
+ * @returns {Promise<any>} - The submission from the iframe.
147
147
  */
148
148
  getSubmission() {
149
149
  return new Promise((resolve) => {
@@ -153,8 +153,8 @@ class PDF extends Webform_1.default {
153
153
  }
154
154
  /**
155
155
  * Ensure we have the submission from the iframe before we submit the form.
156
- * @param options
157
- * @returns {*}
156
+ * @param {any} options - The options for submission.
157
+ * @returns {Promise<any>} - Resolves when the form is submitted.
158
158
  */
159
159
  submitForm(options = {}) {
160
160
  this.postMessage({ name: 'getErrors' });
@@ -196,8 +196,9 @@ class PDF extends Webform_1.default {
196
196
  }
197
197
  /**
198
198
  * Set's the value of this form component.
199
- * @param submission
200
- * @param flags
199
+ * @param {import('@formio/core').Submission} submission - The submission JSON to set the value of this form.
200
+ * @param {any} flags - The flags to use when setting the submission.
201
+ * @returns {boolean} - If the value changed or not.
201
202
  */
202
203
  setValue(submission, flags = {}) {
203
204
  const changed = super.setValue(submission, flags);
@@ -83,9 +83,6 @@
83
83
  * @property {boolean} [building] - If we are in the process of building the form.
84
84
  * @property {number} [zoom] - The zoom for PDF forms.
85
85
  */
86
- /**
87
- * Renders a Form.io form within the webpage.
88
- */
89
86
  declare class Webform extends NestedDataComponent {
90
87
  /**
91
88
  * Creates a new Form instance.
@@ -134,23 +134,20 @@ function getOptions(options) {
134
134
  * @property {boolean} [building] - If we are in the process of building the form.
135
135
  * @property {number} [zoom] - The zoom for PDF forms.
136
136
  */
137
- /**
138
- * Renders a Form.io form within the webpage.
139
- */
140
137
  class Webform extends NestedDataComponent_1.default {
141
138
  /**
142
139
  * Creates a new Form instance.
143
140
  * @param {HTMLElement | object | import('Form').FormOptions} [elementOrOptions] - The DOM element to render this form within or the options to create this form instance.
144
141
  * @param {import('Form').FormOptions} [options] - The options to create a new form instance.
145
142
  */
146
- constructor(elementOrOptions, options) {
143
+ constructor(elementOrOptions, options = undefined) {
147
144
  let element, formOptions;
148
145
  if (elementOrOptions instanceof HTMLElement || options) {
149
146
  element = elementOrOptions;
150
- formOptions = options;
147
+ formOptions = options || {};
151
148
  }
152
149
  else {
153
- formOptions = elementOrOptions;
150
+ formOptions = elementOrOptions || {};
154
151
  }
155
152
  super(null, getOptions(formOptions));
156
153
  this.executeShortcuts = (event) => {
@@ -196,7 +193,7 @@ class Webform extends NestedDataComponent_1.default {
196
193
  this._loading = false;
197
194
  this._form = {};
198
195
  this.draftEnabled = false;
199
- this.savingDraft = true;
196
+ this.savingDraft = false;
200
197
  if (this.options.saveDraftThrottle) {
201
198
  this.triggerSaveDraft = lodash_1.default.throttle(this.saveDraft.bind(this), this.options.saveDraftThrottle);
202
199
  }
@@ -293,14 +290,20 @@ class Webform extends NestedDataComponent_1.default {
293
290
  // Set language after everything is established.
294
291
  this.language = this.i18next.language;
295
292
  // See if we need to restore the draft from a user.
296
- if (this.options.saveDraft && !this.options.skipDraftRestore) {
297
- this.formReady.then(() => {
298
- const user = Formio_1.Formio.getUser();
299
- // Only restore a draft if the submission isn't explicitly set.
300
- if (user && !this.submissionSet) {
301
- this.restoreDraft(user._id);
302
- }
303
- });
293
+ if (this.options.saveDraft) {
294
+ if (this.options.skipDraftRestore) {
295
+ this.draftEnabled = true;
296
+ this.savingDraft = false;
297
+ }
298
+ else {
299
+ this.formReady.then(() => {
300
+ const user = Formio_1.Formio.getUser();
301
+ // Only restore a draft if the submission isn't explicitly set.
302
+ if (user && !this.submissionSet) {
303
+ this.restoreDraft(user._id);
304
+ }
305
+ });
306
+ }
304
307
  }
305
308
  this.component.clearOnHide = false;
306
309
  // Ensure the root is set to this component.