@processmaker/screen-builder 2.5.29 → 2.5.30-PATCH4.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/vue-form-builder.common.js +3580 -3267
- package/dist/vue-form-builder.common.js.map +1 -1
- package/dist/vue-form-builder.css +1 -1
- package/dist/vue-form-builder.umd.js +3580 -3267
- package/dist/vue-form-builder.umd.js.map +1 -1
- package/dist/vue-form-builder.umd.min.js +107 -107
- package/dist/vue-form-builder.umd.min.js.map +1 -1
- package/package-lock.json +1 -1
- package/package.json +1 -1
- package/src/.DS_Store +0 -0
- package/src/ValidationsFactory.js +45 -9
- package/src/components/renderer/file-download.vue +2 -1
- package/src/components/renderer/file-upload.vue +0 -19
- package/src/components/renderer/form-record-list.vue +10 -0
package/package-lock.json
CHANGED
package/package.json
CHANGED
package/src/.DS_Store
CHANGED
|
Binary file
|
|
@@ -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 {
|
|
@@ -110,7 +110,7 @@ export default {
|
|
|
110
110
|
listenRecordList(recordList, index, id) {
|
|
111
111
|
const parent = this.parentRecordList(this);
|
|
112
112
|
if (_.has(window, 'PM4ConfigOverrides.requestFiles') && parent === recordList) {
|
|
113
|
-
const prefix = (this.parentRecordList(this) === null) ? '' :
|
|
113
|
+
const prefix = (this.parentRecordList(this) === null) ? '' : this.prefix;
|
|
114
114
|
const fileDataName = prefix + this.name + (id ? '.' + id : '');
|
|
115
115
|
this.fileInfo = window.PM4ConfigOverrides.requestFiles[fileDataName];
|
|
116
116
|
this.loading = false;
|
|
@@ -268,6 +268,7 @@ export default {
|
|
|
268
268
|
this.loading = false;
|
|
269
269
|
});
|
|
270
270
|
}
|
|
271
|
+
this.loading = false;
|
|
271
272
|
},
|
|
272
273
|
setFileInfoFromCache() {
|
|
273
274
|
const info = _.get(window.ProcessMaker.CollectionData, this.prefix + this.name, null);
|
|
@@ -94,8 +94,6 @@ export default {
|
|
|
94
94
|
(loop, removed) => this.listenRemovedLoop(loop, removed));
|
|
95
95
|
|
|
96
96
|
this.removeDefaultClasses();
|
|
97
|
-
|
|
98
|
-
this.checkIfInRecordList();
|
|
99
97
|
|
|
100
98
|
this.setPrefix();
|
|
101
99
|
if (this.$refs['uploader']) {
|
|
@@ -288,15 +286,6 @@ export default {
|
|
|
288
286
|
this.prefix = parent.loopContext + '.';
|
|
289
287
|
}
|
|
290
288
|
},
|
|
291
|
-
setFileUploadNameForChildren(children, prefix) {
|
|
292
|
-
children.forEach(child => {
|
|
293
|
-
if (_.get(child, '$options.name') === 'FileUpload') {
|
|
294
|
-
child.prefix = prefix;
|
|
295
|
-
} else if (_.get(child, '$children', []).length > 0) {
|
|
296
|
-
this.setFileUploadNameForChildren(child.$children, prefix);
|
|
297
|
-
}
|
|
298
|
-
});
|
|
299
|
-
},
|
|
300
289
|
addFile(file) {
|
|
301
290
|
if (this.disabled) {
|
|
302
291
|
file.ignored = true;
|
|
@@ -420,14 +409,6 @@ export default {
|
|
|
420
409
|
: null;
|
|
421
410
|
}
|
|
422
411
|
},
|
|
423
|
-
checkIfInRecordList() {
|
|
424
|
-
const parent = this.parentRecordList(this);
|
|
425
|
-
if (parent !== null) {
|
|
426
|
-
const recordList = parent;
|
|
427
|
-
const prefix = recordList.name + '.';
|
|
428
|
-
this.setFileUploadNameForChildren(recordList.$children, prefix);
|
|
429
|
-
}
|
|
430
|
-
},
|
|
431
412
|
},
|
|
432
413
|
};
|
|
433
414
|
</script>
|
|
@@ -86,6 +86,7 @@
|
|
|
86
86
|
debug-context="Record List Add"
|
|
87
87
|
:key="Array.isArray(value) ? value.length : 0"
|
|
88
88
|
:_parent="validationData"
|
|
89
|
+
@update="updateRowDataNamePrefix"
|
|
89
90
|
/>
|
|
90
91
|
</b-modal>
|
|
91
92
|
<b-modal
|
|
@@ -112,6 +113,7 @@
|
|
|
112
113
|
debug-context="Record List Edit"
|
|
113
114
|
:_parent="validationData"
|
|
114
115
|
:key="editFormVersion"
|
|
116
|
+
@update="updateRowDataNamePrefix"
|
|
115
117
|
/>
|
|
116
118
|
</b-modal>
|
|
117
119
|
<b-modal
|
|
@@ -164,6 +166,7 @@ export default {
|
|
|
164
166
|
props: ['name', 'label', 'fields', 'value', 'editable', '_config', 'form', 'validationData', 'formConfig', 'formComputed', 'formWatchers'],
|
|
165
167
|
data() {
|
|
166
168
|
return {
|
|
169
|
+
currentRowIndex: null,
|
|
167
170
|
editFormVersion: 0,
|
|
168
171
|
single: '',
|
|
169
172
|
plural: '',
|
|
@@ -259,6 +262,9 @@ export default {
|
|
|
259
262
|
},
|
|
260
263
|
},
|
|
261
264
|
methods: {
|
|
265
|
+
updateRowDataNamePrefix() {
|
|
266
|
+
this.setUploadDataNamePrefix(this.currentRowIndex);
|
|
267
|
+
},
|
|
262
268
|
emitShownEvent() {
|
|
263
269
|
window.ProcessMaker.EventBus.$emit('modal-shown');
|
|
264
270
|
},
|
|
@@ -270,6 +276,7 @@ export default {
|
|
|
270
276
|
return field.key === '__filedownload';
|
|
271
277
|
},
|
|
272
278
|
setUploadDataNamePrefix(index = null) {
|
|
279
|
+
this.currentRowIndex = index;
|
|
273
280
|
let rowId = null;
|
|
274
281
|
if (index !== null && this.editItem) {
|
|
275
282
|
rowId = this.editItem.row_id;
|
|
@@ -451,6 +458,9 @@ export default {
|
|
|
451
458
|
this.$root.$emit('removed-record', this, recordData);
|
|
452
459
|
},
|
|
453
460
|
},
|
|
461
|
+
mounted() {
|
|
462
|
+
this.updateRowDataNamePrefix = _.debounce(this.updateRowDataNamePrefix, 100);
|
|
463
|
+
},
|
|
454
464
|
};
|
|
455
465
|
</script>
|
|
456
466
|
|