@formio/js 5.0.0-dev.5610.da13e39 → 5.0.0-dev.5613.3476921

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (448) 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 +1199 -651
  5. package/dist/formio.form.min.js +1 -1
  6. package/dist/formio.form.min.js.LICENSE.txt +11 -3
  7. package/dist/formio.full.js +919 -691
  8. package/dist/formio.full.min.js +1 -1
  9. package/dist/formio.full.min.js.LICENSE.txt +11 -3
  10. package/dist/formio.js +16 -16
  11. package/dist/formio.min.js +1 -1
  12. package/dist/formio.min.js.LICENSE.txt +1 -1
  13. package/dist/formio.utils.js +493 -1861
  14. package/dist/formio.utils.min.js +1 -1
  15. package/dist/formio.utils.min.js.LICENSE.txt +2 -12
  16. package/lib/cjs/Element.d.ts +96 -86
  17. package/lib/cjs/Element.js +78 -68
  18. package/lib/cjs/Form.d.ts +36 -365
  19. package/lib/cjs/Form.js +64 -50
  20. package/lib/cjs/FormBuilder.d.ts +2 -187
  21. package/lib/cjs/FormBuilder.js +8 -30
  22. package/lib/cjs/PDF.d.ts +13 -11
  23. package/lib/cjs/PDF.js +8 -6
  24. package/lib/cjs/Webform.d.ts +139 -180
  25. package/lib/cjs/Webform.js +298 -313
  26. package/lib/cjs/WebformBuilder.d.ts +14 -16
  27. package/lib/cjs/WebformBuilder.js +11 -17
  28. package/lib/cjs/Wizard.d.ts +21 -31
  29. package/lib/cjs/Wizard.js +19 -42
  30. package/lib/cjs/WizardBuilder.d.ts +1 -1
  31. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +5 -8
  32. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +3 -6
  33. package/lib/cjs/components/Components.d.ts +4 -4
  34. package/lib/cjs/components/Components.js +3 -3
  35. package/lib/cjs/components/_classes/component/Component.d.ts +269 -502
  36. package/lib/cjs/components/_classes/component/Component.form.d.ts +3 -6
  37. package/lib/cjs/components/_classes/component/Component.form.js +0 -5
  38. package/lib/cjs/components/_classes/component/Component.js +189 -433
  39. package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +8 -0
  40. package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +2 -2
  41. package/lib/cjs/components/_classes/component/editForm/utils.js +2 -2
  42. package/lib/cjs/components/_classes/field/Field.d.ts +2 -11
  43. package/lib/cjs/components/_classes/field/Field.js +1 -13
  44. package/lib/cjs/components/_classes/input/Input.d.ts +3 -4
  45. package/lib/cjs/components/_classes/input/Input.js +2 -2
  46. package/lib/cjs/components/_classes/list/ListComponent.d.ts +2 -2
  47. package/lib/cjs/components/_classes/list/ListComponent.form.d.ts +3 -6
  48. package/lib/cjs/components/_classes/list/ListComponent.form.js +0 -5
  49. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +12 -43
  50. package/lib/cjs/components/_classes/multivalue/Multivalue.js +3 -37
  51. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +67 -163
  52. package/lib/cjs/components/_classes/nested/NestedComponent.form.d.ts +3 -6
  53. package/lib/cjs/components/_classes/nested/NestedComponent.form.js +0 -5
  54. package/lib/cjs/components/_classes/nested/NestedComponent.js +54 -175
  55. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -2
  56. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  57. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -7
  58. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +3 -2
  59. package/lib/cjs/components/address/Address.d.ts +2 -4
  60. package/lib/cjs/components/address/Address.form.d.ts +3 -6
  61. package/lib/cjs/components/address/Address.form.js +0 -5
  62. package/lib/cjs/components/button/Button.d.ts +12 -3
  63. package/lib/cjs/components/button/Button.form.d.ts +3 -6
  64. package/lib/cjs/components/button/Button.form.js +0 -5
  65. package/lib/cjs/components/button/Button.js +0 -5
  66. package/lib/cjs/components/checkbox/Checkbox.d.ts +27 -4
  67. package/lib/cjs/components/checkbox/Checkbox.form.d.ts +3 -6
  68. package/lib/cjs/components/checkbox/Checkbox.form.js +0 -5
  69. package/lib/cjs/components/columns/Columns.d.ts +2 -3
  70. package/lib/cjs/components/columns/Columns.form.d.ts +3 -6
  71. package/lib/cjs/components/columns/Columns.form.js +0 -5
  72. package/lib/cjs/components/columns/Columns.js +1 -1
  73. package/lib/cjs/components/container/Container.form.d.ts +3 -6
  74. package/lib/cjs/components/container/Container.form.js +0 -5
  75. package/lib/cjs/components/content/Content.d.ts +1 -2
  76. package/lib/cjs/components/content/Content.form.d.ts +3 -6
  77. package/lib/cjs/components/content/Content.form.js +0 -5
  78. package/lib/cjs/components/currency/Currency.form.d.ts +3 -6
  79. package/lib/cjs/components/currency/Currency.form.js +0 -5
  80. package/lib/cjs/components/currency/Currency.js +2 -1
  81. package/lib/cjs/components/datagrid/DataGrid.d.ts +7 -8
  82. package/lib/cjs/components/datagrid/DataGrid.form.d.ts +3 -6
  83. package/lib/cjs/components/datagrid/DataGrid.form.js +0 -5
  84. package/lib/cjs/components/datagrid/DataGrid.js +5 -5
  85. package/lib/cjs/components/datamap/DataMap.d.ts +0 -1
  86. package/lib/cjs/components/datamap/DataMap.form.d.ts +3 -6
  87. package/lib/cjs/components/datamap/DataMap.form.js +0 -5
  88. package/lib/cjs/components/datetime/DateTime.d.ts +14 -0
  89. package/lib/cjs/components/datetime/DateTime.form.d.ts +3 -6
  90. package/lib/cjs/components/datetime/DateTime.form.js +0 -5
  91. package/lib/cjs/components/datetime/editForm/DateTime.edit.date.js +2 -2
  92. package/lib/cjs/components/day/Day.d.ts +48 -22
  93. package/lib/cjs/components/day/Day.form.d.ts +3 -6
  94. package/lib/cjs/components/day/Day.form.js +0 -5
  95. package/lib/cjs/components/day/Day.js +20 -15
  96. package/lib/cjs/components/editgrid/EditGrid.d.ts +3 -7
  97. package/lib/cjs/components/editgrid/EditGrid.form.d.ts +3 -6
  98. package/lib/cjs/components/editgrid/EditGrid.form.js +0 -5
  99. package/lib/cjs/components/editgrid/EditGrid.js +3 -3
  100. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +5 -2
  101. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.templates.js +9 -6
  102. package/lib/cjs/components/email/Email.form.d.ts +3 -6
  103. package/lib/cjs/components/email/Email.form.js +0 -5
  104. package/lib/cjs/components/fieldset/Fieldset.form.d.ts +3 -6
  105. package/lib/cjs/components/fieldset/Fieldset.form.js +0 -5
  106. package/lib/cjs/components/file/File.d.ts +22 -9
  107. package/lib/cjs/components/file/File.form.d.ts +3 -6
  108. package/lib/cjs/components/file/File.form.js +0 -5
  109. package/lib/cjs/components/form/Form.d.ts +20 -31
  110. package/lib/cjs/components/form/Form.form.d.ts +3 -6
  111. package/lib/cjs/components/form/Form.form.js +0 -5
  112. package/lib/cjs/components/form/Form.js +10 -13
  113. package/lib/cjs/components/hidden/Hidden.d.ts +11 -1
  114. package/lib/cjs/components/hidden/Hidden.form.d.ts +3 -6
  115. package/lib/cjs/components/hidden/Hidden.form.js +0 -5
  116. package/lib/cjs/components/hidden/Hidden.js +2 -1
  117. package/lib/cjs/components/html/HTML.d.ts +1 -2
  118. package/lib/cjs/components/html/HTML.form.d.ts +3 -6
  119. package/lib/cjs/components/html/HTML.form.js +0 -5
  120. package/lib/cjs/components/number/Number.d.ts +17 -3
  121. package/lib/cjs/components/number/Number.form.d.ts +3 -6
  122. package/lib/cjs/components/number/Number.form.js +0 -5
  123. package/lib/cjs/components/number/Number.js +2 -1
  124. package/lib/cjs/components/panel/Panel.form.d.ts +3 -6
  125. package/lib/cjs/components/panel/Panel.form.js +0 -5
  126. package/lib/cjs/components/panel/Panel.js +1 -0
  127. package/lib/cjs/components/password/Password.form.d.ts +3 -6
  128. package/lib/cjs/components/password/Password.form.js +0 -5
  129. package/lib/cjs/components/phonenumber/PhoneNumber.form.d.ts +3 -6
  130. package/lib/cjs/components/phonenumber/PhoneNumber.form.js +0 -5
  131. package/lib/cjs/components/radio/Radio.d.ts +26 -3
  132. package/lib/cjs/components/radio/Radio.form.d.ts +3 -6
  133. package/lib/cjs/components/radio/Radio.form.js +0 -5
  134. package/lib/cjs/components/radio/Radio.js +4 -3
  135. package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +1 -1
  136. package/lib/cjs/components/recaptcha/ReCaptcha.form.d.ts +3 -5
  137. package/lib/cjs/components/recaptcha/ReCaptcha.form.js +0 -4
  138. package/lib/cjs/components/select/Select.d.ts +39 -16
  139. package/lib/cjs/components/select/Select.form.d.ts +3 -6
  140. package/lib/cjs/components/select/Select.form.js +0 -5
  141. package/lib/cjs/components/select/Select.js +16 -13
  142. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +17 -2
  143. package/lib/cjs/components/selectboxes/SelectBoxes.form.d.ts +3 -6
  144. package/lib/cjs/components/selectboxes/SelectBoxes.form.js +0 -5
  145. package/lib/cjs/components/selectboxes/SelectBoxes.js +9 -7
  146. package/lib/cjs/components/signature/Signature.d.ts +14 -1
  147. package/lib/cjs/components/signature/Signature.form.d.ts +3 -6
  148. package/lib/cjs/components/signature/Signature.form.js +0 -5
  149. package/lib/cjs/components/survey/Survey.d.ts +15 -3
  150. package/lib/cjs/components/survey/Survey.form.d.ts +3 -6
  151. package/lib/cjs/components/survey/Survey.form.js +0 -5
  152. package/lib/cjs/components/table/Table.d.ts +1 -2
  153. package/lib/cjs/components/table/Table.form.d.ts +3 -6
  154. package/lib/cjs/components/table/Table.form.js +0 -5
  155. package/lib/cjs/components/tabs/Tabs.d.ts +4 -4
  156. package/lib/cjs/components/tabs/Tabs.form.d.ts +3 -6
  157. package/lib/cjs/components/tabs/Tabs.form.js +0 -5
  158. package/lib/cjs/components/tabs/Tabs.js +2 -1
  159. package/lib/cjs/components/tags/Tags.d.ts +14 -0
  160. package/lib/cjs/components/tags/Tags.form.d.ts +3 -6
  161. package/lib/cjs/components/tags/Tags.form.js +0 -5
  162. package/lib/cjs/components/textarea/TextArea.d.ts +9 -4
  163. package/lib/cjs/components/textarea/TextArea.form.d.ts +3 -6
  164. package/lib/cjs/components/textarea/TextArea.form.js +0 -5
  165. package/lib/cjs/components/textarea/TextArea.js +2 -2
  166. package/lib/cjs/components/textfield/TextField.d.ts +30 -14
  167. package/lib/cjs/components/textfield/TextField.form.d.ts +3 -6
  168. package/lib/cjs/components/textfield/TextField.form.js +0 -5
  169. package/lib/cjs/components/textfield/TextField.js +16 -13
  170. package/lib/cjs/components/time/Time.form.d.ts +3 -6
  171. package/lib/cjs/components/time/Time.form.js +0 -5
  172. package/lib/cjs/components/unknown/Unknown.form.d.ts +34 -5
  173. package/lib/cjs/components/unknown/Unknown.form.js +0 -4
  174. package/lib/cjs/components/url/Url.form.d.ts +3 -6
  175. package/lib/cjs/components/url/Url.form.js +0 -5
  176. package/lib/cjs/components/well/Well.form.d.ts +3 -6
  177. package/lib/cjs/components/well/Well.form.js +0 -5
  178. package/lib/cjs/formio.embed.d.ts +2 -1
  179. package/lib/cjs/formio.embed.js +100 -2
  180. package/lib/cjs/formio.form.d.ts +4 -11
  181. package/lib/cjs/formio.form.js +5 -13
  182. package/lib/cjs/providers/Providers.d.ts +5 -36
  183. package/lib/cjs/providers/Providers.js +0 -29
  184. package/lib/cjs/providers/address/AddressProvider.d.ts +12 -131
  185. package/lib/cjs/providers/address/AddressProvider.js +2 -88
  186. package/lib/cjs/providers/address/AzureAddressProvider.d.ts +1 -48
  187. package/lib/cjs/providers/address/AzureAddressProvider.js +0 -37
  188. package/lib/cjs/providers/address/CustomAddressProvider.d.ts +4 -27
  189. package/lib/cjs/providers/address/CustomAddressProvider.js +0 -34
  190. package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +6 -130
  191. package/lib/cjs/providers/address/GoogleAddressProvider.js +0 -72
  192. package/lib/cjs/providers/address/NominatimAddressProvider.d.ts +7 -32
  193. package/lib/cjs/providers/address/NominatimAddressProvider.js +0 -33
  194. package/lib/cjs/providers/address/index.d.ts +1 -3
  195. package/lib/cjs/providers/processor/fileProcessor.d.ts +1 -7
  196. package/lib/cjs/providers/processor/fileProcessor.js +0 -6
  197. package/lib/cjs/providers/storage/azure.d.ts +13 -6
  198. package/lib/cjs/providers/storage/azure.js +0 -5
  199. package/lib/cjs/providers/storage/base64.d.ts +6 -5
  200. package/lib/cjs/providers/storage/base64.js +0 -4
  201. package/lib/cjs/providers/storage/dropbox.d.ts +4 -6
  202. package/lib/cjs/providers/storage/dropbox.js +0 -5
  203. package/lib/cjs/providers/storage/googleDrive.d.ts +5 -7
  204. package/lib/cjs/providers/storage/googleDrive.js +0 -6
  205. package/lib/cjs/providers/storage/indexeddb.d.ts +7 -5
  206. package/lib/cjs/providers/storage/indexeddb.js +0 -4
  207. package/lib/cjs/providers/storage/s3.d.ts +20 -6
  208. package/lib/cjs/providers/storage/s3.js +0 -5
  209. package/lib/cjs/providers/storage/url.d.ts +7 -6
  210. package/lib/cjs/providers/storage/url.js +0 -10
  211. package/lib/cjs/providers/storage/util.d.ts +1 -24
  212. package/lib/cjs/providers/storage/util.js +0 -18
  213. package/lib/cjs/templates/Templates.d.ts +0 -1
  214. package/lib/cjs/translations/en.d.ts +1 -0
  215. package/lib/cjs/translations/en.js +1 -0
  216. package/lib/cjs/utils/Evaluator.d.ts +3 -6
  217. package/lib/cjs/utils/Evaluator.js +20 -11
  218. package/lib/cjs/utils/builder.d.ts +7 -9
  219. package/lib/cjs/utils/builder.js +5 -10
  220. package/lib/cjs/utils/calendarUtils.d.ts +13 -7
  221. package/lib/cjs/utils/calendarUtils.js +17 -10
  222. package/lib/cjs/utils/formUtils.d.ts +171 -43
  223. package/lib/cjs/utils/formUtils.js +569 -38
  224. package/lib/cjs/utils/utils.d.ts +216 -362
  225. package/lib/cjs/utils/utils.js +224 -331
  226. package/lib/cjs/widgets/CalendarWidget.d.ts +10 -9
  227. package/lib/cjs/widgets/CalendarWidget.js +11 -9
  228. package/lib/mjs/Element.d.ts +96 -86
  229. package/lib/mjs/Element.js +78 -68
  230. package/lib/mjs/Form.d.ts +36 -365
  231. package/lib/mjs/Form.js +57 -140
  232. package/lib/mjs/FormBuilder.d.ts +2 -187
  233. package/lib/mjs/FormBuilder.js +8 -32
  234. package/lib/mjs/PDF.d.ts +13 -11
  235. package/lib/mjs/PDF.js +8 -6
  236. package/lib/mjs/Webform.d.ts +139 -180
  237. package/lib/mjs/Webform.js +310 -325
  238. package/lib/mjs/WebformBuilder.d.ts +14 -16
  239. package/lib/mjs/WebformBuilder.js +11 -16
  240. package/lib/mjs/Wizard.d.ts +21 -31
  241. package/lib/mjs/Wizard.js +18 -41
  242. package/lib/mjs/WizardBuilder.d.ts +1 -1
  243. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +5 -8
  244. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +3 -6
  245. package/lib/mjs/components/Components.d.ts +4 -4
  246. package/lib/mjs/components/Components.js +3 -3
  247. package/lib/mjs/components/_classes/component/Component.d.ts +269 -502
  248. package/lib/mjs/components/_classes/component/Component.form.d.ts +3 -6
  249. package/lib/mjs/components/_classes/component/Component.form.js +0 -5
  250. package/lib/mjs/components/_classes/component/Component.js +189 -433
  251. package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +8 -0
  252. package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +1 -1
  253. package/lib/mjs/components/_classes/component/editForm/utils.js +1 -1
  254. package/lib/mjs/components/_classes/field/Field.d.ts +2 -11
  255. package/lib/mjs/components/_classes/field/Field.js +1 -13
  256. package/lib/mjs/components/_classes/input/Input.d.ts +3 -4
  257. package/lib/mjs/components/_classes/input/Input.js +2 -2
  258. package/lib/mjs/components/_classes/list/ListComponent.d.ts +2 -2
  259. package/lib/mjs/components/_classes/list/ListComponent.form.d.ts +3 -6
  260. package/lib/mjs/components/_classes/list/ListComponent.form.js +0 -5
  261. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +12 -43
  262. package/lib/mjs/components/_classes/multivalue/Multivalue.js +3 -37
  263. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +67 -163
  264. package/lib/mjs/components/_classes/nested/NestedComponent.form.d.ts +3 -6
  265. package/lib/mjs/components/_classes/nested/NestedComponent.form.js +0 -5
  266. package/lib/mjs/components/_classes/nested/NestedComponent.js +54 -175
  267. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -2
  268. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  269. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -7
  270. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +3 -2
  271. package/lib/mjs/components/address/Address.d.ts +2 -4
  272. package/lib/mjs/components/address/Address.form.d.ts +3 -6
  273. package/lib/mjs/components/address/Address.form.js +0 -5
  274. package/lib/mjs/components/button/Button.d.ts +12 -3
  275. package/lib/mjs/components/button/Button.form.d.ts +3 -6
  276. package/lib/mjs/components/button/Button.form.js +0 -5
  277. package/lib/mjs/components/button/Button.js +0 -5
  278. package/lib/mjs/components/checkbox/Checkbox.d.ts +27 -4
  279. package/lib/mjs/components/checkbox/Checkbox.form.d.ts +3 -6
  280. package/lib/mjs/components/checkbox/Checkbox.form.js +0 -5
  281. package/lib/mjs/components/columns/Columns.d.ts +2 -3
  282. package/lib/mjs/components/columns/Columns.form.d.ts +3 -6
  283. package/lib/mjs/components/columns/Columns.form.js +0 -5
  284. package/lib/mjs/components/columns/Columns.js +1 -1
  285. package/lib/mjs/components/container/Container.form.d.ts +3 -6
  286. package/lib/mjs/components/container/Container.form.js +0 -5
  287. package/lib/mjs/components/content/Content.d.ts +1 -2
  288. package/lib/mjs/components/content/Content.form.d.ts +3 -6
  289. package/lib/mjs/components/content/Content.form.js +0 -5
  290. package/lib/mjs/components/currency/Currency.form.d.ts +3 -6
  291. package/lib/mjs/components/currency/Currency.form.js +0 -5
  292. package/lib/mjs/components/currency/Currency.js +2 -1
  293. package/lib/mjs/components/datagrid/DataGrid.d.ts +7 -8
  294. package/lib/mjs/components/datagrid/DataGrid.form.d.ts +3 -6
  295. package/lib/mjs/components/datagrid/DataGrid.form.js +0 -5
  296. package/lib/mjs/components/datagrid/DataGrid.js +5 -5
  297. package/lib/mjs/components/datamap/DataMap.d.ts +0 -1
  298. package/lib/mjs/components/datamap/DataMap.form.d.ts +3 -6
  299. package/lib/mjs/components/datamap/DataMap.form.js +0 -5
  300. package/lib/mjs/components/datetime/DateTime.d.ts +14 -0
  301. package/lib/mjs/components/datetime/DateTime.form.d.ts +3 -6
  302. package/lib/mjs/components/datetime/DateTime.form.js +0 -5
  303. package/lib/mjs/components/datetime/editForm/DateTime.edit.date.js +1 -1
  304. package/lib/mjs/components/day/Day.d.ts +48 -22
  305. package/lib/mjs/components/day/Day.form.d.ts +3 -6
  306. package/lib/mjs/components/day/Day.form.js +0 -5
  307. package/lib/mjs/components/day/Day.js +20 -15
  308. package/lib/mjs/components/editgrid/EditGrid.d.ts +3 -7
  309. package/lib/mjs/components/editgrid/EditGrid.form.d.ts +3 -6
  310. package/lib/mjs/components/editgrid/EditGrid.form.js +0 -5
  311. package/lib/mjs/components/editgrid/EditGrid.js +3 -3
  312. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
  313. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.templates.js +1 -1
  314. package/lib/mjs/components/email/Email.form.d.ts +3 -6
  315. package/lib/mjs/components/email/Email.form.js +0 -5
  316. package/lib/mjs/components/fieldset/Fieldset.form.d.ts +3 -6
  317. package/lib/mjs/components/fieldset/Fieldset.form.js +0 -5
  318. package/lib/mjs/components/file/File.d.ts +22 -9
  319. package/lib/mjs/components/file/File.form.d.ts +3 -6
  320. package/lib/mjs/components/file/File.form.js +0 -5
  321. package/lib/mjs/components/form/Form.d.ts +20 -31
  322. package/lib/mjs/components/form/Form.form.d.ts +3 -6
  323. package/lib/mjs/components/form/Form.form.js +0 -5
  324. package/lib/mjs/components/form/Form.js +10 -13
  325. package/lib/mjs/components/hidden/Hidden.d.ts +11 -1
  326. package/lib/mjs/components/hidden/Hidden.form.d.ts +3 -6
  327. package/lib/mjs/components/hidden/Hidden.form.js +0 -5
  328. package/lib/mjs/components/hidden/Hidden.js +2 -1
  329. package/lib/mjs/components/html/HTML.d.ts +1 -2
  330. package/lib/mjs/components/html/HTML.form.d.ts +3 -6
  331. package/lib/mjs/components/html/HTML.form.js +0 -5
  332. package/lib/mjs/components/number/Number.d.ts +17 -3
  333. package/lib/mjs/components/number/Number.form.d.ts +3 -6
  334. package/lib/mjs/components/number/Number.form.js +0 -5
  335. package/lib/mjs/components/number/Number.js +2 -1
  336. package/lib/mjs/components/panel/Panel.form.d.ts +3 -6
  337. package/lib/mjs/components/panel/Panel.form.js +0 -5
  338. package/lib/mjs/components/panel/Panel.js +1 -0
  339. package/lib/mjs/components/password/Password.form.d.ts +3 -6
  340. package/lib/mjs/components/password/Password.form.js +0 -5
  341. package/lib/mjs/components/phonenumber/PhoneNumber.form.d.ts +3 -6
  342. package/lib/mjs/components/phonenumber/PhoneNumber.form.js +0 -5
  343. package/lib/mjs/components/radio/Radio.d.ts +26 -3
  344. package/lib/mjs/components/radio/Radio.form.d.ts +3 -6
  345. package/lib/mjs/components/radio/Radio.form.js +0 -5
  346. package/lib/mjs/components/radio/Radio.js +4 -3
  347. package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +1 -1
  348. package/lib/mjs/components/recaptcha/ReCaptcha.form.d.ts +3 -5
  349. package/lib/mjs/components/recaptcha/ReCaptcha.form.js +0 -4
  350. package/lib/mjs/components/select/Select.d.ts +39 -16
  351. package/lib/mjs/components/select/Select.form.d.ts +3 -6
  352. package/lib/mjs/components/select/Select.form.js +0 -5
  353. package/lib/mjs/components/select/Select.js +16 -13
  354. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +17 -2
  355. package/lib/mjs/components/selectboxes/SelectBoxes.form.d.ts +3 -6
  356. package/lib/mjs/components/selectboxes/SelectBoxes.form.js +0 -5
  357. package/lib/mjs/components/selectboxes/SelectBoxes.js +9 -7
  358. package/lib/mjs/components/signature/Signature.d.ts +14 -1
  359. package/lib/mjs/components/signature/Signature.form.d.ts +3 -6
  360. package/lib/mjs/components/signature/Signature.form.js +0 -5
  361. package/lib/mjs/components/survey/Survey.d.ts +15 -3
  362. package/lib/mjs/components/survey/Survey.form.d.ts +3 -6
  363. package/lib/mjs/components/survey/Survey.form.js +0 -5
  364. package/lib/mjs/components/table/Table.d.ts +1 -2
  365. package/lib/mjs/components/table/Table.form.d.ts +3 -6
  366. package/lib/mjs/components/table/Table.form.js +0 -5
  367. package/lib/mjs/components/tabs/Tabs.d.ts +4 -4
  368. package/lib/mjs/components/tabs/Tabs.form.d.ts +3 -6
  369. package/lib/mjs/components/tabs/Tabs.form.js +0 -5
  370. package/lib/mjs/components/tabs/Tabs.js +2 -1
  371. package/lib/mjs/components/tags/Tags.d.ts +14 -0
  372. package/lib/mjs/components/tags/Tags.form.d.ts +3 -6
  373. package/lib/mjs/components/tags/Tags.form.js +0 -5
  374. package/lib/mjs/components/textarea/TextArea.d.ts +9 -4
  375. package/lib/mjs/components/textarea/TextArea.form.d.ts +3 -6
  376. package/lib/mjs/components/textarea/TextArea.form.js +0 -5
  377. package/lib/mjs/components/textarea/TextArea.js +2 -2
  378. package/lib/mjs/components/textfield/TextField.d.ts +30 -14
  379. package/lib/mjs/components/textfield/TextField.form.d.ts +3 -6
  380. package/lib/mjs/components/textfield/TextField.form.js +0 -5
  381. package/lib/mjs/components/textfield/TextField.js +16 -13
  382. package/lib/mjs/components/time/Time.form.d.ts +3 -6
  383. package/lib/mjs/components/time/Time.form.js +0 -5
  384. package/lib/mjs/components/unknown/Unknown.form.d.ts +34 -5
  385. package/lib/mjs/components/unknown/Unknown.form.js +0 -4
  386. package/lib/mjs/components/url/Url.form.d.ts +3 -6
  387. package/lib/mjs/components/url/Url.form.js +0 -5
  388. package/lib/mjs/components/well/Well.form.d.ts +3 -6
  389. package/lib/mjs/components/well/Well.form.js +0 -5
  390. package/lib/mjs/formio.embed.d.ts +2 -1
  391. package/lib/mjs/formio.embed.js +99 -2
  392. package/lib/mjs/formio.form.d.ts +4 -11
  393. package/lib/mjs/formio.form.js +3 -10
  394. package/lib/mjs/providers/Providers.d.ts +5 -36
  395. package/lib/mjs/providers/Providers.js +0 -29
  396. package/lib/mjs/providers/address/AddressProvider.d.ts +12 -131
  397. package/lib/mjs/providers/address/AddressProvider.js +2 -88
  398. package/lib/mjs/providers/address/AzureAddressProvider.d.ts +1 -48
  399. package/lib/mjs/providers/address/AzureAddressProvider.js +0 -37
  400. package/lib/mjs/providers/address/CustomAddressProvider.d.ts +4 -27
  401. package/lib/mjs/providers/address/CustomAddressProvider.js +0 -34
  402. package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +6 -130
  403. package/lib/mjs/providers/address/GoogleAddressProvider.js +0 -72
  404. package/lib/mjs/providers/address/NominatimAddressProvider.d.ts +7 -32
  405. package/lib/mjs/providers/address/NominatimAddressProvider.js +0 -33
  406. package/lib/mjs/providers/address/index.d.ts +1 -3
  407. package/lib/mjs/providers/processor/fileProcessor.d.ts +1 -7
  408. package/lib/mjs/providers/processor/fileProcessor.js +0 -6
  409. package/lib/mjs/providers/storage/azure.d.ts +13 -6
  410. package/lib/mjs/providers/storage/azure.js +0 -5
  411. package/lib/mjs/providers/storage/base64.d.ts +6 -5
  412. package/lib/mjs/providers/storage/base64.js +0 -4
  413. package/lib/mjs/providers/storage/dropbox.d.ts +4 -6
  414. package/lib/mjs/providers/storage/dropbox.js +0 -5
  415. package/lib/mjs/providers/storage/googleDrive.d.ts +5 -7
  416. package/lib/mjs/providers/storage/googleDrive.js +0 -6
  417. package/lib/mjs/providers/storage/indexeddb.d.ts +7 -5
  418. package/lib/mjs/providers/storage/indexeddb.js +0 -4
  419. package/lib/mjs/providers/storage/s3.d.ts +20 -6
  420. package/lib/mjs/providers/storage/s3.js +0 -5
  421. package/lib/mjs/providers/storage/url.d.ts +7 -6
  422. package/lib/mjs/providers/storage/url.js +0 -10
  423. package/lib/mjs/providers/storage/util.d.ts +1 -24
  424. package/lib/mjs/providers/storage/util.js +0 -18
  425. package/lib/mjs/templates/Templates.d.ts +0 -1
  426. package/lib/mjs/translations/en.d.ts +1 -0
  427. package/lib/mjs/translations/en.js +1 -0
  428. package/lib/mjs/utils/Evaluator.d.ts +3 -6
  429. package/lib/mjs/utils/Evaluator.js +20 -9
  430. package/lib/mjs/utils/builder.d.ts +7 -9
  431. package/lib/mjs/utils/builder.js +5 -10
  432. package/lib/mjs/utils/calendarUtils.d.ts +13 -7
  433. package/lib/mjs/utils/calendarUtils.js +17 -10
  434. package/lib/mjs/utils/formUtils.d.ts +171 -43
  435. package/lib/mjs/utils/formUtils.js +554 -6
  436. package/lib/mjs/utils/utils.d.ts +216 -362
  437. package/lib/mjs/utils/utils.js +218 -325
  438. package/lib/mjs/widgets/CalendarWidget.d.ts +10 -9
  439. package/lib/mjs/widgets/CalendarWidget.js +11 -9
  440. package/package.json +22 -22
  441. package/embed.d.ts +0 -1
  442. package/form.d.ts +0 -1
  443. package/lib/cjs/InlineEmbed.d.ts +0 -7
  444. package/lib/cjs/InlineEmbed.js +0 -109
  445. package/lib/mjs/InlineEmbed.d.ts +0 -7
  446. package/lib/mjs/InlineEmbed.js +0 -105
  447. package/sdk.d.ts +0 -1
  448. package/utils.d.ts +0 -1
package/lib/cjs/Form.d.ts CHANGED
@@ -1,377 +1,50 @@
1
1
  export default class Form extends Element {
2
2
  static embed(embed: any): Promise<any>;
3
- constructor(elementOrForm: any, formOrOptions: any, options?: {});
4
- /**
5
- * Represents a JSON value.
6
- * @typedef {(string | number | boolean | null | JSONArray | JSONObject)} JSON
7
- */
8
- /**
9
- * Represents a JSON array.
10
- * @typedef {Array<JSON>} JSONArray
11
- */
12
- /**
13
- * Represents a JSON object.
14
- * @typedef {{[key: string]: JSON}} JSONObject
15
- */
16
- /**
17
- * @typedef {object} FormioHooks
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
- */
29
- /**
30
- * @typedef {object} SanitizeConfig
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
- */
38
- /**
39
- * @typedef {object} ButtonSettings
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
- */
45
- /**
46
- * @typedef {object} FormOptions
47
- * @property {boolean} [saveDraft] - Enable the save draft feature.
48
- * @property {number} [saveDraftThrottle] - The throttle for the save draft feature.
49
- * @property {boolean} [readOnly] - Set this form to readOnly.
50
- * @property {boolean} [noAlerts] - Disable the alerts dialog.
51
- * @property {{[key: string]: string}} [i18n] - The translation file for this rendering.
52
- * @property {string} [template] - Custom logic for creation of elements.
53
- * @property {boolean} [noDefaults] - Exclude default values from the settings.
54
- * @property {any} [fileService] - The file service for this form.
55
- * @property {EventEmitter} [events] - The EventEmitter for this form.
56
- * @property {string} [language] - The language to render this form in.
57
- * @property {{[key: string]: string}} [i18next] - The i18next configuration for this form.
58
- * @property {boolean} [viewAsHtml] - View the form as raw HTML.
59
- * @property {'form' | 'html' | 'flat' | 'builder' | 'pdf'} [renderMode] - The render mode for this form.
60
- * @property {boolean} [highlightErrors] - Highlight any errors on the form.
61
- * @property {string} [componentErrorClass] - The error class for components.
62
- * @property {any} [templates] - The templates for this form.
63
- * @property {string} [iconset] - The iconset for this form.
64
- * @property {import('@formio/core').Component[]} [components] - The components for this form.
65
- * @property {{[key: string]: boolean}} [disabled] - Disabled components for this form.
66
- * @property {boolean} [showHiddenFields] - Show hidden fields.
67
- * @property {{[key: string]: boolean}} [hide] - Hidden components for this form.
68
- * @property {{[key: string]: boolean}} [show] - Components to show for this form.
69
- * @property {Formio} [formio] - The Formio instance for this form.
70
- * @property {string} [decimalSeparator] - The decimal separator for this form.
71
- * @property {string} [thousandsSeparator] - The thousands separator for this form.
72
- * @property {FormioHooks} [hooks] - The hooks for this form.
73
- * @property {boolean} [alwaysDirty] - Always be dirty.
74
- * @property {boolean} [skipDraftRestore] - Skip restoring a draft.
75
- * @property {'form' | 'wizard' | 'pdf'} [display] - The display for this form.
76
- * @property {string} [cdnUrl] - The CDN url for this form.
77
- * @property {boolean} [flatten] - Flatten the form.
78
- * @property {boolean} [sanitize] - Sanitize the form.
79
- * @property {SanitizeConfig} [sanitizeConfig] - The sanitize configuration for this form.
80
- * @property {ButtonSettings} [buttonSettings] - The button settings for this form.
81
- * @property {object} [breadcrumbSettings] - The breadcrumb settings for this form.
82
- * @property {boolean} [allowPrevious] - Allow the previous button (for Wizard forms).
83
- * @property {string[]} [wizardButtonOrder] - The order of the buttons (for Wizard forms).
84
- * @property {boolean} [showCheckboxBackground] - Show the checkbox background.
85
- * @property {number} [zoom] - The zoom for PDF forms.
86
- */
87
3
  /**
88
4
  * Creates an easy to use interface for embedding webforms, pdfs, and wizards into your application.
89
- * @param {object} elementOrForm - The DOM element you wish to render this form within, or the form definition.
90
- * @param {object | string | FormOptions} formOrOptions - A Form JSON schema, the URL of a hosted form, or the form options.
91
- * @param {FormOptions} [options] - The options to create a new form instance.
5
+ *
6
+ * @param {Object} element - The DOM element you wish to render this form within.
7
+ * @param {Object | string} form - Either a Form JSON schema or the URL of a hosted form via. form.io.
8
+ * @param {Object} options - The options to create a new form instance.
9
+ * @param {boolean} options.readOnly - Set this form to readOnly
10
+ * @param {boolean} options.noAlerts - Set to true to disable the alerts dialog.
11
+ * @param {boolean} options.i18n - The translation file for this rendering. @see https://github.com/formio/formio.js/blob/master/i18n.js
12
+ * @param {boolean} options.template - Provides a way to inject custom logic into the creation of every element rendered within the form.
13
+ *
92
14
  * @example
93
15
  * import Form from '@formio/js/Form';
94
16
  * const form = new Form(document.getElementById('formio'), 'https://examples.form.io/example');
95
17
  * form.build();
96
18
  */
97
- /**
98
- * @type {FormOptions} - the options for this Form.
99
- */
100
- options: {
101
- /**
102
- * - Enable the save draft feature.
103
- */
104
- saveDraft?: boolean | undefined;
105
- /**
106
- * - The throttle for the save draft feature.
107
- */
108
- saveDraftThrottle?: number | undefined;
109
- /**
110
- * - Set this form to readOnly.
111
- */
112
- readOnly?: boolean | undefined;
113
- /**
114
- * - Disable the alerts dialog.
115
- */
116
- noAlerts?: boolean | undefined;
117
- /**
118
- * - The translation file for this rendering.
119
- */
120
- i18n?: {
121
- [key: string]: string;
122
- } | undefined;
123
- /**
124
- * - Custom logic for creation of elements.
125
- */
126
- template?: string | undefined;
127
- /**
128
- * - Exclude default values from the settings.
129
- */
130
- noDefaults?: boolean | undefined;
131
- /**
132
- * - The file service for this form.
133
- */
134
- fileService?: any;
135
- /**
136
- * - The EventEmitter for this form.
137
- */
138
- events?: any;
139
- /**
140
- * - The language to render this form in.
141
- */
142
- language?: string | undefined;
143
- /**
144
- * - The i18next configuration for this form.
145
- */
146
- i18next?: {
147
- [key: string]: string;
148
- } | undefined;
149
- /**
150
- * - View the form as raw HTML.
151
- */
152
- viewAsHtml?: boolean | undefined;
153
- /**
154
- * - The render mode for this form.
155
- */
156
- renderMode?: "builder" | "form" | "html" | "flat" | "pdf" | undefined;
157
- /**
158
- * - Highlight any errors on the form.
159
- */
160
- highlightErrors?: boolean | undefined;
161
- /**
162
- * - The error class for components.
163
- */
164
- componentErrorClass?: string | undefined;
165
- /**
166
- * - The templates for this form.
167
- */
168
- templates?: any;
169
- /**
170
- * - The iconset for this form.
171
- */
172
- iconset?: string | undefined;
173
- /**
174
- * - The components for this form.
175
- */
176
- components?: import("@formio/core").Component[] | undefined;
177
- /**
178
- * - Disabled components for this form.
179
- */
180
- disabled?: {
181
- [key: string]: boolean;
182
- } | undefined;
183
- /**
184
- * - Show hidden fields.
185
- */
186
- showHiddenFields?: boolean | undefined;
187
- /**
188
- * - Hidden components for this form.
189
- */
190
- hide?: {
191
- [key: string]: boolean;
192
- } | undefined;
193
- /**
194
- * - Components to show for this form.
195
- */
196
- show?: {
197
- [key: string]: boolean;
198
- } | undefined;
199
- /**
200
- * - The Formio instance for this form.
201
- */
202
- formio?: any;
203
- /**
204
- * - The decimal separator for this form.
205
- */
206
- decimalSeparator?: string | undefined;
207
- /**
208
- * - The thousands separator for this form.
209
- */
210
- thousandsSeparator?: string | undefined;
211
- /**
212
- * - The hooks for this form.
213
- */
214
- hooks?: {
215
- /**
216
- * - Called before a submission is made.
217
- */
218
- beforeSubmit?: Function | undefined;
219
- /**
220
- * - Called before a cancel is made.
221
- */
222
- beforeCancel?: Function | undefined;
223
- /**
224
- * - Called before the next page is navigated to.
225
- */
226
- beforeNext?: Function | undefined;
227
- /**
228
- * - Called before the previous page is navigated to.
229
- */
230
- beforePrev?: Function | undefined;
231
- /**
232
- * - Called when a component is attached.
233
- */
234
- attachComponent?: Function | undefined;
235
- /**
236
- * - Called when a data value is set.
237
- */
238
- setDataValue?: Function | undefined;
239
- /**
240
- * - Called when components are added.
241
- */
242
- addComponents?: Function | undefined;
243
- /**
244
- * - Called when a component is added.
245
- */
246
- addComponent?: Function | undefined;
247
- /**
248
- * - Called when a custom validation is made.
249
- */
250
- customValidation?: Function | undefined;
251
- /**
252
- * - Called when a webform is attached.
253
- */
254
- attachWebform?: Function | undefined;
255
- } | undefined;
256
- /**
257
- * - Always be dirty.
258
- */
259
- alwaysDirty?: boolean | undefined;
260
- /**
261
- * - Skip restoring a draft.
262
- */
263
- skipDraftRestore?: boolean | undefined;
264
- /**
265
- * - The display for this form.
266
- */
267
- display?: "form" | "pdf" | "wizard" | undefined;
268
- /**
269
- * - The CDN url for this form.
270
- */
271
- cdnUrl?: string | undefined;
272
- /**
273
- * - Flatten the form.
274
- */
275
- flatten?: boolean | undefined;
276
- /**
277
- * - Sanitize the form.
278
- */
279
- sanitize?: boolean | undefined;
280
- /**
281
- * - The sanitize configuration for this form.
282
- */
283
- sanitizeConfig?: {
284
- /**
285
- * - The html attributes to allow with sanitization.
286
- */
287
- addAttr?: string[] | undefined;
288
- /**
289
- * - The html tags to allow with sanitization.
290
- */
291
- addTags?: string[] | undefined;
292
- /**
293
- * - The html attributes to allow with sanitization.
294
- */
295
- allowedAttrs?: string[] | undefined;
296
- /**
297
- * - The html tags to allow with sanitization.
298
- */
299
- allowedTags?: string[] | undefined;
300
- /**
301
- * - The regex for allowed URIs.
302
- */
303
- allowedUriRegex?: string[] | undefined;
304
- /**
305
- * - The URI attributes to allow with sanitization.
306
- */
307
- addUriSafeAttr?: string[] | undefined;
308
- } | undefined;
309
- /**
310
- * - The button settings for this form.
311
- */
312
- buttonSettings?: {
313
- /**
314
- * - Show the previous button in wizard forms.
315
- */
316
- showPrevious?: boolean | undefined;
317
- /**
318
- * - Show the next button in wizard forms.
319
- */
320
- showNext?: boolean | undefined;
321
- /**
322
- * - Show the cancel button in wizard forms.
323
- */
324
- showCancel?: boolean | undefined;
325
- /**
326
- * - Show the submit button in wizard forms.
327
- */
328
- showSubmit?: boolean | undefined;
329
- } | undefined;
330
- /**
331
- * - The breadcrumb settings for this form.
332
- */
333
- breadcrumbSettings?: object | undefined;
334
- /**
335
- * - Allow the previous button (for Wizard forms).
336
- */
337
- allowPrevious?: boolean | undefined;
338
- /**
339
- * - The order of the buttons (for Wizard forms).
340
- */
341
- wizardButtonOrder?: string[] | undefined;
342
- /**
343
- * - Show the checkbox background.
344
- */
345
- showCheckboxBackground?: boolean | undefined;
346
- /**
347
- * - The zoom for PDF forms.
348
- */
349
- zoom?: number | undefined;
350
- };
19
+ constructor(...args: any[]);
351
20
  ready: Promise<any>;
352
21
  readyResolve: (value: any) => void;
353
22
  readyReject: (reason?: any) => void;
354
23
  instance: any;
355
24
  element: any;
25
+ options: any;
356
26
  display: string;
357
27
  createElement(tag: any, attrs: any, children: any): any;
358
28
  set loading(load: any);
359
29
  loader: any;
360
30
  /**
361
31
  * Create a new form instance provided the display of the form.
32
+ *
362
33
  * @param {string} display - The display of the form, either "wizard", "form", or "pdf"
363
- * @returns {Webform|Wizard|PDF} - The new form instance for the display.
34
+ * @return {*}
364
35
  */
365
- create(display: string): Webform | Wizard | PDF;
36
+ create(display: string): any;
366
37
  /**
367
38
  * Sets the form. Either as JSON or a URL to a form JSON schema.
39
+ *
368
40
  * @param {string|object} formParam - Either the form JSON or the URL of the form json.
369
- * @returns {void}
41
+ * @return {*}
370
42
  */
371
43
  set form(formParam: object);
372
44
  /**
373
45
  * Returns the loaded forms JSON.
374
- * @returns {object} - The loaded form's JSON
46
+ *
47
+ * @return {object} - The loaded form's JSON
375
48
  */
376
49
  get form(): object;
377
50
  errorForm(err: any): {
@@ -390,40 +63,38 @@ export default class Form extends Element {
390
63
  }[];
391
64
  };
392
65
  /**
393
- * Check Subdirectories path and provide correct options
394
- * @param {string} url - The the URL of the form json.
395
- * @param {import('@formio/core').Form} form - The form json.
396
- * @returns {object} The initial options with base and project.
397
- */
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>;
66
+ * Check Subdirectories path and provide correct options
67
+ *
68
+ * @param {string} url - The the URL of the form json.
69
+ * @param {form} object - The form json.
70
+ * @return {object} The initial options with base and project.
71
+ */
72
+ getFormInitOptions(url: string, form: any): object;
73
+ setForm(formParam: any): any;
405
74
  _form: any;
406
75
  getSubmission(formio: any, opts: any): any;
407
76
  /**
408
77
  * Changes the display of the form.
78
+ *
409
79
  * @param {string} display - The display to set this form. Either "wizard", "form", or "pdf"
410
- * @returns {Promise<Webform|Wizard|PDF>} - The form instance that was created after changing the display.
80
+ * @return {Promise<T>}
411
81
  */
412
- setDisplay(display: string): Promise<Webform | Wizard | PDF>;
82
+ setDisplay(display: string): Promise<T>;
413
83
  empty(): void;
414
84
  /**
415
85
  * Sanitize an html string.
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.
86
+ *
87
+ * @param string
88
+ * @returns {*}
419
89
  */
420
- sanitize(dirty: string, forceSanitize: boolean): string;
90
+ sanitize(dirty: any, forceSanitize: any): any;
421
91
  setContent(element: any, content: any, forceSanitize: any): boolean;
422
92
  /**
423
93
  * Build a new form.
424
- * @returns {Promise<Webform|Wizard|PDF>} - The form instance that was created.
94
+ *
95
+ * @return {Promise<T>}
425
96
  */
426
- build(): Promise<Webform | Wizard | PDF>;
97
+ build(): Promise<T>;
427
98
  render(): Promise<any>;
428
99
  attach(element: any): any;
429
100
  }
package/lib/cjs/Form.js CHANGED
@@ -32,22 +32,28 @@ const displays_1 = __importDefault(require("./displays"));
32
32
  const templates_1 = __importDefault(require("./templates"));
33
33
  const FormioUtils = __importStar(require("./utils/utils"));
34
34
  class Form extends Element_1.default {
35
- constructor(elementOrForm, formOrOptions, options = {}) {
36
- let element, form, formOptions;
37
- if (elementOrForm instanceof HTMLElement) {
38
- element = elementOrForm;
39
- form = formOrOptions;
40
- formOptions = options;
41
- }
42
- else {
43
- element = null;
44
- form = elementOrForm;
45
- formOptions = formOrOptions || {};
46
- }
35
+ /**
36
+ * Creates an easy to use interface for embedding webforms, pdfs, and wizards into your application.
37
+ *
38
+ * @param {Object} element - The DOM element you wish to render this form within.
39
+ * @param {Object | string} form - Either a Form JSON schema or the URL of a hosted form via. form.io.
40
+ * @param {Object} options - The options to create a new form instance.
41
+ * @param {boolean} options.readOnly - Set this form to readOnly
42
+ * @param {boolean} options.noAlerts - Set to true to disable the alerts dialog.
43
+ * @param {boolean} options.i18n - The translation file for this rendering. @see https://github.com/formio/formio.js/blob/master/i18n.js
44
+ * @param {boolean} options.template - Provides a way to inject custom logic into the creation of every element rendered within the form.
45
+ *
46
+ * @example
47
+ * import Form from '@formio/js/Form';
48
+ * const form = new Form(document.getElementById('formio'), 'https://examples.form.io/example');
49
+ * form.build();
50
+ */
51
+ constructor(...args) {
52
+ let options = args[0] instanceof HTMLElement ? args[2] : args[1];
47
53
  if (Formio_1.Formio.options && Formio_1.Formio.options.form) {
48
- formOptions = Object.assign(formOptions, Formio_1.Formio.options.form);
54
+ options = Object.assign(options, Formio_1.Formio.options.form);
49
55
  }
50
- super(formOptions);
56
+ super(options);
51
57
  if (this.options.useSessionToken) {
52
58
  Formio_1.Formio.useSessionToken(this.options);
53
59
  }
@@ -56,22 +62,30 @@ class Form extends Element_1.default {
56
62
  this.readyReject = reject;
57
63
  });
58
64
  this.instance = null;
59
- if (element) {
65
+ if (args[0] instanceof HTMLElement) {
60
66
  if (this.element) {
61
67
  delete this.element.component;
62
68
  }
63
- this.element = element;
69
+ this.element = args[0];
70
+ this.options = args[2] || {};
71
+ this.options.events = this.events;
72
+ this.setForm(args[1])
73
+ .then(() => this.readyResolve(this.instance))
74
+ .catch(this.readyReject);
64
75
  }
65
- else {
76
+ else if (args[0]) {
66
77
  this.element = null;
67
- }
68
- if (form) {
69
- this.setForm(form)
78
+ this.options = args[1] || {};
79
+ this.options.events = this.events;
80
+ this.setForm(args[0])
70
81
  .then(() => this.readyResolve(this.instance))
71
82
  .catch(this.readyReject);
72
83
  }
73
- this.options = formOptions;
74
- this.options.events = this.events;
84
+ else {
85
+ this.element = null;
86
+ this.options = {};
87
+ this.options.events = this.events;
88
+ }
75
89
  this.display = '';
76
90
  }
77
91
  createElement(tag, attrs, children) {
@@ -119,8 +133,9 @@ class Form extends Element_1.default {
119
133
  }
120
134
  /**
121
135
  * Create a new form instance provided the display of the form.
136
+ *
122
137
  * @param {string} display - The display of the form, either "wizard", "form", or "pdf"
123
- * @returns {Webform|Wizard|PDF} - The new form instance for the display.
138
+ * @return {*}
124
139
  */
125
140
  create(display) {
126
141
  if (this.options && (this.options.flatten || this.options.renderMode === 'flat')) {
@@ -137,8 +152,9 @@ class Form extends Element_1.default {
137
152
  }
138
153
  /**
139
154
  * Sets the form. Either as JSON or a URL to a form JSON schema.
155
+ *
140
156
  * @param {string|object} formParam - Either the form JSON or the URL of the form json.
141
- * @returns {void}
157
+ * @return {*}
142
158
  */
143
159
  set form(formParam) {
144
160
  this.setForm(formParam);
@@ -165,11 +181,12 @@ class Form extends Element_1.default {
165
181
  };
166
182
  }
167
183
  /**
168
- * Check Subdirectories path and provide correct options
169
- * @param {string} url - The the URL of the form json.
170
- * @param {import('@formio/core').Form} form - The form json.
171
- * @returns {object} The initial options with base and project.
172
- */
184
+ * Check Subdirectories path and provide correct options
185
+ *
186
+ * @param {string} url - The the URL of the form json.
187
+ * @param {form} object - The form json.
188
+ * @return {object} The initial options with base and project.
189
+ */
173
190
  getFormInitOptions(url, form) {
174
191
  const options = {};
175
192
  const index = url.indexOf(form === null || form === void 0 ? void 0 : form.path);
@@ -193,11 +210,6 @@ class Form extends Element_1.default {
193
210
  }
194
211
  return {};
195
212
  }
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
- */
201
213
  setForm(formParam) {
202
214
  let result;
203
215
  formParam = formParam || this.form;
@@ -258,15 +270,17 @@ class Form extends Element_1.default {
258
270
  }
259
271
  /**
260
272
  * Returns the loaded forms JSON.
261
- * @returns {object} - The loaded form's JSON
273
+ *
274
+ * @return {object} - The loaded form's JSON
262
275
  */
263
276
  get form() {
264
277
  return this._form;
265
278
  }
266
279
  /**
267
280
  * Changes the display of the form.
281
+ *
268
282
  * @param {string} display - The display to set this form. Either "wizard", "form", or "pdf"
269
- * @returns {Promise<Webform|Wizard|PDF>} - The form instance that was created after changing the display.
283
+ * @return {Promise<T>}
270
284
  */
271
285
  setDisplay(display) {
272
286
  if ((this.display === display) && this.instance) {
@@ -307,9 +321,9 @@ class Form extends Element_1.default {
307
321
  }
308
322
  /**
309
323
  * Sanitize an html string.
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.
324
+ *
325
+ * @param string
326
+ * @returns {*}
313
327
  */
314
328
  sanitize(dirty, forceSanitize) {
315
329
  // If Sanitize is turned off
@@ -327,7 +341,8 @@ class Form extends Element_1.default {
327
341
  }
328
342
  /**
329
343
  * Build a new form.
330
- * @returns {Promise<Webform|Wizard|PDF>} - The form instance that was created.
344
+ *
345
+ * @return {Promise<T>}
331
346
  */
332
347
  build() {
333
348
  if (!this.instance) {
@@ -383,16 +398,15 @@ exports.default = Form;
383
398
  // Allow simple embedding.
384
399
  Formio_1.Formio.embedForm = (embed) => Form.embed(embed);
385
400
  /**
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');
401
+ * Factory that creates a new form based on the form parameters.
402
+ *
403
+ * @param element {HMTLElement} - The HTML Element to add this form to.
404
+ * @param form {string|Object} - The src of the form, or a form object.
405
+ * @param options {Object} - The options to create this form.
406
+ *
407
+ * @return {Promise} - When the form is instance is ready.
394
408
  */
395
- Formio_1.Formio.createForm = (elementOrForm, formOrOptions, options) => {
396
- return (new Form(elementOrForm, formOrOptions, options)).ready;
409
+ Formio_1.Formio.createForm = (...args) => {
410
+ return (new Form(...args)).ready;
397
411
  };
398
412
  Formio_1.Formio.Form = Form;