@processmaker/screen-builder 3.2.0 → 3.3.0
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 +4867 -4849
- package/dist/vue-form-builder.es.js.map +1 -1
- package/dist/vue-form-builder.umd.js +37 -37
- package/dist/vue-form-builder.umd.js.map +1 -1
- package/package.json +3 -3
- package/src/App.vue +12 -4
- package/src/components/inspector/collection-data-source.vue +153 -155
- package/src/components/inspector/collection-display-mode.vue +41 -59
- package/src/components/inspector/column-setup.vue +2 -3
- package/src/components/inspector/options-list.vue +21 -11
- package/src/components/renderer/form-collection-record-control.vue +112 -73
- package/src/components/task.vue +2 -0
- package/src/components/vue-form-builder.vue +9 -4
- package/src/form-builder-controls.js +4 -0
- package/src/main.js +3 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<vue-form-renderer
|
|
3
3
|
ref="collectionRecordControl"
|
|
4
|
+
v-model="data"
|
|
4
5
|
class="form-collection-record-control"
|
|
5
6
|
:placeholder="placeholder"
|
|
6
|
-
v-model="data"
|
|
7
7
|
mode="preview"
|
|
8
8
|
:config="validatedConfig"
|
|
9
9
|
:computed="computed"
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
</template>
|
|
15
15
|
|
|
16
16
|
<script>
|
|
17
|
+
import _ from "lodash";
|
|
17
18
|
import VueFormRenderer from "../vue-form-renderer.vue";
|
|
18
19
|
import CollectionRecordsList from "../inspector/collection-records-list.vue";
|
|
19
|
-
import _ from 'lodash';
|
|
20
20
|
|
|
21
21
|
const globalObject = typeof window === "undefined" ? global : window;
|
|
22
22
|
|
|
@@ -43,7 +43,7 @@ export default {
|
|
|
43
43
|
collectionmode: {
|
|
44
44
|
type: Object
|
|
45
45
|
},
|
|
46
|
-
taskdraft: Object
|
|
46
|
+
taskdraft: Object
|
|
47
47
|
},
|
|
48
48
|
data() {
|
|
49
49
|
return {
|
|
@@ -55,7 +55,7 @@ export default {
|
|
|
55
55
|
screenTitle: null,
|
|
56
56
|
selCollectionId: Number,
|
|
57
57
|
selRecordId: Number,
|
|
58
|
-
selDisplayMode:
|
|
58
|
+
selDisplayMode: "Edit",
|
|
59
59
|
screenCollectionId: null,
|
|
60
60
|
placeholder: "Select a collection",
|
|
61
61
|
screenType: "",
|
|
@@ -72,21 +72,91 @@ export default {
|
|
|
72
72
|
},
|
|
73
73
|
data: {
|
|
74
74
|
get() {
|
|
75
|
-
if(this.hasMustache) {
|
|
75
|
+
if (this.hasMustache) {
|
|
76
76
|
this.clearDataObject();
|
|
77
77
|
}
|
|
78
78
|
return this.localData;
|
|
79
79
|
},
|
|
80
80
|
set(data) {
|
|
81
81
|
Object.keys(data).forEach((variable) => {
|
|
82
|
-
this.validationData &&
|
|
82
|
+
this.validationData &&
|
|
83
|
+
this.$set(this.validationData, variable, data[variable]);
|
|
83
84
|
});
|
|
84
85
|
if (this.collection) {
|
|
85
|
-
this.$set(
|
|
86
|
-
|
|
86
|
+
this.$set(
|
|
87
|
+
this.collection,
|
|
88
|
+
"data",
|
|
89
|
+
Array.isArray(data) ? data : [data]
|
|
90
|
+
);
|
|
91
|
+
this.$set(this.collection, "screen", this.screenCollectionId);
|
|
87
92
|
}
|
|
88
|
-
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
watch: {
|
|
97
|
+
collection(collection) {
|
|
98
|
+
if (collection) {
|
|
99
|
+
this.selCollectionId = collection.collectionId;
|
|
100
|
+
const currentData = this.localData;
|
|
101
|
+
this.$set(
|
|
102
|
+
collection,
|
|
103
|
+
"data",
|
|
104
|
+
Array.isArray(currentData) ? currentData : [currentData]
|
|
105
|
+
);
|
|
106
|
+
this.$set(collection, "screen", this.screenCollectionId);
|
|
107
|
+
}
|
|
89
108
|
},
|
|
109
|
+
record(record) {
|
|
110
|
+
this.hasMustache = false;
|
|
111
|
+
this.enableDraft = false;
|
|
112
|
+
if (
|
|
113
|
+
record &&
|
|
114
|
+
!isNaN(record) &&
|
|
115
|
+
record > 0 &&
|
|
116
|
+
this.collection.collectionId
|
|
117
|
+
) {
|
|
118
|
+
this.selRecordId = record;
|
|
119
|
+
this.loadRecordCollection(
|
|
120
|
+
this.collection.collectionId,
|
|
121
|
+
record,
|
|
122
|
+
this.selDisplayMode
|
|
123
|
+
);
|
|
124
|
+
} else {
|
|
125
|
+
if (this.isMustache(record)) {
|
|
126
|
+
this.callbackRecord();
|
|
127
|
+
}
|
|
128
|
+
this.localData = {};
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
collectionmode(collectionmode) {
|
|
132
|
+
if (collectionmode) {
|
|
133
|
+
this.selDisplayMode = collectionmode.modeId;
|
|
134
|
+
}
|
|
135
|
+
this.loadRecordCollection(
|
|
136
|
+
this.selCollectionId,
|
|
137
|
+
this.selRecordId,
|
|
138
|
+
this.selDisplayMode
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
mounted() {
|
|
143
|
+
this.$root.$on("taskdraft-input", (val) => {
|
|
144
|
+
this.taskDraft = val;
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
if (this.collection && this.record) {
|
|
148
|
+
const recordId = this.isMustache(this.record)
|
|
149
|
+
? this.defaultColumnsRecordId
|
|
150
|
+
: this.record;
|
|
151
|
+
if (this.isMustache(this.record)) {
|
|
152
|
+
this.hasMustache = true;
|
|
153
|
+
}
|
|
154
|
+
this.loadRecordCollection(
|
|
155
|
+
this.collection.collectionId,
|
|
156
|
+
recordId,
|
|
157
|
+
this.collectionmode.modeId
|
|
158
|
+
);
|
|
159
|
+
}
|
|
90
160
|
},
|
|
91
161
|
methods: {
|
|
92
162
|
isSubmitButton(item) {
|
|
@@ -98,17 +168,17 @@ export default {
|
|
|
98
168
|
},
|
|
99
169
|
hideSubmitButtons(config) {
|
|
100
170
|
config.forEach((item) => {
|
|
101
|
-
//If the element has containers
|
|
171
|
+
// If the element has containers
|
|
102
172
|
if (Array.isArray(item)) {
|
|
103
173
|
this.hideSubmitButtons(item);
|
|
104
174
|
}
|
|
105
175
|
|
|
106
|
-
//If the element has items
|
|
176
|
+
// If the element has items
|
|
107
177
|
if (item.items) {
|
|
108
178
|
this.hideSubmitButtons(item.items);
|
|
109
179
|
}
|
|
110
180
|
|
|
111
|
-
//hidden buttons
|
|
181
|
+
// hidden buttons
|
|
112
182
|
if (this.isSubmitButton(item)) {
|
|
113
183
|
item.config.hidden = true;
|
|
114
184
|
}
|
|
@@ -116,17 +186,17 @@ export default {
|
|
|
116
186
|
},
|
|
117
187
|
disableForm(config) {
|
|
118
188
|
config.forEach((item) => {
|
|
119
|
-
//If the element has containers
|
|
189
|
+
// If the element has containers
|
|
120
190
|
if (Array.isArray(item)) {
|
|
121
191
|
this.disableForm(item);
|
|
122
192
|
}
|
|
123
193
|
|
|
124
|
-
//If the element has items
|
|
194
|
+
// If the element has items
|
|
125
195
|
if (item.items) {
|
|
126
196
|
this.disableForm(item.items);
|
|
127
197
|
}
|
|
128
198
|
|
|
129
|
-
//Disable element
|
|
199
|
+
// Disable element
|
|
130
200
|
if (item && item.config) {
|
|
131
201
|
item.config.disabled = true;
|
|
132
202
|
item.config.readonly = true;
|
|
@@ -149,7 +219,7 @@ export default {
|
|
|
149
219
|
this.watchers = response.data.watchers;
|
|
150
220
|
this.screenTitle = response.data.title;
|
|
151
221
|
|
|
152
|
-
if (this.$attrs
|
|
222
|
+
if (this.$attrs.disabled) {
|
|
153
223
|
this.disableForm(this.config);
|
|
154
224
|
}
|
|
155
225
|
});
|
|
@@ -174,81 +244,50 @@ export default {
|
|
|
174
244
|
const respData = response.data;
|
|
175
245
|
const viewScreen = response.collection.read_screen_id;
|
|
176
246
|
const editScreen = response.collection.update_screen_id;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
247
|
+
// Choose screen id regarding of the display Mode
|
|
248
|
+
this.screenCollectionId =
|
|
249
|
+
typeof this.selDisplayMode === "function"
|
|
250
|
+
? this.collectionmode.modeId === "View"
|
|
251
|
+
? viewScreen
|
|
252
|
+
: editScreen
|
|
253
|
+
: this.selDisplayMode === "View"
|
|
254
|
+
? viewScreen
|
|
255
|
+
: editScreen;
|
|
182
256
|
this.loadScreen(this.screenCollectionId);
|
|
183
|
-
|
|
184
|
-
//This section validates if Collection has draft data
|
|
185
|
-
if (
|
|
186
|
-
|
|
257
|
+
|
|
258
|
+
// This section validates if Collection has draft data
|
|
259
|
+
if (
|
|
260
|
+
this.taskDraft?.draft?.data == null ||
|
|
261
|
+
this.taskDraft.draft.data === "" ||
|
|
262
|
+
!this.enableDraft
|
|
263
|
+
) {
|
|
187
264
|
this.localData = respData;
|
|
188
|
-
}else{
|
|
265
|
+
} else {
|
|
189
266
|
this.localData = _.merge({}, respData, this.taskDraft.draft.data);
|
|
190
267
|
}
|
|
191
|
-
|
|
192
268
|
})
|
|
193
269
|
.catch(() => {
|
|
194
270
|
this.localData = {};
|
|
195
|
-
globalObject.ProcessMaker.alert(
|
|
271
|
+
globalObject.ProcessMaker.alert(
|
|
272
|
+
this.$t(
|
|
273
|
+
"This content does not exist. We could not locate indicated data"
|
|
274
|
+
),
|
|
275
|
+
"danger"
|
|
276
|
+
);
|
|
196
277
|
this.placeholder = "Select a collection";
|
|
197
|
-
})
|
|
278
|
+
});
|
|
198
279
|
},
|
|
199
280
|
isMustache(record) {
|
|
200
281
|
return /\{\{.*\}\}/.test(record);
|
|
201
282
|
},
|
|
202
283
|
clearDataObject() {
|
|
203
|
-
Object.keys(this.localData).forEach(key => {
|
|
284
|
+
Object.keys(this.localData).forEach((key) => {
|
|
204
285
|
if (key !== "id") {
|
|
205
286
|
this.localData[key] = "";
|
|
206
287
|
}
|
|
207
288
|
});
|
|
208
|
-
},
|
|
209
|
-
},
|
|
210
|
-
watch: {
|
|
211
|
-
collection(collection) {
|
|
212
|
-
if(collection) {
|
|
213
|
-
this.selCollectionId = collection.collectionId;
|
|
214
|
-
const currentData = this.localData;
|
|
215
|
-
this.$set(collection, 'data', Array.isArray(currentData) ? currentData : [currentData]);
|
|
216
|
-
this.$set(collection, 'screen', this.screenCollectionId);
|
|
217
|
-
}
|
|
218
|
-
},
|
|
219
|
-
record(record) {
|
|
220
|
-
this.hasMustache = false;
|
|
221
|
-
this.enableDraft = false;
|
|
222
|
-
if (record && !isNaN(record) && record > 0 && this.collection.collectionId) {
|
|
223
|
-
this.selRecordId = record;
|
|
224
|
-
this.loadRecordCollection(this.collection.collectionId, record, this.selDisplayMode);
|
|
225
|
-
} else {
|
|
226
|
-
if (this.isMustache(record)) {
|
|
227
|
-
this.callbackRecord();
|
|
228
|
-
}
|
|
229
|
-
this.localData = {};
|
|
230
|
-
}
|
|
231
|
-
},
|
|
232
|
-
collectionmode(collectionmode) {
|
|
233
|
-
if(collectionmode) {
|
|
234
|
-
this.selDisplayMode = collectionmode.modeId;
|
|
235
|
-
}
|
|
236
|
-
this.loadRecordCollection(this.selCollectionId, this.selRecordId, this.selDisplayMode);
|
|
237
|
-
},
|
|
238
|
-
},
|
|
239
|
-
mounted() {
|
|
240
|
-
this.$root.$on("taskdraft-input", (val)=>{
|
|
241
|
-
this.taskDraft = val;
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
if (this.collection && this.record) {
|
|
245
|
-
const recordId = this.isMustache(this.record) ? this.defaultColumnsRecordId : this.record;
|
|
246
|
-
if(this.isMustache(this.record)) {
|
|
247
|
-
this.hasMustache = true;
|
|
248
|
-
}
|
|
249
|
-
this.loadRecordCollection(this.collection.collectionId, recordId, this.collectionmode.modeId);
|
|
250
289
|
}
|
|
251
|
-
}
|
|
290
|
+
}
|
|
252
291
|
};
|
|
253
292
|
</script>
|
|
254
293
|
|
package/src/components/task.vue
CHANGED
|
@@ -250,6 +250,7 @@ export default {
|
|
|
250
250
|
this.renderComponent = 'simpleErrorMessage';
|
|
251
251
|
},
|
|
252
252
|
loadScreen(id) {
|
|
253
|
+
this.disabled = true;
|
|
253
254
|
let query = '?include=nested';
|
|
254
255
|
if (this.requestId) {
|
|
255
256
|
query += '&request_id=' + this.requestId;
|
|
@@ -257,6 +258,7 @@ export default {
|
|
|
257
258
|
|
|
258
259
|
this.$dataProvider.getScreen(id, query).then((response) => {
|
|
259
260
|
this.screen = response.data;
|
|
261
|
+
this.disabled = false;
|
|
260
262
|
});
|
|
261
263
|
},
|
|
262
264
|
reload() {
|
|
@@ -329,7 +329,7 @@
|
|
|
329
329
|
: null
|
|
330
330
|
"
|
|
331
331
|
@focusout.native="updateState"
|
|
332
|
-
|
|
332
|
+
|
|
333
333
|
/>
|
|
334
334
|
</div>
|
|
335
335
|
</div>
|
|
@@ -568,9 +568,10 @@ const globalObject = typeof window === "undefined" ? global : window;
|
|
|
568
568
|
if (
|
|
569
569
|
globalObject.ProcessMaker &&
|
|
570
570
|
globalObject.ProcessMaker.user &&
|
|
571
|
-
globalObject.ProcessMaker.user.lang
|
|
571
|
+
globalObject.ProcessMaker.user.lang &&
|
|
572
|
+
typeof globalObject.ProcessMaker.setValidatorLanguage === 'function'
|
|
572
573
|
) {
|
|
573
|
-
|
|
574
|
+
globalObject.ProcessMaker.setValidatorLanguage(Validator, globalObject.ProcessMaker.user.lang);
|
|
574
575
|
}
|
|
575
576
|
|
|
576
577
|
// Todo: Validation messages are not translated. These will need to be converted
|
|
@@ -1476,8 +1477,12 @@ export default {
|
|
|
1476
1477
|
}
|
|
1477
1478
|
|
|
1478
1479
|
// Generate Variable Name
|
|
1480
|
+
const keyNamePropertyToFind = _.cloneDeep(keyNameProperty);
|
|
1481
|
+
delete keyNamePropertyToFind.config.helper;
|
|
1482
|
+
delete keyNamePropertyToFind.config.label;
|
|
1483
|
+
|
|
1479
1484
|
if (
|
|
1480
|
-
_.findIndex(control.inspector,
|
|
1485
|
+
_.findIndex(control.inspector, keyNamePropertyToFind) !== -1 ||
|
|
1481
1486
|
control.component === "FormLoop"
|
|
1482
1487
|
) {
|
|
1483
1488
|
[this.variables, copy.config.name] = this.generator.generate(
|
package/src/main.js
CHANGED
|
@@ -163,6 +163,9 @@ window.ProcessMaker = {
|
|
|
163
163
|
app: {
|
|
164
164
|
url: `${protocol}//${hostname}:${port}` // Create a URL with the current port
|
|
165
165
|
},
|
|
166
|
+
setValidatorLanguage(language) {
|
|
167
|
+
window.ProcessMaker.user.lang = 'en';
|
|
168
|
+
},
|
|
166
169
|
apiClient: {
|
|
167
170
|
create() {
|
|
168
171
|
return this;
|