@logicflow/core 1.2.0-alpha.2 → 1.2.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 +1 -15
- package/dist/style/index.css +3 -0
- package/package.json +4 -5
- package/types/LogicFlow.d.ts +3 -3
- package/types/constant/constant.d.ts +6 -0
- package/types/history/History.d.ts +4 -2
- package/types/index.d.ts +4 -4
- package/types/model/edge/BaseEdgeModel.d.ts +1 -0
- package/types/model/edge/BezierEdgeModel.d.ts +1 -0
- package/types/model/edge/PolylineEdgeModel.d.ts +1 -0
- package/types/model/node/BaseNodeModel.d.ts +12 -0
- package/types/model/node/CircleNodeModel.d.ts +1 -0
- package/types/model/node/DiamondNodeModel.d.ts +1 -0
- package/types/model/node/EllipseNodeModel.d.ts +1 -0
- package/types/model/node/PolygonNodeModel.d.ts +1 -0
- package/types/model/node/RectNodeModel.d.ts +1 -0
- package/types/model/node/TextNodeModel.d.ts +1 -0
- package/types/options.d.ts +16 -0
- package/types/tool/TextEditTool.d.ts +1 -0
- package/types/util/edge.d.ts +13 -2
- package/types/util/stateUtil.d.ts +4 -0
- package/types/view/overlay/CanvasOverlay.d.ts +5 -0
- package/types/view/text/BaseText.d.ts +1 -0
- package/types/view/basic-shape/LinearGradient.d.ts +0 -1
- package/types/view/behavior/Transform.d.ts +0 -4
package/dist/style/index.css
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logicflow/core",
|
|
3
|
-
"version": "1.2.0-alpha.
|
|
3
|
+
"version": "1.2.0-alpha.5",
|
|
4
4
|
"description": "LogicFlow core, to quickly build flowchart editor",
|
|
5
5
|
"main": "dist/logic-flow.js",
|
|
6
6
|
"unpkg": "dist/logic-flow.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"build": "npm run build:umd",
|
|
20
20
|
"build:umd": "cross-env NODE_ENV=production webpack --config scripts/webpack.config.build.js && cp -r src/style/ dist/style",
|
|
21
21
|
"build-analyse": "cross-env analyse=true npm run build",
|
|
22
|
-
"types": "tsc -d --declarationDir ./
|
|
22
|
+
"types": "tsc -d --declarationDir ./tempTypes --outDir temp && rimraf types && mv ./tempTypes/src ./types && rimraf temp && rimraf tempTypes",
|
|
23
23
|
"lint": "eslint . --ext .ts,.tsx",
|
|
24
24
|
"publish-lib": "npm run types & npm run clean && npm run build && npm publish",
|
|
25
25
|
"publish-next": "npm run types & npm run clean && npm run build && npm publish --tag next"
|
|
@@ -73,9 +73,8 @@
|
|
|
73
73
|
"ids": "^1.0.0",
|
|
74
74
|
"less-loader": "^6.0.0",
|
|
75
75
|
"lodash-es": "^4.17.15",
|
|
76
|
-
"mobx": "^5.
|
|
77
|
-
"mobx-react": "^
|
|
78
|
-
"mobx-utils": "^5.6.1",
|
|
76
|
+
"mobx": "^6.5.0",
|
|
77
|
+
"mobx-react": "^7.3.0",
|
|
79
78
|
"prettier": "^2.2.1",
|
|
80
79
|
"rimraf": "^3.0.2",
|
|
81
80
|
"standard-version": "^9.0.0",
|
package/types/LogicFlow.d.ts
CHANGED
|
@@ -468,7 +468,7 @@ export default class LogicFlow {
|
|
|
468
468
|
/**
|
|
469
469
|
* 触发监听事件
|
|
470
470
|
*/
|
|
471
|
-
emit(evt: string, arg
|
|
471
|
+
emit(evt: string, arg?: any): void;
|
|
472
472
|
/**
|
|
473
473
|
* 添加扩展, 待讨论,这里是不是静态方法好一些?
|
|
474
474
|
* 重复添加插件的时候,把上一次添加的插件的销毁。
|
|
@@ -519,7 +519,7 @@ export default class LogicFlow {
|
|
|
519
519
|
* 用于支持国际化
|
|
520
520
|
*/
|
|
521
521
|
static t(text: string): string;
|
|
522
|
-
renderRawData(graphRawData: any): void;
|
|
522
|
+
renderRawData(graphRawData: any, isForce?: boolean): void;
|
|
523
523
|
/**
|
|
524
524
|
* 渲染图
|
|
525
525
|
* @example
|
|
@@ -548,7 +548,7 @@ export default class LogicFlow {
|
|
|
548
548
|
* })
|
|
549
549
|
* @param graphData 图数据
|
|
550
550
|
*/
|
|
551
|
-
render(graphData?: {}): void;
|
|
551
|
+
render(graphData?: {}, isForce?: boolean): void;
|
|
552
552
|
/**
|
|
553
553
|
* 内部保留方法
|
|
554
554
|
* 获取指定类型的view
|
|
@@ -46,6 +46,8 @@ 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",
|
|
49
51
|
NODE_CONTEXTMENU = "node:contextmenu",
|
|
50
52
|
EDGE_DELETE = "edge:delete",
|
|
51
53
|
EDGE_ADD = "edge:add",
|
|
@@ -53,6 +55,8 @@ export declare enum EventType {
|
|
|
53
55
|
EDGE_DBCLICK = "edge:dbclick",
|
|
54
56
|
EDGE_MOUSEENTER = "edge:mouseenter",
|
|
55
57
|
EDGE_MOUSELEAVE = "edge:mouseleave",
|
|
58
|
+
EDGE_TEXT_UPDATE = "edge:text-update",
|
|
59
|
+
EDGE_PROPERTY_UPDATE = "edge:property-update",
|
|
56
60
|
EDGE_CONTEXTMENU = "edge:contextmenu",
|
|
57
61
|
EDGE_ADJUST = "edge:adjust",
|
|
58
62
|
EDGE_EXCHANGE_NODE = "edge:exchange-node",
|
|
@@ -76,7 +80,9 @@ export declare enum EventType {
|
|
|
76
80
|
SELECTION_CONTEXTMENU = "selection:contextmenu",
|
|
77
81
|
CONNECTION_NOT_ALLOWED = "connection:not-allowed",
|
|
78
82
|
HISTORY_CHANGE = "history:change",
|
|
83
|
+
HISTORY_INSERT = "history:insert",
|
|
79
84
|
TEXT_UPDATE = "text:update",
|
|
85
|
+
TEXT_DROP = "text:drop",
|
|
80
86
|
GRAPH_TRANSFORM = "graph:transform",
|
|
81
87
|
GRAPH_RENDERED = "graph:rendered"
|
|
82
88
|
}
|
|
@@ -8,13 +8,15 @@ declare class History {
|
|
|
8
8
|
maxSize: number;
|
|
9
9
|
waitTime: number;
|
|
10
10
|
eventCenter: EventEmitter;
|
|
11
|
-
|
|
11
|
+
model: any;
|
|
12
|
+
constructor(graphModel: any, isPropertiesChangeHistory: any);
|
|
12
13
|
add(data: any): void;
|
|
13
14
|
undoAble(): boolean;
|
|
14
15
|
undo(): any;
|
|
15
16
|
redoAble(): boolean;
|
|
16
17
|
redo(): any;
|
|
17
|
-
|
|
18
|
+
emitHistoryChange(): void;
|
|
19
|
+
listenHistoryChange: () => void;
|
|
18
20
|
}
|
|
19
21
|
export { History };
|
|
20
22
|
export default History;
|
package/types/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { h } from 'preact';
|
|
2
1
|
import LogicFlow from './LogicFlow';
|
|
3
2
|
import * as LogicFlowUtil from './util';
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
export
|
|
3
|
+
import { version } from '../package.json';
|
|
4
|
+
export { h } from 'preact';
|
|
5
|
+
export * from './util/stateUtil';
|
|
6
|
+
export { LogicFlowUtil, version, LogicFlow };
|
|
7
7
|
export * from './type/index';
|
|
8
8
|
export * from './view';
|
|
9
9
|
export * from './model';
|
|
@@ -38,6 +38,7 @@ declare class BaseEdgeModel implements IBaseModel {
|
|
|
38
38
|
animationData: import("../../constant/DefaultAnimation").Animation;
|
|
39
39
|
[propName: string]: any;
|
|
40
40
|
constructor(data: EdgeConfig, graphModel: GraphModel);
|
|
41
|
+
init(): void;
|
|
41
42
|
/**
|
|
42
43
|
* @override 支持重写
|
|
43
44
|
* 初始化边数据
|
|
@@ -59,6 +59,7 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
59
59
|
hasSetSourceRules: boolean;
|
|
60
60
|
[propName: string]: any;
|
|
61
61
|
constructor(data: NodeConfig, graphModel: GraphModel);
|
|
62
|
+
init(): void;
|
|
62
63
|
/**
|
|
63
64
|
* 获取进入当前节点的边和节点
|
|
64
65
|
*/
|
|
@@ -105,6 +106,7 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
105
106
|
* @override 支持重写
|
|
106
107
|
*/
|
|
107
108
|
getData(): NodeData;
|
|
109
|
+
setIsDragging(isDragging: any): void;
|
|
108
110
|
/**
|
|
109
111
|
* 用于在历史记录时获取节点数据,
|
|
110
112
|
* 在某些情况下,如果希望某个属性变化不引起history的变化,
|
|
@@ -193,5 +195,15 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
193
195
|
setProperty(key: any, val: any): void;
|
|
194
196
|
setProperties(properties: any): void;
|
|
195
197
|
setZIndex(zIndex?: number): void;
|
|
198
|
+
/**
|
|
199
|
+
* 设置节点属性;
|
|
200
|
+
* 支持属性请参考节点属性文档
|
|
201
|
+
* http://logic-flow.org/api/nodeModelApi.html#%E6%95%B0%E6%8D%AE%E5%B1%9E%E6%80%A7
|
|
202
|
+
* @example
|
|
203
|
+
* nodeModel.updateAttributes({
|
|
204
|
+
* width: 100,
|
|
205
|
+
* height: 100
|
|
206
|
+
* })
|
|
207
|
+
*/
|
|
196
208
|
updateAttributes(attributes: any): void;
|
|
197
209
|
}
|
|
@@ -2,6 +2,7 @@ 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);
|
|
5
6
|
getTextStyle(): {
|
|
6
7
|
[x: string]: any;
|
|
7
8
|
color?: string;
|
package/types/options.d.ts
CHANGED
|
@@ -60,6 +60,13 @@ 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;
|
|
63
70
|
/**
|
|
64
71
|
* 是否开启局部渲染,默认不开启
|
|
65
72
|
*/
|
|
@@ -107,6 +114,7 @@ export declare function get(options: Definition): {
|
|
|
107
114
|
background: boolean;
|
|
108
115
|
grid: boolean;
|
|
109
116
|
textEdit: boolean;
|
|
117
|
+
isPropertiesChangeHistory: boolean;
|
|
110
118
|
disabledTools: any[];
|
|
111
119
|
} & {
|
|
112
120
|
[key: string]: any;
|
|
@@ -155,6 +163,13 @@ export declare function get(options: Definition): {
|
|
|
155
163
|
* 是否开启历史记录功能,默认开启
|
|
156
164
|
*/
|
|
157
165
|
history?: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* 节点、连线的属性的变化是否会记录到history中,默认是。
|
|
168
|
+
* 例如:节点的一个属性为active, 在自定义节点时这个属性为true节点高亮。
|
|
169
|
+
* 那么在isPropertiesChangeHistory为true的情况下,将节点active设置为true
|
|
170
|
+
* 会在历史记录中多一个active为false的快照。
|
|
171
|
+
*/
|
|
172
|
+
isPropertiesChangeHistory?: boolean;
|
|
158
173
|
/**
|
|
159
174
|
* 是否开启局部渲染,默认不开启
|
|
160
175
|
*/
|
|
@@ -197,6 +212,7 @@ export declare const defaults: {
|
|
|
197
212
|
background: boolean;
|
|
198
213
|
grid: boolean;
|
|
199
214
|
textEdit: boolean;
|
|
215
|
+
isPropertiesChangeHistory: boolean;
|
|
200
216
|
disabledTools: any[];
|
|
201
217
|
};
|
|
202
218
|
export {};
|
|
@@ -28,6 +28,7 @@ export default class TextEdit extends Component<IProps, IState> {
|
|
|
28
28
|
componentDidUpdate(): void;
|
|
29
29
|
keyupHandler: (ev: any) => void;
|
|
30
30
|
inputHandler: (ev: any) => void;
|
|
31
|
+
keydownHandler: (ev: any) => void;
|
|
31
32
|
placeCaretAtEnd(el: any): void;
|
|
32
33
|
render(): h.JSX.Element;
|
|
33
34
|
}
|
package/types/util/edge.d.ts
CHANGED
|
@@ -26,8 +26,11 @@ export declare const isBboxOverLapping: (b1: PBBox, b2: PBBox) => boolean;
|
|
|
26
26
|
export declare const filterRepeatPoints: (points: PolyPoint[]) => PolyPoint[];
|
|
27
27
|
export declare const getSimplePolyline: (sPoint: PolyPoint, tPoint: PolyPoint) => PolyPoint[];
|
|
28
28
|
export declare const getExpandedBBox: (bbox: PBBox, offset: number) => PBBox;
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
/**
|
|
30
|
+
* 判断点与中心点边的方向:是否水平,true水平,false垂直
|
|
31
|
+
*/
|
|
32
|
+
export declare const pointDirection: (point: PolyPoint, node: BaseNode) => Direction;
|
|
33
|
+
export declare const getExpandedBBoxPoint: (bbox: PBBox, point: PolyPoint, direction: any) => PolyPoint;
|
|
31
34
|
export declare const mergeBBox: (b1: PBBox, b2: PBBox) => PBBox;
|
|
32
35
|
export declare const getBBoxOfPoints: (points?: PolyPoint[], offset?: number) => PBBox;
|
|
33
36
|
export declare const getPointsFromBBox: (bbox: PBBox) => PolyPoint[];
|
|
@@ -46,6 +49,14 @@ export declare const getNextNeighborPoints: (points: PolyPoint[], point: PolyPoi
|
|
|
46
49
|
export declare const pathFinder: (points: PolyPoint[], start: PolyPoint, goal: PolyPoint, sBBox: PBBox, tBBox: PBBox, os: PolyPoint, ot: PolyPoint) => PolyPoint[];
|
|
47
50
|
export declare const getBoxByOriginNode: (node: BaseNode) => PBBox;
|
|
48
51
|
export declare const pointFilter: (points: PolyPoint[]) => PolyPoint[];
|
|
52
|
+
/**
|
|
53
|
+
* 计算折线点
|
|
54
|
+
* @param start 连线的开始点坐标
|
|
55
|
+
* @param end 连线的结束点坐标
|
|
56
|
+
* @param sNode 连线连接的开始节点
|
|
57
|
+
* @param tNode 连线连接的结束节点
|
|
58
|
+
* @param offset 连线箭头距离
|
|
59
|
+
*/
|
|
49
60
|
export declare const getPolylinePoints: (start: PolyPoint, end: PolyPoint, sNode: BaseNode, tNode: BaseNode, offset: number) => PolyPoint[];
|
|
50
61
|
/**
|
|
51
62
|
* 获取折线中最长的一个线
|
|
@@ -13,7 +13,12 @@ declare class CanvasOverlay extends Component<IProps, IState> {
|
|
|
13
13
|
stepDrag: StepDrag;
|
|
14
14
|
stepScrollX: number;
|
|
15
15
|
stepScrollY: number;
|
|
16
|
+
ref: HTMLElement;
|
|
16
17
|
constructor(props: IProps);
|
|
18
|
+
componentDidMount(): void;
|
|
19
|
+
componentWillUnmount(): void;
|
|
20
|
+
setRef: (dom: any) => void;
|
|
21
|
+
get rootEl(): HTMLElement;
|
|
17
22
|
onDragging: ({ deltaX, deltaY }: {
|
|
18
23
|
deltaX: any;
|
|
19
24
|
deltaY: any;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function Rect(props: any): void;
|