@processmaker/modeler 1.40.1 → 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.1",
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",
@@ -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,7 +151,7 @@ export default {
160
151
  if (!this.highlightedNode || (!this.visible && !force)) {
161
152
  return;
162
153
  }
163
-
154
+ this.prepareData();
164
155
  const previewConfig = this.getConfig(this.data);
165
156
 
166
157
  let clone = {};
@@ -179,7 +170,6 @@ export default {
179
170
  this.previewUrl = nodeHasConfiguredAssets && previewConfig && nodeHasConfigParams
180
171
  ? `${previewConfig.url}?node=${nodeData}`
181
172
  : null;
182
-
183
173
  this.taskTitle = this.highlightedNode?.definition?.name;
184
174
  },
185
175
  onClose() {
@@ -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;
@@ -1177,11 +1184,10 @@ export default {
1177
1184
  'processmaker-modeler-sequence-flow',
1178
1185
  'processmaker-modeler-association',
1179
1186
  'processmaker-modeler-data-input-association',
1180
- 'processmaker-modeler-data-input-association',
1181
1187
  'processmaker-modeler-boundary-timer-event',
1182
1188
  'processmaker-modeler-boundary-error-event',
1183
1189
  'processmaker-modeler-boundary-signal-event',
1184
- 'processmaker-modeler-boundary-conditional-even',
1190
+ 'processmaker-modeler-boundary-conditional-event',
1185
1191
  'processmaker-modeler-boundary-message-event',
1186
1192
  ];
1187
1193
  if (!this.isMultiplayer) {
@@ -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],
@@ -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
  };
@@ -118,6 +118,7 @@ export default {
118
118
  deep: true,
119
119
  handler() {
120
120
  setupLoopCharacteristicsMarkers(this.node.definition, this.markers, this.$set, this.$delete);
121
+ this.$emit('definition-changed', this.node.definition);
121
122
  },
122
123
  },
123
124
  },
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <b-avatar-group class="container" v-show="!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);
@@ -559,8 +567,8 @@ export default class Multiplayer {
559
567
  return;
560
568
  }
561
569
  const keys = Object.keys(data).filter((key) => key !== 'id');
562
- const key = keys[0];
563
- const value = data[key];
570
+ let key = keys[0];
571
+ let value = data[key];
564
572
 
565
573
  if (key === 'condition') {
566
574
  node.definition.get('eventDefinitions')[0].get('condition').body = value;
@@ -606,6 +614,15 @@ export default class Multiplayer {
606
614
  node.definition.get('eventDefinitions')[0].signalRef = signal;
607
615
  }
608
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
+
609
626
  const specialProperties = [
610
627
  'messageRef', 'signalRef', 'gatewayDirection', 'condition', 'allowedUsers', 'allowedGroups',
611
628
  ];
@@ -28,10 +28,10 @@ export default (node) => {
28
28
  const originalInspectorData = node.inspectorData || null;
29
29
 
30
30
  // Override the inspector handler to add loop props
31
- node.inspectorHandler = (value, node, setNodeProp, moddle, definitions, defaultInspectorHandler) => {
31
+ node.inspectorHandler = (value, node, setNodeProp, moddle, definitions, defaultInspectorHandler, isMultiplayer) => {
32
32
  originalInspectorHandler(value, node, setNodeProp, moddle, definitions, defaultInspectorHandler);
33
- value = loopCharacteristicsHandler(value, node, setNodeProp, moddle, definitions);
34
- defaultInspectorHandler(value);
33
+ value = loopCharacteristicsHandler(value, node, setNodeProp, moddle, definitions, isMultiplayer);
34
+ defaultInspectorHandler(value, isMultiplayer);
35
35
  };
36
36
 
37
37
  // Override the data handler to load loop config into the inspector