@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
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ComboModel, NodeModel } from 'types';
|
|
2
|
+
import { Point } from '../../../types/common';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Use cross product to judge the direction of the turn.
|
|
6
|
+
* Returns a positive value, if OAB makes a clockwise turn,
|
|
7
|
+
* negative for counter-clockwise turn, and zero if the points are collinear.
|
|
8
|
+
*/
|
|
9
|
+
export const cross = (a: Point, b: Point, o: Point) => {
|
|
10
|
+
return (a.y - o.y) * (b.x - o.x) - (a.x - o.x) * (b.y - o.y);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Generate a convex hull of given points. Andrew's monotone chain algorithm.
|
|
15
|
+
* @param points An array of [x, y] representing the coordinates of points.
|
|
16
|
+
* @return a list of vertices of the convex hull in counter-clockwise order,
|
|
17
|
+
*/
|
|
18
|
+
export const genConvexHull = (models: (NodeModel | ComboModel)[]) => {
|
|
19
|
+
const points: Point[] = models.map(
|
|
20
|
+
(model) =>
|
|
21
|
+
({
|
|
22
|
+
x: model.data.x,
|
|
23
|
+
y: model.data.y,
|
|
24
|
+
} as Point),
|
|
25
|
+
);
|
|
26
|
+
points.sort((a, b) => {
|
|
27
|
+
return a.x === b.x ? a.y - b.y : a.x - b.x;
|
|
28
|
+
});
|
|
29
|
+
// remove duplicate points
|
|
30
|
+
const pointMap = {};
|
|
31
|
+
for (let i = points.length - 1; i >= 0; i--) {
|
|
32
|
+
const { x, y } = points[i];
|
|
33
|
+
if (pointMap[`${x}-${y}`]) points.splice(i, 1);
|
|
34
|
+
pointMap[`${x}-${y}`] = true;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (points.length === 1) {
|
|
38
|
+
return points;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// build the lower hull
|
|
42
|
+
const lower = [];
|
|
43
|
+
for (let i = 0; i < points.length; i++) {
|
|
44
|
+
while (
|
|
45
|
+
lower.length >= 2 &&
|
|
46
|
+
cross(lower[lower.length - 2], lower[lower.length - 1], points[i]) <= 0
|
|
47
|
+
) {
|
|
48
|
+
lower.pop();
|
|
49
|
+
}
|
|
50
|
+
lower.push(points[i]);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// build the upper hull
|
|
54
|
+
const upper = [];
|
|
55
|
+
for (let i = points.length - 1; i >= 0; i--) {
|
|
56
|
+
while (
|
|
57
|
+
upper.length >= 2 &&
|
|
58
|
+
cross(upper[upper.length - 2], upper[upper.length - 1], points[i]) <= 0
|
|
59
|
+
) {
|
|
60
|
+
upper.pop();
|
|
61
|
+
}
|
|
62
|
+
upper.push(points[i]);
|
|
63
|
+
}
|
|
64
|
+
upper.pop();
|
|
65
|
+
lower.pop();
|
|
66
|
+
const strictHull = lower.concat(upper);
|
|
67
|
+
return strictHull;
|
|
68
|
+
};
|
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
import { parsePathString } from '@antv/path-util';
|
|
2
|
+
import { DisplayObject } from '@antv/g';
|
|
3
|
+
import { isArray } from '@antv/util';
|
|
4
|
+
import { ComboModel, ID, IGraph, NodeModel } from '../../../types';
|
|
5
|
+
import { ShapeStyle } from '../../../types/item';
|
|
6
|
+
import { isPolygonsIntersect } from '../../../util/shape';
|
|
7
|
+
import { pathToPoints } from '../../../util/path';
|
|
8
|
+
import {
|
|
9
|
+
getClosedSpline,
|
|
10
|
+
roundedHull,
|
|
11
|
+
paddedHull,
|
|
12
|
+
getPolygonIntersectByLine,
|
|
13
|
+
getExtendPoint,
|
|
14
|
+
getInvertBaseline,
|
|
15
|
+
} from './util';
|
|
16
|
+
import { genConvexHull } from './convexHull';
|
|
17
|
+
import { genBubbleSet } from './bubbleset';
|
|
18
|
+
import { BubblesetCfg } from './types';
|
|
19
|
+
|
|
20
|
+
type LabelPlacement = 'top' | 'bottom' | 'right' | 'left';
|
|
21
|
+
|
|
22
|
+
export interface HullComponentOptions {
|
|
23
|
+
id: string;
|
|
24
|
+
members?: ID[];
|
|
25
|
+
nonMembers?: ID[];
|
|
26
|
+
style?: ShapeStyle;
|
|
27
|
+
padding?: number;
|
|
28
|
+
type?: 'bubble' | 'round-convex' | 'smooth-convex';
|
|
29
|
+
labelShape?: ShapeStyle & {
|
|
30
|
+
position?: LabelPlacement;
|
|
31
|
+
offsetX?: number;
|
|
32
|
+
offsetY?: number;
|
|
33
|
+
// string means the percentage of the keyShape, number means pixel
|
|
34
|
+
maxWidth?: string | number;
|
|
35
|
+
/** Whether rotate automatically according to the slope of the hull edge. */
|
|
36
|
+
autoRotate?: boolean;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface HullComponentFullOptions extends HullComponentOptions {
|
|
41
|
+
/** Controlling the effect of the bubble more finely (the scaling degree of the point and edge design, setting the granularity), generally no configuration is required */
|
|
42
|
+
bubbleCfg?: BubblesetCfg;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The outline of the member used to wrap the interior.
|
|
47
|
+
* convex hull(convex hull): http://geomalgorithms.com/a10-_hull-1.html#Monotone%20Chain
|
|
48
|
+
* bubble: bubbleset algorithm, refer: http://vialab.science.uoit.ca/wp-content/papercite-data/pdf/col2009c.pdf
|
|
49
|
+
* 通By configuring padding, you can adjust the tightness of the wrapping contour to the node.
|
|
50
|
+
*/
|
|
51
|
+
export default class Hull {
|
|
52
|
+
graph: IGraph;
|
|
53
|
+
|
|
54
|
+
path: any[][];
|
|
55
|
+
|
|
56
|
+
members: (NodeModel | ComboModel)[];
|
|
57
|
+
|
|
58
|
+
nonMembers: (NodeModel | ComboModel)[];
|
|
59
|
+
|
|
60
|
+
padding: number;
|
|
61
|
+
|
|
62
|
+
bubbleCfg: Partial<BubblesetCfg>;
|
|
63
|
+
|
|
64
|
+
type: 'bubble' | 'round-convex' | 'smooth-convex';
|
|
65
|
+
|
|
66
|
+
hullShape: DisplayObject;
|
|
67
|
+
|
|
68
|
+
options: HullComponentFullOptions;
|
|
69
|
+
|
|
70
|
+
constructor(graph: IGraph, options: HullComponentFullOptions) {
|
|
71
|
+
const { members: memberIds = [], nonMembers: nonMemberIds = [] } = options;
|
|
72
|
+
this.options = options;
|
|
73
|
+
this.graph = graph;
|
|
74
|
+
this.members = memberIds.map(
|
|
75
|
+
(id) => graph.getNodeData(id) || graph.getComboData(id),
|
|
76
|
+
);
|
|
77
|
+
this.nonMembers = nonMemberIds.map(
|
|
78
|
+
(id) => graph.getNodeData(id) || graph.getComboData(id),
|
|
79
|
+
);
|
|
80
|
+
this.setPadding();
|
|
81
|
+
this.setType();
|
|
82
|
+
|
|
83
|
+
this.path = this.getPath(this.members, this.nonMembers);
|
|
84
|
+
this.render();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
public getDefaultCfg(): HullComponentFullOptions {
|
|
88
|
+
return {
|
|
89
|
+
id: 'g6-hull',
|
|
90
|
+
type: 'round-convex', // 'round-convex' /'smooth-convex' / 'bubble'
|
|
91
|
+
members: [],
|
|
92
|
+
nonMembers: [],
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
setPadding() {
|
|
97
|
+
let nodeSize = 30;
|
|
98
|
+
if (this.members.length) {
|
|
99
|
+
const firstBBox = this.graph.getRenderBBox(this.members[0].id);
|
|
100
|
+
if (firstBBox) nodeSize = firstBBox.halfExtents[0];
|
|
101
|
+
}
|
|
102
|
+
this.padding =
|
|
103
|
+
this.options.padding > 0
|
|
104
|
+
? this.options.padding + nodeSize
|
|
105
|
+
: 10 + nodeSize;
|
|
106
|
+
this.bubbleCfg = {
|
|
107
|
+
...this.options.bubbleCfg,
|
|
108
|
+
nodeR0: this.padding - nodeSize,
|
|
109
|
+
nodeR1: this.padding - nodeSize,
|
|
110
|
+
morphBuffer: this.padding - nodeSize,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
setType() {
|
|
115
|
+
this.type = this.options.type;
|
|
116
|
+
if (this.members.length < 3) {
|
|
117
|
+
this.type = 'round-convex';
|
|
118
|
+
}
|
|
119
|
+
if (
|
|
120
|
+
this.type !== 'round-convex' &&
|
|
121
|
+
this.type !== 'smooth-convex' &&
|
|
122
|
+
this.type !== 'bubble'
|
|
123
|
+
) {
|
|
124
|
+
console.warn(
|
|
125
|
+
'The hull type should be either round-convex, smooth-convex or bubble, round-convex is used by default.',
|
|
126
|
+
);
|
|
127
|
+
this.type = 'round-convex';
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
getPath(
|
|
132
|
+
members: (NodeModel | ComboModel)[],
|
|
133
|
+
nonMembers: (NodeModel | ComboModel)[],
|
|
134
|
+
) {
|
|
135
|
+
let contour, path, hull;
|
|
136
|
+
switch (this.type) {
|
|
137
|
+
case 'round-convex':
|
|
138
|
+
contour = genConvexHull(members);
|
|
139
|
+
hull = roundedHull(
|
|
140
|
+
contour.map((p) => [p.x, p.y]),
|
|
141
|
+
this.padding,
|
|
142
|
+
);
|
|
143
|
+
path = parsePathString(hull);
|
|
144
|
+
break;
|
|
145
|
+
case 'smooth-convex':
|
|
146
|
+
contour = genConvexHull(members);
|
|
147
|
+
if (contour.length === 2) {
|
|
148
|
+
hull = roundedHull(
|
|
149
|
+
contour.map((p) => [p.x, p.y]),
|
|
150
|
+
this.padding,
|
|
151
|
+
);
|
|
152
|
+
path = parsePathString(hull);
|
|
153
|
+
} else if (contour.length > 2) {
|
|
154
|
+
hull = paddedHull(
|
|
155
|
+
contour.map((p) => [p.x, p.y]),
|
|
156
|
+
this.padding,
|
|
157
|
+
);
|
|
158
|
+
path = getClosedSpline(hull);
|
|
159
|
+
}
|
|
160
|
+
break;
|
|
161
|
+
case 'bubble':
|
|
162
|
+
contour = genBubbleSet(this.graph, members, nonMembers, this.bubbleCfg);
|
|
163
|
+
path = contour.length >= 2 && getClosedSpline(contour);
|
|
164
|
+
break;
|
|
165
|
+
default:
|
|
166
|
+
}
|
|
167
|
+
return path;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
render() {
|
|
171
|
+
if (!this.path) return;
|
|
172
|
+
const shape = this.graph.drawTransient('path', this.options.id, {
|
|
173
|
+
style: {
|
|
174
|
+
path: this.path,
|
|
175
|
+
...this.options.style,
|
|
176
|
+
},
|
|
177
|
+
capture: false,
|
|
178
|
+
});
|
|
179
|
+
const { labelShape } = this.options;
|
|
180
|
+
if (labelShape?.text) {
|
|
181
|
+
const shapeBounds = shape.getRenderBounds();
|
|
182
|
+
const { position, offsetX, offsetY, ...labelShapeStyle } = labelShape;
|
|
183
|
+
const formattedLabelStyle = this.getLabelStyle(labelShape, shapeBounds);
|
|
184
|
+
this.graph.drawTransient('text', `${this.options.id}-label`, {
|
|
185
|
+
style: {
|
|
186
|
+
...labelShapeStyle,
|
|
187
|
+
...formattedLabelStyle,
|
|
188
|
+
},
|
|
189
|
+
capture: false,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
shape.toBack();
|
|
193
|
+
this.hullShape = shape;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
private getLabelStyle(propsStyle, keyShapeBounds) {
|
|
197
|
+
const {
|
|
198
|
+
position,
|
|
199
|
+
offsetX = 0,
|
|
200
|
+
offsetY = 0,
|
|
201
|
+
autoRotate = true,
|
|
202
|
+
} = propsStyle;
|
|
203
|
+
const { min, max, center } = keyShapeBounds;
|
|
204
|
+
const style: ShapeStyle = {
|
|
205
|
+
x: 0,
|
|
206
|
+
y: 0,
|
|
207
|
+
textAlign: 'center',
|
|
208
|
+
textBaseline: 'middle',
|
|
209
|
+
};
|
|
210
|
+
const point = { x: 0, y: 0 };
|
|
211
|
+
switch (position) {
|
|
212
|
+
case 'bottom':
|
|
213
|
+
case 'outside-bottom':
|
|
214
|
+
point.x = (min[0] + max[0]) / 2;
|
|
215
|
+
point.y = max[1];
|
|
216
|
+
style.textBaseline = 'bottom';
|
|
217
|
+
break;
|
|
218
|
+
case 'left':
|
|
219
|
+
case 'outside-left':
|
|
220
|
+
point.x = min[0];
|
|
221
|
+
point.y = (min[1] + max[1]) / 2;
|
|
222
|
+
style.textAlign = 'left';
|
|
223
|
+
break;
|
|
224
|
+
case 'right':
|
|
225
|
+
case 'outside-right':
|
|
226
|
+
point.x = max[0];
|
|
227
|
+
point.y = (min[1] + max[1]) / 2;
|
|
228
|
+
style.textAlign = 'right';
|
|
229
|
+
break;
|
|
230
|
+
case 'top':
|
|
231
|
+
case 'outside-top':
|
|
232
|
+
default:
|
|
233
|
+
point.x = (min[0] + max[0]) / 2;
|
|
234
|
+
point.y = min[1];
|
|
235
|
+
style.textBaseline = 'top';
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
let startPoint;
|
|
240
|
+
const points = pathToPoints(this.path);
|
|
241
|
+
if (this.type === 'bubble') {
|
|
242
|
+
switch (position) {
|
|
243
|
+
case 'bottom':
|
|
244
|
+
startPoint = { x: center[0], y: max[0] + 10 };
|
|
245
|
+
break;
|
|
246
|
+
case 'left':
|
|
247
|
+
startPoint = { x: max[0] + 10, y: center[1] };
|
|
248
|
+
break;
|
|
249
|
+
case 'right':
|
|
250
|
+
startPoint = { x: min[0] - 10, y: center[1] };
|
|
251
|
+
break;
|
|
252
|
+
case 'top':
|
|
253
|
+
default:
|
|
254
|
+
startPoint = { x: center[0], y: max[1] - 10 };
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
} else {
|
|
258
|
+
startPoint = { x: center[0], y: center[1] };
|
|
259
|
+
}
|
|
260
|
+
const extendedPoint = getExtendPoint(point, startPoint, 100);
|
|
261
|
+
const intersect = getPolygonIntersectByLine(points, [
|
|
262
|
+
startPoint,
|
|
263
|
+
extendedPoint,
|
|
264
|
+
]);
|
|
265
|
+
if (intersect) {
|
|
266
|
+
const { point: intersectPoint, line } = intersect;
|
|
267
|
+
style.x = intersectPoint.x + offsetX;
|
|
268
|
+
style.y = intersectPoint.y + offsetY;
|
|
269
|
+
if (autoRotate) {
|
|
270
|
+
const angle = Math.atan(
|
|
271
|
+
(line[0].y - line[1].y) / (line[0].x - line[1].x),
|
|
272
|
+
);
|
|
273
|
+
style.transform = `rotate(${(angle / Math.PI) * 180}deg)`;
|
|
274
|
+
style.textAlign = 'center';
|
|
275
|
+
if (position === 'right' || position === 'left') {
|
|
276
|
+
if (angle > 0) {
|
|
277
|
+
style.textBaseline = position === 'right' ? 'top' : 'bottom';
|
|
278
|
+
} else {
|
|
279
|
+
style.textBaseline = position === 'right' ? 'bottom' : 'top';
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
} else {
|
|
284
|
+
style.x = point.x + offsetX;
|
|
285
|
+
style.y = point.y + offsetY;
|
|
286
|
+
}
|
|
287
|
+
if (position.split('-')[0] === 'outside') {
|
|
288
|
+
// @ts-ignore
|
|
289
|
+
style.textBaseline = getInvertBaseline(style.textBaseline);
|
|
290
|
+
}
|
|
291
|
+
return style;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Add a member of hull, and if the member was originally in nonMembers, remove it from nonMembers.
|
|
296
|
+
* @param itemIds id(s) of member nodes/combos
|
|
297
|
+
* @return boolean Whether successfully added.
|
|
298
|
+
*/
|
|
299
|
+
public addMember(itemIds: ID | ID[]): boolean {
|
|
300
|
+
if (!itemIds) return;
|
|
301
|
+
const idArr = isArray(itemIds) ? itemIds : [itemIds];
|
|
302
|
+
let shouldUpdate = false;
|
|
303
|
+
idArr.forEach((id) => {
|
|
304
|
+
const model = this.graph.getNodeData(id) || this.graph.getComboData(id);
|
|
305
|
+
const memberIdx = this.members.indexOf(model);
|
|
306
|
+
if (memberIdx === -1) {
|
|
307
|
+
this.members.push(model);
|
|
308
|
+
shouldUpdate = true;
|
|
309
|
+
}
|
|
310
|
+
const nonMemberIdx = this.nonMembers.indexOf(model);
|
|
311
|
+
if (nonMemberIdx > -1) {
|
|
312
|
+
this.nonMembers.splice(nonMemberIdx, 1);
|
|
313
|
+
shouldUpdate = true;
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
if (shouldUpdate) {
|
|
317
|
+
this.updateMembers(
|
|
318
|
+
this.members.map((model) => model.id),
|
|
319
|
+
this.nonMembers.map((model) => model.id),
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
return false;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Add the nodes that the hull needs to exclude, and if the member was originally in the members, remove it from the members.
|
|
327
|
+
* @param itemIds id(s) of member nodes/combos
|
|
328
|
+
* @return boolean Whether successfully added.
|
|
329
|
+
*/
|
|
330
|
+
public addNonMember(itemIds: ID | ID[]): boolean {
|
|
331
|
+
if (!itemIds) return;
|
|
332
|
+
const idArr = isArray(itemIds) ? itemIds : [itemIds];
|
|
333
|
+
let shouldUpdate = false;
|
|
334
|
+
idArr.forEach((id) => {
|
|
335
|
+
const model = this.graph.getNodeData(id) || this.graph.getComboData(id);
|
|
336
|
+
const nonMemberIdx = this.nonMembers.indexOf(model);
|
|
337
|
+
if (nonMemberIdx === -1) {
|
|
338
|
+
this.nonMembers.push(model);
|
|
339
|
+
shouldUpdate = true;
|
|
340
|
+
}
|
|
341
|
+
const memberIdx = this.members.indexOf(model);
|
|
342
|
+
if (memberIdx > -1) {
|
|
343
|
+
this.members.splice(memberIdx, 1);
|
|
344
|
+
shouldUpdate = true;
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
if (shouldUpdate) {
|
|
348
|
+
this.updateMembers(
|
|
349
|
+
this.members.map((model) => model.id),
|
|
350
|
+
this.nonMembers.map((model) => model.id),
|
|
351
|
+
);
|
|
352
|
+
return true;
|
|
353
|
+
}
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Remove members from the hull.
|
|
359
|
+
* @param itemIds id(s) of member nodes/combos
|
|
360
|
+
* @return boolean Returns true if the removal is successful, otherwise returns false.
|
|
361
|
+
*/
|
|
362
|
+
public removeMember(itemIds: ID | ID[]): boolean {
|
|
363
|
+
if (!itemIds) return;
|
|
364
|
+
const idArr = isArray(itemIds) ? itemIds : [itemIds];
|
|
365
|
+
let removed = false;
|
|
366
|
+
idArr.forEach((id) => {
|
|
367
|
+
const index = this.members.findIndex((member) => member.id === id);
|
|
368
|
+
if (index > -1) {
|
|
369
|
+
this.members.splice(index, 1);
|
|
370
|
+
removed = true;
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
if (removed) {
|
|
374
|
+
this.updateMembers(
|
|
375
|
+
this.members.map((model) => model.id),
|
|
376
|
+
this.nonMembers.map((model) => model.id),
|
|
377
|
+
);
|
|
378
|
+
return true;
|
|
379
|
+
}
|
|
380
|
+
return false;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Remove non members from the hull.
|
|
385
|
+
* @param itemIds id(s) of member nodes/combos
|
|
386
|
+
* @return boolean Returns true if the removal is successful, otherwise returns false.
|
|
387
|
+
*/
|
|
388
|
+
public removeNonMember(itemIds: ID | ID[]): boolean {
|
|
389
|
+
if (!itemIds) return;
|
|
390
|
+
const idArr = isArray(itemIds) ? itemIds : [itemIds];
|
|
391
|
+
let removed = false;
|
|
392
|
+
idArr.forEach((id) => {
|
|
393
|
+
const model = this.graph.getNodeData(id) || this.graph.getComboData(id);
|
|
394
|
+
const index = this.nonMembers.indexOf(model);
|
|
395
|
+
if (index > -1) {
|
|
396
|
+
this.nonMembers.splice(index, 1);
|
|
397
|
+
removed = true;
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
if (removed) {
|
|
401
|
+
this.updateMembers(
|
|
402
|
+
this.members.map((model) => model.id),
|
|
403
|
+
this.nonMembers.map((model) => model.id),
|
|
404
|
+
);
|
|
405
|
+
return true;
|
|
406
|
+
}
|
|
407
|
+
return false;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
public updateMembers(memberIds?: ID[], nonMemberIds?: ID[]) {
|
|
411
|
+
if (memberIds) {
|
|
412
|
+
this.options.members = memberIds;
|
|
413
|
+
this.members = memberIds.map(
|
|
414
|
+
(id) => this.graph.getNodeData(id) || this.graph.getComboData(id),
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
if (nonMemberIds) {
|
|
418
|
+
this.options.nonMembers = nonMemberIds;
|
|
419
|
+
this.nonMembers = nonMemberIds.map(
|
|
420
|
+
(id) => this.graph.getNodeData(id) || this.graph.getComboData(id),
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
this.path = this.getPath(this.members, this.nonMembers);
|
|
424
|
+
this.render();
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
public updateStyle(style: ShapeStyle) {
|
|
428
|
+
this.graph.drawTransient('path', this.options.id, {
|
|
429
|
+
style,
|
|
430
|
+
capture: false,
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Update the options
|
|
436
|
+
* @param options hull options
|
|
437
|
+
*/
|
|
438
|
+
public updateOptions(options: Partial<HullComponentOptions>) {
|
|
439
|
+
const { members: memberIds, nonMembers: nonMemberIds } = options;
|
|
440
|
+
this.options = {
|
|
441
|
+
...this.options,
|
|
442
|
+
...options,
|
|
443
|
+
style: {
|
|
444
|
+
...this.options.style,
|
|
445
|
+
...options.style,
|
|
446
|
+
},
|
|
447
|
+
labelShape: {
|
|
448
|
+
...this.options.labelShape,
|
|
449
|
+
...options.labelShape,
|
|
450
|
+
},
|
|
451
|
+
};
|
|
452
|
+
if (memberIds) {
|
|
453
|
+
this.members = memberIds.map(
|
|
454
|
+
(id) => this.graph.getNodeData(id) || this.graph.getComboData(id),
|
|
455
|
+
);
|
|
456
|
+
}
|
|
457
|
+
if (nonMemberIds) {
|
|
458
|
+
this.nonMembers = nonMemberIds.map(
|
|
459
|
+
(id) => this.graph.getNodeData(id) || this.graph.getComboData(id),
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
this.setPadding();
|
|
463
|
+
this.setType();
|
|
464
|
+
this.path = this.getPath(this.members, this.nonMembers);
|
|
465
|
+
this.render();
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Whether a node/edge is inside the range of the hull.
|
|
470
|
+
* @param itemId
|
|
471
|
+
*/
|
|
472
|
+
public contain(itemId): boolean {
|
|
473
|
+
let shapePoints;
|
|
474
|
+
// TODO
|
|
475
|
+
// const shape = nodeItem.getKeyShape();
|
|
476
|
+
// if (nodeItem.get('type') === 'path') {
|
|
477
|
+
// shapePoints = pathToPoints(shape.attr('path'));
|
|
478
|
+
// } else {
|
|
479
|
+
const shapeBBox = this.graph.getRenderBBox(itemId);
|
|
480
|
+
if (!shapeBBox) {
|
|
481
|
+
console.warn(`The item with ${itemId} is not existed in the graph.`);
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
shapePoints = [
|
|
485
|
+
[shapeBBox.min[0], shapeBBox.min[1]],
|
|
486
|
+
[shapeBBox.max[0], shapeBBox.min[1]],
|
|
487
|
+
[shapeBBox.max[0], shapeBBox.max[1]],
|
|
488
|
+
[shapeBBox.min[0], shapeBBox.max[1]],
|
|
489
|
+
];
|
|
490
|
+
// }
|
|
491
|
+
shapePoints = shapePoints.map((canvasPoint) => {
|
|
492
|
+
const point = this.graph.getPointByCanvas(canvasPoint[0], canvasPoint[1]);
|
|
493
|
+
return [point.x, point.y];
|
|
494
|
+
});
|
|
495
|
+
return isPolygonsIntersect(shapePoints, pathToPoints(this.path));
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
public destroy() {
|
|
499
|
+
this.graph.drawTransient('path', this.options.id, { action: 'remove' });
|
|
500
|
+
}
|
|
501
|
+
}
|