@processmaker/screen-builder 3.0.2 → 3.0.4

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.
@@ -127,6 +127,7 @@
127
127
  v-if="isClipboardPage(tabPage)"
128
128
  variant="link"
129
129
  @click="clearClipboard"
130
+ class="no-text-transform"
130
131
  >
131
132
  {{ $t('Clear All') }}
132
133
  </b-button>
@@ -201,9 +202,18 @@
201
202
  class="mr-2 ml-1"
202
203
  />
203
204
  {{ element.config.name || element.label || $t("Field Name") }}
205
+ <b-badge
206
+ v-if="!isClipboardPage(tabPage) && isInClipboard(extendedPages[tabPage].items[index]) && screenType === 'form'"
207
+ data-cy="copied-badge"
208
+ class="m-2 custom-badge"
209
+ pill
210
+ >
211
+ <i class="far fa-check-circle"></i>
212
+ <span class="pl-2">{{ $t('Copied')}}</span>
213
+ </b-badge>
204
214
  <div class="ml-auto">
205
215
  <clipboard-button
206
- v-if="!isClipboardPage(tabPage)"
216
+ v-if="!isClipboardPage(tabPage) && screenType === 'form'"
207
217
  :index="index"
208
218
  :config="element.config"
209
219
  :isInClipboard="isInClipboard(extendedPages[tabPage].items[index])"
@@ -245,10 +255,13 @@
245
255
  v-model="element.items"
246
256
  :validation-errors="validationErrors"
247
257
  class="card-body"
248
- :class="styleMode === 'Modern' ? elementCssClassModern(element) : elementCssClass(element)"
258
+ :class="styleMode === 'Modern' && element.component === 'FormRecordList'
259
+ ? elementCssClassModern(element)
260
+ : elementCssClass(element)"
249
261
  :selected="selected"
250
262
  :config="element.config"
251
263
  :ai-element="element"
264
+ :screen-type="screenType"
252
265
  @inspect="inspect"
253
266
  @update-state="updateState"
254
267
  />
@@ -266,9 +279,18 @@
266
279
  class="mr-2 ml-1"
267
280
  />
268
281
  {{ element.config.name || $t("Variable Name") }}
282
+ <b-badge
283
+ v-if="!isClipboardPage(tabPage) && isInClipboard(extendedPages[tabPage].items[index]) && screenType === 'form'"
284
+ data-cy="copied-badge"
285
+ class="m-2 custom-badge"
286
+ pill
287
+ >
288
+ <i class="far fa-check-circle"></i>
289
+ <span class="pl-2">{{ $t('Copied')}}</span>
290
+ </b-badge>
269
291
  <div class="ml-auto">
270
292
  <clipboard-button
271
- v-if="!isClipboardPage(tabPage)"
293
+ v-if="!isClipboardPage(tabPage) && screenType === 'form'"
272
294
  :index="index"
273
295
  :config="element.config"
274
296
  :isInClipboard="isInClipboard(extendedPages[tabPage].items[index])"
@@ -299,15 +321,19 @@
299
321
  :tabindex="element.config.interactive ? 0 : -1"
300
322
  class="card-body m-0 pb-4 pt-4"
301
323
  :class="[
302
- styleMode === 'Modern' ? elementCssClassModern(element) : elementCssClass(element),
324
+ styleMode === 'Modern' && element.component === 'FormRecordList'
325
+ ? elementCssClassModern(element)
326
+ : elementCssClass(element),
303
327
  { 'prevent-interaction': !element.config.interactive }
304
328
  ]"
329
+ :screen-type="screenType"
305
330
  @input="
306
331
  element.config.interactive
307
332
  ? (element.config.content = $event)
308
333
  : null
309
334
  "
310
335
  @focusout.native="updateState"
336
+
311
337
  />
312
338
  </div>
313
339
  </div>
@@ -1745,4 +1771,15 @@ $side-bar-font-size: 0.875rem;
1745
1771
  cursor: not-allowed; /* Cambia el cursor cuando se pasa por encima */
1746
1772
  pointer-events: all; /* Permite que el pseudo-elemento reciba eventos del ratón */
1747
1773
  }
1774
+ .custom-badge {
1775
+ background-color: #D1F4D7 !important;
1776
+ color: #06723A !important;
1777
+ padding: 0.5rem 0.75rem;
1778
+ border-radius: 8px;
1779
+ font-weight: 500;
1780
+ font-size: 14px;
1781
+ }
1782
+ .no-text-transform {
1783
+ text-transform: none;
1784
+ }
1748
1785
  </style>
package/src/main.js CHANGED
@@ -325,6 +325,14 @@ window.Echo = {
325
325
  }, 1000);
326
326
  });
327
327
  },
328
+
329
+ eventMockNext(event, response) {
330
+ this.listeners.forEach((listener) => {
331
+ setTimeout(() => {
332
+ listener.callback(response);
333
+ }, 1000);
334
+ });
335
+ },
328
336
  private() {
329
337
  return {
330
338
  notification(callback) {
@@ -108,19 +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
- }
119
- if (item.items) {
120
- replaceInPage(item);
121
- }
122
- });
123
- }
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
+
124
150
  screenConfig.forEach((item) => replaceInPage(item));
125
151
  },
126
152
 
@@ -144,6 +170,7 @@ export default {
144
170
  }
145
171
  );
146
172
  if (confirm) {
173
+ this.clipboardPage.items = [];
147
174
  this.$store.dispatch("clipboardModule/clearClipboard");
148
175
  this.$root.$emit('update-clipboard');
149
176
  }