bpmn-js 12.1.1 → 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.
- package/dist/bpmn-modeler.development.js +4998 -2001
- package/dist/bpmn-modeler.production.min.js +6 -6
- package/dist/bpmn-navigated-viewer.development.js +1408 -552
- package/dist/bpmn-navigated-viewer.production.min.js +4 -4
- package/dist/bpmn-viewer.development.js +1386 -547
- package/dist/bpmn-viewer.production.min.js +4 -4
- package/lib/BaseModeler.d.ts +12 -5
- package/lib/BaseModeler.js +4 -5
- package/lib/BaseViewer.d.ts +160 -366
- package/lib/BaseViewer.js +136 -57
- package/lib/Modeler.d.ts +76 -15
- package/lib/Modeler.js +6 -4
- package/lib/NavigatedViewer.d.ts +8 -3
- package/lib/Viewer.d.ts +44 -3
- package/lib/core/index.d.ts +10 -0
- package/lib/draw/BpmnRenderUtil.d.ts +76 -0
- package/lib/draw/BpmnRenderUtil.js +73 -21
- package/lib/draw/BpmnRenderer.d.ts +124 -0
- package/lib/draw/BpmnRenderer.js +51 -0
- package/lib/draw/PathMap.d.ts +330 -0
- package/lib/draw/PathMap.js +9 -2
- package/lib/draw/TextRenderer.d.ts +74 -0
- package/lib/draw/TextRenderer.js +32 -11
- package/lib/draw/index.d.ts +10 -0
- package/lib/features/align-elements/AlignElementsContextPadProvider.d.ts +32 -0
- package/lib/features/align-elements/AlignElementsContextPadProvider.js +28 -5
- package/lib/features/align-elements/AlignElementsIcons.d.ts +10 -0
- package/lib/features/align-elements/AlignElementsMenuProvider.d.ts +32 -0
- package/lib/features/align-elements/AlignElementsMenuProvider.js +38 -10
- package/lib/features/align-elements/BpmnAlignElements.d.ts +9 -0
- package/lib/features/align-elements/BpmnAlignElements.js +7 -1
- package/lib/features/align-elements/index.d.ts +11 -0
- package/lib/features/auto-place/BpmnAutoPlace.d.ts +13 -0
- package/lib/features/auto-place/BpmnAutoPlace.js +3 -0
- package/lib/features/auto-place/BpmnAutoPlaceUtil.d.ts +47 -0
- package/lib/features/auto-place/BpmnAutoPlaceUtil.js +39 -11
- package/lib/features/auto-place/index.d.ts +7 -0
- package/lib/features/auto-resize/BpmnAutoResize.d.ts +25 -0
- package/lib/features/auto-resize/BpmnAutoResize.js +15 -7
- package/lib/features/auto-resize/BpmnAutoResizeProvider.d.ts +26 -0
- package/lib/features/auto-resize/BpmnAutoResizeProvider.js +16 -4
- package/lib/features/auto-resize/index.d.ts +8 -0
- package/lib/features/context-pad/ContextPadProvider.d.ts +60 -0
- package/lib/features/context-pad/ContextPadProvider.js +64 -9
- package/lib/features/context-pad/index.d.ts +7 -0
- package/lib/features/copy-paste/BpmnCopyPaste.d.ts +17 -0
- package/lib/features/copy-paste/BpmnCopyPaste.js +15 -7
- package/lib/features/copy-paste/ModdleCopy.d.ts +45 -0
- package/lib/features/copy-paste/ModdleCopy.js +17 -45
- package/lib/features/copy-paste/index.d.ts +9 -0
- package/lib/features/di-ordering/BpmnDiOrdering.d.ts +11 -0
- package/lib/features/di-ordering/BpmnDiOrdering.js +8 -0
- package/lib/features/di-ordering/index.d.ts +6 -0
- package/lib/features/distribute-elements/BpmnDistributeElements.d.ts +10 -0
- package/lib/features/distribute-elements/BpmnDistributeElements.js +9 -4
- package/lib/features/distribute-elements/DistributeElementsIcons.d.ts +5 -0
- package/lib/features/distribute-elements/DistributeElementsMenuProvider.d.ts +32 -0
- package/lib/features/distribute-elements/DistributeElementsMenuProvider.js +27 -4
- package/lib/features/distribute-elements/index.d.ts +9 -0
- package/lib/features/drilldown/DrilldownBreadcrumbs.d.ts +19 -0
- package/lib/features/drilldown/DrilldownBreadcrumbs.js +34 -24
- package/lib/features/drilldown/DrilldownCentering.d.ts +17 -0
- package/lib/features/drilldown/DrilldownCentering.js +7 -2
- package/lib/features/drilldown/DrilldownOverlayBehavior.d.ts +18 -0
- package/lib/features/drilldown/DrilldownOverlayBehavior.js +70 -40
- package/lib/features/drilldown/SubprocessCompatibility.d.ts +21 -0
- package/lib/features/drilldown/SubprocessCompatibility.js +80 -30
- package/lib/features/drilldown/index.d.ts +13 -0
- package/lib/features/editor-actions/BpmnEditorActions.d.ts +13 -0
- package/lib/features/editor-actions/BpmnEditorActions.js +4 -0
- package/lib/features/editor-actions/index.d.ts +6 -0
- package/lib/features/grid-snapping/BpmnGridSnapping.d.ts +9 -0
- package/lib/features/grid-snapping/BpmnGridSnapping.js +7 -0
- package/lib/features/grid-snapping/behavior/GridSnappingAutoPlaceBehavior.d.ts +12 -0
- package/lib/features/grid-snapping/behavior/GridSnappingAutoPlaceBehavior.js +16 -1
- package/lib/features/grid-snapping/behavior/GridSnappingLayoutConnectionBehavior.d.ts +27 -0
- package/lib/features/grid-snapping/behavior/GridSnappingLayoutConnectionBehavior.js +20 -8
- package/lib/features/grid-snapping/behavior/GridSnappingParticipantBehavior.d.ts +13 -0
- package/lib/features/grid-snapping/behavior/GridSnappingParticipantBehavior.js +11 -1
- package/lib/features/grid-snapping/behavior/index.d.ts +10 -0
- package/lib/features/grid-snapping/index.d.ts +11 -0
- package/lib/features/interaction-events/BpmnInteractionEvents.d.ts +18 -0
- package/lib/features/interaction-events/BpmnInteractionEvents.js +34 -9
- package/lib/features/interaction-events/index.d.ts +6 -0
- package/lib/features/keyboard/BpmnKeyboardBindings.d.ts +15 -0
- package/lib/features/keyboard/BpmnKeyboardBindings.js +5 -0
- package/lib/features/keyboard/index.d.ts +7 -0
- package/lib/features/label-editing/LabelEditingPreview.d.ts +13 -0
- package/lib/features/label-editing/LabelEditingPreview.js +13 -6
- package/lib/features/label-editing/LabelEditingProvider.d.ts +62 -0
- package/lib/features/label-editing/LabelEditingProvider.js +48 -11
- package/lib/features/label-editing/LabelUtil.d.ts +14 -0
- package/lib/features/label-editing/LabelUtil.js +16 -1
- package/lib/features/label-editing/cmd/UpdateLabelHandler.d.ts +22 -0
- package/lib/features/label-editing/cmd/UpdateLabelHandler.js +14 -3
- package/lib/features/label-editing/index.d.ts +9 -0
- package/lib/features/modeling/BpmnFactory.d.ts +67 -0
- package/lib/features/modeling/BpmnFactory.js +57 -8
- package/lib/features/modeling/BpmnLayouter.d.ts +26 -0
- package/lib/features/modeling/BpmnLayouter.js +25 -2
- package/lib/features/modeling/BpmnUpdater.d.ts +92 -0
- package/lib/features/modeling/BpmnUpdater.js +90 -29
- package/lib/features/modeling/ElementFactory.d.ts +116 -0
- package/lib/features/modeling/ElementFactory.js +114 -17
- package/lib/features/modeling/ElementFactory.test.ts +133 -0
- package/lib/features/modeling/Modeling.d.ts +150 -0
- package/lib/features/modeling/Modeling.js +124 -19
- package/lib/features/modeling/Modeling.test.ts +148 -0
- package/lib/features/modeling/behavior/AdaptiveLabelPositioningBehavior.d.ts +20 -0
- package/lib/features/modeling/behavior/AdaptiveLabelPositioningBehavior.js +16 -6
- package/lib/features/modeling/behavior/AppendBehavior.d.ts +6 -0
- package/lib/features/modeling/behavior/AppendBehavior.js +6 -5
- package/lib/features/modeling/behavior/AssociationBehavior.d.ts +11 -0
- package/lib/features/modeling/behavior/AssociationBehavior.js +9 -1
- package/lib/features/modeling/behavior/AttachEventBehavior.d.ts +15 -0
- package/lib/features/modeling/behavior/AttachEventBehavior.js +11 -3
- package/lib/features/modeling/behavior/BoundaryEventBehavior.d.ts +15 -0
- package/lib/features/modeling/behavior/BoundaryEventBehavior.js +8 -1
- package/lib/features/modeling/behavior/CreateBehavior.d.ts +9 -0
- package/lib/features/modeling/behavior/CreateBehavior.js +6 -0
- package/lib/features/modeling/behavior/CreateDataObjectBehavior.d.ts +15 -0
- package/lib/features/modeling/behavior/CreateDataObjectBehavior.js +10 -4
- package/lib/features/modeling/behavior/CreateParticipantBehavior.d.ts +19 -0
- package/lib/features/modeling/behavior/CreateParticipantBehavior.js +10 -0
- package/lib/features/modeling/behavior/DataInputAssociationBehavior.d.ts +21 -0
- package/lib/features/modeling/behavior/DataInputAssociationBehavior.js +5 -0
- package/lib/features/modeling/behavior/DataStoreBehavior.d.ts +19 -0
- package/lib/features/modeling/behavior/DataStoreBehavior.js +12 -1
- package/lib/features/modeling/behavior/DeleteLaneBehavior.d.ts +15 -0
- package/lib/features/modeling/behavior/DeleteLaneBehavior.js +9 -3
- package/lib/features/modeling/behavior/DetachEventBehavior.d.ts +15 -0
- package/lib/features/modeling/behavior/DetachEventBehavior.js +11 -3
- package/lib/features/modeling/behavior/DropOnFlowBehavior.d.ts +13 -0
- package/lib/features/modeling/behavior/DropOnFlowBehavior.js +11 -1
- package/lib/features/modeling/behavior/EventBasedGatewayBehavior.d.ts +11 -0
- package/lib/features/modeling/behavior/EventBasedGatewayBehavior.js +9 -0
- package/lib/features/modeling/behavior/FixHoverBehavior.d.ts +17 -0
- package/lib/features/modeling/behavior/FixHoverBehavior.js +6 -0
- package/lib/features/modeling/behavior/GroupBehavior.d.ts +26 -0
- package/lib/features/modeling/behavior/GroupBehavior.js +35 -13
- package/lib/features/modeling/behavior/ImportDockingFix.d.ts +13 -0
- package/lib/features/modeling/behavior/ImportDockingFix.js +3 -0
- package/lib/features/modeling/behavior/IsHorizontalFix.d.ts +10 -0
- package/lib/features/modeling/behavior/IsHorizontalFix.js +4 -0
- package/lib/features/modeling/behavior/LabelBehavior.d.ts +56 -0
- package/lib/features/modeling/behavior/LabelBehavior.js +22 -10
- package/lib/features/modeling/behavior/LayoutConnectionBehavior.d.ts +16 -0
- package/lib/features/modeling/behavior/LayoutConnectionBehavior.js +6 -2
- package/lib/features/modeling/behavior/MessageFlowBehavior.d.ts +15 -0
- package/lib/features/modeling/behavior/MessageFlowBehavior.js +8 -0
- package/lib/features/modeling/behavior/ModelingFeedback.d.ts +13 -0
- package/lib/features/modeling/behavior/ModelingFeedback.js +11 -0
- package/lib/features/modeling/behavior/RemoveElementBehavior.d.ts +13 -0
- package/lib/features/modeling/behavior/RemoveElementBehavior.js +11 -1
- package/lib/features/modeling/behavior/RemoveEmbeddedLabelBoundsBehavior.d.ts +16 -0
- package/lib/features/modeling/behavior/RemoveEmbeddedLabelBoundsBehavior.js +8 -0
- package/lib/features/modeling/behavior/RemoveParticipantBehavior.d.ts +15 -0
- package/lib/features/modeling/behavior/RemoveParticipantBehavior.js +8 -1
- package/lib/features/modeling/behavior/ReplaceConnectionBehavior.d.ts +15 -0
- package/lib/features/modeling/behavior/ReplaceConnectionBehavior.js +13 -1
- package/lib/features/modeling/behavior/ReplaceElementBehaviour.d.ts +23 -0
- package/lib/features/modeling/behavior/ReplaceElementBehaviour.js +19 -4
- package/lib/features/modeling/behavior/ResizeBehavior.d.ts +57 -0
- package/lib/features/modeling/behavior/ResizeBehavior.js +35 -0
- package/lib/features/modeling/behavior/ResizeLaneBehavior.d.ts +16 -0
- package/lib/features/modeling/behavior/ResizeLaneBehavior.js +10 -3
- package/lib/features/modeling/behavior/RootElementReferenceBehavior.d.ts +25 -0
- package/lib/features/modeling/behavior/RootElementReferenceBehavior.js +19 -0
- package/lib/features/modeling/behavior/SpaceToolBehavior.d.ts +10 -0
- package/lib/features/modeling/behavior/SpaceToolBehavior.js +14 -4
- package/lib/features/modeling/behavior/SubProcessPlaneBehavior.d.ts +28 -0
- package/lib/features/modeling/behavior/SubProcessPlaneBehavior.js +45 -23
- package/lib/features/modeling/behavior/SubProcessStartEventBehavior.d.ts +15 -0
- package/lib/features/modeling/behavior/SubProcessStartEventBehavior.js +6 -0
- package/lib/features/modeling/behavior/ToggleCollapseConnectionBehaviour.d.ts +14 -0
- package/lib/features/modeling/behavior/ToggleCollapseConnectionBehaviour.js +14 -1
- package/lib/features/modeling/behavior/ToggleElementCollapseBehaviour.d.ts +13 -0
- package/lib/features/modeling/behavior/ToggleElementCollapseBehaviour.js +11 -3
- package/lib/features/modeling/behavior/UnclaimIdBehavior.d.ts +19 -0
- package/lib/features/modeling/behavior/UnclaimIdBehavior.js +7 -0
- package/lib/features/modeling/behavior/UnsetDefaultFlowBehavior.d.ts +16 -0
- package/lib/features/modeling/behavior/UnsetDefaultFlowBehavior.js +6 -3
- package/lib/features/modeling/behavior/UpdateFlowNodeRefsBehavior.d.ts +17 -0
- package/lib/features/modeling/behavior/UpdateFlowNodeRefsBehavior.js +13 -10
- package/lib/features/modeling/behavior/index.d.ts +2 -0
- package/lib/features/modeling/behavior/index.js +3 -0
- package/lib/features/modeling/behavior/util/CategoryUtil.d.ts +49 -0
- package/lib/features/modeling/behavior/util/CategoryUtil.js +10 -6
- package/lib/features/modeling/behavior/util/ConnectionLayoutUtil.d.ts +19 -0
- package/lib/features/modeling/behavior/util/ConnectionLayoutUtil.js +11 -5
- package/lib/features/modeling/behavior/util/GeometricUtil.d.ts +1 -0
- package/lib/features/modeling/behavior/util/LabelLayoutUtil.d.ts +32 -0
- package/lib/features/modeling/behavior/util/LabelLayoutUtil.js +27 -18
- package/lib/features/modeling/behavior/util/LayoutUtil.d.ts +48 -0
- package/lib/features/modeling/behavior/util/LayoutUtil.js +35 -6
- package/lib/features/modeling/behavior/util/LineAttachmentUtil.d.ts +37 -0
- package/lib/features/modeling/behavior/util/LineAttachmentUtil.js +17 -5
- package/lib/features/modeling/behavior/util/LineIntersect.d.ts +13 -0
- package/lib/features/modeling/behavior/util/LineIntersect.js +4 -0
- package/lib/features/modeling/behavior/util/ResizeUtil.d.ts +1 -0
- package/lib/features/modeling/cmd/AddLaneHandler.d.ts +22 -0
- package/lib/features/modeling/cmd/AddLaneHandler.js +8 -0
- package/lib/features/modeling/cmd/IdClaimHandler.d.ts +22 -0
- package/lib/features/modeling/cmd/IdClaimHandler.js +15 -0
- package/lib/features/modeling/cmd/ResizeLaneHandler.d.ts +39 -0
- package/lib/features/modeling/cmd/ResizeLaneHandler.js +17 -4
- package/lib/features/modeling/cmd/SetColorHandler.d.ts +18 -0
- package/lib/features/modeling/cmd/SetColorHandler.js +25 -12
- package/lib/features/modeling/cmd/SplitLaneHandler.d.ts +22 -0
- package/lib/features/modeling/cmd/SplitLaneHandler.js +9 -0
- package/lib/features/modeling/cmd/UpdateCanvasRootHandler.d.ts +20 -0
- package/lib/features/modeling/cmd/UpdateCanvasRootHandler.js +16 -1
- package/lib/features/modeling/cmd/UpdateFlowNodeRefsHandler.d.ts +21 -0
- package/lib/features/modeling/cmd/UpdateFlowNodeRefsHandler.js +29 -4
- package/lib/features/modeling/cmd/UpdateModdlePropertiesHandler.d.ts +20 -0
- package/lib/features/modeling/cmd/UpdateModdlePropertiesHandler.js +17 -3
- package/lib/features/modeling/cmd/UpdatePropertiesHandler.d.ts +60 -0
- package/lib/features/modeling/cmd/UpdatePropertiesHandler.js +38 -14
- package/lib/features/modeling/cmd/UpdateSemanticParentHandler.d.ts +18 -0
- package/lib/features/modeling/cmd/UpdateSemanticParentHandler.js +15 -0
- package/lib/features/modeling/index.d.ts +27 -0
- package/lib/features/modeling/util/LaneUtil.d.ts +46 -0
- package/lib/features/modeling/util/LaneUtil.js +22 -13
- package/lib/features/modeling/util/ModelingUtil.d.ts +12 -0
- package/lib/features/modeling/util/ModelingUtil.js +10 -4
- package/lib/features/ordering/BpmnOrderingProvider.d.ts +21 -0
- package/lib/features/ordering/BpmnOrderingProvider.js +9 -3
- package/lib/features/ordering/index.d.ts +7 -0
- package/lib/features/palette/PaletteProvider.d.ts +34 -0
- package/lib/features/palette/PaletteProvider.js +26 -2
- package/lib/features/palette/index.d.ts +9 -0
- package/lib/features/popup-menu/ReplaceMenuProvider.d.ts +50 -0
- package/lib/features/popup-menu/ReplaceMenuProvider.js +226 -202
- package/lib/features/popup-menu/index.d.ts +11 -0
- package/lib/features/popup-menu/util/TypeUtil.d.ts +12 -0
- package/lib/features/popup-menu/util/TypeUtil.js +4 -1
- package/lib/features/replace/BpmnReplace.d.ts +47 -0
- package/lib/features/replace/BpmnReplace.js +81 -29
- package/lib/features/replace/ReplaceOptions.d.ts +70 -0
- package/lib/features/replace/ReplaceOptions.js +58 -0
- package/lib/features/replace/index.d.ts +9 -0
- package/lib/features/replace-preview/BpmnReplacePreview.d.ts +17 -0
- package/lib/features/replace-preview/BpmnReplacePreview.js +15 -1
- package/lib/features/replace-preview/index.d.ts +7 -0
- package/lib/features/rules/BpmnRules.d.ts +171 -0
- package/lib/features/rules/BpmnRules.js +295 -46
- package/lib/features/rules/index.d.ts +7 -0
- package/lib/features/search/BpmnSearchProvider.d.ts +29 -0
- package/lib/features/search/BpmnSearchProvider.js +30 -22
- package/lib/features/search/index.d.ts +7 -0
- package/lib/features/snapping/BpmnConnectSnapping.d.ts +17 -0
- package/lib/features/snapping/BpmnConnectSnapping.js +51 -3
- package/lib/features/snapping/BpmnCreateMoveSnapping.d.ts +41 -0
- package/lib/features/snapping/BpmnCreateMoveSnapping.js +47 -1
- package/lib/features/snapping/BpmnSnappingUtil.d.ts +11 -0
- package/lib/features/snapping/BpmnSnappingUtil.js +12 -0
- package/lib/features/snapping/index.d.ts +9 -0
- package/lib/features/space-tool/BpmnSpaceTool.d.ts +21 -0
- package/lib/features/space-tool/BpmnSpaceTool.js +20 -1
- package/lib/features/space-tool/index.d.ts +6 -0
- package/lib/import/BpmnImporter.d.ts +49 -0
- package/lib/import/BpmnImporter.js +37 -10
- package/lib/import/BpmnTreeWalker.d.ts +22 -0
- package/lib/import/BpmnTreeWalker.js +25 -22
- package/lib/import/Importer.d.ts +25 -0
- package/lib/import/Importer.js +15 -21
- package/lib/import/Util.d.ts +1 -0
- package/lib/import/index.d.ts +6 -0
- package/lib/model/Types.d.ts +24 -0
- package/lib/model/Types.ts +40 -0
- package/lib/util/CompatibilityUtil.d.ts +22 -0
- package/lib/util/CompatibilityUtil.js +13 -0
- package/lib/util/DiUtil.d.ts +53 -0
- package/lib/util/DiUtil.js +47 -13
- package/lib/util/DrilldownUtil.d.ts +39 -0
- package/lib/util/DrilldownUtil.js +12 -8
- package/lib/util/LabelUtil.d.ts +73 -0
- package/lib/util/LabelUtil.js +40 -16
- package/lib/util/ModelUtil.d.ts +40 -0
- package/lib/util/ModelUtil.js +9 -5
- package/lib/util/PoweredByUtil.d.ts +8 -0
- package/lib/util/Types.js +5 -0
- package/lib/util/Types.ts +4 -0
- package/package.json +10 -5
- package/test/matchers/ConnectionMatchers.js +1 -1
- package/lib/features/align-elements/dist/align-bottom-tool.svg +0 -1
- package/lib/features/align-elements/dist/align-horizontal-center-tool.svg +0 -1
- package/lib/features/align-elements/dist/align-left-tool.svg +0 -1
- package/lib/features/align-elements/dist/align-right-tool.svg +0 -1
- package/lib/features/align-elements/dist/align-tool.svg +0 -1
- package/lib/features/align-elements/dist/align-top-tool.svg +0 -1
- package/lib/features/align-elements/dist/align-vertical-center-tool.svg +0 -1
- package/lib/features/palette/dist/create.svg +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* bpmn-js - bpmn-viewer
|
|
2
|
+
* bpmn-js - bpmn-viewer v13.0.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2014-present, camunda Services GmbH
|
|
5
5
|
*
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Source Code: https://github.com/bpmn-io/bpmn-js
|
|
10
10
|
*
|
|
11
|
-
* Date: 2023-04-
|
|
11
|
+
* Date: 2023-04-19
|
|
12
12
|
*/
|
|
13
13
|
(function (global, factory) {
|
|
14
14
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
@@ -544,9 +544,9 @@
|
|
|
544
544
|
var DEFAULT_RENDER_PRIORITY$1 = 1000;
|
|
545
545
|
|
|
546
546
|
/**
|
|
547
|
-
* @typedef {import('../
|
|
548
|
-
* @typedef {import('../
|
|
549
|
-
* @typedef {import('../
|
|
547
|
+
* @typedef {import('../core/Types').ElementLike} Element
|
|
548
|
+
* @typedef {import('../core/Types').ConnectionLike} Connection
|
|
549
|
+
* @typedef {import('../core/Types').ShapeLike} Shape
|
|
550
550
|
*
|
|
551
551
|
* @typedef {import('../core/EventBus').default} EventBus
|
|
552
552
|
*/
|
|
@@ -591,9 +591,9 @@
|
|
|
591
591
|
/**
|
|
592
592
|
* Checks whether an element can be rendered.
|
|
593
593
|
*
|
|
594
|
-
* @param {
|
|
594
|
+
* @param {Element} element The element to be rendered.
|
|
595
595
|
*
|
|
596
|
-
* @
|
|
596
|
+
* @return {boolean} Whether the element can be rendered.
|
|
597
597
|
*/
|
|
598
598
|
BaseRenderer.prototype.canRender = function(element) {};
|
|
599
599
|
|
|
@@ -603,7 +603,7 @@
|
|
|
603
603
|
* @param {SVGElement} visuals The SVG element to draw the shape into.
|
|
604
604
|
* @param {Shape} shape The shape to be drawn.
|
|
605
605
|
*
|
|
606
|
-
* @
|
|
606
|
+
* @return {SVGElement} The SVG element of the shape drawn.
|
|
607
607
|
*/
|
|
608
608
|
BaseRenderer.prototype.drawShape = function(visuals, shape) {};
|
|
609
609
|
|
|
@@ -613,7 +613,7 @@
|
|
|
613
613
|
* @param {SVGElement} visuals The SVG element to draw the connection into.
|
|
614
614
|
* @param {Connection} connection The connection to be drawn.
|
|
615
615
|
*
|
|
616
|
-
* @
|
|
616
|
+
* @return {SVGElement} The SVG element of the connection drawn.
|
|
617
617
|
*/
|
|
618
618
|
BaseRenderer.prototype.drawConnection = function(visuals, connection) {};
|
|
619
619
|
|
|
@@ -635,10 +635,15 @@
|
|
|
635
635
|
*/
|
|
636
636
|
BaseRenderer.prototype.getConnectionPath = function(connection) {};
|
|
637
637
|
|
|
638
|
+
/**
|
|
639
|
+
* @typedef { import('../model/Types').Element } Element
|
|
640
|
+
* @typedef { import('../model/Types').ModdleElement } ModdleElement
|
|
641
|
+
*/
|
|
642
|
+
|
|
638
643
|
/**
|
|
639
644
|
* Is an element of the given BPMN type?
|
|
640
645
|
*
|
|
641
|
-
* @param {
|
|
646
|
+
* @param {Element|ModdleElement} element
|
|
642
647
|
* @param {string} type
|
|
643
648
|
*
|
|
644
649
|
* @return {boolean}
|
|
@@ -653,8 +658,8 @@
|
|
|
653
658
|
/**
|
|
654
659
|
* Return true if element has any of the given types.
|
|
655
660
|
*
|
|
656
|
-
* @param {
|
|
657
|
-
* @param {
|
|
661
|
+
* @param {Element|ModdleElement} element
|
|
662
|
+
* @param {string[]} types
|
|
658
663
|
*
|
|
659
664
|
* @return {boolean}
|
|
660
665
|
*/
|
|
@@ -667,7 +672,7 @@
|
|
|
667
672
|
/**
|
|
668
673
|
* Return the business object for a given element.
|
|
669
674
|
*
|
|
670
|
-
* @param
|
|
675
|
+
* @param {Element|ModdleElement} element
|
|
671
676
|
*
|
|
672
677
|
* @return {ModdleElement}
|
|
673
678
|
*/
|
|
@@ -678,7 +683,7 @@
|
|
|
678
683
|
/**
|
|
679
684
|
* Return the di object for a given element.
|
|
680
685
|
*
|
|
681
|
-
* @param
|
|
686
|
+
* @param {Element} element
|
|
682
687
|
*
|
|
683
688
|
* @return {ModdleElement}
|
|
684
689
|
*/
|
|
@@ -686,6 +691,17 @@
|
|
|
686
691
|
return element && element.di;
|
|
687
692
|
}
|
|
688
693
|
|
|
694
|
+
/**
|
|
695
|
+
* @typedef {import('../model/Types').Element} Element
|
|
696
|
+
* @typedef {import('../model/Types').ModdleElement} ModdleElement
|
|
697
|
+
*/
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* @param {Element} element
|
|
701
|
+
* @param {ModdleElement} di
|
|
702
|
+
*
|
|
703
|
+
* @return {boolean}
|
|
704
|
+
*/
|
|
689
705
|
function isExpanded(element, di) {
|
|
690
706
|
|
|
691
707
|
if (is$1(element, 'bpmn:CallActivity')) {
|
|
@@ -709,10 +725,19 @@
|
|
|
709
725
|
return true;
|
|
710
726
|
}
|
|
711
727
|
|
|
728
|
+
/**
|
|
729
|
+
* @param {Element} element
|
|
730
|
+
*
|
|
731
|
+
* @return {boolean}
|
|
732
|
+
*/
|
|
712
733
|
function isEventSubProcess(element) {
|
|
713
734
|
return element && !!getBusinessObject(element).triggeredByEvent;
|
|
714
735
|
}
|
|
715
736
|
|
|
737
|
+
/**
|
|
738
|
+
* @typedef { import('../../model').DiagramElement } DiagramElement
|
|
739
|
+
*/
|
|
740
|
+
|
|
716
741
|
function getLabelAttr(semantic) {
|
|
717
742
|
if (
|
|
718
743
|
is$1(semantic, 'bpmn:FlowElement') ||
|
|
@@ -746,6 +771,11 @@
|
|
|
746
771
|
return categoryValueRef.value || '';
|
|
747
772
|
}
|
|
748
773
|
|
|
774
|
+
/**
|
|
775
|
+
* @param {DiagramElement} element
|
|
776
|
+
*
|
|
777
|
+
* @return {string} label
|
|
778
|
+
*/
|
|
749
779
|
function getLabel(element) {
|
|
750
780
|
var semantic = element.businessObject,
|
|
751
781
|
attr = getLabelAttr(semantic);
|
|
@@ -1454,14 +1484,31 @@
|
|
|
1454
1484
|
return elements.flat().join(',').replace(/,?([A-z]),?/g, '$1');
|
|
1455
1485
|
}
|
|
1456
1486
|
|
|
1487
|
+
/**
|
|
1488
|
+
* @param {Point} point
|
|
1489
|
+
*
|
|
1490
|
+
* @return {Component[]}
|
|
1491
|
+
*/
|
|
1457
1492
|
function move(point) {
|
|
1458
1493
|
return [ 'M', point.x, point.y ];
|
|
1459
1494
|
}
|
|
1460
1495
|
|
|
1496
|
+
/**
|
|
1497
|
+
* @param {Point} point
|
|
1498
|
+
*
|
|
1499
|
+
* @return {Component[]}
|
|
1500
|
+
*/
|
|
1461
1501
|
function lineTo(point) {
|
|
1462
1502
|
return [ 'L', point.x, point.y ];
|
|
1463
1503
|
}
|
|
1464
1504
|
|
|
1505
|
+
/**
|
|
1506
|
+
* @param {Point} p1
|
|
1507
|
+
* @param {Point} p2
|
|
1508
|
+
* @param {Point} p3
|
|
1509
|
+
*
|
|
1510
|
+
* @return {Component[]}
|
|
1511
|
+
*/
|
|
1465
1512
|
function curveTo(p1, p2, p3) {
|
|
1466
1513
|
return [ 'C', p1.x, p1.y, p2.x, p2.y, p3.x, p3.y ];
|
|
1467
1514
|
}
|
|
@@ -1529,7 +1576,7 @@
|
|
|
1529
1576
|
|
|
1530
1577
|
/**
|
|
1531
1578
|
* @param {Point[]} points
|
|
1532
|
-
* @param {
|
|
1579
|
+
* @param {any} [attrs]
|
|
1533
1580
|
* @param {number} [radius]
|
|
1534
1581
|
*
|
|
1535
1582
|
* @return {SVGElement}
|
|
@@ -1578,54 +1625,75 @@
|
|
|
1578
1625
|
/**
|
|
1579
1626
|
* Checks if eventDefinition of the given element matches with semantic type.
|
|
1580
1627
|
*
|
|
1581
|
-
* @
|
|
1628
|
+
* @param {ModdleElement} event
|
|
1629
|
+
* @param {string} eventDefinitionType
|
|
1630
|
+
*
|
|
1631
|
+
* @return {boolean}
|
|
1582
1632
|
*/
|
|
1583
|
-
function isTypedEvent(event, eventDefinitionType
|
|
1584
|
-
|
|
1585
|
-
function matches(definition, filter) {
|
|
1586
|
-
return every(filter, function(val, key) {
|
|
1587
|
-
|
|
1588
|
-
// we want a == conversion here, to be able to catch
|
|
1589
|
-
// undefined == false and friends
|
|
1590
|
-
/* jshint -W116 */
|
|
1591
|
-
return definition[key] == val;
|
|
1592
|
-
});
|
|
1593
|
-
}
|
|
1594
|
-
|
|
1633
|
+
function isTypedEvent(event, eventDefinitionType) {
|
|
1595
1634
|
return some(event.eventDefinitions, function(definition) {
|
|
1596
|
-
return definition.$type === eventDefinitionType
|
|
1635
|
+
return definition.$type === eventDefinitionType;
|
|
1597
1636
|
});
|
|
1598
1637
|
}
|
|
1599
1638
|
|
|
1639
|
+
/**
|
|
1640
|
+
* Check if element is a throw event.
|
|
1641
|
+
*
|
|
1642
|
+
* @param {ModdleElement} event
|
|
1643
|
+
*
|
|
1644
|
+
* @return {boolean}
|
|
1645
|
+
*/
|
|
1600
1646
|
function isThrowEvent(event) {
|
|
1601
1647
|
return (event.$type === 'bpmn:IntermediateThrowEvent') || (event.$type === 'bpmn:EndEvent');
|
|
1602
1648
|
}
|
|
1603
1649
|
|
|
1650
|
+
/**
|
|
1651
|
+
* Check if element is a throw event.
|
|
1652
|
+
*
|
|
1653
|
+
* @param {ModdleElement} element
|
|
1654
|
+
*
|
|
1655
|
+
* @return {boolean}
|
|
1656
|
+
*/
|
|
1604
1657
|
function isCollection(element) {
|
|
1605
1658
|
var dataObject = element.dataObjectRef;
|
|
1606
1659
|
|
|
1607
1660
|
return element.isCollection || (dataObject && dataObject.isCollection);
|
|
1608
1661
|
}
|
|
1609
1662
|
|
|
1610
|
-
function getSemantic(element) {
|
|
1611
|
-
return element.businessObject;
|
|
1612
|
-
}
|
|
1613
|
-
|
|
1614
1663
|
|
|
1615
1664
|
// color access //////////////////////
|
|
1616
1665
|
|
|
1666
|
+
/**
|
|
1667
|
+
* @param {DiagramElement} element
|
|
1668
|
+
* @param {string} defaultColor
|
|
1669
|
+
*
|
|
1670
|
+
* @return {string}
|
|
1671
|
+
*/
|
|
1617
1672
|
function getFillColor(element, defaultColor) {
|
|
1618
1673
|
var di = getDi(element);
|
|
1619
1674
|
|
|
1620
1675
|
return di.get('color:background-color') || di.get('bioc:fill') || defaultColor || 'white';
|
|
1621
1676
|
}
|
|
1622
1677
|
|
|
1678
|
+
/**
|
|
1679
|
+
* @param {DiagramElement} element
|
|
1680
|
+
* @param {string} defaultColor
|
|
1681
|
+
*
|
|
1682
|
+
* @return {string}
|
|
1683
|
+
*/
|
|
1623
1684
|
function getStrokeColor(element, defaultColor) {
|
|
1624
1685
|
var di = getDi(element);
|
|
1625
1686
|
|
|
1626
1687
|
return di.get('color:border-color') || di.get('bioc:stroke') || defaultColor || black;
|
|
1627
1688
|
}
|
|
1628
1689
|
|
|
1690
|
+
/**
|
|
1691
|
+
* @param {DiagramElement} element
|
|
1692
|
+
* @param {string} defaultColor
|
|
1693
|
+
* @param {string} defaultStrokeColor
|
|
1694
|
+
*
|
|
1695
|
+
* @return {string}
|
|
1696
|
+
*/
|
|
1629
1697
|
function getLabelColor(element, defaultColor, defaultStrokeColor) {
|
|
1630
1698
|
var di = getDi(element),
|
|
1631
1699
|
label = di.get('label');
|
|
@@ -1636,6 +1704,11 @@
|
|
|
1636
1704
|
|
|
1637
1705
|
// cropping path customizations //////////////////////
|
|
1638
1706
|
|
|
1707
|
+
/**
|
|
1708
|
+
* @param {ShapeLike} shape
|
|
1709
|
+
*
|
|
1710
|
+
* @return {string} path
|
|
1711
|
+
*/
|
|
1639
1712
|
function getCirclePath(shape) {
|
|
1640
1713
|
|
|
1641
1714
|
var cx = shape.x + shape.width / 2,
|
|
@@ -1653,6 +1726,11 @@
|
|
|
1653
1726
|
return componentsToPath(circlePath);
|
|
1654
1727
|
}
|
|
1655
1728
|
|
|
1729
|
+
/**
|
|
1730
|
+
* @param {ShapeLike} shape
|
|
1731
|
+
*
|
|
1732
|
+
* @return {string} path
|
|
1733
|
+
*/
|
|
1656
1734
|
function getRoundRectPath(shape, borderRadius) {
|
|
1657
1735
|
|
|
1658
1736
|
var x = shape.x,
|
|
@@ -1676,6 +1754,11 @@
|
|
|
1676
1754
|
return componentsToPath(roundRectPath);
|
|
1677
1755
|
}
|
|
1678
1756
|
|
|
1757
|
+
/**
|
|
1758
|
+
* @param {ShapeLike} shape
|
|
1759
|
+
*
|
|
1760
|
+
* @return {string} path
|
|
1761
|
+
*/
|
|
1679
1762
|
function getDiamondPath(shape) {
|
|
1680
1763
|
|
|
1681
1764
|
var width = shape.width,
|
|
@@ -1696,6 +1779,11 @@
|
|
|
1696
1779
|
return componentsToPath(diamondPath);
|
|
1697
1780
|
}
|
|
1698
1781
|
|
|
1782
|
+
/**
|
|
1783
|
+
* @param {ShapeLike} shape
|
|
1784
|
+
*
|
|
1785
|
+
* @return {string} path
|
|
1786
|
+
*/
|
|
1699
1787
|
function getRectPath(shape) {
|
|
1700
1788
|
var x = shape.x,
|
|
1701
1789
|
y = shape.y,
|
|
@@ -2277,7 +2365,7 @@
|
|
|
2277
2365
|
}
|
|
2278
2366
|
|
|
2279
2367
|
/**
|
|
2280
|
-
* @param {SVGElement}
|
|
2368
|
+
* @param {SVGElement} gfx
|
|
2281
2369
|
* @param {number} x
|
|
2282
2370
|
* @param {number} y
|
|
2283
2371
|
* @param {number} angle
|
|
@@ -2298,7 +2386,7 @@
|
|
|
2298
2386
|
|
|
2299
2387
|
|
|
2300
2388
|
/**
|
|
2301
|
-
* @param {SVGElement}
|
|
2389
|
+
* @param {SVGElement} gfx
|
|
2302
2390
|
* @param {number} x
|
|
2303
2391
|
* @param {number} y
|
|
2304
2392
|
*/
|
|
@@ -2311,7 +2399,7 @@
|
|
|
2311
2399
|
|
|
2312
2400
|
|
|
2313
2401
|
/**
|
|
2314
|
-
* @param {SVGElement}
|
|
2402
|
+
* @param {SVGElement} gfx
|
|
2315
2403
|
* @param {number} angle
|
|
2316
2404
|
*/
|
|
2317
2405
|
function rotate(gfx, angle) {
|
|
@@ -2494,6 +2582,29 @@
|
|
|
2494
2582
|
|
|
2495
2583
|
var ELEMENT_LABEL_DISTANCE = 10;
|
|
2496
2584
|
|
|
2585
|
+
/**
|
|
2586
|
+
* @typedef { Partial<{
|
|
2587
|
+
* defaultFillColor: string,
|
|
2588
|
+
* defaultStrokeColor: string,
|
|
2589
|
+
* defaultLabelColor: string
|
|
2590
|
+
* }> } BpmnRendererConfig
|
|
2591
|
+
*/
|
|
2592
|
+
|
|
2593
|
+
/**
|
|
2594
|
+
* @typedef { import('../model').DiagramElement } DiagramElement
|
|
2595
|
+
*/
|
|
2596
|
+
|
|
2597
|
+
/**
|
|
2598
|
+
* A renderer for BPMN elements
|
|
2599
|
+
*
|
|
2600
|
+
* @param {BpmnRendererConfig} config
|
|
2601
|
+
* @param {import('diagram-js/lib/core/EventBus').default} eventBus
|
|
2602
|
+
* @param {import('diagram-js/lib/draw/Styles').default} styles
|
|
2603
|
+
* @param {import('./PathMap').default} pathMap
|
|
2604
|
+
* @param {import('diagram-js/lib/core/Canvas').default} canvas
|
|
2605
|
+
* @param {import('./TextRenderer').default} textRenderer
|
|
2606
|
+
* @param {number} [priority]
|
|
2607
|
+
*/
|
|
2497
2608
|
function BpmnRenderer(
|
|
2498
2609
|
config, eventBus, styles, pathMap,
|
|
2499
2610
|
canvas, textRenderer, priority) {
|
|
@@ -2853,7 +2964,7 @@
|
|
|
2853
2964
|
|
|
2854
2965
|
function renderEventContent(element, parentGfx) {
|
|
2855
2966
|
|
|
2856
|
-
var event =
|
|
2967
|
+
var event = getBusinessObject(element);
|
|
2857
2968
|
var isThrowing = isThrowEvent(event);
|
|
2858
2969
|
|
|
2859
2970
|
if (event.eventDefinitions && event.eventDefinitions.length > 1) {
|
|
@@ -2926,7 +3037,7 @@
|
|
|
2926
3037
|
}
|
|
2927
3038
|
|
|
2928
3039
|
function renderEmbeddedLabel(parentGfx, element, align) {
|
|
2929
|
-
var semantic =
|
|
3040
|
+
var semantic = getBusinessObject(element);
|
|
2930
3041
|
|
|
2931
3042
|
return renderLabel(parentGfx, semantic.name, {
|
|
2932
3043
|
box: element,
|
|
@@ -2992,7 +3103,7 @@
|
|
|
2992
3103
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
2993
3104
|
};
|
|
2994
3105
|
|
|
2995
|
-
var semantic =
|
|
3106
|
+
var semantic = getBusinessObject(element);
|
|
2996
3107
|
|
|
2997
3108
|
if (!semantic.isInterrupting) {
|
|
2998
3109
|
attrs = {
|
|
@@ -3453,7 +3564,7 @@
|
|
|
3453
3564
|
return task;
|
|
3454
3565
|
},
|
|
3455
3566
|
'bpmn:ReceiveTask' : function(parentGfx, element) {
|
|
3456
|
-
var semantic =
|
|
3567
|
+
var semantic = getBusinessObject(element);
|
|
3457
3568
|
|
|
3458
3569
|
var task = renderer('bpmn:Task')(parentGfx, element);
|
|
3459
3570
|
var pathData;
|
|
@@ -3609,12 +3720,12 @@
|
|
|
3609
3720
|
stroke: getStrokeColor(element, defaultStrokeColor),
|
|
3610
3721
|
strokeWidth
|
|
3611
3722
|
});
|
|
3612
|
-
var text =
|
|
3723
|
+
var text = getBusinessObject(element).name;
|
|
3613
3724
|
renderLaneLabel(parentGfx, text, element);
|
|
3614
3725
|
} else {
|
|
3615
3726
|
|
|
3616
3727
|
// collapsed pool draw text inline
|
|
3617
|
-
var text2 =
|
|
3728
|
+
var text2 = getBusinessObject(element).name;
|
|
3618
3729
|
renderLabel(parentGfx, text2, {
|
|
3619
3730
|
box: element, align: 'center-middle',
|
|
3620
3731
|
style: {
|
|
@@ -3623,7 +3734,7 @@
|
|
|
3623
3734
|
});
|
|
3624
3735
|
}
|
|
3625
3736
|
|
|
3626
|
-
var participantMultiplicity = !!(
|
|
3737
|
+
var participantMultiplicity = !!(getBusinessObject(element).participantMultiplicity);
|
|
3627
3738
|
|
|
3628
3739
|
if (participantMultiplicity) {
|
|
3629
3740
|
renderer('ParticipantMultiplicityMarker')(parentGfx, element);
|
|
@@ -3640,7 +3751,7 @@
|
|
|
3640
3751
|
...attrs
|
|
3641
3752
|
});
|
|
3642
3753
|
|
|
3643
|
-
var semantic =
|
|
3754
|
+
var semantic = getBusinessObject(element);
|
|
3644
3755
|
|
|
3645
3756
|
if (semantic.$type === 'bpmn:Lane') {
|
|
3646
3757
|
var text = semantic.name;
|
|
@@ -3731,7 +3842,7 @@
|
|
|
3731
3842
|
},
|
|
3732
3843
|
'bpmn:EventBasedGateway': function(parentGfx, element) {
|
|
3733
3844
|
|
|
3734
|
-
var semantic =
|
|
3845
|
+
var semantic = getBusinessObject(element);
|
|
3735
3846
|
|
|
3736
3847
|
var diamond = renderer('bpmn:Gateway')(parentGfx, element);
|
|
3737
3848
|
|
|
@@ -3813,7 +3924,7 @@
|
|
|
3813
3924
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3814
3925
|
});
|
|
3815
3926
|
|
|
3816
|
-
var sequenceFlow =
|
|
3927
|
+
var sequenceFlow = getBusinessObject(element);
|
|
3817
3928
|
|
|
3818
3929
|
var source;
|
|
3819
3930
|
|
|
@@ -3840,7 +3951,7 @@
|
|
|
3840
3951
|
},
|
|
3841
3952
|
'bpmn:Association': function(parentGfx, element, attrs) {
|
|
3842
3953
|
|
|
3843
|
-
var semantic =
|
|
3954
|
+
var semantic = getBusinessObject(element);
|
|
3844
3955
|
|
|
3845
3956
|
var fill = getFillColor(element, defaultFillColor),
|
|
3846
3957
|
stroke = getStrokeColor(element, defaultStrokeColor);
|
|
@@ -3880,7 +3991,7 @@
|
|
|
3880
3991
|
},
|
|
3881
3992
|
'bpmn:MessageFlow': function(parentGfx, element) {
|
|
3882
3993
|
|
|
3883
|
-
var semantic =
|
|
3994
|
+
var semantic = getBusinessObject(element),
|
|
3884
3995
|
di = getDi(element);
|
|
3885
3996
|
|
|
3886
3997
|
var fill = getFillColor(element, defaultFillColor),
|
|
@@ -3955,7 +4066,7 @@
|
|
|
3955
4066
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
3956
4067
|
});
|
|
3957
4068
|
|
|
3958
|
-
var semantic =
|
|
4069
|
+
var semantic = getBusinessObject(element);
|
|
3959
4070
|
|
|
3960
4071
|
if (isCollection(semantic)) {
|
|
3961
4072
|
renderDataItemCollection(parentGfx, element);
|
|
@@ -4011,7 +4122,7 @@
|
|
|
4011
4122
|
},
|
|
4012
4123
|
'bpmn:BoundaryEvent': function(parentGfx, element) {
|
|
4013
4124
|
|
|
4014
|
-
var semantic =
|
|
4125
|
+
var semantic = getBusinessObject(element),
|
|
4015
4126
|
cancel = semantic.cancelActivity;
|
|
4016
4127
|
|
|
4017
4128
|
var attrs = {
|
|
@@ -4077,7 +4188,7 @@
|
|
|
4077
4188
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
4078
4189
|
});
|
|
4079
4190
|
|
|
4080
|
-
var text =
|
|
4191
|
+
var text = getBusinessObject(element).text || '';
|
|
4081
4192
|
renderLabel(parentGfx, text, {
|
|
4082
4193
|
box: element,
|
|
4083
4194
|
align: 'left-top',
|
|
@@ -4226,7 +4337,7 @@
|
|
|
4226
4337
|
};
|
|
4227
4338
|
|
|
4228
4339
|
function attachTaskMarkers(parentGfx, element, taskMarkers) {
|
|
4229
|
-
var obj =
|
|
4340
|
+
var obj = getBusinessObject(element);
|
|
4230
4341
|
|
|
4231
4342
|
var subprocess = taskMarkers && taskMarkers.indexOf('SubProcessMarker') !== -1;
|
|
4232
4343
|
var position;
|
|
@@ -4320,10 +4431,23 @@
|
|
|
4320
4431
|
];
|
|
4321
4432
|
|
|
4322
4433
|
|
|
4434
|
+
/**
|
|
4435
|
+
* @param {DiagramElement} element
|
|
4436
|
+
*
|
|
4437
|
+
* @return {boolean}
|
|
4438
|
+
*/
|
|
4323
4439
|
BpmnRenderer.prototype.canRender = function(element) {
|
|
4324
4440
|
return is$1(element, 'bpmn:BaseElement');
|
|
4325
4441
|
};
|
|
4326
4442
|
|
|
4443
|
+
/**
|
|
4444
|
+
* Draw shape into parentGfx.
|
|
4445
|
+
*
|
|
4446
|
+
* @param {SVGElement} parentGfx
|
|
4447
|
+
* @param {DiagramElement} element
|
|
4448
|
+
*
|
|
4449
|
+
* @return {SVGElement} mainGfx
|
|
4450
|
+
*/
|
|
4327
4451
|
BpmnRenderer.prototype.drawShape = function(parentGfx, element) {
|
|
4328
4452
|
var type = element.type;
|
|
4329
4453
|
var h = this._renderer(type);
|
|
@@ -4332,6 +4456,14 @@
|
|
|
4332
4456
|
return h(parentGfx, element);
|
|
4333
4457
|
};
|
|
4334
4458
|
|
|
4459
|
+
/**
|
|
4460
|
+
* Draw connection into parentGfx.
|
|
4461
|
+
*
|
|
4462
|
+
* @param {SVGElement} parentGfx
|
|
4463
|
+
* @param {DiagramElement} element
|
|
4464
|
+
*
|
|
4465
|
+
* @return {SVGElement} mainGfx
|
|
4466
|
+
*/
|
|
4335
4467
|
BpmnRenderer.prototype.drawConnection = function(parentGfx, element) {
|
|
4336
4468
|
var type = element.type;
|
|
4337
4469
|
var h = this._renderer(type);
|
|
@@ -4340,6 +4472,13 @@
|
|
|
4340
4472
|
return h(parentGfx, element);
|
|
4341
4473
|
};
|
|
4342
4474
|
|
|
4475
|
+
/**
|
|
4476
|
+
* Get shape path.
|
|
4477
|
+
*
|
|
4478
|
+
* @param {DiagramElement} element
|
|
4479
|
+
*
|
|
4480
|
+
* @return {string} path
|
|
4481
|
+
*/
|
|
4343
4482
|
BpmnRenderer.prototype.getShapePath = function(element) {
|
|
4344
4483
|
|
|
4345
4484
|
if (is$1(element, 'bpmn:Event')) {
|
|
@@ -4359,6 +4498,41 @@
|
|
|
4359
4498
|
|
|
4360
4499
|
/**
|
|
4361
4500
|
* @typedef {import('../util/Types').Dimensions} Dimensions
|
|
4501
|
+
*
|
|
4502
|
+
* @typedef { {
|
|
4503
|
+
* top: number;
|
|
4504
|
+
* left: number;
|
|
4505
|
+
* right: number;
|
|
4506
|
+
* bottom: number;
|
|
4507
|
+
* } } Padding
|
|
4508
|
+
*
|
|
4509
|
+
* @typedef { number | Partial<Padding> } PaddingConfig
|
|
4510
|
+
*
|
|
4511
|
+
* @typedef { {
|
|
4512
|
+
* horizontal: 'center' | 'left';
|
|
4513
|
+
* vertical: 'top' | 'center';
|
|
4514
|
+
* } } Alignment
|
|
4515
|
+
*
|
|
4516
|
+
* @typedef { 'center-middle' | 'center-top' } AlignmentConfig
|
|
4517
|
+
*
|
|
4518
|
+
* @typedef { Partial<{
|
|
4519
|
+
* align: AlignmentConfig;
|
|
4520
|
+
* style: Record<string, any>;
|
|
4521
|
+
* padding: PaddingConfig;
|
|
4522
|
+
* }> } BaseTextConfig
|
|
4523
|
+
*
|
|
4524
|
+
* @typedef { BaseTextConfig & Partial<{
|
|
4525
|
+
* size: Dimensions;
|
|
4526
|
+
* }> } TextConfig
|
|
4527
|
+
*
|
|
4528
|
+
* @typedef { BaseTextConfig & Partial<{
|
|
4529
|
+
* box: Dimensions;
|
|
4530
|
+
* fitBox: boolean;
|
|
4531
|
+
* }> } TextLayoutConfig
|
|
4532
|
+
*
|
|
4533
|
+
* @typedef { Dimensions & {
|
|
4534
|
+
* text: string;
|
|
4535
|
+
* } } LineDescriptor
|
|
4362
4536
|
*/
|
|
4363
4537
|
|
|
4364
4538
|
var DEFAULT_BOX_PADDING = 0;
|
|
@@ -4369,6 +4543,10 @@
|
|
|
4369
4543
|
};
|
|
4370
4544
|
|
|
4371
4545
|
|
|
4546
|
+
/**
|
|
4547
|
+
* @param {AlignmentConfig} align
|
|
4548
|
+
* @return {Alignment}
|
|
4549
|
+
*/
|
|
4372
4550
|
function parseAlign(align) {
|
|
4373
4551
|
|
|
4374
4552
|
var parts = align.split('-');
|
|
@@ -4379,6 +4557,11 @@
|
|
|
4379
4557
|
};
|
|
4380
4558
|
}
|
|
4381
4559
|
|
|
4560
|
+
/**
|
|
4561
|
+
* @param {PaddingConfig} padding
|
|
4562
|
+
*
|
|
4563
|
+
* @return {Padding}
|
|
4564
|
+
*/
|
|
4382
4565
|
function parsePadding(padding) {
|
|
4383
4566
|
|
|
4384
4567
|
if (isObject(padding)) {
|
|
@@ -4393,6 +4576,12 @@
|
|
|
4393
4576
|
}
|
|
4394
4577
|
}
|
|
4395
4578
|
|
|
4579
|
+
/**
|
|
4580
|
+
* @param {string} text
|
|
4581
|
+
* @param {SVGTextElement} fakeText
|
|
4582
|
+
*
|
|
4583
|
+
* @return {import('../util/Types').Dimensions}
|
|
4584
|
+
*/
|
|
4396
4585
|
function getTextBBox(text, fakeText) {
|
|
4397
4586
|
|
|
4398
4587
|
fakeText.textContent = text;
|
|
@@ -4436,7 +4625,7 @@
|
|
|
4436
4625
|
*
|
|
4437
4626
|
* @param {string[]} lines
|
|
4438
4627
|
*
|
|
4439
|
-
* @return {
|
|
4628
|
+
* @return {LineDescriptor} the line descriptor
|
|
4440
4629
|
*/
|
|
4441
4630
|
function layoutNext(lines, maxWidth, fakeText) {
|
|
4442
4631
|
|
|
@@ -4459,6 +4648,14 @@
|
|
|
4459
4648
|
}
|
|
4460
4649
|
}
|
|
4461
4650
|
|
|
4651
|
+
/**
|
|
4652
|
+
* @param {string[]} lines
|
|
4653
|
+
* @param {string} fitLine
|
|
4654
|
+
* @param {string} originalLine
|
|
4655
|
+
* @param {Dimensions} textBBox
|
|
4656
|
+
*
|
|
4657
|
+
* @return {LineDescriptor}
|
|
4658
|
+
*/
|
|
4462
4659
|
function fit(lines, fitLine, originalLine, textBBox) {
|
|
4463
4660
|
if (fitLine.length < originalLine.length) {
|
|
4464
4661
|
var remainder = originalLine.slice(fitLine.length).trim();
|
|
@@ -4522,6 +4719,13 @@
|
|
|
4522
4719
|
}
|
|
4523
4720
|
|
|
4524
4721
|
|
|
4722
|
+
/**
|
|
4723
|
+
* @param {string} line
|
|
4724
|
+
* @param {number} width
|
|
4725
|
+
* @param {number} maxWidth
|
|
4726
|
+
*
|
|
4727
|
+
* @return {string}
|
|
4728
|
+
*/
|
|
4525
4729
|
function shortenLine(line, width, maxWidth) {
|
|
4526
4730
|
var length = Math.max(line.length * (maxWidth / width), 1);
|
|
4527
4731
|
|
|
@@ -4538,6 +4742,9 @@
|
|
|
4538
4742
|
}
|
|
4539
4743
|
|
|
4540
4744
|
|
|
4745
|
+
/**
|
|
4746
|
+
* @return {SVGSVGElement}
|
|
4747
|
+
*/
|
|
4541
4748
|
function getHelperSvg() {
|
|
4542
4749
|
var helperSvg = document.getElementById('helper-svg');
|
|
4543
4750
|
|
|
@@ -4565,11 +4772,7 @@
|
|
|
4565
4772
|
/**
|
|
4566
4773
|
* Creates a new label utility
|
|
4567
4774
|
*
|
|
4568
|
-
* @param {
|
|
4569
|
-
* @param {Dimensions} config.size
|
|
4570
|
-
* @param {number} config.padding
|
|
4571
|
-
* @param {Object} config.style
|
|
4572
|
-
* @param {string} config.align
|
|
4775
|
+
* @param {TextConfig} config
|
|
4573
4776
|
*/
|
|
4574
4777
|
function Text(config) {
|
|
4575
4778
|
|
|
@@ -4585,7 +4788,7 @@
|
|
|
4585
4788
|
* Returns the layouted text as an SVG element.
|
|
4586
4789
|
*
|
|
4587
4790
|
* @param {string} text
|
|
4588
|
-
* @param {
|
|
4791
|
+
* @param {TextLayoutConfig} options
|
|
4589
4792
|
*
|
|
4590
4793
|
* @return {SVGElement}
|
|
4591
4794
|
*/
|
|
@@ -4597,7 +4800,7 @@
|
|
|
4597
4800
|
* Returns a labels layouted dimensions.
|
|
4598
4801
|
*
|
|
4599
4802
|
* @param {string} text to layout
|
|
4600
|
-
* @param {
|
|
4803
|
+
* @param {TextLayoutConfig} options
|
|
4601
4804
|
*
|
|
4602
4805
|
* @return {Dimensions}
|
|
4603
4806
|
*/
|
|
@@ -4608,18 +4811,13 @@
|
|
|
4608
4811
|
/**
|
|
4609
4812
|
* Creates and returns a label and its bounding box.
|
|
4610
4813
|
*
|
|
4611
|
-
* @method Text#createText
|
|
4612
|
-
*
|
|
4613
4814
|
* @param {string} text the text to render on the label
|
|
4614
|
-
* @param {
|
|
4615
|
-
* @param {string} options.align how to align in the bounding box.
|
|
4616
|
-
* Any of { 'center-middle', 'center-top' },
|
|
4617
|
-
* defaults to 'center-top'.
|
|
4618
|
-
* @param {string} options.style style to be applied to the text
|
|
4619
|
-
* @param {boolean} options.fitBox indicates if box will be recalculated to
|
|
4620
|
-
* fit text
|
|
4815
|
+
* @param {TextLayoutConfig} options
|
|
4621
4816
|
*
|
|
4622
|
-
* @return {
|
|
4817
|
+
* @return { {
|
|
4818
|
+
* element: SVGElement,
|
|
4819
|
+
* dimensions: Dimensions
|
|
4820
|
+
* } }
|
|
4623
4821
|
*/
|
|
4624
4822
|
Text.prototype.layoutText = function(text, options) {
|
|
4625
4823
|
var box = assign$1({}, this._config.size, options.box),
|
|
@@ -4735,7 +4933,30 @@
|
|
|
4735
4933
|
|
|
4736
4934
|
var MIN_TEXT_ANNOTATION_HEIGHT = 30;
|
|
4737
4935
|
|
|
4936
|
+
/**
|
|
4937
|
+
* @typedef { {
|
|
4938
|
+
* fontFamily: string;
|
|
4939
|
+
* fontSize: number;
|
|
4940
|
+
* fontWeight: string;
|
|
4941
|
+
* lineHeight: number;
|
|
4942
|
+
* } } TextRendererStyle
|
|
4943
|
+
*
|
|
4944
|
+
* @typedef { {
|
|
4945
|
+
* defaultStyle?: Partial<TextRendererStyle>;
|
|
4946
|
+
* externalStyle?: Partial<TextRendererStyle>;
|
|
4947
|
+
* } } TextRendererConfig
|
|
4948
|
+
*
|
|
4949
|
+
* @typedef { import('diagram-js/lib/util/Text').TextLayoutConfig } TextLayoutConfig
|
|
4950
|
+
*
|
|
4951
|
+
* @typedef { import('diagram-js/lib/util/Types').Rect } Rect
|
|
4952
|
+
*/
|
|
4738
4953
|
|
|
4954
|
+
|
|
4955
|
+
/**
|
|
4956
|
+
* Renders text and computes text bounding boxes.
|
|
4957
|
+
*
|
|
4958
|
+
* @param {TextRendererConfig} [config]
|
|
4959
|
+
*/
|
|
4739
4960
|
function TextRenderer(config) {
|
|
4740
4961
|
|
|
4741
4962
|
var defaultStyle = assign$1({
|
|
@@ -4759,19 +4980,17 @@
|
|
|
4759
4980
|
* Get the new bounds of an externally rendered,
|
|
4760
4981
|
* layouted label.
|
|
4761
4982
|
*
|
|
4762
|
-
* @param
|
|
4763
|
-
* @param
|
|
4983
|
+
* @param {Rect} bounds
|
|
4984
|
+
* @param {string} text
|
|
4764
4985
|
*
|
|
4765
|
-
* @return {
|
|
4986
|
+
* @return {Rect}
|
|
4766
4987
|
*/
|
|
4767
4988
|
this.getExternalLabelBounds = function(bounds, text) {
|
|
4768
4989
|
|
|
4769
4990
|
var layoutedDimensions = textUtil.getDimensions(text, {
|
|
4770
4991
|
box: {
|
|
4771
4992
|
width: 90,
|
|
4772
|
-
height: 30
|
|
4773
|
-
x: bounds.width / 2 + bounds.x,
|
|
4774
|
-
y: bounds.height / 2 + bounds.y
|
|
4993
|
+
height: 30
|
|
4775
4994
|
},
|
|
4776
4995
|
style: externalStyle
|
|
4777
4996
|
});
|
|
@@ -4789,10 +5008,10 @@
|
|
|
4789
5008
|
/**
|
|
4790
5009
|
* Get the new bounds of text annotation.
|
|
4791
5010
|
*
|
|
4792
|
-
* @param
|
|
4793
|
-
* @param
|
|
5011
|
+
* @param {Rect} bounds
|
|
5012
|
+
* @param {string} text
|
|
4794
5013
|
*
|
|
4795
|
-
* @return {
|
|
5014
|
+
* @return {Rect}
|
|
4796
5015
|
*/
|
|
4797
5016
|
this.getTextAnnotationBounds = function(bounds, text) {
|
|
4798
5017
|
|
|
@@ -4815,7 +5034,7 @@
|
|
|
4815
5034
|
* Create a layouted text element.
|
|
4816
5035
|
*
|
|
4817
5036
|
* @param {string} text
|
|
4818
|
-
* @param {
|
|
5037
|
+
* @param {TextLayoutConfig} [options]
|
|
4819
5038
|
*
|
|
4820
5039
|
* @return {SVGElement} rendered text
|
|
4821
5040
|
*/
|
|
@@ -4844,9 +5063,8 @@
|
|
|
4844
5063
|
];
|
|
4845
5064
|
|
|
4846
5065
|
/**
|
|
4847
|
-
* Map containing SVG paths needed by BpmnRenderer
|
|
5066
|
+
* Map containing SVG paths needed by BpmnRenderer
|
|
4848
5067
|
*/
|
|
4849
|
-
|
|
4850
5068
|
function PathMap() {
|
|
4851
5069
|
|
|
4852
5070
|
/**
|
|
@@ -5188,6 +5406,13 @@
|
|
|
5188
5406
|
}
|
|
5189
5407
|
};
|
|
5190
5408
|
|
|
5409
|
+
/**
|
|
5410
|
+
* Return raw path for the given ID.
|
|
5411
|
+
*
|
|
5412
|
+
* @param {string} pathId
|
|
5413
|
+
*
|
|
5414
|
+
* @return {string} raw path
|
|
5415
|
+
*/
|
|
5191
5416
|
this.getRawPath = function getRawPath(pathId) {
|
|
5192
5417
|
return this.pathMap[pathId].d;
|
|
5193
5418
|
};
|
|
@@ -5240,6 +5465,7 @@
|
|
|
5240
5465
|
* </ul>
|
|
5241
5466
|
* </p>
|
|
5242
5467
|
*
|
|
5468
|
+
* @return {string} scaled path
|
|
5243
5469
|
*/
|
|
5244
5470
|
this.getScaledPath = function getScaledPath(pathId, param) {
|
|
5245
5471
|
var rawPath = this.pathMap[pathId];
|
|
@@ -5323,7 +5549,9 @@
|
|
|
5323
5549
|
};
|
|
5324
5550
|
|
|
5325
5551
|
/**
|
|
5326
|
-
* @typedef {
|
|
5552
|
+
* @typedef { {
|
|
5553
|
+
* [key: string]: string;
|
|
5554
|
+
* } } TranslateReplacements
|
|
5327
5555
|
*/
|
|
5328
5556
|
|
|
5329
5557
|
/**
|
|
@@ -5333,14 +5561,16 @@
|
|
|
5333
5561
|
*
|
|
5334
5562
|
* @example
|
|
5335
5563
|
*
|
|
5564
|
+
* ```javascript
|
|
5336
5565
|
* // use it inside any diagram component by injecting `translate`.
|
|
5337
5566
|
*
|
|
5338
5567
|
* function MyService(translate) {
|
|
5339
5568
|
* alert(translate('HELLO {you}', { you: 'You!' }));
|
|
5340
5569
|
* }
|
|
5570
|
+
* ```
|
|
5341
5571
|
*
|
|
5342
5572
|
* @param {string} template to interpolate
|
|
5343
|
-
* @param {
|
|
5573
|
+
* @param {TranslateReplacements} [replacements] a map with substitutes
|
|
5344
5574
|
*
|
|
5345
5575
|
* @return {string} the translated string
|
|
5346
5576
|
*/
|
|
@@ -5353,10 +5583,21 @@
|
|
|
5353
5583
|
});
|
|
5354
5584
|
}
|
|
5355
5585
|
|
|
5586
|
+
/**
|
|
5587
|
+
* @type { import('didi').ModuleDeclaration }
|
|
5588
|
+
*/
|
|
5356
5589
|
var TranslateModule = {
|
|
5357
5590
|
translate: [ 'value', translate ]
|
|
5358
5591
|
};
|
|
5359
5592
|
|
|
5593
|
+
/**
|
|
5594
|
+
* @typedef {import('diagram-js/lib/util/Types').Point} Point
|
|
5595
|
+
* @typedef {import('diagram-js/lib/util/Types').Rect} Rect
|
|
5596
|
+
*
|
|
5597
|
+
* @typedef {import('../model/Types').Element} Element
|
|
5598
|
+
* @typedef {import('../model/Types').ModdleElement} ModdleElement
|
|
5599
|
+
*/
|
|
5600
|
+
|
|
5360
5601
|
var DEFAULT_LABEL_SIZE = {
|
|
5361
5602
|
width: 90,
|
|
5362
5603
|
height: 20
|
|
@@ -5366,10 +5607,11 @@
|
|
|
5366
5607
|
|
|
5367
5608
|
|
|
5368
5609
|
/**
|
|
5369
|
-
*
|
|
5610
|
+
* Return true if the given semantic has an external label.
|
|
5611
|
+
*
|
|
5612
|
+
* @param {Element} semantic
|
|
5370
5613
|
*
|
|
5371
|
-
* @
|
|
5372
|
-
* @return {boolean} true if has label
|
|
5614
|
+
* @return {boolean}
|
|
5373
5615
|
*/
|
|
5374
5616
|
function isLabelExternal(semantic) {
|
|
5375
5617
|
return is$1(semantic, 'bpmn:Event') ||
|
|
@@ -5384,10 +5626,11 @@
|
|
|
5384
5626
|
}
|
|
5385
5627
|
|
|
5386
5628
|
/**
|
|
5387
|
-
* Get the position
|
|
5629
|
+
* Get the position of a sequence flow label.
|
|
5630
|
+
*
|
|
5631
|
+
* @param {Point[]} waypoints
|
|
5388
5632
|
*
|
|
5389
|
-
* @
|
|
5390
|
-
* @return {Point} the label position
|
|
5633
|
+
* @return {Point}
|
|
5391
5634
|
*/
|
|
5392
5635
|
function getFlowLabelPosition(waypoints) {
|
|
5393
5636
|
|
|
@@ -5417,10 +5660,11 @@
|
|
|
5417
5660
|
|
|
5418
5661
|
|
|
5419
5662
|
/**
|
|
5420
|
-
* Get the middle of a number of waypoints
|
|
5663
|
+
* Get the middle of a number of waypoints.
|
|
5421
5664
|
*
|
|
5422
|
-
* @param {
|
|
5423
|
-
*
|
|
5665
|
+
* @param {Point[]} waypoints
|
|
5666
|
+
*
|
|
5667
|
+
* @return {Point}
|
|
5424
5668
|
*/
|
|
5425
5669
|
function getWaypointsMid(waypoints) {
|
|
5426
5670
|
|
|
@@ -5435,7 +5679,13 @@
|
|
|
5435
5679
|
};
|
|
5436
5680
|
}
|
|
5437
5681
|
|
|
5438
|
-
|
|
5682
|
+
/**
|
|
5683
|
+
* Get the middle of the external label of an element.
|
|
5684
|
+
*
|
|
5685
|
+
* @param {Element} element
|
|
5686
|
+
*
|
|
5687
|
+
* @return {Point}
|
|
5688
|
+
*/
|
|
5439
5689
|
function getExternalLabelMid(element) {
|
|
5440
5690
|
|
|
5441
5691
|
if (element.waypoints) {
|
|
@@ -5455,11 +5705,13 @@
|
|
|
5455
5705
|
|
|
5456
5706
|
|
|
5457
5707
|
/**
|
|
5458
|
-
*
|
|
5708
|
+
* Return the bounds of an elements label, parsed from the elements DI or
|
|
5459
5709
|
* generated from its bounds.
|
|
5460
5710
|
*
|
|
5461
|
-
* @param {
|
|
5462
|
-
* @param {
|
|
5711
|
+
* @param {ModdleElement} di
|
|
5712
|
+
* @param {Element} element
|
|
5713
|
+
*
|
|
5714
|
+
* @return {Rect}
|
|
5463
5715
|
*/
|
|
5464
5716
|
function getExternalLabelBounds(di, element) {
|
|
5465
5717
|
|
|
@@ -5617,7 +5869,7 @@
|
|
|
5617
5869
|
/**
|
|
5618
5870
|
* Get the mid of the given Element.
|
|
5619
5871
|
*
|
|
5620
|
-
* @param {
|
|
5872
|
+
* @param {Element} element
|
|
5621
5873
|
*
|
|
5622
5874
|
* @return {Point}
|
|
5623
5875
|
*/
|
|
@@ -5647,6 +5899,21 @@
|
|
|
5647
5899
|
return '<' + e.$type + (e.id ? ' id="' + e.id : '') + '" />';
|
|
5648
5900
|
}
|
|
5649
5901
|
|
|
5902
|
+
/**
|
|
5903
|
+
* @typedef {import('diagram-js/lib/core/Canvas').default} Canvas
|
|
5904
|
+
* @typedef {import('diagram-js/lib/core/ElementRegistry').default} ElementRegistry
|
|
5905
|
+
* @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
|
|
5906
|
+
* @typedef {import('diagram-js/lib/i18n/translate/translate').default} Translate
|
|
5907
|
+
*
|
|
5908
|
+
* @typedef {import('../features/modeling/ElementFactory').default} ElementFactory
|
|
5909
|
+
* @typedef {import('../draw/TextRenderer').default} TextRenderer
|
|
5910
|
+
*
|
|
5911
|
+
* @typedef {import('../model/Types').Element} Element
|
|
5912
|
+
* @typedef {import('../model/Types').Label} Label
|
|
5913
|
+
* @typedef {import('../model/Types').Shape} Shape
|
|
5914
|
+
* @typedef {import('../model/Types').ModdleElement} ModdleElement
|
|
5915
|
+
*/
|
|
5916
|
+
|
|
5650
5917
|
/**
|
|
5651
5918
|
* @param {ModdleElement} semantic
|
|
5652
5919
|
* @param {ModdleElement} di
|
|
@@ -5718,8 +5985,12 @@
|
|
|
5718
5985
|
|
|
5719
5986
|
|
|
5720
5987
|
/**
|
|
5721
|
-
* Add
|
|
5722
|
-
*
|
|
5988
|
+
* Add a BPMN element (semantic) to the canvas making it a child of the
|
|
5989
|
+
* given parent.
|
|
5990
|
+
*
|
|
5991
|
+
* @param {ModdleElement} semantic
|
|
5992
|
+
* @param {ModdleElement} di
|
|
5993
|
+
* @param {Shape} parentElement
|
|
5723
5994
|
*/
|
|
5724
5995
|
BpmnImporter.prototype.add = function(semantic, di, parentElement) {
|
|
5725
5996
|
var element,
|
|
@@ -5828,10 +6099,10 @@
|
|
|
5828
6099
|
|
|
5829
6100
|
|
|
5830
6101
|
/**
|
|
5831
|
-
* Attach
|
|
6102
|
+
* Attach a boundary element to the given host.
|
|
5832
6103
|
*
|
|
5833
6104
|
* @param {ModdleElement} boundarySemantic
|
|
5834
|
-
* @param {
|
|
6105
|
+
* @param {Shape} boundaryElement
|
|
5835
6106
|
*/
|
|
5836
6107
|
BpmnImporter.prototype._attachBoundary = function(boundarySemantic, boundaryElement) {
|
|
5837
6108
|
var translate = this._translate;
|
|
@@ -5864,7 +6135,13 @@
|
|
|
5864
6135
|
|
|
5865
6136
|
|
|
5866
6137
|
/**
|
|
5867
|
-
*
|
|
6138
|
+
* Add a label to a given element.
|
|
6139
|
+
*
|
|
6140
|
+
* @param {ModdleElement} semantic
|
|
6141
|
+
* @param {ModdleElement} di
|
|
6142
|
+
* @param {Element} element
|
|
6143
|
+
*
|
|
6144
|
+
* @return {Label}
|
|
5868
6145
|
*/
|
|
5869
6146
|
BpmnImporter.prototype.addLabel = function(semantic, di, element) {
|
|
5870
6147
|
var bounds,
|
|
@@ -5896,11 +6173,14 @@
|
|
|
5896
6173
|
};
|
|
5897
6174
|
|
|
5898
6175
|
/**
|
|
5899
|
-
*
|
|
6176
|
+
* Get the source or target of the given connection.
|
|
6177
|
+
*
|
|
6178
|
+
* @param {ModdleElement} semantic
|
|
6179
|
+
* @param {'source' | 'target'} side
|
|
5900
6180
|
*
|
|
5901
|
-
* @
|
|
6181
|
+
* @return {Element}
|
|
5902
6182
|
*/
|
|
5903
|
-
BpmnImporter.prototype.
|
|
6183
|
+
BpmnImporter.prototype._getConnectedElement = function(semantic, side) {
|
|
5904
6184
|
|
|
5905
6185
|
var element,
|
|
5906
6186
|
refSemantic,
|
|
@@ -5938,11 +6218,11 @@
|
|
|
5938
6218
|
};
|
|
5939
6219
|
|
|
5940
6220
|
BpmnImporter.prototype._getSource = function(semantic) {
|
|
5941
|
-
return this.
|
|
6221
|
+
return this._getConnectedElement(semantic, 'source');
|
|
5942
6222
|
};
|
|
5943
6223
|
|
|
5944
6224
|
BpmnImporter.prototype._getTarget = function(semantic) {
|
|
5945
|
-
return this.
|
|
6225
|
+
return this._getConnectedElement(semantic, 'target');
|
|
5946
6226
|
};
|
|
5947
6227
|
|
|
5948
6228
|
|
|
@@ -6028,11 +6308,13 @@
|
|
|
6028
6308
|
}
|
|
6029
6309
|
|
|
6030
6310
|
/**
|
|
6031
|
-
* @typedef {import('../../model').
|
|
6311
|
+
* @typedef {import('../../model/Types').Element} Element
|
|
6032
6312
|
*
|
|
6033
6313
|
* @typedef {import('../../core/ElementRegistry').default} ElementRegistry
|
|
6034
6314
|
* @typedef {import('../../core/EventBus').default} EventBus
|
|
6035
6315
|
* @typedef {import('../../draw/Styles').default} Styles
|
|
6316
|
+
*
|
|
6317
|
+
* @typedef {import('../../util/Types').Point} Point
|
|
6036
6318
|
*/
|
|
6037
6319
|
|
|
6038
6320
|
function allowAll(event) { return true; }
|
|
@@ -6076,7 +6358,7 @@
|
|
|
6076
6358
|
*
|
|
6077
6359
|
* @param {string} type local event name, e.g. element.click.
|
|
6078
6360
|
* @param {MouseEvent|TouchEvent} event native event
|
|
6079
|
-
* @param {
|
|
6361
|
+
* @param {Element} [element] the diagram element to emit the event on;
|
|
6080
6362
|
* defaults to the event target
|
|
6081
6363
|
*/
|
|
6082
6364
|
function fire(type, event, element) {
|
|
@@ -6159,7 +6441,7 @@
|
|
|
6159
6441
|
*
|
|
6160
6442
|
* @param {string} eventName the name of the triggered DOM event
|
|
6161
6443
|
* @param {MouseEvent|TouchEvent} event
|
|
6162
|
-
* @param {
|
|
6444
|
+
* @param {Element} targetElement
|
|
6163
6445
|
*/
|
|
6164
6446
|
function triggerMouseEvent(eventName, event, targetElement) {
|
|
6165
6447
|
|
|
@@ -6325,7 +6607,7 @@
|
|
|
6325
6607
|
/**
|
|
6326
6608
|
* Create default hit for the given element.
|
|
6327
6609
|
*
|
|
6328
|
-
* @param {
|
|
6610
|
+
* @param {Element} element
|
|
6329
6611
|
* @param {SVGElement} gfx
|
|
6330
6612
|
*
|
|
6331
6613
|
* @return {SVGElement} created hit
|
|
@@ -6352,7 +6634,7 @@
|
|
|
6352
6634
|
* Create hits for the given waypoints.
|
|
6353
6635
|
*
|
|
6354
6636
|
* @param {SVGElement} gfx
|
|
6355
|
-
* @param {
|
|
6637
|
+
* @param {Point[]} waypoints
|
|
6356
6638
|
*
|
|
6357
6639
|
* @return {SVGElement}
|
|
6358
6640
|
*/
|
|
@@ -6371,7 +6653,7 @@
|
|
|
6371
6653
|
* Create hits for a box.
|
|
6372
6654
|
*
|
|
6373
6655
|
* @param {SVGElement} gfx
|
|
6374
|
-
* @param {string}
|
|
6656
|
+
* @param {string} type
|
|
6375
6657
|
* @param {Object} attrs
|
|
6376
6658
|
*
|
|
6377
6659
|
* @return {SVGElement}
|
|
@@ -6397,7 +6679,7 @@
|
|
|
6397
6679
|
/**
|
|
6398
6680
|
* Update default hit of the element.
|
|
6399
6681
|
*
|
|
6400
|
-
* @param {
|
|
6682
|
+
* @param {Element} element
|
|
6401
6683
|
* @param {SVGElement} gfx
|
|
6402
6684
|
*
|
|
6403
6685
|
* @return {SVGElement} updated hit
|
|
@@ -6446,7 +6728,7 @@
|
|
|
6446
6728
|
* @event element.hover
|
|
6447
6729
|
*
|
|
6448
6730
|
* @type {Object}
|
|
6449
|
-
* @property {
|
|
6731
|
+
* @property {Element} element
|
|
6450
6732
|
* @property {SVGElement} gfx
|
|
6451
6733
|
* @property {Event} originalEvent
|
|
6452
6734
|
*/
|
|
@@ -6457,7 +6739,7 @@
|
|
|
6457
6739
|
* @event element.out
|
|
6458
6740
|
*
|
|
6459
6741
|
* @type {Object}
|
|
6460
|
-
* @property {
|
|
6742
|
+
* @property {Element} element
|
|
6461
6743
|
* @property {SVGElement} gfx
|
|
6462
6744
|
* @property {Event} originalEvent
|
|
6463
6745
|
*/
|
|
@@ -6468,7 +6750,7 @@
|
|
|
6468
6750
|
* @event element.click
|
|
6469
6751
|
*
|
|
6470
6752
|
* @type {Object}
|
|
6471
|
-
* @property {
|
|
6753
|
+
* @property {Element} element
|
|
6472
6754
|
* @property {SVGElement} gfx
|
|
6473
6755
|
* @property {Event} originalEvent
|
|
6474
6756
|
*/
|
|
@@ -6479,7 +6761,7 @@
|
|
|
6479
6761
|
* @event element.dblclick
|
|
6480
6762
|
*
|
|
6481
6763
|
* @type {Object}
|
|
6482
|
-
* @property {
|
|
6764
|
+
* @property {Element} element
|
|
6483
6765
|
* @property {SVGElement} gfx
|
|
6484
6766
|
* @property {Event} originalEvent
|
|
6485
6767
|
*/
|
|
@@ -6490,7 +6772,7 @@
|
|
|
6490
6772
|
* @event element.mousedown
|
|
6491
6773
|
*
|
|
6492
6774
|
* @type {Object}
|
|
6493
|
-
* @property {
|
|
6775
|
+
* @property {Element} element
|
|
6494
6776
|
* @property {SVGElement} gfx
|
|
6495
6777
|
* @property {Event} originalEvent
|
|
6496
6778
|
*/
|
|
@@ -6501,7 +6783,7 @@
|
|
|
6501
6783
|
* @event element.mouseup
|
|
6502
6784
|
*
|
|
6503
6785
|
* @type {Object}
|
|
6504
|
-
* @property {
|
|
6786
|
+
* @property {Element} element
|
|
6505
6787
|
* @property {SVGElement} gfx
|
|
6506
6788
|
* @property {Event} originalEvent
|
|
6507
6789
|
*/
|
|
@@ -6513,11 +6795,14 @@
|
|
|
6513
6795
|
* @event element.contextmenu
|
|
6514
6796
|
*
|
|
6515
6797
|
* @type {Object}
|
|
6516
|
-
* @property {
|
|
6798
|
+
* @property {Element} element
|
|
6517
6799
|
* @property {SVGElement} gfx
|
|
6518
6800
|
* @property {Event} originalEvent
|
|
6519
6801
|
*/
|
|
6520
6802
|
|
|
6803
|
+
/**
|
|
6804
|
+
* @type { import('didi').ModuleDeclaration }
|
|
6805
|
+
*/
|
|
6521
6806
|
var InteractionEventsModule = {
|
|
6522
6807
|
__init__: [ 'interactionEvents' ],
|
|
6523
6808
|
interactionEvents: [ 'type', InteractionEvents ]
|
|
@@ -6527,7 +6812,7 @@
|
|
|
6527
6812
|
* Returns the surrounding bbox for all elements in
|
|
6528
6813
|
* the array or the element primitive.
|
|
6529
6814
|
*
|
|
6530
|
-
* @param {
|
|
6815
|
+
* @param {Element|Element[]} elements
|
|
6531
6816
|
* @param {boolean} [stopRecursion=false]
|
|
6532
6817
|
*
|
|
6533
6818
|
* @return {Rect}
|
|
@@ -6602,7 +6887,7 @@
|
|
|
6602
6887
|
var LOW_PRIORITY$2 = 500;
|
|
6603
6888
|
|
|
6604
6889
|
/**
|
|
6605
|
-
* @typedef {import('../../model').
|
|
6890
|
+
* @typedef {import('../../model/Types').Element} Element
|
|
6606
6891
|
*
|
|
6607
6892
|
* @typedef {import('../../core/EventBus').default} EventBus
|
|
6608
6893
|
* @typedef {import('../../draw/Styles').default} Styles
|
|
@@ -6676,7 +6961,7 @@
|
|
|
6676
6961
|
* element and an outline offset.
|
|
6677
6962
|
*
|
|
6678
6963
|
* @param {SVGElement} outline
|
|
6679
|
-
* @param {
|
|
6964
|
+
* @param {Element} element
|
|
6680
6965
|
*/
|
|
6681
6966
|
Outline.prototype.updateShapeOutline = function(outline, element) {
|
|
6682
6967
|
|
|
@@ -6695,7 +6980,7 @@
|
|
|
6695
6980
|
* the connection and an outline offset.
|
|
6696
6981
|
*
|
|
6697
6982
|
* @param {SVGElement} outline
|
|
6698
|
-
* @param {
|
|
6983
|
+
* @param {Element} connection
|
|
6699
6984
|
*/
|
|
6700
6985
|
Outline.prototype.updateConnectionOutline = function(outline, connection) {
|
|
6701
6986
|
|
|
@@ -6713,12 +6998,16 @@
|
|
|
6713
6998
|
|
|
6714
6999
|
Outline.$inject = [ 'eventBus', 'styles', 'elementRegistry' ];
|
|
6715
7000
|
|
|
7001
|
+
/**
|
|
7002
|
+
* @type { import('didi').ModuleDeclaration }
|
|
7003
|
+
*/
|
|
6716
7004
|
var OutlineModule = {
|
|
6717
7005
|
__init__: [ 'outline' ],
|
|
6718
7006
|
outline: [ 'type', Outline ]
|
|
6719
7007
|
};
|
|
6720
7008
|
|
|
6721
7009
|
/**
|
|
7010
|
+
* @typedef {import('../../core/Canvas').default} Canvas
|
|
6722
7011
|
* @typedef {import('../../core/EventBus').default} EventBus
|
|
6723
7012
|
*/
|
|
6724
7013
|
|
|
@@ -6726,15 +7015,17 @@
|
|
|
6726
7015
|
* A service that offers the current selection in a diagram.
|
|
6727
7016
|
* Offers the api to control the selection, too.
|
|
6728
7017
|
*
|
|
6729
|
-
* @class
|
|
6730
|
-
*
|
|
6731
7018
|
* @param {EventBus} eventBus
|
|
7019
|
+
* @param {Canvas} canvas
|
|
6732
7020
|
*/
|
|
6733
7021
|
function Selection(eventBus, canvas) {
|
|
6734
7022
|
|
|
6735
7023
|
this._eventBus = eventBus;
|
|
6736
7024
|
this._canvas = canvas;
|
|
6737
7025
|
|
|
7026
|
+
/**
|
|
7027
|
+
* @type {Object[]}
|
|
7028
|
+
*/
|
|
6738
7029
|
this._selectedElements = [];
|
|
6739
7030
|
|
|
6740
7031
|
var self = this;
|
|
@@ -6751,7 +7042,11 @@
|
|
|
6751
7042
|
|
|
6752
7043
|
Selection.$inject = [ 'eventBus', 'canvas' ];
|
|
6753
7044
|
|
|
6754
|
-
|
|
7045
|
+
/**
|
|
7046
|
+
* Deselect an element.
|
|
7047
|
+
*
|
|
7048
|
+
* @param {Object} element The element to deselect.
|
|
7049
|
+
*/
|
|
6755
7050
|
Selection.prototype.deselect = function(element) {
|
|
6756
7051
|
var selectedElements = this._selectedElements;
|
|
6757
7052
|
|
|
@@ -6766,26 +7061,33 @@
|
|
|
6766
7061
|
}
|
|
6767
7062
|
};
|
|
6768
7063
|
|
|
6769
|
-
|
|
7064
|
+
/**
|
|
7065
|
+
* Get the selected elements.
|
|
7066
|
+
*
|
|
7067
|
+
* @return {Object[]} The selected elements.
|
|
7068
|
+
*/
|
|
6770
7069
|
Selection.prototype.get = function() {
|
|
6771
7070
|
return this._selectedElements;
|
|
6772
7071
|
};
|
|
6773
7072
|
|
|
7073
|
+
/**
|
|
7074
|
+
* Check whether an element is selected.
|
|
7075
|
+
*
|
|
7076
|
+
* @param {Object} element The element.
|
|
7077
|
+
*
|
|
7078
|
+
* @return {boolean} Whether the element is selected.
|
|
7079
|
+
*/
|
|
6774
7080
|
Selection.prototype.isSelected = function(element) {
|
|
6775
7081
|
return this._selectedElements.indexOf(element) !== -1;
|
|
6776
7082
|
};
|
|
6777
7083
|
|
|
6778
7084
|
|
|
6779
7085
|
/**
|
|
6780
|
-
*
|
|
7086
|
+
* Select one or many elements.
|
|
6781
7087
|
*
|
|
6782
|
-
*
|
|
6783
|
-
*
|
|
6784
|
-
*
|
|
6785
|
-
* @method Selection#select
|
|
6786
|
-
*
|
|
6787
|
-
* @param {Object|Object[]} elements element or array of elements to be selected
|
|
6788
|
-
* @param {boolean} [add] whether the element(s) should be appended to the current selection, defaults to false
|
|
7088
|
+
* @param {Object|Object[]} elements The element(s) to select.
|
|
7089
|
+
* @param {boolean} [add] Whether to add the element(s) to the selected elements.
|
|
7090
|
+
* Defaults to `false`.
|
|
6789
7091
|
*/
|
|
6790
7092
|
Selection.prototype.select = function(elements, add) {
|
|
6791
7093
|
var selectedElements = this._selectedElements,
|
|
@@ -7071,6 +7373,9 @@
|
|
|
7071
7373
|
return !element.hidden;
|
|
7072
7374
|
}
|
|
7073
7375
|
|
|
7376
|
+
/**
|
|
7377
|
+
* @type { import('didi').ModuleDeclaration }
|
|
7378
|
+
*/
|
|
7074
7379
|
var SelectionModule = {
|
|
7075
7380
|
__init__: [ 'selectionVisuals', 'selectionBehavior' ],
|
|
7076
7381
|
__depends__: [
|
|
@@ -7101,7 +7406,7 @@
|
|
|
7101
7406
|
/**
|
|
7102
7407
|
* Returns a next unique ID.
|
|
7103
7408
|
*
|
|
7104
|
-
* @
|
|
7409
|
+
* @return {string} the id
|
|
7105
7410
|
*/
|
|
7106
7411
|
IdGenerator.prototype.next = function() {
|
|
7107
7412
|
return this._prefix + (++this._counter);
|
|
@@ -7117,12 +7422,54 @@
|
|
|
7117
7422
|
* @typedef {import('../../core/ElementRegistry').default} ElementRegistry
|
|
7118
7423
|
* @typedef {import('../../core/EventBus').default} EventBus
|
|
7119
7424
|
*
|
|
7120
|
-
* @typedef {import('
|
|
7121
|
-
*
|
|
7122
|
-
* @typedef {
|
|
7123
|
-
*
|
|
7124
|
-
*
|
|
7125
|
-
*
|
|
7425
|
+
* @typedef {import('../../model/Types').Element} Element
|
|
7426
|
+
*
|
|
7427
|
+
* @typedef { {
|
|
7428
|
+
* minZoom?: number,
|
|
7429
|
+
* maxZoom?: number
|
|
7430
|
+
* } } OverlaysConfigShow
|
|
7431
|
+
*
|
|
7432
|
+
* @typedef { {
|
|
7433
|
+
* min?: number,
|
|
7434
|
+
* max?: number
|
|
7435
|
+
* } } OverlaysConfigScale
|
|
7436
|
+
*
|
|
7437
|
+
* @typedef { {
|
|
7438
|
+
* id: string,
|
|
7439
|
+
* type: string | null,
|
|
7440
|
+
* element: Element | string
|
|
7441
|
+
* } & OverlayAttrs } Overlay
|
|
7442
|
+
*
|
|
7443
|
+
* @typedef { {
|
|
7444
|
+
* html: HTMLElement | string,
|
|
7445
|
+
* position: {
|
|
7446
|
+
* top?: number,
|
|
7447
|
+
* right?: number,
|
|
7448
|
+
* bottom?: number,
|
|
7449
|
+
* left?: number
|
|
7450
|
+
* }
|
|
7451
|
+
* } & OverlaysConfigDefault } OverlayAttrs
|
|
7452
|
+
*
|
|
7453
|
+
* @typedef { {
|
|
7454
|
+
* html: HTMLElement,
|
|
7455
|
+
* element: Element,
|
|
7456
|
+
* overlays: Overlay[]
|
|
7457
|
+
* } } OverlayContainer
|
|
7458
|
+
*
|
|
7459
|
+
* @typedef {{
|
|
7460
|
+
* defaults?: OverlaysConfigDefault
|
|
7461
|
+
* }} OverlaysConfig
|
|
7462
|
+
*
|
|
7463
|
+
* @typedef { {
|
|
7464
|
+
* show?: OverlaysConfigShow,
|
|
7465
|
+
* scale?: OverlaysConfigScale | boolean
|
|
7466
|
+
* } } OverlaysConfigDefault
|
|
7467
|
+
*
|
|
7468
|
+
* @typedef { {
|
|
7469
|
+
* id?: string;
|
|
7470
|
+
* element?: Element | string;
|
|
7471
|
+
* type?: string;
|
|
7472
|
+
* } | string } OverlaysFilter
|
|
7126
7473
|
*/
|
|
7127
7474
|
|
|
7128
7475
|
/**
|
|
@@ -7132,6 +7479,7 @@
|
|
|
7132
7479
|
*
|
|
7133
7480
|
* @example
|
|
7134
7481
|
*
|
|
7482
|
+
* ```javascript
|
|
7135
7483
|
* // add a pink badge on the top left of the shape
|
|
7136
7484
|
*
|
|
7137
7485
|
* overlays.add(someShape, {
|
|
@@ -7161,8 +7509,9 @@
|
|
|
7161
7509
|
* }
|
|
7162
7510
|
* html: '<div style="width: 10px; background: fuchsia; color: white;">0</div>'
|
|
7163
7511
|
* });
|
|
7512
|
+
* ```
|
|
7164
7513
|
*
|
|
7165
|
-
*
|
|
7514
|
+
* ```javascript
|
|
7166
7515
|
* // remove an overlay
|
|
7167
7516
|
*
|
|
7168
7517
|
* var id = overlays.add(...);
|
|
@@ -7184,6 +7533,7 @@
|
|
|
7184
7533
|
* }
|
|
7185
7534
|
* }
|
|
7186
7535
|
* }
|
|
7536
|
+
* ```
|
|
7187
7537
|
*
|
|
7188
7538
|
* @param {OverlaysConfig} config
|
|
7189
7539
|
* @param {EventBus} eventBus
|
|
@@ -7242,6 +7592,7 @@
|
|
|
7242
7592
|
*
|
|
7243
7593
|
* @example
|
|
7244
7594
|
*
|
|
7595
|
+
* ```javascript
|
|
7245
7596
|
* // return the single overlay with the given ID
|
|
7246
7597
|
* overlays.get('some-id');
|
|
7247
7598
|
*
|
|
@@ -7253,6 +7604,7 @@
|
|
|
7253
7604
|
*
|
|
7254
7605
|
* // shape can also be specified as ID
|
|
7255
7606
|
* overlays.get({ element: 'element-id', type: 'badge' });
|
|
7607
|
+
* ```
|
|
7256
7608
|
*
|
|
7257
7609
|
* @param {OverlaysFilter} search The filter to be used to find the overlay(s).
|
|
7258
7610
|
*
|
|
@@ -7290,7 +7642,7 @@
|
|
|
7290
7642
|
/**
|
|
7291
7643
|
* Adds an HTML overlay to an element.
|
|
7292
7644
|
*
|
|
7293
|
-
* @param {
|
|
7645
|
+
* @param {Element|string} element The element to add the overlay to.
|
|
7294
7646
|
* @param {string} [type] An optional type that can be used to filter.
|
|
7295
7647
|
* @param {OverlayAttrs} overlay The overlay.
|
|
7296
7648
|
*
|
|
@@ -7378,7 +7730,7 @@
|
|
|
7378
7730
|
/**
|
|
7379
7731
|
* Checks whether overlays are shown.
|
|
7380
7732
|
*
|
|
7381
|
-
* @
|
|
7733
|
+
* @return {boolean} Whether overlays are shown.
|
|
7382
7734
|
*/
|
|
7383
7735
|
Overlays.prototype.isShown = function() {
|
|
7384
7736
|
return this._overlayRoot.style.display !== 'none';
|
|
@@ -7771,6 +8123,9 @@
|
|
|
7771
8123
|
});
|
|
7772
8124
|
}
|
|
7773
8125
|
|
|
8126
|
+
/**
|
|
8127
|
+
* @type { import('didi').ModuleDeclaration }
|
|
8128
|
+
*/
|
|
7774
8129
|
var OverlaysModule = {
|
|
7775
8130
|
__init__: [ 'overlays' ],
|
|
7776
8131
|
overlays: [ 'type', Overlays ]
|
|
@@ -7847,15 +8202,22 @@
|
|
|
7847
8202
|
'graphicsFactory'
|
|
7848
8203
|
];
|
|
7849
8204
|
|
|
8205
|
+
/**
|
|
8206
|
+
* @type { import('didi').ModuleDeclaration }
|
|
8207
|
+
*/
|
|
7850
8208
|
var ChangeSupportModule = {
|
|
7851
8209
|
__init__: [ 'changeSupport' ],
|
|
7852
8210
|
changeSupport: [ 'type', ChangeSupport ]
|
|
7853
8211
|
};
|
|
7854
8212
|
|
|
7855
8213
|
/**
|
|
8214
|
+
* @typedef {import('../core/Types').ElementLike} ElementLike
|
|
7856
8215
|
* @typedef {import('../core/EventBus').default} EventBus
|
|
7857
|
-
* @typedef {import(./
|
|
7858
|
-
*
|
|
8216
|
+
* @typedef {import('./CommandStack').CommandContext} CommandContext
|
|
8217
|
+
*
|
|
8218
|
+
* @typedef {string|string[]} Events
|
|
8219
|
+
* @typedef { (context: CommandContext) => ElementLike[] | void } HandlerFunction
|
|
8220
|
+
* @typedef { (context: CommandContext) => void } ComposeHandlerFunction
|
|
7859
8221
|
*/
|
|
7860
8222
|
|
|
7861
8223
|
var DEFAULT_PRIORITY$1 = 1000;
|
|
@@ -7867,10 +8229,9 @@
|
|
|
7867
8229
|
* @class
|
|
7868
8230
|
* @constructor
|
|
7869
8231
|
*
|
|
7870
|
-
* @param {EventBus} eventBus
|
|
7871
|
-
*
|
|
7872
8232
|
* @example
|
|
7873
8233
|
*
|
|
8234
|
+
* ```javascript
|
|
7874
8235
|
* import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
7875
8236
|
*
|
|
7876
8237
|
* class CommandLogger extends CommandInterceptor {
|
|
@@ -7881,6 +8242,9 @@
|
|
|
7881
8242
|
* console.log('commandStack.shape-create.preExecute', event);
|
|
7882
8243
|
* });
|
|
7883
8244
|
* }
|
|
8245
|
+
* ```
|
|
8246
|
+
*
|
|
8247
|
+
* @param {EventBus} eventBus
|
|
7884
8248
|
*/
|
|
7885
8249
|
function CommandInterceptor(eventBus) {
|
|
7886
8250
|
|
|
@@ -7898,16 +8262,17 @@
|
|
|
7898
8262
|
};
|
|
7899
8263
|
}
|
|
7900
8264
|
|
|
8265
|
+
|
|
7901
8266
|
/**
|
|
7902
|
-
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
|
|
8267
|
+
* Intercept a command during one of the phases.
|
|
8268
|
+
*
|
|
8269
|
+
* @param {Events} [events] command(s) to intercept
|
|
8270
|
+
* @param {string} [hook] phase to intercept
|
|
8271
|
+
* @param {number} [priority]
|
|
8272
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8273
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8274
|
+
* @param {any} [that]
|
|
8275
|
+
*/
|
|
7911
8276
|
CommandInterceptor.prototype.on = function(events, hook, priority, handlerFn, unwrap, that) {
|
|
7912
8277
|
|
|
7913
8278
|
if (isFunction(hook) || isNumber(hook)) {
|
|
@@ -7949,35 +8314,130 @@
|
|
|
7949
8314
|
});
|
|
7950
8315
|
};
|
|
7951
8316
|
|
|
8317
|
+
/**
|
|
8318
|
+
* Add a <canExecute> phase of command interceptor.
|
|
8319
|
+
*
|
|
8320
|
+
* @param {Events} [events] command(s) to intercept
|
|
8321
|
+
* @param {number} [priority]
|
|
8322
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8323
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8324
|
+
* @param {any} [that]
|
|
8325
|
+
*/
|
|
8326
|
+
CommandInterceptor.prototype.canExecute = createHook('canExecute');
|
|
7952
8327
|
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
8328
|
+
/**
|
|
8329
|
+
* Add a <preExecute> phase of command interceptor.
|
|
8330
|
+
*
|
|
8331
|
+
* @param {Events} [events] command(s) to intercept
|
|
8332
|
+
* @param {number} [priority]
|
|
8333
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8334
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8335
|
+
* @param {any} [that]
|
|
8336
|
+
*/
|
|
8337
|
+
CommandInterceptor.prototype.preExecute = createHook('preExecute');
|
|
8338
|
+
|
|
8339
|
+
/**
|
|
8340
|
+
* Add a <preExecuted> phase of command interceptor.
|
|
8341
|
+
*
|
|
8342
|
+
* @param {Events} [events] command(s) to intercept
|
|
8343
|
+
* @param {number} [priority]
|
|
8344
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8345
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8346
|
+
* @param {any} [that]
|
|
8347
|
+
*/
|
|
8348
|
+
CommandInterceptor.prototype.preExecuted = createHook('preExecuted');
|
|
8349
|
+
|
|
8350
|
+
/**
|
|
8351
|
+
* Add a <execute> phase of command interceptor.
|
|
8352
|
+
*
|
|
8353
|
+
* @param {Events} [events] command(s) to intercept
|
|
8354
|
+
* @param {number} [priority]
|
|
8355
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8356
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8357
|
+
* @param {any} [that]
|
|
8358
|
+
*/
|
|
8359
|
+
CommandInterceptor.prototype.execute = createHook('execute');
|
|
8360
|
+
|
|
8361
|
+
/**
|
|
8362
|
+
* Add a <executed> phase of command interceptor.
|
|
8363
|
+
*
|
|
8364
|
+
* @param {Events} [events] command(s) to intercept
|
|
8365
|
+
* @param {number} [priority]
|
|
8366
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8367
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8368
|
+
* @param {any} [that]
|
|
8369
|
+
*/
|
|
8370
|
+
CommandInterceptor.prototype.executed = createHook('executed');
|
|
8371
|
+
|
|
8372
|
+
/**
|
|
8373
|
+
* Add a <postExecute> phase of command interceptor.
|
|
8374
|
+
*
|
|
8375
|
+
* @param {Events} [events] command(s) to intercept
|
|
8376
|
+
* @param {number} [priority]
|
|
8377
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8378
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8379
|
+
* @param {any} [that]
|
|
8380
|
+
*/
|
|
8381
|
+
CommandInterceptor.prototype.postExecute = createHook('postExecute');
|
|
8382
|
+
|
|
8383
|
+
/**
|
|
8384
|
+
* Add a <postExecuted> phase of command interceptor.
|
|
8385
|
+
*
|
|
8386
|
+
* @param {Events} [events] command(s) to intercept
|
|
8387
|
+
* @param {number} [priority]
|
|
8388
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8389
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8390
|
+
* @param {any} [that]
|
|
8391
|
+
*/
|
|
8392
|
+
CommandInterceptor.prototype.postExecuted = createHook('postExecuted');
|
|
8393
|
+
|
|
8394
|
+
/**
|
|
8395
|
+
* Add a <revert> phase of command interceptor.
|
|
8396
|
+
*
|
|
8397
|
+
* @param {Events} [events] command(s) to intercept
|
|
8398
|
+
* @param {number} [priority]
|
|
8399
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8400
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8401
|
+
* @param {any} [that]
|
|
8402
|
+
*/
|
|
8403
|
+
CommandInterceptor.prototype.revert = createHook('revert');
|
|
8404
|
+
|
|
8405
|
+
/**
|
|
8406
|
+
* Add a <reverted> phase of command interceptor.
|
|
8407
|
+
*
|
|
8408
|
+
* @param {Events} [events] command(s) to intercept
|
|
8409
|
+
* @param {number} [priority]
|
|
8410
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8411
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8412
|
+
* @param {any} [that]
|
|
8413
|
+
*/
|
|
8414
|
+
CommandInterceptor.prototype.reverted = createHook('reverted');
|
|
7964
8415
|
|
|
7965
8416
|
/*
|
|
7966
8417
|
* Add prototype methods for each phase of command execution (e.g. execute,
|
|
7967
8418
|
* revert).
|
|
8419
|
+
*
|
|
8420
|
+
* @param {string} hook
|
|
8421
|
+
*
|
|
8422
|
+
* @return { (
|
|
8423
|
+
* events?: Events,
|
|
8424
|
+
* priority?: number,
|
|
8425
|
+
* handlerFn: ComposeHandlerFunction|HandlerFunction,
|
|
8426
|
+
* unwrap?: boolean
|
|
8427
|
+
* ) => any }
|
|
7968
8428
|
*/
|
|
7969
|
-
|
|
8429
|
+
function createHook(hook) {
|
|
7970
8430
|
|
|
7971
8431
|
/**
|
|
7972
|
-
*
|
|
8432
|
+
* @this {CommandInterceptor}
|
|
7973
8433
|
*
|
|
7974
|
-
* @param {
|
|
7975
|
-
* @param {number} [priority]
|
|
7976
|
-
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
7977
|
-
* @param {boolean} [unwrap]
|
|
7978
|
-
* @param {
|
|
8434
|
+
* @param {Events} [events]
|
|
8435
|
+
* @param {number} [priority]
|
|
8436
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8437
|
+
* @param {boolean} [unwrap]
|
|
8438
|
+
* @param {any} [that]
|
|
7979
8439
|
*/
|
|
7980
|
-
|
|
8440
|
+
const hookFn = function(events, priority, handlerFn, unwrap, that) {
|
|
7981
8441
|
|
|
7982
8442
|
if (isFunction(events) || isNumber(events)) {
|
|
7983
8443
|
that = unwrap;
|
|
@@ -7989,7 +8449,9 @@
|
|
|
7989
8449
|
|
|
7990
8450
|
this.on(events, hook, priority, handlerFn, unwrap, that);
|
|
7991
8451
|
};
|
|
7992
|
-
|
|
8452
|
+
|
|
8453
|
+
return hookFn;
|
|
8454
|
+
}
|
|
7993
8455
|
|
|
7994
8456
|
/**
|
|
7995
8457
|
* @typedef {import('didi').Injector} Injector
|
|
@@ -8031,6 +8493,9 @@
|
|
|
8031
8493
|
|
|
8032
8494
|
RootElementsBehavior.$inject = [ 'canvas', 'injector' ];
|
|
8033
8495
|
|
|
8496
|
+
/**
|
|
8497
|
+
* @type { import('didi').ModuleDeclaration }
|
|
8498
|
+
*/
|
|
8034
8499
|
var RootElementsModule = {
|
|
8035
8500
|
__init__: [ 'rootElementsBehavior' ],
|
|
8036
8501
|
rootElementsBehavior: [ 'type', RootElementsBehavior ]
|
|
@@ -8038,7 +8503,7 @@
|
|
|
8038
8503
|
|
|
8039
8504
|
/**
|
|
8040
8505
|
* @param {string} str
|
|
8041
|
-
* @
|
|
8506
|
+
* @return {string}
|
|
8042
8507
|
*/
|
|
8043
8508
|
|
|
8044
8509
|
var HTML_ESCAPE_MAP = {
|
|
@@ -8057,14 +8522,19 @@
|
|
|
8057
8522
|
});
|
|
8058
8523
|
}
|
|
8059
8524
|
|
|
8525
|
+
/**
|
|
8526
|
+
* @typedef {import('../model/Types').Element} Element
|
|
8527
|
+
* @typedef {import('../model/Types').ModdleElement} ModdleElement
|
|
8528
|
+
*/
|
|
8529
|
+
|
|
8060
8530
|
var planeSuffix = '_plane';
|
|
8061
8531
|
|
|
8062
8532
|
/**
|
|
8063
8533
|
* Get plane ID for a primary shape.
|
|
8064
8534
|
*
|
|
8065
|
-
* @param {
|
|
8535
|
+
* @param {Element|ModdleElement} element
|
|
8066
8536
|
*
|
|
8067
|
-
* @
|
|
8537
|
+
* @return {string}
|
|
8068
8538
|
*/
|
|
8069
8539
|
function getPlaneIdFromShape(element) {
|
|
8070
8540
|
var id = element.id;
|
|
@@ -8080,32 +8550,40 @@
|
|
|
8080
8550
|
return id + planeSuffix;
|
|
8081
8551
|
}
|
|
8082
8552
|
|
|
8553
|
+
/**
|
|
8554
|
+
* @typedef {import('diagram-js/lib/core/Canvas').default} Canvas
|
|
8555
|
+
* @typedef {import('diagram-js/lib/core/ElementRegistry').default} ElementRegistry
|
|
8556
|
+
* @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
|
|
8557
|
+
*
|
|
8558
|
+
* @typedef {import('../../model/Types').Element} Element
|
|
8559
|
+
* @typedef {import('../../model/Types').Shape} Shape
|
|
8560
|
+
*/
|
|
8561
|
+
|
|
8083
8562
|
var OPEN_CLASS = 'bjs-breadcrumbs-shown';
|
|
8084
8563
|
|
|
8085
8564
|
|
|
8086
8565
|
/**
|
|
8087
8566
|
* Adds overlays that allow switching planes on collapsed subprocesses.
|
|
8088
8567
|
*
|
|
8089
|
-
* @param {
|
|
8090
|
-
* @param {
|
|
8091
|
-
* @param {
|
|
8092
|
-
* @param {canvas} canvas
|
|
8568
|
+
* @param {EventBus} eventBus
|
|
8569
|
+
* @param {ElementRegistry} elementRegistry
|
|
8570
|
+
* @param {Canvas} canvas
|
|
8093
8571
|
*/
|
|
8094
|
-
function DrilldownBreadcrumbs(eventBus, elementRegistry,
|
|
8572
|
+
function DrilldownBreadcrumbs(eventBus, elementRegistry, canvas) {
|
|
8095
8573
|
var breadcrumbs = domify$1('<ul class="bjs-breadcrumbs"></ul>');
|
|
8096
8574
|
var container = canvas.getContainer();
|
|
8097
8575
|
var containerClasses = classes(container);
|
|
8098
8576
|
container.appendChild(breadcrumbs);
|
|
8099
8577
|
|
|
8100
|
-
var
|
|
8578
|
+
var businessObjectParents = [];
|
|
8101
8579
|
|
|
8102
8580
|
// update breadcrumbs if name or ID of the primary shape changes
|
|
8103
|
-
eventBus.on('element.changed', function(
|
|
8104
|
-
var shape =
|
|
8105
|
-
|
|
8581
|
+
eventBus.on('element.changed', function(event) {
|
|
8582
|
+
var shape = event.element,
|
|
8583
|
+
businessObject = getBusinessObject(shape);
|
|
8106
8584
|
|
|
8107
|
-
var isPresent = find(
|
|
8108
|
-
return
|
|
8585
|
+
var isPresent = find(businessObjectParents, function(element) {
|
|
8586
|
+
return element === businessObject;
|
|
8109
8587
|
});
|
|
8110
8588
|
|
|
8111
8589
|
if (!isPresent) {
|
|
@@ -8119,14 +8597,14 @@
|
|
|
8119
8597
|
* Updates the displayed breadcrumbs. If no element is provided, only the
|
|
8120
8598
|
* labels are updated.
|
|
8121
8599
|
*
|
|
8122
|
-
* @param {
|
|
8600
|
+
* @param {Element} [element]
|
|
8123
8601
|
*/
|
|
8124
8602
|
function updateBreadcrumbs(element) {
|
|
8125
8603
|
if (element) {
|
|
8126
|
-
|
|
8604
|
+
businessObjectParents = getBusinessObjectParentChain(element);
|
|
8127
8605
|
}
|
|
8128
8606
|
|
|
8129
|
-
var path =
|
|
8607
|
+
var path = businessObjectParents.map(function(parent) {
|
|
8130
8608
|
var title = escapeHTML(parent.name || parent.id);
|
|
8131
8609
|
var link = domify$1('<li><span class="bjs-crumb"><a title="' + title + '">' + title + '</a></span></li>');
|
|
8132
8610
|
|
|
@@ -8136,8 +8614,9 @@
|
|
|
8136
8614
|
// element in the elementRegisty. Instead, we search for the corresponding participant
|
|
8137
8615
|
if (!parentPlane && is$1(parent, 'bpmn:Process')) {
|
|
8138
8616
|
var participant = elementRegistry.find(function(element) {
|
|
8139
|
-
var
|
|
8140
|
-
|
|
8617
|
+
var businessObject = getBusinessObject(element);
|
|
8618
|
+
|
|
8619
|
+
return businessObject && businessObject.get('processRef') && businessObject.get('processRef') === parent;
|
|
8141
8620
|
});
|
|
8142
8621
|
|
|
8143
8622
|
parentPlane = canvas.findRoot(participant.id);
|
|
@@ -8154,10 +8633,11 @@
|
|
|
8154
8633
|
|
|
8155
8634
|
// show breadcrumbs and expose state to .djs-container
|
|
8156
8635
|
var visible = path.length > 1;
|
|
8636
|
+
|
|
8157
8637
|
containerClasses.toggle(OPEN_CLASS, visible);
|
|
8158
8638
|
|
|
8159
|
-
path.forEach(function(
|
|
8160
|
-
breadcrumbs.appendChild(
|
|
8639
|
+
path.forEach(function(element) {
|
|
8640
|
+
breadcrumbs.appendChild(element);
|
|
8161
8641
|
});
|
|
8162
8642
|
}
|
|
8163
8643
|
|
|
@@ -8167,7 +8647,7 @@
|
|
|
8167
8647
|
|
|
8168
8648
|
}
|
|
8169
8649
|
|
|
8170
|
-
DrilldownBreadcrumbs.$inject = [ 'eventBus', 'elementRegistry', '
|
|
8650
|
+
DrilldownBreadcrumbs.$inject = [ 'eventBus', 'elementRegistry', 'canvas' ];
|
|
8171
8651
|
|
|
8172
8652
|
|
|
8173
8653
|
// helpers //////////
|
|
@@ -8176,16 +8656,16 @@
|
|
|
8176
8656
|
* Returns the parents for the element using the business object chain,
|
|
8177
8657
|
* starting with the root element.
|
|
8178
8658
|
*
|
|
8179
|
-
* @param {
|
|
8659
|
+
* @param {Shape} child
|
|
8180
8660
|
*
|
|
8181
|
-
* @
|
|
8661
|
+
* @return {Shape}
|
|
8182
8662
|
*/
|
|
8183
|
-
function
|
|
8184
|
-
var
|
|
8663
|
+
function getBusinessObjectParentChain(child) {
|
|
8664
|
+
var businessObject = getBusinessObject(child);
|
|
8185
8665
|
|
|
8186
8666
|
var parents = [];
|
|
8187
8667
|
|
|
8188
|
-
for (var element =
|
|
8668
|
+
for (var element = businessObject; element; element = element.$parent) {
|
|
8189
8669
|
if (is$1(element, 'bpmn:SubProcess') || is$1(element, 'bpmn:Process')) {
|
|
8190
8670
|
parents.push(element);
|
|
8191
8671
|
}
|
|
@@ -8194,13 +8674,18 @@
|
|
|
8194
8674
|
return parents.reverse();
|
|
8195
8675
|
}
|
|
8196
8676
|
|
|
8677
|
+
/**
|
|
8678
|
+
* @typedef {import('diagram-js/lib/core/Canvas').default} Canvas
|
|
8679
|
+
* @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
|
|
8680
|
+
*/
|
|
8681
|
+
|
|
8197
8682
|
/**
|
|
8198
8683
|
* Move collapsed subprocesses into view when drilling down.
|
|
8199
8684
|
*
|
|
8200
8685
|
* Zoom and scroll are saved in a session.
|
|
8201
8686
|
*
|
|
8202
|
-
* @param {
|
|
8203
|
-
* @param {
|
|
8687
|
+
* @param {EventBus} eventBus
|
|
8688
|
+
* @param {Canvas} canvas
|
|
8204
8689
|
*/
|
|
8205
8690
|
function DrilldownCentering(eventBus, canvas) {
|
|
8206
8691
|
|
|
@@ -8311,6 +8796,18 @@
|
|
|
8311
8796
|
};
|
|
8312
8797
|
}
|
|
8313
8798
|
|
|
8799
|
+
/**
|
|
8800
|
+
* @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
|
|
8801
|
+
* @typedef {import('../../model/Types').Moddle} Moddle
|
|
8802
|
+
*
|
|
8803
|
+
* @typedef {import('../../model/Types').Element} Element
|
|
8804
|
+
* @typedef {import('../../model/Types').Shape} Shape
|
|
8805
|
+
*
|
|
8806
|
+
* @typedef {import('diagram-js/lib/core/Canvas').CanvasPlane} CanvasPlane
|
|
8807
|
+
*
|
|
8808
|
+
* @typedef {import('diagram-js/lib/util/Types').Rect} Rect
|
|
8809
|
+
*/
|
|
8810
|
+
|
|
8314
8811
|
var DEFAULT_POSITION = {
|
|
8315
8812
|
x: 180,
|
|
8316
8813
|
y: 160
|
|
@@ -8318,10 +8815,10 @@
|
|
|
8318
8815
|
|
|
8319
8816
|
/**
|
|
8320
8817
|
* Hook into `import.render.start` and create new planes for diagrams with
|
|
8321
|
-
* collapsed subprocesses and all
|
|
8818
|
+
* collapsed subprocesses and all DI elements on the same plane.
|
|
8322
8819
|
*
|
|
8323
|
-
* @param {
|
|
8324
|
-
* @param {
|
|
8820
|
+
* @param {EventBus} eventBus
|
|
8821
|
+
* @param {Moddle} moddle
|
|
8325
8822
|
*/
|
|
8326
8823
|
function SubprocessCompatibility(eventBus, moddle) {
|
|
8327
8824
|
this._eventBus = eventBus;
|
|
@@ -8330,11 +8827,14 @@
|
|
|
8330
8827
|
var self = this;
|
|
8331
8828
|
|
|
8332
8829
|
eventBus.on('import.render.start', 1500, function(e, context) {
|
|
8333
|
-
self.
|
|
8830
|
+
self._handleImport(context.definitions);
|
|
8334
8831
|
});
|
|
8335
8832
|
}
|
|
8336
8833
|
|
|
8337
|
-
|
|
8834
|
+
/**
|
|
8835
|
+
* @param {ModdleElement} definitions
|
|
8836
|
+
*/
|
|
8837
|
+
SubprocessCompatibility.prototype._handleImport = function(definitions) {
|
|
8338
8838
|
if (!definitions.diagrams) {
|
|
8339
8839
|
return;
|
|
8340
8840
|
}
|
|
@@ -8353,12 +8853,12 @@
|
|
|
8353
8853
|
|
|
8354
8854
|
var newDiagrams = [];
|
|
8355
8855
|
definitions.diagrams.forEach(function(diagram) {
|
|
8356
|
-
var createdDiagrams = self.
|
|
8856
|
+
var createdDiagrams = self._createNewDiagrams(diagram.plane);
|
|
8357
8857
|
Array.prototype.push.apply(newDiagrams, createdDiagrams);
|
|
8358
8858
|
});
|
|
8359
8859
|
|
|
8360
8860
|
newDiagrams.forEach(function(diagram) {
|
|
8361
|
-
self.
|
|
8861
|
+
self._movePlaneElementsToOrigin(diagram.plane);
|
|
8362
8862
|
});
|
|
8363
8863
|
};
|
|
8364
8864
|
|
|
@@ -8366,29 +8866,30 @@
|
|
|
8366
8866
|
/**
|
|
8367
8867
|
* Moves all DI elements from collapsed subprocesses to a new plane.
|
|
8368
8868
|
*
|
|
8369
|
-
* @param {
|
|
8370
|
-
*
|
|
8869
|
+
* @param {CanvasPlane} plane
|
|
8870
|
+
*
|
|
8871
|
+
* @return {ModdleElement[]} new diagrams created for the collapsed subprocesses
|
|
8371
8872
|
*/
|
|
8372
|
-
SubprocessCompatibility.prototype.
|
|
8873
|
+
SubprocessCompatibility.prototype._createNewDiagrams = function(plane) {
|
|
8373
8874
|
var self = this;
|
|
8374
8875
|
|
|
8375
8876
|
var collapsedElements = [];
|
|
8376
8877
|
var elementsToMove = [];
|
|
8377
8878
|
|
|
8378
8879
|
plane.get('planeElement').forEach(function(diElement) {
|
|
8379
|
-
var
|
|
8880
|
+
var businessObject = diElement.bpmnElement;
|
|
8380
8881
|
|
|
8381
|
-
if (!
|
|
8882
|
+
if (!businessObject) {
|
|
8382
8883
|
return;
|
|
8383
8884
|
}
|
|
8384
8885
|
|
|
8385
|
-
var parent =
|
|
8886
|
+
var parent = businessObject.$parent;
|
|
8386
8887
|
|
|
8387
|
-
if (is$1(
|
|
8388
|
-
collapsedElements.push(
|
|
8888
|
+
if (is$1(businessObject, 'bpmn:SubProcess') && !diElement.isExpanded) {
|
|
8889
|
+
collapsedElements.push(businessObject);
|
|
8389
8890
|
}
|
|
8390
8891
|
|
|
8391
|
-
if (shouldMoveToPlane(
|
|
8892
|
+
if (shouldMoveToPlane(businessObject, plane)) {
|
|
8392
8893
|
|
|
8393
8894
|
// don't change the array while we iterate over it
|
|
8394
8895
|
elementsToMove.push({ diElement: diElement, parent: parent });
|
|
@@ -8399,9 +8900,11 @@
|
|
|
8399
8900
|
|
|
8400
8901
|
// create new planes for all collapsed subprocesses, even when they are empty
|
|
8401
8902
|
collapsedElements.forEach(function(element) {
|
|
8402
|
-
if (!self._processToDiagramMap[element.id]) {
|
|
8403
|
-
var diagram = self.
|
|
8903
|
+
if (!self._processToDiagramMap[ element.id ]) {
|
|
8904
|
+
var diagram = self._createDiagram(element);
|
|
8905
|
+
|
|
8404
8906
|
self._processToDiagramMap[element.id] = diagram;
|
|
8907
|
+
|
|
8405
8908
|
newDiagrams.push(diagram);
|
|
8406
8909
|
}
|
|
8407
8910
|
});
|
|
@@ -8420,14 +8923,18 @@
|
|
|
8420
8923
|
return;
|
|
8421
8924
|
}
|
|
8422
8925
|
|
|
8423
|
-
var diagram = self._processToDiagramMap[parent.id];
|
|
8424
|
-
|
|
8926
|
+
var diagram = self._processToDiagramMap[ parent.id ];
|
|
8927
|
+
|
|
8928
|
+
self._moveToDiPlane(diElement, diagram.plane);
|
|
8425
8929
|
});
|
|
8426
8930
|
|
|
8427
8931
|
return newDiagrams;
|
|
8428
8932
|
};
|
|
8429
8933
|
|
|
8430
|
-
|
|
8934
|
+
/**
|
|
8935
|
+
* @param {CanvasPlane} plane
|
|
8936
|
+
*/
|
|
8937
|
+
SubprocessCompatibility.prototype._movePlaneElementsToOrigin = function(plane) {
|
|
8431
8938
|
var elements = plane.get('planeElement');
|
|
8432
8939
|
|
|
8433
8940
|
// get bounding box of all elements
|
|
@@ -8451,33 +8958,50 @@
|
|
|
8451
8958
|
});
|
|
8452
8959
|
};
|
|
8453
8960
|
|
|
8454
|
-
|
|
8455
|
-
|
|
8961
|
+
/**
|
|
8962
|
+
* @param {ModdleElement} diElement
|
|
8963
|
+
* @param {CanvasPlane} newPlane
|
|
8964
|
+
*/
|
|
8965
|
+
SubprocessCompatibility.prototype._moveToDiPlane = function(diElement, newPlane) {
|
|
8456
8966
|
var containingDiagram = findRootDiagram(diElement);
|
|
8457
8967
|
|
|
8458
8968
|
// remove DI from old Plane and add it to the new one
|
|
8459
8969
|
var parentPlaneElement = containingDiagram.plane.get('planeElement');
|
|
8970
|
+
|
|
8460
8971
|
parentPlaneElement.splice(parentPlaneElement.indexOf(diElement), 1);
|
|
8972
|
+
|
|
8461
8973
|
newPlane.get('planeElement').push(diElement);
|
|
8462
8974
|
};
|
|
8463
8975
|
|
|
8976
|
+
/**
|
|
8977
|
+
* @param {ModdleElement} businessObject
|
|
8978
|
+
*
|
|
8979
|
+
* @return {ModdleElement}
|
|
8980
|
+
*/
|
|
8981
|
+
SubprocessCompatibility.prototype._createDiagram = function(businessObject) {
|
|
8982
|
+
var plane = this._moddle.create('bpmndi:BPMNPlane', {
|
|
8983
|
+
bpmnElement: businessObject
|
|
8984
|
+
});
|
|
8464
8985
|
|
|
8465
|
-
SubprocessCompatibility.prototype.createDiagram = function(bo) {
|
|
8466
|
-
var plane = this._moddle.create('bpmndi:BPMNPlane', { bpmnElement: bo });
|
|
8467
8986
|
var diagram = this._moddle.create('bpmndi:BPMNDiagram', {
|
|
8468
8987
|
plane: plane
|
|
8469
8988
|
});
|
|
8989
|
+
|
|
8470
8990
|
plane.$parent = diagram;
|
|
8471
|
-
|
|
8991
|
+
|
|
8992
|
+
plane.bpmnElement = businessObject;
|
|
8993
|
+
|
|
8472
8994
|
diagram.$parent = this._definitions;
|
|
8995
|
+
|
|
8473
8996
|
this._definitions.diagrams.push(diagram);
|
|
8997
|
+
|
|
8474
8998
|
return diagram;
|
|
8475
8999
|
};
|
|
8476
9000
|
|
|
8477
9001
|
SubprocessCompatibility.$inject = [ 'eventBus', 'moddle' ];
|
|
8478
9002
|
|
|
8479
9003
|
|
|
8480
|
-
// helpers
|
|
9004
|
+
// helpers //////////
|
|
8481
9005
|
|
|
8482
9006
|
function findRootDiagram(element) {
|
|
8483
9007
|
if (is$1(element, 'bpmndi:BPMNDiagram')) {
|
|
@@ -8487,6 +9011,11 @@
|
|
|
8487
9011
|
}
|
|
8488
9012
|
}
|
|
8489
9013
|
|
|
9014
|
+
/**
|
|
9015
|
+
* @param {CanvasPlane} plane
|
|
9016
|
+
*
|
|
9017
|
+
* @return {Rect}
|
|
9018
|
+
*/
|
|
8490
9019
|
function getPlaneBounds(plane) {
|
|
8491
9020
|
var planeTrbl = {
|
|
8492
9021
|
top: Infinity,
|
|
@@ -8509,8 +9038,14 @@
|
|
|
8509
9038
|
return asBounds(planeTrbl);
|
|
8510
9039
|
}
|
|
8511
9040
|
|
|
8512
|
-
|
|
8513
|
-
|
|
9041
|
+
/**
|
|
9042
|
+
* @param {ModdleElement} businessObject
|
|
9043
|
+
* @param {CanvasPlane} plane
|
|
9044
|
+
*
|
|
9045
|
+
* @return {boolean}
|
|
9046
|
+
*/
|
|
9047
|
+
function shouldMoveToPlane(businessObject, plane) {
|
|
9048
|
+
var parent = businessObject.$parent;
|
|
8514
9049
|
|
|
8515
9050
|
// don't move elements that are already on the plane
|
|
8516
9051
|
if (!is$1(parent, 'bpmn:SubProcess') || parent === plane.bpmnElement) {
|
|
@@ -8519,18 +9054,35 @@
|
|
|
8519
9054
|
|
|
8520
9055
|
// dataAssociations are children of the subprocess but rendered on process level
|
|
8521
9056
|
// cf. https://github.com/bpmn-io/bpmn-js/issues/1619
|
|
8522
|
-
if (isAny(
|
|
9057
|
+
if (isAny(businessObject, [ 'bpmn:DataInputAssociation', 'bpmn:DataOutputAssociation' ])) {
|
|
8523
9058
|
return false;
|
|
8524
9059
|
}
|
|
8525
9060
|
|
|
8526
9061
|
return true;
|
|
8527
9062
|
}
|
|
8528
9063
|
|
|
9064
|
+
/**
|
|
9065
|
+
* @typedef {import('diagram-js/lib/core/Canvas').default} Canvas
|
|
9066
|
+
* @typedef {import('diagram-js/lib/core/ElementRegistry').default} ElementRegistry
|
|
9067
|
+
* @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
|
|
9068
|
+
* @typedef {import('diagram-js/lib/features/overlays/Overlays').default} Overlays
|
|
9069
|
+
*
|
|
9070
|
+
* @typedef {import('../../model/Types').Element} Element
|
|
9071
|
+
* @typedef {import('../../model/Types').Parent} Parent
|
|
9072
|
+
* @typedef {import('../../model/Types').Shape} Shape
|
|
9073
|
+
*/
|
|
9074
|
+
|
|
8529
9075
|
var LOW_PRIORITY = 250;
|
|
8530
9076
|
var ARROW_DOWN_SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.81801948,3.50735931 L10.4996894,9.1896894 L10.5,4 L12,4 L12,12 L4,12 L4,10.5 L9.6896894,10.4996894 L3.75735931,4.56801948 C3.46446609,4.27512627 3.46446609,3.80025253 3.75735931,3.50735931 C4.05025253,3.21446609 4.52512627,3.21446609 4.81801948,3.50735931 Z"/></svg>';
|
|
8531
9077
|
|
|
8532
9078
|
var EMPTY_MARKER = 'bjs-drilldown-empty';
|
|
8533
9079
|
|
|
9080
|
+
/**
|
|
9081
|
+
* @param {Canvas} canvas
|
|
9082
|
+
* @param {EventBus} eventBus
|
|
9083
|
+
* @param {ElementRegistry} elementRegistry
|
|
9084
|
+
* @param {Overlays} overlays
|
|
9085
|
+
*/
|
|
8534
9086
|
function DrilldownOverlayBehavior(
|
|
8535
9087
|
canvas, eventBus, elementRegistry, overlays
|
|
8536
9088
|
) {
|
|
@@ -8547,10 +9099,10 @@
|
|
|
8547
9099
|
var shape = context.shape;
|
|
8548
9100
|
|
|
8549
9101
|
// Add overlay to the collapsed shape
|
|
8550
|
-
if (self.
|
|
8551
|
-
self.
|
|
9102
|
+
if (self._canDrillDown(shape)) {
|
|
9103
|
+
self._addOverlay(shape);
|
|
8552
9104
|
} else {
|
|
8553
|
-
self.
|
|
9105
|
+
self._removeOverlay(shape);
|
|
8554
9106
|
}
|
|
8555
9107
|
}, true);
|
|
8556
9108
|
|
|
@@ -8559,10 +9111,10 @@
|
|
|
8559
9111
|
var shape = context.shape;
|
|
8560
9112
|
|
|
8561
9113
|
// Add overlay to the collapsed shape
|
|
8562
|
-
if (self.
|
|
8563
|
-
self.
|
|
9114
|
+
if (self._canDrillDown(shape)) {
|
|
9115
|
+
self._addOverlay(shape);
|
|
8564
9116
|
} else {
|
|
8565
|
-
self.
|
|
9117
|
+
self._removeOverlay(shape);
|
|
8566
9118
|
}
|
|
8567
9119
|
}, true);
|
|
8568
9120
|
|
|
@@ -8574,13 +9126,13 @@
|
|
|
8574
9126
|
shape = context.shape;
|
|
8575
9127
|
|
|
8576
9128
|
// Add overlay to the collapsed shape
|
|
8577
|
-
if (self.
|
|
8578
|
-
self.
|
|
9129
|
+
if (self._canDrillDown(shape)) {
|
|
9130
|
+
self._addOverlay(shape);
|
|
8579
9131
|
}
|
|
8580
9132
|
|
|
8581
|
-
self.
|
|
8582
|
-
self.
|
|
8583
|
-
self.
|
|
9133
|
+
self._updateDrilldownOverlay(oldParent);
|
|
9134
|
+
self._updateDrilldownOverlay(newParent);
|
|
9135
|
+
self._updateDrilldownOverlay(shape);
|
|
8584
9136
|
}, true);
|
|
8585
9137
|
|
|
8586
9138
|
|
|
@@ -8591,21 +9143,21 @@
|
|
|
8591
9143
|
shape = context.shape;
|
|
8592
9144
|
|
|
8593
9145
|
// Add overlay to the collapsed shape
|
|
8594
|
-
if (self.
|
|
8595
|
-
self.
|
|
9146
|
+
if (self._canDrillDown(shape)) {
|
|
9147
|
+
self._addOverlay(shape);
|
|
8596
9148
|
}
|
|
8597
9149
|
|
|
8598
|
-
self.
|
|
8599
|
-
self.
|
|
8600
|
-
self.
|
|
9150
|
+
self._updateDrilldownOverlay(oldParent);
|
|
9151
|
+
self._updateDrilldownOverlay(newParent);
|
|
9152
|
+
self._updateDrilldownOverlay(shape);
|
|
8601
9153
|
}, true);
|
|
8602
9154
|
|
|
8603
9155
|
|
|
8604
9156
|
eventBus.on('import.render.complete', function() {
|
|
8605
9157
|
elementRegistry.filter(function(e) {
|
|
8606
|
-
return self.
|
|
9158
|
+
return self._canDrillDown(e);
|
|
8607
9159
|
}).map(function(el) {
|
|
8608
|
-
self.
|
|
9160
|
+
self._addOverlay(el);
|
|
8609
9161
|
});
|
|
8610
9162
|
});
|
|
8611
9163
|
|
|
@@ -8613,7 +9165,10 @@
|
|
|
8613
9165
|
|
|
8614
9166
|
e(DrilldownOverlayBehavior, CommandInterceptor);
|
|
8615
9167
|
|
|
8616
|
-
|
|
9168
|
+
/**
|
|
9169
|
+
* @param {Shape} shape
|
|
9170
|
+
*/
|
|
9171
|
+
DrilldownOverlayBehavior.prototype._updateDrilldownOverlay = function(shape) {
|
|
8617
9172
|
var canvas = this._canvas;
|
|
8618
9173
|
|
|
8619
9174
|
if (!shape) {
|
|
@@ -8621,51 +9176,61 @@
|
|
|
8621
9176
|
}
|
|
8622
9177
|
|
|
8623
9178
|
var root = canvas.findRoot(shape);
|
|
9179
|
+
|
|
8624
9180
|
if (root) {
|
|
8625
|
-
this.
|
|
9181
|
+
this._updateOverlayVisibility(root);
|
|
8626
9182
|
}
|
|
8627
9183
|
};
|
|
8628
9184
|
|
|
8629
|
-
|
|
8630
|
-
|
|
9185
|
+
/**
|
|
9186
|
+
* @param {Element} element
|
|
9187
|
+
*
|
|
9188
|
+
* @return {boolean}
|
|
9189
|
+
*/
|
|
9190
|
+
DrilldownOverlayBehavior.prototype._canDrillDown = function(element) {
|
|
8631
9191
|
var canvas = this._canvas;
|
|
9192
|
+
|
|
8632
9193
|
return is$1(element, 'bpmn:SubProcess') && canvas.findRoot(getPlaneIdFromShape(element));
|
|
8633
9194
|
};
|
|
8634
9195
|
|
|
8635
9196
|
/**
|
|
8636
|
-
*
|
|
8637
|
-
* the drilldown will be
|
|
9197
|
+
* Update the visibility of the drilldown overlay. If the plane has no elements,
|
|
9198
|
+
* the drilldown will only be shown when the element is selected.
|
|
8638
9199
|
*
|
|
8639
|
-
* @param {
|
|
9200
|
+
* @param {Parent} element The collapsed root or shape.
|
|
8640
9201
|
*/
|
|
8641
|
-
DrilldownOverlayBehavior.prototype.
|
|
9202
|
+
DrilldownOverlayBehavior.prototype._updateOverlayVisibility = function(element) {
|
|
8642
9203
|
var overlays = this._overlays;
|
|
8643
9204
|
|
|
8644
|
-
var
|
|
9205
|
+
var businessObject = getBusinessObject(element);
|
|
8645
9206
|
|
|
8646
|
-
var overlay = overlays.get({ element:
|
|
9207
|
+
var overlay = overlays.get({ element: businessObject.id, type: 'drilldown' })[0];
|
|
8647
9208
|
|
|
8648
9209
|
if (!overlay) {
|
|
8649
9210
|
return;
|
|
8650
9211
|
}
|
|
8651
9212
|
|
|
8652
|
-
var
|
|
8653
|
-
|
|
9213
|
+
var hasFlowElements = businessObject
|
|
9214
|
+
&& businessObject.get('flowElements')
|
|
9215
|
+
&& businessObject.get('flowElements').length;
|
|
9216
|
+
|
|
9217
|
+
classes(overlay.html).toggle(EMPTY_MARKER, !hasFlowElements);
|
|
8654
9218
|
};
|
|
8655
9219
|
|
|
8656
9220
|
/**
|
|
8657
|
-
*
|
|
8658
|
-
*
|
|
9221
|
+
* Add a drilldown button to the given element assuming the plane has the same
|
|
9222
|
+
* ID as the element.
|
|
8659
9223
|
*
|
|
8660
|
-
* @param {
|
|
9224
|
+
* @param {Shape} element The collapsed shape.
|
|
8661
9225
|
*/
|
|
8662
|
-
DrilldownOverlayBehavior.prototype.
|
|
8663
|
-
var canvas = this._canvas
|
|
8664
|
-
|
|
9226
|
+
DrilldownOverlayBehavior.prototype._addOverlay = function(element) {
|
|
9227
|
+
var canvas = this._canvas,
|
|
9228
|
+
overlays = this._overlays;
|
|
8665
9229
|
|
|
8666
9230
|
var existingOverlays = overlays.get({ element: element, type: 'drilldown' });
|
|
9231
|
+
|
|
8667
9232
|
if (existingOverlays.length) {
|
|
8668
|
-
this.
|
|
9233
|
+
this._removeOverlay(element);
|
|
8669
9234
|
}
|
|
8670
9235
|
|
|
8671
9236
|
var button = domify$1('<button class="bjs-drilldown">' + ARROW_DOWN_SVG + '</button>');
|
|
@@ -8682,10 +9247,10 @@
|
|
|
8682
9247
|
html: button
|
|
8683
9248
|
});
|
|
8684
9249
|
|
|
8685
|
-
this.
|
|
9250
|
+
this._updateOverlayVisibility(element);
|
|
8686
9251
|
};
|
|
8687
9252
|
|
|
8688
|
-
DrilldownOverlayBehavior.prototype.
|
|
9253
|
+
DrilldownOverlayBehavior.prototype._removeOverlay = function(element) {
|
|
8689
9254
|
var overlays = this._overlays;
|
|
8690
9255
|
|
|
8691
9256
|
overlays.remove({
|
|
@@ -9191,7 +9756,6 @@
|
|
|
9191
9756
|
*/
|
|
9192
9757
|
function DefaultRenderer(eventBus, styles) {
|
|
9193
9758
|
|
|
9194
|
-
//
|
|
9195
9759
|
BaseRenderer.call(this, eventBus, DEFAULT_RENDER_PRIORITY);
|
|
9196
9760
|
|
|
9197
9761
|
this.CONNECTION_STYLE = styles.style([ 'no-fill' ], { strokeWidth: 5, stroke: 'fuchsia' });
|
|
@@ -9202,10 +9766,16 @@
|
|
|
9202
9766
|
e(DefaultRenderer, BaseRenderer);
|
|
9203
9767
|
|
|
9204
9768
|
|
|
9769
|
+
/**
|
|
9770
|
+
* @private
|
|
9771
|
+
*/
|
|
9205
9772
|
DefaultRenderer.prototype.canRender = function() {
|
|
9206
9773
|
return true;
|
|
9207
9774
|
};
|
|
9208
9775
|
|
|
9776
|
+
/**
|
|
9777
|
+
* @private
|
|
9778
|
+
*/
|
|
9209
9779
|
DefaultRenderer.prototype.drawShape = function drawShape(visuals, element, attrs) {
|
|
9210
9780
|
var rect = create$1('rect');
|
|
9211
9781
|
|
|
@@ -9227,6 +9797,9 @@
|
|
|
9227
9797
|
return rect;
|
|
9228
9798
|
};
|
|
9229
9799
|
|
|
9800
|
+
/**
|
|
9801
|
+
* @private
|
|
9802
|
+
*/
|
|
9230
9803
|
DefaultRenderer.prototype.drawConnection = function drawConnection(visuals, connection, attrs) {
|
|
9231
9804
|
|
|
9232
9805
|
var line = createLine(connection.waypoints, assign$1({}, this.CONNECTION_STYLE, attrs || {}));
|
|
@@ -9235,6 +9808,9 @@
|
|
|
9235
9808
|
return line;
|
|
9236
9809
|
};
|
|
9237
9810
|
|
|
9811
|
+
/**
|
|
9812
|
+
* @private
|
|
9813
|
+
*/
|
|
9238
9814
|
DefaultRenderer.prototype.getShapePath = function getShapePath(shape) {
|
|
9239
9815
|
|
|
9240
9816
|
var x = shape.x,
|
|
@@ -9253,6 +9829,9 @@
|
|
|
9253
9829
|
return componentsToPath(shapePath);
|
|
9254
9830
|
};
|
|
9255
9831
|
|
|
9832
|
+
/**
|
|
9833
|
+
* @private
|
|
9834
|
+
*/
|
|
9256
9835
|
DefaultRenderer.prototype.getConnectionPath = function getConnectionPath(connection) {
|
|
9257
9836
|
var waypoints = connection.waypoints;
|
|
9258
9837
|
|
|
@@ -9270,7 +9849,6 @@
|
|
|
9270
9849
|
return componentsToPath(connectionPath);
|
|
9271
9850
|
};
|
|
9272
9851
|
|
|
9273
|
-
|
|
9274
9852
|
DefaultRenderer.$inject = [ 'eventBus', 'styles' ];
|
|
9275
9853
|
|
|
9276
9854
|
/**
|
|
@@ -9297,7 +9875,7 @@
|
|
|
9297
9875
|
* Builds a style definition from a className, a list of traits and an object of additional attributes.
|
|
9298
9876
|
*
|
|
9299
9877
|
* @param {string} className
|
|
9300
|
-
* @param {
|
|
9878
|
+
* @param {string[]} traits
|
|
9301
9879
|
* @param {Object} additionalAttrs
|
|
9302
9880
|
*
|
|
9303
9881
|
* @return {Object} the style defintion
|
|
@@ -9311,7 +9889,7 @@
|
|
|
9311
9889
|
/**
|
|
9312
9890
|
* Builds a style definition from a list of traits and an object of additional attributes.
|
|
9313
9891
|
*
|
|
9314
|
-
* @param {
|
|
9892
|
+
* @param {string[]} traits
|
|
9315
9893
|
* @param {Object} additionalAttrs
|
|
9316
9894
|
*
|
|
9317
9895
|
* @return {Object} the style defintion
|
|
@@ -9340,6 +9918,9 @@
|
|
|
9340
9918
|
};
|
|
9341
9919
|
}
|
|
9342
9920
|
|
|
9921
|
+
/**
|
|
9922
|
+
* @type { import('didi').ModuleDeclaration }
|
|
9923
|
+
*/
|
|
9343
9924
|
var DrawModule = {
|
|
9344
9925
|
__init__: [ 'defaultRenderer' ],
|
|
9345
9926
|
defaultRenderer: [ 'type', DefaultRenderer ],
|
|
@@ -9421,15 +10002,34 @@
|
|
|
9421
10002
|
}
|
|
9422
10003
|
|
|
9423
10004
|
/**
|
|
9424
|
-
* @typedef {import('
|
|
9425
|
-
* @typedef {import('
|
|
9426
|
-
* @typedef {import('
|
|
10005
|
+
* @typedef {import('./Types').ConnectionLike} ConnectionLike
|
|
10006
|
+
* @typedef {import('./Types').RootLike} RootLike
|
|
10007
|
+
* @typedef {import('./Types').ParentLike } ParentLike
|
|
10008
|
+
* @typedef {import('./Types').ShapeLike} ShapeLike
|
|
9427
10009
|
*
|
|
9428
|
-
* @typedef {
|
|
9429
|
-
*
|
|
9430
|
-
*
|
|
9431
|
-
*
|
|
9432
|
-
*
|
|
10010
|
+
* @typedef { {
|
|
10011
|
+
* container?: HTMLElement;
|
|
10012
|
+
* deferUpdate?: boolean;
|
|
10013
|
+
* width?: number;
|
|
10014
|
+
* height?: number;
|
|
10015
|
+
* } } CanvasConfig
|
|
10016
|
+
* @typedef { {
|
|
10017
|
+
* group: SVGElement;
|
|
10018
|
+
* index: number;
|
|
10019
|
+
* visible: boolean;
|
|
10020
|
+
* } } CanvasLayer
|
|
10021
|
+
* @typedef { {
|
|
10022
|
+
* [key: string]: CanvasLayer;
|
|
10023
|
+
* } } CanvasLayers
|
|
10024
|
+
* @typedef { {
|
|
10025
|
+
* rootElement: ShapeLike;
|
|
10026
|
+
* layer: CanvasLayer;
|
|
10027
|
+
* } } CanvasPlane
|
|
10028
|
+
* @typedef { {
|
|
10029
|
+
* scale: number;
|
|
10030
|
+
* inner: Rect;
|
|
10031
|
+
* outer: Dimensions;
|
|
10032
|
+
* } & Rect } CanvasViewbox
|
|
9433
10033
|
*
|
|
9434
10034
|
* @typedef {import('./ElementRegistry').default} ElementRegistry
|
|
9435
10035
|
* @typedef {import('./EventBus').default} EventBus
|
|
@@ -9770,7 +10370,7 @@
|
|
|
9770
10370
|
/**
|
|
9771
10371
|
* Shows a given layer.
|
|
9772
10372
|
*
|
|
9773
|
-
* @param {string}
|
|
10373
|
+
* @param {string} name The name of the layer.
|
|
9774
10374
|
*
|
|
9775
10375
|
* @return {SVGElement} The SVG element of the layer.
|
|
9776
10376
|
*/
|
|
@@ -9806,7 +10406,7 @@
|
|
|
9806
10406
|
/**
|
|
9807
10407
|
* Hides a given layer.
|
|
9808
10408
|
*
|
|
9809
|
-
* @param {string}
|
|
10409
|
+
* @param {string} name The name of the layer.
|
|
9810
10410
|
*
|
|
9811
10411
|
* @return {SVGElement} The SVG element of the layer.
|
|
9812
10412
|
*/
|
|
@@ -9948,7 +10548,7 @@
|
|
|
9948
10548
|
*
|
|
9949
10549
|
* @event element.marker.update
|
|
9950
10550
|
* @type {Object}
|
|
9951
|
-
* @property {
|
|
10551
|
+
* @property {Element} element the shape
|
|
9952
10552
|
* @property {SVGElement} gfx the graphical representation of the shape
|
|
9953
10553
|
* @property {string} marker
|
|
9954
10554
|
* @property {boolean} add true if the marker was added, false if it got removed
|
|
@@ -10054,7 +10654,7 @@
|
|
|
10054
10654
|
/**
|
|
10055
10655
|
* Adds a given root element and returns it.
|
|
10056
10656
|
*
|
|
10057
|
-
* @param {
|
|
10657
|
+
* @param {RootLike} [rootElement] The root element to be added.
|
|
10058
10658
|
*
|
|
10059
10659
|
* @return {RootLike} The added root element or an implicit root element.
|
|
10060
10660
|
*/
|
|
@@ -10090,9 +10690,9 @@
|
|
|
10090
10690
|
/**
|
|
10091
10691
|
* Removes a given root element and returns it.
|
|
10092
10692
|
*
|
|
10093
|
-
* @param {
|
|
10693
|
+
* @param {RootLike|string} rootElement element or element ID
|
|
10094
10694
|
*
|
|
10095
|
-
* @return {
|
|
10695
|
+
* @return {RootLike|undefined} removed element
|
|
10096
10696
|
*/
|
|
10097
10697
|
Canvas.prototype.removeRootElement = function(rootElement) {
|
|
10098
10698
|
|
|
@@ -10134,11 +10734,7 @@
|
|
|
10134
10734
|
*
|
|
10135
10735
|
* @return {RootLike} The set root element.
|
|
10136
10736
|
*/
|
|
10137
|
-
Canvas.prototype.setRootElement = function(rootElement
|
|
10138
|
-
|
|
10139
|
-
if (isDefined(override)) {
|
|
10140
|
-
throw new Error('override not supported');
|
|
10141
|
-
}
|
|
10737
|
+
Canvas.prototype.setRootElement = function(rootElement) {
|
|
10142
10738
|
|
|
10143
10739
|
if (rootElement === this._rootElement) {
|
|
10144
10740
|
return;
|
|
@@ -10295,7 +10891,7 @@
|
|
|
10295
10891
|
* Adds a shape to the canvas.
|
|
10296
10892
|
*
|
|
10297
10893
|
* @param {ShapeLike} shape The shape to be added
|
|
10298
|
-
* @param {
|
|
10894
|
+
* @param {ParentLike} [parent] The shape's parent.
|
|
10299
10895
|
* @param {number} [parentIndex] The index at which to add the shape to the parent's children.
|
|
10300
10896
|
*
|
|
10301
10897
|
* @return {ShapeLike} The added shape.
|
|
@@ -10308,7 +10904,7 @@
|
|
|
10308
10904
|
* Adds a connection to the canvas.
|
|
10309
10905
|
*
|
|
10310
10906
|
* @param {ConnectionLike} connection The connection to be added.
|
|
10311
|
-
* @param {
|
|
10907
|
+
* @param {ParentLike} [parent] The connection's parent.
|
|
10312
10908
|
* @param {number} [parentIndex] The index at which to add the connection to the parent's children.
|
|
10313
10909
|
*
|
|
10314
10910
|
* @return {ConnectionLike} The added connection.
|
|
@@ -10675,7 +11271,7 @@
|
|
|
10675
11271
|
* The getter may return a cached zoom level. Call it with `false` as the first
|
|
10676
11272
|
* argument to force recomputation of the current level.
|
|
10677
11273
|
*
|
|
10678
|
-
* @param {number|
|
|
11274
|
+
* @param {number|'fit-viewport'} [newScale] The new zoom level, either a number,
|
|
10679
11275
|
* i.e. 0.9, or `fit-viewport` to adjust the size to fit the current viewport.
|
|
10680
11276
|
* @param {Point} [center] The reference point { x: ..., y: ...} to zoom to.
|
|
10681
11277
|
*
|
|
@@ -10870,11 +11466,12 @@
|
|
|
10870
11466
|
var ELEMENT_ID = 'data-element-id';
|
|
10871
11467
|
|
|
10872
11468
|
/**
|
|
10873
|
-
* @typedef {import('
|
|
11469
|
+
* @typedef {import('./Types').ElementLike} ElementLike
|
|
10874
11470
|
*
|
|
10875
11471
|
* @typedef {import('./EventBus').default} EventBus
|
|
10876
11472
|
*
|
|
10877
|
-
* @typedef {
|
|
11473
|
+
* @typedef { (element: ElementLike, gfx: SVGElement) => boolean|any } ElementRegistryFilterCallback
|
|
11474
|
+
* @typedef { (element: ElementLike, gfx: SVGElement) => any } ElementRegistryForEachCallback
|
|
10878
11475
|
*/
|
|
10879
11476
|
|
|
10880
11477
|
/**
|
|
@@ -10886,6 +11483,16 @@
|
|
|
10886
11483
|
* @param {EventBus} eventBus
|
|
10887
11484
|
*/
|
|
10888
11485
|
function ElementRegistry(eventBus) {
|
|
11486
|
+
|
|
11487
|
+
/**
|
|
11488
|
+
* @type { {
|
|
11489
|
+
* [id: string]: {
|
|
11490
|
+
* element: ElementLike;
|
|
11491
|
+
* gfx?: SVGElement;
|
|
11492
|
+
* secondaryGfx?: SVGElement;
|
|
11493
|
+
* }
|
|
11494
|
+
* } }
|
|
11495
|
+
*/
|
|
10889
11496
|
this._elements = {};
|
|
10890
11497
|
|
|
10891
11498
|
this._eventBus = eventBus;
|
|
@@ -10971,7 +11578,7 @@
|
|
|
10971
11578
|
/**
|
|
10972
11579
|
* Update the graphical representation of an element.
|
|
10973
11580
|
*
|
|
10974
|
-
* @param {ElementLike|string}
|
|
11581
|
+
* @param {ElementLike|string} filter The element or its ID.
|
|
10975
11582
|
* @param {SVGElement} gfx The new graphical representation.
|
|
10976
11583
|
* @param {boolean} [secondary=false] Whether to update the secondary graphical representation.
|
|
10977
11584
|
*/
|
|
@@ -11022,7 +11629,7 @@
|
|
|
11022
11629
|
/**
|
|
11023
11630
|
* Return all elements that match a given filter function.
|
|
11024
11631
|
*
|
|
11025
|
-
* @param {
|
|
11632
|
+
* @param {ElementRegistryFilterCallback} fn The filter function.
|
|
11026
11633
|
*
|
|
11027
11634
|
* @return {ElementLike[]} The matching elements.
|
|
11028
11635
|
*/
|
|
@@ -11042,7 +11649,7 @@
|
|
|
11042
11649
|
/**
|
|
11043
11650
|
* Return the first element that matches the given filter function.
|
|
11044
11651
|
*
|
|
11045
|
-
* @param {
|
|
11652
|
+
* @param {ElementRegistryFilterCallback} fn The filter function.
|
|
11046
11653
|
*
|
|
11047
11654
|
* @return {ElementLike|undefined} The matching element.
|
|
11048
11655
|
*/
|
|
@@ -11074,7 +11681,7 @@
|
|
|
11074
11681
|
/**
|
|
11075
11682
|
* Execute a given function for each element.
|
|
11076
11683
|
*
|
|
11077
|
-
* @param {
|
|
11684
|
+
* @param {ElementRegistryForEachCallback} fn The function to execute.
|
|
11078
11685
|
*/
|
|
11079
11686
|
ElementRegistry.prototype.forEach = function(fn) {
|
|
11080
11687
|
|
|
@@ -11461,19 +12068,26 @@
|
|
|
11461
12068
|
outgoingRefs = new Refs({ name: 'outgoing', collection: true }, { name: 'source' }),
|
|
11462
12069
|
incomingRefs = new Refs({ name: 'incoming', collection: true }, { name: 'target' });
|
|
11463
12070
|
|
|
12071
|
+
/**
|
|
12072
|
+
* @typedef {import('./Types').Element} Element
|
|
12073
|
+
* @typedef {import('./Types').Shape} Shape
|
|
12074
|
+
* @typedef {import('./Types').Root} Root
|
|
12075
|
+
* @typedef {import('./Types').Label} Label
|
|
12076
|
+
* @typedef {import('./Types').Connection} Connection
|
|
12077
|
+
*/
|
|
12078
|
+
|
|
11464
12079
|
/**
|
|
11465
12080
|
* The basic graphical representation
|
|
11466
12081
|
*
|
|
11467
12082
|
* @class
|
|
11468
|
-
*
|
|
11469
|
-
* @abstract
|
|
12083
|
+
* @constructor
|
|
11470
12084
|
*/
|
|
11471
|
-
function
|
|
12085
|
+
function ElementImpl() {
|
|
11472
12086
|
|
|
11473
12087
|
/**
|
|
11474
12088
|
* The object that backs up the shape
|
|
11475
12089
|
*
|
|
11476
|
-
* @name
|
|
12090
|
+
* @name Element#businessObject
|
|
11477
12091
|
* @type Object
|
|
11478
12092
|
*/
|
|
11479
12093
|
Object.defineProperty(this, 'businessObject', {
|
|
@@ -11484,7 +12098,7 @@
|
|
|
11484
12098
|
/**
|
|
11485
12099
|
* Single label support, will mapped to multi label array
|
|
11486
12100
|
*
|
|
11487
|
-
* @name
|
|
12101
|
+
* @name Element#label
|
|
11488
12102
|
* @type Object
|
|
11489
12103
|
*/
|
|
11490
12104
|
Object.defineProperty(this, 'label', {
|
|
@@ -11507,7 +12121,7 @@
|
|
|
11507
12121
|
/**
|
|
11508
12122
|
* The parent shape
|
|
11509
12123
|
*
|
|
11510
|
-
* @name
|
|
12124
|
+
* @name Element#parent
|
|
11511
12125
|
* @type Shape
|
|
11512
12126
|
*/
|
|
11513
12127
|
parentRefs.bind(this, 'parent');
|
|
@@ -11515,7 +12129,7 @@
|
|
|
11515
12129
|
/**
|
|
11516
12130
|
* The list of labels
|
|
11517
12131
|
*
|
|
11518
|
-
* @name
|
|
12132
|
+
* @name Element#labels
|
|
11519
12133
|
* @type Label
|
|
11520
12134
|
*/
|
|
11521
12135
|
labelRefs.bind(this, 'labels');
|
|
@@ -11523,7 +12137,7 @@
|
|
|
11523
12137
|
/**
|
|
11524
12138
|
* The list of outgoing connections
|
|
11525
12139
|
*
|
|
11526
|
-
* @name
|
|
12140
|
+
* @name Element#outgoing
|
|
11527
12141
|
* @type Array<Connection>
|
|
11528
12142
|
*/
|
|
11529
12143
|
outgoingRefs.bind(this, 'outgoing');
|
|
@@ -11531,7 +12145,7 @@
|
|
|
11531
12145
|
/**
|
|
11532
12146
|
* The list of incoming connections
|
|
11533
12147
|
*
|
|
11534
|
-
* @name
|
|
12148
|
+
* @name Element#incoming
|
|
11535
12149
|
* @type Array<Connection>
|
|
11536
12150
|
*/
|
|
11537
12151
|
incomingRefs.bind(this, 'incoming');
|
|
@@ -11544,40 +12158,40 @@
|
|
|
11544
12158
|
* @class
|
|
11545
12159
|
* @constructor
|
|
11546
12160
|
*
|
|
11547
|
-
* @extends
|
|
12161
|
+
* @extends ElementImpl
|
|
11548
12162
|
*/
|
|
11549
|
-
function
|
|
11550
|
-
|
|
12163
|
+
function ShapeImpl() {
|
|
12164
|
+
ElementImpl.call(this);
|
|
11551
12165
|
|
|
11552
12166
|
/**
|
|
11553
12167
|
* Indicates frame shapes
|
|
11554
12168
|
*
|
|
11555
|
-
* @name
|
|
12169
|
+
* @name ShapeImpl#isFrame
|
|
11556
12170
|
* @type boolean
|
|
11557
12171
|
*/
|
|
11558
12172
|
|
|
11559
12173
|
/**
|
|
11560
12174
|
* The list of children
|
|
11561
12175
|
*
|
|
11562
|
-
* @name
|
|
11563
|
-
* @type
|
|
12176
|
+
* @name ShapeImpl#children
|
|
12177
|
+
* @type Element[]
|
|
11564
12178
|
*/
|
|
11565
12179
|
parentRefs.bind(this, 'children');
|
|
11566
12180
|
|
|
11567
12181
|
/**
|
|
11568
|
-
* @name
|
|
12182
|
+
* @name ShapeImpl#host
|
|
11569
12183
|
* @type Shape
|
|
11570
12184
|
*/
|
|
11571
12185
|
attacherRefs.bind(this, 'host');
|
|
11572
12186
|
|
|
11573
12187
|
/**
|
|
11574
|
-
* @name
|
|
12188
|
+
* @name ShapeImpl#attachers
|
|
11575
12189
|
* @type Shape
|
|
11576
12190
|
*/
|
|
11577
12191
|
attacherRefs.bind(this, 'attachers');
|
|
11578
12192
|
}
|
|
11579
12193
|
|
|
11580
|
-
e(
|
|
12194
|
+
e(ShapeImpl, ElementImpl);
|
|
11581
12195
|
|
|
11582
12196
|
|
|
11583
12197
|
/**
|
|
@@ -11586,13 +12200,21 @@
|
|
|
11586
12200
|
* @class
|
|
11587
12201
|
* @constructor
|
|
11588
12202
|
*
|
|
11589
|
-
* @extends
|
|
12203
|
+
* @extends ElementImpl
|
|
11590
12204
|
*/
|
|
11591
|
-
function
|
|
11592
|
-
|
|
12205
|
+
function RootImpl() {
|
|
12206
|
+
ElementImpl.call(this);
|
|
12207
|
+
|
|
12208
|
+
/**
|
|
12209
|
+
* The list of children
|
|
12210
|
+
*
|
|
12211
|
+
* @name RootImpl#children
|
|
12212
|
+
* @type Element[]
|
|
12213
|
+
*/
|
|
12214
|
+
parentRefs.bind(this, 'children');
|
|
11593
12215
|
}
|
|
11594
12216
|
|
|
11595
|
-
e(
|
|
12217
|
+
e(RootImpl, ShapeImpl);
|
|
11596
12218
|
|
|
11597
12219
|
|
|
11598
12220
|
/**
|
|
@@ -11601,21 +12223,21 @@
|
|
|
11601
12223
|
* @class
|
|
11602
12224
|
* @constructor
|
|
11603
12225
|
*
|
|
11604
|
-
* @extends
|
|
12226
|
+
* @extends ShapeImpl
|
|
11605
12227
|
*/
|
|
11606
|
-
function
|
|
11607
|
-
|
|
12228
|
+
function LabelImpl() {
|
|
12229
|
+
ShapeImpl.call(this);
|
|
11608
12230
|
|
|
11609
12231
|
/**
|
|
11610
12232
|
* The labeled element
|
|
11611
12233
|
*
|
|
11612
|
-
* @name
|
|
11613
|
-
* @type
|
|
12234
|
+
* @name LabelImpl#labelTarget
|
|
12235
|
+
* @type Element
|
|
11614
12236
|
*/
|
|
11615
12237
|
labelRefs.bind(this, 'labelTarget');
|
|
11616
12238
|
}
|
|
11617
12239
|
|
|
11618
|
-
e(
|
|
12240
|
+
e(LabelImpl, ShapeImpl);
|
|
11619
12241
|
|
|
11620
12242
|
|
|
11621
12243
|
/**
|
|
@@ -11624,45 +12246,69 @@
|
|
|
11624
12246
|
* @class
|
|
11625
12247
|
* @constructor
|
|
11626
12248
|
*
|
|
11627
|
-
* @extends
|
|
12249
|
+
* @extends ElementImpl
|
|
11628
12250
|
*/
|
|
11629
|
-
function
|
|
11630
|
-
|
|
12251
|
+
function ConnectionImpl() {
|
|
12252
|
+
ElementImpl.call(this);
|
|
11631
12253
|
|
|
11632
12254
|
/**
|
|
11633
12255
|
* The element this connection originates from
|
|
11634
12256
|
*
|
|
11635
|
-
* @name
|
|
11636
|
-
* @type
|
|
12257
|
+
* @name ConnectionImpl#source
|
|
12258
|
+
* @type Element
|
|
11637
12259
|
*/
|
|
11638
12260
|
outgoingRefs.bind(this, 'source');
|
|
11639
12261
|
|
|
11640
12262
|
/**
|
|
11641
12263
|
* The element this connection points to
|
|
11642
12264
|
*
|
|
11643
|
-
* @name
|
|
11644
|
-
* @type
|
|
12265
|
+
* @name ConnectionImpl#target
|
|
12266
|
+
* @type Element
|
|
11645
12267
|
*/
|
|
11646
12268
|
incomingRefs.bind(this, 'target');
|
|
11647
12269
|
}
|
|
11648
12270
|
|
|
11649
|
-
e(
|
|
12271
|
+
e(ConnectionImpl, ElementImpl);
|
|
11650
12272
|
|
|
11651
12273
|
|
|
11652
12274
|
var types$6 = {
|
|
11653
|
-
connection:
|
|
11654
|
-
shape:
|
|
11655
|
-
label:
|
|
11656
|
-
root:
|
|
12275
|
+
connection: ConnectionImpl,
|
|
12276
|
+
shape: ShapeImpl,
|
|
12277
|
+
label: LabelImpl,
|
|
12278
|
+
root: RootImpl
|
|
11657
12279
|
};
|
|
11658
12280
|
|
|
11659
12281
|
/**
|
|
11660
|
-
* Creates a
|
|
12282
|
+
* Creates a root element.
|
|
12283
|
+
*
|
|
12284
|
+
* @overlord
|
|
12285
|
+
*
|
|
12286
|
+
* @example
|
|
12287
|
+
*
|
|
12288
|
+
* ```
|
|
12289
|
+
* import * as Model from 'diagram-js/lib/model';
|
|
12290
|
+
*
|
|
12291
|
+
* const root = Model.create('root', {
|
|
12292
|
+
* x: 100,
|
|
12293
|
+
* y: 100,
|
|
12294
|
+
* width: 100,
|
|
12295
|
+
* height: 100
|
|
12296
|
+
* });
|
|
12297
|
+
* ```
|
|
12298
|
+
*
|
|
12299
|
+
* @param {'root'} type
|
|
12300
|
+
* @param {any} [attrs]
|
|
12301
|
+
*
|
|
12302
|
+
* @return {Root}
|
|
12303
|
+
*/
|
|
12304
|
+
/**
|
|
12305
|
+
* Creates a connection.
|
|
11661
12306
|
*
|
|
11662
|
-
* @
|
|
12307
|
+
* @overlord
|
|
11663
12308
|
*
|
|
11664
12309
|
* @example
|
|
11665
12310
|
*
|
|
12311
|
+
* ```
|
|
11666
12312
|
* import * as Model from 'diagram-js/lib/model';
|
|
11667
12313
|
*
|
|
11668
12314
|
* const connection = Model.create('connection', {
|
|
@@ -11671,33 +12317,56 @@
|
|
|
11671
12317
|
* { x: 200, y: 100 }
|
|
11672
12318
|
* ]
|
|
11673
12319
|
* });
|
|
12320
|
+
* ```
|
|
11674
12321
|
*
|
|
11675
|
-
*
|
|
11676
|
-
*
|
|
11677
|
-
* y: 100,
|
|
11678
|
-
* width: 100,
|
|
11679
|
-
* height: 100,
|
|
11680
|
-
* labelTarget: shape
|
|
11681
|
-
* });
|
|
12322
|
+
* @param {'connection'} type
|
|
12323
|
+
* @param {any} [attrs]
|
|
11682
12324
|
*
|
|
11683
|
-
*
|
|
12325
|
+
* @return {Connection}
|
|
12326
|
+
*/
|
|
12327
|
+
/**
|
|
12328
|
+
* Creates a shape.
|
|
12329
|
+
*
|
|
12330
|
+
* @overlord
|
|
12331
|
+
*
|
|
12332
|
+
* @example
|
|
12333
|
+
*
|
|
12334
|
+
* ```
|
|
12335
|
+
* import * as Model from 'diagram-js/lib/model';
|
|
12336
|
+
*
|
|
12337
|
+
* const shape = Model.create('shape', {
|
|
11684
12338
|
* x: 100,
|
|
11685
12339
|
* y: 100,
|
|
11686
12340
|
* width: 100,
|
|
11687
12341
|
* height: 100
|
|
11688
12342
|
* });
|
|
12343
|
+
* ```
|
|
11689
12344
|
*
|
|
11690
|
-
*
|
|
12345
|
+
* @param {'shape'} type
|
|
12346
|
+
* @param {any} [attrs]
|
|
12347
|
+
*
|
|
12348
|
+
* @return {Shape}
|
|
12349
|
+
*/
|
|
12350
|
+
/**
|
|
12351
|
+
* Creates a label.
|
|
12352
|
+
*
|
|
12353
|
+
* @example
|
|
12354
|
+
*
|
|
12355
|
+
* ```
|
|
12356
|
+
* import * as Model from 'diagram-js/lib/model';
|
|
12357
|
+
*
|
|
12358
|
+
* const label = Model.create('label', {
|
|
11691
12359
|
* x: 100,
|
|
11692
12360
|
* y: 100,
|
|
11693
12361
|
* width: 100,
|
|
11694
|
-
* height: 100
|
|
12362
|
+
* height: 100,
|
|
12363
|
+
* labelTarget: shape
|
|
11695
12364
|
* });
|
|
12365
|
+
* ```
|
|
11696
12366
|
*
|
|
11697
|
-
* @param {
|
|
11698
|
-
* @param {
|
|
11699
|
-
*
|
|
11700
|
-
* @return {Connection|Label|Root|Shape} The created model element.
|
|
12367
|
+
* @param {'label'} type
|
|
12368
|
+
* @param {any} [attrs]
|
|
12369
|
+
* @return {Label}
|
|
11701
12370
|
*/
|
|
11702
12371
|
function create(type, attrs) {
|
|
11703
12372
|
var Type = types$6[type];
|
|
@@ -11708,22 +12377,20 @@
|
|
|
11708
12377
|
}
|
|
11709
12378
|
|
|
11710
12379
|
/**
|
|
11711
|
-
* @typedef {import('../model/
|
|
11712
|
-
* @typedef {import('../model/
|
|
11713
|
-
* @typedef {import('../model/
|
|
11714
|
-
* @typedef {import('../model/
|
|
11715
|
-
* @typedef {import('../model/
|
|
11716
|
-
* @typedef {import('../model/index').ModelAttrsConnection} ModelAttrsConnection
|
|
11717
|
-
* @typedef {import('../model/index').ModelAttrsLabel} ModelAttrsLabel
|
|
11718
|
-
* @typedef {import('../model/index').ModelAttrsRoot} ModelAttrsRoot
|
|
11719
|
-
* @typedef {import('../model/index').ModelAttrsShape} ModelAttrsShape
|
|
12380
|
+
* @typedef {import('../model/Types').Element} Element
|
|
12381
|
+
* @typedef {import('../model/Types').Connection} Connection
|
|
12382
|
+
* @typedef {import('../model/Types').Label} Label
|
|
12383
|
+
* @typedef {import('../model/Types').Root} Root
|
|
12384
|
+
* @typedef {import('../model/Types').Shape} Shape
|
|
11720
12385
|
*/
|
|
11721
12386
|
|
|
11722
12387
|
/**
|
|
11723
12388
|
* A factory for model elements.
|
|
11724
12389
|
*
|
|
11725
|
-
* @
|
|
11726
|
-
* @
|
|
12390
|
+
* @template {Connection} [T=Connection]
|
|
12391
|
+
* @template {Label} [U=Label]
|
|
12392
|
+
* @template {Root} [V=Root]
|
|
12393
|
+
* @template {Shape} [W=Shape]
|
|
11727
12394
|
*/
|
|
11728
12395
|
function ElementFactory() {
|
|
11729
12396
|
this._uid = 12;
|
|
@@ -11732,9 +12399,9 @@
|
|
|
11732
12399
|
/**
|
|
11733
12400
|
* Create a root element.
|
|
11734
12401
|
*
|
|
11735
|
-
* @param {
|
|
12402
|
+
* @param {Partial<Root>} [attrs]
|
|
11736
12403
|
*
|
|
11737
|
-
* @return {
|
|
12404
|
+
* @return {V} The created root element.
|
|
11738
12405
|
*/
|
|
11739
12406
|
ElementFactory.prototype.createRoot = function(attrs) {
|
|
11740
12407
|
return this.create('root', attrs);
|
|
@@ -11743,9 +12410,9 @@
|
|
|
11743
12410
|
/**
|
|
11744
12411
|
* Create a label.
|
|
11745
12412
|
*
|
|
11746
|
-
* @param {
|
|
12413
|
+
* @param {Partial<Label>} [attrs]
|
|
11747
12414
|
*
|
|
11748
|
-
* @return {
|
|
12415
|
+
* @return {U} The created label.
|
|
11749
12416
|
*/
|
|
11750
12417
|
ElementFactory.prototype.createLabel = function(attrs) {
|
|
11751
12418
|
return this.create('label', attrs);
|
|
@@ -11754,9 +12421,9 @@
|
|
|
11754
12421
|
/**
|
|
11755
12422
|
* Create a shape.
|
|
11756
12423
|
*
|
|
11757
|
-
* @param {
|
|
12424
|
+
* @param {Partial<Shape>} [attrs]
|
|
11758
12425
|
*
|
|
11759
|
-
* @return {
|
|
12426
|
+
* @return {W} The created shape.
|
|
11760
12427
|
*/
|
|
11761
12428
|
ElementFactory.prototype.createShape = function(attrs) {
|
|
11762
12429
|
return this.create('shape', attrs);
|
|
@@ -11765,21 +12432,44 @@
|
|
|
11765
12432
|
/**
|
|
11766
12433
|
* Create a connection.
|
|
11767
12434
|
*
|
|
11768
|
-
* @param {
|
|
12435
|
+
* @param {Partial<Connection>} [attrs]
|
|
11769
12436
|
*
|
|
11770
|
-
* @return {
|
|
12437
|
+
* @return {T} The created connection.
|
|
11771
12438
|
*/
|
|
11772
12439
|
ElementFactory.prototype.createConnection = function(attrs) {
|
|
11773
12440
|
return this.create('connection', attrs);
|
|
11774
12441
|
};
|
|
11775
12442
|
|
|
11776
12443
|
/**
|
|
11777
|
-
* Create a
|
|
12444
|
+
* Create a root element.
|
|
12445
|
+
*
|
|
12446
|
+
* @overlord
|
|
12447
|
+
* @param {'root'} type
|
|
12448
|
+
* @param {Partial<Root>} [attrs]
|
|
12449
|
+
* @return {V}
|
|
12450
|
+
*/
|
|
12451
|
+
/**
|
|
12452
|
+
* Create a shape.
|
|
12453
|
+
*
|
|
12454
|
+
* @overlord
|
|
12455
|
+
* @param {'shape'} type
|
|
12456
|
+
* @param {Partial<Shape>} [attrs]
|
|
12457
|
+
* @return {W}
|
|
12458
|
+
*/
|
|
12459
|
+
/**
|
|
12460
|
+
* Create a connection.
|
|
11778
12461
|
*
|
|
11779
|
-
* @
|
|
11780
|
-
* @param {
|
|
12462
|
+
* @overlord
|
|
12463
|
+
* @param {'connection'} type
|
|
12464
|
+
* @param {Partial<Connection>} [attrs]
|
|
12465
|
+
* @return {T}
|
|
12466
|
+
*/
|
|
12467
|
+
/**
|
|
12468
|
+
* Create a label.
|
|
11781
12469
|
*
|
|
11782
|
-
* @
|
|
12470
|
+
* @param {'label'} type
|
|
12471
|
+
* @param {Partial<Label>} [attrs]
|
|
12472
|
+
* @return {U}
|
|
11783
12473
|
*/
|
|
11784
12474
|
ElementFactory.prototype.create = function(type, attrs) {
|
|
11785
12475
|
|
|
@@ -11799,13 +12489,27 @@
|
|
|
11799
12489
|
var slice = Array.prototype.slice;
|
|
11800
12490
|
|
|
11801
12491
|
/**
|
|
11802
|
-
* @typedef {
|
|
11803
|
-
*
|
|
12492
|
+
* @typedef { {
|
|
12493
|
+
* stopPropagation(): void;
|
|
12494
|
+
* preventDefault(): void;
|
|
12495
|
+
* cancelBubble: boolean;
|
|
12496
|
+
* defaultPrevented: boolean;
|
|
12497
|
+
* returnValue: any;
|
|
12498
|
+
* } } Event
|
|
12499
|
+
*/
|
|
12500
|
+
|
|
12501
|
+
/**
|
|
12502
|
+
* @template E
|
|
11804
12503
|
*
|
|
11805
|
-
* @typedef {
|
|
11806
|
-
|
|
11807
|
-
|
|
11808
|
-
|
|
12504
|
+
* @typedef { (event: E & Event, ...any) => any } EventBusEventCallback
|
|
12505
|
+
*/
|
|
12506
|
+
|
|
12507
|
+
/**
|
|
12508
|
+
* @typedef { {
|
|
12509
|
+
* priority: number;
|
|
12510
|
+
* next: EventBusListener | null;
|
|
12511
|
+
* callback: EventBusEventCallback<any>;
|
|
12512
|
+
* } } EventBusListener
|
|
11809
12513
|
*/
|
|
11810
12514
|
|
|
11811
12515
|
/**
|
|
@@ -11892,6 +12596,10 @@
|
|
|
11892
12596
|
* ```
|
|
11893
12597
|
*/
|
|
11894
12598
|
function EventBus() {
|
|
12599
|
+
|
|
12600
|
+
/**
|
|
12601
|
+
* @type { Record<string, EventBusListener> }
|
|
12602
|
+
*/
|
|
11895
12603
|
this._listeners = {};
|
|
11896
12604
|
|
|
11897
12605
|
// cleanup on destroy on lowest priority to allow
|
|
@@ -11912,10 +12620,12 @@
|
|
|
11912
12620
|
*
|
|
11913
12621
|
* Returning anything but `undefined` from a listener will stop the listener propagation.
|
|
11914
12622
|
*
|
|
11915
|
-
* @
|
|
11916
|
-
*
|
|
11917
|
-
* @param {
|
|
11918
|
-
* @param {
|
|
12623
|
+
* @template T
|
|
12624
|
+
*
|
|
12625
|
+
* @param {string|string[]} events to subscribe to
|
|
12626
|
+
* @param {number} [priority=1000] listen priority
|
|
12627
|
+
* @param {EventBusEventCallback<T>} callback
|
|
12628
|
+
* @param {any} [that] callback context
|
|
11919
12629
|
*/
|
|
11920
12630
|
EventBus.prototype.on = function(events, priority, callback, that) {
|
|
11921
12631
|
|
|
@@ -11957,12 +12667,14 @@
|
|
|
11957
12667
|
/**
|
|
11958
12668
|
* Register an event listener that is called only once.
|
|
11959
12669
|
*
|
|
11960
|
-
* @
|
|
11961
|
-
*
|
|
11962
|
-
* @param {
|
|
11963
|
-
* @param {
|
|
12670
|
+
* @template T
|
|
12671
|
+
*
|
|
12672
|
+
* @param {string|string[]} events to subscribe to
|
|
12673
|
+
* @param {number} [priority=1000] the listen priority
|
|
12674
|
+
* @param {EventBusEventCallback<T>} callback
|
|
12675
|
+
* @param {any} [that] callback context
|
|
11964
12676
|
*/
|
|
11965
|
-
EventBus.prototype.once = function(
|
|
12677
|
+
EventBus.prototype.once = function(events, priority, callback, that) {
|
|
11966
12678
|
var self = this;
|
|
11967
12679
|
|
|
11968
12680
|
if (isFunction(priority)) {
|
|
@@ -11980,7 +12692,7 @@
|
|
|
11980
12692
|
|
|
11981
12693
|
var result = callback.apply(that, arguments);
|
|
11982
12694
|
|
|
11983
|
-
self.off(
|
|
12695
|
+
self.off(events, wrappedCallback);
|
|
11984
12696
|
|
|
11985
12697
|
return result;
|
|
11986
12698
|
}
|
|
@@ -11990,7 +12702,7 @@
|
|
|
11990
12702
|
// callback
|
|
11991
12703
|
wrappedCallback[FN_REF] = callback;
|
|
11992
12704
|
|
|
11993
|
-
this.on(
|
|
12705
|
+
this.on(events, priority, wrappedCallback);
|
|
11994
12706
|
};
|
|
11995
12707
|
|
|
11996
12708
|
|
|
@@ -11999,8 +12711,8 @@
|
|
|
11999
12711
|
*
|
|
12000
12712
|
* If no callback is given, all listeners for a given event name are being removed.
|
|
12001
12713
|
*
|
|
12002
|
-
* @param {string|string[]} events
|
|
12003
|
-
* @param {
|
|
12714
|
+
* @param {string|string[]} events
|
|
12715
|
+
* @param {EventBusEventCallback} [callback]
|
|
12004
12716
|
*/
|
|
12005
12717
|
EventBus.prototype.off = function(events, callback) {
|
|
12006
12718
|
|
|
@@ -12036,6 +12748,7 @@
|
|
|
12036
12748
|
*
|
|
12037
12749
|
* @example
|
|
12038
12750
|
*
|
|
12751
|
+
* ```javascript
|
|
12039
12752
|
* // fire event by name
|
|
12040
12753
|
* events.fire('foo');
|
|
12041
12754
|
*
|
|
@@ -12053,12 +12766,13 @@
|
|
|
12053
12766
|
* });
|
|
12054
12767
|
*
|
|
12055
12768
|
* events.fire({ type: 'foo' }, 'I am bar!');
|
|
12769
|
+
* ```
|
|
12056
12770
|
*
|
|
12057
|
-
* @param {string} [type]
|
|
12058
|
-
* @param {Object} [data]
|
|
12059
|
-
* @param {
|
|
12771
|
+
* @param {string} [type] event type
|
|
12772
|
+
* @param {Object} [data] event or event data
|
|
12773
|
+
* @param {...any} [args] additional arguments the callback will be called with.
|
|
12060
12774
|
*
|
|
12061
|
-
* @return {
|
|
12775
|
+
* @return {any} The return value. Will be set to `false` if the default was prevented.
|
|
12062
12776
|
*/
|
|
12063
12777
|
EventBus.prototype.fire = function(type, data) {
|
|
12064
12778
|
var event,
|
|
@@ -12139,6 +12853,13 @@
|
|
|
12139
12853
|
this._listeners = {};
|
|
12140
12854
|
};
|
|
12141
12855
|
|
|
12856
|
+
/**
|
|
12857
|
+
* @param {Event} event
|
|
12858
|
+
* @param {any[]} args
|
|
12859
|
+
* @param {EventBusListener} listener
|
|
12860
|
+
*
|
|
12861
|
+
* @return {any}
|
|
12862
|
+
*/
|
|
12142
12863
|
EventBus.prototype._invokeListeners = function(event, args, listener) {
|
|
12143
12864
|
|
|
12144
12865
|
var returnValue;
|
|
@@ -12158,6 +12879,13 @@
|
|
|
12158
12879
|
return returnValue;
|
|
12159
12880
|
};
|
|
12160
12881
|
|
|
12882
|
+
/**
|
|
12883
|
+
* @param {Event} event
|
|
12884
|
+
* @param {any[]} args
|
|
12885
|
+
* @param {EventBusListener} listener
|
|
12886
|
+
*
|
|
12887
|
+
* @return {any}
|
|
12888
|
+
*/
|
|
12161
12889
|
EventBus.prototype._invokeListener = function(event, args, listener) {
|
|
12162
12890
|
|
|
12163
12891
|
var returnValue;
|
|
@@ -12206,7 +12934,7 @@
|
|
|
12206
12934
|
* * after: [ 1500, 1500, (new=1300), 1000, 1000, (new=1000) ]
|
|
12207
12935
|
*
|
|
12208
12936
|
* @param {string} event
|
|
12209
|
-
* @param {
|
|
12937
|
+
* @param {EventBusListener} listener
|
|
12210
12938
|
*/
|
|
12211
12939
|
EventBus.prototype._addListener = function(event, newListener) {
|
|
12212
12940
|
|
|
@@ -12246,10 +12974,19 @@
|
|
|
12246
12974
|
};
|
|
12247
12975
|
|
|
12248
12976
|
|
|
12977
|
+
/**
|
|
12978
|
+
* @param {string} name
|
|
12979
|
+
*
|
|
12980
|
+
* @return {EventBusListener}
|
|
12981
|
+
*/
|
|
12249
12982
|
EventBus.prototype._getListeners = function(name) {
|
|
12250
12983
|
return this._listeners[name];
|
|
12251
12984
|
};
|
|
12252
12985
|
|
|
12986
|
+
/**
|
|
12987
|
+
* @param {string} name
|
|
12988
|
+
* @param {EventBusListener} listener
|
|
12989
|
+
*/
|
|
12253
12990
|
EventBus.prototype._setListeners = function(name, listener) {
|
|
12254
12991
|
this._listeners[name] = listener;
|
|
12255
12992
|
};
|
|
@@ -12312,9 +13049,9 @@
|
|
|
12312
13049
|
* Invoke function. Be fast...
|
|
12313
13050
|
*
|
|
12314
13051
|
* @param {Function} fn
|
|
12315
|
-
* @param {
|
|
13052
|
+
* @param {any[]} args
|
|
12316
13053
|
*
|
|
12317
|
-
* @return {
|
|
13054
|
+
* @return {any}
|
|
12318
13055
|
*/
|
|
12319
13056
|
function invokeFunction(fn, args) {
|
|
12320
13057
|
return fn.apply(null, args);
|
|
@@ -12349,13 +13086,9 @@
|
|
|
12349
13086
|
}
|
|
12350
13087
|
|
|
12351
13088
|
/**
|
|
12352
|
-
* @typedef {import('
|
|
12353
|
-
* @typedef {import('
|
|
12354
|
-
* @typedef {import('
|
|
12355
|
-
*
|
|
12356
|
-
* @typedef {import('.').ConnectionLike} ConnectionLike
|
|
12357
|
-
* @typedef {import('.').ElementLike} ElementLike
|
|
12358
|
-
* @typedef {import('.').ShapeLike} ShapeLike
|
|
13089
|
+
* @typedef {import('./Types').ConnectionLike} ConnectionLike
|
|
13090
|
+
* @typedef {import('./Types').ElementLike} ElementLike
|
|
13091
|
+
* @typedef {import('./Types').ShapeLike} ShapeLike
|
|
12359
13092
|
*
|
|
12360
13093
|
* @typedef {import('./ElementRegistry').default} ElementRegistry
|
|
12361
13094
|
* @typedef {import('./EventBus').default} EventBus
|
|
@@ -12374,7 +13107,10 @@
|
|
|
12374
13107
|
|
|
12375
13108
|
GraphicsFactory.$inject = [ 'eventBus' , 'elementRegistry' ];
|
|
12376
13109
|
|
|
12377
|
-
|
|
13110
|
+
/**
|
|
13111
|
+
* @param { { parent?: any } } element
|
|
13112
|
+
* @return {SVGElement}
|
|
13113
|
+
*/
|
|
12378
13114
|
GraphicsFactory.prototype._getChildrenContainer = function(element) {
|
|
12379
13115
|
|
|
12380
13116
|
var gfx = this._elementRegistry.getGraphics(element);
|
|
@@ -12471,7 +13207,7 @@
|
|
|
12471
13207
|
/**
|
|
12472
13208
|
* Create a graphical element.
|
|
12473
13209
|
*
|
|
12474
|
-
* @param {
|
|
13210
|
+
* @param { 'shape' | 'connection' | 'label' | 'root' } type The type of the element.
|
|
12475
13211
|
* @param {ElementLike} element The element.
|
|
12476
13212
|
* @param {number} [parentIndex] The index at which to add the graphical element to its parent's children.
|
|
12477
13213
|
*
|
|
@@ -12527,6 +13263,8 @@
|
|
|
12527
13263
|
*
|
|
12528
13264
|
* @param {SVGElement} visual The graphical element.
|
|
12529
13265
|
* @param {ShapeLike} element The shape.
|
|
13266
|
+
*
|
|
13267
|
+
* @return {SVGElement}
|
|
12530
13268
|
*/
|
|
12531
13269
|
GraphicsFactory.prototype.drawShape = function(visual, element) {
|
|
12532
13270
|
var eventBus = this._eventBus;
|
|
@@ -12552,6 +13290,8 @@
|
|
|
12552
13290
|
*
|
|
12553
13291
|
* @param {SVGElement} visual The graphical element.
|
|
12554
13292
|
* @param {ConnectionLike} element The connection.
|
|
13293
|
+
*
|
|
13294
|
+
* @return {SVGElement}
|
|
12555
13295
|
*/
|
|
12556
13296
|
GraphicsFactory.prototype.drawConnection = function(visual, element) {
|
|
12557
13297
|
var eventBus = this._eventBus;
|
|
@@ -12562,7 +13302,7 @@
|
|
|
12562
13302
|
/**
|
|
12563
13303
|
* Get the path of a connection.
|
|
12564
13304
|
*
|
|
12565
|
-
* @param {ConnectionLike}
|
|
13305
|
+
* @param {ConnectionLike} connection The connection.
|
|
12566
13306
|
*
|
|
12567
13307
|
* @return {string} The path of the connection.
|
|
12568
13308
|
*/
|
|
@@ -12575,9 +13315,9 @@
|
|
|
12575
13315
|
/**
|
|
12576
13316
|
* Update an elements graphical representation.
|
|
12577
13317
|
*
|
|
12578
|
-
* @param {
|
|
12579
|
-
* @param {ElementLike} element
|
|
12580
|
-
* @param {SVGElement} gfx
|
|
13318
|
+
* @param {'shape'|'connection'} type
|
|
13319
|
+
* @param {ElementLike} element
|
|
13320
|
+
* @param {SVGElement} gfx
|
|
12581
13321
|
*/
|
|
12582
13322
|
GraphicsFactory.prototype.update = function(type, element, gfx) {
|
|
12583
13323
|
|
|
@@ -12635,6 +13375,9 @@
|
|
|
12635
13375
|
parentNode.insertBefore(newNode, node);
|
|
12636
13376
|
}
|
|
12637
13377
|
|
|
13378
|
+
/**
|
|
13379
|
+
* @type { import('didi').ModuleDeclaration }
|
|
13380
|
+
*/
|
|
12638
13381
|
var CoreModule = {
|
|
12639
13382
|
__depends__: [ DrawModule ],
|
|
12640
13383
|
__init__: [ 'canvas' ],
|
|
@@ -12650,7 +13393,9 @@
|
|
|
12650
13393
|
* @typedef {import('didi').LocalsMap} LocalsMap
|
|
12651
13394
|
* @typedef {import('didi').ModuleDeclaration} ModuleDeclaration
|
|
12652
13395
|
*
|
|
12653
|
-
* @typedef {
|
|
13396
|
+
* @typedef { {
|
|
13397
|
+
* modules?: ModuleDeclaration[];
|
|
13398
|
+
* } & Record<string, any> } DiagramOptions
|
|
12654
13399
|
*/
|
|
12655
13400
|
|
|
12656
13401
|
/**
|
|
@@ -12679,6 +13424,9 @@
|
|
|
12679
13424
|
|
|
12680
13425
|
options = options || {};
|
|
12681
13426
|
|
|
13427
|
+
/**
|
|
13428
|
+
* @type { ModuleDeclaration }
|
|
13429
|
+
*/
|
|
12682
13430
|
var configModule = {
|
|
12683
13431
|
'config': [ 'value', options ]
|
|
12684
13432
|
};
|
|
@@ -12698,11 +13446,10 @@
|
|
|
12698
13446
|
* @class
|
|
12699
13447
|
* @constructor
|
|
12700
13448
|
*
|
|
12701
|
-
* @example
|
|
12702
|
-
*
|
|
12703
|
-
* <caption>Creating a plug-in that logs whenever a shape is added to the canvas.</caption>
|
|
13449
|
+
* @example Creating a plug-in that logs whenever a shape is added to the canvas.
|
|
12704
13450
|
*
|
|
12705
|
-
*
|
|
13451
|
+
* ```javascript
|
|
13452
|
+
* // plug-in implementation
|
|
12706
13453
|
* function MyLoggingPlugin(eventBus) {
|
|
12707
13454
|
* eventBus.on('shape.added', function(event) {
|
|
12708
13455
|
* console.log('shape ', event.shape, ' was added to the diagram');
|
|
@@ -12714,10 +13461,11 @@
|
|
|
12714
13461
|
* __init__: [ 'myLoggingPlugin' ],
|
|
12715
13462
|
* myLoggingPlugin: [ 'type', MyLoggingPlugin ]
|
|
12716
13463
|
* };
|
|
13464
|
+
* ```
|
|
12717
13465
|
*
|
|
13466
|
+
* Use the plug-in in a Diagram instance:
|
|
12718
13467
|
*
|
|
12719
|
-
*
|
|
12720
|
-
*
|
|
13468
|
+
* ```javascript
|
|
12721
13469
|
* import MyLoggingModule from 'path-to-my-logging-plugin';
|
|
12722
13470
|
*
|
|
12723
13471
|
* var diagram = new Diagram({
|
|
@@ -12732,36 +13480,39 @@
|
|
|
12732
13480
|
* });
|
|
12733
13481
|
*
|
|
12734
13482
|
* // 'shape ... was added to the diagram' logged to console
|
|
13483
|
+
* ```
|
|
12735
13484
|
*
|
|
12736
13485
|
* @param {DiagramOptions} [options]
|
|
12737
|
-
* @param {ModuleDeclaration[]} [options.modules] External modules to instantiate with the diagram.
|
|
12738
13486
|
* @param {Injector} [injector] An (optional) injector to bootstrap the diagram with.
|
|
12739
13487
|
*/
|
|
12740
13488
|
function Diagram(options, injector) {
|
|
12741
13489
|
|
|
12742
|
-
|
|
12743
|
-
this.injector = injector = injector || createInjector(options);
|
|
13490
|
+
this._injector = injector = injector || createInjector(options);
|
|
12744
13491
|
|
|
12745
13492
|
// API
|
|
12746
13493
|
|
|
12747
13494
|
/**
|
|
12748
13495
|
* Resolves a diagram service.
|
|
12749
13496
|
*
|
|
12750
|
-
* @
|
|
13497
|
+
* @template T
|
|
12751
13498
|
*
|
|
12752
13499
|
* @param {string} name The name of the service to get.
|
|
12753
13500
|
* @param {boolean} [strict=true] If false, resolve missing services to null.
|
|
13501
|
+
*
|
|
13502
|
+
* @return {T|null}
|
|
12754
13503
|
*/
|
|
12755
13504
|
this.get = injector.get;
|
|
12756
13505
|
|
|
12757
13506
|
/**
|
|
12758
13507
|
* Executes a function with its dependencies injected.
|
|
12759
13508
|
*
|
|
12760
|
-
* @
|
|
13509
|
+
* @template T
|
|
13510
|
+
*
|
|
13511
|
+
* @param {Function} func function to be invoked
|
|
13512
|
+
* @param {InjectionContext} [context] context of the invocation
|
|
13513
|
+
* @param {LocalsMap} [locals] locals provided
|
|
12761
13514
|
*
|
|
12762
|
-
* @
|
|
12763
|
-
* @param {InjectionContext} [context] The context.
|
|
12764
|
-
* @param {LocalsMap} [locals] The locals.
|
|
13515
|
+
* @return {T|null}
|
|
12765
13516
|
*/
|
|
12766
13517
|
this.invoke = injector.invoke;
|
|
12767
13518
|
|
|
@@ -12793,8 +13544,6 @@
|
|
|
12793
13544
|
|
|
12794
13545
|
/**
|
|
12795
13546
|
* Destroys the diagram
|
|
12796
|
-
*
|
|
12797
|
-
* @method Diagram#destroy
|
|
12798
13547
|
*/
|
|
12799
13548
|
Diagram.prototype.destroy = function() {
|
|
12800
13549
|
this.get('eventBus').fire('diagram.destroy');
|
|
@@ -20332,6 +21081,10 @@
|
|
|
20332
21081
|
return new BpmnModdle(pks, options);
|
|
20333
21082
|
}
|
|
20334
21083
|
|
|
21084
|
+
/**
|
|
21085
|
+
* @typedef {import('../model/Types').ModdleElement} ModdleElement
|
|
21086
|
+
*/
|
|
21087
|
+
|
|
20335
21088
|
// TODO(nikku): remove with future bpmn-js version
|
|
20336
21089
|
|
|
20337
21090
|
/**
|
|
@@ -20341,6 +21094,10 @@
|
|
|
20341
21094
|
* 2) If Promise class is implemented in current environment.
|
|
20342
21095
|
*
|
|
20343
21096
|
* @private
|
|
21097
|
+
*
|
|
21098
|
+
* @param {Function} api
|
|
21099
|
+
*
|
|
21100
|
+
* @return {Function}
|
|
20344
21101
|
*/
|
|
20345
21102
|
function wrapForCompatibility(api) {
|
|
20346
21103
|
|
|
@@ -20389,6 +21146,11 @@
|
|
|
20389
21146
|
|
|
20390
21147
|
var DI_ERROR_MESSAGE = 'Tried to access di from the businessObject. The di is available through the diagram element only. For more information, see https://github.com/bpmn-io/bpmn-js/issues/1472';
|
|
20391
21148
|
|
|
21149
|
+
/**
|
|
21150
|
+
* @private
|
|
21151
|
+
*
|
|
21152
|
+
* @param {ModdleElement} businessObject
|
|
21153
|
+
*/
|
|
20392
21154
|
function ensureCompatDiRef(businessObject) {
|
|
20393
21155
|
|
|
20394
21156
|
// bpmnElement can have multiple independent DIs
|
|
@@ -20403,10 +21165,16 @@
|
|
|
20403
21165
|
}
|
|
20404
21166
|
|
|
20405
21167
|
/**
|
|
20406
|
-
*
|
|
21168
|
+
* @typedef {import('diagram-js/lib/i18n/translate/translate').default} Translate
|
|
21169
|
+
*
|
|
21170
|
+
* @typedef {import('../model/Types').ModdleElement} ModdleElement
|
|
21171
|
+
*/
|
|
21172
|
+
|
|
21173
|
+
/**
|
|
21174
|
+
* Returns true if an element is of the given meta-model type.
|
|
20407
21175
|
*
|
|
20408
|
-
* @param
|
|
20409
|
-
* @param
|
|
21176
|
+
* @param {ModdleElement} element
|
|
21177
|
+
* @param {string} type
|
|
20410
21178
|
*
|
|
20411
21179
|
* @return {boolean}
|
|
20412
21180
|
*/
|
|
@@ -20418,6 +21186,10 @@
|
|
|
20418
21186
|
/**
|
|
20419
21187
|
* Find a suitable display candidate for definitions where the DI does not
|
|
20420
21188
|
* correctly specify one.
|
|
21189
|
+
*
|
|
21190
|
+
* @param {ModdleElement}
|
|
21191
|
+
*
|
|
21192
|
+
* @return {ModdleElement}
|
|
20421
21193
|
*/
|
|
20422
21194
|
function findDisplayCandidate(definitions) {
|
|
20423
21195
|
return find(definitions.rootElements, function(e) {
|
|
@@ -20425,7 +21197,10 @@
|
|
|
20425
21197
|
});
|
|
20426
21198
|
}
|
|
20427
21199
|
|
|
20428
|
-
|
|
21200
|
+
/**
|
|
21201
|
+
* @param {Function} handler
|
|
21202
|
+
* @param {Translate} translate
|
|
21203
|
+
*/
|
|
20429
21204
|
function BpmnTreeWalker(handler, translate) {
|
|
20430
21205
|
|
|
20431
21206
|
// list of containers already walked
|
|
@@ -20494,7 +21269,7 @@
|
|
|
20494
21269
|
|
|
20495
21270
|
// DI handling //////////////////////
|
|
20496
21271
|
|
|
20497
|
-
function registerDi(di) {
|
|
21272
|
+
var registerDi = this.registerDi = function registerDi(di) {
|
|
20498
21273
|
var bpmnElement = di.bpmnElement;
|
|
20499
21274
|
|
|
20500
21275
|
if (bpmnElement) {
|
|
@@ -20518,7 +21293,7 @@
|
|
|
20518
21293
|
{ element: di }
|
|
20519
21294
|
);
|
|
20520
21295
|
}
|
|
20521
|
-
}
|
|
21296
|
+
};
|
|
20522
21297
|
|
|
20523
21298
|
function handleDiagram(diagram) {
|
|
20524
21299
|
handlePlane(diagram.plane);
|
|
@@ -20538,14 +21313,14 @@
|
|
|
20538
21313
|
// Semantic handling //////////////////////
|
|
20539
21314
|
|
|
20540
21315
|
/**
|
|
20541
|
-
* Handle definitions and return the rendered diagram (if any)
|
|
21316
|
+
* Handle definitions and return the rendered diagram (if any).
|
|
20542
21317
|
*
|
|
20543
21318
|
* @param {ModdleElement} definitions to walk and import
|
|
20544
21319
|
* @param {ModdleElement} [diagram] specific diagram to import and display
|
|
20545
21320
|
*
|
|
20546
21321
|
* @throws {Error} if no diagram to display could be found
|
|
20547
21322
|
*/
|
|
20548
|
-
function handleDefinitions(definitions, diagram) {
|
|
21323
|
+
this.handleDefinitions = function handleDefinitions(definitions, diagram) {
|
|
20549
21324
|
|
|
20550
21325
|
// make sure we walk the correct bpmnElement
|
|
20551
21326
|
|
|
@@ -20622,10 +21397,10 @@
|
|
|
20622
21397
|
}
|
|
20623
21398
|
|
|
20624
21399
|
// handle all deferred elements
|
|
20625
|
-
handleDeferred();
|
|
20626
|
-
}
|
|
21400
|
+
handleDeferred(deferred);
|
|
21401
|
+
};
|
|
20627
21402
|
|
|
20628
|
-
function handleDeferred() {
|
|
21403
|
+
var handleDeferred = this.handleDeferred = function handleDeferred() {
|
|
20629
21404
|
|
|
20630
21405
|
var fn;
|
|
20631
21406
|
|
|
@@ -20635,7 +21410,7 @@
|
|
|
20635
21410
|
|
|
20636
21411
|
fn();
|
|
20637
21412
|
}
|
|
20638
|
-
}
|
|
21413
|
+
};
|
|
20639
21414
|
|
|
20640
21415
|
function handleProcess(process, context) {
|
|
20641
21416
|
handleFlowElementsContainer(process, context);
|
|
@@ -20711,10 +21486,10 @@
|
|
|
20711
21486
|
forEach$1(ioSpecification.dataOutputs, contextual(handleDataOutput, context));
|
|
20712
21487
|
}
|
|
20713
21488
|
|
|
20714
|
-
function handleSubProcess(subProcess, context) {
|
|
21489
|
+
var handleSubProcess = this.handleSubProcess = function handleSubProcess(subProcess, context) {
|
|
20715
21490
|
handleFlowElementsContainer(subProcess, context);
|
|
20716
21491
|
handleArtifacts(subProcess.artifacts, context);
|
|
20717
|
-
}
|
|
21492
|
+
};
|
|
20718
21493
|
|
|
20719
21494
|
function handleFlowNode(flowNode, context) {
|
|
20720
21495
|
var childCtx = visitIfDi(flowNode, context);
|
|
@@ -20839,44 +21614,29 @@
|
|
|
20839
21614
|
}
|
|
20840
21615
|
});
|
|
20841
21616
|
}
|
|
20842
|
-
|
|
20843
|
-
// API //////////////////////
|
|
20844
|
-
|
|
20845
|
-
return {
|
|
20846
|
-
handleDeferred: handleDeferred,
|
|
20847
|
-
handleDefinitions: handleDefinitions,
|
|
20848
|
-
handleSubProcess: handleSubProcess,
|
|
20849
|
-
registerDi: registerDi
|
|
20850
|
-
};
|
|
20851
21617
|
}
|
|
20852
21618
|
|
|
20853
21619
|
/**
|
|
20854
|
-
*
|
|
21620
|
+
* @typedef {import('../model/Types').ModdleElement} ModdleElement
|
|
20855
21621
|
*
|
|
20856
|
-
* @typedef {
|
|
21622
|
+
* @typedef { {
|
|
21623
|
+
* warnings: string[];
|
|
21624
|
+
* } } ImportBPMNDiagramResult
|
|
20857
21625
|
*
|
|
20858
|
-
* @
|
|
21626
|
+
* @typedef {ImportBPMNDiagramResult & Error} ImportBPMNDiagramError
|
|
20859
21627
|
*/
|
|
20860
21628
|
|
|
20861
|
-
/**
|
|
20862
|
-
* The importBpmnDiagram error.
|
|
20863
|
-
*
|
|
20864
|
-
* @typedef {Error} ImportBPMNDiagramError
|
|
20865
|
-
*
|
|
20866
|
-
* @property {Array<string>} warnings
|
|
20867
|
-
*/
|
|
20868
|
-
|
|
20869
21629
|
/**
|
|
20870
21630
|
* Import the definitions into a diagram.
|
|
20871
21631
|
*
|
|
20872
21632
|
* Errors and warnings are reported through the specified callback.
|
|
20873
21633
|
*
|
|
20874
|
-
* @param
|
|
20875
|
-
* @param
|
|
20876
|
-
* @param
|
|
20877
|
-
*
|
|
21634
|
+
* @param {ModdleElement} diagram
|
|
21635
|
+
* @param {ModdleElement} definitions
|
|
21636
|
+
* @param {ModdleElement} [bpmnDiagram] The diagram to be rendered (if not
|
|
21637
|
+
* provided, the first one will be rendered).
|
|
20878
21638
|
*
|
|
20879
|
-
*
|
|
21639
|
+
* @return {Promise<ImportBPMNDiagramResult>}
|
|
20880
21640
|
*/
|
|
20881
21641
|
function importBpmnDiagram(diagram, definitions, bpmnDiagram) {
|
|
20882
21642
|
|
|
@@ -20892,8 +21652,8 @@
|
|
|
20892
21652
|
* Walk the diagram semantically, importing (=drawing)
|
|
20893
21653
|
* all elements you encounter.
|
|
20894
21654
|
*
|
|
20895
|
-
* @param {ModdleElement
|
|
20896
|
-
* @param {ModdleElement
|
|
21655
|
+
* @param {ModdleElement} definitions
|
|
21656
|
+
* @param {ModdleElement} bpmnDiagram
|
|
20897
21657
|
*/
|
|
20898
21658
|
function render(definitions, bpmnDiagram) {
|
|
20899
21659
|
|
|
@@ -20968,10 +21728,10 @@
|
|
|
20968
21728
|
* Returns all diagrams in the same hierarchy as the requested diagram.
|
|
20969
21729
|
* Includes all parent and sub process diagrams.
|
|
20970
21730
|
*
|
|
20971
|
-
* @param {
|
|
20972
|
-
* @param {
|
|
21731
|
+
* @param {ModdleElement} definitions
|
|
21732
|
+
* @param {ModdleElement} bpmnDiagram
|
|
20973
21733
|
*
|
|
20974
|
-
* @
|
|
21734
|
+
* @return {ModdleElement[]}
|
|
20975
21735
|
*/
|
|
20976
21736
|
function getDiagramsToImport(definitions, bpmnDiagram) {
|
|
20977
21737
|
if (!bpmnDiagram) {
|
|
@@ -21165,22 +21925,89 @@
|
|
|
21165
21925
|
* @see http://bpmn.io/license for more information.
|
|
21166
21926
|
*/
|
|
21167
21927
|
|
|
21928
|
+
/**
|
|
21929
|
+
* @template T
|
|
21930
|
+
*
|
|
21931
|
+
* @typedef {import('diagram-js/lib/core/EventBus').EventBusEventCallback<T>} EventBusEventCallback
|
|
21932
|
+
*/
|
|
21168
21933
|
|
|
21169
21934
|
/**
|
|
21170
21935
|
* @typedef {import('didi').ModuleDeclaration} ModuleDeclaration
|
|
21171
21936
|
*
|
|
21172
|
-
* @typedef {import('./
|
|
21173
|
-
* @typedef {import('./
|
|
21174
|
-
* @typedef {import('./
|
|
21175
|
-
*
|
|
21176
|
-
* @typedef {
|
|
21177
|
-
*
|
|
21178
|
-
*
|
|
21179
|
-
*
|
|
21180
|
-
*
|
|
21181
|
-
*
|
|
21182
|
-
*
|
|
21183
|
-
*
|
|
21937
|
+
* @typedef {import('./model/Types').Moddle} Moddle
|
|
21938
|
+
* @typedef {import('./model/Types').ModdleElement} ModdleElement
|
|
21939
|
+
* @typedef {import('./model/Types').ModdleExtension} ModdleExtension
|
|
21940
|
+
*
|
|
21941
|
+
* @typedef { {
|
|
21942
|
+
* width?: number|string;
|
|
21943
|
+
* height?: number|string;
|
|
21944
|
+
* position?: string;
|
|
21945
|
+
* container?: string|HTMLElement;
|
|
21946
|
+
* moddleExtensions?: ModdleExtensions;
|
|
21947
|
+
* additionalModules?: ModuleDeclaration[];
|
|
21948
|
+
* } & Record<string, any> } BaseViewerOptions
|
|
21949
|
+
*
|
|
21950
|
+
* @typedef {Record<string, ModdleElement>} ModdleElementsById
|
|
21951
|
+
*
|
|
21952
|
+
* @typedef { {
|
|
21953
|
+
* [key: string]: ModdleExtension;
|
|
21954
|
+
* } } ModdleExtensions
|
|
21955
|
+
*
|
|
21956
|
+
* @typedef { {
|
|
21957
|
+
* warnings: string[];
|
|
21958
|
+
* } } ImportXMLResult
|
|
21959
|
+
*
|
|
21960
|
+
* @typedef {ImportXMLResult & Error} ImportXMLError
|
|
21961
|
+
*
|
|
21962
|
+
* @typedef {ImportXMLResult} ImportDefinitionsResult
|
|
21963
|
+
*
|
|
21964
|
+
* @typedef {ImportXMLError} ImportDefinitionsError
|
|
21965
|
+
*
|
|
21966
|
+
* @typedef {ImportXMLResult} OpenResult
|
|
21967
|
+
*
|
|
21968
|
+
* @typedef {ImportXMLError} OpenError
|
|
21969
|
+
*
|
|
21970
|
+
* @typedef { {
|
|
21971
|
+
* format?: boolean;
|
|
21972
|
+
* preamble?: boolean;
|
|
21973
|
+
* } } SaveXMLOptions
|
|
21974
|
+
*
|
|
21975
|
+
* @typedef { {
|
|
21976
|
+
* xml?: string;
|
|
21977
|
+
* error?: Error;
|
|
21978
|
+
* } } SaveXMLResult
|
|
21979
|
+
*
|
|
21980
|
+
* @typedef { {
|
|
21981
|
+
* svg: string;
|
|
21982
|
+
* } } SaveSVGResult
|
|
21983
|
+
*
|
|
21984
|
+
* @typedef { {
|
|
21985
|
+
* xml: string;
|
|
21986
|
+
* } } ImportParseStartEvent
|
|
21987
|
+
*
|
|
21988
|
+
* @typedef { {
|
|
21989
|
+
* error?: ImportXMLError;
|
|
21990
|
+
* definitions?: ModdleElement;
|
|
21991
|
+
* elementsById?: ModdleElementsById;
|
|
21992
|
+
* references?: ModdleElement[];
|
|
21993
|
+
* warnings: string[];
|
|
21994
|
+
* } } ImportParseCompleteEvent
|
|
21995
|
+
*
|
|
21996
|
+
* @typedef { {
|
|
21997
|
+
* error?: ImportXMLError;
|
|
21998
|
+
* warnings: string[];
|
|
21999
|
+
* } } ImportDoneEvent
|
|
22000
|
+
*
|
|
22001
|
+
* @typedef { {
|
|
22002
|
+
* definitions: ModdleElement;
|
|
22003
|
+
* } } SaveXMLStartEvent
|
|
22004
|
+
*
|
|
22005
|
+
* @typedef {SaveXMLResult} SaveXMLDoneEvent
|
|
22006
|
+
*
|
|
22007
|
+
* @typedef { {
|
|
22008
|
+
* error?: Error;
|
|
22009
|
+
* svg: string;
|
|
22010
|
+
* } } SaveSVGDoneEvent
|
|
21184
22011
|
*/
|
|
21185
22012
|
|
|
21186
22013
|
/**
|
|
@@ -21189,15 +22016,18 @@
|
|
|
21189
22016
|
* Have a look at {@link Viewer}, {@link NavigatedViewer} or {@link Modeler} for
|
|
21190
22017
|
* bundles that include actual features.
|
|
21191
22018
|
*
|
|
21192
|
-
* @param {
|
|
22019
|
+
* @param {BaseViewerOptions} [options] The options to configure the viewer.
|
|
21193
22020
|
*/
|
|
21194
22021
|
function BaseViewer(options) {
|
|
21195
22022
|
|
|
21196
22023
|
/**
|
|
21197
|
-
* @type {
|
|
22024
|
+
* @type {BaseViewerOptions}
|
|
21198
22025
|
*/
|
|
21199
22026
|
options = assign$1({}, DEFAULT_OPTIONS, options);
|
|
21200
22027
|
|
|
22028
|
+
/**
|
|
22029
|
+
* @type {Moddle}
|
|
22030
|
+
*/
|
|
21201
22031
|
this._moddle = this._createModdle(options);
|
|
21202
22032
|
|
|
21203
22033
|
/**
|
|
@@ -21236,18 +22066,18 @@
|
|
|
21236
22066
|
*
|
|
21237
22067
|
* @throws {ImportXMLError} An error thrown during the import of the XML.
|
|
21238
22068
|
*
|
|
21239
|
-
* @fires BaseViewer#
|
|
21240
|
-
* @fires BaseViewer#
|
|
21241
|
-
* @fires Importer#
|
|
21242
|
-
* @fires Importer#
|
|
21243
|
-
* @fires BaseViewer#
|
|
22069
|
+
* @fires BaseViewer#ImportParseStartEvent
|
|
22070
|
+
* @fires BaseViewer#ImportParseCompleteEvent
|
|
22071
|
+
* @fires Importer#ImportRenderStartEvent
|
|
22072
|
+
* @fires Importer#ImportRenderCompleteEvent
|
|
22073
|
+
* @fires BaseViewer#ImportDoneEvent
|
|
21244
22074
|
*
|
|
21245
22075
|
* @param {string} xml The BPMN 2.0 XML to be imported.
|
|
21246
22076
|
* @param {ModdleElement|string} [bpmnDiagram] The optional diagram or Id of the BPMN diagram to open.
|
|
21247
22077
|
*
|
|
21248
22078
|
* @return {Promise<ImportXMLResult>} A promise resolving with warnings that were produced during the import.
|
|
21249
22079
|
*/
|
|
21250
|
-
BaseViewer.prototype.importXML =
|
|
22080
|
+
BaseViewer.prototype.importXML = async function importXML(xml, bpmnDiagram) {
|
|
21251
22081
|
|
|
21252
22082
|
const self = this;
|
|
21253
22083
|
|
|
@@ -21285,9 +22115,8 @@
|
|
|
21285
22115
|
/**
|
|
21286
22116
|
* A `import.parse.start` event.
|
|
21287
22117
|
*
|
|
21288
|
-
* @event BaseViewer#
|
|
21289
|
-
* @type {
|
|
21290
|
-
* @property {string} xml The XML that is to be parsed.
|
|
22118
|
+
* @event BaseViewer#ImportParseStartEvent
|
|
22119
|
+
* @type {ImportParseStartEvent}
|
|
21291
22120
|
*/
|
|
21292
22121
|
xml = this._emit('import.parse.start', { xml: xml }) || xml;
|
|
21293
22122
|
|
|
@@ -21315,13 +22144,8 @@
|
|
|
21315
22144
|
/**
|
|
21316
22145
|
* A `import.parse.complete` event.
|
|
21317
22146
|
*
|
|
21318
|
-
* @event BaseViewer#
|
|
21319
|
-
* @type {
|
|
21320
|
-
* @property {Error|null} error An error thrown when parsing the XML.
|
|
21321
|
-
* @property {ModdleElement} definitions The definitions model element.
|
|
21322
|
-
* @property {ModdleElementsById} elementsById The model elements by ID.
|
|
21323
|
-
* @property {ModdleElement[]} references The referenced model elements.
|
|
21324
|
-
* @property {string[]} warnings The warnings produced when parsing the XML.
|
|
22147
|
+
* @event BaseViewer#ImportParseCompleteEvent
|
|
22148
|
+
* @type {ImportParseCompleteEvent}
|
|
21325
22149
|
*/
|
|
21326
22150
|
definitions = this._emit('import.parse.complete', ParseCompleteEvent({
|
|
21327
22151
|
error: null,
|
|
@@ -21338,10 +22162,8 @@
|
|
|
21338
22162
|
/**
|
|
21339
22163
|
* A `import.parse.complete` event.
|
|
21340
22164
|
*
|
|
21341
|
-
* @event BaseViewer#
|
|
21342
|
-
* @type {
|
|
21343
|
-
* @property {ImportXMLError|null} error An error thrown during import.
|
|
21344
|
-
* @property {string[]} warnings The warnings.
|
|
22165
|
+
* @event BaseViewer#ImportDoneEvent
|
|
22166
|
+
* @type {ImportDoneEvent}
|
|
21345
22167
|
*/
|
|
21346
22168
|
this._emit('import.done', { error: null, warnings: aggregatedWarnings });
|
|
21347
22169
|
|
|
@@ -21357,7 +22179,9 @@
|
|
|
21357
22179
|
|
|
21358
22180
|
throw error;
|
|
21359
22181
|
}
|
|
21360
|
-
}
|
|
22182
|
+
};
|
|
22183
|
+
|
|
22184
|
+
BaseViewer.prototype.importXML = wrapForCompatibility(BaseViewer.prototype.importXML);
|
|
21361
22185
|
|
|
21362
22186
|
|
|
21363
22187
|
/**
|
|
@@ -21382,12 +22206,14 @@
|
|
|
21382
22206
|
*
|
|
21383
22207
|
* @return {Promise<ImportDefinitionsResult>} A promise resolving with warnings that were produced during the import.
|
|
21384
22208
|
*/
|
|
21385
|
-
BaseViewer.prototype.importDefinitions =
|
|
22209
|
+
BaseViewer.prototype.importDefinitions = async function importDefinitions(definitions, bpmnDiagram) {
|
|
21386
22210
|
this._setDefinitions(definitions);
|
|
21387
22211
|
const result = await this.open(bpmnDiagram);
|
|
21388
22212
|
|
|
21389
22213
|
return { warnings: result.warnings };
|
|
21390
|
-
}
|
|
22214
|
+
};
|
|
22215
|
+
|
|
22216
|
+
BaseViewer.prototype.importDefinitions = wrapForCompatibility(BaseViewer.prototype.importDefinitions);
|
|
21391
22217
|
|
|
21392
22218
|
|
|
21393
22219
|
/**
|
|
@@ -21411,7 +22237,7 @@
|
|
|
21411
22237
|
*
|
|
21412
22238
|
* @return {Promise<OpenResult>} A promise resolving with warnings that were produced during opening.
|
|
21413
22239
|
*/
|
|
21414
|
-
BaseViewer.prototype.open =
|
|
22240
|
+
BaseViewer.prototype.open = async function open(bpmnDiagramOrId) {
|
|
21415
22241
|
|
|
21416
22242
|
const definitions = this._definitions;
|
|
21417
22243
|
let bpmnDiagram = bpmnDiagramOrId;
|
|
@@ -21448,7 +22274,9 @@
|
|
|
21448
22274
|
const { warnings } = await importBpmnDiagram(this, definitions, bpmnDiagram);
|
|
21449
22275
|
|
|
21450
22276
|
return { warnings };
|
|
21451
|
-
}
|
|
22277
|
+
};
|
|
22278
|
+
|
|
22279
|
+
BaseViewer.prototype.open = wrapForCompatibility(BaseViewer.prototype.open);
|
|
21452
22280
|
|
|
21453
22281
|
/**
|
|
21454
22282
|
* Export the currently displayed BPMN 2.0 diagram as
|
|
@@ -21473,7 +22301,7 @@
|
|
|
21473
22301
|
*
|
|
21474
22302
|
* @return {Promise<SaveXMLResult>} A promise resolving with the XML.
|
|
21475
22303
|
*/
|
|
21476
|
-
BaseViewer.prototype.saveXML =
|
|
22304
|
+
BaseViewer.prototype.saveXML = async function saveXML(options) {
|
|
21477
22305
|
|
|
21478
22306
|
options = options || {};
|
|
21479
22307
|
|
|
@@ -21490,9 +22318,8 @@
|
|
|
21490
22318
|
/**
|
|
21491
22319
|
* A `saveXML.start` event.
|
|
21492
22320
|
*
|
|
21493
|
-
* @event BaseViewer#
|
|
21494
|
-
* @type {
|
|
21495
|
-
* @property {ModdleElement} definitions The definitions model element.
|
|
22321
|
+
* @event BaseViewer#SaveXMLStartEvent
|
|
22322
|
+
* @type {SaveXMLStartEvent}
|
|
21496
22323
|
*/
|
|
21497
22324
|
definitions = this._emit('saveXML.start', {
|
|
21498
22325
|
definitions
|
|
@@ -21513,10 +22340,8 @@
|
|
|
21513
22340
|
/**
|
|
21514
22341
|
* A `saveXML.done` event.
|
|
21515
22342
|
*
|
|
21516
|
-
* @event BaseViewer#
|
|
21517
|
-
* @type {
|
|
21518
|
-
* @property {Error} [error] An error thrown when saving the XML.
|
|
21519
|
-
* @property {string} [xml] The saved XML.
|
|
22343
|
+
* @event BaseViewer#SaveXMLDoneEvent
|
|
22344
|
+
* @type {SaveXMLDoneEvent}
|
|
21520
22345
|
*/
|
|
21521
22346
|
this._emit('saveXML.done', result);
|
|
21522
22347
|
|
|
@@ -21525,7 +22350,9 @@
|
|
|
21525
22350
|
}
|
|
21526
22351
|
|
|
21527
22352
|
return result;
|
|
21528
|
-
}
|
|
22353
|
+
};
|
|
22354
|
+
|
|
22355
|
+
BaseViewer.prototype.saveXML = wrapForCompatibility(BaseViewer.prototype.saveXML);
|
|
21529
22356
|
|
|
21530
22357
|
|
|
21531
22358
|
/**
|
|
@@ -21547,7 +22374,7 @@
|
|
|
21547
22374
|
*
|
|
21548
22375
|
* @return {Promise<SaveSVGResult>} A promise resolving with the SVG.
|
|
21549
22376
|
*/
|
|
21550
|
-
BaseViewer.prototype.saveSVG =
|
|
22377
|
+
BaseViewer.prototype.saveSVG = async function saveSVG() {
|
|
21551
22378
|
this._emit('saveSVG.start');
|
|
21552
22379
|
|
|
21553
22380
|
let svg, err;
|
|
@@ -21579,10 +22406,8 @@
|
|
|
21579
22406
|
/**
|
|
21580
22407
|
* A `saveSVG.done` event.
|
|
21581
22408
|
*
|
|
21582
|
-
* @event BaseViewer#
|
|
21583
|
-
* @type {
|
|
21584
|
-
* @property {Error} [error] An error thrown when saving the SVG.
|
|
21585
|
-
* @property {string} [svg] The saved SVG.
|
|
22409
|
+
* @event BaseViewer#SaveSVGDoneEvent
|
|
22410
|
+
* @type {SaveSVGDoneEvent}
|
|
21586
22411
|
*/
|
|
21587
22412
|
this._emit('saveSVG.done', {
|
|
21588
22413
|
error: err,
|
|
@@ -21594,7 +22419,9 @@
|
|
|
21594
22419
|
}
|
|
21595
22420
|
|
|
21596
22421
|
return { svg };
|
|
21597
|
-
}
|
|
22422
|
+
};
|
|
22423
|
+
|
|
22424
|
+
BaseViewer.prototype.saveSVG = wrapForCompatibility(BaseViewer.prototype.saveSVG);
|
|
21598
22425
|
|
|
21599
22426
|
/**
|
|
21600
22427
|
* Get a named diagram service.
|
|
@@ -21676,10 +22503,12 @@
|
|
|
21676
22503
|
*
|
|
21677
22504
|
* Remove an event listener via {@link BaseViewer#off}.
|
|
21678
22505
|
*
|
|
22506
|
+
* @template T
|
|
22507
|
+
*
|
|
21679
22508
|
* @param {string|string[]} events The event(s) to listen to.
|
|
21680
22509
|
* @param {number} [priority] The priority with which to listen.
|
|
21681
|
-
* @param {
|
|
21682
|
-
* @param {
|
|
22510
|
+
* @param {EventBusEventCallback<T>} callback The callback.
|
|
22511
|
+
* @param {any} [that] Value of `this` the callback will be called with.
|
|
21683
22512
|
*/
|
|
21684
22513
|
BaseViewer.prototype.on = function(events, priority, callback, that) {
|
|
21685
22514
|
return this.get('eventBus').on(events, priority, callback, that);
|
|
@@ -21729,7 +22558,7 @@
|
|
|
21729
22558
|
/**
|
|
21730
22559
|
* Get the definitions model element.
|
|
21731
22560
|
*
|
|
21732
|
-
* @
|
|
22561
|
+
* @return {ModdleElement} The definitions model element.
|
|
21733
22562
|
*/
|
|
21734
22563
|
BaseViewer.prototype.getDefinitions = function() {
|
|
21735
22564
|
return this._definitions;
|
|
@@ -21798,6 +22627,11 @@
|
|
|
21798
22627
|
return this.get('eventBus').fire(type, event);
|
|
21799
22628
|
};
|
|
21800
22629
|
|
|
22630
|
+
/**
|
|
22631
|
+
* @param {BaseViewerOptions} options
|
|
22632
|
+
*
|
|
22633
|
+
* @return {HTMLElement}
|
|
22634
|
+
*/
|
|
21801
22635
|
BaseViewer.prototype._createContainer = function(options) {
|
|
21802
22636
|
|
|
21803
22637
|
const container = domify$1('<div class="bjs-container"></div>');
|
|
@@ -21811,6 +22645,11 @@
|
|
|
21811
22645
|
return container;
|
|
21812
22646
|
};
|
|
21813
22647
|
|
|
22648
|
+
/**
|
|
22649
|
+
* @param {BaseViewerOptions} options
|
|
22650
|
+
*
|
|
22651
|
+
* @return {Moddle}
|
|
22652
|
+
*/
|
|
21814
22653
|
BaseViewer.prototype._createModdle = function(options) {
|
|
21815
22654
|
const moddleOptions = assign$1({}, this._moddleExtensions, options.moddleExtensions);
|
|
21816
22655
|
|