@formio/js 5.1.0-dev.6056.ba6432d → 5.1.0-dev.6059.845a6e3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/Changelog.md +13 -131
  2. package/README.md +1 -28
  3. package/dist/formio.builder.css +17 -19
  4. package/dist/formio.builder.min.css +1 -1
  5. package/dist/formio.embed.js +1 -1
  6. package/dist/formio.embed.min.js +1 -1
  7. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  8. package/dist/formio.form.css +17 -19
  9. package/dist/formio.form.js +176 -102
  10. package/dist/formio.form.min.css +1 -1
  11. package/dist/formio.form.min.js +1 -1
  12. package/dist/formio.form.min.js.LICENSE.txt +3 -3
  13. package/dist/formio.full.css +17 -19
  14. package/dist/formio.full.js +101 -123
  15. package/dist/formio.full.min.css +2 -2
  16. package/dist/formio.full.min.js +1 -1
  17. package/dist/formio.full.min.js.LICENSE.txt +3 -3
  18. package/dist/formio.js +10 -10
  19. package/dist/formio.min.js +1 -1
  20. package/dist/formio.min.js.LICENSE.txt +1 -1
  21. package/dist/formio.utils.js +3 -3
  22. package/dist/formio.utils.min.js +1 -1
  23. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  24. package/lib/cjs/CDN.d.ts +1 -1
  25. package/lib/cjs/CDN.js +2 -2
  26. package/lib/cjs/Embed.js +1 -1
  27. package/lib/cjs/Form.d.ts +6 -4
  28. package/lib/cjs/Form.js +8 -16
  29. package/lib/cjs/Formio.js +1 -1
  30. package/lib/cjs/PDFBuilder.js +4 -4
  31. package/lib/cjs/Webform.d.ts +13 -16
  32. package/lib/cjs/Webform.js +148 -162
  33. package/lib/cjs/WebformBuilder.js +28 -17
  34. package/lib/cjs/Wizard.js +1 -1
  35. package/lib/cjs/WizardBuilder.js +2 -15
  36. package/lib/cjs/components/Components.d.ts +0 -3
  37. package/lib/cjs/components/_classes/component/Component.d.ts +0 -1
  38. package/lib/cjs/components/_classes/component/Component.js +11 -38
  39. package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
  40. package/lib/cjs/components/_classes/component/editForm/Component.edit.data.d.ts +0 -37
  41. package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +2 -13
  42. package/lib/cjs/components/_classes/component/editForm/utils.d.ts +0 -1
  43. package/lib/cjs/components/_classes/component/editForm/utils.js +0 -3
  44. package/lib/cjs/components/_classes/input/Input.js +1 -23
  45. package/lib/cjs/components/_classes/list/ListComponent.js +4 -4
  46. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +1 -1
  47. package/lib/cjs/components/_classes/multivalue/Multivalue.js +3 -10
  48. package/lib/cjs/components/_classes/nested/NestedComponent.form.js +0 -13
  49. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +0 -2
  50. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +31 -52
  51. package/lib/cjs/components/address/Address.js +1 -1
  52. package/lib/cjs/components/button/Button.js +6 -6
  53. package/lib/cjs/components/checkbox/Checkbox.d.ts +1 -1
  54. package/lib/cjs/components/checkbox/Checkbox.js +2 -2
  55. package/lib/cjs/components/content/editForm/Content.edit.display.js +0 -8
  56. package/lib/cjs/components/currency/editForm/Currency.edit.display.js +0 -12
  57. package/lib/cjs/components/datagrid/DataGrid.d.ts +0 -2
  58. package/lib/cjs/components/datagrid/DataGrid.js +26 -41
  59. package/lib/cjs/components/day/Day.js +7 -9
  60. package/lib/cjs/components/day/editForm/Day.edit.display.js +0 -8
  61. package/lib/cjs/components/editgrid/EditGrid.d.ts +1 -1
  62. package/lib/cjs/components/editgrid/EditGrid.js +8 -26
  63. package/lib/cjs/components/email/editForm/Email.edit.display.js +0 -12
  64. package/lib/cjs/components/fieldset/editForm/Fieldset.edit.display.js +0 -8
  65. package/lib/cjs/components/file/File.d.ts +1 -1
  66. package/lib/cjs/components/file/File.js +17 -23
  67. package/lib/cjs/components/form/Form.d.ts +1 -1
  68. package/lib/cjs/components/form/Form.js +5 -9
  69. package/lib/cjs/components/form/editForm/Form.edit.form.js +3 -3
  70. package/lib/cjs/components/hidden/Hidden.d.ts +1 -0
  71. package/lib/cjs/components/hidden/Hidden.js +1 -1
  72. package/lib/cjs/components/hidden/editForm/Hidden.edit.display.js +0 -8
  73. package/lib/cjs/components/html/editForm/HTML.edit.display.js +0 -8
  74. package/lib/cjs/components/number/Number.js +5 -12
  75. package/lib/cjs/components/number/editForm/Number.edit.display.js +0 -12
  76. package/lib/cjs/components/password/editForm/Password.edit.display.js +1 -13
  77. package/lib/cjs/components/phonenumber/PhoneNumber.form.js +1 -9
  78. package/lib/cjs/components/radio/Radio.js +0 -10
  79. package/lib/cjs/components/recaptcha/ReCaptcha.js +2 -2
  80. package/lib/cjs/components/select/Select.d.ts +1 -0
  81. package/lib/cjs/components/select/Select.js +33 -12
  82. package/lib/cjs/components/select/editForm/Select.edit.data.d.ts +1 -1
  83. package/lib/cjs/components/select/editForm/Select.edit.data.js +2 -3
  84. package/lib/cjs/components/selectboxes/SelectBoxes.js +2 -2
  85. package/lib/cjs/components/signature/Signature.d.ts +1 -1
  86. package/lib/cjs/components/signature/Signature.js +3 -5
  87. package/lib/cjs/components/signature/editForm/Signature.edit.display.d.ts +6 -0
  88. package/lib/cjs/components/signature/editForm/Signature.edit.display.js +1 -0
  89. package/lib/cjs/components/survey/Survey.js +2 -2
  90. package/lib/cjs/components/tabs/editForm/Tabs.edit.display.js +0 -8
  91. package/lib/cjs/components/tags/Tags.d.ts +1 -1
  92. package/lib/cjs/components/tags/Tags.js +2 -2
  93. package/lib/cjs/components/textarea/TextArea.js +6 -6
  94. package/lib/cjs/components/textarea/editForm/TextArea.edit.display.js +0 -12
  95. package/lib/cjs/components/url/editForm/Url.edit.display.js +0 -12
  96. package/lib/cjs/components/well/editForm/Well.edit.display.js +0 -8
  97. package/lib/cjs/formio.form.js +0 -5
  98. package/lib/cjs/providers/storage/googleDrive.js +2 -3
  99. package/lib/cjs/providers/storage/s3.js +3 -3
  100. package/lib/cjs/providers/storage/xhr.d.ts +0 -1
  101. package/lib/cjs/providers/storage/xhr.js +1 -6
  102. package/lib/cjs/translations/en.d.ts +81 -234
  103. package/lib/cjs/translations/en.js +81 -8
  104. package/lib/cjs/utils/ChoicesWrapper.d.ts +25 -4
  105. package/lib/cjs/utils/ChoicesWrapper.js +124 -47
  106. package/lib/cjs/utils/formUtils.d.ts +2 -2
  107. package/lib/cjs/utils/i18n.d.ts +2 -5
  108. package/lib/cjs/utils/i18n.js +5 -32
  109. package/lib/cjs/widgets/CalendarWidget.js +27 -27
  110. package/lib/mjs/CDN.d.ts +1 -1
  111. package/lib/mjs/CDN.js +2 -2
  112. package/lib/mjs/Embed.js +1 -1
  113. package/lib/mjs/Form.d.ts +6 -4
  114. package/lib/mjs/Form.js +9 -17
  115. package/lib/mjs/Formio.js +1 -1
  116. package/lib/mjs/PDFBuilder.js +4 -4
  117. package/lib/mjs/Webform.d.ts +13 -16
  118. package/lib/mjs/Webform.js +158 -171
  119. package/lib/mjs/WebformBuilder.js +28 -17
  120. package/lib/mjs/Wizard.js +1 -1
  121. package/lib/mjs/WizardBuilder.js +2 -15
  122. package/lib/mjs/components/Components.d.ts +0 -3
  123. package/lib/mjs/components/_classes/component/Component.d.ts +0 -1
  124. package/lib/mjs/components/_classes/component/Component.js +11 -27
  125. package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
  126. package/lib/mjs/components/_classes/component/editForm/Component.edit.data.d.ts +0 -37
  127. package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +2 -13
  128. package/lib/mjs/components/_classes/component/editForm/utils.d.ts +0 -1
  129. package/lib/mjs/components/_classes/component/editForm/utils.js +0 -3
  130. package/lib/mjs/components/_classes/input/Input.js +1 -22
  131. package/lib/mjs/components/_classes/list/ListComponent.js +4 -4
  132. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +1 -1
  133. package/lib/mjs/components/_classes/multivalue/Multivalue.js +3 -10
  134. package/lib/mjs/components/_classes/nested/NestedComponent.form.js +0 -13
  135. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +0 -2
  136. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +31 -53
  137. package/lib/mjs/components/address/Address.js +1 -1
  138. package/lib/mjs/components/button/Button.js +6 -6
  139. package/lib/mjs/components/checkbox/Checkbox.d.ts +1 -1
  140. package/lib/mjs/components/checkbox/Checkbox.js +2 -2
  141. package/lib/mjs/components/content/editForm/Content.edit.display.js +0 -8
  142. package/lib/mjs/components/currency/editForm/Currency.edit.display.js +0 -12
  143. package/lib/mjs/components/datagrid/DataGrid.d.ts +0 -2
  144. package/lib/mjs/components/datagrid/DataGrid.js +26 -41
  145. package/lib/mjs/components/day/Day.js +7 -9
  146. package/lib/mjs/components/day/editForm/Day.edit.display.js +0 -8
  147. package/lib/mjs/components/editgrid/EditGrid.d.ts +1 -1
  148. package/lib/mjs/components/editgrid/EditGrid.js +7 -25
  149. package/lib/mjs/components/email/editForm/Email.edit.display.js +0 -12
  150. package/lib/mjs/components/fieldset/editForm/Fieldset.edit.display.js +0 -8
  151. package/lib/mjs/components/file/File.d.ts +1 -1
  152. package/lib/mjs/components/file/File.js +17 -23
  153. package/lib/mjs/components/form/Form.d.ts +1 -1
  154. package/lib/mjs/components/form/Form.js +5 -8
  155. package/lib/mjs/components/form/editForm/Form.edit.form.js +3 -3
  156. package/lib/mjs/components/hidden/Hidden.d.ts +1 -0
  157. package/lib/mjs/components/hidden/Hidden.js +1 -1
  158. package/lib/mjs/components/hidden/editForm/Hidden.edit.display.js +0 -8
  159. package/lib/mjs/components/html/editForm/HTML.edit.display.js +0 -8
  160. package/lib/mjs/components/number/Number.js +5 -12
  161. package/lib/mjs/components/number/editForm/Number.edit.display.js +0 -12
  162. package/lib/mjs/components/password/editForm/Password.edit.display.js +1 -13
  163. package/lib/mjs/components/phonenumber/PhoneNumber.form.js +1 -9
  164. package/lib/mjs/components/radio/Radio.js +0 -10
  165. package/lib/mjs/components/recaptcha/ReCaptcha.js +2 -2
  166. package/lib/mjs/components/select/Select.d.ts +1 -0
  167. package/lib/mjs/components/select/Select.js +34 -14
  168. package/lib/mjs/components/select/editForm/Select.edit.data.d.ts +1 -1
  169. package/lib/mjs/components/select/editForm/Select.edit.data.js +2 -3
  170. package/lib/mjs/components/selectboxes/SelectBoxes.js +2 -2
  171. package/lib/mjs/components/signature/Signature.d.ts +1 -1
  172. package/lib/mjs/components/signature/Signature.js +3 -5
  173. package/lib/mjs/components/signature/editForm/Signature.edit.display.d.ts +6 -0
  174. package/lib/mjs/components/signature/editForm/Signature.edit.display.js +1 -0
  175. package/lib/mjs/components/survey/Survey.js +2 -2
  176. package/lib/mjs/components/tabs/editForm/Tabs.edit.display.js +0 -8
  177. package/lib/mjs/components/tags/Tags.d.ts +1 -1
  178. package/lib/mjs/components/tags/Tags.js +2 -2
  179. package/lib/mjs/components/textarea/TextArea.js +6 -6
  180. package/lib/mjs/components/textarea/editForm/TextArea.edit.display.js +0 -12
  181. package/lib/mjs/components/url/editForm/Url.edit.display.js +0 -12
  182. package/lib/mjs/components/well/editForm/Well.edit.display.js +0 -8
  183. package/lib/mjs/formio.form.js +0 -5
  184. package/lib/mjs/providers/storage/googleDrive.js +2 -3
  185. package/lib/mjs/providers/storage/s3.js +3 -3
  186. package/lib/mjs/providers/storage/xhr.d.ts +0 -1
  187. package/lib/mjs/providers/storage/xhr.js +1 -6
  188. package/lib/mjs/translations/en.d.ts +81 -234
  189. package/lib/mjs/translations/en.js +1 -87
  190. package/lib/mjs/utils/ChoicesWrapper.d.ts +25 -4
  191. package/lib/mjs/utils/ChoicesWrapper.js +119 -26
  192. package/lib/mjs/utils/formUtils.d.ts +2 -2
  193. package/lib/mjs/utils/i18n.d.ts +2 -5
  194. package/lib/mjs/utils/i18n.js +5 -32
  195. package/lib/mjs/widgets/CalendarWidget.js +27 -27
  196. package/package.json +11 -27
@@ -109,18 +109,12 @@ class FileComponent extends Field_1.default {
109
109
  if (this.component.privateDownload) {
110
110
  fileInfo.private = true;
111
111
  }
112
- // pass the component to the downloadFile method
113
- return this.fileService.downloadFile(fileInfo, this.component).then((result) => result.url);
112
+ return this.fileService.downloadFile(fileInfo).then((result) => result.url);
114
113
  }
115
114
  get emptyValue() {
116
115
  return [];
117
116
  }
118
- getValueAsString(value, options) {
119
- if ((options === null || options === void 0 ? void 0 : options.review) && !this.component.uploadOnly) {
120
- return lodash_1.default.map(value, (val, index) => {
121
- return `<a href="${val.url || '#'}" target="_blank" data-path='${this.path}' data-fileindex='${index}'>${val.originalName}</a>`;
122
- }).join(', ');
123
- }
117
+ getValueAsString(value) {
124
118
  if (lodash_1.default.isArray(value)) {
125
119
  return lodash_1.default.map(value, 'originalName').join(', ');
126
120
  }
@@ -208,7 +202,7 @@ class FileComponent extends Field_1.default {
208
202
  this.videoStream = stream;
209
203
  const { videoPlayer } = this.refs;
210
204
  if (!videoPlayer) {
211
- console.warn(this.t('videoPlayerNotFound'));
205
+ console.warn('Video player not found in template.');
212
206
  this.cameraMode = false;
213
207
  this.redraw();
214
208
  return;
@@ -233,7 +227,7 @@ class FileComponent extends Field_1.default {
233
227
  takePicture() {
234
228
  const { videoPlayer } = this.refs;
235
229
  if (!videoPlayer) {
236
- console.warn(this.t('videoPlayerNotFound'));
230
+ console.warn('Video player not found in template.');
237
231
  this.cameraMode = false;
238
232
  this.redraw();
239
233
  return;
@@ -633,7 +627,7 @@ class FileComponent extends Field_1.default {
633
627
  file,
634
628
  size: file.size,
635
629
  status: 'info',
636
- message: this.t('waitFileProcessing'),
630
+ message: this.t('Processing file. Please wait...'),
637
631
  hash: '',
638
632
  };
639
633
  }
@@ -664,7 +658,7 @@ class FileComponent extends Field_1.default {
664
658
  return fileWithSameNameUploaded || fileWithSameNameUploading
665
659
  ? {
666
660
  status: 'error',
667
- message: this.t(fileWithSameNameUploading ? 'fileWithDuplicatedNameInProgress' : 'fileWithDuplicatedNameLoaded'),
661
+ message: this.t(`File with the same name is already ${fileWithSameNameUploading ? 'being ' : ''}uploaded`),
668
662
  }
669
663
  : {};
670
664
  }
@@ -673,7 +667,7 @@ class FileComponent extends Field_1.default {
673
667
  if (this.component.filePattern && !this.validatePattern(file, this.component.filePattern)) {
674
668
  return {
675
669
  status: 'error',
676
- message: this.t('wrongFileType', {
670
+ message: this.t('File is the wrong type; it must be {{ pattern }}', {
677
671
  pattern: this.component.filePattern,
678
672
  }),
679
673
  };
@@ -682,7 +676,7 @@ class FileComponent extends Field_1.default {
682
676
  if (this.component.fileMinSize && !this.validateMinSize(file, this.component.fileMinSize)) {
683
677
  return {
684
678
  status: 'error',
685
- message: this.t('fileTooSmall', {
679
+ message: this.t('File is too small; it must be at least {{ size }}', {
686
680
  size: this.component.fileMinSize,
687
681
  }),
688
682
  };
@@ -691,7 +685,7 @@ class FileComponent extends Field_1.default {
691
685
  if (this.component.fileMaxSize && !this.validateMaxSize(file, this.component.fileMaxSize)) {
692
686
  return {
693
687
  status: 'error',
694
- message: this.t('fileTooBig', {
688
+ message: this.t('File is too big; it must be at most {{ size }}', {
695
689
  size: this.component.fileMaxSize,
696
690
  }),
697
691
  };
@@ -703,7 +697,7 @@ class FileComponent extends Field_1.default {
703
697
  return !fileService
704
698
  ? {
705
699
  status: 'error',
706
- message: this.t('noFileService'),
700
+ message: this.t('File Service not provided.'),
707
701
  }
708
702
  : {};
709
703
  }
@@ -753,7 +747,7 @@ class FileComponent extends Field_1.default {
753
747
  this.fileDropHidden = false;
754
748
  return {
755
749
  status: 'error',
756
- message: this.t('fileProcessingFailed'),
750
+ message: this.t('File processing has been failed.'),
757
751
  };
758
752
  }
759
753
  finally {
@@ -789,7 +783,7 @@ class FileComponent extends Field_1.default {
789
783
  return this.filesToSync.filesToUpload.push(fileToSync);
790
784
  }
791
785
  if (this.autoSync) {
792
- fileToSync.message = this.t('readyForUpload');
786
+ fileToSync.message = this.t('Ready to be uploaded into storage');
793
787
  }
794
788
  this.filesToSync.filesToUpload.push(Object.assign(Object.assign({}, fileToSync), { message: fileToSync.message, file: processedFile.file || file, url: this.interpolate(this.component.url, { file: fileToSync }), groupPermissions, groupResourceId: groupKey ? this.currentForm.submission.data[groupKey]._id : null }));
795
789
  });
@@ -822,8 +816,8 @@ class FileComponent extends Field_1.default {
822
816
  }
823
817
  prepareFileToDelete(fileInfo) {
824
818
  this.filesToSync.filesToDelete.push(Object.assign(Object.assign({}, fileInfo), { status: 'info', message: this.autoSync
825
- ? this.t('readyForRemovingFromStorage')
826
- : this.t('preparingFileToRemove') }));
819
+ ? this.t('Ready to be removed from storage')
820
+ : this.t('Preparing file to remove') }));
827
821
  const index = this.dataValue.findIndex(file => file.name === fileInfo.name);
828
822
  this.splice(index);
829
823
  this.redraw();
@@ -863,7 +857,7 @@ class FileComponent extends Field_1.default {
863
857
  }
864
858
  yield this.deleteFile(fileToSync);
865
859
  fileToSync.status = 'success';
866
- fileToSync.message = this.t('succefullyRemoved');
860
+ fileToSync.message = this.t('Succefully removed');
867
861
  }
868
862
  catch (response) {
869
863
  fileToSync.status = 'error';
@@ -931,7 +925,7 @@ class FileComponent extends Field_1.default {
931
925
  }
932
926
  fileInfo = yield this.uploadFile(fileToSync);
933
927
  fileToSync.status = 'success';
934
- fileToSync.message = this.t('succefullyUploaded');
928
+ fileToSync.message = this.t('Succefully uploaded');
935
929
  fileInfo.originalName = fileToSync.originalName;
936
930
  fileInfo.hash = fileToSync.hash;
937
931
  }
@@ -1034,7 +1028,7 @@ class FileComponent extends Field_1.default {
1034
1028
  }
1035
1029
  yield this.syncFiles();
1036
1030
  return this.shouldSyncFiles
1037
- ? Promise.reject(this.t('synchronizationFailed'))
1031
+ ? Promise.reject('Synchronization is failed')
1038
1032
  : Promise.resolve();
1039
1033
  }
1040
1034
  catch (error) {
@@ -13,7 +13,7 @@ export default class FormComponent extends Component {
13
13
  valueChanged: boolean | undefined;
14
14
  subForm: any;
15
15
  formSrc: any;
16
- get dataReady(): any;
16
+ get dataReady(): Promise<any>;
17
17
  get emptyValue(): {
18
18
  data: {};
19
19
  };
@@ -102,8 +102,7 @@ class FormComponent extends Component_1.default {
102
102
  return this.createSubForm();
103
103
  }
104
104
  get dataReady() {
105
- var _a;
106
- return ((_a = this.subForm) === null || _a === void 0 ? void 0 : _a.dataReady) || this.subFormReady || Promise.resolve();
105
+ return this.subFormReady || Promise.resolve();
107
106
  }
108
107
  get defaultValue() {
109
108
  // Not not provide a default value unless the subform is ready so that it will initialize correctly.
@@ -218,7 +217,7 @@ class FormComponent extends Component_1.default {
218
217
  /* eslint-enable max-statements */
219
218
  render() {
220
219
  if (this.builderMode) {
221
- return super.render(this.t(this.component.label || 'nestedForm'));
220
+ return super.render(this.component.label || 'Nested form');
222
221
  }
223
222
  const subform = this.subForm ? this.subForm.render() : this.renderTemplate('loading');
224
223
  return super.render(subform);
@@ -231,13 +230,13 @@ class FormComponent extends Component_1.default {
231
230
  */
232
231
  getValueAsString(value, options) {
233
232
  if (!value) {
234
- return this.t('noDataProvided');
233
+ return 'No data provided';
235
234
  }
236
235
  if (!value.data && value._id) {
237
236
  return value._id;
238
237
  }
239
238
  if (!value.data || !Object.keys(value.data).length) {
240
- return this.t('noDataProvided');
239
+ return 'No data provided';
241
240
  }
242
241
  if (options === null || options === void 0 ? void 0 : options.email) {
243
242
  let result = (`
@@ -659,7 +658,7 @@ class FormComponent extends Component_1.default {
659
658
  : {};
660
659
  this.subForm.setUrl(submissionUrl, Object.assign(Object.assign({}, this.options), options));
661
660
  this.subForm.loadSubmission().catch((err) => {
662
- console.error(this.t('subformSubmissionLoadingError', { submissionId: submission._id }), err);
661
+ console.error(`Unable to load subform submission ${submission._id}:`, err);
663
662
  });
664
663
  }
665
664
  else {
@@ -674,9 +673,6 @@ class FormComponent extends Component_1.default {
674
673
  */
675
674
  onSetSubFormValue(submission, flags) {
676
675
  this.subForm.setValue(submission, flags);
677
- if (flags === null || flags === void 0 ? void 0 : flags.fromSubmission) {
678
- this.subForm.submissionReadyResolve(submission);
679
- }
680
676
  }
681
677
  isEmpty(value = this.dataValue) {
682
678
  return value === null || lodash_1.default.isEqual(value, this.emptyValue) || (this.areAllComponentsEmpty(value === null || value === void 0 ? void 0 : value.data) && !(value === null || value === void 0 ? void 0 : value._id));
@@ -47,7 +47,7 @@ exports.default = [
47
47
  },
48
48
  searchField: 'title__regex',
49
49
  template: '<span>{{ item._vid }}</span>',
50
- valueProperty: 'revisionId',
50
+ valueProperty: '_id',
51
51
  authenticate: true,
52
52
  label: 'Form Revision',
53
53
  key: 'revision',
@@ -69,7 +69,7 @@ exports.default = [
69
69
  input: true,
70
70
  weight: 20,
71
71
  key: 'reference',
72
- label: 'Submit as reference',
73
- tooltip: 'When "Submit as reference" is enabled, the form submission will be recorded against the Parent Form as well as the Child Form. When a submission recorded with "Submit as reference" is edited, the update is applied to each submission made against the Parent Form and Child Form.'
72
+ label: 'Save as reference',
73
+ tooltip: 'Using this option will save this field as a reference and link its value to the value of the origin record.'
74
74
  }
75
75
  ];
@@ -10,6 +10,7 @@ export default class HiddenComponent extends Input {
10
10
  };
11
11
  get inputInfo(): any;
12
12
  labelIsHidden(): boolean;
13
+ get emptyValue(): string;
13
14
  setValue(value: any, flags?: {}): boolean;
14
15
  }
15
16
  import Input from '../_classes/input/Input';
@@ -48,7 +48,7 @@ class HiddenComponent extends Input_1.default {
48
48
  return true;
49
49
  }
50
50
  get emptyValue() {
51
- return null;
51
+ return '';
52
52
  }
53
53
  setValue(value, flags = {}) {
54
54
  return this.updateValue(value, flags);
@@ -5,14 +5,6 @@ exports.default = [
5
5
  key: 'labelPosition',
6
6
  ignore: true
7
7
  },
8
- {
9
- key: 'labelWidth',
10
- ignore: true
11
- },
12
- {
13
- key: 'labelMargin',
14
- ignore: true
15
- },
16
8
  {
17
9
  key: 'placeholder',
18
10
  ignore: true
@@ -5,14 +5,6 @@ exports.default = [
5
5
  key: 'labelPosition',
6
6
  ignore: true
7
7
  },
8
- {
9
- key: 'labelWidth',
10
- ignore: true
11
- },
12
- {
13
- key: 'labelMargin',
14
- ignore: true
15
- },
16
8
  {
17
9
  key: 'placeholder',
18
10
  ignore: true
@@ -56,7 +56,7 @@ class NumberComponent extends Input_1.default {
56
56
  }
57
57
  else {
58
58
  if (this.component.thousandsSeparator || ((_c = this.options.properties) === null || _c === void 0 ? void 0 : _c.thousandsSeparator) || this.options.thousandsSeparator) {
59
- console.warn(this.t('noDelimiterSet'));
59
+ console.warn('In order for thousands separator to work properly, you must set the delimiter to true in the component json');
60
60
  }
61
61
  this.delimiter = '';
62
62
  }
@@ -170,21 +170,14 @@ class NumberComponent extends Input_1.default {
170
170
  if (typeof input === 'string') {
171
171
  input = input.split(this.delimiter).join('').replace(this.decimalSeparator, '.');
172
172
  }
173
- let value;
174
- if (!lodash_1.default.isNaN(input)) {
173
+ let value = parseFloat(input);
174
+ if (!lodash_1.default.isNaN(value)) {
175
175
  // Format scientific notation
176
- if (/[0-9]+[eE]/.test(String(input))) {
177
- // Convert to exponential notation will depend on the decimal limit set in the component
178
- // Example: 1.23e-5 will be converted to 1.23e-5 if decimal limit is set to 2
179
- // Example: 1.23e5 will be converted to 1.23e+5 if decimal limit is set to 2
180
- // if decimal limit is 3, 1.23e5 will be converted to 1.230e+5
181
- // if decimal limit is not set, 1.23e5 will be converted to 1.23000000000000000000e+5
182
- value = parseFloat(input);
176
+ if (/e/i.test(String(value))) {
183
177
  value = value.toExponential(this.decimalLimit);
184
178
  }
185
179
  else {
186
- value = parseFloat(input);
187
- value = !lodash_1.default.isNaN(value) ? String(value).replace('.', this.decimalSeparator) : null;
180
+ value = String(value).replace('.', this.decimalSeparator);
188
181
  }
189
182
  }
190
183
  else {
@@ -13,18 +13,6 @@ exports.default = [
13
13
  key: 'allowMultipleMasks',
14
14
  ignore: true
15
15
  },
16
- {
17
- key: 'inputMasks',
18
- ignore: true
19
- },
20
- {
21
- key: 'widget.type',
22
- ignore: true
23
- },
24
- {
25
- key: 'widget',
26
- ignore: true
27
- },
28
16
  {
29
17
  key: 'showWordCount',
30
18
  ignore: true,
@@ -12,17 +12,5 @@ exports.default = [
12
12
  {
13
13
  key: 'allowMultipleMasks',
14
14
  ignore: true
15
- },
16
- {
17
- key: 'inputMasks',
18
- ignore: true
19
- },
20
- {
21
- key: 'widget.type',
22
- ignore: true
23
- },
24
- {
25
- key: 'widget',
26
- ignore: true
27
- },
15
+ }
28
16
  ];
@@ -22,15 +22,7 @@ function default_1(...extend) {
22
22
  {
23
23
  key: 'showCharCount',
24
24
  ignore: true
25
- },
26
- {
27
- key: 'widget.type',
28
- ignore: true
29
- },
30
- {
31
- key: 'widget',
32
- ignore: true
33
- },
25
+ }
34
26
  ]
35
27
  },
36
28
  {
@@ -293,16 +293,6 @@ class RadioComponent extends ListComponent_1.default {
293
293
  if (method.toUpperCase() === 'GET') {
294
294
  body = null;
295
295
  }
296
- const limit = this.component.limit || 100;
297
- const skip = this.isScrollLoading ? this.selectOptions.length : 0;
298
- // Allow for url interpolation.
299
- url = this.sanitize(this.interpolate(url, {
300
- formioBase: Formio_1.Formio.getBaseUrl(),
301
- search,
302
- limit,
303
- skip,
304
- page: Math.abs(Math.floor(skip / limit))
305
- }), this.shouldSanitizeValue);
306
296
  // Set ignoreCache if it is
307
297
  options.ignoreCache = this.component.ignoreCache;
308
298
  // Make the request.
@@ -58,7 +58,7 @@ class ReCaptchaComponent extends Component_1.default {
58
58
  this.recaptchaApiReady = Formio_1.Formio.requireLibrary('googleRecaptcha', 'grecaptcha', recaptchaApiScriptUrl, true);
59
59
  }
60
60
  else {
61
- console.warn(this.t('noSiteKey'));
61
+ console.warn('There is no Site Key specified in settings in form JSON');
62
62
  }
63
63
  }
64
64
  }
@@ -72,7 +72,7 @@ class ReCaptchaComponent extends Component_1.default {
72
72
  return __awaiter(this, void 0, void 0, function* () {
73
73
  const siteKey = (0, get_1.default)(this.root.form, 'settings.recaptcha.siteKey');
74
74
  if (!siteKey) {
75
- console.warn(this.t('noSiteKey'));
75
+ console.warn('There is no Site Key specified in settings in form JSON');
76
76
  return;
77
77
  }
78
78
  if (!this.recaptchaApiReady) {
@@ -126,6 +126,7 @@ export default class SelectComponent extends ListComponent {
126
126
  get isLoadingAvailable(): any;
127
127
  onScroll(): void;
128
128
  attachRefreshOnBlur(): void;
129
+ addPlaceholderItem(placeholderValue: any): void;
129
130
  update(): void;
130
131
  addCurrentChoices(values: any, items: any, keyValue: any): any;
131
132
  getValueAsString(data: any, options: any): any;
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const lodash_1 = __importDefault(require("lodash"));
7
7
  const Formio_1 = require("../../Formio");
8
8
  const ListComponent_1 = __importDefault(require("../_classes/list/ListComponent"));
9
+ const Input_1 = __importDefault(require("../_classes/input/Input"));
9
10
  const Form_1 = __importDefault(require("../../Form"));
10
11
  const utils_1 = require("../../utils/utils");
11
12
  const ChoicesWrapper_1 = __importDefault(require("../../utils/ChoicesWrapper"));
@@ -529,13 +530,13 @@ class SelectComponent extends ListComponent_1.default {
529
530
  skip,
530
531
  };
531
532
  // Allow for url interpolation.
532
- url = this.sanitize(this.interpolate(url, {
533
+ url = this.interpolate(url, {
533
534
  formioBase: Formio_1.Formio.getBaseUrl(),
534
535
  search,
535
536
  limit,
536
537
  skip,
537
538
  page: Math.abs(Math.floor(skip / limit))
538
- }), this.shouldSanitizeValue);
539
+ });
539
540
  // Add search capability.
540
541
  if (this.component.searchField && search) {
541
542
  const searchValue = Array.isArray(search)
@@ -592,7 +593,7 @@ class SelectComponent extends ListComponent_1.default {
592
593
  component: this.component,
593
594
  message: err.toString(),
594
595
  });
595
- console.warn(this.t('loadResourcesError', { componentKey: this.key }));
596
+ console.warn(`Unable to load resources for ${this.key}`);
596
597
  }
597
598
  /**
598
599
  * Get the request headers for this select dropdown.
@@ -726,7 +727,7 @@ class SelectComponent extends ListComponent_1.default {
726
727
  }
727
728
  }
728
729
  else if (this.component.dataSrc === 'url' || this.component.dataSrc === 'resource') {
729
- this.addOption('', `${this.t('loading')}...`);
730
+ this.addOption('', this.t('loading...'));
730
731
  }
731
732
  }
732
733
  get active() {
@@ -767,10 +768,10 @@ class SelectComponent extends ListComponent_1.default {
767
768
  distance: 1000,
768
769
  };
769
770
  return Object.assign({ removeItemButton: this.component.disabled ? false : lodash_1.default.get(this.component, 'removeItemButton', true), itemSelectText: '', classNames: {
770
- containerOuter: ['choices', 'form-group', 'formio-choices'],
771
- containerInner: this.transform('class', 'form-control ui fluid selection dropdown').split(' '),
772
- }, addItemText: false, allowHTML: true, placeholder: !!this.component.placeholder, placeholderValue: placeholderValue, noResultsText: this.t('noResultsFound'), noChoicesText: this.t('noChoices'), searchPlaceholderValue: this.t('typeToSearch'), shouldSort: false, position: (this.component.dropdown || 'auto'), searchEnabled: useSearch, searchChoices: !this.component.searchField, searchFields: lodash_1.default.get(this, 'component.searchFields', ['label']), shadowRoot: this.root ? this.root.shadowRoot : null, fuseOptions: this.component.useExactSearch
773
- ? Object.assign({ tokenize: true, matchAllTokens: true }, commonFuseOptions) : Object.assign({}, lodash_1.default.get(this, 'component.fuseOptions', {}), Object.assign({ include: 'score', threshold: lodash_1.default.get(this, 'component.selectThreshold', 0.3) }, commonFuseOptions)), valueComparer: lodash_1.default.isEqual, resetScrollPosition: false, duplicateItemsAllowed: false }, customOptions);
771
+ containerOuter: 'choices form-group formio-choices',
772
+ containerInner: this.transform('class', 'form-control ui fluid selection dropdown')
773
+ }, addItemText: false, allowHTML: true, placeholder: !!this.component.placeholder, placeholderValue: placeholderValue, noResultsText: this.t('No results found'), noChoicesText: this.t('No choices to choose from'), searchPlaceholderValue: this.t('Type to search'), shouldSort: false, position: (this.component.dropdown || 'auto'), searchEnabled: useSearch, searchChoices: !this.component.searchField, searchFields: lodash_1.default.get(this, 'component.searchFields', ['label']), shadowRoot: this.root ? this.root.shadowRoot : null, fuseOptions: this.component.useExactSearch
774
+ ? Object.assign({ tokenize: true, matchAllTokens: true }, commonFuseOptions) : Object.assign({}, lodash_1.default.get(this, 'component.fuseOptions', {}), Object.assign({ include: 'score', threshold: lodash_1.default.get(this, 'component.selectThreshold', 0.3) }, commonFuseOptions)), valueComparer: lodash_1.default.isEqual, resetScrollPosition: false }, customOptions);
774
775
  }
775
776
  /* eslint-disable max-statements */
776
777
  attach(element) {
@@ -836,7 +837,7 @@ class SelectComponent extends ListComponent_1.default {
836
837
  this.choices.containerOuter.element.setAttribute('tabIndex', '-1');
837
838
  this.addEventListener(this.choices.containerOuter.element, 'focus', () => this.focusableElement.focus());
838
839
  }
839
- this.addFocusBlurEvents(this.choices.input.element);
840
+ Input_1.default.prototype.addFocusBlurEvents.call(this, this.focusableElement);
840
841
  if (this.itemsFromUrl && !this.component.noRefreshOnScroll) {
841
842
  this.scrollList = this.choices.choiceList.element;
842
843
  this.addEventListener(this.scrollList, 'scroll', () => this.onScroll());
@@ -902,6 +903,12 @@ class SelectComponent extends ListComponent_1.default {
902
903
  this.positionDropdown();
903
904
  });
904
905
  }
906
+ if (this.choices && choicesOptions.placeholderValue && this.choices._isSelectOneElement) {
907
+ this.addPlaceholderItem(choicesOptions.placeholderValue);
908
+ this.addEventListener(input, 'removeItem', () => {
909
+ this.addPlaceholderItem(choicesOptions.placeholderValue);
910
+ });
911
+ }
905
912
  // Add value options.
906
913
  this.addValueOptions();
907
914
  this.setChoicesValue(this.dataValue);
@@ -989,6 +996,20 @@ class SelectComponent extends ListComponent_1.default {
989
996
  });
990
997
  }
991
998
  }
999
+ addPlaceholderItem(placeholderValue) {
1000
+ const items = this.choices._store.activeItems;
1001
+ if (!items.length) {
1002
+ this.choices._addItem({
1003
+ value: '',
1004
+ label: placeholderValue,
1005
+ choiceId: 0,
1006
+ groupId: -1,
1007
+ customProperties: null,
1008
+ placeholder: true,
1009
+ keyCode: null
1010
+ });
1011
+ }
1012
+ }
992
1013
  /* eslint-enable max-statements */
993
1014
  update() {
994
1015
  if (this.component.dataSrc === 'custom') {
@@ -1169,7 +1190,7 @@ class SelectComponent extends ListComponent_1.default {
1169
1190
  return normalize[dataType]().value;
1170
1191
  }
1171
1192
  catch (err) {
1172
- console.warn(this.t('failedToNormalize'), err);
1193
+ console.warn('Failed to normalize value', err);
1173
1194
  return value;
1174
1195
  }
1175
1196
  }
@@ -1366,7 +1387,7 @@ class SelectComponent extends ListComponent_1.default {
1366
1387
  return (JSON.stringify(normalizedOptionValue) === JSON.stringify(value));
1367
1388
  }
1368
1389
  catch (err) {
1369
- console.warn.error(this.t('failedToCompareItems'), err);
1390
+ console.warn.error('Error while comparing items', err);
1370
1391
  return false;
1371
1392
  }
1372
1393
  };
@@ -1459,7 +1480,7 @@ class SelectComponent extends ListComponent_1.default {
1459
1480
  asString(value, options = {}) {
1460
1481
  var _a;
1461
1482
  value = value !== null && value !== void 0 ? value : this.getValue();
1462
- if (options.modalPreview || this.inDataTable || options.email) {
1483
+ if (options.modalPreview || this.inDataTable) {
1463
1484
  if (this.inDataTable) {
1464
1485
  value = this.undoValueTyping(value);
1465
1486
  }
@@ -1099,7 +1099,6 @@ declare const _default: ({
1099
1099
  alwaysEnabled?: undefined;
1100
1100
  } | {
1101
1101
  key: string;
1102
- type: string;
1103
1102
  conditional: {
1104
1103
  json: {
1105
1104
  and: ({
@@ -1150,6 +1149,7 @@ declare const _default: ({
1150
1149
  };
1151
1150
  };
1152
1151
  data?: undefined;
1152
+ type?: undefined;
1153
1153
  weight?: undefined;
1154
1154
  input?: undefined;
1155
1155
  label?: undefined;
@@ -641,8 +641,8 @@ exports.default = [
641
641
  input: true,
642
642
  weight: 25,
643
643
  key: 'reference',
644
- label: 'Submit as reference',
645
- tooltip: 'Using this option will submit this field as a reference id and link its value to the value of the origin record.',
644
+ label: 'Save as reference',
645
+ tooltip: 'Using this option will save this field as a reference and link its value to the value of the origin record.',
646
646
  conditional: {
647
647
  json: { '===': [{ var: 'data.dataSrc' }, 'resource'] },
648
648
  },
@@ -687,7 +687,6 @@ exports.default = [
687
687
  },
688
688
  {
689
689
  key: 'selectData',
690
- type: 'hidden',
691
690
  conditional: {
692
691
  json: {
693
692
  and: [
@@ -252,14 +252,14 @@ class SelectBoxesComponent extends Radio_1.default {
252
252
  this.setInputsDisabled(false);
253
253
  }
254
254
  if (!isValid && maxCount && count > maxCount) {
255
- const message = this.t(this.component.maxSelectedCountMessage || 'maxSelectItems', { maxCount });
255
+ const message = this.t(this.component.maxSelectedCountMessage || 'You may only select up to {{maxCount}} items', { maxCount });
256
256
  this.errors.push({ message });
257
257
  this.setCustomValidity(message, dirty);
258
258
  return false;
259
259
  }
260
260
  else if (!isValid && minCount && count < minCount) {
261
261
  this.setInputsDisabled(false);
262
- const message = this.t(this.component.minSelectedCountMessage || 'minSelectItems', { minCount });
262
+ const message = this.t(this.component.minSelectedCountMessage || 'You must select at least {{minCount}} items', { minCount });
263
263
  this.errors.push({ message });
264
264
  this.setCustomValidity(message, dirty);
265
265
  return false;
@@ -24,7 +24,7 @@ export default class SignatureComponent extends Input {
24
24
  checkSize(force: any, scale: any): void;
25
25
  signaturePad: SignaturePad | null | undefined;
26
26
  observer: any;
27
- getValueAsString(value: any): string;
27
+ getValueAsString(value: any): "" | "Yes" | "No";
28
28
  focus(): void;
29
29
  setDataToSigaturePad(): void;
30
30
  }
@@ -159,9 +159,7 @@ class SignatureComponent extends Input_1.default {
159
159
  if (this.dataValue) {
160
160
  this.setDataToSigaturePad();
161
161
  }
162
- if (!this.disabled) {
163
- this.showCanvas(true);
164
- }
162
+ this.showCanvas(true);
165
163
  }
166
164
  }
167
165
  renderElement(value, index) {
@@ -177,7 +175,7 @@ class SignatureComponent extends Input_1.default {
177
175
  return this.renderModalPreview({
178
176
  previewText: this.dataValue ?
179
177
  `<img src=${this.dataValue} ${this._referenceAttributeName}='openModal' style="width: 100%;height: 100%;" />` :
180
- this.t('clickToSign')
178
+ this.t('Click to Sign')
181
179
  });
182
180
  }
183
181
  attach(element) {
@@ -245,7 +243,7 @@ class SignatureComponent extends Input_1.default {
245
243
  if (lodash_1.default.isUndefined(value) && this.inDataTable) {
246
244
  return '';
247
245
  }
248
- return this.t(value ? 'yes' : 'no');
246
+ return value ? 'Yes' : 'No';
249
247
  }
250
248
  focus() {
251
249
  this.refs.padBody.focus();