@formio/js 5.4.1 → 5.4.2
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/README.md +11 -5
- package/dist/formio.builder.css +1 -0
- 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 +1 -0
- package/dist/formio.form.js +131 -109
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +2 -2
- package/dist/formio.full.css +1 -0
- package/dist/formio.full.js +155 -133
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +2 -2
- package/dist/formio.js +26 -26
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +2 -2
- package/dist/formio.utils.js +19 -19
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -2
- package/lib/cjs/Embed.js +8 -16
- package/lib/cjs/Form.js +4 -4
- package/lib/cjs/Formio.js +2 -9
- package/lib/cjs/InlineEmbed.js +1 -4
- package/lib/cjs/PDF.js +28 -8
- package/lib/cjs/PDFBuilder.js +6 -10
- package/lib/cjs/Webform.d.ts +1 -0
- package/lib/cjs/Webform.js +19 -34
- package/lib/cjs/WebformBuilder.js +27 -68
- package/lib/cjs/Wizard.d.ts +1 -0
- package/lib/cjs/Wizard.js +44 -31
- package/lib/cjs/WizardBuilder.js +5 -15
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.form.js +2 -6
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +3 -9
- package/lib/cjs/addons/index.js +1 -3
- package/lib/cjs/components/_classes/component/Component.d.ts +5 -5
- package/lib/cjs/components/_classes/component/Component.js +60 -132
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +2 -4
- package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +4 -16
- package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +1 -4
- package/lib/cjs/components/_classes/field/Field.js +1 -4
- package/lib/cjs/components/_classes/input/Input.js +2 -2
- package/lib/cjs/components/_classes/list/ListComponent.js +4 -4
- package/lib/cjs/components/_classes/list/editForm/ListComponent.edit.data.js +6 -28
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +8 -26
- package/lib/cjs/components/_classes/nested/NestedComponent.js +1 -4
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +5 -9
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +1 -3
- package/lib/cjs/components/address/Address.js +10 -30
- package/lib/cjs/components/address/editForm/Address.edit.provider.js +8 -32
- package/lib/cjs/components/alert/Alert.js +3 -6
- package/lib/cjs/components/button/Button.js +10 -17
- package/lib/cjs/components/button/editForm/Button.edit.display.js +8 -32
- package/lib/cjs/components/checkbox/Checkbox.js +4 -10
- package/lib/cjs/components/checkbox/editForm/Checkbox.edit.display.js +2 -8
- package/lib/cjs/components/columns/Columns.js +5 -17
- package/lib/cjs/components/container/Container.js +1 -3
- package/lib/cjs/components/currency/Currency.js +2 -7
- package/lib/cjs/components/datagrid/DataGrid.js +23 -63
- package/lib/cjs/components/datamap/DataMap.js +4 -16
- package/lib/cjs/components/datetime/DateTime.js +2 -6
- package/lib/cjs/components/datetime/editForm/DateTime.edit.display.js +1 -4
- package/lib/cjs/components/day/Day.js +12 -70
- package/lib/cjs/components/day/editForm/Day.edit.day.js +1 -3
- package/lib/cjs/components/day/editForm/Day.edit.month.js +1 -3
- package/lib/cjs/components/editgrid/EditGrid.d.ts +1 -0
- package/lib/cjs/components/editgrid/EditGrid.js +18 -44
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -4
- package/lib/cjs/components/file/File.js +40 -70
- package/lib/cjs/components/file/editForm/File.edit.display.js +1 -5
- package/lib/cjs/components/file/editForm/File.edit.file.js +8 -30
- package/lib/cjs/components/form/Form.js +5 -7
- package/lib/cjs/components/html/HTML.js +1 -5
- package/lib/cjs/components/number/Number.js +2 -4
- package/lib/cjs/components/panel/editForm/Panel.edit.display.js +3 -12
- package/lib/cjs/components/password/Password.js +1 -4
- package/lib/cjs/components/radio/Radio.js +7 -17
- package/lib/cjs/components/radio/editForm/Radio.edit.data.js +4 -14
- package/lib/cjs/components/recaptcha/ReCaptcha.js +3 -6
- package/lib/cjs/components/select/Select.js +48 -92
- package/lib/cjs/components/select/editForm/Select.edit.data.js +37 -182
- package/lib/cjs/components/select/editForm/Select.edit.validation.js +1 -9
- package/lib/cjs/components/selectboxes/SelectBoxes.js +3 -6
- package/lib/cjs/components/signature/Signature.d.ts +1 -1
- package/lib/cjs/components/signature/Signature.js +5 -10
- package/lib/cjs/components/signature/editForm/Signature.edit.display.js +2 -6
- package/lib/cjs/components/survey/Survey.js +6 -17
- package/lib/cjs/components/survey/editForm/Survey.edit.data.js +4 -12
- package/lib/cjs/components/table/editForm/Table.edit.display.js +3 -3
- package/lib/cjs/components/tabs/Tabs.js +4 -19
- package/lib/cjs/components/tabs/editForm/Tabs.edit.display.js +1 -3
- package/lib/cjs/components/tags/Tags.js +4 -14
- package/lib/cjs/components/textarea/TextArea.js +8 -15
- package/lib/cjs/components/textarea/editForm/TextArea.edit.display.js +14 -56
- package/lib/cjs/components/textfield/TextField.js +4 -4
- package/lib/cjs/components/textfield/editForm/TextField.edit.display.js +2 -8
- package/lib/cjs/components/time/Time.js +1 -4
- package/lib/cjs/components/time/editForm/Time.edit.display.js +1 -4
- package/lib/cjs/formio.form.js +5 -5
- package/lib/cjs/package.json +1 -1
- package/lib/cjs/providers/address/AddressProvider.js +1 -1
- package/lib/cjs/providers/address/GoogleAddressProvider.js +1 -3
- package/lib/cjs/providers/processor/fileProcessor.js +1 -3
- package/lib/cjs/providers/storage/azure.js +5 -6
- package/lib/cjs/providers/storage/indexeddb.js +5 -15
- package/lib/cjs/providers/storage/s3.js +3 -14
- package/lib/cjs/providers/storage/xhr.js +19 -28
- package/lib/cjs/templates/Templates.js +1 -0
- package/lib/cjs/translations/en.d.ts +237 -82
- package/lib/cjs/translations/en.js +9 -82
- package/lib/cjs/utils/ChoicesWrapper.js +1 -1
- package/lib/cjs/utils/builder.js +5 -26
- package/lib/cjs/utils/i18n.d.ts +5 -2
- package/lib/cjs/utils/i18n.js +33 -12
- package/lib/cjs/utils/utils.js +37 -47
- package/lib/cjs/widgets/CalendarWidget.js +2 -6
- package/lib/mjs/Embed.js +8 -16
- package/lib/mjs/Form.js +4 -4
- package/lib/mjs/Formio.js +2 -9
- package/lib/mjs/InlineEmbed.js +1 -4
- package/lib/mjs/PDF.js +27 -8
- package/lib/mjs/PDFBuilder.js +6 -10
- package/lib/mjs/Webform.d.ts +1 -0
- package/lib/mjs/Webform.js +19 -31
- package/lib/mjs/WebformBuilder.js +27 -68
- package/lib/mjs/Wizard.d.ts +1 -0
- package/lib/mjs/Wizard.js +39 -27
- package/lib/mjs/WizardBuilder.js +5 -15
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.form.js +2 -6
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +3 -9
- package/lib/mjs/addons/index.js +1 -3
- package/lib/mjs/components/_classes/component/Component.d.ts +5 -5
- package/lib/mjs/components/_classes/component/Component.js +59 -132
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +2 -4
- package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +4 -16
- package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +1 -4
- package/lib/mjs/components/_classes/field/Field.js +1 -4
- package/lib/mjs/components/_classes/input/Input.js +2 -2
- package/lib/mjs/components/_classes/list/ListComponent.js +4 -4
- package/lib/mjs/components/_classes/list/editForm/ListComponent.edit.data.js +6 -28
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +8 -26
- package/lib/mjs/components/_classes/nested/NestedComponent.js +1 -4
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +5 -9
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +1 -3
- package/lib/mjs/components/address/Address.js +10 -30
- package/lib/mjs/components/address/editForm/Address.edit.provider.js +8 -32
- package/lib/mjs/components/alert/Alert.js +3 -6
- package/lib/mjs/components/button/Button.js +9 -16
- package/lib/mjs/components/button/editForm/Button.edit.display.js +8 -32
- package/lib/mjs/components/checkbox/Checkbox.js +4 -10
- package/lib/mjs/components/checkbox/editForm/Checkbox.edit.display.js +2 -8
- package/lib/mjs/components/columns/Columns.js +5 -17
- package/lib/mjs/components/container/Container.js +1 -3
- package/lib/mjs/components/currency/Currency.js +2 -7
- package/lib/mjs/components/datagrid/DataGrid.js +23 -63
- package/lib/mjs/components/datamap/DataMap.js +12 -18
- package/lib/mjs/components/datetime/DateTime.js +2 -6
- package/lib/mjs/components/datetime/editForm/DateTime.edit.display.js +1 -4
- package/lib/mjs/components/day/Day.js +12 -70
- package/lib/mjs/components/day/editForm/Day.edit.day.js +1 -3
- package/lib/mjs/components/day/editForm/Day.edit.month.js +1 -3
- package/lib/mjs/components/editgrid/EditGrid.d.ts +1 -0
- package/lib/mjs/components/editgrid/EditGrid.js +18 -44
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -4
- package/lib/mjs/components/file/File.js +40 -70
- package/lib/mjs/components/file/editForm/File.edit.display.js +1 -5
- package/lib/mjs/components/file/editForm/File.edit.file.js +8 -30
- package/lib/mjs/components/form/Form.js +5 -7
- package/lib/mjs/components/html/HTML.js +1 -5
- package/lib/mjs/components/number/Number.js +2 -4
- package/lib/mjs/components/panel/editForm/Panel.edit.display.js +3 -12
- package/lib/mjs/components/password/Password.js +1 -4
- package/lib/mjs/components/radio/Radio.js +7 -17
- package/lib/mjs/components/radio/editForm/Radio.edit.data.js +4 -14
- package/lib/mjs/components/recaptcha/ReCaptcha.js +3 -6
- package/lib/mjs/components/select/Select.js +51 -95
- package/lib/mjs/components/select/editForm/Select.edit.data.js +37 -182
- package/lib/mjs/components/select/editForm/Select.edit.validation.js +1 -9
- package/lib/mjs/components/selectboxes/SelectBoxes.js +3 -6
- package/lib/mjs/components/signature/Signature.d.ts +1 -1
- package/lib/mjs/components/signature/Signature.js +5 -10
- package/lib/mjs/components/signature/editForm/Signature.edit.display.js +2 -6
- package/lib/mjs/components/survey/Survey.js +6 -17
- package/lib/mjs/components/survey/editForm/Survey.edit.data.js +4 -12
- package/lib/mjs/components/table/editForm/Table.edit.display.js +3 -3
- package/lib/mjs/components/tabs/Tabs.js +4 -19
- package/lib/mjs/components/tabs/editForm/Tabs.edit.display.js +1 -3
- package/lib/mjs/components/tags/Tags.js +4 -14
- package/lib/mjs/components/textarea/TextArea.js +8 -15
- package/lib/mjs/components/textarea/editForm/TextArea.edit.display.js +14 -56
- package/lib/mjs/components/textfield/TextField.js +4 -4
- package/lib/mjs/components/textfield/editForm/TextField.edit.display.js +2 -8
- package/lib/mjs/components/time/Time.js +1 -4
- package/lib/mjs/components/time/editForm/Time.edit.display.js +1 -4
- package/lib/mjs/formio.form.js +6 -6
- package/lib/mjs/package.json +1 -1
- package/lib/mjs/providers/address/AddressProvider.js +1 -1
- package/lib/mjs/providers/address/GoogleAddressProvider.js +1 -3
- package/lib/mjs/providers/processor/fileProcessor.js +1 -3
- package/lib/mjs/providers/storage/azure.js +5 -6
- package/lib/mjs/providers/storage/indexeddb.js +5 -15
- package/lib/mjs/providers/storage/s3.js +3 -14
- package/lib/mjs/providers/storage/xhr.js +19 -32
- package/lib/mjs/templates/Templates.js +1 -0
- package/lib/mjs/translations/en.d.ts +237 -82
- package/lib/mjs/translations/en.js +88 -0
- package/lib/mjs/utils/ChoicesWrapper.js +1 -1
- package/lib/mjs/utils/builder.js +5 -26
- package/lib/mjs/utils/i18n.d.ts +5 -2
- package/lib/mjs/utils/i18n.js +33 -12
- package/lib/mjs/utils/utils.js +37 -47
- package/lib/mjs/widgets/CalendarWidget.js +2 -6
- package/package.json +6 -4
|
@@ -23,9 +23,7 @@ if (htmlCanvasElement && !htmlCanvasElement.prototype.toBlob) {
|
|
|
23
23
|
for (var i = 0; i < len; i++) {
|
|
24
24
|
arr[i] = binStr.charCodeAt(i);
|
|
25
25
|
}
|
|
26
|
-
callback(new Blob([
|
|
27
|
-
arr,
|
|
28
|
-
], { type: type || 'image/png' }));
|
|
26
|
+
callback(new Blob([arr], { type: type || 'image/png' }));
|
|
29
27
|
});
|
|
30
28
|
},
|
|
31
29
|
});
|
|
@@ -62,17 +60,12 @@ export default class FileComponent extends Field {
|
|
|
62
60
|
static get conditionOperatorsSettings() {
|
|
63
61
|
return {
|
|
64
62
|
...super.conditionOperatorsSettings,
|
|
65
|
-
operators: [
|
|
66
|
-
'isEmpty',
|
|
67
|
-
'isNotEmpty',
|
|
68
|
-
],
|
|
63
|
+
operators: ['isEmpty', 'isNotEmpty'],
|
|
69
64
|
};
|
|
70
65
|
}
|
|
71
66
|
static savedValueTypes(schema) {
|
|
72
67
|
schema = schema || {};
|
|
73
|
-
return
|
|
74
|
-
componentValueTypes.object,
|
|
75
|
-
]);
|
|
68
|
+
return getComponentSavedTypes(schema) || [componentValueTypes.object];
|
|
76
69
|
}
|
|
77
70
|
init() {
|
|
78
71
|
super.init();
|
|
@@ -213,7 +206,7 @@ export default class FileComponent extends Field {
|
|
|
213
206
|
this.videoStream = stream;
|
|
214
207
|
const { videoPlayer } = this.refs;
|
|
215
208
|
if (!videoPlayer) {
|
|
216
|
-
console.warn(
|
|
209
|
+
console.warn(this.t('videoPlayerNotFound'));
|
|
217
210
|
this.cameraMode = false;
|
|
218
211
|
this.redraw();
|
|
219
212
|
return;
|
|
@@ -238,16 +231,14 @@ export default class FileComponent extends Field {
|
|
|
238
231
|
takePicture() {
|
|
239
232
|
const { videoPlayer } = this.refs;
|
|
240
233
|
if (!videoPlayer) {
|
|
241
|
-
console.warn(
|
|
234
|
+
console.warn(this.t('videoPlayerNotFound'));
|
|
242
235
|
this.cameraMode = false;
|
|
243
236
|
this.redraw();
|
|
244
237
|
return;
|
|
245
238
|
}
|
|
246
239
|
this.getFrame(videoPlayer).then((frame) => {
|
|
247
240
|
frame.name = `photo-${Date.now()}.png`;
|
|
248
|
-
this.handleFilesToUpload([
|
|
249
|
-
frame,
|
|
250
|
-
]);
|
|
241
|
+
this.handleFilesToUpload([frame]);
|
|
251
242
|
this.cameraMode = false;
|
|
252
243
|
this.redraw();
|
|
253
244
|
});
|
|
@@ -426,13 +417,9 @@ export default class FileComponent extends Field {
|
|
|
426
417
|
fileEntry.file((file) => {
|
|
427
418
|
const reader = new FileReader();
|
|
428
419
|
reader.onloadend = (evt) => {
|
|
429
|
-
const blob = new Blob([
|
|
430
|
-
new Uint8Array(evt.target.result),
|
|
431
|
-
], { type: file.type });
|
|
420
|
+
const blob = new Blob([new Uint8Array(evt.target.result)], { type: file.type });
|
|
432
421
|
blob.name = file.name;
|
|
433
|
-
this.handleFilesToUpload([
|
|
434
|
-
blob,
|
|
435
|
-
]);
|
|
422
|
+
this.handleFilesToUpload([blob]);
|
|
436
423
|
};
|
|
437
424
|
reader.readAsArrayBuffer(file);
|
|
438
425
|
});
|
|
@@ -452,13 +439,9 @@ export default class FileComponent extends Field {
|
|
|
452
439
|
fileEntry.file((file) => {
|
|
453
440
|
const reader = new FileReader();
|
|
454
441
|
reader.onloadend = (evt) => {
|
|
455
|
-
const blob = new Blob([
|
|
456
|
-
new Uint8Array(evt.target.result),
|
|
457
|
-
], { type: file.type });
|
|
442
|
+
const blob = new Blob([new Uint8Array(evt.target.result)], { type: file.type });
|
|
458
443
|
blob.name = file.name;
|
|
459
|
-
this.handleFilesToUpload([
|
|
460
|
-
blob,
|
|
461
|
-
]);
|
|
444
|
+
this.handleFilesToUpload([blob]);
|
|
462
445
|
};
|
|
463
446
|
reader.readAsArrayBuffer(file);
|
|
464
447
|
});
|
|
@@ -629,7 +612,7 @@ export default class FileComponent extends Field {
|
|
|
629
612
|
if (!target.id) {
|
|
630
613
|
return;
|
|
631
614
|
}
|
|
632
|
-
const [action, id
|
|
615
|
+
const [action, id] = target.id.split('-');
|
|
633
616
|
if (!action || !id || !this.actions[action]) {
|
|
634
617
|
return;
|
|
635
618
|
}
|
|
@@ -654,7 +637,7 @@ export default class FileComponent extends Field {
|
|
|
654
637
|
file,
|
|
655
638
|
size: file.size,
|
|
656
639
|
status: 'info',
|
|
657
|
-
message: this.t('
|
|
640
|
+
message: this.t('waitFileProcessing'),
|
|
658
641
|
hash: '',
|
|
659
642
|
};
|
|
660
643
|
}
|
|
@@ -682,7 +665,7 @@ export default class FileComponent extends Field {
|
|
|
682
665
|
return fileWithSameNameUploaded || fileWithSameNameUploading
|
|
683
666
|
? {
|
|
684
667
|
status: 'error',
|
|
685
|
-
message: this.t(
|
|
668
|
+
message: this.t(fileWithSameNameUploading ? 'fileWithDuplicatedNameInProgress' : 'fileWithDuplicatedNameLoaded'),
|
|
686
669
|
}
|
|
687
670
|
: {};
|
|
688
671
|
}
|
|
@@ -691,7 +674,7 @@ export default class FileComponent extends Field {
|
|
|
691
674
|
if (this.component.filePattern && !this.validatePattern(file, this.component.filePattern)) {
|
|
692
675
|
return {
|
|
693
676
|
status: 'error',
|
|
694
|
-
message: this.t('
|
|
677
|
+
message: this.t('wrongFileType', {
|
|
695
678
|
pattern: this.component.filePattern,
|
|
696
679
|
}),
|
|
697
680
|
};
|
|
@@ -704,7 +687,7 @@ export default class FileComponent extends Field {
|
|
|
704
687
|
if (!interpolatedMinSize) {
|
|
705
688
|
return {
|
|
706
689
|
status: 'error',
|
|
707
|
-
message: '
|
|
690
|
+
message: this.t('checkEnteredParameters'),
|
|
708
691
|
};
|
|
709
692
|
}
|
|
710
693
|
if (!this.validateMinSize(file, interpolatedMinSize)) {
|
|
@@ -722,7 +705,7 @@ export default class FileComponent extends Field {
|
|
|
722
705
|
if (!interpolatedMaxSize) {
|
|
723
706
|
return {
|
|
724
707
|
status: 'error',
|
|
725
|
-
message: '
|
|
708
|
+
message: this.t('checkEnteredParameters'),
|
|
726
709
|
};
|
|
727
710
|
}
|
|
728
711
|
if (!this.validateMaxSize(file, interpolatedMaxSize)) {
|
|
@@ -741,7 +724,7 @@ export default class FileComponent extends Field {
|
|
|
741
724
|
return !fileService
|
|
742
725
|
? {
|
|
743
726
|
status: 'error',
|
|
744
|
-
message: this.t('
|
|
727
|
+
message: this.t('noFileService'),
|
|
745
728
|
}
|
|
746
729
|
: {};
|
|
747
730
|
}
|
|
@@ -771,11 +754,7 @@ export default class FileComponent extends Field {
|
|
|
771
754
|
]
|
|
772
755
|
: element.component.submissionAccess;
|
|
773
756
|
groupPermissions.forEach((permission) => {
|
|
774
|
-
groupKey = [
|
|
775
|
-
'admin',
|
|
776
|
-
'write',
|
|
777
|
-
'create',
|
|
778
|
-
].includes(permission.type)
|
|
757
|
+
groupKey = ['admin', 'write', 'create'].includes(permission.type)
|
|
779
758
|
? element.component.key
|
|
780
759
|
: null;
|
|
781
760
|
});
|
|
@@ -797,7 +776,7 @@ export default class FileComponent extends Field {
|
|
|
797
776
|
this.fileDropHidden = false;
|
|
798
777
|
return {
|
|
799
778
|
status: 'error',
|
|
800
|
-
message: this.t('
|
|
779
|
+
message: this.t('fileProcessingFailed'),
|
|
801
780
|
};
|
|
802
781
|
}
|
|
803
782
|
finally {
|
|
@@ -831,7 +810,7 @@ export default class FileComponent extends Field {
|
|
|
831
810
|
return this.filesToSync.filesToUpload.push(fileToSync);
|
|
832
811
|
}
|
|
833
812
|
if (this.autoSync) {
|
|
834
|
-
fileToSync.message = this.t('
|
|
813
|
+
fileToSync.message = this.t('readyForUpload');
|
|
835
814
|
}
|
|
836
815
|
this.filesToSync.filesToUpload.push({
|
|
837
816
|
...fileToSync,
|
|
@@ -849,9 +828,7 @@ export default class FileComponent extends Field {
|
|
|
849
828
|
}
|
|
850
829
|
if (this.component.storage && files && files.length) {
|
|
851
830
|
this.fileDropHidden = true;
|
|
852
|
-
return Promise.all([
|
|
853
|
-
...files,
|
|
854
|
-
].map(async (file) => {
|
|
831
|
+
return Promise.all([...files].map(async (file) => {
|
|
855
832
|
await this.prepareFileToUpload(file);
|
|
856
833
|
this.redraw();
|
|
857
834
|
}));
|
|
@@ -871,8 +848,8 @@ export default class FileComponent extends Field {
|
|
|
871
848
|
...fileInfo,
|
|
872
849
|
status: 'info',
|
|
873
850
|
message: this.autoSync
|
|
874
|
-
? this.t('
|
|
875
|
-
: this.t('
|
|
851
|
+
? this.t('readyForRemovingFromStorage')
|
|
852
|
+
: this.t('preparingFileToRemove'),
|
|
876
853
|
});
|
|
877
854
|
const index = this.dataValue.findIndex((file) => file.name === fileInfo.name);
|
|
878
855
|
this.splice(index);
|
|
@@ -887,13 +864,7 @@ export default class FileComponent extends Field {
|
|
|
887
864
|
async deleteFile(fileInfo) {
|
|
888
865
|
const { options = {} } = this.component;
|
|
889
866
|
if (fileInfo &&
|
|
890
|
-
[
|
|
891
|
-
'url',
|
|
892
|
-
'indexeddb',
|
|
893
|
-
's3',
|
|
894
|
-
'azure',
|
|
895
|
-
'googledrive',
|
|
896
|
-
].includes(this.component.storage)) {
|
|
867
|
+
['url', 'indexeddb', 's3', 'azure', 'googledrive'].includes(this.component.storage)) {
|
|
897
868
|
const { fileService } = this;
|
|
898
869
|
if (fileService && typeof fileService.deleteFile === 'function') {
|
|
899
870
|
return await fileService.deleteFile(fileInfo, options);
|
|
@@ -917,7 +888,7 @@ export default class FileComponent extends Field {
|
|
|
917
888
|
}
|
|
918
889
|
await this.deleteFile(fileToSync);
|
|
919
890
|
fileToSync.status = 'success';
|
|
920
|
-
fileToSync.message = this.t('
|
|
891
|
+
fileToSync.message = this.t('succefullyRemoved');
|
|
921
892
|
}
|
|
922
893
|
catch (response) {
|
|
923
894
|
fileToSync.status = 'error';
|
|
@@ -988,14 +959,14 @@ export default class FileComponent extends Field {
|
|
|
988
959
|
fileInfo,
|
|
989
960
|
};
|
|
990
961
|
}
|
|
991
|
-
if (fileToSync.status ===
|
|
992
|
-
const uploadedFile = this.resolvedFiles.find(x => x.fileToSync.originalName === fileToSync.originalName);
|
|
962
|
+
if (fileToSync.status === 'success') {
|
|
963
|
+
const uploadedFile = this.resolvedFiles.find((x) => x.fileToSync.originalName === fileToSync.originalName);
|
|
993
964
|
return {
|
|
994
965
|
fileToSync: uploadedFile.fileToSync,
|
|
995
966
|
fileInfo: uploadedFile.fileInfo,
|
|
996
967
|
};
|
|
997
968
|
}
|
|
998
|
-
const pendingFile = this.pendingfiles.find(x => x.name === fileToSync.name);
|
|
969
|
+
const pendingFile = this.pendingfiles.find((x) => x.name === fileToSync.name);
|
|
999
970
|
if (pendingFile) {
|
|
1000
971
|
fileInfo = await pendingFile.fileInfoProm;
|
|
1001
972
|
}
|
|
@@ -1004,9 +975,9 @@ export default class FileComponent extends Field {
|
|
|
1004
975
|
this.pendingfiles.push({ name: fileToSync.name, fileInfoProm: promInfo });
|
|
1005
976
|
fileInfo = await promInfo;
|
|
1006
977
|
}
|
|
1007
|
-
this.pendingfiles = this.pendingfiles.filter(x => x.name !== fileToSync.name);
|
|
978
|
+
this.pendingfiles = this.pendingfiles.filter((x) => x.name !== fileToSync.name);
|
|
1008
979
|
fileToSync.status = 'success';
|
|
1009
|
-
fileToSync.message = this.t('
|
|
980
|
+
fileToSync.message = this.t('succefullyUploaded');
|
|
1010
981
|
fileInfo.originalName = fileToSync.originalName;
|
|
1011
982
|
fileInfo.hash = fileToSync.hash;
|
|
1012
983
|
this.emit('fileUploadingEnd', Promise.resolve(fileInfo));
|
|
@@ -1018,7 +989,7 @@ export default class FileComponent extends Field {
|
|
|
1018
989
|
typeof response === 'string'
|
|
1019
990
|
? response
|
|
1020
991
|
: response.type === 'abort'
|
|
1021
|
-
? this.t('
|
|
992
|
+
? this.t('requestAborted')
|
|
1022
993
|
: response.toString();
|
|
1023
994
|
this.emit('fileUploadingEnd', Promise.reject(response));
|
|
1024
995
|
this.emit(_.get(response, 'type') === 'abort' ? 'fileUploadCanceled' : 'fileUploadError', {
|
|
@@ -1029,9 +1000,11 @@ export default class FileComponent extends Field {
|
|
|
1029
1000
|
finally {
|
|
1030
1001
|
delete fileToSync.progress;
|
|
1031
1002
|
this.redraw();
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1003
|
+
if (fileInfo) {
|
|
1004
|
+
const fileExists = this.resolvedFiles.find(x => x.fileInfo.originalName === fileToSync.originalName);
|
|
1005
|
+
if (!fileExists && fileToSync.status !== 'error') {
|
|
1006
|
+
this.resolvedFiles.push({ fileToSync, fileInfo });
|
|
1007
|
+
}
|
|
1035
1008
|
}
|
|
1036
1009
|
}
|
|
1037
1010
|
return {
|
|
@@ -1045,7 +1018,7 @@ export default class FileComponent extends Field {
|
|
|
1045
1018
|
this.fileDropHidden = true;
|
|
1046
1019
|
this.redraw();
|
|
1047
1020
|
try {
|
|
1048
|
-
const [filesToDelete = [], filesToUpload = []
|
|
1021
|
+
const [filesToDelete = [], filesToUpload = []] = await Promise.all([
|
|
1049
1022
|
this.delete(),
|
|
1050
1023
|
this.upload(),
|
|
1051
1024
|
]);
|
|
@@ -1084,7 +1057,7 @@ export default class FileComponent extends Field {
|
|
|
1084
1057
|
const { options = {} } = this.component;
|
|
1085
1058
|
const { fileService } = this;
|
|
1086
1059
|
if (!fileService) {
|
|
1087
|
-
return alert('
|
|
1060
|
+
return alert(this.t('noFileService'));
|
|
1088
1061
|
}
|
|
1089
1062
|
if (this.component.privateDownload) {
|
|
1090
1063
|
fileInfo.private = true;
|
|
@@ -1093,10 +1066,7 @@ export default class FileComponent extends Field {
|
|
|
1093
1066
|
.downloadFile(fileInfo, options)
|
|
1094
1067
|
.then((file) => {
|
|
1095
1068
|
if (file) {
|
|
1096
|
-
if ([
|
|
1097
|
-
'base64',
|
|
1098
|
-
'indexeddb',
|
|
1099
|
-
].includes(file.storage)) {
|
|
1069
|
+
if (['base64', 'indexeddb'].includes(file.storage)) {
|
|
1100
1070
|
download(file.url, file.originalName || file.name, file.type);
|
|
1101
1071
|
}
|
|
1102
1072
|
else {
|
|
@@ -1124,7 +1094,7 @@ export default class FileComponent extends Field {
|
|
|
1124
1094
|
return Promise.resolve();
|
|
1125
1095
|
}
|
|
1126
1096
|
await this.syncFiles();
|
|
1127
|
-
return this.shouldSyncFiles ? Promise.reject('
|
|
1097
|
+
return this.shouldSyncFiles ? Promise.reject(this.t('synchronizationFailed')) : Promise.resolve();
|
|
1128
1098
|
}
|
|
1129
1099
|
catch (error) {
|
|
1130
1100
|
return Promise.reject(error.message);
|
|
@@ -28,10 +28,7 @@ export default [
|
|
|
28
28
|
tooltip: "The <a href='https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpuoverview.html'>S3 Multipart Upload API</a> is designed to improve the upload experience for larger objects (> 5GB).",
|
|
29
29
|
conditional: {
|
|
30
30
|
json: {
|
|
31
|
-
'===': [
|
|
32
|
-
{ var: 'data.storage' },
|
|
33
|
-
's3',
|
|
34
|
-
],
|
|
31
|
+
'===': [{ var: 'data.storage' }, 's3'],
|
|
35
32
|
},
|
|
36
33
|
},
|
|
37
34
|
},
|
|
@@ -63,10 +60,7 @@ export default [
|
|
|
63
60
|
],
|
|
64
61
|
conditional: {
|
|
65
62
|
json: {
|
|
66
|
-
'===': [
|
|
67
|
-
{ var: 'data.useMultipartUpload' },
|
|
68
|
-
true,
|
|
69
|
-
],
|
|
63
|
+
'===': [{ var: 'data.useMultipartUpload' }, true],
|
|
70
64
|
},
|
|
71
65
|
},
|
|
72
66
|
},
|
|
@@ -80,10 +74,7 @@ export default [
|
|
|
80
74
|
tooltip: "See <a href='https://github.com/danialfarid/ng-file-upload#server-side' target='_blank'>https://github.com/danialfarid/ng-file-upload#server-side</a> for how to set up the server.",
|
|
81
75
|
conditional: {
|
|
82
76
|
json: {
|
|
83
|
-
'===': [
|
|
84
|
-
{ var: 'data.storage' },
|
|
85
|
-
'url',
|
|
86
|
-
],
|
|
77
|
+
'===': [{ var: 'data.storage' }, 'url'],
|
|
87
78
|
},
|
|
88
79
|
},
|
|
89
80
|
},
|
|
@@ -100,9 +91,7 @@ export default [
|
|
|
100
91
|
{
|
|
101
92
|
var: 'data.storage',
|
|
102
93
|
},
|
|
103
|
-
[
|
|
104
|
-
'indexeddb',
|
|
105
|
-
],
|
|
94
|
+
['indexeddb'],
|
|
106
95
|
],
|
|
107
96
|
},
|
|
108
97
|
},
|
|
@@ -120,9 +109,7 @@ export default [
|
|
|
120
109
|
{
|
|
121
110
|
var: 'data.storage',
|
|
122
111
|
},
|
|
123
|
-
[
|
|
124
|
-
'indexeddb',
|
|
125
|
-
],
|
|
112
|
+
['indexeddb'],
|
|
126
113
|
],
|
|
127
114
|
},
|
|
128
115
|
},
|
|
@@ -296,10 +283,7 @@ export default [
|
|
|
296
283
|
weight: 31,
|
|
297
284
|
conditional: {
|
|
298
285
|
json: {
|
|
299
|
-
'===': [
|
|
300
|
-
{ var: 'data.storage' },
|
|
301
|
-
'url',
|
|
302
|
-
],
|
|
286
|
+
'===': [{ var: 'data.storage' }, 'url'],
|
|
303
287
|
},
|
|
304
288
|
},
|
|
305
289
|
},
|
|
@@ -313,10 +297,7 @@ export default [
|
|
|
313
297
|
weight: 40,
|
|
314
298
|
conditional: {
|
|
315
299
|
json: {
|
|
316
|
-
'==': [
|
|
317
|
-
{ var: 'data.image' },
|
|
318
|
-
true,
|
|
319
|
-
],
|
|
300
|
+
'==': [{ var: 'data.image' }, true],
|
|
320
301
|
},
|
|
321
302
|
},
|
|
322
303
|
},
|
|
@@ -338,10 +319,7 @@ export default [
|
|
|
338
319
|
weight: 38,
|
|
339
320
|
conditional: {
|
|
340
321
|
json: {
|
|
341
|
-
'==': [
|
|
342
|
-
{ var: 'data.webcam' },
|
|
343
|
-
true,
|
|
344
|
-
],
|
|
322
|
+
'==': [{ var: 'data.webcam' }, true],
|
|
345
323
|
},
|
|
346
324
|
},
|
|
347
325
|
},
|
|
@@ -29,9 +29,7 @@ export default class FormComponent extends Component {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
static savedValueTypes() {
|
|
32
|
-
return [
|
|
33
|
-
componentValueTypes.object,
|
|
34
|
-
];
|
|
32
|
+
return [componentValueTypes.object];
|
|
35
33
|
}
|
|
36
34
|
init() {
|
|
37
35
|
super.init();
|
|
@@ -215,7 +213,7 @@ export default class FormComponent extends Component {
|
|
|
215
213
|
}
|
|
216
214
|
render() {
|
|
217
215
|
if (this.builderMode) {
|
|
218
|
-
return super.render(this.component.label || '
|
|
216
|
+
return super.render(this.t(this.component.label || 'nestedForm'));
|
|
219
217
|
}
|
|
220
218
|
const subform = this.subForm ? this.subForm.render() : this.renderTemplate('loading');
|
|
221
219
|
return super.render(subform);
|
|
@@ -228,13 +226,13 @@ export default class FormComponent extends Component {
|
|
|
228
226
|
*/
|
|
229
227
|
getValueAsString(value, options) {
|
|
230
228
|
if (!value) {
|
|
231
|
-
return '
|
|
229
|
+
return this.t('noDataProvided');
|
|
232
230
|
}
|
|
233
231
|
if (!value.data && value._id) {
|
|
234
232
|
return value._id;
|
|
235
233
|
}
|
|
236
234
|
if (!value.data || !Object.keys(value.data).length) {
|
|
237
|
-
return '
|
|
235
|
+
return this.t('noDataProvided');
|
|
238
236
|
}
|
|
239
237
|
if (options?.email) {
|
|
240
238
|
let result = `
|
|
@@ -696,7 +694,7 @@ export default class FormComponent extends Component {
|
|
|
696
694
|
: {};
|
|
697
695
|
this.subForm.setUrl(submissionUrl, { ...this.options, ...options });
|
|
698
696
|
this.subForm.loadSubmission().catch((err) => {
|
|
699
|
-
console.error(
|
|
697
|
+
console.error(this.t('subformSubmissionLoadingError', { submissionId: submission._id }), err);
|
|
700
698
|
});
|
|
701
699
|
}
|
|
702
700
|
else {
|
|
@@ -47,9 +47,7 @@ export default class NumberComponent extends Input {
|
|
|
47
47
|
}
|
|
48
48
|
static savedValueTypes(schema) {
|
|
49
49
|
schema = schema || {};
|
|
50
|
-
return
|
|
51
|
-
componentValueTypes.number,
|
|
52
|
-
]);
|
|
50
|
+
return getComponentSavedTypes(schema) || [componentValueTypes.number];
|
|
53
51
|
}
|
|
54
52
|
constructor(...args) {
|
|
55
53
|
super(...args);
|
|
@@ -70,7 +68,7 @@ export default class NumberComponent extends Input {
|
|
|
70
68
|
if (this.component.thousandsSeparator ||
|
|
71
69
|
this.options.properties?.thousandsSeparator ||
|
|
72
70
|
this.options.thousandsSeparator) {
|
|
73
|
-
console.warn('
|
|
71
|
+
console.warn(this.t('noDelimiterSet'));
|
|
74
72
|
}
|
|
75
73
|
this.delimiter = '';
|
|
76
74
|
}
|
|
@@ -87,10 +87,7 @@ export default [
|
|
|
87
87
|
defaultValue: true,
|
|
88
88
|
customConditional({ data = {}, buildingForm = {} }) {
|
|
89
89
|
const formSettings = buildingForm.settings || {};
|
|
90
|
-
return ![
|
|
91
|
-
data.breadcrumb,
|
|
92
|
-
formSettings.wizardBreadcrumbsType,
|
|
93
|
-
].includes('none');
|
|
90
|
+
return ![data.breadcrumb, formSettings.wizardBreadcrumbsType].includes('none');
|
|
94
91
|
},
|
|
95
92
|
},
|
|
96
93
|
{
|
|
@@ -102,10 +99,7 @@ export default [
|
|
|
102
99
|
tooltip: 'Determines if the breadcrumb bar is clickable or not for visited tabs.',
|
|
103
100
|
conditional: {
|
|
104
101
|
json: {
|
|
105
|
-
'===': [
|
|
106
|
-
{ var: 'data.breadcrumbClickable' },
|
|
107
|
-
false,
|
|
108
|
-
],
|
|
102
|
+
'===': [{ var: 'data.breadcrumbClickable' }, false],
|
|
109
103
|
},
|
|
110
104
|
},
|
|
111
105
|
},
|
|
@@ -211,10 +205,7 @@ export default [
|
|
|
211
205
|
input: true,
|
|
212
206
|
conditional: {
|
|
213
207
|
json: {
|
|
214
|
-
'===': [
|
|
215
|
-
{ var: 'data.collapsible' },
|
|
216
|
-
true,
|
|
217
|
-
],
|
|
208
|
+
'===': [{ var: 'data.collapsible' }, true],
|
|
218
209
|
},
|
|
219
210
|
},
|
|
220
211
|
},
|
|
@@ -21,10 +21,7 @@ export default class PasswordComponent extends TextFieldComponent {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
get defaultSchema() {
|
|
24
|
-
return _.omit(PasswordComponent.schema(), [
|
|
25
|
-
'protected',
|
|
26
|
-
'tableView',
|
|
27
|
-
]);
|
|
24
|
+
return _.omit(PasswordComponent.schema(), ['protected', 'tableView']);
|
|
28
25
|
}
|
|
29
26
|
get inputInfo() {
|
|
30
27
|
const info = super.inputInfo;
|
|
@@ -9,9 +9,7 @@ export default class RadioComponent extends ListComponent {
|
|
|
9
9
|
inputType: 'radio',
|
|
10
10
|
label: 'Radio',
|
|
11
11
|
key: 'radio',
|
|
12
|
-
values: [
|
|
13
|
-
{ label: '', value: '' },
|
|
14
|
-
],
|
|
12
|
+
values: [{ label: '', value: '' }],
|
|
15
13
|
data: {
|
|
16
14
|
url: '',
|
|
17
15
|
},
|
|
@@ -61,23 +59,12 @@ export default class RadioComponent extends ListComponent {
|
|
|
61
59
|
return types;
|
|
62
60
|
}
|
|
63
61
|
if (dataType === 'object') {
|
|
64
|
-
return [
|
|
65
|
-
object,
|
|
66
|
-
array,
|
|
67
|
-
];
|
|
62
|
+
return [object, array];
|
|
68
63
|
}
|
|
69
64
|
if (componentValueTypes[dataType]) {
|
|
70
|
-
return [
|
|
71
|
-
componentValueTypes[dataType],
|
|
72
|
-
];
|
|
65
|
+
return [componentValueTypes[dataType]];
|
|
73
66
|
}
|
|
74
|
-
return [
|
|
75
|
-
boolean,
|
|
76
|
-
string,
|
|
77
|
-
number,
|
|
78
|
-
object,
|
|
79
|
-
array,
|
|
80
|
-
];
|
|
67
|
+
return [boolean, string, number, object, array];
|
|
81
68
|
}
|
|
82
69
|
constructor(component, options, data) {
|
|
83
70
|
super(component, options, data);
|
|
@@ -415,6 +402,9 @@ export default class RadioComponent extends ListComponent {
|
|
|
415
402
|
if (changed) {
|
|
416
403
|
this.previousValue = this.dataValue;
|
|
417
404
|
}
|
|
405
|
+
if (!this.visible) {
|
|
406
|
+
this.previousValue = this.emptyValue;
|
|
407
|
+
}
|
|
418
408
|
return changed;
|
|
419
409
|
}
|
|
420
410
|
// If they clicked on the radio that is currently selected, it needs to reset the value.
|
|
@@ -18,9 +18,7 @@ export default [
|
|
|
18
18
|
},
|
|
19
19
|
onChange(context) {
|
|
20
20
|
if (context && context.flags && context.flags && context.flags.modified) {
|
|
21
|
-
context.data.values = [
|
|
22
|
-
{ label: '', value: '' },
|
|
23
|
-
];
|
|
21
|
+
context.data.values = [{ label: '', value: '' }];
|
|
24
22
|
}
|
|
25
23
|
},
|
|
26
24
|
},
|
|
@@ -32,9 +30,7 @@ export default [
|
|
|
32
30
|
tooltip: 'The radio button values that can be picked for this field. Values are text submitted with the form data. Labels are text that appears next to the radio buttons on the form.',
|
|
33
31
|
weight: 10,
|
|
34
32
|
reorder: true,
|
|
35
|
-
defaultValue: [
|
|
36
|
-
{ label: '', value: '' },
|
|
37
|
-
],
|
|
33
|
+
defaultValue: [{ label: '', value: '' }],
|
|
38
34
|
components: [
|
|
39
35
|
{
|
|
40
36
|
label: 'Label',
|
|
@@ -73,10 +69,7 @@ export default [
|
|
|
73
69
|
],
|
|
74
70
|
conditional: {
|
|
75
71
|
json: {
|
|
76
|
-
'===': [
|
|
77
|
-
{ var: 'data.dataSrc' },
|
|
78
|
-
'values',
|
|
79
|
-
],
|
|
72
|
+
'===': [{ var: 'data.dataSrc' }, 'values'],
|
|
80
73
|
},
|
|
81
74
|
},
|
|
82
75
|
},
|
|
@@ -104,10 +97,7 @@ export default [
|
|
|
104
97
|
key: 'template',
|
|
105
98
|
conditional: {
|
|
106
99
|
json: {
|
|
107
|
-
'===': [
|
|
108
|
-
{ var: 'data.dataSrc' },
|
|
109
|
-
'url',
|
|
110
|
-
],
|
|
100
|
+
'===': [{ var: 'data.dataSrc' }, 'url'],
|
|
111
101
|
},
|
|
112
102
|
},
|
|
113
103
|
},
|
|
@@ -20,10 +20,7 @@ export default class ReCaptchaComponent extends Component {
|
|
|
20
20
|
static get conditionOperatorsSettings() {
|
|
21
21
|
return {
|
|
22
22
|
...super.conditionOperatorsSettings,
|
|
23
|
-
operators: [
|
|
24
|
-
'isEmpty',
|
|
25
|
-
'isNotEmpty',
|
|
26
|
-
],
|
|
23
|
+
operators: ['isEmpty', 'isNotEmpty'],
|
|
27
24
|
};
|
|
28
25
|
}
|
|
29
26
|
static get serverConditionSettings() {
|
|
@@ -50,7 +47,7 @@ export default class ReCaptchaComponent extends Component {
|
|
|
50
47
|
this.recaptchaApiReady = Formio.requireLibrary('googleRecaptcha', 'grecaptcha', recaptchaApiScriptUrl, true);
|
|
51
48
|
}
|
|
52
49
|
else {
|
|
53
|
-
console.warn('
|
|
50
|
+
console.warn(this.t('noSiteKey'));
|
|
54
51
|
}
|
|
55
52
|
}
|
|
56
53
|
}
|
|
@@ -63,7 +60,7 @@ export default class ReCaptchaComponent extends Component {
|
|
|
63
60
|
async verify(actionName) {
|
|
64
61
|
const siteKey = _get(this.root?.form, 'settings.recaptcha.siteKey');
|
|
65
62
|
if (!siteKey) {
|
|
66
|
-
console.warn('
|
|
63
|
+
console.warn(this.t('noSiteKey'));
|
|
67
64
|
return;
|
|
68
65
|
}
|
|
69
66
|
if (!this.recaptchaApiReady) {
|