@processmaker/screen-builder 2.61.0 → 2.62.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.61.0",
3
+ "version": "2.62.1",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
package/src/.DS_Store CHANGED
Binary file
@@ -246,11 +246,9 @@ export default {
246
246
  return;
247
247
  }
248
248
 
249
- this.$set(
250
- object,
251
- attr,
252
- setValue,
253
- );
249
+ if (object instanceof Object) {
250
+ this.$set(object, attr, setValue);
251
+ }
254
252
 
255
253
  object = get(object, attr);
256
254
  defaults = get(defaults, attr);
@@ -31,14 +31,22 @@ function countErrors(obj) {
31
31
  return errors;
32
32
  }
33
33
 
34
- const updateValidationRules = async (screen, commit) => {
35
- const mainScreen = findRootScreen(screen);
34
+ const updateValidationRules = async (screens, commit) => {
35
+ const rootScreen = findRootScreen(screens[0]);
36
+ const awaitLoad = [];
37
+ screens.forEach((screen) => {
38
+ if (rootScreen !== screen) {
39
+ // refresh nested screen validation rules
40
+ awaitLoad.push(screen.loadValidationRules());
41
+ }
42
+ });
43
+ await Promise.all(awaitLoad);
36
44
  try {
37
- await mainScreen.loadValidationRules();
45
+ await rootScreen.loadValidationRules();
38
46
  } catch (error) {
39
47
  console.warn("There was a problem rendering the screen", error);
40
48
  }
41
- const validate = mainScreen.$v;
49
+ const validate = rootScreen.$v;
42
50
  // update the global error state used by submit buttons
43
51
  if (validate) {
44
52
  let errors = 0;
@@ -50,7 +58,7 @@ const updateValidationRules = async (screen, commit) => {
50
58
  errors === 1
51
59
  ? "There is a validation error in your form."
52
60
  : "There are {{items}} validation errors in your form.";
53
- message = mainScreen.$t(message, { items: errors });
61
+ message = rootScreen.$t(message, { items: errors });
54
62
  }
55
63
  commit("basic", {
56
64
  key: "valid",
@@ -63,7 +71,15 @@ const updateValidationRules = async (screen, commit) => {
63
71
  }
64
72
  };
65
73
 
66
- const updateValidationRulesDebounced = debounce(updateValidationRules, 1000);
74
+ const updateValidationRulesDebounced = debounce(updateValidationRules, 500);
75
+
76
+ const screensToValidate = [];
77
+ const queueUpdateValidationRules = (mainScreen, commit) => {
78
+ if (!screensToValidate.includes(mainScreen)) {
79
+ screensToValidate.push(mainScreen);
80
+ }
81
+ updateValidationRulesDebounced(screensToValidate, commit);
82
+ };
67
83
 
68
84
  const globalErrorsModule = {
69
85
  namespaced,
@@ -96,14 +112,14 @@ const globalErrorsModule = {
96
112
  },
97
113
  actions: {
98
114
  validate({ commit }, mainScreen) {
99
- updateValidationRulesDebounced(mainScreen, commit);
115
+ queueUpdateValidationRules(mainScreen, commit);
100
116
  },
101
117
  async validateNow({ commit }, mainScreen) {
102
- await updateValidationRules(mainScreen, commit);
118
+ await updateValidationRules([mainScreen], commit);
103
119
  },
104
120
  close({ commit }) {
105
121
  commit("basic", { key: "valid", value: true });
106
- },
122
+ }
107
123
  }
108
124
  };
109
125