@processmaker/screen-builder 3.3.0 → 3.3.2

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": "3.3.0",
3
+ "version": "3.3.2",
4
4
  "scripts": {
5
5
  "dev": "VITE_COVERAGE=true vite",
6
6
  "build": "vite build",
@@ -41,23 +41,37 @@ export default {
41
41
  data() {
42
42
  return {
43
43
  mode: "",
44
- submitCollectionCheck: null
44
+ submitCollectionCheck: null,
45
+ defaultMode: 'Edit',
45
46
  };
46
47
  },
47
48
  computed: {
48
49
  showCollectionCheck() {
49
- return this.mode === "Edit";
50
+ return this.mode === this.defaultMode;
51
+ }
52
+ },
53
+ watch: {
54
+ value: {
55
+ handler(newValue) {
56
+ this.updateModeAndCollectionCheck(newValue);
57
+ },
58
+ deep: true,
50
59
  }
51
60
  },
52
61
  mounted() {
53
- // Set the defaulta data
54
- this.mode = this.value.modeId || "Edit";
55
- this.submitCollectionCheck =
56
- this.value.submitCollectionCheck !== undefined
57
- ? this.value.submitCollectionCheck
58
- : true;
62
+ // Set the default data
63
+ this.updateModeAndCollectionCheck(this.value);
59
64
  },
60
65
  methods: {
66
+ /**
67
+ * Update the mode and collection check value
68
+ *
69
+ * @param {Object} value
70
+ */
71
+ updateModeAndCollectionCheck(value) {
72
+ this.mode = value.modeId || this.defaultMode;
73
+ this.submitCollectionCheck = value.submitCollectionCheck ?? true;
74
+ },
61
75
  saveFields() {
62
76
  this.$emit("input", {
63
77
  modeId: this.mode,
@@ -10,15 +10,15 @@
10
10
  data-cy="inspector-collection"
11
11
  />
12
12
  <b-form-text class="mt-2">
13
- {{ $t("Collection Record Control is not available for Anonymous Web Entry") }}
13
+ {{ $t("Collection Record Control is not available for Anonymous Web Entry") }}
14
14
  </b-form-text>
15
15
  </b-form-group>
16
16
  </div>
17
17
  <div v-if="collectionId > 0" class="screen-link mt-2">
18
- <a
18
+ <a
19
19
  :href="`/designer/screen-builder/${
20
20
  screenMode === 'display' ? idCollectionScreenView : idCollectionScreenEdit
21
- }/edit`"
21
+ }/edit`"
22
22
  target="_blank">
23
23
  {{ $t(screenMode === 'display' ? "Open View Screen" : "Open Edit Screen") }}
24
24
  <i class="ml-1 fas fa-external-link-alt" />
@@ -67,11 +67,15 @@ export default {
67
67
  },
68
68
  watch: {
69
69
  value: {
70
- handler(value) {
71
- if (!value) {
70
+ handler(newValue) {
71
+ if (!newValue) {
72
+ // Clear collection id
73
+ this.collectionId = null;
74
+
72
75
  return;
73
76
  }
74
- CONFIG_FIELDS.forEach((field) => (this[field] = value[field]));
77
+
78
+ CONFIG_FIELDS.forEach((field) => (this[field] = newValue[field]));
75
79
  },
76
80
  immediate: true
77
81
  },
@@ -63,7 +63,8 @@ export default {
63
63
  flagDraft: {},
64
64
  taskDraft: {},
65
65
  enableDraft: true,
66
- defaultColumnsRecordId: 1
66
+ defaultColumnsRecordId: 1,
67
+ defaultCollectionMode: 'Edit',
67
68
  };
68
69
  },
69
70
  computed: {
@@ -148,13 +149,17 @@ export default {
148
149
  const recordId = this.isMustache(this.record)
149
150
  ? this.defaultColumnsRecordId
150
151
  : this.record;
152
+
151
153
  if (this.isMustache(this.record)) {
152
154
  this.hasMustache = true;
153
155
  }
156
+
157
+ const collectionMode = this.collectionmode?.modeId ?? this.defaultCollectionMode;
158
+
154
159
  this.loadRecordCollection(
155
160
  this.collection.collectionId,
156
161
  recordId,
157
- this.collectionmode.modeId
162
+ collectionMode,
158
163
  );
159
164
  }
160
165
  },
@@ -1132,6 +1132,10 @@ export default [
1132
1132
  name: 'Collection Record Control',
1133
1133
  icon: 'fas fa-database',
1134
1134
  label: 'Collection Record Control',
1135
+ collectionmode: {
1136
+ modeId: 'Edit',
1137
+ submitCollectionCheck: true
1138
+ }
1135
1139
  },
1136
1140
  inspector: [
1137
1141
  {