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