@formio/js 5.0.0-rc.99 → 5.0.1-rc.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.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.js +10 -20
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -9
- package/dist/formio.full.js +11 -21
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -9
- package/dist/formio.js +4 -4
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +13 -13
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +5 -3
- package/lib/cjs/WebformBuilder.js +18 -6
- package/lib/cjs/Wizard.d.ts +0 -1
- package/lib/cjs/Wizard.js +16 -23
- package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +1 -1
- package/lib/cjs/components/form/Form.js +4 -3
- package/lib/cjs/components/html/HTML.js +1 -1
- package/lib/cjs/components/number/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/number/fixtures/index.js +2 -0
- package/lib/cjs/components/selectboxes/SelectBoxes.js +8 -1
- package/lib/mjs/WebformBuilder.js +18 -6
- package/lib/mjs/Wizard.d.ts +0 -1
- package/lib/mjs/Wizard.js +15 -22
- package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +1 -1
- package/lib/mjs/components/form/Form.js +4 -3
- package/lib/mjs/components/html/HTML.js +1 -1
- package/lib/mjs/components/number/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/number/fixtures/index.js +1 -0
- package/lib/mjs/components/selectboxes/SelectBoxes.js +8 -1
- package/package.json +3 -3
@@ -1,9 +1,9 @@
|
|
1
1
|
/*!
|
2
2
|
* dist/inputmask
|
3
3
|
* https://github.com/RobinHerbots/Inputmask
|
4
|
-
* Copyright (c) 2010 -
|
4
|
+
* Copyright (c) 2010 - 2024 Robin Herbots
|
5
5
|
* Licensed under the MIT license
|
6
|
-
* Version: 5.0.
|
6
|
+
* Version: 5.0.9
|
7
7
|
*/
|
8
8
|
|
9
9
|
/*!
|
@@ -20,7 +20,9 @@
|
|
20
20
|
|
21
21
|
/*! @license DOMPurify 3.1.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.6/LICENSE */
|
22
22
|
|
23
|
-
/*! formiojs v5.0.
|
23
|
+
/*! formiojs v5.0.1-rc.1 | https://unpkg.com/formiojs@5.0.1-rc.1/LICENSE.txt */
|
24
|
+
|
25
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
24
26
|
|
25
27
|
/**
|
26
28
|
* @license
|
@@ -913,13 +913,16 @@ class WebformBuilder extends Component_1.default {
|
|
913
913
|
keyboardActionsEnabled = keyboardActionsEnabled === 'true';
|
914
914
|
}
|
915
915
|
this.keyboardActionsEnabled = keyboardActionsEnabled;
|
916
|
-
const
|
917
|
-
|
918
|
-
};
|
919
|
-
const
|
920
|
-
|
916
|
+
const { display, noAddSubmitButton, noDefaultSubmitButton } = this.options;
|
917
|
+
const { _id, components } = form;
|
918
|
+
const isSubmitButton = ({ type, action }) => type === 'button' && (action === 'submit' || !action);
|
919
|
+
const hasSubmitButton = components.some(isSubmitButton);
|
920
|
+
// Add submit button if form display was switched from wizard
|
921
|
+
// Don't add if there is noAddSubmitButton flag passed, or the form has id, or the form has a submit button already
|
922
|
+
const shouldAddSubmitButton = (display === 'wizard' && !hasSubmitButton) ||
|
923
|
+
(!noAddSubmitButton && !_id && !hasSubmitButton);
|
921
924
|
// Ensure there is at least a submit button.
|
922
|
-
if (
|
925
|
+
if (!noDefaultSubmitButton && shouldAddSubmitButton) {
|
923
926
|
form.components.push({
|
924
927
|
type: 'button',
|
925
928
|
label: 'Submit',
|
@@ -1068,6 +1071,7 @@ class WebformBuilder extends Component_1.default {
|
|
1068
1071
|
'conditional',
|
1069
1072
|
'customConditional',
|
1070
1073
|
'id',
|
1074
|
+
'logic',
|
1071
1075
|
'fields.day.required',
|
1072
1076
|
'fields.month.required',
|
1073
1077
|
'fields.year.required',
|
@@ -1093,6 +1097,12 @@ class WebformBuilder extends Component_1.default {
|
|
1093
1097
|
parentComponent.tabs[tabIndex].splice(index, 1, newComp);
|
1094
1098
|
newComp.checkValidity = () => true;
|
1095
1099
|
newComp.build(defaultValueComponent.element);
|
1100
|
+
if (this.preview && !this.preview.defaultChanged) {
|
1101
|
+
const defaultValue = lodash_1.default.get(this.preview._data, this.editForm._data.key);
|
1102
|
+
if (lodash_1.default.isObject(defaultValue) && !lodash_1.default.isArray(defaultValue)) {
|
1103
|
+
this.editForm._data.defaultValue = defaultValue;
|
1104
|
+
}
|
1105
|
+
}
|
1096
1106
|
}
|
1097
1107
|
}
|
1098
1108
|
else {
|
@@ -1103,6 +1113,7 @@ class WebformBuilder extends Component_1.default {
|
|
1103
1113
|
path.unshift(component.key);
|
1104
1114
|
dataPath = (0, utils_1.getStringFromComponentPath)(path);
|
1105
1115
|
}
|
1116
|
+
this.preview.defaultChanged = true;
|
1106
1117
|
lodash_1.default.set(this.preview._data, dataPath, changed.value);
|
1107
1118
|
lodash_1.default.set(this.webform._data, dataPath, changed.value);
|
1108
1119
|
}
|
@@ -1187,6 +1198,7 @@ class WebformBuilder extends Component_1.default {
|
|
1187
1198
|
}
|
1188
1199
|
const rebuild = parentComponent.rebuild() || Promise.resolve();
|
1189
1200
|
return rebuild.then(() => {
|
1201
|
+
parentComponent.resetValue();
|
1190
1202
|
const schema = parentContainer ? parentContainer[index] : (comp ? comp.schema : []);
|
1191
1203
|
this.emitSaveComponentEvent(schema, originalComp, parentComponent.schema, path, index, isNew, originalComponentSchema);
|
1192
1204
|
this.emit('change', this.form);
|
package/lib/cjs/Wizard.d.ts
CHANGED
@@ -105,7 +105,6 @@ declare class Wizard extends Webform {
|
|
105
105
|
pageId(page: any): any;
|
106
106
|
onChange(flags: any, changed: any, modified: any, changes: any): void;
|
107
107
|
checkValidity(data: any, dirty: any, row: any, currentPageOnly: any, childErrors?: any[]): any;
|
108
|
-
showErrors(errors: any, triggerEvent: any): void | any[];
|
109
108
|
focusOnComponent(key: any): void | Promise<void>;
|
110
109
|
}
|
111
110
|
declare namespace Wizard {
|
package/lib/cjs/Wizard.js
CHANGED
@@ -602,7 +602,10 @@ class Wizard extends Webform_1.default {
|
|
602
602
|
}
|
603
603
|
this.redraw().then(() => {
|
604
604
|
this.checkData(this.submission.data);
|
605
|
-
this.validateCurrentPage();
|
605
|
+
const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
|
606
|
+
if (this.alert) {
|
607
|
+
this.showErrors(errors, true, true);
|
608
|
+
}
|
606
609
|
});
|
607
610
|
return Promise.resolve();
|
608
611
|
}
|
@@ -699,9 +702,11 @@ class Wizard extends Webform_1.default {
|
|
699
702
|
});
|
700
703
|
});
|
701
704
|
}
|
702
|
-
// Validate the form
|
703
|
-
const
|
704
|
-
|
705
|
+
// Validate the form before going to the next page
|
706
|
+
const currentPageErrors = this.validateCurrentPage({ dirty: true });
|
707
|
+
const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : currentPageErrors;
|
708
|
+
// allow going to the next page if the current page is valid, even if there are form level errors
|
709
|
+
if (currentPageErrors.length === 0) {
|
705
710
|
this.checkData(this.submission.data);
|
706
711
|
return this.beforePage(true).then(() => {
|
707
712
|
return this.setPage(this.getNextPage()).then(() => {
|
@@ -716,13 +721,14 @@ class Wizard extends Webform_1.default {
|
|
716
721
|
else {
|
717
722
|
this.currentPage.components.forEach((comp) => comp.setPristine(false));
|
718
723
|
this.scrollIntoView(this.element, true);
|
719
|
-
return Promise.reject(
|
724
|
+
return Promise.reject(this.showErrors(errors, true));
|
720
725
|
}
|
721
726
|
}
|
722
727
|
validateCurrentPage(flags = {}) {
|
723
|
-
var _a;
|
728
|
+
var _a, _b;
|
729
|
+
const components = (_a = this.currentPage) === null || _a === void 0 ? void 0 : _a.components.map((component) => component.component);
|
724
730
|
// Accessing the parent ensures the right instance (whether it's the parent Wizard or a nested Wizard) performs its validation
|
725
|
-
return (
|
731
|
+
return (_b = this.currentPage) === null || _b === void 0 ? void 0 : _b.parent.validateComponents(components, this.currentPage.parent.data, flags);
|
726
732
|
}
|
727
733
|
emitPrevPage() {
|
728
734
|
this.emit('prevPage', { page: this.page, submission: this.submission });
|
@@ -864,7 +870,8 @@ class Wizard extends Webform_1.default {
|
|
864
870
|
onChange(flags, changed, modified, changes) {
|
865
871
|
var _a, _b;
|
866
872
|
super.onChange(flags, changed, modified, changes);
|
867
|
-
|
873
|
+
// The onChange loop doesn't need all components for wizards
|
874
|
+
const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
|
868
875
|
if (this.alert) {
|
869
876
|
this.showErrors(errors, true, true);
|
870
877
|
}
|
@@ -919,21 +926,7 @@ class Wizard extends Webform_1.default {
|
|
919
926
|
return components.reduce((check, comp) => comp.checkValidity(data, dirty, row, currentPageOnly, childErrors) && check, true);
|
920
927
|
}
|
921
928
|
get errors() {
|
922
|
-
|
923
|
-
return this.currentPage.errors;
|
924
|
-
}
|
925
|
-
return super.errors;
|
926
|
-
}
|
927
|
-
showErrors(errors, triggerEvent) {
|
928
|
-
if (this.hasExtraPages) {
|
929
|
-
this.subWizards.forEach((subWizard) => {
|
930
|
-
if (Array.isArray(subWizard.errors)) {
|
931
|
-
errors = [...errors, ...subWizard.errors];
|
932
|
-
}
|
933
|
-
});
|
934
|
-
}
|
935
|
-
;
|
936
|
-
return super.showErrors(errors, triggerEvent);
|
929
|
+
return !this.isLastPage() && !this.submitted ? this.currentPage.errors : super.errors;
|
937
930
|
}
|
938
931
|
focusOnComponent(key) {
|
939
932
|
const component = this.getComponent(key);
|
@@ -27,7 +27,7 @@ exports.default = [
|
|
27
27
|
weight: 100,
|
28
28
|
type: 'checkbox',
|
29
29
|
label: 'Validate When Hidden',
|
30
|
-
tooltip: 'Validates the component when it is hidden/conditionally hidden. Vaildation errors are displayed in the error alert on the form submission.',
|
30
|
+
tooltip: 'Validates the component when it is hidden/conditionally hidden. Vaildation errors are displayed in the error alert on the form submission. Use caution when enabling this setting, as it can cause a hidden component to be invalid with no way for the form user to correct it.',
|
31
31
|
key: 'validateWhenHidden',
|
32
32
|
input: true
|
33
33
|
},
|
@@ -148,6 +148,9 @@ class FormComponent extends Component_1.default {
|
|
148
148
|
options.events = this.createEmitter();
|
149
149
|
// Make sure to not show the submit button in wizards in the nested forms.
|
150
150
|
lodash_1.default.set(options, 'buttonSettings.showSubmit', false);
|
151
|
+
// Set the parent options to the subform so those references are stable when the subform is created
|
152
|
+
options.parent = this;
|
153
|
+
options.parentVisible = this.visible;
|
151
154
|
if (!this.options) {
|
152
155
|
return options;
|
153
156
|
}
|
@@ -395,8 +398,6 @@ class FormComponent extends Component_1.default {
|
|
395
398
|
return (new Form_1.default(form, this.getSubOptions())).ready.then((instance) => {
|
396
399
|
this.subForm = instance;
|
397
400
|
this.subForm.currentForm = this;
|
398
|
-
this.subForm.parent = this;
|
399
|
-
this.subForm.parentVisible = this.visible;
|
400
401
|
this.subForm.on('change', () => {
|
401
402
|
if (this.subForm) {
|
402
403
|
this.dataValue = this.subForm.getValue();
|
@@ -476,7 +477,7 @@ class FormComponent extends Component_1.default {
|
|
476
477
|
checkComponentValidity(data, dirty, row, options, errors = []) {
|
477
478
|
options = options || {};
|
478
479
|
const silentCheck = options.silentCheck || false;
|
479
|
-
if (this.subForm
|
480
|
+
if (this.subForm) {
|
480
481
|
return this.subForm.checkValidity(this.subFormData, dirty, null, silentCheck, errors);
|
481
482
|
}
|
482
483
|
return super.checkComponentValidity(data, dirty, row, options, errors);
|
@@ -9,4 +9,5 @@ import comp8 from './comp8';
|
|
9
9
|
import comp9 from './comp9';
|
10
10
|
import comp10 from './comp10';
|
11
11
|
import comp11 from './comp11';
|
12
|
-
|
12
|
+
import scientificNotation from './scientificNotation';
|
13
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, scientificNotation };
|
@@ -26,3 +26,5 @@ const comp10_1 = __importDefault(require("./comp10"));
|
|
26
26
|
exports.comp10 = comp10_1.default;
|
27
27
|
const comp11_1 = __importDefault(require("./comp11"));
|
28
28
|
exports.comp11 = comp11_1.default;
|
29
|
+
const scientificNotation_1 = __importDefault(require("./scientificNotation"));
|
30
|
+
exports.scientificNotation = scientificNotation_1.default;
|
@@ -139,6 +139,14 @@ class SelectBoxesComponent extends Radio_1.default {
|
|
139
139
|
checkedValues.forEach((value) => selectData.push(this.templateData[value]));
|
140
140
|
lodash_1.default.set(submission.metadata.selectData, this.path, selectData);
|
141
141
|
}
|
142
|
+
// Ensure that for dataSrc == 'values' that there are not any other superfluous values.
|
143
|
+
if (this.component.dataSrc === 'values') {
|
144
|
+
for (const key in value) {
|
145
|
+
if (!this.component.values.find((val) => val.value === key)) {
|
146
|
+
delete value[key];
|
147
|
+
}
|
148
|
+
}
|
149
|
+
}
|
142
150
|
return value;
|
143
151
|
}
|
144
152
|
/**
|
@@ -267,7 +275,6 @@ class SelectBoxesComponent extends Radio_1.default {
|
|
267
275
|
else {
|
268
276
|
return super.setCustomValidity(messages, dirty, external);
|
269
277
|
}
|
270
|
-
;
|
271
278
|
}
|
272
279
|
validateValueAvailability(setting, value) {
|
273
280
|
if (!(0, utils_1.boolValue)(setting) || !value) {
|
@@ -897,13 +897,16 @@ export default class WebformBuilder extends Component {
|
|
897
897
|
keyboardActionsEnabled = keyboardActionsEnabled === 'true';
|
898
898
|
}
|
899
899
|
this.keyboardActionsEnabled = keyboardActionsEnabled;
|
900
|
-
const
|
901
|
-
|
902
|
-
};
|
903
|
-
const
|
904
|
-
|
900
|
+
const { display, noAddSubmitButton, noDefaultSubmitButton } = this.options;
|
901
|
+
const { _id, components } = form;
|
902
|
+
const isSubmitButton = ({ type, action }) => type === 'button' && (action === 'submit' || !action);
|
903
|
+
const hasSubmitButton = components.some(isSubmitButton);
|
904
|
+
// Add submit button if form display was switched from wizard
|
905
|
+
// Don't add if there is noAddSubmitButton flag passed, or the form has id, or the form has a submit button already
|
906
|
+
const shouldAddSubmitButton = (display === 'wizard' && !hasSubmitButton) ||
|
907
|
+
(!noAddSubmitButton && !_id && !hasSubmitButton);
|
905
908
|
// Ensure there is at least a submit button.
|
906
|
-
if (
|
909
|
+
if (!noDefaultSubmitButton && shouldAddSubmitButton) {
|
907
910
|
form.components.push({
|
908
911
|
type: 'button',
|
909
912
|
label: 'Submit',
|
@@ -1052,6 +1055,7 @@ export default class WebformBuilder extends Component {
|
|
1052
1055
|
'conditional',
|
1053
1056
|
'customConditional',
|
1054
1057
|
'id',
|
1058
|
+
'logic',
|
1055
1059
|
'fields.day.required',
|
1056
1060
|
'fields.month.required',
|
1057
1061
|
'fields.year.required',
|
@@ -1077,6 +1081,12 @@ export default class WebformBuilder extends Component {
|
|
1077
1081
|
parentComponent.tabs[tabIndex].splice(index, 1, newComp);
|
1078
1082
|
newComp.checkValidity = () => true;
|
1079
1083
|
newComp.build(defaultValueComponent.element);
|
1084
|
+
if (this.preview && !this.preview.defaultChanged) {
|
1085
|
+
const defaultValue = _.get(this.preview._data, this.editForm._data.key);
|
1086
|
+
if (_.isObject(defaultValue) && !_.isArray(defaultValue)) {
|
1087
|
+
this.editForm._data.defaultValue = defaultValue;
|
1088
|
+
}
|
1089
|
+
}
|
1080
1090
|
}
|
1081
1091
|
}
|
1082
1092
|
else {
|
@@ -1087,6 +1097,7 @@ export default class WebformBuilder extends Component {
|
|
1087
1097
|
path.unshift(component.key);
|
1088
1098
|
dataPath = getStringFromComponentPath(path);
|
1089
1099
|
}
|
1100
|
+
this.preview.defaultChanged = true;
|
1090
1101
|
_.set(this.preview._data, dataPath, changed.value);
|
1091
1102
|
_.set(this.webform._data, dataPath, changed.value);
|
1092
1103
|
}
|
@@ -1171,6 +1182,7 @@ export default class WebformBuilder extends Component {
|
|
1171
1182
|
}
|
1172
1183
|
const rebuild = parentComponent.rebuild() || Promise.resolve();
|
1173
1184
|
return rebuild.then(() => {
|
1185
|
+
parentComponent.resetValue();
|
1174
1186
|
const schema = parentContainer ? parentContainer[index] : (comp ? comp.schema : []);
|
1175
1187
|
this.emitSaveComponentEvent(schema, originalComp, parentComponent.schema, path, index, isNew, originalComponentSchema);
|
1176
1188
|
this.emit('change', this.form);
|
package/lib/mjs/Wizard.d.ts
CHANGED
@@ -105,7 +105,6 @@ declare class Wizard extends Webform {
|
|
105
105
|
pageId(page: any): any;
|
106
106
|
onChange(flags: any, changed: any, modified: any, changes: any): void;
|
107
107
|
checkValidity(data: any, dirty: any, row: any, currentPageOnly: any, childErrors?: any[]): any;
|
108
|
-
showErrors(errors: any, triggerEvent: any): void | any[];
|
109
108
|
focusOnComponent(key: any): void | Promise<void>;
|
110
109
|
}
|
111
110
|
declare namespace Wizard {
|
package/lib/mjs/Wizard.js
CHANGED
@@ -594,7 +594,10 @@ export default class Wizard extends Webform {
|
|
594
594
|
}
|
595
595
|
this.redraw().then(() => {
|
596
596
|
this.checkData(this.submission.data);
|
597
|
-
this.validateCurrentPage();
|
597
|
+
const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
|
598
|
+
if (this.alert) {
|
599
|
+
this.showErrors(errors, true, true);
|
600
|
+
}
|
598
601
|
});
|
599
602
|
return Promise.resolve();
|
600
603
|
}
|
@@ -689,9 +692,11 @@ export default class Wizard extends Webform {
|
|
689
692
|
});
|
690
693
|
});
|
691
694
|
}
|
692
|
-
// Validate the form
|
693
|
-
const
|
694
|
-
|
695
|
+
// Validate the form before going to the next page
|
696
|
+
const currentPageErrors = this.validateCurrentPage({ dirty: true });
|
697
|
+
const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : currentPageErrors;
|
698
|
+
// allow going to the next page if the current page is valid, even if there are form level errors
|
699
|
+
if (currentPageErrors.length === 0) {
|
695
700
|
this.checkData(this.submission.data);
|
696
701
|
return this.beforePage(true).then(() => {
|
697
702
|
return this.setPage(this.getNextPage()).then(() => {
|
@@ -706,12 +711,13 @@ export default class Wizard extends Webform {
|
|
706
711
|
else {
|
707
712
|
this.currentPage.components.forEach((comp) => comp.setPristine(false));
|
708
713
|
this.scrollIntoView(this.element, true);
|
709
|
-
return Promise.reject(
|
714
|
+
return Promise.reject(this.showErrors(errors, true));
|
710
715
|
}
|
711
716
|
}
|
712
717
|
validateCurrentPage(flags = {}) {
|
718
|
+
const components = this.currentPage?.components.map((component) => component.component);
|
713
719
|
// Accessing the parent ensures the right instance (whether it's the parent Wizard or a nested Wizard) performs its validation
|
714
|
-
return this.currentPage?.parent.validateComponents(
|
720
|
+
return this.currentPage?.parent.validateComponents(components, this.currentPage.parent.data, flags);
|
715
721
|
}
|
716
722
|
emitPrevPage() {
|
717
723
|
this.emit('prevPage', { page: this.page, submission: this.submission });
|
@@ -852,7 +858,8 @@ export default class Wizard extends Webform {
|
|
852
858
|
}
|
853
859
|
onChange(flags, changed, modified, changes) {
|
854
860
|
super.onChange(flags, changed, modified, changes);
|
855
|
-
|
861
|
+
// The onChange loop doesn't need all components for wizards
|
862
|
+
const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
|
856
863
|
if (this.alert) {
|
857
864
|
this.showErrors(errors, true, true);
|
858
865
|
}
|
@@ -906,21 +913,7 @@ export default class Wizard extends Webform {
|
|
906
913
|
return components.reduce((check, comp) => comp.checkValidity(data, dirty, row, currentPageOnly, childErrors) && check, true);
|
907
914
|
}
|
908
915
|
get errors() {
|
909
|
-
|
910
|
-
return this.currentPage.errors;
|
911
|
-
}
|
912
|
-
return super.errors;
|
913
|
-
}
|
914
|
-
showErrors(errors, triggerEvent) {
|
915
|
-
if (this.hasExtraPages) {
|
916
|
-
this.subWizards.forEach((subWizard) => {
|
917
|
-
if (Array.isArray(subWizard.errors)) {
|
918
|
-
errors = [...errors, ...subWizard.errors];
|
919
|
-
}
|
920
|
-
});
|
921
|
-
}
|
922
|
-
;
|
923
|
-
return super.showErrors(errors, triggerEvent);
|
916
|
+
return !this.isLastPage() && !this.submitted ? this.currentPage.errors : super.errors;
|
924
917
|
}
|
925
918
|
focusOnComponent(key) {
|
926
919
|
const component = this.getComponent(key);
|
@@ -22,7 +22,7 @@ export default [
|
|
22
22
|
weight: 100,
|
23
23
|
type: 'checkbox',
|
24
24
|
label: 'Validate When Hidden',
|
25
|
-
tooltip: 'Validates the component when it is hidden/conditionally hidden. Vaildation errors are displayed in the error alert on the form submission.',
|
25
|
+
tooltip: 'Validates the component when it is hidden/conditionally hidden. Vaildation errors are displayed in the error alert on the form submission. Use caution when enabling this setting, as it can cause a hidden component to be invalid with no way for the form user to correct it.',
|
26
26
|
key: 'validateWhenHidden',
|
27
27
|
input: true
|
28
28
|
},
|
@@ -142,6 +142,9 @@ export default class FormComponent extends Component {
|
|
142
142
|
options.events = this.createEmitter();
|
143
143
|
// Make sure to not show the submit button in wizards in the nested forms.
|
144
144
|
_.set(options, 'buttonSettings.showSubmit', false);
|
145
|
+
// Set the parent options to the subform so those references are stable when the subform is created
|
146
|
+
options.parent = this;
|
147
|
+
options.parentVisible = this.visible;
|
145
148
|
if (!this.options) {
|
146
149
|
return options;
|
147
150
|
}
|
@@ -391,8 +394,6 @@ export default class FormComponent extends Component {
|
|
391
394
|
return (new Form(form, this.getSubOptions())).ready.then((instance) => {
|
392
395
|
this.subForm = instance;
|
393
396
|
this.subForm.currentForm = this;
|
394
|
-
this.subForm.parent = this;
|
395
|
-
this.subForm.parentVisible = this.visible;
|
396
397
|
this.subForm.on('change', () => {
|
397
398
|
if (this.subForm) {
|
398
399
|
this.dataValue = this.subForm.getValue();
|
@@ -470,7 +471,7 @@ export default class FormComponent extends Component {
|
|
470
471
|
checkComponentValidity(data, dirty, row, options, errors = []) {
|
471
472
|
options = options || {};
|
472
473
|
const silentCheck = options.silentCheck || false;
|
473
|
-
if (this.subForm
|
474
|
+
if (this.subForm) {
|
474
475
|
return this.subForm.checkValidity(this.subFormData, dirty, null, silentCheck, errors);
|
475
476
|
}
|
476
477
|
return super.checkComponentValidity(data, dirty, row, options, errors);
|
@@ -9,4 +9,5 @@ import comp8 from './comp8';
|
|
9
9
|
import comp9 from './comp9';
|
10
10
|
import comp10 from './comp10';
|
11
11
|
import comp11 from './comp11';
|
12
|
-
|
12
|
+
import scientificNotation from './scientificNotation';
|
13
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, scientificNotation };
|
@@ -9,4 +9,5 @@ import comp8 from './comp8';
|
|
9
9
|
import comp9 from './comp9';
|
10
10
|
import comp10 from './comp10';
|
11
11
|
import comp11 from './comp11';
|
12
|
+
import scientificNotation from './scientificNotation';
|
12
13
|
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, scientificNotation };
|
@@ -141,6 +141,14 @@ export default class SelectBoxesComponent extends RadioComponent {
|
|
141
141
|
checkedValues.forEach((value) => selectData.push(this.templateData[value]));
|
142
142
|
_.set(submission.metadata.selectData, this.path, selectData);
|
143
143
|
}
|
144
|
+
// Ensure that for dataSrc == 'values' that there are not any other superfluous values.
|
145
|
+
if (this.component.dataSrc === 'values') {
|
146
|
+
for (const key in value) {
|
147
|
+
if (!this.component.values.find((val) => val.value === key)) {
|
148
|
+
delete value[key];
|
149
|
+
}
|
150
|
+
}
|
151
|
+
}
|
144
152
|
return value;
|
145
153
|
}
|
146
154
|
/**
|
@@ -268,7 +276,6 @@ export default class SelectBoxesComponent extends RadioComponent {
|
|
268
276
|
else {
|
269
277
|
return super.setCustomValidity(messages, dirty, external);
|
270
278
|
}
|
271
|
-
;
|
272
279
|
}
|
273
280
|
validateValueAvailability(setting, value) {
|
274
281
|
if (!boolValue(setting) || !value) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@formio/js",
|
3
|
-
"version": "5.0.
|
3
|
+
"version": "5.0.1-rc.1",
|
4
4
|
"description": "JavaScript powered Forms with JSON Form Builder",
|
5
5
|
"main": "lib/cjs/index.js",
|
6
6
|
"exports": {
|
@@ -79,9 +79,9 @@
|
|
79
79
|
},
|
80
80
|
"homepage": "https://github.com/formio/formio.js#readme",
|
81
81
|
"dependencies": {
|
82
|
-
"@formio/bootstrap": "3.0.0
|
82
|
+
"@formio/bootstrap": "3.0.0",
|
83
83
|
"@formio/choices.js": "^10.2.1",
|
84
|
-
"@formio/core": "2.3.0
|
84
|
+
"@formio/core": "2.3.0",
|
85
85
|
"@formio/text-mask-addons": "^3.8.0-formio.3",
|
86
86
|
"@formio/vanilla-text-mask": "^5.1.1-formio.1",
|
87
87
|
"abortcontroller-polyfill": "^1.7.5",
|