@formio/js 5.3.6 → 5.4.0
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/dist/formio.builder.css +31 -5
- package/dist/formio.builder.min.css +1 -1
- package/dist/formio.embed.css +1 -1
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.css +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 +31 -5
- package/dist/formio.form.js +2837 -2818
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.css +31 -5
- package/dist/formio.full.js +3442 -3403
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +1152 -1154
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +1084 -1086
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/Embed.js +28 -1
- package/lib/cjs/Form.d.ts +4 -2
- package/lib/cjs/Form.js +2 -2
- package/lib/cjs/FormBuilder.d.ts +2 -2
- package/lib/cjs/FormBuilder.js +1 -1
- package/lib/cjs/Formio.js +1 -1
- package/lib/cjs/PDF.js +2 -0
- package/lib/cjs/PDFBuilder.js +6 -1
- package/lib/cjs/Webform.d.ts +1 -0
- package/lib/cjs/Webform.js +50 -1
- package/lib/cjs/WebformBuilder.js +29 -1
- package/lib/cjs/Wizard.d.ts +1 -0
- package/lib/cjs/Wizard.js +11 -0
- package/lib/cjs/components/Components.d.ts +3 -0
- package/lib/cjs/components/_classes/component/Component.d.ts +13 -3
- package/lib/cjs/components/_classes/component/Component.js +167 -47
- 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 +7 -0
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +2 -1
- package/lib/cjs/components/_classes/component/editForm/utils.d.ts +1 -0
- package/lib/cjs/components/_classes/component/editForm/utils.js +3 -0
- package/lib/cjs/components/_classes/nested/NestedComponent.js +5 -0
- package/lib/cjs/components/address/Address.js +18 -0
- package/lib/cjs/components/datagrid/DataGrid.js +12 -2
- package/lib/cjs/components/datamap/DataMap.d.ts +1 -0
- package/lib/cjs/components/datamap/DataMap.js +37 -4
- package/lib/cjs/components/datetime/DateTime.js +11 -1
- package/lib/cjs/components/day/Day.d.ts +0 -15
- package/lib/cjs/components/day/Day.js +8 -17
- package/lib/cjs/components/editgrid/EditGrid.js +11 -1
- package/lib/cjs/components/fieldset/Fieldset.js +1 -0
- package/lib/cjs/components/file/File.d.ts +3 -1
- package/lib/cjs/components/file/File.js +62 -17
- package/lib/cjs/components/form/Form.js +3 -1
- package/lib/cjs/components/number/Number.d.ts +1 -0
- package/lib/cjs/components/number/Number.js +18 -0
- package/lib/cjs/components/select/Select.js +5 -1
- package/lib/cjs/components/signature/Signature.js +5 -5
- package/lib/cjs/components/signature/editForm/Signature.edit.display.d.ts +0 -6
- package/lib/cjs/components/signature/editForm/Signature.edit.display.js +0 -1
- package/lib/cjs/components/table/editForm/Table.edit.display.d.ts +27 -0
- package/lib/cjs/components/table/editForm/Table.edit.display.js +10 -0
- package/lib/cjs/formio.form.js +2 -5
- package/lib/cjs/package.json +1 -1
- package/lib/cjs/providers/storage/azure.js +9 -3
- package/lib/cjs/templates/index.d.ts +3 -0
- package/lib/cjs/translations/en.d.ts +2 -0
- package/lib/cjs/translations/en.js +2 -0
- package/lib/cjs/utils/i18n.d.ts +1 -0
- package/lib/cjs/utils/i18n.js +2 -0
- package/lib/cjs/utils/index.d.ts +1 -1
- package/lib/cjs/utils/utils.d.ts +1 -1
- package/lib/cjs/utils/utils.js +23 -6
- package/lib/cjs/widgets/CalendarWidget.js +1 -1
- package/lib/mjs/Embed.js +26 -1
- package/lib/mjs/Form.d.ts +4 -2
- package/lib/mjs/Form.js +2 -2
- package/lib/mjs/FormBuilder.d.ts +2 -2
- package/lib/mjs/FormBuilder.js +1 -1
- package/lib/mjs/Formio.js +1 -1
- package/lib/mjs/PDF.js +2 -0
- package/lib/mjs/PDFBuilder.js +6 -1
- package/lib/mjs/Webform.d.ts +1 -0
- package/lib/mjs/Webform.js +48 -1
- package/lib/mjs/WebformBuilder.js +28 -1
- package/lib/mjs/Wizard.d.ts +1 -0
- package/lib/mjs/Wizard.js +12 -1
- package/lib/mjs/components/Components.d.ts +3 -0
- package/lib/mjs/components/_classes/component/Component.d.ts +13 -3
- package/lib/mjs/components/_classes/component/Component.js +164 -46
- 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 +7 -0
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +2 -1
- package/lib/mjs/components/_classes/component/editForm/utils.d.ts +1 -0
- package/lib/mjs/components/_classes/component/editForm/utils.js +3 -0
- package/lib/mjs/components/_classes/nested/NestedComponent.js +5 -0
- package/lib/mjs/components/address/Address.js +17 -0
- package/lib/mjs/components/datagrid/DataGrid.js +14 -1
- package/lib/mjs/components/datamap/DataMap.d.ts +1 -0
- package/lib/mjs/components/datamap/DataMap.js +36 -4
- package/lib/mjs/components/datetime/DateTime.js +11 -1
- package/lib/mjs/components/day/Day.d.ts +0 -15
- package/lib/mjs/components/day/Day.js +8 -17
- package/lib/mjs/components/editgrid/EditGrid.js +11 -1
- package/lib/mjs/components/fieldset/Fieldset.js +1 -0
- package/lib/mjs/components/file/File.d.ts +3 -1
- package/lib/mjs/components/file/File.js +60 -15
- package/lib/mjs/components/form/Form.js +3 -1
- package/lib/mjs/components/number/Number.d.ts +1 -0
- package/lib/mjs/components/number/Number.js +17 -0
- package/lib/mjs/components/select/Select.js +5 -1
- package/lib/mjs/components/signature/Signature.js +1 -1
- package/lib/mjs/components/signature/editForm/Signature.edit.display.d.ts +0 -6
- package/lib/mjs/components/signature/editForm/Signature.edit.display.js +0 -1
- package/lib/mjs/components/table/editForm/Table.edit.display.d.ts +27 -0
- package/lib/mjs/components/table/editForm/Table.edit.display.js +10 -0
- package/lib/mjs/formio.form.js +4 -7
- package/lib/mjs/package.json +1 -1
- package/lib/mjs/providers/storage/azure.js +9 -3
- package/lib/mjs/templates/index.d.ts +3 -0
- package/lib/mjs/translations/en.d.ts +2 -0
- package/lib/mjs/translations/en.js +2 -0
- package/lib/mjs/utils/i18n.d.ts +1 -0
- package/lib/mjs/utils/i18n.js +2 -0
- package/lib/mjs/utils/index.d.ts +1 -1
- package/lib/mjs/utils/utils.d.ts +1 -1
- package/lib/mjs/utils/utils.js +22 -6
- package/lib/mjs/widgets/CalendarWidget.js +2 -2
- package/package.json +8 -6
|
@@ -57,10 +57,6 @@ export default class DayComponent extends Field {
|
|
|
57
57
|
value: string;
|
|
58
58
|
label: any;
|
|
59
59
|
}[];
|
|
60
|
-
_days: {
|
|
61
|
-
value: string;
|
|
62
|
-
label: any;
|
|
63
|
-
}[] | undefined;
|
|
64
60
|
get months(): ({
|
|
65
61
|
value: string;
|
|
66
62
|
label: any;
|
|
@@ -68,21 +64,10 @@ export default class DayComponent extends Field {
|
|
|
68
64
|
value: number;
|
|
69
65
|
label: string;
|
|
70
66
|
})[];
|
|
71
|
-
_months: ({
|
|
72
|
-
value: string;
|
|
73
|
-
label: any;
|
|
74
|
-
} | {
|
|
75
|
-
value: number;
|
|
76
|
-
label: string;
|
|
77
|
-
})[] | undefined;
|
|
78
67
|
get years(): {
|
|
79
68
|
value: string;
|
|
80
69
|
label: any;
|
|
81
70
|
}[];
|
|
82
|
-
_years: {
|
|
83
|
-
value: string;
|
|
84
|
-
label: any;
|
|
85
|
-
}[] | undefined;
|
|
86
71
|
setErrorClasses(elements: any, dirty: any, hasError: any): void;
|
|
87
72
|
dayFirst: any;
|
|
88
73
|
render(): string;
|
|
@@ -166,25 +166,19 @@ class DayComponent extends Field_1.default {
|
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
168
|
get days() {
|
|
169
|
-
|
|
170
|
-
return this._days;
|
|
171
|
-
}
|
|
172
|
-
this._days = [
|
|
169
|
+
const days = [
|
|
173
170
|
{ value: '', label: lodash_1.default.get(this.component, 'fields.day.placeholder', '') },
|
|
174
171
|
];
|
|
175
172
|
for (let x = 1; x <= 31; x++) {
|
|
176
|
-
|
|
173
|
+
days.push({
|
|
177
174
|
value: x,
|
|
178
175
|
label: x.toString(),
|
|
179
176
|
});
|
|
180
177
|
}
|
|
181
|
-
return
|
|
178
|
+
return days;
|
|
182
179
|
}
|
|
183
180
|
get months() {
|
|
184
|
-
|
|
185
|
-
return this._months;
|
|
186
|
-
}
|
|
187
|
-
this._months = [
|
|
181
|
+
const months = [
|
|
188
182
|
{
|
|
189
183
|
value: '',
|
|
190
184
|
label: lodash_1.default.get(this.component, 'fields.month.placeholder') ||
|
|
@@ -203,24 +197,21 @@ class DayComponent extends Field_1.default {
|
|
|
203
197
|
{ value: 11, label: 'November' },
|
|
204
198
|
{ value: 12, label: 'December' },
|
|
205
199
|
];
|
|
206
|
-
return
|
|
200
|
+
return months;
|
|
207
201
|
}
|
|
208
202
|
get years() {
|
|
209
|
-
|
|
210
|
-
return this._years;
|
|
211
|
-
}
|
|
212
|
-
this._years = [
|
|
203
|
+
const years = [
|
|
213
204
|
{ value: '', label: lodash_1.default.get(this.component, 'fields.year.placeholder', '') },
|
|
214
205
|
];
|
|
215
206
|
const minYears = lodash_1.default.get(this.component, 'fields.year.minYear', 1900) || 1900;
|
|
216
207
|
const maxYears = lodash_1.default.get(this.component, 'fields.year.maxYear', 2030) || 2030;
|
|
217
208
|
for (let x = minYears; x <= maxYears; x++) {
|
|
218
|
-
|
|
209
|
+
years.push({
|
|
219
210
|
value: x,
|
|
220
211
|
label: x.toString(),
|
|
221
212
|
});
|
|
222
213
|
}
|
|
223
|
-
return
|
|
214
|
+
return years;
|
|
224
215
|
}
|
|
225
216
|
setErrorClasses(elements, dirty, hasError) {
|
|
226
217
|
super.setErrorClasses(elements, dirty, hasError);
|
|
@@ -545,7 +545,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
545
545
|
getView: (component, data) => {
|
|
546
546
|
var _a, _b;
|
|
547
547
|
const instance = flattenedComponents[component.key];
|
|
548
|
-
const view = instance ? instance.getView(
|
|
548
|
+
const view = instance ? instance.getView(instance.dataValue) : '';
|
|
549
549
|
// If there is an html tag in view, don't allow it to be injected in template
|
|
550
550
|
const htmlTagRegExp = new RegExp('<(.*?)>');
|
|
551
551
|
return typeof view === 'string' &&
|
|
@@ -960,9 +960,19 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
960
960
|
}
|
|
961
961
|
const column = lodash_1.default.clone(col);
|
|
962
962
|
const options = lodash_1.default.clone(this.options);
|
|
963
|
+
const rootSubmissionTz = lodash_1.default.get(this.root, 'options.submissionTimezone');
|
|
964
|
+
if (rootSubmissionTz && !options.submissionTimezone) {
|
|
965
|
+
options.submissionTimezone = rootSubmissionTz;
|
|
966
|
+
}
|
|
963
967
|
options.name += `[${rowIndex}]`;
|
|
964
968
|
options.row = `${rowIndex}-${colIndex}`;
|
|
965
969
|
options.rowIndex = rowIndex;
|
|
970
|
+
if (this.submissionTimezone) {
|
|
971
|
+
options.submissionTimezone = this.submissionTimezone;
|
|
972
|
+
if (column.type === 'datetime') {
|
|
973
|
+
column.widget = Object.assign(Object.assign({}, column.widget), { submissionTimezone: this.submissionTimezone });
|
|
974
|
+
}
|
|
975
|
+
}
|
|
966
976
|
options.onChange = (flags = {}, changed, modified) => {
|
|
967
977
|
var _a, _b, _c, _d;
|
|
968
978
|
if (((_a = changed.instance.root) === null || _a === void 0 ? void 0 : _a.id) && ((_b = this.root) === null || _b === void 0 ? void 0 : _b.id) !== changed.instance.root.id) {
|
|
@@ -30,6 +30,8 @@ export default class FileComponent extends Field {
|
|
|
30
30
|
} | undefined;
|
|
31
31
|
isSyncing: boolean | undefined;
|
|
32
32
|
abortUploads: any[] | undefined;
|
|
33
|
+
pendingfiles: any;
|
|
34
|
+
resolvedFiles: any[] | undefined;
|
|
33
35
|
get dataReady(): Promise<any>;
|
|
34
36
|
loadImage(fileInfo: any): any;
|
|
35
37
|
get emptyValue(): never[];
|
|
@@ -147,7 +149,7 @@ export default class FileComponent extends Field {
|
|
|
147
149
|
getMultipartOptions(fileToSync: any): any;
|
|
148
150
|
uploadFile(fileToSync: any): Promise<any>;
|
|
149
151
|
upload(): Promise<void | {
|
|
150
|
-
fileToSync:
|
|
152
|
+
fileToSync: any;
|
|
151
153
|
fileInfo: any;
|
|
152
154
|
}[]>;
|
|
153
155
|
syncFiles(): Promise<void>;
|
|
@@ -107,6 +107,8 @@ class FileComponent extends Field_1.default {
|
|
|
107
107
|
};
|
|
108
108
|
this.isSyncing = false;
|
|
109
109
|
this.abortUploads = [];
|
|
110
|
+
this.pendingfiles = [];
|
|
111
|
+
this.resolvedFiles = [];
|
|
110
112
|
}
|
|
111
113
|
get dataReady() {
|
|
112
114
|
return this.filesReady || Promise.resolve();
|
|
@@ -700,22 +702,42 @@ class FileComponent extends Field_1.default {
|
|
|
700
702
|
};
|
|
701
703
|
}
|
|
702
704
|
// Check file minimum size
|
|
703
|
-
if (this.component.fileMinSize
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
705
|
+
if (this.component.fileMinSize) {
|
|
706
|
+
const interpolatedMinSize = this.interpolate(this.component.fileMinSize, this.evalContext());
|
|
707
|
+
// This case is when the user entered fileMinSize expression, but did not enter or made a typo when
|
|
708
|
+
// setting the fileMinSize variable in the config of the project
|
|
709
|
+
if (!interpolatedMinSize) {
|
|
710
|
+
return {
|
|
711
|
+
status: 'error',
|
|
712
|
+
message: 'Please, check the entered parameters',
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
if (!this.validateMinSize(file, interpolatedMinSize)) {
|
|
716
|
+
return {
|
|
717
|
+
status: 'error',
|
|
718
|
+
message: this.t('fileTooSmall', {
|
|
719
|
+
size: interpolatedMinSize,
|
|
720
|
+
}),
|
|
721
|
+
};
|
|
722
|
+
}
|
|
710
723
|
}
|
|
711
724
|
// Check file maximum size
|
|
712
|
-
if (this.component.fileMaxSize
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
725
|
+
if (this.component.fileMaxSize) {
|
|
726
|
+
const interpolatedMaxSize = this.interpolate(this.component.fileMaxSize, this.evalContext());
|
|
727
|
+
if (!interpolatedMaxSize) {
|
|
728
|
+
return {
|
|
729
|
+
status: 'error',
|
|
730
|
+
message: 'Please, check the entered parameters',
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
if (!this.validateMaxSize(file, interpolatedMaxSize)) {
|
|
734
|
+
return {
|
|
735
|
+
status: 'error',
|
|
736
|
+
message: this.t('fileTooBig', {
|
|
737
|
+
size: interpolatedMaxSize,
|
|
738
|
+
}),
|
|
739
|
+
};
|
|
740
|
+
}
|
|
719
741
|
}
|
|
720
742
|
return {};
|
|
721
743
|
}
|
|
@@ -973,7 +995,23 @@ class FileComponent extends Field_1.default {
|
|
|
973
995
|
fileInfo,
|
|
974
996
|
};
|
|
975
997
|
}
|
|
976
|
-
|
|
998
|
+
if (fileToSync.status === "success") {
|
|
999
|
+
const uploadedFile = this.resolvedFiles.find(x => x.fileToSync.originalName === fileToSync.originalName);
|
|
1000
|
+
return {
|
|
1001
|
+
fileToSync: uploadedFile.fileToSync,
|
|
1002
|
+
fileInfo: uploadedFile.fileInfo,
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
const pendingFile = this.pendingfiles.find(x => x.name === fileToSync.name);
|
|
1006
|
+
if (pendingFile) {
|
|
1007
|
+
fileInfo = yield pendingFile.fileInfoProm;
|
|
1008
|
+
}
|
|
1009
|
+
else {
|
|
1010
|
+
const promInfo = this.uploadFile(fileToSync);
|
|
1011
|
+
this.pendingfiles.push({ name: fileToSync.name, fileInfoProm: promInfo });
|
|
1012
|
+
fileInfo = yield promInfo;
|
|
1013
|
+
}
|
|
1014
|
+
this.pendingfiles = this.pendingfiles.filter(x => x.name !== fileToSync.name);
|
|
977
1015
|
fileToSync.status = 'success';
|
|
978
1016
|
fileToSync.message = this.t('Succefully uploaded');
|
|
979
1017
|
fileInfo.originalName = fileToSync.originalName;
|
|
@@ -998,6 +1036,10 @@ class FileComponent extends Field_1.default {
|
|
|
998
1036
|
finally {
|
|
999
1037
|
delete fileToSync.progress;
|
|
1000
1038
|
this.redraw();
|
|
1039
|
+
const fileExists = this.resolvedFiles.find(x => x.fileInfo.originalName === fileToSync.originalName);
|
|
1040
|
+
if (!fileExists && fileToSync.status !== 'error') {
|
|
1041
|
+
this.resolvedFiles.push({ fileToSync, fileInfo });
|
|
1042
|
+
}
|
|
1001
1043
|
}
|
|
1002
1044
|
return {
|
|
1003
1045
|
fileToSync,
|
|
@@ -1007,7 +1049,7 @@ class FileComponent extends Field_1.default {
|
|
|
1007
1049
|
});
|
|
1008
1050
|
}
|
|
1009
1051
|
syncFiles() {
|
|
1010
|
-
var _a;
|
|
1052
|
+
var _a, _b, _c;
|
|
1011
1053
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1012
1054
|
this.isSyncing = true;
|
|
1013
1055
|
this.fileDropHidden = true;
|
|
@@ -1017,6 +1059,9 @@ class FileComponent extends Field_1.default {
|
|
|
1017
1059
|
this.delete(),
|
|
1018
1060
|
this.upload(),
|
|
1019
1061
|
]);
|
|
1062
|
+
if (filesToUpload.length !== ((_b = (_a = this.filesToSync) === null || _a === void 0 ? void 0 : _a.filesToUpload) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
1063
|
+
return;
|
|
1064
|
+
}
|
|
1020
1065
|
this.filesToSync.filesToDelete = filesToDelete
|
|
1021
1066
|
.filter((file) => { var _a; return ((_a = file.fileToSync) === null || _a === void 0 ? void 0 : _a.status) === 'error'; })
|
|
1022
1067
|
.map((file) => file.fileToSync);
|
|
@@ -1030,7 +1075,7 @@ class FileComponent extends Field_1.default {
|
|
|
1030
1075
|
.filter((file) => { var _a; return ((_a = file.fileToSync) === null || _a === void 0 ? void 0 : _a.status) === 'success'; })
|
|
1031
1076
|
.map((file) => file.fileInfo);
|
|
1032
1077
|
this.dataValue.push(...data);
|
|
1033
|
-
(
|
|
1078
|
+
(_c = this.triggerChange) === null || _c === void 0 ? void 0 : _c.call(this, {
|
|
1034
1079
|
modified: true,
|
|
1035
1080
|
});
|
|
1036
1081
|
return Promise.resolve();
|
|
@@ -571,9 +571,11 @@ class FormComponent extends Component_1.default {
|
|
|
571
571
|
* @returns {*|boolean} - TRUE if the subform should be submitted, FALSE if it should not.
|
|
572
572
|
*/
|
|
573
573
|
get shouldSubmit() {
|
|
574
|
+
const hiddenByJsonOnly = !this.hasCondition() && this.component.hidden;
|
|
574
575
|
return (this.subFormReady &&
|
|
575
576
|
(!this.component.hasOwnProperty('reference') || this.component.reference) &&
|
|
576
|
-
!this.shouldConditionallyClear()
|
|
577
|
+
!this.shouldConditionallyClear() &&
|
|
578
|
+
!(hiddenByJsonOnly && this.component.clearOnHide));
|
|
577
579
|
}
|
|
578
580
|
/**
|
|
579
581
|
* Returns the data for the subform.
|
|
@@ -34,6 +34,7 @@ export default class NumberComponent extends Input {
|
|
|
34
34
|
* @returns {number} a parsed number
|
|
35
35
|
*/
|
|
36
36
|
parseNumber(value: string): number;
|
|
37
|
+
normalizeValue(value: any, flags?: {}, emptyValue?: null): any;
|
|
37
38
|
setInputMask(input: any): void;
|
|
38
39
|
getValueAt(index: any): number | null;
|
|
39
40
|
setValueAt(index: any, value: any, flags?: {}): void;
|
|
@@ -143,6 +143,24 @@ class NumberComponent extends Input_1.default {
|
|
|
143
143
|
return parseFloat(value);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
+
normalizeValue(value, flags = {}, emptyValue = this.emptyValue) {
|
|
147
|
+
var _a;
|
|
148
|
+
if (typeof value === 'string') {
|
|
149
|
+
const result = this.parseNumber(value);
|
|
150
|
+
value = lodash_1.default.isNaN(result) ? this.emptyValue : result;
|
|
151
|
+
}
|
|
152
|
+
if (((_a = this.component) === null || _a === void 0 ? void 0 : _a.multiple) && Array.isArray(value)) {
|
|
153
|
+
const normilizedValues = value.map((val) => {
|
|
154
|
+
if (typeof val === 'string') {
|
|
155
|
+
const result = this.parseNumber(val);
|
|
156
|
+
return lodash_1.default.isNaN(result) ? this.emptyValue : result;
|
|
157
|
+
}
|
|
158
|
+
return val;
|
|
159
|
+
});
|
|
160
|
+
value = normilizedValues;
|
|
161
|
+
}
|
|
162
|
+
return super.normalizeValue(value, flags, emptyValue);
|
|
163
|
+
}
|
|
146
164
|
setInputMask(input) {
|
|
147
165
|
let numberPattern = '[0-9';
|
|
148
166
|
numberPattern += this.decimalSeparator || '';
|
|
@@ -519,7 +519,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
519
519
|
noUpdateEvent: true,
|
|
520
520
|
});
|
|
521
521
|
}
|
|
522
|
-
else if (this.shouldAddDefaultValue && !this.options.readOnly) {
|
|
522
|
+
else if (this.shouldAddDefaultValue && !this.options.readOnly && this.root && !this.root.submissionSet) {
|
|
523
523
|
// If a default value is provided then select it.
|
|
524
524
|
const defaultValue = this.defaultValue;
|
|
525
525
|
if (!this.isEmpty(defaultValue)) {
|
|
@@ -1339,6 +1339,10 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
1339
1339
|
}
|
|
1340
1340
|
lodash_1.default.set(submission.metadata.selectData, this.path, templateData);
|
|
1341
1341
|
}
|
|
1342
|
+
else if (!this.templateData[templateValue] &&
|
|
1343
|
+
this.isEmpty(value)) {
|
|
1344
|
+
lodash_1.default.unset(this.root.submission, `metadata.selectData.${this.path}`);
|
|
1345
|
+
}
|
|
1342
1346
|
if (flags.resetValue && ((_b = this.root) === null || _b === void 0 ? void 0 : _b.submission) && !this.options.readOnly) {
|
|
1343
1347
|
const submission = this.root.submission;
|
|
1344
1348
|
if (!submission.metadata) {
|
|
@@ -49,7 +49,7 @@ class SignatureComponent extends Input_1.default {
|
|
|
49
49
|
]);
|
|
50
50
|
}
|
|
51
51
|
init() {
|
|
52
|
-
var _a, _b, _c, _d
|
|
52
|
+
var _a, _b, _c, _d;
|
|
53
53
|
super.init();
|
|
54
54
|
this.currentWidth = 0;
|
|
55
55
|
this.scale = 1;
|
|
@@ -60,10 +60,10 @@ class SignatureComponent extends Input_1.default {
|
|
|
60
60
|
this.component.height = '200px';
|
|
61
61
|
}
|
|
62
62
|
if (this.component.keepOverlayRatio &&
|
|
63
|
-
|
|
64
|
-
((
|
|
65
|
-
((
|
|
66
|
-
this.ratio = ((
|
|
63
|
+
this.options.pdf &&
|
|
64
|
+
((_a = this.component.overlay) === null || _a === void 0 ? void 0 : _a.width) &&
|
|
65
|
+
((_b = this.component.overlay) === null || _b === void 0 ? void 0 : _b.height)) {
|
|
66
|
+
this.ratio = ((_c = this.component.overlay) === null || _c === void 0 ? void 0 : _c.width) / ((_d = this.component.overlay) === null || _d === void 0 ? void 0 : _d.height);
|
|
67
67
|
this.component.width = '100%';
|
|
68
68
|
this.component.height = 'auto';
|
|
69
69
|
}
|
|
@@ -7,7 +7,6 @@ declare const _default: ({
|
|
|
7
7
|
placeholder: string;
|
|
8
8
|
weight: number;
|
|
9
9
|
conditional?: undefined;
|
|
10
|
-
customConditional?: undefined;
|
|
11
10
|
ignore?: undefined;
|
|
12
11
|
} | {
|
|
13
12
|
type: string;
|
|
@@ -24,7 +23,6 @@ declare const _default: ({
|
|
|
24
23
|
};
|
|
25
24
|
};
|
|
26
25
|
weight: number;
|
|
27
|
-
customConditional?: undefined;
|
|
28
26
|
ignore?: undefined;
|
|
29
27
|
} | {
|
|
30
28
|
weight: number;
|
|
@@ -32,9 +30,6 @@ declare const _default: ({
|
|
|
32
30
|
label: string;
|
|
33
31
|
tooltip: string;
|
|
34
32
|
key: string;
|
|
35
|
-
customConditional: ({ options }: {
|
|
36
|
-
options: any;
|
|
37
|
-
}) => boolean;
|
|
38
33
|
input: boolean;
|
|
39
34
|
placeholder?: undefined;
|
|
40
35
|
conditional?: undefined;
|
|
@@ -49,6 +44,5 @@ declare const _default: ({
|
|
|
49
44
|
placeholder?: undefined;
|
|
50
45
|
weight?: undefined;
|
|
51
46
|
conditional?: undefined;
|
|
52
|
-
customConditional?: undefined;
|
|
53
47
|
})[];
|
|
54
48
|
export default _default;
|
|
@@ -48,7 +48,6 @@ exports.default = [
|
|
|
48
48
|
label: 'Keep Overlay Aspect Ratio',
|
|
49
49
|
tooltip: 'If checked, the field will have the same aspect ratio as its preview.',
|
|
50
50
|
key: 'keepOverlayRatio',
|
|
51
|
-
customConditional: ({ options }) => { var _a; return ((_a = options === null || options === void 0 ? void 0 : options.editForm) === null || _a === void 0 ? void 0 : _a.display) === 'pdf'; },
|
|
52
51
|
input: true,
|
|
53
52
|
},
|
|
54
53
|
{
|
|
@@ -10,6 +10,8 @@ declare const _default: ({
|
|
|
10
10
|
validate?: undefined;
|
|
11
11
|
autofocus?: undefined;
|
|
12
12
|
overrideEditForm?: undefined;
|
|
13
|
+
multiple?: undefined;
|
|
14
|
+
customConditional?: undefined;
|
|
13
15
|
dataSrc?: undefined;
|
|
14
16
|
data?: undefined;
|
|
15
17
|
defaultValue?: undefined;
|
|
@@ -27,6 +29,8 @@ declare const _default: ({
|
|
|
27
29
|
autofocus: boolean;
|
|
28
30
|
overrideEditForm: boolean;
|
|
29
31
|
ignore?: undefined;
|
|
32
|
+
multiple?: undefined;
|
|
33
|
+
customConditional?: undefined;
|
|
30
34
|
dataSrc?: undefined;
|
|
31
35
|
data?: undefined;
|
|
32
36
|
defaultValue?: undefined;
|
|
@@ -42,6 +46,25 @@ declare const _default: ({
|
|
|
42
46
|
validate?: undefined;
|
|
43
47
|
autofocus?: undefined;
|
|
44
48
|
overrideEditForm?: undefined;
|
|
49
|
+
multiple?: undefined;
|
|
50
|
+
customConditional?: undefined;
|
|
51
|
+
dataSrc?: undefined;
|
|
52
|
+
data?: undefined;
|
|
53
|
+
defaultValue?: undefined;
|
|
54
|
+
} | {
|
|
55
|
+
label: string;
|
|
56
|
+
multiple: boolean;
|
|
57
|
+
key: string;
|
|
58
|
+
type: string;
|
|
59
|
+
input: boolean;
|
|
60
|
+
tooltip: string;
|
|
61
|
+
customConditional: string;
|
|
62
|
+
weight: number;
|
|
63
|
+
ignore?: undefined;
|
|
64
|
+
placeholder?: undefined;
|
|
65
|
+
validate?: undefined;
|
|
66
|
+
autofocus?: undefined;
|
|
67
|
+
overrideEditForm?: undefined;
|
|
45
68
|
dataSrc?: undefined;
|
|
46
69
|
data?: undefined;
|
|
47
70
|
defaultValue?: undefined;
|
|
@@ -57,6 +80,8 @@ declare const _default: ({
|
|
|
57
80
|
validate?: undefined;
|
|
58
81
|
autofocus?: undefined;
|
|
59
82
|
overrideEditForm?: undefined;
|
|
83
|
+
multiple?: undefined;
|
|
84
|
+
customConditional?: undefined;
|
|
60
85
|
dataSrc?: undefined;
|
|
61
86
|
data?: undefined;
|
|
62
87
|
defaultValue?: undefined;
|
|
@@ -80,5 +105,7 @@ declare const _default: ({
|
|
|
80
105
|
validate?: undefined;
|
|
81
106
|
autofocus?: undefined;
|
|
82
107
|
overrideEditForm?: undefined;
|
|
108
|
+
multiple?: undefined;
|
|
109
|
+
customConditional?: undefined;
|
|
83
110
|
})[];
|
|
84
111
|
export default _default;
|
|
@@ -69,6 +69,16 @@ exports.default = [
|
|
|
69
69
|
placeholder: 'Number of Columns',
|
|
70
70
|
tooltip: 'Enter the number or columns that should be displayed by this table.',
|
|
71
71
|
},
|
|
72
|
+
{
|
|
73
|
+
label: "Column Headers",
|
|
74
|
+
multiple: true,
|
|
75
|
+
key: "header",
|
|
76
|
+
type: "textfield",
|
|
77
|
+
input: true,
|
|
78
|
+
tooltip: 'Enter header names for the columns',
|
|
79
|
+
customConditional: "if(instance && instance.dataValue && Array.isArray(instance.dataValue)) {\r\n const isAllowToAddHeader = instance.dataValue.length < data.numCols;\r\n const addBtn = _.get(instance, 'refs.addButton[0]', null);\r\n if(addBtn) {\r\n isAllowToAddHeader? addBtn.removeAttribute('disabled'): addBtn.setAttribute('disabled', 'disabled');\r\n }\r\n} ",
|
|
80
|
+
weight: 3,
|
|
81
|
+
},
|
|
72
82
|
{
|
|
73
83
|
type: 'checkbox',
|
|
74
84
|
label: 'Clone Row Components',
|
package/lib/cjs/formio.form.js
CHANGED
|
@@ -132,12 +132,9 @@ function registerModule(mod, defaultFn = null, options = {}) {
|
|
|
132
132
|
break;
|
|
133
133
|
default:
|
|
134
134
|
if (defaultFn) {
|
|
135
|
-
|
|
136
|
-
console.warn('Unknown module option', key);
|
|
137
|
-
}
|
|
135
|
+
defaultFn(key, mod);
|
|
138
136
|
break;
|
|
139
137
|
}
|
|
140
|
-
console.log('Unknown module option', key);
|
|
141
138
|
}
|
|
142
139
|
}
|
|
143
140
|
}
|
|
@@ -151,7 +148,7 @@ function useModule(defaultFn = null) {
|
|
|
151
148
|
plugins = lodash_1.default.isArray(plugins)
|
|
152
149
|
? plugins
|
|
153
150
|
: [
|
|
154
|
-
plugins
|
|
151
|
+
plugins
|
|
155
152
|
];
|
|
156
153
|
plugins.forEach((plugin) => {
|
|
157
154
|
if (Array.isArray(plugin)) {
|
package/lib/cjs/package.json
CHANGED
|
@@ -35,9 +35,15 @@ function azure(formio) {
|
|
|
35
35
|
downloadFile(file) {
|
|
36
36
|
return formio.makeRequest('file', `${formio.formUrl}/storage/azure?name=${xhr_1.default.trim(file.name)}`, 'GET');
|
|
37
37
|
},
|
|
38
|
-
deleteFile
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
deleteFile(fileInfo, options) {
|
|
39
|
+
const name = xhr_1.default.trim(fileInfo.name);
|
|
40
|
+
const key = xhr_1.default.trim(fileInfo.key);
|
|
41
|
+
return formio.makeRequest('', `${formio.formUrl}/storage/azure?name=${encodeURIComponent(name)}&key=${encodeURIComponent(key)}`, 'delete').then((response) => {
|
|
42
|
+
return {
|
|
43
|
+
success: true,
|
|
44
|
+
key: (response === null || response === void 0 ? void 0 : response.key) || key,
|
|
45
|
+
};
|
|
46
|
+
});
|
|
41
47
|
},
|
|
42
48
|
};
|
|
43
49
|
}
|
|
@@ -78,4 +78,6 @@ exports.default = {
|
|
|
78
78
|
requiredDayEmpty: '{{ field }} is required',
|
|
79
79
|
requiredMonthField: '{{ field }} is required',
|
|
80
80
|
requiredYearField: '{{ field }} is required',
|
|
81
|
+
fileTooSmall: 'File is too small; it must be at least {{ size }}',
|
|
82
|
+
fileTooBig: 'File is too big; it must be at most {{ size }}'
|
|
81
83
|
};
|
package/lib/cjs/utils/i18n.d.ts
CHANGED
package/lib/cjs/utils/i18n.js
CHANGED
|
@@ -19,6 +19,7 @@ class I18n {
|
|
|
19
19
|
constructor(languages = {}) {
|
|
20
20
|
this.languages = i18Defaults;
|
|
21
21
|
this.language = 'en';
|
|
22
|
+
this.originalLanguage = 'en';
|
|
22
23
|
this.currentLanguage = i18Defaults.en;
|
|
23
24
|
this.setLanguages(languages);
|
|
24
25
|
this.changeLanguage(this.language);
|
|
@@ -72,6 +73,7 @@ class I18n {
|
|
|
72
73
|
return new I18n();
|
|
73
74
|
}
|
|
74
75
|
changeLanguage(language, ready = null) {
|
|
76
|
+
this.originalLanguage = language;
|
|
75
77
|
if (!this.languages[language]) {
|
|
76
78
|
language = 'en';
|
|
77
79
|
}
|
package/lib/cjs/utils/index.d.ts
CHANGED
|
@@ -94,7 +94,7 @@ declare const FormioUtils: {
|
|
|
94
94
|
offsetDate(date: Date, timezone: string): Date;
|
|
95
95
|
zonesLoaded(): boolean;
|
|
96
96
|
shouldLoadZones(timezone: string): boolean;
|
|
97
|
-
loadZones(url: string,
|
|
97
|
+
loadZones(url: string, _timezone: any): any;
|
|
98
98
|
momentDate(value: string | Date, format: string, timezone: string, options: object): Date;
|
|
99
99
|
formatDate(timezonesUrl: string, value: string | Date, format: string, timezone: string, flatPickrInputFormat: string): string;
|
|
100
100
|
formatOffset(timezonesUrl: string, formatFn: Function, date: string | Date, format: string, timezone: string): string;
|
package/lib/cjs/utils/utils.d.ts
CHANGED
|
@@ -202,7 +202,7 @@ export function shouldLoadZones(timezone: string): boolean;
|
|
|
202
202
|
* @param {string} timezone - The timezone to load.
|
|
203
203
|
* @returns {Promise<any> | *} - Resolves when the zones for this timezone are loaded.
|
|
204
204
|
*/
|
|
205
|
-
export function loadZones(url: string,
|
|
205
|
+
export function loadZones(url: string, _timezone: any): Promise<any> | any;
|
|
206
206
|
/**
|
|
207
207
|
* Get the moment date object for translating dates with timezones.
|
|
208
208
|
* @param {string|Date} value - The value to convert into a moment date.
|