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