@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
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { parsePathString } from '@antv/path-util';
|
|
2
1
|
import { DisplayObject } from '@antv/g';
|
|
3
2
|
import { isArray } from '@antv/util';
|
|
4
3
|
import { ComboModel, ID, IGraph, NodeModel } from '../../../types';
|
|
@@ -51,7 +50,8 @@ interface HullComponentFullOptions extends HullComponentOptions {
|
|
|
51
50
|
export default class Hull {
|
|
52
51
|
graph: IGraph;
|
|
53
52
|
|
|
54
|
-
|
|
53
|
+
// TODO: PathArray is not exported by @antv/util 2.x but by 3.x. Correct the type String | PathArray after upgrading @antv/util
|
|
54
|
+
path: any;
|
|
55
55
|
|
|
56
56
|
members: (NodeModel | ComboModel)[];
|
|
57
57
|
|
|
@@ -140,7 +140,7 @@ export default class Hull {
|
|
|
140
140
|
contour.map((p) => [p.x, p.y]),
|
|
141
141
|
this.padding,
|
|
142
142
|
);
|
|
143
|
-
path =
|
|
143
|
+
path = hull;
|
|
144
144
|
break;
|
|
145
145
|
case 'smooth-convex':
|
|
146
146
|
contour = genConvexHull(members);
|
|
@@ -149,7 +149,7 @@ export default class Hull {
|
|
|
149
149
|
contour.map((p) => [p.x, p.y]),
|
|
150
150
|
this.padding,
|
|
151
151
|
);
|
|
152
|
-
path =
|
|
152
|
+
path = hull;
|
|
153
153
|
} else if (contour.length > 2) {
|
|
154
154
|
hull = paddedHull(
|
|
155
155
|
contour.map((p) => [p.x, p.y]),
|
|
@@ -172,9 +172,9 @@ export default class Hull {
|
|
|
172
172
|
const shape = this.graph.drawTransient('path', this.options.id, {
|
|
173
173
|
style: {
|
|
174
174
|
path: this.path,
|
|
175
|
+
pointerEvents: 'none',
|
|
175
176
|
...this.options.style,
|
|
176
177
|
},
|
|
177
|
-
capture: false,
|
|
178
178
|
});
|
|
179
179
|
const { labelShape } = this.options;
|
|
180
180
|
if (labelShape?.text) {
|
|
@@ -183,10 +183,10 @@ export default class Hull {
|
|
|
183
183
|
const formattedLabelStyle = this.getLabelStyle(labelShape, shapeBounds);
|
|
184
184
|
this.graph.drawTransient('text', `${this.options.id}-label`, {
|
|
185
185
|
style: {
|
|
186
|
+
pointerEvents: 'none',
|
|
186
187
|
...labelShapeStyle,
|
|
187
188
|
...formattedLabelStyle,
|
|
188
189
|
},
|
|
189
|
-
capture: false,
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
192
|
shape.toBack();
|
|
@@ -426,8 +426,10 @@ export default class Hull {
|
|
|
426
426
|
|
|
427
427
|
public updateStyle(style: ShapeStyle) {
|
|
428
428
|
this.graph.drawTransient('path', this.options.id, {
|
|
429
|
-
style
|
|
430
|
-
|
|
429
|
+
style: {
|
|
430
|
+
...style,
|
|
431
|
+
pointerEvents: 'none',
|
|
432
|
+
},
|
|
431
433
|
});
|
|
432
434
|
}
|
|
433
435
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { vec2 } from '
|
|
1
|
+
import { vec2 } from 'gl-matrix';
|
|
2
2
|
import { ID, IGraph } from 'types';
|
|
3
3
|
import { AABB } from '@antv/g';
|
|
4
4
|
import { Bounds, Point } from '../../../types/common';
|
|
@@ -56,7 +56,11 @@ export function roundedHull(polyPoints: vec2[], padding: number) {
|
|
|
56
56
|
const p1 = [points[0][0], points[0][1] - padding];
|
|
57
57
|
const p2 = [points[0][0], points[0][1] + padding];
|
|
58
58
|
|
|
59
|
-
return
|
|
59
|
+
return [
|
|
60
|
+
['M', p1],
|
|
61
|
+
['A', padding, padding, 0, 0, 0, p2],
|
|
62
|
+
['A', padding, padding, 0, 0, 0, p1],
|
|
63
|
+
];
|
|
60
64
|
};
|
|
61
65
|
|
|
62
66
|
// The rounded hull path around two points
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Category } from '@antv/gui';
|
|
2
2
|
import { Canvas, DisplayObject, Circle, Line } from '@antv/g';
|
|
3
3
|
import { isFunction, isString, upperFirst, uniqueId } from '@antv/util';
|
|
4
|
-
import { createDom } from '@antv/dom-util';
|
|
5
4
|
import { ID } from '@antv/graphlib';
|
|
6
5
|
import { IGraph } from '../../../types';
|
|
7
6
|
import { RendererName } from '../../../types/render';
|
|
8
7
|
import { Plugin as Base, IPluginBaseConfig } from '../../../types/plugin';
|
|
9
8
|
import { createCanvas } from '../../../util/canvas';
|
|
10
9
|
import { ShapeTagMap, formatPadding } from '../../../util/shape';
|
|
10
|
+
import { createDOM } from '../../../util/dom';
|
|
11
11
|
|
|
12
12
|
const LEGEND_CATEGORY_ITEM_MARKER = '.legend-category-item-marker';
|
|
13
13
|
|
|
@@ -51,7 +51,7 @@ export interface LegendConfig extends IPluginBaseConfig {
|
|
|
51
51
|
/**
|
|
52
52
|
* Container for the legend, using graph's container by default
|
|
53
53
|
*/
|
|
54
|
-
container?:
|
|
54
|
+
container?: HTMLElement | string;
|
|
55
55
|
/**
|
|
56
56
|
* Renderer for the legend canvas, 'canvas' by default
|
|
57
57
|
*/
|
|
@@ -102,7 +102,7 @@ export class Legend extends Base {
|
|
|
102
102
|
*/
|
|
103
103
|
private edgeLegend: Category;
|
|
104
104
|
|
|
105
|
-
private wrapper:
|
|
105
|
+
private wrapper: HTMLElement;
|
|
106
106
|
private canvas: Canvas;
|
|
107
107
|
|
|
108
108
|
private size: ('fit-content' | number)[];
|
|
@@ -303,7 +303,7 @@ export class Legend extends Base {
|
|
|
303
303
|
|
|
304
304
|
/**
|
|
305
305
|
* Creates a wrapper div element for the graph and appends it to the container.
|
|
306
|
-
* @returns {
|
|
306
|
+
* @returns {HTMLElement} - The created wrapper div element.
|
|
307
307
|
*/
|
|
308
308
|
private createWrapper() {
|
|
309
309
|
const { options, graph, size } = this;
|
|
@@ -322,9 +322,9 @@ export class Legend extends Base {
|
|
|
322
322
|
size[0] === 'fit-content' ? 0 : size[0],
|
|
323
323
|
size[1] === 'fit-content' ? 0 : size[1],
|
|
324
324
|
];
|
|
325
|
-
const wrapper = (
|
|
325
|
+
const wrapper = createDOM(
|
|
326
326
|
`<div class='${className}' style='width: ${wrapperSize[0]}px; height: ${wrapperSize[1]}px; overflow: hidden;'></div>`,
|
|
327
|
-
)
|
|
327
|
+
);
|
|
328
328
|
$container.appendChild(wrapper);
|
|
329
329
|
return wrapper;
|
|
330
330
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { createDom, modifyCSS } from '@antv/dom-util';
|
|
2
|
-
import { AABB } from '@antv/g';
|
|
3
1
|
import { isString, uniqueId } from '@antv/util';
|
|
4
2
|
import insertCss from 'insert-css';
|
|
5
3
|
import Item from '../../../item/item';
|
|
4
|
+
import { createDOM, modifyCSS } from '../../../util/dom';
|
|
6
5
|
import { IGraph } from '../../../types';
|
|
7
6
|
import { IG6GraphEvent } from '../../../types/event';
|
|
8
7
|
import { Plugin as Base, IPluginBaseConfig } from '../../../types/plugin';
|
|
8
|
+
|
|
9
9
|
typeof document !== 'undefined' &&
|
|
10
10
|
insertCss(`
|
|
11
11
|
.g6-component-contextmenu {
|
|
@@ -39,14 +39,14 @@ typeof document !== 'undefined' &&
|
|
|
39
39
|
* The `MenuConfig` interface contains the following properties:
|
|
40
40
|
|
|
41
41
|
- `handleMenuClick`: An optional function for handling menu click events. It takes two arguments: `target` (of type HTMLElement) and `item` (of type Item), and has no return value.
|
|
42
|
-
- `getContent`: An optional function for getting the content of the menu. It takes an optional argument of type `IG6GraphEvent`, and returns a value of type
|
|
42
|
+
- `getContent`: An optional function for getting the content of the menu. It takes an optional argument of type `IG6GraphEvent`, and returns a value of type HTMLElement, string, or Promise (resolving to HTMLElement or string).
|
|
43
43
|
- `offsetX`: An optional number representing the offset of the menu in the X direction.
|
|
44
44
|
- `offsetY`: An optional number representing the offset of the menu in the Y direction.
|
|
45
45
|
- `shouldBegin`: An optional function for determining whether the menu should be displayed. It takes an optional argument of type `IG6GraphEvent`, and returns a boolean value.
|
|
46
46
|
- `itemTypes`: An optional array of strings representing the types of items for which the menu is allowed to be displayed.
|
|
47
47
|
- `trigger`: An optional string, either 'click' or 'contextmenu', representing the event type that triggers the display of the menu.
|
|
48
48
|
- `onHide`: An optional function to be executed when the menu is hidden. It takes no arguments and returns a boolean value.
|
|
49
|
-
- `loadingContent`: An optional
|
|
49
|
+
- `loadingContent`: An optional HTMLElement or string representing the loading DOM.
|
|
50
50
|
- `liHoverStyle`: An optional object representing the style of li elements when hovered over. It can contain any number of key-value pairs, where the key is a style name and the value is a string.
|
|
51
51
|
*/
|
|
52
52
|
export interface MenuConfig extends IPluginBaseConfig {
|
|
@@ -54,7 +54,7 @@ export interface MenuConfig extends IPluginBaseConfig {
|
|
|
54
54
|
// return the content of menu, support the `Promise` type return value.
|
|
55
55
|
getContent?: (
|
|
56
56
|
evt?: IG6GraphEvent,
|
|
57
|
-
) =>
|
|
57
|
+
) => HTMLElement | string | Promise<HTMLElement | string>;
|
|
58
58
|
offsetX?: number;
|
|
59
59
|
offsetY?: number;
|
|
60
60
|
shouldBegin?: (evt?: IG6GraphEvent) => boolean;
|
|
@@ -62,7 +62,7 @@ export interface MenuConfig extends IPluginBaseConfig {
|
|
|
62
62
|
trigger?: 'click' | 'contextmenu';
|
|
63
63
|
onHide?: () => boolean;
|
|
64
64
|
//loading Dom
|
|
65
|
-
loadingContent?:
|
|
65
|
+
loadingContent?: HTMLElement | string;
|
|
66
66
|
liHoverStyle?: { [key: string]: string };
|
|
67
67
|
}
|
|
68
68
|
|
|
@@ -126,16 +126,16 @@ export class Menu extends Base {
|
|
|
126
126
|
.join('')}
|
|
127
127
|
}
|
|
128
128
|
`);
|
|
129
|
-
const menu =
|
|
129
|
+
const menu = createDOM(
|
|
130
130
|
`<div class=${className || 'g6-component-contextmenu'}></div>`,
|
|
131
131
|
);
|
|
132
132
|
modifyCSS(menu, { top: '0px', position: 'absolute', visibility: 'hidden' });
|
|
133
|
-
let container:
|
|
133
|
+
let container: HTMLElement | null | string = this.options.container;
|
|
134
134
|
if (!container) {
|
|
135
|
-
container = this.graph.container as
|
|
135
|
+
container = this.graph.container as HTMLElement;
|
|
136
136
|
}
|
|
137
137
|
if (isString(container)) {
|
|
138
|
-
container = document.getElementById(container) as
|
|
138
|
+
container = document.getElementById(container) as HTMLElement;
|
|
139
139
|
}
|
|
140
140
|
container.appendChild(menu);
|
|
141
141
|
this.menu = menu;
|
|
@@ -189,7 +189,7 @@ export class Menu extends Base {
|
|
|
189
189
|
if (isString(menu)) {
|
|
190
190
|
//the type is string
|
|
191
191
|
menuDom.innerHTML = menu;
|
|
192
|
-
} else if (menu instanceof
|
|
192
|
+
} else if (menu instanceof HTMLElement) {
|
|
193
193
|
//the type is htmldom
|
|
194
194
|
menuDom.innerHTML = menu.outerHTML;
|
|
195
195
|
} else {
|
|
@@ -264,10 +264,10 @@ export class Menu extends Base {
|
|
|
264
264
|
if (menu) {
|
|
265
265
|
let container = this.options.container;
|
|
266
266
|
if (!container) {
|
|
267
|
-
container = this.graph.container as
|
|
267
|
+
container = this.graph.container as HTMLElement;
|
|
268
268
|
}
|
|
269
269
|
if (isString(container)) {
|
|
270
|
-
container = document.getElementById(container) as
|
|
270
|
+
container = document.getElementById(container) as HTMLElement;
|
|
271
271
|
}
|
|
272
272
|
container.removeChild(menu);
|
|
273
273
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// TODO: update type define.
|
|
2
2
|
// @ts-nocheck
|
|
3
|
-
import { createDom, modifyCSS } from '@antv/dom-util';
|
|
4
3
|
import { Canvas, DisplayObject, Group, Rect } from '@antv/g';
|
|
5
4
|
import { debounce, each, isNil, isString, uniqueId } from '@antv/util';
|
|
6
5
|
import { IGraph } from '../../../types';
|
|
@@ -8,6 +7,7 @@ import { IG6GraphEvent } from '../../../types/event';
|
|
|
8
7
|
import { ShapeStyle } from '../../../types/item';
|
|
9
8
|
import { Plugin as Base, IPluginBaseConfig } from '../../../types/plugin';
|
|
10
9
|
import { createCanvas } from '../../../util/canvas';
|
|
10
|
+
import { createDOM, modifyCSS } from '../../../util/dom';
|
|
11
11
|
|
|
12
12
|
const DEFAULT_MODE = 'default';
|
|
13
13
|
const KEYSHAPE_MODE = 'keyShape';
|
|
@@ -32,7 +32,7 @@ export interface MiniMapConfig extends IPluginBaseConfig {
|
|
|
32
32
|
/** Whether to hide edges on minimap to enhance performance */
|
|
33
33
|
hideEdge?: boolean;
|
|
34
34
|
/** Container for minimap */
|
|
35
|
-
container?:
|
|
35
|
+
container?: HTMLElement | null;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export class Minimap extends Base {
|
|
@@ -47,13 +47,15 @@ export class Minimap extends Base {
|
|
|
47
47
|
graphItem: DisplayObject;
|
|
48
48
|
}
|
|
49
49
|
> = new Map();
|
|
50
|
-
private container:
|
|
50
|
+
private container: HTMLElement;
|
|
51
51
|
/** Ratio of (minimap graph size / main graph size). */
|
|
52
52
|
private ratio: number;
|
|
53
53
|
/** Distance from top of minimap graph to the top of minimap container. */
|
|
54
54
|
private dx: number;
|
|
55
55
|
/** Distance from left of minimap graph to the left of minimap container. */
|
|
56
56
|
private dy: number;
|
|
57
|
+
/** Cache the visibility while items' visibility changed. And apply them onto the minimap with debounce. */
|
|
58
|
+
private visibleCache: { [id: string]: boolean } = {};
|
|
57
59
|
|
|
58
60
|
constructor(options?: MiniMapConfig) {
|
|
59
61
|
super(options);
|
|
@@ -80,11 +82,11 @@ export class Minimap extends Base {
|
|
|
80
82
|
|
|
81
83
|
public getEvents() {
|
|
82
84
|
return {
|
|
83
|
-
afterupdateitem: this.handleUpdateCanvas,
|
|
84
85
|
afteritemstatechange: this.handleUpdateCanvas,
|
|
85
86
|
afterlayout: this.handleUpdateCanvas,
|
|
86
87
|
viewportchange: this.handleUpdateCanvas,
|
|
87
88
|
afteritemchange: this.handleUpdateCanvas,
|
|
89
|
+
afteritemvisibilitychange: this.handleVisibilityChange,
|
|
88
90
|
};
|
|
89
91
|
}
|
|
90
92
|
|
|
@@ -109,18 +111,18 @@ export class Minimap extends Base {
|
|
|
109
111
|
const containerDOM = canvas.context.config.container as HTMLElement;
|
|
110
112
|
const isFireFox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
|
111
113
|
const isSafari = navigator.userAgent.toLowerCase().indexOf('safari') > -1;
|
|
112
|
-
const viewport =
|
|
114
|
+
const viewport = createDOM(`
|
|
113
115
|
<div
|
|
114
116
|
class=${viewportClassName}
|
|
115
117
|
style='position:absolute;
|
|
116
118
|
left:0;
|
|
117
119
|
top:0;
|
|
118
|
-
box-sizing:border-box;
|
|
119
120
|
border: 2px solid #1980ff;
|
|
121
|
+
box-sizing:border-box;
|
|
120
122
|
background: rgba(0, 0, 255, 0.1);
|
|
121
123
|
cursor:move'
|
|
122
124
|
draggable=${isSafari || isFireFox ? false : true}
|
|
123
|
-
|
|
125
|
+
/>`);
|
|
124
126
|
|
|
125
127
|
// Last mouse x position
|
|
126
128
|
let x = 0;
|
|
@@ -128,11 +130,25 @@ export class Minimap extends Base {
|
|
|
128
130
|
let y = 0;
|
|
129
131
|
// Whether in dragging status
|
|
130
132
|
let dragging = false;
|
|
133
|
+
let resizing = false;
|
|
131
134
|
|
|
132
135
|
const dragstartevent = isSafari || isFireFox ? 'mousedown' : 'dragstart';
|
|
136
|
+
this.container.addEventListener('mousemove', (e) => {
|
|
137
|
+
const moveAtBorder = getMoveAtBorder(viewport, e);
|
|
138
|
+
if (moveAtBorder) {
|
|
139
|
+
this.container.style.cursor = cursorMap[moveAtBorder];
|
|
140
|
+
viewport.style.cursor = cursorMap[moveAtBorder];
|
|
141
|
+
} else {
|
|
142
|
+
this.container.style.cursor = 'unset';
|
|
143
|
+
viewport.style.cursor = 'move';
|
|
144
|
+
}
|
|
145
|
+
});
|
|
133
146
|
viewport.addEventListener(
|
|
134
147
|
dragstartevent,
|
|
135
148
|
((e: IG6GraphEvent) => {
|
|
149
|
+
resizing = getMoveAtBorder(viewport, e);
|
|
150
|
+
if (resizing) return;
|
|
151
|
+
|
|
136
152
|
if ((e as any).dataTransfer) {
|
|
137
153
|
const img = new Image();
|
|
138
154
|
img.src =
|
|
@@ -159,6 +175,30 @@ export class Minimap extends Base {
|
|
|
159
175
|
);
|
|
160
176
|
|
|
161
177
|
const dragListener = (e: IG6GraphEvent) => {
|
|
178
|
+
const { style } = viewport;
|
|
179
|
+
const left = parseInt(style.left, 10);
|
|
180
|
+
const top = parseInt(style.top, 10);
|
|
181
|
+
const width = parseInt(style.width, 10);
|
|
182
|
+
const height = parseInt(style.height, 10);
|
|
183
|
+
|
|
184
|
+
if (resizing) {
|
|
185
|
+
const { clientX, clientY } = e;
|
|
186
|
+
const afterResize = { left, top, width, height };
|
|
187
|
+
if (resizing.includes('left')) {
|
|
188
|
+
afterResize.left = `${clientX}px`;
|
|
189
|
+
afterResize.width = `${left + width - clientX}px`;
|
|
190
|
+
} else if (resizing.includes('right')) {
|
|
191
|
+
afterResize.width = `${clientX - left}px`;
|
|
192
|
+
}
|
|
193
|
+
if (resizing.includes('top')) {
|
|
194
|
+
afterResize.top = `${clientY}`;
|
|
195
|
+
afterResize.height = `${top + height - clientY}`;
|
|
196
|
+
} else if (resizing.includes('bottom')) {
|
|
197
|
+
afterResize.height = `${clientY - top}`;
|
|
198
|
+
}
|
|
199
|
+
modifyCSS(viewport, afterResize);
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
162
202
|
if (!dragging || isNil(e.clientX) || isNil(e.clientY)) {
|
|
163
203
|
return;
|
|
164
204
|
}
|
|
@@ -168,12 +208,6 @@ export class Minimap extends Base {
|
|
|
168
208
|
let dx = x - e.clientX;
|
|
169
209
|
let dy = y - e.clientY;
|
|
170
210
|
|
|
171
|
-
const { style } = viewport;
|
|
172
|
-
const left = parseInt(style.left, 10);
|
|
173
|
-
const top = parseInt(style.top, 10);
|
|
174
|
-
const width = parseInt(style.width, 10);
|
|
175
|
-
const height = parseInt(style.height, 10);
|
|
176
|
-
|
|
177
211
|
// If the viewport is already on the left or right, stop moving x.
|
|
178
212
|
if (left - dx < 0 || left - dx + width >= size[0]) {
|
|
179
213
|
dx = 0;
|
|
@@ -201,6 +235,7 @@ export class Minimap extends Base {
|
|
|
201
235
|
|
|
202
236
|
const dragendListener = () => {
|
|
203
237
|
dragging = false;
|
|
238
|
+
resizing = false;
|
|
204
239
|
this.options.refresh = true;
|
|
205
240
|
};
|
|
206
241
|
const dragendevent = isSafari || isFireFox ? 'mouseup' : 'dragend';
|
|
@@ -467,8 +502,12 @@ export class Minimap extends Base {
|
|
|
467
502
|
if (!graphEdgeGroup) return;
|
|
468
503
|
let { minimapItem, graphItem } = itemMap.get(edgeModel.id) || {};
|
|
469
504
|
if (minimapItem && !minimapItem.destroyed) {
|
|
470
|
-
const path = graphItem.style
|
|
505
|
+
const { path, x1, x2, y1, y2 } = graphItem.style;
|
|
471
506
|
minimapItem.style.path = path;
|
|
507
|
+
minimapItem.style.x1 = x1;
|
|
508
|
+
minimapItem.style.x2 = x2;
|
|
509
|
+
minimapItem.style.y1 = y1;
|
|
510
|
+
minimapItem.style.y2 = y2;
|
|
472
511
|
} else {
|
|
473
512
|
graphItem = graphEdgeGroup
|
|
474
513
|
.find((ele) => ele.getAttribute('data-item-id') === edgeModel.id)
|
|
@@ -549,6 +588,36 @@ export class Minimap extends Base {
|
|
|
549
588
|
false,
|
|
550
589
|
);
|
|
551
590
|
|
|
591
|
+
private handleVisibilityChange = (params) => {
|
|
592
|
+
const { ids, value } = params;
|
|
593
|
+
ids.forEach((id) => {
|
|
594
|
+
this.visibleCache[id] = value;
|
|
595
|
+
});
|
|
596
|
+
this.debounceCloneVisibility();
|
|
597
|
+
};
|
|
598
|
+
|
|
599
|
+
private debounceCloneVisibility = debounce(
|
|
600
|
+
() => {
|
|
601
|
+
const nodeGroup = this.canvas.getRoot().getElementById('node-group');
|
|
602
|
+
const edgeGroup = this.canvas.getRoot().getElementById('edge-group');
|
|
603
|
+
(nodeGroup?.childNodes || [])
|
|
604
|
+
.concat(edgeGroup?.childNodes || [])
|
|
605
|
+
.forEach((child) => {
|
|
606
|
+
const id = child.getAttribute?.('data-item-id');
|
|
607
|
+
if (this.visibleCache.hasOwnProperty(id)) {
|
|
608
|
+
if (this.visibleCache[id]) {
|
|
609
|
+
child.childNodes.forEach((shape) => shape.show());
|
|
610
|
+
} else if (this.visibleCache[id] === false) {
|
|
611
|
+
child.childNodes.forEach((shape) => shape.hide());
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
this.visibleCache = {};
|
|
616
|
+
},
|
|
617
|
+
50,
|
|
618
|
+
false,
|
|
619
|
+
);
|
|
620
|
+
|
|
552
621
|
public init(graph: IGraph) {
|
|
553
622
|
super.init(graph);
|
|
554
623
|
const promise = this.initContainer();
|
|
@@ -562,12 +631,12 @@ export class Minimap extends Base {
|
|
|
562
631
|
const { graph, options } = this;
|
|
563
632
|
const { size, className } = options;
|
|
564
633
|
let parentNode = options.container;
|
|
565
|
-
const container:
|
|
634
|
+
const container: HTMLElement = createDOM(
|
|
566
635
|
`<div class='${className}' style='width: ${size[0]}px; height: ${size[1]}px; overflow: hidden;'></div>`,
|
|
567
636
|
);
|
|
568
637
|
|
|
569
638
|
if (isString(parentNode)) {
|
|
570
|
-
parentNode = document.getElementById(parentNode) as
|
|
639
|
+
parentNode = document.getElementById(parentNode) as HTMLElement;
|
|
571
640
|
}
|
|
572
641
|
|
|
573
642
|
if (parentNode) {
|
|
@@ -696,3 +765,44 @@ export class Minimap extends Base {
|
|
|
696
765
|
if (container?.parentNode) container.parentNode.removeChild(container);
|
|
697
766
|
}
|
|
698
767
|
}
|
|
768
|
+
|
|
769
|
+
const getMoveAtBorder = (dom, evt) => {
|
|
770
|
+
const bounds = dom.getBoundingClientRect();
|
|
771
|
+
const { clientX, clientY } = evt;
|
|
772
|
+
if (Math.abs(clientX - bounds.x) < 4 && Math.abs(clientY - bounds.y) < 4) {
|
|
773
|
+
return 'left-top';
|
|
774
|
+
} else if (
|
|
775
|
+
Math.abs(clientX - bounds.x) < 4 &&
|
|
776
|
+
Math.abs(clientY - bounds.y - bounds.height) < 4
|
|
777
|
+
) {
|
|
778
|
+
return 'left-bottom';
|
|
779
|
+
} else if (
|
|
780
|
+
Math.abs(clientX - bounds.x - bounds.width) < 4 &&
|
|
781
|
+
Math.abs(clientY - bounds.y) < 4
|
|
782
|
+
) {
|
|
783
|
+
return 'right-top';
|
|
784
|
+
} else if (
|
|
785
|
+
Math.abs(clientX - bounds.x - bounds.width) < 4 &&
|
|
786
|
+
Math.abs(clientY - bounds.y - bounds.height) < 4
|
|
787
|
+
) {
|
|
788
|
+
return 'right-bottom';
|
|
789
|
+
} else if (Math.abs(clientX - bounds.x) < 4) {
|
|
790
|
+
return 'left';
|
|
791
|
+
} else if (Math.abs(clientY - bounds.y) < 4) {
|
|
792
|
+
return 'top';
|
|
793
|
+
} else if (Math.abs(clientY - bounds.y - bounds.height) < 4) {
|
|
794
|
+
return 'bottom';
|
|
795
|
+
}
|
|
796
|
+
return false;
|
|
797
|
+
};
|
|
798
|
+
|
|
799
|
+
const cursorMap = {
|
|
800
|
+
'left-top': 'nwse-resize',
|
|
801
|
+
'right-bottom': 'nwse-resize',
|
|
802
|
+
'right-top': 'nesw-resize',
|
|
803
|
+
'left-bottom': 'nesw-resize',
|
|
804
|
+
left: 'ew-resize',
|
|
805
|
+
right: 'ew-resize',
|
|
806
|
+
top: 'ns-resize',
|
|
807
|
+
bottom: 'ns-resize',
|
|
808
|
+
};
|