@antv/g6 5.0.0-beta.33 → 5.0.0-beta.35
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/dist/lib/animations/types.d.ts +3 -4
- package/dist/lib/behaviors/base-behavior.d.ts +2 -1
- package/dist/lib/behaviors/brush-select.d.ts +33 -16
- package/dist/lib/behaviors/click-element.d.ts +28 -5
- package/dist/lib/behaviors/collapse-expand.d.ts +3 -2
- package/dist/lib/behaviors/create-edge.d.ts +1 -2
- package/dist/lib/behaviors/drag-canvas.d.ts +7 -0
- package/dist/lib/behaviors/drag-element-force.d.ts +1 -2
- package/dist/lib/behaviors/drag-element.d.ts +4 -5
- package/dist/lib/behaviors/index.d.ts +2 -0
- package/dist/lib/behaviors/lasso-select.d.ts +4 -4
- package/dist/lib/behaviors/scroll-canvas.d.ts +64 -0
- package/dist/lib/behaviors/types.d.ts +2 -1
- package/dist/lib/behaviors/zoom-canvas.d.ts +1 -1
- package/dist/lib/constants/events/animation.d.ts +1 -4
- package/dist/lib/constants/events/graph.d.ts +5 -1
- package/dist/lib/elements/combos/base-combo.d.ts +1 -1
- package/dist/lib/elements/edges/base-edge.d.ts +0 -5
- package/dist/lib/elements/nodes/base-node.d.ts +3 -10
- package/dist/lib/elements/nodes/donut.d.ts +45 -0
- package/dist/lib/elements/nodes/html.d.ts +27 -0
- package/dist/lib/elements/nodes/index.d.ts +4 -0
- package/dist/lib/elements/shapes/badge.d.ts +1 -1
- package/dist/lib/{plugins/hull/shape.d.ts → elements/shapes/contour.d.ts} +17 -17
- package/dist/lib/elements/shapes/index.d.ts +2 -0
- package/dist/lib/exports.d.ts +15 -22
- package/dist/lib/plugins/bubble-sets.d.ts +45 -0
- package/dist/lib/plugins/camera-setting.d.ts +4 -2
- package/dist/lib/plugins/contextmenu.d.ts +1 -0
- package/dist/lib/plugins/grid-line.d.ts +51 -8
- package/dist/lib/plugins/hull/index.d.ts +44 -13
- package/dist/lib/plugins/index.d.ts +4 -0
- package/dist/lib/plugins/timebar.d.ts +225 -0
- package/dist/lib/plugins/tooltip.d.ts +2 -2
- package/dist/lib/registry/index.d.ts +1 -1
- package/dist/lib/runtime/data.d.ts +13 -7
- package/dist/lib/runtime/element.d.ts +6 -10
- package/dist/lib/runtime/graph.d.ts +532 -45
- package/dist/lib/runtime/types.d.ts +3 -3
- package/dist/lib/runtime/viewport.d.ts +3 -4
- package/dist/lib/spec/canvas.d.ts +6 -2
- package/dist/lib/spec/data.d.ts +74 -1
- package/dist/lib/spec/element/combo.d.ts +17 -6
- package/dist/lib/spec/element/edge.d.ts +14 -2
- package/dist/lib/spec/element/node.d.ts +19 -3
- package/{lib/spec/spec.d.ts → dist/lib/spec/graph.d.ts} +12 -4
- package/dist/lib/spec/index.d.ts +1 -1
- package/dist/lib/spec/theme.d.ts +1 -4
- package/dist/lib/spec/viewport.d.ts +1 -1
- package/dist/lib/themes/base.d.ts +1 -0
- package/dist/lib/themes/types.d.ts +0 -1
- package/dist/lib/transforms/process-parallel-edges.d.ts +2 -3
- package/dist/lib/transforms/types.d.ts +1 -1
- package/dist/lib/types/callable.d.ts +2 -2
- package/dist/lib/types/data.d.ts +3 -3
- package/dist/lib/types/id.d.ts +1 -0
- package/dist/lib/types/index.d.ts +1 -0
- package/dist/lib/types/style.d.ts +1 -3
- package/dist/lib/types/viewport.d.ts +4 -4
- package/dist/lib/utils/animation.d.ts +6 -6
- package/dist/lib/utils/behaviors/brush.d.ts +1 -2
- package/dist/lib/utils/behaviors/lasso.d.ts +1 -2
- package/dist/lib/utils/behaviors/utils.d.ts +1 -1
- package/dist/lib/utils/data.d.ts +2 -2
- package/dist/lib/utils/edge.d.ts +1 -2
- package/dist/lib/utils/element.d.ts +1 -1
- package/dist/lib/utils/event/events.d.ts +1 -1
- package/dist/lib/utils/event/index.d.ts +1 -1
- package/dist/lib/utils/id.d.ts +2 -3
- package/dist/lib/utils/palette.d.ts +2 -3
- package/dist/lib/utils/relation.d.ts +3 -4
- package/dist/lib/utils/visibility.d.ts +1 -1
- package/esm/animations/types.d.ts +3 -4
- package/esm/behaviors/base-behavior.d.ts +2 -1
- package/esm/behaviors/brush-select.d.ts +33 -16
- package/esm/behaviors/brush-select.js +7 -2
- package/esm/behaviors/brush-select.js.map +1 -1
- package/esm/behaviors/click-element.d.ts +28 -5
- package/esm/behaviors/click-element.js +11 -0
- package/esm/behaviors/click-element.js.map +1 -1
- package/esm/behaviors/collapse-expand.d.ts +3 -2
- package/esm/behaviors/collapse-expand.js +2 -2
- package/esm/behaviors/collapse-expand.js.map +1 -1
- package/esm/behaviors/create-edge.d.ts +1 -2
- package/esm/behaviors/create-edge.js.map +1 -1
- package/esm/behaviors/drag-canvas.d.ts +7 -0
- package/esm/behaviors/drag-canvas.js.map +1 -1
- package/esm/behaviors/drag-element-force.d.ts +1 -2
- package/esm/behaviors/drag-element-force.js.map +1 -1
- package/esm/behaviors/drag-element.d.ts +4 -5
- package/esm/behaviors/drag-element.js.map +1 -1
- package/esm/behaviors/focus-element.js.map +1 -1
- package/esm/behaviors/hover-element.js.map +1 -1
- package/esm/behaviors/index.d.ts +2 -0
- package/esm/behaviors/index.js +1 -0
- package/esm/behaviors/index.js.map +1 -1
- package/esm/behaviors/lasso-select.d.ts +4 -4
- package/esm/behaviors/lasso-select.js +1 -1
- package/esm/behaviors/lasso-select.js.map +1 -1
- package/esm/behaviors/scroll-canvas.d.ts +64 -0
- package/esm/behaviors/scroll-canvas.js +80 -0
- package/esm/behaviors/scroll-canvas.js.map +1 -0
- package/esm/behaviors/types.d.ts +2 -1
- package/esm/behaviors/zoom-canvas.d.ts +1 -1
- package/esm/constants/events/animation.d.ts +1 -4
- package/esm/constants/events/animation.js +0 -4
- package/esm/constants/events/animation.js.map +1 -1
- package/esm/constants/events/graph.d.ts +5 -1
- package/esm/constants/events/graph.js +4 -0
- package/esm/constants/events/graph.js.map +1 -1
- package/esm/elements/combos/base-combo.d.ts +1 -1
- package/esm/elements/edges/base-edge.d.ts +0 -5
- package/esm/elements/edges/base-edge.js +1 -2
- package/esm/elements/edges/base-edge.js.map +1 -1
- package/esm/elements/nodes/base-node.d.ts +3 -10
- package/esm/elements/nodes/base-node.js +2 -2
- package/esm/elements/nodes/base-node.js.map +1 -1
- package/esm/elements/nodes/donut.d.ts +45 -0
- package/esm/elements/nodes/donut.js +81 -0
- package/esm/elements/nodes/donut.js.map +1 -0
- package/esm/elements/nodes/html.d.ts +27 -0
- package/esm/elements/nodes/html.js +209 -0
- package/esm/elements/nodes/html.js.map +1 -0
- package/esm/elements/nodes/index.d.ts +4 -0
- package/esm/elements/nodes/index.js +2 -0
- package/esm/elements/nodes/index.js.map +1 -1
- package/esm/elements/shapes/badge.d.ts +1 -1
- package/esm/{plugins/hull/shape.d.ts → elements/shapes/contour.d.ts} +17 -17
- package/esm/{plugins/hull/shape.js → elements/shapes/contour.js} +12 -11
- package/esm/elements/shapes/contour.js.map +1 -0
- package/esm/elements/shapes/index.d.ts +2 -0
- package/esm/elements/shapes/index.js +1 -0
- package/esm/elements/shapes/index.js.map +1 -1
- package/esm/exports.d.ts +15 -22
- package/esm/exports.js +8 -18
- package/esm/exports.js.map +1 -1
- package/esm/plugins/bubble-sets.d.ts +45 -0
- package/esm/plugins/bubble-sets.js +212 -0
- package/esm/plugins/bubble-sets.js.map +1 -0
- package/esm/plugins/camera-setting.d.ts +4 -2
- package/esm/plugins/camera-setting.js.map +1 -1
- package/esm/plugins/contextmenu.d.ts +1 -0
- package/esm/plugins/contextmenu.js +1 -0
- package/esm/plugins/contextmenu.js.map +1 -1
- package/esm/plugins/grid-line.d.ts +51 -8
- package/esm/plugins/grid-line.js.map +1 -1
- package/esm/plugins/history/utils.js +6 -2
- package/esm/plugins/history/utils.js.map +1 -1
- package/esm/plugins/hull/index.d.ts +44 -13
- package/esm/plugins/hull/index.js +46 -16
- package/esm/plugins/hull/index.js.map +1 -1
- package/esm/plugins/index.d.ts +4 -0
- package/esm/plugins/index.js +2 -0
- package/esm/plugins/index.js.map +1 -1
- package/esm/plugins/legend.js +4 -2
- package/esm/plugins/legend.js.map +1 -1
- package/esm/plugins/timebar.d.ts +225 -0
- package/esm/plugins/timebar.js +253 -0
- package/esm/plugins/timebar.js.map +1 -0
- package/esm/plugins/tooltip.d.ts +2 -2
- package/esm/registry/build-in.js +15 -10
- package/esm/registry/build-in.js.map +1 -1
- package/esm/registry/index.d.ts +1 -1
- package/esm/registry/index.js +1 -1
- package/esm/runtime/canvas.js +7 -4
- package/esm/runtime/canvas.js.map +1 -1
- package/esm/runtime/data.d.ts +13 -7
- package/esm/runtime/data.js +20 -3
- package/esm/runtime/data.js.map +1 -1
- package/esm/runtime/element.d.ts +6 -10
- package/esm/runtime/element.js +65 -46
- package/esm/runtime/element.js.map +1 -1
- package/esm/runtime/graph.d.ts +532 -45
- package/esm/runtime/graph.js +418 -40
- package/esm/runtime/graph.js.map +1 -1
- package/esm/runtime/layout.js +2 -2
- package/esm/runtime/layout.js.map +1 -1
- package/esm/runtime/types.d.ts +3 -3
- package/esm/runtime/viewport.d.ts +3 -4
- package/esm/runtime/viewport.js +2 -2
- package/esm/runtime/viewport.js.map +1 -1
- package/esm/spec/canvas.d.ts +6 -2
- package/esm/spec/data.d.ts +74 -1
- package/esm/spec/element/combo.d.ts +17 -6
- package/esm/spec/element/edge.d.ts +14 -2
- package/esm/spec/element/node.d.ts +19 -3
- package/esm/spec/{spec.d.ts → graph.d.ts} +12 -4
- package/esm/spec/graph.js +2 -0
- package/esm/spec/graph.js.map +1 -0
- package/esm/spec/index.d.ts +1 -1
- package/esm/spec/theme.d.ts +1 -4
- package/esm/spec/viewport.d.ts +1 -1
- package/esm/themes/base.d.ts +1 -0
- package/esm/themes/base.js +11 -9
- package/esm/themes/base.js.map +1 -1
- package/esm/themes/types.d.ts +0 -1
- package/esm/transforms/process-parallel-edges.d.ts +2 -3
- package/esm/transforms/process-parallel-edges.js +2 -4
- package/esm/transforms/process-parallel-edges.js.map +1 -1
- package/esm/transforms/types.d.ts +1 -1
- package/esm/transforms/update-related-edge.js.map +1 -1
- package/esm/types/callable.d.ts +2 -2
- package/esm/types/data.d.ts +3 -3
- package/esm/types/id.d.ts +1 -0
- package/esm/types/id.js +2 -0
- package/esm/types/id.js.map +1 -0
- package/esm/types/index.d.ts +1 -0
- package/esm/types/style.d.ts +1 -3
- package/esm/types/viewport.d.ts +4 -4
- package/esm/utils/animation.d.ts +6 -6
- package/esm/utils/animation.js +3 -3
- package/esm/utils/animation.js.map +1 -1
- package/esm/utils/behaviors/brush.d.ts +1 -2
- package/esm/utils/behaviors/brush.js.map +1 -1
- package/esm/utils/behaviors/lasso.d.ts +1 -2
- package/esm/utils/behaviors/lasso.js.map +1 -1
- package/esm/utils/behaviors/utils.d.ts +1 -1
- package/esm/utils/change.js +8 -1
- package/esm/utils/change.js.map +1 -1
- package/esm/utils/data.d.ts +2 -2
- package/esm/utils/data.js +2 -2
- package/esm/utils/edge.d.ts +1 -2
- package/esm/utils/edge.js.map +1 -1
- package/esm/utils/element.d.ts +1 -1
- package/esm/utils/element.js +2 -2
- package/esm/utils/event/events.d.ts +1 -1
- package/esm/utils/event/events.js.map +1 -1
- package/esm/utils/event/index.d.ts +1 -1
- package/esm/utils/event/index.js +1 -1
- package/esm/utils/id.d.ts +2 -3
- package/esm/utils/id.js.map +1 -1
- package/esm/utils/palette.d.ts +2 -3
- package/esm/utils/palette.js +1 -1
- package/esm/utils/palette.js.map +1 -1
- package/esm/utils/relation.d.ts +3 -4
- package/esm/utils/relation.js +2 -2
- package/esm/utils/relation.js.map +1 -1
- package/esm/utils/style.js +3 -3
- package/esm/utils/style.js.map +1 -1
- package/esm/utils/visibility.d.ts +1 -1
- package/esm/utils/visibility.js +1 -1
- package/lib/animations/types.d.ts +3 -4
- package/lib/behaviors/base-behavior.d.ts +2 -1
- package/lib/behaviors/brush-select.d.ts +33 -16
- package/lib/behaviors/brush-select.js +7 -2
- package/lib/behaviors/brush-select.js.map +1 -1
- package/lib/behaviors/click-element.d.ts +28 -5
- package/lib/behaviors/click-element.js +11 -0
- package/lib/behaviors/click-element.js.map +1 -1
- package/lib/behaviors/collapse-expand.d.ts +3 -2
- package/lib/behaviors/collapse-expand.js +2 -2
- package/lib/behaviors/collapse-expand.js.map +1 -1
- package/lib/behaviors/create-edge.d.ts +1 -2
- package/lib/behaviors/create-edge.js.map +1 -1
- package/lib/behaviors/drag-canvas.d.ts +7 -0
- package/lib/behaviors/drag-canvas.js.map +1 -1
- package/lib/behaviors/drag-element-force.d.ts +1 -2
- package/lib/behaviors/drag-element-force.js.map +1 -1
- package/lib/behaviors/drag-element.d.ts +4 -5
- package/lib/behaviors/drag-element.js.map +1 -1
- package/lib/behaviors/focus-element.js.map +1 -1
- package/lib/behaviors/hover-element.js.map +1 -1
- package/lib/behaviors/index.d.ts +2 -0
- package/lib/behaviors/index.js +3 -1
- package/lib/behaviors/index.js.map +1 -1
- package/lib/behaviors/lasso-select.d.ts +4 -4
- package/lib/behaviors/lasso-select.js +1 -1
- package/lib/behaviors/lasso-select.js.map +1 -1
- package/lib/behaviors/scroll-canvas.d.ts +64 -0
- package/lib/behaviors/scroll-canvas.js +84 -0
- package/lib/behaviors/scroll-canvas.js.map +1 -0
- package/lib/behaviors/types.d.ts +2 -1
- package/lib/behaviors/zoom-canvas.d.ts +1 -1
- package/lib/constants/events/animation.d.ts +1 -4
- package/lib/constants/events/animation.js +0 -4
- package/lib/constants/events/animation.js.map +1 -1
- package/lib/constants/events/graph.d.ts +5 -1
- package/lib/constants/events/graph.js +4 -0
- package/lib/constants/events/graph.js.map +1 -1
- package/lib/elements/combos/base-combo.d.ts +1 -1
- package/lib/elements/edges/base-edge.d.ts +0 -5
- package/lib/elements/edges/base-edge.js +1 -2
- package/lib/elements/edges/base-edge.js.map +1 -1
- package/lib/elements/nodes/base-node.d.ts +3 -10
- package/lib/elements/nodes/base-node.js +2 -2
- package/lib/elements/nodes/base-node.js.map +1 -1
- package/lib/elements/nodes/donut.d.ts +45 -0
- package/lib/elements/nodes/donut.js +85 -0
- package/lib/elements/nodes/donut.js.map +1 -0
- package/lib/elements/nodes/html.d.ts +27 -0
- package/lib/elements/nodes/html.js +213 -0
- package/lib/elements/nodes/html.js.map +1 -0
- package/lib/elements/nodes/index.d.ts +4 -0
- package/lib/elements/nodes/index.js +5 -1
- package/lib/elements/nodes/index.js.map +1 -1
- package/lib/elements/shapes/badge.d.ts +1 -1
- package/lib/{plugins/hull/shape.d.ts → elements/shapes/contour.d.ts} +17 -17
- package/lib/{plugins/hull/shape.js → elements/shapes/contour.js} +15 -14
- package/lib/elements/shapes/contour.js.map +1 -0
- package/lib/elements/shapes/index.d.ts +2 -0
- package/lib/elements/shapes/index.js +3 -1
- package/lib/elements/shapes/index.js.map +1 -1
- package/lib/exports.d.ts +15 -22
- package/lib/exports.js +50 -17
- package/lib/exports.js.map +1 -1
- package/lib/plugins/bubble-sets.d.ts +45 -0
- package/lib/plugins/bubble-sets.js +216 -0
- package/lib/plugins/bubble-sets.js.map +1 -0
- package/lib/plugins/camera-setting.d.ts +4 -2
- package/lib/plugins/camera-setting.js.map +1 -1
- package/lib/plugins/contextmenu.d.ts +1 -0
- package/lib/plugins/contextmenu.js +1 -0
- package/lib/plugins/contextmenu.js.map +1 -1
- package/lib/plugins/grid-line.d.ts +51 -8
- package/lib/plugins/grid-line.js.map +1 -1
- package/lib/plugins/history/utils.js +6 -2
- package/lib/plugins/history/utils.js.map +1 -1
- package/lib/plugins/hull/index.d.ts +44 -13
- package/lib/plugins/hull/index.js +46 -16
- package/lib/plugins/hull/index.js.map +1 -1
- package/lib/plugins/index.d.ts +4 -0
- package/lib/plugins/index.js +5 -1
- package/lib/plugins/index.js.map +1 -1
- package/lib/plugins/legend.js +4 -2
- package/lib/plugins/legend.js.map +1 -1
- package/lib/plugins/timebar.d.ts +225 -0
- package/lib/plugins/timebar.js +257 -0
- package/lib/plugins/timebar.js.map +1 -0
- package/lib/plugins/tooltip.d.ts +2 -2
- package/lib/registry/build-in.js +12 -7
- package/lib/registry/build-in.js.map +1 -1
- package/lib/registry/index.d.ts +1 -1
- package/lib/registry/index.js +1 -1
- package/lib/runtime/canvas.js +7 -4
- package/lib/runtime/canvas.js.map +1 -1
- package/lib/runtime/data.d.ts +13 -7
- package/lib/runtime/data.js +20 -3
- package/lib/runtime/data.js.map +1 -1
- package/lib/runtime/element.d.ts +6 -10
- package/lib/runtime/element.js +64 -45
- package/lib/runtime/element.js.map +1 -1
- package/lib/runtime/graph.d.ts +532 -45
- package/lib/runtime/graph.js +417 -39
- package/lib/runtime/graph.js.map +1 -1
- package/lib/runtime/layout.js +2 -2
- package/lib/runtime/layout.js.map +1 -1
- package/lib/runtime/types.d.ts +3 -3
- package/lib/runtime/viewport.d.ts +3 -4
- package/lib/runtime/viewport.js +2 -2
- package/lib/runtime/viewport.js.map +1 -1
- package/lib/spec/canvas.d.ts +6 -2
- package/lib/spec/data.d.ts +74 -1
- package/lib/spec/element/combo.d.ts +17 -6
- package/lib/spec/element/edge.d.ts +14 -2
- package/lib/spec/element/node.d.ts +19 -3
- package/{dist/lib/spec/spec.d.ts → lib/spec/graph.d.ts} +12 -4
- package/lib/spec/{spec.js → graph.js} +1 -1
- package/lib/spec/graph.js.map +1 -0
- package/lib/spec/index.d.ts +1 -1
- package/lib/spec/theme.d.ts +1 -4
- package/lib/spec/viewport.d.ts +1 -1
- package/lib/themes/base.d.ts +1 -0
- package/lib/themes/base.js +11 -9
- package/lib/themes/base.js.map +1 -1
- package/lib/themes/types.d.ts +0 -1
- package/lib/transforms/process-parallel-edges.d.ts +2 -3
- package/lib/transforms/process-parallel-edges.js +2 -4
- package/lib/transforms/process-parallel-edges.js.map +1 -1
- package/lib/transforms/types.d.ts +1 -1
- package/lib/transforms/update-related-edge.js.map +1 -1
- package/lib/types/callable.d.ts +2 -2
- package/lib/types/data.d.ts +3 -3
- package/lib/types/id.d.ts +1 -0
- package/lib/{spec/element/base.js → types/id.js} +1 -1
- package/lib/types/id.js.map +1 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/style.d.ts +1 -3
- package/lib/types/viewport.d.ts +4 -4
- package/lib/utils/animation.d.ts +6 -6
- package/lib/utils/animation.js +3 -3
- package/lib/utils/animation.js.map +1 -1
- package/lib/utils/behaviors/brush.d.ts +1 -2
- package/lib/utils/behaviors/brush.js.map +1 -1
- package/lib/utils/behaviors/lasso.d.ts +1 -2
- package/lib/utils/behaviors/lasso.js.map +1 -1
- package/lib/utils/behaviors/utils.d.ts +1 -1
- package/lib/utils/change.js +8 -1
- package/lib/utils/change.js.map +1 -1
- package/lib/utils/data.d.ts +2 -2
- package/lib/utils/data.js +2 -2
- package/lib/utils/edge.d.ts +1 -2
- package/lib/utils/edge.js.map +1 -1
- package/lib/utils/element.d.ts +1 -1
- package/lib/utils/element.js +2 -2
- package/lib/utils/event/events.d.ts +1 -1
- package/lib/utils/event/events.js.map +1 -1
- package/lib/utils/event/index.d.ts +1 -1
- package/lib/utils/event/index.js +1 -1
- package/lib/utils/id.d.ts +2 -3
- package/lib/utils/id.js.map +1 -1
- package/lib/utils/palette.d.ts +2 -3
- package/lib/utils/palette.js +1 -1
- package/lib/utils/palette.js.map +1 -1
- package/lib/utils/relation.d.ts +3 -4
- package/lib/utils/relation.js +2 -2
- package/lib/utils/relation.js.map +1 -1
- package/lib/utils/style.js +3 -3
- package/lib/utils/style.js.map +1 -1
- package/lib/utils/visibility.d.ts +1 -1
- package/lib/utils/visibility.js +1 -1
- package/package.json +2 -1
- package/src/animations/types.ts +3 -4
- package/src/behaviors/base-behavior.ts +1 -1
- package/src/behaviors/brush-select.ts +34 -16
- package/src/behaviors/click-element.ts +29 -7
- package/src/behaviors/collapse-expand.ts +5 -4
- package/src/behaviors/create-edge.ts +1 -2
- package/src/behaviors/drag-canvas.ts +7 -0
- package/src/behaviors/drag-element-force.ts +1 -2
- package/src/behaviors/drag-element.ts +3 -4
- package/src/behaviors/focus-element.ts +1 -2
- package/src/behaviors/hover-element.ts +1 -2
- package/src/behaviors/index.ts +2 -0
- package/src/behaviors/lasso-select.ts +3 -4
- package/src/behaviors/scroll-canvas.ts +143 -0
- package/src/behaviors/types.ts +2 -1
- package/src/behaviors/zoom-canvas.ts +1 -1
- package/src/constants/events/animation.ts +0 -4
- package/src/constants/events/graph.ts +4 -0
- package/src/elements/combos/base-combo.ts +1 -1
- package/src/elements/edges/base-edge.ts +1 -7
- package/src/elements/nodes/base-node.ts +6 -15
- package/src/elements/nodes/donut.ts +137 -0
- package/src/elements/nodes/html.ts +230 -0
- package/src/elements/nodes/index.ts +4 -0
- package/src/{plugins/hull/shape.ts → elements/shapes/contour.ts} +27 -34
- package/src/elements/shapes/index.ts +2 -0
- package/src/exports.ts +124 -25
- package/src/plugins/bubble-sets.ts +268 -0
- package/src/plugins/camera-setting.ts +4 -2
- package/src/plugins/contextmenu.ts +1 -0
- package/src/plugins/grid-line.ts +51 -8
- package/src/plugins/history/utils.ts +6 -2
- package/src/plugins/hull/index.ts +58 -22
- package/src/plugins/index.ts +4 -0
- package/src/plugins/legend.ts +6 -4
- package/src/plugins/timebar.ts +450 -0
- package/src/plugins/tooltip.ts +2 -2
- package/src/registry/build-in.ts +27 -8
- package/src/registry/index.ts +1 -1
- package/src/runtime/canvas.ts +7 -4
- package/src/runtime/data.ts +23 -4
- package/src/runtime/element.ts +67 -40
- package/src/runtime/graph.ts +554 -56
- package/src/runtime/layout.ts +4 -4
- package/src/runtime/types.ts +3 -3
- package/src/runtime/viewport.ts +3 -4
- package/src/spec/canvas.ts +6 -2
- package/src/spec/data.ts +74 -1
- package/src/spec/element/combo.ts +17 -6
- package/src/spec/element/edge.ts +14 -2
- package/src/spec/element/node.ts +19 -3
- package/src/spec/{spec.ts → graph.ts} +12 -4
- package/src/spec/index.ts +1 -1
- package/src/spec/theme.ts +1 -5
- package/src/spec/viewport.ts +1 -1
- package/src/themes/base.ts +12 -9
- package/src/themes/types.ts +0 -2
- package/src/transforms/arrange-draw-order.ts +1 -1
- package/src/transforms/process-parallel-edges.ts +5 -7
- package/src/transforms/types.ts +1 -1
- package/src/transforms/update-related-edge.ts +1 -2
- package/src/types/callable.ts +2 -2
- package/src/types/data.ts +3 -3
- package/src/types/id.ts +1 -0
- package/src/types/index.ts +1 -0
- package/src/types/style.ts +1 -3
- package/src/types/viewport.ts +4 -4
- package/src/utils/animation.ts +6 -6
- package/src/utils/behaviors/brush.ts +1 -2
- package/src/utils/behaviors/lasso.ts +1 -2
- package/src/utils/behaviors/utils.ts +1 -1
- package/src/utils/change.ts +7 -3
- package/src/utils/data.ts +2 -2
- package/src/utils/edge.ts +1 -1
- package/src/utils/element.ts +2 -2
- package/src/utils/event/events.ts +3 -1
- package/src/utils/event/index.ts +1 -1
- package/src/utils/id.ts +1 -2
- package/src/utils/palette.ts +2 -2
- package/src/utils/relation.ts +3 -4
- package/src/utils/style.ts +3 -3
- package/src/utils/visibility.ts +1 -1
- package/dist/lib/runtime/index.d.ts +0 -6
- package/dist/lib/spec/element/base.d.ts +0 -6
- package/esm/plugins/hull/shape.js.map +0 -1
- package/esm/runtime/index.d.ts +0 -6
- package/esm/runtime/index.js +0 -7
- package/esm/runtime/index.js.map +0 -1
- package/esm/spec/element/base.d.ts +0 -6
- package/esm/spec/element/base.js +0 -2
- package/esm/spec/element/base.js.map +0 -1
- package/esm/spec/spec.js +0 -2
- package/esm/spec/spec.js.map +0 -1
- package/lib/plugins/hull/shape.js.map +0 -1
- package/lib/runtime/index.d.ts +0 -6
- package/lib/runtime/index.js +0 -8
- package/lib/runtime/index.js.map +0 -1
- package/lib/spec/element/base.d.ts +0 -6
- package/lib/spec/element/base.js.map +0 -1
- package/lib/spec/spec.js.map +0 -1
- package/src/runtime/index.ts +0 -7
- package/src/spec/element/base.ts +0 -6
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { ID } from '@antv/graphlib';
|
|
2
1
|
import { isFunction } from '@antv/util';
|
|
3
2
|
import { CommonEvent } from '../constants';
|
|
4
3
|
import type { RuntimeContext } from '../runtime/types';
|
|
5
|
-
import type { IPointerEvent } from '../types';
|
|
4
|
+
import type { ID, IPointerEvent } from '../types';
|
|
6
5
|
import { isElement } from '../utils/element';
|
|
7
6
|
import type { BaseBehaviorOptions } from './base-behavior';
|
|
8
7
|
import { BaseBehavior } from './base-behavior';
|
|
@@ -12,12 +11,14 @@ export interface CollapseExpandOptions extends BaseBehaviorOptions {
|
|
|
12
11
|
* <zh/> 是否启用动画
|
|
13
12
|
*
|
|
14
13
|
* <en/> Whether to enable animation
|
|
14
|
+
* @defaultValue true
|
|
15
15
|
*/
|
|
16
16
|
animation: boolean;
|
|
17
17
|
/**
|
|
18
18
|
* <zh/> 是否启用展开/收起功能
|
|
19
19
|
*
|
|
20
20
|
* <en/> Whether to enable the expand/collapse function
|
|
21
|
+
* @defaultValue true
|
|
21
22
|
*/
|
|
22
23
|
enable?: boolean | ((event: IPointerEvent) => boolean);
|
|
23
24
|
/**
|
|
@@ -71,10 +72,10 @@ export class CollapseExpand extends BaseBehavior<CollapseExpandOptions> {
|
|
|
71
72
|
const { onCollapse, onExpand, animation } = this.options;
|
|
72
73
|
const isCollapse = data.style?.collapsed;
|
|
73
74
|
if (isCollapse) {
|
|
74
|
-
await graph.
|
|
75
|
+
await graph.expandElement(id, animation);
|
|
75
76
|
onExpand?.(id);
|
|
76
77
|
} else {
|
|
77
|
-
await graph.
|
|
78
|
+
await graph.collapseElement(id, animation);
|
|
78
79
|
onCollapse?.(id);
|
|
79
80
|
}
|
|
80
81
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type { ID } from '@antv/graphlib';
|
|
2
1
|
import { isFunction, uniqueId } from '@antv/util';
|
|
3
2
|
import { CommonEvent } from '../constants';
|
|
4
3
|
import type { RuntimeContext } from '../runtime/types';
|
|
5
4
|
import type { EdgeData } from '../spec';
|
|
6
5
|
import type { EdgeStyle } from '../spec/element/edge';
|
|
7
|
-
import type { Element, IPointerEvent } from '../types';
|
|
6
|
+
import type { Element, ID, IPointerEvent } from '../types';
|
|
8
7
|
import type { BaseBehaviorOptions } from './base-behavior';
|
|
9
8
|
import { BaseBehavior } from './base-behavior';
|
|
10
9
|
|
|
@@ -9,6 +9,11 @@ import { multiply } from '../utils/vector';
|
|
|
9
9
|
import type { BaseBehaviorOptions } from './base-behavior';
|
|
10
10
|
import { BaseBehavior } from './base-behavior';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* <zh/> 拖拽画布交互配置项
|
|
14
|
+
*
|
|
15
|
+
* <en/> Drag canvas behavior options
|
|
16
|
+
*/
|
|
12
17
|
export interface DragCanvasOptions extends BaseBehaviorOptions {
|
|
13
18
|
/**
|
|
14
19
|
* <zh/> 是否启用拖拽动画,仅在使用按键移动时有效
|
|
@@ -20,6 +25,7 @@ export interface DragCanvasOptions extends BaseBehaviorOptions {
|
|
|
20
25
|
* <zh/> 是否启用拖拽画布的功能
|
|
21
26
|
*
|
|
22
27
|
* <en/> Whether to enable the function of dragging the canvas
|
|
28
|
+
* @defaultValue true
|
|
23
29
|
*/
|
|
24
30
|
enable?: boolean | ((event: IPointerEvent | IKeyboardEvent) => boolean);
|
|
25
31
|
/**
|
|
@@ -32,6 +38,7 @@ export interface DragCanvasOptions extends BaseBehaviorOptions {
|
|
|
32
38
|
* <zh/> 触发一次按键移动的距离
|
|
33
39
|
*
|
|
34
40
|
* <en/> The distance of a single key movement
|
|
41
|
+
* @defaultValue 10
|
|
35
42
|
*/
|
|
36
43
|
sensitivity?: number;
|
|
37
44
|
/**
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { ID } from '@antv/graphlib';
|
|
2
1
|
import type { D3Force3DLayout, D3ForceLayout } from '@antv/layout';
|
|
3
|
-
import type { Element, IDragEvent, Point } from '../types';
|
|
2
|
+
import type { Element, ID, IDragEvent, Point } from '../types';
|
|
4
3
|
import { idOf } from '../utils/id';
|
|
5
4
|
import { add } from '../utils/vector';
|
|
6
5
|
import type { DragElementOptions } from './drag-element';
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { BaseStyleProps } from '@antv/g';
|
|
2
2
|
import { Rect } from '@antv/g';
|
|
3
|
-
import type { ID } from '@antv/graphlib';
|
|
4
3
|
import { isFunction } from '@antv/util';
|
|
5
4
|
import { COMBO_KEY, CommonEvent } from '../constants';
|
|
6
5
|
import type { RuntimeContext } from '../runtime/types';
|
|
7
|
-
import type { EdgeDirection, Element, IDragEvent, Point, PrefixObject } from '../types';
|
|
6
|
+
import type { EdgeDirection, Element, ID, IDragEvent, Point, PrefixObject } from '../types';
|
|
8
7
|
import { getBBoxSize, getCombinedBBox } from '../utils/bbox';
|
|
9
8
|
import { idOf } from '../utils/id';
|
|
10
9
|
import { subStyleProps } from '../utils/prefix';
|
|
@@ -35,7 +34,7 @@ export interface DragElementOptions extends BaseBehaviorOptions, PrefixObject<Ba
|
|
|
35
34
|
* - link: Place the drag element as a child element of the target element
|
|
36
35
|
* - move: Move the element and update the parent element size
|
|
37
36
|
* - none: Only update the drag target position, no additional operations
|
|
38
|
-
* @
|
|
37
|
+
* @remarks
|
|
39
38
|
* <zh/> combo 元素可作为元素容器置入 node 或 combo 元素
|
|
40
39
|
*
|
|
41
40
|
* <en/> The combo element can be placed as an element container into the node or combo element
|
|
@@ -61,7 +60,7 @@ export interface DragElementOptions extends BaseBehaviorOptions, PrefixObject<Ba
|
|
|
61
60
|
* - in: hide the edges with the node as the target node
|
|
62
61
|
* - both: hide all edges related to the node
|
|
63
62
|
* - all: hide all edges in the graph
|
|
64
|
-
* @
|
|
63
|
+
* @remarks
|
|
65
64
|
* <zh/> 使用幽灵节点时不会隐藏边
|
|
66
65
|
*
|
|
67
66
|
* <en/> Edges will not be hidden when using the drag shadow
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { ID } from '@antv/graphlib';
|
|
2
1
|
import { isFunction } from '@antv/util';
|
|
3
2
|
import { CommonEvent } from '../constants';
|
|
4
3
|
import type { RuntimeContext } from '../runtime/types';
|
|
5
|
-
import type { Element, IPointerEvent, ViewportAnimationEffectTiming } from '../types';
|
|
4
|
+
import type { Element, ID, IPointerEvent, ViewportAnimationEffectTiming } from '../types';
|
|
6
5
|
import type { BaseBehaviorOptions } from './base-behavior';
|
|
7
6
|
import { BaseBehavior } from './base-behavior';
|
|
8
7
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { ID } from '@antv/graphlib';
|
|
2
1
|
import { isFunction } from '@antv/util';
|
|
3
2
|
import { CommonEvent } from '../constants';
|
|
4
3
|
import { ELEMENT_TYPES } from '../constants/element';
|
|
5
4
|
import type { RuntimeContext } from '../runtime/types';
|
|
6
|
-
import type { Element, ElementType, IPointerEvent, State } from '../types';
|
|
5
|
+
import type { Element, ElementType, ID, IPointerEvent, State } from '../types';
|
|
7
6
|
import { idsOf } from '../utils/id';
|
|
8
7
|
import { getElementNthDegreeIds } from '../utils/relation';
|
|
9
8
|
import type { BaseBehaviorOptions } from './base-behavior';
|
package/src/behaviors/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ export { DragElementForce } from './drag-element-force';
|
|
|
9
9
|
export { FocusElement } from './focus-element';
|
|
10
10
|
export { HoverElement } from './hover-element';
|
|
11
11
|
export { LassoSelect } from './lasso-select';
|
|
12
|
+
export { ScrollCanvas } from './scroll-canvas';
|
|
12
13
|
export { ZoomCanvas } from './zoom-canvas';
|
|
13
14
|
|
|
14
15
|
export type { BaseBehaviorOptions } from './base-behavior';
|
|
@@ -22,4 +23,5 @@ export type { DragElementForceOptions } from './drag-element-force';
|
|
|
22
23
|
export type { FocusElementOptions } from './focus-element';
|
|
23
24
|
export type { HoverElementOptions } from './hover-element';
|
|
24
25
|
export type { LassoSelectOptions } from './lasso-select';
|
|
26
|
+
export type { ScrollCanvasOptions } from './scroll-canvas';
|
|
25
27
|
export type { ZoomCanvasOptions } from './zoom-canvas';
|
|
@@ -4,16 +4,15 @@ import { getAllElementState } from '../utils/behaviors/utils';
|
|
|
4
4
|
import { pointsToPath } from '../utils/path';
|
|
5
5
|
import { BrushSelect, DEFAULT_STYLE } from './brush-select';
|
|
6
6
|
|
|
7
|
-
import type { ID } from '@antv/graphlib';
|
|
8
7
|
import type { RuntimeContext } from '../runtime/types';
|
|
9
|
-
import type { IPointerEvent, Points, State } from '../types';
|
|
8
|
+
import type { ID, IPointerEvent, Points, State } from '../types';
|
|
10
9
|
import type { BrushSelectOptions } from './brush-select';
|
|
11
10
|
|
|
12
11
|
const SHOW_PATH_ID = 'g6-lasso-select-path-id';
|
|
13
12
|
|
|
14
13
|
export type States = Record<ID, State | State[]>;
|
|
15
14
|
|
|
16
|
-
export
|
|
15
|
+
export interface LassoSelectOptions extends BrushSelectOptions {}
|
|
17
16
|
|
|
18
17
|
export class LassoSelect extends BrushSelect<LassoSelectOptions> {
|
|
19
18
|
static defaultOptions: Partial<LassoSelectOptions> = {
|
|
@@ -43,7 +42,7 @@ export class LassoSelect extends BrushSelect<LassoSelectOptions> {
|
|
|
43
42
|
id: SHOW_PATH_ID,
|
|
44
43
|
style: {
|
|
45
44
|
...LassoSelect.defaultOptions.style,
|
|
46
|
-
fill: style.
|
|
45
|
+
fill: style.fill || DEFAULT_STYLE.fill,
|
|
47
46
|
...style,
|
|
48
47
|
pointerEvents: 'none',
|
|
49
48
|
},
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { isFunction, isObject } from '@antv/util';
|
|
2
|
+
import { CanvasEvent } from '../constants';
|
|
3
|
+
import type { RuntimeContext } from '../runtime/types';
|
|
4
|
+
import type { IKeyboardEvent, Point } from '../types';
|
|
5
|
+
import { Shortcut, ShortcutKey } from '../utils/shortcut';
|
|
6
|
+
import type { BaseBehaviorOptions } from './base-behavior';
|
|
7
|
+
import { BaseBehavior } from './base-behavior';
|
|
8
|
+
|
|
9
|
+
export interface ScrollCanvasOptions extends BaseBehaviorOptions {
|
|
10
|
+
/**
|
|
11
|
+
* <zh/> 是否启用滚动画布的功能
|
|
12
|
+
*
|
|
13
|
+
* <en/> Whether to enable the function of scrolling the canvas
|
|
14
|
+
* @defaultValue true
|
|
15
|
+
*/
|
|
16
|
+
enable?: boolean | ((event: WheelEvent | IKeyboardEvent) => boolean);
|
|
17
|
+
/**
|
|
18
|
+
* <zh/> 触发滚动的方式,默认使用指针滚动
|
|
19
|
+
*
|
|
20
|
+
* <en/> The way to trigger scrolling, default to scrolling with the pointer pressed
|
|
21
|
+
*/
|
|
22
|
+
trigger?: CombinationKey;
|
|
23
|
+
/**
|
|
24
|
+
* <zh/> 允许的滚动方向
|
|
25
|
+
* - 默认情况下没有限制
|
|
26
|
+
* - x : 只允许水平滚动
|
|
27
|
+
* - y : 只允许垂直滚动
|
|
28
|
+
*
|
|
29
|
+
* <en/> The allowed rolling direction
|
|
30
|
+
* - by default, there is no restriction
|
|
31
|
+
* - x: only allow horizontal scrolling
|
|
32
|
+
* - y: only allow vertical scrolling
|
|
33
|
+
*/
|
|
34
|
+
direction?: 'x' | 'y';
|
|
35
|
+
/**
|
|
36
|
+
* <zh/> 滚动灵敏度
|
|
37
|
+
*
|
|
38
|
+
* <en/> Scroll sensitivity
|
|
39
|
+
* @defaultValue 1
|
|
40
|
+
*/
|
|
41
|
+
sensitivity?: number;
|
|
42
|
+
/**
|
|
43
|
+
* <zh/> 完成滚动时的回调
|
|
44
|
+
*
|
|
45
|
+
* <en/> Callback when scrolling is completed
|
|
46
|
+
*/
|
|
47
|
+
onFinish?: () => void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
type CombinationKey = {
|
|
51
|
+
up: ShortcutKey;
|
|
52
|
+
down: ShortcutKey;
|
|
53
|
+
left: ShortcutKey;
|
|
54
|
+
right: ShortcutKey;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export class ScrollCanvas extends BaseBehavior<ScrollCanvasOptions> {
|
|
58
|
+
static defaultOptions: ScrollCanvasOptions = {
|
|
59
|
+
enable: true,
|
|
60
|
+
sensitivity: 1,
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
private shortcut: Shortcut;
|
|
64
|
+
|
|
65
|
+
constructor(context: RuntimeContext, options: ScrollCanvasOptions) {
|
|
66
|
+
super(context, Object.assign({}, ScrollCanvas.defaultOptions, options));
|
|
67
|
+
|
|
68
|
+
this.shortcut = new Shortcut(context.graph);
|
|
69
|
+
|
|
70
|
+
this.bindEvents();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
private bindEvents() {
|
|
74
|
+
const { trigger } = this.options;
|
|
75
|
+
this.shortcut.unbindAll();
|
|
76
|
+
const { graph } = this.context;
|
|
77
|
+
if (isObject(trigger)) {
|
|
78
|
+
graph.off(CanvasEvent.WHEEL, this.onWheel);
|
|
79
|
+
const { up = [], down = [], left = [], right = [] } = trigger;
|
|
80
|
+
|
|
81
|
+
this.shortcut.bind(up, (event) => this.scroll([0, -10], event));
|
|
82
|
+
this.shortcut.bind(down, (event) => this.scroll([0, 10], event));
|
|
83
|
+
this.shortcut.bind(left, (event) => this.scroll([-10, 0], event));
|
|
84
|
+
this.shortcut.bind(right, (event) => this.scroll([10, 0], event));
|
|
85
|
+
} else {
|
|
86
|
+
/**
|
|
87
|
+
* 这里必需在原生canvas上绑定wheel事件,参考:
|
|
88
|
+
* https://g.antv.antgroup.com/api/event/faq#%E5%9C%A8-chrome-%E4%B8%AD%E7%A6%81%E6%AD%A2%E9%A1%B5%E9%9D%A2%E9%BB%98%E8%AE%A4%E6%BB%9A%E5%8A%A8%E8%A1%8C%E4%B8%BA
|
|
89
|
+
*/
|
|
90
|
+
this.graphDom?.addEventListener(CanvasEvent.WHEEL, this.onWheel, { passive: false });
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
get graphDom() {
|
|
95
|
+
return this.context.graph.getCanvas().getContextService().getDomElement();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private onWheel = async (event: WheelEvent) => {
|
|
99
|
+
event.preventDefault();
|
|
100
|
+
const diffX = event.deltaX;
|
|
101
|
+
const diffY = event.deltaY;
|
|
102
|
+
|
|
103
|
+
await this.scroll([-diffX, -diffY], event);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
private formatDisplacement([dx, dy]: Point) {
|
|
107
|
+
const { direction, sensitivity } = this.options;
|
|
108
|
+
|
|
109
|
+
dx = dx * sensitivity;
|
|
110
|
+
dy = dy * sensitivity;
|
|
111
|
+
|
|
112
|
+
if (direction === 'x') {
|
|
113
|
+
dy = 0;
|
|
114
|
+
} else if (direction === 'y') {
|
|
115
|
+
dx = 0;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return [dx, dy] as Point;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
private async scroll(value: Point, event: WheelEvent | IKeyboardEvent) {
|
|
122
|
+
if (!this.validate(event)) return;
|
|
123
|
+
const { onFinish } = this.options;
|
|
124
|
+
const graph = this.context.graph;
|
|
125
|
+
const formattedValue = this.formatDisplacement(value);
|
|
126
|
+
await graph.translateBy(formattedValue, false);
|
|
127
|
+
onFinish?.();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
private validate(event: WheelEvent | IKeyboardEvent) {
|
|
131
|
+
if (this.destroyed) return false;
|
|
132
|
+
|
|
133
|
+
const { enable } = this.options;
|
|
134
|
+
if (isFunction(enable)) return enable(event);
|
|
135
|
+
return !!enable;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
public destroy(): void {
|
|
139
|
+
this.shortcut.destroy();
|
|
140
|
+
this.graphDom?.removeEventListener(CanvasEvent.WHEEL, this.onWheel);
|
|
141
|
+
super.destroy();
|
|
142
|
+
}
|
|
143
|
+
}
|
package/src/behaviors/types.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { BaseBehavior } from './base-behavior';
|
|
2
2
|
import type { DragCanvasOptions } from './drag-canvas';
|
|
3
|
+
import type { ScrollCanvasOptions } from './scroll-canvas';
|
|
3
4
|
import type { ZoomCanvasOptions } from './zoom-canvas';
|
|
4
5
|
|
|
5
6
|
export type { States } from './brush-select';
|
|
6
7
|
|
|
7
|
-
export type BuiltInBehaviorOptions = DragCanvasOptions | ZoomCanvasOptions;
|
|
8
|
+
export type BuiltInBehaviorOptions = DragCanvasOptions | ZoomCanvasOptions | ScrollCanvasOptions;
|
|
8
9
|
export type Behavior = BaseBehavior<any>;
|
|
@@ -26,7 +26,7 @@ export interface ZoomCanvasOptions extends BaseBehaviorOptions {
|
|
|
26
26
|
* <zh/> 触发缩放的方式
|
|
27
27
|
*
|
|
28
28
|
* <en/> The way to trigger zoom
|
|
29
|
-
* @
|
|
29
|
+
* @remarks
|
|
30
30
|
* <zh/>
|
|
31
31
|
* - 数组:组合快捷键,默认使用滚轮缩放,['Control'] 表示按住 Control 键滚动鼠标滚轮时触发缩放
|
|
32
32
|
* - 对象:缩放快捷键,例如 { zoomIn: ['Control', '+'], zoomOut: ['Control', '-'], reset: ['Control', '0'] }
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
export enum AnimationType {
|
|
2
2
|
DRAW = 'draw',
|
|
3
3
|
TRANSFORM = 'transform',
|
|
4
|
-
// LAYOUT = 'layout', // 布局没有统一的动画对象,因此不抛出动画事件 | There is no unified animation object for layout, so no animation event is thrown
|
|
5
|
-
ELEMENT_VISIBILITY_CHANGE = 'elementvisibilitychange',
|
|
6
|
-
ELEMENT_STATE_CHANGE = 'elementstatechange',
|
|
7
|
-
ELEMENT_TRANSLATE = 'elementtranslate',
|
|
8
4
|
}
|
|
@@ -51,4 +51,8 @@ export enum GraphEvent {
|
|
|
51
51
|
BATCH_START = 'batchstart',
|
|
52
52
|
/** <zh/> 批处理结束 | <en/> Batch processing ends */
|
|
53
53
|
BATCH_END = 'batchend',
|
|
54
|
+
/** <zh/> 销毁开始之前 | <en/> Before destruction */
|
|
55
|
+
BEFORE_DESTROY = 'beforedestroy',
|
|
56
|
+
/** <zh/> 销毁结束之后 | <en/> After destruction */
|
|
57
|
+
AFTER_DESTROY = 'afterdestroy',
|
|
54
58
|
}
|
|
@@ -57,7 +57,7 @@ export type BaseComboStyleProps<T extends Record<string, unknown> = Record<strin
|
|
|
57
57
|
* <zh/> Combo 的子元素数据
|
|
58
58
|
*
|
|
59
59
|
* <en/> The data of the children of combo
|
|
60
|
-
* @
|
|
60
|
+
* @remarks
|
|
61
61
|
* <zh/> 如果 combo 是收起状态,children 可能为空,通过 childrenData 能够获取完整的子元素数据
|
|
62
62
|
*
|
|
63
63
|
* <en/> If the combo is collapsed, children may be empty, and the complete child element data can be obtained through childrenData
|
|
@@ -78,11 +78,6 @@ export type BaseEdgeStyleProps = BaseElementStyleProps &
|
|
|
78
78
|
* <en/> Offset of the end arrow
|
|
79
79
|
*/
|
|
80
80
|
endArrowOffset?: number;
|
|
81
|
-
/**
|
|
82
|
-
* <zh/> 主色
|
|
83
|
-
* <en/> Subject color
|
|
84
|
-
*/
|
|
85
|
-
color?: string;
|
|
86
81
|
/**
|
|
87
82
|
* <zh/> 边的起点 shape
|
|
88
83
|
* <en/> The source shape. Represents the start of the edge
|
|
@@ -151,13 +146,12 @@ export abstract class BaseEdge extends BaseShape<BaseEdgeStyleProps> {
|
|
|
151
146
|
}
|
|
152
147
|
|
|
153
148
|
protected getKeyStyle(attributes: ParsedBaseEdgeStyleProps): PathStyleProps {
|
|
154
|
-
const { sourceNode, targetNode,
|
|
149
|
+
const { sourceNode, targetNode, ...style } = this.getGraphicStyle(attributes);
|
|
155
150
|
|
|
156
151
|
const path = isSameNode(sourceNode, targetNode) ? this.getLoopPath(attributes) : this.getKeyPath(attributes);
|
|
157
152
|
return {
|
|
158
153
|
path,
|
|
159
154
|
...omitStyleProps(style, ['halo', 'label', 'startArrow', 'endArrow']),
|
|
160
|
-
stroke: color || stroke,
|
|
161
155
|
};
|
|
162
156
|
}
|
|
163
157
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { DisplayObject, DisplayObjectConfig, Group } from '@antv/g';
|
|
2
2
|
import { Circle as GCircle } from '@antv/g';
|
|
3
|
-
import type { ID } from '@antv/graphlib';
|
|
4
3
|
import { deepMix, isEmpty } from '@antv/util';
|
|
5
4
|
import type { CategoricalPalette } from '../../palettes/types';
|
|
6
5
|
import type { NodeData } from '../../spec';
|
|
7
6
|
import type {
|
|
8
7
|
BadgePlacement,
|
|
9
8
|
BaseElementStyleProps,
|
|
9
|
+
ID,
|
|
10
10
|
Keyframe,
|
|
11
11
|
LabelPlacement,
|
|
12
12
|
Node,
|
|
@@ -59,18 +59,12 @@ export type BaseNodeStyleProps<T extends Record<string, unknown> = Record<string
|
|
|
59
59
|
* <en/> The size of node, which is a shortcut to set the width and height of node
|
|
60
60
|
*/
|
|
61
61
|
size?: Size;
|
|
62
|
-
/**
|
|
63
|
-
* <zh/> 主色
|
|
64
|
-
*
|
|
65
|
-
* <en/> Subject color
|
|
66
|
-
*/
|
|
67
|
-
color?: string;
|
|
68
62
|
/**
|
|
69
63
|
* @deprecated
|
|
70
64
|
* <zh/> 解决类型 style.getPropertyValue 问题,不要使用该属性
|
|
71
65
|
*
|
|
72
66
|
* <en/> Solve the problem of style.getPropertyValue, do not use this property
|
|
73
|
-
* @
|
|
67
|
+
* @remarks
|
|
74
68
|
* <zh/> 移除该属性会导致 Polygon 及其子类与 Node 不兼容
|
|
75
69
|
*
|
|
76
70
|
* <en/> Removing this property will cause Polygon and its subclasses to be incompatible with Node
|
|
@@ -200,12 +194,9 @@ export abstract class BaseNode<S extends BaseNodeStyleProps = BaseNodeStyleProps
|
|
|
200
194
|
}
|
|
201
195
|
|
|
202
196
|
protected getKeyStyle(attributes: Required<S>) {
|
|
203
|
-
const
|
|
197
|
+
const style = this.getGraphicStyle(attributes);
|
|
204
198
|
|
|
205
|
-
return Object.assign(
|
|
206
|
-
{ fill: color || fill },
|
|
207
|
-
omitStyleProps(style, ['label', 'halo', 'icon', 'badge', 'port']),
|
|
208
|
-
) as any;
|
|
199
|
+
return Object.assign(omitStyleProps(style, ['label', 'halo', 'icon', 'badge', 'port'])) as any;
|
|
209
200
|
}
|
|
210
201
|
|
|
211
202
|
protected getLabelStyle(attributes: Required<S>): false | LabelStyleProps {
|
|
@@ -310,8 +301,8 @@ export abstract class BaseNode<S extends BaseNodeStyleProps = BaseNodeStyleProps
|
|
|
310
301
|
* Get the key shape for the node.
|
|
311
302
|
* @returns Key shape.
|
|
312
303
|
*/
|
|
313
|
-
public getKey():
|
|
314
|
-
return this.shapeMap.key;
|
|
304
|
+
public getKey<T extends DisplayObject>(): T {
|
|
305
|
+
return this.shapeMap.key as T;
|
|
315
306
|
}
|
|
316
307
|
|
|
317
308
|
/**
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { Path } from '@antv/g';
|
|
2
|
+
import { deepMix, isNumber, isString } from '@antv/util';
|
|
3
|
+
import { getPaletteColors } from '../../utils/palette';
|
|
4
|
+
import { subStyleProps } from '../../utils/prefix';
|
|
5
|
+
import { parseSize } from '../../utils/size';
|
|
6
|
+
import { Circle } from './circle';
|
|
7
|
+
|
|
8
|
+
import type { BaseStyleProps, DisplayObjectConfig, Group } from '@antv/g';
|
|
9
|
+
import type { PrefixObject } from '../../types';
|
|
10
|
+
import type { CircleStyleProps } from './circle';
|
|
11
|
+
|
|
12
|
+
interface Round extends BaseStyleProps {
|
|
13
|
+
/**
|
|
14
|
+
* <zh/> 数值,用于计算比例
|
|
15
|
+
*
|
|
16
|
+
* <en/> Numerical value used to calculate the scale.
|
|
17
|
+
*/
|
|
18
|
+
value: number;
|
|
19
|
+
/**
|
|
20
|
+
* <zh/> 颜色
|
|
21
|
+
*
|
|
22
|
+
* <en/> Color.
|
|
23
|
+
*/
|
|
24
|
+
color?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface DonutStyleProps extends CircleStyleProps, PrefixObject<BaseStyleProps, 'donut'> {
|
|
28
|
+
/**
|
|
29
|
+
* <zh/> 内环半径,使用百分比或者像素值
|
|
30
|
+
*
|
|
31
|
+
* <en/> Inner ring radius, using percentage or pixel value.
|
|
32
|
+
*/
|
|
33
|
+
innerRadius?: string | number;
|
|
34
|
+
/**
|
|
35
|
+
* <zh/> 圆环数据
|
|
36
|
+
*
|
|
37
|
+
* <en/> Donut data.
|
|
38
|
+
*/
|
|
39
|
+
donuts?: number[] | Round[];
|
|
40
|
+
/**
|
|
41
|
+
* <zh/> 颜色或者色板名
|
|
42
|
+
*
|
|
43
|
+
* <en/> Color or palette.
|
|
44
|
+
*/
|
|
45
|
+
colors?: string | string[];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export class Donut extends Circle {
|
|
49
|
+
static defaultStyleProps: Partial<DonutStyleProps> = {
|
|
50
|
+
innerRadius: '50%',
|
|
51
|
+
donuts: [],
|
|
52
|
+
colors: 'tableau',
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
constructor(options: DisplayObjectConfig<DonutStyleProps>) {
|
|
56
|
+
super(deepMix({}, { style: Donut.defaultStyleProps }, options));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
protected drawDonutShape(attributes: Required<DonutStyleProps>, container: Group): void {
|
|
60
|
+
const { donuts, innerRadius = 0, size } = attributes;
|
|
61
|
+
if (!donuts?.length) return;
|
|
62
|
+
|
|
63
|
+
const parsedDonuts = donuts.map((round) => (isNumber(round) ? { value: round } : round) as Round);
|
|
64
|
+
|
|
65
|
+
const style = subStyleProps<BaseStyleProps>(this.getGraphicStyle(attributes), 'donut');
|
|
66
|
+
|
|
67
|
+
const colors = getPaletteColors(attributes.colors);
|
|
68
|
+
if (!colors) return;
|
|
69
|
+
|
|
70
|
+
const sum = parsedDonuts.reduce((acc, cur) => acc + (cur.value ?? 0), 0);
|
|
71
|
+
|
|
72
|
+
let start = 0;
|
|
73
|
+
parsedDonuts.forEach((round, index) => {
|
|
74
|
+
const { value = 0, color = colors[index % colors.length], ...roundStyle } = round;
|
|
75
|
+
const outerR = parseSize(size)[0] / 2;
|
|
76
|
+
const innerR = isString(innerRadius) ? (outerR * parseInt(innerRadius)) / 100 : innerRadius;
|
|
77
|
+
const angle = (sum === 0 ? 1 / parsedDonuts.length : value / sum) * 360;
|
|
78
|
+
|
|
79
|
+
this.upsert(
|
|
80
|
+
`round${index}`,
|
|
81
|
+
Path,
|
|
82
|
+
{
|
|
83
|
+
...style,
|
|
84
|
+
path: arc(outerR, innerR, start, start + angle),
|
|
85
|
+
fill: color,
|
|
86
|
+
...roundStyle,
|
|
87
|
+
},
|
|
88
|
+
container,
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
start += angle;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
public render(attributes: Required<DonutStyleProps>, container: Group = this) {
|
|
96
|
+
super.render(attributes, container);
|
|
97
|
+
this.drawDonutShape(attributes, container);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const point = (x: number, y: number, r: number, angel: number) => [x + Math.sin(angel) * r, y - Math.cos(angel) * r];
|
|
102
|
+
|
|
103
|
+
const full = (x: number, y: number, R: number, r: number) => {
|
|
104
|
+
if (r <= 0 || R <= r) {
|
|
105
|
+
return [['M', x - R, y], ['A', R, R, 0, 1, 1, x + R, y], ['A', R, R, 0, 1, 1, x - R, y], ['Z']];
|
|
106
|
+
}
|
|
107
|
+
return [
|
|
108
|
+
['M', x - R, y],
|
|
109
|
+
['A', R, R, 0, 1, 1, x + R, y],
|
|
110
|
+
['A', R, R, 0, 1, 1, x - R, y],
|
|
111
|
+
['Z'],
|
|
112
|
+
['M', x + r, y],
|
|
113
|
+
['A', r, r, 0, 1, 0, x - r, y],
|
|
114
|
+
['A', r, r, 0, 1, 0, x + r, y],
|
|
115
|
+
['Z'],
|
|
116
|
+
];
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const part = (x: number, y: number, R: number, r: number, start: number, end: number) => {
|
|
120
|
+
const [s, e] = [(start / 360) * 2 * Math.PI, (end / 360) * 2 * Math.PI];
|
|
121
|
+
const P = [point(x, y, r, s), point(x, y, R, s), point(x, y, R, e), point(x, y, r, e)];
|
|
122
|
+
const flag = e - s > Math.PI ? 1 : 0;
|
|
123
|
+
return [
|
|
124
|
+
['M', P[0][0], P[0][1]],
|
|
125
|
+
['L', P[1][0], P[1][1]],
|
|
126
|
+
['A', R, R, 0, flag, 1, P[2][0], P[2][1]],
|
|
127
|
+
['L', P[3][0], P[3][1]],
|
|
128
|
+
['A', r, r, 0, flag, 0, P[0][0], P[0][1]],
|
|
129
|
+
['Z'],
|
|
130
|
+
];
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const arc = (R = 0, r = 0, start: number, end: number) => {
|
|
134
|
+
const [x, y] = [0, 0];
|
|
135
|
+
if (Math.abs(start - end) % 360 < 0.000001) return full(x, y, R, r);
|
|
136
|
+
return part(x, y, R, r, start, end);
|
|
137
|
+
};
|