@formio/js 5.0.0-dev.5613.77144cc → 5.0.0-dev.5614.b5c93f3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (581) hide show
  1. package/Changelog.md +73 -4
  2. package/dist/formio.builder.css +8 -13
  3. package/dist/formio.builder.min.css +1 -1
  4. package/dist/formio.embed.js +1 -1
  5. package/dist/formio.embed.min.js +1 -1
  6. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  7. package/dist/formio.form.css +8 -13
  8. package/dist/formio.form.js +803 -1226
  9. package/dist/formio.form.min.css +1 -1
  10. package/dist/formio.form.min.js +1 -1
  11. package/dist/formio.form.min.js.LICENSE.txt +3 -3
  12. package/dist/formio.full.css +8 -13
  13. package/dist/formio.full.js +722 -941
  14. package/dist/formio.full.min.css +1 -1
  15. package/dist/formio.full.min.js +1 -1
  16. package/dist/formio.full.min.js.LICENSE.txt +3 -3
  17. package/dist/formio.js +18 -18
  18. package/dist/formio.min.js +1 -1
  19. package/dist/formio.min.js.LICENSE.txt +1 -1
  20. package/dist/formio.utils.js +1853 -466
  21. package/dist/formio.utils.min.js +1 -1
  22. package/dist/formio.utils.min.js.LICENSE.txt +10 -2
  23. package/embed.d.ts +1 -0
  24. package/form.d.ts +1 -0
  25. package/lib/cjs/CDN.d.ts +1 -0
  26. package/lib/cjs/CDN.js +6 -3
  27. package/lib/cjs/Element.d.ts +87 -98
  28. package/lib/cjs/Element.js +76 -95
  29. package/lib/cjs/Embed.d.ts +1 -1
  30. package/lib/cjs/Embed.js +52 -12
  31. package/lib/cjs/Form.d.ts +365 -36
  32. package/lib/cjs/Form.js +50 -75
  33. package/lib/cjs/FormBuilder.d.ts +187 -2
  34. package/lib/cjs/FormBuilder.js +30 -8
  35. package/lib/cjs/Formio.js +12 -0
  36. package/lib/cjs/InlineEmbed.d.ts +7 -0
  37. package/lib/cjs/InlineEmbed.js +116 -0
  38. package/lib/cjs/PDF.d.ts +11 -13
  39. package/lib/cjs/PDF.js +7 -16
  40. package/lib/cjs/PDFBuilder.js +3 -3
  41. package/lib/cjs/Webform.d.ts +193 -140
  42. package/lib/cjs/Webform.js +341 -306
  43. package/lib/cjs/WebformBuilder.d.ts +18 -15
  44. package/lib/cjs/WebformBuilder.js +34 -27
  45. package/lib/cjs/Wizard.d.ts +31 -21
  46. package/lib/cjs/Wizard.js +44 -21
  47. package/lib/cjs/WizardBuilder.d.ts +1 -1
  48. package/lib/cjs/addons/FormioAddon.d.ts +0 -1
  49. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +8 -5
  50. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +6 -3
  51. package/lib/cjs/components/Components.d.ts +4 -4
  52. package/lib/cjs/components/Components.js +3 -3
  53. package/lib/cjs/components/_classes/component/Component.d.ts +516 -270
  54. package/lib/cjs/components/_classes/component/Component.form.d.ts +6 -3
  55. package/lib/cjs/components/_classes/component/Component.form.js +5 -0
  56. package/lib/cjs/components/_classes/component/Component.js +470 -246
  57. package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +1 -1
  58. package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +2 -2
  59. package/lib/cjs/components/_classes/component/editForm/utils.js +2 -2
  60. package/lib/cjs/components/_classes/component/fixtures/comp6.d.ts +77 -0
  61. package/lib/cjs/components/_classes/component/fixtures/comp6.js +59 -0
  62. package/lib/cjs/components/_classes/component/fixtures/comp7.d.ts +84 -0
  63. package/lib/cjs/components/_classes/component/fixtures/comp7.js +86 -0
  64. package/lib/cjs/components/_classes/component/fixtures/index.d.ts +3 -1
  65. package/lib/cjs/components/_classes/component/fixtures/index.js +5 -1
  66. package/lib/cjs/components/_classes/field/Field.d.ts +11 -2
  67. package/lib/cjs/components/_classes/field/Field.js +13 -1
  68. package/lib/cjs/components/_classes/input/Input.d.ts +4 -3
  69. package/lib/cjs/components/_classes/input/Input.js +32 -23
  70. package/lib/cjs/components/_classes/list/ListComponent.d.ts +2 -2
  71. package/lib/cjs/components/_classes/list/ListComponent.form.d.ts +6 -3
  72. package/lib/cjs/components/_classes/list/ListComponent.form.js +5 -0
  73. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +43 -12
  74. package/lib/cjs/components/_classes/multivalue/Multivalue.js +44 -3
  75. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +164 -68
  76. package/lib/cjs/components/_classes/nested/NestedComponent.form.d.ts +6 -3
  77. package/lib/cjs/components/_classes/nested/NestedComponent.form.js +5 -0
  78. package/lib/cjs/components/_classes/nested/NestedComponent.js +182 -62
  79. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -2
  80. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  81. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +7 -1
  82. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +2 -3
  83. package/lib/cjs/components/address/Address.d.ts +4 -2
  84. package/lib/cjs/components/address/Address.form.d.ts +6 -3
  85. package/lib/cjs/components/address/Address.form.js +5 -0
  86. package/lib/cjs/components/address/Address.js +4 -0
  87. package/lib/cjs/components/address/editForm/Address.edit.provider.js +1 -1
  88. package/lib/cjs/components/button/Button.d.ts +4 -13
  89. package/lib/cjs/components/button/Button.form.d.ts +6 -3
  90. package/lib/cjs/components/button/Button.form.js +5 -0
  91. package/lib/cjs/components/button/Button.js +12 -7
  92. package/lib/cjs/components/checkbox/Checkbox.d.ts +5 -28
  93. package/lib/cjs/components/checkbox/Checkbox.form.d.ts +6 -3
  94. package/lib/cjs/components/checkbox/Checkbox.form.js +5 -0
  95. package/lib/cjs/components/checkbox/Checkbox.js +1 -1
  96. package/lib/cjs/components/checkbox/fixtures/comp6.d.ts +32 -0
  97. package/lib/cjs/components/checkbox/fixtures/comp6.js +30 -0
  98. package/lib/cjs/components/checkbox/fixtures/index.d.ts +2 -1
  99. package/lib/cjs/components/checkbox/fixtures/index.js +3 -1
  100. package/lib/cjs/components/columns/Columns.d.ts +3 -2
  101. package/lib/cjs/components/columns/Columns.form.d.ts +6 -3
  102. package/lib/cjs/components/columns/Columns.form.js +5 -0
  103. package/lib/cjs/components/columns/Columns.js +3 -3
  104. package/lib/cjs/components/container/Container.form.d.ts +6 -3
  105. package/lib/cjs/components/container/Container.form.js +5 -0
  106. package/lib/cjs/components/content/Content.d.ts +2 -1
  107. package/lib/cjs/components/content/Content.form.d.ts +6 -3
  108. package/lib/cjs/components/content/Content.form.js +5 -0
  109. package/lib/cjs/components/currency/Currency.form.d.ts +6 -3
  110. package/lib/cjs/components/currency/Currency.form.js +5 -0
  111. package/lib/cjs/components/currency/Currency.js +1 -2
  112. package/lib/cjs/components/datagrid/DataGrid.d.ts +17 -7
  113. package/lib/cjs/components/datagrid/DataGrid.form.d.ts +6 -3
  114. package/lib/cjs/components/datagrid/DataGrid.form.js +5 -0
  115. package/lib/cjs/components/datagrid/DataGrid.js +55 -37
  116. package/lib/cjs/components/datagrid/fixtures/comp-with-checkboxes.d.ts +29 -0
  117. package/lib/cjs/components/datagrid/fixtures/comp-with-checkboxes.js +36 -0
  118. package/lib/cjs/components/datagrid/fixtures/comp-with-reorder.d.ts +100 -0
  119. package/lib/cjs/components/datagrid/fixtures/comp-with-reorder.js +139 -0
  120. package/lib/cjs/components/datagrid/fixtures/comp10.d.ts +81 -0
  121. package/lib/cjs/components/datagrid/fixtures/comp10.js +87 -0
  122. package/lib/cjs/components/datagrid/fixtures/comp9.d.ts +41 -0
  123. package/lib/cjs/components/datagrid/fixtures/comp9.js +44 -0
  124. package/lib/cjs/components/datagrid/fixtures/index.d.ts +5 -1
  125. package/lib/cjs/components/datagrid/fixtures/index.js +9 -1
  126. package/lib/cjs/components/datamap/DataMap.d.ts +1 -0
  127. package/lib/cjs/components/datamap/DataMap.form.d.ts +6 -3
  128. package/lib/cjs/components/datamap/DataMap.form.js +5 -0
  129. package/lib/cjs/components/datetime/DateTime.d.ts +0 -14
  130. package/lib/cjs/components/datetime/DateTime.form.d.ts +6 -3
  131. package/lib/cjs/components/datetime/DateTime.form.js +5 -0
  132. package/lib/cjs/components/datetime/editForm/DateTime.edit.date.js +2 -2
  133. package/lib/cjs/components/day/Day.d.ts +23 -49
  134. package/lib/cjs/components/day/Day.form.d.ts +6 -3
  135. package/lib/cjs/components/day/Day.form.js +5 -0
  136. package/lib/cjs/components/day/Day.js +16 -21
  137. package/lib/cjs/components/day/fixtures/comp7.d.ts +109 -0
  138. package/lib/cjs/components/day/fixtures/comp7.js +109 -0
  139. package/lib/cjs/components/day/fixtures/comp8.d.ts +41 -0
  140. package/lib/cjs/components/day/fixtures/comp8.js +40 -0
  141. package/lib/cjs/components/day/fixtures/index.d.ts +3 -1
  142. package/lib/cjs/components/day/fixtures/index.js +5 -1
  143. package/lib/cjs/components/editgrid/EditGrid.d.ts +8 -4
  144. package/lib/cjs/components/editgrid/EditGrid.form.d.ts +6 -3
  145. package/lib/cjs/components/editgrid/EditGrid.form.js +5 -0
  146. package/lib/cjs/components/editgrid/EditGrid.js +12 -26
  147. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +2 -5
  148. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.templates.js +6 -9
  149. package/lib/cjs/components/email/Email.form.d.ts +6 -3
  150. package/lib/cjs/components/email/Email.form.js +5 -0
  151. package/lib/cjs/components/fieldset/Fieldset.form.d.ts +6 -3
  152. package/lib/cjs/components/fieldset/Fieldset.form.js +5 -0
  153. package/lib/cjs/components/file/File.d.ts +9 -23
  154. package/lib/cjs/components/file/File.form.d.ts +6 -3
  155. package/lib/cjs/components/file/File.form.js +5 -0
  156. package/lib/cjs/components/file/File.js +3 -4
  157. package/lib/cjs/components/form/Form.d.ts +38 -20
  158. package/lib/cjs/components/form/Form.form.d.ts +6 -3
  159. package/lib/cjs/components/form/Form.form.js +5 -0
  160. package/lib/cjs/components/form/Form.js +33 -20
  161. package/lib/cjs/components/hidden/Hidden.d.ts +1 -11
  162. package/lib/cjs/components/hidden/Hidden.form.d.ts +6 -3
  163. package/lib/cjs/components/hidden/Hidden.form.js +5 -0
  164. package/lib/cjs/components/hidden/Hidden.js +1 -2
  165. package/lib/cjs/components/html/HTML.d.ts +2 -1
  166. package/lib/cjs/components/html/HTML.form.d.ts +6 -3
  167. package/lib/cjs/components/html/HTML.form.js +5 -0
  168. package/lib/cjs/components/number/Number.d.ts +3 -17
  169. package/lib/cjs/components/number/Number.form.d.ts +6 -3
  170. package/lib/cjs/components/number/Number.form.js +5 -0
  171. package/lib/cjs/components/number/Number.js +2 -3
  172. package/lib/cjs/components/number/fixtures/comp8.d.ts +32 -0
  173. package/lib/cjs/components/number/fixtures/comp8.js +28 -0
  174. package/lib/cjs/components/number/fixtures/index.d.ts +2 -1
  175. package/lib/cjs/components/number/fixtures/index.js +3 -1
  176. package/lib/cjs/components/panel/Panel.form.d.ts +6 -3
  177. package/lib/cjs/components/panel/Panel.form.js +5 -0
  178. package/lib/cjs/components/panel/Panel.js +0 -1
  179. package/lib/cjs/components/password/Password.form.d.ts +6 -3
  180. package/lib/cjs/components/password/Password.form.js +5 -0
  181. package/lib/cjs/components/phonenumber/PhoneNumber.form.d.ts +6 -3
  182. package/lib/cjs/components/phonenumber/PhoneNumber.form.js +5 -0
  183. package/lib/cjs/components/phonenumber/fixtures/comp2.d.ts +16 -0
  184. package/lib/cjs/components/phonenumber/fixtures/comp2.js +25 -0
  185. package/lib/cjs/components/phonenumber/fixtures/index.d.ts +2 -1
  186. package/lib/cjs/components/phonenumber/fixtures/index.js +3 -1
  187. package/lib/cjs/components/radio/Radio.d.ts +4 -27
  188. package/lib/cjs/components/radio/Radio.form.d.ts +6 -3
  189. package/lib/cjs/components/radio/Radio.form.js +5 -0
  190. package/lib/cjs/components/radio/Radio.js +11 -9
  191. package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +2 -9
  192. package/lib/cjs/components/recaptcha/ReCaptcha.form.d.ts +6 -3
  193. package/lib/cjs/components/recaptcha/ReCaptcha.form.js +7 -2
  194. package/lib/cjs/components/recaptcha/ReCaptcha.js +1 -8
  195. package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.d.ts +33 -2
  196. package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +13 -2
  197. package/lib/cjs/components/select/Select.d.ts +16 -39
  198. package/lib/cjs/components/select/Select.form.d.ts +6 -3
  199. package/lib/cjs/components/select/Select.form.js +5 -0
  200. package/lib/cjs/components/select/Select.js +23 -24
  201. package/lib/cjs/components/select/editForm/Select.edit.data.js +16 -2
  202. package/lib/cjs/components/select/fixtures/comp22.js +1 -1
  203. package/lib/cjs/components/select/fixtures/comp23.d.ts +58 -0
  204. package/lib/cjs/components/select/fixtures/comp23.js +49 -0
  205. package/lib/cjs/components/select/fixtures/comp24.d.ts +47 -0
  206. package/lib/cjs/components/select/fixtures/comp24.js +40 -0
  207. package/lib/cjs/components/select/fixtures/index.d.ts +3 -1
  208. package/lib/cjs/components/select/fixtures/index.js +5 -1
  209. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +2 -17
  210. package/lib/cjs/components/selectboxes/SelectBoxes.form.d.ts +6 -3
  211. package/lib/cjs/components/selectboxes/SelectBoxes.form.js +5 -0
  212. package/lib/cjs/components/selectboxes/SelectBoxes.js +11 -10
  213. package/lib/cjs/components/signature/Signature.d.ts +0 -14
  214. package/lib/cjs/components/signature/Signature.form.d.ts +6 -3
  215. package/lib/cjs/components/signature/Signature.form.js +5 -0
  216. package/lib/cjs/components/signature/Signature.js +1 -1
  217. package/lib/cjs/components/survey/Survey.d.ts +3 -15
  218. package/lib/cjs/components/survey/Survey.form.d.ts +6 -3
  219. package/lib/cjs/components/survey/Survey.form.js +5 -0
  220. package/lib/cjs/components/table/Table.d.ts +3 -1
  221. package/lib/cjs/components/table/Table.form.d.ts +6 -3
  222. package/lib/cjs/components/table/Table.form.js +5 -0
  223. package/lib/cjs/components/table/Table.js +1 -1
  224. package/lib/cjs/components/tabs/Tabs.d.ts +4 -4
  225. package/lib/cjs/components/tabs/Tabs.form.d.ts +6 -3
  226. package/lib/cjs/components/tabs/Tabs.form.js +5 -0
  227. package/lib/cjs/components/tabs/Tabs.js +1 -2
  228. package/lib/cjs/components/tags/Tags.d.ts +0 -14
  229. package/lib/cjs/components/tags/Tags.form.d.ts +6 -3
  230. package/lib/cjs/components/tags/Tags.form.js +5 -0
  231. package/lib/cjs/components/tags/Tags.js +2 -4
  232. package/lib/cjs/components/textarea/TextArea.d.ts +4 -9
  233. package/lib/cjs/components/textarea/TextArea.form.d.ts +6 -3
  234. package/lib/cjs/components/textarea/TextArea.form.js +5 -0
  235. package/lib/cjs/components/textarea/TextArea.js +2 -2
  236. package/lib/cjs/components/textfield/TextField.d.ts +14 -30
  237. package/lib/cjs/components/textfield/TextField.form.d.ts +6 -3
  238. package/lib/cjs/components/textfield/TextField.form.js +5 -0
  239. package/lib/cjs/components/textfield/TextField.js +16 -17
  240. package/lib/cjs/components/time/Time.form.d.ts +6 -3
  241. package/lib/cjs/components/time/Time.form.js +5 -0
  242. package/lib/cjs/components/unknown/Unknown.form.d.ts +5 -34
  243. package/lib/cjs/components/unknown/Unknown.form.js +4 -0
  244. package/lib/cjs/components/url/Url.form.d.ts +6 -3
  245. package/lib/cjs/components/url/Url.form.js +5 -0
  246. package/lib/cjs/components/well/Well.form.d.ts +6 -3
  247. package/lib/cjs/components/well/Well.form.js +5 -0
  248. package/lib/cjs/formio.embed.d.ts +1 -2
  249. package/lib/cjs/formio.embed.js +2 -100
  250. package/lib/cjs/formio.form.d.ts +11 -4
  251. package/lib/cjs/formio.form.js +13 -5
  252. package/lib/cjs/providers/Providers.d.ts +36 -5
  253. package/lib/cjs/providers/Providers.js +29 -0
  254. package/lib/cjs/providers/address/AddressProvider.d.ts +131 -12
  255. package/lib/cjs/providers/address/AddressProvider.js +88 -2
  256. package/lib/cjs/providers/address/AzureAddressProvider.d.ts +48 -1
  257. package/lib/cjs/providers/address/AzureAddressProvider.js +37 -0
  258. package/lib/cjs/providers/address/CustomAddressProvider.d.ts +27 -4
  259. package/lib/cjs/providers/address/CustomAddressProvider.js +34 -0
  260. package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +135 -6
  261. package/lib/cjs/providers/address/GoogleAddressProvider.js +95 -1
  262. package/lib/cjs/providers/address/NominatimAddressProvider.d.ts +32 -7
  263. package/lib/cjs/providers/address/NominatimAddressProvider.js +33 -0
  264. package/lib/cjs/providers/address/index.d.ts +3 -1
  265. package/lib/cjs/providers/processor/fileProcessor.d.ts +7 -1
  266. package/lib/cjs/providers/processor/fileProcessor.js +6 -0
  267. package/lib/cjs/providers/storage/azure.d.ts +6 -13
  268. package/lib/cjs/providers/storage/azure.js +5 -0
  269. package/lib/cjs/providers/storage/base64.d.ts +5 -6
  270. package/lib/cjs/providers/storage/base64.js +4 -0
  271. package/lib/cjs/providers/storage/dropbox.d.ts +6 -4
  272. package/lib/cjs/providers/storage/dropbox.js +5 -0
  273. package/lib/cjs/providers/storage/googleDrive.d.ts +7 -5
  274. package/lib/cjs/providers/storage/googleDrive.js +6 -0
  275. package/lib/cjs/providers/storage/indexeddb.d.ts +5 -7
  276. package/lib/cjs/providers/storage/indexeddb.js +4 -0
  277. package/lib/cjs/providers/storage/s3.d.ts +6 -20
  278. package/lib/cjs/providers/storage/s3.js +5 -0
  279. package/lib/cjs/providers/storage/url.d.ts +6 -7
  280. package/lib/cjs/providers/storage/url.js +10 -0
  281. package/lib/cjs/providers/storage/util.d.ts +24 -1
  282. package/lib/cjs/providers/storage/util.js +18 -0
  283. package/lib/cjs/templates/Templates.d.ts +1 -0
  284. package/lib/cjs/translations/en.d.ts +5 -0
  285. package/lib/cjs/translations/en.js +6 -1
  286. package/lib/cjs/utils/ChoicesWrapper.d.ts +1 -1
  287. package/lib/cjs/utils/ChoicesWrapper.js +13 -2
  288. package/lib/cjs/utils/Evaluator.d.ts +6 -3
  289. package/lib/cjs/utils/Evaluator.js +11 -20
  290. package/lib/cjs/utils/builder.d.ts +9 -7
  291. package/lib/cjs/utils/builder.js +10 -5
  292. package/lib/cjs/utils/calendarUtils.d.ts +7 -13
  293. package/lib/cjs/utils/calendarUtils.js +10 -17
  294. package/lib/cjs/utils/conditionOperators/IsEmptyValue.js +4 -3
  295. package/lib/cjs/utils/conditionOperators/IsEqualTo.js +3 -3
  296. package/lib/cjs/utils/formUtils.d.ts +43 -171
  297. package/lib/cjs/utils/formUtils.js +38 -569
  298. package/lib/cjs/utils/utils.d.ts +367 -218
  299. package/lib/cjs/utils/utils.js +420 -252
  300. package/lib/cjs/widgets/CalendarWidget.d.ts +9 -10
  301. package/lib/cjs/widgets/CalendarWidget.js +11 -13
  302. package/lib/mjs/CDN.d.ts +1 -0
  303. package/lib/mjs/CDN.js +6 -3
  304. package/lib/mjs/Element.d.ts +87 -98
  305. package/lib/mjs/Element.js +76 -95
  306. package/lib/mjs/Embed.d.ts +1 -1
  307. package/lib/mjs/Embed.js +52 -12
  308. package/lib/mjs/Form.d.ts +365 -36
  309. package/lib/mjs/Form.js +140 -68
  310. package/lib/mjs/FormBuilder.d.ts +187 -2
  311. package/lib/mjs/FormBuilder.js +32 -8
  312. package/lib/mjs/Formio.js +12 -0
  313. package/lib/mjs/InlineEmbed.d.ts +7 -0
  314. package/lib/mjs/InlineEmbed.js +112 -0
  315. package/lib/mjs/PDF.d.ts +11 -13
  316. package/lib/mjs/PDF.js +7 -16
  317. package/lib/mjs/PDFBuilder.js +3 -3
  318. package/lib/mjs/Webform.d.ts +193 -140
  319. package/lib/mjs/Webform.js +353 -318
  320. package/lib/mjs/WebformBuilder.d.ts +18 -15
  321. package/lib/mjs/WebformBuilder.js +34 -27
  322. package/lib/mjs/Wizard.d.ts +31 -21
  323. package/lib/mjs/Wizard.js +43 -20
  324. package/lib/mjs/WizardBuilder.d.ts +1 -1
  325. package/lib/mjs/addons/FormioAddon.d.ts +0 -1
  326. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +8 -5
  327. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +6 -3
  328. package/lib/mjs/components/Components.d.ts +4 -4
  329. package/lib/mjs/components/Components.js +3 -3
  330. package/lib/mjs/components/_classes/component/Component.d.ts +516 -270
  331. package/lib/mjs/components/_classes/component/Component.form.d.ts +6 -3
  332. package/lib/mjs/components/_classes/component/Component.form.js +5 -0
  333. package/lib/mjs/components/_classes/component/Component.js +479 -247
  334. package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +1 -1
  335. package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +1 -1
  336. package/lib/mjs/components/_classes/component/editForm/utils.js +1 -1
  337. package/lib/mjs/components/_classes/component/fixtures/comp6.d.ts +77 -0
  338. package/lib/mjs/components/_classes/component/fixtures/comp6.js +57 -0
  339. package/lib/mjs/components/_classes/component/fixtures/comp7.d.ts +84 -0
  340. package/lib/mjs/components/_classes/component/fixtures/comp7.js +84 -0
  341. package/lib/mjs/components/_classes/component/fixtures/index.d.ts +3 -1
  342. package/lib/mjs/components/_classes/component/fixtures/index.js +3 -1
  343. package/lib/mjs/components/_classes/field/Field.d.ts +11 -2
  344. package/lib/mjs/components/_classes/field/Field.js +13 -1
  345. package/lib/mjs/components/_classes/input/Input.d.ts +4 -3
  346. package/lib/mjs/components/_classes/input/Input.js +31 -23
  347. package/lib/mjs/components/_classes/list/ListComponent.d.ts +2 -2
  348. package/lib/mjs/components/_classes/list/ListComponent.form.d.ts +6 -3
  349. package/lib/mjs/components/_classes/list/ListComponent.form.js +5 -0
  350. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +43 -12
  351. package/lib/mjs/components/_classes/multivalue/Multivalue.js +44 -3
  352. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +164 -68
  353. package/lib/mjs/components/_classes/nested/NestedComponent.form.d.ts +6 -3
  354. package/lib/mjs/components/_classes/nested/NestedComponent.form.js +5 -0
  355. package/lib/mjs/components/_classes/nested/NestedComponent.js +182 -62
  356. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -2
  357. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  358. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +7 -1
  359. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +2 -3
  360. package/lib/mjs/components/address/Address.d.ts +4 -2
  361. package/lib/mjs/components/address/Address.form.d.ts +6 -3
  362. package/lib/mjs/components/address/Address.form.js +5 -0
  363. package/lib/mjs/components/address/Address.js +4 -0
  364. package/lib/mjs/components/address/editForm/Address.edit.provider.js +1 -1
  365. package/lib/mjs/components/button/Button.d.ts +4 -13
  366. package/lib/mjs/components/button/Button.form.d.ts +6 -3
  367. package/lib/mjs/components/button/Button.form.js +5 -0
  368. package/lib/mjs/components/button/Button.js +12 -7
  369. package/lib/mjs/components/checkbox/Checkbox.d.ts +5 -28
  370. package/lib/mjs/components/checkbox/Checkbox.form.d.ts +6 -3
  371. package/lib/mjs/components/checkbox/Checkbox.form.js +5 -0
  372. package/lib/mjs/components/checkbox/Checkbox.js +1 -1
  373. package/lib/mjs/components/checkbox/fixtures/comp6.d.ts +32 -0
  374. package/lib/mjs/components/checkbox/fixtures/comp6.js +28 -0
  375. package/lib/mjs/components/checkbox/fixtures/index.d.ts +2 -1
  376. package/lib/mjs/components/checkbox/fixtures/index.js +2 -1
  377. package/lib/mjs/components/columns/Columns.d.ts +3 -2
  378. package/lib/mjs/components/columns/Columns.form.d.ts +6 -3
  379. package/lib/mjs/components/columns/Columns.form.js +5 -0
  380. package/lib/mjs/components/columns/Columns.js +3 -3
  381. package/lib/mjs/components/container/Container.form.d.ts +6 -3
  382. package/lib/mjs/components/container/Container.form.js +5 -0
  383. package/lib/mjs/components/content/Content.d.ts +2 -1
  384. package/lib/mjs/components/content/Content.form.d.ts +6 -3
  385. package/lib/mjs/components/content/Content.form.js +5 -0
  386. package/lib/mjs/components/currency/Currency.form.d.ts +6 -3
  387. package/lib/mjs/components/currency/Currency.form.js +5 -0
  388. package/lib/mjs/components/currency/Currency.js +1 -2
  389. package/lib/mjs/components/datagrid/DataGrid.d.ts +17 -7
  390. package/lib/mjs/components/datagrid/DataGrid.form.d.ts +6 -3
  391. package/lib/mjs/components/datagrid/DataGrid.form.js +5 -0
  392. package/lib/mjs/components/datagrid/DataGrid.js +55 -37
  393. package/lib/mjs/components/datagrid/fixtures/comp-with-checkboxes.d.ts +29 -0
  394. package/lib/mjs/components/datagrid/fixtures/comp-with-checkboxes.js +34 -0
  395. package/lib/mjs/components/datagrid/fixtures/comp-with-reorder.d.ts +100 -0
  396. package/lib/mjs/components/datagrid/fixtures/comp-with-reorder.js +137 -0
  397. package/lib/mjs/components/datagrid/fixtures/comp10.d.ts +81 -0
  398. package/lib/mjs/components/datagrid/fixtures/comp10.js +85 -0
  399. package/lib/mjs/components/datagrid/fixtures/comp9.d.ts +41 -0
  400. package/lib/mjs/components/datagrid/fixtures/comp9.js +42 -0
  401. package/lib/mjs/components/datagrid/fixtures/index.d.ts +5 -1
  402. package/lib/mjs/components/datagrid/fixtures/index.js +5 -1
  403. package/lib/mjs/components/datamap/DataMap.d.ts +1 -0
  404. package/lib/mjs/components/datamap/DataMap.form.d.ts +6 -3
  405. package/lib/mjs/components/datamap/DataMap.form.js +5 -0
  406. package/lib/mjs/components/datetime/DateTime.d.ts +0 -14
  407. package/lib/mjs/components/datetime/DateTime.form.d.ts +6 -3
  408. package/lib/mjs/components/datetime/DateTime.form.js +5 -0
  409. package/lib/mjs/components/datetime/editForm/DateTime.edit.date.js +1 -1
  410. package/lib/mjs/components/day/Day.d.ts +23 -49
  411. package/lib/mjs/components/day/Day.form.d.ts +6 -3
  412. package/lib/mjs/components/day/Day.form.js +5 -0
  413. package/lib/mjs/components/day/Day.js +16 -21
  414. package/lib/mjs/components/day/fixtures/comp7.d.ts +109 -0
  415. package/lib/mjs/components/day/fixtures/comp7.js +107 -0
  416. package/lib/mjs/components/day/fixtures/comp8.d.ts +41 -0
  417. package/lib/mjs/components/day/fixtures/comp8.js +38 -0
  418. package/lib/mjs/components/day/fixtures/index.d.ts +3 -1
  419. package/lib/mjs/components/day/fixtures/index.js +3 -1
  420. package/lib/mjs/components/editgrid/EditGrid.d.ts +8 -4
  421. package/lib/mjs/components/editgrid/EditGrid.form.d.ts +6 -3
  422. package/lib/mjs/components/editgrid/EditGrid.form.js +5 -0
  423. package/lib/mjs/components/editgrid/EditGrid.js +12 -25
  424. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
  425. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.templates.js +1 -1
  426. package/lib/mjs/components/email/Email.form.d.ts +6 -3
  427. package/lib/mjs/components/email/Email.form.js +5 -0
  428. package/lib/mjs/components/fieldset/Fieldset.form.d.ts +6 -3
  429. package/lib/mjs/components/fieldset/Fieldset.form.js +5 -0
  430. package/lib/mjs/components/file/File.d.ts +9 -23
  431. package/lib/mjs/components/file/File.form.d.ts +6 -3
  432. package/lib/mjs/components/file/File.form.js +5 -0
  433. package/lib/mjs/components/file/File.js +3 -4
  434. package/lib/mjs/components/form/Form.d.ts +38 -20
  435. package/lib/mjs/components/form/Form.form.d.ts +6 -3
  436. package/lib/mjs/components/form/Form.form.js +5 -0
  437. package/lib/mjs/components/form/Form.js +31 -18
  438. package/lib/mjs/components/hidden/Hidden.d.ts +1 -11
  439. package/lib/mjs/components/hidden/Hidden.form.d.ts +6 -3
  440. package/lib/mjs/components/hidden/Hidden.form.js +5 -0
  441. package/lib/mjs/components/hidden/Hidden.js +1 -2
  442. package/lib/mjs/components/html/HTML.d.ts +2 -1
  443. package/lib/mjs/components/html/HTML.form.d.ts +6 -3
  444. package/lib/mjs/components/html/HTML.form.js +5 -0
  445. package/lib/mjs/components/number/Number.d.ts +3 -17
  446. package/lib/mjs/components/number/Number.form.d.ts +6 -3
  447. package/lib/mjs/components/number/Number.form.js +5 -0
  448. package/lib/mjs/components/number/Number.js +2 -3
  449. package/lib/mjs/components/number/fixtures/comp8.d.ts +32 -0
  450. package/lib/mjs/components/number/fixtures/comp8.js +26 -0
  451. package/lib/mjs/components/number/fixtures/index.d.ts +2 -1
  452. package/lib/mjs/components/number/fixtures/index.js +2 -1
  453. package/lib/mjs/components/panel/Panel.form.d.ts +6 -3
  454. package/lib/mjs/components/panel/Panel.form.js +5 -0
  455. package/lib/mjs/components/panel/Panel.js +0 -1
  456. package/lib/mjs/components/password/Password.form.d.ts +6 -3
  457. package/lib/mjs/components/password/Password.form.js +5 -0
  458. package/lib/mjs/components/phonenumber/PhoneNumber.form.d.ts +6 -3
  459. package/lib/mjs/components/phonenumber/PhoneNumber.form.js +5 -0
  460. package/lib/mjs/components/phonenumber/fixtures/comp2.d.ts +16 -0
  461. package/lib/mjs/components/phonenumber/fixtures/comp2.js +23 -0
  462. package/lib/mjs/components/phonenumber/fixtures/index.d.ts +2 -1
  463. package/lib/mjs/components/phonenumber/fixtures/index.js +2 -1
  464. package/lib/mjs/components/radio/Radio.d.ts +4 -27
  465. package/lib/mjs/components/radio/Radio.form.d.ts +6 -3
  466. package/lib/mjs/components/radio/Radio.form.js +5 -0
  467. package/lib/mjs/components/radio/Radio.js +11 -9
  468. package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +2 -9
  469. package/lib/mjs/components/recaptcha/ReCaptcha.form.d.ts +6 -3
  470. package/lib/mjs/components/recaptcha/ReCaptcha.form.js +7 -2
  471. package/lib/mjs/components/recaptcha/ReCaptcha.js +1 -8
  472. package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.d.ts +33 -2
  473. package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +13 -2
  474. package/lib/mjs/components/select/Select.d.ts +16 -39
  475. package/lib/mjs/components/select/Select.form.d.ts +6 -3
  476. package/lib/mjs/components/select/Select.form.js +5 -0
  477. package/lib/mjs/components/select/Select.js +24 -25
  478. package/lib/mjs/components/select/editForm/Select.edit.data.js +16 -2
  479. package/lib/mjs/components/select/fixtures/comp22.js +1 -1
  480. package/lib/mjs/components/select/fixtures/comp23.d.ts +58 -0
  481. package/lib/mjs/components/select/fixtures/comp23.js +47 -0
  482. package/lib/mjs/components/select/fixtures/comp24.d.ts +47 -0
  483. package/lib/mjs/components/select/fixtures/comp24.js +38 -0
  484. package/lib/mjs/components/select/fixtures/index.d.ts +3 -1
  485. package/lib/mjs/components/select/fixtures/index.js +3 -1
  486. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +2 -17
  487. package/lib/mjs/components/selectboxes/SelectBoxes.form.d.ts +6 -3
  488. package/lib/mjs/components/selectboxes/SelectBoxes.form.js +5 -0
  489. package/lib/mjs/components/selectboxes/SelectBoxes.js +11 -10
  490. package/lib/mjs/components/signature/Signature.d.ts +0 -14
  491. package/lib/mjs/components/signature/Signature.form.d.ts +6 -3
  492. package/lib/mjs/components/signature/Signature.form.js +5 -0
  493. package/lib/mjs/components/signature/Signature.js +1 -1
  494. package/lib/mjs/components/survey/Survey.d.ts +3 -15
  495. package/lib/mjs/components/survey/Survey.form.d.ts +6 -3
  496. package/lib/mjs/components/survey/Survey.form.js +5 -0
  497. package/lib/mjs/components/table/Table.d.ts +3 -1
  498. package/lib/mjs/components/table/Table.form.d.ts +6 -3
  499. package/lib/mjs/components/table/Table.form.js +5 -0
  500. package/lib/mjs/components/table/Table.js +1 -1
  501. package/lib/mjs/components/tabs/Tabs.d.ts +4 -4
  502. package/lib/mjs/components/tabs/Tabs.form.d.ts +6 -3
  503. package/lib/mjs/components/tabs/Tabs.form.js +5 -0
  504. package/lib/mjs/components/tabs/Tabs.js +1 -2
  505. package/lib/mjs/components/tags/Tags.d.ts +0 -14
  506. package/lib/mjs/components/tags/Tags.form.d.ts +6 -3
  507. package/lib/mjs/components/tags/Tags.form.js +5 -0
  508. package/lib/mjs/components/tags/Tags.js +2 -4
  509. package/lib/mjs/components/textarea/TextArea.d.ts +4 -9
  510. package/lib/mjs/components/textarea/TextArea.form.d.ts +6 -3
  511. package/lib/mjs/components/textarea/TextArea.form.js +5 -0
  512. package/lib/mjs/components/textarea/TextArea.js +2 -2
  513. package/lib/mjs/components/textfield/TextField.d.ts +14 -30
  514. package/lib/mjs/components/textfield/TextField.form.d.ts +6 -3
  515. package/lib/mjs/components/textfield/TextField.form.js +5 -0
  516. package/lib/mjs/components/textfield/TextField.js +16 -17
  517. package/lib/mjs/components/time/Time.form.d.ts +6 -3
  518. package/lib/mjs/components/time/Time.form.js +5 -0
  519. package/lib/mjs/components/unknown/Unknown.form.d.ts +5 -34
  520. package/lib/mjs/components/unknown/Unknown.form.js +4 -0
  521. package/lib/mjs/components/url/Url.form.d.ts +6 -3
  522. package/lib/mjs/components/url/Url.form.js +5 -0
  523. package/lib/mjs/components/well/Well.form.d.ts +6 -3
  524. package/lib/mjs/components/well/Well.form.js +5 -0
  525. package/lib/mjs/formio.embed.d.ts +1 -2
  526. package/lib/mjs/formio.embed.js +2 -99
  527. package/lib/mjs/formio.form.d.ts +11 -4
  528. package/lib/mjs/formio.form.js +10 -3
  529. package/lib/mjs/providers/Providers.d.ts +36 -5
  530. package/lib/mjs/providers/Providers.js +29 -0
  531. package/lib/mjs/providers/address/AddressProvider.d.ts +131 -12
  532. package/lib/mjs/providers/address/AddressProvider.js +88 -2
  533. package/lib/mjs/providers/address/AzureAddressProvider.d.ts +48 -1
  534. package/lib/mjs/providers/address/AzureAddressProvider.js +37 -0
  535. package/lib/mjs/providers/address/CustomAddressProvider.d.ts +27 -4
  536. package/lib/mjs/providers/address/CustomAddressProvider.js +34 -0
  537. package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +135 -6
  538. package/lib/mjs/providers/address/GoogleAddressProvider.js +94 -1
  539. package/lib/mjs/providers/address/NominatimAddressProvider.d.ts +32 -7
  540. package/lib/mjs/providers/address/NominatimAddressProvider.js +33 -0
  541. package/lib/mjs/providers/address/index.d.ts +3 -1
  542. package/lib/mjs/providers/processor/fileProcessor.d.ts +7 -1
  543. package/lib/mjs/providers/processor/fileProcessor.js +6 -0
  544. package/lib/mjs/providers/storage/azure.d.ts +6 -13
  545. package/lib/mjs/providers/storage/azure.js +5 -0
  546. package/lib/mjs/providers/storage/base64.d.ts +5 -6
  547. package/lib/mjs/providers/storage/base64.js +4 -0
  548. package/lib/mjs/providers/storage/dropbox.d.ts +6 -4
  549. package/lib/mjs/providers/storage/dropbox.js +5 -0
  550. package/lib/mjs/providers/storage/googleDrive.d.ts +7 -5
  551. package/lib/mjs/providers/storage/googleDrive.js +6 -0
  552. package/lib/mjs/providers/storage/indexeddb.d.ts +5 -7
  553. package/lib/mjs/providers/storage/indexeddb.js +4 -0
  554. package/lib/mjs/providers/storage/s3.d.ts +6 -20
  555. package/lib/mjs/providers/storage/s3.js +5 -0
  556. package/lib/mjs/providers/storage/url.d.ts +6 -7
  557. package/lib/mjs/providers/storage/url.js +10 -0
  558. package/lib/mjs/providers/storage/util.d.ts +24 -1
  559. package/lib/mjs/providers/storage/util.js +18 -0
  560. package/lib/mjs/templates/Templates.d.ts +1 -0
  561. package/lib/mjs/translations/en.d.ts +5 -0
  562. package/lib/mjs/translations/en.js +6 -1
  563. package/lib/mjs/utils/ChoicesWrapper.d.ts +1 -1
  564. package/lib/mjs/utils/ChoicesWrapper.js +13 -2
  565. package/lib/mjs/utils/Evaluator.d.ts +6 -3
  566. package/lib/mjs/utils/Evaluator.js +9 -20
  567. package/lib/mjs/utils/builder.d.ts +9 -7
  568. package/lib/mjs/utils/builder.js +10 -5
  569. package/lib/mjs/utils/calendarUtils.d.ts +7 -13
  570. package/lib/mjs/utils/calendarUtils.js +10 -17
  571. package/lib/mjs/utils/conditionOperators/IsEmptyValue.js +3 -3
  572. package/lib/mjs/utils/conditionOperators/IsEqualTo.js +1 -1
  573. package/lib/mjs/utils/formUtils.d.ts +43 -171
  574. package/lib/mjs/utils/formUtils.js +6 -554
  575. package/lib/mjs/utils/utils.d.ts +367 -218
  576. package/lib/mjs/utils/utils.js +409 -233
  577. package/lib/mjs/widgets/CalendarWidget.d.ts +9 -10
  578. package/lib/mjs/widgets/CalendarWidget.js +11 -13
  579. package/package.json +22 -23
  580. package/sdk.d.ts +1 -0
  581. package/utils.d.ts +1 -0
@@ -6,7 +6,7 @@ import isMobile from 'ismobilejs';
6
6
  import { processOne, processOneSync, validateProcessInfo } from '@formio/core/process';
7
7
  import { Formio } from '../../../Formio';
8
8
  import * as FormioUtils from '../../../utils/utils';
9
- import { fastCloneDeep, boolValue, getComponentPath, isInsideScopingComponent, currentTimezone } from '../../../utils/utils';
9
+ import { fastCloneDeep, boolValue, getComponentPath, isInsideScopingComponent, currentTimezone, getScriptPlugin } from '../../../utils/utils';
10
10
  import Element from '../../../Element';
11
11
  import ComponentModal from '../componentModal/ComponentModal';
12
12
  import Widgets from '../../../widgets';
@@ -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);
@@ -498,30 +485,10 @@ export default class Component extends Element {
498
485
  }
499
486
  return addon;
500
487
  }
501
- teardown() {
502
- if (this.element) {
503
- delete this.element.component;
504
- delete this.element;
505
- }
506
- delete this._currentForm;
507
- delete this.parent;
508
- delete this.root;
509
- delete this.triggerChange;
510
- delete this.triggerRedraw;
511
- if (this.options) {
512
- delete this.options.root;
513
- delete this.options.parent;
514
- delete this.options.i18next;
515
- }
516
- super.teardown();
517
- }
518
- destroy(all = false) {
519
- super.destroy(all);
488
+ destroy() {
489
+ super.destroy();
520
490
  this.detach();
521
491
  this.addons.forEach((addon) => addon.destroy());
522
- if (all) {
523
- this.teardown();
524
- }
525
492
  }
526
493
  get shouldDisabled() {
527
494
  return this.options.readOnly || this.component.disabled || (this.options.hasOwnProperty('disabled') && this.options.disabled[this.key]);
@@ -572,8 +539,8 @@ export default class Component extends Element {
572
539
  return this.shouldForceVisibility(component, 'show');
573
540
  }
574
541
  /**
575
- *
576
- * @param value {boolean}
542
+ * Sets the component visibility.
543
+ * @param {boolean} value - Whether the component should be visible or not.
577
544
  */
578
545
  set visible(value) {
579
546
  if (this._visible !== value) {
@@ -591,8 +558,8 @@ export default class Component extends Element {
591
558
  }
592
559
  }
593
560
  /**
594
- *
595
- * @returns {boolean}
561
+ * Returns the component visibility
562
+ * @returns {boolean} - Whether the component is visible or not.
596
563
  */
597
564
  get visible() {
598
565
  // Show only if visibility changes or if we are in builder mode or if hidden fields should be shown.
@@ -682,9 +649,10 @@ export default class Component extends Element {
682
649
  }
683
650
  /**
684
651
  * Returns only the schema that is different from the default.
685
- *
686
- * @param schema
687
- * @param defaultSchema
652
+ * @param {object} schema - The "full" json schema for the component.
653
+ * @param {object} defaultSchema - The "default" json schema for the component.
654
+ * @param {boolean} recursion - If we are currently in a recursive loop.
655
+ * @returns {object} - The minified json schema for this component.
688
656
  */
689
657
  getModifiedSchema(schema, defaultSchema, recursion) {
690
658
  const modified = {};
@@ -718,21 +686,24 @@ export default class Component extends Element {
718
686
  }
719
687
  /**
720
688
  * Returns the JSON schema for this component.
689
+ * @returns {object} - The JSON schema for this component.
721
690
  */
722
691
  get schema() {
723
692
  return fastCloneDeep(this.getModifiedSchema(_.omit(this.component, 'id'), this.defaultSchema));
724
693
  }
725
694
  /**
726
695
  * Returns true if component is inside DataGrid
696
+ * @returns {boolean} - True if component is inside DataGrid
727
697
  */
728
698
  get isInDataGrid() {
729
699
  return this.inDataGrid;
730
700
  }
731
701
  /**
732
702
  * Translate a text using the i18n system.
733
- *
734
703
  * @param {string} text - The i18n identifier.
735
- * @param {Object} params - The i18n parameters to use for translation.
704
+ * @param {object} params - The i18n parameters to use for translation.
705
+ * @param {...any} args - Additional arguments to pass to the translation library.
706
+ * @returns {string} - The translated text.
736
707
  */
737
708
  t(text, params = {}, ...args) {
738
709
  if (!text) {
@@ -822,7 +793,7 @@ export default class Component extends Element {
822
793
  isHtmlRenderMode() {
823
794
  return this.options.renderMode === 'html';
824
795
  }
825
- renderTemplate(name, data = {}, modeOption) {
796
+ renderTemplate(name, data = {}, modeOption = '') {
826
797
  // Need to make this fall back to form if renderMode is not found similar to how we search templates.
827
798
  const mode = modeOption || this.options.renderMode || 'form';
828
799
  data.component = this.component;
@@ -862,11 +833,12 @@ export default class Component extends Element {
862
833
  }
863
834
  /**
864
835
  * Sanitize an html string.
865
- *
866
- * @param string
867
- * @returns {*}
836
+ * @param {string} dirty - The dirty html string to sanitize.
837
+ * @param {boolean} forceSanitize - If we should force the sanitize to occur.
838
+ * @param {object} options - The options for the sanitize.
839
+ * @returns {*} - The sanitized html string.
868
840
  */
869
- sanitize(dirty, forceSanitize, options) {
841
+ sanitize(dirty, forceSanitize = false, options = {}) {
870
842
  if (!this.shouldSanitizeValue && !forceSanitize) {
871
843
  return dirty;
872
844
  }
@@ -876,12 +848,9 @@ export default class Component extends Element {
876
848
  }
877
849
  /**
878
850
  * 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.
851
+ * @param {string} template - The template to render.
852
+ * @param {object} data - The data to provide to the template.
853
+ * @returns {HTMLElement | string} - The created element or an empty string if template is not specified.
885
854
  */
886
855
  renderString(template, data) {
887
856
  if (!template) {
@@ -890,9 +859,18 @@ export default class Component extends Element {
890
859
  // Interpolate the template and populate
891
860
  return this.interpolate(template, data);
892
861
  }
862
+ /**
863
+ * Allows for modification of the component value prior to submission.
864
+ * @param {*} input - The input to be modified.
865
+ * @returns {*} - The modified input mapping for the extended component.
866
+ */
893
867
  performInputMapping(input) {
894
868
  return input;
895
869
  }
870
+ /**
871
+ * Returns the component "widget" if one is available.
872
+ * @returns {Widget|null} - The widget instance. null if not available.
873
+ */
896
874
  get widget() {
897
875
  const settings = this.component.widget;
898
876
  if (settings && this.root?.shadowRoot) {
@@ -901,6 +879,10 @@ export default class Component extends Element {
901
879
  const widget = settings && Widgets[settings.type] ? new Widgets[settings.type](settings, this.component, this) : null;
902
880
  return widget;
903
881
  }
882
+ /**
883
+ * Returns the native supported browser language.
884
+ * @returns {string|null} - The native browser language that is supported.
885
+ */
904
886
  getBrowserLanguage() {
905
887
  const nav = window.navigator;
906
888
  const browserLanguagePropertyKeys = ['language', 'browserLanguage', 'systemLanguage', 'userLanguage'];
@@ -924,38 +906,46 @@ export default class Component extends Element {
924
906
  return null;
925
907
  }
926
908
  /**
927
- * Called before a next and previous page is triggered allowing the components
928
- * to perform special functions.
929
- *
930
- * @return {*}
909
+ * Called before a next and previous page is triggered allowing the components to perform special functions.
910
+ * @returns {Promise<boolean>} - A promise to resolve when the component is no longer blocking the next/previous page navigation.
931
911
  */
932
912
  beforePage() {
933
913
  return Promise.resolve(true);
934
914
  }
915
+ /**
916
+ * Called before the next page is triggered allowing the components to hook into the page navigation and perform tasks.
917
+ * @returns {Promise<boolean>} - A promise to resolve when the component is no longer blocking the next page navigation.
918
+ */
935
919
  beforeNext() {
936
920
  return this.beforePage(true);
937
921
  }
938
922
  /**
939
- * Called before a submission is triggered allowing the components
940
- * to perform special async functions.
941
- *
942
- * @return {*}
923
+ * Called before a submission is triggered allowing the components to perform special async functions.
924
+ * @returns {Promise<boolean>} - A promise to resolve when the component is no longer blocking the submission.
943
925
  */
944
926
  beforeSubmit() {
945
927
  return Promise.resolve(true);
946
928
  }
947
929
  /**
948
930
  * Return the submission timezone.
949
- *
950
- * @return {*}
931
+ * @returns {string} - The submission timezone.
951
932
  */
952
933
  get submissionTimezone() {
953
934
  this.options.submissionTimezone = this.options.submissionTimezone || _.get(this.root, 'options.submissionTimezone');
954
935
  return this.options.submissionTimezone;
955
936
  }
937
+ /**
938
+ * Return the current timezone.
939
+ * @returns {string} - The current timezone.
940
+ */
956
941
  get timezone() {
957
942
  return this.getTimezone(this.component);
958
943
  }
944
+ /**
945
+ * Return the current timezone.
946
+ * @param {object} settings - Settings to control how the timezone should be returned.
947
+ * @returns {string} - The current timezone.
948
+ */
959
949
  getTimezone(settings) {
960
950
  if (settings.timezone) {
961
951
  return settings.timezone;
@@ -979,6 +969,9 @@ export default class Component extends Element {
979
969
  * @param {string} [referenceAttributeName] - The attribute name to use for the reference.
980
970
  */
981
971
  loadRefs(element, refs, referenceAttributeName) {
972
+ if (!element) {
973
+ return;
974
+ }
982
975
  for (const ref in refs) {
983
976
  const refType = refs[ref];
984
977
  const isString = typeof refType === 'string';
@@ -993,21 +986,42 @@ export default class Component extends Element {
993
986
  }
994
987
  }
995
988
  }
996
- setOpenModalElement(template) {
989
+ /**
990
+ * Opens the modal element.
991
+ * @param {string} template - The template to use for the modal dialog.
992
+ */
993
+ setOpenModalElement(template = null) {
997
994
  this.componentModal.setOpenModalElement(template || this.getModalPreviewTemplate());
998
995
  }
996
+ /**
997
+ * Renders a modal preview template and returns the markup as a string
998
+ * @param {object|null|undefined} ctx - The rendering context
999
+ * @returns {string} - The modal preview markup
1000
+ */
1001
+ renderModalPreview(ctx) {
1002
+ return this.renderTemplate('modalPreview', ctx || {});
1003
+ }
1004
+ /**
1005
+ * Returns the modal preview template.
1006
+ * @returns {string} - The modal preview template.
1007
+ */
999
1008
  getModalPreviewTemplate() {
1000
1009
  const dataValue = this.component.type === 'password' ? this.dataValue.replace(/./g, '•') : this.dataValue;
1001
1010
  let modalLabel;
1002
1011
  if (this.hasInput && this.component.validate?.required && !this.isPDFReadOnlyMode) {
1003
1012
  modalLabel = { className: 'field-required' };
1004
1013
  }
1005
- return this.renderTemplate('modalPreview', {
1014
+ return this.renderModalPreview({
1006
1015
  previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('Click to set value'),
1007
1016
  messages: '',
1008
1017
  labelInfo: modalLabel,
1009
1018
  });
1010
1019
  }
1020
+ /**
1021
+ * Performs a complete build of a component, which empties, renders, sets the content in the DOM, and then finally attaches events.
1022
+ * @param {HTMLElement} element - The element to attach this component to.
1023
+ * @returns {Promise<void>} - A promise that resolves when the component has been built.
1024
+ */
1011
1025
  build(element) {
1012
1026
  element = element || this.element;
1013
1027
  this.empty(element);
@@ -1017,6 +1031,12 @@ export default class Component extends Element {
1017
1031
  get hasModalSaveButton() {
1018
1032
  return true;
1019
1033
  }
1034
+ /**
1035
+ * Renders a component as an HTML string.
1036
+ * @param {string} children - The contents of all the children HTML as a string.
1037
+ * @param {boolean} topLevel - If this is the topmost component that is being rendered.
1038
+ * @returns {string} - The rendered HTML string of a component.
1039
+ */
1020
1040
  render(children = `Unknown component: ${this.component.type}`, topLevel = false) {
1021
1041
  const isVisible = this.visible;
1022
1042
  this.rendered = true;
@@ -1040,27 +1060,54 @@ export default class Component extends Element {
1040
1060
  }, topLevel);
1041
1061
  }
1042
1062
  }
1063
+ /**
1064
+ * Creates the tooltip instance using tippy.js and returns it
1065
+ * @param {HTMLElement} tooltipEl - HTML element to attach the tooltip
1066
+ * @param {object|null|undefined} settings - tippy.js options
1067
+ * @returns {import('tippy.js').Tippy} - tippy.js instance
1068
+ */
1069
+ createTooltip(tooltipEl, settings = {}) {
1070
+ const tooltipAttribute = tooltipEl.getAttribute('data-tooltip');
1071
+ const tooltipDataTitle = tooltipEl.getAttribute('data-title');
1072
+ const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
1073
+ .replace(/(?:\r\n|\r|\n)/g, '<br />');
1074
+ return tippy(tooltipEl, {
1075
+ allowHTML: true,
1076
+ trigger: 'mouseenter click focus',
1077
+ placement: 'right',
1078
+ zIndex: 10000,
1079
+ interactive: true,
1080
+ ...settings,
1081
+ content: this.t(this.sanitize(tooltipText), { _userInput: true }),
1082
+ });
1083
+ }
1084
+ /**
1085
+ * Attaches all the tooltips provided the refs object.
1086
+ * @param {object} toolTipsRefs - The refs for the tooltips within your template.
1087
+ * @returns {void}
1088
+ */
1043
1089
  attachTooltips(toolTipsRefs) {
1044
1090
  toolTipsRefs?.forEach((tooltip, index) => {
1045
1091
  if (tooltip) {
1046
- const tooltipAttribute = tooltip.getAttribute('data-tooltip');
1047
- const tooltipDataTitle = tooltip.getAttribute('data-title');
1048
- const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
1049
- .replace(/(?:\r\n|\r|\n)/g, '<br />');
1050
- this.tooltips[index] = tippy(tooltip, {
1051
- allowHTML: true,
1052
- trigger: 'mouseenter click focus',
1053
- placement: 'right',
1054
- zIndex: 10000,
1055
- interactive: true,
1056
- content: this.t(this.sanitize(tooltipText), { _userInput: true }),
1057
- });
1092
+ this.tooltips[index] = this.createTooltip(tooltip);
1058
1093
  }
1059
1094
  });
1060
1095
  }
1096
+ /**
1097
+ * Create a new component modal for this component.
1098
+ * @param {HTMLElement} element - The element to attach the modal to.
1099
+ * @param {boolean} modalShouldBeOpened - TRUE if the modal should open immediately.
1100
+ * @param {any} currentValue - The current value of the component.
1101
+ * @returns {ComponentModal} - The created component modal.
1102
+ */
1061
1103
  createComponentModal(element, modalShouldBeOpened, currentValue) {
1062
1104
  return new ComponentModal(this, element, modalShouldBeOpened, currentValue, this._referenceAttributeName);
1063
1105
  }
1106
+ /**
1107
+ * Attaches all event listensers for this component to the DOM elements that were rendered.
1108
+ * @param {HTMLElement} element - The element to attach the listeners to.
1109
+ * @returns {Promise<void>} - Resolves when the component is done attaching to the DOM.
1110
+ */
1064
1111
  attach(element) {
1065
1112
  if (!this.builderMode && !this.previewMode && this.component.modalEdit) {
1066
1113
  const modalShouldBeOpened = this.componentModal ? this.componentModal.isOpened : false;
@@ -1072,7 +1119,7 @@ export default class Component extends Element {
1072
1119
  this.setOpenModalElement(openModalTemplate);
1073
1120
  }
1074
1121
  this.attached = true;
1075
- this.setElement(element);
1122
+ this.element = element;
1076
1123
  element.component = this;
1077
1124
  // If this already has an id, get it from the dom. If SSR, it could be different from the initiated id.
1078
1125
  if (this.element.id) {
@@ -1098,6 +1145,9 @@ export default class Component extends Element {
1098
1145
  this.addons.forEach((addon) => addon.attach(element));
1099
1146
  return Promise.resolve();
1100
1147
  }
1148
+ /**
1149
+ * Restors the "focus" on a component after a redraw event has occured.
1150
+ */
1101
1151
  restoreFocus() {
1102
1152
  const isFocused = this.root?.focusedComponent?.path === this.path;
1103
1153
  if (isFocused) {
@@ -1106,6 +1156,12 @@ export default class Component extends Element {
1106
1156
  this.restoreCaretPosition();
1107
1157
  }
1108
1158
  }
1159
+ /**
1160
+ * Adds a keyboard shortcut to this component.
1161
+ * @param {HTMLElement} element - The element to attach the keyboard shortcut to.
1162
+ * @param {string} shortcut - The keyboard shortcut to add.
1163
+ * @returns {void}
1164
+ */
1109
1165
  addShortcut(element, shortcut) {
1110
1166
  // Avoid infinite recursion.
1111
1167
  if (!element || !this.root || (this.root === this)) {
@@ -1116,6 +1172,12 @@ export default class Component extends Element {
1116
1172
  }
1117
1173
  this.root.addShortcut(element, shortcut);
1118
1174
  }
1175
+ /**
1176
+ * Removes a keyboard shortcut from this component.
1177
+ * @param {HTMLElement} element - The element to remove the keyboard shortcut from.
1178
+ * @param {string} shortcut - The keyboard shortcut to remove.
1179
+ * @returns {void}
1180
+ */
1119
1181
  removeShortcut(element, shortcut) {
1120
1182
  // Avoid infinite recursion.
1121
1183
  if (!element || (this.root === this)) {
@@ -1130,17 +1192,6 @@ export default class Component extends Element {
1130
1192
  * Remove all event handlers.
1131
1193
  */
1132
1194
  detach() {
1133
- // First iterate through each ref and delete the component so there are no dangling component references.
1134
- _.each(this.refs, (ref) => {
1135
- if (typeof ref === NodeList) {
1136
- ref.forEach((elem) => {
1137
- delete elem.component;
1138
- });
1139
- }
1140
- else if (ref) {
1141
- delete ref.component;
1142
- }
1143
- });
1144
1195
  this.refs = {};
1145
1196
  this.removeEventListeners();
1146
1197
  this.detachLogic();
@@ -1148,6 +1199,13 @@ export default class Component extends Element {
1148
1199
  this.tooltip.destroy();
1149
1200
  }
1150
1201
  }
1202
+ /**
1203
+ * Determines if the component should be refreshed based on the path of another component that changed.
1204
+ * @param {string} refreshData - The path of the data that needs to trigger a refresh.
1205
+ * @param {boolean} changed - Flag that is true if the data has been changed.
1206
+ * @param {any} flags - The flags for the checkData procedure.
1207
+ * @returns {void}
1208
+ */
1151
1209
  checkRefresh(refreshData, changed, flags) {
1152
1210
  const changePath = _.get(changed, 'instance.path', false);
1153
1211
  // Don't let components change themselves.
@@ -1164,6 +1222,12 @@ export default class Component extends Element {
1164
1222
  this.refresh(changed.value, changed, flags);
1165
1223
  }
1166
1224
  }
1225
+ /**
1226
+ * 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.
1227
+ * @param {Array<any>} changes - The list of components that have changed.
1228
+ * @param {any} flags - The checkData flags.
1229
+ * @returns {void}
1230
+ */
1167
1231
  checkRefreshOn(changes, flags = {}) {
1168
1232
  changes = changes || [];
1169
1233
  if (flags.noRefresh) {
@@ -1185,8 +1249,8 @@ export default class Component extends Element {
1185
1249
  }
1186
1250
  /**
1187
1251
  * Refreshes the component with a new value.
1188
- *
1189
- * @param value
1252
+ * @param {any} value - The latest value of the component to check if it needs to be refreshed.
1253
+ * @returns {void}
1190
1254
  */
1191
1255
  refresh(value) {
1192
1256
  if (this.hasOwnProperty('refreshOnValue')) {
@@ -1209,8 +1273,8 @@ export default class Component extends Element {
1209
1273
  * with the components data and returns true if they are in the same context.
1210
1274
  *
1211
1275
  * Different rows of the same EditGrid, for example, are in different contexts.
1212
- *
1213
- * @param component
1276
+ * @param {any} component - The component to check if it is in the same context as this component.
1277
+ * @returns {boolean} - TRUE if the component is in the same context as this component.
1214
1278
  */
1215
1279
  inContext(component) {
1216
1280
  if (component.data === this.data) {
@@ -1225,9 +1289,18 @@ export default class Component extends Element {
1225
1289
  }
1226
1290
  return false;
1227
1291
  }
1292
+ /**
1293
+ * Determines if we are in "view" only mode.
1294
+ * @returns {boolean} - TRUE if we are in "view" only mode.
1295
+ */
1228
1296
  get viewOnly() {
1229
1297
  return this.options.readOnly && this.options.viewAsHtml;
1230
1298
  }
1299
+ /**
1300
+ * Sets the HTMLElement for this component.
1301
+ * @param {HTMLElement} element - The element that is attached to this component.
1302
+ * @returns {void}
1303
+ */
1231
1304
  setElement(element) {
1232
1305
  if (this.element) {
1233
1306
  delete this.element.component;
@@ -1235,24 +1308,32 @@ export default class Component extends Element {
1235
1308
  }
1236
1309
  this.element = element;
1237
1310
  }
1311
+ /**
1312
+ * Creates an element to hold the "view only" version of this component.
1313
+ * @returns {HTMLElement} - The element for this component.
1314
+ */
1238
1315
  createViewOnlyElement() {
1239
- this.setElement(this.ce('dl', {
1316
+ this.element = this.ce('dl', {
1240
1317
  id: this.id
1241
- }));
1318
+ });
1242
1319
  if (this.element) {
1243
1320
  // Ensure you can get the component info from the element.
1244
1321
  this.element.component = this;
1245
1322
  }
1246
1323
  return this.element;
1247
1324
  }
1325
+ /**
1326
+ * The default value for the "view only" mode of a component if the value is not provided.
1327
+ * @returns {string} - The default value for this component.
1328
+ */
1248
1329
  get defaultViewOnlyValue() {
1249
1330
  return '-';
1250
1331
  }
1251
1332
  /**
1252
1333
  * Uses the widget to determine the output string.
1253
- *
1254
- * @param value
1255
- * @return {*}
1334
+ * @param {any} value - The current value of the component.
1335
+ * @param {any} options - The options for getValueAsString.
1336
+ * @returns {any|Array<any>} - The value as a string.
1256
1337
  */
1257
1338
  getWidgetValueAsString(value, options) {
1258
1339
  const noInputWidget = !this.refs.input || !this.refs.input[0] || !this.refs.input[0].widget;
@@ -1277,6 +1358,12 @@ export default class Component extends Element {
1277
1358
  const widget = this.refs.input[0].widget;
1278
1359
  return widget.getValueAsString(value, options);
1279
1360
  }
1361
+ /**
1362
+ * Returns the value of the component as a string.
1363
+ * @param {any} value - The value for this component.
1364
+ * @param {any} options - The options for this component.
1365
+ * @returns {string} - The string representation of the value of this component.
1366
+ */
1280
1367
  getValueAsString(value, options) {
1281
1368
  if (!value) {
1282
1369
  return '';
@@ -1294,20 +1381,32 @@ export default class Component extends Element {
1294
1381
  const stringValue = value.toString();
1295
1382
  return this.sanitize(stringValue);
1296
1383
  }
1384
+ /**
1385
+ * Returns the string representation "view" of the component value.
1386
+ * @param {any} value - The value of the component.
1387
+ * @param {any} options - The options for this component.
1388
+ * @returns {string} - The string representation of the value of this component.
1389
+ */
1297
1390
  getView(value, options) {
1298
1391
  if (this.component.protected) {
1299
1392
  return '--- PROTECTED ---';
1300
1393
  }
1301
1394
  return this.getValueAsString(value, options);
1302
1395
  }
1396
+ /**
1397
+ * Updates the items list for this component. Useful for Select and other List component types.
1398
+ * @param {...any} args - The arguments to pass to the onChange event.
1399
+ * @returns {void}
1400
+ */
1303
1401
  updateItems(...args) {
1304
1402
  this.restoreValue();
1305
1403
  this.onChange(...args);
1306
1404
  }
1307
1405
  /**
1308
- * @param {*} data
1309
- * @param {boolean} [forceUseValue=false] - if true, return 'value' property of the data
1310
- * @return {*}
1406
+ * Returns the value for a specific item in a List type component.
1407
+ * @param {any} data - The data for this component.
1408
+ * @param {boolean} [forceUseValue] - if true, return 'value' property of the data
1409
+ * @returns {any} - The value of the item.
1311
1410
  */
1312
1411
  itemValue(data, forceUseValue = false) {
1313
1412
  if (_.isObject(data) && !_.isArray(data)) {
@@ -1320,6 +1419,11 @@ export default class Component extends Element {
1320
1419
  }
1321
1420
  return data;
1322
1421
  }
1422
+ /**
1423
+ * Returns the item value for html mode.
1424
+ * @param {any} value - The value for this component.
1425
+ * @returns {any} - The value of the item for html mode.
1426
+ */
1323
1427
  itemValueForHTMLMode(value) {
1324
1428
  if (Array.isArray(value)) {
1325
1429
  const values = value.map(item => Array.isArray(item) ? this.itemValueForHTMLMode(item) : this.itemValue(item));
@@ -1327,6 +1431,13 @@ export default class Component extends Element {
1327
1431
  }
1328
1432
  return this.itemValue(value);
1329
1433
  }
1434
+ /**
1435
+ * Creates a modal to input the value of this component.
1436
+ * @param {HTMLElement} element - The element to attach the modal to.
1437
+ * @param {any} attr - A list of attributes to add to the modal.
1438
+ * @param {boolean} confirm - If we should add a confirmation to the modal that keeps it from closing unless confirmed.
1439
+ * @returns {HTMLElement} - The created modal element.
1440
+ */
1330
1441
  createModal(element, attr, confirm) {
1331
1442
  const dialog = this.ce('div', attr || {});
1332
1443
  this.setContent(dialog, this.renderTemplate('dialog'));
@@ -1362,6 +1473,10 @@ export default class Component extends Element {
1362
1473
  this.addEventListener(dialog.refs.dialogClose, 'click', handleCloseClick);
1363
1474
  return dialog;
1364
1475
  }
1476
+ /**
1477
+ * Uses CSS classes to show or hide an element.
1478
+ * @returns {boolean} - TRUE if the element has been css removed.
1479
+ */
1365
1480
  get optimizeRedraw() {
1366
1481
  if (this.options.optimizeRedraw && this.element && !this.visible) {
1367
1482
  this.addClass(this.element, 'formio-removed');
@@ -1399,7 +1514,7 @@ export default class Component extends Element {
1399
1514
  }
1400
1515
  /**
1401
1516
  * Build the custom style from the layout values
1402
- * @return {string} - The custom style
1517
+ * @returns {string} - The custom style
1403
1518
  */
1404
1519
  get customStyle() {
1405
1520
  let customCSS = '';
@@ -1410,24 +1525,31 @@ export default class Component extends Element {
1410
1525
  });
1411
1526
  return customCSS;
1412
1527
  }
1528
+ /**
1529
+ * Returns the component condition operator settings if available.
1530
+ * @returns {object} - The component condition operator settings.
1531
+ */
1413
1532
  static get serverConditionSettings() {
1414
1533
  return Component.conditionOperatorsSettings;
1415
1534
  }
1535
+ /**
1536
+ * Returns if the application is on a mobile device.
1537
+ * @returns {boolean} - TRUE if the application is on a mobile device.
1538
+ */
1416
1539
  get isMobile() {
1417
1540
  return isMobile();
1418
1541
  }
1419
1542
  /**
1420
1543
  * Returns the outside wrapping element of this component.
1421
- * @returns {HTMLElement}
1544
+ * @returns {HTMLElement} - The wrapping element of this component.
1422
1545
  */
1423
1546
  getElement() {
1424
1547
  return this.element;
1425
1548
  }
1426
1549
  /**
1427
1550
  * Create an evaluation context for all script executions and interpolations.
1428
- *
1429
- * @param additional
1430
- * @return {*}
1551
+ * @param {any} additional - Additional context to provide.
1552
+ * @returns {any} - The evaluation context.
1431
1553
  */
1432
1554
  evalContext(additional) {
1433
1555
  return super.evalContext(Object.assign({
@@ -1449,18 +1571,29 @@ export default class Component extends Element {
1449
1571
  }
1450
1572
  /**
1451
1573
  * Sets the pristine flag for this component.
1452
- *
1453
- * @param pristine {boolean} - TRUE to make pristine, FALSE not pristine.
1574
+ * @param {boolean} pristine - TRUE to make pristine, FALSE not pristine.
1454
1575
  */
1455
1576
  setPristine(pristine) {
1456
1577
  this.pristine = pristine;
1457
1578
  }
1579
+ /**
1580
+ * Returns if the component is pristine.
1581
+ * @returns {boolean} - TRUE if the component is pristine.
1582
+ */
1458
1583
  get isPristine() {
1459
1584
  return this.pristine;
1460
1585
  }
1586
+ /**
1587
+ * Sets the dirty flag for this component.
1588
+ * @param {boolean} dirty - TRUE to make dirty, FALSE not dirty.
1589
+ */
1461
1590
  setDirty(dirty) {
1462
1591
  this.dirty = dirty;
1463
1592
  }
1593
+ /**
1594
+ * Returns if the component is dirty.
1595
+ * @returns {boolean} - TRUE if the component is dirty.
1596
+ */
1464
1597
  get isDirty() {
1465
1598
  return this.dirty;
1466
1599
  }
@@ -1474,12 +1607,23 @@ export default class Component extends Element {
1474
1607
  this.restoreValue();
1475
1608
  this.triggerRootChange();
1476
1609
  }
1610
+ /**
1611
+ * Returns the icon class for a given icon name.
1612
+ * @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.
1613
+ * @param {boolean} spinning - If the component should be spinning.
1614
+ * @returns {string} - The icon class for the equivalent icon in the iconset we are using.
1615
+ */
1477
1616
  iconClass(name, spinning) {
1478
1617
  const iconset = this.options.iconset || Templates.current.defaultIconset || 'fa';
1479
1618
  return Templates.current.hasOwnProperty('iconClass')
1480
1619
  ? Templates.current.iconClass(iconset, name, spinning)
1481
1620
  : this.options.iconset === 'fa' ? Templates.defaultTemplates.iconClass(iconset, name, spinning) : name;
1482
1621
  }
1622
+ /**
1623
+ * Returns the size css class names for our current template.
1624
+ * @param {string} size - The size class name for the default iconset.
1625
+ * @returns {string} - The size class for our component.
1626
+ */
1483
1627
  size(size) {
1484
1628
  return Templates.current.hasOwnProperty('size')
1485
1629
  ? Templates.current.size(size)
@@ -1492,15 +1636,23 @@ export default class Component extends Element {
1492
1636
  get name() {
1493
1637
  return this.t(this.component.label || this.component.placeholder || this.key, { _userInput: true });
1494
1638
  }
1639
+ /**
1640
+ * Returns the visible errors for this component.
1641
+ * @returns {Array<object>} - The visible errors for this component.
1642
+ */
1495
1643
  get visibleErrors() {
1496
1644
  return this._visibleErrors;
1497
1645
  }
1646
+ /**
1647
+ * Returns all the errors for this component, visible or not.
1648
+ * @returns {Array<object>} - All the errors for this component.
1649
+ */
1498
1650
  get errors() {
1499
1651
  return this._errors;
1500
1652
  }
1501
1653
  /**
1502
1654
  * Returns the error label for this component.
1503
- * @return {*}
1655
+ * @returns {string} - The error label for this component.
1504
1656
  */
1505
1657
  get errorLabel() {
1506
1658
  return this.t(this.component.errorLabel
@@ -1510,12 +1662,20 @@ export default class Component extends Element {
1510
1662
  }
1511
1663
  /**
1512
1664
  * Get the error message provided a certain type of error.
1513
- * @param type
1514
- * @return {*}
1665
+ * @param {string} type - The type of error to fetch the message for.
1666
+ * @returns {string} - The error message configured for this component.
1515
1667
  */
1516
1668
  errorMessage(type) {
1517
1669
  return (this.component.errors && this.component.errors[type]) ? this.component.errors[type] : type;
1518
1670
  }
1671
+ /**
1672
+ * Sets the content, innerHTML, of an element to the sanitized content.
1673
+ * @param {HTMLElement} element - The element to set the innerHTML to.
1674
+ * @param {string} content - The HTML string content that we wish to set.
1675
+ * @param {boolean} forceSanitize - If we should force the content to be sanitized.
1676
+ * @param {any} sanitizeOptions - The options for the sanitize function.
1677
+ * @returns {boolean} - TRUE if the content was sanitized and set.
1678
+ */
1519
1679
  setContent(element, content, forceSanitize, sanitizeOptions) {
1520
1680
  if (element instanceof HTMLElement) {
1521
1681
  element.innerHTML = this.sanitize(content, forceSanitize, sanitizeOptions);
@@ -1523,6 +1683,9 @@ export default class Component extends Element {
1523
1683
  }
1524
1684
  return false;
1525
1685
  }
1686
+ /**
1687
+ * Restores the caret position in the input element after a refresh occurs.
1688
+ */
1526
1689
  restoreCaretPosition() {
1527
1690
  if (this.root?.currentSelection) {
1528
1691
  if (this.refs.input?.length) {
@@ -1544,6 +1707,10 @@ export default class Component extends Element {
1544
1707
  }
1545
1708
  }
1546
1709
  }
1710
+ /**
1711
+ * Redraw the component.
1712
+ * @returns {Promise<void>} - A promise that resolves when the component is done redrawing.
1713
+ */
1547
1714
  redraw() {
1548
1715
  // Don't bother if we have not built yet.
1549
1716
  if (!this.element || !this.element.parentNode || this.optimizeRedraw) {
@@ -1556,32 +1723,57 @@ export default class Component extends Element {
1556
1723
  const parent = this.element.parentNode;
1557
1724
  const index = Array.prototype.indexOf.call(parent.children, this.element);
1558
1725
  this.element.outerHTML = this.sanitize(this.render());
1559
- this.setElement(parent.children[index]);
1726
+ this.element = parent.children[index];
1560
1727
  return this.attach(this.element);
1561
1728
  }
1729
+ /**
1730
+ * Rebuild and redraw a component.
1731
+ * @returns {Promise<void>} - A promise that resolves when the component is done rebuilding and redrawing.
1732
+ */
1562
1733
  rebuild() {
1563
1734
  this.destroy();
1564
1735
  this.init();
1565
1736
  this.visible = this.conditionallyVisible(null, null);
1566
1737
  return this.redraw();
1567
1738
  }
1739
+ /**
1740
+ * Removes all event listeners attached to this component.
1741
+ */
1568
1742
  removeEventListeners() {
1569
1743
  super.removeEventListeners();
1570
1744
  this.tooltips.forEach(tooltip => tooltip.destroy());
1571
1745
  this.tooltips = [];
1572
1746
  }
1747
+ /**
1748
+ * Returns if the dom node has the classes provided.
1749
+ * @param {HTMLElement} element - The element to check for the class.
1750
+ * @param {string} className - The name of the class to check.
1751
+ * @returns {boolean|void} - TRUE if the element has the class.
1752
+ */
1573
1753
  hasClass(element, className) {
1574
1754
  if (!element) {
1575
1755
  return;
1576
1756
  }
1577
1757
  return super.hasClass(element, this.transform('class', className));
1578
1758
  }
1759
+ /**
1760
+ * Adds a class to an HTML element.
1761
+ * @param {HTMLElement} element - The dom element to add the class to.
1762
+ * @param {string} className - The class name you wish to add.
1763
+ * @returns {this|void} - The component instance.
1764
+ */
1579
1765
  addClass(element, className) {
1580
1766
  if (!element) {
1581
1767
  return;
1582
1768
  }
1583
1769
  return super.addClass(element, this.transform('class', className));
1584
1770
  }
1771
+ /**
1772
+ * Removes a class from an element.
1773
+ * @param {HTMLElement} element - The element to remove the class from.
1774
+ * @param {string} className - The class name to remove.
1775
+ * @returns {this|void} - The component instance.
1776
+ */
1585
1777
  removeClass(element, className) {
1586
1778
  if (!element) {
1587
1779
  return;
@@ -1590,8 +1782,7 @@ export default class Component extends Element {
1590
1782
  }
1591
1783
  /**
1592
1784
  * Determines if this component has a condition defined.
1593
- *
1594
- * @return {null}
1785
+ * @returns {boolean} - TRUE if the component has a condition defined.
1595
1786
  */
1596
1787
  hasCondition() {
1597
1788
  if (this._hasCondition !== null) {
@@ -1602,9 +1793,9 @@ export default class Component extends Element {
1602
1793
  }
1603
1794
  /**
1604
1795
  * Check if this component is conditionally visible.
1605
- *
1606
- * @param data
1607
- * @return {boolean}
1796
+ * @param {any} data - The data to check against.
1797
+ * @param {any} row - The row data to check against.
1798
+ * @returns {boolean} - TRUE if the component is conditionally visible.
1608
1799
  */
1609
1800
  conditionallyVisible(data, row) {
1610
1801
  data = data || this.rootValue;
@@ -1619,16 +1810,19 @@ export default class Component extends Element {
1619
1810
  * Checks the condition of this component.
1620
1811
  *
1621
1812
  * TODO: Switch row and data parameters to be consistent with other methods.
1622
- *
1623
- * @param row - The row contextual data.
1624
- * @param data - The global data object.
1625
- * @return {boolean} - True if the condition applies to this component.
1813
+ * @param {any} row - The row contextual data.
1814
+ * @param {any} data - The global data object.
1815
+ * @returns {boolean} - True if the condition applies to this component.
1626
1816
  */
1627
1817
  checkCondition(row, data) {
1628
1818
  return FormioUtils.checkCondition(this.component, row || this.data, data || this.rootValue, this.root ? this.root._form : {}, this);
1629
1819
  }
1630
1820
  /**
1631
1821
  * Check for conditionals and hide/show the element based on those conditions.
1822
+ * @param {any} data - The data to check against.
1823
+ * @param {any} flags - The flags passed to checkData function.
1824
+ * @param {any} row - The row data to check against.
1825
+ * @returns {boolean} - TRUE if the component is visible.
1632
1826
  */
1633
1827
  checkComponentConditions(data, flags, row) {
1634
1828
  data = data || this.rootValue;
@@ -1646,8 +1840,10 @@ export default class Component extends Element {
1646
1840
  }
1647
1841
  /**
1648
1842
  * Checks conditions for this component and any sub components.
1649
- * @param args
1650
- * @return {boolean}
1843
+ * @param {any} data - The data to check against.
1844
+ * @param {any} flags - The flags passed to checkData function.
1845
+ * @param {any} row - The row data to check against.
1846
+ * @returns {boolean} - TRUE if the component is visible.
1651
1847
  */
1652
1848
  checkConditions(data, flags, row) {
1653
1849
  data = data || this.rootValue;
@@ -1655,17 +1851,20 @@ export default class Component extends Element {
1655
1851
  row = row || this.data;
1656
1852
  return this.checkComponentConditions(data, flags, row);
1657
1853
  }
1854
+ /**
1855
+ * Returns the component logic if applicable.
1856
+ * @returns {Array<object>} - The component logic.
1857
+ */
1658
1858
  get logic() {
1659
1859
  return this.component.logic || [];
1660
1860
  }
1661
1861
  /**
1662
1862
  * Check all triggers and apply necessary actions.
1663
- *
1664
- * @param data
1863
+ * @param {any} data - The data to check against.
1864
+ * @param {any} row - The row data to check against.
1865
+ * @returns {boolean|void} - TRUE if the component was altered.
1665
1866
  */
1666
- fieldLogic(data, row) {
1667
- data = data || this.rootValue;
1668
- row = row || this.data;
1867
+ fieldLogic(data = this.rootValue, row = this.data) {
1669
1868
  const logics = this.logic;
1670
1869
  // If there aren't logic, don't go further.
1671
1870
  if (logics.length === 0) {
@@ -1688,6 +1887,10 @@ export default class Component extends Element {
1688
1887
  }
1689
1888
  return changed;
1690
1889
  }
1890
+ /**
1891
+ * Retuns if the browser is Internet Explorer.
1892
+ * @returns {boolean} - TRUE if the browser is IE.
1893
+ */
1691
1894
  isIE() {
1692
1895
  if (typeof window === 'undefined') {
1693
1896
  return false;
@@ -1712,9 +1915,24 @@ export default class Component extends Element {
1712
1915
  // other browser
1713
1916
  return false;
1714
1917
  }
1918
+ /**
1919
+ * Defines the logic action value through evaluation.
1920
+ * @param {object} action - The action within the Logic system to perform.
1921
+ * @param {object} argsObject - The arguments to pass to the evaluation.
1922
+ * @returns {any} - The result of the evaluation.
1923
+ */
1715
1924
  defineActionValue(action, argsObject) {
1716
1925
  return this.evaluate(action.value, argsObject, 'value');
1717
1926
  }
1927
+ /**
1928
+ * Apply the actions of Logic for a component once the conditions have been met.
1929
+ * @param {object} newComponent - The new component to apply the actions to.
1930
+ * @param {Array<object>} actions - An array of actions
1931
+ * @param {any} result - The result of the conditional check in order to evaluate the actions.
1932
+ * @param {any} row - The contextual row data for this component.
1933
+ * @param {any} data - The global data object for the submission.
1934
+ * @returns {boolean} - TRUE if the component was altered.
1935
+ */
1718
1936
  applyActions(newComponent, actions, result, row, data) {
1719
1937
  data = data || this.rootValue;
1720
1938
  row = row || this.data;
@@ -1794,8 +2012,8 @@ export default class Component extends Element {
1794
2012
  }
1795
2013
  /**
1796
2014
  * Add a new input error to this element.
1797
- *
1798
- * @param {{level: string, message: string}[]} messages
2015
+ * @param {Array<object>|string} messages - An array of messages to add to the element.
2016
+ * @returns {void}
1799
2017
  */
1800
2018
  addMessages(messages) {
1801
2019
  if (!messages) {
@@ -1814,13 +2032,19 @@ export default class Component extends Element {
1814
2032
  messages = _.uniqBy(messages, message => message.message);
1815
2033
  if (this.refs.messageContainer) {
1816
2034
  this.setContent(this.refs.messageContainer, messages.map((message) => {
1817
- if (message.message && typeof message.message === 'string') {
1818
- message.message = message.message.replaceAll('<', '&lt;').replaceAll('>', '&gt;');
1819
- }
1820
2035
  return this.renderTemplate('message', { ...message });
1821
2036
  }).join(''));
1822
2037
  }
1823
2038
  }
2039
+ /**
2040
+ * Sets the form input widget error classes.
2041
+ * @param {Array<HTMLElement>} elements - An array of DOM elements to set the error classes on.
2042
+ * @param {boolean} dirty - If the input is dirty.
2043
+ * @param {boolean} hasErrors - If the input has errors.
2044
+ * @param {boolean} hasMessages - If the input has messages.
2045
+ * @param {HTMLElement} element - The wrapper element for all the other elements passed in first argument.
2046
+ * @returns {void}
2047
+ */
1824
2048
  setErrorClasses(elements, dirty, hasErrors, hasMessages, element = this.element) {
1825
2049
  this.clearErrorClasses();
1826
2050
  elements.forEach((element) => {
@@ -1847,6 +2071,12 @@ export default class Component extends Element {
1847
2071
  this.addClass(element, 'has-message');
1848
2072
  }
1849
2073
  }
2074
+ /**
2075
+ * Adds the classes necessary to mark an element as invalid.
2076
+ * @param {HTMLElement} element - The element you wish to add the invalid classes to.
2077
+ * @param {boolean} invalid - TRUE if the component is invalid, FALSE otherwise.
2078
+ * @returns {void}
2079
+ */
1850
2080
  setElementInvalid(element, invalid) {
1851
2081
  if (!element)
1852
2082
  return;
@@ -1858,6 +2088,9 @@ export default class Component extends Element {
1858
2088
  }
1859
2089
  element.setAttribute('aria-invalid', invalid ? 'true' : 'false');
1860
2090
  }
2091
+ /**
2092
+ * Clears the components data if it is conditionally hidden AND clearOnHide is set to true for this component.
2093
+ */
1861
2094
  clearOnHide() {
1862
2095
  // clearOnHide defaults to true for old forms (without the value set) so only trigger if the value is false.
1863
2096
  if (
@@ -1877,6 +2110,10 @@ export default class Component extends Element {
1877
2110
  }
1878
2111
  }
1879
2112
  }
2113
+ /**
2114
+ * Triggers a debounced onChange event for the root component (usually Webform).
2115
+ * @param {...any} args - The arguments to pass to the onChange event.
2116
+ */
1880
2117
  triggerRootChange(...args) {
1881
2118
  if (this.options.onChange) {
1882
2119
  this.options.onChange(...args);
@@ -1885,6 +2122,13 @@ export default class Component extends Element {
1885
2122
  this.root.triggerChange(...args);
1886
2123
  }
1887
2124
  }
2125
+ /**
2126
+ * Called when the component value has been changed. This will then trigger the root level onChange handler which
2127
+ * propagates the checkData methods for the full component tree.
2128
+ * @param {any} flags - The flags for the change event propagation.
2129
+ * @param {boolean} fromRoot - If the change event is from the root component.
2130
+ * @returns {boolean} - TRUE if the component has changed.
2131
+ */
1888
2132
  onChange(flags, fromRoot) {
1889
2133
  flags = flags || {};
1890
2134
  if (flags.modified) {
@@ -2020,7 +2264,7 @@ export default class Component extends Element {
2020
2264
  return Promise.reject();
2021
2265
  }
2022
2266
  this.quill = new Quill(element, isIEBrowser ? { ...settings, modules: {} } : settings);
2023
- /** This block of code adds the [source] capabilities. See https://codepen.io/anon/pen/ZyEjrQ **/
2267
+ /** This block of code adds the [source] capabilities. See https://codepen.io/anon/pen/ZyEjrQ */
2024
2268
  const txtArea = document.createElement('textarea');
2025
2269
  txtArea.setAttribute('class', 'quill-source-code');
2026
2270
  this.quill.addContainer('ql-custom').appendChild(txtArea);
@@ -2034,7 +2278,7 @@ export default class Component extends Element {
2034
2278
  txtArea.style.display = (txtArea.style.display === 'none') ? 'inherit' : 'none';
2035
2279
  });
2036
2280
  }
2037
- /** END CODEBLOCK **/
2281
+ /** END CODEBLOCK */
2038
2282
  // Make sure to select cursor when they click on the element.
2039
2283
  this.addEventListener(element, 'click', () => this.quill.focus());
2040
2284
  // Allows users to skip toolbar items when tabbing though form
@@ -2081,23 +2325,22 @@ export default class Component extends Element {
2081
2325
  }
2082
2326
  /**
2083
2327
  * The empty value for this component.
2084
- *
2085
- * @return {null}
2328
+ * @returns {null} - The empty value for this component.
2086
2329
  */
2087
2330
  get emptyValue() {
2088
2331
  return null;
2089
2332
  }
2090
2333
  /**
2091
2334
  * Returns if this component has a value set.
2092
- *
2335
+ * @param {any} data - The global data object.
2336
+ * @returns {boolean} - TRUE if a value is set.
2093
2337
  */
2094
2338
  hasValue(data) {
2095
2339
  return !_.isUndefined(_.get(data || this.data, this.key));
2096
2340
  }
2097
2341
  /**
2098
2342
  * Get the data value at the root level.
2099
- *
2100
- * @return {*}
2343
+ * @returns {*} - The root value for the component, typically the Webform data object.
2101
2344
  */
2102
2345
  get rootValue() {
2103
2346
  return this.root ? this.root.data : this.data;
@@ -2107,7 +2350,7 @@ export default class Component extends Element {
2107
2350
  }
2108
2351
  /**
2109
2352
  * Get the static value of this component.
2110
- * @return {*}
2353
+ * @returns {*} - The value for this component.
2111
2354
  */
2112
2355
  get dataValue() {
2113
2356
  if (!this.key ||
@@ -2125,8 +2368,7 @@ export default class Component extends Element {
2125
2368
  }
2126
2369
  /**
2127
2370
  * Sets the static value of this component.
2128
- *
2129
- * @param value
2371
+ * @param {*} value - The value to set for this component.
2130
2372
  */
2131
2373
  set dataValue(value) {
2132
2374
  if (!this.allowData ||
@@ -2146,8 +2388,8 @@ export default class Component extends Element {
2146
2388
  }
2147
2389
  /**
2148
2390
  * Splice a value from the dataValue.
2149
- *
2150
- * @param index
2391
+ * @param {number} index - The index to splice for an array component values.
2392
+ * @param {*} flags - The flags to use when splicing the value.
2151
2393
  */
2152
2394
  splice(index, flags = {}) {
2153
2395
  if (this.hasValue()) {
@@ -2215,8 +2457,7 @@ export default class Component extends Element {
2215
2457
  }
2216
2458
  /**
2217
2459
  * Get the input value of this component.
2218
- *
2219
- * @return {*}
2460
+ * @returns {*} - The value for the component.
2220
2461
  */
2221
2462
  getValue() {
2222
2463
  if (!this.hasInput || this.viewOnly || !this.refs.input || !this.refs.input.length) {
@@ -2238,9 +2479,8 @@ export default class Component extends Element {
2238
2479
  }
2239
2480
  /**
2240
2481
  * Get the value at a specific index.
2241
- *
2242
- * @param index
2243
- * @returns {*}
2482
+ * @param {number} index - For an array component or multiple values, this returns the value at a specific index.
2483
+ * @returns {*} - The value at the specified index.
2244
2484
  */
2245
2485
  getValueAt(index) {
2246
2486
  const input = this.performInputMapping(this.refs.input[index]);
@@ -2248,11 +2488,9 @@ export default class Component extends Element {
2248
2488
  }
2249
2489
  /**
2250
2490
  * Set the value of this component.
2251
- *
2252
- * @param value
2253
- * @param flags
2254
- *
2255
- * @return {boolean} - If the value changed.
2491
+ * @param {*} value - The value to set for this component.
2492
+ * @param {*} flags - The flags to use when setting the value.
2493
+ * @returns {boolean} - If the value changed.
2256
2494
  */
2257
2495
  setValue(value, flags = {}) {
2258
2496
  const changed = this.updateValue(value, flags);
@@ -2283,9 +2521,9 @@ export default class Component extends Element {
2283
2521
  }
2284
2522
  /**
2285
2523
  * Set the value at a specific index.
2286
- *
2287
- * @param index
2288
- * @param value
2524
+ * @param {number} index - The index to set the value at.
2525
+ * @param {*} value - The value to set at the specified index.
2526
+ * @param {*} flags - The flags to use when setting the value.
2289
2527
  */
2290
2528
  setValueAt(index, value, flags = {}) {
2291
2529
  if (!flags.noDefault && (value === null || value === undefined) && !this.component.multiple) {
@@ -2332,9 +2570,8 @@ export default class Component extends Element {
2332
2570
  }
2333
2571
  /**
2334
2572
  * Normalize values coming into updateValue.
2335
- *
2336
- * @param value
2337
- * @return {*}
2573
+ * @param {*} value - The value to normalize before setting.
2574
+ * @returns {*} - The normalized value.
2338
2575
  */
2339
2576
  normalizeValue(value) {
2340
2577
  if (this.component.multiple && !Array.isArray(value)) {
@@ -2344,8 +2581,9 @@ export default class Component extends Element {
2344
2581
  }
2345
2582
  /**
2346
2583
  * Update a value of this component.
2347
- *
2348
- * @param flags
2584
+ * @param {*} value - The value to update.
2585
+ * @param {*} flags - The flags to use when updating the value.
2586
+ * @returns {boolean} - If the value changed.
2349
2587
  */
2350
2588
  updateComponentValue(value, flags = {}) {
2351
2589
  let newValue = (!flags.resetValue && (value === undefined || value === null)) ? this.getValue() : value;
@@ -2364,9 +2602,8 @@ export default class Component extends Element {
2364
2602
  }
2365
2603
  /**
2366
2604
  * Updates the value of this component plus all sub-components.
2367
- *
2368
- * @param args
2369
- * @return {boolean}
2605
+ * @param {...any} args - The arguments to pass to updateValue.
2606
+ * @returns {boolean} - If the value changed.
2370
2607
  */
2371
2608
  updateValue(...args) {
2372
2609
  return this.updateComponentValue(...args);
@@ -2384,7 +2621,7 @@ export default class Component extends Element {
2384
2621
  */
2385
2622
  resetValue() {
2386
2623
  this.unset();
2387
- this.setValue(this.emptyValue, {
2624
+ this.setValue(this.defaultValue || this.emptyValue, {
2388
2625
  noUpdateEvent: true,
2389
2626
  noValidate: true,
2390
2627
  resetValue: true
@@ -2392,10 +2629,9 @@ export default class Component extends Element {
2392
2629
  }
2393
2630
  /**
2394
2631
  * Determine if the value of this component has changed.
2395
- *
2396
- * @param newValue
2397
- * @param oldValue
2398
- * @return {boolean}
2632
+ * @param {*} newValue - The new value to check.
2633
+ * @param {*} oldValue - The existing value of the component.
2634
+ * @returns {boolean} - TRUE if the value has changed.
2399
2635
  */
2400
2636
  hasChanged(newValue, oldValue) {
2401
2637
  if (((newValue === undefined) || (newValue === null)) &&
@@ -2413,8 +2649,9 @@ export default class Component extends Element {
2413
2649
  }
2414
2650
  /**
2415
2651
  * Update the value on change.
2416
- *
2417
- * @param flags
2652
+ * @param {*} flags - The flags to use when triggering the on change event.
2653
+ * @param {boolean} changed - If the value has changed.
2654
+ * @returns {boolean} - If the value changed.
2418
2655
  */
2419
2656
  updateOnChange(flags = {}, changed = false) {
2420
2657
  if (!flags.noUpdateEvent && changed) {
@@ -2427,13 +2664,6 @@ export default class Component extends Element {
2427
2664
  }
2428
2665
  return false;
2429
2666
  }
2430
- /**
2431
- * Perform a calculated value operation.
2432
- *
2433
- * @param data - The global data object.
2434
- *
2435
- * @return {boolean} - If the value changed during calculation.
2436
- */
2437
2667
  convertNumberOrBoolToString(value) {
2438
2668
  if (typeof value === 'number' || typeof value === 'boolean') {
2439
2669
  return value.toString();
@@ -2530,7 +2760,7 @@ export default class Component extends Element {
2530
2760
  }
2531
2761
  this.calculatedValue = fastCloneDeep(calculatedValue);
2532
2762
  if (changed) {
2533
- if (!flags.noPristineChangeOnModified) {
2763
+ if (!flags.noPristineChangeOnModified && this.root.initialized) {
2534
2764
  this.pristine = false;
2535
2765
  }
2536
2766
  flags.triggeredComponentId = this.id;
@@ -2541,9 +2771,10 @@ export default class Component extends Element {
2541
2771
  /* eslint-enable max-statements */
2542
2772
  /**
2543
2773
  * Performs calculations in this component plus any child components.
2544
- *
2545
- * @param args
2546
- * @return {boolean}
2774
+ * @param {*} data - The data to perform the calculation with.
2775
+ * @param {*} flags - The flags to use when calculating the value.
2776
+ * @param {*} row - The contextual row data to use when performing the calculation.
2777
+ * @returns {boolean} - TRUE if the value changed.
2547
2778
  */
2548
2779
  calculateValue(data, flags, row) {
2549
2780
  data = data || this.rootValue;
@@ -2553,15 +2784,14 @@ export default class Component extends Element {
2553
2784
  }
2554
2785
  /**
2555
2786
  * Get this component's label text.
2556
- *
2787
+ * @returns {string} - The label text for this component.
2557
2788
  */
2558
2789
  get label() {
2559
2790
  return this.component.label;
2560
2791
  }
2561
2792
  /**
2562
2793
  * Set this component's label text and render it.
2563
- *
2564
- * @param value - The new label text.
2794
+ * @param {string} value - The new label text.
2565
2795
  */
2566
2796
  set label(value) {
2567
2797
  this.component.label = value;
@@ -2571,17 +2801,18 @@ export default class Component extends Element {
2571
2801
  }
2572
2802
  /**
2573
2803
  * Get FormioForm element at the root of this component tree.
2574
- *
2804
+ * @returns {*} root - The root component to search from.
2575
2805
  */
2576
2806
  getRoot() {
2577
2807
  return this.root;
2578
2808
  }
2579
2809
  /**
2580
2810
  * Returns the invalid message, or empty string if the component is valid.
2581
- *
2582
- * @param data
2583
- * @param dirty
2584
- * @return {*}
2811
+ * @param {*} data - The data to check if the component is valid.
2812
+ * @param {boolean} dirty - If the component is dirty.
2813
+ * @param {boolean} ignoreCondition - If conditions for the component should be ignored when checking validity.
2814
+ * @param {*} row - Contextual row data for this component.
2815
+ * @returns {string} - The message to show when the component is invalid.
2585
2816
  */
2586
2817
  invalidMessage(data, dirty, ignoreCondition, row) {
2587
2818
  if (!ignoreCondition && !this.checkCondition(row, data)) {
@@ -2613,10 +2844,9 @@ export default class Component extends Element {
2613
2844
  }
2614
2845
  /**
2615
2846
  * Returns if the component is valid or not.
2616
- *
2617
- * @param data
2618
- * @param dirty
2619
- * @return {boolean}
2847
+ * @param {*} data - The data to check if the component is valid.
2848
+ * @param {boolean} dirty - If the component is dirty.
2849
+ * @returns {boolean} - TRUE if the component is valid.
2620
2850
  */
2621
2851
  isValid(data, dirty) {
2622
2852
  return !this.invalidMessage(data, dirty);
@@ -2635,8 +2865,8 @@ export default class Component extends Element {
2635
2865
  }
2636
2866
  /**
2637
2867
  * Interpolate errors from the validation methods.
2638
- * @param {*} errors
2639
- * @returns
2868
+ * @param {Array<any>} errors - An array of errors to interpolate.
2869
+ * @returns {Array<any>} - The interpolated errors.
2640
2870
  */
2641
2871
  interpolateErrors(errors) {
2642
2872
  const interpolatedErrors = FormioUtils.interpolateErrors(this.component, errors, this.t.bind(this));
@@ -2648,7 +2878,7 @@ export default class Component extends Element {
2648
2878
  * @param {*} data - The root submission data.
2649
2879
  * @param {*} row - The contextual row data.
2650
2880
  * @param {*} flags - The flags to perform validation.
2651
- * @returns
2881
+ * @returns {boolean} - TRUE if the component is valid.
2652
2882
  */
2653
2883
  showValidationErrors(errors, data, row, flags) {
2654
2884
  if (flags.silentCheck) {
@@ -2668,9 +2898,9 @@ export default class Component extends Element {
2668
2898
  * @param {*} data - The root data you wish to use for this component.
2669
2899
  * @param {*} row - The contextual row data you wish to use for this component.
2670
2900
  * @param {*} flags - The flags to control the behavior of the validation.
2671
- * @returns
2901
+ * @returns {Array<any>} - An array of errors if the component is invalid.
2672
2902
  */
2673
- validateComponent(data, row, flags = {}) {
2903
+ validateComponent(data = null, row = null, flags = {}) {
2674
2904
  data = data || this.rootValue;
2675
2905
  row = row || this.data;
2676
2906
  const { async = false } = flags;
@@ -2701,13 +2931,14 @@ export default class Component extends Element {
2701
2931
  }
2702
2932
  /**
2703
2933
  * Checks the validity of this component and sets the error message if it is invalid.
2704
- *
2705
- * @param data
2706
- * @param dirty
2707
- * @param row
2708
- * @return {boolean}
2709
- */
2710
- checkComponentValidity(data, dirty, row, flags = {}, allErrors = []) {
2934
+ * @param {*} data - The data to check if the component is valid.
2935
+ * @param {boolean} dirty - If the component is dirty.
2936
+ * @param {*} row - The contextual row data for this component.
2937
+ * @param {*} flags - The flags to use when checking the validity.
2938
+ * @param {Array<any>} allErrors - An array of all errors that have occured so that it can be appended when another one occurs here.
2939
+ * @returns {boolean} - TRUE if the component is valid.
2940
+ */
2941
+ checkComponentValidity(data = null, dirty = false, row = null, flags = {}, allErrors = []) {
2711
2942
  data = data || this.rootValue;
2712
2943
  row = row || this.data;
2713
2944
  flags.dirty = dirty || false;
@@ -2743,32 +2974,30 @@ export default class Component extends Element {
2743
2974
  }
2744
2975
  /**
2745
2976
  * Checks the validity of the component.
2746
- * @param {*} data
2747
- * @param {*} dirty
2748
- * @param {*} row
2749
- * @param {*} silentCheck
2750
- * @returns
2751
- */
2752
- checkValidity(data, dirty, row, silentCheck, errors = []) {
2977
+ * @param {*} data - The data to check if the component is valid.
2978
+ * @param {boolean} dirty - If the component is dirty.
2979
+ * @param {*} row - The contextual row data for this component.
2980
+ * @param {boolean} silentCheck - If the check should be silent and not set the error messages.
2981
+ * @param {Array<any>} errors - An array of all errors that have occured so that it can be appended when another one occurs here.
2982
+ * @returns {boolean} - TRUE if the component is valid.
2983
+ */
2984
+ checkValidity(data = null, dirty = false, row = null, silentCheck = false, errors = []) {
2753
2985
  data = data || this.rootValue;
2754
2986
  row = row || this.data;
2755
- console.log('Deprecation warning: Component.checkValidity() will be deprecated in 6.x version of renderer. Use Component.validateComponent instead.');
2756
2987
  return this.checkComponentValidity(data, dirty, row, { silentCheck }, errors);
2757
2988
  }
2758
- checkAsyncValidity(data, dirty, row, silentCheck, errors = []) {
2759
- console.log('Deprecation warning: Component.checkAsyncValidity() will be deprecated in 6.x version of renderer. Use Component.validateComponent instead.');
2989
+ checkAsyncValidity(data = null, dirty = false, row = null, silentCheck = false, errors = []) {
2760
2990
  return this.checkComponentValidity(data, dirty, row, { async: true, silentCheck }, errors);
2761
2991
  }
2762
2992
  /**
2763
2993
  * Check the conditions, calculations, and validity of a single component and triggers an update if
2764
2994
  * something changed.
2765
- *
2766
- * @param data - The root data of the change event.
2767
- * @param flags - The flags from this change event.
2768
- *
2769
- * @return boolean - If component is valid or not.
2995
+ * @param {*} data - The root data of the change event.
2996
+ * @param {*} flags - The flags from this change event.
2997
+ * @param {*} row - The contextual row data for this component.
2998
+ * @returns {void|boolean} - TRUE if no check should be performed on the component.
2770
2999
  */
2771
- checkData(data, flags, row) {
3000
+ checkData(data = null, flags = null, row = null) {
2772
3001
  data = data || this.rootValue;
2773
3002
  flags = flags || {};
2774
3003
  row = row || this.data;
@@ -2811,8 +3040,7 @@ export default class Component extends Element {
2811
3040
  }
2812
3041
  /**
2813
3042
  * Check if a component is eligible for multiple validation
2814
- *
2815
- * @return {boolean}
3043
+ * @returns {boolean} - TRUE if the component is eligible for multiple validation.
2816
3044
  */
2817
3045
  validateMultiple() {
2818
3046
  return true;
@@ -2930,8 +3158,7 @@ export default class Component extends Element {
2930
3158
  /**
2931
3159
  * Determines if the value of this component is hidden from the user as if it is coming from the server, but is
2932
3160
  * protected.
2933
- *
2934
- * @return {boolean|*}
3161
+ * @returns {boolean|*} - TRUE if the value is hidden.
2935
3162
  */
2936
3163
  isValueHidden() {
2937
3164
  if (this.component.protected && this.root.editing) {
@@ -2976,6 +3203,8 @@ export default class Component extends Element {
2976
3203
  }
2977
3204
  /**
2978
3205
  * Prints out the value of this component as a string value.
3206
+ * @param {*} value - The value to print out.
3207
+ * @returns {string} - The string representation of the value.
2979
3208
  */
2980
3209
  asString(value) {
2981
3210
  value = value || this.getValue();
@@ -2983,15 +3212,14 @@ export default class Component extends Element {
2983
3212
  }
2984
3213
  /**
2985
3214
  * Return if the component is disabled.
2986
- * @return {boolean}
3215
+ * @returns {boolean} - TRUE if the component is disabled.
2987
3216
  */
2988
3217
  get disabled() {
2989
3218
  return this._disabled || this.parentDisabled;
2990
3219
  }
2991
3220
  /**
2992
3221
  * Disable this component.
2993
- *
2994
- * @param {boolean} disabled
3222
+ * @param {boolean} disabled - TRUE to disable the component.
2995
3223
  */
2996
3224
  set disabled(disabled) {
2997
3225
  this._disabled = disabled;
@@ -3102,6 +3330,10 @@ export default class Component extends Element {
3102
3330
  const disabled = this.shouldDisabled;
3103
3331
  // Change states which won't be recalculated during redrawing
3104
3332
  if (this.visible !== visible) {
3333
+ // If the logic is triggered by an event and the action sets the hidden state then the original
3334
+ // component definition must be changed so that the components hidden state does not get flipped back by
3335
+ // the fieldLogic function
3336
+ this.originalComponent.hidden = !visible;
3105
3337
  this.visible = visible;
3106
3338
  }
3107
3339
  if (this.disabled !== disabled) {
@@ -3116,6 +3348,7 @@ export default class Component extends Element {
3116
3348
  }
3117
3349
  /**
3118
3350
  * Get the element information.
3351
+ * @returns {*} - The components "input" DOM element information.
3119
3352
  */
3120
3353
  elementInfo() {
3121
3354
  const attributes = {
@@ -3154,14 +3387,12 @@ export default class Component extends Element {
3154
3387
  const { left, top } = element.getBoundingClientRect();
3155
3388
  window.scrollTo(left + window.scrollX, top + window.scrollY);
3156
3389
  }
3157
- focus(index) {
3390
+ focus(index = (this.refs.input.length - 1)) {
3158
3391
  if ('beforeFocus' in this.parent) {
3159
3392
  this.parent.beforeFocus(this);
3160
3393
  }
3161
3394
  if (this.refs.input?.length) {
3162
- const focusingInput = typeof index === 'number' && this.refs.input[index]
3163
- ? this.refs.input[index]
3164
- : this.refs.input[this.refs.input.length - 1];
3395
+ const focusingInput = this.refs.input[index];
3165
3396
  if (this.component.widget?.type === 'calendar') {
3166
3397
  const sibling = focusingInput.nextSibling;
3167
3398
  if (sibling) {
@@ -3181,6 +3412,7 @@ export default class Component extends Element {
3181
3412
  }
3182
3413
  /**
3183
3414
  * Get `Formio` instance for working with files
3415
+ * @returns {import('@formio/core').Formio} - The Formio instance file service.
3184
3416
  */
3185
3417
  get fileService() {
3186
3418
  if (this.options.fileService) {
@@ -3219,7 +3451,7 @@ Component.requireLibrary = function (name, property, src, polling) {
3219
3451
  }.bind(Component.externalLibraries[name]);
3220
3452
  }
3221
3453
  // See if the plugin already exists.
3222
- const plugin = _.get(window, property);
3454
+ const plugin = getScriptPlugin(property);
3223
3455
  if (plugin) {
3224
3456
  Component.externalLibraries[name].resolve(plugin);
3225
3457
  }
@@ -3262,7 +3494,7 @@ Component.requireLibrary = function (name, property, src, polling) {
3262
3494
  // if no callback is provided, then check periodically for the script.
3263
3495
  if (polling) {
3264
3496
  setTimeout(function checkLibrary() {
3265
- const plugin = _.get(window, property);
3497
+ const plugin = getScriptPlugin(property);
3266
3498
  if (plugin) {
3267
3499
  Component.externalLibraries[name].resolve(plugin);
3268
3500
  }