@processmaker/modeler 1.25.0 → 1.27.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.
@@ -85,23 +85,63 @@
85
85
  <font-awesome-icon :icon="miniMapOpen ? minusIcon : mapIcon" />
86
86
  </b-button>
87
87
  </div>
88
-
89
- <b-button
90
- class="btn btn-sm btn-secondary mini-map-btn ml-auto"
91
- data-test="mini-map-btn"
92
- @click="$emit('saveBpmn')"
93
- v-b-tooltip.hover
94
- :title="$t('Save')"
95
- >
96
- <font-awesome-icon :icon="saveIcon" />
97
- </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 autosave-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 autosave-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
+ :actions="ellipsisMenuActions"
121
+ :divider="false"
122
+ @navigate="onNavigate"
123
+ @show="onShow"
124
+ @hide="onHide"
125
+ />
126
+ </template>
127
+ <b-button
128
+ v-else
129
+ class="btn btn-sm btn-secondary mini-map-btn mx-1"
130
+ data-test="mini-map-btn"
131
+ v-b-tooltip.hover
132
+ :title="$t('Save')"
133
+ @click="$emit('saveBpmn')"
134
+ >
135
+ <font-awesome-icon :icon="saveIcon" />
136
+ </b-button>
137
+ </div>
98
138
  </div>
99
139
  </div>
100
140
  </b-row>
101
141
  </template>
102
142
  <script>
103
143
  import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
104
- import { faCompress, faExpand, faMapMarked, faMinus, faPlus, faRedo, faSave, faUndo } from '@fortawesome/free-solid-svg-icons';
144
+ import { faCompress, faExpand, faMapMarked, faMinus, faPlus, faRedo, faUndo, faSave, faCheckCircle, faSpinner } from '@fortawesome/free-solid-svg-icons';
105
145
  import undoRedoStore from '@/undoRedoStore';
106
146
  import Breadcrumb from '@/components/toolbar/breadcrumb/Breadcrumb';
107
147
  import AlignButtons from '@/components/toolbar/alignButtons/AlignButtons';
@@ -143,6 +183,26 @@ export default {
143
183
  canRedo() {
144
184
  return undoRedoStore.getters.canRedo;
145
185
  },
186
+ saved() {
187
+ return undoRedoStore.getters.saved;
188
+ },
189
+ versionStatus() {
190
+ const status = undoRedoStore.getters.isDraft ? 'Draft' : 'Published';
191
+ return this.$t(status);
192
+ },
193
+ isVersionsInstalled() {
194
+ return undoRedoStore.getters.isVersionsInstalled;
195
+ },
196
+ isLoading() {
197
+ return undoRedoStore.getters.isLoading;
198
+ },
199
+ loadingStatus() {
200
+ const status = this.isLoading ? 'Saving' : 'Saved';
201
+ return this.$t(status);
202
+ },
203
+ loadingIcon() {
204
+ return this.isLoading ? this.spinner : this.savedIcon;
205
+ },
146
206
  },
147
207
  data() {
148
208
  return {
@@ -159,6 +219,15 @@ export default {
159
219
  undoIcon: faUndo,
160
220
  redoIcon: faRedo,
161
221
  saveIcon: faSave,
222
+ savedIcon: faCheckCircle,
223
+ spinner: faSpinner,
224
+ ellipsisMenuActions: [
225
+ {
226
+ value: 'discard-draft',
227
+ content: this.$t('Discard Draft'),
228
+ icon: '',
229
+ },
230
+ ],
162
231
  };
163
232
  },
164
233
  methods: {
@@ -182,6 +251,27 @@ export default {
182
251
  .then(() => this.$emit('load-xml'))
183
252
  .then(() => window.ProcessMaker.EventBus.$emit('modeler-change'));
184
253
  },
254
+ onNavigate(action) {
255
+ switch (action.value) {
256
+ case 'discard-draft':
257
+ window.ProcessMaker.EventBus.$emit('open-versions-discard-modal');
258
+ break;
259
+ default:
260
+ break;
261
+ }
262
+ },
263
+ onShow() {
264
+ const inspectorDiv = document.getElementById('inspector');
265
+ if (inspectorDiv) {
266
+ inspectorDiv.style.zIndex = '1';
267
+ }
268
+ },
269
+ onHide() {
270
+ const inspectorDiv = document.getElementById('inspector');
271
+ if (inspectorDiv) {
272
+ inspectorDiv.style.zIndex = '2';
273
+ }
274
+ },
185
275
  },
186
276
  };
187
277
  </script>
@@ -19,3 +19,10 @@ export default {
19
19
  },
20
20
  };
21
21
  </script>
22
+ <style lang="css" scoped>
23
+ @media screen and (max-width: 1365px) {
24
+ #breadcrumbs {
25
+ width: 290px;
26
+ }
27
+ }
28
+ </style>
@@ -1,4 +1,4 @@
1
- $toolbar-background-color: #FFF;
1
+ $toolbar-background-color: #fff;
2
2
 
3
3
  .toolbar {
4
4
  z-index: 2;
@@ -11,3 +11,30 @@ $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
+ }
30
+
31
+ .autosave-btn {
32
+ display: flex;
33
+ justify-content: center;
34
+ align-items: center;
35
+ }
36
+
37
+ .btn-ellipsis {
38
+ border-top-left-radius: 4px !important;
39
+ border-bottom-left-radius: 4px !important;
40
+ }
package/src/store.js CHANGED
@@ -35,6 +35,9 @@ export default new Vuex.Store({
35
35
  autoValidate: false,
36
36
  globalProcesses: [],
37
37
  allowSavingElementPosition: true,
38
+ copiedElements: [],
39
+ clientX: null,
40
+ clientY: null,
38
41
  },
39
42
  getters: {
40
43
  nodes: state => state.nodes,
@@ -52,6 +55,9 @@ export default new Vuex.Store({
52
55
  globalProcesses: state => state.globalProcesses,
53
56
  globalProcessEvents: (state, getters) => flatten(getters.globalProcesses.map(process => process.events)),
54
57
  allowSavingElementPosition: state => state.allowSavingElementPosition,
58
+ copiedElements: state => state.copiedElements,
59
+ clientX: state => state.clientX,
60
+ clientY: state => state.clientY,
55
61
  },
56
62
  mutations: {
57
63
  preventSavingElementPosition(state) {
@@ -138,6 +144,18 @@ export default new Vuex.Store({
138
144
  setGlobalProcesses(state, globalProcesses) {
139
145
  state.globalProcesses = globalProcesses;
140
146
  },
147
+ // Copy Nodes to the clipboard or in this case, to the state
148
+ setCopiedElements(state, elements) {
149
+ state.copiedElements = elements;
150
+ },
151
+ setClientMousePosition(state, position) {
152
+ const { clientX, clientY } = position;
153
+ state = { clientX, clientY };
154
+ },
155
+ clientLeftPaper(state) {
156
+ state.clientX = null;
157
+ state.clientY = null;
158
+ },
141
159
  },
142
160
  actions: {
143
161
  async fetchGlobalProcesses({ commit }) {
@@ -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
  });