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