@formio/js 5.0.0-dev.5643.9c5173a → 5.0.0-dev.5646.35daa65

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