@processmaker/modeler 1.24.3 → 1.25.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/dist/modeler.common.js +11056 -9679
- package/dist/modeler.common.js.map +1 -1
- package/dist/modeler.umd.js +11056 -9679
- package/dist/modeler.umd.js.map +1 -1
- package/dist/modeler.umd.min.js +4 -2
- package/dist/modeler.umd.min.js.map +1 -1
- package/package.json +6 -5
- package/src/.DS_Store +0 -0
- package/src/components/controls/controls.scss +8 -3
- package/src/components/crown/crownConfig/crownConfig.scss +1 -1
- package/src/components/crown/crownConfig/crownConfig.vue +5 -1
- package/src/components/crown/crownMultiselect/crownMultiselect.vue +140 -0
- package/src/components/hotkeys/main.js +62 -0
- package/src/components/hotkeys/zoomInOut.js +29 -0
- package/src/components/inspectors/InspectorPanel.vue +1 -0
- package/src/components/inspectors/inspector.scss +1 -1
- package/src/components/modeler/Modeler.vue +173 -46
- package/src/components/modeler/Selection.vue +705 -0
- package/src/components/modeler/modeler.scss +0 -1
- package/src/components/nodes/boundaryEvent/boundaryEvent.vue +3 -0
- package/src/components/nodes/pool/poolEventHandlers.js +1 -0
- package/src/components/paperManager.js +2 -0
- package/src/components/toolbar/ToolBar.vue +8 -11
- package/src/components/toolbar/toolbar.scss +1 -1
- package/src/mixins/highlightConfig.js +2 -0
- package/src/mixins/linkConfig.js +3 -0
- package/src/store.js +12 -1
- /package/src/components/{modeler → hotkeys}/moveWithArrowKeys.js +0 -0
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@processmaker/modeler",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.25.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"serve": "vue-cli-service serve",
|
|
6
6
|
"open-cypress": "TZ=UTC cypress open",
|
|
7
|
+
"run-cypress": "TZ=UTC cypress run",
|
|
7
8
|
"lint": "vue-cli-service lint --no-fix",
|
|
8
9
|
"build-bundle": "vue-cli-service build --target lib --name modeler ./src/components/nodes/index.js",
|
|
9
10
|
"bundle-analyze": "npm run build-bundle -- --analyze",
|
|
@@ -75,7 +76,7 @@
|
|
|
75
76
|
"@types/jest": "^24.9.1",
|
|
76
77
|
"@vue/babel-preset-app": "^5.0.4",
|
|
77
78
|
"@vue/cli-plugin-babel": "^4.5.9",
|
|
78
|
-
"@vue/cli-plugin-e2e-cypress": "
|
|
79
|
+
"@vue/cli-plugin-e2e-cypress": "5.0.0",
|
|
79
80
|
"@vue/cli-plugin-eslint": "^4.5.9",
|
|
80
81
|
"@vue/cli-plugin-unit-jest": "^4.5.9",
|
|
81
82
|
"@vue/cli-service": "^4.5.9",
|
|
@@ -100,9 +101,9 @@
|
|
|
100
101
|
"nyc": "^14.1.1",
|
|
101
102
|
"sass": "^1.51.0",
|
|
102
103
|
"sass-loader": "^8.0.2",
|
|
103
|
-
"stylelint": "^
|
|
104
|
-
"stylelint-config-recommended-scss": "^
|
|
105
|
-
"stylelint-scss": "
|
|
104
|
+
"stylelint": "^15.2.0",
|
|
105
|
+
"stylelint-config-recommended-scss": "^9.0.1",
|
|
106
|
+
"stylelint-scss": "4.4.0",
|
|
106
107
|
"vue-color": "^2.7.1",
|
|
107
108
|
"vue-jest": "^3.0.5",
|
|
108
109
|
"vue-loader": "latest",
|
package/src/.DS_Store
CHANGED
|
Binary file
|
|
@@ -3,7 +3,7 @@ $controls-column-compressed-max-width: 95px;
|
|
|
3
3
|
$controls-transition: 0.3s;
|
|
4
4
|
|
|
5
5
|
.controls {
|
|
6
|
-
z-index:
|
|
6
|
+
z-index: 2;
|
|
7
7
|
padding-bottom: $toolbar-height;
|
|
8
8
|
|
|
9
9
|
&-column {
|
|
@@ -27,8 +27,13 @@ $controls-transition: 0.3s;
|
|
|
27
27
|
background: #f7f7f7;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
.list-group-item
|
|
31
|
-
|
|
30
|
+
.list-group-item {
|
|
31
|
+
&:focus-visible {
|
|
32
|
+
outline: none;
|
|
33
|
+
}
|
|
34
|
+
&:first-child {
|
|
35
|
+
border-top: 0;
|
|
36
|
+
}
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
.tool {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="crown-config" :style="style" v-if="showCrown" role="menu">
|
|
2
|
+
<div class="crown-config" :style="style" v-if="showCrown && !isMultiselect" role="menu">
|
|
3
3
|
<slot />
|
|
4
4
|
|
|
5
5
|
<association-flow-button
|
|
@@ -168,6 +168,10 @@ export default {
|
|
|
168
168
|
this.$t = this.$t.bind(this);
|
|
169
169
|
},
|
|
170
170
|
computed: {
|
|
171
|
+
isMultiselect() {
|
|
172
|
+
const countSelected = store.getters.highlightedShapes.length;
|
|
173
|
+
return countSelected > 1;
|
|
174
|
+
},
|
|
171
175
|
isFlow() {
|
|
172
176
|
return [
|
|
173
177
|
'processmaker-modeler-sequence-flow',
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="crown-config crown-multiselect"
|
|
4
|
+
:style="style"
|
|
5
|
+
v-if="isMultiSelect"
|
|
6
|
+
role="menu"
|
|
7
|
+
>
|
|
8
|
+
<slot />
|
|
9
|
+
|
|
10
|
+
<button
|
|
11
|
+
v-for="button in buttons"
|
|
12
|
+
:key="button.label"
|
|
13
|
+
:aria-label="button.label"
|
|
14
|
+
class="btn"
|
|
15
|
+
:title="button.label"
|
|
16
|
+
:data-test="button.testId"
|
|
17
|
+
:role="button.role"
|
|
18
|
+
@mousedown.stop.prevent
|
|
19
|
+
@click.stop.prevent="button.action"
|
|
20
|
+
>
|
|
21
|
+
<i :class="`fa fa-${button.icon} text-white`" />
|
|
22
|
+
</button>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
import store from '@/store';
|
|
28
|
+
import runningInCypressTest from '@/runningInCypressTest';
|
|
29
|
+
|
|
30
|
+
export default {
|
|
31
|
+
props: {
|
|
32
|
+
paper: Object,
|
|
33
|
+
},
|
|
34
|
+
data() {
|
|
35
|
+
return {
|
|
36
|
+
runningInCypressTest: runningInCypressTest(),
|
|
37
|
+
showCrown: false,
|
|
38
|
+
savePositionOnPointerupEventSet: false,
|
|
39
|
+
style: null,
|
|
40
|
+
taskDropdownInitiallyOpen: this.paperNotRendered(),
|
|
41
|
+
showReplaceModal: false,
|
|
42
|
+
nodeToReplace: null,
|
|
43
|
+
buttons: [
|
|
44
|
+
{
|
|
45
|
+
label: 'Copy Element',
|
|
46
|
+
icon: 'copy',
|
|
47
|
+
testId: 'copy-button',
|
|
48
|
+
role: 'menuitem',
|
|
49
|
+
action: this.copyElement,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
label: 'Delete Element',
|
|
53
|
+
icon: 'trash-alt',
|
|
54
|
+
testId: 'delete-button',
|
|
55
|
+
role: 'menuitem',
|
|
56
|
+
action: this.deleteElement,
|
|
57
|
+
},
|
|
58
|
+
// add more buttons as necessary
|
|
59
|
+
],
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
created() {
|
|
63
|
+
this.$t = this.$t.bind(this);
|
|
64
|
+
},
|
|
65
|
+
computed: {
|
|
66
|
+
isMultiSelect() {
|
|
67
|
+
const countSelected = store.getters.highlightedShapes.length;
|
|
68
|
+
return countSelected > 1;
|
|
69
|
+
},
|
|
70
|
+
highlightedShapes: () => store.getters.highlightedShapes,
|
|
71
|
+
},
|
|
72
|
+
methods: {
|
|
73
|
+
copyElement() {
|
|
74
|
+
// @todo: Implement copyElement
|
|
75
|
+
this.$emit('copy-nodes');
|
|
76
|
+
},
|
|
77
|
+
deleteElement() {
|
|
78
|
+
this.$emit('remove-nodes');
|
|
79
|
+
},
|
|
80
|
+
paperNotRendered() {
|
|
81
|
+
return !this.isRendering;
|
|
82
|
+
},
|
|
83
|
+
setNodePosition() {
|
|
84
|
+
this.shape.stopListening(
|
|
85
|
+
this.paper,
|
|
86
|
+
'element:pointerup',
|
|
87
|
+
this.setNodePosition
|
|
88
|
+
);
|
|
89
|
+
this.savePositionOnPointerupEventSet = false;
|
|
90
|
+
|
|
91
|
+
if (!store.getters.allowSavingElementPosition) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
this.$emit('save-state');
|
|
96
|
+
},
|
|
97
|
+
paperDoneRendering() {
|
|
98
|
+
if (!this.isRendering) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return new Promise((resolve) => this.paper.once('render:done', resolve));
|
|
103
|
+
},
|
|
104
|
+
setUpCrownConfig() {
|
|
105
|
+
this.paper.on(
|
|
106
|
+
'render:done scale:changed translate:changed',
|
|
107
|
+
this.repositionCrown
|
|
108
|
+
);
|
|
109
|
+
},
|
|
110
|
+
setUpPositionHandling() {},
|
|
111
|
+
},
|
|
112
|
+
async mounted() {
|
|
113
|
+
await this.$nextTick();
|
|
114
|
+
await this.paperDoneRendering();
|
|
115
|
+
this.setUpCrownConfig();
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
</script>
|
|
119
|
+
|
|
120
|
+
<style scoped>
|
|
121
|
+
.crown-multiselect {
|
|
122
|
+
top: -38px;
|
|
123
|
+
left: 50%;
|
|
124
|
+
pointer-events: auto;
|
|
125
|
+
}
|
|
126
|
+
.btn {
|
|
127
|
+
border: none;
|
|
128
|
+
padding: 0;
|
|
129
|
+
margin-top: 0;
|
|
130
|
+
display: flex;
|
|
131
|
+
}
|
|
132
|
+
img {
|
|
133
|
+
margin: 0px 10px;
|
|
134
|
+
height: 15px;
|
|
135
|
+
}
|
|
136
|
+
i {
|
|
137
|
+
margin: 0px 10px;
|
|
138
|
+
font-size: 15px;
|
|
139
|
+
}
|
|
140
|
+
</style>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import ZoomInOut from './zoomInOut';
|
|
2
|
+
import store from '@/store';
|
|
3
|
+
import moveShapeByKeypress from './moveWithArrowKeys';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
mixins: [ZoomInOut],
|
|
7
|
+
mounted() {
|
|
8
|
+
document.addEventListener('keydown', this.keydownListener);
|
|
9
|
+
document.addEventListener('keyup', this.keyupListener);
|
|
10
|
+
},
|
|
11
|
+
methods: {
|
|
12
|
+
handleHotkeys(event, options) {
|
|
13
|
+
// Pass event to all handlers
|
|
14
|
+
this.zoomInOutHandler(event, options);
|
|
15
|
+
},
|
|
16
|
+
keyupListener(event) {
|
|
17
|
+
if (event.code === 'Space') {
|
|
18
|
+
this.isGrabbing = false;
|
|
19
|
+
this.paperManager.removeEventHandler('blank:pointermove');
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
keydownListener(event) {
|
|
23
|
+
// Check if either the Control key (Windows/Linux) or the Meta key (macOS) is pressed
|
|
24
|
+
const isAppleOS = this.isAppleOS();
|
|
25
|
+
const mod = isAppleOS ? event.metaKey : event.ctrlKey;
|
|
26
|
+
let options = { mod, isAppleOS, modeler: this };
|
|
27
|
+
try {
|
|
28
|
+
this.handleHotkeys(event, options);
|
|
29
|
+
} catch (error) {
|
|
30
|
+
// eslint-disable-next-line no-console
|
|
31
|
+
console.error(error);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const focusIsOutsideDiagram = !event.target.toString().toLowerCase().includes('body');
|
|
35
|
+
if (focusIsOutsideDiagram) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (event.code === 'Space') {
|
|
40
|
+
this.isGrabbing = true;
|
|
41
|
+
this.paperManager.addEventHandler('blank:pointermove', (event, x, y) => {
|
|
42
|
+
if (!this.canvasDragPosition) {
|
|
43
|
+
const scale = this.paperManager.scale;
|
|
44
|
+
this.canvasDragPosition = { x: x * scale.sx, y: y * scale.sy };
|
|
45
|
+
}
|
|
46
|
+
if (this.canvasDragPosition) {
|
|
47
|
+
this.paperManager.translate(
|
|
48
|
+
event.offsetX - this.canvasDragPosition.x,
|
|
49
|
+
event.offsetY - this.canvasDragPosition.y
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
moveShapeByKeypress(
|
|
56
|
+
event.key,
|
|
57
|
+
store.getters.highlightedShapes,
|
|
58
|
+
this.pushToUndoStack,
|
|
59
|
+
);
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
methods: {
|
|
3
|
+
zoomInOutHandler(event, options) {
|
|
4
|
+
const isPlus =
|
|
5
|
+
(event.key === '+' || event.key === 'NumpadAdd')
|
|
6
|
+
|| (event.keyCode === 107 || event.keyCode === 187);
|
|
7
|
+
|
|
8
|
+
const isMinus =
|
|
9
|
+
(event.key === '-' || event.key === 'NumpadSubtract')
|
|
10
|
+
|| (event.keyCode === 109 || event.keyCode === 189);
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
if (isPlus && options.mod) {
|
|
14
|
+
this.zoomIn(event);
|
|
15
|
+
}
|
|
16
|
+
if (isMinus && options.mod) {
|
|
17
|
+
this.zoomOut(event);
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
zoomIn(event) {
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
this.canvasScale = this.paperManager.scale.sx + this.scaleStep;
|
|
23
|
+
},
|
|
24
|
+
zoomOut(event) {
|
|
25
|
+
event.preventDefault();
|
|
26
|
+
this.canvasScale = Math.max(this.minimumScale, this.paperManager.scale.sx -= this.scaleStep);
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -212,6 +212,7 @@ export default {
|
|
|
212
212
|
return this.defaultInspectorHandler(omit(value, ['artifacts', 'flowElements', 'laneSets']));
|
|
213
213
|
},
|
|
214
214
|
setNodeProp(node, key, value) {
|
|
215
|
+
this.$emit('shape-resize');
|
|
215
216
|
store.commit('updateNodeProp', { node, key, value });
|
|
216
217
|
},
|
|
217
218
|
defaultInspectorHandler(value) {
|