@processmaker/modeler 1.42.0 → 1.43.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@processmaker/modeler",
3
- "version": "1.42.0",
3
+ "version": "1.43.0",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve --mode development",
6
6
  "test:unit": "vue-cli-service test:unit",
@@ -632,7 +632,7 @@ export default {
632
632
  */
633
633
  getConnectedLinkProperties(links) {
634
634
  let changed = [];
635
- links.forEach((linkView) => {
635
+ links?.forEach((linkView) => {
636
636
  const vertices = linkView.model.component.shape.vertices();
637
637
  if (vertices?.length) {
638
638
  const waypoint = [];
@@ -719,7 +719,7 @@ export default {
719
719
  * Selector will update the waypoints of the related flows
720
720
  */
721
721
  updateFlowsWaypoint(){
722
- this.connectedLinks.forEach((link)=> {
722
+ this.connectedLinks?.forEach((link)=> {
723
723
  if (link.model.component && link.model.get('type') === 'standard.Link'){
724
724
  const start = link.sourceAnchor;
725
725
  const end = link.targetAnchor;
@@ -37,7 +37,7 @@
37
37
  <span />
38
38
  </div>
39
39
  <i v-if="!containsSvg(data.icon)" :class="data.icon" class="fa-lg"/>
40
- <inline-svg :src="data.icon" />
40
+ <inline-svg v-else :src="data.icon" />
41
41
  </a>
42
42
  </popper>
43
43
  <a v-else class="control-submenu-item"
@@ -46,7 +46,7 @@
46
46
  v-b-tooltip.hover.viewport.d50="{ customClass: 'no-pointer-events' }"
47
47
  >
48
48
  <i v-if="!containsSvg(data.icon)" :class="data.icon" class="fa-lg"/>
49
- <inline-svg :src="data.icon" />
49
+ <inline-svg v-else :src="data.icon" />
50
50
  </a>
51
51
  </template>
52
52
 
@@ -101,6 +101,10 @@ export default ({
101
101
  width: 24px;
102
102
  height: 24px;
103
103
  }
104
+ & > i {
105
+ color: #000000;
106
+ padding: 5px;
107
+ }
104
108
  &.active {
105
109
  background-color: #EBEEF2;
106
110
  }
@@ -33,7 +33,14 @@ export default {
33
33
  },
34
34
  computed: {
35
35
  pinnedObjects() {
36
- return nodeTypesStore.getters.getPinnedNodeTypes;
36
+ const pinnedNodeTypes = nodeTypesStore.getters.getPinnedNodeTypes;
37
+
38
+ // Filter pinnedNodeTypes to exclude objects with PM Blocks type.
39
+ const filteredPinnedNodeTypes = pinnedNodeTypes.filter(obj => {
40
+ return !obj.type?.includes('processmaker-pm-block');
41
+ });
42
+
43
+ return filteredPinnedNodeTypes;
37
44
  },
38
45
  objects() {
39
46
  return nodeTypesStore.getters.getNodeTypes;
@@ -1,11 +1,51 @@
1
1
  <script>
2
+ import pinIcon from '@/assets/pin-angle.svg';
3
+ import pinFillIcon from '@/assets/pin-angle-fill.svg';
2
4
  import nodeTypesStore from '@/nodeTypesStore';
3
5
  import clickAndDrop from '@/mixins/clickAndDrop';
6
+ import iconHelper from '@/mixins/iconHelper';
4
7
 
5
8
  export default {
6
9
  name: 'PmBlocksLoop',
7
- mixins: [clickAndDrop],
10
+ mixins: [clickAndDrop, iconHelper],
11
+ data() {
12
+ return {
13
+ pinIcon,
14
+ pinFillIcon,
15
+ showPin: false,
16
+ };
17
+ },
18
+ created() {
19
+ nodeTypesStore.dispatch('getUserPinnedObjects');
20
+ },
21
+ methods: {
22
+ blockAlreadyPinned(object, type) {
23
+ return !!this.pinnedBlocks.find(obj => obj.type === type);
24
+ },
25
+ unPin(object) {
26
+ this.deselect();
27
+ return nodeTypesStore.dispatch('removeUserPinnedObject', object);
28
+ },
29
+ addPin(object) {
30
+ this.deselect();
31
+ return nodeTypesStore.dispatch('addUserPinnedObject', object);
32
+ },
33
+ },
8
34
  computed: {
35
+ pinnedBlocks() {
36
+ const pinnedNodeTypes = nodeTypesStore.getters.getPinnedNodeTypes;
37
+
38
+ //Filter pinnedNodeTypes to only return objects with PM Blocks type.
39
+ const filteredPinnedNodeTypes = pinnedNodeTypes.filter(obj => {
40
+ return obj.type?.includes('processmaker-pm-block');
41
+ });
42
+
43
+ return filteredPinnedNodeTypes;
44
+ },
45
+ unpinnedBlocks() {
46
+ const objects = this.pmBlockNodeTypes;
47
+ return objects.filter((obj) => !this.pinnedBlocks.some(pinnedObj => pinnedObj.type === obj.type));
48
+ },
9
49
  pmBlockNodeTypes() {
10
50
  return nodeTypesStore.getters.getPmBlockNodeTypes;
11
51
  },
@@ -25,30 +65,78 @@ export default {
25
65
  <template v-for="object in filteredPmBlockNodes">
26
66
  <div
27
67
  class="node-types__item"
68
+ :data-test="object.type"
28
69
  :key="object.id"
70
+ @mouseover="showPin = true"
71
+ @mouseleave="showPin = false"
29
72
  @click.stop="onClickHandler($event, object)"
30
73
  >
31
74
  <div class="d-flex">
32
75
  <i v-if="!object.svgIcon" class="node-types__item__icon" :class="object.customIcon"/>
33
76
  <img v-else class="node-types__item__icon" :src="object.svgIcon" :alt="$t(object.label)">
34
77
  <label>{{ $t(object.label) }}</label>
78
+ <img
79
+ v-if="blockAlreadyPinned(object, object.type)"
80
+ :src="pinFillIcon"
81
+ class="pinIcon"
82
+ alt="Unpin Element"
83
+ @click="unPin(object)"
84
+ >
85
+ <img
86
+ v-else
87
+ :src="pinIcon"
88
+ class="pinIcon"
89
+ alt="Pin Element"
90
+ @click="addPin(object)"
91
+ >
35
92
  </div>
36
93
  </div>
37
94
  </template>
38
95
  </div>
39
96
  <template v-if="filteredPmBlockNodes.length === 0 && !searchTerm">
40
- <div class="pmBlocksContainer p-2">
41
- <template v-for="nodeType in pmBlockNodeTypes">
97
+ <div class="pinnedBlocks" v-if="pinnedBlocks.length > 0">
98
+ <p>{{ $t('Pinned PM Blocks') }}</p>
99
+ <template v-for="pinnedBlock in pinnedBlocks">
42
100
  <div
43
- class="pm-block-node-types__item p-2 d-block"
101
+ class="node-types__item"
102
+ :data-test="pinnedBlock.type"
103
+ :key="pinnedBlock.id"
104
+ @mouseover="showPin = true"
105
+ @mouseleave="showPin = false"
106
+ @click.stop="onClickHandler($event, pinnedBlock)"
107
+ >
108
+ <i v-if="!containsSvg(pinnedBlock.icon)" :class="pinnedBlock.customIcon" class="fa-lg"/>
109
+ <img v-else class="node-types__item__icon" :src="pinnedBlock.svgIcon" :alt="$t(pinnedBlock.label)">
110
+ <span>{{ $t(pinnedBlock.label) }}</span>
111
+ <img
112
+ :src="pinFillIcon"
113
+ class="pinIcon"
114
+ alt="Pin/Unpin Element"
115
+ @click="unPin(pinnedBlock)"
116
+ >
117
+ </div>
118
+ </template>
119
+ </div>
120
+ <div class="objectCategory">
121
+ <p>{{ $t('PM Block Category') }}</p>
122
+ <template v-for="nodeType in unpinnedBlocks">
123
+ <div
124
+ class="node-types__item"
125
+ :data-test="nodeType.type"
44
126
  :key="nodeType.id"
127
+ @mouseover="showPin = true"
128
+ @mouseleave="showPin = false"
45
129
  @click.stop="onClickHandler($event, nodeType)"
46
130
  >
47
- <div class="d-flex">
48
- <i v-if="!nodeType.svgIcon" class="node-types__item__icon" :class="nodeType.customIcon"/>
49
- <img v-else class="node-types__item__icon" :src="nodeType.svgIcon" :alt="$t(nodeType.label)">
50
- <label>{{ $t(nodeType.label) }}</label>
51
- </div>
131
+ <i v-if="!containsSvg(nodeType.icon)" :class="nodeType.customIcon" class="fa-lg"/>
132
+ <img v-else class="node-types__item__icon" :src="nodeType.svgIcon" :alt="$t(nodeType.label)">
133
+ <span>{{ $t(nodeType.label) }}</span>
134
+ <img
135
+ :src="pinIcon"
136
+ class="pinIcon"
137
+ alt="Pin/Unpin Element"
138
+ @click="addPin(nodeType)"
139
+ >
52
140
  </div>
53
141
  </template>
54
142
  </div>
@@ -57,6 +145,11 @@ export default {
57
145
  </template>
58
146
 
59
147
  <style lang="scss">
148
+ #pmBlockNodeTypesList {
149
+ .pinnedBlocks {
150
+ margin-bottom: 1rem;
151
+ }
152
+ }
60
153
  .pm-block-node-types {
61
154
  &__item {
62
155
  display: block;
@@ -66,6 +159,9 @@ export default {
66
159
  margin-bottom: 8px;
67
160
  &:hover {
68
161
  background-color: #EBEEF2;
162
+ .pinIcon {
163
+ background-color: #DADDDF;
164
+ }
69
165
  }
70
166
  &__icon {
71
167
  width: 1.5rem;
@@ -81,6 +177,11 @@ export default {
81
177
  font-size: 13px;
82
178
  color:#6C757D;
83
179
  }
180
+ .pinIcon {
181
+ margin-left: auto;
182
+ border-radius: 4px;
183
+ padding: 0.3rem;
184
+ }
84
185
  }
85
186
  }
86
187
  </style>
@@ -86,6 +86,9 @@ export default {
86
86
  tempGhost.src = control.icon;
87
87
  } else {
88
88
  tempGhost.setAttribute('class', control.icon);
89
+ tempGhost.style.fontSize = '42px';
90
+ tempGhost.style.width = '42px';
91
+ tempGhost.style.height = '42px';
89
92
  }
90
93
 
91
94
  document.body.appendChild(tempGhost);