@processmaker/screen-builder 2.5.29 → 2.5.30
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/vue-form-builder.common.js +1296 -752
- package/dist/vue-form-builder.common.js.map +1 -1
- package/dist/vue-form-builder.umd.js +1296 -752
- package/dist/vue-form-builder.umd.js.map +1 -1
- package/dist/vue-form-builder.umd.min.js +106 -106
- package/dist/vue-form-builder.umd.min.js.map +1 -1
- package/package-lock.json +1 -1
- package/package.json +1 -1
- package/src/ValidationsFactory.js +45 -9
package/package-lock.json
CHANGED
package/package.json
CHANGED
|
@@ -34,7 +34,7 @@ class Validations {
|
|
|
34
34
|
isVisible() {
|
|
35
35
|
// Disable validations if field is hidden
|
|
36
36
|
let visible = true;
|
|
37
|
-
if (this.element.config.conditionalHide) {
|
|
37
|
+
if (!this.data.noData && this.element.config.conditionalHide) {
|
|
38
38
|
try {
|
|
39
39
|
visible = !!Parser.evaluate(this.element.config.conditionalHide, this.data);
|
|
40
40
|
} catch (error) {
|
|
@@ -51,7 +51,7 @@ class Validations {
|
|
|
51
51
|
class ArrayOfFieldsValidations extends Validations {
|
|
52
52
|
async addValidations(validations) {
|
|
53
53
|
for (const item of this.element) {
|
|
54
|
-
await ValidationsFactory(item, { screen: this.screen, data: this.data }).addValidations(validations);
|
|
54
|
+
await ValidationsFactory(item, { screen: this.screen, data: this.data, parentVisibilityRule: this.parentVisibilityRule}).addValidations(validations);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -81,8 +81,9 @@ class FormNestedScreenValidations extends Validations {
|
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
const definition = await this.loadScreen(this.element.config.screen);
|
|
84
|
+
let parentVisibilityRule = this.parentVisibilityRule ? this.parentVisibilityRule : this.element.config.conditionalHide;
|
|
84
85
|
if (definition && definition[0] && definition[0].items) {
|
|
85
|
-
await ValidationsFactory(definition[0].items, { screen: this.screen, data: this.data }).addValidations(validations);
|
|
86
|
+
await ValidationsFactory(definition[0].items, { screen: this.screen, data: this.data, parentVisibilityRule }).addValidations(validations);
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
89
|
|
|
@@ -112,8 +113,7 @@ class FormLoopValidations extends Validations {
|
|
|
112
113
|
set(validations, this.element.config.name, {});
|
|
113
114
|
const loopField = get(validations, this.element.config.name);
|
|
114
115
|
loopField['$each'] = {};
|
|
115
|
-
|
|
116
|
-
await ValidationsFactory(this.element.items, { screen: this.screen, data: {_parent: this.data, ...firstRow } }).addValidations(loopField['$each']);
|
|
116
|
+
await ValidationsFactory(this.element.items, { screen: this.screen, data: {_parent: this.data, noData: true}, parentVisibilityRule: this.element.config.conditionalHide}).addValidations(loopField['$each']);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
|
|
@@ -126,7 +126,7 @@ class FormMultiColumnValidations extends Validations {
|
|
|
126
126
|
if (!this.isVisible()) {
|
|
127
127
|
return;
|
|
128
128
|
}
|
|
129
|
-
await ValidationsFactory(this.element.items, { screen: this.screen, data: this.data }).addValidations(validations);
|
|
129
|
+
await ValidationsFactory(this.element.items, { screen: this.screen, data: this.data, parentVisibilityRule: this.element.config.conditionalHide }).addValidations(validations);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
|
|
@@ -168,7 +168,7 @@ class FormElementValidations extends Validations {
|
|
|
168
168
|
const fieldName = this.element.config.name;
|
|
169
169
|
const validationConfig = this.element.config.validation;
|
|
170
170
|
const conditionalHide = this.element.config.conditionalHide;
|
|
171
|
-
|
|
171
|
+
const parentVisibilityRule = this.parentVisibilityRule;
|
|
172
172
|
set(validations, fieldName, get(validations, fieldName, {}));
|
|
173
173
|
const fieldValidation = get(validations, fieldName);
|
|
174
174
|
if (validationConfig instanceof Array) {
|
|
@@ -193,7 +193,25 @@ class FormElementValidations extends Validations {
|
|
|
193
193
|
}
|
|
194
194
|
fieldValidation[rule] = function(...props) {
|
|
195
195
|
const data = props[1];
|
|
196
|
-
|
|
196
|
+
let dataWithParent = this.addReferenceToParents(data);
|
|
197
|
+
const nestedDataWithParent = this.addReferenceToParents(this.findParent(data));
|
|
198
|
+
if (nestedDataWithParent) {
|
|
199
|
+
dataWithParent = Object.assign(nestedDataWithParent, dataWithParent);
|
|
200
|
+
}
|
|
201
|
+
// Check Parent Visibility
|
|
202
|
+
if (parentVisibilityRule) {
|
|
203
|
+
let isParentVisible = true;
|
|
204
|
+
try {
|
|
205
|
+
isParentVisible = !!Parser.evaluate(parentVisibilityRule, dataWithParent);
|
|
206
|
+
} catch (error) {
|
|
207
|
+
isParentVisible = false;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (!isParentVisible ) {
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
// Check Field Visibility
|
|
197
215
|
let visible = true;
|
|
198
216
|
if (conditionalHide) {
|
|
199
217
|
try {
|
|
@@ -217,7 +235,25 @@ class FormElementValidations extends Validations {
|
|
|
217
235
|
}
|
|
218
236
|
fieldValidation[validationConfig] = function(...props) {
|
|
219
237
|
const data = props[1];
|
|
220
|
-
|
|
238
|
+
let dataWithParent = this.addReferenceToParents(data);
|
|
239
|
+
const nestedDataWithParent = this.addReferenceToParents(this.findParent(data));
|
|
240
|
+
if (nestedDataWithParent) {
|
|
241
|
+
dataWithParent = Object.assign(nestedDataWithParent, dataWithParent);
|
|
242
|
+
}
|
|
243
|
+
// Check Parent Visibility
|
|
244
|
+
if (parentVisibilityRule) {
|
|
245
|
+
let isParentVisible = true;
|
|
246
|
+
try {
|
|
247
|
+
isParentVisible = !!Parser.evaluate(parentVisibilityRule, dataWithParent);
|
|
248
|
+
} catch (error) {
|
|
249
|
+
isParentVisible = false;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if (!isParentVisible) {
|
|
253
|
+
return true;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
// Check Field Visibility
|
|
221
257
|
let visible = true;
|
|
222
258
|
if (conditionalHide) {
|
|
223
259
|
try {
|