@antv/g6 5.0.0-beta.25 → 5.0.0-beta.27
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/g6.min.js +2 -2
- package/esm/constant/shape.d.ts +1 -1
- package/esm/index.d.ts +3 -1
- package/esm/index.js +1 -1
- package/esm/item/combo.d.ts +6 -4
- package/esm/item/combo.js +10 -3
- package/esm/item/combo.js.map +1 -1
- package/esm/item/edge.d.ts +12 -4
- package/esm/item/edge.js +100 -17
- package/esm/item/edge.js.map +1 -1
- package/esm/item/item.d.ts +18 -8
- package/esm/item/item.js +121 -62
- package/esm/item/item.js.map +1 -1
- package/esm/item/node.d.ts +10 -4
- package/esm/item/node.js +92 -8
- package/esm/item/node.js.map +1 -1
- package/esm/runtime/controller/data.d.ts +5 -1
- package/esm/runtime/controller/data.js +38 -1
- package/esm/runtime/controller/data.js.map +1 -1
- package/esm/runtime/controller/index.d.ts +1 -1
- package/esm/runtime/controller/index.js +1 -1
- package/esm/runtime/controller/index.js.map +1 -1
- package/esm/runtime/controller/item.d.ts +22 -11
- package/esm/runtime/controller/item.js +241 -96
- package/esm/runtime/controller/item.js.map +1 -1
- package/esm/runtime/controller/layout.d.ts +3 -0
- package/esm/runtime/controller/layout.js +178 -98
- package/esm/runtime/controller/layout.js.map +1 -1
- package/esm/runtime/controller/plugin.d.ts +3 -0
- package/esm/runtime/controller/plugin.js +66 -24
- package/esm/runtime/controller/plugin.js.map +1 -1
- package/esm/runtime/controller/viewport.js +9 -2
- package/esm/runtime/controller/viewport.js.map +1 -1
- package/esm/runtime/graph.d.ts +57 -26
- package/esm/runtime/graph.js +263 -139
- package/esm/runtime/graph.js.map +1 -1
- package/esm/stdlib/behavior/click-select.js +9 -3
- package/esm/stdlib/behavior/click-select.js.map +1 -1
- package/esm/stdlib/behavior/drag-canvas.js +6 -3
- package/esm/stdlib/behavior/drag-canvas.js.map +1 -1
- package/esm/stdlib/behavior/drag-combo.js +8 -8
- package/esm/stdlib/behavior/drag-combo.js.map +1 -1
- package/esm/stdlib/behavior/drag-node.d.ts +4 -0
- package/esm/stdlib/behavior/drag-node.js +121 -27
- package/esm/stdlib/behavior/drag-node.js.map +1 -1
- package/esm/stdlib/behavior/scroll-canvas.js +3 -3
- package/esm/stdlib/behavior/scroll-canvas.js.map +1 -1
- package/esm/stdlib/behavior/zoom-canvas.js +3 -3
- package/esm/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/esm/stdlib/data/mapNodeSize.js +2 -2
- package/esm/stdlib/data/mapNodeSize.js.map +1 -1
- package/esm/stdlib/data/validateData.js +2 -2
- package/esm/stdlib/data/validateData.js.map +1 -1
- package/esm/stdlib/index.d.ts +2 -0
- package/esm/stdlib/index.js +3 -1
- package/esm/stdlib/index.js.map +1 -1
- package/esm/stdlib/item/edge/base.d.ts +2 -11
- package/esm/stdlib/item/edge/base.js +12 -105
- package/esm/stdlib/item/edge/base.js.map +1 -1
- package/esm/stdlib/item/node/base.d.ts +2 -20
- package/esm/stdlib/item/node/base.js +10 -150
- package/esm/stdlib/item/node/base.js.map +1 -1
- package/esm/stdlib/plugin/edgeFilterLens/index.js +2 -2
- package/esm/stdlib/plugin/edgeFilterLens/index.js.map +1 -1
- package/esm/stdlib/plugin/fisheye/index.js +3 -2
- package/esm/stdlib/plugin/fisheye/index.js.map +1 -1
- package/esm/stdlib/plugin/history/visibility-updated-command.js +2 -2
- package/esm/stdlib/plugin/history/visibility-updated-command.js.map +1 -1
- package/esm/stdlib/plugin/hull/index.d.ts +1 -1
- package/esm/stdlib/plugin/index.d.ts +1 -0
- package/esm/stdlib/plugin/index.js +1 -0
- package/esm/stdlib/plugin/index.js.map +1 -1
- package/esm/stdlib/plugin/lodController/index.d.ts +73 -0
- package/esm/stdlib/plugin/lodController/index.js +556 -0
- package/esm/stdlib/plugin/lodController/index.js.map +1 -0
- package/esm/stdlib/plugin/menu/index.js +2 -1
- package/esm/stdlib/plugin/menu/index.js.map +1 -1
- package/esm/stdlib/plugin/minimap/index.js +12 -14
- package/esm/stdlib/plugin/minimap/index.js.map +1 -1
- package/esm/stdlib/plugin/toolbar/index.d.ts +2 -2
- package/esm/stdlib/plugin/toolbar/index.js +27 -29
- package/esm/stdlib/plugin/toolbar/index.js.map +1 -1
- package/esm/stdlib/theme/dark.js +32 -35
- package/esm/stdlib/theme/dark.js.map +1 -1
- package/esm/stdlib/theme/light.js +27 -30
- package/esm/stdlib/theme/light.js.map +1 -1
- package/esm/stdlib/themeSolver/spec.js +2 -2
- package/esm/stdlib/themeSolver/spec.js.map +1 -1
- package/esm/types/animate.d.ts +1 -1
- package/esm/types/combo.d.ts +2 -2
- package/esm/types/edge.d.ts +2 -2
- package/esm/types/graph.d.ts +62 -43
- package/esm/types/hook.d.ts +5 -0
- package/esm/types/item.d.ts +9 -15
- package/esm/types/layout.d.ts +7 -2
- package/esm/types/layout.js.map +1 -1
- package/esm/types/node.d.ts +3 -2
- package/esm/types/plugin.d.ts +1 -0
- package/esm/types/plugin.js +1 -0
- package/esm/types/plugin.js.map +1 -1
- package/esm/types/spec.d.ts +1 -0
- package/esm/types/theme.d.ts +7 -7
- package/esm/util/animate.d.ts +7 -2
- package/esm/util/animate.js +40 -23
- package/esm/util/animate.js.map +1 -1
- package/esm/util/bbox.d.ts +7 -1
- package/esm/util/bbox.js +16 -0
- package/esm/util/bbox.js.map +1 -1
- package/esm/util/data.d.ts +7 -1
- package/esm/util/data.js +17 -5
- package/esm/util/data.js.map +1 -1
- package/esm/util/dom.js +5 -5
- package/esm/util/dom.js.map +1 -1
- package/esm/util/item.d.ts +1 -1
- package/esm/util/item.js +8 -8
- package/esm/util/item.js.map +1 -1
- package/esm/util/mapper.js +1 -1
- package/esm/util/mapper.js.map +1 -1
- package/esm/util/path.d.ts +6 -1
- package/esm/util/path.js +72 -1
- package/esm/util/path.js.map +1 -1
- package/esm/util/polyline.d.ts +10 -0
- package/esm/util/polyline.js +22 -17
- package/esm/util/polyline.js.map +1 -1
- package/esm/util/router.d.ts +1 -1
- package/esm/util/router.js +19 -18
- package/esm/util/router.js.map +1 -1
- package/esm/util/shape.d.ts +1 -1
- package/esm/util/shape.js +28 -13
- package/esm/util/shape.js.map +1 -1
- package/esm/util/zoom.d.ts +5 -8
- package/esm/util/zoom.js +15 -20
- package/esm/util/zoom.js.map +1 -1
- package/lib/constant/shape.d.ts +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.js +1 -1
- package/lib/item/combo.d.ts +6 -4
- package/lib/item/combo.js +10 -3
- package/lib/item/combo.js.map +1 -1
- package/lib/item/edge.d.ts +12 -4
- package/lib/item/edge.js +99 -16
- package/lib/item/edge.js.map +1 -1
- package/lib/item/item.d.ts +18 -8
- package/lib/item/item.js +119 -60
- package/lib/item/item.js.map +1 -1
- package/lib/item/node.d.ts +10 -4
- package/lib/item/node.js +92 -8
- package/lib/item/node.js.map +1 -1
- package/lib/runtime/controller/data.d.ts +5 -1
- package/lib/runtime/controller/data.js +38 -1
- package/lib/runtime/controller/data.js.map +1 -1
- package/lib/runtime/controller/index.d.ts +1 -1
- package/lib/runtime/controller/index.js +1 -1
- package/lib/runtime/controller/index.js.map +1 -1
- package/lib/runtime/controller/item.d.ts +22 -11
- package/lib/runtime/controller/item.js +238 -93
- package/lib/runtime/controller/item.js.map +1 -1
- package/lib/runtime/controller/layout.d.ts +3 -0
- package/lib/runtime/controller/layout.js +178 -98
- package/lib/runtime/controller/layout.js.map +1 -1
- package/lib/runtime/controller/plugin.d.ts +3 -0
- package/lib/runtime/controller/plugin.js +66 -24
- package/lib/runtime/controller/plugin.js.map +1 -1
- package/lib/runtime/controller/viewport.js +9 -2
- package/lib/runtime/controller/viewport.js.map +1 -1
- package/lib/runtime/graph.d.ts +57 -26
- package/lib/runtime/graph.js +263 -139
- package/lib/runtime/graph.js.map +1 -1
- package/lib/stdlib/behavior/click-select.js +9 -3
- package/lib/stdlib/behavior/click-select.js.map +1 -1
- package/lib/stdlib/behavior/drag-canvas.js +6 -3
- package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
- package/lib/stdlib/behavior/drag-combo.js +8 -8
- package/lib/stdlib/behavior/drag-combo.js.map +1 -1
- package/lib/stdlib/behavior/drag-node.d.ts +4 -0
- package/lib/stdlib/behavior/drag-node.js +121 -27
- package/lib/stdlib/behavior/drag-node.js.map +1 -1
- package/lib/stdlib/behavior/scroll-canvas.js +3 -3
- package/lib/stdlib/behavior/scroll-canvas.js.map +1 -1
- package/lib/stdlib/behavior/zoom-canvas.js +3 -3
- package/lib/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/lib/stdlib/data/mapNodeSize.js +2 -2
- package/lib/stdlib/data/mapNodeSize.js.map +1 -1
- package/lib/stdlib/data/validateData.js +2 -2
- package/lib/stdlib/data/validateData.js.map +1 -1
- package/lib/stdlib/index.d.ts +2 -0
- package/lib/stdlib/index.js +3 -1
- package/lib/stdlib/index.js.map +1 -1
- package/lib/stdlib/item/edge/base.d.ts +2 -11
- package/lib/stdlib/item/edge/base.js +12 -105
- package/lib/stdlib/item/edge/base.js.map +1 -1
- package/lib/stdlib/item/node/base.d.ts +2 -20
- package/lib/stdlib/item/node/base.js +10 -150
- package/lib/stdlib/item/node/base.js.map +1 -1
- package/lib/stdlib/plugin/edgeFilterLens/index.js +2 -2
- package/lib/stdlib/plugin/edgeFilterLens/index.js.map +1 -1
- package/lib/stdlib/plugin/fisheye/index.js +2 -1
- package/lib/stdlib/plugin/fisheye/index.js.map +1 -1
- package/lib/stdlib/plugin/history/visibility-updated-command.js +2 -2
- package/lib/stdlib/plugin/history/visibility-updated-command.js.map +1 -1
- package/lib/stdlib/plugin/hull/index.d.ts +1 -1
- package/lib/stdlib/plugin/index.d.ts +1 -0
- package/lib/stdlib/plugin/index.js +1 -0
- package/lib/stdlib/plugin/index.js.map +1 -1
- package/lib/stdlib/plugin/lodController/index.d.ts +73 -0
- package/lib/stdlib/plugin/lodController/index.js +560 -0
- package/lib/stdlib/plugin/lodController/index.js.map +1 -0
- package/lib/stdlib/plugin/menu/index.js +2 -1
- package/lib/stdlib/plugin/menu/index.js.map +1 -1
- package/lib/stdlib/plugin/minimap/index.js +12 -14
- package/lib/stdlib/plugin/minimap/index.js.map +1 -1
- package/lib/stdlib/plugin/toolbar/index.d.ts +2 -2
- package/lib/stdlib/plugin/toolbar/index.js +27 -29
- package/lib/stdlib/plugin/toolbar/index.js.map +1 -1
- package/lib/stdlib/theme/dark.js +32 -35
- package/lib/stdlib/theme/dark.js.map +1 -1
- package/lib/stdlib/theme/light.js +27 -30
- package/lib/stdlib/theme/light.js.map +1 -1
- package/lib/stdlib/themeSolver/spec.js +2 -2
- package/lib/stdlib/themeSolver/spec.js.map +1 -1
- package/lib/types/animate.d.ts +1 -1
- package/lib/types/combo.d.ts +2 -2
- package/lib/types/edge.d.ts +2 -2
- package/lib/types/graph.d.ts +62 -43
- package/lib/types/hook.d.ts +5 -0
- package/lib/types/item.d.ts +9 -15
- package/lib/types/layout.d.ts +7 -2
- package/lib/types/layout.js.map +1 -1
- package/lib/types/node.d.ts +3 -2
- package/lib/types/plugin.d.ts +1 -0
- package/lib/types/plugin.js +1 -0
- package/lib/types/plugin.js.map +1 -1
- package/lib/types/spec.d.ts +1 -0
- package/lib/types/theme.d.ts +7 -7
- package/lib/util/animate.d.ts +7 -2
- package/lib/util/animate.js +40 -23
- package/lib/util/animate.js.map +1 -1
- package/lib/util/bbox.d.ts +7 -1
- package/lib/util/bbox.js +18 -1
- package/lib/util/bbox.js.map +1 -1
- package/lib/util/data.d.ts +7 -1
- package/lib/util/data.js +19 -6
- package/lib/util/data.js.map +1 -1
- package/lib/util/dom.js +5 -5
- package/lib/util/dom.js.map +1 -1
- package/lib/util/item.d.ts +1 -1
- package/lib/util/item.js +8 -8
- package/lib/util/item.js.map +1 -1
- package/lib/util/mapper.js +1 -1
- package/lib/util/mapper.js.map +1 -1
- package/lib/util/path.d.ts +6 -1
- package/lib/util/path.js +72 -1
- package/lib/util/path.js.map +1 -1
- package/lib/util/polyline.d.ts +10 -0
- package/lib/util/polyline.js +25 -18
- package/lib/util/polyline.js.map +1 -1
- package/lib/util/router.d.ts +1 -1
- package/lib/util/router.js +19 -18
- package/lib/util/router.js.map +1 -1
- package/lib/util/shape.d.ts +1 -1
- package/lib/util/shape.js +27 -12
- package/lib/util/shape.js.map +1 -1
- package/lib/util/zoom.d.ts +5 -8
- package/lib/util/zoom.js +17 -22
- package/lib/util/zoom.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/item/combo.ts +13 -5
- package/src/item/edge.ts +126 -17
- package/src/item/item.ts +140 -57
- package/src/item/node.ts +109 -12
- package/src/runtime/controller/data.ts +64 -3
- package/src/runtime/controller/index.ts +1 -1
- package/src/runtime/controller/item.ts +321 -135
- package/src/runtime/controller/layout.ts +254 -113
- package/src/runtime/controller/plugin.ts +86 -33
- package/src/runtime/controller/viewport.ts +8 -2
- package/src/runtime/graph.ts +383 -158
- package/src/stdlib/behavior/click-select.ts +8 -3
- package/src/stdlib/behavior/drag-canvas.ts +6 -3
- package/src/stdlib/behavior/drag-combo.ts +8 -8
- package/src/stdlib/behavior/drag-node.ts +165 -50
- package/src/stdlib/behavior/scroll-canvas.ts +3 -3
- package/src/stdlib/behavior/zoom-canvas.ts +3 -3
- package/src/stdlib/data/mapNodeSize.ts +2 -2
- package/src/stdlib/data/validateData.ts +2 -2
- package/src/stdlib/index.ts +3 -0
- package/src/stdlib/item/edge/base.ts +15 -139
- package/src/stdlib/item/node/base.ts +20 -215
- package/src/stdlib/plugin/edgeFilterLens/index.ts +2 -2
- package/src/stdlib/plugin/fisheye/index.ts +3 -2
- package/src/stdlib/plugin/history/visibility-updated-command.ts +2 -2
- package/src/stdlib/plugin/index.ts +1 -0
- package/src/stdlib/plugin/lodController/index.ts +602 -0
- package/src/stdlib/plugin/menu/index.ts +1 -1
- package/src/stdlib/plugin/minimap/index.ts +12 -14
- package/src/stdlib/plugin/toolbar/index.ts +29 -31
- package/src/stdlib/theme/dark.ts +32 -34
- package/src/stdlib/theme/light.ts +27 -29
- package/src/stdlib/themeSolver/spec.ts +2 -2
- package/src/types/animate.ts +1 -1
- package/src/types/combo.ts +2 -2
- package/src/types/edge.ts +2 -2
- package/src/types/graph.ts +65 -53
- package/src/types/hook.ts +5 -0
- package/src/types/item.ts +8 -14
- package/src/types/layout.ts +20 -15
- package/src/types/node.ts +3 -2
- package/src/types/plugin.ts +2 -0
- package/src/types/spec.ts +1 -0
- package/src/types/theme.ts +7 -7
- package/src/util/animate.ts +104 -75
- package/src/util/bbox.ts +26 -1
- package/src/util/data.ts +15 -6
- package/src/util/dom.ts +6 -6
- package/src/util/item.ts +15 -1
- package/src/util/mapper.ts +1 -1
- package/src/util/path.ts +72 -2
- package/src/util/polyline.ts +30 -23
- package/src/util/router.ts +21 -19
- package/src/util/shape.ts +27 -12
- package/src/util/zoom.ts +19 -25
- package/esm/runtime/controller/extension.d.ts +0 -9
- package/esm/runtime/controller/extension.js +0 -11
- package/esm/runtime/controller/extension.js.map +0 -1
- package/lib/runtime/controller/extension.d.ts +0 -9
- package/lib/runtime/controller/extension.js +0 -15
- package/lib/runtime/controller/extension.js.map +0 -1
- package/src/runtime/controller/extension.ts +0 -14
package/src/types/graph.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { BehaviorOptionsOf, BehaviorRegistry } from './behavior';
|
|
|
8
8
|
import { ComboModel, ComboUserModel } from './combo';
|
|
9
9
|
import { Padding, Point } from './common';
|
|
10
10
|
import { GraphData } from './data';
|
|
11
|
-
import { EdgeModel, EdgeUserModel } from './edge';
|
|
11
|
+
import { EdgeDisplayModel, EdgeModel, EdgeUserModel } from './edge';
|
|
12
12
|
import type { StackType } from './history';
|
|
13
13
|
import { ITEM_TYPE, SHAPE_TYPE, ShapeStyle } from './item';
|
|
14
14
|
import { LayoutOptions } from './layout';
|
|
@@ -25,6 +25,7 @@ export interface IGraph<
|
|
|
25
25
|
[x: string]: any;
|
|
26
26
|
hooks: Hooks;
|
|
27
27
|
canvas: Canvas;
|
|
28
|
+
labelCanvas: Canvas;
|
|
28
29
|
transientCanvas: Canvas;
|
|
29
30
|
destroyed: boolean;
|
|
30
31
|
container: HTMLElement;
|
|
@@ -116,6 +117,15 @@ export interface IGraph<
|
|
|
116
117
|
nodeId: ID,
|
|
117
118
|
direction?: 'in' | 'out' | 'both',
|
|
118
119
|
) => EdgeModel[];
|
|
120
|
+
/**
|
|
121
|
+
* Get nearby edges from a start node using quadtree collision detection.
|
|
122
|
+
* @param nodeId id of the start node
|
|
123
|
+
* @returns nearby edges' data array
|
|
124
|
+
*/
|
|
125
|
+
getNearEdgesData: (
|
|
126
|
+
nodeId: ID,
|
|
127
|
+
shouldBegin?: (edge: EdgeDisplayModel) => boolean,
|
|
128
|
+
) => EdgeModel[];
|
|
119
129
|
/**
|
|
120
130
|
* Get one-hop node ids from a start node.
|
|
121
131
|
* @param nodeId id of the start node
|
|
@@ -126,12 +136,6 @@ export interface IGraph<
|
|
|
126
136
|
nodeId: ID,
|
|
127
137
|
direction?: 'in' | 'out' | 'both',
|
|
128
138
|
) => NodeModel[];
|
|
129
|
-
/**
|
|
130
|
-
* Retrieve the nearby edges for a given node using quadtree collision detection.
|
|
131
|
-
* @param nodeId target node's id
|
|
132
|
-
* @returns edges
|
|
133
|
-
*/
|
|
134
|
-
getNearEdgesForNode: (nodeId: ID) => EdgeModel[];
|
|
135
139
|
/*
|
|
136
140
|
* Get the children's data of a combo.
|
|
137
141
|
* @param comboId combo id
|
|
@@ -157,10 +161,15 @@ export interface IGraph<
|
|
|
157
161
|
* Change graph data.
|
|
158
162
|
* @param data new data
|
|
159
163
|
* @param type the way to change data, 'replace' means discard the old data and use the new one; 'mergeReplace' means merge the common part, remove (old - new), add (new - old)
|
|
164
|
+
* @param relayout whether relayout the nodes after data changing
|
|
160
165
|
* @returns
|
|
161
166
|
* @group Data
|
|
162
167
|
*/
|
|
163
|
-
changeData: (
|
|
168
|
+
changeData: (
|
|
169
|
+
data: GraphData,
|
|
170
|
+
type?: 'replace' | 'mergeReplace',
|
|
171
|
+
relayout?: boolean,
|
|
172
|
+
) => void;
|
|
164
173
|
/**
|
|
165
174
|
* Clear the graph, means remove all the items on the graph.
|
|
166
175
|
* @returns
|
|
@@ -185,7 +194,6 @@ export interface IGraph<
|
|
|
185
194
|
* Add one or more node/edge/combo data to the graph.
|
|
186
195
|
* @param itemType item type
|
|
187
196
|
* @param model user data
|
|
188
|
-
* @param stack whether push this operation to stack
|
|
189
197
|
* @returns whehter success
|
|
190
198
|
* @group Data
|
|
191
199
|
*/
|
|
@@ -198,7 +206,6 @@ export interface IGraph<
|
|
|
198
206
|
| NodeUserModel[]
|
|
199
207
|
| EdgeUserModel[]
|
|
200
208
|
| ComboUserModel[],
|
|
201
|
-
stack?: boolean,
|
|
202
209
|
) =>
|
|
203
210
|
| NodeModel
|
|
204
211
|
| EdgeModel
|
|
@@ -208,17 +215,16 @@ export interface IGraph<
|
|
|
208
215
|
| ComboModel[];
|
|
209
216
|
/**
|
|
210
217
|
* Remove one or more node/edge/combo data from the graph.
|
|
211
|
-
* @param
|
|
212
|
-
* @param
|
|
218
|
+
* @param itemType the type the item(s) to be removed.
|
|
219
|
+
* @param id the id or the ids' array of the items to be removed.
|
|
213
220
|
* @returns whehter success
|
|
214
221
|
* @group Data
|
|
215
222
|
*/
|
|
216
|
-
removeData: (itemType: ITEM_TYPE, id: ID | ID[]
|
|
223
|
+
removeData: (itemType: ITEM_TYPE, id: ID | ID[]) => void;
|
|
217
224
|
/**
|
|
218
225
|
* Update one or more node/edge/combo data on the graph.
|
|
219
|
-
* @param
|
|
220
|
-
* @param
|
|
221
|
-
* @param {boolean} stack whether push this operation to stack
|
|
226
|
+
* @param itemType the type the item(s) to be udated.
|
|
227
|
+
* @param models update configs.
|
|
222
228
|
* @group Data
|
|
223
229
|
*/
|
|
224
230
|
updateData: (
|
|
@@ -232,7 +238,6 @@ export interface IGraph<
|
|
|
232
238
|
| Partial<EdgeUserModel>[]
|
|
233
239
|
| Partial<ComboUserModel>[]
|
|
234
240
|
>,
|
|
235
|
-
stack?: boolean,
|
|
236
241
|
) =>
|
|
237
242
|
| NodeModel
|
|
238
243
|
| EdgeModel
|
|
@@ -244,8 +249,10 @@ export interface IGraph<
|
|
|
244
249
|
/**
|
|
245
250
|
* Update one or more nodes' positions,
|
|
246
251
|
* do not update other styles which leads to better performance than updating positions by updateData.
|
|
247
|
-
* @param models new configurations with x and y for every node, which has id field to indicate the specific item
|
|
248
|
-
* @param
|
|
252
|
+
* @param models new configurations with x and y for every node, which has id field to indicate the specific item.
|
|
253
|
+
* @param upsertAncestors whether update the ancestors in combo tree.
|
|
254
|
+
* @param disableAnimate whether disable the animation for this call.
|
|
255
|
+
* @param callback callback function after update nodes done.
|
|
249
256
|
* @group Data
|
|
250
257
|
*/
|
|
251
258
|
updateNodePosition: (
|
|
@@ -260,14 +267,15 @@ export interface IGraph<
|
|
|
260
267
|
model: NodeModel | EdgeModel | ComboModel,
|
|
261
268
|
canceled?: boolean,
|
|
262
269
|
) => void,
|
|
263
|
-
stack?: boolean,
|
|
264
270
|
) => NodeModel | ComboModel | NodeModel[] | ComboModel[];
|
|
265
271
|
|
|
266
272
|
/**
|
|
267
273
|
* Update one or more combos' positions, it is achieved by move the succeed nodes.
|
|
268
274
|
* Do not update other styles which leads to better performance than updating positions by updateData.
|
|
269
|
-
* @param models new configurations with x and y for every combo, which has id field to indicate the specific item
|
|
270
|
-
* @param
|
|
275
|
+
* @param models new configurations with x and y for every combo, which has id field to indicate the specific item.
|
|
276
|
+
* @param upsertAncestors whether update the ancestors in combo tree.
|
|
277
|
+
* @param disableAnimate whether disable the animation for this call.
|
|
278
|
+
* @param callback callback function after update combos done.
|
|
271
279
|
* @group Data
|
|
272
280
|
*/
|
|
273
281
|
updateComboPosition: (
|
|
@@ -279,15 +287,17 @@ export interface IGraph<
|
|
|
279
287
|
upsertAncestors?: boolean,
|
|
280
288
|
disableAnimate?: boolean,
|
|
281
289
|
callback?: (model: NodeModel | EdgeModel | ComboModel) => void,
|
|
282
|
-
stack?: boolean,
|
|
283
290
|
) => NodeModel | ComboModel | NodeModel[] | ComboModel[];
|
|
284
291
|
|
|
285
292
|
/**
|
|
286
293
|
* Move one or more combos a distance (dx, dy) relatively,
|
|
287
294
|
* do not update other styles which leads to better performance than updating positions by updateData.
|
|
288
295
|
* In fact, it changes the succeed nodes positions to affect the combo's position, but not modify the combo's position directly.
|
|
289
|
-
* @param models new configurations with x and y for every combo, which has id field to indicate the specific item
|
|
290
|
-
* @param
|
|
296
|
+
* @param models new configurations with x and y for every combo, which has id field to indicate the specific item.
|
|
297
|
+
* @param dx the distance alone x-axis to move the combo.
|
|
298
|
+
* @param dy the distance alone y-axis to move the combo.
|
|
299
|
+
* @param upsertAncestors whether update the ancestors in the combo tree.
|
|
300
|
+
* @param callback callback function after move combo done.
|
|
291
301
|
* @group Data
|
|
292
302
|
*/
|
|
293
303
|
moveCombo: (
|
|
@@ -299,7 +309,6 @@ export interface IGraph<
|
|
|
299
309
|
model: NodeModel | EdgeModel | ComboModel,
|
|
300
310
|
canceled?: boolean,
|
|
301
311
|
) => void,
|
|
302
|
-
stack?: boolean,
|
|
303
312
|
) => ComboModel[];
|
|
304
313
|
|
|
305
314
|
// ===== view operations =====
|
|
@@ -481,7 +490,10 @@ export interface IGraph<
|
|
|
481
490
|
* @returns
|
|
482
491
|
* @group Data
|
|
483
492
|
*/
|
|
484
|
-
showItem: (
|
|
493
|
+
showItem: (
|
|
494
|
+
ids: ID | ID[],
|
|
495
|
+
options?: { disableAnimate?: boolean; shapeIds?: string[] },
|
|
496
|
+
) => void;
|
|
485
497
|
/**
|
|
486
498
|
* Hide the item(s).
|
|
487
499
|
* @param ids the item id(s) to be hidden
|
|
@@ -490,8 +502,12 @@ export interface IGraph<
|
|
|
490
502
|
*/
|
|
491
503
|
hideItem: (
|
|
492
504
|
ids: ID | ID[],
|
|
493
|
-
|
|
494
|
-
|
|
505
|
+
options?: {
|
|
506
|
+
disableAnimate?: boolean;
|
|
507
|
+
keepKeyShape?: boolean;
|
|
508
|
+
keepRelated?: boolean;
|
|
509
|
+
shapeIds?: string[];
|
|
510
|
+
},
|
|
495
511
|
) => void;
|
|
496
512
|
/**
|
|
497
513
|
* Make the item(s) to the front.
|
|
@@ -499,14 +515,14 @@ export interface IGraph<
|
|
|
499
515
|
* @returns
|
|
500
516
|
* @group Item
|
|
501
517
|
*/
|
|
502
|
-
frontItem: (ids: ID | ID[]
|
|
518
|
+
frontItem: (ids: ID | ID[]) => void;
|
|
503
519
|
/**
|
|
504
520
|
* Make the item(s) to the back.
|
|
505
521
|
* @param ids the item id(s) to back
|
|
506
522
|
* @returns
|
|
507
523
|
* @group Item
|
|
508
524
|
*/
|
|
509
|
-
backItem: (ids: ID | ID[]
|
|
525
|
+
backItem: (ids: ID | ID[]) => void;
|
|
510
526
|
/**
|
|
511
527
|
* Set state for the item(s).
|
|
512
528
|
* @param ids the id(s) for the item(s) to be set
|
|
@@ -515,12 +531,7 @@ export interface IGraph<
|
|
|
515
531
|
* @returns
|
|
516
532
|
* @group Item
|
|
517
533
|
*/
|
|
518
|
-
setItemState: (
|
|
519
|
-
ids: ID | ID[],
|
|
520
|
-
state: string,
|
|
521
|
-
value: boolean,
|
|
522
|
-
stack?: boolean,
|
|
523
|
-
) => void;
|
|
534
|
+
setItemState: (ids: ID | ID[], state: string, value: boolean) => void;
|
|
524
535
|
/**
|
|
525
536
|
* Get the state value for an item.
|
|
526
537
|
* @param id the id for the item
|
|
@@ -543,7 +554,7 @@ export interface IGraph<
|
|
|
543
554
|
* @returns
|
|
544
555
|
* @group Item
|
|
545
556
|
*/
|
|
546
|
-
clearItemState: (ids: ID | ID[], states?: string[]
|
|
557
|
+
clearItemState: (ids: ID | ID[], states?: string[]) => void;
|
|
547
558
|
|
|
548
559
|
/**
|
|
549
560
|
* Get the rendering bbox for a node / edge / combo, or the graph (when the id is not assigned).
|
|
@@ -563,34 +574,37 @@ export interface IGraph<
|
|
|
563
574
|
*/
|
|
564
575
|
getItemVisible: (id: ID) => boolean;
|
|
565
576
|
|
|
577
|
+
/**
|
|
578
|
+
* Get the visible shape ids in a node / edge / combo.
|
|
579
|
+
* @param id the id for the node / edge / combo
|
|
580
|
+
* @returns ids of the visible shapes
|
|
581
|
+
*/
|
|
582
|
+
getItemVisibleShapeIds: (id: ID) => string[];
|
|
583
|
+
|
|
566
584
|
// ===== combo operations =====
|
|
567
585
|
|
|
568
586
|
/**
|
|
569
587
|
* Add a new combo to the graph, and update the structure of the existed child in childrenIds to be the children of the new combo.
|
|
570
588
|
* Different from addData with combo type, this API update the succeeds' combo tree strucutres in the same time.
|
|
571
|
-
* @param model combo user data
|
|
572
|
-
* @param
|
|
589
|
+
* @param model combo user data.
|
|
590
|
+
* @param childrenIds the ids of the children nodes / combos to move into the new combo.
|
|
573
591
|
* @returns whether success
|
|
574
592
|
* @group Combo
|
|
575
593
|
*/
|
|
576
|
-
addCombo: (
|
|
577
|
-
model: ComboUserModel,
|
|
578
|
-
childrenIds: ID[],
|
|
579
|
-
stack?: boolean,
|
|
580
|
-
) => ComboModel;
|
|
594
|
+
addCombo: (model: ComboUserModel, childrenIds: ID[]) => ComboModel;
|
|
581
595
|
/**
|
|
582
596
|
* Collapse a combo.
|
|
583
|
-
* @param comboId combo id or
|
|
597
|
+
* @param comboId combo id or ids' array.
|
|
584
598
|
* @group Combo
|
|
585
599
|
*/
|
|
586
|
-
collapseCombo: (comboIds: ID | ID[]
|
|
600
|
+
collapseCombo: (comboIds: ID | ID[]) => void;
|
|
587
601
|
/**
|
|
588
602
|
* Expand a combo.
|
|
589
603
|
* @group Combo
|
|
590
|
-
* @param
|
|
604
|
+
* @param comboId combo id or ids' array.
|
|
591
605
|
* @group Combo
|
|
592
606
|
*/
|
|
593
|
-
expandCombo: (comboIds: ID | ID[]
|
|
607
|
+
expandCombo: (comboIds: ID | ID[]) => void;
|
|
594
608
|
|
|
595
609
|
// ===== layout =====
|
|
596
610
|
/**
|
|
@@ -806,18 +820,16 @@ export interface IGraph<
|
|
|
806
820
|
* Collapse sub tree(s).
|
|
807
821
|
* @param ids Root id(s) of the sub trees.
|
|
808
822
|
* @param disableAnimate Whether disable the animations for this operation.
|
|
809
|
-
* @param stack Whether push this operation to stack.
|
|
810
823
|
* @returns
|
|
811
824
|
* @group Tree
|
|
812
825
|
*/
|
|
813
|
-
collapse: (ids: ID | ID[], disableAnimate?: boolean
|
|
826
|
+
collapse: (ids: ID | ID[], disableAnimate?: boolean) => void;
|
|
814
827
|
/**
|
|
815
828
|
* Expand sub tree(s).
|
|
816
829
|
* @param ids Root id(s) of the sub trees.
|
|
817
830
|
* @param disableAnimate Whether disable the animations for this operation.
|
|
818
|
-
* @param stack Whether push this operation to stack.
|
|
819
831
|
* @returns
|
|
820
832
|
* @group Tree
|
|
821
833
|
*/
|
|
822
|
-
expand: (ids: ID | ID[], disableAnimate?: boolean
|
|
834
|
+
expand: (ids: ID | ID[], disableAnimate?: boolean) => void;
|
|
823
835
|
}
|
package/src/types/hook.ts
CHANGED
|
@@ -33,7 +33,9 @@ export interface Hooks {
|
|
|
33
33
|
canvases: {
|
|
34
34
|
background: Canvas;
|
|
35
35
|
main: Canvas;
|
|
36
|
+
label: Canvas;
|
|
36
37
|
transient: Canvas;
|
|
38
|
+
transientLabel: Canvas;
|
|
37
39
|
};
|
|
38
40
|
}>;
|
|
39
41
|
// data
|
|
@@ -55,6 +57,7 @@ export interface Hooks {
|
|
|
55
57
|
graphCore: GraphCore;
|
|
56
58
|
theme: ThemeSpecification;
|
|
57
59
|
transientCanvas: Canvas;
|
|
60
|
+
transientLabelCanvas: Canvas;
|
|
58
61
|
tileOptimize?: {
|
|
59
62
|
tileFirstRender?: boolean | number;
|
|
60
63
|
tileFirstRenderSize?: number;
|
|
@@ -89,6 +92,8 @@ export interface Hooks {
|
|
|
89
92
|
enableStack?: boolean;
|
|
90
93
|
changes?: any;
|
|
91
94
|
keepKeyShape?: boolean;
|
|
95
|
+
keepRelated?: boolean;
|
|
96
|
+
shapeIds?: string[];
|
|
92
97
|
}>;
|
|
93
98
|
itemzindexchange: IHook<{
|
|
94
99
|
ids: ID[];
|
package/src/types/item.ts
CHANGED
|
@@ -72,7 +72,7 @@ export type ClipCfg = {
|
|
|
72
72
|
export type ShapeStyle = Partial<
|
|
73
73
|
GShapeStyle & {
|
|
74
74
|
animates?: IAnimates;
|
|
75
|
-
lod?: number;
|
|
75
|
+
lod?: number | 'auto';
|
|
76
76
|
visible?: boolean;
|
|
77
77
|
} & {
|
|
78
78
|
clipCfg?: ClipCfg;
|
|
@@ -180,19 +180,13 @@ export type ItemShapeStyles = {
|
|
|
180
180
|
animates?: IAnimates;
|
|
181
181
|
};
|
|
182
182
|
|
|
183
|
-
export interface
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
primary?: boolean;
|
|
187
|
-
}[];
|
|
188
|
-
animateCfg: AnimateCfg;
|
|
183
|
+
export interface LodLevel {
|
|
184
|
+
zoomRange: [number, number];
|
|
185
|
+
primary?: boolean;
|
|
189
186
|
}
|
|
190
187
|
|
|
191
|
-
export interface
|
|
192
|
-
|
|
193
|
-
[levelIdx: number]: [number, number];
|
|
194
|
-
};
|
|
195
|
-
animateCfg: AnimateCfg;
|
|
188
|
+
export interface LodLevelRanges {
|
|
189
|
+
[levelIdx: number]: [number, number];
|
|
196
190
|
}
|
|
197
191
|
|
|
198
192
|
/**
|
|
@@ -238,7 +232,7 @@ export interface IItem {
|
|
|
238
232
|
[stateName: string]: ItemShapeStyles;
|
|
239
233
|
};
|
|
240
234
|
/** The zoom strategy to show and hide shapes according to their lod. */
|
|
241
|
-
|
|
235
|
+
lodLevels: LodLevelRanges;
|
|
242
236
|
/** Last zoom ratio. */
|
|
243
237
|
zoom: number;
|
|
244
238
|
/** Cache the chaging states which are not consomed by draw */
|
|
@@ -275,7 +269,7 @@ export interface IItem {
|
|
|
275
269
|
isReplace?: boolean,
|
|
276
270
|
itemTheme?: {
|
|
277
271
|
styles: NodeStyleSet | EdgeStyleSet | ComboStyleSet;
|
|
278
|
-
|
|
272
|
+
lodLevels: LodLevelRanges;
|
|
279
273
|
},
|
|
280
274
|
onlyMove?: boolean,
|
|
281
275
|
animate?: boolean,
|
package/src/types/layout.ts
CHANGED
|
@@ -40,33 +40,38 @@ type Workerized = {
|
|
|
40
40
|
iterations?: number;
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
+
type PureLayoutOptions =
|
|
44
|
+
| CircularLayout
|
|
45
|
+
| RandomLayout
|
|
46
|
+
| ConcentricLayout
|
|
47
|
+
| GridLayout
|
|
48
|
+
| MDSLayout
|
|
49
|
+
| RadialLayout
|
|
50
|
+
| FruchtermanLayout
|
|
51
|
+
| D3ForceLayout
|
|
52
|
+
| ForceLayout
|
|
53
|
+
| ForceAtlas2
|
|
54
|
+
| CustomLayout;
|
|
55
|
+
|
|
43
56
|
export type ImmediatelyInvokedLayoutOptions = {
|
|
44
57
|
/**
|
|
45
58
|
* like an IIFE.
|
|
46
59
|
*/
|
|
47
60
|
execute: (graph: GraphCore, options?: any) => Promise<LayoutMapping>;
|
|
48
|
-
} & Animatable
|
|
61
|
+
} & Animatable & {
|
|
62
|
+
presetLayout?: Partial<PureLayoutOptions>;
|
|
63
|
+
};
|
|
49
64
|
|
|
50
65
|
type CustomLayout = {
|
|
51
66
|
type: string;
|
|
52
67
|
[option: string]: any;
|
|
53
68
|
};
|
|
54
69
|
|
|
55
|
-
export type StandardLayoutOptions =
|
|
56
|
-
| CircularLayout
|
|
57
|
-
| RandomLayout
|
|
58
|
-
| ConcentricLayout
|
|
59
|
-
| GridLayout
|
|
60
|
-
| MDSLayout
|
|
61
|
-
| RadialLayout
|
|
62
|
-
| FruchtermanLayout
|
|
63
|
-
| D3ForceLayout
|
|
64
|
-
| ForceLayout
|
|
65
|
-
| ForceAtlas2
|
|
66
|
-
| CustomLayout
|
|
67
|
-
) &
|
|
70
|
+
export type StandardLayoutOptions = PureLayoutOptions &
|
|
68
71
|
Animatable &
|
|
69
|
-
Workerized
|
|
72
|
+
Workerized & {
|
|
73
|
+
presetLayout?: Partial<PureLayoutOptions>;
|
|
74
|
+
};
|
|
70
75
|
|
|
71
76
|
export type LayoutOptions =
|
|
72
77
|
| StandardLayoutOptions
|
package/src/types/node.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
IBadgePosition,
|
|
10
10
|
IItem,
|
|
11
11
|
ItemShapeStyles,
|
|
12
|
-
|
|
12
|
+
LodLevel,
|
|
13
13
|
ShapeAttrEncode,
|
|
14
14
|
ShapeStyle,
|
|
15
15
|
ShapesEncode,
|
|
@@ -193,7 +193,7 @@ export interface NodeShapeStyles extends ItemShapeStyles {
|
|
|
193
193
|
|
|
194
194
|
/** Data in display model. */
|
|
195
195
|
export type NodeDisplayModelData = NodeModelData &
|
|
196
|
-
NodeShapeStyles & {
|
|
196
|
+
NodeShapeStyles & { lodLevels?: LodLevel[] };
|
|
197
197
|
|
|
198
198
|
/** User input model. */
|
|
199
199
|
export type NodeUserModel = GNode<NodeUserModelData>;
|
|
@@ -219,6 +219,7 @@ export interface NodeShapesEncode extends ShapesEncode {
|
|
|
219
219
|
}
|
|
220
220
|
export interface NodeEncode extends NodeShapesEncode {
|
|
221
221
|
type?: string | Encode<string>;
|
|
222
|
+
lodLevels?: LodLevel[];
|
|
222
223
|
animates?: IAnimates;
|
|
223
224
|
}
|
|
224
225
|
|
package/src/types/plugin.ts
CHANGED
package/src/types/spec.ts
CHANGED
package/src/types/theme.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseThemeSolver } from '../stdlib/themeSolver/base';
|
|
2
2
|
import { ComboShapeStyles } from './combo';
|
|
3
3
|
import { EdgeShapeStyles } from './edge';
|
|
4
|
-
import {
|
|
4
|
+
import { LodLevel } from './item';
|
|
5
5
|
import { NodeShapeStyles } from './node';
|
|
6
6
|
|
|
7
7
|
export interface ThemeOption {}
|
|
@@ -122,13 +122,13 @@ export type ComboStyleSets =
|
|
|
122
122
|
* dataTypeField - the field name in model.data that indicates the data type to map style set.
|
|
123
123
|
* palette - color palette.
|
|
124
124
|
* styles - style sets to map.
|
|
125
|
-
*
|
|
125
|
+
* lodLevels - level of detail strategy for global setting.
|
|
126
126
|
*/
|
|
127
127
|
export interface NodeThemeSpecifications {
|
|
128
128
|
dataTypeField?: string;
|
|
129
129
|
palette?: string[] | { [dataTypeValue: string]: string };
|
|
130
130
|
styles?: NodeStyleSets;
|
|
131
|
-
|
|
131
|
+
lodLevels?: LodLevel[];
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
/**
|
|
@@ -136,13 +136,13 @@ export interface NodeThemeSpecifications {
|
|
|
136
136
|
* dataTypeField - the field name in model.data that indicates the data type to map style set.
|
|
137
137
|
* palette - color palette.
|
|
138
138
|
* styles - style sets to map.
|
|
139
|
-
*
|
|
139
|
+
* lodLevels - level of detail strategy for global setting.
|
|
140
140
|
*/
|
|
141
141
|
export interface EdgeThemeSpecifications {
|
|
142
142
|
dataTypeField?: string;
|
|
143
143
|
palette?: string[] | { [dataTypeValue: string]: string };
|
|
144
144
|
styles?: EdgeStyleSets;
|
|
145
|
-
|
|
145
|
+
lodLevels?: LodLevel[];
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
/**
|
|
@@ -150,13 +150,13 @@ export interface EdgeThemeSpecifications {
|
|
|
150
150
|
* dataTypeField - the field name in model.data that indicates the data type to map style set.
|
|
151
151
|
* palette - color palette.
|
|
152
152
|
* styles - style sets to map.
|
|
153
|
-
*
|
|
153
|
+
* lodLevels - level of detail strategy for global setting.
|
|
154
154
|
*/
|
|
155
155
|
export interface ComboThemeSpecifications {
|
|
156
156
|
dataTypeField?: string;
|
|
157
157
|
palette?: string[] | { [dataTypeValue: string]: string };
|
|
158
158
|
styles?: ComboStyleSets;
|
|
159
|
-
|
|
159
|
+
lodLevels?: LodLevel[];
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
162
162
|
* Theme specification with node / edge / combo palette and style mappers. And also canvas DOM CSS settings.
|