@processmaker/modeler 1.40.0 → 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.40.0",
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>
@@ -245,7 +245,6 @@ export default class Multiplayer {
245
245
  removeNode(data) {
246
246
  const index = this.getIndex(data.definition.id);
247
247
  if (index >= 0) {
248
- this.removeShape(data);
249
248
  this.yArray.delete(index, 1); // delete one element
250
249
  // Encode the state as an update and send it to the server
251
250
  const stateUpdate = Y.encodeStateAsUpdate(this.yDoc);
@@ -352,34 +351,40 @@ export default class Multiplayer {
352
351
  const newPool = this.modeler.getElementByNodeId(data.poolId);
353
352
 
354
353
  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
354
  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
355
 
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
- });
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
+ }
383
388
  } else {
384
389
  // Update the element's position attribute
385
390
  element.resize(
@@ -405,6 +410,7 @@ export default class Multiplayer {
405
410
  if (newPool && element.component.node.pool && element.component.node.pool.component.id !== data.poolId) {
406
411
  element.component.node.pool.component.moveElementRemote(element, newPool);
407
412
  }
413
+ this.modeler.updateLasso();
408
414
  }
409
415
  }
410
416
  attachBoundaryEventToNode(element, data) {
@@ -586,7 +592,25 @@ export default class Multiplayer {
586
592
  }
587
593
  }
588
594
 
589
- 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)) {
590
614
  store.commit('updateNodeProp', { node, key, value });
591
615
  }
592
616
  }