@processmaker/screen-builder 3.0.1 → 3.0.3

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.
Files changed (31) hide show
  1. package/dist/vue-form-builder.css +1 -1
  2. package/dist/vue-form-builder.es.js +6134 -5704
  3. package/dist/vue-form-builder.es.js.map +1 -1
  4. package/dist/vue-form-builder.umd.js +51 -51
  5. package/dist/vue-form-builder.umd.js.map +1 -1
  6. package/package.json +3 -3
  7. package/src/assets/Shape.svg +3 -0
  8. package/src/assets/pencil-square.svg +3 -0
  9. package/src/components/ScreenTemplateCard.vue +128 -74
  10. package/src/components/ScreenTemplates.vue +138 -110
  11. package/src/components/accordions.js +1 -1
  12. package/src/components/editor/loop.vue +26 -0
  13. package/src/components/editor/multi-column.vue +26 -0
  14. package/src/components/inspector/collection-data-source.vue +3 -1
  15. package/src/components/inspector/collection-designer-mode.vue +73 -0
  16. package/src/components/inspector/color-select-modern.vue +101 -0
  17. package/src/components/inspector/encrypted-config.vue +1 -1
  18. package/src/components/inspector/index.js +3 -0
  19. package/src/components/renderer/file-upload.vue +60 -13
  20. package/src/components/renderer/form-collection-record-control.vue +5 -4
  21. package/src/components/renderer/form-collection-view-control.vue +2 -2
  22. package/src/components/renderer/form-masked-input.vue +7 -5
  23. package/src/components/renderer/form-record-list.vue +200 -23
  24. package/src/components/sortable/tableStyles.scss +42 -0
  25. package/src/components/task.vue +82 -38
  26. package/src/components/vue-form-builder.vue +84 -7
  27. package/src/form-builder-controls.js +14 -2
  28. package/src/form-control-common-properties.js +115 -2
  29. package/src/main.js +8 -0
  30. package/src/mixins/Clipboard.js +15 -5
  31. package/src/mixins/HasColorProperty.js +5 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@processmaker/screen-builder",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
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.60.0",
60
+ "@processmaker/vue-form-elements": "0.61.1",
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.60.0",
119
+ "@processmaker/vue-form-elements": "0.61.1",
120
120
  "i18next": "^15.0.8",
121
121
  "vue": "^2.6.12",
122
122
  "vuex": "^3.1.1"
@@ -0,0 +1,3 @@
1
+ <svg width="16" height="18" viewBox="0 0 16 18" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M10.2837 6.5L9.99519 14M6.00481 14L5.71635 6.5M14.023 3.82547C14.308 3.86851 14.592 3.91456 14.875 3.96358M14.023 3.82547L13.1332 15.3938C13.058 16.3707 12.2434 17.125 11.2637 17.125H4.73631C3.75655 17.125 2.94198 16.3707 2.86683 15.3938L1.97696 3.82547M14.023 3.82547C13.0677 3.6812 12.1013 3.57071 11.125 3.49527M1.125 3.96358C1.40798 3.91456 1.69198 3.86851 1.97696 3.82547M1.97696 3.82547C2.93231 3.6812 3.89874 3.57071 4.875 3.49527M11.125 3.49527V2.73182C11.125 1.74902 10.3661 0.928526 9.38382 0.897103C8.92435 0.882405 8.46304 0.875 8 0.875C7.53696 0.875 7.07565 0.882405 6.61618 0.897103C5.63388 0.928526 4.875 1.74902 4.875 2.73182V3.49527M11.125 3.49527C10.0938 3.41558 9.05164 3.375 8 3.375C6.94836 3.375 5.9062 3.41558 4.875 3.49527" stroke="#596372" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M14.0514 3.73889L15.4576 2.33265C16.0678 1.72245 17.0572 1.72245 17.6674 2.33265C18.2775 2.94284 18.2775 3.93216 17.6674 4.54235L8.81849 13.3912C8.37792 13.8318 7.83453 14.1556 7.23741 14.3335L5 15L5.66648 12.7626C5.84435 12.1655 6.1682 11.6221 6.60877 11.1815L14.0514 3.73889ZM14.0514 3.73889L16.25 5.93749M15 11.6667V15.625C15 16.6605 14.1605 17.5 13.125 17.5H4.375C3.33947 17.5 2.5 16.6605 2.5 15.625V6.87499C2.5 5.83946 3.33947 4.99999 4.375 4.99999H8.33333" stroke="#596372" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>
@@ -3,13 +3,17 @@
3
3
  <b-card
4
4
  img-top
5
5
  class="mb-2 screenbuilder-template-card"
6
- @click="showDetails"
6
+ @click="toggleDetails"
7
7
  >
8
8
  <div
9
9
  v-if="thumbnail"
10
10
  class="thumbnail-container thumbnail-image-container"
11
11
  >
12
- <img class="thumbnail-image" :src="thumbnail" :alt="`${template.name}`"/>
12
+ <img
13
+ class="thumbnail-image"
14
+ :src="thumbnail"
15
+ :alt="`${template.name}`"
16
+ />
13
17
  </div>
14
18
  <div
15
19
  v-else
@@ -17,25 +21,33 @@
17
21
  >
18
22
  <i class="p-4 fas fa-palette thumbnail-icon"></i>
19
23
  </div>
20
- <hr class="card-divider">
24
+ <hr class="card-divider" />
21
25
  <b-card-body class="p-1">
22
26
  <div class="template-details">
23
- <span class="template-name d-block pt-1">{{ template.name }}</span>
24
- <span class="template-description d-block">{{ template.description }}</span>
27
+ <span class="template-name d-block pt-1">{{
28
+ truncateText(template.name, 45)
29
+ }}</span>
30
+ <span class="template-description d-block">{{
31
+ truncateText(template.description, 60)
32
+ }}</span>
25
33
  </div>
26
- <b-collapse v-model="showApplyOptions">
27
- <b-form-checkbox-group
28
- class="apply-options-group p-2"
29
- v-model="selected"
30
- name="apply-options"
31
- >
34
+ <b-collapse v-model="isApplyOptionsActive">
35
+ <b-form-checkbox-group
36
+ v-model="selected"
37
+ class="apply-options-group p-2"
38
+ name="apply-options"
39
+ >
32
40
  <div class="row row-cols-3 icons-row">
33
41
  <div
34
42
  v-for="option in applyOptions"
35
43
  :key="option.value"
36
44
  class="col apply-options-container d-flex align-items-baseline flex-column"
37
45
  >
38
- <div class="icon-container">
46
+ <div
47
+ class="icon-container"
48
+ :class="{ selected: selected.includes(option.value) }"
49
+ @click.stop="toggleOption(option.value)"
50
+ >
39
51
  <div v-if="option.value === 'CSS'">
40
52
  <css-icon />
41
53
  </div>
@@ -43,135 +55,178 @@
43
55
  <i :class="option.icon"></i>
44
56
  </div>
45
57
  </div>
46
- <b-form-checkbox
47
- class="option-checkbox"
48
- :value="option.value"
49
- >
58
+ <b-form-checkbox class="option-checkbox" :value="option.value">
50
59
  {{ option.text }}
51
60
  </b-form-checkbox>
52
61
  </div>
53
62
  </div>
54
- </b-form-checkbox-group>
55
- <hr class="bottom-card-divider">
56
- <div class="apply-btn-container d-flex justify-content-end">
57
- <button
58
- type="button"
59
- size="sm"
60
- class="btn btn-outline-secondary card-btn"
61
- @click="onCancel"
62
- >
63
- {{ $t("Cancel") }}
64
- </button>
65
- <button
66
- :disabled="!selected.length"
67
- type="button"
68
- size="sm"
69
- class="btn btn-primary ml-2 card-btn"
70
- @click="applyTemplate"
71
- >
72
- {{ $t("Apply") }}
73
- </button>
74
- </div>
63
+ </b-form-checkbox-group>
64
+ <hr class="bottom-card-divider" />
65
+ <div class="apply-btn-container d-flex justify-content-end">
66
+ <button
67
+ type="button"
68
+ size="sm"
69
+ class="btn btn-outline-secondary card-btn"
70
+ @click.stop="onCancel"
71
+ >
72
+ {{ $t("Cancel") }}
73
+ </button>
74
+ <button
75
+ :disabled="!selected.length"
76
+ type="button"
77
+ size="sm"
78
+ class="btn btn-primary ml-2 card-btn"
79
+ @click.stop="applyTemplate"
80
+ >
81
+ {{ $t("Apply") }}
82
+ </button>
83
+ </div>
75
84
  </b-collapse>
76
85
  </b-card-body>
77
86
  </b-card>
78
-
79
87
  </div>
80
88
  </template>
81
89
 
82
90
  <script>
83
- import CssIcon from './CssIcon.vue';
91
+ import CssIcon from "./CssIcon.vue";
84
92
 
85
93
  export default {
86
94
  components: {
87
- CssIcon,
95
+ CssIcon
88
96
  },
89
97
  mixins: [],
90
- props: ['template', 'screenId', 'currentScreenPage'],
98
+ props: {
99
+ template: {
100
+ type: Object,
101
+ required: true
102
+ },
103
+ screenId: {
104
+ type: Number,
105
+ required: true
106
+ },
107
+ currentScreenPage: {
108
+ type: Number,
109
+ default: 0
110
+ },
111
+ activeTemplateId: {
112
+ type: Number,
113
+ default: 0
114
+ }
115
+ },
91
116
  data() {
92
117
  return {
93
- showApplyOptions: false,
118
+ isApplyOptionsActive: false,
94
119
  selected: [],
95
120
  applyOptions: [
96
- { text: 'CSS', value: 'CSS' },
97
- { text: 'Fields', value: 'Fields', icon: 'fp-fields-icon' },
98
- { text: 'Layout', value: 'Layout', icon: 'fp-layout-icon' },
99
- ],
121
+ { text: "CSS", value: "CSS" },
122
+ { text: "Fields", value: "Fields", icon: "fp-fields-icon" },
123
+ { text: "Layout", value: "Layout", icon: "fp-layout-icon" }
124
+ ]
100
125
  };
101
126
  },
102
127
  computed: {
103
128
  thumbnail() {
104
- if (this.template?.template_media && this.template.template_media.length > 0) {
129
+ if (
130
+ this.template?.template_media &&
131
+ this.template.template_media.length > 0
132
+ ) {
105
133
  return this.template.template_media[0].url;
106
- } else if (this.template?.template_media?.thumbnail?.url) {
107
- return this.template?.template_media.thumbnail.url
134
+ }
135
+ if (this.template?.template_media?.thumbnail?.url) {
136
+ return this.template?.template_media.thumbnail.url;
108
137
  }
109
138
  return null;
110
- },
139
+ }
111
140
  },
112
- mounted() {
141
+ watch: {
142
+ activeTemplateId(newVal) {
143
+ this.isApplyOptionsActive = newVal === this.template.id;
144
+ }
113
145
  },
114
146
  methods: {
115
- showDetails() {
116
- this.showApplyOptions = !this.showApplyOptions;
147
+ toggleDetails() {
148
+ this.$emit("toggle-active", this.template.id);
117
149
  },
118
150
  applyTemplate() {
119
151
  ProcessMaker.apiClient
120
152
  .post(`/template/screen/${this.template.id}/apply`, {
121
153
  screenId: this.screenId,
122
154
  templateOptions: this.selected,
123
- currentScreenPage: this.currentScreenPage,
155
+ currentScreenPage: this.currentScreenPage
124
156
  })
125
- .then((response) => {
126
- ProcessMaker.alert(this.$t("The template options have been applied."), "success");
157
+ .then(() => {
158
+ ProcessMaker.alert(
159
+ this.$t("The template options have been applied."),
160
+ "success"
161
+ );
127
162
  window.location.reload();
128
163
  })
129
164
  .catch((error) => {
130
- const errorMessage = error.response?.data?.message || error.response?.data?.error || error.message;
165
+ const errorMessage =
166
+ error.response?.data?.message ||
167
+ error.response?.data?.error ||
168
+ error.message;
131
169
  ProcessMaker.alert(errorMessage, "danger");
132
170
  });
133
171
  },
134
172
  onCancel() {
135
- this.showApplyOptions = false;
173
+ this.isApplyOptionsActive = false;
136
174
  this.selected = [];
175
+ },
176
+ toggleOption(value) {
177
+ const index = this.selected.indexOf(value);
178
+ if (index === -1) {
179
+ this.selected.push(value);
180
+ } else {
181
+ this.selected.splice(index, 1);
182
+ }
183
+ },
184
+ truncateText(text, limit) {
185
+ if (!text) return "";
186
+ return text.length > limit ? `${text.substring(0, limit)}...` : text;
137
187
  }
138
- },
188
+ }
139
189
  };
140
190
  </script>
141
191
 
142
192
  <style lang="scss" scoped>
143
-
144
- .fp-fields-icon, .fp-layout-icon {
145
- color: #EAF2FF;
193
+ .fp-fields-icon,
194
+ .fp-layout-icon {
195
+ color: #eaf2ff;
146
196
  }
147
197
 
148
198
  .screenbuilder-template-card {
149
199
  width: 225px;
150
200
  margin: 8px;
151
- border: 1px solid #D7DDE5;
201
+ border: 1px solid #d7dde5;
152
202
  border-radius: 8px;
153
- box-shadow: 0px 3px 6px -3px rgb(0, 0, 0, 0.05), 0px 2px 4px -2px rgba(0, 0, 0, 0.05);
203
+ box-shadow: 0px 3px 6px -3px rgb(0, 0, 0, 0.05),
204
+ 0px 2px 4px -2px rgba(0, 0, 0, 0.05);
154
205
  cursor: pointer;
155
206
  }
156
207
 
157
208
  .card-divider {
158
209
  width: 100%;
159
210
  margin: 0px;
160
- background-color: #D7DDE5;
211
+ background-color: #d7dde5;
161
212
  }
162
213
 
163
214
  .thumbnail-container:hover,
164
215
  .thumbnail-container.active {
165
- border-color: #1572C2;
216
+ border-color: #1572c2;
166
217
  cursor: pointer;
167
218
  }
168
219
 
169
220
  .thumbnail-image {
170
221
  width: 100%;
222
+ height: 100%;
223
+ object-fit: cover;
171
224
  border-radius: 8px 8px 0px 0px;
172
225
  }
173
226
 
174
227
  .thumbnail-image-container {
228
+ width: 100%;
229
+ height: 107px;
175
230
  border-radius: 8px;
176
231
  padding: 0px !important;
177
232
  background-size: contain;
@@ -180,7 +235,7 @@ export default {
180
235
  }
181
236
 
182
237
  .thumbnail-icon {
183
- color: #CDDDEE;
238
+ color: #cdddee;
184
239
  font-size: 59px;
185
240
  }
186
241
 
@@ -192,14 +247,14 @@ export default {
192
247
  font-size: 14px;
193
248
  font-weight: 600;
194
249
  line-height: 20px;
195
- color: #2F343B;
250
+ color: #2f343b;
196
251
  }
197
252
 
198
253
  .template-description {
199
254
  font-size: 12.5px;
200
255
  font-weight: 400;
201
256
  line-height: 18px;
202
- color: #4E5663;
257
+ color: #4e5663;
203
258
  }
204
259
 
205
260
  .apply-options-group {
@@ -214,7 +269,7 @@ export default {
214
269
  }
215
270
 
216
271
  .apply-options-container {
217
- padding: 5px;
272
+ padding: 5px;
218
273
  }
219
274
 
220
275
  .apply-options-group i {
@@ -228,7 +283,7 @@ export default {
228
283
  justify-content: center;
229
284
  width: 66px;
230
285
  height: 76px;
231
- border: 0.7px solid #D7DDE5;
286
+ border: 0.7px solid #d7dde5;
232
287
  border-radius: 8px;
233
288
  margin-bottom: 10px;
234
289
  }
@@ -239,7 +294,7 @@ export default {
239
294
 
240
295
  .bottom-card-divider {
241
296
  width: 90%;
242
- background-color: #E9ECF1;
297
+ background-color: #e9ecf1;
243
298
  margin-top: 0px;
244
299
  }
245
300
 
@@ -253,5 +308,4 @@ export default {
253
308
  border-radius: 8px;
254
309
  padding: 5px 10px;
255
310
  }
256
-
257
- </style>
311
+ </style>