@logicflow/core 1.0.0-alpha.5 → 1.0.0-alpha.6

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 (52) hide show
  1. package/dist/logic-flow.js +3 -3
  2. package/dist/style/index.css +1 -1
  3. package/package.json +1 -1
  4. package/types/LogicFlow.d.ts +341 -137
  5. package/types/constant/DefaultTheme.d.ts +271 -171
  6. package/types/constant/constant.d.ts +7 -1
  7. package/types/keyboard/index.d.ts +1 -5
  8. package/types/model/BaseModel.d.ts +59 -0
  9. package/types/model/EditConfigModel.d.ts +6 -16
  10. package/types/model/GraphModel.d.ts +264 -58
  11. package/types/model/SnaplineModel.d.ts +6 -2
  12. package/types/model/TransformModel.d.ts +8 -2
  13. package/types/model/edge/BaseEdgeModel.d.ts +36 -12
  14. package/types/model/edge/BezierEdgeModel.d.ts +9 -0
  15. package/types/model/edge/LineEdgeModel.d.ts +6 -0
  16. package/types/model/edge/PolylineEdgeModel.d.ts +7 -0
  17. package/types/model/node/BaseNodeModel.d.ts +90 -29
  18. package/types/model/node/CircleNodeModel.d.ts +12 -4
  19. package/types/model/node/DiamondNodeModel.d.ts +7 -4
  20. package/types/model/node/EllipseNodeModel.d.ts +6 -2
  21. package/types/model/node/HtmlNodeModel.d.ts +0 -2
  22. package/types/model/node/PolygonNodeModel.d.ts +11 -2
  23. package/types/model/node/RectNodeModel.d.ts +9 -2
  24. package/types/model/node/TextNodeModel.d.ts +8 -4
  25. package/types/options.d.ts +84 -10
  26. package/types/type/index.d.ts +50 -37
  27. package/types/util/edge.d.ts +3 -3
  28. package/types/util/graph.d.ts +1 -1
  29. package/types/util/node.d.ts +1 -1
  30. package/types/util/theme.d.ts +2 -173
  31. package/types/view/Anchor.d.ts +0 -2
  32. package/types/view/Graph.d.ts +1 -3
  33. package/types/view/basic-shape/Path.d.ts +1 -9
  34. package/types/view/basic-shape/Rect.d.ts +1 -5
  35. package/types/view/behavior/DnD.d.ts +0 -4
  36. package/types/view/edge/AdjustPoint.d.ts +1 -3
  37. package/types/view/edge/Arrow.d.ts +3 -3
  38. package/types/view/edge/BaseEdge.d.ts +2 -20
  39. package/types/view/edge/BezierEdge.d.ts +0 -12
  40. package/types/view/edge/LineEdge.d.ts +0 -13
  41. package/types/view/edge/PolylineEdge.d.ts +0 -12
  42. package/types/view/node/BaseNode.d.ts +1 -36
  43. package/types/view/node/CircleNode.d.ts +0 -37
  44. package/types/view/node/DiamondNode.d.ts +0 -37
  45. package/types/view/node/EllipseNode.d.ts +0 -26
  46. package/types/view/node/HtmlNode.d.ts +20 -0
  47. package/types/view/node/PolygonNode.d.ts +1 -19
  48. package/types/view/node/RectNode.d.ts +0 -37
  49. package/types/view/node/TextNode.d.ts +1 -0
  50. package/types/view/overlay/BackgroundOverlay.d.ts +18 -29
  51. package/types/view/overlay/CanvasOverlay.d.ts +0 -2
  52. package/types/view/overlay/OutlineOverlay.d.ts +1 -1
@@ -1,5 +1,6 @@
1
- import { ElementState, ModelType, ElementType } from '../../constant/constant';
2
- import { AdditionData, NodeData, NodeAttribute, NodeConfig, NodeMoveRule, Bounds, Point, AnchorConfig } from '../../type';
1
+ import { OutlineTheme } from '../../constant/DefaultTheme';
2
+ import { ModelType, ElementType } from '../../constant/constant';
3
+ import { AdditionData, NodeData, NodeConfig, NodeMoveRule, Bounds, AnchorConfig, PointAnchor, AnchorsOffsetItem, ShapeStyleAttribute } from '../../type';
3
4
  import GraphModel from '../GraphModel';
4
5
  import { IBaseModel } from '../BaseModel';
5
6
  export declare type ConnectRule = {
@@ -10,8 +11,14 @@ export declare type ConnectRuleResult = {
10
11
  isAllPass: boolean;
11
12
  msg?: string;
12
13
  };
14
+ interface IBaseNodeModel extends IBaseModel {
15
+ /**
16
+ * model基础类型,固定为node
17
+ */
18
+ readonly BaseType: ElementType.NODE;
19
+ }
13
20
  export { BaseNodeModel };
14
- export default class BaseNodeModel implements IBaseModel {
21
+ export default class BaseNodeModel implements IBaseNodeModel {
15
22
  id: string;
16
23
  readonly BaseType = ElementType.NODE;
17
24
  modelType: ModelType;
@@ -33,23 +40,11 @@ export default class BaseNodeModel implements IBaseModel {
33
40
  private _height;
34
41
  get height(): number;
35
42
  set height(value: number);
36
- fill: string;
37
- fillOpacity: number;
38
- strokeWidth: number;
39
- stroke: string;
40
- strokeOpacity: number;
41
- opacity: number;
42
- outlineColor: string;
43
- hideOutline: boolean;
44
- hoverOutlineColor: string;
45
- outlineStrokeDashArray: string;
46
- hoverOutlineStrokeDashArray: string;
47
43
  isSelected: boolean;
48
44
  isHovered: boolean;
49
- isDragging: boolean;
50
45
  isHitable: boolean;
51
46
  zIndex: number;
52
- anchorsOffset: any[];
47
+ anchorsOffset: AnchorsOffsetItem[];
53
48
  state: number;
54
49
  text: {
55
50
  value: string;
@@ -59,18 +54,78 @@ export default class BaseNodeModel implements IBaseModel {
59
54
  editable: boolean;
60
55
  };
61
56
  draggable: boolean;
62
- constructor(data: NodeConfig, graphModel: GraphModel, type: any);
63
- initNodeData(data: any): void;
64
- createId(): any;
65
- formatText(data: any): void;
57
+ constructor(data: NodeConfig, graphModel: GraphModel);
58
+ /**
59
+ * 初始化节点数据,不建议重写
60
+ * 可以重写setAttributes来实现修改初始化功能
61
+ * initNodeData和setAttributes的区别在于
62
+ * initNodeData需要
63
+ */
64
+ protected initNodeData(data: any): void;
65
+ /**
66
+ * @overridable 支持重新
67
+ * @returns string
68
+ */
69
+ createId(): string;
70
+ /**
71
+ * 初始化文本属性,对
72
+ */
73
+ private formatText;
74
+ /**
75
+ * 设置model初始化属性
76
+ * 例如设置节点的宽度
77
+ * @example
78
+ *
79
+ * setAttributes () {
80
+ * this.width = 300
81
+ * this.height = 200
82
+ * }
83
+ *
84
+ * @overridable 支持重写
85
+ */
66
86
  setAttributes(): void;
67
87
  /**
68
- * 保存时获取的数据
88
+ * 获取被保存时返回的数据
89
+ * @overridable 支持重写
90
+ * @returns NodeData
69
91
  */
70
92
  getData(): NodeData;
71
93
  getProperties(): Record<string, any>;
72
94
  /**
73
- * 在连线的时候,是否允许这个节点为source节点,连线到target节点。
95
+ * @overridable 支持重写
96
+ * 获取当前节点样式
97
+ * @returns 自定义节点样式
98
+ */
99
+ getNodeStyle(): ShapeStyleAttribute;
100
+ getTextStyle(): {
101
+ [x: string]: any;
102
+ overflowMode?: string;
103
+ background?: import("../../constant/DefaultTheme").RectTheme;
104
+ color?: string;
105
+ fontSize?: number;
106
+ fill?: string;
107
+ stroke?: string;
108
+ strokeWidth?: number;
109
+ };
110
+ /**
111
+ * 获取节点锚点样式
112
+ * @returns 自定义样式
113
+ */
114
+ getAnchorStyle(): Record<string, any>;
115
+ getAnchorLineStyle(): {
116
+ [x: string]: any;
117
+ fill?: string;
118
+ stroke?: string;
119
+ strokeWidth?: number;
120
+ };
121
+ /**
122
+ * @overridable 支持重写
123
+ * 获取outline样式,重写可以定义此类型节点outline样式, 默认使用主题样式
124
+ * @returns 自定义outline样式
125
+ */
126
+ getOutlineStyle(): OutlineTheme;
127
+ /**
128
+ * 在边的时候,是否允许这个节点为source节点,边到target节点。
74
129
  */
75
130
  isAllowConnectedAsSource(target: BaseNodeModel, soureAnchor: AnchorConfig, targetAnchor: AnchorConfig): ConnectRuleResult | Boolean;
76
131
  /**
@@ -78,7 +133,7 @@ export default class BaseNodeModel implements IBaseModel {
78
133
  */
79
134
  getConnectedSourceRules(): ConnectRule[];
80
135
  /**
81
- * 在连线的时候,是否允许这个节点未target节点
136
+ * 在边的时候,是否允许这个节点未target节点
82
137
  */
83
138
  isAllowConnectedAsTarget(source: BaseNodeModel, soureAnchor: AnchorConfig, targetAnchor: AnchorConfig): ConnectRuleResult | Boolean;
84
139
  /**
@@ -86,12 +141,20 @@ export default class BaseNodeModel implements IBaseModel {
86
141
  */
87
142
  isAllowMoveNode(deltaX: any, deltaY: any): boolean;
88
143
  getConnectedTargetRules(): ConnectRule[];
89
- getAnchorsByOffset(): Point[];
90
144
  /**
91
- * 获取节点区域
145
+ * @overridable 子类重写此方法设置锚点
146
+ * @returns Point[] 锚点坐标构成的数组
147
+ */
148
+ getAnchorsByOffset(): PointAnchor[];
149
+ /**
150
+ * 获取节点默认情况下的锚点
151
+ */
152
+ getDetaultAnchor(): PointAnchor[];
153
+ /**
154
+ * 获取节点BBox
92
155
  */
93
156
  getBounds(): Bounds;
94
- get anchors(): Point[];
157
+ get anchors(): PointAnchor[];
95
158
  addNodeMoveRules(fn: NodeMoveRule): void;
96
159
  move(deltaX: any, deltaY: any, isignoreRule?: boolean): void;
97
160
  moveTo(x: any, y: any, isignoreRule?: boolean): void;
@@ -100,12 +163,10 @@ export default class BaseNodeModel implements IBaseModel {
100
163
  setSelected(flag?: boolean): void;
101
164
  setHovered(flag?: boolean): void;
102
165
  setHitable(flag?: boolean): void;
103
- setElementState(state: ElementState, additionStateData?: AdditionData): void;
166
+ setElementState(state: number, additionStateData?: AdditionData): void;
104
167
  updateStroke(color: any): void;
105
- updateData(nodeAttribute: NodeAttribute): void;
106
168
  setProperty(key: any, val: any): void;
107
169
  setProperties(properties: any): void;
108
- setStyleFromTheme(type: any, graphModel: any): void;
109
170
  setZIndex(zindex?: number): void;
110
171
  updateAttributes(attributes: any): void;
111
172
  }
@@ -1,14 +1,22 @@
1
- import { Point } from '../../type';
2
1
  import BaseNodeModel from './BaseNodeModel';
3
2
  import { ModelType } from '../../constant/constant';
4
- import GraphModel from '../GraphModel';
5
3
  declare class CircleNodeModel extends BaseNodeModel {
6
4
  modelType: ModelType;
7
5
  r: number;
8
- constructor(data: any, graphModel: GraphModel);
9
6
  get width(): number;
10
7
  get height(): number;
11
- get anchors(): Point[];
8
+ getNodeStyle(): {
9
+ [x: string]: any;
10
+ r?: number;
11
+ fill?: string;
12
+ stroke?: string;
13
+ strokeWidth?: number;
14
+ };
15
+ getDetaultAnchor(): {
16
+ x: number;
17
+ y: number;
18
+ id: string;
19
+ }[];
12
20
  }
13
21
  export { CircleNodeModel };
14
22
  export default CircleNodeModel;
@@ -1,13 +1,16 @@
1
- import { NodeData, Point, PointTuple } from '../../type';
1
+ import { Point, PointTuple } from '../../type';
2
2
  import BaseNodeModel from './BaseNodeModel';
3
3
  import { ModelType } from '../../constant/constant';
4
- import GraphModel from '../GraphModel';
5
4
  declare class DiamondNodeModel extends BaseNodeModel {
6
5
  modelType: ModelType;
7
6
  rx: number;
8
7
  ry: number;
9
- constructor(data: any, graphModel: GraphModel);
10
- getData(): NodeData;
8
+ getNodeStyle(): {
9
+ [x: string]: any;
10
+ fill?: string;
11
+ stroke?: string;
12
+ strokeWidth?: number;
13
+ };
11
14
  get points(): PointTuple[];
12
15
  get pointsPosition(): Point[];
13
16
  get width(): number;
@@ -1,12 +1,16 @@
1
1
  import { Point } from '../../type';
2
2
  import BaseNodeModel from './BaseNodeModel';
3
3
  import { ModelType } from '../../constant/constant';
4
- import GraphModel from '../GraphModel';
5
4
  declare class EllipseNodeModel extends BaseNodeModel {
6
5
  modelType: ModelType;
7
6
  rx: number;
8
7
  ry: number;
9
- constructor(data: any, graphModel: GraphModel);
8
+ getNodeStyle(): {
9
+ [x: string]: any;
10
+ fill?: string;
11
+ stroke?: string;
12
+ strokeWidth?: number;
13
+ };
10
14
  get width(): number;
11
15
  get height(): number;
12
16
  get anchors(): Point[];
@@ -1,10 +1,8 @@
1
1
  import { Point } from '../../type';
2
2
  import BaseNodeModel from './BaseNodeModel';
3
3
  import { ModelType } from '../../constant/constant';
4
- import GraphModel from '../GraphModel';
5
4
  declare class HtmlNodeModel extends BaseNodeModel {
6
5
  modelType: ModelType;
7
- constructor(data: any, graphModel: GraphModel);
8
6
  get anchors(): Point[];
9
7
  }
10
8
  export { HtmlNodeModel };
@@ -1,11 +1,20 @@
1
1
  import { Point, PointTuple } from '../../type';
2
2
  import BaseNodeModel from './BaseNodeModel';
3
3
  import { ModelType } from '../../constant/constant';
4
- import GraphModel from '../GraphModel';
5
4
  declare class PolygonNodeModel extends BaseNodeModel {
6
5
  modelType: ModelType;
7
6
  points: PointTuple[];
8
- constructor(data: any, graphModel: GraphModel);
7
+ getNodeStyle(): {
8
+ [x: string]: any;
9
+ fill?: string;
10
+ stroke?: string;
11
+ strokeWidth?: number;
12
+ };
13
+ /**
14
+ * 由于大多数情况下,我们初始化拿到的多边形坐标都是基于原点的(例如绘图工具到处的svg)。
15
+ * 在logicflow中对多边形进行移动,我们不需要去更新points,
16
+ * 而是去更新多边形中心点即可。
17
+ */
9
18
  get pointsPosition(): Point[];
10
19
  get width(): number;
11
20
  get height(): number;
@@ -1,12 +1,19 @@
1
1
  import { Point } from '../../type';
2
2
  import BaseNodeModel from './BaseNodeModel';
3
3
  import { ModelType } from '../../constant/constant';
4
- import GraphModel from '../GraphModel';
5
4
  declare class RectNodeModel extends BaseNodeModel {
6
5
  modelType: ModelType;
7
6
  radius: number;
8
- constructor(data: any, graphModel: GraphModel);
9
7
  get anchors(): Point[];
8
+ getNodeStyle(): {
9
+ [x: string]: any;
10
+ width?: number;
11
+ height?: number;
12
+ radius?: number;
13
+ fill?: string;
14
+ stroke?: string;
15
+ strokeWidth?: number;
16
+ };
10
17
  }
11
18
  export { RectNodeModel };
12
19
  export default RectNodeModel;
@@ -1,12 +1,16 @@
1
1
  import BaseNodeModel from './BaseNodeModel';
2
2
  import { ModelType } from '../../constant/constant';
3
- import GraphModel from '../GraphModel';
4
3
  declare class TextNodeModel extends BaseNodeModel {
5
4
  modelType: ModelType;
6
5
  fontSize: number;
7
- fontFamily: string;
8
- fontWeight: string;
9
- constructor(data: any, graphModel: GraphModel);
6
+ getNodeStyle(): {
7
+ [x: string]: any;
8
+ color?: string;
9
+ fontSize?: number;
10
+ fill?: string;
11
+ stroke?: string;
12
+ strokeWidth?: number;
13
+ };
10
14
  get width(): number;
11
15
  get height(): number;
12
16
  }
@@ -1,21 +1,22 @@
1
- import { DndOptions } from './view/behavior/DnD';
2
1
  import { GridOptions } from './view/overlay/Grid';
3
2
  import { BackgroundConfig } from './view/overlay/BackgroundOverlay';
4
- import { Style, NodeData, EdgeData, GraphConfigData } from './type';
3
+ import { NodeData, EdgeData, GraphConfigData } from './type';
5
4
  import { KeyboardDef } from './keyboard';
6
- import { EditConfigInterface } from './model/EditConfigModel';
5
+ import { EditConfigInterface } from './model/editConfigModel';
6
+ import { Theme } from './constant/DefaultTheme';
7
7
  export declare type EdgeType = 'line' | 'polyline' | 'bezier' | any;
8
8
  declare type DefaultOverlapMode = 0;
9
9
  declare type IncreaseOverlapMode = 1;
10
10
  /**
11
11
  * 元素重叠处理方式
12
- * 0:表示节点在上,连线在下,点击元素时选择元素显示在最顶部。
12
+ * 0:表示节点在上,边在下,点击元素时选择元素显示在最顶部。
13
13
  * 1:表示安装元素创建顺序排序,点击元素也不会将其置顶。要置顶需要调用置顶API。
14
14
  */
15
15
  export declare type OverlapMode = DefaultOverlapMode | IncreaseOverlapMode;
16
16
  export declare type Definition = {
17
17
  /**
18
18
  * 画布初始化容器
19
+ * 注意,在不传入width和height的情况下,container元素本身应该存在高度和高度。
19
20
  */
20
21
  container: HTMLElement;
21
22
  /**
@@ -34,18 +35,53 @@ export declare type Definition = {
34
35
  * 网格
35
36
  */
36
37
  grid?: boolean | GridOptions;
38
+ /**
39
+ * 键盘快捷操作
40
+ */
37
41
  keyboard?: KeyboardDef;
38
- style?: Style;
39
- dndOptions?: DndOptions;
42
+ /**
43
+ * 主题配置
44
+ */
45
+ style?: Theme;
46
+ /**
47
+ * 禁止初始化的插件名称
48
+ */
40
49
  disabledPlugins?: string[];
50
+ /**
51
+ * 默认边类型
52
+ */
41
53
  edgeType?: EdgeType;
54
+ /**
55
+ * 是否开启对齐线,默认开启
56
+ */
42
57
  snapline?: boolean;
58
+ /**
59
+ * 是否开启历史记录功能,默认开启
60
+ */
43
61
  history?: boolean;
62
+ /**
63
+ * 是否开启局部渲染,默认不开启
64
+ */
44
65
  partial?: boolean;
66
+ /**
67
+ * 删除和克隆之前的判断函数
68
+ * todo: 目前不完善,仅支持同步
69
+ */
45
70
  guards?: GuardsTypes;
71
+ /**
72
+ * 是否不启用outline显示选中和hover效果
73
+ */
46
74
  hideOutline?: boolean;
75
+ /**
76
+ * 表示节点在上,边在下,点击元素时选择元素显示在最顶部。
77
+ * 表示安装元素创建顺序排序,点击元素也不会将其置顶。要置顶需要调用置顶API。
78
+ */
47
79
  overlapMode?: OverlapMode;
48
- idGenerator?: () => number | string;
80
+ /**
81
+ * 自定义创建节点、连线时生成id规则。
82
+ * @param type 节点、连线类型
83
+ */
84
+ idGenerator?: (type?: string) => string;
49
85
  /**
50
86
  * 禁止启用的内置工具
51
87
  * 有些场景下,需要自定义多选效果或者文本编辑效果,则需要禁用这些内置的工具
@@ -53,6 +89,7 @@ export declare type Definition = {
53
89
  * todo: 将multipleSelect放到插件中
54
90
  */
55
91
  disabledTools?: string[];
92
+ [key: string]: any;
56
93
  } & EditConfigInterface;
57
94
  export interface GuardsTypes {
58
95
  beforeClone?: (data: NodeData | GraphConfigData) => boolean;
@@ -64,8 +101,10 @@ export declare function get(options: Definition): {
64
101
  textEdit: boolean;
65
102
  disabledTools: any[];
66
103
  } & {
104
+ [key: string]: any;
67
105
  /**
68
106
  * 画布初始化容器
107
+ * 注意,在不传入width和height的情况下,container元素本身应该存在高度和高度。
69
108
  */
70
109
  container: HTMLElement;
71
110
  /**
@@ -84,18 +123,53 @@ export declare function get(options: Definition): {
84
123
  * 网格
85
124
  */
86
125
  grid?: boolean | GridOptions;
126
+ /**
127
+ * 键盘快捷操作
128
+ */
87
129
  keyboard?: KeyboardDef;
88
- style?: Style;
89
- dndOptions?: DndOptions;
130
+ /**
131
+ * 主题配置
132
+ */
133
+ style?: Theme;
134
+ /**
135
+ * 禁止初始化的插件名称
136
+ */
90
137
  disabledPlugins?: string[];
138
+ /**
139
+ * 默认边类型
140
+ */
91
141
  edgeType?: any;
142
+ /**
143
+ * 是否开启对齐线,默认开启
144
+ */
92
145
  snapline?: boolean;
146
+ /**
147
+ * 是否开启历史记录功能,默认开启
148
+ */
93
149
  history?: boolean;
150
+ /**
151
+ * 是否开启局部渲染,默认不开启
152
+ */
94
153
  partial?: boolean;
154
+ /**
155
+ * 删除和克隆之前的判断函数
156
+ * todo: 目前不完善,仅支持同步
157
+ */
95
158
  guards?: GuardsTypes;
159
+ /**
160
+ * 是否不启用outline显示选中和hover效果
161
+ */
96
162
  hideOutline?: boolean;
163
+ /**
164
+ * 表示节点在上,边在下,点击元素时选择元素显示在最顶部。
165
+ * 表示安装元素创建顺序排序,点击元素也不会将其置顶。要置顶需要调用置顶API。
166
+ */
97
167
  overlapMode?: OverlapMode;
98
- idGenerator?: () => string | number;
168
+ /**
169
+ * 自定义创建节点、连线时生成id规则。
170
+ * @param type 节点、连线类型
171
+ */
172
+ idGenerator?: (type?: string) => string;
99
173
  /**
100
174
  * 禁止启用的内置工具
101
175
  * 有些场景下,需要自定义多选效果或者文本编辑效果,则需要禁用这些内置的工具
@@ -23,12 +23,34 @@ import EllipseNodeModel from '../model/node/EllipseNodeModel';
23
23
  import HtmlNode from '../view/node/HtmlNode';
24
24
  import HtmlNodeModel from '../model/node/HtmlNodeModel';
25
25
  import * as Options from '../options';
26
+ import { CommonTheme, EdgeTextTheme } from '../constant/DefaultTheme';
26
27
  export declare type PointTuple = [number, number];
27
28
  export declare type Point = {
28
29
  x: number;
29
30
  y: number;
30
31
  [key: string]: unknown;
31
32
  };
33
+ /**
34
+ * 锚点坐标
35
+ * 为了方便计算
36
+ * 锚点的位置都是相对于节点中心点的偏移量。
37
+ */
38
+ export declare type PointAnchor = {
39
+ /**
40
+ * 锚点x轴相对于中心点的偏移量
41
+ */
42
+ x: number;
43
+ /**
44
+ * 锚点y轴相对于中心点的偏移量
45
+ */
46
+ y: number;
47
+ /**
48
+ * 锚点Id
49
+ */
50
+ id?: string;
51
+ [key: string]: unknown;
52
+ };
53
+ export declare type AnchorsOffsetItem = PointTuple | PointAnchor;
32
54
  export declare type Size = {
33
55
  width: number;
34
56
  height: number;
@@ -103,7 +125,11 @@ export declare type EdgeFilter = {
103
125
  };
104
126
  export declare type EdgeConfig = {
105
127
  id?: string;
106
- type: string;
128
+ /**
129
+ * 边的类型,不传默认为lf.setDefaultEdgeType(type)传入的类型。
130
+ * LogicFlow内部默认为polyline
131
+ */
132
+ type?: string;
107
133
  sourceNodeId: string;
108
134
  sourceAnchorId?: string;
109
135
  targetNodeId: string;
@@ -143,9 +169,7 @@ export declare type CommonStyle = {
143
169
  strokeOpacity?: number;
144
170
  opacity?: number;
145
171
  outlineColor?: string;
146
- hoverOutlineColor?: string;
147
172
  outlineStrokeDashArray?: string;
148
- hoverOutlineStrokeDashArray?: string;
149
173
  };
150
174
  export declare type RectStyle = CommonStyle & {
151
175
  width?: number;
@@ -205,25 +229,10 @@ export declare type TextStyle = {
205
229
  fontFamily?: string;
206
230
  };
207
231
  export declare type NodeTextStyle = TextStyle & {
208
- autoWrap?: boolean;
209
- lineHeight?: number;
210
- wrapPadding?: string;
211
- };
212
- export declare type EdgeTextStyle = TextStyle & {
213
- background?: {
214
- fill?: string;
215
- stroke?: string;
216
- radius?: number;
217
- };
218
- hoverBackground?: {
219
- fill?: string;
220
- stroke?: string;
221
- radius?: number;
222
- };
223
- autoWrap?: boolean;
224
232
  lineHeight?: number;
225
233
  wrapPadding?: string;
226
234
  };
235
+ export declare type EdgeTextStyle = TextStyle & EdgeTextTheme;
227
236
  export declare type ArrowStyle = {
228
237
  offset?: number;
229
238
  verticalLength?: number;
@@ -233,24 +242,6 @@ export declare type EdgeAdjustStyle = {
233
242
  fill?: string;
234
243
  stroke?: string;
235
244
  };
236
- export declare type Style = {
237
- rect?: RectStyle;
238
- circle?: CircleStyle;
239
- ellipse?: EllipseStyle;
240
- diamond?: DiamondStyle;
241
- polygon?: PolygonStyle;
242
- anchor?: AnchorStyle;
243
- text?: TextStyle;
244
- nodeText?: NodeTextStyle;
245
- edgeText?: EdgeTextStyle;
246
- line?: LineStyle;
247
- polyline?: PolylineStyle;
248
- bezier?: BezierStyle;
249
- arrow?: ArrowStyle;
250
- anchorLine?: AnchorLineStyle;
251
- anchorHover?: AnchorHoverStyle;
252
- EdgeAdjustStyle?: EdgeAdjustStyle;
253
- };
254
245
  export declare type GraphTransform = {
255
246
  transform: string;
256
247
  transformOrigin: string;
@@ -353,4 +344,26 @@ export declare type AnchorConfig = {
353
344
  */
354
345
  export declare type NodeMoveRule = (model: BaseNodeModel, deltaX: number, deltaY: number) => Boolean;
355
346
  export declare type ZoomParam = boolean | number;
347
+ export declare type NodeAttributes = {
348
+ id: string;
349
+ properties: Record<string, any>;
350
+ type: string;
351
+ x: number;
352
+ y: number;
353
+ isSelected: boolean;
354
+ isHovered: boolean;
355
+ width: number;
356
+ height: number;
357
+ text: {
358
+ x: number;
359
+ y: number;
360
+ value: string;
361
+ [key: string]: any;
362
+ };
363
+ [key: string]: any;
364
+ };
365
+ export declare type DiamondAttributes = {
366
+ points: PointTuple[];
367
+ } & NodeAttributes;
368
+ export declare type ShapeStyleAttribute = CommonTheme;
356
369
  export {};
@@ -88,9 +88,9 @@ export declare type IBezierPoints = {
88
88
  export declare const getBezierPoints: (path: string) => Point[];
89
89
  export declare const getEndTangent: (path: string) => Point[];
90
90
  /**
91
- * 获取移动连线后,文本位置距离连线上的最近的一点
92
- * @param point 连线上文本的位置
93
- * @param points 连线的各个拐点
91
+ * 获取移动边后,文本位置距离边上的最近的一点
92
+ * @param point 边上文本的位置
93
+ * @param points 边的各个拐点
94
94
  */
95
95
  export declare const getClosestPointOfPolyline: (point: Point, points: string) => Point;
96
96
  export declare const pickEdgeConfig: (data: any) => EdgeConfig;
@@ -9,4 +9,4 @@ export declare const isPointInArea: ([x, y]: [any, any], [leftTopX, leftTopY]: [
9
9
  /**
10
10
  * 判断鼠标点击选中元素的时候,是否为多选
11
11
  */
12
- export declare const isMultipleSelect: (e: MouseEvent, editConfig: any) => boolean;
12
+ export declare const isMultipleSelect: (e: MouseEvent, editConfigModel: any) => boolean;
@@ -58,7 +58,7 @@ export declare const getSvgTextWidthHeight: ({ rows, rowsLength, fontSize }: {
58
58
  height: number;
59
59
  };
60
60
  /**
61
- * @description 格式化连线校验信息
61
+ * @description 格式化边校验信息
62
62
  */
63
63
  export declare const formateAnchorConnectValidateData: (data: any) => any;
64
64
  export {};