@formio/js 5.1.0-dev.6059.845a6e3 → 5.1.0-dev.6060.19e3bfc
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.
- package/Changelog.md +131 -13
- package/README.md +28 -1
- package/dist/formio.builder.css +19 -17
- package/dist/formio.builder.min.css +1 -1
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.css +19 -17
- package/dist/formio.form.js +102 -176
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +3 -3
- package/dist/formio.full.css +19 -17
- package/dist/formio.full.js +123 -101
- package/dist/formio.full.min.css +2 -2
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +3 -3
- package/dist/formio.js +10 -10
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +3 -3
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/CDN.d.ts +1 -1
- package/lib/cjs/CDN.js +2 -2
- package/lib/cjs/Embed.js +1 -1
- package/lib/cjs/Form.d.ts +4 -6
- package/lib/cjs/Form.js +16 -8
- package/lib/cjs/Formio.js +1 -1
- package/lib/cjs/PDFBuilder.js +4 -4
- package/lib/cjs/Webform.d.ts +16 -13
- package/lib/cjs/Webform.js +162 -148
- package/lib/cjs/WebformBuilder.js +17 -28
- package/lib/cjs/Wizard.js +1 -1
- package/lib/cjs/WizardBuilder.js +15 -2
- package/lib/cjs/components/Components.d.ts +3 -0
- package/lib/cjs/components/_classes/component/Component.d.ts +1 -0
- package/lib/cjs/components/_classes/component/Component.js +38 -11
- package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.d.ts +37 -0
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +32 -2
- package/lib/cjs/components/_classes/component/editForm/utils.d.ts +1 -0
- package/lib/cjs/components/_classes/component/editForm/utils.js +3 -0
- package/lib/cjs/components/_classes/input/Input.js +23 -1
- package/lib/cjs/components/_classes/list/ListComponent.js +4 -4
- package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +1 -1
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +10 -3
- package/lib/cjs/components/_classes/nested/NestedComponent.form.js +13 -0
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -0
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +52 -31
- package/lib/cjs/components/address/Address.js +14 -1
- package/lib/cjs/components/button/Button.js +6 -6
- package/lib/cjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/cjs/components/checkbox/Checkbox.js +2 -2
- package/lib/cjs/components/content/editForm/Content.edit.display.js +8 -0
- package/lib/cjs/components/currency/editForm/Currency.edit.display.js +12 -0
- package/lib/cjs/components/datagrid/DataGrid.d.ts +2 -0
- package/lib/cjs/components/datagrid/DataGrid.js +41 -26
- package/lib/cjs/components/day/Day.js +9 -7
- package/lib/cjs/components/day/editForm/Day.edit.display.js +8 -0
- package/lib/cjs/components/editgrid/EditGrid.d.ts +1 -1
- package/lib/cjs/components/editgrid/EditGrid.js +26 -8
- package/lib/cjs/components/email/editForm/Email.edit.display.js +12 -0
- package/lib/cjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -0
- package/lib/cjs/components/file/File.d.ts +1 -1
- package/lib/cjs/components/file/File.js +30 -19
- package/lib/cjs/components/form/Form.d.ts +1 -1
- package/lib/cjs/components/form/Form.js +9 -5
- package/lib/cjs/components/form/editForm/Form.edit.form.js +3 -3
- package/lib/cjs/components/hidden/Hidden.d.ts +0 -1
- package/lib/cjs/components/hidden/Hidden.js +1 -1
- package/lib/cjs/components/hidden/editForm/Hidden.edit.display.js +8 -0
- package/lib/cjs/components/html/editForm/HTML.edit.display.js +8 -0
- package/lib/cjs/components/number/Number.js +12 -5
- package/lib/cjs/components/number/editForm/Number.edit.display.js +12 -0
- package/lib/cjs/components/password/editForm/Password.edit.display.js +13 -1
- package/lib/cjs/components/phonenumber/PhoneNumber.form.js +9 -1
- package/lib/cjs/components/radio/Radio.js +10 -0
- package/lib/cjs/components/recaptcha/ReCaptcha.js +2 -2
- package/lib/cjs/components/select/Select.d.ts +0 -1
- package/lib/cjs/components/select/Select.js +12 -33
- package/lib/cjs/components/select/editForm/Select.edit.data.d.ts +1 -1
- package/lib/cjs/components/select/editForm/Select.edit.data.js +3 -2
- package/lib/cjs/components/selectboxes/SelectBoxes.js +2 -2
- package/lib/cjs/components/signature/Signature.d.ts +1 -1
- package/lib/cjs/components/signature/Signature.js +5 -3
- package/lib/cjs/components/signature/editForm/Signature.edit.display.d.ts +0 -6
- package/lib/cjs/components/signature/editForm/Signature.edit.display.js +0 -1
- package/lib/cjs/components/survey/Survey.js +2 -2
- package/lib/cjs/components/tabs/editForm/Tabs.edit.display.js +8 -0
- package/lib/cjs/components/tags/Tags.d.ts +1 -1
- package/lib/cjs/components/tags/Tags.js +2 -2
- package/lib/cjs/components/textarea/TextArea.js +6 -6
- package/lib/cjs/components/textarea/editForm/TextArea.edit.display.js +12 -0
- package/lib/cjs/components/url/editForm/Url.edit.display.js +12 -0
- package/lib/cjs/components/well/editForm/Well.edit.display.js +8 -0
- package/lib/cjs/formio.form.js +5 -0
- package/lib/cjs/providers/storage/googleDrive.js +3 -2
- package/lib/cjs/providers/storage/s3.js +3 -3
- package/lib/cjs/providers/storage/xhr.d.ts +1 -0
- package/lib/cjs/providers/storage/xhr.js +6 -1
- package/lib/cjs/translations/en.d.ts +234 -81
- package/lib/cjs/translations/en.js +8 -81
- package/lib/cjs/utils/ChoicesWrapper.d.ts +4 -25
- package/lib/cjs/utils/ChoicesWrapper.js +47 -124
- package/lib/cjs/utils/formUtils.d.ts +2 -2
- package/lib/cjs/utils/i18n.d.ts +5 -2
- package/lib/cjs/utils/i18n.js +32 -5
- package/lib/cjs/widgets/CalendarWidget.js +27 -27
- package/lib/mjs/CDN.d.ts +1 -1
- package/lib/mjs/CDN.js +2 -2
- package/lib/mjs/Embed.js +1 -1
- package/lib/mjs/Form.d.ts +4 -6
- package/lib/mjs/Form.js +17 -9
- package/lib/mjs/Formio.js +1 -1
- package/lib/mjs/PDFBuilder.js +4 -4
- package/lib/mjs/Webform.d.ts +16 -13
- package/lib/mjs/Webform.js +171 -158
- package/lib/mjs/WebformBuilder.js +17 -28
- package/lib/mjs/Wizard.js +1 -1
- package/lib/mjs/WizardBuilder.js +15 -2
- package/lib/mjs/components/Components.d.ts +3 -0
- package/lib/mjs/components/_classes/component/Component.d.ts +1 -0
- package/lib/mjs/components/_classes/component/Component.js +27 -11
- package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.d.ts +37 -0
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +32 -2
- package/lib/mjs/components/_classes/component/editForm/utils.d.ts +1 -0
- package/lib/mjs/components/_classes/component/editForm/utils.js +3 -0
- package/lib/mjs/components/_classes/input/Input.js +22 -1
- package/lib/mjs/components/_classes/list/ListComponent.js +4 -4
- package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +1 -1
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +10 -3
- package/lib/mjs/components/_classes/nested/NestedComponent.form.js +13 -0
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -0
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +53 -31
- package/lib/mjs/components/address/Address.js +14 -1
- package/lib/mjs/components/button/Button.js +6 -6
- package/lib/mjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/mjs/components/checkbox/Checkbox.js +2 -2
- package/lib/mjs/components/content/editForm/Content.edit.display.js +8 -0
- package/lib/mjs/components/currency/editForm/Currency.edit.display.js +12 -0
- package/lib/mjs/components/datagrid/DataGrid.d.ts +2 -0
- package/lib/mjs/components/datagrid/DataGrid.js +41 -26
- package/lib/mjs/components/day/Day.js +9 -7
- package/lib/mjs/components/day/editForm/Day.edit.display.js +8 -0
- package/lib/mjs/components/editgrid/EditGrid.d.ts +1 -1
- package/lib/mjs/components/editgrid/EditGrid.js +25 -7
- package/lib/mjs/components/email/editForm/Email.edit.display.js +12 -0
- package/lib/mjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -0
- package/lib/mjs/components/file/File.d.ts +1 -1
- package/lib/mjs/components/file/File.js +30 -19
- package/lib/mjs/components/form/Form.d.ts +1 -1
- package/lib/mjs/components/form/Form.js +8 -5
- package/lib/mjs/components/form/editForm/Form.edit.form.js +3 -3
- package/lib/mjs/components/hidden/Hidden.d.ts +0 -1
- package/lib/mjs/components/hidden/Hidden.js +1 -1
- package/lib/mjs/components/hidden/editForm/Hidden.edit.display.js +8 -0
- package/lib/mjs/components/html/editForm/HTML.edit.display.js +8 -0
- package/lib/mjs/components/number/Number.js +12 -5
- package/lib/mjs/components/number/editForm/Number.edit.display.js +12 -0
- package/lib/mjs/components/password/editForm/Password.edit.display.js +13 -1
- package/lib/mjs/components/phonenumber/PhoneNumber.form.js +9 -1
- package/lib/mjs/components/radio/Radio.js +10 -0
- package/lib/mjs/components/recaptcha/ReCaptcha.js +2 -2
- package/lib/mjs/components/select/Select.d.ts +0 -1
- package/lib/mjs/components/select/Select.js +14 -34
- package/lib/mjs/components/select/editForm/Select.edit.data.d.ts +1 -1
- package/lib/mjs/components/select/editForm/Select.edit.data.js +3 -2
- package/lib/mjs/components/selectboxes/SelectBoxes.js +2 -2
- package/lib/mjs/components/signature/Signature.d.ts +1 -1
- package/lib/mjs/components/signature/Signature.js +5 -3
- package/lib/mjs/components/signature/editForm/Signature.edit.display.d.ts +0 -6
- package/lib/mjs/components/signature/editForm/Signature.edit.display.js +0 -1
- package/lib/mjs/components/survey/Survey.js +2 -2
- package/lib/mjs/components/tabs/editForm/Tabs.edit.display.js +8 -0
- package/lib/mjs/components/tags/Tags.d.ts +1 -1
- package/lib/mjs/components/tags/Tags.js +2 -2
- package/lib/mjs/components/textarea/TextArea.js +6 -6
- package/lib/mjs/components/textarea/editForm/TextArea.edit.display.js +12 -0
- package/lib/mjs/components/url/editForm/Url.edit.display.js +12 -0
- package/lib/mjs/components/well/editForm/Well.edit.display.js +8 -0
- package/lib/mjs/formio.form.js +5 -0
- package/lib/mjs/providers/storage/googleDrive.js +3 -2
- package/lib/mjs/providers/storage/s3.js +3 -3
- package/lib/mjs/providers/storage/xhr.d.ts +1 -0
- package/lib/mjs/providers/storage/xhr.js +6 -1
- package/lib/mjs/translations/en.d.ts +234 -81
- package/lib/mjs/translations/en.js +87 -1
- package/lib/mjs/utils/ChoicesWrapper.d.ts +4 -25
- package/lib/mjs/utils/ChoicesWrapper.js +26 -119
- package/lib/mjs/utils/formUtils.d.ts +2 -2
- package/lib/mjs/utils/i18n.d.ts +5 -2
- package/lib/mjs/utils/i18n.js +32 -5
- package/lib/mjs/widgets/CalendarWidget.js +27 -27
- package/package.json +27 -11
@@ -98,12 +98,18 @@ export default class FileComponent extends Field {
|
|
98
98
|
if (this.component.privateDownload) {
|
99
99
|
fileInfo.private = true;
|
100
100
|
}
|
101
|
-
|
101
|
+
// pass the component to the downloadFile method
|
102
|
+
return this.fileService.downloadFile(fileInfo, this.component).then((result) => result.url);
|
102
103
|
}
|
103
104
|
get emptyValue() {
|
104
105
|
return [];
|
105
106
|
}
|
106
|
-
getValueAsString(value) {
|
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
|
+
}
|
107
113
|
if (_.isArray(value)) {
|
108
114
|
return _.map(value, 'originalName').join(', ');
|
109
115
|
}
|
@@ -196,7 +202,7 @@ export default class FileComponent extends Field {
|
|
196
202
|
this.videoStream = stream;
|
197
203
|
const { videoPlayer } = this.refs;
|
198
204
|
if (!videoPlayer) {
|
199
|
-
console.warn(
|
205
|
+
console.warn(this.t('videoPlayerNotFound'));
|
200
206
|
this.cameraMode = false;
|
201
207
|
this.redraw();
|
202
208
|
return;
|
@@ -221,7 +227,7 @@ export default class FileComponent extends Field {
|
|
221
227
|
takePicture() {
|
222
228
|
const { videoPlayer } = this.refs;
|
223
229
|
if (!videoPlayer) {
|
224
|
-
console.warn(
|
230
|
+
console.warn(this.t('videoPlayerNotFound'));
|
225
231
|
this.cameraMode = false;
|
226
232
|
this.redraw();
|
227
233
|
return;
|
@@ -626,7 +632,7 @@ export default class FileComponent extends Field {
|
|
626
632
|
file,
|
627
633
|
size: file.size,
|
628
634
|
status: 'info',
|
629
|
-
message: this.t('
|
635
|
+
message: this.t('waitFileProcessing'),
|
630
636
|
hash: '',
|
631
637
|
};
|
632
638
|
}
|
@@ -655,7 +661,7 @@ export default class FileComponent extends Field {
|
|
655
661
|
return fileWithSameNameUploaded || fileWithSameNameUploading
|
656
662
|
? {
|
657
663
|
status: 'error',
|
658
|
-
message: this.t(
|
664
|
+
message: this.t(fileWithSameNameUploading ? 'fileWithDuplicatedNameInProgress' : 'fileWithDuplicatedNameLoaded'),
|
659
665
|
}
|
660
666
|
: {};
|
661
667
|
}
|
@@ -664,7 +670,7 @@ export default class FileComponent extends Field {
|
|
664
670
|
if (this.component.filePattern && !this.validatePattern(file, this.component.filePattern)) {
|
665
671
|
return {
|
666
672
|
status: 'error',
|
667
|
-
message: this.t('
|
673
|
+
message: this.t('wrongFileType', {
|
668
674
|
pattern: this.component.filePattern,
|
669
675
|
}),
|
670
676
|
};
|
@@ -673,7 +679,7 @@ export default class FileComponent extends Field {
|
|
673
679
|
if (this.component.fileMinSize && !this.validateMinSize(file, this.component.fileMinSize)) {
|
674
680
|
return {
|
675
681
|
status: 'error',
|
676
|
-
message: this.t('
|
682
|
+
message: this.t('fileTooSmall', {
|
677
683
|
size: this.component.fileMinSize,
|
678
684
|
}),
|
679
685
|
};
|
@@ -682,7 +688,7 @@ export default class FileComponent extends Field {
|
|
682
688
|
if (this.component.fileMaxSize && !this.validateMaxSize(file, this.component.fileMaxSize)) {
|
683
689
|
return {
|
684
690
|
status: 'error',
|
685
|
-
message: this.t('
|
691
|
+
message: this.t('fileTooBig', {
|
686
692
|
size: this.component.fileMaxSize,
|
687
693
|
}),
|
688
694
|
};
|
@@ -694,7 +700,7 @@ export default class FileComponent extends Field {
|
|
694
700
|
return !fileService
|
695
701
|
? {
|
696
702
|
status: 'error',
|
697
|
-
message: this.t('
|
703
|
+
message: this.t('noFileService'),
|
698
704
|
}
|
699
705
|
: {};
|
700
706
|
}
|
@@ -742,7 +748,7 @@ export default class FileComponent extends Field {
|
|
742
748
|
this.fileDropHidden = false;
|
743
749
|
return {
|
744
750
|
status: 'error',
|
745
|
-
message: this.t('
|
751
|
+
message: this.t('fileProcessingFailed'),
|
746
752
|
};
|
747
753
|
}
|
748
754
|
finally {
|
@@ -776,7 +782,7 @@ export default class FileComponent extends Field {
|
|
776
782
|
return this.filesToSync.filesToUpload.push(fileToSync);
|
777
783
|
}
|
778
784
|
if (this.autoSync) {
|
779
|
-
fileToSync.message = this.t('
|
785
|
+
fileToSync.message = this.t('readyForUpload');
|
780
786
|
}
|
781
787
|
this.filesToSync.filesToUpload.push({
|
782
788
|
...fileToSync,
|
@@ -814,8 +820,8 @@ export default class FileComponent extends Field {
|
|
814
820
|
...fileInfo,
|
815
821
|
status: 'info',
|
816
822
|
message: this.autoSync
|
817
|
-
? this.t('
|
818
|
-
: this.t('
|
823
|
+
? this.t('readyForRemovingFromStorage')
|
824
|
+
: this.t('preparingFileToRemove'),
|
819
825
|
});
|
820
826
|
const index = this.dataValue.findIndex(file => file.name === fileInfo.name);
|
821
827
|
this.splice(index);
|
@@ -853,7 +859,7 @@ export default class FileComponent extends Field {
|
|
853
859
|
}
|
854
860
|
await this.deleteFile(fileToSync);
|
855
861
|
fileToSync.status = 'success';
|
856
|
-
fileToSync.message = this.t('
|
862
|
+
fileToSync.message = this.t('succefullyRemoved');
|
857
863
|
}
|
858
864
|
catch (response) {
|
859
865
|
fileToSync.status = 'error';
|
@@ -897,14 +903,17 @@ export default class FileComponent extends Field {
|
|
897
903
|
} : false;
|
898
904
|
}
|
899
905
|
async uploadFile(fileToSync) {
|
900
|
-
|
906
|
+
const filePromise = this.fileService.uploadFile(fileToSync.storage, fileToSync.file, fileToSync.name, fileToSync.dir,
|
901
907
|
// Progress callback
|
902
|
-
this.updateProgress.bind(this, fileToSync), fileToSync.url, fileToSync.options, fileToSync.fileKey, fileToSync.groupPermissions, fileToSync.groupResourceId, () => {
|
908
|
+
this.updateProgress.bind(this, fileToSync), fileToSync.url, fileToSync.options, fileToSync.fileKey, fileToSync.groupPermissions, fileToSync.groupResourceId, () => {
|
909
|
+
this.emit('fileUploadingStart', filePromise);
|
910
|
+
},
|
903
911
|
// Abort upload callback
|
904
912
|
(abort) => this.abortUploads.push({
|
905
913
|
id: fileToSync.id,
|
906
914
|
abort,
|
907
915
|
}), this.getMultipartOptions(fileToSync));
|
916
|
+
return await filePromise;
|
908
917
|
}
|
909
918
|
async upload() {
|
910
919
|
if (!this.filesToSync.filesToUpload.length) {
|
@@ -921,9 +930,10 @@ export default class FileComponent extends Field {
|
|
921
930
|
}
|
922
931
|
fileInfo = await this.uploadFile(fileToSync);
|
923
932
|
fileToSync.status = 'success';
|
924
|
-
fileToSync.message = this.t('
|
933
|
+
fileToSync.message = this.t('succefullyUploaded');
|
925
934
|
fileInfo.originalName = fileToSync.originalName;
|
926
935
|
fileInfo.hash = fileToSync.hash;
|
936
|
+
this.emit('fileUploadingEnd', Promise.resolve(fileInfo));
|
927
937
|
}
|
928
938
|
catch (response) {
|
929
939
|
fileToSync.status = 'error';
|
@@ -933,6 +943,7 @@ export default class FileComponent extends Field {
|
|
933
943
|
: response.type === 'abort'
|
934
944
|
? this.t('Request was aborted')
|
935
945
|
: response.toString();
|
946
|
+
this.emit('fileUploadingEnd', Promise.reject(response));
|
936
947
|
this.emit('fileUploadError', {
|
937
948
|
fileToSync,
|
938
949
|
response,
|
@@ -1020,7 +1031,7 @@ export default class FileComponent extends Field {
|
|
1020
1031
|
}
|
1021
1032
|
await this.syncFiles();
|
1022
1033
|
return this.shouldSyncFiles
|
1023
|
-
? Promise.reject('
|
1034
|
+
? Promise.reject(this.t('synchronizationFailed'))
|
1024
1035
|
: Promise.resolve();
|
1025
1036
|
}
|
1026
1037
|
catch (error) {
|
@@ -97,7 +97,7 @@ export default class FormComponent extends Component {
|
|
97
97
|
return this.createSubForm();
|
98
98
|
}
|
99
99
|
get dataReady() {
|
100
|
-
return this.subFormReady || Promise.resolve();
|
100
|
+
return this.subForm?.dataReady || 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.component.label || '
|
214
|
+
return super.render(this.t(this.component.label || 'nestedForm'));
|
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 '
|
227
|
+
return this.t('noDataProvided');
|
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 '
|
233
|
+
return this.t('noDataProvided');
|
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(
|
651
|
+
console.error(this.t('subformSubmissionLoadingError', { submissionId: submission._id }), err);
|
652
652
|
});
|
653
653
|
}
|
654
654
|
else {
|
@@ -663,6 +663,9 @@ 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
|
+
}
|
666
669
|
}
|
667
670
|
isEmpty(value = this.dataValue) {
|
668
671
|
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: '
|
47
|
+
valueProperty: 'revisionId',
|
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: '
|
70
|
-
tooltip: '
|
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.'
|
71
71
|
}
|
72
72
|
];
|
@@ -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('
|
57
|
+
console.warn(this.t('noDelimiterSet'));
|
58
58
|
}
|
59
59
|
this.delimiter = '';
|
60
60
|
}
|
@@ -168,14 +168,21 @@ 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(
|
171
|
+
let value;
|
172
|
+
if (!_.isNaN(input)) {
|
173
173
|
// Format scientific notation
|
174
|
-
if (/
|
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);
|
175
181
|
value = value.toExponential(this.decimalLimit);
|
176
182
|
}
|
177
183
|
else {
|
178
|
-
value =
|
184
|
+
value = parseFloat(input);
|
185
|
+
value = !_.isNaN(value) ? String(value).replace('.', this.decimalSeparator) : null;
|
179
186
|
}
|
180
187
|
}
|
181
188
|
else {
|
@@ -11,6 +11,18 @@ 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
|
+
},
|
14
26
|
{
|
15
27
|
key: 'showWordCount',
|
16
28
|
ignore: true,
|
@@ -293,6 +293,16 @@ 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);
|
296
306
|
// Set ignoreCache if it is
|
297
307
|
options.ignoreCache = this.component.ignoreCache;
|
298
308
|
// 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('
|
50
|
+
console.warn(this.t('noSiteKey'));
|
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('
|
63
|
+
console.warn(this.t('noSiteKey'));
|
64
64
|
return;
|
65
65
|
}
|
66
66
|
if (!this.recaptchaApiReady) {
|
@@ -126,7 +126,6 @@ export default class SelectComponent extends ListComponent {
|
|
126
126
|
get isLoadingAvailable(): any;
|
127
127
|
onScroll(): void;
|
128
128
|
attachRefreshOnBlur(): void;
|
129
|
-
addPlaceholderItem(placeholderValue: any): void;
|
130
129
|
update(): void;
|
131
130
|
addCurrentChoices(values: any, items: any, keyValue: any): any;
|
132
131
|
getValueAsString(data: any, options: any): any;
|
@@ -1,7 +1,6 @@
|
|
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';
|
5
4
|
import Form from '../../Form';
|
6
5
|
import { getRandomComponentId, boolValue, isPromise, componentValueTypes, getComponentSavedTypes, isSelectResourceWithObjectValue, removeHTML } from '../../utils/utils';
|
7
6
|
import Choices from '../../utils/ChoicesWrapper';
|
@@ -532,13 +531,13 @@ export default class SelectComponent extends ListComponent {
|
|
532
531
|
skip,
|
533
532
|
};
|
534
533
|
// Allow for url interpolation.
|
535
|
-
url = this.interpolate(url, {
|
534
|
+
url = this.sanitize(this.interpolate(url, {
|
536
535
|
formioBase: Formio.getBaseUrl(),
|
537
536
|
search,
|
538
537
|
limit,
|
539
538
|
skip,
|
540
539
|
page: Math.abs(Math.floor(skip / limit))
|
541
|
-
});
|
540
|
+
}), this.shouldSanitizeValue);
|
542
541
|
// Add search capability.
|
543
542
|
if (this.component.searchField && search) {
|
544
543
|
const searchValue = Array.isArray(search)
|
@@ -595,7 +594,7 @@ export default class SelectComponent extends ListComponent {
|
|
595
594
|
component: this.component,
|
596
595
|
message: err.toString(),
|
597
596
|
});
|
598
|
-
console.warn(
|
597
|
+
console.warn(this.t('loadResourcesError', { componentKey: this.key }));
|
599
598
|
}
|
600
599
|
/**
|
601
600
|
* Get the request headers for this select dropdown.
|
@@ -729,7 +728,7 @@ export default class SelectComponent extends ListComponent {
|
|
729
728
|
}
|
730
729
|
}
|
731
730
|
else if (this.component.dataSrc === 'url' || this.component.dataSrc === 'resource') {
|
732
|
-
this.addOption('', this.t('loading
|
731
|
+
this.addOption('', `${this.t('loading')}...`);
|
733
732
|
}
|
734
733
|
}
|
735
734
|
get active() {
|
@@ -773,16 +772,16 @@ export default class SelectComponent extends ListComponent {
|
|
773
772
|
removeItemButton: this.component.disabled ? false : _.get(this.component, 'removeItemButton', true),
|
774
773
|
itemSelectText: '',
|
775
774
|
classNames: {
|
776
|
-
containerOuter: 'choices form-group formio-choices',
|
777
|
-
containerInner: this.transform('class', 'form-control ui fluid selection dropdown')
|
775
|
+
containerOuter: ['choices', 'form-group', 'formio-choices'],
|
776
|
+
containerInner: this.transform('class', 'form-control ui fluid selection dropdown').split(' '),
|
778
777
|
},
|
779
778
|
addItemText: false,
|
780
779
|
allowHTML: true,
|
781
780
|
placeholder: !!this.component.placeholder,
|
782
781
|
placeholderValue: placeholderValue,
|
783
|
-
noResultsText: this.t('
|
784
|
-
noChoicesText: this.t('
|
785
|
-
searchPlaceholderValue: this.t('
|
782
|
+
noResultsText: this.t('noResultsFound'),
|
783
|
+
noChoicesText: this.t('noChoices'),
|
784
|
+
searchPlaceholderValue: this.t('typeToSearch'),
|
786
785
|
shouldSort: false,
|
787
786
|
position: (this.component.dropdown || 'auto'),
|
788
787
|
searchEnabled: useSearch,
|
@@ -802,6 +801,7 @@ export default class SelectComponent extends ListComponent {
|
|
802
801
|
}),
|
803
802
|
valueComparer: _.isEqual,
|
804
803
|
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
|
-
|
871
|
+
this.addFocusBlurEvents(this.choices.input.element);
|
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,12 +934,6 @@ 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
|
-
}
|
943
937
|
// Add value options.
|
944
938
|
this.addValueOptions();
|
945
939
|
this.setChoicesValue(this.dataValue);
|
@@ -1025,20 +1019,6 @@ export default class SelectComponent extends ListComponent {
|
|
1025
1019
|
});
|
1026
1020
|
}
|
1027
1021
|
}
|
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
|
-
}
|
1042
1022
|
/* eslint-enable max-statements */
|
1043
1023
|
update() {
|
1044
1024
|
if (this.component.dataSrc === 'custom') {
|
@@ -1219,7 +1199,7 @@ export default class SelectComponent extends ListComponent {
|
|
1219
1199
|
return normalize[dataType]().value;
|
1220
1200
|
}
|
1221
1201
|
catch (err) {
|
1222
|
-
console.warn('
|
1202
|
+
console.warn(this.t('failedToNormalize'), err);
|
1223
1203
|
return value;
|
1224
1204
|
}
|
1225
1205
|
}
|
@@ -1415,7 +1395,7 @@ export default class SelectComponent extends ListComponent {
|
|
1415
1395
|
return (JSON.stringify(normalizedOptionValue) === JSON.stringify(value));
|
1416
1396
|
}
|
1417
1397
|
catch (err) {
|
1418
|
-
console.warn.error('
|
1398
|
+
console.warn.error(this.t('failedToCompareItems'), err);
|
1419
1399
|
return false;
|
1420
1400
|
}
|
1421
1401
|
};
|
@@ -1507,7 +1487,7 @@ export default class SelectComponent extends ListComponent {
|
|
1507
1487
|
}
|
1508
1488
|
asString(value, options = {}) {
|
1509
1489
|
value = value ?? this.getValue();
|
1510
|
-
if (options.modalPreview || this.inDataTable) {
|
1490
|
+
if (options.modalPreview || this.inDataTable || options.email) {
|
1511
1491
|
if (this.inDataTable) {
|
1512
1492
|
value = this.undoValueTyping(value);
|
1513
1493
|
}
|
@@ -1099,6 +1099,7 @@ declare const _default: ({
|
|
1099
1099
|
alwaysEnabled?: undefined;
|
1100
1100
|
} | {
|
1101
1101
|
key: string;
|
1102
|
+
type: string;
|
1102
1103
|
conditional: {
|
1103
1104
|
json: {
|
1104
1105
|
and: ({
|
@@ -1149,7 +1150,6 @@ declare const _default: ({
|
|
1149
1150
|
};
|
1150
1151
|
};
|
1151
1152
|
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: '
|
639
|
-
tooltip: 'Using this option will
|
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.',
|
640
640
|
conditional: {
|
641
641
|
json: { '===': [{ var: 'data.dataSrc' }, 'resource'] },
|
642
642
|
},
|
@@ -681,6 +681,7 @@ export default [
|
|
681
681
|
},
|
682
682
|
{
|
683
683
|
key: 'selectData',
|
684
|
+
type: 'hidden',
|
684
685
|
conditional: {
|
685
686
|
json: {
|
686
687
|
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 || '
|
256
|
+
const message = this.t(this.component.maxSelectedCountMessage || 'maxSelectItems', { 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 || '
|
263
|
+
const message = this.t(this.component.minSelectedCountMessage || 'minSelectItems', { 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):
|
27
|
+
getValueAsString(value: any): string;
|
28
28
|
focus(): void;
|
29
29
|
setDataToSigaturePad(): void;
|
30
30
|
}
|