@processmaker/modeler 1.39.24 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@processmaker/modeler",
3
- "version": "1.39.24",
3
+ "version": "1.39.26",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve --mode development",
6
6
  "test:unit": "vue-cli-service test:unit",
@@ -1,10 +1,11 @@
1
1
  <template>
2
2
  <crown-button
3
- v-if="node.isBpmnType(...validPreviewElements)"
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
- this.$emit('previewNode', this.node);
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
  };
@@ -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;
@@ -7,7 +7,7 @@
7
7
  @mousedown="onMouseDown"
8
8
  @mouseup="onMouseUp"
9
9
  @mousemove="onMouseMove"
10
- data-test="preview-column"
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
- this.prepareData();
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
- this.previewUrl = previewConfig ? `${previewConfig.url}?node=${nodeData}` : null;
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
  },
@@ -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) {
@@ -418,6 +417,9 @@ export default {
418
417
  this.isOpenInspector = value;
419
418
  },
420
419
  handlePreview() {
420
+ if (this.highlightedNodes.length != 1) {
421
+ this.isOpenPreview = false;
422
+ }
421
423
  this.$refs['preview-panel'].previewNode(true);
422
424
  this.handleTogglePreview(true) ;
423
425
  },
@@ -1161,8 +1163,15 @@ export default {
1161
1163
  width: node.diagram.bounds.width,
1162
1164
  type: node.type,
1163
1165
  id: node.definition.id,
1166
+ oldNodeId: null,
1164
1167
  isAddingLaneAbove: true,
1165
- color: node.color,
1168
+ color: node.definition.color,
1169
+ dueIn: node.definition.dueIn,
1170
+ name: node.definition.name,
1171
+ assignedUsers: node.definition.assignedUsers,
1172
+ config: node.definition.config,
1173
+ loopCharacteristics: null,
1174
+ gatewayDirection: null,
1166
1175
  };
1167
1176
  if (node?.pool?.component) {
1168
1177
  defaultData['poolId'] = node.pool.component.id;
@@ -1258,7 +1267,7 @@ export default {
1258
1267
  },
1259
1268
  async removeNode(node, options) {
1260
1269
  // Check if the node is not replaced
1261
- if (this.isMultiplayer && !options?.isReplaced) {
1270
+ if (this.isMultiplayer) {
1262
1271
  // Emit event to server to remove node
1263
1272
  window.ProcessMaker.EventBus.$emit('multiplayer-removeNode', node);
1264
1273
  }
@@ -1318,35 +1327,19 @@ export default {
1318
1327
  control: { type: typeToReplaceWith },
1319
1328
  nodeThatWillBeReplaced: node,
1320
1329
  };
1321
-
1322
- await this.replaceNodeProcedure(nodeData);
1330
+ await this.replaceNodeProcedure(nodeData, true);
1323
1331
  });
1324
1332
  });
1325
1333
  },
1326
1334
  async replaceNodeProcedure(data, isReplaced = false) {
1327
- // Get the clientX and clientY from the node that will be replaced
1328
- const { x: clientX, y: clientY } = this.paper.localToClientPoint(data.nodeThatWillBeReplaced.diagram.bounds);
1329
- data.clientX = clientX;
1330
- data.clientY = clientY;
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
- }
1335
+ if (isReplaced) {
1336
+ // Get the clientX and clientY from the node that will be replaced
1337
+ const { x: clientX, y: clientY } = this.paper.localToClientPoint(data.nodeThatWillBeReplaced.diagram.bounds);
1338
+ data.clientX = clientX;
1339
+ data.clientY = clientY;
1349
1340
  }
1341
+ await this.handleDrop(data);
1342
+ await this.removeNode(data.nodeThatWillBeReplaced, { removeRelationships: false, isReplaced });
1350
1343
  },
1351
1344
  replaceAiNode({ node, typeToReplaceWith, assetId, assetName, redirectTo }) {
1352
1345
  this.performSingleUndoRedoTransaction(async() => {
@@ -1581,7 +1574,7 @@ export default {
1581
1574
  window.location = redirectTo;
1582
1575
  },
1583
1576
  enableMultiplayer(value) {
1584
- this.isMultiplayer = value;
1577
+ store.commit('enableMultiplayer', value);
1585
1578
  },
1586
1579
  addPlayer(player) {
1587
1580
  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, moddle);
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);
@@ -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
  }
@@ -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
+
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 }) {