@processmaker/screen-builder 3.0.5 → 3.0.7

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.5",
3
+ "version": "3.0.7",
4
4
  "scripts": {
5
5
  "dev": "VITE_COVERAGE=true vite",
6
6
  "build": "vite build",
@@ -62,7 +62,7 @@
62
62
  </button>
63
63
  <button
64
64
  v-if="!(isAiSection(element) && aiPreview(element))"
65
- class="btn btn-sm btn-secondary mr-2"
65
+ class="btn btn-sm btn-primary mr-2"
66
66
  :title="$t('Copy Control')"
67
67
  @click="duplicateItem(index)"
68
68
  >
@@ -128,7 +128,7 @@
128
128
  @removeFromClipboard="removeFromClipboard(items[index])"
129
129
  />
130
130
  <button
131
- class="btn btn-sm btn-secondary mr-2"
131
+ class="btn btn-sm btn-primary mr-2"
132
132
  :title="$t('Copy Control')"
133
133
  @click="duplicateItem(index)"
134
134
  >
@@ -72,7 +72,7 @@
72
72
  </button>
73
73
  <button
74
74
  v-if="!(isAiSection(element) && aiPreview(element))"
75
- class="btn btn-sm btn-secondary mr-2"
75
+ class="btn btn-sm btn-primary mr-2"
76
76
  :aria-label="$t('Duplicate')"
77
77
  @click="duplicateItem(index, row)"
78
78
  >
@@ -140,7 +140,7 @@
140
140
  @removeFromClipboard="removeFromClipboard(element)"
141
141
  />
142
142
  <button
143
- class="btn btn-sm btn-secondary mr-2"
143
+ class="btn btn-sm btn-primary mr-2"
144
144
  :title="$t('Copy Control')"
145
145
  @click="duplicateItem(index, row)"
146
146
  >
@@ -54,7 +54,8 @@ export default {
54
54
  dataRecordList: [],
55
55
  idCollectionScreenView: null,
56
56
  idCollectionScreenEdit: null,
57
- screenMode: null
57
+ screenMode: null,
58
+ collectionsMap: {}
58
59
  };
59
60
  },
60
61
  computed: {
@@ -76,6 +77,7 @@ export default {
76
77
  },
77
78
  collectionId: {
78
79
  handler() {
80
+ this.updateScreenIds();
79
81
  this.getFields();
80
82
  }
81
83
  },
@@ -114,17 +116,20 @@ export default {
114
116
  },
115
117
  getCollections() {
116
118
  this.$dataProvider.getCollections().then((response) => {
117
- const [firstItem = {}] = response.data.data || [];
118
- this.idCollectionScreenView = firstItem.read_screen_id;
119
- this.idCollectionScreenEdit = firstItem.create_screen_id;
119
+ this.collectionsMap = response.data.data.reduce((acc, collection) => {
120
+ acc[collection.id] = {
121
+ read_screen_id: collection.read_screen_id,
122
+ create_screen_id: collection.create_screen_id
123
+ };
124
+ return acc;
125
+ }, {});
126
+
120
127
  this.collections = [
121
128
  { value: null, text: this.$t("Select a collection") },
122
- ...response.data.data.map((collection) => {
123
- return {
124
- text: collection.name,
125
- value: collection.id
126
- };
127
- })
129
+ ...response.data.data.map((collection) => ({
130
+ text: collection.name,
131
+ value: collection.id
132
+ }))
128
133
  ];
129
134
  });
130
135
  },
@@ -155,6 +160,16 @@ export default {
155
160
  },
156
161
  onPmqlChange(pmql) {
157
162
  this.pmql = pmql;
163
+ },
164
+ updateScreenIds() {
165
+ if (this.collectionId && this.collectionsMap[this.collectionId]) {
166
+ const selectedCollection = this.collectionsMap[this.collectionId];
167
+ this.idCollectionScreenView = selectedCollection.read_screen_id;
168
+ this.idCollectionScreenEdit = selectedCollection.create_screen_id;
169
+ } else {
170
+ this.idCollectionScreenView = null;
171
+ this.idCollectionScreenEdit = null;
172
+ }
158
173
  }
159
174
  }
160
175
  };
@@ -192,7 +192,7 @@
192
192
  </div>
193
193
 
194
194
  <div v-if="dataSource === dataSourceValues.dataConnector">
195
- <div v-if="valueTypeReturned === 'single'">
195
+ <div v-if="valueTypeReturned === 'single' || valueTypeReturned === 'object' && $attrs['screen-type'] === 'conversational'">
196
196
  <label for="key">{{ $t('Value') }}</label>
197
197
  <mustache-helper/>
198
198
  <b-form-input id="key" v-model="key" @change="keyChanged" data-cy="inspector-datasource-value"/>
@@ -62,7 +62,8 @@ export default {
62
62
  hasMustache: false,
63
63
  flagDraft: {},
64
64
  taskDraft: {},
65
- enableDraft: true
65
+ enableDraft: true,
66
+ defaultColumnsRecordId: 1
66
67
  };
67
68
  },
68
69
  computed: {
@@ -80,7 +81,6 @@ export default {
80
81
  Object.keys(data).forEach((variable) => {
81
82
  this.validationData && this.$set(this.validationData, variable, data[variable]);
82
83
  });
83
-
84
84
  if (this.collection) {
85
85
  this.$set(this.collection, 'data', Array.isArray(data) ? data : [data]);
86
86
  this.$set(this.collection, 'screen', this.screenCollectionId);
@@ -140,7 +140,6 @@ export default {
140
140
  this.customCSS = null;
141
141
  this.watchers = [];
142
142
  this.screenTitle = null;
143
-
144
143
  if (id) {
145
144
  this.$dataProvider.getScreen(id).then((response) => {
146
145
  this.config = response.data.config;
@@ -212,6 +211,9 @@ export default {
212
211
  collection(collection) {
213
212
  if(collection) {
214
213
  this.selCollectionId = collection.collectionId;
214
+ const currentData = this.localData;
215
+ this.$set(collection, 'data', Array.isArray(currentData) ? currentData : [currentData]);
216
+ this.$set(collection, 'screen', this.screenCollectionId);
215
217
  }
216
218
  },
217
219
  record(record) {
@@ -240,7 +242,11 @@ export default {
240
242
  });
241
243
 
242
244
  if (this.collection && this.record) {
243
- this.loadRecordCollection(this.collection.collectionId, this.record, this.collectionmode.modeId);
245
+ const recordId = this.isMustache(this.record) ? this.defaultColumnsRecordId : this.record;
246
+ if(this.isMustache(this.record)) {
247
+ this.hasMustache = true;
248
+ }
249
+ this.loadRecordCollection(this.collection.collectionId, recordId, this.collectionmode.modeId);
244
250
  }
245
251
  },
246
252
  };
@@ -37,7 +37,7 @@
37
37
  :is="component"
38
38
  ref="component"
39
39
  :vdata="value"
40
- :_parent="_parent || value._parent"
40
+ :_parent="_parent || value?._parent"
41
41
  :_initial-page="currentPage"
42
42
  :taskdraft="taskdraft"
43
43
  @after-submit="afterSubmit"
@@ -234,7 +234,7 @@
234
234
  <button
235
235
  v-if="!(isAiSection(element) && aiPreview(element))"
236
236
  data-test="copy-control-btn"
237
- class="btn btn-sm btn-secondary mr-2"
237
+ class="btn btn-sm btn-primary mr-2"
238
238
  :title="$t('Copy Control')"
239
239
  @click="duplicateItem(index)"
240
240
  >
@@ -255,9 +255,7 @@
255
255
  v-model="element.items"
256
256
  :validation-errors="validationErrors"
257
257
  class="card-body"
258
- :class="styleMode === 'Modern' && element.component === 'FormRecordList'
259
- ? elementCssClassModern(element)
260
- : elementCssClass(element)"
258
+ :class="elementCssClass(element)"
261
259
  :selected="selected"
262
260
  :config="element.config"
263
261
  :ai-element="element"
@@ -300,7 +298,7 @@
300
298
  @removeFromClipboard="removeFromClipboard(extendedPages[tabPage].items[index])"
301
299
  />
302
300
  <button
303
- class="btn btn-sm btn-secondary mr-2"
301
+ class="btn btn-sm btn-primary mr-2"
304
302
  :title="$t('Copy Control')"
305
303
  @click="duplicateItem(index)"
306
304
  >
@@ -321,9 +319,7 @@
321
319
  :tabindex="element.config.interactive ? 0 : -1"
322
320
  class="card-body m-0 pb-4 pt-4"
323
321
  :class="[
324
- styleMode === 'Modern' && element.component === 'FormRecordList'
325
- ? elementCssClassModern(element)
326
- : elementCssClass(element),
322
+ elementCssClass(element),
327
323
  { 'prevent-interaction': !element.config.interactive }
328
324
  ]"
329
325
  :screen-type="screenType"
@@ -10,7 +10,7 @@
10
10
  <screen-renderer
11
11
  ref="renderer"
12
12
  :value="data"
13
- :_parent="_parent || data._parent"
13
+ :_parent="_parent || data?._parent"
14
14
  :definition="definition"
15
15
  :current-page="currentPage"
16
16
  data-cy="screen-renderer"
@@ -170,9 +170,10 @@ export default {
170
170
  }
171
171
  );
172
172
  if (confirm) {
173
- this.clipboardPage.items = [];
174
173
  this.$store.dispatch("clipboardModule/clearClipboard");
175
174
  this.$root.$emit('update-clipboard');
175
+ // Update the clipboard page with the new clipboard items
176
+ this.clipboardPage.items = this.$store.getters["clipboardModule/clipboardItems"];
176
177
  }
177
178
  },
178
179
 
@@ -5,6 +5,7 @@ export default {
5
5
  const css = [];
6
6
  element.config.bgcolor ? css.push(element.config.bgcolor) : null;
7
7
  element.config.color ? css.push(element.config.color) : null;
8
+ element.config.bgcolormodern ? css.push(element.config.bgcolormodern) : null;
8
9
  return css.join(' ');
9
10
  },
10
11
  elementCssClassModern(element) {