@formio/js 5.0.0-dev.5911.81fbc1f → 5.0.0-dev.5913.108f53e
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/Changelog.md +2 -0
- package/dist/formio.form.js +48 -26
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +2 -0
- package/dist/formio.full.js +49 -27
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +2 -0
- package/dist/formio.js +207 -4
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +2 -0
- package/dist/formio.utils.js +42 -20
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -0
- package/lib/cjs/WebformBuilder.js +17 -4
- package/lib/cjs/Wizard.d.ts +1 -2
- package/lib/cjs/Wizard.js +17 -24
- package/lib/cjs/components/_classes/component/Component.js +9 -8
- package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +1 -1
- package/lib/cjs/components/_classes/nested/NestedComponent.js +1 -1
- package/lib/cjs/components/signature/Signature.js +3 -1
- package/lib/cjs/utils/i18n.js +5 -0
- package/lib/mjs/WebformBuilder.js +17 -4
- package/lib/mjs/Wizard.d.ts +1 -2
- package/lib/mjs/Wizard.js +16 -23
- package/lib/mjs/components/_classes/component/Component.js +9 -8
- package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +1 -1
- package/lib/mjs/components/_classes/nested/NestedComponent.js +1 -1
- package/lib/mjs/components/signature/Signature.js +3 -1
- package/lib/mjs/utils/i18n.js +4 -0
- package/package.json +2 -2
|
@@ -20,6 +20,8 @@
|
|
|
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
|
+
/*! @license DOMPurify 3.2.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.0/LICENSE */
|
|
24
|
+
|
|
23
25
|
/*! formiojs v5.0.0-rc.59 | https://unpkg.com/formiojs@5.0.0-rc.59/LICENSE.txt */
|
|
24
26
|
|
|
25
27
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
@@ -808,18 +808,31 @@ class WebformBuilder extends Component_1.default {
|
|
|
808
808
|
// Show an error if siblings are disabled for a component and such a component already exists.
|
|
809
809
|
const compKey = (group === 'resource') ? `component-${key}` : key;
|
|
810
810
|
const draggableComponent = ((_a = this.groups[group]) === null || _a === void 0 ? void 0 : _a.components[compKey]) || {};
|
|
811
|
-
if (draggableComponent.disableSiblings
|
|
811
|
+
if (draggableComponent.disableSiblings) {
|
|
812
812
|
let isCompAlreadyExists = false;
|
|
813
813
|
(0, formUtils_1.eachComponent)(this.webform.components, (component) => {
|
|
814
|
-
if (
|
|
815
|
-
(draggableComponent.uniqueComponent && component.component.key === draggableComponent.schema.key)) {
|
|
814
|
+
if (component.type === draggableComponent.schema.type) {
|
|
816
815
|
isCompAlreadyExists = true;
|
|
817
816
|
return;
|
|
818
817
|
}
|
|
819
818
|
}, true);
|
|
820
819
|
if (isCompAlreadyExists) {
|
|
821
820
|
this.webform.redraw();
|
|
822
|
-
this.webform.setAlert('danger', `You cannot add more than one ${
|
|
821
|
+
this.webform.setAlert('danger', `You cannot add more than one ${draggableComponent.key} component to one page.`);
|
|
822
|
+
return;
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
if (draggableComponent.uniqueComponent) {
|
|
826
|
+
let isCompAlreadyExists = false;
|
|
827
|
+
(0, formUtils_1.eachComponent)(this.webform.components, (component) => {
|
|
828
|
+
if (component.key === draggableComponent.schema.key) {
|
|
829
|
+
isCompAlreadyExists = true;
|
|
830
|
+
return;
|
|
831
|
+
}
|
|
832
|
+
}, true);
|
|
833
|
+
if (isCompAlreadyExists) {
|
|
834
|
+
this.webform.redraw();
|
|
835
|
+
this.webform.setAlert('danger', `You cannot add more than one ${draggableComponent.title} component to one page.`);
|
|
823
836
|
return;
|
|
824
837
|
}
|
|
825
838
|
}
|
package/lib/cjs/Wizard.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ declare class Wizard extends Webform {
|
|
|
6
6
|
originalComponents: any[];
|
|
7
7
|
page: number;
|
|
8
8
|
currentPanel: any;
|
|
9
|
-
currentPanels: any[] | null;
|
|
10
9
|
currentNextPage: number;
|
|
11
10
|
_seenPages: number[];
|
|
12
11
|
subWizards: any[];
|
|
@@ -17,7 +16,7 @@ declare class Wizard extends Webform {
|
|
|
17
16
|
originalOptions: any;
|
|
18
17
|
isLastPage(): any;
|
|
19
18
|
getPages(args?: {}): any[];
|
|
20
|
-
get
|
|
19
|
+
get hasSubWizards(): boolean;
|
|
21
20
|
get localData(): any;
|
|
22
21
|
get wizardKey(): string;
|
|
23
22
|
set wizard(form: object);
|
package/lib/cjs/Wizard.js
CHANGED
|
@@ -34,7 +34,6 @@ class Wizard extends Webform_1.default {
|
|
|
34
34
|
this.originalComponents = [];
|
|
35
35
|
this.page = 0;
|
|
36
36
|
this.currentPanel = null;
|
|
37
|
-
this.currentPanels = null;
|
|
38
37
|
this.currentNextPage = 0;
|
|
39
38
|
this._seenPages = [0];
|
|
40
39
|
this.subWizards = [];
|
|
@@ -53,12 +52,12 @@ class Wizard extends Webform_1.default {
|
|
|
53
52
|
}
|
|
54
53
|
getPages(args = {}) {
|
|
55
54
|
const { all = false } = args;
|
|
56
|
-
const pages = this.
|
|
55
|
+
const pages = this.hasSubWizards ? this.components : this.pages;
|
|
57
56
|
const filteredPages = pages
|
|
58
57
|
.filter(all ? lodash_1.default.identity : (p, index) => this._seenPages.includes(index));
|
|
59
58
|
return filteredPages;
|
|
60
59
|
}
|
|
61
|
-
get
|
|
60
|
+
get hasSubWizards() {
|
|
62
61
|
return !lodash_1.default.isEmpty(this.subWizards);
|
|
63
62
|
}
|
|
64
63
|
get data() {
|
|
@@ -187,9 +186,9 @@ class Wizard extends Webform_1.default {
|
|
|
187
186
|
}
|
|
188
187
|
render() {
|
|
189
188
|
const ctx = this.renderContext;
|
|
190
|
-
if (this.component.
|
|
189
|
+
if (this.component.id) {
|
|
191
190
|
ctx.panels.map(panel => {
|
|
192
|
-
if (panel.
|
|
191
|
+
if (panel.id === this.component.id) {
|
|
193
192
|
this.currentPanel = panel;
|
|
194
193
|
ctx.wizardPageTooltip = this.getFormattedTooltip(panel.tooltip);
|
|
195
194
|
}
|
|
@@ -587,7 +586,7 @@ class Wizard extends Webform_1.default {
|
|
|
587
586
|
this.pageFieldLogic(num);
|
|
588
587
|
this.getNextPage();
|
|
589
588
|
let parentNum = num;
|
|
590
|
-
if (this.
|
|
589
|
+
if (this.hasSubWizards) {
|
|
591
590
|
const pageFromPages = this.pages[num];
|
|
592
591
|
const pageFromComponents = this.components[num];
|
|
593
592
|
if (!pageFromComponents || (pageFromPages === null || pageFromPages === void 0 ? void 0 : pageFromPages.id) !== pageFromComponents.id) {
|
|
@@ -862,30 +861,25 @@ class Wizard extends Webform_1.default {
|
|
|
862
861
|
}
|
|
863
862
|
}
|
|
864
863
|
onChange(flags, changed, modified, changes) {
|
|
865
|
-
var _a
|
|
864
|
+
var _a;
|
|
866
865
|
super.onChange(flags, changed, modified, changes);
|
|
867
866
|
const errors = this.validate(this.localData, { dirty: false });
|
|
868
867
|
if (this.alert) {
|
|
869
868
|
this.showErrors(errors, true, true);
|
|
870
869
|
}
|
|
871
870
|
// If the pages change, need to redraw the header.
|
|
872
|
-
|
|
873
|
-
|
|
871
|
+
const currentPanels = this.pages;
|
|
872
|
+
// calling this.establishPages() updates/mutates this.pages to be the current pages
|
|
873
|
+
this.establishPages();
|
|
874
|
+
const newPanels = this.pages;
|
|
874
875
|
const currentNextPage = this.currentNextPage;
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
this.
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
else {
|
|
881
|
-
currentPanels = this.currentPanels || this.pages.map(page => page.component.key);
|
|
882
|
-
panels = this.establishPages().map(panel => panel.key);
|
|
883
|
-
this.currentPanels = panels;
|
|
884
|
-
if (((_a = this.currentPanel) === null || _a === void 0 ? void 0 : _a.key) && ((_b = this.currentPanels) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
885
|
-
this.setPage(this.currentPanels.findIndex(panel => panel === this.currentPanel.key));
|
|
886
|
-
}
|
|
876
|
+
const panelsUpdated = !lodash_1.default.isEqual(newPanels, currentPanels);
|
|
877
|
+
if (((_a = this.currentPanel) === null || _a === void 0 ? void 0 : _a.id) && this.pages.length && (!this.hasSubWizards || (this.hasSubWizards && panelsUpdated))) {
|
|
878
|
+
const newIndex = this.pages.findIndex(page => page.id === this.currentPanel.id);
|
|
879
|
+
if (newIndex !== -1)
|
|
880
|
+
this.setPage(newIndex);
|
|
887
881
|
}
|
|
888
|
-
if (
|
|
882
|
+
if (panelsUpdated || (flags && flags.fromSubmission)) {
|
|
889
883
|
this.redrawHeader();
|
|
890
884
|
}
|
|
891
885
|
// If the next page changes, then make sure to redraw navigation.
|
|
@@ -925,14 +919,13 @@ class Wizard extends Webform_1.default {
|
|
|
925
919
|
return super.errors;
|
|
926
920
|
}
|
|
927
921
|
showErrors(errors, triggerEvent) {
|
|
928
|
-
if (this.
|
|
922
|
+
if (this.hasSubWizards) {
|
|
929
923
|
this.subWizards.forEach((subWizard) => {
|
|
930
924
|
if (Array.isArray(subWizard.errors)) {
|
|
931
925
|
errors = [...errors, ...subWizard.errors];
|
|
932
926
|
}
|
|
933
927
|
});
|
|
934
928
|
}
|
|
935
|
-
;
|
|
936
929
|
return super.showErrors(errors, triggerEvent);
|
|
937
930
|
}
|
|
938
931
|
focusOnComponent(key) {
|
|
@@ -2516,7 +2516,7 @@ class Component extends Element_1.default {
|
|
|
2516
2516
|
}
|
|
2517
2517
|
return value;
|
|
2518
2518
|
};
|
|
2519
|
-
if (this.defaultMask) {
|
|
2519
|
+
if (Array.isArray(this.defaultMask) ? this.defaultMask.length > 0 : this.defaultMask) {
|
|
2520
2520
|
if (Array.isArray(defaultValue)) {
|
|
2521
2521
|
defaultValue = defaultValue.map(checkMask);
|
|
2522
2522
|
}
|
|
@@ -3252,12 +3252,6 @@ class Component extends Element_1.default {
|
|
|
3252
3252
|
return (this.component.protected || !this.component.persistent || (this.component.persistent === 'client-only'));
|
|
3253
3253
|
}
|
|
3254
3254
|
shouldSkipValidation(data, row, flags = {}) {
|
|
3255
|
-
const { validateWhenHidden = false } = this.component || {};
|
|
3256
|
-
const forceValidOnHidden = (!this.visible || !this.checkCondition(row, data)) && !validateWhenHidden;
|
|
3257
|
-
if (forceValidOnHidden) {
|
|
3258
|
-
// If this component is forced valid when it is hidden, then we also need to reset the errors for this component.
|
|
3259
|
-
this._errors = [];
|
|
3260
|
-
}
|
|
3261
3255
|
const rules = [
|
|
3262
3256
|
// Do not validate if the flags say not too.
|
|
3263
3257
|
() => flags.noValidate,
|
|
@@ -3268,7 +3262,14 @@ class Component extends Element_1.default {
|
|
|
3268
3262
|
// Check to see if we are editing and if so, check component persistence.
|
|
3269
3263
|
() => this.isValueHidden(),
|
|
3270
3264
|
// Force valid if component is hidden.
|
|
3271
|
-
() =>
|
|
3265
|
+
() => {
|
|
3266
|
+
if (!this.component.validateWhenHidden && (!this.visible || !this.checkCondition(row, data))) {
|
|
3267
|
+
// If this component is forced valid when it is hidden, then we also need to reset the errors for this component.
|
|
3268
|
+
this._errors = [];
|
|
3269
|
+
return true;
|
|
3270
|
+
}
|
|
3271
|
+
return false;
|
|
3272
|
+
}
|
|
3272
3273
|
];
|
|
3273
3274
|
return rules.some(pred => pred());
|
|
3274
3275
|
}
|
|
@@ -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
|
},
|
|
@@ -685,7 +685,7 @@ class NestedComponent extends Field_1.default {
|
|
|
685
685
|
validationProcessor({ scope, data, row, instance, component }, flags) {
|
|
686
686
|
var _a;
|
|
687
687
|
const { dirty } = flags;
|
|
688
|
-
if (this.root.
|
|
688
|
+
if (this.root.hasSubWizards && this.page !== this.root.page) {
|
|
689
689
|
instance = ((_a = this.childComponentsMap) === null || _a === void 0 ? void 0 : _a.hasOwnProperty(component.path))
|
|
690
690
|
? this.childComponentsMap[component.path]
|
|
691
691
|
: this.getComponent(component.path);
|
package/lib/cjs/utils/i18n.js
CHANGED
|
@@ -79,7 +79,12 @@ class I18n {
|
|
|
79
79
|
this.languages[language] = strings;
|
|
80
80
|
}
|
|
81
81
|
t(text, ...args) {
|
|
82
|
+
var _a;
|
|
82
83
|
if (this.currentLanguage[text]) {
|
|
84
|
+
const customTranslationFieldName = (_a = args[0]) === null || _a === void 0 ? void 0 : _a.field;
|
|
85
|
+
if (customTranslationFieldName && this.currentLanguage[customTranslationFieldName]) {
|
|
86
|
+
args[0].field = this.currentLanguage[customTranslationFieldName];
|
|
87
|
+
}
|
|
83
88
|
return utils_1.Evaluator.interpolateString(this.currentLanguage[text], ...args);
|
|
84
89
|
}
|
|
85
90
|
return utils_1.Evaluator.interpolateString(text, ...args);
|
|
@@ -793,18 +793,31 @@ export default class WebformBuilder extends Component {
|
|
|
793
793
|
// Show an error if siblings are disabled for a component and such a component already exists.
|
|
794
794
|
const compKey = (group === 'resource') ? `component-${key}` : key;
|
|
795
795
|
const draggableComponent = this.groups[group]?.components[compKey] || {};
|
|
796
|
-
if (draggableComponent.disableSiblings
|
|
796
|
+
if (draggableComponent.disableSiblings) {
|
|
797
797
|
let isCompAlreadyExists = false;
|
|
798
798
|
eachComponent(this.webform.components, (component) => {
|
|
799
|
-
if (
|
|
800
|
-
(draggableComponent.uniqueComponent && component.component.key === draggableComponent.schema.key)) {
|
|
799
|
+
if (component.type === draggableComponent.schema.type) {
|
|
801
800
|
isCompAlreadyExists = true;
|
|
802
801
|
return;
|
|
803
802
|
}
|
|
804
803
|
}, true);
|
|
805
804
|
if (isCompAlreadyExists) {
|
|
806
805
|
this.webform.redraw();
|
|
807
|
-
this.webform.setAlert('danger', `You cannot add more than one ${
|
|
806
|
+
this.webform.setAlert('danger', `You cannot add more than one ${draggableComponent.key} component to one page.`);
|
|
807
|
+
return;
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
if (draggableComponent.uniqueComponent) {
|
|
811
|
+
let isCompAlreadyExists = false;
|
|
812
|
+
eachComponent(this.webform.components, (component) => {
|
|
813
|
+
if (component.key === draggableComponent.schema.key) {
|
|
814
|
+
isCompAlreadyExists = true;
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
}, true);
|
|
818
|
+
if (isCompAlreadyExists) {
|
|
819
|
+
this.webform.redraw();
|
|
820
|
+
this.webform.setAlert('danger', `You cannot add more than one ${draggableComponent.title} component to one page.`);
|
|
808
821
|
return;
|
|
809
822
|
}
|
|
810
823
|
}
|
package/lib/mjs/Wizard.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ declare class Wizard extends Webform {
|
|
|
6
6
|
originalComponents: any[];
|
|
7
7
|
page: number;
|
|
8
8
|
currentPanel: any;
|
|
9
|
-
currentPanels: any[] | null;
|
|
10
9
|
currentNextPage: number;
|
|
11
10
|
_seenPages: number[];
|
|
12
11
|
subWizards: any[];
|
|
@@ -17,7 +16,7 @@ declare class Wizard extends Webform {
|
|
|
17
16
|
originalOptions: any;
|
|
18
17
|
isLastPage(): any;
|
|
19
18
|
getPages(args?: {}): any[];
|
|
20
|
-
get
|
|
19
|
+
get hasSubWizards(): boolean;
|
|
21
20
|
get localData(): any;
|
|
22
21
|
get wizardKey(): string;
|
|
23
22
|
set wizard(form: object);
|
package/lib/mjs/Wizard.js
CHANGED
|
@@ -29,7 +29,6 @@ export default class Wizard extends Webform {
|
|
|
29
29
|
this.originalComponents = [];
|
|
30
30
|
this.page = 0;
|
|
31
31
|
this.currentPanel = null;
|
|
32
|
-
this.currentPanels = null;
|
|
33
32
|
this.currentNextPage = 0;
|
|
34
33
|
this._seenPages = [0];
|
|
35
34
|
this.subWizards = [];
|
|
@@ -48,12 +47,12 @@ export default class Wizard extends Webform {
|
|
|
48
47
|
}
|
|
49
48
|
getPages(args = {}) {
|
|
50
49
|
const { all = false } = args;
|
|
51
|
-
const pages = this.
|
|
50
|
+
const pages = this.hasSubWizards ? this.components : this.pages;
|
|
52
51
|
const filteredPages = pages
|
|
53
52
|
.filter(all ? _.identity : (p, index) => this._seenPages.includes(index));
|
|
54
53
|
return filteredPages;
|
|
55
54
|
}
|
|
56
|
-
get
|
|
55
|
+
get hasSubWizards() {
|
|
57
56
|
return !_.isEmpty(this.subWizards);
|
|
58
57
|
}
|
|
59
58
|
get data() {
|
|
@@ -177,9 +176,9 @@ export default class Wizard extends Webform {
|
|
|
177
176
|
}
|
|
178
177
|
render() {
|
|
179
178
|
const ctx = this.renderContext;
|
|
180
|
-
if (this.component.
|
|
179
|
+
if (this.component.id) {
|
|
181
180
|
ctx.panels.map(panel => {
|
|
182
|
-
if (panel.
|
|
181
|
+
if (panel.id === this.component.id) {
|
|
183
182
|
this.currentPanel = panel;
|
|
184
183
|
ctx.wizardPageTooltip = this.getFormattedTooltip(panel.tooltip);
|
|
185
184
|
}
|
|
@@ -580,7 +579,7 @@ export default class Wizard extends Webform {
|
|
|
580
579
|
this.pageFieldLogic(num);
|
|
581
580
|
this.getNextPage();
|
|
582
581
|
let parentNum = num;
|
|
583
|
-
if (this.
|
|
582
|
+
if (this.hasSubWizards) {
|
|
584
583
|
const pageFromPages = this.pages[num];
|
|
585
584
|
const pageFromComponents = this.components[num];
|
|
586
585
|
if (!pageFromComponents || pageFromPages?.id !== pageFromComponents.id) {
|
|
@@ -857,23 +856,18 @@ export default class Wizard extends Webform {
|
|
|
857
856
|
this.showErrors(errors, true, true);
|
|
858
857
|
}
|
|
859
858
|
// If the pages change, need to redraw the header.
|
|
860
|
-
|
|
861
|
-
|
|
859
|
+
const currentPanels = this.pages;
|
|
860
|
+
// calling this.establishPages() updates/mutates this.pages to be the current pages
|
|
861
|
+
this.establishPages();
|
|
862
|
+
const newPanels = this.pages;
|
|
862
863
|
const currentNextPage = this.currentNextPage;
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
this.
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
else {
|
|
869
|
-
currentPanels = this.currentPanels || this.pages.map(page => page.component.key);
|
|
870
|
-
panels = this.establishPages().map(panel => panel.key);
|
|
871
|
-
this.currentPanels = panels;
|
|
872
|
-
if (this.currentPanel?.key && this.currentPanels?.length) {
|
|
873
|
-
this.setPage(this.currentPanels.findIndex(panel => panel === this.currentPanel.key));
|
|
874
|
-
}
|
|
864
|
+
const panelsUpdated = !_.isEqual(newPanels, currentPanels);
|
|
865
|
+
if (this.currentPanel?.id && this.pages.length && (!this.hasSubWizards || (this.hasSubWizards && panelsUpdated))) {
|
|
866
|
+
const newIndex = this.pages.findIndex(page => page.id === this.currentPanel.id);
|
|
867
|
+
if (newIndex !== -1)
|
|
868
|
+
this.setPage(newIndex);
|
|
875
869
|
}
|
|
876
|
-
if (
|
|
870
|
+
if (panelsUpdated || (flags && flags.fromSubmission)) {
|
|
877
871
|
this.redrawHeader();
|
|
878
872
|
}
|
|
879
873
|
// If the next page changes, then make sure to redraw navigation.
|
|
@@ -912,14 +906,13 @@ export default class Wizard extends Webform {
|
|
|
912
906
|
return super.errors;
|
|
913
907
|
}
|
|
914
908
|
showErrors(errors, triggerEvent) {
|
|
915
|
-
if (this.
|
|
909
|
+
if (this.hasSubWizards) {
|
|
916
910
|
this.subWizards.forEach((subWizard) => {
|
|
917
911
|
if (Array.isArray(subWizard.errors)) {
|
|
918
912
|
errors = [...errors, ...subWizard.errors];
|
|
919
913
|
}
|
|
920
914
|
});
|
|
921
915
|
}
|
|
922
|
-
;
|
|
923
916
|
return super.showErrors(errors, triggerEvent);
|
|
924
917
|
}
|
|
925
918
|
focusOnComponent(key) {
|
|
@@ -2482,7 +2482,7 @@ export default class Component extends Element {
|
|
|
2482
2482
|
}
|
|
2483
2483
|
return value;
|
|
2484
2484
|
};
|
|
2485
|
-
if (this.defaultMask) {
|
|
2485
|
+
if (Array.isArray(this.defaultMask) ? this.defaultMask.length > 0 : this.defaultMask) {
|
|
2486
2486
|
if (Array.isArray(defaultValue)) {
|
|
2487
2487
|
defaultValue = defaultValue.map(checkMask);
|
|
2488
2488
|
}
|
|
@@ -3214,12 +3214,6 @@ export default class Component extends Element {
|
|
|
3214
3214
|
return (this.component.protected || !this.component.persistent || (this.component.persistent === 'client-only'));
|
|
3215
3215
|
}
|
|
3216
3216
|
shouldSkipValidation(data, row, flags = {}) {
|
|
3217
|
-
const { validateWhenHidden = false } = this.component || {};
|
|
3218
|
-
const forceValidOnHidden = (!this.visible || !this.checkCondition(row, data)) && !validateWhenHidden;
|
|
3219
|
-
if (forceValidOnHidden) {
|
|
3220
|
-
// If this component is forced valid when it is hidden, then we also need to reset the errors for this component.
|
|
3221
|
-
this._errors = [];
|
|
3222
|
-
}
|
|
3223
3217
|
const rules = [
|
|
3224
3218
|
// Do not validate if the flags say not too.
|
|
3225
3219
|
() => flags.noValidate,
|
|
@@ -3230,7 +3224,14 @@ export default class Component extends Element {
|
|
|
3230
3224
|
// Check to see if we are editing and if so, check component persistence.
|
|
3231
3225
|
() => this.isValueHidden(),
|
|
3232
3226
|
// Force valid if component is hidden.
|
|
3233
|
-
() =>
|
|
3227
|
+
() => {
|
|
3228
|
+
if (!this.component.validateWhenHidden && (!this.visible || !this.checkCondition(row, data))) {
|
|
3229
|
+
// If this component is forced valid when it is hidden, then we also need to reset the errors for this component.
|
|
3230
|
+
this._errors = [];
|
|
3231
|
+
return true;
|
|
3232
|
+
}
|
|
3233
|
+
return false;
|
|
3234
|
+
}
|
|
3234
3235
|
];
|
|
3235
3236
|
return rules.some(pred => pred());
|
|
3236
3237
|
}
|
|
@@ -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
|
},
|
|
@@ -680,7 +680,7 @@ export default class NestedComponent extends Field {
|
|
|
680
680
|
}
|
|
681
681
|
validationProcessor({ scope, data, row, instance, component }, flags) {
|
|
682
682
|
const { dirty } = flags;
|
|
683
|
-
if (this.root.
|
|
683
|
+
if (this.root.hasSubWizards && this.page !== this.root.page) {
|
|
684
684
|
instance = this.childComponentsMap?.hasOwnProperty(component.path)
|
|
685
685
|
? this.childComponentsMap[component.path]
|
|
686
686
|
: this.getComponent(component.path);
|
|
@@ -156,7 +156,9 @@ export default class SignatureComponent extends Input {
|
|
|
156
156
|
if (this.dataValue) {
|
|
157
157
|
this.setDataToSigaturePad();
|
|
158
158
|
}
|
|
159
|
-
this.
|
|
159
|
+
if (!this.disabled) {
|
|
160
|
+
this.showCanvas(true);
|
|
161
|
+
}
|
|
160
162
|
}
|
|
161
163
|
}
|
|
162
164
|
renderElement(value, index) {
|
package/lib/mjs/utils/i18n.js
CHANGED
|
@@ -74,6 +74,10 @@ export class I18n {
|
|
|
74
74
|
}
|
|
75
75
|
t(text, ...args) {
|
|
76
76
|
if (this.currentLanguage[text]) {
|
|
77
|
+
const customTranslationFieldName = args[0]?.field;
|
|
78
|
+
if (customTranslationFieldName && this.currentLanguage[customTranslationFieldName]) {
|
|
79
|
+
args[0].field = this.currentLanguage[customTranslationFieldName];
|
|
80
|
+
}
|
|
77
81
|
return Evaluator.interpolateString(this.currentLanguage[text], ...args);
|
|
78
82
|
}
|
|
79
83
|
return Evaluator.interpolateString(text, ...args);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formio/js",
|
|
3
|
-
"version": "5.0.0-dev.
|
|
3
|
+
"version": "5.0.0-dev.5913.108f53e",
|
|
4
4
|
"description": "JavaScript powered Forms with JSON Form Builder",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"@formio/bootstrap": "3.0.0-dev.98.17ba6ea",
|
|
84
84
|
"@formio/choices.js": "^10.2.1",
|
|
85
|
-
"@formio/core": "
|
|
85
|
+
"@formio/core": "2.1.0-dev.191.8c609ab",
|
|
86
86
|
"@formio/text-mask-addons": "^3.8.0-formio.3",
|
|
87
87
|
"@formio/vanilla-text-mask": "^5.1.1-formio.1",
|
|
88
88
|
"abortcontroller-polyfill": "^1.7.5",
|