@logicflow/core 1.2.0-next.1 → 1.2.0-next.2
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 +81 -35
- package/dist/logic-flow.js +10900 -9644
- package/dist/logic-flow.min.js +15 -1
- package/dist/style/index.css +2 -12
- package/package.json +5 -4
- package/types/LogicFlow.d.ts +16 -10
- package/types/constant/constant.d.ts +7 -6
- package/types/history/History.d.ts +2 -4
- package/types/index.d.ts +5 -4
- package/types/model/BaseModel.d.ts +2 -2
- package/types/model/EditConfigModel.d.ts +0 -6
- package/types/model/GraphModel.d.ts +3 -2
- package/types/model/edge/BaseEdgeModel.d.ts +7 -8
- package/types/model/edge/BezierEdgeModel.d.ts +0 -1
- package/types/model/edge/PolylineEdgeModel.d.ts +4 -17
- package/types/model/node/BaseNodeModel.d.ts +25 -28
- package/types/model/node/CircleNodeModel.d.ts +0 -1
- package/types/model/node/DiamondNodeModel.d.ts +0 -1
- package/types/model/node/EllipseNodeModel.d.ts +0 -1
- package/types/model/node/PolygonNodeModel.d.ts +0 -1
- package/types/model/node/RectNodeModel.d.ts +0 -1
- package/types/model/node/TextNodeModel.d.ts +0 -1
- package/types/options.d.ts +8 -16
- package/types/type/index.d.ts +13 -10
- package/types/util/drag.d.ts +3 -1
- package/types/util/edge.d.ts +2 -13
- package/types/util/node.d.ts +2 -1
- package/types/view/Anchor.d.ts +3 -1
- package/types/view/basic-shape/LinearGradient.d.ts +1 -0
- package/types/view/behavior/Transform.d.ts +4 -0
- package/types/view/edge/AdjustPoint.d.ts +9 -4
- package/types/view/edge/BaseEdge.d.ts +3 -7
- package/types/view/node/BaseNode.d.ts +0 -1
- package/types/view/node/HtmlNode.d.ts +2 -2
- package/types/view/overlay/CanvasOverlay.d.ts +0 -5
- package/types/view/text/BaseText.d.ts +0 -1
package/dist/style/index.css
CHANGED
|
@@ -6,9 +6,6 @@
|
|
|
6
6
|
background: #ffffff;
|
|
7
7
|
user-select: none;
|
|
8
8
|
}
|
|
9
|
-
.lf-graph svg {
|
|
10
|
-
display: block;
|
|
11
|
-
}
|
|
12
9
|
.lf-element-text {
|
|
13
10
|
cursor: text;
|
|
14
11
|
}
|
|
@@ -35,9 +32,9 @@
|
|
|
35
32
|
}
|
|
36
33
|
.lf-edge-animation {
|
|
37
34
|
stroke-dashoffset: 100%;
|
|
38
|
-
animation:
|
|
35
|
+
animation: lf_animate_dash 5s linear infinite;
|
|
39
36
|
}
|
|
40
|
-
@keyframes
|
|
37
|
+
@keyframes lf_animate_dash {
|
|
41
38
|
to {
|
|
42
39
|
stroke-dashoffset: 0;
|
|
43
40
|
}
|
|
@@ -196,10 +193,3 @@
|
|
|
196
193
|
.lf-edge-adjust-point {
|
|
197
194
|
cursor: move;
|
|
198
195
|
}
|
|
199
|
-
/*
|
|
200
|
-
* svg默认会多5px,强制全部设置为block
|
|
201
|
-
* @see https://stackoverflow.com/questions/41437423/difference-between-display-inline-and-block-on-svg-elements
|
|
202
|
-
*/
|
|
203
|
-
.lf-graph svg {
|
|
204
|
-
display: block;
|
|
205
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logicflow/core",
|
|
3
|
-
"version": "1.2.0-next.
|
|
3
|
+
"version": "1.2.0-next.2",
|
|
4
4
|
"description": "LogicFlow core, to quickly build flowchart editor",
|
|
5
5
|
"main": "dist/entry.js",
|
|
6
6
|
"module": "dist/logic-flow.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"build": "npm run build:umd",
|
|
22
22
|
"build:umd": "cross-env NODE_ENV=production webpack --config scripts/webpack.config.build.js && npm run copy",
|
|
23
23
|
"build-analyse": "cross-env analyse=true npm run build",
|
|
24
|
-
"types": "tsc -d --declarationDir ./
|
|
24
|
+
"types": "tsc -d --declarationDir ./types --outDir temp && rimraf temp",
|
|
25
25
|
"lint": "eslint . --ext .ts,.tsx",
|
|
26
26
|
"publish-lib": "npm run types & npm run clean && npm run build && npm publish",
|
|
27
27
|
"publish-next": "npm run types & npm run clean && npm run build && npm publish --tag next",
|
|
@@ -76,8 +76,9 @@
|
|
|
76
76
|
"ids": "^1.0.0",
|
|
77
77
|
"less-loader": "^6.0.0",
|
|
78
78
|
"lodash-es": "^4.17.15",
|
|
79
|
-
"mobx": "^
|
|
80
|
-
"mobx-react": "^
|
|
79
|
+
"mobx": "^5.15.7",
|
|
80
|
+
"mobx-react": "^6.3.0",
|
|
81
|
+
"mobx-utils": "^5.6.1",
|
|
81
82
|
"prettier": "^2.2.1",
|
|
82
83
|
"rimraf": "^3.0.2",
|
|
83
84
|
"standard-version": "^9.0.0",
|
package/types/LogicFlow.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { EdgeConfig, EdgeFilter, NodeConfig, Extension, ComponentRender, FocusOn
|
|
|
10
10
|
import SnaplineModel from './model/SnaplineModel';
|
|
11
11
|
import { EditConfigInterface } from './model/EditConfigModel';
|
|
12
12
|
import { Theme } from './constant/DefaultTheme';
|
|
13
|
+
import { EventType } from './constant/constant';
|
|
13
14
|
declare type GraphConfigModel = {
|
|
14
15
|
nodes: _Model.BaseNodeModel[];
|
|
15
16
|
edges: _Model.BaseEdgeModel[];
|
|
@@ -19,6 +20,14 @@ export default class LogicFlow {
|
|
|
19
20
|
* 只读:logicflow实例挂载的容器。
|
|
20
21
|
*/
|
|
21
22
|
container: HTMLElement;
|
|
23
|
+
/**
|
|
24
|
+
* 只读:画布宽度
|
|
25
|
+
*/
|
|
26
|
+
width: number;
|
|
27
|
+
/**
|
|
28
|
+
* 只读:画布高度
|
|
29
|
+
*/
|
|
30
|
+
height: number;
|
|
22
31
|
/**
|
|
23
32
|
* 只读:控制整个logicflow画布的model
|
|
24
33
|
*/
|
|
@@ -108,8 +117,9 @@ export default class LogicFlow {
|
|
|
108
117
|
* 将图形选中
|
|
109
118
|
* @param id 选择元素ID
|
|
110
119
|
* @param multiple 是否允许多选,如果为true,不会将上一个选中的元素重置
|
|
120
|
+
* @param toFront 是否将选中的元素置顶,默认为true
|
|
111
121
|
*/
|
|
112
|
-
selectElementById(id: string, multiple?: boolean): void;
|
|
122
|
+
selectElementById(id: string, multiple?: boolean, toFront?: boolean): void;
|
|
113
123
|
/**
|
|
114
124
|
* 定位到画布视口中心
|
|
115
125
|
* 支持用户传入图形当前的坐标或id,可以通过type来区分是节点还是边的id,也可以不传(兜底)
|
|
@@ -176,8 +186,9 @@ export default class LogicFlow {
|
|
|
176
186
|
/**
|
|
177
187
|
* 添加节点
|
|
178
188
|
* @param nodeConfig 节点配置
|
|
189
|
+
* @param eventType 新增节点事件类型,默认EventType.NODE_ADD
|
|
179
190
|
*/
|
|
180
|
-
addNode(nodeConfig: NodeConfig): _Model.BaseNodeModel;
|
|
191
|
+
addNode(nodeConfig: NodeConfig, eventType?: EventType): _Model.BaseNodeModel;
|
|
181
192
|
/**
|
|
182
193
|
* 删除节点
|
|
183
194
|
* @param {string} nodeId 节点Id
|
|
@@ -478,7 +489,7 @@ export default class LogicFlow {
|
|
|
478
489
|
/**
|
|
479
490
|
* 触发监听事件
|
|
480
491
|
*/
|
|
481
|
-
emit(evt: string, arg
|
|
492
|
+
emit(evt: string, arg: any): void;
|
|
482
493
|
/**
|
|
483
494
|
* 添加扩展, 待讨论,这里是不是静态方法好一些?
|
|
484
495
|
* 重复添加插件的时候,把上一次添加的插件的销毁。
|
|
@@ -524,12 +535,7 @@ export default class LogicFlow {
|
|
|
524
535
|
* 用于fakerNode移除对齐线
|
|
525
536
|
*/
|
|
526
537
|
setView(type: string, component: any): void;
|
|
527
|
-
|
|
528
|
-
* 内部保留方法
|
|
529
|
-
* 用于支持国际化
|
|
530
|
-
*/
|
|
531
|
-
static t(text: string): string;
|
|
532
|
-
renderRawData(graphRawData: any, isForce?: boolean): void;
|
|
538
|
+
renderRawData(graphRawData: any): void;
|
|
533
539
|
/**
|
|
534
540
|
* 渲染图
|
|
535
541
|
* @example
|
|
@@ -558,7 +564,7 @@ export default class LogicFlow {
|
|
|
558
564
|
* })
|
|
559
565
|
* @param graphData 图数据
|
|
560
566
|
*/
|
|
561
|
-
render(graphData?: {}
|
|
567
|
+
render(graphData?: {}): void;
|
|
562
568
|
/**
|
|
563
569
|
* 内部保留方法
|
|
564
570
|
* 获取指定类型的view
|
|
@@ -46,8 +46,6 @@ export declare enum EventType {
|
|
|
46
46
|
NODE_MOUSEMOVE = "node:mousemove",
|
|
47
47
|
NODE_MOUSEENTER = "node:mouseenter",
|
|
48
48
|
NODE_MOUSELEAVE = "node:mouseleave",
|
|
49
|
-
NODE_TEXT_UPDATE = "node:text-update",
|
|
50
|
-
NODE_PROPERTY_UPDATE = "node:property-update",
|
|
51
49
|
NODE_CONTEXTMENU = "node:contextmenu",
|
|
52
50
|
EDGE_DELETE = "edge:delete",
|
|
53
51
|
EDGE_ADD = "edge:add",
|
|
@@ -55,8 +53,6 @@ export declare enum EventType {
|
|
|
55
53
|
EDGE_DBCLICK = "edge:dbclick",
|
|
56
54
|
EDGE_MOUSEENTER = "edge:mouseenter",
|
|
57
55
|
EDGE_MOUSELEAVE = "edge:mouseleave",
|
|
58
|
-
EDGE_TEXT_UPDATE = "edge:text-update",
|
|
59
|
-
EDGE_PROPERTY_UPDATE = "edge:property-update",
|
|
60
56
|
EDGE_CONTEXTMENU = "edge:contextmenu",
|
|
61
57
|
EDGE_ADJUST = "edge:adjust",
|
|
62
58
|
EDGE_EXCHANGE_NODE = "edge:exchange-node",
|
|
@@ -64,6 +60,13 @@ export declare enum EventType {
|
|
|
64
60
|
ANCHOR_DRAG = "anchor:drag",
|
|
65
61
|
ANCHOR_DROP = "anchor:drop",
|
|
66
62
|
ANCHOR_DRAGEND = "anchor:dragend",
|
|
63
|
+
ADJUST_POINT_MOUSEDOWN = "adjustPoint:mousedown",
|
|
64
|
+
ADJUST_POINT_MOUSEUP = "adjustPoint:mouseup",
|
|
65
|
+
ADJUST_POINT_MOUSEMOVE = "adjustPoint:mousemove",
|
|
66
|
+
ADJUST_POINT_DRAGSTART = "adjustPoint:dragstart",
|
|
67
|
+
ADJUST_POINT_DRAG = "adjustPoint:drag",
|
|
68
|
+
ADJUST_POINT_DROP = "adjustPoint:drop",
|
|
69
|
+
ADJUST_POINT_DRAGEND = "adjustPoint:dragend",
|
|
67
70
|
BLANK_MOUSEDOWN = "blank:mousedown",
|
|
68
71
|
BLANK_DRAGSTART = "blank:dragstart",
|
|
69
72
|
BLANK_DRAG = "blank:drag",
|
|
@@ -81,9 +84,7 @@ export declare enum EventType {
|
|
|
81
84
|
SELECTION_CONTEXTMENU = "selection:contextmenu",
|
|
82
85
|
CONNECTION_NOT_ALLOWED = "connection:not-allowed",
|
|
83
86
|
HISTORY_CHANGE = "history:change",
|
|
84
|
-
HISTORY_INSERT = "history:insert",
|
|
85
87
|
TEXT_UPDATE = "text:update",
|
|
86
|
-
TEXT_DROP = "text:drop",
|
|
87
88
|
GRAPH_TRANSFORM = "graph:transform",
|
|
88
89
|
GRAPH_RENDERED = "graph:rendered"
|
|
89
90
|
}
|
|
@@ -8,15 +8,13 @@ declare class History {
|
|
|
8
8
|
maxSize: number;
|
|
9
9
|
waitTime: number;
|
|
10
10
|
eventCenter: EventEmitter;
|
|
11
|
-
|
|
12
|
-
constructor(graphModel: any, isPropertiesChangeHistory: any);
|
|
11
|
+
constructor(eventCenter: any);
|
|
13
12
|
add(data: any): void;
|
|
14
13
|
undoAble(): boolean;
|
|
15
14
|
undo(): any;
|
|
16
15
|
redoAble(): boolean;
|
|
17
16
|
redo(): any;
|
|
18
|
-
|
|
19
|
-
listenHistoryChange: () => void;
|
|
17
|
+
watch(model: any): void;
|
|
20
18
|
}
|
|
21
19
|
export { History };
|
|
22
20
|
export default History;
|
package/types/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { h } from 'preact';
|
|
1
2
|
import LogicFlow from './LogicFlow';
|
|
2
3
|
import * as LogicFlowUtil from './util';
|
|
3
|
-
|
|
4
|
-
export { h }
|
|
5
|
-
export
|
|
6
|
-
export { LogicFlowUtil, version, LogicFlow };
|
|
4
|
+
export declare function observer<P>(props: P): any;
|
|
5
|
+
export { LogicFlow, h };
|
|
6
|
+
export { LogicFlowUtil };
|
|
7
7
|
export * from './type/index';
|
|
8
8
|
export * from './view';
|
|
9
9
|
export * from './model';
|
|
10
10
|
export * from './keyboard';
|
|
11
11
|
export * from './options';
|
|
12
|
+
export { ElementState, ModelType, ElementType, EventType } from './constant/constant';
|
|
12
13
|
export default LogicFlow;
|
|
@@ -72,14 +72,14 @@ interface IBaseModel {
|
|
|
72
72
|
* 在自定义节点的时候,可以重写此方法基于自己的规则生成id。
|
|
73
73
|
* 注意,此方法必须是同步的。
|
|
74
74
|
* 如果想要异步修改Id,建议删除此节点后再同一位置创建一个新的节点。
|
|
75
|
-
* @
|
|
75
|
+
* @overridable 可以重写
|
|
76
76
|
* @returns string
|
|
77
77
|
*/
|
|
78
78
|
createId(): string;
|
|
79
79
|
moveText(deltaX: number, deltaY: number): void;
|
|
80
80
|
updateText(value: string): void;
|
|
81
81
|
setSelected(flag: boolean): void;
|
|
82
|
-
setZIndex(
|
|
82
|
+
setZIndex(zindex?: number): void;
|
|
83
83
|
/**
|
|
84
84
|
* 设置Node|Edge等model的状态
|
|
85
85
|
* @param state 状态
|
|
@@ -2,7 +2,7 @@ import BaseNodeModel from './node/BaseNodeModel';
|
|
|
2
2
|
import BaseEdgeModel from './edge/BaseEdgeModel';
|
|
3
3
|
import EditConfigModel from './EditConfigModel';
|
|
4
4
|
import TransformModel from './TransformModel';
|
|
5
|
-
import { OverlapMode } from '../constant/constant';
|
|
5
|
+
import { EventType, OverlapMode } from '../constant/constant';
|
|
6
6
|
import { AdditionData, Point, NodeConfig, EdgeConfig, PointTuple, NodeMoveRule, GraphConfigData, VirtualRectSize } from '../type';
|
|
7
7
|
import EventEmitter from '../event/eventEmitter';
|
|
8
8
|
import { Theme } from '../constant/DefaultTheme';
|
|
@@ -272,8 +272,9 @@ declare class GraphModel {
|
|
|
272
272
|
/**
|
|
273
273
|
* 添加节点
|
|
274
274
|
* @param nodeConfig 节点配置
|
|
275
|
+
* @param eventType 新增节点事件类型,默认EventType.NODE_ADD
|
|
275
276
|
*/
|
|
276
|
-
addNode(nodeConfig: NodeConfig): any;
|
|
277
|
+
addNode(nodeConfig: NodeConfig, eventType?: EventType): any;
|
|
277
278
|
/**
|
|
278
279
|
* 克隆节点
|
|
279
280
|
* @param nodeId 节点Id
|
|
@@ -45,9 +45,8 @@ declare class BaseEdgeModel implements IBaseModel {
|
|
|
45
45
|
};
|
|
46
46
|
[propName: string]: any;
|
|
47
47
|
constructor(data: EdgeConfig, graphModel: GraphModel);
|
|
48
|
-
init(): void;
|
|
49
48
|
/**
|
|
50
|
-
* @
|
|
49
|
+
* @overridable 支持重写
|
|
51
50
|
* 初始化边数据
|
|
52
51
|
* initNodeData和setAttributes的区别在于
|
|
53
52
|
* initNodeData只在节点初始化的时候调用,用于初始化节点的所有属性。
|
|
@@ -56,16 +55,16 @@ declare class BaseEdgeModel implements IBaseModel {
|
|
|
56
55
|
initEdgeData(data: any): void;
|
|
57
56
|
/**
|
|
58
57
|
* 设置model属性,每次properties发生变化会触发
|
|
59
|
-
* @
|
|
58
|
+
* @overridable 支持重写
|
|
60
59
|
*/
|
|
61
60
|
setAttributes(): void;
|
|
62
61
|
/**
|
|
63
|
-
* @
|
|
62
|
+
* @overridable 支持重写,自定义此类型节点默认生成方式
|
|
64
63
|
* @returns string
|
|
65
64
|
*/
|
|
66
65
|
createId(): any;
|
|
67
66
|
/**
|
|
68
|
-
* @
|
|
67
|
+
* @overridable 支持重写
|
|
69
68
|
* 获取当前节点样式
|
|
70
69
|
* @returns 自定义边样式
|
|
71
70
|
*/
|
|
@@ -76,12 +75,12 @@ declare class BaseEdgeModel implements IBaseModel {
|
|
|
76
75
|
strokeWidth?: number;
|
|
77
76
|
};
|
|
78
77
|
/**
|
|
79
|
-
* @
|
|
78
|
+
* @overridable 支持重写
|
|
80
79
|
* 获取当前节点文本样式
|
|
81
80
|
*/
|
|
82
81
|
getTextStyle(): import("../../constant/DefaultTheme").EdgeTextTheme;
|
|
83
82
|
/**
|
|
84
|
-
* @
|
|
83
|
+
* @overridable 支持重写
|
|
85
84
|
* 获取当前边的动画样式
|
|
86
85
|
* @returns 自定义边动画样式
|
|
87
86
|
*/
|
|
@@ -99,7 +98,7 @@ declare class BaseEdgeModel implements IBaseModel {
|
|
|
99
98
|
*/
|
|
100
99
|
getOutlineStyle(): OutlineTheme;
|
|
101
100
|
/**
|
|
102
|
-
* @
|
|
101
|
+
* @overridable 支持重新,重新自定义文本位置
|
|
103
102
|
* @returns 文本位置
|
|
104
103
|
*/
|
|
105
104
|
getTextPosition(): Point;
|
|
@@ -6,7 +6,6 @@ export default class PolylineEdgeModel extends BaseEdgeModel {
|
|
|
6
6
|
modelType: ModelType;
|
|
7
7
|
draggingPointList: any;
|
|
8
8
|
dbClickPosition: Point;
|
|
9
|
-
constructor(data: any, graphModel: any);
|
|
10
9
|
initEdgeData(data: any): void;
|
|
11
10
|
getEdgeStyle(): {
|
|
12
11
|
[x: string]: any;
|
|
@@ -37,27 +36,15 @@ export default class PolylineEdgeModel extends BaseEdgeModel {
|
|
|
37
36
|
moveEndPoint(deltaX: any, deltaY: any): void;
|
|
38
37
|
dragAppendStart(): void;
|
|
39
38
|
dragAppendSimple(appendInfo: any, dragInfo: any): {
|
|
40
|
-
start:
|
|
41
|
-
|
|
42
|
-
y: any;
|
|
43
|
-
};
|
|
44
|
-
end: {
|
|
45
|
-
x: any;
|
|
46
|
-
y: any;
|
|
47
|
-
};
|
|
39
|
+
start: any;
|
|
40
|
+
end: any;
|
|
48
41
|
startIndex: any;
|
|
49
42
|
endIndex: any;
|
|
50
43
|
direction: any;
|
|
51
44
|
};
|
|
52
45
|
dragAppend(appendInfo: any, dragInfo: any): {
|
|
53
|
-
start:
|
|
54
|
-
|
|
55
|
-
y: any;
|
|
56
|
-
};
|
|
57
|
-
end: {
|
|
58
|
-
x: any;
|
|
59
|
-
y: any;
|
|
60
|
-
};
|
|
46
|
+
start: any;
|
|
47
|
+
end: any;
|
|
61
48
|
startIndex: any;
|
|
62
49
|
endIndex: any;
|
|
63
50
|
direction: any;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { OutlineTheme } from '../../constant/DefaultTheme';
|
|
2
2
|
import { ModelType, ElementType } from '../../constant/constant';
|
|
3
|
-
import { AdditionData, NodeData, NodeConfig, NodeMoveRule, Bounds, AnchorConfig, PointAnchor, AnchorsOffsetItem, ShapeStyleAttribute, IsAllowMove } from '../../type';
|
|
3
|
+
import { AdditionData, NodeData, NodeConfig, NodeMoveRule, Bounds, AnchorConfig, PointAnchor, AnchorsOffsetItem, ShapeStyleAttribute, IsAllowMove, Point, AnchorInfo } from '../../type';
|
|
4
4
|
import GraphModel from '../GraphModel';
|
|
5
5
|
import { IBaseModel } from '../BaseModel';
|
|
6
6
|
import { BaseEdgeModel } from '../edge';
|
|
7
7
|
export declare type ConnectRule = {
|
|
8
8
|
message: string;
|
|
9
|
-
validate: (source?: BaseNodeModel, target?: BaseNodeModel, sourceAnchor?: AnchorConfig, targetAnchor?: AnchorConfig) => boolean;
|
|
9
|
+
validate: (source?: BaseNodeModel, target?: BaseNodeModel, sourceAnchor?: AnchorConfig, targetAnchor?: AnchorConfig, edgeId?: string) => boolean;
|
|
10
10
|
};
|
|
11
11
|
export declare type ConnectRuleResult = {
|
|
12
12
|
isAllPass: boolean;
|
|
@@ -41,9 +41,9 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
41
41
|
anchorsOffset: AnchorsOffsetItem[];
|
|
42
42
|
isSelected: boolean;
|
|
43
43
|
isHovered: boolean;
|
|
44
|
+
isShowAnchor: boolean;
|
|
44
45
|
isDragging: boolean;
|
|
45
46
|
isHitable: boolean;
|
|
46
|
-
isShowAnchor: boolean;
|
|
47
47
|
draggable: boolean;
|
|
48
48
|
visible: boolean;
|
|
49
49
|
virtual: boolean;
|
|
@@ -62,7 +62,6 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
62
62
|
hasSetSourceRules: boolean;
|
|
63
63
|
[propName: string]: any;
|
|
64
64
|
constructor(data: NodeConfig, graphModel: GraphModel);
|
|
65
|
-
init(): void;
|
|
66
65
|
/**
|
|
67
66
|
* 获取进入当前节点的边和节点
|
|
68
67
|
*/
|
|
@@ -75,7 +74,7 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
75
74
|
edges: BaseEdgeModel[];
|
|
76
75
|
};
|
|
77
76
|
/**
|
|
78
|
-
* @
|
|
77
|
+
* @overridable 可以重写
|
|
79
78
|
* 初始化节点数据
|
|
80
79
|
* initNodeData和setAttributes的区别在于
|
|
81
80
|
* initNodeData只在节点初始化的时候调用,用于初始化节点的所有属性。
|
|
@@ -92,11 +91,11 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
92
91
|
* this.height = 200
|
|
93
92
|
* }
|
|
94
93
|
*
|
|
95
|
-
* @
|
|
94
|
+
* @overridable 支持重写
|
|
96
95
|
*/
|
|
97
96
|
setAttributes(): void;
|
|
98
97
|
/**
|
|
99
|
-
* @
|
|
98
|
+
* @overridable 支持重写,自定义此类型节点默认生成方式
|
|
100
99
|
* @returns string
|
|
101
100
|
*/
|
|
102
101
|
createId(): string;
|
|
@@ -106,10 +105,9 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
106
105
|
private formatText;
|
|
107
106
|
/**
|
|
108
107
|
* 获取被保存时返回的数据
|
|
109
|
-
* @
|
|
108
|
+
* @overridable 支持重写
|
|
110
109
|
*/
|
|
111
110
|
getData(): NodeData;
|
|
112
|
-
setIsDragging(isDragging: any): void;
|
|
113
111
|
/**
|
|
114
112
|
* 用于在历史记录时获取节点数据,
|
|
115
113
|
* 在某些情况下,如果希望某个属性变化不引起history的变化,
|
|
@@ -121,30 +119,30 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
121
119
|
*/
|
|
122
120
|
getProperties(): Record<string, any>;
|
|
123
121
|
/**
|
|
124
|
-
* @
|
|
122
|
+
* @overridable 支持重写
|
|
125
123
|
* 获取当前节点样式
|
|
126
124
|
* @returns 自定义节点样式
|
|
127
125
|
*/
|
|
128
126
|
getNodeStyle(): ShapeStyleAttribute;
|
|
129
127
|
/**
|
|
130
|
-
* @
|
|
128
|
+
* @overridable 支持重写
|
|
131
129
|
* 获取当前节点文本样式
|
|
132
130
|
*/
|
|
133
131
|
getTextStyle(): import("../../constant/DefaultTheme").NodeTextTheme;
|
|
134
132
|
/**
|
|
135
|
-
* @
|
|
133
|
+
* @overridable 支持重写
|
|
136
134
|
* 获取当前节点锚点样式
|
|
137
135
|
* @returns 自定义样式
|
|
138
136
|
*/
|
|
139
137
|
getAnchorStyle(anchorInfo: any): Record<string, any>;
|
|
140
138
|
/**
|
|
141
|
-
* @
|
|
139
|
+
* @overridable 支持重写
|
|
142
140
|
* 获取当前节点锚点拖出连线样式
|
|
143
141
|
* @returns 自定义锚点拖出样式
|
|
144
142
|
*/
|
|
145
143
|
getAnchorLineStyle(anchorInfo: any): import("../../constant/DefaultTheme").CommonTheme;
|
|
146
144
|
/**
|
|
147
|
-
* @
|
|
145
|
+
* @overridable 支持重写
|
|
148
146
|
* 获取outline样式,重写可以定义此类型节点outline样式, 默认使用主题样式
|
|
149
147
|
* @returns 自定义outline样式
|
|
150
148
|
*/
|
|
@@ -152,16 +150,20 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
152
150
|
/**
|
|
153
151
|
* @over
|
|
154
152
|
* 在边的时候,是否允许这个节点为source节点,边到target节点。
|
|
153
|
+
*
|
|
154
|
+
* @param edgeId 调整的边的id,在开启adjustEdgeStartAndEnd后调整边连接的节点时会传入,见https://github.com/didi/LogicFlow/issues/926#issuecomment-1371823306
|
|
155
155
|
*/
|
|
156
|
-
isAllowConnectedAsSource(target: BaseNodeModel, sourceAnchor: AnchorConfig, targetAnchor: AnchorConfig): ConnectRuleResult | Boolean;
|
|
156
|
+
isAllowConnectedAsSource(target: BaseNodeModel, sourceAnchor: AnchorConfig, targetAnchor: AnchorConfig, edgeId?: string): ConnectRuleResult | Boolean;
|
|
157
157
|
/**
|
|
158
158
|
* 获取当前节点作为连接的起始节点规则。
|
|
159
159
|
*/
|
|
160
160
|
getConnectedSourceRules(): ConnectRule[];
|
|
161
161
|
/**
|
|
162
162
|
* 在连线的时候,是否允许这个节点为target节点
|
|
163
|
+
*
|
|
164
|
+
* @param edgeId 调整的边的id,在开启adjustEdgeStartAndEnd后调整边连接的节点时会传入,见https://github.com/didi/LogicFlow/issues/926#issuecomment-1371823306
|
|
163
165
|
*/
|
|
164
|
-
isAllowConnectedAsTarget(source: BaseNodeModel, sourceAnchor: AnchorConfig, targetAnchor: AnchorConfig): ConnectRuleResult | Boolean;
|
|
166
|
+
isAllowConnectedAsTarget(source: BaseNodeModel, sourceAnchor: AnchorConfig, targetAnchor: AnchorConfig, edgeId?: string): ConnectRuleResult | Boolean;
|
|
165
167
|
/**
|
|
166
168
|
* 内部方法
|
|
167
169
|
* 是否允许移动节点到新的位置
|
|
@@ -176,10 +178,15 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
176
178
|
*/
|
|
177
179
|
getAnchorsByOffset(): PointAnchor[];
|
|
178
180
|
/**
|
|
179
|
-
* @
|
|
181
|
+
* @overridable 子类重写此方法设置默认锚点
|
|
180
182
|
* 获取节点默认情况下的锚点
|
|
181
183
|
*/
|
|
182
184
|
getDefaultAnchor(): PointAnchor[];
|
|
185
|
+
/**
|
|
186
|
+
* @overridable 子类重写此方法获取手动连接边到节点时,需要连接的锚点
|
|
187
|
+
* 手动连接边到节点时,需要连接的锚点
|
|
188
|
+
*/
|
|
189
|
+
getTargetAnchor(position: Point): AnchorInfo;
|
|
183
190
|
/**
|
|
184
191
|
* 获取节点BBox
|
|
185
192
|
*/
|
|
@@ -203,16 +210,6 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
203
210
|
setStyle(key: any, val: any): void;
|
|
204
211
|
setStyles(styles: any): void;
|
|
205
212
|
updateStyles(styles: any): void;
|
|
206
|
-
setZIndex(
|
|
207
|
-
/**
|
|
208
|
-
* 设置节点属性;
|
|
209
|
-
* 支持属性请参考节点属性文档
|
|
210
|
-
* http://logic-flow.org/api/nodeModelApi.html#%E6%95%B0%E6%8D%AE%E5%B1%9E%E6%80%A7
|
|
211
|
-
* @example
|
|
212
|
-
* nodeModel.updateAttributes({
|
|
213
|
-
* width: 100,
|
|
214
|
-
* height: 100
|
|
215
|
-
* })
|
|
216
|
-
*/
|
|
213
|
+
setZIndex(zIndex?: number): void;
|
|
217
214
|
updateAttributes(attributes: any): void;
|
|
218
215
|
}
|
|
@@ -2,7 +2,6 @@ import BaseNodeModel from './BaseNodeModel';
|
|
|
2
2
|
import { ModelType } from '../../constant/constant';
|
|
3
3
|
declare class TextNodeModel extends BaseNodeModel {
|
|
4
4
|
modelType: ModelType;
|
|
5
|
-
constructor(data: any, graphModel: any);
|
|
6
5
|
getTextStyle(): {
|
|
7
6
|
[x: string]: any;
|
|
8
7
|
color?: string;
|
package/types/options.d.ts
CHANGED
|
@@ -60,13 +60,6 @@ export declare type Definition = {
|
|
|
60
60
|
* 是否开启历史记录功能,默认开启
|
|
61
61
|
*/
|
|
62
62
|
history?: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* 节点、连线的属性的变化是否会记录到history中,默认是。
|
|
65
|
-
* 例如:节点的一个属性为active, 在自定义节点时这个属性为true节点高亮。
|
|
66
|
-
* 那么在isPropertiesChangeHistory为true的情况下,将节点active设置为true
|
|
67
|
-
* 会在历史记录中多一个active为false的快照。
|
|
68
|
-
*/
|
|
69
|
-
isPropertiesChangeHistory?: boolean;
|
|
70
63
|
/**
|
|
71
64
|
* 是否开启局部渲染,默认不开启
|
|
72
65
|
*/
|
|
@@ -97,6 +90,10 @@ export declare type Definition = {
|
|
|
97
90
|
* 是否配置个性插件,覆盖全局配置的插件
|
|
98
91
|
*/
|
|
99
92
|
plugins?: Extension[];
|
|
93
|
+
/**
|
|
94
|
+
* 插件配置参数,包含所有插件的参数,用户在插件内进行访问,也可以再插件之间读取
|
|
95
|
+
*/
|
|
96
|
+
pluginsOptions?: Record<string, any>;
|
|
100
97
|
/**
|
|
101
98
|
* 控制是否开启动画
|
|
102
99
|
* false: 关闭所有动画
|
|
@@ -125,7 +122,6 @@ export declare function get(options: Definition): {
|
|
|
125
122
|
background: boolean;
|
|
126
123
|
grid: boolean;
|
|
127
124
|
textEdit: boolean;
|
|
128
|
-
isPropertiesChangeHistory: boolean;
|
|
129
125
|
disabledTools: any[];
|
|
130
126
|
} & {
|
|
131
127
|
[key: string]: any;
|
|
@@ -174,13 +170,6 @@ export declare function get(options: Definition): {
|
|
|
174
170
|
* 是否开启历史记录功能,默认开启
|
|
175
171
|
*/
|
|
176
172
|
history?: boolean;
|
|
177
|
-
/**
|
|
178
|
-
* 节点、连线的属性的变化是否会记录到history中,默认是。
|
|
179
|
-
* 例如:节点的一个属性为active, 在自定义节点时这个属性为true节点高亮。
|
|
180
|
-
* 那么在isPropertiesChangeHistory为true的情况下,将节点active设置为true
|
|
181
|
-
* 会在历史记录中多一个active为false的快照。
|
|
182
|
-
*/
|
|
183
|
-
isPropertiesChangeHistory?: boolean;
|
|
184
173
|
/**
|
|
185
174
|
* 是否开启局部渲染,默认不开启
|
|
186
175
|
*/
|
|
@@ -211,6 +200,10 @@ export declare function get(options: Definition): {
|
|
|
211
200
|
* 是否配置个性插件,覆盖全局配置的插件
|
|
212
201
|
*/
|
|
213
202
|
plugins?: Extension[];
|
|
203
|
+
/**
|
|
204
|
+
* 插件配置参数,包含所有插件的参数,用户在插件内进行访问,也可以再插件之间读取
|
|
205
|
+
*/
|
|
206
|
+
pluginsOptions?: Record<string, any>;
|
|
214
207
|
/**
|
|
215
208
|
* 控制是否开启动画
|
|
216
209
|
* false: 关闭所有动画
|
|
@@ -234,7 +227,6 @@ export declare const defaults: {
|
|
|
234
227
|
background: boolean;
|
|
235
228
|
grid: boolean;
|
|
236
229
|
textEdit: boolean;
|
|
237
|
-
isPropertiesChangeHistory: boolean;
|
|
238
230
|
disabledTools: any[];
|
|
239
231
|
};
|
|
240
232
|
export {};
|