@processmaker/screen-builder 3.2.1 → 3.3.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 +4862 -4821
- 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-display-mode.vue +51 -55
- package/src/components/inspector/collection-records-list.vue +10 -6
- package/src/components/inspector/options-list.vue +21 -11
- package/src/components/renderer/form-collection-record-control.vue +118 -74
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@processmaker/screen-builder",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "VITE_COVERAGE=true vite",
|
|
6
6
|
"build": "vite build",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@fortawesome/fontawesome-free": "^5.6.1",
|
|
58
58
|
"@originjs/vite-plugin-commonjs": "^1.0.3",
|
|
59
59
|
"@panter/vue-i18next": "^0.15.2",
|
|
60
|
-
"@processmaker/vue-form-elements": "0.
|
|
60
|
+
"@processmaker/vue-form-elements": "0.64.0",
|
|
61
61
|
"@processmaker/vue-multiselect": "2.3.0",
|
|
62
62
|
"@storybook/addon-essentials": "^7.6.13",
|
|
63
63
|
"@storybook/addon-interactions": "^7.6.13",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
},
|
|
117
117
|
"peerDependencies": {
|
|
118
118
|
"@panter/vue-i18next": "^0.15.0",
|
|
119
|
-
"@processmaker/vue-form-elements": "0.
|
|
119
|
+
"@processmaker/vue-form-elements": "0.64.0",
|
|
120
120
|
"i18next": "^15.0.8",
|
|
121
121
|
"vue": "^2.6.12",
|
|
122
122
|
"vuex": "^3.1.1"
|
package/src/App.vue
CHANGED
|
@@ -340,6 +340,10 @@ import "./assets/css/tabs.css";
|
|
|
340
340
|
// To include another language in the Validator with variable processmaker
|
|
341
341
|
const globalObject = typeof window === "undefined" ? global : window;
|
|
342
342
|
|
|
343
|
+
if (typeof globalObject.ProcessMaker?.setValidatorLanguage === 'function') {
|
|
344
|
+
globalObject.ProcessMaker.setValidatorLanguage(Validator, globalObject.ProcessMaker.user.lang);
|
|
345
|
+
}
|
|
346
|
+
|
|
343
347
|
/* istanbul ignore next */
|
|
344
348
|
Validator.register(
|
|
345
349
|
"attr-value",
|
|
@@ -540,9 +544,11 @@ export default {
|
|
|
540
544
|
if (
|
|
541
545
|
globalObject.ProcessMaker &&
|
|
542
546
|
globalObject.ProcessMaker.user &&
|
|
543
|
-
globalObject.ProcessMaker.user.lang
|
|
547
|
+
globalObject.ProcessMaker.user.lang &&
|
|
548
|
+
typeof globalObject.ProcessMaker.setValidatorLanguage === 'function'
|
|
544
549
|
) {
|
|
545
|
-
Validator.useLang(globalObject.ProcessMaker.user.lang);
|
|
550
|
+
//Validator.useLang(globalObject.ProcessMaker.user.lang);
|
|
551
|
+
globalObject.ProcessMaker.setValidatorLanguage(Validator, globalObject.ProcessMaker.user.lang);
|
|
546
552
|
}
|
|
547
553
|
// Iterate through our initial config set, calling this.addControl
|
|
548
554
|
controlConfig.forEach((config) => {
|
|
@@ -672,9 +678,11 @@ export default {
|
|
|
672
678
|
if (
|
|
673
679
|
globalObject.ProcessMaker &&
|
|
674
680
|
globalObject.ProcessMaker.user &&
|
|
675
|
-
globalObject.ProcessMaker.user.lang
|
|
681
|
+
globalObject.ProcessMaker.user.lang &&
|
|
682
|
+
typeof globalObject.ProcessMaker.setValidatorLanguage === 'function'
|
|
676
683
|
) {
|
|
677
|
-
|
|
684
|
+
globalObject.ProcessMaker.setValidatorLanguage(Validator, globalObject.ProcessMaker.user.lang);
|
|
685
|
+
//Validator.useLang(globalObject.ProcessMaker.user.lang);
|
|
678
686
|
}
|
|
679
687
|
|
|
680
688
|
// Validation will not run until you call passes/fails on it
|
|
@@ -1,86 +1,82 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<div>
|
|
4
|
-
<label for="
|
|
4
|
+
<label for="collection-mode">{{ $t(label) }}</label>
|
|
5
5
|
<b-form-select
|
|
6
|
-
id="
|
|
7
|
-
v-model="
|
|
8
|
-
:options="
|
|
6
|
+
id="collection-mode"
|
|
7
|
+
v-model="mode"
|
|
8
|
+
:options="options"
|
|
9
9
|
data-cy="inspector-collection"
|
|
10
|
+
@change="saveFields"
|
|
10
11
|
/>
|
|
11
12
|
</div>
|
|
12
|
-
<div class="mt-2"
|
|
13
|
-
<b-form-checkbox v-model="submitCollectionCheck">
|
|
14
|
-
|
|
13
|
+
<div v-show="showCollectionCheck" class="mt-2">
|
|
14
|
+
<b-form-checkbox v-model="submitCollectionCheck" @change="saveFields">
|
|
15
|
+
{{ $t("Update collection on submit") }}
|
|
15
16
|
</b-form-checkbox>
|
|
16
17
|
</div>
|
|
17
18
|
</div>
|
|
18
19
|
</template>
|
|
19
20
|
|
|
20
21
|
<script>
|
|
21
|
-
import ScreenVariableSelector from "../screen-variable-selector.vue";
|
|
22
|
-
|
|
23
|
-
const CONFIG_FIELDS = ["modeId", "submitCollectionCheck"];
|
|
24
22
|
export default {
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
props: {
|
|
24
|
+
value: {
|
|
25
|
+
type: Object,
|
|
26
|
+
default: () => ({})
|
|
27
|
+
},
|
|
28
|
+
screenType: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: ""
|
|
31
|
+
},
|
|
32
|
+
options: {
|
|
33
|
+
type: Array,
|
|
34
|
+
default: () => []
|
|
35
|
+
},
|
|
36
|
+
label: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: ""
|
|
39
|
+
}
|
|
27
40
|
},
|
|
28
|
-
props: ["value", "screenType"],
|
|
29
41
|
data() {
|
|
30
42
|
return {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
displayOptions: []
|
|
43
|
+
mode: "",
|
|
44
|
+
submitCollectionCheck: null,
|
|
45
|
+
defaultMode: 'Edit',
|
|
35
46
|
};
|
|
36
47
|
},
|
|
37
|
-
mounted() {
|
|
38
|
-
this.getFields();
|
|
39
|
-
},
|
|
40
48
|
computed: {
|
|
41
|
-
|
|
42
|
-
return
|
|
43
|
-
CONFIG_FIELDS.map((field) => [field, this[field]])
|
|
44
|
-
);
|
|
49
|
+
showCollectionCheck() {
|
|
50
|
+
return this.mode === this.defaultMode;
|
|
45
51
|
}
|
|
46
52
|
},
|
|
47
53
|
watch: {
|
|
48
54
|
value: {
|
|
49
|
-
handler(
|
|
50
|
-
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
CONFIG_FIELDS.forEach((field) => (this[field] = value[field]));
|
|
55
|
+
handler(newValue) {
|
|
56
|
+
this.updateModeAndCollectionCheck(newValue);
|
|
54
57
|
},
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
modeId: {
|
|
58
|
-
handler() {
|
|
59
|
-
this.getFields();
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
submitCollectionCheck(newValue) {
|
|
63
|
-
this.submitCollectionCheck = newValue;
|
|
64
|
-
},
|
|
65
|
-
screenType: {
|
|
66
|
-
handler() {
|
|
67
|
-
this.getFields();
|
|
68
|
-
},
|
|
69
|
-
immediate: true
|
|
70
|
-
},
|
|
71
|
-
options: {
|
|
72
|
-
handler() {
|
|
73
|
-
this.$emit("input", this.options);
|
|
74
|
-
},
|
|
75
|
-
deep: true
|
|
58
|
+
deep: true,
|
|
76
59
|
}
|
|
77
60
|
},
|
|
61
|
+
mounted() {
|
|
62
|
+
// Set the default data
|
|
63
|
+
this.updateModeAndCollectionCheck(this.value);
|
|
64
|
+
},
|
|
78
65
|
methods: {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Update the mode and collection check value
|
|
68
|
+
*
|
|
69
|
+
* @param {Object} value
|
|
70
|
+
*/
|
|
71
|
+
updateModeAndCollectionCheck(value) {
|
|
72
|
+
this.mode = value.modeId || this.defaultMode;
|
|
73
|
+
this.submitCollectionCheck = value.submitCollectionCheck ?? true;
|
|
74
|
+
},
|
|
75
|
+
saveFields() {
|
|
76
|
+
this.$emit("input", {
|
|
77
|
+
modeId: this.mode,
|
|
78
|
+
submitCollectionCheck: this.submitCollectionCheck
|
|
79
|
+
});
|
|
84
80
|
}
|
|
85
81
|
}
|
|
86
82
|
};
|
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
data-cy="inspector-collection"
|
|
11
11
|
/>
|
|
12
12
|
<b-form-text class="mt-2">
|
|
13
|
-
{{ $t("Collection Record Control is not available for Anonymous Web Entry") }}
|
|
13
|
+
{{ $t("Collection Record Control is not available for Anonymous Web Entry") }}
|
|
14
14
|
</b-form-text>
|
|
15
15
|
</b-form-group>
|
|
16
16
|
</div>
|
|
17
17
|
<div v-if="collectionId > 0" class="screen-link mt-2">
|
|
18
|
-
<a
|
|
18
|
+
<a
|
|
19
19
|
:href="`/designer/screen-builder/${
|
|
20
20
|
screenMode === 'display' ? idCollectionScreenView : idCollectionScreenEdit
|
|
21
|
-
}/edit`"
|
|
21
|
+
}/edit`"
|
|
22
22
|
target="_blank">
|
|
23
23
|
{{ $t(screenMode === 'display' ? "Open View Screen" : "Open Edit Screen") }}
|
|
24
24
|
<i class="ml-1 fas fa-external-link-alt" />
|
|
@@ -67,11 +67,15 @@ export default {
|
|
|
67
67
|
},
|
|
68
68
|
watch: {
|
|
69
69
|
value: {
|
|
70
|
-
handler(
|
|
71
|
-
if (!
|
|
70
|
+
handler(newValue) {
|
|
71
|
+
if (!newValue) {
|
|
72
|
+
// Clear collection id
|
|
73
|
+
this.collectionId = null;
|
|
74
|
+
|
|
72
75
|
return;
|
|
73
76
|
}
|
|
74
|
-
|
|
77
|
+
|
|
78
|
+
CONFIG_FIELDS.forEach((field) => (this[field] = newValue[field]));
|
|
75
79
|
},
|
|
76
80
|
immediate: true
|
|
77
81
|
},
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
</div>
|
|
29
29
|
<label class="mt-3" for="option-content">{{ $t('Content') }}</label>
|
|
30
30
|
<b-form-input id="option-content" v-model="optionContent" data-cy="inspector-option-content" />
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
<label v-if="renderAs === 'checkbox'" class="mt-3" for="option-aria-label">{{ $t('Aria Label') }}</label>
|
|
33
33
|
<b-form-input v-if="renderAs === 'checkbox'" id="option-aria-label" v-model="optionAriaLabel" data-cy="inspector-option-aria-label" />
|
|
34
34
|
</div>
|
|
@@ -294,6 +294,7 @@ export default {
|
|
|
294
294
|
endpoints: {},
|
|
295
295
|
pmqlQuery: '',
|
|
296
296
|
optionsList: [],
|
|
297
|
+
optionsListExtra: [],
|
|
297
298
|
showOptionCard: false,
|
|
298
299
|
showRemoveWarning: false,
|
|
299
300
|
showJsonEditor: false,
|
|
@@ -401,6 +402,14 @@ export default {
|
|
|
401
402
|
this.selectedEndPoint = this.endPointList[0].value;
|
|
402
403
|
}
|
|
403
404
|
},
|
|
405
|
+
renderAs(val) {
|
|
406
|
+
if (this.dataSource === 'provideData') {
|
|
407
|
+
if (val !== 'dropdown') {
|
|
408
|
+
// add aria label field when renderAs is not dropdown
|
|
409
|
+
this.optionsListExtra = this.optionsList.map(option => ({...option, [this.ariaLabelField]: ''}));
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
404
413
|
},
|
|
405
414
|
computed: {
|
|
406
415
|
showTypeOfValueReturned() {
|
|
@@ -460,6 +469,7 @@ export default {
|
|
|
460
469
|
defaultOptionKey: this.defaultOptionKey,
|
|
461
470
|
selectedOptions: this.selectedOptions,
|
|
462
471
|
optionsList: this.optionsList,
|
|
472
|
+
optionsListExtra: this.optionsListExtra,
|
|
463
473
|
showRenderAs: this.showRenderAs,
|
|
464
474
|
renderAs: this.renderAs,
|
|
465
475
|
allowMultiSelect: this.allowMultiSelect,
|
|
@@ -492,6 +502,7 @@ export default {
|
|
|
492
502
|
this.defaultOptionKey= this.options.defaultOptionKey;
|
|
493
503
|
this.selectedOptions = this.options.selectedOptions;
|
|
494
504
|
this.optionsList = this.options.optionsList ? this.options.optionsList : [];
|
|
505
|
+
this.optionsListExtra = this.options.optionsListExtra ? this.options.optionsListExtra : [];
|
|
495
506
|
this.jsonData = JSON.stringify(this.optionsList);
|
|
496
507
|
this.showRenderAs = this.options.showRenderAs;
|
|
497
508
|
this.renderAs = this.options.renderAs;
|
|
@@ -590,7 +601,7 @@ export default {
|
|
|
590
601
|
this.optionContent = this.optionsList[index][this.valueField];
|
|
591
602
|
this.optionValue = this.optionsList[index][this.keyField];
|
|
592
603
|
if (this.renderAs === "checkbox") {
|
|
593
|
-
this.optionAriaLabel = this.
|
|
604
|
+
this.optionAriaLabel = this.optionsListExtra[index][this.ariaLabelField];
|
|
594
605
|
}
|
|
595
606
|
this.optionError = '';
|
|
596
607
|
},
|
|
@@ -611,17 +622,16 @@ export default {
|
|
|
611
622
|
this.optionError = 'An item with the same key already exists';
|
|
612
623
|
return;
|
|
613
624
|
}
|
|
614
|
-
|
|
615
|
-
this.optionsList.push({
|
|
625
|
+
const newOption = {
|
|
616
626
|
[this.valueField]: this.optionContent,
|
|
617
627
|
[this.keyField]: this.optionValue,
|
|
618
|
-
|
|
619
|
-
|
|
628
|
+
};
|
|
629
|
+
if (this.renderAs === "checkbox") {
|
|
630
|
+
this.optionsList.push(newOption);
|
|
631
|
+
this.optionsListExtra.push({...newOption, [this.ariaLabelField]: this.optionAriaLabel});
|
|
632
|
+
|
|
620
633
|
} else {
|
|
621
|
-
this.optionsList.push(
|
|
622
|
-
[this.valueField]: this.optionContent,
|
|
623
|
-
[this.keyField]: this.optionValue
|
|
624
|
-
});
|
|
634
|
+
this.optionsList.push(newOption);
|
|
625
635
|
}
|
|
626
636
|
} else {
|
|
627
637
|
if (this.optionsList.find((item, index) => { return item[that.keyField] === this.optionValue && index !== this.editIndex ; })) {
|
|
@@ -631,7 +641,7 @@ export default {
|
|
|
631
641
|
this.optionsList[this.editIndex][this.keyField] = this.optionValue;
|
|
632
642
|
this.optionsList[this.editIndex][this.valueField] = this.optionContent;
|
|
633
643
|
if (this.renderAs === "checkbox") {
|
|
634
|
-
this.optionsList[this.editIndex][this.ariaLabelField]
|
|
644
|
+
this.optionsListExtra[this.editIndex] = {...this.optionsList[this.editIndex], [this.ariaLabelField]: this.optionAriaLabel};
|
|
635
645
|
}
|
|
636
646
|
}
|
|
637
647
|
|
|
@@ -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: "",
|
|
@@ -63,7 +63,8 @@ export default {
|
|
|
63
63
|
flagDraft: {},
|
|
64
64
|
taskDraft: {},
|
|
65
65
|
enableDraft: true,
|
|
66
|
-
defaultColumnsRecordId: 1
|
|
66
|
+
defaultColumnsRecordId: 1,
|
|
67
|
+
defaultCollectionMode: 'Edit',
|
|
67
68
|
};
|
|
68
69
|
},
|
|
69
70
|
computed: {
|
|
@@ -72,21 +73,95 @@ export default {
|
|
|
72
73
|
},
|
|
73
74
|
data: {
|
|
74
75
|
get() {
|
|
75
|
-
if(this.hasMustache) {
|
|
76
|
+
if (this.hasMustache) {
|
|
76
77
|
this.clearDataObject();
|
|
77
78
|
}
|
|
78
79
|
return this.localData;
|
|
79
80
|
},
|
|
80
81
|
set(data) {
|
|
81
82
|
Object.keys(data).forEach((variable) => {
|
|
82
|
-
this.validationData &&
|
|
83
|
+
this.validationData &&
|
|
84
|
+
this.$set(this.validationData, variable, data[variable]);
|
|
83
85
|
});
|
|
84
86
|
if (this.collection) {
|
|
85
|
-
this.$set(
|
|
86
|
-
|
|
87
|
+
this.$set(
|
|
88
|
+
this.collection,
|
|
89
|
+
"data",
|
|
90
|
+
Array.isArray(data) ? data : [data]
|
|
91
|
+
);
|
|
92
|
+
this.$set(this.collection, "screen", this.screenCollectionId);
|
|
87
93
|
}
|
|
88
|
-
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
watch: {
|
|
98
|
+
collection(collection) {
|
|
99
|
+
if (collection) {
|
|
100
|
+
this.selCollectionId = collection.collectionId;
|
|
101
|
+
const currentData = this.localData;
|
|
102
|
+
this.$set(
|
|
103
|
+
collection,
|
|
104
|
+
"data",
|
|
105
|
+
Array.isArray(currentData) ? currentData : [currentData]
|
|
106
|
+
);
|
|
107
|
+
this.$set(collection, "screen", this.screenCollectionId);
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
record(record) {
|
|
111
|
+
this.hasMustache = false;
|
|
112
|
+
this.enableDraft = false;
|
|
113
|
+
if (
|
|
114
|
+
record &&
|
|
115
|
+
!isNaN(record) &&
|
|
116
|
+
record > 0 &&
|
|
117
|
+
this.collection.collectionId
|
|
118
|
+
) {
|
|
119
|
+
this.selRecordId = record;
|
|
120
|
+
this.loadRecordCollection(
|
|
121
|
+
this.collection.collectionId,
|
|
122
|
+
record,
|
|
123
|
+
this.selDisplayMode
|
|
124
|
+
);
|
|
125
|
+
} else {
|
|
126
|
+
if (this.isMustache(record)) {
|
|
127
|
+
this.callbackRecord();
|
|
128
|
+
}
|
|
129
|
+
this.localData = {};
|
|
130
|
+
}
|
|
89
131
|
},
|
|
132
|
+
collectionmode(collectionmode) {
|
|
133
|
+
if (collectionmode) {
|
|
134
|
+
this.selDisplayMode = collectionmode.modeId;
|
|
135
|
+
}
|
|
136
|
+
this.loadRecordCollection(
|
|
137
|
+
this.selCollectionId,
|
|
138
|
+
this.selRecordId,
|
|
139
|
+
this.selDisplayMode
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
mounted() {
|
|
144
|
+
this.$root.$on("taskdraft-input", (val) => {
|
|
145
|
+
this.taskDraft = val;
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
if (this.collection && this.record) {
|
|
149
|
+
const recordId = this.isMustache(this.record)
|
|
150
|
+
? this.defaultColumnsRecordId
|
|
151
|
+
: this.record;
|
|
152
|
+
|
|
153
|
+
if (this.isMustache(this.record)) {
|
|
154
|
+
this.hasMustache = true;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const collectionMode = this.collectionmode?.modeId ?? this.defaultCollectionMode;
|
|
158
|
+
|
|
159
|
+
this.loadRecordCollection(
|
|
160
|
+
this.collection.collectionId,
|
|
161
|
+
recordId,
|
|
162
|
+
collectionMode,
|
|
163
|
+
);
|
|
164
|
+
}
|
|
90
165
|
},
|
|
91
166
|
methods: {
|
|
92
167
|
isSubmitButton(item) {
|
|
@@ -98,17 +173,17 @@ export default {
|
|
|
98
173
|
},
|
|
99
174
|
hideSubmitButtons(config) {
|
|
100
175
|
config.forEach((item) => {
|
|
101
|
-
//If the element has containers
|
|
176
|
+
// If the element has containers
|
|
102
177
|
if (Array.isArray(item)) {
|
|
103
178
|
this.hideSubmitButtons(item);
|
|
104
179
|
}
|
|
105
180
|
|
|
106
|
-
//If the element has items
|
|
181
|
+
// If the element has items
|
|
107
182
|
if (item.items) {
|
|
108
183
|
this.hideSubmitButtons(item.items);
|
|
109
184
|
}
|
|
110
185
|
|
|
111
|
-
//hidden buttons
|
|
186
|
+
// hidden buttons
|
|
112
187
|
if (this.isSubmitButton(item)) {
|
|
113
188
|
item.config.hidden = true;
|
|
114
189
|
}
|
|
@@ -116,17 +191,17 @@ export default {
|
|
|
116
191
|
},
|
|
117
192
|
disableForm(config) {
|
|
118
193
|
config.forEach((item) => {
|
|
119
|
-
//If the element has containers
|
|
194
|
+
// If the element has containers
|
|
120
195
|
if (Array.isArray(item)) {
|
|
121
196
|
this.disableForm(item);
|
|
122
197
|
}
|
|
123
198
|
|
|
124
|
-
//If the element has items
|
|
199
|
+
// If the element has items
|
|
125
200
|
if (item.items) {
|
|
126
201
|
this.disableForm(item.items);
|
|
127
202
|
}
|
|
128
203
|
|
|
129
|
-
//Disable element
|
|
204
|
+
// Disable element
|
|
130
205
|
if (item && item.config) {
|
|
131
206
|
item.config.disabled = true;
|
|
132
207
|
item.config.readonly = true;
|
|
@@ -149,7 +224,7 @@ export default {
|
|
|
149
224
|
this.watchers = response.data.watchers;
|
|
150
225
|
this.screenTitle = response.data.title;
|
|
151
226
|
|
|
152
|
-
if (this.$attrs
|
|
227
|
+
if (this.$attrs.disabled) {
|
|
153
228
|
this.disableForm(this.config);
|
|
154
229
|
}
|
|
155
230
|
});
|
|
@@ -174,81 +249,50 @@ export default {
|
|
|
174
249
|
const respData = response.data;
|
|
175
250
|
const viewScreen = response.collection.read_screen_id;
|
|
176
251
|
const editScreen = response.collection.update_screen_id;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
252
|
+
// Choose screen id regarding of the display Mode
|
|
253
|
+
this.screenCollectionId =
|
|
254
|
+
typeof this.selDisplayMode === "function"
|
|
255
|
+
? this.collectionmode.modeId === "View"
|
|
256
|
+
? viewScreen
|
|
257
|
+
: editScreen
|
|
258
|
+
: this.selDisplayMode === "View"
|
|
259
|
+
? viewScreen
|
|
260
|
+
: editScreen;
|
|
182
261
|
this.loadScreen(this.screenCollectionId);
|
|
183
|
-
|
|
184
|
-
//This section validates if Collection has draft data
|
|
185
|
-
if (
|
|
186
|
-
|
|
262
|
+
|
|
263
|
+
// This section validates if Collection has draft data
|
|
264
|
+
if (
|
|
265
|
+
this.taskDraft?.draft?.data == null ||
|
|
266
|
+
this.taskDraft.draft.data === "" ||
|
|
267
|
+
!this.enableDraft
|
|
268
|
+
) {
|
|
187
269
|
this.localData = respData;
|
|
188
|
-
}else{
|
|
270
|
+
} else {
|
|
189
271
|
this.localData = _.merge({}, respData, this.taskDraft.draft.data);
|
|
190
272
|
}
|
|
191
|
-
|
|
192
273
|
})
|
|
193
274
|
.catch(() => {
|
|
194
275
|
this.localData = {};
|
|
195
|
-
globalObject.ProcessMaker.alert(
|
|
276
|
+
globalObject.ProcessMaker.alert(
|
|
277
|
+
this.$t(
|
|
278
|
+
"This content does not exist. We could not locate indicated data"
|
|
279
|
+
),
|
|
280
|
+
"danger"
|
|
281
|
+
);
|
|
196
282
|
this.placeholder = "Select a collection";
|
|
197
|
-
})
|
|
283
|
+
});
|
|
198
284
|
},
|
|
199
285
|
isMustache(record) {
|
|
200
286
|
return /\{\{.*\}\}/.test(record);
|
|
201
287
|
},
|
|
202
288
|
clearDataObject() {
|
|
203
|
-
Object.keys(this.localData).forEach(key => {
|
|
289
|
+
Object.keys(this.localData).forEach((key) => {
|
|
204
290
|
if (key !== "id") {
|
|
205
291
|
this.localData[key] = "";
|
|
206
292
|
}
|
|
207
293
|
});
|
|
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
294
|
}
|
|
251
|
-
}
|
|
295
|
+
}
|
|
252
296
|
};
|
|
253
297
|
</script>
|
|
254
298
|
|
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(
|