@processmaker/screen-builder 2.5.21 → 2.5.25

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.
@@ -20,15 +20,15 @@ export default {
20
20
  }
21
21
  // Update vdata
22
22
  this.addMounted(screen, `
23
- this.setValue(${JSON.stringify(name)}, this.${name}, this.vdata, this);
23
+ this.setValue(${JSON.stringify(name)}, this.getValue(${JSON.stringify(name)}), this.vdata, this);
24
24
  `);
25
25
  });
26
26
  },
27
27
  setupDefaultValue(screen, name, value) {
28
28
  const defaultComputedName = `default_${name}__`;
29
- this.addData(screen, `${name}_was_filled__`, `!!this.getValue(${JSON.stringify(name)}, this.vdata)`);
29
+ this.addData(screen, `${name}_was_filled__`, `!!this.getValue(${JSON.stringify(name)}, this.vdata) || !!this.getValue(${JSON.stringify(name)}, data)`);
30
30
  this.addMounted(screen, `if (!this.${name}) {
31
- this.tryFormField(${JSON.stringify(name)}, () => {this.${name} = ${value};});
31
+ this.tryFormField(${JSON.stringify(name)}, () => {this.${this.dot2bracket(name)} = ${value};});
32
32
  }`);
33
33
  screen.computed[defaultComputedName] = {
34
34
  get: new Function(`return this.tryFormField(${JSON.stringify(name)}, () => ${value});`),
@@ -46,7 +46,7 @@ export default {
46
46
  const name = element.config.name;
47
47
  if (this.isComputedVariable(name, definition)) return;
48
48
  if (element.config.defaultValue || element.config.initiallyChecked) {
49
- const event = `${name}_was_filled__ |= !!$event; !${name}_was_filled__ && (vdata.${name} = default_${name}__)`;
49
+ const event = `${name}_was_filled__ |= !!$event; !${name}_was_filled__ && (vdata.${this.dot2bracket(name)} = default_${name}__)`;
50
50
  this.addEvent(properties, 'input', event);
51
51
  }
52
52
  },
@@ -25,6 +25,7 @@ export default {
25
25
  items: element.items,
26
26
  },
27
27
  ],
28
+ watchers: definition.watchers,
28
29
  };
29
30
 
30
31
  let loopContext = '';
@@ -2,17 +2,24 @@ import watchersMixin from '../../mixins/watchers';
2
2
 
3
3
  export default {
4
4
  methods: {
5
+ filterWatchers(watcher) {
6
+ const inContext = !watcher.watching || this.variables.find(({name}) => name === watcher.watching);
7
+ return inContext;
8
+ },
5
9
  addWatcherVariables(definition) {
6
10
  if (definition.watchers) {
7
- definition.watchers.forEach((watcher) => {
8
- this.registerVariable(watcher.output_variable, {});
11
+ definition.watchers.filter(this.filterWatchers).forEach((watcher) => {
12
+ const inContext = !watcher.watching || this.variables.find(({name}) => name === watcher.watching);
13
+ if (inContext) {
14
+ this.registerVariable(watcher.output_variable, {});
15
+ }
9
16
  });
10
17
  }
11
18
  },
12
19
  watchers(screen, definition) {
13
20
  if (definition.watchers) {
14
21
  screen.mixins.push(watchersMixin);
15
- definition.watchers.forEach((watcher) => {
22
+ definition.watchers.filter(this.filterWatchers).forEach((watcher) => {
16
23
  this.addMounted(screen, `
17
24
  this.$nextTick(() => this.$watch('${watcher.watching}', (newValue) => {
18
25
  if (typeof newValue !== 'undefined') {