@logicflow/core 1.0.0-alpha.5 → 1.0.0-alpha.9
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/dist/logic-flow.js +2 -11
- package/dist/style/index.css +1 -1
- package/package.json +1 -1
- package/types/LogicFlow.d.ts +341 -137
- package/types/constant/DefaultTheme.d.ts +271 -171
- package/types/constant/constant.d.ts +7 -1
- package/types/keyboard/index.d.ts +1 -5
- package/types/model/BaseModel.d.ts +59 -0
- package/types/model/EditConfigModel.d.ts +6 -16
- package/types/model/GraphModel.d.ts +264 -58
- package/types/model/SnaplineModel.d.ts +6 -2
- package/types/model/TransformModel.d.ts +8 -2
- package/types/model/edge/BaseEdgeModel.d.ts +17 -19
- package/types/model/edge/BezierEdgeModel.d.ts +9 -0
- package/types/model/edge/LineEdgeModel.d.ts +6 -0
- package/types/model/edge/PolylineEdgeModel.d.ts +7 -0
- package/types/model/node/BaseNodeModel.d.ts +80 -29
- package/types/model/node/CircleNodeModel.d.ts +12 -4
- package/types/model/node/DiamondNodeModel.d.ts +7 -4
- package/types/model/node/EllipseNodeModel.d.ts +6 -2
- package/types/model/node/HtmlNodeModel.d.ts +0 -2
- package/types/model/node/PolygonNodeModel.d.ts +11 -2
- package/types/model/node/RectNodeModel.d.ts +9 -2
- package/types/model/node/TextNodeModel.d.ts +8 -4
- package/types/options.d.ts +78 -12
- package/types/type/index.d.ts +50 -37
- package/types/util/edge.d.ts +3 -3
- package/types/util/graph.d.ts +1 -1
- package/types/util/node.d.ts +1 -1
- package/types/util/theme.d.ts +2 -173
- package/types/view/Anchor.d.ts +0 -2
- package/types/view/Graph.d.ts +1 -3
- package/types/view/basic-shape/Path.d.ts +1 -9
- package/types/view/basic-shape/Rect.d.ts +1 -5
- package/types/view/behavior/DnD.d.ts +0 -4
- package/types/view/edge/AdjustPoint.d.ts +1 -3
- package/types/view/edge/Arrow.d.ts +3 -3
- package/types/view/edge/BaseEdge.d.ts +2 -20
- package/types/view/edge/BezierEdge.d.ts +0 -12
- package/types/view/edge/LineEdge.d.ts +0 -13
- package/types/view/edge/PolylineEdge.d.ts +0 -12
- package/types/view/node/BaseNode.d.ts +1 -36
- package/types/view/node/CircleNode.d.ts +0 -37
- package/types/view/node/DiamondNode.d.ts +0 -37
- package/types/view/node/EllipseNode.d.ts +0 -26
- package/types/view/node/HtmlNode.d.ts +20 -0
- package/types/view/node/PolygonNode.d.ts +1 -19
- package/types/view/node/RectNode.d.ts +0 -37
- package/types/view/node/TextNode.d.ts +1 -0
- package/types/view/overlay/BackgroundOverlay.d.ts +18 -29
- package/types/view/overlay/CanvasOverlay.d.ts +0 -2
- package/types/view/overlay/OutlineOverlay.d.ts +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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
|
|
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:
|
|
47
|
+
anchorsOffset: AnchorsOffsetItem[];
|
|
53
48
|
state: number;
|
|
54
49
|
text: {
|
|
55
50
|
value: string;
|
|
@@ -59,18 +54,68 @@ export default class BaseNodeModel implements IBaseModel {
|
|
|
59
54
|
editable: boolean;
|
|
60
55
|
};
|
|
61
56
|
draggable: boolean;
|
|
62
|
-
constructor(data: NodeConfig, graphModel: GraphModel
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
*
|
|
95
|
+
* @overridable 支持重写
|
|
96
|
+
* 获取当前节点样式
|
|
97
|
+
* @returns 自定义节点样式
|
|
98
|
+
*/
|
|
99
|
+
getNodeStyle(): ShapeStyleAttribute;
|
|
100
|
+
getTextStyle(): import("../../constant/DefaultTheme").NodeTextTheme;
|
|
101
|
+
/**
|
|
102
|
+
* 获取节点锚点样式
|
|
103
|
+
* @returns 自定义样式
|
|
104
|
+
*/
|
|
105
|
+
getAnchorStyle(): Record<string, any>;
|
|
106
|
+
/**
|
|
107
|
+
* 获取自定义锚点拖出样式
|
|
108
|
+
* @returns 自定义锚点拖出样式
|
|
109
|
+
*/
|
|
110
|
+
getAnchorLineStyle(): import("../../constant/DefaultTheme").CommonTheme;
|
|
111
|
+
/**
|
|
112
|
+
* @overridable 支持重写
|
|
113
|
+
* 获取outline样式,重写可以定义此类型节点outline样式, 默认使用主题样式
|
|
114
|
+
* @returns 自定义outline样式
|
|
115
|
+
*/
|
|
116
|
+
getOutlineStyle(): OutlineTheme;
|
|
117
|
+
/**
|
|
118
|
+
* 在边的时候,是否允许这个节点为source节点,边到target节点。
|
|
74
119
|
*/
|
|
75
120
|
isAllowConnectedAsSource(target: BaseNodeModel, soureAnchor: AnchorConfig, targetAnchor: AnchorConfig): ConnectRuleResult | Boolean;
|
|
76
121
|
/**
|
|
@@ -78,7 +123,7 @@ export default class BaseNodeModel implements IBaseModel {
|
|
|
78
123
|
*/
|
|
79
124
|
getConnectedSourceRules(): ConnectRule[];
|
|
80
125
|
/**
|
|
81
|
-
*
|
|
126
|
+
* 在边的时候,是否允许这个节点未target节点
|
|
82
127
|
*/
|
|
83
128
|
isAllowConnectedAsTarget(source: BaseNodeModel, soureAnchor: AnchorConfig, targetAnchor: AnchorConfig): ConnectRuleResult | Boolean;
|
|
84
129
|
/**
|
|
@@ -86,12 +131,20 @@ export default class BaseNodeModel implements IBaseModel {
|
|
|
86
131
|
*/
|
|
87
132
|
isAllowMoveNode(deltaX: any, deltaY: any): boolean;
|
|
88
133
|
getConnectedTargetRules(): ConnectRule[];
|
|
89
|
-
getAnchorsByOffset(): Point[];
|
|
90
134
|
/**
|
|
91
|
-
*
|
|
135
|
+
* @overridable 子类重写此方法设置锚点
|
|
136
|
+
* @returns Point[] 锚点坐标构成的数组
|
|
137
|
+
*/
|
|
138
|
+
getAnchorsByOffset(): PointAnchor[];
|
|
139
|
+
/**
|
|
140
|
+
* 获取节点默认情况下的锚点
|
|
141
|
+
*/
|
|
142
|
+
getDetaultAnchor(): PointAnchor[];
|
|
143
|
+
/**
|
|
144
|
+
* 获取节点BBox
|
|
92
145
|
*/
|
|
93
146
|
getBounds(): Bounds;
|
|
94
|
-
get anchors():
|
|
147
|
+
get anchors(): PointAnchor[];
|
|
95
148
|
addNodeMoveRules(fn: NodeMoveRule): void;
|
|
96
149
|
move(deltaX: any, deltaY: any, isignoreRule?: boolean): void;
|
|
97
150
|
moveTo(x: any, y: any, isignoreRule?: boolean): void;
|
|
@@ -100,12 +153,10 @@ export default class BaseNodeModel implements IBaseModel {
|
|
|
100
153
|
setSelected(flag?: boolean): void;
|
|
101
154
|
setHovered(flag?: boolean): void;
|
|
102
155
|
setHitable(flag?: boolean): void;
|
|
103
|
-
setElementState(state:
|
|
156
|
+
setElementState(state: number, additionStateData?: AdditionData): void;
|
|
104
157
|
updateStroke(color: any): void;
|
|
105
|
-
updateData(nodeAttribute: NodeAttribute): void;
|
|
106
158
|
setProperty(key: any, val: any): void;
|
|
107
159
|
setProperties(properties: any): void;
|
|
108
|
-
setStyleFromTheme(type: any, graphModel: any): void;
|
|
109
160
|
setZIndex(zindex?: number): void;
|
|
110
161
|
updateAttributes(attributes: any): void;
|
|
111
162
|
}
|
|
@@ -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
|
-
|
|
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 {
|
|
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
|
-
|
|
10
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
}
|
package/types/options.d.ts
CHANGED
|
@@ -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 {
|
|
3
|
+
import { NodeData, EdgeData, GraphConfigData } from './type';
|
|
5
4
|
import { KeyboardDef } from './keyboard';
|
|
6
|
-
import { EditConfigInterface } from './model/
|
|
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,49 @@ export declare type Definition = {
|
|
|
34
35
|
* 网格
|
|
35
36
|
*/
|
|
36
37
|
grid?: boolean | GridOptions;
|
|
38
|
+
/**
|
|
39
|
+
* 键盘快捷操作
|
|
40
|
+
*/
|
|
37
41
|
keyboard?: KeyboardDef;
|
|
38
|
-
|
|
39
|
-
|
|
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;
|
|
46
|
-
|
|
71
|
+
/**
|
|
72
|
+
* 表示节点在上,边在下,点击元素时选择元素显示在最顶部。
|
|
73
|
+
* 表示安装元素创建顺序排序,点击元素也不会将其置顶。要置顶需要调用置顶API。
|
|
74
|
+
*/
|
|
47
75
|
overlapMode?: OverlapMode;
|
|
48
|
-
|
|
76
|
+
/**
|
|
77
|
+
* 自定义创建节点、连线时生成id规则。
|
|
78
|
+
* @param type 节点、连线类型
|
|
79
|
+
*/
|
|
80
|
+
idGenerator?: (type?: string) => string;
|
|
49
81
|
/**
|
|
50
82
|
* 禁止启用的内置工具
|
|
51
83
|
* 有些场景下,需要自定义多选效果或者文本编辑效果,则需要禁用这些内置的工具
|
|
@@ -53,6 +85,7 @@ export declare type Definition = {
|
|
|
53
85
|
* todo: 将multipleSelect放到插件中
|
|
54
86
|
*/
|
|
55
87
|
disabledTools?: string[];
|
|
88
|
+
[key: string]: any;
|
|
56
89
|
} & EditConfigInterface;
|
|
57
90
|
export interface GuardsTypes {
|
|
58
91
|
beforeClone?: (data: NodeData | GraphConfigData) => boolean;
|
|
@@ -64,8 +97,10 @@ export declare function get(options: Definition): {
|
|
|
64
97
|
textEdit: boolean;
|
|
65
98
|
disabledTools: any[];
|
|
66
99
|
} & {
|
|
100
|
+
[key: string]: any;
|
|
67
101
|
/**
|
|
68
102
|
* 画布初始化容器
|
|
103
|
+
* 注意,在不传入width和height的情况下,container元素本身应该存在高度和高度。
|
|
69
104
|
*/
|
|
70
105
|
container: HTMLElement;
|
|
71
106
|
/**
|
|
@@ -84,18 +119,49 @@ export declare function get(options: Definition): {
|
|
|
84
119
|
* 网格
|
|
85
120
|
*/
|
|
86
121
|
grid?: boolean | GridOptions;
|
|
122
|
+
/**
|
|
123
|
+
* 键盘快捷操作
|
|
124
|
+
*/
|
|
87
125
|
keyboard?: KeyboardDef;
|
|
88
|
-
|
|
89
|
-
|
|
126
|
+
/**
|
|
127
|
+
* 主题配置
|
|
128
|
+
*/
|
|
129
|
+
style?: Theme;
|
|
130
|
+
/**
|
|
131
|
+
* 禁止初始化的插件名称
|
|
132
|
+
*/
|
|
90
133
|
disabledPlugins?: string[];
|
|
134
|
+
/**
|
|
135
|
+
* 默认边类型
|
|
136
|
+
*/
|
|
91
137
|
edgeType?: any;
|
|
138
|
+
/**
|
|
139
|
+
* 是否开启对齐线,默认开启
|
|
140
|
+
*/
|
|
92
141
|
snapline?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* 是否开启历史记录功能,默认开启
|
|
144
|
+
*/
|
|
93
145
|
history?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* 是否开启局部渲染,默认不开启
|
|
148
|
+
*/
|
|
94
149
|
partial?: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* 删除和克隆之前的判断函数
|
|
152
|
+
* todo: 目前不完善,仅支持同步
|
|
153
|
+
*/
|
|
95
154
|
guards?: GuardsTypes;
|
|
96
|
-
|
|
155
|
+
/**
|
|
156
|
+
* 表示节点在上,边在下,点击元素时选择元素显示在最顶部。
|
|
157
|
+
* 表示安装元素创建顺序排序,点击元素也不会将其置顶。要置顶需要调用置顶API。
|
|
158
|
+
*/
|
|
97
159
|
overlapMode?: OverlapMode;
|
|
98
|
-
|
|
160
|
+
/**
|
|
161
|
+
* 自定义创建节点、连线时生成id规则。
|
|
162
|
+
* @param type 节点、连线类型
|
|
163
|
+
*/
|
|
164
|
+
idGenerator?: (type?: string) => string;
|
|
99
165
|
/**
|
|
100
166
|
* 禁止启用的内置工具
|
|
101
167
|
* 有些场景下,需要自定义多选效果或者文本编辑效果,则需要禁用这些内置的工具
|
package/types/type/index.d.ts
CHANGED
|
@@ -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
|
-
|
|
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 {};
|
package/types/util/edge.d.ts
CHANGED
|
@@ -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;
|
package/types/util/graph.d.ts
CHANGED
|
@@ -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,
|
|
12
|
+
export declare const isMultipleSelect: (e: MouseEvent, editConfigModel: any) => boolean;
|
package/types/util/node.d.ts
CHANGED
|
@@ -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 {};
|