@formio/js 5.4.1 → 5.4.3
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 +137 -115
- 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 +161 -139
- 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 +27 -27
- 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/Element.js +1 -1
- 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 +2 -0
- package/lib/cjs/Wizard.js +59 -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 +31 -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 +52 -75
- package/lib/cjs/components/file/editForm/File.edit.display.js +1 -5
- package/lib/cjs/components/file/editForm/File.edit.file.d.ts +9 -3
- package/lib/cjs/components/file/editForm/File.edit.file.js +27 -52
- package/lib/cjs/components/form/Form.js +5 -7
- package/lib/cjs/components/html/HTML.d.ts +1 -1
- package/lib/cjs/components/html/HTML.js +8 -10
- package/lib/cjs/components/number/Number.js +7 -5
- 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 +17 -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 +21 -24
- package/lib/cjs/components/signature/editForm/Signature.edit.display.d.ts +4 -10
- package/lib/cjs/components/signature/editForm/Signature.edit.display.js +8 -12
- 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 +17 -18
- package/lib/cjs/providers/storage/s3.js +3 -14
- package/lib/cjs/providers/storage/url.js +13 -2
- package/lib/cjs/providers/storage/xhr.js +19 -28
- package/lib/cjs/templates/Templates.js +1 -0
- package/lib/cjs/templates/index.d.ts +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/Element.js +1 -1
- 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 +2 -0
- package/lib/mjs/Wizard.js +54 -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 +30 -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 +52 -75
- package/lib/mjs/components/file/editForm/File.edit.display.js +1 -5
- package/lib/mjs/components/file/editForm/File.edit.file.d.ts +9 -3
- package/lib/mjs/components/file/editForm/File.edit.file.js +27 -52
- package/lib/mjs/components/form/Form.js +5 -7
- package/lib/mjs/components/html/HTML.d.ts +1 -1
- package/lib/mjs/components/html/HTML.js +8 -10
- package/lib/mjs/components/number/Number.js +7 -5
- 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 +17 -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 +20 -23
- package/lib/mjs/components/signature/editForm/Signature.edit.display.d.ts +4 -10
- package/lib/mjs/components/signature/editForm/Signature.edit.display.js +6 -12
- 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 +17 -18
- package/lib/mjs/providers/storage/s3.js +3 -14
- package/lib/mjs/providers/storage/url.js +13 -2
- package/lib/mjs/providers/storage/xhr.js +19 -32
- package/lib/mjs/templates/Templates.js +1 -0
- package/lib/mjs/templates/index.d.ts +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
|
@@ -37,9 +37,7 @@ if (htmlCanvasElement && !htmlCanvasElement.prototype.toBlob) {
|
|
|
37
37
|
for (var i = 0; i < len; i++) {
|
|
38
38
|
arr[i] = binStr.charCodeAt(i);
|
|
39
39
|
}
|
|
40
|
-
callback(new Blob([
|
|
41
|
-
arr,
|
|
42
|
-
], { type: type || 'image/png' }));
|
|
40
|
+
callback(new Blob([arr], { type: type || 'image/png' }));
|
|
43
41
|
});
|
|
44
42
|
},
|
|
45
43
|
});
|
|
@@ -58,6 +56,7 @@ class FileComponent extends Field_1.default {
|
|
|
58
56
|
fileMinSize: '0KB',
|
|
59
57
|
fileMaxSize: '1GB',
|
|
60
58
|
uploadOnly: false,
|
|
59
|
+
options: {},
|
|
61
60
|
}, ...extend);
|
|
62
61
|
}
|
|
63
62
|
static get builderInfo() {
|
|
@@ -74,16 +73,11 @@ class FileComponent extends Field_1.default {
|
|
|
74
73
|
return FileComponent.conditionOperatorsSettings;
|
|
75
74
|
}
|
|
76
75
|
static get conditionOperatorsSettings() {
|
|
77
|
-
return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { operators: [
|
|
78
|
-
'isEmpty',
|
|
79
|
-
'isNotEmpty',
|
|
80
|
-
] });
|
|
76
|
+
return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { operators: ['isEmpty', 'isNotEmpty'] });
|
|
81
77
|
}
|
|
82
78
|
static savedValueTypes(schema) {
|
|
83
79
|
schema = schema || {};
|
|
84
|
-
return (
|
|
85
|
-
utils_1.componentValueTypes.object,
|
|
86
|
-
]);
|
|
80
|
+
return (0, utils_1.getComponentSavedTypes)(schema) || [utils_1.componentValueTypes.object];
|
|
87
81
|
}
|
|
88
82
|
init() {
|
|
89
83
|
super.init();
|
|
@@ -127,7 +121,7 @@ class FileComponent extends Field_1.default {
|
|
|
127
121
|
return [];
|
|
128
122
|
}
|
|
129
123
|
getValueAsString(value, options) {
|
|
130
|
-
if ((options === null || options === void 0 ? void 0 : options.review) && !this.component.uploadOnly) {
|
|
124
|
+
if ((options === null || options === void 0 ? void 0 : options.review) && !this.component.uploadOnly && !(options === null || options === void 0 ? void 0 : options.pdf)) {
|
|
131
125
|
return lodash_1.default.map(value, (val, index) => {
|
|
132
126
|
return `<a href="${val.url || '#'}" target="_blank" data-path='${this.path}' data-fileindex='${index}'>${val.originalName}</a>`;
|
|
133
127
|
}).join(', ');
|
|
@@ -219,7 +213,7 @@ class FileComponent extends Field_1.default {
|
|
|
219
213
|
this.videoStream = stream;
|
|
220
214
|
const { videoPlayer } = this.refs;
|
|
221
215
|
if (!videoPlayer) {
|
|
222
|
-
console.warn(
|
|
216
|
+
console.warn(this.t('videoPlayerNotFound'));
|
|
223
217
|
this.cameraMode = false;
|
|
224
218
|
this.redraw();
|
|
225
219
|
return;
|
|
@@ -244,16 +238,14 @@ class FileComponent extends Field_1.default {
|
|
|
244
238
|
takePicture() {
|
|
245
239
|
const { videoPlayer } = this.refs;
|
|
246
240
|
if (!videoPlayer) {
|
|
247
|
-
console.warn(
|
|
241
|
+
console.warn(this.t('videoPlayerNotFound'));
|
|
248
242
|
this.cameraMode = false;
|
|
249
243
|
this.redraw();
|
|
250
244
|
return;
|
|
251
245
|
}
|
|
252
246
|
this.getFrame(videoPlayer).then((frame) => {
|
|
253
247
|
frame.name = `photo-${Date.now()}.png`;
|
|
254
|
-
this.handleFilesToUpload([
|
|
255
|
-
frame,
|
|
256
|
-
]);
|
|
248
|
+
this.handleFilesToUpload([frame]);
|
|
257
249
|
this.cameraMode = false;
|
|
258
250
|
this.redraw();
|
|
259
251
|
});
|
|
@@ -428,13 +420,9 @@ class FileComponent extends Field_1.default {
|
|
|
428
420
|
fileEntry.file((file) => {
|
|
429
421
|
const reader = new FileReader();
|
|
430
422
|
reader.onloadend = (evt) => {
|
|
431
|
-
const blob = new Blob([
|
|
432
|
-
new Uint8Array(evt.target.result),
|
|
433
|
-
], { type: file.type });
|
|
423
|
+
const blob = new Blob([new Uint8Array(evt.target.result)], { type: file.type });
|
|
434
424
|
blob.name = file.name;
|
|
435
|
-
this.handleFilesToUpload([
|
|
436
|
-
blob,
|
|
437
|
-
]);
|
|
425
|
+
this.handleFilesToUpload([blob]);
|
|
438
426
|
};
|
|
439
427
|
reader.readAsArrayBuffer(file);
|
|
440
428
|
});
|
|
@@ -454,13 +442,9 @@ class FileComponent extends Field_1.default {
|
|
|
454
442
|
fileEntry.file((file) => {
|
|
455
443
|
const reader = new FileReader();
|
|
456
444
|
reader.onloadend = (evt) => {
|
|
457
|
-
const blob = new Blob([
|
|
458
|
-
new Uint8Array(evt.target.result),
|
|
459
|
-
], { type: file.type });
|
|
445
|
+
const blob = new Blob([new Uint8Array(evt.target.result)], { type: file.type });
|
|
460
446
|
blob.name = file.name;
|
|
461
|
-
this.handleFilesToUpload([
|
|
462
|
-
blob,
|
|
463
|
-
]);
|
|
447
|
+
this.handleFilesToUpload([blob]);
|
|
464
448
|
};
|
|
465
449
|
reader.readAsArrayBuffer(file);
|
|
466
450
|
});
|
|
@@ -631,7 +615,7 @@ class FileComponent extends Field_1.default {
|
|
|
631
615
|
if (!target.id) {
|
|
632
616
|
return;
|
|
633
617
|
}
|
|
634
|
-
const [action, id
|
|
618
|
+
const [action, id] = target.id.split('-');
|
|
635
619
|
if (!action || !id || !this.actions[action]) {
|
|
636
620
|
return;
|
|
637
621
|
}
|
|
@@ -652,11 +636,13 @@ class FileComponent extends Field_1.default {
|
|
|
652
636
|
originalName: escapedFileName,
|
|
653
637
|
fileKey: this.component.fileKey || 'file',
|
|
654
638
|
storage: this.component.storage,
|
|
655
|
-
options: this.component.
|
|
639
|
+
options: this.component.storage === 'url'
|
|
640
|
+
? (this.component.urlRequestOptions || this.component.options)
|
|
641
|
+
: this.component.options,
|
|
656
642
|
file,
|
|
657
643
|
size: file.size,
|
|
658
644
|
status: 'info',
|
|
659
|
-
message: this.t('
|
|
645
|
+
message: this.t('waitFileProcessing'),
|
|
660
646
|
hash: '',
|
|
661
647
|
};
|
|
662
648
|
}
|
|
@@ -687,7 +673,7 @@ class FileComponent extends Field_1.default {
|
|
|
687
673
|
return fileWithSameNameUploaded || fileWithSameNameUploading
|
|
688
674
|
? {
|
|
689
675
|
status: 'error',
|
|
690
|
-
message: this.t(
|
|
676
|
+
message: this.t(fileWithSameNameUploading ? 'fileWithDuplicatedNameInProgress' : 'fileWithDuplicatedNameLoaded'),
|
|
691
677
|
}
|
|
692
678
|
: {};
|
|
693
679
|
}
|
|
@@ -696,7 +682,7 @@ class FileComponent extends Field_1.default {
|
|
|
696
682
|
if (this.component.filePattern && !this.validatePattern(file, this.component.filePattern)) {
|
|
697
683
|
return {
|
|
698
684
|
status: 'error',
|
|
699
|
-
message: this.t('
|
|
685
|
+
message: this.t('wrongFileType', {
|
|
700
686
|
pattern: this.component.filePattern,
|
|
701
687
|
}),
|
|
702
688
|
};
|
|
@@ -709,7 +695,7 @@ class FileComponent extends Field_1.default {
|
|
|
709
695
|
if (!interpolatedMinSize) {
|
|
710
696
|
return {
|
|
711
697
|
status: 'error',
|
|
712
|
-
message: '
|
|
698
|
+
message: this.t('checkEnteredParameters'),
|
|
713
699
|
};
|
|
714
700
|
}
|
|
715
701
|
if (!this.validateMinSize(file, interpolatedMinSize)) {
|
|
@@ -727,7 +713,7 @@ class FileComponent extends Field_1.default {
|
|
|
727
713
|
if (!interpolatedMaxSize) {
|
|
728
714
|
return {
|
|
729
715
|
status: 'error',
|
|
730
|
-
message: '
|
|
716
|
+
message: this.t('checkEnteredParameters'),
|
|
731
717
|
};
|
|
732
718
|
}
|
|
733
719
|
if (!this.validateMaxSize(file, interpolatedMaxSize)) {
|
|
@@ -746,7 +732,7 @@ class FileComponent extends Field_1.default {
|
|
|
746
732
|
return !fileService
|
|
747
733
|
? {
|
|
748
734
|
status: 'error',
|
|
749
|
-
message: this.t('
|
|
735
|
+
message: this.t('noFileService'),
|
|
750
736
|
}
|
|
751
737
|
: {};
|
|
752
738
|
}
|
|
@@ -778,11 +764,7 @@ class FileComponent extends Field_1.default {
|
|
|
778
764
|
]
|
|
779
765
|
: element.component.submissionAccess;
|
|
780
766
|
groupPermissions.forEach((permission) => {
|
|
781
|
-
groupKey = [
|
|
782
|
-
'admin',
|
|
783
|
-
'write',
|
|
784
|
-
'create',
|
|
785
|
-
].includes(permission.type)
|
|
767
|
+
groupKey = ['admin', 'write', 'create'].includes(permission.type)
|
|
786
768
|
? element.component.key
|
|
787
769
|
: null;
|
|
788
770
|
});
|
|
@@ -806,7 +788,7 @@ class FileComponent extends Field_1.default {
|
|
|
806
788
|
this.fileDropHidden = false;
|
|
807
789
|
return {
|
|
808
790
|
status: 'error',
|
|
809
|
-
message: this.t('
|
|
791
|
+
message: this.t('fileProcessingFailed'),
|
|
810
792
|
};
|
|
811
793
|
}
|
|
812
794
|
finally {
|
|
@@ -842,7 +824,7 @@ class FileComponent extends Field_1.default {
|
|
|
842
824
|
return this.filesToSync.filesToUpload.push(fileToSync);
|
|
843
825
|
}
|
|
844
826
|
if (this.autoSync) {
|
|
845
|
-
fileToSync.message = this.t('
|
|
827
|
+
fileToSync.message = this.t('readyForUpload');
|
|
846
828
|
}
|
|
847
829
|
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 }));
|
|
848
830
|
});
|
|
@@ -855,9 +837,7 @@ class FileComponent extends Field_1.default {
|
|
|
855
837
|
}
|
|
856
838
|
if (this.component.storage && files && files.length) {
|
|
857
839
|
this.fileDropHidden = true;
|
|
858
|
-
return Promise.all([
|
|
859
|
-
...files,
|
|
860
|
-
].map((file) => __awaiter(this, void 0, void 0, function* () {
|
|
840
|
+
return Promise.all([...files].map((file) => __awaiter(this, void 0, void 0, function* () {
|
|
861
841
|
yield this.prepareFileToUpload(file);
|
|
862
842
|
this.redraw();
|
|
863
843
|
})));
|
|
@@ -877,8 +857,8 @@ class FileComponent extends Field_1.default {
|
|
|
877
857
|
}
|
|
878
858
|
prepareFileToDelete(fileInfo) {
|
|
879
859
|
this.filesToSync.filesToDelete.push(Object.assign(Object.assign({}, fileInfo), { status: 'info', message: this.autoSync
|
|
880
|
-
? this.t('
|
|
881
|
-
: this.t('
|
|
860
|
+
? this.t('readyForRemovingFromStorage')
|
|
861
|
+
: this.t('preparingFileToRemove') }));
|
|
882
862
|
const index = this.dataValue.findIndex((file) => file.name === fileInfo.name);
|
|
883
863
|
this.splice(index);
|
|
884
864
|
this.redraw();
|
|
@@ -891,15 +871,11 @@ class FileComponent extends Field_1.default {
|
|
|
891
871
|
}
|
|
892
872
|
deleteFile(fileInfo) {
|
|
893
873
|
return __awaiter(this, void 0, void 0, function* () {
|
|
894
|
-
const
|
|
874
|
+
const options = this.component.storage === 'url'
|
|
875
|
+
? (this.component.urlRequestOptions || this.component.options || {})
|
|
876
|
+
: (this.component.options || {});
|
|
895
877
|
if (fileInfo &&
|
|
896
|
-
[
|
|
897
|
-
'url',
|
|
898
|
-
'indexeddb',
|
|
899
|
-
's3',
|
|
900
|
-
'azure',
|
|
901
|
-
'googledrive',
|
|
902
|
-
].includes(this.component.storage)) {
|
|
878
|
+
['url', 'indexeddb', 's3', 'azure', 'googledrive'].includes(this.component.storage)) {
|
|
903
879
|
const { fileService } = this;
|
|
904
880
|
if (fileService && typeof fileService.deleteFile === 'function') {
|
|
905
881
|
return yield fileService.deleteFile(fileInfo, options);
|
|
@@ -925,7 +901,7 @@ class FileComponent extends Field_1.default {
|
|
|
925
901
|
}
|
|
926
902
|
yield this.deleteFile(fileToSync);
|
|
927
903
|
fileToSync.status = 'success';
|
|
928
|
-
fileToSync.message = this.t('
|
|
904
|
+
fileToSync.message = this.t('succefullyRemoved');
|
|
929
905
|
}
|
|
930
906
|
catch (response) {
|
|
931
907
|
fileToSync.status = 'error';
|
|
@@ -995,14 +971,14 @@ class FileComponent extends Field_1.default {
|
|
|
995
971
|
fileInfo,
|
|
996
972
|
};
|
|
997
973
|
}
|
|
998
|
-
if (fileToSync.status ===
|
|
999
|
-
const uploadedFile = this.resolvedFiles.find(x => x.fileToSync.originalName === fileToSync.originalName);
|
|
974
|
+
if (fileToSync.status === 'success') {
|
|
975
|
+
const uploadedFile = this.resolvedFiles.find((x) => x.fileToSync.originalName === fileToSync.originalName);
|
|
1000
976
|
return {
|
|
1001
977
|
fileToSync: uploadedFile.fileToSync,
|
|
1002
978
|
fileInfo: uploadedFile.fileInfo,
|
|
1003
979
|
};
|
|
1004
980
|
}
|
|
1005
|
-
const pendingFile = this.pendingfiles.find(x => x.name === fileToSync.name);
|
|
981
|
+
const pendingFile = this.pendingfiles.find((x) => x.name === fileToSync.name);
|
|
1006
982
|
if (pendingFile) {
|
|
1007
983
|
fileInfo = yield pendingFile.fileInfoProm;
|
|
1008
984
|
}
|
|
@@ -1011,9 +987,9 @@ class FileComponent extends Field_1.default {
|
|
|
1011
987
|
this.pendingfiles.push({ name: fileToSync.name, fileInfoProm: promInfo });
|
|
1012
988
|
fileInfo = yield promInfo;
|
|
1013
989
|
}
|
|
1014
|
-
this.pendingfiles = this.pendingfiles.filter(x => x.name !== fileToSync.name);
|
|
990
|
+
this.pendingfiles = this.pendingfiles.filter((x) => x.name !== fileToSync.name);
|
|
1015
991
|
fileToSync.status = 'success';
|
|
1016
|
-
fileToSync.message = this.t('
|
|
992
|
+
fileToSync.message = this.t('succefullyUploaded');
|
|
1017
993
|
fileInfo.originalName = fileToSync.originalName;
|
|
1018
994
|
fileInfo.hash = fileToSync.hash;
|
|
1019
995
|
this.emit('fileUploadingEnd', Promise.resolve(fileInfo));
|
|
@@ -1025,8 +1001,8 @@ class FileComponent extends Field_1.default {
|
|
|
1025
1001
|
typeof response === 'string'
|
|
1026
1002
|
? response
|
|
1027
1003
|
: response.type === 'abort'
|
|
1028
|
-
? this.t('
|
|
1029
|
-
: response.toString();
|
|
1004
|
+
? this.t('requestAborted')
|
|
1005
|
+
: response.message || response.toString();
|
|
1030
1006
|
this.emit('fileUploadingEnd', Promise.reject(response));
|
|
1031
1007
|
this.emit(lodash_1.default.get(response, 'type') === 'abort' ? 'fileUploadCanceled' : 'fileUploadError', {
|
|
1032
1008
|
fileToSync,
|
|
@@ -1036,9 +1012,11 @@ class FileComponent extends Field_1.default {
|
|
|
1036
1012
|
finally {
|
|
1037
1013
|
delete fileToSync.progress;
|
|
1038
1014
|
this.redraw();
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1015
|
+
if (fileInfo) {
|
|
1016
|
+
const fileExists = this.resolvedFiles.find(x => x.fileInfo.originalName === fileToSync.originalName);
|
|
1017
|
+
if (!fileExists && fileToSync.status !== 'error') {
|
|
1018
|
+
this.resolvedFiles.push({ fileToSync, fileInfo });
|
|
1019
|
+
}
|
|
1042
1020
|
}
|
|
1043
1021
|
}
|
|
1044
1022
|
return {
|
|
@@ -1055,7 +1033,7 @@ class FileComponent extends Field_1.default {
|
|
|
1055
1033
|
this.fileDropHidden = true;
|
|
1056
1034
|
this.redraw();
|
|
1057
1035
|
try {
|
|
1058
|
-
const [filesToDelete = [], filesToUpload = []
|
|
1036
|
+
const [filesToDelete = [], filesToUpload = []] = yield Promise.all([
|
|
1059
1037
|
this.delete(),
|
|
1060
1038
|
this.upload(),
|
|
1061
1039
|
]);
|
|
@@ -1092,10 +1070,12 @@ class FileComponent extends Field_1.default {
|
|
|
1092
1070
|
});
|
|
1093
1071
|
}
|
|
1094
1072
|
getFile(fileInfo) {
|
|
1095
|
-
const
|
|
1073
|
+
const options = this.component.storage === 'url'
|
|
1074
|
+
? (this.component.urlRequestOptions || this.component.options || {})
|
|
1075
|
+
: (this.component.options || {});
|
|
1096
1076
|
const { fileService } = this;
|
|
1097
1077
|
if (!fileService) {
|
|
1098
|
-
return alert('
|
|
1078
|
+
return alert(this.t('noFileService'));
|
|
1099
1079
|
}
|
|
1100
1080
|
if (this.component.privateDownload) {
|
|
1101
1081
|
fileInfo.private = true;
|
|
@@ -1104,10 +1084,7 @@ class FileComponent extends Field_1.default {
|
|
|
1104
1084
|
.downloadFile(fileInfo, options)
|
|
1105
1085
|
.then((file) => {
|
|
1106
1086
|
if (file) {
|
|
1107
|
-
if ([
|
|
1108
|
-
'base64',
|
|
1109
|
-
'indexeddb',
|
|
1110
|
-
].includes(file.storage)) {
|
|
1087
|
+
if (['base64', 'indexeddb'].includes(file.storage)) {
|
|
1111
1088
|
(0, downloadjs_1.default)(file.url, file.originalName || file.name, file.type);
|
|
1112
1089
|
}
|
|
1113
1090
|
else {
|
|
@@ -1136,7 +1113,7 @@ class FileComponent extends Field_1.default {
|
|
|
1136
1113
|
return Promise.resolve();
|
|
1137
1114
|
}
|
|
1138
1115
|
yield this.syncFiles();
|
|
1139
|
-
return this.shouldSyncFiles ? Promise.reject('
|
|
1116
|
+
return this.shouldSyncFiles ? Promise.reject(this.t('synchronizationFailed')) : Promise.resolve();
|
|
1140
1117
|
}
|
|
1141
1118
|
catch (error) {
|
|
1142
1119
|
return Promise.reject(error.message);
|
|
@@ -131,11 +131,10 @@ declare const _default: ({
|
|
|
131
131
|
values?: undefined;
|
|
132
132
|
} | {
|
|
133
133
|
type: string;
|
|
134
|
-
input: boolean;
|
|
135
134
|
key: string;
|
|
136
135
|
label: string;
|
|
137
136
|
weight: number;
|
|
138
|
-
|
|
137
|
+
input: boolean;
|
|
139
138
|
conditional: {
|
|
140
139
|
json: {
|
|
141
140
|
in: (string[] | {
|
|
@@ -145,12 +144,19 @@ declare const _default: ({
|
|
|
145
144
|
'=='?: undefined;
|
|
146
145
|
};
|
|
147
146
|
};
|
|
147
|
+
components: {
|
|
148
|
+
type: string;
|
|
149
|
+
input: boolean;
|
|
150
|
+
key: string;
|
|
151
|
+
label: string;
|
|
152
|
+
placeholder: string;
|
|
153
|
+
}[];
|
|
154
|
+
placeholder?: undefined;
|
|
148
155
|
tooltip?: undefined;
|
|
149
156
|
valueProperty?: undefined;
|
|
150
157
|
dataSrc?: undefined;
|
|
151
158
|
data?: undefined;
|
|
152
159
|
tableView?: undefined;
|
|
153
|
-
components?: undefined;
|
|
154
160
|
rows?: undefined;
|
|
155
161
|
editor?: undefined;
|
|
156
162
|
as?: undefined;
|
|
@@ -33,10 +33,7 @@ exports.default = [
|
|
|
33
33
|
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).",
|
|
34
34
|
conditional: {
|
|
35
35
|
json: {
|
|
36
|
-
'===': [
|
|
37
|
-
{ var: 'data.storage' },
|
|
38
|
-
's3',
|
|
39
|
-
],
|
|
36
|
+
'===': [{ var: 'data.storage' }, 's3'],
|
|
40
37
|
},
|
|
41
38
|
},
|
|
42
39
|
},
|
|
@@ -68,10 +65,7 @@ exports.default = [
|
|
|
68
65
|
],
|
|
69
66
|
conditional: {
|
|
70
67
|
json: {
|
|
71
|
-
'===': [
|
|
72
|
-
{ var: 'data.useMultipartUpload' },
|
|
73
|
-
true,
|
|
74
|
-
],
|
|
68
|
+
'===': [{ var: 'data.useMultipartUpload' }, true],
|
|
75
69
|
},
|
|
76
70
|
},
|
|
77
71
|
},
|
|
@@ -85,56 +79,46 @@ exports.default = [
|
|
|
85
79
|
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.",
|
|
86
80
|
conditional: {
|
|
87
81
|
json: {
|
|
88
|
-
'===': [
|
|
89
|
-
{ var: 'data.storage' },
|
|
90
|
-
'url',
|
|
91
|
-
],
|
|
82
|
+
'===': [{ var: 'data.storage' }, 'url'],
|
|
92
83
|
},
|
|
93
84
|
},
|
|
94
85
|
},
|
|
95
86
|
{
|
|
96
|
-
type: '
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
label: 'Database',
|
|
87
|
+
type: 'container',
|
|
88
|
+
key: 'options',
|
|
89
|
+
label: 'IndexedDB options',
|
|
100
90
|
weight: 10,
|
|
101
|
-
placeholder: 'Enter the indexeddb database name',
|
|
102
|
-
conditional: {
|
|
103
|
-
json: {
|
|
104
|
-
in: [
|
|
105
|
-
{
|
|
106
|
-
var: 'data.storage',
|
|
107
|
-
},
|
|
108
|
-
[
|
|
109
|
-
'indexeddb',
|
|
110
|
-
],
|
|
111
|
-
],
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
type: 'textfield',
|
|
117
91
|
input: true,
|
|
118
|
-
label: 'Table',
|
|
119
|
-
key: 'options.indexeddbTable',
|
|
120
|
-
weight: 10,
|
|
121
|
-
placeholder: 'Enter the name for indexeddb table',
|
|
122
92
|
conditional: {
|
|
123
93
|
json: {
|
|
124
94
|
in: [
|
|
125
95
|
{
|
|
126
96
|
var: 'data.storage',
|
|
127
97
|
},
|
|
128
|
-
[
|
|
129
|
-
'indexeddb',
|
|
130
|
-
],
|
|
98
|
+
['indexeddb'],
|
|
131
99
|
],
|
|
132
100
|
},
|
|
133
101
|
},
|
|
102
|
+
components: [
|
|
103
|
+
{
|
|
104
|
+
type: 'textfield',
|
|
105
|
+
input: true,
|
|
106
|
+
key: 'indexeddb',
|
|
107
|
+
label: 'Database',
|
|
108
|
+
placeholder: 'Enter the indexeddb database name',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
type: 'textfield',
|
|
112
|
+
input: true,
|
|
113
|
+
key: 'indexeddbTable',
|
|
114
|
+
label: 'Table',
|
|
115
|
+
placeholder: 'Enter the name for indexeddb table',
|
|
116
|
+
},
|
|
117
|
+
],
|
|
134
118
|
},
|
|
135
119
|
{
|
|
136
120
|
type: 'textarea',
|
|
137
|
-
key: '
|
|
121
|
+
key: 'urlRequestOptions',
|
|
138
122
|
label: 'Custom request options',
|
|
139
123
|
tooltip: 'Pass your custom xhr options(optional)',
|
|
140
124
|
rows: 5,
|
|
@@ -301,10 +285,7 @@ exports.default = [
|
|
|
301
285
|
weight: 31,
|
|
302
286
|
conditional: {
|
|
303
287
|
json: {
|
|
304
|
-
'===': [
|
|
305
|
-
{ var: 'data.storage' },
|
|
306
|
-
'url',
|
|
307
|
-
],
|
|
288
|
+
'===': [{ var: 'data.storage' }, 'url'],
|
|
308
289
|
},
|
|
309
290
|
},
|
|
310
291
|
},
|
|
@@ -318,10 +299,7 @@ exports.default = [
|
|
|
318
299
|
weight: 40,
|
|
319
300
|
conditional: {
|
|
320
301
|
json: {
|
|
321
|
-
'==': [
|
|
322
|
-
{ var: 'data.image' },
|
|
323
|
-
true,
|
|
324
|
-
],
|
|
302
|
+
'==': [{ var: 'data.image' }, true],
|
|
325
303
|
},
|
|
326
304
|
},
|
|
327
305
|
},
|
|
@@ -343,10 +321,7 @@ exports.default = [
|
|
|
343
321
|
weight: 38,
|
|
344
322
|
conditional: {
|
|
345
323
|
json: {
|
|
346
|
-
'==': [
|
|
347
|
-
{ var: 'data.webcam' },
|
|
348
|
-
true,
|
|
349
|
-
],
|
|
324
|
+
'==': [{ var: 'data.webcam' }, true],
|
|
350
325
|
},
|
|
351
326
|
},
|
|
352
327
|
},
|
|
@@ -34,9 +34,7 @@ class FormComponent extends Component_1.default {
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
static savedValueTypes() {
|
|
37
|
-
return [
|
|
38
|
-
utils_1.componentValueTypes.object,
|
|
39
|
-
];
|
|
37
|
+
return [utils_1.componentValueTypes.object];
|
|
40
38
|
}
|
|
41
39
|
init() {
|
|
42
40
|
super.init();
|
|
@@ -222,7 +220,7 @@ class FormComponent extends Component_1.default {
|
|
|
222
220
|
}
|
|
223
221
|
render() {
|
|
224
222
|
if (this.builderMode) {
|
|
225
|
-
return super.render(this.component.label || '
|
|
223
|
+
return super.render(this.t(this.component.label || 'nestedForm'));
|
|
226
224
|
}
|
|
227
225
|
const subform = this.subForm ? this.subForm.render() : this.renderTemplate('loading');
|
|
228
226
|
return super.render(subform);
|
|
@@ -235,13 +233,13 @@ class FormComponent extends Component_1.default {
|
|
|
235
233
|
*/
|
|
236
234
|
getValueAsString(value, options) {
|
|
237
235
|
if (!value) {
|
|
238
|
-
return '
|
|
236
|
+
return this.t('noDataProvided');
|
|
239
237
|
}
|
|
240
238
|
if (!value.data && value._id) {
|
|
241
239
|
return value._id;
|
|
242
240
|
}
|
|
243
241
|
if (!value.data || !Object.keys(value.data).length) {
|
|
244
|
-
return '
|
|
242
|
+
return this.t('noDataProvided');
|
|
245
243
|
}
|
|
246
244
|
if (options === null || options === void 0 ? void 0 : options.email) {
|
|
247
245
|
let result = `
|
|
@@ -710,7 +708,7 @@ class FormComponent extends Component_1.default {
|
|
|
710
708
|
: {};
|
|
711
709
|
this.subForm.setUrl(submissionUrl, Object.assign(Object.assign({}, this.options), options));
|
|
712
710
|
this.subForm.loadSubmission().catch((err) => {
|
|
713
|
-
console.error(
|
|
711
|
+
console.error(this.t('subformSubmissionLoadingError', { submissionId: submission._id }), err);
|
|
714
712
|
});
|
|
715
713
|
}
|
|
716
714
|
else {
|
|
@@ -12,7 +12,7 @@ export default class HTMLComponent extends Component {
|
|
|
12
12
|
get content(): any;
|
|
13
13
|
get singleTags(): string[];
|
|
14
14
|
checkRefreshOn(changed: any): void;
|
|
15
|
-
renderContent(): any;
|
|
15
|
+
renderContent(content?: any): any;
|
|
16
16
|
render(): string;
|
|
17
17
|
get dataReady(): any;
|
|
18
18
|
attach(element: any): Promise<void>;
|
|
@@ -54,11 +54,7 @@ class HTMLComponent extends Component_1.default {
|
|
|
54
54
|
return content;
|
|
55
55
|
}
|
|
56
56
|
get singleTags() {
|
|
57
|
-
return [
|
|
58
|
-
'br',
|
|
59
|
-
'img',
|
|
60
|
-
'hr',
|
|
61
|
-
];
|
|
57
|
+
return ['br', 'img', 'hr'];
|
|
62
58
|
}
|
|
63
59
|
checkRefreshOn(changed) {
|
|
64
60
|
super.checkRefreshOn(changed);
|
|
@@ -75,7 +71,7 @@ class HTMLComponent extends Component_1.default {
|
|
|
75
71
|
this.setContent(this.element, this.renderContent());
|
|
76
72
|
}
|
|
77
73
|
}
|
|
78
|
-
renderContent() {
|
|
74
|
+
renderContent(content = this.content) {
|
|
79
75
|
const submission = lodash_1.default.get(this.root, 'submission', {});
|
|
80
76
|
return this.renderTemplate('html', {
|
|
81
77
|
component: this.component,
|
|
@@ -91,12 +87,12 @@ class HTMLComponent extends Component_1.default {
|
|
|
91
87
|
}),
|
|
92
88
|
};
|
|
93
89
|
}),
|
|
94
|
-
content
|
|
90
|
+
content,
|
|
95
91
|
singleTags: this.singleTags,
|
|
96
92
|
});
|
|
97
93
|
}
|
|
98
94
|
render() {
|
|
99
|
-
return super.render(this.renderContent());
|
|
95
|
+
return super.render(this.renderContent(''));
|
|
100
96
|
}
|
|
101
97
|
get dataReady() {
|
|
102
98
|
var _a;
|
|
@@ -104,11 +100,13 @@ class HTMLComponent extends Component_1.default {
|
|
|
104
100
|
}
|
|
105
101
|
attach(element) {
|
|
106
102
|
this.loadRefs(element, { html: 'single' });
|
|
107
|
-
|
|
103
|
+
const setHtmlContent = () => {
|
|
108
104
|
if (this.refs.html) {
|
|
109
105
|
this.setContent(this.refs.html, this.content);
|
|
110
106
|
}
|
|
111
|
-
}
|
|
107
|
+
};
|
|
108
|
+
setHtmlContent();
|
|
109
|
+
this.dataReady.then(setHtmlContent);
|
|
112
110
|
return super.attach(element);
|
|
113
111
|
}
|
|
114
112
|
}
|
|
@@ -48,9 +48,7 @@ class NumberComponent extends Input_1.default {
|
|
|
48
48
|
}
|
|
49
49
|
static savedValueTypes(schema) {
|
|
50
50
|
schema = schema || {};
|
|
51
|
-
return (
|
|
52
|
-
utils_1.componentValueTypes.number,
|
|
53
|
-
]);
|
|
51
|
+
return (0, utils_1.getComponentSavedTypes)(schema) || [utils_1.componentValueTypes.number];
|
|
54
52
|
}
|
|
55
53
|
constructor(...args) {
|
|
56
54
|
var _a, _b, _c;
|
|
@@ -72,7 +70,7 @@ class NumberComponent extends Input_1.default {
|
|
|
72
70
|
if (this.component.thousandsSeparator ||
|
|
73
71
|
((_c = this.options.properties) === null || _c === void 0 ? void 0 : _c.thousandsSeparator) ||
|
|
74
72
|
this.options.thousandsSeparator) {
|
|
75
|
-
console.warn('
|
|
73
|
+
console.warn(this.t('noDelimiterSet'));
|
|
76
74
|
}
|
|
77
75
|
this.delimiter = '';
|
|
78
76
|
}
|
|
@@ -190,7 +188,11 @@ class NumberComponent extends Input_1.default {
|
|
|
190
188
|
return null;
|
|
191
189
|
}
|
|
192
190
|
const val = this.refs.input[index].value;
|
|
193
|
-
|
|
191
|
+
const result = val && val !== '-_' ? this.parseNumber(val) : null;
|
|
192
|
+
if (lodash_1.default.isNaN(result)) {
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
return result;
|
|
194
196
|
}
|
|
195
197
|
setValueAt(index, value, flags = {}) {
|
|
196
198
|
return super.setValueAt(index, this.formatValue(this.parseValue(value)), flags);
|