@antv/g6 5.0.0-alpha.8 → 5.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/g6.min.js +6 -19
- package/esm/api-doc/behaviors.d.ts +2 -0
- package/esm/api-doc/behaviors.js +2 -0
- package/esm/api-doc/behaviors.js.map +1 -0
- package/esm/api-doc/graph.d.ts +4 -0
- package/esm/api-doc/graph.js +4 -0
- package/esm/api-doc/graph.js.map +1 -0
- package/esm/api-doc/item.d.ts +9 -0
- package/esm/api-doc/item.js +3 -0
- package/esm/api-doc/item.js.map +1 -0
- package/esm/api-doc/layout.d.ts +1 -0
- package/esm/api-doc/layout.js +2 -0
- package/esm/api-doc/layout.js.map +1 -0
- package/esm/api-doc/plugins.d.ts +1 -0
- package/esm/api-doc/plugins.js +2 -0
- package/esm/api-doc/plugins.js.map +1 -0
- package/esm/api-doc/types.d.ts +0 -0
- package/esm/api-doc/types.js +3 -0
- package/esm/api-doc/types.js.map +1 -0
- package/esm/api-doc/util.d.ts +3 -0
- package/esm/api-doc/util.js +4 -0
- package/esm/api-doc/util.js.map +1 -0
- package/esm/constant/shape.d.ts +7 -14
- package/esm/constant/shape.js +1 -0
- package/esm/constant/shape.js.map +1 -1
- package/esm/index.d.ts +215 -95
- package/esm/index.js +11 -4
- package/esm/index.js.map +1 -1
- package/esm/item/combo.d.ts +79 -2
- package/esm/item/combo.js +186 -2
- package/esm/item/combo.js.map +1 -1
- package/esm/item/edge.d.ts +15 -12
- package/esm/item/edge.js +40 -14
- package/esm/item/edge.js.map +1 -1
- package/esm/item/item.d.ts +12 -10
- package/esm/item/item.js +155 -83
- package/esm/item/item.js.map +1 -1
- package/esm/item/node.d.ts +32 -23
- package/esm/item/node.js +70 -49
- package/esm/item/node.js.map +1 -1
- package/esm/runtime/controller/data.d.ts +28 -4
- package/esm/runtime/controller/data.js +562 -173
- package/esm/runtime/controller/data.js.map +1 -1
- package/esm/runtime/controller/interaction.d.ts +1 -0
- package/esm/runtime/controller/interaction.js +23 -8
- package/esm/runtime/controller/interaction.js.map +1 -1
- package/esm/runtime/controller/item.d.ts +47 -5
- package/esm/runtime/controller/item.js +712 -122
- package/esm/runtime/controller/item.js.map +1 -1
- package/esm/runtime/controller/layout.d.ts +4 -1
- package/esm/runtime/controller/layout.js +109 -13
- package/esm/runtime/controller/layout.js.map +1 -1
- package/esm/runtime/controller/plugin.d.ts +11 -0
- package/esm/runtime/controller/plugin.js +39 -6
- package/esm/runtime/controller/plugin.js.map +1 -1
- package/esm/runtime/controller/theme.js +8 -4
- package/esm/runtime/controller/theme.js.map +1 -1
- package/esm/runtime/graph.d.ts +226 -47
- package/esm/runtime/graph.js +710 -90
- package/esm/runtime/graph.js.map +1 -1
- package/esm/stdlib/behavior/activate-relations.d.ts +2 -3
- package/esm/stdlib/behavior/activate-relations.js +13 -9
- package/esm/stdlib/behavior/activate-relations.js.map +1 -1
- package/esm/stdlib/behavior/brush-select.d.ts +3 -4
- package/esm/stdlib/behavior/brush-select.js +2 -2
- package/esm/stdlib/behavior/brush-select.js.map +1 -1
- package/esm/stdlib/behavior/click-select.d.ts +5 -3
- package/esm/stdlib/behavior/click-select.js +21 -7
- package/esm/stdlib/behavior/click-select.js.map +1 -1
- package/esm/stdlib/behavior/collapse-expand-combo.d.ts +28 -0
- package/esm/stdlib/behavior/collapse-expand-combo.js +35 -0
- package/esm/stdlib/behavior/collapse-expand-combo.js.map +1 -0
- package/esm/stdlib/behavior/collapse-expand-tree.d.ts +44 -0
- package/esm/stdlib/behavior/collapse-expand-tree.js +69 -0
- package/esm/stdlib/behavior/collapse-expand-tree.js.map +1 -0
- package/esm/stdlib/behavior/drag-canvas.d.ts +1 -2
- package/esm/stdlib/behavior/drag-canvas.js +15 -11
- package/esm/stdlib/behavior/drag-canvas.js.map +1 -1
- package/esm/stdlib/behavior/drag-combo.d.ts +111 -0
- package/esm/stdlib/behavior/drag-combo.js +380 -0
- package/esm/stdlib/behavior/drag-combo.js.map +1 -0
- package/esm/stdlib/behavior/drag-node.d.ts +33 -13
- package/esm/stdlib/behavior/drag-node.js +252 -67
- package/esm/stdlib/behavior/drag-node.js.map +1 -1
- package/esm/stdlib/behavior/hover-activate.d.ts +2 -1
- package/esm/stdlib/behavior/hover-activate.js +2 -0
- package/esm/stdlib/behavior/hover-activate.js.map +1 -1
- package/esm/stdlib/behavior/index.d.ts +15 -0
- package/esm/stdlib/behavior/index.js +16 -0
- package/esm/stdlib/behavior/index.js.map +1 -0
- package/esm/stdlib/behavior/lasso-select.d.ts +7 -3
- package/esm/stdlib/behavior/lasso-select.js +2 -2
- package/esm/stdlib/behavior/lasso-select.js.map +1 -1
- package/esm/stdlib/behavior/orbit-canvas-3d.d.ts +2 -3
- package/esm/stdlib/behavior/orbit-canvas-3d.js +2 -2
- package/esm/stdlib/behavior/orbit-canvas-3d.js.map +1 -1
- package/esm/stdlib/behavior/rotate-canvas-3d.d.ts +1 -2
- package/esm/stdlib/behavior/rotate-canvas-3d.js +1 -1
- package/esm/stdlib/behavior/rotate-canvas-3d.js.map +1 -1
- package/esm/stdlib/behavior/track-canvas-3d.d.ts +2 -3
- package/esm/stdlib/behavior/track-canvas-3d.js +2 -2
- package/esm/stdlib/behavior/track-canvas-3d.js.map +1 -1
- package/esm/stdlib/behavior/types.d.ts +13 -0
- package/esm/stdlib/behavior/types.js +2 -0
- package/esm/stdlib/behavior/types.js.map +1 -0
- package/esm/stdlib/behavior/zoom-canvas-3d.d.ts +1 -2
- package/esm/stdlib/behavior/zoom-canvas-3d.js +7 -7
- package/esm/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
- package/esm/stdlib/behavior/zoom-canvas.d.ts +1 -2
- package/esm/stdlib/behavior/zoom-canvas.js +20 -18
- package/esm/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/esm/stdlib/data/index.d.ts +3 -0
- package/esm/stdlib/data/index.js +4 -0
- package/esm/stdlib/data/index.js.map +1 -0
- package/esm/stdlib/data/mapNodeSize.d.ts +12 -0
- package/esm/stdlib/data/mapNodeSize.js +43 -0
- package/esm/stdlib/data/mapNodeSize.js.map +1 -0
- package/esm/stdlib/data/transformV4Data.d.ts +9 -0
- package/esm/stdlib/data/transformV4Data.js +142 -0
- package/esm/stdlib/data/transformV4Data.js.map +1 -0
- package/esm/stdlib/data/validateData.d.ts +9 -0
- package/esm/stdlib/data/validateData.js +98 -0
- package/esm/stdlib/data/validateData.js.map +1 -0
- package/esm/stdlib/index.d.ts +115 -49
- package/esm/stdlib/index.js +156 -37
- package/esm/stdlib/index.js.map +1 -1
- package/esm/stdlib/item/combo/circle.d.ts +29 -0
- package/esm/stdlib/item/combo/circle.js +56 -0
- package/esm/stdlib/item/combo/circle.js.map +1 -0
- package/esm/stdlib/item/combo/index.d.ts +2 -0
- package/esm/stdlib/item/combo/index.js +3 -0
- package/esm/stdlib/item/combo/index.js.map +1 -0
- package/esm/stdlib/item/combo/rect.d.ts +31 -0
- package/esm/stdlib/item/combo/rect.js +65 -0
- package/esm/stdlib/item/combo/rect.js.map +1 -0
- package/esm/stdlib/item/edge/base.d.ts +12 -3
- package/esm/stdlib/item/edge/base.js +39 -5
- package/esm/stdlib/item/edge/base.js.map +1 -1
- package/esm/stdlib/item/edge/cubic-horizontal.d.ts +36 -0
- package/esm/stdlib/item/edge/cubic-horizontal.js +56 -0
- package/esm/stdlib/item/edge/cubic-horizontal.js.map +1 -0
- package/esm/stdlib/item/edge/cubic-vertical.d.ts +36 -0
- package/esm/stdlib/item/edge/cubic-vertical.js +56 -0
- package/esm/stdlib/item/edge/cubic-vertical.js.map +1 -0
- package/esm/stdlib/item/edge/cubic.d.ts +59 -0
- package/esm/stdlib/item/edge/cubic.js +116 -0
- package/esm/stdlib/item/edge/cubic.js.map +1 -0
- package/esm/stdlib/item/edge/index.d.ts +6 -0
- package/esm/stdlib/item/edge/index.js +6 -0
- package/esm/stdlib/item/edge/index.js.map +1 -1
- package/esm/stdlib/item/edge/line.d.ts +1 -1
- package/esm/stdlib/item/edge/line.js +16 -1
- package/esm/stdlib/item/edge/line.js.map +1 -1
- package/esm/stdlib/item/edge/loop.d.ts +32 -0
- package/esm/stdlib/item/edge/loop.js +115 -0
- package/esm/stdlib/item/edge/loop.js.map +1 -0
- package/esm/stdlib/item/edge/polyline.d.ts +44 -0
- package/esm/stdlib/item/edge/polyline.js +92 -0
- package/esm/stdlib/item/edge/polyline.js.map +1 -0
- package/esm/stdlib/item/edge/quadratic.d.ts +40 -0
- package/esm/stdlib/item/edge/quadratic.js +78 -0
- package/esm/stdlib/item/edge/quadratic.js.map +1 -0
- package/esm/stdlib/item/node/base.d.ts +83 -38
- package/esm/stdlib/item/node/base.js +100 -15
- package/esm/stdlib/item/node/base.js.map +1 -1
- package/esm/stdlib/item/node/base3d.js +1 -1
- package/esm/stdlib/item/node/base3d.js.map +1 -1
- package/esm/stdlib/item/node/circle.js +5 -5
- package/esm/stdlib/item/node/circle.js.map +1 -1
- package/esm/stdlib/item/node/diamond.d.ts +32 -0
- package/esm/stdlib/item/node/diamond.js +79 -0
- package/esm/stdlib/item/node/diamond.js.map +1 -0
- package/esm/stdlib/item/node/donut.d.ts +70 -0
- package/esm/stdlib/item/node/donut.js +207 -0
- package/esm/stdlib/item/node/donut.js.map +1 -0
- package/esm/stdlib/item/node/ellipse.d.ts +32 -0
- package/esm/stdlib/item/node/ellipse.js +71 -0
- package/esm/stdlib/item/node/ellipse.js.map +1 -0
- package/esm/stdlib/item/node/hexagon.d.ts +33 -0
- package/esm/stdlib/item/node/hexagon.js +102 -0
- package/esm/stdlib/item/node/hexagon.js.map +1 -0
- package/esm/stdlib/item/node/index.d.ts +8 -0
- package/esm/stdlib/item/node/index.js +8 -0
- package/esm/stdlib/item/node/index.js.map +1 -1
- package/esm/stdlib/item/node/modelRect.d.ts +61 -0
- package/esm/stdlib/item/node/modelRect.js +186 -0
- package/esm/stdlib/item/node/modelRect.js.map +1 -0
- package/esm/stdlib/item/node/rect.d.ts +32 -0
- package/esm/stdlib/item/node/rect.js +75 -0
- package/esm/stdlib/item/node/rect.js.map +1 -0
- package/esm/stdlib/item/node/star.d.ts +34 -0
- package/esm/stdlib/item/node/star.js +115 -0
- package/esm/stdlib/item/node/star.js.map +1 -0
- package/esm/stdlib/item/node/triangle.d.ts +44 -0
- package/esm/stdlib/item/node/triangle.js +177 -0
- package/esm/stdlib/item/node/triangle.js.map +1 -0
- package/esm/stdlib/plugin/fisheye/index.d.ts +130 -0
- package/esm/stdlib/plugin/fisheye/index.js +488 -0
- package/esm/stdlib/plugin/fisheye/index.js.map +1 -0
- package/esm/stdlib/plugin/grid/index.d.ts +36 -0
- package/esm/stdlib/plugin/grid/index.js +81 -0
- package/esm/stdlib/plugin/grid/index.js.map +1 -0
- package/esm/stdlib/plugin/history/combo-command.d.ts +9 -0
- package/esm/stdlib/plugin/history/combo-command.js +21 -0
- package/esm/stdlib/plugin/history/combo-command.js.map +1 -0
- package/esm/stdlib/plugin/history/command.d.ts +18 -0
- package/esm/stdlib/plugin/history/command.js +51 -0
- package/esm/stdlib/plugin/history/command.js.map +1 -0
- package/esm/stdlib/plugin/history/index.d.ts +112 -0
- package/esm/stdlib/plugin/history/index.js +275 -0
- package/esm/stdlib/plugin/history/index.js.map +1 -0
- package/esm/stdlib/plugin/history/item-data-command.d.ts +14 -0
- package/esm/stdlib/plugin/history/item-data-command.js +63 -0
- package/esm/stdlib/plugin/history/item-data-command.js.map +1 -0
- package/esm/stdlib/plugin/history/layer-updated-command.d.ts +9 -0
- package/esm/stdlib/plugin/history/layer-updated-command.js +21 -0
- package/esm/stdlib/plugin/history/layer-updated-command.js.map +1 -0
- package/esm/stdlib/plugin/history/state-updated-command.d.ts +9 -0
- package/esm/stdlib/plugin/history/state-updated-command.js +20 -0
- package/esm/stdlib/plugin/history/state-updated-command.js.map +1 -0
- package/esm/stdlib/plugin/history/visibility-updated-command.d.ts +10 -0
- package/esm/stdlib/plugin/history/visibility-updated-command.js +23 -0
- package/esm/stdlib/plugin/history/visibility-updated-command.js.map +1 -0
- package/esm/stdlib/plugin/hull/bubbleset.d.ts +9 -0
- package/esm/stdlib/plugin/hull/bubbleset.js +592 -0
- package/esm/stdlib/plugin/hull/bubbleset.js.map +1 -0
- package/esm/stdlib/plugin/hull/convexHull.d.ts +14 -0
- package/esm/stdlib/plugin/hull/convexHull.js +56 -0
- package/esm/stdlib/plugin/hull/convexHull.js.map +1 -0
- package/esm/stdlib/plugin/hull/hullComponent.d.ts +87 -0
- package/esm/stdlib/plugin/hull/hullComponent.js +382 -0
- package/esm/stdlib/plugin/hull/hullComponent.js.map +1 -0
- package/esm/stdlib/plugin/hull/index.d.ts +59 -0
- package/esm/stdlib/plugin/hull/index.js +161 -0
- package/esm/stdlib/plugin/hull/index.js.map +1 -0
- package/esm/stdlib/plugin/hull/types.d.ts +15 -0
- package/esm/stdlib/plugin/hull/types.js +2 -0
- package/esm/stdlib/plugin/hull/types.js.map +1 -0
- package/esm/stdlib/plugin/hull/util.d.ts +77 -0
- package/esm/stdlib/plugin/hull/util.js +401 -0
- package/esm/stdlib/plugin/hull/util.js.map +1 -0
- package/esm/stdlib/plugin/index.d.ts +8 -0
- package/esm/stdlib/plugin/index.js +9 -0
- package/esm/stdlib/plugin/index.js.map +1 -0
- package/esm/stdlib/plugin/legend/index.d.ts +45 -3
- package/esm/stdlib/plugin/legend/index.js +47 -42
- package/esm/stdlib/plugin/legend/index.js.map +1 -1
- package/esm/stdlib/plugin/menu/index.d.ts +55 -0
- package/esm/stdlib/plugin/menu/index.js +237 -0
- package/esm/stdlib/plugin/menu/index.js.map +1 -0
- package/esm/stdlib/plugin/minimap/index.d.ts +11 -3
- package/esm/stdlib/plugin/minimap/index.js +19 -21
- package/esm/stdlib/plugin/minimap/index.js.map +1 -1
- package/esm/stdlib/plugin/toolbar/index.d.ts +59 -0
- package/esm/stdlib/plugin/toolbar/index.js +215 -0
- package/esm/stdlib/plugin/toolbar/index.js.map +1 -0
- package/esm/stdlib/plugin/tooltip/index.d.ts +96 -0
- package/esm/stdlib/plugin/tooltip/index.js +378 -0
- package/esm/stdlib/plugin/tooltip/index.js.map +1 -0
- package/esm/stdlib/plugin/types.d.ts +8 -0
- package/esm/stdlib/plugin/types.js +2 -0
- package/esm/stdlib/plugin/types.js.map +1 -0
- package/esm/stdlib/theme/dark.d.ts +1 -2
- package/esm/stdlib/theme/dark.js +13 -1
- package/esm/stdlib/theme/dark.js.map +1 -1
- package/esm/stdlib/theme/index.d.ts +2 -0
- package/esm/stdlib/theme/index.js +3 -0
- package/esm/stdlib/theme/index.js.map +1 -0
- package/esm/stdlib/theme/light.d.ts +1 -2
- package/esm/stdlib/theme/light.js +65 -10
- package/esm/stdlib/theme/light.js.map +1 -1
- package/esm/stdlib/themeSolver/base.d.ts +1 -1
- package/esm/stdlib/themeSolver/base.js +1 -1
- package/esm/stdlib/themeSolver/base.js.map +1 -1
- package/esm/stdlib/themeSolver/index.d.ts +3 -0
- package/esm/stdlib/themeSolver/index.js +4 -0
- package/esm/stdlib/themeSolver/index.js.map +1 -0
- package/esm/stdlib/themeSolver/spec.d.ts +2 -4
- package/esm/stdlib/themeSolver/spec.js +2 -2
- package/esm/stdlib/themeSolver/spec.js.map +1 -1
- package/esm/stdlib/themeSolver/subject.d.ts +2 -4
- package/esm/stdlib/themeSolver/subject.js +2 -2
- package/esm/stdlib/themeSolver/subject.js.map +1 -1
- package/esm/types/behavior.js.map +1 -1
- package/esm/types/combo.d.ts +51 -3
- package/esm/types/common.d.ts +10 -0
- package/esm/types/data.d.ts +13 -7
- package/esm/types/edge.d.ts +19 -5
- package/esm/types/event.d.ts +9 -1
- package/esm/types/event.js +8 -8
- package/esm/types/event.js.map +1 -1
- package/esm/types/graph.d.ts +169 -20
- package/esm/types/history.d.ts +28 -0
- package/esm/types/history.js +6 -0
- package/esm/types/history.js.map +1 -0
- package/esm/types/hook.d.ts +33 -6
- package/esm/types/index.d.ts +11 -5
- package/esm/types/index.js.map +1 -1
- package/esm/types/item.d.ts +14 -8
- package/esm/types/item.js.map +1 -1
- package/esm/types/layout.d.ts +4 -1
- package/esm/types/loop.d.ts +21 -0
- package/esm/types/loop.js +12 -0
- package/esm/types/loop.js.map +1 -0
- package/esm/types/node.d.ts +90 -10
- package/esm/types/plugin.d.ts +4 -0
- package/esm/types/plugin.js +1 -1
- package/esm/types/plugin.js.map +1 -1
- package/esm/types/spec.d.ts +26 -9
- package/esm/types/theme.d.ts +76 -10
- package/esm/types/theme.js +1 -2
- package/esm/types/theme.js.map +1 -1
- package/esm/util/animate.d.ts +2 -2
- package/esm/util/animate.js +52 -17
- package/esm/util/animate.js.map +1 -1
- package/esm/util/array.d.ts +8 -0
- package/esm/util/array.js +11 -1
- package/esm/util/array.js.map +1 -1
- package/esm/util/arrow.d.ts +17 -0
- package/esm/util/arrow.js +56 -0
- package/esm/util/arrow.js.map +1 -0
- package/esm/util/bbox.d.ts +106 -0
- package/esm/util/bbox.js +255 -0
- package/esm/util/bbox.js.map +1 -0
- package/esm/util/behavior.d.ts +2 -0
- package/esm/util/behavior.js +12 -0
- package/esm/util/behavior.js.map +1 -0
- package/esm/util/canvas.d.ts +1 -2
- package/esm/util/canvas.js +11 -20
- package/esm/util/canvas.js.map +1 -1
- package/esm/util/data.d.ts +96 -0
- package/esm/util/data.js +262 -0
- package/esm/util/data.js.map +1 -0
- package/esm/util/event.d.ts +29 -1
- package/esm/util/event.js +70 -0
- package/esm/util/event.js.map +1 -1
- package/esm/util/extend.d.ts +8 -2
- package/esm/util/extend.js.map +1 -1
- package/esm/util/index.d.ts +41 -3
- package/esm/util/index.js +20 -1
- package/esm/util/index.js.map +1 -1
- package/esm/util/item.d.ts +2 -1
- package/esm/util/item.js +38 -13
- package/esm/util/item.js.map +1 -1
- package/esm/util/layout.d.ts +40 -0
- package/esm/util/layout.js +160 -0
- package/esm/util/layout.js.map +1 -0
- package/esm/util/loop.d.ts +37 -0
- package/esm/util/loop.js +104 -0
- package/esm/util/loop.js.map +1 -0
- package/esm/util/mapper.js +4 -9
- package/esm/util/mapper.js.map +1 -1
- package/esm/util/math.d.ts +15 -0
- package/esm/util/math.js +14 -0
- package/esm/util/math.js.map +1 -1
- package/esm/util/mock.d.ts +30 -0
- package/esm/util/mock.js +69 -0
- package/esm/util/mock.js.map +1 -0
- package/esm/util/path.d.ts +11 -0
- package/esm/util/path.js +44 -0
- package/esm/util/path.js.map +1 -0
- package/esm/util/point.d.ts +24 -2
- package/esm/util/point.js +27 -2
- package/esm/util/point.js.map +1 -1
- package/esm/util/polyline.d.ts +113 -0
- package/esm/util/polyline.js +505 -0
- package/esm/util/polyline.js.map +1 -0
- package/esm/util/router.d.ts +31 -0
- package/esm/util/router.js +380 -0
- package/esm/util/router.js.map +1 -0
- package/esm/util/shape.d.ts +39 -4
- package/esm/util/shape.js +118 -2
- package/esm/util/shape.js.map +1 -1
- package/esm/util/shape3d.d.ts +1 -1
- package/esm/util/shape3d.js +12 -6
- package/esm/util/shape3d.js.map +1 -1
- package/esm/util/type.d.ts +6 -0
- package/esm/util/type.js +7 -1
- package/esm/util/type.js.map +1 -1
- package/esm/util/zoom.d.ts +2 -2
- package/esm/util/zoom.js +6 -2
- package/esm/util/zoom.js.map +1 -1
- package/lib/api-doc/behaviors.d.ts +2 -0
- package/lib/api-doc/behaviors.js +18 -0
- package/lib/api-doc/behaviors.js.map +1 -0
- package/lib/api-doc/graph.d.ts +4 -0
- package/lib/api-doc/graph.js +11 -0
- package/lib/api-doc/graph.js.map +1 -0
- package/lib/api-doc/item.d.ts +9 -0
- package/lib/api-doc/item.js +21 -0
- package/lib/api-doc/item.js.map +1 -0
- package/lib/api-doc/layout.d.ts +1 -0
- package/lib/api-doc/layout.js +3 -0
- package/lib/api-doc/layout.js.map +1 -0
- package/lib/api-doc/plugins.d.ts +1 -0
- package/lib/api-doc/plugins.js +18 -0
- package/lib/api-doc/plugins.js.map +1 -0
- package/lib/api-doc/types.d.ts +0 -0
- package/lib/api-doc/types.js +3 -0
- package/lib/api-doc/types.js.map +1 -0
- package/lib/api-doc/util.d.ts +3 -0
- package/lib/api-doc/util.js +10 -0
- package/lib/api-doc/util.js.map +1 -0
- package/lib/constant/shape.d.ts +7 -14
- package/lib/constant/shape.js +1 -0
- package/lib/constant/shape.js.map +1 -1
- package/lib/index.d.ts +215 -95
- package/lib/index.js +13 -3
- package/lib/index.js.map +1 -1
- package/lib/item/combo.d.ts +79 -2
- package/lib/item/combo.js +186 -2
- package/lib/item/combo.js.map +1 -1
- package/lib/item/edge.d.ts +15 -12
- package/lib/item/edge.js +40 -14
- package/lib/item/edge.js.map +1 -1
- package/lib/item/item.d.ts +12 -10
- package/lib/item/item.js +153 -81
- package/lib/item/item.js.map +1 -1
- package/lib/item/node.d.ts +32 -23
- package/lib/item/node.js +70 -49
- package/lib/item/node.js.map +1 -1
- package/lib/runtime/controller/data.d.ts +28 -4
- package/lib/runtime/controller/data.js +561 -172
- package/lib/runtime/controller/data.js.map +1 -1
- package/lib/runtime/controller/interaction.d.ts +1 -0
- package/lib/runtime/controller/interaction.js +22 -7
- package/lib/runtime/controller/interaction.js.map +1 -1
- package/lib/runtime/controller/item.d.ts +47 -5
- package/lib/runtime/controller/item.js +710 -120
- package/lib/runtime/controller/item.js.map +1 -1
- package/lib/runtime/controller/layout.d.ts +4 -1
- package/lib/runtime/controller/layout.js +132 -13
- package/lib/runtime/controller/layout.js.map +1 -1
- package/lib/runtime/controller/plugin.d.ts +11 -0
- package/lib/runtime/controller/plugin.js +39 -6
- package/lib/runtime/controller/plugin.js.map +1 -1
- package/lib/runtime/controller/theme.js +8 -4
- package/lib/runtime/controller/theme.js.map +1 -1
- package/lib/runtime/graph.d.ts +226 -47
- package/lib/runtime/graph.js +709 -89
- package/lib/runtime/graph.js.map +1 -1
- package/lib/stdlib/behavior/activate-relations.d.ts +2 -3
- package/lib/stdlib/behavior/activate-relations.js +14 -9
- package/lib/stdlib/behavior/activate-relations.js.map +1 -1
- package/lib/stdlib/behavior/brush-select.d.ts +3 -4
- package/lib/stdlib/behavior/brush-select.js +3 -2
- package/lib/stdlib/behavior/brush-select.js.map +1 -1
- package/lib/stdlib/behavior/click-select.d.ts +5 -3
- package/lib/stdlib/behavior/click-select.js +22 -7
- package/lib/stdlib/behavior/click-select.js.map +1 -1
- package/lib/stdlib/behavior/collapse-expand-combo.d.ts +28 -0
- package/lib/stdlib/behavior/collapse-expand-combo.js +39 -0
- package/lib/stdlib/behavior/collapse-expand-combo.js.map +1 -0
- package/lib/stdlib/behavior/collapse-expand-tree.d.ts +44 -0
- package/lib/stdlib/behavior/collapse-expand-tree.js +73 -0
- package/lib/stdlib/behavior/collapse-expand-tree.js.map +1 -0
- package/lib/stdlib/behavior/drag-canvas.d.ts +1 -2
- package/lib/stdlib/behavior/drag-canvas.js +16 -11
- package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
- package/lib/stdlib/behavior/drag-combo.d.ts +111 -0
- package/lib/stdlib/behavior/drag-combo.js +384 -0
- package/lib/stdlib/behavior/drag-combo.js.map +1 -0
- package/lib/stdlib/behavior/drag-node.d.ts +33 -13
- package/lib/stdlib/behavior/drag-node.js +252 -66
- package/lib/stdlib/behavior/drag-node.js.map +1 -1
- package/lib/stdlib/behavior/hover-activate.d.ts +2 -1
- package/lib/stdlib/behavior/hover-activate.js +2 -0
- package/lib/stdlib/behavior/hover-activate.js.map +1 -1
- package/lib/stdlib/behavior/index.d.ts +15 -0
- package/lib/stdlib/behavior/index.js +32 -0
- package/lib/stdlib/behavior/index.js.map +1 -0
- package/lib/stdlib/behavior/lasso-select.d.ts +7 -3
- package/lib/stdlib/behavior/lasso-select.js +4 -6
- package/lib/stdlib/behavior/lasso-select.js.map +1 -1
- package/lib/stdlib/behavior/orbit-canvas-3d.d.ts +2 -3
- package/lib/stdlib/behavior/orbit-canvas-3d.js +4 -6
- package/lib/stdlib/behavior/orbit-canvas-3d.js.map +1 -1
- package/lib/stdlib/behavior/rotate-canvas-3d.d.ts +1 -2
- package/lib/stdlib/behavior/rotate-canvas-3d.js +2 -1
- package/lib/stdlib/behavior/rotate-canvas-3d.js.map +1 -1
- package/lib/stdlib/behavior/track-canvas-3d.d.ts +2 -3
- package/lib/stdlib/behavior/track-canvas-3d.js +4 -6
- package/lib/stdlib/behavior/track-canvas-3d.js.map +1 -1
- package/lib/stdlib/behavior/types.d.ts +13 -0
- package/lib/stdlib/behavior/types.js +3 -0
- package/lib/stdlib/behavior/types.js.map +1 -0
- package/lib/stdlib/behavior/zoom-canvas-3d.d.ts +1 -2
- package/lib/stdlib/behavior/zoom-canvas-3d.js +8 -7
- package/lib/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
- package/lib/stdlib/behavior/zoom-canvas.d.ts +1 -2
- package/lib/stdlib/behavior/zoom-canvas.js +21 -18
- package/lib/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/lib/stdlib/data/index.d.ts +3 -0
- package/lib/stdlib/data/index.js +20 -0
- package/lib/stdlib/data/index.js.map +1 -0
- package/lib/stdlib/data/mapNodeSize.d.ts +12 -0
- package/lib/stdlib/data/mapNodeSize.js +47 -0
- package/lib/stdlib/data/mapNodeSize.js.map +1 -0
- package/lib/stdlib/data/transformV4Data.d.ts +9 -0
- package/lib/stdlib/data/transformV4Data.js +146 -0
- package/lib/stdlib/data/transformV4Data.js.map +1 -0
- package/lib/stdlib/data/validateData.d.ts +9 -0
- package/lib/stdlib/data/validateData.js +102 -0
- package/lib/stdlib/data/validateData.js.map +1 -0
- package/lib/stdlib/index.d.ts +115 -49
- package/lib/stdlib/index.js +190 -47
- package/lib/stdlib/index.js.map +1 -1
- package/lib/stdlib/item/combo/circle.d.ts +29 -0
- package/lib/stdlib/item/combo/circle.js +60 -0
- package/lib/stdlib/item/combo/circle.js.map +1 -0
- package/lib/stdlib/item/combo/index.d.ts +2 -0
- package/lib/stdlib/item/combo/index.js +19 -0
- package/lib/stdlib/item/combo/index.js.map +1 -0
- package/lib/stdlib/item/combo/rect.d.ts +31 -0
- package/lib/stdlib/item/combo/rect.js +69 -0
- package/lib/stdlib/item/combo/rect.js.map +1 -0
- package/lib/stdlib/item/edge/base.d.ts +12 -3
- package/lib/stdlib/item/edge/base.js +38 -4
- package/lib/stdlib/item/edge/base.js.map +1 -1
- package/lib/stdlib/item/edge/cubic-horizontal.d.ts +36 -0
- package/lib/stdlib/item/edge/cubic-horizontal.js +60 -0
- package/lib/stdlib/item/edge/cubic-horizontal.js.map +1 -0
- package/lib/stdlib/item/edge/cubic-vertical.d.ts +36 -0
- package/lib/stdlib/item/edge/cubic-vertical.js +60 -0
- package/lib/stdlib/item/edge/cubic-vertical.js.map +1 -0
- package/lib/stdlib/item/edge/cubic.d.ts +59 -0
- package/lib/stdlib/item/edge/cubic.js +120 -0
- package/lib/stdlib/item/edge/cubic.js.map +1 -0
- package/lib/stdlib/item/edge/index.d.ts +6 -0
- package/lib/stdlib/item/edge/index.js +6 -0
- package/lib/stdlib/item/edge/index.js.map +1 -1
- package/lib/stdlib/item/edge/line.d.ts +1 -1
- package/lib/stdlib/item/edge/line.js +16 -1
- package/lib/stdlib/item/edge/line.js.map +1 -1
- package/lib/stdlib/item/edge/loop.d.ts +32 -0
- package/lib/stdlib/item/edge/loop.js +119 -0
- package/lib/stdlib/item/edge/loop.js.map +1 -0
- package/lib/stdlib/item/edge/polyline.d.ts +44 -0
- package/lib/stdlib/item/edge/polyline.js +96 -0
- package/lib/stdlib/item/edge/polyline.js.map +1 -0
- package/lib/stdlib/item/edge/quadratic.d.ts +40 -0
- package/lib/stdlib/item/edge/quadratic.js +82 -0
- package/lib/stdlib/item/edge/quadratic.js.map +1 -0
- package/lib/stdlib/item/node/base.d.ts +83 -38
- package/lib/stdlib/item/node/base.js +100 -15
- package/lib/stdlib/item/node/base.js.map +1 -1
- package/lib/stdlib/item/node/base3d.js +1 -1
- package/lib/stdlib/item/node/base3d.js.map +1 -1
- package/lib/stdlib/item/node/circle.js +5 -5
- package/lib/stdlib/item/node/circle.js.map +1 -1
- package/lib/stdlib/item/node/diamond.d.ts +32 -0
- package/lib/stdlib/item/node/diamond.js +83 -0
- package/lib/stdlib/item/node/diamond.js.map +1 -0
- package/lib/stdlib/item/node/donut.d.ts +70 -0
- package/lib/stdlib/item/node/donut.js +211 -0
- package/lib/stdlib/item/node/donut.js.map +1 -0
- package/lib/stdlib/item/node/ellipse.d.ts +32 -0
- package/lib/stdlib/item/node/ellipse.js +75 -0
- package/lib/stdlib/item/node/ellipse.js.map +1 -0
- package/lib/stdlib/item/node/hexagon.d.ts +33 -0
- package/lib/stdlib/item/node/hexagon.js +106 -0
- package/lib/stdlib/item/node/hexagon.js.map +1 -0
- package/lib/stdlib/item/node/index.d.ts +8 -0
- package/lib/stdlib/item/node/index.js +8 -0
- package/lib/stdlib/item/node/index.js.map +1 -1
- package/lib/stdlib/item/node/modelRect.d.ts +61 -0
- package/lib/stdlib/item/node/modelRect.js +190 -0
- package/lib/stdlib/item/node/modelRect.js.map +1 -0
- package/lib/stdlib/item/node/rect.d.ts +32 -0
- package/lib/stdlib/item/node/rect.js +79 -0
- package/lib/stdlib/item/node/rect.js.map +1 -0
- package/lib/stdlib/item/node/star.d.ts +34 -0
- package/lib/stdlib/item/node/star.js +119 -0
- package/lib/stdlib/item/node/star.js.map +1 -0
- package/lib/stdlib/item/node/triangle.d.ts +44 -0
- package/lib/stdlib/item/node/triangle.js +181 -0
- package/lib/stdlib/item/node/triangle.js.map +1 -0
- package/lib/stdlib/plugin/fisheye/index.d.ts +130 -0
- package/lib/stdlib/plugin/fisheye/index.js +492 -0
- package/lib/stdlib/plugin/fisheye/index.js.map +1 -0
- package/lib/stdlib/plugin/grid/index.d.ts +36 -0
- package/lib/stdlib/plugin/grid/index.js +85 -0
- package/lib/stdlib/plugin/grid/index.js.map +1 -0
- package/lib/stdlib/plugin/history/combo-command.d.ts +9 -0
- package/lib/stdlib/plugin/history/combo-command.js +25 -0
- package/lib/stdlib/plugin/history/combo-command.js.map +1 -0
- package/lib/stdlib/plugin/history/command.d.ts +18 -0
- package/lib/stdlib/plugin/history/command.js +54 -0
- package/lib/stdlib/plugin/history/command.js.map +1 -0
- package/lib/stdlib/plugin/history/index.d.ts +112 -0
- package/lib/stdlib/plugin/history/index.js +283 -0
- package/lib/stdlib/plugin/history/index.js.map +1 -0
- package/lib/stdlib/plugin/history/item-data-command.d.ts +14 -0
- package/lib/stdlib/plugin/history/item-data-command.js +67 -0
- package/lib/stdlib/plugin/history/item-data-command.js.map +1 -0
- package/lib/stdlib/plugin/history/layer-updated-command.d.ts +9 -0
- package/lib/stdlib/plugin/history/layer-updated-command.js +25 -0
- package/lib/stdlib/plugin/history/layer-updated-command.js.map +1 -0
- package/lib/stdlib/plugin/history/state-updated-command.d.ts +9 -0
- package/lib/stdlib/plugin/history/state-updated-command.js +24 -0
- package/lib/stdlib/plugin/history/state-updated-command.js.map +1 -0
- package/lib/stdlib/plugin/history/visibility-updated-command.d.ts +10 -0
- package/lib/stdlib/plugin/history/visibility-updated-command.js +27 -0
- package/lib/stdlib/plugin/history/visibility-updated-command.js.map +1 -0
- package/lib/stdlib/plugin/hull/bubbleset.d.ts +9 -0
- package/lib/stdlib/plugin/hull/bubbleset.js +596 -0
- package/lib/stdlib/plugin/hull/bubbleset.js.map +1 -0
- package/lib/stdlib/plugin/hull/convexHull.d.ts +14 -0
- package/lib/stdlib/plugin/hull/convexHull.js +61 -0
- package/lib/stdlib/plugin/hull/convexHull.js.map +1 -0
- package/lib/stdlib/plugin/hull/hullComponent.d.ts +87 -0
- package/lib/stdlib/plugin/hull/hullComponent.js +385 -0
- package/lib/stdlib/plugin/hull/hullComponent.js.map +1 -0
- package/lib/stdlib/plugin/hull/index.d.ts +59 -0
- package/lib/stdlib/plugin/hull/index.js +167 -0
- package/lib/stdlib/plugin/hull/index.js.map +1 -0
- package/lib/stdlib/plugin/hull/types.d.ts +15 -0
- package/lib/stdlib/plugin/hull/types.js +3 -0
- package/lib/stdlib/plugin/hull/types.js.map +1 -0
- package/lib/stdlib/plugin/hull/util.d.ts +77 -0
- package/lib/stdlib/plugin/hull/util.js +419 -0
- package/lib/stdlib/plugin/hull/util.js.map +1 -0
- package/lib/stdlib/plugin/index.d.ts +8 -0
- package/lib/stdlib/plugin/index.js +25 -0
- package/lib/stdlib/plugin/index.js.map +1 -0
- package/lib/stdlib/plugin/legend/index.d.ts +45 -3
- package/lib/stdlib/plugin/legend/index.js +46 -40
- package/lib/stdlib/plugin/legend/index.js.map +1 -1
- package/lib/stdlib/plugin/menu/index.d.ts +55 -0
- package/lib/stdlib/plugin/menu/index.js +244 -0
- package/lib/stdlib/plugin/menu/index.js.map +1 -0
- package/lib/stdlib/plugin/minimap/index.d.ts +11 -3
- package/lib/stdlib/plugin/minimap/index.js +19 -20
- package/lib/stdlib/plugin/minimap/index.js.map +1 -1
- package/lib/stdlib/plugin/toolbar/index.d.ts +59 -0
- package/lib/stdlib/plugin/toolbar/index.js +222 -0
- package/lib/stdlib/plugin/toolbar/index.js.map +1 -0
- package/lib/stdlib/plugin/tooltip/index.d.ts +96 -0
- package/lib/stdlib/plugin/tooltip/index.js +385 -0
- package/lib/stdlib/plugin/tooltip/index.js.map +1 -0
- package/lib/stdlib/plugin/types.d.ts +8 -0
- package/lib/stdlib/plugin/types.js +3 -0
- package/lib/stdlib/plugin/types.js.map +1 -0
- package/lib/stdlib/theme/dark.d.ts +1 -2
- package/lib/stdlib/theme/dark.js +14 -1
- package/lib/stdlib/theme/dark.js.map +1 -1
- package/lib/stdlib/theme/index.d.ts +2 -0
- package/lib/stdlib/theme/index.js +19 -0
- package/lib/stdlib/theme/index.js.map +1 -0
- package/lib/stdlib/theme/light.d.ts +1 -2
- package/lib/stdlib/theme/light.js +66 -10
- package/lib/stdlib/theme/light.js.map +1 -1
- package/lib/stdlib/themeSolver/base.d.ts +1 -1
- package/lib/stdlib/themeSolver/base.js +2 -1
- package/lib/stdlib/themeSolver/base.js.map +1 -1
- package/lib/stdlib/themeSolver/index.d.ts +3 -0
- package/lib/stdlib/themeSolver/index.js +20 -0
- package/lib/stdlib/themeSolver/index.js.map +1 -0
- package/lib/stdlib/themeSolver/spec.d.ts +2 -4
- package/lib/stdlib/themeSolver/spec.js +4 -6
- package/lib/stdlib/themeSolver/spec.js.map +1 -1
- package/lib/stdlib/themeSolver/subject.d.ts +2 -4
- package/lib/stdlib/themeSolver/subject.js +4 -4
- package/lib/stdlib/themeSolver/subject.js.map +1 -1
- package/lib/types/behavior.js.map +1 -1
- package/lib/types/combo.d.ts +51 -3
- package/lib/types/common.d.ts +10 -0
- package/lib/types/data.d.ts +13 -7
- package/lib/types/edge.d.ts +19 -5
- package/lib/types/event.d.ts +9 -1
- package/lib/types/event.js +10 -10
- package/lib/types/event.js.map +1 -1
- package/lib/types/graph.d.ts +169 -20
- package/lib/types/history.d.ts +28 -0
- package/lib/types/history.js +9 -0
- package/lib/types/history.js.map +1 -0
- package/lib/types/hook.d.ts +33 -6
- package/lib/types/index.d.ts +11 -5
- package/lib/types/index.js.map +1 -1
- package/lib/types/item.d.ts +14 -8
- package/lib/types/item.js +1 -1
- package/lib/types/item.js.map +1 -1
- package/lib/types/layout.d.ts +4 -1
- package/lib/types/loop.d.ts +21 -0
- package/lib/types/loop.js +15 -0
- package/lib/types/loop.js.map +1 -0
- package/lib/types/node.d.ts +90 -10
- package/lib/types/plugin.d.ts +4 -0
- package/lib/types/plugin.js.map +1 -1
- package/lib/types/spec.d.ts +26 -9
- package/lib/types/theme.d.ts +76 -10
- package/lib/types/theme.js +1 -2
- package/lib/types/theme.js.map +1 -1
- package/lib/util/animate.d.ts +2 -2
- package/lib/util/animate.js +52 -17
- package/lib/util/animate.js.map +1 -1
- package/lib/util/array.d.ts +8 -0
- package/lib/util/array.js +13 -2
- package/lib/util/array.js.map +1 -1
- package/lib/util/arrow.d.ts +17 -0
- package/lib/util/arrow.js +60 -0
- package/lib/util/arrow.js.map +1 -0
- package/lib/util/bbox.d.ts +106 -0
- package/lib/util/bbox.js +273 -0
- package/lib/util/bbox.js.map +1 -0
- package/lib/util/behavior.d.ts +2 -0
- package/lib/util/behavior.js +16 -0
- package/lib/util/behavior.js.map +1 -0
- package/lib/util/canvas.d.ts +1 -2
- package/lib/util/canvas.js +11 -20
- package/lib/util/canvas.js.map +1 -1
- package/lib/util/data.d.ts +96 -0
- package/lib/util/data.js +276 -0
- package/lib/util/data.js.map +1 -0
- package/lib/util/event.d.ts +29 -1
- package/lib/util/event.js +73 -1
- package/lib/util/event.js.map +1 -1
- package/lib/util/extend.d.ts +8 -2
- package/lib/util/extend.js.map +1 -1
- package/lib/util/index.d.ts +41 -3
- package/lib/util/index.js +20 -1
- package/lib/util/index.js.map +1 -1
- package/lib/util/item.d.ts +2 -1
- package/lib/util/item.js +38 -13
- package/lib/util/item.js.map +1 -1
- package/lib/util/layout.d.ts +40 -0
- package/lib/util/layout.js +172 -0
- package/lib/util/layout.js.map +1 -0
- package/lib/util/loop.d.ts +37 -0
- package/lib/util/loop.js +111 -0
- package/lib/util/loop.js.map +1 -0
- package/lib/util/mapper.js +4 -9
- package/lib/util/mapper.js.map +1 -1
- package/lib/util/math.d.ts +15 -0
- package/lib/util/math.js +17 -1
- package/lib/util/math.js.map +1 -1
- package/lib/util/mock.d.ts +30 -0
- package/lib/util/mock.js +73 -0
- package/lib/util/mock.js.map +1 -0
- package/lib/util/path.d.ts +11 -0
- package/lib/util/path.js +49 -0
- package/lib/util/path.js.map +1 -0
- package/lib/util/point.d.ts +24 -2
- package/lib/util/point.js +31 -3
- package/lib/util/point.js.map +1 -1
- package/lib/util/polyline.d.ts +113 -0
- package/lib/util/polyline.js +524 -0
- package/lib/util/polyline.js.map +1 -0
- package/lib/util/router.d.ts +31 -0
- package/lib/util/router.js +384 -0
- package/lib/util/router.js.map +1 -0
- package/lib/util/shape.d.ts +39 -4
- package/lib/util/shape.js +122 -3
- package/lib/util/shape.js.map +1 -1
- package/lib/util/shape3d.d.ts +1 -1
- package/lib/util/shape3d.js +11 -5
- package/lib/util/shape3d.js.map +1 -1
- package/lib/util/type.d.ts +6 -0
- package/lib/util/type.js +9 -2
- package/lib/util/type.js.map +1 -1
- package/lib/util/zoom.d.ts +2 -2
- package/lib/util/zoom.js +6 -2
- package/lib/util/zoom.js.map +1 -1
- package/package.json +42 -22
- package/src/api-doc/behaviors.ts +2 -0
- package/src/api-doc/graph.ts +4 -0
- package/src/api-doc/item.ts +43 -0
- package/src/api-doc/layout.ts +13 -0
- package/src/api-doc/plugins.ts +1 -0
- package/src/api-doc/readme.md +59 -0
- package/src/api-doc/types.ts +2 -0
- package/src/api-doc/util.ts +3 -0
- package/src/constant/shape.ts +4 -1
- package/src/index.ts +14 -4
- package/src/item/combo.ts +307 -2
- package/src/item/edge.ts +73 -24
- package/src/item/item.ts +184 -85
- package/src/item/node.ts +138 -69
- package/src/runtime/controller/data.ts +665 -191
- package/src/runtime/controller/interaction.ts +31 -7
- package/src/runtime/controller/item.ts +990 -172
- package/src/runtime/controller/layout.ts +165 -13
- package/src/runtime/controller/plugin.ts +47 -10
- package/src/runtime/controller/theme.ts +8 -4
- package/src/runtime/graph.ts +922 -144
- package/src/stdlib/behavior/activate-relations.ts +14 -11
- package/src/stdlib/behavior/brush-select.ts +4 -5
- package/src/stdlib/behavior/click-select.ts +26 -11
- package/src/stdlib/behavior/collapse-expand-combo.ts +57 -0
- package/src/stdlib/behavior/collapse-expand-tree.ts +106 -0
- package/src/stdlib/behavior/drag-canvas.ts +15 -13
- package/src/stdlib/behavior/drag-combo.ts +589 -0
- package/src/stdlib/behavior/drag-node.ts +380 -110
- package/src/stdlib/behavior/hover-activate.ts +3 -5
- package/src/stdlib/behavior/index.ts +15 -0
- package/src/stdlib/behavior/lasso-select.ts +6 -2
- package/src/stdlib/behavior/orbit-canvas-3d.ts +3 -5
- package/src/stdlib/behavior/rotate-canvas-3d.ts +1 -3
- package/src/stdlib/behavior/track-canvas-3d.ts +3 -5
- package/src/stdlib/behavior/types.ts +15 -0
- package/src/stdlib/behavior/zoom-canvas-3d.ts +5 -7
- package/src/stdlib/behavior/zoom-canvas.ts +19 -19
- package/src/stdlib/data/index.ts +3 -0
- package/src/stdlib/data/mapNodeSize.ts +67 -0
- package/src/stdlib/data/transformV4Data.ts +207 -0
- package/src/stdlib/data/validateData.ts +146 -0
- package/src/stdlib/index.ts +221 -37
- package/src/stdlib/item/combo/circle.ts +113 -0
- package/src/stdlib/item/combo/index.ts +2 -0
- package/src/stdlib/item/combo/rect.ts +123 -0
- package/src/stdlib/item/edge/base.ts +71 -6
- package/src/stdlib/item/edge/cubic-horizontal.ts +86 -0
- package/src/stdlib/item/edge/cubic-vertical.ts +85 -0
- package/src/stdlib/item/edge/cubic.ts +198 -0
- package/src/stdlib/item/edge/index.ts +6 -0
- package/src/stdlib/item/edge/line.ts +14 -15
- package/src/stdlib/item/edge/loop.ts +162 -0
- package/src/stdlib/item/edge/polyline.ts +161 -0
- package/src/stdlib/item/edge/quadratic.ts +133 -0
- package/src/stdlib/item/node/base.ts +195 -53
- package/src/stdlib/item/node/base3d.ts +2 -0
- package/src/stdlib/item/node/circle.ts +5 -5
- package/src/stdlib/item/node/diamond.ts +144 -0
- package/src/stdlib/item/node/donut.ts +368 -0
- package/src/stdlib/item/node/ellipse.ts +128 -0
- package/src/stdlib/item/node/hexagon.ts +168 -0
- package/src/stdlib/item/node/index.ts +8 -0
- package/src/stdlib/item/node/modelRect.ts +405 -0
- package/src/stdlib/item/node/rect.ts +141 -0
- package/src/stdlib/item/node/star.ts +181 -0
- package/src/stdlib/item/node/triangle.ts +265 -0
- package/src/stdlib/plugin/fisheye/index.ts +607 -0
- package/src/stdlib/plugin/grid/index.ts +125 -0
- package/src/stdlib/plugin/history/combo-command.ts +28 -0
- package/src/stdlib/plugin/history/command.ts +81 -0
- package/src/stdlib/plugin/history/index.ts +347 -0
- package/src/stdlib/plugin/history/item-data-command.ts +96 -0
- package/src/stdlib/plugin/history/layer-updated-command.ts +28 -0
- package/src/stdlib/plugin/history/state-updated-command.ts +36 -0
- package/src/stdlib/plugin/history/visibility-updated-command.ts +41 -0
- package/src/stdlib/plugin/hull/bubbleset.ts +828 -0
- package/src/stdlib/plugin/hull/convexHull.ts +68 -0
- package/src/stdlib/plugin/hull/hullComponent.ts +501 -0
- package/src/stdlib/plugin/hull/index.ts +234 -0
- package/src/stdlib/plugin/hull/types.ts +15 -0
- package/src/stdlib/plugin/hull/util.ts +511 -0
- package/src/stdlib/plugin/index.ts +8 -0
- package/src/stdlib/plugin/legend/index.ts +122 -61
- package/src/stdlib/plugin/menu/index.ts +275 -0
- package/src/stdlib/plugin/minimap/index.ts +35 -26
- package/src/stdlib/plugin/toolbar/index.ts +257 -0
- package/src/stdlib/plugin/tooltip/index.ts +444 -0
- package/src/stdlib/plugin/types.ts +8 -0
- package/src/stdlib/theme/dark.ts +13 -1
- package/src/stdlib/theme/index.ts +2 -0
- package/src/stdlib/theme/light.ts +88 -10
- package/src/stdlib/themeSolver/base.ts +1 -1
- package/src/stdlib/themeSolver/index.ts +3 -0
- package/src/stdlib/themeSolver/spec.ts +2 -5
- package/src/stdlib/themeSolver/subject.ts +2 -5
- package/src/types/behavior.ts +0 -1
- package/src/types/combo.ts +61 -4
- package/src/types/common.ts +13 -0
- package/src/types/data.ts +28 -7
- package/src/types/edge.ts +30 -6
- package/src/types/event.ts +8 -8
- package/src/types/graph.ts +232 -25
- package/src/types/history.ts +30 -0
- package/src/types/hook.ts +37 -7
- package/src/types/index.ts +37 -12
- package/src/types/item.ts +25 -11
- package/src/types/layout.ts +20 -16
- package/src/types/loop.ts +23 -0
- package/src/types/node.ts +94 -14
- package/src/types/plugin.ts +7 -1
- package/src/types/spec.ts +30 -13
- package/src/types/theme.ts +80 -10
- package/src/util/animate.ts +60 -20
- package/src/util/array.ts +12 -1
- package/src/util/arrow.ts +62 -0
- package/src/util/bbox.ts +298 -0
- package/src/util/behavior.ts +14 -0
- package/src/util/canvas.ts +16 -24
- package/src/util/data.ts +307 -0
- package/src/util/event.ts +114 -1
- package/src/util/extend.ts +8 -2
- package/src/util/index.ts +31 -1
- package/src/util/item.ts +79 -13
- package/src/util/layout.ts +165 -0
- package/src/util/loop.ts +145 -0
- package/src/util/mapper.ts +10 -9
- package/src/util/math.ts +24 -0
- package/src/util/mock.ts +72 -0
- package/src/util/path.ts +52 -0
- package/src/util/point.ts +33 -2
- package/src/util/polyline.ts +676 -0
- package/src/util/router.ts +552 -0
- package/src/util/shape.ts +159 -6
- package/src/util/shape3d.ts +16 -11
- package/src/util/type.ts +8 -1
- package/src/util/zoom.ts +8 -4
- package/esm/stdlib/data/comboFromNode.d.ts +0 -9
- package/esm/stdlib/data/comboFromNode.js +0 -28
- package/esm/stdlib/data/comboFromNode.js.map +0 -1
- package/lib/stdlib/data/comboFromNode.d.ts +0 -9
- package/lib/stdlib/data/comboFromNode.js +0 -32
- package/lib/stdlib/data/comboFromNode.js.map +0 -1
- package/src/stdlib/data/comboFromNode.ts +0 -28
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
13
|
};
|
|
@@ -6,14 +15,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
15
|
exports.ItemController = void 0;
|
|
7
16
|
const g_1 = require("@antv/g");
|
|
8
17
|
const util_1 = require("@antv/util");
|
|
18
|
+
const g_plugin_3d_1 = require("@antv/g-plugin-3d");
|
|
9
19
|
const stdlib_1 = __importDefault(require("../../stdlib"));
|
|
10
20
|
const node_1 = __importDefault(require("../../item/node"));
|
|
11
21
|
const edge_1 = __importDefault(require("../../item/edge"));
|
|
22
|
+
const combo_1 = __importDefault(require("../../item/combo"));
|
|
12
23
|
const shape_1 = require("../../util/shape");
|
|
13
24
|
const extension_1 = require("../../util/extension");
|
|
14
25
|
const item_1 = require("../../util/item");
|
|
15
|
-
const g_plugin_3d_1 = require("@antv/g-plugin-3d");
|
|
16
26
|
const zoom_1 = require("../../util/zoom");
|
|
27
|
+
const data_1 = require("../../util/data");
|
|
28
|
+
const event_1 = require("../../util/event");
|
|
29
|
+
const polyline_1 = require("../../util/polyline");
|
|
17
30
|
/**
|
|
18
31
|
* Manages and stores the node / edge / combo items.
|
|
19
32
|
*/
|
|
@@ -25,18 +38,18 @@ class ItemController {
|
|
|
25
38
|
/**
|
|
26
39
|
* Node / edge / combo items map
|
|
27
40
|
*/
|
|
28
|
-
this.itemMap =
|
|
29
|
-
// TODO: combo? not a independent group
|
|
41
|
+
this.itemMap = new Map();
|
|
30
42
|
this.nodeDataTypeSet = new Set();
|
|
31
43
|
this.edgeDataTypeSet = new Set();
|
|
44
|
+
this.comboDataTypeSet = new Set();
|
|
32
45
|
// The G shapes or groups on transient map drawn by this controller
|
|
33
|
-
this.transientObjectMap =
|
|
34
|
-
this.transientItemMap =
|
|
46
|
+
this.transientObjectMap = new Map();
|
|
47
|
+
this.transientItemMap = new Map();
|
|
35
48
|
this.onViewportChange = (0, util_1.debounce)(({ transform, effectTiming }) => {
|
|
36
49
|
const { zoom } = transform;
|
|
37
50
|
if (zoom) {
|
|
38
51
|
const zoomRatio = this.graph.getZoom();
|
|
39
|
-
|
|
52
|
+
this.itemMap.forEach((item) => item.updateZoom(zoomRatio));
|
|
40
53
|
this.zoom = zoomRatio;
|
|
41
54
|
}
|
|
42
55
|
}, 500, false);
|
|
@@ -45,7 +58,7 @@ class ItemController {
|
|
|
45
58
|
return;
|
|
46
59
|
const { nodeDataTypeSet, edgeDataTypeSet } = this;
|
|
47
60
|
const { node: nodeTheme, edge: edgeTheme } = theme;
|
|
48
|
-
|
|
61
|
+
this.itemMap.forEach((item) => {
|
|
49
62
|
const itemTye = item.getType();
|
|
50
63
|
const usingTheme = itemTye === 'node' ? nodeTheme : edgeTheme;
|
|
51
64
|
const usingTypeSet = itemTye === 'node' ? nodeDataTypeSet : edgeDataTypeSet;
|
|
@@ -59,10 +72,12 @@ class ItemController {
|
|
|
59
72
|
};
|
|
60
73
|
this.onDestroy = () => {
|
|
61
74
|
Object.values(this.itemMap).forEach((item) => item.destroy());
|
|
75
|
+
// Fix OOM problem, since this map will hold all the refs of items.
|
|
76
|
+
this.itemMap.clear();
|
|
62
77
|
};
|
|
63
78
|
this.graph = graph;
|
|
64
79
|
// get mapper for node / edge / combo
|
|
65
|
-
const { node, edge, combo, nodeState, edgeState, comboState } = graph.getSpecification();
|
|
80
|
+
const { node, edge, combo, nodeState = {}, edgeState = {}, comboState = {}, } = graph.getSpecification();
|
|
66
81
|
this.nodeMapper = node;
|
|
67
82
|
this.edgeMapper = edge;
|
|
68
83
|
this.comboMapper = combo;
|
|
@@ -84,9 +99,11 @@ class ItemController {
|
|
|
84
99
|
this.graph.hooks.itemchange.tap(this.onChange.bind(this));
|
|
85
100
|
this.graph.hooks.itemstatechange.tap(this.onItemStateChange.bind(this));
|
|
86
101
|
this.graph.hooks.itemvisibilitychange.tap(this.onItemVisibilityChange.bind(this));
|
|
102
|
+
this.graph.hooks.itemzindexchange.tap(this.onItemZIndexChange.bind(this));
|
|
87
103
|
this.graph.hooks.transientupdate.tap(this.onTransientUpdate.bind(this));
|
|
88
104
|
this.graph.hooks.viewportchange.tap(this.onViewportChange.bind(this));
|
|
89
105
|
this.graph.hooks.themechange.tap(this.onThemeChange.bind(this));
|
|
106
|
+
this.graph.hooks.treecollapseexpand.tap(this.onTreeCollapseExpand.bind(this));
|
|
90
107
|
this.graph.hooks.destroy.tap(this.onDestroy.bind(this));
|
|
91
108
|
}
|
|
92
109
|
/**
|
|
@@ -95,9 +112,9 @@ class ItemController {
|
|
|
95
112
|
getExtensions() {
|
|
96
113
|
// TODO: user need to config using node/edge/combo types from useLib to spec?
|
|
97
114
|
const { node, edge, combo } = this.graph.getSpecification();
|
|
98
|
-
const nodeTypes = Object.keys(stdlib_1.default.useLib.nodes);
|
|
99
|
-
const edgeTypes = Object.keys(stdlib_1.default.useLib.edges);
|
|
100
|
-
const comboTypes = Object.keys(stdlib_1.default.useLib.combos);
|
|
115
|
+
const nodeTypes = Object.keys(stdlib_1.default.useLib.nodes || {});
|
|
116
|
+
const edgeTypes = Object.keys(stdlib_1.default.useLib.edges || {});
|
|
117
|
+
const comboTypes = Object.keys(stdlib_1.default.useLib.combos || {});
|
|
101
118
|
return {
|
|
102
119
|
node: nodeTypes
|
|
103
120
|
.map((config) => (0, extension_1.getExtension)(config, stdlib_1.default.useLib, 'node'))
|
|
@@ -119,16 +136,21 @@ class ItemController {
|
|
|
119
136
|
const { graph } = this;
|
|
120
137
|
// 0. clear groups on canvas, and create new groups
|
|
121
138
|
graph.canvas.removeChildren();
|
|
139
|
+
const comboGroup = new g_1.Group({ id: 'combo-group' });
|
|
122
140
|
const edgeGroup = new g_1.Group({ id: 'edge-group' });
|
|
123
141
|
const nodeGroup = new g_1.Group({ id: 'node-group' });
|
|
142
|
+
graph.canvas.appendChild(comboGroup);
|
|
124
143
|
graph.canvas.appendChild(edgeGroup);
|
|
125
144
|
graph.canvas.appendChild(nodeGroup);
|
|
126
145
|
this.nodeGroup = nodeGroup;
|
|
127
146
|
this.edgeGroup = edgeGroup;
|
|
147
|
+
this.comboGroup = comboGroup;
|
|
128
148
|
// Also create transient groups on transient canvas.
|
|
129
149
|
transientCanvas.removeChildren();
|
|
150
|
+
this.transientComboGroup = new g_1.Group({ id: 'combo-group' });
|
|
130
151
|
this.transientEdgeGroup = new g_1.Group({ id: 'edge-group' });
|
|
131
152
|
this.transientNodeGroup = new g_1.Group({ id: 'node-group' });
|
|
153
|
+
transientCanvas.appendChild(this.transientComboGroup);
|
|
132
154
|
transientCanvas.appendChild(this.transientEdgeGroup);
|
|
133
155
|
transientCanvas.appendChild(this.transientNodeGroup);
|
|
134
156
|
// 1. create lights for webgl 3d rendering
|
|
@@ -146,134 +168,233 @@ class ItemController {
|
|
|
146
168
|
intensity: Math.PI * 0.7,
|
|
147
169
|
},
|
|
148
170
|
});
|
|
171
|
+
// @ts-ignore
|
|
149
172
|
graph.canvas.appendChild(ambientLight);
|
|
173
|
+
// @ts-ignore
|
|
150
174
|
graph.canvas.appendChild(light);
|
|
151
175
|
const { width, height } = graph.canvas.getConfig();
|
|
152
176
|
graph.canvas.getCamera().setPerspective(0.1, 50000, 45, width / height);
|
|
153
177
|
}
|
|
154
178
|
// 2. create node / edge / combo items, classes from ../../item, and element drawing and updating fns from node/edge/comboExtensions
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
this.
|
|
160
|
-
|
|
179
|
+
const { nodes, edges, combos } = (0, data_1.deconstructData)({
|
|
180
|
+
nodes: graphCore.getAllNodes(),
|
|
181
|
+
edges: graphCore.getAllEdges(),
|
|
182
|
+
});
|
|
183
|
+
this.renderNodes(nodes, theme.node);
|
|
184
|
+
this.renderCombos(combos, theme.combo, graphCore);
|
|
185
|
+
this.renderEdges(edges, theme.edge);
|
|
186
|
+
this.sortByComboTree(graphCore);
|
|
187
|
+
// collapse the combos which has 'collapsed' in initial data
|
|
188
|
+
if (graphCore.hasTreeStructure('combo')) {
|
|
189
|
+
(0, data_1.graphCoreTreeDfs)(graphCore, graphCore.getRoots('combo'), (child) => {
|
|
190
|
+
if (child.data.collapsed)
|
|
191
|
+
this.collapseCombo(graphCore, child);
|
|
192
|
+
}, 'BT', 'combo');
|
|
193
|
+
}
|
|
194
|
+
// collapse the sub tree which has 'collapsed' in initial data
|
|
195
|
+
if (graphCore.hasTreeStructure('tree')) {
|
|
196
|
+
const collapseNodes = [];
|
|
197
|
+
(0, data_1.graphCoreTreeDfs)(graphCore, graphCore.getRoots('tree'), (child) => {
|
|
198
|
+
if (child.data.collapsed)
|
|
199
|
+
collapseNodes.push(child);
|
|
200
|
+
}, 'BT', 'tree');
|
|
201
|
+
this.collapseSubTree(collapseNodes, graphCore, false);
|
|
202
|
+
}
|
|
161
203
|
}
|
|
162
204
|
/**
|
|
163
205
|
* Listener of runtime's itemchange lifecycle hook.
|
|
164
206
|
* @param param
|
|
165
207
|
*/
|
|
166
208
|
onChange(param) {
|
|
167
|
-
const { changes, graphCore, theme = {},
|
|
168
|
-
const groupedChanges =
|
|
169
|
-
NodeRemoved: [],
|
|
170
|
-
EdgeRemoved: [],
|
|
171
|
-
NodeAdded: [],
|
|
172
|
-
EdgeAdded: [],
|
|
173
|
-
NodeDataUpdated: [],
|
|
174
|
-
EdgeUpdated: [],
|
|
175
|
-
EdgeDataUpdated: [],
|
|
176
|
-
};
|
|
177
|
-
changes.forEach((change) => {
|
|
178
|
-
const { type: changeType } = change;
|
|
179
|
-
groupedChanges[changeType].push(change);
|
|
180
|
-
});
|
|
209
|
+
const { changes, graphCore, action, animate = true, upsertAncestors = true, theme = {}, callback = () => { }, } = param;
|
|
210
|
+
const groupedChanges = (0, event_1.getGroupedChanges)(graphCore, changes);
|
|
181
211
|
const { itemMap } = this;
|
|
182
212
|
// change items according to the order of the keys in groupedChanges
|
|
183
213
|
// === 1. remove edges; 2. remove nodes ===
|
|
184
|
-
groupedChanges.EdgeRemoved
|
|
214
|
+
[...groupedChanges.EdgeRemoved, ...groupedChanges.NodeRemoved].forEach(({ value }) => {
|
|
185
215
|
const { id } = value;
|
|
186
|
-
const item = itemMap
|
|
216
|
+
const item = itemMap.get(id);
|
|
187
217
|
if (item) {
|
|
188
218
|
item.destroy();
|
|
189
|
-
delete
|
|
219
|
+
itemMap.delete(id);
|
|
190
220
|
}
|
|
191
221
|
});
|
|
192
|
-
const { node: nodeTheme = {}, edge: edgeTheme = {} } = theme;
|
|
222
|
+
const { node: nodeTheme = {}, edge: edgeTheme = {}, combo: comboTheme = {}, } = theme;
|
|
193
223
|
// === 3. add nodes ===
|
|
194
224
|
if (groupedChanges.NodeAdded.length) {
|
|
195
|
-
|
|
225
|
+
const newNodes = [];
|
|
226
|
+
const newCombos = [];
|
|
227
|
+
groupedChanges.NodeAdded.map((change) => change.value).forEach((model) => {
|
|
228
|
+
if (model.data._isCombo)
|
|
229
|
+
newCombos.push(model);
|
|
230
|
+
else
|
|
231
|
+
newNodes.push(model);
|
|
232
|
+
});
|
|
233
|
+
if (newNodes.length) {
|
|
234
|
+
this.renderNodes(newNodes, nodeTheme);
|
|
235
|
+
}
|
|
236
|
+
if (newCombos.length) {
|
|
237
|
+
this.renderCombos(newCombos, comboTheme, graphCore);
|
|
238
|
+
}
|
|
196
239
|
}
|
|
197
240
|
// === 4. add edges ===
|
|
198
241
|
if (groupedChanges.EdgeAdded.length) {
|
|
199
242
|
this.renderEdges(groupedChanges.EdgeAdded.map((change) => change.value), edgeTheme);
|
|
200
243
|
}
|
|
201
244
|
// === 5. update nodes's data ===
|
|
202
|
-
// merge changes for each node
|
|
245
|
+
// merge changes for each node or combo
|
|
203
246
|
if (groupedChanges.NodeDataUpdated.length) {
|
|
204
|
-
const
|
|
247
|
+
const nodeComboUpdate = {};
|
|
205
248
|
groupedChanges.NodeDataUpdated.forEach((change) => {
|
|
206
249
|
const { id, propertyName, newValue, oldValue } = change;
|
|
207
|
-
|
|
250
|
+
nodeComboUpdate[id] = nodeComboUpdate[id] || {
|
|
251
|
+
id,
|
|
252
|
+
previous: {},
|
|
253
|
+
current: {},
|
|
254
|
+
};
|
|
208
255
|
if (!propertyName) {
|
|
209
|
-
|
|
256
|
+
nodeComboUpdate[id] = {
|
|
257
|
+
id,
|
|
210
258
|
isReplace: true,
|
|
211
259
|
previous: oldValue,
|
|
212
260
|
current: newValue,
|
|
213
261
|
};
|
|
214
262
|
}
|
|
215
263
|
else {
|
|
216
|
-
|
|
217
|
-
|
|
264
|
+
nodeComboUpdate[id].previous[propertyName] = oldValue;
|
|
265
|
+
nodeComboUpdate[id].current[propertyName] = newValue;
|
|
218
266
|
}
|
|
219
267
|
});
|
|
220
268
|
const { dataTypeField: nodeDataTypeField } = nodeTheme;
|
|
221
|
-
const
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
269
|
+
const edgeIdsToUpdate = new Set();
|
|
270
|
+
const comboIdsToUpdate = new Set();
|
|
271
|
+
const updateRelates = (edgeIds) => {
|
|
272
|
+
const ids = edgeIds
|
|
273
|
+
? [...edgeIds]
|
|
274
|
+
: [...comboIdsToUpdate, ...edgeIdsToUpdate];
|
|
275
|
+
ids.forEach((nid) => {
|
|
276
|
+
const item = itemMap.get(nid);
|
|
225
277
|
if (item && !item.destroyed)
|
|
226
278
|
item.forceUpdate();
|
|
227
279
|
});
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
280
|
+
};
|
|
281
|
+
const debounceUpdateRelates = (0, util_1.debounce)(updateRelates, 16, false);
|
|
282
|
+
Object.values(nodeComboUpdate).forEach((updateObj) => {
|
|
283
|
+
var _a;
|
|
284
|
+
const { isReplace, previous, current, id } = updateObj;
|
|
285
|
+
if (!graphCore.hasNode(id))
|
|
286
|
+
return;
|
|
287
|
+
const onlyMove = action === 'updatePosition';
|
|
288
|
+
const item = itemMap.get(id);
|
|
289
|
+
if (!item || item.destroyed)
|
|
290
|
+
return;
|
|
291
|
+
const type = item.getType();
|
|
292
|
+
const innerModel = graphCore.getNode(id);
|
|
293
|
+
if (onlyMove &&
|
|
294
|
+
type === 'node' &&
|
|
295
|
+
isNaN(current.x) &&
|
|
296
|
+
isNaN(current.y)) {
|
|
297
|
+
callback(innerModel, true);
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
const nodeRelatedIdsToUpdate = new Set();
|
|
301
|
+
// collapse and expand
|
|
302
|
+
if (graphCore.hasTreeStructure('combo')) {
|
|
303
|
+
if (type === 'combo' && current.collapsed !== previous.collapsed) {
|
|
304
|
+
if (current.collapsed) {
|
|
305
|
+
this.collapseCombo(graphCore, innerModel);
|
|
306
|
+
}
|
|
307
|
+
else if (current.collapsed === false) {
|
|
308
|
+
this.expandCombo(graphCore, innerModel);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
const previousParentId = item.displayModel.data.parentId;
|
|
312
|
+
// update the current parent combo tree
|
|
313
|
+
// if the node has previous parent, related previous parent combo should be updated to
|
|
314
|
+
if (upsertAncestors) {
|
|
315
|
+
const begins = [innerModel];
|
|
316
|
+
if (previousParentId &&
|
|
317
|
+
previousParentId !== current.parentId &&
|
|
318
|
+
graphCore.hasNode(previousParentId)) {
|
|
319
|
+
begins.push(graphCore.getNode(previousParentId));
|
|
320
|
+
}
|
|
321
|
+
// ancestors and suceeds combos should be updated
|
|
322
|
+
(0, data_1.traverseAncestorsAndSucceeds)(this.graph, graphCore, begins, (treeItem) => {
|
|
323
|
+
if (treeItem.data._isCombo && treeItem.id !== innerModel.id)
|
|
324
|
+
comboIdsToUpdate.add(treeItem.id);
|
|
325
|
+
const relatedEdges = graphCore.getRelatedEdges(treeItem.id);
|
|
326
|
+
relatedEdges.forEach((edge) => {
|
|
327
|
+
edgeIdsToUpdate.add(edge.id);
|
|
328
|
+
nodeRelatedIdsToUpdate.add(edge.id);
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
else if (type === 'combo') {
|
|
333
|
+
// only the succeed combos should be updated
|
|
334
|
+
(0, data_1.graphComboTreeDfs)(this.graph, [innerModel], (child) => {
|
|
335
|
+
const relatedEdges = graphCore.getRelatedEdges(child.id);
|
|
336
|
+
relatedEdges.forEach((edge) => {
|
|
337
|
+
edgeIdsToUpdate.add(edge.id);
|
|
338
|
+
nodeRelatedIdsToUpdate.add(edge.id);
|
|
339
|
+
});
|
|
340
|
+
if (child.data._isCombo && child.id !== innerModel.id)
|
|
341
|
+
comboIdsToUpdate.add(child.id);
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
}
|
|
234
345
|
// update the theme if the dataType value is changed
|
|
235
346
|
let itemTheme;
|
|
236
347
|
if (nodeDataTypeField &&
|
|
237
348
|
previous[nodeDataTypeField] !== current[nodeDataTypeField]) {
|
|
238
349
|
itemTheme = getItemTheme(this.nodeDataTypeSet, nodeDataTypeField, current[nodeDataTypeField], nodeTheme);
|
|
239
350
|
}
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}
|
|
245
|
-
catch (e) {
|
|
246
|
-
innerModel = graphCore.getNode(Number(id));
|
|
247
|
-
}
|
|
248
|
-
let relatedEdgeInnerModels;
|
|
249
|
-
try {
|
|
250
|
-
relatedEdgeInnerModels = graphCore.getRelatedEdges(id);
|
|
251
|
-
}
|
|
252
|
-
catch (e) {
|
|
253
|
-
relatedEdgeInnerModels = graphCore.getRelatedEdges(Number(id));
|
|
254
|
-
}
|
|
255
|
-
const nodeRelatedToUpdate = {};
|
|
351
|
+
const preventPolylineEdgeOverlap = ((_a = innerModel === null || innerModel === void 0 ? void 0 : innerModel.data) === null || _a === void 0 ? void 0 : _a.preventPolylineEdgeOverlap) || false;
|
|
352
|
+
const relatedEdgeInnerModels = preventPolylineEdgeOverlap
|
|
353
|
+
? this.findNearEdgesByNode(id, graphCore).concat(graphCore.getRelatedEdges(id))
|
|
354
|
+
: graphCore.getRelatedEdges(id);
|
|
256
355
|
relatedEdgeInnerModels.forEach((edge) => {
|
|
257
|
-
|
|
258
|
-
|
|
356
|
+
edgeIdsToUpdate.add(edge.id);
|
|
357
|
+
nodeRelatedIdsToUpdate.add(edge.id);
|
|
259
358
|
});
|
|
260
|
-
|
|
261
|
-
|
|
359
|
+
item.onframe = () => updateRelates(nodeRelatedIdsToUpdate);
|
|
360
|
+
let statesCache;
|
|
361
|
+
if (innerModel.data._isCombo &&
|
|
362
|
+
previous.collapsed !== current.collapsed) {
|
|
363
|
+
statesCache = this.graph.getItemAllStates(id);
|
|
364
|
+
this.graph.clearItemState(id);
|
|
365
|
+
}
|
|
366
|
+
item.update(innerModel, { previous, current }, isReplace, itemTheme, onlyMove, animate,
|
|
262
367
|
// call after updating finished
|
|
263
|
-
() => {
|
|
264
|
-
|
|
265
|
-
|
|
368
|
+
(0, util_1.throttle)((_, canceled) => {
|
|
369
|
+
var _a;
|
|
370
|
+
(_a = item.onframe) === null || _a === void 0 ? void 0 : _a.call(item, true);
|
|
371
|
+
item.onframe = undefined;
|
|
372
|
+
if (statesCache) {
|
|
373
|
+
statesCache.forEach((state) => this.graph.setItemState(id, state, true));
|
|
374
|
+
}
|
|
375
|
+
callback(innerModel, canceled);
|
|
376
|
+
}, 500, {
|
|
377
|
+
leading: false,
|
|
378
|
+
trailing: true,
|
|
379
|
+
}));
|
|
380
|
+
const parentItem = this.itemMap.get(current.parentId);
|
|
381
|
+
if (current.parentId && (parentItem === null || parentItem === void 0 ? void 0 : parentItem.model.data.collapsed)) {
|
|
382
|
+
this.graph.executeWithoutStacking(() => {
|
|
383
|
+
this.graph.hideItem(innerModel.id, false);
|
|
384
|
+
});
|
|
385
|
+
}
|
|
266
386
|
});
|
|
267
|
-
|
|
387
|
+
debounceUpdateRelates();
|
|
268
388
|
}
|
|
269
389
|
// === 6. update edges' data ===
|
|
270
390
|
if (groupedChanges.EdgeDataUpdated.length) {
|
|
271
391
|
const edgeUpdate = {};
|
|
272
392
|
groupedChanges.EdgeDataUpdated.forEach((change) => {
|
|
273
393
|
const { id, propertyName, newValue, oldValue } = change;
|
|
274
|
-
edgeUpdate[id] = edgeUpdate[id] || { previous: {}, current: {} };
|
|
394
|
+
edgeUpdate[id] = edgeUpdate[id] || { id, previous: {}, current: {} };
|
|
275
395
|
if (!propertyName) {
|
|
276
396
|
edgeUpdate[id] = {
|
|
397
|
+
id,
|
|
277
398
|
isReplace: true,
|
|
278
399
|
previous: oldValue,
|
|
279
400
|
current: newValue,
|
|
@@ -284,17 +405,19 @@ class ItemController {
|
|
|
284
405
|
edgeUpdate[id].current[propertyName] = newValue;
|
|
285
406
|
}
|
|
286
407
|
});
|
|
287
|
-
const { dataTypeField: edgeDataTypeField } = edgeTheme;
|
|
288
|
-
Object.
|
|
289
|
-
const { isReplace, current, previous } =
|
|
408
|
+
const { dataTypeField: edgeDataTypeField = '' } = edgeTheme;
|
|
409
|
+
Object.values(edgeUpdate).forEach((updateObj) => {
|
|
410
|
+
const { isReplace, current, previous, id } = updateObj;
|
|
290
411
|
// update the theme if the dataType value is changed
|
|
291
412
|
let itemTheme;
|
|
292
413
|
if (previous[edgeDataTypeField] !== current[edgeDataTypeField]) {
|
|
293
414
|
itemTheme = getItemTheme(this.edgeDataTypeSet, edgeDataTypeField, current[edgeDataTypeField], edgeTheme);
|
|
294
415
|
}
|
|
295
|
-
const item = itemMap
|
|
416
|
+
const item = itemMap.get(id);
|
|
296
417
|
const innerModel = graphCore.getEdge(id);
|
|
297
|
-
item
|
|
418
|
+
if (!item || item.destroyed)
|
|
419
|
+
return;
|
|
420
|
+
item.update(innerModel, { current, previous }, isReplace, itemTheme, undefined, animate, (_, canceled) => callback(innerModel, canceled));
|
|
298
421
|
});
|
|
299
422
|
}
|
|
300
423
|
// === 7. update edges' source target ===
|
|
@@ -303,16 +426,35 @@ class ItemController {
|
|
|
303
426
|
groupedChanges.EdgeUpdated.forEach((change) => {
|
|
304
427
|
// propertyName is 'source' or 'target'
|
|
305
428
|
const { id, propertyName, newValue } = change;
|
|
306
|
-
edgeUpdate[id] = edgeUpdate[id] || {};
|
|
429
|
+
edgeUpdate[id] = edgeUpdate[id] || { id };
|
|
307
430
|
edgeUpdate[id][propertyName] = newValue;
|
|
308
431
|
});
|
|
309
|
-
Object.
|
|
310
|
-
const { source, target } =
|
|
311
|
-
const item = itemMap
|
|
432
|
+
Object.values(edgeUpdate).forEach((updateObj) => {
|
|
433
|
+
const { source, target, id } = updateObj;
|
|
434
|
+
const item = itemMap.get(id);
|
|
312
435
|
if (source !== undefined)
|
|
313
|
-
item.updateEnd('source', this.itemMap
|
|
436
|
+
item.updateEnd('source', this.itemMap.get(source));
|
|
314
437
|
if (target !== undefined)
|
|
315
|
-
item.updateEnd('target', this.itemMap
|
|
438
|
+
item.updateEnd('target', this.itemMap.get(target));
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
// === 8. combo tree structure change, resort the shapes ===
|
|
442
|
+
if (groupedChanges.ComboStructureChanged.length) {
|
|
443
|
+
this.sortByComboTree(graphCore);
|
|
444
|
+
}
|
|
445
|
+
// === 9. tree data structure change, hide the new node and edge while one of the ancestor is collapsed ===
|
|
446
|
+
if (groupedChanges.TreeStructureChanged.length) {
|
|
447
|
+
groupedChanges.TreeStructureChanged.forEach((change) => {
|
|
448
|
+
const { nodeId } = change;
|
|
449
|
+
// hide it when an ancestor is collapsed
|
|
450
|
+
let parent = graphCore.getParent(nodeId, 'tree');
|
|
451
|
+
while (parent) {
|
|
452
|
+
if (parent.data.collapsed) {
|
|
453
|
+
this.graph.hideItem(nodeId, true);
|
|
454
|
+
break;
|
|
455
|
+
}
|
|
456
|
+
parent = graphCore.getParent(parent.id, 'tree');
|
|
457
|
+
}
|
|
316
458
|
});
|
|
317
459
|
}
|
|
318
460
|
}
|
|
@@ -328,7 +470,7 @@ class ItemController {
|
|
|
328
470
|
onItemStateChange(param) {
|
|
329
471
|
const { ids, states, value } = param;
|
|
330
472
|
ids.forEach((id) => {
|
|
331
|
-
const item = this.itemMap
|
|
473
|
+
const item = this.itemMap.get(id);
|
|
332
474
|
if (!item) {
|
|
333
475
|
console.warn(`Fail to set state for item ${id}, which is not exist.`);
|
|
334
476
|
return;
|
|
@@ -343,56 +485,122 @@ class ItemController {
|
|
|
343
485
|
});
|
|
344
486
|
}
|
|
345
487
|
onItemVisibilityChange(param) {
|
|
346
|
-
const { ids, value, animate = true } = param;
|
|
488
|
+
const { ids, value, graphCore, animate = true } = param;
|
|
347
489
|
ids.forEach((id) => {
|
|
348
|
-
const item = this.itemMap
|
|
490
|
+
const item = this.itemMap.get(id);
|
|
349
491
|
if (!item) {
|
|
350
492
|
console.warn(`Fail to set visibility for item ${id}, which is not exist.`);
|
|
351
493
|
return;
|
|
352
494
|
}
|
|
495
|
+
const type = item.getType();
|
|
353
496
|
if (value) {
|
|
354
|
-
|
|
497
|
+
if (type === 'edge') {
|
|
498
|
+
item.show(animate);
|
|
499
|
+
}
|
|
500
|
+
else {
|
|
501
|
+
if (graphCore.hasTreeStructure('combo')) {
|
|
502
|
+
let anccestorCollapsed = false;
|
|
503
|
+
(0, data_1.traverseAncestors)(graphCore, [item.model], (model) => {
|
|
504
|
+
if (model.data.collapsed)
|
|
505
|
+
anccestorCollapsed = true;
|
|
506
|
+
return anccestorCollapsed;
|
|
507
|
+
});
|
|
508
|
+
if (anccestorCollapsed)
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
const relatedEdges = graphCore.getRelatedEdges(id);
|
|
512
|
+
item.show(animate);
|
|
513
|
+
relatedEdges.forEach(({ id: edgeId, source, target }) => {
|
|
514
|
+
var _a;
|
|
515
|
+
if (this.getItemVisible(source) && this.getItemVisible(target))
|
|
516
|
+
(_a = this.itemMap.get(edgeId)) === null || _a === void 0 ? void 0 : _a.show(animate);
|
|
517
|
+
});
|
|
518
|
+
}
|
|
355
519
|
}
|
|
356
520
|
else {
|
|
357
521
|
item.hide(animate);
|
|
522
|
+
if (type !== 'edge') {
|
|
523
|
+
const relatedEdges = graphCore.getRelatedEdges(id);
|
|
524
|
+
relatedEdges.forEach(({ id: edgeId }) => {
|
|
525
|
+
var _a;
|
|
526
|
+
(_a = this.itemMap.get(edgeId)) === null || _a === void 0 ? void 0 : _a.hide(animate);
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
onItemZIndexChange(params) {
|
|
533
|
+
const { ids = [], action, graphCore } = params;
|
|
534
|
+
ids.forEach((id) => {
|
|
535
|
+
const item = this.itemMap.get(id);
|
|
536
|
+
if (!item)
|
|
537
|
+
return;
|
|
538
|
+
if (action === 'front') {
|
|
539
|
+
item.toFront();
|
|
540
|
+
if (graphCore.hasTreeStructure('combo')) {
|
|
541
|
+
(0, data_1.graphComboTreeDfs)(this.graph, [item.model], (model) => {
|
|
542
|
+
if (model.data._isCombo) {
|
|
543
|
+
const subCombo = this.itemMap.get(model.id);
|
|
544
|
+
subCombo && subCombo.toFront();
|
|
545
|
+
}
|
|
546
|
+
}, 'TB');
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
else {
|
|
550
|
+
item.toBack();
|
|
551
|
+
if (graphCore.hasTreeStructure('combo')) {
|
|
552
|
+
(0, data_1.traverseGraphAncestors)(this.graph, [item.model], (model) => {
|
|
553
|
+
var _a;
|
|
554
|
+
(_a = this.itemMap.get(model.id)) === null || _a === void 0 ? void 0 : _a.toBack();
|
|
555
|
+
});
|
|
556
|
+
}
|
|
358
557
|
}
|
|
359
558
|
});
|
|
360
559
|
}
|
|
361
560
|
onTransientUpdate(param) {
|
|
362
561
|
const { transientObjectMap } = this;
|
|
363
|
-
const { type, id, config = {}, canvas } = param;
|
|
364
|
-
const { style = {}, data = {}, capture, action, onlyDrawKeyShape, } = config;
|
|
562
|
+
const { type, id, config = {}, canvas, graphCore } = param;
|
|
563
|
+
const { style = {}, data = {}, capture, action, onlyDrawKeyShape, upsertAncestors, } = config;
|
|
365
564
|
const isItemType = type === 'node' || type === 'edge' || type === 'combo';
|
|
366
565
|
// Removing
|
|
367
566
|
if (action === 'remove') {
|
|
368
567
|
if (isItemType) {
|
|
369
|
-
const transientItem = this.transientItemMap
|
|
568
|
+
const transientItem = this.transientItemMap.get(id);
|
|
569
|
+
if (type === 'combo') {
|
|
570
|
+
// remove children from bottom to top
|
|
571
|
+
(0, data_1.graphCoreTreeDfs)(graphCore, [graphCore.getNode(id)], (child) => {
|
|
572
|
+
const transientChild = this.transientItemMap.get(child.id);
|
|
573
|
+
if (transientChild && !transientChild.destroyed) {
|
|
574
|
+
transientChild.destroy();
|
|
575
|
+
}
|
|
576
|
+
this.transientItemMap.delete(child.id);
|
|
577
|
+
}, 'BT');
|
|
578
|
+
}
|
|
370
579
|
if (transientItem && !transientItem.destroyed) {
|
|
371
580
|
transientItem.destroy();
|
|
372
581
|
}
|
|
373
|
-
|
|
582
|
+
this.transientItemMap.delete(id);
|
|
374
583
|
return;
|
|
375
584
|
}
|
|
376
585
|
else {
|
|
377
|
-
const preObj = transientObjectMap
|
|
378
|
-
if (preObj && !preObj.destroyed)
|
|
586
|
+
const preObj = transientObjectMap.get(id);
|
|
587
|
+
if (preObj && !preObj.destroyed)
|
|
379
588
|
preObj.destroy();
|
|
380
|
-
|
|
381
|
-
delete transientObjectMap[id];
|
|
589
|
+
transientObjectMap.delete(id);
|
|
382
590
|
return;
|
|
383
591
|
}
|
|
384
592
|
}
|
|
385
593
|
// Adding / Updating
|
|
386
594
|
if (isItemType) {
|
|
387
|
-
const item = this.itemMap
|
|
595
|
+
const item = this.itemMap.get(id);
|
|
388
596
|
if (!item) {
|
|
389
597
|
console.warn(`Fail to draw transient item of ${id}, which is not exist.`);
|
|
390
598
|
return;
|
|
391
599
|
}
|
|
392
|
-
const transientItem = (0, item_1.upsertTransientItem)(item, this.transientNodeGroup, this.transientEdgeGroup, this.transientItemMap, onlyDrawKeyShape);
|
|
600
|
+
const transientItem = (0, item_1.upsertTransientItem)(item, this.transientNodeGroup, this.transientEdgeGroup, this.transientComboGroup, this.transientItemMap, this.itemMap, graphCore, onlyDrawKeyShape, upsertAncestors);
|
|
393
601
|
if (onlyDrawKeyShape) {
|
|
394
602
|
// only update node positions to cloned node container(group)
|
|
395
|
-
if (type === 'node' &&
|
|
603
|
+
if ((type === 'node' || type === 'combo') &&
|
|
396
604
|
data.hasOwnProperty('x') &&
|
|
397
605
|
data.hasOwnProperty('y')) {
|
|
398
606
|
const { x, y } = data;
|
|
@@ -402,16 +610,54 @@ class ItemController {
|
|
|
402
610
|
}
|
|
403
611
|
else {
|
|
404
612
|
const transItem = transientItem;
|
|
613
|
+
const positionChanged = data.hasOwnProperty('x') && data.hasOwnProperty('y');
|
|
614
|
+
if (type === 'combo' && positionChanged) {
|
|
615
|
+
const { x, y } = data;
|
|
616
|
+
const { x: ox = x, y: oy = y } = transItem.displayModel.data;
|
|
617
|
+
const dx = x - ox;
|
|
618
|
+
const dy = y - oy;
|
|
619
|
+
// move combo = move children nodes from bottom to top
|
|
620
|
+
(0, data_1.graphCoreTreeDfs)(graphCore, [transItem.model], (node) => {
|
|
621
|
+
const transChild = this.transientItemMap.get(node.id);
|
|
622
|
+
if (!transChild)
|
|
623
|
+
return;
|
|
624
|
+
const { x: childX = 0, y: childY = 0 } = transChild.model
|
|
625
|
+
.data;
|
|
626
|
+
transChild === null || transChild === void 0 ? void 0 : transChild.update(Object.assign(Object.assign({}, transChild.model), { data: Object.assign(Object.assign({}, transChild.model.data), { x: childX + dx, y: childY + dy }) }));
|
|
627
|
+
}, 'BT');
|
|
628
|
+
}
|
|
629
|
+
if (graphCore.hasTreeStructure('combo') &&
|
|
630
|
+
type !== 'edge' &&
|
|
631
|
+
positionChanged) {
|
|
632
|
+
// force update ancestor combos in the sametime
|
|
633
|
+
let currentAncestor = graphCore.getParent(transItem.model.id, 'combo');
|
|
634
|
+
while (currentAncestor) {
|
|
635
|
+
const ancestorItem = this.transientItemMap.get(currentAncestor.id);
|
|
636
|
+
if (ancestorItem)
|
|
637
|
+
ancestorItem.forceUpdate();
|
|
638
|
+
currentAncestor = graphCore.getParent(currentAncestor.id, 'combo');
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
// Update the target combo's posiiton and other props
|
|
405
642
|
transItem.update(Object.assign(Object.assign({}, transItem.model), { data: Object.assign(Object.assign({}, transItem.model.data), data) }));
|
|
406
643
|
}
|
|
407
644
|
return;
|
|
408
645
|
}
|
|
409
|
-
const
|
|
646
|
+
const idStr = String(id);
|
|
647
|
+
const shape = (0, shape_1.upsertShape)(type, idStr, style, Object.fromEntries(transientObjectMap));
|
|
648
|
+
transientObjectMap.set(idStr, shape);
|
|
410
649
|
shape.style.pointerEvents = capture ? 'auto' : 'none';
|
|
411
650
|
canvas.getRoot().appendChild(shape);
|
|
412
651
|
}
|
|
413
652
|
getTransient(id) {
|
|
414
|
-
return this.transientObjectMap
|
|
653
|
+
return this.transientObjectMap.get(id);
|
|
654
|
+
}
|
|
655
|
+
getTransientItem(id) {
|
|
656
|
+
return this.transientItemMap[id];
|
|
657
|
+
}
|
|
658
|
+
findDisplayModel(id) {
|
|
659
|
+
var _a;
|
|
660
|
+
return (_a = this.itemMap.get(id)) === null || _a === void 0 ? void 0 : _a.displayModel;
|
|
415
661
|
}
|
|
416
662
|
/**
|
|
417
663
|
* Create nodes with inner data to canvas.
|
|
@@ -419,7 +665,7 @@ class ItemController {
|
|
|
419
665
|
*/
|
|
420
666
|
renderNodes(models, nodeTheme = {}) {
|
|
421
667
|
const { nodeExtensions, nodeGroup, nodeDataTypeSet, graph } = this;
|
|
422
|
-
const { dataTypeField } = nodeTheme;
|
|
668
|
+
const { dataTypeField = '' } = nodeTheme;
|
|
423
669
|
const zoom = graph.getZoom();
|
|
424
670
|
models.forEach((node) => {
|
|
425
671
|
// get the base styles from theme
|
|
@@ -427,7 +673,7 @@ class ItemController {
|
|
|
427
673
|
if (dataTypeField)
|
|
428
674
|
dataType = node.data[dataTypeField];
|
|
429
675
|
const itemTheme = getItemTheme(nodeDataTypeSet, dataTypeField, dataType, nodeTheme);
|
|
430
|
-
this.itemMap
|
|
676
|
+
this.itemMap.set(node.id, new node_1.default({
|
|
431
677
|
model: node,
|
|
432
678
|
renderExtensions: nodeExtensions,
|
|
433
679
|
containerGroup: nodeGroup,
|
|
@@ -439,7 +685,50 @@ class ItemController {
|
|
|
439
685
|
? // TODO: G type
|
|
440
686
|
graph.canvas.context.deviceRendererPlugin.getDevice()
|
|
441
687
|
: undefined,
|
|
688
|
+
}));
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
renderCombos(models, comboTheme = {}, graphCore) {
|
|
692
|
+
const { comboExtensions, comboGroup, comboDataTypeSet, graph, itemMap } = this;
|
|
693
|
+
const { dataTypeField = '' } = comboTheme;
|
|
694
|
+
const zoom = graph.getZoom();
|
|
695
|
+
models.forEach((combo) => {
|
|
696
|
+
// get the base styles from theme
|
|
697
|
+
let dataType;
|
|
698
|
+
if (dataTypeField)
|
|
699
|
+
dataType = combo.data[dataTypeField];
|
|
700
|
+
const itemTheme = getItemTheme(comboDataTypeSet, dataTypeField, dataType, comboTheme);
|
|
701
|
+
const getCombinedBounds = () => {
|
|
702
|
+
// calculate the position of the combo according to its children
|
|
703
|
+
return (0, shape_1.getCombinedBoundsByData)(graph, graphCore
|
|
704
|
+
.getChildren(combo.id, 'combo')
|
|
705
|
+
.map(({ id }) => itemMap.get(id))
|
|
706
|
+
.filter(Boolean));
|
|
707
|
+
};
|
|
708
|
+
const getChildren = () => {
|
|
709
|
+
const childModels = graphCore.getChildren(combo.id, 'combo');
|
|
710
|
+
return childModels.map(({ id }) => itemMap.get(id));
|
|
711
|
+
};
|
|
712
|
+
const comboItem = new combo_1.default({
|
|
713
|
+
model: combo,
|
|
714
|
+
getCombinedBounds,
|
|
715
|
+
getChildren,
|
|
716
|
+
renderExtensions: comboExtensions,
|
|
717
|
+
containerGroup: comboGroup,
|
|
718
|
+
mapper: this.comboMapper,
|
|
719
|
+
stateMapper: this.comboStateMapper,
|
|
720
|
+
zoom,
|
|
721
|
+
theme: itemTheme,
|
|
722
|
+
device: graph.rendererType === 'webgl-3d'
|
|
723
|
+
? graph.canvas.context.deviceRendererPlugin.getDevice()
|
|
724
|
+
: undefined,
|
|
442
725
|
});
|
|
726
|
+
// ------- for integration tests -------
|
|
727
|
+
comboItem.getCombinedBounds = getCombinedBounds;
|
|
728
|
+
comboItem.getChildren = getChildren;
|
|
729
|
+
comboItem.type = 'combo';
|
|
730
|
+
// ------- for integration tests end-------
|
|
731
|
+
itemMap.set(combo.id, comboItem);
|
|
443
732
|
});
|
|
444
733
|
}
|
|
445
734
|
/**
|
|
@@ -448,24 +737,27 @@ class ItemController {
|
|
|
448
737
|
*/
|
|
449
738
|
renderEdges(models, edgeTheme = {}) {
|
|
450
739
|
const { edgeExtensions, edgeGroup, itemMap, edgeDataTypeSet, graph } = this;
|
|
451
|
-
const { dataTypeField } = edgeTheme;
|
|
740
|
+
const { dataTypeField = '' } = edgeTheme;
|
|
452
741
|
const zoom = graph.getZoom();
|
|
742
|
+
const nodeMap = filterItemMapByType(itemMap, 'node');
|
|
453
743
|
models.forEach((edge) => {
|
|
454
744
|
const { source, target, id } = edge;
|
|
455
|
-
const sourceItem = itemMap
|
|
456
|
-
const targetItem = itemMap
|
|
745
|
+
const sourceItem = itemMap.get(source);
|
|
746
|
+
const targetItem = itemMap.get(target);
|
|
457
747
|
if (!sourceItem) {
|
|
458
748
|
console.warn(`The source node ${source} is not exist in the graph for edge ${id}, please add the node first`);
|
|
749
|
+
return;
|
|
459
750
|
}
|
|
460
751
|
if (!targetItem) {
|
|
461
752
|
console.warn(`The source node ${source} is not exist in the graph for edge ${id}, please add the node first`);
|
|
753
|
+
return;
|
|
462
754
|
}
|
|
463
755
|
// get the base styles from theme
|
|
464
756
|
let dataType;
|
|
465
757
|
if (dataTypeField)
|
|
466
758
|
dataType = edge.data[dataTypeField];
|
|
467
759
|
const itemTheme = getItemTheme(edgeDataTypeSet, dataTypeField, dataType, edgeTheme);
|
|
468
|
-
itemMap
|
|
760
|
+
itemMap.set(id, new edge_1.default({
|
|
469
761
|
model: edge,
|
|
470
762
|
renderExtensions: edgeExtensions,
|
|
471
763
|
containerGroup: edgeGroup,
|
|
@@ -473,9 +765,10 @@ class ItemController {
|
|
|
473
765
|
stateMapper: this.edgeStateMapper,
|
|
474
766
|
sourceItem,
|
|
475
767
|
targetItem,
|
|
768
|
+
nodeMap,
|
|
476
769
|
zoom,
|
|
477
770
|
theme: itemTheme,
|
|
478
|
-
});
|
|
771
|
+
}));
|
|
479
772
|
});
|
|
480
773
|
}
|
|
481
774
|
/**
|
|
@@ -487,7 +780,7 @@ class ItemController {
|
|
|
487
780
|
*/
|
|
488
781
|
findIdByState(itemType, state, value = true) {
|
|
489
782
|
const ids = [];
|
|
490
|
-
|
|
783
|
+
this.itemMap.forEach((item) => {
|
|
491
784
|
if (item.getType() !== itemType)
|
|
492
785
|
return;
|
|
493
786
|
if (item.hasState(state) === value)
|
|
@@ -502,36 +795,291 @@ class ItemController {
|
|
|
502
795
|
* @returns {boolean | string} the state value
|
|
503
796
|
*/
|
|
504
797
|
getItemState(id, state) {
|
|
505
|
-
const item = this.itemMap
|
|
798
|
+
const item = this.itemMap.get(id);
|
|
506
799
|
if (!item) {
|
|
507
800
|
console.warn(`Fail to get item state, the item with id ${id} does not exist.`);
|
|
508
801
|
return false;
|
|
509
802
|
}
|
|
510
803
|
return item.hasState(state);
|
|
511
804
|
}
|
|
805
|
+
getItemAllStates(id) {
|
|
806
|
+
const item = this.itemMap.get(id);
|
|
807
|
+
if (!item) {
|
|
808
|
+
console.warn(`Fail to get item state, the item with id ${id} does not exist.`);
|
|
809
|
+
return [];
|
|
810
|
+
}
|
|
811
|
+
return item
|
|
812
|
+
.getStates()
|
|
813
|
+
.filter(({ value }) => value)
|
|
814
|
+
.map(({ name }) => name);
|
|
815
|
+
}
|
|
512
816
|
getItemById(id) {
|
|
513
|
-
return this.itemMap
|
|
817
|
+
return this.itemMap.get(id);
|
|
514
818
|
}
|
|
515
|
-
getItemBBox(id, isKeyShape = false) {
|
|
516
|
-
const item =
|
|
819
|
+
getItemBBox(id, isKeyShape = false, isTransient = false) {
|
|
820
|
+
const item = isTransient
|
|
821
|
+
? this.transientItemMap.get(id)
|
|
822
|
+
: this.itemMap.get(id);
|
|
517
823
|
if (!item) {
|
|
518
824
|
console.warn(`Fail to get item bbox, the item with id ${id} does not exist.`);
|
|
519
825
|
return false;
|
|
520
826
|
}
|
|
827
|
+
if (item instanceof g_1.Group)
|
|
828
|
+
return item.getRenderBounds();
|
|
521
829
|
return isKeyShape ? item.getKeyBBox() : item.getBBox();
|
|
522
830
|
}
|
|
523
831
|
getItemVisible(id) {
|
|
524
|
-
const item = this.itemMap
|
|
832
|
+
const item = this.itemMap.get(id);
|
|
525
833
|
if (!item) {
|
|
526
834
|
console.warn(`Fail to get item visible, the item with id ${id} does not exist.`);
|
|
527
835
|
return false;
|
|
528
836
|
}
|
|
529
837
|
return item.isVisible();
|
|
530
838
|
}
|
|
839
|
+
/**
|
|
840
|
+
* Identify edges that are intersected by a particular node
|
|
841
|
+
* @param nodeId node id
|
|
842
|
+
* @param graphCore
|
|
843
|
+
* @returns
|
|
844
|
+
*/
|
|
845
|
+
findNearEdgesByNode(nodeId, graphCore) {
|
|
846
|
+
var _a;
|
|
847
|
+
const edges = graphCore.getAllEdges();
|
|
848
|
+
const canvasBBox = this.graph.getRenderBBox(undefined);
|
|
849
|
+
const quadTree = new polyline_1.QuadTree(canvasBBox, 4);
|
|
850
|
+
(0, util_1.each)(edges, (edge) => {
|
|
851
|
+
const { data: { x: sourceX, y: sourceY }, } = graphCore.getNode(edge.source);
|
|
852
|
+
const { data: { x: targetX, y: targetY }, } = graphCore.getNode(edge.target);
|
|
853
|
+
quadTree.insert({
|
|
854
|
+
id: edge.id,
|
|
855
|
+
p1: { x: sourceX, y: sourceY },
|
|
856
|
+
p2: { x: targetX, y: targetY },
|
|
857
|
+
bbox: this.graph.getRenderBBox(edge.id),
|
|
858
|
+
});
|
|
859
|
+
});
|
|
860
|
+
// update node position
|
|
861
|
+
const node = (this.getTransientItem(nodeId) ||
|
|
862
|
+
this.getItemById(nodeId));
|
|
863
|
+
const nodeBBox = this.graph.getRenderBBox(nodeId);
|
|
864
|
+
const nodeData = (_a = node === null || node === void 0 ? void 0 : node.model) === null || _a === void 0 ? void 0 : _a.data;
|
|
865
|
+
if (nodeData) {
|
|
866
|
+
nodeBBox.update([nodeData.x, nodeData.y, 0], nodeBBox.halfExtents);
|
|
867
|
+
}
|
|
868
|
+
const checker = new polyline_1.EdgeCollisionChecker(quadTree);
|
|
869
|
+
const collisions = checker.getCollidingEdges(nodeBBox);
|
|
870
|
+
const collidingEdges = (0, util_1.map)(collisions, (collision) => graphCore.getEdge(collision.id));
|
|
871
|
+
return collidingEdges;
|
|
872
|
+
}
|
|
873
|
+
sortByComboTree(graphCore) {
|
|
874
|
+
if (!graphCore.hasTreeStructure('combo'))
|
|
875
|
+
return;
|
|
876
|
+
(0, data_1.graphCoreTreeDfs)(graphCore, graphCore.getRoots('combo'), (node) => {
|
|
877
|
+
const nodeItem = this.itemMap.get(node.id);
|
|
878
|
+
if (node.data._isCombo && nodeItem) {
|
|
879
|
+
nodeItem.toFront();
|
|
880
|
+
}
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
collapseCombo(graphCore, comboModel) {
|
|
884
|
+
let relatedEdges = [];
|
|
885
|
+
const succeedIds = [];
|
|
886
|
+
// find the succeeds in collapsed
|
|
887
|
+
(0, data_1.graphComboTreeDfs)(this.graph, [comboModel], (child) => {
|
|
888
|
+
if (child.id !== comboModel.id) {
|
|
889
|
+
this.graph.executeWithoutStacking(() => {
|
|
890
|
+
this.graph.hideItem(child.id, false);
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
relatedEdges = relatedEdges.concat(graphCore.getRelatedEdges(child.id));
|
|
894
|
+
succeedIds.push(child.id);
|
|
895
|
+
});
|
|
896
|
+
const pairs = [];
|
|
897
|
+
(0, util_1.uniq)(relatedEdges).forEach((edge) => {
|
|
898
|
+
const { id, source: s, target: t } = edge;
|
|
899
|
+
if (!this.graph.getItemVisible(id))
|
|
900
|
+
return;
|
|
901
|
+
const sourceIsSucceed = succeedIds.includes(s);
|
|
902
|
+
const targetIsSucceed = succeedIds.includes(t);
|
|
903
|
+
// do not add virtual edge if the source and target are both the succeed
|
|
904
|
+
if (sourceIsSucceed && targetIsSucceed)
|
|
905
|
+
return;
|
|
906
|
+
const source = sourceIsSucceed ? comboModel.id : s;
|
|
907
|
+
const target = targetIsSucceed ? comboModel.id : t;
|
|
908
|
+
pairs.push({ source, target });
|
|
909
|
+
});
|
|
910
|
+
// each item in groupedEdges is a virtual edge
|
|
911
|
+
this.graph.executeWithoutStacking(() => {
|
|
912
|
+
this.graph.addData('edge', groupVirtualEdges(pairs));
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
expandCombo(graphCore, comboModel) {
|
|
916
|
+
let isAncestorCollapsed = false;
|
|
917
|
+
(0, data_1.traverseAncestors)(graphCore, [comboModel], (anccestor) => {
|
|
918
|
+
if (anccestor.data.collapsed) {
|
|
919
|
+
isAncestorCollapsed = true;
|
|
920
|
+
return true;
|
|
921
|
+
}
|
|
922
|
+
return false;
|
|
923
|
+
});
|
|
924
|
+
if (isAncestorCollapsed)
|
|
925
|
+
return;
|
|
926
|
+
const relatedVirtualEdgeIds = [];
|
|
927
|
+
let edgesToShow = [];
|
|
928
|
+
const nodesToShow = [];
|
|
929
|
+
// show the succeeds and remove the related virtual edges, including the succeeds' related edges
|
|
930
|
+
(0, data_1.graphComboTreeDfs)(this.graph, [comboModel], (child) => {
|
|
931
|
+
graphCore.getRelatedEdges(child.id).forEach((edge) => {
|
|
932
|
+
if (edge.data._virtual)
|
|
933
|
+
relatedVirtualEdgeIds.push(edge.id);
|
|
934
|
+
else
|
|
935
|
+
edgesToShow.push(edge.id);
|
|
936
|
+
});
|
|
937
|
+
if (child.id !== comboModel.id) {
|
|
938
|
+
if (!graphCore.getNode(child.data.parentId).data.collapsed) {
|
|
939
|
+
nodesToShow.push(child.id);
|
|
940
|
+
}
|
|
941
|
+
// re-add collapsed succeeds' virtual edges by calling collapseCombo
|
|
942
|
+
if (child.data._isCombo && child.data.collapsed) {
|
|
943
|
+
this.collapseCombo(graphCore, child);
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
});
|
|
947
|
+
const virtualPairs = [];
|
|
948
|
+
const visibleAncestorMap = new Map();
|
|
949
|
+
edgesToShow = (0, util_1.uniq)(edgesToShow.filter((eid) => {
|
|
950
|
+
const { source, target } = graphCore.getEdge(eid);
|
|
951
|
+
const ends = { source, target };
|
|
952
|
+
const endsVisible = {
|
|
953
|
+
source: this.graph.getItemVisible(source) || nodesToShow.includes(source),
|
|
954
|
+
target: this.graph.getItemVisible(target) || nodesToShow.includes(target),
|
|
955
|
+
};
|
|
956
|
+
// actual edges to show
|
|
957
|
+
if (endsVisible.source && endsVisible.target)
|
|
958
|
+
return true;
|
|
959
|
+
// add virtual edges by finding the visible ancestor
|
|
960
|
+
const virtualEnds = { source: undefined, target: undefined };
|
|
961
|
+
Object.keys(virtualEnds).forEach((end) => {
|
|
962
|
+
if (!endsVisible[end]) {
|
|
963
|
+
if (!visibleAncestorMap.get(ends[end])) {
|
|
964
|
+
(0, data_1.traverseAncestors)(graphCore, [graphCore.getNode(ends[end])], (ancestor) => {
|
|
965
|
+
if (visibleAncestorMap.has(ends[end]))
|
|
966
|
+
return;
|
|
967
|
+
if (this.graph.getItemVisible(ancestor.id) ||
|
|
968
|
+
nodesToShow.includes(ancestor.id))
|
|
969
|
+
visibleAncestorMap.set(ends[end], ancestor.id);
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
virtualEnds[end] = visibleAncestorMap.get(ends[end]);
|
|
973
|
+
}
|
|
974
|
+
else {
|
|
975
|
+
virtualEnds[end] = ends[end];
|
|
976
|
+
}
|
|
977
|
+
});
|
|
978
|
+
if (virtualEnds.source !== undefined &&
|
|
979
|
+
virtualEnds.target !== undefined) {
|
|
980
|
+
virtualPairs.push(virtualEnds);
|
|
981
|
+
}
|
|
982
|
+
return false;
|
|
983
|
+
}));
|
|
984
|
+
// remove related virtual edges
|
|
985
|
+
this.graph.executeWithoutStacking(() => {
|
|
986
|
+
this.graph.removeData('edge', (0, util_1.uniq)(relatedVirtualEdgeIds));
|
|
987
|
+
this.graph.showItem(edgesToShow.concat(nodesToShow));
|
|
988
|
+
// add virtual edges by grouping visible ancestor edges
|
|
989
|
+
this.graph.addData('edge', groupVirtualEdges(virtualPairs));
|
|
990
|
+
});
|
|
991
|
+
}
|
|
992
|
+
/**
|
|
993
|
+
* Collapse or expand a sub tree according to action
|
|
994
|
+
* @param params
|
|
995
|
+
*/
|
|
996
|
+
onTreeCollapseExpand(params) {
|
|
997
|
+
const { ids, animate, action, graphCore } = params;
|
|
998
|
+
const rootModels = ids.map((id) => graphCore.getNode(id));
|
|
999
|
+
switch (action) {
|
|
1000
|
+
case 'collapse':
|
|
1001
|
+
this.collapseSubTree(rootModels, graphCore, animate);
|
|
1002
|
+
break;
|
|
1003
|
+
case 'expand':
|
|
1004
|
+
default:
|
|
1005
|
+
this.expandSubTree(rootModels, graphCore, animate);
|
|
1006
|
+
break;
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Collapse sub tree(s).
|
|
1011
|
+
* @param rootModels The root node models of sub trees
|
|
1012
|
+
* @param graphCore
|
|
1013
|
+
* @param animate Whether enable animations for expanding, true by default
|
|
1014
|
+
* @returns
|
|
1015
|
+
*/
|
|
1016
|
+
collapseSubTree(rootModels, graphCore, animate = true) {
|
|
1017
|
+
let positions = [];
|
|
1018
|
+
rootModels.forEach((root) => {
|
|
1019
|
+
let shouldCollapse = true;
|
|
1020
|
+
const nodes = [];
|
|
1021
|
+
(0, data_1.graphCoreTreeDfs)(graphCore, [root], (node) => {
|
|
1022
|
+
var _a;
|
|
1023
|
+
if (node.id === root.id)
|
|
1024
|
+
return;
|
|
1025
|
+
const neighbors = graphCore.getNeighbors(node.id);
|
|
1026
|
+
if (!((_a = graphCore.getChildren(node.id, 'tree')) === null || _a === void 0 ? void 0 : _a.length) &&
|
|
1027
|
+
neighbors.length > 1) {
|
|
1028
|
+
shouldCollapse = false;
|
|
1029
|
+
}
|
|
1030
|
+
nodes.push(node);
|
|
1031
|
+
}, 'TB', 'tree', {
|
|
1032
|
+
stopAllFn: () => !shouldCollapse,
|
|
1033
|
+
});
|
|
1034
|
+
if (shouldCollapse) {
|
|
1035
|
+
positions = positions.concat(nodes.map((node) => ({
|
|
1036
|
+
id: node.id,
|
|
1037
|
+
data: { x: root.data.x, y: root.data.y },
|
|
1038
|
+
})));
|
|
1039
|
+
}
|
|
1040
|
+
});
|
|
1041
|
+
if (!positions.length)
|
|
1042
|
+
return;
|
|
1043
|
+
this.graph.updateNodePosition(positions, undefined, !animate, (model, canceled) => {
|
|
1044
|
+
this.graph.hideItem(model.id, canceled);
|
|
1045
|
+
}, undefined);
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* Expand sub tree(s).
|
|
1049
|
+
* @param rootModels The root node models of sub trees.
|
|
1050
|
+
* @param graphCore
|
|
1051
|
+
* @param animate Whether enable animations for expanding, true by default.
|
|
1052
|
+
* @returns
|
|
1053
|
+
*/
|
|
1054
|
+
expandSubTree(rootModels, graphCore, animate = true) {
|
|
1055
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1056
|
+
let allNodeIds = [];
|
|
1057
|
+
let allEdgeIds = [];
|
|
1058
|
+
rootModels.forEach((root) => {
|
|
1059
|
+
const nodeIds = [];
|
|
1060
|
+
(0, data_1.graphCoreTreeDfs)(graphCore, [root], (node) => nodeIds.push(node.id), 'TB', 'tree', {
|
|
1061
|
+
stopBranchFn: (node) => {
|
|
1062
|
+
const shouldStop = node.id !== root.id && node.data.collapsed;
|
|
1063
|
+
if (shouldStop)
|
|
1064
|
+
nodeIds.push(node.id);
|
|
1065
|
+
return shouldStop;
|
|
1066
|
+
},
|
|
1067
|
+
});
|
|
1068
|
+
allEdgeIds = allEdgeIds.concat(graphCore
|
|
1069
|
+
.getAllEdges()
|
|
1070
|
+
.filter((edge) => nodeIds.includes(edge.source) && nodeIds.includes(edge.target))
|
|
1071
|
+
.map((edge) => edge.id));
|
|
1072
|
+
allNodeIds = allNodeIds.concat(nodeIds.filter((id) => id !== root.id));
|
|
1073
|
+
});
|
|
1074
|
+
const ids = (0, util_1.uniq)(allNodeIds.concat(allEdgeIds));
|
|
1075
|
+
this.graph.showItem(ids, !animate);
|
|
1076
|
+
yield this.graph.layout(undefined, !animate);
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
531
1079
|
}
|
|
532
1080
|
exports.ItemController = ItemController;
|
|
533
1081
|
const getItemTheme = (dataTypeSet, dataTypeField, dataType, itemTheme) => {
|
|
534
|
-
const { styles: themeStyles, lodStrategy } = itemTheme;
|
|
1082
|
+
const { styles: themeStyles = [], lodStrategy } = itemTheme;
|
|
535
1083
|
const formattedLodStrategy = (0, zoom_1.formatLodStrategy)(lodStrategy);
|
|
536
1084
|
if (!dataTypeField) {
|
|
537
1085
|
// dataType field is not assigned
|
|
@@ -548,11 +1096,53 @@ const getItemTheme = (dataTypeSet, dataTypeField, dataType, itemTheme) => {
|
|
|
548
1096
|
themeStyle = themeStyles[idx % themeStylesLength];
|
|
549
1097
|
}
|
|
550
1098
|
else if ((0, util_1.isObject)(themeStyles)) {
|
|
551
|
-
themeStyle =
|
|
1099
|
+
themeStyle =
|
|
1100
|
+
themeStyles[dataType] ||
|
|
1101
|
+
themeStyles.others;
|
|
552
1102
|
}
|
|
553
1103
|
return {
|
|
554
1104
|
styles: themeStyle,
|
|
555
1105
|
lodStrategy: formattedLodStrategy,
|
|
556
1106
|
};
|
|
557
1107
|
};
|
|
1108
|
+
const filterItemMapByType = (itemMap, type) => {
|
|
1109
|
+
const filteredMap = new Map();
|
|
1110
|
+
itemMap.forEach((value, key) => {
|
|
1111
|
+
if (value.type === type) {
|
|
1112
|
+
filteredMap.set(key, value);
|
|
1113
|
+
}
|
|
1114
|
+
});
|
|
1115
|
+
return filteredMap;
|
|
1116
|
+
};
|
|
1117
|
+
const groupVirtualEdges = (pairs) => {
|
|
1118
|
+
const groupedVirtualEdges = new Map();
|
|
1119
|
+
pairs.forEach((edge) => {
|
|
1120
|
+
const { source, target } = edge;
|
|
1121
|
+
const key = `${source}_${target}`;
|
|
1122
|
+
const group = groupedVirtualEdges.get(key) || {
|
|
1123
|
+
edges: [],
|
|
1124
|
+
source,
|
|
1125
|
+
target,
|
|
1126
|
+
};
|
|
1127
|
+
group.edges.push(edge);
|
|
1128
|
+
groupedVirtualEdges.set(key, group);
|
|
1129
|
+
});
|
|
1130
|
+
// each item in groupedEdges is a virtual edge
|
|
1131
|
+
const virtualEdges = [];
|
|
1132
|
+
groupedVirtualEdges.forEach((group) => {
|
|
1133
|
+
const { source, target, edges } = group;
|
|
1134
|
+
virtualEdges.push({
|
|
1135
|
+
id: `virtual-${(0, util_1.uniqueId)()}`,
|
|
1136
|
+
source,
|
|
1137
|
+
target,
|
|
1138
|
+
data: {
|
|
1139
|
+
_virtual: true,
|
|
1140
|
+
keyShape: {
|
|
1141
|
+
lineWidth: edges.length,
|
|
1142
|
+
},
|
|
1143
|
+
},
|
|
1144
|
+
});
|
|
1145
|
+
});
|
|
1146
|
+
return virtualEdges;
|
|
1147
|
+
};
|
|
558
1148
|
//# sourceMappingURL=item.js.map
|