@processmaker/screen-builder 2.5.20 → 2.5.24

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-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@processmaker/screen-builder",
3
- "version": "2.5.20",
3
+ "version": "2.5.24",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
@@ -2165,9 +2165,9 @@
2165
2165
  }
2166
2166
  },
2167
2167
  "@processmaker/vue-form-elements": {
2168
- "version": "0.18.4-H",
2169
- "resolved": "https://registry.npmjs.org/@processmaker/vue-form-elements/-/vue-form-elements-0.18.4-H.tgz",
2170
- "integrity": "sha512-imuL1cPdPfXEzjz5Qe+uBNpdMxDRYUMGVSx+p/XQSM/2XaBfZvV3gZPKrYCDbw4MPyzhOIGprLcF6AUfU+Wq9g==",
2168
+ "version": "0.18.4-M",
2169
+ "resolved": "https://registry.npmjs.org/@processmaker/vue-form-elements/-/vue-form-elements-0.18.4-M.tgz",
2170
+ "integrity": "sha512-VWdG1T8DYhzJalYBP4qljVPfM9T5Fw8kmUKVznAXvBT9SOh1GqekQeO9iXcdOiDsuQGHiozhwyAYwC/ibavkuw==",
2171
2171
  "dev": true,
2172
2172
  "requires": {
2173
2173
  "@tinymce/tinymce-vue": "2.0.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@processmaker/screen-builder",
3
- "version": "2.5.20",
3
+ "version": "2.5.24",
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-H",
47
+ "@processmaker/vue-form-elements": "0.18.4-M",
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",
@@ -83,7 +83,7 @@
83
83
  },
84
84
  "peerDependencies": {
85
85
  "@panter/vue-i18next": "^0.15.0",
86
- "@processmaker/vue-form-elements": "0.18.4-H",
86
+ "@processmaker/vue-form-elements": "0.18.4-M",
87
87
  "i18next": "^15.0.8",
88
88
  "vue": "^2.6.12",
89
89
  "vuex": "^3.1.1"
@@ -139,7 +139,7 @@ class PageNavigateValidations extends Validations {
139
139
  if (!this.isVisible()) {
140
140
  return;
141
141
  }
142
- if (!this.screen.pagesValidated.includes(parseInt(this.element.config.eventData))) {
142
+ if (this.screen.pagesValidated && !this.screen.pagesValidated.includes(parseInt(this.element.config.eventData))) {
143
143
  this.screen.pagesValidated.push(parseInt(this.element.config.eventData));
144
144
  if (this.screen.config[this.element.config.eventData] && this.screen.config[this.element.config.eventData].items) {
145
145
  await ValidationsFactory(this.screen.config[this.element.config.eventData].items, { screen: this.screen, data: this.data }).addValidations(validations);
@@ -186,7 +186,7 @@
186
186
  <small class="form-text text-muted mb-3">{{ $t("Select 'Single Value' to use parts of the selected object. Select 'Object' to use the entire selected value.") }}</small>
187
187
 
188
188
  <div v-if="dataSource === dataSourceValues.dataConnector">
189
- <div v-if="valueTypeReturned === 'single'">
189
+ <div>
190
190
  <label for="key">{{ $t('Value') }}</label>
191
191
  <mustache-helper/>
192
192
  <b-form-input id="key" v-model="key" @change="keyChanged" data-cy="inspector-datasource-value"/>
@@ -196,7 +196,7 @@
196
196
  <label for="value">{{ $t('Content') }}</label>
197
197
  <mustache-helper/>
198
198
  <b-form-input id="value" v-model="value" @change="valueChanged" data-cy="inspector-datasource-content"/>
199
- <small class="form-text text-muted mb-3">{{ $t('Key name in the selected object to display to the user in the select list. Leave blank to show the entire selected value.') }}</small>
199
+ <small class="form-text text-muted mb-3">{{ $t('Content to display to the user in the select list.') }}</small>
200
200
  </div>
201
201
 
202
202
  <div v-if="valueTypeReturned === 'single' && dataSource === dataSourceValues.dataObject">
@@ -49,6 +49,10 @@ export default {
49
49
  };
50
50
  },
51
51
  methods: {
52
+ // Convert foo.0.bar to foo[0].bar
53
+ dot2bracket(str) {
54
+ return str.replace(/\.\d/g, match => `[${match.substr(1)}]`);
55
+ },
52
56
  submit() {
53
57
  this.$emit('submit', this.value);
54
58
  },
@@ -327,7 +331,9 @@ export default {
327
331
  }
328
332
  this.ValidationRules__ = validations;
329
333
  this.$nextTick(() => {
330
- this.$v.$touch();
334
+ if (this.$v) {
335
+ this.$v.$touch();
336
+ }
331
337
  });
332
338
  });
333
339
  };
@@ -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') {