@processmaker/screen-builder 2.84.0 → 2.84.1
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/dist/vue-form-builder.css +1 -1
- package/dist/vue-form-builder.es.js +68 -66
- package/dist/vue-form-builder.es.js.map +1 -1
- package/dist/vue-form-builder.umd.js +2 -2
- package/dist/vue-form-builder.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/App.vue +1 -0
- package/src/assets/css/tabs.css +118 -0
- package/src/components/TabsBar.vue +0 -121
- package/src/components/editor/pagesDropdown.vue +1 -1
- package/src/components/index.js +1 -0
- package/src/components/sortable/sortableList/SortableList.vue +21 -20
- package/src/components/vue-form-builder.vue +10 -7
- package/src/stories/DropdownAndPages.stories.js +2 -1
- package/src/stories/Sortable.stories.js +11 -0
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -332,6 +332,7 @@ import controlConfig from "./form-builder-controls";
|
|
|
332
332
|
import globalProperties from "./global-properties";
|
|
333
333
|
|
|
334
334
|
import "bootstrap";
|
|
335
|
+
import "./assets/css/tabs.css";
|
|
335
336
|
|
|
336
337
|
// To include another language in the Validator with variable processmaker
|
|
337
338
|
const globalObject = typeof window === "undefined" ? global : window;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/* Setup some colors */
|
|
2
|
+
:root {
|
|
3
|
+
--tabs-blue: #1572c2;
|
|
4
|
+
--tabs-light: #c3c9cf;
|
|
5
|
+
--tabs-grey: #6a7888;
|
|
6
|
+
--tabs-border: #cdddee;
|
|
7
|
+
--tabs-scroll-bg: #ebeef2;
|
|
8
|
+
--tabs-white: #ffffff;
|
|
9
|
+
}
|
|
10
|
+
/* Override Bootstrap default tab styles */
|
|
11
|
+
.nav-tabs {
|
|
12
|
+
border-bottom: 1px solid var(--tabs-border) !important;
|
|
13
|
+
flex-wrap: nowrap !important;
|
|
14
|
+
overflow: hidden !important;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.nav-tabs .nav-item .nav-link {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Style for individual tabs */
|
|
23
|
+
.nav-tabs .nav-item.show .nav-link,
|
|
24
|
+
.nav-tabs .nav-link.active {
|
|
25
|
+
border: none;
|
|
26
|
+
box-shadow: inset 0 -3px 0 0 var(--tabs-blue) !important; /* This sets the blue bottom border for the active tab */
|
|
27
|
+
background-color: var(
|
|
28
|
+
--tabs-white
|
|
29
|
+
); /* This sets the background color for the active tab */
|
|
30
|
+
border-radius: 0 !important; /* This removes the border-radius */
|
|
31
|
+
color: var(--tabs-blue) !important;
|
|
32
|
+
position: relative;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* Style for non-active tabs */
|
|
36
|
+
.nav-tabs .nav-link {
|
|
37
|
+
border: 1px solid var(--tabs-border) !important;
|
|
38
|
+
color: var(--tabs-grey); /* This sets the text color for the inactive tabs */
|
|
39
|
+
border-radius: 0 !important; /* This ensures no border radius for a flat design */
|
|
40
|
+
padding: 0.5rem 1rem;
|
|
41
|
+
margin-right: -1px;
|
|
42
|
+
text-wrap: nowrap !important;
|
|
43
|
+
flex-wrap: nowrap !important;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.nav-tabs .nav-item .nav-link:not(.active) {
|
|
47
|
+
.badge {
|
|
48
|
+
background-color: #6A7888 !important;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
span:not(.badge, .close-tab) {
|
|
52
|
+
color: #556271 !important;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* Style for the hover effect */
|
|
57
|
+
.nav-tabs .nav-link:hover {
|
|
58
|
+
border: none;
|
|
59
|
+
background-color: var(
|
|
60
|
+
--tabs-white
|
|
61
|
+
); /* This changes the background color when hovering */
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Adding the 'x' button to the tab */
|
|
65
|
+
.nav-tabs .nav-link .close-tab {
|
|
66
|
+
font-size: 0.8rem;
|
|
67
|
+
color: var(--tabs-light);
|
|
68
|
+
margin-left: 0.5rem;
|
|
69
|
+
display: inline !important;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* Style adjustments for the 'x' button */
|
|
73
|
+
.nav-tabs .nav-link .close-tab:hover {
|
|
74
|
+
color: var(--tabs-grey);
|
|
75
|
+
cursor: pointer;
|
|
76
|
+
}
|
|
77
|
+
.nav-tabs .nav-scroll {
|
|
78
|
+
position: absolute;
|
|
79
|
+
top: calc(50% - 0.75rem);
|
|
80
|
+
width: 1.5rem;
|
|
81
|
+
height: 1.5rem;
|
|
82
|
+
font-size: 0.75rem;
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
background-color: var(--tabs-scroll-bg);
|
|
87
|
+
color: var(--tabs-grey);
|
|
88
|
+
cursor: pointer;
|
|
89
|
+
border: 1px solid var(--tabs-border);
|
|
90
|
+
border-radius: 100%;
|
|
91
|
+
z-index: 1;
|
|
92
|
+
}
|
|
93
|
+
.nav-tabs .nav-scroll-right {
|
|
94
|
+
right: 5px;
|
|
95
|
+
}
|
|
96
|
+
.nav-tabs .nav-scroll-left {
|
|
97
|
+
margin-left: 5px;
|
|
98
|
+
}
|
|
99
|
+
.nav-tabs .tabs-sticky {
|
|
100
|
+
position: sticky;
|
|
101
|
+
-webkit-position: sticky;
|
|
102
|
+
left: 0;
|
|
103
|
+
right: 0;
|
|
104
|
+
z-index: 2;
|
|
105
|
+
}
|
|
106
|
+
.nav-tabs .tabs-start {
|
|
107
|
+
background-color: var(--tabs-white);
|
|
108
|
+
}
|
|
109
|
+
/* add margin right to the last li element to hide safely the right scroll button */
|
|
110
|
+
.nav-tabs li.nav-item:last-of-type {
|
|
111
|
+
margin-right: 2rem;
|
|
112
|
+
}
|
|
113
|
+
.flat-tabs .h-tab {
|
|
114
|
+
height: calc(100% - 42px) !important;
|
|
115
|
+
}
|
|
116
|
+
.dd-ml {
|
|
117
|
+
margin-left: 2rem;
|
|
118
|
+
}
|
|
@@ -231,124 +231,3 @@ export default {
|
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
233
|
</script>
|
|
234
|
-
|
|
235
|
-
<style>
|
|
236
|
-
/* Setup some colors */
|
|
237
|
-
:root {
|
|
238
|
-
--tabs-blue: #1572c2;
|
|
239
|
-
--tabs-light: #c3c9cf;
|
|
240
|
-
--tabs-grey: #6a7888;
|
|
241
|
-
--tabs-border: #cdddee;
|
|
242
|
-
--tabs-scroll-bg: #ebeef2;
|
|
243
|
-
--tabs-white: #ffffff;
|
|
244
|
-
}
|
|
245
|
-
/* Override Bootstrap default tab styles */
|
|
246
|
-
.nav-tabs {
|
|
247
|
-
border-bottom: 1px solid var(--tabs-border) !important;
|
|
248
|
-
flex-wrap: nowrap !important;
|
|
249
|
-
overflow: hidden !important;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
.nav-tabs .nav-item .nav-link {
|
|
253
|
-
display: flex;
|
|
254
|
-
align-items: center;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/* Style for individual tabs */
|
|
258
|
-
.nav-tabs .nav-item.show .nav-link,
|
|
259
|
-
.nav-tabs .nav-link.active {
|
|
260
|
-
border: none;
|
|
261
|
-
box-shadow: inset 0 -3px 0 0 var(--tabs-blue) !important; /* This sets the blue bottom border for the active tab */
|
|
262
|
-
background-color: var(
|
|
263
|
-
--tabs-white
|
|
264
|
-
); /* This sets the background color for the active tab */
|
|
265
|
-
border-radius: 0 !important; /* This removes the border-radius */
|
|
266
|
-
color: var(--tabs-blue) !important;
|
|
267
|
-
position: relative;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/* Style for non-active tabs */
|
|
271
|
-
.nav-tabs .nav-link {
|
|
272
|
-
border: 1px solid var(--tabs-border) !important;
|
|
273
|
-
color: var(--tabs-grey); /* This sets the text color for the inactive tabs */
|
|
274
|
-
border-radius: 0 !important; /* This ensures no border radius for a flat design */
|
|
275
|
-
padding: 0.5rem 1rem;
|
|
276
|
-
margin-right: -1px;
|
|
277
|
-
text-wrap: nowrap !important;
|
|
278
|
-
flex-wrap: nowrap !important;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
.nav-tabs .nav-item .nav-link:not(.active) {
|
|
282
|
-
.badge {
|
|
283
|
-
background-color: #6A7888 !important;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
span:not(.badge, .close-tab) {
|
|
287
|
-
color: #556271 !important;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
/* Style for the hover effect */
|
|
292
|
-
.nav-tabs .nav-link:hover {
|
|
293
|
-
border: none;
|
|
294
|
-
background-color: var(
|
|
295
|
-
--tabs-white
|
|
296
|
-
); /* This changes the background color when hovering */
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
/* Adding the 'x' button to the tab */
|
|
300
|
-
.nav-tabs .nav-link .close-tab {
|
|
301
|
-
font-size: 0.8rem;
|
|
302
|
-
color: var(--tabs-light);
|
|
303
|
-
margin-left: 0.5rem;
|
|
304
|
-
display: inline !important;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
/* Style adjustments for the 'x' button */
|
|
308
|
-
.nav-tabs .nav-link .close-tab:hover {
|
|
309
|
-
color: var(--tabs-grey);
|
|
310
|
-
cursor: pointer;
|
|
311
|
-
}
|
|
312
|
-
.nav-tabs .nav-scroll {
|
|
313
|
-
position: absolute;
|
|
314
|
-
top: calc(50% - 0.75rem);
|
|
315
|
-
width: 1.5rem;
|
|
316
|
-
height: 1.5rem;
|
|
317
|
-
font-size: 0.75rem;
|
|
318
|
-
display: flex;
|
|
319
|
-
align-items: center;
|
|
320
|
-
justify-content: center;
|
|
321
|
-
background-color: var(--tabs-scroll-bg);
|
|
322
|
-
color: var(--tabs-grey);
|
|
323
|
-
cursor: pointer;
|
|
324
|
-
border: 1px solid var(--tabs-border);
|
|
325
|
-
border-radius: 100%;
|
|
326
|
-
z-index: 1;
|
|
327
|
-
}
|
|
328
|
-
.nav-tabs .nav-scroll-right {
|
|
329
|
-
right: 5px;
|
|
330
|
-
}
|
|
331
|
-
.nav-tabs .nav-scroll-left {
|
|
332
|
-
margin-left: 5px;
|
|
333
|
-
}
|
|
334
|
-
.nav-tabs .tabs-sticky {
|
|
335
|
-
position: sticky;
|
|
336
|
-
-webkit-position: sticky;
|
|
337
|
-
left: 0;
|
|
338
|
-
right: 0;
|
|
339
|
-
z-index: 2;
|
|
340
|
-
}
|
|
341
|
-
.nav-tabs .tabs-start {
|
|
342
|
-
background-color: var(--tabs-white);
|
|
343
|
-
}
|
|
344
|
-
/* add margin right to the last li element to hide safely the right scroll button */
|
|
345
|
-
.nav-tabs .nav-item:last-of-type {
|
|
346
|
-
margin-right: 2rem;
|
|
347
|
-
}
|
|
348
|
-
.flat-tabs .h-tab {
|
|
349
|
-
height: calc(100% - 42px) !important;
|
|
350
|
-
}
|
|
351
|
-
.dd-ml {
|
|
352
|
-
margin-left: 2rem;
|
|
353
|
-
}
|
|
354
|
-
</style>
|
package/src/components/index.js
CHANGED
|
@@ -47,6 +47,7 @@ import FormListTable from "./renderer/form-list-table.vue";
|
|
|
47
47
|
import FormAnalyticsChart from "./renderer/form-analytics-chart.vue";
|
|
48
48
|
import accordions from "@/components/accordions";
|
|
49
49
|
import VariableNameGenerator from "@/components/VariableNameGenerator";
|
|
50
|
+
import "../assets/css/tabs.css";
|
|
50
51
|
|
|
51
52
|
const rendererComponents = {
|
|
52
53
|
...renderer,
|
|
@@ -57,23 +57,17 @@ export default {
|
|
|
57
57
|
return {
|
|
58
58
|
draggedItem: 0,
|
|
59
59
|
draggedOverItem: 0,
|
|
60
|
-
itemsClone: [],
|
|
61
60
|
editRowIndex: null,
|
|
62
61
|
};
|
|
63
62
|
},
|
|
64
63
|
computed: {
|
|
65
64
|
sortedItems() {
|
|
66
|
-
|
|
65
|
+
const sortedItems = [...this.filteredItems].sort(
|
|
66
|
+
(a, b) => a.order - b.order
|
|
67
|
+
);
|
|
68
|
+
return sortedItems;
|
|
67
69
|
}
|
|
68
70
|
},
|
|
69
|
-
watch: {
|
|
70
|
-
items: {
|
|
71
|
-
handler(newVal) {
|
|
72
|
-
this.itemsClone = [...newVal];
|
|
73
|
-
},
|
|
74
|
-
immediate: true,
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
71
|
methods: {
|
|
78
72
|
onBlur() {
|
|
79
73
|
this.editRowIndex = -1;
|
|
@@ -101,34 +95,41 @@ export default {
|
|
|
101
95
|
event.target.classList.remove('dragging');
|
|
102
96
|
|
|
103
97
|
// get the index of the dragged item and the dragged over item
|
|
104
|
-
const
|
|
105
|
-
|
|
98
|
+
const itemsSortedClone = [...this.items].sort(
|
|
99
|
+
(a, b) => a.order - b.order
|
|
100
|
+
);
|
|
101
|
+
const draggedItemIndex = itemsSortedClone.findIndex(
|
|
102
|
+
(item) => item.order === this.draggedItem
|
|
103
|
+
);
|
|
104
|
+
const draggedOverItemIndex = itemsSortedClone.findIndex(
|
|
105
|
+
(item) => item.order === this.draggedOverItem
|
|
106
|
+
);
|
|
106
107
|
|
|
107
108
|
if (draggedItemIndex !== draggedOverItemIndex) {
|
|
108
109
|
// get the order of the dragged over item
|
|
109
|
-
const tempOrder =
|
|
110
|
+
const tempOrder = itemsSortedClone[draggedOverItemIndex].order;
|
|
110
111
|
// set the increment
|
|
111
112
|
const increment = this.draggedItem > this.draggedOverItem ? 1 : -1;
|
|
112
113
|
|
|
113
114
|
// update the order of the items between the dragged item and the dragged over item
|
|
114
115
|
if (draggedItemIndex < draggedOverItemIndex) {
|
|
115
116
|
for (let i = draggedItemIndex + 1; i <= draggedOverItemIndex; i++) {
|
|
116
|
-
const orderAux =
|
|
117
|
-
|
|
117
|
+
const orderAux = itemsSortedClone[i].order;
|
|
118
|
+
itemsSortedClone[i].order = orderAux + increment;
|
|
118
119
|
}
|
|
119
120
|
|
|
120
|
-
|
|
121
|
+
itemsSortedClone[draggedItemIndex].order = tempOrder;
|
|
121
122
|
} else if (draggedItemIndex > draggedOverItemIndex) {
|
|
122
123
|
for (let i = draggedOverItemIndex; i <= draggedItemIndex - 1; i++) {
|
|
123
|
-
const orderAux =
|
|
124
|
-
|
|
124
|
+
const orderAux = itemsSortedClone[i].order;
|
|
125
|
+
itemsSortedClone[i].order = orderAux + increment;
|
|
125
126
|
}
|
|
126
127
|
|
|
127
|
-
|
|
128
|
+
itemsSortedClone[draggedItemIndex].order = tempOrder;
|
|
128
129
|
}
|
|
129
130
|
}
|
|
130
131
|
|
|
131
|
-
this.$emit('ordered',
|
|
132
|
+
this.$emit('ordered', itemsSortedClone);
|
|
132
133
|
},
|
|
133
134
|
dragOver(event) {
|
|
134
135
|
event.preventDefault();
|
|
@@ -109,15 +109,15 @@
|
|
|
109
109
|
<template #tabs-start>
|
|
110
110
|
<pages-dropdown
|
|
111
111
|
v-if="showToolbar"
|
|
112
|
-
:data="
|
|
112
|
+
:data="sortedPages"
|
|
113
113
|
@addPage="$bvModal.show('addPageModal')"
|
|
114
114
|
@clickPage="onClick"
|
|
115
115
|
@seeAllPages="$bvModal.show('openSortable')"
|
|
116
116
|
/>
|
|
117
117
|
</template>
|
|
118
|
-
<template #default>
|
|
118
|
+
<template #default="{ currentPage: tabPage }">
|
|
119
119
|
<div
|
|
120
|
-
v-if="isCurrentPageEmpty(
|
|
120
|
+
v-if="isCurrentPageEmpty(tabPage)"
|
|
121
121
|
data-cy="screen-drop-zone"
|
|
122
122
|
class="d-flex justify-content-center align-items-center drag-placeholder text-center position-absolute rounded mt-4 flex-column"
|
|
123
123
|
>
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
data-cy="editor-content"
|
|
151
151
|
class="h-100"
|
|
152
152
|
ghost-class="form-control-ghost"
|
|
153
|
-
:value="config[
|
|
153
|
+
:value="config[tabPage].items"
|
|
154
154
|
v-bind="{
|
|
155
155
|
group: { name: 'controls' },
|
|
156
156
|
swapThreshold: 0.5
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
@input="updateConfig"
|
|
159
159
|
>
|
|
160
160
|
<div
|
|
161
|
-
v-for="(element, index) in config[
|
|
161
|
+
v-for="(element, index) in config[tabPage].items"
|
|
162
162
|
:key="index"
|
|
163
163
|
class="control-item mt-4 mb-4"
|
|
164
164
|
:class="{
|
|
@@ -279,7 +279,7 @@
|
|
|
279
279
|
</div>
|
|
280
280
|
</draggable>
|
|
281
281
|
|
|
282
|
-
<div v-if="!isCurrentPageEmpty" data-cy="screen-drop-zone">
|
|
282
|
+
<div v-if="!isCurrentPageEmpty(tabPage)" data-cy="screen-drop-zone">
|
|
283
283
|
|
|
284
284
|
</div>
|
|
285
285
|
</template>
|
|
@@ -624,6 +624,9 @@ export default {
|
|
|
624
624
|
};
|
|
625
625
|
},
|
|
626
626
|
computed: {
|
|
627
|
+
sortedPages() {
|
|
628
|
+
return [...this.config].sort((a, b) => a.order - b.order);
|
|
629
|
+
},
|
|
627
630
|
builder() {
|
|
628
631
|
return this;
|
|
629
632
|
},
|
|
@@ -764,7 +767,7 @@ export default {
|
|
|
764
767
|
return this.config[currentPage]?.items?.length === 0;
|
|
765
768
|
},
|
|
766
769
|
onClick(page) {
|
|
767
|
-
this.$refs.tabsBar.openPageByIndex(page);
|
|
770
|
+
this.$refs.tabsBar.openPageByIndex(this.config.indexOf(page));
|
|
768
771
|
},
|
|
769
772
|
checkPageName(value, force = false) {
|
|
770
773
|
if (!force && !this.showAddPageValidations) {
|
|
@@ -221,5 +221,16 @@ export const UserCanSortWithFilterByText = {
|
|
|
221
221
|
expect(items[2]).toHaveTextContent("Hephaïstus");
|
|
222
222
|
expect(items[3]).toHaveTextContent("Athena");
|
|
223
223
|
expect(items[4]).toHaveTextContent("Hera");
|
|
224
|
+
|
|
225
|
+
// Drag "Athena" to "Hera" position
|
|
226
|
+
await dragAndDrop(canvas.getByTitle("Athena"), canvas.getByTitle("Hera"));
|
|
227
|
+
|
|
228
|
+
// Check the new order
|
|
229
|
+
const itemsOrder = canvas.getAllByTestId(/item-\d+/);
|
|
230
|
+
expect(itemsOrder[0]).toHaveAttribute("data-order", "1");
|
|
231
|
+
expect(itemsOrder[1]).toHaveAttribute("data-order", "2");
|
|
232
|
+
expect(itemsOrder[2]).toHaveAttribute("data-order", "3");
|
|
233
|
+
expect(itemsOrder[3]).toHaveAttribute("data-order", "4");
|
|
234
|
+
expect(itemsOrder[4]).toHaveAttribute("data-order", "5");
|
|
224
235
|
}
|
|
225
236
|
};
|