bpmn-js 9.0.0-subprocesses.0 → 9.0.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +73 -1
  2. package/dist/assets/bpmn-js.css +113 -0
  3. package/dist/assets/diagram-js.css +82 -78
  4. package/dist/bpmn-modeler.development.js +3402 -2196
  5. package/dist/bpmn-modeler.production.min.js +9 -8
  6. package/dist/bpmn-navigated-viewer.development.js +21207 -20345
  7. package/dist/bpmn-navigated-viewer.production.min.js +22 -20
  8. package/dist/bpmn-viewer.development.js +20401 -19562
  9. package/dist/bpmn-viewer.production.min.js +22 -20
  10. package/lib/BaseViewer.js +1 -1
  11. package/lib/Modeler.js +1 -4
  12. package/lib/Viewer.js +2 -2
  13. package/lib/draw/BpmnRenderer.js +8 -7
  14. package/lib/draw/PathMap.js +2 -2
  15. package/lib/features/auto-resize/BpmnAutoResizeProvider.js +9 -6
  16. package/lib/features/copy-paste/BpmnCopyPaste.js +1 -0
  17. package/lib/features/copy-paste/ModdleCopy.js +19 -2
  18. package/lib/features/di-ordering/BpmnDiOrdering.js +15 -11
  19. package/lib/features/drilldown/DrilldownBreadcrumbs.js +122 -0
  20. package/lib/features/drilldown/DrilldownCentering.js +118 -0
  21. package/lib/features/drilldown/DrilldownOverlayBehavior.js +181 -0
  22. package/lib/features/drilldown/SubprocessCompatibility.js +196 -0
  23. package/lib/features/drilldown/index.js +17 -0
  24. package/lib/features/label-editing/LabelEditingProvider.js +1 -1
  25. package/lib/features/label-editing/cmd/UpdateLabelHandler.js +29 -2
  26. package/lib/features/modeling/BpmnFactory.js +12 -8
  27. package/lib/features/modeling/BpmnUpdater.js +43 -6
  28. package/lib/features/modeling/ElementFactory.js +31 -13
  29. package/lib/features/modeling/behavior/CreateParticipantBehavior.js +59 -84
  30. package/lib/features/modeling/behavior/DropOnFlowBehavior.js +2 -2
  31. package/lib/features/modeling/behavior/RemoveEmbeddedLabelBoundsBehavior.js +34 -0
  32. package/lib/features/modeling/behavior/ResizeBehavior.js +129 -3
  33. package/lib/features/modeling/behavior/SubProcessPlaneBehavior.js +557 -0
  34. package/lib/features/modeling/behavior/ToggleCollapseConnectionBehaviour.js +74 -0
  35. package/lib/features/modeling/behavior/UnclaimIdBehavior.js +3 -1
  36. package/lib/features/modeling/behavior/index.js +27 -18
  37. package/lib/features/modeling/behavior/util/ResizeUtil.js +1 -132
  38. package/lib/features/modeling/cmd/SetColorHandler.js +23 -6
  39. package/lib/features/modeling/cmd/UpdateCanvasRootHandler.js +4 -2
  40. package/lib/features/modeling/util/ModelingUtil.js +2 -20
  41. package/lib/features/ordering/BpmnOrderingProvider.js +3 -3
  42. package/lib/features/palette/PaletteProvider.js +1 -1
  43. package/lib/features/popup-menu/ReplaceMenuProvider.js +1 -1
  44. package/lib/features/replace/BpmnReplace.js +38 -16
  45. package/lib/import/BpmnImporter.js +19 -13
  46. package/lib/import/BpmnTreeWalker.js +2 -2
  47. package/lib/import/Importer.js +134 -14
  48. package/lib/util/DiUtil.js +1 -0
  49. package/lib/util/DrilldownUtil.js +66 -0
  50. package/lib/util/ModelUtil.js +19 -0
  51. package/package.json +2 -2
  52. package/test/util/MockEvents.js +10 -2
  53. package/lib/features/collapsed-subprocesses/DeleteBehaviour.js +0 -65
  54. package/lib/features/collapsed-subprocesses/ToggleCollapseBehaviour.js +0 -133
  55. package/lib/features/collapsed-subprocesses/diagramFactory.js +0 -56
  56. package/lib/features/collapsed-subprocesses/index.js +0 -12
  57. package/lib/features/collapsed-subprocesses-navigation/CollapsedSubprocessNavigation.js +0 -198
  58. package/lib/features/collapsed-subprocesses-navigation/index.js +0 -7
@@ -0,0 +1,34 @@
1
+ import inherits from 'inherits';
2
+
3
+ import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
4
+
5
+ import { getDi } from '../../../util/ModelUtil';
6
+
7
+ /**
8
+ * BPMN specific behavior ensuring that bpmndi:Label's dc:Bounds are removed
9
+ * when shape is resized.
10
+ */
11
+ export default function RemoveEmbeddedLabelBoundsBehavior(eventBus, modeling) {
12
+ CommandInterceptor.call(this, eventBus);
13
+
14
+ this.preExecute('shape.resize', function(context) {
15
+ var shape = context.shape;
16
+
17
+ var di = getDi(shape),
18
+ label = di && di.get('label'),
19
+ bounds = label && label.get('bounds');
20
+
21
+ if (bounds) {
22
+ modeling.updateModdleProperties(shape, label, {
23
+ bounds: undefined
24
+ });
25
+ }
26
+ }, true);
27
+ }
28
+
29
+ inherits(RemoveEmbeddedLabelBoundsBehavior, CommandInterceptor);
30
+
31
+ RemoveEmbeddedLabelBoundsBehavior.$inject = [
32
+ 'eventBus',
33
+ 'modeling'
34
+ ];
@@ -2,7 +2,14 @@ import { is } from '../../../util/ModelUtil';
2
2
 
3
3
  import { isExpanded } from '../../../util/DiUtil';
4
4
 
5
- import { getParticipantResizeConstraints } from './util/ResizeUtil';
5
+ import {
6
+ asTRBL
7
+ } from 'diagram-js/lib/layout/LayoutUtil';
8
+
9
+ import {
10
+ collectLanes,
11
+ getLanesRoot
12
+ } from '../util/LaneUtil';
6
13
 
7
14
  var HIGH_PRIORITY = 1500;
8
15
 
@@ -14,7 +21,6 @@ export var SUB_PROCESS_MIN_DIMENSIONS = { width: 140, height: 120 };
14
21
 
15
22
  export var TEXT_ANNOTATION_MIN_DIMENSIONS = { width: 50, height: 30 };
16
23
 
17
-
18
24
  /**
19
25
  * Set minimum bounds/resize constraints on resize.
20
26
  *
@@ -45,4 +51,124 @@ export default function ResizeBehavior(eventBus) {
45
51
  });
46
52
  }
47
53
 
48
- ResizeBehavior.$inject = [ 'eventBus' ];
54
+ ResizeBehavior.$inject = [ 'eventBus' ];
55
+
56
+
57
+ var abs = Math.abs,
58
+ min = Math.min,
59
+ max = Math.max;
60
+
61
+
62
+ function addToTrbl(trbl, attr, value, choice) {
63
+ var current = trbl[attr];
64
+
65
+ // make sure to set the value if it does not exist
66
+ // or apply the correct value by comparing against
67
+ // choice(value, currentValue)
68
+ trbl[attr] = current === undefined ? value : choice(value, current);
69
+ }
70
+
71
+ function addMin(trbl, attr, value) {
72
+ return addToTrbl(trbl, attr, value, min);
73
+ }
74
+
75
+ function addMax(trbl, attr, value) {
76
+ return addToTrbl(trbl, attr, value, max);
77
+ }
78
+
79
+ var LANE_RIGHT_PADDING = 20,
80
+ LANE_LEFT_PADDING = 50,
81
+ LANE_TOP_PADDING = 20,
82
+ LANE_BOTTOM_PADDING = 20;
83
+
84
+ export function getParticipantResizeConstraints(laneShape, resizeDirection, balanced) {
85
+ var lanesRoot = getLanesRoot(laneShape);
86
+
87
+ var isFirst = true,
88
+ isLast = true;
89
+
90
+ // max top/bottom size for lanes
91
+ var allLanes = collectLanes(lanesRoot, [ lanesRoot ]);
92
+
93
+ var laneTrbl = asTRBL(laneShape);
94
+
95
+ var maxTrbl = {},
96
+ minTrbl = {};
97
+
98
+ if (/e/.test(resizeDirection)) {
99
+ minTrbl.right = laneTrbl.left + LANE_MIN_DIMENSIONS.width;
100
+ } else
101
+ if (/w/.test(resizeDirection)) {
102
+ minTrbl.left = laneTrbl.right - LANE_MIN_DIMENSIONS.width;
103
+ }
104
+
105
+ allLanes.forEach(function(other) {
106
+
107
+ var otherTrbl = asTRBL(other);
108
+
109
+ if (/n/.test(resizeDirection)) {
110
+
111
+ if (otherTrbl.top < (laneTrbl.top - 10)) {
112
+ isFirst = false;
113
+ }
114
+
115
+ // max top size (based on next element)
116
+ if (balanced && abs(laneTrbl.top - otherTrbl.bottom) < 10) {
117
+ addMax(maxTrbl, 'top', otherTrbl.top + LANE_MIN_DIMENSIONS.height);
118
+ }
119
+
120
+ // min top size (based on self or nested element)
121
+ if (abs(laneTrbl.top - otherTrbl.top) < 5) {
122
+ addMin(minTrbl, 'top', otherTrbl.bottom - LANE_MIN_DIMENSIONS.height);
123
+ }
124
+ }
125
+
126
+ if (/s/.test(resizeDirection)) {
127
+
128
+ if (otherTrbl.bottom > (laneTrbl.bottom + 10)) {
129
+ isLast = false;
130
+ }
131
+
132
+ // max bottom size (based on previous element)
133
+ if (balanced && abs(laneTrbl.bottom - otherTrbl.top) < 10) {
134
+ addMin(maxTrbl, 'bottom', otherTrbl.bottom - LANE_MIN_DIMENSIONS.height);
135
+ }
136
+
137
+ // min bottom size (based on self or nested element)
138
+ if (abs(laneTrbl.bottom - otherTrbl.bottom) < 5) {
139
+ addMax(minTrbl, 'bottom', otherTrbl.top + LANE_MIN_DIMENSIONS.height);
140
+ }
141
+ }
142
+ });
143
+
144
+ // max top/bottom/left/right size based on flow nodes
145
+ var flowElements = lanesRoot.children.filter(function(s) {
146
+ return !s.hidden && !s.waypoints && (is(s, 'bpmn:FlowElement') || is(s, 'bpmn:Artifact'));
147
+ });
148
+
149
+ flowElements.forEach(function(flowElement) {
150
+
151
+ var flowElementTrbl = asTRBL(flowElement);
152
+
153
+ if (isFirst && /n/.test(resizeDirection)) {
154
+ addMin(minTrbl, 'top', flowElementTrbl.top - LANE_TOP_PADDING);
155
+ }
156
+
157
+ if (/e/.test(resizeDirection)) {
158
+ addMax(minTrbl, 'right', flowElementTrbl.right + LANE_RIGHT_PADDING);
159
+ }
160
+
161
+ if (isLast && /s/.test(resizeDirection)) {
162
+ addMax(minTrbl, 'bottom', flowElementTrbl.bottom + LANE_BOTTOM_PADDING);
163
+ }
164
+
165
+ if (/w/.test(resizeDirection)) {
166
+ addMin(minTrbl, 'left', flowElementTrbl.left - LANE_LEFT_PADDING);
167
+ }
168
+ });
169
+
170
+ return {
171
+ min: minTrbl,
172
+ max: maxTrbl
173
+ };
174
+ }