@processmaker/modeler 1.39.3 → 1.39.5

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.3",
3
+ "version": "1.39.5",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "test:unit": "vue-cli-service test:unit",
@@ -2,6 +2,7 @@
2
2
  <span data-test="body-container">
3
3
  <tool-bar
4
4
  v-if="showComponent"
5
+ ref="tool-bar"
5
6
  :canvas-drag-position="canvasDragPosition"
6
7
  :cursor="cursor"
7
8
  :is-rendering="isRendering"
@@ -12,6 +13,7 @@
12
13
  :warnings="allWarnings"
13
14
  :xml-manager="xmlManager"
14
15
  :validationBar="validationBar"
16
+ :extra-actions="extraActions"
15
17
  @load-xml="loadXML"
16
18
  @toggle-panels-compressed="panelsCompressed = !panelsCompressed"
17
19
  @toggle-mini-map-open="miniMapOpen = $event"
@@ -21,6 +23,7 @@
21
23
  @close="close"
22
24
  @save-state="pushToUndoStack"
23
25
  @clearSelection="clearSelection"
26
+ @action="handleToolbarAction"
24
27
  />
25
28
  <b-row class="modeler h-100">
26
29
  <b-tooltip
@@ -242,6 +245,7 @@ export default {
242
245
  mixins: [hotkeys, cloneSelection],
243
246
  data() {
244
247
  return {
248
+ extraActions: [],
245
249
  pasteInProgress: false,
246
250
  cloneInProgress: false,
247
251
  internalClipboard: [],
@@ -354,6 +358,11 @@ export default {
354
358
  showComponent: () => store.getters.showComponent,
355
359
  },
356
360
  methods: {
361
+ handleToolbarAction(action) {
362
+ if (action.handler instanceof Function) {
363
+ action.handler(this);
364
+ }
365
+ },
357
366
  handleToggleInspector(value) {
358
367
  this.isOpenInspector = value;
359
368
  },
@@ -689,6 +698,15 @@ export default {
689
698
  });
690
699
  nodeTypesStore.commit('setPmBlockNodeTypes', this.pmBlockNodes);
691
700
  },
701
+ registerMenuAction(action) {
702
+ if (!action.value || typeof action.value !== 'string') {
703
+ throw new Error('Menu action must have a action.value');
704
+ }
705
+ if (!action.content || typeof action.content !== 'string') {
706
+ throw new Error('Menu action must have a action.content');
707
+ }
708
+ this.extraActions.push(action);
709
+ },
692
710
  addMessageFlows() {
693
711
  if (this.collaboration) {
694
712
  this.collaboration
@@ -1330,6 +1348,9 @@ export default {
1330
1348
  this.registerNode(Process);
1331
1349
  /* Initialize the BpmnModdle and its extensions */
1332
1350
  window.ProcessMaker.EventBus.$emit('modeler-init', {
1351
+ $t: this.$t,
1352
+ modeler: this,
1353
+ registerMenuAction: this.registerMenuAction,
1333
1354
  registerInspectorExtension,
1334
1355
  registerBpmnExtension: this.registerBpmnExtension,
1335
1356
  registerNode: this.registerNode,
@@ -1464,6 +1485,9 @@ export default {
1464
1485
 
1465
1486
  /* Register custom nodes */
1466
1487
  window.ProcessMaker.EventBus.$emit('modeler-start', {
1488
+ $t: this.$t,
1489
+ modeler: this,
1490
+ registerMenuAction: this.registerMenuAction,
1467
1491
  loadXML: async(xml) => {
1468
1492
  await this.loadXML(xml);
1469
1493
  await undoRedoStore.dispatch('pushState', xml);
@@ -20,6 +20,7 @@ import { shapes } from 'jointjs';
20
20
  import linkConfig from '@/mixins/linkConfig';
21
21
  import get from 'lodash/get';
22
22
  import { namePosition } from './sequenceFlowConfig';
23
+ import highlightConfig from '@/mixins/highlightConfig';
23
24
  import CrownConfig from '@/components/crown/crownConfig/crownConfig';
24
25
  import SequenceFlow from '@/components/nodes/genericFlow/SequenceFlow';
25
26
 
@@ -40,7 +41,7 @@ export default {
40
41
  'planeElements',
41
42
  'isRendering',
42
43
  ],
43
- mixins: [linkConfig],
44
+ mixins: [highlightConfig, linkConfig],
44
45
  data() {
45
46
  return {
46
47
  shape: null,
@@ -56,7 +56,7 @@
56
56
  {{ $t('Close') }}
57
57
  </a>
58
58
  <EllipsisMenu
59
- :actions="ellipsisMenuActions"
59
+ :actions="combinedMenuActions"
60
60
  :divider="false"
61
61
  @navigate="onNavigate"
62
62
  @show="onShow"
@@ -129,6 +129,7 @@ export default {
129
129
  'warnings',
130
130
  'xmlManager',
131
131
  'validationBar',
132
+ 'extraActions',
132
133
  ],
133
134
  watch: {
134
135
  miniMapOpen(isOpen) {
@@ -146,6 +147,9 @@ export default {
146
147
  },
147
148
  },
148
149
  computed: {
150
+ combinedMenuActions() {
151
+ return this.extraActions ? this.ellipsisMenuActions.concat(this.extraActions) : this.ellipsisMenuActions;
152
+ },
149
153
  canUndo() {
150
154
  return undoRedoStore.getters.canUndo;
151
155
  },
@@ -237,7 +241,7 @@ export default {
237
241
  this.$emit('publishPmBlock');
238
242
  break;
239
243
  default:
240
- break;
244
+ this.$emit('action', action);
241
245
  }
242
246
  },
243
247
  onShow() {
@@ -113,7 +113,7 @@ export default {
113
113
  return this.shape.findView(this.paperManager.paper);
114
114
  },
115
115
  shapeBody() {
116
- return this.shapeView.$el.find('[joint-selector=body]');
116
+ return this.shapeView.$el.find('[joint-selector=body]') || this.shapeView.$el;
117
117
  },
118
118
  },
119
119
  methods: {