@processmaker/modeler 1.24.4 → 1.26.0

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.
@@ -143,6 +143,7 @@ export default {
143
143
  resetToInitialPosition() {
144
144
  this.shape.position(this.validPosition.x, this.validPosition.y);
145
145
  store.commit('allowSavingElementPosition');
146
+ this.$emit('shape-resize');
146
147
  },
147
148
  moveBoundaryEventIfOverTask() {
148
149
  const task = this.getTaskUnderShape();
@@ -154,11 +155,13 @@ export default {
154
155
 
155
156
  this.attachBoundaryEventToTask(task);
156
157
  this.updateShapePosition(task);
158
+ this.$emit('shape-resize');
157
159
  },
158
160
  resetInvalidTarget() {
159
161
  if (this.invalidTargetElement) {
160
162
  resetShapeColor(this.invalidTargetElement);
161
163
  this.invalidTargetElement = null;
164
+ this.$emit('shape-resize');
162
165
  }
163
166
  },
164
167
  attachToValidTarget(cellView) {
@@ -25,6 +25,7 @@ export default class PoolEventHandlers {
25
25
 
26
26
  onPointerDown(cellView) {
27
27
  if (this.isNotPoolChild(cellView.model)) {
28
+ this.component.$emit('select-pool');
28
29
  return;
29
30
  }
30
31
 
@@ -21,6 +21,8 @@ export default class PaperManager {
21
21
  sorting: 'sorting-approximate',
22
22
  gridSize: PaperManager.gridSize,
23
23
  drawGrid: true,
24
+ snapLinks: false, // disable snapping of links
25
+ snapElements: false, // disable snapping of elements
24
26
  clickThreshold: 10,
25
27
  perpendicularLinks: true,
26
28
  interactive: interactiveFunc,
@@ -34,7 +34,7 @@
34
34
  <div class="btn-group btn-group-sm mr-2" role="group" aria-label="Zoom controls">
35
35
  <b-button
36
36
  class="btn btn-sm btn-secondary"
37
- @click="scale += scaleStep"
37
+ @click="paperManager.scale = paperManager.scale.sx + scaleStep"
38
38
  data-test="zoom-in"
39
39
  v-b-tooltip.hover
40
40
  :title="$t('Zoom In')"
@@ -43,7 +43,7 @@
43
43
  </b-button>
44
44
  <b-button
45
45
  class="btn btn-sm btn-secondary"
46
- @click="scale = Math.max(minimumScale, scale -= scaleStep)"
46
+ @click="paperManager.scale = Math.max(minimumScale, paperManager.scale.sx -= scaleStep)"
47
47
  data-test="zoom-out"
48
48
  v-b-tooltip.hover
49
49
  :title="$t('Zoom Out')"
@@ -51,16 +51,17 @@
51
51
  <font-awesome-icon :icon="minusIcon" />
52
52
  </b-button>
53
53
  <b-button
54
+ v-if="paperManager"
54
55
  class="btn btn-sm btn-secondary"
55
- @click="scale = initialScale"
56
- :disabled="scale === initialScale"
56
+ @click="paperManager.scale = initialScale"
57
+ :disabled="paperManager.scale.sx === initialScale"
57
58
  data-test="zoom-reset"
58
59
  v-b-tooltip.hover
59
60
  :title="$t('Reset to initial scale')"
60
61
  >
61
62
  {{ $t('Reset') }}
62
63
  </b-button>
63
- <span class="btn btn-sm btn-secondary scale-value">{{ Math.round(scale*100) }}%</span>
64
+ <span v-if="paperManager" class="btn btn-sm btn-secondary scale-value">{{ Math.round(paperManager.scale.sx*100) }}%</span>
64
65
  </div>
65
66
 
66
67
  <div class="btn-group btn-group-sm mr-2" role="group" aria-label="Additional controls">
@@ -84,23 +85,61 @@
84
85
  <font-awesome-icon :icon="miniMapOpen ? minusIcon : mapIcon" />
85
86
  </b-button>
86
87
  </div>
87
-
88
- <b-button
89
- class="btn btn-sm btn-secondary mini-map-btn ml-auto"
90
- data-test="mini-map-btn"
91
- @click="$emit('saveBpmn')"
92
- v-b-tooltip.hover
93
- :title="$t('Save')"
94
- >
95
- <font-awesome-icon :icon="saveIcon" />
96
- </b-button>
88
+ <div class="btn-group btn-group-sm" role="group" aria-label="Publish controls">
89
+ <template v-if="isVersionsInstalled">
90
+ <div class="d-flex justify-content-center align-items-center text-black text-capitalize" :style="{ width: '65px' }">
91
+ <span class="toolbar-item mr-1" :style="{ fontWeight: 600 }">
92
+ {{ versionStatus }}
93
+ </span>
94
+ </div>
95
+ <div class="d-flex justify-content-center align-items-center text-black text-capitalize mx-2" :style="{ width: '60px' }">
96
+ <span class="toolbar-item mr-1" :style="{ fontWeight: 400 }">
97
+ {{ loadingStatus }}
98
+ </span>
99
+ <span>
100
+ <font-awesome-icon class="text-success" :icon="loadingIcon" :spin="isLoading" />
101
+ </span>
102
+ </div>
103
+ <a
104
+ class="btn btn-sm btn-primary mini-map-btn text-uppercase mx-2"
105
+ data-test="publish-btn"
106
+ :title="$t('Publish')"
107
+ @click="$emit('saveBpmn')"
108
+ >
109
+ {{ $t('Publish') }}
110
+ </a>
111
+ <a
112
+ class="btn btn-sm btn-link toolbar-item mini-map-btn text-black text-uppercase"
113
+ data-test="close-btn"
114
+ :title="$t('Close')"
115
+ @click="$emit('close')"
116
+ >
117
+ {{ $t('Close') }}
118
+ </a>
119
+ <EllipsisMenu
120
+ @navigate="onNavigate"
121
+ :actions="ellipsisMenuActions"
122
+ :divider="false"
123
+ />
124
+ </template>
125
+ <b-button
126
+ v-else
127
+ class="btn btn-sm btn-secondary mini-map-btn mx-1"
128
+ data-test="mini-map-btn"
129
+ v-b-tooltip.hover
130
+ :title="$t('Save')"
131
+ @click="$emit('saveBpmn')"
132
+ >
133
+ <font-awesome-icon :icon="saveIcon" />
134
+ </b-button>
135
+ </div>
97
136
  </div>
98
137
  </div>
99
138
  </b-row>
100
139
  </template>
101
140
  <script>
102
141
  import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
103
- import { faCompress, faExpand, faMapMarked, faMinus, faPlus, faRedo, faSave, faUndo } from '@fortawesome/free-solid-svg-icons';
142
+ import { faCompress, faExpand, faMapMarked, faMinus, faPlus, faRedo, faUndo, faSave, faCheckCircle, faSpinner } from '@fortawesome/free-solid-svg-icons';
104
143
  import undoRedoStore from '@/undoRedoStore';
105
144
  import Breadcrumb from '@/components/toolbar/breadcrumb/Breadcrumb';
106
145
  import AlignButtons from '@/components/toolbar/alignButtons/AlignButtons';
@@ -121,12 +160,6 @@ export default {
121
160
  panelsCompressed: Boolean,
122
161
  },
123
162
  watch: {
124
- scale(scale) {
125
- this.paperManager.scale = scale;
126
- if (scale === this.initialScale) {
127
- this.$root.$emit('bv::hide::tooltip');
128
- }
129
- },
130
163
  miniMapOpen(isOpen) {
131
164
  this.$emit('toggle-mini-map-open', isOpen);
132
165
  },
@@ -148,6 +181,26 @@ export default {
148
181
  canRedo() {
149
182
  return undoRedoStore.getters.canRedo;
150
183
  },
184
+ saved() {
185
+ return undoRedoStore.getters.saved;
186
+ },
187
+ versionStatus() {
188
+ const status = undoRedoStore.getters.isDraft ? 'Draft' : 'Published';
189
+ return this.$t(status);
190
+ },
191
+ isVersionsInstalled() {
192
+ return undoRedoStore.getters.isVersionsInstalled;
193
+ },
194
+ isLoading() {
195
+ return undoRedoStore.getters.isLoading;
196
+ },
197
+ loadingStatus() {
198
+ const status = this.isLoading ? 'Saving' : 'Saved';
199
+ return this.$t(status);
200
+ },
201
+ loadingIcon() {
202
+ return this.isLoading ? this.spinner : this.savedIcon;
203
+ },
151
204
  },
152
205
  data() {
153
206
  return {
@@ -164,10 +217,20 @@ export default {
164
217
  undoIcon: faUndo,
165
218
  redoIcon: faRedo,
166
219
  saveIcon: faSave,
220
+ savedIcon: faCheckCircle,
221
+ spinner: faSpinner,
222
+ ellipsisMenuActions: [
223
+ {
224
+ value: 'discard-draft',
225
+ content: this.$t('Discard Draft'),
226
+ icon: '',
227
+ },
228
+ ],
167
229
  };
168
230
  },
169
231
  methods: {
170
232
  undo() {
233
+ this.$emit('clearSelection');
171
234
  if (this.isRendering) {
172
235
  return;
173
236
  }
@@ -177,6 +240,7 @@ export default {
177
240
  .then(() => window.ProcessMaker.EventBus.$emit('modeler-change'));
178
241
  },
179
242
  redo() {
243
+ this.$emit('clearSelection');
180
244
  if (this.isRendering) {
181
245
  return;
182
246
  }
@@ -185,6 +249,15 @@ export default {
185
249
  .then(() => this.$emit('load-xml'))
186
250
  .then(() => window.ProcessMaker.EventBus.$emit('modeler-change'));
187
251
  },
252
+ onNavigate(action) {
253
+ switch (action.value) {
254
+ case 'discard-draft':
255
+ window.ProcessMaker.EventBus.$emit('open-versions-discard-modal');
256
+ break;
257
+ default:
258
+ break;
259
+ }
260
+ },
188
261
  },
189
262
  };
190
263
  </script>
@@ -1,7 +1,7 @@
1
- $toolbar-background-color: #FFF;
1
+ $toolbar-background-color: #fff;
2
2
 
3
3
  .toolbar {
4
- z-index: 1;
4
+ z-index: 2;
5
5
  height: $toolbar-height;
6
6
  cursor: auto;
7
7
  width: 100%;
@@ -11,3 +11,19 @@ $toolbar-background-color: #FFF;
11
11
  cursor: pointer;
12
12
  }
13
13
  }
14
+
15
+ .toolbar-item {
16
+ font-family: "Open Sans";
17
+ font-style: normal;
18
+ font-size: 14px;
19
+ letter-spacing: -0.02em;
20
+ line-height: 21px;
21
+ }
22
+
23
+ .text-black {
24
+ color: #000000 !important;
25
+ }
26
+
27
+ .cursor-default {
28
+ cursor: default !important;
29
+ }
@@ -21,6 +21,7 @@ const defaultHighlighter = {
21
21
  attrs: {
22
22
  stroke: '#5096db',
23
23
  'stroke-width': 3,
24
+ 'data-cy': 'selected',
24
25
  },
25
26
  },
26
27
  },
@@ -96,6 +97,7 @@ export default {
96
97
  this.setShapeHighlight();
97
98
  this.shape.on('change:size', () => {
98
99
  this.paperManager.awaitScheduledUpdates().then(this.setShapeHighlight);
100
+ this.$emit('shape-resize', this.shape);
99
101
  });
100
102
  });
101
103
  });
@@ -302,6 +302,9 @@ export default {
302
302
  }
303
303
 
304
304
  this.updateRouter();
305
+ this.shape.on('change:vertices', function() {
306
+ this.component.$emit('shape-resize');
307
+ });
305
308
  },
306
309
  beforeDestroy() {
307
310
  document.removeEventListener('mouseup', this.emitSave);
package/src/store.js CHANGED
@@ -94,7 +94,18 @@ export default new Vuex.Store({
94
94
  state.highlightedNodes = node ? [node] : [];
95
95
  },
96
96
  addToHighlightedNodes(state, nodes) {
97
- state.highlightedNodes = uniq([...state.highlightedNodes, ...nodes]);
97
+ const highlightedNodes = uniq([...state.highlightedNodes, ...nodes]);
98
+ const selectedPoolsIds = highlightedNodes
99
+ .filter(node => node.type === 'processmaker-modeler-pool')
100
+ .map(node => node.id);
101
+ state.highlightedNodes = highlightedNodes
102
+ // remove from selection the selected child nodes in the pool
103
+ .filter(node => {
104
+ if (node.pool && node.pool.component.node.id) {
105
+ return !selectedPoolsIds.includes(node.pool.component.node.id);
106
+ }
107
+ return true;
108
+ });
98
109
  },
99
110
  addNode(state, node) {
100
111
  /* Add an unchanging ID that Vue can use to track the component
@@ -8,6 +8,10 @@ export default new Vuex.Store({
8
8
  stack: [],
9
9
  position: null,
10
10
  disabled: false,
11
+ saved: false,
12
+ isVersionsInstalled: false,
13
+ isDraft: false,
14
+ isLoading: false,
11
15
  },
12
16
  getters: {
13
17
  canUndo(state) {
@@ -19,6 +23,18 @@ export default new Vuex.Store({
19
23
  currentState(state) {
20
24
  return state.stack[state.position];
21
25
  },
26
+ saved(state) {
27
+ return state.saved;
28
+ },
29
+ isVersionsInstalled(state) {
30
+ return state.isVersionsInstalled;
31
+ },
32
+ isDraft(state) {
33
+ return state.isDraft;
34
+ },
35
+ isLoading(state) {
36
+ return state.isLoading;
37
+ },
22
38
  },
23
39
  mutations: {
24
40
  setPosition(state, position) {
@@ -37,6 +53,18 @@ export default new Vuex.Store({
37
53
  enableSavingState(state) {
38
54
  state.disabled = false;
39
55
  },
56
+ savedState(state, payload) {
57
+ state.saved = payload;
58
+ },
59
+ isVersionsInstalled(state, payload) {
60
+ state.isVersionsInstalled = payload;
61
+ },
62
+ isDraft(state, payload) {
63
+ state.isDraft = payload;
64
+ },
65
+ isLoading(state, payload) {
66
+ state.isLoading = payload;
67
+ },
40
68
  },
41
69
  actions: {
42
70
  pushState({ state, getters, commit }, newState) {
@@ -61,5 +89,22 @@ export default new Vuex.Store({
61
89
 
62
90
  commit('setPosition', state.position + 1);
63
91
  },
92
+ saved({ commit }) {
93
+ commit('savedState', true);
94
+
95
+ // Automatically remove the notification after 2 seconds.
96
+ setTimeout(() => {
97
+ commit('savedState', false);
98
+ }, 2000);
99
+ },
100
+ enableVersions({ commit }) {
101
+ commit('isVersionsInstalled', true);
102
+ },
103
+ setVersionIndicator({ commit }, newState) {
104
+ commit('isDraft', newState);
105
+ },
106
+ setLoadingState({ commit }, newState) {
107
+ commit('isLoading', newState);
108
+ },
64
109
  },
65
110
  });