@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
package/src/runtime/layout.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { COMBO_KEY, GraphEvent, TREE_KEY } from '../constants';
|
|
|
8
8
|
import { getExtension } from '../registry';
|
|
9
9
|
import type { EdgeData, NodeData } from '../spec';
|
|
10
10
|
import type { STDLayoutOptions } from '../spec/layout';
|
|
11
|
-
import type { Combo, Node, PartialGraphData, TreeData } from '../types';
|
|
11
|
+
import type { Combo, ID, Node, PartialGraphData, TreeData } from '../types';
|
|
12
12
|
import { getAnimation } from '../utils/animation';
|
|
13
13
|
import { isVisible } from '../utils/element';
|
|
14
14
|
import { GraphLifeCycleEvent, emit } from '../utils/event';
|
|
@@ -292,7 +292,7 @@ export class LayoutController {
|
|
|
292
292
|
const nodeSize: number | ((node: LayoutGraphlibNode) => number) =
|
|
293
293
|
(options?.nodeSize as number) ??
|
|
294
294
|
((node) => {
|
|
295
|
-
const nodeElement = element?.getElement<Node | Combo>(node.id);
|
|
295
|
+
const nodeElement = element?.getElement<Node | Combo>(node.id as string);
|
|
296
296
|
const { size } = nodeElement?.attributes || {};
|
|
297
297
|
return Math.max(...parseSize(size));
|
|
298
298
|
});
|
|
@@ -327,7 +327,7 @@ export class LayoutController {
|
|
|
327
327
|
const { nodes, edges } = layoutData;
|
|
328
328
|
const dataToUpdate: Required<PartialGraphData> = { nodes: [], edges: [], combos: [] };
|
|
329
329
|
nodes.forEach(({ id, data: { x, y, z = 0 } }) => {
|
|
330
|
-
dataToUpdate.nodes.push({ id, style: { x, y, z } });
|
|
330
|
+
dataToUpdate.nodes.push({ id: id as ID, style: { x, y, z } });
|
|
331
331
|
});
|
|
332
332
|
|
|
333
333
|
edges.forEach(({ id, data: { points = [], controlPoints = points.slice(1, points.length - 1) } }) => {
|
|
@@ -338,7 +338,7 @@ export class LayoutController {
|
|
|
338
338
|
if (controlPoints?.length) {
|
|
339
339
|
// points 的第一个点是起点,最后一个点是终点,中间的点是控制点
|
|
340
340
|
// The first point of points is the starting point, and the last point is the end point, and the middle point is the control point
|
|
341
|
-
dataToUpdate.edges.push({ id, style: { controlPoints: controlPoints.map(parsePoint) } });
|
|
341
|
+
dataToUpdate.edges.push({ id: id as ID, style: { controlPoints: controlPoints.map(parsePoint) } });
|
|
342
342
|
}
|
|
343
343
|
});
|
|
344
344
|
|
package/src/runtime/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { GraphOptions } from '../spec';
|
|
2
2
|
import type { BatchController } from './batch';
|
|
3
3
|
import type { BehaviorController } from './behavior';
|
|
4
4
|
import type { Canvas } from './canvas';
|
|
@@ -28,7 +28,7 @@ export interface RuntimeContext {
|
|
|
28
28
|
*
|
|
29
29
|
* <en/> G6 options
|
|
30
30
|
*/
|
|
31
|
-
options:
|
|
31
|
+
options: GraphOptions;
|
|
32
32
|
/**
|
|
33
33
|
* <zh/> 数据模型
|
|
34
34
|
*
|
|
@@ -45,7 +45,7 @@ export interface RuntimeContext {
|
|
|
45
45
|
* <zh/> 元素控制器
|
|
46
46
|
*
|
|
47
47
|
* <en/> Element controller
|
|
48
|
-
* @
|
|
48
|
+
* @remarks
|
|
49
49
|
* <zh/> 仅在绘制开始后才可用
|
|
50
50
|
*
|
|
51
51
|
* <en/> Only available after drawing starts
|
package/src/runtime/viewport.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { AABB } from '@antv/g';
|
|
2
|
-
import type { ID } from '@antv/graphlib';
|
|
3
2
|
import { clamp, isNumber, pick } from '@antv/util';
|
|
4
3
|
import { AnimationType, GraphEvent } from '../constants';
|
|
5
|
-
import type { FitViewOptions, Point, TransformOptions, Vector2, ViewportAnimationEffectTiming } from '../types';
|
|
4
|
+
import type { FitViewOptions, ID, Point, TransformOptions, Vector2, ViewportAnimationEffectTiming } from '../types';
|
|
6
5
|
import { getAnimation } from '../utils/animation';
|
|
7
6
|
import { getBBoxSize, getCombinedBBox } from '../utils/bbox';
|
|
8
7
|
import { AnimateEvent, ViewportEvent, emit } from '../utils/event';
|
|
@@ -57,7 +56,7 @@ export class ViewportController {
|
|
|
57
56
|
*
|
|
58
57
|
* <en/> Get the center coordinates of the canvas
|
|
59
58
|
* @returns - <zh/> 画布中心坐标 | <en/> Center coordinates of the canvas
|
|
60
|
-
* @
|
|
59
|
+
* @remarks
|
|
61
60
|
* <zh/> 基于画布的宽高计算中心坐标,不受视口变换影响
|
|
62
61
|
*
|
|
63
62
|
* <en/> Calculate the center coordinates based on the width and height of the canvas, not affected by the viewport transformation
|
|
@@ -73,7 +72,7 @@ export class ViewportController {
|
|
|
73
72
|
*
|
|
74
73
|
* <en/> Current viewport center coordinates
|
|
75
74
|
* @returns - <zh/> 视口中心坐标 | <en/> Viewport center coordinates
|
|
76
|
-
* @
|
|
75
|
+
* @remarks
|
|
77
76
|
* <zh/> 以画布原点为原点,受到视口变换影响
|
|
78
77
|
*
|
|
79
78
|
* <en/> With the origin of the canvas as the origin, affected by the viewport transformation
|
package/src/spec/canvas.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { CanvasConfig, IRenderer } from '@antv/g';
|
|
2
2
|
import type { Canvas } from '../runtime/canvas';
|
|
3
|
-
import type { CanvasLayer } from '../types/canvas';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* <zh/> 画布配置项
|
|
@@ -9,6 +8,11 @@ import type { CanvasLayer } from '../types/canvas';
|
|
|
9
8
|
* @public
|
|
10
9
|
*/
|
|
11
10
|
export interface CanvasOptions extends Pick<CanvasConfig, 'devicePixelRatio'> {
|
|
11
|
+
/**
|
|
12
|
+
* <zh/> 画布容器
|
|
13
|
+
*
|
|
14
|
+
* <en/> canvas container
|
|
15
|
+
*/
|
|
12
16
|
container?: string | HTMLElement | Canvas;
|
|
13
17
|
/**
|
|
14
18
|
* <zh/> 画布宽度
|
|
@@ -27,7 +31,7 @@ export interface CanvasOptions extends Pick<CanvasConfig, 'devicePixelRatio'> {
|
|
|
27
31
|
*
|
|
28
32
|
* <en/> get renderer
|
|
29
33
|
*/
|
|
30
|
-
renderer?: (layer:
|
|
34
|
+
renderer?: (layer: 'background' | 'main' | 'label' | 'transient') => IRenderer;
|
|
31
35
|
/**
|
|
32
36
|
* <zh/> 是否自动调整画布大小
|
|
33
37
|
*
|
package/src/spec/data.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ID } from '
|
|
1
|
+
import type { ID } from '../types';
|
|
2
2
|
import type { ComboStyle } from './element/combo';
|
|
3
3
|
import type { EdgeStyle } from './element/edge';
|
|
4
4
|
import type { NodeStyle } from './element/node';
|
|
@@ -25,24 +25,97 @@ export interface GraphData {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export interface NodeData {
|
|
28
|
+
/**
|
|
29
|
+
* <zh/> 节点 ID
|
|
30
|
+
*
|
|
31
|
+
* <en/> Node ID
|
|
32
|
+
*/
|
|
28
33
|
id: ID;
|
|
34
|
+
/**
|
|
35
|
+
* <zh/> 节点类型
|
|
36
|
+
*
|
|
37
|
+
* <en/> Node type
|
|
38
|
+
*/
|
|
39
|
+
type?: string;
|
|
40
|
+
/**
|
|
41
|
+
* <zh/> 节点数据
|
|
42
|
+
*
|
|
43
|
+
* <en/> Node data
|
|
44
|
+
*/
|
|
29
45
|
data?: Record<string, unknown>;
|
|
46
|
+
/**
|
|
47
|
+
* <zh/> 节点样式
|
|
48
|
+
*
|
|
49
|
+
* <en/> Node style
|
|
50
|
+
*/
|
|
30
51
|
style?: NodeStyle;
|
|
31
52
|
[key: string]: unknown;
|
|
32
53
|
}
|
|
33
54
|
|
|
34
55
|
export interface ComboData {
|
|
56
|
+
/**
|
|
57
|
+
* <zh/> Combo ID
|
|
58
|
+
*
|
|
59
|
+
* <en/> Combo ID
|
|
60
|
+
*/
|
|
35
61
|
id: ID;
|
|
62
|
+
/**
|
|
63
|
+
* <zh/> Combo 类型
|
|
64
|
+
*
|
|
65
|
+
* <en/> Combo type
|
|
66
|
+
*/
|
|
67
|
+
type?: string;
|
|
68
|
+
/**
|
|
69
|
+
* <zh/> Combo 数据
|
|
70
|
+
*
|
|
71
|
+
* <en/> Combo data
|
|
72
|
+
*/
|
|
36
73
|
data?: Record<string, unknown>;
|
|
74
|
+
/**
|
|
75
|
+
* <zh/> Combo 样式
|
|
76
|
+
*
|
|
77
|
+
* <en/> Combo style
|
|
78
|
+
*/
|
|
37
79
|
style?: ComboStyle;
|
|
38
80
|
[key: string]: unknown;
|
|
39
81
|
}
|
|
40
82
|
|
|
41
83
|
export interface EdgeData {
|
|
84
|
+
/**
|
|
85
|
+
* <zh/> 边 ID
|
|
86
|
+
*
|
|
87
|
+
* <en/> Edge ID
|
|
88
|
+
*/
|
|
42
89
|
id?: ID;
|
|
90
|
+
/**
|
|
91
|
+
* <zh/> 边源节点 ID
|
|
92
|
+
*
|
|
93
|
+
* <en/> Source node ID
|
|
94
|
+
*/
|
|
43
95
|
source: ID;
|
|
96
|
+
/**
|
|
97
|
+
* <zh/> 边目标节点 ID
|
|
98
|
+
*
|
|
99
|
+
* <en/> Target node ID
|
|
100
|
+
*/
|
|
44
101
|
target: ID;
|
|
102
|
+
/**
|
|
103
|
+
* <zh/> 边类型
|
|
104
|
+
*
|
|
105
|
+
* <en/> Edge type
|
|
106
|
+
*/
|
|
107
|
+
type?: string;
|
|
108
|
+
/**
|
|
109
|
+
* <zh/> 边数据
|
|
110
|
+
*
|
|
111
|
+
* <en/> Edge data
|
|
112
|
+
*/
|
|
45
113
|
data?: Record<string, unknown>;
|
|
114
|
+
/**
|
|
115
|
+
* <zh/> 边样式
|
|
116
|
+
*
|
|
117
|
+
* <en/> Edge style
|
|
118
|
+
*/
|
|
46
119
|
style?: EdgeStyle;
|
|
47
120
|
[key: string]: unknown;
|
|
48
121
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { ID } from '@antv/graphlib';
|
|
2
1
|
import type { BaseComboStyleProps } from '../../elements/combos';
|
|
2
|
+
import type { ID, State } from '../../types';
|
|
3
3
|
import type { CallableObject } from '../../types/callable';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ComboData } from '../data';
|
|
5
5
|
import type { AnimationOptions } from './animation';
|
|
6
|
-
import type { BaseElementStyle } from './base';
|
|
7
6
|
import type { PaletteOptions } from './palette';
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -12,18 +11,24 @@ import type { PaletteOptions } from './palette';
|
|
|
12
11
|
* <en/> Combo spec
|
|
13
12
|
*/
|
|
14
13
|
export interface ComboOptions {
|
|
14
|
+
/**
|
|
15
|
+
* <zh/> Combo 类型
|
|
16
|
+
*
|
|
17
|
+
* <en/> Combo type
|
|
18
|
+
*/
|
|
19
|
+
type?: string | ((datum: ComboData) => string);
|
|
15
20
|
/**
|
|
16
21
|
* <zh/> Combo 样式
|
|
17
22
|
*
|
|
18
23
|
* <en/> Combo style
|
|
19
24
|
*/
|
|
20
|
-
style?: CallableObject<ComboStyle,
|
|
25
|
+
style?: CallableObject<ComboStyle, ComboData>;
|
|
21
26
|
/**
|
|
22
27
|
* <zh/> Combo 状态样式
|
|
23
28
|
*
|
|
24
29
|
* <en/> Combo state style
|
|
25
30
|
*/
|
|
26
|
-
state?: Record<string, CallableObject<ComboStyle,
|
|
31
|
+
state?: Record<string, CallableObject<ComboStyle, ComboData>>;
|
|
27
32
|
/**
|
|
28
33
|
* <zh/> Combo 动画
|
|
29
34
|
*
|
|
@@ -45,7 +50,13 @@ export interface StaticComboOptions {
|
|
|
45
50
|
palette?: PaletteOptions;
|
|
46
51
|
}
|
|
47
52
|
|
|
48
|
-
export interface ComboStyle extends
|
|
53
|
+
export interface ComboStyle extends Partial<BaseComboStyleProps> {
|
|
54
|
+
/**
|
|
55
|
+
* <zh/> 初始状态
|
|
56
|
+
*
|
|
57
|
+
* <en/> Initial state
|
|
58
|
+
*/
|
|
59
|
+
states?: State[];
|
|
49
60
|
children?: ID[];
|
|
50
61
|
[key: string]: any;
|
|
51
62
|
}
|
package/src/spec/element/edge.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { BaseEdgeStyleProps } from '../../elements/edges';
|
|
2
|
+
import { State } from '../../types';
|
|
2
3
|
import type { CallableObject } from '../../types/callable';
|
|
3
4
|
import type { EdgeData } from '../data';
|
|
4
5
|
import type { AnimationOptions } from './animation';
|
|
5
|
-
import type { BaseElementStyle } from './base';
|
|
6
6
|
import type { PaletteOptions } from './palette';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -11,6 +11,12 @@ import type { PaletteOptions } from './palette';
|
|
|
11
11
|
* <en/> Edge spec
|
|
12
12
|
*/
|
|
13
13
|
export interface EdgeOptions {
|
|
14
|
+
/**
|
|
15
|
+
* <zh/> 边类型
|
|
16
|
+
*
|
|
17
|
+
* <en/> Edge type
|
|
18
|
+
*/
|
|
19
|
+
type?: string | ((datum: EdgeData) => string);
|
|
14
20
|
/**
|
|
15
21
|
* <zh/> 边样式
|
|
16
22
|
*
|
|
@@ -44,6 +50,12 @@ export interface StaticEdgeOptions {
|
|
|
44
50
|
palette?: PaletteOptions;
|
|
45
51
|
}
|
|
46
52
|
|
|
47
|
-
export interface EdgeStyle extends
|
|
53
|
+
export interface EdgeStyle extends Partial<BaseEdgeStyleProps> {
|
|
54
|
+
/**
|
|
55
|
+
* <zh/> 初始状态
|
|
56
|
+
*
|
|
57
|
+
* <en/> Initial state
|
|
58
|
+
*/
|
|
59
|
+
states?: State[];
|
|
48
60
|
[key: string]: any;
|
|
49
61
|
}
|
package/src/spec/element/node.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { ID } from '@antv/graphlib';
|
|
2
1
|
import type { BaseNodeStyleProps } from '../../elements/nodes';
|
|
2
|
+
import type { ID, State } from '../../types';
|
|
3
3
|
import type { CallableObject } from '../../types/callable';
|
|
4
4
|
import type { NodeData } from '../data';
|
|
5
5
|
import type { AnimationOptions } from './animation';
|
|
6
|
-
import type { BaseElementStyle } from './base';
|
|
7
6
|
import type { PaletteOptions } from './palette';
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -12,6 +11,12 @@ import type { PaletteOptions } from './palette';
|
|
|
12
11
|
* <en/> Node spec
|
|
13
12
|
*/
|
|
14
13
|
export interface NodeOptions {
|
|
14
|
+
/**
|
|
15
|
+
* <zh/> 节点类型
|
|
16
|
+
*
|
|
17
|
+
* <en/> Node type
|
|
18
|
+
*/
|
|
19
|
+
type?: string | ((datum: NodeData) => string);
|
|
15
20
|
/**
|
|
16
21
|
* <zh/> 节点样式
|
|
17
22
|
*
|
|
@@ -45,7 +50,18 @@ export interface StaticNodeOptions {
|
|
|
45
50
|
palette?: PaletteOptions;
|
|
46
51
|
}
|
|
47
52
|
|
|
48
|
-
export interface NodeStyle extends
|
|
53
|
+
export interface NodeStyle extends Partial<BaseNodeStyleProps> {
|
|
54
|
+
/**
|
|
55
|
+
* <zh/> 初始状态
|
|
56
|
+
*
|
|
57
|
+
* <en/> Initial state
|
|
58
|
+
*/
|
|
59
|
+
states?: State[];
|
|
60
|
+
/**
|
|
61
|
+
* <zh/> 子节点 ID (树图专用)
|
|
62
|
+
*
|
|
63
|
+
* <en/> Child node ID (for tree graph)
|
|
64
|
+
*/
|
|
49
65
|
children?: ID[];
|
|
50
66
|
[key: string]: any;
|
|
51
67
|
}
|
|
@@ -12,17 +12,25 @@ import type { TransformOptions } from './transform';
|
|
|
12
12
|
import type { ViewportOptions } from './viewport';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* <zh/>
|
|
15
|
+
* <zh/> Graph 配置项
|
|
16
16
|
*
|
|
17
|
-
* <en/>
|
|
17
|
+
* <en/> Graph options
|
|
18
|
+
* @remarks
|
|
19
|
+
* <zh/> Graph 的初始化通过 `new` 进行实例化,实例化时需要传入需要的参数。目前所支持的参数如下:
|
|
20
|
+
*
|
|
21
|
+
* <en/> The initialization of Graph is instantiated through `new`, and the required parameters need to be passed in when instantiated.
|
|
22
|
+
*
|
|
23
|
+
* ```
|
|
24
|
+
* new G6.Graph(options: GraphOptions) => Graph
|
|
25
|
+
* ```
|
|
18
26
|
*/
|
|
19
27
|
|
|
20
|
-
export interface
|
|
28
|
+
export interface GraphOptions extends CanvasOptions, ViewportOptions {
|
|
21
29
|
/**
|
|
22
30
|
* <zh/> 启用关闭、全局动画
|
|
23
31
|
*
|
|
24
32
|
* <en/> Enable or disable global animation
|
|
25
|
-
* @
|
|
33
|
+
* @remarks
|
|
26
34
|
* <zh/> 为动画配置项时,会启用动画,并将该动画配置作为全局动画的基础配置
|
|
27
35
|
*
|
|
28
36
|
* <en/> When it is an animation configuration item, the animation will be enabled, and the animation configuration will be used as the basic configuration of the global animation
|
package/src/spec/index.ts
CHANGED
|
@@ -4,9 +4,9 @@ export type { ComboData, EdgeData, GraphData, NodeData } from './data';
|
|
|
4
4
|
export type { ComboOptions } from './element/combo';
|
|
5
5
|
export type { EdgeOptions } from './element/edge';
|
|
6
6
|
export type { NodeOptions } from './element/node';
|
|
7
|
+
export type { GraphOptions } from './graph';
|
|
7
8
|
export type { LayoutOptions } from './layout';
|
|
8
9
|
export type { PluginOptions } from './plugin';
|
|
9
|
-
export type { G6Spec } from './spec';
|
|
10
10
|
export type { ThemeOptions } from './theme';
|
|
11
11
|
export type { TransformOptions } from './transform';
|
|
12
12
|
export type { ViewportOptions } from './viewport';
|
package/src/spec/theme.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import type { BuiltInTheme } from '../themes/types';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* <zh/> 主题配置项
|
|
5
3
|
*
|
|
6
4
|
* <en/> Theme Options
|
|
7
5
|
* @public
|
|
8
6
|
*/
|
|
9
|
-
export type ThemeOptions =
|
|
10
|
-
|
|
11
|
-
type CustomTheme = string;
|
|
7
|
+
export type ThemeOptions = 'light' | 'dark' | string;
|
package/src/spec/viewport.ts
CHANGED
package/src/themes/base.ts
CHANGED
|
@@ -34,6 +34,7 @@ type ThemeTokens = {
|
|
|
34
34
|
nodeStroke: string;
|
|
35
35
|
nodeBadgePalette?: string[];
|
|
36
36
|
nodePaletteOptions?: PaletteOptions;
|
|
37
|
+
donutPaletteOptions?: PaletteOptions;
|
|
37
38
|
edgeColor: string;
|
|
38
39
|
edgeColorDisabled: string;
|
|
39
40
|
edgePaletteOptions?: PaletteOptions;
|
|
@@ -77,7 +78,7 @@ export function create(tokens: ThemeTokens): Theme {
|
|
|
77
78
|
badgeFontSize: 8,
|
|
78
79
|
badgePadding: [1, 4],
|
|
79
80
|
badgePalette: nodeBadgePalette,
|
|
80
|
-
|
|
81
|
+
fill: nodeColor,
|
|
81
82
|
halo: false,
|
|
82
83
|
haloLineWidth: 12,
|
|
83
84
|
haloStrokeOpacity: 0.25,
|
|
@@ -120,26 +121,27 @@ export function create(tokens: ThemeTokens): Theme {
|
|
|
120
121
|
strokeOpacity: 0.85,
|
|
121
122
|
},
|
|
122
123
|
inactive: {
|
|
124
|
+
donutOpacity: 0.25,
|
|
123
125
|
iconOpacity: 0.25,
|
|
124
126
|
labelOpacity: 0.25,
|
|
125
127
|
opacity: 0.25,
|
|
126
128
|
},
|
|
127
129
|
disabled: {
|
|
128
|
-
|
|
130
|
+
fill: nodeColorDisabled,
|
|
129
131
|
labelOpacity: 0.25,
|
|
132
|
+
donutOpacity: 0.25,
|
|
130
133
|
},
|
|
131
134
|
},
|
|
132
135
|
animation: {
|
|
133
136
|
enter: 'fade',
|
|
134
137
|
exit: 'fade',
|
|
135
138
|
visibility: 'fade',
|
|
136
|
-
update: [{ fields: ['x', 'y', '
|
|
139
|
+
update: [{ fields: ['x', 'y', 'fill', 'stroke'] }],
|
|
137
140
|
},
|
|
138
141
|
},
|
|
139
142
|
edge: {
|
|
140
143
|
palette: edgePaletteOptions,
|
|
141
144
|
style: {
|
|
142
|
-
color: edgeColor,
|
|
143
145
|
halo: false,
|
|
144
146
|
haloLineWidth: 12,
|
|
145
147
|
haloStrokeOpacity: 0.25,
|
|
@@ -157,6 +159,7 @@ export function create(tokens: ThemeTokens): Theme {
|
|
|
157
159
|
labelTextBaseline: 'middle',
|
|
158
160
|
lineWidth: 1,
|
|
159
161
|
opacity: 1,
|
|
162
|
+
stroke: edgeColor,
|
|
160
163
|
},
|
|
161
164
|
state: {
|
|
162
165
|
selected: {
|
|
@@ -177,7 +180,7 @@ export function create(tokens: ThemeTokens): Theme {
|
|
|
177
180
|
opacity: 0.25,
|
|
178
181
|
},
|
|
179
182
|
disabled: {
|
|
180
|
-
|
|
183
|
+
stroke: edgeColorDisabled,
|
|
181
184
|
labelOpacity: 0.25,
|
|
182
185
|
},
|
|
183
186
|
},
|
|
@@ -185,7 +188,7 @@ export function create(tokens: ThemeTokens): Theme {
|
|
|
185
188
|
enter: 'fade',
|
|
186
189
|
exit: 'fade',
|
|
187
190
|
visibility: 'fade',
|
|
188
|
-
update: [{ fields: ['
|
|
191
|
+
update: [{ fields: ['path', 'stroke'], shape: 'key' }],
|
|
189
192
|
},
|
|
190
193
|
},
|
|
191
194
|
combo: {
|
|
@@ -193,7 +196,7 @@ export function create(tokens: ThemeTokens): Theme {
|
|
|
193
196
|
collapsedMaskFill: comboColor,
|
|
194
197
|
collapsedMaskFontSize: 12,
|
|
195
198
|
collapsedSize: 32,
|
|
196
|
-
|
|
199
|
+
fill: comboColor,
|
|
197
200
|
halo: false,
|
|
198
201
|
haloLineWidth: 12,
|
|
199
202
|
haloStroke: comboStroke,
|
|
@@ -232,7 +235,7 @@ export function create(tokens: ThemeTokens): Theme {
|
|
|
232
235
|
opacity: 0.65,
|
|
233
236
|
},
|
|
234
237
|
disabled: {
|
|
235
|
-
|
|
238
|
+
fill: comboColorDisabled,
|
|
236
239
|
labelOpacity: 0.25,
|
|
237
240
|
opacity: 0.25,
|
|
238
241
|
stroke: comboStrokeDisabled,
|
|
@@ -244,7 +247,7 @@ export function create(tokens: ThemeTokens): Theme {
|
|
|
244
247
|
visibility: 'fade',
|
|
245
248
|
expand: 'combo-collapse-expand',
|
|
246
249
|
collapse: 'combo-collapse-expand',
|
|
247
|
-
update: [{ fields: ['x', 'y'] }, { fields: ['size', '
|
|
250
|
+
update: [{ fields: ['x', 'y'] }, { fields: ['size', 'fill', 'stroke'], shape: 'key' }],
|
|
248
251
|
},
|
|
249
252
|
},
|
|
250
253
|
};
|
package/src/themes/types.ts
CHANGED
|
@@ -2,8 +2,6 @@ import type { StaticComboOptions } from '../spec/element/combo';
|
|
|
2
2
|
import type { StaticEdgeOptions } from '../spec/element/edge';
|
|
3
3
|
import type { StaticNodeOptions } from '../spec/element/node';
|
|
4
4
|
|
|
5
|
-
export type BuiltInTheme = 'light' | 'dark';
|
|
6
|
-
|
|
7
5
|
export type Theme = {
|
|
8
6
|
node?: StaticNodeOptions;
|
|
9
7
|
edge?: StaticEdgeOptions;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { PathStyleProps } from '@antv/g';
|
|
2
|
-
import type { ID } from '@antv/graphlib';
|
|
3
2
|
import { deepMix, isBoolean, isEmpty } from '@antv/util';
|
|
4
3
|
import type { RuntimeContext } from '../runtime/types';
|
|
5
4
|
import type { EdgeData } from '../spec';
|
|
6
|
-
import type { ElementDatum, ElementType, LoopPlacement, NodeLikeData } from '../types';
|
|
5
|
+
import type { ElementDatum, ElementType, ID, LoopPlacement, NodeLikeData } from '../types';
|
|
7
6
|
import { groupByChangeType, reduceDataChanges } from '../utils/change';
|
|
8
7
|
import { idOf } from '../utils/id';
|
|
9
8
|
import type { BaseTransformOptions } from './base-transform';
|
|
@@ -28,7 +27,7 @@ export interface ProcessParallelEdgesOptions extends BaseTransformOptions {
|
|
|
28
27
|
* <zh/> 处理模式,默认为捆绑
|
|
29
28
|
*
|
|
30
29
|
* <en/> Processing mode, default is bundle
|
|
31
|
-
* @
|
|
30
|
+
* @remarks
|
|
32
31
|
* <zh/>
|
|
33
32
|
* - merge: 将平行边合并为一条边,适用于不需要区分平行边的情况
|
|
34
33
|
* - bundle: 每条边都会与其他所有平行边捆绑在一起,并通过改变曲率与其他边分开。如果一组平行边的数量是奇数,那么中心的边将被绘制为直线,其他的边将被绘制为曲线
|
|
@@ -153,9 +152,7 @@ export class ProcessParallelEdges extends BaseTransform<ProcessParallelEdgesOpti
|
|
|
153
152
|
arcEdges.forEach((edge, i, edgeArr) => {
|
|
154
153
|
const computeStyle = () => {
|
|
155
154
|
const length = edgeArr.length;
|
|
156
|
-
const style: EdgeData['style'] = {
|
|
157
|
-
type: CUBIC_EDGE_TYPE,
|
|
158
|
-
};
|
|
155
|
+
const style: EdgeData['style'] = {};
|
|
159
156
|
if (edge.source === edge.target) {
|
|
160
157
|
const len = CUBIC_LOOP_PLACEMENTS.length;
|
|
161
158
|
style.loopPlacement = CUBIC_LOOP_PLACEMENTS[i % len];
|
|
@@ -172,7 +169,8 @@ export class ProcessParallelEdges extends BaseTransform<ProcessParallelEdgesOpti
|
|
|
172
169
|
return style;
|
|
173
170
|
};
|
|
174
171
|
|
|
175
|
-
const mergedEdgeData = deepMix(edge, { style: computeStyle() });
|
|
172
|
+
const mergedEdgeData = deepMix(edge, { type: CUBIC_EDGE_TYPE, style: computeStyle() });
|
|
173
|
+
|
|
176
174
|
const element = this.context.element?.getElement(idOf(edge));
|
|
177
175
|
if (element) reassignTo('update', 'edge', mergedEdgeData);
|
|
178
176
|
else reassignTo('add', 'edge', mergedEdgeData);
|
package/src/transforms/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ID } from '@antv/graphlib';
|
|
2
1
|
import type { ComboData, EdgeData, NodeData } from '../spec';
|
|
2
|
+
import type { ID } from '../types';
|
|
3
3
|
import type { BaseTransform, BaseTransformOptions } from './base-transform';
|
|
4
4
|
|
|
5
5
|
export type BuiltInTransformOptions = BaseTransformOptions;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { ID } from '
|
|
2
|
-
import type { NodeLikeData } from '../types';
|
|
1
|
+
import type { ID, NodeLikeData } from '../types';
|
|
3
2
|
import { idOf } from '../utils/id';
|
|
4
3
|
import { BaseTransform } from './base-transform';
|
|
5
4
|
import type { DrawData } from './types';
|
package/src/types/callable.ts
CHANGED
|
@@ -27,7 +27,7 @@ export type CallableValue<Returns, Param = Returns> = Returns | ((args: Param) =
|
|
|
27
27
|
* }
|
|
28
28
|
*/
|
|
29
29
|
export type CallableObject<Obj extends Record<string, unknown>, T> =
|
|
30
|
-
| ((datum: T
|
|
30
|
+
| ((datum: T) => Obj)
|
|
31
31
|
| {
|
|
32
|
-
[K in keyof Obj]: Obj[K] | ((datum: T
|
|
32
|
+
[K in keyof Obj]: Obj[K] | ((datum: T) => NonNullable<Obj[K]>);
|
|
33
33
|
};
|
package/src/types/data.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ID } from '@antv/graphlib';
|
|
2
1
|
import type { ComboData, EdgeData, NodeData } from '../spec/data';
|
|
2
|
+
import type { ID } from '../types';
|
|
3
3
|
|
|
4
4
|
export type DataID = {
|
|
5
5
|
nodes?: ID[];
|
|
@@ -17,7 +17,7 @@ export type ElementData = NodeData[] | EdgeData[] | ComboData[];
|
|
|
17
17
|
* <zh/> 节点、边更新可选数据
|
|
18
18
|
*
|
|
19
19
|
* <en/> Node, edge update optional data
|
|
20
|
-
* @
|
|
20
|
+
* @remarks
|
|
21
21
|
* <zh/> 必须包含 id 字段,其他字段可选
|
|
22
22
|
*
|
|
23
23
|
* <en/> Must contain the id field, other fields are optional
|
|
@@ -28,7 +28,7 @@ export type PartialNodeLikeData<T extends NodeLikeData> = Partial<T> & Pick<T, '
|
|
|
28
28
|
* <zh/> 边更新可选数据
|
|
29
29
|
*
|
|
30
30
|
* <en/> Edge update optional data
|
|
31
|
-
* @
|
|
31
|
+
* @remarks
|
|
32
32
|
* <zh/> 包含两种情况:
|
|
33
33
|
* 1. 必须包含 source、target 字段,其他字段可选
|
|
34
34
|
* 2. 必须包含 id 字段,其他字段可选
|
package/src/types/id.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ID = string;
|
package/src/types/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ export type * from './element';
|
|
|
9
9
|
export type * from './enum';
|
|
10
10
|
export type * from './event';
|
|
11
11
|
export type * from './graphlib';
|
|
12
|
+
export type * from './id';
|
|
12
13
|
export type * from './node';
|
|
13
14
|
export type * from './padding';
|
|
14
15
|
export type * from './placement';
|
package/src/types/style.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ElementDatum } from './data';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* <zh/> 样式计算迭代上下文
|
|
@@ -7,6 +7,4 @@ import type { ElementData, ElementDatum } from './data';
|
|
|
7
7
|
*/
|
|
8
8
|
export type StyleIterationContext = {
|
|
9
9
|
datum: ElementDatum;
|
|
10
|
-
index: number;
|
|
11
|
-
elementData: ElementData;
|
|
12
10
|
};
|