@formio/js 5.0.0-rc.26 → 5.0.0-rc.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (360) hide show
  1. package/dist/fonts/bootstrap-icons.woff +0 -0
  2. package/dist/fonts/bootstrap-icons.woff2 +0 -0
  3. package/dist/formio.embed.js +1 -1
  4. package/dist/formio.embed.min.js +1 -1
  5. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  6. package/dist/formio.form.js +710 -689
  7. package/dist/formio.form.min.js +1 -1
  8. package/dist/formio.form.min.js.LICENSE.txt +2 -2
  9. package/dist/formio.full.css +100 -3
  10. package/dist/formio.full.js +715 -727
  11. package/dist/formio.full.min.css +2 -2
  12. package/dist/formio.full.min.js +1 -1
  13. package/dist/formio.full.min.js.LICENSE.txt +2 -2
  14. package/dist/formio.js +659 -264
  15. package/dist/formio.min.js +1 -1
  16. package/dist/formio.min.js.LICENSE.txt +2 -2
  17. package/dist/formio.utils.js +29 -8
  18. package/dist/formio.utils.min.js +1 -1
  19. package/dist/formio.utils.min.js.LICENSE.txt +2 -2
  20. package/lib/cjs/Embed.d.ts +2 -1
  21. package/lib/cjs/Embed.js +20 -7
  22. package/lib/cjs/PDF.js +2 -2
  23. package/lib/cjs/Webform.d.ts +3 -5
  24. package/lib/cjs/Webform.js +59 -81
  25. package/lib/cjs/WebformBuilder.d.ts +1 -1
  26. package/lib/cjs/WebformBuilder.js +27 -10
  27. package/lib/cjs/Wizard.d.ts +2 -0
  28. package/lib/cjs/Wizard.js +37 -26
  29. package/lib/cjs/WizardBuilder.d.ts +1 -0
  30. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +1 -2
  31. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +11 -12
  32. package/lib/cjs/addons/index.d.ts +1 -0
  33. package/lib/cjs/addons/index.js +5 -1
  34. package/lib/cjs/components/Components.d.ts +7 -0
  35. package/lib/cjs/components/Components.js +30 -0
  36. package/lib/cjs/components/_classes/component/Component.d.ts +57 -27
  37. package/lib/cjs/components/_classes/component/Component.js +193 -119
  38. package/lib/cjs/components/_classes/component/editForm/Component.edit.addons.d.ts +8 -0
  39. package/lib/cjs/components/_classes/component/editForm/Component.edit.addons.js +31 -1
  40. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +28 -11
  41. package/lib/cjs/components/_classes/nested/NestedComponent.js +88 -57
  42. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +4 -3
  43. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +17 -4
  44. package/lib/cjs/components/builder.js +0 -2
  45. package/lib/cjs/components/button/Button.js +2 -1
  46. package/lib/cjs/components/columns/Columns.d.ts +1 -0
  47. package/lib/cjs/components/columns/Columns.js +2 -3
  48. package/lib/cjs/components/columns/editForm/Columns.edit.display.d.ts +30 -1
  49. package/lib/cjs/components/columns/editForm/Columns.edit.display.js +23 -1
  50. package/lib/cjs/components/container/Container.d.ts +1 -0
  51. package/lib/cjs/components/container/Container.js +2 -6
  52. package/lib/cjs/components/content/Content.d.ts +1 -0
  53. package/lib/cjs/components/content/Content.js +1 -0
  54. package/lib/cjs/components/datagrid/DataGrid.d.ts +0 -8
  55. package/lib/cjs/components/datagrid/DataGrid.js +9 -26
  56. package/lib/cjs/components/datamap/DataMap.js +2 -1
  57. package/lib/cjs/components/datetime/DateTime.js +0 -2
  58. package/lib/cjs/components/day/Day.js +2 -3
  59. package/lib/cjs/components/editgrid/EditGrid.d.ts +8 -4
  60. package/lib/cjs/components/editgrid/EditGrid.js +96 -73
  61. package/lib/cjs/components/email/Email.js +0 -1
  62. package/lib/cjs/components/file/File.js +1 -1
  63. package/lib/cjs/components/file/fixtures/comp3.d.ts +29 -0
  64. package/lib/cjs/components/file/fixtures/comp3.js +31 -0
  65. package/lib/cjs/components/form/Form.d.ts +2 -6
  66. package/lib/cjs/components/form/Form.js +43 -14
  67. package/lib/cjs/components/index.d.ts +0 -2
  68. package/lib/cjs/components/index.js +0 -2
  69. package/lib/cjs/components/number/Number.d.ts +1 -2
  70. package/lib/cjs/components/number/Number.js +5 -6
  71. package/lib/cjs/components/panel/Panel.d.ts +0 -1
  72. package/lib/cjs/components/panel/Panel.js +2 -9
  73. package/lib/cjs/components/panel/editForm/Panel.edit.display.d.ts +6 -38
  74. package/lib/cjs/components/panel/editForm/Panel.edit.display.js +3 -16
  75. package/lib/cjs/components/phonenumber/PhoneNumber.js +17 -0
  76. package/lib/cjs/components/radio/Radio.js +0 -2
  77. package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +1 -1
  78. package/lib/cjs/components/recaptcha/ReCaptcha.js +2 -2
  79. package/lib/cjs/components/select/Select.js +3 -2
  80. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +1 -2
  81. package/lib/cjs/components/selectboxes/SelectBoxes.js +7 -6
  82. package/lib/cjs/components/table/editForm/Table.edit.display.d.ts +31 -2
  83. package/lib/cjs/components/table/editForm/Table.edit.display.js +22 -0
  84. package/lib/cjs/components/tabs/editForm/Tabs.edit.display.d.ts +30 -2
  85. package/lib/cjs/components/tabs/editForm/Tabs.edit.display.js +22 -0
  86. package/lib/cjs/components/textfield/TextField.js +20 -6
  87. package/lib/cjs/components/time/Time.js +0 -6
  88. package/lib/cjs/components/url/Url.js +0 -1
  89. package/lib/cjs/components/well/editForm/Well.edit.display.d.ts +25 -2
  90. package/lib/cjs/components/well/editForm/Well.edit.display.js +18 -0
  91. package/lib/cjs/formio.embed.js +5 -3
  92. package/lib/cjs/formio.form.d.ts +1 -7
  93. package/lib/cjs/formio.form.js +2 -38
  94. package/lib/cjs/index.d.ts +2 -1
  95. package/lib/cjs/index.js +2 -1
  96. package/lib/cjs/providers/Providers.d.ts +0 -4
  97. package/lib/cjs/providers/storage/azure.d.ts +0 -2
  98. package/lib/cjs/providers/storage/azure.js +1 -6
  99. package/lib/cjs/providers/storage/googleDrive.d.ts +0 -1
  100. package/lib/cjs/providers/storage/googleDrive.js +0 -4
  101. package/lib/cjs/providers/storage/s3.d.ts +0 -1
  102. package/lib/cjs/providers/storage/s3.js +0 -4
  103. package/lib/cjs/translations/en.d.ts +5 -0
  104. package/lib/cjs/translations/en.js +5 -0
  105. package/lib/cjs/utils/formUtils.js +1 -0
  106. package/lib/cjs/utils/utils.d.ts +2 -1
  107. package/lib/cjs/utils/utils.js +27 -9
  108. package/lib/mjs/Embed.d.ts +2 -1
  109. package/lib/mjs/Embed.js +20 -7
  110. package/lib/mjs/PDF.js +2 -2
  111. package/lib/mjs/Webform.d.ts +3 -5
  112. package/lib/mjs/Webform.js +58 -82
  113. package/lib/mjs/WebformBuilder.d.ts +1 -1
  114. package/lib/mjs/WebformBuilder.js +28 -7
  115. package/lib/mjs/Wizard.d.ts +2 -0
  116. package/lib/mjs/Wizard.js +36 -27
  117. package/lib/mjs/WizardBuilder.d.ts +1 -0
  118. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +1 -2
  119. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +11 -12
  120. package/lib/mjs/addons/index.d.ts +1 -0
  121. package/lib/mjs/addons/index.js +5 -1
  122. package/lib/mjs/components/Components.d.ts +7 -0
  123. package/lib/mjs/components/Components.js +29 -0
  124. package/lib/mjs/components/_classes/component/Component.d.ts +57 -27
  125. package/lib/mjs/components/_classes/component/Component.js +191 -118
  126. package/lib/mjs/components/_classes/component/editForm/Component.edit.addons.d.ts +8 -0
  127. package/lib/mjs/components/_classes/component/editForm/Component.edit.addons.js +31 -1
  128. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +28 -11
  129. package/lib/mjs/components/_classes/nested/NestedComponent.js +88 -57
  130. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +4 -3
  131. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +18 -5
  132. package/lib/mjs/components/builder.js +0 -2
  133. package/lib/mjs/components/button/Button.js +2 -1
  134. package/lib/mjs/components/columns/Columns.d.ts +1 -0
  135. package/lib/mjs/components/columns/Columns.js +2 -3
  136. package/lib/mjs/components/columns/editForm/Columns.edit.display.d.ts +30 -1
  137. package/lib/mjs/components/columns/editForm/Columns.edit.display.js +23 -1
  138. package/lib/mjs/components/container/Container.d.ts +1 -0
  139. package/lib/mjs/components/container/Container.js +2 -6
  140. package/lib/mjs/components/content/Content.d.ts +1 -0
  141. package/lib/mjs/components/content/Content.js +1 -0
  142. package/lib/mjs/components/datagrid/DataGrid.d.ts +0 -8
  143. package/lib/mjs/components/datagrid/DataGrid.js +9 -26
  144. package/lib/mjs/components/datamap/DataMap.js +2 -1
  145. package/lib/mjs/components/datetime/DateTime.js +0 -2
  146. package/lib/mjs/components/day/Day.js +2 -3
  147. package/lib/mjs/components/editgrid/EditGrid.d.ts +8 -4
  148. package/lib/mjs/components/editgrid/EditGrid.js +97 -76
  149. package/lib/mjs/components/email/Email.js +0 -1
  150. package/lib/mjs/components/file/File.js +1 -1
  151. package/lib/mjs/components/file/fixtures/comp3.d.ts +29 -0
  152. package/lib/mjs/components/file/fixtures/comp3.js +29 -0
  153. package/lib/mjs/components/form/Form.d.ts +2 -6
  154. package/lib/mjs/components/form/Form.js +45 -14
  155. package/lib/mjs/components/index.d.ts +0 -2
  156. package/lib/mjs/components/index.js +0 -2
  157. package/lib/mjs/components/number/Number.d.ts +1 -2
  158. package/lib/mjs/components/number/Number.js +4 -5
  159. package/lib/mjs/components/panel/Panel.d.ts +0 -1
  160. package/lib/mjs/components/panel/Panel.js +3 -9
  161. package/lib/mjs/components/panel/editForm/Panel.edit.display.d.ts +6 -38
  162. package/lib/mjs/components/panel/editForm/Panel.edit.display.js +3 -16
  163. package/lib/mjs/components/phonenumber/PhoneNumber.js +17 -0
  164. package/lib/mjs/components/radio/Radio.js +0 -2
  165. package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +1 -1
  166. package/lib/mjs/components/recaptcha/ReCaptcha.js +2 -2
  167. package/lib/mjs/components/select/Select.js +3 -2
  168. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +1 -2
  169. package/lib/mjs/components/selectboxes/SelectBoxes.js +7 -6
  170. package/lib/mjs/components/table/editForm/Table.edit.display.d.ts +31 -2
  171. package/lib/mjs/components/table/editForm/Table.edit.display.js +22 -0
  172. package/lib/mjs/components/tabs/editForm/Tabs.edit.display.d.ts +30 -2
  173. package/lib/mjs/components/tabs/editForm/Tabs.edit.display.js +22 -0
  174. package/lib/mjs/components/textfield/TextField.js +20 -6
  175. package/lib/mjs/components/time/Time.js +0 -6
  176. package/lib/mjs/components/url/Url.js +0 -1
  177. package/lib/mjs/components/well/editForm/Well.edit.display.d.ts +25 -2
  178. package/lib/mjs/components/well/editForm/Well.edit.display.js +18 -0
  179. package/lib/mjs/formio.embed.js +5 -3
  180. package/lib/mjs/formio.form.d.ts +1 -7
  181. package/lib/mjs/formio.form.js +2 -32
  182. package/lib/mjs/index.d.ts +2 -1
  183. package/lib/mjs/index.js +1 -1
  184. package/lib/mjs/providers/Providers.d.ts +0 -4
  185. package/lib/mjs/providers/storage/azure.d.ts +0 -2
  186. package/lib/mjs/providers/storage/azure.js +1 -6
  187. package/lib/mjs/providers/storage/googleDrive.d.ts +0 -1
  188. package/lib/mjs/providers/storage/googleDrive.js +0 -4
  189. package/lib/mjs/providers/storage/s3.d.ts +0 -1
  190. package/lib/mjs/providers/storage/s3.js +0 -4
  191. package/lib/mjs/translations/en.d.ts +5 -0
  192. package/lib/mjs/translations/en.js +5 -0
  193. package/lib/mjs/utils/formUtils.js +1 -0
  194. package/lib/mjs/utils/utils.d.ts +2 -1
  195. package/lib/mjs/utils/utils.js +24 -7
  196. package/package.json +6 -6
  197. package/lib/cjs/components/tree/Node.d.ts +0 -55
  198. package/lib/cjs/components/tree/Node.js +0 -185
  199. package/lib/cjs/components/tree/Tree.d.ts +0 -48
  200. package/lib/cjs/components/tree/Tree.form.d.ts +0 -3
  201. package/lib/cjs/components/tree/Tree.form.js +0 -21
  202. package/lib/cjs/components/tree/Tree.js +0 -383
  203. package/lib/cjs/components/tree/editForm/Tree.edit.data.d.ts +0 -5
  204. package/lib/cjs/components/tree/editForm/Tree.edit.data.js +0 -9
  205. package/lib/cjs/components/tree/editForm/Tree.edit.display.d.ts +0 -9
  206. package/lib/cjs/components/tree/editForm/Tree.edit.display.js +0 -12
  207. package/lib/cjs/components/tree/fixtures/comp1.d.ts +0 -23
  208. package/lib/cjs/components/tree/fixtures/comp1.js +0 -24
  209. package/lib/cjs/components/tree/fixtures/comp2.d.ts +0 -116
  210. package/lib/cjs/components/tree/fixtures/comp2.js +0 -82
  211. package/lib/cjs/components/tree/fixtures/comp3.d.ts +0 -24
  212. package/lib/cjs/components/tree/fixtures/comp3.js +0 -25
  213. package/lib/cjs/components/tree/fixtures/comp4.d.ts +0 -42
  214. package/lib/cjs/components/tree/fixtures/comp4.js +0 -47
  215. package/lib/cjs/components/tree/fixtures/index.d.ts +0 -5
  216. package/lib/cjs/components/tree/fixtures/index.js +0 -14
  217. package/lib/cjs/validator/Rules.d.ts +0 -53
  218. package/lib/cjs/validator/Rules.js +0 -22
  219. package/lib/cjs/validator/Validator.d.ts +0 -228
  220. package/lib/cjs/validator/Validator.js +0 -1113
  221. package/lib/cjs/validator/conjunctions/index.d.ts +0 -7
  222. package/lib/cjs/validator/conjunctions/index.js +0 -18
  223. package/lib/cjs/validator/operators/index.d.ts +0 -7
  224. package/lib/cjs/validator/operators/index.js +0 -18
  225. package/lib/cjs/validator/quickRules/index.d.ts +0 -7
  226. package/lib/cjs/validator/quickRules/index.js +0 -18
  227. package/lib/cjs/validator/rules/Custom.d.ts +0 -5
  228. package/lib/cjs/validator/rules/Custom.js +0 -30
  229. package/lib/cjs/validator/rules/Date.d.ts +0 -5
  230. package/lib/cjs/validator/rules/Date.js +0 -25
  231. package/lib/cjs/validator/rules/Day.d.ts +0 -5
  232. package/lib/cjs/validator/rules/Day.js +0 -58
  233. package/lib/cjs/validator/rules/Email.d.ts +0 -5
  234. package/lib/cjs/validator/rules/Email.js +0 -24
  235. package/lib/cjs/validator/rules/JSON.d.ts +0 -5
  236. package/lib/cjs/validator/rules/JSON.js +0 -29
  237. package/lib/cjs/validator/rules/Mask.d.ts +0 -5
  238. package/lib/cjs/validator/rules/Mask.js +0 -32
  239. package/lib/cjs/validator/rules/Max.d.ts +0 -5
  240. package/lib/cjs/validator/rules/Max.js +0 -21
  241. package/lib/cjs/validator/rules/MaxDate.d.ts +0 -5
  242. package/lib/cjs/validator/rules/MaxDate.js +0 -34
  243. package/lib/cjs/validator/rules/MaxLength.d.ts +0 -5
  244. package/lib/cjs/validator/rules/MaxLength.js +0 -20
  245. package/lib/cjs/validator/rules/MaxWords.d.ts +0 -5
  246. package/lib/cjs/validator/rules/MaxWords.js +0 -20
  247. package/lib/cjs/validator/rules/MaxYear.d.ts +0 -5
  248. package/lib/cjs/validator/rules/MaxYear.js +0 -22
  249. package/lib/cjs/validator/rules/Min.d.ts +0 -5
  250. package/lib/cjs/validator/rules/Min.js +0 -21
  251. package/lib/cjs/validator/rules/MinDate.d.ts +0 -5
  252. package/lib/cjs/validator/rules/MinDate.js +0 -30
  253. package/lib/cjs/validator/rules/MinLength.d.ts +0 -5
  254. package/lib/cjs/validator/rules/MinLength.js +0 -20
  255. package/lib/cjs/validator/rules/MinWords.d.ts +0 -5
  256. package/lib/cjs/validator/rules/MinWords.js +0 -20
  257. package/lib/cjs/validator/rules/MinYear.d.ts +0 -5
  258. package/lib/cjs/validator/rules/MinYear.js +0 -22
  259. package/lib/cjs/validator/rules/Pattern.d.ts +0 -5
  260. package/lib/cjs/validator/rules/Pattern.js +0 -20
  261. package/lib/cjs/validator/rules/Required.d.ts +0 -5
  262. package/lib/cjs/validator/rules/Required.js +0 -17
  263. package/lib/cjs/validator/rules/Rule.d.ts +0 -7
  264. package/lib/cjs/validator/rules/Rule.js +0 -12
  265. package/lib/cjs/validator/rules/Select.d.ts +0 -5
  266. package/lib/cjs/validator/rules/Select.js +0 -95
  267. package/lib/cjs/validator/rules/Time.d.ts +0 -5
  268. package/lib/cjs/validator/rules/Time.js +0 -19
  269. package/lib/cjs/validator/rules/Unique.d.ts +0 -5
  270. package/lib/cjs/validator/rules/Unique.js +0 -69
  271. package/lib/cjs/validator/rules/Url.d.ts +0 -5
  272. package/lib/cjs/validator/rules/Url.js +0 -23
  273. package/lib/cjs/validator/rules/index.d.ts +0 -47
  274. package/lib/cjs/validator/rules/index.js +0 -51
  275. package/lib/cjs/validator/transformers/index.d.ts +0 -7
  276. package/lib/cjs/validator/transformers/index.js +0 -18
  277. package/lib/cjs/validator/valueSources/index.d.ts +0 -7
  278. package/lib/cjs/validator/valueSources/index.js +0 -18
  279. package/lib/mjs/components/tree/Node.d.ts +0 -55
  280. package/lib/mjs/components/tree/Node.js +0 -179
  281. package/lib/mjs/components/tree/Tree.d.ts +0 -48
  282. package/lib/mjs/components/tree/Tree.form.d.ts +0 -3
  283. package/lib/mjs/components/tree/Tree.form.js +0 -15
  284. package/lib/mjs/components/tree/Tree.js +0 -384
  285. package/lib/mjs/components/tree/editForm/Tree.edit.data.d.ts +0 -5
  286. package/lib/mjs/components/tree/editForm/Tree.edit.data.js +0 -7
  287. package/lib/mjs/components/tree/editForm/Tree.edit.display.d.ts +0 -9
  288. package/lib/mjs/components/tree/editForm/Tree.edit.display.js +0 -10
  289. package/lib/mjs/components/tree/fixtures/comp1.d.ts +0 -23
  290. package/lib/mjs/components/tree/fixtures/comp1.js +0 -22
  291. package/lib/mjs/components/tree/fixtures/comp2.d.ts +0 -116
  292. package/lib/mjs/components/tree/fixtures/comp2.js +0 -80
  293. package/lib/mjs/components/tree/fixtures/comp3.d.ts +0 -24
  294. package/lib/mjs/components/tree/fixtures/comp3.js +0 -23
  295. package/lib/mjs/components/tree/fixtures/comp4.d.ts +0 -42
  296. package/lib/mjs/components/tree/fixtures/comp4.js +0 -45
  297. package/lib/mjs/components/tree/fixtures/index.d.ts +0 -5
  298. package/lib/mjs/components/tree/fixtures/index.js +0 -5
  299. package/lib/mjs/validator/Rules.d.ts +0 -53
  300. package/lib/mjs/validator/Rules.js +0 -17
  301. package/lib/mjs/validator/Validator.d.ts +0 -228
  302. package/lib/mjs/validator/Validator.js +0 -1103
  303. package/lib/mjs/validator/conjunctions/index.d.ts +0 -7
  304. package/lib/mjs/validator/conjunctions/index.js +0 -16
  305. package/lib/mjs/validator/operators/index.d.ts +0 -7
  306. package/lib/mjs/validator/operators/index.js +0 -16
  307. package/lib/mjs/validator/quickRules/index.d.ts +0 -7
  308. package/lib/mjs/validator/quickRules/index.js +0 -16
  309. package/lib/mjs/validator/rules/Custom.d.ts +0 -5
  310. package/lib/mjs/validator/rules/Custom.js +0 -21
  311. package/lib/mjs/validator/rules/Date.d.ts +0 -5
  312. package/lib/mjs/validator/rules/Date.js +0 -16
  313. package/lib/mjs/validator/rules/Day.d.ts +0 -5
  314. package/lib/mjs/validator/rules/Day.js +0 -49
  315. package/lib/mjs/validator/rules/Email.d.ts +0 -5
  316. package/lib/mjs/validator/rules/Email.js +0 -15
  317. package/lib/mjs/validator/rules/JSON.d.ts +0 -5
  318. package/lib/mjs/validator/rules/JSON.js +0 -20
  319. package/lib/mjs/validator/rules/Mask.d.ts +0 -5
  320. package/lib/mjs/validator/rules/Mask.js +0 -23
  321. package/lib/mjs/validator/rules/Max.d.ts +0 -5
  322. package/lib/mjs/validator/rules/Max.js +0 -12
  323. package/lib/mjs/validator/rules/MaxDate.d.ts +0 -5
  324. package/lib/mjs/validator/rules/MaxDate.js +0 -25
  325. package/lib/mjs/validator/rules/MaxLength.d.ts +0 -5
  326. package/lib/mjs/validator/rules/MaxLength.js +0 -11
  327. package/lib/mjs/validator/rules/MaxWords.d.ts +0 -5
  328. package/lib/mjs/validator/rules/MaxWords.js +0 -11
  329. package/lib/mjs/validator/rules/MaxYear.d.ts +0 -5
  330. package/lib/mjs/validator/rules/MaxYear.js +0 -13
  331. package/lib/mjs/validator/rules/Min.d.ts +0 -5
  332. package/lib/mjs/validator/rules/Min.js +0 -12
  333. package/lib/mjs/validator/rules/MinDate.d.ts +0 -5
  334. package/lib/mjs/validator/rules/MinDate.js +0 -21
  335. package/lib/mjs/validator/rules/MinLength.d.ts +0 -5
  336. package/lib/mjs/validator/rules/MinLength.js +0 -11
  337. package/lib/mjs/validator/rules/MinWords.d.ts +0 -5
  338. package/lib/mjs/validator/rules/MinWords.js +0 -11
  339. package/lib/mjs/validator/rules/MinYear.d.ts +0 -5
  340. package/lib/mjs/validator/rules/MinYear.js +0 -13
  341. package/lib/mjs/validator/rules/Pattern.d.ts +0 -5
  342. package/lib/mjs/validator/rules/Pattern.js +0 -11
  343. package/lib/mjs/validator/rules/Required.d.ts +0 -5
  344. package/lib/mjs/validator/rules/Required.js +0 -8
  345. package/lib/mjs/validator/rules/Rule.d.ts +0 -7
  346. package/lib/mjs/validator/rules/Rule.js +0 -9
  347. package/lib/mjs/validator/rules/Select.d.ts +0 -5
  348. package/lib/mjs/validator/rules/Select.js +0 -86
  349. package/lib/mjs/validator/rules/Time.d.ts +0 -5
  350. package/lib/mjs/validator/rules/Time.js +0 -10
  351. package/lib/mjs/validator/rules/Unique.d.ts +0 -5
  352. package/lib/mjs/validator/rules/Unique.js +0 -60
  353. package/lib/mjs/validator/rules/Url.d.ts +0 -5
  354. package/lib/mjs/validator/rules/Url.js +0 -14
  355. package/lib/mjs/validator/rules/index.d.ts +0 -47
  356. package/lib/mjs/validator/rules/index.js +0 -46
  357. package/lib/mjs/validator/transformers/index.d.ts +0 -7
  358. package/lib/mjs/validator/transformers/index.js +0 -16
  359. package/lib/mjs/validator/valueSources/index.d.ts +0 -7
  360. package/lib/mjs/validator/valueSources/index.js +0 -16
@@ -8,16 +8,10 @@ export function useModule(defaultFn?: null): (plugins: any, options?: {}) => voi
8
8
  import Components from './components/Components';
9
9
  import Displays from './displays/Displays';
10
10
  import Providers from './providers';
11
- import Rules from './validator/Rules';
12
11
  import Widgets from './widgets';
13
12
  import Templates from './templates/Templates';
14
- import Conjunctions from './validator/conjunctions';
15
- import Operators from './validator/operators';
16
- import QuickRules from './validator/quickRules';
17
- import Transformers from './validator/transformers';
18
- import ValueSources from './validator/valueSources';
19
13
  import Utils from './utils';
20
14
  import Form from './Form';
21
15
  import { Formio } from './Formio';
22
16
  import Licenses from './licenses';
23
- export { Components, Displays, Providers, Rules, Widgets, Templates, Conjunctions, Operators, QuickRules, Transformers, ValueSources, Utils, Form, Formio, Licenses };
17
+ export { Components, Displays, Providers, Widgets, Templates, Utils, Form, Formio, Licenses };
@@ -5,12 +5,6 @@ import Components from './components/Components';
5
5
  import Displays from './displays/Displays';
6
6
  import Templates from './templates/Templates';
7
7
  import Providers from './providers';
8
- import Rules from './validator/Rules';
9
- import Conjunctions from './validator/conjunctions';
10
- import Operators from './validator/operators';
11
- import QuickRules from './validator/quickRules';
12
- import Transformers from './validator/transformers';
13
- import ValueSources from './validator/valueSources';
14
8
  import Widgets from './widgets';
15
9
  import Form from './Form';
16
10
  import Utils from './utils';
@@ -29,14 +23,8 @@ Formio.Utils = Utils;
29
23
  Formio.Form = Form;
30
24
  Formio.Displays = Displays;
31
25
  Formio.Providers = Providers;
32
- Formio.Rules = Rules;
33
26
  Formio.Widgets = Widgets;
34
27
  Formio.Evaluator = Evaluator;
35
- Formio.Conjunctions = Conjunctions;
36
- Formio.Operators = Operators;
37
- Formio.QuickRules = QuickRules;
38
- Formio.Transformers = Transformers;
39
- Formio.ValueSources = ValueSources;
40
28
  Formio.AllComponents = AllComponents;
41
29
  Formio.Licenses = Licenses;
42
30
  // This is strange, but is needed for "premium" components to import correctly.
@@ -85,30 +73,12 @@ export function registerModule(mod, defaultFn = null, options = {}) {
85
73
  case 'displays':
86
74
  Formio.Displays.addDisplays(mod.displays);
87
75
  break;
88
- case 'rules':
89
- Formio.Rules.addRules(mod.rules);
90
- break;
91
76
  case 'evaluator':
92
77
  Formio.Evaluator.registerEvaluator(mod.evaluator);
93
78
  break;
94
- case 'conjunctions':
95
- Formio.Conjunctions.addConjunctions(mod.conjunctions);
96
- break;
97
- case 'operators':
98
- Formio.Operators.addOperators(mod.operators);
99
- break;
100
- case 'quickRules':
101
- Formio.QuickRules.addQuickRules(mod.quickRules);
102
- break;
103
- case 'transformers':
104
- Formio.Transformers.addTransformers(mod.transformers);
105
- break;
106
- case 'valueSources':
107
- Formio.ValueSources.addValueSources(mod.valueSources);
108
- break;
109
79
  case 'library':
110
80
  options.license
111
- ? Formio.Licenses.addLicense(mod.library, mod.license)
81
+ ? Formio.Licenses.addLicense(mod.library, options.license)
112
82
  : Formio.Licenses.removeLicense(mod.library);
113
83
  break;
114
84
  default:
@@ -143,4 +113,4 @@ export function useModule(defaultFn = null) {
143
113
  */
144
114
  Formio.use = useModule();
145
115
  // Export the components.
146
- export { Components, Displays, Providers, Rules, Widgets, Templates, Conjunctions, Operators, QuickRules, Transformers, ValueSources, Utils, Form, Formio, Licenses };
116
+ export { Components, Displays, Providers, Widgets, Templates, Utils, Form, Formio, Licenses };
@@ -1,4 +1,5 @@
1
1
  export * from "./formio.form";
2
2
  import FormBuilder from './FormBuilder';
3
3
  import Builders from './builders/Builders';
4
- export { FormBuilder, Builders };
4
+ import { Formio } from './formio.form';
5
+ export { FormBuilder, Builders, Formio };
package/lib/mjs/index.js CHANGED
@@ -10,4 +10,4 @@ Formio.use = useModule((key, mod) => {
10
10
  return false;
11
11
  });
12
12
  export * from './formio.form';
13
- export { FormBuilder, Builders };
13
+ export { FormBuilder, Builders, Formio };
@@ -27,7 +27,6 @@ export default class Providers {
27
27
  type: any;
28
28
  }>;
29
29
  downloadFile(file: any): any;
30
- deleteFile(fileInfo: any): any;
31
30
  };
32
31
  title: string;
33
32
  };
@@ -50,10 +49,8 @@ export default class Providers {
50
49
  type: any;
51
50
  groupPermissions: any;
52
51
  groupId: any;
53
- key: any;
54
52
  }>;
55
53
  downloadFile(file: any): any;
56
- deleteFile: (fileInfo: any) => any;
57
54
  };
58
55
  title: string;
59
56
  };
@@ -71,7 +68,6 @@ export default class Providers {
71
68
  (formio: any): {
72
69
  uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any): Promise<any>;
73
70
  downloadFile(file: any): Promise<any>;
74
- deleteFile: (fileInfo: any) => any;
75
71
  };
76
72
  title: string;
77
73
  };
@@ -7,10 +7,8 @@ declare function azure(formio: any): {
7
7
  type: any;
8
8
  groupPermissions: any;
9
9
  groupId: any;
10
- key: any;
11
10
  }>;
12
11
  downloadFile(file: any): any;
13
- deleteFile: (fileInfo: any) => any;
14
12
  };
15
13
  declare namespace azure {
16
14
  const title: string;
@@ -6,7 +6,7 @@ const azure = (formio) => ({
6
6
  xhr.setRequestHeader('Content-Type', file.type);
7
7
  xhr.setRequestHeader('x-ms-blob-type', 'BlockBlob');
8
8
  return file;
9
- }, file, fileName, dir, progressCallback, groupPermissions, groupId, abortCallback).then((response) => {
9
+ }, file, fileName, dir, progressCallback, groupPermissions, groupId, abortCallback).then(() => {
10
10
  return {
11
11
  storage: 'azure',
12
12
  name: XHR.path([dir, fileName]),
@@ -14,16 +14,11 @@ const azure = (formio) => ({
14
14
  type: file.type,
15
15
  groupPermissions,
16
16
  groupId,
17
- key: response.pathFile
18
17
  };
19
18
  });
20
19
  },
21
20
  downloadFile(file) {
22
21
  return formio.makeRequest('file', `${formio.formUrl}/storage/azure?name=${XHR.trim(file.name)}`, 'GET');
23
- },
24
- deleteFile: function deleteFile(fileInfo) {
25
- var url = `${formio.formUrl}/storage/azure?name=${XHR.trim(fileInfo.name)}&key=${XHR.trim(fileInfo.key)}`;
26
- return formio.makeRequest('', url, 'delete');
27
22
  }
28
23
  });
29
24
  azure.title = 'Azure File Services';
@@ -2,7 +2,6 @@ export default googledrive;
2
2
  declare function googledrive(formio: any): {
3
3
  uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any): Promise<any>;
4
4
  downloadFile(file: any): Promise<any>;
5
- deleteFile: (fileInfo: any) => any;
6
5
  };
7
6
  declare namespace googledrive {
8
7
  const title: string;
@@ -48,10 +48,6 @@ const googledrive = (formio) => ({
48
48
  file.url =
49
49
  `${formio.formUrl}/storage/gdrive?fileId=${file.id}&fileName=${file.originalName}${token ? `&x-jwt-token=${token}` : ''}`;
50
50
  return Promise.resolve(file);
51
- },
52
- deleteFile: function deleteFile(fileInfo) {
53
- var url = ''.concat(formio.formUrl, `/storage/gdrive?id=${fileInfo.id}&name=${fileInfo.originalName}`);
54
- return formio.makeRequest('', url, 'delete');
55
51
  }
56
52
  });
57
53
  googledrive.title = 'Google Drive';
@@ -11,7 +11,6 @@ declare function s3(formio: any): {
11
11
  type: any;
12
12
  }>;
13
13
  downloadFile(file: any): any;
14
- deleteFile(fileInfo: any): any;
15
14
  };
16
15
  declare namespace s3 {
17
16
  const title: string;
@@ -38,10 +38,6 @@ const s3 = (formio) => ({
38
38
  else {
39
39
  return Promise.resolve(file);
40
40
  }
41
- },
42
- deleteFile(fileInfo) {
43
- const url = `${formio.formUrl}/file/${XHR.trim(fileInfo.name)}?bucket=${XHR.trim(fileInfo.bucket)}&key=${XHR.trim(fileInfo.key)}`;
44
- return formio.makeRequest('', url, 'delete');
45
41
  }
46
42
  });
47
43
  s3.title = 'S3';
@@ -2,6 +2,8 @@ declare namespace _default {
2
2
  const unsavedRowsError: string;
3
3
  const invalidRowsError: string;
4
4
  const invalidRowError: string;
5
+ const invalidOption: string;
6
+ const invalidDay: string;
5
7
  const alertMessageWithLabel: string;
6
8
  const alertMessage: string;
7
9
  const complete: string;
@@ -26,11 +28,14 @@ declare namespace _default {
26
28
  const minDate: string;
27
29
  const maxYear: string;
28
30
  const minYear: string;
31
+ const minSelectedCount: string;
32
+ const maxSelectedCount: string;
29
33
  const invalid_email: string;
30
34
  const invalid_url: string;
31
35
  const invalid_regex: string;
32
36
  const invalid_date: string;
33
37
  const invalid_day: string;
38
+ const invalidValueProperty: string;
34
39
  const mask: string;
35
40
  const valueIsNotAvailable: string;
36
41
  const stripe: string;
@@ -2,6 +2,8 @@ export default {
2
2
  unsavedRowsError: 'Please save all rows before proceeding.',
3
3
  invalidRowsError: 'Please correct invalid rows before proceeding.',
4
4
  invalidRowError: 'Invalid row. Please correct it or delete.',
5
+ invalidOption: '{{field}} is an invalid value.',
6
+ invalidDay: '{{field}} is not a valid day.',
5
7
  alertMessageWithLabel: '{{label}}: {{message}}',
6
8
  alertMessage: '{{message}}',
7
9
  complete: 'Submission Complete',
@@ -26,11 +28,14 @@ export default {
26
28
  minDate: '{{field}} should not contain date before {{- minDate}}',
27
29
  maxYear: '{{field}} should not contain year greater than {{maxYear}}',
28
30
  minYear: '{{field}} should not contain year less than {{minYear}}',
31
+ minSelectedCount: 'You must select at least {{minCount}} items',
32
+ maxSelectedCount: 'You may only select up to {{maxCount}} items',
29
33
  invalid_email: '{{field}} must be a valid email.',
30
34
  invalid_url: '{{field}} must be a valid url.',
31
35
  invalid_regex: '{{field}} does not match the pattern {{regex}}.',
32
36
  invalid_date: '{{field}} is not a valid date.',
33
37
  invalid_day: '{{field}} is not a valid day.',
38
+ invalidValueProperty: 'Invalid Value Property',
34
39
  mask: '{{field}} does not match the mask.',
35
40
  valueIsNotAvailable: '{{ field }} is an invalid value.',
36
41
  stripe: '{{stripe}}',
@@ -12,6 +12,7 @@ import chunk from 'lodash/chunk';
12
12
  import pad from 'lodash/pad';
13
13
  import { compare, applyPatch } from 'fast-json-patch';
14
14
  import _ from 'lodash';
15
+ import { fastCloneDeep } from './utils';
15
16
  /**
16
17
  * Determine if a component is a layout component or not.
17
18
  *
@@ -306,7 +306,7 @@ export function sanitize(string: any, options: any): any;
306
306
  export function fastCloneDeep(obj: any): any;
307
307
  export function isInputComponent(componentJson: any): any;
308
308
  export function getArrayFromComponentPath(pathStr: any): any;
309
- export function hasInvalidComponent(component: any): any;
309
+ export function isChildOf(child: any, parent: any): boolean;
310
310
  export function getStringFromComponentPath(path: any): any;
311
311
  export function round(number: any, precision: any): any;
312
312
  /**
@@ -367,6 +367,7 @@ export namespace componentValueTypes {
367
367
  const date: string;
368
368
  const any: string;
369
369
  }
370
+ export function interpolateErrors(component: any, errors: FieldError[], interpolateFn: any): [];
370
371
  import jsonLogic from 'json-logic-js';
371
372
  import ConditionOperators from './conditionOperators';
372
373
  import Evaluator from './Evaluator';
@@ -715,8 +715,10 @@ export function convertFormatToMask(format) {
715
715
  .replace(/M{3}/g, '***')
716
716
  // Short month conversion if input as text.
717
717
  .replace(/e/g, 'Q')
718
+ // Month number conversion.
719
+ .replace(/W/g, '99')
718
720
  // Year conversion.
719
- .replace(/[ydhmsHMG]/g, '9')
721
+ .replace(/[ydhmswHMG]/g, '9')
720
722
  // AM/PM conversion.
721
723
  .replace(/a/g, 'AA');
722
724
  }
@@ -1207,13 +1209,14 @@ export function getArrayFromComponentPath(pathStr) {
1207
1209
  .split('.')
1208
1210
  .map(part => _.defaultTo(_.toNumber(part), part));
1209
1211
  }
1210
- export function hasInvalidComponent(component) {
1211
- return component.getComponents().some((comp) => {
1212
- if (_.isArray(comp.components)) {
1213
- return hasInvalidComponent(comp);
1212
+ export function isChildOf(child, parent) {
1213
+ while (child && child.parent) {
1214
+ if (child.parent === parent) {
1215
+ return true;
1214
1216
  }
1215
- return comp.error;
1216
- });
1217
+ child = child.parent;
1218
+ }
1219
+ return false;
1217
1220
  }
1218
1221
  export function getStringFromComponentPath(path) {
1219
1222
  if (!_.isArray(path)) {
@@ -1384,3 +1387,17 @@ export function getComponentSavedTypes(fullSchema) {
1384
1387
  }
1385
1388
  return null;
1386
1389
  }
1390
+ /**
1391
+ * Interpolates @formio/core errors so that they are compatible with the renderer
1392
+ * @param {FieldError[]} errors
1393
+ * @param firstPass
1394
+ * @returns {[]}
1395
+ */
1396
+ export const interpolateErrors = (component, errors, interpolateFn) => {
1397
+ return errors.map((error) => {
1398
+ error.component = component;
1399
+ const { errorKeyOrMessage, context } = error;
1400
+ const toInterpolate = component.errors && component.errors[errorKeyOrMessage] ? component.errors[errorKeyOrMessage] : errorKeyOrMessage;
1401
+ return { ...error, message: unescapeHTML(interpolateFn(toInterpolate, context)), context: { ...context } };
1402
+ });
1403
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-rc.26",
3
+ "version": "5.0.0-rc.28",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -47,7 +47,7 @@
47
47
  "build-app:create-app": "node -e 'var fs=require(`fs`);fs.writeFileSync(`./_config.app.yml`, `baseurl: /` + require(`./package.json`).version + `/`);'",
48
48
  "build-app:remove-app": "rm ./_config.app.yml",
49
49
  "build-app:jekyll": "jekyll build --config _config.yml,_config.app.yml",
50
- "gh-pages": "npm run build && jekyll build --config _config.yml && cd _site && git init && git remote add origin git@github.com:formio/formio.js.git && git checkout -b gh-pages && git add . && git commit -m \"Deploy to GitHub Pages\" && git push origin gh-pages --force && cd ..",
50
+ "gh-pages": "rm -rf _site && npm run build && jekyll build --config _config.yml && cd _site && git init && git remote add origin git@github.com:formio/formio.js.git && git checkout -b gh-pages && git add . && git commit -m \"Deploy to GitHub Pages\" && git push origin gh-pages --force && cd ..",
51
51
  "deploy-s3": "$(node -e 'process.stdout.write(`aws s3 cp _site s3://formiojs.test-form.io/` + require(`./package.json`).version + `/ --recursive`)')",
52
52
  "invalidate": "VERSION=$(yarn version);aws cloudfront create-invalidation --distribution-id E1MXNA5A4ZKRMZ --paths \"/$VERSION/*\"",
53
53
  "release": "yarn build-app && yarn deploy-s3",
@@ -80,7 +80,7 @@
80
80
  "dependencies": {
81
81
  "@formio/bootstrap": "^3.0.0-rc.13",
82
82
  "@formio/choices.js": "^10.2.0",
83
- "@formio/core": "1.3.0-rc.16",
83
+ "@formio/core": "^1.3.0-rc.19",
84
84
  "@formio/text-mask-addons": "^3.8.0-formio.2",
85
85
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
86
86
  "autocompleter": "^8.0.4",
@@ -88,10 +88,10 @@
88
88
  "browser-cookies": "^1.2.0",
89
89
  "browser-md5-file": "^1.1.1",
90
90
  "compare-versions": "^6.0.0-rc.2",
91
- "core-js": "^3.31.0",
91
+ "core-js": "^3.32.1",
92
92
  "dialog-polyfill": "^0.5.6",
93
93
  "dom-autoscroller": "^2.3.4",
94
- "dompurify": "^3.0.3",
94
+ "dompurify": "^3.0.5",
95
95
  "downloadjs": "^1.4.7",
96
96
  "dragula": "^3.7.3",
97
97
  "eventemitter3": "^5.0.1",
@@ -111,7 +111,7 @@
111
111
  "string-hash": "^1.1.3",
112
112
  "tippy.js": "^6.3.7",
113
113
  "uuid": "^9.0.0",
114
- "vanilla-picker": "^2.12.1"
114
+ "vanilla-picker": "^2.12.2"
115
115
  },
116
116
  "devDependencies": {
117
117
  "@typescript-eslint/eslint-plugin": "^5.60.1",
@@ -1,55 +0,0 @@
1
- export default class Node {
2
- constructor(parent: any, { data, children, }?: {
3
- data?: {} | undefined;
4
- children?: any[] | undefined;
5
- }, { checkNode, createComponents, isNew, removeComponents, parentPath }?: {
6
- checkNode: any;
7
- createComponents: any;
8
- isNew?: boolean | undefined;
9
- removeComponents: any;
10
- parentPath?: string | undefined;
11
- });
12
- parent: any;
13
- previousData: {};
14
- persistentData: any;
15
- new: boolean;
16
- createComponents: any;
17
- checkNode: any;
18
- removeComponents: any;
19
- revertAvailable: boolean;
20
- editing: boolean;
21
- collapsed: boolean;
22
- components: any[];
23
- children: Node[];
24
- parentPath: string;
25
- get value(): any;
26
- get isRoot(): boolean;
27
- get changing(): boolean;
28
- get hasChangingChildren(): any;
29
- get hasData(): boolean;
30
- get hasChildren(): boolean;
31
- getChildrenPath(index: any): string;
32
- eachChild(iteratee: any): Node;
33
- getComponents(): any;
34
- validateNode(): boolean;
35
- addChild(): Node | null;
36
- removeChild(childToRemove: any): Node;
37
- edit(): Node;
38
- save(): boolean;
39
- cancel(): Node;
40
- remove(): Node;
41
- revert(): Node;
42
- data: any;
43
- commitData(): Node;
44
- resetData(): Node;
45
- updateComponentsContext(): Node;
46
- instantiateComponents(): void;
47
- clearComponents(): void;
48
- /**
49
- * Return a path of component's value.
50
- *
51
- * @param {Object} component - The component instance.
52
- * @return {string} - The component's value path.
53
- */
54
- calculateComponentPath(component: Object): string;
55
- }
@@ -1,185 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const lodash_1 = __importDefault(require("lodash"));
7
- class Node {
8
- constructor(parent, { data = {}, children = [], } = {}, { checkNode, createComponents, isNew = true, removeComponents, parentPath = '' } = {}) {
9
- this.parent = parent;
10
- this.previousData = {};
11
- this.persistentData = lodash_1.default.cloneDeep(data);
12
- this.new = isNew;
13
- this.createComponents = createComponents;
14
- this.checkNode = checkNode;
15
- this.removeComponents = removeComponents;
16
- this.revertAvailable = false;
17
- this.editing = false;
18
- this.collapsed = false;
19
- this.components = [];
20
- this.children = [];
21
- this.parentPath = parentPath;
22
- this.resetData();
23
- this.children = children.map((child, index) => new Node(this, child, {
24
- checkNode,
25
- createComponents,
26
- isNew: false,
27
- removeComponents,
28
- parentPath: this.getChildrenPath(index),
29
- }));
30
- }
31
- get value() {
32
- return this.new
33
- ? null // Check the special case for empty root node.
34
- : {
35
- data: lodash_1.default.cloneDeep(this.persistentData),
36
- children: this.children.filter((child) => !child.new).map((child) => child.value),
37
- };
38
- }
39
- get isRoot() {
40
- return this.parent === null;
41
- }
42
- get changing() {
43
- return this.new || this.editing;
44
- }
45
- get hasChangingChildren() {
46
- return this.changin || this.children.some((child) => child.hasChangingChildren);
47
- }
48
- get hasData() {
49
- return !lodash_1.default.isEmpty(this.persistentData);
50
- }
51
- get hasChildren() {
52
- return Array.isArray(this.children) && this.children.length > 0;
53
- }
54
- getChildrenPath(index) {
55
- return this.parentPath ? `${this.parentPath}.children[${index}]` : '';
56
- }
57
- eachChild(iteratee) {
58
- iteratee(this);
59
- this.children.forEach((child) => child.eachChild(iteratee));
60
- return this;
61
- }
62
- getComponents() {
63
- return this.children.reduce((components, child) => components.concat(child.getComponents()), this.components);
64
- }
65
- validateNode() {
66
- let valid = true;
67
- this.getComponents().forEach(comp => {
68
- comp.setPristine(false);
69
- valid &= comp.checkValidity(null, false, this.persistentData);
70
- });
71
- return valid;
72
- }
73
- addChild() {
74
- if (this.new) {
75
- return null;
76
- }
77
- const child = new Node(this, {}, {
78
- checkNode: this.checkNode,
79
- createComponents: this.createComponents,
80
- isNew: true,
81
- removeComponents: this.removeComponents,
82
- parentPath: this.getChildrenPath(this.children.length),
83
- });
84
- this.children = this.children.concat(child);
85
- return child;
86
- }
87
- removeChild(childToRemove) {
88
- if (!this.new) {
89
- this.children = this.children.filter((child) => child !== childToRemove);
90
- }
91
- return this;
92
- }
93
- edit() {
94
- if (this.new) {
95
- return this;
96
- }
97
- this.editing = true;
98
- return this.resetData();
99
- }
100
- save() {
101
- const isValid = this.validateNode();
102
- if (this.changing && isValid) {
103
- if (this.new) {
104
- this.new = false;
105
- }
106
- else {
107
- this.editing = false;
108
- this.revertAvailable = true;
109
- }
110
- this.commitData();
111
- }
112
- return isValid;
113
- }
114
- cancel() {
115
- if (this.new) {
116
- this.remove();
117
- }
118
- else if (this.editing) {
119
- this.editing = false;
120
- this.resetData();
121
- }
122
- return this;
123
- }
124
- remove() {
125
- this.parent.removeChild(this);
126
- this.parent = null;
127
- this.clearComponents();
128
- return this;
129
- }
130
- revert() {
131
- if (!this.revertAvailable) {
132
- return this;
133
- }
134
- this.data = this.previousData;
135
- return this.commitData();
136
- }
137
- commitData() {
138
- this.previousData = this.persistentData;
139
- this.persistentData = lodash_1.default.cloneDeep(this.data);
140
- this.clearComponents();
141
- return this;
142
- }
143
- resetData() {
144
- this.data = lodash_1.default.cloneDeep(this.persistentData);
145
- this.updateComponentsContext();
146
- return this;
147
- }
148
- updateComponentsContext() {
149
- if (this.changing) {
150
- this.instantiateComponents();
151
- }
152
- else {
153
- this.clearComponents();
154
- }
155
- return this;
156
- }
157
- instantiateComponents() {
158
- this.components = this.createComponents(this.data, this);
159
- this.components.forEach((component) => {
160
- if (this.parentPath) {
161
- const path = this.calculateComponentPath(component);
162
- component.path = path;
163
- }
164
- });
165
- this.checkNode(this);
166
- }
167
- clearComponents() {
168
- this.removeComponents(this.components);
169
- this.components = [];
170
- }
171
- /**
172
- * Return a path of component's value.
173
- *
174
- * @param {Object} component - The component instance.
175
- * @return {string} - The component's value path.
176
- */
177
- calculateComponentPath(component) {
178
- let path = '';
179
- if (component.component.key) {
180
- path = `${this.parentPath}.data.${component.component.key}`;
181
- }
182
- return path;
183
- }
184
- }
185
- exports.default = Node;
@@ -1,48 +0,0 @@
1
- export default class TreeComponent extends NestedDataComponent {
2
- static get builderInfo(): {
3
- title: string;
4
- icon: string;
5
- weight: number;
6
- documentation: string;
7
- showPreview: boolean;
8
- schema: any;
9
- };
10
- constructor(...args: any[]);
11
- get viewComponents(): any;
12
- viewComponentsInstantiated: boolean | undefined;
13
- _viewComponents: any;
14
- componentOptions: {
15
- parent: TreeComponent;
16
- root: Component;
17
- } | undefined;
18
- get isDefaultValueComponent(): boolean;
19
- createComponents(data: any, node: any): any;
20
- removeComponents(components: any, all?: boolean): any;
21
- render(): any;
22
- renderTree(node?: {}, odd?: boolean): any;
23
- renderChildNodes(nodes: any[] | undefined, odd: any): any;
24
- renderEdit(node?: {}): any;
25
- renderView(node?: {}): any;
26
- attach(element: any): Promise<[void, void]> | Promise<[[void, void], void | [void, void]]>;
27
- attachNode(element: any, node: any): Promise<void> | Promise<[void, void]>;
28
- attachActions(node: any): void;
29
- attachComponents(node: any, ...args: any[]): Promise<any>;
30
- attachChildren(node: any): Promise<any>;
31
- addChild(parent: any): void;
32
- cancelNode(node: any): void;
33
- editNode(node: any): void;
34
- removeNode(node: any): void;
35
- revertNode(node: any): void;
36
- saveNode(node: any): void;
37
- toggleNode(node: any): void;
38
- removeRoot(): void;
39
- setRoot(): void;
40
- treeRoot: Node | undefined;
41
- updateTree(): void;
42
- checkData(data: any, flags: any, row: any): any;
43
- checkNode(data: any, node: any, flags: any, row: any): any;
44
- hasChanged: (newValue: any, oldValue: any) => boolean;
45
- }
46
- import NestedDataComponent from '../_classes/nesteddata/NestedDataComponent';
47
- import Component from '../_classes/component/Component';
48
- import Node from './Node';