@formio/js 5.0.0-rc.18 → 5.0.0-rc.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (325) 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 -2
  5. package/dist/formio.embed.js +2 -2
  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 +333 -361
  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 +353 -370
  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 +208 -121
  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.js +1 -1
  26. package/lib/cjs/Element.js +7 -2
  27. package/lib/cjs/Embed.js +1 -1
  28. package/lib/cjs/Form.d.ts +8 -5
  29. package/lib/cjs/Form.js +52 -10
  30. package/lib/cjs/PDF.d.ts +11 -3
  31. package/lib/cjs/PDF.js +4 -5
  32. package/lib/cjs/PDFBuilder.js +2 -3
  33. package/lib/cjs/Webform.d.ts +4 -7
  34. package/lib/cjs/Webform.js +40 -119
  35. package/lib/cjs/WebformBuilder.d.ts +6 -1
  36. package/lib/cjs/WebformBuilder.js +104 -64
  37. package/lib/cjs/Wizard.d.ts +8 -5
  38. package/lib/cjs/Wizard.js +14 -14
  39. package/lib/cjs/WizardBuilder.d.ts +6 -4
  40. package/lib/cjs/WizardBuilder.js +20 -3
  41. package/lib/cjs/addons/FormioAddon.d.ts +1 -1
  42. package/lib/cjs/addons/FormioAddon.js +1 -2
  43. package/lib/cjs/components/_classes/component/Component.d.ts +17 -8
  44. package/lib/cjs/components/_classes/component/Component.js +52 -18
  45. package/lib/cjs/components/_classes/input/Input.d.ts +1 -1
  46. package/lib/cjs/components/_classes/input/Input.js +1 -2
  47. package/lib/cjs/components/_classes/list/ListComponent.d.ts +4 -0
  48. package/lib/cjs/components/_classes/list/ListComponent.js +43 -6
  49. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +1 -0
  50. package/lib/cjs/components/_classes/multivalue/Multivalue.js +10 -4
  51. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +5 -2
  52. package/lib/cjs/components/_classes/nested/NestedComponent.js +11 -12
  53. package/lib/cjs/components/address/Address.d.ts +8 -0
  54. package/lib/cjs/components/button/Button.js +2 -3
  55. package/lib/cjs/components/checkbox/Checkbox.d.ts +13 -0
  56. package/lib/cjs/components/checkbox/Checkbox.js +17 -5
  57. package/lib/cjs/components/columns/Columns.d.ts +1 -0
  58. package/lib/cjs/components/columns/Columns.js +1 -0
  59. package/lib/cjs/components/container/Container.d.ts +1 -0
  60. package/lib/cjs/components/container/Container.js +1 -0
  61. package/lib/cjs/components/content/Content.d.ts +1 -0
  62. package/lib/cjs/components/content/Content.js +1 -2
  63. package/lib/cjs/components/currency/editForm/Currency.edit.data.d.ts +14 -2
  64. package/lib/cjs/components/currency/editForm/Currency.edit.data.js +4 -0
  65. package/lib/cjs/components/currency/editForm/Currency.edit.display.js +4 -0
  66. package/lib/cjs/components/datagrid/DataGrid.d.ts +1 -0
  67. package/lib/cjs/components/datagrid/DataGrid.js +8 -1
  68. package/lib/cjs/components/datamap/DataMap.js +1 -0
  69. package/lib/cjs/components/datetime/DateTime.d.ts +4 -0
  70. package/lib/cjs/components/datetime/DateTime.js +21 -1
  71. package/lib/cjs/components/day/Day.d.ts +1 -1
  72. package/lib/cjs/components/day/Day.js +22 -6
  73. package/lib/cjs/components/day/fixtures/comp3.js +2 -2
  74. package/lib/cjs/components/editgrid/EditGrid.d.ts +4 -3
  75. package/lib/cjs/components/editgrid/EditGrid.js +11 -6
  76. package/lib/cjs/components/editgrid/fixtures/comp-with-custom-default-value.d.ts +190 -0
  77. package/lib/cjs/components/editgrid/fixtures/comp-with-custom-default-value.js +227 -0
  78. package/lib/cjs/components/editgrid/fixtures/comp15.d.ts +54 -0
  79. package/lib/cjs/components/editgrid/fixtures/comp15.js +51 -0
  80. package/lib/cjs/components/editgrid/fixtures/index.d.ts +3 -1
  81. package/lib/cjs/components/editgrid/fixtures/index.js +5 -1
  82. package/lib/cjs/components/fieldset/Fieldset.d.ts +1 -0
  83. package/lib/cjs/components/fieldset/Fieldset.js +1 -0
  84. package/lib/cjs/components/file/File.d.ts +7 -5
  85. package/lib/cjs/components/file/File.js +26 -9
  86. package/lib/cjs/components/file/editForm/File.edit.file.d.ts +62 -0
  87. package/lib/cjs/components/file/editForm/File.edit.file.js +29 -2
  88. package/lib/cjs/components/form/Form.d.ts +3 -0
  89. package/lib/cjs/components/form/Form.js +9 -10
  90. package/lib/cjs/components/hidden/Hidden.d.ts +1 -0
  91. package/lib/cjs/components/hidden/Hidden.js +1 -0
  92. package/lib/cjs/components/html/HTML.d.ts +1 -0
  93. package/lib/cjs/components/html/HTML.js +1 -0
  94. package/lib/cjs/components/number/Number.d.ts +5 -1
  95. package/lib/cjs/components/number/Number.js +24 -7
  96. package/lib/cjs/components/phonenumber/PhoneNumber.form.js +9 -0
  97. package/lib/cjs/components/radio/Radio.d.ts +5 -3
  98. package/lib/cjs/components/radio/Radio.js +59 -18
  99. package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +1 -1
  100. package/lib/cjs/components/recaptcha/ReCaptcha.js +4 -5
  101. package/lib/cjs/components/resource/Resource.d.ts +7 -0
  102. package/lib/cjs/components/resource/Resource.js +0 -1
  103. package/lib/cjs/components/resource/editForm/Resource.edit.display.js +1 -1
  104. package/lib/cjs/components/select/Select.d.ts +7 -5
  105. package/lib/cjs/components/select/Select.js +15 -49
  106. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +12 -0
  107. package/lib/cjs/components/selectboxes/SelectBoxes.js +53 -25
  108. package/lib/cjs/components/selectboxes/fixtures/comp4.d.ts +30 -27
  109. package/lib/cjs/components/selectboxes/fixtures/comp4.js +47 -32
  110. package/lib/cjs/components/selectboxes/fixtures/comp6.d.ts +14 -0
  111. package/lib/cjs/components/selectboxes/fixtures/comp6.js +15 -0
  112. package/lib/cjs/components/selectboxes/fixtures/index.d.ts +2 -1
  113. package/lib/cjs/components/selectboxes/fixtures/index.js +3 -1
  114. package/lib/cjs/components/signature/Signature.d.ts +1 -1
  115. package/lib/cjs/components/signature/Signature.js +8 -3
  116. package/lib/cjs/components/survey/Survey.js +3 -0
  117. package/lib/cjs/components/table/Table.d.ts +1 -0
  118. package/lib/cjs/components/table/Table.js +1 -0
  119. package/lib/cjs/components/tabs/Tabs.d.ts +1 -0
  120. package/lib/cjs/components/tabs/Tabs.js +1 -0
  121. package/lib/cjs/components/tags/Tags.js +3 -0
  122. package/lib/cjs/components/textarea/TextArea.d.ts +3 -2
  123. package/lib/cjs/components/textarea/TextArea.js +4 -5
  124. package/lib/cjs/components/textarea/fixtures/comp4.d.ts +30 -0
  125. package/lib/cjs/components/textarea/fixtures/comp4.js +27 -0
  126. package/lib/cjs/components/textarea/fixtures/index.d.ts +2 -1
  127. package/lib/cjs/components/textarea/fixtures/index.js +3 -1
  128. package/lib/cjs/components/textfield/TextField.d.ts +1 -0
  129. package/lib/cjs/components/textfield/TextField.js +5 -3
  130. package/lib/cjs/components/time/Time.d.ts +4 -0
  131. package/lib/cjs/components/time/Time.js +6 -1
  132. package/lib/cjs/components/tree/Tree.d.ts +5 -4
  133. package/lib/cjs/components/tree/Tree.form.js +5 -0
  134. package/lib/cjs/components/tree/Tree.js +8 -9
  135. package/lib/cjs/components/tree/editForm/Tree.edit.display.d.ts +9 -0
  136. package/lib/cjs/components/tree/editForm/Tree.edit.display.js +12 -0
  137. package/lib/cjs/components/well/Well.d.ts +1 -0
  138. package/lib/cjs/components/well/Well.js +1 -0
  139. package/lib/cjs/providers/Providers.d.ts +31 -11
  140. package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +2 -2
  141. package/lib/cjs/providers/address/GoogleAddressProvider.js +2 -3
  142. package/lib/cjs/providers/processor/fileProcessor.d.ts +1 -1
  143. package/lib/cjs/providers/processor/fileProcessor.js +1 -5
  144. package/lib/cjs/providers/storage/azure.d.ts +10 -1
  145. package/lib/cjs/providers/storage/azure.js +7 -2
  146. package/lib/cjs/providers/storage/base64.d.ts +2 -2
  147. package/lib/cjs/providers/storage/base64.js +2 -6
  148. package/lib/cjs/providers/storage/dropbox.d.ts +2 -2
  149. package/lib/cjs/providers/storage/dropbox.js +2 -6
  150. package/lib/cjs/providers/storage/googleDrive.d.ts +3 -2
  151. package/lib/cjs/providers/storage/googleDrive.js +6 -6
  152. package/lib/cjs/providers/storage/indexeddb.d.ts +3 -3
  153. package/lib/cjs/providers/storage/indexeddb.js +9 -13
  154. package/lib/cjs/providers/storage/s3.d.ts +11 -1
  155. package/lib/cjs/providers/storage/s3.js +5 -2
  156. package/lib/cjs/providers/storage/uploadAdapter.js +1 -5
  157. package/lib/cjs/providers/storage/url.d.ts +2 -2
  158. package/lib/cjs/providers/storage/url.js +12 -8
  159. package/lib/cjs/providers/storage/xhr.d.ts +1 -1
  160. package/lib/cjs/providers/storage/xhr.js +1 -2
  161. package/lib/cjs/templates/index.d.ts +226 -1
  162. package/lib/cjs/utils/Evaluator.js +4 -33
  163. package/lib/cjs/utils/i18n.d.ts +16 -0
  164. package/lib/cjs/utils/i18n.js +88 -0
  165. package/lib/cjs/utils/utils.d.ts +1 -1
  166. package/lib/cjs/utils/utils.js +8 -9
  167. package/lib/cjs/validator/Validator.d.ts +30 -2
  168. package/lib/cjs/validator/Validator.js +32 -9
  169. package/lib/cjs/validator/rules/Select.js +1 -2
  170. package/lib/cjs/validator/rules/Unique.d.ts +1 -1
  171. package/lib/cjs/validator/rules/Unique.js +1 -2
  172. package/lib/cjs/widgets/CalendarWidget.d.ts +1 -0
  173. package/lib/cjs/widgets/InputWidget.d.ts +1 -1
  174. package/lib/cjs/widgets/InputWidget.js +1 -2
  175. package/lib/mjs/CDN.js +1 -1
  176. package/lib/mjs/Element.js +6 -2
  177. package/lib/mjs/Embed.js +4 -1
  178. package/lib/mjs/Form.d.ts +8 -5
  179. package/lib/mjs/Form.js +52 -10
  180. package/lib/mjs/PDF.d.ts +11 -3
  181. package/lib/mjs/PDF.js +4 -5
  182. package/lib/mjs/PDFBuilder.js +2 -3
  183. package/lib/mjs/Webform.d.ts +4 -7
  184. package/lib/mjs/Webform.js +40 -122
  185. package/lib/mjs/WebformBuilder.d.ts +6 -1
  186. package/lib/mjs/WebformBuilder.js +102 -64
  187. package/lib/mjs/Wizard.d.ts +8 -5
  188. package/lib/mjs/Wizard.js +14 -14
  189. package/lib/mjs/WizardBuilder.d.ts +6 -4
  190. package/lib/mjs/WizardBuilder.js +20 -3
  191. package/lib/mjs/addons/FormioAddon.d.ts +1 -1
  192. package/lib/mjs/addons/FormioAddon.js +1 -2
  193. package/lib/mjs/components/_classes/component/Component.d.ts +17 -8
  194. package/lib/mjs/components/_classes/component/Component.js +52 -18
  195. package/lib/mjs/components/_classes/input/Input.d.ts +1 -1
  196. package/lib/mjs/components/_classes/input/Input.js +1 -2
  197. package/lib/mjs/components/_classes/list/ListComponent.d.ts +4 -0
  198. package/lib/mjs/components/_classes/list/ListComponent.js +43 -5
  199. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +1 -0
  200. package/lib/mjs/components/_classes/multivalue/Multivalue.js +10 -4
  201. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +5 -2
  202. package/lib/mjs/components/_classes/nested/NestedComponent.js +11 -12
  203. package/lib/mjs/components/address/Address.d.ts +8 -0
  204. package/lib/mjs/components/button/Button.js +2 -3
  205. package/lib/mjs/components/checkbox/Checkbox.d.ts +13 -0
  206. package/lib/mjs/components/checkbox/Checkbox.js +21 -5
  207. package/lib/mjs/components/columns/Columns.d.ts +1 -0
  208. package/lib/mjs/components/columns/Columns.js +1 -0
  209. package/lib/mjs/components/container/Container.d.ts +1 -0
  210. package/lib/mjs/components/container/Container.js +1 -0
  211. package/lib/mjs/components/content/Content.d.ts +1 -0
  212. package/lib/mjs/components/content/Content.js +1 -2
  213. package/lib/mjs/components/currency/editForm/Currency.edit.data.d.ts +14 -2
  214. package/lib/mjs/components/currency/editForm/Currency.edit.data.js +4 -0
  215. package/lib/mjs/components/currency/editForm/Currency.edit.display.js +4 -0
  216. package/lib/mjs/components/datagrid/DataGrid.d.ts +1 -0
  217. package/lib/mjs/components/datagrid/DataGrid.js +8 -1
  218. package/lib/mjs/components/datamap/DataMap.js +1 -0
  219. package/lib/mjs/components/datetime/DateTime.d.ts +4 -0
  220. package/lib/mjs/components/datetime/DateTime.js +28 -1
  221. package/lib/mjs/components/day/Day.d.ts +1 -1
  222. package/lib/mjs/components/day/Day.js +25 -6
  223. package/lib/mjs/components/day/fixtures/comp3.js +2 -2
  224. package/lib/mjs/components/editgrid/EditGrid.d.ts +4 -3
  225. package/lib/mjs/components/editgrid/EditGrid.js +11 -6
  226. package/lib/mjs/components/editgrid/fixtures/comp-with-custom-default-value.d.ts +190 -0
  227. package/lib/mjs/components/editgrid/fixtures/comp-with-custom-default-value.js +225 -0
  228. package/lib/mjs/components/editgrid/fixtures/comp15.d.ts +54 -0
  229. package/lib/mjs/components/editgrid/fixtures/comp15.js +49 -0
  230. package/lib/mjs/components/editgrid/fixtures/index.d.ts +3 -1
  231. package/lib/mjs/components/editgrid/fixtures/index.js +3 -1
  232. package/lib/mjs/components/fieldset/Fieldset.d.ts +1 -0
  233. package/lib/mjs/components/fieldset/Fieldset.js +1 -0
  234. package/lib/mjs/components/file/File.d.ts +7 -5
  235. package/lib/mjs/components/file/File.js +29 -9
  236. package/lib/mjs/components/file/editForm/File.edit.file.d.ts +62 -0
  237. package/lib/mjs/components/file/editForm/File.edit.file.js +29 -2
  238. package/lib/mjs/components/form/Form.d.ts +3 -0
  239. package/lib/mjs/components/form/Form.js +9 -10
  240. package/lib/mjs/components/hidden/Hidden.d.ts +1 -0
  241. package/lib/mjs/components/hidden/Hidden.js +1 -0
  242. package/lib/mjs/components/html/HTML.d.ts +1 -0
  243. package/lib/mjs/components/html/HTML.js +1 -0
  244. package/lib/mjs/components/number/Number.d.ts +5 -1
  245. package/lib/mjs/components/number/Number.js +24 -7
  246. package/lib/mjs/components/phonenumber/PhoneNumber.form.js +9 -0
  247. package/lib/mjs/components/radio/Radio.d.ts +5 -3
  248. package/lib/mjs/components/radio/Radio.js +59 -18
  249. package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +1 -1
  250. package/lib/mjs/components/recaptcha/ReCaptcha.js +4 -5
  251. package/lib/mjs/components/resource/Resource.d.ts +7 -0
  252. package/lib/mjs/components/resource/Resource.js +0 -1
  253. package/lib/mjs/components/resource/editForm/Resource.edit.display.js +1 -1
  254. package/lib/mjs/components/select/Select.d.ts +7 -5
  255. package/lib/mjs/components/select/Select.js +18 -49
  256. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +12 -0
  257. package/lib/mjs/components/selectboxes/SelectBoxes.js +56 -25
  258. package/lib/mjs/components/selectboxes/fixtures/comp4.d.ts +30 -27
  259. package/lib/mjs/components/selectboxes/fixtures/comp4.js +47 -32
  260. package/lib/mjs/components/selectboxes/fixtures/comp6.d.ts +14 -0
  261. package/lib/mjs/components/selectboxes/fixtures/comp6.js +13 -0
  262. package/lib/mjs/components/selectboxes/fixtures/index.d.ts +2 -1
  263. package/lib/mjs/components/selectboxes/fixtures/index.js +2 -1
  264. package/lib/mjs/components/signature/Signature.d.ts +1 -1
  265. package/lib/mjs/components/signature/Signature.js +11 -3
  266. package/lib/mjs/components/survey/Survey.js +6 -0
  267. package/lib/mjs/components/table/Table.d.ts +1 -0
  268. package/lib/mjs/components/table/Table.js +1 -0
  269. package/lib/mjs/components/tabs/Tabs.d.ts +1 -0
  270. package/lib/mjs/components/tabs/Tabs.js +1 -0
  271. package/lib/mjs/components/tags/Tags.js +6 -0
  272. package/lib/mjs/components/textarea/TextArea.d.ts +3 -2
  273. package/lib/mjs/components/textarea/TextArea.js +4 -5
  274. package/lib/mjs/components/textarea/fixtures/comp4.d.ts +30 -0
  275. package/lib/mjs/components/textarea/fixtures/comp4.js +25 -0
  276. package/lib/mjs/components/textarea/fixtures/index.d.ts +2 -1
  277. package/lib/mjs/components/textarea/fixtures/index.js +2 -1
  278. package/lib/mjs/components/textfield/TextField.d.ts +1 -0
  279. package/lib/mjs/components/textfield/TextField.js +8 -3
  280. package/lib/mjs/components/time/Time.d.ts +4 -0
  281. package/lib/mjs/components/time/Time.js +12 -1
  282. package/lib/mjs/components/tree/Tree.d.ts +5 -4
  283. package/lib/mjs/components/tree/Tree.form.js +5 -0
  284. package/lib/mjs/components/tree/Tree.js +8 -9
  285. package/lib/mjs/components/tree/editForm/Tree.edit.display.d.ts +9 -0
  286. package/lib/mjs/components/tree/editForm/Tree.edit.display.js +10 -0
  287. package/lib/mjs/components/well/Well.d.ts +1 -0
  288. package/lib/mjs/components/well/Well.js +1 -0
  289. package/lib/mjs/providers/Providers.d.ts +31 -11
  290. package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +2 -2
  291. package/lib/mjs/providers/address/GoogleAddressProvider.js +2 -3
  292. package/lib/mjs/providers/processor/fileProcessor.d.ts +1 -1
  293. package/lib/mjs/providers/processor/fileProcessor.js +1 -2
  294. package/lib/mjs/providers/storage/azure.d.ts +10 -1
  295. package/lib/mjs/providers/storage/azure.js +7 -2
  296. package/lib/mjs/providers/storage/base64.d.ts +2 -2
  297. package/lib/mjs/providers/storage/base64.js +2 -3
  298. package/lib/mjs/providers/storage/dropbox.d.ts +2 -2
  299. package/lib/mjs/providers/storage/dropbox.js +2 -3
  300. package/lib/mjs/providers/storage/googleDrive.d.ts +3 -2
  301. package/lib/mjs/providers/storage/googleDrive.js +6 -3
  302. package/lib/mjs/providers/storage/indexeddb.d.ts +3 -3
  303. package/lib/mjs/providers/storage/indexeddb.js +9 -10
  304. package/lib/mjs/providers/storage/s3.d.ts +11 -1
  305. package/lib/mjs/providers/storage/s3.js +5 -2
  306. package/lib/mjs/providers/storage/uploadAdapter.js +1 -2
  307. package/lib/mjs/providers/storage/url.d.ts +2 -2
  308. package/lib/mjs/providers/storage/url.js +12 -5
  309. package/lib/mjs/providers/storage/xhr.d.ts +1 -1
  310. package/lib/mjs/providers/storage/xhr.js +1 -2
  311. package/lib/mjs/templates/index.d.ts +226 -1
  312. package/lib/mjs/utils/Evaluator.js +4 -33
  313. package/lib/mjs/utils/i18n.d.ts +16 -0
  314. package/lib/mjs/utils/i18n.js +81 -0
  315. package/lib/mjs/utils/utils.d.ts +1 -1
  316. package/lib/mjs/utils/utils.js +8 -9
  317. package/lib/mjs/validator/Validator.d.ts +30 -2
  318. package/lib/mjs/validator/Validator.js +31 -9
  319. package/lib/mjs/validator/rules/Select.js +1 -2
  320. package/lib/mjs/validator/rules/Unique.d.ts +1 -1
  321. package/lib/mjs/validator/rules/Unique.js +1 -2
  322. package/lib/mjs/widgets/CalendarWidget.d.ts +1 -0
  323. package/lib/mjs/widgets/InputWidget.d.ts +1 -1
  324. package/lib/mjs/widgets/InputWidget.js +1 -2
  325. package/package.json +24 -25
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);
@@ -497,8 +496,8 @@ export default class Wizard extends Webform {
497
496
  item.key = item.title;
498
497
  }
499
498
  let page = currentPages[item.key];
500
- const forceShow = this.options.show ? this.options.show[item.key] : false;
501
- const forceHide = this.options.hide ? this.options.hide[item.key] : false;
499
+ const forceShow = this.shouldForceShow(item);
500
+ const forceHide = this.shouldForceHide(item);
502
501
  let isVisible = !page
503
502
  ? checkCondition(item, data, data, this.component, this) && !item.hidden
504
503
  : page.visible;
@@ -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
  }
@@ -12,6 +12,12 @@ declare class Component extends Element {
12
12
  * @param options
13
13
  */
14
14
  static tableView(value: any, options: any): void;
15
+ static get serverConditionSettings(): {
16
+ operators: string[];
17
+ valueComponent(): {
18
+ type: string;
19
+ };
20
+ };
15
21
  /**
16
22
  * Initialize a new Component.
17
23
  *
@@ -151,7 +157,7 @@ declare class Component extends Element {
151
157
  set data(arg: any);
152
158
  get data(): any;
153
159
  mergeSchema(component?: {}): any;
154
- get ready(): any;
160
+ get ready(): Promise<Component>;
155
161
  get isPDFReadOnlyMode(): any;
156
162
  get labelInfo(): {
157
163
  hidden: any;
@@ -184,6 +190,9 @@ declare class Component extends Element {
184
190
  get parentVisible(): any;
185
191
  set parentDisabled(arg: boolean);
186
192
  get parentDisabled(): boolean;
193
+ shouldForceVisibility(component: any, visibility: any): any;
194
+ shouldForceHide(component: any): any;
195
+ shouldForceShow(component: any): any;
187
196
  /**
188
197
  *
189
198
  * @param value {boolean}
@@ -290,12 +299,12 @@ declare class Component extends Element {
290
299
  loadRefs(element: any, refs: any): void;
291
300
  setOpenModalElement(template: any): void;
292
301
  getModalPreviewTemplate(): any;
293
- build(element: any): any;
302
+ build(element: any): Promise<void>;
294
303
  get hasModalSaveButton(): boolean;
295
304
  render(children?: string, topLevel?: boolean): any;
296
305
  attachTooltips(toolTipsRefs: any): void;
297
306
  createComponentModal(element: any, modalShouldBeOpened: any, currentValue: any): ComponentModal;
298
- attach(element: any): any;
307
+ attach(element: any): Promise<void>;
299
308
  componentModal: any;
300
309
  restoreFocus(): void;
301
310
  addShortcut(element: any, shortcut: any): void;
@@ -399,8 +408,8 @@ declare class Component extends Element {
399
408
  errorMessage(type: any): any;
400
409
  setContent(element: any, content: any, forceSanitize: any, sanitizeOptions: any): boolean;
401
410
  restoreCaretPosition(): void;
402
- redraw(): any;
403
- rebuild(): any;
411
+ redraw(): Promise<void>;
412
+ rebuild(): Promise<void>;
404
413
  hasClass(element: any, className: any): boolean | undefined;
405
414
  addClass(element: any, className: any): Component | undefined;
406
415
  removeClass(element: any, className: any): Component | undefined;
@@ -691,7 +700,7 @@ declare class Component extends Element {
691
700
  */
692
701
  checkComponentValidity(data: any, dirty: any, row: any, options?: {}): boolean;
693
702
  checkValidity(data: any, dirty: any, row: any, silentCheck: any): boolean;
694
- checkAsyncValidity(data: any, dirty: any, row: any, silentCheck: any): any;
703
+ checkAsyncValidity(data: any, dirty: any, row: any, silentCheck: any): Promise<boolean>;
695
704
  /**
696
705
  * Check the conditions, calculations, and validity of a single component and triggers an update if
697
706
  * something changed.
@@ -725,8 +734,8 @@ declare class Component extends Element {
725
734
  */
726
735
  isValueHidden(): boolean | any;
727
736
  shouldSkipValidation(data: any, dirty: any, row: any): boolean;
728
- whenReady(): any;
729
- get dataReady(): any;
737
+ whenReady(): Promise<void>;
738
+ get dataReady(): Promise<void>;
730
739
  /**
731
740
  * Prints out the value of this component as a string value.
732
741
  */
@@ -1,6 +1,5 @@
1
1
  /* globals Quill, ClassicEditor, CKEDITOR */
2
2
  import { conformToMask } from '@formio/vanilla-text-mask';
3
- import NativePromise from 'native-promise-only';
4
3
  import tippy from 'tippy.js';
5
4
  import _ from 'lodash';
6
5
  import isMobile from 'ismobilejs';
@@ -409,7 +408,7 @@ export default class Component extends Element {
409
408
  }
410
409
  // Allow componets to notify when ready.
411
410
  get ready() {
412
- return NativePromise.resolve(this);
411
+ return Promise.resolve(this);
413
412
  }
414
413
  get isPDFReadOnlyMode() {
415
414
  return this.parent &&
@@ -522,12 +521,38 @@ export default class Component extends Element {
522
521
  get parentDisabled() {
523
522
  return this._parentDisabled;
524
523
  }
524
+ shouldForceVisibility(component, visibility) {
525
+ if (!this.options[visibility]) {
526
+ return false;
527
+ }
528
+ if (!component) {
529
+ component = this.component;
530
+ }
531
+ if (_.isArray(this.options[visibility])) {
532
+ return this.options[visibility].includes(component.key);
533
+ }
534
+ return this.options[visibility][component.key];
535
+ }
536
+ shouldForceHide(component) {
537
+ return this.shouldForceVisibility(component, 'hide');
538
+ }
539
+ shouldForceShow(component) {
540
+ return this.shouldForceVisibility(component, 'show');
541
+ }
525
542
  /**
526
543
  *
527
544
  * @param value {boolean}
528
545
  */
529
546
  set visible(value) {
530
547
  if (this._visible !== value) {
548
+ // Skip if this component is set to visible and is supposed to be hidden.
549
+ if (value && this.shouldForceHide()) {
550
+ return;
551
+ }
552
+ // Skip if this component is set to hidden and is supposed to be shown.
553
+ if (!value && this.shouldForceShow()) {
554
+ return;
555
+ }
531
556
  this._visible = value;
532
557
  this.clearOnHide();
533
558
  this.redraw();
@@ -542,12 +567,10 @@ export default class Component extends Element {
542
567
  if (this.builderMode || this.previewMode || this.options.showHiddenFields) {
543
568
  return true;
544
569
  }
545
- if (this.options.hide &&
546
- this.options.hide[this.component.key]) {
570
+ if (this.shouldForceHide()) {
547
571
  return false;
548
572
  }
549
- if (this.options.show &&
550
- this.options.show[this.component.key]) {
573
+ if (this.shouldForceShow()) {
551
574
  return true;
552
575
  }
553
576
  return this._visible && this._parentVisible;
@@ -870,7 +893,7 @@ export default class Component extends Element {
870
893
  * @return {*}
871
894
  */
872
895
  beforePage() {
873
- return NativePromise.resolve(true);
896
+ return Promise.resolve(true);
874
897
  }
875
898
  beforeNext() {
876
899
  return this.beforePage(true);
@@ -882,7 +905,7 @@ export default class Component extends Element {
882
905
  * @return {*}
883
906
  */
884
907
  beforeSubmit() {
885
- return NativePromise.resolve(true);
908
+ return Promise.resolve(true);
886
909
  }
887
910
  /**
888
911
  * Return the submission timezone.
@@ -1032,7 +1055,7 @@ export default class Component extends Element {
1032
1055
  }
1033
1056
  this.restoreFocus();
1034
1057
  this.addons.forEach((addon) => addon.attach(element));
1035
- return NativePromise.resolve();
1058
+ return Promise.resolve();
1036
1059
  }
1037
1060
  restoreFocus() {
1038
1061
  const isFocused = this.root?.focusedComponent?.path === this.path;
@@ -1346,6 +1369,14 @@ export default class Component extends Element {
1346
1369
  });
1347
1370
  return customCSS;
1348
1371
  }
1372
+ static get serverConditionSettings() {
1373
+ return {
1374
+ operators: ['isEqual', 'isNotEqual', 'isEmpty', 'isNotEmpty'],
1375
+ valueComponent() {
1376
+ return { type: 'textfield' };
1377
+ },
1378
+ };
1379
+ }
1349
1380
  get isMobile() {
1350
1381
  return isMobile();
1351
1382
  }
@@ -1475,7 +1506,7 @@ export default class Component extends Element {
1475
1506
  // Don't bother if we have not built yet.
1476
1507
  if (!this.element || !this.element.parentNode || this.optimizeRedraw) {
1477
1508
  // Return a non-resolving promise.
1478
- return NativePromise.resolve();
1509
+ return Promise.resolve();
1479
1510
  }
1480
1511
  this.detach();
1481
1512
  this.emit('redraw');
@@ -1906,12 +1937,12 @@ export default class Component extends Element {
1906
1937
  return Formio.requireLibrary('ckeditor', isIEBrowser ? 'CKEDITOR' : 'ClassicEditor', _.get(this.options, 'editors.ckeditor.src', `${Formio.cdn.ckeditor}/ckeditor.js`), true)
1907
1938
  .then(() => {
1908
1939
  if (!element.parentNode) {
1909
- return NativePromise.reject();
1940
+ return Promise.reject();
1910
1941
  }
1911
1942
  if (isIEBrowser) {
1912
1943
  const editor = CKEDITOR.replace(element);
1913
1944
  editor.on('change', () => onChange(editor.getData()));
1914
- return NativePromise.resolve(editor);
1945
+ return Promise.resolve(editor);
1915
1946
  }
1916
1947
  else {
1917
1948
  return ClassicEditor.create(element, settings).then(editor => {
@@ -1941,7 +1972,7 @@ export default class Component extends Element {
1941
1972
  return Formio.requireLibrary('quill-table', 'Quill', `${Formio.cdn.baseUrl}/quill/quill-table.js`, true)
1942
1973
  .then(() => {
1943
1974
  if (!element.parentNode) {
1944
- return NativePromise.reject();
1975
+ return Promise.reject();
1945
1976
  }
1946
1977
  this.quill = new Quill(element, isIEBrowser ? { ...settings, modules: {} } : settings);
1947
1978
  /** This block of code adds the [source] capabilities. See https://codepen.io/anon/pen/ZyEjrQ **/
@@ -2390,6 +2421,9 @@ export default class Component extends Element {
2390
2421
  const dataValue = this.dataValue;
2391
2422
  // Calculate the new value.
2392
2423
  let calculatedValue = this.doValueCalculation(dataValue, data, row, flags);
2424
+ if (this.options.readOnly && dataValue && !calculatedValue) {
2425
+ return false;
2426
+ }
2393
2427
  if (_.isNil(calculatedValue)) {
2394
2428
  calculatedValue = this.emptyValue;
2395
2429
  }
@@ -2539,7 +2573,7 @@ export default class Component extends Element {
2539
2573
  const { async = false, silentCheck = false } = options;
2540
2574
  if (this.shouldSkipValidation(data, dirty, row)) {
2541
2575
  this.setCustomValidity('');
2542
- return async ? NativePromise.resolve(true) : true;
2576
+ return async ? Promise.resolve(true) : true;
2543
2577
  }
2544
2578
  const check = Validator.checkComponent(this, data, row, true, async);
2545
2579
  let validations = check;
@@ -2558,7 +2592,7 @@ export default class Component extends Element {
2558
2592
  return isValid;
2559
2593
  }
2560
2594
  checkAsyncValidity(data, dirty, row, silentCheck) {
2561
- return NativePromise.resolve(this.checkComponentValidity(data, dirty, row, { async: true, silentCheck }));
2595
+ return Promise.resolve(this.checkComponentValidity(data, dirty, row, { async: true, silentCheck }));
2562
2596
  }
2563
2597
  /**
2564
2598
  * Check the conditions, calculations, and validity of a single component and triggers an update if
@@ -2797,7 +2831,7 @@ export default class Component extends Element {
2797
2831
  return this.dataReady;
2798
2832
  }
2799
2833
  get dataReady() {
2800
- return NativePromise.resolve();
2834
+ return Promise.resolve();
2801
2835
  }
2802
2836
  /**
2803
2837
  * Prints out the value of this component as a string value.
@@ -3033,7 +3067,7 @@ Component.externalLibraries = {};
3033
3067
  Component.requireLibrary = function (name, property, src, polling) {
3034
3068
  if (!Component.externalLibraries.hasOwnProperty(name)) {
3035
3069
  Component.externalLibraries[name] = {};
3036
- Component.externalLibraries[name].ready = new NativePromise((resolve, reject) => {
3070
+ Component.externalLibraries[name].ready = new Promise((resolve, reject) => {
3037
3071
  Component.externalLibraries[name].resolve = resolve;
3038
3072
  Component.externalLibraries[name].reject = reject;
3039
3073
  });
@@ -3106,5 +3140,5 @@ Component.libraryReady = function (name) {
3106
3140
  Component.externalLibraries[name].ready) {
3107
3141
  return Component.externalLibraries[name].ready;
3108
3142
  }
3109
- return NativePromise.reject(`${name} library was not required.`);
3143
+ return Promise.reject(`${name} library was not required.`);
3110
3144
  };
@@ -31,7 +31,7 @@ export default class Input extends Multivalue {
31
31
  parseValue(value: any): any;
32
32
  formatValue(value: any): any;
33
33
  getWidget(index: any): any;
34
- attachElement(element: any, index: any): any;
34
+ attachElement(element: any, index: any): Promise<void>;
35
35
  /**
36
36
  * Creates an instance of a widget for this component.
37
37
  *
@@ -1,7 +1,6 @@
1
1
  import Multivalue from '../multivalue/Multivalue';
2
2
  import { convertStringToHTMLElement } from '../../../utils/utils';
3
3
  import Widgets from '../../../widgets';
4
- import NativePromise from 'native-promise-only';
5
4
  import _ from 'lodash';
6
5
  export default class Input extends Multivalue {
7
6
  constructor(component, options, data) {
@@ -213,7 +212,7 @@ export default class Input extends Multivalue {
213
212
  element.widget.destroy();
214
213
  }
215
214
  // Attach the widget.
216
- let promise = NativePromise.resolve();
215
+ let promise = Promise.resolve();
217
216
  element.widget = this.createWidget(index);
218
217
  if (element.widget) {
219
218
  promise = element.widget.attach(element);
@@ -1,5 +1,9 @@
1
1
  export default class ListComponent extends Field {
2
2
  get isSelectURL(): boolean;
3
+ get selectData(): any;
4
+ get shouldLoad(): any;
5
+ getTemplateKeys(): void;
6
+ templateKeys: any[] | undefined;
3
7
  get requestHeaders(): any;
4
8
  setItems(): void;
5
9
  updateCustomItems(): void;
@@ -1,7 +1,6 @@
1
1
  import Field from '../field/Field';
2
2
  import { Formio } from '../../../Formio';
3
3
  import _ from 'lodash';
4
- import NativePromise from 'native-promise-only';
5
4
  export default class ListComponent extends Field {
6
5
  static schema(...extend) {
7
6
  return Field.schema({
@@ -17,6 +16,46 @@ export default class ListComponent extends Field {
17
16
  get isSelectURL() {
18
17
  return this.component.dataSrc === 'url';
19
18
  }
19
+ get selectData() {
20
+ const selectData = _.get(this.root, 'submission.metadata.selectData', {});
21
+ return _.get(selectData, this.path);
22
+ }
23
+ get shouldLoad() {
24
+ if (this.loadingError) {
25
+ return false;
26
+ }
27
+ // Live forms should always load.
28
+ if (!this.options.readOnly) {
29
+ return true;
30
+ }
31
+ // If there are template keys, then we need to see if we have the data.
32
+ if (this.templateKeys && this.templateKeys.length) {
33
+ // See if we already have the data we need.
34
+ const dataValue = this.dataValue;
35
+ const selectData = this.selectData;
36
+ return this.templateKeys.reduce((shouldLoad, key) => {
37
+ const hasValue = _.has(dataValue, key) ||
38
+ (_.isArray(selectData) ? selectData.every((data) => _.has(data, key)) : _.has(selectData, key));
39
+ return shouldLoad || !hasValue;
40
+ }, false);
41
+ }
42
+ // Return that we should load.
43
+ return true;
44
+ }
45
+ getTemplateKeys() {
46
+ this.templateKeys = [];
47
+ if (this.options.readOnly && this.component.template) {
48
+ const keys = this.component.template.match(/({{\s*(.*?)\s*}})/g);
49
+ if (keys) {
50
+ keys.forEach((key) => {
51
+ const propKey = key.match(/{{\s*item\.(.*?)\s*}}/);
52
+ if (propKey && propKey.length > 1) {
53
+ this.templateKeys.push(propKey[1]);
54
+ }
55
+ });
56
+ }
57
+ }
58
+ }
20
59
  get requestHeaders() {
21
60
  // Create the headers object.
22
61
  const headers = new Formio.Headers();
@@ -64,10 +103,9 @@ export default class ListComponent extends Field {
64
103
  const template = this.sanitize(this.getOptionTemplate(data, value), this.shouldSanitizeValue);
65
104
  if (template) {
66
105
  const label = template.replace(/<\/?[^>]+(>|$)/g, '');
67
- const hasTranslator = this.i18next?.translator;
68
- if (!label || (hasTranslator && !this.t(label, { _userInput: true })))
106
+ if (!label)
69
107
  return;
70
- return hasTranslator ? template.replace(label, this.t(label, { _userInput: true })) : label;
108
+ return template.replace(label, this.t(label, { _userInput: true }));
71
109
  }
72
110
  else {
73
111
  return this.sanitize(JSON.stringify(data), this.shouldSanitizeValue);
@@ -186,7 +224,7 @@ export default class ListComponent extends Field {
186
224
  const db = event.target.result;
187
225
  const transaction = db.transaction(this.component.indexeddb.table, 'readwrite');
188
226
  const objectStore = transaction.objectStore(this.component.indexeddb.table);
189
- new NativePromise((resolve) => {
227
+ new Promise((resolve) => {
190
228
  const responseItems = [];
191
229
  objectStore.getAll().onsuccess = (event) => {
192
230
  event.target.result.forEach((item) => {
@@ -4,6 +4,7 @@ export default class Multivalue extends Field {
4
4
  render(): any;
5
5
  renderElement(): string;
6
6
  renderRow(value: any, index: any): any;
7
+ attach(dom: any): Promise<any[]>;
7
8
  /**
8
9
  * Attach inputs to the element.
9
10
  *
@@ -1,5 +1,4 @@
1
1
  import Field from '../field/Field';
2
- import NativePromise from 'native-promise-only';
3
2
  import _ from 'lodash';
4
3
  export default class Multivalue extends Field {
5
4
  get dataValue() {
@@ -73,7 +72,7 @@ export default class Multivalue extends Field {
73
72
  promises.push(this.attachElement.call(this, element, index));
74
73
  });
75
74
  if (!this.component.multiple) {
76
- return NativePromise.all(promises);
75
+ return Promise.all(promises);
77
76
  }
78
77
  this.refs.removeRow.forEach((removeButton, index) => {
79
78
  this.addEventListener(removeButton, 'click', (event) => {
@@ -89,7 +88,7 @@ export default class Multivalue extends Field {
89
88
  });
90
89
  });
91
90
  return superAttach.then(() => {
92
- return NativePromise.all(promises);
91
+ return Promise.all(promises);
93
92
  });
94
93
  }
95
94
  detach() {
@@ -181,7 +180,14 @@ export default class Multivalue extends Field {
181
180
  // Saves current caret position to restore it after the component is redrawn
182
181
  saveCaretPosition(element, index) {
183
182
  if (this.root?.focusedComponent?.path === this.path) {
184
- this.root.currentSelection = { selection: [element.selectionStart, element.selectionEnd], index };
183
+ try {
184
+ this.root.currentSelection = { selection: [element.selectionStart, element.selectionEnd], index };
185
+ }
186
+ catch (e) {
187
+ if (!(e instanceof DOMException)) {
188
+ console.debug(e);
189
+ }
190
+ }
185
191
  }
186
192
  }
187
193
  onSelectMaskHandler(event) {
@@ -4,7 +4,8 @@ export default class NestedComponent extends Field {
4
4
  _collapsed: boolean;
5
5
  set collapsed(arg: boolean);
6
6
  get collapsed(): boolean;
7
- collapse(value: any): any;
7
+ collapse(value: any): Promise<void>;
8
+ get ready(): Promise<any[]>;
8
9
  set rowIndex(arg: any);
9
10
  get rowIndex(): any;
10
11
  _rowIndex: any;
@@ -78,8 +79,9 @@ export default class NestedComponent extends Field {
78
79
  addComponent(component: Object, data: Object, before: HTMLElement, noAdd: any): Component;
79
80
  beforeFocus(): void;
80
81
  renderComponents(components: any): any;
82
+ attach(element: any): Promise<[void, void]>;
81
83
  attachComponentsLogic(components: any): void;
82
- attachComponents(element: any, components: any, container: any): any;
84
+ attachComponents(element: any, components: any, container: any): Promise<any>;
83
85
  /**
84
86
  * Remove a component from the components array.
85
87
  *
@@ -123,6 +125,7 @@ export default class NestedComponent extends Field {
123
125
  get isPristine(): any;
124
126
  destroyComponents(all?: boolean): void;
125
127
  get errors(): any;
128
+ get dataReady(): Promise<any[]>;
126
129
  setNestedValue(component: any, value: any, flags?: {}): any;
127
130
  setValue(value: any, flags?: {}): any;
128
131
  get lazyLoad(): any;