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-navigated-viewer
|
|
2
|
+
* bpmn-js - bpmn-navigated-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
|
+
*/
|
|
4953
|
+
|
|
4738
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.
|
|
5370
5611
|
*
|
|
5371
|
-
* @param {
|
|
5372
|
-
*
|
|
5612
|
+
* @param {Element} semantic
|
|
5613
|
+
*
|
|
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.
|
|
5388
5630
|
*
|
|
5389
|
-
* @param {
|
|
5390
|
-
*
|
|
5631
|
+
* @param {Point[]} waypoints
|
|
5632
|
+
*
|
|
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.
|
|
5664
|
+
*
|
|
5665
|
+
* @param {Point[]} waypoints
|
|
5421
5666
|
*
|
|
5422
|
-
* @
|
|
5423
|
-
* @return {Point} the mid point
|
|
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.
|
|
5900
6177
|
*
|
|
5901
|
-
* @
|
|
6178
|
+
* @param {ModdleElement} semantic
|
|
6179
|
+
* @param {'source' | 'target'} side
|
|
6180
|
+
*
|
|
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
|
|
|
@@ -6045,11 +6325,13 @@
|
|
|
6045
6325
|
}
|
|
6046
6326
|
|
|
6047
6327
|
/**
|
|
6048
|
-
* @typedef {import('../../model').
|
|
6328
|
+
* @typedef {import('../../model/Types').Element} Element
|
|
6049
6329
|
*
|
|
6050
6330
|
* @typedef {import('../../core/ElementRegistry').default} ElementRegistry
|
|
6051
6331
|
* @typedef {import('../../core/EventBus').default} EventBus
|
|
6052
6332
|
* @typedef {import('../../draw/Styles').default} Styles
|
|
6333
|
+
*
|
|
6334
|
+
* @typedef {import('../../util/Types').Point} Point
|
|
6053
6335
|
*/
|
|
6054
6336
|
|
|
6055
6337
|
function allowAll(event) { return true; }
|
|
@@ -6093,7 +6375,7 @@
|
|
|
6093
6375
|
*
|
|
6094
6376
|
* @param {string} type local event name, e.g. element.click.
|
|
6095
6377
|
* @param {MouseEvent|TouchEvent} event native event
|
|
6096
|
-
* @param {
|
|
6378
|
+
* @param {Element} [element] the diagram element to emit the event on;
|
|
6097
6379
|
* defaults to the event target
|
|
6098
6380
|
*/
|
|
6099
6381
|
function fire(type, event, element) {
|
|
@@ -6176,7 +6458,7 @@
|
|
|
6176
6458
|
*
|
|
6177
6459
|
* @param {string} eventName the name of the triggered DOM event
|
|
6178
6460
|
* @param {MouseEvent|TouchEvent} event
|
|
6179
|
-
* @param {
|
|
6461
|
+
* @param {Element} targetElement
|
|
6180
6462
|
*/
|
|
6181
6463
|
function triggerMouseEvent(eventName, event, targetElement) {
|
|
6182
6464
|
|
|
@@ -6342,7 +6624,7 @@
|
|
|
6342
6624
|
/**
|
|
6343
6625
|
* Create default hit for the given element.
|
|
6344
6626
|
*
|
|
6345
|
-
* @param {
|
|
6627
|
+
* @param {Element} element
|
|
6346
6628
|
* @param {SVGElement} gfx
|
|
6347
6629
|
*
|
|
6348
6630
|
* @return {SVGElement} created hit
|
|
@@ -6369,7 +6651,7 @@
|
|
|
6369
6651
|
* Create hits for the given waypoints.
|
|
6370
6652
|
*
|
|
6371
6653
|
* @param {SVGElement} gfx
|
|
6372
|
-
* @param {
|
|
6654
|
+
* @param {Point[]} waypoints
|
|
6373
6655
|
*
|
|
6374
6656
|
* @return {SVGElement}
|
|
6375
6657
|
*/
|
|
@@ -6388,7 +6670,7 @@
|
|
|
6388
6670
|
* Create hits for a box.
|
|
6389
6671
|
*
|
|
6390
6672
|
* @param {SVGElement} gfx
|
|
6391
|
-
* @param {string}
|
|
6673
|
+
* @param {string} type
|
|
6392
6674
|
* @param {Object} attrs
|
|
6393
6675
|
*
|
|
6394
6676
|
* @return {SVGElement}
|
|
@@ -6414,7 +6696,7 @@
|
|
|
6414
6696
|
/**
|
|
6415
6697
|
* Update default hit of the element.
|
|
6416
6698
|
*
|
|
6417
|
-
* @param {
|
|
6699
|
+
* @param {Element} element
|
|
6418
6700
|
* @param {SVGElement} gfx
|
|
6419
6701
|
*
|
|
6420
6702
|
* @return {SVGElement} updated hit
|
|
@@ -6463,7 +6745,7 @@
|
|
|
6463
6745
|
* @event element.hover
|
|
6464
6746
|
*
|
|
6465
6747
|
* @type {Object}
|
|
6466
|
-
* @property {
|
|
6748
|
+
* @property {Element} element
|
|
6467
6749
|
* @property {SVGElement} gfx
|
|
6468
6750
|
* @property {Event} originalEvent
|
|
6469
6751
|
*/
|
|
@@ -6474,7 +6756,7 @@
|
|
|
6474
6756
|
* @event element.out
|
|
6475
6757
|
*
|
|
6476
6758
|
* @type {Object}
|
|
6477
|
-
* @property {
|
|
6759
|
+
* @property {Element} element
|
|
6478
6760
|
* @property {SVGElement} gfx
|
|
6479
6761
|
* @property {Event} originalEvent
|
|
6480
6762
|
*/
|
|
@@ -6485,7 +6767,7 @@
|
|
|
6485
6767
|
* @event element.click
|
|
6486
6768
|
*
|
|
6487
6769
|
* @type {Object}
|
|
6488
|
-
* @property {
|
|
6770
|
+
* @property {Element} element
|
|
6489
6771
|
* @property {SVGElement} gfx
|
|
6490
6772
|
* @property {Event} originalEvent
|
|
6491
6773
|
*/
|
|
@@ -6496,7 +6778,7 @@
|
|
|
6496
6778
|
* @event element.dblclick
|
|
6497
6779
|
*
|
|
6498
6780
|
* @type {Object}
|
|
6499
|
-
* @property {
|
|
6781
|
+
* @property {Element} element
|
|
6500
6782
|
* @property {SVGElement} gfx
|
|
6501
6783
|
* @property {Event} originalEvent
|
|
6502
6784
|
*/
|
|
@@ -6507,7 +6789,7 @@
|
|
|
6507
6789
|
* @event element.mousedown
|
|
6508
6790
|
*
|
|
6509
6791
|
* @type {Object}
|
|
6510
|
-
* @property {
|
|
6792
|
+
* @property {Element} element
|
|
6511
6793
|
* @property {SVGElement} gfx
|
|
6512
6794
|
* @property {Event} originalEvent
|
|
6513
6795
|
*/
|
|
@@ -6518,7 +6800,7 @@
|
|
|
6518
6800
|
* @event element.mouseup
|
|
6519
6801
|
*
|
|
6520
6802
|
* @type {Object}
|
|
6521
|
-
* @property {
|
|
6803
|
+
* @property {Element} element
|
|
6522
6804
|
* @property {SVGElement} gfx
|
|
6523
6805
|
* @property {Event} originalEvent
|
|
6524
6806
|
*/
|
|
@@ -6530,11 +6812,14 @@
|
|
|
6530
6812
|
* @event element.contextmenu
|
|
6531
6813
|
*
|
|
6532
6814
|
* @type {Object}
|
|
6533
|
-
* @property {
|
|
6815
|
+
* @property {Element} element
|
|
6534
6816
|
* @property {SVGElement} gfx
|
|
6535
6817
|
* @property {Event} originalEvent
|
|
6536
6818
|
*/
|
|
6537
6819
|
|
|
6820
|
+
/**
|
|
6821
|
+
* @type { import('didi').ModuleDeclaration }
|
|
6822
|
+
*/
|
|
6538
6823
|
var InteractionEventsModule = {
|
|
6539
6824
|
__init__: [ 'interactionEvents' ],
|
|
6540
6825
|
interactionEvents: [ 'type', InteractionEvents ]
|
|
@@ -6544,7 +6829,7 @@
|
|
|
6544
6829
|
* Returns the surrounding bbox for all elements in
|
|
6545
6830
|
* the array or the element primitive.
|
|
6546
6831
|
*
|
|
6547
|
-
* @param {
|
|
6832
|
+
* @param {Element|Element[]} elements
|
|
6548
6833
|
* @param {boolean} [stopRecursion=false]
|
|
6549
6834
|
*
|
|
6550
6835
|
* @return {Rect}
|
|
@@ -6619,7 +6904,7 @@
|
|
|
6619
6904
|
var LOW_PRIORITY$3 = 500;
|
|
6620
6905
|
|
|
6621
6906
|
/**
|
|
6622
|
-
* @typedef {import('../../model').
|
|
6907
|
+
* @typedef {import('../../model/Types').Element} Element
|
|
6623
6908
|
*
|
|
6624
6909
|
* @typedef {import('../../core/EventBus').default} EventBus
|
|
6625
6910
|
* @typedef {import('../../draw/Styles').default} Styles
|
|
@@ -6693,7 +6978,7 @@
|
|
|
6693
6978
|
* element and an outline offset.
|
|
6694
6979
|
*
|
|
6695
6980
|
* @param {SVGElement} outline
|
|
6696
|
-
* @param {
|
|
6981
|
+
* @param {Element} element
|
|
6697
6982
|
*/
|
|
6698
6983
|
Outline.prototype.updateShapeOutline = function(outline, element) {
|
|
6699
6984
|
|
|
@@ -6712,7 +6997,7 @@
|
|
|
6712
6997
|
* the connection and an outline offset.
|
|
6713
6998
|
*
|
|
6714
6999
|
* @param {SVGElement} outline
|
|
6715
|
-
* @param {
|
|
7000
|
+
* @param {Element} connection
|
|
6716
7001
|
*/
|
|
6717
7002
|
Outline.prototype.updateConnectionOutline = function(outline, connection) {
|
|
6718
7003
|
|
|
@@ -6730,12 +7015,16 @@
|
|
|
6730
7015
|
|
|
6731
7016
|
Outline.$inject = [ 'eventBus', 'styles', 'elementRegistry' ];
|
|
6732
7017
|
|
|
7018
|
+
/**
|
|
7019
|
+
* @type { import('didi').ModuleDeclaration }
|
|
7020
|
+
*/
|
|
6733
7021
|
var OutlineModule = {
|
|
6734
7022
|
__init__: [ 'outline' ],
|
|
6735
7023
|
outline: [ 'type', Outline ]
|
|
6736
7024
|
};
|
|
6737
7025
|
|
|
6738
7026
|
/**
|
|
7027
|
+
* @typedef {import('../../core/Canvas').default} Canvas
|
|
6739
7028
|
* @typedef {import('../../core/EventBus').default} EventBus
|
|
6740
7029
|
*/
|
|
6741
7030
|
|
|
@@ -6743,15 +7032,17 @@
|
|
|
6743
7032
|
* A service that offers the current selection in a diagram.
|
|
6744
7033
|
* Offers the api to control the selection, too.
|
|
6745
7034
|
*
|
|
6746
|
-
* @class
|
|
6747
|
-
*
|
|
6748
7035
|
* @param {EventBus} eventBus
|
|
7036
|
+
* @param {Canvas} canvas
|
|
6749
7037
|
*/
|
|
6750
7038
|
function Selection(eventBus, canvas) {
|
|
6751
7039
|
|
|
6752
7040
|
this._eventBus = eventBus;
|
|
6753
7041
|
this._canvas = canvas;
|
|
6754
7042
|
|
|
7043
|
+
/**
|
|
7044
|
+
* @type {Object[]}
|
|
7045
|
+
*/
|
|
6755
7046
|
this._selectedElements = [];
|
|
6756
7047
|
|
|
6757
7048
|
var self = this;
|
|
@@ -6768,7 +7059,11 @@
|
|
|
6768
7059
|
|
|
6769
7060
|
Selection.$inject = [ 'eventBus', 'canvas' ];
|
|
6770
7061
|
|
|
6771
|
-
|
|
7062
|
+
/**
|
|
7063
|
+
* Deselect an element.
|
|
7064
|
+
*
|
|
7065
|
+
* @param {Object} element The element to deselect.
|
|
7066
|
+
*/
|
|
6772
7067
|
Selection.prototype.deselect = function(element) {
|
|
6773
7068
|
var selectedElements = this._selectedElements;
|
|
6774
7069
|
|
|
@@ -6783,26 +7078,33 @@
|
|
|
6783
7078
|
}
|
|
6784
7079
|
};
|
|
6785
7080
|
|
|
6786
|
-
|
|
7081
|
+
/**
|
|
7082
|
+
* Get the selected elements.
|
|
7083
|
+
*
|
|
7084
|
+
* @return {Object[]} The selected elements.
|
|
7085
|
+
*/
|
|
6787
7086
|
Selection.prototype.get = function() {
|
|
6788
7087
|
return this._selectedElements;
|
|
6789
7088
|
};
|
|
6790
7089
|
|
|
7090
|
+
/**
|
|
7091
|
+
* Check whether an element is selected.
|
|
7092
|
+
*
|
|
7093
|
+
* @param {Object} element The element.
|
|
7094
|
+
*
|
|
7095
|
+
* @return {boolean} Whether the element is selected.
|
|
7096
|
+
*/
|
|
6791
7097
|
Selection.prototype.isSelected = function(element) {
|
|
6792
7098
|
return this._selectedElements.indexOf(element) !== -1;
|
|
6793
7099
|
};
|
|
6794
7100
|
|
|
6795
7101
|
|
|
6796
7102
|
/**
|
|
6797
|
-
*
|
|
7103
|
+
* Select one or many elements.
|
|
6798
7104
|
*
|
|
6799
|
-
*
|
|
6800
|
-
*
|
|
6801
|
-
*
|
|
6802
|
-
* @method Selection#select
|
|
6803
|
-
*
|
|
6804
|
-
* @param {Object|Object[]} elements element or array of elements to be selected
|
|
6805
|
-
* @param {boolean} [add] whether the element(s) should be appended to the current selection, defaults to false
|
|
7105
|
+
* @param {Object|Object[]} elements The element(s) to select.
|
|
7106
|
+
* @param {boolean} [add] Whether to add the element(s) to the selected elements.
|
|
7107
|
+
* Defaults to `false`.
|
|
6806
7108
|
*/
|
|
6807
7109
|
Selection.prototype.select = function(elements, add) {
|
|
6808
7110
|
var selectedElements = this._selectedElements,
|
|
@@ -7088,6 +7390,9 @@
|
|
|
7088
7390
|
return !element.hidden;
|
|
7089
7391
|
}
|
|
7090
7392
|
|
|
7393
|
+
/**
|
|
7394
|
+
* @type { import('didi').ModuleDeclaration }
|
|
7395
|
+
*/
|
|
7091
7396
|
var SelectionModule = {
|
|
7092
7397
|
__init__: [ 'selectionVisuals', 'selectionBehavior' ],
|
|
7093
7398
|
__depends__: [
|
|
@@ -7118,7 +7423,7 @@
|
|
|
7118
7423
|
/**
|
|
7119
7424
|
* Returns a next unique ID.
|
|
7120
7425
|
*
|
|
7121
|
-
* @
|
|
7426
|
+
* @return {string} the id
|
|
7122
7427
|
*/
|
|
7123
7428
|
IdGenerator.prototype.next = function() {
|
|
7124
7429
|
return this._prefix + (++this._counter);
|
|
@@ -7134,12 +7439,54 @@
|
|
|
7134
7439
|
* @typedef {import('../../core/ElementRegistry').default} ElementRegistry
|
|
7135
7440
|
* @typedef {import('../../core/EventBus').default} EventBus
|
|
7136
7441
|
*
|
|
7137
|
-
* @typedef {import('
|
|
7138
|
-
*
|
|
7139
|
-
* @typedef {
|
|
7140
|
-
*
|
|
7141
|
-
*
|
|
7142
|
-
*
|
|
7442
|
+
* @typedef {import('../../model/Types').Element} Element
|
|
7443
|
+
*
|
|
7444
|
+
* @typedef { {
|
|
7445
|
+
* minZoom?: number,
|
|
7446
|
+
* maxZoom?: number
|
|
7447
|
+
* } } OverlaysConfigShow
|
|
7448
|
+
*
|
|
7449
|
+
* @typedef { {
|
|
7450
|
+
* min?: number,
|
|
7451
|
+
* max?: number
|
|
7452
|
+
* } } OverlaysConfigScale
|
|
7453
|
+
*
|
|
7454
|
+
* @typedef { {
|
|
7455
|
+
* id: string,
|
|
7456
|
+
* type: string | null,
|
|
7457
|
+
* element: Element | string
|
|
7458
|
+
* } & OverlayAttrs } Overlay
|
|
7459
|
+
*
|
|
7460
|
+
* @typedef { {
|
|
7461
|
+
* html: HTMLElement | string,
|
|
7462
|
+
* position: {
|
|
7463
|
+
* top?: number,
|
|
7464
|
+
* right?: number,
|
|
7465
|
+
* bottom?: number,
|
|
7466
|
+
* left?: number
|
|
7467
|
+
* }
|
|
7468
|
+
* } & OverlaysConfigDefault } OverlayAttrs
|
|
7469
|
+
*
|
|
7470
|
+
* @typedef { {
|
|
7471
|
+
* html: HTMLElement,
|
|
7472
|
+
* element: Element,
|
|
7473
|
+
* overlays: Overlay[]
|
|
7474
|
+
* } } OverlayContainer
|
|
7475
|
+
*
|
|
7476
|
+
* @typedef {{
|
|
7477
|
+
* defaults?: OverlaysConfigDefault
|
|
7478
|
+
* }} OverlaysConfig
|
|
7479
|
+
*
|
|
7480
|
+
* @typedef { {
|
|
7481
|
+
* show?: OverlaysConfigShow,
|
|
7482
|
+
* scale?: OverlaysConfigScale | boolean
|
|
7483
|
+
* } } OverlaysConfigDefault
|
|
7484
|
+
*
|
|
7485
|
+
* @typedef { {
|
|
7486
|
+
* id?: string;
|
|
7487
|
+
* element?: Element | string;
|
|
7488
|
+
* type?: string;
|
|
7489
|
+
* } | string } OverlaysFilter
|
|
7143
7490
|
*/
|
|
7144
7491
|
|
|
7145
7492
|
/**
|
|
@@ -7149,6 +7496,7 @@
|
|
|
7149
7496
|
*
|
|
7150
7497
|
* @example
|
|
7151
7498
|
*
|
|
7499
|
+
* ```javascript
|
|
7152
7500
|
* // add a pink badge on the top left of the shape
|
|
7153
7501
|
*
|
|
7154
7502
|
* overlays.add(someShape, {
|
|
@@ -7178,8 +7526,9 @@
|
|
|
7178
7526
|
* }
|
|
7179
7527
|
* html: '<div style="width: 10px; background: fuchsia; color: white;">0</div>'
|
|
7180
7528
|
* });
|
|
7529
|
+
* ```
|
|
7181
7530
|
*
|
|
7182
|
-
*
|
|
7531
|
+
* ```javascript
|
|
7183
7532
|
* // remove an overlay
|
|
7184
7533
|
*
|
|
7185
7534
|
* var id = overlays.add(...);
|
|
@@ -7201,6 +7550,7 @@
|
|
|
7201
7550
|
* }
|
|
7202
7551
|
* }
|
|
7203
7552
|
* }
|
|
7553
|
+
* ```
|
|
7204
7554
|
*
|
|
7205
7555
|
* @param {OverlaysConfig} config
|
|
7206
7556
|
* @param {EventBus} eventBus
|
|
@@ -7259,6 +7609,7 @@
|
|
|
7259
7609
|
*
|
|
7260
7610
|
* @example
|
|
7261
7611
|
*
|
|
7612
|
+
* ```javascript
|
|
7262
7613
|
* // return the single overlay with the given ID
|
|
7263
7614
|
* overlays.get('some-id');
|
|
7264
7615
|
*
|
|
@@ -7270,6 +7621,7 @@
|
|
|
7270
7621
|
*
|
|
7271
7622
|
* // shape can also be specified as ID
|
|
7272
7623
|
* overlays.get({ element: 'element-id', type: 'badge' });
|
|
7624
|
+
* ```
|
|
7273
7625
|
*
|
|
7274
7626
|
* @param {OverlaysFilter} search The filter to be used to find the overlay(s).
|
|
7275
7627
|
*
|
|
@@ -7307,7 +7659,7 @@
|
|
|
7307
7659
|
/**
|
|
7308
7660
|
* Adds an HTML overlay to an element.
|
|
7309
7661
|
*
|
|
7310
|
-
* @param {
|
|
7662
|
+
* @param {Element|string} element The element to add the overlay to.
|
|
7311
7663
|
* @param {string} [type] An optional type that can be used to filter.
|
|
7312
7664
|
* @param {OverlayAttrs} overlay The overlay.
|
|
7313
7665
|
*
|
|
@@ -7395,7 +7747,7 @@
|
|
|
7395
7747
|
/**
|
|
7396
7748
|
* Checks whether overlays are shown.
|
|
7397
7749
|
*
|
|
7398
|
-
* @
|
|
7750
|
+
* @return {boolean} Whether overlays are shown.
|
|
7399
7751
|
*/
|
|
7400
7752
|
Overlays.prototype.isShown = function() {
|
|
7401
7753
|
return this._overlayRoot.style.display !== 'none';
|
|
@@ -7788,6 +8140,9 @@
|
|
|
7788
8140
|
});
|
|
7789
8141
|
}
|
|
7790
8142
|
|
|
8143
|
+
/**
|
|
8144
|
+
* @type { import('didi').ModuleDeclaration }
|
|
8145
|
+
*/
|
|
7791
8146
|
var OverlaysModule = {
|
|
7792
8147
|
__init__: [ 'overlays' ],
|
|
7793
8148
|
overlays: [ 'type', Overlays ]
|
|
@@ -7864,15 +8219,22 @@
|
|
|
7864
8219
|
'graphicsFactory'
|
|
7865
8220
|
];
|
|
7866
8221
|
|
|
8222
|
+
/**
|
|
8223
|
+
* @type { import('didi').ModuleDeclaration }
|
|
8224
|
+
*/
|
|
7867
8225
|
var ChangeSupportModule = {
|
|
7868
8226
|
__init__: [ 'changeSupport' ],
|
|
7869
8227
|
changeSupport: [ 'type', ChangeSupport ]
|
|
7870
8228
|
};
|
|
7871
8229
|
|
|
7872
8230
|
/**
|
|
8231
|
+
* @typedef {import('../core/Types').ElementLike} ElementLike
|
|
7873
8232
|
* @typedef {import('../core/EventBus').default} EventBus
|
|
7874
|
-
* @typedef {import(./
|
|
7875
|
-
*
|
|
8233
|
+
* @typedef {import('./CommandStack').CommandContext} CommandContext
|
|
8234
|
+
*
|
|
8235
|
+
* @typedef {string|string[]} Events
|
|
8236
|
+
* @typedef { (context: CommandContext) => ElementLike[] | void } HandlerFunction
|
|
8237
|
+
* @typedef { (context: CommandContext) => void } ComposeHandlerFunction
|
|
7876
8238
|
*/
|
|
7877
8239
|
|
|
7878
8240
|
var DEFAULT_PRIORITY$2 = 1000;
|
|
@@ -7884,10 +8246,9 @@
|
|
|
7884
8246
|
* @class
|
|
7885
8247
|
* @constructor
|
|
7886
8248
|
*
|
|
7887
|
-
* @param {EventBus} eventBus
|
|
7888
|
-
*
|
|
7889
8249
|
* @example
|
|
7890
8250
|
*
|
|
8251
|
+
* ```javascript
|
|
7891
8252
|
* import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
7892
8253
|
*
|
|
7893
8254
|
* class CommandLogger extends CommandInterceptor {
|
|
@@ -7898,6 +8259,9 @@
|
|
|
7898
8259
|
* console.log('commandStack.shape-create.preExecute', event);
|
|
7899
8260
|
* });
|
|
7900
8261
|
* }
|
|
8262
|
+
* ```
|
|
8263
|
+
*
|
|
8264
|
+
* @param {EventBus} eventBus
|
|
7901
8265
|
*/
|
|
7902
8266
|
function CommandInterceptor(eventBus) {
|
|
7903
8267
|
|
|
@@ -7915,16 +8279,17 @@
|
|
|
7915
8279
|
};
|
|
7916
8280
|
}
|
|
7917
8281
|
|
|
8282
|
+
|
|
7918
8283
|
/**
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
8284
|
+
* Intercept a command during one of the phases.
|
|
8285
|
+
*
|
|
8286
|
+
* @param {Events} [events] command(s) to intercept
|
|
8287
|
+
* @param {string} [hook] phase to intercept
|
|
8288
|
+
* @param {number} [priority]
|
|
8289
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8290
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8291
|
+
* @param {any} [that]
|
|
8292
|
+
*/
|
|
7928
8293
|
CommandInterceptor.prototype.on = function(events, hook, priority, handlerFn, unwrap, that) {
|
|
7929
8294
|
|
|
7930
8295
|
if (isFunction(hook) || isNumber(hook)) {
|
|
@@ -7966,35 +8331,130 @@
|
|
|
7966
8331
|
});
|
|
7967
8332
|
};
|
|
7968
8333
|
|
|
8334
|
+
/**
|
|
8335
|
+
* Add a <canExecute> phase of command interceptor.
|
|
8336
|
+
*
|
|
8337
|
+
* @param {Events} [events] command(s) to intercept
|
|
8338
|
+
* @param {number} [priority]
|
|
8339
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8340
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8341
|
+
* @param {any} [that]
|
|
8342
|
+
*/
|
|
8343
|
+
CommandInterceptor.prototype.canExecute = createHook('canExecute');
|
|
8344
|
+
|
|
8345
|
+
/**
|
|
8346
|
+
* Add a <preExecute> phase of command interceptor.
|
|
8347
|
+
*
|
|
8348
|
+
* @param {Events} [events] command(s) to intercept
|
|
8349
|
+
* @param {number} [priority]
|
|
8350
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8351
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8352
|
+
* @param {any} [that]
|
|
8353
|
+
*/
|
|
8354
|
+
CommandInterceptor.prototype.preExecute = createHook('preExecute');
|
|
8355
|
+
|
|
8356
|
+
/**
|
|
8357
|
+
* Add a <preExecuted> phase of command interceptor.
|
|
8358
|
+
*
|
|
8359
|
+
* @param {Events} [events] command(s) to intercept
|
|
8360
|
+
* @param {number} [priority]
|
|
8361
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8362
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8363
|
+
* @param {any} [that]
|
|
8364
|
+
*/
|
|
8365
|
+
CommandInterceptor.prototype.preExecuted = createHook('preExecuted');
|
|
7969
8366
|
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
8367
|
+
/**
|
|
8368
|
+
* Add a <execute> phase of command interceptor.
|
|
8369
|
+
*
|
|
8370
|
+
* @param {Events} [events] command(s) to intercept
|
|
8371
|
+
* @param {number} [priority]
|
|
8372
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8373
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8374
|
+
* @param {any} [that]
|
|
8375
|
+
*/
|
|
8376
|
+
CommandInterceptor.prototype.execute = createHook('execute');
|
|
8377
|
+
|
|
8378
|
+
/**
|
|
8379
|
+
* Add a <executed> phase of command interceptor.
|
|
8380
|
+
*
|
|
8381
|
+
* @param {Events} [events] command(s) to intercept
|
|
8382
|
+
* @param {number} [priority]
|
|
8383
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8384
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8385
|
+
* @param {any} [that]
|
|
8386
|
+
*/
|
|
8387
|
+
CommandInterceptor.prototype.executed = createHook('executed');
|
|
8388
|
+
|
|
8389
|
+
/**
|
|
8390
|
+
* Add a <postExecute> phase of command interceptor.
|
|
8391
|
+
*
|
|
8392
|
+
* @param {Events} [events] command(s) to intercept
|
|
8393
|
+
* @param {number} [priority]
|
|
8394
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8395
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8396
|
+
* @param {any} [that]
|
|
8397
|
+
*/
|
|
8398
|
+
CommandInterceptor.prototype.postExecute = createHook('postExecute');
|
|
8399
|
+
|
|
8400
|
+
/**
|
|
8401
|
+
* Add a <postExecuted> phase of command interceptor.
|
|
8402
|
+
*
|
|
8403
|
+
* @param {Events} [events] command(s) to intercept
|
|
8404
|
+
* @param {number} [priority]
|
|
8405
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8406
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8407
|
+
* @param {any} [that]
|
|
8408
|
+
*/
|
|
8409
|
+
CommandInterceptor.prototype.postExecuted = createHook('postExecuted');
|
|
8410
|
+
|
|
8411
|
+
/**
|
|
8412
|
+
* Add a <revert> phase of command interceptor.
|
|
8413
|
+
*
|
|
8414
|
+
* @param {Events} [events] command(s) to intercept
|
|
8415
|
+
* @param {number} [priority]
|
|
8416
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8417
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8418
|
+
* @param {any} [that]
|
|
8419
|
+
*/
|
|
8420
|
+
CommandInterceptor.prototype.revert = createHook('revert');
|
|
8421
|
+
|
|
8422
|
+
/**
|
|
8423
|
+
* Add a <reverted> phase of command interceptor.
|
|
8424
|
+
*
|
|
8425
|
+
* @param {Events} [events] command(s) to intercept
|
|
8426
|
+
* @param {number} [priority]
|
|
8427
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8428
|
+
* @param {boolean} [unwrap] whether the event should be unwrapped
|
|
8429
|
+
* @param {any} [that]
|
|
8430
|
+
*/
|
|
8431
|
+
CommandInterceptor.prototype.reverted = createHook('reverted');
|
|
7981
8432
|
|
|
7982
8433
|
/*
|
|
7983
8434
|
* Add prototype methods for each phase of command execution (e.g. execute,
|
|
7984
8435
|
* revert).
|
|
8436
|
+
*
|
|
8437
|
+
* @param {string} hook
|
|
8438
|
+
*
|
|
8439
|
+
* @return { (
|
|
8440
|
+
* events?: Events,
|
|
8441
|
+
* priority?: number,
|
|
8442
|
+
* handlerFn: ComposeHandlerFunction|HandlerFunction,
|
|
8443
|
+
* unwrap?: boolean
|
|
8444
|
+
* ) => any }
|
|
7985
8445
|
*/
|
|
7986
|
-
|
|
8446
|
+
function createHook(hook) {
|
|
7987
8447
|
|
|
7988
8448
|
/**
|
|
7989
|
-
*
|
|
8449
|
+
* @this {CommandInterceptor}
|
|
7990
8450
|
*
|
|
7991
|
-
* @param {
|
|
7992
|
-
* @param {number} [priority]
|
|
7993
|
-
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
7994
|
-
* @param {boolean} [unwrap]
|
|
7995
|
-
* @param {
|
|
8451
|
+
* @param {Events} [events]
|
|
8452
|
+
* @param {number} [priority]
|
|
8453
|
+
* @param {ComposeHandlerFunction|HandlerFunction} handlerFn
|
|
8454
|
+
* @param {boolean} [unwrap]
|
|
8455
|
+
* @param {any} [that]
|
|
7996
8456
|
*/
|
|
7997
|
-
|
|
8457
|
+
const hookFn = function(events, priority, handlerFn, unwrap, that) {
|
|
7998
8458
|
|
|
7999
8459
|
if (isFunction(events) || isNumber(events)) {
|
|
8000
8460
|
that = unwrap;
|
|
@@ -8006,7 +8466,9 @@
|
|
|
8006
8466
|
|
|
8007
8467
|
this.on(events, hook, priority, handlerFn, unwrap, that);
|
|
8008
8468
|
};
|
|
8009
|
-
|
|
8469
|
+
|
|
8470
|
+
return hookFn;
|
|
8471
|
+
}
|
|
8010
8472
|
|
|
8011
8473
|
/**
|
|
8012
8474
|
* @typedef {import('didi').Injector} Injector
|
|
@@ -8048,6 +8510,9 @@
|
|
|
8048
8510
|
|
|
8049
8511
|
RootElementsBehavior.$inject = [ 'canvas', 'injector' ];
|
|
8050
8512
|
|
|
8513
|
+
/**
|
|
8514
|
+
* @type { import('didi').ModuleDeclaration }
|
|
8515
|
+
*/
|
|
8051
8516
|
var RootElementsModule = {
|
|
8052
8517
|
__init__: [ 'rootElementsBehavior' ],
|
|
8053
8518
|
rootElementsBehavior: [ 'type', RootElementsBehavior ]
|
|
@@ -8055,7 +8520,7 @@
|
|
|
8055
8520
|
|
|
8056
8521
|
/**
|
|
8057
8522
|
* @param {string} str
|
|
8058
|
-
* @
|
|
8523
|
+
* @return {string}
|
|
8059
8524
|
*/
|
|
8060
8525
|
|
|
8061
8526
|
var HTML_ESCAPE_MAP = {
|
|
@@ -8074,14 +8539,19 @@
|
|
|
8074
8539
|
});
|
|
8075
8540
|
}
|
|
8076
8541
|
|
|
8542
|
+
/**
|
|
8543
|
+
* @typedef {import('../model/Types').Element} Element
|
|
8544
|
+
* @typedef {import('../model/Types').ModdleElement} ModdleElement
|
|
8545
|
+
*/
|
|
8546
|
+
|
|
8077
8547
|
var planeSuffix = '_plane';
|
|
8078
8548
|
|
|
8079
8549
|
/**
|
|
8080
8550
|
* Get plane ID for a primary shape.
|
|
8081
8551
|
*
|
|
8082
|
-
* @param {
|
|
8552
|
+
* @param {Element|ModdleElement} element
|
|
8083
8553
|
*
|
|
8084
|
-
* @
|
|
8554
|
+
* @return {string}
|
|
8085
8555
|
*/
|
|
8086
8556
|
function getPlaneIdFromShape(element) {
|
|
8087
8557
|
var id = element.id;
|
|
@@ -8097,32 +8567,40 @@
|
|
|
8097
8567
|
return id + planeSuffix;
|
|
8098
8568
|
}
|
|
8099
8569
|
|
|
8570
|
+
/**
|
|
8571
|
+
* @typedef {import('diagram-js/lib/core/Canvas').default} Canvas
|
|
8572
|
+
* @typedef {import('diagram-js/lib/core/ElementRegistry').default} ElementRegistry
|
|
8573
|
+
* @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
|
|
8574
|
+
*
|
|
8575
|
+
* @typedef {import('../../model/Types').Element} Element
|
|
8576
|
+
* @typedef {import('../../model/Types').Shape} Shape
|
|
8577
|
+
*/
|
|
8578
|
+
|
|
8100
8579
|
var OPEN_CLASS = 'bjs-breadcrumbs-shown';
|
|
8101
8580
|
|
|
8102
8581
|
|
|
8103
8582
|
/**
|
|
8104
8583
|
* Adds overlays that allow switching planes on collapsed subprocesses.
|
|
8105
8584
|
*
|
|
8106
|
-
* @param {
|
|
8107
|
-
* @param {
|
|
8108
|
-
* @param {
|
|
8109
|
-
* @param {canvas} canvas
|
|
8585
|
+
* @param {EventBus} eventBus
|
|
8586
|
+
* @param {ElementRegistry} elementRegistry
|
|
8587
|
+
* @param {Canvas} canvas
|
|
8110
8588
|
*/
|
|
8111
|
-
function DrilldownBreadcrumbs(eventBus, elementRegistry,
|
|
8589
|
+
function DrilldownBreadcrumbs(eventBus, elementRegistry, canvas) {
|
|
8112
8590
|
var breadcrumbs = domify$1('<ul class="bjs-breadcrumbs"></ul>');
|
|
8113
8591
|
var container = canvas.getContainer();
|
|
8114
8592
|
var containerClasses = classes(container);
|
|
8115
8593
|
container.appendChild(breadcrumbs);
|
|
8116
8594
|
|
|
8117
|
-
var
|
|
8595
|
+
var businessObjectParents = [];
|
|
8118
8596
|
|
|
8119
8597
|
// update breadcrumbs if name or ID of the primary shape changes
|
|
8120
|
-
eventBus.on('element.changed', function(
|
|
8121
|
-
var shape =
|
|
8122
|
-
|
|
8598
|
+
eventBus.on('element.changed', function(event) {
|
|
8599
|
+
var shape = event.element,
|
|
8600
|
+
businessObject = getBusinessObject(shape);
|
|
8123
8601
|
|
|
8124
|
-
var isPresent = find(
|
|
8125
|
-
return
|
|
8602
|
+
var isPresent = find(businessObjectParents, function(element) {
|
|
8603
|
+
return element === businessObject;
|
|
8126
8604
|
});
|
|
8127
8605
|
|
|
8128
8606
|
if (!isPresent) {
|
|
@@ -8136,14 +8614,14 @@
|
|
|
8136
8614
|
* Updates the displayed breadcrumbs. If no element is provided, only the
|
|
8137
8615
|
* labels are updated.
|
|
8138
8616
|
*
|
|
8139
|
-
* @param {
|
|
8617
|
+
* @param {Element} [element]
|
|
8140
8618
|
*/
|
|
8141
8619
|
function updateBreadcrumbs(element) {
|
|
8142
8620
|
if (element) {
|
|
8143
|
-
|
|
8621
|
+
businessObjectParents = getBusinessObjectParentChain(element);
|
|
8144
8622
|
}
|
|
8145
8623
|
|
|
8146
|
-
var path =
|
|
8624
|
+
var path = businessObjectParents.map(function(parent) {
|
|
8147
8625
|
var title = escapeHTML(parent.name || parent.id);
|
|
8148
8626
|
var link = domify$1('<li><span class="bjs-crumb"><a title="' + title + '">' + title + '</a></span></li>');
|
|
8149
8627
|
|
|
@@ -8153,8 +8631,9 @@
|
|
|
8153
8631
|
// element in the elementRegisty. Instead, we search for the corresponding participant
|
|
8154
8632
|
if (!parentPlane && is$1(parent, 'bpmn:Process')) {
|
|
8155
8633
|
var participant = elementRegistry.find(function(element) {
|
|
8156
|
-
var
|
|
8157
|
-
|
|
8634
|
+
var businessObject = getBusinessObject(element);
|
|
8635
|
+
|
|
8636
|
+
return businessObject && businessObject.get('processRef') && businessObject.get('processRef') === parent;
|
|
8158
8637
|
});
|
|
8159
8638
|
|
|
8160
8639
|
parentPlane = canvas.findRoot(participant.id);
|
|
@@ -8171,10 +8650,11 @@
|
|
|
8171
8650
|
|
|
8172
8651
|
// show breadcrumbs and expose state to .djs-container
|
|
8173
8652
|
var visible = path.length > 1;
|
|
8653
|
+
|
|
8174
8654
|
containerClasses.toggle(OPEN_CLASS, visible);
|
|
8175
8655
|
|
|
8176
|
-
path.forEach(function(
|
|
8177
|
-
breadcrumbs.appendChild(
|
|
8656
|
+
path.forEach(function(element) {
|
|
8657
|
+
breadcrumbs.appendChild(element);
|
|
8178
8658
|
});
|
|
8179
8659
|
}
|
|
8180
8660
|
|
|
@@ -8184,7 +8664,7 @@
|
|
|
8184
8664
|
|
|
8185
8665
|
}
|
|
8186
8666
|
|
|
8187
|
-
DrilldownBreadcrumbs.$inject = [ 'eventBus', 'elementRegistry', '
|
|
8667
|
+
DrilldownBreadcrumbs.$inject = [ 'eventBus', 'elementRegistry', 'canvas' ];
|
|
8188
8668
|
|
|
8189
8669
|
|
|
8190
8670
|
// helpers //////////
|
|
@@ -8193,16 +8673,16 @@
|
|
|
8193
8673
|
* Returns the parents for the element using the business object chain,
|
|
8194
8674
|
* starting with the root element.
|
|
8195
8675
|
*
|
|
8196
|
-
* @param {
|
|
8676
|
+
* @param {Shape} child
|
|
8197
8677
|
*
|
|
8198
|
-
* @
|
|
8678
|
+
* @return {Shape}
|
|
8199
8679
|
*/
|
|
8200
|
-
function
|
|
8201
|
-
var
|
|
8680
|
+
function getBusinessObjectParentChain(child) {
|
|
8681
|
+
var businessObject = getBusinessObject(child);
|
|
8202
8682
|
|
|
8203
8683
|
var parents = [];
|
|
8204
8684
|
|
|
8205
|
-
for (var element =
|
|
8685
|
+
for (var element = businessObject; element; element = element.$parent) {
|
|
8206
8686
|
if (is$1(element, 'bpmn:SubProcess') || is$1(element, 'bpmn:Process')) {
|
|
8207
8687
|
parents.push(element);
|
|
8208
8688
|
}
|
|
@@ -8211,13 +8691,18 @@
|
|
|
8211
8691
|
return parents.reverse();
|
|
8212
8692
|
}
|
|
8213
8693
|
|
|
8694
|
+
/**
|
|
8695
|
+
* @typedef {import('diagram-js/lib/core/Canvas').default} Canvas
|
|
8696
|
+
* @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
|
|
8697
|
+
*/
|
|
8698
|
+
|
|
8214
8699
|
/**
|
|
8215
8700
|
* Move collapsed subprocesses into view when drilling down.
|
|
8216
8701
|
*
|
|
8217
8702
|
* Zoom and scroll are saved in a session.
|
|
8218
8703
|
*
|
|
8219
|
-
* @param {
|
|
8220
|
-
* @param {
|
|
8704
|
+
* @param {EventBus} eventBus
|
|
8705
|
+
* @param {Canvas} canvas
|
|
8221
8706
|
*/
|
|
8222
8707
|
function DrilldownCentering(eventBus, canvas) {
|
|
8223
8708
|
|
|
@@ -8328,6 +8813,18 @@
|
|
|
8328
8813
|
};
|
|
8329
8814
|
}
|
|
8330
8815
|
|
|
8816
|
+
/**
|
|
8817
|
+
* @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
|
|
8818
|
+
* @typedef {import('../../model/Types').Moddle} Moddle
|
|
8819
|
+
*
|
|
8820
|
+
* @typedef {import('../../model/Types').Element} Element
|
|
8821
|
+
* @typedef {import('../../model/Types').Shape} Shape
|
|
8822
|
+
*
|
|
8823
|
+
* @typedef {import('diagram-js/lib/core/Canvas').CanvasPlane} CanvasPlane
|
|
8824
|
+
*
|
|
8825
|
+
* @typedef {import('diagram-js/lib/util/Types').Rect} Rect
|
|
8826
|
+
*/
|
|
8827
|
+
|
|
8331
8828
|
var DEFAULT_POSITION = {
|
|
8332
8829
|
x: 180,
|
|
8333
8830
|
y: 160
|
|
@@ -8335,10 +8832,10 @@
|
|
|
8335
8832
|
|
|
8336
8833
|
/**
|
|
8337
8834
|
* Hook into `import.render.start` and create new planes for diagrams with
|
|
8338
|
-
* collapsed subprocesses and all
|
|
8835
|
+
* collapsed subprocesses and all DI elements on the same plane.
|
|
8339
8836
|
*
|
|
8340
|
-
* @param {
|
|
8341
|
-
* @param {
|
|
8837
|
+
* @param {EventBus} eventBus
|
|
8838
|
+
* @param {Moddle} moddle
|
|
8342
8839
|
*/
|
|
8343
8840
|
function SubprocessCompatibility(eventBus, moddle) {
|
|
8344
8841
|
this._eventBus = eventBus;
|
|
@@ -8347,11 +8844,14 @@
|
|
|
8347
8844
|
var self = this;
|
|
8348
8845
|
|
|
8349
8846
|
eventBus.on('import.render.start', 1500, function(e, context) {
|
|
8350
|
-
self.
|
|
8847
|
+
self._handleImport(context.definitions);
|
|
8351
8848
|
});
|
|
8352
8849
|
}
|
|
8353
8850
|
|
|
8354
|
-
|
|
8851
|
+
/**
|
|
8852
|
+
* @param {ModdleElement} definitions
|
|
8853
|
+
*/
|
|
8854
|
+
SubprocessCompatibility.prototype._handleImport = function(definitions) {
|
|
8355
8855
|
if (!definitions.diagrams) {
|
|
8356
8856
|
return;
|
|
8357
8857
|
}
|
|
@@ -8370,12 +8870,12 @@
|
|
|
8370
8870
|
|
|
8371
8871
|
var newDiagrams = [];
|
|
8372
8872
|
definitions.diagrams.forEach(function(diagram) {
|
|
8373
|
-
var createdDiagrams = self.
|
|
8873
|
+
var createdDiagrams = self._createNewDiagrams(diagram.plane);
|
|
8374
8874
|
Array.prototype.push.apply(newDiagrams, createdDiagrams);
|
|
8375
8875
|
});
|
|
8376
8876
|
|
|
8377
8877
|
newDiagrams.forEach(function(diagram) {
|
|
8378
|
-
self.
|
|
8878
|
+
self._movePlaneElementsToOrigin(diagram.plane);
|
|
8379
8879
|
});
|
|
8380
8880
|
};
|
|
8381
8881
|
|
|
@@ -8383,29 +8883,30 @@
|
|
|
8383
8883
|
/**
|
|
8384
8884
|
* Moves all DI elements from collapsed subprocesses to a new plane.
|
|
8385
8885
|
*
|
|
8386
|
-
* @param {
|
|
8387
|
-
*
|
|
8886
|
+
* @param {CanvasPlane} plane
|
|
8887
|
+
*
|
|
8888
|
+
* @return {ModdleElement[]} new diagrams created for the collapsed subprocesses
|
|
8388
8889
|
*/
|
|
8389
|
-
SubprocessCompatibility.prototype.
|
|
8890
|
+
SubprocessCompatibility.prototype._createNewDiagrams = function(plane) {
|
|
8390
8891
|
var self = this;
|
|
8391
8892
|
|
|
8392
8893
|
var collapsedElements = [];
|
|
8393
8894
|
var elementsToMove = [];
|
|
8394
8895
|
|
|
8395
8896
|
plane.get('planeElement').forEach(function(diElement) {
|
|
8396
|
-
var
|
|
8897
|
+
var businessObject = diElement.bpmnElement;
|
|
8397
8898
|
|
|
8398
|
-
if (!
|
|
8899
|
+
if (!businessObject) {
|
|
8399
8900
|
return;
|
|
8400
8901
|
}
|
|
8401
8902
|
|
|
8402
|
-
var parent =
|
|
8903
|
+
var parent = businessObject.$parent;
|
|
8403
8904
|
|
|
8404
|
-
if (is$1(
|
|
8405
|
-
collapsedElements.push(
|
|
8905
|
+
if (is$1(businessObject, 'bpmn:SubProcess') && !diElement.isExpanded) {
|
|
8906
|
+
collapsedElements.push(businessObject);
|
|
8406
8907
|
}
|
|
8407
8908
|
|
|
8408
|
-
if (shouldMoveToPlane(
|
|
8909
|
+
if (shouldMoveToPlane(businessObject, plane)) {
|
|
8409
8910
|
|
|
8410
8911
|
// don't change the array while we iterate over it
|
|
8411
8912
|
elementsToMove.push({ diElement: diElement, parent: parent });
|
|
@@ -8416,9 +8917,11 @@
|
|
|
8416
8917
|
|
|
8417
8918
|
// create new planes for all collapsed subprocesses, even when they are empty
|
|
8418
8919
|
collapsedElements.forEach(function(element) {
|
|
8419
|
-
if (!self._processToDiagramMap[element.id]) {
|
|
8420
|
-
var diagram = self.
|
|
8920
|
+
if (!self._processToDiagramMap[ element.id ]) {
|
|
8921
|
+
var diagram = self._createDiagram(element);
|
|
8922
|
+
|
|
8421
8923
|
self._processToDiagramMap[element.id] = diagram;
|
|
8924
|
+
|
|
8422
8925
|
newDiagrams.push(diagram);
|
|
8423
8926
|
}
|
|
8424
8927
|
});
|
|
@@ -8437,14 +8940,18 @@
|
|
|
8437
8940
|
return;
|
|
8438
8941
|
}
|
|
8439
8942
|
|
|
8440
|
-
var diagram = self._processToDiagramMap[parent.id];
|
|
8441
|
-
|
|
8943
|
+
var diagram = self._processToDiagramMap[ parent.id ];
|
|
8944
|
+
|
|
8945
|
+
self._moveToDiPlane(diElement, diagram.plane);
|
|
8442
8946
|
});
|
|
8443
8947
|
|
|
8444
8948
|
return newDiagrams;
|
|
8445
8949
|
};
|
|
8446
8950
|
|
|
8447
|
-
|
|
8951
|
+
/**
|
|
8952
|
+
* @param {CanvasPlane} plane
|
|
8953
|
+
*/
|
|
8954
|
+
SubprocessCompatibility.prototype._movePlaneElementsToOrigin = function(plane) {
|
|
8448
8955
|
var elements = plane.get('planeElement');
|
|
8449
8956
|
|
|
8450
8957
|
// get bounding box of all elements
|
|
@@ -8468,33 +8975,50 @@
|
|
|
8468
8975
|
});
|
|
8469
8976
|
};
|
|
8470
8977
|
|
|
8471
|
-
|
|
8472
|
-
|
|
8978
|
+
/**
|
|
8979
|
+
* @param {ModdleElement} diElement
|
|
8980
|
+
* @param {CanvasPlane} newPlane
|
|
8981
|
+
*/
|
|
8982
|
+
SubprocessCompatibility.prototype._moveToDiPlane = function(diElement, newPlane) {
|
|
8473
8983
|
var containingDiagram = findRootDiagram(diElement);
|
|
8474
8984
|
|
|
8475
8985
|
// remove DI from old Plane and add it to the new one
|
|
8476
8986
|
var parentPlaneElement = containingDiagram.plane.get('planeElement');
|
|
8987
|
+
|
|
8477
8988
|
parentPlaneElement.splice(parentPlaneElement.indexOf(diElement), 1);
|
|
8989
|
+
|
|
8478
8990
|
newPlane.get('planeElement').push(diElement);
|
|
8479
8991
|
};
|
|
8480
8992
|
|
|
8993
|
+
/**
|
|
8994
|
+
* @param {ModdleElement} businessObject
|
|
8995
|
+
*
|
|
8996
|
+
* @return {ModdleElement}
|
|
8997
|
+
*/
|
|
8998
|
+
SubprocessCompatibility.prototype._createDiagram = function(businessObject) {
|
|
8999
|
+
var plane = this._moddle.create('bpmndi:BPMNPlane', {
|
|
9000
|
+
bpmnElement: businessObject
|
|
9001
|
+
});
|
|
8481
9002
|
|
|
8482
|
-
SubprocessCompatibility.prototype.createDiagram = function(bo) {
|
|
8483
|
-
var plane = this._moddle.create('bpmndi:BPMNPlane', { bpmnElement: bo });
|
|
8484
9003
|
var diagram = this._moddle.create('bpmndi:BPMNDiagram', {
|
|
8485
9004
|
plane: plane
|
|
8486
9005
|
});
|
|
9006
|
+
|
|
8487
9007
|
plane.$parent = diagram;
|
|
8488
|
-
|
|
9008
|
+
|
|
9009
|
+
plane.bpmnElement = businessObject;
|
|
9010
|
+
|
|
8489
9011
|
diagram.$parent = this._definitions;
|
|
9012
|
+
|
|
8490
9013
|
this._definitions.diagrams.push(diagram);
|
|
9014
|
+
|
|
8491
9015
|
return diagram;
|
|
8492
9016
|
};
|
|
8493
9017
|
|
|
8494
9018
|
SubprocessCompatibility.$inject = [ 'eventBus', 'moddle' ];
|
|
8495
9019
|
|
|
8496
9020
|
|
|
8497
|
-
// helpers
|
|
9021
|
+
// helpers //////////
|
|
8498
9022
|
|
|
8499
9023
|
function findRootDiagram(element) {
|
|
8500
9024
|
if (is$1(element, 'bpmndi:BPMNDiagram')) {
|
|
@@ -8504,6 +9028,11 @@
|
|
|
8504
9028
|
}
|
|
8505
9029
|
}
|
|
8506
9030
|
|
|
9031
|
+
/**
|
|
9032
|
+
* @param {CanvasPlane} plane
|
|
9033
|
+
*
|
|
9034
|
+
* @return {Rect}
|
|
9035
|
+
*/
|
|
8507
9036
|
function getPlaneBounds(plane) {
|
|
8508
9037
|
var planeTrbl = {
|
|
8509
9038
|
top: Infinity,
|
|
@@ -8526,8 +9055,14 @@
|
|
|
8526
9055
|
return asBounds(planeTrbl);
|
|
8527
9056
|
}
|
|
8528
9057
|
|
|
8529
|
-
|
|
8530
|
-
|
|
9058
|
+
/**
|
|
9059
|
+
* @param {ModdleElement} businessObject
|
|
9060
|
+
* @param {CanvasPlane} plane
|
|
9061
|
+
*
|
|
9062
|
+
* @return {boolean}
|
|
9063
|
+
*/
|
|
9064
|
+
function shouldMoveToPlane(businessObject, plane) {
|
|
9065
|
+
var parent = businessObject.$parent;
|
|
8531
9066
|
|
|
8532
9067
|
// don't move elements that are already on the plane
|
|
8533
9068
|
if (!is$1(parent, 'bpmn:SubProcess') || parent === plane.bpmnElement) {
|
|
@@ -8536,18 +9071,35 @@
|
|
|
8536
9071
|
|
|
8537
9072
|
// dataAssociations are children of the subprocess but rendered on process level
|
|
8538
9073
|
// cf. https://github.com/bpmn-io/bpmn-js/issues/1619
|
|
8539
|
-
if (isAny(
|
|
9074
|
+
if (isAny(businessObject, [ 'bpmn:DataInputAssociation', 'bpmn:DataOutputAssociation' ])) {
|
|
8540
9075
|
return false;
|
|
8541
9076
|
}
|
|
8542
9077
|
|
|
8543
9078
|
return true;
|
|
8544
9079
|
}
|
|
8545
9080
|
|
|
9081
|
+
/**
|
|
9082
|
+
* @typedef {import('diagram-js/lib/core/Canvas').default} Canvas
|
|
9083
|
+
* @typedef {import('diagram-js/lib/core/ElementRegistry').default} ElementRegistry
|
|
9084
|
+
* @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
|
|
9085
|
+
* @typedef {import('diagram-js/lib/features/overlays/Overlays').default} Overlays
|
|
9086
|
+
*
|
|
9087
|
+
* @typedef {import('../../model/Types').Element} Element
|
|
9088
|
+
* @typedef {import('../../model/Types').Parent} Parent
|
|
9089
|
+
* @typedef {import('../../model/Types').Shape} Shape
|
|
9090
|
+
*/
|
|
9091
|
+
|
|
8546
9092
|
var LOW_PRIORITY$1 = 250;
|
|
8547
9093
|
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>';
|
|
8548
9094
|
|
|
8549
9095
|
var EMPTY_MARKER = 'bjs-drilldown-empty';
|
|
8550
9096
|
|
|
9097
|
+
/**
|
|
9098
|
+
* @param {Canvas} canvas
|
|
9099
|
+
* @param {EventBus} eventBus
|
|
9100
|
+
* @param {ElementRegistry} elementRegistry
|
|
9101
|
+
* @param {Overlays} overlays
|
|
9102
|
+
*/
|
|
8551
9103
|
function DrilldownOverlayBehavior(
|
|
8552
9104
|
canvas, eventBus, elementRegistry, overlays
|
|
8553
9105
|
) {
|
|
@@ -8564,10 +9116,10 @@
|
|
|
8564
9116
|
var shape = context.shape;
|
|
8565
9117
|
|
|
8566
9118
|
// Add overlay to the collapsed shape
|
|
8567
|
-
if (self.
|
|
8568
|
-
self.
|
|
9119
|
+
if (self._canDrillDown(shape)) {
|
|
9120
|
+
self._addOverlay(shape);
|
|
8569
9121
|
} else {
|
|
8570
|
-
self.
|
|
9122
|
+
self._removeOverlay(shape);
|
|
8571
9123
|
}
|
|
8572
9124
|
}, true);
|
|
8573
9125
|
|
|
@@ -8576,10 +9128,10 @@
|
|
|
8576
9128
|
var shape = context.shape;
|
|
8577
9129
|
|
|
8578
9130
|
// Add overlay to the collapsed shape
|
|
8579
|
-
if (self.
|
|
8580
|
-
self.
|
|
9131
|
+
if (self._canDrillDown(shape)) {
|
|
9132
|
+
self._addOverlay(shape);
|
|
8581
9133
|
} else {
|
|
8582
|
-
self.
|
|
9134
|
+
self._removeOverlay(shape);
|
|
8583
9135
|
}
|
|
8584
9136
|
}, true);
|
|
8585
9137
|
|
|
@@ -8591,13 +9143,13 @@
|
|
|
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
|
|
|
@@ -8608,21 +9160,21 @@
|
|
|
8608
9160
|
shape = context.shape;
|
|
8609
9161
|
|
|
8610
9162
|
// Add overlay to the collapsed shape
|
|
8611
|
-
if (self.
|
|
8612
|
-
self.
|
|
9163
|
+
if (self._canDrillDown(shape)) {
|
|
9164
|
+
self._addOverlay(shape);
|
|
8613
9165
|
}
|
|
8614
9166
|
|
|
8615
|
-
self.
|
|
8616
|
-
self.
|
|
8617
|
-
self.
|
|
9167
|
+
self._updateDrilldownOverlay(oldParent);
|
|
9168
|
+
self._updateDrilldownOverlay(newParent);
|
|
9169
|
+
self._updateDrilldownOverlay(shape);
|
|
8618
9170
|
}, true);
|
|
8619
9171
|
|
|
8620
9172
|
|
|
8621
9173
|
eventBus.on('import.render.complete', function() {
|
|
8622
9174
|
elementRegistry.filter(function(e) {
|
|
8623
|
-
return self.
|
|
9175
|
+
return self._canDrillDown(e);
|
|
8624
9176
|
}).map(function(el) {
|
|
8625
|
-
self.
|
|
9177
|
+
self._addOverlay(el);
|
|
8626
9178
|
});
|
|
8627
9179
|
});
|
|
8628
9180
|
|
|
@@ -8630,7 +9182,10 @@
|
|
|
8630
9182
|
|
|
8631
9183
|
e(DrilldownOverlayBehavior, CommandInterceptor);
|
|
8632
9184
|
|
|
8633
|
-
|
|
9185
|
+
/**
|
|
9186
|
+
* @param {Shape} shape
|
|
9187
|
+
*/
|
|
9188
|
+
DrilldownOverlayBehavior.prototype._updateDrilldownOverlay = function(shape) {
|
|
8634
9189
|
var canvas = this._canvas;
|
|
8635
9190
|
|
|
8636
9191
|
if (!shape) {
|
|
@@ -8638,51 +9193,61 @@
|
|
|
8638
9193
|
}
|
|
8639
9194
|
|
|
8640
9195
|
var root = canvas.findRoot(shape);
|
|
9196
|
+
|
|
8641
9197
|
if (root) {
|
|
8642
|
-
this.
|
|
9198
|
+
this._updateOverlayVisibility(root);
|
|
8643
9199
|
}
|
|
8644
9200
|
};
|
|
8645
9201
|
|
|
8646
|
-
|
|
8647
|
-
|
|
9202
|
+
/**
|
|
9203
|
+
* @param {Element} element
|
|
9204
|
+
*
|
|
9205
|
+
* @return {boolean}
|
|
9206
|
+
*/
|
|
9207
|
+
DrilldownOverlayBehavior.prototype._canDrillDown = function(element) {
|
|
8648
9208
|
var canvas = this._canvas;
|
|
9209
|
+
|
|
8649
9210
|
return is$1(element, 'bpmn:SubProcess') && canvas.findRoot(getPlaneIdFromShape(element));
|
|
8650
9211
|
};
|
|
8651
9212
|
|
|
8652
9213
|
/**
|
|
8653
|
-
*
|
|
8654
|
-
* the drilldown will be
|
|
9214
|
+
* Update the visibility of the drilldown overlay. If the plane has no elements,
|
|
9215
|
+
* the drilldown will only be shown when the element is selected.
|
|
8655
9216
|
*
|
|
8656
|
-
* @param {
|
|
9217
|
+
* @param {Parent} element The collapsed root or shape.
|
|
8657
9218
|
*/
|
|
8658
|
-
DrilldownOverlayBehavior.prototype.
|
|
9219
|
+
DrilldownOverlayBehavior.prototype._updateOverlayVisibility = function(element) {
|
|
8659
9220
|
var overlays = this._overlays;
|
|
8660
9221
|
|
|
8661
|
-
var
|
|
9222
|
+
var businessObject = getBusinessObject(element);
|
|
8662
9223
|
|
|
8663
|
-
var overlay = overlays.get({ element:
|
|
9224
|
+
var overlay = overlays.get({ element: businessObject.id, type: 'drilldown' })[0];
|
|
8664
9225
|
|
|
8665
9226
|
if (!overlay) {
|
|
8666
9227
|
return;
|
|
8667
9228
|
}
|
|
8668
9229
|
|
|
8669
|
-
var
|
|
8670
|
-
|
|
9230
|
+
var hasFlowElements = businessObject
|
|
9231
|
+
&& businessObject.get('flowElements')
|
|
9232
|
+
&& businessObject.get('flowElements').length;
|
|
9233
|
+
|
|
9234
|
+
classes(overlay.html).toggle(EMPTY_MARKER, !hasFlowElements);
|
|
8671
9235
|
};
|
|
8672
9236
|
|
|
8673
9237
|
/**
|
|
8674
|
-
*
|
|
8675
|
-
*
|
|
9238
|
+
* Add a drilldown button to the given element assuming the plane has the same
|
|
9239
|
+
* ID as the element.
|
|
8676
9240
|
*
|
|
8677
|
-
* @param {
|
|
9241
|
+
* @param {Shape} element The collapsed shape.
|
|
8678
9242
|
*/
|
|
8679
|
-
DrilldownOverlayBehavior.prototype.
|
|
8680
|
-
var canvas = this._canvas
|
|
8681
|
-
|
|
9243
|
+
DrilldownOverlayBehavior.prototype._addOverlay = function(element) {
|
|
9244
|
+
var canvas = this._canvas,
|
|
9245
|
+
overlays = this._overlays;
|
|
8682
9246
|
|
|
8683
9247
|
var existingOverlays = overlays.get({ element: element, type: 'drilldown' });
|
|
9248
|
+
|
|
8684
9249
|
if (existingOverlays.length) {
|
|
8685
|
-
this.
|
|
9250
|
+
this._removeOverlay(element);
|
|
8686
9251
|
}
|
|
8687
9252
|
|
|
8688
9253
|
var button = domify$1('<button class="bjs-drilldown">' + ARROW_DOWN_SVG + '</button>');
|
|
@@ -8699,10 +9264,10 @@
|
|
|
8699
9264
|
html: button
|
|
8700
9265
|
});
|
|
8701
9266
|
|
|
8702
|
-
this.
|
|
9267
|
+
this._updateOverlayVisibility(element);
|
|
8703
9268
|
};
|
|
8704
9269
|
|
|
8705
|
-
DrilldownOverlayBehavior.prototype.
|
|
9270
|
+
DrilldownOverlayBehavior.prototype._removeOverlay = function(element) {
|
|
8706
9271
|
var overlays = this._overlays;
|
|
8707
9272
|
|
|
8708
9273
|
overlays.remove({
|
|
@@ -9208,7 +9773,6 @@
|
|
|
9208
9773
|
*/
|
|
9209
9774
|
function DefaultRenderer(eventBus, styles) {
|
|
9210
9775
|
|
|
9211
|
-
//
|
|
9212
9776
|
BaseRenderer.call(this, eventBus, DEFAULT_RENDER_PRIORITY);
|
|
9213
9777
|
|
|
9214
9778
|
this.CONNECTION_STYLE = styles.style([ 'no-fill' ], { strokeWidth: 5, stroke: 'fuchsia' });
|
|
@@ -9219,10 +9783,16 @@
|
|
|
9219
9783
|
e(DefaultRenderer, BaseRenderer);
|
|
9220
9784
|
|
|
9221
9785
|
|
|
9786
|
+
/**
|
|
9787
|
+
* @private
|
|
9788
|
+
*/
|
|
9222
9789
|
DefaultRenderer.prototype.canRender = function() {
|
|
9223
9790
|
return true;
|
|
9224
9791
|
};
|
|
9225
9792
|
|
|
9793
|
+
/**
|
|
9794
|
+
* @private
|
|
9795
|
+
*/
|
|
9226
9796
|
DefaultRenderer.prototype.drawShape = function drawShape(visuals, element, attrs) {
|
|
9227
9797
|
var rect = create$1('rect');
|
|
9228
9798
|
|
|
@@ -9244,6 +9814,9 @@
|
|
|
9244
9814
|
return rect;
|
|
9245
9815
|
};
|
|
9246
9816
|
|
|
9817
|
+
/**
|
|
9818
|
+
* @private
|
|
9819
|
+
*/
|
|
9247
9820
|
DefaultRenderer.prototype.drawConnection = function drawConnection(visuals, connection, attrs) {
|
|
9248
9821
|
|
|
9249
9822
|
var line = createLine(connection.waypoints, assign$1({}, this.CONNECTION_STYLE, attrs || {}));
|
|
@@ -9252,6 +9825,9 @@
|
|
|
9252
9825
|
return line;
|
|
9253
9826
|
};
|
|
9254
9827
|
|
|
9828
|
+
/**
|
|
9829
|
+
* @private
|
|
9830
|
+
*/
|
|
9255
9831
|
DefaultRenderer.prototype.getShapePath = function getShapePath(shape) {
|
|
9256
9832
|
|
|
9257
9833
|
var x = shape.x,
|
|
@@ -9270,6 +9846,9 @@
|
|
|
9270
9846
|
return componentsToPath(shapePath);
|
|
9271
9847
|
};
|
|
9272
9848
|
|
|
9849
|
+
/**
|
|
9850
|
+
* @private
|
|
9851
|
+
*/
|
|
9273
9852
|
DefaultRenderer.prototype.getConnectionPath = function getConnectionPath(connection) {
|
|
9274
9853
|
var waypoints = connection.waypoints;
|
|
9275
9854
|
|
|
@@ -9287,7 +9866,6 @@
|
|
|
9287
9866
|
return componentsToPath(connectionPath);
|
|
9288
9867
|
};
|
|
9289
9868
|
|
|
9290
|
-
|
|
9291
9869
|
DefaultRenderer.$inject = [ 'eventBus', 'styles' ];
|
|
9292
9870
|
|
|
9293
9871
|
/**
|
|
@@ -9314,7 +9892,7 @@
|
|
|
9314
9892
|
* Builds a style definition from a className, a list of traits and an object of additional attributes.
|
|
9315
9893
|
*
|
|
9316
9894
|
* @param {string} className
|
|
9317
|
-
* @param {
|
|
9895
|
+
* @param {string[]} traits
|
|
9318
9896
|
* @param {Object} additionalAttrs
|
|
9319
9897
|
*
|
|
9320
9898
|
* @return {Object} the style defintion
|
|
@@ -9328,7 +9906,7 @@
|
|
|
9328
9906
|
/**
|
|
9329
9907
|
* Builds a style definition from a list of traits and an object of additional attributes.
|
|
9330
9908
|
*
|
|
9331
|
-
* @param {
|
|
9909
|
+
* @param {string[]} traits
|
|
9332
9910
|
* @param {Object} additionalAttrs
|
|
9333
9911
|
*
|
|
9334
9912
|
* @return {Object} the style defintion
|
|
@@ -9357,6 +9935,9 @@
|
|
|
9357
9935
|
};
|
|
9358
9936
|
}
|
|
9359
9937
|
|
|
9938
|
+
/**
|
|
9939
|
+
* @type { import('didi').ModuleDeclaration }
|
|
9940
|
+
*/
|
|
9360
9941
|
var DrawModule = {
|
|
9361
9942
|
__init__: [ 'defaultRenderer' ],
|
|
9362
9943
|
defaultRenderer: [ 'type', DefaultRenderer ],
|
|
@@ -9438,15 +10019,34 @@
|
|
|
9438
10019
|
}
|
|
9439
10020
|
|
|
9440
10021
|
/**
|
|
9441
|
-
* @typedef {import('
|
|
9442
|
-
* @typedef {import('
|
|
9443
|
-
* @typedef {import('
|
|
10022
|
+
* @typedef {import('./Types').ConnectionLike} ConnectionLike
|
|
10023
|
+
* @typedef {import('./Types').RootLike} RootLike
|
|
10024
|
+
* @typedef {import('./Types').ParentLike } ParentLike
|
|
10025
|
+
* @typedef {import('./Types').ShapeLike} ShapeLike
|
|
9444
10026
|
*
|
|
9445
|
-
* @typedef {
|
|
9446
|
-
*
|
|
9447
|
-
*
|
|
9448
|
-
*
|
|
9449
|
-
*
|
|
10027
|
+
* @typedef { {
|
|
10028
|
+
* container?: HTMLElement;
|
|
10029
|
+
* deferUpdate?: boolean;
|
|
10030
|
+
* width?: number;
|
|
10031
|
+
* height?: number;
|
|
10032
|
+
* } } CanvasConfig
|
|
10033
|
+
* @typedef { {
|
|
10034
|
+
* group: SVGElement;
|
|
10035
|
+
* index: number;
|
|
10036
|
+
* visible: boolean;
|
|
10037
|
+
* } } CanvasLayer
|
|
10038
|
+
* @typedef { {
|
|
10039
|
+
* [key: string]: CanvasLayer;
|
|
10040
|
+
* } } CanvasLayers
|
|
10041
|
+
* @typedef { {
|
|
10042
|
+
* rootElement: ShapeLike;
|
|
10043
|
+
* layer: CanvasLayer;
|
|
10044
|
+
* } } CanvasPlane
|
|
10045
|
+
* @typedef { {
|
|
10046
|
+
* scale: number;
|
|
10047
|
+
* inner: Rect;
|
|
10048
|
+
* outer: Dimensions;
|
|
10049
|
+
* } & Rect } CanvasViewbox
|
|
9450
10050
|
*
|
|
9451
10051
|
* @typedef {import('./ElementRegistry').default} ElementRegistry
|
|
9452
10052
|
* @typedef {import('./EventBus').default} EventBus
|
|
@@ -9787,7 +10387,7 @@
|
|
|
9787
10387
|
/**
|
|
9788
10388
|
* Shows a given layer.
|
|
9789
10389
|
*
|
|
9790
|
-
* @param {string}
|
|
10390
|
+
* @param {string} name The name of the layer.
|
|
9791
10391
|
*
|
|
9792
10392
|
* @return {SVGElement} The SVG element of the layer.
|
|
9793
10393
|
*/
|
|
@@ -9823,7 +10423,7 @@
|
|
|
9823
10423
|
/**
|
|
9824
10424
|
* Hides a given layer.
|
|
9825
10425
|
*
|
|
9826
|
-
* @param {string}
|
|
10426
|
+
* @param {string} name The name of the layer.
|
|
9827
10427
|
*
|
|
9828
10428
|
* @return {SVGElement} The SVG element of the layer.
|
|
9829
10429
|
*/
|
|
@@ -9965,7 +10565,7 @@
|
|
|
9965
10565
|
*
|
|
9966
10566
|
* @event element.marker.update
|
|
9967
10567
|
* @type {Object}
|
|
9968
|
-
* @property {
|
|
10568
|
+
* @property {Element} element the shape
|
|
9969
10569
|
* @property {SVGElement} gfx the graphical representation of the shape
|
|
9970
10570
|
* @property {string} marker
|
|
9971
10571
|
* @property {boolean} add true if the marker was added, false if it got removed
|
|
@@ -10071,7 +10671,7 @@
|
|
|
10071
10671
|
/**
|
|
10072
10672
|
* Adds a given root element and returns it.
|
|
10073
10673
|
*
|
|
10074
|
-
* @param {
|
|
10674
|
+
* @param {RootLike} [rootElement] The root element to be added.
|
|
10075
10675
|
*
|
|
10076
10676
|
* @return {RootLike} The added root element or an implicit root element.
|
|
10077
10677
|
*/
|
|
@@ -10107,9 +10707,9 @@
|
|
|
10107
10707
|
/**
|
|
10108
10708
|
* Removes a given root element and returns it.
|
|
10109
10709
|
*
|
|
10110
|
-
* @param {
|
|
10710
|
+
* @param {RootLike|string} rootElement element or element ID
|
|
10111
10711
|
*
|
|
10112
|
-
* @return {
|
|
10712
|
+
* @return {RootLike|undefined} removed element
|
|
10113
10713
|
*/
|
|
10114
10714
|
Canvas.prototype.removeRootElement = function(rootElement) {
|
|
10115
10715
|
|
|
@@ -10151,11 +10751,7 @@
|
|
|
10151
10751
|
*
|
|
10152
10752
|
* @return {RootLike} The set root element.
|
|
10153
10753
|
*/
|
|
10154
|
-
Canvas.prototype.setRootElement = function(rootElement
|
|
10155
|
-
|
|
10156
|
-
if (isDefined(override)) {
|
|
10157
|
-
throw new Error('override not supported');
|
|
10158
|
-
}
|
|
10754
|
+
Canvas.prototype.setRootElement = function(rootElement) {
|
|
10159
10755
|
|
|
10160
10756
|
if (rootElement === this._rootElement) {
|
|
10161
10757
|
return;
|
|
@@ -10312,7 +10908,7 @@
|
|
|
10312
10908
|
* Adds a shape to the canvas.
|
|
10313
10909
|
*
|
|
10314
10910
|
* @param {ShapeLike} shape The shape to be added
|
|
10315
|
-
* @param {
|
|
10911
|
+
* @param {ParentLike} [parent] The shape's parent.
|
|
10316
10912
|
* @param {number} [parentIndex] The index at which to add the shape to the parent's children.
|
|
10317
10913
|
*
|
|
10318
10914
|
* @return {ShapeLike} The added shape.
|
|
@@ -10325,7 +10921,7 @@
|
|
|
10325
10921
|
* Adds a connection to the canvas.
|
|
10326
10922
|
*
|
|
10327
10923
|
* @param {ConnectionLike} connection The connection to be added.
|
|
10328
|
-
* @param {
|
|
10924
|
+
* @param {ParentLike} [parent] The connection's parent.
|
|
10329
10925
|
* @param {number} [parentIndex] The index at which to add the connection to the parent's children.
|
|
10330
10926
|
*
|
|
10331
10927
|
* @return {ConnectionLike} The added connection.
|
|
@@ -10692,7 +11288,7 @@
|
|
|
10692
11288
|
* The getter may return a cached zoom level. Call it with `false` as the first
|
|
10693
11289
|
* argument to force recomputation of the current level.
|
|
10694
11290
|
*
|
|
10695
|
-
* @param {number|
|
|
11291
|
+
* @param {number|'fit-viewport'} [newScale] The new zoom level, either a number,
|
|
10696
11292
|
* i.e. 0.9, or `fit-viewport` to adjust the size to fit the current viewport.
|
|
10697
11293
|
* @param {Point} [center] The reference point { x: ..., y: ...} to zoom to.
|
|
10698
11294
|
*
|
|
@@ -10887,11 +11483,12 @@
|
|
|
10887
11483
|
var ELEMENT_ID = 'data-element-id';
|
|
10888
11484
|
|
|
10889
11485
|
/**
|
|
10890
|
-
* @typedef {import('
|
|
11486
|
+
* @typedef {import('./Types').ElementLike} ElementLike
|
|
10891
11487
|
*
|
|
10892
11488
|
* @typedef {import('./EventBus').default} EventBus
|
|
10893
11489
|
*
|
|
10894
|
-
* @typedef {
|
|
11490
|
+
* @typedef { (element: ElementLike, gfx: SVGElement) => boolean|any } ElementRegistryFilterCallback
|
|
11491
|
+
* @typedef { (element: ElementLike, gfx: SVGElement) => any } ElementRegistryForEachCallback
|
|
10895
11492
|
*/
|
|
10896
11493
|
|
|
10897
11494
|
/**
|
|
@@ -10903,6 +11500,16 @@
|
|
|
10903
11500
|
* @param {EventBus} eventBus
|
|
10904
11501
|
*/
|
|
10905
11502
|
function ElementRegistry(eventBus) {
|
|
11503
|
+
|
|
11504
|
+
/**
|
|
11505
|
+
* @type { {
|
|
11506
|
+
* [id: string]: {
|
|
11507
|
+
* element: ElementLike;
|
|
11508
|
+
* gfx?: SVGElement;
|
|
11509
|
+
* secondaryGfx?: SVGElement;
|
|
11510
|
+
* }
|
|
11511
|
+
* } }
|
|
11512
|
+
*/
|
|
10906
11513
|
this._elements = {};
|
|
10907
11514
|
|
|
10908
11515
|
this._eventBus = eventBus;
|
|
@@ -10988,7 +11595,7 @@
|
|
|
10988
11595
|
/**
|
|
10989
11596
|
* Update the graphical representation of an element.
|
|
10990
11597
|
*
|
|
10991
|
-
* @param {ElementLike|string}
|
|
11598
|
+
* @param {ElementLike|string} filter The element or its ID.
|
|
10992
11599
|
* @param {SVGElement} gfx The new graphical representation.
|
|
10993
11600
|
* @param {boolean} [secondary=false] Whether to update the secondary graphical representation.
|
|
10994
11601
|
*/
|
|
@@ -11039,7 +11646,7 @@
|
|
|
11039
11646
|
/**
|
|
11040
11647
|
* Return all elements that match a given filter function.
|
|
11041
11648
|
*
|
|
11042
|
-
* @param {
|
|
11649
|
+
* @param {ElementRegistryFilterCallback} fn The filter function.
|
|
11043
11650
|
*
|
|
11044
11651
|
* @return {ElementLike[]} The matching elements.
|
|
11045
11652
|
*/
|
|
@@ -11059,7 +11666,7 @@
|
|
|
11059
11666
|
/**
|
|
11060
11667
|
* Return the first element that matches the given filter function.
|
|
11061
11668
|
*
|
|
11062
|
-
* @param {
|
|
11669
|
+
* @param {ElementRegistryFilterCallback} fn The filter function.
|
|
11063
11670
|
*
|
|
11064
11671
|
* @return {ElementLike|undefined} The matching element.
|
|
11065
11672
|
*/
|
|
@@ -11091,7 +11698,7 @@
|
|
|
11091
11698
|
/**
|
|
11092
11699
|
* Execute a given function for each element.
|
|
11093
11700
|
*
|
|
11094
|
-
* @param {
|
|
11701
|
+
* @param {ElementRegistryForEachCallback} fn The function to execute.
|
|
11095
11702
|
*/
|
|
11096
11703
|
ElementRegistry.prototype.forEach = function(fn) {
|
|
11097
11704
|
|
|
@@ -11478,19 +12085,26 @@
|
|
|
11478
12085
|
outgoingRefs = new Refs({ name: 'outgoing', collection: true }, { name: 'source' }),
|
|
11479
12086
|
incomingRefs = new Refs({ name: 'incoming', collection: true }, { name: 'target' });
|
|
11480
12087
|
|
|
12088
|
+
/**
|
|
12089
|
+
* @typedef {import('./Types').Element} Element
|
|
12090
|
+
* @typedef {import('./Types').Shape} Shape
|
|
12091
|
+
* @typedef {import('./Types').Root} Root
|
|
12092
|
+
* @typedef {import('./Types').Label} Label
|
|
12093
|
+
* @typedef {import('./Types').Connection} Connection
|
|
12094
|
+
*/
|
|
12095
|
+
|
|
11481
12096
|
/**
|
|
11482
12097
|
* The basic graphical representation
|
|
11483
12098
|
*
|
|
11484
12099
|
* @class
|
|
11485
|
-
*
|
|
11486
|
-
* @abstract
|
|
12100
|
+
* @constructor
|
|
11487
12101
|
*/
|
|
11488
|
-
function
|
|
12102
|
+
function ElementImpl() {
|
|
11489
12103
|
|
|
11490
12104
|
/**
|
|
11491
12105
|
* The object that backs up the shape
|
|
11492
12106
|
*
|
|
11493
|
-
* @name
|
|
12107
|
+
* @name Element#businessObject
|
|
11494
12108
|
* @type Object
|
|
11495
12109
|
*/
|
|
11496
12110
|
Object.defineProperty(this, 'businessObject', {
|
|
@@ -11501,7 +12115,7 @@
|
|
|
11501
12115
|
/**
|
|
11502
12116
|
* Single label support, will mapped to multi label array
|
|
11503
12117
|
*
|
|
11504
|
-
* @name
|
|
12118
|
+
* @name Element#label
|
|
11505
12119
|
* @type Object
|
|
11506
12120
|
*/
|
|
11507
12121
|
Object.defineProperty(this, 'label', {
|
|
@@ -11524,7 +12138,7 @@
|
|
|
11524
12138
|
/**
|
|
11525
12139
|
* The parent shape
|
|
11526
12140
|
*
|
|
11527
|
-
* @name
|
|
12141
|
+
* @name Element#parent
|
|
11528
12142
|
* @type Shape
|
|
11529
12143
|
*/
|
|
11530
12144
|
parentRefs.bind(this, 'parent');
|
|
@@ -11532,7 +12146,7 @@
|
|
|
11532
12146
|
/**
|
|
11533
12147
|
* The list of labels
|
|
11534
12148
|
*
|
|
11535
|
-
* @name
|
|
12149
|
+
* @name Element#labels
|
|
11536
12150
|
* @type Label
|
|
11537
12151
|
*/
|
|
11538
12152
|
labelRefs.bind(this, 'labels');
|
|
@@ -11540,7 +12154,7 @@
|
|
|
11540
12154
|
/**
|
|
11541
12155
|
* The list of outgoing connections
|
|
11542
12156
|
*
|
|
11543
|
-
* @name
|
|
12157
|
+
* @name Element#outgoing
|
|
11544
12158
|
* @type Array<Connection>
|
|
11545
12159
|
*/
|
|
11546
12160
|
outgoingRefs.bind(this, 'outgoing');
|
|
@@ -11548,7 +12162,7 @@
|
|
|
11548
12162
|
/**
|
|
11549
12163
|
* The list of incoming connections
|
|
11550
12164
|
*
|
|
11551
|
-
* @name
|
|
12165
|
+
* @name Element#incoming
|
|
11552
12166
|
* @type Array<Connection>
|
|
11553
12167
|
*/
|
|
11554
12168
|
incomingRefs.bind(this, 'incoming');
|
|
@@ -11561,40 +12175,40 @@
|
|
|
11561
12175
|
* @class
|
|
11562
12176
|
* @constructor
|
|
11563
12177
|
*
|
|
11564
|
-
* @extends
|
|
12178
|
+
* @extends ElementImpl
|
|
11565
12179
|
*/
|
|
11566
|
-
function
|
|
11567
|
-
|
|
12180
|
+
function ShapeImpl() {
|
|
12181
|
+
ElementImpl.call(this);
|
|
11568
12182
|
|
|
11569
12183
|
/**
|
|
11570
12184
|
* Indicates frame shapes
|
|
11571
12185
|
*
|
|
11572
|
-
* @name
|
|
12186
|
+
* @name ShapeImpl#isFrame
|
|
11573
12187
|
* @type boolean
|
|
11574
12188
|
*/
|
|
11575
12189
|
|
|
11576
12190
|
/**
|
|
11577
12191
|
* The list of children
|
|
11578
12192
|
*
|
|
11579
|
-
* @name
|
|
11580
|
-
* @type
|
|
12193
|
+
* @name ShapeImpl#children
|
|
12194
|
+
* @type Element[]
|
|
11581
12195
|
*/
|
|
11582
12196
|
parentRefs.bind(this, 'children');
|
|
11583
12197
|
|
|
11584
12198
|
/**
|
|
11585
|
-
* @name
|
|
12199
|
+
* @name ShapeImpl#host
|
|
11586
12200
|
* @type Shape
|
|
11587
12201
|
*/
|
|
11588
12202
|
attacherRefs.bind(this, 'host');
|
|
11589
12203
|
|
|
11590
12204
|
/**
|
|
11591
|
-
* @name
|
|
12205
|
+
* @name ShapeImpl#attachers
|
|
11592
12206
|
* @type Shape
|
|
11593
12207
|
*/
|
|
11594
12208
|
attacherRefs.bind(this, 'attachers');
|
|
11595
12209
|
}
|
|
11596
12210
|
|
|
11597
|
-
e(
|
|
12211
|
+
e(ShapeImpl, ElementImpl);
|
|
11598
12212
|
|
|
11599
12213
|
|
|
11600
12214
|
/**
|
|
@@ -11603,13 +12217,21 @@
|
|
|
11603
12217
|
* @class
|
|
11604
12218
|
* @constructor
|
|
11605
12219
|
*
|
|
11606
|
-
* @extends
|
|
12220
|
+
* @extends ElementImpl
|
|
11607
12221
|
*/
|
|
11608
|
-
function
|
|
11609
|
-
|
|
12222
|
+
function RootImpl() {
|
|
12223
|
+
ElementImpl.call(this);
|
|
12224
|
+
|
|
12225
|
+
/**
|
|
12226
|
+
* The list of children
|
|
12227
|
+
*
|
|
12228
|
+
* @name RootImpl#children
|
|
12229
|
+
* @type Element[]
|
|
12230
|
+
*/
|
|
12231
|
+
parentRefs.bind(this, 'children');
|
|
11610
12232
|
}
|
|
11611
12233
|
|
|
11612
|
-
e(
|
|
12234
|
+
e(RootImpl, ShapeImpl);
|
|
11613
12235
|
|
|
11614
12236
|
|
|
11615
12237
|
/**
|
|
@@ -11618,21 +12240,21 @@
|
|
|
11618
12240
|
* @class
|
|
11619
12241
|
* @constructor
|
|
11620
12242
|
*
|
|
11621
|
-
* @extends
|
|
12243
|
+
* @extends ShapeImpl
|
|
11622
12244
|
*/
|
|
11623
|
-
function
|
|
11624
|
-
|
|
12245
|
+
function LabelImpl() {
|
|
12246
|
+
ShapeImpl.call(this);
|
|
11625
12247
|
|
|
11626
12248
|
/**
|
|
11627
12249
|
* The labeled element
|
|
11628
12250
|
*
|
|
11629
|
-
* @name
|
|
11630
|
-
* @type
|
|
12251
|
+
* @name LabelImpl#labelTarget
|
|
12252
|
+
* @type Element
|
|
11631
12253
|
*/
|
|
11632
12254
|
labelRefs.bind(this, 'labelTarget');
|
|
11633
12255
|
}
|
|
11634
12256
|
|
|
11635
|
-
e(
|
|
12257
|
+
e(LabelImpl, ShapeImpl);
|
|
11636
12258
|
|
|
11637
12259
|
|
|
11638
12260
|
/**
|
|
@@ -11641,45 +12263,69 @@
|
|
|
11641
12263
|
* @class
|
|
11642
12264
|
* @constructor
|
|
11643
12265
|
*
|
|
11644
|
-
* @extends
|
|
12266
|
+
* @extends ElementImpl
|
|
11645
12267
|
*/
|
|
11646
|
-
function
|
|
11647
|
-
|
|
12268
|
+
function ConnectionImpl() {
|
|
12269
|
+
ElementImpl.call(this);
|
|
11648
12270
|
|
|
11649
12271
|
/**
|
|
11650
12272
|
* The element this connection originates from
|
|
11651
12273
|
*
|
|
11652
|
-
* @name
|
|
11653
|
-
* @type
|
|
12274
|
+
* @name ConnectionImpl#source
|
|
12275
|
+
* @type Element
|
|
11654
12276
|
*/
|
|
11655
12277
|
outgoingRefs.bind(this, 'source');
|
|
11656
12278
|
|
|
11657
12279
|
/**
|
|
11658
12280
|
* The element this connection points to
|
|
11659
12281
|
*
|
|
11660
|
-
* @name
|
|
11661
|
-
* @type
|
|
12282
|
+
* @name ConnectionImpl#target
|
|
12283
|
+
* @type Element
|
|
11662
12284
|
*/
|
|
11663
12285
|
incomingRefs.bind(this, 'target');
|
|
11664
12286
|
}
|
|
11665
12287
|
|
|
11666
|
-
e(
|
|
12288
|
+
e(ConnectionImpl, ElementImpl);
|
|
11667
12289
|
|
|
11668
12290
|
|
|
11669
12291
|
var types$6 = {
|
|
11670
|
-
connection:
|
|
11671
|
-
shape:
|
|
11672
|
-
label:
|
|
11673
|
-
root:
|
|
12292
|
+
connection: ConnectionImpl,
|
|
12293
|
+
shape: ShapeImpl,
|
|
12294
|
+
label: LabelImpl,
|
|
12295
|
+
root: RootImpl
|
|
11674
12296
|
};
|
|
11675
12297
|
|
|
11676
12298
|
/**
|
|
11677
|
-
* Creates a
|
|
12299
|
+
* Creates a root element.
|
|
12300
|
+
*
|
|
12301
|
+
* @overlord
|
|
12302
|
+
*
|
|
12303
|
+
* @example
|
|
12304
|
+
*
|
|
12305
|
+
* ```
|
|
12306
|
+
* import * as Model from 'diagram-js/lib/model';
|
|
12307
|
+
*
|
|
12308
|
+
* const root = Model.create('root', {
|
|
12309
|
+
* x: 100,
|
|
12310
|
+
* y: 100,
|
|
12311
|
+
* width: 100,
|
|
12312
|
+
* height: 100
|
|
12313
|
+
* });
|
|
12314
|
+
* ```
|
|
12315
|
+
*
|
|
12316
|
+
* @param {'root'} type
|
|
12317
|
+
* @param {any} [attrs]
|
|
12318
|
+
*
|
|
12319
|
+
* @return {Root}
|
|
12320
|
+
*/
|
|
12321
|
+
/**
|
|
12322
|
+
* Creates a connection.
|
|
11678
12323
|
*
|
|
11679
|
-
* @
|
|
12324
|
+
* @overlord
|
|
11680
12325
|
*
|
|
11681
12326
|
* @example
|
|
11682
12327
|
*
|
|
12328
|
+
* ```
|
|
11683
12329
|
* import * as Model from 'diagram-js/lib/model';
|
|
11684
12330
|
*
|
|
11685
12331
|
* const connection = Model.create('connection', {
|
|
@@ -11688,33 +12334,56 @@
|
|
|
11688
12334
|
* { x: 200, y: 100 }
|
|
11689
12335
|
* ]
|
|
11690
12336
|
* });
|
|
12337
|
+
* ```
|
|
11691
12338
|
*
|
|
11692
|
-
*
|
|
11693
|
-
*
|
|
11694
|
-
* y: 100,
|
|
11695
|
-
* width: 100,
|
|
11696
|
-
* height: 100,
|
|
11697
|
-
* labelTarget: shape
|
|
11698
|
-
* });
|
|
12339
|
+
* @param {'connection'} type
|
|
12340
|
+
* @param {any} [attrs]
|
|
11699
12341
|
*
|
|
11700
|
-
*
|
|
12342
|
+
* @return {Connection}
|
|
12343
|
+
*/
|
|
12344
|
+
/**
|
|
12345
|
+
* Creates a shape.
|
|
12346
|
+
*
|
|
12347
|
+
* @overlord
|
|
12348
|
+
*
|
|
12349
|
+
* @example
|
|
12350
|
+
*
|
|
12351
|
+
* ```
|
|
12352
|
+
* import * as Model from 'diagram-js/lib/model';
|
|
12353
|
+
*
|
|
12354
|
+
* const shape = Model.create('shape', {
|
|
11701
12355
|
* x: 100,
|
|
11702
12356
|
* y: 100,
|
|
11703
12357
|
* width: 100,
|
|
11704
12358
|
* height: 100
|
|
11705
12359
|
* });
|
|
12360
|
+
* ```
|
|
11706
12361
|
*
|
|
11707
|
-
*
|
|
12362
|
+
* @param {'shape'} type
|
|
12363
|
+
* @param {any} [attrs]
|
|
12364
|
+
*
|
|
12365
|
+
* @return {Shape}
|
|
12366
|
+
*/
|
|
12367
|
+
/**
|
|
12368
|
+
* Creates a label.
|
|
12369
|
+
*
|
|
12370
|
+
* @example
|
|
12371
|
+
*
|
|
12372
|
+
* ```
|
|
12373
|
+
* import * as Model from 'diagram-js/lib/model';
|
|
12374
|
+
*
|
|
12375
|
+
* const label = Model.create('label', {
|
|
11708
12376
|
* x: 100,
|
|
11709
12377
|
* y: 100,
|
|
11710
12378
|
* width: 100,
|
|
11711
|
-
* height: 100
|
|
12379
|
+
* height: 100,
|
|
12380
|
+
* labelTarget: shape
|
|
11712
12381
|
* });
|
|
12382
|
+
* ```
|
|
11713
12383
|
*
|
|
11714
|
-
* @param {
|
|
11715
|
-
* @param {
|
|
11716
|
-
*
|
|
11717
|
-
* @return {Connection|Label|Root|Shape} The created model element.
|
|
12384
|
+
* @param {'label'} type
|
|
12385
|
+
* @param {any} [attrs]
|
|
12386
|
+
* @return {Label}
|
|
11718
12387
|
*/
|
|
11719
12388
|
function create(type, attrs) {
|
|
11720
12389
|
var Type = types$6[type];
|
|
@@ -11725,22 +12394,20 @@
|
|
|
11725
12394
|
}
|
|
11726
12395
|
|
|
11727
12396
|
/**
|
|
11728
|
-
* @typedef {import('../model/
|
|
11729
|
-
* @typedef {import('../model/
|
|
11730
|
-
* @typedef {import('../model/
|
|
11731
|
-
* @typedef {import('../model/
|
|
11732
|
-
* @typedef {import('../model/
|
|
11733
|
-
* @typedef {import('../model/index').ModelAttrsConnection} ModelAttrsConnection
|
|
11734
|
-
* @typedef {import('../model/index').ModelAttrsLabel} ModelAttrsLabel
|
|
11735
|
-
* @typedef {import('../model/index').ModelAttrsRoot} ModelAttrsRoot
|
|
11736
|
-
* @typedef {import('../model/index').ModelAttrsShape} ModelAttrsShape
|
|
12397
|
+
* @typedef {import('../model/Types').Element} Element
|
|
12398
|
+
* @typedef {import('../model/Types').Connection} Connection
|
|
12399
|
+
* @typedef {import('../model/Types').Label} Label
|
|
12400
|
+
* @typedef {import('../model/Types').Root} Root
|
|
12401
|
+
* @typedef {import('../model/Types').Shape} Shape
|
|
11737
12402
|
*/
|
|
11738
12403
|
|
|
11739
12404
|
/**
|
|
11740
12405
|
* A factory for model elements.
|
|
11741
12406
|
*
|
|
11742
|
-
* @
|
|
11743
|
-
* @
|
|
12407
|
+
* @template {Connection} [T=Connection]
|
|
12408
|
+
* @template {Label} [U=Label]
|
|
12409
|
+
* @template {Root} [V=Root]
|
|
12410
|
+
* @template {Shape} [W=Shape]
|
|
11744
12411
|
*/
|
|
11745
12412
|
function ElementFactory() {
|
|
11746
12413
|
this._uid = 12;
|
|
@@ -11749,9 +12416,9 @@
|
|
|
11749
12416
|
/**
|
|
11750
12417
|
* Create a root element.
|
|
11751
12418
|
*
|
|
11752
|
-
* @param {
|
|
12419
|
+
* @param {Partial<Root>} [attrs]
|
|
11753
12420
|
*
|
|
11754
|
-
* @return {
|
|
12421
|
+
* @return {V} The created root element.
|
|
11755
12422
|
*/
|
|
11756
12423
|
ElementFactory.prototype.createRoot = function(attrs) {
|
|
11757
12424
|
return this.create('root', attrs);
|
|
@@ -11760,9 +12427,9 @@
|
|
|
11760
12427
|
/**
|
|
11761
12428
|
* Create a label.
|
|
11762
12429
|
*
|
|
11763
|
-
* @param {
|
|
12430
|
+
* @param {Partial<Label>} [attrs]
|
|
11764
12431
|
*
|
|
11765
|
-
* @return {
|
|
12432
|
+
* @return {U} The created label.
|
|
11766
12433
|
*/
|
|
11767
12434
|
ElementFactory.prototype.createLabel = function(attrs) {
|
|
11768
12435
|
return this.create('label', attrs);
|
|
@@ -11771,9 +12438,9 @@
|
|
|
11771
12438
|
/**
|
|
11772
12439
|
* Create a shape.
|
|
11773
12440
|
*
|
|
11774
|
-
* @param {
|
|
12441
|
+
* @param {Partial<Shape>} [attrs]
|
|
11775
12442
|
*
|
|
11776
|
-
* @return {
|
|
12443
|
+
* @return {W} The created shape.
|
|
11777
12444
|
*/
|
|
11778
12445
|
ElementFactory.prototype.createShape = function(attrs) {
|
|
11779
12446
|
return this.create('shape', attrs);
|
|
@@ -11782,21 +12449,44 @@
|
|
|
11782
12449
|
/**
|
|
11783
12450
|
* Create a connection.
|
|
11784
12451
|
*
|
|
11785
|
-
* @param {
|
|
12452
|
+
* @param {Partial<Connection>} [attrs]
|
|
11786
12453
|
*
|
|
11787
|
-
* @return {
|
|
12454
|
+
* @return {T} The created connection.
|
|
11788
12455
|
*/
|
|
11789
12456
|
ElementFactory.prototype.createConnection = function(attrs) {
|
|
11790
12457
|
return this.create('connection', attrs);
|
|
11791
12458
|
};
|
|
11792
12459
|
|
|
11793
12460
|
/**
|
|
11794
|
-
* Create a
|
|
12461
|
+
* Create a root element.
|
|
12462
|
+
*
|
|
12463
|
+
* @overlord
|
|
12464
|
+
* @param {'root'} type
|
|
12465
|
+
* @param {Partial<Root>} [attrs]
|
|
12466
|
+
* @return {V}
|
|
12467
|
+
*/
|
|
12468
|
+
/**
|
|
12469
|
+
* Create a shape.
|
|
12470
|
+
*
|
|
12471
|
+
* @overlord
|
|
12472
|
+
* @param {'shape'} type
|
|
12473
|
+
* @param {Partial<Shape>} [attrs]
|
|
12474
|
+
* @return {W}
|
|
12475
|
+
*/
|
|
12476
|
+
/**
|
|
12477
|
+
* Create a connection.
|
|
11795
12478
|
*
|
|
11796
|
-
* @
|
|
11797
|
-
* @param {
|
|
12479
|
+
* @overlord
|
|
12480
|
+
* @param {'connection'} type
|
|
12481
|
+
* @param {Partial<Connection>} [attrs]
|
|
12482
|
+
* @return {T}
|
|
12483
|
+
*/
|
|
12484
|
+
/**
|
|
12485
|
+
* Create a label.
|
|
11798
12486
|
*
|
|
11799
|
-
* @
|
|
12487
|
+
* @param {'label'} type
|
|
12488
|
+
* @param {Partial<Label>} [attrs]
|
|
12489
|
+
* @return {U}
|
|
11800
12490
|
*/
|
|
11801
12491
|
ElementFactory.prototype.create = function(type, attrs) {
|
|
11802
12492
|
|
|
@@ -11816,13 +12506,27 @@
|
|
|
11816
12506
|
var slice = Array.prototype.slice;
|
|
11817
12507
|
|
|
11818
12508
|
/**
|
|
11819
|
-
* @typedef {
|
|
11820
|
-
*
|
|
12509
|
+
* @typedef { {
|
|
12510
|
+
* stopPropagation(): void;
|
|
12511
|
+
* preventDefault(): void;
|
|
12512
|
+
* cancelBubble: boolean;
|
|
12513
|
+
* defaultPrevented: boolean;
|
|
12514
|
+
* returnValue: any;
|
|
12515
|
+
* } } Event
|
|
12516
|
+
*/
|
|
12517
|
+
|
|
12518
|
+
/**
|
|
12519
|
+
* @template E
|
|
11821
12520
|
*
|
|
11822
|
-
* @typedef {
|
|
11823
|
-
|
|
11824
|
-
|
|
11825
|
-
|
|
12521
|
+
* @typedef { (event: E & Event, ...any) => any } EventBusEventCallback
|
|
12522
|
+
*/
|
|
12523
|
+
|
|
12524
|
+
/**
|
|
12525
|
+
* @typedef { {
|
|
12526
|
+
* priority: number;
|
|
12527
|
+
* next: EventBusListener | null;
|
|
12528
|
+
* callback: EventBusEventCallback<any>;
|
|
12529
|
+
* } } EventBusListener
|
|
11826
12530
|
*/
|
|
11827
12531
|
|
|
11828
12532
|
/**
|
|
@@ -11909,6 +12613,10 @@
|
|
|
11909
12613
|
* ```
|
|
11910
12614
|
*/
|
|
11911
12615
|
function EventBus() {
|
|
12616
|
+
|
|
12617
|
+
/**
|
|
12618
|
+
* @type { Record<string, EventBusListener> }
|
|
12619
|
+
*/
|
|
11912
12620
|
this._listeners = {};
|
|
11913
12621
|
|
|
11914
12622
|
// cleanup on destroy on lowest priority to allow
|
|
@@ -11929,10 +12637,12 @@
|
|
|
11929
12637
|
*
|
|
11930
12638
|
* Returning anything but `undefined` from a listener will stop the listener propagation.
|
|
11931
12639
|
*
|
|
11932
|
-
* @
|
|
11933
|
-
*
|
|
11934
|
-
* @param {
|
|
11935
|
-
* @param {
|
|
12640
|
+
* @template T
|
|
12641
|
+
*
|
|
12642
|
+
* @param {string|string[]} events to subscribe to
|
|
12643
|
+
* @param {number} [priority=1000] listen priority
|
|
12644
|
+
* @param {EventBusEventCallback<T>} callback
|
|
12645
|
+
* @param {any} [that] callback context
|
|
11936
12646
|
*/
|
|
11937
12647
|
EventBus.prototype.on = function(events, priority, callback, that) {
|
|
11938
12648
|
|
|
@@ -11974,12 +12684,14 @@
|
|
|
11974
12684
|
/**
|
|
11975
12685
|
* Register an event listener that is called only once.
|
|
11976
12686
|
*
|
|
11977
|
-
* @
|
|
11978
|
-
*
|
|
11979
|
-
* @param {
|
|
11980
|
-
* @param {
|
|
12687
|
+
* @template T
|
|
12688
|
+
*
|
|
12689
|
+
* @param {string|string[]} events to subscribe to
|
|
12690
|
+
* @param {number} [priority=1000] the listen priority
|
|
12691
|
+
* @param {EventBusEventCallback<T>} callback
|
|
12692
|
+
* @param {any} [that] callback context
|
|
11981
12693
|
*/
|
|
11982
|
-
EventBus.prototype.once = function(
|
|
12694
|
+
EventBus.prototype.once = function(events, priority, callback, that) {
|
|
11983
12695
|
var self = this;
|
|
11984
12696
|
|
|
11985
12697
|
if (isFunction(priority)) {
|
|
@@ -11997,7 +12709,7 @@
|
|
|
11997
12709
|
|
|
11998
12710
|
var result = callback.apply(that, arguments);
|
|
11999
12711
|
|
|
12000
|
-
self.off(
|
|
12712
|
+
self.off(events, wrappedCallback);
|
|
12001
12713
|
|
|
12002
12714
|
return result;
|
|
12003
12715
|
}
|
|
@@ -12007,7 +12719,7 @@
|
|
|
12007
12719
|
// callback
|
|
12008
12720
|
wrappedCallback[FN_REF] = callback;
|
|
12009
12721
|
|
|
12010
|
-
this.on(
|
|
12722
|
+
this.on(events, priority, wrappedCallback);
|
|
12011
12723
|
};
|
|
12012
12724
|
|
|
12013
12725
|
|
|
@@ -12016,8 +12728,8 @@
|
|
|
12016
12728
|
*
|
|
12017
12729
|
* If no callback is given, all listeners for a given event name are being removed.
|
|
12018
12730
|
*
|
|
12019
|
-
* @param {string|string[]} events
|
|
12020
|
-
* @param {
|
|
12731
|
+
* @param {string|string[]} events
|
|
12732
|
+
* @param {EventBusEventCallback} [callback]
|
|
12021
12733
|
*/
|
|
12022
12734
|
EventBus.prototype.off = function(events, callback) {
|
|
12023
12735
|
|
|
@@ -12053,6 +12765,7 @@
|
|
|
12053
12765
|
*
|
|
12054
12766
|
* @example
|
|
12055
12767
|
*
|
|
12768
|
+
* ```javascript
|
|
12056
12769
|
* // fire event by name
|
|
12057
12770
|
* events.fire('foo');
|
|
12058
12771
|
*
|
|
@@ -12070,12 +12783,13 @@
|
|
|
12070
12783
|
* });
|
|
12071
12784
|
*
|
|
12072
12785
|
* events.fire({ type: 'foo' }, 'I am bar!');
|
|
12786
|
+
* ```
|
|
12073
12787
|
*
|
|
12074
|
-
* @param {string} [type]
|
|
12075
|
-
* @param {Object} [data]
|
|
12076
|
-
* @param {
|
|
12788
|
+
* @param {string} [type] event type
|
|
12789
|
+
* @param {Object} [data] event or event data
|
|
12790
|
+
* @param {...any} [args] additional arguments the callback will be called with.
|
|
12077
12791
|
*
|
|
12078
|
-
* @return {
|
|
12792
|
+
* @return {any} The return value. Will be set to `false` if the default was prevented.
|
|
12079
12793
|
*/
|
|
12080
12794
|
EventBus.prototype.fire = function(type, data) {
|
|
12081
12795
|
var event,
|
|
@@ -12156,6 +12870,13 @@
|
|
|
12156
12870
|
this._listeners = {};
|
|
12157
12871
|
};
|
|
12158
12872
|
|
|
12873
|
+
/**
|
|
12874
|
+
* @param {Event} event
|
|
12875
|
+
* @param {any[]} args
|
|
12876
|
+
* @param {EventBusListener} listener
|
|
12877
|
+
*
|
|
12878
|
+
* @return {any}
|
|
12879
|
+
*/
|
|
12159
12880
|
EventBus.prototype._invokeListeners = function(event, args, listener) {
|
|
12160
12881
|
|
|
12161
12882
|
var returnValue;
|
|
@@ -12175,6 +12896,13 @@
|
|
|
12175
12896
|
return returnValue;
|
|
12176
12897
|
};
|
|
12177
12898
|
|
|
12899
|
+
/**
|
|
12900
|
+
* @param {Event} event
|
|
12901
|
+
* @param {any[]} args
|
|
12902
|
+
* @param {EventBusListener} listener
|
|
12903
|
+
*
|
|
12904
|
+
* @return {any}
|
|
12905
|
+
*/
|
|
12178
12906
|
EventBus.prototype._invokeListener = function(event, args, listener) {
|
|
12179
12907
|
|
|
12180
12908
|
var returnValue;
|
|
@@ -12223,7 +12951,7 @@
|
|
|
12223
12951
|
* * after: [ 1500, 1500, (new=1300), 1000, 1000, (new=1000) ]
|
|
12224
12952
|
*
|
|
12225
12953
|
* @param {string} event
|
|
12226
|
-
* @param {
|
|
12954
|
+
* @param {EventBusListener} listener
|
|
12227
12955
|
*/
|
|
12228
12956
|
EventBus.prototype._addListener = function(event, newListener) {
|
|
12229
12957
|
|
|
@@ -12263,10 +12991,19 @@
|
|
|
12263
12991
|
};
|
|
12264
12992
|
|
|
12265
12993
|
|
|
12994
|
+
/**
|
|
12995
|
+
* @param {string} name
|
|
12996
|
+
*
|
|
12997
|
+
* @return {EventBusListener}
|
|
12998
|
+
*/
|
|
12266
12999
|
EventBus.prototype._getListeners = function(name) {
|
|
12267
13000
|
return this._listeners[name];
|
|
12268
13001
|
};
|
|
12269
13002
|
|
|
13003
|
+
/**
|
|
13004
|
+
* @param {string} name
|
|
13005
|
+
* @param {EventBusListener} listener
|
|
13006
|
+
*/
|
|
12270
13007
|
EventBus.prototype._setListeners = function(name, listener) {
|
|
12271
13008
|
this._listeners[name] = listener;
|
|
12272
13009
|
};
|
|
@@ -12329,9 +13066,9 @@
|
|
|
12329
13066
|
* Invoke function. Be fast...
|
|
12330
13067
|
*
|
|
12331
13068
|
* @param {Function} fn
|
|
12332
|
-
* @param {
|
|
13069
|
+
* @param {any[]} args
|
|
12333
13070
|
*
|
|
12334
|
-
* @return {
|
|
13071
|
+
* @return {any}
|
|
12335
13072
|
*/
|
|
12336
13073
|
function invokeFunction(fn, args) {
|
|
12337
13074
|
return fn.apply(null, args);
|
|
@@ -12366,13 +13103,9 @@
|
|
|
12366
13103
|
}
|
|
12367
13104
|
|
|
12368
13105
|
/**
|
|
12369
|
-
* @typedef {import('
|
|
12370
|
-
* @typedef {import('
|
|
12371
|
-
* @typedef {import('
|
|
12372
|
-
*
|
|
12373
|
-
* @typedef {import('.').ConnectionLike} ConnectionLike
|
|
12374
|
-
* @typedef {import('.').ElementLike} ElementLike
|
|
12375
|
-
* @typedef {import('.').ShapeLike} ShapeLike
|
|
13106
|
+
* @typedef {import('./Types').ConnectionLike} ConnectionLike
|
|
13107
|
+
* @typedef {import('./Types').ElementLike} ElementLike
|
|
13108
|
+
* @typedef {import('./Types').ShapeLike} ShapeLike
|
|
12376
13109
|
*
|
|
12377
13110
|
* @typedef {import('./ElementRegistry').default} ElementRegistry
|
|
12378
13111
|
* @typedef {import('./EventBus').default} EventBus
|
|
@@ -12391,7 +13124,10 @@
|
|
|
12391
13124
|
|
|
12392
13125
|
GraphicsFactory.$inject = [ 'eventBus' , 'elementRegistry' ];
|
|
12393
13126
|
|
|
12394
|
-
|
|
13127
|
+
/**
|
|
13128
|
+
* @param { { parent?: any } } element
|
|
13129
|
+
* @return {SVGElement}
|
|
13130
|
+
*/
|
|
12395
13131
|
GraphicsFactory.prototype._getChildrenContainer = function(element) {
|
|
12396
13132
|
|
|
12397
13133
|
var gfx = this._elementRegistry.getGraphics(element);
|
|
@@ -12488,7 +13224,7 @@
|
|
|
12488
13224
|
/**
|
|
12489
13225
|
* Create a graphical element.
|
|
12490
13226
|
*
|
|
12491
|
-
* @param {
|
|
13227
|
+
* @param { 'shape' | 'connection' | 'label' | 'root' } type The type of the element.
|
|
12492
13228
|
* @param {ElementLike} element The element.
|
|
12493
13229
|
* @param {number} [parentIndex] The index at which to add the graphical element to its parent's children.
|
|
12494
13230
|
*
|
|
@@ -12544,6 +13280,8 @@
|
|
|
12544
13280
|
*
|
|
12545
13281
|
* @param {SVGElement} visual The graphical element.
|
|
12546
13282
|
* @param {ShapeLike} element The shape.
|
|
13283
|
+
*
|
|
13284
|
+
* @return {SVGElement}
|
|
12547
13285
|
*/
|
|
12548
13286
|
GraphicsFactory.prototype.drawShape = function(visual, element) {
|
|
12549
13287
|
var eventBus = this._eventBus;
|
|
@@ -12569,6 +13307,8 @@
|
|
|
12569
13307
|
*
|
|
12570
13308
|
* @param {SVGElement} visual The graphical element.
|
|
12571
13309
|
* @param {ConnectionLike} element The connection.
|
|
13310
|
+
*
|
|
13311
|
+
* @return {SVGElement}
|
|
12572
13312
|
*/
|
|
12573
13313
|
GraphicsFactory.prototype.drawConnection = function(visual, element) {
|
|
12574
13314
|
var eventBus = this._eventBus;
|
|
@@ -12579,7 +13319,7 @@
|
|
|
12579
13319
|
/**
|
|
12580
13320
|
* Get the path of a connection.
|
|
12581
13321
|
*
|
|
12582
|
-
* @param {ConnectionLike}
|
|
13322
|
+
* @param {ConnectionLike} connection The connection.
|
|
12583
13323
|
*
|
|
12584
13324
|
* @return {string} The path of the connection.
|
|
12585
13325
|
*/
|
|
@@ -12592,9 +13332,9 @@
|
|
|
12592
13332
|
/**
|
|
12593
13333
|
* Update an elements graphical representation.
|
|
12594
13334
|
*
|
|
12595
|
-
* @param {
|
|
12596
|
-
* @param {ElementLike} element
|
|
12597
|
-
* @param {SVGElement} gfx
|
|
13335
|
+
* @param {'shape'|'connection'} type
|
|
13336
|
+
* @param {ElementLike} element
|
|
13337
|
+
* @param {SVGElement} gfx
|
|
12598
13338
|
*/
|
|
12599
13339
|
GraphicsFactory.prototype.update = function(type, element, gfx) {
|
|
12600
13340
|
|
|
@@ -12652,6 +13392,9 @@
|
|
|
12652
13392
|
parentNode.insertBefore(newNode, node);
|
|
12653
13393
|
}
|
|
12654
13394
|
|
|
13395
|
+
/**
|
|
13396
|
+
* @type { import('didi').ModuleDeclaration }
|
|
13397
|
+
*/
|
|
12655
13398
|
var CoreModule = {
|
|
12656
13399
|
__depends__: [ DrawModule ],
|
|
12657
13400
|
__init__: [ 'canvas' ],
|
|
@@ -12667,7 +13410,9 @@
|
|
|
12667
13410
|
* @typedef {import('didi').LocalsMap} LocalsMap
|
|
12668
13411
|
* @typedef {import('didi').ModuleDeclaration} ModuleDeclaration
|
|
12669
13412
|
*
|
|
12670
|
-
* @typedef {
|
|
13413
|
+
* @typedef { {
|
|
13414
|
+
* modules?: ModuleDeclaration[];
|
|
13415
|
+
* } & Record<string, any> } DiagramOptions
|
|
12671
13416
|
*/
|
|
12672
13417
|
|
|
12673
13418
|
/**
|
|
@@ -12696,6 +13441,9 @@
|
|
|
12696
13441
|
|
|
12697
13442
|
options = options || {};
|
|
12698
13443
|
|
|
13444
|
+
/**
|
|
13445
|
+
* @type { ModuleDeclaration }
|
|
13446
|
+
*/
|
|
12699
13447
|
var configModule = {
|
|
12700
13448
|
'config': [ 'value', options ]
|
|
12701
13449
|
};
|
|
@@ -12715,11 +13463,10 @@
|
|
|
12715
13463
|
* @class
|
|
12716
13464
|
* @constructor
|
|
12717
13465
|
*
|
|
12718
|
-
* @example
|
|
12719
|
-
*
|
|
12720
|
-
* <caption>Creating a plug-in that logs whenever a shape is added to the canvas.</caption>
|
|
13466
|
+
* @example Creating a plug-in that logs whenever a shape is added to the canvas.
|
|
12721
13467
|
*
|
|
12722
|
-
*
|
|
13468
|
+
* ```javascript
|
|
13469
|
+
* // plug-in implementation
|
|
12723
13470
|
* function MyLoggingPlugin(eventBus) {
|
|
12724
13471
|
* eventBus.on('shape.added', function(event) {
|
|
12725
13472
|
* console.log('shape ', event.shape, ' was added to the diagram');
|
|
@@ -12731,10 +13478,11 @@
|
|
|
12731
13478
|
* __init__: [ 'myLoggingPlugin' ],
|
|
12732
13479
|
* myLoggingPlugin: [ 'type', MyLoggingPlugin ]
|
|
12733
13480
|
* };
|
|
13481
|
+
* ```
|
|
12734
13482
|
*
|
|
13483
|
+
* Use the plug-in in a Diagram instance:
|
|
12735
13484
|
*
|
|
12736
|
-
*
|
|
12737
|
-
*
|
|
13485
|
+
* ```javascript
|
|
12738
13486
|
* import MyLoggingModule from 'path-to-my-logging-plugin';
|
|
12739
13487
|
*
|
|
12740
13488
|
* var diagram = new Diagram({
|
|
@@ -12749,36 +13497,39 @@
|
|
|
12749
13497
|
* });
|
|
12750
13498
|
*
|
|
12751
13499
|
* // 'shape ... was added to the diagram' logged to console
|
|
13500
|
+
* ```
|
|
12752
13501
|
*
|
|
12753
13502
|
* @param {DiagramOptions} [options]
|
|
12754
|
-
* @param {ModuleDeclaration[]} [options.modules] External modules to instantiate with the diagram.
|
|
12755
13503
|
* @param {Injector} [injector] An (optional) injector to bootstrap the diagram with.
|
|
12756
13504
|
*/
|
|
12757
13505
|
function Diagram(options, injector) {
|
|
12758
13506
|
|
|
12759
|
-
|
|
12760
|
-
this.injector = injector = injector || createInjector(options);
|
|
13507
|
+
this._injector = injector = injector || createInjector(options);
|
|
12761
13508
|
|
|
12762
13509
|
// API
|
|
12763
13510
|
|
|
12764
13511
|
/**
|
|
12765
13512
|
* Resolves a diagram service.
|
|
12766
13513
|
*
|
|
12767
|
-
* @
|
|
13514
|
+
* @template T
|
|
12768
13515
|
*
|
|
12769
13516
|
* @param {string} name The name of the service to get.
|
|
12770
13517
|
* @param {boolean} [strict=true] If false, resolve missing services to null.
|
|
13518
|
+
*
|
|
13519
|
+
* @return {T|null}
|
|
12771
13520
|
*/
|
|
12772
13521
|
this.get = injector.get;
|
|
12773
13522
|
|
|
12774
13523
|
/**
|
|
12775
13524
|
* Executes a function with its dependencies injected.
|
|
12776
13525
|
*
|
|
12777
|
-
* @
|
|
13526
|
+
* @template T
|
|
12778
13527
|
*
|
|
12779
|
-
* @param {Function}
|
|
12780
|
-
* @param {InjectionContext} [context]
|
|
12781
|
-
* @param {LocalsMap} [locals]
|
|
13528
|
+
* @param {Function} func function to be invoked
|
|
13529
|
+
* @param {InjectionContext} [context] context of the invocation
|
|
13530
|
+
* @param {LocalsMap} [locals] locals provided
|
|
13531
|
+
*
|
|
13532
|
+
* @return {T|null}
|
|
12782
13533
|
*/
|
|
12783
13534
|
this.invoke = injector.invoke;
|
|
12784
13535
|
|
|
@@ -12810,8 +13561,6 @@
|
|
|
12810
13561
|
|
|
12811
13562
|
/**
|
|
12812
13563
|
* Destroys the diagram
|
|
12813
|
-
*
|
|
12814
|
-
* @method Diagram#destroy
|
|
12815
13564
|
*/
|
|
12816
13565
|
Diagram.prototype.destroy = function() {
|
|
12817
13566
|
this.get('eventBus').fire('diagram.destroy');
|
|
@@ -20349,6 +21098,10 @@
|
|
|
20349
21098
|
return new BpmnModdle(pks, options);
|
|
20350
21099
|
}
|
|
20351
21100
|
|
|
21101
|
+
/**
|
|
21102
|
+
* @typedef {import('../model/Types').ModdleElement} ModdleElement
|
|
21103
|
+
*/
|
|
21104
|
+
|
|
20352
21105
|
// TODO(nikku): remove with future bpmn-js version
|
|
20353
21106
|
|
|
20354
21107
|
/**
|
|
@@ -20358,6 +21111,10 @@
|
|
|
20358
21111
|
* 2) If Promise class is implemented in current environment.
|
|
20359
21112
|
*
|
|
20360
21113
|
* @private
|
|
21114
|
+
*
|
|
21115
|
+
* @param {Function} api
|
|
21116
|
+
*
|
|
21117
|
+
* @return {Function}
|
|
20361
21118
|
*/
|
|
20362
21119
|
function wrapForCompatibility(api) {
|
|
20363
21120
|
|
|
@@ -20406,6 +21163,11 @@
|
|
|
20406
21163
|
|
|
20407
21164
|
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';
|
|
20408
21165
|
|
|
21166
|
+
/**
|
|
21167
|
+
* @private
|
|
21168
|
+
*
|
|
21169
|
+
* @param {ModdleElement} businessObject
|
|
21170
|
+
*/
|
|
20409
21171
|
function ensureCompatDiRef(businessObject) {
|
|
20410
21172
|
|
|
20411
21173
|
// bpmnElement can have multiple independent DIs
|
|
@@ -20420,10 +21182,16 @@
|
|
|
20420
21182
|
}
|
|
20421
21183
|
|
|
20422
21184
|
/**
|
|
20423
|
-
*
|
|
21185
|
+
* @typedef {import('diagram-js/lib/i18n/translate/translate').default} Translate
|
|
20424
21186
|
*
|
|
20425
|
-
* @
|
|
20426
|
-
|
|
21187
|
+
* @typedef {import('../model/Types').ModdleElement} ModdleElement
|
|
21188
|
+
*/
|
|
21189
|
+
|
|
21190
|
+
/**
|
|
21191
|
+
* Returns true if an element is of the given meta-model type.
|
|
21192
|
+
*
|
|
21193
|
+
* @param {ModdleElement} element
|
|
21194
|
+
* @param {string} type
|
|
20427
21195
|
*
|
|
20428
21196
|
* @return {boolean}
|
|
20429
21197
|
*/
|
|
@@ -20435,6 +21203,10 @@
|
|
|
20435
21203
|
/**
|
|
20436
21204
|
* Find a suitable display candidate for definitions where the DI does not
|
|
20437
21205
|
* correctly specify one.
|
|
21206
|
+
*
|
|
21207
|
+
* @param {ModdleElement}
|
|
21208
|
+
*
|
|
21209
|
+
* @return {ModdleElement}
|
|
20438
21210
|
*/
|
|
20439
21211
|
function findDisplayCandidate(definitions) {
|
|
20440
21212
|
return find(definitions.rootElements, function(e) {
|
|
@@ -20442,7 +21214,10 @@
|
|
|
20442
21214
|
});
|
|
20443
21215
|
}
|
|
20444
21216
|
|
|
20445
|
-
|
|
21217
|
+
/**
|
|
21218
|
+
* @param {Function} handler
|
|
21219
|
+
* @param {Translate} translate
|
|
21220
|
+
*/
|
|
20446
21221
|
function BpmnTreeWalker(handler, translate) {
|
|
20447
21222
|
|
|
20448
21223
|
// list of containers already walked
|
|
@@ -20511,7 +21286,7 @@
|
|
|
20511
21286
|
|
|
20512
21287
|
// DI handling //////////////////////
|
|
20513
21288
|
|
|
20514
|
-
function registerDi(di) {
|
|
21289
|
+
var registerDi = this.registerDi = function registerDi(di) {
|
|
20515
21290
|
var bpmnElement = di.bpmnElement;
|
|
20516
21291
|
|
|
20517
21292
|
if (bpmnElement) {
|
|
@@ -20535,7 +21310,7 @@
|
|
|
20535
21310
|
{ element: di }
|
|
20536
21311
|
);
|
|
20537
21312
|
}
|
|
20538
|
-
}
|
|
21313
|
+
};
|
|
20539
21314
|
|
|
20540
21315
|
function handleDiagram(diagram) {
|
|
20541
21316
|
handlePlane(diagram.plane);
|
|
@@ -20555,14 +21330,14 @@
|
|
|
20555
21330
|
// Semantic handling //////////////////////
|
|
20556
21331
|
|
|
20557
21332
|
/**
|
|
20558
|
-
* Handle definitions and return the rendered diagram (if any)
|
|
21333
|
+
* Handle definitions and return the rendered diagram (if any).
|
|
20559
21334
|
*
|
|
20560
21335
|
* @param {ModdleElement} definitions to walk and import
|
|
20561
21336
|
* @param {ModdleElement} [diagram] specific diagram to import and display
|
|
20562
21337
|
*
|
|
20563
21338
|
* @throws {Error} if no diagram to display could be found
|
|
20564
21339
|
*/
|
|
20565
|
-
function handleDefinitions(definitions, diagram) {
|
|
21340
|
+
this.handleDefinitions = function handleDefinitions(definitions, diagram) {
|
|
20566
21341
|
|
|
20567
21342
|
// make sure we walk the correct bpmnElement
|
|
20568
21343
|
|
|
@@ -20639,10 +21414,10 @@
|
|
|
20639
21414
|
}
|
|
20640
21415
|
|
|
20641
21416
|
// handle all deferred elements
|
|
20642
|
-
handleDeferred();
|
|
20643
|
-
}
|
|
21417
|
+
handleDeferred(deferred);
|
|
21418
|
+
};
|
|
20644
21419
|
|
|
20645
|
-
function handleDeferred() {
|
|
21420
|
+
var handleDeferred = this.handleDeferred = function handleDeferred() {
|
|
20646
21421
|
|
|
20647
21422
|
var fn;
|
|
20648
21423
|
|
|
@@ -20652,7 +21427,7 @@
|
|
|
20652
21427
|
|
|
20653
21428
|
fn();
|
|
20654
21429
|
}
|
|
20655
|
-
}
|
|
21430
|
+
};
|
|
20656
21431
|
|
|
20657
21432
|
function handleProcess(process, context) {
|
|
20658
21433
|
handleFlowElementsContainer(process, context);
|
|
@@ -20728,10 +21503,10 @@
|
|
|
20728
21503
|
forEach$1(ioSpecification.dataOutputs, contextual(handleDataOutput, context));
|
|
20729
21504
|
}
|
|
20730
21505
|
|
|
20731
|
-
function handleSubProcess(subProcess, context) {
|
|
21506
|
+
var handleSubProcess = this.handleSubProcess = function handleSubProcess(subProcess, context) {
|
|
20732
21507
|
handleFlowElementsContainer(subProcess, context);
|
|
20733
21508
|
handleArtifacts(subProcess.artifacts, context);
|
|
20734
|
-
}
|
|
21509
|
+
};
|
|
20735
21510
|
|
|
20736
21511
|
function handleFlowNode(flowNode, context) {
|
|
20737
21512
|
var childCtx = visitIfDi(flowNode, context);
|
|
@@ -20856,44 +21631,29 @@
|
|
|
20856
21631
|
}
|
|
20857
21632
|
});
|
|
20858
21633
|
}
|
|
20859
|
-
|
|
20860
|
-
// API //////////////////////
|
|
20861
|
-
|
|
20862
|
-
return {
|
|
20863
|
-
handleDeferred: handleDeferred,
|
|
20864
|
-
handleDefinitions: handleDefinitions,
|
|
20865
|
-
handleSubProcess: handleSubProcess,
|
|
20866
|
-
registerDi: registerDi
|
|
20867
|
-
};
|
|
20868
21634
|
}
|
|
20869
21635
|
|
|
20870
21636
|
/**
|
|
20871
|
-
*
|
|
21637
|
+
* @typedef {import('../model/Types').ModdleElement} ModdleElement
|
|
20872
21638
|
*
|
|
20873
|
-
* @typedef {
|
|
21639
|
+
* @typedef { {
|
|
21640
|
+
* warnings: string[];
|
|
21641
|
+
* } } ImportBPMNDiagramResult
|
|
20874
21642
|
*
|
|
20875
|
-
* @
|
|
21643
|
+
* @typedef {ImportBPMNDiagramResult & Error} ImportBPMNDiagramError
|
|
20876
21644
|
*/
|
|
20877
21645
|
|
|
20878
|
-
/**
|
|
20879
|
-
* The importBpmnDiagram error.
|
|
20880
|
-
*
|
|
20881
|
-
* @typedef {Error} ImportBPMNDiagramError
|
|
20882
|
-
*
|
|
20883
|
-
* @property {Array<string>} warnings
|
|
20884
|
-
*/
|
|
20885
|
-
|
|
20886
21646
|
/**
|
|
20887
21647
|
* Import the definitions into a diagram.
|
|
20888
21648
|
*
|
|
20889
21649
|
* Errors and warnings are reported through the specified callback.
|
|
20890
21650
|
*
|
|
20891
|
-
* @param
|
|
20892
|
-
* @param
|
|
20893
|
-
* @param
|
|
20894
|
-
*
|
|
21651
|
+
* @param {ModdleElement} diagram
|
|
21652
|
+
* @param {ModdleElement} definitions
|
|
21653
|
+
* @param {ModdleElement} [bpmnDiagram] The diagram to be rendered (if not
|
|
21654
|
+
* provided, the first one will be rendered).
|
|
20895
21655
|
*
|
|
20896
|
-
*
|
|
21656
|
+
* @return {Promise<ImportBPMNDiagramResult>}
|
|
20897
21657
|
*/
|
|
20898
21658
|
function importBpmnDiagram(diagram, definitions, bpmnDiagram) {
|
|
20899
21659
|
|
|
@@ -20909,8 +21669,8 @@
|
|
|
20909
21669
|
* Walk the diagram semantically, importing (=drawing)
|
|
20910
21670
|
* all elements you encounter.
|
|
20911
21671
|
*
|
|
20912
|
-
* @param {ModdleElement
|
|
20913
|
-
* @param {ModdleElement
|
|
21672
|
+
* @param {ModdleElement} definitions
|
|
21673
|
+
* @param {ModdleElement} bpmnDiagram
|
|
20914
21674
|
*/
|
|
20915
21675
|
function render(definitions, bpmnDiagram) {
|
|
20916
21676
|
|
|
@@ -20985,10 +21745,10 @@
|
|
|
20985
21745
|
* Returns all diagrams in the same hierarchy as the requested diagram.
|
|
20986
21746
|
* Includes all parent and sub process diagrams.
|
|
20987
21747
|
*
|
|
20988
|
-
* @param {
|
|
20989
|
-
* @param {
|
|
21748
|
+
* @param {ModdleElement} definitions
|
|
21749
|
+
* @param {ModdleElement} bpmnDiagram
|
|
20990
21750
|
*
|
|
20991
|
-
* @
|
|
21751
|
+
* @return {ModdleElement[]}
|
|
20992
21752
|
*/
|
|
20993
21753
|
function getDiagramsToImport(definitions, bpmnDiagram) {
|
|
20994
21754
|
if (!bpmnDiagram) {
|
|
@@ -21182,22 +21942,89 @@
|
|
|
21182
21942
|
* @see http://bpmn.io/license for more information.
|
|
21183
21943
|
*/
|
|
21184
21944
|
|
|
21945
|
+
/**
|
|
21946
|
+
* @template T
|
|
21947
|
+
*
|
|
21948
|
+
* @typedef {import('diagram-js/lib/core/EventBus').EventBusEventCallback<T>} EventBusEventCallback
|
|
21949
|
+
*/
|
|
21185
21950
|
|
|
21186
21951
|
/**
|
|
21187
21952
|
* @typedef {import('didi').ModuleDeclaration} ModuleDeclaration
|
|
21188
21953
|
*
|
|
21189
|
-
* @typedef {import('./
|
|
21190
|
-
* @typedef {import('./
|
|
21191
|
-
* @typedef {import('./
|
|
21192
|
-
*
|
|
21193
|
-
* @typedef {
|
|
21194
|
-
*
|
|
21195
|
-
*
|
|
21196
|
-
*
|
|
21197
|
-
*
|
|
21198
|
-
*
|
|
21199
|
-
*
|
|
21200
|
-
*
|
|
21954
|
+
* @typedef {import('./model/Types').Moddle} Moddle
|
|
21955
|
+
* @typedef {import('./model/Types').ModdleElement} ModdleElement
|
|
21956
|
+
* @typedef {import('./model/Types').ModdleExtension} ModdleExtension
|
|
21957
|
+
*
|
|
21958
|
+
* @typedef { {
|
|
21959
|
+
* width?: number|string;
|
|
21960
|
+
* height?: number|string;
|
|
21961
|
+
* position?: string;
|
|
21962
|
+
* container?: string|HTMLElement;
|
|
21963
|
+
* moddleExtensions?: ModdleExtensions;
|
|
21964
|
+
* additionalModules?: ModuleDeclaration[];
|
|
21965
|
+
* } & Record<string, any> } BaseViewerOptions
|
|
21966
|
+
*
|
|
21967
|
+
* @typedef {Record<string, ModdleElement>} ModdleElementsById
|
|
21968
|
+
*
|
|
21969
|
+
* @typedef { {
|
|
21970
|
+
* [key: string]: ModdleExtension;
|
|
21971
|
+
* } } ModdleExtensions
|
|
21972
|
+
*
|
|
21973
|
+
* @typedef { {
|
|
21974
|
+
* warnings: string[];
|
|
21975
|
+
* } } ImportXMLResult
|
|
21976
|
+
*
|
|
21977
|
+
* @typedef {ImportXMLResult & Error} ImportXMLError
|
|
21978
|
+
*
|
|
21979
|
+
* @typedef {ImportXMLResult} ImportDefinitionsResult
|
|
21980
|
+
*
|
|
21981
|
+
* @typedef {ImportXMLError} ImportDefinitionsError
|
|
21982
|
+
*
|
|
21983
|
+
* @typedef {ImportXMLResult} OpenResult
|
|
21984
|
+
*
|
|
21985
|
+
* @typedef {ImportXMLError} OpenError
|
|
21986
|
+
*
|
|
21987
|
+
* @typedef { {
|
|
21988
|
+
* format?: boolean;
|
|
21989
|
+
* preamble?: boolean;
|
|
21990
|
+
* } } SaveXMLOptions
|
|
21991
|
+
*
|
|
21992
|
+
* @typedef { {
|
|
21993
|
+
* xml?: string;
|
|
21994
|
+
* error?: Error;
|
|
21995
|
+
* } } SaveXMLResult
|
|
21996
|
+
*
|
|
21997
|
+
* @typedef { {
|
|
21998
|
+
* svg: string;
|
|
21999
|
+
* } } SaveSVGResult
|
|
22000
|
+
*
|
|
22001
|
+
* @typedef { {
|
|
22002
|
+
* xml: string;
|
|
22003
|
+
* } } ImportParseStartEvent
|
|
22004
|
+
*
|
|
22005
|
+
* @typedef { {
|
|
22006
|
+
* error?: ImportXMLError;
|
|
22007
|
+
* definitions?: ModdleElement;
|
|
22008
|
+
* elementsById?: ModdleElementsById;
|
|
22009
|
+
* references?: ModdleElement[];
|
|
22010
|
+
* warnings: string[];
|
|
22011
|
+
* } } ImportParseCompleteEvent
|
|
22012
|
+
*
|
|
22013
|
+
* @typedef { {
|
|
22014
|
+
* error?: ImportXMLError;
|
|
22015
|
+
* warnings: string[];
|
|
22016
|
+
* } } ImportDoneEvent
|
|
22017
|
+
*
|
|
22018
|
+
* @typedef { {
|
|
22019
|
+
* definitions: ModdleElement;
|
|
22020
|
+
* } } SaveXMLStartEvent
|
|
22021
|
+
*
|
|
22022
|
+
* @typedef {SaveXMLResult} SaveXMLDoneEvent
|
|
22023
|
+
*
|
|
22024
|
+
* @typedef { {
|
|
22025
|
+
* error?: Error;
|
|
22026
|
+
* svg: string;
|
|
22027
|
+
* } } SaveSVGDoneEvent
|
|
21201
22028
|
*/
|
|
21202
22029
|
|
|
21203
22030
|
/**
|
|
@@ -21206,15 +22033,18 @@
|
|
|
21206
22033
|
* Have a look at {@link Viewer}, {@link NavigatedViewer} or {@link Modeler} for
|
|
21207
22034
|
* bundles that include actual features.
|
|
21208
22035
|
*
|
|
21209
|
-
* @param {
|
|
22036
|
+
* @param {BaseViewerOptions} [options] The options to configure the viewer.
|
|
21210
22037
|
*/
|
|
21211
22038
|
function BaseViewer(options) {
|
|
21212
22039
|
|
|
21213
22040
|
/**
|
|
21214
|
-
* @type {
|
|
22041
|
+
* @type {BaseViewerOptions}
|
|
21215
22042
|
*/
|
|
21216
22043
|
options = assign$1({}, DEFAULT_OPTIONS, options);
|
|
21217
22044
|
|
|
22045
|
+
/**
|
|
22046
|
+
* @type {Moddle}
|
|
22047
|
+
*/
|
|
21218
22048
|
this._moddle = this._createModdle(options);
|
|
21219
22049
|
|
|
21220
22050
|
/**
|
|
@@ -21253,18 +22083,18 @@
|
|
|
21253
22083
|
*
|
|
21254
22084
|
* @throws {ImportXMLError} An error thrown during the import of the XML.
|
|
21255
22085
|
*
|
|
21256
|
-
* @fires BaseViewer#
|
|
21257
|
-
* @fires BaseViewer#
|
|
21258
|
-
* @fires Importer#
|
|
21259
|
-
* @fires Importer#
|
|
21260
|
-
* @fires BaseViewer#
|
|
22086
|
+
* @fires BaseViewer#ImportParseStartEvent
|
|
22087
|
+
* @fires BaseViewer#ImportParseCompleteEvent
|
|
22088
|
+
* @fires Importer#ImportRenderStartEvent
|
|
22089
|
+
* @fires Importer#ImportRenderCompleteEvent
|
|
22090
|
+
* @fires BaseViewer#ImportDoneEvent
|
|
21261
22091
|
*
|
|
21262
22092
|
* @param {string} xml The BPMN 2.0 XML to be imported.
|
|
21263
22093
|
* @param {ModdleElement|string} [bpmnDiagram] The optional diagram or Id of the BPMN diagram to open.
|
|
21264
22094
|
*
|
|
21265
22095
|
* @return {Promise<ImportXMLResult>} A promise resolving with warnings that were produced during the import.
|
|
21266
22096
|
*/
|
|
21267
|
-
BaseViewer.prototype.importXML =
|
|
22097
|
+
BaseViewer.prototype.importXML = async function importXML(xml, bpmnDiagram) {
|
|
21268
22098
|
|
|
21269
22099
|
const self = this;
|
|
21270
22100
|
|
|
@@ -21302,9 +22132,8 @@
|
|
|
21302
22132
|
/**
|
|
21303
22133
|
* A `import.parse.start` event.
|
|
21304
22134
|
*
|
|
21305
|
-
* @event BaseViewer#
|
|
21306
|
-
* @type {
|
|
21307
|
-
* @property {string} xml The XML that is to be parsed.
|
|
22135
|
+
* @event BaseViewer#ImportParseStartEvent
|
|
22136
|
+
* @type {ImportParseStartEvent}
|
|
21308
22137
|
*/
|
|
21309
22138
|
xml = this._emit('import.parse.start', { xml: xml }) || xml;
|
|
21310
22139
|
|
|
@@ -21332,13 +22161,8 @@
|
|
|
21332
22161
|
/**
|
|
21333
22162
|
* A `import.parse.complete` event.
|
|
21334
22163
|
*
|
|
21335
|
-
* @event BaseViewer#
|
|
21336
|
-
* @type {
|
|
21337
|
-
* @property {Error|null} error An error thrown when parsing the XML.
|
|
21338
|
-
* @property {ModdleElement} definitions The definitions model element.
|
|
21339
|
-
* @property {ModdleElementsById} elementsById The model elements by ID.
|
|
21340
|
-
* @property {ModdleElement[]} references The referenced model elements.
|
|
21341
|
-
* @property {string[]} warnings The warnings produced when parsing the XML.
|
|
22164
|
+
* @event BaseViewer#ImportParseCompleteEvent
|
|
22165
|
+
* @type {ImportParseCompleteEvent}
|
|
21342
22166
|
*/
|
|
21343
22167
|
definitions = this._emit('import.parse.complete', ParseCompleteEvent({
|
|
21344
22168
|
error: null,
|
|
@@ -21355,10 +22179,8 @@
|
|
|
21355
22179
|
/**
|
|
21356
22180
|
* A `import.parse.complete` event.
|
|
21357
22181
|
*
|
|
21358
|
-
* @event BaseViewer#
|
|
21359
|
-
* @type {
|
|
21360
|
-
* @property {ImportXMLError|null} error An error thrown during import.
|
|
21361
|
-
* @property {string[]} warnings The warnings.
|
|
22182
|
+
* @event BaseViewer#ImportDoneEvent
|
|
22183
|
+
* @type {ImportDoneEvent}
|
|
21362
22184
|
*/
|
|
21363
22185
|
this._emit('import.done', { error: null, warnings: aggregatedWarnings });
|
|
21364
22186
|
|
|
@@ -21374,7 +22196,9 @@
|
|
|
21374
22196
|
|
|
21375
22197
|
throw error;
|
|
21376
22198
|
}
|
|
21377
|
-
}
|
|
22199
|
+
};
|
|
22200
|
+
|
|
22201
|
+
BaseViewer.prototype.importXML = wrapForCompatibility(BaseViewer.prototype.importXML);
|
|
21378
22202
|
|
|
21379
22203
|
|
|
21380
22204
|
/**
|
|
@@ -21399,12 +22223,14 @@
|
|
|
21399
22223
|
*
|
|
21400
22224
|
* @return {Promise<ImportDefinitionsResult>} A promise resolving with warnings that were produced during the import.
|
|
21401
22225
|
*/
|
|
21402
|
-
BaseViewer.prototype.importDefinitions =
|
|
22226
|
+
BaseViewer.prototype.importDefinitions = async function importDefinitions(definitions, bpmnDiagram) {
|
|
21403
22227
|
this._setDefinitions(definitions);
|
|
21404
22228
|
const result = await this.open(bpmnDiagram);
|
|
21405
22229
|
|
|
21406
22230
|
return { warnings: result.warnings };
|
|
21407
|
-
}
|
|
22231
|
+
};
|
|
22232
|
+
|
|
22233
|
+
BaseViewer.prototype.importDefinitions = wrapForCompatibility(BaseViewer.prototype.importDefinitions);
|
|
21408
22234
|
|
|
21409
22235
|
|
|
21410
22236
|
/**
|
|
@@ -21428,7 +22254,7 @@
|
|
|
21428
22254
|
*
|
|
21429
22255
|
* @return {Promise<OpenResult>} A promise resolving with warnings that were produced during opening.
|
|
21430
22256
|
*/
|
|
21431
|
-
BaseViewer.prototype.open =
|
|
22257
|
+
BaseViewer.prototype.open = async function open(bpmnDiagramOrId) {
|
|
21432
22258
|
|
|
21433
22259
|
const definitions = this._definitions;
|
|
21434
22260
|
let bpmnDiagram = bpmnDiagramOrId;
|
|
@@ -21465,7 +22291,9 @@
|
|
|
21465
22291
|
const { warnings } = await importBpmnDiagram(this, definitions, bpmnDiagram);
|
|
21466
22292
|
|
|
21467
22293
|
return { warnings };
|
|
21468
|
-
}
|
|
22294
|
+
};
|
|
22295
|
+
|
|
22296
|
+
BaseViewer.prototype.open = wrapForCompatibility(BaseViewer.prototype.open);
|
|
21469
22297
|
|
|
21470
22298
|
/**
|
|
21471
22299
|
* Export the currently displayed BPMN 2.0 diagram as
|
|
@@ -21490,7 +22318,7 @@
|
|
|
21490
22318
|
*
|
|
21491
22319
|
* @return {Promise<SaveXMLResult>} A promise resolving with the XML.
|
|
21492
22320
|
*/
|
|
21493
|
-
BaseViewer.prototype.saveXML =
|
|
22321
|
+
BaseViewer.prototype.saveXML = async function saveXML(options) {
|
|
21494
22322
|
|
|
21495
22323
|
options = options || {};
|
|
21496
22324
|
|
|
@@ -21507,9 +22335,8 @@
|
|
|
21507
22335
|
/**
|
|
21508
22336
|
* A `saveXML.start` event.
|
|
21509
22337
|
*
|
|
21510
|
-
* @event BaseViewer#
|
|
21511
|
-
* @type {
|
|
21512
|
-
* @property {ModdleElement} definitions The definitions model element.
|
|
22338
|
+
* @event BaseViewer#SaveXMLStartEvent
|
|
22339
|
+
* @type {SaveXMLStartEvent}
|
|
21513
22340
|
*/
|
|
21514
22341
|
definitions = this._emit('saveXML.start', {
|
|
21515
22342
|
definitions
|
|
@@ -21530,10 +22357,8 @@
|
|
|
21530
22357
|
/**
|
|
21531
22358
|
* A `saveXML.done` event.
|
|
21532
22359
|
*
|
|
21533
|
-
* @event BaseViewer#
|
|
21534
|
-
* @type {
|
|
21535
|
-
* @property {Error} [error] An error thrown when saving the XML.
|
|
21536
|
-
* @property {string} [xml] The saved XML.
|
|
22360
|
+
* @event BaseViewer#SaveXMLDoneEvent
|
|
22361
|
+
* @type {SaveXMLDoneEvent}
|
|
21537
22362
|
*/
|
|
21538
22363
|
this._emit('saveXML.done', result);
|
|
21539
22364
|
|
|
@@ -21542,7 +22367,9 @@
|
|
|
21542
22367
|
}
|
|
21543
22368
|
|
|
21544
22369
|
return result;
|
|
21545
|
-
}
|
|
22370
|
+
};
|
|
22371
|
+
|
|
22372
|
+
BaseViewer.prototype.saveXML = wrapForCompatibility(BaseViewer.prototype.saveXML);
|
|
21546
22373
|
|
|
21547
22374
|
|
|
21548
22375
|
/**
|
|
@@ -21564,7 +22391,7 @@
|
|
|
21564
22391
|
*
|
|
21565
22392
|
* @return {Promise<SaveSVGResult>} A promise resolving with the SVG.
|
|
21566
22393
|
*/
|
|
21567
|
-
BaseViewer.prototype.saveSVG =
|
|
22394
|
+
BaseViewer.prototype.saveSVG = async function saveSVG() {
|
|
21568
22395
|
this._emit('saveSVG.start');
|
|
21569
22396
|
|
|
21570
22397
|
let svg, err;
|
|
@@ -21596,10 +22423,8 @@
|
|
|
21596
22423
|
/**
|
|
21597
22424
|
* A `saveSVG.done` event.
|
|
21598
22425
|
*
|
|
21599
|
-
* @event BaseViewer#
|
|
21600
|
-
* @type {
|
|
21601
|
-
* @property {Error} [error] An error thrown when saving the SVG.
|
|
21602
|
-
* @property {string} [svg] The saved SVG.
|
|
22426
|
+
* @event BaseViewer#SaveSVGDoneEvent
|
|
22427
|
+
* @type {SaveSVGDoneEvent}
|
|
21603
22428
|
*/
|
|
21604
22429
|
this._emit('saveSVG.done', {
|
|
21605
22430
|
error: err,
|
|
@@ -21611,7 +22436,9 @@
|
|
|
21611
22436
|
}
|
|
21612
22437
|
|
|
21613
22438
|
return { svg };
|
|
21614
|
-
}
|
|
22439
|
+
};
|
|
22440
|
+
|
|
22441
|
+
BaseViewer.prototype.saveSVG = wrapForCompatibility(BaseViewer.prototype.saveSVG);
|
|
21615
22442
|
|
|
21616
22443
|
/**
|
|
21617
22444
|
* Get a named diagram service.
|
|
@@ -21693,10 +22520,12 @@
|
|
|
21693
22520
|
*
|
|
21694
22521
|
* Remove an event listener via {@link BaseViewer#off}.
|
|
21695
22522
|
*
|
|
22523
|
+
* @template T
|
|
22524
|
+
*
|
|
21696
22525
|
* @param {string|string[]} events The event(s) to listen to.
|
|
21697
22526
|
* @param {number} [priority] The priority with which to listen.
|
|
21698
|
-
* @param {
|
|
21699
|
-
* @param {
|
|
22527
|
+
* @param {EventBusEventCallback<T>} callback The callback.
|
|
22528
|
+
* @param {any} [that] Value of `this` the callback will be called with.
|
|
21700
22529
|
*/
|
|
21701
22530
|
BaseViewer.prototype.on = function(events, priority, callback, that) {
|
|
21702
22531
|
return this.get('eventBus').on(events, priority, callback, that);
|
|
@@ -21746,7 +22575,7 @@
|
|
|
21746
22575
|
/**
|
|
21747
22576
|
* Get the definitions model element.
|
|
21748
22577
|
*
|
|
21749
|
-
* @
|
|
22578
|
+
* @return {ModdleElement} The definitions model element.
|
|
21750
22579
|
*/
|
|
21751
22580
|
BaseViewer.prototype.getDefinitions = function() {
|
|
21752
22581
|
return this._definitions;
|
|
@@ -21815,6 +22644,11 @@
|
|
|
21815
22644
|
return this.get('eventBus').fire(type, event);
|
|
21816
22645
|
};
|
|
21817
22646
|
|
|
22647
|
+
/**
|
|
22648
|
+
* @param {BaseViewerOptions} options
|
|
22649
|
+
*
|
|
22650
|
+
* @return {HTMLElement}
|
|
22651
|
+
*/
|
|
21818
22652
|
BaseViewer.prototype._createContainer = function(options) {
|
|
21819
22653
|
|
|
21820
22654
|
const container = domify$1('<div class="bjs-container"></div>');
|
|
@@ -21828,6 +22662,11 @@
|
|
|
21828
22662
|
return container;
|
|
21829
22663
|
};
|
|
21830
22664
|
|
|
22665
|
+
/**
|
|
22666
|
+
* @param {BaseViewerOptions} options
|
|
22667
|
+
*
|
|
22668
|
+
* @return {Moddle}
|
|
22669
|
+
*/
|
|
21831
22670
|
BaseViewer.prototype._createModdle = function(options) {
|
|
21832
22671
|
const moddleOptions = assign$1({}, this._moddleExtensions, options.moddleExtensions);
|
|
21833
22672
|
|
|
@@ -22027,7 +22866,7 @@
|
|
|
22027
22866
|
/**
|
|
22028
22867
|
* Checks if key pressed is one of provided keys.
|
|
22029
22868
|
*
|
|
22030
|
-
* @param {string|
|
|
22869
|
+
* @param {string|string[]} keys
|
|
22031
22870
|
* @param {KeyboardEvent} event
|
|
22032
22871
|
*/
|
|
22033
22872
|
function isKey(keys, event) {
|
|
@@ -22420,6 +23259,9 @@
|
|
|
22420
23259
|
});
|
|
22421
23260
|
};
|
|
22422
23261
|
|
|
23262
|
+
/**
|
|
23263
|
+
* @type { import('didi').ModuleDeclaration }
|
|
23264
|
+
*/
|
|
22423
23265
|
var KeyboardModule = {
|
|
22424
23266
|
__init__: [ 'keyboard', 'keyboardBindings' ],
|
|
22425
23267
|
keyboard: [ 'type', Keyboard ],
|
|
@@ -22549,6 +23391,9 @@
|
|
|
22549
23391
|
'canvas'
|
|
22550
23392
|
];
|
|
22551
23393
|
|
|
23394
|
+
/**
|
|
23395
|
+
* @type { import('didi').ModuleDeclaration }
|
|
23396
|
+
*/
|
|
22552
23397
|
var KeyboardMoveModule = {
|
|
22553
23398
|
__depends__: [
|
|
22554
23399
|
KeyboardModule
|
|
@@ -22721,6 +23566,9 @@
|
|
|
22721
23566
|
return Math.sqrt(Math.pow(point.x, 2) + Math.pow(point.y, 2));
|
|
22722
23567
|
}
|
|
22723
23568
|
|
|
23569
|
+
/**
|
|
23570
|
+
* @type { import('didi').ModuleDeclaration }
|
|
23571
|
+
*/
|
|
22724
23572
|
var MoveCanvasModule = {
|
|
22725
23573
|
__init__: [ 'moveCanvas' ],
|
|
22726
23574
|
moveCanvas: [ 'type', MoveCanvas ]
|
|
@@ -22759,6 +23607,8 @@
|
|
|
22759
23607
|
/**
|
|
22760
23608
|
* @typedef {import('../../core/Canvas').default} Canvas
|
|
22761
23609
|
* @typedef {import('../../core/EventBus').default} EventBus
|
|
23610
|
+
*
|
|
23611
|
+
* @typedef {import('../../util/Types').Point} Point
|
|
22762
23612
|
*/
|
|
22763
23613
|
|
|
22764
23614
|
var sign = Math.sign || function(n) {
|
|
@@ -22812,6 +23662,9 @@
|
|
|
22812
23662
|
'canvas'
|
|
22813
23663
|
];
|
|
22814
23664
|
|
|
23665
|
+
/**
|
|
23666
|
+
* @param {Point} delta
|
|
23667
|
+
*/
|
|
22815
23668
|
ZoomScroll.prototype.scroll = function scroll(delta) {
|
|
22816
23669
|
this._canvas.scroll(delta);
|
|
22817
23670
|
};
|
|
@@ -22825,7 +23678,7 @@
|
|
|
22825
23678
|
* Zoom depending on delta.
|
|
22826
23679
|
*
|
|
22827
23680
|
* @param {number} delta
|
|
22828
|
-
* @param {
|
|
23681
|
+
* @param {Point} position
|
|
22829
23682
|
*/
|
|
22830
23683
|
ZoomScroll.prototype.zoom = function zoom(delta, position) {
|
|
22831
23684
|
|
|
@@ -22909,8 +23762,8 @@
|
|
|
22909
23762
|
/**
|
|
22910
23763
|
* Zoom with fixed step size.
|
|
22911
23764
|
*
|
|
22912
|
-
* @param {number} delta
|
|
22913
|
-
* @param {
|
|
23765
|
+
* @param {number} delta Zoom delta (1 for zooming in, -1 for zooming out).
|
|
23766
|
+
* @param {Point} position
|
|
22914
23767
|
*/
|
|
22915
23768
|
ZoomScroll.prototype.stepZoom = function stepZoom(delta, position) {
|
|
22916
23769
|
|
|
@@ -22924,7 +23777,7 @@
|
|
|
22924
23777
|
* Zoom in/out given a step size.
|
|
22925
23778
|
*
|
|
22926
23779
|
* @param {number} delta
|
|
22927
|
-
* @param {
|
|
23780
|
+
* @param {Point} position
|
|
22928
23781
|
* @param {number} stepSize
|
|
22929
23782
|
*/
|
|
22930
23783
|
ZoomScroll.prototype._zoom = function(delta, position, stepSize) {
|
|
@@ -22982,6 +23835,9 @@
|
|
|
22982
23835
|
this.toggle(newEnabled);
|
|
22983
23836
|
};
|
|
22984
23837
|
|
|
23838
|
+
/**
|
|
23839
|
+
* @type { import('didi').ModuleDeclaration }
|
|
23840
|
+
*/
|
|
22985
23841
|
var ZoomScrollModule = {
|
|
22986
23842
|
__init__: [ 'zoomScroll' ],
|
|
22987
23843
|
zoomScroll: [ 'type', ZoomScroll ]
|