@formio/js 5.0.0-rc.19 → 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 +1239 -1097
  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 +1271 -1118
  16. package/dist/formio.full.min.css +1 -1
  17. package/dist/formio.full.min.js +1 -1
  18. package/dist/formio.full.min.js.LICENSE.txt +3 -8
  19. package/dist/formio.js +713 -626
  20. package/dist/formio.min.js +1 -1
  21. package/dist/formio.min.js.LICENSE.txt +2 -7
  22. package/dist/formio.utils.js +220 -13
  23. package/dist/formio.utils.min.js +1 -1
  24. package/dist/formio.utils.min.js.LICENSE.txt +2 -7
  25. package/lib/cjs/CDN.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 +12 -12
  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 +14 -8
  44. package/lib/cjs/components/_classes/component/Component.js +24 -14
  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 +9 -10
  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 +12 -12
  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 +14 -8
  194. package/lib/mjs/components/_classes/component/Component.js +24 -14
  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 +9 -10
  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 +14 -15
@@ -3,7 +3,6 @@ import Component from '../_classes/component/Component';
3
3
  import { Formio } from '../../Formio';
4
4
  import _get from 'lodash/get';
5
5
  import _debounce from 'lodash/debounce';
6
- import NativePromise from 'native-promise-only';
7
6
  export default class ReCaptchaComponent extends Component {
8
7
  static schema(...extend) {
9
8
  return Component.schema({
@@ -61,7 +60,7 @@ export default class ReCaptchaComponent extends Component {
61
60
  this.recaptchaApiReady = Formio.requireLibrary('googleRecaptcha', 'grecaptcha', recaptchaApiScriptUrl, true);
62
61
  }
63
62
  if (this.recaptchaApiReady) {
64
- this.recaptchaVerifiedPromise = new NativePromise((resolve, reject) => {
63
+ this.recaptchaVerifiedPromise = new Promise((resolve, reject) => {
65
64
  this.recaptchaApiReady
66
65
  .then(() => {
67
66
  if (!this.isLoading) {
@@ -117,13 +116,13 @@ export default class ReCaptchaComponent extends Component {
117
116
  const componentData = row[this.component.key];
118
117
  if (!componentData || !componentData.token) {
119
118
  this.setCustomValidity('ReCAPTCHA: Token is not specified in submission');
120
- return NativePromise.resolve(false);
119
+ return Promise.resolve(false);
121
120
  }
122
121
  if (!componentData.success) {
123
122
  this.setCustomValidity('ReCAPTCHA: Token validation error');
124
- return NativePromise.resolve(false);
123
+ return Promise.resolve(false);
125
124
  }
126
- return this.hook('validateReCaptcha', componentData.token, () => NativePromise.resolve(true))
125
+ return this.hook('validateReCaptcha', componentData.token, () => Promise.resolve(true))
127
126
  .then((success) => success)
128
127
  .catch((err) => {
129
128
  this.setCustomValidity(err.message || err);
@@ -1,3 +1,10 @@
1
1
  export default class ResourceComponent extends SelectComponent {
2
+ static get builderInfo(): {
3
+ title: string;
4
+ icon: string;
5
+ weight: number;
6
+ documentation: string;
7
+ schema: any;
8
+ };
2
9
  }
3
10
  import SelectComponent from '../select/Select';
@@ -14,7 +14,6 @@ export default class ResourceComponent extends SelectComponent {
14
14
  static get builderInfo() {
15
15
  return {
16
16
  title: 'Resource',
17
- group: 'premium',
18
17
  icon: 'files-o',
19
18
  weight: 90,
20
19
  documentation: '/userguide/form-building/form-components#resource',
@@ -5,7 +5,7 @@ export default [
5
5
  type: 'htmlelement',
6
6
  tag: 'div',
7
7
  className: 'alert alert-danger',
8
- content: 'The Resource component is deprecated. Use the Select component with data source of "Resource" instead.',
8
+ content: 'This component has been deprecated and will be removed in a future version of Formio.js.',
9
9
  },
10
10
  {
11
11
  type: 'select',
@@ -7,11 +7,15 @@ export default class SelectComponent extends ListComponent {
7
7
  documentation: string;
8
8
  schema: any;
9
9
  };
10
+ static get serverConditionSettings(): {
11
+ valueComponent(classComp: any): any;
12
+ operators: string[];
13
+ };
10
14
  templateData: {} | undefined;
11
15
  triggerUpdate: ((...args: any[]) => any) | undefined;
12
16
  set itemsLoaded(arg: any);
13
17
  get itemsLoaded(): any;
14
- itemsLoadedResolve: any;
18
+ itemsLoadedResolve: ((value: any) => void) | undefined;
15
19
  isFromSearch: boolean | undefined;
16
20
  searchServerCount: any;
17
21
  defaultServerCount: any;
@@ -19,6 +23,7 @@ export default class SelectComponent extends ListComponent {
19
23
  searchDownloadedResources: any;
20
24
  defaultDownloadedResources: any;
21
25
  activated: boolean | undefined;
26
+ get dataReady(): any;
22
27
  get emptyValue(): {};
23
28
  get valueProperty(): any;
24
29
  get inputInfo(): {
@@ -55,11 +60,7 @@ export default class SelectComponent extends ListComponent {
55
60
  set downloadedResources(arg: any);
56
61
  get downloadedResources(): any;
57
62
  getSingleItemValueForHTMLMode(data: any): any;
58
- getTemplateKeys(): void;
59
- templateKeys: any[] | undefined;
60
63
  get loadingError(): boolean | undefined;
61
- get selectData(): any;
62
- get shouldLoad(): any;
63
64
  loadItems(url: any, search: any, headers: any, options: any, method: any, body: any): void;
64
65
  getCustomItems(): any;
65
66
  asyncValues: boolean | undefined;
@@ -79,6 +80,7 @@ export default class SelectComponent extends ListComponent {
79
80
  render(): any;
80
81
  wrapElement(element: any): any;
81
82
  choicesOptions(): any;
83
+ attach(element: any): Promise<void> | undefined;
82
84
  focusableElement: any;
83
85
  choices: Choices | null | undefined;
84
86
  scrollList: any;
@@ -2,7 +2,6 @@ import _ from 'lodash';
2
2
  import { Formio } from '../../Formio';
3
3
  import ListComponent from '../_classes/list/ListComponent';
4
4
  import Form from '../../Form';
5
- import NativePromise from 'native-promise-only';
6
5
  import { getRandomComponentId, boolValue, isPromise } from '../../utils/utils';
7
6
  import Choices from '../../utils/ChoicesWrapper';
8
7
  export default class SelectComponent extends ListComponent {
@@ -54,6 +53,14 @@ export default class SelectComponent extends ListComponent {
54
53
  schema: SelectComponent.schema()
55
54
  };
56
55
  }
56
+ static get serverConditionSettings() {
57
+ return {
58
+ ...super.serverConditionSettings,
59
+ valueComponent(classComp) {
60
+ return { ...classComp, type: 'select' };
61
+ },
62
+ };
63
+ }
57
64
  init() {
58
65
  super.init();
59
66
  this.templateData = {};
@@ -69,7 +76,7 @@ export default class SelectComponent extends ListComponent {
69
76
  if (typeof this.itemsLoadedResolve === 'function') {
70
77
  this.itemsLoadedResolve();
71
78
  }
72
- this.itemsLoaded = new NativePromise((resolve) => {
79
+ this.itemsLoaded = new Promise((resolve) => {
73
80
  this.itemsLoadedResolve = resolve;
74
81
  });
75
82
  if (args.length) {
@@ -89,7 +96,7 @@ export default class SelectComponent extends ListComponent {
89
96
  }
90
97
  // If this component has been activated.//
91
98
  this.activated = false;
92
- this.itemsLoaded = new NativePromise((resolve) => {
99
+ this.itemsLoaded = new Promise((resolve) => {
93
100
  this.itemsLoadedResolve = resolve;
94
101
  });
95
102
  if (this.isHtmlRenderMode()) {
@@ -104,7 +111,7 @@ export default class SelectComponent extends ListComponent {
104
111
  if (this.root &&
105
112
  this.root.submissionSet &&
106
113
  !this.attached) {
107
- return NativePromise.resolve();
114
+ return Promise.resolve();
108
115
  }
109
116
  return this.itemsLoaded;
110
117
  }
@@ -189,7 +196,7 @@ export default class SelectComponent extends ListComponent {
189
196
  const value = (typeof itemLabel === 'string') ? this.t(itemLabel, { _userInput: true }) : itemLabel;
190
197
  return this.sanitize(value, this.shouldSanitizeValue);
191
198
  }
192
- if (this.component.multiple ? this.dataValue.find((val) => value === val) : (this.dataValue === value)) {
199
+ if (this.component.multiple && _.isArray(this.dataValue) ? this.dataValue.find((val) => value === val) : (this.dataValue === value)) {
193
200
  const selectData = this.selectData;
194
201
  if (selectData) {
195
202
  const templateValue = this.component.reference && value?._id ? value._id.toString() : value;
@@ -434,48 +441,9 @@ export default class SelectComponent extends ListComponent {
434
441
  }
435
442
  return defaultValue;
436
443
  }
437
- getTemplateKeys() {
438
- this.templateKeys = [];
439
- if (this.options.readOnly && this.component.template) {
440
- const keys = this.component.template.match(/({{\s*(.*?)\s*}})/g);
441
- if (keys) {
442
- keys.forEach((key) => {
443
- const propKey = key.match(/{{\s*item\.(.*?)\s*}}/);
444
- if (propKey && propKey.length > 1) {
445
- this.templateKeys.push(propKey[1]);
446
- }
447
- });
448
- }
449
- }
450
- }
451
444
  get loadingError() {
452
445
  return !this.component.refreshOn && !this.component.refreshOnBlur && this.networkError;
453
446
  }
454
- get selectData() {
455
- const selectData = _.get(this.root, 'submission.metadata.selectData', {});
456
- return _.get(selectData, this.path);
457
- }
458
- get shouldLoad() {
459
- if (this.loadingError) {
460
- return false;
461
- }
462
- // Live forms should always load.
463
- if (!this.options.readOnly) {
464
- return true;
465
- }
466
- // If there are template keys, then we need to see if we have the data.
467
- if (this.templateKeys && this.templateKeys.length) {
468
- // See if we already have the data we need.
469
- const dataValue = this.dataValue;
470
- const selectData = this.selectData;
471
- return this.templateKeys.reduce((shouldLoad, key) => {
472
- const hasValue = _.has(dataValue, key) || _.has(selectData, key);
473
- return shouldLoad || !hasValue;
474
- }, false);
475
- }
476
- // Return that we should load.
477
- return true;
478
- }
479
447
  loadItems(url, search, headers, options, method, body) {
480
448
  options = options || {};
481
449
  // See if we should load items or not.
@@ -937,7 +905,7 @@ export default class SelectComponent extends ListComponent {
937
905
  const items = this.choices._store.activeItems;
938
906
  if (!items.length) {
939
907
  this.choices._addItem({
940
- value: placeholderValue,
908
+ value: '',
941
909
  label: placeholderValue,
942
910
  choiceId: 0,
943
911
  groupId: -1,
@@ -1107,7 +1075,7 @@ export default class SelectComponent extends ListComponent {
1107
1075
  if (this.component.multiple) {
1108
1076
  templateData = {};
1109
1077
  const dataValue = this.dataValue;
1110
- if (dataValue && dataValue.length) {
1078
+ if (dataValue && _.isArray(dataValue) && dataValue.length) {
1111
1079
  dataValue.forEach((dataValueItem) => {
1112
1080
  const dataValueItemValue = this.component.reference ? dataValueItem._id.toString() : dataValueItem;
1113
1081
  templateData[dataValueItemValue] = this.templateData[dataValueItemValue];
@@ -1175,7 +1143,7 @@ export default class SelectComponent extends ListComponent {
1175
1143
  }
1176
1144
  setValue(value, flags = {}) {
1177
1145
  const previousValue = this.dataValue;
1178
- if (this.component.widget === 'html5' && (_.isEqual(value, previousValue) || _.isEqual(previousValue, {}) && _.isEqual(flags, {}))) {
1146
+ if (this.component.widget === 'html5' && (_.isEqual(value, previousValue) || _.isEqual(previousValue, {}) && _.isEqual(flags, {})) && !flags.fromSubmission) {
1179
1147
  return false;
1180
1148
  }
1181
1149
  const changed = this.updateValue(value, flags);
@@ -1251,7 +1219,8 @@ export default class SelectComponent extends ListComponent {
1251
1219
  else {
1252
1220
  if (hasValue) {
1253
1221
  const values = Array.isArray(value) ? value : [value];
1254
- if (!_.isEqual(this.dataValue, this.defaultValue) && this.selectOptions.length < 2) {
1222
+ if (!_.isEqual(this.dataValue, this.defaultValue) && this.selectOptions.length < 2
1223
+ || (this.selectData && flags.fromSubmission)) {
1255
1224
  const { value, label } = this.selectValueAndLabel(this.dataValue);
1256
1225
  this.addOption(value, label);
1257
1226
  }
@@ -1279,7 +1248,7 @@ export default class SelectComponent extends ListComponent {
1279
1248
  }
1280
1249
  }
1281
1250
  get itemsLoaded() {
1282
- return this._itemsLoaded || NativePromise.resolve();
1251
+ return this._itemsLoaded || Promise.resolve();
1283
1252
  }
1284
1253
  set itemsLoaded(promise) {
1285
1254
  this._itemsLoaded = promise;
@@ -1,4 +1,16 @@
1
1
  export default class SelectBoxesComponent extends RadioComponent {
2
+ static get serverConditionSettings(): {
3
+ valueComponent(classComp: any): {
4
+ type: string;
5
+ dataSrc: string;
6
+ valueProperty: string;
7
+ valueType: string;
8
+ data: {
9
+ custom: string;
10
+ };
11
+ };
12
+ operators: string[];
13
+ };
2
14
  constructor(...args: any[]);
3
15
  validators: string[];
4
16
  get emptyValue(): any;
@@ -19,6 +19,22 @@ export default class SelectBoxesComponent extends RadioComponent {
19
19
  schema: SelectBoxesComponent.schema()
20
20
  };
21
21
  }
22
+ static get serverConditionSettings() {
23
+ return {
24
+ ...super.serverConditionSettings,
25
+ valueComponent(classComp) {
26
+ return {
27
+ type: 'select',
28
+ dataSrc: 'custom',
29
+ valueProperty: 'value',
30
+ valueType: 'string',
31
+ data: {
32
+ custom: `values = ${classComp && classComp.values ? JSON.stringify(classComp.values) : []}`
33
+ },
34
+ };
35
+ }
36
+ };
37
+ }
22
38
  constructor(...args) {
23
39
  super(...args);
24
40
  this.validators = this.validators.concat('minSelectedCount', 'maxSelectedCount', 'availableValueProperty');
@@ -104,6 +120,16 @@ export default class SelectBoxesComponent extends RadioComponent {
104
120
  value[val] = true;
105
121
  });
106
122
  }
123
+ const checkedValues = _.keys(_.pickBy(value, (val) => val));
124
+ if (this.isSelectURL && this.templateData && _.every(checkedValues, (val) => this.templateData[val])) {
125
+ const submission = this.root.submission;
126
+ if (!submission.metadata.selectData) {
127
+ submission.metadata.selectData = {};
128
+ }
129
+ const selectData = [];
130
+ checkedValues.forEach((value) => selectData.push(this.templateData[value]));
131
+ _.set(submission.metadata.selectData, this.path, selectData);
132
+ }
107
133
  return value;
108
134
  }
109
135
  /**
@@ -134,6 +160,9 @@ export default class SelectBoxesComponent extends RadioComponent {
134
160
  if (!value) {
135
161
  return '';
136
162
  }
163
+ if (this.isSelectURL) {
164
+ return _(value).pickBy((val) => val).keys().join(', ');
165
+ }
137
166
  return _(this.component.values || [])
138
167
  .filter((v) => value[v.value])
139
168
  .map('label')
@@ -151,7 +180,7 @@ export default class SelectBoxesComponent extends RadioComponent {
151
180
  key = valuesKeys.find((k) => input?.value.toString() === k);
152
181
  }
153
182
  const isChecked = value[key];
154
- if (isChecked && key) {
183
+ if ((isChecked && key) || (this.isSelectURL && !this.shouldLoad && this.listData && _.findIndex(this.selectData, this.listData[index]) !== -1)) {
155
184
  //add class to container when selected
156
185
  this.addClass(wrapper, this.optionSelectedClass);
157
186
  //change "checked" attribute
@@ -176,31 +205,33 @@ export default class SelectBoxesComponent extends RadioComponent {
176
205
  checkComponentValidity(data, dirty, rowData, options) {
177
206
  const minCount = this.component.validate.minSelectedCount;
178
207
  const maxCount = this.component.validate.maxSelectedCount;
179
- const isValid = this.isValid(data, dirty);
180
- if ((maxCount || minCount) && !this.shouldSkipValidation(data, dirty, rowData)) {
181
- const count = Object.keys(this.validationValue).reduce((total, key) => {
182
- if (this.validationValue[key]) {
183
- total++;
208
+ if (!this.shouldSkipValidation(data, dirty, rowData)) {
209
+ const isValid = this.isValid(data, dirty);
210
+ if ((maxCount || minCount)) {
211
+ const count = Object.keys(this.validationValue).reduce((total, key) => {
212
+ if (this.validationValue[key]) {
213
+ total++;
214
+ }
215
+ return total;
216
+ }, 0);
217
+ // Disable the rest of inputs if the max amount is already checked
218
+ if (maxCount && count >= maxCount) {
219
+ this.setInputsDisabled(true, true);
220
+ }
221
+ else if (maxCount && !this.shouldDisabled) {
222
+ this.setInputsDisabled(false);
223
+ }
224
+ if (!isValid && maxCount && count > maxCount) {
225
+ const message = this.t(this.component.maxSelectedCountMessage || 'You can only select up to {{maxCount}} items.', { maxCount });
226
+ this.setCustomValidity(message, dirty);
227
+ return false;
228
+ }
229
+ else if (!isValid && minCount && count < minCount) {
230
+ this.setInputsDisabled(false);
231
+ const message = this.t(this.component.minSelectedCountMessage || 'You must select at least {{minCount}} items.', { minCount });
232
+ this.setCustomValidity(message, dirty);
233
+ return false;
184
234
  }
185
- return total;
186
- }, 0);
187
- // Disable the rest of inputs if the max amount is already checked
188
- if (maxCount && count >= maxCount) {
189
- this.setInputsDisabled(true, true);
190
- }
191
- else if (maxCount && !this.shouldDisabled) {
192
- this.setInputsDisabled(false);
193
- }
194
- if (!isValid && maxCount && count > maxCount) {
195
- const message = this.t(this.component.maxSelectedCountMessage || 'You can only select up to {{maxCount}} items.', { maxCount });
196
- this.setCustomValidity(message, dirty);
197
- return false;
198
- }
199
- else if (!isValid && minCount && count < minCount) {
200
- this.setInputsDisabled(false);
201
- const message = this.t(this.component.minSelectedCountMessage || 'You must select at least {{minCount}} items.', { minCount });
202
- this.setCustomValidity(message, dirty);
203
- return false;
204
235
  }
205
236
  }
206
237
  return super.checkComponentValidity(data, dirty, rowData, options);
@@ -11,39 +11,46 @@ declare namespace _default {
11
11
  key: string;
12
12
  type: string;
13
13
  input: boolean;
14
- optionsLabelPosition?: undefined;
15
- defaultValue?: undefined;
16
- values?: undefined;
17
- validate?: undefined;
18
14
  conditional?: undefined;
19
- inputType?: undefined;
15
+ components?: undefined;
20
16
  disableOnInvalid?: undefined;
21
17
  } | {
22
18
  label: string;
23
- optionsLabelPosition: string;
24
19
  tableView: boolean;
25
- defaultValue: {
26
- '1': boolean;
27
- '2': boolean;
28
- '3': boolean;
29
- };
30
- values: {
31
- label: string;
32
- value: string;
33
- shortcut: string;
34
- }[];
35
- validate: {
36
- minSelectedCount: number;
37
- };
38
20
  key: string;
39
21
  conditional: {
40
22
  show: boolean;
41
- when: string;
42
- eq: boolean;
23
+ conjunction: string;
24
+ conditions: {
25
+ component: string;
26
+ operator: string;
27
+ value: boolean;
28
+ }[];
43
29
  };
44
30
  type: string;
45
31
  input: boolean;
46
- inputType: string;
32
+ components: {
33
+ label: string;
34
+ optionsLabelPosition: string;
35
+ tableView: boolean;
36
+ defaultValue: {
37
+ '1': boolean;
38
+ '2': boolean;
39
+ '3': boolean;
40
+ };
41
+ values: {
42
+ label: string;
43
+ value: string;
44
+ shortcut: string;
45
+ }[];
46
+ validate: {
47
+ minSelectedCount: number;
48
+ };
49
+ key: string;
50
+ type: string;
51
+ input: boolean;
52
+ inputType: string;
53
+ }[];
47
54
  disableOnInvalid?: undefined;
48
55
  } | {
49
56
  type: string;
@@ -52,12 +59,8 @@ declare namespace _default {
52
59
  disableOnInvalid: boolean;
53
60
  input: boolean;
54
61
  tableView: boolean;
55
- optionsLabelPosition?: undefined;
56
- defaultValue?: undefined;
57
- values?: undefined;
58
- validate?: undefined;
59
62
  conditional?: undefined;
60
- inputType?: undefined;
63
+ components?: undefined;
61
64
  })[];
62
65
  }
63
66
  export default _default;
@@ -14,43 +14,58 @@ export default {
14
14
  input: true
15
15
  },
16
16
  {
17
- label: 'Select Boxes',
18
- optionsLabelPosition: 'right',
17
+ label: 'Container',
19
18
  tableView: false,
20
- defaultValue: {
21
- '1': false,
22
- '2': false,
23
- '3': false
24
- },
25
- values: [
26
- {
27
- label: '1',
28
- value: '1',
29
- shortcut: ''
30
- },
31
- {
32
- label: '2',
33
- value: '2',
34
- shortcut: ''
35
- },
36
- {
37
- label: '3',
38
- value: '3',
39
- shortcut: ''
40
- }
41
- ],
42
- validate: {
43
- minSelectedCount: 1
44
- },
45
- key: 'selectBoxes1',
19
+ key: 'container',
46
20
  conditional: {
47
21
  show: true,
48
- when: 'checkbox',
49
- eq: true
22
+ conjunction: 'all',
23
+ conditions: [
24
+ {
25
+ component: 'checkbox',
26
+ operator: 'isEqual',
27
+ value: true
28
+ }
29
+ ]
50
30
  },
51
- type: 'selectboxes',
31
+ type: 'container',
52
32
  input: true,
53
- inputType: 'checkbox'
33
+ components: [
34
+ {
35
+ label: 'Select Boxes',
36
+ optionsLabelPosition: 'right',
37
+ tableView: false,
38
+ defaultValue: {
39
+ '1': false,
40
+ '2': false,
41
+ '3': false
42
+ },
43
+ values: [
44
+ {
45
+ label: '1',
46
+ value: '1',
47
+ shortcut: ''
48
+ },
49
+ {
50
+ label: '2',
51
+ value: '2',
52
+ shortcut: ''
53
+ },
54
+ {
55
+ label: '3',
56
+ value: '3',
57
+ shortcut: ''
58
+ }
59
+ ],
60
+ validate: {
61
+ minSelectedCount: 1
62
+ },
63
+ key: 'selectBoxes',
64
+ type: 'selectboxes',
65
+ input: true,
66
+ inputType: 'checkbox'
67
+ }
68
+ ]
54
69
  },
55
70
  {
56
71
  type: 'button',
@@ -0,0 +1,14 @@
1
+ declare namespace _default {
2
+ const label: string;
3
+ const dataSrc: string;
4
+ namespace data {
5
+ const url: string;
6
+ }
7
+ const valueProperty: string;
8
+ const template: string;
9
+ const key: string;
10
+ const type: string;
11
+ const input: boolean;
12
+ const inputType: string;
13
+ }
14
+ export default _default;
@@ -0,0 +1,13 @@
1
+ export default {
2
+ label: 'Select Boxes',
3
+ dataSrc: 'url',
4
+ data: {
5
+ url: 'https://cdn.rawgit.com/mshafrir/2646763/raw/states_titlecase.json'
6
+ },
7
+ valueProperty: 'abbreviation',
8
+ template: '<span>{{ item.name }}</span>',
9
+ key: 'selectBoxes',
10
+ type: 'selectboxes',
11
+ input: true,
12
+ inputType: 'checkbox',
13
+ };
@@ -3,4 +3,5 @@ import comp2 from './comp2';
3
3
  import comp3 from './comp3';
4
4
  import comp4 from './comp4';
5
5
  import comp5 from './comp5';
6
- export { comp1, comp2, comp3, comp4, comp5 };
6
+ import comp6 from './comp6';
7
+ export { comp1, comp2, comp3, comp4, comp5, comp6 };
@@ -3,4 +3,5 @@ import comp2 from './comp2';
3
3
  import comp3 from './comp3';
4
4
  import comp4 from './comp4';
5
5
  import comp5 from './comp5';
6
- export { comp1, comp2, comp3, comp4, comp5 };
6
+ import comp6 from './comp6';
7
+ export { comp1, comp2, comp3, comp4, comp5, comp6 };
@@ -17,7 +17,7 @@ export default class SignatureComponent extends Input {
17
17
  checkSize(force: any, scale: any): void;
18
18
  signaturePad: SignaturePad | null | undefined;
19
19
  observer: _ResizeObserver | null | undefined;
20
- getValueAsString(value: any): "Yes" | "No";
20
+ getValueAsString(value: any): "" | "Yes" | "No";
21
21
  focus(): void;
22
22
  setDataToSigaturePad(): void;
23
23
  }
@@ -28,11 +28,16 @@ export default class SignatureComponent extends Input {
28
28
  schema: SignatureComponent.schema()
29
29
  };
30
30
  }
31
+ static get serverConditionSettings() {
32
+ return {
33
+ ...super.serverConditionSettings,
34
+ operators: ['isEmpty', 'isNotEmpty'],
35
+ };
36
+ }
31
37
  init() {
32
38
  super.init();
33
39
  this.currentWidth = 0;
34
40
  this.scale = 1;
35
- this.ratio = 1;
36
41
  if (!this.component.width) {
37
42
  this.component.width = '100%';
38
43
  }
@@ -129,9 +134,9 @@ export default class SignatureComponent extends Input {
129
134
  this.scale = force ? scale : this.scale;
130
135
  this.currentWidth = this.refs.padBody.offsetWidth;
131
136
  const width = this.currentWidth * this.scale;
132
- this.refs.canvas.width = width;
133
137
  const height = this.ratio ? width / this.ratio : this.refs.padBody.offsetHeight * this.scale;
134
- const maxHeight = this.refs.padBody.offsetHeight * this.scale;
138
+ const maxHeight = this.ratio ? height : this.refs.padBody.offsetHeight * this.scale;
139
+ this.refs.canvas.width = width;
135
140
  this.refs.canvas.height = height > maxHeight ? maxHeight : height;
136
141
  this.refs.canvas.style.maxWidth = `${this.currentWidth * this.scale}px`;
137
142
  this.refs.canvas.style.maxHeight = `${maxHeight}px`;
@@ -225,6 +230,9 @@ export default class SignatureComponent extends Input {
225
230
  super.detach();
226
231
  }
227
232
  getValueAsString(value) {
233
+ if (_.isUndefined(value) && this.inDataTable) {
234
+ return '';
235
+ }
228
236
  return value ? 'Yes' : 'No';
229
237
  }
230
238
  focus() {