@processmaker/modeler 1.40.0 → 1.40.2

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.0",
3
+ "version": "1.40.2",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve --mode development",
6
6
  "test:unit": "vue-cli-service test:unit",
@@ -142,10 +142,10 @@ export default {
142
142
  id: this.node.definition.id,
143
143
  properties: {
144
144
  color: this.node.definition.color,
145
- x: this.node.diagram.bounds.x,
146
- y: this.node.diagram.bounds.y,
147
- height: this.node.diagram.bounds.height,
148
- width: this.node.diagram.bounds.width,
145
+ x: this.node.diagram.bounds?.x,
146
+ y: this.node.diagram.bounds?.y,
147
+ height: this.node.diagram.bounds?.height,
148
+ width: this.node.diagram.bounds?.width,
149
149
  type: this.node.type,
150
150
  id: this.node.definition.id,
151
151
  attachedToRefId: this.node.definition.get('attachedToRef')?.id,
@@ -56,7 +56,7 @@
56
56
 
57
57
  <iframe
58
58
  title="Preview"
59
- v-show="!!previewUrl && !showSpinner"
59
+ :style="{visibility: displayPreviewIframe}"
60
60
  :src="previewUrl"
61
61
  class="preview-iframe"
62
62
  @load="loading"
@@ -95,20 +95,26 @@ export default {
95
95
  }
96
96
  },
97
97
  highlightedNode() {
98
+ // If there isn't preview configuration hide the panel
99
+ const nodeConfig = this.getConfig(this.data);
100
+ if (!nodeConfig) {
101
+ this.$emit('togglePreview', false);
102
+ return;
103
+ }
104
+
98
105
  document.activeElement.blur();
99
- this.prepareData();
106
+ this.previewNode();
100
107
  },
101
- 'highlightedNode.definition'(current, previous) { this.handleAssignmentChanges(current, previous); },
102
- 'highlightedNode.definition.assignmentLock'(current, previous) { this.handleAssignmentChanges(current, previous); },
103
- 'highlightedNode.definition.allowReassignment'(current, previous) { this.handleAssignmentChanges(current, previous); },
104
- 'highlightedNode.definition.assignedUsers'(current, previous) { this.handleAssignmentChanges(current, previous); },
105
- 'highlightedNode.definition.assignedGroups'(current, previous) { this.handleAssignmentChanges(current, previous); },
106
- 'highlightedNode.definition.assignmentRules'(current, previous) { this.handleAssignmentChanges(current, previous); },
107
108
  },
108
109
  computed: {
109
110
  highlightedNode() {
110
111
  return store.getters.highlightedNodes[0];
111
112
  },
113
+ displayPreviewIframe() {
114
+ const result = !!this.previewUrl && !this.showSpinner;
115
+ console.log('mostrar iframe', result);
116
+ return result ? 'visible' : 'hidden';
117
+ },
112
118
  },
113
119
  methods: {
114
120
  loading() {
@@ -137,21 +143,6 @@ export default {
137
143
  this.taskTitle = this.data?.name;
138
144
 
139
145
  this.taskTitle = this?.highlightedNode?.definition?.name;
140
- this.previewNode();
141
- },
142
-
143
- handleAssignmentChanges(currentValue, previousValue) {
144
- if (currentValue === previousValue) {
145
- return;
146
- }
147
-
148
- const nodeConfig = this.getConfig(this.data);
149
-
150
- if (nodeConfig) {
151
- this.prepareData();
152
- } else {
153
- this.$emit('togglePreview', false);
154
- }
155
146
  },
156
147
  onSelectedPreview(item) {
157
148
  this.selectedPreview = item;
@@ -160,10 +151,8 @@ export default {
160
151
  if (!this.highlightedNode || (!this.visible && !force)) {
161
152
  return;
162
153
  }
163
-
164
- const previewConfig = this.previewConfigs.find(config => {
165
- return config.matcher(this.data);
166
- });
154
+ this.prepareData();
155
+ const previewConfig = this.getConfig(this.data);
167
156
 
168
157
  let clone = {};
169
158
  for (let prop in this.data) {
@@ -176,7 +165,11 @@ export default {
176
165
 
177
166
  // if the node has the configurations (for example screenRef for a task in a task)
178
167
  const nodeHasConfigParams = Object.keys(clone).length > 0;
179
- this.previewUrl = previewConfig && nodeHasConfigParams ? `${previewConfig.url}?node=${nodeData}` : null;
168
+ const nodeHasConfiguredAssets = !!previewConfig?.assetUrl(this.data);
169
+
170
+ this.previewUrl = nodeHasConfiguredAssets && previewConfig && nodeHasConfigParams
171
+ ? `${previewConfig.url}?node=${nodeData}`
172
+ : null;
180
173
  this.taskTitle = this.highlightedNode?.definition?.name;
181
174
  },
182
175
  onClose() {
@@ -41,15 +41,16 @@ $inspector-column-min-width: 200px;
41
41
  width: 100%;
42
42
  }
43
43
 
44
- .preview-column .control-bar .actions div {
44
+ .preview-column .control-bar .actions {
45
45
  width: 100%;
46
- padding-right: 15px;
46
+ padding-right: 45px;
47
47
  text-align: right;
48
48
  }
49
49
 
50
- .preview-column .control-bar .actions div i {
50
+ .preview-column .control-bar .actions i {
51
51
  width: 20px;
52
52
  cursor: pointer;
53
+ margin-left: 5px;
53
54
  }
54
55
 
55
56
  .task-title {
@@ -69,7 +69,7 @@
69
69
  @previewResize="[onMouseMove($event), setInspectorButtonPosition($event)]"
70
70
  @startResize="onStartPreviewResize"
71
71
  @stopResize="onMouseUp"
72
- :visible="isOpenPreview"
72
+ :visible="isOpenPreview && !(highlightedNodes.length > 1)"
73
73
  :nodeRegistry="nodeRegistry"
74
74
  :previewConfigs="previewConfigs"
75
75
  :panelWidth="previewPanelWidth"
@@ -139,6 +139,7 @@
139
139
  @clone-selection="cloneSelection"
140
140
  @default-flow="toggleDefaultFlow"
141
141
  @shape-resize="shapeResize"
142
+ @definition-changed="onNodeDefinitionChanged"
142
143
  />
143
144
 
144
145
  <RailBottom
@@ -420,6 +421,12 @@ export default {
420
421
  isMultiplayer: () => store.getters.isMultiplayer,
421
422
  },
422
423
  methods: {
424
+ onNodeDefinitionChanged() {
425
+ // re-render the preview just if the preview pane is open
426
+ if (this.isOpenPreview) {
427
+ this.handlePreview();
428
+ }
429
+ },
423
430
  onStartPreviewResize(event) {
424
431
  this.isResizingPreview = true;
425
432
  this.currentCursorPosition = event.x;
@@ -1106,6 +1113,11 @@ export default {
1106
1113
  diagram.bounds.x = data.x;
1107
1114
  diagram.bounds.y = data.y;
1108
1115
  const newNode = this.createNode(data.type, definition, diagram);
1116
+ //verify if the node has a pool as a container
1117
+ if (data.poolId) {
1118
+ const pool = this.getElementByNodeId(data.poolId);
1119
+ this.poolTarget = pool;
1120
+ }
1109
1121
  await this.addNode(newNode, data.id, true);
1110
1122
  await this.$nextTick();
1111
1123
  await this.paperManager.awaitScheduledUpdates();
@@ -1172,11 +1184,10 @@ export default {
1172
1184
  'processmaker-modeler-sequence-flow',
1173
1185
  'processmaker-modeler-association',
1174
1186
  'processmaker-modeler-data-input-association',
1175
- 'processmaker-modeler-data-input-association',
1176
1187
  'processmaker-modeler-boundary-timer-event',
1177
1188
  'processmaker-modeler-boundary-error-event',
1178
1189
  'processmaker-modeler-boundary-signal-event',
1179
- 'processmaker-modeler-boundary-conditional-even',
1190
+ 'processmaker-modeler-boundary-conditional-event',
1180
1191
  'processmaker-modeler-boundary-message-event',
1181
1192
  ];
1182
1193
  if (!this.isMultiplayer) {
@@ -1202,6 +1213,7 @@ export default {
1202
1213
  loopCharacteristics: null,
1203
1214
  gatewayDirection: null,
1204
1215
  messageRef: null,
1216
+ signalRef: null,
1205
1217
  extras: {},
1206
1218
  };
1207
1219
  if (node?.pool?.component) {
@@ -1223,12 +1235,14 @@ export default {
1223
1235
  targetRefId = node.definition.targetRef?.$parent?.$parent?.get('id');
1224
1236
  }
1225
1237
  const waypoint = [];
1226
- node.diagram.waypoint.forEach(point => {
1238
+
1239
+ node.diagram.waypoint?.forEach(point => {
1227
1240
  waypoint.push({
1228
1241
  x: point.x,
1229
1242
  y: point.y,
1230
1243
  });
1231
1244
  });
1245
+
1232
1246
  if (sourceRefId && targetRefId) {
1233
1247
  const flowData = {
1234
1248
  id: node.definition.id,
@@ -1238,6 +1252,7 @@ export default {
1238
1252
  waypoint,
1239
1253
  name: node.definition.name,
1240
1254
  conditionExpression: null,
1255
+ color: null,
1241
1256
  };
1242
1257
 
1243
1258
  if (isProcessRequested) {
@@ -1625,6 +1640,12 @@ export default {
1625
1640
  this.players.splice(playerIndex, 1);
1626
1641
  }
1627
1642
  },
1643
+ /**
1644
+ * Update the lasso tool
1645
+ */
1646
+ updateLasso(){
1647
+ this.$refs.selector.updateSelectionBox();
1648
+ },
1628
1649
  },
1629
1650
  created() {
1630
1651
  if (runningInCypressTest()) {
@@ -598,8 +598,10 @@ export default {
598
598
  shapes.filter(shape => !shapesToNotTranslate.includes(shape.model.get('type')))
599
599
  .forEach(shape => {
600
600
  if (shape.model.get('type') === 'processmaker.modeler.bpmn.pool') {
601
- const children = shape.model.component.getElementsUnderArea(shape.model, this.graph);
602
- changed = [...changed, ...this.getContainerProperties(children, changed)];
601
+ const childrens = shape.model.component.getElementsUnderArea(shape.model, this.graph)
602
+ .filter((element) => element.component);
603
+
604
+ changed = [...changed, ...this.getContainerProperties(childrens, changed)];
603
605
  } else {
604
606
  const { node } = shape.model.component;
605
607
  const defaultData = {
@@ -655,9 +657,9 @@ export default {
655
657
  });
656
658
  return boundariesChanged;
657
659
  },
658
- getContainerProperties(children) {
660
+ getContainerProperties(childrens) {
659
661
  const changed = [];
660
- children.forEach(model => {
662
+ childrens.forEach(model => {
661
663
  changed.push({
662
664
  id: model.component.node.definition.id,
663
665
  properties: {
@@ -27,6 +27,7 @@ import CrownConfig from '@/components/crown/crownConfig/crownConfig';
27
27
  import highlightConfig from '@/mixins/highlightConfig';
28
28
  import store from '@/store';
29
29
  import { canAddBoundaryEventToTarget } from '@/boundaryEventValidation';
30
+ import { getBoundaryEventData } from '@/components/nodes/boundaryEvent/boundaryEventUtils';
30
31
 
31
32
  export default {
32
33
  components: {
@@ -203,24 +204,9 @@ export default {
203
204
  this.invalidTargetElement = targetElement;
204
205
  },
205
206
  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
- };
207
+ const defaultData = getBoundaryEventData(this.node);
212
208
 
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
- });
209
+ window.ProcessMaker.EventBus.$emit('multiplayer-addBoundaryEvent', defaultData);
224
210
  },
225
211
  },
226
212
  async mounted() {
@@ -234,9 +220,9 @@ export default {
234
220
  const task = this.getTaskUnderShape();
235
221
  this.attachBoundaryEventToTask(task);
236
222
  this.updateShapePosition(task);
237
-
223
+
238
224
  if (this.node.fromCrown) {
239
- this.addMultiplayerBoundaryEvent();
225
+ this.addMultiplayerBoundaryEvent();
240
226
  }
241
227
  },
242
228
  };
@@ -0,0 +1,35 @@
1
+ export const getBoundaryEventData = (node) => {
2
+ const control = {
3
+ bpmnType: node.diagram.$type,
4
+ id: node.diagram.id,
5
+ type: node.type,
6
+ attachedToRef: node.definition.get('attachedToRef'),
7
+ };
8
+
9
+ const eventDefinition = node.definition.get('eventDefinitions')[0];
10
+ const eventDefinitionType = Object.keys(eventDefinition).reduce((acc, key) => {
11
+ if (key.startsWith('time')) {
12
+ acc[key] = eventDefinition[key];
13
+ }
14
+ return acc;
15
+ }, {});
16
+
17
+ const type = Object.keys(eventDefinitionType)[0];
18
+
19
+ return {
20
+ x: node.diagram.bounds.x,
21
+ y: node.diagram.bounds.y,
22
+ height: node.diagram.bounds.height,
23
+ width: node.diagram.bounds.width,
24
+ attachedToRefId: node.definition.get('attachedToRef')?.id,
25
+ control,
26
+ type: node.type,
27
+ id: node.definition.id,
28
+ color: node.definition.get('color'),
29
+ cancelActivity: node.definition.get('cancelActivity'),
30
+ eventTimerDefinition: {
31
+ type,
32
+ body: eventDefinitionType[type]?.body,
33
+ },
34
+ };
35
+ };
@@ -10,6 +10,20 @@ import { defaultDurationTimerEvent } from '@/constants';
10
10
 
11
11
  export const id = 'processmaker-modeler-boundary-timer-event';
12
12
 
13
+ export const setEventTimerDefinition = (moddle, node, type, body) => {
14
+ const eventDefinition = {
15
+ [type]: moddle.create('bpmn:Expression', { body }),
16
+ };
17
+
18
+ const eventDefinitions = [
19
+ moddle.create('bpmn:TimerEventDefinition', eventDefinition),
20
+ ];
21
+
22
+ eventDefinitions[0].id = node.definition.get('eventDefinitions')[0].id;
23
+
24
+ return eventDefinitions;
25
+ };
26
+
13
27
  export default merge(cloneDeep(boundaryEventConfig), {
14
28
  id,
15
29
  component,
@@ -58,17 +72,18 @@ export default merge(cloneDeep(boundaryEventConfig), {
58
72
  continue;
59
73
  }
60
74
 
61
- const eventDefinition = {
62
- [type]: moddle.create('bpmn:Expression', { body }),
63
- };
64
-
65
- const eventDefinitions = [
66
- moddle.create('bpmn:TimerEventDefinition', eventDefinition),
67
- ];
68
-
69
- eventDefinitions[0].id = node.definition.get('eventDefinitions')[0].id;
75
+ const eventDefinitions = setEventTimerDefinition(moddle, node, type, body);
70
76
 
71
77
  setNodeProp(node, 'eventDefinitions', eventDefinitions);
78
+
79
+ window.ProcessMaker.EventBus.$emit('multiplayer-updateInspectorProperty', {
80
+ id: node.definition.id,
81
+ key: 'eventTimerDefinition',
82
+ value: {
83
+ type,
84
+ body,
85
+ },
86
+ });
72
87
  } else {
73
88
  window.ProcessMaker.EventBus.$emit('multiplayer-updateInspectorProperty', {
74
89
  id: node.definition.id , key, value: value[key],
@@ -37,6 +37,7 @@ export default {
37
37
  }
38
38
 
39
39
  let signal = definitions.rootElements.find(element => element.id === value.signalRef);
40
+
40
41
  if (!signal && value.signalRef) {
41
42
  signal = moddle.create('bpmn:Signal', {
42
43
  id: value.signalRef,
@@ -45,5 +46,14 @@ export default {
45
46
  definitions.rootElements.push(signal);
46
47
  }
47
48
  node.definition.get('eventDefinitions')[0].signalRef = signal;
49
+
50
+ window.ProcessMaker.EventBus.$emit('multiplayer-updateInspectorProperty', {
51
+ id: node.definition.id,
52
+ key: 'signalRef',
53
+ value: value.signalRef,
54
+ extras: {
55
+ signalName: signal?.name,
56
+ },
57
+ });
48
58
  },
49
59
  };
@@ -5,6 +5,7 @@ import { taskHeight, taskWidth } from '@/components/nodes/task/taskConfig';
5
5
  import advancedAccordionConfig from '@/components/inspectors/advancedAccordionConfig';
6
6
  import documentationAccordionConfig from '@/components/inspectors/documentationAccordionConfig';
7
7
  import defaultNames from '@/components/nodes/task/defaultNames';
8
+ import { loopCharacteristicsHandler } from '@/components/inspectors/LoopCharacteristics';
8
9
 
9
10
  export const id = 'processmaker-modeler-call-activity';
10
11
 
@@ -86,4 +87,5 @@ export default {
86
87
  ],
87
88
  },
88
89
  ],
90
+ loopCharacteristicsHandler,
89
91
  };
@@ -41,6 +41,7 @@
41
41
  </template>
42
42
 
43
43
  <script>
44
+ import debounce from 'lodash/debounce';
44
45
  import { util } from 'jointjs';
45
46
  import portsConfig from '@/mixins/portsConfig';
46
47
  import TaskShape from '@/components/nodes/task/shape';
@@ -128,7 +129,7 @@ export default {
128
129
  },
129
130
  },
130
131
  watch: {
131
- 'node.definition.name'(name) {
132
+ 'node.definition.name': debounce(function(name) {
132
133
  const { width } = this.node.diagram.bounds;
133
134
  this.shape.attr('label/text', util.breakText(name, { width }));
134
135
 
@@ -142,7 +143,7 @@ export default {
142
143
  this.shape.resize(width, newHeight);
143
144
  this.recalcMarkersAlignment();
144
145
  }
145
- },
146
+ }, 300),
146
147
  'node.definition.config'(config) {
147
148
  store.commit('updateNodeProp', {
148
149
  node: this.node,
@@ -23,6 +23,7 @@
23
23
  </template>
24
24
 
25
25
  <script>
26
+ import debounce from 'lodash/debounce';
26
27
  import { util } from 'jointjs';
27
28
  import highlightConfig from '@/mixins/highlightConfig';
28
29
  import portsConfig from '@/mixins/portsConfig';
@@ -97,7 +98,7 @@ export default {
97
98
  },
98
99
  },
99
100
  watch: {
100
- 'node.definition.name'(name) {
101
+ 'node.definition.name': debounce(function(name) {
101
102
  const { width } = this.node.diagram.bounds;
102
103
  this.shape.attr('label/text', util.breakText(name, { width }));
103
104
  const { height } = this.shape.size();
@@ -109,7 +110,7 @@ export default {
109
110
  this.shape.resize(width, newHeight);
110
111
  this.recalcMarkersAlignment();
111
112
  }
112
- },
113
+ }, 300),
113
114
  'node.definition.isForCompensation'() {
114
115
  setupCompensationMarker(this.node.definition, this.markers, this.$set, this.$delete);
115
116
  },
@@ -117,6 +118,7 @@ export default {
117
118
  deep: true,
118
119
  handler() {
119
120
  setupLoopCharacteristicsMarkers(this.node.definition, this.markers, this.$set, this.$delete);
121
+ this.$emit('definition-changed', this.node.definition);
120
122
  },
121
123
  },
122
124
  },
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <b-avatar-group class="container" v-if="!isMultiplayer">
2
+ <b-avatar-group class="container" v-show="isMultiplayer">
3
3
  <template v-for="item in filteredPlayers" >
4
4
  <Avatar :badgeBackgroundColor="item.color" :imgSrc="item.avatar" :userName="item.name" :key="item.key"/>
5
5
  </template>
@@ -47,6 +47,7 @@ export default {
47
47
  if (node.definition && node.definition.$type !== 'bpmn:BoundaryEvent') {
48
48
  clonedNodes.push(clonedElement);
49
49
  } else {
50
+ clonedElement.fromCrown = true;
50
51
  clonedBoundaryEvents.push(clonedElement);
51
52
  }
52
53
  }
@@ -128,7 +129,7 @@ export default {
128
129
  const originalTargetElement = this.getDataInputOutputAssociationTargetRef(originalAssociation.definition);
129
130
  const clonedElement = clonedNodes.find(node => node.cloneOf === originalTargetElement.id);
130
131
  const clonedDataInput = getOrFindDataInput(this.moddle, clonedElement, srcClone.definition);
131
-
132
+ clonedDataInput.$parent.$parent = clonedElement.definition;
132
133
  clonedAssociation.definition.set('sourceRef', [srcClone.definition]);
133
134
  clonedAssociation.definition.set('targetRef', clonedDataInput);
134
135
  clonedElement.definition.set('dataInputAssociations', [clonedAssociation.definition]);
@@ -4,6 +4,8 @@ import { getNodeIdGenerator } from '../NodeIdGenerator';
4
4
  import { getDefaultAnchorPoint } from '@/portsUtils';
5
5
  import Room from './room';
6
6
  import store from '@/store';
7
+ import { setEventTimerDefinition } from '@/components/nodes/boundaryTimerEvent';
8
+ import { getBoundaryEventData } from '@/components/nodes/boundaryEvent/boundaryEventUtils';
7
9
 
8
10
  export default class Multiplayer {
9
11
  clientIO = null;
@@ -199,7 +201,13 @@ export default class Multiplayer {
199
201
  */
200
202
  syncLocalNodes(clientId){
201
203
  // Get the process definition
202
- const nodes = this.modeler.nodes.map((node) => this.modeler.multiplayerHook(node, false, true));
204
+ const nodes = this.modeler.nodes.map((node) => {
205
+ if (node.definition.$type === 'bpmn:BoundaryEvent') {
206
+ return getBoundaryEventData(node);
207
+ }
208
+
209
+ return this.modeler.multiplayerHook(node, false, true);
210
+ });
203
211
 
204
212
  nodes.forEach((node) => {
205
213
  const yMapNested = new Y.Map();
@@ -227,7 +235,7 @@ export default class Multiplayer {
227
235
  if (node) {
228
236
  return;
229
237
  }
230
- if (this.modeler.nodeRegistry[value.type] && this.modeler.nodeRegistry[value.type].multiplayerClient) {
238
+ if (this.modeler.nodeRegistry[value.type]?.multiplayerClient) {
231
239
  this.modeler.nodeRegistry[value.type].multiplayerClient(this.modeler, value);
232
240
  } else {
233
241
  this.modeler.addRemoteNode(value);
@@ -245,7 +253,6 @@ export default class Multiplayer {
245
253
  removeNode(data) {
246
254
  const index = this.getIndex(data.definition.id);
247
255
  if (index >= 0) {
248
- this.removeShape(data);
249
256
  this.yArray.delete(index, 1); // delete one element
250
257
  // Encode the state as an update and send it to the server
251
258
  const stateUpdate = Y.encodeStateAsUpdate(this.yDoc);
@@ -352,34 +359,40 @@ export default class Multiplayer {
352
359
  const newPool = this.modeler.getElementByNodeId(data.poolId);
353
360
 
354
361
  if (this.modeler.flowTypes.includes(data.type)) {
355
- // Update the element's waypoints
356
- // Get the source and target elements
357
- const sourceElem = this.modeler.getElementByNodeId(data.sourceRefId);
358
- const targetElem = this.modeler.getElementByNodeId(data.targetRefId);
359
-
360
362
  const { waypoint } = data;
361
- const startWaypoint = waypoint.shift();
362
- const endWaypoint = waypoint.pop();
363
-
364
- // Update the element's waypoints
365
- const newWaypoint = waypoint.map(point => this.modeler.moddle.create('dc:Point', point));
366
- element.set('vertices', newWaypoint);
367
-
368
- // Update the element's source anchor
369
- element.source(sourceElem, {
370
- anchor: () => {
371
- return getDefaultAnchorPoint(this.getConnectionPoint(sourceElem, startWaypoint), sourceElem.findView(paper));
372
- },
373
- connectionPoint: { name: 'boundary' },
374
- });
375
363
 
376
- // Update the element's target anchor
377
- element.target(targetElem, {
378
- anchor: () => {
379
- return getDefaultAnchorPoint(this.getConnectionPoint(targetElem, endWaypoint), targetElem.findView(paper));
380
- },
381
- connectionPoint: { name: 'boundary' },
382
- });
364
+ if (waypoint) {
365
+ // Update the element's waypoints
366
+ // Get the source and target elements
367
+ const sourceElem = this.modeler.getElementByNodeId(data.sourceRefId);
368
+ const targetElem = this.modeler.getElementByNodeId(data.targetRefId);
369
+
370
+ const startWaypoint = waypoint.shift();
371
+ const endWaypoint = waypoint.pop();
372
+
373
+ // Update the element's waypoints
374
+ const newWaypoint = waypoint.map(point => this.modeler.moddle.create('dc:Point', point));
375
+ element.set('vertices', newWaypoint);
376
+
377
+ // Update the element's source anchor
378
+ element.source(sourceElem, {
379
+ anchor: () => {
380
+ return getDefaultAnchorPoint(this.getConnectionPoint(sourceElem, startWaypoint), sourceElem.findView(paper));
381
+ },
382
+ connectionPoint: { name: 'boundary' },
383
+ });
384
+
385
+ // Update the element's target anchor
386
+ element.target(targetElem, {
387
+ anchor: () => {
388
+ return getDefaultAnchorPoint(this.getConnectionPoint(targetElem, endWaypoint), targetElem.findView(paper));
389
+ },
390
+ connectionPoint: { name: 'boundary' },
391
+ });
392
+ } else {
393
+ const node = this.getNodeById(data.id);
394
+ store.commit('updateNodeProp', { node, key: 'color', value: data.color });
395
+ }
383
396
  } else {
384
397
  // Update the element's position attribute
385
398
  element.resize(
@@ -405,6 +418,7 @@ export default class Multiplayer {
405
418
  if (newPool && element.component.node.pool && element.component.node.pool.component.id !== data.poolId) {
406
419
  element.component.node.pool.component.moveElementRemote(element, newPool);
407
420
  }
421
+ this.modeler.updateLasso();
408
422
  }
409
423
  }
410
424
  attachBoundaryEventToNode(element, data) {
@@ -553,8 +567,8 @@ export default class Multiplayer {
553
567
  return;
554
568
  }
555
569
  const keys = Object.keys(data).filter((key) => key !== 'id');
556
- const key = keys[0];
557
- const value = data[key];
570
+ let key = keys[0];
571
+ let value = data[key];
558
572
 
559
573
  if (key === 'condition') {
560
574
  node.definition.get('eventDefinitions')[0].get('condition').body = value;
@@ -586,7 +600,34 @@ export default class Multiplayer {
586
600
  }
587
601
  }
588
602
 
589
- if (!['messageRef', 'gatewayDirection', 'condition', 'allowedUsers', 'allowedGroups'].includes(key)) {
603
+ if (key === 'signalRef') {
604
+ let signal = this.modeler.definitions.rootElements.find(element => element.id === value);
605
+
606
+ if (!signal) {
607
+ signal = this.modeler.moddle.create('bpmn:Signal', {
608
+ id: value,
609
+ name: extras?.signalName || value,
610
+ });
611
+ this.modeler.definitions.rootElements.push(signal);
612
+ }
613
+
614
+ node.definition.get('eventDefinitions')[0].signalRef = signal;
615
+ }
616
+
617
+ if (key === 'eventTimerDefinition') {
618
+ const { type, body } = value;
619
+
620
+ const eventDefinitions = setEventTimerDefinition(this.modeler.moddle, node, type, body);
621
+
622
+ key = 'eventDefinitions';
623
+ value = eventDefinitions;
624
+ }
625
+
626
+ const specialProperties = [
627
+ 'messageRef', 'signalRef', 'gatewayDirection', 'condition', 'allowedUsers', 'allowedGroups',
628
+ ];
629
+
630
+ if (!specialProperties.includes(key)) {
590
631
  store.commit('updateNodeProp', { node, key, value });
591
632
  }
592
633
  }