@processmaker/screen-builder 2.60.0 → 2.60.2
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 +2930 -1628
- package/dist/vue-form-builder.common.js.map +1 -1
- package/dist/vue-form-builder.umd.js +2930 -1628
- package/dist/vue-form-builder.umd.js.map +1 -1
- package/dist/vue-form-builder.umd.min.js +3 -3
- package/dist/vue-form-builder.umd.min.js.map +1 -1
- package/package.json +3 -3
- package/src/.DS_Store +0 -0
- package/src/mixins/DataReference.js +85 -0
- package/src/mixins/ScreenBase.js +2 -0
- package/src/mixins/computedFields.js +10 -19
- package/src/mixins/extensions/DefaultValues.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@processmaker/screen-builder",
|
|
3
|
-
"version": "2.60.
|
|
3
|
+
"version": "2.60.2",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"serve": "vue-cli-service serve",
|
|
6
6
|
"build": "vue-cli-service build",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@cypress/code-coverage": "^3.8.1",
|
|
40
40
|
"@fortawesome/fontawesome-free": "^5.6.1",
|
|
41
41
|
"@panter/vue-i18next": "^0.15.2",
|
|
42
|
-
"@processmaker/vue-form-elements": "0.41.
|
|
42
|
+
"@processmaker/vue-form-elements": "0.41.4",
|
|
43
43
|
"@processmaker/vue-multiselect": "^2.2.0",
|
|
44
44
|
"@vue/cli-plugin-babel": "^3.6.0",
|
|
45
45
|
"@vue/cli-plugin-e2e-cypress": "^4.0.3",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
90
|
"@panter/vue-i18next": "^0.15.0",
|
|
91
|
-
"@processmaker/vue-form-elements": "0.41.
|
|
91
|
+
"@processmaker/vue-form-elements": "0.41.4",
|
|
92
92
|
"i18next": "^15.0.8",
|
|
93
93
|
"vue": "^2.6.12",
|
|
94
94
|
"vuex": "^3.1.1"
|
package/src/.DS_Store
CHANGED
|
Binary file
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the screen parent or null if don't have
|
|
3
|
+
* @returns {object|null}
|
|
4
|
+
*/
|
|
5
|
+
function findScreenOwner(control) {
|
|
6
|
+
let owner = control;
|
|
7
|
+
let level = 1;
|
|
8
|
+
while (owner) {
|
|
9
|
+
const isScreen = owner.$options.name === "ScreenContent";
|
|
10
|
+
const isNested = owner.$options.name === "FormNestedScreen";
|
|
11
|
+
if (isScreen) {
|
|
12
|
+
level--;
|
|
13
|
+
}
|
|
14
|
+
if (isNested) {
|
|
15
|
+
level++;
|
|
16
|
+
}
|
|
17
|
+
if (level === -1) {
|
|
18
|
+
return owner;
|
|
19
|
+
}
|
|
20
|
+
owner = owner.$parent;
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Wrap the data of a control using a Proxy
|
|
26
|
+
* @return {object} proxy
|
|
27
|
+
*/
|
|
28
|
+
function wrapScreenData(screen, customProperties = null, setter = null) {
|
|
29
|
+
const handler = {
|
|
30
|
+
get: (target, name) => {
|
|
31
|
+
if (customProperties && customProperties[name]) {
|
|
32
|
+
return customProperties[name];
|
|
33
|
+
}
|
|
34
|
+
if (name === "_parent") {
|
|
35
|
+
if (screen.vdata._parent !== undefined) {
|
|
36
|
+
return screen.vdata._parent;
|
|
37
|
+
}
|
|
38
|
+
const screenOwner = findScreenOwner(screen);
|
|
39
|
+
// Get _parent for the current screen (e.g. Inside Loops, Inside Tabs?, RecordLists...?)
|
|
40
|
+
if (screenOwner && screenOwner !== screen) {
|
|
41
|
+
return wrapScreenData(screenOwner);
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
// Check if vdata exists
|
|
46
|
+
if (screen.vdata !== undefined && screen.vdata !== null) {
|
|
47
|
+
return screen.vdata[name];
|
|
48
|
+
}
|
|
49
|
+
return undefined;
|
|
50
|
+
},
|
|
51
|
+
has(target, name) {
|
|
52
|
+
// customProperties is used by RichText controls
|
|
53
|
+
// to add custom Mustache functions
|
|
54
|
+
if (customProperties && customProperties[name]) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
if (name === "_parent") {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
// Check if vdata exists
|
|
61
|
+
if (screen.vdata !== undefined && screen.vdata !== null) {
|
|
62
|
+
return screen.vdata[name] !== undefined;
|
|
63
|
+
}
|
|
64
|
+
return false;
|
|
65
|
+
},
|
|
66
|
+
set(target, name, value) {
|
|
67
|
+
if (setter) {
|
|
68
|
+
setter(screen, name, value);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
return new Proxy({}, handler);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export default {
|
|
76
|
+
methods: {
|
|
77
|
+
/**
|
|
78
|
+
* Wrap the data of a control using a Proxy
|
|
79
|
+
* @return {object} proxy
|
|
80
|
+
*/
|
|
81
|
+
getDataReference(customProperties = null, setter = null) {
|
|
82
|
+
return wrapScreenData(this, customProperties, setter);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
package/src/mixins/ScreenBase.js
CHANGED
|
@@ -2,12 +2,14 @@ import { get, isEqual, set } from 'lodash';
|
|
|
2
2
|
import Mustache from 'mustache';
|
|
3
3
|
import { mapActions, mapState } from 'vuex';
|
|
4
4
|
import { ValidationMsg } from './ValidationRules';
|
|
5
|
+
import DataReference from "./DataReference";
|
|
5
6
|
|
|
6
7
|
const stringFormats = ['string', 'datetime', 'date', 'password'];
|
|
7
8
|
const parentReference = [];
|
|
8
9
|
|
|
9
10
|
export default {
|
|
10
11
|
name: "ScreenContent",
|
|
12
|
+
mixins: [DataReference],
|
|
11
13
|
schema: [
|
|
12
14
|
function() {
|
|
13
15
|
if (window.ProcessMaker && window.ProcessMaker.packages && window.ProcessMaker.packages.includes('package-vocabularies')) {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Parser } from 'expr-eval';
|
|
1
|
+
import { Parser } from "expr-eval";
|
|
3
2
|
|
|
4
3
|
export default {
|
|
5
4
|
methods: {
|
|
6
5
|
evaluateExpression(expression, type) {
|
|
7
|
-
const self = this;
|
|
8
6
|
let value = null;
|
|
9
7
|
|
|
10
8
|
try {
|
|
@@ -12,22 +10,16 @@ export default {
|
|
|
12
10
|
// vdata (external variables)in this way the event is not
|
|
13
11
|
// executed again when the variable is update
|
|
14
12
|
|
|
15
|
-
const data =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} else {
|
|
20
|
-
return self[name];
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
set() {
|
|
24
|
-
throw 'You are not allowed to set properties from inside an expression';
|
|
25
|
-
},
|
|
13
|
+
const data = this.getDataReference(null, () => {
|
|
14
|
+
throw new Error(
|
|
15
|
+
"You are not allowed to set properties from inside an expression"
|
|
16
|
+
);
|
|
26
17
|
});
|
|
27
18
|
|
|
28
|
-
if (type ===
|
|
19
|
+
if (type === "expression") {
|
|
29
20
|
value = Parser.evaluate(expression, data);
|
|
30
21
|
} else {
|
|
22
|
+
// eslint-disable-next-line no-new-func
|
|
31
23
|
value = new Function(expression).bind(data)();
|
|
32
24
|
}
|
|
33
25
|
|
|
@@ -36,10 +28,9 @@ export default {
|
|
|
36
28
|
}
|
|
37
29
|
|
|
38
30
|
return value;
|
|
39
|
-
|
|
40
31
|
} catch (e) {
|
|
41
|
-
e;
|
|
32
|
+
console.warn("There was a problem evaluating the expression", e);
|
|
42
33
|
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
45
36
|
};
|
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
if (config.defaultValue.mode === 'basic') {
|
|
13
13
|
this.setupDefaultValue(screen, name, `this.mustache(${JSON.stringify(config.defaultValue.value)})`);
|
|
14
14
|
} else if (config.defaultValue.mode === 'js') {
|
|
15
|
-
this.setupDefaultValue(screen, name, `(function() {${config.defaultValue.value}}).bind(this.
|
|
15
|
+
this.setupDefaultValue(screen, name, `(function() {${config.defaultValue.value}}).bind(this.getDataReference())()`);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
if ('initiallyChecked' in config) {
|