@formio/js 5.0.0-dev.5641.d9ab3df → 5.0.0-dev.5643.17b8168

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 (461) hide show
  1. package/Changelog.md +0 -37
  2. package/dist/formio.embed.js +1 -1
  3. package/dist/formio.embed.min.js +1 -1
  4. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  5. package/dist/formio.form.js +1188 -607
  6. package/dist/formio.form.min.js +1 -1
  7. package/dist/formio.form.min.js.LICENSE.txt +5 -3
  8. package/dist/formio.full.js +912 -651
  9. package/dist/formio.full.min.js +1 -1
  10. package/dist/formio.full.min.js.LICENSE.txt +5 -3
  11. package/dist/formio.js +18 -18
  12. package/dist/formio.min.js +1 -1
  13. package/dist/formio.min.js.LICENSE.txt +1 -1
  14. package/dist/formio.utils.js +494 -1831
  15. package/dist/formio.utils.min.js +1 -1
  16. package/dist/formio.utils.min.js.LICENSE.txt +4 -10
  17. package/lib/cjs/CDN.d.ts +0 -1
  18. package/lib/cjs/CDN.js +3 -6
  19. package/lib/cjs/Element.d.ts +96 -86
  20. package/lib/cjs/Element.js +78 -68
  21. package/lib/cjs/Embed.d.ts +1 -1
  22. package/lib/cjs/Embed.js +12 -52
  23. package/lib/cjs/Form.d.ts +36 -365
  24. package/lib/cjs/Form.js +64 -50
  25. package/lib/cjs/FormBuilder.d.ts +2 -187
  26. package/lib/cjs/FormBuilder.js +8 -30
  27. package/lib/cjs/PDF.d.ts +13 -11
  28. package/lib/cjs/PDF.js +8 -6
  29. package/lib/cjs/Webform.d.ts +139 -180
  30. package/lib/cjs/Webform.js +296 -309
  31. package/lib/cjs/WebformBuilder.d.ts +14 -16
  32. package/lib/cjs/WebformBuilder.js +10 -11
  33. package/lib/cjs/Wizard.d.ts +21 -31
  34. package/lib/cjs/Wizard.js +20 -43
  35. package/lib/cjs/WizardBuilder.d.ts +1 -1
  36. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +5 -8
  37. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +3 -6
  38. package/lib/cjs/components/Components.d.ts +4 -4
  39. package/lib/cjs/components/Components.js +3 -3
  40. package/lib/cjs/components/_classes/component/Component.d.ts +269 -502
  41. package/lib/cjs/components/_classes/component/Component.form.d.ts +3 -6
  42. package/lib/cjs/components/_classes/component/Component.form.js +0 -5
  43. package/lib/cjs/components/_classes/component/Component.js +189 -433
  44. package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +8 -0
  45. package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +2 -2
  46. package/lib/cjs/components/_classes/component/editForm/utils.js +2 -2
  47. package/lib/cjs/components/_classes/field/Field.d.ts +2 -11
  48. package/lib/cjs/components/_classes/field/Field.js +1 -13
  49. package/lib/cjs/components/_classes/input/Input.d.ts +3 -4
  50. package/lib/cjs/components/_classes/input/Input.js +2 -2
  51. package/lib/cjs/components/_classes/list/ListComponent.d.ts +2 -2
  52. package/lib/cjs/components/_classes/list/ListComponent.form.d.ts +3 -6
  53. package/lib/cjs/components/_classes/list/ListComponent.form.js +0 -5
  54. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +12 -43
  55. package/lib/cjs/components/_classes/multivalue/Multivalue.js +3 -37
  56. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +67 -163
  57. package/lib/cjs/components/_classes/nested/NestedComponent.form.d.ts +3 -6
  58. package/lib/cjs/components/_classes/nested/NestedComponent.form.js +0 -5
  59. package/lib/cjs/components/_classes/nested/NestedComponent.js +54 -175
  60. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -2
  61. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  62. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -7
  63. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +3 -2
  64. package/lib/cjs/components/address/Address.d.ts +2 -4
  65. package/lib/cjs/components/address/Address.form.d.ts +3 -6
  66. package/lib/cjs/components/address/Address.form.js +0 -5
  67. package/lib/cjs/components/button/Button.d.ts +12 -3
  68. package/lib/cjs/components/button/Button.form.d.ts +3 -6
  69. package/lib/cjs/components/button/Button.form.js +0 -5
  70. package/lib/cjs/components/button/Button.js +0 -5
  71. package/lib/cjs/components/checkbox/Checkbox.d.ts +27 -4
  72. package/lib/cjs/components/checkbox/Checkbox.form.d.ts +3 -6
  73. package/lib/cjs/components/checkbox/Checkbox.form.js +0 -5
  74. package/lib/cjs/components/columns/Columns.d.ts +2 -3
  75. package/lib/cjs/components/columns/Columns.form.d.ts +3 -6
  76. package/lib/cjs/components/columns/Columns.form.js +0 -5
  77. package/lib/cjs/components/columns/Columns.js +1 -1
  78. package/lib/cjs/components/container/Container.form.d.ts +3 -6
  79. package/lib/cjs/components/container/Container.form.js +0 -5
  80. package/lib/cjs/components/content/Content.d.ts +1 -2
  81. package/lib/cjs/components/content/Content.form.d.ts +3 -6
  82. package/lib/cjs/components/content/Content.form.js +0 -5
  83. package/lib/cjs/components/currency/Currency.form.d.ts +3 -6
  84. package/lib/cjs/components/currency/Currency.form.js +0 -5
  85. package/lib/cjs/components/currency/Currency.js +2 -1
  86. package/lib/cjs/components/datagrid/DataGrid.d.ts +7 -8
  87. package/lib/cjs/components/datagrid/DataGrid.form.d.ts +3 -6
  88. package/lib/cjs/components/datagrid/DataGrid.form.js +0 -5
  89. package/lib/cjs/components/datagrid/DataGrid.js +5 -5
  90. package/lib/cjs/components/datagrid/fixtures/comp-with-checkboxes.d.ts +29 -0
  91. package/lib/cjs/components/datagrid/fixtures/comp-with-checkboxes.js +36 -0
  92. package/lib/cjs/components/datagrid/fixtures/index.d.ts +2 -1
  93. package/lib/cjs/components/datagrid/fixtures/index.js +3 -1
  94. package/lib/cjs/components/datamap/DataMap.d.ts +0 -1
  95. package/lib/cjs/components/datamap/DataMap.form.d.ts +3 -6
  96. package/lib/cjs/components/datamap/DataMap.form.js +0 -5
  97. package/lib/cjs/components/datetime/DateTime.d.ts +14 -0
  98. package/lib/cjs/components/datetime/DateTime.form.d.ts +3 -6
  99. package/lib/cjs/components/datetime/DateTime.form.js +0 -5
  100. package/lib/cjs/components/datetime/editForm/DateTime.edit.date.js +2 -2
  101. package/lib/cjs/components/day/Day.d.ts +48 -22
  102. package/lib/cjs/components/day/Day.form.d.ts +3 -6
  103. package/lib/cjs/components/day/Day.form.js +0 -5
  104. package/lib/cjs/components/day/Day.js +20 -15
  105. package/lib/cjs/components/editgrid/EditGrid.d.ts +3 -7
  106. package/lib/cjs/components/editgrid/EditGrid.form.d.ts +3 -6
  107. package/lib/cjs/components/editgrid/EditGrid.form.js +0 -5
  108. package/lib/cjs/components/editgrid/EditGrid.js +3 -3
  109. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +5 -2
  110. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.templates.js +9 -6
  111. package/lib/cjs/components/email/Email.form.d.ts +3 -6
  112. package/lib/cjs/components/email/Email.form.js +0 -5
  113. package/lib/cjs/components/fieldset/Fieldset.form.d.ts +3 -6
  114. package/lib/cjs/components/fieldset/Fieldset.form.js +0 -5
  115. package/lib/cjs/components/file/File.d.ts +22 -9
  116. package/lib/cjs/components/file/File.form.d.ts +3 -6
  117. package/lib/cjs/components/file/File.form.js +0 -5
  118. package/lib/cjs/components/form/Form.d.ts +20 -31
  119. package/lib/cjs/components/form/Form.form.d.ts +3 -6
  120. package/lib/cjs/components/form/Form.form.js +0 -5
  121. package/lib/cjs/components/form/Form.js +14 -17
  122. package/lib/cjs/components/hidden/Hidden.d.ts +11 -1
  123. package/lib/cjs/components/hidden/Hidden.form.d.ts +3 -6
  124. package/lib/cjs/components/hidden/Hidden.form.js +0 -5
  125. package/lib/cjs/components/hidden/Hidden.js +2 -1
  126. package/lib/cjs/components/html/HTML.d.ts +1 -2
  127. package/lib/cjs/components/html/HTML.form.d.ts +3 -6
  128. package/lib/cjs/components/html/HTML.form.js +0 -5
  129. package/lib/cjs/components/number/Number.d.ts +17 -3
  130. package/lib/cjs/components/number/Number.form.d.ts +3 -6
  131. package/lib/cjs/components/number/Number.form.js +0 -5
  132. package/lib/cjs/components/number/Number.js +2 -1
  133. package/lib/cjs/components/panel/Panel.form.d.ts +3 -6
  134. package/lib/cjs/components/panel/Panel.form.js +0 -5
  135. package/lib/cjs/components/panel/Panel.js +1 -0
  136. package/lib/cjs/components/password/Password.form.d.ts +3 -6
  137. package/lib/cjs/components/password/Password.form.js +0 -5
  138. package/lib/cjs/components/phonenumber/PhoneNumber.form.d.ts +3 -6
  139. package/lib/cjs/components/phonenumber/PhoneNumber.form.js +0 -5
  140. package/lib/cjs/components/radio/Radio.d.ts +26 -3
  141. package/lib/cjs/components/radio/Radio.form.d.ts +3 -6
  142. package/lib/cjs/components/radio/Radio.form.js +0 -5
  143. package/lib/cjs/components/radio/Radio.js +7 -5
  144. package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +1 -1
  145. package/lib/cjs/components/recaptcha/ReCaptcha.form.d.ts +3 -6
  146. package/lib/cjs/components/recaptcha/ReCaptcha.form.js +0 -5
  147. package/lib/cjs/components/select/Select.d.ts +39 -16
  148. package/lib/cjs/components/select/Select.form.d.ts +3 -6
  149. package/lib/cjs/components/select/Select.form.js +0 -5
  150. package/lib/cjs/components/select/Select.js +16 -13
  151. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +17 -2
  152. package/lib/cjs/components/selectboxes/SelectBoxes.form.d.ts +3 -6
  153. package/lib/cjs/components/selectboxes/SelectBoxes.form.js +0 -5
  154. package/lib/cjs/components/selectboxes/SelectBoxes.js +9 -7
  155. package/lib/cjs/components/signature/Signature.d.ts +14 -1
  156. package/lib/cjs/components/signature/Signature.form.d.ts +3 -6
  157. package/lib/cjs/components/signature/Signature.form.js +0 -5
  158. package/lib/cjs/components/survey/Survey.d.ts +15 -3
  159. package/lib/cjs/components/survey/Survey.form.d.ts +3 -6
  160. package/lib/cjs/components/survey/Survey.form.js +0 -5
  161. package/lib/cjs/components/table/Table.d.ts +1 -2
  162. package/lib/cjs/components/table/Table.form.d.ts +3 -6
  163. package/lib/cjs/components/table/Table.form.js +0 -5
  164. package/lib/cjs/components/tabs/Tabs.d.ts +4 -4
  165. package/lib/cjs/components/tabs/Tabs.form.d.ts +3 -6
  166. package/lib/cjs/components/tabs/Tabs.form.js +0 -5
  167. package/lib/cjs/components/tabs/Tabs.js +2 -1
  168. package/lib/cjs/components/tags/Tags.d.ts +14 -0
  169. package/lib/cjs/components/tags/Tags.form.d.ts +3 -6
  170. package/lib/cjs/components/tags/Tags.form.js +0 -5
  171. package/lib/cjs/components/textarea/TextArea.d.ts +9 -4
  172. package/lib/cjs/components/textarea/TextArea.form.d.ts +3 -6
  173. package/lib/cjs/components/textarea/TextArea.form.js +0 -5
  174. package/lib/cjs/components/textarea/TextArea.js +2 -2
  175. package/lib/cjs/components/textfield/TextField.d.ts +30 -14
  176. package/lib/cjs/components/textfield/TextField.form.d.ts +3 -6
  177. package/lib/cjs/components/textfield/TextField.form.js +0 -5
  178. package/lib/cjs/components/textfield/TextField.js +17 -16
  179. package/lib/cjs/components/time/Time.form.d.ts +3 -6
  180. package/lib/cjs/components/time/Time.form.js +0 -5
  181. package/lib/cjs/components/unknown/Unknown.form.d.ts +34 -5
  182. package/lib/cjs/components/unknown/Unknown.form.js +0 -4
  183. package/lib/cjs/components/url/Url.form.d.ts +3 -6
  184. package/lib/cjs/components/url/Url.form.js +0 -5
  185. package/lib/cjs/components/well/Well.form.d.ts +3 -6
  186. package/lib/cjs/components/well/Well.form.js +0 -5
  187. package/lib/cjs/formio.embed.d.ts +2 -1
  188. package/lib/cjs/formio.embed.js +100 -2
  189. package/lib/cjs/formio.form.d.ts +4 -11
  190. package/lib/cjs/formio.form.js +5 -13
  191. package/lib/cjs/providers/Providers.d.ts +5 -36
  192. package/lib/cjs/providers/Providers.js +0 -29
  193. package/lib/cjs/providers/address/AddressProvider.d.ts +12 -131
  194. package/lib/cjs/providers/address/AddressProvider.js +2 -88
  195. package/lib/cjs/providers/address/AzureAddressProvider.d.ts +1 -48
  196. package/lib/cjs/providers/address/AzureAddressProvider.js +0 -37
  197. package/lib/cjs/providers/address/CustomAddressProvider.d.ts +4 -27
  198. package/lib/cjs/providers/address/CustomAddressProvider.js +0 -34
  199. package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +6 -130
  200. package/lib/cjs/providers/address/GoogleAddressProvider.js +0 -72
  201. package/lib/cjs/providers/address/NominatimAddressProvider.d.ts +7 -32
  202. package/lib/cjs/providers/address/NominatimAddressProvider.js +0 -33
  203. package/lib/cjs/providers/address/index.d.ts +1 -3
  204. package/lib/cjs/providers/processor/fileProcessor.d.ts +1 -7
  205. package/lib/cjs/providers/processor/fileProcessor.js +0 -6
  206. package/lib/cjs/providers/storage/azure.d.ts +13 -6
  207. package/lib/cjs/providers/storage/azure.js +0 -5
  208. package/lib/cjs/providers/storage/base64.d.ts +6 -5
  209. package/lib/cjs/providers/storage/base64.js +0 -4
  210. package/lib/cjs/providers/storage/dropbox.d.ts +4 -6
  211. package/lib/cjs/providers/storage/dropbox.js +0 -5
  212. package/lib/cjs/providers/storage/googleDrive.d.ts +5 -7
  213. package/lib/cjs/providers/storage/googleDrive.js +0 -6
  214. package/lib/cjs/providers/storage/indexeddb.d.ts +7 -5
  215. package/lib/cjs/providers/storage/indexeddb.js +0 -4
  216. package/lib/cjs/providers/storage/s3.d.ts +20 -6
  217. package/lib/cjs/providers/storage/s3.js +0 -5
  218. package/lib/cjs/providers/storage/url.d.ts +7 -6
  219. package/lib/cjs/providers/storage/url.js +0 -10
  220. package/lib/cjs/providers/storage/util.d.ts +1 -24
  221. package/lib/cjs/providers/storage/util.js +0 -18
  222. package/lib/cjs/templates/Templates.d.ts +0 -1
  223. package/lib/cjs/utils/Evaluator.d.ts +3 -6
  224. package/lib/cjs/utils/Evaluator.js +20 -11
  225. package/lib/cjs/utils/builder.d.ts +7 -9
  226. package/lib/cjs/utils/builder.js +5 -10
  227. package/lib/cjs/utils/calendarUtils.d.ts +13 -7
  228. package/lib/cjs/utils/calendarUtils.js +17 -10
  229. package/lib/cjs/utils/formUtils.d.ts +171 -43
  230. package/lib/cjs/utils/formUtils.js +569 -38
  231. package/lib/cjs/utils/utils.d.ts +221 -367
  232. package/lib/cjs/utils/utils.js +228 -335
  233. package/lib/cjs/widgets/CalendarWidget.d.ts +10 -9
  234. package/lib/cjs/widgets/CalendarWidget.js +11 -9
  235. package/lib/mjs/CDN.d.ts +0 -1
  236. package/lib/mjs/CDN.js +3 -6
  237. package/lib/mjs/Element.d.ts +96 -86
  238. package/lib/mjs/Element.js +78 -68
  239. package/lib/mjs/Embed.d.ts +1 -1
  240. package/lib/mjs/Embed.js +12 -52
  241. package/lib/mjs/Form.d.ts +36 -365
  242. package/lib/mjs/Form.js +57 -140
  243. package/lib/mjs/FormBuilder.d.ts +2 -187
  244. package/lib/mjs/FormBuilder.js +8 -32
  245. package/lib/mjs/PDF.d.ts +13 -11
  246. package/lib/mjs/PDF.js +8 -6
  247. package/lib/mjs/Webform.d.ts +139 -180
  248. package/lib/mjs/Webform.js +308 -321
  249. package/lib/mjs/WebformBuilder.d.ts +14 -16
  250. package/lib/mjs/WebformBuilder.js +10 -11
  251. package/lib/mjs/Wizard.d.ts +21 -31
  252. package/lib/mjs/Wizard.js +19 -42
  253. package/lib/mjs/WizardBuilder.d.ts +1 -1
  254. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +5 -8
  255. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +3 -6
  256. package/lib/mjs/components/Components.d.ts +4 -4
  257. package/lib/mjs/components/Components.js +3 -3
  258. package/lib/mjs/components/_classes/component/Component.d.ts +269 -502
  259. package/lib/mjs/components/_classes/component/Component.form.d.ts +3 -6
  260. package/lib/mjs/components/_classes/component/Component.form.js +0 -5
  261. package/lib/mjs/components/_classes/component/Component.js +189 -433
  262. package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +8 -0
  263. package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +1 -1
  264. package/lib/mjs/components/_classes/component/editForm/utils.js +1 -1
  265. package/lib/mjs/components/_classes/field/Field.d.ts +2 -11
  266. package/lib/mjs/components/_classes/field/Field.js +1 -13
  267. package/lib/mjs/components/_classes/input/Input.d.ts +3 -4
  268. package/lib/mjs/components/_classes/input/Input.js +2 -2
  269. package/lib/mjs/components/_classes/list/ListComponent.d.ts +2 -2
  270. package/lib/mjs/components/_classes/list/ListComponent.form.d.ts +3 -6
  271. package/lib/mjs/components/_classes/list/ListComponent.form.js +0 -5
  272. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +12 -43
  273. package/lib/mjs/components/_classes/multivalue/Multivalue.js +3 -37
  274. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +67 -163
  275. package/lib/mjs/components/_classes/nested/NestedComponent.form.d.ts +3 -6
  276. package/lib/mjs/components/_classes/nested/NestedComponent.form.js +0 -5
  277. package/lib/mjs/components/_classes/nested/NestedComponent.js +54 -175
  278. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -2
  279. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  280. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -7
  281. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +3 -2
  282. package/lib/mjs/components/address/Address.d.ts +2 -4
  283. package/lib/mjs/components/address/Address.form.d.ts +3 -6
  284. package/lib/mjs/components/address/Address.form.js +0 -5
  285. package/lib/mjs/components/button/Button.d.ts +12 -3
  286. package/lib/mjs/components/button/Button.form.d.ts +3 -6
  287. package/lib/mjs/components/button/Button.form.js +0 -5
  288. package/lib/mjs/components/button/Button.js +0 -5
  289. package/lib/mjs/components/checkbox/Checkbox.d.ts +27 -4
  290. package/lib/mjs/components/checkbox/Checkbox.form.d.ts +3 -6
  291. package/lib/mjs/components/checkbox/Checkbox.form.js +0 -5
  292. package/lib/mjs/components/columns/Columns.d.ts +2 -3
  293. package/lib/mjs/components/columns/Columns.form.d.ts +3 -6
  294. package/lib/mjs/components/columns/Columns.form.js +0 -5
  295. package/lib/mjs/components/columns/Columns.js +1 -1
  296. package/lib/mjs/components/container/Container.form.d.ts +3 -6
  297. package/lib/mjs/components/container/Container.form.js +0 -5
  298. package/lib/mjs/components/content/Content.d.ts +1 -2
  299. package/lib/mjs/components/content/Content.form.d.ts +3 -6
  300. package/lib/mjs/components/content/Content.form.js +0 -5
  301. package/lib/mjs/components/currency/Currency.form.d.ts +3 -6
  302. package/lib/mjs/components/currency/Currency.form.js +0 -5
  303. package/lib/mjs/components/currency/Currency.js +2 -1
  304. package/lib/mjs/components/datagrid/DataGrid.d.ts +7 -8
  305. package/lib/mjs/components/datagrid/DataGrid.form.d.ts +3 -6
  306. package/lib/mjs/components/datagrid/DataGrid.form.js +0 -5
  307. package/lib/mjs/components/datagrid/DataGrid.js +5 -5
  308. package/lib/mjs/components/datagrid/fixtures/comp-with-checkboxes.d.ts +29 -0
  309. package/lib/mjs/components/datagrid/fixtures/comp-with-checkboxes.js +34 -0
  310. package/lib/mjs/components/datagrid/fixtures/index.d.ts +2 -1
  311. package/lib/mjs/components/datagrid/fixtures/index.js +2 -1
  312. package/lib/mjs/components/datamap/DataMap.d.ts +0 -1
  313. package/lib/mjs/components/datamap/DataMap.form.d.ts +3 -6
  314. package/lib/mjs/components/datamap/DataMap.form.js +0 -5
  315. package/lib/mjs/components/datetime/DateTime.d.ts +14 -0
  316. package/lib/mjs/components/datetime/DateTime.form.d.ts +3 -6
  317. package/lib/mjs/components/datetime/DateTime.form.js +0 -5
  318. package/lib/mjs/components/datetime/editForm/DateTime.edit.date.js +1 -1
  319. package/lib/mjs/components/day/Day.d.ts +48 -22
  320. package/lib/mjs/components/day/Day.form.d.ts +3 -6
  321. package/lib/mjs/components/day/Day.form.js +0 -5
  322. package/lib/mjs/components/day/Day.js +20 -15
  323. package/lib/mjs/components/editgrid/EditGrid.d.ts +3 -7
  324. package/lib/mjs/components/editgrid/EditGrid.form.d.ts +3 -6
  325. package/lib/mjs/components/editgrid/EditGrid.form.js +0 -5
  326. package/lib/mjs/components/editgrid/EditGrid.js +3 -3
  327. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
  328. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.templates.js +1 -1
  329. package/lib/mjs/components/email/Email.form.d.ts +3 -6
  330. package/lib/mjs/components/email/Email.form.js +0 -5
  331. package/lib/mjs/components/fieldset/Fieldset.form.d.ts +3 -6
  332. package/lib/mjs/components/fieldset/Fieldset.form.js +0 -5
  333. package/lib/mjs/components/file/File.d.ts +22 -9
  334. package/lib/mjs/components/file/File.form.d.ts +3 -6
  335. package/lib/mjs/components/file/File.form.js +0 -5
  336. package/lib/mjs/components/form/Form.d.ts +20 -31
  337. package/lib/mjs/components/form/Form.form.d.ts +3 -6
  338. package/lib/mjs/components/form/Form.form.js +0 -5
  339. package/lib/mjs/components/form/Form.js +12 -15
  340. package/lib/mjs/components/hidden/Hidden.d.ts +11 -1
  341. package/lib/mjs/components/hidden/Hidden.form.d.ts +3 -6
  342. package/lib/mjs/components/hidden/Hidden.form.js +0 -5
  343. package/lib/mjs/components/hidden/Hidden.js +2 -1
  344. package/lib/mjs/components/html/HTML.d.ts +1 -2
  345. package/lib/mjs/components/html/HTML.form.d.ts +3 -6
  346. package/lib/mjs/components/html/HTML.form.js +0 -5
  347. package/lib/mjs/components/number/Number.d.ts +17 -3
  348. package/lib/mjs/components/number/Number.form.d.ts +3 -6
  349. package/lib/mjs/components/number/Number.form.js +0 -5
  350. package/lib/mjs/components/number/Number.js +2 -1
  351. package/lib/mjs/components/panel/Panel.form.d.ts +3 -6
  352. package/lib/mjs/components/panel/Panel.form.js +0 -5
  353. package/lib/mjs/components/panel/Panel.js +1 -0
  354. package/lib/mjs/components/password/Password.form.d.ts +3 -6
  355. package/lib/mjs/components/password/Password.form.js +0 -5
  356. package/lib/mjs/components/phonenumber/PhoneNumber.form.d.ts +3 -6
  357. package/lib/mjs/components/phonenumber/PhoneNumber.form.js +0 -5
  358. package/lib/mjs/components/radio/Radio.d.ts +26 -3
  359. package/lib/mjs/components/radio/Radio.form.d.ts +3 -6
  360. package/lib/mjs/components/radio/Radio.form.js +0 -5
  361. package/lib/mjs/components/radio/Radio.js +7 -5
  362. package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +1 -1
  363. package/lib/mjs/components/recaptcha/ReCaptcha.form.d.ts +3 -6
  364. package/lib/mjs/components/recaptcha/ReCaptcha.form.js +0 -5
  365. package/lib/mjs/components/select/Select.d.ts +39 -16
  366. package/lib/mjs/components/select/Select.form.d.ts +3 -6
  367. package/lib/mjs/components/select/Select.form.js +0 -5
  368. package/lib/mjs/components/select/Select.js +17 -14
  369. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +17 -2
  370. package/lib/mjs/components/selectboxes/SelectBoxes.form.d.ts +3 -6
  371. package/lib/mjs/components/selectboxes/SelectBoxes.form.js +0 -5
  372. package/lib/mjs/components/selectboxes/SelectBoxes.js +9 -7
  373. package/lib/mjs/components/signature/Signature.d.ts +14 -1
  374. package/lib/mjs/components/signature/Signature.form.d.ts +3 -6
  375. package/lib/mjs/components/signature/Signature.form.js +0 -5
  376. package/lib/mjs/components/survey/Survey.d.ts +15 -3
  377. package/lib/mjs/components/survey/Survey.form.d.ts +3 -6
  378. package/lib/mjs/components/survey/Survey.form.js +0 -5
  379. package/lib/mjs/components/table/Table.d.ts +1 -2
  380. package/lib/mjs/components/table/Table.form.d.ts +3 -6
  381. package/lib/mjs/components/table/Table.form.js +0 -5
  382. package/lib/mjs/components/tabs/Tabs.d.ts +4 -4
  383. package/lib/mjs/components/tabs/Tabs.form.d.ts +3 -6
  384. package/lib/mjs/components/tabs/Tabs.form.js +0 -5
  385. package/lib/mjs/components/tabs/Tabs.js +2 -1
  386. package/lib/mjs/components/tags/Tags.d.ts +14 -0
  387. package/lib/mjs/components/tags/Tags.form.d.ts +3 -6
  388. package/lib/mjs/components/tags/Tags.form.js +0 -5
  389. package/lib/mjs/components/textarea/TextArea.d.ts +9 -4
  390. package/lib/mjs/components/textarea/TextArea.form.d.ts +3 -6
  391. package/lib/mjs/components/textarea/TextArea.form.js +0 -5
  392. package/lib/mjs/components/textarea/TextArea.js +2 -2
  393. package/lib/mjs/components/textfield/TextField.d.ts +30 -14
  394. package/lib/mjs/components/textfield/TextField.form.d.ts +3 -6
  395. package/lib/mjs/components/textfield/TextField.form.js +0 -5
  396. package/lib/mjs/components/textfield/TextField.js +17 -16
  397. package/lib/mjs/components/time/Time.form.d.ts +3 -6
  398. package/lib/mjs/components/time/Time.form.js +0 -5
  399. package/lib/mjs/components/unknown/Unknown.form.d.ts +34 -5
  400. package/lib/mjs/components/unknown/Unknown.form.js +0 -4
  401. package/lib/mjs/components/url/Url.form.d.ts +3 -6
  402. package/lib/mjs/components/url/Url.form.js +0 -5
  403. package/lib/mjs/components/well/Well.form.d.ts +3 -6
  404. package/lib/mjs/components/well/Well.form.js +0 -5
  405. package/lib/mjs/formio.embed.d.ts +2 -1
  406. package/lib/mjs/formio.embed.js +99 -2
  407. package/lib/mjs/formio.form.d.ts +4 -11
  408. package/lib/mjs/formio.form.js +3 -10
  409. package/lib/mjs/providers/Providers.d.ts +5 -36
  410. package/lib/mjs/providers/Providers.js +0 -29
  411. package/lib/mjs/providers/address/AddressProvider.d.ts +12 -131
  412. package/lib/mjs/providers/address/AddressProvider.js +2 -88
  413. package/lib/mjs/providers/address/AzureAddressProvider.d.ts +1 -48
  414. package/lib/mjs/providers/address/AzureAddressProvider.js +0 -37
  415. package/lib/mjs/providers/address/CustomAddressProvider.d.ts +4 -27
  416. package/lib/mjs/providers/address/CustomAddressProvider.js +0 -34
  417. package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +6 -130
  418. package/lib/mjs/providers/address/GoogleAddressProvider.js +0 -72
  419. package/lib/mjs/providers/address/NominatimAddressProvider.d.ts +7 -32
  420. package/lib/mjs/providers/address/NominatimAddressProvider.js +0 -33
  421. package/lib/mjs/providers/address/index.d.ts +1 -3
  422. package/lib/mjs/providers/processor/fileProcessor.d.ts +1 -7
  423. package/lib/mjs/providers/processor/fileProcessor.js +0 -6
  424. package/lib/mjs/providers/storage/azure.d.ts +13 -6
  425. package/lib/mjs/providers/storage/azure.js +0 -5
  426. package/lib/mjs/providers/storage/base64.d.ts +6 -5
  427. package/lib/mjs/providers/storage/base64.js +0 -4
  428. package/lib/mjs/providers/storage/dropbox.d.ts +4 -6
  429. package/lib/mjs/providers/storage/dropbox.js +0 -5
  430. package/lib/mjs/providers/storage/googleDrive.d.ts +5 -7
  431. package/lib/mjs/providers/storage/googleDrive.js +0 -6
  432. package/lib/mjs/providers/storage/indexeddb.d.ts +7 -5
  433. package/lib/mjs/providers/storage/indexeddb.js +0 -4
  434. package/lib/mjs/providers/storage/s3.d.ts +20 -6
  435. package/lib/mjs/providers/storage/s3.js +0 -5
  436. package/lib/mjs/providers/storage/url.d.ts +7 -6
  437. package/lib/mjs/providers/storage/url.js +0 -10
  438. package/lib/mjs/providers/storage/util.d.ts +1 -24
  439. package/lib/mjs/providers/storage/util.js +0 -18
  440. package/lib/mjs/templates/Templates.d.ts +0 -1
  441. package/lib/mjs/utils/Evaluator.d.ts +3 -6
  442. package/lib/mjs/utils/Evaluator.js +20 -9
  443. package/lib/mjs/utils/builder.d.ts +7 -9
  444. package/lib/mjs/utils/builder.js +5 -10
  445. package/lib/mjs/utils/calendarUtils.d.ts +13 -7
  446. package/lib/mjs/utils/calendarUtils.js +17 -10
  447. package/lib/mjs/utils/formUtils.d.ts +171 -43
  448. package/lib/mjs/utils/formUtils.js +554 -6
  449. package/lib/mjs/utils/utils.d.ts +221 -367
  450. package/lib/mjs/utils/utils.js +222 -329
  451. package/lib/mjs/widgets/CalendarWidget.d.ts +10 -9
  452. package/lib/mjs/widgets/CalendarWidget.js +11 -9
  453. package/package.json +22 -22
  454. package/embed.d.ts +0 -1
  455. package/form.d.ts +0 -1
  456. package/lib/cjs/InlineEmbed.d.ts +0 -7
  457. package/lib/cjs/InlineEmbed.js +0 -116
  458. package/lib/mjs/InlineEmbed.d.ts +0 -7
  459. package/lib/mjs/InlineEmbed.js +0 -112
  460. package/sdk.d.ts +0 -1
  461. package/utils.d.ts +0 -1
@@ -1,2 +1,99 @@
1
- import { embed } from './InlineEmbed';
2
- embed();
1
+ import { Formio } from './Embed';
2
+ const scripts = document.getElementsByTagName('script');
3
+ const config = window.FormioConfig || {};
4
+ let thisScript = null;
5
+ let i = scripts.length;
6
+ const scriptName = config.scriptName || 'formio.embed.';
7
+ while (i--) {
8
+ if (scripts[i].src && (scripts[i].src.indexOf(scriptName) !== -1)) {
9
+ thisScript = scripts[i];
10
+ break;
11
+ }
12
+ }
13
+ if (thisScript) {
14
+ const query = {};
15
+ const queryString = thisScript.src.replace(/^[^?]+\??/, '');
16
+ queryString.replace(/\?/g, '&').split('&').forEach((item) => {
17
+ query[item.split('=')[0]] = item.split('=')[1] && decodeURIComponent(item.split('=')[1]);
18
+ });
19
+ let scriptSrc = thisScript.src.replace(/^([^?]+).*/, '$1').split('/');
20
+ scriptSrc.pop();
21
+ if (config.formioPath) {
22
+ config.formioPath(scriptSrc);
23
+ }
24
+ scriptSrc = scriptSrc.join('/');
25
+ const debug = (query.debug === 'true' || query.debug === '1');
26
+ const renderer = debug ? 'formio.form' : 'formio.form.min';
27
+ Formio.config = Object.assign({
28
+ script: query.script || (`${config.updatePath ? config.updatePath() : scriptSrc}/${renderer}.js`),
29
+ style: query.styles || (`${config.updatePath ? config.updatePath() : scriptSrc}/${renderer}.css`),
30
+ cdn: query.cdn,
31
+ class: (query.class || 'formio-form-wrapper'),
32
+ src: query.src,
33
+ form: null,
34
+ submission: null,
35
+ project: query.project,
36
+ base: query.base || 'https://api.form.io',
37
+ submit: query.submit,
38
+ includeLibs: (query.libs === 'true' || query.libs === '1'),
39
+ template: query.template,
40
+ debug: debug,
41
+ config: {},
42
+ redirect: (query.return || query.redirect),
43
+ embedCSS: (`${config.updatePath ? config.updatePath() : scriptSrc}/formio.embed.css`),
44
+ success: query.success || 'Thank you for your submission!',
45
+ before: null,
46
+ after: null
47
+ }, config);
48
+ const form = (Formio.config.form || Formio.config.src);
49
+ if (form) {
50
+ Formio.debug('Embedding Configuration', config);
51
+ if (Formio.config.addPremiumLib) {
52
+ Formio.config.addPremiumLib(Formio.config, scriptSrc);
53
+ }
54
+ // The id for this embedded form.
55
+ Formio.config.id = `formio-${Math.random().toString(36).substring(7)}`;
56
+ Formio.debug('Creating form element');
57
+ const element = Formio.createElement('div', {
58
+ 'id': Formio.config.id,
59
+ class: Formio.config.class
60
+ });
61
+ // insertAfter doesn't exist, but effect is identical.
62
+ thisScript.parentNode.insertBefore(element, thisScript.parentNode.firstElementChild.nextSibling);
63
+ Formio.createForm(element, form, Formio.config.config).then((instance) => {
64
+ if (Formio.config.submit) {
65
+ instance.nosubmit = true;
66
+ }
67
+ // Configure a redirect.
68
+ instance.on('submit', (submission) => {
69
+ Formio.debug("on('submit')", submission);
70
+ if (Formio.config.submit) {
71
+ Formio.debug(`Sending submission to ${Formio.config.submit}`);
72
+ const headers = {
73
+ 'content-type': 'application/json'
74
+ };
75
+ const token = Formio.FormioClass.getToken();
76
+ if (token) {
77
+ headers['x-jwt-token'] = token;
78
+ }
79
+ Formio.FormioClass.fetch(Formio.config.submit, {
80
+ body: JSON.stringify(submission),
81
+ headers: headers,
82
+ method: 'POST',
83
+ mode: 'cors',
84
+ })
85
+ .then(resp => resp.json())
86
+ .then(submission => Formio.submitDone(instance, submission));
87
+ }
88
+ else {
89
+ Formio.submitDone(instance, submission);
90
+ }
91
+ });
92
+ });
93
+ }
94
+ }
95
+ else {
96
+ // Show an error if the script cannot be found.
97
+ document.write('<span>Could not locate the Embedded form.</span>');
98
+ }
99
+ export { Formio };
@@ -1,17 +1,10 @@
1
1
  /**
2
2
  * Register a module
3
- * @param {any} mod - The module object to register. This can also be a function which accepts Formio as an argument.
4
- * @param {Function|null} [defaultFn] - The default function to call if the module does not have a known key.
5
- * @param {any} options - Options for the module.
6
- * @returns {void}
3
+ * @param {*} plugin
4
+ * @returns
7
5
  */
8
- export function registerModule(mod: any, defaultFn?: Function | null | undefined, options?: any): void;
9
- /**
10
- * @param {Function|null} defaultFn - The default function to call if the module does not have a known key.
11
- * @returns {void}
12
- */
13
- export function useModule(defaultFn?: Function | null): void;
14
- export { Formio as FormioCore } from "./Formio";
6
+ export function registerModule(mod: any, defaultFn?: null, options?: {}): void;
7
+ export function useModule(defaultFn?: null): (plugins: any, options?: {}) => void;
15
8
  import Components from './components/Components';
16
9
  import Displays from './displays/Displays';
17
10
  import Providers from './providers';
@@ -8,7 +8,7 @@ import Providers from './providers';
8
8
  import Widgets from './widgets';
9
9
  import Form from './Form';
10
10
  import Utils from './utils';
11
- import { Evaluator } from './utils/Evaluator';
11
+ import Evaluator from './utils/Evaluator';
12
12
  import Licenses from './licenses';
13
13
  import EventEmitter from './EventEmitter';
14
14
  import Webform from './Webform';
@@ -35,10 +35,8 @@ Formio.Formio = Formio;
35
35
  Formio.Components.setComponents(AllComponents);
36
36
  /**
37
37
  * Register a module
38
- * @param {any} mod - The module object to register. This can also be a function which accepts Formio as an argument.
39
- * @param {Function|null} [defaultFn] - The default function to call if the module does not have a known key.
40
- * @param {any} options - Options for the module.
41
- * @returns {void}
38
+ * @param {*} plugin
39
+ * @returns
42
40
  */
43
41
  export function registerModule(mod, defaultFn = null, options = {}) {
44
42
  if (typeof mod === 'function') {
@@ -99,10 +97,6 @@ export function registerModule(mod, defaultFn = null, options = {}) {
99
97
  }
100
98
  }
101
99
  }
102
- /**
103
- * @param {Function|null} defaultFn - The default function to call if the module does not have a known key.
104
- * @returns {void}
105
- */
106
100
  export function useModule(defaultFn = null) {
107
101
  return (plugins, options = {}) => {
108
102
  plugins = _.isArray(plugins) ? plugins : [plugins];
@@ -123,6 +117,5 @@ export function useModule(defaultFn = null) {
123
117
  * Formio.plugins([plugin1, plugin2, etc], options);
124
118
  */
125
119
  Formio.use = useModule();
126
- export { Formio as FormioCore } from './Formio';
127
120
  // Export the components.
128
121
  export { Components, Displays, Providers, Widgets, Templates, Utils, Form, Formio, Licenses, EventEmitter, Webform };
@@ -1,14 +1,7 @@
1
- /**
2
- * @class Providers
3
- * @classdesc Represents a collection of providers.
4
- */
5
- /**
6
- * Represents a collection of providers.
7
- */
8
1
  export default class Providers {
9
2
  static providers: {
10
3
  address: {
11
- [x: string]: typeof import("./address/AzureAddressProvider").AzureAddressProvider | typeof import("./address/CustomAddressProvider").CustomAddressProvider | typeof import("./address/GoogleAddressProvider").GoogleAddressProvider | typeof import("./address/NominatimAddressProvider").NominatimAddressProvider;
4
+ [x: string]: typeof import("./address/CustomAddressProvider").CustomAddressProvider | typeof import("./address/GoogleAddressProvider").GoogleAddressProvider;
12
5
  };
13
6
  auth: {};
14
7
  storage: {
@@ -20,32 +13,8 @@ export default class Providers {
20
13
  googledrive: typeof import("./storage/googleDrive").default;
21
14
  };
22
15
  };
23
- /**
24
- * Adds a provider to the collection.
25
- * @param {string} type - The type of the provider.
26
- * @param {string} name - The name of the provider.
27
- * @param {Provider} provider - The provider object.
28
- */
29
- static addProvider(type: string, name: string, provider: Provider): void;
30
- /**
31
- * Adds multiple providers to the collection.
32
- * @param {string} type - The type of the providers.
33
- * @param {{ [key: string]: Provider }} providers - The collection of providers.
34
- */
35
- static addProviders(type: string, providers: {
36
- [key: string]: Provider;
37
- }): void;
38
- /**
39
- * Retrives a provider a provider from the collection.
40
- * @param {string} type - The type of the provider.
41
- * @param {string} name - The name of the provider.
42
- * @returns {Provider | void} The provider object.
43
- */
44
- static getProvider(type: string, name: string): Provider | void;
45
- /**
46
- * Retrives all providers of a given type.
47
- * @param {string} type - The type of the providers.
48
- * @returns {Provider[] | void} The collection of providers.
49
- */
50
- static getProviders(type: string): Provider[] | void;
16
+ static addProvider(type: any, name: any, provider: any): void;
17
+ static addProviders(type: any, providers: any): void;
18
+ static getProvider(type: any, name: any): any;
19
+ static getProviders(type: any): any;
51
20
  }
@@ -2,53 +2,24 @@ import _ from 'lodash';
2
2
  import address from './address';
3
3
  import auth from './auth';
4
4
  import storage from './storage';
5
- /**
6
- * @class Providers
7
- * @classdesc Represents a collection of providers.
8
- */
9
- /**
10
- * Represents a collection of providers.
11
- */
12
5
  export default class Providers {
13
6
  static providers = {
14
7
  address,
15
8
  auth,
16
9
  storage,
17
10
  };
18
- /**
19
- * Adds a provider to the collection.
20
- * @param {string} type - The type of the provider.
21
- * @param {string} name - The name of the provider.
22
- * @param {Provider} provider - The provider object.
23
- */
24
11
  static addProvider(type, name, provider) {
25
12
  Providers.providers[type] = Providers.providers[type] || {};
26
13
  Providers.providers[type][name] = provider;
27
14
  }
28
- /**
29
- * Adds multiple providers to the collection.
30
- * @param {string} type - The type of the providers.
31
- * @param {{ [key: string]: Provider }} providers - The collection of providers.
32
- */
33
15
  static addProviders(type, providers) {
34
16
  Providers.providers[type] = _.merge(Providers.providers[type], providers);
35
17
  }
36
- /**
37
- * Retrives a provider a provider from the collection.
38
- * @param {string} type - The type of the provider.
39
- * @param {string} name - The name of the provider.
40
- * @returns {Provider | void} The provider object.
41
- */
42
18
  static getProvider(type, name) {
43
19
  if (Providers.providers[type] && Providers.providers[type][name]) {
44
20
  return Providers.providers[type][name];
45
21
  }
46
22
  }
47
- /**
48
- * Retrives all providers of a given type.
49
- * @param {string} type - The type of the providers.
50
- * @returns {Provider[] | void} The collection of providers.
51
- */
52
23
  static getProviders(type) {
53
24
  if (Providers.providers[type]) {
54
25
  return Providers.providers[type];
@@ -1,136 +1,17 @@
1
- /**
2
- * @typedef {object} RequestOptions
3
- * @property {object} params - The request parameters.
4
- * @property {boolean} noToken - Whether to include a token in the request.
5
- */
6
- /**
7
- * @typedef {object} Address
8
- * @property {string} street - The street address.
9
- * @property {string} city - The city.
10
- * @property {string} state - The state.
11
- * @property {string} country - The country.
12
- * @property {string} postalCode - The postal code.
13
- */
14
- /**
15
- * @class AddressProvider
16
- * @classdesc Represents an address provider.
17
- */
18
1
  export class AddressProvider {
19
- /**
20
- * @static
21
- * @type {string}
22
- * @description The name of the address provider.
23
- */
24
2
  static get name(): string;
25
- /**
26
- * @static
27
- * @type {string}
28
- * @description The display name of the address provider.
29
- */
30
3
  static get displayName(): string;
31
- /**
32
- * @class
33
- * @param {object} options - The options for the address provider.
34
- */
35
- constructor(options?: object);
4
+ constructor(options?: {});
36
5
  options: any;
37
- /**
38
- * @private
39
- * @description Executes before merging the options.
40
- */
41
- private beforeMergeOptions;
42
- /**
43
- * @private
44
- * @type {object}
45
- * @description The default options for the address provider.
46
- */
47
- private get defaultOptions();
48
- /**
49
- * @private
50
- * @type {string}
51
- * @description The query property name.
52
- */
53
- private get queryProperty();
54
- /**
55
- * @private
56
- * @type {string|null}
57
- * @description The response property name.
58
- */
59
- private get responseProperty();
60
- /**
61
- * @private
62
- * @type {string|null}
63
- * @description The display value property name.
64
- */
65
- private get displayValueProperty();
66
- /**
67
- * @private
68
- * @param {object} params - The parameters to serialize.
69
- * @returns {string} The serialized parameters.
70
- */
71
- private serialize;
72
- /**
73
- * @private
74
- * @param {object} options - The request options.
75
- * @returns {RequestOptions} The merged request options.
76
- */
77
- private getRequestOptions;
78
- /**
79
- * @private
80
- * @param {object} _options - The request options.
81
- * @throws {Error} Throws an error if the method is not implemented.
82
- */
83
- private getRequestUrl;
84
- /**
85
- * @private
86
- * @param {object} options - The request options.
87
- * @returns {Promise} A promise that resolves with the request result.
88
- */
89
- private makeRequest;
90
- /**
91
- * @public
92
- * @description The search parameters for the request.
93
- * @param {string} query - The search query.
94
- * @param {object} options - The search options.
95
- * @returns {Promise<Address[]>} A promise that resolves with the search results.
96
- */
97
- public search(query: string, options?: object): Promise<Address[]>;
98
- /**
99
- * @public
100
- * @param {Address} address - The address object.
101
- * @returns {string} The display value of the address.
102
- */
103
- public getDisplayValue(address: Address): string;
6
+ beforeMergeOptions(): void;
7
+ get defaultOptions(): {};
8
+ get queryProperty(): string;
9
+ get responseProperty(): null;
10
+ get displayValueProperty(): null;
11
+ serialize(params: any): any;
12
+ getRequestOptions(options?: {}): any;
13
+ getRequestUrl(options?: {}): void;
14
+ makeRequest(options?: {}): any;
15
+ search(query: any, options?: {}): any;
16
+ getDisplayValue(address: any): any;
104
17
  }
105
- export type RequestOptions = {
106
- /**
107
- * - The request parameters.
108
- */
109
- params: object;
110
- /**
111
- * - Whether to include a token in the request.
112
- */
113
- noToken: boolean;
114
- };
115
- export type Address = {
116
- /**
117
- * - The street address.
118
- */
119
- street: string;
120
- /**
121
- * - The city.
122
- */
123
- city: string;
124
- /**
125
- * - The state.
126
- */
127
- state: string;
128
- /**
129
- * - The country.
130
- */
131
- country: string;
132
- /**
133
- * - The postal code.
134
- */
135
- postalCode: string;
136
- };
@@ -1,127 +1,46 @@
1
1
  import _ from 'lodash';
2
2
  import { Formio } from '../../Formio';
3
- /**
4
- * @typedef {object} RequestOptions
5
- * @property {object} params - The request parameters.
6
- * @property {boolean} noToken - Whether to include a token in the request.
7
- */
8
- /**
9
- * @typedef {object} Address
10
- * @property {string} street - The street address.
11
- * @property {string} city - The city.
12
- * @property {string} state - The state.
13
- * @property {string} country - The country.
14
- * @property {string} postalCode - The postal code.
15
- */
16
- /**
17
- * @class AddressProvider
18
- * @classdesc Represents an address provider.
19
- */
20
3
  export class AddressProvider {
21
- /**
22
- * @static
23
- * @type {string}
24
- * @description The name of the address provider.
25
- */
26
4
  static get name() {
27
5
  return 'address';
28
6
  }
29
- /**
30
- * @static
31
- * @type {string}
32
- * @description The display name of the address provider.
33
- */
34
7
  static get displayName() {
35
8
  return 'Address';
36
9
  }
37
- /**
38
- * @class
39
- * @param {object} options - The options for the address provider.
40
- */
41
10
  constructor(options = {}) {
42
11
  this.beforeMergeOptions(options);
43
12
  this.options = _.merge({}, this.defaultOptions, options);
44
13
  }
45
- /**
46
- * @private
47
- * @description Executes before merging the options.
48
- */
49
14
  beforeMergeOptions() {
50
15
  return;
51
16
  }
52
- /**
53
- * @private
54
- * @type {object}
55
- * @description The default options for the address provider.
56
- */
57
17
  get defaultOptions() {
58
18
  return {};
59
19
  }
60
- /**
61
- * @private
62
- * @type {string}
63
- * @description The query property name.
64
- */
65
20
  get queryProperty() {
66
21
  return 'query';
67
22
  }
68
- /**
69
- * @private
70
- * @type {string|null}
71
- * @description The response property name.
72
- */
73
23
  get responseProperty() {
74
24
  return null;
75
25
  }
76
- /**
77
- * @private
78
- * @type {string|null}
79
- * @description The display value property name.
80
- */
81
26
  get displayValueProperty() {
82
27
  return null;
83
28
  }
84
- /**
85
- * @private
86
- * @param {object} params - The parameters to serialize.
87
- * @returns {string} The serialized parameters.
88
- */
89
29
  serialize(params) {
90
30
  return _.toPairs(params).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join('&');
91
31
  }
92
- /**
93
- * @private
94
- * @param {object} options - The request options.
95
- * @returns {RequestOptions} The merged request options.
96
- */
97
32
  getRequestOptions(options = {}) {
98
33
  return _.merge({}, this.options, options);
99
34
  }
100
- /**
101
- * @private
102
- * @param {object} _options - The request options.
103
- * @throws {Error} Throws an error if the method is not implemented.
104
- */
105
- getRequestUrl(_options = {}) {
35
+ // eslint-disable-next-line no-unused-vars
36
+ getRequestUrl(options = {}) {
106
37
  throw new Error('Method AddressProvider#getRequestUrl(options) is abstract.');
107
38
  }
108
- /**
109
- * @private
110
- * @param {object} options - The request options.
111
- * @returns {Promise} A promise that resolves with the request result.
112
- */
113
39
  makeRequest(options = {}) {
114
40
  return Formio.makeStaticRequest(this.getRequestUrl(options), 'GET', null, {
115
41
  noToken: true,
116
42
  });
117
43
  }
118
- /**
119
- * @public
120
- * @description The search parameters for the request.
121
- * @param {string} query - The search query.
122
- * @param {object} options - The search options.
123
- * @returns {Promise<Address[]>} A promise that resolves with the search results.
124
- */
125
44
  search(query, options = {}) {
126
45
  const requestOptions = this.getRequestOptions(options);
127
46
  const params = requestOptions.params = requestOptions.params || {};
@@ -129,11 +48,6 @@ export class AddressProvider {
129
48
  return this.makeRequest(requestOptions)
130
49
  .then((result) => this.responseProperty ? _.get(result, this.responseProperty, []) : result);
131
50
  }
132
- /**
133
- * @public
134
- * @param {Address} address - The address object.
135
- * @returns {string} The display value of the address.
136
- */
137
51
  getDisplayValue(address) {
138
52
  return this.displayValueProperty ? _.get(address, this.displayValueProperty, '') : String(address);
139
53
  }
@@ -1,59 +1,12 @@
1
- /**
2
- * @typedef {object} AzureAddressProviderOptionsParams
3
- * @property {string} 'api-version' - The version of the Azure Maps API.
4
- * @property {string} typeahead - Whether to enable typeahead in the search.
5
- * @typedef {object} AzureAddressProviderOptions
6
- * @property {AzureAddressProviderOptionsParams} params - The parameters for the Azure Maps API request.
7
- */
8
- /**
9
- * @class
10
- * @augments AddressProvider
11
- * @classdesc Represents an Azure Maps address provider.
12
- */
13
1
  export class AzureAddressProvider extends AddressProvider {
14
- /**
15
- * Gets the default options for the address provider.
16
- * @returns {{ params: { 'api-version': string, typeahead: string } }} The default options.
17
- */
18
2
  get defaultOptions(): {
19
3
  params: {
20
4
  'api-version': string;
21
5
  typeahead: string;
22
6
  };
23
7
  };
24
- /**
25
- * Gets the response property for the address provider.
26
- * @type {string}
27
- */
28
8
  get responseProperty(): string;
29
- /**
30
- * Gets the display value property for the address provider.
31
- * @type {string}
32
- */
33
9
  get displayValueProperty(): string;
34
- /**
35
- * Gets the request URL for the address provider.
36
- * @param {{params: any}} options - The request options.
37
- * @returns {string} The request URL.
38
- */
39
- getRequestUrl(options?: {
40
- params: any;
41
- }): string;
10
+ getRequestUrl(options?: {}): string;
42
11
  }
43
- export type AzureAddressProviderOptionsParams = {
44
- /**
45
- * 'api-version' - The version of the Azure Maps API.
46
- */
47
- "": string;
48
- /**
49
- * - Whether to enable typeahead in the search.
50
- */
51
- typeahead: string;
52
- };
53
- export type AzureAddressProviderOptions = {
54
- /**
55
- * - The parameters for the Azure Maps API request.
56
- */
57
- params: AzureAddressProviderOptionsParams;
58
- };
59
12
  import { AddressProvider } from './AddressProvider';
@@ -1,35 +1,11 @@
1
1
  import { AddressProvider } from './AddressProvider';
2
- /**
3
- * @typedef {object} AzureAddressProviderOptionsParams
4
- * @property {string} 'api-version' - The version of the Azure Maps API.
5
- * @property {string} typeahead - Whether to enable typeahead in the search.
6
- * @typedef {object} AzureAddressProviderOptions
7
- * @property {AzureAddressProviderOptionsParams} params - The parameters for the Azure Maps API request.
8
- */
9
- /**
10
- * @class
11
- * @augments AddressProvider
12
- * @classdesc Represents an Azure Maps address provider.
13
- */
14
2
  export class AzureAddressProvider extends AddressProvider {
15
- /**
16
- * Gets the name of the address provider.
17
- * @type {string}
18
- */
19
3
  static get name() {
20
4
  return 'azure';
21
5
  }
22
- /**
23
- * Gets the display name of the address provider.
24
- * @type {string}
25
- */
26
6
  static get displayName() {
27
7
  return 'Azure Maps';
28
8
  }
29
- /**
30
- * Gets the default options for the address provider.
31
- * @returns {{ params: { 'api-version': string, typeahead: string } }} The default options.
32
- */
33
9
  get defaultOptions() {
34
10
  return {
35
11
  params: {
@@ -38,25 +14,12 @@ export class AzureAddressProvider extends AddressProvider {
38
14
  },
39
15
  };
40
16
  }
41
- /**
42
- * Gets the response property for the address provider.
43
- * @type {string}
44
- */
45
17
  get responseProperty() {
46
18
  return 'results';
47
19
  }
48
- /**
49
- * Gets the display value property for the address provider.
50
- * @type {string}
51
- */
52
20
  get displayValueProperty() {
53
21
  return 'address.freeformAddress';
54
22
  }
55
- /**
56
- * Gets the request URL for the address provider.
57
- * @param {{params: any}} options - The request options.
58
- * @returns {string} The request URL.
59
- */
60
23
  getRequestUrl(options = {}) {
61
24
  const { params } = options;
62
25
  return `https://atlas.microsoft.com/search/address/json?${this.serialize(params)}`;