@processmaker/screen-builder 3.8.45 → 3.8.46
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 +5729 -5040
- package/dist/vue-form-builder.es.js.map +1 -1
- package/dist/vue-form-builder.umd.js +43 -42
- package/dist/vue-form-builder.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/DataProvider.js +2 -0
- package/src/ValidationsFactory.js +15 -12
- package/src/components/index.js +4 -0
- package/src/components/inspector/vueRender/EditorFieldInspector.vue +239 -0
- package/src/components/renderer/add-loop-row.vue +27 -1
- package/src/components/renderer/form-collection-record-control.vue +44 -10
- package/src/components/renderer/form-collection-view-control.vue +2 -0
- package/src/components/renderer/form-loop.vue +29 -2
- package/src/components/renderer/form-nested-screen.vue +17 -1
- package/src/components/renderer/form-record-list.vue +93 -13
- package/src/components/renderer/vueRender/VueRenderEditor.vue +99 -0
- package/src/components/renderer/vueRender/VueRenderPreview.vue +36 -0
- package/src/components/renderer/vueRender/VueRenderTemplate.js +245 -0
- package/src/components/screen-renderer.vue +5 -0
- package/src/components/task.vue +37 -5
- package/src/components/vue-form-renderer.vue +51 -8
- package/src/form-builder-controls.js +68 -1
- package/src/main.js +11 -0
- package/src/mixins/DeviceDetector.js +19 -3
- package/src/mixins/Json2Vue.js +12 -1
- package/src/mixins/ScreenBase.js +43 -16
- package/src/mixins/VisibilityRule.js +3 -3
- package/src/mixins/extensions/FormDynamicPanel.js +2 -2
- package/src/mixins/extensions/LoadFieldComponents.js +64 -39
- package/src/mixins/extensions/LoopContainer.js +2 -2
- package/src/mixins/extensions/VisibilityRule.js +8 -8
- package/src/stories/VueRender.stories.js +274 -0
package/package.json
CHANGED
package/src/DataProvider.js
CHANGED
|
@@ -228,6 +228,7 @@ export default {
|
|
|
228
228
|
const normalizedDataSourceId = normalizeDataSourceId(dataSourceId);
|
|
229
229
|
// keep backwards compatibility
|
|
230
230
|
if (
|
|
231
|
+
!params.cache &&
|
|
231
232
|
!window.ProcessMaker.screen.cacheEnabled &&
|
|
232
233
|
!window.ProcessMaker.screen.cacheTimeout
|
|
233
234
|
) {
|
|
@@ -242,6 +243,7 @@ export default {
|
|
|
242
243
|
url += this.authQueryString();
|
|
243
244
|
return this.get(url, {
|
|
244
245
|
useCache: window.ProcessMaker.screen.cacheEnabled,
|
|
246
|
+
cache: params.cache,
|
|
245
247
|
params: {
|
|
246
248
|
pmds_config: JSON.stringify(params.config),
|
|
247
249
|
pmds_data: JSON.stringify(params.data)
|
|
@@ -13,6 +13,7 @@ class Validations {
|
|
|
13
13
|
firstPage = 0;
|
|
14
14
|
data = {};
|
|
15
15
|
insideLoop = false;
|
|
16
|
+
isMobile = false;
|
|
16
17
|
constructor(element, options) {
|
|
17
18
|
this.element = element;
|
|
18
19
|
Object.assign(this, options);
|
|
@@ -35,11 +36,13 @@ class Validations {
|
|
|
35
36
|
* Check if element/container is visible.
|
|
36
37
|
*/
|
|
37
38
|
isVisible() {
|
|
38
|
-
|
|
39
|
+
const deviceConfig = this.element.config?.deviceVisibility || {
|
|
40
|
+
showForDesktop: true,
|
|
41
|
+
showForMobile: true
|
|
42
|
+
};
|
|
39
43
|
const visibleInDevice =
|
|
40
|
-
this.
|
|
41
|
-
|
|
42
|
-
: this.element.visibleInDevice;
|
|
44
|
+
(this.isMobile && deviceConfig.showForMobile) ||
|
|
45
|
+
(!this.isMobile && deviceConfig.showForDesktop);
|
|
43
46
|
if (!visibleInDevice) {
|
|
44
47
|
return false;
|
|
45
48
|
}
|
|
@@ -62,7 +65,7 @@ class Validations {
|
|
|
62
65
|
class ArrayOfFieldsValidations extends Validations {
|
|
63
66
|
async addValidations(validations) {
|
|
64
67
|
for (const item of this.element) {
|
|
65
|
-
await ValidationsFactory(item, { screen: this.screen, data: this.data, parentVisibilityRule: this.parentVisibilityRule, insideLoop: this.insideLoop }).addValidations(validations);
|
|
68
|
+
await ValidationsFactory(item, { screen: this.screen, data: this.data, parentVisibilityRule: this.parentVisibilityRule, insideLoop: this.insideLoop, isMobile: this.isMobile }).addValidations(validations);
|
|
66
69
|
}
|
|
67
70
|
}
|
|
68
71
|
}
|
|
@@ -75,7 +78,7 @@ class ScreenValidations extends Validations {
|
|
|
75
78
|
// add validations for page 1
|
|
76
79
|
if (this.element.config[this.firstPage]) {
|
|
77
80
|
pagesValidated = [this.firstPage];
|
|
78
|
-
const screenValidations = ValidationsFactory(this.element.config[this.firstPage].items, { screen: this.element, data: this.data });
|
|
81
|
+
const screenValidations = ValidationsFactory(this.element.config[this.firstPage].items, { screen: this.element, data: this.data, isMobile: this.isMobile });
|
|
79
82
|
await screenValidations.addValidations(validations);
|
|
80
83
|
pagesValidated = [];
|
|
81
84
|
}
|
|
@@ -96,7 +99,7 @@ class FormNestedScreenValidations extends Validations {
|
|
|
96
99
|
const definition = nestedScreen.config;
|
|
97
100
|
let parentVisibilityRule = this.parentVisibilityRule ? this.parentVisibilityRule : this.element.config.conditionalHide;
|
|
98
101
|
if (definition && definition[0] && definition[0].items) {
|
|
99
|
-
await ValidationsFactory(definition[0].items, { screen: nestedScreen, data: this.data, parentVisibilityRule }).addValidations(validations);
|
|
102
|
+
await ValidationsFactory(definition[0].items, { screen: nestedScreen, data: this.data, parentVisibilityRule, isMobile: this.isMobile }).addValidations(validations);
|
|
100
103
|
}
|
|
101
104
|
}
|
|
102
105
|
}
|
|
@@ -146,7 +149,7 @@ class FormLoopValidations extends Validations {
|
|
|
146
149
|
loopField['$each'] = {};
|
|
147
150
|
this.checkForSiblings(validations);
|
|
148
151
|
const firstRow = (get(this.data, this.element.config.name) || [{}])[0];
|
|
149
|
-
await ValidationsFactory(this.element.items, { screen: this.screen, data: {_parent: this.data, ...firstRow }, parentVisibilityRule: this.element.config.conditionalHide, insideLoop: true }).addValidations(loopField['$each']);
|
|
152
|
+
await ValidationsFactory(this.element.items, { screen: this.screen, data: {_parent: this.data, ...firstRow }, parentVisibilityRule: this.element.config.conditionalHide, insideLoop: true, isMobile: this.isMobile }).addValidations(loopField['$each']);
|
|
150
153
|
}
|
|
151
154
|
checkForSiblings(validations) {
|
|
152
155
|
const siblings = [];
|
|
@@ -207,7 +210,7 @@ class FormMultiColumnValidations extends Validations {
|
|
|
207
210
|
if (!this.isVisible()) {
|
|
208
211
|
return;
|
|
209
212
|
}
|
|
210
|
-
await ValidationsFactory(this.element.items, { screen: this.screen, data: this.data, parentVisibilityRule: this.element.config.conditionalHide }).addValidations(validations);
|
|
213
|
+
await ValidationsFactory(this.element.items, { screen: this.screen, data: this.data, parentVisibilityRule: this.element.config.conditionalHide, isMobile: this.isMobile }).addValidations(validations);
|
|
211
214
|
}
|
|
212
215
|
}
|
|
213
216
|
|
|
@@ -229,7 +232,7 @@ class PageNavigateValidations extends Validations {
|
|
|
229
232
|
if (pagesValidated.length > 0 && !pagesValidated.includes(screenPageId)) {
|
|
230
233
|
if (this.screen.config[screenNumber] && this.screen.config[screenNumber].items) {
|
|
231
234
|
pagesValidated.push(screenPageId);
|
|
232
|
-
await ValidationsFactory(this.screen.config[this.element.config.eventData].items, { screen: this.screen, data: this.data }).addValidations(validations);
|
|
235
|
+
await ValidationsFactory(this.screen.config[this.element.config.eventData].items, { screen: this.screen, data: this.data, isMobile: this.isMobile }).addValidations(validations);
|
|
233
236
|
}
|
|
234
237
|
}
|
|
235
238
|
}
|
|
@@ -313,7 +316,7 @@ class FormElementValidations extends Validations {
|
|
|
313
316
|
fieldValidation[validationConfig] = this.buildClosure(validationFn, closureOptions);
|
|
314
317
|
}
|
|
315
318
|
if (this.element.items) {
|
|
316
|
-
ValidationsFactory(this.element.items, { screen: this.screen, data: this.data }).addValidations(validations);
|
|
319
|
+
ValidationsFactory(this.element.items, { screen: this.screen, data: this.data, isMobile: this.isMobile }).addValidations(validations);
|
|
317
320
|
}
|
|
318
321
|
}
|
|
319
322
|
|
|
@@ -340,7 +343,7 @@ class FormElementValidations extends Validations {
|
|
|
340
343
|
// Check Device Visibility
|
|
341
344
|
let visibleInDevice = true;
|
|
342
345
|
try {
|
|
343
|
-
const isMobileScreen = this
|
|
346
|
+
const isMobileScreen = this.isMobile;
|
|
344
347
|
visibleInDevice =
|
|
345
348
|
(isMobileScreen && deviceConfig.showForMobile) ||
|
|
346
349
|
(!isMobileScreen && deviceConfig.showForDesktop);
|
package/src/components/index.js
CHANGED
|
@@ -54,6 +54,8 @@ import { LinkButton, CaseProgressBar } from "./renderer";
|
|
|
54
54
|
import "../assets/css/tabs.css";
|
|
55
55
|
import FormCollectionRecordControl from "./renderer/form-collection-record-control.vue";
|
|
56
56
|
import FormCollectionViewControl from "./renderer/form-collection-view-control.vue";
|
|
57
|
+
import VueRenderPreview from "./renderer/vueRender/VueRenderPreview.vue";
|
|
58
|
+
import VueRenderEditor from "./renderer/vueRender/VueRenderEditor.vue";
|
|
57
59
|
|
|
58
60
|
const rendererComponents = {
|
|
59
61
|
...renderer,
|
|
@@ -161,6 +163,8 @@ export default {
|
|
|
161
163
|
Vue.component("VueFormRenderer", VueFormRenderer);
|
|
162
164
|
Vue.component("DefaultLoadingSpinner", DefaultLoadingSpinner);
|
|
163
165
|
Vue.use(VueFormElements);
|
|
166
|
+
Vue.component("VueRenderPreview", VueRenderPreview);
|
|
167
|
+
Vue.component("VueRenderEditor", VueRenderEditor);
|
|
164
168
|
Vue.component("FormButton", FormButton);
|
|
165
169
|
Vue.component("FileUpload", FileUpload);
|
|
166
170
|
Vue.component("FileDownload", FileDownload);
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="d-flex align-items-center justify-content-between inspector-label-row">
|
|
4
|
+
<label :for="'inspector-defaultValue-jsValue'">{{ $t(label) }}</label>
|
|
5
|
+
<button
|
|
6
|
+
v-if="enablePopup"
|
|
7
|
+
type="button"
|
|
8
|
+
class="btn btn-light btn-sm"
|
|
9
|
+
:title="$t(resolvedOpenPopupLabel)"
|
|
10
|
+
data-test="tce-control-expand-button"
|
|
11
|
+
:aria-label="resolvedOpenPopupLabel"
|
|
12
|
+
@click="openCodePopup"
|
|
13
|
+
>
|
|
14
|
+
<i class="fas fa-expand" />
|
|
15
|
+
</button>
|
|
16
|
+
</div>
|
|
17
|
+
<MonacoEditor
|
|
18
|
+
v-model="jsValue"
|
|
19
|
+
:options="monacoOptions"
|
|
20
|
+
class="editor"
|
|
21
|
+
:language="language"
|
|
22
|
+
data-cy="inspector-defaultValue-jsValue"
|
|
23
|
+
/>
|
|
24
|
+
<b-modal
|
|
25
|
+
v-if="enablePopup"
|
|
26
|
+
v-model="isPopupOpen"
|
|
27
|
+
:title="$t(resolvedPopupTitle)"
|
|
28
|
+
size="xl"
|
|
29
|
+
dialog-class="editor-dialog-large"
|
|
30
|
+
header-close-content="×"
|
|
31
|
+
no-close-on-backdrop
|
|
32
|
+
@hidden="onCodePopupHidden"
|
|
33
|
+
>
|
|
34
|
+
<div
|
|
35
|
+
class="tce-p-4"
|
|
36
|
+
data-test="tce-control-code-input"
|
|
37
|
+
>
|
|
38
|
+
<MonacoEditor
|
|
39
|
+
v-model="popupCode"
|
|
40
|
+
:options="popupMonacoOptions"
|
|
41
|
+
class="popup-editor"
|
|
42
|
+
:language="language"
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
45
|
+
<template #modal-footer>
|
|
46
|
+
<div class="tce-flex tce-justify-end tce-gap-2 w-100">
|
|
47
|
+
<button
|
|
48
|
+
type="button"
|
|
49
|
+
class="btn btn-outline-secondary"
|
|
50
|
+
data-test="tce-control-close-button"
|
|
51
|
+
@click="closeCodePopup"
|
|
52
|
+
>
|
|
53
|
+
{{ $t(resolvedCancelPopupLabel) }}
|
|
54
|
+
</button>
|
|
55
|
+
<button
|
|
56
|
+
type="button"
|
|
57
|
+
class="btn btn-primary ml-2"
|
|
58
|
+
data-test="tce-control-save-button"
|
|
59
|
+
@click="saveCodePopup"
|
|
60
|
+
>
|
|
61
|
+
{{ $t(resolvedSavePopupLabel) }}
|
|
62
|
+
</button>
|
|
63
|
+
</div>
|
|
64
|
+
</template>
|
|
65
|
+
</b-modal>
|
|
66
|
+
<small
|
|
67
|
+
v-if="helper"
|
|
68
|
+
class="form-text text-muted mt-2"
|
|
69
|
+
>{{ $t(helper) }}</small>
|
|
70
|
+
</div>
|
|
71
|
+
</template>
|
|
72
|
+
|
|
73
|
+
<script>
|
|
74
|
+
import MonacoEditor from 'vue-monaco';
|
|
75
|
+
|
|
76
|
+
const _ = window._ || {
|
|
77
|
+
isEqual: (a, b) => JSON.stringify(a) === JSON.stringify(b),
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export default {
|
|
81
|
+
components: {
|
|
82
|
+
MonacoEditor,
|
|
83
|
+
},
|
|
84
|
+
props: {
|
|
85
|
+
value: {
|
|
86
|
+
type: [String, Number, Object],
|
|
87
|
+
default: '',
|
|
88
|
+
},
|
|
89
|
+
helper: {
|
|
90
|
+
type: String,
|
|
91
|
+
default: '',
|
|
92
|
+
},
|
|
93
|
+
language: {
|
|
94
|
+
type: String,
|
|
95
|
+
default: 'javascript',
|
|
96
|
+
},
|
|
97
|
+
label: {
|
|
98
|
+
type: String,
|
|
99
|
+
default: '',
|
|
100
|
+
},
|
|
101
|
+
enablePopup: {
|
|
102
|
+
type: Boolean,
|
|
103
|
+
default: true,
|
|
104
|
+
},
|
|
105
|
+
openPopupLabel: {
|
|
106
|
+
type: String,
|
|
107
|
+
default: 'Open in popup',
|
|
108
|
+
},
|
|
109
|
+
cancelPopupLabel: {
|
|
110
|
+
type: String,
|
|
111
|
+
default: 'Cancel',
|
|
112
|
+
},
|
|
113
|
+
savePopupLabel: {
|
|
114
|
+
type: String,
|
|
115
|
+
default: 'Save',
|
|
116
|
+
},
|
|
117
|
+
popupTitle: {
|
|
118
|
+
type: String,
|
|
119
|
+
default: 'Edit source code',
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
emits: ['input'],
|
|
123
|
+
data() {
|
|
124
|
+
return {
|
|
125
|
+
mode: 'basic',
|
|
126
|
+
jsValue: '',
|
|
127
|
+
basicValue: '',
|
|
128
|
+
popupCode: '',
|
|
129
|
+
isPopupOpen: false,
|
|
130
|
+
monacoOptions: {
|
|
131
|
+
lineNumbers: 'off',
|
|
132
|
+
glyphMargin: false,
|
|
133
|
+
folding: false,
|
|
134
|
+
lineDecorationsWidth: 0,
|
|
135
|
+
lineNumbersMinChars: 0,
|
|
136
|
+
minimap: { enabled: false },
|
|
137
|
+
fixedOverflowWidgets: true,
|
|
138
|
+
automaticLayout: true,
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
},
|
|
142
|
+
computed: {
|
|
143
|
+
popupMonacoOptions() {
|
|
144
|
+
return {
|
|
145
|
+
...this.monacoOptions,
|
|
146
|
+
lineNumbers: 'on',
|
|
147
|
+
minimap: { enabled: true },
|
|
148
|
+
};
|
|
149
|
+
},
|
|
150
|
+
resolvedOpenPopupLabel() {
|
|
151
|
+
return this.openPopupLabel || 'Open in popup';
|
|
152
|
+
},
|
|
153
|
+
resolvedPopupTitle() {
|
|
154
|
+
return this.popupTitle || 'Edit source code';
|
|
155
|
+
},
|
|
156
|
+
resolvedCancelPopupLabel() {
|
|
157
|
+
return this.cancelPopupLabel || 'Cancel';
|
|
158
|
+
},
|
|
159
|
+
resolvedSavePopupLabel() {
|
|
160
|
+
return this.savePopupLabel || 'Save';
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
watch: {
|
|
164
|
+
enablePopup(value) {
|
|
165
|
+
if (!value) {
|
|
166
|
+
this.isPopupOpen = false;
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
value: {
|
|
170
|
+
handler() {
|
|
171
|
+
if (_.isEqual(this.jsValue, this.value)) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
this.mode = 'basic';
|
|
176
|
+
this.basicValue = '';
|
|
177
|
+
this.jsValue = '';
|
|
178
|
+
|
|
179
|
+
if (!this.value) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
this.jsValue = this.value;
|
|
184
|
+
},
|
|
185
|
+
immediate: true,
|
|
186
|
+
},
|
|
187
|
+
mode() {
|
|
188
|
+
this.emit();
|
|
189
|
+
},
|
|
190
|
+
jsValue() {
|
|
191
|
+
this.emit();
|
|
192
|
+
},
|
|
193
|
+
basicValue() {
|
|
194
|
+
this.emit();
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
methods: {
|
|
198
|
+
emit() {
|
|
199
|
+
this.$emit('input', this.jsValue);
|
|
200
|
+
},
|
|
201
|
+
openCodePopup() {
|
|
202
|
+
this.popupCode = this.jsValue || '';
|
|
203
|
+
this.isPopupOpen = true;
|
|
204
|
+
},
|
|
205
|
+
closeCodePopup() {
|
|
206
|
+
this.isPopupOpen = false;
|
|
207
|
+
},
|
|
208
|
+
onCodePopupHidden() {
|
|
209
|
+
this.popupCode = '';
|
|
210
|
+
},
|
|
211
|
+
saveCodePopup() {
|
|
212
|
+
this.jsValue = this.popupCode;
|
|
213
|
+
this.isPopupOpen = false;
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
</script>
|
|
218
|
+
|
|
219
|
+
<style scoped>
|
|
220
|
+
.buttons button {
|
|
221
|
+
min-width: 2.2em;
|
|
222
|
+
margin-left: 0.5em;
|
|
223
|
+
margin-bottom: 0.5em;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.editor {
|
|
227
|
+
width: 100%;
|
|
228
|
+
height: 10em;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.popup-editor {
|
|
232
|
+
width: 100%;
|
|
233
|
+
height: 60vh;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.inspector-label-row {
|
|
237
|
+
width: 100%;
|
|
238
|
+
}
|
|
239
|
+
</style>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
</b-row>
|
|
8
8
|
|
|
9
9
|
<b-row
|
|
10
|
-
v-if="
|
|
10
|
+
v-if="canAddOrRemove"
|
|
11
11
|
class="justify-content-md-center"
|
|
12
12
|
>
|
|
13
13
|
<b-col md="auto">
|
|
@@ -44,15 +44,41 @@ export default {
|
|
|
44
44
|
config: Object,
|
|
45
45
|
error: String
|
|
46
46
|
},
|
|
47
|
+
computed: {
|
|
48
|
+
isDisabled() {
|
|
49
|
+
return Boolean(
|
|
50
|
+
this.config
|
|
51
|
+
&& (this.config.disabled || this.config.readonly || this.config.editable === false)
|
|
52
|
+
);
|
|
53
|
+
},
|
|
54
|
+
canAddOrRemove() {
|
|
55
|
+
return Boolean(
|
|
56
|
+
this.value
|
|
57
|
+
&& this.config
|
|
58
|
+
&& this.config.settings
|
|
59
|
+
&& this.config.settings.add
|
|
60
|
+
&& !this.isDisabled
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
47
64
|
methods: {
|
|
48
65
|
async add() {
|
|
66
|
+
if (this.isDisabled) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
49
69
|
this.value.push({});
|
|
50
70
|
},
|
|
51
71
|
remove() {
|
|
72
|
+
if (this.isDisabled) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
52
75
|
const removed = this.value.pop();
|
|
53
76
|
this.$root.$emit("removed-loop", this, removed);
|
|
54
77
|
},
|
|
55
78
|
removeConfirm() {
|
|
79
|
+
if (this.isDisabled) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
56
82
|
const message = this.$t("Are you sure you want to delete this?");
|
|
57
83
|
window.ProcessMaker.confirmModal(this.$t("Caution!"), message, "", () => {
|
|
58
84
|
this.remove();
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
:computed="computed"
|
|
10
10
|
:custom-css="customCss"
|
|
11
11
|
:watchers="watchers"
|
|
12
|
+
:is-mobile="isMobile"
|
|
12
13
|
:_parent="_parent"
|
|
14
|
+
:read-only="isDisabled"
|
|
13
15
|
/>
|
|
14
16
|
</template>
|
|
15
17
|
|
|
@@ -44,7 +46,16 @@ export default {
|
|
|
44
46
|
collectionmode: {
|
|
45
47
|
type: Object
|
|
46
48
|
},
|
|
47
|
-
taskdraft: Object
|
|
49
|
+
taskdraft: Object,
|
|
50
|
+
isMobile: {type: Boolean, default: false},
|
|
51
|
+
disabled: {
|
|
52
|
+
type: [Boolean, String],
|
|
53
|
+
default: false
|
|
54
|
+
},
|
|
55
|
+
readonly: {
|
|
56
|
+
type: [Boolean, String],
|
|
57
|
+
default: false
|
|
58
|
+
}
|
|
48
59
|
},
|
|
49
60
|
data() {
|
|
50
61
|
return {
|
|
@@ -69,6 +80,16 @@ export default {
|
|
|
69
80
|
};
|
|
70
81
|
},
|
|
71
82
|
computed: {
|
|
83
|
+
isDisabled() {
|
|
84
|
+
return Boolean(
|
|
85
|
+
this.disabled === true
|
|
86
|
+
|| this.disabled === "true"
|
|
87
|
+
|| this.disabled === ""
|
|
88
|
+
|| this.readonly === true
|
|
89
|
+
|| this.readonly === "true"
|
|
90
|
+
|| this.readonly === ""
|
|
91
|
+
);
|
|
92
|
+
},
|
|
72
93
|
validatedConfig() {
|
|
73
94
|
return this.config && this.config[0] ? this.config : defaultConfig;
|
|
74
95
|
},
|
|
@@ -80,6 +101,9 @@ export default {
|
|
|
80
101
|
return this.localData;
|
|
81
102
|
},
|
|
82
103
|
set(data) {
|
|
104
|
+
if (this.isDisabled) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
83
107
|
Object.keys(data).forEach((variable) => {
|
|
84
108
|
this.validationData &&
|
|
85
109
|
this.$set(this.validationData, variable, data[variable]);
|
|
@@ -139,6 +163,15 @@ export default {
|
|
|
139
163
|
this.selRecordId,
|
|
140
164
|
this.selDisplayMode
|
|
141
165
|
);
|
|
166
|
+
},
|
|
167
|
+
isDisabled() {
|
|
168
|
+
if (this.selCollectionId && this.selRecordId) {
|
|
169
|
+
this.loadRecordCollection(
|
|
170
|
+
this.selCollectionId,
|
|
171
|
+
this.selRecordId,
|
|
172
|
+
this.selDisplayMode
|
|
173
|
+
);
|
|
174
|
+
}
|
|
142
175
|
}
|
|
143
176
|
},
|
|
144
177
|
mounted() {
|
|
@@ -231,7 +264,7 @@ export default {
|
|
|
231
264
|
this.watchers = response.data.watchers;
|
|
232
265
|
this.screenTitle = response.data.title;
|
|
233
266
|
|
|
234
|
-
if (this
|
|
267
|
+
if (this.isDisabled) {
|
|
235
268
|
this.disableForm(this.config);
|
|
236
269
|
}
|
|
237
270
|
});
|
|
@@ -249,6 +282,8 @@ export default {
|
|
|
249
282
|
this.selCollectionId = collectionId;
|
|
250
283
|
this.selRecordId = recordId;
|
|
251
284
|
this.selDisplayMode = modeId;
|
|
285
|
+
// Completed/closed task previews must not load the editable collection screen.
|
|
286
|
+
const effectiveMode = this.isDisabled ? "View" : modeId;
|
|
252
287
|
this.$dataProvider
|
|
253
288
|
.getCollectionRecordsView(collectionId, recordId)
|
|
254
289
|
.then((response) => {
|
|
@@ -257,14 +292,12 @@ export default {
|
|
|
257
292
|
const viewScreen = response.collection.read_screen_id;
|
|
258
293
|
const editScreen = response.collection.update_screen_id;
|
|
259
294
|
// Choose screen id regarding of the display Mode
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
? viewScreen
|
|
267
|
-
: editScreen;
|
|
295
|
+
let useViewScreen = effectiveMode === "View";
|
|
296
|
+
if (typeof this.selDisplayMode === "function") {
|
|
297
|
+
useViewScreen =
|
|
298
|
+
this.collectionmode.modeId === "View" || this.isDisabled;
|
|
299
|
+
}
|
|
300
|
+
this.screenCollectionId = useViewScreen ? viewScreen : editScreen;
|
|
268
301
|
this.loadScreen(this.screenCollectionId);
|
|
269
302
|
|
|
270
303
|
// This section validates if Collection has draft data
|
|
@@ -272,6 +305,7 @@ export default {
|
|
|
272
305
|
this.taskDraft?.draft?.data == null ||
|
|
273
306
|
this.taskDraft.draft.data === "" ||
|
|
274
307
|
!this.enableDraft
|
|
308
|
+
|| this.isDisabled
|
|
275
309
|
) {
|
|
276
310
|
this.localData = respData;
|
|
277
311
|
} else {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
:computed="computed"
|
|
10
10
|
:custom-css="customCss"
|
|
11
11
|
:watchers="watchers"
|
|
12
|
+
:is-mobile="isMobile"
|
|
12
13
|
:_parent="_parent"
|
|
13
14
|
/>
|
|
14
15
|
</template>
|
|
@@ -38,6 +39,7 @@ export default {
|
|
|
38
39
|
type: Object
|
|
39
40
|
},
|
|
40
41
|
taskdraft: Object,
|
|
42
|
+
isMobile: {type: Boolean, default: false},
|
|
41
43
|
},
|
|
42
44
|
data() {
|
|
43
45
|
return {
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
:computed="null"
|
|
8
8
|
:custom-css="null"
|
|
9
9
|
:watchers="null"
|
|
10
|
+
:is-mobile="isMobile"
|
|
10
11
|
:is-loop="true"
|
|
11
12
|
:debug-context="'Loop #' + loopIndex"
|
|
12
13
|
:mode="mode"
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
@update="setMatrixValue(loopIndex, $event)"
|
|
18
19
|
/>
|
|
19
20
|
</form>
|
|
20
|
-
<b-row v-if="
|
|
21
|
+
<b-row v-if="canAddOrRemove" class="justify-content-md-center">
|
|
21
22
|
<b-col md="auto">
|
|
22
23
|
<b-button
|
|
23
24
|
size="sm"
|
|
@@ -54,7 +55,9 @@ export default {
|
|
|
54
55
|
VueFormRenderer
|
|
55
56
|
},
|
|
56
57
|
mixins: [],
|
|
57
|
-
props
|
|
58
|
+
// Renderer props stay untyped because legacy screens may pass non-canonical runtime types.
|
|
59
|
+
// eslint-disable-next-line prettier/prettier
|
|
60
|
+
props: ["value", "config", "transientData", "name", "mode", "formConfig", "isMobile", "disabled", "readonly"], // NOSONAR
|
|
58
61
|
data() {
|
|
59
62
|
return {
|
|
60
63
|
matrix: [],
|
|
@@ -65,6 +68,21 @@ export default {
|
|
|
65
68
|
};
|
|
66
69
|
},
|
|
67
70
|
computed: {
|
|
71
|
+
isDisabled() {
|
|
72
|
+
return Boolean(
|
|
73
|
+
this.disabled
|
|
74
|
+
|| this.readonly
|
|
75
|
+
|| (this.config && (this.config.disabled || this.config.readonly || this.config.editable === false))
|
|
76
|
+
);
|
|
77
|
+
},
|
|
78
|
+
canAddOrRemove() {
|
|
79
|
+
return Boolean(
|
|
80
|
+
this.config
|
|
81
|
+
&& this.config.settings
|
|
82
|
+
&& this.config.settings.add
|
|
83
|
+
&& !this.isDisabled
|
|
84
|
+
);
|
|
85
|
+
},
|
|
68
86
|
parentLoopContext() {
|
|
69
87
|
let parent = this.$parent;
|
|
70
88
|
let i = 0;
|
|
@@ -191,6 +209,9 @@ export default {
|
|
|
191
209
|
return context;
|
|
192
210
|
},
|
|
193
211
|
add() {
|
|
212
|
+
if (this.isDisabled) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
194
215
|
if (this.config.settings.type === "existing") {
|
|
195
216
|
this.setMatrixValue(this.matrix.length, {});
|
|
196
217
|
} else {
|
|
@@ -198,6 +219,9 @@ export default {
|
|
|
198
219
|
}
|
|
199
220
|
},
|
|
200
221
|
remove() {
|
|
222
|
+
if (this.isDisabled) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
201
225
|
if (this.config.settings.type === "existing") {
|
|
202
226
|
this.$delete(this.matrix, this.matrix.length - 1);
|
|
203
227
|
} else {
|
|
@@ -205,6 +229,9 @@ export default {
|
|
|
205
229
|
}
|
|
206
230
|
},
|
|
207
231
|
removeConfirm() {
|
|
232
|
+
if (this.isDisabled) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
208
235
|
const message = this.$t("Are you sure you want to delete this?");
|
|
209
236
|
window.ProcessMaker.confirmModal(this.$t("Caution!"), message, "", () => {
|
|
210
237
|
this.remove();
|
|
@@ -11,9 +11,11 @@
|
|
|
11
11
|
:computed="computed"
|
|
12
12
|
:custom-css="customCSS"
|
|
13
13
|
:watchers="watchers"
|
|
14
|
+
:is-mobile="isMobile"
|
|
14
15
|
debug-context="Nested Screen"
|
|
15
16
|
@css-errors="cssErrors = $event"
|
|
16
17
|
:_parent="_parent"
|
|
18
|
+
:read-only="isDisabled"
|
|
17
19
|
/>
|
|
18
20
|
</template>
|
|
19
21
|
|
|
@@ -42,6 +44,9 @@ export default {
|
|
|
42
44
|
validationData: null,
|
|
43
45
|
_parent: null,
|
|
44
46
|
ancestorScreens: {type: Array, default: () => []},
|
|
47
|
+
isMobile: {type: Boolean, default: false},
|
|
48
|
+
disabled: { type: [Boolean, String], default: false },
|
|
49
|
+
readonly: { type: [Boolean, String], default: false },
|
|
45
50
|
},
|
|
46
51
|
data() {
|
|
47
52
|
return {
|
|
@@ -54,6 +59,17 @@ export default {
|
|
|
54
59
|
};
|
|
55
60
|
},
|
|
56
61
|
computed: {
|
|
62
|
+
isDisabled() {
|
|
63
|
+
return Boolean(
|
|
64
|
+
this.disabled === true
|
|
65
|
+
|| this.disabled === "true"
|
|
66
|
+
|| this.disabled === ""
|
|
67
|
+
|| this.readonly === true
|
|
68
|
+
|| this.readonly === "true"
|
|
69
|
+
|| this.readonly === ""
|
|
70
|
+
|| this.$attrs.disabled
|
|
71
|
+
);
|
|
72
|
+
},
|
|
57
73
|
validatedConfig() {
|
|
58
74
|
return this.config && this.config[0] ? this.config : defaultConfig;
|
|
59
75
|
},
|
|
@@ -133,7 +149,7 @@ export default {
|
|
|
133
149
|
this.watchers = response.data.watchers;
|
|
134
150
|
this.screenTitle = response.data.title;
|
|
135
151
|
|
|
136
|
-
if (this
|
|
152
|
+
if (this.isDisabled) {
|
|
137
153
|
this.disableForm(this.config);
|
|
138
154
|
}
|
|
139
155
|
|