@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
@@ -98,18 +98,12 @@ export default class FileComponent extends Field {
98
98
  if (this.component.privateDownload) {
99
99
  fileInfo.private = true;
100
100
  }
101
- // pass the component to the downloadFile method
102
- return this.fileService.downloadFile(fileInfo, this.component).then((result) => result.url);
101
+ return this.fileService.downloadFile(fileInfo).then((result) => result.url);
103
102
  }
104
103
  get emptyValue() {
105
104
  return [];
106
105
  }
107
- getValueAsString(value, options) {
108
- if (options?.review && !this.component.uploadOnly) {
109
- return _.map(value, (val, index) => {
110
- return `<a href="${val.url || '#'}" target="_blank" data-path='${this.path}' data-fileindex='${index}'>${val.originalName}</a>`;
111
- }).join(', ');
112
- }
106
+ getValueAsString(value) {
113
107
  if (_.isArray(value)) {
114
108
  return _.map(value, 'originalName').join(', ');
115
109
  }
@@ -202,7 +196,7 @@ export default class FileComponent extends Field {
202
196
  this.videoStream = stream;
203
197
  const { videoPlayer } = this.refs;
204
198
  if (!videoPlayer) {
205
- console.warn(this.t('videoPlayerNotFound'));
199
+ console.warn('Video player not found in template.');
206
200
  this.cameraMode = false;
207
201
  this.redraw();
208
202
  return;
@@ -227,7 +221,7 @@ export default class FileComponent extends Field {
227
221
  takePicture() {
228
222
  const { videoPlayer } = this.refs;
229
223
  if (!videoPlayer) {
230
- console.warn(this.t('videoPlayerNotFound'));
224
+ console.warn('Video player not found in template.');
231
225
  this.cameraMode = false;
232
226
  this.redraw();
233
227
  return;
@@ -632,7 +626,7 @@ export default class FileComponent extends Field {
632
626
  file,
633
627
  size: file.size,
634
628
  status: 'info',
635
- message: this.t('waitFileProcessing'),
629
+ message: this.t('Processing file. Please wait...'),
636
630
  hash: '',
637
631
  };
638
632
  }
@@ -661,7 +655,7 @@ export default class FileComponent extends Field {
661
655
  return fileWithSameNameUploaded || fileWithSameNameUploading
662
656
  ? {
663
657
  status: 'error',
664
- message: this.t(fileWithSameNameUploading ? 'fileWithDuplicatedNameInProgress' : 'fileWithDuplicatedNameLoaded'),
658
+ message: this.t(`File with the same name is already ${fileWithSameNameUploading ? 'being ' : ''}uploaded`),
665
659
  }
666
660
  : {};
667
661
  }
@@ -670,7 +664,7 @@ export default class FileComponent extends Field {
670
664
  if (this.component.filePattern && !this.validatePattern(file, this.component.filePattern)) {
671
665
  return {
672
666
  status: 'error',
673
- message: this.t('wrongFileType', {
667
+ message: this.t('File is the wrong type; it must be {{ pattern }}', {
674
668
  pattern: this.component.filePattern,
675
669
  }),
676
670
  };
@@ -679,7 +673,7 @@ export default class FileComponent extends Field {
679
673
  if (this.component.fileMinSize && !this.validateMinSize(file, this.component.fileMinSize)) {
680
674
  return {
681
675
  status: 'error',
682
- message: this.t('fileTooSmall', {
676
+ message: this.t('File is too small; it must be at least {{ size }}', {
683
677
  size: this.component.fileMinSize,
684
678
  }),
685
679
  };
@@ -688,7 +682,7 @@ export default class FileComponent extends Field {
688
682
  if (this.component.fileMaxSize && !this.validateMaxSize(file, this.component.fileMaxSize)) {
689
683
  return {
690
684
  status: 'error',
691
- message: this.t('fileTooBig', {
685
+ message: this.t('File is too big; it must be at most {{ size }}', {
692
686
  size: this.component.fileMaxSize,
693
687
  }),
694
688
  };
@@ -700,7 +694,7 @@ export default class FileComponent extends Field {
700
694
  return !fileService
701
695
  ? {
702
696
  status: 'error',
703
- message: this.t('noFileService'),
697
+ message: this.t('File Service not provided.'),
704
698
  }
705
699
  : {};
706
700
  }
@@ -748,7 +742,7 @@ export default class FileComponent extends Field {
748
742
  this.fileDropHidden = false;
749
743
  return {
750
744
  status: 'error',
751
- message: this.t('fileProcessingFailed'),
745
+ message: this.t('File processing has been failed.'),
752
746
  };
753
747
  }
754
748
  finally {
@@ -782,7 +776,7 @@ export default class FileComponent extends Field {
782
776
  return this.filesToSync.filesToUpload.push(fileToSync);
783
777
  }
784
778
  if (this.autoSync) {
785
- fileToSync.message = this.t('readyForUpload');
779
+ fileToSync.message = this.t('Ready to be uploaded into storage');
786
780
  }
787
781
  this.filesToSync.filesToUpload.push({
788
782
  ...fileToSync,
@@ -820,8 +814,8 @@ export default class FileComponent extends Field {
820
814
  ...fileInfo,
821
815
  status: 'info',
822
816
  message: this.autoSync
823
- ? this.t('readyForRemovingFromStorage')
824
- : this.t('preparingFileToRemove'),
817
+ ? this.t('Ready to be removed from storage')
818
+ : this.t('Preparing file to remove'),
825
819
  });
826
820
  const index = this.dataValue.findIndex(file => file.name === fileInfo.name);
827
821
  this.splice(index);
@@ -859,7 +853,7 @@ export default class FileComponent extends Field {
859
853
  }
860
854
  await this.deleteFile(fileToSync);
861
855
  fileToSync.status = 'success';
862
- fileToSync.message = this.t('succefullyRemoved');
856
+ fileToSync.message = this.t('Succefully removed');
863
857
  }
864
858
  catch (response) {
865
859
  fileToSync.status = 'error';
@@ -927,7 +921,7 @@ export default class FileComponent extends Field {
927
921
  }
928
922
  fileInfo = await this.uploadFile(fileToSync);
929
923
  fileToSync.status = 'success';
930
- fileToSync.message = this.t('succefullyUploaded');
924
+ fileToSync.message = this.t('Succefully uploaded');
931
925
  fileInfo.originalName = fileToSync.originalName;
932
926
  fileInfo.hash = fileToSync.hash;
933
927
  }
@@ -1026,7 +1020,7 @@ export default class FileComponent extends Field {
1026
1020
  }
1027
1021
  await this.syncFiles();
1028
1022
  return this.shouldSyncFiles
1029
- ? Promise.reject(this.t('synchronizationFailed'))
1023
+ ? Promise.reject('Synchronization is failed')
1030
1024
  : Promise.resolve();
1031
1025
  }
1032
1026
  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
  };
@@ -97,7 +97,7 @@ export default class FormComponent extends Component {
97
97
  return this.createSubForm();
98
98
  }
99
99
  get dataReady() {
100
- return this.subForm?.dataReady || this.subFormReady || Promise.resolve();
100
+ return this.subFormReady || Promise.resolve();
101
101
  }
102
102
  get defaultValue() {
103
103
  // Not not provide a default value unless the subform is ready so that it will initialize correctly.
@@ -211,7 +211,7 @@ export default class FormComponent extends Component {
211
211
  /* eslint-enable max-statements */
212
212
  render() {
213
213
  if (this.builderMode) {
214
- return super.render(this.t(this.component.label || 'nestedForm'));
214
+ return super.render(this.component.label || 'Nested form');
215
215
  }
216
216
  const subform = this.subForm ? this.subForm.render() : this.renderTemplate('loading');
217
217
  return super.render(subform);
@@ -224,13 +224,13 @@ export default class FormComponent extends Component {
224
224
  */
225
225
  getValueAsString(value, options) {
226
226
  if (!value) {
227
- return this.t('noDataProvided');
227
+ return 'No data provided';
228
228
  }
229
229
  if (!value.data && value._id) {
230
230
  return value._id;
231
231
  }
232
232
  if (!value.data || !Object.keys(value.data).length) {
233
- return this.t('noDataProvided');
233
+ return 'No data provided';
234
234
  }
235
235
  if (options?.email) {
236
236
  let result = (`
@@ -648,7 +648,7 @@ export default class FormComponent extends Component {
648
648
  : {};
649
649
  this.subForm.setUrl(submissionUrl, { ...this.options, ...options });
650
650
  this.subForm.loadSubmission().catch((err) => {
651
- console.error(this.t('subformSubmissionLoadingError', { submissionId: submission._id }), err);
651
+ console.error(`Unable to load subform submission ${submission._id}:`, err);
652
652
  });
653
653
  }
654
654
  else {
@@ -663,9 +663,6 @@ export default class FormComponent extends Component {
663
663
  */
664
664
  onSetSubFormValue(submission, flags) {
665
665
  this.subForm.setValue(submission, flags);
666
- if (flags?.fromSubmission) {
667
- this.subForm.submissionReadyResolve(submission);
668
- }
669
666
  }
670
667
  isEmpty(value = this.dataValue) {
671
668
  return value === null || _.isEqual(value, this.emptyValue) || (this.areAllComponentsEmpty(value?.data) && !value?._id);
@@ -44,7 +44,7 @@ export default [
44
44
  },
45
45
  searchField: 'title__regex',
46
46
  template: '<span>{{ item._vid }}</span>',
47
- valueProperty: 'revisionId',
47
+ valueProperty: '_id',
48
48
  authenticate: true,
49
49
  label: 'Form Revision',
50
50
  key: 'revision',
@@ -66,7 +66,7 @@ export default [
66
66
  input: true,
67
67
  weight: 20,
68
68
  key: 'reference',
69
- label: 'Submit as reference',
70
- 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.'
69
+ label: 'Save as reference',
70
+ tooltip: 'Using this option will save this field as a reference and link its value to the value of the origin record.'
71
71
  }
72
72
  ];
@@ -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';
@@ -43,7 +43,7 @@ export default class HiddenComponent extends Input {
43
43
  return true;
44
44
  }
45
45
  get emptyValue() {
46
- return null;
46
+ return '';
47
47
  }
48
48
  setValue(value, flags = {}) {
49
49
  return this.updateValue(value, flags);
@@ -3,14 +3,6 @@ export default [
3
3
  key: 'labelPosition',
4
4
  ignore: true
5
5
  },
6
- {
7
- key: 'labelWidth',
8
- ignore: true
9
- },
10
- {
11
- key: 'labelMargin',
12
- ignore: true
13
- },
14
6
  {
15
7
  key: 'placeholder',
16
8
  ignore: true
@@ -3,14 +3,6 @@ export default [
3
3
  key: 'labelPosition',
4
4
  ignore: true
5
5
  },
6
- {
7
- key: 'labelWidth',
8
- ignore: true
9
- },
10
- {
11
- key: 'labelMargin',
12
- ignore: true
13
- },
14
6
  {
15
7
  key: 'placeholder',
16
8
  ignore: true
@@ -54,7 +54,7 @@ export default class NumberComponent extends Input {
54
54
  }
55
55
  else {
56
56
  if (this.component.thousandsSeparator || this.options.properties?.thousandsSeparator || this.options.thousandsSeparator) {
57
- console.warn(this.t('noDelimiterSet'));
57
+ console.warn('In order for thousands separator to work properly, you must set the delimiter to true in the component json');
58
58
  }
59
59
  this.delimiter = '';
60
60
  }
@@ -168,21 +168,14 @@ export default class NumberComponent extends Input {
168
168
  if (typeof input === 'string') {
169
169
  input = input.split(this.delimiter).join('').replace(this.decimalSeparator, '.');
170
170
  }
171
- let value;
172
- if (!_.isNaN(input)) {
171
+ let value = parseFloat(input);
172
+ if (!_.isNaN(value)) {
173
173
  // Format scientific notation
174
- if (/[0-9]+[eE]/.test(String(input))) {
175
- // Convert to exponential notation will depend on the decimal limit set in the component
176
- // Example: 1.23e-5 will be converted to 1.23e-5 if decimal limit is set to 2
177
- // Example: 1.23e5 will be converted to 1.23e+5 if decimal limit is set to 2
178
- // if decimal limit is 3, 1.23e5 will be converted to 1.230e+5
179
- // if decimal limit is not set, 1.23e5 will be converted to 1.23000000000000000000e+5
180
- value = parseFloat(input);
174
+ if (/e/i.test(String(value))) {
181
175
  value = value.toExponential(this.decimalLimit);
182
176
  }
183
177
  else {
184
- value = parseFloat(input);
185
- value = !_.isNaN(value) ? String(value).replace('.', this.decimalSeparator) : null;
178
+ value = String(value).replace('.', this.decimalSeparator);
186
179
  }
187
180
  }
188
181
  else {
@@ -11,18 +11,6 @@ export default [
11
11
  key: 'allowMultipleMasks',
12
12
  ignore: true
13
13
  },
14
- {
15
- key: 'inputMasks',
16
- ignore: true
17
- },
18
- {
19
- key: 'widget.type',
20
- ignore: true
21
- },
22
- {
23
- key: 'widget',
24
- ignore: true
25
- },
26
14
  {
27
15
  key: 'showWordCount',
28
16
  ignore: true,
@@ -10,17 +10,5 @@ export default [
10
10
  {
11
11
  key: 'allowMultipleMasks',
12
12
  ignore: true
13
- },
14
- {
15
- key: 'inputMasks',
16
- ignore: true
17
- },
18
- {
19
- key: 'widget.type',
20
- ignore: true
21
- },
22
- {
23
- key: 'widget',
24
- ignore: true
25
- },
13
+ }
26
14
  ];
@@ -17,15 +17,7 @@ export default function (...extend) {
17
17
  {
18
18
  key: 'showCharCount',
19
19
  ignore: true
20
- },
21
- {
22
- key: 'widget.type',
23
- ignore: true
24
- },
25
- {
26
- key: 'widget',
27
- ignore: true
28
- },
20
+ }
29
21
  ]
30
22
  },
31
23
  {
@@ -293,16 +293,6 @@ export default class RadioComponent extends ListComponent {
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.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.
@@ -47,7 +47,7 @@ export default class ReCaptchaComponent extends Component {
47
47
  this.recaptchaApiReady = Formio.requireLibrary('googleRecaptcha', 'grecaptcha', recaptchaApiScriptUrl, true);
48
48
  }
49
49
  else {
50
- console.warn(this.t('noSiteKey'));
50
+ console.warn('There is no Site Key specified in settings in form JSON');
51
51
  }
52
52
  }
53
53
  }
@@ -60,7 +60,7 @@ export default class ReCaptchaComponent extends Component {
60
60
  async verify(actionName) {
61
61
  const siteKey = _get(this.root.form, 'settings.recaptcha.siteKey');
62
62
  if (!siteKey) {
63
- console.warn(this.t('noSiteKey'));
63
+ console.warn('There is no Site Key specified in settings in form JSON');
64
64
  return;
65
65
  }
66
66
  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;
@@ -1,6 +1,7 @@
1
1
  import _ from 'lodash';
2
2
  import { Formio } from '../../Formio';
3
3
  import ListComponent from '../_classes/list/ListComponent';
4
+ import Input from '../_classes/input/Input';
4
5
  import Form from '../../Form';
5
6
  import { getRandomComponentId, boolValue, isPromise, componentValueTypes, getComponentSavedTypes, isSelectResourceWithObjectValue, removeHTML } from '../../utils/utils';
6
7
  import Choices from '../../utils/ChoicesWrapper';
@@ -531,13 +532,13 @@ export default class SelectComponent extends ListComponent {
531
532
  skip,
532
533
  };
533
534
  // Allow for url interpolation.
534
- url = this.sanitize(this.interpolate(url, {
535
+ url = this.interpolate(url, {
535
536
  formioBase: Formio.getBaseUrl(),
536
537
  search,
537
538
  limit,
538
539
  skip,
539
540
  page: Math.abs(Math.floor(skip / limit))
540
- }), this.shouldSanitizeValue);
541
+ });
541
542
  // Add search capability.
542
543
  if (this.component.searchField && search) {
543
544
  const searchValue = Array.isArray(search)
@@ -594,7 +595,7 @@ export default class SelectComponent extends ListComponent {
594
595
  component: this.component,
595
596
  message: err.toString(),
596
597
  });
597
- console.warn(this.t('loadResourcesError', { componentKey: this.key }));
598
+ console.warn(`Unable to load resources for ${this.key}`);
598
599
  }
599
600
  /**
600
601
  * Get the request headers for this select dropdown.
@@ -728,7 +729,7 @@ export default class SelectComponent extends ListComponent {
728
729
  }
729
730
  }
730
731
  else if (this.component.dataSrc === 'url' || this.component.dataSrc === 'resource') {
731
- this.addOption('', `${this.t('loading')}...`);
732
+ this.addOption('', this.t('loading...'));
732
733
  }
733
734
  }
734
735
  get active() {
@@ -772,16 +773,16 @@ export default class SelectComponent extends ListComponent {
772
773
  removeItemButton: this.component.disabled ? false : _.get(this.component, 'removeItemButton', true),
773
774
  itemSelectText: '',
774
775
  classNames: {
775
- containerOuter: ['choices', 'form-group', 'formio-choices'],
776
- containerInner: this.transform('class', 'form-control ui fluid selection dropdown').split(' '),
776
+ containerOuter: 'choices form-group formio-choices',
777
+ containerInner: this.transform('class', 'form-control ui fluid selection dropdown')
777
778
  },
778
779
  addItemText: false,
779
780
  allowHTML: true,
780
781
  placeholder: !!this.component.placeholder,
781
782
  placeholderValue: placeholderValue,
782
- noResultsText: this.t('noResultsFound'),
783
- noChoicesText: this.t('noChoices'),
784
- searchPlaceholderValue: this.t('typeToSearch'),
783
+ noResultsText: this.t('No results found'),
784
+ noChoicesText: this.t('No choices to choose from'),
785
+ searchPlaceholderValue: this.t('Type to search'),
785
786
  shouldSort: false,
786
787
  position: (this.component.dropdown || 'auto'),
787
788
  searchEnabled: useSearch,
@@ -801,7 +802,6 @@ export default class SelectComponent extends ListComponent {
801
802
  }),
802
803
  valueComparer: _.isEqual,
803
804
  resetScrollPosition: false,
804
- duplicateItemsAllowed: false,
805
805
  ...customOptions,
806
806
  };
807
807
  }
@@ -868,7 +868,7 @@ export default class SelectComponent extends ListComponent {
868
868
  this.choices.containerOuter.element.setAttribute('tabIndex', '-1');
869
869
  this.addEventListener(this.choices.containerOuter.element, 'focus', () => this.focusableElement.focus());
870
870
  }
871
- this.addFocusBlurEvents(this.choices.input.element);
871
+ Input.prototype.addFocusBlurEvents.call(this, this.focusableElement);
872
872
  if (this.itemsFromUrl && !this.component.noRefreshOnScroll) {
873
873
  this.scrollList = this.choices.choiceList.element;
874
874
  this.addEventListener(this.scrollList, 'scroll', () => this.onScroll());
@@ -934,6 +934,12 @@ export default class SelectComponent extends ListComponent {
934
934
  this.positionDropdown();
935
935
  });
936
936
  }
937
+ if (this.choices && choicesOptions.placeholderValue && this.choices._isSelectOneElement) {
938
+ this.addPlaceholderItem(choicesOptions.placeholderValue);
939
+ this.addEventListener(input, 'removeItem', () => {
940
+ this.addPlaceholderItem(choicesOptions.placeholderValue);
941
+ });
942
+ }
937
943
  // Add value options.
938
944
  this.addValueOptions();
939
945
  this.setChoicesValue(this.dataValue);
@@ -1019,6 +1025,20 @@ export default class SelectComponent extends ListComponent {
1019
1025
  });
1020
1026
  }
1021
1027
  }
1028
+ addPlaceholderItem(placeholderValue) {
1029
+ const items = this.choices._store.activeItems;
1030
+ if (!items.length) {
1031
+ this.choices._addItem({
1032
+ value: '',
1033
+ label: placeholderValue,
1034
+ choiceId: 0,
1035
+ groupId: -1,
1036
+ customProperties: null,
1037
+ placeholder: true,
1038
+ keyCode: null
1039
+ });
1040
+ }
1041
+ }
1022
1042
  /* eslint-enable max-statements */
1023
1043
  update() {
1024
1044
  if (this.component.dataSrc === 'custom') {
@@ -1199,7 +1219,7 @@ export default class SelectComponent extends ListComponent {
1199
1219
  return normalize[dataType]().value;
1200
1220
  }
1201
1221
  catch (err) {
1202
- console.warn(this.t('failedToNormalize'), err);
1222
+ console.warn('Failed to normalize value', err);
1203
1223
  return value;
1204
1224
  }
1205
1225
  }
@@ -1395,7 +1415,7 @@ export default class SelectComponent extends ListComponent {
1395
1415
  return (JSON.stringify(normalizedOptionValue) === JSON.stringify(value));
1396
1416
  }
1397
1417
  catch (err) {
1398
- console.warn.error(this.t('failedToCompareItems'), err);
1418
+ console.warn.error('Error while comparing items', err);
1399
1419
  return false;
1400
1420
  }
1401
1421
  };
@@ -1487,7 +1507,7 @@ export default class SelectComponent extends ListComponent {
1487
1507
  }
1488
1508
  asString(value, options = {}) {
1489
1509
  value = value ?? this.getValue();
1490
- if (options.modalPreview || this.inDataTable || options.email) {
1510
+ if (options.modalPreview || this.inDataTable) {
1491
1511
  if (this.inDataTable) {
1492
1512
  value = this.undoValueTyping(value);
1493
1513
  }
@@ -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;
@@ -635,8 +635,8 @@ export default [
635
635
  input: true,
636
636
  weight: 25,
637
637
  key: 'reference',
638
- label: 'Submit as reference',
639
- tooltip: 'Using this option will submit this field as a reference id and link its value to the value of the origin record.',
638
+ label: 'Save as reference',
639
+ tooltip: 'Using this option will save this field as a reference and link its value to the value of the origin record.',
640
640
  conditional: {
641
641
  json: { '===': [{ var: 'data.dataSrc' }, 'resource'] },
642
642
  },
@@ -681,7 +681,6 @@ export default [
681
681
  },
682
682
  {
683
683
  key: 'selectData',
684
- type: 'hidden',
685
684
  conditional: {
686
685
  json: {
687
686
  and: [
@@ -253,14 +253,14 @@ export default class SelectBoxesComponent extends RadioComponent {
253
253
  this.setInputsDisabled(false);
254
254
  }
255
255
  if (!isValid && maxCount && count > maxCount) {
256
- const message = this.t(this.component.maxSelectedCountMessage || 'maxSelectItems', { maxCount });
256
+ const message = this.t(this.component.maxSelectedCountMessage || 'You may only select up to {{maxCount}} items', { maxCount });
257
257
  this.errors.push({ message });
258
258
  this.setCustomValidity(message, dirty);
259
259
  return false;
260
260
  }
261
261
  else if (!isValid && minCount && count < minCount) {
262
262
  this.setInputsDisabled(false);
263
- const message = this.t(this.component.minSelectedCountMessage || 'minSelectItems', { minCount });
263
+ const message = this.t(this.component.minSelectedCountMessage || 'You must select at least {{minCount}} items', { minCount });
264
264
  this.errors.push({ message });
265
265
  this.setCustomValidity(message, dirty);
266
266
  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
  }
@@ -156,9 +156,7 @@ export default class SignatureComponent extends Input {
156
156
  if (this.dataValue) {
157
157
  this.setDataToSigaturePad();
158
158
  }
159
- if (!this.disabled) {
160
- this.showCanvas(true);
161
- }
159
+ this.showCanvas(true);
162
160
  }
163
161
  }
164
162
  renderElement(value, index) {
@@ -174,7 +172,7 @@ export default class SignatureComponent extends Input {
174
172
  return this.renderModalPreview({
175
173
  previewText: this.dataValue ?
176
174
  `<img src=${this.dataValue} ${this._referenceAttributeName}='openModal' style="width: 100%;height: 100%;" />` :
177
- this.t('clickToSign')
175
+ this.t('Click to Sign')
178
176
  });
179
177
  }
180
178
  attach(element) {
@@ -242,7 +240,7 @@ export default class SignatureComponent extends Input {
242
240
  if (_.isUndefined(value) && this.inDataTable) {
243
241
  return '';
244
242
  }
245
- return this.t(value ? 'yes' : 'no');
243
+ return value ? 'Yes' : 'No';
246
244
  }
247
245
  focus() {
248
246
  this.refs.padBody.focus();