@formio/js 5.0.0-dev.5613.3476921 → 5.0.0-dev.5614.b5c93f3

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