@processmaker/modeler 1.40.2 → 1.41.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.2",
3
+ "version": "1.41.0",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve --mode development",
6
6
  "test:unit": "vue-cli-service test:unit",
@@ -102,6 +102,8 @@ export default {
102
102
  'highlightedNode.definition.assignedUsers'(current, previous) { this.handleAssignmentChanges(current, previous); },
103
103
  'highlightedNode.definition.assignedGroups'(current, previous) { this.handleAssignmentChanges(current, previous); },
104
104
  'highlightedNode.definition.assignmentRules'(current, previous) { this.handleAssignmentChanges(current, previous); },
105
+ 'highlightedNode.definition.allowInterstitial'(current, previous) { this.handleAssignmentChanges(current, previous); },
106
+ 'highlightedNode.definition.interstitialScreenRef'(current, previous) { this.handleAssignmentChanges(current, previous); },
105
107
  },
106
108
  computed: {
107
109
  inspectorHeaderTitle() {
@@ -254,7 +256,7 @@ export default {
254
256
  defaultInspectorHandler(value, isMultiplayer) {
255
257
  /* Go through each property and rebind it to our data */
256
258
  for (const key in omit(value, ['$type', 'eventDefinitions'])) {
257
- if (this.highlightedNode.definition.get(key) !== value[key]) {
259
+ if (this.highlightedNode.definition.get(key) !== value[key]) {
258
260
  this.multiplayerHook(key, value[key], isMultiplayer);
259
261
  this.setNodeProp(this.highlightedNode, key, value[key]);
260
262
  }
@@ -238,6 +238,7 @@ import ProcessmakerModelerGenericFlow from '@/components/nodes/genericFlow/gener
238
238
  import Selection from './Selection';
239
239
  import RemoteCursor from '@/components/multiplayer/remoteCursor/RemoteCursor.vue';
240
240
  import Multiplayer from '@/multiplayer/multiplayer';
241
+ import { getBoundaryEventData } from '../nodes/boundaryEvent/boundaryEventUtils';
241
242
 
242
243
  export default {
243
244
  components: {
@@ -354,6 +355,13 @@ export default {
354
355
  'processmaker-modeler-data-output-association',
355
356
  'processmaker-modeler-association',
356
357
  ],
358
+ boundaryEventTypes: [
359
+ 'processmaker-modeler-boundary-timer-event',
360
+ 'processmaker-modeler-boundary-error-event',
361
+ 'processmaker-modeler-boundary-signal-event',
362
+ 'processmaker-modeler-boundary-conditional-event',
363
+ 'processmaker-modeler-boundary-message-event',
364
+ ],
357
365
  };
358
366
  },
359
367
  watch: {
@@ -489,6 +497,14 @@ export default {
489
497
  if (source.default && source.default.id === flow.id) {
490
498
  flow = null;
491
499
  }
500
+ window.ProcessMaker.EventBus.$emit('multiplayer-updateNodes', [
501
+ {
502
+ id: source.id,
503
+ properties: {
504
+ default: flow?.id || null,
505
+ },
506
+ },
507
+ ]);
492
508
  source.set('default', flow);
493
509
  },
494
510
  cloneElement(node, copyCount) {
@@ -1184,11 +1200,7 @@ export default {
1184
1200
  'processmaker-modeler-sequence-flow',
1185
1201
  'processmaker-modeler-association',
1186
1202
  'processmaker-modeler-data-input-association',
1187
- 'processmaker-modeler-boundary-timer-event',
1188
- 'processmaker-modeler-boundary-error-event',
1189
- 'processmaker-modeler-boundary-signal-event',
1190
- 'processmaker-modeler-boundary-conditional-event',
1191
- 'processmaker-modeler-boundary-message-event',
1203
+ ...this.boundaryEventTypes,
1192
1204
  ];
1193
1205
  if (!this.isMultiplayer) {
1194
1206
  return;
@@ -1214,7 +1226,9 @@ export default {
1214
1226
  gatewayDirection: null,
1215
1227
  messageRef: null,
1216
1228
  signalRef: null,
1229
+ signalPayload: null,
1217
1230
  extras: {},
1231
+ default: null,
1218
1232
  };
1219
1233
  if (node?.pool?.component) {
1220
1234
  defaultData['poolId'] = node.pool.component.id;
@@ -1305,6 +1319,8 @@ export default {
1305
1319
  });
1306
1320
  },
1307
1321
  async addClonedNodes(nodes) {
1322
+ const flowNodes = [];
1323
+
1308
1324
  nodes.forEach(node => {
1309
1325
  if (!node.pool) {
1310
1326
  node.pool = this.poolTarget;
@@ -1314,10 +1330,24 @@ export default {
1314
1330
  addNodeToProcess(node, targetProcess);
1315
1331
 
1316
1332
  this.planeElements.push(node.diagram);
1317
- this.multiplayerHook(node, false);
1333
+
1334
+ if (this.flowTypes.includes(node.type)) {
1335
+ // Add flow to array to render after
1336
+ flowNodes.push(node);
1337
+ } else if (this.boundaryEventTypes.includes(node.type)) {
1338
+ // Get boundary event data
1339
+ const defaultData = getBoundaryEventData(node);
1340
+ window.ProcessMaker.EventBus.$emit('multiplayer-addBoundaryEvent', defaultData);
1341
+ } else {
1342
+ this.multiplayerHook(node, false);
1343
+ }
1344
+
1318
1345
  store.commit('addNode', node);
1319
1346
  this.poolTarget = null;
1320
1347
  });
1348
+
1349
+ // Render flows after all nodes have been added
1350
+ flowNodes.forEach(node => this.multiplayerHook(node, false));
1321
1351
  },
1322
1352
  async removeNode(node, options) {
1323
1353
  // Check if the node is not replaced
@@ -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
 
@@ -347,7 +347,7 @@ export default {
347
347
  */
348
348
  prepareConectedLinks(shapes){
349
349
  const { paper } = this.paperManager;
350
- this.conectedLinks = [];
350
+ this.connectedLinks = [];
351
351
  this.isValidSelectionLinks = true;
352
352
  shapes.forEach((shape) => {
353
353
  let conectedLinks = this.graph.getConnectedLinks(shape.model);
@@ -368,8 +368,8 @@ export default {
368
368
  }
369
369
  conectedLinks.forEach((link) => {
370
370
  const linkView = paper.findViewByModel(link);
371
- if (!this.conectedLinks.some(obj => obj.id === linkView.id)) {
372
- this.conectedLinks.push(linkView);
371
+ if (!this.connectedLinks.some(obj => obj.id === linkView.id)) {
372
+ this.connectedLinks.push(linkView);
373
373
  this.validateSelectionLinks(linkView);
374
374
  }
375
375
  });
@@ -585,6 +585,7 @@ export default {
585
585
  this.updateSelectionBox();
586
586
  if (this.isMultiplayer) {
587
587
  window.ProcessMaker.EventBus.$emit('multiplayer-updateNodes', this.getProperties(this.selected));
588
+ window.ProcessMaker.EventBus.$emit('multiplayer-updateNodes', this.getConnectedLinkProperties(this.connectedLinks));
588
589
  }
589
590
  },
590
591
 
@@ -598,10 +599,9 @@ export default {
598
599
  shapes.filter(shape => !shapesToNotTranslate.includes(shape.model.get('type')))
599
600
  .forEach(shape => {
600
601
  if (shape.model.get('type') === 'processmaker.modeler.bpmn.pool') {
601
- const childrens = shape.model.component.getElementsUnderArea(shape.model, this.graph)
602
+ const children = shape.model.component.getElementsUnderArea(shape.model, this.graph)
602
603
  .filter((element) => element.component);
603
-
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,7 +623,42 @@ export default {
623
623
  const boundariesChanges = this.getBoundariesChangesForShape(shape);
624
624
  changed = changed.concat(boundariesChanges);
625
625
  });
626
-
626
+
627
+ return changed;
628
+ },
629
+ /**
630
+ * Get connected link properties
631
+ * @param {Array} links
632
+ */
633
+ getConnectedLinkProperties(links) {
634
+ let changed = [];
635
+ links.forEach((linkView) => {
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
+ });
646
+ });
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
+ }
661
+ });
627
662
  return changed;
628
663
  },
629
664
  /**
@@ -657,10 +692,11 @@ export default {
657
692
  });
658
693
  return boundariesChanged;
659
694
  },
660
- getContainerProperties(childrens) {
695
+ getContainerProperties(children) {
661
696
  const changed = [];
662
- childrens.forEach(model => {
663
- changed.push({
697
+
698
+ children.forEach(model => {
699
+ const defaultData = {
664
700
  id: model.component.node.definition.id,
665
701
  properties: {
666
702
  x: model.get('position').x,
@@ -669,7 +705,13 @@ export default {
669
705
  width: model.get('size').width,
670
706
  color: model.get('color'),
671
707
  },
672
- });
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);
673
715
  });
674
716
  return changed;
675
717
  },
@@ -677,7 +719,7 @@ export default {
677
719
  * Selector will update the waypoints of the related flows
678
720
  */
679
721
  updateFlowsWaypoint(){
680
- this.conectedLinks.forEach((link)=> {
722
+ this.connectedLinks.forEach((link)=> {
681
723
  if (link.model.component && link.model.get('type') === 'standard.Link'){
682
724
  const start = link.sourceAnchor;
683
725
  const end = link.targetAnchor;
@@ -885,7 +927,7 @@ export default {
885
927
  if (this.newPool){
886
928
  /* Remove the shape from its current pool */
887
929
  this.moveElements(this.selected, this.oldPool, this.newPool);
888
- this.moveConectedLinks(this.conectedLinks, this.oldPool, this.newPool);
930
+ this.moveConnectedLinks(this.connectedLinks, this.oldPool, this.newPool);
889
931
  this.newPool = null;
890
932
  this.oldPool = null;
891
933
  this.updateLaneChildren(this.selected);
@@ -1025,7 +1067,7 @@ export default {
1025
1067
  oldPool.model.component.moveElement(shape.model, newPool.model);
1026
1068
  });
1027
1069
  },
1028
- moveConectedLinks(links, oldPool, newPool){
1070
+ moveConnectedLinks(links, oldPool, newPool){
1029
1071
  links.forEach(link => {
1030
1072
  oldPool.model.component.moveFlow(link.model, newPool.model);
1031
1073
  });
@@ -15,13 +15,9 @@ export const setEventTimerDefinition = (moddle, node, type, body) => {
15
15
  [type]: moddle.create('bpmn:Expression', { body }),
16
16
  };
17
17
 
18
- const eventDefinitions = [
18
+ return [
19
19
  moddle.create('bpmn:TimerEventDefinition', eventDefinition),
20
20
  ];
21
-
22
- eventDefinitions[0].id = node.definition.get('eventDefinitions')[0].id;
23
-
24
- return eventDefinitions;
25
21
  };
26
22
 
27
23
  export default merge(cloneDeep(boundaryEventConfig), {
@@ -73,9 +69,7 @@ export default merge(cloneDeep(boundaryEventConfig), {
73
69
  }
74
70
 
75
71
  const eventDefinitions = setEventTimerDefinition(moddle, node, type, body);
76
-
77
72
  setNodeProp(node, 'eventDefinitions', eventDefinitions);
78
-
79
73
  window.ProcessMaker.EventBus.$emit('multiplayer-updateInspectorProperty', {
80
74
  id: node.definition.id,
81
75
  key: 'eventTimerDefinition',
@@ -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 {
@@ -47,7 +47,6 @@ export default {
47
47
  if (node.definition && node.definition.$type !== 'bpmn:BoundaryEvent') {
48
48
  clonedNodes.push(clonedElement);
49
49
  } else {
50
- clonedElement.fromCrown = true;
51
50
  clonedBoundaryEvents.push(clonedElement);
52
51
  }
53
52
  }
@@ -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
+ }