@next-bricks/diagram 0.19.0 → 0.20.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/2680.440281fd.js +3 -0
- package/dist/chunks/2680.440281fd.js.map +1 -0
- package/dist/chunks/{3322.63bf67fe.js → 3322.eaf8483d.js} +2 -2
- package/dist/chunks/{3322.63bf67fe.js.map → 3322.eaf8483d.js.map} +1 -1
- package/dist/chunks/3780.57b33842.js +3 -0
- package/dist/chunks/{720.fc86c182.js.LICENSE.txt → 3780.57b33842.js.LICENSE.txt} +0 -6
- package/dist/chunks/3780.57b33842.js.map +1 -0
- package/dist/chunks/4092.422e3ee4.js +2 -0
- package/dist/chunks/4092.422e3ee4.js.map +1 -0
- package/dist/chunks/{8020.7d347956.js → 8020.528badbd.js} +2 -2
- package/dist/chunks/{8020.7d347956.js.map → 8020.528badbd.js.map} +1 -1
- package/dist/chunks/{eo-diagram.2b8615e9.js → eo-diagram.9d077ab7.js} +2 -2
- package/dist/chunks/{eo-diagram.2b8615e9.js.map → eo-diagram.9d077ab7.js.map} +1 -1
- package/dist/chunks/eo-draw-canvas.03073fd4.js +2 -0
- package/dist/chunks/eo-draw-canvas.03073fd4.js.map +1 -0
- package/dist/chunks/main.6831cfb7.js +2 -0
- package/dist/chunks/main.6831cfb7.js.map +1 -0
- package/dist/examples.json +3 -3
- package/dist/index.539888da.js +2 -0
- package/dist/index.539888da.js.map +1 -0
- package/dist/manifest.json +63 -36
- package/dist/types.json +134 -67
- package/dist-types/draw-canvas/CellComponent.d.ts +3 -1
- package/dist-types/draw-canvas/ConnectLineComponent.d.ts +3 -2
- package/dist-types/draw-canvas/decorators/DecoratorArea.d.ts +1 -1
- package/dist-types/draw-canvas/decorators/index.d.ts +1 -1
- package/dist-types/draw-canvas/index.d.ts +11 -1
- package/dist-types/draw-canvas/interfaces.d.ts +2 -1
- package/dist-types/draw-canvas/processors/handleMouseDown.d.ts +2 -1
- package/dist-types/draw-canvas/processors/transformToCenter.d.ts +8 -0
- package/dist-types/draw-canvas/processors/transformToCenter.spec.d.ts +1 -0
- package/docs/eo-draw-canvas.md +309 -300
- package/package.json +2 -2
- package/dist/chunks/720.fc86c182.js +0 -3
- package/dist/chunks/720.fc86c182.js.map +0 -1
- package/dist/chunks/9640.1ec0b7d0.js +0 -2
- package/dist/chunks/9640.1ec0b7d0.js.map +0 -1
- package/dist/chunks/eo-draw-canvas.29e94b46.js +0 -3
- package/dist/chunks/eo-draw-canvas.29e94b46.js.map +0 -1
- package/dist/chunks/main.48459c1c.js +0 -2
- package/dist/chunks/main.48459c1c.js.map +0 -1
- package/dist/index.e837507c.js +0 -2
- package/dist/index.e837507c.js.map +0 -1
- /package/dist/chunks/{eo-draw-canvas.29e94b46.js.LICENSE.txt → 2680.440281fd.js.LICENSE.txt} +0 -0
package/dist/types.json
CHANGED
|
@@ -1,71 +1,4 @@
|
|
|
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
|
-
"events": [
|
|
23
|
-
{
|
|
24
|
-
"name": "label.editing.change",
|
|
25
|
-
"detail": {
|
|
26
|
-
"annotation": {
|
|
27
|
-
"type": "keyword",
|
|
28
|
-
"value": "boolean"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"name": "label.change",
|
|
34
|
-
"detail": {
|
|
35
|
-
"annotation": {
|
|
36
|
-
"type": "keyword",
|
|
37
|
-
"value": "string"
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
],
|
|
42
|
-
"methods": [
|
|
43
|
-
{
|
|
44
|
-
"name": "enableEditing",
|
|
45
|
-
"params": [],
|
|
46
|
-
"returns": {}
|
|
47
|
-
}
|
|
48
|
-
],
|
|
49
|
-
"types": [
|
|
50
|
-
{
|
|
51
|
-
"type": "typeAlias",
|
|
52
|
-
"name": "LabelType",
|
|
53
|
-
"annotation": {
|
|
54
|
-
"type": "union",
|
|
55
|
-
"types": [
|
|
56
|
-
{
|
|
57
|
-
"type": "jsLiteral",
|
|
58
|
-
"value": "line"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
"type": "jsLiteral",
|
|
62
|
-
"value": "default"
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
]
|
|
68
|
-
},
|
|
69
2
|
"diagram.experimental-node": {
|
|
70
3
|
"properties": [
|
|
71
4
|
{
|
|
@@ -227,6 +160,73 @@
|
|
|
227
160
|
}
|
|
228
161
|
]
|
|
229
162
|
},
|
|
163
|
+
"diagram.editable-label": {
|
|
164
|
+
"properties": [
|
|
165
|
+
{
|
|
166
|
+
"name": "label",
|
|
167
|
+
"annotation": {
|
|
168
|
+
"type": "keyword",
|
|
169
|
+
"value": "string"
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"name": "type",
|
|
174
|
+
"annotation": {
|
|
175
|
+
"type": "reference",
|
|
176
|
+
"typeName": {
|
|
177
|
+
"type": "identifier",
|
|
178
|
+
"name": "LabelType"
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
"events": [
|
|
184
|
+
{
|
|
185
|
+
"name": "label.editing.change",
|
|
186
|
+
"detail": {
|
|
187
|
+
"annotation": {
|
|
188
|
+
"type": "keyword",
|
|
189
|
+
"value": "boolean"
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"name": "label.change",
|
|
195
|
+
"detail": {
|
|
196
|
+
"annotation": {
|
|
197
|
+
"type": "keyword",
|
|
198
|
+
"value": "string"
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
],
|
|
203
|
+
"methods": [
|
|
204
|
+
{
|
|
205
|
+
"name": "enableEditing",
|
|
206
|
+
"params": [],
|
|
207
|
+
"returns": {}
|
|
208
|
+
}
|
|
209
|
+
],
|
|
210
|
+
"types": [
|
|
211
|
+
{
|
|
212
|
+
"type": "typeAlias",
|
|
213
|
+
"name": "LabelType",
|
|
214
|
+
"annotation": {
|
|
215
|
+
"type": "union",
|
|
216
|
+
"types": [
|
|
217
|
+
{
|
|
218
|
+
"type": "jsLiteral",
|
|
219
|
+
"value": "line"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"type": "jsLiteral",
|
|
223
|
+
"value": "default"
|
|
224
|
+
}
|
|
225
|
+
]
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
]
|
|
229
|
+
},
|
|
230
230
|
"eo-diagram": {
|
|
231
231
|
"properties": [
|
|
232
232
|
{
|
|
@@ -2083,6 +2083,37 @@
|
|
|
2083
2083
|
}
|
|
2084
2084
|
]
|
|
2085
2085
|
}
|
|
2086
|
+
},
|
|
2087
|
+
{
|
|
2088
|
+
"name": "zoomable",
|
|
2089
|
+
"annotation": {
|
|
2090
|
+
"type": "keyword",
|
|
2091
|
+
"value": "boolean"
|
|
2092
|
+
}
|
|
2093
|
+
},
|
|
2094
|
+
{
|
|
2095
|
+
"name": "scrollable",
|
|
2096
|
+
"annotation": {
|
|
2097
|
+
"type": "keyword",
|
|
2098
|
+
"value": "boolean"
|
|
2099
|
+
}
|
|
2100
|
+
},
|
|
2101
|
+
{
|
|
2102
|
+
"name": "pannable",
|
|
2103
|
+
"annotation": {
|
|
2104
|
+
"type": "keyword",
|
|
2105
|
+
"value": "boolean"
|
|
2106
|
+
}
|
|
2107
|
+
},
|
|
2108
|
+
{
|
|
2109
|
+
"name": "scaleRange",
|
|
2110
|
+
"annotation": {
|
|
2111
|
+
"type": "reference",
|
|
2112
|
+
"typeName": {
|
|
2113
|
+
"type": "identifier",
|
|
2114
|
+
"name": "RangeTuple"
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2086
2117
|
}
|
|
2087
2118
|
],
|
|
2088
2119
|
"events": [
|
|
@@ -2178,6 +2209,15 @@
|
|
|
2178
2209
|
}
|
|
2179
2210
|
}
|
|
2180
2211
|
}
|
|
2212
|
+
},
|
|
2213
|
+
{
|
|
2214
|
+
"name": "scale.change",
|
|
2215
|
+
"detail": {
|
|
2216
|
+
"annotation": {
|
|
2217
|
+
"type": "keyword",
|
|
2218
|
+
"value": "number"
|
|
2219
|
+
}
|
|
2220
|
+
}
|
|
2181
2221
|
}
|
|
2182
2222
|
],
|
|
2183
2223
|
"methods": [
|
|
@@ -3178,6 +3218,33 @@
|
|
|
3178
3218
|
}
|
|
3179
3219
|
]
|
|
3180
3220
|
},
|
|
3221
|
+
{
|
|
3222
|
+
"type": "typeAlias",
|
|
3223
|
+
"name": "RangeTuple",
|
|
3224
|
+
"annotation": {
|
|
3225
|
+
"type": "tuple",
|
|
3226
|
+
"elementTypes": [
|
|
3227
|
+
{
|
|
3228
|
+
"type": "namedTupleMember",
|
|
3229
|
+
"label": "min",
|
|
3230
|
+
"optional": false,
|
|
3231
|
+
"elementType": {
|
|
3232
|
+
"type": "keyword",
|
|
3233
|
+
"value": "number"
|
|
3234
|
+
}
|
|
3235
|
+
},
|
|
3236
|
+
{
|
|
3237
|
+
"type": "namedTupleMember",
|
|
3238
|
+
"label": "max",
|
|
3239
|
+
"optional": false,
|
|
3240
|
+
"elementType": {
|
|
3241
|
+
"type": "keyword",
|
|
3242
|
+
"value": "number"
|
|
3243
|
+
}
|
|
3244
|
+
}
|
|
3245
|
+
]
|
|
3246
|
+
}
|
|
3247
|
+
},
|
|
3181
3248
|
{
|
|
3182
3249
|
"type": "interface",
|
|
3183
3250
|
"name": "MoveCellPayload",
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ActiveTarget, Cell, CellContextMenuDetail, NodeBrickConf } from "./interfaces";
|
|
3
3
|
import type { MoveCellPayload, ResizeCellPayload } from "./reducers/interfaces";
|
|
4
|
+
import type { TransformLiteral } from "../diagram/interfaces";
|
|
4
5
|
export interface CellComponentProps {
|
|
5
6
|
cell: Cell;
|
|
6
7
|
cells: Cell[];
|
|
7
8
|
defaultNodeBricks?: NodeBrickConf[];
|
|
9
|
+
transform: TransformLiteral;
|
|
8
10
|
markerEnd: string;
|
|
9
11
|
active: boolean;
|
|
10
12
|
onCellMoving(info: MoveCellPayload): void;
|
|
@@ -14,4 +16,4 @@ export interface CellComponentProps {
|
|
|
14
16
|
onSwitchActiveTarget(target: ActiveTarget | null): void;
|
|
15
17
|
onCellContextMenu(detail: CellContextMenuDetail): void;
|
|
16
18
|
}
|
|
17
|
-
export declare function CellComponent({ cell, cells, defaultNodeBricks, markerEnd, active, onCellMoving, onCellMoved, onCellResizing, onCellResized, onSwitchActiveTarget, onCellContextMenu, }: CellComponentProps): JSX.Element | null;
|
|
19
|
+
export declare function CellComponent({ cell, cells, defaultNodeBricks, markerEnd, active, transform, onCellMoving, onCellMoved, onCellResizing, onCellResized, onSwitchActiveTarget, onCellContextMenu, }: CellComponentProps): JSX.Element | null;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ConnectLineState } from "./interfaces";
|
|
3
|
-
import type { PositionTuple } from "../diagram/interfaces";
|
|
3
|
+
import type { PositionTuple, TransformLiteral } from "../diagram/interfaces";
|
|
4
4
|
export interface ConnectLineComponentProps {
|
|
5
5
|
connectLineState: ConnectLineState | null;
|
|
6
|
+
transform: TransformLiteral;
|
|
6
7
|
markerEnd: string;
|
|
7
8
|
onConnect(state: ConnectLineState, to: PositionTuple): void;
|
|
8
9
|
}
|
|
9
|
-
export declare function ConnectLineComponent({ connectLineState, markerEnd, onConnect, }: ConnectLineComponentProps): JSX.Element;
|
|
10
|
+
export declare function ConnectLineComponent({ connectLineState, transform, markerEnd, onConnect, }: ConnectLineComponentProps): JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { BasicDecoratorProps } from "../interfaces";
|
|
3
|
-
export declare function DecoratorArea({ cell, onCellResizing, onCellResized, onSwitchActiveTarget, }: BasicDecoratorProps): JSX.Element;
|
|
3
|
+
export declare function DecoratorArea({ cell, transform, onCellResizing, onCellResized, onSwitchActiveTarget, }: BasicDecoratorProps): JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { BasicDecoratorProps } from "../interfaces";
|
|
3
|
-
export declare function DecoratorComponent({ cell, onCellResizing, onCellResized, onSwitchActiveTarget, }: BasicDecoratorProps): JSX.Element | null;
|
|
3
|
+
export declare function DecoratorComponent({ cell, transform, onCellResizing, onCellResized, onSwitchActiveTarget, }: BasicDecoratorProps): JSX.Element | null;
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { ReactNextElement } from "@next-core/react-element";
|
|
3
3
|
import type { UseSingleBrickConf } from "@next-core/react-runtime";
|
|
4
4
|
import "@next-core/theme";
|
|
5
|
-
import type { PositionTuple, SizeTuple } from "../diagram/interfaces";
|
|
5
|
+
import type { PositionTuple, RangeTuple, SizeTuple, TransformLiteral } from "../diagram/interfaces";
|
|
6
6
|
import type { ActiveTarget, Cell, EdgeCell, InitialCell, NodeBrickConf, NodeCell, NodeId, DecoratorCell, DecoratorType, CellContextMenuDetail, ConnectNodesDetail } from "./interfaces";
|
|
7
7
|
import type { MoveCellPayload, ResizeCellPayload } from "./reducers/interfaces";
|
|
8
8
|
export interface EoDrawCanvasProps {
|
|
@@ -10,6 +10,10 @@ export interface EoDrawCanvasProps {
|
|
|
10
10
|
defaultNodeSize?: SizeTuple;
|
|
11
11
|
defaultNodeBricks?: NodeBrickConf[];
|
|
12
12
|
activeTarget?: ActiveTarget | null;
|
|
13
|
+
zoomable?: boolean;
|
|
14
|
+
scrollable?: boolean;
|
|
15
|
+
pannable?: boolean;
|
|
16
|
+
scaleRange?: RangeTuple;
|
|
13
17
|
}
|
|
14
18
|
export interface DropNodeInfo extends AddNodeInfo {
|
|
15
19
|
/** [PointerEvent::clientX, PointerEvent::clientY] */
|
|
@@ -46,6 +50,10 @@ export declare class EoDrawCanvas extends ReactNextElement implements EoDrawCanv
|
|
|
46
50
|
accessor defaultNodeSize: SizeTuple | undefined;
|
|
47
51
|
accessor defaultNodeBricks: NodeBrickConf[] | undefined;
|
|
48
52
|
accessor activeTarget: ActiveTarget | null | undefined;
|
|
53
|
+
accessor zoomable: boolean | undefined;
|
|
54
|
+
accessor scrollable: boolean | undefined;
|
|
55
|
+
accessor pannable: boolean | undefined;
|
|
56
|
+
accessor scaleRange: RangeTuple | undefined;
|
|
49
57
|
dropNode({ id, position, size, data, useBrick, }: DropNodeInfo): Promise<NodeCell | null>;
|
|
50
58
|
dropDecorator({ position, decorator, }: DropDecoratorInfo): Promise<DecoratorCell | null>;
|
|
51
59
|
addNodes(nodes: AddNodeInfo[]): Promise<NodeCell[]>;
|
|
@@ -63,6 +71,7 @@ export interface EoDrawCanvasComponentProps extends EoDrawCanvasProps {
|
|
|
63
71
|
onCellResize(cell: ResizeCellPayload): void;
|
|
64
72
|
onCellDelete(cell: Cell): void;
|
|
65
73
|
onCellContextMenu(detail: CellContextMenuDetail): void;
|
|
74
|
+
onScaleChange(scale: number): void;
|
|
66
75
|
}
|
|
67
76
|
export interface DrawCanvasRef {
|
|
68
77
|
dropNode(node: NodeCell): void;
|
|
@@ -71,4 +80,5 @@ export interface DrawCanvasRef {
|
|
|
71
80
|
addEdge(edge: EdgeCell): void;
|
|
72
81
|
manuallyConnectNodes(source: NodeId): Promise<ConnectNodesDetail>;
|
|
73
82
|
updateCells(cells: InitialCell[]): void;
|
|
83
|
+
getTransform(): TransformLiteral;
|
|
74
84
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { UseSingleBrickConf } from "@next-core/react-runtime";
|
|
2
2
|
import type { ResizeCellPayload } from "./reducers/interfaces";
|
|
3
|
-
import type { PositionTuple } from "../diagram/interfaces";
|
|
3
|
+
import type { PositionTuple, TransformLiteral } from "../diagram/interfaces";
|
|
4
4
|
export type Cell = NodeCell | EdgeCell | DecoratorCell;
|
|
5
5
|
export type BrickCell = NodeBrickCell;
|
|
6
6
|
export type NodeCell = NodeBrickCell;
|
|
@@ -69,6 +69,7 @@ export interface ActiveTargetOfDecorator {
|
|
|
69
69
|
}
|
|
70
70
|
export interface BasicDecoratorProps {
|
|
71
71
|
cell: DecoratorCell;
|
|
72
|
+
transform: TransformLiteral;
|
|
72
73
|
onCellResizing(info: ResizeCellPayload): void;
|
|
73
74
|
onCellResized(info: ResizeCellPayload): void;
|
|
74
75
|
onSwitchActiveTarget(activeTarget: ActiveTarget | null): void;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { ActiveTarget, Cell } from "../interfaces";
|
|
2
2
|
import type { MoveCellPayload, ResizeCellPayload } from "../reducers/interfaces";
|
|
3
|
-
export declare function handleMouseDown(event: MouseEvent, { action, cell, onCellMoving, onCellMoved, onCellResizing, onCellResized, onSwitchActiveTarget, }: {
|
|
3
|
+
export declare function handleMouseDown(event: MouseEvent, { action, cell, scale, onCellMoving, onCellMoved, onCellResizing, onCellResized, onSwitchActiveTarget, }: {
|
|
4
4
|
action: "move" | "resize";
|
|
5
5
|
cell: Cell;
|
|
6
|
+
scale: number;
|
|
6
7
|
onCellMoving?(info: MoveCellPayload): void;
|
|
7
8
|
onCellMoved?(info: MoveCellPayload): void;
|
|
8
9
|
onCellResizing?(info: ResizeCellPayload): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TransformLiteral } from "../../diagram/interfaces";
|
|
2
|
+
import type { Cell } from "../interfaces";
|
|
3
|
+
export interface TransformToCenterOptions {
|
|
4
|
+
canvasWidth: number;
|
|
5
|
+
canvasHeight: number;
|
|
6
|
+
scaleRange?: [min: number, max: number];
|
|
7
|
+
}
|
|
8
|
+
export declare function transformToCenter(cells: Cell[], { canvasWidth, canvasHeight, scaleRange }: TransformToCenterOptions): TransformLiteral;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|