@formio/js 5.0.0-dev.5604.02ffada → 5.0.0-dev.5610.c46fab6

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 (445) hide show
  1. package/Changelog.md +1 -0
  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 +646 -1194
  6. package/dist/formio.form.min.js +1 -1
  7. package/dist/formio.form.min.js.LICENSE.txt +3 -11
  8. package/dist/formio.full.js +690 -918
  9. package/dist/formio.full.min.js +1 -1
  10. package/dist/formio.full.min.js.LICENSE.txt +3 -11
  11. package/dist/formio.js +16 -16
  12. package/dist/formio.min.js +1 -1
  13. package/dist/formio.min.js.LICENSE.txt +1 -1
  14. package/dist/formio.utils.js +1856 -488
  15. package/dist/formio.utils.min.js +1 -1
  16. package/dist/formio.utils.min.js.LICENSE.txt +12 -2
  17. package/embed.d.ts +1 -0
  18. package/form.d.ts +1 -0
  19. package/lib/cjs/Element.d.ts +86 -96
  20. package/lib/cjs/Element.js +68 -78
  21. package/lib/cjs/Form.d.ts +365 -36
  22. package/lib/cjs/Form.js +50 -64
  23. package/lib/cjs/FormBuilder.d.ts +187 -2
  24. package/lib/cjs/FormBuilder.js +30 -8
  25. package/lib/cjs/InlineEmbed.d.ts +7 -0
  26. package/lib/cjs/InlineEmbed.js +109 -0
  27. package/lib/cjs/PDF.d.ts +11 -13
  28. package/lib/cjs/PDF.js +6 -8
  29. package/lib/cjs/Webform.d.ts +180 -139
  30. package/lib/cjs/Webform.js +313 -298
  31. package/lib/cjs/WebformBuilder.d.ts +16 -14
  32. package/lib/cjs/WebformBuilder.js +11 -10
  33. package/lib/cjs/Wizard.d.ts +31 -21
  34. package/lib/cjs/Wizard.js +42 -19
  35. package/lib/cjs/WizardBuilder.d.ts +1 -1
  36. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +8 -5
  37. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +6 -3
  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 +501 -266
  41. package/lib/cjs/components/_classes/component/Component.form.d.ts +6 -3
  42. package/lib/cjs/components/_classes/component/Component.form.js +5 -0
  43. package/lib/cjs/components/_classes/component/Component.js +433 -190
  44. package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +0 -8
  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 +11 -2
  48. package/lib/cjs/components/_classes/field/Field.js +13 -1
  49. package/lib/cjs/components/_classes/input/Input.d.ts +4 -3
  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 +6 -3
  53. package/lib/cjs/components/_classes/list/ListComponent.form.js +5 -0
  54. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +43 -12
  55. package/lib/cjs/components/_classes/multivalue/Multivalue.js +37 -3
  56. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +163 -67
  57. package/lib/cjs/components/_classes/nested/NestedComponent.form.d.ts +6 -3
  58. package/lib/cjs/components/_classes/nested/NestedComponent.form.js +5 -0
  59. package/lib/cjs/components/_classes/nested/NestedComponent.js +175 -54
  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 +7 -1
  63. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +2 -3
  64. package/lib/cjs/components/address/Address.d.ts +4 -2
  65. package/lib/cjs/components/address/Address.form.d.ts +6 -3
  66. package/lib/cjs/components/address/Address.form.js +5 -0
  67. package/lib/cjs/components/button/Button.d.ts +3 -12
  68. package/lib/cjs/components/button/Button.form.d.ts +6 -3
  69. package/lib/cjs/components/button/Button.form.js +5 -0
  70. package/lib/cjs/components/button/Button.js +5 -0
  71. package/lib/cjs/components/checkbox/Checkbox.d.ts +4 -27
  72. package/lib/cjs/components/checkbox/Checkbox.form.d.ts +6 -3
  73. package/lib/cjs/components/checkbox/Checkbox.form.js +5 -0
  74. package/lib/cjs/components/columns/Columns.d.ts +3 -2
  75. package/lib/cjs/components/columns/Columns.form.d.ts +6 -3
  76. package/lib/cjs/components/columns/Columns.form.js +5 -0
  77. package/lib/cjs/components/columns/Columns.js +1 -1
  78. package/lib/cjs/components/container/Container.form.d.ts +6 -3
  79. package/lib/cjs/components/container/Container.form.js +5 -0
  80. package/lib/cjs/components/content/Content.d.ts +2 -1
  81. package/lib/cjs/components/content/Content.form.d.ts +6 -3
  82. package/lib/cjs/components/content/Content.form.js +5 -0
  83. package/lib/cjs/components/currency/Currency.form.d.ts +6 -3
  84. package/lib/cjs/components/currency/Currency.form.js +5 -0
  85. package/lib/cjs/components/currency/Currency.js +1 -2
  86. package/lib/cjs/components/datagrid/DataGrid.d.ts +8 -7
  87. package/lib/cjs/components/datagrid/DataGrid.form.d.ts +6 -3
  88. package/lib/cjs/components/datagrid/DataGrid.form.js +5 -0
  89. package/lib/cjs/components/datagrid/DataGrid.js +5 -5
  90. package/lib/cjs/components/datamap/DataMap.d.ts +1 -0
  91. package/lib/cjs/components/datamap/DataMap.form.d.ts +6 -3
  92. package/lib/cjs/components/datamap/DataMap.form.js +5 -0
  93. package/lib/cjs/components/datetime/DateTime.d.ts +0 -14
  94. package/lib/cjs/components/datetime/DateTime.form.d.ts +6 -3
  95. package/lib/cjs/components/datetime/DateTime.form.js +5 -0
  96. package/lib/cjs/components/datetime/editForm/DateTime.edit.date.js +2 -2
  97. package/lib/cjs/components/day/Day.d.ts +22 -48
  98. package/lib/cjs/components/day/Day.form.d.ts +6 -3
  99. package/lib/cjs/components/day/Day.form.js +5 -0
  100. package/lib/cjs/components/day/Day.js +15 -20
  101. package/lib/cjs/components/editgrid/EditGrid.d.ts +7 -3
  102. package/lib/cjs/components/editgrid/EditGrid.form.d.ts +6 -3
  103. package/lib/cjs/components/editgrid/EditGrid.form.js +5 -0
  104. package/lib/cjs/components/editgrid/EditGrid.js +3 -3
  105. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +2 -5
  106. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.templates.js +6 -9
  107. package/lib/cjs/components/email/Email.form.d.ts +6 -3
  108. package/lib/cjs/components/email/Email.form.js +5 -0
  109. package/lib/cjs/components/fieldset/Fieldset.form.d.ts +6 -3
  110. package/lib/cjs/components/fieldset/Fieldset.form.js +5 -0
  111. package/lib/cjs/components/file/File.d.ts +9 -22
  112. package/lib/cjs/components/file/File.form.d.ts +6 -3
  113. package/lib/cjs/components/file/File.form.js +5 -0
  114. package/lib/cjs/components/form/Form.d.ts +31 -20
  115. package/lib/cjs/components/form/Form.form.d.ts +6 -3
  116. package/lib/cjs/components/form/Form.form.js +5 -0
  117. package/lib/cjs/components/form/Form.js +13 -10
  118. package/lib/cjs/components/hidden/Hidden.d.ts +1 -11
  119. package/lib/cjs/components/hidden/Hidden.form.d.ts +6 -3
  120. package/lib/cjs/components/hidden/Hidden.form.js +5 -0
  121. package/lib/cjs/components/hidden/Hidden.js +1 -2
  122. package/lib/cjs/components/html/HTML.d.ts +2 -1
  123. package/lib/cjs/components/html/HTML.form.d.ts +6 -3
  124. package/lib/cjs/components/html/HTML.form.js +5 -0
  125. package/lib/cjs/components/number/Number.d.ts +3 -17
  126. package/lib/cjs/components/number/Number.form.d.ts +6 -3
  127. package/lib/cjs/components/number/Number.form.js +5 -0
  128. package/lib/cjs/components/number/Number.js +1 -2
  129. package/lib/cjs/components/panel/Panel.form.d.ts +6 -3
  130. package/lib/cjs/components/panel/Panel.form.js +5 -0
  131. package/lib/cjs/components/panel/Panel.js +0 -1
  132. package/lib/cjs/components/password/Password.form.d.ts +6 -3
  133. package/lib/cjs/components/password/Password.form.js +5 -0
  134. package/lib/cjs/components/phonenumber/PhoneNumber.form.d.ts +6 -3
  135. package/lib/cjs/components/phonenumber/PhoneNumber.form.js +5 -0
  136. package/lib/cjs/components/radio/Radio.d.ts +3 -26
  137. package/lib/cjs/components/radio/Radio.form.d.ts +6 -3
  138. package/lib/cjs/components/radio/Radio.form.js +5 -0
  139. package/lib/cjs/components/radio/Radio.js +3 -4
  140. package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +1 -1
  141. package/lib/cjs/components/recaptcha/ReCaptcha.form.d.ts +5 -3
  142. package/lib/cjs/components/recaptcha/ReCaptcha.form.js +4 -0
  143. package/lib/cjs/components/select/Select.d.ts +16 -39
  144. package/lib/cjs/components/select/Select.form.d.ts +6 -3
  145. package/lib/cjs/components/select/Select.form.js +5 -0
  146. package/lib/cjs/components/select/Select.js +13 -16
  147. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +2 -17
  148. package/lib/cjs/components/selectboxes/SelectBoxes.form.d.ts +6 -3
  149. package/lib/cjs/components/selectboxes/SelectBoxes.form.js +5 -0
  150. package/lib/cjs/components/selectboxes/SelectBoxes.js +7 -9
  151. package/lib/cjs/components/signature/Signature.d.ts +1 -14
  152. package/lib/cjs/components/signature/Signature.form.d.ts +6 -3
  153. package/lib/cjs/components/signature/Signature.form.js +5 -0
  154. package/lib/cjs/components/survey/Survey.d.ts +3 -15
  155. package/lib/cjs/components/survey/Survey.form.d.ts +6 -3
  156. package/lib/cjs/components/survey/Survey.form.js +5 -0
  157. package/lib/cjs/components/table/Table.d.ts +2 -1
  158. package/lib/cjs/components/table/Table.form.d.ts +6 -3
  159. package/lib/cjs/components/table/Table.form.js +5 -0
  160. package/lib/cjs/components/tabs/Tabs.d.ts +4 -4
  161. package/lib/cjs/components/tabs/Tabs.form.d.ts +6 -3
  162. package/lib/cjs/components/tabs/Tabs.form.js +5 -0
  163. package/lib/cjs/components/tabs/Tabs.js +1 -2
  164. package/lib/cjs/components/tags/Tags.d.ts +0 -14
  165. package/lib/cjs/components/tags/Tags.form.d.ts +6 -3
  166. package/lib/cjs/components/tags/Tags.form.js +5 -0
  167. package/lib/cjs/components/textarea/TextArea.d.ts +4 -9
  168. package/lib/cjs/components/textarea/TextArea.form.d.ts +6 -3
  169. package/lib/cjs/components/textarea/TextArea.form.js +5 -0
  170. package/lib/cjs/components/textarea/TextArea.js +2 -2
  171. package/lib/cjs/components/textfield/TextField.d.ts +14 -30
  172. package/lib/cjs/components/textfield/TextField.form.d.ts +6 -3
  173. package/lib/cjs/components/textfield/TextField.form.js +5 -0
  174. package/lib/cjs/components/textfield/TextField.js +13 -16
  175. package/lib/cjs/components/time/Time.form.d.ts +6 -3
  176. package/lib/cjs/components/time/Time.form.js +5 -0
  177. package/lib/cjs/components/unknown/Unknown.form.d.ts +5 -34
  178. package/lib/cjs/components/unknown/Unknown.form.js +4 -0
  179. package/lib/cjs/components/url/Url.form.d.ts +6 -3
  180. package/lib/cjs/components/url/Url.form.js +5 -0
  181. package/lib/cjs/components/well/Well.form.d.ts +6 -3
  182. package/lib/cjs/components/well/Well.form.js +5 -0
  183. package/lib/cjs/formio.embed.d.ts +1 -2
  184. package/lib/cjs/formio.embed.js +2 -100
  185. package/lib/cjs/formio.form.d.ts +11 -4
  186. package/lib/cjs/formio.form.js +13 -5
  187. package/lib/cjs/providers/Providers.d.ts +36 -5
  188. package/lib/cjs/providers/Providers.js +29 -0
  189. package/lib/cjs/providers/address/AddressProvider.d.ts +131 -12
  190. package/lib/cjs/providers/address/AddressProvider.js +88 -2
  191. package/lib/cjs/providers/address/AzureAddressProvider.d.ts +48 -1
  192. package/lib/cjs/providers/address/AzureAddressProvider.js +37 -0
  193. package/lib/cjs/providers/address/CustomAddressProvider.d.ts +27 -4
  194. package/lib/cjs/providers/address/CustomAddressProvider.js +34 -0
  195. package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +130 -6
  196. package/lib/cjs/providers/address/GoogleAddressProvider.js +72 -0
  197. package/lib/cjs/providers/address/NominatimAddressProvider.d.ts +32 -7
  198. package/lib/cjs/providers/address/NominatimAddressProvider.js +33 -0
  199. package/lib/cjs/providers/address/index.d.ts +3 -1
  200. package/lib/cjs/providers/processor/fileProcessor.d.ts +7 -1
  201. package/lib/cjs/providers/processor/fileProcessor.js +6 -0
  202. package/lib/cjs/providers/storage/azure.d.ts +6 -13
  203. package/lib/cjs/providers/storage/azure.js +5 -0
  204. package/lib/cjs/providers/storage/base64.d.ts +5 -6
  205. package/lib/cjs/providers/storage/base64.js +4 -0
  206. package/lib/cjs/providers/storage/dropbox.d.ts +6 -4
  207. package/lib/cjs/providers/storage/dropbox.js +5 -0
  208. package/lib/cjs/providers/storage/googleDrive.d.ts +7 -5
  209. package/lib/cjs/providers/storage/googleDrive.js +6 -0
  210. package/lib/cjs/providers/storage/indexeddb.d.ts +5 -7
  211. package/lib/cjs/providers/storage/indexeddb.js +4 -0
  212. package/lib/cjs/providers/storage/s3.d.ts +6 -20
  213. package/lib/cjs/providers/storage/s3.js +5 -0
  214. package/lib/cjs/providers/storage/url.d.ts +6 -7
  215. package/lib/cjs/providers/storage/url.js +10 -0
  216. package/lib/cjs/providers/storage/util.d.ts +24 -1
  217. package/lib/cjs/providers/storage/util.js +18 -0
  218. package/lib/cjs/templates/Templates.d.ts +1 -0
  219. package/lib/cjs/utils/Evaluator.d.ts +6 -3
  220. package/lib/cjs/utils/Evaluator.js +11 -20
  221. package/lib/cjs/utils/builder.d.ts +9 -7
  222. package/lib/cjs/utils/builder.js +10 -5
  223. package/lib/cjs/utils/calendarUtils.d.ts +7 -13
  224. package/lib/cjs/utils/calendarUtils.js +10 -17
  225. package/lib/cjs/utils/formUtils.d.ts +43 -171
  226. package/lib/cjs/utils/formUtils.js +38 -569
  227. package/lib/cjs/utils/utils.d.ts +362 -216
  228. package/lib/cjs/utils/utils.js +331 -224
  229. package/lib/cjs/widgets/CalendarWidget.d.ts +9 -10
  230. package/lib/cjs/widgets/CalendarWidget.js +9 -11
  231. package/lib/mjs/Element.d.ts +86 -96
  232. package/lib/mjs/Element.js +68 -78
  233. package/lib/mjs/Form.d.ts +365 -36
  234. package/lib/mjs/Form.js +140 -57
  235. package/lib/mjs/FormBuilder.d.ts +187 -2
  236. package/lib/mjs/FormBuilder.js +32 -8
  237. package/lib/mjs/InlineEmbed.d.ts +7 -0
  238. package/lib/mjs/InlineEmbed.js +105 -0
  239. package/lib/mjs/PDF.d.ts +11 -13
  240. package/lib/mjs/PDF.js +6 -8
  241. package/lib/mjs/Webform.d.ts +180 -139
  242. package/lib/mjs/Webform.js +325 -310
  243. package/lib/mjs/WebformBuilder.d.ts +16 -14
  244. package/lib/mjs/WebformBuilder.js +11 -10
  245. package/lib/mjs/Wizard.d.ts +31 -21
  246. package/lib/mjs/Wizard.js +41 -18
  247. package/lib/mjs/WizardBuilder.d.ts +1 -1
  248. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +8 -5
  249. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +6 -3
  250. package/lib/mjs/components/Components.d.ts +4 -4
  251. package/lib/mjs/components/Components.js +3 -3
  252. package/lib/mjs/components/_classes/component/Component.d.ts +501 -266
  253. package/lib/mjs/components/_classes/component/Component.form.d.ts +6 -3
  254. package/lib/mjs/components/_classes/component/Component.form.js +5 -0
  255. package/lib/mjs/components/_classes/component/Component.js +433 -190
  256. package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +0 -8
  257. package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +1 -1
  258. package/lib/mjs/components/_classes/component/editForm/utils.js +1 -1
  259. package/lib/mjs/components/_classes/field/Field.d.ts +11 -2
  260. package/lib/mjs/components/_classes/field/Field.js +13 -1
  261. package/lib/mjs/components/_classes/input/Input.d.ts +4 -3
  262. package/lib/mjs/components/_classes/input/Input.js +2 -2
  263. package/lib/mjs/components/_classes/list/ListComponent.d.ts +2 -2
  264. package/lib/mjs/components/_classes/list/ListComponent.form.d.ts +6 -3
  265. package/lib/mjs/components/_classes/list/ListComponent.form.js +5 -0
  266. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +43 -12
  267. package/lib/mjs/components/_classes/multivalue/Multivalue.js +37 -3
  268. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +163 -67
  269. package/lib/mjs/components/_classes/nested/NestedComponent.form.d.ts +6 -3
  270. package/lib/mjs/components/_classes/nested/NestedComponent.form.js +5 -0
  271. package/lib/mjs/components/_classes/nested/NestedComponent.js +175 -54
  272. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -2
  273. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  274. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +7 -1
  275. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +2 -3
  276. package/lib/mjs/components/address/Address.d.ts +4 -2
  277. package/lib/mjs/components/address/Address.form.d.ts +6 -3
  278. package/lib/mjs/components/address/Address.form.js +5 -0
  279. package/lib/mjs/components/button/Button.d.ts +3 -12
  280. package/lib/mjs/components/button/Button.form.d.ts +6 -3
  281. package/lib/mjs/components/button/Button.form.js +5 -0
  282. package/lib/mjs/components/button/Button.js +5 -0
  283. package/lib/mjs/components/checkbox/Checkbox.d.ts +4 -27
  284. package/lib/mjs/components/checkbox/Checkbox.form.d.ts +6 -3
  285. package/lib/mjs/components/checkbox/Checkbox.form.js +5 -0
  286. package/lib/mjs/components/columns/Columns.d.ts +3 -2
  287. package/lib/mjs/components/columns/Columns.form.d.ts +6 -3
  288. package/lib/mjs/components/columns/Columns.form.js +5 -0
  289. package/lib/mjs/components/columns/Columns.js +1 -1
  290. package/lib/mjs/components/container/Container.form.d.ts +6 -3
  291. package/lib/mjs/components/container/Container.form.js +5 -0
  292. package/lib/mjs/components/content/Content.d.ts +2 -1
  293. package/lib/mjs/components/content/Content.form.d.ts +6 -3
  294. package/lib/mjs/components/content/Content.form.js +5 -0
  295. package/lib/mjs/components/currency/Currency.form.d.ts +6 -3
  296. package/lib/mjs/components/currency/Currency.form.js +5 -0
  297. package/lib/mjs/components/currency/Currency.js +1 -2
  298. package/lib/mjs/components/datagrid/DataGrid.d.ts +8 -7
  299. package/lib/mjs/components/datagrid/DataGrid.form.d.ts +6 -3
  300. package/lib/mjs/components/datagrid/DataGrid.form.js +5 -0
  301. package/lib/mjs/components/datagrid/DataGrid.js +5 -5
  302. package/lib/mjs/components/datamap/DataMap.d.ts +1 -0
  303. package/lib/mjs/components/datamap/DataMap.form.d.ts +6 -3
  304. package/lib/mjs/components/datamap/DataMap.form.js +5 -0
  305. package/lib/mjs/components/datetime/DateTime.d.ts +0 -14
  306. package/lib/mjs/components/datetime/DateTime.form.d.ts +6 -3
  307. package/lib/mjs/components/datetime/DateTime.form.js +5 -0
  308. package/lib/mjs/components/datetime/editForm/DateTime.edit.date.js +1 -1
  309. package/lib/mjs/components/day/Day.d.ts +22 -48
  310. package/lib/mjs/components/day/Day.form.d.ts +6 -3
  311. package/lib/mjs/components/day/Day.form.js +5 -0
  312. package/lib/mjs/components/day/Day.js +15 -20
  313. package/lib/mjs/components/editgrid/EditGrid.d.ts +7 -3
  314. package/lib/mjs/components/editgrid/EditGrid.form.d.ts +6 -3
  315. package/lib/mjs/components/editgrid/EditGrid.form.js +5 -0
  316. package/lib/mjs/components/editgrid/EditGrid.js +3 -3
  317. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
  318. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.templates.js +1 -1
  319. package/lib/mjs/components/email/Email.form.d.ts +6 -3
  320. package/lib/mjs/components/email/Email.form.js +5 -0
  321. package/lib/mjs/components/fieldset/Fieldset.form.d.ts +6 -3
  322. package/lib/mjs/components/fieldset/Fieldset.form.js +5 -0
  323. package/lib/mjs/components/file/File.d.ts +9 -22
  324. package/lib/mjs/components/file/File.form.d.ts +6 -3
  325. package/lib/mjs/components/file/File.form.js +5 -0
  326. package/lib/mjs/components/form/Form.d.ts +31 -20
  327. package/lib/mjs/components/form/Form.form.d.ts +6 -3
  328. package/lib/mjs/components/form/Form.form.js +5 -0
  329. package/lib/mjs/components/form/Form.js +13 -10
  330. package/lib/mjs/components/hidden/Hidden.d.ts +1 -11
  331. package/lib/mjs/components/hidden/Hidden.form.d.ts +6 -3
  332. package/lib/mjs/components/hidden/Hidden.form.js +5 -0
  333. package/lib/mjs/components/hidden/Hidden.js +1 -2
  334. package/lib/mjs/components/html/HTML.d.ts +2 -1
  335. package/lib/mjs/components/html/HTML.form.d.ts +6 -3
  336. package/lib/mjs/components/html/HTML.form.js +5 -0
  337. package/lib/mjs/components/number/Number.d.ts +3 -17
  338. package/lib/mjs/components/number/Number.form.d.ts +6 -3
  339. package/lib/mjs/components/number/Number.form.js +5 -0
  340. package/lib/mjs/components/number/Number.js +1 -2
  341. package/lib/mjs/components/panel/Panel.form.d.ts +6 -3
  342. package/lib/mjs/components/panel/Panel.form.js +5 -0
  343. package/lib/mjs/components/panel/Panel.js +0 -1
  344. package/lib/mjs/components/password/Password.form.d.ts +6 -3
  345. package/lib/mjs/components/password/Password.form.js +5 -0
  346. package/lib/mjs/components/phonenumber/PhoneNumber.form.d.ts +6 -3
  347. package/lib/mjs/components/phonenumber/PhoneNumber.form.js +5 -0
  348. package/lib/mjs/components/radio/Radio.d.ts +3 -26
  349. package/lib/mjs/components/radio/Radio.form.d.ts +6 -3
  350. package/lib/mjs/components/radio/Radio.form.js +5 -0
  351. package/lib/mjs/components/radio/Radio.js +3 -4
  352. package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +1 -1
  353. package/lib/mjs/components/recaptcha/ReCaptcha.form.d.ts +5 -3
  354. package/lib/mjs/components/recaptcha/ReCaptcha.form.js +4 -0
  355. package/lib/mjs/components/select/Select.d.ts +16 -39
  356. package/lib/mjs/components/select/Select.form.d.ts +6 -3
  357. package/lib/mjs/components/select/Select.form.js +5 -0
  358. package/lib/mjs/components/select/Select.js +13 -16
  359. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +2 -17
  360. package/lib/mjs/components/selectboxes/SelectBoxes.form.d.ts +6 -3
  361. package/lib/mjs/components/selectboxes/SelectBoxes.form.js +5 -0
  362. package/lib/mjs/components/selectboxes/SelectBoxes.js +7 -9
  363. package/lib/mjs/components/signature/Signature.d.ts +1 -14
  364. package/lib/mjs/components/signature/Signature.form.d.ts +6 -3
  365. package/lib/mjs/components/signature/Signature.form.js +5 -0
  366. package/lib/mjs/components/survey/Survey.d.ts +3 -15
  367. package/lib/mjs/components/survey/Survey.form.d.ts +6 -3
  368. package/lib/mjs/components/survey/Survey.form.js +5 -0
  369. package/lib/mjs/components/table/Table.d.ts +2 -1
  370. package/lib/mjs/components/table/Table.form.d.ts +6 -3
  371. package/lib/mjs/components/table/Table.form.js +5 -0
  372. package/lib/mjs/components/tabs/Tabs.d.ts +4 -4
  373. package/lib/mjs/components/tabs/Tabs.form.d.ts +6 -3
  374. package/lib/mjs/components/tabs/Tabs.form.js +5 -0
  375. package/lib/mjs/components/tabs/Tabs.js +1 -2
  376. package/lib/mjs/components/tags/Tags.d.ts +0 -14
  377. package/lib/mjs/components/tags/Tags.form.d.ts +6 -3
  378. package/lib/mjs/components/tags/Tags.form.js +5 -0
  379. package/lib/mjs/components/textarea/TextArea.d.ts +4 -9
  380. package/lib/mjs/components/textarea/TextArea.form.d.ts +6 -3
  381. package/lib/mjs/components/textarea/TextArea.form.js +5 -0
  382. package/lib/mjs/components/textarea/TextArea.js +2 -2
  383. package/lib/mjs/components/textfield/TextField.d.ts +14 -30
  384. package/lib/mjs/components/textfield/TextField.form.d.ts +6 -3
  385. package/lib/mjs/components/textfield/TextField.form.js +5 -0
  386. package/lib/mjs/components/textfield/TextField.js +13 -16
  387. package/lib/mjs/components/time/Time.form.d.ts +6 -3
  388. package/lib/mjs/components/time/Time.form.js +5 -0
  389. package/lib/mjs/components/unknown/Unknown.form.d.ts +5 -34
  390. package/lib/mjs/components/unknown/Unknown.form.js +4 -0
  391. package/lib/mjs/components/url/Url.form.d.ts +6 -3
  392. package/lib/mjs/components/url/Url.form.js +5 -0
  393. package/lib/mjs/components/well/Well.form.d.ts +6 -3
  394. package/lib/mjs/components/well/Well.form.js +5 -0
  395. package/lib/mjs/formio.embed.d.ts +1 -2
  396. package/lib/mjs/formio.embed.js +2 -99
  397. package/lib/mjs/formio.form.d.ts +11 -4
  398. package/lib/mjs/formio.form.js +10 -3
  399. package/lib/mjs/providers/Providers.d.ts +36 -5
  400. package/lib/mjs/providers/Providers.js +29 -0
  401. package/lib/mjs/providers/address/AddressProvider.d.ts +131 -12
  402. package/lib/mjs/providers/address/AddressProvider.js +88 -2
  403. package/lib/mjs/providers/address/AzureAddressProvider.d.ts +48 -1
  404. package/lib/mjs/providers/address/AzureAddressProvider.js +37 -0
  405. package/lib/mjs/providers/address/CustomAddressProvider.d.ts +27 -4
  406. package/lib/mjs/providers/address/CustomAddressProvider.js +34 -0
  407. package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +130 -6
  408. package/lib/mjs/providers/address/GoogleAddressProvider.js +72 -0
  409. package/lib/mjs/providers/address/NominatimAddressProvider.d.ts +32 -7
  410. package/lib/mjs/providers/address/NominatimAddressProvider.js +33 -0
  411. package/lib/mjs/providers/address/index.d.ts +3 -1
  412. package/lib/mjs/providers/processor/fileProcessor.d.ts +7 -1
  413. package/lib/mjs/providers/processor/fileProcessor.js +6 -0
  414. package/lib/mjs/providers/storage/azure.d.ts +6 -13
  415. package/lib/mjs/providers/storage/azure.js +5 -0
  416. package/lib/mjs/providers/storage/base64.d.ts +5 -6
  417. package/lib/mjs/providers/storage/base64.js +4 -0
  418. package/lib/mjs/providers/storage/dropbox.d.ts +6 -4
  419. package/lib/mjs/providers/storage/dropbox.js +5 -0
  420. package/lib/mjs/providers/storage/googleDrive.d.ts +7 -5
  421. package/lib/mjs/providers/storage/googleDrive.js +6 -0
  422. package/lib/mjs/providers/storage/indexeddb.d.ts +5 -7
  423. package/lib/mjs/providers/storage/indexeddb.js +4 -0
  424. package/lib/mjs/providers/storage/s3.d.ts +6 -20
  425. package/lib/mjs/providers/storage/s3.js +5 -0
  426. package/lib/mjs/providers/storage/url.d.ts +6 -7
  427. package/lib/mjs/providers/storage/url.js +10 -0
  428. package/lib/mjs/providers/storage/util.d.ts +24 -1
  429. package/lib/mjs/providers/storage/util.js +18 -0
  430. package/lib/mjs/templates/Templates.d.ts +1 -0
  431. package/lib/mjs/utils/Evaluator.d.ts +6 -3
  432. package/lib/mjs/utils/Evaluator.js +9 -20
  433. package/lib/mjs/utils/builder.d.ts +9 -7
  434. package/lib/mjs/utils/builder.js +10 -5
  435. package/lib/mjs/utils/calendarUtils.d.ts +7 -13
  436. package/lib/mjs/utils/calendarUtils.js +10 -17
  437. package/lib/mjs/utils/formUtils.d.ts +43 -171
  438. package/lib/mjs/utils/formUtils.js +6 -554
  439. package/lib/mjs/utils/utils.d.ts +362 -216
  440. package/lib/mjs/utils/utils.js +325 -218
  441. package/lib/mjs/widgets/CalendarWidget.d.ts +9 -10
  442. package/lib/mjs/widgets/CalendarWidget.js +9 -11
  443. package/package.json +22 -22
  444. package/sdk.d.ts +1 -0
  445. package/utils.d.ts +1 -0
@@ -7,7 +7,7 @@ import jtz from 'jstimezonedetect';
7
7
  import { lodashOperators } from './jsonlogic/operators';
8
8
  import dompurify from 'dompurify';
9
9
  import { getValue } from './formUtils';
10
- import Evaluator from './Evaluator';
10
+ import { Evaluator } from './Evaluator';
11
11
  import ConditionOperators from './conditionOperators';
12
12
  const interpolate = Evaluator.interpolate;
13
13
  const { fetch } = fetchPonyfill({
@@ -30,6 +30,10 @@ jsonLogic.add_operation('relativeMaxDate', (relativeMaxDate) => {
30
30
  });
31
31
  export { jsonLogic, ConditionOperators };
32
32
  export * as moment from 'moment-timezone/moment-timezone';
33
+ /**
34
+ * Sets the path to the component and parent schema.
35
+ * @param {import('@formio/core').Component} component - The component to set the path for.
36
+ */
33
37
  function setPathToComponentAndPerentSchema(component) {
34
38
  component.path = getComponentPath(component);
35
39
  const dataParent = getDataParentComponent(component);
@@ -39,77 +43,28 @@ function setPathToComponentAndPerentSchema(component) {
39
43
  }
40
44
  /**
41
45
  * Evaluate a method.
42
- *
43
- * @param func
44
- * @param args
45
- * @return {*}
46
- */
47
- export function evaluate(func, args, ret, tokenize) {
48
- let returnVal = null;
49
- const component = args.component ? args.component : { key: 'unknown' };
50
- if (!args.form && args.instance) {
51
- args.form = _.get(args.instance, 'root._form', {});
52
- }
53
- const componentKey = component.key;
54
- if (typeof func === 'string') {
55
- if (ret) {
56
- func += `;return ${ret}`;
57
- }
58
- if (tokenize) {
59
- // Replace all {{ }} references with actual data.
60
- func = func.replace(/({{\s+(.*)\s+}})/, (match, $1, $2) => {
61
- if ($2.indexOf('data.') === 0) {
62
- return _.get(args.data, $2.replace('data.', ''));
63
- }
64
- else if ($2.indexOf('row.') === 0) {
65
- return _.get(args.row, $2.replace('row.', ''));
66
- }
67
- // Support legacy...
68
- return _.get(args.data, $2);
69
- });
70
- }
71
- try {
72
- func = Evaluator.evaluator(func, args);
73
- args = _.values(args);
74
- }
75
- catch (err) {
76
- console.warn(`An error occured within the custom function for ${componentKey}`, err);
77
- returnVal = null;
78
- func = false;
79
- }
80
- }
81
- if (typeof func === 'function') {
82
- try {
83
- returnVal = Evaluator.evaluate(func, args);
84
- }
85
- catch (err) {
86
- returnVal = null;
87
- console.warn(`An error occured within custom function for ${componentKey}`, err);
88
- }
89
- }
90
- else if (typeof func === 'object') {
91
- try {
92
- returnVal = jsonLogic.apply(func, args);
93
- }
94
- catch (err) {
95
- returnVal = null;
96
- console.warn(`An error occured within custom function for ${componentKey}`, err);
97
- }
98
- }
99
- else if (func) {
100
- console.warn(`Unknown function type for ${componentKey}`);
101
- }
102
- return returnVal;
46
+ * @param {Function|string|object} func - The function to evaluate.
47
+ * @param {*} args - A map of arguments to pass to the function.
48
+ * @param {string} ret - The name of the "return" variable in the script.
49
+ * @param {boolean} interpolate - True if the script should be interpolated before being executed.
50
+ * @param {import('@formio/core').EvaluatorOptions} options - The evaluator options.
51
+ * @returns {*} - The result of the evaluation.
52
+ */
53
+ export function evaluate(func, args, ret, interpolate, options = {}) {
54
+ return Evaluator.evaluate(func, args, ret, interpolate, undefined, options);
103
55
  }
56
+ /**
57
+ * Returns a random compoennt ID.
58
+ * @returns {string} - A random component ID.
59
+ */
104
60
  export function getRandomComponentId() {
105
61
  return `e${Math.random().toString(36).substring(7)}`;
106
62
  }
107
63
  /**
108
64
  * Get a property value of an element.
109
- *
110
- * @param style
111
- * @param prop
112
- * @return {number}
65
+ * @param {CSSStyleDeclaration} style - The style element to get the property value from.
66
+ * @param {string} prop - The property to get the value for.
67
+ * @returns {number} - The value of the property.
113
68
  */
114
69
  export function getPropertyValue(style, prop) {
115
70
  let value = style.getPropertyValue(prop);
@@ -118,9 +73,8 @@ export function getPropertyValue(style, prop) {
118
73
  }
119
74
  /**
120
75
  * Get an elements bounding rectagle.
121
- *
122
- * @param element
123
- * @return {{x: string, y: string, width: string, height: string}}
76
+ * @param {HTMLElement} element - A DOM element to get the bounding rectangle for.
77
+ * @returns {{x: number, y: number, width: number, height: number}} - The bounding rectangle.
124
78
  */
125
79
  export function getElementRect(element) {
126
80
  const style = window.getComputedStyle(element, null);
@@ -133,9 +87,8 @@ export function getElementRect(element) {
133
87
  }
134
88
  /**
135
89
  * Determines the boolean value of a setting.
136
- *
137
- * @param value
138
- * @return {boolean}
90
+ * @param {string|boolean} value - A string or boolean value to convert to boolean.
91
+ * @returns {boolean} - The boolean value of the setting.
139
92
  */
140
93
  export function boolValue(value) {
141
94
  if (_.isBoolean(value)) {
@@ -150,21 +103,17 @@ export function boolValue(value) {
150
103
  }
151
104
  /**
152
105
  * Check to see if an ID is a mongoID.
153
- * @param text
154
- * @return {Array|{index: number, input: string}|Boolean|*}
106
+ * @param {string} text - The text to check if it is a mongoID.
107
+ * @returns {boolean} - TRUE if the text is a mongoID; FALSE otherwise.
155
108
  */
156
109
  export function isMongoId(text) {
157
- return text.toString().match(/^[0-9a-fA-F]{24}$/);
110
+ return !!text.toString().match(/^[0-9a-fA-F]{24}$/);
158
111
  }
159
112
  /**
160
113
  * Checks the calculated value for a provided component and data.
161
- *
162
- * @param {Object} component
163
- * The component to check for the calculated value.
164
- * @param {Object} submission
165
- * A submission object.
166
- * @param data
167
- * The full submission data.
114
+ * @param {import('@formio/core').Component} component - The component to check for the calculated value.
115
+ * @param {import('@formio/core').Submission} submission - A submission object.
116
+ * @param {*} rowData - The contextual row data for the component.
168
117
  */
169
118
  export function checkCalculated(component, submission, rowData) {
170
119
  // Process calculated value stuff if present.
@@ -180,13 +129,12 @@ export function checkCalculated(component, submission, rowData) {
180
129
  }
181
130
  /**
182
131
  * Check if a simple conditional evaluates to true.
183
- *
184
- * @param condition
185
- * @param condition
186
- * @param row
187
- * @param data
188
- * @param instance
189
- * @returns {boolean}
132
+ * @param {import('@formio/core').Component} component - The component to check for the conditional.
133
+ * @param {import('@formio/core').SimpleConditional} condition - The condition to check.
134
+ * @param {*} row - The row data for the component.
135
+ * @param {*} data - The full submission data.
136
+ * @param {import('../../src/components/_classes/component/Component').Component} instance - The instance of the component.
137
+ * @returns {boolean} - TRUE if the condition is true; FALSE otherwise.
190
138
  */
191
139
  export function checkSimpleConditional(component, condition, row, data, instance) {
192
140
  if (condition.when) {
@@ -230,6 +178,13 @@ export function checkSimpleConditional(component, condition, row, data, instance
230
178
  return show ? result : !result;
231
179
  }
232
180
  }
181
+ /**
182
+ * Returns a components normalized value.
183
+ * @param {string} compPath - The full path to the component.
184
+ * @param {*} data - The data object to get the value from.
185
+ * @param {*} row - The contextual row data for the component.
186
+ * @returns {*} - The normalized value of the component.
187
+ */
233
188
  export function getComponentActualValue(compPath, data, row) {
234
189
  let value = null;
235
190
  if (row) {
@@ -246,12 +201,15 @@ export function getComponentActualValue(compPath, data, row) {
246
201
  }
247
202
  /**
248
203
  * Check custom javascript conditional.
249
- *
250
- * @param component
251
- * @param custom
252
- * @param row
253
- * @param data
254
- * @returns {*}
204
+ * @param {import('@formio/core').Component} component - The component to check for the conditional.
205
+ * @param {string} custom - The custom conditional string to evaluate.
206
+ * @param {*} row - The row data for the component.
207
+ * @param {*} data - The full submission data.
208
+ * @param {import('@formio/core').Form} form - The form object.
209
+ * @param {string} variable - The variable name for the result of the custom conditional.
210
+ * @param {*} onError - A custom return if there is an error or the value is null from the evaluation.
211
+ * @param {import('../../src/components/_classes/component/Component').Component} instance - The component instance.
212
+ * @returns {*} - The result of the evaulation.
255
213
  */
256
214
  export function checkCustomConditional(component, custom, row, data, form, variable, onError, instance) {
257
215
  if (typeof custom === 'string') {
@@ -265,6 +223,16 @@ export function checkCustomConditional(component, custom, row, data, form, varia
265
223
  }
266
224
  return value;
267
225
  }
226
+ /**
227
+ * Check a component for JSON conditionals.
228
+ * @param {import('@formio/core').Component} component - The component
229
+ * @param {import('@formio/core').JSONConditional} json - The json conditional to check.
230
+ * @param {*} row - The contextual row data for the component.
231
+ * @param {*} data - The full submission data.
232
+ * @param {import('@formio/core').Form} form - The Form JSON of the form.
233
+ * @param {*} onError - Custom return value if there is an error.
234
+ * @returns {boolean} - TRUE if the condition is true; FALSE otherwise.
235
+ */
268
236
  export function checkJsonConditional(component, json, row, data, form, onError) {
269
237
  try {
270
238
  return jsonLogic.apply(json, {
@@ -279,6 +247,14 @@ export function checkJsonConditional(component, json, row, data, form, onError)
279
247
  return onError;
280
248
  }
281
249
  }
250
+ /**
251
+ * Returns the contextual row data for a component.
252
+ * @param {import('@formio/core').Component} component - The component to get the row data for.
253
+ * @param {*} row - The row data for the component.
254
+ * @param {import('../../src/components/_classes/component/Component').Component} instance - The component instance.
255
+ * @param {*} conditional - The component conditional.
256
+ * @returns {*} - The contextual row data for the component.
257
+ */
282
258
  function getRow(component, row, instance, conditional) {
283
259
  const condition = conditional || component.conditional;
284
260
  // If no component's instance passed (happens only in 6.x server), calculate its path based on the schema
@@ -300,15 +276,12 @@ function getRow(component, row, instance, conditional) {
300
276
  }
301
277
  /**
302
278
  * Checks the conditions for a provided component and data.
303
- *
304
- * @param component
305
- * The component to check for the condition.
306
- * @param row
307
- * The data within a row
308
- * @param data
309
- * The full submission data.
310
- *
311
- * @returns {boolean}
279
+ * @param {import('@formio/core').Component} component - The component to check for the condition.
280
+ * @param {*} row - The data within a row
281
+ * @param {*} data - The full submission data.
282
+ * @param {import('@formio/core').Form} form - The form object.
283
+ * @param {import('../../src/components/_classes/component/Component').Component} instance - The component instance.
284
+ * @returns {boolean} - TRUE if the condition is true; FALSE otherwise.
312
285
  */
313
286
  export function checkCondition(component, row, data, form, instance) {
314
287
  const { customConditional, conditional } = component;
@@ -327,12 +300,13 @@ export function checkCondition(component, row, data, form, instance) {
327
300
  }
328
301
  /**
329
302
  * Test a trigger on a component.
330
- *
331
- * @param component
332
- * @param action
333
- * @param data
334
- * @param row
335
- * @returns {mixed}
303
+ * @param {import('@formio/core').Component} component - The component to test the trigger against.
304
+ * @param {import('@formio/core').LogicTrigger} trigger - The trigger configuration.
305
+ * @param {import('@formio/core').DataObject} row - The contextual row data.
306
+ * @param {import('@formio/core').DataObject} data - The root data object.
307
+ * @param {import('@formio/core').Form} form - The form object.
308
+ * @param {any} instance - The component that is performing the trigger.
309
+ * @returns {boolean} - TRUE if the trigger should fire; FALSE otherwise.
336
310
  */
337
311
  export function checkTrigger(component, trigger, row, data, form, instance) {
338
312
  // If trigger is empty, don't fire it
@@ -351,6 +325,16 @@ export function checkTrigger(component, trigger, row, data, form, instance) {
351
325
  // If none of the types matched, don't fire the trigger.
352
326
  return false;
353
327
  }
328
+ /**
329
+ * Sets a property on a component via an executed Logic action.
330
+ * @param {import('@formio/core').Component} component - The component to set the property on.
331
+ * @param {import('@formio/core').LogicAction} action - The action to perform on the component.
332
+ * @param {string} result - The name of the variable in the evaulation to use as the result.
333
+ * @param {import('@formio/core').DataObject} row - The contextual row data.
334
+ * @param {import('@formio/core').DataObject} data - The full submission data.
335
+ * @param {any} instance - The component instance.
336
+ * @returns {import('@formio/core').Component} - The modified component.
337
+ */
354
338
  export function setActionProperty(component, action, result, row, data, instance) {
355
339
  const property = action.property.value;
356
340
  switch (action.property.type) {
@@ -384,8 +368,8 @@ export function setActionProperty(component, action, result, row, data, instance
384
368
  }
385
369
  /**
386
370
  * Unescape HTML characters like &lt, &gt, &amp and etc.
387
- * @param str
388
- * @returns {string}
371
+ * @param {string} str - The string to unescape.
372
+ * @returns {string} - The unescaped string.
389
373
  */
390
374
  export function unescapeHTML(str) {
391
375
  if (typeof window === 'undefined' || !('DOMParser' in window)) {
@@ -396,9 +380,9 @@ export function unescapeHTML(str) {
396
380
  }
397
381
  /**
398
382
  * Make HTML element from string
399
- * @param str
400
- * @param selector
401
- * @returns {HTMLElement}
383
+ * @param {string} str - The string to convert to an HTML element.
384
+ * @param {string} selector - The selector to use to get the element once it is created.
385
+ * @returns {HTMLElement} - The HTML element that was created.
402
386
  */
403
387
  export function convertStringToHTMLElement(str, selector) {
404
388
  const doc = new window.DOMParser().parseFromString(str, 'text/html');
@@ -406,10 +390,10 @@ export function convertStringToHTMLElement(str, selector) {
406
390
  }
407
391
  /**
408
392
  * Make a filename guaranteed to be unique.
409
- * @param name
410
- * @param template
411
- * @param evalContext
412
- * @returns {string}
393
+ * @param {string} name - The original name of the file.
394
+ * @param {string} template - The template to use for the unique name.
395
+ * @param {object} evalContext - The context to use for the evaluation.
396
+ * @returns {string} - A unique filename.
413
397
  */
414
398
  export function uniqueName(name, template, evalContext) {
415
399
  template = template || '{{fileName}}-{{guid}}';
@@ -432,6 +416,10 @@ export function uniqueName(name, template, evalContext) {
432
416
  const uniqueName = `${Evaluator.interpolate(template, evalContext)}${extension}`.replace(/[^0-9a-zA-Z.\-_ ]/g, '-');
433
417
  return uniqueName;
434
418
  }
419
+ /**
420
+ * Returns a GUID
421
+ * @returns {string} - A GUID.
422
+ */
435
423
  export function guid() {
436
424
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
437
425
  const r = Math.random() * 16 | 0;
@@ -443,9 +431,8 @@ export function guid() {
443
431
  }
444
432
  /**
445
433
  * Return a translated date setting.
446
- *
447
- * @param date
448
- * @return {(null|Date)}
434
+ * @param {string|Date} date - The date to translate.
435
+ * @returns {(null|Date)} - The translated date.
449
436
  */
450
437
  export function getDateSetting(date) {
451
438
  if (_.isNil(date) || _.isNaN(date) || date === '') {
@@ -486,13 +473,17 @@ export function getDateSetting(date) {
486
473
  }
487
474
  return dateSetting.toDate();
488
475
  }
476
+ /**
477
+ * Returns true if the date is a valid date. False otherwise.
478
+ * @param {Date|string} date - The date to check for validity.
479
+ * @returns {boolean} - TRUE if the date is valid; FALSE otherwise.
480
+ */
489
481
  export function isValidDate(date) {
490
482
  return _.isDate(date) && !_.isNaN(date.getDate());
491
483
  }
492
484
  /**
493
485
  * Get the current timezone string.
494
- *
495
- * @return {string}
486
+ * @returns {string} - The current timezone.
496
487
  */
497
488
  export function currentTimezone() {
498
489
  if (moment.currentTimezone) {
@@ -503,10 +494,9 @@ export function currentTimezone() {
503
494
  }
504
495
  /**
505
496
  * Get an offset date provided a date object and timezone object.
506
- *
507
- * @param date
508
- * @param timezone
509
- * @return {Date}
497
+ * @param {Date} date - The date to offset.
498
+ * @param {string} timezone - The timezone to offset the date to.
499
+ * @returns {Date} - The offset date.
510
500
  */
511
501
  export function offsetDate(date, timezone) {
512
502
  if (timezone === 'UTC') {
@@ -523,17 +513,15 @@ export function offsetDate(date, timezone) {
523
513
  }
524
514
  /**
525
515
  * Returns if the zones are loaded.
526
- *
527
- * @return {boolean}
516
+ * @returns {boolean} - TRUE if the zones are loaded; FALSE otherwise.
528
517
  */
529
518
  export function zonesLoaded() {
530
519
  return moment.zonesLoaded;
531
520
  }
532
521
  /**
533
522
  * Returns if we should load the zones.
534
- *
535
- * @param timezone
536
- * @return {boolean}
523
+ * @param {string} timezone - The timezone to check if we should load the zones.
524
+ * @returns {boolean} - TRUE if we should load the zones; FALSE otherwise.
537
525
  */
538
526
  export function shouldLoadZones(timezone) {
539
527
  if (timezone === currentTimezone() || timezone === 'UTC') {
@@ -543,8 +531,9 @@ export function shouldLoadZones(timezone) {
543
531
  }
544
532
  /**
545
533
  * Externally load the timezone data.
546
- *
547
- * @return {Promise<any> | *}
534
+ * @param {string} url - The URL to load the timezone data from.
535
+ * @param {string} timezone - The timezone to load.
536
+ * @returns {Promise<any> | *} - Resolves when the zones for this timezone are loaded.
548
537
  */
549
538
  export function loadZones(url, timezone) {
550
539
  if (timezone && !shouldLoadZones(timezone)) {
@@ -568,11 +557,10 @@ export function loadZones(url, timezone) {
568
557
  }
569
558
  /**
570
559
  * Get the moment date object for translating dates with timezones.
571
- *
572
- * @param value
573
- * @param format
574
- * @param timezone
575
- * @return {*}
560
+ * @param {string|Date} value - The value to convert into a moment date.
561
+ * @param {string} format - The format to convert the date to.
562
+ * @param {string} timezone - The timezone to convert the date to.
563
+ * @returns {Date} - The moment date object.
576
564
  */
577
565
  export function momentDate(value, format, timezone) {
578
566
  const momentDate = moment(value);
@@ -589,11 +577,12 @@ export function momentDate(value, format, timezone) {
589
577
  }
590
578
  /**
591
579
  * Format a date provided a value, format, and timezone object.
592
- *
593
- * @param value
594
- * @param format
595
- * @param timezone
596
- * @return {string}
580
+ * @param {string} timezonesUrl - The URL to load the timezone data from.
581
+ * @param {string|Date} value - The value to format.
582
+ * @param {string} format - The format to format the date to.
583
+ * @param {string} timezone - The timezone to format the date to.
584
+ * @param {string} flatPickrInputFormat - The format to use for flatpickr input.
585
+ * @returns {string} - The formatted date.
597
586
  */
598
587
  export function formatDate(timezonesUrl, value, format, timezone, flatPickrInputFormat) {
599
588
  const momentDate = moment(value, flatPickrInputFormat || undefined);
@@ -626,12 +615,12 @@ export function formatDate(timezonesUrl, value, format, timezone, flatPickrInput
626
615
  }
627
616
  /**
628
617
  * Pass a format function to format within a timezone.
629
- *
630
- * @param formatFn
631
- * @param date
632
- * @param format
633
- * @param timezone
634
- * @return {string}
618
+ * @param {string} timezonesUrl - The URL to load the timezone data from.
619
+ * @param {Function} formatFn - The format function to use.
620
+ * @param {Date|string} date - The date to format.
621
+ * @param {string} format - The format to format the date to.
622
+ * @param {string} timezone - The timezone to format the date to.
623
+ * @returns {string} - The formatted date.
635
624
  */
636
625
  export function formatOffset(timezonesUrl, formatFn, date, format, timezone) {
637
626
  if (timezone === currentTimezone()) {
@@ -650,6 +639,11 @@ export function formatOffset(timezonesUrl, formatFn, date, format, timezone) {
650
639
  return formatFn(date, format);
651
640
  }
652
641
  }
642
+ /**
643
+ * Returns the local date format information.
644
+ * @param {Intl.LocalesArgument} locale - The locale to get the date format for.
645
+ * @returns {object} - The local date format information.
646
+ */
653
647
  export function getLocaleDateFormatInfo(locale) {
654
648
  const formatInfo = {};
655
649
  const day = 21;
@@ -660,8 +654,8 @@ export function getLocaleDateFormatInfo(locale) {
660
654
  }
661
655
  /**
662
656
  * Convert the format from the angular-datepicker module to flatpickr format.
663
- * @param format
664
- * @return {string}
657
+ * @param {string} format - The format to convert.
658
+ * @returns {string} - The converted format.
665
659
  */
666
660
  export function convertFormatToFlatpickr(format) {
667
661
  return format
@@ -691,8 +685,8 @@ export function convertFormatToFlatpickr(format) {
691
685
  }
692
686
  /**
693
687
  * Convert the format from the angular-datepicker module to moment format.
694
- * @param format
695
- * @return {string}
688
+ * @param {string} format - The format to convert.
689
+ * @returns {string} - The converted format.
696
690
  */
697
691
  export function convertFormatToMoment(format) {
698
692
  return format
@@ -707,6 +701,11 @@ export function convertFormatToMoment(format) {
707
701
  // Unix Timestamp
708
702
  .replace(/U/g, 'X');
709
703
  }
704
+ /**
705
+ * Convert the format from the angular-datepicker module to mask format.
706
+ * @param {string} format - The format to convert.
707
+ * @returns {string} - The converted format.
708
+ */
710
709
  export function convertFormatToMask(format) {
711
710
  return format
712
711
  // Long month replacement.
@@ -764,6 +763,13 @@ export function getInputMask(mask, placeholderChar) {
764
763
  }
765
764
  return maskArray;
766
765
  }
766
+ /**
767
+ * Unmasks a value using the provided mask and placeholder characters.
768
+ * @param {string} value - The value to unmask.
769
+ * @param {string} mask - The mask to use for unmasking.
770
+ * @param {string} placeholderChar - The placeholder character to use for unmasking.
771
+ * @returns {string} - The unmasked value.
772
+ */
767
773
  export function unmaskValue(value, mask, placeholderChar) {
768
774
  if (!mask || !value || value.length > mask.length) {
769
775
  return value;
@@ -779,6 +785,12 @@ export function unmaskValue(value, mask, placeholderChar) {
779
785
  unmaskedValue = unmaskedValue.join('').replace(placeholderChar, '');
780
786
  return unmaskedValue;
781
787
  }
788
+ /**
789
+ * Returns true if the value matches the input mask format.
790
+ * @param {string} value - The value to check.
791
+ * @param {string} inputMask - The input mask to check against.
792
+ * @returns {boolean} - TRUE if the value matches the input mask; FALSE otherwise.
793
+ */
782
794
  export function matchInputMask(value, inputMask) {
783
795
  if (!inputMask) {
784
796
  return true;
@@ -796,6 +808,11 @@ export function matchInputMask(value, inputMask) {
796
808
  }
797
809
  return true;
798
810
  }
811
+ /**
812
+ * Returns the number separators (i.e. 1,000) for the provided language.
813
+ * @param {string} lang - The language code to get the number separators for.
814
+ * @returns {{delimiter: string, decimalSeparator: string}} - The number separators.
815
+ */
799
816
  export function getNumberSeparators(lang = 'en') {
800
817
  const formattedNumberString = (12345.6789).toLocaleString(lang);
801
818
  const delimeters = formattedNumberString.match(/..(.)...(.)../);
@@ -810,6 +827,12 @@ export function getNumberSeparators(lang = 'en') {
810
827
  decimalSeparator: (delimeters.length > 2) ? delimeters[2] : '.',
811
828
  };
812
829
  }
830
+ /**
831
+ * Returns the number for the maximum amount of decimal places for a number.
832
+ * @param {import('@formio/core').Component} component - The component to check for decimal limits.
833
+ * @param {number} defaultLimit - The default limit to use if none is provided in the component.
834
+ * @returns {number} - The number of decimal places allowed.
835
+ */
813
836
  export function getNumberDecimalLimit(component, defaultLimit) {
814
837
  if (_.has(component, 'decimalLimit')) {
815
838
  return _.get(component, 'decimalLimit');
@@ -825,6 +848,15 @@ export function getNumberDecimalLimit(component, defaultLimit) {
825
848
  }
826
849
  return decimalLimit;
827
850
  }
851
+ /**
852
+ * Returns the currency affixes for a specific language.
853
+ * @param {object} arg0 - The arguments object.
854
+ * @param {string} arg0.currency - The currency code to get the affixes for.
855
+ * @param {number} arg0.decimalLimit - The number of decimal places to use.
856
+ * @param {string} arg0.decimalSeparator - The decimal separator to use.
857
+ * @param {string} arg0.lang - The language code to use.
858
+ * @returns {{prefix: string, suffix: string}} - The currency affixes.
859
+ */
828
860
  export function getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, lang, }) {
829
861
  // Get the prefix and suffix from the localized string.
830
862
  let regex = `(.*)?${(100).toLocaleString(lang)}`;
@@ -846,10 +878,9 @@ export function getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, l
846
878
  }
847
879
  /**
848
880
  * Fetch the field data provided a component.
849
- *
850
- * @param data
851
- * @param component
852
- * @return {*}
881
+ * @param {import('@formio/core').DataObject} data - The data object to fetch the field data from.
882
+ * @param {import('@formio/core').Component} component - The component to fetch the field data for.
883
+ * @returns {*} - The field data.
853
884
  */
854
885
  export function fieldData(data, component) {
855
886
  if (!data) {
@@ -895,16 +926,23 @@ export function fieldData(data, component) {
895
926
  }
896
927
  /**
897
928
  * Delays function execution with possibility to execute function synchronously or cancel it.
898
- *
899
- * @param fn Function to delay
900
- * @param delay Delay time
901
- * @return {*}
929
+ * @param {Function} fn - Function to delay
930
+ * @param {number} delay - Delay time
931
+ * @param {...any} args - Arguments to pass to the function
932
+ * @returns {*} - Function to cancel the delay
902
933
  */
903
934
  export function delay(fn, delay = 0, ...args) {
904
935
  const timer = setTimeout(fn, delay, ...args);
936
+ /**
937
+ *
938
+ */
905
939
  function cancel() {
906
940
  clearTimeout(timer);
907
941
  }
942
+ /**
943
+ * Execute the function early.
944
+ * @returns {*} - The result of the function.
945
+ */
908
946
  function earlyCall() {
909
947
  cancel();
910
948
  return fn(...args);
@@ -915,11 +953,9 @@ export function delay(fn, delay = 0, ...args) {
915
953
  }
916
954
  /**
917
955
  * Iterate the given key to make it unique.
918
- *
919
- * @param {String} key
956
+ * @param {string} key
920
957
  * Modify the component key to be unique.
921
- *
922
- * @returns {String}
958
+ * @returns {string}
923
959
  * The new component key.
924
960
  */
925
961
  export function iterateKey(key) {
@@ -932,10 +968,9 @@ export function iterateKey(key) {
932
968
  }
933
969
  /**
934
970
  * Determines a unique key within a map provided the base key.
935
- *
936
- * @param map
937
- * @param base
938
- * @return {*}
971
+ * @param {Record<string, string>} map - The map to check for uniqueness.
972
+ * @param {string} base - The base path of the key.
973
+ * @returns {string} - The unique key.
939
974
  */
940
975
  export function uniqueKey(map, base) {
941
976
  let newKey = base;
@@ -946,8 +981,9 @@ export function uniqueKey(map, base) {
946
981
  }
947
982
  /**
948
983
  * Determines the major version number of bootstrap.
949
- *
950
- * @return {number}
984
+ * @param {object} options - The options to check for bootstrap version.
985
+ * @param {string} options.bootstrap - The bootstrap version to use.
986
+ * @returns {number} - The bootstrap version.
951
987
  */
952
988
  export function bootstrapVersion(options) {
953
989
  if (options.bootstrap) {
@@ -964,9 +1000,8 @@ export function bootstrapVersion(options) {
964
1000
  /**
965
1001
  * Retrun provided argument.
966
1002
  * If argument is a function, returns the result of a function call.
967
- * @param {*} e;
968
- *
969
- * @return {*}
1003
+ * @param {Function|any} e - The argument to check if a function and call if so.
1004
+ * @returns {any} - Either the result of the function call (e) or e if it is not a function.
970
1005
  */
971
1006
  export function unfold(e) {
972
1007
  if (typeof e === 'function') {
@@ -976,27 +1011,32 @@ export function unfold(e) {
976
1011
  }
977
1012
  /**
978
1013
  * Map values through unfold and return first non-nil value.
979
- * @param {Array<T>} collection;
980
- *
981
- * @return {T}
1014
+ * @param {Array<T>} collection - The collection to map through unfold.;
1015
+ * @returns {T} - The first non-nil value.
982
1016
  */
983
1017
  export const firstNonNil = _.flow([
984
1018
  _.partialRight(_.map, unfold),
985
1019
  _.partialRight(_.find, v => !_.isUndefined(v))
986
1020
  ]);
987
- /*
988
- * Create enclosed state.
989
- * Returns functions to getting and cycling between states.
1021
+ /**
1022
+ * Create enclosed state. Returns functions to getting and cycling between states.
990
1023
  * @param {*} a - initial state.
991
1024
  * @param {*} b - next state.
992
- * @return {Functions[]} -- [get, toggle];
1025
+ * @returns {Functions[]} -- [get, toggle];
993
1026
  */
994
1027
  export function withSwitch(a, b) {
995
1028
  let state = a;
996
1029
  let next = b;
1030
+ /**
1031
+ * Returns the state of the switch.
1032
+ * @returns {*} - The current state.
1033
+ */
997
1034
  function get() {
998
1035
  return state;
999
1036
  }
1037
+ /**
1038
+ * Toggles the state of the switch.
1039
+ */
1000
1040
  function toggle() {
1001
1041
  const prev = state;
1002
1042
  state = next;
@@ -1004,6 +1044,14 @@ export function withSwitch(a, b) {
1004
1044
  }
1005
1045
  return [get, toggle];
1006
1046
  }
1047
+ /**
1048
+ * Create a function that will call the provided function only the provided limit.
1049
+ * @param {Function} callback - The callback to call.
1050
+ * @param {object} options - The options to use.
1051
+ * @param {number} options.limit - The limit to call the callback.
1052
+ * @param {number} options.delay - The delay to wait before resetting the call count.
1053
+ * @returns {Function} - The function that will call the callback only the provided limit.
1054
+ */
1007
1055
  export function observeOverload(callback, options = {}) {
1008
1056
  const { limit = 50, delay = 500 } = options;
1009
1057
  let callCount = 0;
@@ -1023,6 +1071,13 @@ export function observeOverload(callback, options = {}) {
1023
1071
  }
1024
1072
  };
1025
1073
  }
1074
+ /**
1075
+ * Returns the components that are provided within an evaluation context.
1076
+ * @param {any} context - The evaluation context to get the components from.
1077
+ * @param {boolean} excludeNested - Exclude nested components.
1078
+ * @param {Array<string>} excludedTypes - The types of components to exclude.
1079
+ * @returns {Array} - The components within the evaluation context.
1080
+ */
1026
1081
  export function getContextComponents(context, excludeNested, excludedTypes = []) {
1027
1082
  const values = [];
1028
1083
  context.utils.eachComponent(context.instance.options.editForm.components, (component, path) => {
@@ -1036,6 +1091,11 @@ export function getContextComponents(context, excludeNested, excludedTypes = [])
1036
1091
  });
1037
1092
  return values;
1038
1093
  }
1094
+ /**
1095
+ * Returns the button components that are within an evaluation context.
1096
+ * @param {any} context - The evaluation context to get the components from.
1097
+ * @returns {Array} - The button components within the evaluation context.
1098
+ */
1039
1099
  export function getContextButtons(context) {
1040
1100
  const values = [];
1041
1101
  context.utils.eachComponent(context.instance.options.editForm.components, (component) => {
@@ -1052,12 +1112,9 @@ export function getContextButtons(context) {
1052
1112
  const inTextTags = ['#text', 'A', 'B', 'EM', 'I', 'SMALL', 'STRONG', 'SUB', 'SUP', 'INS', 'DEL', 'MARK', 'CODE'];
1053
1113
  /**
1054
1114
  * Helper function for 'translateHTMLTemplate'. Translates text value of the passed html element.
1055
- *
1056
- * @param {HTMLElement} elem
1057
- * @param {Function} translate
1058
- *
1059
- * @returns {String}
1060
- * Translated element template.
1115
+ * @param {HTMLElement} elem - The element to translate.
1116
+ * @param {Function} translate - The translation function.
1117
+ * @returns {string} - Translated element template.
1061
1118
  */
1062
1119
  function translateElemValue(elem, translate) {
1063
1120
  if (!elem.innerText) {
@@ -1088,10 +1145,8 @@ function translateElemValue(elem, translate) {
1088
1145
  }
1089
1146
  /**
1090
1147
  * Helper function for 'translateHTMLTemplate'. Goes deep through html tag children and calls function to translate their text values.
1091
- *
1092
- * @param {HTMLElement} tag
1093
- * @param {Function} translate
1094
- *
1148
+ * @param {HTMLElement} tag - The tag to translate.
1149
+ * @param {Function} translate - The translation function.
1095
1150
  * @returns {void}
1096
1151
  */
1097
1152
  function translateDeepTag(tag, translate) {
@@ -1107,12 +1162,9 @@ function translateDeepTag(tag, translate) {
1107
1162
  }
1108
1163
  /**
1109
1164
  * Translates text values in html template.
1110
- *
1111
- * @param {String} template
1112
- * @param {Function} translate
1113
- *
1114
- * @returns {String}
1115
- * Html template with translated values.
1165
+ * @param {string} template - The template to translate.
1166
+ * @param {Function} translate - The translation function.
1167
+ * @returns {string} - Html template with translated values.
1116
1168
  */
1117
1169
  export function translateHTMLTemplate(template, translate) {
1118
1170
  const isHTML = /<[^>]*>/.test(template);
@@ -1129,9 +1181,9 @@ export function translateHTMLTemplate(template, translate) {
1129
1181
  }
1130
1182
  /**
1131
1183
  * Sanitize an html string.
1132
- *
1133
- * @param string
1134
- * @returns {*}
1184
+ * @param {string} string - The string to sanitize.
1185
+ * @param {any} options - The options to use for sanitization.
1186
+ * @returns {string} - The sanitized html string.
1135
1187
  */
1136
1188
  export function sanitize(string, options) {
1137
1189
  if (typeof dompurify.sanitize !== 'function') {
@@ -1179,11 +1231,18 @@ export function sanitize(string, options) {
1179
1231
  }
1180
1232
  /**
1181
1233
  * Fast cloneDeep for JSON objects only.
1234
+ * @param {any} obj - The object to perform a fast clone deep against.
1235
+ * @returns {any} - The cloned object.
1182
1236
  */
1183
1237
  export function fastCloneDeep(obj) {
1184
1238
  return obj ? JSON.parse(JSON.stringify(obj)) : obj;
1185
1239
  }
1186
1240
  export { Evaluator, interpolate };
1241
+ /**
1242
+ * Returns if the component is an input component.
1243
+ * @param {import('@formio/core').Component} componentJson - The JSON of a component.
1244
+ * @returns {bool} - TRUE if the component is an input component; FALSE otherwise.
1245
+ */
1187
1246
  export function isInputComponent(componentJson) {
1188
1247
  if (componentJson.input === false || componentJson.input === true) {
1189
1248
  return componentJson.input;
@@ -1203,6 +1262,11 @@ export function isInputComponent(componentJson) {
1203
1262
  return true;
1204
1263
  }
1205
1264
  }
1265
+ /**
1266
+ * Takes a component path, and returns a component path array.
1267
+ * @param {string} pathStr - The path string to convert to an array.
1268
+ * @returns {Arryay<number>} - The array of paths.
1269
+ */
1206
1270
  export function getArrayFromComponentPath(pathStr) {
1207
1271
  if (!pathStr || !_.isString(pathStr)) {
1208
1272
  if (!_.isArray(pathStr)) {
@@ -1216,6 +1280,12 @@ export function getArrayFromComponentPath(pathStr) {
1216
1280
  .split('.')
1217
1281
  .map(part => _.defaultTo(_.toNumber(part), part));
1218
1282
  }
1283
+ /**
1284
+ * Returns true if the component is a child of the parent.
1285
+ * @param {any} child - The child component to check.
1286
+ * @param {any} parent - The parent component to check.
1287
+ * @returns {boolean} - TRUE if the child is a child of the parent; FALSE otherwise.
1288
+ */
1219
1289
  export function isChildOf(child, parent) {
1220
1290
  while (child && child.parent) {
1221
1291
  if (child.parent === parent) {
@@ -1225,6 +1295,11 @@ export function isChildOf(child, parent) {
1225
1295
  }
1226
1296
  return false;
1227
1297
  }
1298
+ /**
1299
+ * Takes an array of component path indexes, and returns a string version of that array.
1300
+ * @param {Array<number>} path - The path array to convert to a string.
1301
+ * @returns {string} - The string version of the path.
1302
+ */
1228
1303
  export function getStringFromComponentPath(path) {
1229
1304
  if (!_.isArray(path)) {
1230
1305
  return path;
@@ -1240,16 +1315,21 @@ export function getStringFromComponentPath(path) {
1240
1315
  });
1241
1316
  return strPath;
1242
1317
  }
1318
+ /**
1319
+ * Takes a number and rounds it to the provided precision amount.
1320
+ * @param {number} number - The number to round.
1321
+ * @param {number} precision - The precision to round the number to.
1322
+ * @returns {string} - The rounded number.
1323
+ */
1243
1324
  export function round(number, precision) {
1244
1325
  if (_.isNumber(number)) {
1245
1326
  return number.toFixed(precision);
1246
1327
  }
1247
- return number;
1328
+ return number.toString();
1248
1329
  }
1249
1330
  /**
1250
1331
  * Check for Internet Explorer browser version
1251
- *
1252
- * @return {(number|null)}
1332
+ * @returns {(number|null)} - The IE browser version or null if not IE
1253
1333
  */
1254
1334
  export function getIEBrowserVersion() {
1255
1335
  const { ie, version } = getBrowserInfo();
@@ -1257,8 +1337,7 @@ export function getIEBrowserVersion() {
1257
1337
  }
1258
1338
  /**
1259
1339
  * Get browser name and version (modified from 'jquery-browser-plugin')
1260
- *
1261
- * @return {Object} -- {{browser name, version, isWebkit?}}
1340
+ * @returns {object} -- {{browser name, version, isWebkit?}}
1262
1341
  * Possible browser names: chrome, safari, ie, edge, opera, mozilla, yabrowser
1263
1342
  */
1264
1343
  export function getBrowserInfo() {
@@ -1306,12 +1385,19 @@ export function getBrowserInfo() {
1306
1385
  }
1307
1386
  return browser;
1308
1387
  }
1388
+ /**
1389
+ * Takes a component path, which may include array indicies (i.e. [0][1]), and returns the compoennt path without the indicies.
1390
+ * @param {string} path - The path to remove the indicies from.
1391
+ * @returns {string} - The path without the indicies.
1392
+ */
1309
1393
  export function getComponentPathWithoutIndicies(path = '') {
1310
1394
  return path.replace(/\[\d+\]/, '');
1311
1395
  }
1312
1396
  /**
1313
1397
  * Returns a path to the component which based on its schema
1314
- * @param {*} component is a component's schema containing link to its parent's schema in the 'parent' property
1398
+ * @param {import('@formio/core').Component} component - Component containing link to its parent's schema in the 'parent' property
1399
+ * @param {string} path - Path to the component
1400
+ * @returns {string} - Path to the component
1315
1401
  */
1316
1402
  export function getComponentPath(component, path = '') {
1317
1403
  if (!component || !component.key || component?._form?.display === 'wizard') { // unlike the Webform, the Wizard has the key and it is a duplicate of the panel key
@@ -1322,8 +1408,8 @@ export function getComponentPath(component, path = '') {
1322
1408
  }
1323
1409
  /**
1324
1410
  * Returns a parent component of the passed component instance skipping all the Layout components
1325
- * @param {*} componentInstance
1326
- * @return {(Component|undefined)}
1411
+ * @param {Component} componentInstance - The component to check for the parent.
1412
+ * @returns {Component|undefined} - The parent data component.
1327
1413
  */
1328
1414
  export function getDataParentComponent(componentInstance) {
1329
1415
  if (!componentInstance) {
@@ -1339,8 +1425,8 @@ export function getDataParentComponent(componentInstance) {
1339
1425
  }
1340
1426
  /**
1341
1427
  * Returns whether the value is a promise
1342
- * @param value
1343
- * @return {boolean}
1428
+ * @param {any} value - The value to check
1429
+ * @returns {boolean} - TRUE if the value is a promise; FALSE otherwise
1344
1430
  */
1345
1431
  export function isPromise(value) {
1346
1432
  return value
@@ -1351,9 +1437,9 @@ export function isPromise(value) {
1351
1437
  /**
1352
1438
  * Determines if the component has a scoping parent in tree (a component which scopes its children and manages its
1353
1439
  * changes by itself, e.g. EditGrid)
1354
- * @param componentInstance
1355
- * @param firstPass
1356
- * @returns {boolean|boolean|*}
1440
+ * @param {Component} componentInstance - The component to check for the scoping parent.
1441
+ * @param {boolean} firstPass - Whether it is the first pass of the function
1442
+ * @returns {boolean|*} - TRUE if the component has a scoping parent; FALSE otherwise
1357
1443
  */
1358
1444
  export function isInsideScopingComponent(componentInstance, firstPass = true) {
1359
1445
  if (!firstPass && componentInstance?.hasScopedChildren) {
@@ -1368,6 +1454,11 @@ export function isInsideScopingComponent(componentInstance, firstPass = true) {
1368
1454
  }
1369
1455
  return false;
1370
1456
  }
1457
+ /**
1458
+ * Returns all the focusable elements within the provided dom element.
1459
+ * @param {HTMLElement} element - The element to get the focusable elements from.
1460
+ * @returns {NodeList<HTMLElement>} - The focusable elements within the provided element.
1461
+ */
1371
1462
  export function getFocusableElements(element) {
1372
1463
  const focusableSelector = `button:not([disabled]), input:not([disabled]), select:not([disabled]),
1373
1464
  textarea:not([disabled]), button:not([disabled]), [href]`;
@@ -1384,6 +1475,11 @@ export const componentValueTypes = {
1384
1475
  date: 'date',
1385
1476
  any: 'any',
1386
1477
  };
1478
+ /**
1479
+ * Returns the saved types for the component
1480
+ * @param {import('@formio/core').Component} fullSchema - The component schema
1481
+ * @returns {Array<string>|null} - The saved types for the component
1482
+ */
1387
1483
  export function getComponentSavedTypes(fullSchema) {
1388
1484
  const schema = fullSchema || {};
1389
1485
  if (schema.persistent !== true) {
@@ -1396,9 +1492,10 @@ export function getComponentSavedTypes(fullSchema) {
1396
1492
  }
1397
1493
  /**
1398
1494
  * Interpolates @formio/core errors so that they are compatible with the renderer
1399
- * @param {FieldError[]} errors
1400
- * @param firstPass
1401
- * @returns {[]}
1495
+ * @param {Component} component - The component to interpolate the errors for
1496
+ * @param {FieldError[]} errors - The errors to interpolate
1497
+ * @param {Function} interpolateFn - The interpolation function
1498
+ * @returns {[]} - The interpolated errors
1402
1499
  */
1403
1500
  export const interpolateErrors = (component, errors, interpolateFn) => {
1404
1501
  return errors.map((error) => {
@@ -1408,6 +1505,11 @@ export const interpolateErrors = (component, errors, interpolateFn) => {
1408
1505
  return { ...error, message: unescapeHTML(interpolateFn(toInterpolate, context)), context: { ...context } };
1409
1506
  });
1410
1507
  };
1508
+ /**
1509
+ * Returns the template keys inside the template code.
1510
+ * @param {string} template - The template to get the keys from.
1511
+ * @returns {Array<string>} - The keys inside the template.
1512
+ */
1411
1513
  export function getItemTemplateKeys(template) {
1412
1514
  const templateKeys = [];
1413
1515
  if (!template) {
@@ -1424,6 +1526,11 @@ export function getItemTemplateKeys(template) {
1424
1526
  }
1425
1527
  return templateKeys;
1426
1528
  }
1529
+ /**
1530
+ * Returns if the component is a select resource with an object for its value.
1531
+ * @param {import('@formio/core').Component} comp - The component to check.
1532
+ * @returns {boolean} - TRUE if the component is a select resource with an object for its value; FALSE otherwise.
1533
+ */
1427
1534
  export function isSelectResourceWithObjectValue(comp = {}) {
1428
1535
  const { reference, dataSrc, valueProperty } = comp;
1429
1536
  return reference || (dataSrc === 'resource' && (!valueProperty || valueProperty === 'data'));