@logicflow/core 1.2.0-next.1 → 1.2.0-next.3
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 +10925 -9653
- 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 +14 -11
- 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 +4 -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/types/type/index.d.ts
CHANGED
|
@@ -31,9 +31,6 @@ export declare type Point = {
|
|
|
31
31
|
y: number;
|
|
32
32
|
[key: string]: unknown;
|
|
33
33
|
};
|
|
34
|
-
export declare type Vector2 = [number, number];
|
|
35
|
-
export declare type DirectionVectorNumber = 0 | 1 | -1;
|
|
36
|
-
export declare type DirectionVector2 = [DirectionVectorNumber, DirectionVectorNumber];
|
|
37
34
|
/**
|
|
38
35
|
* 锚点坐标
|
|
39
36
|
* 为了方便计算
|
|
@@ -55,6 +52,10 @@ export declare type PointAnchor = {
|
|
|
55
52
|
[key: string]: unknown;
|
|
56
53
|
};
|
|
57
54
|
export declare type AnchorsOffsetItem = PointTuple | PointAnchor;
|
|
55
|
+
export declare type AnchorInfo = {
|
|
56
|
+
index: number;
|
|
57
|
+
anchor: Point;
|
|
58
|
+
};
|
|
58
59
|
export declare type Size = {
|
|
59
60
|
width: number;
|
|
60
61
|
height: number;
|
|
@@ -250,7 +251,7 @@ export declare type GraphTransform = {
|
|
|
250
251
|
transform: string;
|
|
251
252
|
transformOrigin: string;
|
|
252
253
|
};
|
|
253
|
-
export declare type EventArgs = Record<string, number | object | string>;
|
|
254
|
+
export declare type EventArgs = Record<string, number | object | string | boolean>;
|
|
254
255
|
export declare type FocusOnArgs = {
|
|
255
256
|
id?: string;
|
|
256
257
|
coordinate?: {
|
|
@@ -261,7 +262,7 @@ export declare type FocusOnArgs = {
|
|
|
261
262
|
export declare type ComponentRender = (lf: LogicFlow, container: HTMLElement) => void;
|
|
262
263
|
export interface Extension {
|
|
263
264
|
pluginName: string;
|
|
264
|
-
install?: (lf: LogicFlow, LogicFlow:
|
|
265
|
+
install?: (lf: LogicFlow, LogicFlow: LogicFlowConstructor) => void;
|
|
265
266
|
render?: ComponentRender;
|
|
266
267
|
destroy?: () => void;
|
|
267
268
|
[props: string]: any;
|
|
@@ -287,15 +288,17 @@ export declare type IEdgeState = {
|
|
|
287
288
|
export interface ModelContractor {
|
|
288
289
|
new (data: any, graphModel: any): unknown;
|
|
289
290
|
}
|
|
290
|
-
export interface
|
|
291
|
+
export interface LogicFlowConstructor {
|
|
291
292
|
new (option: Options.Definition): LogicFlow;
|
|
292
293
|
}
|
|
293
|
-
export
|
|
294
|
+
export declare type ExtensionOptions = {
|
|
295
|
+
lf: LogicFlow;
|
|
296
|
+
LogicFlow: LogicFlowConstructor;
|
|
297
|
+
options: Record<string, any>;
|
|
298
|
+
};
|
|
299
|
+
export interface ExtensionConstructor {
|
|
294
300
|
pluginName: string;
|
|
295
|
-
new (
|
|
296
|
-
lf: any;
|
|
297
|
-
LogicFlow: any;
|
|
298
|
-
}): any;
|
|
301
|
+
new (ExtensionOptions: ExtensionOptions): Extension;
|
|
299
302
|
render?: Function;
|
|
300
303
|
}
|
|
301
304
|
export declare type RegisterBack = {
|
package/types/util/drag.d.ts
CHANGED
|
@@ -23,8 +23,9 @@ declare class StepDrag {
|
|
|
23
23
|
eventType: string;
|
|
24
24
|
eventCenter: EventEmitter | null;
|
|
25
25
|
model?: BaseNodeModel | BaseEdgeModel;
|
|
26
|
+
data?: object;
|
|
26
27
|
startTime?: number;
|
|
27
|
-
constructor({ onDragStart, onDragging, onDragEnd, eventType, eventCenter, step, isStopPropagation, model, }: {
|
|
28
|
+
constructor({ onDragStart, onDragging, onDragEnd, eventType, eventCenter, step, isStopPropagation, model, data, }: {
|
|
28
29
|
onDragStart?: (...args: any[]) => void;
|
|
29
30
|
onDragging?: (...args: any[]) => void;
|
|
30
31
|
onDragEnd?: (...args: any[]) => void;
|
|
@@ -33,6 +34,7 @@ declare class StepDrag {
|
|
|
33
34
|
step?: number;
|
|
34
35
|
isStopPropagation?: boolean;
|
|
35
36
|
model?: any;
|
|
37
|
+
data?: any;
|
|
36
38
|
});
|
|
37
39
|
setStep(step: number): void;
|
|
38
40
|
handleMouseDown: (e: MouseEvent) => void;
|
package/types/util/edge.d.ts
CHANGED
|
@@ -26,11 +26,8 @@ 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
|
-
|
|
31
|
-
*/
|
|
32
|
-
export declare const pointDirection: (point: PolyPoint, node: BaseNode) => Direction;
|
|
33
|
-
export declare const getExpandedBBoxPoint: (bbox: PBBox, point: PolyPoint, direction: any) => PolyPoint;
|
|
29
|
+
export declare const pointDirection: (point: PolyPoint, bbox: PBBox) => Direction;
|
|
30
|
+
export declare const getExpandedBBoxPoint: (bbox: PBBox, point: PolyPoint) => PolyPoint;
|
|
34
31
|
export declare const mergeBBox: (b1: PBBox, b2: PBBox) => PBBox;
|
|
35
32
|
export declare const getBBoxOfPoints: (points?: PolyPoint[], offset?: number) => PBBox;
|
|
36
33
|
export declare const getPointsFromBBox: (bbox: PBBox) => PolyPoint[];
|
|
@@ -49,14 +46,6 @@ export declare const getNextNeighborPoints: (points: PolyPoint[], point: PolyPoi
|
|
|
49
46
|
export declare const pathFinder: (points: PolyPoint[], start: PolyPoint, goal: PolyPoint, sBBox: PBBox, tBBox: PBBox, os: PolyPoint, ot: PolyPoint) => PolyPoint[];
|
|
50
47
|
export declare const getBoxByOriginNode: (node: BaseNode) => PBBox;
|
|
51
48
|
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
|
-
*/
|
|
60
49
|
export declare const getPolylinePoints: (start: PolyPoint, end: PolyPoint, sNode: BaseNode, tNode: BaseNode, offset: number) => PolyPoint[];
|
|
61
50
|
/**
|
|
62
51
|
* 获取折线中最长的一个线
|
package/types/util/node.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseNode from '../model/node/BaseNodeModel';
|
|
2
|
-
import { Point, Direction, NodeConfig, AnchorConfig } from '../type';
|
|
2
|
+
import { Point, Direction, NodeConfig, AnchorConfig, AnchorInfo } from '../type';
|
|
3
3
|
import { GraphModel } from '..';
|
|
4
4
|
export declare const getAnchors: (data: any) => Point[];
|
|
5
5
|
declare type NodeContaint = {
|
|
@@ -8,6 +8,7 @@ declare type NodeContaint = {
|
|
|
8
8
|
anchor: AnchorConfig;
|
|
9
9
|
};
|
|
10
10
|
export declare const targetNodeInfo: (position: Point, graphModel: GraphModel) => NodeContaint;
|
|
11
|
+
export declare const getClosestAnchor: (position: Point, node: BaseNode) => AnchorInfo;
|
|
11
12
|
export declare const distance: (x1: number, y1: number, x2: number, y2: number) => number;
|
|
12
13
|
export declare const isInNode: (position: Point, node: BaseNode) => boolean;
|
|
13
14
|
export declare const isInNodeBbox: (position: Point, node: any) => boolean;
|
package/types/view/Anchor.d.ts
CHANGED
|
@@ -37,7 +37,9 @@ declare class Anchor extends Component<IProps, IState> {
|
|
|
37
37
|
onDragging: ({ event }: {
|
|
38
38
|
event: any;
|
|
39
39
|
}) => void;
|
|
40
|
-
onDragEnd: (event:
|
|
40
|
+
onDragEnd: ({ event }: {
|
|
41
|
+
event: any;
|
|
42
|
+
}) => void;
|
|
41
43
|
checkEnd: (event: any) => void;
|
|
42
44
|
moveAnchorEnd(endX: number, endY: number): void;
|
|
43
45
|
isShowLine(): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function Rect(props: any): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { h, Component } from 'preact';
|
|
2
2
|
import { BaseEdgeModel } from '../../model/edge';
|
|
3
3
|
import GraphModel from '../../model/GraphModel';
|
|
4
|
+
import { StepDrag } from '../../util/drag';
|
|
4
5
|
import { Point } from '../../type';
|
|
5
6
|
interface IProps {
|
|
6
7
|
x: number;
|
|
@@ -11,7 +12,7 @@ interface IProps {
|
|
|
11
12
|
edgeModel: BaseEdgeModel;
|
|
12
13
|
}
|
|
13
14
|
interface IState {
|
|
14
|
-
|
|
15
|
+
dragging: boolean;
|
|
15
16
|
endX: number;
|
|
16
17
|
endY: number;
|
|
17
18
|
}
|
|
@@ -25,18 +26,22 @@ declare enum AdjustType {
|
|
|
25
26
|
TARGET = "TARGET"
|
|
26
27
|
}
|
|
27
28
|
export default class AdjustPoint extends Component<IProps, IState> {
|
|
28
|
-
|
|
29
|
+
stepDragData: any;
|
|
30
|
+
stepDrag: StepDrag;
|
|
29
31
|
oldEdge: OldEdge;
|
|
30
32
|
preTargetNode: any;
|
|
31
33
|
targetRuleResults: Map<any, any>;
|
|
32
34
|
sourceRuleResults: Map<any, any>;
|
|
33
|
-
constructor();
|
|
35
|
+
constructor(props: any);
|
|
36
|
+
handleMouseDown: (ev: MouseEvent) => void;
|
|
34
37
|
onDragStart: () => void;
|
|
35
38
|
onDragging: ({ deltaX, deltaY }: {
|
|
36
39
|
deltaX: any;
|
|
37
40
|
deltaY: any;
|
|
38
41
|
}) => void;
|
|
39
|
-
onDragEnd: (
|
|
42
|
+
onDragEnd: ({ event }: {
|
|
43
|
+
event: any;
|
|
44
|
+
}) => void;
|
|
40
45
|
recoveryEdge: () => void;
|
|
41
46
|
getAdjustPointStyle: () => import("../../constant/DefaultTheme").CircleTheme;
|
|
42
47
|
isAllowAdjust(info: any): any;
|
|
@@ -11,18 +11,15 @@ export default class BaseEdge extends Component<IProps> {
|
|
|
11
11
|
startTime: number;
|
|
12
12
|
contextMenuTime: number;
|
|
13
13
|
clickTimer: number;
|
|
14
|
+
textRef: import("preact").RefObject<any>;
|
|
14
15
|
getShape(): void;
|
|
15
|
-
/**
|
|
16
|
-
* 支持重写此方法来实现在连线上定义额外内容。
|
|
17
|
-
*/
|
|
18
|
-
getExtraShape(): void;
|
|
19
16
|
getTextStyle(): void;
|
|
20
17
|
getText(): "" | h.JSX.Element;
|
|
21
18
|
getArrowInfo(): ArrowInfo;
|
|
22
19
|
getArrowStyle(): ArrowStyle;
|
|
23
|
-
getArrow(): h.JSX.Element;
|
|
24
|
-
getStartArrow(): h.JSX.Element;
|
|
25
|
-
getEndArrow(): h.JSX.Element;
|
|
20
|
+
getArrow(): h.JSX.Element | null;
|
|
21
|
+
getStartArrow(): h.JSX.Element | null;
|
|
22
|
+
getEndArrow(): h.JSX.Element | null;
|
|
26
23
|
getAdjustPoints(): h.JSX.Element;
|
|
27
24
|
getAnimation(): void;
|
|
28
25
|
getAppendWidth(): h.JSX.Element;
|
|
@@ -7,7 +7,7 @@ export default class HtmlNode extends BaseNode {
|
|
|
7
7
|
setRef: (dom: any) => void;
|
|
8
8
|
get rootEl(): HTMLElement;
|
|
9
9
|
/**
|
|
10
|
-
* @
|
|
10
|
+
* @overridable 支持重写
|
|
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
|
+
* @overridable 支持重写
|
|
24
24
|
* 和react的shouldComponentUpdate类似,都是为了避免出发不必要的render.
|
|
25
25
|
* 但是这里不一样的地方在于,setHtml方法,我们只在properties发生变化了后再触发。
|
|
26
26
|
* 而x,y等这些坐标相关的方法发生了变化,不会再重新触发setHtml.
|
|
@@ -13,12 +13,7 @@ declare class CanvasOverlay extends Component<IProps, IState> {
|
|
|
13
13
|
stepDrag: StepDrag;
|
|
14
14
|
stepScrollX: number;
|
|
15
15
|
stepScrollY: number;
|
|
16
|
-
ref: HTMLElement;
|
|
17
16
|
constructor(props: IProps);
|
|
18
|
-
componentDidMount(): void;
|
|
19
|
-
componentWillUnmount(): void;
|
|
20
|
-
setRef: (dom: any) => void;
|
|
21
|
-
get rootEl(): HTMLElement;
|
|
22
17
|
onDragging: ({ deltaX, deltaY }: {
|
|
23
18
|
deltaX: any;
|
|
24
19
|
deltaY: any;
|