@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
@@ -109,12 +109,18 @@ class FileComponent extends Field_1.default {
|
|
109
109
|
if (this.component.privateDownload) {
|
110
110
|
fileInfo.private = true;
|
111
111
|
}
|
112
|
-
|
112
|
+
// pass the component to the downloadFile method
|
113
|
+
return this.fileService.downloadFile(fileInfo, this.component).then((result) => result.url);
|
113
114
|
}
|
114
115
|
get emptyValue() {
|
115
116
|
return [];
|
116
117
|
}
|
117
|
-
getValueAsString(value) {
|
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
|
+
}
|
118
124
|
if (lodash_1.default.isArray(value)) {
|
119
125
|
return lodash_1.default.map(value, 'originalName').join(', ');
|
120
126
|
}
|
@@ -202,7 +208,7 @@ class FileComponent extends Field_1.default {
|
|
202
208
|
this.videoStream = stream;
|
203
209
|
const { videoPlayer } = this.refs;
|
204
210
|
if (!videoPlayer) {
|
205
|
-
console.warn(
|
211
|
+
console.warn(this.t('videoPlayerNotFound'));
|
206
212
|
this.cameraMode = false;
|
207
213
|
this.redraw();
|
208
214
|
return;
|
@@ -227,7 +233,7 @@ class FileComponent extends Field_1.default {
|
|
227
233
|
takePicture() {
|
228
234
|
const { videoPlayer } = this.refs;
|
229
235
|
if (!videoPlayer) {
|
230
|
-
console.warn(
|
236
|
+
console.warn(this.t('videoPlayerNotFound'));
|
231
237
|
this.cameraMode = false;
|
232
238
|
this.redraw();
|
233
239
|
return;
|
@@ -627,7 +633,7 @@ class FileComponent extends Field_1.default {
|
|
627
633
|
file,
|
628
634
|
size: file.size,
|
629
635
|
status: 'info',
|
630
|
-
message: this.t('
|
636
|
+
message: this.t('waitFileProcessing'),
|
631
637
|
hash: '',
|
632
638
|
};
|
633
639
|
}
|
@@ -658,7 +664,7 @@ class FileComponent extends Field_1.default {
|
|
658
664
|
return fileWithSameNameUploaded || fileWithSameNameUploading
|
659
665
|
? {
|
660
666
|
status: 'error',
|
661
|
-
message: this.t(
|
667
|
+
message: this.t(fileWithSameNameUploading ? 'fileWithDuplicatedNameInProgress' : 'fileWithDuplicatedNameLoaded'),
|
662
668
|
}
|
663
669
|
: {};
|
664
670
|
}
|
@@ -667,7 +673,7 @@ class FileComponent extends Field_1.default {
|
|
667
673
|
if (this.component.filePattern && !this.validatePattern(file, this.component.filePattern)) {
|
668
674
|
return {
|
669
675
|
status: 'error',
|
670
|
-
message: this.t('
|
676
|
+
message: this.t('wrongFileType', {
|
671
677
|
pattern: this.component.filePattern,
|
672
678
|
}),
|
673
679
|
};
|
@@ -676,7 +682,7 @@ class FileComponent extends Field_1.default {
|
|
676
682
|
if (this.component.fileMinSize && !this.validateMinSize(file, this.component.fileMinSize)) {
|
677
683
|
return {
|
678
684
|
status: 'error',
|
679
|
-
message: this.t('
|
685
|
+
message: this.t('fileTooSmall', {
|
680
686
|
size: this.component.fileMinSize,
|
681
687
|
}),
|
682
688
|
};
|
@@ -685,7 +691,7 @@ class FileComponent extends Field_1.default {
|
|
685
691
|
if (this.component.fileMaxSize && !this.validateMaxSize(file, this.component.fileMaxSize)) {
|
686
692
|
return {
|
687
693
|
status: 'error',
|
688
|
-
message: this.t('
|
694
|
+
message: this.t('fileTooBig', {
|
689
695
|
size: this.component.fileMaxSize,
|
690
696
|
}),
|
691
697
|
};
|
@@ -697,7 +703,7 @@ class FileComponent extends Field_1.default {
|
|
697
703
|
return !fileService
|
698
704
|
? {
|
699
705
|
status: 'error',
|
700
|
-
message: this.t('
|
706
|
+
message: this.t('noFileService'),
|
701
707
|
}
|
702
708
|
: {};
|
703
709
|
}
|
@@ -747,7 +753,7 @@ class FileComponent extends Field_1.default {
|
|
747
753
|
this.fileDropHidden = false;
|
748
754
|
return {
|
749
755
|
status: 'error',
|
750
|
-
message: this.t('
|
756
|
+
message: this.t('fileProcessingFailed'),
|
751
757
|
};
|
752
758
|
}
|
753
759
|
finally {
|
@@ -783,7 +789,7 @@ class FileComponent extends Field_1.default {
|
|
783
789
|
return this.filesToSync.filesToUpload.push(fileToSync);
|
784
790
|
}
|
785
791
|
if (this.autoSync) {
|
786
|
-
fileToSync.message = this.t('
|
792
|
+
fileToSync.message = this.t('readyForUpload');
|
787
793
|
}
|
788
794
|
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 }));
|
789
795
|
});
|
@@ -816,8 +822,8 @@ class FileComponent extends Field_1.default {
|
|
816
822
|
}
|
817
823
|
prepareFileToDelete(fileInfo) {
|
818
824
|
this.filesToSync.filesToDelete.push(Object.assign(Object.assign({}, fileInfo), { status: 'info', message: this.autoSync
|
819
|
-
? this.t('
|
820
|
-
: this.t('
|
825
|
+
? this.t('readyForRemovingFromStorage')
|
826
|
+
: this.t('preparingFileToRemove') }));
|
821
827
|
const index = this.dataValue.findIndex(file => file.name === fileInfo.name);
|
822
828
|
this.splice(index);
|
823
829
|
this.redraw();
|
@@ -857,7 +863,7 @@ class FileComponent extends Field_1.default {
|
|
857
863
|
}
|
858
864
|
yield this.deleteFile(fileToSync);
|
859
865
|
fileToSync.status = 'success';
|
860
|
-
fileToSync.message = this.t('
|
866
|
+
fileToSync.message = this.t('succefullyRemoved');
|
861
867
|
}
|
862
868
|
catch (response) {
|
863
869
|
fileToSync.status = 'error';
|
@@ -899,14 +905,17 @@ class FileComponent extends Field_1.default {
|
|
899
905
|
}
|
900
906
|
uploadFile(fileToSync) {
|
901
907
|
return __awaiter(this, void 0, void 0, function* () {
|
902
|
-
|
908
|
+
const filePromise = this.fileService.uploadFile(fileToSync.storage, fileToSync.file, fileToSync.name, fileToSync.dir,
|
903
909
|
// Progress callback
|
904
|
-
this.updateProgress.bind(this, fileToSync), fileToSync.url, fileToSync.options, fileToSync.fileKey, fileToSync.groupPermissions, fileToSync.groupResourceId, () => {
|
910
|
+
this.updateProgress.bind(this, fileToSync), fileToSync.url, fileToSync.options, fileToSync.fileKey, fileToSync.groupPermissions, fileToSync.groupResourceId, () => {
|
911
|
+
this.emit('fileUploadingStart', filePromise);
|
912
|
+
},
|
905
913
|
// Abort upload callback
|
906
914
|
(abort) => this.abortUploads.push({
|
907
915
|
id: fileToSync.id,
|
908
916
|
abort,
|
909
917
|
}), this.getMultipartOptions(fileToSync));
|
918
|
+
return yield filePromise;
|
910
919
|
});
|
911
920
|
}
|
912
921
|
upload() {
|
@@ -925,9 +934,10 @@ class FileComponent extends Field_1.default {
|
|
925
934
|
}
|
926
935
|
fileInfo = yield this.uploadFile(fileToSync);
|
927
936
|
fileToSync.status = 'success';
|
928
|
-
fileToSync.message = this.t('
|
937
|
+
fileToSync.message = this.t('succefullyUploaded');
|
929
938
|
fileInfo.originalName = fileToSync.originalName;
|
930
939
|
fileInfo.hash = fileToSync.hash;
|
940
|
+
this.emit('fileUploadingEnd', Promise.resolve(fileInfo));
|
931
941
|
}
|
932
942
|
catch (response) {
|
933
943
|
fileToSync.status = 'error';
|
@@ -937,6 +947,7 @@ class FileComponent extends Field_1.default {
|
|
937
947
|
: response.type === 'abort'
|
938
948
|
? this.t('Request was aborted')
|
939
949
|
: response.toString();
|
950
|
+
this.emit('fileUploadingEnd', Promise.reject(response));
|
940
951
|
this.emit('fileUploadError', {
|
941
952
|
fileToSync,
|
942
953
|
response,
|
@@ -1028,7 +1039,7 @@ class FileComponent extends Field_1.default {
|
|
1028
1039
|
}
|
1029
1040
|
yield this.syncFiles();
|
1030
1041
|
return this.shouldSyncFiles
|
1031
|
-
? Promise.reject('
|
1042
|
+
? Promise.reject(this.t('synchronizationFailed'))
|
1032
1043
|
: Promise.resolve();
|
1033
1044
|
}
|
1034
1045
|
catch (error) {
|
@@ -102,7 +102,8 @@ class FormComponent extends Component_1.default {
|
|
102
102
|
return this.createSubForm();
|
103
103
|
}
|
104
104
|
get dataReady() {
|
105
|
-
|
105
|
+
var _a;
|
106
|
+
return ((_a = this.subForm) === null || _a === void 0 ? void 0 : _a.dataReady) || this.subFormReady || Promise.resolve();
|
106
107
|
}
|
107
108
|
get defaultValue() {
|
108
109
|
// Not not provide a default value unless the subform is ready so that it will initialize correctly.
|
@@ -217,7 +218,7 @@ class FormComponent extends Component_1.default {
|
|
217
218
|
/* eslint-enable max-statements */
|
218
219
|
render() {
|
219
220
|
if (this.builderMode) {
|
220
|
-
return super.render(this.component.label || '
|
221
|
+
return super.render(this.t(this.component.label || 'nestedForm'));
|
221
222
|
}
|
222
223
|
const subform = this.subForm ? this.subForm.render() : this.renderTemplate('loading');
|
223
224
|
return super.render(subform);
|
@@ -230,13 +231,13 @@ class FormComponent extends Component_1.default {
|
|
230
231
|
*/
|
231
232
|
getValueAsString(value, options) {
|
232
233
|
if (!value) {
|
233
|
-
return '
|
234
|
+
return this.t('noDataProvided');
|
234
235
|
}
|
235
236
|
if (!value.data && value._id) {
|
236
237
|
return value._id;
|
237
238
|
}
|
238
239
|
if (!value.data || !Object.keys(value.data).length) {
|
239
|
-
return '
|
240
|
+
return this.t('noDataProvided');
|
240
241
|
}
|
241
242
|
if (options === null || options === void 0 ? void 0 : options.email) {
|
242
243
|
let result = (`
|
@@ -658,7 +659,7 @@ class FormComponent extends Component_1.default {
|
|
658
659
|
: {};
|
659
660
|
this.subForm.setUrl(submissionUrl, Object.assign(Object.assign({}, this.options), options));
|
660
661
|
this.subForm.loadSubmission().catch((err) => {
|
661
|
-
console.error(
|
662
|
+
console.error(this.t('subformSubmissionLoadingError', { submissionId: submission._id }), err);
|
662
663
|
});
|
663
664
|
}
|
664
665
|
else {
|
@@ -673,6 +674,9 @@ class FormComponent extends Component_1.default {
|
|
673
674
|
*/
|
674
675
|
onSetSubFormValue(submission, flags) {
|
675
676
|
this.subForm.setValue(submission, flags);
|
677
|
+
if (flags === null || flags === void 0 ? void 0 : flags.fromSubmission) {
|
678
|
+
this.subForm.submissionReadyResolve(submission);
|
679
|
+
}
|
676
680
|
}
|
677
681
|
isEmpty(value = this.dataValue) {
|
678
682
|
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: '
|
50
|
+
valueProperty: 'revisionId',
|
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: '
|
73
|
-
tooltip: '
|
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.'
|
74
74
|
}
|
75
75
|
];
|
@@ -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('
|
59
|
+
console.warn(this.t('noDelimiterSet'));
|
60
60
|
}
|
61
61
|
this.delimiter = '';
|
62
62
|
}
|
@@ -170,14 +170,21 @@ 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(
|
173
|
+
let value;
|
174
|
+
if (!lodash_1.default.isNaN(input)) {
|
175
175
|
// Format scientific notation
|
176
|
-
if (/
|
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);
|
177
183
|
value = value.toExponential(this.decimalLimit);
|
178
184
|
}
|
179
185
|
else {
|
180
|
-
value =
|
186
|
+
value = parseFloat(input);
|
187
|
+
value = !lodash_1.default.isNaN(value) ? String(value).replace('.', this.decimalSeparator) : null;
|
181
188
|
}
|
182
189
|
}
|
183
190
|
else {
|
@@ -13,6 +13,18 @@ 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
|
+
},
|
16
28
|
{
|
17
29
|
key: 'showWordCount',
|
18
30
|
ignore: true,
|
@@ -293,6 +293,16 @@ 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);
|
296
306
|
// Set ignoreCache if it is
|
297
307
|
options.ignoreCache = this.component.ignoreCache;
|
298
308
|
// 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('
|
61
|
+
console.warn(this.t('noSiteKey'));
|
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('
|
75
|
+
console.warn(this.t('noSiteKey'));
|
76
76
|
return;
|
77
77
|
}
|
78
78
|
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;
|
@@ -6,7 +6,6 @@ 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"));
|
10
9
|
const Form_1 = __importDefault(require("../../Form"));
|
11
10
|
const utils_1 = require("../../utils/utils");
|
12
11
|
const ChoicesWrapper_1 = __importDefault(require("../../utils/ChoicesWrapper"));
|
@@ -530,13 +529,13 @@ class SelectComponent extends ListComponent_1.default {
|
|
530
529
|
skip,
|
531
530
|
};
|
532
531
|
// Allow for url interpolation.
|
533
|
-
url = this.interpolate(url, {
|
532
|
+
url = this.sanitize(this.interpolate(url, {
|
534
533
|
formioBase: Formio_1.Formio.getBaseUrl(),
|
535
534
|
search,
|
536
535
|
limit,
|
537
536
|
skip,
|
538
537
|
page: Math.abs(Math.floor(skip / limit))
|
539
|
-
});
|
538
|
+
}), this.shouldSanitizeValue);
|
540
539
|
// Add search capability.
|
541
540
|
if (this.component.searchField && search) {
|
542
541
|
const searchValue = Array.isArray(search)
|
@@ -593,7 +592,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
593
592
|
component: this.component,
|
594
593
|
message: err.toString(),
|
595
594
|
});
|
596
|
-
console.warn(
|
595
|
+
console.warn(this.t('loadResourcesError', { componentKey: this.key }));
|
597
596
|
}
|
598
597
|
/**
|
599
598
|
* Get the request headers for this select dropdown.
|
@@ -727,7 +726,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
727
726
|
}
|
728
727
|
}
|
729
728
|
else if (this.component.dataSrc === 'url' || this.component.dataSrc === 'resource') {
|
730
|
-
this.addOption('', this.t('loading
|
729
|
+
this.addOption('', `${this.t('loading')}...`);
|
731
730
|
}
|
732
731
|
}
|
733
732
|
get active() {
|
@@ -768,10 +767,10 @@ class SelectComponent extends ListComponent_1.default {
|
|
768
767
|
distance: 1000,
|
769
768
|
};
|
770
769
|
return Object.assign({ removeItemButton: this.component.disabled ? false : lodash_1.default.get(this.component, 'removeItemButton', true), itemSelectText: '', classNames: {
|
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('
|
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);
|
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);
|
775
774
|
}
|
776
775
|
/* eslint-disable max-statements */
|
777
776
|
attach(element) {
|
@@ -837,7 +836,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
837
836
|
this.choices.containerOuter.element.setAttribute('tabIndex', '-1');
|
838
837
|
this.addEventListener(this.choices.containerOuter.element, 'focus', () => this.focusableElement.focus());
|
839
838
|
}
|
840
|
-
|
839
|
+
this.addFocusBlurEvents(this.choices.input.element);
|
841
840
|
if (this.itemsFromUrl && !this.component.noRefreshOnScroll) {
|
842
841
|
this.scrollList = this.choices.choiceList.element;
|
843
842
|
this.addEventListener(this.scrollList, 'scroll', () => this.onScroll());
|
@@ -903,12 +902,6 @@ class SelectComponent extends ListComponent_1.default {
|
|
903
902
|
this.positionDropdown();
|
904
903
|
});
|
905
904
|
}
|
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
|
-
}
|
912
905
|
// Add value options.
|
913
906
|
this.addValueOptions();
|
914
907
|
this.setChoicesValue(this.dataValue);
|
@@ -996,20 +989,6 @@ class SelectComponent extends ListComponent_1.default {
|
|
996
989
|
});
|
997
990
|
}
|
998
991
|
}
|
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
|
-
}
|
1013
992
|
/* eslint-enable max-statements */
|
1014
993
|
update() {
|
1015
994
|
if (this.component.dataSrc === 'custom') {
|
@@ -1190,7 +1169,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
1190
1169
|
return normalize[dataType]().value;
|
1191
1170
|
}
|
1192
1171
|
catch (err) {
|
1193
|
-
console.warn('
|
1172
|
+
console.warn(this.t('failedToNormalize'), err);
|
1194
1173
|
return value;
|
1195
1174
|
}
|
1196
1175
|
}
|
@@ -1387,7 +1366,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
1387
1366
|
return (JSON.stringify(normalizedOptionValue) === JSON.stringify(value));
|
1388
1367
|
}
|
1389
1368
|
catch (err) {
|
1390
|
-
console.warn.error('
|
1369
|
+
console.warn.error(this.t('failedToCompareItems'), err);
|
1391
1370
|
return false;
|
1392
1371
|
}
|
1393
1372
|
};
|
@@ -1480,7 +1459,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
1480
1459
|
asString(value, options = {}) {
|
1481
1460
|
var _a;
|
1482
1461
|
value = value !== null && value !== void 0 ? value : this.getValue();
|
1483
|
-
if (options.modalPreview || this.inDataTable) {
|
1462
|
+
if (options.modalPreview || this.inDataTable || options.email) {
|
1484
1463
|
if (this.inDataTable) {
|
1485
1464
|
value = this.undoValueTyping(value);
|
1486
1465
|
}
|
@@ -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;
|
@@ -641,8 +641,8 @@ exports.default = [
|
|
641
641
|
input: true,
|
642
642
|
weight: 25,
|
643
643
|
key: 'reference',
|
644
|
-
label: '
|
645
|
-
tooltip: 'Using this option will
|
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.',
|
646
646
|
conditional: {
|
647
647
|
json: { '===': [{ var: 'data.dataSrc' }, 'resource'] },
|
648
648
|
},
|
@@ -687,6 +687,7 @@ exports.default = [
|
|
687
687
|
},
|
688
688
|
{
|
689
689
|
key: 'selectData',
|
690
|
+
type: 'hidden',
|
690
691
|
conditional: {
|
691
692
|
json: {
|
692
693
|
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 || '
|
255
|
+
const message = this.t(this.component.maxSelectedCountMessage || 'maxSelectItems', { 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 || '
|
262
|
+
const message = this.t(this.component.minSelectedCountMessage || 'minSelectItems', { 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):
|
27
|
+
getValueAsString(value: any): string;
|
28
28
|
focus(): void;
|
29
29
|
setDataToSigaturePad(): void;
|
30
30
|
}
|