@formio/js 5.0.0-dev.5633.8d2b30d → 5.0.0-dev.5633.fde3bc9

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 (493) hide show
  1. package/Changelog.md +47 -2
  2. package/dist/formio.builder.css +8 -8
  3. package/dist/formio.builder.min.css +1 -1
  4. package/dist/formio.embed.js +1 -1
  5. package/dist/formio.embed.min.js +1 -1
  6. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  7. package/dist/formio.form.css +8 -8
  8. package/dist/formio.form.js +615 -1196
  9. package/dist/formio.form.min.css +1 -1
  10. package/dist/formio.form.min.js +1 -1
  11. package/dist/formio.form.min.js.LICENSE.txt +3 -5
  12. package/dist/formio.full.css +8 -8
  13. package/dist/formio.full.js +659 -920
  14. package/dist/formio.full.min.css +1 -1
  15. package/dist/formio.full.min.js +1 -1
  16. package/dist/formio.full.min.js.LICENSE.txt +3 -5
  17. package/dist/formio.js +18 -18
  18. package/dist/formio.min.js +1 -1
  19. package/dist/formio.min.js.LICENSE.txt +1 -1
  20. package/dist/formio.utils.js +1829 -492
  21. package/dist/formio.utils.min.js +1 -1
  22. package/dist/formio.utils.min.js.LICENSE.txt +10 -4
  23. package/embed.d.ts +1 -0
  24. package/form.d.ts +1 -0
  25. package/lib/cjs/CDN.d.ts +1 -0
  26. package/lib/cjs/CDN.js +6 -3
  27. package/lib/cjs/Element.d.ts +86 -96
  28. package/lib/cjs/Element.js +68 -78
  29. package/lib/cjs/Embed.d.ts +1 -1
  30. package/lib/cjs/Embed.js +52 -12
  31. package/lib/cjs/Form.d.ts +365 -36
  32. package/lib/cjs/Form.js +50 -64
  33. package/lib/cjs/FormBuilder.d.ts +187 -2
  34. package/lib/cjs/FormBuilder.js +30 -8
  35. package/lib/cjs/InlineEmbed.d.ts +7 -0
  36. package/lib/cjs/InlineEmbed.js +116 -0
  37. package/lib/cjs/PDF.d.ts +11 -13
  38. package/lib/cjs/PDF.js +6 -8
  39. package/lib/cjs/Webform.d.ts +183 -143
  40. package/lib/cjs/Webform.js +310 -298
  41. package/lib/cjs/WebformBuilder.d.ts +16 -14
  42. package/lib/cjs/WebformBuilder.js +11 -10
  43. package/lib/cjs/Wizard.d.ts +31 -21
  44. package/lib/cjs/Wizard.js +43 -20
  45. package/lib/cjs/WizardBuilder.d.ts +1 -1
  46. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +8 -5
  47. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +6 -3
  48. package/lib/cjs/components/Components.d.ts +4 -4
  49. package/lib/cjs/components/Components.js +3 -3
  50. package/lib/cjs/components/_classes/component/Component.d.ts +507 -276
  51. package/lib/cjs/components/_classes/component/Component.form.d.ts +6 -3
  52. package/lib/cjs/components/_classes/component/Component.form.js +5 -0
  53. package/lib/cjs/components/_classes/component/Component.js +438 -196
  54. package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +0 -8
  55. package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +2 -2
  56. package/lib/cjs/components/_classes/component/editForm/utils.js +2 -2
  57. package/lib/cjs/components/_classes/component/fixtures/comp6.d.ts +77 -0
  58. package/lib/cjs/components/_classes/component/fixtures/comp6.js +59 -0
  59. package/lib/cjs/components/_classes/component/fixtures/index.d.ts +2 -1
  60. package/lib/cjs/components/_classes/component/fixtures/index.js +3 -1
  61. package/lib/cjs/components/_classes/field/Field.d.ts +11 -2
  62. package/lib/cjs/components/_classes/field/Field.js +13 -1
  63. package/lib/cjs/components/_classes/input/Input.d.ts +4 -3
  64. package/lib/cjs/components/_classes/input/Input.js +8 -6
  65. package/lib/cjs/components/_classes/list/ListComponent.d.ts +2 -2
  66. package/lib/cjs/components/_classes/list/ListComponent.form.d.ts +6 -3
  67. package/lib/cjs/components/_classes/list/ListComponent.form.js +5 -0
  68. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +43 -12
  69. package/lib/cjs/components/_classes/multivalue/Multivalue.js +37 -3
  70. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +163 -67
  71. package/lib/cjs/components/_classes/nested/NestedComponent.form.d.ts +6 -3
  72. package/lib/cjs/components/_classes/nested/NestedComponent.form.js +5 -0
  73. package/lib/cjs/components/_classes/nested/NestedComponent.js +175 -54
  74. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -2
  75. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  76. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +7 -1
  77. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +2 -3
  78. package/lib/cjs/components/address/Address.d.ts +4 -2
  79. package/lib/cjs/components/address/Address.form.d.ts +6 -3
  80. package/lib/cjs/components/address/Address.form.js +5 -0
  81. package/lib/cjs/components/button/Button.d.ts +3 -12
  82. package/lib/cjs/components/button/Button.form.d.ts +6 -3
  83. package/lib/cjs/components/button/Button.form.js +5 -0
  84. package/lib/cjs/components/button/Button.js +5 -0
  85. package/lib/cjs/components/checkbox/Checkbox.d.ts +4 -27
  86. package/lib/cjs/components/checkbox/Checkbox.form.d.ts +6 -3
  87. package/lib/cjs/components/checkbox/Checkbox.form.js +5 -0
  88. package/lib/cjs/components/columns/Columns.d.ts +3 -2
  89. package/lib/cjs/components/columns/Columns.form.d.ts +6 -3
  90. package/lib/cjs/components/columns/Columns.form.js +5 -0
  91. package/lib/cjs/components/columns/Columns.js +1 -1
  92. package/lib/cjs/components/container/Container.form.d.ts +6 -3
  93. package/lib/cjs/components/container/Container.form.js +5 -0
  94. package/lib/cjs/components/content/Content.d.ts +2 -1
  95. package/lib/cjs/components/content/Content.form.d.ts +6 -3
  96. package/lib/cjs/components/content/Content.form.js +5 -0
  97. package/lib/cjs/components/currency/Currency.form.d.ts +6 -3
  98. package/lib/cjs/components/currency/Currency.form.js +5 -0
  99. package/lib/cjs/components/currency/Currency.js +1 -2
  100. package/lib/cjs/components/datagrid/DataGrid.d.ts +8 -7
  101. package/lib/cjs/components/datagrid/DataGrid.form.d.ts +6 -3
  102. package/lib/cjs/components/datagrid/DataGrid.form.js +5 -0
  103. package/lib/cjs/components/datagrid/DataGrid.js +5 -5
  104. package/lib/cjs/components/datagrid/fixtures/comp-with-checkboxes.d.ts +29 -0
  105. package/lib/cjs/components/datagrid/fixtures/comp-with-checkboxes.js +36 -0
  106. package/lib/cjs/components/datagrid/fixtures/index.d.ts +2 -1
  107. package/lib/cjs/components/datagrid/fixtures/index.js +3 -1
  108. package/lib/cjs/components/datamap/DataMap.d.ts +1 -0
  109. package/lib/cjs/components/datamap/DataMap.form.d.ts +6 -3
  110. package/lib/cjs/components/datamap/DataMap.form.js +5 -0
  111. package/lib/cjs/components/datetime/DateTime.d.ts +0 -14
  112. package/lib/cjs/components/datetime/DateTime.form.d.ts +6 -3
  113. package/lib/cjs/components/datetime/DateTime.form.js +5 -0
  114. package/lib/cjs/components/datetime/editForm/DateTime.edit.date.js +2 -2
  115. package/lib/cjs/components/day/Day.d.ts +23 -49
  116. package/lib/cjs/components/day/Day.form.d.ts +6 -3
  117. package/lib/cjs/components/day/Day.form.js +5 -0
  118. package/lib/cjs/components/day/Day.js +16 -21
  119. package/lib/cjs/components/day/fixtures/comp7.d.ts +109 -0
  120. package/lib/cjs/components/day/fixtures/comp7.js +109 -0
  121. package/lib/cjs/components/day/fixtures/index.d.ts +2 -1
  122. package/lib/cjs/components/day/fixtures/index.js +3 -1
  123. package/lib/cjs/components/editgrid/EditGrid.d.ts +7 -3
  124. package/lib/cjs/components/editgrid/EditGrid.form.d.ts +6 -3
  125. package/lib/cjs/components/editgrid/EditGrid.form.js +5 -0
  126. package/lib/cjs/components/editgrid/EditGrid.js +3 -3
  127. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +2 -5
  128. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.templates.js +6 -9
  129. package/lib/cjs/components/email/Email.form.d.ts +6 -3
  130. package/lib/cjs/components/email/Email.form.js +5 -0
  131. package/lib/cjs/components/fieldset/Fieldset.form.d.ts +6 -3
  132. package/lib/cjs/components/fieldset/Fieldset.form.js +5 -0
  133. package/lib/cjs/components/file/File.d.ts +9 -22
  134. package/lib/cjs/components/file/File.form.d.ts +6 -3
  135. package/lib/cjs/components/file/File.form.js +5 -0
  136. package/lib/cjs/components/file/File.js +1 -2
  137. package/lib/cjs/components/form/Form.d.ts +34 -24
  138. package/lib/cjs/components/form/Form.form.d.ts +6 -3
  139. package/lib/cjs/components/form/Form.form.js +5 -0
  140. package/lib/cjs/components/form/Form.js +15 -13
  141. package/lib/cjs/components/hidden/Hidden.d.ts +1 -11
  142. package/lib/cjs/components/hidden/Hidden.form.d.ts +6 -3
  143. package/lib/cjs/components/hidden/Hidden.form.js +5 -0
  144. package/lib/cjs/components/hidden/Hidden.js +1 -2
  145. package/lib/cjs/components/html/HTML.d.ts +2 -1
  146. package/lib/cjs/components/html/HTML.form.d.ts +6 -3
  147. package/lib/cjs/components/html/HTML.form.js +5 -0
  148. package/lib/cjs/components/number/Number.d.ts +3 -17
  149. package/lib/cjs/components/number/Number.form.d.ts +6 -3
  150. package/lib/cjs/components/number/Number.form.js +5 -0
  151. package/lib/cjs/components/number/Number.js +1 -2
  152. package/lib/cjs/components/panel/Panel.form.d.ts +6 -3
  153. package/lib/cjs/components/panel/Panel.form.js +5 -0
  154. package/lib/cjs/components/panel/Panel.js +0 -1
  155. package/lib/cjs/components/password/Password.form.d.ts +6 -3
  156. package/lib/cjs/components/password/Password.form.js +5 -0
  157. package/lib/cjs/components/phonenumber/PhoneNumber.form.d.ts +6 -3
  158. package/lib/cjs/components/phonenumber/PhoneNumber.form.js +5 -0
  159. package/lib/cjs/components/radio/Radio.d.ts +3 -26
  160. package/lib/cjs/components/radio/Radio.form.d.ts +6 -3
  161. package/lib/cjs/components/radio/Radio.form.js +5 -0
  162. package/lib/cjs/components/radio/Radio.js +6 -6
  163. package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +1 -1
  164. package/lib/cjs/components/recaptcha/ReCaptcha.form.d.ts +6 -3
  165. package/lib/cjs/components/recaptcha/ReCaptcha.form.js +5 -0
  166. package/lib/cjs/components/select/Select.d.ts +16 -39
  167. package/lib/cjs/components/select/Select.form.d.ts +6 -3
  168. package/lib/cjs/components/select/Select.form.js +5 -0
  169. package/lib/cjs/components/select/Select.js +13 -16
  170. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +2 -17
  171. package/lib/cjs/components/selectboxes/SelectBoxes.form.d.ts +6 -3
  172. package/lib/cjs/components/selectboxes/SelectBoxes.form.js +5 -0
  173. package/lib/cjs/components/selectboxes/SelectBoxes.js +7 -9
  174. package/lib/cjs/components/signature/Signature.d.ts +0 -14
  175. package/lib/cjs/components/signature/Signature.form.d.ts +6 -3
  176. package/lib/cjs/components/signature/Signature.form.js +5 -0
  177. package/lib/cjs/components/survey/Survey.d.ts +3 -15
  178. package/lib/cjs/components/survey/Survey.form.d.ts +6 -3
  179. package/lib/cjs/components/survey/Survey.form.js +5 -0
  180. package/lib/cjs/components/table/Table.d.ts +2 -1
  181. package/lib/cjs/components/table/Table.form.d.ts +6 -3
  182. package/lib/cjs/components/table/Table.form.js +5 -0
  183. package/lib/cjs/components/tabs/Tabs.d.ts +4 -4
  184. package/lib/cjs/components/tabs/Tabs.form.d.ts +6 -3
  185. package/lib/cjs/components/tabs/Tabs.form.js +5 -0
  186. package/lib/cjs/components/tabs/Tabs.js +1 -2
  187. package/lib/cjs/components/tags/Tags.d.ts +0 -14
  188. package/lib/cjs/components/tags/Tags.form.d.ts +6 -3
  189. package/lib/cjs/components/tags/Tags.form.js +5 -0
  190. package/lib/cjs/components/textarea/TextArea.d.ts +4 -9
  191. package/lib/cjs/components/textarea/TextArea.form.d.ts +6 -3
  192. package/lib/cjs/components/textarea/TextArea.form.js +5 -0
  193. package/lib/cjs/components/textarea/TextArea.js +2 -2
  194. package/lib/cjs/components/textfield/TextField.d.ts +14 -30
  195. package/lib/cjs/components/textfield/TextField.form.d.ts +6 -3
  196. package/lib/cjs/components/textfield/TextField.form.js +5 -0
  197. package/lib/cjs/components/textfield/TextField.js +16 -17
  198. package/lib/cjs/components/time/Time.form.d.ts +6 -3
  199. package/lib/cjs/components/time/Time.form.js +5 -0
  200. package/lib/cjs/components/unknown/Unknown.form.d.ts +5 -34
  201. package/lib/cjs/components/unknown/Unknown.form.js +4 -0
  202. package/lib/cjs/components/url/Url.form.d.ts +6 -3
  203. package/lib/cjs/components/url/Url.form.js +5 -0
  204. package/lib/cjs/components/well/Well.form.d.ts +6 -3
  205. package/lib/cjs/components/well/Well.form.js +5 -0
  206. package/lib/cjs/formio.embed.d.ts +1 -2
  207. package/lib/cjs/formio.embed.js +2 -100
  208. package/lib/cjs/formio.form.d.ts +11 -4
  209. package/lib/cjs/formio.form.js +13 -5
  210. package/lib/cjs/providers/Providers.d.ts +36 -5
  211. package/lib/cjs/providers/Providers.js +29 -0
  212. package/lib/cjs/providers/address/AddressProvider.d.ts +131 -12
  213. package/lib/cjs/providers/address/AddressProvider.js +88 -2
  214. package/lib/cjs/providers/address/AzureAddressProvider.d.ts +48 -1
  215. package/lib/cjs/providers/address/AzureAddressProvider.js +37 -0
  216. package/lib/cjs/providers/address/CustomAddressProvider.d.ts +27 -4
  217. package/lib/cjs/providers/address/CustomAddressProvider.js +34 -0
  218. package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +130 -6
  219. package/lib/cjs/providers/address/GoogleAddressProvider.js +73 -1
  220. package/lib/cjs/providers/address/NominatimAddressProvider.d.ts +32 -7
  221. package/lib/cjs/providers/address/NominatimAddressProvider.js +33 -0
  222. package/lib/cjs/providers/address/index.d.ts +3 -1
  223. package/lib/cjs/providers/processor/fileProcessor.d.ts +7 -1
  224. package/lib/cjs/providers/processor/fileProcessor.js +6 -0
  225. package/lib/cjs/providers/storage/azure.d.ts +6 -13
  226. package/lib/cjs/providers/storage/azure.js +5 -0
  227. package/lib/cjs/providers/storage/base64.d.ts +5 -6
  228. package/lib/cjs/providers/storage/base64.js +4 -0
  229. package/lib/cjs/providers/storage/dropbox.d.ts +6 -4
  230. package/lib/cjs/providers/storage/dropbox.js +5 -0
  231. package/lib/cjs/providers/storage/googleDrive.d.ts +7 -5
  232. package/lib/cjs/providers/storage/googleDrive.js +6 -0
  233. package/lib/cjs/providers/storage/indexeddb.d.ts +5 -7
  234. package/lib/cjs/providers/storage/indexeddb.js +4 -0
  235. package/lib/cjs/providers/storage/s3.d.ts +6 -20
  236. package/lib/cjs/providers/storage/s3.js +5 -0
  237. package/lib/cjs/providers/storage/url.d.ts +6 -7
  238. package/lib/cjs/providers/storage/url.js +10 -0
  239. package/lib/cjs/providers/storage/util.d.ts +24 -1
  240. package/lib/cjs/providers/storage/util.js +18 -0
  241. package/lib/cjs/templates/Templates.d.ts +1 -0
  242. package/lib/cjs/translations/en.d.ts +2 -0
  243. package/lib/cjs/translations/en.js +3 -1
  244. package/lib/cjs/utils/ChoicesWrapper.d.ts +1 -1
  245. package/lib/cjs/utils/ChoicesWrapper.js +13 -2
  246. package/lib/cjs/utils/Evaluator.d.ts +6 -3
  247. package/lib/cjs/utils/Evaluator.js +11 -20
  248. package/lib/cjs/utils/builder.d.ts +9 -7
  249. package/lib/cjs/utils/builder.js +10 -5
  250. package/lib/cjs/utils/calendarUtils.d.ts +7 -13
  251. package/lib/cjs/utils/calendarUtils.js +10 -17
  252. package/lib/cjs/utils/formUtils.d.ts +43 -171
  253. package/lib/cjs/utils/formUtils.js +38 -569
  254. package/lib/cjs/utils/utils.d.ts +367 -221
  255. package/lib/cjs/utils/utils.js +335 -228
  256. package/lib/cjs/widgets/CalendarWidget.d.ts +9 -10
  257. package/lib/cjs/widgets/CalendarWidget.js +9 -11
  258. package/lib/mjs/CDN.d.ts +1 -0
  259. package/lib/mjs/CDN.js +6 -3
  260. package/lib/mjs/Element.d.ts +86 -96
  261. package/lib/mjs/Element.js +68 -78
  262. package/lib/mjs/Embed.d.ts +1 -1
  263. package/lib/mjs/Embed.js +52 -12
  264. package/lib/mjs/Form.d.ts +365 -36
  265. package/lib/mjs/Form.js +140 -57
  266. package/lib/mjs/FormBuilder.d.ts +187 -2
  267. package/lib/mjs/FormBuilder.js +32 -8
  268. package/lib/mjs/InlineEmbed.d.ts +7 -0
  269. package/lib/mjs/InlineEmbed.js +112 -0
  270. package/lib/mjs/PDF.d.ts +11 -13
  271. package/lib/mjs/PDF.js +6 -8
  272. package/lib/mjs/Webform.d.ts +183 -143
  273. package/lib/mjs/Webform.js +322 -310
  274. package/lib/mjs/WebformBuilder.d.ts +16 -14
  275. package/lib/mjs/WebformBuilder.js +11 -10
  276. package/lib/mjs/Wizard.d.ts +31 -21
  277. package/lib/mjs/Wizard.js +42 -19
  278. package/lib/mjs/WizardBuilder.d.ts +1 -1
  279. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +8 -5
  280. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +6 -3
  281. package/lib/mjs/components/Components.d.ts +4 -4
  282. package/lib/mjs/components/Components.js +3 -3
  283. package/lib/mjs/components/_classes/component/Component.d.ts +507 -276
  284. package/lib/mjs/components/_classes/component/Component.form.d.ts +6 -3
  285. package/lib/mjs/components/_classes/component/Component.form.js +5 -0
  286. package/lib/mjs/components/_classes/component/Component.js +438 -196
  287. package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +0 -8
  288. package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +1 -1
  289. package/lib/mjs/components/_classes/component/editForm/utils.js +1 -1
  290. package/lib/mjs/components/_classes/component/fixtures/comp6.d.ts +77 -0
  291. package/lib/mjs/components/_classes/component/fixtures/comp6.js +57 -0
  292. package/lib/mjs/components/_classes/component/fixtures/index.d.ts +2 -1
  293. package/lib/mjs/components/_classes/component/fixtures/index.js +2 -1
  294. package/lib/mjs/components/_classes/field/Field.d.ts +11 -2
  295. package/lib/mjs/components/_classes/field/Field.js +13 -1
  296. package/lib/mjs/components/_classes/input/Input.d.ts +4 -3
  297. package/lib/mjs/components/_classes/input/Input.js +8 -6
  298. package/lib/mjs/components/_classes/list/ListComponent.d.ts +2 -2
  299. package/lib/mjs/components/_classes/list/ListComponent.form.d.ts +6 -3
  300. package/lib/mjs/components/_classes/list/ListComponent.form.js +5 -0
  301. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +43 -12
  302. package/lib/mjs/components/_classes/multivalue/Multivalue.js +37 -3
  303. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +163 -67
  304. package/lib/mjs/components/_classes/nested/NestedComponent.form.d.ts +6 -3
  305. package/lib/mjs/components/_classes/nested/NestedComponent.form.js +5 -0
  306. package/lib/mjs/components/_classes/nested/NestedComponent.js +175 -54
  307. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -2
  308. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  309. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +7 -1
  310. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +2 -3
  311. package/lib/mjs/components/address/Address.d.ts +4 -2
  312. package/lib/mjs/components/address/Address.form.d.ts +6 -3
  313. package/lib/mjs/components/address/Address.form.js +5 -0
  314. package/lib/mjs/components/button/Button.d.ts +3 -12
  315. package/lib/mjs/components/button/Button.form.d.ts +6 -3
  316. package/lib/mjs/components/button/Button.form.js +5 -0
  317. package/lib/mjs/components/button/Button.js +5 -0
  318. package/lib/mjs/components/checkbox/Checkbox.d.ts +4 -27
  319. package/lib/mjs/components/checkbox/Checkbox.form.d.ts +6 -3
  320. package/lib/mjs/components/checkbox/Checkbox.form.js +5 -0
  321. package/lib/mjs/components/columns/Columns.d.ts +3 -2
  322. package/lib/mjs/components/columns/Columns.form.d.ts +6 -3
  323. package/lib/mjs/components/columns/Columns.form.js +5 -0
  324. package/lib/mjs/components/columns/Columns.js +1 -1
  325. package/lib/mjs/components/container/Container.form.d.ts +6 -3
  326. package/lib/mjs/components/container/Container.form.js +5 -0
  327. package/lib/mjs/components/content/Content.d.ts +2 -1
  328. package/lib/mjs/components/content/Content.form.d.ts +6 -3
  329. package/lib/mjs/components/content/Content.form.js +5 -0
  330. package/lib/mjs/components/currency/Currency.form.d.ts +6 -3
  331. package/lib/mjs/components/currency/Currency.form.js +5 -0
  332. package/lib/mjs/components/currency/Currency.js +1 -2
  333. package/lib/mjs/components/datagrid/DataGrid.d.ts +8 -7
  334. package/lib/mjs/components/datagrid/DataGrid.form.d.ts +6 -3
  335. package/lib/mjs/components/datagrid/DataGrid.form.js +5 -0
  336. package/lib/mjs/components/datagrid/DataGrid.js +5 -5
  337. package/lib/mjs/components/datagrid/fixtures/comp-with-checkboxes.d.ts +29 -0
  338. package/lib/mjs/components/datagrid/fixtures/comp-with-checkboxes.js +34 -0
  339. package/lib/mjs/components/datagrid/fixtures/index.d.ts +2 -1
  340. package/lib/mjs/components/datagrid/fixtures/index.js +2 -1
  341. package/lib/mjs/components/datamap/DataMap.d.ts +1 -0
  342. package/lib/mjs/components/datamap/DataMap.form.d.ts +6 -3
  343. package/lib/mjs/components/datamap/DataMap.form.js +5 -0
  344. package/lib/mjs/components/datetime/DateTime.d.ts +0 -14
  345. package/lib/mjs/components/datetime/DateTime.form.d.ts +6 -3
  346. package/lib/mjs/components/datetime/DateTime.form.js +5 -0
  347. package/lib/mjs/components/datetime/editForm/DateTime.edit.date.js +1 -1
  348. package/lib/mjs/components/day/Day.d.ts +23 -49
  349. package/lib/mjs/components/day/Day.form.d.ts +6 -3
  350. package/lib/mjs/components/day/Day.form.js +5 -0
  351. package/lib/mjs/components/day/Day.js +16 -21
  352. package/lib/mjs/components/day/fixtures/comp7.d.ts +109 -0
  353. package/lib/mjs/components/day/fixtures/comp7.js +107 -0
  354. package/lib/mjs/components/day/fixtures/index.d.ts +2 -1
  355. package/lib/mjs/components/day/fixtures/index.js +2 -1
  356. package/lib/mjs/components/editgrid/EditGrid.d.ts +7 -3
  357. package/lib/mjs/components/editgrid/EditGrid.form.d.ts +6 -3
  358. package/lib/mjs/components/editgrid/EditGrid.form.js +5 -0
  359. package/lib/mjs/components/editgrid/EditGrid.js +3 -3
  360. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
  361. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.templates.js +1 -1
  362. package/lib/mjs/components/email/Email.form.d.ts +6 -3
  363. package/lib/mjs/components/email/Email.form.js +5 -0
  364. package/lib/mjs/components/fieldset/Fieldset.form.d.ts +6 -3
  365. package/lib/mjs/components/fieldset/Fieldset.form.js +5 -0
  366. package/lib/mjs/components/file/File.d.ts +9 -22
  367. package/lib/mjs/components/file/File.form.d.ts +6 -3
  368. package/lib/mjs/components/file/File.form.js +5 -0
  369. package/lib/mjs/components/file/File.js +1 -2
  370. package/lib/mjs/components/form/Form.d.ts +34 -24
  371. package/lib/mjs/components/form/Form.form.d.ts +6 -3
  372. package/lib/mjs/components/form/Form.form.js +5 -0
  373. package/lib/mjs/components/form/Form.js +15 -13
  374. package/lib/mjs/components/hidden/Hidden.d.ts +1 -11
  375. package/lib/mjs/components/hidden/Hidden.form.d.ts +6 -3
  376. package/lib/mjs/components/hidden/Hidden.form.js +5 -0
  377. package/lib/mjs/components/hidden/Hidden.js +1 -2
  378. package/lib/mjs/components/html/HTML.d.ts +2 -1
  379. package/lib/mjs/components/html/HTML.form.d.ts +6 -3
  380. package/lib/mjs/components/html/HTML.form.js +5 -0
  381. package/lib/mjs/components/number/Number.d.ts +3 -17
  382. package/lib/mjs/components/number/Number.form.d.ts +6 -3
  383. package/lib/mjs/components/number/Number.form.js +5 -0
  384. package/lib/mjs/components/number/Number.js +1 -2
  385. package/lib/mjs/components/panel/Panel.form.d.ts +6 -3
  386. package/lib/mjs/components/panel/Panel.form.js +5 -0
  387. package/lib/mjs/components/panel/Panel.js +0 -1
  388. package/lib/mjs/components/password/Password.form.d.ts +6 -3
  389. package/lib/mjs/components/password/Password.form.js +5 -0
  390. package/lib/mjs/components/phonenumber/PhoneNumber.form.d.ts +6 -3
  391. package/lib/mjs/components/phonenumber/PhoneNumber.form.js +5 -0
  392. package/lib/mjs/components/radio/Radio.d.ts +3 -26
  393. package/lib/mjs/components/radio/Radio.form.d.ts +6 -3
  394. package/lib/mjs/components/radio/Radio.form.js +5 -0
  395. package/lib/mjs/components/radio/Radio.js +6 -6
  396. package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +1 -1
  397. package/lib/mjs/components/recaptcha/ReCaptcha.form.d.ts +6 -3
  398. package/lib/mjs/components/recaptcha/ReCaptcha.form.js +5 -0
  399. package/lib/mjs/components/select/Select.d.ts +16 -39
  400. package/lib/mjs/components/select/Select.form.d.ts +6 -3
  401. package/lib/mjs/components/select/Select.form.js +5 -0
  402. package/lib/mjs/components/select/Select.js +14 -17
  403. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +2 -17
  404. package/lib/mjs/components/selectboxes/SelectBoxes.form.d.ts +6 -3
  405. package/lib/mjs/components/selectboxes/SelectBoxes.form.js +5 -0
  406. package/lib/mjs/components/selectboxes/SelectBoxes.js +7 -9
  407. package/lib/mjs/components/signature/Signature.d.ts +0 -14
  408. package/lib/mjs/components/signature/Signature.form.d.ts +6 -3
  409. package/lib/mjs/components/signature/Signature.form.js +5 -0
  410. package/lib/mjs/components/survey/Survey.d.ts +3 -15
  411. package/lib/mjs/components/survey/Survey.form.d.ts +6 -3
  412. package/lib/mjs/components/survey/Survey.form.js +5 -0
  413. package/lib/mjs/components/table/Table.d.ts +2 -1
  414. package/lib/mjs/components/table/Table.form.d.ts +6 -3
  415. package/lib/mjs/components/table/Table.form.js +5 -0
  416. package/lib/mjs/components/tabs/Tabs.d.ts +4 -4
  417. package/lib/mjs/components/tabs/Tabs.form.d.ts +6 -3
  418. package/lib/mjs/components/tabs/Tabs.form.js +5 -0
  419. package/lib/mjs/components/tabs/Tabs.js +1 -2
  420. package/lib/mjs/components/tags/Tags.d.ts +0 -14
  421. package/lib/mjs/components/tags/Tags.form.d.ts +6 -3
  422. package/lib/mjs/components/tags/Tags.form.js +5 -0
  423. package/lib/mjs/components/textarea/TextArea.d.ts +4 -9
  424. package/lib/mjs/components/textarea/TextArea.form.d.ts +6 -3
  425. package/lib/mjs/components/textarea/TextArea.form.js +5 -0
  426. package/lib/mjs/components/textarea/TextArea.js +2 -2
  427. package/lib/mjs/components/textfield/TextField.d.ts +14 -30
  428. package/lib/mjs/components/textfield/TextField.form.d.ts +6 -3
  429. package/lib/mjs/components/textfield/TextField.form.js +5 -0
  430. package/lib/mjs/components/textfield/TextField.js +16 -17
  431. package/lib/mjs/components/time/Time.form.d.ts +6 -3
  432. package/lib/mjs/components/time/Time.form.js +5 -0
  433. package/lib/mjs/components/unknown/Unknown.form.d.ts +5 -34
  434. package/lib/mjs/components/unknown/Unknown.form.js +4 -0
  435. package/lib/mjs/components/url/Url.form.d.ts +6 -3
  436. package/lib/mjs/components/url/Url.form.js +5 -0
  437. package/lib/mjs/components/well/Well.form.d.ts +6 -3
  438. package/lib/mjs/components/well/Well.form.js +5 -0
  439. package/lib/mjs/formio.embed.d.ts +1 -2
  440. package/lib/mjs/formio.embed.js +2 -99
  441. package/lib/mjs/formio.form.d.ts +11 -4
  442. package/lib/mjs/formio.form.js +10 -3
  443. package/lib/mjs/providers/Providers.d.ts +36 -5
  444. package/lib/mjs/providers/Providers.js +29 -0
  445. package/lib/mjs/providers/address/AddressProvider.d.ts +131 -12
  446. package/lib/mjs/providers/address/AddressProvider.js +88 -2
  447. package/lib/mjs/providers/address/AzureAddressProvider.d.ts +48 -1
  448. package/lib/mjs/providers/address/AzureAddressProvider.js +37 -0
  449. package/lib/mjs/providers/address/CustomAddressProvider.d.ts +27 -4
  450. package/lib/mjs/providers/address/CustomAddressProvider.js +34 -0
  451. package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +130 -6
  452. package/lib/mjs/providers/address/GoogleAddressProvider.js +73 -1
  453. package/lib/mjs/providers/address/NominatimAddressProvider.d.ts +32 -7
  454. package/lib/mjs/providers/address/NominatimAddressProvider.js +33 -0
  455. package/lib/mjs/providers/address/index.d.ts +3 -1
  456. package/lib/mjs/providers/processor/fileProcessor.d.ts +7 -1
  457. package/lib/mjs/providers/processor/fileProcessor.js +6 -0
  458. package/lib/mjs/providers/storage/azure.d.ts +6 -13
  459. package/lib/mjs/providers/storage/azure.js +5 -0
  460. package/lib/mjs/providers/storage/base64.d.ts +5 -6
  461. package/lib/mjs/providers/storage/base64.js +4 -0
  462. package/lib/mjs/providers/storage/dropbox.d.ts +6 -4
  463. package/lib/mjs/providers/storage/dropbox.js +5 -0
  464. package/lib/mjs/providers/storage/googleDrive.d.ts +7 -5
  465. package/lib/mjs/providers/storage/googleDrive.js +6 -0
  466. package/lib/mjs/providers/storage/indexeddb.d.ts +5 -7
  467. package/lib/mjs/providers/storage/indexeddb.js +4 -0
  468. package/lib/mjs/providers/storage/s3.d.ts +6 -20
  469. package/lib/mjs/providers/storage/s3.js +5 -0
  470. package/lib/mjs/providers/storage/url.d.ts +6 -7
  471. package/lib/mjs/providers/storage/url.js +10 -0
  472. package/lib/mjs/providers/storage/util.d.ts +24 -1
  473. package/lib/mjs/providers/storage/util.js +18 -0
  474. package/lib/mjs/templates/Templates.d.ts +1 -0
  475. package/lib/mjs/translations/en.d.ts +2 -0
  476. package/lib/mjs/translations/en.js +3 -1
  477. package/lib/mjs/utils/ChoicesWrapper.d.ts +1 -1
  478. package/lib/mjs/utils/ChoicesWrapper.js +13 -2
  479. package/lib/mjs/utils/Evaluator.d.ts +6 -3
  480. package/lib/mjs/utils/Evaluator.js +9 -20
  481. package/lib/mjs/utils/builder.d.ts +9 -7
  482. package/lib/mjs/utils/builder.js +10 -5
  483. package/lib/mjs/utils/calendarUtils.d.ts +7 -13
  484. package/lib/mjs/utils/calendarUtils.js +10 -17
  485. package/lib/mjs/utils/formUtils.d.ts +43 -171
  486. package/lib/mjs/utils/formUtils.js +6 -554
  487. package/lib/mjs/utils/utils.d.ts +367 -221
  488. package/lib/mjs/utils/utils.js +329 -222
  489. package/lib/mjs/widgets/CalendarWidget.d.ts +9 -10
  490. package/lib/mjs/widgets/CalendarWidget.js +9 -11
  491. package/package.json +22 -22
  492. package/sdk.d.ts +1 -0
  493. 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,8 +87,8 @@ export function getElementRect(element) {
133
87
  }
134
88
  /**
135
89
  * Get non HTMLElement property in the window object
136
- * @param {String} property
137
- * @return {any || undefined}
90
+ * @param {string} property - The window property to fetch the script plugin from.
91
+ * @returns {any | undefined} - The HTML Element property on the window object.
138
92
  */
139
93
  export function getScriptPlugin(property) {
140
94
  const obj = window[property];
@@ -146,9 +100,8 @@ export function getScriptPlugin(property) {
146
100
  }
147
101
  /**
148
102
  * Determines the boolean value of a setting.
149
- *
150
- * @param value
151
- * @return {boolean}
103
+ * @param {string|boolean} value - A string or boolean value to convert to boolean.
104
+ * @returns {boolean} - The boolean value of the setting.
152
105
  */
153
106
  export function boolValue(value) {
154
107
  if (_.isBoolean(value)) {
@@ -163,21 +116,17 @@ export function boolValue(value) {
163
116
  }
164
117
  /**
165
118
  * Check to see if an ID is a mongoID.
166
- * @param text
167
- * @return {Array|{index: number, input: string}|Boolean|*}
119
+ * @param {string} text - The text to check if it is a mongoID.
120
+ * @returns {boolean} - TRUE if the text is a mongoID; FALSE otherwise.
168
121
  */
169
122
  export function isMongoId(text) {
170
- return text.toString().match(/^[0-9a-fA-F]{24}$/);
123
+ return !!text.toString().match(/^[0-9a-fA-F]{24}$/);
171
124
  }
172
125
  /**
173
126
  * Checks the calculated value for a provided component and data.
174
- *
175
- * @param {Object} component
176
- * The component to check for the calculated value.
177
- * @param {Object} submission
178
- * A submission object.
179
- * @param data
180
- * The full submission data.
127
+ * @param {import('@formio/core').Component} component - The component to check for the calculated value.
128
+ * @param {import('@formio/core').Submission} submission - A submission object.
129
+ * @param {*} rowData - The contextual row data for the component.
181
130
  */
182
131
  export function checkCalculated(component, submission, rowData) {
183
132
  // Process calculated value stuff if present.
@@ -193,13 +142,12 @@ export function checkCalculated(component, submission, rowData) {
193
142
  }
194
143
  /**
195
144
  * Check if a simple conditional evaluates to true.
196
- *
197
- * @param condition
198
- * @param condition
199
- * @param row
200
- * @param data
201
- * @param instance
202
- * @returns {boolean}
145
+ * @param {import('@formio/core').Component} component - The component to check for the conditional.
146
+ * @param {import('@formio/core').SimpleConditional} condition - The condition to check.
147
+ * @param {*} row - The row data for the component.
148
+ * @param {*} data - The full submission data.
149
+ * @param {import('../../src/components/_classes/component/Component').Component} instance - The instance of the component.
150
+ * @returns {boolean} - TRUE if the condition is true; FALSE otherwise.
203
151
  */
204
152
  export function checkSimpleConditional(component, condition, row, data, instance) {
205
153
  if (condition.when) {
@@ -243,6 +191,13 @@ export function checkSimpleConditional(component, condition, row, data, instance
243
191
  return show ? result : !result;
244
192
  }
245
193
  }
194
+ /**
195
+ * Returns a components normalized value.
196
+ * @param {string} compPath - The full path to the component.
197
+ * @param {*} data - The data object to get the value from.
198
+ * @param {*} row - The contextual row data for the component.
199
+ * @returns {*} - The normalized value of the component.
200
+ */
246
201
  export function getComponentActualValue(compPath, data, row) {
247
202
  let value = null;
248
203
  if (row) {
@@ -259,12 +214,15 @@ export function getComponentActualValue(compPath, data, row) {
259
214
  }
260
215
  /**
261
216
  * Check custom javascript conditional.
262
- *
263
- * @param component
264
- * @param custom
265
- * @param row
266
- * @param data
267
- * @returns {*}
217
+ * @param {import('@formio/core').Component} component - The component to check for the conditional.
218
+ * @param {string} custom - The custom conditional string to evaluate.
219
+ * @param {*} row - The row data for the component.
220
+ * @param {*} data - The full submission data.
221
+ * @param {import('@formio/core').Form} form - The form object.
222
+ * @param {string} variable - The variable name for the result of the custom conditional.
223
+ * @param {*} onError - A custom return if there is an error or the value is null from the evaluation.
224
+ * @param {import('../../src/components/_classes/component/Component').Component} instance - The component instance.
225
+ * @returns {*} - The result of the evaulation.
268
226
  */
269
227
  export function checkCustomConditional(component, custom, row, data, form, variable, onError, instance) {
270
228
  if (typeof custom === 'string') {
@@ -278,6 +236,16 @@ export function checkCustomConditional(component, custom, row, data, form, varia
278
236
  }
279
237
  return value;
280
238
  }
239
+ /**
240
+ * Check a component for JSON conditionals.
241
+ * @param {import('@formio/core').Component} component - The component
242
+ * @param {import('@formio/core').JSONConditional} json - The json conditional to check.
243
+ * @param {*} row - The contextual row data for the component.
244
+ * @param {*} data - The full submission data.
245
+ * @param {import('@formio/core').Form} form - The Form JSON of the form.
246
+ * @param {*} onError - Custom return value if there is an error.
247
+ * @returns {boolean} - TRUE if the condition is true; FALSE otherwise.
248
+ */
281
249
  export function checkJsonConditional(component, json, row, data, form, onError) {
282
250
  try {
283
251
  return jsonLogic.apply(json, {
@@ -292,6 +260,14 @@ export function checkJsonConditional(component, json, row, data, form, onError)
292
260
  return onError;
293
261
  }
294
262
  }
263
+ /**
264
+ * Returns the contextual row data for a component.
265
+ * @param {import('@formio/core').Component} component - The component to get the row data for.
266
+ * @param {*} row - The row data for the component.
267
+ * @param {import('../../src/components/_classes/component/Component').Component} instance - The component instance.
268
+ * @param {*} conditional - The component conditional.
269
+ * @returns {*} - The contextual row data for the component.
270
+ */
295
271
  function getRow(component, row, instance, conditional) {
296
272
  const condition = conditional || component.conditional;
297
273
  // If no component's instance passed (happens only in 6.x server), calculate its path based on the schema
@@ -313,15 +289,12 @@ function getRow(component, row, instance, conditional) {
313
289
  }
314
290
  /**
315
291
  * Checks the conditions for a provided component and data.
316
- *
317
- * @param component
318
- * The component to check for the condition.
319
- * @param row
320
- * The data within a row
321
- * @param data
322
- * The full submission data.
323
- *
324
- * @returns {boolean}
292
+ * @param {import('@formio/core').Component} component - The component to check for the condition.
293
+ * @param {*} row - The data within a row
294
+ * @param {*} data - The full submission data.
295
+ * @param {import('@formio/core').Form} form - The form object.
296
+ * @param {import('../../src/components/_classes/component/Component').Component} instance - The component instance.
297
+ * @returns {boolean} - TRUE if the condition is true; FALSE otherwise.
325
298
  */
326
299
  export function checkCondition(component, row, data, form, instance) {
327
300
  const { customConditional, conditional } = component;
@@ -340,12 +313,13 @@ export function checkCondition(component, row, data, form, instance) {
340
313
  }
341
314
  /**
342
315
  * Test a trigger on a component.
343
- *
344
- * @param component
345
- * @param action
346
- * @param data
347
- * @param row
348
- * @returns {mixed}
316
+ * @param {import('@formio/core').Component} component - The component to test the trigger against.
317
+ * @param {import('@formio/core').LogicTrigger} trigger - The trigger configuration.
318
+ * @param {import('@formio/core').DataObject} row - The contextual row data.
319
+ * @param {import('@formio/core').DataObject} data - The root data object.
320
+ * @param {import('@formio/core').Form} form - The form object.
321
+ * @param {any} instance - The component that is performing the trigger.
322
+ * @returns {boolean} - TRUE if the trigger should fire; FALSE otherwise.
349
323
  */
350
324
  export function checkTrigger(component, trigger, row, data, form, instance) {
351
325
  // If trigger is empty, don't fire it
@@ -364,6 +338,16 @@ export function checkTrigger(component, trigger, row, data, form, instance) {
364
338
  // If none of the types matched, don't fire the trigger.
365
339
  return false;
366
340
  }
341
+ /**
342
+ * Sets a property on a component via an executed Logic action.
343
+ * @param {import('@formio/core').Component} component - The component to set the property on.
344
+ * @param {import('@formio/core').LogicAction} action - The action to perform on the component.
345
+ * @param {string} result - The name of the variable in the evaulation to use as the result.
346
+ * @param {import('@formio/core').DataObject} row - The contextual row data.
347
+ * @param {import('@formio/core').DataObject} data - The full submission data.
348
+ * @param {any} instance - The component instance.
349
+ * @returns {import('@formio/core').Component} - The modified component.
350
+ */
367
351
  export function setActionProperty(component, action, result, row, data, instance) {
368
352
  const property = action.property.value;
369
353
  switch (action.property.type) {
@@ -397,8 +381,8 @@ export function setActionProperty(component, action, result, row, data, instance
397
381
  }
398
382
  /**
399
383
  * Removes HTML tags from string e.g. <div>Hello World</div> => Hello World
400
- * @param {string} str
401
- * @returns {string}
384
+ * @param {string} str - The string to remove HTML tags from.
385
+ * @returns {string} - The string without HTML tags.
402
386
  */
403
387
  export function removeHTML(str) {
404
388
  const doc = new window.DOMParser().parseFromString(str, 'text/html');
@@ -406,8 +390,8 @@ export function removeHTML(str) {
406
390
  }
407
391
  /**
408
392
  * Unescape HTML characters like &lt, &gt, &amp and etc.
409
- * @param str
410
- * @returns {string}
393
+ * @param {string} str - The string to unescape.
394
+ * @returns {string} - The unescaped string.
411
395
  */
412
396
  export function unescapeHTML(str) {
413
397
  if (typeof window === 'undefined' || !('DOMParser' in window)) {
@@ -419,9 +403,9 @@ export function unescapeHTML(str) {
419
403
  }
420
404
  /**
421
405
  * Make HTML element from string
422
- * @param str
423
- * @param selector
424
- * @returns {HTMLElement}
406
+ * @param {string} str - The string to convert to an HTML element.
407
+ * @param {string} selector - The selector to use to get the element once it is created.
408
+ * @returns {HTMLElement} - The HTML element that was created.
425
409
  */
426
410
  export function convertStringToHTMLElement(str, selector) {
427
411
  const doc = new window.DOMParser().parseFromString(str, 'text/html');
@@ -429,10 +413,10 @@ export function convertStringToHTMLElement(str, selector) {
429
413
  }
430
414
  /**
431
415
  * Make a filename guaranteed to be unique.
432
- * @param name
433
- * @param template
434
- * @param evalContext
435
- * @returns {string}
416
+ * @param {string} name - The original name of the file.
417
+ * @param {string} template - The template to use for the unique name.
418
+ * @param {object} evalContext - The context to use for the evaluation.
419
+ * @returns {string} - A unique filename.
436
420
  */
437
421
  export function uniqueName(name, template, evalContext) {
438
422
  template = template || '{{fileName}}-{{guid}}';
@@ -455,6 +439,10 @@ export function uniqueName(name, template, evalContext) {
455
439
  const uniqueName = `${Evaluator.interpolate(template, evalContext)}${extension}`.replace(/[^0-9a-zA-Z.\-_ ]/g, '-');
456
440
  return uniqueName;
457
441
  }
442
+ /**
443
+ * Returns a GUID
444
+ * @returns {string} - A GUID.
445
+ */
458
446
  export function guid() {
459
447
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
460
448
  const r = Math.random() * 16 | 0;
@@ -466,9 +454,8 @@ export function guid() {
466
454
  }
467
455
  /**
468
456
  * Return a translated date setting.
469
- *
470
- * @param date
471
- * @return {(null|Date)}
457
+ * @param {string|Date} date - The date to translate.
458
+ * @returns {(null|Date)} - The translated date.
472
459
  */
473
460
  export function getDateSetting(date) {
474
461
  if (_.isNil(date) || _.isNaN(date) || date === '') {
@@ -509,13 +496,17 @@ export function getDateSetting(date) {
509
496
  }
510
497
  return dateSetting.toDate();
511
498
  }
499
+ /**
500
+ * Returns true if the date is a valid date. False otherwise.
501
+ * @param {Date|string} date - The date to check for validity.
502
+ * @returns {boolean} - TRUE if the date is valid; FALSE otherwise.
503
+ */
512
504
  export function isValidDate(date) {
513
505
  return _.isDate(date) && !_.isNaN(date.getDate());
514
506
  }
515
507
  /**
516
508
  * Get the current timezone string.
517
- *
518
- * @return {string}
509
+ * @returns {string} - The current timezone.
519
510
  */
520
511
  export function currentTimezone() {
521
512
  if (moment.currentTimezone) {
@@ -526,10 +517,9 @@ export function currentTimezone() {
526
517
  }
527
518
  /**
528
519
  * Get an offset date provided a date object and timezone object.
529
- *
530
- * @param date
531
- * @param timezone
532
- * @return {Date}
520
+ * @param {Date} date - The date to offset.
521
+ * @param {string} timezone - The timezone to offset the date to.
522
+ * @returns {Date} - The offset date.
533
523
  */
534
524
  export function offsetDate(date, timezone) {
535
525
  if (timezone === 'UTC') {
@@ -546,17 +536,15 @@ export function offsetDate(date, timezone) {
546
536
  }
547
537
  /**
548
538
  * Returns if the zones are loaded.
549
- *
550
- * @return {boolean}
539
+ * @returns {boolean} - TRUE if the zones are loaded; FALSE otherwise.
551
540
  */
552
541
  export function zonesLoaded() {
553
542
  return moment.zonesLoaded;
554
543
  }
555
544
  /**
556
545
  * Returns if we should load the zones.
557
- *
558
- * @param timezone
559
- * @return {boolean}
546
+ * @param {string} timezone - The timezone to check if we should load the zones.
547
+ * @returns {boolean} - TRUE if we should load the zones; FALSE otherwise.
560
548
  */
561
549
  export function shouldLoadZones(timezone) {
562
550
  if (timezone === currentTimezone() || timezone === 'UTC') {
@@ -566,8 +554,9 @@ export function shouldLoadZones(timezone) {
566
554
  }
567
555
  /**
568
556
  * Externally load the timezone data.
569
- *
570
- * @return {Promise<any> | *}
557
+ * @param {string} url - The URL to load the timezone data from.
558
+ * @param {string} timezone - The timezone to load.
559
+ * @returns {Promise<any> | *} - Resolves when the zones for this timezone are loaded.
571
560
  */
572
561
  export function loadZones(url, timezone) {
573
562
  if (timezone && !shouldLoadZones(timezone)) {
@@ -591,11 +580,10 @@ export function loadZones(url, timezone) {
591
580
  }
592
581
  /**
593
582
  * Get the moment date object for translating dates with timezones.
594
- *
595
- * @param value
596
- * @param format
597
- * @param timezone
598
- * @return {*}
583
+ * @param {string|Date} value - The value to convert into a moment date.
584
+ * @param {string} format - The format to convert the date to.
585
+ * @param {string} timezone - The timezone to convert the date to.
586
+ * @returns {Date} - The moment date object.
599
587
  */
600
588
  export function momentDate(value, format, timezone) {
601
589
  const momentDate = moment(value);
@@ -612,11 +600,12 @@ export function momentDate(value, format, timezone) {
612
600
  }
613
601
  /**
614
602
  * Format a date provided a value, format, and timezone object.
615
- *
616
- * @param value
617
- * @param format
618
- * @param timezone
619
- * @return {string}
603
+ * @param {string} timezonesUrl - The URL to load the timezone data from.
604
+ * @param {string|Date} value - The value to format.
605
+ * @param {string} format - The format to format the date to.
606
+ * @param {string} timezone - The timezone to format the date to.
607
+ * @param {string} flatPickrInputFormat - The format to use for flatpickr input.
608
+ * @returns {string} - The formatted date.
620
609
  */
621
610
  export function formatDate(timezonesUrl, value, format, timezone, flatPickrInputFormat) {
622
611
  const momentDate = moment(value, flatPickrInputFormat || undefined);
@@ -649,12 +638,12 @@ export function formatDate(timezonesUrl, value, format, timezone, flatPickrInput
649
638
  }
650
639
  /**
651
640
  * Pass a format function to format within a timezone.
652
- *
653
- * @param formatFn
654
- * @param date
655
- * @param format
656
- * @param timezone
657
- * @return {string}
641
+ * @param {string} timezonesUrl - The URL to load the timezone data from.
642
+ * @param {Function} formatFn - The format function to use.
643
+ * @param {Date|string} date - The date to format.
644
+ * @param {string} format - The format to format the date to.
645
+ * @param {string} timezone - The timezone to format the date to.
646
+ * @returns {string} - The formatted date.
658
647
  */
659
648
  export function formatOffset(timezonesUrl, formatFn, date, format, timezone) {
660
649
  if (timezone === currentTimezone()) {
@@ -673,6 +662,11 @@ export function formatOffset(timezonesUrl, formatFn, date, format, timezone) {
673
662
  return formatFn(date, format);
674
663
  }
675
664
  }
665
+ /**
666
+ * Returns the local date format information.
667
+ * @param {Intl.LocalesArgument} locale - The locale to get the date format for.
668
+ * @returns {object} - The local date format information.
669
+ */
676
670
  export function getLocaleDateFormatInfo(locale) {
677
671
  const formatInfo = {};
678
672
  const day = 21;
@@ -683,8 +677,8 @@ export function getLocaleDateFormatInfo(locale) {
683
677
  }
684
678
  /**
685
679
  * Convert the format from the angular-datepicker module to flatpickr format.
686
- * @param format
687
- * @return {string}
680
+ * @param {string} format - The format to convert.
681
+ * @returns {string} - The converted format.
688
682
  */
689
683
  export function convertFormatToFlatpickr(format) {
690
684
  return format
@@ -714,8 +708,8 @@ export function convertFormatToFlatpickr(format) {
714
708
  }
715
709
  /**
716
710
  * Convert the format from the angular-datepicker module to moment format.
717
- * @param format
718
- * @return {string}
711
+ * @param {string} format - The format to convert.
712
+ * @returns {string} - The converted format.
719
713
  */
720
714
  export function convertFormatToMoment(format) {
721
715
  return format
@@ -730,6 +724,11 @@ export function convertFormatToMoment(format) {
730
724
  // Unix Timestamp
731
725
  .replace(/U/g, 'X');
732
726
  }
727
+ /**
728
+ * Convert the format from the angular-datepicker module to mask format.
729
+ * @param {string} format - The format to convert.
730
+ * @returns {string} - The converted format.
731
+ */
733
732
  export function convertFormatToMask(format) {
734
733
  return format
735
734
  // Long month replacement.
@@ -787,6 +786,13 @@ export function getInputMask(mask, placeholderChar) {
787
786
  }
788
787
  return maskArray;
789
788
  }
789
+ /**
790
+ * Unmasks a value using the provided mask and placeholder characters.
791
+ * @param {string} value - The value to unmask.
792
+ * @param {string} mask - The mask to use for unmasking.
793
+ * @param {string} placeholderChar - The placeholder character to use for unmasking.
794
+ * @returns {string} - The unmasked value.
795
+ */
790
796
  export function unmaskValue(value, mask, placeholderChar) {
791
797
  if (!mask || !value || value.length > mask.length) {
792
798
  return value;
@@ -802,6 +808,12 @@ export function unmaskValue(value, mask, placeholderChar) {
802
808
  unmaskedValue = unmaskedValue.join('').replace(placeholderChar, '');
803
809
  return unmaskedValue;
804
810
  }
811
+ /**
812
+ * Returns true if the value matches the input mask format.
813
+ * @param {string} value - The value to check.
814
+ * @param {string} inputMask - The input mask to check against.
815
+ * @returns {boolean} - TRUE if the value matches the input mask; FALSE otherwise.
816
+ */
805
817
  export function matchInputMask(value, inputMask) {
806
818
  if (!inputMask) {
807
819
  return true;
@@ -819,6 +831,11 @@ export function matchInputMask(value, inputMask) {
819
831
  }
820
832
  return true;
821
833
  }
834
+ /**
835
+ * Returns the number separators (i.e. 1,000) for the provided language.
836
+ * @param {string} lang - The language code to get the number separators for.
837
+ * @returns {{delimiter: string, decimalSeparator: string}} - The number separators.
838
+ */
822
839
  export function getNumberSeparators(lang = 'en') {
823
840
  const formattedNumberString = (12345.6789).toLocaleString(lang);
824
841
  const delimeters = formattedNumberString.match(/..(.)...(.)../);
@@ -833,6 +850,12 @@ export function getNumberSeparators(lang = 'en') {
833
850
  decimalSeparator: (delimeters.length > 2) ? delimeters[2] : '.',
834
851
  };
835
852
  }
853
+ /**
854
+ * Returns the number for the maximum amount of decimal places for a number.
855
+ * @param {import('@formio/core').Component} component - The component to check for decimal limits.
856
+ * @param {number} defaultLimit - The default limit to use if none is provided in the component.
857
+ * @returns {number} - The number of decimal places allowed.
858
+ */
836
859
  export function getNumberDecimalLimit(component, defaultLimit) {
837
860
  if (_.has(component, 'decimalLimit')) {
838
861
  return _.get(component, 'decimalLimit');
@@ -848,6 +871,15 @@ export function getNumberDecimalLimit(component, defaultLimit) {
848
871
  }
849
872
  return decimalLimit;
850
873
  }
874
+ /**
875
+ * Returns the currency affixes for a specific language.
876
+ * @param {object} arg0 - The arguments object.
877
+ * @param {string} arg0.currency - The currency code to get the affixes for.
878
+ * @param {number} arg0.decimalLimit - The number of decimal places to use.
879
+ * @param {string} arg0.decimalSeparator - The decimal separator to use.
880
+ * @param {string} arg0.lang - The language code to use.
881
+ * @returns {{prefix: string, suffix: string}} - The currency affixes.
882
+ */
851
883
  export function getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, lang, }) {
852
884
  // Get the prefix and suffix from the localized string.
853
885
  let regex = `(.*)?${(100).toLocaleString(lang)}`;
@@ -869,10 +901,9 @@ export function getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, l
869
901
  }
870
902
  /**
871
903
  * Fetch the field data provided a component.
872
- *
873
- * @param data
874
- * @param component
875
- * @return {*}
904
+ * @param {import('@formio/core').DataObject} data - The data object to fetch the field data from.
905
+ * @param {import('@formio/core').Component} component - The component to fetch the field data for.
906
+ * @returns {*} - The field data.
876
907
  */
877
908
  export function fieldData(data, component) {
878
909
  if (!data) {
@@ -918,16 +949,23 @@ export function fieldData(data, component) {
918
949
  }
919
950
  /**
920
951
  * Delays function execution with possibility to execute function synchronously or cancel it.
921
- *
922
- * @param fn Function to delay
923
- * @param delay Delay time
924
- * @return {*}
952
+ * @param {Function} fn - Function to delay
953
+ * @param {number} delay - Delay time
954
+ * @param {...any} args - Arguments to pass to the function
955
+ * @returns {*} - Function to cancel the delay
925
956
  */
926
957
  export function delay(fn, delay = 0, ...args) {
927
958
  const timer = setTimeout(fn, delay, ...args);
959
+ /**
960
+ *
961
+ */
928
962
  function cancel() {
929
963
  clearTimeout(timer);
930
964
  }
965
+ /**
966
+ * Execute the function early.
967
+ * @returns {*} - The result of the function.
968
+ */
931
969
  function earlyCall() {
932
970
  cancel();
933
971
  return fn(...args);
@@ -938,11 +976,9 @@ export function delay(fn, delay = 0, ...args) {
938
976
  }
939
977
  /**
940
978
  * Iterate the given key to make it unique.
941
- *
942
- * @param {String} key
979
+ * @param {string} key
943
980
  * Modify the component key to be unique.
944
- *
945
- * @returns {String}
981
+ * @returns {string}
946
982
  * The new component key.
947
983
  */
948
984
  export function iterateKey(key) {
@@ -955,10 +991,9 @@ export function iterateKey(key) {
955
991
  }
956
992
  /**
957
993
  * Determines a unique key within a map provided the base key.
958
- *
959
- * @param map
960
- * @param base
961
- * @return {*}
994
+ * @param {Record<string, string>} map - The map to check for uniqueness.
995
+ * @param {string} base - The base path of the key.
996
+ * @returns {string} - The unique key.
962
997
  */
963
998
  export function uniqueKey(map, base) {
964
999
  let newKey = base;
@@ -969,8 +1004,9 @@ export function uniqueKey(map, base) {
969
1004
  }
970
1005
  /**
971
1006
  * Determines the major version number of bootstrap.
972
- *
973
- * @return {number}
1007
+ * @param {object} options - The options to check for bootstrap version.
1008
+ * @param {string} options.bootstrap - The bootstrap version to use.
1009
+ * @returns {number} - The bootstrap version.
974
1010
  */
975
1011
  export function bootstrapVersion(options) {
976
1012
  if (options.bootstrap) {
@@ -987,9 +1023,8 @@ export function bootstrapVersion(options) {
987
1023
  /**
988
1024
  * Retrun provided argument.
989
1025
  * If argument is a function, returns the result of a function call.
990
- * @param {*} e;
991
- *
992
- * @return {*}
1026
+ * @param {Function|any} e - The argument to check if a function and call if so.
1027
+ * @returns {any} - Either the result of the function call (e) or e if it is not a function.
993
1028
  */
994
1029
  export function unfold(e) {
995
1030
  if (typeof e === 'function') {
@@ -999,27 +1034,32 @@ export function unfold(e) {
999
1034
  }
1000
1035
  /**
1001
1036
  * Map values through unfold and return first non-nil value.
1002
- * @param {Array<T>} collection;
1003
- *
1004
- * @return {T}
1037
+ * @param {Array<T>} collection - The collection to map through unfold.;
1038
+ * @returns {T} - The first non-nil value.
1005
1039
  */
1006
1040
  export const firstNonNil = _.flow([
1007
1041
  _.partialRight(_.map, unfold),
1008
1042
  _.partialRight(_.find, v => !_.isUndefined(v))
1009
1043
  ]);
1010
- /*
1011
- * Create enclosed state.
1012
- * Returns functions to getting and cycling between states.
1044
+ /**
1045
+ * Create enclosed state. Returns functions to getting and cycling between states.
1013
1046
  * @param {*} a - initial state.
1014
1047
  * @param {*} b - next state.
1015
- * @return {Functions[]} -- [get, toggle];
1048
+ * @returns {Functions[]} -- [get, toggle];
1016
1049
  */
1017
1050
  export function withSwitch(a, b) {
1018
1051
  let state = a;
1019
1052
  let next = b;
1053
+ /**
1054
+ * Returns the state of the switch.
1055
+ * @returns {*} - The current state.
1056
+ */
1020
1057
  function get() {
1021
1058
  return state;
1022
1059
  }
1060
+ /**
1061
+ * Toggles the state of the switch.
1062
+ */
1023
1063
  function toggle() {
1024
1064
  const prev = state;
1025
1065
  state = next;
@@ -1027,6 +1067,14 @@ export function withSwitch(a, b) {
1027
1067
  }
1028
1068
  return [get, toggle];
1029
1069
  }
1070
+ /**
1071
+ * Create a function that will call the provided function only the provided limit.
1072
+ * @param {Function} callback - The callback to call.
1073
+ * @param {object} options - The options to use.
1074
+ * @param {number} options.limit - The limit to call the callback.
1075
+ * @param {number} options.delay - The delay to wait before resetting the call count.
1076
+ * @returns {Function} - The function that will call the callback only the provided limit.
1077
+ */
1030
1078
  export function observeOverload(callback, options = {}) {
1031
1079
  const { limit = 50, delay = 500 } = options;
1032
1080
  let callCount = 0;
@@ -1046,6 +1094,13 @@ export function observeOverload(callback, options = {}) {
1046
1094
  }
1047
1095
  };
1048
1096
  }
1097
+ /**
1098
+ * Returns the components that are provided within an evaluation context.
1099
+ * @param {any} context - The evaluation context to get the components from.
1100
+ * @param {boolean} excludeNested - Exclude nested components.
1101
+ * @param {Array<string>} excludedTypes - The types of components to exclude.
1102
+ * @returns {Array} - The components within the evaluation context.
1103
+ */
1049
1104
  export function getContextComponents(context, excludeNested, excludedTypes = []) {
1050
1105
  const values = [];
1051
1106
  context.utils.eachComponent(context.instance.options.editForm.components, (component, path) => {
@@ -1059,6 +1114,11 @@ export function getContextComponents(context, excludeNested, excludedTypes = [])
1059
1114
  });
1060
1115
  return values;
1061
1116
  }
1117
+ /**
1118
+ * Returns the button components that are within an evaluation context.
1119
+ * @param {any} context - The evaluation context to get the components from.
1120
+ * @returns {Array} - The button components within the evaluation context.
1121
+ */
1062
1122
  export function getContextButtons(context) {
1063
1123
  const values = [];
1064
1124
  context.utils.eachComponent(context.instance.options.editForm.components, (component) => {
@@ -1075,12 +1135,9 @@ export function getContextButtons(context) {
1075
1135
  const inTextTags = ['#text', 'A', 'B', 'EM', 'I', 'SMALL', 'STRONG', 'SUB', 'SUP', 'INS', 'DEL', 'MARK', 'CODE'];
1076
1136
  /**
1077
1137
  * Helper function for 'translateHTMLTemplate'. Translates text value of the passed html element.
1078
- *
1079
- * @param {HTMLElement} elem
1080
- * @param {Function} translate
1081
- *
1082
- * @returns {String}
1083
- * Translated element template.
1138
+ * @param {HTMLElement} elem - The element to translate.
1139
+ * @param {Function} translate - The translation function.
1140
+ * @returns {string} - Translated element template.
1084
1141
  */
1085
1142
  function translateElemValue(elem, translate) {
1086
1143
  if (!elem.innerText) {
@@ -1111,10 +1168,8 @@ function translateElemValue(elem, translate) {
1111
1168
  }
1112
1169
  /**
1113
1170
  * Helper function for 'translateHTMLTemplate'. Goes deep through html tag children and calls function to translate their text values.
1114
- *
1115
- * @param {HTMLElement} tag
1116
- * @param {Function} translate
1117
- *
1171
+ * @param {HTMLElement} tag - The tag to translate.
1172
+ * @param {Function} translate - The translation function.
1118
1173
  * @returns {void}
1119
1174
  */
1120
1175
  function translateDeepTag(tag, translate) {
@@ -1130,12 +1185,9 @@ function translateDeepTag(tag, translate) {
1130
1185
  }
1131
1186
  /**
1132
1187
  * Translates text values in html template.
1133
- *
1134
- * @param {String} template
1135
- * @param {Function} translate
1136
- *
1137
- * @returns {String}
1138
- * Html template with translated values.
1188
+ * @param {string} template - The template to translate.
1189
+ * @param {Function} translate - The translation function.
1190
+ * @returns {string} - Html template with translated values.
1139
1191
  */
1140
1192
  export function translateHTMLTemplate(template, translate) {
1141
1193
  const isHTML = /<[^>]*>/.test(template);
@@ -1152,9 +1204,9 @@ export function translateHTMLTemplate(template, translate) {
1152
1204
  }
1153
1205
  /**
1154
1206
  * Sanitize an html string.
1155
- *
1156
- * @param string
1157
- * @returns {*}
1207
+ * @param {string} string - The string to sanitize.
1208
+ * @param {any} options - The options to use for sanitization.
1209
+ * @returns {string} - The sanitized html string.
1158
1210
  */
1159
1211
  export function sanitize(string, options) {
1160
1212
  if (typeof dompurify.sanitize !== 'function') {
@@ -1202,11 +1254,18 @@ export function sanitize(string, options) {
1202
1254
  }
1203
1255
  /**
1204
1256
  * Fast cloneDeep for JSON objects only.
1257
+ * @param {any} obj - The object to perform a fast clone deep against.
1258
+ * @returns {any} - The cloned object.
1205
1259
  */
1206
1260
  export function fastCloneDeep(obj) {
1207
1261
  return obj ? JSON.parse(JSON.stringify(obj)) : obj;
1208
1262
  }
1209
1263
  export { Evaluator, interpolate };
1264
+ /**
1265
+ * Returns if the component is an input component.
1266
+ * @param {import('@formio/core').Component} componentJson - The JSON of a component.
1267
+ * @returns {bool} - TRUE if the component is an input component; FALSE otherwise.
1268
+ */
1210
1269
  export function isInputComponent(componentJson) {
1211
1270
  if (componentJson.input === false || componentJson.input === true) {
1212
1271
  return componentJson.input;
@@ -1226,6 +1285,11 @@ export function isInputComponent(componentJson) {
1226
1285
  return true;
1227
1286
  }
1228
1287
  }
1288
+ /**
1289
+ * Takes a component path, and returns a component path array.
1290
+ * @param {string} pathStr - The path string to convert to an array.
1291
+ * @returns {Arryay<number>} - The array of paths.
1292
+ */
1229
1293
  export function getArrayFromComponentPath(pathStr) {
1230
1294
  if (!pathStr || !_.isString(pathStr)) {
1231
1295
  if (!_.isArray(pathStr)) {
@@ -1239,6 +1303,12 @@ export function getArrayFromComponentPath(pathStr) {
1239
1303
  .split('.')
1240
1304
  .map(part => _.defaultTo(_.toNumber(part), part));
1241
1305
  }
1306
+ /**
1307
+ * Returns true if the component is a child of the parent.
1308
+ * @param {any} child - The child component to check.
1309
+ * @param {any} parent - The parent component to check.
1310
+ * @returns {boolean} - TRUE if the child is a child of the parent; FALSE otherwise.
1311
+ */
1242
1312
  export function isChildOf(child, parent) {
1243
1313
  while (child && child.parent) {
1244
1314
  if (child.parent === parent) {
@@ -1248,6 +1318,11 @@ export function isChildOf(child, parent) {
1248
1318
  }
1249
1319
  return false;
1250
1320
  }
1321
+ /**
1322
+ * Takes an array of component path indexes, and returns a string version of that array.
1323
+ * @param {Array<number>} path - The path array to convert to a string.
1324
+ * @returns {string} - The string version of the path.
1325
+ */
1251
1326
  export function getStringFromComponentPath(path) {
1252
1327
  if (!_.isArray(path)) {
1253
1328
  return path;
@@ -1263,16 +1338,21 @@ export function getStringFromComponentPath(path) {
1263
1338
  });
1264
1339
  return strPath;
1265
1340
  }
1341
+ /**
1342
+ * Takes a number and rounds it to the provided precision amount.
1343
+ * @param {number} number - The number to round.
1344
+ * @param {number} precision - The precision to round the number to.
1345
+ * @returns {string} - The rounded number.
1346
+ */
1266
1347
  export function round(number, precision) {
1267
1348
  if (_.isNumber(number)) {
1268
1349
  return number.toFixed(precision);
1269
1350
  }
1270
- return number;
1351
+ return number.toString();
1271
1352
  }
1272
1353
  /**
1273
1354
  * Check for Internet Explorer browser version
1274
- *
1275
- * @return {(number|null)}
1355
+ * @returns {(number|null)} - The IE browser version or null if not IE
1276
1356
  */
1277
1357
  export function getIEBrowserVersion() {
1278
1358
  const { ie, version } = getBrowserInfo();
@@ -1280,8 +1360,7 @@ export function getIEBrowserVersion() {
1280
1360
  }
1281
1361
  /**
1282
1362
  * Get browser name and version (modified from 'jquery-browser-plugin')
1283
- *
1284
- * @return {Object} -- {{browser name, version, isWebkit?}}
1363
+ * @returns {object} -- {{browser name, version, isWebkit?}}
1285
1364
  * Possible browser names: chrome, safari, ie, edge, opera, mozilla, yabrowser
1286
1365
  */
1287
1366
  export function getBrowserInfo() {
@@ -1329,12 +1408,19 @@ export function getBrowserInfo() {
1329
1408
  }
1330
1409
  return browser;
1331
1410
  }
1411
+ /**
1412
+ * Takes a component path, which may include array indicies (i.e. [0][1]), and returns the compoennt path without the indicies.
1413
+ * @param {string} path - The path to remove the indicies from.
1414
+ * @returns {string} - The path without the indicies.
1415
+ */
1332
1416
  export function getComponentPathWithoutIndicies(path = '') {
1333
1417
  return path.replace(/\[\d+\]/, '');
1334
1418
  }
1335
1419
  /**
1336
1420
  * Returns a path to the component which based on its schema
1337
- * @param {*} component is a component's schema containing link to its parent's schema in the 'parent' property
1421
+ * @param {import('@formio/core').Component} component - Component containing link to its parent's schema in the 'parent' property
1422
+ * @param {string} path - Path to the component
1423
+ * @returns {string} - Path to the component
1338
1424
  */
1339
1425
  export function getComponentPath(component, path = '') {
1340
1426
  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
@@ -1345,8 +1431,8 @@ export function getComponentPath(component, path = '') {
1345
1431
  }
1346
1432
  /**
1347
1433
  * Returns a parent component of the passed component instance skipping all the Layout components
1348
- * @param {*} componentInstance
1349
- * @return {(Component|undefined)}
1434
+ * @param {Component} componentInstance - The component to check for the parent.
1435
+ * @returns {Component|undefined} - The parent data component.
1350
1436
  */
1351
1437
  export function getDataParentComponent(componentInstance) {
1352
1438
  if (!componentInstance) {
@@ -1362,8 +1448,8 @@ export function getDataParentComponent(componentInstance) {
1362
1448
  }
1363
1449
  /**
1364
1450
  * Returns whether the value is a promise
1365
- * @param value
1366
- * @return {boolean}
1451
+ * @param {any} value - The value to check
1452
+ * @returns {boolean} - TRUE if the value is a promise; FALSE otherwise
1367
1453
  */
1368
1454
  export function isPromise(value) {
1369
1455
  return value
@@ -1374,9 +1460,9 @@ export function isPromise(value) {
1374
1460
  /**
1375
1461
  * Determines if the component has a scoping parent in tree (a component which scopes its children and manages its
1376
1462
  * changes by itself, e.g. EditGrid)
1377
- * @param componentInstance
1378
- * @param firstPass
1379
- * @returns {boolean|boolean|*}
1463
+ * @param {Component} componentInstance - The component to check for the scoping parent.
1464
+ * @param {boolean} firstPass - Whether it is the first pass of the function
1465
+ * @returns {boolean|*} - TRUE if the component has a scoping parent; FALSE otherwise
1380
1466
  */
1381
1467
  export function isInsideScopingComponent(componentInstance, firstPass = true) {
1382
1468
  if (!firstPass && componentInstance?.hasScopedChildren) {
@@ -1391,6 +1477,11 @@ export function isInsideScopingComponent(componentInstance, firstPass = true) {
1391
1477
  }
1392
1478
  return false;
1393
1479
  }
1480
+ /**
1481
+ * Returns all the focusable elements within the provided dom element.
1482
+ * @param {HTMLElement} element - The element to get the focusable elements from.
1483
+ * @returns {NodeList<HTMLElement>} - The focusable elements within the provided element.
1484
+ */
1394
1485
  export function getFocusableElements(element) {
1395
1486
  const focusableSelector = `button:not([disabled]), input:not([disabled]), select:not([disabled]),
1396
1487
  textarea:not([disabled]), button:not([disabled]), [href]`;
@@ -1407,6 +1498,11 @@ export const componentValueTypes = {
1407
1498
  date: 'date',
1408
1499
  any: 'any',
1409
1500
  };
1501
+ /**
1502
+ * Returns the saved types for the component
1503
+ * @param {import('@formio/core').Component} fullSchema - The component schema
1504
+ * @returns {Array<string>|null} - The saved types for the component
1505
+ */
1410
1506
  export function getComponentSavedTypes(fullSchema) {
1411
1507
  const schema = fullSchema || {};
1412
1508
  if (schema.persistent !== true) {
@@ -1419,9 +1515,10 @@ export function getComponentSavedTypes(fullSchema) {
1419
1515
  }
1420
1516
  /**
1421
1517
  * Interpolates @formio/core errors so that they are compatible with the renderer
1422
- * @param {FieldError[]} errors
1423
- * @param firstPass
1424
- * @returns {[]}
1518
+ * @param {Component} component - The component to interpolate the errors for
1519
+ * @param {FieldError[]} errors - The errors to interpolate
1520
+ * @param {Function} interpolateFn - The interpolation function
1521
+ * @returns {[]} - The interpolated errors
1425
1522
  */
1426
1523
  export const interpolateErrors = (component, errors, interpolateFn) => {
1427
1524
  return errors.map((error) => {
@@ -1431,6 +1528,11 @@ export const interpolateErrors = (component, errors, interpolateFn) => {
1431
1528
  return { ...error, message: unescapeHTML(interpolateFn(toInterpolate, context)), context: { ...context } };
1432
1529
  });
1433
1530
  };
1531
+ /**
1532
+ * Returns the template keys inside the template code.
1533
+ * @param {string} template - The template to get the keys from.
1534
+ * @returns {Array<string>} - The keys inside the template.
1535
+ */
1434
1536
  export function getItemTemplateKeys(template) {
1435
1537
  const templateKeys = [];
1436
1538
  if (!template) {
@@ -1447,6 +1549,11 @@ export function getItemTemplateKeys(template) {
1447
1549
  }
1448
1550
  return templateKeys;
1449
1551
  }
1552
+ /**
1553
+ * Returns if the component is a select resource with an object for its value.
1554
+ * @param {import('@formio/core').Component} comp - The component to check.
1555
+ * @returns {boolean} - TRUE if the component is a select resource with an object for its value; FALSE otherwise.
1556
+ */
1450
1557
  export function isSelectResourceWithObjectValue(comp = {}) {
1451
1558
  const { reference, dataSrc, valueProperty } = comp;
1452
1559
  return reference || (dataSrc === 'resource' && (!valueProperty || valueProperty === 'data'));