@relation-graph/react 3.0.1 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (21) hide show
  1. package/package.json +1 -1
  2. package/relation-graph.js +6 -6
  3. package/relation-graph.mjs +1004 -943
  4. package/relation-graph.umd.js +6 -6
  5. package/types/packages/platforms/react/src/index.d.ts +4 -1
  6. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent.d.ts +1 -1
  7. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent4CreatingLine.d.ts +1 -1
  8. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent4FakeLines.d.ts +1 -1
  9. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent4Lines.d.ts +1 -1
  10. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGLinePath.d.ts +1 -0
  11. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGLineText.d.ts +3 -1
  12. package/types/packages/platforms/vue2/src/core4vue/RGLineContent.vue.d.ts +5 -4
  13. package/types/packages/platforms/vue2/src/core4vue/RGLinePath.vue.d.ts +1 -2
  14. package/types/packages/platforms/vue2/src/index.d.ts +1 -2
  15. package/types/packages/relation-graph-models/data/RGNodeDataUtils.d.ts +5 -2
  16. package/types/packages/relation-graph-models/models/RelationGraphWith2Data1Getter.d.ts +13 -6
  17. package/types/packages/relation-graph-models/models/RelationGraphWith2Data2Analysis.d.ts +6 -1
  18. package/types/packages/relation-graph-models/models/RelationGraphWith2Data3Update.d.ts +2 -0
  19. package/types/packages/relation-graph-models/models/RelationGraphWith4Line.d.ts +5 -2
  20. package/types/packages/relation-graph-models/models/RelationGraphWith7Event.d.ts +2 -3
  21. package/types/packages/types.ts +11 -8
@@ -154,8 +154,11 @@ export declare const RGFakeNode: import('react').FC<{
154
154
  }>;
155
155
  export declare const RGLinePath: import('react').FC<import('../../../types').RGLinePathProps & {
156
156
  onLineClick: (e: React.MouseEvent | React.TouchEvent) => void;
157
+ children?: React.ReactNode;
158
+ }>;
159
+ export declare const RGLineText: import('react').FC<import('../../../types').RGLineTextProps & {
160
+ children?: React.ReactNode;
157
161
  }>;
158
- export declare const RGLineText: import('react').FC<import('../../../types').RGLineTextProps>;
159
162
  export declare const RGDebugView: import('react').FC<{}>;
160
163
  export declare const RGToolBar: import('react').FC<import('../../../types').RGToolBarProps>;
161
164
  export declare const RGNodeExpandHolder: import('react').FC<import('./types-react').RGNodeExpandHolderProps>;
@@ -11,7 +11,7 @@ export interface RGCanvasContentProps {
11
11
  draggingNodeId?: string;
12
12
  checkedNodeId?: string;
13
13
  checkedLineId?: string;
14
- lineUseTextPath?: boolean;
14
+ defaultLineTextOnPath?: boolean;
15
15
  graphInstanceId?: string;
16
16
  }
17
17
  declare const RGCanvasContent: React.FC<RGCanvasContentProps>;
@@ -2,7 +2,7 @@ import { default as React } from 'react';
2
2
  import { RGLineSlotProps } from '../../../../../../types';
3
3
  export interface RGCanvasContent4CreatingLineProps {
4
4
  lineSlot?: React.FC<RGLineSlotProps> | ((props: RGLineSlotProps) => React.ReactNode);
5
- lineUseTextPath?: boolean;
5
+ defaultLineTextOnPath?: boolean;
6
6
  checkedLineId?: string;
7
7
  graphInstanceId?: string;
8
8
  }
@@ -3,7 +3,7 @@ import { RGLineSlotProps } from '../../../../../../types';
3
3
  export interface RGCanvasContent4FakeLinesProps {
4
4
  showEasyView: boolean;
5
5
  lineSlot?: React.FC<RGLineSlotProps> | ((props: RGLineSlotProps) => React.ReactNode);
6
- lineUseTextPath?: boolean;
6
+ defaultLineTextOnPath?: boolean;
7
7
  checkedLineId?: string;
8
8
  graphInstanceId?: string;
9
9
  }
@@ -3,7 +3,7 @@ import { RGLine, RGLineSlotProps } from '../../../../../../types';
3
3
  export interface RGCanvasContent4LinesProps {
4
4
  showEasyView: boolean;
5
5
  lineSlot?: React.FC<RGLineSlotProps> | ((props: RGLineSlotProps) => React.ReactNode);
6
- lineUseTextPath?: boolean;
6
+ defaultLineTextOnPath?: boolean;
7
7
  checkedLineId?: string;
8
8
  graphInstanceId?: string;
9
9
  allLineConfigList: RGLine[];
@@ -2,5 +2,6 @@ import { default as React } from 'react';
2
2
  import { RGLinePathProps } from '../../../../../../types';
3
3
  declare const RGLinePath: React.FC<RGLinePathProps & {
4
4
  onLineClick: (e: React.MouseEvent | React.TouchEvent) => void;
5
+ children?: React.ReactNode;
5
6
  }>;
6
7
  export default RGLinePath;
@@ -1,4 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  import { RGLineTextProps } from '../../../../../../types';
3
- declare const RGLineText: React.FC<RGLineTextProps>;
3
+ declare const RGLineText: React.FC<RGLineTextProps & {
4
+ children?: React.ReactNode;
5
+ }>;
4
6
  export default RGLineText;
@@ -1,20 +1,21 @@
1
1
  declare const _default: import('vue').DefineComponent<Readonly<{
2
- lineUseTextPath?: any;
2
+ defaultLineTextOnPath?: any;
3
3
  lineConfig?: any;
4
4
  graphInstanceId?: any;
5
5
  checked?: any;
6
6
  }>, {}, {}, {
7
7
  graphInstance(): any;
8
- useTextPath(): any;
8
+ useTextOnPath(): any;
9
+ useSvgTextPath(): any;
9
10
  linePathInfo(): any;
10
11
  textStyle(): any;
11
12
  }, {}, import('vue/types/v3-component-options').ComponentOptionsMixin, import('vue/types/v3-component-options').ComponentOptionsMixin, {}, string, Readonly<import('vue').ExtractPropTypes<Readonly<{
12
- lineUseTextPath?: any;
13
+ defaultLineTextOnPath?: any;
13
14
  lineConfig?: any;
14
15
  graphInstanceId?: any;
15
16
  checked?: any;
16
17
  }>>>, {
17
- readonly lineUseTextPath?: any;
18
+ readonly defaultLineTextOnPath?: any;
18
19
  readonly lineConfig?: any;
19
20
  readonly graphInstanceId?: any;
20
21
  readonly checked?: any;
@@ -1,12 +1,11 @@
1
1
  declare const _default: import('vue').DefineComponent<string[], {}, {}, {
2
2
  graphInstance(): any;
3
3
  pathId(): string;
4
- useTextPath(): any;
5
4
  line(): any;
6
5
  lineWidth(): string | undefined;
7
6
  startArrowMarkerId(): any;
8
7
  endArrowMarkerId(): any;
9
- textStyle(): any;
8
+ onPathTextStyle(): any;
10
9
  }, {
11
10
  onLineClick(e: any): void;
12
11
  }, import('vue/types/v3-component-options').ComponentOptionsMixin, import('vue/types/v3-component-options').ComponentOptionsMixin, {}, string, Readonly<import('vue').ExtractPropTypes<string[]>>, {
@@ -169,12 +169,11 @@ export declare const RGFakeNode: import('vue').DefineComponent<{
169
169
  export declare const RGLinePath: import('vue').DefineComponent<string[], {}, {}, {
170
170
  graphInstance(): any;
171
171
  pathId(): string;
172
- useTextPath(): any;
173
172
  line(): any;
174
173
  lineWidth(): string | undefined;
175
174
  startArrowMarkerId(): any;
176
175
  endArrowMarkerId(): any;
177
- textStyle(): any;
176
+ onPathTextStyle(): any;
178
177
  }, {
179
178
  onLineClick(e: any): void;
180
179
  }, import('vue/types/v3-component-options').ComponentOptionsMixin, import('vue/types/v3-component-options').ComponentOptionsMixin, {}, string, Readonly<import('vue').ExtractPropTypes<string[]>>, {
@@ -5,10 +5,13 @@ export declare const newNodeTemplate: {
5
5
  y: number;
6
6
  text: string;
7
7
  };
8
- export declare const json2Node: (originData: JsonNode, graphOptions?: RGOptions) => RGNode;
8
+ export declare const json2Node: (originData: JsonNode, graphOptions?: RGOptions, nodesSizeMap: Map<string, [
9
+ number,
10
+ number
11
+ ]>) => RGNode;
9
12
  export declare const transNodeToJson: (node: RGNode) => JsonNode | undefined;
10
13
  declare const _default: {
11
- json2Node: (originData: JsonNode, graphOptions?: Partial<import('../../types').RGOptionsInited> | undefined) => RGNode;
14
+ json2Node: (originData: JsonNode, graphOptions?: Partial<import('../../types').RGOptionsInited> | undefined, nodesSizeMap: Map<string, [number, number]>) => RGNode;
12
15
  transNodeToJson: (node: RGNode) => JsonNode | undefined;
13
16
  };
14
17
  export default _default;
@@ -1,4 +1,4 @@
1
- import { RGFakeLine, RGLine } from '../../types';
1
+ import { RGFakeLine, RGLine, RGLink, RGNode } from '../../types';
2
2
  import { RelationGraphWith2Data } from './RelationGraphWith2Data';
3
3
  /**
4
4
  * The instance class of the relation-graph component, providing read-only API methods based on data
@@ -15,7 +15,7 @@ export declare class RelationGraphWith2Data1Getter extends RelationGraphWith2Dat
15
15
  * @param nodeId
16
16
  * @return RGNode | undefined
17
17
  */
18
- getNodeById(nodeId: string): import('../../types').RGNode | undefined;
18
+ getNodeById(nodeId: string): RGNode | undefined;
19
19
  /**
20
20
  * Get line by lineId
21
21
  * @param lineId
@@ -27,13 +27,13 @@ export declare class RelationGraphWith2Data1Getter extends RelationGraphWith2Dat
27
27
  * @param lineId
28
28
  * @return RGLink | undefined
29
29
  */
30
- getLinkByLineId(lineId: string): import('../../types').RGLink | undefined;
30
+ getLinkByLineId(lineId: string): RGLink | undefined;
31
31
  /**
32
32
  * Get link by line
33
33
  * @param line
34
34
  * @return RGLink | undefined
35
35
  */
36
- getLinkByLine(line: RGLine): import('../../types').RGLink | undefined;
36
+ getLinkByLine(line: RGLine): RGLink | undefined;
37
37
  /**
38
38
  * Get all lines
39
39
  * @return RGLine[]
@@ -63,12 +63,19 @@ export declare class RelationGraphWith2Data1Getter extends RelationGraphWith2Dat
63
63
  * Get all nodes
64
64
  * @return RGNode[]
65
65
  */
66
- getNodes(): import('../../types').RGNode[];
66
+ getNodes(): RGNode[];
67
67
  /**
68
68
  * Get all links
69
69
  * @return RGLink[]
70
70
  */
71
- getLinks(): import('../../types').RGLink[];
71
+ getLinks(): RGLink[];
72
+ /**
73
+ * Get all links, Inlcuding fakeLine links
74
+ * @return RGLink[]
75
+ */
76
+ protected _getAllLinks(): RGLink[];
77
+ private getNodeByTargetId;
78
+ protected _getFakeLineLinks(): RGLink[];
72
79
  /**
73
80
  * Get all connect targets
74
81
  * @return RGLineTarget[]
@@ -55,8 +55,13 @@ export declare class RelationGraphWith2Data2Analysis extends RelationGraphWith2D
55
55
  * getNodeRelatedNodes(X) will return [A,B,C,F,M]
56
56
  * ```
57
57
  * @param node
58
+ * @param options
59
+ * @return RGNode[]
58
60
  */
59
- getNodeRelatedNodes(node: RGNode): RGNode[];
61
+ getNodeRelatedNodes(node: RGNode, options?: {
62
+ incoming: boolean;
63
+ outgoing: boolean;
64
+ }): RGNode[];
60
65
  /**
61
66
  * Get all nodes that have an incoming relationship to the given node
62
67
  * - e.g.
@@ -219,6 +219,8 @@ export declare class RelationGraphWith2Data3Update extends RelationGraphWith2Dat
219
219
  * @param lines_collect All expanded lines will be stored here
220
220
  */
221
221
  flatNodeData(orign_nodes: JsonNode[], parentNode: JsonNode | null, nodes_collect: JsonNode[], lines_collect: JsonLine[]): void;
222
+ private _nodesElSizeMap;
223
+ private backupNodesElSize;
222
224
  /**
223
225
  * @inner
224
226
  * @param jsonData
@@ -98,9 +98,12 @@ export declare class RelationGraphWith4Line extends RelationGraphWith3Options2AP
98
98
  * @return Returns an object containing text content and CSS styles
99
99
  *
100
100
  */
101
- generateLineTextStyle4TextPath(lineConfig: RGGenerateLineConfig): {
101
+ generateLineTextStyle4TextOnPath(lineConfig: RGGenerateLineConfig): {
102
102
  text: string;
103
- textOffset: string;
103
+ textOffset: {
104
+ x: number;
105
+ y: number;
106
+ };
104
107
  textAnchor: string;
105
108
  onPathStartOffset: string;
106
109
  textRotate: number;
@@ -1,4 +1,4 @@
1
- import { CreatingLinePlotOptions, CreatingNodePlotOptions, RGLine, RGLineConnectEventHandler, RGLineTarget, RGLink, RGNode, RGPosition, RGUserEvent, RGCoordinate, JsonLine } from '../../types';
1
+ import { CreatingLinePlotOptions, CreatingNodePlotOptions, RGLine, RGLineConnectEventHandler, RGLineTarget, RGNode, RGPosition, RGUserEvent, RGCoordinate, JsonLine } from '../../types';
2
2
  import { RelationGraphWith6Layout } from './RelationGraphWith6Layout';
3
3
  /**
4
4
  * The relation-graph component UI and graphInstance event bus handle user interaction events.
@@ -45,10 +45,9 @@ export declare class RelationGraphWith7Event extends RelationGraphWith6Layout {
45
45
  * Triggered when the user clicks on a line
46
46
  * - Triggered when the user clicks on a line path or line text
47
47
  * @param line The clicked line object
48
- * @param link The link object that the line belongs to
49
48
  * @param e MouseDown or TouchStart event
50
49
  */
51
- onLineClick(line: RGLine, link: RGLink, e: RGUserEvent): void;
50
+ onLineClick(line: RGLine, e: RGUserEvent): void;
52
51
  /**
53
52
  * Triggered when the node's expand/collapse button is clicked.
54
53
  * - This method will expand or collapse all descendant nodes of the node.
@@ -313,8 +313,9 @@ export type JsonLine = {
313
313
  showEndArrow?: boolean
314
314
  startMarkerId?: string
315
315
  endMarkerId?: string
316
- useTextPath?: boolean
316
+ useTextOnPath?: boolean
317
317
  onPathStartOffset?: string
318
+ placeText?: 'start'|'center'|'end'
318
319
  textAnchor?: string
319
320
  lineDirection?: string
320
321
  polyLineStartDistance?: number
@@ -503,11 +504,13 @@ export type RGForceLayoutOptions = RGLayoutOptionsCore & {
503
504
  /**
504
505
  * Center layout options type
505
506
  * - distance_coefficient: Coefficient for calculating the ideal distance between nodes, default is 1. The larger this value, the greater the ideal distance between nodes, and the more dispersed the layout will be.
507
+ * - disableAsForceLayout: CenterLayout extends ForceLayout. If you want to use CenterLayout as a pure center layout without force-directed layout capabilities, you can set this option to true to disable the force-directed layout features.
506
508
  * - levelDistance: Array of distances between levels, default is []. You can set the distance between different levels of nodes in the tree structure. For example, [100, 200, 300] means the distance between level 0 and level 1 is 100, the distance between level 1 and level 2 is 200, and the distance between level 2 and level 3 is 300. If the array length is less than the number of levels, the last value will be used for the remaining levels.
507
509
  */
508
510
  export type RGCenterLayoutOptions = RGForceLayoutOptions & {
509
511
  distance_coefficient?: number
510
512
  levelDistance?: number[]
513
+ disableAsForceLayout?: boolean;
511
514
  };
512
515
  /**
513
516
  * Tree layout options type
@@ -522,7 +525,7 @@ export type RGCenterLayoutOptions = RGForceLayoutOptions & {
522
525
  * - alignParentItemsY: Alignment of parent nodes in the Y direction, 'start' means top-aligned, 'center' means center-aligned, and 'end' means bottom-aligned. Default is 'center'.
523
526
  */
524
527
  export type RGTreeLayoutOptions = RGLayoutOptionsCore & {
525
- from: string
528
+ from?: string
526
529
  treeNodeGapH?: number
527
530
  treeNodeGapV?: number
528
531
  levelGaps?: number[]
@@ -610,7 +613,7 @@ export type RGOptionsInited = {
610
613
  defaultLineJunctionOffset: number,
611
614
  // placeSingleNode: boolean
612
615
  placeOtherNodes: boolean
613
- lineUseTextPath: boolean
616
+ defaultLineTextOnPath: boolean
614
617
  lineTextMaxLength: number
615
618
  multiLineDistance: number
616
619
  checkedNodeId: string // private
@@ -757,7 +760,7 @@ export interface RGNodeSlotProps {
757
760
  export interface RGLinePeelProps {
758
761
  line: RGLine | RGFakeLine
759
762
  checked?: boolean
760
- lineUseTextPath?: boolean
763
+ defaultLineTextOnPath?: boolean
761
764
  graphInstanceId?: string
762
765
  }
763
766
 
@@ -765,14 +768,14 @@ export interface RGLinePeelProps {
765
768
  * Custom line slot component Props type
766
769
  * @param lineConfig Configuration parameters for the line, which include information such as the start and end objects, line objects, etc., used for line objects, and global default configurations for rendering lines.
767
770
  * @param checked Whether the current line is selected
768
- * @param lineUseTextPath Whether the line uses textPath to typeset text, allowing the text to be arranged along the line path
771
+ * @param defaultLineTextOnPath Whether the line uses textPath to typeset text, allowing the text to be arranged along the line path
769
772
  * @param graphInstanceId The ID of the current graph instance, used for creating some unique identifiers, etc. (for example, you can display two relation-graph components with the same data on one page to prevent their ids from conflicting)
770
773
  *
771
774
  */
772
775
  export interface RGLineSlotProps {
773
776
  lineConfig: RGGenerateLineConfig
774
777
  checked?: boolean
775
- lineUseTextPath?: boolean
778
+ defaultLineTextOnPath?: boolean
776
779
  graphInstanceId?: string
777
780
  }
778
781
 
@@ -780,7 +783,7 @@ export interface RGLineSlotProps {
780
783
  * Props type for RGLinePath component
781
784
  * @param lineConfig Configuration parameters for the line, which include information such as the start and end objects, line objects, etc., used for line objects, and global default configurations for rendering lines.
782
785
  * @param linePathInfo The path information of the line, including path data, text position, etc., used for rendering the line path
783
- * @param lineUseTextPath Whether the line uses textPath to typeset text, allowing the text to be arranged along the line path
786
+ * @param defaultLineTextOnPath Whether the line uses textPath to typeset text, allowing the text to be arranged along the line path
784
787
  * @param checked Whether the current line is selected
785
788
  * @param graphInstanceId The ID of the current graph instance, used for creating some unique identifiers, etc. (for example, you can display two relation-graph components with the same data on one page to prevent their ids from conflicting)
786
789
  *
@@ -788,7 +791,7 @@ export interface RGLineSlotProps {
788
791
  export interface RGLinePathProps {
789
792
  lineConfig: RGGenerateLineConfig
790
793
  linePathInfo: RGLinePathInfo
791
- lineUseTextPath?: boolean
794
+ useTextOnPath?: boolean
792
795
  checked?: boolean
793
796
  graphInstanceId?: string
794
797
  }