@processmaker/modeler 1.41.0 → 1.42.1

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.41.0",
3
+ "version": "1.42.1",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve --mode development",
6
6
  "test:unit": "vue-cli-service test:unit",
@@ -1128,6 +1128,8 @@ export default {
1128
1128
  const diagram = this.nodeRegistry[data.type].diagram(this.moddle);
1129
1129
  diagram.bounds.x = data.x;
1130
1130
  diagram.bounds.y = data.y;
1131
+ diagram.bounds.width = data.width;
1132
+ diagram.bounds.height = data.height;
1131
1133
  const newNode = this.createNode(data.type, definition, diagram);
1132
1134
  //verify if the node has a pool as a container
1133
1135
  if (data.poolId) {
@@ -632,7 +632,7 @@ export default {
632
632
  */
633
633
  getConnectedLinkProperties(links) {
634
634
  let changed = [];
635
- links.forEach((linkView) => {
635
+ links?.forEach((linkView) => {
636
636
  const vertices = linkView.model.component.shape.vertices();
637
637
  if (vertices?.length) {
638
638
  const waypoint = [];
@@ -719,7 +719,7 @@ export default {
719
719
  * Selector will update the waypoints of the related flows
720
720
  */
721
721
  updateFlowsWaypoint(){
722
- this.connectedLinks.forEach((link)=> {
722
+ this.connectedLinks?.forEach((link)=> {
723
723
  if (link.model.component && link.model.get('type') === 'standard.Link'){
724
724
  const start = link.sourceAnchor;
725
725
  const end = link.targetAnchor;
@@ -58,6 +58,11 @@ export default {
58
58
  const definition = modeler.moddle.create('bpmn:Lane', {
59
59
  name: data.name,
60
60
  });
61
+ // Set the position of the pool
62
+ if (data.poolX && data.poolY) {
63
+ pool.set('position', { x: data.poolX, y: data.poolY });
64
+ }
65
+
61
66
  if (!pool.component.laneSet && pool.component.createLaneSet) {
62
67
  pool.component.createLaneSet([data.laneSetId]);
63
68
  /* If there are currently elements in the pool, add them to the first lane */
@@ -81,6 +86,10 @@ export default {
81
86
  definition,
82
87
  diagram,
83
88
  );
89
+
90
+ // Set the pool as the parent of the lane
91
+ node.pool = pool;
92
+
84
93
  await modeler.addNode(node, data.id, true);
85
94
  modeler.setShapeStacking(pool.component.shape);
86
95
 
@@ -203,13 +203,17 @@ export default class Multiplayer {
203
203
  * Sync the modeler nodes with the microservice
204
204
  * @param {String} clientId
205
205
  */
206
- syncLocalNodes(clientId){
206
+ syncLocalNodes(clientId) {
207
207
  // Get the process definition
208
208
  const nodes = this.modeler.nodes.map((node) => {
209
209
  if (node.definition.$type === 'bpmn:BoundaryEvent') {
210
210
  return getBoundaryEventData(node);
211
211
  }
212
212
 
213
+ if (node.definition.$type === 'bpmn:Lane') {
214
+ return this.prepareLaneData(node);
215
+ }
216
+
213
217
  return this.modeler.multiplayerHook(node, false, true);
214
218
  });
215
219
 
@@ -484,7 +488,8 @@ export default class Multiplayer {
484
488
  }
485
489
  addLaneNodes(lanes) {
486
490
  const pool = this.getPool(lanes);
487
- window.ProcessMaker.EventBus.$emit('multiplayer-updateNodes', [{
491
+
492
+ const defaultPoolData = {
488
493
  id: pool.component.node.definition.id,
489
494
  properties: {
490
495
  x: pool.component.node.diagram.bounds.x,
@@ -493,7 +498,10 @@ export default class Multiplayer {
493
498
  width: pool.component.node.diagram.bounds.width,
494
499
  isAddingLaneAbove: pool.isAddingLaneAbove,
495
500
  },
496
- }]);
501
+ };
502
+
503
+ window.ProcessMaker.EventBus.$emit('multiplayer-updateNodes', [defaultPoolData]);
504
+
497
505
  this.yDoc.transact(() => {
498
506
  lanes.forEach((lane) => {
499
507
  const yMapNested = new Y.Map();
@@ -516,6 +524,8 @@ export default class Multiplayer {
516
524
  height: lane.diagram.bounds.height,
517
525
  poolId: lane.pool.component.node.definition.id,
518
526
  laneSetId: lane.pool.component.laneSet.id,
527
+ poolX: lane.pool.component.node.diagram.bounds.x,
528
+ poolY: lane.pool.component.node.diagram.bounds.y,
519
529
  };
520
530
  return data;
521
531
  }