@logicflow/core 1.0.0-alpha.4 → 1.0.0-alpha.5
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 +11 -2
- package/dist/style/index.css +1 -1
- package/package.json +1 -1
- package/types/LogicFlow.d.ts +137 -341
- package/types/constant/DefaultTheme.d.ts +171 -271
- package/types/keyboard/index.d.ts +5 -1
- package/types/model/BaseModel.d.ts +0 -59
- package/types/model/EditConfigModel.d.ts +16 -6
- package/types/model/GraphModel.d.ts +58 -264
- package/types/model/SnaplineModel.d.ts +2 -6
- package/types/model/TransformModel.d.ts +2 -8
- package/types/model/edge/BaseEdgeModel.d.ts +10 -16
- package/types/model/edge/BezierEdgeModel.d.ts +0 -9
- package/types/model/edge/LineEdgeModel.d.ts +0 -6
- package/types/model/edge/PolylineEdgeModel.d.ts +0 -7
- package/types/model/node/BaseNodeModel.d.ts +29 -90
- package/types/model/node/CircleNodeModel.d.ts +4 -12
- package/types/model/node/DiamondNodeModel.d.ts +4 -7
- package/types/model/node/EllipseNodeModel.d.ts +2 -6
- package/types/model/node/HtmlNodeModel.d.ts +2 -0
- package/types/model/node/PolygonNodeModel.d.ts +2 -11
- package/types/model/node/RectNodeModel.d.ts +2 -9
- package/types/model/node/TextNodeModel.d.ts +4 -8
- package/types/options.d.ts +10 -84
- package/types/type/index.d.ts +37 -50
- 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 +173 -2
- package/types/view/Anchor.d.ts +2 -0
- package/types/view/Graph.d.ts +3 -1
- package/types/view/basic-shape/Path.d.ts +9 -1
- package/types/view/basic-shape/Rect.d.ts +5 -1
- package/types/view/behavior/DnD.d.ts +4 -0
- package/types/view/edge/AdjustPoint.d.ts +3 -1
- package/types/view/edge/Arrow.d.ts +3 -3
- package/types/view/edge/BaseEdge.d.ts +20 -2
- package/types/view/edge/BezierEdge.d.ts +12 -0
- package/types/view/edge/LineEdge.d.ts +13 -0
- package/types/view/edge/PolylineEdge.d.ts +12 -0
- package/types/view/node/BaseNode.d.ts +36 -1
- package/types/view/node/CircleNode.d.ts +37 -0
- package/types/view/node/DiamondNode.d.ts +37 -0
- package/types/view/node/EllipseNode.d.ts +26 -0
- package/types/view/node/HtmlNode.d.ts +0 -20
- package/types/view/node/PolygonNode.d.ts +19 -1
- package/types/view/node/RectNode.d.ts +37 -0
- package/types/view/node/TextNode.d.ts +0 -1
- package/types/view/overlay/BackgroundOverlay.d.ts +29 -18
- package/types/view/overlay/CanvasOverlay.d.ts +2 -0
- package/types/view/overlay/OutlineOverlay.d.ts +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { AdditionData, NodeData, NodeConfig, NodeMoveRule, Bounds, AnchorConfig, PointAnchor, AnchorsOffsetItem, ShapeStyleAttribute } from '../../type';
|
|
1
|
+
import { ElementState, ModelType, ElementType } from '../../constant/constant';
|
|
2
|
+
import { AdditionData, NodeData, NodeAttribute, NodeConfig, NodeMoveRule, Bounds, Point, AnchorConfig } from '../../type';
|
|
4
3
|
import GraphModel from '../GraphModel';
|
|
5
4
|
import { IBaseModel } from '../BaseModel';
|
|
6
5
|
export declare type ConnectRule = {
|
|
@@ -11,14 +10,8 @@ export declare type ConnectRuleResult = {
|
|
|
11
10
|
isAllPass: boolean;
|
|
12
11
|
msg?: string;
|
|
13
12
|
};
|
|
14
|
-
interface IBaseNodeModel extends IBaseModel {
|
|
15
|
-
/**
|
|
16
|
-
* model基础类型,固定为node
|
|
17
|
-
*/
|
|
18
|
-
readonly BaseType: ElementType.NODE;
|
|
19
|
-
}
|
|
20
13
|
export { BaseNodeModel };
|
|
21
|
-
export default class BaseNodeModel implements
|
|
14
|
+
export default class BaseNodeModel implements IBaseModel {
|
|
22
15
|
id: string;
|
|
23
16
|
readonly BaseType = ElementType.NODE;
|
|
24
17
|
modelType: ModelType;
|
|
@@ -40,11 +33,23 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
40
33
|
private _height;
|
|
41
34
|
get height(): number;
|
|
42
35
|
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;
|
|
43
47
|
isSelected: boolean;
|
|
44
48
|
isHovered: boolean;
|
|
49
|
+
isDragging: boolean;
|
|
45
50
|
isHitable: boolean;
|
|
46
51
|
zIndex: number;
|
|
47
|
-
anchorsOffset:
|
|
52
|
+
anchorsOffset: any[];
|
|
48
53
|
state: number;
|
|
49
54
|
text: {
|
|
50
55
|
value: string;
|
|
@@ -54,78 +59,18 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
54
59
|
editable: boolean;
|
|
55
60
|
};
|
|
56
61
|
draggable: boolean;
|
|
57
|
-
constructor(data: NodeConfig, graphModel: GraphModel);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
*/
|
|
62
|
+
constructor(data: NodeConfig, graphModel: GraphModel, type: any);
|
|
63
|
+
initNodeData(data: any): void;
|
|
64
|
+
createId(): any;
|
|
65
|
+
formatText(data: any): void;
|
|
86
66
|
setAttributes(): void;
|
|
87
67
|
/**
|
|
88
|
-
*
|
|
89
|
-
* @overridable 支持重写
|
|
90
|
-
* @returns NodeData
|
|
68
|
+
* 保存时获取的数据
|
|
91
69
|
*/
|
|
92
70
|
getData(): NodeData;
|
|
93
71
|
getProperties(): Record<string, any>;
|
|
94
72
|
/**
|
|
95
|
-
*
|
|
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节点。
|
|
73
|
+
* 在连线的时候,是否允许这个节点为source节点,连线到target节点。
|
|
129
74
|
*/
|
|
130
75
|
isAllowConnectedAsSource(target: BaseNodeModel, soureAnchor: AnchorConfig, targetAnchor: AnchorConfig): ConnectRuleResult | Boolean;
|
|
131
76
|
/**
|
|
@@ -133,7 +78,7 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
133
78
|
*/
|
|
134
79
|
getConnectedSourceRules(): ConnectRule[];
|
|
135
80
|
/**
|
|
136
|
-
*
|
|
81
|
+
* 在连线的时候,是否允许这个节点未target节点
|
|
137
82
|
*/
|
|
138
83
|
isAllowConnectedAsTarget(source: BaseNodeModel, soureAnchor: AnchorConfig, targetAnchor: AnchorConfig): ConnectRuleResult | Boolean;
|
|
139
84
|
/**
|
|
@@ -141,20 +86,12 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
141
86
|
*/
|
|
142
87
|
isAllowMoveNode(deltaX: any, deltaY: any): boolean;
|
|
143
88
|
getConnectedTargetRules(): ConnectRule[];
|
|
89
|
+
getAnchorsByOffset(): Point[];
|
|
144
90
|
/**
|
|
145
|
-
*
|
|
146
|
-
* @returns Point[] 锚点坐标构成的数组
|
|
147
|
-
*/
|
|
148
|
-
getAnchorsByOffset(): PointAnchor[];
|
|
149
|
-
/**
|
|
150
|
-
* 获取节点默认情况下的锚点
|
|
151
|
-
*/
|
|
152
|
-
getDetaultAnchor(): PointAnchor[];
|
|
153
|
-
/**
|
|
154
|
-
* 获取节点BBox
|
|
91
|
+
* 获取节点区域
|
|
155
92
|
*/
|
|
156
93
|
getBounds(): Bounds;
|
|
157
|
-
get anchors():
|
|
94
|
+
get anchors(): Point[];
|
|
158
95
|
addNodeMoveRules(fn: NodeMoveRule): void;
|
|
159
96
|
move(deltaX: any, deltaY: any, isignoreRule?: boolean): void;
|
|
160
97
|
moveTo(x: any, y: any, isignoreRule?: boolean): void;
|
|
@@ -163,10 +100,12 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
163
100
|
setSelected(flag?: boolean): void;
|
|
164
101
|
setHovered(flag?: boolean): void;
|
|
165
102
|
setHitable(flag?: boolean): void;
|
|
166
|
-
setElementState(state:
|
|
103
|
+
setElementState(state: ElementState, additionStateData?: AdditionData): void;
|
|
167
104
|
updateStroke(color: any): void;
|
|
105
|
+
updateData(nodeAttribute: NodeAttribute): void;
|
|
168
106
|
setProperty(key: any, val: any): void;
|
|
169
107
|
setProperties(properties: any): void;
|
|
108
|
+
setStyleFromTheme(type: any, graphModel: any): void;
|
|
170
109
|
setZIndex(zindex?: number): void;
|
|
171
110
|
updateAttributes(attributes: any): void;
|
|
172
111
|
}
|
|
@@ -1,22 +1,14 @@
|
|
|
1
|
+
import { Point } from '../../type';
|
|
1
2
|
import BaseNodeModel from './BaseNodeModel';
|
|
2
3
|
import { ModelType } from '../../constant/constant';
|
|
4
|
+
import GraphModel from '../GraphModel';
|
|
3
5
|
declare class CircleNodeModel extends BaseNodeModel {
|
|
4
6
|
modelType: ModelType;
|
|
5
7
|
r: number;
|
|
8
|
+
constructor(data: any, graphModel: GraphModel);
|
|
6
9
|
get width(): number;
|
|
7
10
|
get height(): number;
|
|
8
|
-
|
|
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
|
-
}[];
|
|
11
|
+
get anchors(): Point[];
|
|
20
12
|
}
|
|
21
13
|
export { CircleNodeModel };
|
|
22
14
|
export default CircleNodeModel;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import { Point, PointTuple } from '../../type';
|
|
1
|
+
import { NodeData, Point, PointTuple } from '../../type';
|
|
2
2
|
import BaseNodeModel from './BaseNodeModel';
|
|
3
3
|
import { ModelType } from '../../constant/constant';
|
|
4
|
+
import GraphModel from '../GraphModel';
|
|
4
5
|
declare class DiamondNodeModel extends BaseNodeModel {
|
|
5
6
|
modelType: ModelType;
|
|
6
7
|
rx: number;
|
|
7
8
|
ry: number;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
fill?: string;
|
|
11
|
-
stroke?: string;
|
|
12
|
-
strokeWidth?: number;
|
|
13
|
-
};
|
|
9
|
+
constructor(data: any, graphModel: GraphModel);
|
|
10
|
+
getData(): NodeData;
|
|
14
11
|
get points(): PointTuple[];
|
|
15
12
|
get pointsPosition(): Point[];
|
|
16
13
|
get width(): number;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { Point } from '../../type';
|
|
2
2
|
import BaseNodeModel from './BaseNodeModel';
|
|
3
3
|
import { ModelType } from '../../constant/constant';
|
|
4
|
+
import GraphModel from '../GraphModel';
|
|
4
5
|
declare class EllipseNodeModel extends BaseNodeModel {
|
|
5
6
|
modelType: ModelType;
|
|
6
7
|
rx: number;
|
|
7
8
|
ry: number;
|
|
8
|
-
|
|
9
|
-
[x: string]: any;
|
|
10
|
-
fill?: string;
|
|
11
|
-
stroke?: string;
|
|
12
|
-
strokeWidth?: number;
|
|
13
|
-
};
|
|
9
|
+
constructor(data: any, graphModel: GraphModel);
|
|
14
10
|
get width(): number;
|
|
15
11
|
get height(): number;
|
|
16
12
|
get anchors(): Point[];
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Point } from '../../type';
|
|
2
2
|
import BaseNodeModel from './BaseNodeModel';
|
|
3
3
|
import { ModelType } from '../../constant/constant';
|
|
4
|
+
import GraphModel from '../GraphModel';
|
|
4
5
|
declare class HtmlNodeModel extends BaseNodeModel {
|
|
5
6
|
modelType: ModelType;
|
|
7
|
+
constructor(data: any, graphModel: GraphModel);
|
|
6
8
|
get anchors(): Point[];
|
|
7
9
|
}
|
|
8
10
|
export { HtmlNodeModel };
|
|
@@ -1,20 +1,11 @@
|
|
|
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';
|
|
4
5
|
declare class PolygonNodeModel extends BaseNodeModel {
|
|
5
6
|
modelType: ModelType;
|
|
6
7
|
points: PointTuple[];
|
|
7
|
-
|
|
8
|
-
[x: string]: any;
|
|
9
|
-
fill?: string;
|
|
10
|
-
stroke?: string;
|
|
11
|
-
strokeWidth?: number;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* 由于大多数情况下,我们初始化拿到的多边形坐标都是基于原点的(例如绘图工具到处的svg)。
|
|
15
|
-
* 在logicflow中对多边形进行移动,我们不需要去更新points,
|
|
16
|
-
* 而是去更新多边形中心点即可。
|
|
17
|
-
*/
|
|
8
|
+
constructor(data: any, graphModel: GraphModel);
|
|
18
9
|
get pointsPosition(): Point[];
|
|
19
10
|
get width(): number;
|
|
20
11
|
get height(): number;
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import { Point } from '../../type';
|
|
2
2
|
import BaseNodeModel from './BaseNodeModel';
|
|
3
3
|
import { ModelType } from '../../constant/constant';
|
|
4
|
+
import GraphModel from '../GraphModel';
|
|
4
5
|
declare class RectNodeModel extends BaseNodeModel {
|
|
5
6
|
modelType: ModelType;
|
|
6
7
|
radius: number;
|
|
8
|
+
constructor(data: any, graphModel: GraphModel);
|
|
7
9
|
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
|
-
};
|
|
17
10
|
}
|
|
18
11
|
export { RectNodeModel };
|
|
19
12
|
export default RectNodeModel;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import BaseNodeModel from './BaseNodeModel';
|
|
2
2
|
import { ModelType } from '../../constant/constant';
|
|
3
|
+
import GraphModel from '../GraphModel';
|
|
3
4
|
declare class TextNodeModel extends BaseNodeModel {
|
|
4
5
|
modelType: ModelType;
|
|
5
6
|
fontSize: number;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
fontSize?: number;
|
|
10
|
-
fill?: string;
|
|
11
|
-
stroke?: string;
|
|
12
|
-
strokeWidth?: number;
|
|
13
|
-
};
|
|
7
|
+
fontFamily: string;
|
|
8
|
+
fontWeight: string;
|
|
9
|
+
constructor(data: any, graphModel: GraphModel);
|
|
14
10
|
get width(): number;
|
|
15
11
|
get height(): number;
|
|
16
12
|
}
|
package/types/options.d.ts
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
|
+
import { DndOptions } from './view/behavior/DnD';
|
|
1
2
|
import { GridOptions } from './view/overlay/Grid';
|
|
2
3
|
import { BackgroundConfig } from './view/overlay/BackgroundOverlay';
|
|
3
|
-
import { NodeData, EdgeData, GraphConfigData } from './type';
|
|
4
|
+
import { Style, NodeData, EdgeData, GraphConfigData } from './type';
|
|
4
5
|
import { KeyboardDef } from './keyboard';
|
|
5
|
-
import { EditConfigInterface } from './model/
|
|
6
|
-
import { Theme } from './constant/DefaultTheme';
|
|
6
|
+
import { EditConfigInterface } from './model/EditConfigModel';
|
|
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元素本身应该存在高度和高度。
|
|
20
19
|
*/
|
|
21
20
|
container: HTMLElement;
|
|
22
21
|
/**
|
|
@@ -35,53 +34,18 @@ export declare type Definition = {
|
|
|
35
34
|
* 网格
|
|
36
35
|
*/
|
|
37
36
|
grid?: boolean | GridOptions;
|
|
38
|
-
/**
|
|
39
|
-
* 键盘快捷操作
|
|
40
|
-
*/
|
|
41
37
|
keyboard?: KeyboardDef;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*/
|
|
45
|
-
style?: Theme;
|
|
46
|
-
/**
|
|
47
|
-
* 禁止初始化的插件名称
|
|
48
|
-
*/
|
|
38
|
+
style?: Style;
|
|
39
|
+
dndOptions?: DndOptions;
|
|
49
40
|
disabledPlugins?: string[];
|
|
50
|
-
/**
|
|
51
|
-
* 默认边类型
|
|
52
|
-
*/
|
|
53
41
|
edgeType?: EdgeType;
|
|
54
|
-
/**
|
|
55
|
-
* 是否开启对齐线,默认开启
|
|
56
|
-
*/
|
|
57
42
|
snapline?: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* 是否开启历史记录功能,默认开启
|
|
60
|
-
*/
|
|
61
43
|
history?: boolean;
|
|
62
|
-
/**
|
|
63
|
-
* 是否开启局部渲染,默认不开启
|
|
64
|
-
*/
|
|
65
44
|
partial?: boolean;
|
|
66
|
-
/**
|
|
67
|
-
* 删除和克隆之前的判断函数
|
|
68
|
-
* todo: 目前不完善,仅支持同步
|
|
69
|
-
*/
|
|
70
45
|
guards?: GuardsTypes;
|
|
71
|
-
/**
|
|
72
|
-
* 是否不启用outline显示选中和hover效果
|
|
73
|
-
*/
|
|
74
46
|
hideOutline?: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* 表示节点在上,边在下,点击元素时选择元素显示在最顶部。
|
|
77
|
-
* 表示安装元素创建顺序排序,点击元素也不会将其置顶。要置顶需要调用置顶API。
|
|
78
|
-
*/
|
|
79
47
|
overlapMode?: OverlapMode;
|
|
80
|
-
|
|
81
|
-
* 自定义创建节点、连线时生成id规则。
|
|
82
|
-
* @param type 节点、连线类型
|
|
83
|
-
*/
|
|
84
|
-
idGenerator?: (type?: string) => string;
|
|
48
|
+
idGenerator?: () => number | string;
|
|
85
49
|
/**
|
|
86
50
|
* 禁止启用的内置工具
|
|
87
51
|
* 有些场景下,需要自定义多选效果或者文本编辑效果,则需要禁用这些内置的工具
|
|
@@ -89,7 +53,6 @@ export declare type Definition = {
|
|
|
89
53
|
* todo: 将multipleSelect放到插件中
|
|
90
54
|
*/
|
|
91
55
|
disabledTools?: string[];
|
|
92
|
-
[key: string]: any;
|
|
93
56
|
} & EditConfigInterface;
|
|
94
57
|
export interface GuardsTypes {
|
|
95
58
|
beforeClone?: (data: NodeData | GraphConfigData) => boolean;
|
|
@@ -101,10 +64,8 @@ export declare function get(options: Definition): {
|
|
|
101
64
|
textEdit: boolean;
|
|
102
65
|
disabledTools: any[];
|
|
103
66
|
} & {
|
|
104
|
-
[key: string]: any;
|
|
105
67
|
/**
|
|
106
68
|
* 画布初始化容器
|
|
107
|
-
* 注意,在不传入width和height的情况下,container元素本身应该存在高度和高度。
|
|
108
69
|
*/
|
|
109
70
|
container: HTMLElement;
|
|
110
71
|
/**
|
|
@@ -123,53 +84,18 @@ export declare function get(options: Definition): {
|
|
|
123
84
|
* 网格
|
|
124
85
|
*/
|
|
125
86
|
grid?: boolean | GridOptions;
|
|
126
|
-
/**
|
|
127
|
-
* 键盘快捷操作
|
|
128
|
-
*/
|
|
129
87
|
keyboard?: KeyboardDef;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
*/
|
|
133
|
-
style?: Theme;
|
|
134
|
-
/**
|
|
135
|
-
* 禁止初始化的插件名称
|
|
136
|
-
*/
|
|
88
|
+
style?: Style;
|
|
89
|
+
dndOptions?: DndOptions;
|
|
137
90
|
disabledPlugins?: string[];
|
|
138
|
-
/**
|
|
139
|
-
* 默认边类型
|
|
140
|
-
*/
|
|
141
91
|
edgeType?: any;
|
|
142
|
-
/**
|
|
143
|
-
* 是否开启对齐线,默认开启
|
|
144
|
-
*/
|
|
145
92
|
snapline?: boolean;
|
|
146
|
-
/**
|
|
147
|
-
* 是否开启历史记录功能,默认开启
|
|
148
|
-
*/
|
|
149
93
|
history?: boolean;
|
|
150
|
-
/**
|
|
151
|
-
* 是否开启局部渲染,默认不开启
|
|
152
|
-
*/
|
|
153
94
|
partial?: boolean;
|
|
154
|
-
/**
|
|
155
|
-
* 删除和克隆之前的判断函数
|
|
156
|
-
* todo: 目前不完善,仅支持同步
|
|
157
|
-
*/
|
|
158
95
|
guards?: GuardsTypes;
|
|
159
|
-
/**
|
|
160
|
-
* 是否不启用outline显示选中和hover效果
|
|
161
|
-
*/
|
|
162
96
|
hideOutline?: boolean;
|
|
163
|
-
/**
|
|
164
|
-
* 表示节点在上,边在下,点击元素时选择元素显示在最顶部。
|
|
165
|
-
* 表示安装元素创建顺序排序,点击元素也不会将其置顶。要置顶需要调用置顶API。
|
|
166
|
-
*/
|
|
167
97
|
overlapMode?: OverlapMode;
|
|
168
|
-
|
|
169
|
-
* 自定义创建节点、连线时生成id规则。
|
|
170
|
-
* @param type 节点、连线类型
|
|
171
|
-
*/
|
|
172
|
-
idGenerator?: (type?: string) => string;
|
|
98
|
+
idGenerator?: () => string | number;
|
|
173
99
|
/**
|
|
174
100
|
* 禁止启用的内置工具
|
|
175
101
|
* 有些场景下,需要自定义多选效果或者文本编辑效果,则需要禁用这些内置的工具
|
package/types/type/index.d.ts
CHANGED
|
@@ -23,34 +23,12 @@ 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';
|
|
27
26
|
export declare type PointTuple = [number, number];
|
|
28
27
|
export declare type Point = {
|
|
29
28
|
x: number;
|
|
30
29
|
y: number;
|
|
31
30
|
[key: string]: unknown;
|
|
32
31
|
};
|
|
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;
|
|
54
32
|
export declare type Size = {
|
|
55
33
|
width: number;
|
|
56
34
|
height: number;
|
|
@@ -125,11 +103,7 @@ export declare type EdgeFilter = {
|
|
|
125
103
|
};
|
|
126
104
|
export declare type EdgeConfig = {
|
|
127
105
|
id?: string;
|
|
128
|
-
|
|
129
|
-
* 边的类型,不传默认为lf.setDefaultEdgeType(type)传入的类型。
|
|
130
|
-
* LogicFlow内部默认为polyline
|
|
131
|
-
*/
|
|
132
|
-
type?: string;
|
|
106
|
+
type: string;
|
|
133
107
|
sourceNodeId: string;
|
|
134
108
|
sourceAnchorId?: string;
|
|
135
109
|
targetNodeId: string;
|
|
@@ -169,7 +143,9 @@ export declare type CommonStyle = {
|
|
|
169
143
|
strokeOpacity?: number;
|
|
170
144
|
opacity?: number;
|
|
171
145
|
outlineColor?: string;
|
|
146
|
+
hoverOutlineColor?: string;
|
|
172
147
|
outlineStrokeDashArray?: string;
|
|
148
|
+
hoverOutlineStrokeDashArray?: string;
|
|
173
149
|
};
|
|
174
150
|
export declare type RectStyle = CommonStyle & {
|
|
175
151
|
width?: number;
|
|
@@ -229,10 +205,25 @@ export declare type TextStyle = {
|
|
|
229
205
|
fontFamily?: string;
|
|
230
206
|
};
|
|
231
207
|
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;
|
|
232
224
|
lineHeight?: number;
|
|
233
225
|
wrapPadding?: string;
|
|
234
226
|
};
|
|
235
|
-
export declare type EdgeTextStyle = TextStyle & EdgeTextTheme;
|
|
236
227
|
export declare type ArrowStyle = {
|
|
237
228
|
offset?: number;
|
|
238
229
|
verticalLength?: number;
|
|
@@ -242,6 +233,24 @@ export declare type EdgeAdjustStyle = {
|
|
|
242
233
|
fill?: string;
|
|
243
234
|
stroke?: string;
|
|
244
235
|
};
|
|
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
|
+
};
|
|
245
254
|
export declare type GraphTransform = {
|
|
246
255
|
transform: string;
|
|
247
256
|
transformOrigin: string;
|
|
@@ -344,26 +353,4 @@ export declare type AnchorConfig = {
|
|
|
344
353
|
*/
|
|
345
354
|
export declare type NodeMoveRule = (model: BaseNodeModel, deltaX: number, deltaY: number) => Boolean;
|
|
346
355
|
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;
|
|
369
356
|
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, editConfig: 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 {};
|