@processmaker/modeler 1.39.21 → 1.39.23

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.21",
3
+ "version": "1.39.23",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve --mode development",
6
6
  "test:unit": "vue-cli-service test:unit",
@@ -90,6 +90,7 @@ export default {
90
90
 
91
91
  const node = new Node(nodeType, definition, diagram);
92
92
  node.pool = this.node.pool;
93
+ node.fromCrown = true;
93
94
 
94
95
  store.commit('highlightNode', node);
95
96
 
@@ -137,7 +137,7 @@ export default {
137
137
  store.commit('updateNodeProp', { node: this.node, key: 'color', value: color });
138
138
  Vue.set(this.node.definition, 'color', color);
139
139
  this.$emit('save-state');
140
-
140
+
141
141
  const properties = {
142
142
  id: this.node.definition.id,
143
143
  properties: {
@@ -148,6 +148,7 @@ export default {
148
148
  width: this.node.diagram.bounds.width,
149
149
  type: this.node.type,
150
150
  id: this.node.definition.id,
151
+ attachedToRefId: this.node.definition.get('attachedToRef')?.id,
151
152
  },
152
153
  };
153
154
  window.ProcessMaker.EventBus.$emit('multiplayer-updateNodes', [properties]);
@@ -56,7 +56,7 @@
56
56
 
57
57
  <InspectorButton
58
58
  ref="inspector-button"
59
- v-if="showComponent && showInspectorButton"
59
+ v-show="showComponent && showInspectorButton"
60
60
  :showInspector="isOpenInspector"
61
61
  @toggleInspector="[handleToggleInspector($event), setInspectorButtonPosition($event)]"
62
62
  :style="{ right: inspectorButtonRight + 'px' }"
@@ -371,6 +371,11 @@ export default {
371
371
  canvasScale(canvasScale) {
372
372
  this.paperManager.scale = canvasScale;
373
373
  },
374
+ highlightedNodes() {
375
+ if (window.ProcessMaker?.EventBus) {
376
+ window.ProcessMaker.EventBus.$emit('modeler:highlightedNodes', this.highlightedNodes);
377
+ }
378
+ },
374
379
  },
375
380
  computed: {
376
381
  showWelcomeMessage() {
@@ -1094,7 +1099,6 @@ export default {
1094
1099
  diagram.bounds.y = y;
1095
1100
 
1096
1101
  const newNode = this.createNode(control.type, definition, diagram);
1097
-
1098
1102
  if (newNode.isBpmnType('bpmn:BoundaryEvent')) {
1099
1103
  this.setShapeCenterUnderCursor(diagram);
1100
1104
  }
@@ -1137,9 +1141,13 @@ export default {
1137
1141
  'processmaker-modeler-sequence-flow',
1138
1142
  'processmaker-modeler-association',
1139
1143
  'processmaker-modeler-data-input-association',
1140
- 'processmaker-modeler-data-output-association',
1144
+ 'processmaker-modeler-data-input-association',
1145
+ 'processmaker-modeler-boundary-timer-event',
1146
+ 'processmaker-modeler-boundary-error-event',
1147
+ 'processmaker-modeler-boundary-signal-event',
1148
+ 'processmaker-modeler-boundary-conditional-even',
1149
+ 'processmaker-modeler-boundary-message-event',
1141
1150
  ];
1142
-
1143
1151
  if (!this.isMultiplayer) {
1144
1152
  return;
1145
1153
  }
@@ -35,6 +35,12 @@ import { id as associationId } from '@/components/nodes/association/associationC
35
35
  import { id as messageFlowId } from '@/components/nodes/messageFlow/config';
36
36
  import { id as dataOutputAssociationFlowId } from '@/components/nodes/dataOutputAssociation/config';
37
37
  import { id as dataInputAssociationFlowId } from '@/components/nodes/dataInputAssociation/config';
38
+ import { id as boundaryErrorEventId } from '@/components/nodes/boundaryErrorEvent';
39
+ import { id as boundaryConditionalEventId } from '@/components/nodes/boundaryConditionalEvent';
40
+ import { id as boundaryEscalationEventId } from '@/components/nodes/boundaryEscalationEvent';
41
+ import { id as boundaryMessageEventId } from '@/components/nodes/boundaryMessageEvent';
42
+ import { id as boundarySignalEventId } from '@/components/nodes/boundarySignalEvent';
43
+ import { id as boundaryTimerEventId } from '@/components/nodes/boundaryTimerEvent';
38
44
  import { labelWidth, poolPadding } from '../nodes/pool/poolSizes';
39
45
  import { invalidNodeColor, poolColor } from '@/components/nodeColors';
40
46
 
@@ -587,7 +593,6 @@ export default {
587
593
  const shapesToNotTranslate = [
588
594
  'PoolLane',
589
595
  'standard.Link',
590
- 'processmaker.components.nodes.boundaryEvent.Shape',
591
596
  ];
592
597
 
593
598
  shapes.filter(shape => !shapesToNotTranslate.includes(shape.model.get('type')))
@@ -604,6 +609,7 @@ export default {
604
609
  y: shape.model.get('position').y,
605
610
  height: shape.model.get('size').height,
606
611
  width: shape.model.get('size').width,
612
+ attachedToRefId: shape.model.component.node.definition.get('attachedToRef')?.id ?? null,
607
613
  color: shape.model.get('color'),
608
614
  },
609
615
  };
@@ -612,9 +618,43 @@ export default {
612
618
  }
613
619
  changed.push(defaultData);
614
620
  }
621
+ const boundariesChanges = this.getBoundariesChangesForShape(shape);
622
+ changed = changed.concat(boundariesChanges);
615
623
  });
624
+
616
625
  return changed;
617
626
  },
627
+ /**
628
+ * Get properties for each boundary inside a shape
629
+ */
630
+ getBoundariesChangesForShape(shape) {
631
+ let boundariesChanged = [];
632
+ const boundaryEventTypes = [
633
+ boundaryErrorEventId,
634
+ boundaryConditionalEventId,
635
+ boundaryEscalationEventId,
636
+ boundaryMessageEventId,
637
+ boundarySignalEventId,
638
+ boundaryTimerEventId,
639
+ ];
640
+ const boundaryNodes = store.getters.nodes.filter(node => boundaryEventTypes.includes(node.type));
641
+ boundaryNodes.forEach(boundaryNode => {
642
+ if (boundaryNode.definition.attachedToRef.id === shape.model.component.node.definition.id) {
643
+ boundariesChanged.push({
644
+ id: boundaryNode.definition.id,
645
+ properties: {
646
+ x: boundaryNode.diagram.bounds.x,
647
+ y: boundaryNode.diagram.bounds.y,
648
+ height: boundaryNode.diagram.bounds.height,
649
+ width: boundaryNode.diagram.bounds.width,
650
+ attachedToRefId: boundaryNode.definition.get('attachedToRef')?.id ?? null,
651
+ color: boundaryNode.definition.get('color') ?? null,
652
+ },
653
+ });
654
+ }
655
+ });
656
+ return boundariesChanged;
657
+ },
618
658
  getContainerProperties(children) {
619
659
  const changed = [];
620
660
  children.forEach(model => {
@@ -202,6 +202,26 @@ export default {
202
202
 
203
203
  this.invalidTargetElement = targetElement;
204
204
  },
205
+ addMultiplayerBoundaryEvent() {
206
+ const control = {
207
+ bpmnType: this.node.diagram.$type,
208
+ id: this.node.diagram.id,
209
+ type: this.node.type,
210
+ attachedToRef: this.node.definition.get('attachedToRef'),
211
+ };
212
+
213
+ window.ProcessMaker.EventBus.$emit('multiplayer-addBoundaryEvent', {
214
+ x: this.node.diagram.bounds.x,
215
+ y: this.node.diagram.bounds.y,
216
+ height: this.node.diagram.bounds.height,
217
+ width: this.node.diagram.bounds.width,
218
+ attachedToRefId: this.node.definition.get('attachedToRef')?.id,
219
+ control,
220
+ type: this.node.type,
221
+ id: this.node.definition.id,
222
+ color: this.node.definition.get('color'),
223
+ });
224
+ },
205
225
  },
206
226
  async mounted() {
207
227
  this.shape = new EventShape();
@@ -214,6 +234,10 @@ export default {
214
234
  const task = this.getTaskUnderShape();
215
235
  this.attachBoundaryEventToTask(task);
216
236
  this.updateShapePosition(task);
237
+
238
+ if (this.node.fromCrown) {
239
+ this.addMultiplayerBoundaryEvent();
240
+ }
217
241
  },
218
242
  };
219
243
  </script>
@@ -1,7 +1,7 @@
1
1
  $toolbar-background-color: #fff;
2
2
 
3
3
  .toolbar {
4
- z-index: 3;
4
+ z-index: 4;
5
5
  height: $toolbar-height;
6
6
  cursor: auto;
7
7
  width: 100%;
@@ -150,7 +150,11 @@ export default class Multiplayer {
150
150
  });
151
151
 
152
152
  window.ProcessMaker.EventBus.$on('multiplayer-addFlow', ( data ) => {
153
- this.addFlow(data);
153
+ this.addCommonElement(data);
154
+ });
155
+
156
+ window.ProcessMaker.EventBus.$on('multiplayer-addBoundaryEvent', ( data ) => {
157
+ this.addCommonElement(data);
154
158
  });
155
159
 
156
160
  window.ProcessMaker.EventBus.$on('multiplayer-addLanes', ( lanes ) => {
@@ -246,7 +250,6 @@ export default class Multiplayer {
246
250
 
247
251
  // Encode the state as an update and send it to the server
248
252
  const stateUpdate = Y.encodeStateAsUpdate(this.yDoc);
249
-
250
253
  this.clientIO.emit('updateElement', { updateDoc: stateUpdate, isReplaced: true });
251
254
  }
252
255
  replaceShape(updatedNode) {
@@ -327,6 +330,11 @@ export default class Multiplayer {
327
330
  const node = this.getNodeById(data.id);
328
331
  store.commit('updateNodeProp', { node, key: 'color', value: data.color });
329
332
 
333
+ // boundary type
334
+ if (element.component.node.definition.$type === 'bpmn:BoundaryEvent') {
335
+ this.attachBoundaryEventToNode(element, data);
336
+ }
337
+
330
338
  // Trigger a rendering of the element on the paper
331
339
  await paper.findViewByModel(element).update();
332
340
  // validate if the parent pool was updated
@@ -337,8 +345,27 @@ export default class Multiplayer {
337
345
  }
338
346
  }
339
347
  }
348
+ attachBoundaryEventToNode(element, data) {
349
+ const node = this.getNodeById(data.attachedToRefId);
350
+
351
+ // Find previous attached task
352
+ const previousAttachedTask = element.getParentCell();
353
+
354
+ // Find new attached task
355
+ const newAttachedTask = this.modeler.getElementByNodeId(data.attachedToRefId);
340
356
 
341
- addFlow(data) {
357
+ if (previousAttachedTask) {
358
+ previousAttachedTask.unembed(element);
359
+ }
360
+
361
+ if (newAttachedTask) {
362
+ newAttachedTask.embed(element);
363
+ }
364
+
365
+ element.component.node.definition.set('attachedToRef', node.definition);
366
+ }
367
+ addCommonElement(data) {
368
+ // Add a new flow / boundary event to the shared array
342
369
  const yMapNested = new Y.Map();
343
370
  this.doTransact(yMapNested, data);
344
371
  this.yArray.push([yMapNested]);
@@ -348,7 +375,6 @@ export default class Multiplayer {
348
375
  this.clientIO.emit('createElement', { updateDoc: stateUpdate });
349
376
  this.#nodeIdGenerator.updateCounters();
350
377
  }
351
-
352
378
  addLaneNodes(lanes) {
353
379
  const pool = this.getPool(lanes);
354
380
  window.ProcessMaker.EventBus.$emit('multiplayer-updateNodes', [{