@processmaker/modeler 1.43.2 → 1.43.3
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 +322 -146
- package/dist/modeler.common.js.map +1 -1
- package/dist/modeler.umd.js +322 -146
- 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/colorUtil.js +0 -1
- package/src/components/modeler/Modeler.vue +41 -0
- package/src/components/modeler/Selection.vue +13 -0
- package/src/components/nodes/boundaryTimerEvent/index.js +2 -3
- package/src/mixins/highlightConfig.js +59 -17
- package/src/mixins/linkConfig.js +12 -0
- package/src/multiplayer/multiplayer.js +39 -1
package/package.json
CHANGED
package/src/colorUtil.js
CHANGED
|
@@ -44,7 +44,6 @@ export default class ColorUtil {
|
|
|
44
44
|
* @returns {Number}
|
|
45
45
|
*/
|
|
46
46
|
generateHSL(name) {
|
|
47
|
-
console.log(name);
|
|
48
47
|
const hash = this.getHashOfString(name);
|
|
49
48
|
const h = this.normalizeHash(hash, 0, 360);
|
|
50
49
|
const s = this.normalizeHash(hash, this.saturationRange[0], this.saturationRange[1]);
|
|
@@ -1731,6 +1731,47 @@ export default {
|
|
|
1731
1731
|
this.players = this.players.map((item) => (item.id === data.id ? { ...item, ...data } : item));
|
|
1732
1732
|
}
|
|
1733
1733
|
},
|
|
1734
|
+
/**
|
|
1735
|
+
* Unhightligt selected Nodes
|
|
1736
|
+
* @param {String} clientId
|
|
1737
|
+
*/
|
|
1738
|
+
unhightligtNodes(clientId) {
|
|
1739
|
+
const player = this.players.find(player => player.id === clientId);
|
|
1740
|
+
|
|
1741
|
+
player?.selectedNodes?.forEach((nodeId) => {
|
|
1742
|
+
const element = this.getElementByNodeId(nodeId);
|
|
1743
|
+
element.component.setHighlightColor(false, player.color);
|
|
1744
|
+
});
|
|
1745
|
+
},
|
|
1746
|
+
/**
|
|
1747
|
+
* Update the hightligted nodes
|
|
1748
|
+
* @param {Object} data
|
|
1749
|
+
*/
|
|
1750
|
+
updateHightligtedNodes(data) {
|
|
1751
|
+
if (data) {
|
|
1752
|
+
this.unhightligtNodes(data.id);
|
|
1753
|
+
// highlight selected shape
|
|
1754
|
+
this.players = this.players.map((item) => (item.id === data.id ? { ...item, ...data } : item));
|
|
1755
|
+
data?.selectedNodes?.forEach((nodeId) => {
|
|
1756
|
+
const element = this.getElementByNodeId(nodeId);
|
|
1757
|
+
element.component.setHighlightColor(true, data.color);
|
|
1758
|
+
});
|
|
1759
|
+
}
|
|
1760
|
+
},
|
|
1761
|
+
isMultiplayerSelected(data) {
|
|
1762
|
+
let intersectionExists = false;
|
|
1763
|
+
if (data) {
|
|
1764
|
+
this.players?.some((player) => {
|
|
1765
|
+
if (intersectionExists) {
|
|
1766
|
+
return true; // This will break out of the loop
|
|
1767
|
+
}
|
|
1768
|
+
intersectionExists = player?.selectedNodes?.some(item => data.includes(item));
|
|
1769
|
+
return false;
|
|
1770
|
+
});
|
|
1771
|
+
|
|
1772
|
+
}
|
|
1773
|
+
return intersectionExists;
|
|
1774
|
+
},
|
|
1734
1775
|
removePlayer(playerId) {
|
|
1735
1776
|
const playerIndex = this.players.findIndex(player => player.id === playerId);
|
|
1736
1777
|
|
|
@@ -112,6 +112,7 @@ export default {
|
|
|
112
112
|
selected(newSelected) {
|
|
113
113
|
this.prepareConectedLinks(newSelected);
|
|
114
114
|
this.addToHighlightedNodes(newSelected);
|
|
115
|
+
this.highlightNodesMultiplayer (newSelected);
|
|
115
116
|
},
|
|
116
117
|
},
|
|
117
118
|
methods: {
|
|
@@ -780,6 +781,18 @@ export default {
|
|
|
780
781
|
store.commit('highlightNode', this.processNode);
|
|
781
782
|
}
|
|
782
783
|
},
|
|
784
|
+
highlightNodesMultiplayer(selected){
|
|
785
|
+
// Update selected nodes
|
|
786
|
+
window.ProcessMaker.EventBus.$emit('multiplayer-updateSelectedNodes', this.getSelectedNodeKeys(selected));
|
|
787
|
+
},
|
|
788
|
+
getSelectedNodeKeys(selected) {
|
|
789
|
+
const keys = [];
|
|
790
|
+
selected.forEach(shape => {
|
|
791
|
+
const { node } = shape.model.component;
|
|
792
|
+
keys.push( node.definition.id);
|
|
793
|
+
});
|
|
794
|
+
return keys;
|
|
795
|
+
},
|
|
783
796
|
/**
|
|
784
797
|
* Gets the child shape
|
|
785
798
|
* @param {object} point
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import component from './boundaryTimerEvent.vue';
|
|
2
2
|
import IntermediateTimer from '../../inspectors/IntermediateTimer.vue';
|
|
3
3
|
import boundaryEventConfig from '../boundaryEvent';
|
|
4
|
-
import merge from 'lodash/merge';
|
|
5
|
-
import cloneDeep from 'lodash/cloneDeep';
|
|
6
4
|
import interruptingToggleConfig from '../boundaryEvent/interruptingToggleInspector';
|
|
7
5
|
import advancedAccordionConfig from '@/components/inspectors/advancedAccordionConfig';
|
|
8
6
|
import documentationAccordionConfig from '@/components/inspectors/documentationAccordionConfig';
|
|
9
7
|
import { defaultDurationTimerEvent } from '@/constants';
|
|
8
|
+
import { omit, cloneDeep, merge } from 'lodash';
|
|
10
9
|
|
|
11
10
|
export const id = 'processmaker-modeler-boundary-timer-event';
|
|
12
11
|
|
|
@@ -42,7 +41,7 @@ export default merge(cloneDeep(boundaryEventConfig), {
|
|
|
42
41
|
inspectorData(node) {
|
|
43
42
|
return Object.entries(node.definition).reduce((data, [key, value]) => {
|
|
44
43
|
if (key === 'eventDefinitions') {
|
|
45
|
-
const type = Object.keys(value[0])[
|
|
44
|
+
const type = Object.keys(omit(value[0], ['id', '$type', 'get', 'set', '$instanceOf']))[0];
|
|
46
45
|
const body = value[0][type].body;
|
|
47
46
|
data[key] = { type, body };
|
|
48
47
|
} else {
|
|
@@ -117,25 +117,54 @@ export default {
|
|
|
117
117
|
},
|
|
118
118
|
},
|
|
119
119
|
methods: {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
120
|
+
prepareCustomColorHighlighter(color) {
|
|
121
|
+
return {
|
|
122
|
+
highlighter: {
|
|
123
|
+
name: 'stroke',
|
|
124
|
+
options: {
|
|
125
|
+
attrs: {
|
|
126
|
+
stroke: color,
|
|
127
|
+
'stroke-width': 3,
|
|
128
|
+
'data-cy': 'selected',
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
partial: false,
|
|
132
|
+
type: 'default',
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
},
|
|
136
|
+
setHighlightColor(highlighted, color) {
|
|
137
|
+
if (!this.shapeView) {
|
|
136
138
|
return;
|
|
137
139
|
}
|
|
138
|
-
|
|
140
|
+
if (highlighted) {
|
|
141
|
+
this.shapeView.unhighlight(this.shapeBody, errorHighlighter);
|
|
142
|
+
this.shapeView.highlight(this.shapeBody, this.prepareCustomColorHighlighter(color));
|
|
143
|
+
} else {
|
|
144
|
+
this.shapeView.unhighlight(this.shapeBody, this.prepareCustomColorHighlighter(color));
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
},
|
|
148
|
+
setShapeHighlightForReadOnly() {
|
|
149
|
+
if (!this.shapeView) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
this.shapeView.unhighlight(this.shapeBody, completedHighlighter);
|
|
153
|
+
if (this.isCompleted) {
|
|
154
|
+
this.shape.attr('body/fill', COLOR_COMPLETED_FILL);
|
|
155
|
+
this.shapeView.highlight(this.shapeBody, completedHighlighter);
|
|
156
|
+
}
|
|
157
|
+
this.shapeView.unhighlight(this.shapeBody, inProgressHighlighter);
|
|
158
|
+
if (this.isInProgress) {
|
|
159
|
+
this.shape.attr('body/fill', COLOR_IN_PROGRESS_FILL);
|
|
160
|
+
this.shapeView.highlight(this.shapeBody, inProgressHighlighter);
|
|
161
|
+
}
|
|
162
|
+
if (this.isIdle) {
|
|
163
|
+
this.shape.attr('body/fill', COLOR_IDLE_FILL);
|
|
164
|
+
this.shapeView.highlight(this.shapeBody, idleHighlighter);
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
setShapeHighlightForDefault() {
|
|
139
168
|
if (!this.shapeView) {
|
|
140
169
|
return;
|
|
141
170
|
}
|
|
@@ -148,6 +177,19 @@ export default {
|
|
|
148
177
|
this.shapeView.highlight(this.shapeBody, defaultHighlighter);
|
|
149
178
|
}
|
|
150
179
|
},
|
|
180
|
+
setShapeHighlight() {
|
|
181
|
+
if (!this.shapeView) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
this.shapeView.unhighlight(this.shapeBody, errorHighlighter);
|
|
185
|
+
if (store.getters.isReadOnly) {
|
|
186
|
+
this.setShapeHighlightForReadOnly();
|
|
187
|
+
} else {
|
|
188
|
+
this.setShapeHighlightForDefault();
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
|
|
151
193
|
setBorderOutline(borderOutline) {
|
|
152
194
|
if (this.currentBorderOutline) {
|
|
153
195
|
this.shapeView.unhighlight(this.shapeBody, this.currentBorderOutline);
|
package/src/mixins/linkConfig.js
CHANGED
|
@@ -82,6 +82,18 @@ export default {
|
|
|
82
82
|
},
|
|
83
83
|
},
|
|
84
84
|
methods: {
|
|
85
|
+
setHighlightColor(highlighted, color){
|
|
86
|
+
if (highlighted) {
|
|
87
|
+
this.shape.attr({
|
|
88
|
+
line: { stroke: color },
|
|
89
|
+
'.joint-highlight-stroke': { 'display': 'none' },
|
|
90
|
+
});
|
|
91
|
+
this.shapeView.showTools();
|
|
92
|
+
} else {
|
|
93
|
+
resetShapeColor(this.shape);
|
|
94
|
+
this.shapeView.hideTools();
|
|
95
|
+
}
|
|
96
|
+
},
|
|
85
97
|
setShapeHighlight() {
|
|
86
98
|
if (this.isCompleted) {
|
|
87
99
|
this.shape.attr({
|
|
@@ -67,6 +67,8 @@ export default class Multiplayer {
|
|
|
67
67
|
});
|
|
68
68
|
|
|
69
69
|
this.clientIO.on('clientLeft', (payload) => {
|
|
70
|
+
// Unhighlight nodes
|
|
71
|
+
this.modeler.unhightligtNodes(payload.clientId);
|
|
70
72
|
// Remove the player from the multiplayer list
|
|
71
73
|
this.modeler.removePlayer(payload.clientId);
|
|
72
74
|
|
|
@@ -80,11 +82,17 @@ export default class Multiplayer {
|
|
|
80
82
|
this.syncLocalNodes(clientId);
|
|
81
83
|
}
|
|
82
84
|
});
|
|
83
|
-
|
|
85
|
+
|
|
86
|
+
// Listen for updates when the cursor data was updated
|
|
84
87
|
this.clientIO.on('updateUserCursor', async(payload) => {
|
|
85
88
|
this.updateClientCursor(payload);
|
|
86
89
|
});
|
|
87
90
|
|
|
91
|
+
// Listen for updates when the cursor data was updated
|
|
92
|
+
this.clientIO.on('selectedNodesWasUpdated', async(payload) => {
|
|
93
|
+
this.updateHightligtedNodes(payload);
|
|
94
|
+
});
|
|
95
|
+
|
|
88
96
|
// Listen for updates when a new element is added
|
|
89
97
|
this.clientIO.on('createElement', async(payload) => {
|
|
90
98
|
// Create the new element in the process
|
|
@@ -197,6 +205,11 @@ export default class Multiplayer {
|
|
|
197
205
|
this.updateFlows(data);
|
|
198
206
|
}
|
|
199
207
|
});
|
|
208
|
+
window.ProcessMaker.EventBus.$on('multiplayer-updateSelectedNodes', ( data ) => {
|
|
209
|
+
if (this.modeler.isMultiplayer) {
|
|
210
|
+
this.updateSelectedNodes(data);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
200
213
|
window.ProcessMaker.EventBus.$on('multiplayer-updateMousePosition', ( data ) => {
|
|
201
214
|
if (this.modeler.isMultiplayer) {
|
|
202
215
|
this.updateMousePosition(data);
|
|
@@ -241,6 +254,31 @@ export default class Multiplayer {
|
|
|
241
254
|
this.modeler.updateClientCursor(client);
|
|
242
255
|
});
|
|
243
256
|
}
|
|
257
|
+
/**
|
|
258
|
+
* Updates the selected nodes by the user
|
|
259
|
+
* @param {Object} data
|
|
260
|
+
*/
|
|
261
|
+
updateSelectedNodes(data) {
|
|
262
|
+
const warningMessage = 'Another user is working on this object, wait until they finish making changes.';
|
|
263
|
+
if (this.modeler.isMultiplayerSelected(data)) {
|
|
264
|
+
window.ProcessMaker.alert(warningMessage, 'warning');
|
|
265
|
+
}
|
|
266
|
+
this.clientIO.emit('updateSelectedNodes', {
|
|
267
|
+
clientId: this.clientIO.id,
|
|
268
|
+
roomName: this.room.getRoom(),
|
|
269
|
+
selectedNodes: data,
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Update highlighted nodes
|
|
274
|
+
* @param {Object} data
|
|
275
|
+
*/
|
|
276
|
+
updateHightligtedNodes(payload) {
|
|
277
|
+
payload.clients.map(client => {
|
|
278
|
+
this.modeler.updateHightligtedNodes(client);
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
|
|
244
282
|
/**
|
|
245
283
|
* Sync the modeler nodes with the microservice
|
|
246
284
|
* @param {String} clientId
|