@antv/g6 5.0.0-alpha.9 → 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 +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 +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 +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 +320 -223
- 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 +15 -11
- 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 +98 -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 +10 -1
- package/esm/stdlib/item/edge/base.js +36 -5
- 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 +45 -1
- package/esm/stdlib/item/node/base.js +97 -12
- 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 +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 +47 -42
- 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 +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 +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 +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 +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 +318 -221
- 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 +16 -11
- 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 +102 -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 +10 -1
- package/lib/stdlib/item/edge/base.js +35 -4
- 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 +45 -1
- package/lib/stdlib/item/node/base.js +97 -12
- 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 +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 +46 -40
- 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 +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 +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 +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 +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 +410 -258
- 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 +47 -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 +15 -13
- 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 +146 -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 +66 -4
- 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 +116 -12
- 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 +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 +122 -61
- 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 +30 -13
- 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,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
|
};
|
|
@@ -16,11 +25,12 @@ const extension_1 = require("../../util/extension");
|
|
|
16
25
|
const item_1 = require("../../util/item");
|
|
17
26
|
const zoom_1 = require("../../util/zoom");
|
|
18
27
|
const data_1 = require("../../util/data");
|
|
28
|
+
const event_1 = require("../../util/event");
|
|
29
|
+
const polyline_1 = require("../../util/polyline");
|
|
19
30
|
/**
|
|
20
31
|
* Manages and stores the node / edge / combo items.
|
|
21
32
|
*/
|
|
22
33
|
class ItemController {
|
|
23
|
-
// private comboTreeView: GraphView<any, any>;
|
|
24
34
|
constructor(graph) {
|
|
25
35
|
this.nodeExtensions = [];
|
|
26
36
|
this.edgeExtensions = [];
|
|
@@ -28,18 +38,18 @@ class ItemController {
|
|
|
28
38
|
/**
|
|
29
39
|
* Node / edge / combo items map
|
|
30
40
|
*/
|
|
31
|
-
this.itemMap =
|
|
41
|
+
this.itemMap = new Map();
|
|
32
42
|
this.nodeDataTypeSet = new Set();
|
|
33
43
|
this.edgeDataTypeSet = new Set();
|
|
34
44
|
this.comboDataTypeSet = new Set();
|
|
35
45
|
// The G shapes or groups on transient map drawn by this controller
|
|
36
|
-
this.transientObjectMap =
|
|
37
|
-
this.transientItemMap =
|
|
46
|
+
this.transientObjectMap = new Map();
|
|
47
|
+
this.transientItemMap = new Map();
|
|
38
48
|
this.onViewportChange = (0, util_1.debounce)(({ transform, effectTiming }) => {
|
|
39
49
|
const { zoom } = transform;
|
|
40
50
|
if (zoom) {
|
|
41
51
|
const zoomRatio = this.graph.getZoom();
|
|
42
|
-
|
|
52
|
+
this.itemMap.forEach((item) => item.updateZoom(zoomRatio));
|
|
43
53
|
this.zoom = zoomRatio;
|
|
44
54
|
}
|
|
45
55
|
}, 500, false);
|
|
@@ -48,7 +58,7 @@ class ItemController {
|
|
|
48
58
|
return;
|
|
49
59
|
const { nodeDataTypeSet, edgeDataTypeSet } = this;
|
|
50
60
|
const { node: nodeTheme, edge: edgeTheme } = theme;
|
|
51
|
-
|
|
61
|
+
this.itemMap.forEach((item) => {
|
|
52
62
|
const itemTye = item.getType();
|
|
53
63
|
const usingTheme = itemTye === 'node' ? nodeTheme : edgeTheme;
|
|
54
64
|
const usingTypeSet = itemTye === 'node' ? nodeDataTypeSet : edgeDataTypeSet;
|
|
@@ -62,10 +72,12 @@ class ItemController {
|
|
|
62
72
|
};
|
|
63
73
|
this.onDestroy = () => {
|
|
64
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();
|
|
65
77
|
};
|
|
66
78
|
this.graph = graph;
|
|
67
79
|
// get mapper for node / edge / combo
|
|
68
|
-
const { node, edge, combo, nodeState, edgeState, comboState } = graph.getSpecification();
|
|
80
|
+
const { node, edge, combo, nodeState = {}, edgeState = {}, comboState = {}, } = graph.getSpecification();
|
|
69
81
|
this.nodeMapper = node;
|
|
70
82
|
this.edgeMapper = edge;
|
|
71
83
|
this.comboMapper = combo;
|
|
@@ -91,6 +103,7 @@ class ItemController {
|
|
|
91
103
|
this.graph.hooks.transientupdate.tap(this.onTransientUpdate.bind(this));
|
|
92
104
|
this.graph.hooks.viewportchange.tap(this.onViewportChange.bind(this));
|
|
93
105
|
this.graph.hooks.themechange.tap(this.onThemeChange.bind(this));
|
|
106
|
+
this.graph.hooks.treecollapseexpand.tap(this.onTreeCollapseExpand.bind(this));
|
|
94
107
|
this.graph.hooks.destroy.tap(this.onDestroy.bind(this));
|
|
95
108
|
}
|
|
96
109
|
/**
|
|
@@ -99,9 +112,9 @@ class ItemController {
|
|
|
99
112
|
getExtensions() {
|
|
100
113
|
// TODO: user need to config using node/edge/combo types from useLib to spec?
|
|
101
114
|
const { node, edge, combo } = this.graph.getSpecification();
|
|
102
|
-
const nodeTypes = Object.keys(stdlib_1.default.useLib.nodes);
|
|
103
|
-
const edgeTypes = Object.keys(stdlib_1.default.useLib.edges);
|
|
104
|
-
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 || {});
|
|
105
118
|
return {
|
|
106
119
|
node: nodeTypes
|
|
107
120
|
.map((config) => (0, extension_1.getExtension)(config, stdlib_1.default.useLib, 'node'))
|
|
@@ -155,7 +168,9 @@ class ItemController {
|
|
|
155
168
|
intensity: Math.PI * 0.7,
|
|
156
169
|
},
|
|
157
170
|
});
|
|
171
|
+
// @ts-ignore
|
|
158
172
|
graph.canvas.appendChild(ambientLight);
|
|
173
|
+
// @ts-ignore
|
|
159
174
|
graph.canvas.appendChild(light);
|
|
160
175
|
const { width, height } = graph.canvas.getConfig();
|
|
161
176
|
graph.canvas.getCamera().setPerspective(0.1, 50000, 45, width / height);
|
|
@@ -169,11 +184,21 @@ class ItemController {
|
|
|
169
184
|
this.renderCombos(combos, theme.combo, graphCore);
|
|
170
185
|
this.renderEdges(edges, theme.edge);
|
|
171
186
|
this.sortByComboTree(graphCore);
|
|
187
|
+
// collapse the combos which has 'collapsed' in initial data
|
|
172
188
|
if (graphCore.hasTreeStructure('combo')) {
|
|
173
189
|
(0, data_1.graphCoreTreeDfs)(graphCore, graphCore.getRoots('combo'), (child) => {
|
|
174
190
|
if (child.data.collapsed)
|
|
175
191
|
this.collapseCombo(graphCore, child);
|
|
176
|
-
}, 'BT');
|
|
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);
|
|
177
202
|
}
|
|
178
203
|
}
|
|
179
204
|
/**
|
|
@@ -181,30 +206,17 @@ class ItemController {
|
|
|
181
206
|
* @param param
|
|
182
207
|
*/
|
|
183
208
|
onChange(param) {
|
|
184
|
-
const { changes, graphCore, action, upsertAncestors = true, theme = {}, } = param;
|
|
185
|
-
const groupedChanges =
|
|
186
|
-
NodeRemoved: [],
|
|
187
|
-
EdgeRemoved: [],
|
|
188
|
-
NodeAdded: [],
|
|
189
|
-
EdgeAdded: [],
|
|
190
|
-
NodeDataUpdated: [],
|
|
191
|
-
EdgeUpdated: [],
|
|
192
|
-
EdgeDataUpdated: [],
|
|
193
|
-
TreeStructureChanged: [],
|
|
194
|
-
};
|
|
195
|
-
changes.forEach((change) => {
|
|
196
|
-
const { type: changeType } = change;
|
|
197
|
-
groupedChanges[changeType].push(change);
|
|
198
|
-
});
|
|
209
|
+
const { changes, graphCore, action, animate = true, upsertAncestors = true, theme = {}, callback = () => { }, } = param;
|
|
210
|
+
const groupedChanges = (0, event_1.getGroupedChanges)(graphCore, changes);
|
|
199
211
|
const { itemMap } = this;
|
|
200
212
|
// change items according to the order of the keys in groupedChanges
|
|
201
213
|
// === 1. remove edges; 2. remove nodes ===
|
|
202
|
-
groupedChanges.EdgeRemoved
|
|
214
|
+
[...groupedChanges.EdgeRemoved, ...groupedChanges.NodeRemoved].forEach(({ value }) => {
|
|
203
215
|
const { id } = value;
|
|
204
|
-
const item = itemMap
|
|
216
|
+
const item = itemMap.get(id);
|
|
205
217
|
if (item) {
|
|
206
218
|
item.destroy();
|
|
207
|
-
delete
|
|
219
|
+
itemMap.delete(id);
|
|
208
220
|
}
|
|
209
221
|
});
|
|
210
222
|
const { node: nodeTheme = {}, edge: edgeTheme = {}, combo: comboTheme = {}, } = theme;
|
|
@@ -236,11 +248,13 @@ class ItemController {
|
|
|
236
248
|
groupedChanges.NodeDataUpdated.forEach((change) => {
|
|
237
249
|
const { id, propertyName, newValue, oldValue } = change;
|
|
238
250
|
nodeComboUpdate[id] = nodeComboUpdate[id] || {
|
|
251
|
+
id,
|
|
239
252
|
previous: {},
|
|
240
253
|
current: {},
|
|
241
254
|
};
|
|
242
255
|
if (!propertyName) {
|
|
243
256
|
nodeComboUpdate[id] = {
|
|
257
|
+
id,
|
|
244
258
|
isReplace: true,
|
|
245
259
|
previous: oldValue,
|
|
246
260
|
current: newValue,
|
|
@@ -252,52 +266,39 @@ class ItemController {
|
|
|
252
266
|
}
|
|
253
267
|
});
|
|
254
268
|
const { dataTypeField: nodeDataTypeField } = nodeTheme;
|
|
255
|
-
const
|
|
256
|
-
const
|
|
257
|
-
const updateRelates = (
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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);
|
|
262
277
|
if (item && !item.destroyed)
|
|
263
278
|
item.forceUpdate();
|
|
264
279
|
});
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
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;
|
|
270
285
|
if (!graphCore.hasNode(id))
|
|
271
286
|
return;
|
|
272
|
-
const { isReplace, previous, current } = nodeComboUpdate[id];
|
|
273
287
|
const onlyMove = action === 'updatePosition';
|
|
274
|
-
const item = itemMap
|
|
288
|
+
const item = itemMap.get(id);
|
|
289
|
+
if (!item || item.destroyed)
|
|
290
|
+
return;
|
|
275
291
|
const type = item.getType();
|
|
276
|
-
|
|
292
|
+
const innerModel = graphCore.getNode(id);
|
|
293
|
+
if (onlyMove &&
|
|
294
|
+
type === 'node' &&
|
|
295
|
+
isNaN(current.x) &&
|
|
296
|
+
isNaN(current.y)) {
|
|
297
|
+
callback(innerModel, true);
|
|
277
298
|
return;
|
|
278
|
-
// update the theme if the dataType value is changed
|
|
279
|
-
let itemTheme;
|
|
280
|
-
if (nodeDataTypeField &&
|
|
281
|
-
previous[nodeDataTypeField] !== current[nodeDataTypeField]) {
|
|
282
|
-
itemTheme = getItemTheme(this.nodeDataTypeSet, nodeDataTypeField, current[nodeDataTypeField], nodeTheme);
|
|
283
299
|
}
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
const nodeRelatedToUpdate = {};
|
|
287
|
-
relatedEdgeInnerModels.forEach((edge) => {
|
|
288
|
-
edgeToUpdate[edge.id] = edge;
|
|
289
|
-
nodeRelatedToUpdate[edge.id] = edge;
|
|
290
|
-
});
|
|
291
|
-
const previousParentId = item.displayModel.data.parentId;
|
|
292
|
-
item.onframe = () => {
|
|
293
|
-
updateRelates(nodeRelatedToUpdate);
|
|
294
|
-
};
|
|
295
|
-
item.update(innerModel, { previous, current }, isReplace, itemTheme, onlyMove,
|
|
296
|
-
// call after updating finished
|
|
297
|
-
() => {
|
|
298
|
-
item.onframe();
|
|
299
|
-
item.onframe = undefined;
|
|
300
|
-
});
|
|
300
|
+
const nodeRelatedIdsToUpdate = new Set();
|
|
301
|
+
// collapse and expand
|
|
301
302
|
if (graphCore.hasTreeStructure('combo')) {
|
|
302
303
|
if (type === 'combo' && current.collapsed !== previous.collapsed) {
|
|
303
304
|
if (current.collapsed) {
|
|
@@ -307,6 +308,7 @@ class ItemController {
|
|
|
307
308
|
this.expandCombo(graphCore, innerModel);
|
|
308
309
|
}
|
|
309
310
|
}
|
|
311
|
+
const previousParentId = item.displayModel.data.parentId;
|
|
310
312
|
// update the current parent combo tree
|
|
311
313
|
// if the node has previous parent, related previous parent combo should be updated to
|
|
312
314
|
if (upsertAncestors) {
|
|
@@ -319,11 +321,11 @@ class ItemController {
|
|
|
319
321
|
// ancestors and suceeds combos should be updated
|
|
320
322
|
(0, data_1.traverseAncestorsAndSucceeds)(this.graph, graphCore, begins, (treeItem) => {
|
|
321
323
|
if (treeItem.data._isCombo && treeItem.id !== innerModel.id)
|
|
322
|
-
|
|
324
|
+
comboIdsToUpdate.add(treeItem.id);
|
|
323
325
|
const relatedEdges = graphCore.getRelatedEdges(treeItem.id);
|
|
324
326
|
relatedEdges.forEach((edge) => {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
+
edgeIdsToUpdate.add(edge.id);
|
|
328
|
+
nodeRelatedIdsToUpdate.add(edge.id);
|
|
327
329
|
});
|
|
328
330
|
});
|
|
329
331
|
}
|
|
@@ -332,29 +334,67 @@ class ItemController {
|
|
|
332
334
|
(0, data_1.graphComboTreeDfs)(this.graph, [innerModel], (child) => {
|
|
333
335
|
const relatedEdges = graphCore.getRelatedEdges(child.id);
|
|
334
336
|
relatedEdges.forEach((edge) => {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
+
edgeIdsToUpdate.add(edge.id);
|
|
338
|
+
nodeRelatedIdsToUpdate.add(edge.id);
|
|
337
339
|
});
|
|
338
340
|
if (child.data._isCombo && child.id !== innerModel.id)
|
|
339
|
-
|
|
341
|
+
comboIdsToUpdate.add(child.id);
|
|
340
342
|
});
|
|
341
343
|
}
|
|
342
344
|
}
|
|
343
|
-
|
|
345
|
+
// update the theme if the dataType value is changed
|
|
346
|
+
let itemTheme;
|
|
347
|
+
if (nodeDataTypeField &&
|
|
348
|
+
previous[nodeDataTypeField] !== current[nodeDataTypeField]) {
|
|
349
|
+
itemTheme = getItemTheme(this.nodeDataTypeSet, nodeDataTypeField, current[nodeDataTypeField], nodeTheme);
|
|
350
|
+
}
|
|
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);
|
|
355
|
+
relatedEdgeInnerModels.forEach((edge) => {
|
|
356
|
+
edgeIdsToUpdate.add(edge.id);
|
|
357
|
+
nodeRelatedIdsToUpdate.add(edge.id);
|
|
358
|
+
});
|
|
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,
|
|
367
|
+
// call after updating finished
|
|
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);
|
|
344
381
|
if (current.parentId && (parentItem === null || parentItem === void 0 ? void 0 : parentItem.model.data.collapsed)) {
|
|
345
|
-
this.graph.
|
|
382
|
+
this.graph.executeWithoutStacking(() => {
|
|
383
|
+
this.graph.hideItem(innerModel.id, false);
|
|
384
|
+
});
|
|
346
385
|
}
|
|
347
386
|
});
|
|
348
|
-
|
|
387
|
+
debounceUpdateRelates();
|
|
349
388
|
}
|
|
350
389
|
// === 6. update edges' data ===
|
|
351
390
|
if (groupedChanges.EdgeDataUpdated.length) {
|
|
352
391
|
const edgeUpdate = {};
|
|
353
392
|
groupedChanges.EdgeDataUpdated.forEach((change) => {
|
|
354
393
|
const { id, propertyName, newValue, oldValue } = change;
|
|
355
|
-
edgeUpdate[id] = edgeUpdate[id] || { previous: {}, current: {} };
|
|
394
|
+
edgeUpdate[id] = edgeUpdate[id] || { id, previous: {}, current: {} };
|
|
356
395
|
if (!propertyName) {
|
|
357
396
|
edgeUpdate[id] = {
|
|
397
|
+
id,
|
|
358
398
|
isReplace: true,
|
|
359
399
|
previous: oldValue,
|
|
360
400
|
current: newValue,
|
|
@@ -365,17 +405,19 @@ class ItemController {
|
|
|
365
405
|
edgeUpdate[id].current[propertyName] = newValue;
|
|
366
406
|
}
|
|
367
407
|
});
|
|
368
|
-
const { dataTypeField: edgeDataTypeField } = edgeTheme;
|
|
369
|
-
Object.
|
|
370
|
-
const { isReplace, current, previous } =
|
|
408
|
+
const { dataTypeField: edgeDataTypeField = '' } = edgeTheme;
|
|
409
|
+
Object.values(edgeUpdate).forEach((updateObj) => {
|
|
410
|
+
const { isReplace, current, previous, id } = updateObj;
|
|
371
411
|
// update the theme if the dataType value is changed
|
|
372
412
|
let itemTheme;
|
|
373
413
|
if (previous[edgeDataTypeField] !== current[edgeDataTypeField]) {
|
|
374
414
|
itemTheme = getItemTheme(this.edgeDataTypeSet, edgeDataTypeField, current[edgeDataTypeField], edgeTheme);
|
|
375
415
|
}
|
|
376
|
-
const item = itemMap
|
|
416
|
+
const item = itemMap.get(id);
|
|
377
417
|
const innerModel = graphCore.getEdge(id);
|
|
378
|
-
item
|
|
418
|
+
if (!item || item.destroyed)
|
|
419
|
+
return;
|
|
420
|
+
item.update(innerModel, { current, previous }, isReplace, itemTheme, undefined, animate, (_, canceled) => callback(innerModel, canceled));
|
|
379
421
|
});
|
|
380
422
|
}
|
|
381
423
|
// === 7. update edges' source target ===
|
|
@@ -384,22 +426,37 @@ class ItemController {
|
|
|
384
426
|
groupedChanges.EdgeUpdated.forEach((change) => {
|
|
385
427
|
// propertyName is 'source' or 'target'
|
|
386
428
|
const { id, propertyName, newValue } = change;
|
|
387
|
-
edgeUpdate[id] = edgeUpdate[id] || {};
|
|
429
|
+
edgeUpdate[id] = edgeUpdate[id] || { id };
|
|
388
430
|
edgeUpdate[id][propertyName] = newValue;
|
|
389
431
|
});
|
|
390
|
-
Object.
|
|
391
|
-
const { source, target } =
|
|
392
|
-
const item = itemMap
|
|
432
|
+
Object.values(edgeUpdate).forEach((updateObj) => {
|
|
433
|
+
const { source, target, id } = updateObj;
|
|
434
|
+
const item = itemMap.get(id);
|
|
393
435
|
if (source !== undefined)
|
|
394
|
-
item.updateEnd('source', this.itemMap
|
|
436
|
+
item.updateEnd('source', this.itemMap.get(source));
|
|
395
437
|
if (target !== undefined)
|
|
396
|
-
item.updateEnd('target', this.itemMap
|
|
438
|
+
item.updateEnd('target', this.itemMap.get(target));
|
|
397
439
|
});
|
|
398
440
|
}
|
|
399
441
|
// === 8. combo tree structure change, resort the shapes ===
|
|
400
|
-
if (groupedChanges.
|
|
442
|
+
if (groupedChanges.ComboStructureChanged.length) {
|
|
401
443
|
this.sortByComboTree(graphCore);
|
|
402
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
|
+
}
|
|
458
|
+
});
|
|
459
|
+
}
|
|
403
460
|
}
|
|
404
461
|
/**
|
|
405
462
|
* The listener for item state changing.
|
|
@@ -413,7 +470,7 @@ class ItemController {
|
|
|
413
470
|
onItemStateChange(param) {
|
|
414
471
|
const { ids, states, value } = param;
|
|
415
472
|
ids.forEach((id) => {
|
|
416
|
-
const item = this.itemMap
|
|
473
|
+
const item = this.itemMap.get(id);
|
|
417
474
|
if (!item) {
|
|
418
475
|
console.warn(`Fail to set state for item ${id}, which is not exist.`);
|
|
419
476
|
return;
|
|
@@ -430,7 +487,7 @@ class ItemController {
|
|
|
430
487
|
onItemVisibilityChange(param) {
|
|
431
488
|
const { ids, value, graphCore, animate = true } = param;
|
|
432
489
|
ids.forEach((id) => {
|
|
433
|
-
const item = this.itemMap
|
|
490
|
+
const item = this.itemMap.get(id);
|
|
434
491
|
if (!item) {
|
|
435
492
|
console.warn(`Fail to set visibility for item ${id}, which is not exist.`);
|
|
436
493
|
return;
|
|
@@ -441,20 +498,22 @@ class ItemController {
|
|
|
441
498
|
item.show(animate);
|
|
442
499
|
}
|
|
443
500
|
else {
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
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
|
+
}
|
|
452
511
|
const relatedEdges = graphCore.getRelatedEdges(id);
|
|
453
512
|
item.show(animate);
|
|
454
513
|
relatedEdges.forEach(({ id: edgeId, source, target }) => {
|
|
455
514
|
var _a;
|
|
456
515
|
if (this.getItemVisible(source) && this.getItemVisible(target))
|
|
457
|
-
(_a = this.itemMap
|
|
516
|
+
(_a = this.itemMap.get(edgeId)) === null || _a === void 0 ? void 0 : _a.show(animate);
|
|
458
517
|
});
|
|
459
518
|
}
|
|
460
519
|
}
|
|
@@ -464,30 +523,35 @@ class ItemController {
|
|
|
464
523
|
const relatedEdges = graphCore.getRelatedEdges(id);
|
|
465
524
|
relatedEdges.forEach(({ id: edgeId }) => {
|
|
466
525
|
var _a;
|
|
467
|
-
(_a = this.itemMap
|
|
526
|
+
(_a = this.itemMap.get(edgeId)) === null || _a === void 0 ? void 0 : _a.hide(animate);
|
|
468
527
|
});
|
|
469
528
|
}
|
|
470
529
|
}
|
|
471
530
|
});
|
|
472
531
|
}
|
|
473
532
|
onItemZIndexChange(params) {
|
|
474
|
-
const { ids = [], action } = params;
|
|
533
|
+
const { ids = [], action, graphCore } = params;
|
|
475
534
|
ids.forEach((id) => {
|
|
476
|
-
const item = this.itemMap
|
|
477
|
-
if (item)
|
|
478
|
-
|
|
535
|
+
const item = this.itemMap.get(id);
|
|
536
|
+
if (!item)
|
|
537
|
+
return;
|
|
538
|
+
if (action === 'front') {
|
|
539
|
+
item.toFront();
|
|
540
|
+
if (graphCore.hasTreeStructure('combo')) {
|
|
479
541
|
(0, data_1.graphComboTreeDfs)(this.graph, [item.model], (model) => {
|
|
480
542
|
if (model.data._isCombo) {
|
|
481
|
-
const subCombo = this.itemMap
|
|
543
|
+
const subCombo = this.itemMap.get(model.id);
|
|
482
544
|
subCombo && subCombo.toFront();
|
|
483
545
|
}
|
|
484
546
|
}, 'TB');
|
|
485
547
|
}
|
|
486
|
-
|
|
487
|
-
|
|
548
|
+
}
|
|
549
|
+
else {
|
|
550
|
+
item.toBack();
|
|
551
|
+
if (graphCore.hasTreeStructure('combo')) {
|
|
488
552
|
(0, data_1.traverseGraphAncestors)(this.graph, [item.model], (model) => {
|
|
489
553
|
var _a;
|
|
490
|
-
(_a = this.itemMap
|
|
554
|
+
(_a = this.itemMap.get(model.id)) === null || _a === void 0 ? void 0 : _a.toBack();
|
|
491
555
|
});
|
|
492
556
|
}
|
|
493
557
|
}
|
|
@@ -501,34 +565,34 @@ class ItemController {
|
|
|
501
565
|
// Removing
|
|
502
566
|
if (action === 'remove') {
|
|
503
567
|
if (isItemType) {
|
|
504
|
-
const transientItem = this.transientItemMap
|
|
568
|
+
const transientItem = this.transientItemMap.get(id);
|
|
505
569
|
if (type === 'combo') {
|
|
506
570
|
// remove children from bottom to top
|
|
507
571
|
(0, data_1.graphCoreTreeDfs)(graphCore, [graphCore.getNode(id)], (child) => {
|
|
508
|
-
const transientChild = this.transientItemMap
|
|
572
|
+
const transientChild = this.transientItemMap.get(child.id);
|
|
509
573
|
if (transientChild && !transientChild.destroyed) {
|
|
510
574
|
transientChild.destroy();
|
|
511
575
|
}
|
|
512
|
-
|
|
576
|
+
this.transientItemMap.delete(child.id);
|
|
513
577
|
}, 'BT');
|
|
514
578
|
}
|
|
515
579
|
if (transientItem && !transientItem.destroyed) {
|
|
516
580
|
transientItem.destroy();
|
|
517
581
|
}
|
|
518
|
-
|
|
582
|
+
this.transientItemMap.delete(id);
|
|
519
583
|
return;
|
|
520
584
|
}
|
|
521
585
|
else {
|
|
522
|
-
const preObj = transientObjectMap
|
|
586
|
+
const preObj = transientObjectMap.get(id);
|
|
523
587
|
if (preObj && !preObj.destroyed)
|
|
524
588
|
preObj.destroy();
|
|
525
|
-
delete
|
|
589
|
+
transientObjectMap.delete(id);
|
|
526
590
|
return;
|
|
527
591
|
}
|
|
528
592
|
}
|
|
529
593
|
// Adding / Updating
|
|
530
594
|
if (isItemType) {
|
|
531
|
-
const item = this.itemMap
|
|
595
|
+
const item = this.itemMap.get(id);
|
|
532
596
|
if (!item) {
|
|
533
597
|
console.warn(`Fail to draw transient item of ${id}, which is not exist.`);
|
|
534
598
|
return;
|
|
@@ -554,19 +618,21 @@ class ItemController {
|
|
|
554
618
|
const dy = y - oy;
|
|
555
619
|
// move combo = move children nodes from bottom to top
|
|
556
620
|
(0, data_1.graphCoreTreeDfs)(graphCore, [transItem.model], (node) => {
|
|
557
|
-
const transChild = this.transientItemMap
|
|
621
|
+
const transChild = this.transientItemMap.get(node.id);
|
|
558
622
|
if (!transChild)
|
|
559
623
|
return;
|
|
560
|
-
const { x: childX, y: childY } = transChild.model
|
|
624
|
+
const { x: childX = 0, y: childY = 0 } = transChild.model
|
|
561
625
|
.data;
|
|
562
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 }) }));
|
|
563
627
|
}, 'BT');
|
|
564
628
|
}
|
|
565
|
-
if (
|
|
629
|
+
if (graphCore.hasTreeStructure('combo') &&
|
|
630
|
+
type !== 'edge' &&
|
|
631
|
+
positionChanged) {
|
|
566
632
|
// force update ancestor combos in the sametime
|
|
567
633
|
let currentAncestor = graphCore.getParent(transItem.model.id, 'combo');
|
|
568
634
|
while (currentAncestor) {
|
|
569
|
-
const ancestorItem = this.transientItemMap
|
|
635
|
+
const ancestorItem = this.transientItemMap.get(currentAncestor.id);
|
|
570
636
|
if (ancestorItem)
|
|
571
637
|
ancestorItem.forceUpdate();
|
|
572
638
|
currentAncestor = graphCore.getParent(currentAncestor.id, 'combo');
|
|
@@ -577,12 +643,21 @@ class ItemController {
|
|
|
577
643
|
}
|
|
578
644
|
return;
|
|
579
645
|
}
|
|
580
|
-
const
|
|
646
|
+
const idStr = String(id);
|
|
647
|
+
const shape = (0, shape_1.upsertShape)(type, idStr, style, Object.fromEntries(transientObjectMap));
|
|
648
|
+
transientObjectMap.set(idStr, shape);
|
|
581
649
|
shape.style.pointerEvents = capture ? 'auto' : 'none';
|
|
582
650
|
canvas.getRoot().appendChild(shape);
|
|
583
651
|
}
|
|
584
652
|
getTransient(id) {
|
|
585
|
-
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;
|
|
586
661
|
}
|
|
587
662
|
/**
|
|
588
663
|
* Create nodes with inner data to canvas.
|
|
@@ -590,7 +665,7 @@ class ItemController {
|
|
|
590
665
|
*/
|
|
591
666
|
renderNodes(models, nodeTheme = {}) {
|
|
592
667
|
const { nodeExtensions, nodeGroup, nodeDataTypeSet, graph } = this;
|
|
593
|
-
const { dataTypeField } = nodeTheme;
|
|
668
|
+
const { dataTypeField = '' } = nodeTheme;
|
|
594
669
|
const zoom = graph.getZoom();
|
|
595
670
|
models.forEach((node) => {
|
|
596
671
|
// get the base styles from theme
|
|
@@ -598,7 +673,7 @@ class ItemController {
|
|
|
598
673
|
if (dataTypeField)
|
|
599
674
|
dataType = node.data[dataTypeField];
|
|
600
675
|
const itemTheme = getItemTheme(nodeDataTypeSet, dataTypeField, dataType, nodeTheme);
|
|
601
|
-
this.itemMap
|
|
676
|
+
this.itemMap.set(node.id, new node_1.default({
|
|
602
677
|
model: node,
|
|
603
678
|
renderExtensions: nodeExtensions,
|
|
604
679
|
containerGroup: nodeGroup,
|
|
@@ -610,12 +685,12 @@ class ItemController {
|
|
|
610
685
|
? // TODO: G type
|
|
611
686
|
graph.canvas.context.deviceRendererPlugin.getDevice()
|
|
612
687
|
: undefined,
|
|
613
|
-
});
|
|
688
|
+
}));
|
|
614
689
|
});
|
|
615
690
|
}
|
|
616
691
|
renderCombos(models, comboTheme = {}, graphCore) {
|
|
617
692
|
const { comboExtensions, comboGroup, comboDataTypeSet, graph, itemMap } = this;
|
|
618
|
-
const { dataTypeField } = comboTheme;
|
|
693
|
+
const { dataTypeField = '' } = comboTheme;
|
|
619
694
|
const zoom = graph.getZoom();
|
|
620
695
|
models.forEach((combo) => {
|
|
621
696
|
// get the base styles from theme
|
|
@@ -623,17 +698,21 @@ class ItemController {
|
|
|
623
698
|
if (dataTypeField)
|
|
624
699
|
dataType = combo.data[dataTypeField];
|
|
625
700
|
const itemTheme = getItemTheme(comboDataTypeSet, dataTypeField, dataType, comboTheme);
|
|
626
|
-
|
|
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({
|
|
627
713
|
model: combo,
|
|
628
|
-
getCombinedBounds
|
|
629
|
-
|
|
630
|
-
const childModels = graphCore.getChildren(combo.id, 'combo');
|
|
631
|
-
return (0, shape_1.getCombinedBoundsByData)(graph, childModels);
|
|
632
|
-
},
|
|
633
|
-
getChildren: () => {
|
|
634
|
-
const childModels = graphCore.getChildren(combo.id, 'combo');
|
|
635
|
-
return childModels.map(({ id }) => itemMap[id]);
|
|
636
|
-
},
|
|
714
|
+
getCombinedBounds,
|
|
715
|
+
getChildren,
|
|
637
716
|
renderExtensions: comboExtensions,
|
|
638
717
|
containerGroup: comboGroup,
|
|
639
718
|
mapper: this.comboMapper,
|
|
@@ -644,6 +723,12 @@ class ItemController {
|
|
|
644
723
|
? graph.canvas.context.deviceRendererPlugin.getDevice()
|
|
645
724
|
: undefined,
|
|
646
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);
|
|
647
732
|
});
|
|
648
733
|
}
|
|
649
734
|
/**
|
|
@@ -652,24 +737,27 @@ class ItemController {
|
|
|
652
737
|
*/
|
|
653
738
|
renderEdges(models, edgeTheme = {}) {
|
|
654
739
|
const { edgeExtensions, edgeGroup, itemMap, edgeDataTypeSet, graph } = this;
|
|
655
|
-
const { dataTypeField } = edgeTheme;
|
|
740
|
+
const { dataTypeField = '' } = edgeTheme;
|
|
656
741
|
const zoom = graph.getZoom();
|
|
742
|
+
const nodeMap = filterItemMapByType(itemMap, 'node');
|
|
657
743
|
models.forEach((edge) => {
|
|
658
744
|
const { source, target, id } = edge;
|
|
659
|
-
const sourceItem = itemMap
|
|
660
|
-
const targetItem = itemMap
|
|
745
|
+
const sourceItem = itemMap.get(source);
|
|
746
|
+
const targetItem = itemMap.get(target);
|
|
661
747
|
if (!sourceItem) {
|
|
662
748
|
console.warn(`The source node ${source} is not exist in the graph for edge ${id}, please add the node first`);
|
|
749
|
+
return;
|
|
663
750
|
}
|
|
664
751
|
if (!targetItem) {
|
|
665
752
|
console.warn(`The source node ${source} is not exist in the graph for edge ${id}, please add the node first`);
|
|
753
|
+
return;
|
|
666
754
|
}
|
|
667
755
|
// get the base styles from theme
|
|
668
756
|
let dataType;
|
|
669
757
|
if (dataTypeField)
|
|
670
758
|
dataType = edge.data[dataTypeField];
|
|
671
759
|
const itemTheme = getItemTheme(edgeDataTypeSet, dataTypeField, dataType, edgeTheme);
|
|
672
|
-
itemMap
|
|
760
|
+
itemMap.set(id, new edge_1.default({
|
|
673
761
|
model: edge,
|
|
674
762
|
renderExtensions: edgeExtensions,
|
|
675
763
|
containerGroup: edgeGroup,
|
|
@@ -677,9 +765,10 @@ class ItemController {
|
|
|
677
765
|
stateMapper: this.edgeStateMapper,
|
|
678
766
|
sourceItem,
|
|
679
767
|
targetItem,
|
|
768
|
+
nodeMap,
|
|
680
769
|
zoom,
|
|
681
770
|
theme: itemTheme,
|
|
682
|
-
});
|
|
771
|
+
}));
|
|
683
772
|
});
|
|
684
773
|
}
|
|
685
774
|
/**
|
|
@@ -691,7 +780,7 @@ class ItemController {
|
|
|
691
780
|
*/
|
|
692
781
|
findIdByState(itemType, state, value = true) {
|
|
693
782
|
const ids = [];
|
|
694
|
-
|
|
783
|
+
this.itemMap.forEach((item) => {
|
|
695
784
|
if (item.getType() !== itemType)
|
|
696
785
|
return;
|
|
697
786
|
if (item.hasState(state) === value)
|
|
@@ -706,18 +795,31 @@ class ItemController {
|
|
|
706
795
|
* @returns {boolean | string} the state value
|
|
707
796
|
*/
|
|
708
797
|
getItemState(id, state) {
|
|
709
|
-
const item = this.itemMap
|
|
798
|
+
const item = this.itemMap.get(id);
|
|
710
799
|
if (!item) {
|
|
711
800
|
console.warn(`Fail to get item state, the item with id ${id} does not exist.`);
|
|
712
801
|
return false;
|
|
713
802
|
}
|
|
714
803
|
return item.hasState(state);
|
|
715
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
|
+
}
|
|
716
816
|
getItemById(id) {
|
|
717
|
-
return this.itemMap
|
|
817
|
+
return this.itemMap.get(id);
|
|
718
818
|
}
|
|
719
819
|
getItemBBox(id, isKeyShape = false, isTransient = false) {
|
|
720
|
-
const item = isTransient
|
|
820
|
+
const item = isTransient
|
|
821
|
+
? this.transientItemMap.get(id)
|
|
822
|
+
: this.itemMap.get(id);
|
|
721
823
|
if (!item) {
|
|
722
824
|
console.warn(`Fail to get item bbox, the item with id ${id} does not exist.`);
|
|
723
825
|
return false;
|
|
@@ -727,18 +829,52 @@ class ItemController {
|
|
|
727
829
|
return isKeyShape ? item.getKeyBBox() : item.getBBox();
|
|
728
830
|
}
|
|
729
831
|
getItemVisible(id) {
|
|
730
|
-
const item = this.itemMap
|
|
832
|
+
const item = this.itemMap.get(id);
|
|
731
833
|
if (!item) {
|
|
732
834
|
console.warn(`Fail to get item visible, the item with id ${id} does not exist.`);
|
|
733
835
|
return false;
|
|
734
836
|
}
|
|
735
837
|
return item.isVisible();
|
|
736
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
|
+
}
|
|
737
873
|
sortByComboTree(graphCore) {
|
|
738
874
|
if (!graphCore.hasTreeStructure('combo'))
|
|
739
875
|
return;
|
|
740
876
|
(0, data_1.graphCoreTreeDfs)(graphCore, graphCore.getRoots('combo'), (node) => {
|
|
741
|
-
const nodeItem = this.itemMap
|
|
877
|
+
const nodeItem = this.itemMap.get(node.id);
|
|
742
878
|
if (node.data._isCombo && nodeItem) {
|
|
743
879
|
nodeItem.toFront();
|
|
744
880
|
}
|
|
@@ -747,18 +883,20 @@ class ItemController {
|
|
|
747
883
|
collapseCombo(graphCore, comboModel) {
|
|
748
884
|
let relatedEdges = [];
|
|
749
885
|
const succeedIds = [];
|
|
750
|
-
//
|
|
886
|
+
// find the succeeds in collapsed
|
|
751
887
|
(0, data_1.graphComboTreeDfs)(this.graph, [comboModel], (child) => {
|
|
752
|
-
if (child.id !== comboModel.id)
|
|
753
|
-
this.graph.
|
|
888
|
+
if (child.id !== comboModel.id) {
|
|
889
|
+
this.graph.executeWithoutStacking(() => {
|
|
890
|
+
this.graph.hideItem(child.id, false);
|
|
891
|
+
});
|
|
892
|
+
}
|
|
754
893
|
relatedEdges = relatedEdges.concat(graphCore.getRelatedEdges(child.id));
|
|
755
894
|
succeedIds.push(child.id);
|
|
756
895
|
});
|
|
757
|
-
const
|
|
758
|
-
const groupedEdges = new Map();
|
|
896
|
+
const pairs = [];
|
|
759
897
|
(0, util_1.uniq)(relatedEdges).forEach((edge) => {
|
|
760
|
-
const { source: s, target: t
|
|
761
|
-
if (
|
|
898
|
+
const { id, source: s, target: t } = edge;
|
|
899
|
+
if (!this.graph.getItemVisible(id))
|
|
762
900
|
return;
|
|
763
901
|
const sourceIsSucceed = succeedIds.includes(s);
|
|
764
902
|
const targetIsSucceed = succeedIds.includes(t);
|
|
@@ -767,27 +905,12 @@ class ItemController {
|
|
|
767
905
|
return;
|
|
768
906
|
const source = sourceIsSucceed ? comboModel.id : s;
|
|
769
907
|
const target = targetIsSucceed ? comboModel.id : t;
|
|
770
|
-
|
|
771
|
-
const group = groupedEdges.get(key) || { edges: [], source, target };
|
|
772
|
-
group.edges.push(edge);
|
|
773
|
-
groupedEdges.set(key, group);
|
|
908
|
+
pairs.push({ source, target });
|
|
774
909
|
});
|
|
775
910
|
// each item in groupedEdges is a virtual edge
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
virtualEdges.push({
|
|
779
|
-
id: `virtual-${(0, util_1.uniqueId)()}`,
|
|
780
|
-
source,
|
|
781
|
-
target,
|
|
782
|
-
data: {
|
|
783
|
-
_virtual: true,
|
|
784
|
-
keyShape: {
|
|
785
|
-
lineWidth: edges.length,
|
|
786
|
-
},
|
|
787
|
-
},
|
|
788
|
-
});
|
|
911
|
+
this.graph.executeWithoutStacking(() => {
|
|
912
|
+
this.graph.addData('edge', groupVirtualEdges(pairs));
|
|
789
913
|
});
|
|
790
|
-
this.graph.addData('edge', virtualEdges);
|
|
791
914
|
}
|
|
792
915
|
expandCombo(graphCore, comboModel) {
|
|
793
916
|
let isAncestorCollapsed = false;
|
|
@@ -801,15 +924,19 @@ class ItemController {
|
|
|
801
924
|
if (isAncestorCollapsed)
|
|
802
925
|
return;
|
|
803
926
|
const relatedVirtualEdgeIds = [];
|
|
804
|
-
|
|
927
|
+
let edgesToShow = [];
|
|
928
|
+
const nodesToShow = [];
|
|
929
|
+
// show the succeeds and remove the related virtual edges, including the succeeds' related edges
|
|
805
930
|
(0, data_1.graphComboTreeDfs)(this.graph, [comboModel], (child) => {
|
|
806
931
|
graphCore.getRelatedEdges(child.id).forEach((edge) => {
|
|
807
932
|
if (edge.data._virtual)
|
|
808
933
|
relatedVirtualEdgeIds.push(edge.id);
|
|
934
|
+
else
|
|
935
|
+
edgesToShow.push(edge.id);
|
|
809
936
|
});
|
|
810
937
|
if (child.id !== comboModel.id) {
|
|
811
938
|
if (!graphCore.getNode(child.data.parentId).data.collapsed) {
|
|
812
|
-
|
|
939
|
+
nodesToShow.push(child.id);
|
|
813
940
|
}
|
|
814
941
|
// re-add collapsed succeeds' virtual edges by calling collapseCombo
|
|
815
942
|
if (child.data._isCombo && child.data.collapsed) {
|
|
@@ -817,13 +944,142 @@ class ItemController {
|
|
|
817
944
|
}
|
|
818
945
|
}
|
|
819
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
|
+
}));
|
|
820
984
|
// remove related virtual edges
|
|
821
|
-
this.graph.
|
|
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
|
+
});
|
|
822
1078
|
}
|
|
823
1079
|
}
|
|
824
1080
|
exports.ItemController = ItemController;
|
|
825
1081
|
const getItemTheme = (dataTypeSet, dataTypeField, dataType, itemTheme) => {
|
|
826
|
-
const { styles: themeStyles, lodStrategy } = itemTheme;
|
|
1082
|
+
const { styles: themeStyles = [], lodStrategy } = itemTheme;
|
|
827
1083
|
const formattedLodStrategy = (0, zoom_1.formatLodStrategy)(lodStrategy);
|
|
828
1084
|
if (!dataTypeField) {
|
|
829
1085
|
// dataType field is not assigned
|
|
@@ -840,11 +1096,53 @@ const getItemTheme = (dataTypeSet, dataTypeField, dataType, itemTheme) => {
|
|
|
840
1096
|
themeStyle = themeStyles[idx % themeStylesLength];
|
|
841
1097
|
}
|
|
842
1098
|
else if ((0, util_1.isObject)(themeStyles)) {
|
|
843
|
-
themeStyle =
|
|
1099
|
+
themeStyle =
|
|
1100
|
+
themeStyles[dataType] ||
|
|
1101
|
+
themeStyles.others;
|
|
844
1102
|
}
|
|
845
1103
|
return {
|
|
846
1104
|
styles: themeStyle,
|
|
847
1105
|
lodStrategy: formattedLodStrategy,
|
|
848
1106
|
};
|
|
849
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
|
+
};
|
|
850
1148
|
//# sourceMappingURL=item.js.map
|