@processmaker/modeler 1.39.30 → 1.39.32

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.30",
3
+ "version": "1.39.32",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve --mode development",
6
6
  "test:unit": "vue-cli-service test:unit",
@@ -329,7 +329,7 @@ export default {
329
329
  immediate: true,
330
330
  handler(value) {
331
331
  this.selectedOption = this.options.find(option => get(option, this.trackBy) == value);
332
-
332
+
333
333
  if (value && !this.selectedOption) {
334
334
  this.loadSelected(value);
335
335
  }
@@ -1,65 +1,71 @@
1
1
  <template>
2
- <b-col
3
- v-show="visible"
4
- id="preview_panel"
5
- class="pl-0 h-100 overflow-hidden preview-column"
6
- :style="{ maxWidth: width + 'px' }"
7
- @mousedown="onMouseDown"
2
+ <b-row ref="resizableDiv"
8
3
  @mouseup="onMouseUp"
9
4
  @mousemove="onMouseMove"
10
- data-test="preview-panel"
5
+ v-show="visible"
11
6
  >
12
- <b-row class="control-bar">
13
- <b-col cols="9">
14
- <div>
15
- <i v-show = "selectedPreview == 1" class="fas fa-file-alt"/>
16
- <b v-show = "selectedPreview == 2"> {} </b>
17
- <b-dropdown
18
- variant="ellipsis"
19
- no-caret
20
- no-flip
21
- lazy
22
- class="dropdown-right"
23
- style="margin-top:-10px"
24
- v-model="selectedPreview"
25
- >
26
- <template #button-content>
27
- <i class="fas fa-sort-down" />
28
- </template>
29
-
30
- <b-dropdown-item key="1" class="ellipsis-dropdown-item mx-auto" @click="onSelectedPreview(1)">
31
- <div class="ellipsis-dropdown-content">
32
- <b class="pr-1 fa-fw fas fa-file-alt" />
33
- <span>{{ $t('Document') }}</span>
34
- </div>
35
- </b-dropdown-item>
36
-
37
- </b-dropdown>
38
- <span>{{ $t('Preview') }} - {{ taskTitle }}</span>
39
- </div>
40
- </b-col>
41
- <b-col class="actions">
42
- <div>
7
+ <b-col class="col-auto p-0 resizer-column" @mousedown="onMouseDown" />
8
+ <b-col
9
+ class="pl-0 h-100 overflow-hidden preview-column"
10
+ :style="{ width: panelWidth + 'px' }"
11
+ data-test="preview-panel"
12
+ >
13
+ <b-row class="control-bar">
14
+ <b-col cols="9">
15
+ <div>
16
+ <i v-show = "selectedPreview === 1" class="fas fa-file-alt"/>
17
+ <b v-show = "selectedPreview === 2"> {} </b>
18
+ <b-dropdown
19
+ variant="ellipsis"
20
+ no-caret
21
+ no-flip
22
+ lazy
23
+ class="preview-type-dropdown"
24
+ v-model="selectedPreview"
25
+ >
26
+ <template #button-content>
27
+ <i class="fas fa-sort-down" />
28
+ </template>
29
+
30
+ <b-dropdown-item key="1" class="ellipsis-dropdown-item mx-auto" @click="onSelectedPreview(1)">
31
+ <div class="ellipsis-dropdown-content">
32
+ <b class="pr-1 fa-fw fas fa-file-alt" />
33
+ <span>{{ $t('Document') }}</span>
34
+ </div>
35
+ </b-dropdown-item>
36
+
37
+ </b-dropdown>
38
+ <span>{{ $t('Preview') }} - {{ taskTitle }}</span>
39
+ </div>
40
+ </b-col>
41
+ <b-col class="actions">
43
42
  <i class="fas fa-external-link-alt" v-show="previewUrl" @click="openAsset()"/>
44
43
  <i class="fas fa-times" @click="onClose()" />
45
- </div>
46
- </b-col>
47
- </b-row>
44
+ </b-col>
45
+ </b-row>
46
+
47
+ <b-row class="divider"/>
48
48
 
49
- <b-row>
50
- <div style="background-color: #0074D9; height: 20px; width: 100%">&nbsp;</div>
51
- </b-row>
49
+ <b-row>
50
+ <div class="task-title"> {{ taskTitle }} </div>
51
+ </b-row>
52
52
 
53
- <b-row>
54
- <div class="task-title"> {{ taskTitle }} </div>
55
- </b-row>
53
+ <loading-preview v-show="showSpinner"/>
56
54
 
57
- <loading-preview v-if="showSpinner"/>
55
+ <no-preview-available v-show="!previewUrl"/>
58
56
 
59
- <no-preview-available v-show="!previewUrl"/>
60
- <iframe title="Preview" v-show="!!previewUrl && !showSpinner" :src="previewUrl" style="width:100%; height:100%;border: none;" @load="loading"/>
61
- </b-col>
57
+ <iframe
58
+ title="Preview"
59
+ v-show="!!previewUrl && !showSpinner"
60
+ :src="previewUrl"
61
+ class="preview-iframe"
62
+ @load="loading"
63
+ @mousemove="onMouseMove"
64
+ @mouseup="onMouseUp"
65
+ />
62
66
 
67
+ </b-col>
68
+ </b-row>
63
69
  </template>
64
70
 
65
71
  <script>
@@ -68,7 +74,7 @@ import NoPreviewAvailable from '@/components/inspectors/NoPreviewAvailable';
68
74
  import LoadingPreview from '@/components/inspectors/LoadingPreview.vue';
69
75
 
70
76
  export default {
71
- props: ['nodeRegistry', 'visible', 'previewConfigs'],
77
+ props: ['nodeRegistry', 'visible', 'previewConfigs', 'panelWidth'],
72
78
  components: { NoPreviewAvailable, LoadingPreview },
73
79
  data() {
74
80
  return {
@@ -79,7 +85,6 @@ export default {
79
85
  taskTitle: '',
80
86
  itemTitle: '',
81
87
  width: 600,
82
- isDragging: false,
83
88
  currentPos: 600,
84
89
  };
85
90
  },
@@ -148,7 +153,6 @@ export default {
148
153
  this.$emit('togglePreview', false);
149
154
  }
150
155
  },
151
-
152
156
  onSelectedPreview(item) {
153
157
  this.selectedPreview = item;
154
158
  },
@@ -174,26 +178,26 @@ export default {
174
178
  const nodeHasConfigParams = Object.keys(clone).length > 0;
175
179
  this.previewUrl = previewConfig && nodeHasConfigParams ? `${previewConfig.url}?node=${nodeData}` : null;
176
180
  this.taskTitle = this.highlightedNode?.definition?.name;
177
- this.showPanel = true;
178
181
  },
179
182
  onClose() {
180
183
  this.$emit('togglePreview', false);
181
184
  },
182
185
  onMouseDown(event) {
183
- this.isDragging = true;
184
- this.currentPos = event.x;
186
+ this.$emit('startResize', event);
185
187
  },
186
188
  onMouseUp() {
187
- this.isDragging = false;
189
+ this.$emit('stopResize');
188
190
  },
189
191
  onMouseMove(event) {
190
- if (this.isDragging) {
191
- const dx = this.currentPos - event.x;
192
- this.currentPos = event.x;
193
- this.width = parseInt(this.width) + dx;
194
- this.$emit('previewResize', this.width);
192
+ if (window.ProcessMaker.$modeler.isResizingPreview) {
193
+ this.$emit('previewResize', event);
195
194
  }
196
195
  },
196
+ setWidth(positionX) {
197
+ const dx = this.currentPos - positionX;
198
+ this.currentPos = positionX;
199
+ this.width = parseInt(this.width) + dx;
200
+ },
197
201
  },
198
202
  };
199
203
  </script>
@@ -1,28 +1,18 @@
1
- $inspector-column-max-width: 400px;
2
1
  $inspector-column-min-width: 200px;
3
2
 
4
- #preview_panel::after {
5
- display: flex;
6
- content: '';
7
- left: 0;
8
- width: 5px;
9
- height: 100%;
10
- cursor: ew-resize;
11
- }
12
-
13
3
  .preview-column {
14
- max-width: $inspector-column-max-width;
15
4
  min-width: $inspector-column-min-width;
16
5
  resize: both;
17
6
  overflow:auto;
18
7
  background-color: #fff;
19
- border-left: 8px solid #EBEEF2;
20
8
  z-index: 2;
21
9
  }
22
10
 
23
- .paneiframe {
24
- display:block;
25
- width:100%;
11
+ .preview-iframe {
12
+ width:90%;
13
+ height:100%;
14
+ padding: 0 30px 0 50px;
15
+ border: none;
26
16
  }
27
17
 
28
18
  .preview-column .control-bar {
@@ -31,12 +21,29 @@ $inspector-column-min-width: 200px;
31
21
  color: #7f7f7f;
32
22
  }
33
23
 
24
+ .preview-type-dropdown {
25
+ margin-top:-10px;
26
+ }
27
+
28
+ .resizer-column {
29
+ cursor:ew-resize;
30
+ width:5px;
31
+ background-color:#EBEEF2;
32
+ }
33
+
34
34
  .preview-column .control-bar .actions {
35
35
  text-align: right;
36
36
  }
37
37
 
38
+ .preview-column .divider {
39
+ background-color: #0074D9;
40
+ height: 20px;
41
+ width: 100%;
42
+ }
43
+
38
44
  .preview-column .control-bar .actions div {
39
45
  width: 100%;
46
+ padding-right: 15px;
40
47
  text-align: right;
41
48
  }
42
49
 
@@ -45,16 +52,6 @@ $inspector-column-min-width: 200px;
45
52
  cursor: pointer;
46
53
  }
47
54
 
48
- .item-title {
49
- margin-top: 15px;
50
- width: 100%;
51
- height: 30px;
52
- font-size: larger;
53
- text-align: center;
54
- align-items: center;
55
- color: #7f7f7f;
56
- }
57
-
58
55
  .task-title {
59
56
  width: 100%;
60
57
  height: 60px;
@@ -45,6 +45,8 @@
45
45
  ref="paper-container"
46
46
  :class="[cursor, { 'grabbing-cursor' : isGrabbing }]"
47
47
  :style="{ width: parentWidth, height: parentHeight }"
48
+ @mouseup="onMouseUp"
49
+ @mousemove="[onMouseMove($event), setInspectorButtonPosition($event)]"
48
50
  >
49
51
 
50
52
  <div ref="paper" data-test="paper" class="main-paper" />
@@ -64,10 +66,13 @@
64
66
 
65
67
  <PreviewPanel ref="preview-panel"
66
68
  @togglePreview="[handleTogglePreview($event), setInspectorButtonPosition($event)]"
67
- @previewResize="setInspectorButtonPosition"
69
+ @previewResize="[onMouseMove($event), setInspectorButtonPosition($event)]"
70
+ @startResize="onStartPreviewResize"
71
+ @stopResize="onMouseUp"
68
72
  :visible="isOpenPreview"
69
73
  :nodeRegistry="nodeRegistry"
70
74
  :previewConfigs="previewConfigs"
75
+ :panelWidth="previewPanelWidth"
71
76
  />
72
77
 
73
78
  <InspectorPanel
@@ -164,6 +169,7 @@
164
169
  </template>
165
170
 
166
171
  <script>
172
+
167
173
  import Vue from 'vue';
168
174
  import _ from 'lodash';
169
175
  import { dia } from 'jointjs';
@@ -212,7 +218,14 @@ import hotkeys from '@/components/hotkeys/main';
212
218
  import TimerEventNode from '@/components/nodes/timerEventNode';
213
219
  import focusNameInputAndHighlightLabel from '@/components/modeler/focusNameInputAndHighlightLabel';
214
220
  import XMLManager from '@/components/modeler/XMLManager';
215
- import { removeNodeFlows, removeNodeMessageFlows, removeNodeAssociations, removeOutgoingAndIncomingRefsToFlow, removeBoundaryEvents, removeSourceDefault } from '@/components/crown/utils';
221
+ import {
222
+ removeBoundaryEvents,
223
+ removeNodeAssociations,
224
+ removeNodeFlows,
225
+ removeNodeMessageFlows,
226
+ removeOutgoingAndIncomingRefsToFlow,
227
+ removeSourceDefault,
228
+ } from '@/components/crown/utils';
216
229
  import { getInvalidNodes } from '@/components/modeler/modelerUtils';
217
230
  import { NodeMigrator } from '@/components/modeler/NodeMigrator';
218
231
  import addLoopCharacteristics from '@/setup/addLoopCharacteristics';
@@ -330,6 +343,9 @@ export default {
330
343
  showInspectorButton: true,
331
344
  inspectorButtonRight: 65,
332
345
  previewConfigs: [],
346
+ isResizingPreview: false,
347
+ currentCursorPosition: 0,
348
+ previewPanelWidth: 600,
333
349
  flowTypes: [
334
350
  'processmaker-modeler-sequence-flow',
335
351
  'processmaker-modeler-message-flow',
@@ -404,6 +420,20 @@ export default {
404
420
  isMultiplayer: () => store.getters.isMultiplayer,
405
421
  },
406
422
  methods: {
423
+ onStartPreviewResize(event) {
424
+ this.isResizingPreview = true;
425
+ this.currentCursorPosition = event.x;
426
+ },
427
+ onMouseUp() {
428
+ this.isResizingPreview = false;
429
+ },
430
+ onMouseMove(event) {
431
+ if (this.isResizingPreview) {
432
+ const dx = this.currentCursorPosition - event.x;
433
+ this.previewPanelWidth = parseInt(this.previewPanelWidth) + dx;
434
+ this.currentCursorPosition = event.x;
435
+ }
436
+ },
407
437
  registerPreview(config) {
408
438
  this.previewConfigs.push(config);
409
439
  },
@@ -427,13 +457,12 @@ export default {
427
457
  this.isOpenPreview = value;
428
458
  },
429
459
  setInspectorButtonPosition() {
430
- const previewWidth = this.$refs['preview-panel'].width;
431
460
  if (this.isOpenInspector) {
432
461
  return;
433
462
  }
434
463
 
435
464
  if (this.isOpenPreview && !this.isOpenInspector) {
436
- this.inspectorButtonRight = 65 + previewWidth;
465
+ this.inspectorButtonRight = 65 + this.previewPanelWidth;
437
466
  }
438
467
 
439
468
  if (!this.isOpenPreview && !this.isOpenInspector) {
@@ -1172,6 +1201,8 @@ export default {
1172
1201
  config: node.definition.config,
1173
1202
  loopCharacteristics: null,
1174
1203
  gatewayDirection: null,
1204
+ messageRef: null,
1205
+ extras: {},
1175
1206
  };
1176
1207
  if (node?.pool?.component) {
1177
1208
  defaultData['poolId'] = node.pool.component.id;
@@ -1191,14 +1222,22 @@ export default {
1191
1222
  sourceRefId = Array.isArray(node.definition.sourceRef) && node.definition.sourceRef[0]?.id;
1192
1223
  targetRefId = node.definition.targetRef?.$parent?.$parent?.get('id');
1193
1224
  }
1194
-
1225
+ const waypoint = [];
1226
+ node.diagram.waypoint.forEach(point => {
1227
+ waypoint.push({
1228
+ x: point.x,
1229
+ y: point.y,
1230
+ });
1231
+ });
1195
1232
  if (sourceRefId && targetRefId) {
1196
1233
  const flowData = {
1197
1234
  id: node.definition.id,
1198
1235
  type: node.type,
1199
1236
  sourceRefId,
1200
1237
  targetRefId,
1201
- waypoint: node.diagram.waypoint,
1238
+ waypoint,
1239
+ name: node.definition.name,
1240
+ conditionExpression: null,
1202
1241
  };
1203
1242
 
1204
1243
  if (isProcessRequested) {
@@ -14,17 +14,23 @@ export class NodeMigrator {
14
14
  if (keepOriginalName(this._nodeThatWillBeReplaced)) {
15
15
  this._definition.name = this._nodeThatWillBeReplaced.definition.name;
16
16
  }
17
-
17
+ const flowNodes = [];
18
18
  const forceNodeToRemount = definition => {
19
19
  const shape = this._graph.getLinks().find(element => {
20
20
  return element.component && element.component.node.definition === definition;
21
21
  });
22
22
  shape.component.node._modelerId += '_replaced';
23
+ 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,
29
+ });
23
30
  };
24
31
 
25
32
  const incoming = this._nodeThatWillBeReplaced.definition.get('incoming');
26
33
  const outgoing = this._nodeThatWillBeReplaced.definition.get('outgoing');
27
-
28
34
  this._definition.get('incoming').push(...incoming);
29
35
  this._definition.get('outgoing').push(...outgoing);
30
36
 
@@ -62,6 +68,8 @@ export class NodeMigrator {
62
68
  forceNodeToRemount(flow);
63
69
  });
64
70
  }
71
+ // multiplayer hook to update the flows
72
+ window.ProcessMaker.EventBus.$emit('multiplayer-updateFlows', flowNodes);
65
73
  }
66
74
 
67
75
  _handleSequenceFlowForGateway(ref) {
@@ -52,7 +52,7 @@ export default merge(cloneDeep(endEventConfig), {
52
52
  });
53
53
  }
54
54
  },
55
- multiplayerInspectorHandler(node, data){
55
+ multiplayerInspectorHandler(node, data, setNodeProp) {
56
56
  const keys = Object.keys(data).filter((key) => key !== 'id');
57
57
  if (keys[0] === 'eventDefinitions') {
58
58
  const error = data[keys[0]][0].errorRef;
@@ -62,7 +62,9 @@ export default merge(cloneDeep(endEventConfig), {
62
62
  errorRef.name = error.name;
63
63
  }
64
64
  }
65
+ return;
65
66
  }
67
+ setNodeProp(node, keys[0], data[keys[0]]);
66
68
  },
67
69
  inspectorConfig: [
68
70
  {
@@ -34,8 +34,9 @@ export default {
34
34
  });
35
35
  setNodeProp(node, key, value[key]);
36
36
  }
37
-
37
+
38
38
  let message = definitions.rootElements.find(element => element.id === value.messageRef);
39
+
39
40
  if (!message && value.messageRef) {
40
41
  message = moddle.create('bpmn:Message', {
41
42
  id: value.messageRef,
@@ -44,5 +45,16 @@ export default {
44
45
  definitions.rootElements.push(message);
45
46
  }
46
47
  node.definition.get('eventDefinitions')[0].messageRef = message;
48
+
49
+ window.ProcessMaker.EventBus.$emit('multiplayer-updateInspectorProperty', {
50
+ id: node.definition.id,
51
+ key: 'messageRef',
52
+ value: value.messageRef,
53
+ extras: {
54
+ messageName: message?.name,
55
+ allowedUsers: node.definition.get('allowedUsers'),
56
+ allowedGroups: node.definition.get('allowedGroups'),
57
+ },
58
+ });
47
59
  },
48
60
  };
@@ -52,6 +52,9 @@ export default {
52
52
  // Set the condition expression IFF the expresion body changed
53
53
  if (definition[key].body !== value[key]) {
54
54
  const conditionExpression = moddle.create('bpmn:FormalExpression', { body: value[key] });
55
+ window.ProcessMaker.EventBus.$emit('multiplayer-updateInspectorProperty', {
56
+ id: node.definition.id , key, value: [conditionExpression],
57
+ });
55
58
  setNodeProp(node, key, conditionExpression);
56
59
  }
57
60
  } else {
@@ -62,6 +65,18 @@ export default {
62
65
  }
63
66
  }
64
67
  },
68
+ multiplayerInspectorHandler(node, data, setNodeProp, moddle) {
69
+ const keys = Object.keys(data).filter((key) => key !== 'id');
70
+ if (keys.length === 0) {
71
+ return;
72
+ }
73
+ if (keys[0] === 'conditionExpression') {
74
+ const conditionExpression = moddle.create('bpmn:FormalExpression', { body: data[keys[0]][0].body });
75
+ setNodeProp(node, keys[0], conditionExpression);
76
+ return;
77
+ }
78
+ setNodeProp(node, keys[0], data[keys[0]]);
79
+ },
65
80
  inspectorConfig: [
66
81
  {
67
82
  name: 'Sequence Flow',