@processmaker/screen-builder 2.64.0 → 2.64.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@processmaker/screen-builder",
3
- "version": "2.64.0",
3
+ "version": "2.64.1",
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.43.0",
42
+ "@processmaker/vue-form-elements": "0.43.2",
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.43.0",
91
+ "@processmaker/vue-form-elements": "0.43.2",
92
92
  "i18next": "^15.0.8",
93
93
  "vue": "^2.6.12",
94
94
  "vuex": "^3.1.1"
@@ -62,6 +62,14 @@ export default {
62
62
  name: "ScreenRenderer",
63
63
  components: { WatchersSynchronous, ScreenRendererError },
64
64
  mixins: [Json2Vue, CurrentPageProperty],
65
+ props: {
66
+ // property used to pass the context of the screen used as prefix for the file upload component
67
+ // e.g. `multi_instance_var.1` or `loop_var.1`
68
+ loopContext: {
69
+ type: String,
70
+ default: ""
71
+ }
72
+ },
65
73
  data() {
66
74
  return {
67
75
  currentDefinition: null,
@@ -16,6 +16,7 @@
16
16
  :custom-css="screen.custom_css"
17
17
  :watchers="screen.watchers"
18
18
  :key="refreshScreen"
19
+ :loop-context="loopContext"
19
20
  @update="onUpdate"
20
21
  @submit="submit"
21
22
  />
@@ -74,6 +75,7 @@ export default {
74
75
  csrfToken: { type: String, default: null },
75
76
  value: { type: Object, default: () => {} },
76
77
  beforeLoadTask: { type: Function, default: defaultBeforeLoadTask },
78
+ initialLoopContext: { type: String, default: "" }
77
79
  },
78
80
  data() {
79
81
  return {
@@ -230,7 +232,7 @@ export default {
230
232
  }
231
233
  },
232
234
  loadTask() {
233
- const url = `/${this.taskId}?include=data,user,requestor,processRequest,component,screen,requestData,bpmnTagName,interstitial,definition,nested,userRequestPermission`;
235
+ const url = `/${this.taskId}?include=data,user,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission`;
234
236
  // For Vocabularies
235
237
  if (window.ProcessMaker && window.ProcessMaker.packages && window.ProcessMaker.packages.includes('package-vocabularies')) {
236
238
  window.ProcessMaker.VocabulariesSchemaUrl = `vocabularies/task_schema/${this.taskId}`;
@@ -256,6 +258,7 @@ export default {
256
258
  prepareTask() {
257
259
  this.resetScreenState();
258
260
  this.requestData = _.get(this.task, 'request_data', {});
261
+ this.loopContext = _.get(this.task, "loop_context", "");
259
262
  this.refreshScreen++;
260
263
 
261
264
  this.$emit('task-updated', this.task);
@@ -497,6 +500,7 @@ export default {
497
500
  this.processId = this.initialProcessId;
498
501
  this.nodeId = this.initialNodeId;
499
502
  this.requestData = this.value;
503
+ this.loopContext = this.initialLoopContext;
500
504
  },
501
505
  destroyed() {
502
506
  this.unsubscribeSocketListeners();
@@ -1,7 +1,19 @@
1
1
  <template>
2
2
  <div :class="containerClass">
3
3
  <custom-css-output>{{ customCssWrapped }}</custom-css-output>
4
- <screen-renderer ref="renderer" :value="data" :_parent="_parent" :definition="definition" :current-page="currentPage" @submit="submit" data-cy="screen-renderer" :show-errors="showErrors" :test-screen-definition="testScreenDefinition || false" class="p-0"/>
4
+ <screen-renderer
5
+ ref="renderer"
6
+ :value="data"
7
+ :_parent="_parent"
8
+ :definition="definition"
9
+ :current-page="currentPage"
10
+ data-cy="screen-renderer"
11
+ :show-errors="showErrors"
12
+ :test-screen-definition="testScreenDefinition || false"
13
+ class="p-0"
14
+ :loop-context="loopContext"
15
+ @submit="submit"
16
+ />
5
17
  </div>
6
18
  </template>
7
19
 
@@ -28,9 +28,14 @@ export default {
28
28
  const safeDotName = this.safeDotName(name);
29
29
  const defaultComputedName = `default_${safeDotName}__`;
30
30
  this.addData(screen, `${name}_was_filled__`, `!!this.getValue(${JSON.stringify(name)}, this.vdata) || !!this.getValue(${JSON.stringify(name)}, data)`);
31
- this.addMounted(screen, `if (!this.${name}) {
32
- this.tryFormField(${JSON.stringify(name)}, () => {this.${this.dot2bracket(name)} = ${value};});
33
- }`);
31
+ this.addMounted(
32
+ screen,
33
+ `if (!this.${safeDotName}) {
34
+ this.tryFormField(${JSON.stringify(name)}, () => {
35
+ this.${safeDotName} = ${value};
36
+ this.setValue(${JSON.stringify(name)}, ${value}, this.vdata, this);});
37
+ }`
38
+ );
34
39
  screen.computed[defaultComputedName] = {
35
40
  get: new Function(`return this.tryFormField(${JSON.stringify(name)}, () => ${value});`),
36
41
  set() {},
@@ -1,51 +1,60 @@
1
1
  export default {
2
2
  props: {
3
3
  configRef: null,
4
- loopContext: null,
4
+ loopContext: null
5
5
  },
6
6
  data() {
7
7
  return {
8
- loops: [],
8
+ loops: []
9
9
  };
10
10
  },
11
11
  methods: {
12
12
  loadFormLoopProperties({ properties, element }) {
13
13
  this.registerVariable(element.config.settings.varname, element);
14
- this.loops.push({ variable: element.config.settings.varname, element, properties });
14
+ this.loops.push({
15
+ variable: element.config.settings.varname,
16
+ element,
17
+ properties
18
+ });
15
19
  },
16
20
  loadFormLoopItems({ element, node, definition }) {
17
- const loop = this.createComponent('div', {
18
- 'v-for': `(loopRow, index) in ${element.config.settings.varname}`,
21
+ const safeDotName = this.safeDotName(element.config.settings.varname);
22
+ const loop = this.createComponent("div", {
23
+ "v-for": `(loopRow, index) in ${safeDotName}`
19
24
  });
20
25
  const nested = {
21
26
  config: [
22
27
  {
23
- items: element.items,
24
- },
28
+ items: element.items
29
+ }
25
30
  ],
26
- watchers: definition.watchers,
31
+ watchers: definition.watchers
27
32
  };
28
33
 
29
- let loopContext = '';
34
+ let loopContext = "";
30
35
  if (this.loopContext) {
31
- loopContext = this.loopContext + '.';
36
+ loopContext = `${this.loopContext}.`;
32
37
  }
33
38
  loopContext += element.config.settings.varname;
34
39
 
35
40
  // Add nested component inside loop
36
- const child = this.createComponent('ScreenRenderer', {
37
- ':definition': this.byRef(nested),
38
- ':value': 'loopRow',
39
- ':loop-context': `'${loopContext}.' + index`,
40
- ':_parent': 'getValidationData()',
41
- ':components': this.byRef(this.components),
42
- ':config-ref': this.byRef(this.configRef || definition.config),
43
- '@submit': 'submitForm',
41
+ const child = this.createComponent("ScreenRenderer", {
42
+ ":definition": this.byRef(nested),
43
+ ":value": "loopRow",
44
+ ":loop-context": `'${loopContext}.' + index`,
45
+ ":_parent": "getValidationData()",
46
+ ":components": this.byRef(this.components),
47
+ ":config-ref": this.byRef(this.configRef || definition.config),
48
+ "@submit": "submitForm"
44
49
  });
45
- const addLoopRow = this.createComponent('AddLoopRow', {
46
- ':value': element.config.settings.varname,
47
- ':config': this.byRef(element.config),
48
- ':error': `${this.checkVariableExists('$v.vdata.' + element.config.name)} && validationMessage($v.vdata.${element.config.name}) || ${this.checkVariableExists('$v.schema.' + element.config.name)} && validationMessage($v.schema.${element.config.name})`,
50
+ const addLoopRow = this.createComponent("AddLoopRow", {
51
+ ":value": safeDotName,
52
+ ":config": this.byRef(element.config),
53
+ ":error": `${this.checkVariableExists(
54
+ `$v.vdata.${element.config.name}`
55
+ )} && validationMessage($v.vdata.${element.config.name})
56
+ || ${this.checkVariableExists(`$v.schema.${element.config.name}`)}
57
+ && validationMessage($v.schema.${element.config.name})`
49
58
  });
50
59
  loop.appendChild(child);
51
60
  node.appendChild(loop);
@@ -53,24 +62,24 @@ export default {
53
62
  // Register nested component as Array
54
63
  this.registerNestedVariable(
55
64
  element.config.settings.varname,
56
- element.config.settings.varname + '.index.',
65
+ `${element.config.settings.varname}.index.`,
57
66
  nested
58
67
  );
59
- },
68
+ }
60
69
  },
61
70
  mounted() {
62
- this.alias['FormLoop'] = 'div';
71
+ this.alias.FormLoop = "div";
63
72
  this.extensions.push({
64
73
  beforeload() {
65
74
  this.loops.splice(0);
66
75
  },
67
76
  onloadproperties(params) {
68
- if (params.element.container && params.componentName === 'FormLoop') {
77
+ if (params.element.container && params.componentName === "FormLoop") {
69
78
  this.loadFormLoopProperties(params);
70
79
  }
71
80
  },
72
81
  onloaditems(params) {
73
- if (params.element.container && params.componentName === 'FormLoop') {
82
+ if (params.element.container && params.componentName === "FormLoop") {
74
83
  this.loadFormLoopItems(params);
75
84
  }
76
85
  }