@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
|
@@ -0,0 +1,589 @@
|
|
|
1
|
+
import { ID } from '@antv/graphlib';
|
|
2
|
+
import { debounce, throttle, uniq } from '@antv/util';
|
|
3
|
+
import { ComboModel, EdgeModel, NodeModel } from '../../types';
|
|
4
|
+
import { Behavior } from '../../types/behavior';
|
|
5
|
+
import { IG6GraphEvent } from '../../types/event';
|
|
6
|
+
import { Point } from '../../types/common';
|
|
7
|
+
import { graphComboTreeDfs } from '../../util/data';
|
|
8
|
+
|
|
9
|
+
const DELEGATE_SHAPE_ID = 'g6-drag-combo-delegate-shape';
|
|
10
|
+
|
|
11
|
+
export interface DragComboOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Whether to draw dragging nodes in transient layer.
|
|
14
|
+
* Ignored when enableDelegate is true.
|
|
15
|
+
* Defaults to true.
|
|
16
|
+
*/
|
|
17
|
+
enableTransient?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Whether to use a virtual rect moved with the dragging mouse instead of the node.
|
|
20
|
+
* Defaults to false.
|
|
21
|
+
*/
|
|
22
|
+
enableDelegate?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The drawing properties when the nodes are dragged.
|
|
25
|
+
* Only used when enableDelegate is true.
|
|
26
|
+
*/
|
|
27
|
+
delegateStyle?: {
|
|
28
|
+
fill?: string;
|
|
29
|
+
stroke?: string;
|
|
30
|
+
fillOpacity?: number;
|
|
31
|
+
strokeOpacity?: number;
|
|
32
|
+
lineWidth?: number;
|
|
33
|
+
lineDash?: [number, number];
|
|
34
|
+
[key: string]: unknown;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* The time in milliseconds to throttle moving. Useful to avoid the frequent calculation.
|
|
38
|
+
* Defaults to 0.
|
|
39
|
+
*/
|
|
40
|
+
throttle?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Whether to hide the related edges to avoid calculation while dragging nodes.
|
|
43
|
+
* Ignored when enableTransient or enableDelegate is true.
|
|
44
|
+
* Defaults to false.
|
|
45
|
+
*/
|
|
46
|
+
hideRelatedEdges?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* The state name to be considered as "selected".
|
|
49
|
+
* Defaults to "selected".
|
|
50
|
+
*/
|
|
51
|
+
selectedState?: string;
|
|
52
|
+
/**
|
|
53
|
+
* The event name to trigger when drag end.
|
|
54
|
+
*/
|
|
55
|
+
eventName?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Whether change the combo hierarchy structure or only change size.
|
|
58
|
+
*/
|
|
59
|
+
updateComboStructure?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Whether allow the behavior happen on the current item.
|
|
62
|
+
*/
|
|
63
|
+
shouldBegin?: (event: IG6GraphEvent) => boolean;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const DEFAULT_OPTIONS: Required<DragComboOptions> = {
|
|
67
|
+
enableTransient: true,
|
|
68
|
+
enableDelegate: false,
|
|
69
|
+
delegateStyle: {
|
|
70
|
+
fill: '#F3F9FF',
|
|
71
|
+
fillOpacity: 0.5,
|
|
72
|
+
stroke: '#1890FF',
|
|
73
|
+
strokeOpacity: 0.9,
|
|
74
|
+
lineDash: [5, 5],
|
|
75
|
+
},
|
|
76
|
+
throttle: 16,
|
|
77
|
+
hideRelatedEdges: false,
|
|
78
|
+
selectedState: 'selected',
|
|
79
|
+
eventName: '',
|
|
80
|
+
updateComboStructure: true,
|
|
81
|
+
shouldBegin: () => true,
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
type Position = {
|
|
85
|
+
id: ID;
|
|
86
|
+
x: number;
|
|
87
|
+
y: number;
|
|
88
|
+
// The following fields only have values when delegate is enabled.
|
|
89
|
+
minX?: number;
|
|
90
|
+
maxX?: number;
|
|
91
|
+
minY?: number;
|
|
92
|
+
maxY?: number;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export class DragCombo extends Behavior {
|
|
96
|
+
// Private states
|
|
97
|
+
private hiddenEdges: EdgeModel[] = [];
|
|
98
|
+
private hiddenComboTreeRoots: (ComboModel | NodeModel)[] = [];
|
|
99
|
+
private originX: number;
|
|
100
|
+
private originY: number;
|
|
101
|
+
private previousX: number;
|
|
102
|
+
private previousY: number;
|
|
103
|
+
private originPositions: Array<Position> = [];
|
|
104
|
+
private selectedComboIds: ID[];
|
|
105
|
+
private pointerDown: Point | undefined = undefined;
|
|
106
|
+
private dragging = false;
|
|
107
|
+
|
|
108
|
+
constructor(options: Partial<DragComboOptions>) {
|
|
109
|
+
const finalOptions = Object.assign({}, DEFAULT_OPTIONS, options);
|
|
110
|
+
if (finalOptions.enableDelegate) {
|
|
111
|
+
finalOptions.enableTransient = false;
|
|
112
|
+
}
|
|
113
|
+
if (finalOptions.enableDelegate || finalOptions.enableTransient) {
|
|
114
|
+
finalOptions.hideRelatedEdges = false;
|
|
115
|
+
}
|
|
116
|
+
super(finalOptions);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
getEvents = () => {
|
|
120
|
+
const events = {
|
|
121
|
+
'combo:pointerdown': this.onPointerDown,
|
|
122
|
+
pointermove: this.onPointerMove,
|
|
123
|
+
click: this.onPointerUp,
|
|
124
|
+
// FIXME: IG6Event -> keyboard event
|
|
125
|
+
keydown: this.onKeydown as any,
|
|
126
|
+
};
|
|
127
|
+
if (this.options.updateComboStructure) {
|
|
128
|
+
return {
|
|
129
|
+
'node:drop': this.onDropNode,
|
|
130
|
+
'combo:drop': this.onDropCombo,
|
|
131
|
+
'canvas:drop': this.onDropCanvas,
|
|
132
|
+
...events,
|
|
133
|
+
};
|
|
134
|
+
} else {
|
|
135
|
+
return {
|
|
136
|
+
pointerup: this.onPointerUp,
|
|
137
|
+
...events,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/** Given selected node ids, get their related visible edges. */
|
|
143
|
+
private getRelatedEdges(
|
|
144
|
+
selectedComboIds: ID[],
|
|
145
|
+
comboTreeRoots: (ComboModel | NodeModel)[],
|
|
146
|
+
) {
|
|
147
|
+
let edges = selectedComboIds.flatMap((comboId) =>
|
|
148
|
+
this.graph.getRelatedEdgesData(comboId),
|
|
149
|
+
);
|
|
150
|
+
graphComboTreeDfs(this.graph, comboTreeRoots, (child) => {
|
|
151
|
+
edges = edges.concat(this.graph.getRelatedEdgesData(child.id));
|
|
152
|
+
});
|
|
153
|
+
return uniq(edges).filter((edgeData) => {
|
|
154
|
+
return this.graph.getItemVisible(edgeData.id);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
private getComboTreeItems(selectedComboIds: ID[]) {
|
|
159
|
+
let begins = [];
|
|
160
|
+
if (!this.options.updateComboStructure) {
|
|
161
|
+
// do not change the combo structure, begins are the roots
|
|
162
|
+
selectedComboIds.forEach((id) => {
|
|
163
|
+
const comboData = this.graph.getComboData(id);
|
|
164
|
+
let rootAncestor = comboData;
|
|
165
|
+
let parentId = comboData.data.parentId;
|
|
166
|
+
while (parentId) {
|
|
167
|
+
const parentData = this.graph.getComboData(parentId);
|
|
168
|
+
if (!parentData) break;
|
|
169
|
+
parentId = parentData.data.parentId;
|
|
170
|
+
rootAncestor = parentData;
|
|
171
|
+
}
|
|
172
|
+
begins.push(rootAncestor);
|
|
173
|
+
});
|
|
174
|
+
} else {
|
|
175
|
+
begins = selectedComboIds.map((id) => this.graph.getComboData(id));
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const items = begins;
|
|
179
|
+
graphComboTreeDfs(this.graph, begins, (child) => items.push(child), 'TB');
|
|
180
|
+
return uniq(items).filter(
|
|
181
|
+
(item) =>
|
|
182
|
+
!selectedComboIds.includes(item.id) &&
|
|
183
|
+
this.graph.getItemVisible(item.id),
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
public onPointerDown(event: IG6GraphEvent) {
|
|
188
|
+
if (!this.options.shouldBegin(event)) return;
|
|
189
|
+
this.pointerDown = { x: event.canvas.x, y: event.canvas.y };
|
|
190
|
+
this.dragging = false;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
public onPointerMove(event: IG6GraphEvent) {
|
|
194
|
+
if (!this.pointerDown) return;
|
|
195
|
+
|
|
196
|
+
const beginDeltaX = Math.abs(this.pointerDown.x - event.canvas.x);
|
|
197
|
+
const beginDeltaY = Math.abs(this.pointerDown.y - event.canvas.y);
|
|
198
|
+
if (beginDeltaX < 1 && beginDeltaY < 1) return;
|
|
199
|
+
|
|
200
|
+
const enableTransient =
|
|
201
|
+
this.options.enableTransient && this.graph.rendererType !== 'webgl-3d';
|
|
202
|
+
|
|
203
|
+
if (this.dragging) {
|
|
204
|
+
this.originPositions = this.selectedComboIds
|
|
205
|
+
.map((id) => {
|
|
206
|
+
if (!this.graph.getComboData(id)) {
|
|
207
|
+
console.warn('combo does not exist', id);
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const bounds = this.graph.getRenderBBox(id, true, enableTransient);
|
|
211
|
+
if (!bounds) return;
|
|
212
|
+
const [x, y] = bounds.center;
|
|
213
|
+
// If delegate is enabled, record bbox together.
|
|
214
|
+
if (this.options.enableDelegate) {
|
|
215
|
+
const [minX, minY] = bounds.min;
|
|
216
|
+
const [maxX, maxY] = bounds.max;
|
|
217
|
+
return { id, x, y, minX, minY, maxX, maxY };
|
|
218
|
+
}
|
|
219
|
+
return { id, x, y };
|
|
220
|
+
})
|
|
221
|
+
.filter(Boolean);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// pointerDown + first move = dragstart
|
|
225
|
+
if (!this.dragging) {
|
|
226
|
+
this.dragging = true;
|
|
227
|
+
|
|
228
|
+
const currentComboId = event.itemId;
|
|
229
|
+
let selectedComboIds = this.graph.findIdByState(
|
|
230
|
+
'combo',
|
|
231
|
+
this.options.selectedState,
|
|
232
|
+
true,
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
// If current node is selected, drag all the selected nodes together.
|
|
236
|
+
// Otherwise drag current node.
|
|
237
|
+
if (
|
|
238
|
+
currentComboId &&
|
|
239
|
+
event.itemType === 'combo' &&
|
|
240
|
+
!selectedComboIds.includes(currentComboId)
|
|
241
|
+
) {
|
|
242
|
+
selectedComboIds = [currentComboId];
|
|
243
|
+
}
|
|
244
|
+
this.selectedComboIds = selectedComboIds;
|
|
245
|
+
|
|
246
|
+
// Hide related edge.
|
|
247
|
+
if (this.options.hideRelatedEdges && !enableTransient) {
|
|
248
|
+
this.hiddenComboTreeRoots = this.getComboTreeItems(selectedComboIds);
|
|
249
|
+
this.hiddenEdges = this.getRelatedEdges(
|
|
250
|
+
selectedComboIds,
|
|
251
|
+
this.hiddenComboTreeRoots,
|
|
252
|
+
);
|
|
253
|
+
this.graph.executeWithoutStacking(() => {
|
|
254
|
+
this.graph.hideItem(
|
|
255
|
+
this.hiddenEdges.map((edge) => edge.id),
|
|
256
|
+
true,
|
|
257
|
+
);
|
|
258
|
+
this.graph.hideItem(
|
|
259
|
+
this.hiddenComboTreeRoots.map((child) => child.id),
|
|
260
|
+
true,
|
|
261
|
+
);
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// Draw transient nodes and edges.
|
|
266
|
+
if (enableTransient) {
|
|
267
|
+
// Draw transient edges and nodes.
|
|
268
|
+
this.hiddenComboTreeRoots = this.getComboTreeItems(selectedComboIds);
|
|
269
|
+
this.hiddenEdges = this.getRelatedEdges(
|
|
270
|
+
selectedComboIds,
|
|
271
|
+
this.hiddenComboTreeRoots,
|
|
272
|
+
);
|
|
273
|
+
selectedComboIds.forEach((comboId) => {
|
|
274
|
+
this.graph.drawTransient('combo', comboId, {
|
|
275
|
+
upsertAncestors: !this.options.updateComboStructure,
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
this.hiddenEdges.forEach((edge) => {
|
|
279
|
+
this.graph.drawTransient('edge', edge.id, {});
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// Hide original edges and nodes. They will be restored when pointerup.
|
|
283
|
+
this.graph.executeWithoutStacking(() => {
|
|
284
|
+
this.graph.hideItem(selectedComboIds, true);
|
|
285
|
+
this.graph.hideItem(
|
|
286
|
+
this.hiddenEdges.map((edge) => edge.id),
|
|
287
|
+
true,
|
|
288
|
+
);
|
|
289
|
+
this.graph.hideItem(
|
|
290
|
+
this.hiddenComboTreeRoots.map((child) => child.id),
|
|
291
|
+
true,
|
|
292
|
+
);
|
|
293
|
+
});
|
|
294
|
+
} else {
|
|
295
|
+
this.graph.frontItem(selectedComboIds);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// Throttle moving.
|
|
299
|
+
if (this.options.throttle > 0) {
|
|
300
|
+
this.throttledMoveCombos = throttle(
|
|
301
|
+
this.moveCombos,
|
|
302
|
+
this.options.throttle,
|
|
303
|
+
{ leading: true, trailing: true },
|
|
304
|
+
);
|
|
305
|
+
} else {
|
|
306
|
+
this.throttledMoveCombos = this.moveCombos;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
this.originX = event.canvas.x;
|
|
310
|
+
this.originY = event.canvas.y;
|
|
311
|
+
this.previousX = event.canvas.x;
|
|
312
|
+
this.previousY = event.canvas.y;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
if (!this.originPositions.length || !this.dragging) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// @ts-ignore FIXME: type
|
|
320
|
+
const pointerEvent = event as PointerEvent;
|
|
321
|
+
// @ts-ignore FIXME: Type
|
|
322
|
+
const deltaX = pointerEvent.canvas.x - this.previousX;
|
|
323
|
+
// @ts-ignore FIXME: Type
|
|
324
|
+
const deltaY = pointerEvent.canvas.y - this.previousY;
|
|
325
|
+
|
|
326
|
+
if (this.options.enableDelegate) {
|
|
327
|
+
this.moveDelegate(deltaX, deltaY);
|
|
328
|
+
} else {
|
|
329
|
+
const enableTransient =
|
|
330
|
+
this.options.enableTransient && this.graph.rendererType !== 'webgl-3d';
|
|
331
|
+
this.throttledMoveCombos(
|
|
332
|
+
deltaX,
|
|
333
|
+
deltaY,
|
|
334
|
+
enableTransient,
|
|
335
|
+
!this.options.updateComboStructure,
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
public moveCombos(
|
|
341
|
+
deltaX: number,
|
|
342
|
+
deltaY: number,
|
|
343
|
+
transient: boolean,
|
|
344
|
+
upsertAncestors = true,
|
|
345
|
+
callback?: (positions: Position[]) => void,
|
|
346
|
+
) {
|
|
347
|
+
if (transient) {
|
|
348
|
+
// Move transient nodes
|
|
349
|
+
this.originPositions.forEach(({ id, x, y }) => {
|
|
350
|
+
this.graph.drawTransient('combo', id, {
|
|
351
|
+
data: {
|
|
352
|
+
x: x + deltaX,
|
|
353
|
+
y: y + deltaY,
|
|
354
|
+
},
|
|
355
|
+
upsertAncestors,
|
|
356
|
+
});
|
|
357
|
+
});
|
|
358
|
+
// Update transient edges.
|
|
359
|
+
this.hiddenEdges.forEach((edge) => {
|
|
360
|
+
this.graph.drawTransient('edge', edge.id, {});
|
|
361
|
+
});
|
|
362
|
+
} else {
|
|
363
|
+
const positions = [...this.originPositions];
|
|
364
|
+
this.graph.moveCombo(
|
|
365
|
+
this.originPositions.map(({ id }) => id),
|
|
366
|
+
deltaX,
|
|
367
|
+
deltaY,
|
|
368
|
+
upsertAncestors,
|
|
369
|
+
() => callback?.(positions),
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
this.previousX += deltaX;
|
|
374
|
+
this.previousY += deltaY;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
public throttledMoveCombos: Function = (
|
|
378
|
+
deltaX: number,
|
|
379
|
+
deltaY: number,
|
|
380
|
+
transient: boolean,
|
|
381
|
+
upsertAncestors = true,
|
|
382
|
+
) => {
|
|
383
|
+
// Should be overrided when drag start.
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
public moveDelegate(deltaX: number, deltaY: number) {
|
|
387
|
+
const x1 = Math.min(
|
|
388
|
+
...this.originPositions.map((position) => position.minX),
|
|
389
|
+
);
|
|
390
|
+
const y1 = Math.min(
|
|
391
|
+
...this.originPositions.map((position) => position.minY),
|
|
392
|
+
);
|
|
393
|
+
const x2 = Math.max(
|
|
394
|
+
...this.originPositions.map((position) => position.maxX),
|
|
395
|
+
);
|
|
396
|
+
const y2 = Math.max(
|
|
397
|
+
...this.originPositions.map((position) => position.maxY),
|
|
398
|
+
);
|
|
399
|
+
this.graph.drawTransient('rect', DELEGATE_SHAPE_ID, {
|
|
400
|
+
style: {
|
|
401
|
+
x: x1 + deltaX,
|
|
402
|
+
y: y1 + deltaY,
|
|
403
|
+
width: x2 - x1,
|
|
404
|
+
height: y2 - y1,
|
|
405
|
+
...this.options.delegateStyle,
|
|
406
|
+
},
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
public clearDelegate() {
|
|
411
|
+
this.graph.drawTransient('rect', DELEGATE_SHAPE_ID, { action: 'remove' });
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
public clearTransientItems() {
|
|
415
|
+
this.hiddenEdges.forEach((edge) => {
|
|
416
|
+
this.graph.drawTransient('combo', edge.source, { action: 'remove' });
|
|
417
|
+
this.graph.drawTransient('combo', edge.target, { action: 'remove' });
|
|
418
|
+
this.graph.drawTransient('edge', edge.id, { action: 'remove' });
|
|
419
|
+
});
|
|
420
|
+
this.hiddenComboTreeRoots.forEach((item) => {
|
|
421
|
+
const isCombo = item.data._isCombo;
|
|
422
|
+
this.graph.drawTransient(isCombo ? 'combo' : 'node', item.id, {
|
|
423
|
+
action: 'remove',
|
|
424
|
+
});
|
|
425
|
+
});
|
|
426
|
+
this.originPositions.forEach(({ id }) => {
|
|
427
|
+
this.graph.drawTransient('combo', id, { action: 'remove' });
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
public restoreHiddenItems(positions?: Position[]) {
|
|
432
|
+
this.graph.pauseStacking();
|
|
433
|
+
if (this.hiddenEdges.length) {
|
|
434
|
+
this.graph.showItem(
|
|
435
|
+
this.hiddenEdges.map((edge) => edge.id),
|
|
436
|
+
true,
|
|
437
|
+
);
|
|
438
|
+
this.hiddenEdges = [];
|
|
439
|
+
}
|
|
440
|
+
if (this.hiddenComboTreeRoots.length) {
|
|
441
|
+
this.graph.showItem(
|
|
442
|
+
this.hiddenComboTreeRoots.map((model) => model.id),
|
|
443
|
+
true,
|
|
444
|
+
);
|
|
445
|
+
this.hiddenComboTreeRoots = [];
|
|
446
|
+
}
|
|
447
|
+
const enableTransient =
|
|
448
|
+
this.options.enableTransient && this.graph.rendererType !== 'webgl-3d';
|
|
449
|
+
if (enableTransient) {
|
|
450
|
+
this.graph.showItem(
|
|
451
|
+
this.originPositions.concat(positions).map((position) => position.id),
|
|
452
|
+
true,
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
this.graph.resumeStacking();
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
public onPointerUp(event: IG6GraphEvent) {
|
|
459
|
+
this.pointerDown = undefined;
|
|
460
|
+
this.dragging = false;
|
|
461
|
+
const enableTransient =
|
|
462
|
+
this.options.enableTransient && this.graph.rendererType !== 'webgl-3d';
|
|
463
|
+
// If transient or delegate was enabled, move the real nodes.
|
|
464
|
+
// if (enableTransient || this.options.enableDelegate) {
|
|
465
|
+
// @ts-ignore FIXME: type
|
|
466
|
+
const pointerEvent = event as PointerEvent;
|
|
467
|
+
const baseX = enableTransient ? this.originX : this.previousX;
|
|
468
|
+
const baseY = enableTransient ? this.originY : this.previousY;
|
|
469
|
+
// @ts-ignore FIXME: Type
|
|
470
|
+
const deltaX = pointerEvent.canvas.x - baseX + 0.01;
|
|
471
|
+
// @ts-ignore FIXME: Type
|
|
472
|
+
const deltaY = pointerEvent.canvas.y - baseY + 0.01;
|
|
473
|
+
this.moveCombos(
|
|
474
|
+
deltaX,
|
|
475
|
+
deltaY,
|
|
476
|
+
false,
|
|
477
|
+
true,
|
|
478
|
+
debounce(
|
|
479
|
+
(positions) => {
|
|
480
|
+
// restore the hidden items after move real combos done
|
|
481
|
+
if (enableTransient) {
|
|
482
|
+
this.clearTransientItems();
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
if (this.options.enableDelegate) {
|
|
486
|
+
this.clearDelegate();
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
// Restore all hidden items.
|
|
490
|
+
// For all hideRelatedEdges, enableTransient and enableDelegate cases.
|
|
491
|
+
this.restoreHiddenItems(positions);
|
|
492
|
+
// Emit event.
|
|
493
|
+
if (this.options.eventName) {
|
|
494
|
+
this.graph.emit(this.options.eventName, {
|
|
495
|
+
itemIds: positions.map((position) => position.id),
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
// Reset state.
|
|
500
|
+
this.originPositions = [];
|
|
501
|
+
},
|
|
502
|
+
16,
|
|
503
|
+
false,
|
|
504
|
+
),
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
public onKeydown(event: KeyboardEvent) {
|
|
509
|
+
if (event.key !== 'Escape' && event.key !== 'Esc') {
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
this.clearDelegate();
|
|
513
|
+
this.clearTransientItems();
|
|
514
|
+
this.restoreHiddenItems();
|
|
515
|
+
|
|
516
|
+
const enableTransient =
|
|
517
|
+
this.options.enableTransient && this.graph.rendererType !== 'webgl-3d';
|
|
518
|
+
// Restore node positions.
|
|
519
|
+
if (!enableTransient && !this.options.enableDelegate) {
|
|
520
|
+
const positionChanges = this.originPositions.map(({ id, x, y }) => {
|
|
521
|
+
return { id, data: { x, y } };
|
|
522
|
+
});
|
|
523
|
+
this.graph.updateComboPosition(positionChanges);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
this.originPositions = [];
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
public onDropNode(event: IG6GraphEvent) {
|
|
530
|
+
const elements = this.graph.canvas.document.elementsFromPointSync(
|
|
531
|
+
event.canvas.x,
|
|
532
|
+
event.canvas.y,
|
|
533
|
+
);
|
|
534
|
+
const draggingIds = this.originPositions.map(({ id }) => id);
|
|
535
|
+
const currentIds = elements
|
|
536
|
+
// @ts-ignore TODO: G type
|
|
537
|
+
.map((ele) => ele.parentNode.getAttribute?.('data-item-id'))
|
|
538
|
+
.filter((id) => id !== undefined && !draggingIds.includes(id));
|
|
539
|
+
// the top item which is not in draggingIds
|
|
540
|
+
const dropId = currentIds.find(
|
|
541
|
+
(id) => this.graph.getComboData(id) || this.graph.getNodeData(id),
|
|
542
|
+
);
|
|
543
|
+
// drop on a node A, move the dragged node to the same parent of A
|
|
544
|
+
const newParentId = this.graph.getNodeData(dropId)
|
|
545
|
+
? this.graph.getNodeData(dropId).data.parentId
|
|
546
|
+
: dropId;
|
|
547
|
+
|
|
548
|
+
this.originPositions.forEach(({ id }) => {
|
|
549
|
+
const model = this.graph.getComboData(id);
|
|
550
|
+
if (!model) return;
|
|
551
|
+
const { parentId } = model.data;
|
|
552
|
+
// if the parents are same, do nothing
|
|
553
|
+
if (parentId === newParentId) return;
|
|
554
|
+
|
|
555
|
+
// update data to change the structure
|
|
556
|
+
// if newParentId is undefined, new parent is the canvas
|
|
557
|
+
this.graph.updateData('node', { id, data: { parentId: newParentId } });
|
|
558
|
+
});
|
|
559
|
+
this.onPointerUp(event);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
public onDropCombo(event: IG6GraphEvent) {
|
|
563
|
+
const newParentId = event.itemId;
|
|
564
|
+
this.graph.startBatch();
|
|
565
|
+
this.originPositions.forEach(({ id }) => {
|
|
566
|
+
const model = this.graph.getComboData(id);
|
|
567
|
+
if (!model || model.id === newParentId) return;
|
|
568
|
+
const { parentId } = model.data;
|
|
569
|
+
if (parentId === newParentId) return;
|
|
570
|
+
// event.stopPropagation();
|
|
571
|
+
this.graph.updateData('combo', { id, data: { parentId: newParentId } });
|
|
572
|
+
});
|
|
573
|
+
this.graph.stopBatch();
|
|
574
|
+
this.onPointerUp(event);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
public onDropCanvas(event: IG6GraphEvent) {
|
|
578
|
+
this.graph.startBatch();
|
|
579
|
+
this.originPositions.forEach(({ id }) => {
|
|
580
|
+
const model = this.graph.getComboData(id);
|
|
581
|
+
if (!model) return;
|
|
582
|
+
const { parentId } = model.data;
|
|
583
|
+
if (!parentId) return;
|
|
584
|
+
this.graph.updateData('combo', { id, data: { parentId: undefined } });
|
|
585
|
+
});
|
|
586
|
+
this.graph.stopBatch();
|
|
587
|
+
this.onPointerUp(event);
|
|
588
|
+
}
|
|
589
|
+
}
|