@logicflow/extension 1.2.23 → 1.2.25
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/cjs/components/dnd-panel/index.js +10 -0
- package/cjs/components/selection-select/index.js +13 -0
- package/cjs/style/index.css +4 -0
- package/es/components/dnd-panel/index.d.ts +1 -0
- package/es/components/dnd-panel/index.js +10 -0
- package/es/components/selection-select/index.d.ts +1 -0
- package/es/components/selection-select/index.js +13 -0
- package/es/style/index.css +4 -0
- package/lib/DndPanel.js +1 -1
- package/lib/SelectionSelect.js +1 -1
- package/lib/style/index.css +4 -0
- package/package.json +2 -2
- package/types/NodeResize/BasicShape/Polygon.d.ts +10 -0
- package/types/NodeResize/BasicShape/Rect.d.ts +17 -0
- package/types/NodeResize/Control/Control.d.ts +66 -0
- package/types/NodeResize/Control/ControlGroup.d.ts +13 -0
- package/types/NodeResize/Control/Util.d.ts +33 -0
- package/types/NodeResize/Node/DiamondResize.d.ts +30 -0
- package/types/NodeResize/Node/EllipseResize.d.ts +30 -0
- package/types/NodeResize/Node/HtmlResize.d.ts +30 -0
- package/types/NodeResize/Node/RectResize.d.ts +32 -0
- package/types/NodeResize/index.d.ts +11 -0
- package/types/bpmn/constant.d.ts +46 -0
- package/types/bpmn/events/EndEvent.d.ts +21 -0
- package/types/bpmn/events/StartEvent.d.ts +17 -0
- package/types/bpmn/flow/SequenceFlow.d.ts +15 -0
- package/types/bpmn/gateways/ExclusiveGateway.d.ts +16 -0
- package/types/bpmn/getBpmnId.d.ts +1 -0
- package/types/bpmn/index.d.ts +13 -0
- package/types/bpmn/tasks/ServiceTask.d.ts +17 -0
- package/types/bpmn/tasks/UserTask.d.ts +17 -0
- package/types/bpmn-adapter/bpmnIds.d.ts +1 -0
- package/types/bpmn-adapter/index.d.ts +63 -0
- package/types/bpmn-adapter/json2xml.d.ts +3 -0
- package/types/bpmn-adapter/xml2json.d.ts +2 -0
- package/types/bpmn-elements/index.d.ts +17 -0
- package/types/bpmn-elements/presets/Event/EndEventFactory.d.ts +5 -0
- package/types/bpmn-elements/presets/Event/IntermediateCatchEvent.d.ts +5 -0
- package/types/bpmn-elements/presets/Event/IntermediateThrowEvent.d.ts +5 -0
- package/types/bpmn-elements/presets/Event/StartEventFactory.d.ts +5 -0
- package/types/bpmn-elements/presets/Event/boundaryEventFactory.d.ts +5 -0
- package/types/bpmn-elements/presets/Event/index.d.ts +2 -0
- package/types/bpmn-elements/presets/Flow/index.d.ts +7 -0
- package/types/bpmn-elements/presets/Flow/sequenceFlow.d.ts +5 -0
- package/types/bpmn-elements/presets/Gateway/gateway.d.ts +17 -0
- package/types/bpmn-elements/presets/Gateway/index.d.ts +2 -0
- package/types/bpmn-elements/presets/Task/index.d.ts +2 -0
- package/types/bpmn-elements/presets/Task/subProcess.d.ts +5 -0
- package/types/bpmn-elements/presets/Task/task.d.ts +12 -0
- package/types/bpmn-elements/presets/icons.d.ts +25 -0
- package/types/bpmn-elements/utils.d.ts +2 -0
- package/types/bpmn-elements-adapter/constant.d.ts +66 -0
- package/types/bpmn-elements-adapter/index.d.ts +103 -0
- package/types/bpmn-elements-adapter/json2xml.d.ts +3 -0
- package/types/bpmn-elements-adapter/xml2json.d.ts +2 -0
- package/types/components/context-menu/index.d.ts +34 -0
- package/types/components/control/index.d.ts +26 -0
- package/types/components/dnd-panel/index.d.ts +26 -0
- package/types/components/highlight/index.d.ts +21 -0
- package/types/components/menu/index.d.ts +50 -0
- package/types/components/mini-map/index.d.ts +88 -0
- package/types/components/selection-select/index.d.ts +43 -0
- package/types/index.d.ts +21 -0
- package/types/insert-node-in-polyline/edge.d.ts +31 -0
- package/types/insert-node-in-polyline/index.d.ts +28 -0
- package/types/materials/curved-edge/index.d.ts +14 -0
- package/types/materials/group/GroupNode.d.ts +125 -0
- package/types/materials/group/index.d.ts +65 -0
- package/types/tools/auto-layout/index.d.ts +40 -0
- package/types/tools/flow-path/index.d.ts +47 -0
- package/types/tools/snapshot/index.d.ts +26 -0
- package/types/turbo-adapter/index.d.ts +21 -0
- package/types/type/index.d.ts +6 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import LogicFlow from '@logicflow/core';
|
|
2
|
+
declare type ShapeItem = {
|
|
3
|
+
type?: string;
|
|
4
|
+
text?: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
properties?: Record<string, any>;
|
|
10
|
+
callback?: (lf: LogicFlow, container: HTMLElement) => void;
|
|
11
|
+
};
|
|
12
|
+
declare class DndPanel {
|
|
13
|
+
lf: LogicFlow;
|
|
14
|
+
shapeList: ShapeItem[];
|
|
15
|
+
panelEl: HTMLDivElement;
|
|
16
|
+
static pluginName: string;
|
|
17
|
+
domContainer: HTMLElement;
|
|
18
|
+
constructor({ lf }: {
|
|
19
|
+
lf: any;
|
|
20
|
+
});
|
|
21
|
+
render(lf: any, domContainer: any): void;
|
|
22
|
+
destroy(): void;
|
|
23
|
+
setPatternItems(shapeList: any): void;
|
|
24
|
+
private createDndItem;
|
|
25
|
+
}
|
|
26
|
+
export { DndPanel, };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import LogicFlow from '@logicflow/core';
|
|
2
|
+
declare type IMode = 'single' | 'path';
|
|
3
|
+
declare class Highlight {
|
|
4
|
+
lf: LogicFlow;
|
|
5
|
+
static pluginName: string;
|
|
6
|
+
mode: IMode;
|
|
7
|
+
manual: boolean;
|
|
8
|
+
tempStyles: {};
|
|
9
|
+
constructor({ lf }: {
|
|
10
|
+
lf: any;
|
|
11
|
+
});
|
|
12
|
+
setMode(mode: IMode): void;
|
|
13
|
+
setManual(manual: boolean): void;
|
|
14
|
+
private highlightSingle;
|
|
15
|
+
private highlightPath;
|
|
16
|
+
highlight(id: string, mode?: IMode): void;
|
|
17
|
+
restoreHighlight(): void;
|
|
18
|
+
render(lf: any, domContainer: any): void;
|
|
19
|
+
destroy(): void;
|
|
20
|
+
}
|
|
21
|
+
export { Highlight };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import LogicFlow from '@logicflow/core';
|
|
2
|
+
declare type SetType = 'add' | 'reset';
|
|
3
|
+
export declare type MenuItem = {
|
|
4
|
+
text?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
icon?: boolean;
|
|
7
|
+
callback: (element: any) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare type MenuConfig = {
|
|
10
|
+
nodeMenu?: MenuItem[] | false;
|
|
11
|
+
edgeMenu?: MenuItem[] | false;
|
|
12
|
+
graphMenu?: MenuItem[] | false;
|
|
13
|
+
};
|
|
14
|
+
declare class Menu {
|
|
15
|
+
lf: LogicFlow;
|
|
16
|
+
private __container;
|
|
17
|
+
private __menuDOM;
|
|
18
|
+
private menuTypeMap;
|
|
19
|
+
private __currentData;
|
|
20
|
+
static pluginName: string;
|
|
21
|
+
constructor({ lf }: {
|
|
22
|
+
lf: any;
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* 初始化设置默认内置菜单栏
|
|
26
|
+
*/
|
|
27
|
+
private init;
|
|
28
|
+
render(lf: any, container: any): void;
|
|
29
|
+
destroy(): void;
|
|
30
|
+
private showMenu;
|
|
31
|
+
/**
|
|
32
|
+
* 设置指定类型元素的菜单
|
|
33
|
+
*/
|
|
34
|
+
private setMenuByType;
|
|
35
|
+
/**
|
|
36
|
+
* 获取 Menu DOM
|
|
37
|
+
* @param list 菜单项
|
|
38
|
+
* @return 菜单项 DOM
|
|
39
|
+
*/
|
|
40
|
+
private __getMenuDom;
|
|
41
|
+
setMenuConfig(config: MenuConfig): void;
|
|
42
|
+
addMenuConfig(config: MenuConfig): void;
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated
|
|
45
|
+
* 复写添加
|
|
46
|
+
*/
|
|
47
|
+
changeMenuItem(type: SetType, config: MenuConfig): void;
|
|
48
|
+
}
|
|
49
|
+
export default Menu;
|
|
50
|
+
export { Menu, };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
declare class MiniMap {
|
|
2
|
+
static pluginName: string;
|
|
3
|
+
static width: number;
|
|
4
|
+
static height: number;
|
|
5
|
+
static viewPortWidth: number;
|
|
6
|
+
static viewPortHeight: number;
|
|
7
|
+
static isShowHeader: boolean;
|
|
8
|
+
static isShowCloseIcon: boolean;
|
|
9
|
+
static leftPosition: number;
|
|
10
|
+
static topPosition: number;
|
|
11
|
+
static rightPosition: any;
|
|
12
|
+
static bottomPosition: any;
|
|
13
|
+
static headerTitle: string;
|
|
14
|
+
private lf;
|
|
15
|
+
private container;
|
|
16
|
+
private miniMapWrap;
|
|
17
|
+
private miniMapContainer;
|
|
18
|
+
private lfMap;
|
|
19
|
+
private viewport;
|
|
20
|
+
private width;
|
|
21
|
+
private height;
|
|
22
|
+
private leftPosition;
|
|
23
|
+
private topPosition;
|
|
24
|
+
private rightPosition;
|
|
25
|
+
private bottomPosition;
|
|
26
|
+
private miniMapWidth;
|
|
27
|
+
private miniMapHeight;
|
|
28
|
+
private viewPortTop;
|
|
29
|
+
private viewPortLeft;
|
|
30
|
+
private startPosition;
|
|
31
|
+
private viewPortScale;
|
|
32
|
+
private viewPortWidth;
|
|
33
|
+
private viewPortHeight;
|
|
34
|
+
private resetDataX;
|
|
35
|
+
private resetDataY;
|
|
36
|
+
private LogicFlow;
|
|
37
|
+
private isShow;
|
|
38
|
+
private isShowHeader;
|
|
39
|
+
private isShowCloseIcon;
|
|
40
|
+
private dragging;
|
|
41
|
+
private disabledPlugins;
|
|
42
|
+
constructor({ lf, LogicFlow, options }: {
|
|
43
|
+
lf: any;
|
|
44
|
+
LogicFlow: any;
|
|
45
|
+
options: any;
|
|
46
|
+
});
|
|
47
|
+
render(lf: any, container: any): void;
|
|
48
|
+
init(option: any): void;
|
|
49
|
+
/**
|
|
50
|
+
* 显示mini map
|
|
51
|
+
*/
|
|
52
|
+
show: (leftPosition?: number, topPosition?: number) => void;
|
|
53
|
+
/**
|
|
54
|
+
* 隐藏mini map
|
|
55
|
+
*/
|
|
56
|
+
hide: () => void;
|
|
57
|
+
reset: () => void;
|
|
58
|
+
private setOption;
|
|
59
|
+
private initMiniMap;
|
|
60
|
+
private createMiniMap;
|
|
61
|
+
private removeMiniMap;
|
|
62
|
+
/**
|
|
63
|
+
* 计算所有图形一起,占领的区域范围。
|
|
64
|
+
* @param data
|
|
65
|
+
*/
|
|
66
|
+
private getBounds;
|
|
67
|
+
/**
|
|
68
|
+
* 将负值的平移转换为正值。
|
|
69
|
+
* 保证渲染的时候,minimap能完全展示。
|
|
70
|
+
* 获取将画布所有元素平移到0,0开始时,所有节点数据
|
|
71
|
+
*/
|
|
72
|
+
private resetData;
|
|
73
|
+
/**
|
|
74
|
+
* 显示导航
|
|
75
|
+
* 显示视口范围
|
|
76
|
+
* 1. 基于画布的范围比例,设置视口范围比例。宽度默认为导航宽度。
|
|
77
|
+
*/
|
|
78
|
+
private setView;
|
|
79
|
+
private setViewPort;
|
|
80
|
+
private createViewPort;
|
|
81
|
+
private startDrag;
|
|
82
|
+
private moveViewport;
|
|
83
|
+
private drag;
|
|
84
|
+
private drop;
|
|
85
|
+
private mapClick;
|
|
86
|
+
}
|
|
87
|
+
export default MiniMap;
|
|
88
|
+
export { MiniMap };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import LogicFlow from '@logicflow/core';
|
|
2
|
+
declare class SelectionSelect {
|
|
3
|
+
__domContainer: HTMLElement;
|
|
4
|
+
wrapper: HTMLElement;
|
|
5
|
+
lf: LogicFlow;
|
|
6
|
+
startPoint: {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
};
|
|
10
|
+
endPoint: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
};
|
|
14
|
+
__disabled: boolean;
|
|
15
|
+
isDefaultStopMoveGraph: boolean;
|
|
16
|
+
isWholeNode: boolean;
|
|
17
|
+
isWholeEdge: boolean;
|
|
18
|
+
static pluginName: string;
|
|
19
|
+
constructor({ lf }: {
|
|
20
|
+
lf: any;
|
|
21
|
+
});
|
|
22
|
+
render(lf: any, domContainer: any): void;
|
|
23
|
+
/**
|
|
24
|
+
* 设置选中的灵敏度
|
|
25
|
+
* @param isWholeEdge 是否要边的起点终点都在选区范围才算选中。默认true
|
|
26
|
+
* @param isWholeNode 是否要节点的全部点都在选区范围才算选中。默认true
|
|
27
|
+
*/
|
|
28
|
+
setSelectionSense(isWholeEdge?: boolean, isWholeNode?: boolean): void;
|
|
29
|
+
/**
|
|
30
|
+
* 开启选区
|
|
31
|
+
*/
|
|
32
|
+
openSelectionSelect(): void;
|
|
33
|
+
/**
|
|
34
|
+
* 关闭选区
|
|
35
|
+
*/
|
|
36
|
+
closeSelectionSelect(): void;
|
|
37
|
+
__draw: (ev: any) => void;
|
|
38
|
+
__drawOff: () => void;
|
|
39
|
+
__zoom: (ev: WheelEvent) => void;
|
|
40
|
+
open(): void;
|
|
41
|
+
close(): void;
|
|
42
|
+
}
|
|
43
|
+
export { SelectionSelect };
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from './bpmn';
|
|
2
|
+
export * from './bpmn-adapter';
|
|
3
|
+
export * from './bpmn-elements';
|
|
4
|
+
export * from './bpmn-elements-adapter';
|
|
5
|
+
export * from './tools/snapshot';
|
|
6
|
+
export * from './turbo-adapter';
|
|
7
|
+
export * from './insert-node-in-polyline';
|
|
8
|
+
export * from './components/control';
|
|
9
|
+
export * from './components/menu';
|
|
10
|
+
export * from './components/context-menu';
|
|
11
|
+
export * from './components/dnd-panel';
|
|
12
|
+
export * from './components/selection-select';
|
|
13
|
+
export * from './components/mini-map';
|
|
14
|
+
export * from './materials/curved-edge';
|
|
15
|
+
export * from './materials/group';
|
|
16
|
+
export * from './NodeResize';
|
|
17
|
+
export * from './tools/flow-path';
|
|
18
|
+
export * from './tools/auto-layout';
|
|
19
|
+
export * from './bpmn-adapter/xml2json';
|
|
20
|
+
export * from './bpmn-adapter/json2xml';
|
|
21
|
+
export * from './components/highlight';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Point, PolylineEdgeModel, BaseNodeModel } from '@logicflow/core';
|
|
2
|
+
/**
|
|
3
|
+
* 判断一个点是否在线段中
|
|
4
|
+
* @param point 判断的点
|
|
5
|
+
* @param start 线段的起点
|
|
6
|
+
* @param end 线段的终点
|
|
7
|
+
* @param deviation 误差范围
|
|
8
|
+
* @returns boolean
|
|
9
|
+
*/
|
|
10
|
+
export declare const isInSegment: (point: any, start: any, end: any, deviation?: number) => boolean;
|
|
11
|
+
export declare const distToSegmentSquared: (p: any, v: any, w: any) => number;
|
|
12
|
+
export declare const distToSegment: (point: Point, start: Point, end: Point) => number;
|
|
13
|
+
export declare const crossPointInSegment: (node: BaseNodeModel, start: Point, end: Point) => {
|
|
14
|
+
startCrossPoint: {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
};
|
|
18
|
+
endCrossPoint: {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
interface SegmentCross {
|
|
24
|
+
crossIndex: number;
|
|
25
|
+
crossPoints: {
|
|
26
|
+
startCrossPoint: Point;
|
|
27
|
+
endCrossPoint: Point;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export declare const isNodeInSegment: (node: BaseNodeModel, polyline: PolylineEdgeModel, deviation?: number) => SegmentCross;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import LogicFlow from '@logicflow/core';
|
|
2
|
+
declare class InsertNodeInPolyline {
|
|
3
|
+
static pluginName: string;
|
|
4
|
+
_lf: LogicFlow;
|
|
5
|
+
dndAdd: boolean;
|
|
6
|
+
dropAdd: boolean;
|
|
7
|
+
deviation: number;
|
|
8
|
+
constructor({ lf }: {
|
|
9
|
+
lf: any;
|
|
10
|
+
});
|
|
11
|
+
eventHandler(): void;
|
|
12
|
+
/**
|
|
13
|
+
* 插入节点前校验规则
|
|
14
|
+
* @param sourceNodeId
|
|
15
|
+
* @param targetNodeId
|
|
16
|
+
* @param sourceAnchorId
|
|
17
|
+
* @param targetAnchorId
|
|
18
|
+
* @param nodeData
|
|
19
|
+
*/
|
|
20
|
+
checkRuleBeforeInsetNode(sourceNodeId: any, targetNodeId: any, sourceAnchorId: any, targetAnchorId: any, nodeData: any): {
|
|
21
|
+
isPass: any;
|
|
22
|
+
sourceMsg: any;
|
|
23
|
+
targetMsg: any;
|
|
24
|
+
};
|
|
25
|
+
insetNode(nodeData: any): void;
|
|
26
|
+
}
|
|
27
|
+
export { InsertNodeInPolyline };
|
|
28
|
+
export default InsertNodeInPolyline;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PolylineEdge, PolylineEdgeModel } from '@logicflow/core';
|
|
2
|
+
declare function getCurvedEdgePath(points: number[][], radius: number): string;
|
|
3
|
+
declare class CurvedEdge extends PolylineEdge {
|
|
4
|
+
getEdge(): import("preact").VNode<any>;
|
|
5
|
+
}
|
|
6
|
+
declare class CurvedEdgeModel extends PolylineEdgeModel {
|
|
7
|
+
}
|
|
8
|
+
declare const defaultCurvedEdge: {
|
|
9
|
+
type: string;
|
|
10
|
+
view: typeof CurvedEdge;
|
|
11
|
+
model: typeof CurvedEdgeModel;
|
|
12
|
+
};
|
|
13
|
+
export default defaultCurvedEdge;
|
|
14
|
+
export { CurvedEdge, CurvedEdgeModel, getCurvedEdgePath };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { h } from '@logicflow/core';
|
|
2
|
+
import { RectResize } from '../../NodeResize';
|
|
3
|
+
declare class GroupNodeModel extends RectResize.model {
|
|
4
|
+
readonly isGroup = true;
|
|
5
|
+
/**
|
|
6
|
+
* 此分组的子节点Id
|
|
7
|
+
*/
|
|
8
|
+
children: Set<string>;
|
|
9
|
+
/**
|
|
10
|
+
* 其子节点是否被禁止通过拖拽移出分组。 默认false,允许拖拽移除分组。
|
|
11
|
+
*/
|
|
12
|
+
isRestrict: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* 分组节点是否允许调整大小。
|
|
15
|
+
*/
|
|
16
|
+
resizable: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* 分组节点是否允许折叠
|
|
19
|
+
*/
|
|
20
|
+
foldable: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* 折叠后的宽度
|
|
23
|
+
*/
|
|
24
|
+
foldedWidth: number;
|
|
25
|
+
/**
|
|
26
|
+
* 折叠后的高度
|
|
27
|
+
*/
|
|
28
|
+
foldedHeight: number;
|
|
29
|
+
/**
|
|
30
|
+
* 分组折叠状态
|
|
31
|
+
*/
|
|
32
|
+
isFolded: boolean;
|
|
33
|
+
unfoldedWidth: number;
|
|
34
|
+
unfoldedHight: number;
|
|
35
|
+
/**
|
|
36
|
+
* children元素上一次折叠的状态缓存
|
|
37
|
+
*/
|
|
38
|
+
childrenLastFoldStatus: Record<string, boolean>;
|
|
39
|
+
initNodeData(data: any): void;
|
|
40
|
+
getResizeOutlineStyle(): {
|
|
41
|
+
fill: string;
|
|
42
|
+
stroke: string;
|
|
43
|
+
strokeWidth: number;
|
|
44
|
+
strokeDasharray: string;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* 折叠分组
|
|
48
|
+
* 1. 折叠分组的宽高
|
|
49
|
+
* 2. 处理分组子节点
|
|
50
|
+
* 3. 处理连线
|
|
51
|
+
*/
|
|
52
|
+
foldGroup(isFolded: any): void;
|
|
53
|
+
getAnchorStyle(anchorInfo: any): Record<string, any>;
|
|
54
|
+
/**
|
|
55
|
+
* 折叠分组的时候,处理分组自身的连线和分组内部子节点上的连线
|
|
56
|
+
* 边的分类:
|
|
57
|
+
* - 虚拟边:分组被收起时,表示分组本身与外部节点关系的边。
|
|
58
|
+
* - 真实边:分组本身或者分组内部节点与外部节点节点(非收起分组)关系的边。
|
|
59
|
+
* 如果一个分组,本身与外部节点有M条连线,且内部N个子节点与外部节点有连线,那么这个分组收起时会生成M+N条连线。
|
|
60
|
+
* 折叠分组时:
|
|
61
|
+
* - 原有的虚拟边删除;
|
|
62
|
+
* - 创建一个虚拟边;
|
|
63
|
+
* - 真实边则隐藏;
|
|
64
|
+
* 展开分组是:
|
|
65
|
+
* - 原有的虚拟边删除;
|
|
66
|
+
* - 如果目外部点是收起的分组,则创建虚拟边;
|
|
67
|
+
* - 如果外部节点是普通节点,则显示真实边;
|
|
68
|
+
*/
|
|
69
|
+
private foldEdge;
|
|
70
|
+
createVirtualEdge(edgeData: any): void;
|
|
71
|
+
isInRange({ x1, y1, x2, y2 }: {
|
|
72
|
+
x1: any;
|
|
73
|
+
y1: any;
|
|
74
|
+
x2: any;
|
|
75
|
+
y2: any;
|
|
76
|
+
}): boolean;
|
|
77
|
+
isAllowMoveTo({ x1, y1, x2, y2 }: {
|
|
78
|
+
x1: any;
|
|
79
|
+
y1: any;
|
|
80
|
+
x2: any;
|
|
81
|
+
y2: any;
|
|
82
|
+
}): {
|
|
83
|
+
x: boolean;
|
|
84
|
+
y: boolean;
|
|
85
|
+
};
|
|
86
|
+
setAllowAppendChild(isAllow: any): void;
|
|
87
|
+
/**
|
|
88
|
+
* 添加分组子节点
|
|
89
|
+
* @param id 节点id
|
|
90
|
+
*/
|
|
91
|
+
addChild(id: any): void;
|
|
92
|
+
/**
|
|
93
|
+
* 删除分组子节点
|
|
94
|
+
* @param id 节点id
|
|
95
|
+
*/
|
|
96
|
+
removeChild(id: any): void;
|
|
97
|
+
getAddableOutlineStyle(): {
|
|
98
|
+
stroke: string;
|
|
99
|
+
strokeWidth: number;
|
|
100
|
+
strokeDasharray: string;
|
|
101
|
+
fill: string;
|
|
102
|
+
};
|
|
103
|
+
getData(): import("@logicflow/core").NodeData;
|
|
104
|
+
getHistoryData(): import("@logicflow/core").NodeData;
|
|
105
|
+
/**
|
|
106
|
+
* 是否允许此节点添加到此分组中
|
|
107
|
+
*/
|
|
108
|
+
isAllowAppendIn(nodeData: any): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* 当groupA被添加到groupB中时,将groupB及groupB所属的group的zIndex减1
|
|
111
|
+
*/
|
|
112
|
+
toBack(): void;
|
|
113
|
+
}
|
|
114
|
+
declare class GroupNode extends RectResize.view {
|
|
115
|
+
getControlGroup(): h.JSX.Element;
|
|
116
|
+
getAddableShape(): import("preact").VNode<any>;
|
|
117
|
+
getFoldIcon(): import("preact").VNode<any>;
|
|
118
|
+
getResizeShape(): import("preact").VNode<any>;
|
|
119
|
+
}
|
|
120
|
+
declare const _default: {
|
|
121
|
+
type: string;
|
|
122
|
+
view: typeof GroupNode;
|
|
123
|
+
model: typeof GroupNodeModel;
|
|
124
|
+
};
|
|
125
|
+
export default _default;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import LogicFlow, { BaseEdgeModel, BaseNodeModel, EdgeConfig } from '@logicflow/core';
|
|
2
|
+
import GroupNode from './GroupNode';
|
|
3
|
+
declare type BaseNodeId = string;
|
|
4
|
+
declare type GroupId = string;
|
|
5
|
+
declare type Bounds = {
|
|
6
|
+
x1: number;
|
|
7
|
+
y1: number;
|
|
8
|
+
x2: number;
|
|
9
|
+
y2: number;
|
|
10
|
+
};
|
|
11
|
+
declare class Group {
|
|
12
|
+
static pluginName: string;
|
|
13
|
+
lf: LogicFlow;
|
|
14
|
+
topGroupZIndex: number;
|
|
15
|
+
activeGroup: any;
|
|
16
|
+
nodeGroupMap: Map<BaseNodeId, GroupId>;
|
|
17
|
+
constructor({ lf }: {
|
|
18
|
+
lf: any;
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* 创建一个Group类型节点内部的所有子节点的副本
|
|
22
|
+
* 并且在遍历所有nodes的过程中顺便拿到所有edges(只在Group范围的edges)
|
|
23
|
+
*/
|
|
24
|
+
createAllChildNodes(nodeIdMap: Record<string, string>, children: Set<string>, current: BaseNodeModel, distance: number): {
|
|
25
|
+
nodesArray: BaseNodeModel[];
|
|
26
|
+
edgesArray: EdgeConfig[];
|
|
27
|
+
};
|
|
28
|
+
createEdgeModel(edge: EdgeConfig, nodeIdMap: Record<string, string>, distance: number): BaseEdgeModel;
|
|
29
|
+
/**
|
|
30
|
+
* 获取一个节点内部所有的子节点,包裹分组的子节点
|
|
31
|
+
*/
|
|
32
|
+
getNodeAllChild(model: any): any[];
|
|
33
|
+
graphRendered: (data: any) => void;
|
|
34
|
+
appendNodeToGroup: ({ data }: {
|
|
35
|
+
data: any;
|
|
36
|
+
}) => void;
|
|
37
|
+
deleteGroupChild: ({ data }: {
|
|
38
|
+
data: any;
|
|
39
|
+
}) => void;
|
|
40
|
+
setActiveGroup: ({ data }: {
|
|
41
|
+
data: any;
|
|
42
|
+
}) => void;
|
|
43
|
+
/**
|
|
44
|
+
* 1. 分组节点默认在普通节点下面。
|
|
45
|
+
* 2. 分组节点被选中后,会将分组节点以及其内部的其他分组节点放到其余分组节点的上面。
|
|
46
|
+
* 3. 分组节点取消选中后,不会将分组节点重置为原来的高度。
|
|
47
|
+
* 4. 由于LogicFlow核心目标是支持用户手动绘制流程图,所以不考虑一张流程图超过1000个分组节点的情况。
|
|
48
|
+
*/
|
|
49
|
+
nodeSelected: ({ data, isMultiple, isSelected }: {
|
|
50
|
+
data: any;
|
|
51
|
+
isMultiple: any;
|
|
52
|
+
isSelected: any;
|
|
53
|
+
}) => void;
|
|
54
|
+
toFrontGroup: (model: any) => void;
|
|
55
|
+
/**
|
|
56
|
+
* 获取自定位置其所属分组
|
|
57
|
+
* 当分组重合时,优先返回最上层的分组
|
|
58
|
+
*/
|
|
59
|
+
getGroup(bounds: Bounds, nodeData: BaseNodeModel): BaseNodeModel | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* 获取某个节点所属的groupModel
|
|
62
|
+
*/
|
|
63
|
+
getNodeGroup(nodeId: any): BaseNodeModel;
|
|
64
|
+
}
|
|
65
|
+
export { Group, GroupNode, };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 自动布局插件
|
|
3
|
+
* 依赖flowPath插件
|
|
4
|
+
* 未完善
|
|
5
|
+
*/
|
|
6
|
+
import LogicFlow from '@logicflow/core';
|
|
7
|
+
declare class AutoLayout {
|
|
8
|
+
lf: LogicFlow;
|
|
9
|
+
levelHeight: any[];
|
|
10
|
+
newNodeMap: Map<string, any>;
|
|
11
|
+
trunk: any[];
|
|
12
|
+
static pluginName: string;
|
|
13
|
+
constructor({ lf }: {
|
|
14
|
+
lf: any;
|
|
15
|
+
});
|
|
16
|
+
layout(data: any, path: any): void;
|
|
17
|
+
private setNodePosition;
|
|
18
|
+
/**
|
|
19
|
+
* 1. 处理边上的文本
|
|
20
|
+
* 2. 主干节点之间直接的边
|
|
21
|
+
* 3. 一个节点被多个连接作为目标节点,合理分配锚点位置。
|
|
22
|
+
*/
|
|
23
|
+
private getEdgeDataPoints;
|
|
24
|
+
/**
|
|
25
|
+
* 获取边的连接节点相对位置。
|
|
26
|
+
* source一定在target左边。
|
|
27
|
+
* 1. 如果source和target在同一x, y坐标内容。
|
|
28
|
+
* 2. 如果source在target左上方。
|
|
29
|
+
* 3. 如果source在target左下方。
|
|
30
|
+
*/
|
|
31
|
+
private getRelativePosition;
|
|
32
|
+
/**
|
|
33
|
+
* 获取边节点图形的宽高。
|
|
34
|
+
*/
|
|
35
|
+
private getShape;
|
|
36
|
+
private formatData;
|
|
37
|
+
addLevelHeight(level: any, height?: number, isNegative?: boolean): void;
|
|
38
|
+
getLevelHeight(level: any, isNegative?: boolean): any;
|
|
39
|
+
}
|
|
40
|
+
export { AutoLayout };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 路径插件,此插件支持获取绘制的图中所有的路径。
|
|
3
|
+
* 需要指定开始节点类型。
|
|
4
|
+
*/
|
|
5
|
+
import LogicFlow from '@logicflow/core';
|
|
6
|
+
declare type Path = {
|
|
7
|
+
routeId: string;
|
|
8
|
+
name: string;
|
|
9
|
+
elements: string[];
|
|
10
|
+
type: number;
|
|
11
|
+
};
|
|
12
|
+
declare type RawPath = Path & {
|
|
13
|
+
similarElement: RawPath;
|
|
14
|
+
weight: number;
|
|
15
|
+
};
|
|
16
|
+
declare class FlowPath {
|
|
17
|
+
lf: LogicFlow;
|
|
18
|
+
pathes: RawPath[];
|
|
19
|
+
startNodeType: string;
|
|
20
|
+
static pluginName: string;
|
|
21
|
+
constructor({ lf }: {
|
|
22
|
+
lf: any;
|
|
23
|
+
});
|
|
24
|
+
setPathes(pathes: any): void;
|
|
25
|
+
getPathes(): any[];
|
|
26
|
+
private findPathElements;
|
|
27
|
+
/**
|
|
28
|
+
* 设置路径id
|
|
29
|
+
* 如果存在原始路径Id, 则需要比较新路径是否在原始路径中存在相似路径
|
|
30
|
+
* 如果有,则尽量使用原始路径。
|
|
31
|
+
* 相似路径
|
|
32
|
+
* 1. 如果所有的节点都相同,则必定为同一路径。(包括顺序不同)
|
|
33
|
+
* 2. 如果新路径比原来路径少了或者多了部分节点,则记录为相似路径。基于不同的差异,标记不同的权重。
|
|
34
|
+
* 3. 基于新路径在旧路径占用权限,设置新路径Id.
|
|
35
|
+
* 4. 如果某一条旧路径被多条新路径标记为相同的权重,则这两条新路径都使用新Id.
|
|
36
|
+
*/
|
|
37
|
+
private getNewPathes;
|
|
38
|
+
private similar2Path;
|
|
39
|
+
private getNewId;
|
|
40
|
+
/**
|
|
41
|
+
* 判断是否为循环路径
|
|
42
|
+
* 由于前面进行了特殊处理,将循环部分单独提出来作为路径
|
|
43
|
+
* 所有循环路径必定开始节点等于结束节点。
|
|
44
|
+
*/
|
|
45
|
+
private isLoopPath;
|
|
46
|
+
}
|
|
47
|
+
export { FlowPath, };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 快照插件,生成视图
|
|
3
|
+
*/
|
|
4
|
+
declare class Snapshot {
|
|
5
|
+
static pluginName: string;
|
|
6
|
+
lf: any;
|
|
7
|
+
offsetX: number;
|
|
8
|
+
offsetY: number;
|
|
9
|
+
fileName: string;
|
|
10
|
+
customCssRules: string;
|
|
11
|
+
useGlobalRules: boolean;
|
|
12
|
+
constructor({ lf }: {
|
|
13
|
+
lf: any;
|
|
14
|
+
});
|
|
15
|
+
getSvgRootElement(lf: any): any;
|
|
16
|
+
triggerDownload(imgURI: string): void;
|
|
17
|
+
removeAnchor(element: any): void;
|
|
18
|
+
removeRotateControl(element: any): void;
|
|
19
|
+
getSnapshot(fileName: string, backgroundColor: string): void;
|
|
20
|
+
getSnapshotBase64(backgroundColor: string): Promise<unknown>;
|
|
21
|
+
getSnapshotBlob(backgroundColor: string): Promise<unknown>;
|
|
22
|
+
getClassRules(): string;
|
|
23
|
+
getCanvasData(svg: SVGGraphicsElement, backgroundColor: string): Promise<unknown>;
|
|
24
|
+
}
|
|
25
|
+
export default Snapshot;
|
|
26
|
+
export { Snapshot };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare function toTurboData(data: any): {
|
|
2
|
+
flowElementList: any[];
|
|
3
|
+
};
|
|
4
|
+
export declare function toLogicflowData(data: any): {
|
|
5
|
+
nodes: any[];
|
|
6
|
+
edges: any[];
|
|
7
|
+
};
|
|
8
|
+
declare class TurboAdapter {
|
|
9
|
+
static pluginName: string;
|
|
10
|
+
constructor({ lf }: {
|
|
11
|
+
lf: any;
|
|
12
|
+
});
|
|
13
|
+
adapterOut(logicflowData: any): {
|
|
14
|
+
flowElementList: any[];
|
|
15
|
+
};
|
|
16
|
+
adapterIn(turboData: any): {
|
|
17
|
+
nodes: any[];
|
|
18
|
+
edges: any[];
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export default TurboAdapter;
|