@logicflow/core 1.1.24 → 1.1.27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logicflow/core",
3
- "version": "1.1.24",
3
+ "version": "1.1.27",
4
4
  "description": "LogicFlow core, to quickly build flowchart editor",
5
5
  "main": "dist/entry.js",
6
6
  "module": "dist/logic-flow.js",
@@ -53,6 +53,10 @@ declare class GraphModel {
53
53
  * @see todo docs link
54
54
  */
55
55
  idGenerator: (type?: string) => string;
56
+ /**
57
+ * 节点间连线、连线变更时的边的生成规则
58
+ */
59
+ edgeGenerator: Definition['edgeGenerator'];
56
60
  /**
57
61
  * 节点移动规则判断
58
62
  * 在节点移动的时候,会出发此数组中的所有规则判断
@@ -185,6 +185,7 @@ export default class BaseNodeModel implements IBaseNodeModel {
185
185
  getAnchorInfo(anchorId: string): PointAnchor;
186
186
  addNodeMoveRules(fn: NodeMoveRule): void;
187
187
  move(deltaX: any, deltaY: any, isIgnoreRule?: boolean): boolean;
188
+ getMoveDistance(deltaX: number, deltaY: number, isIgnoreRule?: boolean): [number, number];
188
189
  moveTo(x: any, y: any, isIgnoreRule?: boolean): boolean;
189
190
  moveText(deltaX: any, deltaY: any): void;
190
191
  updateText(value: string): void;
@@ -97,6 +97,17 @@ export declare type Definition = {
97
97
  * AnimationConfig: 配置部分动画开启
98
98
  */
99
99
  animation?: boolean | Partial<AnimationConfig>;
100
+ /**
101
+ * 节点间连线、连线变更时的边的生成规则
102
+ * @param sourceNode 起始节点数据
103
+ * @param targetNode 终止节点数据
104
+ * @param currentEdge 当前边的数据, 仅移动已有边的时候有值
105
+ *
106
+ * @return undefined: 使用默认边
107
+ * string: 自定义边类型
108
+ * any: 自定义边及其他数据
109
+ */
110
+ edgeGenerator?: (sourceNode: any, targetNode: any, currentEdge?: any) => string | any | undefined;
100
111
  [key: string]: any;
101
112
  } & EditConfigInterface;
102
113
  export interface GuardsTypes {
@@ -192,6 +203,17 @@ export declare function get(options: Definition): {
192
203
  * AnimationConfig: 配置部分动画开启
193
204
  */
194
205
  animation?: boolean | Partial<AnimationConfig>;
206
+ /**
207
+ * 节点间连线、连线变更时的边的生成规则
208
+ * @param sourceNode 起始节点数据
209
+ * @param targetNode 终止节点数据
210
+ * @param currentEdge 当前边的数据, 仅移动已有边的时候有值
211
+ *
212
+ * @return undefined: 使用默认边
213
+ * string: 自定义边类型
214
+ * any: 自定义边及其他数据
215
+ */
216
+ edgeGenerator?: (sourceNode: any, targetNode: any, currentEdge?: any) => any;
195
217
  } & EditConfigInterface;
196
218
  export declare const defaults: {
197
219
  background: boolean;
@@ -99,4 +99,10 @@ declare type Position = {
99
99
  y: number;
100
100
  };
101
101
  export declare const twoPointDistance: (source: Position, target: Position) => number;
102
+ /**
103
+ * 包装边生成函数
104
+ * @param graphModel graph model
105
+ * @param generator 用户自定义的边生成函数
106
+ */
107
+ export declare function createEdgeGenerator(graphModel: any, generator?: Function): (sourceNode: any, targetNode: any, currentEdge?: any) => any;
102
108
  export {};
@@ -5,6 +5,8 @@ export declare type ArrowStyle = {
5
5
  fill?: string;
6
6
  strokeWidth?: number;
7
7
  offset: number;
8
+ refX?: number;
9
+ refY?: number;
8
10
  verticalLength: number;
9
11
  };
10
12
  declare type ArrowAttributesType = {