@processmaker/modeler 1.39.25 → 1.39.26
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/modeler.common.js +78 -40
- package/dist/modeler.common.js.map +1 -1
- package/dist/modeler.umd.js +78 -40
- package/dist/modeler.umd.js.map +1 -1
- package/dist/modeler.umd.min.js +3 -3
- package/dist/modeler.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/crown/crownButtons/previewButton.vue +20 -2
- package/src/components/inspectors/PreviewPanel.vue +15 -3
- package/src/components/modeler/Modeler.vue +3 -0
- package/src/setup/initialLoad.js +22 -0
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<crown-button
|
|
3
|
-
v-if="
|
|
3
|
+
v-if="displayIcon"
|
|
4
4
|
:title="$t('Preview')"
|
|
5
5
|
role="menuitem"
|
|
6
6
|
id="preview-button"
|
|
7
7
|
aria-label="Preview"
|
|
8
|
+
data-test="preview-button"
|
|
8
9
|
@click="preview()"
|
|
9
10
|
v-b-tooltip.hover.viewport.d50="{ customClass: 'no-pointer-events' }"
|
|
10
11
|
>
|
|
@@ -24,8 +25,21 @@ export default {
|
|
|
24
25
|
return {
|
|
25
26
|
trashIcon,
|
|
26
27
|
validPreviewElements,
|
|
28
|
+
displayIcon: false,
|
|
27
29
|
};
|
|
28
30
|
},
|
|
31
|
+
mounted() {
|
|
32
|
+
const defaultDataTransform = (node) => Object.entries(node.definition).reduce((data, [key, value]) => {
|
|
33
|
+
data[key] = value;
|
|
34
|
+
return data;
|
|
35
|
+
}, {});
|
|
36
|
+
const nodeData = defaultDataTransform(this.node);
|
|
37
|
+
|
|
38
|
+
const previewConfig = window.ProcessMaker.$modeler.previewConfigs.find(config => {
|
|
39
|
+
return config.matcher(nodeData);
|
|
40
|
+
});
|
|
41
|
+
this.displayIcon = !!previewConfig;
|
|
42
|
+
},
|
|
29
43
|
computed: {
|
|
30
44
|
isPoolLane() {
|
|
31
45
|
return this.node.type === 'processmaker-modeler-lane';
|
|
@@ -33,7 +47,11 @@ export default {
|
|
|
33
47
|
},
|
|
34
48
|
methods: {
|
|
35
49
|
preview() {
|
|
36
|
-
|
|
50
|
+
if (window.ProcessMaker.$modeler.isOpenPreview) {
|
|
51
|
+
window.ProcessMaker.$modeler.isOpenPreview = false;
|
|
52
|
+
} else {
|
|
53
|
+
this.$emit('previewNode', this.node);
|
|
54
|
+
}
|
|
37
55
|
},
|
|
38
56
|
},
|
|
39
57
|
};
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
@mousedown="onMouseDown"
|
|
8
8
|
@mouseup="onMouseUp"
|
|
9
9
|
@mousemove="onMouseMove"
|
|
10
|
-
data-test="preview-
|
|
10
|
+
data-test="preview-panel"
|
|
11
11
|
>
|
|
12
12
|
<b-row class="control-bar">
|
|
13
13
|
<b-col cols="9">
|
|
@@ -138,7 +138,16 @@ export default {
|
|
|
138
138
|
if (currentValue === previousValue) {
|
|
139
139
|
return;
|
|
140
140
|
}
|
|
141
|
-
|
|
141
|
+
|
|
142
|
+
const nodeConfig = this.previewConfigs.find(config => {
|
|
143
|
+
return config.matcher(this.data);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
if (nodeConfig) {
|
|
147
|
+
this.prepareData();
|
|
148
|
+
} else {
|
|
149
|
+
this.$emit('togglePreview', false);
|
|
150
|
+
}
|
|
142
151
|
},
|
|
143
152
|
|
|
144
153
|
onSelectedPreview(item) {
|
|
@@ -159,9 +168,12 @@ export default {
|
|
|
159
168
|
clone[prop] = this.data[prop];
|
|
160
169
|
}
|
|
161
170
|
}
|
|
171
|
+
|
|
162
172
|
const nodeData = encodeURI(JSON.stringify(clone));
|
|
163
173
|
|
|
164
|
-
|
|
174
|
+
// if the node has the configurations (for example screenRef for a task in a task)
|
|
175
|
+
const nodeHasConfigParams = Object.keys(clone).length > 0;
|
|
176
|
+
this.previewUrl = previewConfig && nodeHasConfigParams ? `${previewConfig.url}?node=${nodeData}` : null;
|
|
165
177
|
this.taskTitle = this.highlightedNode?.definition?.name;
|
|
166
178
|
this.showPanel = true;
|
|
167
179
|
},
|
|
@@ -417,6 +417,9 @@ export default {
|
|
|
417
417
|
this.isOpenInspector = value;
|
|
418
418
|
},
|
|
419
419
|
handlePreview() {
|
|
420
|
+
if (this.highlightedNodes.length != 1) {
|
|
421
|
+
this.isOpenPreview = false;
|
|
422
|
+
}
|
|
420
423
|
this.$refs['preview-panel'].previewNode(true);
|
|
421
424
|
this.handleTogglePreview(true) ;
|
|
422
425
|
},
|
package/src/setup/initialLoad.js
CHANGED
|
@@ -20,3 +20,25 @@ window.ProcessMaker.EventBus.$on('modeler-init', registerNodes);
|
|
|
20
20
|
window.ProcessMaker.EventBus.$on('modeler-start', ({ loadXML }) => {
|
|
21
21
|
loadXML(blank);
|
|
22
22
|
});
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
window.ProcessMaker.EventBus.$on(
|
|
27
|
+
'modeler-init',
|
|
28
|
+
(event) => {
|
|
29
|
+
event.registerPreview({
|
|
30
|
+
url:'/designer/screens/preview',
|
|
31
|
+
receivingParams: ['screenRef'],
|
|
32
|
+
matcher: (nodeData) => {
|
|
33
|
+
return nodeData?.$type === 'bpmn:Task';
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
event.registerPreview({
|
|
37
|
+
url:'/designer/scripts/preview',
|
|
38
|
+
receivingParams: ['scriptRef'],
|
|
39
|
+
matcher: (nodeData) => {
|
|
40
|
+
return nodeData?.$type === 'bpmn:ScriptTask';
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|