@logicflow/core 1.0.0-alpha.0 → 1.0.0-alpha.1
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 -11
- package/dist/style/index.css +14 -0
- package/package.json +3 -3
- 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": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.1",
|
|
4
4
|
"description": "LogicFlow core, to quickly build flowchart editor",
|
|
5
5
|
"main": "dist/logic-flow.js",
|
|
6
6
|
"unpkg": "dist/logic-flow.js",
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
"ids": "^1.0.0",
|
|
76
76
|
"less-loader": "^6.0.0",
|
|
77
77
|
"lodash-es": "^4.17.15",
|
|
78
|
-
"mobx": "^
|
|
79
|
-
"mobx-react": "^
|
|
78
|
+
"mobx": "^5.15.7",
|
|
79
|
+
"mobx-react": "^6.3.0",
|
|
80
80
|
"mobx-utils": "^5.6.1",
|
|
81
81
|
"prettier": "^2.2.1",
|
|
82
82
|
"rimraf": "^3.0.2",
|
|
@@ -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;
|