@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;
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const Webform_1 = __importDefault(require("./Webform"));
7
7
  const Component_1 = __importDefault(require("./components/_classes/component/Component"));
8
8
  const tippy_js_1 = __importDefault(require("tippy.js"));
9
- const native_promise_only_1 = __importDefault(require("native-promise-only"));
10
9
  const Components_1 = __importDefault(require("./components/Components"));
11
10
  const Formio_1 = require("./Formio");
12
11
  const utils_1 = require("./utils/utils");
@@ -37,8 +36,10 @@ class WebformBuilder extends Component_1.default {
37
36
  options.display = options.display || 'form';
38
37
  super(null, options);
39
38
  this.moveHandler = (e) => {
40
- e.stopPropagation();
41
- e.preventDefault();
39
+ if (e.keyCode === 38 || e.keyCode === 40 || e.keyCode === 13) {
40
+ e.stopPropagation();
41
+ e.preventDefault();
42
+ }
42
43
  if (e.keyCode === 38) {
43
44
  this.updateComponentPlacement(true);
44
45
  }
@@ -46,7 +47,7 @@ class WebformBuilder extends Component_1.default {
46
47
  this.updateComponentPlacement(false);
47
48
  }
48
49
  if (e.keyCode === 13) {
49
- this.stopMoving(this.selectedElement);
50
+ this.stopMoving(this.selectedComponent);
50
51
  }
51
52
  };
52
53
  this.setElement(element);
@@ -317,6 +318,9 @@ class WebformBuilder extends Component_1.default {
317
318
  });
318
319
  }
319
320
  attachComponent(element, component) {
321
+ if (component instanceof WebformBuilder) {
322
+ return;
323
+ }
320
324
  // Add component to element for later reference.
321
325
  element.formioComponent = component;
322
326
  component.loadRefs(element, {
@@ -403,7 +407,7 @@ class WebformBuilder extends Component_1.default {
403
407
  premium: {
404
408
  title: 'Premium',
405
409
  weight: 40
406
- },
410
+ }
407
411
  };
408
412
  }
409
413
  redraw() {
@@ -583,7 +587,7 @@ class WebformBuilder extends Component_1.default {
583
587
  const { subgroups = [], components } = result;
584
588
  const filteredComponents = [];
585
589
  for (const key in components) {
586
- const isMatchedToTitle = components[key].title.toLowerCase().match(searchValue);
590
+ const isMatchedToTitle = this.t(components[key].title).toLowerCase().match(searchValue);
587
591
  const isMatchedToKey = components[key].key.toLowerCase().match(searchValue);
588
592
  if (isMatchedToTitle || isMatchedToKey) {
589
593
  filteredComponents.push(components[key]);
@@ -701,8 +705,17 @@ class WebformBuilder extends Component_1.default {
701
705
  }
702
706
  getComponentInfo(key, group) {
703
707
  let info;
708
+ // Need to check in first order as resource component key can be the same as from webform default components
709
+ if (group && group.slice(0, group.indexOf('-')) === 'resource') {
710
+ // This is an existing resource field.
711
+ const resourceGroups = this.groups.resource.subgroups;
712
+ const resourceGroup = lodash_1.default.find(resourceGroups, { key: group });
713
+ if (resourceGroup && resourceGroup.components.hasOwnProperty(`component-${key}`)) {
714
+ info = (0, utils_1.fastCloneDeep)(resourceGroup.components[`component-${key}`].schema);
715
+ }
716
+ }
704
717
  // This is a new component
705
- if (this.schemas.hasOwnProperty(key)) {
718
+ else if (this.schemas.hasOwnProperty(key)) {
706
719
  info = (0, utils_1.fastCloneDeep)(this.schemas[key]);
707
720
  }
708
721
  else if (this.groups.hasOwnProperty(group)) {
@@ -711,14 +724,6 @@ class WebformBuilder extends Component_1.default {
711
724
  info = (0, utils_1.fastCloneDeep)(groupComponents[key].schema);
712
725
  }
713
726
  }
714
- else if (group.slice(0, group.indexOf('-')) === 'resource') {
715
- // This is an existing resource field.
716
- const resourceGroups = this.groups.resource.subgroups;
717
- const resourceGroup = lodash_1.default.find(resourceGroups, { key: group });
718
- if (resourceGroup && resourceGroup.components.hasOwnProperty(`component-${key}`)) {
719
- info = (0, utils_1.fastCloneDeep)(resourceGroup.components[`component-${key}`].schema);
720
- }
721
- }
722
727
  else if (group === 'searchFields') { //Search components go into this group
723
728
  const resourceGroups = this.groups.resource.subgroups;
724
729
  for (let ix = 0; ix < resourceGroups.length; ix++) {
@@ -866,7 +871,7 @@ class WebformBuilder extends Component_1.default {
866
871
  rebuild = target.formioComponent.rebuild();
867
872
  }
868
873
  if (!rebuild) {
869
- rebuild = native_promise_only_1.default.resolve();
874
+ rebuild = Promise.resolve();
870
875
  }
871
876
  return rebuild.then(() => {
872
877
  this.emit('addComponent', info, parent, path, index, isNew && !this.options.noNewEdit && !info.noNewEdit);
@@ -885,7 +890,7 @@ class WebformBuilder extends Component_1.default {
885
890
  }
886
891
  this.keyboardActionsEnabled = lodash_1.default.get(this.options, 'keyboardBuilder', false) || ((_a = this.options.properties) === null || _a === void 0 ? void 0 : _a.keyboardBuilder);
887
892
  const isShowSubmitButton = !this.options.noDefaultSubmitButton
888
- && !form.components.length;
893
+ && (!form.components.length || !form.components.find(comp => comp.key === 'submit'));
889
894
  // Ensure there is at least a submit button.
890
895
  if (isShowSubmitButton) {
891
896
  form.components.push({
@@ -912,7 +917,7 @@ class WebformBuilder extends Component_1.default {
912
917
  return this.rebuild().then(() => this.form);
913
918
  });
914
919
  }
915
- return native_promise_only_1.default.resolve(form);
920
+ return Promise.resolve(form);
916
921
  }
917
922
  populateRecaptchaSettings(form) {
918
923
  //populate isEnabled for recaptcha form settings
@@ -961,7 +966,7 @@ class WebformBuilder extends Component_1.default {
961
966
  else if (parent.formioComponent && parent.formioComponent.removeChildComponent) {
962
967
  parent.formioComponent.removeChildComponent(component);
963
968
  }
964
- const rebuild = parent.formioComponent.rebuild() || native_promise_only_1.default.resolve();
969
+ const rebuild = parent.formioComponent.rebuild() || Promise.resolve();
965
970
  rebuild.then(() => {
966
971
  this.emit('removeComponent', component, parent.formioComponent.schema, path, index);
967
972
  this.emit('change', this.form);
@@ -1010,6 +1015,9 @@ class WebformBuilder extends Component_1.default {
1010
1015
  lodash_1.default.assign(defaultValueComponent.component, lodash_1.default.omit(Object.assign({}, component), [
1011
1016
  'key',
1012
1017
  'label',
1018
+ 'labelPosition',
1019
+ 'labelMargin',
1020
+ 'labelWidth',
1013
1021
  'placeholder',
1014
1022
  'tooltip',
1015
1023
  'hidden',
@@ -1139,7 +1147,7 @@ class WebformBuilder extends Component_1.default {
1139
1147
  else if (isParentSaveChildMethod) {
1140
1148
  parent.formioComponent.saveChildComponent(submissionData);
1141
1149
  }
1142
- const rebuild = parentComponent.rebuild() || native_promise_only_1.default.resolve();
1150
+ const rebuild = parentComponent.rebuild() || Promise.resolve();
1143
1151
  return rebuild.then(() => {
1144
1152
  const schema = parentContainer ? parentContainer[index] : (comp ? comp.schema : []);
1145
1153
  this.emitSaveComponentEvent(schema, originalComp, parentComponent.schema, path, index, isNew, originalComponentSchema);
@@ -1153,16 +1161,71 @@ class WebformBuilder extends Component_1.default {
1153
1161
  });
1154
1162
  }
1155
1163
  this.highlightInvalidComponents();
1156
- return native_promise_only_1.default.resolve();
1164
+ return Promise.resolve();
1157
1165
  }
1158
1166
  emitSaveComponentEvent(schema, originalComp, parentComponentSchema, path, index, isNew, originalComponentSchema) {
1159
1167
  this.emit('saveComponent', schema, originalComp, parentComponentSchema, path, index, isNew, originalComponentSchema);
1160
1168
  }
1169
+ attachEditComponentControls(component, parent, isNew, original, ComponentClass) {
1170
+ const cancelButtons = this.componentEdit.querySelectorAll('[ref="cancelButton"]');
1171
+ cancelButtons.forEach((cancelButton) => {
1172
+ this.editForm.addEventListener(cancelButton, 'click', (event) => {
1173
+ event.preventDefault();
1174
+ this.editForm.detach();
1175
+ this.emit('cancelComponent', component);
1176
+ this.dialog.close();
1177
+ this.highlightInvalidComponents();
1178
+ });
1179
+ });
1180
+ const removeButtons = this.componentEdit.querySelectorAll('[ref="removeButton"]');
1181
+ removeButtons.forEach((removeButton) => {
1182
+ this.editForm.addEventListener(removeButton, 'click', (event) => {
1183
+ event.preventDefault();
1184
+ // Since we are already removing the component, don't trigger another remove.
1185
+ this.saved = true;
1186
+ this.editForm.detach();
1187
+ this.removeComponent(component, parent, original);
1188
+ this.dialog.close();
1189
+ this.highlightInvalidComponents();
1190
+ });
1191
+ });
1192
+ const saveButtons = this.componentEdit.querySelectorAll('[ref="saveButton"]');
1193
+ saveButtons.forEach((saveButton) => {
1194
+ this.editForm.addEventListener(saveButton, 'click', (event) => {
1195
+ event.preventDefault();
1196
+ if (!this.editForm.checkValidity(this.editForm.data, true, this.editForm.data)) {
1197
+ this.editForm.setPristine(false);
1198
+ this.editForm.showErrors();
1199
+ return false;
1200
+ }
1201
+ this.saved = true;
1202
+ this.saveComponent(component, parent, isNew, original);
1203
+ });
1204
+ });
1205
+ const previewButtons = this.componentEdit.querySelectorAll('[ref="previewButton"]');
1206
+ previewButtons.forEach((previewButton) => {
1207
+ this.editForm.addEventListener(previewButton, 'click', (event) => {
1208
+ event.preventDefault();
1209
+ this.showPreview = !this.showPreview;
1210
+ this.editForm.detach();
1211
+ this.setContent(this.componentEdit, this.renderTemplate('builderEditForm', {
1212
+ componentInfo: ComponentClass.builderInfo,
1213
+ editForm: this.editForm.render(),
1214
+ preview: this.preview ? this.preview.render() : false,
1215
+ showPreview: this.showPreview,
1216
+ helplinks: this.helplinks,
1217
+ }));
1218
+ this.editForm.attach(this.componentEdit.querySelector('[ref="editForm"]'));
1219
+ this.attachEditComponentControls(component, parent, isNew, original, ComponentClass);
1220
+ });
1221
+ });
1222
+ }
1161
1223
  editComponent(component, parent, isNew, isJsonEdit, original, flags = {}) {
1224
+ var _a;
1162
1225
  if (!component.key) {
1163
1226
  return;
1164
1227
  }
1165
- let saved = false;
1228
+ this.saved = false;
1166
1229
  const componentCopy = (0, utils_1.fastCloneDeep)(component);
1167
1230
  let ComponentClass = Components_1.default.components[componentCopy.type];
1168
1231
  const isCustom = ComponentClass === undefined;
@@ -1206,7 +1269,9 @@ class WebformBuilder extends Component_1.default {
1206
1269
  }
1207
1270
  ]
1208
1271
  } : ComponentClass.editForm(lodash_1.default.cloneDeep(overrides));
1209
- const instanceOptions = {};
1272
+ const instanceOptions = {
1273
+ inFormBuilder: true,
1274
+ };
1210
1275
  this.hook('instanceOptionsPreview', instanceOptions);
1211
1276
  const instance = new ComponentClass(componentCopy, instanceOptions);
1212
1277
  const schema = this.hook('builderComponentSchema', component, instance);
@@ -1231,12 +1296,14 @@ class WebformBuilder extends Component_1.default {
1231
1296
  ]));
1232
1297
  this.hook('previewFormSettitngs', schema, isJsonEdit);
1233
1298
  }
1299
+ this.showPreview = (_a = ComponentClass.builderInfo.showPreview) !== null && _a !== void 0 ? _a : true;
1234
1300
  this.componentEdit = this.ce('div', { 'class': 'component-edit-container' });
1235
1301
  this.setContent(this.componentEdit, this.renderTemplate('builderEditForm', {
1236
1302
  componentInfo: ComponentClass.builderInfo,
1237
1303
  editForm: this.editForm.render(),
1238
1304
  preview: this.preview ? this.preview.render() : false,
1239
- helplinks: this.helplinks,
1305
+ showPreview: this.showPreview,
1306
+ helplinks: this.helplinks
1240
1307
  }));
1241
1308
  this.dialog = this.createModal(this.componentEdit, lodash_1.default.get(this.options, 'dialogAttr', {}));
1242
1309
  // This is the attach step.
@@ -1290,48 +1357,14 @@ class WebformBuilder extends Component_1.default {
1290
1357
  this.updateComponent(event.data.componentJson || event.data, event.changed);
1291
1358
  }
1292
1359
  });
1293
- const cancelButtons = this.componentEdit.querySelectorAll('[ref="cancelButton"]');
1294
- cancelButtons.forEach((cancelButton) => {
1295
- this.addEventListener(cancelButton, 'click', (event) => {
1296
- event.preventDefault();
1297
- this.editForm.detach();
1298
- this.emit('cancelComponent', component);
1299
- this.dialog.close();
1300
- this.highlightInvalidComponents();
1301
- });
1302
- });
1303
- const removeButtons = this.componentEdit.querySelectorAll('[ref="removeButton"]');
1304
- removeButtons.forEach((removeButton) => {
1305
- this.addEventListener(removeButton, 'click', (event) => {
1306
- event.preventDefault();
1307
- // Since we are already removing the component, don't trigger another remove.
1308
- saved = true;
1309
- this.editForm.detach();
1310
- this.removeComponent(component, parent, original);
1311
- this.dialog.close();
1312
- this.highlightInvalidComponents();
1313
- });
1314
- });
1315
- const saveButtons = this.componentEdit.querySelectorAll('[ref="saveButton"]');
1316
- saveButtons.forEach((saveButton) => {
1317
- this.addEventListener(saveButton, 'click', (event) => {
1318
- event.preventDefault();
1319
- if (!this.editForm.checkValidity(this.editForm.data, true, this.editForm.data)) {
1320
- this.editForm.setPristine(false);
1321
- this.editForm.showErrors();
1322
- return false;
1323
- }
1324
- saved = true;
1325
- this.saveComponent(component, parent, isNew, original);
1326
- });
1327
- });
1360
+ this.attachEditComponentControls(component, parent, isNew, original, ComponentClass);
1328
1361
  const dialogClose = () => {
1329
1362
  this.editForm.destroy(true);
1330
1363
  if (this.preview) {
1331
1364
  this.preview.destroy(true);
1332
1365
  this.preview = null;
1333
1366
  }
1334
- if (isNew && !saved) {
1367
+ if (isNew && !this.saved) {
1335
1368
  this.removeComponent(component, parent, original);
1336
1369
  this.highlightInvalidComponents();
1337
1370
  }
@@ -1350,14 +1383,19 @@ class WebformBuilder extends Component_1.default {
1350
1383
  data.type).replace(/^[0-9]*/, '');
1351
1384
  }
1352
1385
  moveComponent(component) {
1386
+ var _a;
1387
+ if (this.selectedComponent) {
1388
+ const prevSelected = this.selectedComponent;
1389
+ (_a = prevSelected.element) === null || _a === void 0 ? void 0 : _a.classList.remove('builder-component-selected');
1390
+ this.removeEventListener(document, 'keydown');
1391
+ }
1353
1392
  component.element.focus();
1354
- component.element.classList.add('builder-selected');
1355
- this.selectedElement = component;
1356
- this.removeEventListener(component.element, 'keydown');
1357
- this.addEventListener(component.element, 'keydown', this.moveHandler.bind(this));
1393
+ component.element.classList.add('builder-component-selected');
1394
+ this.selectedComponent = component;
1395
+ this.addEventListener(document, 'keydown', this.moveHandler.bind(this));
1358
1396
  }
1359
1397
  updateComponentPlacement(direction) {
1360
- const component = this.selectedElement;
1398
+ const component = this.selectedComponent;
1361
1399
  let index, info;
1362
1400
  const step = direction ? -1 : 1;
1363
1401
  if (component) {
@@ -1400,7 +1438,9 @@ class WebformBuilder extends Component_1.default {
1400
1438
  }
1401
1439
  stopMoving(comp) {
1402
1440
  const parent = comp.element.parentNode;
1441
+ this.removeEventListener(document, 'keydown');
1403
1442
  parent.formioComponent.rebuild();
1443
+ this.selectedComponent = null;
1404
1444
  }
1405
1445
  addNewComponent(element) {
1406
1446
  var _a;
@@ -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/cjs/Wizard.js CHANGED
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const native_promise_only_1 = __importDefault(require("native-promise-only"));
7
6
  const lodash_1 = __importDefault(require("lodash"));
8
7
  const Webform_1 = __importDefault(require("./Webform"));
9
8
  const Formio_1 = require("./Formio");
@@ -40,7 +39,7 @@ class Wizard extends Webform_1.default {
40
39
  this._seenPages = [0];
41
40
  this.subWizards = [];
42
41
  this.allPages = [];
43
- this.lastPromise = native_promise_only_1.default.resolve();
42
+ this.lastPromise = Promise.resolve();
44
43
  this.enabledIndex = 0;
45
44
  this.editMode = false;
46
45
  this.originalOptions = lodash_1.default.cloneDeep(this.options);
@@ -556,7 +555,7 @@ class Wizard extends Webform_1.default {
556
555
  }
557
556
  setPage(num) {
558
557
  if (num === this.page) {
559
- return native_promise_only_1.default.resolve();
558
+ return Promise.resolve();
560
559
  }
561
560
  if (num >= 0 && num < this.pages.length) {
562
561
  this.page = num;
@@ -579,13 +578,13 @@ class Wizard extends Webform_1.default {
579
578
  this.redraw().then(() => {
580
579
  this.checkData(this.submission.data);
581
580
  });
582
- return native_promise_only_1.default.resolve();
581
+ return Promise.resolve();
583
582
  }
584
583
  else if (!this.pages.length) {
585
584
  this.redraw();
586
- return native_promise_only_1.default.resolve();
585
+ return Promise.resolve();
587
586
  }
588
- return native_promise_only_1.default.reject('Page not found');
587
+ return Promise.reject('Page not found');
589
588
  }
590
589
  pageFieldLogic(page) {
591
590
  var _a;
@@ -640,13 +639,13 @@ class Wizard extends Webform_1.default {
640
639
  }
641
640
  beforeSubmit() {
642
641
  const pages = this.getPages();
643
- return native_promise_only_1.default.all(pages.map((page) => {
642
+ return Promise.all(pages.map((page) => {
644
643
  page.options.beforeSubmit = true;
645
644
  return page.beforeSubmit();
646
645
  }));
647
646
  }
648
647
  beforePage(next) {
649
- return new native_promise_only_1.default((resolve, reject) => {
648
+ return new Promise((resolve, reject) => {
650
649
  this.hook(next ? 'beforeNext' : 'beforePrev', this.currentPage, this.submission, (err) => {
651
650
  if (err) {
652
651
  this.showErrors(err, true);
@@ -690,7 +689,7 @@ class Wizard extends Webform_1.default {
690
689
  else {
691
690
  this.currentPage.components.forEach((comp) => comp.setPristine(false));
692
691
  this.scrollIntoView(this.element);
693
- return native_promise_only_1.default.reject(this.showErrors([], true));
692
+ return Promise.reject(this.showErrors([], true));
694
693
  }
695
694
  }
696
695
  emitPrevPage() {
@@ -705,7 +704,7 @@ class Wizard extends Webform_1.default {
705
704
  }
706
705
  cancel(noconfirm) {
707
706
  if (this.options.readOnly) {
708
- return native_promise_only_1.default.resolve();
707
+ return Promise.resolve();
709
708
  }
710
709
  if (super.cancel(noconfirm)) {
711
710
  this.setPristine(true);
@@ -718,7 +717,7 @@ class Wizard extends Webform_1.default {
718
717
  return this.page;
719
718
  });
720
719
  }
721
- return native_promise_only_1.default.resolve();
720
+ return Promise.resolve();
722
721
  }
723
722
  getPageIndexByKey(key) {
724
723
  let pageIndex = this.page;
@@ -781,7 +780,8 @@ class Wizard extends Webform_1.default {
781
780
  setValue(submission, flags = {}, ignoreEstablishment) {
782
781
  this._submission = submission;
783
782
  if ((flags && flags.fromSubmission && (this.options.readOnly || this.editMode) && !this.isHtmlRenderMode()) ||
784
- (flags && flags.fromSubmission && (this.prefixComps.length || this.suffixComps.length) && submission._id)) {
783
+ (flags && flags.fromSubmission && (this.prefixComps.length || this.suffixComps.length) && submission._id) ||
784
+ (this.options.server && (this.prefixComps.length || this.suffixComps.length))) {
785
785
  this._data = submission.data;
786
786
  }
787
787
  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;
@@ -106,6 +106,11 @@ class WizardBuilder extends WebformBuilder_1.default {
106
106
  const components = this._form.components.filter((component) => component.type !== 'button');
107
107
  this._form.components = [this.getPageConfig(1, components)];
108
108
  }
109
+ else {
110
+ const components = this._form.components
111
+ .filter((component) => component.type !== 'button' || component.action !== 'submit');
112
+ this._form.components = components;
113
+ }
109
114
  this.rebuild();
110
115
  }
111
116
  get form() {
@@ -148,7 +153,10 @@ class WizardBuilder extends WebformBuilder_1.default {
148
153
  page.parentNode.dragInfo = { index };
149
154
  });
150
155
  if (this.dragulaLib) {
151
- this.dragulaLib([this.element.querySelector('.wizard-pages')])
156
+ this.navigationDragula = this.dragulaLib([this.element.querySelector('.wizard-pages')], {
157
+ moves: (el) => (!el.classList.contains('wizard-add-page')),
158
+ accepts: (el, target, source, sibling) => (sibling ? true : false),
159
+ })
152
160
  .on('drop', this.onReorder.bind(this));
153
161
  }
154
162
  this.refs.addPage.forEach(link => {
@@ -165,6 +173,13 @@ class WizardBuilder extends WebformBuilder_1.default {
165
173
  });
166
174
  return super.attach(element);
167
175
  }
176
+ detach() {
177
+ if (this.navigationDragula) {
178
+ this.navigationDragula.destroy();
179
+ }
180
+ this.navigationDragula = null;
181
+ super.detach();
182
+ }
168
183
  rebuild() {
169
184
  var _a;
170
185
  const page = this.currentPage;
@@ -202,13 +217,15 @@ class WizardBuilder extends WebformBuilder_1.default {
202
217
  }
203
218
  }
204
219
  onReorder(element, _target, _source, sibling) {
205
- if (!element.dragInfo || (sibling && !sibling.dragInfo)) {
220
+ const isSiblingAnAddPageButton = sibling === null || sibling === void 0 ? void 0 : sibling.classList.contains('wizard-add-page');
221
+ // We still can paste before Add Page button
222
+ if (!element.dragInfo || (sibling && !sibling.dragInfo && !isSiblingAnAddPageButton)) {
206
223
  console.warn('There is no Drag Info available for either dragged or sibling element');
207
224
  return;
208
225
  }
209
226
  const oldPosition = element.dragInfo.index;
210
227
  //should drop at next sibling position; no next sibling means drop to last position
211
- const newPosition = (sibling ? sibling.dragInfo.index : this.pages.length);
228
+ const newPosition = (sibling && sibling.dragInfo ? sibling.dragInfo.index : this.pages.length);
212
229
  const movedBelow = newPosition > oldPosition;
213
230
  const formComponents = (0, utils_1.fastCloneDeep)(this._form.components);
214
231
  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
  }
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const Element_1 = __importDefault(require("../Element"));
7
- const native_promise_only_1 = __importDefault(require("native-promise-only"));
8
7
  const lodash_1 = __importDefault(require("lodash"));
9
8
  class FormioAddon extends Element_1.default {
10
9
  static get info() {
@@ -30,7 +29,7 @@ class FormioAddon extends Element_1.default {
30
29
  }
31
30
  attach(element) {
32
31
  this._element = element;
33
- return native_promise_only_1.default.resolve();
32
+ return Promise.resolve();
34
33
  }
35
34
  destroy() { }
36
35
  }