@processmaker/screen-builder 2.24.1 → 2.26.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.common.js +11345 -11654
- package/dist/vue-form-builder.common.js.map +1 -1
- package/dist/vue-form-builder.css +1 -1
- package/dist/vue-form-builder.umd.js +11345 -11654
- package/dist/vue-form-builder.umd.js.map +1 -1
- package/dist/vue-form-builder.umd.min.js +17 -17
- package/dist/vue-form-builder.umd.min.js.map +1 -1
- package/package-lock.json +9 -4
- package/package.json +4 -3
- package/src/App.vue +10 -0
- package/src/DataProvider.js +4 -0
- package/src/ValidationsFactory.js +17 -15
- package/src/components/inspector/screen-selector.vue +5 -1
- package/src/components/renderer/file-download.vue +35 -93
- package/src/components/renderer/file-upload.vue +0 -19
- package/src/components/renderer/form-button.vue +23 -28
- package/src/components/renderer/form-record-list.vue +23 -30
- package/src/components/screen-renderer.vue +1 -2
- package/src/components/task.vue +9 -2
- package/src/components/vue-form-builder.vue +15 -1
- package/src/components/vue-form-renderer.vue +9 -0
- package/src/form-builder-controls.js +3 -1
- package/src/mixins/Json2Vue.js +3 -0
- package/src/mixins/extensions/DataManager.js +1 -1
- package/src/mixins/multiselectApi.js +3 -1
- package/src/store/modules/global-errors.js +30 -0
|
@@ -21,12 +21,11 @@
|
|
|
21
21
|
:fields="tableFields"
|
|
22
22
|
:items="tableData.data"
|
|
23
23
|
:sort-compare-options="{ numeric: false }"
|
|
24
|
+
:sort-null-last="true"
|
|
24
25
|
sort-icon-left
|
|
25
26
|
:css="css"
|
|
26
27
|
:empty-text="$t('No Data Available')"
|
|
27
28
|
:current-page="currentPage"
|
|
28
|
-
@sort-changed="sortChanged"
|
|
29
|
-
@input="onInput"
|
|
30
29
|
data-cy="table"
|
|
31
30
|
>
|
|
32
31
|
<template #cell()="{index,field,item}">
|
|
@@ -40,13 +39,13 @@
|
|
|
40
39
|
{{ formatIfDate(mustache(field.key, item)) }}
|
|
41
40
|
</template>
|
|
42
41
|
</template>
|
|
43
|
-
<template #cell(__actions)="{index}">
|
|
42
|
+
<template #cell(__actions)="{index,item}">
|
|
44
43
|
<div class="actions">
|
|
45
44
|
<div class="btn-group btn-group-sm" role="group" aria-label="Actions">
|
|
46
|
-
<button @click="showEditForm(index)" class="btn btn-primary" :title="$t('Edit')" data-cy="edit-row">
|
|
45
|
+
<button @click="showEditForm(index, item.row_id)" class="btn btn-primary" :title="$t('Edit')" data-cy="edit-row">
|
|
47
46
|
<i class="fas fa-edit"/>
|
|
48
47
|
</button>
|
|
49
|
-
<button @click="showDeleteConfirmation(index)" class="btn btn-danger" :title="$t('Delete')" data-cy="remove-row">
|
|
48
|
+
<button @click="showDeleteConfirmation(index, item.row_id)" class="btn btn-danger" :title="$t('Delete')" data-cy="remove-row">
|
|
50
49
|
<i class="fas fa-trash-alt"/>
|
|
51
50
|
</button>
|
|
52
51
|
</div>
|
|
@@ -90,6 +89,7 @@
|
|
|
90
89
|
debug-context="Record List Add"
|
|
91
90
|
:key="Array.isArray(value) ? value.length : 0"
|
|
92
91
|
:_parent="validationData"
|
|
92
|
+
@update="updateRowDataNamePrefix"
|
|
93
93
|
/>
|
|
94
94
|
</b-modal>
|
|
95
95
|
<b-modal
|
|
@@ -116,6 +116,7 @@
|
|
|
116
116
|
debug-context="Record List Edit"
|
|
117
117
|
:_parent="validationData"
|
|
118
118
|
:key="editFormVersion"
|
|
119
|
+
@update="updateRowDataNamePrefix"
|
|
119
120
|
/>
|
|
120
121
|
</b-modal>
|
|
121
122
|
<b-modal
|
|
@@ -195,12 +196,14 @@ export default {
|
|
|
195
196
|
},
|
|
196
197
|
},
|
|
197
198
|
initFormValues: {},
|
|
199
|
+
currentRowIndex: null,
|
|
198
200
|
};
|
|
199
201
|
},
|
|
200
202
|
mounted() {
|
|
201
203
|
if (this._perPage) {
|
|
202
204
|
this.perPage = this._perPage;
|
|
203
205
|
}
|
|
206
|
+
this.updateRowDataNamePrefix = _.debounce(this.updateRowDataNamePrefix, 100);
|
|
204
207
|
},
|
|
205
208
|
computed: {
|
|
206
209
|
popupConfig() {
|
|
@@ -280,20 +283,8 @@ export default {
|
|
|
280
283
|
},
|
|
281
284
|
},
|
|
282
285
|
methods: {
|
|
283
|
-
|
|
284
|
-
this.
|
|
285
|
-
this.tableData.data = this.sort(this.tableData.data, payload);
|
|
286
|
-
},
|
|
287
|
-
onInput() {
|
|
288
|
-
if (this.lastSortConfig) {
|
|
289
|
-
this.tableData.data = this.sort(this.tableData.data, this.lastSortConfig);
|
|
290
|
-
}
|
|
291
|
-
},
|
|
292
|
-
sort(data, options) {
|
|
293
|
-
if (options.sortDesc) {
|
|
294
|
-
return data.sort((b,a) => a[options.sortBy].localeCompare(b[options.sortBy], 0, {numeric: false}));
|
|
295
|
-
}
|
|
296
|
-
return data.sort((a,b) => a[options.sortBy].localeCompare(b[options.sortBy], 0, {numeric: false}));
|
|
286
|
+
updateRowDataNamePrefix() {
|
|
287
|
+
this.setUploadDataNamePrefix(this.currentRowIndex);
|
|
297
288
|
},
|
|
298
289
|
emitShownEvent() {
|
|
299
290
|
window.ProcessMaker.EventBus.$emit('modal-shown');
|
|
@@ -309,6 +300,7 @@ export default {
|
|
|
309
300
|
return field.key === '__filedownload';
|
|
310
301
|
},
|
|
311
302
|
setUploadDataNamePrefix(index = null) {
|
|
303
|
+
this.currentRowIndex = index;
|
|
312
304
|
let rowId = null;
|
|
313
305
|
if (index !== null && this.editItem) {
|
|
314
306
|
rowId = this.editItem.row_id;
|
|
@@ -375,10 +367,10 @@ export default {
|
|
|
375
367
|
this.paginatorPage = this.lastPage;
|
|
376
368
|
}
|
|
377
369
|
},
|
|
378
|
-
showEditForm(index) {
|
|
370
|
+
showEditForm(index, rowId) {
|
|
379
371
|
let pageIndex = ((this.currentPage-1) * this.perPage) + index;
|
|
380
372
|
// Reset edit to be a copy of our data model item
|
|
381
|
-
this.editItem =
|
|
373
|
+
this.editItem = _.find(this.tableData.data, {'row_id': rowId});
|
|
382
374
|
this.editIndex = pageIndex;
|
|
383
375
|
// rebuild the edit screen to avoid
|
|
384
376
|
this.editFormVersion++;
|
|
@@ -395,10 +387,11 @@ export default {
|
|
|
395
387
|
|
|
396
388
|
// Edit the item in our model and emit change
|
|
397
389
|
let data = this.tableData.data ? JSON.parse(JSON.stringify(this.tableData.data)) : [];
|
|
398
|
-
|
|
390
|
+
var index = _.findIndex(data, {'row_id': this.editItem.rowId});
|
|
391
|
+
data[index] = JSON.parse(JSON.stringify(this.editItem));
|
|
399
392
|
|
|
400
393
|
// Remove the parent object
|
|
401
|
-
delete data[
|
|
394
|
+
delete data[index]._parent;
|
|
402
395
|
|
|
403
396
|
// Emit the newly updated data model
|
|
404
397
|
this.$emit('input', data);
|
|
@@ -428,8 +421,7 @@ export default {
|
|
|
428
421
|
// Add the item to our model and emit change
|
|
429
422
|
// @todo Also check that value is an array type, if not, reset it to an array
|
|
430
423
|
let data = this.value ? JSON.parse(JSON.stringify(this.value)) : [];
|
|
431
|
-
|
|
432
|
-
const item = JSON.parse(JSON.stringify(this.addItem));
|
|
424
|
+
const item = JSON.parse(JSON.stringify({...this.addItem, _parent: undefined }));
|
|
433
425
|
delete item._parent;
|
|
434
426
|
data[data.length] = item;
|
|
435
427
|
|
|
@@ -443,9 +435,8 @@ export default {
|
|
|
443
435
|
this.$refs.addModal.hide();
|
|
444
436
|
});
|
|
445
437
|
},
|
|
446
|
-
showDeleteConfirmation(index) {
|
|
447
|
-
|
|
448
|
-
this.deleteIndex = pageIndex;
|
|
438
|
+
showDeleteConfirmation(index, rowId) {
|
|
439
|
+
this.deleteIndex = _.find(this.tableData.data, {'row_id': rowId});
|
|
449
440
|
this.$refs.deleteModal.show();
|
|
450
441
|
},
|
|
451
442
|
downloadFile(rowData, rowField, rowIndex) {
|
|
@@ -482,9 +473,11 @@ export default {
|
|
|
482
473
|
// Add the item to our model and emit change
|
|
483
474
|
// @todo Also check that value is an array type, if not, reset it to an array
|
|
484
475
|
let data = this.tableData.data ? JSON.parse(JSON.stringify(this.tableData.data)) : [];
|
|
485
|
-
let recordData =
|
|
476
|
+
let recordData = this.deleteIndex;
|
|
486
477
|
// Remove item from data array
|
|
487
|
-
|
|
478
|
+
_.remove(data, {
|
|
479
|
+
'row_id': this.deleteIndex.row_id,
|
|
480
|
+
});
|
|
488
481
|
// Emit the newly updated data model
|
|
489
482
|
this.$emit('input', data);
|
|
490
483
|
this.$root.$emit('removed-record', this, recordData);
|
|
@@ -26,7 +26,7 @@ import Json2Vue from '../mixins/Json2Vue';
|
|
|
26
26
|
import CurrentPageProperty from '../mixins/CurrentPageProperty';
|
|
27
27
|
import WatchersSynchronous from '@/components/watchers-synchronous';
|
|
28
28
|
import ScreenRendererError from '../components/renderer/screen-renderer-error';
|
|
29
|
-
import { cloneDeep, isEqual
|
|
29
|
+
import { cloneDeep, isEqual } from 'lodash';
|
|
30
30
|
|
|
31
31
|
export default {
|
|
32
32
|
name: 'screen-renderer',
|
|
@@ -43,7 +43,6 @@ export default {
|
|
|
43
43
|
mounted() {
|
|
44
44
|
this.currentDefinition = cloneDeep(this.definition);
|
|
45
45
|
this.component = this.buildComponent(this.currentDefinition);
|
|
46
|
-
this.rebuildScreen = debounce(this.rebuildScreen, 25);
|
|
47
46
|
},
|
|
48
47
|
watch: {
|
|
49
48
|
definition: {
|
package/src/components/task.vue
CHANGED
|
@@ -8,6 +8,13 @@
|
|
|
8
8
|
<template v-if="screen">
|
|
9
9
|
<div class="card card-body border-top-0 h-100" :class="screenTypeClass">
|
|
10
10
|
<div v-if="renderComponent === 'task-screen'">
|
|
11
|
+
<div v-if="$store.getters['globalErrorsModule/isValidScreen'] === false" class="alert alert-danger mt-3">
|
|
12
|
+
<i class="fas fa-exclamation-circle"/>
|
|
13
|
+
{{ $store.getters['globalErrorsModule/getErrorMessage'] }}
|
|
14
|
+
<button type="button" class="close" aria-label="Close" @click="$store.dispatch('globalErrorsModule/close')">
|
|
15
|
+
<span aria-hidden="true">×</span>
|
|
16
|
+
</button>
|
|
17
|
+
</div>
|
|
11
18
|
<vue-form-renderer
|
|
12
19
|
ref="renderer"
|
|
13
20
|
v-model="requestData"
|
|
@@ -326,8 +333,8 @@ export default {
|
|
|
326
333
|
}
|
|
327
334
|
this.taskId = task.id;
|
|
328
335
|
this.nodeId = task.element_id;
|
|
329
|
-
} else {
|
|
330
|
-
this.$emit('completed',
|
|
336
|
+
} else if (this.parentRequest) {
|
|
337
|
+
this.$emit('completed', this.parentRequest);
|
|
331
338
|
}
|
|
332
339
|
});
|
|
333
340
|
},
|
|
@@ -102,6 +102,7 @@
|
|
|
102
102
|
class="h-100"
|
|
103
103
|
ghost-class="form-control-ghost"
|
|
104
104
|
:value="config[currentPage].items"
|
|
105
|
+
:key="editorContentKey"
|
|
105
106
|
@input="updateConfig"
|
|
106
107
|
v-bind="{
|
|
107
108
|
group: {name: 'controls'},
|
|
@@ -311,6 +312,7 @@ import * as renderer from './renderer';
|
|
|
311
312
|
import * as inspector from './inspector';
|
|
312
313
|
import '@processmaker/vue-form-elements/dist/vue-form-elements.css';
|
|
313
314
|
import undoRedoModule from '../undoRedoModule';
|
|
315
|
+
import globalErrorsModule from '@/store/modules/global-errors';
|
|
314
316
|
import accordions from './accordions';
|
|
315
317
|
import { keyNameProperty } from '../form-control-common-properties';
|
|
316
318
|
import VariableNameGenerator from '@/components/VariableNameGenerator';
|
|
@@ -437,6 +439,7 @@ export default {
|
|
|
437
439
|
variablesTree: [],
|
|
438
440
|
language: 'en',
|
|
439
441
|
collator: null,
|
|
442
|
+
editorContentKey: 0,
|
|
440
443
|
};
|
|
441
444
|
},
|
|
442
445
|
computed: {
|
|
@@ -511,6 +514,9 @@ export default {
|
|
|
511
514
|
},
|
|
512
515
|
},
|
|
513
516
|
methods: {
|
|
517
|
+
refreshContent() {
|
|
518
|
+
this.editorContentKey++;
|
|
519
|
+
},
|
|
514
520
|
loadVariablesTree() {
|
|
515
521
|
const definition = {
|
|
516
522
|
config : this.$parent.config,
|
|
@@ -810,6 +816,13 @@ export default {
|
|
|
810
816
|
}
|
|
811
817
|
this.collator = Intl.Collator(this.language);
|
|
812
818
|
},
|
|
819
|
+
registerStoreModule(moduleName, storeModule) {
|
|
820
|
+
const store = this.$store;
|
|
821
|
+
|
|
822
|
+
if (!(store && store.state && store.state[moduleName])) {
|
|
823
|
+
store.registerModule(moduleName, storeModule);
|
|
824
|
+
}
|
|
825
|
+
},
|
|
813
826
|
},
|
|
814
827
|
created() {
|
|
815
828
|
this.loadVariablesTree = _.debounce(this.loadVariablesTree, 2000);
|
|
@@ -823,7 +836,8 @@ export default {
|
|
|
823
836
|
},
|
|
824
837
|
this.$t('Must be unique')
|
|
825
838
|
);
|
|
826
|
-
this
|
|
839
|
+
this.registerStoreModule('globalErrorsModule', globalErrorsModule);
|
|
840
|
+
this.registerStoreModule('undoRedoModule', undoRedoModule);
|
|
827
841
|
this.$store.dispatch('undoRedoModule/pushState', {'config': JSON.stringify(this.config), 'currentPage': this.currentPage});
|
|
828
842
|
this.initiateLanguageSupport();
|
|
829
843
|
},
|
|
@@ -13,6 +13,7 @@ import Inputmask from 'inputmask';
|
|
|
13
13
|
import { getItemsFromConfig } from '../itemProcessingUtils';
|
|
14
14
|
import { ValidatorFactory } from '../factories/ValidatorFactory';
|
|
15
15
|
import CurrentPageProperty from '../mixins/CurrentPageProperty';
|
|
16
|
+
import globalErrorsModule from '@/store/modules/global-errors';
|
|
16
17
|
|
|
17
18
|
const csstree = require('css-tree');
|
|
18
19
|
const Scrollparent = require('scrollparent');
|
|
@@ -107,6 +108,7 @@ export default {
|
|
|
107
108
|
},
|
|
108
109
|
},
|
|
109
110
|
created() {
|
|
111
|
+
this.registerStoreModule('globalErrorsModule', globalErrorsModule);
|
|
110
112
|
this.parseCss = _.debounce(this.parseCss, 500, {leading: true});
|
|
111
113
|
},
|
|
112
114
|
mounted() {
|
|
@@ -118,6 +120,13 @@ export default {
|
|
|
118
120
|
this.scrollable = Scrollparent(this.$el);
|
|
119
121
|
},
|
|
120
122
|
methods: {
|
|
123
|
+
registerStoreModule(moduleName, storeModule) {
|
|
124
|
+
const store = this.$store;
|
|
125
|
+
|
|
126
|
+
if (!(store && store.state && store.state[moduleName])) {
|
|
127
|
+
store.registerModule(moduleName, storeModule);
|
|
128
|
+
}
|
|
129
|
+
},
|
|
121
130
|
countElements(config) {
|
|
122
131
|
const definition = { config };
|
|
123
132
|
return this.$refs.renderer.countElements(definition);
|
|
@@ -283,6 +283,7 @@ export default [
|
|
|
283
283
|
type: 'FormInput',
|
|
284
284
|
field: 'minDate',
|
|
285
285
|
config: {
|
|
286
|
+
name: 'Minimum Date',
|
|
286
287
|
label: 'Minimum Date',
|
|
287
288
|
validation: 'date_or_mustache',
|
|
288
289
|
},
|
|
@@ -291,8 +292,9 @@ export default [
|
|
|
291
292
|
type: 'FormInput',
|
|
292
293
|
field: 'maxDate',
|
|
293
294
|
config: {
|
|
295
|
+
name: 'Maximum Date',
|
|
294
296
|
label: 'Maximum Date',
|
|
295
|
-
validation: 'date_or_mustache',
|
|
297
|
+
validation: 'after_min_date|date_or_mustache',
|
|
296
298
|
},
|
|
297
299
|
},
|
|
298
300
|
keyNameProperty,
|
package/src/mixins/Json2Vue.js
CHANGED
|
@@ -3,7 +3,7 @@ import _ from 'lodash';
|
|
|
3
3
|
export default {
|
|
4
4
|
methods: {
|
|
5
5
|
dataFields(screen, definition) {
|
|
6
|
-
this.variables.filter(v => !this.isComputedVariable(v.name, definition))
|
|
6
|
+
this.variables.filter(v => (!v.name.startsWith('_parent') && !v.name.includes('._parent.') && !this.isComputedVariable(v.name, definition)))
|
|
7
7
|
.forEach(v => {
|
|
8
8
|
let component = _.get(v, 'element.component');
|
|
9
9
|
let dataFormat = _.get(v, 'config.dataFormat', null);
|
|
@@ -31,6 +31,7 @@ export default {
|
|
|
31
31
|
pmql: null,
|
|
32
32
|
options: [],
|
|
33
33
|
selectedOption: null,
|
|
34
|
+
fields: null,
|
|
34
35
|
};
|
|
35
36
|
},
|
|
36
37
|
watch: {
|
|
@@ -50,8 +51,9 @@ export default {
|
|
|
50
51
|
},
|
|
51
52
|
loadOptions(filter) {
|
|
52
53
|
const pmql = this.pmql;
|
|
54
|
+
const fields = this.fields || undefined;
|
|
53
55
|
window.ProcessMaker.apiClient
|
|
54
|
-
.get(this.api, { params: { filter, pmql } })
|
|
56
|
+
.get(this.api, { params: { filter, pmql, fields } })
|
|
55
57
|
.then(response => {
|
|
56
58
|
this.options = response.data.data || [];
|
|
57
59
|
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const namespaced = true;
|
|
2
|
+
const globalErrorsModule = {
|
|
3
|
+
namespaced,
|
|
4
|
+
state: () => {
|
|
5
|
+
return {
|
|
6
|
+
valid: true,
|
|
7
|
+
message: '',
|
|
8
|
+
};
|
|
9
|
+
},
|
|
10
|
+
getters: {
|
|
11
|
+
isValidScreen(state) {
|
|
12
|
+
return state.valid;
|
|
13
|
+
},
|
|
14
|
+
getErrorMessage(state) {
|
|
15
|
+
return state.message;
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
mutations: {
|
|
19
|
+
basic(state, payload) {
|
|
20
|
+
state[payload.key] = payload.value;
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
actions: {
|
|
24
|
+
close({ commit }) {
|
|
25
|
+
commit('basic', { key: 'valid', value: true });
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default globalErrorsModule;
|