@bpmnkit/core 0.0.26 → 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/dist/bpmn/auto-layout.js +71 -139
- package/dist/bpmn/bpmn-builder.d.ts +30 -0
- package/dist/bpmn/bpmn-builder.js +343 -31
- package/dist/bpmn/di-check.d.ts +14 -0
- package/dist/bpmn/di-check.js +51 -0
- package/dist/bpmn/svg.js +14 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/layout/annotations.d.ts +27 -0
- package/dist/layout/annotations.js +251 -0
- package/dist/layout/grid/edge-labels.d.ts +8 -0
- package/dist/layout/grid/edge-labels.js +126 -0
- package/dist/layout/grid/flow-graph.d.ts +25 -0
- package/dist/layout/grid/flow-graph.js +99 -0
- package/dist/layout/grid/grid-engine.d.ts +4 -0
- package/dist/layout/grid/grid-engine.js +214 -0
- package/dist/layout/grid/grid-router.d.ts +36 -0
- package/dist/layout/grid/grid-router.js +190 -0
- package/dist/layout/grid/grid.d.ts +43 -0
- package/dist/layout/grid/grid.js +174 -0
- package/dist/layout/grid/walker.d.ts +11 -0
- package/dist/layout/grid/walker.js +126 -0
- package/dist/layout/index.d.ts +2 -5
- package/dist/layout/index.js +1 -4
- package/dist/layout/layout-engine.d.ts +5 -15
- package/dist/layout/layout-engine.js +8 -478
- package/dist/layout/types.d.ts +2 -2
- package/dist/layout/types.js +6 -2
- package/dist/xml/xml-parser.js +5 -0
- package/package.json +1 -1
- package/dist/layout/astar.d.ts +0 -15
- package/dist/layout/astar.js +0 -191
- package/dist/layout/block-builder.d.ts +0 -37
- package/dist/layout/block-builder.js +0 -154
- package/dist/layout/block-layout.d.ts +0 -9
- package/dist/layout/block-layout.js +0 -163
- package/dist/layout/coordinates.d.ts +0 -85
- package/dist/layout/coordinates.js +0 -1392
- package/dist/layout/crossing.d.ts +0 -8
- package/dist/layout/crossing.js +0 -60
- package/dist/layout/graph.d.ts +0 -28
- package/dist/layout/graph.js +0 -126
- package/dist/layout/layers.d.ts +0 -13
- package/dist/layout/layers.js +0 -49
- package/dist/layout/routing.d.ts +0 -33
- package/dist/layout/routing.js +0 -622
- package/dist/layout/subprocess.d.ts +0 -14
- package/dist/layout/subprocess.js +0 -77
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { layoutFlowNodes } from "./layout-engine.js";
|
|
2
|
-
import { SUBPROCESS_PADDING } from "./types.js";
|
|
3
|
-
/**
|
|
4
|
-
* Check if a node type is a sub-process container.
|
|
5
|
-
*/
|
|
6
|
-
export function isSubProcess(type) {
|
|
7
|
-
return type === "subProcess" || type === "adHocSubProcess" || type === "eventSubProcess";
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Perform recursive layout for sub-process containers.
|
|
11
|
-
* Lays out internal elements in local coordinates, then sizes the
|
|
12
|
-
* sub-process to fit its content with padding, and translates internal
|
|
13
|
-
* elements into the parent coordinate space.
|
|
14
|
-
*/
|
|
15
|
-
export function layoutSubProcesses(layoutNodes, nodeIndex) {
|
|
16
|
-
const childResults = [];
|
|
17
|
-
for (const layoutNode of layoutNodes) {
|
|
18
|
-
const bpmnNode = nodeIndex.get(layoutNode.id);
|
|
19
|
-
if (!bpmnNode || !isSubProcess(bpmnNode.type))
|
|
20
|
-
continue;
|
|
21
|
-
const subProcess = bpmnNode;
|
|
22
|
-
if (!subProcess.flowElements || subProcess.flowElements.length === 0)
|
|
23
|
-
continue;
|
|
24
|
-
const childResult = layoutFlowNodes(subProcess.flowElements, subProcess.sequenceFlows ?? []);
|
|
25
|
-
if (childResult.nodes.length === 0)
|
|
26
|
-
continue;
|
|
27
|
-
// Compute bounding box of child elements
|
|
28
|
-
let minX = Number.POSITIVE_INFINITY;
|
|
29
|
-
let minY = Number.POSITIVE_INFINITY;
|
|
30
|
-
let maxX = Number.NEGATIVE_INFINITY;
|
|
31
|
-
let maxY = Number.NEGATIVE_INFINITY;
|
|
32
|
-
for (const child of childResult.nodes) {
|
|
33
|
-
minX = Math.min(minX, child.bounds.x);
|
|
34
|
-
minY = Math.min(minY, child.bounds.y);
|
|
35
|
-
maxX = Math.max(maxX, child.bounds.x + child.bounds.width);
|
|
36
|
-
maxY = Math.max(maxY, child.bounds.y + child.bounds.height);
|
|
37
|
-
}
|
|
38
|
-
const contentWidth = maxX - minX;
|
|
39
|
-
const contentHeight = maxY - minY;
|
|
40
|
-
// Size the sub-process to fit content with padding
|
|
41
|
-
const originalCenterY = layoutNode.bounds.y + layoutNode.bounds.height / 2;
|
|
42
|
-
layoutNode.bounds.width = contentWidth + SUBPROCESS_PADDING * 2;
|
|
43
|
-
layoutNode.bounds.height = contentHeight + SUBPROCESS_PADDING * 2;
|
|
44
|
-
layoutNode.isExpanded = true;
|
|
45
|
-
// Re-center vertically on the original baseline position
|
|
46
|
-
layoutNode.bounds.y = originalCenterY - layoutNode.bounds.height / 2;
|
|
47
|
-
// Translate child coordinates into parent space
|
|
48
|
-
const offsetX = layoutNode.bounds.x + SUBPROCESS_PADDING - minX;
|
|
49
|
-
const offsetY = layoutNode.bounds.y + SUBPROCESS_PADDING - minY;
|
|
50
|
-
for (const child of childResult.nodes) {
|
|
51
|
-
child.bounds.x += offsetX;
|
|
52
|
-
child.bounds.y += offsetY;
|
|
53
|
-
if (child.labelBounds) {
|
|
54
|
-
child.labelBounds.x += offsetX;
|
|
55
|
-
child.labelBounds.y += offsetY;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
for (const edge of childResult.edges) {
|
|
59
|
-
for (const wp of edge.waypoints) {
|
|
60
|
-
wp.x += offsetX;
|
|
61
|
-
wp.y += offsetY;
|
|
62
|
-
}
|
|
63
|
-
if (edge.labelBounds) {
|
|
64
|
-
edge.labelBounds.x += offsetX;
|
|
65
|
-
edge.labelBounds.y += offsetY;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
childResults.push({
|
|
69
|
-
parentId: layoutNode.id,
|
|
70
|
-
result: childResult,
|
|
71
|
-
parentX: layoutNode.bounds.x,
|
|
72
|
-
parentY: layoutNode.bounds.y,
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
return childResults;
|
|
76
|
-
}
|
|
77
|
-
//# sourceMappingURL=subprocess.js.map
|