@relation-graph/react 3.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/LICENSE +21 -0
- package/package.json +65 -0
- package/relation-graph.js +56 -0
- package/relation-graph.mjs +7433 -0
- package/relation-graph.umd.js +56 -0
- package/types/components.d.ts +5 -0
- package/types/packages/platforms/react/src/constants.d.ts +1 -0
- package/types/packages/platforms/react/src/index.d.ts +182 -0
- package/types/packages/platforms/react/src/relation-graph/RGPovider.d.ts +7 -0
- package/types/packages/platforms/react/src/relation-graph/RelationGraph.d.ts +5 -0
- package/types/packages/platforms/react/src/relation-graph/RelationLinker.d.ts +5 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvas.d.ts +13 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent.d.ts +11 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGEasyView.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGFakeNode.d.ts +6 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGGraphRefs.d.ts +6 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGLineContent.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGLinePath.d.ts +6 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGLinePeel.d.ts +7 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGLineText.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGNodeExpandHolder.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGNodePeel.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationLinkerCanvas.d.ts +8 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationLinkerContent.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationView.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGConnectSource.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGConnectTarget.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingConnectController.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingConnectPoints.d.ts +7 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingLineController.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingNearNodeWidget.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingNodeController.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingReferenceLine.d.ts +6 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingResize.d.ts +7 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGMiniView.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/NewCanvas.d.ts +20 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/NewCanvasV2.d.ts +1 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/NewCanvasV3.d.ts +1 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnCanvas.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnCanvasAbove.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnLine.d.ts +6 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnLineText.d.ts +6 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnNode.d.ts +6 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnNodeExpandHandle.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnSVGDefs.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnToolbar.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnView.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/store/index.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/store/reducers/StockStore.d.ts +8 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphBackground.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphDebugPanel.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphLoading.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphMoveOperator.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphOperateStuff.d.ts +7 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphToolBar.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphWatermark.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphXsToolBar.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/RGIcons.d.ts +6 -0
- package/types/packages/platforms/react/src/relation-graph/src/hooks/RGHooks.d.ts +7 -0
- package/types/packages/platforms/react/src/relation-graph/src/hooks/useFakeNodesState.d.ts +8 -0
- package/types/packages/platforms/react/src/relation-graph/src/hooks/useGraphInstance.d.ts +13 -0
- package/types/packages/platforms/react/src/types-react.d.ts +35 -0
- package/types/packages/platforms/react/src/types.d.ts +1 -0
- package/types/packages/platforms/react/vite.config.d.ts +2 -0
- package/types/packages/platforms/vue2/src/core4vue/RGCanvas.vue.d.ts +13 -0
- package/types/packages/platforms/vue2/src/core4vue/RGCanvasContent.vue.d.ts +10 -0
- package/types/packages/platforms/vue2/src/core4vue/RGEasyView.vue.d.ts +6 -0
- package/types/packages/platforms/vue2/src/core4vue/RGFakeNode.vue.d.ts +18 -0
- package/types/packages/platforms/vue2/src/core4vue/RGGraphDefs.vue.d.ts +18 -0
- package/types/packages/platforms/vue2/src/core4vue/RGLineContent.vue.d.ts +22 -0
- package/types/packages/platforms/vue2/src/core4vue/RGLinePath.vue.d.ts +39 -0
- package/types/packages/platforms/vue2/src/core4vue/RGLinePeel.vue.d.ts +20 -0
- package/types/packages/platforms/vue2/src/core4vue/RGLineText.vue.d.ts +33 -0
- package/types/packages/platforms/vue2/src/core4vue/RGNodeExpandHolder.vue.d.ts +36 -0
- package/types/packages/platforms/vue2/src/core4vue/RGNodePeel.vue.d.ts +32 -0
- package/types/packages/platforms/vue2/src/core4vue/RelationGraph.vue.d.ts +820 -0
- package/types/packages/platforms/vue2/src/core4vue/RelationLinker.vue.d.ts +62 -0
- package/types/packages/platforms/vue2/src/core4vue/RelationLinkerCanvas.vue.d.ts +11 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGConnectSource.vue.d.ts +29 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGConnectTarget.vue.d.ts +45 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingConnectController.vue.d.ts +8 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingConnectPoints.vue.d.ts +24 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingLineController.vue.d.ts +26 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingNearNodeWidget.vue.d.ts +20 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingNodeController.vue.d.ts +4 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingReferenceLine.vue.d.ts +29 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingResize.vue.d.ts +31 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGMiniView.vue.d.ts +38 -0
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphBackground.vue.d.ts +32 -0
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphDebugPanel.vue.d.ts +12 -0
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphLoading.vue.d.ts +4 -0
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphMoveOperator.vue.d.ts +8 -0
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphOperateStuff.vue.d.ts +4 -0
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphToolBar.vue.d.ts +46 -0
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphWatermark.vue.d.ts +57 -0
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphXsToolBar.vue.d.ts +46 -0
- package/types/packages/platforms/vue2/src/index.d.ts +2454 -0
- package/types/packages/platforms/vue2/src/types-vue2.d.ts +0 -0
- package/types/packages/platforms/vue2/vite.config.d.ts +2 -0
- package/types/packages/platforms/vue3/src/constants.d.ts +4 -0
- package/types/packages/platforms/vue3/src/index.d.ts +1495 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RGCanvas.vue.d.ts +34 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RGCanvasContent.vue.d.ts +37 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RGEasyView.vue.d.ts +2 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RGFakeNode.vue.d.ts +32 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RGGraphDefs.vue.d.ts +29 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RGLineContent.vue.d.ts +12 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RGLinePath.vue.d.ts +16 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RGLinePeel.vue.d.ts +29 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RGLineText.vue.d.ts +27 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RGNodeExpandHolder.vue.d.ts +18 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RGNodePeel.vue.d.ts +40 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RGProvider.vue.d.ts +34 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RelationGraph.vue.d.ts +39 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RelationLinker.vue.d.ts +130 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RelationLinkerCanvas.vue.d.ts +23 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RelationLinkerView.vue.d.ts +24 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGConnectSource.vue.d.ts +45 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGConnectTarget.vue.d.ts +46 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGEditingConnectController.vue.d.ts +23 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGEditingConnectPoints.vue.d.ts +16 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGEditingLineController.vue.d.ts +56 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGEditingNearNodeWidget.vue.d.ts +30 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGEditingNodeController.vue.d.ts +17 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGEditingReferenceLine.vue.d.ts +15 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGEditingResize.vue.d.ts +19 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGMiniView.vue.d.ts +17 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/index.vue.d.ts +143 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/widgets/GraphBackground.vue.d.ts +49 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/widgets/GraphDebugPanel.vue.d.ts +2 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/widgets/GraphLoading.vue.d.ts +2 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/widgets/GraphMoveOperator.vue.d.ts +2 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/widgets/GraphOperateStuff.vue.d.ts +19 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/widgets/GraphToolBar.vue.d.ts +31 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/widgets/GraphWatermark.vue.d.ts +56 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/widgets/GraphXsToolBar.vue.d.ts +31 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/widgets/RGIcons.vue.d.ts +15 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/hooks/RGHooks.d.ts +7 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useGraphInstance.d.ts +13 -0
- package/types/packages/platforms/vue3/src/types-vue3.d.ts +22 -0
- package/types/packages/platforms/vue3/src/types.d.ts +1 -0
- package/types/packages/platforms/vue3/vite.config.d.ts +2 -0
- package/types/packages/relation-graph-models/RGObjectsForExport.d.ts +132 -0
- package/types/packages/relation-graph-models/constants.d.ts +1 -0
- package/types/packages/relation-graph-models/layouters/RGBaseLayouter.d.ts +36 -0
- package/types/packages/relation-graph-models/layouters/RGCenterLayouter.d.ts +12 -0
- package/types/packages/relation-graph-models/layouters/RGCircleLayouter.d.ts +8 -0
- package/types/packages/relation-graph-models/layouters/RGFixedLayouter.d.ts +11 -0
- package/types/packages/relation-graph-models/layouters/RGFolderLayouter.d.ts +17 -0
- package/types/packages/relation-graph-models/layouters/RGForceLayouter.d.ts +71 -0
- package/types/packages/relation-graph-models/layouters/RGForceLayouterV2.d.ts +59 -0
- package/types/packages/relation-graph-models/layouters/RGSmartTreeLayouter.d.ts +16 -0
- package/types/packages/relation-graph-models/layouters/RGTreeLayouter.d.ts +18 -0
- package/types/packages/relation-graph-models/models/RGLineDataUtils.d.ts +9 -0
- package/types/packages/relation-graph-models/models/RGNodeDataUtils.d.ts +14 -0
- package/types/packages/relation-graph-models/models/RGOptionsDataUtils.d.ts +11 -0
- package/types/packages/relation-graph-models/models/RelationGraphBase.d.ts +67 -0
- package/types/packages/relation-graph-models/models/RelationGraphFinal.d.ts +11 -0
- package/types/packages/relation-graph-models/models/RelationGraphReact.d.ts +5 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith1Dom.d.ts +76 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith2Data.d.ts +398 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith3Image.d.ts +20 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith4Line.d.ts +48 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith5Zoom.d.ts +31 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith6Effect.d.ts +18 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith6Layout.d.ts +33 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith7Event.d.ts +74 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith8Update.d.ts +23 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith91Editing.d.ts +59 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith92MiniView.d.ts +50 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith9EasyView.d.ts +28 -0
- package/types/packages/relation-graph-models/types.d.ts +903 -0
- package/types/packages/relation-graph-models/utils/RGCanvasImpl2D.d.ts +59 -0
- package/types/packages/relation-graph-models/utils/RGCanvasImplWebGL.d.ts +47 -0
- package/types/packages/relation-graph-models/utils/RGCommon.d.ts +26 -0
- package/types/packages/relation-graph-models/utils/RGDragUtils.d.ts +17 -0
- package/types/packages/relation-graph-models/utils/RGFullscreenUtils.d.ts +3 -0
- package/types/packages/relation-graph-models/utils/RGGraphMath.d.ts +104 -0
- package/types/packages/relation-graph-models/utils/RGIconsData.d.ts +41 -0
- package/types/packages/relation-graph-models/utils/RGIntergration.d.ts +47 -0
- package/types/packages/relation-graph-models/utils/RGNodesAnalytic.d.ts +38 -0
- package/types/packages/relation-graph-models/utils/line/RGLinePath.d.ts +90 -0
- package/types/packages/relation-graph-models/utils/line/RGLinePathUtils.d.ts +54 -0
- package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor1.d.ts +2 -0
- package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor4.d.ts +2 -0
- package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor44.d.ts +2 -0
- package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor49.d.ts +2 -0
- package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor6.d.ts +6 -0
- package/types/packages/relation-graph-models/utils/line/RGPathGeneratorForCurve.d.ts +2 -0
- package/types/react.d.ts +201 -0
- package/types/svelte.d.ts +170 -0
- package/types/vue2.d.ts +862 -0
- package/types/vue3.d.ts +1246 -0
|
@@ -0,0 +1,903 @@
|
|
|
1
|
+
import { RelationGraphFinal } from './models/RelationGraphFinal';
|
|
2
|
+
import { RGLinePathCommands } from './utils/line/RGLinePath';
|
|
3
|
+
export declare enum RGInnerConnectTargetType {
|
|
4
|
+
Node = "node",
|
|
5
|
+
NodePoint = "NodePoint",
|
|
6
|
+
HTMLElementId = "HTMLElementId",
|
|
7
|
+
CanvasPoint = "CanvasPoint",
|
|
8
|
+
ViewPoint = "ViewPoint"
|
|
9
|
+
}
|
|
10
|
+
export declare enum RGJunctionPoint {
|
|
11
|
+
border = "border",
|
|
12
|
+
ltrb = "ltrb",
|
|
13
|
+
tb = "tb",
|
|
14
|
+
lr = "lr",
|
|
15
|
+
left = "left",
|
|
16
|
+
right = "right",
|
|
17
|
+
top = "top",
|
|
18
|
+
bottom = "bottom"
|
|
19
|
+
}
|
|
20
|
+
export type RGConnectTarget4NodePoint = {
|
|
21
|
+
targetId: string;
|
|
22
|
+
targetType: string;
|
|
23
|
+
nodeId?: string;
|
|
24
|
+
junctionPoint: RGJunctionPoint;
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
offsetX: number;
|
|
28
|
+
offsetY: number;
|
|
29
|
+
offsetPercentX: number;
|
|
30
|
+
offsetPercentY: number;
|
|
31
|
+
targetData: Record<string, any>;
|
|
32
|
+
};
|
|
33
|
+
export type RGResizeHandlePosition = 't' | 'r' | 'b' | 'l' | 'tl' | 'tr' | 'bl' | 'br';
|
|
34
|
+
export type RGWidgetPosition = 'top' | 'right' | 'bottom' | 'left' | 'tl' | 'tr' | 'bl' | 'br';
|
|
35
|
+
export type RGPositionPoint = 'left' | 'top' | 'right' | 'bottom';
|
|
36
|
+
export type RGLineEditPoint = 'start' | 'end';
|
|
37
|
+
export declare enum RGNodeShape {
|
|
38
|
+
circle = 0,
|
|
39
|
+
rect = 1
|
|
40
|
+
}
|
|
41
|
+
export declare enum RGLineShape {
|
|
42
|
+
StandardStraight = 1,
|
|
43
|
+
StandardCurve = 6,
|
|
44
|
+
Curve2 = 2,
|
|
45
|
+
Curve3 = 3,
|
|
46
|
+
Curve5 = 5,
|
|
47
|
+
Curve7 = 7,
|
|
48
|
+
Curve8 = 8,
|
|
49
|
+
SimpleOrthogonal = 4,
|
|
50
|
+
StandardOrthogonal = 44,
|
|
51
|
+
HardOrthogonal = 49
|
|
52
|
+
}
|
|
53
|
+
export type RGEventTargetType = 'canvas' | 'node' | 'line';
|
|
54
|
+
export declare enum RGDirection {
|
|
55
|
+
Left = "left",
|
|
56
|
+
Top = "top",
|
|
57
|
+
Right = "right",
|
|
58
|
+
Bottom = "bottom"
|
|
59
|
+
}
|
|
60
|
+
export type RGUserEvent = MouseEvent | TouchEvent;
|
|
61
|
+
export interface JsonNode {
|
|
62
|
+
id: string;
|
|
63
|
+
text?: string;
|
|
64
|
+
type?: string;
|
|
65
|
+
targetType?: string;
|
|
66
|
+
expanded?: boolean;
|
|
67
|
+
selected?: boolean;
|
|
68
|
+
disablePointEvent?: boolean;
|
|
69
|
+
disableDrag?: boolean;
|
|
70
|
+
className?: string;
|
|
71
|
+
nodeShape?: RGNodeShape;
|
|
72
|
+
borderColor?: string;
|
|
73
|
+
borderWidth?: number;
|
|
74
|
+
borderRadius?: number;
|
|
75
|
+
fontColor?: string;
|
|
76
|
+
fontSize?: number;
|
|
77
|
+
color?: string;
|
|
78
|
+
opacity?: number;
|
|
79
|
+
fixed?: boolean;
|
|
80
|
+
width?: number;
|
|
81
|
+
height?: number;
|
|
82
|
+
x?: number;
|
|
83
|
+
y?: number;
|
|
84
|
+
expandHolderPosition?: string;
|
|
85
|
+
data?: Record<string, any>;
|
|
86
|
+
force_weight?: number;
|
|
87
|
+
zIndex?: number;
|
|
88
|
+
/**
|
|
89
|
+
* Will be ignored when importing data
|
|
90
|
+
*/
|
|
91
|
+
children?: JsonNode[];
|
|
92
|
+
hidden?: boolean;
|
|
93
|
+
alwaysRender?: boolean;
|
|
94
|
+
}
|
|
95
|
+
export interface JsonLine {
|
|
96
|
+
id?: string;
|
|
97
|
+
from: string;
|
|
98
|
+
to: string;
|
|
99
|
+
text?: string;
|
|
100
|
+
selected?: boolean;
|
|
101
|
+
type?: string;
|
|
102
|
+
isFakeLine?: boolean;
|
|
103
|
+
fromType?: string;
|
|
104
|
+
toType?: string;
|
|
105
|
+
color?: string;
|
|
106
|
+
fontColor?: string;
|
|
107
|
+
fontSize?: number;
|
|
108
|
+
lineWidth?: number;
|
|
109
|
+
opacity?: number;
|
|
110
|
+
lineShape?: RGLineShape;
|
|
111
|
+
className?: string;
|
|
112
|
+
showStartArrow?: boolean;
|
|
113
|
+
showEndArrow?: boolean;
|
|
114
|
+
startMarkerId?: string;
|
|
115
|
+
endMarkerId?: string;
|
|
116
|
+
useTextPath?: boolean;
|
|
117
|
+
onPathStartOffset?: string;
|
|
118
|
+
textAnchor?: string;
|
|
119
|
+
reverseText?: boolean;
|
|
120
|
+
lineDirection?: string;
|
|
121
|
+
polyLineStartDistance?: number;
|
|
122
|
+
disablePointEvent?: boolean;
|
|
123
|
+
data?: Record<string, any>;
|
|
124
|
+
cssVars?: Record<string, any>;
|
|
125
|
+
force_elastic?: number;
|
|
126
|
+
textOffset_x?: number;
|
|
127
|
+
textOffset_y?: number;
|
|
128
|
+
animation?: number;
|
|
129
|
+
dashType?: number;
|
|
130
|
+
lineRadius?: number;
|
|
131
|
+
forDisplayOnly?: boolean;
|
|
132
|
+
junctionOffset?: number;
|
|
133
|
+
fromJunctionPoint?: RGJunctionPoint;
|
|
134
|
+
toJunctionPoint?: RGJunctionPoint;
|
|
135
|
+
fromJuctionPointOffsetX?: number;
|
|
136
|
+
fromJuctionPointOffsetY?: number;
|
|
137
|
+
toJuctionPointOffsetX?: number;
|
|
138
|
+
toJuctionPointOffsetY?: number;
|
|
139
|
+
hidden?: boolean;
|
|
140
|
+
}
|
|
141
|
+
export interface RGFakeLine extends JsonLine {
|
|
142
|
+
id: string;
|
|
143
|
+
fromType: string;
|
|
144
|
+
toType: string;
|
|
145
|
+
}
|
|
146
|
+
export interface RGNode extends JsonNode {
|
|
147
|
+
x: number;
|
|
148
|
+
y: number;
|
|
149
|
+
type: string;
|
|
150
|
+
nodeShape: RGNodeShape;
|
|
151
|
+
zIndex?: number;
|
|
152
|
+
lot: {
|
|
153
|
+
childs: RGNode[];
|
|
154
|
+
parent?: RGNode | undefined;
|
|
155
|
+
eached?: boolean;
|
|
156
|
+
strength?: number;
|
|
157
|
+
subling?: {
|
|
158
|
+
level: number;
|
|
159
|
+
all_size: number;
|
|
160
|
+
all_strength: number;
|
|
161
|
+
};
|
|
162
|
+
level?: number;
|
|
163
|
+
index_of_parent?: number;
|
|
164
|
+
strength_plus?: number;
|
|
165
|
+
index_of_level?: number;
|
|
166
|
+
childs_size?: number;
|
|
167
|
+
index_of_p_childs?: number;
|
|
168
|
+
level_index?: number;
|
|
169
|
+
strengthWithChilds?: number;
|
|
170
|
+
strengthWithChilds_from?: number;
|
|
171
|
+
placed?: boolean;
|
|
172
|
+
notLeafNode?: boolean;
|
|
173
|
+
x?: number;
|
|
174
|
+
y?: number;
|
|
175
|
+
to_x?: number;
|
|
176
|
+
to_y?: number;
|
|
177
|
+
from_x?: number;
|
|
178
|
+
from_y?: number;
|
|
179
|
+
};
|
|
180
|
+
dragging?: boolean;
|
|
181
|
+
el: {
|
|
182
|
+
offsetWidth: number;
|
|
183
|
+
offsetHeight: number;
|
|
184
|
+
};
|
|
185
|
+
Fx: number;
|
|
186
|
+
Fy: number;
|
|
187
|
+
rgShouldRender?: boolean;
|
|
188
|
+
rgCalcedVisible?: boolean;
|
|
189
|
+
}
|
|
190
|
+
export interface RGLine extends JsonLine {
|
|
191
|
+
reverseText?: boolean;
|
|
192
|
+
isReverse?: boolean;
|
|
193
|
+
}
|
|
194
|
+
export interface RGRectTarget {
|
|
195
|
+
x: number;
|
|
196
|
+
y: number;
|
|
197
|
+
el: {
|
|
198
|
+
offsetWidth: number;
|
|
199
|
+
offsetHeight: number;
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
export interface RGLineTarget extends RGRectTarget {
|
|
203
|
+
text?: string;
|
|
204
|
+
nodeShape: RGNodeShape;
|
|
205
|
+
targetType: RGInnerConnectTargetType | string;
|
|
206
|
+
id?: string;
|
|
207
|
+
targetData?: Record<string, any>;
|
|
208
|
+
rotate?: number;
|
|
209
|
+
hidden?: boolean;
|
|
210
|
+
}
|
|
211
|
+
export type RGLink = {
|
|
212
|
+
seeks_id: string;
|
|
213
|
+
fromNode: RGNode;
|
|
214
|
+
toNode: RGNode;
|
|
215
|
+
currentLineIndex: number;
|
|
216
|
+
totalLinesBetweenNodes: number;
|
|
217
|
+
forDisplayOnly: boolean;
|
|
218
|
+
rgShouldRender?: boolean;
|
|
219
|
+
rgCalcedVisible?: boolean;
|
|
220
|
+
line: RGLine;
|
|
221
|
+
};
|
|
222
|
+
export type RGElementLine = RGLink;
|
|
223
|
+
export type RGJsonData = {
|
|
224
|
+
rootId?: string;
|
|
225
|
+
nodes: JsonNode[];
|
|
226
|
+
lines: JsonLine[];
|
|
227
|
+
[key: string]: any;
|
|
228
|
+
fakeLines?: RGFakeLine[];
|
|
229
|
+
};
|
|
230
|
+
export type RGGraphData = {
|
|
231
|
+
rootNode?: RGNode;
|
|
232
|
+
nodes: RGNode[];
|
|
233
|
+
normalLines: RGLine[];
|
|
234
|
+
elementLines: RGElementLine[];
|
|
235
|
+
fakeLines: RGFakeLine[];
|
|
236
|
+
};
|
|
237
|
+
export type RGCoordinate = {
|
|
238
|
+
x: number;
|
|
239
|
+
y: number;
|
|
240
|
+
};
|
|
241
|
+
export type RGPosition = RGCoordinate;
|
|
242
|
+
export type RGDraggingCallback = (offsetX: number, offsetY: number, startElPosition: {
|
|
243
|
+
x: number;
|
|
244
|
+
y: number;
|
|
245
|
+
}, startEventPosition: {
|
|
246
|
+
x: number;
|
|
247
|
+
y: number;
|
|
248
|
+
}, event: MouseEvent | TouchEvent) => void;
|
|
249
|
+
export type RGDragedCallback = (buffX: number, buffY: number, event: MouseEvent | TouchEvent) => void;
|
|
250
|
+
export type RGLayoutOptions4Alignable = {
|
|
251
|
+
alignItemsX: 'start' | 'center' | 'end';
|
|
252
|
+
alignItemsY: 'start' | 'center' | 'end';
|
|
253
|
+
};
|
|
254
|
+
export type RGLayoutOptionsCore = RGLayoutOptions4Alignable & {
|
|
255
|
+
layoutName: string;
|
|
256
|
+
label?: string;
|
|
257
|
+
layoutDirection?: string;
|
|
258
|
+
centerOffset_x?: number;
|
|
259
|
+
centerOffset_y?: number;
|
|
260
|
+
fixedRootNode?: boolean;
|
|
261
|
+
autoLayouting?: boolean;
|
|
262
|
+
supportAutoLayout?: boolean;
|
|
263
|
+
};
|
|
264
|
+
export type RGForceLayoutOptions = RGLayoutOptionsCore & {
|
|
265
|
+
fastStart?: boolean;
|
|
266
|
+
maxLayoutTimes?: number;
|
|
267
|
+
byNode?: boolean;
|
|
268
|
+
byLine?: boolean;
|
|
269
|
+
force_node_repulsion?: number;
|
|
270
|
+
force_line_elastic?: number;
|
|
271
|
+
startAngle?: number;
|
|
272
|
+
};
|
|
273
|
+
export type RGCenterLayoutOptions = RGForceLayoutOptions & {
|
|
274
|
+
distance_coefficient?: number;
|
|
275
|
+
levelDistance?: number[];
|
|
276
|
+
};
|
|
277
|
+
export type RGTreeLayoutOptions = RGLayoutOptionsCore & {
|
|
278
|
+
from?: string;
|
|
279
|
+
treeNodeGapH?: number;
|
|
280
|
+
treeNodeGapV?: number;
|
|
281
|
+
levelGaps?: number[];
|
|
282
|
+
layoutExpansionDirection?: 'start' | 'center' | 'end';
|
|
283
|
+
simpleTree?: boolean;
|
|
284
|
+
ignoreNodeSize?: boolean;
|
|
285
|
+
alignParentItemsX: 'start' | 'center' | 'end';
|
|
286
|
+
alignParentItemsY: 'start' | 'center' | 'end';
|
|
287
|
+
};
|
|
288
|
+
export type RGLayoutOptions = RGLayoutOptionsCore & RGForceLayoutOptions & RGCenterLayoutOptions & RGTreeLayoutOptions;
|
|
289
|
+
export interface RGLayouter {
|
|
290
|
+
isMainLayouer: boolean;
|
|
291
|
+
requireLinks: boolean;
|
|
292
|
+
allNodes: RGNode[];
|
|
293
|
+
rootNode?: RGNode;
|
|
294
|
+
layoutOptions: RGLayoutOptions;
|
|
295
|
+
setLinks: (links: RGLink[]) => void;
|
|
296
|
+
placeNodes: (allNodes: RGNode[], rootNode: RGNode) => void;
|
|
297
|
+
doLayout: (allNodes: RGNode[], rootNode: RGNode) => void;
|
|
298
|
+
autoLayout?: (forceLayout?: boolean, viewUpdate?: (() => void) | false) => void;
|
|
299
|
+
stop?: () => void;
|
|
300
|
+
}
|
|
301
|
+
export type RGOptionsInited = {
|
|
302
|
+
instanceId: string;
|
|
303
|
+
debug: boolean;
|
|
304
|
+
showDebugPanel: boolean;
|
|
305
|
+
showToolBar: boolean;
|
|
306
|
+
backgroundColor: string;
|
|
307
|
+
downloadImageFileName: string;
|
|
308
|
+
disableWheelEvent: boolean;
|
|
309
|
+
wheelEventAction: 'zoom' | 'scroll' | 'none';
|
|
310
|
+
disableDragNode: boolean;
|
|
311
|
+
disableDragLine: boolean;
|
|
312
|
+
selectionMode: boolean;
|
|
313
|
+
canvasMoveMode: boolean;
|
|
314
|
+
disableNodePointEvent: boolean;
|
|
315
|
+
disableLinePointEvent: boolean;
|
|
316
|
+
toolBarDirection: string;
|
|
317
|
+
toolBarPositionH: string;
|
|
318
|
+
toolBarPositionV: string;
|
|
319
|
+
defaultExpandHolderPosition: 'hide' | 'left' | 'top' | 'right' | 'bottom';
|
|
320
|
+
defaultExpandHolderColor?: string;
|
|
321
|
+
defaultNodeColor: string;
|
|
322
|
+
checkedItemBackgroundColor?: string;
|
|
323
|
+
defaultLineTextOffset_x?: number;
|
|
324
|
+
defaultLineTextOffset_y?: number;
|
|
325
|
+
defaultLineColor: string;
|
|
326
|
+
defaultLineShape?: RGLineShape;
|
|
327
|
+
defaultJunctionPoint?: RGJunctionPoint;
|
|
328
|
+
disableDragCanvas: boolean;
|
|
329
|
+
placeSingleNode: boolean;
|
|
330
|
+
placeOtherNodes: boolean;
|
|
331
|
+
lineUseTextPath: boolean;
|
|
332
|
+
lineTextMaxLength: number;
|
|
333
|
+
multiLineDistance: number;
|
|
334
|
+
checkedNodeId: string;
|
|
335
|
+
checkedLineId: string;
|
|
336
|
+
checkedLinkId: string;
|
|
337
|
+
performanceMode: boolean;
|
|
338
|
+
data: any;
|
|
339
|
+
viewHeight: string;
|
|
340
|
+
defaultLineMarker: {
|
|
341
|
+
markerWidth: number;
|
|
342
|
+
markerHeight: number;
|
|
343
|
+
refX: number;
|
|
344
|
+
refY: number;
|
|
345
|
+
viewBox: string;
|
|
346
|
+
data: string;
|
|
347
|
+
};
|
|
348
|
+
layout: RGLayoutOptions;
|
|
349
|
+
graphOffset_x: number;
|
|
350
|
+
graphOffset_y: number;
|
|
351
|
+
canvasZoom: number;
|
|
352
|
+
mouseWheelSpeed: number;
|
|
353
|
+
minCanvasZoom: number;
|
|
354
|
+
maxCanvasZoom: number;
|
|
355
|
+
placeOtherGroup: boolean;
|
|
356
|
+
defaultPolyLineRadius: number;
|
|
357
|
+
reLayoutWhenExpandedOrCollapsed: boolean;
|
|
358
|
+
useHorizontalView: boolean;
|
|
359
|
+
creatingSelection: boolean;
|
|
360
|
+
selectionView: any;
|
|
361
|
+
creatingNodePlot: boolean;
|
|
362
|
+
showTemplateNode: boolean;
|
|
363
|
+
newNodeTemplate: any;
|
|
364
|
+
creatingLinePlot: boolean;
|
|
365
|
+
newLineTemplate: RGLine;
|
|
366
|
+
newLinkTemplate: any;
|
|
367
|
+
};
|
|
368
|
+
export type RGOptions = Partial<RGOptionsInited>;
|
|
369
|
+
export type RGLineColorItem = {
|
|
370
|
+
id: string;
|
|
371
|
+
color: string;
|
|
372
|
+
};
|
|
373
|
+
export type RGGraphReactiveData = {
|
|
374
|
+
options: RGOptions | undefined;
|
|
375
|
+
};
|
|
376
|
+
export type RGSelectionView = {
|
|
377
|
+
x: number;
|
|
378
|
+
y: number;
|
|
379
|
+
width: number;
|
|
380
|
+
height: number;
|
|
381
|
+
};
|
|
382
|
+
export interface RGListeners {
|
|
383
|
+
onReady?: (graphInstance: RelationGraphInstance) => void;
|
|
384
|
+
/**
|
|
385
|
+
* 当节点被点击时触发
|
|
386
|
+
*/
|
|
387
|
+
onNodeClick?: (node: RGNode, e: RGUserEvent) => boolean | void | Promise<boolean | void>;
|
|
388
|
+
/**
|
|
389
|
+
* 当节点被展开时触发
|
|
390
|
+
*/
|
|
391
|
+
onNodeExpand?: (node: RGNode, e: RGUserEvent) => boolean | void | Promise<boolean | void>;
|
|
392
|
+
/**
|
|
393
|
+
* 当节点被折叠时触发
|
|
394
|
+
*/
|
|
395
|
+
onNodeCollapse?: (node: RGNode, e: RGUserEvent) => boolean | void | Promise<boolean | void>;
|
|
396
|
+
/**
|
|
397
|
+
* 当连线被点击时触发, line是连线,link是line对应的RGLink对象
|
|
398
|
+
*/
|
|
399
|
+
onLineClick?: (line: RGLine, link: RGLink, e: RGUserEvent) => boolean | void | Promise<boolean | void>;
|
|
400
|
+
/**
|
|
401
|
+
* 当节点被拖拽开始时触发
|
|
402
|
+
*/
|
|
403
|
+
onNodeDragStart?: (node: RGNode, e: RGUserEvent) => void;
|
|
404
|
+
/**
|
|
405
|
+
* 当节点拖拽结束时触发
|
|
406
|
+
* @param node 被拖拽的节点
|
|
407
|
+
* @param e 触发事件
|
|
408
|
+
* @param x_buff 拖拽结束时的x偏移量,可能为undefined
|
|
409
|
+
* @param y_buff 拖拽结束时的y偏移量,可能为undefined
|
|
410
|
+
*/
|
|
411
|
+
onNodeDragEnd?: (node: RGNode, e: RGUserEvent, x_buff: number, y_buff: number) => void;
|
|
412
|
+
/**
|
|
413
|
+
* 当节点正在被拖拽时触发
|
|
414
|
+
*/
|
|
415
|
+
onNodeDragging?: (node: RGNode, newX: number, newY: number, buffX: number, buffY: number, e: RGUserEvent) => void | RGPosition | undefined;
|
|
416
|
+
/**
|
|
417
|
+
* 当画布被拖拽结束时触发
|
|
418
|
+
*/
|
|
419
|
+
onCanvasDragEnd?: (e: RGUserEvent) => void;
|
|
420
|
+
/**
|
|
421
|
+
* 当画布正在被拖拽时触发
|
|
422
|
+
* @param newX 画布新的偏移量X
|
|
423
|
+
* @param newY 画布新的偏移量Y
|
|
424
|
+
* @param buffX 画布拖拽的X偏移量
|
|
425
|
+
* @param buffY 画布拖拽的Y偏移量
|
|
426
|
+
*/
|
|
427
|
+
onCanvasDragging?: (newX: number, newY: number, buffX: number, buffY: number) => void | RGPosition | undefined;
|
|
428
|
+
/**
|
|
429
|
+
* 当画布被右键点击时触发
|
|
430
|
+
* @param e 触发事件
|
|
431
|
+
* @param objectType 对象类型,可能是'canvas'、'node'、'line'
|
|
432
|
+
* @param object 被点击的对象,可能是undefined、RGNode、RGLine
|
|
433
|
+
* @param eventPositionOnCanvas 事件在画布上的位置
|
|
434
|
+
* @param eventPositionOnView 事件在视图上的位置
|
|
435
|
+
*/
|
|
436
|
+
onContextmenu?: (e: RGUserEvent, objectType: RGEventTargetType, object: RGNode | RGLine | undefined, eventPositionOnCanvas: RGCoordinate, eventPositionOnView: RGCoordinate) => void;
|
|
437
|
+
/**
|
|
438
|
+
* 当全屏状态改变时触发
|
|
439
|
+
*/
|
|
440
|
+
onFullscreen?: (newValue: boolean, defaultFullscreen: () => Promise<void>) => void;
|
|
441
|
+
/**
|
|
442
|
+
* 当画布被点击时触发
|
|
443
|
+
*/
|
|
444
|
+
onCanvasClick?: (e: RGUserEvent) => void;
|
|
445
|
+
/**
|
|
446
|
+
* 当画布选择结束时触发
|
|
447
|
+
* @param selectionView 画布选择的视图信息,包含x、y、width、height
|
|
448
|
+
* @param e 触发事件
|
|
449
|
+
*/
|
|
450
|
+
onCanvasSelectionEnd?: (selectionView: RGSelectionView, e: RGUserEvent) => void;
|
|
451
|
+
/**
|
|
452
|
+
* 当缩放开始前触发
|
|
453
|
+
*/
|
|
454
|
+
beforeZoomStart?: () => void | false;
|
|
455
|
+
/**
|
|
456
|
+
* 当缩放结束时触发
|
|
457
|
+
*/
|
|
458
|
+
onZoomEnd?: () => void;
|
|
459
|
+
/**
|
|
460
|
+
* 当下载图像时触发
|
|
461
|
+
*/
|
|
462
|
+
onImageDownload?: (dom: HTMLElement, format: string) => boolean | void;
|
|
463
|
+
/**
|
|
464
|
+
* 当保存图像为文件时触发
|
|
465
|
+
*/
|
|
466
|
+
onImageSaveAsFile?: (canvas: HTMLCanvasElement, format: string, fileName: string) => boolean | void;
|
|
467
|
+
/**
|
|
468
|
+
* 当视图大小改变时触发
|
|
469
|
+
*/
|
|
470
|
+
onViewResize?: () => void;
|
|
471
|
+
/**
|
|
472
|
+
* 在一个或者多个节点(通过RGEditingController)开始被调整大小时触发
|
|
473
|
+
*/
|
|
474
|
+
onResizeStart?: (nodes: RGNode[], e: RGUserEvent) => void;
|
|
475
|
+
/**
|
|
476
|
+
* 调整节点大小之前触发,可以返回false来阻止调整大小
|
|
477
|
+
* @param node 被调整大小的节点
|
|
478
|
+
* @param newX 即将被调整到的新的X位置
|
|
479
|
+
* @param newY 即将被调整到的新的Y位置
|
|
480
|
+
* @param newW 即将被调整到的新的宽度
|
|
481
|
+
* @param newH 即将被调整到的新的高度
|
|
482
|
+
*/
|
|
483
|
+
beforeNodeResize?: (node: RGNode, newX: number, newY: number, newW: number, newH: number) => void | false;
|
|
484
|
+
/**
|
|
485
|
+
* 在一个或者多个节点(通过RGEditingController)调整大小完成时触发
|
|
486
|
+
* @param nodes 被调整大小的节点数组
|
|
487
|
+
* @param buffX 调整大小结束时的X偏移量
|
|
488
|
+
* @param buffY 调整大小结束时的Y偏移量
|
|
489
|
+
* @param e 触发事件
|
|
490
|
+
*/
|
|
491
|
+
onResizeEnd?: (nodes: RGNode[], buffX: number, buffY: number, e: RGUserEvent) => void;
|
|
492
|
+
/**
|
|
493
|
+
* 当线段的控制点被放置时触发
|
|
494
|
+
* @param fromNode 起始节点
|
|
495
|
+
* @param toNode 目标节点
|
|
496
|
+
* @param lineTemplate 线段模板
|
|
497
|
+
*/
|
|
498
|
+
onLineVertexDropped?: (lineInfo: {
|
|
499
|
+
newLineTemplate: JsonLine;
|
|
500
|
+
fromNode: RGLineTarget | RGNode;
|
|
501
|
+
toNode: RGLineTarget | RGNode;
|
|
502
|
+
}) => void;
|
|
503
|
+
/**
|
|
504
|
+
* 在创建线段之前触发,可以返回false来阻止创建线段
|
|
505
|
+
* @param fromNode 起始节点
|
|
506
|
+
* @param toNode 目标节点
|
|
507
|
+
* @param lineTemplate 线段模板
|
|
508
|
+
*/
|
|
509
|
+
beforeCreateLine?: (lineInfo: {
|
|
510
|
+
lineJson: JsonLine;
|
|
511
|
+
fromNode: RGLineTarget | RGNode;
|
|
512
|
+
toNode: RGLineTarget | RGNode;
|
|
513
|
+
}) => void | false;
|
|
514
|
+
/**
|
|
515
|
+
* 当一条新线段被创建时触发
|
|
516
|
+
* @param fromNode 起始节点
|
|
517
|
+
* @param toNode 目标节点
|
|
518
|
+
* @param lineTemplate 线段模板
|
|
519
|
+
*/
|
|
520
|
+
onLineBeCreated?: (lineInfo: {
|
|
521
|
+
lineJson: JsonLine;
|
|
522
|
+
fromNode: RGLineTarget | RGNode;
|
|
523
|
+
toNode: RGLineTarget | RGNode;
|
|
524
|
+
}) => void;
|
|
525
|
+
/**
|
|
526
|
+
* 当有新的节点被添加到图中之前时触发
|
|
527
|
+
* @param nodes 即将被添加的节点 jsonNode数组
|
|
528
|
+
*/
|
|
529
|
+
beforeAddNodes?: (nodes: JsonNode[]) => void;
|
|
530
|
+
/**
|
|
531
|
+
* 当有新的线条被添加到图中之前时触发
|
|
532
|
+
* @param lines 即将被添加的线条哦 jsonLine数组
|
|
533
|
+
*/
|
|
534
|
+
beforeAddLines?: (lines: JsonLine[]) => void;
|
|
535
|
+
/**
|
|
536
|
+
* 当键盘在图谱区域内被按下时触发
|
|
537
|
+
* @param e
|
|
538
|
+
*/
|
|
539
|
+
onKeyboardDown?: (e: KeyboardEvent) => void;
|
|
540
|
+
/**
|
|
541
|
+
* 当键盘在图谱区域内被按起时触发
|
|
542
|
+
* @param e
|
|
543
|
+
*/
|
|
544
|
+
onKeyboardUp?: (e: KeyboardEvent) => void;
|
|
545
|
+
/**
|
|
546
|
+
* onCanvasDragStart
|
|
547
|
+
* @param canvasMoveStartPosition
|
|
548
|
+
* @param eventClientStartPosition
|
|
549
|
+
* @param e
|
|
550
|
+
*/
|
|
551
|
+
onCanvasDragStart?: (canvasMoveStartPosition: RGPosition, eventClientStartPosition: RGPosition, e: RGUserEvent) => void;
|
|
552
|
+
onForceLayoutFinish?: () => void;
|
|
553
|
+
/**
|
|
554
|
+
* 在执行画布移动滚动之前触发,返回 true表示阻止继续完成滚动
|
|
555
|
+
* @param e
|
|
556
|
+
* @param buffX
|
|
557
|
+
* @param buffY
|
|
558
|
+
* @return true = Abort Scroll
|
|
559
|
+
*/
|
|
560
|
+
beforeScrollStart?: (buffX: number, buffY: number, e: Event) => true | undefined | void;
|
|
561
|
+
}
|
|
562
|
+
export type RGEventEmits = {
|
|
563
|
+
(e: 'onReady', graphInstance: RelationGraphInstance): void;
|
|
564
|
+
/** 警告:父组件的 boolean 返回值将丢失,无法阻止默认行为 */
|
|
565
|
+
(e: 'onNodeClick', node: RGNode, event: RGUserEvent): void;
|
|
566
|
+
/** 警告:父组件的 boolean 返回值将丢失,无法阻止默认行为 */
|
|
567
|
+
(e: 'onNodeExpand', node: RGNode, event: RGUserEvent): void;
|
|
568
|
+
/** 警告:父组件的 boolean 返回值将丢失,无法阻止默认行为 */
|
|
569
|
+
(e: 'onNodeCollapse', node: RGNode, event: RGUserEvent): void;
|
|
570
|
+
/** 警告:父组件的 boolean 返回值将丢失,无法阻止默认行为 */
|
|
571
|
+
(e: 'onLineClick', line: RGLine, link: RGLink, event: RGUserEvent): void;
|
|
572
|
+
(e: 'onNodeDragStart', node: RGNode, event: RGUserEvent): void;
|
|
573
|
+
(e: 'onNodeDragEnd', node: RGNode, event: RGUserEvent, x_buff: number, y_buff: number): void;
|
|
574
|
+
/** 警告:父组件返回的 RGPosition 值将丢失 */
|
|
575
|
+
(e: 'onNodeDragging', node: RGNode, newX: number, newY: number, buffX: number, buffY: number, event: RGUserEvent): void;
|
|
576
|
+
(e: 'onCanvasDragEnd', event: RGUserEvent): void;
|
|
577
|
+
/** 警告:父组件返回的 RGPosition 值将丢失 */
|
|
578
|
+
(e: 'onCanvasDragging', newX: number, newY: number, buffX: number, buffY: number): void;
|
|
579
|
+
(e: 'onContextmenu', event: RGUserEvent, objectType: RGEventTargetType, object: RGNode | RGLine | undefined, eventPositionOnCanvas: RGCoordinate, eventPositionOnView: RGCoordinate): void;
|
|
580
|
+
(e: 'onFullscreen', newValue: boolean, defaultFullscreen: () => Promise<void>): void;
|
|
581
|
+
(e: 'onCanvasClick', event: RGUserEvent): void;
|
|
582
|
+
(e: 'onCanvasSelectionEnd', selectionView: RGSelectionView, event: RGUserEvent): void;
|
|
583
|
+
/** 警告:父组件返回的 false 值将丢失,无法阻止缩放 */
|
|
584
|
+
(e: 'beforeZoomStart'): void;
|
|
585
|
+
(e: 'onZoomEnd'): void;
|
|
586
|
+
/** 警告:父组件的 boolean 返回值将丢失,无法阻止下载 */
|
|
587
|
+
(e: 'onImageDownload', dom: HTMLElement, format: string): void;
|
|
588
|
+
/** 警告:父组件的 boolean 返回值将丢失,无法阻止保存 */
|
|
589
|
+
(e: 'onImageSaveAsFile', canvas: HTMLCanvasElement, format: string, fileName: string): void;
|
|
590
|
+
(e: 'onViewResize'): void;
|
|
591
|
+
(e: 'onResizeStart', nodes: RGNode[], event: RGUserEvent): void;
|
|
592
|
+
/** 警告:父组件返回的 false 值将丢失,无法阻止调整大小 */
|
|
593
|
+
(e: 'beforeNodeResize', node: RGNode, newX: number, newY: number, newW: number, newH: number): void;
|
|
594
|
+
(e: 'onResizeEnd', nodes: RGNode[], buffX: number, buffY: number, event: RGUserEvent): void;
|
|
595
|
+
(e: 'onLineVertexDropped', lineInfo: {
|
|
596
|
+
newLineTemplate: JsonLine;
|
|
597
|
+
fromNode: RGLineTarget | RGNode;
|
|
598
|
+
toNode: RGLineTarget | RGNode;
|
|
599
|
+
}): void;
|
|
600
|
+
/** 警告:父组件返回的 false 值将丢失,无法阻止创建连线 */
|
|
601
|
+
(e: 'beforeCreateLine', lineInfo: {
|
|
602
|
+
lineJson: JsonLine;
|
|
603
|
+
fromNode: RGLineTarget | RGNode;
|
|
604
|
+
toNode: RGLineTarget | RGNode;
|
|
605
|
+
}): void;
|
|
606
|
+
(e: 'onLineBeCreated', lineInfo: {
|
|
607
|
+
lineJson: JsonLine;
|
|
608
|
+
fromNode: RGLineTarget | RGNode;
|
|
609
|
+
toNode: RGLineTarget | RGNode;
|
|
610
|
+
}): void;
|
|
611
|
+
(e: 'beforeAddNodes', nodes: JsonNode[]): void;
|
|
612
|
+
(e: 'beforeAddLines', lines: JsonLine[]): void;
|
|
613
|
+
(e: 'onKeyboardDown', event: KeyboardEvent): void;
|
|
614
|
+
(e: 'onKeyboardUp', event: KeyboardEvent): void;
|
|
615
|
+
(e: 'onCanvasDragStart', canvasMoveStartPosition: RGPosition, eventClientStartPosition: RGPosition, event: RGUserEvent): void;
|
|
616
|
+
(e: 'onForceLayoutFinish'): void;
|
|
617
|
+
(e: 'beforeScrollStart', buffX: number, buffY: number, event: Event): true | undefined | void;
|
|
618
|
+
};
|
|
619
|
+
export declare enum RGEventNames {
|
|
620
|
+
onReady = "onReady",
|
|
621
|
+
onNodeClick = "onNodeClick",
|
|
622
|
+
onNodeExpand = "onNodeExpand",
|
|
623
|
+
onNodeCollapse = "onNodeCollapse",
|
|
624
|
+
onLineClick = "onLineClick",
|
|
625
|
+
onImageDownload = "onImageDownload",
|
|
626
|
+
onImageSaveAsFile = "onImageSaveAsFile",
|
|
627
|
+
onNodeDragStart = "onNodeDragStart",
|
|
628
|
+
onNodeDragEnd = "onNodeDragEnd",
|
|
629
|
+
onNodeDragging = "onNodeDragging",
|
|
630
|
+
onCanvasDragEnd = "onCanvasDragEnd",
|
|
631
|
+
onCanvasDragging = "onCanvasDragging",
|
|
632
|
+
onContextmenu = "onContextmenu",
|
|
633
|
+
onFullscreen = "onFullscreen",
|
|
634
|
+
onCanvasClick = "onCanvasClick",
|
|
635
|
+
onCanvasSelectionEnd = "onCanvasSelectionEnd",
|
|
636
|
+
beforeZoomStart = "beforeZoomStart",
|
|
637
|
+
onZoomEnd = "onZoomEnd",
|
|
638
|
+
onViewResize = "onViewResize",
|
|
639
|
+
onResizeStart = "onResizeStart",
|
|
640
|
+
beforeNodeResize = "beforeNodeResize",
|
|
641
|
+
onResizeEnd = "onResizeEnd",
|
|
642
|
+
onLineVertexDropped = "onLineVertexDropped",
|
|
643
|
+
beforeCreateLine = "beforeCreateLine",
|
|
644
|
+
onLineBeCreated = "onLineBeCreated",
|
|
645
|
+
beforeAddNodes = "beforeAddNodes",
|
|
646
|
+
beforeAddLines = "beforeAddLines",
|
|
647
|
+
onKeyboardDown = "onKeyboardDown",
|
|
648
|
+
onKeyboardUp = "onKeyboardUp",
|
|
649
|
+
onCanvasDragStart = "onCanvasDragStart",
|
|
650
|
+
onForceLayoutFinish = "onForceLayoutFinish",
|
|
651
|
+
beforeScrollStart = "beforeScrollStart"
|
|
652
|
+
}
|
|
653
|
+
export type RGEventHandler = (eventName: RGEventNames, ...args: any[]) => void | any;
|
|
654
|
+
export type RGEventEmitHook = (eventName: RGEventNames, ...args: any[]) => void | any;
|
|
655
|
+
export type RGCtrlPointForLine44 = {
|
|
656
|
+
pIndex: number;
|
|
657
|
+
optionName: string;
|
|
658
|
+
direction: 'v' | 'h';
|
|
659
|
+
x: number;
|
|
660
|
+
y: number;
|
|
661
|
+
startDirection: RGDirection;
|
|
662
|
+
endDirection: RGDirection;
|
|
663
|
+
hide?: boolean;
|
|
664
|
+
};
|
|
665
|
+
export type RGOptionsFull = RGOptionsInited & {
|
|
666
|
+
snapshotting: boolean;
|
|
667
|
+
graphLoading: boolean;
|
|
668
|
+
enableNodeXYAnimation: boolean;
|
|
669
|
+
enableCanvasTransformAnimation: boolean;
|
|
670
|
+
graphLoadingText: string;
|
|
671
|
+
instanceDestroyed: boolean;
|
|
672
|
+
editingLineController: {
|
|
673
|
+
show: boolean;
|
|
674
|
+
link: RGLink | null;
|
|
675
|
+
line: RGLine | null;
|
|
676
|
+
startPoint: RGPosition;
|
|
677
|
+
endPoint: RGPosition;
|
|
678
|
+
text: {
|
|
679
|
+
show: boolean;
|
|
680
|
+
x: number;
|
|
681
|
+
y: number;
|
|
682
|
+
width: number;
|
|
683
|
+
height: number;
|
|
684
|
+
};
|
|
685
|
+
ctrlPoints: RGPosition[];
|
|
686
|
+
selectedLines: string[];
|
|
687
|
+
line44Splits: RGCtrlPointForLine44[];
|
|
688
|
+
line49Points: RGPosition[];
|
|
689
|
+
ctrlPoint1: RGPosition;
|
|
690
|
+
ctrlPoint2: RGPosition;
|
|
691
|
+
toolbar: RGPosition;
|
|
692
|
+
};
|
|
693
|
+
editingController: {
|
|
694
|
+
show: boolean;
|
|
695
|
+
nodes: RGNode[];
|
|
696
|
+
x: number;
|
|
697
|
+
y: number;
|
|
698
|
+
width: number;
|
|
699
|
+
height: number;
|
|
700
|
+
};
|
|
701
|
+
nodeConnectController: {
|
|
702
|
+
show: boolean;
|
|
703
|
+
node: RGNode;
|
|
704
|
+
x: number;
|
|
705
|
+
y: number;
|
|
706
|
+
width: number;
|
|
707
|
+
height: number;
|
|
708
|
+
};
|
|
709
|
+
showReferenceLine: boolean;
|
|
710
|
+
referenceLineAdsorption: boolean;
|
|
711
|
+
editingReferenceLine: {
|
|
712
|
+
show: boolean;
|
|
713
|
+
directionV: boolean;
|
|
714
|
+
directionH: boolean;
|
|
715
|
+
v_x: number;
|
|
716
|
+
v_y: number;
|
|
717
|
+
v_height: number;
|
|
718
|
+
h_x: number;
|
|
719
|
+
h_y: number;
|
|
720
|
+
h_width: number;
|
|
721
|
+
};
|
|
722
|
+
showMiniView: boolean;
|
|
723
|
+
miniViewVisibleHandle: {
|
|
724
|
+
x: number;
|
|
725
|
+
y: number;
|
|
726
|
+
width: number;
|
|
727
|
+
height: number;
|
|
728
|
+
emptyContent: boolean;
|
|
729
|
+
};
|
|
730
|
+
instanceId: string;
|
|
731
|
+
viewSize: {
|
|
732
|
+
width: number;
|
|
733
|
+
height: number;
|
|
734
|
+
};
|
|
735
|
+
viewELSize: {
|
|
736
|
+
width: number;
|
|
737
|
+
height: number;
|
|
738
|
+
left: number;
|
|
739
|
+
top: number;
|
|
740
|
+
};
|
|
741
|
+
fullscreen: boolean;
|
|
742
|
+
canvasSize: {
|
|
743
|
+
width: number;
|
|
744
|
+
height: number;
|
|
745
|
+
};
|
|
746
|
+
canvasOffset: {
|
|
747
|
+
x: number;
|
|
748
|
+
y: number;
|
|
749
|
+
zoom_buff_x: number;
|
|
750
|
+
zoom_buff_y: number;
|
|
751
|
+
};
|
|
752
|
+
showEasyView?: boolean;
|
|
753
|
+
canvasOpacity?: number;
|
|
754
|
+
};
|
|
755
|
+
export type RGRefreshCallback = (graphInstance: any) => void;
|
|
756
|
+
export type RelationGraphInstance = RelationGraphFinal;
|
|
757
|
+
export interface RelationGraphExpose {
|
|
758
|
+
getInstance(): RelationGraphInstance;
|
|
759
|
+
}
|
|
760
|
+
export interface RGNodeSlotProps {
|
|
761
|
+
node: RGNode;
|
|
762
|
+
graphInstance: RelationGraphInstance;
|
|
763
|
+
}
|
|
764
|
+
export interface RGLinePeelProps {
|
|
765
|
+
line: RGLine | RGFakeLine;
|
|
766
|
+
}
|
|
767
|
+
export interface RGLineSlotProps {
|
|
768
|
+
lineConfig: RGGenerateLineConfig;
|
|
769
|
+
}
|
|
770
|
+
export interface RGLinePathProps {
|
|
771
|
+
lineConfig: RGGenerateLineConfig;
|
|
772
|
+
linePathInfo: RGLinePathInfo;
|
|
773
|
+
}
|
|
774
|
+
export interface RGLineTextProps {
|
|
775
|
+
lineConfig: RGGenerateLineConfig;
|
|
776
|
+
linePathInfo: RGLinePathInfo;
|
|
777
|
+
}
|
|
778
|
+
export type RelationGraphProps = RGListeners & {
|
|
779
|
+
options: RGOptions;
|
|
780
|
+
relationGraphCore?: RelationGraphFinal;
|
|
781
|
+
};
|
|
782
|
+
export interface RGToolBarProps {
|
|
783
|
+
direction?: 'v' | 'h' | string;
|
|
784
|
+
positionH?: 'left' | 'center' | 'right' | string;
|
|
785
|
+
positionV?: 'top' | 'center' | 'bottom' | string;
|
|
786
|
+
}
|
|
787
|
+
export interface RGMiniViewProps {
|
|
788
|
+
position?: RGWidgetPosition;
|
|
789
|
+
width?: string;
|
|
790
|
+
height?: string;
|
|
791
|
+
}
|
|
792
|
+
export interface RGWidgetProps {
|
|
793
|
+
position?: RGWidgetPosition;
|
|
794
|
+
}
|
|
795
|
+
export interface RGEditingLineControllerProps {
|
|
796
|
+
textEditable?: boolean;
|
|
797
|
+
moveLineVertexStart?: (type: RGLineEditPoint, line: RGLine) => void;
|
|
798
|
+
moveLineVertexEnd?: RGLineVertexBeDroppedEventHandler;
|
|
799
|
+
onLineTextDragEnd?: (line: RGLine) => void;
|
|
800
|
+
onLineTextChanged?: (line: RGLine) => void;
|
|
801
|
+
}
|
|
802
|
+
export type RGLineConnectEventHandler = (fromNode: RGNode | RGLineTarget, toNode: RGNode | RGLineTarget | RGPosition, newLineJson?: JsonLine) => void;
|
|
803
|
+
export type RGLineVertexBeDroppedEventHandler = (fromNode: RGNode | RGLineTarget, toNode: RGNode | RGLineTarget | RGPosition, newLineJson?: JsonLine) => void;
|
|
804
|
+
export type JsonNodeLike = Partial<JsonNode>;
|
|
805
|
+
export type JsonLineLike = Partial<JsonLine>;
|
|
806
|
+
export type JsonNodeTemplate = JsonNodeLike;
|
|
807
|
+
export type JsonLineTemplate = JsonLineLike;
|
|
808
|
+
export type CreatingLinePlotOptions = {
|
|
809
|
+
onCreateLine: RGLineConnectEventHandler | undefined;
|
|
810
|
+
template?: JsonLineLike;
|
|
811
|
+
fromNode?: RGLineTarget;
|
|
812
|
+
};
|
|
813
|
+
export type CreatingNodePlotOptions = {
|
|
814
|
+
templateText?: string;
|
|
815
|
+
templateClassName?: string;
|
|
816
|
+
templateNode?: JsonNodeLike;
|
|
817
|
+
templateMove?: (x: number, y: number) => void;
|
|
818
|
+
onCreateNode: (x: number, y: number, nodeTemplate?: JsonNodeLike) => void;
|
|
819
|
+
};
|
|
820
|
+
export interface RGConnectSourceProps {
|
|
821
|
+
fromNode?: RGNode;
|
|
822
|
+
lineTemplate: JsonLineLike;
|
|
823
|
+
onConnectStart?: (fromNode?: RGNode, newLineTemplate?: JsonLineLike, event?: RGUserEvent) => void;
|
|
824
|
+
onConnectEnd?: RGLineConnectEventHandler;
|
|
825
|
+
className?: string;
|
|
826
|
+
style?: Record<string, string | number | undefined>;
|
|
827
|
+
}
|
|
828
|
+
export interface RGConnectTargetProps {
|
|
829
|
+
junctionPoint: RGJunctionPoint;
|
|
830
|
+
targetId: string;
|
|
831
|
+
targetType?: string;
|
|
832
|
+
targetData?: Record<string, any>;
|
|
833
|
+
onLineVertexBeDropped?: RGLineVertexBeDroppedEventHandler;
|
|
834
|
+
lineTemplate?: JsonLineLike;
|
|
835
|
+
disableDrop?: boolean;
|
|
836
|
+
disableDrag?: boolean;
|
|
837
|
+
onDragConnectStart?: (newLineTemplate?: JsonLineLike, event?: RGUserEvent) => void;
|
|
838
|
+
onDragConnectEnd?: RGLineConnectEventHandler;
|
|
839
|
+
className?: string;
|
|
840
|
+
style?: Record<string, string | number | undefined>;
|
|
841
|
+
}
|
|
842
|
+
export interface RGWatermarkProps {
|
|
843
|
+
forImage?: boolean;
|
|
844
|
+
forDisplay?: boolean;
|
|
845
|
+
position?: RGWidgetPosition;
|
|
846
|
+
width?: string;
|
|
847
|
+
height?: string;
|
|
848
|
+
}
|
|
849
|
+
export interface RGBackgroundProps {
|
|
850
|
+
forImage?: boolean;
|
|
851
|
+
forDisplay?: boolean;
|
|
852
|
+
}
|
|
853
|
+
export type RGLineTextPosition = {
|
|
854
|
+
x: number;
|
|
855
|
+
y: number;
|
|
856
|
+
rotate: number;
|
|
857
|
+
};
|
|
858
|
+
export type RGGenerateLineConfig = {
|
|
859
|
+
line: RGLine | RGFakeLine;
|
|
860
|
+
from?: RGLineTarget;
|
|
861
|
+
to?: RGLineTarget;
|
|
862
|
+
totalLinesBetweenNodes?: number;
|
|
863
|
+
currentLineIndex?: number;
|
|
864
|
+
defaultOptions?: any;
|
|
865
|
+
};
|
|
866
|
+
export type RGFakeLineTargetRender = (nodeType: string, nodeId: string, fakeLine: RGFakeLine) => RGLineTarget;
|
|
867
|
+
export type RGGenerateLinePrams = {
|
|
868
|
+
line: RGLine;
|
|
869
|
+
totalLinesBetweenNodes: number;
|
|
870
|
+
currentLineIndex: number;
|
|
871
|
+
lineDirection: 'v' | 'h';
|
|
872
|
+
lineShape: RGLineShape;
|
|
873
|
+
lineRadius: number;
|
|
874
|
+
fromJunctionPoint: RGJunctionPoint;
|
|
875
|
+
toJunctionPoint: RGJunctionPoint;
|
|
876
|
+
fx: number;
|
|
877
|
+
fy: number;
|
|
878
|
+
fcx: number;
|
|
879
|
+
fcy: number;
|
|
880
|
+
f_W: number;
|
|
881
|
+
f_H: number;
|
|
882
|
+
tx: number;
|
|
883
|
+
ty: number;
|
|
884
|
+
tcx: number;
|
|
885
|
+
tcy: number;
|
|
886
|
+
t_W: number;
|
|
887
|
+
t_H: number;
|
|
888
|
+
};
|
|
889
|
+
export type RGLinePathInfo = {
|
|
890
|
+
pathData: string;
|
|
891
|
+
pathCommands: RGLinePathCommands;
|
|
892
|
+
textPosition: RGLineTextPosition;
|
|
893
|
+
points: RGCoordinate[];
|
|
894
|
+
startDirection?: RGDirection;
|
|
895
|
+
endDirection?: RGDirection;
|
|
896
|
+
};
|
|
897
|
+
export type CalcNode = {
|
|
898
|
+
rgNode: RGNode;
|
|
899
|
+
x: number;
|
|
900
|
+
y: number;
|
|
901
|
+
width: number;
|
|
902
|
+
height: number;
|
|
903
|
+
};
|