@processmaker/screen-builder 2.26.0 → 2.28.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/.eslintrc.js +56 -12
- package/dist/vue-form-builder.common.js +6671 -5043
- 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 +6671 -5043
- package/dist/vue-form-builder.umd.js.map +1 -1
- package/dist/vue-form-builder.umd.min.js +49 -49
- package/dist/vue-form-builder.umd.min.js.map +1 -1
- package/package.json +26 -17
- package/src/.DS_Store +0 -0
- package/src/components/inspector/screen-selector.vue +6 -0
- package/src/components/renderer/file-download.vue +5 -0
- package/src/components/renderer/file-upload.vue +17 -9
- package/src/components/renderer/form-nested-screen.vue +26 -0
- package/src/components/renderer/form-record-list.vue +2 -2
- package/src/components/vue-form-builder.vue +36 -1
- package/src/components/vue-form-renderer.vue +2 -2
- package/package-lock.json +0 -19339
- package/src/components/.DS_Store +0 -0
package/package.json
CHANGED
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@processmaker/screen-builder",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.28.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"serve": "vue-cli-service serve",
|
|
6
6
|
"build": "vue-cli-service build",
|
|
7
7
|
"test:unit": "vue-cli-service test:unit",
|
|
8
|
-
"lint": "vue-cli-service lint
|
|
8
|
+
"lint": "vue-cli-service lint",
|
|
9
9
|
"build-bundle": "vue-cli-service build --target lib --name vue-form-builder ./src/components/index.js",
|
|
10
10
|
"lint-fix": "vue-cli-service lint",
|
|
11
11
|
"open-cypress": "TZ=UTC nyc cypress open",
|
|
12
12
|
"run-cypress": "TZ=UTC nyc cypress run",
|
|
13
13
|
"test": "vue-cli-service test:unit"
|
|
14
14
|
},
|
|
15
|
-
"nyc": {
|
|
16
|
-
"include": [
|
|
17
|
-
"src/**"
|
|
18
|
-
],
|
|
19
|
-
"extension": [
|
|
20
|
-
".js",
|
|
21
|
-
".vue"
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
15
|
"main": "./dist/vue-form-builder.common.js",
|
|
25
16
|
"files": [
|
|
26
17
|
"dist/*",
|
|
@@ -42,14 +33,16 @@
|
|
|
42
33
|
},
|
|
43
34
|
"devDependencies": {
|
|
44
35
|
"@4tw/cypress-drag-drop": "~1.3.1",
|
|
36
|
+
"@babel/core": "^7.12.16",
|
|
37
|
+
"@babel/eslint-parser": "^7.12.16",
|
|
45
38
|
"@cypress/code-coverage": "^3.8.1",
|
|
46
39
|
"@fortawesome/fontawesome-free": "^5.6.1",
|
|
47
40
|
"@panter/vue-i18next": "^0.15.2",
|
|
48
|
-
"@processmaker/vue-form-elements": "0.
|
|
41
|
+
"@processmaker/vue-form-elements": "0.29.0",
|
|
49
42
|
"@processmaker/vue-multiselect": "^2.2.0",
|
|
50
43
|
"@vue/cli-plugin-babel": "^3.6.0",
|
|
51
44
|
"@vue/cli-plugin-e2e-cypress": "^4.0.3",
|
|
52
|
-
"@vue/cli-plugin-eslint": "
|
|
45
|
+
"@vue/cli-plugin-eslint": "~5.0.0",
|
|
53
46
|
"@vue/cli-plugin-unit-jest": "^4.3.0",
|
|
54
47
|
"@vue/cli-service": "^3.6.0",
|
|
55
48
|
"@vue/test-utils": "^1.1.1",
|
|
@@ -57,18 +50,21 @@
|
|
|
57
50
|
"babel-core": "7.0.0-bridge.0",
|
|
58
51
|
"bootstrap": "^4.5.3",
|
|
59
52
|
"bootstrap-vue": "^2.19.0",
|
|
53
|
+
"css-loader": "^5.2.7",
|
|
60
54
|
"css-tree": "^1.0.0-alpha.29",
|
|
61
55
|
"cypress": "^3.8.0",
|
|
62
56
|
"cypress-wait-until": "^1.7.1",
|
|
57
|
+
"eslint": "^7.32.0",
|
|
63
58
|
"eslint-plugin-jest": "^22.4.1",
|
|
59
|
+
"eslint-plugin-vue": "^8.0.3",
|
|
64
60
|
"expr-eval": "^2.0.2",
|
|
65
61
|
"i18next": "^15.0.8",
|
|
66
62
|
"identity-obj-proxy": "^3.0.0",
|
|
67
|
-
"inputmask": "^5.0.
|
|
63
|
+
"inputmask": "^5.0.7",
|
|
68
64
|
"monaco-editor-webpack-plugin": "~1.7.0",
|
|
69
65
|
"mustache": "^3.0.1",
|
|
70
|
-
"node-sass": "^6.0.1",
|
|
71
66
|
"nyc": "^15.1.0",
|
|
67
|
+
"sass": "^1.51.0",
|
|
72
68
|
"sass-loader": "^10.2.0",
|
|
73
69
|
"v-calendar": "^0.9.7",
|
|
74
70
|
"validatorjs": "^3.14.2",
|
|
@@ -86,7 +82,7 @@
|
|
|
86
82
|
},
|
|
87
83
|
"peerDependencies": {
|
|
88
84
|
"@panter/vue-i18next": "^0.15.0",
|
|
89
|
-
"@processmaker/vue-form-elements": "0.
|
|
85
|
+
"@processmaker/vue-form-elements": "0.29.0",
|
|
90
86
|
"i18next": "^15.0.8",
|
|
91
87
|
"vue": "^2.6.12",
|
|
92
88
|
"vuex": "^3.1.1"
|
|
@@ -100,5 +96,18 @@
|
|
|
100
96
|
"> 1%",
|
|
101
97
|
"last 2 versions",
|
|
102
98
|
"not ie <= 8"
|
|
103
|
-
]
|
|
99
|
+
],
|
|
100
|
+
"engines": {
|
|
101
|
+
"npm": ">=8",
|
|
102
|
+
"node": ">=16 <18"
|
|
103
|
+
},
|
|
104
|
+
"nyc": {
|
|
105
|
+
"include": [
|
|
106
|
+
"src/**"
|
|
107
|
+
],
|
|
108
|
+
"extension": [
|
|
109
|
+
".js",
|
|
110
|
+
".vue"
|
|
111
|
+
]
|
|
112
|
+
}
|
|
104
113
|
}
|
package/src/.DS_Store
CHANGED
|
Binary file
|
|
@@ -102,6 +102,12 @@ export default {
|
|
|
102
102
|
},
|
|
103
103
|
},
|
|
104
104
|
mounted() {
|
|
105
|
+
this.$root.$on('remove-nested', (nestedScreenId) => {
|
|
106
|
+
if (this.value === nestedScreenId) {
|
|
107
|
+
this.$emit('input', null);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
105
111
|
let pmql = '(type = "FORM" or type = "DISPLAY")';
|
|
106
112
|
if (this.screenType === formTypes.display) {
|
|
107
113
|
pmql = '(type = "DISPLAY")';
|
|
@@ -175,6 +175,11 @@ export default {
|
|
|
175
175
|
const fileId = this.value ? this.value : _.get(this.requestData, this.fileDataName, null);
|
|
176
176
|
let endpoint = this.endpoint;
|
|
177
177
|
|
|
178
|
+
if (this.requestFiles) {
|
|
179
|
+
this.filesInfo.push(_.get(this.requestFiles, this.fileDataName, null));
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
|
|
178
183
|
if (!this.requestId || !fileId) {
|
|
179
184
|
return;
|
|
180
185
|
}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
>
|
|
19
19
|
<uploader-unsupport/>
|
|
20
20
|
|
|
21
|
-
<uploader-drop class="form-control-file">
|
|
21
|
+
<uploader-drop v-if="this.$refs['uploader']" class="form-control-file">
|
|
22
22
|
<p>{{ $t('Drop a file here to upload or') }}</p>
|
|
23
23
|
<uploader-btn
|
|
24
24
|
:attrs="nativeButtonAttrs"
|
|
@@ -33,12 +33,17 @@
|
|
|
33
33
|
<span v-if="validation === 'required' && !value" class="required">{{ $t('Required') }}</span>
|
|
34
34
|
</uploader-drop>
|
|
35
35
|
<uploader-list>
|
|
36
|
-
<template>
|
|
37
|
-
<ul>
|
|
36
|
+
<template slot-scope = "{ fileList }">
|
|
37
|
+
<ul v-if="uploading">
|
|
38
|
+
<li v-for="file in fileList" :key="file.id">
|
|
39
|
+
<uploader-file :file="file" :list="true"/>
|
|
40
|
+
</li>
|
|
41
|
+
</ul>
|
|
42
|
+
<ul v-else>
|
|
38
43
|
<li v-for="(file, i) in files " :key="i" :data-cy="file.id">
|
|
39
44
|
<div class="">
|
|
40
45
|
<div class="" style="display:flex; background:rgb(226 238 255)">
|
|
41
|
-
<div v-if="nativeFiles[file.id]" style="flex: 1" :data-cy="file.file_name.replace(/[^0-9a-zA-Z\-]/g, '-')">
|
|
46
|
+
<div v-if="nativeFiles[file.id]" style="flex: 1" class="overflow-hidden" :data-cy="file.file_name.replace(/[^0-9a-zA-Z\-]/g, '-')">
|
|
42
47
|
<uploader-file :file="nativeFiles[file.id]" :list="true" />
|
|
43
48
|
</div>
|
|
44
49
|
<div v-else style="flex: 1">
|
|
@@ -282,6 +287,7 @@ export default {
|
|
|
282
287
|
disabled: false,
|
|
283
288
|
files: [],
|
|
284
289
|
nativeFiles: {},
|
|
290
|
+
uploading: false,
|
|
285
291
|
};
|
|
286
292
|
},
|
|
287
293
|
methods: {
|
|
@@ -378,7 +384,7 @@ export default {
|
|
|
378
384
|
}
|
|
379
385
|
}
|
|
380
386
|
},
|
|
381
|
-
async removeFile(file) {
|
|
387
|
+
async removeFile(file) {
|
|
382
388
|
const id = file.id;
|
|
383
389
|
const token = file.token ? file.token : null;
|
|
384
390
|
|
|
@@ -386,13 +392,13 @@ export default {
|
|
|
386
392
|
if (!isNaN(id)) {
|
|
387
393
|
await this.$dataProvider.deleteFile(id, token);
|
|
388
394
|
}
|
|
389
|
-
|
|
395
|
+
|
|
390
396
|
this.removeFromFiles(id);
|
|
391
397
|
},
|
|
392
398
|
removeFromFiles(id) {
|
|
393
399
|
const idx = this.files.findIndex(f => f.id === id);
|
|
394
400
|
this.$delete(this.files, idx);
|
|
395
|
-
|
|
401
|
+
|
|
396
402
|
if (this.nativeFiles[id]) {
|
|
397
403
|
if (this.$refs.uploader) {
|
|
398
404
|
this.$refs.uploader.uploader.removeFile(this.nativeFiles[id]);
|
|
@@ -470,6 +476,7 @@ export default {
|
|
|
470
476
|
}
|
|
471
477
|
},
|
|
472
478
|
fileUploaded(rootFile, file, message) {
|
|
479
|
+
this.uploading = false;
|
|
473
480
|
let name = file.name;
|
|
474
481
|
if (message) {
|
|
475
482
|
const msg = JSON.parse(message);
|
|
@@ -478,13 +485,13 @@ export default {
|
|
|
478
485
|
if (this.collection) {
|
|
479
486
|
id = msg.id;
|
|
480
487
|
}
|
|
481
|
-
|
|
488
|
+
|
|
482
489
|
const fileInfo = {
|
|
483
490
|
id,
|
|
484
491
|
file_name: name,
|
|
485
492
|
mime_type: rootFile.fileType,
|
|
486
493
|
};
|
|
487
|
-
|
|
494
|
+
|
|
488
495
|
this.$set(this.nativeFiles, id, rootFile);
|
|
489
496
|
this.addToFiles(fileInfo);
|
|
490
497
|
} else {
|
|
@@ -511,6 +518,7 @@ export default {
|
|
|
511
518
|
return null;
|
|
512
519
|
},
|
|
513
520
|
start() {
|
|
521
|
+
this.uploading = true;
|
|
514
522
|
if (this.parentRecordList(this) === null) {
|
|
515
523
|
this.row_id = null;
|
|
516
524
|
}
|
|
@@ -92,6 +92,27 @@ export default {
|
|
|
92
92
|
|
|
93
93
|
});
|
|
94
94
|
},
|
|
95
|
+
disableForm(config) {
|
|
96
|
+
config.forEach(item => {
|
|
97
|
+
|
|
98
|
+
//If the element has containers
|
|
99
|
+
if (Array.isArray(item)) {
|
|
100
|
+
this.disableForm(item);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
//If the element has items
|
|
104
|
+
if (item.items) {
|
|
105
|
+
this.disableForm(item.items);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
//Disable element
|
|
109
|
+
if (item && item.config) {
|
|
110
|
+
item.config.disabled = true;
|
|
111
|
+
item.config.readonly = true;
|
|
112
|
+
item.config.editable = false;
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
},
|
|
95
116
|
loadScreen(id) {
|
|
96
117
|
this.config = defaultConfig;
|
|
97
118
|
this.computed = [];
|
|
@@ -109,6 +130,10 @@ export default {
|
|
|
109
130
|
this.watchers = response.data.watchers;
|
|
110
131
|
this.screenTitle = response.data.title;
|
|
111
132
|
|
|
133
|
+
if (this.$attrs['disabled']) {
|
|
134
|
+
this.disableForm(this.config);
|
|
135
|
+
}
|
|
136
|
+
|
|
112
137
|
if (this.ancestorScreens.includes(this.screenTitle)) {
|
|
113
138
|
globalObject.ProcessMaker.alert(`Rendering of nested "${this.screenTitle}" screen was disallowed to prevent loop.`, 'warning');
|
|
114
139
|
} else {
|
|
@@ -116,6 +141,7 @@ export default {
|
|
|
116
141
|
globalObject['nestedScreens'] = {};
|
|
117
142
|
}
|
|
118
143
|
globalObject.nestedScreens['id_' + id] = this.config;
|
|
144
|
+
this.$root.$emit('nested-screen-updated');
|
|
119
145
|
}
|
|
120
146
|
});
|
|
121
147
|
}
|
|
@@ -370,7 +370,7 @@ export default {
|
|
|
370
370
|
showEditForm(index, rowId) {
|
|
371
371
|
let pageIndex = ((this.currentPage-1) * this.perPage) + index;
|
|
372
372
|
// Reset edit to be a copy of our data model item
|
|
373
|
-
this.editItem = _.find(this.tableData.data, {'row_id': rowId});
|
|
373
|
+
this.editItem = JSON.parse(JSON.stringify(_.find(this.tableData.data, {'row_id': rowId})));
|
|
374
374
|
this.editIndex = pageIndex;
|
|
375
375
|
// rebuild the edit screen to avoid
|
|
376
376
|
this.editFormVersion++;
|
|
@@ -387,7 +387,7 @@ export default {
|
|
|
387
387
|
|
|
388
388
|
// Edit the item in our model and emit change
|
|
389
389
|
let data = this.tableData.data ? JSON.parse(JSON.stringify(this.tableData.data)) : [];
|
|
390
|
-
var index = _.findIndex(data, {'row_id': this.editItem.
|
|
390
|
+
var index = _.findIndex(data, {'row_id': this.editItem.row_id});
|
|
391
391
|
data[index] = JSON.parse(JSON.stringify(this.editItem));
|
|
392
392
|
|
|
393
393
|
// Remove the parent object
|
|
@@ -474,6 +474,7 @@ export default {
|
|
|
474
474
|
watch: {
|
|
475
475
|
config: {
|
|
476
476
|
handler() {
|
|
477
|
+
this.checkForCaptchaInLoops();
|
|
477
478
|
this.$emit('change', this.config);
|
|
478
479
|
this.loadVariablesTree();
|
|
479
480
|
},
|
|
@@ -517,6 +518,36 @@ export default {
|
|
|
517
518
|
refreshContent() {
|
|
518
519
|
this.editorContentKey++;
|
|
519
520
|
},
|
|
521
|
+
checkForCaptchaInLoops() {
|
|
522
|
+
this.config.forEach(page => {
|
|
523
|
+
this.checkForCaptcha(page.items);
|
|
524
|
+
});
|
|
525
|
+
},
|
|
526
|
+
checkForCaptcha(items, insideLoop = false, nestedScreen = null) {
|
|
527
|
+
items.forEach(item => {
|
|
528
|
+
if (!item.items && item.component == 'Captcha' && insideLoop) {
|
|
529
|
+
if (nestedScreen && nestedScreen.config.screen) {
|
|
530
|
+
this.$root.$emit('remove-nested', nestedScreen.config.screen);
|
|
531
|
+
nestedScreen.config.screen = null;
|
|
532
|
+
globalObject.ProcessMaker.alert(this.$t('You are trying to place a nested screen within CAPTCHA elements inside a loop. CAPTCHA controls cannot be placed within a Loop control.'), 'danger');
|
|
533
|
+
} else {
|
|
534
|
+
items.splice(items.indexOf(item), 1);
|
|
535
|
+
globalObject.ProcessMaker.alert(this.$t('CAPTCHA controls cannot be placed within a Loop control.'), 'danger');
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
if (item.items) {
|
|
539
|
+
this.checkForCaptcha(item.items, true, nestedScreen);
|
|
540
|
+
}
|
|
541
|
+
if (item.component == 'FormNestedScreen' && item.config.screen && window.nestedScreens) {
|
|
542
|
+
let nestedScreenItems = window.nestedScreens['id_' + item.config.screen];
|
|
543
|
+
if (nestedScreenItems) {
|
|
544
|
+
nestedScreenItems.forEach(nestedScreenPage => {
|
|
545
|
+
this.checkForCaptcha(nestedScreenPage.items, insideLoop, item);
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
},
|
|
520
551
|
loadVariablesTree() {
|
|
521
552
|
const definition = {
|
|
522
553
|
config : this.$parent.config,
|
|
@@ -819,7 +850,7 @@ export default {
|
|
|
819
850
|
registerStoreModule(moduleName, storeModule) {
|
|
820
851
|
const store = this.$store;
|
|
821
852
|
|
|
822
|
-
if (
|
|
853
|
+
if (store && store.state && !store.state[moduleName]) {
|
|
823
854
|
store.registerModule(moduleName, storeModule);
|
|
824
855
|
}
|
|
825
856
|
},
|
|
@@ -843,6 +874,10 @@ export default {
|
|
|
843
874
|
},
|
|
844
875
|
mounted() {
|
|
845
876
|
this.loadVariablesTree();
|
|
877
|
+
this.checkForCaptchaInLoops();
|
|
878
|
+
this.$root.$on('nested-screen-updated', () => {
|
|
879
|
+
this.checkForCaptchaInLoops();
|
|
880
|
+
});
|
|
846
881
|
},
|
|
847
882
|
};
|
|
848
883
|
</script>
|
|
@@ -17,7 +17,7 @@ import globalErrorsModule from '@/store/modules/global-errors';
|
|
|
17
17
|
|
|
18
18
|
const csstree = require('css-tree');
|
|
19
19
|
const Scrollparent = require('scrollparent');
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
export default {
|
|
22
22
|
name: 'VueFormRenderer',
|
|
23
23
|
components: { CustomCssOutput },
|
|
@@ -123,7 +123,7 @@ export default {
|
|
|
123
123
|
registerStoreModule(moduleName, storeModule) {
|
|
124
124
|
const store = this.$store;
|
|
125
125
|
|
|
126
|
-
if (
|
|
126
|
+
if (store && store.state && !store.state[moduleName]) {
|
|
127
127
|
store.registerModule(moduleName, storeModule);
|
|
128
128
|
}
|
|
129
129
|
},
|