@antv/g6 5.0.0-alpha.8 → 5.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/g6.min.js +6 -19
- package/esm/api-doc/behaviors.d.ts +2 -0
- package/esm/api-doc/behaviors.js +2 -0
- package/esm/api-doc/behaviors.js.map +1 -0
- package/esm/api-doc/graph.d.ts +4 -0
- package/esm/api-doc/graph.js +4 -0
- package/esm/api-doc/graph.js.map +1 -0
- package/esm/api-doc/item.d.ts +9 -0
- package/esm/api-doc/item.js +3 -0
- package/esm/api-doc/item.js.map +1 -0
- package/esm/api-doc/layout.d.ts +1 -0
- package/esm/api-doc/layout.js +2 -0
- package/esm/api-doc/layout.js.map +1 -0
- package/esm/api-doc/plugins.d.ts +1 -0
- package/esm/api-doc/plugins.js +2 -0
- package/esm/api-doc/plugins.js.map +1 -0
- package/esm/api-doc/types.d.ts +0 -0
- package/esm/api-doc/types.js +3 -0
- package/esm/api-doc/types.js.map +1 -0
- package/esm/api-doc/util.d.ts +3 -0
- package/esm/api-doc/util.js +4 -0
- package/esm/api-doc/util.js.map +1 -0
- package/esm/constant/shape.d.ts +7 -14
- package/esm/constant/shape.js +1 -0
- package/esm/constant/shape.js.map +1 -1
- package/esm/index.d.ts +215 -95
- package/esm/index.js +11 -4
- package/esm/index.js.map +1 -1
- package/esm/item/combo.d.ts +79 -2
- package/esm/item/combo.js +186 -2
- package/esm/item/combo.js.map +1 -1
- package/esm/item/edge.d.ts +15 -12
- package/esm/item/edge.js +40 -14
- package/esm/item/edge.js.map +1 -1
- package/esm/item/item.d.ts +12 -10
- package/esm/item/item.js +155 -83
- package/esm/item/item.js.map +1 -1
- package/esm/item/node.d.ts +32 -23
- package/esm/item/node.js +70 -49
- package/esm/item/node.js.map +1 -1
- package/esm/runtime/controller/data.d.ts +28 -4
- package/esm/runtime/controller/data.js +562 -173
- package/esm/runtime/controller/data.js.map +1 -1
- package/esm/runtime/controller/interaction.d.ts +1 -0
- package/esm/runtime/controller/interaction.js +23 -8
- package/esm/runtime/controller/interaction.js.map +1 -1
- package/esm/runtime/controller/item.d.ts +47 -5
- package/esm/runtime/controller/item.js +712 -122
- package/esm/runtime/controller/item.js.map +1 -1
- package/esm/runtime/controller/layout.d.ts +4 -1
- package/esm/runtime/controller/layout.js +109 -13
- package/esm/runtime/controller/layout.js.map +1 -1
- package/esm/runtime/controller/plugin.d.ts +11 -0
- package/esm/runtime/controller/plugin.js +39 -6
- package/esm/runtime/controller/plugin.js.map +1 -1
- package/esm/runtime/controller/theme.js +8 -4
- package/esm/runtime/controller/theme.js.map +1 -1
- package/esm/runtime/graph.d.ts +226 -47
- package/esm/runtime/graph.js +710 -90
- package/esm/runtime/graph.js.map +1 -1
- package/esm/stdlib/behavior/activate-relations.d.ts +2 -3
- package/esm/stdlib/behavior/activate-relations.js +13 -9
- package/esm/stdlib/behavior/activate-relations.js.map +1 -1
- package/esm/stdlib/behavior/brush-select.d.ts +3 -4
- package/esm/stdlib/behavior/brush-select.js +2 -2
- package/esm/stdlib/behavior/brush-select.js.map +1 -1
- package/esm/stdlib/behavior/click-select.d.ts +5 -3
- package/esm/stdlib/behavior/click-select.js +21 -7
- package/esm/stdlib/behavior/click-select.js.map +1 -1
- package/esm/stdlib/behavior/collapse-expand-combo.d.ts +28 -0
- package/esm/stdlib/behavior/collapse-expand-combo.js +35 -0
- package/esm/stdlib/behavior/collapse-expand-combo.js.map +1 -0
- package/esm/stdlib/behavior/collapse-expand-tree.d.ts +44 -0
- package/esm/stdlib/behavior/collapse-expand-tree.js +69 -0
- package/esm/stdlib/behavior/collapse-expand-tree.js.map +1 -0
- package/esm/stdlib/behavior/drag-canvas.d.ts +1 -2
- package/esm/stdlib/behavior/drag-canvas.js +15 -11
- package/esm/stdlib/behavior/drag-canvas.js.map +1 -1
- package/esm/stdlib/behavior/drag-combo.d.ts +111 -0
- package/esm/stdlib/behavior/drag-combo.js +380 -0
- package/esm/stdlib/behavior/drag-combo.js.map +1 -0
- package/esm/stdlib/behavior/drag-node.d.ts +33 -13
- package/esm/stdlib/behavior/drag-node.js +252 -67
- package/esm/stdlib/behavior/drag-node.js.map +1 -1
- package/esm/stdlib/behavior/hover-activate.d.ts +2 -1
- package/esm/stdlib/behavior/hover-activate.js +2 -0
- package/esm/stdlib/behavior/hover-activate.js.map +1 -1
- package/esm/stdlib/behavior/index.d.ts +15 -0
- package/esm/stdlib/behavior/index.js +16 -0
- package/esm/stdlib/behavior/index.js.map +1 -0
- package/esm/stdlib/behavior/lasso-select.d.ts +7 -3
- package/esm/stdlib/behavior/lasso-select.js +2 -2
- package/esm/stdlib/behavior/lasso-select.js.map +1 -1
- package/esm/stdlib/behavior/orbit-canvas-3d.d.ts +2 -3
- package/esm/stdlib/behavior/orbit-canvas-3d.js +2 -2
- package/esm/stdlib/behavior/orbit-canvas-3d.js.map +1 -1
- package/esm/stdlib/behavior/rotate-canvas-3d.d.ts +1 -2
- package/esm/stdlib/behavior/rotate-canvas-3d.js +1 -1
- package/esm/stdlib/behavior/rotate-canvas-3d.js.map +1 -1
- package/esm/stdlib/behavior/track-canvas-3d.d.ts +2 -3
- package/esm/stdlib/behavior/track-canvas-3d.js +2 -2
- package/esm/stdlib/behavior/track-canvas-3d.js.map +1 -1
- package/esm/stdlib/behavior/types.d.ts +13 -0
- package/esm/stdlib/behavior/types.js +2 -0
- package/esm/stdlib/behavior/types.js.map +1 -0
- package/esm/stdlib/behavior/zoom-canvas-3d.d.ts +1 -2
- package/esm/stdlib/behavior/zoom-canvas-3d.js +7 -7
- package/esm/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
- package/esm/stdlib/behavior/zoom-canvas.d.ts +1 -2
- package/esm/stdlib/behavior/zoom-canvas.js +20 -18
- package/esm/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/esm/stdlib/data/index.d.ts +3 -0
- package/esm/stdlib/data/index.js +4 -0
- package/esm/stdlib/data/index.js.map +1 -0
- package/esm/stdlib/data/mapNodeSize.d.ts +12 -0
- package/esm/stdlib/data/mapNodeSize.js +43 -0
- package/esm/stdlib/data/mapNodeSize.js.map +1 -0
- package/esm/stdlib/data/transformV4Data.d.ts +9 -0
- package/esm/stdlib/data/transformV4Data.js +142 -0
- package/esm/stdlib/data/transformV4Data.js.map +1 -0
- package/esm/stdlib/data/validateData.d.ts +9 -0
- package/esm/stdlib/data/validateData.js +98 -0
- package/esm/stdlib/data/validateData.js.map +1 -0
- package/esm/stdlib/index.d.ts +115 -49
- package/esm/stdlib/index.js +156 -37
- package/esm/stdlib/index.js.map +1 -1
- package/esm/stdlib/item/combo/circle.d.ts +29 -0
- package/esm/stdlib/item/combo/circle.js +56 -0
- package/esm/stdlib/item/combo/circle.js.map +1 -0
- package/esm/stdlib/item/combo/index.d.ts +2 -0
- package/esm/stdlib/item/combo/index.js +3 -0
- package/esm/stdlib/item/combo/index.js.map +1 -0
- package/esm/stdlib/item/combo/rect.d.ts +31 -0
- package/esm/stdlib/item/combo/rect.js +65 -0
- package/esm/stdlib/item/combo/rect.js.map +1 -0
- package/esm/stdlib/item/edge/base.d.ts +12 -3
- package/esm/stdlib/item/edge/base.js +39 -5
- package/esm/stdlib/item/edge/base.js.map +1 -1
- package/esm/stdlib/item/edge/cubic-horizontal.d.ts +36 -0
- package/esm/stdlib/item/edge/cubic-horizontal.js +56 -0
- package/esm/stdlib/item/edge/cubic-horizontal.js.map +1 -0
- package/esm/stdlib/item/edge/cubic-vertical.d.ts +36 -0
- package/esm/stdlib/item/edge/cubic-vertical.js +56 -0
- package/esm/stdlib/item/edge/cubic-vertical.js.map +1 -0
- package/esm/stdlib/item/edge/cubic.d.ts +59 -0
- package/esm/stdlib/item/edge/cubic.js +116 -0
- package/esm/stdlib/item/edge/cubic.js.map +1 -0
- package/esm/stdlib/item/edge/index.d.ts +6 -0
- package/esm/stdlib/item/edge/index.js +6 -0
- package/esm/stdlib/item/edge/index.js.map +1 -1
- package/esm/stdlib/item/edge/line.d.ts +1 -1
- package/esm/stdlib/item/edge/line.js +16 -1
- package/esm/stdlib/item/edge/line.js.map +1 -1
- package/esm/stdlib/item/edge/loop.d.ts +32 -0
- package/esm/stdlib/item/edge/loop.js +115 -0
- package/esm/stdlib/item/edge/loop.js.map +1 -0
- package/esm/stdlib/item/edge/polyline.d.ts +44 -0
- package/esm/stdlib/item/edge/polyline.js +92 -0
- package/esm/stdlib/item/edge/polyline.js.map +1 -0
- package/esm/stdlib/item/edge/quadratic.d.ts +40 -0
- package/esm/stdlib/item/edge/quadratic.js +78 -0
- package/esm/stdlib/item/edge/quadratic.js.map +1 -0
- package/esm/stdlib/item/node/base.d.ts +83 -38
- package/esm/stdlib/item/node/base.js +100 -15
- package/esm/stdlib/item/node/base.js.map +1 -1
- package/esm/stdlib/item/node/base3d.js +1 -1
- package/esm/stdlib/item/node/base3d.js.map +1 -1
- package/esm/stdlib/item/node/circle.js +5 -5
- package/esm/stdlib/item/node/circle.js.map +1 -1
- package/esm/stdlib/item/node/diamond.d.ts +32 -0
- package/esm/stdlib/item/node/diamond.js +79 -0
- package/esm/stdlib/item/node/diamond.js.map +1 -0
- package/esm/stdlib/item/node/donut.d.ts +70 -0
- package/esm/stdlib/item/node/donut.js +207 -0
- package/esm/stdlib/item/node/donut.js.map +1 -0
- package/esm/stdlib/item/node/ellipse.d.ts +32 -0
- package/esm/stdlib/item/node/ellipse.js +71 -0
- package/esm/stdlib/item/node/ellipse.js.map +1 -0
- package/esm/stdlib/item/node/hexagon.d.ts +33 -0
- package/esm/stdlib/item/node/hexagon.js +102 -0
- package/esm/stdlib/item/node/hexagon.js.map +1 -0
- package/esm/stdlib/item/node/index.d.ts +8 -0
- package/esm/stdlib/item/node/index.js +8 -0
- package/esm/stdlib/item/node/index.js.map +1 -1
- package/esm/stdlib/item/node/modelRect.d.ts +61 -0
- package/esm/stdlib/item/node/modelRect.js +186 -0
- package/esm/stdlib/item/node/modelRect.js.map +1 -0
- package/esm/stdlib/item/node/rect.d.ts +32 -0
- package/esm/stdlib/item/node/rect.js +75 -0
- package/esm/stdlib/item/node/rect.js.map +1 -0
- package/esm/stdlib/item/node/star.d.ts +34 -0
- package/esm/stdlib/item/node/star.js +115 -0
- package/esm/stdlib/item/node/star.js.map +1 -0
- package/esm/stdlib/item/node/triangle.d.ts +44 -0
- package/esm/stdlib/item/node/triangle.js +177 -0
- package/esm/stdlib/item/node/triangle.js.map +1 -0
- package/esm/stdlib/plugin/fisheye/index.d.ts +130 -0
- package/esm/stdlib/plugin/fisheye/index.js +488 -0
- package/esm/stdlib/plugin/fisheye/index.js.map +1 -0
- package/esm/stdlib/plugin/grid/index.d.ts +36 -0
- package/esm/stdlib/plugin/grid/index.js +81 -0
- package/esm/stdlib/plugin/grid/index.js.map +1 -0
- package/esm/stdlib/plugin/history/combo-command.d.ts +9 -0
- package/esm/stdlib/plugin/history/combo-command.js +21 -0
- package/esm/stdlib/plugin/history/combo-command.js.map +1 -0
- package/esm/stdlib/plugin/history/command.d.ts +18 -0
- package/esm/stdlib/plugin/history/command.js +51 -0
- package/esm/stdlib/plugin/history/command.js.map +1 -0
- package/esm/stdlib/plugin/history/index.d.ts +112 -0
- package/esm/stdlib/plugin/history/index.js +275 -0
- package/esm/stdlib/plugin/history/index.js.map +1 -0
- package/esm/stdlib/plugin/history/item-data-command.d.ts +14 -0
- package/esm/stdlib/plugin/history/item-data-command.js +63 -0
- package/esm/stdlib/plugin/history/item-data-command.js.map +1 -0
- package/esm/stdlib/plugin/history/layer-updated-command.d.ts +9 -0
- package/esm/stdlib/plugin/history/layer-updated-command.js +21 -0
- package/esm/stdlib/plugin/history/layer-updated-command.js.map +1 -0
- package/esm/stdlib/plugin/history/state-updated-command.d.ts +9 -0
- package/esm/stdlib/plugin/history/state-updated-command.js +20 -0
- package/esm/stdlib/plugin/history/state-updated-command.js.map +1 -0
- package/esm/stdlib/plugin/history/visibility-updated-command.d.ts +10 -0
- package/esm/stdlib/plugin/history/visibility-updated-command.js +23 -0
- package/esm/stdlib/plugin/history/visibility-updated-command.js.map +1 -0
- package/esm/stdlib/plugin/hull/bubbleset.d.ts +9 -0
- package/esm/stdlib/plugin/hull/bubbleset.js +592 -0
- package/esm/stdlib/plugin/hull/bubbleset.js.map +1 -0
- package/esm/stdlib/plugin/hull/convexHull.d.ts +14 -0
- package/esm/stdlib/plugin/hull/convexHull.js +56 -0
- package/esm/stdlib/plugin/hull/convexHull.js.map +1 -0
- package/esm/stdlib/plugin/hull/hullComponent.d.ts +87 -0
- package/esm/stdlib/plugin/hull/hullComponent.js +382 -0
- package/esm/stdlib/plugin/hull/hullComponent.js.map +1 -0
- package/esm/stdlib/plugin/hull/index.d.ts +59 -0
- package/esm/stdlib/plugin/hull/index.js +161 -0
- package/esm/stdlib/plugin/hull/index.js.map +1 -0
- package/esm/stdlib/plugin/hull/types.d.ts +15 -0
- package/esm/stdlib/plugin/hull/types.js +2 -0
- package/esm/stdlib/plugin/hull/types.js.map +1 -0
- package/esm/stdlib/plugin/hull/util.d.ts +77 -0
- package/esm/stdlib/plugin/hull/util.js +401 -0
- package/esm/stdlib/plugin/hull/util.js.map +1 -0
- package/esm/stdlib/plugin/index.d.ts +8 -0
- package/esm/stdlib/plugin/index.js +9 -0
- package/esm/stdlib/plugin/index.js.map +1 -0
- package/esm/stdlib/plugin/legend/index.d.ts +45 -3
- package/esm/stdlib/plugin/legend/index.js +47 -42
- package/esm/stdlib/plugin/legend/index.js.map +1 -1
- package/esm/stdlib/plugin/menu/index.d.ts +55 -0
- package/esm/stdlib/plugin/menu/index.js +237 -0
- package/esm/stdlib/plugin/menu/index.js.map +1 -0
- package/esm/stdlib/plugin/minimap/index.d.ts +11 -3
- package/esm/stdlib/plugin/minimap/index.js +19 -21
- package/esm/stdlib/plugin/minimap/index.js.map +1 -1
- package/esm/stdlib/plugin/toolbar/index.d.ts +59 -0
- package/esm/stdlib/plugin/toolbar/index.js +215 -0
- package/esm/stdlib/plugin/toolbar/index.js.map +1 -0
- package/esm/stdlib/plugin/tooltip/index.d.ts +96 -0
- package/esm/stdlib/plugin/tooltip/index.js +378 -0
- package/esm/stdlib/plugin/tooltip/index.js.map +1 -0
- package/esm/stdlib/plugin/types.d.ts +8 -0
- package/esm/stdlib/plugin/types.js +2 -0
- package/esm/stdlib/plugin/types.js.map +1 -0
- package/esm/stdlib/theme/dark.d.ts +1 -2
- package/esm/stdlib/theme/dark.js +13 -1
- package/esm/stdlib/theme/dark.js.map +1 -1
- package/esm/stdlib/theme/index.d.ts +2 -0
- package/esm/stdlib/theme/index.js +3 -0
- package/esm/stdlib/theme/index.js.map +1 -0
- package/esm/stdlib/theme/light.d.ts +1 -2
- package/esm/stdlib/theme/light.js +65 -10
- package/esm/stdlib/theme/light.js.map +1 -1
- package/esm/stdlib/themeSolver/base.d.ts +1 -1
- package/esm/stdlib/themeSolver/base.js +1 -1
- package/esm/stdlib/themeSolver/base.js.map +1 -1
- package/esm/stdlib/themeSolver/index.d.ts +3 -0
- package/esm/stdlib/themeSolver/index.js +4 -0
- package/esm/stdlib/themeSolver/index.js.map +1 -0
- package/esm/stdlib/themeSolver/spec.d.ts +2 -4
- package/esm/stdlib/themeSolver/spec.js +2 -2
- package/esm/stdlib/themeSolver/spec.js.map +1 -1
- package/esm/stdlib/themeSolver/subject.d.ts +2 -4
- package/esm/stdlib/themeSolver/subject.js +2 -2
- package/esm/stdlib/themeSolver/subject.js.map +1 -1
- package/esm/types/behavior.js.map +1 -1
- package/esm/types/combo.d.ts +51 -3
- package/esm/types/common.d.ts +10 -0
- package/esm/types/data.d.ts +13 -7
- package/esm/types/edge.d.ts +19 -5
- package/esm/types/event.d.ts +9 -1
- package/esm/types/event.js +8 -8
- package/esm/types/event.js.map +1 -1
- package/esm/types/graph.d.ts +169 -20
- package/esm/types/history.d.ts +28 -0
- package/esm/types/history.js +6 -0
- package/esm/types/history.js.map +1 -0
- package/esm/types/hook.d.ts +33 -6
- package/esm/types/index.d.ts +11 -5
- package/esm/types/index.js.map +1 -1
- package/esm/types/item.d.ts +14 -8
- package/esm/types/item.js.map +1 -1
- package/esm/types/layout.d.ts +4 -1
- package/esm/types/loop.d.ts +21 -0
- package/esm/types/loop.js +12 -0
- package/esm/types/loop.js.map +1 -0
- package/esm/types/node.d.ts +90 -10
- package/esm/types/plugin.d.ts +4 -0
- package/esm/types/plugin.js +1 -1
- package/esm/types/plugin.js.map +1 -1
- package/esm/types/spec.d.ts +26 -9
- package/esm/types/theme.d.ts +76 -10
- package/esm/types/theme.js +1 -2
- package/esm/types/theme.js.map +1 -1
- package/esm/util/animate.d.ts +2 -2
- package/esm/util/animate.js +52 -17
- package/esm/util/animate.js.map +1 -1
- package/esm/util/array.d.ts +8 -0
- package/esm/util/array.js +11 -1
- package/esm/util/array.js.map +1 -1
- package/esm/util/arrow.d.ts +17 -0
- package/esm/util/arrow.js +56 -0
- package/esm/util/arrow.js.map +1 -0
- package/esm/util/bbox.d.ts +106 -0
- package/esm/util/bbox.js +255 -0
- package/esm/util/bbox.js.map +1 -0
- package/esm/util/behavior.d.ts +2 -0
- package/esm/util/behavior.js +12 -0
- package/esm/util/behavior.js.map +1 -0
- package/esm/util/canvas.d.ts +1 -2
- package/esm/util/canvas.js +11 -20
- package/esm/util/canvas.js.map +1 -1
- package/esm/util/data.d.ts +96 -0
- package/esm/util/data.js +262 -0
- package/esm/util/data.js.map +1 -0
- package/esm/util/event.d.ts +29 -1
- package/esm/util/event.js +70 -0
- package/esm/util/event.js.map +1 -1
- package/esm/util/extend.d.ts +8 -2
- package/esm/util/extend.js.map +1 -1
- package/esm/util/index.d.ts +41 -3
- package/esm/util/index.js +20 -1
- package/esm/util/index.js.map +1 -1
- package/esm/util/item.d.ts +2 -1
- package/esm/util/item.js +38 -13
- package/esm/util/item.js.map +1 -1
- package/esm/util/layout.d.ts +40 -0
- package/esm/util/layout.js +160 -0
- package/esm/util/layout.js.map +1 -0
- package/esm/util/loop.d.ts +37 -0
- package/esm/util/loop.js +104 -0
- package/esm/util/loop.js.map +1 -0
- package/esm/util/mapper.js +4 -9
- package/esm/util/mapper.js.map +1 -1
- package/esm/util/math.d.ts +15 -0
- package/esm/util/math.js +14 -0
- package/esm/util/math.js.map +1 -1
- package/esm/util/mock.d.ts +30 -0
- package/esm/util/mock.js +69 -0
- package/esm/util/mock.js.map +1 -0
- package/esm/util/path.d.ts +11 -0
- package/esm/util/path.js +44 -0
- package/esm/util/path.js.map +1 -0
- package/esm/util/point.d.ts +24 -2
- package/esm/util/point.js +27 -2
- package/esm/util/point.js.map +1 -1
- package/esm/util/polyline.d.ts +113 -0
- package/esm/util/polyline.js +505 -0
- package/esm/util/polyline.js.map +1 -0
- package/esm/util/router.d.ts +31 -0
- package/esm/util/router.js +380 -0
- package/esm/util/router.js.map +1 -0
- package/esm/util/shape.d.ts +39 -4
- package/esm/util/shape.js +118 -2
- package/esm/util/shape.js.map +1 -1
- package/esm/util/shape3d.d.ts +1 -1
- package/esm/util/shape3d.js +12 -6
- package/esm/util/shape3d.js.map +1 -1
- package/esm/util/type.d.ts +6 -0
- package/esm/util/type.js +7 -1
- package/esm/util/type.js.map +1 -1
- package/esm/util/zoom.d.ts +2 -2
- package/esm/util/zoom.js +6 -2
- package/esm/util/zoom.js.map +1 -1
- package/lib/api-doc/behaviors.d.ts +2 -0
- package/lib/api-doc/behaviors.js +18 -0
- package/lib/api-doc/behaviors.js.map +1 -0
- package/lib/api-doc/graph.d.ts +4 -0
- package/lib/api-doc/graph.js +11 -0
- package/lib/api-doc/graph.js.map +1 -0
- package/lib/api-doc/item.d.ts +9 -0
- package/lib/api-doc/item.js +21 -0
- package/lib/api-doc/item.js.map +1 -0
- package/lib/api-doc/layout.d.ts +1 -0
- package/lib/api-doc/layout.js +3 -0
- package/lib/api-doc/layout.js.map +1 -0
- package/lib/api-doc/plugins.d.ts +1 -0
- package/lib/api-doc/plugins.js +18 -0
- package/lib/api-doc/plugins.js.map +1 -0
- package/lib/api-doc/types.d.ts +0 -0
- package/lib/api-doc/types.js +3 -0
- package/lib/api-doc/types.js.map +1 -0
- package/lib/api-doc/util.d.ts +3 -0
- package/lib/api-doc/util.js +10 -0
- package/lib/api-doc/util.js.map +1 -0
- package/lib/constant/shape.d.ts +7 -14
- package/lib/constant/shape.js +1 -0
- package/lib/constant/shape.js.map +1 -1
- package/lib/index.d.ts +215 -95
- package/lib/index.js +13 -3
- package/lib/index.js.map +1 -1
- package/lib/item/combo.d.ts +79 -2
- package/lib/item/combo.js +186 -2
- package/lib/item/combo.js.map +1 -1
- package/lib/item/edge.d.ts +15 -12
- package/lib/item/edge.js +40 -14
- package/lib/item/edge.js.map +1 -1
- package/lib/item/item.d.ts +12 -10
- package/lib/item/item.js +153 -81
- package/lib/item/item.js.map +1 -1
- package/lib/item/node.d.ts +32 -23
- package/lib/item/node.js +70 -49
- package/lib/item/node.js.map +1 -1
- package/lib/runtime/controller/data.d.ts +28 -4
- package/lib/runtime/controller/data.js +561 -172
- package/lib/runtime/controller/data.js.map +1 -1
- package/lib/runtime/controller/interaction.d.ts +1 -0
- package/lib/runtime/controller/interaction.js +22 -7
- package/lib/runtime/controller/interaction.js.map +1 -1
- package/lib/runtime/controller/item.d.ts +47 -5
- package/lib/runtime/controller/item.js +710 -120
- package/lib/runtime/controller/item.js.map +1 -1
- package/lib/runtime/controller/layout.d.ts +4 -1
- package/lib/runtime/controller/layout.js +132 -13
- package/lib/runtime/controller/layout.js.map +1 -1
- package/lib/runtime/controller/plugin.d.ts +11 -0
- package/lib/runtime/controller/plugin.js +39 -6
- package/lib/runtime/controller/plugin.js.map +1 -1
- package/lib/runtime/controller/theme.js +8 -4
- package/lib/runtime/controller/theme.js.map +1 -1
- package/lib/runtime/graph.d.ts +226 -47
- package/lib/runtime/graph.js +709 -89
- package/lib/runtime/graph.js.map +1 -1
- package/lib/stdlib/behavior/activate-relations.d.ts +2 -3
- package/lib/stdlib/behavior/activate-relations.js +14 -9
- package/lib/stdlib/behavior/activate-relations.js.map +1 -1
- package/lib/stdlib/behavior/brush-select.d.ts +3 -4
- package/lib/stdlib/behavior/brush-select.js +3 -2
- package/lib/stdlib/behavior/brush-select.js.map +1 -1
- package/lib/stdlib/behavior/click-select.d.ts +5 -3
- package/lib/stdlib/behavior/click-select.js +22 -7
- package/lib/stdlib/behavior/click-select.js.map +1 -1
- package/lib/stdlib/behavior/collapse-expand-combo.d.ts +28 -0
- package/lib/stdlib/behavior/collapse-expand-combo.js +39 -0
- package/lib/stdlib/behavior/collapse-expand-combo.js.map +1 -0
- package/lib/stdlib/behavior/collapse-expand-tree.d.ts +44 -0
- package/lib/stdlib/behavior/collapse-expand-tree.js +73 -0
- package/lib/stdlib/behavior/collapse-expand-tree.js.map +1 -0
- package/lib/stdlib/behavior/drag-canvas.d.ts +1 -2
- package/lib/stdlib/behavior/drag-canvas.js +16 -11
- package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
- package/lib/stdlib/behavior/drag-combo.d.ts +111 -0
- package/lib/stdlib/behavior/drag-combo.js +384 -0
- package/lib/stdlib/behavior/drag-combo.js.map +1 -0
- package/lib/stdlib/behavior/drag-node.d.ts +33 -13
- package/lib/stdlib/behavior/drag-node.js +252 -66
- package/lib/stdlib/behavior/drag-node.js.map +1 -1
- package/lib/stdlib/behavior/hover-activate.d.ts +2 -1
- package/lib/stdlib/behavior/hover-activate.js +2 -0
- package/lib/stdlib/behavior/hover-activate.js.map +1 -1
- package/lib/stdlib/behavior/index.d.ts +15 -0
- package/lib/stdlib/behavior/index.js +32 -0
- package/lib/stdlib/behavior/index.js.map +1 -0
- package/lib/stdlib/behavior/lasso-select.d.ts +7 -3
- package/lib/stdlib/behavior/lasso-select.js +4 -6
- package/lib/stdlib/behavior/lasso-select.js.map +1 -1
- package/lib/stdlib/behavior/orbit-canvas-3d.d.ts +2 -3
- package/lib/stdlib/behavior/orbit-canvas-3d.js +4 -6
- package/lib/stdlib/behavior/orbit-canvas-3d.js.map +1 -1
- package/lib/stdlib/behavior/rotate-canvas-3d.d.ts +1 -2
- package/lib/stdlib/behavior/rotate-canvas-3d.js +2 -1
- package/lib/stdlib/behavior/rotate-canvas-3d.js.map +1 -1
- package/lib/stdlib/behavior/track-canvas-3d.d.ts +2 -3
- package/lib/stdlib/behavior/track-canvas-3d.js +4 -6
- package/lib/stdlib/behavior/track-canvas-3d.js.map +1 -1
- package/lib/stdlib/behavior/types.d.ts +13 -0
- package/lib/stdlib/behavior/types.js +3 -0
- package/lib/stdlib/behavior/types.js.map +1 -0
- package/lib/stdlib/behavior/zoom-canvas-3d.d.ts +1 -2
- package/lib/stdlib/behavior/zoom-canvas-3d.js +8 -7
- package/lib/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
- package/lib/stdlib/behavior/zoom-canvas.d.ts +1 -2
- package/lib/stdlib/behavior/zoom-canvas.js +21 -18
- package/lib/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/lib/stdlib/data/index.d.ts +3 -0
- package/lib/stdlib/data/index.js +20 -0
- package/lib/stdlib/data/index.js.map +1 -0
- package/lib/stdlib/data/mapNodeSize.d.ts +12 -0
- package/lib/stdlib/data/mapNodeSize.js +47 -0
- package/lib/stdlib/data/mapNodeSize.js.map +1 -0
- package/lib/stdlib/data/transformV4Data.d.ts +9 -0
- package/lib/stdlib/data/transformV4Data.js +146 -0
- package/lib/stdlib/data/transformV4Data.js.map +1 -0
- package/lib/stdlib/data/validateData.d.ts +9 -0
- package/lib/stdlib/data/validateData.js +102 -0
- package/lib/stdlib/data/validateData.js.map +1 -0
- package/lib/stdlib/index.d.ts +115 -49
- package/lib/stdlib/index.js +190 -47
- package/lib/stdlib/index.js.map +1 -1
- package/lib/stdlib/item/combo/circle.d.ts +29 -0
- package/lib/stdlib/item/combo/circle.js +60 -0
- package/lib/stdlib/item/combo/circle.js.map +1 -0
- package/lib/stdlib/item/combo/index.d.ts +2 -0
- package/lib/stdlib/item/combo/index.js +19 -0
- package/lib/stdlib/item/combo/index.js.map +1 -0
- package/lib/stdlib/item/combo/rect.d.ts +31 -0
- package/lib/stdlib/item/combo/rect.js +69 -0
- package/lib/stdlib/item/combo/rect.js.map +1 -0
- package/lib/stdlib/item/edge/base.d.ts +12 -3
- package/lib/stdlib/item/edge/base.js +38 -4
- package/lib/stdlib/item/edge/base.js.map +1 -1
- package/lib/stdlib/item/edge/cubic-horizontal.d.ts +36 -0
- package/lib/stdlib/item/edge/cubic-horizontal.js +60 -0
- package/lib/stdlib/item/edge/cubic-horizontal.js.map +1 -0
- package/lib/stdlib/item/edge/cubic-vertical.d.ts +36 -0
- package/lib/stdlib/item/edge/cubic-vertical.js +60 -0
- package/lib/stdlib/item/edge/cubic-vertical.js.map +1 -0
- package/lib/stdlib/item/edge/cubic.d.ts +59 -0
- package/lib/stdlib/item/edge/cubic.js +120 -0
- package/lib/stdlib/item/edge/cubic.js.map +1 -0
- package/lib/stdlib/item/edge/index.d.ts +6 -0
- package/lib/stdlib/item/edge/index.js +6 -0
- package/lib/stdlib/item/edge/index.js.map +1 -1
- package/lib/stdlib/item/edge/line.d.ts +1 -1
- package/lib/stdlib/item/edge/line.js +16 -1
- package/lib/stdlib/item/edge/line.js.map +1 -1
- package/lib/stdlib/item/edge/loop.d.ts +32 -0
- package/lib/stdlib/item/edge/loop.js +119 -0
- package/lib/stdlib/item/edge/loop.js.map +1 -0
- package/lib/stdlib/item/edge/polyline.d.ts +44 -0
- package/lib/stdlib/item/edge/polyline.js +96 -0
- package/lib/stdlib/item/edge/polyline.js.map +1 -0
- package/lib/stdlib/item/edge/quadratic.d.ts +40 -0
- package/lib/stdlib/item/edge/quadratic.js +82 -0
- package/lib/stdlib/item/edge/quadratic.js.map +1 -0
- package/lib/stdlib/item/node/base.d.ts +83 -38
- package/lib/stdlib/item/node/base.js +100 -15
- package/lib/stdlib/item/node/base.js.map +1 -1
- package/lib/stdlib/item/node/base3d.js +1 -1
- package/lib/stdlib/item/node/base3d.js.map +1 -1
- package/lib/stdlib/item/node/circle.js +5 -5
- package/lib/stdlib/item/node/circle.js.map +1 -1
- package/lib/stdlib/item/node/diamond.d.ts +32 -0
- package/lib/stdlib/item/node/diamond.js +83 -0
- package/lib/stdlib/item/node/diamond.js.map +1 -0
- package/lib/stdlib/item/node/donut.d.ts +70 -0
- package/lib/stdlib/item/node/donut.js +211 -0
- package/lib/stdlib/item/node/donut.js.map +1 -0
- package/lib/stdlib/item/node/ellipse.d.ts +32 -0
- package/lib/stdlib/item/node/ellipse.js +75 -0
- package/lib/stdlib/item/node/ellipse.js.map +1 -0
- package/lib/stdlib/item/node/hexagon.d.ts +33 -0
- package/lib/stdlib/item/node/hexagon.js +106 -0
- package/lib/stdlib/item/node/hexagon.js.map +1 -0
- package/lib/stdlib/item/node/index.d.ts +8 -0
- package/lib/stdlib/item/node/index.js +8 -0
- package/lib/stdlib/item/node/index.js.map +1 -1
- package/lib/stdlib/item/node/modelRect.d.ts +61 -0
- package/lib/stdlib/item/node/modelRect.js +190 -0
- package/lib/stdlib/item/node/modelRect.js.map +1 -0
- package/lib/stdlib/item/node/rect.d.ts +32 -0
- package/lib/stdlib/item/node/rect.js +79 -0
- package/lib/stdlib/item/node/rect.js.map +1 -0
- package/lib/stdlib/item/node/star.d.ts +34 -0
- package/lib/stdlib/item/node/star.js +119 -0
- package/lib/stdlib/item/node/star.js.map +1 -0
- package/lib/stdlib/item/node/triangle.d.ts +44 -0
- package/lib/stdlib/item/node/triangle.js +181 -0
- package/lib/stdlib/item/node/triangle.js.map +1 -0
- package/lib/stdlib/plugin/fisheye/index.d.ts +130 -0
- package/lib/stdlib/plugin/fisheye/index.js +492 -0
- package/lib/stdlib/plugin/fisheye/index.js.map +1 -0
- package/lib/stdlib/plugin/grid/index.d.ts +36 -0
- package/lib/stdlib/plugin/grid/index.js +85 -0
- package/lib/stdlib/plugin/grid/index.js.map +1 -0
- package/lib/stdlib/plugin/history/combo-command.d.ts +9 -0
- package/lib/stdlib/plugin/history/combo-command.js +25 -0
- package/lib/stdlib/plugin/history/combo-command.js.map +1 -0
- package/lib/stdlib/plugin/history/command.d.ts +18 -0
- package/lib/stdlib/plugin/history/command.js +54 -0
- package/lib/stdlib/plugin/history/command.js.map +1 -0
- package/lib/stdlib/plugin/history/index.d.ts +112 -0
- package/lib/stdlib/plugin/history/index.js +283 -0
- package/lib/stdlib/plugin/history/index.js.map +1 -0
- package/lib/stdlib/plugin/history/item-data-command.d.ts +14 -0
- package/lib/stdlib/plugin/history/item-data-command.js +67 -0
- package/lib/stdlib/plugin/history/item-data-command.js.map +1 -0
- package/lib/stdlib/plugin/history/layer-updated-command.d.ts +9 -0
- package/lib/stdlib/plugin/history/layer-updated-command.js +25 -0
- package/lib/stdlib/plugin/history/layer-updated-command.js.map +1 -0
- package/lib/stdlib/plugin/history/state-updated-command.d.ts +9 -0
- package/lib/stdlib/plugin/history/state-updated-command.js +24 -0
- package/lib/stdlib/plugin/history/state-updated-command.js.map +1 -0
- package/lib/stdlib/plugin/history/visibility-updated-command.d.ts +10 -0
- package/lib/stdlib/plugin/history/visibility-updated-command.js +27 -0
- package/lib/stdlib/plugin/history/visibility-updated-command.js.map +1 -0
- package/lib/stdlib/plugin/hull/bubbleset.d.ts +9 -0
- package/lib/stdlib/plugin/hull/bubbleset.js +596 -0
- package/lib/stdlib/plugin/hull/bubbleset.js.map +1 -0
- package/lib/stdlib/plugin/hull/convexHull.d.ts +14 -0
- package/lib/stdlib/plugin/hull/convexHull.js +61 -0
- package/lib/stdlib/plugin/hull/convexHull.js.map +1 -0
- package/lib/stdlib/plugin/hull/hullComponent.d.ts +87 -0
- package/lib/stdlib/plugin/hull/hullComponent.js +385 -0
- package/lib/stdlib/plugin/hull/hullComponent.js.map +1 -0
- package/lib/stdlib/plugin/hull/index.d.ts +59 -0
- package/lib/stdlib/plugin/hull/index.js +167 -0
- package/lib/stdlib/plugin/hull/index.js.map +1 -0
- package/lib/stdlib/plugin/hull/types.d.ts +15 -0
- package/lib/stdlib/plugin/hull/types.js +3 -0
- package/lib/stdlib/plugin/hull/types.js.map +1 -0
- package/lib/stdlib/plugin/hull/util.d.ts +77 -0
- package/lib/stdlib/plugin/hull/util.js +419 -0
- package/lib/stdlib/plugin/hull/util.js.map +1 -0
- package/lib/stdlib/plugin/index.d.ts +8 -0
- package/lib/stdlib/plugin/index.js +25 -0
- package/lib/stdlib/plugin/index.js.map +1 -0
- package/lib/stdlib/plugin/legend/index.d.ts +45 -3
- package/lib/stdlib/plugin/legend/index.js +46 -40
- package/lib/stdlib/plugin/legend/index.js.map +1 -1
- package/lib/stdlib/plugin/menu/index.d.ts +55 -0
- package/lib/stdlib/plugin/menu/index.js +244 -0
- package/lib/stdlib/plugin/menu/index.js.map +1 -0
- package/lib/stdlib/plugin/minimap/index.d.ts +11 -3
- package/lib/stdlib/plugin/minimap/index.js +19 -20
- package/lib/stdlib/plugin/minimap/index.js.map +1 -1
- package/lib/stdlib/plugin/toolbar/index.d.ts +59 -0
- package/lib/stdlib/plugin/toolbar/index.js +222 -0
- package/lib/stdlib/plugin/toolbar/index.js.map +1 -0
- package/lib/stdlib/plugin/tooltip/index.d.ts +96 -0
- package/lib/stdlib/plugin/tooltip/index.js +385 -0
- package/lib/stdlib/plugin/tooltip/index.js.map +1 -0
- package/lib/stdlib/plugin/types.d.ts +8 -0
- package/lib/stdlib/plugin/types.js +3 -0
- package/lib/stdlib/plugin/types.js.map +1 -0
- package/lib/stdlib/theme/dark.d.ts +1 -2
- package/lib/stdlib/theme/dark.js +14 -1
- package/lib/stdlib/theme/dark.js.map +1 -1
- package/lib/stdlib/theme/index.d.ts +2 -0
- package/lib/stdlib/theme/index.js +19 -0
- package/lib/stdlib/theme/index.js.map +1 -0
- package/lib/stdlib/theme/light.d.ts +1 -2
- package/lib/stdlib/theme/light.js +66 -10
- package/lib/stdlib/theme/light.js.map +1 -1
- package/lib/stdlib/themeSolver/base.d.ts +1 -1
- package/lib/stdlib/themeSolver/base.js +2 -1
- package/lib/stdlib/themeSolver/base.js.map +1 -1
- package/lib/stdlib/themeSolver/index.d.ts +3 -0
- package/lib/stdlib/themeSolver/index.js +20 -0
- package/lib/stdlib/themeSolver/index.js.map +1 -0
- package/lib/stdlib/themeSolver/spec.d.ts +2 -4
- package/lib/stdlib/themeSolver/spec.js +4 -6
- package/lib/stdlib/themeSolver/spec.js.map +1 -1
- package/lib/stdlib/themeSolver/subject.d.ts +2 -4
- package/lib/stdlib/themeSolver/subject.js +4 -4
- package/lib/stdlib/themeSolver/subject.js.map +1 -1
- package/lib/types/behavior.js.map +1 -1
- package/lib/types/combo.d.ts +51 -3
- package/lib/types/common.d.ts +10 -0
- package/lib/types/data.d.ts +13 -7
- package/lib/types/edge.d.ts +19 -5
- package/lib/types/event.d.ts +9 -1
- package/lib/types/event.js +10 -10
- package/lib/types/event.js.map +1 -1
- package/lib/types/graph.d.ts +169 -20
- package/lib/types/history.d.ts +28 -0
- package/lib/types/history.js +9 -0
- package/lib/types/history.js.map +1 -0
- package/lib/types/hook.d.ts +33 -6
- package/lib/types/index.d.ts +11 -5
- package/lib/types/index.js.map +1 -1
- package/lib/types/item.d.ts +14 -8
- package/lib/types/item.js +1 -1
- package/lib/types/item.js.map +1 -1
- package/lib/types/layout.d.ts +4 -1
- package/lib/types/loop.d.ts +21 -0
- package/lib/types/loop.js +15 -0
- package/lib/types/loop.js.map +1 -0
- package/lib/types/node.d.ts +90 -10
- package/lib/types/plugin.d.ts +4 -0
- package/lib/types/plugin.js.map +1 -1
- package/lib/types/spec.d.ts +26 -9
- package/lib/types/theme.d.ts +76 -10
- package/lib/types/theme.js +1 -2
- package/lib/types/theme.js.map +1 -1
- package/lib/util/animate.d.ts +2 -2
- package/lib/util/animate.js +52 -17
- package/lib/util/animate.js.map +1 -1
- package/lib/util/array.d.ts +8 -0
- package/lib/util/array.js +13 -2
- package/lib/util/array.js.map +1 -1
- package/lib/util/arrow.d.ts +17 -0
- package/lib/util/arrow.js +60 -0
- package/lib/util/arrow.js.map +1 -0
- package/lib/util/bbox.d.ts +106 -0
- package/lib/util/bbox.js +273 -0
- package/lib/util/bbox.js.map +1 -0
- package/lib/util/behavior.d.ts +2 -0
- package/lib/util/behavior.js +16 -0
- package/lib/util/behavior.js.map +1 -0
- package/lib/util/canvas.d.ts +1 -2
- package/lib/util/canvas.js +11 -20
- package/lib/util/canvas.js.map +1 -1
- package/lib/util/data.d.ts +96 -0
- package/lib/util/data.js +276 -0
- package/lib/util/data.js.map +1 -0
- package/lib/util/event.d.ts +29 -1
- package/lib/util/event.js +73 -1
- package/lib/util/event.js.map +1 -1
- package/lib/util/extend.d.ts +8 -2
- package/lib/util/extend.js.map +1 -1
- package/lib/util/index.d.ts +41 -3
- package/lib/util/index.js +20 -1
- package/lib/util/index.js.map +1 -1
- package/lib/util/item.d.ts +2 -1
- package/lib/util/item.js +38 -13
- package/lib/util/item.js.map +1 -1
- package/lib/util/layout.d.ts +40 -0
- package/lib/util/layout.js +172 -0
- package/lib/util/layout.js.map +1 -0
- package/lib/util/loop.d.ts +37 -0
- package/lib/util/loop.js +111 -0
- package/lib/util/loop.js.map +1 -0
- package/lib/util/mapper.js +4 -9
- package/lib/util/mapper.js.map +1 -1
- package/lib/util/math.d.ts +15 -0
- package/lib/util/math.js +17 -1
- package/lib/util/math.js.map +1 -1
- package/lib/util/mock.d.ts +30 -0
- package/lib/util/mock.js +73 -0
- package/lib/util/mock.js.map +1 -0
- package/lib/util/path.d.ts +11 -0
- package/lib/util/path.js +49 -0
- package/lib/util/path.js.map +1 -0
- package/lib/util/point.d.ts +24 -2
- package/lib/util/point.js +31 -3
- package/lib/util/point.js.map +1 -1
- package/lib/util/polyline.d.ts +113 -0
- package/lib/util/polyline.js +524 -0
- package/lib/util/polyline.js.map +1 -0
- package/lib/util/router.d.ts +31 -0
- package/lib/util/router.js +384 -0
- package/lib/util/router.js.map +1 -0
- package/lib/util/shape.d.ts +39 -4
- package/lib/util/shape.js +122 -3
- package/lib/util/shape.js.map +1 -1
- package/lib/util/shape3d.d.ts +1 -1
- package/lib/util/shape3d.js +11 -5
- package/lib/util/shape3d.js.map +1 -1
- package/lib/util/type.d.ts +6 -0
- package/lib/util/type.js +9 -2
- package/lib/util/type.js.map +1 -1
- package/lib/util/zoom.d.ts +2 -2
- package/lib/util/zoom.js +6 -2
- package/lib/util/zoom.js.map +1 -1
- package/package.json +42 -22
- package/src/api-doc/behaviors.ts +2 -0
- package/src/api-doc/graph.ts +4 -0
- package/src/api-doc/item.ts +43 -0
- package/src/api-doc/layout.ts +13 -0
- package/src/api-doc/plugins.ts +1 -0
- package/src/api-doc/readme.md +59 -0
- package/src/api-doc/types.ts +2 -0
- package/src/api-doc/util.ts +3 -0
- package/src/constant/shape.ts +4 -1
- package/src/index.ts +14 -4
- package/src/item/combo.ts +307 -2
- package/src/item/edge.ts +73 -24
- package/src/item/item.ts +184 -85
- package/src/item/node.ts +138 -69
- package/src/runtime/controller/data.ts +665 -191
- package/src/runtime/controller/interaction.ts +31 -7
- package/src/runtime/controller/item.ts +990 -172
- package/src/runtime/controller/layout.ts +165 -13
- package/src/runtime/controller/plugin.ts +47 -10
- package/src/runtime/controller/theme.ts +8 -4
- package/src/runtime/graph.ts +922 -144
- package/src/stdlib/behavior/activate-relations.ts +14 -11
- package/src/stdlib/behavior/brush-select.ts +4 -5
- package/src/stdlib/behavior/click-select.ts +26 -11
- package/src/stdlib/behavior/collapse-expand-combo.ts +57 -0
- package/src/stdlib/behavior/collapse-expand-tree.ts +106 -0
- package/src/stdlib/behavior/drag-canvas.ts +15 -13
- package/src/stdlib/behavior/drag-combo.ts +589 -0
- package/src/stdlib/behavior/drag-node.ts +380 -110
- package/src/stdlib/behavior/hover-activate.ts +3 -5
- package/src/stdlib/behavior/index.ts +15 -0
- package/src/stdlib/behavior/lasso-select.ts +6 -2
- package/src/stdlib/behavior/orbit-canvas-3d.ts +3 -5
- package/src/stdlib/behavior/rotate-canvas-3d.ts +1 -3
- package/src/stdlib/behavior/track-canvas-3d.ts +3 -5
- package/src/stdlib/behavior/types.ts +15 -0
- package/src/stdlib/behavior/zoom-canvas-3d.ts +5 -7
- package/src/stdlib/behavior/zoom-canvas.ts +19 -19
- package/src/stdlib/data/index.ts +3 -0
- package/src/stdlib/data/mapNodeSize.ts +67 -0
- package/src/stdlib/data/transformV4Data.ts +207 -0
- package/src/stdlib/data/validateData.ts +146 -0
- package/src/stdlib/index.ts +221 -37
- package/src/stdlib/item/combo/circle.ts +113 -0
- package/src/stdlib/item/combo/index.ts +2 -0
- package/src/stdlib/item/combo/rect.ts +123 -0
- package/src/stdlib/item/edge/base.ts +71 -6
- package/src/stdlib/item/edge/cubic-horizontal.ts +86 -0
- package/src/stdlib/item/edge/cubic-vertical.ts +85 -0
- package/src/stdlib/item/edge/cubic.ts +198 -0
- package/src/stdlib/item/edge/index.ts +6 -0
- package/src/stdlib/item/edge/line.ts +14 -15
- package/src/stdlib/item/edge/loop.ts +162 -0
- package/src/stdlib/item/edge/polyline.ts +161 -0
- package/src/stdlib/item/edge/quadratic.ts +133 -0
- package/src/stdlib/item/node/base.ts +195 -53
- package/src/stdlib/item/node/base3d.ts +2 -0
- package/src/stdlib/item/node/circle.ts +5 -5
- package/src/stdlib/item/node/diamond.ts +144 -0
- package/src/stdlib/item/node/donut.ts +368 -0
- package/src/stdlib/item/node/ellipse.ts +128 -0
- package/src/stdlib/item/node/hexagon.ts +168 -0
- package/src/stdlib/item/node/index.ts +8 -0
- package/src/stdlib/item/node/modelRect.ts +405 -0
- package/src/stdlib/item/node/rect.ts +141 -0
- package/src/stdlib/item/node/star.ts +181 -0
- package/src/stdlib/item/node/triangle.ts +265 -0
- package/src/stdlib/plugin/fisheye/index.ts +607 -0
- package/src/stdlib/plugin/grid/index.ts +125 -0
- package/src/stdlib/plugin/history/combo-command.ts +28 -0
- package/src/stdlib/plugin/history/command.ts +81 -0
- package/src/stdlib/plugin/history/index.ts +347 -0
- package/src/stdlib/plugin/history/item-data-command.ts +96 -0
- package/src/stdlib/plugin/history/layer-updated-command.ts +28 -0
- package/src/stdlib/plugin/history/state-updated-command.ts +36 -0
- package/src/stdlib/plugin/history/visibility-updated-command.ts +41 -0
- package/src/stdlib/plugin/hull/bubbleset.ts +828 -0
- package/src/stdlib/plugin/hull/convexHull.ts +68 -0
- package/src/stdlib/plugin/hull/hullComponent.ts +501 -0
- package/src/stdlib/plugin/hull/index.ts +234 -0
- package/src/stdlib/plugin/hull/types.ts +15 -0
- package/src/stdlib/plugin/hull/util.ts +511 -0
- package/src/stdlib/plugin/index.ts +8 -0
- package/src/stdlib/plugin/legend/index.ts +122 -61
- package/src/stdlib/plugin/menu/index.ts +275 -0
- package/src/stdlib/plugin/minimap/index.ts +35 -26
- package/src/stdlib/plugin/toolbar/index.ts +257 -0
- package/src/stdlib/plugin/tooltip/index.ts +444 -0
- package/src/stdlib/plugin/types.ts +8 -0
- package/src/stdlib/theme/dark.ts +13 -1
- package/src/stdlib/theme/index.ts +2 -0
- package/src/stdlib/theme/light.ts +88 -10
- package/src/stdlib/themeSolver/base.ts +1 -1
- package/src/stdlib/themeSolver/index.ts +3 -0
- package/src/stdlib/themeSolver/spec.ts +2 -5
- package/src/stdlib/themeSolver/subject.ts +2 -5
- package/src/types/behavior.ts +0 -1
- package/src/types/combo.ts +61 -4
- package/src/types/common.ts +13 -0
- package/src/types/data.ts +28 -7
- package/src/types/edge.ts +30 -6
- package/src/types/event.ts +8 -8
- package/src/types/graph.ts +232 -25
- package/src/types/history.ts +30 -0
- package/src/types/hook.ts +37 -7
- package/src/types/index.ts +37 -12
- package/src/types/item.ts +25 -11
- package/src/types/layout.ts +20 -16
- package/src/types/loop.ts +23 -0
- package/src/types/node.ts +94 -14
- package/src/types/plugin.ts +7 -1
- package/src/types/spec.ts +30 -13
- package/src/types/theme.ts +80 -10
- package/src/util/animate.ts +60 -20
- package/src/util/array.ts +12 -1
- package/src/util/arrow.ts +62 -0
- package/src/util/bbox.ts +298 -0
- package/src/util/behavior.ts +14 -0
- package/src/util/canvas.ts +16 -24
- package/src/util/data.ts +307 -0
- package/src/util/event.ts +114 -1
- package/src/util/extend.ts +8 -2
- package/src/util/index.ts +31 -1
- package/src/util/item.ts +79 -13
- package/src/util/layout.ts +165 -0
- package/src/util/loop.ts +145 -0
- package/src/util/mapper.ts +10 -9
- package/src/util/math.ts +24 -0
- package/src/util/mock.ts +72 -0
- package/src/util/path.ts +52 -0
- package/src/util/point.ts +33 -2
- package/src/util/polyline.ts +676 -0
- package/src/util/router.ts +552 -0
- package/src/util/shape.ts +159 -6
- package/src/util/shape3d.ts +16 -11
- package/src/util/type.ts +8 -1
- package/src/util/zoom.ts +8 -4
- package/esm/stdlib/data/comboFromNode.d.ts +0 -9
- package/esm/stdlib/data/comboFromNode.js +0 -28
- package/esm/stdlib/data/comboFromNode.js.map +0 -1
- package/lib/stdlib/data/comboFromNode.d.ts +0 -9
- package/lib/stdlib/data/comboFromNode.js +0 -32
- package/lib/stdlib/data/comboFromNode.js.map +0 -1
- package/src/stdlib/data/comboFromNode.ts +0 -28
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ID } from '@antv/graphlib';
|
|
2
|
-
import { throttle, uniq } from '@antv/util';
|
|
3
|
-
import { EdgeModel } from '../../types';
|
|
2
|
+
import { debounce, throttle, uniq } from '@antv/util';
|
|
3
|
+
import { ComboModel, EdgeModel, NodeModel } from '../../types';
|
|
4
4
|
import { Behavior } from '../../types/behavior';
|
|
5
5
|
import { IG6GraphEvent } from '../../types/event';
|
|
6
6
|
import { Point } from '../../types/common';
|
|
7
|
+
import { graphComboTreeDfs } from '../../util/data';
|
|
7
8
|
|
|
8
9
|
const DELEGATE_SHAPE_ID = 'g6-drag-node-delegate-shape';
|
|
9
10
|
|
|
@@ -18,12 +19,12 @@ export interface DragNodeOptions {
|
|
|
18
19
|
* Ignored when enableDelegate is true.
|
|
19
20
|
* Defaults to true.
|
|
20
21
|
*/
|
|
21
|
-
enableTransient?:
|
|
22
|
+
enableTransient?: boolean;
|
|
22
23
|
/**
|
|
23
24
|
* Whether to use a virtual rect moved with the dragging mouse instead of the node.
|
|
24
25
|
* Defaults to false.
|
|
25
26
|
*/
|
|
26
|
-
enableDelegate?:
|
|
27
|
+
enableDelegate?: boolean;
|
|
27
28
|
/**
|
|
28
29
|
* The drawing properties when the nodes are dragged.
|
|
29
30
|
* Only used when enableDelegate is true.
|
|
@@ -47,7 +48,7 @@ export interface DragNodeOptions {
|
|
|
47
48
|
* Ignored when enableTransient or enableDelegate is true.
|
|
48
49
|
* Defaults to false.
|
|
49
50
|
*/
|
|
50
|
-
hideRelatedEdges?:
|
|
51
|
+
hideRelatedEdges?: boolean;
|
|
51
52
|
/**
|
|
52
53
|
* The state name to be considered as "selected".
|
|
53
54
|
* Defaults to "selected".
|
|
@@ -57,6 +58,10 @@ export interface DragNodeOptions {
|
|
|
57
58
|
* The event name to trigger when drag end.
|
|
58
59
|
*/
|
|
59
60
|
eventName?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Whether change the combo hierarchy structure or only change size.
|
|
63
|
+
*/
|
|
64
|
+
updateComboStructure?: boolean;
|
|
60
65
|
/**
|
|
61
66
|
* Whether allow the behavior happen on the current item.
|
|
62
67
|
*/
|
|
@@ -77,28 +82,32 @@ const DEFAULT_OPTIONS: Required<DragNodeOptions> = {
|
|
|
77
82
|
hideRelatedEdges: false,
|
|
78
83
|
selectedState: 'selected',
|
|
79
84
|
eventName: '',
|
|
85
|
+
updateComboStructure: true,
|
|
80
86
|
shouldBegin: () => true,
|
|
81
87
|
};
|
|
82
88
|
|
|
83
|
-
|
|
84
|
-
|
|
89
|
+
type Position = {
|
|
90
|
+
id: ID;
|
|
91
|
+
x: number;
|
|
92
|
+
y: number;
|
|
93
|
+
// The following fields only have values when delegate is enabled.
|
|
94
|
+
minX?: number;
|
|
95
|
+
maxX?: number;
|
|
96
|
+
minY?: number;
|
|
97
|
+
maxY?: number;
|
|
98
|
+
};
|
|
85
99
|
|
|
100
|
+
export class DragNode extends Behavior {
|
|
86
101
|
// Private states
|
|
87
102
|
private hiddenEdges: EdgeModel[] = [];
|
|
103
|
+
private selectedNodeIds: ID[] = [];
|
|
104
|
+
private hiddenNearEdges: EdgeModel[] = [];
|
|
105
|
+
private hiddenComboTreeItems: (ComboModel | NodeModel)[] = [];
|
|
88
106
|
private originX: number;
|
|
89
107
|
private originY: number;
|
|
90
|
-
private originPositions: Array<
|
|
91
|
-
id: ID;
|
|
92
|
-
x: number;
|
|
93
|
-
y: number;
|
|
94
|
-
// The following fields only have values when delegate is enabled.
|
|
95
|
-
minX?: number;
|
|
96
|
-
maxX?: number;
|
|
97
|
-
minY?: number;
|
|
98
|
-
maxY?: number;
|
|
99
|
-
}> = [];
|
|
108
|
+
private originPositions: Array<Position> = [];
|
|
100
109
|
private pointerDown: Point | undefined = undefined;
|
|
101
|
-
private dragging
|
|
110
|
+
private dragging = false;
|
|
102
111
|
|
|
103
112
|
constructor(options: Partial<DragNodeOptions>) {
|
|
104
113
|
const finalOptions = Object.assign({}, DEFAULT_OPTIONS, options);
|
|
@@ -112,24 +121,77 @@ export default class DragNode extends Behavior {
|
|
|
112
121
|
}
|
|
113
122
|
|
|
114
123
|
getEvents = () => {
|
|
115
|
-
|
|
124
|
+
const events: any = {
|
|
116
125
|
'node:pointerdown': this.onPointerDown,
|
|
117
126
|
pointermove: this.onPointerMove,
|
|
118
|
-
|
|
127
|
+
click: this.onClick,
|
|
119
128
|
// FIXME: IG6Event -> keyboard event
|
|
120
129
|
keydown: this.onKeydown as any,
|
|
121
130
|
};
|
|
131
|
+
if (this.options.updateComboStructure) {
|
|
132
|
+
return {
|
|
133
|
+
'node:drop': this.onDropNode,
|
|
134
|
+
'combo:drop': this.onDropCombo,
|
|
135
|
+
'canvas:drop': this.onDropCanvas,
|
|
136
|
+
...events,
|
|
137
|
+
};
|
|
138
|
+
} else {
|
|
139
|
+
return {
|
|
140
|
+
pointerup: this.onClick,
|
|
141
|
+
...events,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
122
144
|
};
|
|
123
145
|
|
|
124
146
|
/** Given selected node ids, get their related visible edges. */
|
|
125
|
-
private getRelatedEdges(
|
|
147
|
+
private getRelatedEdges(
|
|
148
|
+
selectedNodeIds: ID[],
|
|
149
|
+
relatedCombo: (ComboModel | NodeModel)[],
|
|
150
|
+
onlyVisible = true,
|
|
151
|
+
) {
|
|
152
|
+
const relatedNodeComboIds = [];
|
|
153
|
+
graphComboTreeDfs(this.graph, relatedCombo, (item) =>
|
|
154
|
+
relatedNodeComboIds.push(item.id),
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
let edges = uniq(
|
|
158
|
+
selectedNodeIds
|
|
159
|
+
.concat(relatedNodeComboIds)
|
|
160
|
+
.flatMap((nodeId) => this.graph.getRelatedEdgesData(nodeId)),
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
if (onlyVisible) {
|
|
164
|
+
edges = edges.filter((edgeData) =>
|
|
165
|
+
this.graph.getItemVisible(edgeData.id),
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
return edges;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** Retrieve the nearby edges for a given node using quadtree collision detection. */
|
|
172
|
+
private getNearEdgesForNodes(nodeIds: ID[]) {
|
|
126
173
|
return uniq(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
174
|
+
nodeIds.flatMap((nodeId) => this.graph.getNearEdgesForNode(nodeId)),
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
private getComboTreeItems(selectedNodeIds: ID[]) {
|
|
179
|
+
const ancestors = [];
|
|
180
|
+
if (this.options.updateComboStructure) return ancestors;
|
|
181
|
+
selectedNodeIds.forEach((id) => {
|
|
182
|
+
const nodeData = this.graph.getNodeData(id);
|
|
183
|
+
if (!nodeData.data.parentId) return;
|
|
184
|
+
let parentId = nodeData.data.parentId;
|
|
185
|
+
let ancestor;
|
|
186
|
+
while (parentId) {
|
|
187
|
+
const parentData = this.graph.getComboData(parentId);
|
|
188
|
+
if (!parentData) break;
|
|
189
|
+
ancestor = parentData;
|
|
190
|
+
parentId = parentData.data.parentId;
|
|
191
|
+
ancestors.push(ancestor);
|
|
192
|
+
}
|
|
132
193
|
});
|
|
194
|
+
return uniq(ancestors).filter((item) => this.graph.getItemVisible(item.id));
|
|
133
195
|
}
|
|
134
196
|
|
|
135
197
|
public onPointerDown(event: IG6GraphEvent) {
|
|
@@ -145,11 +207,14 @@ export default class DragNode extends Behavior {
|
|
|
145
207
|
const beginDeltaY = Math.abs(this.pointerDown.y - event.canvas.y);
|
|
146
208
|
if (beginDeltaX < 1 && beginDeltaY < 1) return;
|
|
147
209
|
|
|
210
|
+
const enableTransient =
|
|
211
|
+
this.options.enableTransient && this.graph.rendererType !== 'webgl-3d';
|
|
212
|
+
|
|
148
213
|
// pointerDown + first move = dragging
|
|
149
214
|
if (!this.dragging) {
|
|
150
215
|
this.dragging = true;
|
|
151
216
|
const currentNodeId = event.itemId;
|
|
152
|
-
|
|
217
|
+
this.selectedNodeIds = this.graph.findIdByState(
|
|
153
218
|
'node',
|
|
154
219
|
this.options.selectedState,
|
|
155
220
|
true,
|
|
@@ -157,60 +222,89 @@ export default class DragNode extends Behavior {
|
|
|
157
222
|
|
|
158
223
|
// If current node is selected, drag all the selected nodes together.
|
|
159
224
|
// Otherwise drag current node.
|
|
160
|
-
if (currentNodeId && !selectedNodeIds.includes(currentNodeId)) {
|
|
161
|
-
selectedNodeIds = [currentNodeId];
|
|
225
|
+
if (currentNodeId && !this.selectedNodeIds.includes(currentNodeId)) {
|
|
226
|
+
this.selectedNodeIds = [currentNodeId];
|
|
162
227
|
}
|
|
163
228
|
|
|
164
|
-
this.originPositions = selectedNodeIds
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const { x, y } = this.graph.getNodeData(id).data as {
|
|
170
|
-
x: number;
|
|
171
|
-
y: number;
|
|
172
|
-
};
|
|
173
|
-
// If delegate is enabled, record bbox together.
|
|
174
|
-
if (this.options.enableDelegate) {
|
|
175
|
-
const bbox = this.graph.getRenderBBox(id);
|
|
176
|
-
if (bbox) {
|
|
177
|
-
const [minX, minY] = bbox.min;
|
|
178
|
-
const [maxX, maxY] = bbox.max;
|
|
179
|
-
return { id, x, y, minX, minY, maxX, maxY };
|
|
229
|
+
this.originPositions = this.selectedNodeIds
|
|
230
|
+
.map((id) => {
|
|
231
|
+
if (!this.graph.getNodeData(id)) {
|
|
232
|
+
console.warn('node does not exist', id);
|
|
233
|
+
return;
|
|
180
234
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
235
|
+
const { x, y } = this.graph.getNodeData(id).data as {
|
|
236
|
+
x: number;
|
|
237
|
+
y: number;
|
|
238
|
+
};
|
|
239
|
+
// If delegate is enabled, record bbox together.
|
|
240
|
+
if (this.options.enableDelegate) {
|
|
241
|
+
const bbox = this.graph.getRenderBBox(id);
|
|
242
|
+
if (bbox) {
|
|
243
|
+
const [minX, minY] = bbox.min;
|
|
244
|
+
const [maxX, maxY] = bbox.max;
|
|
245
|
+
return { id, x, y, minX, minY, maxX, maxY };
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return { id, x, y };
|
|
249
|
+
})
|
|
250
|
+
.filter(Boolean);
|
|
187
251
|
|
|
188
252
|
// Hide related edge.
|
|
189
253
|
if (this.options.hideRelatedEdges && !enableTransient) {
|
|
190
|
-
this.
|
|
191
|
-
|
|
192
|
-
this.hiddenEdges.map((edge) => edge.id),
|
|
193
|
-
true,
|
|
254
|
+
this.hiddenComboTreeItems = this.getComboTreeItems(
|
|
255
|
+
this.selectedNodeIds,
|
|
194
256
|
);
|
|
257
|
+
this.hiddenEdges = this.getRelatedEdges(
|
|
258
|
+
this.selectedNodeIds,
|
|
259
|
+
this.hiddenComboTreeItems,
|
|
260
|
+
);
|
|
261
|
+
this.graph.executeWithoutStacking(() => {
|
|
262
|
+
this.graph.hideItem(
|
|
263
|
+
this.hiddenEdges.map((edge) => edge.id),
|
|
264
|
+
true,
|
|
265
|
+
);
|
|
266
|
+
this.graph.hideItem(
|
|
267
|
+
this.hiddenComboTreeItems.map((child) => child.id),
|
|
268
|
+
true,
|
|
269
|
+
);
|
|
270
|
+
});
|
|
195
271
|
}
|
|
196
272
|
|
|
197
273
|
// Draw transient nodes and edges.
|
|
198
274
|
if (enableTransient) {
|
|
199
275
|
// Draw transient edges and nodes.
|
|
200
|
-
this.
|
|
276
|
+
this.hiddenComboTreeItems = this.getComboTreeItems(
|
|
277
|
+
this.selectedNodeIds,
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
this.hiddenEdges = this.getRelatedEdges(
|
|
281
|
+
this.selectedNodeIds,
|
|
282
|
+
this.hiddenComboTreeItems,
|
|
283
|
+
);
|
|
284
|
+
this.selectedNodeIds.forEach((nodeId) => {
|
|
285
|
+
// draw the nodes' transients and their ancestor combos' transisents
|
|
286
|
+
this.graph.drawTransient('node', nodeId, {
|
|
287
|
+
upsertAncestors: !this.options.updateComboStructure,
|
|
288
|
+
});
|
|
289
|
+
});
|
|
201
290
|
this.hiddenEdges.forEach((edge) => {
|
|
202
291
|
this.graph.drawTransient('edge', edge.id, {});
|
|
203
292
|
});
|
|
204
|
-
selectedNodeIds.forEach((nodeId) => {
|
|
205
|
-
this.graph.drawTransient('node', nodeId, {});
|
|
206
|
-
});
|
|
207
293
|
|
|
208
294
|
// Hide original edges and nodes. They will be restored when pointerup.
|
|
209
|
-
this.graph.
|
|
210
|
-
|
|
211
|
-
this.
|
|
212
|
-
|
|
213
|
-
|
|
295
|
+
this.graph.executeWithoutStacking(() => {
|
|
296
|
+
this.graph.hideItem(this.selectedNodeIds, true);
|
|
297
|
+
this.graph.hideItem(
|
|
298
|
+
this.hiddenEdges.map((edge) => edge.id),
|
|
299
|
+
true,
|
|
300
|
+
);
|
|
301
|
+
this.graph.hideItem(
|
|
302
|
+
this.hiddenComboTreeItems.map((combo) => combo.id),
|
|
303
|
+
true,
|
|
304
|
+
);
|
|
305
|
+
});
|
|
306
|
+
} else {
|
|
307
|
+
this.graph.frontItem(this.selectedNodeIds);
|
|
214
308
|
}
|
|
215
309
|
|
|
216
310
|
// Throttle moving.
|
|
@@ -224,13 +318,42 @@ export default class DragNode extends Behavior {
|
|
|
224
318
|
this.throttledMoveNodes = this.moveNodes;
|
|
225
319
|
}
|
|
226
320
|
|
|
227
|
-
// @ts-ignore FIXME: Type
|
|
228
321
|
this.originX = event.canvas.x;
|
|
229
|
-
// @ts-ignore FIXME: Type
|
|
230
322
|
this.originY = event.canvas.y;
|
|
231
323
|
}
|
|
232
324
|
|
|
233
|
-
|
|
325
|
+
/**
|
|
326
|
+
* When dragging nodes, if nodes are set to `preventPolylineEdgeOverlap`,
|
|
327
|
+
* use quadtree collision detection to identity nearby edges and dynamically update them
|
|
328
|
+
*/
|
|
329
|
+
if (this.dragging && enableTransient) {
|
|
330
|
+
const autoRoutedNodesIds = this.selectedNodeIds.filter((nodeId) => {
|
|
331
|
+
return (
|
|
332
|
+
this.graph.getNodeData(nodeId)?.data.preventPolylineEdgeOverlap ||
|
|
333
|
+
false
|
|
334
|
+
);
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
if (autoRoutedNodesIds) {
|
|
338
|
+
const hiddenEdgesIds = this.hiddenEdges.map((edge) => edge.id);
|
|
339
|
+
this.hiddenNearEdges = this.getNearEdgesForNodes(
|
|
340
|
+
autoRoutedNodesIds,
|
|
341
|
+
).filter((edge) => !hiddenEdgesIds.includes(edge.id));
|
|
342
|
+
|
|
343
|
+
if (this.hiddenNearEdges.length) {
|
|
344
|
+
this.hiddenNearEdges.forEach((edge) => {
|
|
345
|
+
this.graph.drawTransient('edge', edge.id, {});
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
this.graph.hideItem(
|
|
349
|
+
this.hiddenNearEdges.map((edge) => edge.id),
|
|
350
|
+
true,
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
if (!this.originPositions.length || !this.dragging) {
|
|
234
357
|
return;
|
|
235
358
|
}
|
|
236
359
|
|
|
@@ -246,20 +369,22 @@ export default class DragNode extends Behavior {
|
|
|
246
369
|
} else {
|
|
247
370
|
const enableTransient =
|
|
248
371
|
this.options.enableTransient && this.graph.rendererType !== 'webgl-3d';
|
|
249
|
-
this.throttledMoveNodes(
|
|
372
|
+
this.throttledMoveNodes(
|
|
373
|
+
deltaX,
|
|
374
|
+
deltaY,
|
|
375
|
+
enableTransient,
|
|
376
|
+
!this.options.updateComboStructure,
|
|
377
|
+
);
|
|
250
378
|
}
|
|
251
379
|
}
|
|
252
380
|
|
|
253
|
-
public moveNodes(
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
},
|
|
261
|
-
};
|
|
262
|
-
});
|
|
381
|
+
public moveNodes(
|
|
382
|
+
deltaX: number,
|
|
383
|
+
deltaY: number,
|
|
384
|
+
transient: boolean,
|
|
385
|
+
upsertAncestors = true,
|
|
386
|
+
callback?: (positions: Position[]) => void,
|
|
387
|
+
) {
|
|
263
388
|
if (transient) {
|
|
264
389
|
// Move transient nodes
|
|
265
390
|
this.originPositions.forEach(({ id, x, y }) => {
|
|
@@ -268,6 +393,7 @@ export default class DragNode extends Behavior {
|
|
|
268
393
|
x: x + deltaX,
|
|
269
394
|
y: y + deltaY,
|
|
270
395
|
},
|
|
396
|
+
upsertAncestors,
|
|
271
397
|
});
|
|
272
398
|
});
|
|
273
399
|
// Update transient edges.
|
|
@@ -275,14 +401,30 @@ export default class DragNode extends Behavior {
|
|
|
275
401
|
this.graph.drawTransient('edge', edge.id, {});
|
|
276
402
|
});
|
|
277
403
|
} else {
|
|
278
|
-
this.
|
|
404
|
+
const positionChanges = this.originPositions.map(({ id, x, y }) => {
|
|
405
|
+
return {
|
|
406
|
+
id,
|
|
407
|
+
data: {
|
|
408
|
+
x: x + deltaX,
|
|
409
|
+
y: y + deltaY,
|
|
410
|
+
},
|
|
411
|
+
};
|
|
412
|
+
});
|
|
413
|
+
const positions = [...this.originPositions];
|
|
414
|
+
this.graph.updateNodePosition(
|
|
415
|
+
positionChanges,
|
|
416
|
+
upsertAncestors,
|
|
417
|
+
true,
|
|
418
|
+
() => callback?.(positions),
|
|
419
|
+
);
|
|
279
420
|
}
|
|
280
421
|
}
|
|
281
422
|
|
|
282
423
|
public throttledMoveNodes: Function = (
|
|
283
424
|
deltaX: number,
|
|
284
425
|
deltaY: number,
|
|
285
|
-
transient:
|
|
426
|
+
transient: boolean,
|
|
427
|
+
upsertAncestors = true,
|
|
286
428
|
) => {
|
|
287
429
|
// Should be overrided when drag start.
|
|
288
430
|
};
|
|
@@ -321,12 +463,22 @@ export default class DragNode extends Behavior {
|
|
|
321
463
|
this.graph.drawTransient('node', edge.target, { action: 'remove' });
|
|
322
464
|
this.graph.drawTransient('edge', edge.id, { action: 'remove' });
|
|
323
465
|
});
|
|
466
|
+
this.hiddenNearEdges.forEach((edge) => {
|
|
467
|
+
this.graph.drawTransient('edge', edge.id, { action: 'remove' });
|
|
468
|
+
});
|
|
469
|
+
this.hiddenComboTreeItems.forEach((item) => {
|
|
470
|
+
const isCombo = item.data._isCombo;
|
|
471
|
+
this.graph.drawTransient(isCombo ? 'combo' : 'node', item.id, {
|
|
472
|
+
action: 'remove',
|
|
473
|
+
});
|
|
474
|
+
});
|
|
324
475
|
this.originPositions.forEach(({ id }) => {
|
|
325
476
|
this.graph.drawTransient('node', id, { action: 'remove' });
|
|
326
477
|
});
|
|
327
478
|
}
|
|
328
479
|
|
|
329
|
-
public restoreHiddenItems() {
|
|
480
|
+
public restoreHiddenItems(positions?: Position[]) {
|
|
481
|
+
this.graph.pauseStacking();
|
|
330
482
|
if (this.hiddenEdges.length) {
|
|
331
483
|
this.graph.showItem(
|
|
332
484
|
this.hiddenEdges.map((edge) => edge.id),
|
|
@@ -334,55 +486,88 @@ export default class DragNode extends Behavior {
|
|
|
334
486
|
);
|
|
335
487
|
this.hiddenEdges = [];
|
|
336
488
|
}
|
|
489
|
+
if (this.hiddenNearEdges.length) {
|
|
490
|
+
this.graph.showItem(
|
|
491
|
+
this.hiddenNearEdges.map((edge) => edge.id),
|
|
492
|
+
true,
|
|
493
|
+
);
|
|
494
|
+
this.hiddenNearEdges = [];
|
|
495
|
+
}
|
|
496
|
+
if (this.hiddenComboTreeItems.length) {
|
|
497
|
+
this.graph.showItem(
|
|
498
|
+
this.hiddenComboTreeItems.map((edge) => edge.id),
|
|
499
|
+
true,
|
|
500
|
+
);
|
|
501
|
+
this.hiddenComboTreeItems = [];
|
|
502
|
+
}
|
|
337
503
|
const enableTransient =
|
|
338
504
|
this.options.enableTransient && this.graph.rendererType !== 'webgl-3d';
|
|
339
505
|
if (enableTransient) {
|
|
340
506
|
this.graph.showItem(
|
|
341
|
-
this.originPositions.map((position) => position.id),
|
|
507
|
+
this.originPositions.concat(positions).map((position) => position.id),
|
|
342
508
|
true,
|
|
343
509
|
);
|
|
344
510
|
}
|
|
511
|
+
this.graph.resumeStacking();
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
public clearState() {
|
|
515
|
+
// Reset state.
|
|
516
|
+
this.originPositions = [];
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
public onClick(event: IG6GraphEvent) {
|
|
520
|
+
this.onPointerUp(event);
|
|
521
|
+
this.clearState();
|
|
345
522
|
}
|
|
346
523
|
|
|
347
524
|
public onPointerUp(event: IG6GraphEvent) {
|
|
348
525
|
this.pointerDown = undefined;
|
|
349
526
|
this.dragging = false;
|
|
527
|
+
this.selectedNodeIds = [];
|
|
350
528
|
const enableTransient =
|
|
351
529
|
this.options.enableTransient && this.graph.rendererType !== 'webgl-3d';
|
|
352
530
|
// If transient or delegate was enabled, move the real nodes.
|
|
353
|
-
if (enableTransient || this.options.enableDelegate) {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
531
|
+
// if (enableTransient || this.options.enableDelegate) {
|
|
532
|
+
// @ts-ignore FIXME: type
|
|
533
|
+
const pointerEvent = event as PointerEvent;
|
|
534
|
+
// @ts-ignore FIXME: Type
|
|
535
|
+
const deltaX = pointerEvent.canvas.x - this.originX + 0.01;
|
|
536
|
+
// @ts-ignore FIXME: Type
|
|
537
|
+
const deltaY = pointerEvent.canvas.y - this.originY + 0.01;
|
|
538
|
+
this.moveNodes(
|
|
539
|
+
deltaX,
|
|
540
|
+
deltaY,
|
|
541
|
+
false,
|
|
542
|
+
true,
|
|
543
|
+
debounce((positions) => {
|
|
544
|
+
// restore the hidden items after move real nodes done
|
|
545
|
+
if (enableTransient) {
|
|
546
|
+
this.clearTransientItems();
|
|
547
|
+
}
|
|
366
548
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
549
|
+
if (this.options.enableDelegate) {
|
|
550
|
+
this.clearDelegate();
|
|
551
|
+
}
|
|
370
552
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
553
|
+
// Restore all hidden items.
|
|
554
|
+
// For all hideRelatedEdges, enableTransient and enableDelegate cases.
|
|
555
|
+
this.restoreHiddenItems(positions);
|
|
374
556
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
557
|
+
// Emit event.
|
|
558
|
+
if (this.options.eventName) {
|
|
559
|
+
this.graph.emit(this.options.eventName, {
|
|
560
|
+
itemIds: positions.map((position) => position.id),
|
|
561
|
+
});
|
|
562
|
+
}
|
|
381
563
|
|
|
382
|
-
|
|
383
|
-
|
|
564
|
+
// Reset state.
|
|
565
|
+
this.clearState();
|
|
566
|
+
}),
|
|
567
|
+
);
|
|
384
568
|
}
|
|
385
569
|
|
|
570
|
+
// TODO: deal with combos
|
|
386
571
|
public onKeydown(event: KeyboardEvent) {
|
|
387
572
|
if (event.key !== 'Escape' && event.key !== 'Esc') {
|
|
388
573
|
return;
|
|
@@ -401,6 +586,91 @@ export default class DragNode extends Behavior {
|
|
|
401
586
|
this.graph.updateNodePosition(positionChanges);
|
|
402
587
|
}
|
|
403
588
|
|
|
404
|
-
this.
|
|
589
|
+
this.clearState();
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
public onDropNode(event: IG6GraphEvent) {
|
|
593
|
+
const elements = this.graph.canvas.document.elementsFromPointSync(
|
|
594
|
+
event.canvas.x,
|
|
595
|
+
event.canvas.y,
|
|
596
|
+
);
|
|
597
|
+
const draggingIds = this.originPositions.map(({ id }) => id);
|
|
598
|
+
const currentIds = elements
|
|
599
|
+
// @ts-ignore TODO: G type
|
|
600
|
+
.map((ele) => ele.parentNode.getAttribute?.('data-item-id'))
|
|
601
|
+
.filter((id) => id !== undefined && !draggingIds.includes(id));
|
|
602
|
+
// the top item which is not in draggingIds
|
|
603
|
+
const dropId = currentIds.find(
|
|
604
|
+
(id) => this.graph.getComboData(id) || this.graph.getNodeData(id),
|
|
605
|
+
);
|
|
606
|
+
// drop on a node A, move the dragged node to the same parent of A
|
|
607
|
+
const newParentId = this.graph.getNodeData(dropId)
|
|
608
|
+
? this.graph.getNodeData(dropId).data.parentId
|
|
609
|
+
: dropId;
|
|
610
|
+
|
|
611
|
+
this.graph.startBatch();
|
|
612
|
+
this.originPositions.forEach(({ id }) => {
|
|
613
|
+
const model = this.graph.getNodeData(id);
|
|
614
|
+
if (!model) return;
|
|
615
|
+
const { parentId } = model.data;
|
|
616
|
+
// if the parents are same, do nothing
|
|
617
|
+
if (parentId === newParentId) return;
|
|
618
|
+
|
|
619
|
+
// update data to change the structure
|
|
620
|
+
// if newParentId is undefined, new parent is the canvas
|
|
621
|
+
this.graph.updateData('node', { id, data: { parentId: newParentId } });
|
|
622
|
+
});
|
|
623
|
+
this.onPointerUp(event);
|
|
624
|
+
this.graph.stopBatch();
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
public onDropCombo(event: IG6GraphEvent) {
|
|
628
|
+
event.stopPropagation();
|
|
629
|
+
const newParentId = event.itemId;
|
|
630
|
+
this.graph.startBatch();
|
|
631
|
+
this.onPointerUp(event);
|
|
632
|
+
this.originPositions.forEach(({ id }) => {
|
|
633
|
+
const model = this.graph.getNodeData(id);
|
|
634
|
+
if (!model) return;
|
|
635
|
+
const { parentId } = model.data;
|
|
636
|
+
if (parentId === newParentId) return;
|
|
637
|
+
this.graph.updateData('node', { id, data: { parentId: newParentId } });
|
|
638
|
+
});
|
|
639
|
+
this.clearState();
|
|
640
|
+
this.graph.stopBatch();
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
public onDropCanvas(event: IG6GraphEvent) {
|
|
644
|
+
const elements = this.graph.canvas.document.elementsFromPointSync(
|
|
645
|
+
event.canvas.x,
|
|
646
|
+
event.canvas.y,
|
|
647
|
+
);
|
|
648
|
+
const draggingIds = this.originPositions.map(({ id }) => id);
|
|
649
|
+
const currentIds = elements
|
|
650
|
+
// @ts-ignore TODO: G type
|
|
651
|
+
.map((ele) => ele.parentNode.getAttribute?.('data-item-id'))
|
|
652
|
+
.filter((id) => id !== undefined && !draggingIds.includes(id));
|
|
653
|
+
// the top item which is not in draggingIds
|
|
654
|
+
const dropId = currentIds.find(
|
|
655
|
+
(id) => this.graph.getComboData(id) || this.graph.getNodeData(id),
|
|
656
|
+
);
|
|
657
|
+
const parentId = this.graph.getNodeData(dropId)
|
|
658
|
+
? this.graph.getNodeData(dropId).data.parentId
|
|
659
|
+
: dropId;
|
|
660
|
+
this.graph.startBatch();
|
|
661
|
+
this.onPointerUp(event);
|
|
662
|
+
const nodeToUpdate = [];
|
|
663
|
+
this.originPositions.forEach(({ id }) => {
|
|
664
|
+
const { parentId: originParentId } = this.graph.getNodeData(id).data;
|
|
665
|
+
if (parentId && originParentId !== parentId) {
|
|
666
|
+
nodeToUpdate.push({ id, data: { parentId } });
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
if (!originParentId) return;
|
|
670
|
+
nodeToUpdate.push({ id, data: { parentId: undefined } });
|
|
671
|
+
});
|
|
672
|
+
if (nodeToUpdate.length) this.graph.updateData('node', nodeToUpdate);
|
|
673
|
+
this.clearState();
|
|
674
|
+
this.graph.stopBatch();
|
|
405
675
|
}
|
|
406
676
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { ID } from '@antv/graphlib';
|
|
2
|
+
import { ITEM_TYPE } from '../../types/item';
|
|
2
3
|
import { Behavior } from '../../types/behavior';
|
|
3
4
|
import { IG6GraphEvent } from '../../types/event';
|
|
4
|
-
import { ITEM_TYPE } from 'types/item';
|
|
5
|
-
|
|
6
|
-
// TODO: Combo related features:
|
|
7
|
-
// hover combo
|
|
8
5
|
|
|
9
6
|
export interface HoverActivateOptions {
|
|
10
7
|
/**
|
|
@@ -42,7 +39,6 @@ const DEFAULT_OPTIONS: Required<HoverActivateOptions> = {
|
|
|
42
39
|
};
|
|
43
40
|
|
|
44
41
|
export class HoverActivate extends Behavior {
|
|
45
|
-
options: HoverActivateOptions;
|
|
46
42
|
private currentItemInfo: { id: ID; itemType: ITEM_TYPE };
|
|
47
43
|
|
|
48
44
|
constructor(options: Partial<HoverActivateOptions>) {
|
|
@@ -56,6 +52,8 @@ export class HoverActivate extends Behavior {
|
|
|
56
52
|
'node:pointerleave': this.onPointerLeave,
|
|
57
53
|
'edge:pointerenter': this.onPointerEnter,
|
|
58
54
|
'edge:pointerleave': this.onPointerLeave,
|
|
55
|
+
'combo:pointerenter': this.onPointerEnter,
|
|
56
|
+
'combo:pointerleave': this.onPointerLeave,
|
|
59
57
|
};
|
|
60
58
|
};
|
|
61
59
|
|