@formio/js 5.2.3 → 5.2.4-rc.0

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 (510) hide show
  1. package/dist/formio.builder.css +161 -50
  2. package/dist/formio.builder.min.css +1 -1
  3. package/dist/formio.embed.js +1 -1
  4. package/dist/formio.embed.min.js +1 -1
  5. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  6. package/dist/formio.form.css +158 -49
  7. package/dist/formio.form.js +152 -108
  8. package/dist/formio.form.min.css +1 -1
  9. package/dist/formio.form.min.js +1 -1
  10. package/dist/formio.form.min.js.LICENSE.txt +1 -1
  11. package/dist/formio.full.css +161 -50
  12. package/dist/formio.full.js +401 -227
  13. package/dist/formio.full.min.css +1 -1
  14. package/dist/formio.full.min.js +1 -1
  15. package/dist/formio.full.min.js.LICENSE.txt +1 -1
  16. package/dist/formio.js +51 -18
  17. package/dist/formio.min.js +1 -1
  18. package/dist/formio.min.js.LICENSE.txt +1 -1
  19. package/dist/formio.utils.js +47 -14
  20. package/dist/formio.utils.min.js +1 -1
  21. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  22. package/lib/cjs/CDN.js +12 -12
  23. package/lib/cjs/Element.d.ts +3 -2
  24. package/lib/cjs/Element.js +27 -21
  25. package/lib/cjs/Embed.js +74 -40
  26. package/lib/cjs/EventEmitter.js +1 -1
  27. package/lib/cjs/Form.d.ts +371 -341
  28. package/lib/cjs/Form.js +153 -39
  29. package/lib/cjs/FormBuilder.d.ts +3 -3
  30. package/lib/cjs/FormBuilder.js +2 -3
  31. package/lib/cjs/Formio.js +26 -23
  32. package/lib/cjs/InlineEmbed.js +23 -17
  33. package/lib/cjs/PDF.d.ts +1 -0
  34. package/lib/cjs/PDF.js +18 -15
  35. package/lib/cjs/PDFBuilder.js +51 -36
  36. package/lib/cjs/Webform.d.ts +8 -366
  37. package/lib/cjs/Webform.js +176 -235
  38. package/lib/cjs/WebformBuilder.js +217 -144
  39. package/lib/cjs/Wizard.js +92 -62
  40. package/lib/cjs/WizardBuilder.js +27 -19
  41. package/lib/cjs/addons/FormioAddon.js +1 -1
  42. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.form.js +59 -57
  43. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +24 -16
  44. package/lib/cjs/addons/index.js +3 -3
  45. package/lib/cjs/components/Components.js +0 -4
  46. package/lib/cjs/components/_classes/component/Component.form.js +11 -11
  47. package/lib/cjs/components/_classes/component/Component.js +298 -179
  48. package/lib/cjs/components/_classes/component/editForm/Component.edit.addons.js +2 -4
  49. package/lib/cjs/components/_classes/component/editForm/Component.edit.api.js +5 -5
  50. package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +9 -11
  51. package/lib/cjs/components/_classes/component/editForm/Component.edit.data.d.ts +37 -0
  52. package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +39 -25
  53. package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +47 -29
  54. package/lib/cjs/components/_classes/component/editForm/Component.edit.layout.js +9 -9
  55. package/lib/cjs/components/_classes/component/editForm/Component.edit.logic.js +5 -7
  56. package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +37 -34
  57. package/lib/cjs/components/_classes/component/editForm/utils.js +12 -16
  58. package/lib/cjs/components/_classes/componentModal/ComponentModal.js +6 -6
  59. package/lib/cjs/components/_classes/field/Field.js +7 -1
  60. package/lib/cjs/components/_classes/input/Input.js +30 -26
  61. package/lib/cjs/components/_classes/list/ListComponent.form.js +1 -1
  62. package/lib/cjs/components/_classes/list/ListComponent.js +27 -18
  63. package/lib/cjs/components/_classes/list/editForm/ListComponent.edit.data.js +36 -9
  64. package/lib/cjs/components/_classes/multivalue/Multivalue.js +32 -13
  65. package/lib/cjs/components/_classes/nested/NestedComponent.form.js +3 -3
  66. package/lib/cjs/components/_classes/nested/NestedComponent.js +36 -32
  67. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +19 -14
  68. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +19 -17
  69. package/lib/cjs/components/address/Address.js +52 -45
  70. package/lib/cjs/components/address/editForm/Address.edit.data.js +2 -2
  71. package/lib/cjs/components/address/editForm/Address.edit.display.js +2 -2
  72. package/lib/cjs/components/address/editForm/Address.edit.provider.js +53 -11
  73. package/lib/cjs/components/alert/Alert.js +21 -15
  74. package/lib/cjs/components/button/Button.form.js +1 -1
  75. package/lib/cjs/components/button/Button.js +50 -27
  76. package/lib/cjs/components/button/editForm/Button.edit.display.js +49 -9
  77. package/lib/cjs/components/checkbox/Checkbox.d.ts +1 -1
  78. package/lib/cjs/components/checkbox/Checkbox.form.js +3 -3
  79. package/lib/cjs/components/checkbox/Checkbox.js +28 -20
  80. package/lib/cjs/components/checkbox/editForm/Checkbox.edit.data.js +1 -1
  81. package/lib/cjs/components/checkbox/editForm/Checkbox.edit.display.js +13 -3
  82. package/lib/cjs/components/checkbox/editForm/Checkbox.edit.validation.js +2 -2
  83. package/lib/cjs/components/columns/Columns.form.js +1 -1
  84. package/lib/cjs/components/columns/Columns.js +24 -12
  85. package/lib/cjs/components/columns/editForm/Columns.edit.display.js +17 -17
  86. package/lib/cjs/components/container/Container.form.js +2 -2
  87. package/lib/cjs/components/container/Container.js +6 -4
  88. package/lib/cjs/components/container/editForm/Container.edit.data.js +3 -3
  89. package/lib/cjs/components/container/editForm/Container.edit.display.js +4 -4
  90. package/lib/cjs/components/content/Content.form.js +4 -2
  91. package/lib/cjs/components/content/Content.js +10 -8
  92. package/lib/cjs/components/content/editForm/Content.edit.display.js +10 -10
  93. package/lib/cjs/components/currency/Currency.form.js +3 -3
  94. package/lib/cjs/components/currency/Currency.js +19 -10
  95. package/lib/cjs/components/currency/editForm/Currency.edit.data.js +5 -5
  96. package/lib/cjs/components/currency/editForm/Currency.edit.display.js +8 -8
  97. package/lib/cjs/components/datagrid/DataGrid.form.js +3 -3
  98. package/lib/cjs/components/datagrid/DataGrid.js +89 -38
  99. package/lib/cjs/components/datagrid/editForm/DataGrid.edit.data.js +1 -1
  100. package/lib/cjs/components/datagrid/editForm/DataGrid.edit.display.js +14 -14
  101. package/lib/cjs/components/datagrid/editForm/DataGrid.edit.validation.js +3 -3
  102. package/lib/cjs/components/datamap/DataMap.form.js +2 -2
  103. package/lib/cjs/components/datamap/DataMap.js +44 -31
  104. package/lib/cjs/components/datamap/editForm/DataMap.edit.data.js +1 -1
  105. package/lib/cjs/components/datamap/editForm/DataMap.edit.display.js +8 -8
  106. package/lib/cjs/components/datetime/DateTime.form.js +5 -5
  107. package/lib/cjs/components/datetime/DateTime.js +30 -15
  108. package/lib/cjs/components/datetime/editForm/DateTime.edit.data.js +4 -3
  109. package/lib/cjs/components/datetime/editForm/DateTime.edit.date.js +10 -10
  110. package/lib/cjs/components/datetime/editForm/DateTime.edit.display.js +22 -17
  111. package/lib/cjs/components/datetime/editForm/DateTime.edit.time.js +5 -5
  112. package/lib/cjs/components/datetime/editForm/DateTime.edit.validation.js +3 -3
  113. package/lib/cjs/components/day/Day.form.js +5 -5
  114. package/lib/cjs/components/day/Day.js +146 -56
  115. package/lib/cjs/components/day/editForm/Day.edit.day.js +13 -9
  116. package/lib/cjs/components/day/editForm/Day.edit.display.js +7 -7
  117. package/lib/cjs/components/day/editForm/Day.edit.month.js +12 -8
  118. package/lib/cjs/components/day/editForm/Day.edit.validation.js +7 -7
  119. package/lib/cjs/components/day/editForm/Day.edit.year.js +8 -8
  120. package/lib/cjs/components/editgrid/EditGrid.form.js +2 -2
  121. package/lib/cjs/components/editgrid/EditGrid.js +137 -89
  122. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.data.js +2 -2
  123. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +7 -2
  124. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.templates.js +16 -16
  125. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.validation.js +3 -3
  126. package/lib/cjs/components/email/Email.js +4 -4
  127. package/lib/cjs/components/email/editForm/Email.edit.display.js +3 -3
  128. package/lib/cjs/components/email/editForm/Email.edit.validation.js +6 -6
  129. package/lib/cjs/components/fieldset/Fieldset.form.js +1 -1
  130. package/lib/cjs/components/fieldset/Fieldset.js +2 -2
  131. package/lib/cjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -8
  132. package/lib/cjs/components/file/File.form.js +4 -4
  133. package/lib/cjs/components/file/File.js +126 -80
  134. package/lib/cjs/components/file/editForm/File.edit.display.js +9 -5
  135. package/lib/cjs/components/file/editForm/File.edit.file.d.ts +37 -16
  136. package/lib/cjs/components/file/editForm/File.edit.file.js +169 -72
  137. package/lib/cjs/components/file/editForm/File.edit.validation.js +2 -2
  138. package/lib/cjs/components/form/Form.form.js +3 -3
  139. package/lib/cjs/components/form/Form.js +67 -51
  140. package/lib/cjs/components/form/editForm/Form.edit.data.js +1 -3
  141. package/lib/cjs/components/form/editForm/Form.edit.display.js +6 -7
  142. package/lib/cjs/components/form/editForm/Form.edit.form.js +11 -9
  143. package/lib/cjs/components/hidden/Hidden.form.js +4 -4
  144. package/lib/cjs/components/hidden/Hidden.js +2 -2
  145. package/lib/cjs/components/hidden/editForm/Hidden.edit.data.js +3 -3
  146. package/lib/cjs/components/hidden/editForm/Hidden.edit.display.js +10 -10
  147. package/lib/cjs/components/html/HTML.js +23 -17
  148. package/lib/cjs/components/html/editForm/HTML.edit.display.js +17 -17
  149. package/lib/cjs/components/html/editForm/HTML.edit.logic.js +2 -2
  150. package/lib/cjs/components/number/Number.form.js +3 -3
  151. package/lib/cjs/components/number/Number.js +27 -11
  152. package/lib/cjs/components/number/editForm/Number.edit.data.js +3 -3
  153. package/lib/cjs/components/number/editForm/Number.edit.display.js +4 -4
  154. package/lib/cjs/components/number/editForm/Number.edit.validation.js +9 -9
  155. package/lib/cjs/components/panel/Panel.form.js +1 -1
  156. package/lib/cjs/components/panel/Panel.js +2 -2
  157. package/lib/cjs/components/panel/editForm/Panel.edit.conditional.js +5 -7
  158. package/lib/cjs/components/panel/editForm/Panel.edit.display.js +55 -29
  159. package/lib/cjs/components/password/Password.form.js +3 -3
  160. package/lib/cjs/components/password/Password.js +5 -2
  161. package/lib/cjs/components/password/editForm/Password.edit.data.js +11 -11
  162. package/lib/cjs/components/password/editForm/Password.edit.display.js +3 -3
  163. package/lib/cjs/components/password/editForm/Password.edit.validation.js +3 -3
  164. package/lib/cjs/components/phonenumber/PhoneNumber.form.js +8 -8
  165. package/lib/cjs/components/phonenumber/PhoneNumber.js +3 -3
  166. package/lib/cjs/components/phonenumber/editForm/PhoneNumber.edit.validation.js +6 -6
  167. package/lib/cjs/components/radio/Radio.form.js +3 -3
  168. package/lib/cjs/components/radio/Radio.js +55 -26
  169. package/lib/cjs/components/radio/editForm/Radio.edit.data.js +23 -9
  170. package/lib/cjs/components/radio/editForm/Radio.edit.display.js +6 -6
  171. package/lib/cjs/components/radio/editForm/Radio.edit.validation.js +2 -2
  172. package/lib/cjs/components/recaptcha/ReCaptcha.form.js +5 -5
  173. package/lib/cjs/components/recaptcha/ReCaptcha.js +7 -5
  174. package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +24 -24
  175. package/lib/cjs/components/select/Select.form.js +3 -3
  176. package/lib/cjs/components/select/Select.js +235 -129
  177. package/lib/cjs/components/select/editForm/Select.edit.data.d.ts +1 -1
  178. package/lib/cjs/components/select/editForm/Select.edit.data.js +191 -57
  179. package/lib/cjs/components/select/editForm/Select.edit.display.js +2 -2
  180. package/lib/cjs/components/select/editForm/Select.edit.validation.js +4 -4
  181. package/lib/cjs/components/selectboxes/SelectBoxes.form.js +3 -3
  182. package/lib/cjs/components/selectboxes/SelectBoxes.js +31 -15
  183. package/lib/cjs/components/selectboxes/editForm/SelectBoxes.edit.validation.js +5 -5
  184. package/lib/cjs/components/signature/Signature.form.js +3 -3
  185. package/lib/cjs/components/signature/Signature.js +25 -15
  186. package/lib/cjs/components/signature/editForm/Signature.edit.display.js +19 -10
  187. package/lib/cjs/components/survey/Survey.form.js +3 -3
  188. package/lib/cjs/components/survey/Survey.js +30 -17
  189. package/lib/cjs/components/survey/editForm/Survey.edit.data.js +23 -11
  190. package/lib/cjs/components/survey/editForm/Survey.edit.display.js +1 -1
  191. package/lib/cjs/components/survey/editForm/Survey.edit.validation.js +1 -1
  192. package/lib/cjs/components/table/Table.form.js +1 -1
  193. package/lib/cjs/components/table/Table.js +7 -5
  194. package/lib/cjs/components/table/editForm/Table.edit.display.js +22 -22
  195. package/lib/cjs/components/tabs/Tabs.form.js +1 -1
  196. package/lib/cjs/components/tabs/Tabs.js +26 -8
  197. package/lib/cjs/components/tabs/editForm/Tabs.edit.display.js +21 -17
  198. package/lib/cjs/components/tags/Tags.form.js +1 -1
  199. package/lib/cjs/components/tags/Tags.js +28 -12
  200. package/lib/cjs/components/tags/editForm/Tags.edit.data.js +7 -7
  201. package/lib/cjs/components/textarea/TextArea.form.js +2 -2
  202. package/lib/cjs/components/textarea/TextArea.js +63 -45
  203. package/lib/cjs/components/textarea/editForm/TextArea.edit.display.js +96 -72
  204. package/lib/cjs/components/textarea/editForm/TextArea.edit.validation.js +3 -3
  205. package/lib/cjs/components/textfield/TextField.form.js +3 -3
  206. package/lib/cjs/components/textfield/TextField.js +32 -21
  207. package/lib/cjs/components/textfield/editForm/TextField.edit.data.js +15 -13
  208. package/lib/cjs/components/textfield/editForm/TextField.edit.display.js +31 -21
  209. package/lib/cjs/components/textfield/editForm/TextField.edit.validation.js +6 -6
  210. package/lib/cjs/components/time/Time.js +17 -10
  211. package/lib/cjs/components/time/editForm/Time.edit.display.js +2 -2
  212. package/lib/cjs/components/unknown/Unknown.form.js +5 -5
  213. package/lib/cjs/components/unknown/Unknown.js +2 -2
  214. package/lib/cjs/components/unknown/editForm/Unknown.edit.display.js +3 -3
  215. package/lib/cjs/components/url/Url.form.js +3 -3
  216. package/lib/cjs/components/url/Url.js +2 -2
  217. package/lib/cjs/components/url/editForm/Url.edit.display.js +3 -3
  218. package/lib/cjs/components/url/editForm/Url.edit.validation.js +1 -1
  219. package/lib/cjs/components/well/Well.form.js +1 -1
  220. package/lib/cjs/components/well/Well.js +2 -2
  221. package/lib/cjs/components/well/editForm/Well.edit.display.js +10 -10
  222. package/lib/cjs/formio.form.d.ts +2 -1
  223. package/lib/cjs/formio.form.js +38 -12
  224. package/lib/cjs/i18n.d.ts +4 -0
  225. package/lib/cjs/i18n.js +7 -3
  226. package/lib/cjs/package.json +1 -1
  227. package/lib/cjs/providers/address/AddressProvider.js +8 -5
  228. package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +3 -3
  229. package/lib/cjs/providers/address/GoogleAddressProvider.js +24 -13
  230. package/lib/cjs/providers/processor/fileProcessor.js +3 -1
  231. package/lib/cjs/providers/storage/azure.js +5 -2
  232. package/lib/cjs/providers/storage/dropbox.js +4 -5
  233. package/lib/cjs/providers/storage/googleDrive.js +3 -4
  234. package/lib/cjs/providers/storage/index.js +1 -1
  235. package/lib/cjs/providers/storage/indexeddb.js +16 -6
  236. package/lib/cjs/providers/storage/s3.js +17 -6
  237. package/lib/cjs/providers/storage/uploadAdapter.js +17 -11
  238. package/lib/cjs/providers/storage/url.js +13 -11
  239. package/lib/cjs/providers/storage/xhr.js +17 -9
  240. package/lib/cjs/templates/index.js +1 -1
  241. package/lib/cjs/translations/de.d.ts +80 -0
  242. package/lib/cjs/translations/de.js +81 -0
  243. package/lib/cjs/translations/en.d.ts +0 -2
  244. package/lib/cjs/translations/en.js +7 -9
  245. package/lib/cjs/utils/ChoicesWrapper.js +2 -2
  246. package/lib/cjs/utils/builder.js +31 -7
  247. package/lib/cjs/utils/calendarUtils.js +7 -5
  248. package/lib/cjs/utils/conditionOperators/ConditionOperator.js +1 -1
  249. package/lib/cjs/utils/conditionOperators/DateGreaterThan.js +12 -4
  250. package/lib/cjs/utils/conditionOperators/IsEmptyValue.js +3 -1
  251. package/lib/cjs/utils/conditionOperators/IsEqualTo.js +10 -6
  252. package/lib/cjs/utils/conditionOperators/index.js +1 -1
  253. package/lib/cjs/utils/formUtils.js +1 -1
  254. package/lib/cjs/utils/i18n.js +7 -1
  255. package/lib/cjs/utils/index.d.ts +2 -1
  256. package/lib/cjs/utils/index.js +2 -2
  257. package/lib/cjs/utils/utils.d.ts +10 -1
  258. package/lib/cjs/utils/utils.js +175 -92
  259. package/lib/cjs/widgets/CalendarWidget.js +66 -49
  260. package/lib/cjs/widgets/InputWidget.js +6 -4
  261. package/lib/cjs/widgets/index.js +1 -1
  262. package/lib/mjs/CDN.js +12 -12
  263. package/lib/mjs/Element.d.ts +3 -2
  264. package/lib/mjs/Element.js +27 -21
  265. package/lib/mjs/Embed.js +76 -42
  266. package/lib/mjs/EventEmitter.js +1 -1
  267. package/lib/mjs/Form.d.ts +371 -341
  268. package/lib/mjs/Form.js +142 -126
  269. package/lib/mjs/FormBuilder.d.ts +3 -3
  270. package/lib/mjs/FormBuilder.js +2 -3
  271. package/lib/mjs/Formio.js +26 -23
  272. package/lib/mjs/InlineEmbed.js +23 -17
  273. package/lib/mjs/PDF.d.ts +1 -0
  274. package/lib/mjs/PDF.js +18 -15
  275. package/lib/mjs/PDFBuilder.js +51 -36
  276. package/lib/mjs/Webform.d.ts +8 -366
  277. package/lib/mjs/Webform.js +183 -250
  278. package/lib/mjs/WebformBuilder.js +220 -147
  279. package/lib/mjs/Wizard.js +93 -63
  280. package/lib/mjs/WizardBuilder.js +27 -19
  281. package/lib/mjs/addons/FormioAddon.js +1 -1
  282. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.form.js +59 -57
  283. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +24 -16
  284. package/lib/mjs/addons/index.js +3 -3
  285. package/lib/mjs/components/Components.js +0 -4
  286. package/lib/mjs/components/_classes/component/Component.form.js +11 -11
  287. package/lib/mjs/components/_classes/component/Component.js +303 -184
  288. package/lib/mjs/components/_classes/component/editForm/Component.edit.addons.js +2 -4
  289. package/lib/mjs/components/_classes/component/editForm/Component.edit.api.js +5 -5
  290. package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +9 -11
  291. package/lib/mjs/components/_classes/component/editForm/Component.edit.data.d.ts +37 -0
  292. package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +39 -25
  293. package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +47 -29
  294. package/lib/mjs/components/_classes/component/editForm/Component.edit.layout.js +9 -9
  295. package/lib/mjs/components/_classes/component/editForm/Component.edit.logic.js +5 -7
  296. package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +37 -34
  297. package/lib/mjs/components/_classes/component/editForm/utils.js +12 -16
  298. package/lib/mjs/components/_classes/componentModal/ComponentModal.js +2 -2
  299. package/lib/mjs/components/_classes/field/Field.js +8 -2
  300. package/lib/mjs/components/_classes/input/Input.js +27 -23
  301. package/lib/mjs/components/_classes/list/ListComponent.form.js +1 -1
  302. package/lib/mjs/components/_classes/list/ListComponent.js +27 -18
  303. package/lib/mjs/components/_classes/list/editForm/ListComponent.edit.data.js +36 -9
  304. package/lib/mjs/components/_classes/multivalue/Multivalue.js +32 -13
  305. package/lib/mjs/components/_classes/nested/NestedComponent.form.js +3 -3
  306. package/lib/mjs/components/_classes/nested/NestedComponent.js +32 -28
  307. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +20 -15
  308. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +19 -17
  309. package/lib/mjs/components/address/Address.js +57 -46
  310. package/lib/mjs/components/address/editForm/Address.edit.data.js +2 -2
  311. package/lib/mjs/components/address/editForm/Address.edit.display.js +2 -2
  312. package/lib/mjs/components/address/editForm/Address.edit.provider.js +53 -11
  313. package/lib/mjs/components/alert/Alert.js +22 -16
  314. package/lib/mjs/components/button/Button.form.js +1 -1
  315. package/lib/mjs/components/button/Button.js +51 -28
  316. package/lib/mjs/components/button/editForm/Button.edit.display.js +49 -9
  317. package/lib/mjs/components/checkbox/Checkbox.d.ts +1 -1
  318. package/lib/mjs/components/checkbox/Checkbox.form.js +3 -3
  319. package/lib/mjs/components/checkbox/Checkbox.js +29 -21
  320. package/lib/mjs/components/checkbox/editForm/Checkbox.edit.data.js +1 -1
  321. package/lib/mjs/components/checkbox/editForm/Checkbox.edit.display.js +13 -3
  322. package/lib/mjs/components/checkbox/editForm/Checkbox.edit.validation.js +2 -2
  323. package/lib/mjs/components/columns/Columns.form.js +1 -1
  324. package/lib/mjs/components/columns/Columns.js +24 -12
  325. package/lib/mjs/components/columns/editForm/Columns.edit.display.js +17 -17
  326. package/lib/mjs/components/container/Container.form.js +2 -2
  327. package/lib/mjs/components/container/Container.js +6 -4
  328. package/lib/mjs/components/container/editForm/Container.edit.data.js +3 -3
  329. package/lib/mjs/components/container/editForm/Container.edit.display.js +4 -4
  330. package/lib/mjs/components/content/Content.form.js +4 -2
  331. package/lib/mjs/components/content/Content.js +10 -8
  332. package/lib/mjs/components/content/editForm/Content.edit.display.js +10 -10
  333. package/lib/mjs/components/currency/Currency.form.js +3 -3
  334. package/lib/mjs/components/currency/Currency.js +19 -10
  335. package/lib/mjs/components/currency/editForm/Currency.edit.data.js +5 -5
  336. package/lib/mjs/components/currency/editForm/Currency.edit.display.js +8 -8
  337. package/lib/mjs/components/datagrid/DataGrid.form.js +3 -3
  338. package/lib/mjs/components/datagrid/DataGrid.js +90 -39
  339. package/lib/mjs/components/datagrid/editForm/DataGrid.edit.data.js +1 -1
  340. package/lib/mjs/components/datagrid/editForm/DataGrid.edit.display.js +14 -14
  341. package/lib/mjs/components/datagrid/editForm/DataGrid.edit.validation.js +3 -3
  342. package/lib/mjs/components/datamap/DataMap.form.js +2 -2
  343. package/lib/mjs/components/datamap/DataMap.js +44 -31
  344. package/lib/mjs/components/datamap/editForm/DataMap.edit.data.js +1 -1
  345. package/lib/mjs/components/datamap/editForm/DataMap.edit.display.js +8 -8
  346. package/lib/mjs/components/datetime/DateTime.form.js +5 -5
  347. package/lib/mjs/components/datetime/DateTime.js +31 -16
  348. package/lib/mjs/components/datetime/editForm/DateTime.edit.data.js +4 -3
  349. package/lib/mjs/components/datetime/editForm/DateTime.edit.date.js +10 -10
  350. package/lib/mjs/components/datetime/editForm/DateTime.edit.display.js +22 -17
  351. package/lib/mjs/components/datetime/editForm/DateTime.edit.time.js +5 -5
  352. package/lib/mjs/components/datetime/editForm/DateTime.edit.validation.js +3 -3
  353. package/lib/mjs/components/day/Day.form.js +5 -5
  354. package/lib/mjs/components/day/Day.js +147 -57
  355. package/lib/mjs/components/day/editForm/Day.edit.day.js +13 -9
  356. package/lib/mjs/components/day/editForm/Day.edit.display.js +7 -7
  357. package/lib/mjs/components/day/editForm/Day.edit.month.js +12 -8
  358. package/lib/mjs/components/day/editForm/Day.edit.validation.js +7 -7
  359. package/lib/mjs/components/day/editForm/Day.edit.year.js +8 -8
  360. package/lib/mjs/components/editgrid/EditGrid.form.js +2 -2
  361. package/lib/mjs/components/editgrid/EditGrid.js +138 -90
  362. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.data.js +2 -2
  363. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +7 -2
  364. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.templates.js +16 -16
  365. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.validation.js +3 -3
  366. package/lib/mjs/components/email/Email.js +4 -4
  367. package/lib/mjs/components/email/editForm/Email.edit.display.js +3 -3
  368. package/lib/mjs/components/email/editForm/Email.edit.validation.js +6 -6
  369. package/lib/mjs/components/fieldset/Fieldset.form.js +1 -1
  370. package/lib/mjs/components/fieldset/Fieldset.js +2 -2
  371. package/lib/mjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -8
  372. package/lib/mjs/components/file/File.form.js +4 -4
  373. package/lib/mjs/components/file/File.js +131 -84
  374. package/lib/mjs/components/file/editForm/File.edit.display.js +9 -5
  375. package/lib/mjs/components/file/editForm/File.edit.file.d.ts +37 -16
  376. package/lib/mjs/components/file/editForm/File.edit.file.js +169 -72
  377. package/lib/mjs/components/file/editForm/File.edit.validation.js +2 -2
  378. package/lib/mjs/components/form/Form.form.js +3 -3
  379. package/lib/mjs/components/form/Form.js +67 -51
  380. package/lib/mjs/components/form/editForm/Form.edit.data.js +1 -3
  381. package/lib/mjs/components/form/editForm/Form.edit.display.js +6 -7
  382. package/lib/mjs/components/form/editForm/Form.edit.form.js +10 -8
  383. package/lib/mjs/components/hidden/Hidden.form.js +4 -4
  384. package/lib/mjs/components/hidden/Hidden.js +2 -2
  385. package/lib/mjs/components/hidden/editForm/Hidden.edit.data.js +3 -3
  386. package/lib/mjs/components/hidden/editForm/Hidden.edit.display.js +10 -10
  387. package/lib/mjs/components/html/HTML.js +23 -17
  388. package/lib/mjs/components/html/editForm/HTML.edit.display.js +17 -17
  389. package/lib/mjs/components/html/editForm/HTML.edit.logic.js +2 -2
  390. package/lib/mjs/components/number/Number.form.js +3 -3
  391. package/lib/mjs/components/number/Number.js +28 -12
  392. package/lib/mjs/components/number/editForm/Number.edit.data.js +3 -3
  393. package/lib/mjs/components/number/editForm/Number.edit.display.js +4 -4
  394. package/lib/mjs/components/number/editForm/Number.edit.validation.js +9 -9
  395. package/lib/mjs/components/panel/Panel.form.js +1 -1
  396. package/lib/mjs/components/panel/Panel.js +2 -2
  397. package/lib/mjs/components/panel/editForm/Panel.edit.conditional.js +6 -8
  398. package/lib/mjs/components/panel/editForm/Panel.edit.display.js +55 -29
  399. package/lib/mjs/components/password/Password.form.js +3 -3
  400. package/lib/mjs/components/password/Password.js +5 -2
  401. package/lib/mjs/components/password/editForm/Password.edit.data.js +11 -11
  402. package/lib/mjs/components/password/editForm/Password.edit.display.js +3 -3
  403. package/lib/mjs/components/password/editForm/Password.edit.validation.js +3 -3
  404. package/lib/mjs/components/phonenumber/PhoneNumber.form.js +8 -8
  405. package/lib/mjs/components/phonenumber/PhoneNumber.js +3 -3
  406. package/lib/mjs/components/phonenumber/editForm/PhoneNumber.edit.validation.js +6 -6
  407. package/lib/mjs/components/radio/Radio.form.js +3 -3
  408. package/lib/mjs/components/radio/Radio.js +56 -27
  409. package/lib/mjs/components/radio/editForm/Radio.edit.data.js +23 -9
  410. package/lib/mjs/components/radio/editForm/Radio.edit.display.js +6 -6
  411. package/lib/mjs/components/radio/editForm/Radio.edit.validation.js +2 -2
  412. package/lib/mjs/components/recaptcha/ReCaptcha.form.js +5 -5
  413. package/lib/mjs/components/recaptcha/ReCaptcha.js +7 -5
  414. package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +24 -24
  415. package/lib/mjs/components/select/Select.form.js +3 -3
  416. package/lib/mjs/components/select/Select.js +240 -134
  417. package/lib/mjs/components/select/editForm/Select.edit.data.d.ts +1 -1
  418. package/lib/mjs/components/select/editForm/Select.edit.data.js +191 -57
  419. package/lib/mjs/components/select/editForm/Select.edit.display.js +2 -2
  420. package/lib/mjs/components/select/editForm/Select.edit.validation.js +4 -4
  421. package/lib/mjs/components/selectboxes/SelectBoxes.form.js +3 -3
  422. package/lib/mjs/components/selectboxes/SelectBoxes.js +32 -16
  423. package/lib/mjs/components/selectboxes/editForm/SelectBoxes.edit.validation.js +5 -5
  424. package/lib/mjs/components/signature/Signature.form.js +3 -3
  425. package/lib/mjs/components/signature/Signature.js +25 -15
  426. package/lib/mjs/components/signature/editForm/Signature.edit.display.js +19 -10
  427. package/lib/mjs/components/survey/Survey.form.js +3 -3
  428. package/lib/mjs/components/survey/Survey.js +30 -17
  429. package/lib/mjs/components/survey/editForm/Survey.edit.data.js +23 -11
  430. package/lib/mjs/components/survey/editForm/Survey.edit.display.js +1 -1
  431. package/lib/mjs/components/survey/editForm/Survey.edit.validation.js +1 -1
  432. package/lib/mjs/components/table/Table.form.js +1 -1
  433. package/lib/mjs/components/table/Table.js +7 -5
  434. package/lib/mjs/components/table/editForm/Table.edit.display.js +22 -22
  435. package/lib/mjs/components/tabs/Tabs.form.js +1 -1
  436. package/lib/mjs/components/tabs/Tabs.js +26 -8
  437. package/lib/mjs/components/tabs/editForm/Tabs.edit.display.js +21 -17
  438. package/lib/mjs/components/tags/Tags.form.js +1 -1
  439. package/lib/mjs/components/tags/Tags.js +28 -12
  440. package/lib/mjs/components/tags/editForm/Tags.edit.data.js +7 -7
  441. package/lib/mjs/components/textarea/TextArea.form.js +2 -2
  442. package/lib/mjs/components/textarea/TextArea.js +75 -51
  443. package/lib/mjs/components/textarea/editForm/TextArea.edit.display.js +96 -72
  444. package/lib/mjs/components/textarea/editForm/TextArea.edit.validation.js +3 -3
  445. package/lib/mjs/components/textfield/TextField.form.js +3 -3
  446. package/lib/mjs/components/textfield/TextField.js +34 -23
  447. package/lib/mjs/components/textfield/editForm/TextField.edit.data.js +15 -13
  448. package/lib/mjs/components/textfield/editForm/TextField.edit.display.js +31 -21
  449. package/lib/mjs/components/textfield/editForm/TextField.edit.validation.js +6 -6
  450. package/lib/mjs/components/time/Time.js +17 -10
  451. package/lib/mjs/components/time/editForm/Time.edit.display.js +2 -2
  452. package/lib/mjs/components/unknown/Unknown.form.js +5 -5
  453. package/lib/mjs/components/unknown/Unknown.js +2 -2
  454. package/lib/mjs/components/unknown/editForm/Unknown.edit.display.js +3 -3
  455. package/lib/mjs/components/url/Url.form.js +3 -3
  456. package/lib/mjs/components/url/Url.js +2 -2
  457. package/lib/mjs/components/url/editForm/Url.edit.display.js +3 -3
  458. package/lib/mjs/components/url/editForm/Url.edit.validation.js +1 -1
  459. package/lib/mjs/components/well/Well.form.js +1 -1
  460. package/lib/mjs/components/well/Well.js +2 -2
  461. package/lib/mjs/components/well/editForm/Well.edit.display.js +10 -10
  462. package/lib/mjs/formio.form.d.ts +2 -1
  463. package/lib/mjs/formio.form.js +10 -8
  464. package/lib/mjs/i18n.d.ts +4 -0
  465. package/lib/mjs/i18n.js +7 -3
  466. package/lib/mjs/package.json +1 -1
  467. package/lib/mjs/providers/address/AddressProvider.js +8 -5
  468. package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +3 -3
  469. package/lib/mjs/providers/address/GoogleAddressProvider.js +24 -13
  470. package/lib/mjs/providers/processor/fileProcessor.js +3 -1
  471. package/lib/mjs/providers/storage/azure.js +5 -2
  472. package/lib/mjs/providers/storage/dropbox.js +4 -5
  473. package/lib/mjs/providers/storage/googleDrive.js +3 -4
  474. package/lib/mjs/providers/storage/index.js +1 -1
  475. package/lib/mjs/providers/storage/indexeddb.js +16 -6
  476. package/lib/mjs/providers/storage/s3.js +19 -8
  477. package/lib/mjs/providers/storage/uploadAdapter.js +17 -11
  478. package/lib/mjs/providers/storage/url.js +13 -11
  479. package/lib/mjs/providers/storage/xhr.js +17 -9
  480. package/lib/mjs/templates/index.js +1 -1
  481. package/lib/mjs/translations/de.d.ts +80 -0
  482. package/lib/mjs/translations/de.js +79 -0
  483. package/lib/mjs/translations/en.d.ts +0 -2
  484. package/lib/mjs/translations/en.js +7 -9
  485. package/lib/mjs/utils/ChoicesWrapper.js +2 -2
  486. package/lib/mjs/utils/builder.js +31 -7
  487. package/lib/mjs/utils/calendarUtils.js +7 -5
  488. package/lib/mjs/utils/conditionOperators/ConditionOperator.js +1 -1
  489. package/lib/mjs/utils/conditionOperators/DateGreaterThan.js +16 -5
  490. package/lib/mjs/utils/conditionOperators/IsEmptyValue.js +3 -1
  491. package/lib/mjs/utils/conditionOperators/IsEqualTo.js +10 -6
  492. package/lib/mjs/utils/conditionOperators/index.js +1 -1
  493. package/lib/mjs/utils/formUtils.js +2 -2
  494. package/lib/mjs/utils/i18n.js +7 -1
  495. package/lib/mjs/utils/index.d.ts +2 -1
  496. package/lib/mjs/utils/index.js +3 -3
  497. package/lib/mjs/utils/utils.d.ts +10 -1
  498. package/lib/mjs/utils/utils.js +178 -91
  499. package/lib/mjs/widgets/CalendarWidget.js +67 -50
  500. package/lib/mjs/widgets/InputWidget.js +6 -4
  501. package/lib/mjs/widgets/index.js +1 -1
  502. package/package.json +3 -3
  503. package/lib/cjs/pdf.image.d.ts +0 -2
  504. package/lib/cjs/pdf.image.js +0 -94
  505. package/lib/cjs/utils/jsonlogic/operators.d.ts +0 -1
  506. package/lib/cjs/utils/jsonlogic/operators.js +0 -265
  507. package/lib/mjs/pdf.image.d.ts +0 -2
  508. package/lib/mjs/pdf.image.js +0 -94
  509. package/lib/mjs/utils/jsonlogic/operators.d.ts +0 -1
  510. package/lib/mjs/utils/jsonlogic/operators.js +0 -262
package/lib/mjs/Form.js CHANGED
@@ -3,90 +3,96 @@ import { Formio } from './Formio';
3
3
  import Displays from './displays';
4
4
  import templates from './templates';
5
5
  import FormioUtils from './utils';
6
+ /**
7
+ * Represents a JSON value.
8
+ * @typedef {(string | number | boolean | null | JSONArray | JSONObject)} JSON
9
+ */
10
+ /**
11
+ * Represents a JSON array.
12
+ * @typedef {Array<JSON>} JSONArray
13
+ */
14
+ /**
15
+ * Represents a JSON object.
16
+ * @typedef {{[key: string]: JSON}} JSONObject
17
+ */
18
+ /**
19
+ * @typedef {object} FormioHooks
20
+ * @property {Function} [beforeSubmit] - Called before a submission is made.
21
+ * @property {Function} [beforeCancel] - Called before a cancel is made.
22
+ * @property {Function} [beforeNext] - Called before the next page is navigated to.
23
+ * @property {Function} [beforePrev] - Called before the previous page is navigated to.
24
+ * @property {Function} [attachComponent] - Called when a component is attached.
25
+ * @property {Function} [setDataValue] - Called when a data value is set.
26
+ * @property {Function} [addComponents] - Called when components are added.
27
+ * @property {Function} [addComponent] - Called when a component is added.
28
+ * @property {Function} [customValidation] - Called when a custom validation is made.
29
+ * @property {Function} [attachWebform] - Called when a webform is attached.
30
+ */
31
+ /**
32
+ * @typedef {object} SanitizeConfig
33
+ * @property {string[]} [addAttr] - The html attributes to allow with sanitization.
34
+ * @property {string[]} [addTags] - The html tags to allow with sanitization.
35
+ * @property {string[]} [allowedAttrs] - The html attributes to allow with sanitization.
36
+ * @property {string[]} [allowedTags] - The html tags to allow with sanitization.
37
+ * @property {string[]} [allowedUriRegex] - The regex for allowed URIs.
38
+ * @property {string[]} [addUriSafeAttr] - The URI attributes to allow with sanitization.
39
+ */
40
+ /**
41
+ * @typedef {object} ButtonSettings
42
+ * @property {boolean} [showPrevious] - Show the previous button in wizard forms.
43
+ * @property {boolean} [showNext] - Show the next button in wizard forms.
44
+ * @property {boolean} [showCancel] - Show the cancel button in wizard forms.
45
+ * @property {boolean} [showSubmit] - Show the submit button in wizard forms.
46
+ */
47
+ /**
48
+ * @typedef {object} FormOptions
49
+ * @property {boolean} [saveDraft] - Enable the save draft feature.
50
+ * @property {number} [saveDraftThrottle] - The throttle for the save draft feature.
51
+ * @property {boolean} [readOnly] - Set this form to readOnly.
52
+ * @property {boolean} [noAlerts] - Disable the alerts dialog.
53
+ * @property {{[key: string]: string}} [i18n] - The translation file for this rendering.
54
+ * @property {string} [template] - Custom logic for creation of elements.
55
+ * @property {boolean} [noDefaults] - Exclude default values from the settings.
56
+ * @property {any} [fileService] - The file service for this form.
57
+ * @property {EventEmitter} [events] - The EventEmitter for this form.
58
+ * @property {string} [language] - The language to render this form in.
59
+ * @property {{[key: string]: string}} [i18next] - The i18next configuration for this form.
60
+ * @property {boolean} [viewAsHtml] - View the form as raw HTML.
61
+ * @property {'form' | 'html' | 'flat' | 'builder' | 'pdf'} [renderMode] - The render mode for this form.
62
+ * @property {boolean} [highlightErrors] - Highlight any errors on the form.
63
+ * @property {string} [componentErrorClass] - The error class for components.
64
+ * @property {any} [templates] - The templates for this form.
65
+ * @property {string} [iconset] - The iconset for this form.
66
+ * @property {import('@formio/core').Component[]} [components] - The components for this form.
67
+ * @property {{[key: string]: boolean}} [disabled] - Disabled components for this form.
68
+ * @property {boolean} [showHiddenFields] - Show hidden fields.
69
+ * @property {{[key: string]: boolean}} [hide] - Hidden components for this form.
70
+ * @property {{[key: string]: boolean}} [show] - Components to show for this form.
71
+ * @property {Formio} [formio] - The Formio instance for this form.
72
+ * @property {string} [decimalSeparator] - The decimal separator for this form.
73
+ * @property {string} [thousandsSeparator] - The thousands separator for this form.
74
+ * @property {FormioHooks} [hooks] - The hooks for this form.
75
+ * @property {boolean} [alwaysDirty] - Always be dirty.
76
+ * @property {boolean} [skipDraftRestore] - Skip restoring a draft.
77
+ * @property {'form' | 'wizard' | 'pdf'} [display] - The display for this form.
78
+ * @property {string} [cdnUrl] - The CDN url for this form.
79
+ * @property {boolean} [flatten] - Flatten the form.
80
+ * @property {boolean} [sanitize] - Sanitize the form.
81
+ * @property {SanitizeConfig} [sanitizeConfig] - The sanitize configuration for this form.
82
+ * @property {ButtonSettings} [buttonSettings] - The button settings for this form.
83
+ * @property {object} [breadcrumbSettings] - The breadcrumb settings for this form.
84
+ * @property {boolean} [allowPrevious] - Allow the previous button (for Wizard forms).
85
+ * @property {string[]} [wizardButtonOrder] - The order of the buttons (for Wizard forms).
86
+ * @property {boolean} [showCheckboxBackground] - Show the checkbox background.
87
+ * @property {number} [zoom] - The zoom for PDF forms.
88
+ * @property {boolean} [building] - Whether the form is in builder mode.
89
+ * @property {boolean} [inputsOnly] - Whether to render inputs only (for PDF forms).
90
+ */
91
+ /**
92
+ * Form class for rendering webforms, pdfs, and wizards.
93
+ * @property {FormOptions} options - The options for this Form instance.
94
+ */
6
95
  export default class Form extends Element {
7
- /**
8
- * Represents a JSON value.
9
- * @typedef {(string | number | boolean | null | JSONArray | JSONObject)} JSON
10
- */
11
- /**
12
- * Represents a JSON array.
13
- * @typedef {Array<JSON>} JSONArray
14
- */
15
- /**
16
- * Represents a JSON object.
17
- * @typedef {{[key: string]: JSON}} JSONObject
18
- */
19
- /**
20
- * @typedef {object} FormioHooks
21
- * @property {Function} [beforeSubmit] - Called before a submission is made.
22
- * @property {Function} [beforeCancel] - Called before a cancel is made.
23
- * @property {Function} [beforeNext] - Called before the next page is navigated to.
24
- * @property {Function} [beforePrev] - Called before the previous page is navigated to.
25
- * @property {Function} [attachComponent] - Called when a component is attached.
26
- * @property {Function} [setDataValue] - Called when a data value is set.
27
- * @property {Function} [addComponents] - Called when components are added.
28
- * @property {Function} [addComponent] - Called when a component is added.
29
- * @property {Function} [customValidation] - Called when a custom validation is made.
30
- * @property {Function} [attachWebform] - Called when a webform is attached.
31
- */
32
- /**
33
- * @typedef {object} SanitizeConfig
34
- * @property {string[]} [addAttr] - The html attributes to allow with sanitization.
35
- * @property {string[]} [addTags] - The html tags to allow with sanitization.
36
- * @property {string[]} [allowedAttrs] - The html attributes to allow with sanitization.
37
- * @property {string[]} [allowedTags] - The html tags to allow with sanitization.
38
- * @property {string[]} [allowedUriRegex] - The regex for allowed URIs.
39
- * @property {string[]} [addUriSafeAttr] - The URI attributes to allow with sanitization.
40
- */
41
- /**
42
- * @typedef {object} ButtonSettings
43
- * @property {boolean} [showPrevious] - Show the previous button in wizard forms.
44
- * @property {boolean} [showNext] - Show the next button in wizard forms.
45
- * @property {boolean} [showCancel] - Show the cancel button in wizard forms.
46
- * @property {boolean} [showSubmit] - Show the submit button in wizard forms.
47
- */
48
- /**
49
- * @typedef {object} FormOptions
50
- * @property {boolean} [saveDraft] - Enable the save draft feature.
51
- * @property {number} [saveDraftThrottle] - The throttle for the save draft feature.
52
- * @property {boolean} [readOnly] - Set this form to readOnly.
53
- * @property {boolean} [noAlerts] - Disable the alerts dialog.
54
- * @property {{[key: string]: string}} [i18n] - The translation file for this rendering.
55
- * @property {string} [template] - Custom logic for creation of elements.
56
- * @property {boolean} [noDefaults] - Exclude default values from the settings.
57
- * @property {any} [fileService] - The file service for this form.
58
- * @property {EventEmitter} [events] - The EventEmitter for this form.
59
- * @property {string} [language] - The language to render this form in.
60
- * @property {{[key: string]: string}} [i18next] - The i18next configuration for this form.
61
- * @property {boolean} [viewAsHtml] - View the form as raw HTML.
62
- * @property {'form' | 'html' | 'flat' | 'builder' | 'pdf'} [renderMode] - The render mode for this form.
63
- * @property {boolean} [highlightErrors] - Highlight any errors on the form.
64
- * @property {string} [componentErrorClass] - The error class for components.
65
- * @property {any} [templates] - The templates for this form.
66
- * @property {string} [iconset] - The iconset for this form.
67
- * @property {import('@formio/core').Component[]} [components] - The components for this form.
68
- * @property {{[key: string]: boolean}} [disabled] - Disabled components for this form.
69
- * @property {boolean} [showHiddenFields] - Show hidden fields.
70
- * @property {{[key: string]: boolean}} [hide] - Hidden components for this form.
71
- * @property {{[key: string]: boolean}} [show] - Components to show for this form.
72
- * @property {Formio} [formio] - The Formio instance for this form.
73
- * @property {string} [decimalSeparator] - The decimal separator for this form.
74
- * @property {string} [thousandsSeparator] - The thousands separator for this form.
75
- * @property {FormioHooks} [hooks] - The hooks for this form.
76
- * @property {boolean} [alwaysDirty] - Always be dirty.
77
- * @property {boolean} [skipDraftRestore] - Skip restoring a draft.
78
- * @property {'form' | 'wizard' | 'pdf'} [display] - The display for this form.
79
- * @property {string} [cdnUrl] - The CDN url for this form.
80
- * @property {boolean} [flatten] - Flatten the form.
81
- * @property {boolean} [sanitize] - Sanitize the form.
82
- * @property {SanitizeConfig} [sanitizeConfig] - The sanitize configuration for this form.
83
- * @property {ButtonSettings} [buttonSettings] - The button settings for this form.
84
- * @property {object} [breadcrumbSettings] - The breadcrumb settings for this form.
85
- * @property {boolean} [allowPrevious] - Allow the previous button (for Wizard forms).
86
- * @property {string[]} [wizardButtonOrder] - The order of the buttons (for Wizard forms).
87
- * @property {boolean} [showCheckboxBackground] - Show the checkbox background.
88
- * @property {number} [zoom] - The zoom for PDF forms.
89
- */
90
96
  /**
91
97
  * Creates an easy to use interface for embedding webforms, pdfs, and wizards into your application.
92
98
  * @param {object} elementOrForm - The DOM element you wish to render this form within, or the form definition.
@@ -97,10 +103,6 @@ export default class Form extends Element {
97
103
  * const form = new Form(document.getElementById('formio'), 'https://examples.form.io/example');
98
104
  * form.build();
99
105
  */
100
- /**
101
- * @type {FormOptions} - the options for this Form.
102
- */
103
- options;
104
106
  constructor(elementOrForm, formOrOptions, options = {}) {
105
107
  let element, form, formOptions;
106
108
  if (elementOrForm instanceof HTMLElement) {
@@ -150,7 +152,7 @@ export default class Form extends Element {
150
152
  element.setAttribute(attr, attrs[attr]);
151
153
  }
152
154
  }
153
- (children || []).forEach(child => {
155
+ (children || []).forEach((child) => {
154
156
  element.appendChild(this.createElement(child.tag, child.attrs, child.children));
155
157
  });
156
158
  return element;
@@ -164,19 +166,23 @@ export default class Form extends Element {
164
166
  return;
165
167
  }
166
168
  this.loader = this.createElement('div', {
167
- 'class': 'formio-loader'
168
- }, [{
169
+ class: 'formio-loader',
170
+ }, [
171
+ {
169
172
  tag: 'div',
170
173
  attrs: {
171
- class: 'loader-wrapper'
174
+ class: 'loader-wrapper',
172
175
  },
173
- children: [{
176
+ children: [
177
+ {
174
178
  tag: 'div',
175
179
  attrs: {
176
- class: 'loader text-center'
177
- }
178
- }]
179
- }]);
180
+ class: 'loader text-center',
181
+ },
182
+ },
183
+ ],
184
+ },
185
+ ]);
180
186
  this.element.appendChild(this.loader);
181
187
  }
182
188
  else if (this.loader) {
@@ -200,7 +206,6 @@ export default class Form extends Element {
200
206
  return new Displays.displays[display](this.element, this.options);
201
207
  }
202
208
  else {
203
- // eslint-disable-next-line new-cap
204
209
  return new Displays.displays['webform'](this.element, this.options);
205
210
  }
206
211
  }
@@ -216,21 +221,21 @@ export default class Form extends Element {
216
221
  return {
217
222
  components: [
218
223
  {
219
- 'label': 'HTML',
220
- 'tag': 'div',
221
- 'className': 'error error-message alert alert-danger ui red message',
222
- 'attrs': [
224
+ label: 'HTML',
225
+ tag: 'div',
226
+ className: 'error error-message alert alert-danger ui red message',
227
+ attrs: [
223
228
  {
224
- 'attr': 'role',
225
- 'value': 'alert'
226
- }
229
+ attr: 'role',
230
+ value: 'alert',
231
+ },
227
232
  ],
228
- 'key': 'errorMessage',
229
- 'type': 'htmlelement',
230
- 'input': false,
231
- 'content': typeof err === 'string' ? err : err.message,
232
- }
233
- ]
233
+ key: 'errorMessage',
234
+ type: 'htmlelement',
235
+ input: false,
236
+ content: typeof err === 'string' ? err : err.message,
237
+ },
238
+ ],
234
239
  };
235
240
  }
236
241
  /**
@@ -249,7 +254,7 @@ export default class Form extends Element {
249
254
  const projectUrl = url.substring(0, index - 1);
250
255
  const urlParts = Formio.getUrlParts(projectUrl);
251
256
  // project url doesn't include subdirectories path
252
- if (!urlParts || urlParts.filter(part => !!part).length < 4) {
257
+ if (!urlParts || urlParts.filter((part) => !!part).length < 4) {
253
258
  return options;
254
259
  }
255
260
  const baseUrl = `${urlParts[1]}${urlParts[2]}`;
@@ -264,7 +269,7 @@ export default class Form extends Element {
264
269
  }
265
270
  /**
266
271
  * Sets the form to the JSON schema of a form.
267
- * @param {import('@formio/core').Form} formParam - The form JSON to set this form to.
272
+ * @param {import('@formio/core').Form | string} formParam - The form JSON to set this form to.
268
273
  * @returns {Promise<Webform|Wizard|PDF>} - The webform instance that was created.
269
274
  */
270
275
  setForm(formParam) {
@@ -279,9 +284,10 @@ export default class Form extends Element {
279
284
  error = err;
280
285
  })
281
286
  .then((submission) => {
282
- return formio.loadForm()
287
+ return (formio
288
+ .loadForm()
283
289
  // If the form returned an error, show it instead of the form.
284
- .catch(err => {
290
+ .catch((err) => {
285
291
  error = err;
286
292
  })
287
293
  .then((form) => {
@@ -291,8 +297,14 @@ export default class Form extends Element {
291
297
  }
292
298
  this.loading = false;
293
299
  this.instance = this.instance || this.create(form.display);
294
- const options = this.getFormInitOptions(formParam, form);
295
- this.instance.setUrl(formParam, options);
300
+ // If we're in builder mode, instance.setUrl is not a function, so just manually set the URL.
301
+ if (this.instance.setUrl) {
302
+ const options = this.getFormInitOptions(formParam, form);
303
+ this.instance.setUrl(formParam, options);
304
+ }
305
+ else {
306
+ this.instance.url = formParam;
307
+ }
296
308
  this.instance.nosubmit = false;
297
309
  this._form = this.instance.form = form;
298
310
  if (submission) {
@@ -302,7 +314,7 @@ export default class Form extends Element {
302
314
  throw error;
303
315
  }
304
316
  return this.instance;
305
- });
317
+ }));
306
318
  });
307
319
  }
308
320
  else {
@@ -338,13 +350,15 @@ export default class Form extends Element {
338
350
  * @returns {Promise<Webform|Wizard|PDF>} - The form instance that was created after changing the display.
339
351
  */
340
352
  setDisplay(display) {
341
- if ((this.display === display) && this.instance) {
353
+ if (this.display === display && this.instance) {
342
354
  return Promise.resolve(this.instance);
343
355
  }
344
356
  this.form.display = display;
345
357
  this.instance.destroy();
346
358
  this.instance = this.create(display);
347
- return this.setForm(this.form);
359
+ return this.setForm(this.form).then(() => {
360
+ this.instance.emit('setDisplay', this.form.display);
361
+ });
348
362
  }
349
363
  empty() {
350
364
  if (this.element) {
@@ -406,10 +420,11 @@ export default class Form extends Element {
406
420
  return Promise.reject('No DOM element for form.');
407
421
  }
408
422
  // Add temporary loader.
409
- const template = (this.options && this.options.template) ? this.options.template : 'bootstrap';
423
+ const template = this.options && this.options.template ? this.options.template : 'bootstrap';
410
424
  const loader = templates[template].loader || templates.bootstrap.loader;
411
425
  this.setContent(this.element, loader.form);
412
- return this.render().then(html => {
426
+ return this.render()
427
+ .then((html) => {
413
428
  this.setContent(this.element, html);
414
429
  return this.attach(this.element).then(() => this.instance);
415
430
  })
@@ -422,8 +437,7 @@ export default class Form extends Element {
422
437
  if (!this.instance) {
423
438
  return Promise.reject('Form not ready. Use form.ready promise');
424
439
  }
425
- return Promise.resolve(this.instance.render())
426
- .then((param) => {
440
+ return Promise.resolve(this.instance.render()).then((param) => {
427
441
  this.emit('render', param);
428
442
  return param;
429
443
  });
@@ -436,8 +450,7 @@ export default class Form extends Element {
436
450
  delete this.element.component;
437
451
  }
438
452
  this.element = element;
439
- return this.instance.attach(this.element)
440
- .then((param) => {
453
+ return this.instance.attach(this.element).then((param) => {
441
454
  this.emit('attach', param);
442
455
  return param;
443
456
  });
@@ -461,6 +474,9 @@ Formio.embedForm = (embed) => Form.embed(embed);
461
474
  * Formio.createForm(document.getElementById('formio'), 'https://examples.form.io/example');
462
475
  */
463
476
  Formio.createForm = (elementOrForm, formOrOptions, options) => {
464
- return (new Form(elementOrForm, formOrOptions, options)).ready;
477
+ return new Form(elementOrForm, formOrOptions, options).ready;
465
478
  };
466
479
  Formio.Form = Form;
480
+ // Export a dummy for TypeScript type resolution
481
+ const FormOptions = undefined;
482
+ export { FormOptions };
@@ -44,7 +44,7 @@ export default class FormBuilder extends Form {
44
44
  /**
45
45
  * - The options to apply to the Edit Form (the form that shows inside the modal when you edit a component).
46
46
  */
47
- editForm?: any;
47
+ editForm?: import("./Form").FormOptions | undefined;
48
48
  /**
49
49
  * - The language to load into the form builder.
50
50
  */
@@ -105,7 +105,7 @@ export default class FormBuilder extends Form {
105
105
  /**
106
106
  * - The options to apply to the Edit Form (the form that shows inside the modal when you edit a component).
107
107
  */
108
- editForm?: any;
108
+ editForm?: import("./Form").FormOptions | undefined;
109
109
  /**
110
110
  * - The language to load into the form builder.
111
111
  */
@@ -160,7 +160,7 @@ export default class FormBuilder extends Form {
160
160
  /**
161
161
  * - The options to apply to the Edit Form (the form that shows inside the modal when you edit a component).
162
162
  */
163
- editForm?: any;
163
+ editForm?: import("./Form").FormOptions | undefined;
164
164
  /**
165
165
  * - The language to load into the form builder.
166
166
  */
@@ -32,14 +32,13 @@ export default class FormBuilder extends Form {
32
32
  constructor(element, form, options) {
33
33
  form = form || {};
34
34
  options = options || {};
35
- super(element, form, Object.assign(options, FormBuilder.options, ((Formio.options && Formio.options.builder) ? Formio.options.builder : {})));
35
+ super(element, form, Object.assign(options, FormBuilder.options, Formio.options && Formio.options.builder ? Formio.options.builder : {}));
36
36
  }
37
37
  create(display) {
38
38
  if (Builders.builders[display]) {
39
39
  return new Builders.builders[display](this.element, this.options);
40
40
  }
41
41
  else {
42
- // eslint-disable-next-line new-cap
43
42
  return new Builders.builders['webform'](this.element, this.options);
44
43
  }
45
44
  }
@@ -52,6 +51,6 @@ export default class FormBuilder extends Form {
52
51
  * @returns {Promise} - When the form is instance is ready.
53
52
  */
54
53
  Formio.builder = (element, form, options) => {
55
- return (new FormBuilder(element, form, options)).ready;
54
+ return new FormBuilder(element, form, options).ready;
56
55
  };
57
56
  Formio.FormBuilder = FormBuilder;
package/lib/mjs/Formio.js CHANGED
@@ -4,8 +4,10 @@ import CDN from './CDN';
4
4
  import Providers from './providers';
5
5
  FormioCore.cdn = new CDN();
6
6
  FormioCore.Providers = Providers;
7
- FormioCore.version = '5.2.3';
8
- CDN.defaultCDN = FormioCore.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';
7
+ FormioCore.version = '5.3.0-rc.0';
8
+ CDN.defaultCDN = FormioCore.version.includes('rc')
9
+ ? 'https://cdn.test-form.io'
10
+ : 'https://cdn.form.io';
9
11
  const isNil = (val) => val === null || val === undefined;
10
12
  FormioCore.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback, multipartOptions) {
11
13
  const requestArgs = {
@@ -13,13 +15,11 @@ FormioCore.prototype.uploadFile = function (storage, file, fileName, dir, progre
13
15
  method: 'upload',
14
16
  file: file,
15
17
  fileName: fileName,
16
- dir: dir
18
+ dir: dir,
17
19
  };
18
20
  fileKey = fileKey || 'file';
19
- const request = FormioCore.pluginWait('preRequest', requestArgs)
20
- .then(() => {
21
- return FormioCore.pluginGet('fileRequest', requestArgs)
22
- .then((result) => {
21
+ const request = FormioCore.pluginWait('preRequest', requestArgs).then(() => {
22
+ return FormioCore.pluginGet('fileRequest', requestArgs).then((result) => {
23
23
  if (storage && isNil(result)) {
24
24
  const Provider = Providers.getProvider('storage', storage);
25
25
  if (Provider) {
@@ -30,7 +30,7 @@ FormioCore.prototype.uploadFile = function (storage, file, fileName, dir, progre
30
30
  return provider.uploadFile(file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, abortCallback, multipartOptions);
31
31
  }
32
32
  else {
33
- throw ('Storage provider not found');
33
+ throw 'Storage provider not found';
34
34
  }
35
35
  }
36
36
  return result || { url: '' };
@@ -41,12 +41,10 @@ FormioCore.prototype.uploadFile = function (storage, file, fileName, dir, progre
41
41
  FormioCore.prototype.downloadFile = function (file, options) {
42
42
  const requestArgs = {
43
43
  method: 'download',
44
- file: file
44
+ file: file,
45
45
  };
46
- const request = FormioCore.pluginWait('preRequest', requestArgs)
47
- .then(() => {
48
- return FormioCore.pluginGet('fileRequest', requestArgs)
49
- .then((result) => {
46
+ const request = FormioCore.pluginWait('preRequest', requestArgs).then(() => {
47
+ return FormioCore.pluginGet('fileRequest', requestArgs).then((result) => {
50
48
  if (file.storage && isNil(result)) {
51
49
  const Provider = Providers.getProvider('storage', file.storage);
52
50
  if (Provider) {
@@ -54,7 +52,7 @@ FormioCore.prototype.downloadFile = function (file, options) {
54
52
  return provider.downloadFile(file, options);
55
53
  }
56
54
  else {
57
- throw ('Storage provider not found');
55
+ throw 'Storage provider not found';
58
56
  }
59
57
  }
60
58
  return result || { url: '' };
@@ -65,12 +63,10 @@ FormioCore.prototype.downloadFile = function (file, options) {
65
63
  FormioCore.prototype.deleteFile = function (file, options) {
66
64
  const requestArgs = {
67
65
  method: 'delete',
68
- file: file
66
+ file: file,
69
67
  };
70
- const request = FormioCore.pluginWait('preRequest', requestArgs)
71
- .then(() => {
72
- return FormioCore.pluginGet('fileRequest', requestArgs)
73
- .then((result) => {
68
+ const request = FormioCore.pluginWait('preRequest', requestArgs).then(() => {
69
+ return FormioCore.pluginGet('fileRequest', requestArgs).then((result) => {
74
70
  if (file.storage && isNil(result)) {
75
71
  const Provider = Providers.getProvider('storage', file.storage);
76
72
  if (Provider) {
@@ -78,7 +74,7 @@ FormioCore.prototype.deleteFile = function (file, options) {
78
74
  return provider.deleteFile(file, options);
79
75
  }
80
76
  else {
81
- throw ('Storage provider not found');
77
+ throw 'Storage provider not found';
82
78
  }
83
79
  }
84
80
  return result || { url: '' };
@@ -87,7 +83,14 @@ FormioCore.prototype.deleteFile = function (file, options) {
87
83
  return FormioCore.pluginAlter('wrapFileRequestPromise', request, requestArgs);
88
84
  };
89
85
  // Esnure we proxy the following methods to the FormioEmbed class.
90
- ['setBaseUrl', 'setApiUrl', 'setAppUrl', 'setProjectUrl', 'setPathType', 'setLicense'].forEach((fn) => {
86
+ [
87
+ 'setBaseUrl',
88
+ 'setApiUrl',
89
+ 'setAppUrl',
90
+ 'setProjectUrl',
91
+ 'setPathType',
92
+ 'setLicense',
93
+ ].forEach((fn) => {
91
94
  const baseFn = FormioCore[fn];
92
95
  FormioCore[fn] = function (arg) {
93
96
  const retVal = FormioEmbed[fn](arg, true);
@@ -112,8 +115,8 @@ FormioCore.addToGlobal = (global) => {
112
115
  global.Formio = FormioCore;
113
116
  }
114
117
  };
115
- if (typeof global !== 'undefined') {
116
- FormioCore.addToGlobal(global);
118
+ if (typeof globalThis !== 'undefined') {
119
+ FormioCore.addToGlobal(globalThis);
117
120
  }
118
121
  if (typeof window !== 'undefined') {
119
122
  FormioCore.addToGlobal(window);
@@ -10,7 +10,7 @@ export function embed(config = {}) {
10
10
  let i = scripts.length;
11
11
  const scriptName = config.scriptName || 'formio.embed.';
12
12
  while (i--) {
13
- if (scripts[i].src && (scripts[i].src.indexOf(scriptName) !== -1)) {
13
+ if (scripts[i].src && scripts[i].src.indexOf(scriptName) !== -1) {
14
14
  thisScript = scripts[i];
15
15
  break;
16
16
  }
@@ -18,13 +18,19 @@ export function embed(config = {}) {
18
18
  if (thisScript) {
19
19
  const query = {};
20
20
  const queryString = thisScript.src.replace(/^[^?]+\??/, '');
21
- queryString.replace(/\?/g, '&').split('&').forEach((item) => {
21
+ queryString
22
+ .replace(/\?/g, '&')
23
+ .split('&')
24
+ .forEach((item) => {
22
25
  query[item.split('=')[0]] = item.split('=')[1] && decodeURIComponent(item.split('=')[1]);
23
26
  });
24
27
  let scriptSrc = thisScript.src.replace(/^([^?]+).*/, '$1').split('/');
25
28
  scriptSrc.pop();
26
29
  let cdnSrc = '';
27
- if (['js', 'offline'].includes(scriptSrc[scriptSrc.length - 1])) {
30
+ if ([
31
+ 'js',
32
+ 'offline',
33
+ ].includes(scriptSrc[scriptSrc.length - 1])) {
28
34
  scriptSrc.pop();
29
35
  scriptSrc = cdnSrc = scriptSrc.join('/');
30
36
  scriptSrc += '/js';
@@ -32,42 +38,42 @@ export function embed(config = {}) {
32
38
  else {
33
39
  scriptSrc = scriptSrc.join('/');
34
40
  }
35
- const debug = (query.debug === 'true' || query.debug === '1');
41
+ const debug = query.debug === 'true' || query.debug === '1';
36
42
  const renderer = debug ? 'formio.form' : 'formio.form.min';
37
43
  Formio.config = Object.assign({
38
- script: query.script || (`${scriptSrc}/${renderer}.js`),
39
- style: query.styles || (`${scriptSrc}/${renderer}.css`),
44
+ script: query.script || `${scriptSrc}/${renderer}.js`,
45
+ style: query.styles || `${scriptSrc}/${renderer}.css`,
40
46
  cdn: query.cdn || cdnSrc,
41
- class: (query.class || 'formio-form-wrapper'),
47
+ class: query.class || 'formio-form-wrapper',
42
48
  src: query.src,
43
49
  form: null,
44
50
  submission: null,
45
51
  project: query.project,
46
52
  base: query.base || 'https://api.form.io',
47
53
  submit: query.submit,
48
- includeLibs: (query.libs === 'true' || query.libs === '1'),
49
- noshadow: (query.shadow === 'false' || query.shadow === '0'),
54
+ includeLibs: query.libs === 'true' || query.libs === '1',
55
+ noshadow: query.shadow === 'false' || query.shadow === '0',
50
56
  template: query.template || 'bootstrap',
51
57
  debug: debug,
52
58
  config: {},
53
- redirect: (query.return || query.redirect),
54
- embedCSS: (`${scriptSrc}/formio.embed.css`),
59
+ redirect: query.return || query.redirect,
60
+ embedCSS: `${scriptSrc}/formio.embed.css`,
55
61
  success: query.success || 'Thank you for your submission!',
56
62
  before: null,
57
- after: null
63
+ after: null,
58
64
  }, config);
59
65
  if (Formio.config.alter) {
60
66
  Formio.config.alter(Formio.config);
61
67
  }
62
- const form = (Formio.config.form || Formio.config.src);
68
+ const form = Formio.config.form || Formio.config.src;
63
69
  if (form) {
64
70
  Formio.debug('Embedding Configuration', config);
65
71
  // The id for this embedded form.
66
72
  Formio.config.id = `formio-${Math.random().toString(36).substring(7)}`;
67
73
  Formio.debug('Creating form element');
68
74
  const element = Formio.createElement('div', {
69
- 'id': Formio.config.id,
70
- class: Formio.config.class
75
+ id: Formio.config.id,
76
+ class: Formio.config.class,
71
77
  });
72
78
  // insertAfter doesn't exist, but effect is identical.
73
79
  thisScript.parentNode.insertBefore(element, thisScript.parentNode.firstElementChild.nextSibling);
@@ -83,7 +89,7 @@ export function embed(config = {}) {
83
89
  if (Formio.config.submit) {
84
90
  Formio.debug(`Sending submission to ${Formio.config.submit}`);
85
91
  const headers = {
86
- 'content-type': 'application/json'
92
+ 'content-type': 'application/json',
87
93
  };
88
94
  const token = Formio.FormioClass.getToken();
89
95
  if (token) {
@@ -95,7 +101,7 @@ export function embed(config = {}) {
95
101
  method: 'POST',
96
102
  mode: 'cors',
97
103
  })
98
- .then(resp => resp.json())
104
+ .then((resp) => resp.json())
99
105
  .then((submission) => {
100
106
  Formio.submitDone(instance, submission);
101
107
  });
package/lib/mjs/PDF.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export default class PDF extends Webform {
2
+ constructor(element: any, options: any);
2
3
  components: any[];
3
4
  init(): void;
4
5
  render(): any;