@processmaker/screen-builder 3.0.3 → 3.0.5

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.0.3",
3
+ "version": "3.0.5",
4
4
  "scripts": {
5
5
  "dev": "VITE_COVERAGE=true vite",
6
6
  "build": "vite build",
@@ -57,7 +57,7 @@
57
57
  "@fortawesome/fontawesome-free": "^5.6.1",
58
58
  "@originjs/vite-plugin-commonjs": "^1.0.3",
59
59
  "@panter/vue-i18next": "^0.15.2",
60
- "@processmaker/vue-form-elements": "0.61.1",
60
+ "@processmaker/vue-form-elements": "0.61.2",
61
61
  "@processmaker/vue-multiselect": "2.3.0",
62
62
  "@storybook/addon-essentials": "^7.6.13",
63
63
  "@storybook/addon-interactions": "^7.6.13",
@@ -116,7 +116,7 @@
116
116
  },
117
117
  "peerDependencies": {
118
118
  "@panter/vue-i18next": "^0.15.0",
119
- "@processmaker/vue-form-elements": "0.61.1",
119
+ "@processmaker/vue-form-elements": "0.61.2",
120
120
  "i18next": "^15.0.8",
121
121
  "vue": "^2.6.12",
122
122
  "vuex": "^3.1.1"
package/src/App.vue CHANGED
@@ -114,6 +114,7 @@
114
114
  title="Default"
115
115
  :render-controls="displayBuilder"
116
116
  @change="updateConfig"
117
+ :screen-type="displayType"
117
118
  >
118
119
  <default-loading-spinner />
119
120
  </vue-form-builder>
@@ -448,6 +449,7 @@ export default {
448
449
  },
449
450
  showTemplatesPanel: false,
450
451
  sharedTemplatesData: null,
452
+ displayType: 'form'
451
453
  };
452
454
  },
453
455
  computed: {
@@ -1,6 +1,11 @@
1
1
  <template>
2
2
  <div class="column-draggable" :selector="config.customCssSelector">
3
- <draggable style="min-height: 80px" :list="items" group="controls">
3
+ <draggable
4
+ style="min-height: 80px"
5
+ :list="items"
6
+ group="controls"
7
+ @change="onChange"
8
+ >
4
9
  <div
5
10
  v-for="(element, index) in items"
6
11
  :key="index"
@@ -28,7 +33,7 @@
28
33
  />
29
34
  {{ element.config.name || $t("Variable Name") }}
30
35
  <b-badge
31
- v-if="isInClipboard(items[index])"
36
+ v-if="isInClipboard(items[index]) && screenType === 'form'"
32
37
  data-cy="copied-badge"
33
38
  class="m-2 custom-badge"
34
39
  pill
@@ -38,6 +43,7 @@
38
43
  </b-badge>
39
44
  <div class="ml-auto">
40
45
  <clipboard-button
46
+ v-if="screenType === 'form'"
41
47
  :index="index"
42
48
  :config="element.config"
43
49
  :isInClipboard="isInClipboard(items[index])"
@@ -83,6 +89,7 @@
83
89
  :config="element.config"
84
90
  @inspect="inspect"
85
91
  @update-state="$emit('update-state')"
92
+ :screen-type="screenType"
86
93
  />
87
94
  </div>
88
95
  </div>
@@ -101,7 +108,7 @@
101
108
  />
102
109
  {{ element.config.name || $t("Variable Name") }}
103
110
  <b-badge
104
- v-if="isInClipboard(items[index])"
111
+ v-if="isInClipboard(items[index]) && screenType === 'form'"
105
112
  data-cy="copied-badge"
106
113
  class="m-2 custom-badge"
107
114
  pill
@@ -111,6 +118,7 @@
111
118
  </b-badge>
112
119
  <div class="ml-auto">
113
120
  <clipboard-button
121
+ v-if="screenType === 'form'"
114
122
  :index="index"
115
123
  :config="element.config"
116
124
  :isInClipboard="isInClipboard(items[index])"
@@ -146,6 +154,7 @@
146
154
  ]"
147
155
  :tabindex="element.config.interactive ? 0 : -1"
148
156
  :config="element.config"
157
+ :screen-type="screenType"
149
158
  @input="
150
159
  element.config.interactive
151
160
  ? (element.config.content = $event)
@@ -191,7 +200,7 @@ export default {
191
200
  ...renderer
192
201
  },
193
202
  mixins: [HasColorProperty, Clipboard],
194
- props: ["value", "name", "config", "selected", "validationErrors"],
203
+ props: ["value", "name", "config", "selected", "validationErrors", "screenType"],
195
204
  data() {
196
205
  return {
197
206
  items: [],
@@ -276,7 +285,13 @@ export default {
276
285
  this.$set(item.config.aiConfig, "progress", progress);
277
286
  }
278
287
  });
279
- }
288
+ },
289
+ /**
290
+ * Triggered when the draggable container is changed.
291
+ */
292
+ onChange(e) {
293
+ this.$emit("update-state");
294
+ },
280
295
  }
281
296
  };
282
297
  </script>
@@ -43,7 +43,7 @@
43
43
  />
44
44
  {{ element.config.name || $t("Variable Name") }}
45
45
  <b-badge
46
- v-if="isInClipboard(element)"
46
+ v-if="isInClipboard(element) && screenType === 'form'"
47
47
  data-cy="copied-badge"
48
48
  class="m-2 custom-badge"
49
49
  pill
@@ -53,6 +53,7 @@
53
53
  </b-badge>
54
54
  <div class="ml-auto">
55
55
  <clipboard-button
56
+ v-if="screenType === 'form'"
56
57
  :index="index"
57
58
  :config="element.config"
58
59
  :isInClipboard="isInClipboard(element)"
@@ -95,6 +96,7 @@
95
96
  :selected="selected"
96
97
  :ai-element="element"
97
98
  :config="element.config"
99
+ :screen-type="screenType"
98
100
  @inspect="inspect"
99
101
  @update-state="$emit('update-state')"
100
102
  />
@@ -118,7 +120,7 @@
118
120
  />
119
121
  {{ element.config.name || $t("Variable Name") }}
120
122
  <b-badge
121
- v-if="isInClipboard(element)"
123
+ v-if="isInClipboard(element) && screenType === 'form'"
122
124
  data-cy="copied-badge"
123
125
  class="m-2 custom-badge"
124
126
  pill
@@ -128,6 +130,7 @@
128
130
  </b-badge>
129
131
  <div class="ml-auto">
130
132
  <clipboard-button
133
+ v-if="screenType === 'form'"
131
134
  :index="index"
132
135
  :config="element.config"
133
136
  :isInClipboard="isInClipboard(element)"
@@ -163,6 +166,7 @@
163
166
  ]"
164
167
  :tabindex="element.config.interactive ? 0 : -1"
165
168
  :config="element.config"
169
+ :screen-type="screenType"
166
170
  @input="
167
171
  element.config.interactive
168
172
  ? (element.config.content = $event)
@@ -212,7 +216,7 @@ export default {
212
216
  ...renderer
213
217
  },
214
218
  mixins: [HasColorProperty, Clipboard],
215
- props: ["value", "name", "config", "selected", "validationErrors"],
219
+ props: ["value", "name", "config", "selected", "validationErrors", "screenType"],
216
220
  data() {
217
221
  return {
218
222
  items: [],
@@ -1,13 +1,18 @@
1
1
  <template>
2
2
  <div>
3
3
  <div>
4
- <label for="collection">{{ $t("Collection") }}</label>
5
- <b-form-select
6
- id="collection"
7
- v-model="collectionId"
8
- :options="collections"
9
- data-cy="inspector-collection"
10
- />
4
+ <label for="collection">{{ $t("Collection Name") }}</label>
5
+ <b-form-group>
6
+ <b-form-select
7
+ id="collection"
8
+ v-model="collectionId"
9
+ :options="collections"
10
+ data-cy="inspector-collection"
11
+ />
12
+ <b-form-text class="mt-2">
13
+ {{ $t("Collection Record Control is not available for Anonymous Web Entry") }}
14
+ </b-form-text>
15
+ </b-form-group>
11
16
  </div>
12
17
  <div v-if="collectionId > 0" class="screen-link mt-2">
13
18
  <a
@@ -61,7 +61,8 @@ export default {
61
61
  screenType: "",
62
62
  hasMustache: false,
63
63
  flagDraft: {},
64
- taskDraft: {}
64
+ taskDraft: {},
65
+ enableDraft: true
65
66
  };
66
67
  },
67
68
  computed: {
@@ -167,7 +168,6 @@ export default {
167
168
  this.selCollectionId = collectionId;
168
169
  this.selRecordId = recordId;
169
170
  this.selDisplayMode = modeId;
170
-
171
171
  this.$dataProvider
172
172
  .getCollectionRecordsView(collectionId, recordId)
173
173
  .then((response) => {
@@ -176,22 +176,25 @@ export default {
176
176
  const viewScreen = response.collection.read_screen_id;
177
177
  const editScreen = response.collection.update_screen_id;
178
178
  //Choose screen id regarding of the display Mode
179
- this.screenCollectionId =
180
- this.selDisplayMode === "View" ? viewScreen : editScreen;
181
-
179
+ this.screenCollectionId =
180
+ typeof this.selDisplayMode === 'function' ?
181
+ (this.collectionmode.modeId === "View" ? viewScreen : editScreen) :
182
+ (this.selDisplayMode === "View" ? viewScreen : editScreen);
182
183
  this.loadScreen(this.screenCollectionId);
183
184
 
184
185
  //This section validates if Collection has draft data
185
- if(this.taskDraft?.draft?.data == null || this.taskDraft.draft.data === '') {
186
+ if (this.taskDraft?.draft?.data == null || this.taskDraft.draft.data === '' || !this.enableDraft)
187
+ {
186
188
  this.localData = respData;
187
189
  }else{
188
190
  this.localData = _.merge({}, respData, this.taskDraft.draft.data);
189
191
  }
190
-
192
+
191
193
  })
192
194
  .catch(() => {
193
195
  this.localData = {};
194
196
  globalObject.ProcessMaker.alert(this.$t('This content does not exist. We could not locate indicated data'), "danger");
197
+ this.placeholder = "Select a collection";
195
198
  });;
196
199
  },
197
200
  isMustache(record) {
@@ -213,6 +216,7 @@ export default {
213
216
  },
214
217
  record(record) {
215
218
  this.hasMustache = false;
219
+ this.enableDraft = false;
216
220
  if (record && !isNaN(record) && record > 0 && this.collection.collectionId) {
217
221
  this.selRecordId = record;
218
222
  this.loadRecordCollection(this.collection.collectionId, record, this.selDisplayMode);
@@ -160,12 +160,12 @@ export default {
160
160
  },
161
161
  watch: {
162
162
  listOption() {
163
- this.title = this.checkTitle(this.listOption);
163
+ this.title = this.$t(this.checkTitle(this.listOption));
164
164
  this.dataControl = {};
165
165
  }
166
166
  },
167
167
  mounted() {
168
- this.title = this.checkTitle(this.listOption);
168
+ this.title = this.$t(this.checkTitle(this.listOption));
169
169
  },
170
170
  methods: {
171
171
  /**
@@ -17,7 +17,7 @@
17
17
  </div>
18
18
  </div>
19
19
  <div v-else>
20
- <formEmpty link="" title="No Case to Start" url="" />
20
+ <formEmpty link="" :title="$t('No Case to Start')" url="" />
21
21
  </div>
22
22
  </div>
23
23
  </template>
@@ -431,20 +431,22 @@ export default {
431
431
  }
432
432
 
433
433
  // Adds radio buttons or checkbox to the table depending selected option
434
- if (['single-field', 'single-record'].includes(this.source?.dataSelectionOptions)) {
435
- fields.unshift({
436
- key: 'radio',
437
- label: '',
438
- sortable: false,
439
- });
440
- }
441
-
442
- if (this.source?.dataSelectionOptions === 'multiple-records') {
443
- fields.unshift({
444
- key: 'checkbox',
445
- label: '',
446
- sortable: false
447
- });
434
+ if(this.source?.sourceOptions === "Collection") {
435
+ if (['single-field', 'single-record'].includes(this.source?.dataSelectionOptions)) {
436
+ fields.unshift({
437
+ key: 'radio',
438
+ label: '',
439
+ sortable: false,
440
+ });
441
+ }
442
+
443
+ if (this.source?.dataSelectionOptions === 'multiple-records') {
444
+ fields.unshift({
445
+ key: 'checkbox',
446
+ label: '',
447
+ sortable: false
448
+ });
449
+ }
448
450
  }
449
451
 
450
452
  return fields;
@@ -70,7 +70,7 @@
70
70
  </filter-table>
71
71
  </div>
72
72
  <div v-else>
73
- <formEmpty link="Requests" title="No Cases to Show" :url="noDataUrl" />
73
+ <formEmpty link="Requests" :title="$t('No Cases to Show')" :url="noDataUrl" />
74
74
  </div>
75
75
  </template>
76
76
 
@@ -203,7 +203,7 @@
203
203
  />
204
204
  {{ element.config.name || element.label || $t("Field Name") }}
205
205
  <b-badge
206
- v-if="!isClipboardPage(tabPage) && isInClipboard(extendedPages[tabPage].items[index])"
206
+ v-if="!isClipboardPage(tabPage) && isInClipboard(extendedPages[tabPage].items[index]) && screenType === 'form'"
207
207
  data-cy="copied-badge"
208
208
  class="m-2 custom-badge"
209
209
  pill
@@ -213,7 +213,7 @@
213
213
  </b-badge>
214
214
  <div class="ml-auto">
215
215
  <clipboard-button
216
- v-if="!isClipboardPage(tabPage)"
216
+ v-if="!isClipboardPage(tabPage) && screenType === 'form'"
217
217
  :index="index"
218
218
  :config="element.config"
219
219
  :isInClipboard="isInClipboard(extendedPages[tabPage].items[index])"
@@ -261,6 +261,7 @@
261
261
  :selected="selected"
262
262
  :config="element.config"
263
263
  :ai-element="element"
264
+ :screen-type="screenType"
264
265
  @inspect="inspect"
265
266
  @update-state="updateState"
266
267
  />
@@ -279,7 +280,7 @@
279
280
  />
280
281
  {{ element.config.name || $t("Variable Name") }}
281
282
  <b-badge
282
- v-if="!isClipboardPage(tabPage) && isInClipboard(extendedPages[tabPage].items[index])"
283
+ v-if="!isClipboardPage(tabPage) && isInClipboard(extendedPages[tabPage].items[index]) && screenType === 'form'"
283
284
  data-cy="copied-badge"
284
285
  class="m-2 custom-badge"
285
286
  pill
@@ -289,7 +290,7 @@
289
290
  </b-badge>
290
291
  <div class="ml-auto">
291
292
  <clipboard-button
292
- v-if="!isClipboardPage(tabPage)"
293
+ v-if="!isClipboardPage(tabPage) && screenType === 'form'"
293
294
  :index="index"
294
295
  :config="element.config"
295
296
  :isInClipboard="isInClipboard(extendedPages[tabPage].items[index])"
@@ -325,12 +326,14 @@
325
326
  : elementCssClass(element),
326
327
  { 'prevent-interaction': !element.config.interactive }
327
328
  ]"
329
+ :screen-type="screenType"
328
330
  @input="
329
331
  element.config.interactive
330
332
  ? (element.config.content = $event)
331
333
  : null
332
334
  "
333
335
  @focusout.native="updateState"
336
+
334
337
  />
335
338
  </div>
336
339
  </div>
@@ -481,6 +481,15 @@ export default [
481
481
  jsonData: '',
482
482
  },
483
483
  form: '',
484
+ source: {
485
+ collectionFields: [],
486
+ collectionFieldsColumns: [],
487
+ pmql: null,
488
+ sourceOptions: "Variable",
489
+ variableStore: null,
490
+ dataSelectionOptions: "no-selection",
491
+ singleField: null
492
+ }
484
493
  },
485
494
  inspector: [
486
495
  keyNameProperty,
@@ -108,22 +108,45 @@ export default {
108
108
  }
109
109
 
110
110
  const replaceInPage = (page) => {
111
- page.items.forEach((item, index) => {
112
- if (item.component === clipboardComponentName) {
113
- // clone clipboard content to avoid modifying the original
114
- const clipboardContent = _.cloneDeep(this.$store.getters["clipboardModule/clipboardItems"]);
115
- // replace uuids in clipboard content
116
- clipboardContent.forEach(this.updateUuids);
117
- page.items.splice(index, 1, ...clipboardContent);
118
- if (clipboardContent.length) {
119
- window.ProcessMaker.alert(this.$t("Clipboard Pasted Succesfully"), "success");
120
- }
121
- }
122
- if (item.items) {
123
- replaceInPage(item);
124
- }
125
- });
126
- }
111
+ const processItems = (items) => {
112
+ items.forEach((item, index) => {
113
+ // Recursively process nested arrays
114
+ if (Array.isArray(item)) {
115
+ return processItems(item);
116
+ }
117
+
118
+ // Replace clipboard component with clipboard content
119
+ if (item.component === clipboardComponentName) {
120
+ // Clone clipboard content to avoid modifying original data
121
+ const clipboardContent = _.cloneDeep(this.$store.getters["clipboardModule/clipboardItems"]);
122
+
123
+ // Update UUIDs in clipboard content to prevent duplicate IDs
124
+ clipboardContent.forEach(this.updateUuids);
125
+
126
+ // Replace the clipboard component with the clipboard content
127
+ items.splice(index, 1, ...clipboardContent);
128
+
129
+ // Show success message if clipboard content is present
130
+ if (clipboardContent.length > 0) {
131
+ window.ProcessMaker.alert(this.$t("Clipboard Pasted Successfully"), "success");
132
+ }
133
+ }
134
+
135
+ // Process nested items recursively
136
+ if (item.items) {
137
+ processItems(item.items);
138
+ }
139
+ });
140
+ };
141
+
142
+ // Initiate the processing of page items
143
+ if (page && Array.isArray(page.items)) {
144
+ processItems(page.items);
145
+ } else {
146
+ console.warn("Invalid page structure or no items to process.");
147
+ }
148
+ };
149
+
127
150
  screenConfig.forEach((item) => replaceInPage(item));
128
151
  },
129
152