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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (493) hide show
  1. package/Changelog.md +47 -2
  2. package/dist/formio.builder.css +8 -8
  3. package/dist/formio.builder.min.css +1 -1
  4. package/dist/formio.embed.js +1 -1
  5. package/dist/formio.embed.min.js +1 -1
  6. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  7. package/dist/formio.form.css +8 -8
  8. package/dist/formio.form.js +615 -1196
  9. package/dist/formio.form.min.css +1 -1
  10. package/dist/formio.form.min.js +1 -1
  11. package/dist/formio.form.min.js.LICENSE.txt +3 -5
  12. package/dist/formio.full.css +8 -8
  13. package/dist/formio.full.js +659 -920
  14. package/dist/formio.full.min.css +1 -1
  15. package/dist/formio.full.min.js +1 -1
  16. package/dist/formio.full.min.js.LICENSE.txt +3 -5
  17. package/dist/formio.js +18 -18
  18. package/dist/formio.min.js +1 -1
  19. package/dist/formio.min.js.LICENSE.txt +1 -1
  20. package/dist/formio.utils.js +1829 -492
  21. package/dist/formio.utils.min.js +1 -1
  22. package/dist/formio.utils.min.js.LICENSE.txt +10 -4
  23. package/embed.d.ts +1 -0
  24. package/form.d.ts +1 -0
  25. package/lib/cjs/CDN.d.ts +1 -0
  26. package/lib/cjs/CDN.js +6 -3
  27. package/lib/cjs/Element.d.ts +86 -96
  28. package/lib/cjs/Element.js +68 -78
  29. package/lib/cjs/Embed.d.ts +1 -1
  30. package/lib/cjs/Embed.js +52 -12
  31. package/lib/cjs/Form.d.ts +365 -36
  32. package/lib/cjs/Form.js +50 -64
  33. package/lib/cjs/FormBuilder.d.ts +187 -2
  34. package/lib/cjs/FormBuilder.js +30 -8
  35. package/lib/cjs/InlineEmbed.d.ts +7 -0
  36. package/lib/cjs/InlineEmbed.js +116 -0
  37. package/lib/cjs/PDF.d.ts +11 -13
  38. package/lib/cjs/PDF.js +6 -8
  39. package/lib/cjs/Webform.d.ts +183 -143
  40. package/lib/cjs/Webform.js +310 -298
  41. package/lib/cjs/WebformBuilder.d.ts +16 -14
  42. package/lib/cjs/WebformBuilder.js +11 -10
  43. package/lib/cjs/Wizard.d.ts +31 -21
  44. package/lib/cjs/Wizard.js +43 -20
  45. package/lib/cjs/WizardBuilder.d.ts +1 -1
  46. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +8 -5
  47. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +6 -3
  48. package/lib/cjs/components/Components.d.ts +4 -4
  49. package/lib/cjs/components/Components.js +3 -3
  50. package/lib/cjs/components/_classes/component/Component.d.ts +507 -276
  51. package/lib/cjs/components/_classes/component/Component.form.d.ts +6 -3
  52. package/lib/cjs/components/_classes/component/Component.form.js +5 -0
  53. package/lib/cjs/components/_classes/component/Component.js +438 -196
  54. package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +0 -8
  55. package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +2 -2
  56. package/lib/cjs/components/_classes/component/editForm/utils.js +2 -2
  57. package/lib/cjs/components/_classes/component/fixtures/comp6.d.ts +77 -0
  58. package/lib/cjs/components/_classes/component/fixtures/comp6.js +59 -0
  59. package/lib/cjs/components/_classes/component/fixtures/index.d.ts +2 -1
  60. package/lib/cjs/components/_classes/component/fixtures/index.js +3 -1
  61. package/lib/cjs/components/_classes/field/Field.d.ts +11 -2
  62. package/lib/cjs/components/_classes/field/Field.js +13 -1
  63. package/lib/cjs/components/_classes/input/Input.d.ts +4 -3
  64. package/lib/cjs/components/_classes/input/Input.js +8 -6
  65. package/lib/cjs/components/_classes/list/ListComponent.d.ts +2 -2
  66. package/lib/cjs/components/_classes/list/ListComponent.form.d.ts +6 -3
  67. package/lib/cjs/components/_classes/list/ListComponent.form.js +5 -0
  68. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +43 -12
  69. package/lib/cjs/components/_classes/multivalue/Multivalue.js +37 -3
  70. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +163 -67
  71. package/lib/cjs/components/_classes/nested/NestedComponent.form.d.ts +6 -3
  72. package/lib/cjs/components/_classes/nested/NestedComponent.form.js +5 -0
  73. package/lib/cjs/components/_classes/nested/NestedComponent.js +175 -54
  74. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -2
  75. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  76. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +7 -1
  77. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +2 -3
  78. package/lib/cjs/components/address/Address.d.ts +4 -2
  79. package/lib/cjs/components/address/Address.form.d.ts +6 -3
  80. package/lib/cjs/components/address/Address.form.js +5 -0
  81. package/lib/cjs/components/button/Button.d.ts +3 -12
  82. package/lib/cjs/components/button/Button.form.d.ts +6 -3
  83. package/lib/cjs/components/button/Button.form.js +5 -0
  84. package/lib/cjs/components/button/Button.js +5 -0
  85. package/lib/cjs/components/checkbox/Checkbox.d.ts +4 -27
  86. package/lib/cjs/components/checkbox/Checkbox.form.d.ts +6 -3
  87. package/lib/cjs/components/checkbox/Checkbox.form.js +5 -0
  88. package/lib/cjs/components/columns/Columns.d.ts +3 -2
  89. package/lib/cjs/components/columns/Columns.form.d.ts +6 -3
  90. package/lib/cjs/components/columns/Columns.form.js +5 -0
  91. package/lib/cjs/components/columns/Columns.js +1 -1
  92. package/lib/cjs/components/container/Container.form.d.ts +6 -3
  93. package/lib/cjs/components/container/Container.form.js +5 -0
  94. package/lib/cjs/components/content/Content.d.ts +2 -1
  95. package/lib/cjs/components/content/Content.form.d.ts +6 -3
  96. package/lib/cjs/components/content/Content.form.js +5 -0
  97. package/lib/cjs/components/currency/Currency.form.d.ts +6 -3
  98. package/lib/cjs/components/currency/Currency.form.js +5 -0
  99. package/lib/cjs/components/currency/Currency.js +1 -2
  100. package/lib/cjs/components/datagrid/DataGrid.d.ts +8 -7
  101. package/lib/cjs/components/datagrid/DataGrid.form.d.ts +6 -3
  102. package/lib/cjs/components/datagrid/DataGrid.form.js +5 -0
  103. package/lib/cjs/components/datagrid/DataGrid.js +5 -5
  104. package/lib/cjs/components/datagrid/fixtures/comp-with-checkboxes.d.ts +29 -0
  105. package/lib/cjs/components/datagrid/fixtures/comp-with-checkboxes.js +36 -0
  106. package/lib/cjs/components/datagrid/fixtures/index.d.ts +2 -1
  107. package/lib/cjs/components/datagrid/fixtures/index.js +3 -1
  108. package/lib/cjs/components/datamap/DataMap.d.ts +1 -0
  109. package/lib/cjs/components/datamap/DataMap.form.d.ts +6 -3
  110. package/lib/cjs/components/datamap/DataMap.form.js +5 -0
  111. package/lib/cjs/components/datetime/DateTime.d.ts +0 -14
  112. package/lib/cjs/components/datetime/DateTime.form.d.ts +6 -3
  113. package/lib/cjs/components/datetime/DateTime.form.js +5 -0
  114. package/lib/cjs/components/datetime/editForm/DateTime.edit.date.js +2 -2
  115. package/lib/cjs/components/day/Day.d.ts +23 -49
  116. package/lib/cjs/components/day/Day.form.d.ts +6 -3
  117. package/lib/cjs/components/day/Day.form.js +5 -0
  118. package/lib/cjs/components/day/Day.js +16 -21
  119. package/lib/cjs/components/day/fixtures/comp7.d.ts +109 -0
  120. package/lib/cjs/components/day/fixtures/comp7.js +109 -0
  121. package/lib/cjs/components/day/fixtures/index.d.ts +2 -1
  122. package/lib/cjs/components/day/fixtures/index.js +3 -1
  123. package/lib/cjs/components/editgrid/EditGrid.d.ts +7 -3
  124. package/lib/cjs/components/editgrid/EditGrid.form.d.ts +6 -3
  125. package/lib/cjs/components/editgrid/EditGrid.form.js +5 -0
  126. package/lib/cjs/components/editgrid/EditGrid.js +3 -3
  127. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +2 -5
  128. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.templates.js +6 -9
  129. package/lib/cjs/components/email/Email.form.d.ts +6 -3
  130. package/lib/cjs/components/email/Email.form.js +5 -0
  131. package/lib/cjs/components/fieldset/Fieldset.form.d.ts +6 -3
  132. package/lib/cjs/components/fieldset/Fieldset.form.js +5 -0
  133. package/lib/cjs/components/file/File.d.ts +9 -22
  134. package/lib/cjs/components/file/File.form.d.ts +6 -3
  135. package/lib/cjs/components/file/File.form.js +5 -0
  136. package/lib/cjs/components/file/File.js +1 -2
  137. package/lib/cjs/components/form/Form.d.ts +34 -24
  138. package/lib/cjs/components/form/Form.form.d.ts +6 -3
  139. package/lib/cjs/components/form/Form.form.js +5 -0
  140. package/lib/cjs/components/form/Form.js +15 -13
  141. package/lib/cjs/components/hidden/Hidden.d.ts +1 -11
  142. package/lib/cjs/components/hidden/Hidden.form.d.ts +6 -3
  143. package/lib/cjs/components/hidden/Hidden.form.js +5 -0
  144. package/lib/cjs/components/hidden/Hidden.js +1 -2
  145. package/lib/cjs/components/html/HTML.d.ts +2 -1
  146. package/lib/cjs/components/html/HTML.form.d.ts +6 -3
  147. package/lib/cjs/components/html/HTML.form.js +5 -0
  148. package/lib/cjs/components/number/Number.d.ts +3 -17
  149. package/lib/cjs/components/number/Number.form.d.ts +6 -3
  150. package/lib/cjs/components/number/Number.form.js +5 -0
  151. package/lib/cjs/components/number/Number.js +1 -2
  152. package/lib/cjs/components/panel/Panel.form.d.ts +6 -3
  153. package/lib/cjs/components/panel/Panel.form.js +5 -0
  154. package/lib/cjs/components/panel/Panel.js +0 -1
  155. package/lib/cjs/components/password/Password.form.d.ts +6 -3
  156. package/lib/cjs/components/password/Password.form.js +5 -0
  157. package/lib/cjs/components/phonenumber/PhoneNumber.form.d.ts +6 -3
  158. package/lib/cjs/components/phonenumber/PhoneNumber.form.js +5 -0
  159. package/lib/cjs/components/radio/Radio.d.ts +3 -26
  160. package/lib/cjs/components/radio/Radio.form.d.ts +6 -3
  161. package/lib/cjs/components/radio/Radio.form.js +5 -0
  162. package/lib/cjs/components/radio/Radio.js +6 -6
  163. package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +1 -1
  164. package/lib/cjs/components/recaptcha/ReCaptcha.form.d.ts +6 -3
  165. package/lib/cjs/components/recaptcha/ReCaptcha.form.js +5 -0
  166. package/lib/cjs/components/select/Select.d.ts +16 -39
  167. package/lib/cjs/components/select/Select.form.d.ts +6 -3
  168. package/lib/cjs/components/select/Select.form.js +5 -0
  169. package/lib/cjs/components/select/Select.js +13 -16
  170. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +2 -17
  171. package/lib/cjs/components/selectboxes/SelectBoxes.form.d.ts +6 -3
  172. package/lib/cjs/components/selectboxes/SelectBoxes.form.js +5 -0
  173. package/lib/cjs/components/selectboxes/SelectBoxes.js +7 -9
  174. package/lib/cjs/components/signature/Signature.d.ts +0 -14
  175. package/lib/cjs/components/signature/Signature.form.d.ts +6 -3
  176. package/lib/cjs/components/signature/Signature.form.js +5 -0
  177. package/lib/cjs/components/survey/Survey.d.ts +3 -15
  178. package/lib/cjs/components/survey/Survey.form.d.ts +6 -3
  179. package/lib/cjs/components/survey/Survey.form.js +5 -0
  180. package/lib/cjs/components/table/Table.d.ts +2 -1
  181. package/lib/cjs/components/table/Table.form.d.ts +6 -3
  182. package/lib/cjs/components/table/Table.form.js +5 -0
  183. package/lib/cjs/components/tabs/Tabs.d.ts +4 -4
  184. package/lib/cjs/components/tabs/Tabs.form.d.ts +6 -3
  185. package/lib/cjs/components/tabs/Tabs.form.js +5 -0
  186. package/lib/cjs/components/tabs/Tabs.js +1 -2
  187. package/lib/cjs/components/tags/Tags.d.ts +0 -14
  188. package/lib/cjs/components/tags/Tags.form.d.ts +6 -3
  189. package/lib/cjs/components/tags/Tags.form.js +5 -0
  190. package/lib/cjs/components/textarea/TextArea.d.ts +4 -9
  191. package/lib/cjs/components/textarea/TextArea.form.d.ts +6 -3
  192. package/lib/cjs/components/textarea/TextArea.form.js +5 -0
  193. package/lib/cjs/components/textarea/TextArea.js +2 -2
  194. package/lib/cjs/components/textfield/TextField.d.ts +14 -30
  195. package/lib/cjs/components/textfield/TextField.form.d.ts +6 -3
  196. package/lib/cjs/components/textfield/TextField.form.js +5 -0
  197. package/lib/cjs/components/textfield/TextField.js +16 -17
  198. package/lib/cjs/components/time/Time.form.d.ts +6 -3
  199. package/lib/cjs/components/time/Time.form.js +5 -0
  200. package/lib/cjs/components/unknown/Unknown.form.d.ts +5 -34
  201. package/lib/cjs/components/unknown/Unknown.form.js +4 -0
  202. package/lib/cjs/components/url/Url.form.d.ts +6 -3
  203. package/lib/cjs/components/url/Url.form.js +5 -0
  204. package/lib/cjs/components/well/Well.form.d.ts +6 -3
  205. package/lib/cjs/components/well/Well.form.js +5 -0
  206. package/lib/cjs/formio.embed.d.ts +1 -2
  207. package/lib/cjs/formio.embed.js +2 -100
  208. package/lib/cjs/formio.form.d.ts +11 -4
  209. package/lib/cjs/formio.form.js +13 -5
  210. package/lib/cjs/providers/Providers.d.ts +36 -5
  211. package/lib/cjs/providers/Providers.js +29 -0
  212. package/lib/cjs/providers/address/AddressProvider.d.ts +131 -12
  213. package/lib/cjs/providers/address/AddressProvider.js +88 -2
  214. package/lib/cjs/providers/address/AzureAddressProvider.d.ts +48 -1
  215. package/lib/cjs/providers/address/AzureAddressProvider.js +37 -0
  216. package/lib/cjs/providers/address/CustomAddressProvider.d.ts +27 -4
  217. package/lib/cjs/providers/address/CustomAddressProvider.js +34 -0
  218. package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +130 -6
  219. package/lib/cjs/providers/address/GoogleAddressProvider.js +73 -1
  220. package/lib/cjs/providers/address/NominatimAddressProvider.d.ts +32 -7
  221. package/lib/cjs/providers/address/NominatimAddressProvider.js +33 -0
  222. package/lib/cjs/providers/address/index.d.ts +3 -1
  223. package/lib/cjs/providers/processor/fileProcessor.d.ts +7 -1
  224. package/lib/cjs/providers/processor/fileProcessor.js +6 -0
  225. package/lib/cjs/providers/storage/azure.d.ts +6 -13
  226. package/lib/cjs/providers/storage/azure.js +5 -0
  227. package/lib/cjs/providers/storage/base64.d.ts +5 -6
  228. package/lib/cjs/providers/storage/base64.js +4 -0
  229. package/lib/cjs/providers/storage/dropbox.d.ts +6 -4
  230. package/lib/cjs/providers/storage/dropbox.js +5 -0
  231. package/lib/cjs/providers/storage/googleDrive.d.ts +7 -5
  232. package/lib/cjs/providers/storage/googleDrive.js +6 -0
  233. package/lib/cjs/providers/storage/indexeddb.d.ts +5 -7
  234. package/lib/cjs/providers/storage/indexeddb.js +4 -0
  235. package/lib/cjs/providers/storage/s3.d.ts +6 -20
  236. package/lib/cjs/providers/storage/s3.js +5 -0
  237. package/lib/cjs/providers/storage/url.d.ts +6 -7
  238. package/lib/cjs/providers/storage/url.js +10 -0
  239. package/lib/cjs/providers/storage/util.d.ts +24 -1
  240. package/lib/cjs/providers/storage/util.js +18 -0
  241. package/lib/cjs/templates/Templates.d.ts +1 -0
  242. package/lib/cjs/translations/en.d.ts +2 -0
  243. package/lib/cjs/translations/en.js +3 -1
  244. package/lib/cjs/utils/ChoicesWrapper.d.ts +1 -1
  245. package/lib/cjs/utils/ChoicesWrapper.js +13 -2
  246. package/lib/cjs/utils/Evaluator.d.ts +6 -3
  247. package/lib/cjs/utils/Evaluator.js +11 -20
  248. package/lib/cjs/utils/builder.d.ts +9 -7
  249. package/lib/cjs/utils/builder.js +10 -5
  250. package/lib/cjs/utils/calendarUtils.d.ts +7 -13
  251. package/lib/cjs/utils/calendarUtils.js +10 -17
  252. package/lib/cjs/utils/formUtils.d.ts +43 -171
  253. package/lib/cjs/utils/formUtils.js +38 -569
  254. package/lib/cjs/utils/utils.d.ts +367 -221
  255. package/lib/cjs/utils/utils.js +335 -228
  256. package/lib/cjs/widgets/CalendarWidget.d.ts +9 -10
  257. package/lib/cjs/widgets/CalendarWidget.js +9 -11
  258. package/lib/mjs/CDN.d.ts +1 -0
  259. package/lib/mjs/CDN.js +6 -3
  260. package/lib/mjs/Element.d.ts +86 -96
  261. package/lib/mjs/Element.js +68 -78
  262. package/lib/mjs/Embed.d.ts +1 -1
  263. package/lib/mjs/Embed.js +52 -12
  264. package/lib/mjs/Form.d.ts +365 -36
  265. package/lib/mjs/Form.js +140 -57
  266. package/lib/mjs/FormBuilder.d.ts +187 -2
  267. package/lib/mjs/FormBuilder.js +32 -8
  268. package/lib/mjs/InlineEmbed.d.ts +7 -0
  269. package/lib/mjs/InlineEmbed.js +112 -0
  270. package/lib/mjs/PDF.d.ts +11 -13
  271. package/lib/mjs/PDF.js +6 -8
  272. package/lib/mjs/Webform.d.ts +183 -143
  273. package/lib/mjs/Webform.js +322 -310
  274. package/lib/mjs/WebformBuilder.d.ts +16 -14
  275. package/lib/mjs/WebformBuilder.js +11 -10
  276. package/lib/mjs/Wizard.d.ts +31 -21
  277. package/lib/mjs/Wizard.js +42 -19
  278. package/lib/mjs/WizardBuilder.d.ts +1 -1
  279. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +8 -5
  280. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +6 -3
  281. package/lib/mjs/components/Components.d.ts +4 -4
  282. package/lib/mjs/components/Components.js +3 -3
  283. package/lib/mjs/components/_classes/component/Component.d.ts +507 -276
  284. package/lib/mjs/components/_classes/component/Component.form.d.ts +6 -3
  285. package/lib/mjs/components/_classes/component/Component.form.js +5 -0
  286. package/lib/mjs/components/_classes/component/Component.js +438 -196
  287. package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +0 -8
  288. package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +1 -1
  289. package/lib/mjs/components/_classes/component/editForm/utils.js +1 -1
  290. package/lib/mjs/components/_classes/component/fixtures/comp6.d.ts +77 -0
  291. package/lib/mjs/components/_classes/component/fixtures/comp6.js +57 -0
  292. package/lib/mjs/components/_classes/component/fixtures/index.d.ts +2 -1
  293. package/lib/mjs/components/_classes/component/fixtures/index.js +2 -1
  294. package/lib/mjs/components/_classes/field/Field.d.ts +11 -2
  295. package/lib/mjs/components/_classes/field/Field.js +13 -1
  296. package/lib/mjs/components/_classes/input/Input.d.ts +4 -3
  297. package/lib/mjs/components/_classes/input/Input.js +8 -6
  298. package/lib/mjs/components/_classes/list/ListComponent.d.ts +2 -2
  299. package/lib/mjs/components/_classes/list/ListComponent.form.d.ts +6 -3
  300. package/lib/mjs/components/_classes/list/ListComponent.form.js +5 -0
  301. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +43 -12
  302. package/lib/mjs/components/_classes/multivalue/Multivalue.js +37 -3
  303. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +163 -67
  304. package/lib/mjs/components/_classes/nested/NestedComponent.form.d.ts +6 -3
  305. package/lib/mjs/components/_classes/nested/NestedComponent.form.js +5 -0
  306. package/lib/mjs/components/_classes/nested/NestedComponent.js +175 -54
  307. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -2
  308. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  309. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +7 -1
  310. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +2 -3
  311. package/lib/mjs/components/address/Address.d.ts +4 -2
  312. package/lib/mjs/components/address/Address.form.d.ts +6 -3
  313. package/lib/mjs/components/address/Address.form.js +5 -0
  314. package/lib/mjs/components/button/Button.d.ts +3 -12
  315. package/lib/mjs/components/button/Button.form.d.ts +6 -3
  316. package/lib/mjs/components/button/Button.form.js +5 -0
  317. package/lib/mjs/components/button/Button.js +5 -0
  318. package/lib/mjs/components/checkbox/Checkbox.d.ts +4 -27
  319. package/lib/mjs/components/checkbox/Checkbox.form.d.ts +6 -3
  320. package/lib/mjs/components/checkbox/Checkbox.form.js +5 -0
  321. package/lib/mjs/components/columns/Columns.d.ts +3 -2
  322. package/lib/mjs/components/columns/Columns.form.d.ts +6 -3
  323. package/lib/mjs/components/columns/Columns.form.js +5 -0
  324. package/lib/mjs/components/columns/Columns.js +1 -1
  325. package/lib/mjs/components/container/Container.form.d.ts +6 -3
  326. package/lib/mjs/components/container/Container.form.js +5 -0
  327. package/lib/mjs/components/content/Content.d.ts +2 -1
  328. package/lib/mjs/components/content/Content.form.d.ts +6 -3
  329. package/lib/mjs/components/content/Content.form.js +5 -0
  330. package/lib/mjs/components/currency/Currency.form.d.ts +6 -3
  331. package/lib/mjs/components/currency/Currency.form.js +5 -0
  332. package/lib/mjs/components/currency/Currency.js +1 -2
  333. package/lib/mjs/components/datagrid/DataGrid.d.ts +8 -7
  334. package/lib/mjs/components/datagrid/DataGrid.form.d.ts +6 -3
  335. package/lib/mjs/components/datagrid/DataGrid.form.js +5 -0
  336. package/lib/mjs/components/datagrid/DataGrid.js +5 -5
  337. package/lib/mjs/components/datagrid/fixtures/comp-with-checkboxes.d.ts +29 -0
  338. package/lib/mjs/components/datagrid/fixtures/comp-with-checkboxes.js +34 -0
  339. package/lib/mjs/components/datagrid/fixtures/index.d.ts +2 -1
  340. package/lib/mjs/components/datagrid/fixtures/index.js +2 -1
  341. package/lib/mjs/components/datamap/DataMap.d.ts +1 -0
  342. package/lib/mjs/components/datamap/DataMap.form.d.ts +6 -3
  343. package/lib/mjs/components/datamap/DataMap.form.js +5 -0
  344. package/lib/mjs/components/datetime/DateTime.d.ts +0 -14
  345. package/lib/mjs/components/datetime/DateTime.form.d.ts +6 -3
  346. package/lib/mjs/components/datetime/DateTime.form.js +5 -0
  347. package/lib/mjs/components/datetime/editForm/DateTime.edit.date.js +1 -1
  348. package/lib/mjs/components/day/Day.d.ts +23 -49
  349. package/lib/mjs/components/day/Day.form.d.ts +6 -3
  350. package/lib/mjs/components/day/Day.form.js +5 -0
  351. package/lib/mjs/components/day/Day.js +16 -21
  352. package/lib/mjs/components/day/fixtures/comp7.d.ts +109 -0
  353. package/lib/mjs/components/day/fixtures/comp7.js +107 -0
  354. package/lib/mjs/components/day/fixtures/index.d.ts +2 -1
  355. package/lib/mjs/components/day/fixtures/index.js +2 -1
  356. package/lib/mjs/components/editgrid/EditGrid.d.ts +7 -3
  357. package/lib/mjs/components/editgrid/EditGrid.form.d.ts +6 -3
  358. package/lib/mjs/components/editgrid/EditGrid.form.js +5 -0
  359. package/lib/mjs/components/editgrid/EditGrid.js +3 -3
  360. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
  361. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.templates.js +1 -1
  362. package/lib/mjs/components/email/Email.form.d.ts +6 -3
  363. package/lib/mjs/components/email/Email.form.js +5 -0
  364. package/lib/mjs/components/fieldset/Fieldset.form.d.ts +6 -3
  365. package/lib/mjs/components/fieldset/Fieldset.form.js +5 -0
  366. package/lib/mjs/components/file/File.d.ts +9 -22
  367. package/lib/mjs/components/file/File.form.d.ts +6 -3
  368. package/lib/mjs/components/file/File.form.js +5 -0
  369. package/lib/mjs/components/file/File.js +1 -2
  370. package/lib/mjs/components/form/Form.d.ts +34 -24
  371. package/lib/mjs/components/form/Form.form.d.ts +6 -3
  372. package/lib/mjs/components/form/Form.form.js +5 -0
  373. package/lib/mjs/components/form/Form.js +15 -13
  374. package/lib/mjs/components/hidden/Hidden.d.ts +1 -11
  375. package/lib/mjs/components/hidden/Hidden.form.d.ts +6 -3
  376. package/lib/mjs/components/hidden/Hidden.form.js +5 -0
  377. package/lib/mjs/components/hidden/Hidden.js +1 -2
  378. package/lib/mjs/components/html/HTML.d.ts +2 -1
  379. package/lib/mjs/components/html/HTML.form.d.ts +6 -3
  380. package/lib/mjs/components/html/HTML.form.js +5 -0
  381. package/lib/mjs/components/number/Number.d.ts +3 -17
  382. package/lib/mjs/components/number/Number.form.d.ts +6 -3
  383. package/lib/mjs/components/number/Number.form.js +5 -0
  384. package/lib/mjs/components/number/Number.js +1 -2
  385. package/lib/mjs/components/panel/Panel.form.d.ts +6 -3
  386. package/lib/mjs/components/panel/Panel.form.js +5 -0
  387. package/lib/mjs/components/panel/Panel.js +0 -1
  388. package/lib/mjs/components/password/Password.form.d.ts +6 -3
  389. package/lib/mjs/components/password/Password.form.js +5 -0
  390. package/lib/mjs/components/phonenumber/PhoneNumber.form.d.ts +6 -3
  391. package/lib/mjs/components/phonenumber/PhoneNumber.form.js +5 -0
  392. package/lib/mjs/components/radio/Radio.d.ts +3 -26
  393. package/lib/mjs/components/radio/Radio.form.d.ts +6 -3
  394. package/lib/mjs/components/radio/Radio.form.js +5 -0
  395. package/lib/mjs/components/radio/Radio.js +6 -6
  396. package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +1 -1
  397. package/lib/mjs/components/recaptcha/ReCaptcha.form.d.ts +6 -3
  398. package/lib/mjs/components/recaptcha/ReCaptcha.form.js +5 -0
  399. package/lib/mjs/components/select/Select.d.ts +16 -39
  400. package/lib/mjs/components/select/Select.form.d.ts +6 -3
  401. package/lib/mjs/components/select/Select.form.js +5 -0
  402. package/lib/mjs/components/select/Select.js +14 -17
  403. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +2 -17
  404. package/lib/mjs/components/selectboxes/SelectBoxes.form.d.ts +6 -3
  405. package/lib/mjs/components/selectboxes/SelectBoxes.form.js +5 -0
  406. package/lib/mjs/components/selectboxes/SelectBoxes.js +7 -9
  407. package/lib/mjs/components/signature/Signature.d.ts +0 -14
  408. package/lib/mjs/components/signature/Signature.form.d.ts +6 -3
  409. package/lib/mjs/components/signature/Signature.form.js +5 -0
  410. package/lib/mjs/components/survey/Survey.d.ts +3 -15
  411. package/lib/mjs/components/survey/Survey.form.d.ts +6 -3
  412. package/lib/mjs/components/survey/Survey.form.js +5 -0
  413. package/lib/mjs/components/table/Table.d.ts +2 -1
  414. package/lib/mjs/components/table/Table.form.d.ts +6 -3
  415. package/lib/mjs/components/table/Table.form.js +5 -0
  416. package/lib/mjs/components/tabs/Tabs.d.ts +4 -4
  417. package/lib/mjs/components/tabs/Tabs.form.d.ts +6 -3
  418. package/lib/mjs/components/tabs/Tabs.form.js +5 -0
  419. package/lib/mjs/components/tabs/Tabs.js +1 -2
  420. package/lib/mjs/components/tags/Tags.d.ts +0 -14
  421. package/lib/mjs/components/tags/Tags.form.d.ts +6 -3
  422. package/lib/mjs/components/tags/Tags.form.js +5 -0
  423. package/lib/mjs/components/textarea/TextArea.d.ts +4 -9
  424. package/lib/mjs/components/textarea/TextArea.form.d.ts +6 -3
  425. package/lib/mjs/components/textarea/TextArea.form.js +5 -0
  426. package/lib/mjs/components/textarea/TextArea.js +2 -2
  427. package/lib/mjs/components/textfield/TextField.d.ts +14 -30
  428. package/lib/mjs/components/textfield/TextField.form.d.ts +6 -3
  429. package/lib/mjs/components/textfield/TextField.form.js +5 -0
  430. package/lib/mjs/components/textfield/TextField.js +16 -17
  431. package/lib/mjs/components/time/Time.form.d.ts +6 -3
  432. package/lib/mjs/components/time/Time.form.js +5 -0
  433. package/lib/mjs/components/unknown/Unknown.form.d.ts +5 -34
  434. package/lib/mjs/components/unknown/Unknown.form.js +4 -0
  435. package/lib/mjs/components/url/Url.form.d.ts +6 -3
  436. package/lib/mjs/components/url/Url.form.js +5 -0
  437. package/lib/mjs/components/well/Well.form.d.ts +6 -3
  438. package/lib/mjs/components/well/Well.form.js +5 -0
  439. package/lib/mjs/formio.embed.d.ts +1 -2
  440. package/lib/mjs/formio.embed.js +2 -99
  441. package/lib/mjs/formio.form.d.ts +11 -4
  442. package/lib/mjs/formio.form.js +10 -3
  443. package/lib/mjs/providers/Providers.d.ts +36 -5
  444. package/lib/mjs/providers/Providers.js +29 -0
  445. package/lib/mjs/providers/address/AddressProvider.d.ts +131 -12
  446. package/lib/mjs/providers/address/AddressProvider.js +88 -2
  447. package/lib/mjs/providers/address/AzureAddressProvider.d.ts +48 -1
  448. package/lib/mjs/providers/address/AzureAddressProvider.js +37 -0
  449. package/lib/mjs/providers/address/CustomAddressProvider.d.ts +27 -4
  450. package/lib/mjs/providers/address/CustomAddressProvider.js +34 -0
  451. package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +130 -6
  452. package/lib/mjs/providers/address/GoogleAddressProvider.js +73 -1
  453. package/lib/mjs/providers/address/NominatimAddressProvider.d.ts +32 -7
  454. package/lib/mjs/providers/address/NominatimAddressProvider.js +33 -0
  455. package/lib/mjs/providers/address/index.d.ts +3 -1
  456. package/lib/mjs/providers/processor/fileProcessor.d.ts +7 -1
  457. package/lib/mjs/providers/processor/fileProcessor.js +6 -0
  458. package/lib/mjs/providers/storage/azure.d.ts +6 -13
  459. package/lib/mjs/providers/storage/azure.js +5 -0
  460. package/lib/mjs/providers/storage/base64.d.ts +5 -6
  461. package/lib/mjs/providers/storage/base64.js +4 -0
  462. package/lib/mjs/providers/storage/dropbox.d.ts +6 -4
  463. package/lib/mjs/providers/storage/dropbox.js +5 -0
  464. package/lib/mjs/providers/storage/googleDrive.d.ts +7 -5
  465. package/lib/mjs/providers/storage/googleDrive.js +6 -0
  466. package/lib/mjs/providers/storage/indexeddb.d.ts +5 -7
  467. package/lib/mjs/providers/storage/indexeddb.js +4 -0
  468. package/lib/mjs/providers/storage/s3.d.ts +6 -20
  469. package/lib/mjs/providers/storage/s3.js +5 -0
  470. package/lib/mjs/providers/storage/url.d.ts +6 -7
  471. package/lib/mjs/providers/storage/url.js +10 -0
  472. package/lib/mjs/providers/storage/util.d.ts +24 -1
  473. package/lib/mjs/providers/storage/util.js +18 -0
  474. package/lib/mjs/templates/Templates.d.ts +1 -0
  475. package/lib/mjs/translations/en.d.ts +2 -0
  476. package/lib/mjs/translations/en.js +3 -1
  477. package/lib/mjs/utils/ChoicesWrapper.d.ts +1 -1
  478. package/lib/mjs/utils/ChoicesWrapper.js +13 -2
  479. package/lib/mjs/utils/Evaluator.d.ts +6 -3
  480. package/lib/mjs/utils/Evaluator.js +9 -20
  481. package/lib/mjs/utils/builder.d.ts +9 -7
  482. package/lib/mjs/utils/builder.js +10 -5
  483. package/lib/mjs/utils/calendarUtils.d.ts +7 -13
  484. package/lib/mjs/utils/calendarUtils.js +10 -17
  485. package/lib/mjs/utils/formUtils.d.ts +43 -171
  486. package/lib/mjs/utils/formUtils.js +6 -554
  487. package/lib/mjs/utils/utils.d.ts +367 -221
  488. package/lib/mjs/utils/utils.js +329 -222
  489. package/lib/mjs/widgets/CalendarWidget.d.ts +9 -10
  490. package/lib/mjs/widgets/CalendarWidget.js +9 -11
  491. package/package.json +22 -22
  492. package/sdk.d.ts +1 -0
  493. package/utils.d.ts +1 -0
@@ -165,9 +165,7 @@ export default class Component extends Element {
165
165
  }
166
166
  /**
167
167
  * Return the simple condition settings as part of the component.
168
- *
169
- * @return {Object}
170
- *
168
+ * @returns {object} - The simple conditional settings.
171
169
  */
172
170
  static get conditionOperatorsSettings() {
173
171
  return {
@@ -184,10 +182,8 @@ export default class Component extends Element {
184
182
  }
185
183
  /**
186
184
  * Return the array of possible types of component value absed on its schema.
187
- *
188
185
  * @param schema
189
- * @return {Array}
190
- *
186
+ * @returns {Array}
191
187
  */
192
188
  static savedValueTypes(schema) {
193
189
  schema = schema || {};
@@ -196,7 +192,6 @@ export default class Component extends Element {
196
192
  /**
197
193
  * Provides a table view for this component. Override if you wish to do something different than using getView
198
194
  * method of your instance.
199
- *
200
195
  * @param value
201
196
  * @param options
202
197
  */
@@ -205,10 +200,9 @@ export default class Component extends Element {
205
200
  /* eslint-enable no-unused-vars */
206
201
  /**
207
202
  * Initialize a new Component.
208
- *
209
- * @param {Object} component - The component JSON you wish to initialize.
210
- * @param {Object} options - The options for this component.
211
- * @param {Object} data - The global data submission object this component will belong.
203
+ * @param {object} component - The component JSON you wish to initialize.
204
+ * @param {object} options - The options for this component.
205
+ * @param {object} data - The global data submission object this component will belong.
212
206
  */
213
207
  /* eslint-disable max-statements */
214
208
  constructor(component, options, data) {
@@ -239,7 +233,6 @@ export default class Component extends Element {
239
233
  }
240
234
  /**
241
235
  * The data path to this specific component instance.
242
- *
243
236
  * @type {string}
244
237
  */
245
238
  this.path = component?.key || '';
@@ -287,32 +280,27 @@ export default class Component extends Element {
287
280
  this.row = this.options.row;
288
281
  /**
289
282
  * Points to a flat map of child components (if applicable).
290
- *
291
- * @type {Object}
283
+ * @type {object}
292
284
  */
293
285
  this.childComponentsMap = {};
294
286
  /**
295
287
  * Determines if this component is disabled, or not.
296
- *
297
288
  * @type {boolean}
298
289
  */
299
290
  this._disabled = boolValue(this.component.disabled) ? this.component.disabled : false;
300
291
  /**
301
292
  * Points to the root component, usually the FormComponent.
302
- *
303
293
  * @type {Component}
304
294
  */
305
295
  this.root = this.options.root || this;
306
296
  this.localRoot = this.options.localRoot || this;
307
297
  /**
308
298
  * If this input has been input and provided value.
309
- *
310
299
  * @type {boolean}
311
300
  */
312
301
  this.pristine = true;
313
302
  /**
314
303
  * Points to the parent component.
315
- *
316
304
  * @type {Component}
317
305
  */
318
306
  this.parent = this.options.parent;
@@ -332,7 +320,7 @@ export default class Component extends Element {
332
320
  this._referenceAttributeName = 'ref';
333
321
  /**
334
322
  * Used to trigger a new change in this component.
335
- * @type {function} - Call to trigger a change in this component.
323
+ * @type {Function} - Call to trigger a change in this component.
336
324
  */
337
325
  let changes = [];
338
326
  let lastChanged = null;
@@ -373,7 +361,6 @@ export default class Component extends Element {
373
361
  };
374
362
  /**
375
363
  * Used to trigger a redraw event within this component.
376
- *
377
364
  * @type {Function}
378
365
  */
379
366
  this.triggerRedraw = _.debounce(this.redraw.bind(this), 100);
@@ -572,8 +559,8 @@ export default class Component extends Element {
572
559
  return this.shouldForceVisibility(component, 'show');
573
560
  }
574
561
  /**
575
- *
576
- * @param value {boolean}
562
+ * Sets the component visibility.
563
+ * @param {boolean} value - Whether the component should be visible or not.
577
564
  */
578
565
  set visible(value) {
579
566
  if (this._visible !== value) {
@@ -591,8 +578,8 @@ export default class Component extends Element {
591
578
  }
592
579
  }
593
580
  /**
594
- *
595
- * @returns {boolean}
581
+ * Returns the component visibility
582
+ * @returns {boolean} - Whether the component is visible or not.
596
583
  */
597
584
  get visible() {
598
585
  // Show only if visibility changes or if we are in builder mode or if hidden fields should be shown.
@@ -682,9 +669,10 @@ export default class Component extends Element {
682
669
  }
683
670
  /**
684
671
  * Returns only the schema that is different from the default.
685
- *
686
- * @param schema
687
- * @param defaultSchema
672
+ * @param {object} schema - The "full" json schema for the component.
673
+ * @param {object} defaultSchema - The "default" json schema for the component.
674
+ * @param {boolean} recursion - If we are currently in a recursive loop.
675
+ * @returns {object} - The minified json schema for this component.
688
676
  */
689
677
  getModifiedSchema(schema, defaultSchema, recursion) {
690
678
  const modified = {};
@@ -718,21 +706,24 @@ export default class Component extends Element {
718
706
  }
719
707
  /**
720
708
  * Returns the JSON schema for this component.
709
+ * @returns {object} - The JSON schema for this component.
721
710
  */
722
711
  get schema() {
723
712
  return fastCloneDeep(this.getModifiedSchema(_.omit(this.component, 'id'), this.defaultSchema));
724
713
  }
725
714
  /**
726
715
  * Returns true if component is inside DataGrid
716
+ * @returns {boolean} - True if component is inside DataGrid
727
717
  */
728
718
  get isInDataGrid() {
729
719
  return this.inDataGrid;
730
720
  }
731
721
  /**
732
722
  * Translate a text using the i18n system.
733
- *
734
723
  * @param {string} text - The i18n identifier.
735
- * @param {Object} params - The i18n parameters to use for translation.
724
+ * @param {object} params - The i18n parameters to use for translation.
725
+ * @param {...any} args - Additional arguments to pass to the translation library.
726
+ * @returns {string} - The translated text.
736
727
  */
737
728
  t(text, params = {}, ...args) {
738
729
  if (!text) {
@@ -822,7 +813,7 @@ export default class Component extends Element {
822
813
  isHtmlRenderMode() {
823
814
  return this.options.renderMode === 'html';
824
815
  }
825
- renderTemplate(name, data = {}, modeOption) {
816
+ renderTemplate(name, data = {}, modeOption = '') {
826
817
  // Need to make this fall back to form if renderMode is not found similar to how we search templates.
827
818
  const mode = modeOption || this.options.renderMode || 'form';
828
819
  data.component = this.component;
@@ -862,11 +853,12 @@ export default class Component extends Element {
862
853
  }
863
854
  /**
864
855
  * Sanitize an html string.
865
- *
866
- * @param string
867
- * @returns {*}
856
+ * @param {string} dirty - The dirty html string to sanitize.
857
+ * @param {boolean} forceSanitize - If we should force the sanitize to occur.
858
+ * @param {object} options - The options for the sanitize.
859
+ * @returns {*} - The sanitized html string.
868
860
  */
869
- sanitize(dirty, forceSanitize, options) {
861
+ sanitize(dirty, forceSanitize = false, options = {}) {
870
862
  if (!this.shouldSanitizeValue && !forceSanitize) {
871
863
  return dirty;
872
864
  }
@@ -876,12 +868,9 @@ export default class Component extends Element {
876
868
  }
877
869
  /**
878
870
  * Render a template string into html.
879
- *
880
- * @param template
881
- * @param data
882
- * @param actions
883
- *
884
- * @return {HTMLElement|String} - The created element or an empty string if template is not specified.
871
+ * @param {string} template - The template to render.
872
+ * @param {object} data - The data to provide to the template.
873
+ * @returns {HTMLElement | string} - The created element or an empty string if template is not specified.
885
874
  */
886
875
  renderString(template, data) {
887
876
  if (!template) {
@@ -890,9 +879,18 @@ export default class Component extends Element {
890
879
  // Interpolate the template and populate
891
880
  return this.interpolate(template, data);
892
881
  }
882
+ /**
883
+ * Allows for modification of the component value prior to submission.
884
+ * @param {*} input - The input to be modified.
885
+ * @returns {*} - The modified input mapping for the extended component.
886
+ */
893
887
  performInputMapping(input) {
894
888
  return input;
895
889
  }
890
+ /**
891
+ * Returns the component "widget" if one is available.
892
+ * @returns {Widget|null} - The widget instance. null if not available.
893
+ */
896
894
  get widget() {
897
895
  const settings = this.component.widget;
898
896
  if (settings && this.root?.shadowRoot) {
@@ -901,6 +899,10 @@ export default class Component extends Element {
901
899
  const widget = settings && Widgets[settings.type] ? new Widgets[settings.type](settings, this.component, this) : null;
902
900
  return widget;
903
901
  }
902
+ /**
903
+ * Returns the native supported browser language.
904
+ * @returns {string|null} - The native browser language that is supported.
905
+ */
904
906
  getBrowserLanguage() {
905
907
  const nav = window.navigator;
906
908
  const browserLanguagePropertyKeys = ['language', 'browserLanguage', 'systemLanguage', 'userLanguage'];
@@ -924,38 +926,46 @@ export default class Component extends Element {
924
926
  return null;
925
927
  }
926
928
  /**
927
- * Called before a next and previous page is triggered allowing the components
928
- * to perform special functions.
929
- *
930
- * @return {*}
929
+ * Called before a next and previous page is triggered allowing the components to perform special functions.
930
+ * @returns {Promise<boolean>} - A promise to resolve when the component is no longer blocking the next/previous page navigation.
931
931
  */
932
932
  beforePage() {
933
933
  return Promise.resolve(true);
934
934
  }
935
+ /**
936
+ * Called before the next page is triggered allowing the components to hook into the page navigation and perform tasks.
937
+ * @returns {Promise<boolean>} - A promise to resolve when the component is no longer blocking the next page navigation.
938
+ */
935
939
  beforeNext() {
936
940
  return this.beforePage(true);
937
941
  }
938
942
  /**
939
- * Called before a submission is triggered allowing the components
940
- * to perform special async functions.
941
- *
942
- * @return {*}
943
+ * Called before a submission is triggered allowing the components to perform special async functions.
944
+ * @returns {Promise<boolean>} - A promise to resolve when the component is no longer blocking the submission.
943
945
  */
944
946
  beforeSubmit() {
945
947
  return Promise.resolve(true);
946
948
  }
947
949
  /**
948
950
  * Return the submission timezone.
949
- *
950
- * @return {*}
951
+ * @returns {string} - The submission timezone.
951
952
  */
952
953
  get submissionTimezone() {
953
954
  this.options.submissionTimezone = this.options.submissionTimezone || _.get(this.root, 'options.submissionTimezone');
954
955
  return this.options.submissionTimezone;
955
956
  }
957
+ /**
958
+ * Return the current timezone.
959
+ * @returns {string} - The current timezone.
960
+ */
956
961
  get timezone() {
957
962
  return this.getTimezone(this.component);
958
963
  }
964
+ /**
965
+ * Return the current timezone.
966
+ * @param {object} settings - Settings to control how the timezone should be returned.
967
+ * @returns {string} - The current timezone.
968
+ */
959
969
  getTimezone(settings) {
960
970
  if (settings.timezone) {
961
971
  return settings.timezone;
@@ -979,6 +989,9 @@ export default class Component extends Element {
979
989
  * @param {string} [referenceAttributeName] - The attribute name to use for the reference.
980
990
  */
981
991
  loadRefs(element, refs, referenceAttributeName) {
992
+ if (!element) {
993
+ return;
994
+ }
982
995
  for (const ref in refs) {
983
996
  const refType = refs[ref];
984
997
  const isString = typeof refType === 'string';
@@ -993,18 +1006,25 @@ export default class Component extends Element {
993
1006
  }
994
1007
  }
995
1008
  }
996
- setOpenModalElement(template) {
1009
+ /**
1010
+ * Opens the modal element.
1011
+ * @param {string} template - The template to use for the modal dialog.
1012
+ */
1013
+ setOpenModalElement(template = null) {
997
1014
  this.componentModal.setOpenModalElement(template || this.getModalPreviewTemplate());
998
1015
  }
999
1016
  /**
1000
1017
  * Renders a modal preview template and returns the markup as a string
1001
- *
1002
- * @param {Object | null | undefined} ctx - the rendering context
1003
- * @return {string}
1018
+ * @param {object|null|undefined} ctx - The rendering context
1019
+ * @return {string} - The modal preview markup
1004
1020
  */
1005
1021
  renderModalPreview(ctx) {
1006
1022
  return this.renderTemplate('modalPreview', ctx || {});
1007
1023
  }
1024
+ /**
1025
+ * Returns the modal preview template.
1026
+ * @returns {string} - The modal preview template.
1027
+ */
1008
1028
  getModalPreviewTemplate() {
1009
1029
  const dataValue = this.component.type === 'password' ? this.dataValue.replace(/./g, '•') : this.dataValue;
1010
1030
  let modalLabel;
@@ -1017,6 +1037,11 @@ export default class Component extends Element {
1017
1037
  labelInfo: modalLabel,
1018
1038
  });
1019
1039
  }
1040
+ /**
1041
+ * Performs a complete build of a component, which empties, renders, sets the content in the DOM, and then finally attaches events.
1042
+ * @param {HTMLElement} element - The element to attach this component to.
1043
+ * @returns {Promise<void>} - A promise that resolves when the component has been built.
1044
+ */
1020
1045
  build(element) {
1021
1046
  element = element || this.element;
1022
1047
  this.empty(element);
@@ -1026,6 +1051,12 @@ export default class Component extends Element {
1026
1051
  get hasModalSaveButton() {
1027
1052
  return true;
1028
1053
  }
1054
+ /**
1055
+ * Renders a component as an HTML string.
1056
+ * @param {string} children - The contents of all the children HTML as a string.
1057
+ * @param {boolean} topLevel - If this is the topmost component that is being rendered.
1058
+ * @returns {string} - The rendered HTML string of a component.
1059
+ */
1029
1060
  render(children = `Unknown component: ${this.component.type}`, topLevel = false) {
1030
1061
  const isVisible = this.visible;
1031
1062
  this.rendered = true;
@@ -1051,10 +1082,9 @@ export default class Component extends Element {
1051
1082
  }
1052
1083
  /**
1053
1084
  * Creates the tooltip instance using tippy.js and returns it
1054
- *
1055
1085
  * @param {HTMLElement} tooltipEl - HTML element to attach the tooltip
1056
- * @param {Object | null | undefined} settings - tippy.js options
1057
- * @return {any} - tippy.js instance
1086
+ * @param {object|null|undefined} settings - tippy.js options
1087
+ * @return {import('tippy.js').Tippy} - tippy.js instance
1058
1088
  */
1059
1089
  createTooltip(tooltipEl, settings = {}) {
1060
1090
  const tooltipAttribute = tooltipEl.getAttribute('data-tooltip');
@@ -1071,6 +1101,11 @@ export default class Component extends Element {
1071
1101
  content: this.t(this.sanitize(tooltipText), { _userInput: true }),
1072
1102
  });
1073
1103
  }
1104
+ /**
1105
+ * Attaches all the tooltips provided the refs object.
1106
+ * @param {object} toolTipsRefs - The refs for the tooltips within your template.
1107
+ * @returns {void}
1108
+ */
1074
1109
  attachTooltips(toolTipsRefs) {
1075
1110
  toolTipsRefs?.forEach((tooltip, index) => {
1076
1111
  if (tooltip) {
@@ -1078,9 +1113,21 @@ export default class Component extends Element {
1078
1113
  }
1079
1114
  });
1080
1115
  }
1116
+ /**
1117
+ * Create a new component modal for this component.
1118
+ * @param {HTMLElement} element - The element to attach the modal to.
1119
+ * @param {boolean} modalShouldBeOpened - TRUE if the modal should open immediately.
1120
+ * @param {any} currentValue - The current value of the component.
1121
+ * @returns {ComponentModal} - The created component modal.
1122
+ */
1081
1123
  createComponentModal(element, modalShouldBeOpened, currentValue) {
1082
1124
  return new ComponentModal(this, element, modalShouldBeOpened, currentValue, this._referenceAttributeName);
1083
1125
  }
1126
+ /**
1127
+ * Attaches all event listensers for this component to the DOM elements that were rendered.
1128
+ * @param {HTMLElement} element - The element to attach the listeners to.
1129
+ * @returns {Promise<void>} - Resolves when the component is done attaching to the DOM.
1130
+ */
1084
1131
  attach(element) {
1085
1132
  if (!this.builderMode && !this.previewMode && this.component.modalEdit) {
1086
1133
  const modalShouldBeOpened = this.componentModal ? this.componentModal.isOpened : false;
@@ -1118,6 +1165,9 @@ export default class Component extends Element {
1118
1165
  this.addons.forEach((addon) => addon.attach(element));
1119
1166
  return Promise.resolve();
1120
1167
  }
1168
+ /**
1169
+ * Restors the "focus" on a component after a redraw event has occured.
1170
+ */
1121
1171
  restoreFocus() {
1122
1172
  const isFocused = this.root?.focusedComponent?.path === this.path;
1123
1173
  if (isFocused) {
@@ -1126,6 +1176,12 @@ export default class Component extends Element {
1126
1176
  this.restoreCaretPosition();
1127
1177
  }
1128
1178
  }
1179
+ /**
1180
+ * Adds a keyboard shortcut to this component.
1181
+ * @param {HTMLElement} element - The element to attach the keyboard shortcut to.
1182
+ * @param {string} shortcut - The keyboard shortcut to add.
1183
+ * @returns {void}
1184
+ */
1129
1185
  addShortcut(element, shortcut) {
1130
1186
  // Avoid infinite recursion.
1131
1187
  if (!element || !this.root || (this.root === this)) {
@@ -1136,6 +1192,12 @@ export default class Component extends Element {
1136
1192
  }
1137
1193
  this.root.addShortcut(element, shortcut);
1138
1194
  }
1195
+ /**
1196
+ * Removes a keyboard shortcut from this component.
1197
+ * @param {HTMLElement} element - The element to remove the keyboard shortcut from.
1198
+ * @param {string} shortcut - The keyboard shortcut to remove.
1199
+ * @returns {void}
1200
+ */
1139
1201
  removeShortcut(element, shortcut) {
1140
1202
  // Avoid infinite recursion.
1141
1203
  if (!element || (this.root === this)) {
@@ -1168,6 +1230,13 @@ export default class Component extends Element {
1168
1230
  this.tooltip.destroy();
1169
1231
  }
1170
1232
  }
1233
+ /**
1234
+ * Determines if the component should be refreshed based on the path of another component that changed.
1235
+ * @param {string} refreshData - The path of the data that needs to trigger a refresh.
1236
+ * @param {boolean} changed - Flag that is true if the data has been changed.
1237
+ * @param {any} flags - The flags for the checkData procedure.
1238
+ * @returns {void}
1239
+ */
1171
1240
  checkRefresh(refreshData, changed, flags) {
1172
1241
  const changePath = _.get(changed, 'instance.path', false);
1173
1242
  // Don't let components change themselves.
@@ -1184,6 +1253,12 @@ export default class Component extends Element {
1184
1253
  this.refresh(changed.value, changed, flags);
1185
1254
  }
1186
1255
  }
1256
+ /**
1257
+ * Iterates over a list of changes, and determines if the component should be refreshed if it is configured to refresh on any of those components.
1258
+ * @param {Array<any>} changes - The list of components that have changed.
1259
+ * @param {any} flags - The checkData flags.
1260
+ * @returns {void}
1261
+ */
1187
1262
  checkRefreshOn(changes, flags = {}) {
1188
1263
  changes = changes || [];
1189
1264
  if (flags.noRefresh) {
@@ -1205,8 +1280,8 @@ export default class Component extends Element {
1205
1280
  }
1206
1281
  /**
1207
1282
  * Refreshes the component with a new value.
1208
- *
1209
- * @param value
1283
+ * @param {any} value - The latest value of the component to check if it needs to be refreshed.
1284
+ * @returns {void}
1210
1285
  */
1211
1286
  refresh(value) {
1212
1287
  if (this.hasOwnProperty('refreshOnValue')) {
@@ -1229,8 +1304,8 @@ export default class Component extends Element {
1229
1304
  * with the components data and returns true if they are in the same context.
1230
1305
  *
1231
1306
  * Different rows of the same EditGrid, for example, are in different contexts.
1232
- *
1233
- * @param component
1307
+ * @param {any} component - The component to check if it is in the same context as this component.
1308
+ * @returns {boolean} - TRUE if the component is in the same context as this component.
1234
1309
  */
1235
1310
  inContext(component) {
1236
1311
  if (component.data === this.data) {
@@ -1245,9 +1320,18 @@ export default class Component extends Element {
1245
1320
  }
1246
1321
  return false;
1247
1322
  }
1323
+ /**
1324
+ * Determines if we are in "view" only mode.
1325
+ * @returns {boolean} - TRUE if we are in "view" only mode.
1326
+ */
1248
1327
  get viewOnly() {
1249
1328
  return this.options.readOnly && this.options.viewAsHtml;
1250
1329
  }
1330
+ /**
1331
+ * Sets the HTMLElement for this component.
1332
+ * @param {HTMLElement} element - The element that is attached to this component.
1333
+ * @returns {void}
1334
+ */
1251
1335
  setElement(element) {
1252
1336
  if (this.element) {
1253
1337
  delete this.element.component;
@@ -1255,6 +1339,10 @@ export default class Component extends Element {
1255
1339
  }
1256
1340
  this.element = element;
1257
1341
  }
1342
+ /**
1343
+ * Creates an element to hold the "view only" version of this component.
1344
+ * @returns {HTMLElement} - The element for this component.
1345
+ */
1258
1346
  createViewOnlyElement() {
1259
1347
  this.setElement(this.ce('dl', {
1260
1348
  id: this.id
@@ -1265,14 +1353,18 @@ export default class Component extends Element {
1265
1353
  }
1266
1354
  return this.element;
1267
1355
  }
1356
+ /**
1357
+ * The default value for the "view only" mode of a component if the value is not provided.
1358
+ * @returns {string} - The default value for this component.
1359
+ */
1268
1360
  get defaultViewOnlyValue() {
1269
1361
  return '-';
1270
1362
  }
1271
1363
  /**
1272
1364
  * Uses the widget to determine the output string.
1273
- *
1274
- * @param value
1275
- * @return {*}
1365
+ * @param {any} value - The current value of the component.
1366
+ * @param {any} options - The options for getValueAsString.
1367
+ * @returns {any|Array<any>} - The value as a string.
1276
1368
  */
1277
1369
  getWidgetValueAsString(value, options) {
1278
1370
  const noInputWidget = !this.refs.input || !this.refs.input[0] || !this.refs.input[0].widget;
@@ -1297,6 +1389,12 @@ export default class Component extends Element {
1297
1389
  const widget = this.refs.input[0].widget;
1298
1390
  return widget.getValueAsString(value, options);
1299
1391
  }
1392
+ /**
1393
+ * Returns the value of the component as a string.
1394
+ * @param {any} value - The value for this component.
1395
+ * @param {any} options - The options for this component.
1396
+ * @returns {string} - The string representation of the value of this component.
1397
+ */
1300
1398
  getValueAsString(value, options) {
1301
1399
  if (!value) {
1302
1400
  return '';
@@ -1314,20 +1412,32 @@ export default class Component extends Element {
1314
1412
  const stringValue = value.toString();
1315
1413
  return this.sanitize(stringValue);
1316
1414
  }
1415
+ /**
1416
+ * Returns the string representation "view" of the component value.
1417
+ * @param {any} value - The value of the component.
1418
+ * @param {any} options - The options for this component.
1419
+ * @returns {string} - The string representation of the value of this component.
1420
+ */
1317
1421
  getView(value, options) {
1318
1422
  if (this.component.protected) {
1319
1423
  return '--- PROTECTED ---';
1320
1424
  }
1321
1425
  return this.getValueAsString(value, options);
1322
1426
  }
1427
+ /**
1428
+ * Updates the items list for this component. Useful for Select and other List component types.
1429
+ * @param {...any} args - The arguments to pass to the onChange event.
1430
+ * @returns {void}
1431
+ */
1323
1432
  updateItems(...args) {
1324
1433
  this.restoreValue();
1325
1434
  this.onChange(...args);
1326
1435
  }
1327
1436
  /**
1328
- * @param {*} data
1329
- * @param {boolean} [forceUseValue=false] - if true, return 'value' property of the data
1330
- * @return {*}
1437
+ * Returns the value for a specific item in a List type component.
1438
+ * @param {any} data - The data for this component.
1439
+ * @param {boolean} [forceUseValue] - if true, return 'value' property of the data
1440
+ * @returns {any} - The value of the item.
1331
1441
  */
1332
1442
  itemValue(data, forceUseValue = false) {
1333
1443
  if (_.isObject(data) && !_.isArray(data)) {
@@ -1340,6 +1450,11 @@ export default class Component extends Element {
1340
1450
  }
1341
1451
  return data;
1342
1452
  }
1453
+ /**
1454
+ * Returns the item value for html mode.
1455
+ * @param {any} value - The value for this component.
1456
+ * @returns {any} - The value of the item for html mode.
1457
+ */
1343
1458
  itemValueForHTMLMode(value) {
1344
1459
  if (Array.isArray(value)) {
1345
1460
  const values = value.map(item => Array.isArray(item) ? this.itemValueForHTMLMode(item) : this.itemValue(item));
@@ -1347,6 +1462,13 @@ export default class Component extends Element {
1347
1462
  }
1348
1463
  return this.itemValue(value);
1349
1464
  }
1465
+ /**
1466
+ * Creates a modal to input the value of this component.
1467
+ * @param {HTMLElement} element - The element to attach the modal to.
1468
+ * @param {any} attr - A list of attributes to add to the modal.
1469
+ * @param {boolean} confirm - If we should add a confirmation to the modal that keeps it from closing unless confirmed.
1470
+ * @returns {HTMLElement} - The created modal element.
1471
+ */
1350
1472
  createModal(element, attr, confirm) {
1351
1473
  const dialog = this.ce('div', attr || {});
1352
1474
  this.setContent(dialog, this.renderTemplate('dialog'));
@@ -1382,6 +1504,10 @@ export default class Component extends Element {
1382
1504
  this.addEventListener(dialog.refs.dialogClose, 'click', handleCloseClick);
1383
1505
  return dialog;
1384
1506
  }
1507
+ /**
1508
+ * Uses CSS classes to show or hide an element.
1509
+ * @returns {boolean} - TRUE if the element has been css removed.
1510
+ */
1385
1511
  get optimizeRedraw() {
1386
1512
  if (this.options.optimizeRedraw && this.element && !this.visible) {
1387
1513
  this.addClass(this.element, 'formio-removed');
@@ -1419,7 +1545,7 @@ export default class Component extends Element {
1419
1545
  }
1420
1546
  /**
1421
1547
  * Build the custom style from the layout values
1422
- * @return {string} - The custom style
1548
+ * @returns {string} - The custom style
1423
1549
  */
1424
1550
  get customStyle() {
1425
1551
  let customCSS = '';
@@ -1430,24 +1556,31 @@ export default class Component extends Element {
1430
1556
  });
1431
1557
  return customCSS;
1432
1558
  }
1559
+ /**
1560
+ * Returns the component condition operator settings if available.
1561
+ * @returns {object} - The component condition operator settings.
1562
+ */
1433
1563
  static get serverConditionSettings() {
1434
1564
  return Component.conditionOperatorsSettings;
1435
1565
  }
1566
+ /**
1567
+ * Returns if the application is on a mobile device.
1568
+ * @returns {boolean} - TRUE if the application is on a mobile device.
1569
+ */
1436
1570
  get isMobile() {
1437
1571
  return isMobile();
1438
1572
  }
1439
1573
  /**
1440
1574
  * Returns the outside wrapping element of this component.
1441
- * @returns {HTMLElement}
1575
+ * @returns {HTMLElement} - The wrapping element of this component.
1442
1576
  */
1443
1577
  getElement() {
1444
1578
  return this.element;
1445
1579
  }
1446
1580
  /**
1447
1581
  * Create an evaluation context for all script executions and interpolations.
1448
- *
1449
- * @param additional
1450
- * @return {*}
1582
+ * @param {any} additional - Additional context to provide.
1583
+ * @returns {any} - The evaluation context.
1451
1584
  */
1452
1585
  evalContext(additional) {
1453
1586
  return super.evalContext(Object.assign({
@@ -1469,18 +1602,29 @@ export default class Component extends Element {
1469
1602
  }
1470
1603
  /**
1471
1604
  * Sets the pristine flag for this component.
1472
- *
1473
- * @param pristine {boolean} - TRUE to make pristine, FALSE not pristine.
1605
+ * @param {boolean} pristine - TRUE to make pristine, FALSE not pristine.
1474
1606
  */
1475
1607
  setPristine(pristine) {
1476
1608
  this.pristine = pristine;
1477
1609
  }
1610
+ /**
1611
+ * Returns if the component is pristine.
1612
+ * @returns {boolean} - TRUE if the component is pristine.
1613
+ */
1478
1614
  get isPristine() {
1479
1615
  return this.pristine;
1480
1616
  }
1617
+ /**
1618
+ * Sets the dirty flag for this component.
1619
+ * @param {boolean} dirty - TRUE to make dirty, FALSE not dirty.
1620
+ */
1481
1621
  setDirty(dirty) {
1482
1622
  this.dirty = dirty;
1483
1623
  }
1624
+ /**
1625
+ * Returns if the component is dirty.
1626
+ * @returns {boolean} - TRUE if the component is dirty.
1627
+ */
1484
1628
  get isDirty() {
1485
1629
  return this.dirty;
1486
1630
  }
@@ -1494,12 +1638,23 @@ export default class Component extends Element {
1494
1638
  this.restoreValue();
1495
1639
  this.triggerRootChange();
1496
1640
  }
1641
+ /**
1642
+ * Returns the icon class for a given icon name.
1643
+ * @param {string} name - The name of the icon you wish to fetch provided the icon class. This is the "font awesome" version of the name of the icon.
1644
+ * @param {boolean} spinning - If the component should be spinning.
1645
+ * @returns {string} - The icon class for the equivalent icon in the iconset we are using.
1646
+ */
1497
1647
  iconClass(name, spinning) {
1498
1648
  const iconset = this.options.iconset || Templates.current.defaultIconset || 'fa';
1499
1649
  return Templates.current.hasOwnProperty('iconClass')
1500
1650
  ? Templates.current.iconClass(iconset, name, spinning)
1501
1651
  : this.options.iconset === 'fa' ? Templates.defaultTemplates.iconClass(iconset, name, spinning) : name;
1502
1652
  }
1653
+ /**
1654
+ * Returns the size css class names for our current template.
1655
+ * @param {string} size - The size class name for the default iconset.
1656
+ * @returns {string} - The size class for our component.
1657
+ */
1503
1658
  size(size) {
1504
1659
  return Templates.current.hasOwnProperty('size')
1505
1660
  ? Templates.current.size(size)
@@ -1512,15 +1667,23 @@ export default class Component extends Element {
1512
1667
  get name() {
1513
1668
  return this.t(this.component.label || this.component.placeholder || this.key, { _userInput: true });
1514
1669
  }
1670
+ /**
1671
+ * Returns the visible errors for this component.
1672
+ * @returns {Array<object>} - The visible errors for this component.
1673
+ */
1515
1674
  get visibleErrors() {
1516
1675
  return this._visibleErrors;
1517
1676
  }
1677
+ /**
1678
+ * Returns all the errors for this component, visible or not.
1679
+ * @returns {Array<object>} - All the errors for this component.
1680
+ */
1518
1681
  get errors() {
1519
1682
  return this._errors;
1520
1683
  }
1521
1684
  /**
1522
1685
  * Returns the error label for this component.
1523
- * @return {*}
1686
+ * @returns {string} - The error label for this component.
1524
1687
  */
1525
1688
  get errorLabel() {
1526
1689
  return this.t(this.component.errorLabel
@@ -1530,12 +1693,20 @@ export default class Component extends Element {
1530
1693
  }
1531
1694
  /**
1532
1695
  * Get the error message provided a certain type of error.
1533
- * @param type
1534
- * @return {*}
1696
+ * @param {string} type - The type of error to fetch the message for.
1697
+ * @returns {string} - The error message configured for this component.
1535
1698
  */
1536
1699
  errorMessage(type) {
1537
1700
  return (this.component.errors && this.component.errors[type]) ? this.component.errors[type] : type;
1538
1701
  }
1702
+ /**
1703
+ * Sets the content, innerHTML, of an element to the sanitized content.
1704
+ * @param {HTMLElement} element - The element to set the innerHTML to.
1705
+ * @param {string} content - The HTML string content that we wish to set.
1706
+ * @param {boolean} forceSanitize - If we should force the content to be sanitized.
1707
+ * @param {any} sanitizeOptions - The options for the sanitize function.
1708
+ * @returns {boolean} - TRUE if the content was sanitized and set.
1709
+ */
1539
1710
  setContent(element, content, forceSanitize, sanitizeOptions) {
1540
1711
  if (element instanceof HTMLElement) {
1541
1712
  element.innerHTML = this.sanitize(content, forceSanitize, sanitizeOptions);
@@ -1543,6 +1714,9 @@ export default class Component extends Element {
1543
1714
  }
1544
1715
  return false;
1545
1716
  }
1717
+ /**
1718
+ * Restores the caret position in the input element after a refresh occurs.
1719
+ */
1546
1720
  restoreCaretPosition() {
1547
1721
  if (this.root?.currentSelection) {
1548
1722
  if (this.refs.input?.length) {
@@ -1564,6 +1738,10 @@ export default class Component extends Element {
1564
1738
  }
1565
1739
  }
1566
1740
  }
1741
+ /**
1742
+ * Redraw the component.
1743
+ * @returns {Promise<void>} - A promise that resolves when the component is done redrawing.
1744
+ */
1567
1745
  redraw() {
1568
1746
  // Don't bother if we have not built yet.
1569
1747
  if (!this.element || !this.element.parentNode || this.optimizeRedraw) {
@@ -1579,29 +1757,54 @@ export default class Component extends Element {
1579
1757
  this.setElement(parent.children[index]);
1580
1758
  return this.attach(this.element);
1581
1759
  }
1760
+ /**
1761
+ * Rebuild and redraw a component.
1762
+ * @returns {Promise<void>} - A promise that resolves when the component is done rebuilding and redrawing.
1763
+ */
1582
1764
  rebuild() {
1583
1765
  this.destroy();
1584
1766
  this.init();
1585
1767
  this.visible = this.conditionallyVisible(null, null);
1586
1768
  return this.redraw();
1587
1769
  }
1770
+ /**
1771
+ * Removes all event listeners attached to this component.
1772
+ */
1588
1773
  removeEventListeners() {
1589
1774
  super.removeEventListeners();
1590
1775
  this.tooltips.forEach(tooltip => tooltip.destroy());
1591
1776
  this.tooltips = [];
1592
1777
  }
1778
+ /**
1779
+ * Returns if the dom node has the classes provided.
1780
+ * @param {HTMLElement} element - The element to check for the class.
1781
+ * @param {string} className - The name of the class to check.
1782
+ * @returns {boolean|void} - TRUE if the element has the class.
1783
+ */
1593
1784
  hasClass(element, className) {
1594
1785
  if (!element) {
1595
1786
  return;
1596
1787
  }
1597
1788
  return super.hasClass(element, this.transform('class', className));
1598
1789
  }
1790
+ /**
1791
+ * Adds a class to an HTML element.
1792
+ * @param {HTMLElement} element - The dom element to add the class to.
1793
+ * @param {string} className - The class name you wish to add.
1794
+ * @returns {this|void} - The component instance.
1795
+ */
1599
1796
  addClass(element, className) {
1600
1797
  if (!element) {
1601
1798
  return;
1602
1799
  }
1603
1800
  return super.addClass(element, this.transform('class', className));
1604
1801
  }
1802
+ /**
1803
+ * Removes a class from an element.
1804
+ * @param {HTMLElement} element - The element to remove the class from.
1805
+ * @param {string} className - The class name to remove.
1806
+ * @returns {this|void} - The component instance.
1807
+ */
1605
1808
  removeClass(element, className) {
1606
1809
  if (!element) {
1607
1810
  return;
@@ -1610,8 +1813,7 @@ export default class Component extends Element {
1610
1813
  }
1611
1814
  /**
1612
1815
  * Determines if this component has a condition defined.
1613
- *
1614
- * @return {null}
1816
+ * @returns {boolean} - TRUE if the component has a condition defined.
1615
1817
  */
1616
1818
  hasCondition() {
1617
1819
  if (this._hasCondition !== null) {
@@ -1622,9 +1824,9 @@ export default class Component extends Element {
1622
1824
  }
1623
1825
  /**
1624
1826
  * Check if this component is conditionally visible.
1625
- *
1626
- * @param data
1627
- * @return {boolean}
1827
+ * @param {any} data - The data to check against.
1828
+ * @param {any} row - The row data to check against.
1829
+ * @returns {boolean} - TRUE if the component is conditionally visible.
1628
1830
  */
1629
1831
  conditionallyVisible(data, row) {
1630
1832
  data = data || this.rootValue;
@@ -1639,16 +1841,19 @@ export default class Component extends Element {
1639
1841
  * Checks the condition of this component.
1640
1842
  *
1641
1843
  * TODO: Switch row and data parameters to be consistent with other methods.
1642
- *
1643
- * @param row - The row contextual data.
1644
- * @param data - The global data object.
1645
- * @return {boolean} - True if the condition applies to this component.
1844
+ * @param {any} row - The row contextual data.
1845
+ * @param {any} data - The global data object.
1846
+ * @returns {boolean} - True if the condition applies to this component.
1646
1847
  */
1647
1848
  checkCondition(row, data) {
1648
1849
  return FormioUtils.checkCondition(this.component, row || this.data, data || this.rootValue, this.root ? this.root._form : {}, this);
1649
1850
  }
1650
1851
  /**
1651
1852
  * Check for conditionals and hide/show the element based on those conditions.
1853
+ * @param {any} data - The data to check against.
1854
+ * @param {any} flags - The flags passed to checkData function.
1855
+ * @param {any} row - The row data to check against.
1856
+ * @returns {boolean} - TRUE if the component is visible.
1652
1857
  */
1653
1858
  checkComponentConditions(data, flags, row) {
1654
1859
  data = data || this.rootValue;
@@ -1666,8 +1871,10 @@ export default class Component extends Element {
1666
1871
  }
1667
1872
  /**
1668
1873
  * Checks conditions for this component and any sub components.
1669
- * @param args
1670
- * @return {boolean}
1874
+ * @param {any} data - The data to check against.
1875
+ * @param {any} flags - The flags passed to checkData function.
1876
+ * @param {any} row - The row data to check against.
1877
+ * @returns {boolean} - TRUE if the component is visible.
1671
1878
  */
1672
1879
  checkConditions(data, flags, row) {
1673
1880
  data = data || this.rootValue;
@@ -1675,17 +1882,20 @@ export default class Component extends Element {
1675
1882
  row = row || this.data;
1676
1883
  return this.checkComponentConditions(data, flags, row);
1677
1884
  }
1885
+ /**
1886
+ * Returns the component logic if applicable.
1887
+ * @returns {Array<object>} - The component logic.
1888
+ */
1678
1889
  get logic() {
1679
1890
  return this.component.logic || [];
1680
1891
  }
1681
1892
  /**
1682
1893
  * Check all triggers and apply necessary actions.
1683
- *
1684
- * @param data
1894
+ * @param {any} data - The data to check against.
1895
+ * @param {any} row - The row data to check against.
1896
+ * @returns {boolean|void} - TRUE if the component was altered.
1685
1897
  */
1686
- fieldLogic(data, row) {
1687
- data = data || this.rootValue;
1688
- row = row || this.data;
1898
+ fieldLogic(data = this.rootValue, row = this.data) {
1689
1899
  const logics = this.logic;
1690
1900
  // If there aren't logic, don't go further.
1691
1901
  if (logics.length === 0) {
@@ -1708,6 +1918,10 @@ export default class Component extends Element {
1708
1918
  }
1709
1919
  return changed;
1710
1920
  }
1921
+ /**
1922
+ * Retuns if the browser is Internet Explorer.
1923
+ * @returns {boolean} - TRUE if the browser is IE.
1924
+ */
1711
1925
  isIE() {
1712
1926
  if (typeof window === 'undefined') {
1713
1927
  return false;
@@ -1732,9 +1946,24 @@ export default class Component extends Element {
1732
1946
  // other browser
1733
1947
  return false;
1734
1948
  }
1949
+ /**
1950
+ * Defines the logic action value through evaluation.
1951
+ * @param {object} action - The action within the Logic system to perform.
1952
+ * @param {object} argsObject - The arguments to pass to the evaluation.
1953
+ * @returns {any} - The result of the evaluation.
1954
+ */
1735
1955
  defineActionValue(action, argsObject) {
1736
1956
  return this.evaluate(action.value, argsObject, 'value');
1737
1957
  }
1958
+ /**
1959
+ * Apply the actions of Logic for a component once the conditions have been met.
1960
+ * @param {object} newComponent - The new component to apply the actions to.
1961
+ * @param {Array<object>} actions - An array of actions
1962
+ * @param {any} result - The result of the conditional check in order to evaluate the actions.
1963
+ * @param {any} row - The contextual row data for this component.
1964
+ * @param {any} data - The global data object for the submission.
1965
+ * @returns {boolean} - TRUE if the component was altered.
1966
+ */
1738
1967
  applyActions(newComponent, actions, result, row, data) {
1739
1968
  data = data || this.rootValue;
1740
1969
  row = row || this.data;
@@ -1814,8 +2043,8 @@ export default class Component extends Element {
1814
2043
  }
1815
2044
  /**
1816
2045
  * Add a new input error to this element.
1817
- *
1818
- * @param {{level: string, message: string}[]} messages
2046
+ * @param {Array<object>|string} messages - An array of messages to add to the element.
2047
+ * @returns {void}
1819
2048
  */
1820
2049
  addMessages(messages) {
1821
2050
  if (!messages) {
@@ -1838,6 +2067,15 @@ export default class Component extends Element {
1838
2067
  }).join(''));
1839
2068
  }
1840
2069
  }
2070
+ /**
2071
+ * Sets the form input widget error classes.
2072
+ * @param {Array<HTMLElement>} elements - An array of DOM elements to set the error classes on.
2073
+ * @param {boolean} dirty - If the input is dirty.
2074
+ * @param {boolean} hasErrors - If the input has errors.
2075
+ * @param {boolean} hasMessages - If the input has messages.
2076
+ * @param {HTMLElement} element - The wrapper element for all the other elements passed in first argument.
2077
+ * @returns {void}
2078
+ */
1841
2079
  setErrorClasses(elements, dirty, hasErrors, hasMessages, element = this.element) {
1842
2080
  this.clearErrorClasses();
1843
2081
  elements.forEach((element) => {
@@ -1864,6 +2102,12 @@ export default class Component extends Element {
1864
2102
  this.addClass(element, 'has-message');
1865
2103
  }
1866
2104
  }
2105
+ /**
2106
+ * Adds the classes necessary to mark an element as invalid.
2107
+ * @param {HTMLElement} element - The element you wish to add the invalid classes to.
2108
+ * @param {boolean} invalid - TRUE if the component is invalid, FALSE otherwise.
2109
+ * @returns {void}
2110
+ */
1867
2111
  setElementInvalid(element, invalid) {
1868
2112
  if (!element)
1869
2113
  return;
@@ -1875,6 +2119,9 @@ export default class Component extends Element {
1875
2119
  }
1876
2120
  element.setAttribute('aria-invalid', invalid ? 'true' : 'false');
1877
2121
  }
2122
+ /**
2123
+ * Clears the components data if it is conditionally hidden AND clearOnHide is set to true for this component.
2124
+ */
1878
2125
  clearOnHide() {
1879
2126
  // clearOnHide defaults to true for old forms (without the value set) so only trigger if the value is false.
1880
2127
  if (
@@ -1894,6 +2141,10 @@ export default class Component extends Element {
1894
2141
  }
1895
2142
  }
1896
2143
  }
2144
+ /**
2145
+ * Triggers a debounced onChange event for the root component (usually Webform).
2146
+ * @param {...any} args - The arguments to pass to the onChange event.
2147
+ */
1897
2148
  triggerRootChange(...args) {
1898
2149
  if (this.options.onChange) {
1899
2150
  this.options.onChange(...args);
@@ -1902,6 +2153,13 @@ export default class Component extends Element {
1902
2153
  this.root.triggerChange(...args);
1903
2154
  }
1904
2155
  }
2156
+ /**
2157
+ * Called when the component value has been changed. This will then trigger the root level onChange handler which
2158
+ * propagates the checkData methods for the full component tree.
2159
+ * @param {any} flags - The flags for the change event propagation.
2160
+ * @param {boolean} fromRoot - If the change event is from the root component.
2161
+ * @returns {boolean} - TRUE if the component has changed.
2162
+ */
1905
2163
  onChange(flags, fromRoot) {
1906
2164
  flags = flags || {};
1907
2165
  if (flags.modified) {
@@ -2037,7 +2295,7 @@ export default class Component extends Element {
2037
2295
  return Promise.reject();
2038
2296
  }
2039
2297
  this.quill = new Quill(element, isIEBrowser ? { ...settings, modules: {} } : settings);
2040
- /** This block of code adds the [source] capabilities. See https://codepen.io/anon/pen/ZyEjrQ **/
2298
+ /** This block of code adds the [source] capabilities. See https://codepen.io/anon/pen/ZyEjrQ */
2041
2299
  const txtArea = document.createElement('textarea');
2042
2300
  txtArea.setAttribute('class', 'quill-source-code');
2043
2301
  this.quill.addContainer('ql-custom').appendChild(txtArea);
@@ -2051,7 +2309,7 @@ export default class Component extends Element {
2051
2309
  txtArea.style.display = (txtArea.style.display === 'none') ? 'inherit' : 'none';
2052
2310
  });
2053
2311
  }
2054
- /** END CODEBLOCK **/
2312
+ /** END CODEBLOCK */
2055
2313
  // Make sure to select cursor when they click on the element.
2056
2314
  this.addEventListener(element, 'click', () => this.quill.focus());
2057
2315
  // Allows users to skip toolbar items when tabbing though form
@@ -2098,23 +2356,22 @@ export default class Component extends Element {
2098
2356
  }
2099
2357
  /**
2100
2358
  * The empty value for this component.
2101
- *
2102
- * @return {null}
2359
+ * @returns {null} - The empty value for this component.
2103
2360
  */
2104
2361
  get emptyValue() {
2105
2362
  return null;
2106
2363
  }
2107
2364
  /**
2108
2365
  * Returns if this component has a value set.
2109
- *
2366
+ * @param {any} data - The global data object.
2367
+ * @returns {boolean} - TRUE if a value is set.
2110
2368
  */
2111
2369
  hasValue(data) {
2112
2370
  return !_.isUndefined(_.get(data || this.data, this.key));
2113
2371
  }
2114
2372
  /**
2115
2373
  * Get the data value at the root level.
2116
- *
2117
- * @return {*}
2374
+ * @returns {*} - The root value for the component, typically the Webform data object.
2118
2375
  */
2119
2376
  get rootValue() {
2120
2377
  return this.root ? this.root.data : this.data;
@@ -2124,7 +2381,7 @@ export default class Component extends Element {
2124
2381
  }
2125
2382
  /**
2126
2383
  * Get the static value of this component.
2127
- * @return {*}
2384
+ * @returns {*} - The value for this component.
2128
2385
  */
2129
2386
  get dataValue() {
2130
2387
  if (!this.key ||
@@ -2142,8 +2399,7 @@ export default class Component extends Element {
2142
2399
  }
2143
2400
  /**
2144
2401
  * Sets the static value of this component.
2145
- *
2146
- * @param value
2402
+ * @param {*} value - The value to set for this component.
2147
2403
  */
2148
2404
  set dataValue(value) {
2149
2405
  if (!this.allowData ||
@@ -2163,8 +2419,8 @@ export default class Component extends Element {
2163
2419
  }
2164
2420
  /**
2165
2421
  * Splice a value from the dataValue.
2166
- *
2167
- * @param index
2422
+ * @param {number} index - The index to splice for an array component values.
2423
+ * @param {*} flags - The flags to use when splicing the value.
2168
2424
  */
2169
2425
  splice(index, flags = {}) {
2170
2426
  if (this.hasValue()) {
@@ -2232,8 +2488,7 @@ export default class Component extends Element {
2232
2488
  }
2233
2489
  /**
2234
2490
  * Get the input value of this component.
2235
- *
2236
- * @return {*}
2491
+ * @returns {*} - The value for the component.
2237
2492
  */
2238
2493
  getValue() {
2239
2494
  if (!this.hasInput || this.viewOnly || !this.refs.input || !this.refs.input.length) {
@@ -2255,9 +2510,8 @@ export default class Component extends Element {
2255
2510
  }
2256
2511
  /**
2257
2512
  * Get the value at a specific index.
2258
- *
2259
- * @param index
2260
- * @returns {*}
2513
+ * @param {number} index - For an array component or multiple values, this returns the value at a specific index.
2514
+ * @returns {*} - The value at the specified index.
2261
2515
  */
2262
2516
  getValueAt(index) {
2263
2517
  const input = this.performInputMapping(this.refs.input[index]);
@@ -2265,11 +2519,9 @@ export default class Component extends Element {
2265
2519
  }
2266
2520
  /**
2267
2521
  * Set the value of this component.
2268
- *
2269
- * @param value
2270
- * @param flags
2271
- *
2272
- * @return {boolean} - If the value changed.
2522
+ * @param {*} value - The value to set for this component.
2523
+ * @param {*} flags - The flags to use when setting the value.
2524
+ * @returns {boolean} - If the value changed.
2273
2525
  */
2274
2526
  setValue(value, flags = {}) {
2275
2527
  const changed = this.updateValue(value, flags);
@@ -2300,9 +2552,9 @@ export default class Component extends Element {
2300
2552
  }
2301
2553
  /**
2302
2554
  * Set the value at a specific index.
2303
- *
2304
- * @param index
2305
- * @param value
2555
+ * @param {number} index - The index to set the value at.
2556
+ * @param {*} value - The value to set at the specified index.
2557
+ * @param {*} flags - The flags to use when setting the value.
2306
2558
  */
2307
2559
  setValueAt(index, value, flags = {}) {
2308
2560
  if (!flags.noDefault && (value === null || value === undefined) && !this.component.multiple) {
@@ -2349,9 +2601,8 @@ export default class Component extends Element {
2349
2601
  }
2350
2602
  /**
2351
2603
  * Normalize values coming into updateValue.
2352
- *
2353
- * @param value
2354
- * @return {*}
2604
+ * @param {*} value - The value to normalize before setting.
2605
+ * @returns {*} - The normalized value.
2355
2606
  */
2356
2607
  normalizeValue(value) {
2357
2608
  if (this.component.multiple && !Array.isArray(value)) {
@@ -2361,8 +2612,9 @@ export default class Component extends Element {
2361
2612
  }
2362
2613
  /**
2363
2614
  * Update a value of this component.
2364
- *
2365
- * @param flags
2615
+ * @param {*} value - The value to update.
2616
+ * @param {*} flags - The flags to use when updating the value.
2617
+ * @returns {boolean} - If the value changed.
2366
2618
  */
2367
2619
  updateComponentValue(value, flags = {}) {
2368
2620
  let newValue = (!flags.resetValue && (value === undefined || value === null)) ? this.getValue() : value;
@@ -2381,9 +2633,8 @@ export default class Component extends Element {
2381
2633
  }
2382
2634
  /**
2383
2635
  * Updates the value of this component plus all sub-components.
2384
- *
2385
- * @param args
2386
- * @return {boolean}
2636
+ * @param {...any} args - The arguments to pass to updateValue.
2637
+ * @returns {boolean} - If the value changed.
2387
2638
  */
2388
2639
  updateValue(...args) {
2389
2640
  return this.updateComponentValue(...args);
@@ -2401,7 +2652,7 @@ export default class Component extends Element {
2401
2652
  */
2402
2653
  resetValue() {
2403
2654
  this.unset();
2404
- this.setValue(this.emptyValue, {
2655
+ this.setValue(this.defaultValue || this.emptyValue, {
2405
2656
  noUpdateEvent: true,
2406
2657
  noValidate: true,
2407
2658
  resetValue: true
@@ -2409,10 +2660,9 @@ export default class Component extends Element {
2409
2660
  }
2410
2661
  /**
2411
2662
  * Determine if the value of this component has changed.
2412
- *
2413
- * @param newValue
2414
- * @param oldValue
2415
- * @return {boolean}
2663
+ * @param {*} newValue - The new value to check.
2664
+ * @param {*} oldValue - The existing value of the component.
2665
+ * @returns {boolean} - TRUE if the value has changed.
2416
2666
  */
2417
2667
  hasChanged(newValue, oldValue) {
2418
2668
  if (((newValue === undefined) || (newValue === null)) &&
@@ -2430,8 +2680,9 @@ export default class Component extends Element {
2430
2680
  }
2431
2681
  /**
2432
2682
  * Update the value on change.
2433
- *
2434
- * @param flags
2683
+ * @param {*} flags - The flags to use when triggering the on change event.
2684
+ * @param {boolean} changed - If the value has changed.
2685
+ * @returns {boolean} - If the value changed.
2435
2686
  */
2436
2687
  updateOnChange(flags = {}, changed = false) {
2437
2688
  if (!flags.noUpdateEvent && changed) {
@@ -2444,13 +2695,6 @@ export default class Component extends Element {
2444
2695
  }
2445
2696
  return false;
2446
2697
  }
2447
- /**
2448
- * Perform a calculated value operation.
2449
- *
2450
- * @param data - The global data object.
2451
- *
2452
- * @return {boolean} - If the value changed during calculation.
2453
- */
2454
2698
  convertNumberOrBoolToString(value) {
2455
2699
  if (typeof value === 'number' || typeof value === 'boolean') {
2456
2700
  return value.toString();
@@ -2558,9 +2802,10 @@ export default class Component extends Element {
2558
2802
  /* eslint-enable max-statements */
2559
2803
  /**
2560
2804
  * Performs calculations in this component plus any child components.
2561
- *
2562
- * @param args
2563
- * @return {boolean}
2805
+ * @param {*} data - The data to perform the calculation with.
2806
+ * @param {*} flags - The flags to use when calculating the value.
2807
+ * @param {*} row - The contextual row data to use when performing the calculation.
2808
+ * @returns {boolean} - TRUE if the value changed.
2564
2809
  */
2565
2810
  calculateValue(data, flags, row) {
2566
2811
  data = data || this.rootValue;
@@ -2570,15 +2815,14 @@ export default class Component extends Element {
2570
2815
  }
2571
2816
  /**
2572
2817
  * Get this component's label text.
2573
- *
2818
+ * @returns {string} - The label text for this component.
2574
2819
  */
2575
2820
  get label() {
2576
2821
  return this.component.label;
2577
2822
  }
2578
2823
  /**
2579
2824
  * Set this component's label text and render it.
2580
- *
2581
- * @param value - The new label text.
2825
+ * @param {string} value - The new label text.
2582
2826
  */
2583
2827
  set label(value) {
2584
2828
  this.component.label = value;
@@ -2588,17 +2832,18 @@ export default class Component extends Element {
2588
2832
  }
2589
2833
  /**
2590
2834
  * Get FormioForm element at the root of this component tree.
2591
- *
2835
+ * @returns {*} root - The root component to search from.
2592
2836
  */
2593
2837
  getRoot() {
2594
2838
  return this.root;
2595
2839
  }
2596
2840
  /**
2597
2841
  * Returns the invalid message, or empty string if the component is valid.
2598
- *
2599
- * @param data
2600
- * @param dirty
2601
- * @return {*}
2842
+ * @param {*} data - The data to check if the component is valid.
2843
+ * @param {boolean} dirty - If the component is dirty.
2844
+ * @param {boolean} ignoreCondition - If conditions for the component should be ignored when checking validity.
2845
+ * @param {*} row - Contextual row data for this component.
2846
+ * @returns {string} - The message to show when the component is invalid.
2602
2847
  */
2603
2848
  invalidMessage(data, dirty, ignoreCondition, row) {
2604
2849
  if (!ignoreCondition && !this.checkCondition(row, data)) {
@@ -2630,10 +2875,9 @@ export default class Component extends Element {
2630
2875
  }
2631
2876
  /**
2632
2877
  * Returns if the component is valid or not.
2633
- *
2634
- * @param data
2635
- * @param dirty
2636
- * @return {boolean}
2878
+ * @param {*} data - The data to check if the component is valid.
2879
+ * @param {boolean} dirty - If the component is dirty.
2880
+ * @returns {boolean} - TRUE if the component is valid.
2637
2881
  */
2638
2882
  isValid(data, dirty) {
2639
2883
  return !this.invalidMessage(data, dirty);
@@ -2652,8 +2896,8 @@ export default class Component extends Element {
2652
2896
  }
2653
2897
  /**
2654
2898
  * Interpolate errors from the validation methods.
2655
- * @param {*} errors
2656
- * @returns
2899
+ * @param {Array<any>} errors - An array of errors to interpolate.
2900
+ * @returns {Array<any>} - The interpolated errors.
2657
2901
  */
2658
2902
  interpolateErrors(errors) {
2659
2903
  const interpolatedErrors = FormioUtils.interpolateErrors(this.component, errors, this.t.bind(this));
@@ -2665,7 +2909,7 @@ export default class Component extends Element {
2665
2909
  * @param {*} data - The root submission data.
2666
2910
  * @param {*} row - The contextual row data.
2667
2911
  * @param {*} flags - The flags to perform validation.
2668
- * @returns
2912
+ * @returns {boolean} - TRUE if the component is valid.
2669
2913
  */
2670
2914
  showValidationErrors(errors, data, row, flags) {
2671
2915
  if (flags.silentCheck) {
@@ -2685,9 +2929,9 @@ export default class Component extends Element {
2685
2929
  * @param {*} data - The root data you wish to use for this component.
2686
2930
  * @param {*} row - The contextual row data you wish to use for this component.
2687
2931
  * @param {*} flags - The flags to control the behavior of the validation.
2688
- * @returns
2932
+ * @returns {Array<any>} - An array of errors if the component is invalid.
2689
2933
  */
2690
- validateComponent(data, row, flags = {}) {
2934
+ validateComponent(data = null, row = null, flags = {}) {
2691
2935
  data = data || this.rootValue;
2692
2936
  row = row || this.data;
2693
2937
  const { async = false } = flags;
@@ -2718,13 +2962,14 @@ export default class Component extends Element {
2718
2962
  }
2719
2963
  /**
2720
2964
  * Checks the validity of this component and sets the error message if it is invalid.
2721
- *
2722
- * @param data
2723
- * @param dirty
2724
- * @param row
2725
- * @return {boolean}
2726
- */
2727
- checkComponentValidity(data, dirty, row, flags = {}, allErrors = []) {
2965
+ * @param {*} data - The data to check if the component is valid.
2966
+ * @param {boolean} dirty - If the component is dirty.
2967
+ * @param {*} row - The contextual row data for this component.
2968
+ * @param {*} flags - The flags to use when checking the validity.
2969
+ * @param {Array<any>} allErrors - An array of all errors that have occured so that it can be appended when another one occurs here.
2970
+ * @returns {boolean} - TRUE if the component is valid.
2971
+ */
2972
+ checkComponentValidity(data = null, dirty = false, row = null, flags = {}, allErrors = []) {
2728
2973
  data = data || this.rootValue;
2729
2974
  row = row || this.data;
2730
2975
  flags.dirty = dirty || false;
@@ -2760,32 +3005,30 @@ export default class Component extends Element {
2760
3005
  }
2761
3006
  /**
2762
3007
  * Checks the validity of the component.
2763
- * @param {*} data
2764
- * @param {*} dirty
2765
- * @param {*} row
2766
- * @param {*} silentCheck
2767
- * @returns
2768
- */
2769
- checkValidity(data, dirty, row, silentCheck, errors = []) {
3008
+ * @param {*} data - The data to check if the component is valid.
3009
+ * @param {boolean} dirty - If the component is dirty.
3010
+ * @param {*} row - The contextual row data for this component.
3011
+ * @param {boolean} silentCheck - If the check should be silent and not set the error messages.
3012
+ * @param {Array<any>} errors - An array of all errors that have occured so that it can be appended when another one occurs here.
3013
+ * @returns {boolean} - TRUE if the component is valid.
3014
+ */
3015
+ checkValidity(data = null, dirty = false, row = null, silentCheck = false, errors = []) {
2770
3016
  data = data || this.rootValue;
2771
3017
  row = row || this.data;
2772
- console.log('Deprecation warning: Component.checkValidity() will be deprecated in 6.x version of renderer. Use Component.validateComponent instead.');
2773
3018
  return this.checkComponentValidity(data, dirty, row, { silentCheck }, errors);
2774
3019
  }
2775
- checkAsyncValidity(data, dirty, row, silentCheck, errors = []) {
2776
- console.log('Deprecation warning: Component.checkAsyncValidity() will be deprecated in 6.x version of renderer. Use Component.validateComponent instead.');
3020
+ checkAsyncValidity(data = null, dirty = false, row = null, silentCheck = false, errors = []) {
2777
3021
  return this.checkComponentValidity(data, dirty, row, { async: true, silentCheck }, errors);
2778
3022
  }
2779
3023
  /**
2780
3024
  * Check the conditions, calculations, and validity of a single component and triggers an update if
2781
3025
  * something changed.
2782
- *
2783
- * @param data - The root data of the change event.
2784
- * @param flags - The flags from this change event.
2785
- *
2786
- * @return boolean - If component is valid or not.
3026
+ * @param {*} data - The root data of the change event.
3027
+ * @param {*} flags - The flags from this change event.
3028
+ * @param {*} row - The contextual row data for this component.
3029
+ * @returns {void|boolean} - TRUE if no check should be performed on the component.
2787
3030
  */
2788
- checkData(data, flags, row) {
3031
+ checkData(data = null, flags = null, row = null) {
2789
3032
  data = data || this.rootValue;
2790
3033
  flags = flags || {};
2791
3034
  row = row || this.data;
@@ -2828,8 +3071,7 @@ export default class Component extends Element {
2828
3071
  }
2829
3072
  /**
2830
3073
  * Check if a component is eligible for multiple validation
2831
- *
2832
- * @return {boolean}
3074
+ * @returns {boolean} - TRUE if the component is eligible for multiple validation.
2833
3075
  */
2834
3076
  validateMultiple() {
2835
3077
  return true;
@@ -2947,8 +3189,7 @@ export default class Component extends Element {
2947
3189
  /**
2948
3190
  * Determines if the value of this component is hidden from the user as if it is coming from the server, but is
2949
3191
  * protected.
2950
- *
2951
- * @return {boolean|*}
3192
+ * @returns {boolean|*} - TRUE if the value is hidden.
2952
3193
  */
2953
3194
  isValueHidden() {
2954
3195
  if (this.component.protected && this.root.editing) {
@@ -2993,6 +3234,8 @@ export default class Component extends Element {
2993
3234
  }
2994
3235
  /**
2995
3236
  * Prints out the value of this component as a string value.
3237
+ * @param {*} value - The value to print out.
3238
+ * @returns {string} - The string representation of the value.
2996
3239
  */
2997
3240
  asString(value) {
2998
3241
  value = value || this.getValue();
@@ -3000,15 +3243,14 @@ export default class Component extends Element {
3000
3243
  }
3001
3244
  /**
3002
3245
  * Return if the component is disabled.
3003
- * @return {boolean}
3246
+ * @returns {boolean} - TRUE if the component is disabled.
3004
3247
  */
3005
3248
  get disabled() {
3006
3249
  return this._disabled || this.parentDisabled;
3007
3250
  }
3008
3251
  /**
3009
3252
  * Disable this component.
3010
- *
3011
- * @param {boolean} disabled
3253
+ * @param {boolean} disabled - TRUE to disable the component.
3012
3254
  */
3013
3255
  set disabled(disabled) {
3014
3256
  this._disabled = disabled;
@@ -3133,6 +3375,7 @@ export default class Component extends Element {
3133
3375
  }
3134
3376
  /**
3135
3377
  * Get the element information.
3378
+ * @returns {*} - The components "input" DOM element information.
3136
3379
  */
3137
3380
  elementInfo() {
3138
3381
  const attributes = {
@@ -3171,14 +3414,12 @@ export default class Component extends Element {
3171
3414
  const { left, top } = element.getBoundingClientRect();
3172
3415
  window.scrollTo(left + window.scrollX, top + window.scrollY);
3173
3416
  }
3174
- focus(index) {
3417
+ focus(index = (this.refs.input.length - 1)) {
3175
3418
  if ('beforeFocus' in this.parent) {
3176
3419
  this.parent.beforeFocus(this);
3177
3420
  }
3178
3421
  if (this.refs.input?.length) {
3179
- const focusingInput = typeof index === 'number' && this.refs.input[index]
3180
- ? this.refs.input[index]
3181
- : this.refs.input[this.refs.input.length - 1];
3422
+ const focusingInput = this.refs.input[index];
3182
3423
  if (this.component.widget?.type === 'calendar') {
3183
3424
  const sibling = focusingInput.nextSibling;
3184
3425
  if (sibling) {
@@ -3198,6 +3439,7 @@ export default class Component extends Element {
3198
3439
  }
3199
3440
  /**
3200
3441
  * Get `Formio` instance for working with files
3442
+ * @returns {import('@formio/core').Formio} - The Formio instance file service.
3201
3443
  */
3202
3444
  get fileService() {
3203
3445
  if (this.options.fileService) {