@logicflow/core 1.1.7 → 1.1.8-alpha.0
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 +9 -1
- package/dist/logic-flow.js +2 -2
- package/package.json +1 -1
- package/types/LogicFlow.d.ts +9 -0
- package/types/constant/constant.d.ts +1 -0
- package/types/model/GraphModel.d.ts +16 -1
- package/types/model/edge/BaseEdgeModel.d.ts +6 -0
- package/types/model/node/BaseNodeModel.d.ts +9 -0
- package/types/type/index.d.ts +6 -0
- package/types/util/drag.d.ts +1 -0
- package/types/view/Anchor.d.ts +1 -4
- package/types/view/behavior/DnD.d.ts +1 -0
- package/types/view/node/BaseNode.d.ts +3 -3
package/package.json
CHANGED
package/types/LogicFlow.d.ts
CHANGED
|
@@ -439,6 +439,15 @@ export default class LogicFlow {
|
|
|
439
439
|
* 还原图形为初始位置
|
|
440
440
|
*/
|
|
441
441
|
resetTranslate(): void;
|
|
442
|
+
/**
|
|
443
|
+
* 图形画布居中显示
|
|
444
|
+
*/
|
|
445
|
+
translateCenter(): void;
|
|
446
|
+
/**
|
|
447
|
+
* 图形适应屏幕大小
|
|
448
|
+
* @param offset number 距离盒子四周的距离, 默认为20
|
|
449
|
+
*/
|
|
450
|
+
fitView(offset: number): void;
|
|
442
451
|
/**
|
|
443
452
|
* 监听事件
|
|
444
453
|
* 事件详情见 @see todo
|
|
@@ -57,6 +57,7 @@ export declare enum EventType {
|
|
|
57
57
|
EDGE_ADJUST = "edge:adjust",
|
|
58
58
|
EDGE_EXCHANGE_NODE = "edge:exchange-node",
|
|
59
59
|
ANCHOR_DRAGSTART = "anchor:dragstart",
|
|
60
|
+
ANCHOR_DRAG = "anchor:drag",
|
|
60
61
|
ANCHOR_DROP = "anchor:drop",
|
|
61
62
|
BLANK_MOUSEDOWN = "blank:mousedown",
|
|
62
63
|
BLANK_DRAGSTART = "blank:dragstart",
|
|
@@ -3,7 +3,7 @@ import BaseEdgeModel from './edge/BaseEdgeModel';
|
|
|
3
3
|
import EditConfigModel from './EditConfigModel';
|
|
4
4
|
import TransfromModel from './TransformModel';
|
|
5
5
|
import { OverlapMode } from '../constant/constant';
|
|
6
|
-
import { AdditionData, Point, NodeConfig, EdgeConfig, PointTuple, NodeMoveRule, GraphConfigData } from '../type';
|
|
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';
|
|
9
9
|
import { Definition } from '../options';
|
|
@@ -106,6 +106,7 @@ declare class GraphModel {
|
|
|
106
106
|
* 外部拖动节点进入画布的过程中,用fakerNode来和画布上正是的节点区分开
|
|
107
107
|
*/
|
|
108
108
|
fakerNode: BaseNodeModel;
|
|
109
|
+
[key: string]: any;
|
|
109
110
|
constructor(options: Definition);
|
|
110
111
|
get nodesMap(): {
|
|
111
112
|
[key: string]: {
|
|
@@ -415,6 +416,20 @@ declare class GraphModel {
|
|
|
415
416
|
* 清空画布
|
|
416
417
|
*/
|
|
417
418
|
clearData(): void;
|
|
419
|
+
/**
|
|
420
|
+
* 获取图形区域虚拟矩型的尺寸和中心坐标
|
|
421
|
+
* @returns
|
|
422
|
+
*/
|
|
423
|
+
getVirtualRectSize(): VirtualRectSize;
|
|
424
|
+
/**
|
|
425
|
+
* 将图形整体移动到画布中心
|
|
426
|
+
*/
|
|
427
|
+
translateCenter(): void;
|
|
428
|
+
/**
|
|
429
|
+
* 画布图形适应屏幕大小
|
|
430
|
+
* @param offset number 距离盒子四周的距离, 默认为20
|
|
431
|
+
*/
|
|
432
|
+
fitView(offset?: number): void;
|
|
418
433
|
}
|
|
419
434
|
export { GraphModel };
|
|
420
435
|
export default GraphModel;
|
|
@@ -103,6 +103,12 @@ declare class BaseEdgeModel implements IBaseModel {
|
|
|
103
103
|
* 获取被保存时返回的数据
|
|
104
104
|
*/
|
|
105
105
|
getData(): EdgeData;
|
|
106
|
+
/**
|
|
107
|
+
* 用于在历史记录时获取节点数据,
|
|
108
|
+
* 在某些情况下,如果希望某个属性变化不引起history的变化,
|
|
109
|
+
* 可以重写此方法。
|
|
110
|
+
*/
|
|
111
|
+
getHistoryData(): EdgeData;
|
|
106
112
|
setProperty(key: any, val: any): void;
|
|
107
113
|
setProperties(properties: any): void;
|
|
108
114
|
/**
|
|
@@ -59,6 +59,9 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
59
59
|
hasSetSourceRules: boolean;
|
|
60
60
|
[propName: string]: any;
|
|
61
61
|
constructor(data: NodeConfig, graphModel: GraphModel);
|
|
62
|
+
/**
|
|
63
|
+
* 获取进入当前节点的边和节点
|
|
64
|
+
*/
|
|
62
65
|
get incoming(): {
|
|
63
66
|
nodes: BaseNodeModel[];
|
|
64
67
|
edges: BaseEdgeModel[];
|
|
@@ -102,6 +105,12 @@ export default class BaseNodeModel implements IBaseNodeModel {
|
|
|
102
105
|
* @overridable 支持重写
|
|
103
106
|
*/
|
|
104
107
|
getData(): NodeData;
|
|
108
|
+
/**
|
|
109
|
+
* 用于在历史记录时获取节点数据,
|
|
110
|
+
* 在某些情况下,如果希望某个属性变化不引起history的变化,
|
|
111
|
+
* 可以重写此方法。
|
|
112
|
+
*/
|
|
113
|
+
getHistoryData(): NodeData;
|
|
105
114
|
/**
|
|
106
115
|
* 获取当前节点的properties
|
|
107
116
|
*/
|
package/types/type/index.d.ts
CHANGED
|
@@ -368,4 +368,10 @@ export declare type DiamondAttributes = {
|
|
|
368
368
|
points: PointTuple[];
|
|
369
369
|
} & NodeAttributes;
|
|
370
370
|
export declare type ShapeStyleAttribute = CommonTheme;
|
|
371
|
+
export declare type VirtualRectSize = {
|
|
372
|
+
virtualRectWidth: number;
|
|
373
|
+
virtualRectHeight: number;
|
|
374
|
+
virtualRectCenterPositionX: number;
|
|
375
|
+
virtualRectCenterPositionY: number;
|
|
376
|
+
};
|
|
371
377
|
export {};
|
package/types/util/drag.d.ts
CHANGED
package/types/view/Anchor.d.ts
CHANGED
|
@@ -14,7 +14,6 @@ interface IProps {
|
|
|
14
14
|
anchorIndex: number;
|
|
15
15
|
graphModel: GraphModel;
|
|
16
16
|
nodeModel: BaseNodeModel;
|
|
17
|
-
nodeDraging: boolean;
|
|
18
17
|
setHoverOFF: Function;
|
|
19
18
|
}
|
|
20
19
|
interface IState {
|
|
@@ -34,9 +33,7 @@ declare class Anchor extends Component<IProps, IState> {
|
|
|
34
33
|
onDragStart: ({ event }: {
|
|
35
34
|
event: any;
|
|
36
35
|
}) => void;
|
|
37
|
-
onDraging: ({
|
|
38
|
-
deltaX: any;
|
|
39
|
-
deltaY: any;
|
|
36
|
+
onDraging: ({ event }: {
|
|
40
37
|
event: any;
|
|
41
38
|
}) => void;
|
|
42
39
|
onDragEnd: (event: any) => void;
|
|
@@ -11,6 +11,7 @@ declare type Istate = {
|
|
|
11
11
|
isDraging?: boolean;
|
|
12
12
|
};
|
|
13
13
|
export default abstract class BaseNode extends Component<IProps, Istate> {
|
|
14
|
+
t: any;
|
|
14
15
|
static getModel(defaultModel: any): any;
|
|
15
16
|
stepDrag: StepDrag;
|
|
16
17
|
contextMenuTime: number;
|
|
@@ -22,9 +23,8 @@ export default abstract class BaseNode extends Component<IProps, Istate> {
|
|
|
22
23
|
getAnchors(): h.JSX.Element[];
|
|
23
24
|
getText(): "" | h.JSX.Element;
|
|
24
25
|
getStateClassName(): string;
|
|
25
|
-
onDraging: ({
|
|
26
|
-
|
|
27
|
-
deltaY: any;
|
|
26
|
+
onDraging: ({ event }: {
|
|
27
|
+
event: any;
|
|
28
28
|
}) => void;
|
|
29
29
|
onDragEnd: () => void;
|
|
30
30
|
handleClick: (e: MouseEvent) => void;
|