@processmaker/modeler 1.39.23 → 1.39.25
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 +279 -80
- package/dist/modeler.common.js.map +1 -1
- package/dist/modeler.umd.js +279 -80
- package/dist/modeler.umd.js.map +1 -1
- package/dist/modeler.umd.min.js +4 -4
- package/dist/modeler.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/inspectors/InspectorPanel.vue +16 -7
- package/src/components/inspectors/LoopCharacteristics.js +7 -1
- package/src/components/modeler/Modeler.vue +19 -29
- package/src/components/nodes/boundaryTimerEvent/index.js +3 -0
- package/src/components/nodes/conditionalEventDefinition/index.js +9 -1
- package/src/components/nodes/errorEndEvent/index.js +20 -1
- package/src/components/nodes/intermediateTimerEvent/index.js +8 -0
- package/src/components/nodes/messageEventDefinition/index.js +3 -1
- package/src/components/nodes/sequenceFlow/index.js +3 -0
- package/src/components/nodes/signalEventDefinition/index.js +3 -1
- package/src/components/nodes/startTimerEvent/index.js +8 -0
- package/src/components/nodes/subProcess/index.js +6 -1
- package/src/components/nodes/task/index.js +4 -4
- package/src/components/nodes/task/shape.js +0 -4
- package/src/multiplayer/multiplayer.js +96 -2
- package/src/store.js +5 -1
package/package.json
CHANGED
|
@@ -146,9 +146,10 @@ export default {
|
|
|
146
146
|
: undefined;
|
|
147
147
|
|
|
148
148
|
this.setNodeProp(this.highlightedNode, 'documentation', documentation);
|
|
149
|
+
this.multiplayerHook('documentation', documentation, store.state.isMultiplayer);
|
|
149
150
|
}
|
|
150
151
|
|
|
151
|
-
inspectorHandler(omit(value, ['documentation']));
|
|
152
|
+
inspectorHandler(omit(value, ['documentation']), store.state.isMultiplayer);
|
|
152
153
|
};
|
|
153
154
|
},
|
|
154
155
|
hasCustomInspectorHandler() {
|
|
@@ -240,20 +241,21 @@ export default {
|
|
|
240
241
|
isConnectedToSubProcess(definition) {
|
|
241
242
|
return definition.targetRef.$type === 'bpmn:CallActivity';
|
|
242
243
|
},
|
|
243
|
-
customInspectorHandler(value) {
|
|
244
|
-
return this.nodeRegistry[this.highlightedNode.type].inspectorHandler(value, this.highlightedNode, this.setNodeProp, this.moddle, this.definitions, this.defaultInspectorHandler);
|
|
244
|
+
customInspectorHandler(value, isMultiplayer) {
|
|
245
|
+
return this.nodeRegistry[this.highlightedNode.type].inspectorHandler(value, this.highlightedNode, this.setNodeProp, this.moddle, this.definitions, this.defaultInspectorHandler, isMultiplayer);
|
|
245
246
|
},
|
|
246
|
-
processNodeInspectorHandler(value) {
|
|
247
|
-
return this.defaultInspectorHandler(omit(value, ['artifacts', 'flowElements', 'laneSets']));
|
|
247
|
+
processNodeInspectorHandler(value, isMultiplayer) {
|
|
248
|
+
return this.defaultInspectorHandler(omit(value, ['artifacts', 'flowElements', 'laneSets']), isMultiplayer);
|
|
248
249
|
},
|
|
249
250
|
setNodeProp(node, key, value) {
|
|
250
251
|
this.$emit('shape-resize');
|
|
251
252
|
store.commit('updateNodeProp', { node, key, value });
|
|
252
253
|
},
|
|
253
|
-
defaultInspectorHandler(value) {
|
|
254
|
+
defaultInspectorHandler(value, isMultiplayer) {
|
|
254
255
|
/* Go through each property and rebind it to our data */
|
|
255
256
|
for (const key in omit(value, ['$type', 'eventDefinitions'])) {
|
|
256
|
-
if (this.highlightedNode.definition.get(key) !== value[key]) {
|
|
257
|
+
if (this.highlightedNode.definition.get(key) !== value[key]) {
|
|
258
|
+
this.multiplayerHook(key, value[key], isMultiplayer);
|
|
257
259
|
this.setNodeProp(this.highlightedNode, key, value[key]);
|
|
258
260
|
}
|
|
259
261
|
}
|
|
@@ -261,6 +263,13 @@ export default {
|
|
|
261
263
|
updateState() {
|
|
262
264
|
this.$emit('save-state');
|
|
263
265
|
},
|
|
266
|
+
multiplayerHook(key, value, isMultiplayer) {
|
|
267
|
+
if (isMultiplayer) {
|
|
268
|
+
window.ProcessMaker.EventBus.$emit('multiplayer-updateInspectorProperty', {
|
|
269
|
+
id: this.highlightedNode.definition.id , key, value,
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
},
|
|
264
273
|
},
|
|
265
274
|
};
|
|
266
275
|
</script>
|
|
@@ -2,13 +2,19 @@ import LoopCharactetistics from '@/components/inspectors/LoopCharacteristics.vue
|
|
|
2
2
|
import NodeInspector from '@/NodeInspector';
|
|
3
3
|
import omit from 'lodash/omit';
|
|
4
4
|
|
|
5
|
-
export const loopCharacteristicsHandler = function(value, node, setNodeProp, moddle, definitions) {
|
|
5
|
+
export const loopCharacteristicsHandler = function(value, node, setNodeProp, moddle, definitions, isMultiplayer) {
|
|
6
6
|
const nodeInspector = new NodeInspector(definitions, { prefix: `${node.definition.id}_inner` });
|
|
7
7
|
let update = nodeInspector.setDefinitionProps(value.$loopCharactetistics, setNodeProp, moddle, {});
|
|
8
8
|
update = nodeInspector.setReferences(update);
|
|
9
9
|
if (update.loopCharacteristics) {
|
|
10
10
|
delete node.definition.loopCharacteristics;
|
|
11
|
+
if (isMultiplayer) {
|
|
12
|
+
window.ProcessMaker.EventBus.$emit('multiplayer-updateInspectorProperty', {
|
|
13
|
+
id: node.definition.id , key: 'loopCharacteristics', value: update.loopCharacteristics,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
11
16
|
setNodeProp(node, 'loopCharacteristics', update.loopCharacteristics);
|
|
17
|
+
|
|
12
18
|
} else {
|
|
13
19
|
node.definition.loopCharacteristics = null;
|
|
14
20
|
delete node.definition.loopCharacteristics;
|
|
@@ -330,8 +330,6 @@ export default {
|
|
|
330
330
|
showInspectorButton: true,
|
|
331
331
|
inspectorButtonRight: 65,
|
|
332
332
|
previewConfigs: [],
|
|
333
|
-
multiplayer: null,
|
|
334
|
-
isMultiplayer: false,
|
|
335
333
|
flowTypes: [
|
|
336
334
|
'processmaker-modeler-sequence-flow',
|
|
337
335
|
'processmaker-modeler-message-flow',
|
|
@@ -403,6 +401,7 @@ export default {
|
|
|
403
401
|
return getInvalidNodes(this.validationErrors, this.nodes);
|
|
404
402
|
},
|
|
405
403
|
showComponent: () => store.getters.showComponent,
|
|
404
|
+
isMultiplayer: () => store.getters.isMultiplayer,
|
|
406
405
|
},
|
|
407
406
|
methods: {
|
|
408
407
|
registerPreview(config) {
|
|
@@ -1161,8 +1160,15 @@ export default {
|
|
|
1161
1160
|
width: node.diagram.bounds.width,
|
|
1162
1161
|
type: node.type,
|
|
1163
1162
|
id: node.definition.id,
|
|
1163
|
+
oldNodeId: null,
|
|
1164
1164
|
isAddingLaneAbove: true,
|
|
1165
|
-
color: node.color,
|
|
1165
|
+
color: node.definition.color,
|
|
1166
|
+
dueIn: node.definition.dueIn,
|
|
1167
|
+
name: node.definition.name,
|
|
1168
|
+
assignedUsers: node.definition.assignedUsers,
|
|
1169
|
+
config: node.definition.config,
|
|
1170
|
+
loopCharacteristics: null,
|
|
1171
|
+
gatewayDirection: null,
|
|
1166
1172
|
};
|
|
1167
1173
|
if (node?.pool?.component) {
|
|
1168
1174
|
defaultData['poolId'] = node.pool.component.id;
|
|
@@ -1258,7 +1264,7 @@ export default {
|
|
|
1258
1264
|
},
|
|
1259
1265
|
async removeNode(node, options) {
|
|
1260
1266
|
// Check if the node is not replaced
|
|
1261
|
-
if (this.isMultiplayer
|
|
1267
|
+
if (this.isMultiplayer) {
|
|
1262
1268
|
// Emit event to server to remove node
|
|
1263
1269
|
window.ProcessMaker.EventBus.$emit('multiplayer-removeNode', node);
|
|
1264
1270
|
}
|
|
@@ -1318,35 +1324,19 @@ export default {
|
|
|
1318
1324
|
control: { type: typeToReplaceWith },
|
|
1319
1325
|
nodeThatWillBeReplaced: node,
|
|
1320
1326
|
};
|
|
1321
|
-
|
|
1322
|
-
await this.replaceNodeProcedure(nodeData);
|
|
1327
|
+
await this.replaceNodeProcedure(nodeData, true);
|
|
1323
1328
|
});
|
|
1324
1329
|
});
|
|
1325
1330
|
},
|
|
1326
1331
|
async replaceNodeProcedure(data, isReplaced = false) {
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
const newNode = await this.handleDrop(data);
|
|
1333
|
-
|
|
1334
|
-
await this.removeNode(data.nodeThatWillBeReplaced, { removeRelationships: false, isReplaced });
|
|
1335
|
-
this.highlightNode(newNode);
|
|
1336
|
-
this.selectNewNode(newNode);
|
|
1337
|
-
|
|
1338
|
-
if (this.isMultiplayer && !isReplaced) {
|
|
1339
|
-
// Get all node types
|
|
1340
|
-
const nodeTypes = nodeTypesStore.getters.getNodeTypes;
|
|
1341
|
-
// Get the new control
|
|
1342
|
-
const newControl = nodeTypes.flatMap(nodeType => {
|
|
1343
|
-
return nodeType.items?.filter(item => item.type === data.typeToReplaceWith);
|
|
1344
|
-
}).filter(Boolean);
|
|
1345
|
-
// If the new control is found, emit event to server to replace node
|
|
1346
|
-
if (newControl.length === 1) {
|
|
1347
|
-
window.ProcessMaker.EventBus.$emit('multiplayer-replaceNode', { data, newControl: newControl[0].type });
|
|
1348
|
-
}
|
|
1332
|
+
if (isReplaced) {
|
|
1333
|
+
// Get the clientX and clientY from the node that will be replaced
|
|
1334
|
+
const { x: clientX, y: clientY } = this.paper.localToClientPoint(data.nodeThatWillBeReplaced.diagram.bounds);
|
|
1335
|
+
data.clientX = clientX;
|
|
1336
|
+
data.clientY = clientY;
|
|
1349
1337
|
}
|
|
1338
|
+
await this.handleDrop(data);
|
|
1339
|
+
await this.removeNode(data.nodeThatWillBeReplaced, { removeRelationships: false, isReplaced });
|
|
1350
1340
|
},
|
|
1351
1341
|
replaceAiNode({ node, typeToReplaceWith, assetId, assetName, redirectTo }) {
|
|
1352
1342
|
this.performSingleUndoRedoTransaction(async() => {
|
|
@@ -1581,7 +1571,7 @@ export default {
|
|
|
1581
1571
|
window.location = redirectTo;
|
|
1582
1572
|
},
|
|
1583
1573
|
enableMultiplayer(value) {
|
|
1584
|
-
|
|
1574
|
+
store.commit('enableMultiplayer', value);
|
|
1585
1575
|
},
|
|
1586
1576
|
addPlayer(player) {
|
|
1587
1577
|
this.players.push(player);
|
|
@@ -70,6 +70,9 @@ export default merge(cloneDeep(boundaryEventConfig), {
|
|
|
70
70
|
|
|
71
71
|
setNodeProp(node, 'eventDefinitions', eventDefinitions);
|
|
72
72
|
} else {
|
|
73
|
+
window.ProcessMaker.EventBus.$emit('multiplayer-updateInspectorProperty', {
|
|
74
|
+
id: node.definition.id , key, value: value[key],
|
|
75
|
+
});
|
|
73
76
|
setNodeProp(node, key, value[key]);
|
|
74
77
|
}
|
|
75
78
|
}
|
|
@@ -25,14 +25,22 @@ export default {
|
|
|
25
25
|
}, {});
|
|
26
26
|
},
|
|
27
27
|
inspectorHandler(value, node, setNodeProp) {
|
|
28
|
-
|
|
29
28
|
for (const key in omit(value, ['$type', 'eventDefinitions'])) {
|
|
30
29
|
if (node.definition[key] === value[key]) {
|
|
31
30
|
continue;
|
|
32
31
|
}
|
|
33
32
|
if (key === 'condition') {
|
|
34
33
|
node.definition.get('eventDefinitions')[0].get('condition').body = value[key];
|
|
34
|
+
|
|
35
|
+
window.ProcessMaker.EventBus.$emit('multiplayer-updateInspectorProperty', {
|
|
36
|
+
id: node.definition.id,
|
|
37
|
+
key,
|
|
38
|
+
value: value[key],
|
|
39
|
+
});
|
|
35
40
|
} else {
|
|
41
|
+
window.ProcessMaker.EventBus.$emit('multiplayer-updateInspectorProperty', {
|
|
42
|
+
id: node.definition.id , key, value: value[key],
|
|
43
|
+
});
|
|
36
44
|
setNodeProp(node, key, value[key]);
|
|
37
45
|
}
|
|
38
46
|
}
|
|
@@ -36,13 +36,32 @@ export default merge(cloneDeep(endEventConfig), {
|
|
|
36
36
|
if (node.definition[key] === value[key]) {
|
|
37
37
|
continue;
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
window.ProcessMaker.EventBus.$emit('multiplayer-updateInspectorProperty', {
|
|
40
|
+
id: node.definition.id , key, value: value[key],
|
|
41
|
+
});
|
|
40
42
|
setNodeProp(node, key, value[key]);
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
const error = node.definition.get('eventDefinitions')[0].errorRef;
|
|
44
46
|
if (error.name !== value.errorName) {
|
|
45
47
|
error.name = value.errorName;
|
|
48
|
+
window.ProcessMaker.EventBus.$emit('multiplayer-updateInspectorProperty', {
|
|
49
|
+
id: node.definition.id,
|
|
50
|
+
key: 'eventDefinitions',
|
|
51
|
+
value: node.definition.get('eventDefinitions'),
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
multiplayerInspectorHandler(node, data){
|
|
56
|
+
const keys = Object.keys(data).filter((key) => key !== 'id');
|
|
57
|
+
if (keys[0] === 'eventDefinitions') {
|
|
58
|
+
const error = data[keys[0]][0].errorRef;
|
|
59
|
+
const errorRef = node.definition.get('eventDefinitions')[0].errorRef;
|
|
60
|
+
if (error && errorRef) {
|
|
61
|
+
if (error.name !== errorRef.name) {
|
|
62
|
+
errorRef.name = error.name;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
46
65
|
}
|
|
47
66
|
},
|
|
48
67
|
inspectorConfig: [
|
|
@@ -121,7 +121,15 @@ export default {
|
|
|
121
121
|
moddle.create('bpmn:TimerEventDefinition', eventDefinition),
|
|
122
122
|
];
|
|
123
123
|
setNodeProp(node, 'eventDefinitions', eventDefinitions);
|
|
124
|
+
window.ProcessMaker.EventBus.$emit('multiplayer-updateInspectorProperty', {
|
|
125
|
+
id: node.definition.id,
|
|
126
|
+
key: 'eventDefinitions',
|
|
127
|
+
value: eventDefinitions,
|
|
128
|
+
});
|
|
124
129
|
} else {
|
|
130
|
+
window.ProcessMaker.EventBus.$emit('multiplayer-updateInspectorProperty', {
|
|
131
|
+
id: node.definition.id , key, value: value[key],
|
|
132
|
+
});
|
|
125
133
|
setNodeProp(node, key, value[key]);
|
|
126
134
|
}
|
|
127
135
|
}
|
|
@@ -29,7 +29,9 @@ export default {
|
|
|
29
29
|
if (node.definition[key] === value[key]) {
|
|
30
30
|
continue;
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
window.ProcessMaker.EventBus.$emit('multiplayer-updateInspectorProperty', {
|
|
33
|
+
id: node.definition.id , key, value: value[key],
|
|
34
|
+
});
|
|
33
35
|
setNodeProp(node, key, value[key]);
|
|
34
36
|
}
|
|
35
37
|
|
|
@@ -55,6 +55,9 @@ export default {
|
|
|
55
55
|
setNodeProp(node, key, conditionExpression);
|
|
56
56
|
}
|
|
57
57
|
} else {
|
|
58
|
+
window.ProcessMaker.EventBus.$emit('multiplayer-updateInspectorProperty', {
|
|
59
|
+
id: node.definition.id , key, value: value[key],
|
|
60
|
+
});
|
|
58
61
|
setNodeProp(node, key, value[key]);
|
|
59
62
|
}
|
|
60
63
|
}
|
|
@@ -30,7 +30,9 @@ export default {
|
|
|
30
30
|
if (node.definition[key] === value[key]) {
|
|
31
31
|
continue;
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
window.ProcessMaker.EventBus.$emit('multiplayer-updateInspectorProperty', {
|
|
34
|
+
id: node.definition.id , key, value: value[key],
|
|
35
|
+
});
|
|
34
36
|
setNodeProp(node, key, value[key]);
|
|
35
37
|
}
|
|
36
38
|
|
|
@@ -52,7 +52,15 @@ export default merge(cloneDeep(baseStartEventConfig), {
|
|
|
52
52
|
moddle.create('bpmn:TimerEventDefinition', eventDefinition),
|
|
53
53
|
];
|
|
54
54
|
setNodeProp(node, 'eventDefinitions', eventDefinitions);
|
|
55
|
+
window.ProcessMaker.EventBus.$emit('multiplayer-updateInspectorProperty', {
|
|
56
|
+
id: node.definition.id,
|
|
57
|
+
key: 'eventDefinitions',
|
|
58
|
+
value: eventDefinitions,
|
|
59
|
+
});
|
|
55
60
|
} else {
|
|
61
|
+
window.ProcessMaker.EventBus.$emit('multiplayer-updateInspectorProperty', {
|
|
62
|
+
id: node.definition.id , key, value: value[key],
|
|
63
|
+
});
|
|
56
64
|
setNodeProp(node, key, value[key]);
|
|
57
65
|
}
|
|
58
66
|
}
|
|
@@ -41,12 +41,17 @@ export default {
|
|
|
41
41
|
const currentConfig = JSON.parse(value.config);
|
|
42
42
|
|
|
43
43
|
value['calledElement'] = currentConfig.calledElement;
|
|
44
|
+
window.ProcessMaker.EventBus.$emit('multiplayer-updateInspectorProperty', {
|
|
45
|
+
id: node.definition.id, key: 'calledElement', value: currentConfig.calledElement,
|
|
46
|
+
});
|
|
44
47
|
setNodeProp(node, 'calledElement', currentConfig.calledElement);
|
|
45
48
|
|
|
46
49
|
if (currentConfig.name !== value.name) {
|
|
47
50
|
currentConfig.name = value.name;
|
|
48
51
|
}
|
|
49
|
-
|
|
52
|
+
window.ProcessMaker.EventBus.$emit('multiplayer-updateInspectorProperty', {
|
|
53
|
+
id: node.definition.id, key: 'config', value: JSON.stringify(currentConfig),
|
|
54
|
+
});
|
|
50
55
|
setNodeProp(node, 'config', JSON.stringify(currentConfig));
|
|
51
56
|
|
|
52
57
|
},
|
|
@@ -63,10 +63,10 @@ export default {
|
|
|
63
63
|
}),
|
|
64
64
|
});
|
|
65
65
|
},
|
|
66
|
-
inspectorHandler(value, node, setNodeProp, moddle, definitions, defaultInspectorHandler) {
|
|
67
|
-
handleMarkerFlagsValue(value.markerFlags, node, setNodeProp
|
|
68
|
-
loopCharacteristicsHandler(value, node, setNodeProp, moddle, definitions);
|
|
69
|
-
defaultInspectorHandler(omit(value, 'markerFlags', '$loopCharactetistics'));
|
|
66
|
+
inspectorHandler(value, node, setNodeProp, moddle, definitions, defaultInspectorHandler, isMultiplayer) {
|
|
67
|
+
handleMarkerFlagsValue(value.markerFlags, node, setNodeProp);
|
|
68
|
+
loopCharacteristicsHandler(value, node, setNodeProp, moddle, definitions, isMultiplayer);
|
|
69
|
+
defaultInspectorHandler(omit(value, 'markerFlags', '$loopCharactetistics'), isMultiplayer);
|
|
70
70
|
},
|
|
71
71
|
inspectorData(node, defaultDataTransform, inspector) {
|
|
72
72
|
const inspectorData = defaultDataTransform(node);
|
|
@@ -11,9 +11,6 @@ export default shapes.standard.Rectangle.extend({
|
|
|
11
11
|
}, {
|
|
12
12
|
tagName: 'image',
|
|
13
13
|
selector: 'image',
|
|
14
|
-
}, {
|
|
15
|
-
tagName: 'i',
|
|
16
|
-
selector: 'icon',
|
|
17
14
|
},
|
|
18
15
|
markersMarkup('topLeft'),
|
|
19
16
|
markersMarkup('topCenter'),
|
|
@@ -28,7 +25,6 @@ export default shapes.standard.Rectangle.extend({
|
|
|
28
25
|
size: { width: 100, height: 60 },
|
|
29
26
|
attrs: {
|
|
30
27
|
'image': { 'ref-x': 4, 'ref-y': 4, ref: 'rect', width: 16, height: 16, 'data-test': 'nodeIcon' },
|
|
31
|
-
'icon': { ref: 'rect', 'ref-x': 4, 'ref-y': 4, width: 16, height: 16, 'data-test': 'nodeCustomIcon' },
|
|
32
28
|
...markersAttrs('topLeft', { 'ref-y': 4, ref: 'rect' }),
|
|
33
29
|
...markersAttrs('topCenter', { 'ref-y': 4, ref: 'rect' }),
|
|
34
30
|
...markersAttrs('topRight', { 'ref-y': 4, 'ref-x': 96, ref: 'rect' }, -1),
|
|
@@ -4,6 +4,7 @@ import { getNodeIdGenerator } from '../NodeIdGenerator';
|
|
|
4
4
|
import { getDefaultAnchorPoint } from '@/portsUtils';
|
|
5
5
|
import Room from './room';
|
|
6
6
|
import store from '@/store';
|
|
7
|
+
|
|
7
8
|
export default class Multiplayer {
|
|
8
9
|
clientIO = null;
|
|
9
10
|
yDoc = null;
|
|
@@ -134,6 +135,19 @@ export default class Multiplayer {
|
|
|
134
135
|
Y.applyUpdate(this.yDoc, new Uint8Array(updateDoc));
|
|
135
136
|
});
|
|
136
137
|
|
|
138
|
+
this.clientIO.on('updateInspector', (payload) => {
|
|
139
|
+
const { updateDoc, updatedNodes } = payload;
|
|
140
|
+
|
|
141
|
+
// Update the elements in the process
|
|
142
|
+
updatedNodes.forEach((data) => {
|
|
143
|
+
this.updateShapeFromInspector(data);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// Update the element in the shared array
|
|
147
|
+
Y.applyUpdate(this.yDoc, new Uint8Array(updateDoc));
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
|
|
137
151
|
window.ProcessMaker.EventBus.$on('multiplayer-addNode', ( data ) => {
|
|
138
152
|
this.addNode(data);
|
|
139
153
|
});
|
|
@@ -160,6 +174,11 @@ export default class Multiplayer {
|
|
|
160
174
|
window.ProcessMaker.EventBus.$on('multiplayer-addLanes', ( lanes ) => {
|
|
161
175
|
this.addLaneNodes(lanes);
|
|
162
176
|
});
|
|
177
|
+
window.ProcessMaker.EventBus.$on('multiplayer-updateInspectorProperty', ( data ) => {
|
|
178
|
+
if (this.modeler.isMultiplayer) {
|
|
179
|
+
this.updateInspectorProperty(data);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
163
182
|
}
|
|
164
183
|
addNode(data) {
|
|
165
184
|
// Add the new element to the shared array
|
|
@@ -171,14 +190,18 @@ export default class Multiplayer {
|
|
|
171
190
|
// Send the update to the web socket server
|
|
172
191
|
this.clientIO.emit('createElement', { updateDoc: stateUpdate });
|
|
173
192
|
}
|
|
174
|
-
createShape(value){
|
|
193
|
+
createShape(value) {
|
|
194
|
+
const node = this.getNodeById(value.id);
|
|
195
|
+
// validate repeated shapes
|
|
196
|
+
if (node) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
175
199
|
if (this.modeler.nodeRegistry[value.type] && this.modeler.nodeRegistry[value.type].multiplayerClient) {
|
|
176
200
|
this.modeler.nodeRegistry[value.type].multiplayerClient(this.modeler, value);
|
|
177
201
|
} else {
|
|
178
202
|
this.modeler.addRemoteNode(value);
|
|
179
203
|
}
|
|
180
204
|
this.#nodeIdGenerator.updateCounters();
|
|
181
|
-
|
|
182
205
|
}
|
|
183
206
|
createRemoteShape(changes) {
|
|
184
207
|
return new Promise(resolve => {
|
|
@@ -238,10 +261,18 @@ export default class Multiplayer {
|
|
|
238
261
|
// Get the node to update
|
|
239
262
|
const index = this.getIndex(nodeData.nodeThatWillBeReplaced.definition.id);
|
|
240
263
|
const nodeToUpdate = this.yArray.get(index);
|
|
264
|
+
|
|
241
265
|
// Update the node id in the nodeData
|
|
242
266
|
nodeData.id = `node_${this.#nodeIdGenerator.getDefinitionNumber()}`;
|
|
243
267
|
// Update the node id generator
|
|
244
268
|
this.#nodeIdGenerator.updateCounters();
|
|
269
|
+
this.replaceShape({
|
|
270
|
+
oldNodeId: nodeData.nodeThatWillBeReplaced.definition.id,
|
|
271
|
+
id: nodeData.id,
|
|
272
|
+
type: newControl,
|
|
273
|
+
x: nodeData.x,
|
|
274
|
+
y: nodeData.y,
|
|
275
|
+
});
|
|
245
276
|
// Update the node in the shared array
|
|
246
277
|
this.yDoc.transact(() => {
|
|
247
278
|
nodeToUpdate.set('type', newControl);
|
|
@@ -432,4 +463,67 @@ export default class Multiplayer {
|
|
|
432
463
|
? { x: x + connectionOffset.x, y: y + connectionOffset.y }
|
|
433
464
|
: { x: x + (width / 2), y: y + (height / 2) };
|
|
434
465
|
}
|
|
466
|
+
updateInspectorProperty(data) {
|
|
467
|
+
const index = this.getIndex(data.id);
|
|
468
|
+
const nodeToUpdate = this.yArray.get(index);
|
|
469
|
+
|
|
470
|
+
if (nodeToUpdate) {
|
|
471
|
+
let newValue = data.value;
|
|
472
|
+
if (data.key === 'loopCharacteristics') {
|
|
473
|
+
newValue = JSON.stringify(data.value);
|
|
474
|
+
}
|
|
475
|
+
nodeToUpdate.set(data.key, newValue);
|
|
476
|
+
|
|
477
|
+
const stateUpdate = Y.encodeStateAsUpdate(this.yDoc);
|
|
478
|
+
// Send the update to the web socket server
|
|
479
|
+
this.clientIO.emit('updateFromInspector', { updateDoc: stateUpdate, isReplaced: false });
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
setNodeProp(node, key, value) {
|
|
483
|
+
store.commit('updateNodeProp', { node, key, value });
|
|
484
|
+
}
|
|
485
|
+
updateShapeFromInspector(data) {
|
|
486
|
+
let node = null;
|
|
487
|
+
if (data.oldNodeId && data.oldNodeId !== data.id) {
|
|
488
|
+
const index = this.getIndex(data.oldNodeId);
|
|
489
|
+
const yNode = this.yArray.get(index);
|
|
490
|
+
yNode.set('id', data.id);
|
|
491
|
+
node = this.getNodeById(data.oldNodeId);
|
|
492
|
+
store.commit('updateNodeProp', { node, key: 'id', value: data.id });
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
// create a node
|
|
496
|
+
node = this.getNodeById(data.id);
|
|
497
|
+
|
|
498
|
+
if (node) {
|
|
499
|
+
// loopCharacteristics property section
|
|
500
|
+
if (data.loopCharacteristics) {
|
|
501
|
+
const loopCharacteristics = JSON.parse(data.loopCharacteristics);
|
|
502
|
+
this.modeler.nodeRegistry[node.type].loopCharacteristicsHandler({
|
|
503
|
+
type: node.definition.type,
|
|
504
|
+
'$loopCharactetistics': {
|
|
505
|
+
id: data.id,
|
|
506
|
+
loopCharacteristics,
|
|
507
|
+
},
|
|
508
|
+
}, node, this.setNodeProp, this.modeler.moddle, this.modeler.definitions, false);
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
if (this.modeler.nodeRegistry[node.type] && this.modeler.nodeRegistry[node.type].multiplayerInspectorHandler) {
|
|
512
|
+
this.modeler.nodeRegistry[node.type].multiplayerInspectorHandler(node, data);
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
const keys = Object.keys(data).filter((key) => key !== 'id');
|
|
516
|
+
|
|
517
|
+
if (keys[0] === 'condition') {
|
|
518
|
+
node.definition.get('eventDefinitions')[0].get('condition').body = data[keys[0]];
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
if (keys[0] === 'gatewayDirection') {
|
|
522
|
+
node.definition.set('gatewayDirection', data[keys[0]]);
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
store.commit('updateNodeProp', { node, key:keys[0], value: data[keys[0]] });
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
}
|
|
435
529
|
}
|
package/src/store.js
CHANGED
|
@@ -38,6 +38,7 @@ export default new Vuex.Store({
|
|
|
38
38
|
copiedElements: [],
|
|
39
39
|
clientLeftPaper: false,
|
|
40
40
|
readOnly: false,
|
|
41
|
+
isMultiplayer: false,
|
|
41
42
|
},
|
|
42
43
|
getters: {
|
|
43
44
|
nodes: state => state.nodes,
|
|
@@ -60,6 +61,7 @@ export default new Vuex.Store({
|
|
|
60
61
|
clientLeftPaper: state => state.clientLeftPaper,
|
|
61
62
|
isReadOnly: state => state.readOnly,
|
|
62
63
|
showComponent: state => !state.readOnly,
|
|
64
|
+
isMultiplayer: state => state.isMultiplayer,
|
|
63
65
|
},
|
|
64
66
|
mutations: {
|
|
65
67
|
setReadOnly(state, value) {
|
|
@@ -96,7 +98,6 @@ export default new Vuex.Store({
|
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
100
|
setDefinitionPropertyReactive(node.definition, key, value);
|
|
99
|
-
|
|
100
101
|
if (value == null) {
|
|
101
102
|
Vue.delete(node.definition, key);
|
|
102
103
|
}
|
|
@@ -159,6 +160,9 @@ export default new Vuex.Store({
|
|
|
159
160
|
setClientLeftPaper(state, status) {
|
|
160
161
|
state.clientLeftPaper = status;
|
|
161
162
|
},
|
|
163
|
+
enableMultiplayer(state, value){
|
|
164
|
+
state.isMultiplayer = value;
|
|
165
|
+
},
|
|
162
166
|
},
|
|
163
167
|
actions: {
|
|
164
168
|
async fetchGlobalProcesses({ commit }) {
|