@antv/g6 5.0.0-beta.0 → 5.0.0-beta.10
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/item.d.ts +2 -0
- package/esm/api-doc/item.js +2 -0
- package/esm/api-doc/item.js.map +1 -1
- package/esm/constant/shape.d.ts +4 -1
- package/esm/constant/shape.js.map +1 -1
- package/esm/index.d.ts +22 -7
- package/esm/index.js +3 -2
- package/esm/index.js.map +1 -1
- package/esm/item/combo.d.ts +1 -1
- package/esm/item/combo.js +16 -9
- package/esm/item/combo.js.map +1 -1
- package/esm/item/edge.d.ts +20 -3
- package/esm/item/edge.js +99 -43
- package/esm/item/edge.js.map +1 -1
- package/esm/item/item.d.ts +3 -2
- package/esm/item/item.js +21 -11
- package/esm/item/item.js.map +1 -1
- package/esm/item/node.d.ts +2 -1
- package/esm/item/node.js +33 -16
- package/esm/item/node.js.map +1 -1
- package/esm/runtime/controller/data.d.ts +7 -10
- package/esm/runtime/controller/data.js +127 -283
- package/esm/runtime/controller/data.js.map +1 -1
- package/esm/runtime/controller/item.d.ts +1 -0
- package/esm/runtime/controller/item.js +267 -151
- package/esm/runtime/controller/item.js.map +1 -1
- package/esm/runtime/controller/plugin.js +3 -3
- package/esm/runtime/controller/plugin.js.map +1 -1
- package/esm/runtime/graph.d.ts +103 -23
- package/esm/runtime/graph.js +460 -88
- package/esm/runtime/graph.js.map +1 -1
- package/esm/stdlib/behavior/activate-relations.d.ts +9 -9
- package/esm/stdlib/behavior/activate-relations.js +8 -8
- package/esm/stdlib/behavior/activate-relations.js.map +1 -1
- package/esm/stdlib/behavior/brush-select.js +1 -2
- 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 +207 -0
- package/esm/stdlib/behavior/create-edge.js.map +1 -0
- package/esm/stdlib/behavior/drag-canvas.d.ts +2 -1
- package/esm/stdlib/behavior/drag-canvas.js +57 -26
- 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 +76 -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 +1 -2
- 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 +80 -0
- package/esm/stdlib/behavior/shortcuts-call.js.map +1 -0
- package/esm/stdlib/behavior/zoom-canvas.d.ts +2 -1
- package/esm/stdlib/behavior/zoom-canvas.js +55 -24
- package/esm/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/esm/stdlib/data/mapNodeSize.d.ts +2 -2
- package/esm/stdlib/data/mapNodeSize.js +2 -2
- package/esm/stdlib/data/mapNodeSize.js.map +1 -1
- package/esm/stdlib/data/transformV4Data.d.ts +2 -2
- package/esm/stdlib/data/transformV4Data.js +2 -2
- package/esm/stdlib/data/transformV4Data.js.map +1 -1
- package/esm/stdlib/data/validateData.d.ts +2 -2
- package/esm/stdlib/data/validateData.js +16 -11
- package/esm/stdlib/data/validateData.js.map +1 -1
- package/esm/stdlib/index.d.ts +16 -6
- package/esm/stdlib/index.js +20 -10
- package/esm/stdlib/index.js.map +1 -1
- package/esm/stdlib/item/edge/base.d.ts +96 -6
- package/esm/stdlib/item/edge/base.js +92 -19
- package/esm/stdlib/item/edge/base.js.map +1 -1
- package/esm/stdlib/item/edge/line.js +5 -2
- package/esm/stdlib/item/edge/line.js.map +1 -1
- package/esm/stdlib/item/edge/polyline.d.ts +3 -2
- package/esm/stdlib/item/edge/polyline.js +3 -3
- package/esm/stdlib/item/edge/polyline.js.map +1 -1
- package/esm/stdlib/item/node/base.d.ts +90 -16
- package/esm/stdlib/item/node/base.js +91 -41
- package/esm/stdlib/item/node/base.js.map +1 -1
- package/esm/stdlib/item/node/base3d.d.ts +24 -0
- package/esm/stdlib/item/node/base3d.js +24 -8
- package/esm/stdlib/item/node/base3d.js.map +1 -1
- 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 +12 -5
- 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 +1 -0
- package/esm/stdlib/item/node/index.js +1 -0
- package/esm/stdlib/item/node/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/hullComponent.d.ts +1 -1
- package/esm/stdlib/plugin/hull/hullComponent.js +3 -6
- package/esm/stdlib/plugin/hull/hullComponent.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.js +5 -3
- package/esm/stdlib/plugin/legend/index.js.map +1 -1
- package/esm/stdlib/plugin/map/index.d.ts +118 -0
- package/esm/stdlib/plugin/map/index.js +683 -0
- package/esm/stdlib/plugin/map/index.js.map +1 -0
- package/esm/stdlib/plugin/minimap/index.d.ts +5 -1
- package/esm/stdlib/plugin/minimap/index.js +116 -9
- 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.d.ts +98 -0
- package/esm/stdlib/plugin/timebar/index.js +303 -0
- package/esm/stdlib/plugin/timebar/index.js.map +1 -0
- package/esm/stdlib/plugin/toolbar/index.js +1 -1
- package/esm/stdlib/plugin/toolbar/index.js.map +1 -1
- package/esm/stdlib/plugin/types.d.ts +2 -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/common.d.ts +1 -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/item.d.ts +6 -0
- package/esm/types/item.js.map +1 -1
- package/esm/types/spec.d.ts +20 -4
- package/esm/types/view.d.ts +5 -0
- package/esm/util/bbox.d.ts +16 -1
- package/esm/util/bbox.js +29 -0
- package/esm/util/bbox.js.map +1 -1
- package/esm/util/canvas.d.ts +2 -2
- package/esm/util/canvas.js +5 -11
- package/esm/util/canvas.js.map +1 -1
- 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/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 +11 -0
- package/esm/util/layout.js +45 -0
- package/esm/util/layout.js.map +1 -1
- package/esm/util/point.js +9 -2
- package/esm/util/point.js.map +1 -1
- package/esm/util/router.d.ts +4 -3
- package/esm/util/router.js +8 -5
- package/esm/util/router.js.map +1 -1
- package/esm/util/shape.d.ts +3 -3
- package/esm/util/shape.js +8 -12
- package/esm/util/shape.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/item.d.ts +2 -0
- package/lib/api-doc/item.js +5 -1
- package/lib/api-doc/item.js.map +1 -1
- package/lib/constant/shape.d.ts +4 -1
- package/lib/constant/shape.js.map +1 -1
- package/lib/index.d.ts +22 -7
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/item/combo.d.ts +1 -1
- package/lib/item/combo.js +16 -9
- package/lib/item/combo.js.map +1 -1
- package/lib/item/edge.d.ts +20 -3
- package/lib/item/edge.js +98 -42
- package/lib/item/edge.js.map +1 -1
- package/lib/item/item.d.ts +3 -2
- package/lib/item/item.js +21 -11
- package/lib/item/item.js.map +1 -1
- package/lib/item/node.d.ts +2 -1
- package/lib/item/node.js +33 -16
- package/lib/item/node.js.map +1 -1
- package/lib/runtime/controller/data.d.ts +7 -10
- package/lib/runtime/controller/data.js +127 -283
- package/lib/runtime/controller/data.js.map +1 -1
- package/lib/runtime/controller/item.d.ts +1 -0
- package/lib/runtime/controller/item.js +266 -150
- package/lib/runtime/controller/item.js.map +1 -1
- package/lib/runtime/controller/plugin.js +3 -3
- package/lib/runtime/controller/plugin.js.map +1 -1
- package/lib/runtime/graph.d.ts +103 -23
- package/lib/runtime/graph.js +460 -88
- package/lib/runtime/graph.js.map +1 -1
- package/lib/stdlib/behavior/activate-relations.d.ts +9 -9
- package/lib/stdlib/behavior/activate-relations.js +8 -8
- package/lib/stdlib/behavior/activate-relations.js.map +1 -1
- package/lib/stdlib/behavior/brush-select.js +1 -2
- 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 +211 -0
- package/lib/stdlib/behavior/create-edge.js.map +1 -0
- package/lib/stdlib/behavior/drag-canvas.d.ts +2 -1
- package/lib/stdlib/behavior/drag-canvas.js +57 -26
- 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 +76 -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 +1 -2
- 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 +84 -0
- package/lib/stdlib/behavior/shortcuts-call.js.map +1 -0
- package/lib/stdlib/behavior/zoom-canvas.d.ts +2 -1
- package/lib/stdlib/behavior/zoom-canvas.js +55 -24
- package/lib/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/lib/stdlib/data/mapNodeSize.d.ts +2 -2
- package/lib/stdlib/data/mapNodeSize.js +2 -2
- package/lib/stdlib/data/mapNodeSize.js.map +1 -1
- package/lib/stdlib/data/transformV4Data.d.ts +2 -2
- package/lib/stdlib/data/transformV4Data.js +2 -2
- package/lib/stdlib/data/transformV4Data.js.map +1 -1
- package/lib/stdlib/data/validateData.d.ts +2 -2
- package/lib/stdlib/data/validateData.js +16 -11
- package/lib/stdlib/data/validateData.js.map +1 -1
- package/lib/stdlib/index.d.ts +16 -6
- package/lib/stdlib/index.js +20 -10
- package/lib/stdlib/index.js.map +1 -1
- package/lib/stdlib/item/edge/base.d.ts +96 -6
- package/lib/stdlib/item/edge/base.js +92 -19
- package/lib/stdlib/item/edge/base.js.map +1 -1
- package/lib/stdlib/item/edge/line.js +5 -2
- package/lib/stdlib/item/edge/line.js.map +1 -1
- package/lib/stdlib/item/edge/polyline.d.ts +3 -2
- package/lib/stdlib/item/edge/polyline.js +3 -3
- package/lib/stdlib/item/edge/polyline.js.map +1 -1
- package/lib/stdlib/item/node/base.d.ts +90 -16
- package/lib/stdlib/item/node/base.js +91 -41
- package/lib/stdlib/item/node/base.js.map +1 -1
- package/lib/stdlib/item/node/base3d.d.ts +24 -0
- package/lib/stdlib/item/node/base3d.js +24 -8
- package/lib/stdlib/item/node/base3d.js.map +1 -1
- 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 +12 -5
- 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 +1 -0
- package/lib/stdlib/item/node/index.js +1 -0
- package/lib/stdlib/item/node/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/hullComponent.d.ts +1 -1
- package/lib/stdlib/plugin/hull/hullComponent.js +3 -6
- package/lib/stdlib/plugin/hull/hullComponent.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.js +5 -3
- package/lib/stdlib/plugin/legend/index.js.map +1 -1
- package/lib/stdlib/plugin/map/index.d.ts +118 -0
- package/lib/stdlib/plugin/map/index.js +687 -0
- package/lib/stdlib/plugin/map/index.js.map +1 -0
- package/lib/stdlib/plugin/minimap/index.d.ts +5 -1
- package/lib/stdlib/plugin/minimap/index.js +116 -9
- 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.d.ts +98 -0
- package/lib/stdlib/plugin/timebar/index.js +307 -0
- package/lib/stdlib/plugin/timebar/index.js.map +1 -0
- package/lib/stdlib/plugin/toolbar/index.js +1 -1
- package/lib/stdlib/plugin/toolbar/index.js.map +1 -1
- package/lib/stdlib/plugin/types.d.ts +2 -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/common.d.ts +1 -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/item.d.ts +6 -0
- package/lib/types/item.js.map +1 -1
- package/lib/types/spec.d.ts +20 -4
- package/lib/types/view.d.ts +5 -0
- package/lib/util/bbox.d.ts +16 -1
- package/lib/util/bbox.js +32 -1
- package/lib/util/bbox.js.map +1 -1
- package/lib/util/canvas.d.ts +2 -2
- package/lib/util/canvas.js +5 -11
- package/lib/util/canvas.js.map +1 -1
- 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/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 +11 -0
- package/lib/util/layout.js +47 -1
- package/lib/util/layout.js.map +1 -1
- package/lib/util/point.js +9 -2
- package/lib/util/point.js.map +1 -1
- package/lib/util/router.d.ts +4 -3
- package/lib/util/router.js +8 -5
- package/lib/util/router.js.map +1 -1
- package/lib/util/shape.d.ts +3 -3
- package/lib/util/shape.js +8 -12
- package/lib/util/shape.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 +10 -10
- package/src/api-doc/item.ts +2 -0
- package/src/constant/shape.ts +2 -1
- package/src/index.ts +4 -2
- package/src/item/combo.ts +14 -9
- package/src/item/edge.ts +131 -57
- package/src/item/item.ts +24 -15
- package/src/item/node.ts +38 -24
- package/src/runtime/controller/data.ts +142 -341
- package/src/runtime/controller/item.ts +236 -72
- package/src/runtime/controller/plugin.ts +15 -3
- package/src/runtime/graph.ts +592 -96
- package/src/stdlib/behavior/activate-relations.ts +8 -8
- package/src/stdlib/behavior/brush-select.ts +4 -2
- package/src/stdlib/behavior/click-select.ts +1 -1
- package/src/stdlib/behavior/create-edge.ts +296 -0
- package/src/stdlib/behavior/drag-canvas.ts +76 -27
- package/src/stdlib/behavior/drag-combo.ts +10 -10
- package/src/stdlib/behavior/drag-node.ts +18 -18
- package/src/stdlib/behavior/index.ts +3 -0
- package/src/stdlib/behavior/lasso-select.ts +5 -3
- package/src/stdlib/behavior/scroll-canvas.ts +348 -0
- package/src/stdlib/behavior/shortcuts-call.ts +120 -0
- package/src/stdlib/behavior/zoom-canvas.ts +72 -25
- package/src/stdlib/data/mapNodeSize.ts +2 -2
- package/src/stdlib/data/transformV4Data.ts +2 -2
- package/src/stdlib/data/validateData.ts +16 -11
- package/src/stdlib/index.ts +33 -9
- package/src/stdlib/item/edge/base.ts +118 -19
- package/src/stdlib/item/edge/line.ts +8 -2
- package/src/stdlib/item/edge/polyline.ts +7 -5
- package/src/stdlib/item/node/base.ts +117 -46
- package/src/stdlib/item/node/base3d.ts +24 -9
- 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 +14 -6
- package/src/stdlib/item/node/image.ts +190 -0
- package/src/stdlib/item/node/index.ts +1 -0
- 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/hullComponent.ts +8 -5
- package/src/stdlib/plugin/index.ts +2 -0
- package/src/stdlib/plugin/legend/index.ts +5 -4
- package/src/stdlib/plugin/map/index.ts +808 -0
- package/src/stdlib/plugin/minimap/index.ts +120 -10
- package/src/stdlib/plugin/snapline/index.ts +1297 -0
- package/src/stdlib/plugin/timebar/index.ts +473 -0
- package/src/stdlib/plugin/toolbar/index.ts +1 -1
- package/src/stdlib/plugin/types.ts +2 -0
- package/src/stdlib/theme/dark.ts +66 -2
- package/src/stdlib/theme/light.ts +4 -4
- package/src/types/common.ts +1 -0
- package/src/types/event.ts +1 -0
- package/src/types/graph.ts +59 -25
- package/src/types/hook.ts +22 -2
- package/src/types/item.ts +10 -0
- package/src/types/spec.ts +23 -4
- package/src/types/view.ts +8 -3
- package/src/util/bbox.ts +38 -1
- package/src/util/canvas.ts +5 -5
- package/src/util/event.ts +14 -1
- package/src/util/item.ts +65 -28
- package/src/util/layout.ts +45 -0
- package/src/util/point.ts +8 -3
- package/src/util/router.ts +15 -6
- package/src/util/shape.ts +16 -14
- package/src/util/warn.ts +20 -0
- package/src/api-doc/readme.md +0 -59
|
@@ -54,6 +54,8 @@ export class Minimap extends Base {
|
|
|
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
|
|
|
@@ -115,12 +117,12 @@ export class Minimap extends Base {
|
|
|
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();
|
|
@@ -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
|
+
};
|