@processmaker/screen-builder 2.85.2 → 2.85.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.
- package/dist/vue-form-builder.css +1 -1
- package/dist/vue-form-builder.es.js +6 -7
- package/dist/vue-form-builder.es.js.map +1 -1
- package/dist/vue-form-builder.umd.js +1 -1
- package/dist/vue-form-builder.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/sortable/Sortable.vue +8 -1
- package/src/components/sortable/sortableList/SortableList.vue +5 -4
- package/src/stories/Sortable.stories.js +49 -0
package/package.json
CHANGED
|
@@ -47,7 +47,14 @@ export default {
|
|
|
47
47
|
data() {
|
|
48
48
|
return {
|
|
49
49
|
search: "",
|
|
50
|
-
filteredItems: [...this.items],
|
|
50
|
+
filteredItems: [...this.items].map((item, index) => {
|
|
51
|
+
// Add the order property to the items if it doesn't exist
|
|
52
|
+
if (item.order === undefined) {
|
|
53
|
+
// eslint-disable-next-line no-param-reassign
|
|
54
|
+
this.$set(item, "order", index + 1);
|
|
55
|
+
}
|
|
56
|
+
return item;
|
|
57
|
+
})
|
|
51
58
|
};
|
|
52
59
|
},
|
|
53
60
|
watch: {
|
|
@@ -64,6 +64,7 @@ export default {
|
|
|
64
64
|
},
|
|
65
65
|
data() {
|
|
66
66
|
return {
|
|
67
|
+
refreshSort: 1,
|
|
67
68
|
newName: '',
|
|
68
69
|
draggedItem: 0,
|
|
69
70
|
draggedOverItem: 0,
|
|
@@ -72,9 +73,9 @@ export default {
|
|
|
72
73
|
},
|
|
73
74
|
computed: {
|
|
74
75
|
sortedItems() {
|
|
75
|
-
const sortedItems =
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
const sortedItems =
|
|
77
|
+
this.refreshSort &&
|
|
78
|
+
[...this.filteredItems].sort((a, b) => a.order - b.order);
|
|
78
79
|
return sortedItems;
|
|
79
80
|
}
|
|
80
81
|
},
|
|
@@ -178,7 +179,7 @@ export default {
|
|
|
178
179
|
item.order = index + 1;
|
|
179
180
|
});
|
|
180
181
|
}
|
|
181
|
-
|
|
182
|
+
this.refreshSort++;
|
|
182
183
|
this.$emit('ordered', itemsSortedClone);
|
|
183
184
|
},
|
|
184
185
|
dragOver(event) {
|
|
@@ -234,3 +234,52 @@ export const UserCanSortWithFilterByText = {
|
|
|
234
234
|
expect(itemsOrder[4]).toHaveAttribute("data-order", "5");
|
|
235
235
|
}
|
|
236
236
|
};
|
|
237
|
+
|
|
238
|
+
// User can reorder items that does not have an order
|
|
239
|
+
export const UserCanReorderItemsThatDoesNotHaveAnOrder = {
|
|
240
|
+
args: {
|
|
241
|
+
filterKey: "name",
|
|
242
|
+
items: [
|
|
243
|
+
{ name: "Page 1" },
|
|
244
|
+
{ name: "Page 2" },
|
|
245
|
+
{ name: "Page 3" },
|
|
246
|
+
{ name: "Page 4" },
|
|
247
|
+
{ name: "Page 5" }
|
|
248
|
+
]
|
|
249
|
+
},
|
|
250
|
+
play: async ({ canvasElement }) => {
|
|
251
|
+
const canvas = within(canvasElement);
|
|
252
|
+
|
|
253
|
+
// Drag item-1 item-5 position
|
|
254
|
+
await dragAndDrop(
|
|
255
|
+
canvas.getByTestId("item-1"),
|
|
256
|
+
canvas.getByTestId("item-5")
|
|
257
|
+
);
|
|
258
|
+
|
|
259
|
+
// Drag item-1 item-4 position
|
|
260
|
+
await dragAndDrop(
|
|
261
|
+
canvas.getByTestId("item-1"),
|
|
262
|
+
canvas.getByTestId("item-4")
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
// Drag item-1 item-3 position
|
|
266
|
+
await dragAndDrop(
|
|
267
|
+
canvas.getByTestId("item-1"),
|
|
268
|
+
canvas.getByTestId("item-3")
|
|
269
|
+
);
|
|
270
|
+
|
|
271
|
+
// Drag item-1 item-2 position
|
|
272
|
+
await dragAndDrop(
|
|
273
|
+
canvas.getByTestId("item-1"),
|
|
274
|
+
canvas.getByTestId("item-2")
|
|
275
|
+
);
|
|
276
|
+
|
|
277
|
+
// Check the new order
|
|
278
|
+
const items = canvas.getAllByTestId(/item-\d+/);
|
|
279
|
+
expect(items[0]).toHaveTextContent("Page 5");
|
|
280
|
+
expect(items[1]).toHaveTextContent("Page 4");
|
|
281
|
+
expect(items[2]).toHaveTextContent("Page 3");
|
|
282
|
+
expect(items[3]).toHaveTextContent("Page 2");
|
|
283
|
+
expect(items[4]).toHaveTextContent("Page 1");
|
|
284
|
+
}
|
|
285
|
+
};
|