@logicflow/core 1.0.0-alpha.1 → 1.0.0-alpha.10
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/README.md +1 -1
- package/dist/logic-flow.js +2 -2
- package/dist/style/index.css +1 -1
- package/package.json +2 -4
- package/types/LogicFlow.d.ts +341 -137
- package/types/constant/DefaultTheme.d.ts +260 -171
- package/types/constant/constant.d.ts +7 -1
- package/types/keyboard/index.d.ts +1 -5
- package/types/model/BaseModel.d.ts +8 -8
- package/types/model/EditConfigModel.d.ts +6 -16
- package/types/model/GraphModel.d.ts +280 -61
- package/types/model/SnaplineModel.d.ts +6 -2
- package/types/model/TransformModel.d.ts +8 -2
- package/types/model/edge/BaseEdgeModel.d.ts +92 -42
- package/types/model/edge/BezierEdgeModel.d.ts +10 -2
- package/types/model/edge/LineEdgeModel.d.ts +6 -1
- package/types/model/edge/PolylineEdgeModel.d.ts +8 -3
- package/types/model/node/BaseNodeModel.d.ts +81 -56
- package/types/model/node/CircleNodeModel.d.ts +7 -2
- 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 +6 -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 +29 -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 -37
- 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
- package/types/view/text/BaseText.d.ts +0 -2
- package/dist/logic-flow.es.js +0 -74
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { ModelType } from '../../constant/constant';
|
|
2
2
|
import { Point } from '../../type';
|
|
3
3
|
import BaseEdgeModel from './BaseEdgeModel';
|
|
4
|
-
import GraphModel from '../GraphModel';
|
|
5
4
|
export { PolylineEdgeModel };
|
|
6
5
|
export default class PolylineEdgeModel extends BaseEdgeModel {
|
|
7
6
|
modelType: ModelType;
|
|
8
|
-
offset:
|
|
7
|
+
offset: any;
|
|
9
8
|
draginngPointList: any;
|
|
10
9
|
dbClickPosition: Point;
|
|
11
|
-
|
|
10
|
+
initEdgeData(data: any): void;
|
|
11
|
+
getEdgeStyle(): {
|
|
12
|
+
[x: string]: any;
|
|
13
|
+
fill?: string;
|
|
14
|
+
stroke?: string;
|
|
15
|
+
strokeWidth?: number;
|
|
16
|
+
};
|
|
12
17
|
getTextPosition(): {
|
|
13
18
|
x: number;
|
|
14
19
|
y: number;
|
|
@@ -1,10 +1,11 @@
|
|
|
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 = {
|
|
6
7
|
message: string;
|
|
7
|
-
validate: (source
|
|
8
|
+
validate: (source?: BaseNodeModel, target?: BaseNodeModel, sourceAnchor?: AnchorConfig, targetAnchor?: AnchorConfig) => boolean;
|
|
8
9
|
};
|
|
9
10
|
export declare type ConnectRuleResult = {
|
|
10
11
|
isAllPass: boolean;
|
|
@@ -19,70 +20,52 @@ interface IBaseNodeModel extends IBaseModel {
|
|
|
19
20
|
export { BaseNodeModel };
|
|
20
21
|
export default class BaseNodeModel implements IBaseNodeModel {
|
|
21
22
|
id: string;
|
|
22
|
-
readonly BaseType = ElementType.NODE;
|
|
23
|
-
modelType: ModelType;
|
|
24
|
-
additionStateData: AdditionData;
|
|
25
|
-
[propName: string]: any;
|
|
26
|
-
targetRules: ConnectRule[];
|
|
27
|
-
sourceRules: ConnectRule[];
|
|
28
|
-
moveRules: NodeMoveRule[];
|
|
29
|
-
hasSetTargetRules: boolean;
|
|
30
|
-
hasSetSourceRules: boolean;
|
|
31
|
-
properties: Record<string, any>;
|
|
32
23
|
type: string;
|
|
33
24
|
x: number;
|
|
34
25
|
y: number;
|
|
26
|
+
text: {
|
|
27
|
+
value: string;
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
draggable: boolean;
|
|
31
|
+
editable: boolean;
|
|
32
|
+
};
|
|
33
|
+
properties: Record<string, any>;
|
|
35
34
|
private _width;
|
|
36
|
-
graphModel: GraphModel;
|
|
37
35
|
get width(): number;
|
|
38
36
|
set width(value: number);
|
|
39
37
|
private _height;
|
|
40
38
|
get height(): number;
|
|
41
39
|
set height(value: number);
|
|
42
|
-
|
|
43
|
-
fillOpacity: number;
|
|
44
|
-
strokeWidth: number;
|
|
45
|
-
stroke: string;
|
|
46
|
-
strokeOpacity: number;
|
|
47
|
-
opacity: number;
|
|
48
|
-
outlineColor: string;
|
|
49
|
-
hideOutline: boolean;
|
|
50
|
-
hoverOutlineColor: string;
|
|
51
|
-
outlineStrokeDashArray: string;
|
|
52
|
-
hoverOutlineStrokeDashArray: string;
|
|
40
|
+
anchorsOffset: AnchorsOffsetItem[];
|
|
53
41
|
isSelected: boolean;
|
|
54
42
|
isHovered: boolean;
|
|
43
|
+
isDragging: boolean;
|
|
55
44
|
isHitable: boolean;
|
|
45
|
+
draggable: boolean;
|
|
46
|
+
graphModel: GraphModel;
|
|
56
47
|
zIndex: number;
|
|
57
|
-
anchorsOffset: AnchorsOffsetItem[];
|
|
58
48
|
state: number;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
49
|
+
readonly BaseType = ElementType.NODE;
|
|
50
|
+
modelType: ModelType;
|
|
51
|
+
additionStateData: AdditionData;
|
|
52
|
+
targetRules: ConnectRule[];
|
|
53
|
+
sourceRules: ConnectRule[];
|
|
54
|
+
moveRules: NodeMoveRule[];
|
|
55
|
+
hasSetTargetRules: boolean;
|
|
56
|
+
hasSetSourceRules: boolean;
|
|
57
|
+
[propName: string]: any;
|
|
58
|
+
constructor(data: NodeConfig, graphModel: GraphModel);
|
|
68
59
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
60
|
+
* @overridable 可以重写
|
|
61
|
+
* 初始化节点数据
|
|
71
62
|
* initNodeData和setAttributes的区别在于
|
|
72
|
-
* initNodeData
|
|
73
|
-
|
|
74
|
-
protected initNodeData(data: any): void;
|
|
75
|
-
/**
|
|
76
|
-
* @overridable 支持重新
|
|
77
|
-
* @returns string
|
|
78
|
-
*/
|
|
79
|
-
createId(): string;
|
|
80
|
-
/**
|
|
81
|
-
* 初始化文本属性,对
|
|
63
|
+
* initNodeData只在节点初始化的时候调用,用于初始化节点的所有属性。
|
|
64
|
+
* setAttributes除了初始化调用外,还会在properties发生变化了调用。
|
|
82
65
|
*/
|
|
83
|
-
|
|
66
|
+
initNodeData(data: any): void;
|
|
84
67
|
/**
|
|
85
|
-
* 设置model
|
|
68
|
+
* 设置model属性,每次properties发生变化会触发
|
|
86
69
|
* 例如设置节点的宽度
|
|
87
70
|
* @example
|
|
88
71
|
*
|
|
@@ -94,15 +77,56 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
94
77
|
* @overridable 支持重写
|
|
95
78
|
*/
|
|
96
79
|
setAttributes(): void;
|
|
80
|
+
/**
|
|
81
|
+
* @overridable 支持重写,自定义此类型节点默认生成方式
|
|
82
|
+
* @returns string
|
|
83
|
+
*/
|
|
84
|
+
createId(): string;
|
|
85
|
+
/**
|
|
86
|
+
* 初始化文本属性
|
|
87
|
+
*/
|
|
88
|
+
private formatText;
|
|
97
89
|
/**
|
|
98
90
|
* 获取被保存时返回的数据
|
|
99
91
|
* @overridable 支持重写
|
|
100
|
-
* @returns NodeData
|
|
101
92
|
*/
|
|
102
93
|
getData(): NodeData;
|
|
94
|
+
/**
|
|
95
|
+
* 获取当前节点的properties
|
|
96
|
+
*/
|
|
103
97
|
getProperties(): Record<string, any>;
|
|
104
98
|
/**
|
|
105
|
-
*
|
|
99
|
+
* @overridable 支持重写
|
|
100
|
+
* 获取当前节点样式
|
|
101
|
+
* @returns 自定义节点样式
|
|
102
|
+
*/
|
|
103
|
+
getNodeStyle(): ShapeStyleAttribute;
|
|
104
|
+
/**
|
|
105
|
+
* @overridable 支持重写
|
|
106
|
+
* 获取当前节点文本样式
|
|
107
|
+
*/
|
|
108
|
+
getTextStyle(): import("../../constant/DefaultTheme").NodeTextTheme;
|
|
109
|
+
/**
|
|
110
|
+
* @overridable 支持重写
|
|
111
|
+
* 获取当前节点锚点样式
|
|
112
|
+
* @returns 自定义样式
|
|
113
|
+
*/
|
|
114
|
+
getAnchorStyle(): Record<string, any>;
|
|
115
|
+
/**
|
|
116
|
+
* @overridable 支持重写
|
|
117
|
+
* 获取当前节点锚点拖出连线样式
|
|
118
|
+
* @returns 自定义锚点拖出样式
|
|
119
|
+
*/
|
|
120
|
+
getAnchorLineStyle(): import("../../constant/DefaultTheme").CommonTheme;
|
|
121
|
+
/**
|
|
122
|
+
* @overridable 支持重写
|
|
123
|
+
* 获取outline样式,重写可以定义此类型节点outline样式, 默认使用主题样式
|
|
124
|
+
* @returns 自定义outline样式
|
|
125
|
+
*/
|
|
126
|
+
getOutlineStyle(): OutlineTheme;
|
|
127
|
+
/**
|
|
128
|
+
* @over
|
|
129
|
+
* 在边的时候,是否允许这个节点为source节点,边到target节点。
|
|
106
130
|
*/
|
|
107
131
|
isAllowConnectedAsSource(target: BaseNodeModel, soureAnchor: AnchorConfig, targetAnchor: AnchorConfig): ConnectRuleResult | Boolean;
|
|
108
132
|
/**
|
|
@@ -110,13 +134,17 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
110
134
|
*/
|
|
111
135
|
getConnectedSourceRules(): ConnectRule[];
|
|
112
136
|
/**
|
|
113
|
-
*
|
|
137
|
+
* 在连线的时候,是否允许这个节点为target节点
|
|
114
138
|
*/
|
|
115
139
|
isAllowConnectedAsTarget(source: BaseNodeModel, soureAnchor: AnchorConfig, targetAnchor: AnchorConfig): ConnectRuleResult | Boolean;
|
|
116
140
|
/**
|
|
141
|
+
* 内部方法
|
|
117
142
|
* 是否允许移动节点到新的位置
|
|
118
143
|
*/
|
|
119
144
|
isAllowMoveNode(deltaX: any, deltaY: any): boolean;
|
|
145
|
+
/**
|
|
146
|
+
* 获取作为连线终点时的所有规则。
|
|
147
|
+
*/
|
|
120
148
|
getConnectedTargetRules(): ConnectRule[];
|
|
121
149
|
/**
|
|
122
150
|
* @overridable 子类重写此方法设置锚点
|
|
@@ -140,12 +168,9 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
140
168
|
setSelected(flag?: boolean): void;
|
|
141
169
|
setHovered(flag?: boolean): void;
|
|
142
170
|
setHitable(flag?: boolean): void;
|
|
143
|
-
setElementState(state:
|
|
144
|
-
updateStroke(color: any): void;
|
|
145
|
-
updateData(nodeAttribute: NodeAttribute): void;
|
|
171
|
+
setElementState(state: number, additionStateData?: AdditionData): void;
|
|
146
172
|
setProperty(key: any, val: any): void;
|
|
147
173
|
setProperties(properties: any): void;
|
|
148
|
-
setStyleFromTheme(type: any, graphModel: any): void;
|
|
149
174
|
setZIndex(zindex?: number): void;
|
|
150
175
|
updateAttributes(attributes: any): void;
|
|
151
176
|
}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import BaseNodeModel from './BaseNodeModel';
|
|
2
2
|
import { ModelType } from '../../constant/constant';
|
|
3
|
-
import GraphModel from '../GraphModel';
|
|
4
3
|
declare class CircleNodeModel extends BaseNodeModel {
|
|
5
4
|
modelType: ModelType;
|
|
6
5
|
r: number;
|
|
7
|
-
constructor(data: any, graphModel: GraphModel);
|
|
8
6
|
get width(): number;
|
|
9
7
|
get height(): number;
|
|
8
|
+
getNodeStyle(): {
|
|
9
|
+
[x: string]: any;
|
|
10
|
+
r?: number;
|
|
11
|
+
fill?: string;
|
|
12
|
+
stroke?: string;
|
|
13
|
+
strokeWidth?: number;
|
|
14
|
+
};
|
|
10
15
|
getDetaultAnchor(): {
|
|
11
16
|
x: number;
|
|
12
17
|
y: number;
|
|
@@ -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,15 @@
|
|
|
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
|
+
};
|
|
9
13
|
/**
|
|
10
14
|
* 由于大多数情况下,我们初始化拿到的多边形坐标都是基于原点的(例如绘图工具到处的svg)。
|
|
11
15
|
* 在logicflow中对多边形进行移动,我们不需要去更新points,
|
|
@@ -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,6 +23,7 @@ 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;
|
|
@@ -124,7 +125,11 @@ export declare type EdgeFilter = {
|
|
|
124
125
|
};
|
|
125
126
|
export declare type EdgeConfig = {
|
|
126
127
|
id?: string;
|
|
127
|
-
|
|
128
|
+
/**
|
|
129
|
+
* 边的类型,不传默认为lf.setDefaultEdgeType(type)传入的类型。
|
|
130
|
+
* LogicFlow内部默认为polyline
|
|
131
|
+
*/
|
|
132
|
+
type?: string;
|
|
128
133
|
sourceNodeId: string;
|
|
129
134
|
sourceAnchorId?: string;
|
|
130
135
|
targetNodeId: string;
|
|
@@ -164,9 +169,7 @@ export declare type CommonStyle = {
|
|
|
164
169
|
strokeOpacity?: number;
|
|
165
170
|
opacity?: number;
|
|
166
171
|
outlineColor?: string;
|
|
167
|
-
hoverOutlineColor?: string;
|
|
168
172
|
outlineStrokeDashArray?: string;
|
|
169
|
-
hoverOutlineStrokeDashArray?: string;
|
|
170
173
|
};
|
|
171
174
|
export declare type RectStyle = CommonStyle & {
|
|
172
175
|
width?: number;
|
|
@@ -226,25 +229,10 @@ export declare type TextStyle = {
|
|
|
226
229
|
fontFamily?: string;
|
|
227
230
|
};
|
|
228
231
|
export declare type NodeTextStyle = TextStyle & {
|
|
229
|
-
autoWrap?: boolean;
|
|
230
|
-
lineHeight?: number;
|
|
231
|
-
wrapPadding?: string;
|
|
232
|
-
};
|
|
233
|
-
export declare type EdgeTextStyle = TextStyle & {
|
|
234
|
-
background?: {
|
|
235
|
-
fill?: string;
|
|
236
|
-
stroke?: string;
|
|
237
|
-
radius?: number;
|
|
238
|
-
};
|
|
239
|
-
hoverBackground?: {
|
|
240
|
-
fill?: string;
|
|
241
|
-
stroke?: string;
|
|
242
|
-
radius?: number;
|
|
243
|
-
};
|
|
244
|
-
autoWrap?: boolean;
|
|
245
232
|
lineHeight?: number;
|
|
246
233
|
wrapPadding?: string;
|
|
247
234
|
};
|
|
235
|
+
export declare type EdgeTextStyle = TextStyle & EdgeTextTheme;
|
|
248
236
|
export declare type ArrowStyle = {
|
|
249
237
|
offset?: number;
|
|
250
238
|
verticalLength?: number;
|
|
@@ -254,24 +242,6 @@ export declare type EdgeAdjustStyle = {
|
|
|
254
242
|
fill?: string;
|
|
255
243
|
stroke?: string;
|
|
256
244
|
};
|
|
257
|
-
export declare type Style = {
|
|
258
|
-
rect?: RectStyle;
|
|
259
|
-
circle?: CircleStyle;
|
|
260
|
-
ellipse?: EllipseStyle;
|
|
261
|
-
diamond?: DiamondStyle;
|
|
262
|
-
polygon?: PolygonStyle;
|
|
263
|
-
anchor?: AnchorStyle;
|
|
264
|
-
text?: TextStyle;
|
|
265
|
-
nodeText?: NodeTextStyle;
|
|
266
|
-
edgeText?: EdgeTextStyle;
|
|
267
|
-
line?: LineStyle;
|
|
268
|
-
polyline?: PolylineStyle;
|
|
269
|
-
bezier?: BezierStyle;
|
|
270
|
-
arrow?: ArrowStyle;
|
|
271
|
-
anchorLine?: AnchorLineStyle;
|
|
272
|
-
anchorHover?: AnchorHoverStyle;
|
|
273
|
-
EdgeAdjustStyle?: EdgeAdjustStyle;
|
|
274
|
-
};
|
|
275
245
|
export declare type GraphTransform = {
|
|
276
246
|
transform: string;
|
|
277
247
|
transformOrigin: string;
|
|
@@ -374,4 +344,26 @@ export declare type AnchorConfig = {
|
|
|
374
344
|
*/
|
|
375
345
|
export declare type NodeMoveRule = (model: BaseNodeModel, deltaX: number, deltaY: number) => Boolean;
|
|
376
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;
|
|
377
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 {};
|