@antv/g6 5.0.0-beta.2 → 5.0.0-beta.21
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/api-doc/graph.d.ts +3 -3
- package/esm/api-doc/graph.js +3 -3
- package/esm/api-doc/graph.js.map +1 -1
- package/esm/api-doc/types.d.ts +1 -0
- package/esm/api-doc/types.js +1 -2
- package/esm/api-doc/types.js.map +1 -1
- package/esm/constant/shape.d.ts +3 -1
- package/esm/index.d.ts +33 -65
- package/esm/index.js +4 -5
- package/esm/index.js.map +1 -1
- package/esm/item/combo.d.ts +1 -1
- package/esm/item/combo.js +18 -14
- package/esm/item/combo.js.map +1 -1
- package/esm/item/edge.d.ts +19 -2
- package/esm/item/edge.js +100 -44
- package/esm/item/edge.js.map +1 -1
- package/esm/item/item.d.ts +3 -2
- package/esm/item/item.js +27 -13
- package/esm/item/item.js.map +1 -1
- package/esm/item/node.d.ts +2 -8
- package/esm/item/node.js +31 -19
- package/esm/item/node.js.map +1 -1
- package/esm/runtime/controller/data.d.ts +30 -16
- package/esm/runtime/controller/data.js +290 -422
- package/esm/runtime/controller/data.js.map +1 -1
- package/esm/runtime/controller/interaction.js +9 -4
- package/esm/runtime/controller/interaction.js.map +1 -1
- package/esm/runtime/controller/item.d.ts +1 -0
- package/esm/runtime/controller/item.js +285 -150
- package/esm/runtime/controller/item.js.map +1 -1
- package/esm/runtime/controller/layout.js +1 -3
- package/esm/runtime/controller/layout.js.map +1 -1
- package/esm/runtime/controller/plugin.js +9 -5
- package/esm/runtime/controller/plugin.js.map +1 -1
- package/esm/runtime/graph.d.ts +104 -24
- package/esm/runtime/graph.js +472 -94
- package/esm/runtime/graph.js.map +1 -1
- package/esm/stdlib/behavior/activate-relations.js +2 -2
- package/esm/stdlib/behavior/activate-relations.js.map +1 -1
- package/esm/stdlib/behavior/brush-select.d.ts +7 -1
- package/esm/stdlib/behavior/brush-select.js +10 -12
- package/esm/stdlib/behavior/brush-select.js.map +1 -1
- package/esm/stdlib/behavior/click-select.js +1 -1
- package/esm/stdlib/behavior/click-select.js.map +1 -1
- package/esm/stdlib/behavior/create-edge.d.ts +57 -0
- package/esm/stdlib/behavior/create-edge.js +215 -0
- package/esm/stdlib/behavior/create-edge.js.map +1 -0
- package/esm/stdlib/behavior/drag-canvas.d.ts +3 -1
- package/esm/stdlib/behavior/drag-canvas.js +78 -33
- package/esm/stdlib/behavior/drag-canvas.js.map +1 -1
- package/esm/stdlib/behavior/drag-combo.d.ts +2 -2
- package/esm/stdlib/behavior/drag-combo.js +43 -32
- package/esm/stdlib/behavior/drag-combo.js.map +1 -1
- package/esm/stdlib/behavior/drag-node.d.ts +3 -3
- package/esm/stdlib/behavior/drag-node.js +80 -63
- package/esm/stdlib/behavior/drag-node.js.map +1 -1
- package/esm/stdlib/behavior/index.d.ts +3 -0
- package/esm/stdlib/behavior/index.js +3 -0
- package/esm/stdlib/behavior/index.js.map +1 -1
- package/esm/stdlib/behavior/lasso-select.d.ts +1 -1
- package/esm/stdlib/behavior/lasso-select.js +3 -4
- package/esm/stdlib/behavior/lasso-select.js.map +1 -1
- package/esm/stdlib/behavior/scroll-canvas.d.ts +67 -0
- package/esm/stdlib/behavior/scroll-canvas.js +266 -0
- package/esm/stdlib/behavior/scroll-canvas.js.map +1 -0
- package/esm/stdlib/behavior/shortcuts-call.d.ts +38 -0
- package/esm/stdlib/behavior/shortcuts-call.js +87 -0
- package/esm/stdlib/behavior/shortcuts-call.js.map +1 -0
- package/esm/stdlib/behavior/zoom-canvas-3d.js +4 -1
- package/esm/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
- package/esm/stdlib/behavior/zoom-canvas.d.ts +3 -1
- package/esm/stdlib/behavior/zoom-canvas.js +70 -26
- package/esm/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/esm/stdlib/data/index.d.ts +1 -0
- package/esm/stdlib/data/index.js +1 -0
- package/esm/stdlib/data/index.js.map +1 -1
- package/esm/stdlib/data/mapNodeSize.d.ts +4 -5
- package/esm/stdlib/data/mapNodeSize.js +12 -2
- package/esm/stdlib/data/mapNodeSize.js.map +1 -1
- package/esm/stdlib/data/processParallelEdges.d.ts +21 -0
- package/esm/stdlib/data/processParallelEdges.js +127 -0
- package/esm/stdlib/data/processParallelEdges.js.map +1 -0
- package/esm/stdlib/data/transformV4Data.d.ts +3 -4
- package/esm/stdlib/data/transformV4Data.js +10 -2
- package/esm/stdlib/data/transformV4Data.js.map +1 -1
- package/esm/stdlib/data/validateData.d.ts +4 -5
- package/esm/stdlib/data/validateData.js +22 -13
- package/esm/stdlib/data/validateData.js.map +1 -1
- package/esm/stdlib/index.d.ts +27 -8
- package/esm/stdlib/index.js +24 -11
- package/esm/stdlib/index.js.map +1 -1
- package/esm/stdlib/item/edge/base.d.ts +3 -5
- package/esm/stdlib/item/edge/base.js +32 -31
- package/esm/stdlib/item/edge/base.js.map +1 -1
- package/esm/stdlib/item/edge/cubic-horizontal.js.map +1 -1
- package/esm/stdlib/item/edge/cubic-vertical.js.map +1 -1
- package/esm/stdlib/item/edge/cubic.js +1 -1
- package/esm/stdlib/item/edge/cubic.js.map +1 -1
- package/esm/stdlib/item/edge/loop.js +1 -1
- package/esm/stdlib/item/edge/loop.js.map +1 -1
- package/esm/stdlib/item/node/base.d.ts +3 -6
- package/esm/stdlib/item/node/base.js +30 -60
- package/esm/stdlib/item/node/base.js.map +1 -1
- package/esm/stdlib/item/node/base3d.d.ts +1 -0
- package/esm/stdlib/item/node/base3d.js +1 -0
- package/esm/stdlib/item/node/base3d.js.map +1 -1
- package/esm/stdlib/item/node/cube.d.ts +35 -0
- package/esm/stdlib/item/node/cube.js +54 -0
- package/esm/stdlib/item/node/cube.js.map +1 -0
- package/esm/stdlib/item/node/diamond.js +1 -1
- package/esm/stdlib/item/node/ellipse.js +2 -2
- package/esm/stdlib/item/node/hexagon.js +6 -2
- package/esm/stdlib/item/node/hexagon.js.map +1 -1
- package/esm/stdlib/item/node/image.d.ts +40 -0
- package/esm/stdlib/item/node/image.js +110 -0
- package/esm/stdlib/item/node/image.js.map +1 -0
- package/esm/stdlib/item/node/index.d.ts +4 -0
- package/esm/stdlib/item/node/index.js +4 -0
- package/esm/stdlib/item/node/index.js.map +1 -1
- package/esm/stdlib/plugin/edgeFilterLens/index.d.ts +66 -0
- package/esm/stdlib/plugin/edgeFilterLens/index.js +309 -0
- package/esm/stdlib/plugin/edgeFilterLens/index.js.map +1 -0
- package/esm/stdlib/plugin/grid/index.d.ts +1 -1
- package/esm/stdlib/plugin/grid/index.js +3 -4
- package/esm/stdlib/plugin/grid/index.js.map +1 -1
- package/esm/stdlib/plugin/history/combo-command.js +2 -2
- package/esm/stdlib/plugin/history/combo-command.js.map +1 -1
- package/esm/stdlib/plugin/history/index.d.ts +10 -10
- package/esm/stdlib/plugin/history/index.js +14 -14
- package/esm/stdlib/plugin/history/index.js.map +1 -1
- package/esm/stdlib/plugin/history/item-data-command.js +25 -16
- package/esm/stdlib/plugin/history/item-data-command.js.map +1 -1
- package/esm/stdlib/plugin/history/layer-updated-command.js +2 -2
- package/esm/stdlib/plugin/history/layer-updated-command.js.map +1 -1
- package/esm/stdlib/plugin/history/state-updated-command.js +1 -1
- package/esm/stdlib/plugin/history/state-updated-command.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/convexHull.d.ts +1 -1
- package/esm/stdlib/plugin/hull/hullComponent.d.ts +1 -1
- package/esm/stdlib/plugin/hull/hullComponent.js +5 -9
- package/esm/stdlib/plugin/hull/hullComponent.js.map +1 -1
- package/esm/stdlib/plugin/hull/util.d.ts +2 -2
- package/esm/stdlib/plugin/hull/util.js +6 -2
- package/esm/stdlib/plugin/hull/util.js.map +1 -1
- package/esm/stdlib/plugin/index.d.ts +2 -0
- package/esm/stdlib/plugin/index.js +2 -0
- package/esm/stdlib/plugin/index.js.map +1 -1
- package/esm/stdlib/plugin/legend/index.d.ts +2 -2
- package/esm/stdlib/plugin/legend/index.js +3 -3
- package/esm/stdlib/plugin/legend/index.js.map +1 -1
- package/esm/stdlib/plugin/menu/index.d.ts +4 -4
- package/esm/stdlib/plugin/menu/index.js +3 -3
- package/esm/stdlib/plugin/menu/index.js.map +1 -1
- package/esm/stdlib/plugin/minimap/index.d.ts +6 -2
- package/esm/stdlib/plugin/minimap/index.js +119 -12
- package/esm/stdlib/plugin/minimap/index.js.map +1 -1
- package/esm/stdlib/plugin/snapline/index.d.ts +167 -0
- package/esm/stdlib/plugin/snapline/index.js +1063 -0
- package/esm/stdlib/plugin/snapline/index.js.map +1 -0
- package/esm/stdlib/plugin/timebar/index.js +2 -2
- package/esm/stdlib/plugin/timebar/index.js.map +1 -1
- package/esm/stdlib/plugin/toolbar/index.d.ts +3 -3
- package/esm/stdlib/plugin/toolbar/index.js +4 -4
- package/esm/stdlib/plugin/toolbar/index.js.map +1 -1
- package/esm/stdlib/plugin/tooltip/index.d.ts +4 -4
- package/esm/stdlib/plugin/tooltip/index.js +3 -4
- package/esm/stdlib/plugin/tooltip/index.js.map +1 -1
- package/esm/stdlib/plugin/types.d.ts +2 -0
- package/esm/stdlib/plugin/watermaker/index.d.ts +78 -0
- package/esm/stdlib/plugin/watermaker/index.js +243 -0
- package/esm/stdlib/plugin/watermaker/index.js.map +1 -0
- package/esm/stdlib/theme/dark.js +42 -2
- package/esm/stdlib/theme/dark.js.map +1 -1
- package/esm/stdlib/theme/light.js +4 -4
- package/esm/types/data.d.ts +5 -0
- package/esm/types/event.d.ts +1 -0
- package/esm/types/graph.d.ts +48 -22
- package/esm/types/hook.d.ts +22 -2
- package/esm/types/index.d.ts +2 -1
- package/esm/types/index.js +1 -0
- package/esm/types/index.js.map +1 -1
- package/esm/types/item.d.ts +7 -1
- package/esm/types/item.js.map +1 -1
- package/esm/types/plugin.d.ts +1 -1
- package/esm/types/spec.d.ts +20 -3
- package/esm/types/view.d.ts +5 -0
- package/esm/util/array.d.ts +1 -0
- package/esm/util/array.js +3 -0
- package/esm/util/array.js.map +1 -1
- package/esm/util/bbox.d.ts +16 -1
- package/esm/util/bbox.js +33 -5
- package/esm/util/bbox.js.map +1 -1
- package/esm/util/behavior.d.ts +2 -2
- package/esm/util/behavior.js +2 -2
- package/esm/util/behavior.js.map +1 -1
- package/esm/util/data.d.ts +5 -2
- package/esm/util/data.js +15 -0
- package/esm/util/data.js.map +1 -1
- package/esm/util/dom.d.ts +15 -0
- package/esm/util/dom.js +29 -0
- package/esm/util/dom.js.map +1 -0
- package/esm/util/event.d.ts +3 -1
- package/esm/util/event.js +8 -1
- package/esm/util/event.js.map +1 -1
- package/esm/util/extend.d.ts +1 -1
- package/esm/util/extend.js +0 -1
- package/esm/util/extend.js.map +1 -1
- package/esm/util/index.d.ts +7 -52
- package/esm/util/index.js +7 -23
- package/esm/util/index.js.map +1 -1
- package/esm/util/item.d.ts +16 -1
- package/esm/util/item.js +31 -8
- package/esm/util/item.js.map +1 -1
- package/esm/util/layout.d.ts +12 -1
- package/esm/util/layout.js +45 -0
- package/esm/util/layout.js.map +1 -1
- package/esm/util/loop.d.ts +2 -1
- package/esm/util/loop.js +14 -0
- package/esm/util/loop.js.map +1 -1
- package/esm/util/math.d.ts +1 -1
- package/esm/util/matrix.d.ts +6 -0
- package/esm/util/matrix.js +48 -0
- package/esm/util/matrix.js.map +1 -0
- package/esm/util/path.js +1 -1
- package/esm/util/path.js.map +1 -1
- package/esm/util/point.d.ts +1 -1
- package/esm/util/point.js +9 -2
- package/esm/util/point.js.map +1 -1
- package/esm/util/polyline.d.ts +2 -1
- package/esm/util/polyline.js +2 -1
- package/esm/util/polyline.js.map +1 -1
- package/esm/util/router.d.ts +1 -1
- package/esm/util/shape.d.ts +3 -3
- package/esm/util/shape.js +17 -26
- package/esm/util/shape.js.map +1 -1
- package/esm/util/shape3d.d.ts +1 -1
- package/esm/util/shape3d.js +16 -17
- package/esm/util/shape3d.js.map +1 -1
- package/esm/util/text.d.ts +1 -1
- package/esm/util/text.js +3 -2
- package/esm/util/text.js.map +1 -1
- package/esm/util/warn.d.ts +14 -0
- package/esm/util/warn.js +4 -0
- package/esm/util/warn.js.map +1 -0
- package/lib/api-doc/graph.d.ts +3 -3
- package/lib/api-doc/graph.js +27 -7
- package/lib/api-doc/graph.js.map +1 -1
- package/lib/api-doc/types.d.ts +1 -0
- package/lib/api-doc/types.js +2 -2
- package/lib/api-doc/types.js.map +1 -1
- package/lib/constant/shape.d.ts +3 -1
- package/lib/index.d.ts +33 -65
- package/lib/index.js +18 -10
- package/lib/index.js.map +1 -1
- package/lib/item/combo.d.ts +1 -1
- package/lib/item/combo.js +18 -14
- package/lib/item/combo.js.map +1 -1
- package/lib/item/edge.d.ts +19 -2
- package/lib/item/edge.js +99 -43
- package/lib/item/edge.js.map +1 -1
- package/lib/item/item.d.ts +3 -2
- package/lib/item/item.js +27 -13
- package/lib/item/item.js.map +1 -1
- package/lib/item/node.d.ts +2 -8
- package/lib/item/node.js +31 -19
- package/lib/item/node.js.map +1 -1
- package/lib/runtime/controller/data.d.ts +30 -16
- package/lib/runtime/controller/data.js +288 -420
- package/lib/runtime/controller/data.js.map +1 -1
- package/lib/runtime/controller/interaction.js +9 -4
- package/lib/runtime/controller/interaction.js.map +1 -1
- package/lib/runtime/controller/item.d.ts +1 -0
- package/lib/runtime/controller/item.js +284 -149
- package/lib/runtime/controller/item.js.map +1 -1
- package/lib/runtime/controller/layout.js +1 -3
- package/lib/runtime/controller/layout.js.map +1 -1
- package/lib/runtime/controller/plugin.js +9 -5
- package/lib/runtime/controller/plugin.js.map +1 -1
- package/lib/runtime/graph.d.ts +104 -24
- package/lib/runtime/graph.js +473 -94
- package/lib/runtime/graph.js.map +1 -1
- package/lib/stdlib/behavior/activate-relations.js +2 -2
- package/lib/stdlib/behavior/activate-relations.js.map +1 -1
- package/lib/stdlib/behavior/brush-select.d.ts +7 -1
- package/lib/stdlib/behavior/brush-select.js +13 -12
- package/lib/stdlib/behavior/brush-select.js.map +1 -1
- package/lib/stdlib/behavior/click-select.js +1 -1
- package/lib/stdlib/behavior/click-select.js.map +1 -1
- package/lib/stdlib/behavior/create-edge.d.ts +57 -0
- package/lib/stdlib/behavior/create-edge.js +219 -0
- package/lib/stdlib/behavior/create-edge.js.map +1 -0
- package/lib/stdlib/behavior/drag-canvas.d.ts +3 -1
- package/lib/stdlib/behavior/drag-canvas.js +78 -33
- package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
- package/lib/stdlib/behavior/drag-combo.d.ts +2 -2
- package/lib/stdlib/behavior/drag-combo.js +43 -32
- package/lib/stdlib/behavior/drag-combo.js.map +1 -1
- package/lib/stdlib/behavior/drag-node.d.ts +3 -3
- package/lib/stdlib/behavior/drag-node.js +80 -63
- package/lib/stdlib/behavior/drag-node.js.map +1 -1
- package/lib/stdlib/behavior/index.d.ts +3 -0
- package/lib/stdlib/behavior/index.js +3 -0
- package/lib/stdlib/behavior/index.js.map +1 -1
- package/lib/stdlib/behavior/lasso-select.d.ts +1 -1
- package/lib/stdlib/behavior/lasso-select.js +6 -4
- package/lib/stdlib/behavior/lasso-select.js.map +1 -1
- package/lib/stdlib/behavior/scroll-canvas.d.ts +67 -0
- package/lib/stdlib/behavior/scroll-canvas.js +270 -0
- package/lib/stdlib/behavior/scroll-canvas.js.map +1 -0
- package/lib/stdlib/behavior/shortcuts-call.d.ts +38 -0
- package/lib/stdlib/behavior/shortcuts-call.js +91 -0
- package/lib/stdlib/behavior/shortcuts-call.js.map +1 -0
- package/lib/stdlib/behavior/zoom-canvas-3d.js +4 -1
- package/lib/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
- package/lib/stdlib/behavior/zoom-canvas.d.ts +3 -1
- package/lib/stdlib/behavior/zoom-canvas.js +70 -26
- package/lib/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/lib/stdlib/data/index.d.ts +1 -0
- package/lib/stdlib/data/index.js +1 -0
- package/lib/stdlib/data/index.js.map +1 -1
- package/lib/stdlib/data/mapNodeSize.d.ts +4 -5
- package/lib/stdlib/data/mapNodeSize.js +13 -3
- package/lib/stdlib/data/mapNodeSize.js.map +1 -1
- package/lib/stdlib/data/processParallelEdges.d.ts +21 -0
- package/lib/stdlib/data/processParallelEdges.js +131 -0
- package/lib/stdlib/data/processParallelEdges.js.map +1 -0
- package/lib/stdlib/data/transformV4Data.d.ts +3 -4
- package/lib/stdlib/data/transformV4Data.js +11 -3
- package/lib/stdlib/data/transformV4Data.js.map +1 -1
- package/lib/stdlib/data/validateData.d.ts +4 -5
- package/lib/stdlib/data/validateData.js +23 -14
- package/lib/stdlib/data/validateData.js.map +1 -1
- package/lib/stdlib/index.d.ts +27 -8
- package/lib/stdlib/index.js +24 -11
- package/lib/stdlib/index.js.map +1 -1
- package/lib/stdlib/item/edge/base.d.ts +3 -5
- package/lib/stdlib/item/edge/base.js +30 -29
- package/lib/stdlib/item/edge/base.js.map +1 -1
- package/lib/stdlib/item/edge/cubic-horizontal.js.map +1 -1
- package/lib/stdlib/item/edge/cubic-vertical.js.map +1 -1
- package/lib/stdlib/item/edge/cubic.js +2 -2
- package/lib/stdlib/item/edge/cubic.js.map +1 -1
- package/lib/stdlib/item/edge/loop.js +3 -3
- package/lib/stdlib/item/edge/loop.js.map +1 -1
- package/lib/stdlib/item/node/base.d.ts +3 -6
- package/lib/stdlib/item/node/base.js +29 -59
- package/lib/stdlib/item/node/base.js.map +1 -1
- package/lib/stdlib/item/node/base3d.d.ts +1 -0
- package/lib/stdlib/item/node/base3d.js +1 -0
- package/lib/stdlib/item/node/base3d.js.map +1 -1
- package/lib/stdlib/item/node/cube.d.ts +35 -0
- package/lib/stdlib/item/node/cube.js +58 -0
- package/lib/stdlib/item/node/cube.js.map +1 -0
- package/lib/stdlib/item/node/diamond.js +1 -1
- package/lib/stdlib/item/node/ellipse.js +2 -2
- package/lib/stdlib/item/node/hexagon.js +6 -2
- package/lib/stdlib/item/node/hexagon.js.map +1 -1
- package/lib/stdlib/item/node/image.d.ts +40 -0
- package/lib/stdlib/item/node/image.js +114 -0
- package/lib/stdlib/item/node/image.js.map +1 -0
- package/lib/stdlib/item/node/index.d.ts +4 -0
- package/lib/stdlib/item/node/index.js +4 -0
- package/lib/stdlib/item/node/index.js.map +1 -1
- package/lib/stdlib/plugin/edgeFilterLens/index.d.ts +66 -0
- package/lib/stdlib/plugin/edgeFilterLens/index.js +313 -0
- package/lib/stdlib/plugin/edgeFilterLens/index.js.map +1 -0
- package/lib/stdlib/plugin/grid/index.d.ts +1 -1
- package/lib/stdlib/plugin/grid/index.js +6 -7
- package/lib/stdlib/plugin/grid/index.js.map +1 -1
- package/lib/stdlib/plugin/history/combo-command.js +2 -2
- package/lib/stdlib/plugin/history/combo-command.js.map +1 -1
- package/lib/stdlib/plugin/history/index.d.ts +10 -10
- package/lib/stdlib/plugin/history/index.js +14 -14
- package/lib/stdlib/plugin/history/index.js.map +1 -1
- package/lib/stdlib/plugin/history/item-data-command.js +25 -16
- package/lib/stdlib/plugin/history/item-data-command.js.map +1 -1
- package/lib/stdlib/plugin/history/layer-updated-command.js +2 -2
- package/lib/stdlib/plugin/history/layer-updated-command.js.map +1 -1
- package/lib/stdlib/plugin/history/state-updated-command.js +1 -1
- package/lib/stdlib/plugin/history/state-updated-command.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/convexHull.d.ts +1 -1
- package/lib/stdlib/plugin/hull/hullComponent.d.ts +1 -1
- package/lib/stdlib/plugin/hull/hullComponent.js +5 -9
- package/lib/stdlib/plugin/hull/hullComponent.js.map +1 -1
- package/lib/stdlib/plugin/hull/util.d.ts +2 -2
- package/lib/stdlib/plugin/hull/util.js +26 -22
- package/lib/stdlib/plugin/hull/util.js.map +1 -1
- package/lib/stdlib/plugin/index.d.ts +2 -0
- package/lib/stdlib/plugin/index.js +2 -0
- package/lib/stdlib/plugin/index.js.map +1 -1
- package/lib/stdlib/plugin/legend/index.d.ts +2 -2
- package/lib/stdlib/plugin/legend/index.js +3 -3
- package/lib/stdlib/plugin/legend/index.js.map +1 -1
- package/lib/stdlib/plugin/menu/index.d.ts +4 -4
- package/lib/stdlib/plugin/menu/index.js +6 -6
- package/lib/stdlib/plugin/menu/index.js.map +1 -1
- package/lib/stdlib/plugin/minimap/index.d.ts +6 -2
- package/lib/stdlib/plugin/minimap/index.js +121 -14
- package/lib/stdlib/plugin/minimap/index.js.map +1 -1
- package/lib/stdlib/plugin/snapline/index.d.ts +167 -0
- package/lib/stdlib/plugin/snapline/index.js +1067 -0
- package/lib/stdlib/plugin/snapline/index.js.map +1 -0
- package/lib/stdlib/plugin/timebar/index.js +2 -2
- package/lib/stdlib/plugin/timebar/index.js.map +1 -1
- package/lib/stdlib/plugin/toolbar/index.d.ts +3 -3
- package/lib/stdlib/plugin/toolbar/index.js +5 -5
- package/lib/stdlib/plugin/toolbar/index.js.map +1 -1
- package/lib/stdlib/plugin/tooltip/index.d.ts +4 -4
- package/lib/stdlib/plugin/tooltip/index.js +10 -11
- package/lib/stdlib/plugin/tooltip/index.js.map +1 -1
- package/lib/stdlib/plugin/types.d.ts +2 -0
- package/lib/stdlib/plugin/watermaker/index.d.ts +78 -0
- package/lib/stdlib/plugin/watermaker/index.js +247 -0
- package/lib/stdlib/plugin/watermaker/index.js.map +1 -0
- package/lib/stdlib/theme/dark.js +42 -2
- package/lib/stdlib/theme/dark.js.map +1 -1
- package/lib/stdlib/theme/light.js +4 -4
- package/lib/types/data.d.ts +5 -0
- package/lib/types/event.d.ts +1 -0
- package/lib/types/graph.d.ts +48 -22
- package/lib/types/hook.d.ts +22 -2
- package/lib/types/index.d.ts +2 -1
- package/lib/types/index.js +3 -1
- package/lib/types/index.js.map +1 -1
- package/lib/types/item.d.ts +7 -1
- package/lib/types/item.js.map +1 -1
- package/lib/types/plugin.d.ts +1 -1
- package/lib/types/spec.d.ts +20 -3
- package/lib/types/view.d.ts +5 -0
- package/lib/util/array.d.ts +1 -0
- package/lib/util/array.js +5 -1
- package/lib/util/array.js.map +1 -1
- package/lib/util/bbox.d.ts +16 -1
- package/lib/util/bbox.js +36 -6
- package/lib/util/bbox.js.map +1 -1
- package/lib/util/behavior.d.ts +2 -2
- package/lib/util/behavior.js +2 -2
- package/lib/util/behavior.js.map +1 -1
- package/lib/util/data.d.ts +5 -2
- package/lib/util/data.js +16 -1
- package/lib/util/data.js.map +1 -1
- package/lib/util/dom.d.ts +15 -0
- package/lib/util/dom.js +34 -0
- package/lib/util/dom.js.map +1 -0
- package/lib/util/event.d.ts +3 -1
- package/lib/util/event.js +8 -1
- package/lib/util/event.js.map +1 -1
- package/lib/util/extend.d.ts +1 -1
- package/lib/util/extend.js +0 -1
- package/lib/util/extend.js.map +1 -1
- package/lib/util/index.d.ts +7 -52
- package/lib/util/index.js +23 -23
- package/lib/util/index.js.map +1 -1
- package/lib/util/item.d.ts +16 -1
- package/lib/util/item.js +33 -9
- package/lib/util/item.js.map +1 -1
- package/lib/util/layout.d.ts +12 -1
- package/lib/util/layout.js +47 -1
- package/lib/util/layout.js.map +1 -1
- package/lib/util/loop.d.ts +2 -1
- package/lib/util/loop.js +15 -1
- package/lib/util/loop.js.map +1 -1
- package/lib/util/math.d.ts +1 -1
- package/lib/util/matrix.d.ts +6 -0
- package/lib/util/matrix.js +52 -0
- package/lib/util/matrix.js.map +1 -0
- package/lib/util/path.js +2 -2
- package/lib/util/path.js.map +1 -1
- package/lib/util/point.d.ts +1 -1
- package/lib/util/point.js +9 -2
- package/lib/util/point.js.map +1 -1
- package/lib/util/polyline.d.ts +2 -1
- package/lib/util/polyline.js +2 -1
- package/lib/util/polyline.js.map +1 -1
- package/lib/util/router.d.ts +1 -1
- package/lib/util/shape.d.ts +3 -3
- package/lib/util/shape.js +17 -26
- package/lib/util/shape.js.map +1 -1
- package/lib/util/shape3d.d.ts +1 -1
- package/lib/util/shape3d.js +15 -16
- package/lib/util/shape3d.js.map +1 -1
- package/lib/util/text.d.ts +1 -1
- package/lib/util/text.js +3 -2
- package/lib/util/text.js.map +1 -1
- package/lib/util/warn.d.ts +14 -0
- package/lib/util/warn.js +8 -0
- package/lib/util/warn.js.map +1 -0
- package/package.json +42 -51
- package/src/api-doc/graph.ts +4 -3
- package/src/api-doc/types.ts +1 -0
- package/src/constant/shape.ts +1 -1
- package/src/index.ts +5 -6
- package/src/item/combo.ts +16 -15
- package/src/item/edge.ts +135 -57
- package/src/item/item.ts +32 -19
- package/src/item/node.ts +36 -50
- package/src/runtime/controller/data.ts +371 -490
- package/src/runtime/controller/interaction.ts +10 -4
- package/src/runtime/controller/item.ts +261 -78
- package/src/runtime/controller/layout.ts +1 -5
- package/src/runtime/controller/plugin.ts +15 -4
- package/src/runtime/graph.ts +605 -103
- package/src/stdlib/behavior/activate-relations.ts +2 -2
- package/src/stdlib/behavior/brush-select.ts +14 -13
- package/src/stdlib/behavior/click-select.ts +1 -1
- package/src/stdlib/behavior/create-edge.ts +305 -0
- package/src/stdlib/behavior/drag-canvas.ts +107 -35
- package/src/stdlib/behavior/drag-combo.ts +10 -10
- package/src/stdlib/behavior/drag-node.ts +27 -18
- package/src/stdlib/behavior/index.ts +3 -0
- package/src/stdlib/behavior/lasso-select.ts +7 -5
- package/src/stdlib/behavior/scroll-canvas.ts +348 -0
- package/src/stdlib/behavior/shortcuts-call.ts +129 -0
- package/src/stdlib/behavior/zoom-canvas-3d.ts +4 -1
- package/src/stdlib/behavior/zoom-canvas.ts +98 -27
- package/src/stdlib/data/index.ts +1 -0
- package/src/stdlib/data/mapNodeSize.ts +22 -3
- package/src/stdlib/data/processParallelEdges.ts +203 -0
- package/src/stdlib/data/transformV4Data.ts +16 -3
- package/src/stdlib/data/validateData.ts +32 -18
- package/src/stdlib/index.ts +31 -8
- package/src/stdlib/item/edge/base.ts +32 -41
- package/src/stdlib/item/edge/cubic-horizontal.ts +0 -1
- package/src/stdlib/item/edge/cubic-vertical.ts +0 -1
- package/src/stdlib/item/edge/cubic.ts +1 -1
- package/src/stdlib/item/edge/loop.ts +1 -1
- package/src/stdlib/item/node/base.ts +38 -65
- package/src/stdlib/item/node/base3d.ts +1 -0
- package/src/stdlib/item/node/cube.ts +102 -0
- package/src/stdlib/item/node/diamond.ts +1 -1
- package/src/stdlib/item/node/ellipse.ts +2 -2
- package/src/stdlib/item/node/hexagon.ts +6 -2
- package/src/stdlib/item/node/image.ts +190 -0
- package/src/stdlib/item/node/index.ts +4 -0
- package/src/stdlib/plugin/edgeFilterLens/index.ts +387 -0
- package/src/stdlib/plugin/grid/index.ts +6 -6
- package/src/stdlib/plugin/history/combo-command.ts +2 -2
- package/src/stdlib/plugin/history/index.ts +14 -14
- package/src/stdlib/plugin/history/item-data-command.ts +35 -17
- package/src/stdlib/plugin/history/layer-updated-command.ts +2 -2
- package/src/stdlib/plugin/history/state-updated-command.ts +1 -1
- package/src/stdlib/plugin/history/visibility-updated-command.ts +2 -2
- package/src/stdlib/plugin/hull/convexHull.ts +1 -1
- package/src/stdlib/plugin/hull/hullComponent.ts +10 -8
- package/src/stdlib/plugin/hull/util.ts +6 -2
- package/src/stdlib/plugin/index.ts +2 -0
- package/src/stdlib/plugin/legend/index.ts +6 -6
- package/src/stdlib/plugin/menu/index.ts +13 -13
- package/src/stdlib/plugin/minimap/index.ts +126 -16
- package/src/stdlib/plugin/snapline/index.ts +1297 -0
- package/src/stdlib/plugin/timebar/index.ts +4 -4
- package/src/stdlib/plugin/toolbar/index.ts +8 -8
- package/src/stdlib/plugin/tooltip/index.ts +10 -10
- package/src/stdlib/plugin/types.ts +2 -0
- package/src/stdlib/plugin/watermaker/index.ts +302 -0
- package/src/stdlib/theme/dark.ts +66 -2
- package/src/stdlib/theme/light.ts +4 -4
- package/src/types/data.ts +6 -0
- package/src/types/event.ts +1 -0
- package/src/types/graph.ts +62 -25
- package/src/types/hook.ts +22 -2
- package/src/types/index.ts +2 -1
- package/src/types/item.ts +12 -1
- package/src/types/plugin.ts +1 -1
- package/src/types/spec.ts +23 -3
- package/src/types/view.ts +8 -3
- package/src/util/array.ts +12 -0
- package/src/util/bbox.ts +42 -6
- package/src/util/behavior.ts +4 -4
- package/src/util/data.ts +26 -4
- package/src/util/dom.ts +33 -0
- package/src/util/event.ts +14 -1
- package/src/util/extend.ts +2 -3
- package/src/util/index.ts +7 -24
- package/src/util/item.ts +65 -28
- package/src/util/layout.ts +48 -2
- package/src/util/loop.ts +16 -1
- package/src/util/math.ts +1 -1
- package/src/util/matrix.ts +66 -0
- package/src/util/path.ts +1 -1
- package/src/util/point.ts +9 -4
- package/src/util/polyline.ts +2 -1
- package/src/util/router.ts +1 -1
- package/src/util/shape.ts +23 -26
- package/src/util/shape3d.ts +20 -20
- package/src/util/text.ts +3 -1
- package/src/util/warn.ts +20 -0
|
@@ -27,6 +27,8 @@ const zoom_1 = require("../../util/zoom");
|
|
|
27
27
|
const data_1 = require("../../util/data");
|
|
28
28
|
const event_1 = require("../../util/event");
|
|
29
29
|
const polyline_1 = require("../../util/polyline");
|
|
30
|
+
const bbox_1 = require("../../util/bbox");
|
|
31
|
+
const type_1 = require("../../util/type");
|
|
30
32
|
/**
|
|
31
33
|
* Manages and stores the node / edge / combo items.
|
|
32
34
|
*/
|
|
@@ -45,11 +47,38 @@ class ItemController {
|
|
|
45
47
|
// The G shapes or groups on transient map drawn by this controller
|
|
46
48
|
this.transientObjectMap = new Map();
|
|
47
49
|
this.transientItemMap = new Map();
|
|
48
|
-
this.onViewportChange = (0, util_1.debounce)(({ transform, effectTiming }) => {
|
|
50
|
+
this.onViewportChange = (0, util_1.debounce)(({ transform, effectTiming, tileLodSize = 1000, }) => {
|
|
49
51
|
const { zoom } = transform;
|
|
50
52
|
if (zoom) {
|
|
51
53
|
const zoomRatio = this.graph.getZoom();
|
|
52
|
-
this.
|
|
54
|
+
const range = this.graph.getCanvasRange();
|
|
55
|
+
const nodeItems = Array.from(this.itemMap, ([key, value]) => value);
|
|
56
|
+
const itemsInViewport = [];
|
|
57
|
+
const itemsOutViewport = [];
|
|
58
|
+
nodeItems.forEach((item) => {
|
|
59
|
+
const { keyShape } = item.shapeMap;
|
|
60
|
+
if (!keyShape)
|
|
61
|
+
return;
|
|
62
|
+
const renderBounds = keyShape.getRenderBounds();
|
|
63
|
+
if ((0, bbox_1.isBBoxInBBox)(renderBounds, range, 0.4))
|
|
64
|
+
itemsInViewport.push(item);
|
|
65
|
+
else
|
|
66
|
+
itemsOutViewport.push(item);
|
|
67
|
+
});
|
|
68
|
+
const sortedItems = itemsInViewport.concat(itemsOutViewport);
|
|
69
|
+
const sections = Math.ceil(nodeItems.length / tileLodSize);
|
|
70
|
+
const itemSections = Array.from({ length: sections }, (v, i) => sortedItems.slice(i * tileLodSize, i * tileLodSize + tileLodSize));
|
|
71
|
+
let requestId;
|
|
72
|
+
const update = () => {
|
|
73
|
+
if (!itemSections.length) {
|
|
74
|
+
cancelAnimationFrame(requestId);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
itemSections.shift().forEach((item) => item.updateZoom(zoomRatio));
|
|
78
|
+
requestId = requestAnimationFrame(update);
|
|
79
|
+
};
|
|
80
|
+
requestId = requestAnimationFrame(update);
|
|
81
|
+
// this.itemMap.forEach((item) => item.updateZoom(zoomRatio));
|
|
53
82
|
this.zoom = zoomRatio;
|
|
54
83
|
}
|
|
55
84
|
}, 500, false);
|
|
@@ -70,6 +99,17 @@ class ItemController {
|
|
|
70
99
|
item.update(item.model, undefined, false, itemTheme);
|
|
71
100
|
});
|
|
72
101
|
};
|
|
102
|
+
this.onMapperChange = ({ type, mapper }) => {
|
|
103
|
+
if (!mapper)
|
|
104
|
+
return;
|
|
105
|
+
this.itemMap.forEach((item) => {
|
|
106
|
+
const itemTye = item.getType();
|
|
107
|
+
if (itemTye !== type)
|
|
108
|
+
return;
|
|
109
|
+
item.mapper = mapper;
|
|
110
|
+
item.update(item.model, undefined, false);
|
|
111
|
+
});
|
|
112
|
+
};
|
|
73
113
|
this.onDestroy = () => {
|
|
74
114
|
Object.values(this.itemMap).forEach((item) => item.destroy());
|
|
75
115
|
// Fix OOM problem, since this map will hold all the refs of items.
|
|
@@ -103,6 +143,7 @@ class ItemController {
|
|
|
103
143
|
this.graph.hooks.transientupdate.tap(this.onTransientUpdate.bind(this));
|
|
104
144
|
this.graph.hooks.viewportchange.tap(this.onViewportChange.bind(this));
|
|
105
145
|
this.graph.hooks.themechange.tap(this.onThemeChange.bind(this));
|
|
146
|
+
this.graph.hooks.mapperchange.tap(this.onMapperChange.bind(this));
|
|
106
147
|
this.graph.hooks.treecollapseexpand.tap(this.onTreeCollapseExpand.bind(this));
|
|
107
148
|
this.graph.hooks.destroy.tap(this.onDestroy.bind(this));
|
|
108
149
|
}
|
|
@@ -132,74 +173,92 @@ class ItemController {
|
|
|
132
173
|
* @param param contains inner data stored in graphCore structure
|
|
133
174
|
*/
|
|
134
175
|
onRender(param) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
transientCanvas.appendChild(this.transientEdgeGroup);
|
|
155
|
-
transientCanvas.appendChild(this.transientNodeGroup);
|
|
156
|
-
// 1. create lights for webgl 3d rendering
|
|
157
|
-
if (graph.rendererType === 'webgl-3d') {
|
|
158
|
-
const ambientLight = new g_plugin_3d_1.AmbientLight({
|
|
159
|
-
style: {
|
|
160
|
-
fill: 'white',
|
|
161
|
-
intensity: Math.PI * 2,
|
|
162
|
-
},
|
|
176
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
177
|
+
const { graphCore, theme = {}, transientCanvas, tileOptimize = {} } = param;
|
|
178
|
+
const { graph } = this;
|
|
179
|
+
// 0. clear groups on canvas, and create new groups
|
|
180
|
+
graph.canvas.removeChildren();
|
|
181
|
+
const comboGroup = new g_1.Group({ id: 'combo-group', style: { zIndex: 0 } });
|
|
182
|
+
const edgeGroup = new g_1.Group({ id: 'edge-group', style: { zIndex: 1 } });
|
|
183
|
+
const nodeGroup = new g_1.Group({ id: 'node-group', style: { zIndex: 2 } });
|
|
184
|
+
graph.canvas.appendChild(comboGroup);
|
|
185
|
+
graph.canvas.appendChild(edgeGroup);
|
|
186
|
+
graph.canvas.appendChild(nodeGroup);
|
|
187
|
+
this.nodeGroup = nodeGroup;
|
|
188
|
+
this.edgeGroup = edgeGroup;
|
|
189
|
+
this.comboGroup = comboGroup;
|
|
190
|
+
// Also create transient groups on transient canvas.
|
|
191
|
+
transientCanvas.removeChildren();
|
|
192
|
+
this.transientComboGroup = new g_1.Group({
|
|
193
|
+
id: 'combo-group',
|
|
194
|
+
style: { zIndex: 0 },
|
|
163
195
|
});
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
direction: [-1, 0, 1],
|
|
168
|
-
intensity: Math.PI * 0.7,
|
|
169
|
-
},
|
|
196
|
+
this.transientEdgeGroup = new g_1.Group({
|
|
197
|
+
id: 'edge-group',
|
|
198
|
+
style: { zIndex: 1 },
|
|
170
199
|
});
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
200
|
+
this.transientNodeGroup = new g_1.Group({
|
|
201
|
+
id: 'node-group',
|
|
202
|
+
style: { zIndex: 2 },
|
|
203
|
+
});
|
|
204
|
+
transientCanvas.appendChild(this.transientComboGroup);
|
|
205
|
+
transientCanvas.appendChild(this.transientEdgeGroup);
|
|
206
|
+
transientCanvas.appendChild(this.transientNodeGroup);
|
|
207
|
+
// 1. create lights for webgl 3d rendering
|
|
208
|
+
if (graph.rendererType === 'webgl-3d') {
|
|
209
|
+
const ambientLight = new g_plugin_3d_1.AmbientLight({
|
|
210
|
+
style: {
|
|
211
|
+
fill: 'white',
|
|
212
|
+
intensity: Math.PI * 2,
|
|
213
|
+
},
|
|
214
|
+
});
|
|
215
|
+
const light = new g_plugin_3d_1.DirectionalLight({
|
|
216
|
+
style: {
|
|
217
|
+
fill: 'white',
|
|
218
|
+
direction: [-1, 0, 1],
|
|
219
|
+
intensity: Math.PI * 0.7,
|
|
220
|
+
},
|
|
221
|
+
});
|
|
222
|
+
// @ts-ignore
|
|
223
|
+
graph.canvas.appendChild(ambientLight);
|
|
224
|
+
// @ts-ignore
|
|
225
|
+
graph.canvas.appendChild(light);
|
|
226
|
+
const { width, height } = graph.canvas.getConfig();
|
|
227
|
+
graph.canvas.getCamera().setPerspective(0.1, 50000, 45, width / height);
|
|
228
|
+
}
|
|
229
|
+
// 2. create node / edge / combo items, classes from ../../item, and element drawing and updating fns from node/edge/comboExtensions
|
|
230
|
+
const { nodes, edges, combos } = (0, data_1.deconstructData)({
|
|
231
|
+
nodes: graphCore.getAllNodes(),
|
|
232
|
+
edges: graphCore.getAllEdges(),
|
|
233
|
+
});
|
|
234
|
+
const renderNodesPromise = this.renderNodes(nodes, theme.node, tileOptimize);
|
|
235
|
+
let nodesInView;
|
|
236
|
+
if (renderNodesPromise) {
|
|
237
|
+
nodesInView = yield renderNodesPromise;
|
|
238
|
+
}
|
|
239
|
+
this.renderCombos(combos, theme.combo, graphCore);
|
|
240
|
+
const renderEdgesPromise = this.renderEdges(edges, theme.edge, tileOptimize, nodesInView);
|
|
241
|
+
if (renderEdgesPromise) {
|
|
242
|
+
yield renderEdgesPromise;
|
|
243
|
+
}
|
|
244
|
+
this.sortByComboTree(graphCore);
|
|
245
|
+
// collapse the combos which has 'collapsed' in initial data
|
|
246
|
+
if (graphCore.hasTreeStructure('combo')) {
|
|
247
|
+
(0, data_1.graphCoreTreeDfs)(graphCore, graphCore.getRoots('combo'), (child) => {
|
|
248
|
+
if (child.data.collapsed)
|
|
249
|
+
this.collapseCombo(graphCore, child);
|
|
250
|
+
}, 'BT', 'combo');
|
|
251
|
+
}
|
|
252
|
+
// collapse the sub tree which has 'collapsed' in initial data
|
|
253
|
+
if (graphCore.hasTreeStructure('tree')) {
|
|
254
|
+
const collapseNodes = [];
|
|
255
|
+
(0, data_1.graphCoreTreeDfs)(graphCore, graphCore.getRoots('tree'), (child) => {
|
|
256
|
+
if (child.data.collapsed)
|
|
257
|
+
collapseNodes.push(child);
|
|
258
|
+
}, 'BT', 'tree');
|
|
259
|
+
this.collapseSubTree(collapseNodes, graphCore, false);
|
|
260
|
+
}
|
|
182
261
|
});
|
|
183
|
-
this.renderNodes(nodes, theme.node);
|
|
184
|
-
this.renderCombos(combos, theme.combo, graphCore);
|
|
185
|
-
this.renderEdges(edges, theme.edge);
|
|
186
|
-
this.sortByComboTree(graphCore);
|
|
187
|
-
// collapse the combos which has 'collapsed' in initial data
|
|
188
|
-
if (graphCore.hasTreeStructure('combo')) {
|
|
189
|
-
(0, data_1.graphCoreTreeDfs)(graphCore, graphCore.getRoots('combo'), (child) => {
|
|
190
|
-
if (child.data.collapsed)
|
|
191
|
-
this.collapseCombo(graphCore, child);
|
|
192
|
-
}, 'BT', 'combo');
|
|
193
|
-
}
|
|
194
|
-
// collapse the sub tree which has 'collapsed' in initial data
|
|
195
|
-
if (graphCore.hasTreeStructure('tree')) {
|
|
196
|
-
const collapseNodes = [];
|
|
197
|
-
(0, data_1.graphCoreTreeDfs)(graphCore, graphCore.getRoots('tree'), (child) => {
|
|
198
|
-
if (child.data.collapsed)
|
|
199
|
-
collapseNodes.push(child);
|
|
200
|
-
}, 'BT', 'tree');
|
|
201
|
-
this.collapseSubTree(collapseNodes, graphCore, false);
|
|
202
|
-
}
|
|
203
262
|
}
|
|
204
263
|
/**
|
|
205
264
|
* Listener of runtime's itemchange lifecycle hook.
|
|
@@ -290,12 +349,12 @@ class ItemController {
|
|
|
290
349
|
return;
|
|
291
350
|
const type = item.getType();
|
|
292
351
|
const innerModel = graphCore.getNode(id);
|
|
293
|
-
if (onlyMove
|
|
294
|
-
|
|
295
|
-
isNaN(
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
352
|
+
if (type === 'node' && onlyMove) {
|
|
353
|
+
const { x, y, fx, fy } = current;
|
|
354
|
+
if (isNaN(x) && isNaN(y) && isNaN(fx) && isNaN(fy)) {
|
|
355
|
+
callback(innerModel, true);
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
299
358
|
}
|
|
300
359
|
const nodeRelatedIdsToUpdate = new Set();
|
|
301
360
|
// collapse and expand
|
|
@@ -374,12 +433,12 @@ class ItemController {
|
|
|
374
433
|
}
|
|
375
434
|
callback(innerModel, canceled);
|
|
376
435
|
}, 500, {
|
|
377
|
-
leading:
|
|
436
|
+
leading: true,
|
|
378
437
|
trailing: true,
|
|
379
438
|
}));
|
|
380
439
|
const parentItem = this.itemMap.get(current.parentId);
|
|
381
440
|
if (current.parentId && (parentItem === null || parentItem === void 0 ? void 0 : parentItem.model.data.collapsed)) {
|
|
382
|
-
this.graph.
|
|
441
|
+
this.graph.executeWithNoStack(() => {
|
|
383
442
|
this.graph.hideItem(innerModel.id, false);
|
|
384
443
|
});
|
|
385
444
|
}
|
|
@@ -485,7 +544,7 @@ class ItemController {
|
|
|
485
544
|
});
|
|
486
545
|
}
|
|
487
546
|
onItemVisibilityChange(param) {
|
|
488
|
-
const { ids, value, graphCore, animate = true } = param;
|
|
547
|
+
const { ids, value, graphCore, animate = true, keepKeyShape = false, } = param;
|
|
489
548
|
ids.forEach((id) => {
|
|
490
549
|
const item = this.itemMap.get(id);
|
|
491
550
|
if (!item) {
|
|
@@ -518,7 +577,7 @@ class ItemController {
|
|
|
518
577
|
}
|
|
519
578
|
}
|
|
520
579
|
else {
|
|
521
|
-
item.hide(animate);
|
|
580
|
+
item.hide(animate, keepKeyShape);
|
|
522
581
|
if (type !== 'edge') {
|
|
523
582
|
const relatedEdges = graphCore.getRelatedEdges(id);
|
|
524
583
|
relatedEdges.forEach(({ id: edgeId }) => {
|
|
@@ -558,9 +617,10 @@ class ItemController {
|
|
|
558
617
|
});
|
|
559
618
|
}
|
|
560
619
|
onTransientUpdate(param) {
|
|
620
|
+
var _a, _b;
|
|
561
621
|
const { transientObjectMap } = this;
|
|
562
622
|
const { type, id, config = {}, canvas, graphCore } = param;
|
|
563
|
-
const { style = {}, data = {}, capture, action,
|
|
623
|
+
const { style = {}, data = {}, capture, action, shapeIds, drawSource, drawTarget, upsertAncestors, visible = true, } = config;
|
|
564
624
|
const isItemType = type === 'node' || type === 'edge' || type === 'combo';
|
|
565
625
|
// Removing
|
|
566
626
|
if (action === 'remove') {
|
|
@@ -577,6 +637,9 @@ class ItemController {
|
|
|
577
637
|
}, 'BT');
|
|
578
638
|
}
|
|
579
639
|
if (transientItem && !transientItem.destroyed) {
|
|
640
|
+
if (!((_b = (_a = transientItem).getType) === null || _b === void 0 ? void 0 : _b.call(_a))) {
|
|
641
|
+
transientItem.remove();
|
|
642
|
+
}
|
|
580
643
|
transientItem.destroy();
|
|
581
644
|
}
|
|
582
645
|
this.transientItemMap.delete(id);
|
|
@@ -597,8 +660,8 @@ class ItemController {
|
|
|
597
660
|
console.warn(`Fail to draw transient item of ${id}, which is not exist.`);
|
|
598
661
|
return;
|
|
599
662
|
}
|
|
600
|
-
const transientItem = (0, item_1.upsertTransientItem)(item, this.transientNodeGroup, this.transientEdgeGroup, this.transientComboGroup, this.transientItemMap, this.itemMap, graphCore,
|
|
601
|
-
if (
|
|
663
|
+
const transientItem = (0, item_1.upsertTransientItem)(item, this.transientNodeGroup, this.transientEdgeGroup, this.transientComboGroup, this.transientItemMap, this.itemMap, graphCore, { shapeIds, drawSource, drawTarget, visible }, upsertAncestors);
|
|
664
|
+
if (shapeIds) {
|
|
602
665
|
// only update node positions to cloned node container(group)
|
|
603
666
|
if ((type === 'node' || type === 'combo') &&
|
|
604
667
|
data.hasOwnProperty('x') &&
|
|
@@ -647,7 +710,8 @@ class ItemController {
|
|
|
647
710
|
const shape = (0, shape_1.upsertShape)(type, idStr, style, Object.fromEntries(transientObjectMap));
|
|
648
711
|
transientObjectMap.set(idStr, shape);
|
|
649
712
|
shape.style.pointerEvents = capture ? 'auto' : 'none';
|
|
650
|
-
|
|
713
|
+
if (shape.parentNode === null)
|
|
714
|
+
canvas.getRoot().appendChild(shape);
|
|
651
715
|
}
|
|
652
716
|
getTransient(id) {
|
|
653
717
|
return this.transientObjectMap.get(id);
|
|
@@ -663,83 +727,130 @@ class ItemController {
|
|
|
663
727
|
* Create nodes with inner data to canvas.
|
|
664
728
|
* @param models nodes' inner datas
|
|
665
729
|
*/
|
|
666
|
-
renderNodes(models, nodeTheme = {}) {
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
const
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
:
|
|
688
|
-
|
|
730
|
+
renderNodes(models, nodeTheme = {}, tileOptimize) {
|
|
731
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
732
|
+
const { nodeExtensions, nodeGroup, nodeDataTypeSet, graph } = this;
|
|
733
|
+
const { dataTypeField = '' } = nodeTheme;
|
|
734
|
+
const { tileFirstRender, tileFirstRenderSize = 1000 } = tileOptimize || {};
|
|
735
|
+
const zoom = graph.getZoom();
|
|
736
|
+
const delayFirstDraw = (0, util_1.isNumber)(tileFirstRender)
|
|
737
|
+
? models.length > tileFirstRender
|
|
738
|
+
: tileFirstRender;
|
|
739
|
+
const itemsInView = [];
|
|
740
|
+
const itemsOutView = [];
|
|
741
|
+
const viewRange = this.graph.getCanvasRange();
|
|
742
|
+
models.forEach((node) => {
|
|
743
|
+
// get the base styles from theme
|
|
744
|
+
let dataType;
|
|
745
|
+
if (dataTypeField)
|
|
746
|
+
dataType = node.data[dataTypeField];
|
|
747
|
+
const itemTheme = getItemTheme(nodeDataTypeSet, dataTypeField, dataType, nodeTheme);
|
|
748
|
+
const nodeItem = new node_1.default({
|
|
749
|
+
delayFirstDraw,
|
|
750
|
+
model: node,
|
|
751
|
+
renderExtensions: nodeExtensions,
|
|
752
|
+
containerGroup: nodeGroup,
|
|
753
|
+
mapper: this.nodeMapper,
|
|
754
|
+
stateMapper: this.nodeStateMapper,
|
|
755
|
+
zoom,
|
|
756
|
+
theme: itemTheme,
|
|
757
|
+
device: graph.rendererType === 'webgl-3d'
|
|
758
|
+
? // TODO: G type
|
|
759
|
+
graph.canvas.context.deviceRendererPlugin.getDevice()
|
|
760
|
+
: undefined,
|
|
761
|
+
});
|
|
762
|
+
this.itemMap.set(node.id, nodeItem);
|
|
763
|
+
const { x, y } = nodeItem.model.data;
|
|
764
|
+
if (delayFirstDraw &&
|
|
765
|
+
(0, bbox_1.isPointInBBox)({ x: (0, type_1.convertToNumber)(x), y: (0, type_1.convertToNumber)(y) }, viewRange)) {
|
|
766
|
+
itemsInView.push(nodeItem);
|
|
767
|
+
}
|
|
768
|
+
else {
|
|
769
|
+
itemsOutView.push(nodeItem);
|
|
770
|
+
}
|
|
771
|
+
});
|
|
772
|
+
if (delayFirstDraw) {
|
|
773
|
+
let requestId;
|
|
774
|
+
const sectionNum = Math.ceil(itemsOutView.length / tileFirstRenderSize);
|
|
775
|
+
const sections = Array.from({ length: sectionNum }, (v, i) => itemsOutView.slice(i * tileFirstRenderSize, i * tileFirstRenderSize + tileFirstRenderSize));
|
|
776
|
+
sections.unshift(itemsInView);
|
|
777
|
+
const update = (resolve) => {
|
|
778
|
+
if (!sections.length) {
|
|
779
|
+
cancelAnimationFrame(requestId);
|
|
780
|
+
return resolve(itemsInView);
|
|
781
|
+
}
|
|
782
|
+
sections
|
|
783
|
+
.shift()
|
|
784
|
+
.forEach((item) => item.draw(item.displayModel, undefined, undefined, !item.displayModel.data.disableAnimate));
|
|
785
|
+
requestId = requestAnimationFrame(() => update(resolve));
|
|
786
|
+
};
|
|
787
|
+
return new Promise((resolve) => {
|
|
788
|
+
requestId = requestAnimationFrame(() => update(resolve));
|
|
789
|
+
});
|
|
790
|
+
}
|
|
689
791
|
});
|
|
690
792
|
}
|
|
691
793
|
renderCombos(models, comboTheme = {}, graphCore) {
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
.
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
const
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
794
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
795
|
+
const { comboExtensions, comboGroup, comboDataTypeSet, graph, itemMap } = this;
|
|
796
|
+
const { dataTypeField = '' } = comboTheme;
|
|
797
|
+
const zoom = graph.getZoom();
|
|
798
|
+
models.forEach((combo) => {
|
|
799
|
+
// get the base styles from theme
|
|
800
|
+
let dataType;
|
|
801
|
+
if (dataTypeField)
|
|
802
|
+
dataType = combo.data[dataTypeField];
|
|
803
|
+
const itemTheme = getItemTheme(comboDataTypeSet, dataTypeField, dataType, comboTheme);
|
|
804
|
+
const getCombinedBounds = () => {
|
|
805
|
+
// calculate the position of the combo according to its children
|
|
806
|
+
return (0, shape_1.getCombinedBoundsByData)(graph, graphCore
|
|
807
|
+
.getChildren(combo.id, 'combo')
|
|
808
|
+
.map(({ id }) => itemMap.get(id))
|
|
809
|
+
.filter(Boolean));
|
|
810
|
+
};
|
|
811
|
+
const getChildren = () => {
|
|
812
|
+
const childModels = graphCore.getChildren(combo.id, 'combo');
|
|
813
|
+
return childModels.map(({ id }) => itemMap.get(id));
|
|
814
|
+
};
|
|
815
|
+
const comboItem = new combo_1.default({
|
|
816
|
+
model: combo,
|
|
817
|
+
getCombinedBounds,
|
|
818
|
+
getChildren,
|
|
819
|
+
renderExtensions: comboExtensions,
|
|
820
|
+
containerGroup: comboGroup,
|
|
821
|
+
mapper: this.comboMapper,
|
|
822
|
+
stateMapper: this.comboStateMapper,
|
|
823
|
+
zoom,
|
|
824
|
+
theme: itemTheme,
|
|
825
|
+
device: graph.rendererType === 'webgl-3d'
|
|
826
|
+
? graph.canvas.context.deviceRendererPlugin.getDevice()
|
|
827
|
+
: undefined,
|
|
828
|
+
});
|
|
829
|
+
// ------- for integration tests -------
|
|
830
|
+
comboItem.getCombinedBounds = getCombinedBounds;
|
|
831
|
+
comboItem.getChildren = getChildren;
|
|
832
|
+
comboItem.type = 'combo';
|
|
833
|
+
// ------- for integration tests end-------
|
|
834
|
+
itemMap.set(combo.id, comboItem);
|
|
725
835
|
});
|
|
726
|
-
// ------- for integration tests -------
|
|
727
|
-
comboItem.getCombinedBounds = getCombinedBounds;
|
|
728
|
-
comboItem.getChildren = getChildren;
|
|
729
|
-
comboItem.type = 'combo';
|
|
730
|
-
// ------- for integration tests end-------
|
|
731
|
-
itemMap.set(combo.id, comboItem);
|
|
732
836
|
});
|
|
733
837
|
}
|
|
734
838
|
/**
|
|
735
839
|
* Create edges with inner data to canvas.
|
|
736
840
|
* @param models edges' inner datas
|
|
737
841
|
*/
|
|
738
|
-
renderEdges(models, edgeTheme = {}) {
|
|
842
|
+
renderEdges(models, edgeTheme = {}, tileOptimize, nodesInView) {
|
|
739
843
|
const { edgeExtensions, edgeGroup, itemMap, edgeDataTypeSet, graph } = this;
|
|
740
844
|
const { dataTypeField = '' } = edgeTheme;
|
|
845
|
+
const { tileFirstRender, tileFirstRenderSize = 1000 } = tileOptimize || {};
|
|
741
846
|
const zoom = graph.getZoom();
|
|
742
847
|
const nodeMap = filterItemMapByType(itemMap, 'node');
|
|
848
|
+
const delayFirstDraw = (0, util_1.isNumber)(tileFirstRender)
|
|
849
|
+
? models.length > tileFirstRender
|
|
850
|
+
: tileFirstRender;
|
|
851
|
+
const nodesInViewIds = new Set(nodesInView === null || nodesInView === void 0 ? void 0 : nodesInView.map((node) => node.getID()));
|
|
852
|
+
const edgesInView = [];
|
|
853
|
+
const edgesOutView = [];
|
|
743
854
|
models.forEach((edge) => {
|
|
744
855
|
const { source, target, id } = edge;
|
|
745
856
|
const sourceItem = itemMap.get(source);
|
|
@@ -757,7 +868,8 @@ class ItemController {
|
|
|
757
868
|
if (dataTypeField)
|
|
758
869
|
dataType = edge.data[dataTypeField];
|
|
759
870
|
const itemTheme = getItemTheme(edgeDataTypeSet, dataTypeField, dataType, edgeTheme);
|
|
760
|
-
|
|
871
|
+
const edgeItem = new edge_1.default({
|
|
872
|
+
delayFirstDraw,
|
|
761
873
|
model: edge,
|
|
762
874
|
renderExtensions: edgeExtensions,
|
|
763
875
|
containerGroup: edgeGroup,
|
|
@@ -768,8 +880,31 @@ class ItemController {
|
|
|
768
880
|
nodeMap,
|
|
769
881
|
zoom,
|
|
770
882
|
theme: itemTheme,
|
|
771
|
-
})
|
|
883
|
+
});
|
|
884
|
+
itemMap.set(id, edgeItem);
|
|
885
|
+
if (nodesInViewIds.has(source) || nodesInViewIds.has(target))
|
|
886
|
+
edgesInView.push(edgeItem);
|
|
887
|
+
else
|
|
888
|
+
edgesOutView.push(edgeItem);
|
|
889
|
+
return edgeItem;
|
|
772
890
|
});
|
|
891
|
+
if (delayFirstDraw) {
|
|
892
|
+
let requestId;
|
|
893
|
+
const sectionNum = Math.ceil(edgesOutView.length / tileFirstRenderSize);
|
|
894
|
+
const sections = Array.from({ length: sectionNum }, (v, i) => edgesOutView.slice(i * tileFirstRenderSize, i * tileFirstRenderSize + tileFirstRenderSize));
|
|
895
|
+
sections.unshift(edgesInView);
|
|
896
|
+
const update = (resolve) => {
|
|
897
|
+
if (!sections.length) {
|
|
898
|
+
cancelAnimationFrame(requestId);
|
|
899
|
+
return resolve();
|
|
900
|
+
}
|
|
901
|
+
sections.shift().forEach((item) => item.draw(item.displayModel));
|
|
902
|
+
requestId = requestAnimationFrame(() => update(resolve));
|
|
903
|
+
};
|
|
904
|
+
return new Promise((resolve) => {
|
|
905
|
+
requestId = requestAnimationFrame(() => update(resolve));
|
|
906
|
+
});
|
|
907
|
+
}
|
|
773
908
|
}
|
|
774
909
|
/**
|
|
775
910
|
* Get the id of the item which have the state with true value
|
|
@@ -886,7 +1021,7 @@ class ItemController {
|
|
|
886
1021
|
// find the succeeds in collapsed
|
|
887
1022
|
(0, data_1.graphComboTreeDfs)(this.graph, [comboModel], (child) => {
|
|
888
1023
|
if (child.id !== comboModel.id) {
|
|
889
|
-
this.graph.
|
|
1024
|
+
this.graph.executeWithNoStack(() => {
|
|
890
1025
|
this.graph.hideItem(child.id, false);
|
|
891
1026
|
});
|
|
892
1027
|
}
|
|
@@ -908,7 +1043,7 @@ class ItemController {
|
|
|
908
1043
|
pairs.push({ source, target });
|
|
909
1044
|
});
|
|
910
1045
|
// each item in groupedEdges is a virtual edge
|
|
911
|
-
this.graph.
|
|
1046
|
+
this.graph.executeWithNoStack(() => {
|
|
912
1047
|
this.graph.addData('edge', groupVirtualEdges(pairs));
|
|
913
1048
|
});
|
|
914
1049
|
}
|
|
@@ -982,7 +1117,7 @@ class ItemController {
|
|
|
982
1117
|
return false;
|
|
983
1118
|
}));
|
|
984
1119
|
// remove related virtual edges
|
|
985
|
-
this.graph.
|
|
1120
|
+
this.graph.executeWithNoStack(() => {
|
|
986
1121
|
this.graph.removeData('edge', (0, util_1.uniq)(relatedVirtualEdgeIds));
|
|
987
1122
|
this.graph.showItem(edgesToShow.concat(nodesToShow));
|
|
988
1123
|
// add virtual edges by grouping visible ancestor edges
|