@formio/js 5.0.0-dev.5603.8554c0d → 5.0.0-dev.5610.11a9aca

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 +641 -1189
  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 +685 -913
  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 +1855 -487
  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 +85 -96
  20. package/lib/cjs/Element.js +65 -76
  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 +15 -11
  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 +7 -3
  220. package/lib/cjs/utils/Evaluator.js +12 -18
  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 +361 -216
  228. package/lib/cjs/utils/utils.js +329 -169
  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 +85 -96
  232. package/lib/mjs/Element.js +65 -76
  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 +15 -11
  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 +7 -3
  432. package/lib/mjs/utils/Evaluator.js +10 -18
  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 +361 -216
  440. package/lib/mjs/utils/utils.js +321 -161
  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,10 +43,11 @@ function setPathToComponentAndPerentSchema(component) {
39
43
  }
40
44
  /**
41
45
  * Evaluate a method.
42
- *
43
- * @param func
44
- * @param args
45
- * @return {*}
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} tokenize - True if the script should be interpolated before being executed.
50
+ * @returns {*} - The result of the evaluation.
46
51
  */
47
52
  export function evaluate(func, args, ret, tokenize) {
48
53
  let returnVal = null;
@@ -101,15 +106,18 @@ export function evaluate(func, args, ret, tokenize) {
101
106
  }
102
107
  return returnVal;
103
108
  }
109
+ /**
110
+ * Returns a random compoennt ID.
111
+ * @returns {string} - A random component ID.
112
+ */
104
113
  export function getRandomComponentId() {
105
114
  return `e${Math.random().toString(36).substring(7)}`;
106
115
  }
107
116
  /**
108
117
  * Get a property value of an element.
109
- *
110
- * @param style
111
- * @param prop
112
- * @return {number}
118
+ * @param {CSSStyleDeclaration} style - The style element to get the property value from.
119
+ * @param {string} prop - The property to get the value for.
120
+ * @returns {number} - The value of the property.
113
121
  */
114
122
  export function getPropertyValue(style, prop) {
115
123
  let value = style.getPropertyValue(prop);
@@ -118,9 +126,8 @@ export function getPropertyValue(style, prop) {
118
126
  }
119
127
  /**
120
128
  * Get an elements bounding rectagle.
121
- *
122
- * @param element
123
- * @return {{x: string, y: string, width: string, height: string}}
129
+ * @param {HTMLElement} element - A DOM element to get the bounding rectangle for.
130
+ * @returns {{x: number, y: number, width: number, height: number}} - The bounding rectangle.
124
131
  */
125
132
  export function getElementRect(element) {
126
133
  const style = window.getComputedStyle(element, null);
@@ -133,9 +140,8 @@ export function getElementRect(element) {
133
140
  }
134
141
  /**
135
142
  * Determines the boolean value of a setting.
136
- *
137
- * @param value
138
- * @return {boolean}
143
+ * @param {string|boolean} value - A string or boolean value to convert to boolean.
144
+ * @returns {boolean} - The boolean value of the setting.
139
145
  */
140
146
  export function boolValue(value) {
141
147
  if (_.isBoolean(value)) {
@@ -150,21 +156,17 @@ export function boolValue(value) {
150
156
  }
151
157
  /**
152
158
  * Check to see if an ID is a mongoID.
153
- * @param text
154
- * @return {Array|{index: number, input: string}|Boolean|*}
159
+ * @param {string} text - The text to check if it is a mongoID.
160
+ * @returns {boolean} - TRUE if the text is a mongoID; FALSE otherwise.
155
161
  */
156
162
  export function isMongoId(text) {
157
- return text.toString().match(/^[0-9a-fA-F]{24}$/);
163
+ return !!text.toString().match(/^[0-9a-fA-F]{24}$/);
158
164
  }
159
165
  /**
160
166
  * 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.
167
+ * @param {import('@formio/core').Component} component - The component to check for the calculated value.
168
+ * @param {import('@formio/core').Submission} submission - A submission object.
169
+ * @param {*} rowData - The contextual row data for the component.
168
170
  */
169
171
  export function checkCalculated(component, submission, rowData) {
170
172
  // Process calculated value stuff if present.
@@ -180,13 +182,12 @@ export function checkCalculated(component, submission, rowData) {
180
182
  }
181
183
  /**
182
184
  * 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}
185
+ * @param {import('@formio/core').Component} component - The component to check for the conditional.
186
+ * @param {import('@formio/core').SimpleConditional} condition - The condition to check.
187
+ * @param {*} row - The row data for the component.
188
+ * @param {*} data - The full submission data.
189
+ * @param {import('../../src/components/_classes/component/Component').Component} instance - The instance of the component.
190
+ * @returns {boolean} - TRUE if the condition is true; FALSE otherwise.
190
191
  */
191
192
  export function checkSimpleConditional(component, condition, row, data, instance) {
192
193
  if (condition.when) {
@@ -230,6 +231,13 @@ export function checkSimpleConditional(component, condition, row, data, instance
230
231
  return show ? result : !result;
231
232
  }
232
233
  }
234
+ /**
235
+ * Returns a components normalized value.
236
+ * @param {string} compPath - The full path to the component.
237
+ * @param {*} data - The data object to get the value from.
238
+ * @param {*} row - The contextual row data for the component.
239
+ * @returns {*} - The normalized value of the component.
240
+ */
233
241
  export function getComponentActualValue(compPath, data, row) {
234
242
  let value = null;
235
243
  if (row) {
@@ -246,12 +254,15 @@ export function getComponentActualValue(compPath, data, row) {
246
254
  }
247
255
  /**
248
256
  * Check custom javascript conditional.
249
- *
250
- * @param component
251
- * @param custom
252
- * @param row
253
- * @param data
254
- * @returns {*}
257
+ * @param {import('@formio/core').Component} component - The component to check for the conditional.
258
+ * @param {string} custom - The custom conditional string to evaluate.
259
+ * @param {*} row - The row data for the component.
260
+ * @param {*} data - The full submission data.
261
+ * @param {import('@formio/core').Form} form - The form object.
262
+ * @param {string} variable - The variable name for the result of the custom conditional.
263
+ * @param {*} onError - A custom return if there is an error or the value is null from the evaluation.
264
+ * @param {import('../../src/components/_classes/component/Component').Component} instance - The component instance.
265
+ * @returns {*} - The result of the evaulation.
255
266
  */
256
267
  export function checkCustomConditional(component, custom, row, data, form, variable, onError, instance) {
257
268
  if (typeof custom === 'string') {
@@ -265,6 +276,16 @@ export function checkCustomConditional(component, custom, row, data, form, varia
265
276
  }
266
277
  return value;
267
278
  }
279
+ /**
280
+ * Check a component for JSON conditionals.
281
+ * @param {import('@formio/core').Component} component - The component
282
+ * @param {import('@formio/core').JSONConditional} json - The json conditional to check.
283
+ * @param {*} row - The contextual row data for the component.
284
+ * @param {*} data - The full submission data.
285
+ * @param {import('@formio/core').Form} form - The Form JSON of the form.
286
+ * @param {*} onError - Custom return value if there is an error.
287
+ * @returns {boolean} - TRUE if the condition is true; FALSE otherwise.
288
+ */
268
289
  export function checkJsonConditional(component, json, row, data, form, onError) {
269
290
  try {
270
291
  return jsonLogic.apply(json, {
@@ -279,6 +300,14 @@ export function checkJsonConditional(component, json, row, data, form, onError)
279
300
  return onError;
280
301
  }
281
302
  }
303
+ /**
304
+ * Returns the contextual row data for a component.
305
+ * @param {import('@formio/core').Component} component - The component to get the row data for.
306
+ * @param {*} row - The row data for the component.
307
+ * @param {import('../../src/components/_classes/component/Component').Component} instance - The component instance.
308
+ * @param {*} conditional - The component conditional.
309
+ * @returns {*} - The contextual row data for the component.
310
+ */
282
311
  function getRow(component, row, instance, conditional) {
283
312
  const condition = conditional || component.conditional;
284
313
  // If no component's instance passed (happens only in 6.x server), calculate its path based on the schema
@@ -300,15 +329,12 @@ function getRow(component, row, instance, conditional) {
300
329
  }
301
330
  /**
302
331
  * 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}
332
+ * @param {import('@formio/core').Component} component - The component to check for the condition.
333
+ * @param {*} row - The data within a row
334
+ * @param {*} data - The full submission data.
335
+ * @param {import('@formio/core').Form} form - The form object.
336
+ * @param {import('../../src/components/_classes/component/Component').Component} instance - The component instance.
337
+ * @returns {boolean} - TRUE if the condition is true; FALSE otherwise.
312
338
  */
313
339
  export function checkCondition(component, row, data, form, instance) {
314
340
  const { customConditional, conditional } = component;
@@ -327,12 +353,13 @@ export function checkCondition(component, row, data, form, instance) {
327
353
  }
328
354
  /**
329
355
  * Test a trigger on a component.
330
- *
331
- * @param component
332
- * @param action
333
- * @param data
334
- * @param row
335
- * @returns {mixed}
356
+ * @param {import('@formio/core').Component} component - The component to test the trigger against.
357
+ * @param {import('@formio/core').LogicTrigger} trigger - The trigger configuration.
358
+ * @param {import('@formio/core').DataObject} row - The contextual row data.
359
+ * @param {import('@formio/core').DataObject} data - The root data object.
360
+ * @param {import('@formio/core').Form} form - The form object.
361
+ * @param {any} instance - The component that is performing the trigger.
362
+ * @returns {boolean} - TRUE if the trigger should fire; FALSE otherwise.
336
363
  */
337
364
  export function checkTrigger(component, trigger, row, data, form, instance) {
338
365
  // If trigger is empty, don't fire it
@@ -351,6 +378,16 @@ export function checkTrigger(component, trigger, row, data, form, instance) {
351
378
  // If none of the types matched, don't fire the trigger.
352
379
  return false;
353
380
  }
381
+ /**
382
+ * Sets a property on a component via an executed Logic action.
383
+ * @param {import('@formio/core').Component} component - The component to set the property on.
384
+ * @param {import('@formio/core').LogicAction} action - The action to perform on the component.
385
+ * @param {string} result - The name of the variable in the evaulation to use as the result.
386
+ * @param {import('@formio/core').DataObject} row - The contextual row data.
387
+ * @param {import('@formio/core').DataObject} data - The full submission data.
388
+ * @param {any} instance - The component instance.
389
+ * @returns {import('@formio/core').Component} - The modified component.
390
+ */
354
391
  export function setActionProperty(component, action, result, row, data, instance) {
355
392
  const property = action.property.value;
356
393
  switch (action.property.type) {
@@ -384,8 +421,8 @@ export function setActionProperty(component, action, result, row, data, instance
384
421
  }
385
422
  /**
386
423
  * Unescape HTML characters like &lt, &gt, &amp and etc.
387
- * @param str
388
- * @returns {string}
424
+ * @param {string} str - The string to unescape.
425
+ * @returns {string} - The unescaped string.
389
426
  */
390
427
  export function unescapeHTML(str) {
391
428
  if (typeof window === 'undefined' || !('DOMParser' in window)) {
@@ -396,9 +433,9 @@ export function unescapeHTML(str) {
396
433
  }
397
434
  /**
398
435
  * Make HTML element from string
399
- * @param str
400
- * @param selector
401
- * @returns {HTMLElement}
436
+ * @param {string} str - The string to convert to an HTML element.
437
+ * @param {string} selector - The selector to use to get the element once it is created.
438
+ * @returns {HTMLElement} - The HTML element that was created.
402
439
  */
403
440
  export function convertStringToHTMLElement(str, selector) {
404
441
  const doc = new window.DOMParser().parseFromString(str, 'text/html');
@@ -406,10 +443,10 @@ export function convertStringToHTMLElement(str, selector) {
406
443
  }
407
444
  /**
408
445
  * Make a filename guaranteed to be unique.
409
- * @param name
410
- * @param template
411
- * @param evalContext
412
- * @returns {string}
446
+ * @param {string} name - The original name of the file.
447
+ * @param {string} template - The template to use for the unique name.
448
+ * @param {object} evalContext - The context to use for the evaluation.
449
+ * @returns {string} - A unique filename.
413
450
  */
414
451
  export function uniqueName(name, template, evalContext) {
415
452
  template = template || '{{fileName}}-{{guid}}';
@@ -432,6 +469,10 @@ export function uniqueName(name, template, evalContext) {
432
469
  const uniqueName = `${Evaluator.interpolate(template, evalContext)}${extension}`.replace(/[^0-9a-zA-Z.\-_ ]/g, '-');
433
470
  return uniqueName;
434
471
  }
472
+ /**
473
+ * Returns a GUID
474
+ * @returns {string} - A GUID.
475
+ */
435
476
  export function guid() {
436
477
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
437
478
  const r = Math.random() * 16 | 0;
@@ -443,9 +484,8 @@ export function guid() {
443
484
  }
444
485
  /**
445
486
  * Return a translated date setting.
446
- *
447
- * @param date
448
- * @return {(null|Date)}
487
+ * @param {string|Date} date - The date to translate.
488
+ * @returns {(null|Date)} - The translated date.
449
489
  */
450
490
  export function getDateSetting(date) {
451
491
  if (_.isNil(date) || _.isNaN(date) || date === '') {
@@ -486,13 +526,17 @@ export function getDateSetting(date) {
486
526
  }
487
527
  return dateSetting.toDate();
488
528
  }
529
+ /**
530
+ * Returns true if the date is a valid date. False otherwise.
531
+ * @param {Date|string} date - The date to check for validity.
532
+ * @returns {boolean} - TRUE if the date is valid; FALSE otherwise.
533
+ */
489
534
  export function isValidDate(date) {
490
535
  return _.isDate(date) && !_.isNaN(date.getDate());
491
536
  }
492
537
  /**
493
538
  * Get the current timezone string.
494
- *
495
- * @return {string}
539
+ * @returns {string} - The current timezone.
496
540
  */
497
541
  export function currentTimezone() {
498
542
  if (moment.currentTimezone) {
@@ -503,10 +547,9 @@ export function currentTimezone() {
503
547
  }
504
548
  /**
505
549
  * Get an offset date provided a date object and timezone object.
506
- *
507
- * @param date
508
- * @param timezone
509
- * @return {Date}
550
+ * @param {Date} date - The date to offset.
551
+ * @param {string} timezone - The timezone to offset the date to.
552
+ * @returns {Date} - The offset date.
510
553
  */
511
554
  export function offsetDate(date, timezone) {
512
555
  if (timezone === 'UTC') {
@@ -523,17 +566,15 @@ export function offsetDate(date, timezone) {
523
566
  }
524
567
  /**
525
568
  * Returns if the zones are loaded.
526
- *
527
- * @return {boolean}
569
+ * @returns {boolean} - TRUE if the zones are loaded; FALSE otherwise.
528
570
  */
529
571
  export function zonesLoaded() {
530
572
  return moment.zonesLoaded;
531
573
  }
532
574
  /**
533
575
  * Returns if we should load the zones.
534
- *
535
- * @param timezone
536
- * @return {boolean}
576
+ * @param {string} timezone - The timezone to check if we should load the zones.
577
+ * @returns {boolean} - TRUE if we should load the zones; FALSE otherwise.
537
578
  */
538
579
  export function shouldLoadZones(timezone) {
539
580
  if (timezone === currentTimezone() || timezone === 'UTC') {
@@ -543,8 +584,9 @@ export function shouldLoadZones(timezone) {
543
584
  }
544
585
  /**
545
586
  * Externally load the timezone data.
546
- *
547
- * @return {Promise<any> | *}
587
+ * @param {string} url - The URL to load the timezone data from.
588
+ * @param {string} timezone - The timezone to load.
589
+ * @returns {Promise<any> | *} - Resolves when the zones for this timezone are loaded.
548
590
  */
549
591
  export function loadZones(url, timezone) {
550
592
  if (timezone && !shouldLoadZones(timezone)) {
@@ -568,11 +610,10 @@ export function loadZones(url, timezone) {
568
610
  }
569
611
  /**
570
612
  * Get the moment date object for translating dates with timezones.
571
- *
572
- * @param value
573
- * @param format
574
- * @param timezone
575
- * @return {*}
613
+ * @param {string|Date} value - The value to convert into a moment date.
614
+ * @param {string} format - The format to convert the date to.
615
+ * @param {string} timezone - The timezone to convert the date to.
616
+ * @returns {Date} - The moment date object.
576
617
  */
577
618
  export function momentDate(value, format, timezone) {
578
619
  const momentDate = moment(value);
@@ -589,11 +630,12 @@ export function momentDate(value, format, timezone) {
589
630
  }
590
631
  /**
591
632
  * Format a date provided a value, format, and timezone object.
592
- *
593
- * @param value
594
- * @param format
595
- * @param timezone
596
- * @return {string}
633
+ * @param {string} timezonesUrl - The URL to load the timezone data from.
634
+ * @param {string|Date} value - The value to format.
635
+ * @param {string} format - The format to format the date to.
636
+ * @param {string} timezone - The timezone to format the date to.
637
+ * @param {string} flatPickrInputFormat - The format to use for flatpickr input.
638
+ * @returns {string} - The formatted date.
597
639
  */
598
640
  export function formatDate(timezonesUrl, value, format, timezone, flatPickrInputFormat) {
599
641
  const momentDate = moment(value, flatPickrInputFormat || undefined);
@@ -626,12 +668,12 @@ export function formatDate(timezonesUrl, value, format, timezone, flatPickrInput
626
668
  }
627
669
  /**
628
670
  * 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}
671
+ * @param {string} timezonesUrl - The URL to load the timezone data from.
672
+ * @param {Function} formatFn - The format function to use.
673
+ * @param {Date|string} date - The date to format.
674
+ * @param {string} format - The format to format the date to.
675
+ * @param {string} timezone - The timezone to format the date to.
676
+ * @returns {string} - The formatted date.
635
677
  */
636
678
  export function formatOffset(timezonesUrl, formatFn, date, format, timezone) {
637
679
  if (timezone === currentTimezone()) {
@@ -650,6 +692,11 @@ export function formatOffset(timezonesUrl, formatFn, date, format, timezone) {
650
692
  return formatFn(date, format);
651
693
  }
652
694
  }
695
+ /**
696
+ * Returns the local date format information.
697
+ * @param {Intl.LocalesArgument} locale - The locale to get the date format for.
698
+ * @returns {object} - The local date format information.
699
+ */
653
700
  export function getLocaleDateFormatInfo(locale) {
654
701
  const formatInfo = {};
655
702
  const day = 21;
@@ -660,8 +707,8 @@ export function getLocaleDateFormatInfo(locale) {
660
707
  }
661
708
  /**
662
709
  * Convert the format from the angular-datepicker module to flatpickr format.
663
- * @param format
664
- * @return {string}
710
+ * @param {string} format - The format to convert.
711
+ * @returns {string} - The converted format.
665
712
  */
666
713
  export function convertFormatToFlatpickr(format) {
667
714
  return format
@@ -691,8 +738,8 @@ export function convertFormatToFlatpickr(format) {
691
738
  }
692
739
  /**
693
740
  * Convert the format from the angular-datepicker module to moment format.
694
- * @param format
695
- * @return {string}
741
+ * @param {string} format - The format to convert.
742
+ * @returns {string} - The converted format.
696
743
  */
697
744
  export function convertFormatToMoment(format) {
698
745
  return format
@@ -707,6 +754,11 @@ export function convertFormatToMoment(format) {
707
754
  // Unix Timestamp
708
755
  .replace(/U/g, 'X');
709
756
  }
757
+ /**
758
+ * Convert the format from the angular-datepicker module to mask format.
759
+ * @param {string} format - The format to convert.
760
+ * @returns {string} - The converted format.
761
+ */
710
762
  export function convertFormatToMask(format) {
711
763
  return format
712
764
  // Long month replacement.
@@ -764,6 +816,13 @@ export function getInputMask(mask, placeholderChar) {
764
816
  }
765
817
  return maskArray;
766
818
  }
819
+ /**
820
+ * Unmasks a value using the provided mask and placeholder characters.
821
+ * @param {string} value - The value to unmask.
822
+ * @param {string} mask - The mask to use for unmasking.
823
+ * @param {string} placeholderChar - The placeholder character to use for unmasking.
824
+ * @returns {string} - The unmasked value.
825
+ */
767
826
  export function unmaskValue(value, mask, placeholderChar) {
768
827
  if (!mask || !value || value.length > mask.length) {
769
828
  return value;
@@ -779,6 +838,12 @@ export function unmaskValue(value, mask, placeholderChar) {
779
838
  unmaskedValue = unmaskedValue.join('').replace(placeholderChar, '');
780
839
  return unmaskedValue;
781
840
  }
841
+ /**
842
+ * Returns true if the value matches the input mask format.
843
+ * @param {string} value - The value to check.
844
+ * @param {string} inputMask - The input mask to check against.
845
+ * @returns {boolean} - TRUE if the value matches the input mask; FALSE otherwise.
846
+ */
782
847
  export function matchInputMask(value, inputMask) {
783
848
  if (!inputMask) {
784
849
  return true;
@@ -796,6 +861,11 @@ export function matchInputMask(value, inputMask) {
796
861
  }
797
862
  return true;
798
863
  }
864
+ /**
865
+ * Returns the number separators (i.e. 1,000) for the provided language.
866
+ * @param {string} lang - The language code to get the number separators for.
867
+ * @returns {{delimiter: string, decimalSeparator: string}} - The number separators.
868
+ */
799
869
  export function getNumberSeparators(lang = 'en') {
800
870
  const formattedNumberString = (12345.6789).toLocaleString(lang);
801
871
  const delimeters = formattedNumberString.match(/..(.)...(.)../);
@@ -810,6 +880,12 @@ export function getNumberSeparators(lang = 'en') {
810
880
  decimalSeparator: (delimeters.length > 2) ? delimeters[2] : '.',
811
881
  };
812
882
  }
883
+ /**
884
+ * Returns the number for the maximum amount of decimal places for a number.
885
+ * @param {import('@formio/core').Component} component - The component to check for decimal limits.
886
+ * @param {number} defaultLimit - The default limit to use if none is provided in the component.
887
+ * @returns {number} - The number of decimal places allowed.
888
+ */
813
889
  export function getNumberDecimalLimit(component, defaultLimit) {
814
890
  if (_.has(component, 'decimalLimit')) {
815
891
  return _.get(component, 'decimalLimit');
@@ -825,6 +901,15 @@ export function getNumberDecimalLimit(component, defaultLimit) {
825
901
  }
826
902
  return decimalLimit;
827
903
  }
904
+ /**
905
+ * Returns the currency affixes for a specific language.
906
+ * @param {object} arg0 - The arguments object.
907
+ * @param {string} arg0.currency - The currency code to get the affixes for.
908
+ * @param {number} arg0.decimalLimit - The number of decimal places to use.
909
+ * @param {string} arg0.decimalSeparator - The decimal separator to use.
910
+ * @param {string} arg0.lang - The language code to use.
911
+ * @returns {{prefix: string, suffix: string}} - The currency affixes.
912
+ */
828
913
  export function getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, lang, }) {
829
914
  // Get the prefix and suffix from the localized string.
830
915
  let regex = `(.*)?${(100).toLocaleString(lang)}`;
@@ -846,10 +931,9 @@ export function getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, l
846
931
  }
847
932
  /**
848
933
  * Fetch the field data provided a component.
849
- *
850
- * @param data
851
- * @param component
852
- * @return {*}
934
+ * @param {import('@formio/core').DataObject} data - The data object to fetch the field data from.
935
+ * @param {import('@formio/core').Component} component - The component to fetch the field data for.
936
+ * @returns {*} - The field data.
853
937
  */
854
938
  export function fieldData(data, component) {
855
939
  if (!data) {
@@ -895,16 +979,23 @@ export function fieldData(data, component) {
895
979
  }
896
980
  /**
897
981
  * 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 {*}
982
+ * @param {Function} fn - Function to delay
983
+ * @param {number} delay - Delay time
984
+ * @param {...any} args - Arguments to pass to the function
985
+ * @returns {*} - Function to cancel the delay
902
986
  */
903
987
  export function delay(fn, delay = 0, ...args) {
904
988
  const timer = setTimeout(fn, delay, ...args);
989
+ /**
990
+ *
991
+ */
905
992
  function cancel() {
906
993
  clearTimeout(timer);
907
994
  }
995
+ /**
996
+ * Execute the function early.
997
+ * @returns {*} - The result of the function.
998
+ */
908
999
  function earlyCall() {
909
1000
  cancel();
910
1001
  return fn(...args);
@@ -915,11 +1006,9 @@ export function delay(fn, delay = 0, ...args) {
915
1006
  }
916
1007
  /**
917
1008
  * Iterate the given key to make it unique.
918
- *
919
- * @param {String} key
1009
+ * @param {string} key
920
1010
  * Modify the component key to be unique.
921
- *
922
- * @returns {String}
1011
+ * @returns {string}
923
1012
  * The new component key.
924
1013
  */
925
1014
  export function iterateKey(key) {
@@ -932,10 +1021,9 @@ export function iterateKey(key) {
932
1021
  }
933
1022
  /**
934
1023
  * Determines a unique key within a map provided the base key.
935
- *
936
- * @param map
937
- * @param base
938
- * @return {*}
1024
+ * @param {Record<string, string>} map - The map to check for uniqueness.
1025
+ * @param {string} base - The base path of the key.
1026
+ * @returns {string} - The unique key.
939
1027
  */
940
1028
  export function uniqueKey(map, base) {
941
1029
  let newKey = base;
@@ -946,8 +1034,9 @@ export function uniqueKey(map, base) {
946
1034
  }
947
1035
  /**
948
1036
  * Determines the major version number of bootstrap.
949
- *
950
- * @return {number}
1037
+ * @param {object} options - The options to check for bootstrap version.
1038
+ * @param {string} options.bootstrap - The bootstrap version to use.
1039
+ * @returns {number} - The bootstrap version.
951
1040
  */
952
1041
  export function bootstrapVersion(options) {
953
1042
  if (options.bootstrap) {
@@ -964,9 +1053,8 @@ export function bootstrapVersion(options) {
964
1053
  /**
965
1054
  * Retrun provided argument.
966
1055
  * If argument is a function, returns the result of a function call.
967
- * @param {*} e;
968
- *
969
- * @return {*}
1056
+ * @param {Function|any} e - The argument to check if a function and call if so.
1057
+ * @returns {any} - Either the result of the function call (e) or e if it is not a function.
970
1058
  */
971
1059
  export function unfold(e) {
972
1060
  if (typeof e === 'function') {
@@ -976,27 +1064,32 @@ export function unfold(e) {
976
1064
  }
977
1065
  /**
978
1066
  * Map values through unfold and return first non-nil value.
979
- * @param {Array<T>} collection;
980
- *
981
- * @return {T}
1067
+ * @param {Array<T>} collection - The collection to map through unfold.;
1068
+ * @returns {T} - The first non-nil value.
982
1069
  */
983
1070
  export const firstNonNil = _.flow([
984
1071
  _.partialRight(_.map, unfold),
985
1072
  _.partialRight(_.find, v => !_.isUndefined(v))
986
1073
  ]);
987
- /*
988
- * Create enclosed state.
989
- * Returns functions to getting and cycling between states.
1074
+ /**
1075
+ * Create enclosed state. Returns functions to getting and cycling between states.
990
1076
  * @param {*} a - initial state.
991
1077
  * @param {*} b - next state.
992
- * @return {Functions[]} -- [get, toggle];
1078
+ * @returns {Functions[]} -- [get, toggle];
993
1079
  */
994
1080
  export function withSwitch(a, b) {
995
1081
  let state = a;
996
1082
  let next = b;
1083
+ /**
1084
+ * Returns the state of the switch.
1085
+ * @returns {*} - The current state.
1086
+ */
997
1087
  function get() {
998
1088
  return state;
999
1089
  }
1090
+ /**
1091
+ * Toggles the state of the switch.
1092
+ */
1000
1093
  function toggle() {
1001
1094
  const prev = state;
1002
1095
  state = next;
@@ -1004,6 +1097,14 @@ export function withSwitch(a, b) {
1004
1097
  }
1005
1098
  return [get, toggle];
1006
1099
  }
1100
+ /**
1101
+ * Create a function that will call the provided function only the provided limit.
1102
+ * @param {Function} callback - The callback to call.
1103
+ * @param {object} options - The options to use.
1104
+ * @param {number} options.limit - The limit to call the callback.
1105
+ * @param {number} options.delay - The delay to wait before resetting the call count.
1106
+ * @returns {Function} - The function that will call the callback only the provided limit.
1107
+ */
1007
1108
  export function observeOverload(callback, options = {}) {
1008
1109
  const { limit = 50, delay = 500 } = options;
1009
1110
  let callCount = 0;
@@ -1023,6 +1124,13 @@ export function observeOverload(callback, options = {}) {
1023
1124
  }
1024
1125
  };
1025
1126
  }
1127
+ /**
1128
+ * Returns the components that are provided within an evaluation context.
1129
+ * @param {any} context - The evaluation context to get the components from.
1130
+ * @param {boolean} excludeNested - Exclude nested components.
1131
+ * @param {Array<string>} excludedTypes - The types of components to exclude.
1132
+ * @returns {Array} - The components within the evaluation context.
1133
+ */
1026
1134
  export function getContextComponents(context, excludeNested, excludedTypes = []) {
1027
1135
  const values = [];
1028
1136
  context.utils.eachComponent(context.instance.options.editForm.components, (component, path) => {
@@ -1036,6 +1144,11 @@ export function getContextComponents(context, excludeNested, excludedTypes = [])
1036
1144
  });
1037
1145
  return values;
1038
1146
  }
1147
+ /**
1148
+ * Returns the button components that are within an evaluation context.
1149
+ * @param {any} context - The evaluation context to get the components from.
1150
+ * @returns {Array} - The button components within the evaluation context.
1151
+ */
1039
1152
  export function getContextButtons(context) {
1040
1153
  const values = [];
1041
1154
  context.utils.eachComponent(context.instance.options.editForm.components, (component) => {
@@ -1052,12 +1165,9 @@ export function getContextButtons(context) {
1052
1165
  const inTextTags = ['#text', 'A', 'B', 'EM', 'I', 'SMALL', 'STRONG', 'SUB', 'SUP', 'INS', 'DEL', 'MARK', 'CODE'];
1053
1166
  /**
1054
1167
  * 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.
1168
+ * @param {HTMLElement} elem - The element to translate.
1169
+ * @param {Function} translate - The translation function.
1170
+ * @returns {string} - Translated element template.
1061
1171
  */
1062
1172
  function translateElemValue(elem, translate) {
1063
1173
  if (!elem.innerText) {
@@ -1088,10 +1198,8 @@ function translateElemValue(elem, translate) {
1088
1198
  }
1089
1199
  /**
1090
1200
  * 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
- *
1201
+ * @param {HTMLElement} tag - The tag to translate.
1202
+ * @param {Function} translate - The translation function.
1095
1203
  * @returns {void}
1096
1204
  */
1097
1205
  function translateDeepTag(tag, translate) {
@@ -1107,12 +1215,9 @@ function translateDeepTag(tag, translate) {
1107
1215
  }
1108
1216
  /**
1109
1217
  * 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.
1218
+ * @param {string} template - The template to translate.
1219
+ * @param {Function} translate - The translation function.
1220
+ * @returns {string} - Html template with translated values.
1116
1221
  */
1117
1222
  export function translateHTMLTemplate(template, translate) {
1118
1223
  const isHTML = /<[^>]*>/.test(template);
@@ -1129,9 +1234,9 @@ export function translateHTMLTemplate(template, translate) {
1129
1234
  }
1130
1235
  /**
1131
1236
  * Sanitize an html string.
1132
- *
1133
- * @param string
1134
- * @returns {*}
1237
+ * @param {string} string - The string to sanitize.
1238
+ * @param {any} options - The options to use for sanitization.
1239
+ * @returns {string} - The sanitized html string.
1135
1240
  */
1136
1241
  export function sanitize(string, options) {
1137
1242
  if (typeof dompurify.sanitize !== 'function') {
@@ -1179,11 +1284,18 @@ export function sanitize(string, options) {
1179
1284
  }
1180
1285
  /**
1181
1286
  * Fast cloneDeep for JSON objects only.
1287
+ * @param {any} obj - The object to perform a fast clone deep against.
1288
+ * @returns {any} - The cloned object.
1182
1289
  */
1183
1290
  export function fastCloneDeep(obj) {
1184
1291
  return obj ? JSON.parse(JSON.stringify(obj)) : obj;
1185
1292
  }
1186
1293
  export { Evaluator, interpolate };
1294
+ /**
1295
+ * Returns if the component is an input component.
1296
+ * @param {import('@formio/core').Component} componentJson - The JSON of a component.
1297
+ * @returns {bool} - TRUE if the component is an input component; FALSE otherwise.
1298
+ */
1187
1299
  export function isInputComponent(componentJson) {
1188
1300
  if (componentJson.input === false || componentJson.input === true) {
1189
1301
  return componentJson.input;
@@ -1203,6 +1315,11 @@ export function isInputComponent(componentJson) {
1203
1315
  return true;
1204
1316
  }
1205
1317
  }
1318
+ /**
1319
+ * Takes a component path, and returns a component path array.
1320
+ * @param {string} pathStr - The path string to convert to an array.
1321
+ * @returns {Arryay<number>} - The array of paths.
1322
+ */
1206
1323
  export function getArrayFromComponentPath(pathStr) {
1207
1324
  if (!pathStr || !_.isString(pathStr)) {
1208
1325
  if (!_.isArray(pathStr)) {
@@ -1216,6 +1333,12 @@ export function getArrayFromComponentPath(pathStr) {
1216
1333
  .split('.')
1217
1334
  .map(part => _.defaultTo(_.toNumber(part), part));
1218
1335
  }
1336
+ /**
1337
+ * Returns true if the component is a child of the parent.
1338
+ * @param {any} child - The child component to check.
1339
+ * @param {any} parent - The parent component to check.
1340
+ * @returns {boolean} - TRUE if the child is a child of the parent; FALSE otherwise.
1341
+ */
1219
1342
  export function isChildOf(child, parent) {
1220
1343
  while (child && child.parent) {
1221
1344
  if (child.parent === parent) {
@@ -1225,6 +1348,11 @@ export function isChildOf(child, parent) {
1225
1348
  }
1226
1349
  return false;
1227
1350
  }
1351
+ /**
1352
+ * Takes an array of component path indexes, and returns a string version of that array.
1353
+ * @param {Array<number>} path - The path array to convert to a string.
1354
+ * @returns {string} - The string version of the path.
1355
+ */
1228
1356
  export function getStringFromComponentPath(path) {
1229
1357
  if (!_.isArray(path)) {
1230
1358
  return path;
@@ -1240,16 +1368,21 @@ export function getStringFromComponentPath(path) {
1240
1368
  });
1241
1369
  return strPath;
1242
1370
  }
1371
+ /**
1372
+ * Takes a number and rounds it to the provided precision amount.
1373
+ * @param {number} number - The number to round.
1374
+ * @param {number} precision - The precision to round the number to.
1375
+ * @returns {string} - The rounded number.
1376
+ */
1243
1377
  export function round(number, precision) {
1244
1378
  if (_.isNumber(number)) {
1245
1379
  return number.toFixed(precision);
1246
1380
  }
1247
- return number;
1381
+ return number.toString();
1248
1382
  }
1249
1383
  /**
1250
1384
  * Check for Internet Explorer browser version
1251
- *
1252
- * @return {(number|null)}
1385
+ * @returns {(number|null)} - The IE browser version or null if not IE
1253
1386
  */
1254
1387
  export function getIEBrowserVersion() {
1255
1388
  const { ie, version } = getBrowserInfo();
@@ -1257,8 +1390,7 @@ export function getIEBrowserVersion() {
1257
1390
  }
1258
1391
  /**
1259
1392
  * Get browser name and version (modified from 'jquery-browser-plugin')
1260
- *
1261
- * @return {Object} -- {{browser name, version, isWebkit?}}
1393
+ * @returns {object} -- {{browser name, version, isWebkit?}}
1262
1394
  * Possible browser names: chrome, safari, ie, edge, opera, mozilla, yabrowser
1263
1395
  */
1264
1396
  export function getBrowserInfo() {
@@ -1306,12 +1438,19 @@ export function getBrowserInfo() {
1306
1438
  }
1307
1439
  return browser;
1308
1440
  }
1441
+ /**
1442
+ * Takes a component path, which may include array indicies (i.e. [0][1]), and returns the compoennt path without the indicies.
1443
+ * @param {string} path - The path to remove the indicies from.
1444
+ * @returns {string} - The path without the indicies.
1445
+ */
1309
1446
  export function getComponentPathWithoutIndicies(path = '') {
1310
1447
  return path.replace(/\[\d+\]/, '');
1311
1448
  }
1312
1449
  /**
1313
1450
  * 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
1451
+ * @param {import('@formio/core').Component} component - Component containing link to its parent's schema in the 'parent' property
1452
+ * @param {string} path - Path to the component
1453
+ * @returns {string} - Path to the component
1315
1454
  */
1316
1455
  export function getComponentPath(component, path = '') {
1317
1456
  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 +1461,8 @@ export function getComponentPath(component, path = '') {
1322
1461
  }
1323
1462
  /**
1324
1463
  * Returns a parent component of the passed component instance skipping all the Layout components
1325
- * @param {*} componentInstance
1326
- * @return {(Component|undefined)}
1464
+ * @param {Component} componentInstance - The component to check for the parent.
1465
+ * @returns {Component|undefined} - The parent data component.
1327
1466
  */
1328
1467
  export function getDataParentComponent(componentInstance) {
1329
1468
  if (!componentInstance) {
@@ -1339,8 +1478,8 @@ export function getDataParentComponent(componentInstance) {
1339
1478
  }
1340
1479
  /**
1341
1480
  * Returns whether the value is a promise
1342
- * @param value
1343
- * @return {boolean}
1481
+ * @param {any} value - The value to check
1482
+ * @returns {boolean} - TRUE if the value is a promise; FALSE otherwise
1344
1483
  */
1345
1484
  export function isPromise(value) {
1346
1485
  return value
@@ -1351,9 +1490,9 @@ export function isPromise(value) {
1351
1490
  /**
1352
1491
  * Determines if the component has a scoping parent in tree (a component which scopes its children and manages its
1353
1492
  * changes by itself, e.g. EditGrid)
1354
- * @param componentInstance
1355
- * @param firstPass
1356
- * @returns {boolean|boolean|*}
1493
+ * @param {Component} componentInstance - The component to check for the scoping parent.
1494
+ * @param {boolean} firstPass - Whether it is the first pass of the function
1495
+ * @returns {boolean|*} - TRUE if the component has a scoping parent; FALSE otherwise
1357
1496
  */
1358
1497
  export function isInsideScopingComponent(componentInstance, firstPass = true) {
1359
1498
  if (!firstPass && componentInstance?.hasScopedChildren) {
@@ -1368,6 +1507,11 @@ export function isInsideScopingComponent(componentInstance, firstPass = true) {
1368
1507
  }
1369
1508
  return false;
1370
1509
  }
1510
+ /**
1511
+ * Returns all the focusable elements within the provided dom element.
1512
+ * @param {HTMLElement} element - The element to get the focusable elements from.
1513
+ * @returns {NodeList<HTMLElement>} - The focusable elements within the provided element.
1514
+ */
1371
1515
  export function getFocusableElements(element) {
1372
1516
  const focusableSelector = `button:not([disabled]), input:not([disabled]), select:not([disabled]),
1373
1517
  textarea:not([disabled]), button:not([disabled]), [href]`;
@@ -1384,6 +1528,11 @@ export const componentValueTypes = {
1384
1528
  date: 'date',
1385
1529
  any: 'any',
1386
1530
  };
1531
+ /**
1532
+ * Returns the saved types for the component
1533
+ * @param {import('@formio/core').Component} fullSchema - The component schema
1534
+ * @returns {Array<string>|null} - The saved types for the component
1535
+ */
1387
1536
  export function getComponentSavedTypes(fullSchema) {
1388
1537
  const schema = fullSchema || {};
1389
1538
  if (schema.persistent !== true) {
@@ -1396,9 +1545,10 @@ export function getComponentSavedTypes(fullSchema) {
1396
1545
  }
1397
1546
  /**
1398
1547
  * Interpolates @formio/core errors so that they are compatible with the renderer
1399
- * @param {FieldError[]} errors
1400
- * @param firstPass
1401
- * @returns {[]}
1548
+ * @param {Component} component - The component to interpolate the errors for
1549
+ * @param {FieldError[]} errors - The errors to interpolate
1550
+ * @param {Function} interpolateFn - The interpolation function
1551
+ * @returns {[]} - The interpolated errors
1402
1552
  */
1403
1553
  export const interpolateErrors = (component, errors, interpolateFn) => {
1404
1554
  return errors.map((error) => {
@@ -1408,6 +1558,11 @@ export const interpolateErrors = (component, errors, interpolateFn) => {
1408
1558
  return { ...error, message: unescapeHTML(interpolateFn(toInterpolate, context)), context: { ...context } };
1409
1559
  });
1410
1560
  };
1561
+ /**
1562
+ * Returns the template keys inside the template code.
1563
+ * @param {string} template - The template to get the keys from.
1564
+ * @returns {Array<string>} - The keys inside the template.
1565
+ */
1411
1566
  export function getItemTemplateKeys(template) {
1412
1567
  const templateKeys = [];
1413
1568
  if (!template) {
@@ -1424,6 +1579,11 @@ export function getItemTemplateKeys(template) {
1424
1579
  }
1425
1580
  return templateKeys;
1426
1581
  }
1582
+ /**
1583
+ * Returns if the component is a select resource with an object for its value.
1584
+ * @param {import('@formio/core').Component} comp - The component to check.
1585
+ * @returns {boolean} - TRUE if the component is a select resource with an object for its value; FALSE otherwise.
1586
+ */
1427
1587
  export function isSelectResourceWithObjectValue(comp = {}) {
1428
1588
  const { reference, dataSrc, valueProperty } = comp;
1429
1589
  return reference || (dataSrc === 'resource' && (!valueProperty || valueProperty === 'data'));