@processmaker/modeler 1.39.32 → 1.40.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.39.32",
3
+ "version": "1.40.1",
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,
@@ -161,9 +161,7 @@ export default {
161
161
  return;
162
162
  }
163
163
 
164
- const previewConfig = this.previewConfigs.find(config => {
165
- return config.matcher(this.data);
166
- });
164
+ const previewConfig = this.getConfig(this.data);
167
165
 
168
166
  let clone = {};
169
167
  for (let prop in this.data) {
@@ -176,7 +174,12 @@ export default {
176
174
 
177
175
  // if the node has the configurations (for example screenRef for a task in a task)
178
176
  const nodeHasConfigParams = Object.keys(clone).length > 0;
179
- this.previewUrl = previewConfig && nodeHasConfigParams ? `${previewConfig.url}?node=${nodeData}` : null;
177
+ const nodeHasConfiguredAssets = !!previewConfig?.assetUrl(this.data);
178
+
179
+ this.previewUrl = nodeHasConfiguredAssets && previewConfig && nodeHasConfigParams
180
+ ? `${previewConfig.url}?node=${nodeData}`
181
+ : null;
182
+
180
183
  this.taskTitle = this.highlightedNode?.definition?.name;
181
184
  },
182
185
  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"
@@ -1106,6 +1106,11 @@ export default {
1106
1106
  diagram.bounds.x = data.x;
1107
1107
  diagram.bounds.y = data.y;
1108
1108
  const newNode = this.createNode(data.type, definition, diagram);
1109
+ //verify if the node has a pool as a container
1110
+ if (data.poolId) {
1111
+ const pool = this.getElementByNodeId(data.poolId);
1112
+ this.poolTarget = pool;
1113
+ }
1109
1114
  await this.addNode(newNode, data.id, true);
1110
1115
  await this.$nextTick();
1111
1116
  await this.paperManager.awaitScheduledUpdates();
@@ -1202,6 +1207,7 @@ export default {
1202
1207
  loopCharacteristics: null,
1203
1208
  gatewayDirection: null,
1204
1209
  messageRef: null,
1210
+ signalRef: null,
1205
1211
  extras: {},
1206
1212
  };
1207
1213
  if (node?.pool?.component) {
@@ -1223,12 +1229,14 @@ export default {
1223
1229
  targetRefId = node.definition.targetRef?.$parent?.$parent?.get('id');
1224
1230
  }
1225
1231
  const waypoint = [];
1226
- node.diagram.waypoint.forEach(point => {
1232
+
1233
+ node.diagram.waypoint?.forEach(point => {
1227
1234
  waypoint.push({
1228
1235
  x: point.x,
1229
1236
  y: point.y,
1230
1237
  });
1231
1238
  });
1239
+
1232
1240
  if (sourceRefId && targetRefId) {
1233
1241
  const flowData = {
1234
1242
  id: node.definition.id,
@@ -1238,6 +1246,7 @@ export default {
1238
1246
  waypoint,
1239
1247
  name: node.definition.name,
1240
1248
  conditionExpression: null,
1249
+ color: null,
1241
1250
  };
1242
1251
 
1243
1252
  if (isProcessRequested) {
@@ -1625,6 +1634,12 @@ export default {
1625
1634
  this.players.splice(playerIndex, 1);
1626
1635
  }
1627
1636
  },
1637
+ /**
1638
+ * Update the lasso tool
1639
+ */
1640
+ updateLasso(){
1641
+ this.$refs.selector.updateSelectionBox();
1642
+ },
1628
1643
  },
1629
1644
  created() {
1630
1645
  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: {
@@ -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
  };
@@ -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
  },
@@ -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>
@@ -32,6 +32,14 @@ export default class Multiplayer {
32
32
  // Connect to websocket server
33
33
  this.clientIO = io(window.ProcessMaker.multiplayer.host, { transports: ['websocket', 'polling']});
34
34
 
35
+ if (window.ProcessMaker.multiplayer.enabled) {
36
+ this.webSocketEvents();
37
+ this.multiplayerEvents();
38
+ } else {
39
+ this.clientIO.disconnect();
40
+ }
41
+ }
42
+ webSocketEvents() {
35
43
  this.clientIO.on('connect', () => {
36
44
  // Join the room
37
45
  this.clientIO.emit('joinRoom', {
@@ -133,6 +141,7 @@ export default class Multiplayer {
133
141
  // Update the element in the shared array
134
142
  Y.applyUpdate(this.yDoc, new Uint8Array(updateDoc));
135
143
  });
144
+
136
145
  this.clientIO.on('updateFlows', (payload) => {
137
146
  const { updateDoc, updatedNodes } = payload;
138
147
  // Update the elements in the process
@@ -142,10 +151,13 @@ export default class Multiplayer {
142
151
  // Update the element in the shared array
143
152
  Y.applyUpdate(this.yDoc, new Uint8Array(updateDoc));
144
153
  });
154
+ }
145
155
 
156
+ multiplayerEvents() {
146
157
  window.ProcessMaker.EventBus.$on('multiplayer-addNode', ( data ) => {
147
158
  this.addNode(data);
148
159
  });
160
+
149
161
  window.ProcessMaker.EventBus.$on('multiplayer-removeNode', ( data ) => {
150
162
  this.removeNode(data);
151
163
  });
@@ -169,6 +181,7 @@ export default class Multiplayer {
169
181
  window.ProcessMaker.EventBus.$on('multiplayer-addLanes', ( lanes ) => {
170
182
  this.addLaneNodes(lanes);
171
183
  });
184
+
172
185
  window.ProcessMaker.EventBus.$on('multiplayer-updateInspectorProperty', ( data ) => {
173
186
  if (this.modeler.isMultiplayer) {
174
187
  this.updateInspectorProperty(data);
@@ -232,7 +245,6 @@ export default class Multiplayer {
232
245
  removeNode(data) {
233
246
  const index = this.getIndex(data.definition.id);
234
247
  if (index >= 0) {
235
- this.removeShape(data);
236
248
  this.yArray.delete(index, 1); // delete one element
237
249
  // Encode the state as an update and send it to the server
238
250
  const stateUpdate = Y.encodeStateAsUpdate(this.yDoc);
@@ -339,34 +351,40 @@ export default class Multiplayer {
339
351
  const newPool = this.modeler.getElementByNodeId(data.poolId);
340
352
 
341
353
  if (this.modeler.flowTypes.includes(data.type)) {
342
- // Update the element's waypoints
343
- // Get the source and target elements
344
- const sourceElem = this.modeler.getElementByNodeId(data.sourceRefId);
345
- const targetElem = this.modeler.getElementByNodeId(data.targetRefId);
346
-
347
354
  const { waypoint } = data;
348
- const startWaypoint = waypoint.shift();
349
- const endWaypoint = waypoint.pop();
350
-
351
- // Update the element's waypoints
352
- const newWaypoint = waypoint.map(point => this.modeler.moddle.create('dc:Point', point));
353
- element.set('vertices', newWaypoint);
354
-
355
- // Update the element's source anchor
356
- element.source(sourceElem, {
357
- anchor: () => {
358
- return getDefaultAnchorPoint(this.getConnectionPoint(sourceElem, startWaypoint), sourceElem.findView(paper));
359
- },
360
- connectionPoint: { name: 'boundary' },
361
- });
362
355
 
363
- // Update the element's target anchor
364
- element.target(targetElem, {
365
- anchor: () => {
366
- return getDefaultAnchorPoint(this.getConnectionPoint(targetElem, endWaypoint), targetElem.findView(paper));
367
- },
368
- connectionPoint: { name: 'boundary' },
369
- });
356
+ if (waypoint) {
357
+ // Update the element's waypoints
358
+ // Get the source and target elements
359
+ const sourceElem = this.modeler.getElementByNodeId(data.sourceRefId);
360
+ const targetElem = this.modeler.getElementByNodeId(data.targetRefId);
361
+
362
+ const startWaypoint = waypoint.shift();
363
+ const endWaypoint = waypoint.pop();
364
+
365
+ // Update the element's waypoints
366
+ const newWaypoint = waypoint.map(point => this.modeler.moddle.create('dc:Point', point));
367
+ element.set('vertices', newWaypoint);
368
+
369
+ // Update the element's source anchor
370
+ element.source(sourceElem, {
371
+ anchor: () => {
372
+ return getDefaultAnchorPoint(this.getConnectionPoint(sourceElem, startWaypoint), sourceElem.findView(paper));
373
+ },
374
+ connectionPoint: { name: 'boundary' },
375
+ });
376
+
377
+ // Update the element's target anchor
378
+ element.target(targetElem, {
379
+ anchor: () => {
380
+ return getDefaultAnchorPoint(this.getConnectionPoint(targetElem, endWaypoint), targetElem.findView(paper));
381
+ },
382
+ connectionPoint: { name: 'boundary' },
383
+ });
384
+ } else {
385
+ const node = this.getNodeById(data.id);
386
+ store.commit('updateNodeProp', { node, key: 'color', value: data.color });
387
+ }
370
388
  } else {
371
389
  // Update the element's position attribute
372
390
  element.resize(
@@ -392,6 +410,7 @@ export default class Multiplayer {
392
410
  if (newPool && element.component.node.pool && element.component.node.pool.component.id !== data.poolId) {
393
411
  element.component.node.pool.component.moveElementRemote(element, newPool);
394
412
  }
413
+ this.modeler.updateLasso();
395
414
  }
396
415
  }
397
416
  attachBoundaryEventToNode(element, data) {
@@ -573,7 +592,25 @@ export default class Multiplayer {
573
592
  }
574
593
  }
575
594
 
576
- if (!['messageRef', 'gatewayDirection', 'condition', 'allowedUsers', 'allowedGroups'].includes(key)) {
595
+ if (key === 'signalRef') {
596
+ let signal = this.modeler.definitions.rootElements.find(element => element.id === value);
597
+
598
+ if (!signal) {
599
+ signal = this.modeler.moddle.create('bpmn:Signal', {
600
+ id: value,
601
+ name: extras?.signalName || value,
602
+ });
603
+ this.modeler.definitions.rootElements.push(signal);
604
+ }
605
+
606
+ node.definition.get('eventDefinitions')[0].signalRef = signal;
607
+ }
608
+
609
+ const specialProperties = [
610
+ 'messageRef', 'signalRef', 'gatewayDirection', 'condition', 'allowedUsers', 'allowedGroups',
611
+ ];
612
+
613
+ if (!specialProperties.includes(key)) {
577
614
  store.commit('updateNodeProp', { node, key, value });
578
615
  }
579
616
  }
@@ -36,6 +36,7 @@ window.ProcessMaker = {
36
36
  },
37
37
  multiplayer:{
38
38
  host: process.env.VUE_APP_WEBSOCKET_PROVIDER,
39
+ enabled: /^true$/i.test(process.env.VUE_APP_COLLABORATIVE_ENABLED),
39
40
  },
40
41
  EventBus: new Vue(),
41
42
  apiClient: axios,
@@ -63,5 +64,4 @@ window.ProcessMaker = {
63
64
  fullName: faker.person.fullName(),
64
65
  avatar: null,
65
66
  },
66
-
67
67
  };