@processmaker/screen-builder 2.5.24 → 2.5.27

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.
@@ -44,10 +44,14 @@ export default {
44
44
  };
45
45
  },
46
46
  findParent(child, data = this.vdata, parent = this._parent) {
47
+
47
48
  if (child === data) {
48
49
  return parent;
49
50
  }
50
51
  for (const key in data) {
52
+ if (key === '_parent') {
53
+ continue;
54
+ }
51
55
  if (data[key] instanceof Array) {
52
56
  for (const item of data[key]) {
53
57
  const result = this.findParent(child, item, data);
@@ -104,7 +108,7 @@ export default {
104
108
  },
105
109
  });
106
110
  },
107
- initialValue(component, dataFormat) {
111
+ initialValue(component, dataFormat, config) {
108
112
  let value = null;
109
113
  if (component === 'FormInput') {
110
114
  if (stringFormats.includes(dataFormat)) {
@@ -114,6 +118,10 @@ export default {
114
118
  }
115
119
  } else if (component === 'FormTextArea') {
116
120
  value = '';
121
+ } else if (component === 'FormSelectList' && config.options.allowMultiSelect) {
122
+ value = [];
123
+ } else if (component === 'FormSelectList' && !config.options.allowMultiSelect) {
124
+ value = null;
117
125
  }
118
126
  return value;
119
127
  },
@@ -3,7 +3,7 @@ import { debounce } from 'lodash';
3
3
 
4
4
  export default {
5
5
  mounted() {
6
- this.refreshValidationRulesByName = debounce(this.refreshValidationRulesByName, 300);
6
+ this.refreshValidationRulesByName = debounce(this.refreshValidationRulesByName, 1000);
7
7
 
8
8
  this.$root.$on('refresh-validation-rules', () => {
9
9
  this.loadValidationRules();
@@ -28,7 +28,9 @@ export default {
28
28
  const data = Object.assign({ _parent: this._parent }, this.vdata);
29
29
  const isVisible = !!Parser.evaluate(rule, Object.assign({}, data));
30
30
 
31
- this.refreshValidationRulesByName(fieldName, isVisible);
31
+ window.setTimeout(() => {
32
+ this.refreshValidationRulesByName(fieldName, isVisible);
33
+ }, 1000);
32
34
  return isVisible;
33
35
  } catch (e) {
34
36
  return false;
@@ -10,7 +10,7 @@ export default {
10
10
  this.addData(screen, v.name, `
11
11
  this.getValue(${JSON.stringify(v.name)}, this.vdata) ||
12
12
  this.getValue(${JSON.stringify(v.name)}, data) ||
13
- this.initialValue('${component}', '${dataFormat}')
13
+ this.initialValue('${component}', '${dataFormat}', ${JSON.stringify(v.config)})
14
14
  `);
15
15
  this.addWatch(screen, v.name, `this.setValue(${JSON.stringify(v.name)}, value, this.vdata);`);
16
16
  this.addWatch(screen, `vdata.${v.name}`, `this.${v.name} = this.vdata.${v.name};`);
@@ -26,7 +26,7 @@ export default {
26
26
  }
27
27
  });
28
28
  },
29
- loadFieldProperties({ properties, element, componentName, definition , formIndex}) {
29
+ loadFieldProperties({ properties, element, componentName, definition , formIndex, screen}) {
30
30
  properties.class = this.elementCssClass(element);
31
31
  properties[':validation-data'] = 'getValidationData()';
32
32
 
@@ -38,7 +38,19 @@ export default {
38
38
  properties[':image'] = this.byRef(element.config.image);
39
39
  } else if (this.validVariableName(element.config.name)) {
40
40
  this.registerVariable(element.config.name, element);
41
- properties['v-model'] = `${element.config.name}`;
41
+ // v-model are not assigned directly to the field name, to prevent invalid references like:
42
+ // `person.content` when `person`=null
43
+ const computed_property = `computedProxy__${element.config.name.split('.').join('_DOT_')}`;
44
+ properties['v-model'] = computed_property;
45
+ screen.computed[computed_property] = {
46
+ get() {
47
+ return this.getValue(element.config.name);
48
+ },
49
+ set(value) {
50
+ this.setValue(element.config.name, value);
51
+ return true;
52
+ },
53
+ };
42
54
  }
43
55
  }
44
56
  // Do not replace mustache in RichText control, it is replaced by the control