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