@formio/js 5.4.0-api98.1 → 5.4.1
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 +26 -5
- 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 +26 -5
- package/dist/formio.form.js +3462 -3448
- 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 +26 -5
- package/dist/formio.full.js +4277 -4263
- 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 +1738 -1724
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +2 -2
- package/dist/formio.utils.js +1631 -1617
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -2
- package/lib/cjs/Element.d.ts +11 -0
- package/lib/cjs/Element.js +24 -0
- package/lib/cjs/Embed.js +23 -2
- package/lib/cjs/Form.d.ts +1 -1
- package/lib/cjs/Formio.js +1 -1
- package/lib/cjs/PDFBuilder.js +6 -1
- package/lib/cjs/Webform.d.ts +1 -1
- package/lib/cjs/Webform.js +9 -6
- package/lib/cjs/WebformBuilder.js +14 -1
- package/lib/cjs/Wizard.js +15 -11
- package/lib/cjs/components/Components.d.ts +3 -0
- package/lib/cjs/components/Components.js +3 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +13 -0
- package/lib/cjs/components/_classes/component/Component.js +137 -44
- package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +1 -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 -7
- package/lib/cjs/components/address/Address.js +2 -0
- package/lib/cjs/components/button/Button.d.ts +1 -0
- package/lib/cjs/components/button/Button.js +22 -1
- package/lib/cjs/components/datagrid/DataGrid.js +35 -10
- package/lib/cjs/components/datamap/DataMap.d.ts +1 -4
- package/lib/cjs/components/datamap/DataMap.js +42 -10
- package/lib/cjs/components/datetime/DateTime.js +11 -1
- package/lib/cjs/components/datetime/editForm/DateTime.edit.date.d.ts +18 -1
- package/lib/cjs/components/datetime/editForm/DateTime.edit.date.js +3 -0
- package/lib/cjs/components/datetime/editForm/DateTime.edit.time.d.ts +13 -2
- package/lib/cjs/components/datetime/editForm/DateTime.edit.time.js +3 -0
- 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 +13 -3
- package/lib/cjs/components/file/File.js +7 -6
- package/lib/cjs/components/form/Form.d.ts +1 -0
- package/lib/cjs/components/form/Form.js +20 -8
- 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 +6 -3
- 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/textfield/editForm/TextField.edit.display.d.ts +0 -10
- package/lib/cjs/components/textfield/editForm/TextField.edit.display.js +9 -23
- package/lib/cjs/formio.form.js +2 -5
- package/lib/cjs/package.json +1 -1
- package/lib/cjs/providers/address/GoogleAddressProvider.js +1 -1
- package/lib/cjs/providers/storage/azure.js +9 -3
- package/lib/cjs/translations/en.d.ts +1 -0
- package/lib/cjs/translations/en.js +3 -1
- package/lib/cjs/utils/formUtils.d.ts +2 -2
- package/lib/cjs/utils/index.d.ts +3 -3
- package/lib/cjs/utils/utils.d.ts +1 -1
- package/lib/cjs/utils/utils.js +28 -11
- package/lib/cjs/widgets/CalendarWidget.js +1 -1
- package/lib/mjs/Element.d.ts +11 -0
- package/lib/mjs/Element.js +23 -0
- package/lib/mjs/Embed.js +21 -2
- package/lib/mjs/Form.d.ts +1 -1
- package/lib/mjs/Formio.js +1 -1
- package/lib/mjs/PDFBuilder.js +6 -1
- package/lib/mjs/Webform.d.ts +1 -1
- package/lib/mjs/Webform.js +6 -3
- package/lib/mjs/WebformBuilder.js +13 -1
- package/lib/mjs/Wizard.js +9 -10
- package/lib/mjs/components/Components.d.ts +3 -0
- package/lib/mjs/components/Components.js +3 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +13 -0
- package/lib/mjs/components/_classes/component/Component.js +135 -43
- package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +1 -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 -6
- package/lib/mjs/components/address/Address.js +2 -0
- package/lib/mjs/components/button/Button.d.ts +1 -0
- package/lib/mjs/components/button/Button.js +21 -1
- package/lib/mjs/components/datagrid/DataGrid.js +39 -11
- package/lib/mjs/components/datamap/DataMap.d.ts +1 -4
- package/lib/mjs/components/datamap/DataMap.js +41 -10
- package/lib/mjs/components/datetime/DateTime.js +11 -1
- package/lib/mjs/components/datetime/editForm/DateTime.edit.date.d.ts +18 -1
- package/lib/mjs/components/datetime/editForm/DateTime.edit.date.js +3 -0
- package/lib/mjs/components/datetime/editForm/DateTime.edit.time.d.ts +13 -2
- package/lib/mjs/components/datetime/editForm/DateTime.edit.time.js +3 -0
- 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 +12 -2
- package/lib/mjs/components/file/File.js +7 -6
- package/lib/mjs/components/form/Form.d.ts +1 -0
- package/lib/mjs/components/form/Form.js +18 -6
- 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 +6 -3
- 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/textfield/editForm/TextField.edit.display.d.ts +0 -10
- package/lib/mjs/components/textfield/editForm/TextField.edit.display.js +9 -23
- package/lib/mjs/formio.form.js +4 -7
- package/lib/mjs/package.json +1 -1
- package/lib/mjs/providers/address/GoogleAddressProvider.js +1 -1
- package/lib/mjs/providers/storage/azure.js +9 -3
- package/lib/mjs/translations/en.d.ts +1 -0
- package/lib/mjs/translations/en.js +3 -1
- package/lib/mjs/utils/formUtils.d.ts +2 -2
- package/lib/mjs/utils/index.d.ts +3 -3
- package/lib/mjs/utils/utils.d.ts +1 -1
- package/lib/mjs/utils/utils.js +27 -11
- package/lib/mjs/widgets/CalendarWidget.js +2 -2
- package/package.json +8 -7
|
@@ -139,6 +139,13 @@ class DateTimeComponent extends Input_1.default {
|
|
|
139
139
|
get momentFormat() {
|
|
140
140
|
return utils_1.default.convertFormatToMoment(this.component.format);
|
|
141
141
|
}
|
|
142
|
+
get timezone() {
|
|
143
|
+
const widget = this.component.widget;
|
|
144
|
+
if (widget && widget.type === 'calendar') {
|
|
145
|
+
return this.getTimezone(widget);
|
|
146
|
+
}
|
|
147
|
+
return super.timezone;
|
|
148
|
+
}
|
|
142
149
|
isEmpty(value = this.dataValue) {
|
|
143
150
|
if (value && value.toString() === 'Invalid Date') {
|
|
144
151
|
return true;
|
|
@@ -170,7 +177,10 @@ class DateTimeComponent extends Input_1.default {
|
|
|
170
177
|
let format = utils_1.default.convertFormatToMoment(this.component.format);
|
|
171
178
|
format += format.match(/z$/) ? '' : ' z';
|
|
172
179
|
const timezone = this.timezone;
|
|
173
|
-
|
|
180
|
+
const useTimezoneAwareFormat = value &&
|
|
181
|
+
timezone &&
|
|
182
|
+
(this.options.pdf || (options === null || options === void 0 ? void 0 : options.email));
|
|
183
|
+
if (useTimezoneAwareFormat) {
|
|
174
184
|
if (Array.isArray(value) && this.component.multiple) {
|
|
175
185
|
return value
|
|
176
186
|
.map((item) => lodash_1.default.trim(utils_1.default.momentDate(item, format, timezone, options).format(format)))
|
|
@@ -5,8 +5,10 @@ declare const _default: ({
|
|
|
5
5
|
label: string;
|
|
6
6
|
weight: number;
|
|
7
7
|
tooltip: string;
|
|
8
|
+
validate: {
|
|
9
|
+
custom: string;
|
|
10
|
+
};
|
|
8
11
|
placeholder?: undefined;
|
|
9
|
-
validate?: undefined;
|
|
10
12
|
title?: undefined;
|
|
11
13
|
collapsible?: undefined;
|
|
12
14
|
collapsed?: undefined;
|
|
@@ -57,7 +59,22 @@ declare const _default: ({
|
|
|
57
59
|
label?: undefined;
|
|
58
60
|
weight?: undefined;
|
|
59
61
|
tooltip?: undefined;
|
|
62
|
+
validate?: undefined;
|
|
60
63
|
placeholder?: undefined;
|
|
64
|
+
} | {
|
|
65
|
+
type: string;
|
|
66
|
+
input: boolean;
|
|
67
|
+
key: string;
|
|
68
|
+
label: string;
|
|
69
|
+
tooltip: string;
|
|
70
|
+
weight: number;
|
|
61
71
|
validate?: undefined;
|
|
72
|
+
placeholder?: undefined;
|
|
73
|
+
title?: undefined;
|
|
74
|
+
collapsible?: undefined;
|
|
75
|
+
collapsed?: undefined;
|
|
76
|
+
style?: undefined;
|
|
77
|
+
customConditional?: undefined;
|
|
78
|
+
components?: undefined;
|
|
62
79
|
})[];
|
|
63
80
|
export default _default;
|
|
@@ -13,6 +13,9 @@ exports.default = [
|
|
|
13
13
|
label: 'Enable Date Input',
|
|
14
14
|
weight: 0,
|
|
15
15
|
tooltip: 'Enables date input for this field.',
|
|
16
|
+
validate: {
|
|
17
|
+
custom: "valid = !data.enableTime && !input ? 'Cannot disable both Date and Time inputs at the same time' : true",
|
|
18
|
+
},
|
|
16
19
|
},
|
|
17
20
|
{
|
|
18
21
|
type: 'tags',
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
declare const _default: {
|
|
1
|
+
declare const _default: ({
|
|
2
2
|
type: string;
|
|
3
3
|
input: boolean;
|
|
4
4
|
key: string;
|
|
5
5
|
label: string;
|
|
6
6
|
tooltip: string;
|
|
7
7
|
weight: number;
|
|
8
|
-
|
|
8
|
+
validate: {
|
|
9
|
+
custom: string;
|
|
10
|
+
};
|
|
11
|
+
} | {
|
|
12
|
+
type: string;
|
|
13
|
+
input: boolean;
|
|
14
|
+
key: string;
|
|
15
|
+
label: string;
|
|
16
|
+
tooltip: string;
|
|
17
|
+
weight: number;
|
|
18
|
+
validate?: undefined;
|
|
19
|
+
})[];
|
|
9
20
|
export default _default;
|
|
@@ -8,6 +8,9 @@ exports.default = [
|
|
|
8
8
|
label: 'Enable Time Input',
|
|
9
9
|
tooltip: 'Enables time input for this field.',
|
|
10
10
|
weight: 0,
|
|
11
|
+
validate: {
|
|
12
|
+
custom: "valid = !data.enableDate && !input ? 'Cannot disable both Date and Time inputs at the same time' : true",
|
|
13
|
+
},
|
|
11
14
|
},
|
|
12
15
|
{
|
|
13
16
|
type: 'number',
|
|
@@ -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' &&
|
|
@@ -814,7 +814,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
814
814
|
}
|
|
815
815
|
}
|
|
816
816
|
saveRow(rowIndex, modified) {
|
|
817
|
-
var _a, _b, _c;
|
|
817
|
+
var _a, _b, _c, _d;
|
|
818
818
|
const editRow = this.editRows[rowIndex];
|
|
819
819
|
if (this.options.readOnly) {
|
|
820
820
|
return;
|
|
@@ -869,7 +869,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
869
869
|
if (this.component.rowDrafts) {
|
|
870
870
|
editRow.components.forEach((comp) => comp.setPristine(this.pristine));
|
|
871
871
|
}
|
|
872
|
-
this.checkValidity(null,
|
|
872
|
+
this.checkValidity(null, !this.component.rowDrafts || ((_d = this.root) === null || _d === void 0 ? void 0 : _d.submitted));
|
|
873
873
|
this.redraw();
|
|
874
874
|
if (editRow.alerts) {
|
|
875
875
|
editRow.alerts = false;
|
|
@@ -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) {
|
|
@@ -968,16 +968,17 @@ class FileComponent extends Field_1.default {
|
|
|
968
968
|
}
|
|
969
969
|
uploadFile(fileToSync) {
|
|
970
970
|
return __awaiter(this, void 0, void 0, function* () {
|
|
971
|
-
|
|
971
|
+
const filePromise = this.fileService.uploadFile(fileToSync.storage, fileToSync.file, fileToSync.name, fileToSync.dir,
|
|
972
972
|
// Progress callback
|
|
973
973
|
this.updateProgress.bind(this, fileToSync), fileToSync.url, fileToSync.options, fileToSync.fileKey, fileToSync.groupPermissions, fileToSync.groupResourceId, () => {
|
|
974
|
-
this.emit('fileUploadingStart');
|
|
974
|
+
this.emit('fileUploadingStart', filePromise);
|
|
975
975
|
},
|
|
976
976
|
// Abort upload callback
|
|
977
977
|
(abort) => this.abortUploads.push({
|
|
978
978
|
id: fileToSync.id,
|
|
979
979
|
abort,
|
|
980
980
|
}), this.getMultipartOptions(fileToSync));
|
|
981
|
+
return yield filePromise;
|
|
981
982
|
});
|
|
982
983
|
}
|
|
983
984
|
upload() {
|
|
@@ -1015,7 +1016,7 @@ class FileComponent extends Field_1.default {
|
|
|
1015
1016
|
fileToSync.message = this.t('Succefully uploaded');
|
|
1016
1017
|
fileInfo.originalName = fileToSync.originalName;
|
|
1017
1018
|
fileInfo.hash = fileToSync.hash;
|
|
1018
|
-
this.emit('fileUploadingEnd');
|
|
1019
|
+
this.emit('fileUploadingEnd', Promise.resolve(fileInfo));
|
|
1019
1020
|
}
|
|
1020
1021
|
catch (response) {
|
|
1021
1022
|
fileToSync.status = 'error';
|
|
@@ -1026,8 +1027,8 @@ class FileComponent extends Field_1.default {
|
|
|
1026
1027
|
: response.type === 'abort'
|
|
1027
1028
|
? this.t('Request was aborted')
|
|
1028
1029
|
: response.toString();
|
|
1029
|
-
this.emit('fileUploadingEnd');
|
|
1030
|
-
this.emit('fileUploadError', {
|
|
1030
|
+
this.emit('fileUploadingEnd', Promise.reject(response));
|
|
1031
|
+
this.emit(lodash_1.default.get(response, 'type') === 'abort' ? 'fileUploadCanceled' : 'fileUploadError', {
|
|
1031
1032
|
fileToSync,
|
|
1032
1033
|
response,
|
|
1033
1034
|
});
|
|
@@ -1036,7 +1037,7 @@ class FileComponent extends Field_1.default {
|
|
|
1036
1037
|
delete fileToSync.progress;
|
|
1037
1038
|
this.redraw();
|
|
1038
1039
|
const fileExists = this.resolvedFiles.find(x => x.fileInfo.originalName === fileToSync.originalName);
|
|
1039
|
-
if (!fileExists) {
|
|
1040
|
+
if (!fileExists && fileToSync.status !== 'error') {
|
|
1040
1041
|
this.resolvedFiles.push({ fileToSync, fileInfo });
|
|
1041
1042
|
}
|
|
1042
1043
|
}
|
|
@@ -42,6 +42,7 @@ export default class FormComponent extends Component {
|
|
|
42
42
|
everyComponent(...args: any[]): any;
|
|
43
43
|
setSubFormDisabled(subForm: any): void;
|
|
44
44
|
updateSubWizards(subForm: any): void;
|
|
45
|
+
updateTopLevelComponentsMap(): void;
|
|
45
46
|
setComponentsMap(): void;
|
|
46
47
|
/**
|
|
47
48
|
* Create a subform instance.
|
|
@@ -400,13 +400,22 @@ class FormComponent extends Component_1.default {
|
|
|
400
400
|
this.emit('subWizardsUpdated', subForm);
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
|
+
updateTopLevelComponentsMap() {
|
|
404
|
+
let prevRootId = null;
|
|
405
|
+
let currentRoot = this.root;
|
|
406
|
+
const subFormComponentMap = this.subForm.componentsMap;
|
|
407
|
+
// update components map for all top forms
|
|
408
|
+
while (currentRoot && prevRootId !== currentRoot.id) {
|
|
409
|
+
lodash_1.default.assign(currentRoot.componentsMap, subFormComponentMap);
|
|
410
|
+
prevRootId = currentRoot.id;
|
|
411
|
+
currentRoot = currentRoot.root;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
403
414
|
setComponentsMap() {
|
|
404
415
|
if (!this.subForm) {
|
|
405
416
|
return;
|
|
406
417
|
}
|
|
407
|
-
|
|
408
|
-
const formComponentsMap = this.subForm.componentsMap;
|
|
409
|
-
lodash_1.default.assign(componentsMap, formComponentsMap);
|
|
418
|
+
this.updateTopLevelComponentsMap();
|
|
410
419
|
}
|
|
411
420
|
/**
|
|
412
421
|
* Create a subform instance.
|
|
@@ -431,13 +440,13 @@ class FormComponent extends Component_1.default {
|
|
|
431
440
|
// Render the form.
|
|
432
441
|
return new Form_1.default(form, this.getSubOptions()).ready
|
|
433
442
|
.then((instance) => {
|
|
434
|
-
var _a
|
|
443
|
+
var _a;
|
|
435
444
|
this.subForm = instance;
|
|
436
445
|
this.subForm.currentForm = this;
|
|
437
446
|
this.subForm.parentVisible = this.visible;
|
|
438
447
|
this.setComponentsMap();
|
|
439
|
-
this.component.components =
|
|
440
|
-
this.component.display = (
|
|
448
|
+
this.component.components = this.subForm.components.map((comp) => comp.component);
|
|
449
|
+
this.component.display = (_a = this.subForm._form) === null || _a === void 0 ? void 0 : _a.display;
|
|
441
450
|
this.subForm.on('change', () => {
|
|
442
451
|
var _a;
|
|
443
452
|
if (this.subForm && !this.shouldConditionallyClear()) {
|
|
@@ -562,10 +571,11 @@ class FormComponent extends Component_1.default {
|
|
|
562
571
|
* @returns {*|boolean} - TRUE if the subform should be submitted, FALSE if it should not.
|
|
563
572
|
*/
|
|
564
573
|
get shouldSubmit() {
|
|
574
|
+
const hiddenByJsonOnly = !this.hasCondition() && this.component.hidden;
|
|
565
575
|
return (this.subFormReady &&
|
|
566
576
|
(!this.component.hasOwnProperty('reference') || this.component.reference) &&
|
|
567
577
|
!this.shouldConditionallyClear() &&
|
|
568
|
-
!(
|
|
578
|
+
!(hiddenByJsonOnly && this.component.clearOnHide));
|
|
569
579
|
}
|
|
570
580
|
/**
|
|
571
581
|
* Returns the data for the subform.
|
|
@@ -776,7 +786,9 @@ class FormComponent extends Component_1.default {
|
|
|
776
786
|
}
|
|
777
787
|
this.updateSubFormVisibility();
|
|
778
788
|
this.clearOnHide();
|
|
779
|
-
|
|
789
|
+
if (!isNestedWizard) {
|
|
790
|
+
this.redraw();
|
|
791
|
+
}
|
|
780
792
|
}
|
|
781
793
|
if (!value && isNestedWizard) {
|
|
782
794
|
(_a = this.root) === null || _a === void 0 ? void 0 : _a.redraw();
|
|
@@ -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 || '';
|
|
@@ -1299,8 +1299,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
1299
1299
|
}
|
|
1300
1300
|
setMetadata(value, flags = {}) {
|
|
1301
1301
|
var _a, _b;
|
|
1302
|
-
if (lodash_1.default.isNil(value)
|
|
1303
|
-
(this.inDataTable && this.component.dataSrc === 'values')) {
|
|
1302
|
+
if (lodash_1.default.isNil(value)) {
|
|
1304
1303
|
return;
|
|
1305
1304
|
}
|
|
1306
1305
|
const valueIsObject = lodash_1.default.isObject(value);
|
|
@@ -1339,6 +1338,10 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
1339
1338
|
}
|
|
1340
1339
|
lodash_1.default.set(submission.metadata.selectData, this.path, templateData);
|
|
1341
1340
|
}
|
|
1341
|
+
else if (!this.templateData[templateValue] &&
|
|
1342
|
+
this.isEmpty(value)) {
|
|
1343
|
+
lodash_1.default.unset(this.root.submission, `metadata.selectData.${this.path}`);
|
|
1344
|
+
}
|
|
1342
1345
|
if (flags.resetValue && ((_b = this.root) === null || _b === void 0 ? void 0 : _b.submission) && !this.options.readOnly) {
|
|
1343
1346
|
const submission = this.root.submission;
|
|
1344
1347
|
if (!submission.metadata) {
|
|
@@ -1601,7 +1604,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
1601
1604
|
if (this.inDataTable) {
|
|
1602
1605
|
value = this.undoValueTyping(value);
|
|
1603
1606
|
}
|
|
1604
|
-
const templateValue = this.isEntireObjectDisplay() && !lodash_1.default.isObject(value.data) ? { data: value } : value;
|
|
1607
|
+
const templateValue = !lodash_1.default.isEmpty(value) && this.isEntireObjectDisplay() && !lodash_1.default.isObject(value.data) ? { data: value } : value;
|
|
1605
1608
|
const template = this.itemTemplate(templateValue, value, options);
|
|
1606
1609
|
return template;
|
|
1607
1610
|
}
|
|
@@ -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
|
{
|
|
@@ -25,7 +25,6 @@ declare const _default: ({
|
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
27
|
clearOnHide?: undefined;
|
|
28
|
-
customDefaultValue?: undefined;
|
|
29
28
|
rows?: undefined;
|
|
30
29
|
editor?: undefined;
|
|
31
30
|
as?: undefined;
|
|
@@ -40,7 +39,6 @@ declare const _default: ({
|
|
|
40
39
|
label: string;
|
|
41
40
|
clearOnHide: boolean;
|
|
42
41
|
onChange: (context: any) => void;
|
|
43
|
-
customDefaultValue: (value: any, component: any, row: any, data: any, instance: any) => any;
|
|
44
42
|
input: boolean;
|
|
45
43
|
rows: number;
|
|
46
44
|
editor: string;
|
|
@@ -79,7 +77,6 @@ declare const _default: ({
|
|
|
79
77
|
data?: undefined;
|
|
80
78
|
conditional?: undefined;
|
|
81
79
|
clearOnHide?: undefined;
|
|
82
|
-
customDefaultValue?: undefined;
|
|
83
80
|
rows?: undefined;
|
|
84
81
|
editor?: undefined;
|
|
85
82
|
as?: undefined;
|
|
@@ -107,7 +104,6 @@ declare const _default: ({
|
|
|
107
104
|
onChange?: undefined;
|
|
108
105
|
conditional?: undefined;
|
|
109
106
|
clearOnHide?: undefined;
|
|
110
|
-
customDefaultValue?: undefined;
|
|
111
107
|
rows?: undefined;
|
|
112
108
|
editor?: undefined;
|
|
113
109
|
as?: undefined;
|
|
@@ -133,7 +129,6 @@ declare const _default: ({
|
|
|
133
129
|
data?: undefined;
|
|
134
130
|
conditional?: undefined;
|
|
135
131
|
clearOnHide?: undefined;
|
|
136
|
-
customDefaultValue?: undefined;
|
|
137
132
|
rows?: undefined;
|
|
138
133
|
editor?: undefined;
|
|
139
134
|
as?: undefined;
|
|
@@ -154,7 +149,6 @@ declare const _default: ({
|
|
|
154
149
|
data?: undefined;
|
|
155
150
|
conditional?: undefined;
|
|
156
151
|
clearOnHide?: undefined;
|
|
157
|
-
customDefaultValue?: undefined;
|
|
158
152
|
rows?: undefined;
|
|
159
153
|
editor?: undefined;
|
|
160
154
|
as?: undefined;
|
|
@@ -177,7 +171,6 @@ declare const _default: ({
|
|
|
177
171
|
data?: undefined;
|
|
178
172
|
conditional?: undefined;
|
|
179
173
|
clearOnHide?: undefined;
|
|
180
|
-
customDefaultValue?: undefined;
|
|
181
174
|
rows?: undefined;
|
|
182
175
|
editor?: undefined;
|
|
183
176
|
as?: undefined;
|
|
@@ -208,7 +201,6 @@ declare const _default: ({
|
|
|
208
201
|
data?: undefined;
|
|
209
202
|
conditional?: undefined;
|
|
210
203
|
clearOnHide?: undefined;
|
|
211
|
-
customDefaultValue?: undefined;
|
|
212
204
|
rows?: undefined;
|
|
213
205
|
editor?: undefined;
|
|
214
206
|
as?: undefined;
|
|
@@ -228,7 +220,6 @@ declare const _default: ({
|
|
|
228
220
|
data?: undefined;
|
|
229
221
|
conditional?: undefined;
|
|
230
222
|
clearOnHide?: undefined;
|
|
231
|
-
customDefaultValue?: undefined;
|
|
232
223
|
rows?: undefined;
|
|
233
224
|
editor?: undefined;
|
|
234
225
|
as?: undefined;
|
|
@@ -251,7 +242,6 @@ declare const _default: ({
|
|
|
251
242
|
data?: undefined;
|
|
252
243
|
conditional?: undefined;
|
|
253
244
|
clearOnHide?: undefined;
|
|
254
|
-
customDefaultValue?: undefined;
|
|
255
245
|
rows?: undefined;
|
|
256
246
|
editor?: undefined;
|
|
257
247
|
as?: undefined;
|
|
@@ -20,19 +20,19 @@ exports.default = [
|
|
|
20
20
|
defaultValue: 'input',
|
|
21
21
|
calculateValue: (context) => {
|
|
22
22
|
var _a;
|
|
23
|
-
let currentType = context.
|
|
23
|
+
let currentType = context.instance._widgetType;
|
|
24
24
|
if (currentType) {
|
|
25
25
|
return currentType;
|
|
26
26
|
}
|
|
27
27
|
const widget = context.data.widget;
|
|
28
28
|
if (isObject(widget) && widget.type) {
|
|
29
|
-
context.
|
|
29
|
+
context.instance._widgetType = widget.type;
|
|
30
30
|
return widget.type;
|
|
31
31
|
}
|
|
32
32
|
if (typeof widget === 'string') {
|
|
33
33
|
const originalType = (_a = getOriginalWidget(context.instance)) === null || _a === void 0 ? void 0 : _a.type;
|
|
34
34
|
if (originalType) {
|
|
35
|
-
context.
|
|
35
|
+
context.instance._widgetType = originalType;
|
|
36
36
|
return originalType;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -40,11 +40,11 @@ exports.default = [
|
|
|
40
40
|
},
|
|
41
41
|
onChange: (context) => {
|
|
42
42
|
var _a;
|
|
43
|
-
const newType = context.
|
|
43
|
+
const newType = context.instance.dataValue;
|
|
44
44
|
const currentWidget = context.data.widget;
|
|
45
45
|
let oldType;
|
|
46
46
|
if (isObject(currentWidget)) {
|
|
47
|
-
oldType =
|
|
47
|
+
oldType = context.instance._widgetType;
|
|
48
48
|
}
|
|
49
49
|
else if (typeof currentWidget === 'string') {
|
|
50
50
|
oldType = (_a = getOriginalWidget(context.instance)) === null || _a === void 0 ? void 0 : _a.type;
|
|
@@ -55,10 +55,12 @@ exports.default = [
|
|
|
55
55
|
if (newType !== oldType) {
|
|
56
56
|
if (newType === 'input') {
|
|
57
57
|
context.data.widget = { type: 'input' };
|
|
58
|
+
context.instance._widgetType = newType;
|
|
58
59
|
}
|
|
59
|
-
else {
|
|
60
|
+
else if (newType) {
|
|
60
61
|
const defaultSettings = getDefaultWidgetSettings(newType);
|
|
61
62
|
context.data.widget = defaultSettings || { type: newType };
|
|
63
|
+
context.instance._widgetType = newType;
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
66
|
else if (!currentWidget) {
|
|
@@ -94,28 +96,12 @@ exports.default = [
|
|
|
94
96
|
return;
|
|
95
97
|
}
|
|
96
98
|
if (isObject(currentWidget)) {
|
|
97
|
-
const currentType = context.
|
|
99
|
+
const currentType = context.instance.root.getComponent('widget.type')._widgetType || currentWidget.type;
|
|
98
100
|
if (currentType && currentWidget.type !== currentType) {
|
|
99
101
|
context.data.widget = Object.assign(Object.assign({}, currentWidget), { type: currentType });
|
|
100
102
|
}
|
|
101
103
|
}
|
|
102
104
|
},
|
|
103
|
-
customDefaultValue: (value, component, row, data, instance) => {
|
|
104
|
-
if (!data.widget) {
|
|
105
|
-
const originalWidget = getOriginalWidget(instance);
|
|
106
|
-
const widgetType = data['widget.type'] || (originalWidget === null || originalWidget === void 0 ? void 0 : originalWidget.type);
|
|
107
|
-
if (widgetType && widgetType !== 'input') {
|
|
108
|
-
if ((originalWidget === null || originalWidget === void 0 ? void 0 : originalWidget.type) === widgetType && !lodash_1.default.isEmpty(lodash_1.default.omit(originalWidget, 'type'))) {
|
|
109
|
-
return lodash_1.default.omit(originalWidget, 'language');
|
|
110
|
-
}
|
|
111
|
-
const defaultSettings = getDefaultWidgetSettings(widgetType);
|
|
112
|
-
if (defaultSettings) {
|
|
113
|
-
return defaultSettings;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return value;
|
|
118
|
-
},
|
|
119
105
|
input: true,
|
|
120
106
|
rows: 5,
|
|
121
107
|
editor: 'ace',
|