bpmn-auto-layout-extended 1.0.2
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 +85 -0
- package/dist/index.cjs +1671 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +1669 -0
- package/dist/index.js.map +1 -0
- package/package.json +63 -0
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# bpmn-auto-layout-extended
|
|
2
|
+
|
|
3
|
+
[](https://github.com/krasucki/bpmn-auto-layout-extended/actions/workflows/CI.yml)
|
|
4
|
+
|
|
5
|
+
Extended fork of [bpmn-auto-layout](https://github.com/bpmn-io/bpmn-auto-layout) with support for collaborations, message flows, text annotations, groups, and sub-process expansion.
|
|
6
|
+
|
|
7
|
+
Create and layout the graphical representation of a BPMN diagram.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
This library works with [Node.js](https://nodejs.org/) and in the browser.
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
import { layoutProcess } from 'bpmn-auto-layout';
|
|
15
|
+
|
|
16
|
+
import diagramXML from './diagram.bpmn';
|
|
17
|
+
|
|
18
|
+
const diagramWithLayoutXML = await layoutProcess(diagramXML);
|
|
19
|
+
|
|
20
|
+
console.log(diagramWithLayoutXML);
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Options
|
|
24
|
+
|
|
25
|
+
```javascript
|
|
26
|
+
await layoutProcess(diagramXML, options);
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
| Option | Type | Default | Description |
|
|
30
|
+
|---|---|---|---|
|
|
31
|
+
| `expandSubProcesses` | `boolean` | `false` | Expand all sub-processes inline instead of leaving them collapsed |
|
|
32
|
+
|
|
33
|
+
## What this fork adds
|
|
34
|
+
|
|
35
|
+
* **All participants laid out** — all participants in a collaboration are positioned, not just the first.
|
|
36
|
+
* **Message flows** — message flows between participants are routed as orthogonal edges.
|
|
37
|
+
* **Text annotations and associations** — process-level and collaboration-level annotations are positioned above their associated element.
|
|
38
|
+
* **Groups** — group shapes are emitted around their member elements.
|
|
39
|
+
* **Original participant gap preserved** — the gap between pool lanes from the input is carried over (capped at 100 px); annotations are accommodated by expanding the pool height.
|
|
40
|
+
* **Sub-process expand support** — collapsed sub-processes retain their inner layout so they can be expanded; use `expandSubProcesses: true` to expand them inline during layout.
|
|
41
|
+
|
|
42
|
+
## Resources
|
|
43
|
+
|
|
44
|
+
* [Issues](https://github.com/bpmn-io/bpmn-auto-layout/issues)
|
|
45
|
+
|
|
46
|
+
## Build and Run
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
# install dependencies
|
|
50
|
+
npm install
|
|
51
|
+
|
|
52
|
+
# build and run tests
|
|
53
|
+
npm run all
|
|
54
|
+
|
|
55
|
+
# run example
|
|
56
|
+
npm start
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Test
|
|
60
|
+
|
|
61
|
+
We use snapshot testing to verify old and new layout attempts. A mismatch is indicated as a test failure.
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
# run tests
|
|
65
|
+
npm test
|
|
66
|
+
|
|
67
|
+
# inspect the results
|
|
68
|
+
npm run test:inspect
|
|
69
|
+
|
|
70
|
+
# run update snapshots
|
|
71
|
+
npm run test:update-snapshots
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Add new test cases to [`test/fixtures`](./test/fixtures) and they will be picked up automatically.
|
|
75
|
+
|
|
76
|
+
To pass options to a fixture, create a sidecar `<fixture>.options.json` file next to it:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
test/fixtures/my-diagram.bpmn
|
|
80
|
+
test/fixtures/my-diagram.bpmn.options.json ← { "expandSubProcesses": true }
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## License
|
|
84
|
+
|
|
85
|
+
MIT
|