bpmn-js 12.1.0 → 13.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 (289) hide show
  1. package/dist/bpmn-modeler.development.js +5172 -2047
  2. package/dist/bpmn-modeler.production.min.js +35 -35
  3. package/dist/bpmn-navigated-viewer.development.js +1547 -589
  4. package/dist/bpmn-navigated-viewer.production.min.js +5 -5
  5. package/dist/bpmn-viewer.development.js +1525 -584
  6. package/dist/bpmn-viewer.production.min.js +5 -5
  7. package/lib/BaseModeler.d.ts +12 -5
  8. package/lib/BaseModeler.js +4 -5
  9. package/lib/BaseViewer.d.ts +160 -366
  10. package/lib/BaseViewer.js +136 -57
  11. package/lib/Modeler.d.ts +76 -15
  12. package/lib/Modeler.js +6 -4
  13. package/lib/NavigatedViewer.d.ts +8 -3
  14. package/lib/Viewer.d.ts +44 -3
  15. package/lib/core/index.d.ts +10 -0
  16. package/lib/draw/BpmnRenderUtil.d.ts +76 -0
  17. package/lib/draw/BpmnRenderUtil.js +73 -21
  18. package/lib/draw/BpmnRenderer.d.ts +124 -0
  19. package/lib/draw/BpmnRenderer.js +51 -0
  20. package/lib/draw/PathMap.d.ts +330 -0
  21. package/lib/draw/PathMap.js +9 -2
  22. package/lib/draw/TextRenderer.d.ts +74 -0
  23. package/lib/draw/TextRenderer.js +32 -11
  24. package/lib/draw/index.d.ts +10 -0
  25. package/lib/features/align-elements/AlignElementsContextPadProvider.d.ts +32 -0
  26. package/lib/features/align-elements/AlignElementsContextPadProvider.js +28 -5
  27. package/lib/features/align-elements/AlignElementsIcons.d.ts +10 -0
  28. package/lib/features/align-elements/AlignElementsMenuProvider.d.ts +32 -0
  29. package/lib/features/align-elements/AlignElementsMenuProvider.js +38 -10
  30. package/lib/features/align-elements/BpmnAlignElements.d.ts +9 -0
  31. package/lib/features/align-elements/BpmnAlignElements.js +7 -1
  32. package/lib/features/align-elements/index.d.ts +11 -0
  33. package/lib/features/auto-place/BpmnAutoPlace.d.ts +13 -0
  34. package/lib/features/auto-place/BpmnAutoPlace.js +3 -0
  35. package/lib/features/auto-place/BpmnAutoPlaceUtil.d.ts +47 -0
  36. package/lib/features/auto-place/BpmnAutoPlaceUtil.js +39 -11
  37. package/lib/features/auto-place/index.d.ts +7 -0
  38. package/lib/features/auto-resize/BpmnAutoResize.d.ts +25 -0
  39. package/lib/features/auto-resize/BpmnAutoResize.js +15 -7
  40. package/lib/features/auto-resize/BpmnAutoResizeProvider.d.ts +26 -0
  41. package/lib/features/auto-resize/BpmnAutoResizeProvider.js +16 -4
  42. package/lib/features/auto-resize/index.d.ts +8 -0
  43. package/lib/features/context-pad/ContextPadProvider.d.ts +60 -0
  44. package/lib/features/context-pad/ContextPadProvider.js +64 -9
  45. package/lib/features/context-pad/index.d.ts +7 -0
  46. package/lib/features/copy-paste/BpmnCopyPaste.d.ts +17 -0
  47. package/lib/features/copy-paste/BpmnCopyPaste.js +15 -7
  48. package/lib/features/copy-paste/ModdleCopy.d.ts +45 -0
  49. package/lib/features/copy-paste/ModdleCopy.js +17 -45
  50. package/lib/features/copy-paste/index.d.ts +9 -0
  51. package/lib/features/di-ordering/BpmnDiOrdering.d.ts +11 -0
  52. package/lib/features/di-ordering/BpmnDiOrdering.js +8 -0
  53. package/lib/features/di-ordering/index.d.ts +6 -0
  54. package/lib/features/distribute-elements/BpmnDistributeElements.d.ts +10 -0
  55. package/lib/features/distribute-elements/BpmnDistributeElements.js +9 -4
  56. package/lib/features/distribute-elements/DistributeElementsIcons.d.ts +5 -0
  57. package/lib/features/distribute-elements/DistributeElementsMenuProvider.d.ts +32 -0
  58. package/lib/features/distribute-elements/DistributeElementsMenuProvider.js +27 -4
  59. package/lib/features/distribute-elements/index.d.ts +9 -0
  60. package/lib/features/drilldown/DrilldownBreadcrumbs.d.ts +19 -0
  61. package/lib/features/drilldown/DrilldownBreadcrumbs.js +34 -24
  62. package/lib/features/drilldown/DrilldownCentering.d.ts +17 -0
  63. package/lib/features/drilldown/DrilldownCentering.js +7 -2
  64. package/lib/features/drilldown/DrilldownOverlayBehavior.d.ts +18 -0
  65. package/lib/features/drilldown/DrilldownOverlayBehavior.js +70 -40
  66. package/lib/features/drilldown/SubprocessCompatibility.d.ts +21 -0
  67. package/lib/features/drilldown/SubprocessCompatibility.js +80 -30
  68. package/lib/features/drilldown/index.d.ts +13 -0
  69. package/lib/features/editor-actions/BpmnEditorActions.d.ts +13 -0
  70. package/lib/features/editor-actions/BpmnEditorActions.js +4 -0
  71. package/lib/features/editor-actions/index.d.ts +6 -0
  72. package/lib/features/grid-snapping/BpmnGridSnapping.d.ts +9 -0
  73. package/lib/features/grid-snapping/BpmnGridSnapping.js +7 -0
  74. package/lib/features/grid-snapping/behavior/GridSnappingAutoPlaceBehavior.d.ts +12 -0
  75. package/lib/features/grid-snapping/behavior/GridSnappingAutoPlaceBehavior.js +16 -1
  76. package/lib/features/grid-snapping/behavior/GridSnappingLayoutConnectionBehavior.d.ts +27 -0
  77. package/lib/features/grid-snapping/behavior/GridSnappingLayoutConnectionBehavior.js +20 -8
  78. package/lib/features/grid-snapping/behavior/GridSnappingParticipantBehavior.d.ts +13 -0
  79. package/lib/features/grid-snapping/behavior/GridSnappingParticipantBehavior.js +11 -1
  80. package/lib/features/grid-snapping/behavior/index.d.ts +10 -0
  81. package/lib/features/grid-snapping/index.d.ts +11 -0
  82. package/lib/features/interaction-events/BpmnInteractionEvents.d.ts +18 -0
  83. package/lib/features/interaction-events/BpmnInteractionEvents.js +34 -9
  84. package/lib/features/interaction-events/index.d.ts +6 -0
  85. package/lib/features/keyboard/BpmnKeyboardBindings.d.ts +15 -0
  86. package/lib/features/keyboard/BpmnKeyboardBindings.js +5 -0
  87. package/lib/features/keyboard/index.d.ts +7 -0
  88. package/lib/features/label-editing/LabelEditingPreview.d.ts +13 -0
  89. package/lib/features/label-editing/LabelEditingPreview.js +13 -6
  90. package/lib/features/label-editing/LabelEditingProvider.d.ts +62 -0
  91. package/lib/features/label-editing/LabelEditingProvider.js +48 -11
  92. package/lib/features/label-editing/LabelUtil.d.ts +14 -0
  93. package/lib/features/label-editing/LabelUtil.js +16 -1
  94. package/lib/features/label-editing/cmd/UpdateLabelHandler.d.ts +22 -0
  95. package/lib/features/label-editing/cmd/UpdateLabelHandler.js +14 -3
  96. package/lib/features/label-editing/index.d.ts +9 -0
  97. package/lib/features/modeling/BpmnFactory.d.ts +67 -0
  98. package/lib/features/modeling/BpmnFactory.js +57 -8
  99. package/lib/features/modeling/BpmnLayouter.d.ts +26 -0
  100. package/lib/features/modeling/BpmnLayouter.js +25 -2
  101. package/lib/features/modeling/BpmnUpdater.d.ts +92 -0
  102. package/lib/features/modeling/BpmnUpdater.js +90 -29
  103. package/lib/features/modeling/ElementFactory.d.ts +116 -0
  104. package/lib/features/modeling/ElementFactory.js +114 -17
  105. package/lib/features/modeling/ElementFactory.test.ts +133 -0
  106. package/lib/features/modeling/Modeling.d.ts +150 -0
  107. package/lib/features/modeling/Modeling.js +124 -19
  108. package/lib/features/modeling/Modeling.test.ts +148 -0
  109. package/lib/features/modeling/behavior/AdaptiveLabelPositioningBehavior.d.ts +20 -0
  110. package/lib/features/modeling/behavior/AdaptiveLabelPositioningBehavior.js +16 -6
  111. package/lib/features/modeling/behavior/AppendBehavior.d.ts +6 -0
  112. package/lib/features/modeling/behavior/AppendBehavior.js +6 -5
  113. package/lib/features/modeling/behavior/AssociationBehavior.d.ts +11 -0
  114. package/lib/features/modeling/behavior/AssociationBehavior.js +9 -1
  115. package/lib/features/modeling/behavior/AttachEventBehavior.d.ts +15 -0
  116. package/lib/features/modeling/behavior/AttachEventBehavior.js +11 -3
  117. package/lib/features/modeling/behavior/BoundaryEventBehavior.d.ts +15 -0
  118. package/lib/features/modeling/behavior/BoundaryEventBehavior.js +8 -1
  119. package/lib/features/modeling/behavior/CreateBehavior.d.ts +9 -0
  120. package/lib/features/modeling/behavior/CreateBehavior.js +6 -0
  121. package/lib/features/modeling/behavior/CreateDataObjectBehavior.d.ts +15 -0
  122. package/lib/features/modeling/behavior/CreateDataObjectBehavior.js +10 -4
  123. package/lib/features/modeling/behavior/CreateParticipantBehavior.d.ts +19 -0
  124. package/lib/features/modeling/behavior/CreateParticipantBehavior.js +10 -0
  125. package/lib/features/modeling/behavior/DataInputAssociationBehavior.d.ts +21 -0
  126. package/lib/features/modeling/behavior/DataInputAssociationBehavior.js +5 -0
  127. package/lib/features/modeling/behavior/DataStoreBehavior.d.ts +19 -0
  128. package/lib/features/modeling/behavior/DataStoreBehavior.js +12 -1
  129. package/lib/features/modeling/behavior/DeleteLaneBehavior.d.ts +15 -0
  130. package/lib/features/modeling/behavior/DeleteLaneBehavior.js +9 -3
  131. package/lib/features/modeling/behavior/DetachEventBehavior.d.ts +15 -0
  132. package/lib/features/modeling/behavior/DetachEventBehavior.js +11 -3
  133. package/lib/features/modeling/behavior/DropOnFlowBehavior.d.ts +13 -0
  134. package/lib/features/modeling/behavior/DropOnFlowBehavior.js +11 -1
  135. package/lib/features/modeling/behavior/EventBasedGatewayBehavior.d.ts +11 -0
  136. package/lib/features/modeling/behavior/EventBasedGatewayBehavior.js +9 -0
  137. package/lib/features/modeling/behavior/FixHoverBehavior.d.ts +17 -0
  138. package/lib/features/modeling/behavior/FixHoverBehavior.js +6 -0
  139. package/lib/features/modeling/behavior/GroupBehavior.d.ts +26 -0
  140. package/lib/features/modeling/behavior/GroupBehavior.js +35 -13
  141. package/lib/features/modeling/behavior/ImportDockingFix.d.ts +13 -0
  142. package/lib/features/modeling/behavior/ImportDockingFix.js +3 -0
  143. package/lib/features/modeling/behavior/IsHorizontalFix.d.ts +10 -0
  144. package/lib/features/modeling/behavior/IsHorizontalFix.js +4 -0
  145. package/lib/features/modeling/behavior/LabelBehavior.d.ts +56 -0
  146. package/lib/features/modeling/behavior/LabelBehavior.js +22 -10
  147. package/lib/features/modeling/behavior/LayoutConnectionBehavior.d.ts +16 -0
  148. package/lib/features/modeling/behavior/LayoutConnectionBehavior.js +6 -2
  149. package/lib/features/modeling/behavior/MessageFlowBehavior.d.ts +15 -0
  150. package/lib/features/modeling/behavior/MessageFlowBehavior.js +8 -0
  151. package/lib/features/modeling/behavior/ModelingFeedback.d.ts +13 -0
  152. package/lib/features/modeling/behavior/ModelingFeedback.js +11 -0
  153. package/lib/features/modeling/behavior/RemoveElementBehavior.d.ts +13 -0
  154. package/lib/features/modeling/behavior/RemoveElementBehavior.js +11 -1
  155. package/lib/features/modeling/behavior/RemoveEmbeddedLabelBoundsBehavior.d.ts +16 -0
  156. package/lib/features/modeling/behavior/RemoveEmbeddedLabelBoundsBehavior.js +8 -0
  157. package/lib/features/modeling/behavior/RemoveParticipantBehavior.d.ts +15 -0
  158. package/lib/features/modeling/behavior/RemoveParticipantBehavior.js +8 -1
  159. package/lib/features/modeling/behavior/ReplaceConnectionBehavior.d.ts +15 -0
  160. package/lib/features/modeling/behavior/ReplaceConnectionBehavior.js +13 -1
  161. package/lib/features/modeling/behavior/ReplaceElementBehaviour.d.ts +23 -0
  162. package/lib/features/modeling/behavior/ReplaceElementBehaviour.js +19 -4
  163. package/lib/features/modeling/behavior/ResizeBehavior.d.ts +57 -0
  164. package/lib/features/modeling/behavior/ResizeBehavior.js +35 -0
  165. package/lib/features/modeling/behavior/ResizeLaneBehavior.d.ts +16 -0
  166. package/lib/features/modeling/behavior/ResizeLaneBehavior.js +10 -3
  167. package/lib/features/modeling/behavior/RootElementReferenceBehavior.d.ts +25 -0
  168. package/lib/features/modeling/behavior/RootElementReferenceBehavior.js +19 -0
  169. package/lib/features/modeling/behavior/SpaceToolBehavior.d.ts +10 -0
  170. package/lib/features/modeling/behavior/SpaceToolBehavior.js +14 -4
  171. package/lib/features/modeling/behavior/SubProcessPlaneBehavior.d.ts +28 -0
  172. package/lib/features/modeling/behavior/SubProcessPlaneBehavior.js +45 -23
  173. package/lib/features/modeling/behavior/SubProcessStartEventBehavior.d.ts +15 -0
  174. package/lib/features/modeling/behavior/SubProcessStartEventBehavior.js +6 -0
  175. package/lib/features/modeling/behavior/ToggleCollapseConnectionBehaviour.d.ts +14 -0
  176. package/lib/features/modeling/behavior/ToggleCollapseConnectionBehaviour.js +14 -1
  177. package/lib/features/modeling/behavior/ToggleElementCollapseBehaviour.d.ts +13 -0
  178. package/lib/features/modeling/behavior/ToggleElementCollapseBehaviour.js +11 -3
  179. package/lib/features/modeling/behavior/UnclaimIdBehavior.d.ts +19 -0
  180. package/lib/features/modeling/behavior/UnclaimIdBehavior.js +7 -0
  181. package/lib/features/modeling/behavior/UnsetDefaultFlowBehavior.d.ts +16 -0
  182. package/lib/features/modeling/behavior/UnsetDefaultFlowBehavior.js +6 -3
  183. package/lib/features/modeling/behavior/UpdateFlowNodeRefsBehavior.d.ts +17 -0
  184. package/lib/features/modeling/behavior/UpdateFlowNodeRefsBehavior.js +13 -10
  185. package/lib/features/modeling/behavior/index.d.ts +2 -0
  186. package/lib/features/modeling/behavior/index.js +3 -0
  187. package/lib/features/modeling/behavior/util/CategoryUtil.d.ts +49 -0
  188. package/lib/features/modeling/behavior/util/CategoryUtil.js +10 -6
  189. package/lib/features/modeling/behavior/util/ConnectionLayoutUtil.d.ts +19 -0
  190. package/lib/features/modeling/behavior/util/ConnectionLayoutUtil.js +11 -5
  191. package/lib/features/modeling/behavior/util/GeometricUtil.d.ts +1 -0
  192. package/lib/features/modeling/behavior/util/LabelLayoutUtil.d.ts +32 -0
  193. package/lib/features/modeling/behavior/util/LabelLayoutUtil.js +27 -18
  194. package/lib/features/modeling/behavior/util/LayoutUtil.d.ts +48 -0
  195. package/lib/features/modeling/behavior/util/LayoutUtil.js +35 -6
  196. package/lib/features/modeling/behavior/util/LineAttachmentUtil.d.ts +37 -0
  197. package/lib/features/modeling/behavior/util/LineAttachmentUtil.js +17 -5
  198. package/lib/features/modeling/behavior/util/LineIntersect.d.ts +13 -0
  199. package/lib/features/modeling/behavior/util/LineIntersect.js +4 -0
  200. package/lib/features/modeling/behavior/util/ResizeUtil.d.ts +1 -0
  201. package/lib/features/modeling/cmd/AddLaneHandler.d.ts +22 -0
  202. package/lib/features/modeling/cmd/AddLaneHandler.js +8 -0
  203. package/lib/features/modeling/cmd/IdClaimHandler.d.ts +22 -0
  204. package/lib/features/modeling/cmd/IdClaimHandler.js +15 -0
  205. package/lib/features/modeling/cmd/ResizeLaneHandler.d.ts +39 -0
  206. package/lib/features/modeling/cmd/ResizeLaneHandler.js +17 -4
  207. package/lib/features/modeling/cmd/SetColorHandler.d.ts +18 -0
  208. package/lib/features/modeling/cmd/SetColorHandler.js +25 -12
  209. package/lib/features/modeling/cmd/SplitLaneHandler.d.ts +22 -0
  210. package/lib/features/modeling/cmd/SplitLaneHandler.js +9 -0
  211. package/lib/features/modeling/cmd/UpdateCanvasRootHandler.d.ts +20 -0
  212. package/lib/features/modeling/cmd/UpdateCanvasRootHandler.js +16 -1
  213. package/lib/features/modeling/cmd/UpdateFlowNodeRefsHandler.d.ts +21 -0
  214. package/lib/features/modeling/cmd/UpdateFlowNodeRefsHandler.js +29 -4
  215. package/lib/features/modeling/cmd/UpdateModdlePropertiesHandler.d.ts +20 -0
  216. package/lib/features/modeling/cmd/UpdateModdlePropertiesHandler.js +17 -3
  217. package/lib/features/modeling/cmd/UpdatePropertiesHandler.d.ts +60 -0
  218. package/lib/features/modeling/cmd/UpdatePropertiesHandler.js +38 -14
  219. package/lib/features/modeling/cmd/UpdateSemanticParentHandler.d.ts +18 -0
  220. package/lib/features/modeling/cmd/UpdateSemanticParentHandler.js +15 -0
  221. package/lib/features/modeling/index.d.ts +27 -0
  222. package/lib/features/modeling/util/LaneUtil.d.ts +46 -0
  223. package/lib/features/modeling/util/LaneUtil.js +22 -13
  224. package/lib/features/modeling/util/ModelingUtil.d.ts +12 -0
  225. package/lib/features/modeling/util/ModelingUtil.js +10 -4
  226. package/lib/features/ordering/BpmnOrderingProvider.d.ts +21 -0
  227. package/lib/features/ordering/BpmnOrderingProvider.js +9 -3
  228. package/lib/features/ordering/index.d.ts +7 -0
  229. package/lib/features/palette/PaletteProvider.d.ts +34 -0
  230. package/lib/features/palette/PaletteProvider.js +26 -2
  231. package/lib/features/palette/index.d.ts +9 -0
  232. package/lib/features/popup-menu/ReplaceMenuProvider.d.ts +50 -0
  233. package/lib/features/popup-menu/ReplaceMenuProvider.js +226 -202
  234. package/lib/features/popup-menu/index.d.ts +11 -0
  235. package/lib/features/popup-menu/util/TypeUtil.d.ts +12 -0
  236. package/lib/features/popup-menu/util/TypeUtil.js +4 -1
  237. package/lib/features/replace/BpmnReplace.d.ts +47 -0
  238. package/lib/features/replace/BpmnReplace.js +81 -29
  239. package/lib/features/replace/ReplaceOptions.d.ts +70 -0
  240. package/lib/features/replace/ReplaceOptions.js +58 -0
  241. package/lib/features/replace/index.d.ts +9 -0
  242. package/lib/features/replace-preview/BpmnReplacePreview.d.ts +17 -0
  243. package/lib/features/replace-preview/BpmnReplacePreview.js +15 -1
  244. package/lib/features/replace-preview/index.d.ts +7 -0
  245. package/lib/features/rules/BpmnRules.d.ts +171 -0
  246. package/lib/features/rules/BpmnRules.js +295 -46
  247. package/lib/features/rules/index.d.ts +7 -0
  248. package/lib/features/search/BpmnSearchProvider.d.ts +29 -0
  249. package/lib/features/search/BpmnSearchProvider.js +30 -22
  250. package/lib/features/search/index.d.ts +7 -0
  251. package/lib/features/snapping/BpmnConnectSnapping.d.ts +17 -0
  252. package/lib/features/snapping/BpmnConnectSnapping.js +51 -3
  253. package/lib/features/snapping/BpmnCreateMoveSnapping.d.ts +41 -0
  254. package/lib/features/snapping/BpmnCreateMoveSnapping.js +47 -1
  255. package/lib/features/snapping/BpmnSnappingUtil.d.ts +11 -0
  256. package/lib/features/snapping/BpmnSnappingUtil.js +12 -0
  257. package/lib/features/snapping/index.d.ts +9 -0
  258. package/lib/features/space-tool/BpmnSpaceTool.d.ts +21 -0
  259. package/lib/features/space-tool/BpmnSpaceTool.js +20 -1
  260. package/lib/features/space-tool/index.d.ts +6 -0
  261. package/lib/import/BpmnImporter.d.ts +49 -0
  262. package/lib/import/BpmnImporter.js +37 -10
  263. package/lib/import/BpmnTreeWalker.d.ts +22 -0
  264. package/lib/import/BpmnTreeWalker.js +25 -22
  265. package/lib/import/Importer.d.ts +25 -0
  266. package/lib/import/Importer.js +15 -21
  267. package/lib/import/Util.d.ts +1 -0
  268. package/lib/import/index.d.ts +6 -0
  269. package/lib/model/Types.d.ts +24 -0
  270. package/lib/model/Types.ts +40 -0
  271. package/lib/util/CompatibilityUtil.d.ts +22 -0
  272. package/lib/util/CompatibilityUtil.js +13 -0
  273. package/lib/util/DiUtil.d.ts +53 -0
  274. package/lib/util/DiUtil.js +47 -13
  275. package/lib/util/DrilldownUtil.d.ts +39 -0
  276. package/lib/util/DrilldownUtil.js +12 -8
  277. package/lib/util/LabelUtil.d.ts +73 -0
  278. package/lib/util/LabelUtil.js +40 -16
  279. package/lib/util/ModelUtil.d.ts +40 -0
  280. package/lib/util/ModelUtil.js +9 -5
  281. package/lib/util/PoweredByUtil.d.ts +8 -0
  282. package/lib/util/Types.js +5 -0
  283. package/lib/util/Types.ts +4 -0
  284. package/package.json +10 -5
  285. package/test/matchers/ConnectionMatchers.js +1 -1
  286. package/lib/icons/dist/append.svg +0 -1
  287. package/lib/icons/dist/connect-context-pad.svg +0 -1
  288. package/lib/icons/dist/connect-palette.svg +0 -1
  289. package/lib/icons/dist/create.svg +0 -1
@@ -0,0 +1,133 @@
1
+ import Modeler from '../../Modeler';
2
+
3
+ import ElementFactory from './ElementFactory';
4
+
5
+ import {
6
+ Connection,
7
+ Label,
8
+ Root,
9
+ Shape
10
+ } from '../../model/Types';
11
+
12
+ const modeler = new Modeler();
13
+
14
+ const elementFactory = modeler.get<ElementFactory>('elementFactory');
15
+
16
+ const shape1 = elementFactory.create('shape', {
17
+ type: 'bpmn:Task',
18
+ id: 'shape1',
19
+ x: 100,
20
+ y: 100,
21
+ width: 100,
22
+ height: 100
23
+ });
24
+
25
+ const shape2 = elementFactory.create('shape', {
26
+ type: 'bpmn:Task',
27
+ id: 'shape2',
28
+ x: 100,
29
+ y: 100,
30
+ width: 100,
31
+ height: 100
32
+ });
33
+
34
+ const connection = elementFactory.create('connection', {
35
+ type: 'bpmn:SequenceFlow',
36
+ id: 'connection',
37
+ source: shape1,
38
+ target: shape2,
39
+ waypoints: []
40
+ });
41
+
42
+ elementFactory.create('root', {
43
+ type: 'bpmn:Process',
44
+ id: 'root'
45
+ });
46
+
47
+ elementFactory.create('label', {
48
+ type: 'bpmn:Task',
49
+ id: 'label'
50
+ });
51
+
52
+ elementFactory.create('shape', {
53
+ type: 'bpmn:Task'
54
+ });
55
+
56
+ elementFactory.create('connection', {
57
+ type: 'bpmn:SequenceFlow'
58
+ });
59
+
60
+ elementFactory.create('root', {
61
+ type: 'bpmn:Process'
62
+ });
63
+
64
+ elementFactory.create('label', {
65
+ type: 'bpmn:Task'
66
+ });
67
+
68
+ elementFactory.create('connection', {
69
+ type: 'bpmn:Association',
70
+ associationDirection: 'One'
71
+ });
72
+
73
+ elementFactory.create('shape', {
74
+ type: 'bpmn:BoundaryEvent',
75
+ cancelActivity: true,
76
+ eventDefinitionType: 'bpmn:ErrorEventDefinition'
77
+ });
78
+
79
+ elementFactory.create('shape', {
80
+ type: 'bpmn:Task',
81
+ isForCompensation: false
82
+ });
83
+
84
+ elementFactory.create('shape', {
85
+ type: 'bpmn:Participant',
86
+ processRef: {}
87
+ });
88
+
89
+ elementFactory.create('shape', {
90
+ type: 'bpmn:SubProcess',
91
+ triggeredByEvent: true
92
+ });
93
+
94
+ elementFactory.createElement('connection', {
95
+ type: 'bpmn:SequenceFlow'
96
+ });
97
+
98
+ elementFactory.createElement('root', {
99
+ type: 'bpmn:Process'
100
+ });
101
+
102
+ elementFactory.createElement('shape', {
103
+ type: 'bpmn:Task'
104
+ });
105
+
106
+ elementFactory.getDefaultSize(shape1, { type: 'bpmndi:BPMNShape' });
107
+
108
+ elementFactory.getDefaultSize(connection, { type: 'bpmndi:BPMNEdge' });
109
+
110
+ elementFactory.createParticipantShape();
111
+
112
+ elementFactory.createParticipantShape(true);
113
+
114
+ elementFactory.createParticipantShape({
115
+ type: 'bpmn:Participant',
116
+ isExpanded: true
117
+ });
118
+
119
+ /**
120
+ * Customization
121
+ */
122
+
123
+ type CustomShape = {
124
+ foo: string;
125
+ } & Shape;
126
+
127
+ export class CustomElementFactory extends ElementFactory<Connection, Label, Root, CustomShape> {};
128
+
129
+ const customElementFactory = modeler.get<CustomElementFactory>('elementFactory');
130
+
131
+ const customShape = customElementFactory.createShape({ foo: 'bar' });
132
+
133
+ console.log(customShape.foo);
@@ -0,0 +1,150 @@
1
+ /**
2
+ * The BPMN 2.0 modeling entry point.
3
+ *
4
+ *
5
+ * @extends {BaseModeling<T, U, V, W, X>}
6
+ *
7
+ */
8
+ export default class Modeling<T extends import("../../model/Types").Connection = import("../../model/Types").Connection, U extends import("../../model/Types").Element = import("../../model/Types").Element, V extends import("../../model/Types").Label = import("../../model/Types").Label, W extends import("../../model/Types").Parent = import("../../model/Types").Parent, X extends import("../../model/Types").Shape = import("../../model/Types").Shape> extends BaseModeling<T, U, V, W, X> {
9
+ /**
10
+ * @param eventBus
11
+ * @param elementFactory
12
+ * @param commandStack
13
+ * @param bpmnRules
14
+ */
15
+ constructor(eventBus: EventBus, elementFactory: ElementFactory, commandStack: CommandStack, bpmnRules: BpmnRules);
16
+
17
+ getHandlers(): any;
18
+
19
+ /**
20
+ * Update an element's label.
21
+ *
22
+ * @param element The element.
23
+ * @param newLabel The new label.
24
+ * @param newBounds The optional bounds of the label.
25
+ * @param hints The optional hints.
26
+ */
27
+ updateLabel(element: Element, newLabel: string, newBounds?: Rect, hints?: UpdateLabelHints): void;
28
+
29
+ /**
30
+ * @param source
31
+ * @param target
32
+ * @param attrs
33
+ * @param hints
34
+ *
35
+ * @return
36
+ */
37
+ connect(source: Element, target: Element, attrs: Partial<Connection>, hints?: ModelingHints): T;
38
+
39
+ /**
40
+ * Update a model element's properties.
41
+ *
42
+ * @param element The element.
43
+ * @param moddleElement The model element.
44
+ * @param properties The updated properties.
45
+ */
46
+ updateModdleProperties(element: Element, moddleElement: ModdleElement, properties: any): void;
47
+
48
+ /**
49
+ * Update an element's properties.
50
+ *
51
+ * @param element The element.
52
+ * @param properties The updated properties.
53
+ */
54
+ updateProperties(element: Element, properties: any): void;
55
+
56
+ /**
57
+ * Resize a lane.
58
+ *
59
+ * @param laneShape The lane.
60
+ * @param newBounds The new bounds of the lane.
61
+ * @param balanced Wether to resize neighboring lanes.
62
+ */
63
+ resizeLane(laneShape: Shape, newBounds: Rect, balanced?: boolean): void;
64
+
65
+ /**
66
+ * Add a lane.
67
+ *
68
+ * @param targetLaneShape The shape to add the lane to.
69
+ * @param location The location.
70
+ *
71
+ * @return The added lane.
72
+ */
73
+ addLane(targetLaneShape: Shape, location: string): Shape;
74
+
75
+ /**
76
+ * Split a lane.
77
+ *
78
+ * @param targetLane The lane to split.
79
+ * @param count The number of lanes to split the lane into. Must not
80
+ * exceed the number of existing lanes.
81
+ */
82
+ splitLane(targetLane: Shape, count: number): void;
83
+
84
+ /**
85
+ * Turn a process into a collaboration.
86
+ *
87
+ * @return The root of the collaboration.
88
+ */
89
+ makeCollaboration(): Root;
90
+
91
+ /**
92
+ * Transform a collaboration into a process.
93
+ *
94
+ * @return The root of the process.
95
+ */
96
+ makeProcess(): Root;
97
+
98
+ /**
99
+ * Update the referenced lanes of each flow node.
100
+ *
101
+ * @param flowNodeShapes The flow nodes to update.
102
+ * @param laneShapes The lanes.
103
+ */
104
+ updateLaneRefs(flowNodeShapes: Shape[], laneShapes: Shape[]): void;
105
+
106
+ /**
107
+ * Claim an ID.
108
+ *
109
+ * @param id The ID to claim.
110
+ * @param moddleElement The model element the ID is claimed for.
111
+ */
112
+ claimId(id: string, moddleElement: ModdleElement): void;
113
+
114
+ /**
115
+ * Unclaim an ID.
116
+ *
117
+ * @param id The ID to unclaim.
118
+ * @param moddleElement The model element the ID is claimed for.
119
+ */
120
+ unclaimId(id: string, moddleElement: ModdleElement): void;
121
+
122
+ /**
123
+ * Set the color(s) of one or many elements.
124
+ *
125
+ * @param elements The elements to set the color(s) for.
126
+ * @param colors The color(s) to set.
127
+ */
128
+ setColor(elements: Element[], colors: Colors): void;
129
+ }
130
+
131
+ type BpmnRules = import('../rules/BpmnRules').default;
132
+ type CommandStack = import('diagram-js/lib/command/CommandStack').default;
133
+ type ElementFactory = import('./ElementFactory').default;
134
+ type EventBus = import('diagram-js/lib/core/EventBus').default;
135
+ type ModelingHints = import('diagram-js/lib/features/modeling/Modeling').ModelingHints;
136
+ type Connection = import('../../model/Types').Connection;
137
+ type Element = import('../../model/Types').Element;
138
+ type Label = import('../../model/Types').Label;
139
+ type Parent = import('../../model/Types').Parent;
140
+ type Root = import('../../model/Types').Root;
141
+ type Shape = import('../../model/Types').Shape;
142
+ type ModdleElement = import('../../model/Types').ModdleElement;
143
+ type Rect = import('diagram-js/lib/util/Types').Rect;
144
+ type Colors = import('../../util/Types').Colors;
145
+
146
+ export type UpdateLabelHints = {
147
+ removeShape?: boolean;
148
+ };
149
+
150
+ import BaseModeling from 'diagram-js/lib/features/modeling/Modeling';
@@ -14,9 +14,41 @@ import SetColorHandler from './cmd/SetColorHandler';
14
14
 
15
15
  import UpdateLabelHandler from '../label-editing/cmd/UpdateLabelHandler';
16
16
 
17
+ /**
18
+ * @typedef {import('../rules/BpmnRules').default} BpmnRules
19
+ * @typedef {import('diagram-js/lib/command/CommandStack').default} CommandStack
20
+ * @typedef {import('./ElementFactory').default} ElementFactory
21
+ * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
22
+ *
23
+ * @typedef {import('diagram-js/lib/features/modeling/Modeling').ModelingHints} ModelingHints
24
+ *
25
+ * @typedef {import('../../model/Types').Connection} Connection
26
+ * @typedef {import('../../model/Types').Element} Element
27
+ * @typedef {import('../../model/Types').Label} Label
28
+ * @typedef {import('../../model/Types').Parent} Parent
29
+ * @typedef {import('../../model/Types').Root} Root
30
+ * @typedef {import('../../model/Types').Shape} Shape
31
+ * @typedef {import('../../model/Types').ModdleElement} ModdleElement
32
+ *
33
+ * @typedef {import('diagram-js/lib/util/Types').Rect} Rect
34
+ *
35
+ * @typedef {import('../../util/Types').Colors} Colors
36
+ *
37
+ * @typedef { {
38
+ * removeShape?: boolean;
39
+ * } } UpdateLabelHints
40
+ */
17
41
 
18
42
  /**
19
- * BPMN 2.0 modeling features activator
43
+ * The BPMN 2.0 modeling entry point.
44
+ *
45
+ * @template {Connection} [T=Connection]
46
+ * @template {Element} [U=Element]
47
+ * @template {Label} [V=Label]
48
+ * @template {Parent} [W=Parent]
49
+ * @template {Shape} [X=Shape]
50
+ *
51
+ * @extends {BaseModeling<T, U, V, W, X>}
20
52
  *
21
53
  * @param {EventBus} eventBus
22
54
  * @param {ElementFactory} elementFactory
@@ -24,8 +56,11 @@ import UpdateLabelHandler from '../label-editing/cmd/UpdateLabelHandler';
24
56
  * @param {BpmnRules} bpmnRules
25
57
  */
26
58
  export default function Modeling(
27
- eventBus, elementFactory, commandStack,
28
- bpmnRules) {
59
+ eventBus,
60
+ elementFactory,
61
+ commandStack,
62
+ bpmnRules
63
+ ) {
29
64
 
30
65
  BaseModeling.call(this, eventBus, elementFactory, commandStack);
31
66
 
@@ -59,7 +94,14 @@ Modeling.prototype.getHandlers = function() {
59
94
  return handlers;
60
95
  };
61
96
 
62
-
97
+ /**
98
+ * Update an element's label.
99
+ *
100
+ * @param {Element} element The element.
101
+ * @param {string} newLabel The new label.
102
+ * @param {Rect} [newBounds] The optional bounds of the label.
103
+ * @param {UpdateLabelHints} [hints] The optional hints.
104
+ */
63
105
  Modeling.prototype.updateLabel = function(element, newLabel, newBounds, hints) {
64
106
  this._commandStack.execute('element.updateLabel', {
65
107
  element: element,
@@ -69,7 +111,14 @@ Modeling.prototype.updateLabel = function(element, newLabel, newBounds, hints) {
69
111
  });
70
112
  };
71
113
 
72
-
114
+ /**
115
+ * @param {Element} source
116
+ * @param {Element} target
117
+ * @param {Partial<Connection>} attrs
118
+ * @param {ModelingHints} [hints]
119
+ *
120
+ * @return {T}
121
+ */
73
122
  Modeling.prototype.connect = function(source, target, attrs, hints) {
74
123
 
75
124
  var bpmnRules = this._bpmnRules;
@@ -85,7 +134,13 @@ Modeling.prototype.connect = function(source, target, attrs, hints) {
85
134
  return this.createConnection(source, target, attrs, source.parent, hints);
86
135
  };
87
136
 
88
-
137
+ /**
138
+ * Update a model element's properties.
139
+ *
140
+ * @param {Element} element The element.
141
+ * @param {ModdleElement} moddleElement The model element.
142
+ * @param {Object} properties The updated properties.
143
+ */
89
144
  Modeling.prototype.updateModdleProperties = function(element, moddleElement, properties) {
90
145
  this._commandStack.execute('element.updateModdleProperties', {
91
146
  element: element,
@@ -94,6 +149,12 @@ Modeling.prototype.updateModdleProperties = function(element, moddleElement, pro
94
149
  });
95
150
  };
96
151
 
152
+ /**
153
+ * Update an element's properties.
154
+ *
155
+ * @param {Element} element The element.
156
+ * @param {Object} properties The updated properties.
157
+ */
97
158
  Modeling.prototype.updateProperties = function(element, properties) {
98
159
  this._commandStack.execute('element.updateProperties', {
99
160
  element: element,
@@ -101,6 +162,13 @@ Modeling.prototype.updateProperties = function(element, properties) {
101
162
  });
102
163
  };
103
164
 
165
+ /**
166
+ * Resize a lane.
167
+ *
168
+ * @param {Shape} laneShape The lane.
169
+ * @param {Rect} newBounds The new bounds of the lane.
170
+ * @param {boolean} [balanced] Wether to resize neighboring lanes.
171
+ */
104
172
  Modeling.prototype.resizeLane = function(laneShape, newBounds, balanced) {
105
173
  this._commandStack.execute('lane.resize', {
106
174
  shape: laneShape,
@@ -109,6 +177,14 @@ Modeling.prototype.resizeLane = function(laneShape, newBounds, balanced) {
109
177
  });
110
178
  };
111
179
 
180
+ /**
181
+ * Add a lane.
182
+ *
183
+ * @param {Shape} targetLaneShape The shape to add the lane to.
184
+ * @param {string} location The location.
185
+ *
186
+ * @return {Shape} The added lane.
187
+ */
112
188
  Modeling.prototype.addLane = function(targetLaneShape, location) {
113
189
  var context = {
114
190
  shape: targetLaneShape,
@@ -120,6 +196,13 @@ Modeling.prototype.addLane = function(targetLaneShape, location) {
120
196
  return context.newLane;
121
197
  };
122
198
 
199
+ /**
200
+ * Split a lane.
201
+ *
202
+ * @param {Shape} targetLane The lane to split.
203
+ * @param {number} count The number of lanes to split the lane into. Must not
204
+ * exceed the number of existing lanes.
205
+ */
123
206
  Modeling.prototype.splitLane = function(targetLane, count) {
124
207
  this._commandStack.execute('lane.split', {
125
208
  shape: targetLane,
@@ -128,9 +211,9 @@ Modeling.prototype.splitLane = function(targetLane, count) {
128
211
  };
129
212
 
130
213
  /**
131
- * Transform the current diagram into a collaboration.
214
+ * Turn a process into a collaboration.
132
215
  *
133
- * @return {djs.model.Root} the new root element
216
+ * @return {Root} The root of the collaboration.
134
217
  */
135
218
  Modeling.prototype.makeCollaboration = function() {
136
219
 
@@ -147,18 +230,10 @@ Modeling.prototype.makeCollaboration = function() {
147
230
  return collaborationElement;
148
231
  };
149
232
 
150
- Modeling.prototype.updateLaneRefs = function(flowNodeShapes, laneShapes) {
151
-
152
- this._commandStack.execute('lane.updateRefs', {
153
- flowNodeShapes: flowNodeShapes,
154
- laneShapes: laneShapes
155
- });
156
- };
157
-
158
233
  /**
159
- * Transform the current diagram into a process.
234
+ * Transform a collaboration into a process.
160
235
  *
161
- * @return {djs.model.Root} the new root element
236
+ * @return {Root} The root of the process.
162
237
  */
163
238
  Modeling.prototype.makeProcess = function() {
164
239
 
@@ -173,7 +248,26 @@ Modeling.prototype.makeProcess = function() {
173
248
  this._commandStack.execute('canvas.updateRoot', context);
174
249
  };
175
250
 
251
+ /**
252
+ * Update the referenced lanes of each flow node.
253
+ *
254
+ * @param {Shape[]} flowNodeShapes The flow nodes to update.
255
+ * @param {Shape[]} laneShapes The lanes.
256
+ */
257
+ Modeling.prototype.updateLaneRefs = function(flowNodeShapes, laneShapes) {
176
258
 
259
+ this._commandStack.execute('lane.updateRefs', {
260
+ flowNodeShapes: flowNodeShapes,
261
+ laneShapes: laneShapes
262
+ });
263
+ };
264
+
265
+ /**
266
+ * Claim an ID.
267
+ *
268
+ * @param {string} id The ID to claim.
269
+ * @param {ModdleElement} moddleElement The model element the ID is claimed for.
270
+ */
177
271
  Modeling.prototype.claimId = function(id, moddleElement) {
178
272
  this._commandStack.execute('id.updateClaim', {
179
273
  id: id,
@@ -182,7 +276,12 @@ Modeling.prototype.claimId = function(id, moddleElement) {
182
276
  });
183
277
  };
184
278
 
185
-
279
+ /**
280
+ * Unclaim an ID.
281
+ *
282
+ * @param {string} id The ID to unclaim.
283
+ * @param {ModdleElement} moddleElement The model element the ID is claimed for.
284
+ */
186
285
  Modeling.prototype.unclaimId = function(id, moddleElement) {
187
286
  this._commandStack.execute('id.updateClaim', {
188
287
  id: id,
@@ -190,6 +289,12 @@ Modeling.prototype.unclaimId = function(id, moddleElement) {
190
289
  });
191
290
  };
192
291
 
292
+ /**
293
+ * Set the color(s) of one or many elements.
294
+ *
295
+ * @param {Element[]} elements The elements to set the color(s) for.
296
+ * @param {Colors} colors The color(s) to set.
297
+ */
193
298
  Modeling.prototype.setColor = function(elements, colors) {
194
299
  if (!elements.length) {
195
300
  elements = [ elements ];
@@ -0,0 +1,148 @@
1
+ import { expectType } from 'ts-expect';
2
+
3
+ import Modeler from '../../Modeler';
4
+
5
+ import {
6
+ Connection,
7
+ Element,
8
+ Label,
9
+ Parent,
10
+ Shape
11
+ } from '../../model/Types';
12
+
13
+ import ElementFactory from './ElementFactory';
14
+ import Modeling from './Modeling';
15
+
16
+ import { getBusinessObject } from '../../util/ModelUtil';
17
+
18
+ import { CustomElementFactory } from './ElementFactory.test';
19
+
20
+ const modeler = new Modeler();
21
+
22
+ const elementFactory = modeler.get<ElementFactory>('elementFactory');
23
+
24
+ const sequenceFlow = elementFactory.create('connection', { type: 'bpmn:SequenceFlow' }),
25
+ process = elementFactory.create('root', { type: 'bpmn:Process' }),
26
+ subProcess = elementFactory.create('shape', { type: 'bpmn:SubProcess' }),
27
+ task = elementFactory.create('shape', { type: 'bpmn:Task' });
28
+
29
+ const modeling = modeler.get<Modeling>('modeling');
30
+
31
+ modeling.updateLabel(task, 'foo');
32
+
33
+ modeling.updateLabel(task, 'foo', {
34
+ x: 100,
35
+ y: 100,
36
+ width: 100,
37
+ height: 100
38
+ });
39
+
40
+ modeling.updateLabel(task, 'foo', {
41
+ x: 100,
42
+ y: 100,
43
+ width: 100,
44
+ height: 100
45
+ }, { removeShape: true });
46
+
47
+ modeling.connect(subProcess, task, sequenceFlow);
48
+
49
+ modeling.connect(subProcess, task, sequenceFlow, { foo: 'bar' });
50
+
51
+ modeling.updateModdleProperties(task, { type: 'bpmn:ExtensionElements' }, {
52
+ values: []
53
+ });
54
+
55
+ modeling.updateProperties(task, {
56
+ name: 'foo'
57
+ });
58
+
59
+ const participant = elementFactory.create('shape', { type: 'bpmn:Participant'}),
60
+ lane = elementFactory.create('shape', { type: 'bpmn:Lane'});
61
+
62
+ modeling.resizeLane(lane, {
63
+ x: 100,
64
+ y: 100,
65
+ width: 100,
66
+ height: 100
67
+ });
68
+
69
+ modeling.resizeLane(lane, {
70
+ x: 100,
71
+ y: 100,
72
+ width: 100,
73
+ height: 100
74
+ }, true);
75
+
76
+ modeling.addLane(participant, 'top');
77
+
78
+ modeling.addLane(participant, 'bottom');
79
+
80
+ modeling.splitLane(lane, 3);
81
+
82
+ modeling.makeCollaboration();
83
+
84
+ modeling.makeProcess();
85
+
86
+ modeling.updateLaneRefs([ task ], [ lane ]);
87
+
88
+ modeling.claimId('foo', task.businessObject);
89
+
90
+ modeling.unclaimId('foo', task.businessObject);
91
+
92
+ modeling.setColor([ task ], { fill: 'red', stroke: 'green' });
93
+
94
+ modeling.setColor([ task ], { fill: 'red' });
95
+
96
+ modeling.setColor([ task ], { stroke: 'green' });
97
+
98
+ /**
99
+ * Integration
100
+ */
101
+
102
+ expectType<Connection>(modeling.createConnection(subProcess, task, sequenceFlow, process));
103
+
104
+ expectType<Label>(modeling.createLabel(task, { x: 100, y: 100 }, {
105
+ businessObject: getBusinessObject(task)
106
+ }));
107
+
108
+ expectType<Shape>(modeling.createShape(task, { x: 100, y: 100 }, process));
109
+
110
+ expectType<Element[]>(modeling.createElements([
111
+ subProcess,
112
+ task,
113
+ sequenceFlow
114
+ ], { x: 100, y: 100 }, process));
115
+
116
+ modeling.moveShape(task, { x: 100, y: 100 });
117
+
118
+ modeling.moveConnection(sequenceFlow, { x: 100, y: 100 });
119
+
120
+ modeling.moveElements([ subProcess, task ], { x: 100, y: 100 });
121
+
122
+ /**
123
+ * Customization
124
+ */
125
+
126
+ type CustomElement = {
127
+ foo: string;
128
+ } & Element;
129
+
130
+ type CustomShape = {
131
+ bar: string;
132
+ } & Shape & CustomElement;
133
+
134
+ class CustomModeling extends Modeling<Connection, CustomElement, Label, Parent, CustomShape> {};
135
+
136
+ const customModeling = modeler.get<CustomModeling>('modeling');
137
+
138
+ const customShape = customModeling.createShape({ bar: 'bar' }, { x: 100, y: 100 }, modeler.get<CustomElementFactory>('elementFactory').create('root'));
139
+
140
+ customModeling.distributeElements([
141
+ {
142
+ elements: [ customShape ],
143
+ range: {
144
+ min: 100,
145
+ max: 200
146
+ }
147
+ }
148
+ ], 'x', 'width');
@@ -0,0 +1,20 @@
1
+ /**
2
+ * A component that makes sure that external labels are added
3
+ * together with respective elements and properly updated (DI wise)
4
+ * during move.
5
+ *
6
+ */
7
+ export default class AdaptiveLabelPositioningBehavior extends CommandInterceptor {
8
+ /**
9
+ * @param eventBus
10
+ * @param modeling
11
+ */
12
+ constructor(eventBus: EventBus, modeling: Modeling);
13
+ }
14
+
15
+ type EventBus = import('diagram-js/lib/core/EventBus').default;
16
+ type Modeling = import('../Modeling').default;
17
+ type Element = import('../../../model/Types').Element;
18
+ type Shape = import('../../../model/Types').Shape;
19
+ type DirectionTRBL = import('diagram-js/lib/util/Types').DirectionTRBL;
20
+ import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';