@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
package/esm/runtime/graph.js
CHANGED
|
@@ -7,18 +7,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
+
var t = {};
|
|
12
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
+
t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
+
t[p[i]] = s[p[i]];
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
10
21
|
import EventEmitter from '@antv/event-emitter';
|
|
11
|
-
import {
|
|
12
|
-
import { isArray, isNil, isNumber, isObject, isString } from '@antv/util';
|
|
22
|
+
import { clone, groupBy, isArray, isEmpty, isEqual, isNil, isNumber, isObject, isString, map, } from '@antv/util';
|
|
13
23
|
import { changeRenderer, createCanvas } from '../util/canvas';
|
|
14
24
|
import { formatPadding } from '../util/shape';
|
|
15
25
|
import { DataController, ExtensionController, InteractionController, ItemController, LayoutController, ThemeController, ViewportController, } from './controller';
|
|
16
26
|
import { PluginController } from './controller/plugin';
|
|
17
27
|
import Hook from './hooks';
|
|
18
|
-
/**
|
|
19
|
-
* Disable CSS parsing for better performance.
|
|
20
|
-
*/
|
|
21
|
-
runtime.enableCSSParsing = false;
|
|
22
28
|
export default class Graph extends EventEmitter {
|
|
23
29
|
constructor(spec) {
|
|
24
30
|
super();
|
|
@@ -27,12 +33,27 @@ export default class Graph extends EventEmitter {
|
|
|
27
33
|
type: 'spec',
|
|
28
34
|
base: 'light',
|
|
29
35
|
},
|
|
36
|
+
enableStack: true,
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Execute a callback without allowing any stacking operations.
|
|
40
|
+
* @param callback
|
|
41
|
+
*/
|
|
42
|
+
this.executeWithoutStacking = (callback) => {
|
|
43
|
+
const history = this.getHistoryPlugin();
|
|
44
|
+
history === null || history === void 0 ? void 0 : history.pauseStacking();
|
|
45
|
+
try {
|
|
46
|
+
callback();
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
history === null || history === void 0 ? void 0 : history.resumeStacking();
|
|
50
|
+
}
|
|
30
51
|
};
|
|
31
|
-
// TODO: analyse cfg
|
|
32
52
|
this.specification = Object.assign({}, this.defaultSpecification, spec);
|
|
33
53
|
this.initHooks();
|
|
34
54
|
this.initCanvas();
|
|
35
55
|
this.initControllers();
|
|
56
|
+
this.initHistory();
|
|
36
57
|
this.hooks.init.emit({
|
|
37
58
|
canvases: {
|
|
38
59
|
background: this.backgroundCanvas,
|
|
@@ -60,7 +81,7 @@ export default class Graph extends EventEmitter {
|
|
|
60
81
|
this.pluginController = new PluginController(this);
|
|
61
82
|
}
|
|
62
83
|
initCanvas() {
|
|
63
|
-
const { renderer, container, width, height } = this.specification;
|
|
84
|
+
const { renderer, container, canvas, backgroundCanvas, transientCanvas, width, height, } = this.specification;
|
|
64
85
|
let pixelRatio;
|
|
65
86
|
if (renderer && !isString(renderer)) {
|
|
66
87
|
// @ts-ignore
|
|
@@ -72,28 +93,68 @@ export default class Graph extends EventEmitter {
|
|
|
72
93
|
// @ts-ignore
|
|
73
94
|
this.rendererType = renderer || 'canvas';
|
|
74
95
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
this.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
this.container = containerDOM;
|
|
84
|
-
const size = [width, height];
|
|
85
|
-
if (size[0] === undefined) {
|
|
86
|
-
size[0] = containerDOM.scrollWidth;
|
|
96
|
+
/**
|
|
97
|
+
* These 3 canvases can be passed in by users, e.g. when doing serverside rendering we can't use DOM API.
|
|
98
|
+
*/
|
|
99
|
+
if (canvas) {
|
|
100
|
+
this.canvas = canvas;
|
|
101
|
+
this.backgroundCanvas = backgroundCanvas;
|
|
102
|
+
this.transientCanvas = transientCanvas;
|
|
103
|
+
this.container = container;
|
|
87
104
|
}
|
|
88
|
-
|
|
89
|
-
|
|
105
|
+
else {
|
|
106
|
+
const containerDOM = isString(container)
|
|
107
|
+
? document.getElementById(container)
|
|
108
|
+
: container;
|
|
109
|
+
if (!containerDOM) {
|
|
110
|
+
console.error(`Create graph failed. The container for graph ${containerDOM} is not exist.`);
|
|
111
|
+
this.destroy();
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
this.container = containerDOM;
|
|
115
|
+
const size = [width, height];
|
|
116
|
+
if (size[0] === undefined) {
|
|
117
|
+
size[0] = containerDOM.scrollWidth;
|
|
118
|
+
}
|
|
119
|
+
if (size[1] === undefined) {
|
|
120
|
+
size[1] = containerDOM.scrollHeight;
|
|
121
|
+
}
|
|
122
|
+
this.backgroundCanvas = createCanvas(this.rendererType, containerDOM, size[0], size[1], pixelRatio);
|
|
123
|
+
this.canvas = createCanvas(this.rendererType, containerDOM, size[0], size[1], pixelRatio);
|
|
124
|
+
this.transientCanvas = createCanvas(this.rendererType, containerDOM, size[0], size[1], pixelRatio);
|
|
90
125
|
}
|
|
91
|
-
this.backgroundCanvas
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
126
|
+
Promise.all([this.backgroundCanvas, this.canvas, this.transientCanvas].map((canvas) => canvas.ready)).then(() => {
|
|
127
|
+
[this.backgroundCanvas, this.canvas, this.transientCanvas].forEach((canvas, i) => {
|
|
128
|
+
const $domElement = canvas
|
|
129
|
+
.getContextService()
|
|
130
|
+
.getDomElement();
|
|
131
|
+
if ($domElement && $domElement.style) {
|
|
132
|
+
$domElement.style.position = 'fixed';
|
|
133
|
+
$domElement.style.outline = 'none';
|
|
134
|
+
$domElement.tabIndex = 1; // Enable keyboard events
|
|
135
|
+
// Transient canvas should let interactive events go through.
|
|
136
|
+
if (i === 2) {
|
|
137
|
+
$domElement.style.pointerEvents = 'none';
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
this.canvasReady = true;
|
|
95
142
|
});
|
|
96
|
-
|
|
143
|
+
}
|
|
144
|
+
initHistory() {
|
|
145
|
+
const { enableStack, stackCfg } = this.specification;
|
|
146
|
+
if (enableStack) {
|
|
147
|
+
const history = {
|
|
148
|
+
type: 'history',
|
|
149
|
+
key: 'history',
|
|
150
|
+
enableStack,
|
|
151
|
+
stackCfg,
|
|
152
|
+
};
|
|
153
|
+
if (!this.specification.plugins) {
|
|
154
|
+
this.specification.plugins = [];
|
|
155
|
+
}
|
|
156
|
+
this.specification.plugins.push(history);
|
|
157
|
+
}
|
|
97
158
|
}
|
|
98
159
|
/**
|
|
99
160
|
* Change the renderer at runtime.
|
|
@@ -127,9 +188,13 @@ export default class Graph extends EventEmitter {
|
|
|
127
188
|
itemvisibilitychange: new Hook({
|
|
128
189
|
name: 'itemvisibilitychange',
|
|
129
190
|
}),
|
|
191
|
+
itemzindexchange: new Hook({
|
|
192
|
+
name: 'itemzindexchange',
|
|
193
|
+
}),
|
|
130
194
|
transientupdate: new Hook({ name: 'transientupdate' }),
|
|
131
195
|
pluginchange: new Hook({ name: 'pluginchange' }),
|
|
132
196
|
themechange: new Hook({ name: 'init' }),
|
|
197
|
+
treecollapseexpand: new Hook({ name: 'treecollapseexpand' }),
|
|
133
198
|
destroy: new Hook({ name: 'destroy' }),
|
|
134
199
|
};
|
|
135
200
|
}
|
|
@@ -182,6 +247,30 @@ export default class Graph extends EventEmitter {
|
|
|
182
247
|
transientCanvas: this.transientCanvas,
|
|
183
248
|
});
|
|
184
249
|
this.emit('afterrender');
|
|
250
|
+
this.once('afterlayout', () => __awaiter(this, void 0, void 0, function* () {
|
|
251
|
+
const { autoFit } = this.specification;
|
|
252
|
+
if (autoFit) {
|
|
253
|
+
if (autoFit === 'view') {
|
|
254
|
+
yield this.fitView();
|
|
255
|
+
}
|
|
256
|
+
else if (autoFit === 'center') {
|
|
257
|
+
yield this.fitCenter();
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
const { type, effectTiming } = autoFit, others = __rest(autoFit, ["type", "effectTiming"]);
|
|
261
|
+
if (type === 'view') {
|
|
262
|
+
yield this.fitView(others, effectTiming);
|
|
263
|
+
}
|
|
264
|
+
else if (type === 'center') {
|
|
265
|
+
yield this.fitCenter(effectTiming);
|
|
266
|
+
}
|
|
267
|
+
else if (type === 'position') {
|
|
268
|
+
// TODO: align
|
|
269
|
+
yield this.translateTo(others.position, effectTiming);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}));
|
|
185
274
|
yield this.layout();
|
|
186
275
|
});
|
|
187
276
|
if (this.canvasReady) {
|
|
@@ -217,7 +306,11 @@ export default class Graph extends EventEmitter {
|
|
|
217
306
|
* @returns
|
|
218
307
|
*/
|
|
219
308
|
clear() {
|
|
220
|
-
|
|
309
|
+
this.startBatch();
|
|
310
|
+
this.removeData('edge', this.getAllEdgesData().map((edge) => edge.id));
|
|
311
|
+
this.removeData('node', this.getAllNodesData().map((node) => node.id));
|
|
312
|
+
this.removeData('combo', this.getAllCombosData().map((combo) => combo.id));
|
|
313
|
+
this.stopBatch();
|
|
221
314
|
}
|
|
222
315
|
getViewportCenter() {
|
|
223
316
|
const { width, height } = this.canvas.getConfig();
|
|
@@ -398,7 +491,7 @@ export default class Graph extends EventEmitter {
|
|
|
398
491
|
return __awaiter(this, void 0, void 0, function* () {
|
|
399
492
|
let bounds = null;
|
|
400
493
|
for (const itemId of !isArray(id) ? [id] : id) {
|
|
401
|
-
const item = this.
|
|
494
|
+
const item = this.getItemById(itemId);
|
|
402
495
|
if (item) {
|
|
403
496
|
const itemBounds = item.group.getBounds();
|
|
404
497
|
if (!bounds) {
|
|
@@ -415,6 +508,14 @@ export default class Graph extends EventEmitter {
|
|
|
415
508
|
}
|
|
416
509
|
});
|
|
417
510
|
}
|
|
511
|
+
/**
|
|
512
|
+
* Get item by id. We don't want to
|
|
513
|
+
* @param id
|
|
514
|
+
* @returns Node | Edge | Combo
|
|
515
|
+
*/
|
|
516
|
+
getItemById(id) {
|
|
517
|
+
return this.itemController.getItemById(id);
|
|
518
|
+
}
|
|
418
519
|
/**
|
|
419
520
|
* Get the size of the graph canvas.
|
|
420
521
|
* @returns [width, height]
|
|
@@ -539,20 +640,47 @@ export default class Graph extends EventEmitter {
|
|
|
539
640
|
/**
|
|
540
641
|
* Get one-hop edge ids from a start node.
|
|
541
642
|
* @param nodeId id of the start node
|
|
542
|
-
* @returns one-hop
|
|
643
|
+
* @returns one-hop edges' data array
|
|
543
644
|
* @group Data
|
|
544
645
|
*/
|
|
545
646
|
getRelatedEdgesData(nodeId, direction = 'both') {
|
|
546
|
-
return this.dataController.
|
|
647
|
+
return this.dataController.findRelatedEdges(nodeId, direction);
|
|
547
648
|
}
|
|
548
649
|
/**
|
|
549
650
|
* Get one-hop node ids from a start node.
|
|
550
651
|
* @param nodeId id of the start node
|
|
551
|
-
* @returns one-hop
|
|
652
|
+
* @returns one-hop nodes' data array
|
|
552
653
|
* @group Data
|
|
553
654
|
*/
|
|
554
655
|
getNeighborNodesData(nodeId, direction = 'both') {
|
|
555
|
-
return this.dataController.
|
|
656
|
+
return this.dataController.findNeighborNodes(nodeId, direction);
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Get the children's data of a combo.
|
|
660
|
+
* @param comboId combo id
|
|
661
|
+
* @returns children's data array
|
|
662
|
+
* @group Data
|
|
663
|
+
*/
|
|
664
|
+
getComboChildrenData(comboId) {
|
|
665
|
+
return this.dataController.findChildren(comboId, 'combo');
|
|
666
|
+
}
|
|
667
|
+
/*
|
|
668
|
+
* Get the display model of a node / edge / combo.
|
|
669
|
+
* @param id item id
|
|
670
|
+
* @returns display model
|
|
671
|
+
* @group Data
|
|
672
|
+
*/
|
|
673
|
+
getDisplayModel(id) {
|
|
674
|
+
return this.itemController.findDisplayModel(id);
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Retrieve the nearby edges for a given node using quadtree collision detection.
|
|
678
|
+
* @param nodeId node id
|
|
679
|
+
* @group Data
|
|
680
|
+
*/
|
|
681
|
+
getNearEdgesForNode(nodeId) {
|
|
682
|
+
const { graphCore } = this.dataController;
|
|
683
|
+
return this.itemController.findNearEdgesByNode(nodeId, graphCore);
|
|
556
684
|
}
|
|
557
685
|
/**
|
|
558
686
|
* Find items which has the state.
|
|
@@ -565,7 +693,11 @@ export default class Graph extends EventEmitter {
|
|
|
565
693
|
findIdByState(itemType, state, value = true, additionalFilter) {
|
|
566
694
|
let ids = this.itemController.findIdByState(itemType, state, value);
|
|
567
695
|
if (additionalFilter) {
|
|
568
|
-
|
|
696
|
+
let getDataFunc = this.getEdgeData;
|
|
697
|
+
if (itemType === 'node')
|
|
698
|
+
getDataFunc = this.getNodeData;
|
|
699
|
+
else if (itemType === 'combo')
|
|
700
|
+
getDataFunc = this.getComboData;
|
|
569
701
|
ids = ids.filter((id) => additionalFilter(getDataFunc(id)));
|
|
570
702
|
}
|
|
571
703
|
return ids;
|
|
@@ -574,24 +706,30 @@ export default class Graph extends EventEmitter {
|
|
|
574
706
|
* Add one or more node/edge/combo data to the graph.
|
|
575
707
|
* @param itemType item type
|
|
576
708
|
* @param model user data
|
|
577
|
-
* @param stack whether push this operation to stack
|
|
578
709
|
* @returns whether success
|
|
579
710
|
* @group Data
|
|
580
711
|
*/
|
|
581
|
-
addData(itemType, models
|
|
712
|
+
addData(itemType, models) {
|
|
582
713
|
// data controller and item controller subscribe additem in order
|
|
583
714
|
const { graphCore } = this.dataController;
|
|
584
715
|
const { specification } = this.themeController;
|
|
585
716
|
graphCore.once('changed', (event) => {
|
|
586
717
|
if (!event.changes.length)
|
|
587
718
|
return;
|
|
719
|
+
const changes = event.changes;
|
|
588
720
|
this.hooks.itemchange.emit({
|
|
589
721
|
type: itemType,
|
|
590
722
|
changes: graphCore.reduceChanges(event.changes),
|
|
591
723
|
graphCore,
|
|
592
724
|
theme: specification,
|
|
593
725
|
});
|
|
594
|
-
this.emit('afteritemchange', {
|
|
726
|
+
this.emit('afteritemchange', {
|
|
727
|
+
type: itemType,
|
|
728
|
+
action: 'add',
|
|
729
|
+
models,
|
|
730
|
+
apiName: 'addData',
|
|
731
|
+
changes,
|
|
732
|
+
});
|
|
595
733
|
});
|
|
596
734
|
const modelArr = isArray(models) ? models : [models];
|
|
597
735
|
const data = { nodes: [], edges: [], combos: [] };
|
|
@@ -606,47 +744,100 @@ export default class Graph extends EventEmitter {
|
|
|
606
744
|
/**
|
|
607
745
|
* Remove one or more node/edge/combo data from the graph.
|
|
608
746
|
* @param item the item to be removed
|
|
609
|
-
* @param stack whether push this operation to stack
|
|
610
747
|
* @returns whether success
|
|
611
748
|
* @group Data
|
|
612
749
|
*/
|
|
613
|
-
removeData(itemType, ids
|
|
750
|
+
removeData(itemType, ids) {
|
|
614
751
|
const idArr = isArray(ids) ? ids : [ids];
|
|
615
752
|
const data = { nodes: [], edges: [], combos: [] };
|
|
616
753
|
const { userGraphCore, graphCore } = this.dataController;
|
|
617
754
|
const { specification } = this.themeController;
|
|
618
|
-
const getItem = itemType === 'edge' ? userGraphCore.getEdge : userGraphCore.getNode;
|
|
755
|
+
const getItem = itemType === 'edge' ? userGraphCore.getEdge : userGraphCore.getNode;
|
|
619
756
|
data[`${itemType}s`] = idArr.map((id) => getItem.bind(userGraphCore)(id));
|
|
620
757
|
graphCore.once('changed', (event) => {
|
|
621
758
|
if (!event.changes.length)
|
|
622
759
|
return;
|
|
760
|
+
const changes = event.changes;
|
|
623
761
|
this.hooks.itemchange.emit({
|
|
624
762
|
type: itemType,
|
|
625
763
|
changes: event.changes,
|
|
626
764
|
graphCore,
|
|
627
765
|
theme: specification,
|
|
628
766
|
});
|
|
629
|
-
this.emit('afteritemchange', {
|
|
767
|
+
this.emit('afteritemchange', {
|
|
768
|
+
type: itemType,
|
|
769
|
+
action: 'remove',
|
|
770
|
+
ids: idArr,
|
|
771
|
+
apiName: 'removeData',
|
|
772
|
+
changes,
|
|
773
|
+
});
|
|
630
774
|
});
|
|
631
775
|
this.hooks.datachange.emit({
|
|
632
776
|
data,
|
|
633
777
|
type: 'remove',
|
|
634
778
|
});
|
|
635
779
|
}
|
|
780
|
+
/**
|
|
781
|
+
* Extends the fields of oldValue and newValue
|
|
782
|
+
* to make sure they both contain the union set of their original fields.
|
|
783
|
+
* The missing fields' values are filled using data from displayModel data.
|
|
784
|
+
* @param changes
|
|
785
|
+
* @returns
|
|
786
|
+
*/
|
|
787
|
+
extendChanges(changes) {
|
|
788
|
+
return changes
|
|
789
|
+
.map((change) => {
|
|
790
|
+
const { id, propertyName, oldValue, newValue } = change;
|
|
791
|
+
if (!oldValue || !newValue)
|
|
792
|
+
return change;
|
|
793
|
+
if (propertyName) {
|
|
794
|
+
if (oldValue !== newValue)
|
|
795
|
+
return change;
|
|
796
|
+
return false;
|
|
797
|
+
}
|
|
798
|
+
const displayData = this.getItemById(id).displayModel.data;
|
|
799
|
+
const oldFields = Object.keys(oldValue);
|
|
800
|
+
const newFields = Object.keys(newValue);
|
|
801
|
+
const commonFields = [...new Set([...oldFields, ...newFields])];
|
|
802
|
+
commonFields.forEach((field) => {
|
|
803
|
+
if (!Object.prototype.hasOwnProperty.call(oldValue, field)) {
|
|
804
|
+
oldValue[field] = displayData[field];
|
|
805
|
+
}
|
|
806
|
+
if (!Object.prototype.hasOwnProperty.call(newValue, field)) {
|
|
807
|
+
newValue[field] = displayData[field];
|
|
808
|
+
}
|
|
809
|
+
});
|
|
810
|
+
if ((oldValue.x === undefined || Number.isNaN(oldValue.x)) &&
|
|
811
|
+
!oldValue._isCombo)
|
|
812
|
+
oldValue.x = 0;
|
|
813
|
+
if ((oldValue.y === undefined || Number.isNaN(oldValue.x)) &&
|
|
814
|
+
!oldValue._isCombo)
|
|
815
|
+
oldValue.y = 0;
|
|
816
|
+
if (Number.isNaN(newValue.x))
|
|
817
|
+
delete newValue.x;
|
|
818
|
+
if (Number.isNaN(newValue.y))
|
|
819
|
+
delete newValue.y;
|
|
820
|
+
if (isEqual(newValue, oldValue))
|
|
821
|
+
return false;
|
|
822
|
+
return Object.assign(Object.assign({}, change), { newValue,
|
|
823
|
+
oldValue });
|
|
824
|
+
})
|
|
825
|
+
.filter(Boolean);
|
|
826
|
+
}
|
|
636
827
|
/**
|
|
637
828
|
* Update one or more node/edge/combo data on the graph.
|
|
638
829
|
* @param {ITEM_TYPE} itemType 'node' | 'edge' | 'combo'
|
|
639
830
|
* @param models new configurations for every node/edge/combo, which has id field to indicate the specific item
|
|
640
|
-
* @param {boolean} stack whether push this operation into graph's stack, true by default
|
|
641
831
|
* @group Data
|
|
642
832
|
*/
|
|
643
|
-
updateData(itemType, models
|
|
833
|
+
updateData(itemType, models) {
|
|
644
834
|
const modelArr = isArray(models) ? models : [models];
|
|
645
835
|
const data = { nodes: [], edges: [], combos: [] };
|
|
646
836
|
data[`${itemType}s`] = modelArr;
|
|
647
837
|
const { graphCore } = this.dataController;
|
|
648
838
|
const { specification } = this.themeController;
|
|
649
839
|
graphCore.once('changed', (event) => {
|
|
840
|
+
const changes = this.extendChanges(clone(event.changes));
|
|
650
841
|
this.hooks.itemchange.emit({
|
|
651
842
|
type: itemType,
|
|
652
843
|
changes: event.changes,
|
|
@@ -657,6 +848,8 @@ export default class Graph extends EventEmitter {
|
|
|
657
848
|
type: itemType,
|
|
658
849
|
action: 'update',
|
|
659
850
|
models,
|
|
851
|
+
apiName: 'updateData',
|
|
852
|
+
changes,
|
|
660
853
|
});
|
|
661
854
|
});
|
|
662
855
|
this.hooks.datachange.emit({
|
|
@@ -670,51 +863,109 @@ export default class Graph extends EventEmitter {
|
|
|
670
863
|
* Update one or more nodes' positions,
|
|
671
864
|
* do not update other styles which leads to better performance than updating positions by updateData.
|
|
672
865
|
* @param models new configurations with x and y for every node, which has id field to indicate the specific item
|
|
673
|
-
* @param {boolean} stack whether push this operation into graph's stack, true by default
|
|
674
866
|
* @group Data
|
|
675
867
|
*/
|
|
676
|
-
updateNodePosition(models, stack) {
|
|
868
|
+
updateNodePosition(models, upsertAncestors, disableAnimate = false, callback, stack) {
|
|
869
|
+
return this.updatePosition('node', models, upsertAncestors, disableAnimate, callback, stack);
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* Update one or more combos' positions,
|
|
873
|
+
* do not update other styles which leads to better performance than updating positions by updateData.
|
|
874
|
+
* In fact, it changes the succeed nodes positions to affect the combo's position, but not modify the combo's position directly.
|
|
875
|
+
* @param models new configurations with x and y for every combo, which has id field to indicate the specific item
|
|
876
|
+
* @group Data
|
|
877
|
+
*/
|
|
878
|
+
updateComboPosition(models, upsertAncestors, disableAnimate = false, callback, stack) {
|
|
879
|
+
return this.updatePosition('combo', models, upsertAncestors, disableAnimate, callback, stack);
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* Get history plugin instance
|
|
883
|
+
*/
|
|
884
|
+
getHistoryPlugin() {
|
|
885
|
+
if (!this.specification.enableStack ||
|
|
886
|
+
!this.pluginController.hasPlugin('history')) {
|
|
887
|
+
console.error('The history plugin is not loaded or initialized.');
|
|
888
|
+
return;
|
|
889
|
+
}
|
|
890
|
+
return this.pluginController.getPlugin('history');
|
|
891
|
+
}
|
|
892
|
+
updatePosition(type, models, upsertAncestors, disableAnimate = false, callback, stack) {
|
|
677
893
|
const modelArr = isArray(models) ? models : [models];
|
|
678
894
|
const { graphCore } = this.dataController;
|
|
679
895
|
const { specification } = this.themeController;
|
|
680
896
|
graphCore.once('changed', (event) => {
|
|
681
897
|
if (!event.changes.length)
|
|
682
898
|
return;
|
|
899
|
+
const changes = event.changes.filter((change) => !isEqual(change.newValue, change.oldValue));
|
|
683
900
|
this.hooks.itemchange.emit({
|
|
684
|
-
type
|
|
901
|
+
type,
|
|
685
902
|
changes: event.changes,
|
|
686
903
|
graphCore,
|
|
687
904
|
theme: specification,
|
|
688
|
-
|
|
905
|
+
upsertAncestors,
|
|
906
|
+
action: 'updatePosition',
|
|
907
|
+
animate: !disableAnimate,
|
|
908
|
+
callback,
|
|
689
909
|
});
|
|
690
910
|
this.emit('afteritemchange', {
|
|
691
|
-
type
|
|
692
|
-
action: '
|
|
911
|
+
type,
|
|
912
|
+
action: 'updatePosition',
|
|
913
|
+
upsertAncestors,
|
|
693
914
|
models,
|
|
915
|
+
apiName: 'updatePosition',
|
|
916
|
+
changes,
|
|
694
917
|
});
|
|
695
918
|
});
|
|
696
919
|
this.hooks.datachange.emit({
|
|
697
920
|
data: {
|
|
698
|
-
nodes: modelArr,
|
|
921
|
+
nodes: type === 'node' ? modelArr : [],
|
|
699
922
|
edges: [],
|
|
923
|
+
combos: type === 'combo' ? modelArr : [],
|
|
700
924
|
},
|
|
701
925
|
type: 'update',
|
|
702
926
|
});
|
|
703
|
-
const dataList = this.dataController.findData(
|
|
927
|
+
const dataList = this.dataController.findData(type, modelArr.map((model) => model.id));
|
|
704
928
|
return isArray(models) ? dataList : dataList[0];
|
|
705
929
|
}
|
|
930
|
+
getItemPreviousVisibility(ids) {
|
|
931
|
+
const objs = ids.map((id) => ({ id, visible: this.getItemVisible(id) }));
|
|
932
|
+
const groupedByVisible = groupBy(objs, 'visible');
|
|
933
|
+
const values = [];
|
|
934
|
+
for (const visible in groupedByVisible) {
|
|
935
|
+
values.push({
|
|
936
|
+
ids: map(groupedByVisible[visible], (item) => item.id),
|
|
937
|
+
visible: visible === 'true',
|
|
938
|
+
});
|
|
939
|
+
}
|
|
940
|
+
return values;
|
|
941
|
+
}
|
|
706
942
|
/**
|
|
707
943
|
* Show the item(s).
|
|
708
944
|
* @param item the item to be shown
|
|
709
945
|
* @returns
|
|
710
946
|
* @group Item
|
|
711
947
|
*/
|
|
712
|
-
showItem(ids,
|
|
948
|
+
showItem(ids, disableAnimate = false) {
|
|
713
949
|
const idArr = isArray(ids) ? ids : [ids];
|
|
950
|
+
if (isEmpty(idArr))
|
|
951
|
+
return;
|
|
952
|
+
const changes = {
|
|
953
|
+
newValue: [{ ids: idArr, visible: true }],
|
|
954
|
+
oldValue: this.getItemPreviousVisibility(idArr),
|
|
955
|
+
};
|
|
714
956
|
this.hooks.itemvisibilitychange.emit({
|
|
715
957
|
ids: idArr,
|
|
716
958
|
value: true,
|
|
717
|
-
|
|
959
|
+
graphCore: this.dataController.graphCore,
|
|
960
|
+
animate: !disableAnimate,
|
|
961
|
+
});
|
|
962
|
+
this.emit('afteritemvisibilitychange', {
|
|
963
|
+
ids,
|
|
964
|
+
value: true,
|
|
965
|
+
animate: !disableAnimate,
|
|
966
|
+
action: 'updateVisibility',
|
|
967
|
+
apiName: 'showItem',
|
|
968
|
+
changes,
|
|
718
969
|
});
|
|
719
970
|
}
|
|
720
971
|
/**
|
|
@@ -723,12 +974,79 @@ export default class Graph extends EventEmitter {
|
|
|
723
974
|
* @returns
|
|
724
975
|
* @group Item
|
|
725
976
|
*/
|
|
726
|
-
hideItem(ids,
|
|
977
|
+
hideItem(ids, disableAnimate = false) {
|
|
727
978
|
const idArr = isArray(ids) ? ids : [ids];
|
|
979
|
+
if (isEmpty(idArr))
|
|
980
|
+
return;
|
|
981
|
+
const changes = {
|
|
982
|
+
newValue: [{ ids: idArr, visible: false }],
|
|
983
|
+
oldValue: this.getItemPreviousVisibility(idArr),
|
|
984
|
+
};
|
|
728
985
|
this.hooks.itemvisibilitychange.emit({
|
|
729
986
|
ids: idArr,
|
|
730
987
|
value: false,
|
|
731
|
-
|
|
988
|
+
graphCore: this.dataController.graphCore,
|
|
989
|
+
animate: !disableAnimate,
|
|
990
|
+
});
|
|
991
|
+
this.emit('afteritemvisibilitychange', {
|
|
992
|
+
ids,
|
|
993
|
+
value: false,
|
|
994
|
+
animate: !disableAnimate,
|
|
995
|
+
action: 'updateVisibility',
|
|
996
|
+
apiName: 'hideItem',
|
|
997
|
+
changes,
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
/**
|
|
1001
|
+
* Make the item(s) to the front.
|
|
1002
|
+
* @param ids
|
|
1003
|
+
* @returns
|
|
1004
|
+
* @group Item
|
|
1005
|
+
*/
|
|
1006
|
+
frontItem(ids) {
|
|
1007
|
+
const idArr = isArray(ids) ? ids : [ids];
|
|
1008
|
+
this.hooks.itemzindexchange.emit({
|
|
1009
|
+
ids: idArr,
|
|
1010
|
+
action: 'front',
|
|
1011
|
+
graphCore: this.dataController.graphCore,
|
|
1012
|
+
});
|
|
1013
|
+
this.emit('afteritemzindexchange', {
|
|
1014
|
+
ids: idArr,
|
|
1015
|
+
action: 'front',
|
|
1016
|
+
apiName: 'frontItem',
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
/**
|
|
1020
|
+
* Make the item(s) to the back.
|
|
1021
|
+
* @param ids
|
|
1022
|
+
* @returns
|
|
1023
|
+
* @group Item
|
|
1024
|
+
*/
|
|
1025
|
+
backItem(ids) {
|
|
1026
|
+
const idArr = isArray(ids) ? ids : [ids];
|
|
1027
|
+
this.hooks.itemzindexchange.emit({
|
|
1028
|
+
ids: idArr,
|
|
1029
|
+
action: 'back',
|
|
1030
|
+
graphCore: this.dataController.graphCore,
|
|
1031
|
+
});
|
|
1032
|
+
this.emit('afteritemzindexchange', {
|
|
1033
|
+
ids: idArr,
|
|
1034
|
+
action: 'back',
|
|
1035
|
+
apiName: 'backItem',
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
getItemPreviousStates(stateOption) {
|
|
1039
|
+
const { ids, states } = stateOption;
|
|
1040
|
+
const idArr = Array.isArray(ids) ? ids : [ids];
|
|
1041
|
+
const stateArr = Array.isArray(states) ? states : [states];
|
|
1042
|
+
if (isEmpty(idArr))
|
|
1043
|
+
return;
|
|
1044
|
+
return idArr.flatMap((id) => {
|
|
1045
|
+
return stateArr.map((state) => ({
|
|
1046
|
+
ids: id,
|
|
1047
|
+
states: state,
|
|
1048
|
+
value: this.getItemState(id, state),
|
|
1049
|
+
}));
|
|
732
1050
|
});
|
|
733
1051
|
}
|
|
734
1052
|
/**
|
|
@@ -742,12 +1060,24 @@ export default class Graph extends EventEmitter {
|
|
|
742
1060
|
setItemState(ids, states, value) {
|
|
743
1061
|
const idArr = isArray(ids) ? ids : [ids];
|
|
744
1062
|
const stateArr = isArray(states) ? states : [states];
|
|
1063
|
+
const stateOption = { ids: idArr, states: stateArr, value };
|
|
1064
|
+
const changes = {
|
|
1065
|
+
newValue: [stateOption],
|
|
1066
|
+
oldValue: this.getItemPreviousStates(stateOption),
|
|
1067
|
+
};
|
|
745
1068
|
this.hooks.itemstatechange.emit({
|
|
746
1069
|
ids: idArr,
|
|
747
1070
|
states: stateArr,
|
|
748
1071
|
value,
|
|
749
1072
|
});
|
|
750
|
-
this.emit('afteritemstatechange', {
|
|
1073
|
+
this.emit('afteritemstatechange', {
|
|
1074
|
+
ids,
|
|
1075
|
+
states,
|
|
1076
|
+
value,
|
|
1077
|
+
action: 'updateState',
|
|
1078
|
+
apiName: 'setItemState',
|
|
1079
|
+
changes,
|
|
1080
|
+
});
|
|
751
1081
|
}
|
|
752
1082
|
/**
|
|
753
1083
|
* Get the state value for an item.
|
|
@@ -759,6 +1089,15 @@ export default class Graph extends EventEmitter {
|
|
|
759
1089
|
getItemState(id, state) {
|
|
760
1090
|
return this.itemController.getItemState(id, state);
|
|
761
1091
|
}
|
|
1092
|
+
/**
|
|
1093
|
+
* Get all the state names with value true for an item.
|
|
1094
|
+
* @param id the id for the item
|
|
1095
|
+
* @returns {string[]} the state names with value true
|
|
1096
|
+
* @group Item
|
|
1097
|
+
*/
|
|
1098
|
+
getItemAllStates(id) {
|
|
1099
|
+
return this.itemController.getItemAllStates(id);
|
|
1100
|
+
}
|
|
762
1101
|
/**
|
|
763
1102
|
* Clear all the states for item(s).
|
|
764
1103
|
* @param ids the id(s) for the item(s) to be clear
|
|
@@ -768,12 +1107,24 @@ export default class Graph extends EventEmitter {
|
|
|
768
1107
|
*/
|
|
769
1108
|
clearItemState(ids, states) {
|
|
770
1109
|
const idArr = isArray(ids) ? ids : [ids];
|
|
1110
|
+
const stateOptions = { ids: idArr, states, value: false };
|
|
1111
|
+
const changes = {
|
|
1112
|
+
newValue: [stateOptions],
|
|
1113
|
+
oldValue: this.getItemPreviousStates(stateOptions),
|
|
1114
|
+
};
|
|
771
1115
|
this.hooks.itemstatechange.emit({
|
|
772
1116
|
ids: idArr,
|
|
773
1117
|
states,
|
|
774
1118
|
value: false,
|
|
775
1119
|
});
|
|
776
|
-
this.emit('afteritemstatechange', {
|
|
1120
|
+
this.emit('afteritemstatechange', {
|
|
1121
|
+
ids,
|
|
1122
|
+
states,
|
|
1123
|
+
value: false,
|
|
1124
|
+
action: 'updateState',
|
|
1125
|
+
apiName: 'clearItemState',
|
|
1126
|
+
changes,
|
|
1127
|
+
});
|
|
777
1128
|
}
|
|
778
1129
|
/**
|
|
779
1130
|
* Get the rendering bbox for a node / edge / combo, or the graph (when the id is not assigned).
|
|
@@ -781,10 +1132,10 @@ export default class Graph extends EventEmitter {
|
|
|
781
1132
|
* @returns rendering bounding box. returns false if the item is not exist
|
|
782
1133
|
* @group Item
|
|
783
1134
|
*/
|
|
784
|
-
getRenderBBox(id) {
|
|
1135
|
+
getRenderBBox(id, onlyKeyShape = false, isTransient = false) {
|
|
785
1136
|
if (!id)
|
|
786
1137
|
return this.canvas.getRoot().getRenderBounds();
|
|
787
|
-
return this.itemController.getItemBBox(id);
|
|
1138
|
+
return this.itemController.getItemBBox(id, onlyKeyShape, isTransient);
|
|
788
1139
|
}
|
|
789
1140
|
/**
|
|
790
1141
|
* Get the visibility for a node / edge / combo.
|
|
@@ -797,47 +1148,137 @@ export default class Graph extends EventEmitter {
|
|
|
797
1148
|
}
|
|
798
1149
|
// ===== combo operations =====
|
|
799
1150
|
/**
|
|
800
|
-
*
|
|
801
|
-
*
|
|
802
|
-
* @param
|
|
1151
|
+
* Add a new combo to the graph, and update the structure of the existed child in childrenIds to be the children of the new combo.
|
|
1152
|
+
* Different from addData with combo type, this API update the succeeds' combo tree strucutres in the same time.
|
|
1153
|
+
* @param model combo user data
|
|
1154
|
+
* @returns whether success
|
|
803
1155
|
* @group Combo
|
|
804
1156
|
*/
|
|
805
|
-
|
|
806
|
-
|
|
1157
|
+
addCombo(model, childrenIds) {
|
|
1158
|
+
const { graphCore } = this.dataController;
|
|
1159
|
+
const { specification } = this.themeController;
|
|
1160
|
+
graphCore.once('changed', (event) => {
|
|
1161
|
+
if (!event.changes.length)
|
|
1162
|
+
return;
|
|
1163
|
+
const changes = event.changes;
|
|
1164
|
+
this.hooks.itemchange.emit({
|
|
1165
|
+
type: 'combo',
|
|
1166
|
+
changes: graphCore.reduceChanges(event.changes),
|
|
1167
|
+
graphCore,
|
|
1168
|
+
theme: specification,
|
|
1169
|
+
});
|
|
1170
|
+
this.emit('afteritemchange', {
|
|
1171
|
+
type: 'combo',
|
|
1172
|
+
action: 'add',
|
|
1173
|
+
models: [model],
|
|
1174
|
+
apiName: 'addCombo',
|
|
1175
|
+
changes,
|
|
1176
|
+
});
|
|
1177
|
+
});
|
|
1178
|
+
const data = {
|
|
1179
|
+
nodes: [],
|
|
1180
|
+
edges: [],
|
|
1181
|
+
combos: [
|
|
1182
|
+
Object.assign(Object.assign({}, model), { data: Object.assign(Object.assign({}, model.data), { _children: childrenIds }) }),
|
|
1183
|
+
],
|
|
1184
|
+
};
|
|
1185
|
+
this.hooks.datachange.emit({
|
|
1186
|
+
data,
|
|
1187
|
+
type: 'addCombo',
|
|
1188
|
+
});
|
|
1189
|
+
return this.dataController.findData('combo', [model.id])[0];
|
|
807
1190
|
}
|
|
808
1191
|
/**
|
|
809
|
-
*
|
|
810
|
-
* @param
|
|
1192
|
+
* Collapse a combo.
|
|
1193
|
+
* @param comboId combo ids
|
|
811
1194
|
* @group Combo
|
|
812
1195
|
*/
|
|
813
|
-
|
|
814
|
-
|
|
1196
|
+
collapseCombo(comboIds) {
|
|
1197
|
+
const ids = isArray(comboIds) ? comboIds : [comboIds];
|
|
1198
|
+
this.executeWithoutStacking(() => {
|
|
1199
|
+
this.updateData('combo', ids.map((id) => ({ id, data: { collapsed: true } })));
|
|
1200
|
+
});
|
|
1201
|
+
this.emit('aftercollapsecombo', {
|
|
1202
|
+
type: 'combo',
|
|
1203
|
+
action: 'collapseCombo',
|
|
1204
|
+
ids: comboIds,
|
|
1205
|
+
apiName: 'collapseCombo',
|
|
1206
|
+
});
|
|
815
1207
|
}
|
|
816
1208
|
/**
|
|
817
|
-
*
|
|
818
|
-
* @param
|
|
1209
|
+
* Expand a combo.
|
|
1210
|
+
* @param combo combo ids
|
|
819
1211
|
* @group Combo
|
|
820
1212
|
*/
|
|
821
|
-
|
|
822
|
-
|
|
1213
|
+
expandCombo(comboIds) {
|
|
1214
|
+
const ids = isArray(comboIds) ? comboIds : [comboIds];
|
|
1215
|
+
this.executeWithoutStacking(() => {
|
|
1216
|
+
this.updateData('combo', ids.map((id) => ({ id, data: { collapsed: false } })));
|
|
1217
|
+
});
|
|
1218
|
+
this.emit('afterexpandcombo', {
|
|
1219
|
+
type: 'combo',
|
|
1220
|
+
action: 'expandCombo',
|
|
1221
|
+
ids: comboIds,
|
|
1222
|
+
apiName: 'expandCombo',
|
|
1223
|
+
});
|
|
823
1224
|
}
|
|
824
1225
|
/**
|
|
825
|
-
*
|
|
826
|
-
*
|
|
1226
|
+
* Move one or more combos a distance (dx, dy) relatively,
|
|
1227
|
+
* do not update other styles which leads to better performance than updating positions by updateData.
|
|
1228
|
+
* In fact, it changes the succeed nodes positions to affect the combo's position, but not modify the combo's position directly.
|
|
1229
|
+
* @param models new configurations with x and y for every combo, which has id field to indicate the specific item
|
|
827
1230
|
* @group Combo
|
|
828
1231
|
*/
|
|
829
|
-
|
|
830
|
-
|
|
1232
|
+
moveCombo(ids, dx, dy, upsertAncestors, callback) {
|
|
1233
|
+
const idArr = isArray(ids) ? ids : [ids];
|
|
1234
|
+
const { graphCore } = this.dataController;
|
|
1235
|
+
const { specification } = this.themeController;
|
|
1236
|
+
graphCore.once('changed', (event) => {
|
|
1237
|
+
if (!event.changes.length)
|
|
1238
|
+
return;
|
|
1239
|
+
const changes = this.extendChanges(clone(event.changes));
|
|
1240
|
+
this.hooks.itemchange.emit({
|
|
1241
|
+
type: 'combo',
|
|
1242
|
+
changes: event.changes,
|
|
1243
|
+
graphCore,
|
|
1244
|
+
theme: specification,
|
|
1245
|
+
upsertAncestors,
|
|
1246
|
+
action: 'updatePosition',
|
|
1247
|
+
callback,
|
|
1248
|
+
});
|
|
1249
|
+
this.emit('afteritemchange', {
|
|
1250
|
+
type: 'combo',
|
|
1251
|
+
ids: idArr,
|
|
1252
|
+
dx,
|
|
1253
|
+
dy,
|
|
1254
|
+
action: 'updatePosition',
|
|
1255
|
+
upsertAncestors,
|
|
1256
|
+
apiName: 'moveCombo',
|
|
1257
|
+
changes,
|
|
1258
|
+
});
|
|
1259
|
+
});
|
|
1260
|
+
this.hooks.datachange.emit({
|
|
1261
|
+
data: {
|
|
1262
|
+
nodes: [],
|
|
1263
|
+
edges: [],
|
|
1264
|
+
combos: idArr.map((id) => ({ id, data: { dx, dy } })),
|
|
1265
|
+
},
|
|
1266
|
+
type: 'moveCombo',
|
|
1267
|
+
});
|
|
1268
|
+
return this.dataController.findData('combo', idArr);
|
|
831
1269
|
}
|
|
832
1270
|
// ===== layout =====
|
|
833
1271
|
/**
|
|
834
1272
|
* Layout the graph (with current configurations if cfg is not assigned).
|
|
835
1273
|
*/
|
|
836
|
-
layout(options) {
|
|
1274
|
+
layout(options, disableAnimate = false) {
|
|
837
1275
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1276
|
+
this.emit('beforelayout');
|
|
838
1277
|
const { graphCore } = this.dataController;
|
|
839
1278
|
const formattedOptions = Object.assign(Object.assign({}, this.getSpecification().layout), options);
|
|
840
|
-
|
|
1279
|
+
this.updateSpecification({ layout: formattedOptions });
|
|
1280
|
+
const layoutUnset = (!options && !this.getSpecification().layout) ||
|
|
1281
|
+
!Object.keys(formattedOptions).length;
|
|
841
1282
|
if (layoutUnset) {
|
|
842
1283
|
const nodes = graphCore.getAllNodes();
|
|
843
1284
|
if (nodes.every((node) => isNil(node.data.x) && isNil(node.data.y))) {
|
|
@@ -864,6 +1305,7 @@ export default class Graph extends EventEmitter {
|
|
|
864
1305
|
yield this.hooks.layout.emitLinearAsync({
|
|
865
1306
|
graphCore,
|
|
866
1307
|
options: formattedOptions,
|
|
1308
|
+
animate: !disableAnimate,
|
|
867
1309
|
});
|
|
868
1310
|
this.emit('afterlayout');
|
|
869
1311
|
});
|
|
@@ -874,6 +1316,13 @@ export default class Graph extends EventEmitter {
|
|
|
874
1316
|
stopLayout() {
|
|
875
1317
|
this.layoutController.stopLayout();
|
|
876
1318
|
}
|
|
1319
|
+
/**
|
|
1320
|
+
*
|
|
1321
|
+
* @returns
|
|
1322
|
+
*/
|
|
1323
|
+
getLayoutCurrentAnimation() {
|
|
1324
|
+
return this.layoutController.getCurrentAnimation();
|
|
1325
|
+
}
|
|
877
1326
|
/**
|
|
878
1327
|
* Switch mode.
|
|
879
1328
|
* @param mode mode name
|
|
@@ -883,6 +1332,14 @@ export default class Graph extends EventEmitter {
|
|
|
883
1332
|
setMode(mode) {
|
|
884
1333
|
this.hooks.modechange.emit({ mode });
|
|
885
1334
|
}
|
|
1335
|
+
/**
|
|
1336
|
+
* Get current mode.
|
|
1337
|
+
* @returns mode name
|
|
1338
|
+
* @group Interaction
|
|
1339
|
+
*/
|
|
1340
|
+
getMode() {
|
|
1341
|
+
return this.interactionController.getMode();
|
|
1342
|
+
}
|
|
886
1343
|
/**
|
|
887
1344
|
* Add behavior(s) to mode(s).
|
|
888
1345
|
* @param behaviors behavior names or configs
|
|
@@ -989,16 +1446,18 @@ export default class Graph extends EventEmitter {
|
|
|
989
1446
|
* @group Plugin
|
|
990
1447
|
*/
|
|
991
1448
|
removePlugins(pluginKeys) {
|
|
1449
|
+
const pluginArr = isArray(pluginKeys) ? pluginKeys : [pluginKeys];
|
|
992
1450
|
this.hooks.pluginchange.emit({
|
|
993
1451
|
action: 'remove',
|
|
994
|
-
plugins:
|
|
1452
|
+
plugins: pluginArr,
|
|
995
1453
|
});
|
|
996
1454
|
// update the graph specification
|
|
997
1455
|
const { plugins } = this.specification;
|
|
998
1456
|
this.specification.plugins = plugins === null || plugins === void 0 ? void 0 : plugins.filter((plugin) => {
|
|
999
1457
|
if (isObject(plugin))
|
|
1000
|
-
return !
|
|
1001
|
-
|
|
1458
|
+
return !(pluginArr.includes(plugin.key) ||
|
|
1459
|
+
pluginArr.includes(plugin));
|
|
1460
|
+
return !pluginArr.includes(plugin);
|
|
1002
1461
|
});
|
|
1003
1462
|
}
|
|
1004
1463
|
/**
|
|
@@ -1008,12 +1467,12 @@ export default class Graph extends EventEmitter {
|
|
|
1008
1467
|
* @group Interaction
|
|
1009
1468
|
*/
|
|
1010
1469
|
updatePlugin(plugin) {
|
|
1470
|
+
const { plugins } = this.specification;
|
|
1011
1471
|
const { key } = plugin;
|
|
1012
1472
|
if (!key) {
|
|
1013
1473
|
console.warn('Update plugin failed, the key for the plugin to be updated should be assign.');
|
|
1014
1474
|
return;
|
|
1015
1475
|
}
|
|
1016
|
-
const { plugins } = this.specification;
|
|
1017
1476
|
if (!plugins) {
|
|
1018
1477
|
console.warn('Update plugin failed, the plugin to be updated does not exist.');
|
|
1019
1478
|
return;
|
|
@@ -1041,15 +1500,174 @@ export default class Graph extends EventEmitter {
|
|
|
1041
1500
|
* @returns upserted shape or group
|
|
1042
1501
|
* @group Interaction
|
|
1043
1502
|
*/
|
|
1044
|
-
drawTransient(type, id, config) {
|
|
1503
|
+
drawTransient(type, id, config, canvas) {
|
|
1045
1504
|
this.hooks.transientupdate.emit({
|
|
1046
1505
|
type,
|
|
1047
1506
|
id,
|
|
1048
1507
|
config,
|
|
1049
|
-
canvas: this.transientCanvas,
|
|
1508
|
+
canvas: canvas || this.transientCanvas,
|
|
1509
|
+
graphCore: this.dataController.graphCore,
|
|
1050
1510
|
});
|
|
1051
1511
|
return this.itemController.getTransient(String(id));
|
|
1052
1512
|
}
|
|
1513
|
+
// ===== history operations =====
|
|
1514
|
+
/**
|
|
1515
|
+
* Determine if history (redo/undo) is enabled.
|
|
1516
|
+
*/
|
|
1517
|
+
isHistoryEnabled() {
|
|
1518
|
+
const history = this.getHistoryPlugin();
|
|
1519
|
+
return history === null || history === void 0 ? void 0 : history.isEnable();
|
|
1520
|
+
}
|
|
1521
|
+
/**
|
|
1522
|
+
* Push the operation(s) onto the specified stack
|
|
1523
|
+
* @param cmd commands to be pushed
|
|
1524
|
+
* @param stackType undo/redo stack
|
|
1525
|
+
* @param isNew
|
|
1526
|
+
*/
|
|
1527
|
+
pushStack(cmd, stackType, isNew) {
|
|
1528
|
+
const history = this.getHistoryPlugin();
|
|
1529
|
+
return history === null || history === void 0 ? void 0 : history.push(cmd, stackType, isNew);
|
|
1530
|
+
}
|
|
1531
|
+
/**
|
|
1532
|
+
* Pause stacking operation.
|
|
1533
|
+
*/
|
|
1534
|
+
pauseStacking() {
|
|
1535
|
+
const history = this.getHistoryPlugin();
|
|
1536
|
+
return history === null || history === void 0 ? void 0 : history.pauseStacking();
|
|
1537
|
+
}
|
|
1538
|
+
/**
|
|
1539
|
+
* Resume stacking operation.
|
|
1540
|
+
*/
|
|
1541
|
+
resumeStacking() {
|
|
1542
|
+
const history = this.getHistoryPlugin();
|
|
1543
|
+
return history === null || history === void 0 ? void 0 : history.resumeStacking();
|
|
1544
|
+
}
|
|
1545
|
+
/**
|
|
1546
|
+
* Retrieve the current redo stack which consists of operations that could be undone
|
|
1547
|
+
*/
|
|
1548
|
+
getUndoStack() {
|
|
1549
|
+
const history = this.getHistoryPlugin();
|
|
1550
|
+
return history === null || history === void 0 ? void 0 : history.getUndoStack();
|
|
1551
|
+
}
|
|
1552
|
+
/**
|
|
1553
|
+
* Retrieve the current undo stack which consists of operations that were undone
|
|
1554
|
+
*/
|
|
1555
|
+
getRedoStack() {
|
|
1556
|
+
const history = this.getHistoryPlugin();
|
|
1557
|
+
return history === null || history === void 0 ? void 0 : history.getRedoStack();
|
|
1558
|
+
}
|
|
1559
|
+
/**
|
|
1560
|
+
* Retrieve the complete history stack
|
|
1561
|
+
* @returns
|
|
1562
|
+
*/
|
|
1563
|
+
getStack() {
|
|
1564
|
+
const history = this.getHistoryPlugin();
|
|
1565
|
+
return history === null || history === void 0 ? void 0 : history.getStack();
|
|
1566
|
+
}
|
|
1567
|
+
/**
|
|
1568
|
+
* Restore n operations that were last n reverted on the graph.
|
|
1569
|
+
* @param steps The number of operations to undo. Default to 1.
|
|
1570
|
+
* @returns
|
|
1571
|
+
*/
|
|
1572
|
+
undo() {
|
|
1573
|
+
const history = this.getHistoryPlugin();
|
|
1574
|
+
history === null || history === void 0 ? void 0 : history.undo();
|
|
1575
|
+
}
|
|
1576
|
+
/**
|
|
1577
|
+
* Revert recent n operation(s) performed on the graph.
|
|
1578
|
+
* @param steps The number of operations to redo. Default to 1.
|
|
1579
|
+
* @returns
|
|
1580
|
+
*/
|
|
1581
|
+
redo() {
|
|
1582
|
+
const history = this.getHistoryPlugin();
|
|
1583
|
+
history === null || history === void 0 ? void 0 : history.redo();
|
|
1584
|
+
}
|
|
1585
|
+
/**
|
|
1586
|
+
* Indicate whether there are any actions available in the undo stack.
|
|
1587
|
+
*/
|
|
1588
|
+
canUndo() {
|
|
1589
|
+
const history = this.getHistoryPlugin();
|
|
1590
|
+
return history === null || history === void 0 ? void 0 : history.canUndo();
|
|
1591
|
+
}
|
|
1592
|
+
/**
|
|
1593
|
+
* Indicate whether there are any actions available in the redo stack.
|
|
1594
|
+
*/
|
|
1595
|
+
canRedo() {
|
|
1596
|
+
const history = this.getHistoryPlugin();
|
|
1597
|
+
return history === null || history === void 0 ? void 0 : history.canRedo();
|
|
1598
|
+
}
|
|
1599
|
+
/**
|
|
1600
|
+
* Begin a batch operation.
|
|
1601
|
+
* Any operations performed between `startBatch` and `stopBatch` are grouped together.
|
|
1602
|
+
* treated as a single operation when undoing or redoing.
|
|
1603
|
+
*/
|
|
1604
|
+
startBatch() {
|
|
1605
|
+
const history = this.getHistoryPlugin();
|
|
1606
|
+
history === null || history === void 0 ? void 0 : history.startBatch();
|
|
1607
|
+
}
|
|
1608
|
+
/**
|
|
1609
|
+
* End a batch operation.
|
|
1610
|
+
* Any operations performed between `startBatch` and `stopBatch` are grouped together.
|
|
1611
|
+
* treated as a single operation when undoing or redoing.
|
|
1612
|
+
*/
|
|
1613
|
+
stopBatch() {
|
|
1614
|
+
const history = this.getHistoryPlugin();
|
|
1615
|
+
history === null || history === void 0 ? void 0 : history.stopBatch();
|
|
1616
|
+
}
|
|
1617
|
+
/**
|
|
1618
|
+
* Execute a provided function within a batched context
|
|
1619
|
+
* All operations performed inside callback will be treated as a composite operation
|
|
1620
|
+
* more convenient way without manually invoking `startBatch` and `stopBatch`.
|
|
1621
|
+
* @param callback The func containing operations to be batched together.
|
|
1622
|
+
*/
|
|
1623
|
+
batch(callback) {
|
|
1624
|
+
const history = this.getHistoryPlugin();
|
|
1625
|
+
history === null || history === void 0 ? void 0 : history.batch(callback);
|
|
1626
|
+
}
|
|
1627
|
+
/**
|
|
1628
|
+
* Clear history stack
|
|
1629
|
+
* @param {StackType} stackType undo/redo stack
|
|
1630
|
+
*/
|
|
1631
|
+
clearStack(stackType) {
|
|
1632
|
+
const history = this.getHistoryPlugin();
|
|
1633
|
+
if (!stackType)
|
|
1634
|
+
return history === null || history === void 0 ? void 0 : history.clear();
|
|
1635
|
+
return stackType === 'undo'
|
|
1636
|
+
? history === null || history === void 0 ? void 0 : history.clearUndoStack()
|
|
1637
|
+
: history === null || history === void 0 ? void 0 : history.clearRedoStack();
|
|
1638
|
+
}
|
|
1639
|
+
/**
|
|
1640
|
+
* Collapse sub tree(s).
|
|
1641
|
+
* @param ids Root id(s) of the sub trees.
|
|
1642
|
+
* @param disableAnimate Whether disable the animations for this operation.
|
|
1643
|
+
* @param stack Whether push this operation to stack.
|
|
1644
|
+
* @returns
|
|
1645
|
+
* @group Tree
|
|
1646
|
+
*/
|
|
1647
|
+
collapse(ids, disableAnimate = false, stack) {
|
|
1648
|
+
this.hooks.treecollapseexpand.emit({
|
|
1649
|
+
ids: isArray(ids) ? ids : [ids],
|
|
1650
|
+
action: 'collapse',
|
|
1651
|
+
animate: !disableAnimate,
|
|
1652
|
+
graphCore: this.dataController.graphCore,
|
|
1653
|
+
});
|
|
1654
|
+
}
|
|
1655
|
+
/**
|
|
1656
|
+
* Expand sub tree(s).
|
|
1657
|
+
* @param ids Root id(s) of the sub trees.
|
|
1658
|
+
* @param disableAnimate Whether disable the animations for this operation.
|
|
1659
|
+
* @param stack Whether push this operation to stack.
|
|
1660
|
+
* @returns
|
|
1661
|
+
* @group Tree
|
|
1662
|
+
*/
|
|
1663
|
+
expand(ids, disableAnimate = false, stack) {
|
|
1664
|
+
this.hooks.treecollapseexpand.emit({
|
|
1665
|
+
ids: isArray(ids) ? ids : [ids],
|
|
1666
|
+
action: 'expand',
|
|
1667
|
+
animate: !disableAnimate,
|
|
1668
|
+
graphCore: this.dataController.graphCore,
|
|
1669
|
+
});
|
|
1670
|
+
}
|
|
1053
1671
|
/**
|
|
1054
1672
|
* Destroy the graph instance and remove the related canvases.
|
|
1055
1673
|
* @returns
|
|
@@ -1057,12 +1675,14 @@ export default class Graph extends EventEmitter {
|
|
|
1057
1675
|
*/
|
|
1058
1676
|
destroy(callback) {
|
|
1059
1677
|
// TODO: call the destroy functions after items' buildOut animations finished
|
|
1060
|
-
setTimeout(() => {
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1678
|
+
// setTimeout(() => {
|
|
1679
|
+
this.canvas.destroy();
|
|
1680
|
+
this.backgroundCanvas.destroy();
|
|
1681
|
+
this.transientCanvas.destroy();
|
|
1682
|
+
// clear history stack
|
|
1683
|
+
this.clearStack();
|
|
1684
|
+
callback === null || callback === void 0 ? void 0 : callback();
|
|
1685
|
+
// }, 500);
|
|
1066
1686
|
this.hooks.destroy.emit({});
|
|
1067
1687
|
// TODO: destroy controllers and off the listeners
|
|
1068
1688
|
// this.dataController.destroy();
|