@logicflow/core 1.1.3-alpha.0 → 1.1.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 +2 -2
- package/dist/style/index.css +13 -4
- package/package.json +1 -1
- package/types/constant/DefaultAnimation.d.ts +12 -0
- package/types/constant/constant.d.ts +2 -0
- package/types/model/EditConfigModel.d.ts +1 -0
- package/types/model/GraphModel.d.ts +5 -0
- package/types/model/edge/BaseEdgeModel.d.ts +8 -1
- package/types/model/node/BaseNodeModel.d.ts +11 -1
- package/types/options.d.ts +15 -0
- package/types/tool/TextEditTool.d.ts +1 -0
- package/types/type/index.d.ts +1 -0
- package/types/util/animation.d.ts +2 -0
- package/types/view/Anchor.d.ts +9 -8
- package/types/view/edge/AdjustPoint.d.ts +4 -0
- package/types/view/edge/BaseEdge.d.ts +1 -0
- package/types/view/edge/BezierEdge.d.ts +1 -0
- package/types/view/edge/LineEdge.d.ts +1 -0
- package/types/view/edge/PolylineEdge.d.ts +1 -0
package/dist/style/index.css
CHANGED
|
@@ -18,17 +18,26 @@
|
|
|
18
18
|
.lf-anchor:hover .lf-node-anchor-hover {
|
|
19
19
|
visibility: visible;
|
|
20
20
|
}
|
|
21
|
+
.lf-edge.pointer-none {
|
|
22
|
+
pointer-events: none;
|
|
23
|
+
}
|
|
21
24
|
.lf-edge-append {
|
|
22
25
|
cursor: pointer;
|
|
23
26
|
}
|
|
24
|
-
|
|
27
|
+
.lf-edge-animation {
|
|
28
|
+
stroke-dashoffset: 100%;
|
|
29
|
+
animation: dash 5s linear infinite;
|
|
30
|
+
}
|
|
31
|
+
@keyframes dash {
|
|
32
|
+
to {
|
|
33
|
+
stroke-dashoffset: 0;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
25
36
|
/* node */
|
|
26
37
|
.lf-node-not-allow {
|
|
27
38
|
cursor: not-allowed;
|
|
28
39
|
}
|
|
29
|
-
|
|
30
|
-
fill: #f9dee5;
|
|
31
|
-
}
|
|
40
|
+
|
|
32
41
|
.lf-polyline-append-ns-resize {
|
|
33
42
|
cursor: ns-resize;
|
|
34
43
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare type AnimationConfig = {
|
|
2
|
+
edge: boolean;
|
|
3
|
+
node: boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare type Animation = {
|
|
6
|
+
stroke: string;
|
|
7
|
+
strokeDasharray: string;
|
|
8
|
+
className: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const defaultAnimationCloseConfig: AnimationConfig;
|
|
11
|
+
export declare const defaultAnimationOpenConfig: AnimationConfig;
|
|
12
|
+
export declare const defaultAnimationData: Animation;
|
|
@@ -56,6 +56,8 @@ export declare enum EventType {
|
|
|
56
56
|
EDGE_CONTEXTMENU = "edge:contextmenu",
|
|
57
57
|
EDGE_ADJUST = "edge:adjust",
|
|
58
58
|
EDGE_EXCHANGE_NODE = "edge:exchange-node",
|
|
59
|
+
ANCHOR_DRAGSTART = "anchor:dragstart",
|
|
60
|
+
ANCHOR_DROP = "anchor:drop",
|
|
59
61
|
BLANK_MOUSEDOWN = "blank:mousedown",
|
|
60
62
|
BLANK_DRAGSTART = "blank:dragstart",
|
|
61
63
|
BLANK_DRAG = "blank:drag",
|
|
@@ -7,6 +7,7 @@ import { AdditionData, Point, NodeConfig, EdgeConfig, PointTuple, NodeMoveRule,
|
|
|
7
7
|
import EventEmitter from '../event/eventEmitter';
|
|
8
8
|
import { Theme } from '../constant/DefaultTheme';
|
|
9
9
|
import { Definition } from '../options';
|
|
10
|
+
import { AnimationConfig } from '../constant/DefaultAnimation';
|
|
10
11
|
declare type BaseNodeModelId = string;
|
|
11
12
|
declare type ElementModeId = string;
|
|
12
13
|
declare class GraphModel {
|
|
@@ -43,6 +44,10 @@ declare class GraphModel {
|
|
|
43
44
|
* 用于在默认模式下将之前的顶部元素恢复初始高度。
|
|
44
45
|
*/
|
|
45
46
|
topElement: BaseNodeModel | BaseEdgeModel;
|
|
47
|
+
/**
|
|
48
|
+
* 控制是否开启动画
|
|
49
|
+
*/
|
|
50
|
+
animation: AnimationConfig;
|
|
46
51
|
/**
|
|
47
52
|
* 自定义全局id生成器
|
|
48
53
|
* @see todo docs link
|
|
@@ -35,6 +35,7 @@ declare class BaseEdgeModel implements IBaseModel {
|
|
|
35
35
|
targetAnchorId: string;
|
|
36
36
|
menu?: MenuConfig[];
|
|
37
37
|
customTextPosition: boolean;
|
|
38
|
+
animationData: import("../../constant/DefaultAnimation").Animation;
|
|
38
39
|
[propName: string]: any;
|
|
39
40
|
constructor(data: EdgeConfig, graphModel: GraphModel);
|
|
40
41
|
/**
|
|
@@ -66,6 +67,12 @@ declare class BaseEdgeModel implements IBaseModel {
|
|
|
66
67
|
* 获取当前节点文本样式
|
|
67
68
|
*/
|
|
68
69
|
getTextStyle(): import("../../constant/DefaultTheme").EdgeTextTheme;
|
|
70
|
+
/**
|
|
71
|
+
* @overridable 支持重写
|
|
72
|
+
* 获取当前边的动画样式
|
|
73
|
+
* @returns 自定义边动画样式
|
|
74
|
+
*/
|
|
75
|
+
getAnimation(): import("../../constant/DefaultAnimation").Animation;
|
|
69
76
|
/**
|
|
70
77
|
* @overridable 支持重写
|
|
71
78
|
* 获取outline样式,重写可以定义此类型边outline样式, 默认使用主题样式
|
|
@@ -119,7 +126,7 @@ declare class BaseEdgeModel implements IBaseModel {
|
|
|
119
126
|
*/
|
|
120
127
|
updateText(value: string): void;
|
|
121
128
|
/**
|
|
122
|
-
*
|
|
129
|
+
* 内部方法,计算边的起点和终点和其对于的锚点Id
|
|
123
130
|
*/
|
|
124
131
|
setAnchors(): void;
|
|
125
132
|
setSelected(flag?: boolean): void;
|
|
@@ -3,6 +3,7 @@ import { ModelType, ElementType } from '../../constant/constant';
|
|
|
3
3
|
import { AdditionData, NodeData, NodeConfig, NodeMoveRule, Bounds, AnchorConfig, PointAnchor, AnchorsOffsetItem, ShapeStyleAttribute } from '../../type';
|
|
4
4
|
import GraphModel from '../GraphModel';
|
|
5
5
|
import { IBaseModel } from '../BaseModel';
|
|
6
|
+
import { BaseEdgeModel } from '../edge';
|
|
6
7
|
export declare type ConnectRule = {
|
|
7
8
|
message: string;
|
|
8
9
|
validate: (source?: BaseNodeModel, target?: BaseNodeModel, sourceAnchor?: AnchorConfig, targetAnchor?: AnchorConfig) => boolean;
|
|
@@ -58,6 +59,14 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
58
59
|
hasSetSourceRules: boolean;
|
|
59
60
|
[propName: string]: any;
|
|
60
61
|
constructor(data: NodeConfig, graphModel: GraphModel);
|
|
62
|
+
get incoming(): {
|
|
63
|
+
nodes: BaseNodeModel[];
|
|
64
|
+
edges: BaseEdgeModel[];
|
|
65
|
+
};
|
|
66
|
+
get outgoing(): {
|
|
67
|
+
nodes: BaseNodeModel[];
|
|
68
|
+
edges: BaseEdgeModel[];
|
|
69
|
+
};
|
|
61
70
|
/**
|
|
62
71
|
* @overridable 可以重写
|
|
63
72
|
* 初始化节点数据
|
|
@@ -113,7 +122,7 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
113
122
|
* 获取当前节点锚点样式
|
|
114
123
|
* @returns 自定义样式
|
|
115
124
|
*/
|
|
116
|
-
getAnchorStyle(): Record<string, any>;
|
|
125
|
+
getAnchorStyle(anchorInfo: any): Record<string, any>;
|
|
117
126
|
/**
|
|
118
127
|
* @overridable 支持重写
|
|
119
128
|
* 获取当前节点锚点拖出连线样式
|
|
@@ -162,6 +171,7 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
162
171
|
*/
|
|
163
172
|
getBounds(): Bounds;
|
|
164
173
|
get anchors(): PointAnchor[];
|
|
174
|
+
getAnchorInfo(anchorId: string): PointAnchor;
|
|
165
175
|
addNodeMoveRules(fn: NodeMoveRule): void;
|
|
166
176
|
move(deltaX: any, deltaY: any, isignoreRule?: boolean): boolean;
|
|
167
177
|
moveTo(x: any, y: any, isignoreRule?: boolean): boolean;
|
package/types/options.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { NodeData, EdgeData, Extension, GraphConfigData } from './type';
|
|
|
4
4
|
import { KeyboardDef } from './keyboard';
|
|
5
5
|
import { EditConfigInterface } from './model/EditConfigModel';
|
|
6
6
|
import { Theme } from './constant/DefaultTheme';
|
|
7
|
+
import { AnimationConfig } from './constant/DefaultAnimation';
|
|
7
8
|
export declare type EdgeType = 'line' | 'polyline' | 'bezier' | any;
|
|
8
9
|
declare type DefaultOverlapMode = 0;
|
|
9
10
|
declare type IncreaseOverlapMode = 1;
|
|
@@ -89,6 +90,13 @@ export declare type Definition = {
|
|
|
89
90
|
* 是否配置个性插件,覆盖全局配置的插件
|
|
90
91
|
*/
|
|
91
92
|
plugins?: Extension[];
|
|
93
|
+
/**
|
|
94
|
+
* 控制是否开启动画
|
|
95
|
+
* false: 关闭所有动画
|
|
96
|
+
* true: 开启所有动画
|
|
97
|
+
* AnimationConfig: 配置部分动画开启
|
|
98
|
+
*/
|
|
99
|
+
animation?: boolean | Partial<AnimationConfig>;
|
|
92
100
|
[key: string]: any;
|
|
93
101
|
} & EditConfigInterface;
|
|
94
102
|
export interface GuardsTypes {
|
|
@@ -177,6 +185,13 @@ export declare function get(options: Definition): {
|
|
|
177
185
|
* 是否配置个性插件,覆盖全局配置的插件
|
|
178
186
|
*/
|
|
179
187
|
plugins?: Extension[];
|
|
188
|
+
/**
|
|
189
|
+
* 控制是否开启动画
|
|
190
|
+
* false: 关闭所有动画
|
|
191
|
+
* true: 开启所有动画
|
|
192
|
+
* AnimationConfig: 配置部分动画开启
|
|
193
|
+
*/
|
|
194
|
+
animation?: boolean | Partial<AnimationConfig>;
|
|
180
195
|
} & EditConfigInterface;
|
|
181
196
|
export declare const defaults: {
|
|
182
197
|
background: boolean;
|
package/types/type/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ import * as Options from '../options';
|
|
|
26
26
|
import { CommonTheme, EdgeTextTheme } from '../constant/DefaultTheme';
|
|
27
27
|
export declare type PointTuple = [number, number];
|
|
28
28
|
export declare type Point = {
|
|
29
|
+
id?: string;
|
|
29
30
|
x: number;
|
|
30
31
|
y: number;
|
|
31
32
|
[key: string]: unknown;
|
package/types/view/Anchor.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { h, Component } from 'preact';
|
|
2
|
+
import { StepDrag } from '../util/drag';
|
|
2
3
|
import BaseNodeModel, { ConnectRuleResult } from '../model/node/BaseNodeModel';
|
|
3
4
|
import GraphModel from '../model/GraphModel';
|
|
4
5
|
import { AnchorConfig } from '../type';
|
|
5
6
|
declare type TargetNodeId = string;
|
|
6
7
|
interface IProps {
|
|
7
|
-
x: number;
|
|
8
|
-
y: number;
|
|
9
|
-
id?: string;
|
|
10
8
|
anchorData: AnchorConfig;
|
|
11
9
|
style?: Record<string, any>;
|
|
12
10
|
hoverStyle?: Record<string, any>;
|
|
@@ -26,16 +24,19 @@ interface IState {
|
|
|
26
24
|
}
|
|
27
25
|
declare class Anchor extends Component<IProps, IState> {
|
|
28
26
|
preTargetNode: BaseNodeModel;
|
|
29
|
-
dragHandler: Function;
|
|
30
27
|
sourceRuleResults: Map<TargetNodeId, ConnectRuleResult>;
|
|
31
28
|
targetRuleResults: Map<TargetNodeId, ConnectRuleResult>;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
dragHandler: StepDrag;
|
|
30
|
+
constructor(props: any);
|
|
31
|
+
onDragStart: ({ event }: {
|
|
32
|
+
event: any;
|
|
33
|
+
}) => void;
|
|
34
|
+
onDraging: ({ deltaX, deltaY, event }: {
|
|
35
35
|
deltaX: any;
|
|
36
36
|
deltaY: any;
|
|
37
|
+
event: any;
|
|
37
38
|
}) => void;
|
|
38
|
-
onDragEnd: () => void;
|
|
39
|
+
onDragEnd: (event: any) => void;
|
|
39
40
|
checkEnd: () => void;
|
|
40
41
|
isShowLine(): boolean;
|
|
41
42
|
render(): h.JSX.Element;
|
|
@@ -27,6 +27,9 @@ declare enum AdjustType {
|
|
|
27
27
|
export default class AdjustPoint extends Component<IProps, IState> {
|
|
28
28
|
dragHandler: Function;
|
|
29
29
|
oldEdge: OldEdge;
|
|
30
|
+
preTargetNode: any;
|
|
31
|
+
targetRuleResults: Map<any, any>;
|
|
32
|
+
sourceRuleResults: Map<any, any>;
|
|
30
33
|
constructor();
|
|
31
34
|
onDragStart: () => void;
|
|
32
35
|
onDraging: ({ deltaX, deltaY }: {
|
|
@@ -36,6 +39,7 @@ export default class AdjustPoint extends Component<IProps, IState> {
|
|
|
36
39
|
onDragEnd: () => void;
|
|
37
40
|
recoveryEdge: () => void;
|
|
38
41
|
getAdjustPointStyle: () => import("../../constant/DefaultTheme").CircleTheme;
|
|
42
|
+
isAllowAdjust(info: any): any;
|
|
39
43
|
render(): h.JSX.Element;
|
|
40
44
|
}
|
|
41
45
|
export {};
|
|
@@ -18,6 +18,7 @@ export default class BaseEdge extends Component<IProps> {
|
|
|
18
18
|
getArrowStyle(): ArrowStyle;
|
|
19
19
|
getArrow(): h.JSX.Element;
|
|
20
20
|
getAdjustPoints(): h.JSX.Element;
|
|
21
|
+
getAnimation(): void;
|
|
21
22
|
getAppendWidth(): h.JSX.Element;
|
|
22
23
|
getAppend(): h.JSX.Element;
|
|
23
24
|
handleHover: (hovered: any, ev: any) => void;
|
|
@@ -24,6 +24,7 @@ export default class PolylineEdge extends BaseEdge {
|
|
|
24
24
|
getIsDraging: () => boolean;
|
|
25
25
|
getEdge(): h.JSX.Element;
|
|
26
26
|
getShape(): h.JSX.Element;
|
|
27
|
+
getAnimation(): h.JSX.Element;
|
|
27
28
|
getArrowInfo(): ArrowInfo;
|
|
28
29
|
getAppendAttributes(appendInfo: AppendInfo): AppendAttributesType;
|
|
29
30
|
getAppendShape(appendInfo: AppendInfo): h.JSX.Element;
|