@logicflow/core 1.2.27 → 2.0.0-beta.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/.turbo/turbo-build$colon$dev.log +10 -0
- package/.turbo/turbo-build.log +42 -0
- package/CHANGELOG.md +2114 -0
- package/LICENSE +206 -0
- package/__tests__/algorithm/egde.test.ts +118 -0
- package/__tests__/algorithm/index.test.ts +69 -0
- package/__tests__/algorithm/outline.test.ts +43 -0
- package/__tests__/bugs/1545-spec.test.ts +38 -0
- package/__tests__/event/event.test.ts +22 -0
- package/__tests__/history/history.test.ts +28 -0
- package/__tests__/logicflow.test.ts +567 -0
- package/__tests__/model/graphmodel.test.ts +67 -0
- package/__tests__/util/compatible.test.ts +48 -0
- package/__tests__/util/edge.test.ts +224 -0
- package/__tests__/util/geometry.test.ts +14 -0
- package/__tests__/util/graph.test.ts +16 -0
- package/__tests__/util/matrix.test.ts +41 -0
- package/__tests__/util/node.test.ts +68 -0
- package/__tests__/util/sampling.test.ts +16 -0
- package/__tests__/util/vector.test.ts +50 -0
- package/__tests__/util/zIndex.test.ts +10 -0
- package/dist/{style/index.css → index.css} +64 -52
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/es/LogicFlow.d.ts +966 -0
- package/es/LogicFlow.js +1174 -0
- package/es/LogicFlow.js.map +1 -0
- package/es/algorithm/edge.d.ts +15 -0
- package/es/algorithm/edge.js +57 -0
- package/es/algorithm/edge.js.map +1 -0
- package/es/algorithm/index.js +71 -0
- package/es/algorithm/index.js.map +1 -0
- package/es/algorithm/outline.d.ts +7 -0
- package/es/algorithm/outline.js +61 -0
- package/es/algorithm/outline.js.map +1 -0
- package/{types/constant/constant.d.ts → es/constant/index.d.ts} +23 -22
- package/es/constant/index.js +117 -0
- package/es/constant/index.js.map +1 -0
- package/es/event/eventArgs.d.ts +428 -0
- package/es/event/eventArgs.js +2 -0
- package/es/event/eventArgs.js.map +1 -0
- package/es/event/eventEmitter.d.ts +48 -0
- package/es/event/eventEmitter.js +92 -0
- package/es/event/eventEmitter.js.map +1 -0
- package/es/history/index.d.ts +23 -0
- package/es/history/index.js +111 -0
- package/es/history/index.js.map +1 -0
- package/es/index.css +210 -0
- package/{types → es}/index.d.ts +4 -6
- package/es/index.js +16 -0
- package/es/index.js.map +1 -0
- package/es/index.less +1 -0
- package/{types → es}/keyboard/index.d.ts +7 -8
- package/es/keyboard/index.js +87 -0
- package/es/keyboard/index.js.map +1 -0
- package/es/keyboard/shortcut.js +116 -0
- package/es/keyboard/shortcut.js.map +1 -0
- package/es/model/BaseModel.d.ts +181 -0
- package/es/model/BaseModel.js +2 -0
- package/es/model/BaseModel.js.map +1 -0
- package/{types → es}/model/EditConfigModel.d.ts +13 -8
- package/es/model/EditConfigModel.js +192 -0
- package/es/model/EditConfigModel.js.map +1 -0
- package/{types → es}/model/GraphModel.d.ts +118 -178
- package/es/model/GraphModel.js +1473 -0
- package/es/model/GraphModel.js.map +1 -0
- package/es/model/SnaplineModel.d.ts +34 -0
- package/es/model/SnaplineModel.js +217 -0
- package/es/model/SnaplineModel.js.map +1 -0
- package/{types → es}/model/TransformModel.d.ts +21 -11
- package/es/model/TransformModel.js +240 -0
- package/es/model/TransformModel.js.map +1 -0
- package/{types → es}/model/edge/BaseEdgeModel.d.ts +82 -63
- package/es/model/edge/BaseEdgeModel.js +739 -0
- package/es/model/edge/BaseEdgeModel.js.map +1 -0
- package/es/model/edge/BezierEdgeModel.d.ts +63 -0
- package/es/model/edge/BezierEdgeModel.js +244 -0
- package/es/model/edge/BezierEdgeModel.js.map +1 -0
- package/es/model/edge/LineEdgeModel.d.ts +19 -0
- package/es/model/edge/LineEdgeModel.js +77 -0
- package/es/model/edge/LineEdgeModel.js.map +1 -0
- package/es/model/edge/PolylineEdgeModel.d.ts +85 -0
- package/es/model/edge/PolylineEdgeModel.js +593 -0
- package/es/model/edge/PolylineEdgeModel.js.map +1 -0
- package/es/model/edge/index.js +5 -0
- package/es/model/edge/index.js.map +1 -0
- package/es/model/index.js +8 -0
- package/es/model/index.js.map +1 -0
- package/es/model/node/BaseNodeModel.d.ts +260 -0
- package/es/model/node/BaseNodeModel.js +883 -0
- package/es/model/node/BaseNodeModel.js.map +1 -0
- package/es/model/node/CircleNodeModel.d.ts +40 -0
- package/es/model/node/CircleNodeModel.js +110 -0
- package/es/model/node/CircleNodeModel.js.map +1 -0
- package/es/model/node/DiamondNodeModel.d.ts +46 -0
- package/es/model/node/DiamondNodeModel.js +187 -0
- package/es/model/node/DiamondNodeModel.js.map +1 -0
- package/es/model/node/EllipseNodeModel.d.ts +42 -0
- package/es/model/node/EllipseNodeModel.js +118 -0
- package/es/model/node/EllipseNodeModel.js.map +1 -0
- package/es/model/node/HtmlNodeModel.d.ts +21 -0
- package/es/model/node/HtmlNodeModel.js +59 -0
- package/es/model/node/HtmlNodeModel.js.map +1 -0
- package/es/model/node/PolygonNodeModel.d.ts +50 -0
- package/es/model/node/PolygonNodeModel.js +196 -0
- package/es/model/node/PolygonNodeModel.js.map +1 -0
- package/es/model/node/RectNodeModel.d.ts +34 -0
- package/es/model/node/RectNodeModel.js +80 -0
- package/es/model/node/RectNodeModel.js.map +1 -0
- package/es/model/node/TextNodeModel.d.ts +27 -0
- package/es/model/node/TextNodeModel.js +113 -0
- package/es/model/node/TextNodeModel.js.map +1 -0
- package/es/model/node/index.js +9 -0
- package/es/model/node/index.js.map +1 -0
- package/es/options.d.ts +86 -0
- package/es/options.js +74 -0
- package/es/options.js.map +1 -0
- package/es/style/index.css +210 -0
- package/es/style/index.less +256 -0
- package/es/style/raw.d.ts +4 -0
- package/es/style/raw.js +6 -0
- package/es/style/raw.js.map +1 -0
- package/es/tool/MultipleSelectTool.d.ts +13 -0
- package/es/tool/MultipleSelectTool.js +159 -0
- package/es/tool/MultipleSelectTool.js.map +1 -0
- package/es/tool/TextEditTool.d.ts +26 -0
- package/es/tool/TextEditTool.js +187 -0
- package/es/tool/TextEditTool.js.map +1 -0
- package/es/tool/index.d.ts +2 -0
- package/es/tool/index.js +3 -0
- package/es/tool/index.js.map +1 -0
- package/{types/tool/SnaplineTool.d.ts → es/tool/snapline.d.ts} +1 -1
- package/es/tool/snapline.js +13 -0
- package/es/tool/snapline.js.map +1 -0
- package/es/tool/tool.d.ts +22 -0
- package/es/tool/tool.js +43 -0
- package/es/tool/tool.js.map +1 -0
- package/es/util/animation.d.ts +12 -0
- package/es/util/animation.js +20 -0
- package/es/util/animation.js.map +1 -0
- package/es/util/browser.js +3 -0
- package/es/util/browser.js.map +1 -0
- package/es/util/compatible.d.ts +6 -0
- package/es/util/compatible.js +17 -0
- package/es/util/compatible.js.map +1 -0
- package/es/util/drag.d.ts +47 -0
- package/es/util/drag.js +139 -0
- package/es/util/drag.js.map +1 -0
- package/es/util/edge.d.ts +94 -0
- package/es/util/edge.js +833 -0
- package/es/util/edge.js.map +1 -0
- package/es/util/geometry.d.ts +11 -0
- package/es/util/geometry.js +72 -0
- package/es/util/geometry.js.map +1 -0
- package/{types → es}/util/graph.d.ts +4 -3
- package/es/util/graph.js +54 -0
- package/es/util/graph.js.map +1 -0
- package/es/util/index.d.ts +16 -0
- package/es/util/index.js +17 -0
- package/es/util/index.js.map +1 -0
- package/{types → es}/util/matrix.d.ts +1 -1
- package/es/util/matrix.js +161 -0
- package/es/util/matrix.js.map +1 -0
- package/es/util/mobx.js +4 -0
- package/es/util/mobx.js.map +1 -0
- package/es/util/node.d.ts +69 -0
- package/es/util/node.js +402 -0
- package/es/util/node.js.map +1 -0
- package/es/util/raf.d.ts +2 -0
- package/es/util/raf.js +24 -0
- package/es/util/raf.js.map +1 -0
- package/{types → es}/util/sampling.d.ts +4 -2
- package/es/util/sampling.js +66 -0
- package/es/util/sampling.js.map +1 -0
- package/es/util/theme.d.ts +4 -0
- package/es/util/theme.js +156 -0
- package/es/util/theme.js.map +1 -0
- package/es/util/uuid.d.ts +7 -0
- package/es/util/uuid.js +20 -0
- package/es/util/uuid.js.map +1 -0
- package/{types → es}/util/vector.d.ts +2 -2
- package/es/util/vector.js +97 -0
- package/es/util/vector.js.map +1 -0
- package/es/util/zIndex.js +5 -0
- package/es/util/zIndex.js.map +1 -0
- package/es/view/Anchor.d.ts +47 -0
- package/es/view/Anchor.js +315 -0
- package/es/view/Anchor.js.map +1 -0
- package/es/view/Control.d.ts +100 -0
- package/es/view/Control.js +324 -0
- package/es/view/Control.js.map +1 -0
- package/es/view/Graph.d.ts +18 -0
- package/es/view/Graph.js +77 -0
- package/es/view/Graph.js.map +1 -0
- package/{types → es}/view/Rotate.d.ts +9 -9
- package/es/view/Rotate.js +108 -0
- package/es/view/Rotate.js.map +1 -0
- package/es/view/behavior/dnd.d.ts +27 -0
- package/es/view/behavior/dnd.js +110 -0
- package/es/view/behavior/dnd.js.map +1 -0
- package/es/view/edge/AdjustPoint.d.ts +50 -0
- package/es/view/edge/AdjustPoint.js +368 -0
- package/es/view/edge/AdjustPoint.js.map +1 -0
- package/es/view/edge/Arrow.d.ts +25 -0
- package/es/view/edge/Arrow.js +60 -0
- package/es/view/edge/Arrow.js.map +1 -0
- package/{types → es}/view/edge/BaseEdge.d.ts +25 -17
- package/es/view/edge/BaseEdge.js +381 -0
- package/es/view/edge/BaseEdge.js.map +1 -0
- package/es/view/edge/BezierEdge.d.ts +26 -0
- package/es/view/edge/BezierEdge.js +118 -0
- package/es/view/edge/BezierEdge.js.map +1 -0
- package/{types → es}/view/edge/LineEdge.d.ts +9 -4
- package/es/view/edge/LineEdge.js +78 -0
- package/es/view/edge/LineEdge.js.map +1 -0
- package/{types → es}/view/edge/PolylineEdge.d.ts +18 -8
- package/es/view/edge/PolylineEdge.js +274 -0
- package/es/view/edge/PolylineEdge.js.map +1 -0
- package/es/view/edge/index.d.ts +6 -0
- package/es/view/edge/index.js +7 -0
- package/es/view/edge/index.js.map +1 -0
- package/es/view/index.d.ts +7 -0
- package/es/view/index.js +8 -0
- package/es/view/index.js.map +1 -0
- package/es/view/node/BaseNode.d.ts +49 -0
- package/es/view/node/BaseNode.js +420 -0
- package/es/view/node/BaseNode.js.map +1 -0
- package/es/view/node/CircleNode.d.ts +10 -0
- package/es/view/node/CircleNode.js +45 -0
- package/es/view/node/CircleNode.js.map +1 -0
- package/es/view/node/DiamondNode.d.ts +10 -0
- package/es/view/node/DiamondNode.js +44 -0
- package/es/view/node/DiamondNode.js.map +1 -0
- package/es/view/node/EllipseNode.d.ts +10 -0
- package/es/view/node/EllipseNode.js +44 -0
- package/es/view/node/EllipseNode.js.map +1 -0
- package/{types → es}/view/node/HtmlNode.d.ts +15 -9
- package/es/view/node/HtmlNode.js +129 -0
- package/es/view/node/HtmlNode.js.map +1 -0
- package/es/view/node/PolygonNode.d.ts +10 -0
- package/es/view/node/PolygonNode.js +48 -0
- package/es/view/node/PolygonNode.js.map +1 -0
- package/es/view/node/RectNode.d.ts +11 -0
- package/es/view/node/RectNode.js +44 -0
- package/es/view/node/RectNode.js.map +1 -0
- package/es/view/node/TextNode.d.ts +12 -0
- package/es/view/node/TextNode.js +55 -0
- package/es/view/node/TextNode.js.map +1 -0
- package/es/view/node/index.d.ts +8 -0
- package/es/view/node/index.js +9 -0
- package/es/view/node/index.js.map +1 -0
- package/{types → es}/view/overlay/BackgroundOverlay.d.ts +7 -7
- package/es/view/overlay/BackgroundOverlay.js +31 -0
- package/es/view/overlay/BackgroundOverlay.js.map +1 -0
- package/es/view/overlay/BezierAdjustOverlay.d.ts +31 -0
- package/es/view/overlay/BezierAdjustOverlay.js +142 -0
- package/es/view/overlay/BezierAdjustOverlay.js.map +1 -0
- package/{types → es}/view/overlay/CanvasOverlay.d.ts +8 -11
- package/es/view/overlay/CanvasOverlay.js +172 -0
- package/es/view/overlay/CanvasOverlay.js.map +1 -0
- package/es/view/overlay/Grid.d.ts +30 -0
- package/es/view/overlay/Grid.js +118 -0
- package/es/view/overlay/Grid.js.map +1 -0
- package/es/view/overlay/ModificationOverlay.d.ts +9 -0
- package/es/view/overlay/ModificationOverlay.js +43 -0
- package/es/view/overlay/ModificationOverlay.js.map +1 -0
- package/es/view/overlay/OutlineOverlay.d.ts +14 -0
- package/es/view/overlay/OutlineOverlay.js +134 -0
- package/es/view/overlay/OutlineOverlay.js.map +1 -0
- package/es/view/overlay/SnaplineOverlay.d.ts +10 -0
- package/es/view/overlay/SnaplineOverlay.js +60 -0
- package/es/view/overlay/SnaplineOverlay.js.map +1 -0
- package/es/view/overlay/ToolOverlay.d.ts +19 -0
- package/es/view/overlay/ToolOverlay.js +76 -0
- package/es/view/overlay/ToolOverlay.js.map +1 -0
- package/{types → es}/view/overlay/getTransformHoc.d.ts +17 -14
- package/es/view/overlay/getTransformHoc.js +57 -0
- package/es/view/overlay/getTransformHoc.js.map +1 -0
- package/es/view/overlay/index.d.ts +8 -0
- package/es/view/overlay/index.js +9 -0
- package/es/view/overlay/index.js.map +1 -0
- package/es/view/shape/Circle.d.ts +2 -0
- package/es/view/shape/Circle.js +57 -0
- package/es/view/shape/Circle.js.map +1 -0
- package/es/view/shape/Ellipse.d.ts +2 -0
- package/es/view/shape/Ellipse.js +58 -0
- package/es/view/shape/Ellipse.js.map +1 -0
- package/es/view/shape/Line.d.ts +2 -0
- package/es/view/shape/Line.js +54 -0
- package/es/view/shape/Line.js.map +1 -0
- package/es/view/shape/Path.d.ts +6 -0
- package/es/view/shape/Path.js +43 -0
- package/es/view/shape/Path.js.map +1 -0
- package/es/view/shape/Polygon.d.ts +8 -0
- package/es/view/shape/Polygon.js +56 -0
- package/es/view/shape/Polygon.js.map +1 -0
- package/es/view/shape/Polyline.d.ts +2 -0
- package/es/view/shape/Polyline.js +49 -0
- package/es/view/shape/Polyline.js.map +1 -0
- package/es/view/shape/Rect.d.ts +15 -0
- package/es/view/shape/Rect.js +60 -0
- package/es/view/shape/Rect.js.map +1 -0
- package/es/view/shape/Text.d.ts +2 -0
- package/es/view/shape/Text.js +110 -0
- package/es/view/shape/Text.js.map +1 -0
- package/es/view/shape/index.d.ts +8 -0
- package/es/view/shape/index.js +9 -0
- package/es/view/shape/index.js.map +1 -0
- package/es/view/text/BaseText.d.ts +25 -0
- package/es/view/text/BaseText.js +114 -0
- package/es/view/text/BaseText.js.map +1 -0
- package/es/view/text/LineText.d.ts +9 -0
- package/es/view/text/LineText.js +149 -0
- package/es/view/text/LineText.js.map +1 -0
- package/es/view/text/index.d.ts +2 -0
- package/es/view/text/index.js +3 -0
- package/es/view/text/index.js.map +1 -0
- package/lib/LogicFlow.d.ts +966 -0
- package/lib/LogicFlow.js +1203 -0
- package/lib/LogicFlow.js.map +1 -0
- package/lib/algorithm/edge.d.ts +15 -0
- package/lib/algorithm/edge.js +62 -0
- package/lib/algorithm/edge.js.map +1 -0
- package/lib/algorithm/index.d.ts +6 -0
- package/lib/algorithm/index.js +75 -0
- package/lib/algorithm/index.js.map +1 -0
- package/lib/algorithm/outline.d.ts +7 -0
- package/lib/algorithm/outline.js +69 -0
- package/lib/algorithm/outline.js.map +1 -0
- package/lib/constant/index.d.ts +102 -0
- package/lib/constant/index.js +120 -0
- package/lib/constant/index.js.map +1 -0
- package/lib/event/eventArgs.d.ts +428 -0
- package/lib/event/eventArgs.js +3 -0
- package/lib/event/eventArgs.js.map +1 -0
- package/lib/event/eventEmitter.d.ts +48 -0
- package/lib/event/eventEmitter.js +95 -0
- package/lib/event/eventEmitter.js.map +1 -0
- package/lib/history/index.d.ts +23 -0
- package/lib/history/index.js +114 -0
- package/lib/history/index.js.map +1 -0
- package/lib/index.css +210 -0
- package/lib/index.d.ts +12 -0
- package/lib/index.js +58 -0
- package/lib/index.js.map +1 -0
- package/lib/index.less +1 -0
- package/lib/keyboard/index.d.ts +31 -0
- package/lib/keyboard/index.js +93 -0
- package/lib/keyboard/index.js.map +1 -0
- package/lib/keyboard/shortcut.d.ts +3 -0
- package/lib/keyboard/shortcut.js +120 -0
- package/lib/keyboard/shortcut.js.map +1 -0
- package/lib/model/BaseModel.d.ts +181 -0
- package/lib/model/BaseModel.js +3 -0
- package/lib/model/BaseModel.js.map +1 -0
- package/lib/model/EditConfigModel.d.ts +114 -0
- package/lib/model/EditConfigModel.js +195 -0
- package/lib/model/EditConfigModel.js.map +1 -0
- package/lib/model/GraphModel.d.ts +426 -0
- package/lib/model/GraphModel.js +1479 -0
- package/lib/model/GraphModel.js.map +1 -0
- package/lib/model/SnaplineModel.d.ts +34 -0
- package/lib/model/SnaplineModel.js +220 -0
- package/lib/model/SnaplineModel.js.map +1 -0
- package/lib/model/TransformModel.d.ts +101 -0
- package/lib/model/TransformModel.js +243 -0
- package/lib/model/TransformModel.js.map +1 -0
- package/lib/model/edge/BaseEdgeModel.d.ts +270 -0
- package/lib/model/edge/BaseEdgeModel.js +742 -0
- package/lib/model/edge/BaseEdgeModel.js.map +1 -0
- package/lib/model/edge/BezierEdgeModel.d.ts +63 -0
- package/lib/model/edge/BezierEdgeModel.js +250 -0
- package/lib/model/edge/BezierEdgeModel.js.map +1 -0
- package/lib/model/edge/LineEdgeModel.d.ts +19 -0
- package/lib/model/edge/LineEdgeModel.js +83 -0
- package/lib/model/edge/LineEdgeModel.js.map +1 -0
- package/lib/model/edge/PolylineEdgeModel.d.ts +85 -0
- package/lib/model/edge/PolylineEdgeModel.js +596 -0
- package/lib/model/edge/PolylineEdgeModel.js.map +1 -0
- package/lib/model/edge/index.d.ts +4 -0
- package/lib/model/edge/index.js +21 -0
- package/lib/model/edge/index.js.map +1 -0
- package/lib/model/index.d.ts +7 -0
- package/lib/model/index.js +24 -0
- package/lib/model/index.js.map +1 -0
- package/lib/model/node/BaseNodeModel.d.ts +260 -0
- package/lib/model/node/BaseNodeModel.js +886 -0
- package/lib/model/node/BaseNodeModel.js.map +1 -0
- package/lib/model/node/CircleNodeModel.d.ts +40 -0
- package/lib/model/node/CircleNodeModel.js +116 -0
- package/lib/model/node/CircleNodeModel.js.map +1 -0
- package/lib/model/node/DiamondNodeModel.d.ts +46 -0
- package/lib/model/node/DiamondNodeModel.js +193 -0
- package/lib/model/node/DiamondNodeModel.js.map +1 -0
- package/lib/model/node/EllipseNodeModel.d.ts +42 -0
- package/lib/model/node/EllipseNodeModel.js +124 -0
- package/lib/model/node/EllipseNodeModel.js.map +1 -0
- package/lib/model/node/HtmlNodeModel.d.ts +21 -0
- package/lib/model/node/HtmlNodeModel.js +65 -0
- package/lib/model/node/HtmlNodeModel.js.map +1 -0
- package/lib/model/node/PolygonNodeModel.d.ts +50 -0
- package/lib/model/node/PolygonNodeModel.js +202 -0
- package/lib/model/node/PolygonNodeModel.js.map +1 -0
- package/lib/model/node/RectNodeModel.d.ts +34 -0
- package/lib/model/node/RectNodeModel.js +86 -0
- package/lib/model/node/RectNodeModel.js.map +1 -0
- package/lib/model/node/TextNodeModel.d.ts +27 -0
- package/lib/model/node/TextNodeModel.js +119 -0
- package/lib/model/node/TextNodeModel.js.map +1 -0
- package/lib/model/node/index.d.ts +8 -0
- package/lib/model/node/index.js +25 -0
- package/lib/model/node/index.js.map +1 -0
- package/lib/options.d.ts +86 -0
- package/lib/options.js +77 -0
- package/lib/options.js.map +1 -0
- package/lib/style/index.css +210 -0
- package/lib/style/index.less +256 -0
- package/lib/style/raw.d.ts +4 -0
- package/lib/style/raw.js +9 -0
- package/lib/style/raw.js.map +1 -0
- package/lib/tool/MultipleSelectTool.d.ts +13 -0
- package/lib/tool/MultipleSelectTool.js +161 -0
- package/lib/tool/MultipleSelectTool.js.map +1 -0
- package/lib/tool/TextEditTool.d.ts +26 -0
- package/lib/tool/TextEditTool.js +190 -0
- package/lib/tool/TextEditTool.js.map +1 -0
- package/lib/tool/index.d.ts +2 -0
- package/lib/tool/index.js +19 -0
- package/lib/tool/index.js.map +1 -0
- package/lib/tool/snapline.d.ts +3 -0
- package/lib/tool/snapline.js +17 -0
- package/lib/tool/snapline.js.map +1 -0
- package/lib/tool/tool.d.ts +22 -0
- package/lib/tool/tool.js +49 -0
- package/lib/tool/tool.js.map +1 -0
- package/lib/util/animation.d.ts +12 -0
- package/lib/util/animation.js +24 -0
- package/lib/util/animation.js.map +1 -0
- package/lib/util/browser.d.ts +1 -0
- package/lib/util/browser.js +6 -0
- package/lib/util/browser.js.map +1 -0
- package/lib/util/compatible.d.ts +6 -0
- package/lib/util/compatible.js +21 -0
- package/lib/util/compatible.js.map +1 -0
- package/lib/util/drag.d.ts +47 -0
- package/lib/util/drag.js +142 -0
- package/lib/util/drag.js.map +1 -0
- package/lib/util/edge.d.ts +94 -0
- package/lib/util/edge.js +879 -0
- package/lib/util/edge.js.map +1 -0
- package/lib/util/geometry.d.ts +11 -0
- package/lib/util/geometry.js +78 -0
- package/lib/util/geometry.js.map +1 -0
- package/lib/util/graph.d.ts +13 -0
- package/lib/util/graph.js +59 -0
- package/lib/util/graph.js.map +1 -0
- package/lib/util/index.d.ts +16 -0
- package/lib/util/index.js +33 -0
- package/lib/util/index.js.map +1 -0
- package/lib/util/matrix.d.ts +32 -0
- package/lib/util/matrix.js +164 -0
- package/lib/util/matrix.js.map +1 -0
- package/lib/util/mobx.d.ts +2 -0
- package/lib/util/mobx.js +13 -0
- package/lib/util/mobx.js.map +1 -0
- package/lib/util/node.d.ts +69 -0
- package/lib/util/node.js +424 -0
- package/lib/util/node.js.map +1 -0
- package/lib/util/raf.d.ts +2 -0
- package/lib/util/raf.js +29 -0
- package/lib/util/raf.js.map +1 -0
- package/lib/util/sampling.d.ts +6 -0
- package/lib/util/sampling.js +72 -0
- package/lib/util/sampling.js.map +1 -0
- package/lib/util/theme.d.ts +4 -0
- package/lib/util/theme.js +160 -0
- package/lib/util/theme.js.map +1 -0
- package/lib/util/uuid.d.ts +7 -0
- package/lib/util/uuid.js +25 -0
- package/lib/util/uuid.js.map +1 -0
- package/lib/util/vector.d.ts +23 -0
- package/lib/util/vector.js +101 -0
- package/lib/util/vector.js.map +1 -0
- package/lib/util/zIndex.d.ts +2 -0
- package/lib/util/zIndex.js +10 -0
- package/lib/util/zIndex.js.map +1 -0
- package/lib/view/Anchor.d.ts +47 -0
- package/lib/view/Anchor.js +317 -0
- package/lib/view/Anchor.js.map +1 -0
- package/lib/view/Control.d.ts +100 -0
- package/lib/view/Control.js +327 -0
- package/lib/view/Control.js.map +1 -0
- package/lib/view/Graph.d.ts +18 -0
- package/lib/view/Graph.js +79 -0
- package/lib/view/Graph.js.map +1 -0
- package/lib/view/Rotate.d.ts +21 -0
- package/lib/view/Rotate.js +113 -0
- package/lib/view/Rotate.js.map +1 -0
- package/lib/view/behavior/dnd.d.ts +27 -0
- package/lib/view/behavior/dnd.js +113 -0
- package/lib/view/behavior/dnd.js.map +1 -0
- package/lib/view/edge/AdjustPoint.d.ts +50 -0
- package/lib/view/edge/AdjustPoint.js +371 -0
- package/lib/view/edge/AdjustPoint.js.map +1 -0
- package/lib/view/edge/Arrow.d.ts +25 -0
- package/lib/view/edge/Arrow.js +63 -0
- package/lib/view/edge/Arrow.js.map +1 -0
- package/lib/view/edge/BaseEdge.d.ts +148 -0
- package/lib/view/edge/BaseEdge.js +407 -0
- package/lib/view/edge/BaseEdge.js.map +1 -0
- package/lib/view/edge/BezierEdge.d.ts +26 -0
- package/lib/view/edge/BezierEdge.js +124 -0
- package/lib/view/edge/BezierEdge.js.map +1 -0
- package/{types/view/edge/BezierEdge.d.ts → lib/view/edge/LineEdge.d.ts} +9 -10
- package/lib/view/edge/LineEdge.js +84 -0
- package/lib/view/edge/LineEdge.js.map +1 -0
- package/lib/view/edge/PolylineEdge.d.ts +55 -0
- package/lib/view/edge/PolylineEdge.js +280 -0
- package/lib/view/edge/PolylineEdge.js.map +1 -0
- package/lib/view/edge/index.d.ts +6 -0
- package/lib/view/edge/index.js +23 -0
- package/lib/view/edge/index.js.map +1 -0
- package/lib/view/index.d.ts +7 -0
- package/lib/view/index.js +24 -0
- package/lib/view/index.js.map +1 -0
- package/lib/view/node/BaseNode.d.ts +49 -0
- package/lib/view/node/BaseNode.js +424 -0
- package/lib/view/node/BaseNode.js.map +1 -0
- package/lib/view/node/CircleNode.d.ts +10 -0
- package/lib/view/node/CircleNode.js +51 -0
- package/lib/view/node/CircleNode.js.map +1 -0
- package/lib/view/node/DiamondNode.d.ts +10 -0
- package/lib/view/node/DiamondNode.js +50 -0
- package/lib/view/node/DiamondNode.js.map +1 -0
- package/lib/view/node/EllipseNode.d.ts +10 -0
- package/lib/view/node/EllipseNode.js +50 -0
- package/lib/view/node/EllipseNode.js.map +1 -0
- package/lib/view/node/HtmlNode.d.ts +38 -0
- package/lib/view/node/HtmlNode.js +135 -0
- package/lib/view/node/HtmlNode.js.map +1 -0
- package/lib/view/node/PolygonNode.d.ts +10 -0
- package/lib/view/node/PolygonNode.js +54 -0
- package/lib/view/node/PolygonNode.js.map +1 -0
- package/lib/view/node/RectNode.d.ts +11 -0
- package/lib/view/node/RectNode.js +50 -0
- package/lib/view/node/RectNode.js.map +1 -0
- package/lib/view/node/TextNode.d.ts +12 -0
- package/lib/view/node/TextNode.js +61 -0
- package/lib/view/node/TextNode.js.map +1 -0
- package/lib/view/node/index.d.ts +8 -0
- package/lib/view/node/index.js +25 -0
- package/lib/view/node/index.js.map +1 -0
- package/lib/view/overlay/BackgroundOverlay.d.ts +28 -0
- package/lib/view/overlay/BackgroundOverlay.js +34 -0
- package/lib/view/overlay/BackgroundOverlay.js.map +1 -0
- package/lib/view/overlay/BezierAdjustOverlay.d.ts +31 -0
- package/lib/view/overlay/BezierAdjustOverlay.js +145 -0
- package/lib/view/overlay/BezierAdjustOverlay.js.map +1 -0
- package/lib/view/overlay/CanvasOverlay.d.ts +25 -0
- package/lib/view/overlay/CanvasOverlay.js +175 -0
- package/lib/view/overlay/CanvasOverlay.js.map +1 -0
- package/lib/view/overlay/Grid.d.ts +30 -0
- package/lib/view/overlay/Grid.js +121 -0
- package/lib/view/overlay/Grid.js.map +1 -0
- package/lib/view/overlay/ModificationOverlay.d.ts +9 -0
- package/lib/view/overlay/ModificationOverlay.js +46 -0
- package/lib/view/overlay/ModificationOverlay.js.map +1 -0
- package/lib/view/overlay/OutlineOverlay.d.ts +14 -0
- package/lib/view/overlay/OutlineOverlay.js +137 -0
- package/lib/view/overlay/OutlineOverlay.js.map +1 -0
- package/lib/view/overlay/SnaplineOverlay.d.ts +10 -0
- package/lib/view/overlay/SnaplineOverlay.js +66 -0
- package/lib/view/overlay/SnaplineOverlay.js.map +1 -0
- package/lib/view/overlay/ToolOverlay.d.ts +19 -0
- package/lib/view/overlay/ToolOverlay.js +79 -0
- package/lib/view/overlay/ToolOverlay.js.map +1 -0
- package/lib/view/overlay/getTransformHoc.d.ts +37 -0
- package/lib/view/overlay/getTransformHoc.js +61 -0
- package/lib/view/overlay/getTransformHoc.js.map +1 -0
- package/lib/view/overlay/index.d.ts +8 -0
- package/lib/view/overlay/index.js +25 -0
- package/lib/view/overlay/index.js.map +1 -0
- package/lib/view/shape/Circle.d.ts +2 -0
- package/lib/view/shape/Circle.js +61 -0
- package/lib/view/shape/Circle.js.map +1 -0
- package/lib/view/shape/Ellipse.d.ts +2 -0
- package/lib/view/shape/Ellipse.js +62 -0
- package/lib/view/shape/Ellipse.js.map +1 -0
- package/lib/view/shape/Line.d.ts +2 -0
- package/lib/view/shape/Line.js +58 -0
- package/lib/view/shape/Line.js.map +1 -0
- package/lib/view/shape/Path.d.ts +6 -0
- package/lib/view/shape/Path.js +47 -0
- package/lib/view/shape/Path.js.map +1 -0
- package/lib/view/shape/Polygon.d.ts +8 -0
- package/lib/view/shape/Polygon.js +60 -0
- package/lib/view/shape/Polygon.js.map +1 -0
- package/lib/view/shape/Polyline.d.ts +2 -0
- package/lib/view/shape/Polyline.js +53 -0
- package/lib/view/shape/Polyline.js.map +1 -0
- package/lib/view/shape/Rect.d.ts +15 -0
- package/lib/view/shape/Rect.js +64 -0
- package/lib/view/shape/Rect.js.map +1 -0
- package/lib/view/shape/Text.d.ts +2 -0
- package/lib/view/shape/Text.js +114 -0
- package/lib/view/shape/Text.js.map +1 -0
- package/lib/view/shape/index.d.ts +8 -0
- package/lib/view/shape/index.js +25 -0
- package/lib/view/shape/index.js.map +1 -0
- package/lib/view/text/BaseText.d.ts +25 -0
- package/lib/view/text/BaseText.js +117 -0
- package/lib/view/text/BaseText.js.map +1 -0
- package/lib/view/text/LineText.d.ts +9 -0
- package/lib/view/text/LineText.js +155 -0
- package/lib/view/text/LineText.js.map +1 -0
- package/lib/view/text/index.d.ts +2 -0
- package/lib/view/text/index.js +19 -0
- package/lib/view/text/index.js.map +1 -0
- package/package.json +41 -88
- package/rollup.config.js +15 -0
- package/src/LogicFlow.tsx +1831 -0
- package/src/algorithm/edge.ts +68 -0
- package/src/algorithm/index.ts +68 -0
- package/src/algorithm/outline.ts +77 -0
- package/src/constant/index.ts +127 -0
- package/src/event/event.md +66 -0
- package/src/event/eventArgs.ts +476 -0
- package/src/event/eventEmitter.ts +153 -0
- package/src/history/index.ts +112 -0
- package/src/index.less +1 -0
- package/src/index.ts +21 -0
- package/src/keyboard/index.ts +106 -0
- package/src/keyboard/shortcut.ts +123 -0
- package/src/model/BaseModel.ts +223 -0
- package/src/model/EditConfigModel.ts +215 -0
- package/src/model/GraphModel.ts +1516 -0
- package/src/model/SnaplineModel.ts +238 -0
- package/src/model/TransformModel.ts +258 -0
- package/src/model/edge/BaseEdgeModel.ts +688 -0
- package/src/model/edge/BezierEdgeModel.ts +196 -0
- package/src/model/edge/LineEdgeModel.ts +26 -0
- package/src/model/edge/PolylineEdgeModel.ts +656 -0
- package/src/model/edge/index.ts +4 -0
- package/src/model/index.ts +8 -0
- package/src/model/node/BaseNodeModel.ts +839 -0
- package/src/model/node/CircleNodeModel.ts +89 -0
- package/src/model/node/DiamondNodeModel.ts +128 -0
- package/src/model/node/EllipseNodeModel.ts +94 -0
- package/src/model/node/HtmlNodeModel.ts +49 -0
- package/src/model/node/PolygonNodeModel.ts +147 -0
- package/src/model/node/RectNodeModel.ts +57 -0
- package/src/model/node/TextNodeModel.ts +41 -0
- package/src/model/node/index.ts +8 -0
- package/src/options.ts +173 -0
- package/src/style/index.less +256 -0
- package/src/style/raw.ts +217 -0
- package/src/tool/MultipleSelectTool.tsx +132 -0
- package/src/tool/TextEditTool.tsx +193 -0
- package/src/tool/index.ts +2 -0
- package/src/tool/snapline.ts +17 -0
- package/src/tool/tool.ts +66 -0
- package/src/typings.d.ts +5 -0
- package/src/util/animation.ts +29 -0
- package/src/util/browser.ts +4 -0
- package/src/util/compatible.ts +15 -0
- package/src/util/drag.ts +186 -0
- package/src/util/edge.ts +1034 -0
- package/src/util/geometry.ts +53 -0
- package/src/util/graph.ts +46 -0
- package/src/util/index.ts +16 -0
- package/src/util/matrix.ts +129 -0
- package/src/util/mobx.ts +23 -0
- package/src/util/node.ts +519 -0
- package/src/util/raf.ts +28 -0
- package/src/util/sampling.ts +85 -0
- package/src/util/theme.ts +180 -0
- package/src/util/uuid.ts +26 -0
- package/src/util/vector.ts +93 -0
- package/src/util/zIndex.ts +6 -0
- package/src/view/Anchor.tsx +407 -0
- package/src/view/Control.tsx +446 -0
- package/src/view/Graph.tsx +104 -0
- package/src/view/Rotate.tsx +112 -0
- package/src/view/behavior/dnd.ts +116 -0
- package/src/view/edge/AdjustPoint.tsx +439 -0
- package/src/view/edge/Arrow.tsx +54 -0
- package/src/view/edge/BaseEdge.tsx +489 -0
- package/src/view/edge/BezierEdge.tsx +101 -0
- package/src/view/edge/LineEdge.tsx +81 -0
- package/src/view/edge/PolylineEdge.tsx +299 -0
- package/src/view/edge/index.ts +6 -0
- package/src/view/index.ts +8 -0
- package/src/view/node/BaseNode.tsx +494 -0
- package/src/view/node/CircleNode.tsx +19 -0
- package/src/view/node/DiamondNode.tsx +22 -0
- package/src/view/node/EllipseNode.tsx +20 -0
- package/src/view/node/HtmlNode.tsx +92 -0
- package/src/view/node/PolygonNode.tsx +26 -0
- package/src/view/node/RectNode.tsx +28 -0
- package/src/view/node/TextNode.tsx +37 -0
- package/src/view/node/index.ts +8 -0
- package/src/view/overlay/BackgroundOverlay.tsx +39 -0
- package/src/view/overlay/BezierAdjustOverlay.tsx +150 -0
- package/src/view/overlay/CanvasOverlay.tsx +180 -0
- package/src/view/overlay/Grid.tsx +135 -0
- package/src/view/overlay/ModificationOverlay.tsx +31 -0
- package/src/view/overlay/OutlineOverlay.tsx +170 -0
- package/src/view/overlay/SnaplineOverlay.tsx +44 -0
- package/src/view/overlay/ToolOverlay.tsx +65 -0
- package/src/view/overlay/getTransformHoc.tsx +50 -0
- package/src/view/overlay/index.ts +8 -0
- package/src/view/shape/Circle.tsx +27 -0
- package/src/view/shape/Ellipse.tsx +28 -0
- package/src/view/shape/Line.tsx +24 -0
- package/src/view/shape/Path.tsx +19 -0
- package/src/view/shape/Polygon.tsx +36 -0
- package/src/view/shape/Polyline.tsx +19 -0
- package/src/view/shape/Rect.tsx +44 -0
- package/src/view/shape/Text.tsx +138 -0
- package/src/view/shape/index.ts +8 -0
- package/src/view/text/BaseText.tsx +96 -0
- package/src/view/text/LineText.tsx +154 -0
- package/src/view/text/index.ts +2 -0
- package/tsconfig.json +18 -0
- package/dist/entry.js +0 -7
- package/dist/logic-flow.js +0 -23
- package/dist/logic-flow.min.js +0 -23
- package/types/LogicFlow.d.ts +0 -581
- package/types/algorithm/edge.d.ts +0 -6
- package/types/algorithm/outline.d.ts +0 -35
- package/types/constant/DefaultAnimation.d.ts +0 -12
- package/types/constant/DefaultTheme.d.ts +0 -270
- package/types/event/eventEmitter.d.ts +0 -36
- package/types/history/History.d.ts +0 -20
- package/types/model/BaseModel.d.ts +0 -99
- package/types/model/SnaplineModel.d.ts +0 -33
- package/types/model/edge/BezierEdgeModel.d.ts +0 -51
- package/types/model/edge/LineEdgeModel.d.ts +0 -14
- package/types/model/edge/PolylineEdgeModel.d.ts +0 -63
- package/types/model/node/BaseNodeModel.d.ts +0 -232
- package/types/model/node/CircleNodeModel.d.ts +0 -21
- package/types/model/node/DiamondNodeModel.d.ts +0 -25
- package/types/model/node/EllipseNodeModel.d.ts +0 -22
- package/types/model/node/HtmlNodeModel.d.ts +0 -12
- package/types/model/node/PolygonNodeModel.d.ts +0 -28
- package/types/model/node/RectNodeModel.d.ts +0 -19
- package/types/model/node/TextNodeModel.d.ts +0 -19
- package/types/options.d.ts +0 -240
- package/types/tool/MultipleSelectTool.d.ts +0 -20
- package/types/tool/TextEditTool.d.ts +0 -34
- package/types/tool/index.d.ts +0 -13
- package/types/type/index.d.ts +0 -429
- package/types/util/animation.d.ts +0 -2
- package/types/util/compatible.d.ts +0 -1
- package/types/util/drag.d.ts +0 -38
- package/types/util/edge.d.ts +0 -108
- package/types/util/geometry.d.ts +0 -2
- package/types/util/index.d.ts +0 -7
- package/types/util/node.d.ts +0 -66
- package/types/util/raf.d.ts +0 -2
- package/types/util/theme.d.ts +0 -2
- package/types/util/uuid.d.ts +0 -6
- package/types/view/Anchor.d.ts +0 -54
- package/types/view/Graph.d.ts +0 -21
- package/types/view/basic-shape/Circle.d.ts +0 -2
- package/types/view/basic-shape/Ellipse.d.ts +0 -2
- package/types/view/basic-shape/Line.d.ts +0 -3
- package/types/view/basic-shape/LinearGradient.d.ts +0 -1
- package/types/view/basic-shape/Path.d.ts +0 -7
- package/types/view/basic-shape/Polygon.d.ts +0 -2
- package/types/view/basic-shape/Polyline.d.ts +0 -3
- package/types/view/basic-shape/Rect.d.ts +0 -14
- package/types/view/basic-shape/Text.d.ts +0 -2
- package/types/view/behavior/DnD.d.ts +0 -35
- package/types/view/behavior/Transform.d.ts +0 -4
- package/types/view/edge/AdjustPoint.d.ts +0 -56
- package/types/view/edge/Arrow.d.ts +0 -24
- package/types/view/edge/index.d.ts +0 -6
- package/types/view/index.d.ts +0 -2
- package/types/view/node/BaseNode.d.ts +0 -57
- package/types/view/node/CircleNode.d.ts +0 -5
- package/types/view/node/DiamondNode.d.ts +0 -5
- package/types/view/node/EllipseNode.d.ts +0 -5
- package/types/view/node/PolygonNode.d.ts +0 -5
- package/types/view/node/RectNode.d.ts +0 -5
- package/types/view/node/TextNode.d.ts +0 -6
- package/types/view/node/index.d.ts +0 -9
- package/types/view/overlay/BezierAdjustOverlay.d.ts +0 -12
- package/types/view/overlay/Grid.d.ts +0 -30
- package/types/view/overlay/HtmlOverlay.d.ts +0 -15
- package/types/view/overlay/ModificationOverlay.d.ts +0 -9
- package/types/view/overlay/OutlineOverlay.d.ts +0 -17
- package/types/view/overlay/SnaplineOverlay.d.ts +0 -9
- package/types/view/overlay/ToolOverlay.d.ts +0 -17
- package/types/view/text/BaseText.d.ts +0 -29
- package/types/view/text/LineText.d.ts +0 -9
- /package/{types → es}/algorithm/index.d.ts +0 -0
- /package/{types → es}/keyboard/shortcut.d.ts +0 -0
- /package/{types → es}/model/edge/index.d.ts +0 -0
- /package/{types → es}/model/index.d.ts +0 -0
- /package/{types → es}/model/node/index.d.ts +0 -0
- /package/{types → es}/util/browser.d.ts +0 -0
- /package/{types → es}/util/mobx.d.ts +0 -0
- /package/{types → es}/util/zIndex.d.ts +0 -0
|
@@ -0,0 +1,966 @@
|
|
|
1
|
+
import { ComponentType, createElement as h } from 'preact/compat';
|
|
2
|
+
import { Options as LFOptions } from './options';
|
|
3
|
+
import * as _Model from './model';
|
|
4
|
+
import { BaseEdgeModel, BaseNodeModel, EditConfigInterface, GraphModel, SnaplineModel, ZoomParamType } from './model';
|
|
5
|
+
import Dnd from './view/behavior/dnd';
|
|
6
|
+
import Tool from './tool/tool';
|
|
7
|
+
import Keyboard from './keyboard';
|
|
8
|
+
import History from './history';
|
|
9
|
+
import { EventCallback, CallbackArgs, EventArgs } from './event/eventEmitter';
|
|
10
|
+
import { EventType, SegmentDirection } from './constant';
|
|
11
|
+
import Extension = LogicFlow.Extension;
|
|
12
|
+
import RegisteredExtension = LogicFlow.RegisteredExtension;
|
|
13
|
+
import ExtensionConstructor = LogicFlow.ExtensionConstructor;
|
|
14
|
+
import GraphConfigData = LogicFlow.GraphConfigData;
|
|
15
|
+
import NodeConfig = LogicFlow.NodeConfig;
|
|
16
|
+
import EdgeConfig = LogicFlow.EdgeConfig;
|
|
17
|
+
import GraphData = LogicFlow.GraphData;
|
|
18
|
+
import NodeData = LogicFlow.NodeData;
|
|
19
|
+
import EdgeData = LogicFlow.EdgeData;
|
|
20
|
+
import RegisterConfig = LogicFlow.RegisterConfig;
|
|
21
|
+
import GraphElements = LogicFlow.GraphElements;
|
|
22
|
+
import Position = LogicFlow.Position;
|
|
23
|
+
import PointTuple = LogicFlow.PointTuple;
|
|
24
|
+
import ExtensionRender = LogicFlow.ExtensionRender;
|
|
25
|
+
import RegisterElementFunc = LogicFlow.RegisterElementFunc;
|
|
26
|
+
import PropertiesType = LogicFlow.PropertiesType;
|
|
27
|
+
import ClientPosition = LogicFlow.ClientPosition;
|
|
28
|
+
declare const pluginFlag: unique symbol;
|
|
29
|
+
export declare class LogicFlow {
|
|
30
|
+
readonly container: HTMLElement;
|
|
31
|
+
readonly options: LFOptions.Definition;
|
|
32
|
+
readonly graphModel: GraphModel;
|
|
33
|
+
viewMap: Map<string, ComponentType>;
|
|
34
|
+
history: History;
|
|
35
|
+
keyboard: Keyboard;
|
|
36
|
+
dnd: Dnd;
|
|
37
|
+
tool: Tool;
|
|
38
|
+
snaplineModel?: SnaplineModel;
|
|
39
|
+
components: ExtensionRender[];
|
|
40
|
+
readonly plugins: ExtensionConstructor[];
|
|
41
|
+
static extensions: Map<string, RegisteredExtension>;
|
|
42
|
+
extension: Record<string, Extension>;
|
|
43
|
+
readonly width?: number;
|
|
44
|
+
readonly height?: number;
|
|
45
|
+
/**
|
|
46
|
+
* 自定义数据转换方法
|
|
47
|
+
* 当接入系统格式和 LogicFlow 数据格式不一致时,可自定义此方法来进行数据格式转换
|
|
48
|
+
* 详情请参考 adapter docs
|
|
49
|
+
* 包括 adapterIn 和 adapterOut 两个方法
|
|
50
|
+
*/
|
|
51
|
+
private adapterIn?;
|
|
52
|
+
private adapterOut?;
|
|
53
|
+
[propName: string]: any;
|
|
54
|
+
private initContainer;
|
|
55
|
+
protected get [Symbol.toStringTag](): string;
|
|
56
|
+
constructor(options: LFOptions.Common);
|
|
57
|
+
/*********************************************************
|
|
58
|
+
* Register 相关
|
|
59
|
+
********************************************************/
|
|
60
|
+
private setView;
|
|
61
|
+
private getView;
|
|
62
|
+
register(element: RegisterConfig): void;
|
|
63
|
+
register(type: string, fn: RegisterElementFunc, isObserverView?: boolean): void;
|
|
64
|
+
/**
|
|
65
|
+
* 注册元素(节点 or 边)
|
|
66
|
+
* @param config 注册元素的配置项
|
|
67
|
+
* @private
|
|
68
|
+
*/
|
|
69
|
+
private registerElement;
|
|
70
|
+
/**
|
|
71
|
+
* 批量注册元素
|
|
72
|
+
* @param elements 注册的元素
|
|
73
|
+
*/
|
|
74
|
+
batchRegister(elements?: RegisterConfig[]): void;
|
|
75
|
+
private defaultRegister;
|
|
76
|
+
/*********************************************************
|
|
77
|
+
* Node 相关方法
|
|
78
|
+
********************************************************/
|
|
79
|
+
/**
|
|
80
|
+
* 添加节点
|
|
81
|
+
* @param nodeConfig 节点配置
|
|
82
|
+
* @param eventType 新增节点事件类型,默认EventType.NODE_ADD
|
|
83
|
+
* @param e MouseEvent 事件
|
|
84
|
+
*/
|
|
85
|
+
addNode(nodeConfig: NodeConfig, eventType?: EventType, e?: MouseEvent): BaseNodeModel;
|
|
86
|
+
/**
|
|
87
|
+
* 删除节点
|
|
88
|
+
* @param {string} nodeId 节点Id
|
|
89
|
+
*/
|
|
90
|
+
deleteNode(nodeId: string): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* 克隆节点
|
|
93
|
+
* @param nodeId 节点Id
|
|
94
|
+
*/
|
|
95
|
+
cloneNode(nodeId: string): NodeData | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* 修改节点的id,如果不传新的id,会内部自动创建一个。
|
|
98
|
+
* @param { string } nodeId 将要被修改的id
|
|
99
|
+
* @param { string } newId 可选,修改后的id
|
|
100
|
+
* @returns 修改后的节点id, 如果传入的oldId不存在,返回空字符串
|
|
101
|
+
*/
|
|
102
|
+
changeNodeId(nodeId: string, newId?: string): string;
|
|
103
|
+
/**
|
|
104
|
+
* 修改指定节点类型
|
|
105
|
+
* @param nodeId 节点id
|
|
106
|
+
* @param type 节点类型
|
|
107
|
+
*/
|
|
108
|
+
changeNodeType(nodeId: string, type: string): void;
|
|
109
|
+
/**
|
|
110
|
+
* 获取节点对象
|
|
111
|
+
* @param nodeId 节点Id
|
|
112
|
+
*/
|
|
113
|
+
getNodeModelById(nodeId: string): BaseNodeModel | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* 获取节点数据
|
|
116
|
+
* @param nodeId 节点
|
|
117
|
+
*/
|
|
118
|
+
getNodeDataById(nodeId: string): NodeData | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* 获取所有以此节点为终点的边
|
|
121
|
+
* @param { string } nodeId
|
|
122
|
+
*/
|
|
123
|
+
getNodeIncomingEdge(nodeId: string): _Model.BaseEdgeModel[];
|
|
124
|
+
/**
|
|
125
|
+
* 获取所有以此节点为起点的边
|
|
126
|
+
* @param {string} nodeId
|
|
127
|
+
*/
|
|
128
|
+
getNodeOutgoingEdge(nodeId: string): _Model.BaseEdgeModel[];
|
|
129
|
+
/**
|
|
130
|
+
* 获取节点连接到的所有起始节点
|
|
131
|
+
* @param {string} nodeId
|
|
132
|
+
*/
|
|
133
|
+
getNodeIncomingNode(nodeId: string): _Model.BaseNodeModel[];
|
|
134
|
+
/**
|
|
135
|
+
* 获取节点连接到的所有目标节点
|
|
136
|
+
* @param {string} nodeId
|
|
137
|
+
*/
|
|
138
|
+
getNodeOutgoingNode(nodeId: string): _Model.BaseNodeModel[];
|
|
139
|
+
/**
|
|
140
|
+
* 内部保留方法
|
|
141
|
+
* 创建一个fakeNode,用于dnd插件拖动节点进画布的时候使用。
|
|
142
|
+
*/
|
|
143
|
+
createFakeNode(nodeConfig: NodeConfig): _Model.BaseNodeModel | null;
|
|
144
|
+
/**
|
|
145
|
+
* 内部保留方法
|
|
146
|
+
* 移除fakeNode
|
|
147
|
+
*/
|
|
148
|
+
removeFakeNode(): void;
|
|
149
|
+
/**
|
|
150
|
+
* 内部保留方法
|
|
151
|
+
* 用于fakeNode显示对齐线
|
|
152
|
+
*/
|
|
153
|
+
setNodeSnapLine(data: NodeData): void;
|
|
154
|
+
/**
|
|
155
|
+
* 内部保留方法
|
|
156
|
+
* 用于fakeNode移除对齐线
|
|
157
|
+
*/
|
|
158
|
+
removeNodeSnapLine(): void;
|
|
159
|
+
/*********************************************************
|
|
160
|
+
* Edge 相关方法
|
|
161
|
+
********************************************************/
|
|
162
|
+
/**
|
|
163
|
+
* 设置默认的边类型。
|
|
164
|
+
* 也就是设置在节点直接由用户手动绘制的连线类型。
|
|
165
|
+
* @param type LFOptions.EdgeType
|
|
166
|
+
*/
|
|
167
|
+
setDefaultEdgeType(type: LFOptions.EdgeType): void;
|
|
168
|
+
/**
|
|
169
|
+
* 给两个节点之间添加一条边
|
|
170
|
+
* @example
|
|
171
|
+
* lf.addEdge({
|
|
172
|
+
* type: 'polygon'
|
|
173
|
+
* sourceNodeId: 'node_id_1',
|
|
174
|
+
* targetNodeId: 'node_id_2',
|
|
175
|
+
* })
|
|
176
|
+
* @param {EdgeConfig} edgeConfig
|
|
177
|
+
*/
|
|
178
|
+
addEdge(edgeConfig: EdgeConfig): BaseEdgeModel;
|
|
179
|
+
/**
|
|
180
|
+
* 基于id获取边数据
|
|
181
|
+
* @param edgeId 边Id
|
|
182
|
+
* @returns EdgeData
|
|
183
|
+
*/
|
|
184
|
+
getEdgeDataById(edgeId: string): EdgeData | undefined;
|
|
185
|
+
/**
|
|
186
|
+
* 基于边Id获取边的model
|
|
187
|
+
* @param edgeId 边的Id
|
|
188
|
+
* @return model
|
|
189
|
+
*/
|
|
190
|
+
getEdgeModelById(edgeId: string): BaseEdgeModel | undefined;
|
|
191
|
+
/**
|
|
192
|
+
* 获取满足条件边的model
|
|
193
|
+
* @param edgeFilter 过滤条件
|
|
194
|
+
* @example
|
|
195
|
+
* 获取所有起点为节点 A 的边的 model
|
|
196
|
+
* lf.getEdgeModels({
|
|
197
|
+
* sourceNodeId: 'nodeA_id'
|
|
198
|
+
* })
|
|
199
|
+
* 获取所有终点为节点 B 的边的 model
|
|
200
|
+
* lf.getEdgeModels({
|
|
201
|
+
* targetNodeId: 'nodeB_id'
|
|
202
|
+
* })
|
|
203
|
+
* 获取起点为节点 A,终点为节点 B 的边
|
|
204
|
+
* lf.getEdgeModels({
|
|
205
|
+
* sourceNodeId: 'nodeA_id',
|
|
206
|
+
* targetNodeId: 'nodeB_id'
|
|
207
|
+
* })
|
|
208
|
+
* @return model数组
|
|
209
|
+
*/
|
|
210
|
+
getEdgeModels({ sourceNodeId, targetNodeId, }: {
|
|
211
|
+
sourceNodeId?: string;
|
|
212
|
+
targetNodeId?: string;
|
|
213
|
+
}): BaseEdgeModel[];
|
|
214
|
+
/**
|
|
215
|
+
* 修改边的id, 如果不传新的id,会内部自动创建一个。
|
|
216
|
+
* @param { string } edgeId 将要被修改的id
|
|
217
|
+
* @param { string } newId 可选,修改后的id
|
|
218
|
+
* @returns 修改后的节点id, 如果传入的oldId不存在,返回空字符串
|
|
219
|
+
*/
|
|
220
|
+
changeEdgeId(edgeId: string, newId?: string): string;
|
|
221
|
+
/**
|
|
222
|
+
* 切换边的类型
|
|
223
|
+
* @param edgeId 边Id
|
|
224
|
+
* @param type 边类型
|
|
225
|
+
*/
|
|
226
|
+
changeEdgeType(edgeId: string, type: LFOptions.EdgeType): void;
|
|
227
|
+
/**
|
|
228
|
+
* 删除边
|
|
229
|
+
* @param {string} edgeId 边Id
|
|
230
|
+
*/
|
|
231
|
+
deleteEdge(edgeId: string): boolean;
|
|
232
|
+
/**
|
|
233
|
+
* 基于给定节点(作为边起点或终点,可以只传其一),删除对应的边
|
|
234
|
+
* @param sourceNodeId 边的起点节点ID
|
|
235
|
+
* @param targetNodeId 边的终点节点ID
|
|
236
|
+
*/
|
|
237
|
+
deleteEdgeByNodeId({ sourceNodeId, targetNodeId, }: {
|
|
238
|
+
sourceNodeId?: string;
|
|
239
|
+
targetNodeId?: string;
|
|
240
|
+
}): void;
|
|
241
|
+
/**
|
|
242
|
+
* 获取节点连接的所有边的model
|
|
243
|
+
* @param nodeId 节点ID
|
|
244
|
+
* @returns model数组
|
|
245
|
+
*/
|
|
246
|
+
getNodeEdges(nodeId: string): BaseEdgeModel[];
|
|
247
|
+
/*********************************************************
|
|
248
|
+
* Element 相关方法
|
|
249
|
+
********************************************************/
|
|
250
|
+
/**
|
|
251
|
+
* 添加多个元素, 包括边和节点。
|
|
252
|
+
* @param nodes
|
|
253
|
+
* @param edges
|
|
254
|
+
* @param distance
|
|
255
|
+
*/
|
|
256
|
+
addElements({ nodes, edges }: GraphConfigData, distance?: number): GraphElements | undefined;
|
|
257
|
+
/**
|
|
258
|
+
* 将图形选中
|
|
259
|
+
* @param id 选择元素ID
|
|
260
|
+
* @param multiple 是否允许多选,如果为true,不会将上一个选中的元素重置
|
|
261
|
+
* @param toFront 是否将选中的元素置顶,默认为true
|
|
262
|
+
*/
|
|
263
|
+
selectElementById(id: string, multiple?: boolean, toFront?: boolean): void;
|
|
264
|
+
/**
|
|
265
|
+
* 获取选中的元素数据
|
|
266
|
+
* @param isIgnoreCheck 是否包括sourceNode和targetNode没有被选中的边,默认包括。
|
|
267
|
+
* 注意:复制的时候不能包括此类边, 因为复制的时候不允许悬空的边。
|
|
268
|
+
*/
|
|
269
|
+
getSelectElements(isIgnoreCheck?: boolean): GraphData;
|
|
270
|
+
/**
|
|
271
|
+
* 将所有选中的元素设置为非选中
|
|
272
|
+
*/
|
|
273
|
+
clearSelectElements(): void;
|
|
274
|
+
/**
|
|
275
|
+
* 获取节点或边对象
|
|
276
|
+
* @param id id
|
|
277
|
+
*/
|
|
278
|
+
getModelById(id: string): LogicFlow.GraphElement | undefined;
|
|
279
|
+
/**
|
|
280
|
+
* 获取节点或边的数据
|
|
281
|
+
* @param id id
|
|
282
|
+
*/
|
|
283
|
+
getDataById(id: string): NodeData | EdgeData | undefined;
|
|
284
|
+
/**
|
|
285
|
+
* 删除元素,在不确定当前id是节点还是边时使用
|
|
286
|
+
* @param id 元素id
|
|
287
|
+
*/
|
|
288
|
+
deleteElement(id: string): boolean;
|
|
289
|
+
/**
|
|
290
|
+
* 设置元素的zIndex.
|
|
291
|
+
* 注意:默认堆叠模式下,不建议使用此方法。
|
|
292
|
+
* @see todo link 堆叠模式
|
|
293
|
+
* @param id 元素id
|
|
294
|
+
* @param zIndex zIndex的值,可以传数字,也支持传入 'top' 和 'bottom'
|
|
295
|
+
*/
|
|
296
|
+
setElementZIndex(id: string, zIndex: number | 'top' | 'bottom'): void;
|
|
297
|
+
/**
|
|
298
|
+
* 获取指定区域内的所有元素,此区域必须是DOM层。
|
|
299
|
+
* 例如鼠标绘制选区后,获取选区内的所有元素。
|
|
300
|
+
* @see todo 分层
|
|
301
|
+
* @param leftTopPoint 区域左上角坐标, dom层坐标
|
|
302
|
+
* @param rightBottomPoint 区域右下角坐标,dom层坐标
|
|
303
|
+
* @param wholeEdge
|
|
304
|
+
* @param wholeNode
|
|
305
|
+
* @param ignoreHideElement
|
|
306
|
+
*/
|
|
307
|
+
getAreaElement(leftTopPoint: PointTuple, rightBottomPoint: PointTuple, wholeEdge?: boolean, wholeNode?: boolean, ignoreHideElement?: boolean): (EdgeData | NodeData)[];
|
|
308
|
+
/**
|
|
309
|
+
* 设置元素的自定义属性
|
|
310
|
+
* @see todo docs link
|
|
311
|
+
* @param id 元素的id
|
|
312
|
+
* @param properties 自定义属性
|
|
313
|
+
*/
|
|
314
|
+
setProperties(id: string, properties: PropertiesType): void;
|
|
315
|
+
/**
|
|
316
|
+
* 获取元素的自定义属性
|
|
317
|
+
* @param id 元素的id
|
|
318
|
+
* @returns 自定义属性
|
|
319
|
+
*/
|
|
320
|
+
getProperties(id: string): PropertiesType | undefined;
|
|
321
|
+
deleteProperty(id: string, key: string): void;
|
|
322
|
+
/**
|
|
323
|
+
* FBI WARNING !!! 慎用 === 不要用
|
|
324
|
+
* 修改对应元素 model 中的属性
|
|
325
|
+
* 注意:此方法慎用,除非您对logicflow内部有足够的了解。
|
|
326
|
+
* 大多数情况下,请使用setProperties、updateText、changeNodeId等方法。
|
|
327
|
+
* 例如直接使用此方法修改节点的id,那么就是会导致连接到此节点的边的sourceNodeId出现找不到的情况。
|
|
328
|
+
* @param {string} id 元素id
|
|
329
|
+
* @param {object} attributes 需要更新的属性
|
|
330
|
+
*/
|
|
331
|
+
updateAttributes(id: string, attributes: object): void;
|
|
332
|
+
/*********************************************************
|
|
333
|
+
* Text 相关方法
|
|
334
|
+
********************************************************/
|
|
335
|
+
/**
|
|
336
|
+
* 显示节点、连线文本编辑框
|
|
337
|
+
* @param id 元素id
|
|
338
|
+
*/
|
|
339
|
+
editText(id: string): void;
|
|
340
|
+
/**
|
|
341
|
+
* 更新节点或边的文案
|
|
342
|
+
* @param id 节点或者边id
|
|
343
|
+
* @param value 文案内容
|
|
344
|
+
*/
|
|
345
|
+
updateText(id: string, value: string): void;
|
|
346
|
+
/*********************************************************
|
|
347
|
+
* EditConfig 相关方法
|
|
348
|
+
********************************************************/
|
|
349
|
+
/**
|
|
350
|
+
* 更新流程图编辑相关设置
|
|
351
|
+
* @param {object} config 编辑配置
|
|
352
|
+
* @see todo docs link
|
|
353
|
+
*/
|
|
354
|
+
updateEditConfig(config: EditConfigInterface): void;
|
|
355
|
+
/**
|
|
356
|
+
* 获取流程图当前编辑相关设置
|
|
357
|
+
* @see todo docs link
|
|
358
|
+
*/
|
|
359
|
+
getEditConfig(): Partial<_Model.EditConfigModel>;
|
|
360
|
+
/*********************************************************
|
|
361
|
+
* Graph 相关方法
|
|
362
|
+
********************************************************/
|
|
363
|
+
/**
|
|
364
|
+
* 设置主题样式
|
|
365
|
+
* @param { object } style 自定义主题样式
|
|
366
|
+
* todo docs link
|
|
367
|
+
*/
|
|
368
|
+
setTheme(style: Partial<LogicFlow.Theme>): void;
|
|
369
|
+
private focusByElement;
|
|
370
|
+
private focusByCoordinate;
|
|
371
|
+
/**
|
|
372
|
+
* 定位到画布视口中心
|
|
373
|
+
* 支持用户传入图形当前的坐标或id,可以通过type来区分是节点还是边的id,也可以不传(兜底)
|
|
374
|
+
* @param focusOnArgs.id 如果传入的是id, 则画布视口中心移动到此id的元素中心点。
|
|
375
|
+
* @param focusOnArgs.coordinate 如果传入的是坐标,则画布视口中心移动到此坐标。
|
|
376
|
+
* TODO: 测试下面代码,重构了一下逻辑,重载 api 定义
|
|
377
|
+
*/
|
|
378
|
+
focusOn(id: string): void;
|
|
379
|
+
focusOn(coordinate: Position): void;
|
|
380
|
+
focusOn(focusOnArgs: LogicFlow.FocusOnArgsType): void;
|
|
381
|
+
/**
|
|
382
|
+
* 重新设置画布的宽高
|
|
383
|
+
* 不传会自动计算画布宽高
|
|
384
|
+
*/
|
|
385
|
+
resize(width?: number, height?: number): void;
|
|
386
|
+
/**
|
|
387
|
+
* 将某个元素放置到顶部。
|
|
388
|
+
* 如果堆叠模式为默认模式,则将原置顶元素重新恢复原有层级。
|
|
389
|
+
* 如果堆叠模式为递增模式,则将需指定元素zIndex设置为当前最大zIndex + 1。
|
|
390
|
+
* @see todo link 堆叠模式
|
|
391
|
+
* @param id 元素Id
|
|
392
|
+
*/
|
|
393
|
+
toFront(id: string): void;
|
|
394
|
+
/**
|
|
395
|
+
* 获取事件位置相对于画布左上角的坐标
|
|
396
|
+
* 画布所在的位置可以是页面任何地方,原生事件返回的坐标是相对于页面左上角的,该方法可以提供以画布左上角为原点的准确位置。
|
|
397
|
+
* @param {number} x
|
|
398
|
+
* @param {number} y
|
|
399
|
+
* @returns {object} Point 事件位置的坐标
|
|
400
|
+
* @returns {object} Point.domOverlayPosition HTML层上的坐标
|
|
401
|
+
* @returns {object} Point.canvasOverlayPosition SVG层上的坐标
|
|
402
|
+
*/
|
|
403
|
+
getPointByClient(x: number, y: number): ClientPosition;
|
|
404
|
+
getPointByClient(point: Position): ClientPosition;
|
|
405
|
+
/**
|
|
406
|
+
* 获取流程绘图数据
|
|
407
|
+
* 注意: getGraphData返回的数据受到adapter影响,所以其数据格式不一定是logicflow内部图数据格式。
|
|
408
|
+
* 如果实现通用插件,请使用getGraphRawData
|
|
409
|
+
*/
|
|
410
|
+
getGraphData(...params: any): GraphData | unknown;
|
|
411
|
+
/**
|
|
412
|
+
* 获取流程绘图原始数据
|
|
413
|
+
* 在存在adapter时,可以使用getGraphRawData获取图原始数据
|
|
414
|
+
*/
|
|
415
|
+
getGraphRawData(): GraphData;
|
|
416
|
+
/**
|
|
417
|
+
* 清空画布
|
|
418
|
+
*/
|
|
419
|
+
clearData(): void;
|
|
420
|
+
/*********************************************************
|
|
421
|
+
* LogicFlow Render方法
|
|
422
|
+
********************************************************/
|
|
423
|
+
renderRawData(graphRawData: GraphConfigData): void;
|
|
424
|
+
/**
|
|
425
|
+
* 渲染图
|
|
426
|
+
* @example
|
|
427
|
+
* lf.render({
|
|
428
|
+
* nodes: [
|
|
429
|
+
* {
|
|
430
|
+
* id: 'node_1',
|
|
431
|
+
* type: 'rect',
|
|
432
|
+
* x: 100,
|
|
433
|
+
* y: 100
|
|
434
|
+
* },
|
|
435
|
+
* {
|
|
436
|
+
* id: 'node_2',
|
|
437
|
+
* type: 'circle',
|
|
438
|
+
* x: 300,
|
|
439
|
+
* y: 200
|
|
440
|
+
* }
|
|
441
|
+
* ],
|
|
442
|
+
* edges: [
|
|
443
|
+
* {
|
|
444
|
+
* sourceNodeId: 'node_1',
|
|
445
|
+
* targetNodeId: 'node_2',
|
|
446
|
+
* type: 'polyline'
|
|
447
|
+
* }
|
|
448
|
+
* ]
|
|
449
|
+
* })
|
|
450
|
+
* @param graphData 图数据
|
|
451
|
+
*/
|
|
452
|
+
render(graphData: GraphConfigData): void;
|
|
453
|
+
/*********************************************************
|
|
454
|
+
* History/Resize 相关方法
|
|
455
|
+
********************************************************/
|
|
456
|
+
/**
|
|
457
|
+
* 历史记录操作
|
|
458
|
+
* 返回上一步
|
|
459
|
+
*/
|
|
460
|
+
undo(): void;
|
|
461
|
+
/**
|
|
462
|
+
* 历史记录操作
|
|
463
|
+
* 恢复下一步
|
|
464
|
+
*/
|
|
465
|
+
redo(): void;
|
|
466
|
+
/**
|
|
467
|
+
* 放大缩小图形
|
|
468
|
+
* @param zoomSize 放大缩小的值,支持传入0-n之间的数字。小于1表示缩小,大于1表示放大。也支持传入true和false按照内置的刻度放大缩小
|
|
469
|
+
* @param point 缩放的原点
|
|
470
|
+
* @returns {string} -放大缩小的比例
|
|
471
|
+
*/
|
|
472
|
+
zoom(zoomSize?: ZoomParamType, point?: PointTuple): string;
|
|
473
|
+
/**
|
|
474
|
+
* 重置图形的放大缩写比例为默认
|
|
475
|
+
*/
|
|
476
|
+
resetZoom(): void;
|
|
477
|
+
/**
|
|
478
|
+
* 设置图形缩小时,能缩放到的最小倍数。参数为0-1自己。默认0.2
|
|
479
|
+
* @param size 图形缩小的最小值
|
|
480
|
+
*/
|
|
481
|
+
setZoomMiniSize(size: number): void;
|
|
482
|
+
/**
|
|
483
|
+
* 设置图形放大时,能放大到的最大倍数,默认16
|
|
484
|
+
* @param size 图形放大的最大值
|
|
485
|
+
*/
|
|
486
|
+
setZoomMaxSize(size: number): void;
|
|
487
|
+
/**
|
|
488
|
+
* 获取缩放的值和平移的值。
|
|
489
|
+
*/
|
|
490
|
+
getTransform(): {
|
|
491
|
+
SCALE_X: number;
|
|
492
|
+
SCALE_Y: number;
|
|
493
|
+
TRANSLATE_X: number;
|
|
494
|
+
TRANSLATE_Y: number;
|
|
495
|
+
};
|
|
496
|
+
/**
|
|
497
|
+
* 平移图
|
|
498
|
+
* @param x 向x轴移动距离
|
|
499
|
+
* @param y 向y轴移动距离
|
|
500
|
+
*/
|
|
501
|
+
translate(x: number, y: number): void;
|
|
502
|
+
/**
|
|
503
|
+
* 还原图形为初始位置
|
|
504
|
+
*/
|
|
505
|
+
resetTranslate(): void;
|
|
506
|
+
/**
|
|
507
|
+
* 图形画布居中显示
|
|
508
|
+
*/
|
|
509
|
+
translateCenter(): void;
|
|
510
|
+
/**
|
|
511
|
+
* 图形适应屏幕大小
|
|
512
|
+
* @param verticalOffset number 距离盒子上下的距离, 默认为20
|
|
513
|
+
* @param horizontalOffset number 距离盒子左右的距离, 默认为20
|
|
514
|
+
*/
|
|
515
|
+
fitView(verticalOffset?: number, horizontalOffset?: number): void;
|
|
516
|
+
/**
|
|
517
|
+
* 开启边的动画
|
|
518
|
+
* @param edgeId string
|
|
519
|
+
*/
|
|
520
|
+
openEdgeAnimation(edgeId: string): void;
|
|
521
|
+
/**
|
|
522
|
+
* 关闭边的动画
|
|
523
|
+
* @param edgeId string
|
|
524
|
+
*/
|
|
525
|
+
closeEdgeAnimation(edgeId: string): void;
|
|
526
|
+
/*********************************************************
|
|
527
|
+
* 事件系统方法
|
|
528
|
+
********************************************************/
|
|
529
|
+
/**
|
|
530
|
+
* 监听事件
|
|
531
|
+
* 事件详情见 @see todo
|
|
532
|
+
* 支持同时监听多个事件
|
|
533
|
+
* @example
|
|
534
|
+
* lf.on('node:click,node:contextmenu', (data) => {
|
|
535
|
+
* });
|
|
536
|
+
*/
|
|
537
|
+
on<T extends keyof EventArgs>(evt: T, callback: EventCallback<T>): void;
|
|
538
|
+
on<T extends string>(evt: T, callback: EventCallback<T>): void;
|
|
539
|
+
/**
|
|
540
|
+
* 撤销监听事件
|
|
541
|
+
*/
|
|
542
|
+
off<T extends keyof EventArgs>(evt: T, callback: EventCallback<T>): void;
|
|
543
|
+
off<T extends string>(evt: T, callback: EventCallback<T>): void;
|
|
544
|
+
/**
|
|
545
|
+
* 监听事件,只监听一次
|
|
546
|
+
*/
|
|
547
|
+
once<T extends keyof EventArgs>(evt: T, callback: EventCallback<T>): void;
|
|
548
|
+
once<T extends string>(evt: T, callback: EventCallback<T>): void;
|
|
549
|
+
/**
|
|
550
|
+
* 触发监听事件
|
|
551
|
+
*/
|
|
552
|
+
emit<T extends keyof EventArgs>(evts: T, eventArgs: CallbackArgs<T>): void;
|
|
553
|
+
emit<T extends string>(evts: T, eventArgs: CallbackArgs<T>): void;
|
|
554
|
+
/*********************************************************
|
|
555
|
+
* 插件系统方法
|
|
556
|
+
********************************************************/
|
|
557
|
+
/**
|
|
558
|
+
* 添加扩展, 待讨论,这里是不是静态方法好一些?
|
|
559
|
+
* 重复添加插件的时候,把上一次添加的插件的销毁。
|
|
560
|
+
* @param extension
|
|
561
|
+
* @param props
|
|
562
|
+
*/
|
|
563
|
+
static use(extension: ExtensionConstructor, props?: Record<string, unknown>): void;
|
|
564
|
+
private installPlugins;
|
|
565
|
+
/**
|
|
566
|
+
* 加载插件-内部方法
|
|
567
|
+
*/
|
|
568
|
+
private installPlugin;
|
|
569
|
+
}
|
|
570
|
+
export declare namespace LogicFlow {
|
|
571
|
+
interface Options extends LFOptions.Common {
|
|
572
|
+
}
|
|
573
|
+
type DomAttributes = {
|
|
574
|
+
className?: string;
|
|
575
|
+
[key: string]: string | undefined;
|
|
576
|
+
};
|
|
577
|
+
type PropertiesType = {
|
|
578
|
+
width?: number;
|
|
579
|
+
height?: number;
|
|
580
|
+
rx?: number;
|
|
581
|
+
ry?: number;
|
|
582
|
+
} & Record<string, any>;
|
|
583
|
+
type AttributesType = Record<string, any>;
|
|
584
|
+
type VectorData = {
|
|
585
|
+
deltaX: number;
|
|
586
|
+
deltaY: number;
|
|
587
|
+
};
|
|
588
|
+
type OffsetData = {
|
|
589
|
+
dx: number;
|
|
590
|
+
dy: number;
|
|
591
|
+
};
|
|
592
|
+
type Position = {
|
|
593
|
+
x: number;
|
|
594
|
+
y: number;
|
|
595
|
+
};
|
|
596
|
+
type Point = {
|
|
597
|
+
id?: string;
|
|
598
|
+
[key: string]: any;
|
|
599
|
+
} & Position;
|
|
600
|
+
type PointTuple = [number, number];
|
|
601
|
+
type ClientPosition = {
|
|
602
|
+
domOverlayPosition: Position;
|
|
603
|
+
canvasOverlayPosition: Position;
|
|
604
|
+
};
|
|
605
|
+
interface LineSegment {
|
|
606
|
+
start: Point;
|
|
607
|
+
end: Point;
|
|
608
|
+
}
|
|
609
|
+
type Direction = SegmentDirection;
|
|
610
|
+
type RadiusCircleInfo = {
|
|
611
|
+
r: number;
|
|
612
|
+
} & Position;
|
|
613
|
+
type Vector = {
|
|
614
|
+
id?: string;
|
|
615
|
+
x: number;
|
|
616
|
+
y: number;
|
|
617
|
+
z: 0;
|
|
618
|
+
[key: string]: any;
|
|
619
|
+
};
|
|
620
|
+
type RectSize = {
|
|
621
|
+
width: number;
|
|
622
|
+
height: number;
|
|
623
|
+
};
|
|
624
|
+
type TextConfig = {
|
|
625
|
+
value: string;
|
|
626
|
+
editable?: boolean;
|
|
627
|
+
draggable?: boolean;
|
|
628
|
+
} & Point;
|
|
629
|
+
type AppendConfig = {
|
|
630
|
+
startIndex: number;
|
|
631
|
+
endIndex: number;
|
|
632
|
+
direction: Direction;
|
|
633
|
+
draggable?: boolean;
|
|
634
|
+
} & LineSegment;
|
|
635
|
+
type ArrowConfig = {
|
|
636
|
+
markerStart: string;
|
|
637
|
+
markerEnd: string;
|
|
638
|
+
};
|
|
639
|
+
type ArrowInfo = {
|
|
640
|
+
start: Point;
|
|
641
|
+
end: Point;
|
|
642
|
+
hover: boolean;
|
|
643
|
+
isSelected: boolean;
|
|
644
|
+
};
|
|
645
|
+
interface GraphConfigData {
|
|
646
|
+
nodes?: NodeConfig[];
|
|
647
|
+
edges?: EdgeConfig[];
|
|
648
|
+
}
|
|
649
|
+
interface GraphData {
|
|
650
|
+
nodes: NodeData[];
|
|
651
|
+
edges: EdgeData[];
|
|
652
|
+
}
|
|
653
|
+
interface FakeNodeConfig {
|
|
654
|
+
type: string;
|
|
655
|
+
text?: TextConfig | string;
|
|
656
|
+
properties?: PropertiesType;
|
|
657
|
+
[key: string]: unknown;
|
|
658
|
+
}
|
|
659
|
+
type OnDragNodeConfig = {
|
|
660
|
+
type: string;
|
|
661
|
+
text?: TextConfig | string;
|
|
662
|
+
properties?: Record<string, unknown>;
|
|
663
|
+
[key: string]: any;
|
|
664
|
+
};
|
|
665
|
+
interface NodeConfig {
|
|
666
|
+
id?: string;
|
|
667
|
+
type: string;
|
|
668
|
+
x: number;
|
|
669
|
+
y: number;
|
|
670
|
+
text?: TextConfig | string;
|
|
671
|
+
zIndex?: number;
|
|
672
|
+
properties?: PropertiesType;
|
|
673
|
+
virtual?: boolean;
|
|
674
|
+
rotate?: number;
|
|
675
|
+
[key: string]: any;
|
|
676
|
+
}
|
|
677
|
+
interface NodeData extends NodeConfig {
|
|
678
|
+
id: string;
|
|
679
|
+
text?: TextConfig;
|
|
680
|
+
[key: string]: unknown;
|
|
681
|
+
}
|
|
682
|
+
interface EdgeConfig {
|
|
683
|
+
id?: string;
|
|
684
|
+
type?: string;
|
|
685
|
+
sourceNodeId: string;
|
|
686
|
+
sourceAnchorId?: string;
|
|
687
|
+
targetNodeId: string;
|
|
688
|
+
targetAnchorId?: string;
|
|
689
|
+
startPoint?: Point;
|
|
690
|
+
endPoint?: Point;
|
|
691
|
+
text?: TextConfig | string;
|
|
692
|
+
pointsList?: Point[];
|
|
693
|
+
zIndex?: number;
|
|
694
|
+
properties?: PropertiesType;
|
|
695
|
+
}
|
|
696
|
+
interface EdgeData extends EdgeConfig {
|
|
697
|
+
id: string;
|
|
698
|
+
type: string;
|
|
699
|
+
text?: TextConfig;
|
|
700
|
+
startPoint: Point;
|
|
701
|
+
endPoint: Point;
|
|
702
|
+
[key: string]: unknown;
|
|
703
|
+
}
|
|
704
|
+
interface MenuConfig {
|
|
705
|
+
text?: string;
|
|
706
|
+
className?: string;
|
|
707
|
+
icon?: boolean;
|
|
708
|
+
callback: (id: string | number) => void;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
export declare namespace LogicFlow {
|
|
712
|
+
type NumberOrPercent = `${number}%` | number;
|
|
713
|
+
/**
|
|
714
|
+
* 颜色 - CSS 属性用颜色
|
|
715
|
+
* 如:#000000, rgba(0, 0, 0, 0), 如果是透明的,可以传 'none'
|
|
716
|
+
*/
|
|
717
|
+
type Color = string | 'none';
|
|
718
|
+
/**
|
|
719
|
+
* svg虚线
|
|
720
|
+
* 格式为逗号分割字符串,如
|
|
721
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute/stroke-dasharray
|
|
722
|
+
*/
|
|
723
|
+
type DashArray = string;
|
|
724
|
+
type CommonTheme = {
|
|
725
|
+
fill?: Color;
|
|
726
|
+
stroke?: Color;
|
|
727
|
+
strokeWidth?: number;
|
|
728
|
+
/**
|
|
729
|
+
* 其他属性 - 我们会把你自定义的所有属性最终传递到 DOM 上
|
|
730
|
+
* 详情请参考 svg 属性规范:
|
|
731
|
+
* https://developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute
|
|
732
|
+
* 注意: 请不要在主题中设置“形状属性”,例如:x、y、width、height、radius、r、rx、ry
|
|
733
|
+
* @see https://docs.logic-flow.cn/docs/#/zh/api/themeApi?id=%e5%bd%a2%e7%8a%b6%e5%b1%9e%e6%80%a7)
|
|
734
|
+
*/
|
|
735
|
+
radius?: number;
|
|
736
|
+
rx?: number;
|
|
737
|
+
ry?: number;
|
|
738
|
+
path?: string;
|
|
739
|
+
[key: string]: unknown;
|
|
740
|
+
};
|
|
741
|
+
type CommonThemePropTypes = CommonTheme[keyof CommonTheme];
|
|
742
|
+
type AppendAttributes = {
|
|
743
|
+
d: string;
|
|
744
|
+
fill: string;
|
|
745
|
+
stroke: Color;
|
|
746
|
+
strokeWidth: number;
|
|
747
|
+
strokeDasharray: DashArray;
|
|
748
|
+
};
|
|
749
|
+
type ContainerTheme = {
|
|
750
|
+
width?: string;
|
|
751
|
+
height?: string;
|
|
752
|
+
};
|
|
753
|
+
/**
|
|
754
|
+
* rect 节点主题
|
|
755
|
+
* svg基础图形-矩形
|
|
756
|
+
* https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/rect
|
|
757
|
+
*/
|
|
758
|
+
type RectTheme = CommonTheme;
|
|
759
|
+
/**
|
|
760
|
+
* circle 节点主题
|
|
761
|
+
* svg基础图形-圆形
|
|
762
|
+
* https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/circle
|
|
763
|
+
*/
|
|
764
|
+
type CircleTheme = CommonTheme;
|
|
765
|
+
/**
|
|
766
|
+
* polygon 节点主题
|
|
767
|
+
* svg基础图形-多边形
|
|
768
|
+
* https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/polygon
|
|
769
|
+
*/
|
|
770
|
+
type PolygonTheme = CommonTheme;
|
|
771
|
+
/**
|
|
772
|
+
* ellipse 节点主题
|
|
773
|
+
* svg基础图形-椭圆
|
|
774
|
+
* https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/ellipse
|
|
775
|
+
*/
|
|
776
|
+
type EllipseTheme = CommonTheme;
|
|
777
|
+
type AnchorTheme = {
|
|
778
|
+
r?: number;
|
|
779
|
+
hover?: {
|
|
780
|
+
r?: number;
|
|
781
|
+
} & CommonTheme;
|
|
782
|
+
} & CommonTheme;
|
|
783
|
+
type TextTheme = {
|
|
784
|
+
color?: Color;
|
|
785
|
+
fontSize: number;
|
|
786
|
+
textWidth?: number;
|
|
787
|
+
lineHeight?: number;
|
|
788
|
+
textAnchor?: 'start' | 'middle' | 'end';
|
|
789
|
+
dominantBaseline?: 'auto' | 'text-bottom' | 'alphabetic' | 'ideographic' | 'middle' | 'central' | 'mathematical' | 'hanging' | 'text-top';
|
|
790
|
+
} & CommonTheme;
|
|
791
|
+
type TextNodeTheme = {
|
|
792
|
+
background?: RectTheme;
|
|
793
|
+
} & TextTheme;
|
|
794
|
+
type NodeTextTheme = {
|
|
795
|
+
/**
|
|
796
|
+
* 文本超出指定宽度处理方式
|
|
797
|
+
* default: 不特殊处理,允许超出
|
|
798
|
+
* autoWrap: 超出自动换行
|
|
799
|
+
* ellipsis: 超出省略
|
|
800
|
+
*/
|
|
801
|
+
overflowMode?: 'default' | 'autoWrap' | 'ellipsis';
|
|
802
|
+
background?: RectTheme;
|
|
803
|
+
/**
|
|
804
|
+
* 背景区域 padding
|
|
805
|
+
* wrapPadding: '5px,10px'
|
|
806
|
+
*/
|
|
807
|
+
wrapPadding?: string;
|
|
808
|
+
} & TextTheme;
|
|
809
|
+
type EdgeTextTheme = {
|
|
810
|
+
textWidth: number;
|
|
811
|
+
background?: {
|
|
812
|
+
/**
|
|
813
|
+
* 背景区域 padding
|
|
814
|
+
* wrapPadding: '5px,10px'
|
|
815
|
+
*/
|
|
816
|
+
wrapPadding?: string;
|
|
817
|
+
} & RectTheme;
|
|
818
|
+
hover?: EdgeTextTheme;
|
|
819
|
+
} & NodeTextTheme & TextTheme;
|
|
820
|
+
type EdgeTheme = CommonTheme;
|
|
821
|
+
type EdgeBezierTheme = {
|
|
822
|
+
adjustLine?: EdgeTheme;
|
|
823
|
+
adjustAnchor?: CircleTheme;
|
|
824
|
+
} & EdgeTheme;
|
|
825
|
+
type EdgePolylineTheme = EdgeTheme;
|
|
826
|
+
type EdgeAnimation = {
|
|
827
|
+
stroke?: Color;
|
|
828
|
+
strokeDasharray?: string;
|
|
829
|
+
strokeDashoffset?: NumberOrPercent;
|
|
830
|
+
animationName?: string;
|
|
831
|
+
animationDuration?: `${number}s` | `${number}ms`;
|
|
832
|
+
animationIterationCount?: 'infinite' | number;
|
|
833
|
+
animationTimingFunction?: string;
|
|
834
|
+
animationDirection?: string;
|
|
835
|
+
};
|
|
836
|
+
type OutlineTheme = {
|
|
837
|
+
hover?: CommonTheme;
|
|
838
|
+
} & CommonTheme & EdgeAnimation;
|
|
839
|
+
type ArrowTheme = {
|
|
840
|
+
/**
|
|
841
|
+
* 箭头长度.
|
|
842
|
+
* 以符号"->"为例, offset表示箭头大于号的宽度。
|
|
843
|
+
*/
|
|
844
|
+
offset: number;
|
|
845
|
+
/**
|
|
846
|
+
* 箭头垂直于边的距离
|
|
847
|
+
* 以符号"->"为例, verticalLength表示箭头大于号的高度
|
|
848
|
+
*/
|
|
849
|
+
refX?: number;
|
|
850
|
+
refY?: number;
|
|
851
|
+
verticalLength: number;
|
|
852
|
+
} & CommonTheme;
|
|
853
|
+
type ArrowAttributesType = {
|
|
854
|
+
d: string;
|
|
855
|
+
} & ArrowTheme;
|
|
856
|
+
type AnchorLineTheme = EdgeTheme & EdgeAnimation;
|
|
857
|
+
interface Theme {
|
|
858
|
+
baseNode: CommonTheme;
|
|
859
|
+
baseEdge: EdgeTheme;
|
|
860
|
+
/**
|
|
861
|
+
* 基础图形节点相关主题
|
|
862
|
+
*/
|
|
863
|
+
rect: RectTheme;
|
|
864
|
+
circle: CircleTheme;
|
|
865
|
+
diamond: PolygonTheme;
|
|
866
|
+
ellipse: EllipseTheme;
|
|
867
|
+
polygon: PolygonTheme;
|
|
868
|
+
/**
|
|
869
|
+
* 基础图形线相关主题
|
|
870
|
+
*/
|
|
871
|
+
line: EdgeTheme;
|
|
872
|
+
polyline: EdgePolylineTheme;
|
|
873
|
+
bezier: EdgeBezierTheme;
|
|
874
|
+
anchorLine: AnchorLineTheme;
|
|
875
|
+
/**
|
|
876
|
+
* 文本内容相关主题
|
|
877
|
+
*/
|
|
878
|
+
text: TextNodeTheme;
|
|
879
|
+
nodeText: NodeTextTheme;
|
|
880
|
+
edgeText: EdgeTextTheme;
|
|
881
|
+
inputText?: CommonTheme;
|
|
882
|
+
/**
|
|
883
|
+
* 其他元素相关主题
|
|
884
|
+
*/
|
|
885
|
+
anchor: AnchorTheme;
|
|
886
|
+
arrow: ArrowTheme;
|
|
887
|
+
snapline: EdgeTheme;
|
|
888
|
+
rotateControl: CommonTheme;
|
|
889
|
+
resizeControl: CommonTheme;
|
|
890
|
+
resizeOutline: CommonTheme;
|
|
891
|
+
/**
|
|
892
|
+
* REMIND: 当开启了跳转边的起点和终点(adjustEdgeStartAndEnd:true)后
|
|
893
|
+
* 边的两端会出现调整按钮
|
|
894
|
+
* 边连段的调整点样式
|
|
895
|
+
*/
|
|
896
|
+
edgeAdjust: CircleTheme;
|
|
897
|
+
outline: OutlineTheme;
|
|
898
|
+
edgeAnimation: EdgeAnimation;
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
export declare namespace LogicFlow {
|
|
902
|
+
type FocusOnById = {
|
|
903
|
+
id: string;
|
|
904
|
+
coordinate?: never;
|
|
905
|
+
};
|
|
906
|
+
type FocusOnByCoordinate = {
|
|
907
|
+
id?: string;
|
|
908
|
+
coordinate: Position;
|
|
909
|
+
};
|
|
910
|
+
export type FocusOnArgsType = FocusOnById | FocusOnByCoordinate;
|
|
911
|
+
export type BaseNodeModelCtor = typeof BaseNodeModel;
|
|
912
|
+
export type BaseEdgeModelCtor = typeof BaseEdgeModel;
|
|
913
|
+
export type GraphElementCtor = BaseNodeModelCtor | BaseEdgeModelCtor;
|
|
914
|
+
export type GraphElement = BaseNodeModel | BaseEdgeModel;
|
|
915
|
+
export type GraphElements = {
|
|
916
|
+
nodes: BaseNodeModel[];
|
|
917
|
+
edges: BaseEdgeModel[];
|
|
918
|
+
};
|
|
919
|
+
export type RegisterConfig = {
|
|
920
|
+
type: string;
|
|
921
|
+
view: ComponentType<any> & {
|
|
922
|
+
isObserved?: boolean;
|
|
923
|
+
};
|
|
924
|
+
model: GraphElementCtor;
|
|
925
|
+
isObserverView?: boolean;
|
|
926
|
+
};
|
|
927
|
+
export type RegisterElement = {
|
|
928
|
+
view: any;
|
|
929
|
+
model: any;
|
|
930
|
+
};
|
|
931
|
+
export type RegisterParam = {
|
|
932
|
+
h: typeof h;
|
|
933
|
+
[key: string]: unknown;
|
|
934
|
+
};
|
|
935
|
+
export type RegisterElementFunc = (params: RegisterParam) => RegisterElement;
|
|
936
|
+
export interface LogicFlowConstructor {
|
|
937
|
+
new (options: LFOptions.Definition): LogicFlow;
|
|
938
|
+
}
|
|
939
|
+
export type RegisteredExtension = {
|
|
940
|
+
[pluginFlag]: symbol;
|
|
941
|
+
extension: ExtensionConstructor;
|
|
942
|
+
props?: Record<string, unknown>;
|
|
943
|
+
};
|
|
944
|
+
export type ExtensionProps = {
|
|
945
|
+
lf: LogicFlow;
|
|
946
|
+
LogicFlow: LogicFlowConstructor;
|
|
947
|
+
options: Record<string, unknown>;
|
|
948
|
+
props?: Record<string, unknown>;
|
|
949
|
+
};
|
|
950
|
+
export interface ExtensionConstructor {
|
|
951
|
+
pluginName: string;
|
|
952
|
+
new (props: ExtensionProps): Extension;
|
|
953
|
+
}
|
|
954
|
+
export type ExtensionRender = (lf: LogicFlow, container: HTMLElement) => void;
|
|
955
|
+
export interface Extension {
|
|
956
|
+
readonly pluginName?: string;
|
|
957
|
+
install?: (lf: LogicFlow, logicFlow: LogicFlowConstructor) => void;
|
|
958
|
+
render?: ExtensionRender;
|
|
959
|
+
destroy?: () => void;
|
|
960
|
+
}
|
|
961
|
+
export {};
|
|
962
|
+
}
|
|
963
|
+
export declare namespace LogicFlow {
|
|
964
|
+
const toStringTag: string;
|
|
965
|
+
}
|
|
966
|
+
export default LogicFlow;
|