bpmn-auto-layout 0.3.0 → 0.5.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 +0 -3
- package/dist/{index.esm.js → index.cjs} +333 -113
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +330 -114
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
- package/dist/index.esm.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
> :warning: __This project is not officially maintained.__ You are still welcome to contribute, e.g. by fixing issues or creating enhancements.
|
|
2
|
-
|
|
3
|
-
|
|
4
1
|
# bpmn-auto-layout
|
|
5
2
|
|
|
6
3
|
[](https://github.com/bpmn-io/bpmn-auto-layout/actions/workflows/CI.yml)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var BPMNModdle = require('bpmn-moddle');
|
|
4
|
+
var minDash = require('min-dash');
|
|
3
5
|
|
|
4
6
|
function isConnection(element) {
|
|
5
7
|
return !!element.sourceRef;
|
|
@@ -14,8 +16,34 @@ class Grid {
|
|
|
14
16
|
this.grid = [];
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
add(element) {
|
|
18
|
-
|
|
19
|
+
add(element, position) {
|
|
20
|
+
if (!position) {
|
|
21
|
+
this._addStart(element);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const [ row, col ] = position;
|
|
26
|
+
if (!row && !col) {
|
|
27
|
+
this._addStart(element);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (!this.grid[row]) {
|
|
31
|
+
this.grid[row] = [];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (this.grid[row][col]) {
|
|
35
|
+
throw new Error('Grid is occupied please ensure the place you insert at is not occupied');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
this.grid[row][col] = element;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
createRow(afterIndex) {
|
|
42
|
+
if (!afterIndex) {
|
|
43
|
+
this.grid.push([]);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
this.grid.splice(afterIndex + 1, 0, []);
|
|
19
47
|
}
|
|
20
48
|
|
|
21
49
|
_addStart(element) {
|
|
@@ -136,7 +164,7 @@ class DiFactory {
|
|
|
136
164
|
}
|
|
137
165
|
|
|
138
166
|
createDiShape(semantic, bounds, attrs) {
|
|
139
|
-
return this.create('bpmndi:BPMNShape', assign({
|
|
167
|
+
return this.create('bpmndi:BPMNShape', minDash.assign({
|
|
140
168
|
bpmnElement: semantic,
|
|
141
169
|
bounds: this.createDiBounds(bounds)
|
|
142
170
|
}, attrs));
|
|
@@ -145,17 +173,17 @@ class DiFactory {
|
|
|
145
173
|
createDiWaypoints(waypoints) {
|
|
146
174
|
var self = this;
|
|
147
175
|
|
|
148
|
-
return map(waypoints, function(pos) {
|
|
176
|
+
return minDash.map(waypoints, function(pos) {
|
|
149
177
|
return self.createDiWaypoint(pos);
|
|
150
178
|
});
|
|
151
179
|
}
|
|
152
180
|
|
|
153
181
|
createDiWaypoint(point) {
|
|
154
|
-
return this.create('dc:Point', pick(point, [ 'x', 'y' ]));
|
|
182
|
+
return this.create('dc:Point', minDash.pick(point, [ 'x', 'y' ]));
|
|
155
183
|
}
|
|
156
184
|
|
|
157
185
|
createDiEdge(semantic, waypoints, attrs) {
|
|
158
|
-
return this.create('bpmndi:BPMNEdge', assign({
|
|
186
|
+
return this.create('bpmndi:BPMNEdge', minDash.assign({
|
|
159
187
|
bpmnElement: semantic,
|
|
160
188
|
waypoint: this.createDiWaypoints(waypoints)
|
|
161
189
|
}, attrs));
|
|
@@ -215,7 +243,7 @@ function is(element, type) {
|
|
|
215
243
|
}
|
|
216
244
|
|
|
217
245
|
const DEFAULT_CELL_WIDTH = 150;
|
|
218
|
-
const DEFAULT_CELL_HEIGHT =
|
|
246
|
+
const DEFAULT_CELL_HEIGHT = 140;
|
|
219
247
|
|
|
220
248
|
function getMid(bounds) {
|
|
221
249
|
return {
|
|
@@ -281,18 +309,19 @@ function connectElements(source, target, layoutGrid) {
|
|
|
281
309
|
|
|
282
310
|
// Source === Target ==> Build loop
|
|
283
311
|
if (dX === 0 && dY === 0) {
|
|
312
|
+
const { x, y } = coordinatesToPosition(source.gridPosition.row, source.gridPosition.col);
|
|
284
313
|
return [
|
|
285
314
|
getDockingPoint(sourceMid, sourceBounds, 'r', dockingSource),
|
|
286
|
-
{ x:
|
|
287
|
-
{ x:
|
|
288
|
-
{ x: targetMid.x, y:
|
|
315
|
+
{ x: x + DEFAULT_CELL_WIDTH, y: sourceMid.y },
|
|
316
|
+
{ x: x + DEFAULT_CELL_WIDTH, y: y },
|
|
317
|
+
{ x: targetMid.x, y: y },
|
|
289
318
|
getDockingPoint(targetMid, targetBounds, 't', dockingTarget)
|
|
290
319
|
];
|
|
291
320
|
}
|
|
292
321
|
|
|
293
322
|
// connect horizontally
|
|
294
323
|
if (dY === 0) {
|
|
295
|
-
if (
|
|
324
|
+
if (isDirectPathBlocked(source, target, layoutGrid)) {
|
|
296
325
|
|
|
297
326
|
// Route on top
|
|
298
327
|
return [
|
|
@@ -313,7 +342,7 @@ function connectElements(source, target, layoutGrid) {
|
|
|
313
342
|
|
|
314
343
|
// connect vertically
|
|
315
344
|
if (dX === 0) {
|
|
316
|
-
if (
|
|
345
|
+
if (isDirectPathBlocked(source, target, layoutGrid)) {
|
|
317
346
|
|
|
318
347
|
// Route parallel
|
|
319
348
|
const yOffset = -Math.sign(dY) * DEFAULT_CELL_HEIGHT / 2;
|
|
@@ -333,6 +362,20 @@ function connectElements(source, target, layoutGrid) {
|
|
|
333
362
|
}
|
|
334
363
|
}
|
|
335
364
|
|
|
365
|
+
const directManhattan = directManhattanConnect(source, target, layoutGrid);
|
|
366
|
+
|
|
367
|
+
if (directManhattan) {
|
|
368
|
+
const startPoint = getDockingPoint(sourceMid, sourceBounds, directManhattan[0], dockingSource);
|
|
369
|
+
const endPoint = getDockingPoint(targetMid, targetBounds, directManhattan[1], dockingTarget);
|
|
370
|
+
|
|
371
|
+
const midPoint = directManhattan[0] === 'h' ? { x: endPoint.x, y: startPoint.y } : { x: startPoint.x, y: endPoint.y };
|
|
372
|
+
|
|
373
|
+
return [
|
|
374
|
+
startPoint,
|
|
375
|
+
midPoint,
|
|
376
|
+
endPoint
|
|
377
|
+
];
|
|
378
|
+
}
|
|
336
379
|
const yOffset = -Math.sign(dY) * DEFAULT_CELL_HEIGHT / 2;
|
|
337
380
|
|
|
338
381
|
return [
|
|
@@ -346,6 +389,15 @@ function connectElements(source, target, layoutGrid) {
|
|
|
346
389
|
}
|
|
347
390
|
|
|
348
391
|
// helpers /////
|
|
392
|
+
function coordinatesToPosition(row, col) {
|
|
393
|
+
return {
|
|
394
|
+
width: DEFAULT_CELL_WIDTH,
|
|
395
|
+
height: DEFAULT_CELL_HEIGHT,
|
|
396
|
+
x: col * DEFAULT_CELL_WIDTH,
|
|
397
|
+
y: row * DEFAULT_CELL_HEIGHT
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
|
|
349
401
|
function getBounds(element, row, col, attachedTo) {
|
|
350
402
|
const { width, height } = getDefaultSize(element);
|
|
351
403
|
|
|
@@ -367,10 +419,264 @@ function getBounds(element, row, col, attachedTo) {
|
|
|
367
419
|
};
|
|
368
420
|
}
|
|
369
421
|
|
|
422
|
+
function isDirectPathBlocked(source, target, layoutGrid) {
|
|
423
|
+
const { row: sourceRow, col: sourceCol } = source.gridPosition;
|
|
424
|
+
const { row: targetRow, col: targetCol } = target.gridPosition;
|
|
425
|
+
|
|
426
|
+
const dX = targetCol - sourceCol;
|
|
427
|
+
const dY = targetRow - sourceRow;
|
|
428
|
+
|
|
429
|
+
let totalElements = 0;
|
|
430
|
+
|
|
431
|
+
if (dX) {
|
|
432
|
+
totalElements += layoutGrid.getElementsInRange({ row: sourceRow, col: sourceCol }, { row: sourceRow, col: targetCol }).length;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
if (dY) {
|
|
436
|
+
totalElements += layoutGrid.getElementsInRange({ row: sourceRow, col: targetCol }, { row: targetRow, col: targetCol }).length;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
return totalElements > 2;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
function directManhattanConnect(source, target, layoutGrid) {
|
|
443
|
+
const { row: sourceRow, col: sourceCol } = source.gridPosition;
|
|
444
|
+
const { row: targetRow, col: targetCol } = target.gridPosition;
|
|
445
|
+
|
|
446
|
+
const dX = targetCol - sourceCol;
|
|
447
|
+
const dY = targetRow - sourceRow;
|
|
448
|
+
|
|
449
|
+
// Only directly connect left-to-right flow
|
|
450
|
+
if (!(dX > 0 && dY !== 0)) {
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
// If below, go down then horizontal
|
|
455
|
+
if (dY > 0) {
|
|
456
|
+
let totalElements = 0;
|
|
457
|
+
const bendPoint = { row: targetRow, col: sourceCol };
|
|
458
|
+
totalElements += layoutGrid.getElementsInRange({ row: sourceRow, col: sourceCol }, bendPoint).length;
|
|
459
|
+
totalElements += layoutGrid.getElementsInRange(bendPoint, { row: targetRow, col: targetCol }).length;
|
|
460
|
+
|
|
461
|
+
return totalElements > 2 ? false : [ 'v', 'h' ];
|
|
462
|
+
} else {
|
|
463
|
+
|
|
464
|
+
// If above, go horizontal than vertical
|
|
465
|
+
let totalElements = 0;
|
|
466
|
+
const bendPoint = { row: sourceRow, col: targetCol };
|
|
467
|
+
|
|
468
|
+
totalElements += layoutGrid.getElementsInRange({ row: sourceRow, col: sourceCol }, bendPoint).length;
|
|
469
|
+
totalElements += layoutGrid.getElementsInRange(bendPoint, { row: targetRow, col: targetCol }).length;
|
|
470
|
+
|
|
471
|
+
return totalElements > 2 ? false : [ 'h', 'v' ];
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
var attacherHandler = {
|
|
476
|
+
'addToGrid': ({ element, grid, visited }) => {
|
|
477
|
+
const nextElements = [];
|
|
478
|
+
|
|
479
|
+
const attachedOutgoing = (element.attachers || [])
|
|
480
|
+
.map(att => att.outgoing.reverse())
|
|
481
|
+
.flat()
|
|
482
|
+
.map(out => out.targetRef);
|
|
483
|
+
|
|
484
|
+
// handle boundary events
|
|
485
|
+
attachedOutgoing.forEach((nextElement, index, arr) => {
|
|
486
|
+
if (visited.has(nextElement)) {
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
// Add below and to the right of the element
|
|
491
|
+
insertIntoGrid(nextElement, element, grid);
|
|
492
|
+
nextElements.push(nextElement);
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
return nextElements;
|
|
496
|
+
},
|
|
497
|
+
|
|
498
|
+
'createElementDi': ({ element, row, col, diFactory }) => {
|
|
499
|
+
const hostBounds = getBounds(element, row, col);
|
|
500
|
+
|
|
501
|
+
const DIs = [];
|
|
502
|
+
(element.attachers || []).forEach((att, i, arr) => {
|
|
503
|
+
att.gridPosition = { row, col };
|
|
504
|
+
const bounds = getBounds(att, row, col, element);
|
|
505
|
+
|
|
506
|
+
// distribute along lower edge
|
|
507
|
+
bounds.x = hostBounds.x + (i + 1) * (hostBounds.width / (arr.length + 1)) - bounds.width / 2;
|
|
508
|
+
|
|
509
|
+
const attacherDi = diFactory.createDiShape(att, bounds, {
|
|
510
|
+
id: att.id + '_di'
|
|
511
|
+
});
|
|
512
|
+
att.di = attacherDi;
|
|
513
|
+
att.gridPosition = { row, col };
|
|
514
|
+
|
|
515
|
+
DIs.push(attacherDi);
|
|
516
|
+
});
|
|
517
|
+
|
|
518
|
+
return DIs;
|
|
519
|
+
},
|
|
520
|
+
|
|
521
|
+
'createConnectionDi': ({ element, row, col, layoutGrid, diFactory }) => {
|
|
522
|
+
const attachers = element.attachers || [];
|
|
523
|
+
|
|
524
|
+
return attachers.flatMap(att => {
|
|
525
|
+
const outgoing = att.outgoing || [];
|
|
526
|
+
|
|
527
|
+
return outgoing.map(out => {
|
|
528
|
+
const target = out.targetRef;
|
|
529
|
+
const waypoints = connectElements(att, target, layoutGrid);
|
|
530
|
+
|
|
531
|
+
// Correct waypoints if they don't automatically attach to the bottom
|
|
532
|
+
ensureExitBottom(att, waypoints, [ row, col ]);
|
|
533
|
+
|
|
534
|
+
const connectionDi = diFactory.createDiEdge(out, waypoints, {
|
|
535
|
+
id: out.id + '_di'
|
|
536
|
+
});
|
|
537
|
+
|
|
538
|
+
return connectionDi;
|
|
539
|
+
});
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
function insertIntoGrid(newElement, host, grid) {
|
|
546
|
+
const [ row, col ] = grid.find(host);
|
|
547
|
+
|
|
548
|
+
// Grid is occupied
|
|
549
|
+
if (grid.get(row + 1, col) || grid.get(row + 1, col + 1)) {
|
|
550
|
+
grid.createRow(row);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
// Host has element directly after, add space
|
|
554
|
+
if (grid.get(row, col + 1)) {
|
|
555
|
+
grid.addAfter(host, null);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
grid.add(newElement, [ row + 1, col + 1 ]);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
function ensureExitBottom(source, waypoints, [ row, col ]) {
|
|
562
|
+
|
|
563
|
+
const sourceDi = source.di;
|
|
564
|
+
const sourceBounds = sourceDi.get('bounds');
|
|
565
|
+
const sourceMid = getMid(sourceBounds);
|
|
566
|
+
|
|
567
|
+
const dockingPoint = getDockingPoint(sourceMid, sourceBounds, 'b');
|
|
568
|
+
if (waypoints[0].x === dockingPoint.x && waypoints[0].y === dockingPoint.y) {
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
if (waypoints.length === 2) {
|
|
573
|
+
const newStart = [
|
|
574
|
+
dockingPoint,
|
|
575
|
+
{ x: dockingPoint.x, y: (row + 1) * DEFAULT_CELL_HEIGHT },
|
|
576
|
+
{ x: (col + 1) * DEFAULT_CELL_WIDTH, y: (row + 1) * DEFAULT_CELL_HEIGHT },
|
|
577
|
+
{ x: (col + 1) * DEFAULT_CELL_WIDTH, y: (row + 0.5) * DEFAULT_CELL_HEIGHT },
|
|
578
|
+
];
|
|
579
|
+
|
|
580
|
+
waypoints.splice(0, 1, ...newStart);
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
// add waypoints to exit bottom and connect to existing path
|
|
585
|
+
const newStart = [
|
|
586
|
+
dockingPoint,
|
|
587
|
+
{ x: dockingPoint.x, y: (row + 1) * DEFAULT_CELL_HEIGHT },
|
|
588
|
+
{ x: waypoints[1].x, y: (row + 1) * DEFAULT_CELL_HEIGHT },
|
|
589
|
+
];
|
|
590
|
+
|
|
591
|
+
waypoints.splice(0, 1, ...newStart);
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
var elementHandler = {
|
|
596
|
+
'createElementDi': ({ element, row, col, diFactory }) => {
|
|
597
|
+
|
|
598
|
+
const bounds = getBounds(element, row, col);
|
|
599
|
+
|
|
600
|
+
const options = {
|
|
601
|
+
id: element.id + '_di'
|
|
602
|
+
};
|
|
603
|
+
|
|
604
|
+
if (is(element, 'bpmn:ExclusiveGateway')) {
|
|
605
|
+
options.isMarkerVisible = true;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
const shapeDi = diFactory.createDiShape(element, bounds, options);
|
|
609
|
+
element.di = shapeDi;
|
|
610
|
+
element.gridPosition = { row, col };
|
|
611
|
+
|
|
612
|
+
return shapeDi;
|
|
613
|
+
}
|
|
614
|
+
};
|
|
615
|
+
|
|
616
|
+
var outgoingHandler = {
|
|
617
|
+
'addToGrid': ({ element, grid, visited }) => {
|
|
618
|
+
const nextElements = [];
|
|
619
|
+
|
|
620
|
+
// Handle outgoing paths
|
|
621
|
+
const outgoing = (element.outgoing || [])
|
|
622
|
+
.map(out => out.targetRef)
|
|
623
|
+
.filter(el => el);
|
|
624
|
+
|
|
625
|
+
let previousElement = null;
|
|
626
|
+
outgoing.forEach((nextElement, index, arr) => {
|
|
627
|
+
if (visited.has(nextElement)) {
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
if (!previousElement) {
|
|
632
|
+
grid.addAfter(element, nextElement);
|
|
633
|
+
}
|
|
634
|
+
else {
|
|
635
|
+
grid.addBelow(arr[index - 1], nextElement);
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
// Is self-looping
|
|
639
|
+
if (nextElement !== element) {
|
|
640
|
+
previousElement = nextElement;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
nextElements.unshift(nextElement);
|
|
644
|
+
visited.add(nextElement);
|
|
645
|
+
});
|
|
646
|
+
|
|
647
|
+
return nextElements;
|
|
648
|
+
},
|
|
649
|
+
'createConnectionDi': ({ element, row, col, layoutGrid, diFactory }) => {
|
|
650
|
+
const outgoing = element.outgoing || [];
|
|
651
|
+
|
|
652
|
+
return outgoing.map(out => {
|
|
653
|
+
const target = out.targetRef;
|
|
654
|
+
const waypoints = connectElements(element, target, layoutGrid);
|
|
655
|
+
|
|
656
|
+
const connectionDi = diFactory.createDiEdge(out, waypoints, {
|
|
657
|
+
id: out.id + '_di'
|
|
658
|
+
});
|
|
659
|
+
|
|
660
|
+
return connectionDi;
|
|
661
|
+
});
|
|
662
|
+
|
|
663
|
+
}
|
|
664
|
+
};
|
|
665
|
+
|
|
666
|
+
const handlers = [ elementHandler, outgoingHandler, attacherHandler ];
|
|
667
|
+
|
|
370
668
|
class Layouter {
|
|
371
669
|
constructor() {
|
|
372
670
|
this.moddle = new BPMNModdle();
|
|
373
671
|
this.diFactory = new DiFactory(this.moddle);
|
|
672
|
+
this._handlers = handlers;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
handle(operation, options) {
|
|
676
|
+
return this._handlers
|
|
677
|
+
.filter(handler => minDash.isFunction(handler[operation]))
|
|
678
|
+
.map(handler => handler[operation](options));
|
|
679
|
+
|
|
374
680
|
}
|
|
375
681
|
|
|
376
682
|
async layoutProcess(xml) {
|
|
@@ -398,7 +704,6 @@ class Layouter {
|
|
|
398
704
|
createGridLayout(root) {
|
|
399
705
|
const grid = new Grid();
|
|
400
706
|
|
|
401
|
-
// const process = this.getProcess();
|
|
402
707
|
const flowElements = root.flowElements;
|
|
403
708
|
|
|
404
709
|
const startingElements = flowElements.filter(el => {
|
|
@@ -429,54 +734,11 @@ class Layouter {
|
|
|
429
734
|
this.handlePlane(currentElement);
|
|
430
735
|
}
|
|
431
736
|
|
|
432
|
-
|
|
433
|
-
const outgoing = (currentElement.outgoing || [])
|
|
434
|
-
.map(out => out.targetRef)
|
|
435
|
-
.filter(el => el);
|
|
436
|
-
|
|
437
|
-
let previousElement = null;
|
|
438
|
-
outgoing.forEach((nextElement, index, arr) => {
|
|
439
|
-
if (visited.has(nextElement)) {
|
|
440
|
-
return;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
if (!previousElement) {
|
|
444
|
-
grid.addAfter(currentElement, nextElement);
|
|
445
|
-
}
|
|
446
|
-
else {
|
|
447
|
-
grid.addBelow(arr[index - 1], nextElement);
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
// Is self-looping
|
|
451
|
-
if (nextElement !== currentElement) {
|
|
452
|
-
previousElement = nextElement;
|
|
453
|
-
}
|
|
454
|
-
});
|
|
455
|
-
|
|
456
|
-
const attachedOutgoing = (currentElement.attachers || [])
|
|
457
|
-
.map(att => att.outgoing)
|
|
458
|
-
.flat()
|
|
459
|
-
.map(out => out.targetRef);
|
|
737
|
+
const nextElements = this.handle('addToGrid', { element: currentElement, grid, visited });
|
|
460
738
|
|
|
461
|
-
|
|
462
|
-
attachedOutgoing.forEach((nextElement, index, arr) => {
|
|
463
|
-
if (visited.has(nextElement)) {
|
|
464
|
-
return;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
const below = arr[index - 1] || currentElement;
|
|
468
|
-
grid.addBelow(below, nextElement);
|
|
469
|
-
stack.push(nextElement);
|
|
470
|
-
visited.add(nextElement);
|
|
471
|
-
});
|
|
472
|
-
|
|
473
|
-
// add to stack in reverse order: first element should be first of the stack
|
|
474
|
-
outgoing.reverse().forEach(el => {
|
|
475
|
-
if (visited.has(el)) {
|
|
476
|
-
return;
|
|
477
|
-
}
|
|
478
|
-
visited.add(el);
|
|
739
|
+
nextElements.flat().forEach(el => {
|
|
479
740
|
stack.push(el);
|
|
741
|
+
visited.add(el);
|
|
480
742
|
});
|
|
481
743
|
}
|
|
482
744
|
|
|
@@ -505,62 +767,20 @@ class Layouter {
|
|
|
505
767
|
|
|
506
768
|
// Step 1: Create DI for all elements
|
|
507
769
|
layoutGrid.elementsByPosition().forEach(({ element, row, col }) => {
|
|
508
|
-
const
|
|
770
|
+
const dis = this
|
|
771
|
+
.handle('createElementDi', { element, row, col, layoutGrid, diFactory })
|
|
772
|
+
.flat();
|
|
509
773
|
|
|
510
|
-
|
|
511
|
-
id: element.id + '_di'
|
|
512
|
-
});
|
|
513
|
-
element.di = shapeDi;
|
|
514
|
-
element.gridPosition = { row, col };
|
|
515
|
-
|
|
516
|
-
planeElement.push(shapeDi);
|
|
517
|
-
|
|
518
|
-
// handle attachers
|
|
519
|
-
(element.attachers || []).forEach(att => {
|
|
520
|
-
att.gridPosition = { row, col };
|
|
521
|
-
const attacherBounds = getBounds(att, row, col, element);
|
|
522
|
-
|
|
523
|
-
const attacherDi = diFactory.createDiShape(att, attacherBounds, {
|
|
524
|
-
id: att.id + '_di'
|
|
525
|
-
});
|
|
526
|
-
att.di = attacherDi;
|
|
527
|
-
att.gridPosition = { row, col };
|
|
528
|
-
|
|
529
|
-
planeElement.push(attacherDi);
|
|
530
|
-
});
|
|
774
|
+
planeElement.push(...dis);
|
|
531
775
|
});
|
|
532
776
|
|
|
533
777
|
// Step 2: Create DI for all connections
|
|
534
778
|
layoutGrid.elementsByPosition().forEach(({ element, row, col }) => {
|
|
535
|
-
const
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
const target = out.targetRef;
|
|
539
|
-
const waypoints = connectElements(element, target, layoutGrid);
|
|
540
|
-
|
|
541
|
-
const connectionDi = diFactory.createDiEdge(out, waypoints, {
|
|
542
|
-
id: out.id + '_di'
|
|
543
|
-
});
|
|
544
|
-
|
|
545
|
-
planeElement.push(connectionDi);
|
|
546
|
-
});
|
|
547
|
-
|
|
548
|
-
// handle attachers
|
|
549
|
-
(element.attachers || []).forEach(att => {
|
|
550
|
-
const outgoing = att.outgoing || [];
|
|
551
|
-
|
|
552
|
-
outgoing.forEach(out => {
|
|
553
|
-
const target = out.targetRef;
|
|
554
|
-
const waypoints = connectElements(att, target, layoutGrid);
|
|
555
|
-
|
|
556
|
-
const connectionDi = diFactory.createDiEdge(out, waypoints, {
|
|
557
|
-
id: out.id + '_di'
|
|
558
|
-
});
|
|
559
|
-
|
|
560
|
-
planeElement.push(connectionDi);
|
|
561
|
-
});
|
|
562
|
-
});
|
|
779
|
+
const dis = this
|
|
780
|
+
.handle('createConnectionDi', { element, row, col, layoutGrid, diFactory })
|
|
781
|
+
.flat();
|
|
563
782
|
|
|
783
|
+
planeElement.push(...dis);
|
|
564
784
|
});
|
|
565
785
|
}
|
|
566
786
|
|
|
@@ -574,5 +794,5 @@ function layoutProcess(xml) {
|
|
|
574
794
|
return new Layouter().layoutProcess(xml);
|
|
575
795
|
}
|
|
576
796
|
|
|
577
|
-
|
|
578
|
-
//# sourceMappingURL=index.
|
|
797
|
+
exports.layoutProcess = layoutProcess;
|
|
798
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../lib/utils/elementUtils.js","../lib/Grid.js","../lib/di/DiFactory.js","../lib/di/DiUtil.js","../lib/utils/layoutUtil.js","../lib/handler/attachersHandler.js","../lib/handler/elementHandler.js","../lib/handler/outgoingHandler.js","../lib/handler/index.js","../lib/Layouter.js","../lib/index.js"],"sourcesContent":["export function isConnection(element) {\n return !!element.sourceRef;\n}\n\nexport function isBoundaryEvent(element) {\n return !!element.attachedToRef;\n}","export class Grid {\n constructor() {\n this.grid = [];\n }\n\n add(element, position) {\n if (!position) {\n this._addStart(element);\n return;\n }\n\n const [ row, col ] = position;\n if (!row && !col) {\n this._addStart(element);\n }\n\n if (!this.grid[row]) {\n this.grid[row] = [];\n }\n\n if (this.grid[row][col]) {\n throw new Error('Grid is occupied please ensure the place you insert at is not occupied');\n }\n\n this.grid[row][col] = element;\n }\n\n createRow(afterIndex) {\n if (!afterIndex) {\n this.grid.push([]);\n }\n\n this.grid.splice(afterIndex + 1, 0, []);\n }\n\n _addStart(element) {\n this.grid.push([ element ]);\n }\n\n addAfter(element, newElement) {\n if (!element) {\n this._addStart(newElement);\n }\n\n const [ row, col ] = this.find(element);\n this.grid[row].splice(col + 1, 0, newElement);\n }\n\n addBelow(element, newElement) {\n if (!element) {\n this._addStart(newElement);\n }\n\n const [ row, col ] = this.find(element);\n\n // We are at the bottom of the current grid - add empty row below\n if (!this.grid[row + 1]) {\n this.grid[row + 1] = [];\n }\n\n // The element below is already occupied - insert new row\n if (this.grid[row + 1][col]) {\n this.grid.splice(row + 1, 0, []);\n }\n\n if (this.grid[row + 1][col]) {\n throw new Error('Grid is occupied and we could not find a place - this should not happen');\n }\n\n this.grid[row + 1][col] = newElement;\n }\n\n find(element) {\n let row, col;\n row = this.grid.findIndex((row) => {\n col = row.findIndex((el) => {\n return el === element;\n });\n\n return col !== -1;\n });\n\n return [ row, col ];\n }\n\n get(row, col) {\n return (this.grid[row] || [])[col];\n }\n\n getElementsInRange({ row: startRow, col: startCol }, { row: endRow, col: endCol }) {\n const elements = [];\n\n if (startRow > endRow) {\n [ startRow, endRow ] = [ endRow, startRow ];\n }\n\n if (startCol > endCol) {\n [ startCol, endCol ] = [ endCol, startCol ];\n }\n\n for (let row = startRow; row <= endRow; row++) {\n for (let col = startCol; col <= endCol; col++) {\n const element = this.get(row, col);\n\n if (element) {\n elements.push(element);\n }\n }\n }\n\n return elements;\n }\n\n elementsByPosition() {\n const elements = [];\n\n this.grid.forEach((row, rowIndex) => {\n row.forEach((element, colIndex) => {\n if (!element) {\n return;\n }\n elements.push({\n element,\n row: rowIndex,\n col: colIndex\n });\n });\n });\n\n return elements;\n }\n}\n\n","import { assign, map, pick } from 'min-dash';\n\n\nexport class DiFactory {\n constructor(moddle) {\n this.moddle = moddle;\n }\n\n create(type, attrs) {\n return this.moddle.create(type, attrs || {});\n }\n\n createDiBounds(bounds) {\n return this.create('dc:Bounds', bounds);\n }\n\n createDiLabel() {\n return this.create('bpmndi:BPMNLabel', {\n bounds: this.createDiBounds()\n });\n }\n\n createDiShape(semantic, bounds, attrs) {\n return this.create('bpmndi:BPMNShape', assign({\n bpmnElement: semantic,\n bounds: this.createDiBounds(bounds)\n }, attrs));\n }\n\n createDiWaypoints(waypoints) {\n var self = this;\n\n return map(waypoints, function(pos) {\n return self.createDiWaypoint(pos);\n });\n }\n\n createDiWaypoint(point) {\n return this.create('dc:Point', pick(point, [ 'x', 'y' ]));\n }\n\n createDiEdge(semantic, waypoints, attrs) {\n return this.create('bpmndi:BPMNEdge', assign({\n bpmnElement: semantic,\n waypoint: this.createDiWaypoints(waypoints)\n }, attrs));\n }\n\n createDiPlane(attrs) {\n return this.create('bpmndi:BPMNPlane', attrs);\n }\n\n createDiDiagram(attrs) {\n return this.create('bpmndi:BPMNDiagram', attrs);\n }\n}","export function getDefaultSize(element) {\n if (is(element, 'bpmn:SubProcess')) {\n return { width: 100, height: 80 };\n }\n\n if (is(element, 'bpmn:Task')) {\n return { width: 100, height: 80 };\n }\n\n if (is(element, 'bpmn:Gateway')) {\n return { width: 50, height: 50 };\n }\n\n if (is(element, 'bpmn:Event')) {\n return { width: 36, height: 36 };\n }\n\n if (is(element, 'bpmn:Participant')) {\n return { width: 400, height: 100 };\n }\n\n if (is(element, 'bpmn:Lane')) {\n return { width: 400, height: 100 };\n }\n\n if (is(element, 'bpmn:DataObjectReference')) {\n return { width: 36, height: 50 };\n }\n\n if (is(element, 'bpmn:DataStoreReference')) {\n return { width: 50, height: 50 };\n }\n\n if (is(element, 'bpmn:TextAnnotation')) {\n return { width: 100, height: 30 };\n }\n\n return { width: 100, height: 80 };\n}\n\nexport function is(element, type) {\n return element.$instanceOf(type);\n}\n","import { getDefaultSize } from '../di/DiUtil.js';\n\nexport const DEFAULT_CELL_WIDTH = 150;\nexport const DEFAULT_CELL_HEIGHT = 140;\n\nexport function getMid(bounds) {\n return {\n x: bounds.x + bounds.width / 2,\n y: bounds.y + bounds.height / 2\n };\n}\n\nexport function getDockingPoint(point, rectangle, dockingDirection = 'r', targetOrientation = 'top-left') {\n\n // ensure we end up with a specific docking direction\n // based on the targetOrientation, if <h|v> is being passed\n\n if (dockingDirection === 'h') {\n dockingDirection = /left/.test(targetOrientation) ? 'l' : 'r';\n }\n\n if (dockingDirection === 'v') {\n dockingDirection = /top/.test(targetOrientation) ? 't' : 'b';\n }\n\n if (dockingDirection === 't') {\n return { original: point, x: point.x, y: rectangle.y };\n }\n\n if (dockingDirection === 'r') {\n return { original: point, x: rectangle.x + rectangle.width, y: point.y };\n }\n\n if (dockingDirection === 'b') {\n return { original: point, x: point.x, y: rectangle.y + rectangle.height };\n }\n\n if (dockingDirection === 'l') {\n return { original: point, x: rectangle.x, y: point.y };\n }\n\n throw new Error('unexpected dockingDirection: <' + dockingDirection + '>');\n}\n\n/**\n * Modified Manhattan layout: Uses space between grid coloumns to route connections\n * if direct connection is not possible.\n * @param {*} source\n * @param {*} target\n * @returns waypoints\n */\nexport function connectElements(source, target, layoutGrid) {\n const sourceDi = source.di;\n const targetDi = target.di;\n\n const sourceBounds = sourceDi.get('bounds');\n const targetBounds = targetDi.get('bounds');\n\n const sourceMid = getMid(sourceBounds);\n const targetMid = getMid(targetBounds);\n\n const dX = target.gridPosition.col - source.gridPosition.col;\n const dY = target.gridPosition.row - source.gridPosition.row;\n\n const dockingSource = `${(dY > 0 ? 'bottom' : 'top')}-${dX > 0 ? 'right' : 'left'}`;\n const dockingTarget = `${(dY > 0 ? 'top' : 'bottom')}-${dX > 0 ? 'left' : 'right'}`;\n\n // Source === Target ==> Build loop\n if (dX === 0 && dY === 0) {\n const { x, y } = coordinatesToPosition(source.gridPosition.row, source.gridPosition.col);\n return [\n getDockingPoint(sourceMid, sourceBounds, 'r', dockingSource),\n { x: x + DEFAULT_CELL_WIDTH, y: sourceMid.y },\n { x: x + DEFAULT_CELL_WIDTH, y: y },\n { x: targetMid.x, y: y },\n getDockingPoint(targetMid, targetBounds, 't', dockingTarget)\n ];\n }\n\n // connect horizontally\n if (dY === 0) {\n if (isDirectPathBlocked(source, target, layoutGrid)) {\n\n // Route on top\n return [\n getDockingPoint(sourceMid, sourceBounds, 't'),\n { x: sourceMid.x, y: sourceMid.y - DEFAULT_CELL_HEIGHT / 2 },\n { x: targetMid.x, y: sourceMid.y - DEFAULT_CELL_HEIGHT / 2 },\n getDockingPoint(targetMid, targetBounds, 't')\n ];\n } else {\n\n // if space is clear, connect directly\n return [\n getDockingPoint(sourceMid, sourceBounds, 'h', dockingSource),\n getDockingPoint(targetMid, targetBounds, 'h', dockingTarget)\n ];\n }\n }\n\n // connect vertically\n if (dX === 0) {\n if (isDirectPathBlocked(source, target, layoutGrid)) {\n\n // Route parallel\n const yOffset = -Math.sign(dY) * DEFAULT_CELL_HEIGHT / 2;\n return [\n getDockingPoint(sourceMid, sourceBounds, 'r'),\n { x: sourceMid.x + DEFAULT_CELL_WIDTH / 2, y: sourceMid.y }, // out right\n { x: targetMid.x + DEFAULT_CELL_WIDTH / 2, y: targetMid.y + yOffset },\n { x: targetMid.x, y: targetMid.y + yOffset },\n getDockingPoint(targetMid, targetBounds, Math.sign(yOffset) > 0 ? 'b' : 't')\n ];\n } else {\n\n // if space is clear, connect directly\n return [ getDockingPoint(sourceMid, sourceBounds, 'v', dockingSource),\n getDockingPoint(targetMid, targetBounds, 'v', dockingTarget)\n ];\n }\n }\n\n const directManhattan = directManhattanConnect(source, target, layoutGrid);\n\n if (directManhattan) {\n const startPoint = getDockingPoint(sourceMid, sourceBounds, directManhattan[0], dockingSource);\n const endPoint = getDockingPoint(targetMid, targetBounds, directManhattan[1], dockingTarget);\n\n const midPoint = directManhattan[0] === 'h' ? { x: endPoint.x, y: startPoint.y } : { x: startPoint.x, y: endPoint.y };\n\n return [\n startPoint,\n midPoint,\n endPoint\n ];\n }\n const yOffset = -Math.sign(dY) * DEFAULT_CELL_HEIGHT / 2;\n\n return [\n getDockingPoint(sourceMid, sourceBounds, 'r', dockingSource),\n { x: sourceMid.x + DEFAULT_CELL_WIDTH / 2, y: sourceMid.y }, // out right\n { x: sourceMid.x + DEFAULT_CELL_WIDTH / 2, y: targetMid.y + yOffset }, // to target row\n { x: targetMid.x - DEFAULT_CELL_WIDTH / 2, y: targetMid.y + yOffset }, // to target column\n { x: targetMid.x - DEFAULT_CELL_WIDTH / 2, y: targetMid.y }, // to mid\n getDockingPoint(targetMid, targetBounds, 'l', dockingTarget)\n ];\n}\n\n// helpers /////\nexport function coordinatesToPosition(row, col) {\n return {\n width: DEFAULT_CELL_WIDTH,\n height: DEFAULT_CELL_HEIGHT,\n x: col * DEFAULT_CELL_WIDTH,\n y: row * DEFAULT_CELL_HEIGHT\n };\n}\n\nexport function getBounds(element, row, col, attachedTo) {\n const { width, height } = getDefaultSize(element);\n\n // Center in cell\n if (!attachedTo) {\n return {\n width, height,\n x: (col * DEFAULT_CELL_WIDTH) + (DEFAULT_CELL_WIDTH - width) / 2,\n y: row * DEFAULT_CELL_HEIGHT + (DEFAULT_CELL_HEIGHT - height) / 2\n };\n }\n\n const hostBounds = getBounds(attachedTo, row, col);\n\n return {\n width, height,\n x: Math.round(hostBounds.x + hostBounds.width / 2 - width / 2),\n y: Math.round(hostBounds.y + hostBounds.height - height / 2)\n };\n}\n\nfunction isDirectPathBlocked(source, target, layoutGrid) {\n const { row: sourceRow, col: sourceCol } = source.gridPosition;\n const { row: targetRow, col: targetCol } = target.gridPosition;\n\n const dX = targetCol - sourceCol;\n const dY = targetRow - sourceRow;\n\n let totalElements = 0;\n\n if (dX) {\n totalElements += layoutGrid.getElementsInRange({ row: sourceRow, col: sourceCol }, { row: sourceRow, col: targetCol }).length;\n }\n\n if (dY) {\n totalElements += layoutGrid.getElementsInRange({ row: sourceRow, col: targetCol }, { row: targetRow, col: targetCol }).length;\n }\n\n return totalElements > 2;\n}\n\nfunction directManhattanConnect(source, target, layoutGrid) {\n const { row: sourceRow, col: sourceCol } = source.gridPosition;\n const { row: targetRow, col: targetCol } = target.gridPosition;\n\n const dX = targetCol - sourceCol;\n const dY = targetRow - sourceRow;\n\n // Only directly connect left-to-right flow\n if (!(dX > 0 && dY !== 0)) {\n return;\n }\n\n // If below, go down then horizontal\n if (dY > 0) {\n let totalElements = 0;\n const bendPoint = { row: targetRow, col: sourceCol };\n totalElements += layoutGrid.getElementsInRange({ row: sourceRow, col: sourceCol }, bendPoint).length;\n totalElements += layoutGrid.getElementsInRange(bendPoint, { row: targetRow, col: targetCol }).length;\n\n return totalElements > 2 ? false : [ 'v', 'h' ];\n } else {\n\n // If above, go horizontal than vertical\n let totalElements = 0;\n const bendPoint = { row: sourceRow, col: targetCol };\n\n totalElements += layoutGrid.getElementsInRange({ row: sourceRow, col: sourceCol }, bendPoint).length;\n totalElements += layoutGrid.getElementsInRange(bendPoint, { row: targetRow, col: targetCol }).length;\n\n return totalElements > 2 ? false : [ 'h', 'v' ];\n }\n}\n","import {\n DEFAULT_CELL_HEIGHT,\n DEFAULT_CELL_WIDTH,\n connectElements,\n getBounds,\n getDockingPoint,\n getMid\n} from '../utils/layoutUtil.js';\n\nexport default {\n 'addToGrid': ({ element, grid, visited }) => {\n const nextElements = [];\n\n const attachedOutgoing = (element.attachers || [])\n .map(att => att.outgoing.reverse())\n .flat()\n .map(out => out.targetRef);\n\n // handle boundary events\n attachedOutgoing.forEach((nextElement, index, arr) => {\n if (visited.has(nextElement)) {\n return;\n }\n\n // Add below and to the right of the element\n insertIntoGrid(nextElement, element, grid);\n nextElements.push(nextElement);\n });\n\n return nextElements;\n },\n\n 'createElementDi': ({ element, row, col, diFactory }) => {\n const hostBounds = getBounds(element, row, col);\n\n const DIs = [];\n (element.attachers || []).forEach((att, i, arr) => {\n att.gridPosition = { row, col };\n const bounds = getBounds(att, row, col, element);\n\n // distribute along lower edge\n bounds.x = hostBounds.x + (i + 1) * (hostBounds.width / (arr.length + 1)) - bounds.width / 2;\n\n const attacherDi = diFactory.createDiShape(att, bounds, {\n id: att.id + '_di'\n });\n att.di = attacherDi;\n att.gridPosition = { row, col };\n\n DIs.push(attacherDi);\n });\n\n return DIs;\n },\n\n 'createConnectionDi': ({ element, row, col, layoutGrid, diFactory }) => {\n const attachers = element.attachers || [];\n\n return attachers.flatMap(att => {\n const outgoing = att.outgoing || [];\n\n return outgoing.map(out => {\n const target = out.targetRef;\n const waypoints = connectElements(att, target, layoutGrid);\n\n // Correct waypoints if they don't automatically attach to the bottom\n ensureExitBottom(att, waypoints, [ row, col ]);\n\n const connectionDi = diFactory.createDiEdge(out, waypoints, {\n id: out.id + '_di'\n });\n\n return connectionDi;\n });\n });\n }\n};\n\n\nfunction insertIntoGrid(newElement, host, grid) {\n const [ row, col ] = grid.find(host);\n\n // Grid is occupied\n if (grid.get(row + 1, col) || grid.get(row + 1, col + 1)) {\n grid.createRow(row);\n }\n\n // Host has element directly after, add space\n if (grid.get(row, col + 1)) {\n grid.addAfter(host, null);\n }\n\n grid.add(newElement, [ row + 1, col + 1 ]);\n}\n\nfunction ensureExitBottom(source, waypoints, [ row, col ]) {\n\n const sourceDi = source.di;\n const sourceBounds = sourceDi.get('bounds');\n const sourceMid = getMid(sourceBounds);\n\n const dockingPoint = getDockingPoint(sourceMid, sourceBounds, 'b');\n if (waypoints[0].x === dockingPoint.x && waypoints[0].y === dockingPoint.y) {\n return;\n }\n\n if (waypoints.length === 2) {\n const newStart = [\n dockingPoint,\n { x: dockingPoint.x, y: (row + 1) * DEFAULT_CELL_HEIGHT },\n { x: (col + 1) * DEFAULT_CELL_WIDTH, y: (row + 1) * DEFAULT_CELL_HEIGHT },\n { x: (col + 1) * DEFAULT_CELL_WIDTH, y: (row + 0.5) * DEFAULT_CELL_HEIGHT },\n ];\n\n waypoints.splice(0, 1, ...newStart);\n return;\n }\n\n // add waypoints to exit bottom and connect to existing path\n const newStart = [\n dockingPoint,\n { x: dockingPoint.x, y: (row + 1) * DEFAULT_CELL_HEIGHT },\n { x: waypoints[1].x, y: (row + 1) * DEFAULT_CELL_HEIGHT },\n ];\n\n waypoints.splice(0, 1, ...newStart);\n return;\n}","import { is } from '../di/DiUtil.js';\nimport { getBounds } from '../utils/layoutUtil.js';\n\nexport default {\n 'createElementDi': ({ element, row, col, diFactory }) => {\n\n const bounds = getBounds(element, row, col);\n\n const options = {\n id: element.id + '_di'\n };\n\n if (is(element, 'bpmn:ExclusiveGateway')) {\n options.isMarkerVisible = true;\n }\n\n const shapeDi = diFactory.createDiShape(element, bounds, options);\n element.di = shapeDi;\n element.gridPosition = { row, col };\n\n return shapeDi;\n }\n};","import { connectElements } from '../utils/layoutUtil.js';\n\nexport default {\n 'addToGrid': ({ element, grid, visited }) => {\n const nextElements = [];\n\n // Handle outgoing paths\n const outgoing = (element.outgoing || [])\n .map(out => out.targetRef)\n .filter(el => el);\n\n let previousElement = null;\n outgoing.forEach((nextElement, index, arr) => {\n if (visited.has(nextElement)) {\n return;\n }\n\n if (!previousElement) {\n grid.addAfter(element, nextElement);\n }\n else {\n grid.addBelow(arr[index - 1], nextElement);\n }\n\n // Is self-looping\n if (nextElement !== element) {\n previousElement = nextElement;\n }\n\n nextElements.unshift(nextElement);\n visited.add(nextElement);\n });\n\n return nextElements;\n },\n 'createConnectionDi': ({ element, row, col, layoutGrid, diFactory }) => {\n const outgoing = element.outgoing || [];\n\n return outgoing.map(out => {\n const target = out.targetRef;\n const waypoints = connectElements(element, target, layoutGrid);\n\n const connectionDi = diFactory.createDiEdge(out, waypoints, {\n id: out.id + '_di'\n });\n\n return connectionDi;\n });\n\n }\n};","import { default as attacherHandler } from './attachersHandler.js';\nimport { default as elementHandler } from './elementHandler.js';\nimport { default as outgoingHandler } from './outgoingHandler.js';\n\nexport const handlers = [ elementHandler, outgoingHandler, attacherHandler ];","import BPMNModdle from 'bpmn-moddle';\nimport { isBoundaryEvent, isConnection } from './utils/elementUtils.js';\nimport { Grid } from './Grid.js';\nimport { DiFactory } from './di/DiFactory.js';\nimport { is } from './di/DiUtil.js';\nimport { handlers } from './handler/index.js';\nimport { isFunction } from 'min-dash';\n\nexport class Layouter {\n constructor() {\n this.moddle = new BPMNModdle();\n this.diFactory = new DiFactory(this.moddle);\n this._handlers = handlers;\n }\n\n handle(operation, options) {\n return this._handlers\n .filter(handler => isFunction(handler[operation]))\n .map(handler => handler[operation](options));\n\n }\n\n async layoutProcess(xml) {\n const { rootElement } = await this.moddle.fromXML(xml);\n\n this.diagram = rootElement;\n\n const root = this.getProcess();\n\n this.cleanDi();\n this.handlePlane(root);\n\n return (await this.moddle.toXML(this.diagram, { format: true })).xml;\n }\n\n handlePlane(planeElement) {\n const layout = this.createGridLayout(planeElement);\n this.generateDi(planeElement, layout);\n }\n\n cleanDi() {\n this.diagram.diagrams = [];\n }\n\n createGridLayout(root) {\n const grid = new Grid();\n\n const flowElements = root.flowElements;\n\n const startingElements = flowElements.filter(el => {\n return !isConnection(el) && !isBoundaryEvent(el) && (!el.incoming || el.length === 0);\n });\n\n const boundaryEvents = flowElements.filter(el => isBoundaryEvent(el));\n boundaryEvents.forEach(boundaryEvent => {\n const attachedTask = boundaryEvent.attachedToRef;\n const attachers = attachedTask.attachers || [];\n attachers.push(boundaryEvent);\n attachedTask.attachers = attachers;\n });\n\n // Depth-first-search\n const stack = [ ...startingElements ];\n const visited = new Set();\n\n startingElements.forEach(el => {\n grid.add(el);\n visited.add(el);\n });\n\n while (stack.length > 0) {\n const currentElement = stack.pop();\n\n if (is(currentElement, 'bpmn:SubProcess')) {\n this.handlePlane(currentElement);\n }\n\n const nextElements = this.handle('addToGrid', { element: currentElement, grid, visited });\n\n nextElements.flat().forEach(el => {\n stack.push(el);\n visited.add(el);\n });\n }\n\n return grid;\n }\n\n generateDi(root, layoutGrid) {\n const diFactory = this.diFactory;\n\n // Step 0: Create Root element\n const diagram = this.diagram;\n\n var planeDi = diFactory.createDiPlane({\n id: 'BPMNPlane_' + root.id,\n bpmnElement: root\n });\n var diagramDi = diFactory.createDiDiagram({\n id: 'BPMNDiagram_' + root.id,\n plane: planeDi\n });\n\n // deepest subprocess is added first - insert at the front\n diagram.diagrams.unshift(diagramDi);\n\n const planeElement = planeDi.get('planeElement');\n\n // Step 1: Create DI for all elements\n layoutGrid.elementsByPosition().forEach(({ element, row, col }) => {\n const dis = this\n .handle('createElementDi', { element, row, col, layoutGrid, diFactory })\n .flat();\n\n planeElement.push(...dis);\n });\n\n // Step 2: Create DI for all connections\n layoutGrid.elementsByPosition().forEach(({ element, row, col }) => {\n const dis = this\n .handle('createConnectionDi', { element, row, col, layoutGrid, diFactory })\n .flat();\n\n planeElement.push(...dis);\n });\n }\n\n\n getProcess() {\n return this.diagram.get('rootElements').find(el => el.$type === 'bpmn:Process');\n }\n}\n","import { Layouter } from './Layouter.js';\n\nexport function layoutProcess(xml) {\n return new Layouter().layoutProcess(xml);\n}\n"],"names":["assign","map","pick","isFunction"],"mappings":";;;;;AAAO,SAAS,YAAY,CAAC,OAAO,EAAE;AACtC,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;AAC7B,CAAC;AACD;AACO,SAAS,eAAe,CAAC,OAAO,EAAE;AACzC,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;AACjC;;ACNO,MAAM,IAAI,CAAC;AAClB,EAAE,WAAW,GAAG;AAChB,IAAI,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;AACnB,GAAG;AACH;AACA,EAAE,GAAG,CAAC,OAAO,EAAE,QA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