@formio/js 5.0.0-rc.19 → 5.0.0-rc.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (370) hide show
  1. package/README.md +1 -1
  2. package/dist/formio.builder.css +14 -22
  3. package/dist/formio.builder.min.css +1 -1
  4. package/dist/formio.embed.css +1 -40
  5. package/dist/formio.embed.js +2 -90
  6. package/dist/formio.embed.min.css +1 -1
  7. package/dist/formio.embed.min.js +1 -1
  8. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  9. package/dist/formio.form.css +10 -2
  10. package/dist/formio.form.js +1267 -1103
  11. package/dist/formio.form.min.css +1 -1
  12. package/dist/formio.form.min.js +1 -1
  13. package/dist/formio.form.min.js.LICENSE.txt +3 -8
  14. package/dist/formio.full.css +14 -22
  15. package/dist/formio.full.js +1302 -1127
  16. package/dist/formio.full.min.css +1 -1
  17. package/dist/formio.full.min.js +1 -1
  18. package/dist/formio.full.min.js.LICENSE.txt +3 -8
  19. package/dist/formio.js +713 -626
  20. package/dist/formio.min.js +1 -1
  21. package/dist/formio.min.js.LICENSE.txt +2 -7
  22. package/dist/formio.utils.js +220 -13
  23. package/dist/formio.utils.min.js +1 -1
  24. package/dist/formio.utils.min.js.LICENSE.txt +2 -7
  25. package/lib/cjs/CDN.d.ts +1 -0
  26. package/lib/cjs/CDN.js +2 -1
  27. package/lib/cjs/Element.js +7 -2
  28. package/lib/cjs/Embed.d.ts +21 -1
  29. package/lib/cjs/Embed.js +211 -308
  30. package/lib/cjs/Form.d.ts +9 -6
  31. package/lib/cjs/Form.js +53 -11
  32. package/lib/cjs/PDF.d.ts +11 -3
  33. package/lib/cjs/PDF.js +4 -5
  34. package/lib/cjs/PDFBuilder.js +2 -3
  35. package/lib/cjs/Webform.d.ts +10 -13
  36. package/lib/cjs/Webform.js +46 -125
  37. package/lib/cjs/WebformBuilder.d.ts +6 -1
  38. package/lib/cjs/WebformBuilder.js +105 -65
  39. package/lib/cjs/Wizard.d.ts +8 -5
  40. package/lib/cjs/Wizard.js +12 -12
  41. package/lib/cjs/WizardBuilder.d.ts +6 -4
  42. package/lib/cjs/WizardBuilder.js +20 -3
  43. package/lib/cjs/addons/FormioAddon.d.ts +1 -1
  44. package/lib/cjs/addons/FormioAddon.js +1 -2
  45. package/lib/cjs/components/_classes/component/Component.d.ts +24 -8
  46. package/lib/cjs/components/_classes/component/Component.js +44 -14
  47. package/lib/cjs/components/_classes/input/Input.d.ts +1 -1
  48. package/lib/cjs/components/_classes/input/Input.js +1 -2
  49. package/lib/cjs/components/_classes/list/ListComponent.d.ts +4 -0
  50. package/lib/cjs/components/_classes/list/ListComponent.js +43 -6
  51. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +1 -0
  52. package/lib/cjs/components/_classes/multivalue/Multivalue.js +10 -4
  53. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +5 -2
  54. package/lib/cjs/components/_classes/nested/NestedComponent.js +9 -10
  55. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -0
  56. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +4 -0
  57. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
  58. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +4 -0
  59. package/lib/cjs/components/address/Address.d.ts +8 -0
  60. package/lib/cjs/components/address/Address.js +5 -0
  61. package/lib/cjs/components/button/Button.d.ts +1 -0
  62. package/lib/cjs/components/button/Button.js +5 -3
  63. package/lib/cjs/components/checkbox/Checkbox.d.ts +41 -0
  64. package/lib/cjs/components/checkbox/Checkbox.js +32 -5
  65. package/lib/cjs/components/columns/Columns.d.ts +2 -0
  66. package/lib/cjs/components/columns/Columns.js +4 -0
  67. package/lib/cjs/components/container/Container.d.ts +1 -0
  68. package/lib/cjs/components/container/Container.js +4 -0
  69. package/lib/cjs/components/content/Content.d.ts +2 -0
  70. package/lib/cjs/components/content/Content.js +4 -2
  71. package/lib/cjs/components/currency/editForm/Currency.edit.data.d.ts +14 -2
  72. package/lib/cjs/components/currency/editForm/Currency.edit.data.js +4 -0
  73. package/lib/cjs/components/currency/editForm/Currency.edit.display.js +4 -0
  74. package/lib/cjs/components/datagrid/DataGrid.d.ts +1 -0
  75. package/lib/cjs/components/datagrid/DataGrid.js +8 -1
  76. package/lib/cjs/components/datamap/DataMap.d.ts +1 -0
  77. package/lib/cjs/components/datamap/DataMap.js +4 -0
  78. package/lib/cjs/components/datetime/DateTime.d.ts +23 -0
  79. package/lib/cjs/components/datetime/DateTime.js +20 -1
  80. package/lib/cjs/components/day/Day.d.ts +22 -1
  81. package/lib/cjs/components/day/Day.js +20 -6
  82. package/lib/cjs/components/day/fixtures/comp3.js +2 -2
  83. package/lib/cjs/components/editgrid/EditGrid.d.ts +4 -3
  84. package/lib/cjs/components/editgrid/EditGrid.js +11 -6
  85. package/lib/cjs/components/editgrid/fixtures/comp-with-custom-default-value.d.ts +190 -0
  86. package/lib/cjs/components/editgrid/fixtures/comp-with-custom-default-value.js +227 -0
  87. package/lib/cjs/components/editgrid/fixtures/comp15.d.ts +54 -0
  88. package/lib/cjs/components/editgrid/fixtures/comp15.js +51 -0
  89. package/lib/cjs/components/editgrid/fixtures/index.d.ts +3 -1
  90. package/lib/cjs/components/editgrid/fixtures/index.js +5 -1
  91. package/lib/cjs/components/fieldset/Fieldset.d.ts +2 -0
  92. package/lib/cjs/components/fieldset/Fieldset.js +4 -0
  93. package/lib/cjs/components/file/File.d.ts +28 -6
  94. package/lib/cjs/components/file/File.js +40 -15
  95. package/lib/cjs/components/file/editForm/File.edit.file.d.ts +62 -0
  96. package/lib/cjs/components/file/editForm/File.edit.file.js +29 -2
  97. package/lib/cjs/components/form/Form.d.ts +4 -0
  98. package/lib/cjs/components/form/Form.js +12 -10
  99. package/lib/cjs/components/hidden/Hidden.d.ts +1 -0
  100. package/lib/cjs/components/hidden/Hidden.js +1 -0
  101. package/lib/cjs/components/html/HTML.d.ts +2 -0
  102. package/lib/cjs/components/html/HTML.js +4 -0
  103. package/lib/cjs/components/number/Number.d.ts +24 -1
  104. package/lib/cjs/components/number/Number.js +18 -6
  105. package/lib/cjs/components/panel/Panel.d.ts +1 -0
  106. package/lib/cjs/components/panel/Panel.js +3 -0
  107. package/lib/cjs/components/phonenumber/PhoneNumber.form.js +9 -0
  108. package/lib/cjs/components/radio/Radio.d.ts +24 -3
  109. package/lib/cjs/components/radio/Radio.js +89 -18
  110. package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +2 -1
  111. package/lib/cjs/components/recaptcha/ReCaptcha.js +7 -5
  112. package/lib/cjs/components/resource/Resource.d.ts +7 -0
  113. package/lib/cjs/components/resource/Resource.js +0 -1
  114. package/lib/cjs/components/resource/editForm/Resource.edit.display.js +1 -1
  115. package/lib/cjs/components/select/Select.d.ts +25 -5
  116. package/lib/cjs/components/select/Select.js +51 -51
  117. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +37 -0
  118. package/lib/cjs/components/selectboxes/SelectBoxes.js +60 -25
  119. package/lib/cjs/components/selectboxes/fixtures/comp4.d.ts +30 -27
  120. package/lib/cjs/components/selectboxes/fixtures/comp4.js +47 -32
  121. package/lib/cjs/components/selectboxes/fixtures/comp6.d.ts +14 -0
  122. package/lib/cjs/components/selectboxes/fixtures/comp6.js +15 -0
  123. package/lib/cjs/components/selectboxes/fixtures/index.d.ts +2 -1
  124. package/lib/cjs/components/selectboxes/fixtures/index.js +3 -1
  125. package/lib/cjs/components/signature/Signature.d.ts +22 -1
  126. package/lib/cjs/components/signature/Signature.js +16 -3
  127. package/lib/cjs/components/survey/Survey.d.ts +21 -0
  128. package/lib/cjs/components/survey/Survey.js +9 -0
  129. package/lib/cjs/components/table/Table.d.ts +2 -0
  130. package/lib/cjs/components/table/Table.js +4 -0
  131. package/lib/cjs/components/tabs/Tabs.d.ts +2 -0
  132. package/lib/cjs/components/tabs/Tabs.js +4 -0
  133. package/lib/cjs/components/tags/Tags.d.ts +21 -0
  134. package/lib/cjs/components/tags/Tags.js +11 -0
  135. package/lib/cjs/components/textarea/TextArea.d.ts +3 -2
  136. package/lib/cjs/components/textarea/TextArea.js +4 -5
  137. package/lib/cjs/components/textarea/fixtures/comp4.d.ts +30 -0
  138. package/lib/cjs/components/textarea/fixtures/comp4.js +27 -0
  139. package/lib/cjs/components/textarea/fixtures/index.d.ts +2 -1
  140. package/lib/cjs/components/textarea/fixtures/index.js +3 -1
  141. package/lib/cjs/components/textfield/TextField.d.ts +22 -0
  142. package/lib/cjs/components/textfield/TextField.js +11 -3
  143. package/lib/cjs/components/time/Time.d.ts +11 -0
  144. package/lib/cjs/components/time/Time.js +6 -1
  145. package/lib/cjs/components/tree/Tree.d.ts +5 -4
  146. package/lib/cjs/components/tree/Tree.form.js +5 -0
  147. package/lib/cjs/components/tree/Tree.js +8 -9
  148. package/lib/cjs/components/tree/editForm/Tree.edit.display.d.ts +9 -0
  149. package/lib/cjs/components/tree/editForm/Tree.edit.display.js +12 -0
  150. package/lib/cjs/components/well/Well.d.ts +2 -0
  151. package/lib/cjs/components/well/Well.js +4 -0
  152. package/lib/cjs/formio.embed.d.ts +2 -1
  153. package/lib/cjs/formio.embed.js +96 -1
  154. package/lib/cjs/formio.form.d.ts +4 -3
  155. package/lib/cjs/formio.form.js +17 -8
  156. package/lib/cjs/licenses/Licenses.d.ts +7 -0
  157. package/lib/cjs/licenses/Licenses.js +22 -0
  158. package/lib/cjs/licenses/index.d.ts +2 -0
  159. package/lib/cjs/licenses/index.js +7 -0
  160. package/lib/cjs/providers/Providers.d.ts +31 -11
  161. package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +2 -2
  162. package/lib/cjs/providers/address/GoogleAddressProvider.js +2 -3
  163. package/lib/cjs/providers/processor/fileProcessor.d.ts +1 -1
  164. package/lib/cjs/providers/processor/fileProcessor.js +1 -5
  165. package/lib/cjs/providers/storage/azure.d.ts +10 -1
  166. package/lib/cjs/providers/storage/azure.js +7 -2
  167. package/lib/cjs/providers/storage/base64.d.ts +2 -2
  168. package/lib/cjs/providers/storage/base64.js +2 -6
  169. package/lib/cjs/providers/storage/dropbox.d.ts +2 -2
  170. package/lib/cjs/providers/storage/dropbox.js +2 -6
  171. package/lib/cjs/providers/storage/googleDrive.d.ts +3 -2
  172. package/lib/cjs/providers/storage/googleDrive.js +6 -6
  173. package/lib/cjs/providers/storage/indexeddb.d.ts +3 -3
  174. package/lib/cjs/providers/storage/indexeddb.js +9 -13
  175. package/lib/cjs/providers/storage/s3.d.ts +11 -1
  176. package/lib/cjs/providers/storage/s3.js +5 -2
  177. package/lib/cjs/providers/storage/uploadAdapter.js +1 -5
  178. package/lib/cjs/providers/storage/url.d.ts +2 -2
  179. package/lib/cjs/providers/storage/url.js +12 -8
  180. package/lib/cjs/providers/storage/xhr.d.ts +1 -1
  181. package/lib/cjs/providers/storage/xhr.js +1 -2
  182. package/lib/cjs/templates/index.d.ts +226 -1
  183. package/lib/cjs/utils/Evaluator.js +4 -33
  184. package/lib/cjs/utils/i18n.d.ts +16 -0
  185. package/lib/cjs/utils/i18n.js +88 -0
  186. package/lib/cjs/utils/utils.d.ts +11 -1
  187. package/lib/cjs/utils/utils.js +29 -10
  188. package/lib/cjs/validator/Validator.d.ts +30 -2
  189. package/lib/cjs/validator/Validator.js +32 -9
  190. package/lib/cjs/validator/rules/Select.js +1 -2
  191. package/lib/cjs/validator/rules/Unique.d.ts +1 -1
  192. package/lib/cjs/validator/rules/Unique.js +1 -2
  193. package/lib/cjs/widgets/CalendarWidget.d.ts +1 -0
  194. package/lib/cjs/widgets/InputWidget.d.ts +1 -1
  195. package/lib/cjs/widgets/InputWidget.js +1 -2
  196. package/lib/mjs/CDN.d.ts +1 -0
  197. package/lib/mjs/CDN.js +2 -1
  198. package/lib/mjs/Element.js +6 -2
  199. package/lib/mjs/Embed.d.ts +21 -1
  200. package/lib/mjs/Embed.js +208 -319
  201. package/lib/mjs/Form.d.ts +9 -6
  202. package/lib/mjs/Form.js +53 -11
  203. package/lib/mjs/PDF.d.ts +11 -3
  204. package/lib/mjs/PDF.js +4 -5
  205. package/lib/mjs/PDFBuilder.js +2 -3
  206. package/lib/mjs/Webform.d.ts +10 -13
  207. package/lib/mjs/Webform.js +46 -128
  208. package/lib/mjs/WebformBuilder.d.ts +6 -1
  209. package/lib/mjs/WebformBuilder.js +103 -65
  210. package/lib/mjs/Wizard.d.ts +8 -5
  211. package/lib/mjs/Wizard.js +12 -12
  212. package/lib/mjs/WizardBuilder.d.ts +6 -4
  213. package/lib/mjs/WizardBuilder.js +20 -3
  214. package/lib/mjs/addons/FormioAddon.d.ts +1 -1
  215. package/lib/mjs/addons/FormioAddon.js +1 -2
  216. package/lib/mjs/components/_classes/component/Component.d.ts +24 -8
  217. package/lib/mjs/components/_classes/component/Component.js +44 -14
  218. package/lib/mjs/components/_classes/input/Input.d.ts +1 -1
  219. package/lib/mjs/components/_classes/input/Input.js +1 -2
  220. package/lib/mjs/components/_classes/list/ListComponent.d.ts +4 -0
  221. package/lib/mjs/components/_classes/list/ListComponent.js +43 -5
  222. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +1 -0
  223. package/lib/mjs/components/_classes/multivalue/Multivalue.js +10 -4
  224. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +5 -2
  225. package/lib/mjs/components/_classes/nested/NestedComponent.js +9 -10
  226. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -0
  227. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +4 -0
  228. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
  229. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +4 -0
  230. package/lib/mjs/components/address/Address.d.ts +8 -0
  231. package/lib/mjs/components/address/Address.js +5 -0
  232. package/lib/mjs/components/button/Button.d.ts +1 -0
  233. package/lib/mjs/components/button/Button.js +6 -4
  234. package/lib/mjs/components/checkbox/Checkbox.d.ts +41 -0
  235. package/lib/mjs/components/checkbox/Checkbox.js +36 -5
  236. package/lib/mjs/components/columns/Columns.d.ts +2 -0
  237. package/lib/mjs/components/columns/Columns.js +4 -0
  238. package/lib/mjs/components/container/Container.d.ts +1 -0
  239. package/lib/mjs/components/container/Container.js +5 -1
  240. package/lib/mjs/components/content/Content.d.ts +2 -0
  241. package/lib/mjs/components/content/Content.js +4 -2
  242. package/lib/mjs/components/currency/editForm/Currency.edit.data.d.ts +14 -2
  243. package/lib/mjs/components/currency/editForm/Currency.edit.data.js +4 -0
  244. package/lib/mjs/components/currency/editForm/Currency.edit.display.js +4 -0
  245. package/lib/mjs/components/datagrid/DataGrid.d.ts +1 -0
  246. package/lib/mjs/components/datagrid/DataGrid.js +8 -1
  247. package/lib/mjs/components/datamap/DataMap.d.ts +1 -0
  248. package/lib/mjs/components/datamap/DataMap.js +5 -1
  249. package/lib/mjs/components/datetime/DateTime.d.ts +23 -0
  250. package/lib/mjs/components/datetime/DateTime.js +27 -1
  251. package/lib/mjs/components/day/Day.d.ts +22 -1
  252. package/lib/mjs/components/day/Day.js +24 -7
  253. package/lib/mjs/components/day/fixtures/comp3.js +2 -2
  254. package/lib/mjs/components/editgrid/EditGrid.d.ts +4 -3
  255. package/lib/mjs/components/editgrid/EditGrid.js +11 -6
  256. package/lib/mjs/components/editgrid/fixtures/comp-with-custom-default-value.d.ts +190 -0
  257. package/lib/mjs/components/editgrid/fixtures/comp-with-custom-default-value.js +225 -0
  258. package/lib/mjs/components/editgrid/fixtures/comp15.d.ts +54 -0
  259. package/lib/mjs/components/editgrid/fixtures/comp15.js +49 -0
  260. package/lib/mjs/components/editgrid/fixtures/index.d.ts +3 -1
  261. package/lib/mjs/components/editgrid/fixtures/index.js +3 -1
  262. package/lib/mjs/components/fieldset/Fieldset.d.ts +2 -0
  263. package/lib/mjs/components/fieldset/Fieldset.js +4 -0
  264. package/lib/mjs/components/file/File.d.ts +28 -6
  265. package/lib/mjs/components/file/File.js +44 -16
  266. package/lib/mjs/components/file/editForm/File.edit.file.d.ts +62 -0
  267. package/lib/mjs/components/file/editForm/File.edit.file.js +29 -2
  268. package/lib/mjs/components/form/Form.d.ts +4 -0
  269. package/lib/mjs/components/form/Form.js +13 -11
  270. package/lib/mjs/components/hidden/Hidden.d.ts +1 -0
  271. package/lib/mjs/components/hidden/Hidden.js +1 -0
  272. package/lib/mjs/components/html/HTML.d.ts +2 -0
  273. package/lib/mjs/components/html/HTML.js +4 -0
  274. package/lib/mjs/components/number/Number.d.ts +24 -1
  275. package/lib/mjs/components/number/Number.js +23 -7
  276. package/lib/mjs/components/panel/Panel.d.ts +1 -0
  277. package/lib/mjs/components/panel/Panel.js +3 -0
  278. package/lib/mjs/components/phonenumber/PhoneNumber.form.js +9 -0
  279. package/lib/mjs/components/radio/Radio.d.ts +24 -3
  280. package/lib/mjs/components/radio/Radio.js +93 -19
  281. package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +2 -1
  282. package/lib/mjs/components/recaptcha/ReCaptcha.js +7 -5
  283. package/lib/mjs/components/resource/Resource.d.ts +7 -0
  284. package/lib/mjs/components/resource/Resource.js +0 -1
  285. package/lib/mjs/components/resource/editForm/Resource.edit.display.js +1 -1
  286. package/lib/mjs/components/select/Select.d.ts +25 -5
  287. package/lib/mjs/components/select/Select.js +55 -52
  288. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +37 -0
  289. package/lib/mjs/components/selectboxes/SelectBoxes.js +63 -25
  290. package/lib/mjs/components/selectboxes/fixtures/comp4.d.ts +30 -27
  291. package/lib/mjs/components/selectboxes/fixtures/comp4.js +47 -32
  292. package/lib/mjs/components/selectboxes/fixtures/comp6.d.ts +14 -0
  293. package/lib/mjs/components/selectboxes/fixtures/comp6.js +13 -0
  294. package/lib/mjs/components/selectboxes/fixtures/index.d.ts +2 -1
  295. package/lib/mjs/components/selectboxes/fixtures/index.js +2 -1
  296. package/lib/mjs/components/signature/Signature.d.ts +22 -1
  297. package/lib/mjs/components/signature/Signature.js +19 -3
  298. package/lib/mjs/components/survey/Survey.d.ts +21 -0
  299. package/lib/mjs/components/survey/Survey.js +13 -1
  300. package/lib/mjs/components/table/Table.d.ts +2 -0
  301. package/lib/mjs/components/table/Table.js +4 -0
  302. package/lib/mjs/components/tabs/Tabs.d.ts +2 -0
  303. package/lib/mjs/components/tabs/Tabs.js +4 -0
  304. package/lib/mjs/components/tags/Tags.d.ts +21 -0
  305. package/lib/mjs/components/tags/Tags.js +14 -0
  306. package/lib/mjs/components/textarea/TextArea.d.ts +3 -2
  307. package/lib/mjs/components/textarea/TextArea.js +4 -5
  308. package/lib/mjs/components/textarea/fixtures/comp4.d.ts +30 -0
  309. package/lib/mjs/components/textarea/fixtures/comp4.js +25 -0
  310. package/lib/mjs/components/textarea/fixtures/index.d.ts +2 -1
  311. package/lib/mjs/components/textarea/fixtures/index.js +2 -1
  312. package/lib/mjs/components/textfield/TextField.d.ts +22 -0
  313. package/lib/mjs/components/textfield/TextField.js +14 -3
  314. package/lib/mjs/components/time/Time.d.ts +11 -0
  315. package/lib/mjs/components/time/Time.js +12 -1
  316. package/lib/mjs/components/tree/Tree.d.ts +5 -4
  317. package/lib/mjs/components/tree/Tree.form.js +5 -0
  318. package/lib/mjs/components/tree/Tree.js +8 -9
  319. package/lib/mjs/components/tree/editForm/Tree.edit.display.d.ts +9 -0
  320. package/lib/mjs/components/tree/editForm/Tree.edit.display.js +10 -0
  321. package/lib/mjs/components/well/Well.d.ts +2 -0
  322. package/lib/mjs/components/well/Well.js +4 -0
  323. package/lib/mjs/formio.embed.d.ts +2 -1
  324. package/lib/mjs/formio.embed.js +96 -2
  325. package/lib/mjs/formio.form.d.ts +4 -3
  326. package/lib/mjs/formio.form.js +16 -8
  327. package/lib/mjs/licenses/Licenses.d.ts +7 -0
  328. package/lib/mjs/licenses/Licenses.js +17 -0
  329. package/lib/mjs/licenses/index.d.ts +2 -0
  330. package/lib/mjs/licenses/index.js +2 -0
  331. package/lib/mjs/providers/Providers.d.ts +31 -11
  332. package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +2 -2
  333. package/lib/mjs/providers/address/GoogleAddressProvider.js +2 -3
  334. package/lib/mjs/providers/processor/fileProcessor.d.ts +1 -1
  335. package/lib/mjs/providers/processor/fileProcessor.js +1 -2
  336. package/lib/mjs/providers/storage/azure.d.ts +10 -1
  337. package/lib/mjs/providers/storage/azure.js +7 -2
  338. package/lib/mjs/providers/storage/base64.d.ts +2 -2
  339. package/lib/mjs/providers/storage/base64.js +2 -3
  340. package/lib/mjs/providers/storage/dropbox.d.ts +2 -2
  341. package/lib/mjs/providers/storage/dropbox.js +2 -3
  342. package/lib/mjs/providers/storage/googleDrive.d.ts +3 -2
  343. package/lib/mjs/providers/storage/googleDrive.js +6 -3
  344. package/lib/mjs/providers/storage/indexeddb.d.ts +3 -3
  345. package/lib/mjs/providers/storage/indexeddb.js +9 -10
  346. package/lib/mjs/providers/storage/s3.d.ts +11 -1
  347. package/lib/mjs/providers/storage/s3.js +5 -2
  348. package/lib/mjs/providers/storage/uploadAdapter.js +1 -2
  349. package/lib/mjs/providers/storage/url.d.ts +2 -2
  350. package/lib/mjs/providers/storage/url.js +12 -5
  351. package/lib/mjs/providers/storage/xhr.d.ts +1 -1
  352. package/lib/mjs/providers/storage/xhr.js +1 -2
  353. package/lib/mjs/templates/index.d.ts +226 -1
  354. package/lib/mjs/utils/Evaluator.js +4 -33
  355. package/lib/mjs/utils/i18n.d.ts +16 -0
  356. package/lib/mjs/utils/i18n.js +81 -0
  357. package/lib/mjs/utils/utils.d.ts +11 -1
  358. package/lib/mjs/utils/utils.js +27 -9
  359. package/lib/mjs/validator/Validator.d.ts +30 -2
  360. package/lib/mjs/validator/Validator.js +31 -9
  361. package/lib/mjs/validator/rules/Select.js +1 -2
  362. package/lib/mjs/validator/rules/Unique.d.ts +1 -1
  363. package/lib/mjs/validator/rules/Unique.js +1 -2
  364. package/lib/mjs/widgets/CalendarWidget.d.ts +1 -0
  365. package/lib/mjs/widgets/InputWidget.d.ts +1 -1
  366. package/lib/mjs/widgets/InputWidget.js +1 -2
  367. package/package.json +18 -15
  368. package/types/index.d.ts +1 -0
  369. package/types/licenses.d.ts +7 -0
  370. package/types/utils.d.ts +2 -0
@@ -49,6 +49,7 @@ export default class WebformBuilder extends Component {
49
49
  weight: number;
50
50
  };
51
51
  };
52
+ redraw(): Promise<void> | Promise<boolean>;
52
53
  set form(arg: any);
53
54
  get form(): any;
54
55
  get container(): any;
@@ -60,6 +61,7 @@ export default class WebformBuilder extends Component {
60
61
  findNamespaceRoot(component: any): any;
61
62
  recurseNamespace(component: any): any;
62
63
  render(): any;
64
+ attach(element: any): Promise<any>;
63
65
  searchFields(searchString?: string): void;
64
66
  orderComponents(groupInfo: any, foundComponents: any): void;
65
67
  updateDragAndDrop(): any;
@@ -86,6 +88,9 @@ export default class WebformBuilder extends Component {
86
88
  saveComponent(component: any, parent: any, isNew: any, original: any): boolean;
87
89
  isComponentCreated: boolean | undefined;
88
90
  emitSaveComponentEvent(schema: any, originalComp: any, parentComponentSchema: any, path: any, index: any, isNew: any, originalComponentSchema: any): void;
91
+ attachEditComponentControls(component: any, parent: any, isNew: any, original: any, ComponentClass: any): void;
92
+ saved: boolean | undefined;
93
+ showPreview: any;
89
94
  editComponent(component: any, parent: any, isNew: any, isJsonEdit: any, original: any, flags?: {}): void;
90
95
  editForm: Webform | undefined;
91
96
  preview: Webform | null | undefined;
@@ -93,7 +98,7 @@ export default class WebformBuilder extends Component {
93
98
  dialog: any;
94
99
  updateComponentKey(data: any): any;
95
100
  moveComponent(component: any): void;
96
- selectedElement: any;
101
+ selectedComponent: any;
97
102
  moveHandler: (e: any) => void;
98
103
  updateComponentPlacement(direction: any): void;
99
104
  stopMoving(comp: any): void;
@@ -1,7 +1,6 @@
1
1
  import Webform from './Webform';
2
2
  import Component from './components/_classes/component/Component';
3
3
  import tippy from 'tippy.js';
4
- import NativePromise from 'native-promise-only';
5
4
  import Components from './components/Components';
6
5
  import { Formio } from './Formio';
7
6
  import { fastCloneDeep, bootstrapVersion, getArrayFromComponentPath, getStringFromComponentPath } from './utils/utils';
@@ -305,6 +304,9 @@ export default class WebformBuilder extends Component {
305
304
  });
306
305
  }
307
306
  attachComponent(element, component) {
307
+ if (component instanceof WebformBuilder) {
308
+ return;
309
+ }
308
310
  // Add component to element for later reference.
309
311
  element.formioComponent = component;
310
312
  component.loadRefs(element, {
@@ -391,7 +393,7 @@ export default class WebformBuilder extends Component {
391
393
  premium: {
392
394
  title: 'Premium',
393
395
  weight: 40
394
- },
396
+ }
395
397
  };
396
398
  }
397
399
  redraw() {
@@ -571,7 +573,7 @@ export default class WebformBuilder extends Component {
571
573
  const { subgroups = [], components } = result;
572
574
  const filteredComponents = [];
573
575
  for (const key in components) {
574
- const isMatchedToTitle = components[key].title.toLowerCase().match(searchValue);
576
+ const isMatchedToTitle = this.t(components[key].title).toLowerCase().match(searchValue);
575
577
  const isMatchedToKey = components[key].key.toLowerCase().match(searchValue);
576
578
  if (isMatchedToTitle || isMatchedToKey) {
577
579
  filteredComponents.push(components[key]);
@@ -689,8 +691,17 @@ export default class WebformBuilder extends Component {
689
691
  }
690
692
  getComponentInfo(key, group) {
691
693
  let info;
694
+ // Need to check in first order as resource component key can be the same as from webform default components
695
+ if (group && group.slice(0, group.indexOf('-')) === 'resource') {
696
+ // This is an existing resource field.
697
+ const resourceGroups = this.groups.resource.subgroups;
698
+ const resourceGroup = _.find(resourceGroups, { key: group });
699
+ if (resourceGroup && resourceGroup.components.hasOwnProperty(`component-${key}`)) {
700
+ info = fastCloneDeep(resourceGroup.components[`component-${key}`].schema);
701
+ }
702
+ }
692
703
  // This is a new component
693
- if (this.schemas.hasOwnProperty(key)) {
704
+ else if (this.schemas.hasOwnProperty(key)) {
694
705
  info = fastCloneDeep(this.schemas[key]);
695
706
  }
696
707
  else if (this.groups.hasOwnProperty(group)) {
@@ -699,14 +710,6 @@ export default class WebformBuilder extends Component {
699
710
  info = fastCloneDeep(groupComponents[key].schema);
700
711
  }
701
712
  }
702
- else if (group.slice(0, group.indexOf('-')) === 'resource') {
703
- // This is an existing resource field.
704
- const resourceGroups = this.groups.resource.subgroups;
705
- const resourceGroup = _.find(resourceGroups, { key: group });
706
- if (resourceGroup && resourceGroup.components.hasOwnProperty(`component-${key}`)) {
707
- info = fastCloneDeep(resourceGroup.components[`component-${key}`].schema);
708
- }
709
- }
710
713
  else if (group === 'searchFields') { //Search components go into this group
711
714
  const resourceGroups = this.groups.resource.subgroups;
712
715
  for (let ix = 0; ix < resourceGroups.length; ix++) {
@@ -853,7 +856,7 @@ export default class WebformBuilder extends Component {
853
856
  rebuild = target.formioComponent.rebuild();
854
857
  }
855
858
  if (!rebuild) {
856
- rebuild = NativePromise.resolve();
859
+ rebuild = Promise.resolve();
857
860
  }
858
861
  return rebuild.then(() => {
859
862
  this.emit('addComponent', info, parent, path, index, isNew && !this.options.noNewEdit && !info.noNewEdit);
@@ -871,7 +874,7 @@ export default class WebformBuilder extends Component {
871
874
  }
872
875
  this.keyboardActionsEnabled = _.get(this.options, 'keyboardBuilder', false) || this.options.properties?.keyboardBuilder;
873
876
  const isShowSubmitButton = !this.options.noDefaultSubmitButton
874
- && !form.components.length;
877
+ && (!form.components.length || !form.components.find(comp => comp.key === 'submit'));
875
878
  // Ensure there is at least a submit button.
876
879
  if (isShowSubmitButton) {
877
880
  form.components.push({
@@ -898,7 +901,7 @@ export default class WebformBuilder extends Component {
898
901
  return this.rebuild().then(() => this.form);
899
902
  });
900
903
  }
901
- return NativePromise.resolve(form);
904
+ return Promise.resolve(form);
902
905
  }
903
906
  populateRecaptchaSettings(form) {
904
907
  //populate isEnabled for recaptcha form settings
@@ -947,7 +950,7 @@ export default class WebformBuilder extends Component {
947
950
  else if (parent.formioComponent && parent.formioComponent.removeChildComponent) {
948
951
  parent.formioComponent.removeChildComponent(component);
949
952
  }
950
- const rebuild = parent.formioComponent.rebuild() || NativePromise.resolve();
953
+ const rebuild = parent.formioComponent.rebuild() || Promise.resolve();
951
954
  rebuild.then(() => {
952
955
  this.emit('removeComponent', component, parent.formioComponent.schema, path, index);
953
956
  this.emit('change', this.form);
@@ -996,6 +999,9 @@ export default class WebformBuilder extends Component {
996
999
  _.assign(defaultValueComponent.component, _.omit({ ...component }, [
997
1000
  'key',
998
1001
  'label',
1002
+ 'labelPosition',
1003
+ 'labelMargin',
1004
+ 'labelWidth',
999
1005
  'placeholder',
1000
1006
  'tooltip',
1001
1007
  'hidden',
@@ -1124,7 +1130,7 @@ export default class WebformBuilder extends Component {
1124
1130
  else if (isParentSaveChildMethod) {
1125
1131
  parent.formioComponent.saveChildComponent(submissionData);
1126
1132
  }
1127
- const rebuild = parentComponent.rebuild() || NativePromise.resolve();
1133
+ const rebuild = parentComponent.rebuild() || Promise.resolve();
1128
1134
  return rebuild.then(() => {
1129
1135
  const schema = parentContainer ? parentContainer[index] : (comp ? comp.schema : []);
1130
1136
  this.emitSaveComponentEvent(schema, originalComp, parentComponent.schema, path, index, isNew, originalComponentSchema);
@@ -1138,16 +1144,70 @@ export default class WebformBuilder extends Component {
1138
1144
  });
1139
1145
  }
1140
1146
  this.highlightInvalidComponents();
1141
- return NativePromise.resolve();
1147
+ return Promise.resolve();
1142
1148
  }
1143
1149
  emitSaveComponentEvent(schema, originalComp, parentComponentSchema, path, index, isNew, originalComponentSchema) {
1144
1150
  this.emit('saveComponent', schema, originalComp, parentComponentSchema, path, index, isNew, originalComponentSchema);
1145
1151
  }
1152
+ attachEditComponentControls(component, parent, isNew, original, ComponentClass) {
1153
+ const cancelButtons = this.componentEdit.querySelectorAll('[ref="cancelButton"]');
1154
+ cancelButtons.forEach((cancelButton) => {
1155
+ this.editForm.addEventListener(cancelButton, 'click', (event) => {
1156
+ event.preventDefault();
1157
+ this.editForm.detach();
1158
+ this.emit('cancelComponent', component);
1159
+ this.dialog.close();
1160
+ this.highlightInvalidComponents();
1161
+ });
1162
+ });
1163
+ const removeButtons = this.componentEdit.querySelectorAll('[ref="removeButton"]');
1164
+ removeButtons.forEach((removeButton) => {
1165
+ this.editForm.addEventListener(removeButton, 'click', (event) => {
1166
+ event.preventDefault();
1167
+ // Since we are already removing the component, don't trigger another remove.
1168
+ this.saved = true;
1169
+ this.editForm.detach();
1170
+ this.removeComponent(component, parent, original);
1171
+ this.dialog.close();
1172
+ this.highlightInvalidComponents();
1173
+ });
1174
+ });
1175
+ const saveButtons = this.componentEdit.querySelectorAll('[ref="saveButton"]');
1176
+ saveButtons.forEach((saveButton) => {
1177
+ this.editForm.addEventListener(saveButton, 'click', (event) => {
1178
+ event.preventDefault();
1179
+ if (!this.editForm.checkValidity(this.editForm.data, true, this.editForm.data)) {
1180
+ this.editForm.setPristine(false);
1181
+ this.editForm.showErrors();
1182
+ return false;
1183
+ }
1184
+ this.saved = true;
1185
+ this.saveComponent(component, parent, isNew, original);
1186
+ });
1187
+ });
1188
+ const previewButtons = this.componentEdit.querySelectorAll('[ref="previewButton"]');
1189
+ previewButtons.forEach((previewButton) => {
1190
+ this.editForm.addEventListener(previewButton, 'click', (event) => {
1191
+ event.preventDefault();
1192
+ this.showPreview = !this.showPreview;
1193
+ this.editForm.detach();
1194
+ this.setContent(this.componentEdit, this.renderTemplate('builderEditForm', {
1195
+ componentInfo: ComponentClass.builderInfo,
1196
+ editForm: this.editForm.render(),
1197
+ preview: this.preview ? this.preview.render() : false,
1198
+ showPreview: this.showPreview,
1199
+ helplinks: this.helplinks,
1200
+ }));
1201
+ this.editForm.attach(this.componentEdit.querySelector('[ref="editForm"]'));
1202
+ this.attachEditComponentControls(component, parent, isNew, original, ComponentClass);
1203
+ });
1204
+ });
1205
+ }
1146
1206
  editComponent(component, parent, isNew, isJsonEdit, original, flags = {}) {
1147
1207
  if (!component.key) {
1148
1208
  return;
1149
1209
  }
1150
- let saved = false;
1210
+ this.saved = false;
1151
1211
  const componentCopy = fastCloneDeep(component);
1152
1212
  let ComponentClass = Components.components[componentCopy.type];
1153
1213
  const isCustom = ComponentClass === undefined;
@@ -1195,7 +1255,9 @@ export default class WebformBuilder extends Component {
1195
1255
  }
1196
1256
  ]
1197
1257
  } : ComponentClass.editForm(_.cloneDeep(overrides));
1198
- const instanceOptions = {};
1258
+ const instanceOptions = {
1259
+ inFormBuilder: true,
1260
+ };
1199
1261
  this.hook('instanceOptionsPreview', instanceOptions);
1200
1262
  const instance = new ComponentClass(componentCopy, instanceOptions);
1201
1263
  const schema = this.hook('builderComponentSchema', component, instance);
@@ -1220,12 +1282,14 @@ export default class WebformBuilder extends Component {
1220
1282
  ]));
1221
1283
  this.hook('previewFormSettitngs', schema, isJsonEdit);
1222
1284
  }
1285
+ this.showPreview = ComponentClass.builderInfo.showPreview ?? true;
1223
1286
  this.componentEdit = this.ce('div', { 'class': 'component-edit-container' });
1224
1287
  this.setContent(this.componentEdit, this.renderTemplate('builderEditForm', {
1225
1288
  componentInfo: ComponentClass.builderInfo,
1226
1289
  editForm: this.editForm.render(),
1227
1290
  preview: this.preview ? this.preview.render() : false,
1228
- helplinks: this.helplinks,
1291
+ showPreview: this.showPreview,
1292
+ helplinks: this.helplinks
1229
1293
  }));
1230
1294
  this.dialog = this.createModal(this.componentEdit, _.get(this.options, 'dialogAttr', {}));
1231
1295
  // This is the attach step.
@@ -1279,48 +1343,14 @@ export default class WebformBuilder extends Component {
1279
1343
  this.updateComponent(event.data.componentJson || event.data, event.changed);
1280
1344
  }
1281
1345
  });
1282
- const cancelButtons = this.componentEdit.querySelectorAll('[ref="cancelButton"]');
1283
- cancelButtons.forEach((cancelButton) => {
1284
- this.addEventListener(cancelButton, 'click', (event) => {
1285
- event.preventDefault();
1286
- this.editForm.detach();
1287
- this.emit('cancelComponent', component);
1288
- this.dialog.close();
1289
- this.highlightInvalidComponents();
1290
- });
1291
- });
1292
- const removeButtons = this.componentEdit.querySelectorAll('[ref="removeButton"]');
1293
- removeButtons.forEach((removeButton) => {
1294
- this.addEventListener(removeButton, 'click', (event) => {
1295
- event.preventDefault();
1296
- // Since we are already removing the component, don't trigger another remove.
1297
- saved = true;
1298
- this.editForm.detach();
1299
- this.removeComponent(component, parent, original);
1300
- this.dialog.close();
1301
- this.highlightInvalidComponents();
1302
- });
1303
- });
1304
- const saveButtons = this.componentEdit.querySelectorAll('[ref="saveButton"]');
1305
- saveButtons.forEach((saveButton) => {
1306
- this.addEventListener(saveButton, 'click', (event) => {
1307
- event.preventDefault();
1308
- if (!this.editForm.checkValidity(this.editForm.data, true, this.editForm.data)) {
1309
- this.editForm.setPristine(false);
1310
- this.editForm.showErrors();
1311
- return false;
1312
- }
1313
- saved = true;
1314
- this.saveComponent(component, parent, isNew, original);
1315
- });
1316
- });
1346
+ this.attachEditComponentControls(component, parent, isNew, original, ComponentClass);
1317
1347
  const dialogClose = () => {
1318
1348
  this.editForm.destroy(true);
1319
1349
  if (this.preview) {
1320
1350
  this.preview.destroy(true);
1321
1351
  this.preview = null;
1322
1352
  }
1323
- if (isNew && !saved) {
1353
+ if (isNew && !this.saved) {
1324
1354
  this.removeComponent(component, parent, original);
1325
1355
  this.highlightInvalidComponents();
1326
1356
  }
@@ -1339,15 +1369,21 @@ export default class WebformBuilder extends Component {
1339
1369
  data.type).replace(/^[0-9]*/, '');
1340
1370
  }
1341
1371
  moveComponent(component) {
1372
+ if (this.selectedComponent) {
1373
+ const prevSelected = this.selectedComponent;
1374
+ prevSelected.element?.classList.remove('builder-component-selected');
1375
+ this.removeEventListener(document, 'keydown');
1376
+ }
1342
1377
  component.element.focus();
1343
- component.element.classList.add('builder-selected');
1344
- this.selectedElement = component;
1345
- this.removeEventListener(component.element, 'keydown');
1346
- this.addEventListener(component.element, 'keydown', this.moveHandler.bind(this));
1378
+ component.element.classList.add('builder-component-selected');
1379
+ this.selectedComponent = component;
1380
+ this.addEventListener(document, 'keydown', this.moveHandler.bind(this));
1347
1381
  }
1348
1382
  moveHandler = (e) => {
1349
- e.stopPropagation();
1350
- e.preventDefault();
1383
+ if (e.keyCode === 38 || e.keyCode === 40 || e.keyCode === 13) {
1384
+ e.stopPropagation();
1385
+ e.preventDefault();
1386
+ }
1351
1387
  if (e.keyCode === 38) {
1352
1388
  this.updateComponentPlacement(true);
1353
1389
  }
@@ -1355,11 +1391,11 @@ export default class WebformBuilder extends Component {
1355
1391
  this.updateComponentPlacement(false);
1356
1392
  }
1357
1393
  if (e.keyCode === 13) {
1358
- this.stopMoving(this.selectedElement);
1394
+ this.stopMoving(this.selectedComponent);
1359
1395
  }
1360
1396
  };
1361
1397
  updateComponentPlacement(direction) {
1362
- const component = this.selectedElement;
1398
+ const component = this.selectedComponent;
1363
1399
  let index, info;
1364
1400
  const step = direction ? -1 : 1;
1365
1401
  if (component) {
@@ -1402,7 +1438,9 @@ export default class WebformBuilder extends Component {
1402
1438
  }
1403
1439
  stopMoving(comp) {
1404
1440
  const parent = comp.element.parentNode;
1441
+ this.removeEventListener(document, 'keydown');
1405
1442
  parent.formioComponent.rebuild();
1443
+ this.selectedComponent = null;
1406
1444
  }
1407
1445
  addNewComponent(element) {
1408
1446
  const source = document.querySelector('.formio-builder-form');
@@ -11,7 +11,7 @@ declare class Wizard extends Webform {
11
11
  _seenPages: number[];
12
12
  subWizards: any[];
13
13
  allPages: any[];
14
- lastPromise: any;
14
+ lastPromise: Promise<void>;
15
15
  enabledIndex: number;
16
16
  editMode: boolean;
17
17
  originalOptions: any;
@@ -40,6 +40,7 @@ declare class Wizard extends Webform {
40
40
  prepareHeaderSettings(ctx: any, headerType: any): any;
41
41
  redrawNavigation(): void;
42
42
  redrawHeader(): void;
43
+ attach(element: any): Promise<void>;
43
44
  scrollPageToTop(): void;
44
45
  isBreadcrumbClickable(): any;
45
46
  isAllowPrevious(): any;
@@ -60,16 +61,18 @@ declare class Wizard extends Webform {
60
61
  establishPages(data?: any): any[];
61
62
  updatePages(): void;
62
63
  addComponents(): void;
63
- setPage(num: any): any;
64
+ setPage(num: any): Promise<void>;
64
65
  pageFieldLogic(page: any): void;
65
66
  get currentPage(): any;
66
67
  getNextPage(): number | null;
67
68
  getPreviousPage(): number;
69
+ beforeSubmit(): Promise<any[]>;
70
+ beforePage(next: any): Promise<any>;
68
71
  emitNextPage(): void;
69
- nextPage(): any;
72
+ nextPage(): Promise<void>;
70
73
  emitPrevPage(): void;
71
- prevPage(): any;
72
- cancel(noconfirm: any): any;
74
+ prevPage(): Promise<void>;
75
+ cancel(noconfirm: any): Promise<void> | Promise<number>;
73
76
  getPageIndexByKey(key: any): number;
74
77
  get schema(): Object;
75
78
  setComponentSchema(): void;
package/lib/mjs/Wizard.js CHANGED
@@ -1,4 +1,3 @@
1
- import NativePromise from 'native-promise-only';
2
1
  import _ from 'lodash';
3
2
  import Webform from './Webform';
4
3
  import { Formio } from './Formio';
@@ -35,7 +34,7 @@ export default class Wizard extends Webform {
35
34
  this._seenPages = [0];
36
35
  this.subWizards = [];
37
36
  this.allPages = [];
38
- this.lastPromise = NativePromise.resolve();
37
+ this.lastPromise = Promise.resolve();
39
38
  this.enabledIndex = 0;
40
39
  this.editMode = false;
41
40
  this.originalOptions = _.cloneDeep(this.options);
@@ -550,7 +549,7 @@ export default class Wizard extends Webform {
550
549
  }
551
550
  setPage(num) {
552
551
  if (num === this.page) {
553
- return NativePromise.resolve();
552
+ return Promise.resolve();
554
553
  }
555
554
  if (num >= 0 && num < this.pages.length) {
556
555
  this.page = num;
@@ -572,13 +571,13 @@ export default class Wizard extends Webform {
572
571
  this.redraw().then(() => {
573
572
  this.checkData(this.submission.data);
574
573
  });
575
- return NativePromise.resolve();
574
+ return Promise.resolve();
576
575
  }
577
576
  else if (!this.pages.length) {
578
577
  this.redraw();
579
- return NativePromise.resolve();
578
+ return Promise.resolve();
580
579
  }
581
- return NativePromise.reject('Page not found');
580
+ return Promise.reject('Page not found');
582
581
  }
583
582
  pageFieldLogic(page) {
584
583
  if (this.pages?.[page]) {
@@ -631,13 +630,13 @@ export default class Wizard extends Webform {
631
630
  }
632
631
  beforeSubmit() {
633
632
  const pages = this.getPages();
634
- return NativePromise.all(pages.map((page) => {
633
+ return Promise.all(pages.map((page) => {
635
634
  page.options.beforeSubmit = true;
636
635
  return page.beforeSubmit();
637
636
  }));
638
637
  }
639
638
  beforePage(next) {
640
- return new NativePromise((resolve, reject) => {
639
+ return new Promise((resolve, reject) => {
641
640
  this.hook(next ? 'beforeNext' : 'beforePrev', this.currentPage, this.submission, (err) => {
642
641
  if (err) {
643
642
  this.showErrors(err, true);
@@ -681,7 +680,7 @@ export default class Wizard extends Webform {
681
680
  else {
682
681
  this.currentPage.components.forEach((comp) => comp.setPristine(false));
683
682
  this.scrollIntoView(this.element);
684
- return NativePromise.reject(this.showErrors([], true));
683
+ return Promise.reject(this.showErrors([], true));
685
684
  }
686
685
  }
687
686
  emitPrevPage() {
@@ -696,7 +695,7 @@ export default class Wizard extends Webform {
696
695
  }
697
696
  cancel(noconfirm) {
698
697
  if (this.options.readOnly) {
699
- return NativePromise.resolve();
698
+ return Promise.resolve();
700
699
  }
701
700
  if (super.cancel(noconfirm)) {
702
701
  this.setPristine(true);
@@ -709,7 +708,7 @@ export default class Wizard extends Webform {
709
708
  return this.page;
710
709
  });
711
710
  }
712
- return NativePromise.resolve();
711
+ return Promise.resolve();
713
712
  }
714
713
  getPageIndexByKey(key) {
715
714
  let pageIndex = this.page;
@@ -772,7 +771,8 @@ export default class Wizard extends Webform {
772
771
  setValue(submission, flags = {}, ignoreEstablishment) {
773
772
  this._submission = submission;
774
773
  if ((flags && flags.fromSubmission && (this.options.readOnly || this.editMode) && !this.isHtmlRenderMode()) ||
775
- (flags && flags.fromSubmission && (this.prefixComps.length || this.suffixComps.length) && submission._id)) {
774
+ (flags && flags.fromSubmission && (this.prefixComps.length || this.suffixComps.length) && submission._id) ||
775
+ (this.options.server && (this.prefixComps.length || this.suffixComps.length))) {
776
776
  this._data = submission.data;
777
777
  }
778
778
  if (!ignoreEstablishment) {
@@ -30,10 +30,12 @@ export default class WizardBuilder extends WebformBuilder {
30
30
  components: any[];
31
31
  }[];
32
32
  };
33
- addPage(page: any): any;
34
- removePage(pageIndex: any, componentIndex: any): any;
35
- onReorder(element: any, _target: any, _source: any, sibling: any): any;
36
- setPage(index: any): any;
33
+ navigationDragula: any;
34
+ rebuild(): Promise<void> | Promise<boolean>;
35
+ addPage(page: any): Promise<void> | Promise<boolean>;
36
+ removePage(pageIndex: any, componentIndex: any): Promise<void> | Promise<boolean> | undefined;
37
+ onReorder(element: any, _target: any, _source: any, sibling: any): Promise<void> | undefined;
38
+ setPage(index: any): Promise<void> | Promise<boolean> | undefined;
37
39
  getPageConfig(index: any, components?: any[]): {
38
40
  title: string;
39
41
  label: string;
@@ -101,6 +101,11 @@ export default class WizardBuilder extends WebformBuilder {
101
101
  const components = this._form.components.filter((component) => component.type !== 'button');
102
102
  this._form.components = [this.getPageConfig(1, components)];
103
103
  }
104
+ else {
105
+ const components = this._form.components
106
+ .filter((component) => component.type !== 'button' || component.action !== 'submit');
107
+ this._form.components = components;
108
+ }
104
109
  this.rebuild();
105
110
  }
106
111
  get form() {
@@ -143,7 +148,10 @@ export default class WizardBuilder extends WebformBuilder {
143
148
  page.parentNode.dragInfo = { index };
144
149
  });
145
150
  if (this.dragulaLib) {
146
- this.dragulaLib([this.element.querySelector('.wizard-pages')])
151
+ this.navigationDragula = this.dragulaLib([this.element.querySelector('.wizard-pages')], {
152
+ moves: (el) => (!el.classList.contains('wizard-add-page')),
153
+ accepts: (el, target, source, sibling) => (sibling ? true : false),
154
+ })
147
155
  .on('drop', this.onReorder.bind(this));
148
156
  }
149
157
  this.refs.addPage.forEach(link => {
@@ -160,6 +168,13 @@ export default class WizardBuilder extends WebformBuilder {
160
168
  });
161
169
  return super.attach(element);
162
170
  }
171
+ detach() {
172
+ if (this.navigationDragula) {
173
+ this.navigationDragula.destroy();
174
+ }
175
+ this.navigationDragula = null;
176
+ super.detach();
177
+ }
163
178
  rebuild() {
164
179
  const page = this.currentPage;
165
180
  this.webform.setForm({
@@ -196,13 +211,15 @@ export default class WizardBuilder extends WebformBuilder {
196
211
  }
197
212
  }
198
213
  onReorder(element, _target, _source, sibling) {
199
- if (!element.dragInfo || (sibling && !sibling.dragInfo)) {
214
+ const isSiblingAnAddPageButton = sibling?.classList.contains('wizard-add-page');
215
+ // We still can paste before Add Page button
216
+ if (!element.dragInfo || (sibling && !sibling.dragInfo && !isSiblingAnAddPageButton)) {
200
217
  console.warn('There is no Drag Info available for either dragged or sibling element');
201
218
  return;
202
219
  }
203
220
  const oldPosition = element.dragInfo.index;
204
221
  //should drop at next sibling position; no next sibling means drop to last position
205
- const newPosition = (sibling ? sibling.dragInfo.index : this.pages.length);
222
+ const newPosition = (sibling && sibling.dragInfo ? sibling.dragInfo.index : this.pages.length);
206
223
  const movedBelow = newPosition > oldPosition;
207
224
  const formComponents = fastCloneDeep(this._form.components);
208
225
  const draggedRowData = this._form.components[oldPosition];
@@ -12,7 +12,7 @@ export default class FormioAddon extends Element {
12
12
  namespace: string;
13
13
  component: any;
14
14
  settings: any;
15
- attach(element: any): any;
15
+ attach(element: any): Promise<void>;
16
16
  _element: any;
17
17
  destroy(): void;
18
18
  }
@@ -1,5 +1,4 @@
1
1
  import Element from '../Element';
2
- import NativePromise from 'native-promise-only';
3
2
  import _ from 'lodash';
4
3
  export default class FormioAddon extends Element {
5
4
  static get info() {
@@ -25,7 +24,7 @@ export default class FormioAddon extends Element {
25
24
  }
26
25
  attach(element) {
27
26
  this._element = element;
28
- return NativePromise.resolve();
27
+ return Promise.resolve();
29
28
  }
30
29
  destroy() { }
31
30
  }
@@ -4,6 +4,21 @@
4
4
  */
5
5
  declare class Component extends Element {
6
6
  static schema(...sources: any[]): any;
7
+ /**
8
+ * Return the simple condition settings as part of the component.
9
+ *
10
+ * @return {Object}
11
+ *
12
+ */
13
+ static get conditionOperatorsSettings(): Object;
14
+ /**
15
+ * Return the array of possible types of component value absed on its schema.
16
+ *
17
+ * @param schema
18
+ * @return {Array}
19
+ *
20
+ */
21
+ static savedValueTypes(schema: any): any[];
7
22
  /**
8
23
  * Provides a table view for this component. Override if you wish to do something different than using getView
9
24
  * method of your instance.
@@ -12,6 +27,7 @@ declare class Component extends Element {
12
27
  * @param options
13
28
  */
14
29
  static tableView(value: any, options: any): void;
30
+ static get serverConditionSettings(): Object;
15
31
  /**
16
32
  * Initialize a new Component.
17
33
  *
@@ -151,7 +167,7 @@ declare class Component extends Element {
151
167
  set data(arg: any);
152
168
  get data(): any;
153
169
  mergeSchema(component?: {}): any;
154
- get ready(): any;
170
+ get ready(): Promise<Component>;
155
171
  get isPDFReadOnlyMode(): any;
156
172
  get labelInfo(): {
157
173
  hidden: any;
@@ -293,12 +309,12 @@ declare class Component extends Element {
293
309
  loadRefs(element: any, refs: any): void;
294
310
  setOpenModalElement(template: any): void;
295
311
  getModalPreviewTemplate(): any;
296
- build(element: any): any;
312
+ build(element: any): Promise<void>;
297
313
  get hasModalSaveButton(): boolean;
298
314
  render(children?: string, topLevel?: boolean): any;
299
315
  attachTooltips(toolTipsRefs: any): void;
300
316
  createComponentModal(element: any, modalShouldBeOpened: any, currentValue: any): ComponentModal;
301
- attach(element: any): any;
317
+ attach(element: any): Promise<void>;
302
318
  componentModal: any;
303
319
  restoreFocus(): void;
304
320
  addShortcut(element: any, shortcut: any): void;
@@ -402,8 +418,8 @@ declare class Component extends Element {
402
418
  errorMessage(type: any): any;
403
419
  setContent(element: any, content: any, forceSanitize: any, sanitizeOptions: any): boolean;
404
420
  restoreCaretPosition(): void;
405
- redraw(): any;
406
- rebuild(): any;
421
+ redraw(): Promise<void>;
422
+ rebuild(): Promise<void>;
407
423
  hasClass(element: any, className: any): boolean | undefined;
408
424
  addClass(element: any, className: any): Component | undefined;
409
425
  removeClass(element: any, className: any): Component | undefined;
@@ -694,7 +710,7 @@ declare class Component extends Element {
694
710
  */
695
711
  checkComponentValidity(data: any, dirty: any, row: any, options?: {}): boolean;
696
712
  checkValidity(data: any, dirty: any, row: any, silentCheck: any): boolean;
697
- checkAsyncValidity(data: any, dirty: any, row: any, silentCheck: any): any;
713
+ checkAsyncValidity(data: any, dirty: any, row: any, silentCheck: any): Promise<boolean>;
698
714
  /**
699
715
  * Check the conditions, calculations, and validity of a single component and triggers an update if
700
716
  * something changed.
@@ -728,8 +744,8 @@ declare class Component extends Element {
728
744
  */
729
745
  isValueHidden(): boolean | any;
730
746
  shouldSkipValidation(data: any, dirty: any, row: any): boolean;
731
- whenReady(): any;
732
- get dataReady(): any;
747
+ whenReady(): Promise<void>;
748
+ get dataReady(): Promise<void>;
733
749
  /**
734
750
  * Prints out the value of this component as a string value.
735
751
  */