@web-utils/component 2.9.8 → 2.9.9
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/flow-viewer/index.mjs +133 -90
- package/flow-viewer/style.css +1 -1
- package/package.json +1 -1
- package/web-types.json +9 -1
package/flow-viewer/index.mjs
CHANGED
|
@@ -1,56 +1,61 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var u = (
|
|
6
|
-
for (var
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var
|
|
10
|
-
V.call(
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
var
|
|
14
|
-
var
|
|
1
|
+
var k = Object.defineProperty, b = Object.defineProperties;
|
|
2
|
+
var M = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var f = Object.getOwnPropertySymbols;
|
|
4
|
+
var x = Object.prototype.hasOwnProperty, V = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var u = (t, i, e) => i in t ? k(t, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[i] = e, w = (t, i) => {
|
|
6
|
+
for (var e in i || (i = {}))
|
|
7
|
+
x.call(i, e) && u(t, e, i[e]);
|
|
8
|
+
if (f)
|
|
9
|
+
for (var e of f(i))
|
|
10
|
+
V.call(i, e) && u(t, e, i[e]);
|
|
11
|
+
return t;
|
|
12
|
+
}, y = (t, i) => b(t, M(i));
|
|
13
|
+
var v = (t, i, e) => new Promise((s, n) => {
|
|
14
|
+
var r = (o) => {
|
|
15
15
|
try {
|
|
16
|
-
a(
|
|
17
|
-
} catch (
|
|
18
|
-
|
|
16
|
+
a(e.next(o));
|
|
17
|
+
} catch (h) {
|
|
18
|
+
n(h);
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, l = (o) => {
|
|
21
21
|
try {
|
|
22
|
-
a(
|
|
23
|
-
} catch (
|
|
24
|
-
|
|
22
|
+
a(e.throw(o));
|
|
23
|
+
} catch (h) {
|
|
24
|
+
n(h);
|
|
25
25
|
}
|
|
26
|
-
}, a = (
|
|
27
|
-
a((
|
|
26
|
+
}, a = (o) => o.done ? s(o.value) : Promise.resolve(o.value).then(r, l);
|
|
27
|
+
a((e = e.apply(t, i)).next());
|
|
28
28
|
});
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
29
|
+
import E from "bpmn-js/lib/NavigatedViewer";
|
|
30
|
+
import d from "diagram-js/lib/navigation/zoomscroll/ZoomScroll";
|
|
31
|
+
import { create as c, attr as m, append as p } from "tiny-svg";
|
|
32
|
+
import { query as S } from "min-dom";
|
|
33
|
+
import $ from "@web-utils/component/easy-popup";
|
|
32
34
|
import "@web-utils/component/easy-popup/style.css";
|
|
33
|
-
import { n as
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
return
|
|
35
|
+
import { n as F } from "../chunks/vueComponentNormalizer.446f5dc4.mjs";
|
|
36
|
+
var B = function() {
|
|
37
|
+
var t = this, i = t.$createElement, e = t._self._c || i;
|
|
38
|
+
return e("div", {
|
|
37
39
|
ref: "container",
|
|
38
|
-
staticClass: "flow-viewer flow-background-image"
|
|
39
|
-
|
|
40
|
+
staticClass: "flow-viewer flow-background-image",
|
|
41
|
+
style: {
|
|
42
|
+
"--highlight-color": t.highlightColor
|
|
43
|
+
}
|
|
44
|
+
}, [e("EasyPopup", {
|
|
40
45
|
ref: "popup"
|
|
41
|
-
}, [
|
|
42
|
-
return [
|
|
46
|
+
}, [t._t("default", function() {
|
|
47
|
+
return [t._v(" " + t._s(t.element) + " ")];
|
|
43
48
|
}, {
|
|
44
|
-
element:
|
|
49
|
+
element: t.element
|
|
45
50
|
})], 2)], 1);
|
|
46
|
-
},
|
|
47
|
-
const
|
|
51
|
+
}, W = [];
|
|
52
|
+
const g = d.prototype._handleWheel, X = {
|
|
48
53
|
__init__: ["zoomScroll"],
|
|
49
|
-
zoomScroll: ["type",
|
|
50
|
-
},
|
|
54
|
+
zoomScroll: ["type", d]
|
|
55
|
+
}, C = {
|
|
51
56
|
name: "FlowViewer",
|
|
52
57
|
components: {
|
|
53
|
-
EasyPopup:
|
|
58
|
+
EasyPopup: $
|
|
54
59
|
},
|
|
55
60
|
props: {
|
|
56
61
|
xml: {
|
|
@@ -68,6 +73,10 @@ const p = s.prototype._handleWheel, k = {
|
|
|
68
73
|
type: Array,
|
|
69
74
|
default: () => []
|
|
70
75
|
},
|
|
76
|
+
highlightColor: {
|
|
77
|
+
type: String,
|
|
78
|
+
default: "rgb(0 190 0 / 100%)"
|
|
79
|
+
},
|
|
71
80
|
ctrlKey: Boolean
|
|
72
81
|
},
|
|
73
82
|
data() {
|
|
@@ -76,77 +85,111 @@ const p = s.prototype._handleWheel, k = {
|
|
|
76
85
|
};
|
|
77
86
|
},
|
|
78
87
|
watch: {
|
|
79
|
-
xml(
|
|
80
|
-
var
|
|
81
|
-
(
|
|
82
|
-
}
|
|
83
|
-
activities: "highlightActivity",
|
|
84
|
-
flows: "highlightFlow"
|
|
88
|
+
xml(t) {
|
|
89
|
+
var i;
|
|
90
|
+
(i = this.bpmnViewer) == null || i.importXML(t);
|
|
91
|
+
}
|
|
85
92
|
},
|
|
86
93
|
mounted() {
|
|
87
|
-
|
|
88
|
-
const { target:
|
|
89
|
-
|
|
90
|
-
target:
|
|
91
|
-
deltaMode:
|
|
92
|
-
clientX:
|
|
93
|
-
clientY:
|
|
94
|
-
deltaX:
|
|
95
|
-
deltaY:
|
|
94
|
+
d.prototype._handleWheel = this.ctrlKey ? g : function(t) {
|
|
95
|
+
const { target: i, deltaMode: e, clientX: s, clientY: n, deltaX: r, deltaY: l } = t;
|
|
96
|
+
g.call(this, {
|
|
97
|
+
target: i,
|
|
98
|
+
deltaMode: e,
|
|
99
|
+
clientX: s,
|
|
100
|
+
clientY: n,
|
|
101
|
+
deltaX: r,
|
|
102
|
+
deltaY: l,
|
|
96
103
|
preventDefault() {
|
|
97
|
-
|
|
104
|
+
t.preventDefault();
|
|
98
105
|
},
|
|
99
106
|
ctrlKey: !0
|
|
100
107
|
});
|
|
101
|
-
}, this.bpmnViewer = new
|
|
108
|
+
}, this.bpmnViewer = new E(y(w({}, this.options), {
|
|
102
109
|
container: this.$refs.container,
|
|
103
|
-
additionalModules: [
|
|
104
|
-
})), this.bpmnViewer.on("import.done", (
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
})),
|
|
110
|
+
additionalModules: [X]
|
|
111
|
+
})), this.bpmnViewer.on("import.done", (t) => {
|
|
112
|
+
const i = t.error, e = t.warnings;
|
|
113
|
+
i ? this.$emit("error", i) : this.$emit("shown", e), this.bpmnViewer.get("canvas").zoom("fit-viewport", "center"), this.canvas = this.bpmnViewer.get("canvas"), this.elementRegistry = this.bpmnViewer.get("elementRegistry");
|
|
114
|
+
const s = this.bpmnViewer.get("eventBus");
|
|
115
|
+
s.on("element.mousemove", (h) => v(this, null, function* () {
|
|
116
|
+
h.element.type === "bpmn:UserTask" && (this.$emit("node-mousemove", h.element), this.element = h.element, yield this.$nextTick(), this.$refs.popup.show(h.originalEvent));
|
|
117
|
+
})), s.on("element.out", () => {
|
|
111
118
|
this.$refs.popup.hide(), this.element = {};
|
|
112
|
-
}), this.highlightFlow(this.flows
|
|
113
|
-
|
|
119
|
+
}), this.highlightFlow(this.flows, this.activities);
|
|
120
|
+
const n = c("marker");
|
|
121
|
+
m(n, {
|
|
122
|
+
id: "sequenceflow-arrow-green",
|
|
123
|
+
viewBox: "0 0 20 20",
|
|
124
|
+
refX: "11",
|
|
125
|
+
refY: "10",
|
|
126
|
+
markerWidth: "10",
|
|
127
|
+
markerHeight: "10",
|
|
128
|
+
orient: "auto"
|
|
129
|
+
});
|
|
130
|
+
const r = c("path");
|
|
131
|
+
m(r, {
|
|
132
|
+
d: "M 1 5 L 11 10 L 1 15 Z",
|
|
133
|
+
style: "stroke-linecap: round; stroke-linejoin: round; stroke: var(--highlight-color); stroke-width: 1px; fill: var(--highlight-color);"
|
|
134
|
+
}), p(n, r);
|
|
135
|
+
const l = c("marker");
|
|
136
|
+
m(l, {
|
|
137
|
+
id: "conditional-default-flow-marker-green",
|
|
138
|
+
viewBox: "0 0 20 20",
|
|
139
|
+
refX: "0",
|
|
140
|
+
refY: "10",
|
|
141
|
+
markerWidth: "10",
|
|
142
|
+
markerHeight: "10",
|
|
143
|
+
orient: "auto"
|
|
144
|
+
});
|
|
145
|
+
const a = c("path");
|
|
146
|
+
m(a, {
|
|
147
|
+
d: "M 6 4 L 10 16",
|
|
148
|
+
style: "stroke-linecap: round; stroke-linejoin: round; stroke: var(--highlight-color); stroke-width: 2px; fill: var(--highlight-color);"
|
|
149
|
+
}), p(l, a);
|
|
150
|
+
const o = S("defs", this.$el);
|
|
151
|
+
p(o, n), p(o, l);
|
|
152
|
+
}), this.bpmnViewer.importXML(this.xml), this.$watch(() => ({
|
|
153
|
+
activities: this.activities,
|
|
154
|
+
flows: this.flows
|
|
155
|
+
}), ({ activities: t, flows: i }) => {
|
|
156
|
+
this.highlightFlow(i, t);
|
|
157
|
+
});
|
|
114
158
|
},
|
|
115
159
|
beforeDestroy() {
|
|
116
|
-
var
|
|
117
|
-
|
|
160
|
+
var t;
|
|
161
|
+
d.prototype._handleWheel = g, (t = this.bpmnViewer) == null || t.destroy();
|
|
118
162
|
},
|
|
119
163
|
methods: {
|
|
120
|
-
|
|
121
|
-
this.elementRegistry.getAll().forEach((
|
|
122
|
-
|
|
164
|
+
highlightFlow(t, i) {
|
|
165
|
+
this.elementRegistry.getAll().forEach((e) => {
|
|
166
|
+
if (["bpmn:StartEvent", "bpmn:UserTask", "bpmn:ExclusiveGateway", "bpmn:ParallelGateway ", "bpmn:EndEvent"].includes(e.type)) {
|
|
167
|
+
this.canvas.removeMarker(e, "highlight");
|
|
168
|
+
const s = e.incoming.map((r) => r.id), n = e.outgoing.map((r) => r.id);
|
|
169
|
+
e.type === "bpmn:StartEvent" && n.some((r) => t.includes(r)) && this.canvas.addMarker(e, "highlight"), e.type === "bpmn:EndEvent" && s.some((r) => t.includes(r)) && this.canvas.addMarker(e, "highlight"), !this.activities.includes(e.id) && s.some((r) => t.includes(r)) && n.some((r) => t.includes(r)) && this.canvas.addMarker(e, "highlight");
|
|
170
|
+
}
|
|
171
|
+
e.type === "bpmn:SequenceFlow" && (t.includes(e.id) ? this.canvas.addMarker(e, "highlight-line") : this.canvas.removeMarker(e, "highlight-line")), e.type === "bpmn:UserTask" && (i.includes(e.id) ? this.canvas.addMarker(e, "highlight-current") : this.canvas.removeMarker(e, "highlight-current"));
|
|
123
172
|
});
|
|
124
|
-
},
|
|
125
|
-
highlightFlow(e) {
|
|
126
|
-
this.highlight(e, "bpmn:SequenceFlow", "highlight-line");
|
|
127
|
-
},
|
|
128
|
-
highlightActivity(e) {
|
|
129
|
-
this.highlight(e, "bpmn:UserTask", "highlight");
|
|
130
173
|
}
|
|
131
174
|
}
|
|
132
|
-
},
|
|
133
|
-
var
|
|
134
|
-
|
|
135
|
-
$,
|
|
136
|
-
S,
|
|
137
|
-
!1,
|
|
175
|
+
}, _ = {};
|
|
176
|
+
var L = /* @__PURE__ */ F(
|
|
177
|
+
C,
|
|
138
178
|
B,
|
|
179
|
+
W,
|
|
180
|
+
!1,
|
|
181
|
+
j,
|
|
139
182
|
null,
|
|
140
183
|
null,
|
|
141
184
|
null
|
|
142
185
|
);
|
|
143
|
-
function
|
|
144
|
-
for (let
|
|
145
|
-
this[
|
|
186
|
+
function j(t) {
|
|
187
|
+
for (let i in _)
|
|
188
|
+
this[i] = _[i];
|
|
146
189
|
}
|
|
147
|
-
const
|
|
148
|
-
return
|
|
190
|
+
const P = /* @__PURE__ */ function() {
|
|
191
|
+
return L.exports;
|
|
149
192
|
}();
|
|
150
193
|
export {
|
|
151
|
-
|
|
194
|
+
P as default
|
|
152
195
|
};
|
package/flow-viewer/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.flow-viewer{width:100%;height:400px}.flow-viewer .highlight
|
|
1
|
+
.flow-viewer{width:100%;height:400px}.flow-viewer .highlight g.djs-visual rect,.flow-viewer .highlight g.djs-visual circle,.flow-viewer .highlight g.djs-visual polygon,.flow-viewer .highlight g.djs-visual path{stroke:var(--highlight-color)!important}.flow-viewer .highlight g.djs-visual polygon+path{fill:var(--highlight-color)!important}@keyframes dashoffset{to{stroke-dashoffset:0}}.flow-viewer .highlight-current g.djs-visual rect{fill:#fbe9d1!important;stroke:#d67e7d!important;animation:dashoffset 2s linear infinite;stroke-dashoffset:80;stroke-dasharray:8}.flow-viewer .highlight-line g.djs-visual path{stroke:var(--highlight-color)!important;stroke-width:2px!important;marker-end:url(#sequenceflow-arrow-green)!important}
|
package/package.json
CHANGED
package/web-types.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"framework": "vue",
|
|
4
4
|
"name": "@web-utils/component",
|
|
5
|
-
"version": "2.9.
|
|
5
|
+
"version": "2.9.9",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"description-markup": "markdown",
|
|
@@ -2612,6 +2612,14 @@
|
|
|
2612
2612
|
},
|
|
2613
2613
|
"default": "[]"
|
|
2614
2614
|
},
|
|
2615
|
+
{
|
|
2616
|
+
"name": "highlightColor",
|
|
2617
|
+
"value": {
|
|
2618
|
+
"kind": "expression",
|
|
2619
|
+
"type": "string"
|
|
2620
|
+
},
|
|
2621
|
+
"default": "'rgb(0 190 0 / 100%)'"
|
|
2622
|
+
},
|
|
2615
2623
|
{
|
|
2616
2624
|
"name": "ctrlKey",
|
|
2617
2625
|
"value": {
|