@logicflow/core 0.7.9 → 0.7.13-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/CHANGELOG.md +41 -0
- package/dist/logic-flow.js +2 -2
- package/dist/style/index.css +14 -0
- package/package.json +2 -2
- package/types/model/EditConfigModel.d.ts +6 -0
- package/types/model/edge/BaseEdgeModel.d.ts +1 -0
- package/types/model/node/BaseNodeModel.d.ts +1 -0
- package/types/options.d.ts +16 -0
- package/types/tool/MultipleSelectTool.d.ts +1 -0
- package/types/tool/TextEditTool.d.ts +1 -0
- package/types/tool/index.d.ts +1 -0
- package/types/util/graph.d.ts +4 -0
- package/types/view/node/BaseNode.d.ts +29 -38
- package/types/view/node/CircleNode.d.ts +13 -16
- package/types/view/node/DiamondNode.d.ts +13 -16
- package/types/view/node/EllipseNode.d.ts +12 -15
- package/types/view/node/PolygonNode.d.ts +13 -35
- package/types/view/node/RectNode.d.ts +13 -16
package/dist/style/index.css
CHANGED
|
@@ -112,6 +112,20 @@
|
|
|
112
112
|
background: transparent;
|
|
113
113
|
text-align: center;
|
|
114
114
|
word-break: break-all;
|
|
115
|
+
width: 100%;
|
|
116
|
+
}
|
|
117
|
+
.lf-node-text-ellipsis-content {
|
|
118
|
+
line-height: 1.2;
|
|
119
|
+
background: transparent;
|
|
120
|
+
text-align: center;
|
|
121
|
+
white-space: nowrap;
|
|
122
|
+
/* overflow: hidden;
|
|
123
|
+
text-overflow: ellipsis; */
|
|
124
|
+
width: 100%;
|
|
125
|
+
}
|
|
126
|
+
.lf-node-text-ellipsis-content>div{
|
|
127
|
+
text-overflow: ellipsis;
|
|
128
|
+
overflow: hidden;
|
|
115
129
|
}
|
|
116
130
|
/* tool-overlay */
|
|
117
131
|
.lf-tool-overlay {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logicflow/core",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.13-alpha.0",
|
|
4
4
|
"description": "LogicFlow core, to quickly build flowchart editor",
|
|
5
5
|
"main": "dist/logic-flow.js",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"last 2 versions",
|
|
93
93
|
"not ie <= 11"
|
|
94
94
|
],
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "898f500224249251d4bdb9e018615dc8ad8b6db8"
|
|
96
96
|
}
|
|
@@ -67,6 +67,11 @@ export interface EditConfigInterface {
|
|
|
67
67
|
* 允许meta多选元素
|
|
68
68
|
*/
|
|
69
69
|
metaKeyMultipleSelected?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* 多选按键, 支持meta(cmd)、shift、alt
|
|
72
|
+
* 不支持ctrl,ctrl会出发contextmenu
|
|
73
|
+
*/
|
|
74
|
+
multipleSelectKey?: string;
|
|
70
75
|
/**
|
|
71
76
|
* 外部传入的额外配置, 待优化,这里不够易用。
|
|
72
77
|
*/
|
|
@@ -92,6 +97,7 @@ export default class EditConfigModel {
|
|
|
92
97
|
nodeTextDraggable: boolean;
|
|
93
98
|
edgeTextDraggable: boolean;
|
|
94
99
|
metaKeyMultipleSelected: boolean;
|
|
100
|
+
multipleSelectKey: string;
|
|
95
101
|
extraConf: {};
|
|
96
102
|
defaultConfig: {};
|
|
97
103
|
constructor(config: EditConfigInterface);
|
package/types/options.d.ts
CHANGED
|
@@ -46,6 +46,13 @@ export declare type Definition = {
|
|
|
46
46
|
hideOutline?: boolean;
|
|
47
47
|
overlapMode?: OverlapMode;
|
|
48
48
|
idGenerator?: () => number | string;
|
|
49
|
+
/**
|
|
50
|
+
* 禁止启用的内置工具
|
|
51
|
+
* 有些场景下,需要自定义多选效果或者文本编辑效果,则需要禁用这些内置的工具
|
|
52
|
+
* multipleSelect和textEdit
|
|
53
|
+
* todo: 将multipleSelect放到插件中
|
|
54
|
+
*/
|
|
55
|
+
disabledTools?: string[];
|
|
49
56
|
} & EditConfigInterface;
|
|
50
57
|
export interface GuardsTypes {
|
|
51
58
|
beforeClone?: (data: NodeData | GraphConfigData) => boolean;
|
|
@@ -55,6 +62,7 @@ export declare function get(options: Definition): {
|
|
|
55
62
|
background: boolean;
|
|
56
63
|
grid: boolean;
|
|
57
64
|
textEdit: boolean;
|
|
65
|
+
disabledTools: any[];
|
|
58
66
|
} & {
|
|
59
67
|
/**
|
|
60
68
|
* 画布初始化容器
|
|
@@ -88,10 +96,18 @@ export declare function get(options: Definition): {
|
|
|
88
96
|
hideOutline?: boolean;
|
|
89
97
|
overlapMode?: OverlapMode;
|
|
90
98
|
idGenerator?: () => string | number;
|
|
99
|
+
/**
|
|
100
|
+
* 禁止启用的内置工具
|
|
101
|
+
* 有些场景下,需要自定义多选效果或者文本编辑效果,则需要禁用这些内置的工具
|
|
102
|
+
* multipleSelect和textEdit
|
|
103
|
+
* todo: 将multipleSelect放到插件中
|
|
104
|
+
*/
|
|
105
|
+
disabledTools?: string[];
|
|
91
106
|
} & EditConfigInterface;
|
|
92
107
|
export declare const defaults: {
|
|
93
108
|
background: boolean;
|
|
94
109
|
grid: boolean;
|
|
95
110
|
textEdit: boolean;
|
|
111
|
+
disabledTools: any[];
|
|
96
112
|
};
|
|
97
113
|
export {};
|
package/types/tool/index.d.ts
CHANGED
package/types/util/graph.d.ts
CHANGED
|
@@ -6,3 +6,7 @@ export declare const getById: (id: any, data: any) => any;
|
|
|
6
6
|
* @param rightBottomPoint 区域的右下角点
|
|
7
7
|
*/
|
|
8
8
|
export declare const isPointInArea: ([x, y]: [any, any], [leftTopX, leftTopY]: [any, any], [rightBottomX, rightBottomY]: [any, any]) => boolean;
|
|
9
|
+
/**
|
|
10
|
+
* 判断鼠标点击选中元素的时候,是否为多选
|
|
11
|
+
*/
|
|
12
|
+
export declare const isMultipleSelect: (e: MouseEvent, editConfig: any) => boolean;
|
|
@@ -12,6 +12,33 @@ declare type Istate = {
|
|
|
12
12
|
isDraging: boolean;
|
|
13
13
|
isHovered: boolean;
|
|
14
14
|
};
|
|
15
|
+
declare type StyleAttribute = {
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
fill: string;
|
|
19
|
+
fillOpacity?: number;
|
|
20
|
+
strokeWidth?: number;
|
|
21
|
+
stroke: string;
|
|
22
|
+
strokeOpacity?: number;
|
|
23
|
+
opacity?: number;
|
|
24
|
+
outlineColor?: string;
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
};
|
|
27
|
+
export declare type NodeAttributes = {
|
|
28
|
+
id: string;
|
|
29
|
+
properties: Record<string, any>;
|
|
30
|
+
type: string;
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
isSelected: boolean;
|
|
34
|
+
isHovered: boolean;
|
|
35
|
+
text: {
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
value: string;
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
};
|
|
41
|
+
} & StyleAttribute;
|
|
15
42
|
export default abstract class BaseNode extends Component<IProps, Istate> {
|
|
16
43
|
static getModel(defaultModel: any): any;
|
|
17
44
|
stepDrag: StepDrag;
|
|
@@ -20,44 +47,8 @@ export default abstract class BaseNode extends Component<IProps, Istate> {
|
|
|
20
47
|
clickTimer: number;
|
|
21
48
|
constructor(props: any);
|
|
22
49
|
abstract getShape(): any;
|
|
23
|
-
getShapeStyle():
|
|
24
|
-
|
|
25
|
-
height: number;
|
|
26
|
-
fill: string;
|
|
27
|
-
fillOpacity: number;
|
|
28
|
-
strokeWidth: number;
|
|
29
|
-
stroke: string;
|
|
30
|
-
strokeOpacity: number;
|
|
31
|
-
opacity: number;
|
|
32
|
-
outlineColor: string;
|
|
33
|
-
};
|
|
34
|
-
getAttributes(): {
|
|
35
|
-
width: number;
|
|
36
|
-
height: number;
|
|
37
|
-
fill: string;
|
|
38
|
-
fillOpacity: number;
|
|
39
|
-
strokeWidth: number;
|
|
40
|
-
stroke: string;
|
|
41
|
-
strokeOpacity: number;
|
|
42
|
-
opacity: number;
|
|
43
|
-
outlineColor: string;
|
|
44
|
-
id: string;
|
|
45
|
-
properties: {
|
|
46
|
-
[x: string]: any;
|
|
47
|
-
};
|
|
48
|
-
type: string;
|
|
49
|
-
x: number;
|
|
50
|
-
y: number;
|
|
51
|
-
isSelected: boolean;
|
|
52
|
-
isHovered: boolean;
|
|
53
|
-
text: {
|
|
54
|
-
value: string;
|
|
55
|
-
x: number;
|
|
56
|
-
y: number;
|
|
57
|
-
draggable: boolean;
|
|
58
|
-
editable: boolean;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
50
|
+
getShapeStyle(): StyleAttribute;
|
|
51
|
+
getAttributes(): NodeAttributes;
|
|
61
52
|
getProperties(): Record<string, any>;
|
|
62
53
|
getAnchorStyle(): Record<string, any>;
|
|
63
54
|
getAnchorHoverStyle(): Record<string, any>;
|
|
@@ -6,39 +6,36 @@ export default class CircleNode extends BaseNode {
|
|
|
6
6
|
width: number;
|
|
7
7
|
height: number;
|
|
8
8
|
fill: string;
|
|
9
|
-
fillOpacity
|
|
10
|
-
strokeWidth
|
|
9
|
+
fillOpacity?: number;
|
|
10
|
+
strokeWidth?: number;
|
|
11
11
|
stroke: string;
|
|
12
|
-
strokeOpacity
|
|
13
|
-
opacity
|
|
14
|
-
outlineColor
|
|
12
|
+
strokeOpacity?: number;
|
|
13
|
+
opacity?: number;
|
|
14
|
+
outlineColor?: string;
|
|
15
15
|
};
|
|
16
16
|
getAttributes(): {
|
|
17
17
|
r: number;
|
|
18
18
|
width: number;
|
|
19
19
|
height: number;
|
|
20
20
|
fill: string;
|
|
21
|
-
fillOpacity
|
|
22
|
-
strokeWidth
|
|
21
|
+
fillOpacity?: number;
|
|
22
|
+
strokeWidth?: number;
|
|
23
23
|
stroke: string;
|
|
24
|
-
strokeOpacity
|
|
25
|
-
opacity
|
|
26
|
-
outlineColor
|
|
24
|
+
strokeOpacity?: number;
|
|
25
|
+
opacity?: number;
|
|
26
|
+
outlineColor?: string;
|
|
27
27
|
id: string;
|
|
28
|
-
properties:
|
|
29
|
-
[x: string]: any;
|
|
30
|
-
};
|
|
28
|
+
properties: Record<string, any>;
|
|
31
29
|
type: string;
|
|
32
30
|
x: number;
|
|
33
31
|
y: number;
|
|
34
32
|
isSelected: boolean;
|
|
35
33
|
isHovered: boolean;
|
|
36
34
|
text: {
|
|
37
|
-
|
|
35
|
+
[key: string]: any;
|
|
38
36
|
x: number;
|
|
39
37
|
y: number;
|
|
40
|
-
|
|
41
|
-
editable: boolean;
|
|
38
|
+
value: string;
|
|
42
39
|
};
|
|
43
40
|
};
|
|
44
41
|
getShape(): h.JSX.Element;
|
|
@@ -6,39 +6,36 @@ export default class DiamondNode extends BaseNode {
|
|
|
6
6
|
width: number;
|
|
7
7
|
height: number;
|
|
8
8
|
fill: string;
|
|
9
|
-
fillOpacity
|
|
10
|
-
strokeWidth
|
|
9
|
+
fillOpacity?: number;
|
|
10
|
+
strokeWidth?: number;
|
|
11
11
|
stroke: string;
|
|
12
|
-
strokeOpacity
|
|
13
|
-
opacity
|
|
14
|
-
outlineColor
|
|
12
|
+
strokeOpacity?: number;
|
|
13
|
+
opacity?: number;
|
|
14
|
+
outlineColor?: string;
|
|
15
15
|
};
|
|
16
16
|
getAttributes(): {
|
|
17
17
|
points: import("../..").PointTuple[];
|
|
18
18
|
width: number;
|
|
19
19
|
height: number;
|
|
20
20
|
fill: string;
|
|
21
|
-
fillOpacity
|
|
22
|
-
strokeWidth
|
|
21
|
+
fillOpacity?: number;
|
|
22
|
+
strokeWidth?: number;
|
|
23
23
|
stroke: string;
|
|
24
|
-
strokeOpacity
|
|
25
|
-
opacity
|
|
26
|
-
outlineColor
|
|
24
|
+
strokeOpacity?: number;
|
|
25
|
+
opacity?: number;
|
|
26
|
+
outlineColor?: string;
|
|
27
27
|
id: string;
|
|
28
|
-
properties:
|
|
29
|
-
[x: string]: any;
|
|
30
|
-
};
|
|
28
|
+
properties: Record<string, any>;
|
|
31
29
|
type: string;
|
|
32
30
|
x: number;
|
|
33
31
|
y: number;
|
|
34
32
|
isSelected: boolean;
|
|
35
33
|
isHovered: boolean;
|
|
36
34
|
text: {
|
|
37
|
-
|
|
35
|
+
[key: string]: any;
|
|
38
36
|
x: number;
|
|
39
37
|
y: number;
|
|
40
|
-
|
|
41
|
-
editable: boolean;
|
|
38
|
+
value: string;
|
|
42
39
|
};
|
|
43
40
|
};
|
|
44
41
|
getShape(): h.JSX.Element;
|
|
@@ -4,31 +4,28 @@ export default class EllipseNode extends BaseNode {
|
|
|
4
4
|
getAttributes(): {
|
|
5
5
|
rx: number;
|
|
6
6
|
ry: number;
|
|
7
|
-
width: number;
|
|
8
|
-
height: number;
|
|
9
|
-
fill: string;
|
|
10
|
-
fillOpacity: number;
|
|
11
|
-
strokeWidth: number;
|
|
12
|
-
stroke: string;
|
|
13
|
-
strokeOpacity: number;
|
|
14
|
-
opacity: number;
|
|
15
|
-
outlineColor: string;
|
|
16
7
|
id: string;
|
|
17
|
-
properties:
|
|
18
|
-
[x: string]: any;
|
|
19
|
-
};
|
|
8
|
+
properties: Record<string, any>;
|
|
20
9
|
type: string;
|
|
21
10
|
x: number;
|
|
22
11
|
y: number;
|
|
23
12
|
isSelected: boolean;
|
|
24
13
|
isHovered: boolean;
|
|
25
14
|
text: {
|
|
26
|
-
|
|
15
|
+
[key: string]: any;
|
|
27
16
|
x: number;
|
|
28
17
|
y: number;
|
|
29
|
-
|
|
30
|
-
editable: boolean;
|
|
18
|
+
value: string;
|
|
31
19
|
};
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
fill: string;
|
|
23
|
+
fillOpacity?: number;
|
|
24
|
+
strokeWidth?: number;
|
|
25
|
+
stroke: string;
|
|
26
|
+
strokeOpacity?: number;
|
|
27
|
+
opacity?: number;
|
|
28
|
+
outlineColor?: string;
|
|
32
29
|
};
|
|
33
30
|
getShape(): h.JSX.Element;
|
|
34
31
|
}
|
|
@@ -1,45 +1,23 @@
|
|
|
1
1
|
import { h } from 'preact';
|
|
2
|
-
import BaseNode from './BaseNode';
|
|
2
|
+
import BaseNode, { NodeAttributes } from './BaseNode';
|
|
3
|
+
import { PointTuple } from '../../type';
|
|
4
|
+
declare type PolygonNodeAttributes = {
|
|
5
|
+
points: PointTuple[];
|
|
6
|
+
} & NodeAttributes;
|
|
3
7
|
export default class PolygonNode extends BaseNode {
|
|
4
8
|
getShapeStyle(): {
|
|
5
|
-
points:
|
|
9
|
+
points: PointTuple[];
|
|
6
10
|
width: number;
|
|
7
11
|
height: number;
|
|
8
12
|
fill: string;
|
|
9
|
-
fillOpacity
|
|
10
|
-
strokeWidth
|
|
13
|
+
fillOpacity?: number;
|
|
14
|
+
strokeWidth?: number;
|
|
11
15
|
stroke: string;
|
|
12
|
-
strokeOpacity
|
|
13
|
-
opacity
|
|
14
|
-
outlineColor
|
|
15
|
-
};
|
|
16
|
-
getAttributes(): {
|
|
17
|
-
points: import("../..").PointTuple[];
|
|
18
|
-
width: number;
|
|
19
|
-
height: number;
|
|
20
|
-
fill: string;
|
|
21
|
-
fillOpacity: number;
|
|
22
|
-
strokeWidth: number;
|
|
23
|
-
stroke: string;
|
|
24
|
-
strokeOpacity: number;
|
|
25
|
-
opacity: number;
|
|
26
|
-
outlineColor: string;
|
|
27
|
-
id: string;
|
|
28
|
-
properties: {
|
|
29
|
-
[x: string]: any;
|
|
30
|
-
};
|
|
31
|
-
type: string;
|
|
32
|
-
x: number;
|
|
33
|
-
y: number;
|
|
34
|
-
isSelected: boolean;
|
|
35
|
-
isHovered: boolean;
|
|
36
|
-
text: {
|
|
37
|
-
value: string;
|
|
38
|
-
x: number;
|
|
39
|
-
y: number;
|
|
40
|
-
draggable: boolean;
|
|
41
|
-
editable: boolean;
|
|
42
|
-
};
|
|
16
|
+
strokeOpacity?: number;
|
|
17
|
+
opacity?: number;
|
|
18
|
+
outlineColor?: string;
|
|
43
19
|
};
|
|
20
|
+
getAttributes(): PolygonNodeAttributes;
|
|
44
21
|
getShape(): h.JSX.Element;
|
|
45
22
|
}
|
|
23
|
+
export {};
|
|
@@ -6,39 +6,36 @@ export default class RectNode extends BaseNode {
|
|
|
6
6
|
width: number;
|
|
7
7
|
height: number;
|
|
8
8
|
fill: string;
|
|
9
|
-
fillOpacity
|
|
10
|
-
strokeWidth
|
|
9
|
+
fillOpacity?: number;
|
|
10
|
+
strokeWidth?: number;
|
|
11
11
|
stroke: string;
|
|
12
|
-
strokeOpacity
|
|
13
|
-
opacity
|
|
14
|
-
outlineColor
|
|
12
|
+
strokeOpacity?: number;
|
|
13
|
+
opacity?: number;
|
|
14
|
+
outlineColor?: string;
|
|
15
15
|
};
|
|
16
16
|
getAttributes(): {
|
|
17
17
|
radius: number;
|
|
18
18
|
width: number;
|
|
19
19
|
height: number;
|
|
20
20
|
fill: string;
|
|
21
|
-
fillOpacity
|
|
22
|
-
strokeWidth
|
|
21
|
+
fillOpacity?: number;
|
|
22
|
+
strokeWidth?: number;
|
|
23
23
|
stroke: string;
|
|
24
|
-
strokeOpacity
|
|
25
|
-
opacity
|
|
26
|
-
outlineColor
|
|
24
|
+
strokeOpacity?: number;
|
|
25
|
+
opacity?: number;
|
|
26
|
+
outlineColor?: string;
|
|
27
27
|
id: string;
|
|
28
|
-
properties:
|
|
29
|
-
[x: string]: any;
|
|
30
|
-
};
|
|
28
|
+
properties: Record<string, any>;
|
|
31
29
|
type: string;
|
|
32
30
|
x: number;
|
|
33
31
|
y: number;
|
|
34
32
|
isSelected: boolean;
|
|
35
33
|
isHovered: boolean;
|
|
36
34
|
text: {
|
|
37
|
-
|
|
35
|
+
[key: string]: any;
|
|
38
36
|
x: number;
|
|
39
37
|
y: number;
|
|
40
|
-
|
|
41
|
-
editable: boolean;
|
|
38
|
+
value: string;
|
|
42
39
|
};
|
|
43
40
|
};
|
|
44
41
|
getShape(): h.JSX.Element;
|