@processmaker/screen-builder 2.84.1 → 2.84.2
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 +23 -10
- 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/sortableList/SortableList.vue +43 -8
package/package.json
CHANGED
|
@@ -27,12 +27,20 @@
|
|
|
27
27
|
v-model="item.name"
|
|
28
28
|
type="text"
|
|
29
29
|
autofocus
|
|
30
|
-
|
|
30
|
+
required
|
|
31
|
+
:state="validateState(item.name, item)"
|
|
32
|
+
:error="validateError(item.name, item)"
|
|
33
|
+
@blur.stop="onBlur(item.name, item)"
|
|
34
|
+
@keydown.enter.stop="onBlur(item.name, item)"
|
|
35
|
+
@focus="onFocus(item.name, item)"
|
|
31
36
|
/>
|
|
32
37
|
<span v-else>{{ item.name }}</span>
|
|
33
38
|
</div>
|
|
34
39
|
<div class="border rounded-lg sortable-item-action">
|
|
35
|
-
<button
|
|
40
|
+
<button v-if="editRowIndex === index" class="btn">
|
|
41
|
+
<i class="fas fa-check"></i>
|
|
42
|
+
</button>
|
|
43
|
+
<button v-else class="btn" @click.stop="onClick(item, index)">
|
|
36
44
|
<i class="fas fa-edit"></i>
|
|
37
45
|
</button>
|
|
38
46
|
<div class="sortable-item-vr"></div>
|
|
@@ -55,6 +63,7 @@ export default {
|
|
|
55
63
|
},
|
|
56
64
|
data() {
|
|
57
65
|
return {
|
|
66
|
+
originalName: '',
|
|
58
67
|
draggedItem: 0,
|
|
59
68
|
draggedOverItem: 0,
|
|
60
69
|
editRowIndex: null,
|
|
@@ -69,14 +78,40 @@ export default {
|
|
|
69
78
|
}
|
|
70
79
|
},
|
|
71
80
|
methods: {
|
|
72
|
-
|
|
73
|
-
|
|
81
|
+
validateState(name, item) {
|
|
82
|
+
const isEmpty = !name;
|
|
83
|
+
const isDuplicated = this.items
|
|
84
|
+
.filter((i) => i !== item)
|
|
85
|
+
.find((i) => i.name === name);
|
|
86
|
+
return isEmpty || isDuplicated ? false : null;
|
|
74
87
|
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return;
|
|
88
|
+
validateError(name, item) {
|
|
89
|
+
const isEmpty = !name;
|
|
90
|
+
if (!isEmpty) {
|
|
91
|
+
return this.$t("The Page Name field is required.");
|
|
92
|
+
}
|
|
93
|
+
const isDuplicated = this.items
|
|
94
|
+
.filter((i) => i !== item)
|
|
95
|
+
.find((i) => i.name === name);
|
|
96
|
+
if (isDuplicated) {
|
|
97
|
+
return this.$t('Must be unique.');
|
|
98
|
+
}
|
|
99
|
+
return '';
|
|
100
|
+
},
|
|
101
|
+
onFocus(name, item) {
|
|
102
|
+
this.originalName = name;
|
|
103
|
+
},
|
|
104
|
+
async onBlur(name, item) {
|
|
105
|
+
if (this.validateState(name, item) === false) {
|
|
106
|
+
// eslint-disable-next-line no-param-reassign
|
|
107
|
+
item.name = this.originalName;
|
|
79
108
|
}
|
|
109
|
+
await this.$nextTick();
|
|
110
|
+
setTimeout(() => {
|
|
111
|
+
this.editRowIndex = null;
|
|
112
|
+
}, 250);
|
|
113
|
+
},
|
|
114
|
+
onClick(item, index) {
|
|
80
115
|
this.editRowIndex = index;
|
|
81
116
|
this.$emit("item-edit", item);
|
|
82
117
|
},
|