@next-bricks/diagram 0.63.2 → 0.64.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/dist/bricks.json +3 -3
- package/dist/chunks/296.f3b52669.js +2 -0
- package/dist/chunks/296.f3b52669.js.map +1 -0
- package/dist/chunks/9711.8e213d2c.js +2 -0
- package/dist/chunks/9711.8e213d2c.js.map +1 -0
- package/dist/chunks/eo-display-canvas.0119f61b.js +2 -0
- package/dist/chunks/{eo-display-canvas.c67d5a35.js.map → eo-display-canvas.0119f61b.js.map} +1 -1
- package/dist/chunks/eo-draw-canvas.bed82f27.js +2 -0
- package/dist/chunks/eo-draw-canvas.bed82f27.js.map +1 -0
- package/dist/chunks/main.962d2671.js +2 -0
- package/dist/chunks/{main.48677ce1.js.map → main.962d2671.js.map} +1 -1
- package/dist/examples.json +1 -1
- package/dist/index.d1c14125.js +2 -0
- package/dist/{index.82d1267c.js.map → index.d1c14125.js.map} +1 -1
- package/dist/manifest.json +37 -37
- package/dist/types.json +185 -76
- package/dist-types/draw-canvas/index.d.ts +1 -0
- package/dist-types/draw-canvas/interfaces.d.ts +7 -0
- package/dist-types/draw-canvas/processors/asserts.d.ts +5 -4
- package/dist-types/draw-canvas/processors/generateNewPointsWithLayout.d.ts +12 -0
- package/dist-types/draw-canvas/processors/initaliContainerLayout.d.ts +6 -0
- package/dist-types/draw-canvas/processors/initializeCells.d.ts +7 -3
- package/dist-types/draw-canvas/processors/updateCells.d.ts +3 -2
- package/docs/eo-draw-canvas.md +52 -39
- package/package.json +2 -2
- package/dist/chunks/8522.6e5772ce.js +0 -2
- package/dist/chunks/8522.6e5772ce.js.map +0 -1
- package/dist/chunks/9711.522aa912.js +0 -2
- package/dist/chunks/9711.522aa912.js.map +0 -1
- package/dist/chunks/eo-display-canvas.c67d5a35.js +0 -2
- package/dist/chunks/eo-draw-canvas.7caa4a7d.js +0 -2
- package/dist/chunks/eo-draw-canvas.7caa4a7d.js.map +0 -1
- package/dist/chunks/main.48677ce1.js +0 -2
- package/dist/index.82d1267c.js +0 -2
package/dist/types.json
CHANGED
|
@@ -1,4 +1,78 @@
|
|
|
1
1
|
{
|
|
2
|
+
"diagram.editable-label": {
|
|
3
|
+
"properties": [
|
|
4
|
+
{
|
|
5
|
+
"name": "label",
|
|
6
|
+
"annotation": {
|
|
7
|
+
"type": "keyword",
|
|
8
|
+
"value": "string"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "type",
|
|
13
|
+
"annotation": {
|
|
14
|
+
"type": "reference",
|
|
15
|
+
"typeName": {
|
|
16
|
+
"type": "identifier",
|
|
17
|
+
"name": "LabelType"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "readOnly",
|
|
23
|
+
"annotation": {
|
|
24
|
+
"type": "keyword",
|
|
25
|
+
"value": "boolean"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"events": [
|
|
30
|
+
{
|
|
31
|
+
"name": "label.editing.change",
|
|
32
|
+
"detail": {
|
|
33
|
+
"annotation": {
|
|
34
|
+
"type": "keyword",
|
|
35
|
+
"value": "boolean"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "label.change",
|
|
41
|
+
"detail": {
|
|
42
|
+
"annotation": {
|
|
43
|
+
"type": "keyword",
|
|
44
|
+
"value": "string"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"methods": [
|
|
50
|
+
{
|
|
51
|
+
"name": "enableEditing",
|
|
52
|
+
"params": [],
|
|
53
|
+
"returns": {}
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"types": [
|
|
57
|
+
{
|
|
58
|
+
"type": "typeAlias",
|
|
59
|
+
"name": "LabelType",
|
|
60
|
+
"annotation": {
|
|
61
|
+
"type": "union",
|
|
62
|
+
"types": [
|
|
63
|
+
{
|
|
64
|
+
"type": "jsLiteral",
|
|
65
|
+
"value": "line"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"type": "jsLiteral",
|
|
69
|
+
"value": "default"
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
},
|
|
2
76
|
"diagram.experimental-node": {
|
|
3
77
|
"properties": [
|
|
4
78
|
{
|
|
@@ -172,80 +246,6 @@
|
|
|
172
246
|
}
|
|
173
247
|
]
|
|
174
248
|
},
|
|
175
|
-
"diagram.editable-label": {
|
|
176
|
-
"properties": [
|
|
177
|
-
{
|
|
178
|
-
"name": "label",
|
|
179
|
-
"annotation": {
|
|
180
|
-
"type": "keyword",
|
|
181
|
-
"value": "string"
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
"name": "type",
|
|
186
|
-
"annotation": {
|
|
187
|
-
"type": "reference",
|
|
188
|
-
"typeName": {
|
|
189
|
-
"type": "identifier",
|
|
190
|
-
"name": "LabelType"
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
"name": "readOnly",
|
|
196
|
-
"annotation": {
|
|
197
|
-
"type": "keyword",
|
|
198
|
-
"value": "boolean"
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
],
|
|
202
|
-
"events": [
|
|
203
|
-
{
|
|
204
|
-
"name": "label.editing.change",
|
|
205
|
-
"detail": {
|
|
206
|
-
"annotation": {
|
|
207
|
-
"type": "keyword",
|
|
208
|
-
"value": "boolean"
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
"name": "label.change",
|
|
214
|
-
"detail": {
|
|
215
|
-
"annotation": {
|
|
216
|
-
"type": "keyword",
|
|
217
|
-
"value": "string"
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
],
|
|
222
|
-
"methods": [
|
|
223
|
-
{
|
|
224
|
-
"name": "enableEditing",
|
|
225
|
-
"params": [],
|
|
226
|
-
"returns": {}
|
|
227
|
-
}
|
|
228
|
-
],
|
|
229
|
-
"types": [
|
|
230
|
-
{
|
|
231
|
-
"type": "typeAlias",
|
|
232
|
-
"name": "LabelType",
|
|
233
|
-
"annotation": {
|
|
234
|
-
"type": "union",
|
|
235
|
-
"types": [
|
|
236
|
-
{
|
|
237
|
-
"type": "jsLiteral",
|
|
238
|
-
"value": "line"
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
"type": "jsLiteral",
|
|
242
|
-
"value": "default"
|
|
243
|
-
}
|
|
244
|
-
]
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
]
|
|
248
|
-
},
|
|
249
249
|
"eo-display-canvas": {
|
|
250
250
|
"properties": [
|
|
251
251
|
{
|
|
@@ -1488,6 +1488,20 @@
|
|
|
1488
1488
|
"computed": false,
|
|
1489
1489
|
"description": "设置容器装饰器的文本位置"
|
|
1490
1490
|
},
|
|
1491
|
+
{
|
|
1492
|
+
"type": "propertySignature",
|
|
1493
|
+
"key": {
|
|
1494
|
+
"type": "identifier",
|
|
1495
|
+
"name": "level"
|
|
1496
|
+
},
|
|
1497
|
+
"annotation": {
|
|
1498
|
+
"type": "keyword",
|
|
1499
|
+
"value": "number"
|
|
1500
|
+
},
|
|
1501
|
+
"optional": true,
|
|
1502
|
+
"computed": false,
|
|
1503
|
+
"description": "设置容器层级(数字越大布局越靠前)"
|
|
1504
|
+
},
|
|
1491
1505
|
{
|
|
1492
1506
|
"type": "propertySignature",
|
|
1493
1507
|
"key": {
|
|
@@ -1610,7 +1624,24 @@
|
|
|
1610
1624
|
{
|
|
1611
1625
|
"type": "interface",
|
|
1612
1626
|
"name": "LayoutOptionsManual",
|
|
1613
|
-
"body": [
|
|
1627
|
+
"body": [
|
|
1628
|
+
{
|
|
1629
|
+
"type": "propertySignature",
|
|
1630
|
+
"key": {
|
|
1631
|
+
"type": "identifier",
|
|
1632
|
+
"name": "initialLayout"
|
|
1633
|
+
},
|
|
1634
|
+
"annotation": {
|
|
1635
|
+
"type": "reference",
|
|
1636
|
+
"typeName": {
|
|
1637
|
+
"type": "identifier",
|
|
1638
|
+
"name": "InitialLayout"
|
|
1639
|
+
}
|
|
1640
|
+
},
|
|
1641
|
+
"optional": true,
|
|
1642
|
+
"computed": false
|
|
1643
|
+
}
|
|
1644
|
+
],
|
|
1614
1645
|
"extends": [
|
|
1615
1646
|
{
|
|
1616
1647
|
"type": "expressionWithTypeArguments",
|
|
@@ -1621,6 +1652,23 @@
|
|
|
1621
1652
|
}
|
|
1622
1653
|
]
|
|
1623
1654
|
},
|
|
1655
|
+
{
|
|
1656
|
+
"type": "typeAlias",
|
|
1657
|
+
"name": "InitialLayout",
|
|
1658
|
+
"annotation": {
|
|
1659
|
+
"type": "union",
|
|
1660
|
+
"types": [
|
|
1661
|
+
{
|
|
1662
|
+
"type": "jsLiteral",
|
|
1663
|
+
"value": "default"
|
|
1664
|
+
},
|
|
1665
|
+
{
|
|
1666
|
+
"type": "jsLiteral",
|
|
1667
|
+
"value": "layered-architecture"
|
|
1668
|
+
}
|
|
1669
|
+
]
|
|
1670
|
+
}
|
|
1671
|
+
},
|
|
1624
1672
|
{
|
|
1625
1673
|
"type": "interface",
|
|
1626
1674
|
"name": "BaseLayoutOptions",
|
|
@@ -6805,6 +6853,20 @@
|
|
|
6805
6853
|
"computed": false,
|
|
6806
6854
|
"description": "设置容器装饰器的文本位置"
|
|
6807
6855
|
},
|
|
6856
|
+
{
|
|
6857
|
+
"type": "propertySignature",
|
|
6858
|
+
"key": {
|
|
6859
|
+
"type": "identifier",
|
|
6860
|
+
"name": "level"
|
|
6861
|
+
},
|
|
6862
|
+
"annotation": {
|
|
6863
|
+
"type": "keyword",
|
|
6864
|
+
"value": "number"
|
|
6865
|
+
},
|
|
6866
|
+
"optional": true,
|
|
6867
|
+
"computed": false,
|
|
6868
|
+
"description": "设置容器层级(数字越大布局越靠前)"
|
|
6869
|
+
},
|
|
6808
6870
|
{
|
|
6809
6871
|
"type": "propertySignature",
|
|
6810
6872
|
"key": {
|
|
@@ -6927,7 +6989,24 @@
|
|
|
6927
6989
|
{
|
|
6928
6990
|
"type": "interface",
|
|
6929
6991
|
"name": "LayoutOptionsManual",
|
|
6930
|
-
"body": [
|
|
6992
|
+
"body": [
|
|
6993
|
+
{
|
|
6994
|
+
"type": "propertySignature",
|
|
6995
|
+
"key": {
|
|
6996
|
+
"type": "identifier",
|
|
6997
|
+
"name": "initialLayout"
|
|
6998
|
+
},
|
|
6999
|
+
"annotation": {
|
|
7000
|
+
"type": "reference",
|
|
7001
|
+
"typeName": {
|
|
7002
|
+
"type": "identifier",
|
|
7003
|
+
"name": "InitialLayout"
|
|
7004
|
+
}
|
|
7005
|
+
},
|
|
7006
|
+
"optional": true,
|
|
7007
|
+
"computed": false
|
|
7008
|
+
}
|
|
7009
|
+
],
|
|
6931
7010
|
"extends": [
|
|
6932
7011
|
{
|
|
6933
7012
|
"type": "expressionWithTypeArguments",
|
|
@@ -6938,6 +7017,23 @@
|
|
|
6938
7017
|
}
|
|
6939
7018
|
]
|
|
6940
7019
|
},
|
|
7020
|
+
{
|
|
7021
|
+
"type": "typeAlias",
|
|
7022
|
+
"name": "InitialLayout",
|
|
7023
|
+
"annotation": {
|
|
7024
|
+
"type": "union",
|
|
7025
|
+
"types": [
|
|
7026
|
+
{
|
|
7027
|
+
"type": "jsLiteral",
|
|
7028
|
+
"value": "default"
|
|
7029
|
+
},
|
|
7030
|
+
{
|
|
7031
|
+
"type": "jsLiteral",
|
|
7032
|
+
"value": "layered-architecture"
|
|
7033
|
+
}
|
|
7034
|
+
]
|
|
7035
|
+
}
|
|
7036
|
+
},
|
|
6941
7037
|
{
|
|
6942
7038
|
"type": "interface",
|
|
6943
7039
|
"name": "BaseLayoutOptions",
|
|
@@ -9118,6 +9214,19 @@
|
|
|
9118
9214
|
},
|
|
9119
9215
|
"optional": true,
|
|
9120
9216
|
"computed": false
|
|
9217
|
+
},
|
|
9218
|
+
{
|
|
9219
|
+
"type": "propertySignature",
|
|
9220
|
+
"key": {
|
|
9221
|
+
"type": "identifier",
|
|
9222
|
+
"name": "containerId"
|
|
9223
|
+
},
|
|
9224
|
+
"annotation": {
|
|
9225
|
+
"type": "keyword",
|
|
9226
|
+
"value": "string"
|
|
9227
|
+
},
|
|
9228
|
+
"optional": true,
|
|
9229
|
+
"computed": false
|
|
9121
9230
|
}
|
|
9122
9231
|
]
|
|
9123
9232
|
},
|
|
@@ -66,6 +66,8 @@ export interface DecoratorView extends NodeView {
|
|
|
66
66
|
titleStyle?: CSSProperties;
|
|
67
67
|
/** 设置容器装饰器的文本位置 */
|
|
68
68
|
direction?: Direction;
|
|
69
|
+
/** 设置容器层级(数字越大布局越靠前) */
|
|
70
|
+
level?: number;
|
|
69
71
|
vertices?: NodePosition[] | null;
|
|
70
72
|
}
|
|
71
73
|
export interface DecoratorLineView extends NodeView, BaseEdgeLineConf {
|
|
@@ -256,8 +258,13 @@ export interface DecoratorTextChangeDetail {
|
|
|
256
258
|
view: DecoratorView | DecoratorLineView;
|
|
257
259
|
}
|
|
258
260
|
export type LayoutType = "manual" | "force" | "dagre" | undefined;
|
|
261
|
+
/**
|
|
262
|
+
* layered-architecture: 分层架构
|
|
263
|
+
*/
|
|
264
|
+
export type InitialLayout = "default" | "layered-architecture";
|
|
259
265
|
export type LayoutOptions = LayoutOptionsManual | LayoutOptionsDagre | LayoutOptionsForce;
|
|
260
266
|
export interface LayoutOptionsManual extends BaseLayoutOptions {
|
|
267
|
+
initialLayout?: InitialLayout;
|
|
261
268
|
}
|
|
262
269
|
export interface BaseLayoutOptions {
|
|
263
270
|
/** Snap options. Setting to true means enable all snap options */
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import type { Cell, DecoratorCell, EdgeCell, EditableEdgeLine, EditableLine, InitialCell, InitialNodeCell, LayoutType, LineDecoratorCell, LineType, NodeCell } from "../interfaces";
|
|
1
|
+
import type { Cell, DecoratorCell, EdgeCell, EditableEdgeLine, EditableLine, InitialCell, InitialNodeCell, InitialNodeView, LayoutType, LineDecoratorCell, LineType, NodeCell } from "../interfaces";
|
|
2
2
|
import { MoveCellPayload } from "../reducers/interfaces";
|
|
3
3
|
export declare function isNodeCell(cell: Cell | MoveCellPayload): cell is NodeCell;
|
|
4
4
|
export declare function isDecoratorCell(cell: Cell): cell is DecoratorCell;
|
|
5
5
|
export declare function isInitialNodeCell(cell: InitialCell): cell is InitialNodeCell;
|
|
6
|
-
export declare function isEdgeCell(cell:
|
|
6
|
+
export declare function isEdgeCell(cell: InitialCell): cell is EdgeCell;
|
|
7
7
|
export declare function isNodeOrEdgeCell(cell: Cell): cell is NodeCell | EdgeCell;
|
|
8
8
|
export declare function isNodeOrAreaDecoratorCell(cell: Cell): cell is NodeCell | DecoratorCell;
|
|
9
9
|
export declare function isEdgeSide(cell: Cell, allowEdgeToArea: boolean | undefined): cell is NodeCell | DecoratorCell;
|
|
10
10
|
export declare function isNodeOrTextDecoratorCell(cell: Cell | MoveCellPayload): cell is NodeCell | DecoratorCell;
|
|
11
11
|
export declare function isTextDecoratorCell(cell: Cell): cell is DecoratorCell;
|
|
12
|
-
export declare function isContainerDecoratorCell(cell:
|
|
13
|
-
export declare function isRectDecoratorCell(cell: Cell | MoveCellPayload): cell is DecoratorCell;
|
|
12
|
+
export declare function isContainerDecoratorCell(cell: InitialCell | MoveCellPayload): cell is DecoratorCell;
|
|
14
13
|
export declare function isLineDecoratorCell(cell: Cell | LineDecoratorCell | MoveCellPayload): cell is LineDecoratorCell;
|
|
15
14
|
export declare function isNoManualLayout(layout: LayoutType): boolean;
|
|
15
|
+
export declare function isNoSize(view: InitialNodeView): boolean;
|
|
16
|
+
export declare function isNoPoint(view: InitialNodeView): boolean;
|
|
16
17
|
export declare function isStraightType(type: LineType | undefined): type is "straight" | undefined;
|
|
17
18
|
export declare function isEditableEdgeLine(line: EditableLine): line is EditableEdgeLine;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InitialCell } from "../interfaces";
|
|
2
|
+
import { SizeTuple } from "../../diagram/interfaces";
|
|
3
|
+
/**
|
|
4
|
+
* 在容器内新加节点时,计算新节点的点按位置
|
|
5
|
+
* 按网格排布避免重叠
|
|
6
|
+
* @param cells
|
|
7
|
+
* @param defaultNodeSize 默认节点大小
|
|
8
|
+
* @returns void
|
|
9
|
+
*/
|
|
10
|
+
export declare function generateNewPointsWithLayout(cells: InitialCell[], { defaultNodeSize }: {
|
|
11
|
+
defaultNodeSize: SizeTuple;
|
|
12
|
+
}): void;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { SizeTuple } from "../../diagram/interfaces";
|
|
2
|
-
import type { Cell, InitialCell } from "../interfaces";
|
|
3
|
-
|
|
2
|
+
import type { Cell, InitialCell, LayoutOptions } from "../interfaces";
|
|
3
|
+
interface initializeConfig {
|
|
4
4
|
defaultNodeSize: SizeTuple;
|
|
5
|
-
|
|
5
|
+
layoutOptions?: LayoutOptions;
|
|
6
|
+
isInitialize?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function initializeCells(initialCells: InitialCell[] | undefined, { defaultNodeSize, layoutOptions, isInitialize }: initializeConfig): Cell[];
|
|
9
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RangeTuple, SizeTuple, TransformLiteral } from "../../diagram/interfaces";
|
|
2
|
-
import type { Cell, InitialCell, LayoutType, NodeId } from "../interfaces";
|
|
3
|
-
export declare function updateCells({ cells, layout, previousCells, defaultNodeSize, canvasWidth, canvasHeight, scaleRange, transform, reason, parent, allowEdgeToArea, }: {
|
|
2
|
+
import type { Cell, InitialCell, LayoutOptions, LayoutType, NodeId } from "../interfaces";
|
|
3
|
+
export declare function updateCells({ cells, layout, previousCells, defaultNodeSize, canvasWidth, canvasHeight, scaleRange, transform, reason, parent, allowEdgeToArea, layoutOptions, }: {
|
|
4
4
|
cells: InitialCell[] | undefined;
|
|
5
5
|
layout?: LayoutType;
|
|
6
6
|
previousCells: Cell[];
|
|
@@ -12,6 +12,7 @@ export declare function updateCells({ cells, layout, previousCells, defaultNodeS
|
|
|
12
12
|
reason?: "add-related-nodes";
|
|
13
13
|
parent?: NodeId;
|
|
14
14
|
allowEdgeToArea?: boolean;
|
|
15
|
+
layoutOptions?: LayoutOptions;
|
|
15
16
|
}): {
|
|
16
17
|
cells: Cell[];
|
|
17
18
|
updated: Cell[];
|
package/docs/eo-draw-canvas.md
CHANGED
|
@@ -20,50 +20,34 @@
|
|
|
20
20
|
[
|
|
21
21
|
{
|
|
22
22
|
type: "decorator",
|
|
23
|
-
id: "
|
|
24
|
-
decorator: "
|
|
25
|
-
view: {
|
|
26
|
-
x: 10,
|
|
27
|
-
y: 20,
|
|
28
|
-
width: 400,
|
|
29
|
-
height: 300,
|
|
30
|
-
style: {
|
|
31
|
-
backgroundColor: "var(--palette-green-3)",
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
type: "decorator",
|
|
37
|
-
id: "rect-1",
|
|
38
|
-
decorator: "rect",
|
|
23
|
+
id: "container-1",
|
|
24
|
+
decorator: "container",
|
|
39
25
|
view: {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
height: 300,
|
|
44
|
-
style: {
|
|
45
|
-
borderColor: "var(--palette-purple-3)",
|
|
46
|
-
}
|
|
26
|
+
direction: "left",
|
|
27
|
+
text: "上层服务" ,
|
|
28
|
+
level: 1
|
|
47
29
|
},
|
|
48
30
|
},
|
|
49
31
|
{
|
|
50
32
|
type: "decorator",
|
|
51
|
-
id: "container-
|
|
33
|
+
id: "container-2",
|
|
52
34
|
decorator: "container",
|
|
53
35
|
view: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
height: 120,
|
|
58
|
-
direction: "top",
|
|
59
|
-
text: " 上层服务"
|
|
36
|
+
direction: "left",
|
|
37
|
+
text: "应用" ,
|
|
38
|
+
level: 2
|
|
60
39
|
},
|
|
61
40
|
},
|
|
62
41
|
{
|
|
63
|
-
type: "edge",
|
|
42
|
+
type: "edge",
|
|
64
43
|
source: "X",
|
|
65
44
|
target: "Y",
|
|
66
45
|
},
|
|
46
|
+
{
|
|
47
|
+
type: "edge",
|
|
48
|
+
source: "Z",
|
|
49
|
+
target: "W",
|
|
50
|
+
},
|
|
67
51
|
{
|
|
68
52
|
type: "edge",
|
|
69
53
|
source: "X",
|
|
@@ -73,22 +57,22 @@
|
|
|
73
57
|
}
|
|
74
58
|
},
|
|
75
59
|
].concat(
|
|
76
|
-
["X", "Y", "Z", "W"].map((id) => ({
|
|
60
|
+
["A","B","X", "Y", "Z", "W",].map((id) => ({
|
|
77
61
|
type: "node",
|
|
78
62
|
id,
|
|
79
|
-
containerId:
|
|
63
|
+
containerId: ["W","Z","X","Y"].includes(id)?"container-1":"container-2",
|
|
80
64
|
data: {
|
|
81
65
|
name: `Node ${id}`,
|
|
82
|
-
},
|
|
66
|
+
},
|
|
83
67
|
view: {
|
|
84
|
-
x: Math.round(
|
|
68
|
+
x: ["A","B","Z","X","Y"].includes(id)?null:Math.round(
|
|
85
69
|
id === "X"
|
|
86
70
|
? 200 + Math.random() * 200
|
|
87
71
|
: id === "Y"
|
|
88
72
|
? Math.random() * 300
|
|
89
73
|
: 300 + Math.random() * 300
|
|
90
74
|
),
|
|
91
|
-
y: (id === "X" ? 0 : 300) + Math.round((Math.random() * 200)),
|
|
75
|
+
y: ["A","B","Z","X","Y"].includes(id)?null:(id === "X" ? 0 : 300) + Math.round((Math.random() * 200)),
|
|
92
76
|
width: 60,
|
|
93
77
|
height: 60,
|
|
94
78
|
}
|
|
@@ -97,9 +81,9 @@
|
|
|
97
81
|
{
|
|
98
82
|
type: "decorator",
|
|
99
83
|
id: "text-1",
|
|
100
|
-
decorator: "text",
|
|
84
|
+
decorator: "text",
|
|
101
85
|
view: {
|
|
102
|
-
x:
|
|
86
|
+
x: 300,
|
|
103
87
|
y: 120,
|
|
104
88
|
width: 100,
|
|
105
89
|
height: 20,
|
|
@@ -121,7 +105,7 @@
|
|
|
121
105
|
- brick: div
|
|
122
106
|
properties:
|
|
123
107
|
style:
|
|
124
|
-
width:
|
|
108
|
+
width: 200px
|
|
125
109
|
display: flex
|
|
126
110
|
flexDirection: column
|
|
127
111
|
gap: 1em
|
|
@@ -155,6 +139,34 @@
|
|
|
155
139
|
args:
|
|
156
140
|
- Added nodes
|
|
157
141
|
- <% EVENT.detail %>
|
|
142
|
+
- brick: eo-button
|
|
143
|
+
properties:
|
|
144
|
+
textContent: Add nodes to container-1
|
|
145
|
+
events:
|
|
146
|
+
click:
|
|
147
|
+
target: eo-draw-canvas
|
|
148
|
+
method: addNodes
|
|
149
|
+
args:
|
|
150
|
+
- |
|
|
151
|
+
<%
|
|
152
|
+
((...seeds) => seeds.map((seed) => ({
|
|
153
|
+
id: seed,
|
|
154
|
+
containerId: "container-1",
|
|
155
|
+
data: {
|
|
156
|
+
name: String(seed),
|
|
157
|
+
},
|
|
158
|
+
})))(
|
|
159
|
+
Math.round(Math.random() * 1e6),
|
|
160
|
+
Math.round(Math.random() * 1e6),
|
|
161
|
+
Math.round(Math.random() * 1e6),
|
|
162
|
+
)
|
|
163
|
+
%>
|
|
164
|
+
callback:
|
|
165
|
+
success:
|
|
166
|
+
action: console.log
|
|
167
|
+
args:
|
|
168
|
+
- Added nodes
|
|
169
|
+
- <% EVENT.detail %>
|
|
158
170
|
- brick: eo-button
|
|
159
171
|
properties:
|
|
160
172
|
textContent: "Add edge: Y => Z"
|
|
@@ -339,6 +351,7 @@
|
|
|
339
351
|
allowEdgeToArea: true
|
|
340
352
|
dragBehavior: lasso
|
|
341
353
|
layoutOptions:
|
|
354
|
+
initialLayout: layered-architecture
|
|
342
355
|
snap:
|
|
343
356
|
# grid: true
|
|
344
357
|
object: true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-bricks/diagram",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.64.0",
|
|
4
4
|
"homepage": "https://github.com/easyops-cn/next-advanced-bricks/tree/master/bricks/diagram",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@next-bricks/basic": "*"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "20960bc108e3ee849ac6ef7d1d35f5cbb3722a1a"
|
|
45
45
|
}
|