@logicflow/core 1.1.23 → 1.1.26

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.23",
3
+ "version": "1.1.26",
4
4
  "description": "LogicFlow core, to quickly build flowchart editor",
5
5
  "main": "dist/entry.js",
6
6
  "module": "dist/logic-flow.js",
@@ -338,7 +338,7 @@ export default class LogicFlow {
338
338
  * @param leftTopPoint 区域左上角坐标, dom层坐标
339
339
  * @param rightBottomPoint 区域右下角坐标,dom层坐标
340
340
  */
341
- getAreaElement(leftTopPoint: PointTuple, rightBottomPoint: PointTuple, wholeEdge?: boolean, wholeNode?: boolean): any[];
341
+ getAreaElement(leftTopPoint: PointTuple, rightBottomPoint: PointTuple, wholeEdge?: boolean, wholeNode?: boolean, ignoreHideElement?: boolean): any[];
342
342
  /**
343
343
  * 获取选中的元素数据
344
344
  * @param isIgnoreCheck 是否包括sourceNode和targetNode没有被选中的边,默认包括。
@@ -53,7 +53,14 @@ interface IBaseModel {
53
53
  * 元素是否被选中
54
54
  */
55
55
  isSelected: boolean;
56
+ /**
57
+ * 节点是否显示
58
+ */
56
59
  visible: boolean;
60
+ /**
61
+ * 节点是否可以通过getGraphData获取
62
+ */
63
+ virtual: boolean;
57
64
  /**
58
65
  * 元素堆叠是层级,默认情况下节点zIndex值为1,边zIndex为0。
59
66
  * todo:写完善
@@ -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
  * 在节点移动的时候,会出发此数组中的所有规则判断
@@ -142,8 +146,9 @@ declare class GraphModel {
142
146
  * @param rightBottomPoint 表示区域右下角的点
143
147
  * @param wholeEdge 是否要整个边都在区域内部
144
148
  * @param wholeNode 是否要整个节点都在区域内部
149
+ * @param ignoreHideElement 是否忽略隐藏的节点
145
150
  */
146
- getAreaElement(leftTopPoint: PointTuple, rightBottomPoint: PointTuple, wholeEdge?: boolean, wholeNode?: boolean): any[];
151
+ getAreaElement(leftTopPoint: PointTuple, rightBottomPoint: PointTuple, wholeEdge?: boolean, wholeNode?: boolean, ignoreHideElement?: boolean): any[];
147
152
  /**
148
153
  * 获取指定类型元素对应的Model
149
154
  */
@@ -25,6 +25,7 @@ declare class BaseEdgeModel implements IBaseModel {
25
25
  isHitable: boolean;
26
26
  draggable: boolean;
27
27
  visible: boolean;
28
+ virtual: boolean;
28
29
  isAnimation: boolean;
29
30
  graphModel: GraphModel;
30
31
  zIndex: number;
@@ -45,6 +45,7 @@ export default class BaseNodeModel implements IBaseNodeModel {
45
45
  isHitable: boolean;
46
46
  draggable: boolean;
47
47
  visible: boolean;
48
+ virtual: boolean;
48
49
  graphModel: GraphModel;
49
50
  zIndex: number;
50
51
  state: number;
@@ -183,8 +184,9 @@ export default class BaseNodeModel implements IBaseNodeModel {
183
184
  get anchors(): PointAnchor[];
184
185
  getAnchorInfo(anchorId: string): PointAnchor;
185
186
  addNodeMoveRules(fn: NodeMoveRule): void;
186
- move(deltaX: any, deltaY: any, isignoreRule?: boolean): boolean;
187
- moveTo(x: any, y: any, isignoreRule?: boolean): boolean;
187
+ move(deltaX: any, deltaY: any, isIgnoreRule?: boolean): boolean;
188
+ getMoveDistance(deltaX: number, deltaY: number, isIgnoreRule?: boolean): [number, number];
189
+ moveTo(x: any, y: any, isIgnoreRule?: boolean): boolean;
188
190
  moveText(deltaX: any, deltaY: any): void;
189
191
  updateText(value: string): void;
190
192
  setSelected(flag?: boolean): 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 {};