@processmaker/modeler 1.40.3 → 1.42.0

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.40.3",
3
+ "version": "1.42.0",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve --mode development",
6
6
  "test:unit": "vue-cli-service test:unit",
@@ -497,6 +497,14 @@ export default {
497
497
  if (source.default && source.default.id === flow.id) {
498
498
  flow = null;
499
499
  }
500
+ window.ProcessMaker.EventBus.$emit('multiplayer-updateNodes', [
501
+ {
502
+ id: source.id,
503
+ properties: {
504
+ default: flow?.id || null,
505
+ },
506
+ },
507
+ ]);
500
508
  source.set('default', flow);
501
509
  },
502
510
  cloneElement(node, copyCount) {
@@ -1120,6 +1128,8 @@ export default {
1120
1128
  const diagram = this.nodeRegistry[data.type].diagram(this.moddle);
1121
1129
  diagram.bounds.x = data.x;
1122
1130
  diagram.bounds.y = data.y;
1131
+ diagram.bounds.width = data.width;
1132
+ diagram.bounds.height = data.height;
1123
1133
  const newNode = this.createNode(data.type, definition, diagram);
1124
1134
  //verify if the node has a pool as a container
1125
1135
  if (data.poolId) {
@@ -1218,7 +1228,9 @@ export default {
1218
1228
  gatewayDirection: null,
1219
1229
  messageRef: null,
1220
1230
  signalRef: null,
1231
+ signalPayload: null,
1221
1232
  extras: {},
1233
+ default: null,
1222
1234
  };
1223
1235
  if (node?.pool?.component) {
1224
1236
  defaultData['poolId'] = node.pool.component.id;
@@ -19,13 +19,22 @@ export class NodeMigrator {
19
19
  const shape = this._graph.getLinks().find(element => {
20
20
  return element.component && element.component.node.definition === definition;
21
21
  });
22
- shape.component.node._modelerId += '_replaced';
22
+ const { node } = shape.component;
23
+ node._modelerId += '_replaced';
24
+ const waypoint = [];
25
+ node.diagram.waypoint?.forEach(point => {
26
+ waypoint.push({
27
+ x: point.x,
28
+ y: point.y,
29
+ });
30
+ });
23
31
  flowNodes.push({
24
- id: shape.component.node.definition.id,
25
- type: shape.component.node.type,
26
- name: shape.component.node.definition.name,
27
- sourceRefId: shape.component.node.definition.sourceRef.id,
28
- targetRefId: shape.component.node.definition.targetRef.id,
32
+ id: node.definition.id,
33
+ type: node.type,
34
+ name: node.definition.name,
35
+ waypoint,
36
+ sourceRefId: node.definition.sourceRef.id,
37
+ targetRefId: node.definition.targetRef.id,
29
38
  });
30
39
  };
31
40
 
@@ -599,9 +599,9 @@ export default {
599
599
  shapes.filter(shape => !shapesToNotTranslate.includes(shape.model.get('type')))
600
600
  .forEach(shape => {
601
601
  if (shape.model.get('type') === 'processmaker.modeler.bpmn.pool') {
602
- const childrens = shape.model.component.getElementsUnderArea(shape.model, this.graph)
602
+ const children = shape.model.component.getElementsUnderArea(shape.model, this.graph)
603
603
  .filter((element) => element.component);
604
- changed = [...changed, ...this.getContainerProperties(childrens, changed)];
604
+ changed = [...changed, ...this.getContainerProperties(children, changed)];
605
605
  } else {
606
606
  const { node } = shape.model.component;
607
607
  const defaultData = {
@@ -623,38 +623,41 @@ export default {
623
623
  const boundariesChanges = this.getBoundariesChangesForShape(shape);
624
624
  changed = changed.concat(boundariesChanges);
625
625
  });
626
-
626
+
627
627
  return changed;
628
628
  },
629
629
  /**
630
630
  * Get connected link properties
631
- * @param {Array} links
631
+ * @param {Array} links
632
632
  */
633
633
  getConnectedLinkProperties(links) {
634
634
  let changed = [];
635
635
  links.forEach((linkView) => {
636
- const waypoint = [];
637
- const { node } = linkView.model.component;
638
- node.diagram.waypoint?.forEach(point => {
639
- waypoint.push({
640
- x: point.x,
641
- y: point.y,
642
- });
643
- });
644
- const sourceRefId = linkView.sourceView.model.component.node.definition.id;
645
- const targetRefId = linkView.targetView.model.component.node.definition.id;
646
- const nodeType = linkView.model.component.node.type;
647
- changed.push(
648
- {
649
- id: node.definition.id,
650
- properties: {
651
- type: nodeType,
652
- waypoint,
653
- sourceRefId,
654
- targetRefId,
655
- },
636
+ const vertices = linkView.model.component.shape.vertices();
637
+ if (vertices?.length) {
638
+ const waypoint = [];
639
+ const { node } = linkView.model.component;
640
+
641
+ node.diagram.waypoint?.forEach(point => {
642
+ waypoint.push({
643
+ x: point.x,
644
+ y: point.y,
645
+ });
656
646
  });
657
-
647
+ const sourceRefId = linkView.sourceView.model.component.node.definition.id;
648
+ const targetRefId = linkView.targetView.model.component.node.definition.id;
649
+ const nodeType = linkView.model.component.node.type;
650
+ changed.push(
651
+ {
652
+ id: node.definition.id,
653
+ properties: {
654
+ type: nodeType,
655
+ waypoint,
656
+ sourceRefId,
657
+ targetRefId,
658
+ },
659
+ });
660
+ }
658
661
  });
659
662
  return changed;
660
663
  },
@@ -689,10 +692,11 @@ export default {
689
692
  });
690
693
  return boundariesChanged;
691
694
  },
692
- getContainerProperties(childrens) {
695
+ getContainerProperties(children) {
693
696
  const changed = [];
694
- childrens.forEach(model => {
695
- changed.push({
697
+
698
+ children.forEach(model => {
699
+ const defaultData = {
696
700
  id: model.component.node.definition.id,
697
701
  properties: {
698
702
  x: model.get('position').x,
@@ -701,7 +705,13 @@ export default {
701
705
  width: model.get('size').width,
702
706
  color: model.get('color'),
703
707
  },
704
- });
708
+ };
709
+
710
+ if (model.component.node.definition.$type === 'bpmn:BoundaryEvent') {
711
+ defaultData.properties.attachedToRefId = model.component.node.definition.get('attachedToRef')?.id ?? null;
712
+ }
713
+
714
+ changed.push(defaultData);
705
715
  });
706
716
  return changed;
707
717
  },
@@ -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
 
@@ -35,10 +35,18 @@ export default {
35
35
  });
36
36
  },
37
37
  inspectorHandler(value, node, setNodeProp) {
38
-
39
- setNodeProp(node, 'id', value.id);
40
- setNodeProp(node, 'name', value.name);
41
-
38
+ if (node.definition.get('id') !== value['id']) {
39
+ window.ProcessMaker.EventBus.$emit('multiplayer-updateInspectorProperty', {
40
+ id: node.definition.id, key: 'id', value: value.id,
41
+ });
42
+ setNodeProp(node, 'id', value.id);
43
+ }
44
+ if (node.definition.get('name') !== value['name']) {
45
+ window.ProcessMaker.EventBus.$emit('multiplayer-updateInspectorProperty', {
46
+ id: node.definition.id, key: 'name', value: value.name,
47
+ });
48
+ setNodeProp(node, 'name', value.name);
49
+ }
42
50
  const currentConfig = JSON.parse(value.config);
43
51
 
44
52
  value['calledElement'] = currentConfig.calledElement;
@@ -1,7 +1,13 @@
1
1
  <template>
2
2
  <b-avatar-group class="container" v-show="isMultiplayer">
3
3
  <template v-for="item in filteredPlayers" >
4
- <Avatar :badgeBackgroundColor="item.color" :imgSrc="item.avatar" :userName="item.name" :key="item.key"/>
4
+ <Avatar
5
+ :badgeBackgroundColor="item.color"
6
+ :imgSrc="item.avatar"
7
+ :userName="item.name"
8
+ :id="item.id"
9
+ :key="item.id"
10
+ />
5
11
  </template>
6
12
  </b-avatar-group>
7
13
  </template>
@@ -3,16 +3,18 @@
3
3
  class="b-avatar rounded-circle"
4
4
  :style="{'backgroundColor': generateColorHsl(userName, saturationRange, lightnessRange)}"
5
5
  >
6
- <span v-if="imgSrc" class="b-avatar-img">
7
- <img :src="imgSrc" :alt=userName>
6
+ <span v-if="imgSrc" class="b-avatar-img" :id="id">
7
+ <img :src="imgSrc" :alt="userName">
8
8
  </span>
9
- <span v-else class="b-avatar-text avatar-initials">
9
+ <span v-else class="b-avatar-text avatar-initials" :id="id">
10
10
  <span>
11
11
  {{ this.getInitials(userName) }}
12
12
  </span>
13
-
14
13
  </span>
15
- <span class="b-avatar-badge badge-danger"
14
+ <b-tooltip :target="id" triggers="hover">
15
+ {{ userName }}
16
+ </b-tooltip>
17
+ <span v-if="badgeBackgroundColor" class="b-avatar-badge badge-danger"
16
18
  :style="{bottom: '0px', right: '0px', backgroundColor: badgeBackgroundColor}"
17
19
  />
18
20
  </span>
@@ -34,6 +36,10 @@ export default {
34
36
  type: String,
35
37
  required: false,
36
38
  },
39
+ id: {
40
+ type: String,
41
+ required: true,
42
+ },
37
43
  },
38
44
  data() {
39
45
  return {
@@ -0,0 +1,99 @@
1
+ import { setEventTimerDefinition } from '@/components/nodes/boundaryTimerEvent';
2
+
3
+ export class InspectorUtils {
4
+ constructor(modeler, store) {
5
+ this.modeler = modeler;
6
+ this.store = store;
7
+ }
8
+
9
+ isSpecialProperty(key) {
10
+ const specialProperties = [
11
+ 'messageRef', 'signalRef', 'signalPayload', 'gatewayDirection', 'condition', 'allowedUsers', 'allowedGroups',
12
+ ];
13
+ return specialProperties.includes(key);
14
+ }
15
+
16
+ updateNodeId(oldNodeId, newId) {
17
+ const index = this.getIndex(oldNodeId);
18
+ const yNode = this.yArray.get(index);
19
+ yNode.set('id', newId);
20
+ const node = this.getNodeById(oldNodeId);
21
+ this.store.commit('updateNodeProp', { node, key: 'id', value: newId });
22
+ }
23
+
24
+ handleLoopCharacteristics(node, loopCharacteristics) {
25
+ const parsedLoopCharacteristics = JSON.parse(loopCharacteristics);
26
+ this.modeler.nodeRegistry[node.type].loopCharacteristicsHandler({
27
+ type: node.definition.type,
28
+ '$loopCharactetistics': {
29
+ id: node.id,
30
+ loopCharacteristics: parsedLoopCharacteristics,
31
+ },
32
+ }, node, this.setNodeProp, this.modeler.moddle, this.modeler.definitions, false);
33
+ }
34
+
35
+ updateEventCondition(definition, value) {
36
+ definition.get('eventDefinitions')[0].get('condition').body = value;
37
+ }
38
+
39
+ updateGatewayDirection(definition, value) {
40
+ definition.set('gatewayDirection', value);
41
+ }
42
+
43
+ updateNodeProperty(node, key, value) {
44
+ this.store.commit('updateNodeProp', { node, key, value });
45
+ }
46
+
47
+ updateMessageRef(node, value, extras) {
48
+ let message = this.modeler.definitions.rootElements.find(element => element.id === value);
49
+
50
+ if (!message) {
51
+ message = this.modeler.moddle.create('bpmn:Message', {
52
+ id: value,
53
+ name: extras?.messageName || value,
54
+ });
55
+ this.modeler.definitions.rootElements.push(message);
56
+ }
57
+
58
+ node.definition.get('eventDefinitions')[0].messageRef = message;
59
+
60
+ if (extras?.allowedUsers) {
61
+ node.definition.set('allowedUsers', extras.allowedUsers);
62
+ }
63
+
64
+ if (extras?.allowedGroups) {
65
+ node.definition.set('allowedGroups', extras.allowedGroups);
66
+ }
67
+ }
68
+
69
+ updateSignalRef(node, value, extras) {
70
+ let signal = this.modeler.definitions.rootElements.find(element => element.id === value);
71
+
72
+ if (!signal) {
73
+ signal = this.modeler.moddle.create('bpmn:Signal', {
74
+ id: value,
75
+ name: extras?.signalName || value,
76
+ });
77
+ this.modeler.definitions.rootElements.push(signal);
78
+ }
79
+
80
+ node.definition.get('eventDefinitions')[0].signalRef = signal;
81
+ }
82
+
83
+ updateSignalPayload(node, value) {
84
+ const eventDefinitions = node.definition.get('eventDefinitions');
85
+ const SIGNAL_EVENT_DEFINITION_TYPE = 'bpmn:SignalEventDefinition';
86
+
87
+ eventDefinitions.forEach(definition => {
88
+ if (definition.$type === SIGNAL_EVENT_DEFINITION_TYPE) {
89
+ definition.config = value;
90
+ }
91
+ });
92
+ }
93
+
94
+ updateEventTimerDefinition(node, value) {
95
+ const { type, body } = value;
96
+ const eventDefinitions = setEventTimerDefinition(this.modeler.moddle, node, type, body);
97
+ this.store.commit('updateNodeProp', { node, key: 'eventDefinitions', value: eventDefinitions });
98
+ }
99
+ }