@processmaker/screen-builder 2.5.28 → 2.5.29
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 +2387 -2673
- package/dist/vue-form-builder.common.js.map +1 -1
- package/dist/vue-form-builder.umd.js +2387 -2673
- 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 +164 -164
- package/package.json +3 -3
- package/src/.DS_Store +0 -0
- package/src/ValidationsFactory.js +33 -16
- package/src/components/renderer/form-button.vue +0 -40
- package/src/components/renderer/form-record-list.vue +6 -1
- package/src/form-control-common-properties.js +2 -1
- package/src/mixins/ValidationRules.js +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@processmaker/screen-builder",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.29",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"serve": "vue-cli-service serve",
|
|
6
6
|
"build": "vue-cli-service build",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@cypress/code-coverage": "^3.8.1",
|
|
45
45
|
"@fortawesome/fontawesome-free": "^5.6.1",
|
|
46
46
|
"@panter/vue-i18next": "^0.15.2",
|
|
47
|
-
"@processmaker/vue-form-elements": "0.18.4-
|
|
47
|
+
"@processmaker/vue-form-elements": "0.18.4-R",
|
|
48
48
|
"@vue/cli-plugin-babel": "^3.6.0",
|
|
49
49
|
"@vue/cli-plugin-e2e-cypress": "^4.0.3",
|
|
50
50
|
"@vue/cli-plugin-eslint": "^3.6.0",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"@panter/vue-i18next": "^0.15.0",
|
|
87
|
-
"@processmaker/vue-form-elements": "0.18.4-
|
|
87
|
+
"@processmaker/vue-form-elements": "0.18.4-R",
|
|
88
88
|
"i18next": "^15.0.8",
|
|
89
89
|
"vue": "^2.6.12",
|
|
90
90
|
"vuex": "^3.1.1"
|
package/src/.DS_Store
CHANGED
|
Binary file
|
|
@@ -167,19 +167,7 @@ class FormElementValidations extends Validations {
|
|
|
167
167
|
}
|
|
168
168
|
const fieldName = this.element.config.name;
|
|
169
169
|
const validationConfig = this.element.config.validation;
|
|
170
|
-
|
|
171
|
-
// Disable validations if field is hidden
|
|
172
|
-
if (this.element.config.conditionalHide) {
|
|
173
|
-
let visible = true;
|
|
174
|
-
try {
|
|
175
|
-
visible = !!Parser.evaluate(this.element.config.conditionalHide, this.data);
|
|
176
|
-
} catch (error) {
|
|
177
|
-
visible = false;
|
|
178
|
-
}
|
|
179
|
-
if (!visible) {
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
170
|
+
const conditionalHide = this.element.config.conditionalHide;
|
|
183
171
|
|
|
184
172
|
set(validations, fieldName, get(validations, fieldName, {}));
|
|
185
173
|
const fieldValidation = get(validations, fieldName);
|
|
@@ -203,7 +191,22 @@ class FormElementValidations extends Validations {
|
|
|
203
191
|
params.push(fieldName);
|
|
204
192
|
validationFn = validationFn(...params);
|
|
205
193
|
}
|
|
206
|
-
fieldValidation[rule] =
|
|
194
|
+
fieldValidation[rule] = function(...props) {
|
|
195
|
+
const data = props[1];
|
|
196
|
+
const dataWithParent = this.addReferenceToParents(data);
|
|
197
|
+
let visible = true;
|
|
198
|
+
if (conditionalHide) {
|
|
199
|
+
try {
|
|
200
|
+
visible = !!Parser.evaluate(conditionalHide, dataWithParent);
|
|
201
|
+
} catch (error) {
|
|
202
|
+
visible = false;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (!visible) {
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
return validationFn.apply(this,props);
|
|
209
|
+
};
|
|
207
210
|
});
|
|
208
211
|
} else if (typeof validationConfig === 'string' && validationConfig) {
|
|
209
212
|
let validationFn = validators[validationConfig];
|
|
@@ -212,7 +215,22 @@ class FormElementValidations extends Validations {
|
|
|
212
215
|
console.error(`Undefined validation rule "${validationConfig}"`);
|
|
213
216
|
return;
|
|
214
217
|
}
|
|
215
|
-
fieldValidation[validationConfig] =
|
|
218
|
+
fieldValidation[validationConfig] = function(...props) {
|
|
219
|
+
const data = props[1];
|
|
220
|
+
const dataWithParent = this.addReferenceToParents(data);
|
|
221
|
+
let visible = true;
|
|
222
|
+
if (conditionalHide) {
|
|
223
|
+
try {
|
|
224
|
+
visible = !!Parser.evaluate(conditionalHide, dataWithParent);
|
|
225
|
+
} catch (error) {
|
|
226
|
+
visible = false;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
if (!visible) {
|
|
230
|
+
return true;
|
|
231
|
+
}
|
|
232
|
+
return validationFn.apply(this,props);
|
|
233
|
+
};
|
|
216
234
|
}
|
|
217
235
|
if (this.element.items) {
|
|
218
236
|
ValidationsFactory(this.element.items, { screen: this.screen, data: this.data }).addValidations(validations);
|
|
@@ -222,7 +240,6 @@ class FormElementValidations extends Validations {
|
|
|
222
240
|
return name.replace(/_\w/g, m => m.substr(1, 1).toUpperCase());
|
|
223
241
|
}
|
|
224
242
|
}
|
|
225
|
-
|
|
226
243
|
function ValidationsFactory(element, options) {
|
|
227
244
|
if (element instanceof Array) {
|
|
228
245
|
return new ArrayOfFieldsValidations(element, options);
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script>
|
|
8
|
-
import Mustache from 'mustache';
|
|
9
8
|
import { getValidPath } from '@/mixins';
|
|
10
9
|
|
|
11
10
|
export default {
|
|
@@ -19,45 +18,6 @@ export default {
|
|
|
19
18
|
['btn-' + variant]: true,
|
|
20
19
|
};
|
|
21
20
|
},
|
|
22
|
-
options() {
|
|
23
|
-
if (!this.tooltip || this.event === 'submit') {
|
|
24
|
-
return {};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
let content = '';
|
|
28
|
-
try {
|
|
29
|
-
content = Mustache.render(this.tooltip.content || '', this.transientData);
|
|
30
|
-
} catch (error) { error; }
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
title: content,
|
|
34
|
-
html: true,
|
|
35
|
-
placement: this.tooltip.position || '',
|
|
36
|
-
trigger: 'hover',
|
|
37
|
-
variant: this.tooltip.variant || '',
|
|
38
|
-
boundary: 'window',
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
valid() {
|
|
42
|
-
if (this.$attrs.validate) {
|
|
43
|
-
return !this.$attrs.validate.$invalid;
|
|
44
|
-
}
|
|
45
|
-
return true;
|
|
46
|
-
},
|
|
47
|
-
message() {
|
|
48
|
-
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
|
49
|
-
this.errors = 0;
|
|
50
|
-
if (!this.valid) {
|
|
51
|
-
this.countErrors(this.$attrs.validate.vdata);
|
|
52
|
-
this.countErrors(this.$attrs.validate.schema);
|
|
53
|
-
let message = 'There are {{items}} validation errors in your form.';
|
|
54
|
-
if (this.errors === 1) {
|
|
55
|
-
message = 'There is a validation error in your form.';
|
|
56
|
-
}
|
|
57
|
-
return this.$t(message, {items: this.errors});
|
|
58
|
-
}
|
|
59
|
-
return '';
|
|
60
|
-
},
|
|
61
21
|
},
|
|
62
22
|
data() {
|
|
63
23
|
return {
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
:title="$t('Add')"
|
|
74
74
|
header-close-content="×"
|
|
75
75
|
data-cy="modal-add"
|
|
76
|
+
@shown="emitShownEvent"
|
|
76
77
|
>
|
|
77
78
|
<vue-form-renderer
|
|
78
79
|
:page="0"
|
|
@@ -98,6 +99,7 @@
|
|
|
98
99
|
:title="$t('Edit Record')"
|
|
99
100
|
header-close-content="×"
|
|
100
101
|
data-cy="modal-edit"
|
|
102
|
+
@shown="emitShownEvent"
|
|
101
103
|
>
|
|
102
104
|
<vue-form-renderer
|
|
103
105
|
:page="0"
|
|
@@ -257,6 +259,9 @@ export default {
|
|
|
257
259
|
},
|
|
258
260
|
},
|
|
259
261
|
methods: {
|
|
262
|
+
emitShownEvent() {
|
|
263
|
+
window.ProcessMaker.EventBus.$emit('modal-shown');
|
|
264
|
+
},
|
|
260
265
|
isImage(field, item) {
|
|
261
266
|
const content = _.get(item, field.key);
|
|
262
267
|
return typeof content === 'string' && content.substr(0,11) === 'data:image/';
|
|
@@ -336,7 +341,7 @@ export default {
|
|
|
336
341
|
// Reset edit to be a copy of our data model item
|
|
337
342
|
this.editItem = JSON.parse(JSON.stringify(this.value[pageIndex]));
|
|
338
343
|
this.editIndex = pageIndex;
|
|
339
|
-
// rebuild the edit screen to avoid
|
|
344
|
+
// rebuild the edit screen to avoid
|
|
340
345
|
this.editFormVersion++;
|
|
341
346
|
this.$nextTick(() => {
|
|
342
347
|
this.setUploadDataNamePrefix(pageIndex);
|
|
@@ -95,7 +95,8 @@ export const keyNameProperty = {
|
|
|
95
95
|
config: {
|
|
96
96
|
label: 'Variable Name',
|
|
97
97
|
name: 'Variable Name',
|
|
98
|
-
|
|
98
|
+
// Update tests/e2e/specs/Builder.spec.js when changing this
|
|
99
|
+
validation: 'regex:/^([a-zA-Z]([a-zA-Z0-9_]?)+\\.?)+(?<!\\.)$/|required|not_in:' + javascriptReservedKeywords,
|
|
99
100
|
helper: 'A variable name is a symbolic name to reference information.',
|
|
100
101
|
},
|
|
101
102
|
};
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
not,
|
|
22
22
|
or,
|
|
23
23
|
and,
|
|
24
|
+
type,
|
|
24
25
|
} from 'vuelidate/lib/validators';
|
|
25
26
|
|
|
26
27
|
export const ValidationMsg = {
|
|
@@ -55,6 +56,7 @@ export const ValidationMsg = {
|
|
|
55
56
|
invalid_default_value: 'Invalid default value',
|
|
56
57
|
customDate: 'Must be a valid Date',
|
|
57
58
|
regex: 'Invalid value',
|
|
59
|
+
type: 'Invalid type.',
|
|
58
60
|
};
|
|
59
61
|
|
|
60
62
|
export const custom_date = (date) => {
|
|
@@ -225,4 +227,5 @@ export const validators = {
|
|
|
225
227
|
notIn,
|
|
226
228
|
regex,
|
|
227
229
|
afterOrEqual: after_or_equal,
|
|
230
|
+
type,
|
|
228
231
|
};
|