@miragon/value-chain-renderer 0.0.0-stage → 0.1.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/README.md +66 -2
- package/dist/Modeler.d.ts +11 -0
- package/dist/Modeler.d.ts.map +1 -0
- package/dist/NavigatedViewer.d.ts +7 -0
- package/dist/NavigatedViewer.d.ts.map +1 -0
- package/dist/VcBaseViewer.d.ts +45 -0
- package/dist/VcBaseViewer.d.ts.map +1 -0
- package/dist/Viewer.d.ts +7 -0
- package/dist/Viewer.d.ts.map +1 -0
- package/dist/append/VcAppend.d.ts +25 -0
- package/dist/append/VcAppend.d.ts.map +1 -0
- package/dist/append/VcAutoPlaceBehavior.d.ts +24 -0
- package/dist/append/VcAutoPlaceBehavior.d.ts.map +1 -0
- package/dist/append/VcCreatePreviewBehavior.d.ts +9 -0
- package/dist/append/VcCreatePreviewBehavior.d.ts.map +1 -0
- package/dist/append/index.d.ts +4 -0
- package/dist/append/index.d.ts.map +1 -0
- package/dist/connect/VcConnect.d.ts +17 -0
- package/dist/connect/VcConnect.d.ts.map +1 -0
- package/dist/connect/index.d.ts +4 -0
- package/dist/connect/index.d.ts.map +1 -0
- package/dist/context-pad/VcContextPadProvider.d.ts +28 -0
- package/dist/context-pad/VcContextPadProvider.d.ts.map +1 -0
- package/dist/context-pad/index.d.ts +4 -0
- package/dist/context-pad/index.d.ts.map +1 -0
- package/dist/copy-paste/VcCopyPasteBehavior.d.ts +10 -0
- package/dist/copy-paste/VcCopyPasteBehavior.d.ts.map +1 -0
- package/dist/copy-paste/index.d.ts +4 -0
- package/dist/copy-paste/index.d.ts.map +1 -0
- package/dist/draw/VcRenderer.d.ts +17 -0
- package/dist/draw/VcRenderer.d.ts.map +1 -0
- package/dist/draw/geometry.d.ts +18 -0
- package/dist/draw/geometry.d.ts.map +1 -0
- package/dist/draw/icons.d.ts +24 -0
- package/dist/draw/icons.d.ts.map +1 -0
- package/dist/draw/index.d.ts +7 -0
- package/dist/draw/index.d.ts.map +1 -0
- package/dist/draw/styles.d.ts +21 -0
- package/dist/draw/styles.d.ts.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1432 -0
- package/dist/index.js.map +1 -0
- package/dist/io/VcExporter.d.ts +16 -0
- package/dist/io/VcExporter.d.ts.map +1 -0
- package/dist/io/VcImporter.d.ts +25 -0
- package/dist/io/VcImporter.d.ts.map +1 -0
- package/dist/io/index.d.ts +8 -0
- package/dist/io/index.d.ts.map +1 -0
- package/dist/io/saveSvg.d.ts +11 -0
- package/dist/io/saveSvg.d.ts.map +1 -0
- package/dist/io/types.d.ts +10 -0
- package/dist/io/types.d.ts.map +1 -0
- package/dist/keyboard/VcEditorActions.d.ts +8 -0
- package/dist/keyboard/VcEditorActions.d.ts.map +1 -0
- package/dist/keyboard/VcKeyboardBindings.d.ts +11 -0
- package/dist/keyboard/VcKeyboardBindings.d.ts.map +1 -0
- package/dist/keyboard/index.d.ts +6 -0
- package/dist/keyboard/index.d.ts.map +1 -0
- package/dist/label-editing/VcLabelEditingProvider.d.ts +38 -0
- package/dist/label-editing/VcLabelEditingProvider.d.ts.map +1 -0
- package/dist/label-editing/index.d.ts +4 -0
- package/dist/label-editing/index.d.ts.map +1 -0
- package/dist/model/VcDiagramElementFactory.d.ts +20 -0
- package/dist/model/VcDiagramElementFactory.d.ts.map +1 -0
- package/dist/model/VcElementFactory.d.ts +23 -0
- package/dist/model/VcElementFactory.d.ts.map +1 -0
- package/dist/model/di-types.d.ts +29 -0
- package/dist/model/di-types.d.ts.map +1 -0
- package/dist/model/index.d.ts +10 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/modeling/VcConnectionTypeBehavior.d.ts +13 -0
- package/dist/modeling/VcConnectionTypeBehavior.d.ts.map +1 -0
- package/dist/modeling/VcHierarchyRelayoutBehavior.d.ts +18 -0
- package/dist/modeling/VcHierarchyRelayoutBehavior.d.ts.map +1 -0
- package/dist/modeling/VcLayouter.d.ts +66 -0
- package/dist/modeling/VcLayouter.d.ts.map +1 -0
- package/dist/modeling/VcModeling.d.ts +16 -0
- package/dist/modeling/VcModeling.d.ts.map +1 -0
- package/dist/modeling/cmd/UpdatePropertiesHandler.d.ts +15 -0
- package/dist/modeling/cmd/UpdatePropertiesHandler.d.ts.map +1 -0
- package/dist/modeling/index.d.ts +11 -0
- package/dist/modeling/index.d.ts.map +1 -0
- package/dist/ordering/VcOrderingProvider.d.ts +13 -0
- package/dist/ordering/VcOrderingProvider.d.ts.map +1 -0
- package/dist/ordering/index.d.ts +4 -0
- package/dist/ordering/index.d.ts.map +1 -0
- package/dist/palette/VcPaletteProvider.d.ts +32 -0
- package/dist/palette/VcPaletteProvider.d.ts.map +1 -0
- package/dist/palette/index.d.ts +4 -0
- package/dist/palette/index.d.ts.map +1 -0
- package/dist/popup/VcAlignMenuProvider.d.ts +21 -0
- package/dist/popup/VcAlignMenuProvider.d.ts.map +1 -0
- package/dist/popup/VcColorPickerProvider.d.ts +18 -0
- package/dist/popup/VcColorPickerProvider.d.ts.map +1 -0
- package/dist/popup/index.d.ts +6 -0
- package/dist/popup/index.d.ts.map +1 -0
- package/dist/resize/VcResizeBehavior.d.ts +7 -0
- package/dist/resize/VcResizeBehavior.d.ts.map +1 -0
- package/dist/resize/index.d.ts +4 -0
- package/dist/resize/index.d.ts.map +1 -0
- package/dist/rules/VcRules.d.ts +15 -0
- package/dist/rules/VcRules.d.ts.map +1 -0
- package/dist/rules/index.d.ts +4 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/value-chain.css +2 -0
- package/package.json +60 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,1432 @@
|
|
|
1
|
+
import e from "diagram-js/lib/Diagram";
|
|
2
|
+
import { getBBox as t } from "diagram-js/lib/util/Elements";
|
|
3
|
+
import { CURRENT_SCHEMA_VERSION as n, DEFAULT_ORG_UNIT_SIZE as r, DEFAULT_STEP_SIZE as i, MIN_STEP_SIZE as a, validateDocument as o } from "@miragon/value-chain-schema-model";
|
|
4
|
+
import s from "diagram-js/lib/core/ElementFactory";
|
|
5
|
+
import c from "diagram-js/lib/draw/BaseRenderer";
|
|
6
|
+
import l from "diagram-js/lib/util/Text";
|
|
7
|
+
import { createLine as u } from "diagram-js/lib/util/RenderUtil";
|
|
8
|
+
import { append as d, attr as f, create as p } from "tiny-svg";
|
|
9
|
+
import ee from "diagram-js/lib/features/selection";
|
|
10
|
+
import te from "diagram-js/lib/navigation/zoomscroll";
|
|
11
|
+
import ne from "diagram-js/lib/navigation/movecanvas";
|
|
12
|
+
import re from "diagram-js/lib/features/modeling";
|
|
13
|
+
import ie from "diagram-js/lib/features/move";
|
|
14
|
+
import ae from "diagram-js/lib/features/outline";
|
|
15
|
+
import oe from "diagram-js/lib/features/bendpoints";
|
|
16
|
+
import se from "diagram-js/lib/features/auto-scroll";
|
|
17
|
+
import ce from "diagram-js/lib/features/grid-snapping";
|
|
18
|
+
import le from "diagram-js/lib/features/snapping";
|
|
19
|
+
import ue from "diagram-js/lib/features/keyboard-move-selection";
|
|
20
|
+
import de from "diagram-js/lib/navigation/keyboard-move";
|
|
21
|
+
import fe from "diagram-js/lib/layout/CroppingConnectionDocking";
|
|
22
|
+
import pe from "diagram-js/lib/layout/BaseLayouter";
|
|
23
|
+
import { getMid as m } from "diagram-js/lib/layout/LayoutUtil";
|
|
24
|
+
import { connectPoints as me, connectRectangles as he, withoutRedundantPoints as h } from "diagram-js/lib/layout/ManhattanLayout";
|
|
25
|
+
import ge from "diagram-js/lib/command/CommandInterceptor";
|
|
26
|
+
import _e from "diagram-js/lib/features/rules";
|
|
27
|
+
import ve from "diagram-js/lib/features/rules/RuleProvider";
|
|
28
|
+
import ye from "diagram-js/lib/features/connect";
|
|
29
|
+
import be from "diagram-js/lib/features/auto-place";
|
|
30
|
+
import xe from "diagram-js/lib/features/create";
|
|
31
|
+
import Se from "diagram-js/lib/features/connection-preview";
|
|
32
|
+
import Ce from "diagram-js/lib/features/palette";
|
|
33
|
+
import we from "diagram-js/lib/features/hand-tool";
|
|
34
|
+
import Te from "diagram-js/lib/features/lasso-tool";
|
|
35
|
+
import Ee from "diagram-js/lib/features/space-tool";
|
|
36
|
+
import De from "diagram-js/lib/features/global-connect";
|
|
37
|
+
import Oe from "diagram-js/lib/features/context-pad";
|
|
38
|
+
import g from "diagram-js/lib/features/popup-menu";
|
|
39
|
+
import ke from "diagram-js-direct-editing";
|
|
40
|
+
import Ae from "diagram-js/lib/features/align-elements";
|
|
41
|
+
import je from "diagram-js/lib/features/distribute-elements";
|
|
42
|
+
import Me from "diagram-js/lib/features/keyboard";
|
|
43
|
+
import Ne from "diagram-js/lib/features/editor-actions";
|
|
44
|
+
import Pe from "diagram-js/lib/features/keyboard/KeyboardBindings";
|
|
45
|
+
import { hasModifier as Fe, isKey as Ie } from "diagram-js/lib/features/keyboard/KeyboardUtil";
|
|
46
|
+
import Le from "diagram-js/lib/features/ordering/OrderingProvider";
|
|
47
|
+
import Re from "diagram-js/lib/features/copy-paste";
|
|
48
|
+
import ze from "diagram-js/lib/features/resize";
|
|
49
|
+
//#region src/model/di-types.ts
|
|
50
|
+
function _(e) {
|
|
51
|
+
return typeof e == "object" && !!e;
|
|
52
|
+
}
|
|
53
|
+
function v(e) {
|
|
54
|
+
return _(e) && (e.vcType === "step" || e.vcType === "orgUnit");
|
|
55
|
+
}
|
|
56
|
+
function y(e) {
|
|
57
|
+
return _(e) && e.vcType === "step";
|
|
58
|
+
}
|
|
59
|
+
function b(e) {
|
|
60
|
+
return _(e) && e.vcType === "orgUnit";
|
|
61
|
+
}
|
|
62
|
+
function x(e) {
|
|
63
|
+
return _(e) && (e.vcType === "sequence" || e.vcType === "hierarchy" || e.vcType === "assignment") && "waypoints" in e;
|
|
64
|
+
}
|
|
65
|
+
function S(e) {
|
|
66
|
+
return v(e) || x(e);
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/io/saveSvg.ts
|
|
70
|
+
var C = 20;
|
|
71
|
+
function w(e, n) {
|
|
72
|
+
let r = e.getContainer().querySelector("svg");
|
|
73
|
+
if (!r) throw Error("No SVG found in the canvas container.");
|
|
74
|
+
let i = n.getAll().filter(S), a = i.length ? t(i) : {
|
|
75
|
+
x: 0,
|
|
76
|
+
y: 0,
|
|
77
|
+
width: 800,
|
|
78
|
+
height: 600
|
|
79
|
+
}, o = {
|
|
80
|
+
x: a.x - C,
|
|
81
|
+
y: a.y - C,
|
|
82
|
+
width: a.width + 40,
|
|
83
|
+
height: a.height + 40
|
|
84
|
+
}, s = r.cloneNode(!0);
|
|
85
|
+
s.setAttribute("xmlns", "http://www.w3.org/2000/svg"), s.setAttribute("viewBox", `${o.x} ${o.y} ${o.width} ${o.height}`), s.setAttribute("width", String(o.width)), s.setAttribute("height", String(o.height));
|
|
86
|
+
let c = s.querySelector(".viewport");
|
|
87
|
+
return c && c.removeAttribute("transform"), { svg: `<?xml version="1.0" encoding="utf-8"?>\n${new XMLSerializer().serializeToString(s)}` };
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/VcBaseViewer.ts
|
|
91
|
+
var T = class {
|
|
92
|
+
_diagram;
|
|
93
|
+
_container;
|
|
94
|
+
_options;
|
|
95
|
+
constructor(e = {}) {
|
|
96
|
+
this._options = e, this._container = this._createContainer(e);
|
|
97
|
+
}
|
|
98
|
+
get container() {
|
|
99
|
+
return this._container;
|
|
100
|
+
}
|
|
101
|
+
get(e) {
|
|
102
|
+
return this._ensureDiagram().get(e);
|
|
103
|
+
}
|
|
104
|
+
getOptional(e) {
|
|
105
|
+
return this._ensureDiagram().get(e, !1) ?? null;
|
|
106
|
+
}
|
|
107
|
+
on(e, t, n = 1e3) {
|
|
108
|
+
this.get("eventBus").on(e, n, t);
|
|
109
|
+
}
|
|
110
|
+
off(e, t) {
|
|
111
|
+
this.get("eventBus").off(e, t);
|
|
112
|
+
}
|
|
113
|
+
importDocument(e) {
|
|
114
|
+
let t = this.get("vcImporter");
|
|
115
|
+
t.clear();
|
|
116
|
+
let n = t.import(e);
|
|
117
|
+
return this.getOptional("commandStack")?.clear(), this.fitViewport(), this.get("eventBus").fire("import.done", { warnings: n }), n;
|
|
118
|
+
}
|
|
119
|
+
exportDocument() {
|
|
120
|
+
return this.get("vcExporter").export();
|
|
121
|
+
}
|
|
122
|
+
saveSVG() {
|
|
123
|
+
return w(this.get("canvas"), this.get("elementRegistry"));
|
|
124
|
+
}
|
|
125
|
+
fitViewport() {
|
|
126
|
+
let e = this.get("canvas");
|
|
127
|
+
this.get("elementRegistry").getAll().some(S) && (e.zoom("fit-viewport"), e.zoom() > 1 && e.zoom(1));
|
|
128
|
+
}
|
|
129
|
+
clear() {
|
|
130
|
+
this.get("vcImporter").clear(), this.getOptional("commandStack")?.clear();
|
|
131
|
+
}
|
|
132
|
+
attachTo(e) {
|
|
133
|
+
this.detach(), e.appendChild(this._container), this.get("canvas").resized();
|
|
134
|
+
}
|
|
135
|
+
detach() {
|
|
136
|
+
this._container.parentNode?.removeChild(this._container);
|
|
137
|
+
}
|
|
138
|
+
destroy() {
|
|
139
|
+
this._diagram?.destroy(), this._diagram = void 0, this.detach();
|
|
140
|
+
}
|
|
141
|
+
_createContainer(e) {
|
|
142
|
+
let t = e.container ?? document.createElement("div");
|
|
143
|
+
return t.classList.add("vc-container"), t.style.width = E(e.width ?? "100%"), t.style.height = E(e.height ?? (e.container ? "100%" : "600px")), t;
|
|
144
|
+
}
|
|
145
|
+
_ensureDiagram() {
|
|
146
|
+
if (!this._diagram) {
|
|
147
|
+
let t = [...this._getModules(), ...this._options.additionalModules ?? []];
|
|
148
|
+
this._diagram = new e({
|
|
149
|
+
canvas: { container: this._container },
|
|
150
|
+
modules: t
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
return this._diagram;
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
function E(e) {
|
|
157
|
+
return typeof e == "number" ? `${e}px` : e;
|
|
158
|
+
}
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region src/model/VcElementFactory.ts
|
|
161
|
+
var D = class {
|
|
162
|
+
elementFactory;
|
|
163
|
+
static $inject = ["elementFactory"];
|
|
164
|
+
constructor(e) {
|
|
165
|
+
this.elementFactory = e;
|
|
166
|
+
}
|
|
167
|
+
createElement(e) {
|
|
168
|
+
return this.elementFactory.createShape({
|
|
169
|
+
id: e.id,
|
|
170
|
+
x: e.bounds.x,
|
|
171
|
+
y: e.bounds.y,
|
|
172
|
+
width: e.bounds.width,
|
|
173
|
+
height: e.bounds.height,
|
|
174
|
+
vcType: e.elementType,
|
|
175
|
+
vcLabel: e.name,
|
|
176
|
+
...e.color === void 0 ? {} : { color: e.color },
|
|
177
|
+
...e.elementType === "step" && e.link !== void 0 ? { link: e.link } : {},
|
|
178
|
+
businessObject: e
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
createConnection(e, t, n) {
|
|
182
|
+
return this.elementFactory.createConnection({
|
|
183
|
+
id: e.id,
|
|
184
|
+
source: t,
|
|
185
|
+
target: n,
|
|
186
|
+
waypoints: e.waypoints.map((e) => ({
|
|
187
|
+
x: e.x,
|
|
188
|
+
y: e.y
|
|
189
|
+
})),
|
|
190
|
+
vcType: e.connectionType,
|
|
191
|
+
businessObject: e
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
createNewStep(e = "") {
|
|
195
|
+
return this.elementFactory.createShape({
|
|
196
|
+
width: i.width,
|
|
197
|
+
height: i.height,
|
|
198
|
+
vcType: "step",
|
|
199
|
+
vcLabel: e
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
createNewOrgUnit(e = "") {
|
|
203
|
+
return this.elementFactory.createShape({
|
|
204
|
+
width: r.width,
|
|
205
|
+
height: r.height,
|
|
206
|
+
vcType: "orgUnit",
|
|
207
|
+
vcLabel: e
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}, O = class extends s {
|
|
211
|
+
elementRegistry;
|
|
212
|
+
static $inject = ["elementRegistry"];
|
|
213
|
+
counters = /* @__PURE__ */ new Map();
|
|
214
|
+
constructor(e) {
|
|
215
|
+
super(), this.elementRegistry = e;
|
|
216
|
+
}
|
|
217
|
+
create(e, t) {
|
|
218
|
+
let n = t?.id ? t : {
|
|
219
|
+
...t,
|
|
220
|
+
id: this.unusedId(e)
|
|
221
|
+
};
|
|
222
|
+
switch (e) {
|
|
223
|
+
case "root": return super.create(e, n);
|
|
224
|
+
case "shape": return super.create(e, n);
|
|
225
|
+
case "connection": return super.create(e, n);
|
|
226
|
+
case "label": return super.create(e, n);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
unusedId(e) {
|
|
230
|
+
let t = this.counters.get(e) ?? 0, n;
|
|
231
|
+
do
|
|
232
|
+
t += 1, n = `${e}_${t}`;
|
|
233
|
+
while (this.elementRegistry.get(n));
|
|
234
|
+
return this.counters.set(e, t), n;
|
|
235
|
+
}
|
|
236
|
+
}, k = {
|
|
237
|
+
elementFactory: ["type", O],
|
|
238
|
+
vcElementFactory: ["type", D]
|
|
239
|
+
};
|
|
240
|
+
//#endregion
|
|
241
|
+
//#region src/draw/geometry.ts
|
|
242
|
+
function A(e, t) {
|
|
243
|
+
return Math.min(t / 2, .4 * e);
|
|
244
|
+
}
|
|
245
|
+
function j(e, t) {
|
|
246
|
+
return N(0, 0, e, t);
|
|
247
|
+
}
|
|
248
|
+
function M(e, t) {
|
|
249
|
+
let n = A(e, t);
|
|
250
|
+
return Math.max(7, n - 5);
|
|
251
|
+
}
|
|
252
|
+
function N(e, t, n, r) {
|
|
253
|
+
let i = A(n, r), a = t + r / 2;
|
|
254
|
+
return [
|
|
255
|
+
`M${e},${t}`,
|
|
256
|
+
`L${e + n - i},${t}`,
|
|
257
|
+
`L${e + n},${a}`,
|
|
258
|
+
`L${e + n - i},${t + r}`,
|
|
259
|
+
`L${e},${t + r}`,
|
|
260
|
+
`L${e + i},${a}`,
|
|
261
|
+
"Z"
|
|
262
|
+
].join("");
|
|
263
|
+
}
|
|
264
|
+
function P(e, t, n, r) {
|
|
265
|
+
let i = n / 2, a = r / 2, o = e + i;
|
|
266
|
+
return [
|
|
267
|
+
`M${o},${t}`,
|
|
268
|
+
`A${i},${a} 0 0 1 ${o},${t + r}`,
|
|
269
|
+
`A${i},${a} 0 0 1 ${o},${t}`,
|
|
270
|
+
"Z"
|
|
271
|
+
].join("");
|
|
272
|
+
}
|
|
273
|
+
//#endregion
|
|
274
|
+
//#region src/draw/styles.ts
|
|
275
|
+
var F = {
|
|
276
|
+
ink: "hsl(225, 10%, 15%)",
|
|
277
|
+
fill: "white"
|
|
278
|
+
}, I = {
|
|
279
|
+
family: "Arial, sans-serif",
|
|
280
|
+
size: 12,
|
|
281
|
+
lineHeight: 1.2
|
|
282
|
+
}, L = [
|
|
283
|
+
{ label: "Default" },
|
|
284
|
+
{
|
|
285
|
+
label: "Blue",
|
|
286
|
+
color: "hsl(205, 100%, 45%)"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
label: "Green",
|
|
290
|
+
color: "hsl(150, 86%, 34%)"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
label: "Orange",
|
|
294
|
+
color: "hsl(29, 89%, 44%)"
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
label: "Red",
|
|
298
|
+
color: "hsl(360, 100%, 45%)"
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
label: "Purple",
|
|
302
|
+
color: "hsl(287, 65%, 44%)"
|
|
303
|
+
}
|
|
304
|
+
], Be = 1500, Ve = "M 1 5 L 11 10 L 1 15 Z", He = 0, R = class extends c {
|
|
305
|
+
static $inject = ["eventBus"];
|
|
306
|
+
textUtil = new l({ style: {
|
|
307
|
+
fontFamily: I.family,
|
|
308
|
+
fontSize: I.size,
|
|
309
|
+
fontWeight: "normal",
|
|
310
|
+
lineHeight: I.lineHeight
|
|
311
|
+
} });
|
|
312
|
+
markerSuffix = `${He += 1}`;
|
|
313
|
+
constructor(e) {
|
|
314
|
+
super(e, Be);
|
|
315
|
+
}
|
|
316
|
+
canRender(e) {
|
|
317
|
+
return v(e) || x(e);
|
|
318
|
+
}
|
|
319
|
+
drawShape(e, t) {
|
|
320
|
+
let n = t, r = n.color ?? F.ink, i = b(n), a = p("path");
|
|
321
|
+
if (f(a, {
|
|
322
|
+
d: i ? P(0, 0, n.width, n.height) : j(n.width, n.height),
|
|
323
|
+
fill: F.fill,
|
|
324
|
+
stroke: r,
|
|
325
|
+
"stroke-width": 2,
|
|
326
|
+
"stroke-linecap": "round",
|
|
327
|
+
"stroke-linejoin": "round"
|
|
328
|
+
}), d(e, a), n.vcLabel) {
|
|
329
|
+
let t = i ? 12 : M(n.width, n.height), a = this.textUtil.createText(n.vcLabel, {
|
|
330
|
+
box: {
|
|
331
|
+
width: n.width,
|
|
332
|
+
height: n.height
|
|
333
|
+
},
|
|
334
|
+
align: "center-middle",
|
|
335
|
+
padding: {
|
|
336
|
+
top: 7,
|
|
337
|
+
bottom: 7,
|
|
338
|
+
left: t,
|
|
339
|
+
right: t
|
|
340
|
+
},
|
|
341
|
+
style: { fill: r }
|
|
342
|
+
});
|
|
343
|
+
d(e, a);
|
|
344
|
+
}
|
|
345
|
+
return a;
|
|
346
|
+
}
|
|
347
|
+
drawConnection(e, t) {
|
|
348
|
+
let n = t, r = F.ink, i = {
|
|
349
|
+
stroke: r,
|
|
350
|
+
"stroke-width": 2,
|
|
351
|
+
"stroke-linecap": "round",
|
|
352
|
+
"stroke-linejoin": "round",
|
|
353
|
+
fill: "none"
|
|
354
|
+
};
|
|
355
|
+
if (n.vcType === "sequence" && (i["stroke-dasharray"] = "8, 5"), n.vcType !== "assignment") {
|
|
356
|
+
let t = e.ownerSVGElement;
|
|
357
|
+
t && (i["marker-end"] = this.arrowMarker(t, r));
|
|
358
|
+
}
|
|
359
|
+
let a = u(n.waypoints, i);
|
|
360
|
+
return d(e, a), a;
|
|
361
|
+
}
|
|
362
|
+
getShapePath(e) {
|
|
363
|
+
return b(e) ? P(e.x, e.y, e.width, e.height) : N(e.x, e.y, e.width, e.height);
|
|
364
|
+
}
|
|
365
|
+
getConnectionPath(e) {
|
|
366
|
+
let [t, ...n] = e.waypoints;
|
|
367
|
+
return t ? `M${t.x},${t.y}${n.map((e) => `L${e.x},${e.y}`).join("")}` : "";
|
|
368
|
+
}
|
|
369
|
+
arrowMarker(e, t) {
|
|
370
|
+
let n = `vc-arrow-${this.markerSuffix}-${t.replace(/[^a-zA-Z0-9]/g, "")}`;
|
|
371
|
+
if (!e.querySelector(`marker[id="${n}"]`)) {
|
|
372
|
+
let r = e.querySelector("defs");
|
|
373
|
+
r || (r = p("defs"), d(e, r));
|
|
374
|
+
let i = p("marker");
|
|
375
|
+
f(i, {
|
|
376
|
+
id: n,
|
|
377
|
+
viewBox: "0 0 20 20",
|
|
378
|
+
refX: 11,
|
|
379
|
+
refY: 10,
|
|
380
|
+
markerWidth: 10,
|
|
381
|
+
markerHeight: 10,
|
|
382
|
+
orient: "auto"
|
|
383
|
+
});
|
|
384
|
+
let a = p("path");
|
|
385
|
+
f(a, {
|
|
386
|
+
d: Ve,
|
|
387
|
+
fill: t,
|
|
388
|
+
stroke: t,
|
|
389
|
+
"stroke-width": 1,
|
|
390
|
+
"stroke-linejoin": "round"
|
|
391
|
+
}), d(i, a), d(r, i);
|
|
392
|
+
}
|
|
393
|
+
return `url(#${n})`;
|
|
394
|
+
}
|
|
395
|
+
}, z = {
|
|
396
|
+
__init__: ["vcRenderer"],
|
|
397
|
+
vcRenderer: ["type", R]
|
|
398
|
+
}, B = "vc-root", V = class {
|
|
399
|
+
canvas;
|
|
400
|
+
elementFactory;
|
|
401
|
+
vcElementFactory;
|
|
402
|
+
elementRegistry;
|
|
403
|
+
eventBus;
|
|
404
|
+
static $inject = [
|
|
405
|
+
"canvas",
|
|
406
|
+
"elementFactory",
|
|
407
|
+
"vcElementFactory",
|
|
408
|
+
"elementRegistry",
|
|
409
|
+
"eventBus"
|
|
410
|
+
];
|
|
411
|
+
constructor(e, t, n, r, i) {
|
|
412
|
+
this.canvas = e, this.elementFactory = t, this.vcElementFactory = n, this.elementRegistry = r, this.eventBus = i;
|
|
413
|
+
}
|
|
414
|
+
import(e) {
|
|
415
|
+
let t = [];
|
|
416
|
+
this.eventBus.fire("import.render.start", { document: e });
|
|
417
|
+
let n = this.ensureRoot();
|
|
418
|
+
n.businessObject = { name: e.meta.name };
|
|
419
|
+
let r = /* @__PURE__ */ new Map();
|
|
420
|
+
for (let i of e.elements) {
|
|
421
|
+
if (i.id === "vc-root") {
|
|
422
|
+
t.push({ message: `Skipped element "${i.id}": reserved id.` });
|
|
423
|
+
continue;
|
|
424
|
+
}
|
|
425
|
+
let e = this.vcElementFactory.createElement(i);
|
|
426
|
+
this.canvas.addShape(e, n), r.set(i.id, e);
|
|
427
|
+
}
|
|
428
|
+
let i = 0;
|
|
429
|
+
for (let a of e.connections) {
|
|
430
|
+
let e = r.get(a.source), o = r.get(a.target);
|
|
431
|
+
if (!e || !o) {
|
|
432
|
+
t.push({
|
|
433
|
+
message: `Skipped connection "${a.id}": unresolved endpoint.`,
|
|
434
|
+
connectionId: a.id
|
|
435
|
+
});
|
|
436
|
+
continue;
|
|
437
|
+
}
|
|
438
|
+
let s = this.vcElementFactory.createConnection(a, e, o);
|
|
439
|
+
this.canvas.addConnection(s, n, i), i += 1;
|
|
440
|
+
}
|
|
441
|
+
return this.eventBus.fire("import.render.done", {
|
|
442
|
+
document: e,
|
|
443
|
+
warnings: t
|
|
444
|
+
}), t;
|
|
445
|
+
}
|
|
446
|
+
clear() {
|
|
447
|
+
let e = this.elementRegistry.getAll();
|
|
448
|
+
for (let t of e) if (t.id === "vc-root") t.businessObject = void 0;
|
|
449
|
+
else try {
|
|
450
|
+
x(t) ? this.canvas.removeConnection(t) : v(t) && this.canvas.removeShape(t);
|
|
451
|
+
} catch {}
|
|
452
|
+
}
|
|
453
|
+
ensureRoot() {
|
|
454
|
+
let e = this.canvas.getRootElement();
|
|
455
|
+
if (e.id === "vc-root") return e;
|
|
456
|
+
let t = this.elementFactory.createRoot({ id: B });
|
|
457
|
+
return this.canvas.setRootElement(t), t;
|
|
458
|
+
}
|
|
459
|
+
}, H = class {
|
|
460
|
+
elementRegistry;
|
|
461
|
+
canvas;
|
|
462
|
+
static $inject = ["elementRegistry", "canvas"];
|
|
463
|
+
constructor(e, t) {
|
|
464
|
+
this.elementRegistry = e, this.canvas = t;
|
|
465
|
+
}
|
|
466
|
+
export() {
|
|
467
|
+
let e = [], t = [];
|
|
468
|
+
for (let n of this.elementRegistry.getAll()) if (n.id !== "vc-root") {
|
|
469
|
+
if (x(n)) {
|
|
470
|
+
if (!n.source || !n.target) continue;
|
|
471
|
+
t.push({
|
|
472
|
+
id: n.id,
|
|
473
|
+
connectionType: n.vcType,
|
|
474
|
+
source: n.source.id,
|
|
475
|
+
target: n.target.id,
|
|
476
|
+
waypoints: n.waypoints.map((e) => ({
|
|
477
|
+
x: e.x,
|
|
478
|
+
y: e.y
|
|
479
|
+
}))
|
|
480
|
+
});
|
|
481
|
+
} else if (v(n)) {
|
|
482
|
+
let t = {
|
|
483
|
+
x: n.x,
|
|
484
|
+
y: n.y,
|
|
485
|
+
width: n.width,
|
|
486
|
+
height: n.height
|
|
487
|
+
}, r = n.color === void 0 ? {} : { color: n.color };
|
|
488
|
+
if (n.vcType === "orgUnit") e.push({
|
|
489
|
+
id: n.id,
|
|
490
|
+
elementType: "orgUnit",
|
|
491
|
+
name: n.vcLabel,
|
|
492
|
+
bounds: t,
|
|
493
|
+
...r
|
|
494
|
+
});
|
|
495
|
+
else {
|
|
496
|
+
let i = n.businessObject, a = n.link ?? (i?.elementType === "step" ? i.link : void 0);
|
|
497
|
+
e.push({
|
|
498
|
+
id: n.id,
|
|
499
|
+
elementType: "step",
|
|
500
|
+
name: n.vcLabel,
|
|
501
|
+
bounds: t,
|
|
502
|
+
...r,
|
|
503
|
+
...a === void 0 ? {} : { link: a }
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
let r = this.canvas.getRootElement().businessObject;
|
|
509
|
+
return o({
|
|
510
|
+
schemaVersion: n,
|
|
511
|
+
meta: { name: r?.name ?? "Untitled value chain" },
|
|
512
|
+
elements: e,
|
|
513
|
+
connections: t
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
}, U = {
|
|
517
|
+
vcImporter: ["type", V],
|
|
518
|
+
vcExporter: ["type", H]
|
|
519
|
+
}, W = class extends T {
|
|
520
|
+
_getModules() {
|
|
521
|
+
return [
|
|
522
|
+
k,
|
|
523
|
+
z,
|
|
524
|
+
U
|
|
525
|
+
];
|
|
526
|
+
}
|
|
527
|
+
}, Ue = class extends W {
|
|
528
|
+
_getModules() {
|
|
529
|
+
return [
|
|
530
|
+
...super._getModules(),
|
|
531
|
+
ee,
|
|
532
|
+
te,
|
|
533
|
+
ne
|
|
534
|
+
];
|
|
535
|
+
}
|
|
536
|
+
}, We = class {
|
|
537
|
+
execute(e) {
|
|
538
|
+
let { element: t, properties: n } = e, r = t, i = {};
|
|
539
|
+
for (let e of Object.keys(n)) i[e] = r[e], Ge(r, e, n[e]);
|
|
540
|
+
return e.oldProperties = i, [t];
|
|
541
|
+
}
|
|
542
|
+
revert(e) {
|
|
543
|
+
let { element: t, oldProperties: n } = e, r = t;
|
|
544
|
+
if (n) for (let e of Object.keys(n)) Ge(r, e, n[e]);
|
|
545
|
+
return [t];
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
function Ge(e, t, n) {
|
|
549
|
+
n === void 0 ? delete e[t] : e[t] = n;
|
|
550
|
+
}
|
|
551
|
+
//#endregion
|
|
552
|
+
//#region src/modeling/VcModeling.ts
|
|
553
|
+
var Ke = "element.updateProperties", qe = class {
|
|
554
|
+
commandStack;
|
|
555
|
+
static $inject = ["commandStack"];
|
|
556
|
+
constructor(e) {
|
|
557
|
+
this.commandStack = e, e.registerHandler(Ke, We);
|
|
558
|
+
}
|
|
559
|
+
updateProperties(e, t) {
|
|
560
|
+
this.commandStack.execute(Ke, {
|
|
561
|
+
element: e,
|
|
562
|
+
properties: t
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
updateLabel(e, t) {
|
|
566
|
+
t !== e.vcLabel && this.updateProperties(e, { vcLabel: t });
|
|
567
|
+
}
|
|
568
|
+
setColor(e, t) {
|
|
569
|
+
t !== e.color && this.updateProperties(e, { color: t });
|
|
570
|
+
}
|
|
571
|
+
setConnectionType(e, t) {
|
|
572
|
+
t !== e.vcType && this.updateProperties(e, { vcType: t });
|
|
573
|
+
}
|
|
574
|
+
}, Je = 25, Ye = 10, Xe = 10, Ze = class extends pe {
|
|
575
|
+
connectionDocking;
|
|
576
|
+
static $inject = ["connectionDocking"];
|
|
577
|
+
constructor(e) {
|
|
578
|
+
super(), this.connectionDocking = e;
|
|
579
|
+
}
|
|
580
|
+
layoutConnection(e, t = {}) {
|
|
581
|
+
let n = t.source ?? e.source, r = t.target ?? e.target;
|
|
582
|
+
if (!n || !r) return e.waypoints?.map((e) => ({
|
|
583
|
+
x: e.x,
|
|
584
|
+
y: e.y
|
|
585
|
+
})) ?? [];
|
|
586
|
+
let i = nt(e) ? this.hierarchyWaypoints(n, r, t) : this.sequenceWaypoints(e, n, r, t), a = {
|
|
587
|
+
...e,
|
|
588
|
+
source: n,
|
|
589
|
+
target: r,
|
|
590
|
+
waypoints: i
|
|
591
|
+
}, o = i;
|
|
592
|
+
try {
|
|
593
|
+
o = this.connectionDocking.getCroppedWaypoints(a, n, r);
|
|
594
|
+
} catch {}
|
|
595
|
+
if (!rt(o)) {
|
|
596
|
+
let e = [m(n), m(r)];
|
|
597
|
+
return rt(e) ? e : [];
|
|
598
|
+
}
|
|
599
|
+
return o;
|
|
600
|
+
}
|
|
601
|
+
sequenceWaypoints(e, t, n, r) {
|
|
602
|
+
let i = (r.waypoints ?? e.waypoints ?? []).slice(1, -1).map((e) => ({
|
|
603
|
+
x: e.x,
|
|
604
|
+
y: e.y
|
|
605
|
+
}));
|
|
606
|
+
return [
|
|
607
|
+
m(t),
|
|
608
|
+
...i,
|
|
609
|
+
m(n)
|
|
610
|
+
];
|
|
611
|
+
}
|
|
612
|
+
hierarchyWaypoints(e, t, n) {
|
|
613
|
+
let r = m(e), i = m(t);
|
|
614
|
+
if (t.y >= e.y + e.height) {
|
|
615
|
+
let n = $e(e), a = n.length ? n : [t];
|
|
616
|
+
if (et(a, e)) return h(me(r, i, "v:v"));
|
|
617
|
+
let o = e.y + e.height, s = Math.min(...a.map((e) => e.y)), c = Math.max(o + Ye, (o + s) / 2), l = Math.min(...a.map((e) => e.x)), u = r.x <= l - 10 ? r.x : l - Je;
|
|
618
|
+
return h([
|
|
619
|
+
r,
|
|
620
|
+
{
|
|
621
|
+
x: r.x,
|
|
622
|
+
y: c
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
x: u,
|
|
626
|
+
y: c
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
x: u,
|
|
630
|
+
y: i.y
|
|
631
|
+
},
|
|
632
|
+
i
|
|
633
|
+
]);
|
|
634
|
+
}
|
|
635
|
+
return h(he(e, t, r, i, { preferredLayouts: ["v:v"] }));
|
|
636
|
+
}
|
|
637
|
+
};
|
|
638
|
+
function Qe(e) {
|
|
639
|
+
return {
|
|
640
|
+
min: e.x + Xe,
|
|
641
|
+
max: e.x + e.width - A(e.width, e.height) - Xe
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
function $e(e) {
|
|
645
|
+
return (e.outgoing ?? []).filter((e) => nt(e)).map((e) => e.target).filter((e) => !!e);
|
|
646
|
+
}
|
|
647
|
+
function et(e, t) {
|
|
648
|
+
if (!e.length) return !1;
|
|
649
|
+
if (e.length >= 2) {
|
|
650
|
+
let t = e.map((e) => e.y);
|
|
651
|
+
return Math.max(...t) - Math.min(...t) <= tt;
|
|
652
|
+
}
|
|
653
|
+
let n = e[0], r = n.x + n.width / 2, i = Qe(t);
|
|
654
|
+
return r >= i.min && r <= i.max;
|
|
655
|
+
}
|
|
656
|
+
var tt = 10;
|
|
657
|
+
function nt(e) {
|
|
658
|
+
return e.vcType === "hierarchy";
|
|
659
|
+
}
|
|
660
|
+
function rt(e) {
|
|
661
|
+
return e.every((e) => Number.isFinite(e.x) && Number.isFinite(e.y));
|
|
662
|
+
}
|
|
663
|
+
//#endregion
|
|
664
|
+
//#region src/modeling/VcConnectionTypeBehavior.ts
|
|
665
|
+
var it = class extends ge {
|
|
666
|
+
static $inject = ["eventBus", "modeling"];
|
|
667
|
+
constructor(e, t) {
|
|
668
|
+
super(e), this.postExecute(["element.updateProperties"], (e) => {
|
|
669
|
+
let { element: n, properties: r } = e;
|
|
670
|
+
r && "vcType" in r && x(n) && t.layoutConnection(n);
|
|
671
|
+
}, !0);
|
|
672
|
+
}
|
|
673
|
+
}, at = class extends ge {
|
|
674
|
+
modeling;
|
|
675
|
+
layouter;
|
|
676
|
+
static $inject = [
|
|
677
|
+
"eventBus",
|
|
678
|
+
"modeling",
|
|
679
|
+
"layouter"
|
|
680
|
+
];
|
|
681
|
+
constructor(e, t, n) {
|
|
682
|
+
super(e), this.modeling = t, this.layouter = n, this.postExecuted([
|
|
683
|
+
"shape.move",
|
|
684
|
+
"elements.move",
|
|
685
|
+
"shape.resize",
|
|
686
|
+
"connection.create",
|
|
687
|
+
"connection.delete"
|
|
688
|
+
], (e) => this.relayoutAffected(e), !0);
|
|
689
|
+
}
|
|
690
|
+
relayoutAffected(e) {
|
|
691
|
+
let t = [
|
|
692
|
+
e.shape,
|
|
693
|
+
...e.shapes ?? [],
|
|
694
|
+
...e.elements ?? []
|
|
695
|
+
].filter(v), n = e.connection, r = /* @__PURE__ */ new Set();
|
|
696
|
+
x(n) && n.vcType === "hierarchy" && n.source && r.add(n.source);
|
|
697
|
+
for (let e of t) {
|
|
698
|
+
ot(e).length && r.add(e);
|
|
699
|
+
for (let t of e.incoming ?? []) x(t) && t.vcType === "hierarchy" && t.source && r.add(t.source);
|
|
700
|
+
}
|
|
701
|
+
for (let e of r) for (let t of ot(e)) st(this.layouter.layoutConnection(t), t.waypoints ?? []) || this.modeling.layoutConnection(t);
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
function ot(e) {
|
|
705
|
+
return (e.outgoing ?? []).filter((e) => x(e) && e.vcType === "hierarchy");
|
|
706
|
+
}
|
|
707
|
+
function st(e, t) {
|
|
708
|
+
return e.length === t.length && e.every((e, n) => e.x === t[n].x && e.y === t[n].y);
|
|
709
|
+
}
|
|
710
|
+
//#endregion
|
|
711
|
+
//#region src/modeling/index.ts
|
|
712
|
+
var ct = {
|
|
713
|
+
__init__: [
|
|
714
|
+
"vcModeling",
|
|
715
|
+
"vcConnectionTypeBehavior",
|
|
716
|
+
"vcHierarchyRelayoutBehavior"
|
|
717
|
+
],
|
|
718
|
+
vcModeling: ["type", qe],
|
|
719
|
+
vcConnectionTypeBehavior: ["type", it],
|
|
720
|
+
vcHierarchyRelayoutBehavior: ["type", at],
|
|
721
|
+
layouter: ["type", Ze],
|
|
722
|
+
connectionDocking: ["type", fe]
|
|
723
|
+
}, lt = class extends ve {
|
|
724
|
+
vcConnect;
|
|
725
|
+
static $inject = ["eventBus", "vcConnect"];
|
|
726
|
+
constructor(e, t) {
|
|
727
|
+
super(e), this.vcConnect = t;
|
|
728
|
+
}
|
|
729
|
+
init() {
|
|
730
|
+
this.addRule("connection.start", (e) => v(e.source)), this.addRule("connection.create", (e) => {
|
|
731
|
+
let { source: t, target: n } = e, r = this.resolveType(t, n);
|
|
732
|
+
return !r || ft(t, n, r) ? !1 : { vcType: r };
|
|
733
|
+
}), this.addRule("connection.reconnect", (e) => {
|
|
734
|
+
let { source: t, target: n, connection: r } = e;
|
|
735
|
+
return !x(r) || !v(t) || !v(n) || t === n || !dt(r.vcType, t, n) ? !1 : !ft(t, n, r.vcType, r);
|
|
736
|
+
}), this.addRule("connection.updateWaypoints", (e) => x(e.connection)), this.addRule("shape.create", (e) => ut(e.target)), this.addRule("elements.create", (e) => ut(e.target)), this.addRule(["shape.move", "elements.move"], () => !0), this.addRule("shape.resize", (e) => v(e.shape)), this.addRule(["elements.align", "elements.distribute"], (e) => (e.elements ?? []).filter(v));
|
|
737
|
+
}
|
|
738
|
+
resolveType(e, t) {
|
|
739
|
+
if (!v(e) || !v(t) || e === t) return null;
|
|
740
|
+
if (y(e) && y(t)) {
|
|
741
|
+
let e = this.vcConnect.pendingType;
|
|
742
|
+
return e === "assignment" ? null : e;
|
|
743
|
+
}
|
|
744
|
+
return y(e) && b(t) || b(e) && y(t) ? "assignment" : null;
|
|
745
|
+
}
|
|
746
|
+
};
|
|
747
|
+
function ut(e) {
|
|
748
|
+
return !!e && !v(e) && !x(e) && !e.parent;
|
|
749
|
+
}
|
|
750
|
+
function dt(e, t, n) {
|
|
751
|
+
return e === "assignment" ? y(t) && b(n) || b(t) && y(n) : y(t) && y(n);
|
|
752
|
+
}
|
|
753
|
+
function ft(e, t, n, r) {
|
|
754
|
+
return [...e.outgoing ?? [], ...n === "assignment" ? e.incoming ?? [] : []].some((e) => e !== r && x(e) && e.vcType === n && (e.target === t || e.source === t));
|
|
755
|
+
}
|
|
756
|
+
//#endregion
|
|
757
|
+
//#region src/rules/index.ts
|
|
758
|
+
var pt = {
|
|
759
|
+
__depends__: [_e],
|
|
760
|
+
__init__: ["vcRules"],
|
|
761
|
+
vcRules: ["type", lt]
|
|
762
|
+
}, mt = class {
|
|
763
|
+
connect;
|
|
764
|
+
static $inject = ["connect", "eventBus"];
|
|
765
|
+
pendingType = "sequence";
|
|
766
|
+
constructor(e, t) {
|
|
767
|
+
this.connect = e, t.on([
|
|
768
|
+
"connect.cleanup",
|
|
769
|
+
"create.cleanup",
|
|
770
|
+
"global-connect.cleanup"
|
|
771
|
+
], () => {
|
|
772
|
+
this.pendingType = "sequence";
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
start(e, t, n) {
|
|
776
|
+
this.pendingType = n, this.connect.start(e, t);
|
|
777
|
+
}
|
|
778
|
+
}, ht = {
|
|
779
|
+
__depends__: [ye],
|
|
780
|
+
__init__: ["vcConnect"],
|
|
781
|
+
vcConnect: ["type", mt]
|
|
782
|
+
}, gt = class {
|
|
783
|
+
autoPlace;
|
|
784
|
+
create;
|
|
785
|
+
factory;
|
|
786
|
+
vcConnect;
|
|
787
|
+
static $inject = [
|
|
788
|
+
"autoPlace",
|
|
789
|
+
"create",
|
|
790
|
+
"vcElementFactory",
|
|
791
|
+
"vcConnect"
|
|
792
|
+
];
|
|
793
|
+
constructor(e, t, n, r) {
|
|
794
|
+
this.autoPlace = e, this.create = t, this.factory = n, this.vcConnect = r;
|
|
795
|
+
}
|
|
796
|
+
append(e, t) {
|
|
797
|
+
this.vcConnect.pendingType = t;
|
|
798
|
+
let n = this.autoPlace.append(e, this.createShape(t), { connection: { vcType: t } });
|
|
799
|
+
return this.vcConnect.pendingType = "sequence", n;
|
|
800
|
+
}
|
|
801
|
+
startAppendDrag(e, t, n) {
|
|
802
|
+
this.vcConnect.pendingType = n, this.create.start(e, this.createShape(n), { source: t });
|
|
803
|
+
}
|
|
804
|
+
createShape(e) {
|
|
805
|
+
return e === "assignment" ? this.factory.createNewOrgUnit() : this.factory.createNewStep();
|
|
806
|
+
}
|
|
807
|
+
}, _t = 200, vt = 45, yt = 45, bt = 30, xt = 20, St = 30, Ct = 10, wt = class {
|
|
808
|
+
static $inject = [
|
|
809
|
+
"eventBus",
|
|
810
|
+
"vcConnect",
|
|
811
|
+
"elementRegistry"
|
|
812
|
+
];
|
|
813
|
+
constructor(e, t, n) {
|
|
814
|
+
e.on("autoPlace", _t, (e) => {
|
|
815
|
+
let { source: n, shape: r } = e;
|
|
816
|
+
if (!v(n)) return;
|
|
817
|
+
let i = this.desiredPosition(t.pendingType, n, r);
|
|
818
|
+
return this.deconflict(i, r);
|
|
819
|
+
}), this.elementRegistry = n;
|
|
820
|
+
}
|
|
821
|
+
elementRegistry;
|
|
822
|
+
desiredPosition(e, t, n) {
|
|
823
|
+
return e === "hierarchy" ? this.hierarchyPosition(t, n) : e === "assignment" ? this.assignmentPosition(t, n) : this.sequencePosition(t, n);
|
|
824
|
+
}
|
|
825
|
+
sequencePosition(e, t) {
|
|
826
|
+
return {
|
|
827
|
+
x: e.x + e.width + vt + t.width / 2,
|
|
828
|
+
y: e.y + e.height / 2
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
assignmentPosition(e, t) {
|
|
832
|
+
return {
|
|
833
|
+
x: e.x + e.width / 2,
|
|
834
|
+
y: e.y + e.height + yt + t.height / 2
|
|
835
|
+
};
|
|
836
|
+
}
|
|
837
|
+
hierarchyPosition(e, t) {
|
|
838
|
+
let n = $e(e);
|
|
839
|
+
if (!n.length) return {
|
|
840
|
+
x: e.x + e.width / 2 + 10 + t.width / 2,
|
|
841
|
+
y: e.y + e.height + yt + t.height / 2
|
|
842
|
+
};
|
|
843
|
+
if (et(n, e)) {
|
|
844
|
+
let e = Tt(n);
|
|
845
|
+
return {
|
|
846
|
+
x: e.x + e.width + xt + t.width / 2,
|
|
847
|
+
y: e.y + t.height / 2
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
let r = Et(n);
|
|
851
|
+
return {
|
|
852
|
+
x: r.x + t.width / 2,
|
|
853
|
+
y: r.y + r.height + bt + t.height / 2
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
deconflict(e, t) {
|
|
857
|
+
let n = this.elementRegistry.getAll().filter(v), r = { ...e };
|
|
858
|
+
for (let e = 0; e < 50; e += 1) {
|
|
859
|
+
let e = {
|
|
860
|
+
x: r.x - t.width / 2 - Ct,
|
|
861
|
+
y: r.y - t.height / 2 - Ct,
|
|
862
|
+
width: t.width + 20,
|
|
863
|
+
height: t.height + 20
|
|
864
|
+
};
|
|
865
|
+
if (!n.some((t) => t.x < e.x + e.width && t.x + t.width > e.x && t.y < e.y + e.height && t.y + t.height > e.y)) break;
|
|
866
|
+
r.y += St;
|
|
867
|
+
}
|
|
868
|
+
return r;
|
|
869
|
+
}
|
|
870
|
+
};
|
|
871
|
+
function Tt(e) {
|
|
872
|
+
return e.reduce((e, t) => !e || t.x + t.width > e.x + e.width ? t : e, void 0);
|
|
873
|
+
}
|
|
874
|
+
function Et(e) {
|
|
875
|
+
return e.reduce((e, t) => !e || t.y + t.height > e.y + e.height ? t : e, void 0);
|
|
876
|
+
}
|
|
877
|
+
//#endregion
|
|
878
|
+
//#region src/append/index.ts
|
|
879
|
+
var Dt = {
|
|
880
|
+
__depends__: [
|
|
881
|
+
be,
|
|
882
|
+
xe,
|
|
883
|
+
Se
|
|
884
|
+
],
|
|
885
|
+
__init__: ["vcAutoPlaceBehavior", "vcCreatePreviewBehavior"],
|
|
886
|
+
vcAppend: ["type", gt],
|
|
887
|
+
vcAutoPlaceBehavior: ["type", wt],
|
|
888
|
+
vcCreatePreviewBehavior: ["type", class {
|
|
889
|
+
static $inject = ["injector", "eventBus"];
|
|
890
|
+
constructor(e, t) {
|
|
891
|
+
let n = e.get("connectionPreview", !1);
|
|
892
|
+
n && (t.on("create.move", (e) => {
|
|
893
|
+
let { context: t } = e, r = t.source;
|
|
894
|
+
if (!r) return;
|
|
895
|
+
let i = typeof t.canExecute == "object" && t.canExecute?.connect;
|
|
896
|
+
n.drawPreview(t, i ?? !1, {
|
|
897
|
+
source: r,
|
|
898
|
+
connectionStart: m(r),
|
|
899
|
+
connectionEnd: {
|
|
900
|
+
x: e.x,
|
|
901
|
+
y: e.y
|
|
902
|
+
},
|
|
903
|
+
noCropping: !0
|
|
904
|
+
});
|
|
905
|
+
}), t.on([
|
|
906
|
+
"create.end",
|
|
907
|
+
"create.cancel",
|
|
908
|
+
"create.cleanup"
|
|
909
|
+
], (e) => {
|
|
910
|
+
n.cleanUp(e.context);
|
|
911
|
+
}));
|
|
912
|
+
}
|
|
913
|
+
}]
|
|
914
|
+
};
|
|
915
|
+
//#endregion
|
|
916
|
+
//#region src/draw/icons.ts
|
|
917
|
+
function G(e, t = "0 0 24 24") {
|
|
918
|
+
return `<svg viewBox="${t}" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${e}</svg>`;
|
|
919
|
+
}
|
|
920
|
+
var K = {
|
|
921
|
+
handTool: G("<path d=\"M18 11V7.5a1.5 1.5 0 0 0-3 0\"/><path d=\"M15 10.5V6a1.5 1.5 0 0 0-3 0v4\"/><path d=\"M12 10V7a1.5 1.5 0 0 0-3 0v6\"/><path d=\"M18 10a1.5 1.5 0 0 1 3 0v4.5a6.5 6.5 0 0 1-6.5 6.5h-1.6c-2.1 0-3.4-.7-4.5-1.8l-3-3a1.5 1.5 0 0 1 2.1-2.1L9 15.5\"/>"),
|
|
922
|
+
lassoTool: G("<rect x=\"3.5\" y=\"5.5\" width=\"14\" height=\"11\" rx=\"1\" stroke-dasharray=\"3.2 2.4\"/><path d=\"M17.5 16.5 l3.5 3.5 M21 17.5 v2.5 h-2.5\"/>"),
|
|
923
|
+
spaceTool: G("<path d=\"M12 3.5 v17\" stroke-dasharray=\"3.2 2.4\"/><path d=\"M15 12 h5.5 m-2.5 -2.5 2.5 2.5 -2.5 2.5\"/><path d=\"M9 12 H3.5 m2.5 -2.5 L3.5 12 l2.5 2.5\"/>"),
|
|
924
|
+
globalConnect: G("<rect x=\"3\" y=\"3.5\" width=\"6\" height=\"5\" rx=\"0.5\"/><rect x=\"15\" y=\"15.5\" width=\"6\" height=\"5\" rx=\"0.5\"/><path d=\"M9.5 9.5 L14.5 14.5 m-4.2 -1 4.2 1 -1 -4.2\" stroke-dasharray=\"2.6 2\"/>"),
|
|
925
|
+
createStep: G("<path d=\"M3 7 h12 l6 5 -6 5 H3 l4.5 -5 Z\"/>"),
|
|
926
|
+
appendStep: G("<path d=\"M2.5 12 h4.5 m-2 -2 2 2 -2 2\" stroke-dasharray=\"2.6 2\"/><path d=\"M9 7 h8 l4 5 -4 5 H9 l3 -5 Z\"/>"),
|
|
927
|
+
appendSubStep: G("<path d=\"M7 3 v8.5 h2.5\" /><path d=\"M11 7 h7.5 l3 4.5 -3 4.5 H11 l2.5 -4.5 Z\" transform=\"translate(-1.5 0.5)\"/>", "0 0 22 22"),
|
|
928
|
+
connectSequence: G("<path d=\"M4 19 L17.5 5.5\" stroke-dasharray=\"3 2.6\"/><path d=\"M13 5 h5.5 v5.5\" />"),
|
|
929
|
+
connectHierarchy: G("<path d=\"M6 4 v14 h11.5 m-3.5 -3.5 3.5 3.5 -3.5 3.5\"/>"),
|
|
930
|
+
createOrgUnit: G("<ellipse cx=\"12\" cy=\"12\" rx=\"9.5\" ry=\"6.5\"/>"),
|
|
931
|
+
appendOrgUnit: G("<path d=\"M12 3.5 v5\"/><ellipse cx=\"12\" cy=\"15\" rx=\"8.5\" ry=\"5.5\"/>"),
|
|
932
|
+
toggleType: G("<path d=\"M4.5 9 h13 m-3.2 -3.2 3.2 3.2 -3.2 3.2\"/><path d=\"M19.5 15.5 h-13 m3.2 3.2 -3.2 -3.2 3.2 -3.2\" stroke-dasharray=\"2.8 2.2\"/>"),
|
|
933
|
+
align: G("<path d=\"M4 3.5 v17\"/><rect x=\"7\" y=\"6\" width=\"12\" height=\"4\" rx=\"0.5\"/><rect x=\"7\" y=\"13.5\" width=\"7.5\" height=\"4\" rx=\"0.5\"/>"),
|
|
934
|
+
color: G("<path d=\"M12 3.5 c3 4 6 7 6 10.5 a6 6 0 1 1 -12 0 c0 -3.5 3 -6.5 6 -10.5 Z\"/>"),
|
|
935
|
+
trash: G("<path d=\"M4.5 6.5 h15 M9.5 6 V4.5 h5 V6 M6.5 6.5 l1 13 h9 l1 -13 M10 10 v6 M14 10 v6\"/>")
|
|
936
|
+
};
|
|
937
|
+
function q(e, t, n = !1) {
|
|
938
|
+
return `<div class="entry vc-palette-entry"${n ? " draggable=\"true\"" : ""} title="${t}">${e}</div>`;
|
|
939
|
+
}
|
|
940
|
+
function J(e, t, n = !1) {
|
|
941
|
+
return `<div class="entry vc-cp-entry"${n ? " draggable=\"true\"" : ""} title="${t}">${e}</div>`;
|
|
942
|
+
}
|
|
943
|
+
//#endregion
|
|
944
|
+
//#region src/palette/VcPaletteProvider.ts
|
|
945
|
+
var Ot = class {
|
|
946
|
+
create;
|
|
947
|
+
factory;
|
|
948
|
+
handTool;
|
|
949
|
+
lassoTool;
|
|
950
|
+
spaceTool;
|
|
951
|
+
globalConnect;
|
|
952
|
+
static $inject = [
|
|
953
|
+
"palette",
|
|
954
|
+
"create",
|
|
955
|
+
"vcElementFactory",
|
|
956
|
+
"handTool",
|
|
957
|
+
"lassoTool",
|
|
958
|
+
"spaceTool",
|
|
959
|
+
"globalConnect"
|
|
960
|
+
];
|
|
961
|
+
constructor(e, t, n, r, i, a, o) {
|
|
962
|
+
this.create = t, this.factory = n, this.handTool = r, this.lassoTool = i, this.spaceTool = a, this.globalConnect = o, e.registerProvider(this);
|
|
963
|
+
}
|
|
964
|
+
getPaletteEntries() {
|
|
965
|
+
let e = (e) => {
|
|
966
|
+
this.create.start(e, this.factory.createNewStep());
|
|
967
|
+
}, t = (e) => {
|
|
968
|
+
this.create.start(e, this.factory.createNewOrgUnit());
|
|
969
|
+
};
|
|
970
|
+
return {
|
|
971
|
+
"hand-tool": {
|
|
972
|
+
group: "tools",
|
|
973
|
+
title: "Activate hand tool — H",
|
|
974
|
+
html: q(K.handTool, "Activate hand tool"),
|
|
975
|
+
action: { click: (e) => this.handTool.activateHand(e, !1, !1) }
|
|
976
|
+
},
|
|
977
|
+
"lasso-tool": {
|
|
978
|
+
group: "tools",
|
|
979
|
+
title: "Activate lasso tool — L",
|
|
980
|
+
html: q(K.lassoTool, "Activate lasso tool"),
|
|
981
|
+
action: { click: (e) => this.lassoTool.activateSelection(e, !1) }
|
|
982
|
+
},
|
|
983
|
+
"space-tool": {
|
|
984
|
+
group: "tools",
|
|
985
|
+
title: "Activate create/remove space tool — S",
|
|
986
|
+
html: q(K.spaceTool, "Activate create/remove space tool"),
|
|
987
|
+
action: { click: (e) => this.spaceTool.activateSelection(e, !1, !1) }
|
|
988
|
+
},
|
|
989
|
+
"global-connect-tool": {
|
|
990
|
+
group: "tools",
|
|
991
|
+
title: "Activate connect tool — C",
|
|
992
|
+
html: q(K.globalConnect, "Activate connect tool"),
|
|
993
|
+
action: { click: (e) => this.globalConnect.start(e, !1) }
|
|
994
|
+
},
|
|
995
|
+
"tool-separator": {
|
|
996
|
+
group: "tools",
|
|
997
|
+
separator: !0
|
|
998
|
+
},
|
|
999
|
+
"create.step": {
|
|
1000
|
+
group: "value-chain",
|
|
1001
|
+
title: "Create step",
|
|
1002
|
+
html: q(K.createStep, "Create step", !0),
|
|
1003
|
+
action: {
|
|
1004
|
+
click: e,
|
|
1005
|
+
dragstart: e
|
|
1006
|
+
}
|
|
1007
|
+
},
|
|
1008
|
+
"create.org-unit": {
|
|
1009
|
+
group: "value-chain",
|
|
1010
|
+
title: "Create organizational unit",
|
|
1011
|
+
html: q(K.createOrgUnit, "Create organizational unit", !0),
|
|
1012
|
+
action: {
|
|
1013
|
+
click: t,
|
|
1014
|
+
dragstart: t
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
};
|
|
1018
|
+
}
|
|
1019
|
+
}, kt = {
|
|
1020
|
+
__depends__: [
|
|
1021
|
+
Ce,
|
|
1022
|
+
xe,
|
|
1023
|
+
we,
|
|
1024
|
+
Te,
|
|
1025
|
+
Ee,
|
|
1026
|
+
De
|
|
1027
|
+
],
|
|
1028
|
+
__init__: ["vcPaletteProvider"],
|
|
1029
|
+
vcPaletteProvider: ["type", Ot]
|
|
1030
|
+
}, Y = "vc-color-picker";
|
|
1031
|
+
function At(e) {
|
|
1032
|
+
return `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><rect x="1" y="1" width="14" height="14" rx="2" fill="white" stroke="${e}" stroke-width="2"/></svg>`;
|
|
1033
|
+
}
|
|
1034
|
+
var jt = class {
|
|
1035
|
+
vcModeling;
|
|
1036
|
+
static $inject = ["popupMenu", "vcModeling"];
|
|
1037
|
+
constructor(e, t) {
|
|
1038
|
+
this.vcModeling = t, e.registerProvider(Y, this);
|
|
1039
|
+
}
|
|
1040
|
+
getPopupMenuEntries(e) {
|
|
1041
|
+
let t = Array.isArray(e) ? e[0] : e;
|
|
1042
|
+
if (!v(t)) return {};
|
|
1043
|
+
let n = {};
|
|
1044
|
+
for (let e of L) n[`color-${e.label.toLowerCase()}`] = {
|
|
1045
|
+
label: e.label,
|
|
1046
|
+
imageHtml: At(e.color ?? F.ink),
|
|
1047
|
+
action: () => this.vcModeling.setColor(t, e.color)
|
|
1048
|
+
};
|
|
1049
|
+
return n;
|
|
1050
|
+
}
|
|
1051
|
+
}, X = "vc-align-elements";
|
|
1052
|
+
function Z(e) {
|
|
1053
|
+
return `<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" aria-hidden="true">${e}</svg>`;
|
|
1054
|
+
}
|
|
1055
|
+
var Q = {
|
|
1056
|
+
left: Z("<path d=\"M3 2v12\"/><rect x=\"5\" y=\"4\" width=\"8\" height=\"3\"/><rect x=\"5\" y=\"9\" width=\"5\" height=\"3\"/>"),
|
|
1057
|
+
center: Z("<path d=\"M8 2v12\"/><rect x=\"4\" y=\"4\" width=\"8\" height=\"3\"/><rect x=\"5.5\" y=\"9\" width=\"5\" height=\"3\"/>"),
|
|
1058
|
+
right: Z("<path d=\"M13 2v12\"/><rect x=\"3\" y=\"4\" width=\"8\" height=\"3\"/><rect x=\"6\" y=\"9\" width=\"5\" height=\"3\"/>"),
|
|
1059
|
+
top: Z("<path d=\"M2 3h12\"/><rect x=\"4\" y=\"5\" width=\"3\" height=\"8\"/><rect x=\"9\" y=\"5\" width=\"3\" height=\"5\"/>"),
|
|
1060
|
+
middle: Z("<path d=\"M2 8h12\"/><rect x=\"4\" y=\"4\" width=\"3\" height=\"8\"/><rect x=\"9\" y=\"5.5\" width=\"3\" height=\"5\"/>"),
|
|
1061
|
+
bottom: Z("<path d=\"M2 13h12\"/><rect x=\"4\" y=\"3\" width=\"3\" height=\"8\"/><rect x=\"9\" y=\"6\" width=\"3\" height=\"5\"/>"),
|
|
1062
|
+
horizontal: Z("<rect x=\"2\" y=\"5\" width=\"3\" height=\"6\"/><rect x=\"6.5\" y=\"5\" width=\"3\" height=\"6\"/><rect x=\"11\" y=\"5\" width=\"3\" height=\"6\"/>"),
|
|
1063
|
+
vertical: Z("<rect x=\"5\" y=\"2\" width=\"6\" height=\"3\"/><rect x=\"5\" y=\"6.5\" width=\"6\" height=\"3\"/><rect x=\"5\" y=\"11\" width=\"6\" height=\"3\"/>")
|
|
1064
|
+
}, Mt = class {
|
|
1065
|
+
alignElements;
|
|
1066
|
+
distributeElements;
|
|
1067
|
+
static $inject = [
|
|
1068
|
+
"popupMenu",
|
|
1069
|
+
"alignElements",
|
|
1070
|
+
"distributeElements"
|
|
1071
|
+
];
|
|
1072
|
+
constructor(e, t, n) {
|
|
1073
|
+
this.alignElements = t, this.distributeElements = n, e.registerProvider(X, this);
|
|
1074
|
+
}
|
|
1075
|
+
getPopupMenuEntries(e) {
|
|
1076
|
+
let t = (Array.isArray(e) ? e : [e]).filter(v);
|
|
1077
|
+
if (t.length < 2) return {};
|
|
1078
|
+
let n = (e, n, r) => ({
|
|
1079
|
+
label: n,
|
|
1080
|
+
group: "align",
|
|
1081
|
+
imageHtml: r,
|
|
1082
|
+
action: () => this.alignElements.trigger(t, e)
|
|
1083
|
+
}), r = {
|
|
1084
|
+
"align-left": n("left", "Align left", Q.left),
|
|
1085
|
+
"align-center": n("center", "Align center", Q.center),
|
|
1086
|
+
"align-right": n("right", "Align right", Q.right),
|
|
1087
|
+
"align-top": n("top", "Align top", Q.top),
|
|
1088
|
+
"align-middle": n("middle", "Align middle", Q.middle),
|
|
1089
|
+
"align-bottom": n("bottom", "Align bottom", Q.bottom)
|
|
1090
|
+
};
|
|
1091
|
+
return t.length >= 3 && (r["distribute-horizontally"] = {
|
|
1092
|
+
label: "Distribute horizontally",
|
|
1093
|
+
group: "distribute",
|
|
1094
|
+
imageHtml: Q.horizontal,
|
|
1095
|
+
action: () => this.distributeElements.trigger(t, "horizontal")
|
|
1096
|
+
}, r["distribute-vertically"] = {
|
|
1097
|
+
label: "Distribute vertically",
|
|
1098
|
+
group: "distribute",
|
|
1099
|
+
imageHtml: Q.vertical,
|
|
1100
|
+
action: () => this.distributeElements.trigger(t, "vertical")
|
|
1101
|
+
}), r;
|
|
1102
|
+
}
|
|
1103
|
+
}, Nt = class {
|
|
1104
|
+
modeling;
|
|
1105
|
+
popupMenu;
|
|
1106
|
+
vcAppend;
|
|
1107
|
+
vcConnect;
|
|
1108
|
+
vcModeling;
|
|
1109
|
+
static $inject = [
|
|
1110
|
+
"contextPad",
|
|
1111
|
+
"modeling",
|
|
1112
|
+
"popupMenu",
|
|
1113
|
+
"vcAppend",
|
|
1114
|
+
"vcConnect",
|
|
1115
|
+
"vcModeling"
|
|
1116
|
+
];
|
|
1117
|
+
constructor(e, t, n, r, i, a) {
|
|
1118
|
+
this.modeling = t, this.popupMenu = n, this.vcAppend = r, this.vcConnect = i, this.vcModeling = a, e.registerProvider(this);
|
|
1119
|
+
}
|
|
1120
|
+
getContextPadEntries(e) {
|
|
1121
|
+
let t = {};
|
|
1122
|
+
if (y(e) && this.addStepEntries(t, e), b(e)) {
|
|
1123
|
+
let n = (t) => {
|
|
1124
|
+
this.vcConnect.start(t, e, "assignment");
|
|
1125
|
+
};
|
|
1126
|
+
t["connect.assignment"] = {
|
|
1127
|
+
group: "connect",
|
|
1128
|
+
title: "Connect to step",
|
|
1129
|
+
html: J(K.connectHierarchy, "Connect to step", !0),
|
|
1130
|
+
action: {
|
|
1131
|
+
click: n,
|
|
1132
|
+
dragstart: n
|
|
1133
|
+
}
|
|
1134
|
+
};
|
|
1135
|
+
}
|
|
1136
|
+
if (v(e) && (t["set-color"] = {
|
|
1137
|
+
group: "edit",
|
|
1138
|
+
title: "Set color",
|
|
1139
|
+
html: J(K.color, "Set color"),
|
|
1140
|
+
action: { click: (t) => {
|
|
1141
|
+
let n = t;
|
|
1142
|
+
this.popupMenu.open(e, Y, {
|
|
1143
|
+
x: n.clientX,
|
|
1144
|
+
y: n.clientY
|
|
1145
|
+
});
|
|
1146
|
+
} }
|
|
1147
|
+
}), x(e) && e.vcType !== "assignment") {
|
|
1148
|
+
let n = e, r = n.vcType === "sequence" ? "hierarchy" : "sequence";
|
|
1149
|
+
t["toggle-type"] = {
|
|
1150
|
+
group: "edit",
|
|
1151
|
+
title: `Switch to "${r === "sequence" ? "is predecessor of" : "is process-oriented superior"}"`,
|
|
1152
|
+
html: J(K.toggleType, "Switch relation type"),
|
|
1153
|
+
action: { click: () => this.vcModeling.setConnectionType(n, r) }
|
|
1154
|
+
};
|
|
1155
|
+
}
|
|
1156
|
+
return (v(e) || x(e)) && (t.delete = {
|
|
1157
|
+
group: "edit",
|
|
1158
|
+
title: "Delete",
|
|
1159
|
+
html: J(K.trash, "Delete"),
|
|
1160
|
+
action: { click: () => this.modeling.removeElements([e]) }
|
|
1161
|
+
}), t;
|
|
1162
|
+
}
|
|
1163
|
+
getMultiElementContextPadEntries(e) {
|
|
1164
|
+
let t = {};
|
|
1165
|
+
return e.filter(v).length >= 2 && (t.align = {
|
|
1166
|
+
group: "edit",
|
|
1167
|
+
title: "Align / distribute",
|
|
1168
|
+
html: J(K.align, "Align / distribute"),
|
|
1169
|
+
action: { click: (t) => {
|
|
1170
|
+
let n = t;
|
|
1171
|
+
this.popupMenu.open(e, X, {
|
|
1172
|
+
x: n.clientX,
|
|
1173
|
+
y: n.clientY
|
|
1174
|
+
});
|
|
1175
|
+
} }
|
|
1176
|
+
}), t.delete = {
|
|
1177
|
+
group: "edit",
|
|
1178
|
+
title: "Delete",
|
|
1179
|
+
html: J(K.trash, "Delete"),
|
|
1180
|
+
action: { click: () => this.modeling.removeElements([...e]) }
|
|
1181
|
+
}, t;
|
|
1182
|
+
}
|
|
1183
|
+
addStepEntries(e, t) {
|
|
1184
|
+
let n = (e) => () => {
|
|
1185
|
+
this.vcAppend.append(t, e);
|
|
1186
|
+
}, r = (e) => (n) => {
|
|
1187
|
+
this.vcAppend.startAppendDrag(n, t, e);
|
|
1188
|
+
}, i = (e) => (n) => {
|
|
1189
|
+
this.vcConnect.start(n, t, e);
|
|
1190
|
+
};
|
|
1191
|
+
e["append.step"] = {
|
|
1192
|
+
group: "model",
|
|
1193
|
+
title: "Append step (is predecessor of)",
|
|
1194
|
+
html: J(K.appendStep, "Append step (is predecessor of)", !0),
|
|
1195
|
+
action: {
|
|
1196
|
+
click: n("sequence"),
|
|
1197
|
+
dragstart: r("sequence")
|
|
1198
|
+
}
|
|
1199
|
+
}, e["append.sub-step"] = {
|
|
1200
|
+
group: "model",
|
|
1201
|
+
title: "Append sub-step (is process-oriented superior)",
|
|
1202
|
+
html: J(K.appendSubStep, "Append sub-step (is process-oriented superior)", !0),
|
|
1203
|
+
action: {
|
|
1204
|
+
click: n("hierarchy"),
|
|
1205
|
+
dragstart: r("hierarchy")
|
|
1206
|
+
}
|
|
1207
|
+
}, e["append.org-unit"] = {
|
|
1208
|
+
group: "model",
|
|
1209
|
+
title: "Append organizational unit",
|
|
1210
|
+
html: J(K.appendOrgUnit, "Append organizational unit", !0),
|
|
1211
|
+
action: {
|
|
1212
|
+
click: n("assignment"),
|
|
1213
|
+
dragstart: r("assignment")
|
|
1214
|
+
}
|
|
1215
|
+
}, e["connect.sequence"] = {
|
|
1216
|
+
group: "connect",
|
|
1217
|
+
title: "Connect (is predecessor of)",
|
|
1218
|
+
html: J(K.connectSequence, "Connect (is predecessor of)", !0),
|
|
1219
|
+
action: {
|
|
1220
|
+
click: i("sequence"),
|
|
1221
|
+
dragstart: i("sequence")
|
|
1222
|
+
}
|
|
1223
|
+
}, e["connect.hierarchy"] = {
|
|
1224
|
+
group: "connect",
|
|
1225
|
+
title: "Connect (is process-oriented superior)",
|
|
1226
|
+
html: J(K.connectHierarchy, "Connect (is process-oriented superior)", !0),
|
|
1227
|
+
action: {
|
|
1228
|
+
click: i("hierarchy"),
|
|
1229
|
+
dragstart: i("hierarchy")
|
|
1230
|
+
}
|
|
1231
|
+
};
|
|
1232
|
+
}
|
|
1233
|
+
}, Pt = {
|
|
1234
|
+
__depends__: [Oe, g],
|
|
1235
|
+
__init__: ["vcContextPadProvider"],
|
|
1236
|
+
vcContextPadProvider: ["type", Nt]
|
|
1237
|
+
}, Ft = class {
|
|
1238
|
+
directEditing;
|
|
1239
|
+
canvas;
|
|
1240
|
+
vcModeling;
|
|
1241
|
+
static $inject = [
|
|
1242
|
+
"directEditing",
|
|
1243
|
+
"canvas",
|
|
1244
|
+
"eventBus",
|
|
1245
|
+
"vcModeling"
|
|
1246
|
+
];
|
|
1247
|
+
constructor(e, t, n, r) {
|
|
1248
|
+
this.directEditing = e, this.canvas = t, this.vcModeling = r, e.registerProvider(this), n.on("element.dblclick", (t) => {
|
|
1249
|
+
t.element && v(t.element) && e.activate(t.element);
|
|
1250
|
+
}), n.on("autoPlace.end", 500, (t) => {
|
|
1251
|
+
t.shape && v(t.shape) && e.activate(t.shape);
|
|
1252
|
+
}), n.on("create.end", 500, (t) => {
|
|
1253
|
+
let { source: n, shape: r, canExecute: i } = t.context;
|
|
1254
|
+
n && i && r && v(r) && e.activate(r);
|
|
1255
|
+
}), n.on([
|
|
1256
|
+
"element.mousedown",
|
|
1257
|
+
"drag.init",
|
|
1258
|
+
"canvas.viewbox.changing",
|
|
1259
|
+
"autoPlace.start",
|
|
1260
|
+
"popupMenu.open"
|
|
1261
|
+
], () => {
|
|
1262
|
+
e.isActive() && e.complete();
|
|
1263
|
+
}), n.on(["commandStack.changed", "diagram.destroy"], () => {
|
|
1264
|
+
e.isActive() && e.cancel();
|
|
1265
|
+
});
|
|
1266
|
+
}
|
|
1267
|
+
activate(e) {
|
|
1268
|
+
if (!v(e)) return;
|
|
1269
|
+
let t = e, n = this.canvas.getAbsoluteBBox(t), r = this.canvas.zoom(), i = (b(t) ? 12 : M(t.width, t.height)) * r;
|
|
1270
|
+
return {
|
|
1271
|
+
bounds: {
|
|
1272
|
+
x: n.x + i,
|
|
1273
|
+
y: n.y,
|
|
1274
|
+
width: n.width - i * 2,
|
|
1275
|
+
height: n.height
|
|
1276
|
+
},
|
|
1277
|
+
style: {
|
|
1278
|
+
fontFamily: I.family,
|
|
1279
|
+
fontSize: `${I.size * r}px`,
|
|
1280
|
+
fontWeight: "normal",
|
|
1281
|
+
lineHeight: String(I.lineHeight),
|
|
1282
|
+
textAlign: "center"
|
|
1283
|
+
},
|
|
1284
|
+
options: { centerVertically: !0 },
|
|
1285
|
+
text: t.vcLabel || ""
|
|
1286
|
+
};
|
|
1287
|
+
}
|
|
1288
|
+
update(e, t) {
|
|
1289
|
+
this.vcModeling.updateLabel(e, It(t));
|
|
1290
|
+
}
|
|
1291
|
+
};
|
|
1292
|
+
function It(e) {
|
|
1293
|
+
return e.replace(/\r\n?/g, "\n").trim();
|
|
1294
|
+
}
|
|
1295
|
+
//#endregion
|
|
1296
|
+
//#region src/label-editing/index.ts
|
|
1297
|
+
var Lt = {
|
|
1298
|
+
__depends__: [ke],
|
|
1299
|
+
__init__: ["vcLabelEditingProvider"],
|
|
1300
|
+
vcLabelEditingProvider: ["type", Ft]
|
|
1301
|
+
}, Rt = {
|
|
1302
|
+
__depends__: [g],
|
|
1303
|
+
__init__: ["vcColorPickerProvider"],
|
|
1304
|
+
vcColorPickerProvider: ["type", jt]
|
|
1305
|
+
}, zt = {
|
|
1306
|
+
__depends__: [
|
|
1307
|
+
g,
|
|
1308
|
+
Ae,
|
|
1309
|
+
je
|
|
1310
|
+
],
|
|
1311
|
+
__init__: ["vcAlignMenuProvider"],
|
|
1312
|
+
vcAlignMenuProvider: ["type", Mt]
|
|
1313
|
+
}, $ = class extends Pe {
|
|
1314
|
+
registerBindings(e, t) {
|
|
1315
|
+
super.registerBindings(e, t);
|
|
1316
|
+
let n = (n, r) => {
|
|
1317
|
+
t.isRegistered(n) && e.addListener(r);
|
|
1318
|
+
}, r = (e, r) => {
|
|
1319
|
+
n(e, (n) => {
|
|
1320
|
+
let i = n.keyEvent;
|
|
1321
|
+
if (Ie(r, i) && !Fe(i)) return t.trigger(e, {}), !0;
|
|
1322
|
+
});
|
|
1323
|
+
};
|
|
1324
|
+
r("handTool", ["h", "H"]), r("lassoTool", ["l", "L"]), r("spaceTool", ["s", "S"]), r("globalConnectTool", ["c", "C"]), r("directEditing", ["e", "E"]);
|
|
1325
|
+
}
|
|
1326
|
+
}, Bt = 1500, Vt = class {
|
|
1327
|
+
static $inject = ["eventBus", "injector"];
|
|
1328
|
+
constructor(e, t) {
|
|
1329
|
+
e.on("editorActions.init", Bt, (e) => {
|
|
1330
|
+
let { editorActions: n } = e, r = (e, r, i) => {
|
|
1331
|
+
let a = t.get(r, !1);
|
|
1332
|
+
a && n.register({ [e]: () => i(a) });
|
|
1333
|
+
};
|
|
1334
|
+
r("handTool", "handTool", (e) => e.toggle()), r("lassoTool", "lassoTool", (e) => e.toggle()), r("spaceTool", "spaceTool", (e) => e.toggle()), r("globalConnectTool", "globalConnect", (e) => e.toggle());
|
|
1335
|
+
let i = t.get("directEditing", !1), a = t.get("selection", !1);
|
|
1336
|
+
i && a && n.register({ directEditing: () => {
|
|
1337
|
+
let e = a.get();
|
|
1338
|
+
e.length === 1 && e[0] && i.activate(e[0]);
|
|
1339
|
+
} });
|
|
1340
|
+
});
|
|
1341
|
+
}
|
|
1342
|
+
}, Ht = {
|
|
1343
|
+
__depends__: [Me, Ne],
|
|
1344
|
+
__init__: ["vcEditorActions"],
|
|
1345
|
+
keyboardBindings: ["type", $],
|
|
1346
|
+
vcEditorActions: ["type", Vt]
|
|
1347
|
+
}, Ut = class extends Le {
|
|
1348
|
+
static $inject = ["eventBus"];
|
|
1349
|
+
constructor(e) {
|
|
1350
|
+
super(e);
|
|
1351
|
+
}
|
|
1352
|
+
getOrdering(e, t) {
|
|
1353
|
+
return x(e) ? {
|
|
1354
|
+
parent: t,
|
|
1355
|
+
index: (t.children ?? []).filter((t) => t !== e && x(t)).length
|
|
1356
|
+
} : { parent: t };
|
|
1357
|
+
}
|
|
1358
|
+
}, Wt = {
|
|
1359
|
+
__init__: ["vcOrderingProvider"],
|
|
1360
|
+
vcOrderingProvider: ["type", Ut]
|
|
1361
|
+
}, Gt = class {
|
|
1362
|
+
static $inject = ["eventBus"];
|
|
1363
|
+
constructor(e) {
|
|
1364
|
+
e.on("copyPaste.copyElement", (e) => {
|
|
1365
|
+
let { descriptor: t, element: n } = e;
|
|
1366
|
+
v(n) ? (t.vcType = n.vcType, t.vcLabel = n.vcLabel, n.color !== void 0 && (t.color = n.color), n.link !== void 0 && (t.link = n.link)) : x(n) && (t.vcType = n.vcType);
|
|
1367
|
+
});
|
|
1368
|
+
}
|
|
1369
|
+
}, Kt = {
|
|
1370
|
+
__depends__: [Re],
|
|
1371
|
+
__init__: ["vcCopyPasteBehavior"],
|
|
1372
|
+
vcCopyPasteBehavior: ["type", Gt]
|
|
1373
|
+
}, qt = class {
|
|
1374
|
+
static $inject = ["eventBus"];
|
|
1375
|
+
constructor(e) {
|
|
1376
|
+
e.on("resize.start", (e) => {
|
|
1377
|
+
v(e.context.shape) && (e.context.minDimensions = { ...a });
|
|
1378
|
+
}), e.on("spaceTool.getMinDimensions", (e) => {
|
|
1379
|
+
let t = {};
|
|
1380
|
+
for (let n of e.shapes) v(n) && (t[n.id] = { ...a });
|
|
1381
|
+
return t;
|
|
1382
|
+
});
|
|
1383
|
+
}
|
|
1384
|
+
}, Jt = {
|
|
1385
|
+
__depends__: [ze],
|
|
1386
|
+
__init__: ["vcResizeBehavior"],
|
|
1387
|
+
vcResizeBehavior: ["type", qt]
|
|
1388
|
+
}, Yt = class extends Ue {
|
|
1389
|
+
_getModules() {
|
|
1390
|
+
return [
|
|
1391
|
+
...super._getModules(),
|
|
1392
|
+
re,
|
|
1393
|
+
ie,
|
|
1394
|
+
ae,
|
|
1395
|
+
oe,
|
|
1396
|
+
se,
|
|
1397
|
+
ce,
|
|
1398
|
+
le,
|
|
1399
|
+
ue,
|
|
1400
|
+
de,
|
|
1401
|
+
ct,
|
|
1402
|
+
pt,
|
|
1403
|
+
ht,
|
|
1404
|
+
Dt,
|
|
1405
|
+
kt,
|
|
1406
|
+
Pt,
|
|
1407
|
+
Lt,
|
|
1408
|
+
Rt,
|
|
1409
|
+
zt,
|
|
1410
|
+
Ht,
|
|
1411
|
+
Wt,
|
|
1412
|
+
Kt,
|
|
1413
|
+
Jt
|
|
1414
|
+
];
|
|
1415
|
+
}
|
|
1416
|
+
undo() {
|
|
1417
|
+
this.get("commandStack").undo();
|
|
1418
|
+
}
|
|
1419
|
+
redo() {
|
|
1420
|
+
this.get("commandStack").redo();
|
|
1421
|
+
}
|
|
1422
|
+
canUndo() {
|
|
1423
|
+
return this.get("commandStack").canUndo();
|
|
1424
|
+
}
|
|
1425
|
+
canRedo() {
|
|
1426
|
+
return this.get("commandStack").canRedo();
|
|
1427
|
+
}
|
|
1428
|
+
};
|
|
1429
|
+
//#endregion
|
|
1430
|
+
export { X as ALIGN_MENU_PROVIDER_ID, F as COLORS, L as COLOR_OPTIONS, Y as COLOR_PICKER_PROVIDER_ID, I as FONT, K as ICONS, Yt as Modeler, Ue as NavigatedViewer, B as ROOT_ID, Mt as VcAlignMenuProvider, gt as VcAppend, T as VcBaseViewer, jt as VcColorPickerProvider, mt as VcConnect, it as VcConnectionTypeBehavior, Nt as VcContextPadProvider, Gt as VcCopyPasteBehavior, O as VcDiagramElementFactory, Vt as VcEditorActions, D as VcElementFactory, H as VcExporter, V as VcImporter, $ as VcKeyboardBindings, Ft as VcLabelEditingProvider, Ze as VcLayouter, qe as VcModeling, Ut as VcOrderingProvider, Ot as VcPaletteProvider, R as VcRenderer, qt as VcResizeBehavior, lt as VcRules, W as Viewer, j as chevronPath, N as chevronPathAt, P as ellipsePathAt, U as ioModule, b as isOrgUnit, y as isStep, x as isVcConnection, S as isVcElement, v as isVcShape, A as notchDepth, w as saveSVG, zt as vcAlignMenuModule, Dt as vcAppendModule, Rt as vcColorPickerModule, ht as vcConnectModule, Pt as vcContextPadModule, Kt as vcCopyPasteModule, z as vcDrawModule, Ht as vcKeyboardModule, Lt as vcLabelEditingModule, k as vcModelModule, ct as vcModelingModule, Wt as vcOrderingModule, kt as vcPaletteModule, Jt as vcResizeModule, pt as vcRulesModule };
|
|
1431
|
+
|
|
1432
|
+
//# sourceMappingURL=index.js.map
|