@logicflow/core 1.1.20 → 1.2.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/dist/logic-flow.js +9598 -10829
- package/dist/logic-flow.min.js +1 -15
- package/dist/style/index.css +10 -0
- package/package.json +4 -5
- package/types/LogicFlow.d.ts +9 -4
- package/types/algorithm/edge.d.ts +1 -1
- package/types/constant/constant.d.ts +7 -1
- package/types/history/History.d.ts +4 -2
- package/types/index.d.ts +4 -4
- package/types/keyboard/index.d.ts +1 -1
- package/types/model/BaseModel.d.ts +2 -2
- package/types/model/EditConfigModel.d.ts +7 -0
- package/types/model/GraphModel.d.ts +6 -6
- package/types/model/SnaplineModel.d.ts +1 -1
- package/types/model/TransformModel.d.ts +4 -4
- package/types/model/edge/BaseEdgeModel.d.ts +10 -8
- package/types/model/edge/BezierEdgeModel.d.ts +1 -0
- package/types/model/edge/PolylineEdgeModel.d.ts +21 -8
- package/types/model/node/BaseNodeModel.d.ts +27 -14
- 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/MultipleSelectTool.d.ts +1 -1
- package/types/util/drag.d.ts +7 -8
- package/types/util/edge.d.ts +13 -2
- package/types/util/node.d.ts +1 -1
- package/types/view/Anchor.d.ts +2 -2
- package/types/view/edge/AdjustPoint.d.ts +1 -1
- package/types/view/edge/PolylineEdge.d.ts +2 -2
- package/types/view/node/BaseNode.d.ts +4 -4
- package/types/view/node/HtmlNode.d.ts +3 -3
- package/types/view/node/TextNode.d.ts +1 -1
- package/types/view/overlay/CanvasOverlay.d.ts +9 -4
- package/types/view/text/BaseText.d.ts +3 -2
- package/types/view/text/LineText.d.ts +1 -1
- package/types/view/basic-shape/LinearGradient.d.ts +0 -1
- package/types/view/behavior/Transform.d.ts +0 -4
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 {};
|
|
@@ -10,7 +10,7 @@ export default class MultipleSelect extends Component<IProps> {
|
|
|
10
10
|
stepDrag: any;
|
|
11
11
|
constructor(props: any);
|
|
12
12
|
handleMouseDown: (ev: MouseEvent) => void;
|
|
13
|
-
|
|
13
|
+
onDragging: ({ deltaX, deltaY }: {
|
|
14
14
|
deltaX: any;
|
|
15
15
|
deltaY: any;
|
|
16
16
|
}) => void;
|
package/types/util/drag.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import EventEmitter from '../event/eventEmitter';
|
|
2
2
|
import BaseEdgeModel from '../model/edge/BaseEdgeModel';
|
|
3
3
|
import BaseNodeModel from '../model/node/BaseNodeModel';
|
|
4
|
-
declare function createDrag({ onDragStart,
|
|
4
|
+
declare function createDrag({ onDragStart, onDragging, onDragEnd, step, isStopPropagation, }: {
|
|
5
5
|
onDragStart?: (...args: any[]) => void;
|
|
6
|
-
|
|
6
|
+
onDragging?: (...args: any[]) => void;
|
|
7
7
|
onDragEnd?: (...args: any[]) => void;
|
|
8
8
|
step?: number;
|
|
9
9
|
isStopPropagation?: boolean;
|
|
10
10
|
}): (e: MouseEvent) => void;
|
|
11
11
|
declare class StepDrag {
|
|
12
12
|
onDragStart: Function;
|
|
13
|
-
|
|
13
|
+
onDragging: Function;
|
|
14
14
|
onDragEnd: Function;
|
|
15
15
|
step: number;
|
|
16
16
|
isStopPropagation: boolean;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
isDragging: boolean;
|
|
18
|
+
isStartDragging: boolean;
|
|
19
19
|
startX: number;
|
|
20
20
|
startY: number;
|
|
21
21
|
sumDeltaX: number;
|
|
@@ -24,10 +24,9 @@ declare class StepDrag {
|
|
|
24
24
|
eventCenter: EventEmitter | null;
|
|
25
25
|
model?: BaseNodeModel | BaseEdgeModel;
|
|
26
26
|
startTime?: number;
|
|
27
|
-
|
|
28
|
-
constructor({ onDragStart, onDraging, onDragEnd, eventType, eventCenter, step, isStopPropagation, model, }: {
|
|
27
|
+
constructor({ onDragStart, onDragging, onDragEnd, eventType, eventCenter, step, isStopPropagation, model, }: {
|
|
29
28
|
onDragStart?: (...args: any[]) => void;
|
|
30
|
-
|
|
29
|
+
onDragging?: (...args: any[]) => void;
|
|
31
30
|
onDragEnd?: (...args: any[]) => void;
|
|
32
31
|
eventType?: string;
|
|
33
32
|
eventCenter?: any;
|
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
|
* 获取折线中最长的一个线
|
package/types/util/node.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export declare const getCrossPointWithCircle: (point: Point, direction: Directio
|
|
|
35
35
|
export declare const pointEdgeDirection: (point: Point, node: BaseNode) => Direction;
|
|
36
36
|
export declare const inStraightLineOfRect: (point: Point, node: BaseNode) => boolean;
|
|
37
37
|
export declare const getCrossPointWithEllipse: (point: Point, direction: Direction, node: BaseNode) => any;
|
|
38
|
-
export declare const
|
|
38
|
+
export declare const getCrossPointWithPolygon: (point: Point, direction: Direction, node: BaseNode) => Point;
|
|
39
39
|
export declare const pickNodeConfig: (data: any) => NodeConfig;
|
|
40
40
|
/**
|
|
41
41
|
* 基于节点的边,重新获取新的节点
|
package/types/view/Anchor.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ interface IState {
|
|
|
21
21
|
startY: number;
|
|
22
22
|
endX: number;
|
|
23
23
|
endY: number;
|
|
24
|
-
|
|
24
|
+
dragging: boolean;
|
|
25
25
|
}
|
|
26
26
|
declare class Anchor extends Component<IProps, IState> {
|
|
27
27
|
preTargetNode: BaseNodeModel;
|
|
@@ -34,7 +34,7 @@ declare class Anchor extends Component<IProps, IState> {
|
|
|
34
34
|
onDragStart: ({ event }: {
|
|
35
35
|
event: any;
|
|
36
36
|
}) => void;
|
|
37
|
-
|
|
37
|
+
onDragging: ({ event }: {
|
|
38
38
|
event: any;
|
|
39
39
|
}) => void;
|
|
40
40
|
onDragEnd: (event: any) => void;
|
|
@@ -32,7 +32,7 @@ export default class AdjustPoint extends Component<IProps, IState> {
|
|
|
32
32
|
sourceRuleResults: Map<any, any>;
|
|
33
33
|
constructor();
|
|
34
34
|
onDragStart: () => void;
|
|
35
|
-
|
|
35
|
+
onDragging: ({ deltaX, deltaY }: {
|
|
36
36
|
deltaX: any;
|
|
37
37
|
deltaY: any;
|
|
38
38
|
}) => void;
|
|
@@ -10,12 +10,12 @@ declare type AppendAttributesType = {
|
|
|
10
10
|
};
|
|
11
11
|
export default class PolylineEdge extends BaseEdge {
|
|
12
12
|
drag: any;
|
|
13
|
-
|
|
13
|
+
isDragging: boolean;
|
|
14
14
|
appendInfo: AppendInfo;
|
|
15
15
|
dragHandler: (ev: MouseEvent) => void;
|
|
16
16
|
constructor();
|
|
17
17
|
onDragStart: () => void;
|
|
18
|
-
|
|
18
|
+
onDragging: ({ deltaX, deltaY }: {
|
|
19
19
|
deltaX: any;
|
|
20
20
|
deltaY: any;
|
|
21
21
|
}) => void;
|
|
@@ -6,11 +6,11 @@ declare type IProps = {
|
|
|
6
6
|
model: BaseNodeModel;
|
|
7
7
|
graphModel: GraphModel;
|
|
8
8
|
};
|
|
9
|
-
declare type
|
|
9
|
+
declare type IState = {
|
|
10
10
|
isHovered: boolean;
|
|
11
|
-
|
|
11
|
+
isDragging?: boolean;
|
|
12
12
|
};
|
|
13
|
-
export default abstract class BaseNode extends Component<IProps,
|
|
13
|
+
export default abstract class BaseNode extends Component<IProps, IState> {
|
|
14
14
|
t: any;
|
|
15
15
|
moveOffset: {
|
|
16
16
|
x: number;
|
|
@@ -33,7 +33,7 @@ export default abstract class BaseNode extends Component<IProps, Istate> {
|
|
|
33
33
|
clientY: any;
|
|
34
34
|
};
|
|
35
35
|
}) => void;
|
|
36
|
-
|
|
36
|
+
onDragging: ({ event }: {
|
|
37
37
|
event: any;
|
|
38
38
|
}) => void;
|
|
39
39
|
onDragEnd: () => void;
|
|
@@ -2,12 +2,12 @@ import { h } from 'preact';
|
|
|
2
2
|
import BaseNode from './BaseNode';
|
|
3
3
|
export default class HtmlNode extends BaseNode {
|
|
4
4
|
ref: HTMLElement;
|
|
5
|
-
|
|
5
|
+
currentProperties: string;
|
|
6
6
|
preProperties: string;
|
|
7
7
|
setRef: (dom: any) => void;
|
|
8
8
|
get rootEl(): HTMLElement;
|
|
9
9
|
/**
|
|
10
|
-
* @
|
|
10
|
+
* @override 支持重写
|
|
11
11
|
* 自定义HTML节点内容
|
|
12
12
|
* @param {HTMLElement} rootEl 自定义HTML节点内容可以挂载的dom节点
|
|
13
13
|
* @example
|
|
@@ -20,7 +20,7 @@ export default class HtmlNode extends BaseNode {
|
|
|
20
20
|
*/
|
|
21
21
|
setHtml(rootEl: HTMLElement): void;
|
|
22
22
|
/**
|
|
23
|
-
* @
|
|
23
|
+
* @override 支持重写
|
|
24
24
|
* 和react的shouldComponentUpdate类似,都是为了避免出发不必要的render.
|
|
25
25
|
* 但是这里不一样的地方在于,setHtml方法,我们只在properties发生变化了后再触发。
|
|
26
26
|
* 而x,y等这些坐标相关的方法发生了变化,不会再重新触发setHtml.
|
|
@@ -6,15 +6,20 @@ declare type IProps = {
|
|
|
6
6
|
graphModel: GraphModel;
|
|
7
7
|
dnd: Dnd;
|
|
8
8
|
};
|
|
9
|
-
declare type
|
|
10
|
-
|
|
9
|
+
declare type IState = {
|
|
10
|
+
isDragging: boolean;
|
|
11
11
|
};
|
|
12
|
-
declare class CanvasOverlay extends Component<IProps,
|
|
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);
|
|
17
|
-
|
|
18
|
+
componentDidMount(): void;
|
|
19
|
+
componentWillUnmount(): void;
|
|
20
|
+
setRef: (dom: any) => void;
|
|
21
|
+
get rootEl(): HTMLElement;
|
|
22
|
+
onDragging: ({ deltaX, deltaY }: {
|
|
18
23
|
deltaX: any;
|
|
19
24
|
deltaY: any;
|
|
20
25
|
}) => void;
|
|
@@ -9,7 +9,7 @@ declare type IProps = {
|
|
|
9
9
|
editable: boolean;
|
|
10
10
|
};
|
|
11
11
|
declare type IState = {
|
|
12
|
-
|
|
12
|
+
isHovered: boolean;
|
|
13
13
|
};
|
|
14
14
|
export default class BaseText extends Component<IProps, IState> {
|
|
15
15
|
dragHandler: (ev: MouseEvent) => void;
|
|
@@ -18,10 +18,11 @@ export default class BaseText extends Component<IProps, IState> {
|
|
|
18
18
|
stepDrag: StepDrag;
|
|
19
19
|
constructor(config: any);
|
|
20
20
|
getShape(): h.JSX.Element;
|
|
21
|
-
|
|
21
|
+
onDragging: ({ deltaX, deltaY }: {
|
|
22
22
|
deltaX: any;
|
|
23
23
|
deltaY: any;
|
|
24
24
|
}) => void;
|
|
25
|
+
onDragEnd: (e: any) => void;
|
|
25
26
|
dblClickHandler: () => void;
|
|
26
27
|
mouseDownHandle: (ev: MouseEvent) => void;
|
|
27
28
|
render(): h.JSX.Element;
|
|
@@ -2,7 +2,7 @@ import { h } from 'preact';
|
|
|
2
2
|
import BaseText from './BaseText';
|
|
3
3
|
export default class LineText extends BaseText {
|
|
4
4
|
constructor(config: any);
|
|
5
|
-
|
|
5
|
+
getBackground(): h.JSX.Element;
|
|
6
6
|
setHoverON: () => void;
|
|
7
7
|
setHoverOFF: () => void;
|
|
8
8
|
getShape(): h.JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function Rect(props: any): void;
|