@antv/g6 5.0.0-beta.32 → 5.0.0-beta.34
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/behaviors/brush-select.d.ts +103 -0
- package/dist/lib/behaviors/click-element.d.ts +77 -0
- package/dist/lib/behaviors/collapse-expand.d.ts +1 -2
- package/dist/lib/behaviors/create-edge.d.ts +1 -2
- package/dist/lib/behaviors/drag-element-force.d.ts +13 -0
- package/dist/lib/behaviors/drag-element.d.ts +12 -12
- package/dist/lib/behaviors/index.d.ts +8 -0
- package/dist/lib/behaviors/lasso-select.d.ts +19 -0
- package/dist/lib/behaviors/types.d.ts +1 -0
- package/dist/lib/constants/change.d.ts +1 -1
- package/dist/lib/constants/events/animation.d.ts +1 -4
- package/dist/lib/constants/events/graph.d.ts +9 -7
- package/dist/lib/constants/registry.d.ts +3 -1
- package/dist/lib/elements/combos/base-combo.d.ts +43 -6
- package/dist/lib/elements/combos/circle.d.ts +8 -12
- package/dist/lib/elements/combos/rect.d.ts +5 -9
- package/dist/lib/elements/edges/base-edge.d.ts +64 -10
- package/dist/lib/elements/edges/cubic-horizontal.d.ts +2 -2
- package/dist/lib/elements/edges/cubic-vertical.d.ts +2 -2
- package/dist/lib/elements/edges/cubic.d.ts +2 -2
- package/dist/lib/elements/edges/polyline.d.ts +2 -2
- package/dist/lib/elements/edges/quadratic.d.ts +2 -2
- package/dist/lib/elements/nodes/base-node.d.ts +104 -14
- package/dist/lib/elements/nodes/circle.d.ts +5 -8
- package/dist/lib/elements/nodes/diamond.d.ts +2 -4
- package/dist/lib/elements/nodes/donut.d.ts +45 -0
- package/dist/lib/elements/nodes/ellipse.d.ts +5 -8
- package/dist/lib/elements/nodes/hexagon.d.ts +6 -9
- package/dist/lib/elements/nodes/html.d.ts +27 -0
- package/dist/lib/elements/nodes/image.d.ts +9 -11
- package/dist/lib/elements/nodes/index.d.ts +4 -0
- package/dist/lib/elements/nodes/polygon.d.ts +9 -8
- package/dist/lib/elements/nodes/rect.d.ts +2 -3
- package/dist/lib/elements/nodes/star.d.ts +7 -10
- package/dist/lib/elements/nodes/triangle.d.ts +7 -10
- package/dist/lib/exports.d.ts +8 -5
- package/dist/lib/layouts/index.d.ts +1 -1
- package/dist/lib/layouts/types.d.ts +6 -6
- package/dist/lib/palettes/index.d.ts +1 -0
- package/dist/lib/plugins/history/events.d.ts +21 -0
- package/dist/lib/plugins/history/index.d.ts +82 -0
- package/dist/lib/plugins/history/utils.d.ts +31 -0
- package/dist/lib/plugins/hull/index.d.ts +58 -0
- package/dist/lib/plugins/hull/shape.d.ts +49 -0
- package/dist/lib/plugins/hull/util.d.ts +12 -0
- package/dist/lib/plugins/index.d.ts +4 -0
- package/dist/lib/registry/extension/index.d.ts +1 -1
- package/dist/lib/registry/types.d.ts +4 -0
- package/dist/lib/runtime/batch.d.ts +11 -0
- package/dist/lib/runtime/behavior.d.ts +1 -1
- package/dist/lib/runtime/canvas.d.ts +13 -3
- package/dist/lib/runtime/data.d.ts +8 -8
- package/dist/lib/runtime/element.d.ts +6 -22
- package/dist/lib/runtime/graph.d.ts +42 -5
- package/dist/lib/runtime/layout.d.ts +5 -11
- package/dist/lib/runtime/plugin.d.ts +1 -1
- package/dist/lib/runtime/transform.d.ts +11 -0
- package/dist/lib/runtime/types.d.ts +14 -0
- package/dist/lib/runtime/viewport.d.ts +1 -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/dist/lib/spec/index.d.ts +1 -0
- package/dist/lib/spec/spec.d.ts +7 -0
- package/dist/lib/spec/transform.d.ts +12 -0
- package/dist/lib/themes/base.d.ts +1 -0
- package/dist/lib/transforms/arrange-draw-order.d.ts +10 -0
- package/dist/lib/transforms/base-transform.d.ts +7 -0
- package/dist/lib/transforms/collapse-expand-combo.d.ts +10 -0
- package/dist/lib/transforms/index.d.ts +6 -0
- package/dist/lib/transforms/process-parallel-edges.d.ts +83 -0
- package/dist/lib/transforms/types.d.ts +20 -0
- package/dist/lib/transforms/update-related-edge.d.ts +9 -0
- package/dist/lib/types/callable.d.ts +2 -2
- package/dist/lib/types/canvas.d.ts +1 -1
- package/dist/lib/types/change.d.ts +27 -10
- package/dist/lib/types/data.d.ts +1 -1
- package/dist/lib/types/element.d.ts +6 -140
- package/dist/lib/types/id.d.ts +1 -0
- package/dist/lib/types/index.d.ts +1 -0
- package/dist/lib/types/node.d.ts +3 -3
- package/dist/lib/types/point.d.ts +1 -0
- package/dist/lib/types/style.d.ts +1 -3
- package/dist/lib/utils/animation.d.ts +2 -2
- package/dist/lib/utils/behaviors/brush.d.ts +18 -0
- package/dist/lib/utils/behaviors/lasso.d.ts +12 -0
- package/dist/lib/utils/behaviors/utils.d.ts +21 -0
- package/dist/lib/utils/change.d.ts +9 -1
- package/dist/lib/utils/combo.d.ts +5 -4
- package/dist/lib/utils/edge.d.ts +12 -2
- package/dist/lib/utils/event/events.d.ts +1 -1
- package/dist/lib/utils/extension.d.ts +1 -1
- package/dist/lib/utils/id.d.ts +4 -10
- package/dist/lib/utils/line.d.ts +21 -0
- package/dist/lib/utils/palette.d.ts +1 -2
- package/dist/lib/utils/path.d.ts +35 -0
- package/dist/lib/utils/point.d.ts +74 -20
- package/dist/lib/utils/polygon.d.ts +17 -0
- package/dist/lib/utils/position.d.ts +14 -1
- package/dist/lib/utils/prefix.d.ts +1 -1
- package/dist/lib/utils/relation.d.ts +1 -2
- package/dist/lib/utils/shortcut.d.ts +1 -0
- package/dist/lib/utils/vector.d.ts +3 -2
- package/esm/behaviors/brush-select.d.ts +103 -0
- package/esm/behaviors/brush-select.js +199 -0
- package/esm/behaviors/brush-select.js.map +1 -0
- package/esm/behaviors/click-element.d.ts +77 -0
- package/esm/behaviors/click-element.js +108 -0
- package/esm/behaviors/click-element.js.map +1 -0
- package/esm/behaviors/collapse-expand.d.ts +1 -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-element-force.d.ts +13 -0
- package/esm/behaviors/drag-element-force.js +55 -0
- package/esm/behaviors/drag-element-force.js.map +1 -0
- package/esm/behaviors/drag-element.d.ts +12 -12
- package/esm/behaviors/drag-element.js +17 -9
- package/esm/behaviors/drag-element.js.map +1 -1
- package/esm/behaviors/focus-element.js.map +1 -1
- package/esm/behaviors/hover-element.js +2 -2
- package/esm/behaviors/hover-element.js.map +1 -1
- package/esm/behaviors/index.d.ts +8 -0
- package/esm/behaviors/index.js +4 -0
- package/esm/behaviors/index.js.map +1 -1
- package/esm/behaviors/lasso-select.d.ts +19 -0
- package/esm/behaviors/lasso-select.js +79 -0
- package/esm/behaviors/lasso-select.js.map +1 -0
- package/esm/behaviors/types.d.ts +1 -0
- package/esm/constants/change.d.ts +1 -1
- package/esm/constants/change.js +12 -12
- package/esm/constants/change.js.map +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 +9 -7
- package/esm/constants/events/graph.js +8 -8
- package/esm/constants/events/graph.js.map +1 -1
- package/esm/constants/registry.d.ts +3 -1
- package/esm/constants/registry.js +2 -0
- package/esm/constants/registry.js.map +1 -1
- package/esm/elements/combos/base-combo.d.ts +43 -6
- package/esm/elements/combos/base-combo.js.map +1 -1
- package/esm/elements/combos/circle.d.ts +8 -12
- package/esm/elements/combos/circle.js.map +1 -1
- package/esm/elements/combos/rect.d.ts +5 -9
- package/esm/elements/combos/rect.js.map +1 -1
- package/esm/elements/edges/base-edge.d.ts +64 -10
- package/esm/elements/edges/base-edge.js.map +1 -1
- package/esm/elements/edges/cubic-horizontal.d.ts +2 -2
- package/esm/elements/edges/cubic-vertical.d.ts +2 -2
- package/esm/elements/edges/cubic.d.ts +2 -2
- package/esm/elements/edges/polyline.d.ts +2 -2
- package/esm/elements/edges/quadratic.d.ts +2 -2
- package/esm/elements/nodes/base-node.d.ts +104 -14
- package/esm/elements/nodes/base-node.js +4 -1
- package/esm/elements/nodes/base-node.js.map +1 -1
- package/esm/elements/nodes/circle.d.ts +5 -8
- package/esm/elements/nodes/circle.js.map +1 -1
- package/esm/elements/nodes/diamond.d.ts +2 -4
- package/esm/elements/nodes/diamond.js +2 -2
- package/esm/elements/nodes/diamond.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/ellipse.d.ts +5 -8
- package/esm/elements/nodes/ellipse.js +1 -1
- package/esm/elements/nodes/ellipse.js.map +1 -1
- package/esm/elements/nodes/hexagon.d.ts +6 -9
- package/esm/elements/nodes/hexagon.js.map +1 -1
- 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/image.d.ts +9 -11
- package/esm/elements/nodes/image.js.map +1 -1
- 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/nodes/polygon.d.ts +9 -8
- package/esm/elements/nodes/polygon.js +4 -1
- package/esm/elements/nodes/polygon.js.map +1 -1
- package/esm/elements/nodes/rect.d.ts +2 -3
- package/esm/elements/nodes/rect.js.map +1 -1
- package/esm/elements/nodes/star.d.ts +7 -10
- package/esm/elements/nodes/star.js.map +1 -1
- package/esm/elements/nodes/triangle.d.ts +7 -10
- package/esm/elements/nodes/triangle.js.map +1 -1
- package/esm/exports.d.ts +8 -5
- package/esm/exports.js +4 -2
- package/esm/exports.js.map +1 -1
- package/esm/layouts/index.d.ts +1 -1
- package/esm/layouts/index.js +1 -1
- package/esm/layouts/index.js.map +1 -1
- package/esm/layouts/types.d.ts +6 -6
- package/esm/palettes/index.d.ts +1 -0
- package/esm/palettes/index.js +12 -0
- package/esm/palettes/index.js.map +1 -1
- package/esm/plugins/history/events.d.ts +21 -0
- package/esm/plugins/history/events.js +16 -0
- package/esm/plugins/history/events.js.map +1 -0
- package/esm/plugins/history/index.d.ts +82 -0
- package/esm/plugins/history/index.js +168 -0
- package/esm/plugins/history/index.js.map +1 -0
- package/esm/plugins/history/utils.d.ts +31 -0
- package/esm/plugins/history/utils.js +79 -0
- package/esm/plugins/history/utils.js.map +1 -0
- package/esm/plugins/hull/index.d.ts +58 -0
- package/esm/plugins/hull/index.js +107 -0
- package/esm/plugins/hull/index.js.map +1 -0
- package/esm/plugins/hull/shape.d.ts +49 -0
- package/esm/plugins/hull/shape.js +35 -0
- package/esm/plugins/hull/shape.js.map +1 -0
- package/esm/plugins/hull/util.d.ts +12 -0
- package/esm/plugins/hull/util.js +203 -0
- package/esm/plugins/hull/util.js.map +1 -0
- 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 +3 -2
- package/esm/plugins/legend.js.map +1 -1
- package/esm/registry/build-in.js +24 -7
- package/esm/registry/build-in.js.map +1 -1
- package/esm/registry/extension/index.d.ts +1 -1
- package/esm/registry/index.js +1 -0
- package/esm/registry/index.js.map +1 -1
- package/esm/registry/types.d.ts +4 -0
- package/esm/runtime/batch.d.ts +11 -0
- package/esm/runtime/batch.js +31 -0
- package/esm/runtime/batch.js.map +1 -0
- package/esm/runtime/behavior.d.ts +1 -1
- package/esm/runtime/behavior.js.map +1 -1
- package/esm/runtime/canvas.d.ts +13 -3
- package/esm/runtime/canvas.js +40 -13
- package/esm/runtime/canvas.js.map +1 -1
- package/esm/runtime/data.d.ts +8 -8
- package/esm/runtime/data.js +23 -25
- package/esm/runtime/data.js.map +1 -1
- package/esm/runtime/element.d.ts +6 -22
- package/esm/runtime/element.js +73 -177
- package/esm/runtime/element.js.map +1 -1
- package/esm/runtime/graph.d.ts +42 -5
- package/esm/runtime/graph.js +68 -10
- package/esm/runtime/graph.js.map +1 -1
- package/esm/runtime/layout.d.ts +5 -11
- package/esm/runtime/layout.js +31 -77
- package/esm/runtime/layout.js.map +1 -1
- package/esm/runtime/plugin.d.ts +1 -1
- package/esm/runtime/plugin.js.map +1 -1
- package/esm/runtime/transform.d.ts +11 -0
- package/esm/runtime/transform.js +20 -0
- package/esm/runtime/transform.js.map +1 -0
- package/esm/runtime/types.d.ts +14 -0
- package/esm/runtime/viewport.d.ts +1 -2
- package/esm/runtime/viewport.js.map +1 -1
- 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/index.d.ts +1 -0
- package/esm/spec/spec.d.ts +7 -0
- package/esm/spec/transform.d.ts +12 -0
- package/esm/spec/transform.js +2 -0
- package/esm/spec/transform.js.map +1 -0
- package/esm/themes/base.d.ts +1 -0
- package/esm/themes/base.js +11 -1
- package/esm/themes/base.js.map +1 -1
- package/esm/transforms/arrange-draw-order.d.ts +10 -0
- package/esm/transforms/arrange-draw-order.js +27 -0
- package/esm/transforms/arrange-draw-order.js.map +1 -0
- package/esm/transforms/base-transform.d.ts +7 -0
- package/esm/transforms/base-transform.js +7 -0
- package/esm/transforms/base-transform.js.map +1 -0
- package/esm/transforms/collapse-expand-combo.d.ts +10 -0
- package/esm/transforms/collapse-expand-combo.js +82 -0
- package/esm/transforms/collapse-expand-combo.js.map +1 -0
- package/esm/transforms/index.d.ts +6 -0
- package/esm/transforms/index.js +6 -0
- package/esm/transforms/index.js.map +1 -0
- package/esm/transforms/process-parallel-edges.d.ts +83 -0
- package/esm/transforms/process-parallel-edges.js +213 -0
- package/esm/transforms/process-parallel-edges.js.map +1 -0
- package/esm/transforms/types.d.ts +20 -0
- package/esm/transforms/types.js +11 -0
- package/esm/transforms/types.js.map +1 -0
- package/esm/transforms/update-related-edge.d.ts +9 -0
- package/esm/transforms/update-related-edge.js +20 -0
- package/esm/transforms/update-related-edge.js.map +1 -0
- package/esm/types/callable.d.ts +2 -2
- package/esm/types/canvas.d.ts +1 -1
- package/esm/types/change.d.ts +27 -10
- package/esm/types/data.d.ts +1 -1
- package/esm/types/element.d.ts +6 -140
- 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/node.d.ts +3 -3
- package/esm/types/point.d.ts +1 -0
- package/esm/types/style.d.ts +1 -3
- package/esm/utils/animation.d.ts +2 -2
- package/esm/utils/animation.js +7 -1
- package/esm/utils/animation.js.map +1 -1
- package/esm/utils/behaviors/brush.d.ts +18 -0
- package/esm/utils/behaviors/brush.js +25 -0
- package/esm/utils/behaviors/brush.js.map +1 -0
- package/esm/utils/behaviors/lasso.d.ts +12 -0
- package/esm/utils/behaviors/lasso.js +112 -0
- package/esm/utils/behaviors/lasso.js.map +1 -0
- package/esm/utils/behaviors/utils.d.ts +21 -0
- package/esm/utils/behaviors/utils.js +42 -0
- package/esm/utils/behaviors/utils.js.map +1 -0
- package/esm/utils/change.d.ts +9 -1
- package/esm/utils/change.js +28 -0
- package/esm/utils/change.js.map +1 -1
- package/esm/utils/combo.d.ts +5 -4
- package/esm/utils/combo.js.map +1 -1
- package/esm/utils/edge.d.ts +12 -2
- package/esm/utils/edge.js +1 -1
- package/esm/utils/edge.js.map +1 -1
- package/esm/utils/event/events.d.ts +1 -1
- package/esm/utils/event/events.js.map +1 -1
- package/esm/utils/extension.d.ts +1 -1
- package/esm/utils/extension.js.map +1 -1
- package/esm/utils/id.d.ts +4 -10
- package/esm/utils/id.js +8 -2
- package/esm/utils/id.js.map +1 -1
- package/esm/utils/line.d.ts +21 -0
- package/esm/utils/line.js +41 -0
- package/esm/utils/line.js.map +1 -0
- package/esm/utils/palette.d.ts +1 -2
- package/esm/utils/palette.js.map +1 -1
- package/esm/utils/path.d.ts +35 -0
- package/esm/utils/path.js +143 -0
- package/esm/utils/path.js.map +1 -0
- package/esm/utils/point.d.ts +74 -20
- package/esm/utils/point.js +168 -44
- package/esm/utils/point.js.map +1 -1
- package/esm/utils/polygon.d.ts +17 -0
- package/esm/utils/polygon.js +62 -0
- package/esm/utils/polygon.js.map +1 -0
- package/esm/utils/position.d.ts +14 -1
- package/esm/utils/position.js +16 -0
- package/esm/utils/position.js.map +1 -1
- package/esm/utils/prefix.d.ts +1 -1
- package/esm/utils/prefix.js.map +1 -1
- package/esm/utils/relation.d.ts +1 -2
- package/esm/utils/relation.js.map +1 -1
- package/esm/utils/shortcut.d.ts +1 -0
- package/esm/utils/shortcut.js +13 -2
- package/esm/utils/shortcut.js.map +1 -1
- package/esm/utils/style.js +3 -3
- package/esm/utils/style.js.map +1 -1
- package/esm/utils/vector.d.ts +3 -2
- package/esm/utils/vector.js +10 -3
- package/esm/utils/vector.js.map +1 -1
- package/lib/behaviors/brush-select.d.ts +103 -0
- package/lib/behaviors/brush-select.js +203 -0
- package/lib/behaviors/brush-select.js.map +1 -0
- package/lib/behaviors/click-element.d.ts +77 -0
- package/lib/behaviors/click-element.js +112 -0
- package/lib/behaviors/click-element.js.map +1 -0
- package/lib/behaviors/collapse-expand.d.ts +1 -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-element-force.d.ts +13 -0
- package/lib/behaviors/drag-element-force.js +59 -0
- package/lib/behaviors/drag-element-force.js.map +1 -0
- package/lib/behaviors/drag-element.d.ts +12 -12
- package/lib/behaviors/drag-element.js +17 -9
- package/lib/behaviors/drag-element.js.map +1 -1
- package/lib/behaviors/focus-element.js.map +1 -1
- package/lib/behaviors/hover-element.js +1 -1
- package/lib/behaviors/hover-element.js.map +1 -1
- package/lib/behaviors/index.d.ts +8 -0
- package/lib/behaviors/index.js +9 -1
- package/lib/behaviors/index.js.map +1 -1
- package/lib/behaviors/lasso-select.d.ts +19 -0
- package/lib/behaviors/lasso-select.js +83 -0
- package/lib/behaviors/lasso-select.js.map +1 -0
- package/lib/behaviors/types.d.ts +1 -0
- package/lib/constants/change.d.ts +1 -1
- package/lib/constants/change.js +13 -13
- package/lib/constants/change.js.map +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 +9 -7
- package/lib/constants/events/graph.js +9 -9
- package/lib/constants/events/graph.js.map +1 -1
- package/lib/constants/registry.d.ts +3 -1
- package/lib/constants/registry.js +2 -0
- package/lib/constants/registry.js.map +1 -1
- package/lib/elements/combos/base-combo.d.ts +43 -6
- package/lib/elements/combos/base-combo.js.map +1 -1
- package/lib/elements/combos/circle.d.ts +8 -12
- package/lib/elements/combos/circle.js.map +1 -1
- package/lib/elements/combos/rect.d.ts +5 -9
- package/lib/elements/combos/rect.js.map +1 -1
- package/lib/elements/edges/base-edge.d.ts +64 -10
- package/lib/elements/edges/base-edge.js.map +1 -1
- package/lib/elements/edges/cubic-horizontal.d.ts +2 -2
- package/lib/elements/edges/cubic-vertical.d.ts +2 -2
- package/lib/elements/edges/cubic.d.ts +2 -2
- package/lib/elements/edges/polyline.d.ts +2 -2
- package/lib/elements/edges/quadratic.d.ts +2 -2
- package/lib/elements/nodes/base-node.d.ts +104 -14
- package/lib/elements/nodes/base-node.js +4 -1
- package/lib/elements/nodes/base-node.js.map +1 -1
- package/lib/elements/nodes/circle.d.ts +5 -8
- package/lib/elements/nodes/circle.js.map +1 -1
- package/lib/elements/nodes/diamond.d.ts +2 -4
- package/lib/elements/nodes/diamond.js +2 -2
- package/lib/elements/nodes/diamond.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/ellipse.d.ts +5 -8
- package/lib/elements/nodes/ellipse.js +1 -1
- package/lib/elements/nodes/ellipse.js.map +1 -1
- package/lib/elements/nodes/hexagon.d.ts +6 -9
- package/lib/elements/nodes/hexagon.js.map +1 -1
- 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/image.d.ts +9 -11
- package/lib/elements/nodes/image.js.map +1 -1
- 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/nodes/polygon.d.ts +9 -8
- package/lib/elements/nodes/polygon.js +4 -1
- package/lib/elements/nodes/polygon.js.map +1 -1
- package/lib/elements/nodes/rect.d.ts +2 -3
- package/lib/elements/nodes/rect.js.map +1 -1
- package/lib/elements/nodes/star.d.ts +7 -10
- package/lib/elements/nodes/star.js.map +1 -1
- package/lib/elements/nodes/triangle.d.ts +7 -10
- package/lib/elements/nodes/triangle.js.map +1 -1
- package/lib/exports.d.ts +8 -5
- package/lib/exports.js +8 -1
- package/lib/exports.js.map +1 -1
- package/lib/layouts/index.d.ts +1 -1
- package/lib/layouts/index.js +2 -1
- package/lib/layouts/index.js.map +1 -1
- package/lib/layouts/types.d.ts +6 -6
- package/lib/palettes/index.d.ts +1 -0
- package/lib/palettes/index.js +13 -1
- package/lib/palettes/index.js.map +1 -1
- package/lib/plugins/history/events.d.ts +21 -0
- package/lib/plugins/history/events.js +19 -0
- package/lib/plugins/history/events.js.map +1 -0
- package/lib/plugins/history/index.d.ts +82 -0
- package/lib/plugins/history/index.js +175 -0
- package/lib/plugins/history/index.js.map +1 -0
- package/lib/plugins/history/utils.d.ts +31 -0
- package/lib/plugins/history/utils.js +84 -0
- package/lib/plugins/history/utils.js.map +1 -0
- package/lib/plugins/hull/index.d.ts +58 -0
- package/lib/plugins/hull/index.js +114 -0
- package/lib/plugins/hull/index.js.map +1 -0
- package/lib/plugins/hull/shape.d.ts +49 -0
- package/lib/plugins/hull/shape.js +39 -0
- package/lib/plugins/hull/shape.js.map +1 -0
- package/lib/plugins/hull/util.d.ts +12 -0
- package/lib/plugins/hull/util.js +207 -0
- package/lib/plugins/hull/util.js.map +1 -0
- 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 +3 -2
- package/lib/plugins/legend.js.map +1 -1
- package/lib/registry/build-in.js +19 -2
- package/lib/registry/build-in.js.map +1 -1
- package/lib/registry/extension/index.d.ts +1 -1
- package/lib/registry/index.js +1 -0
- package/lib/registry/index.js.map +1 -1
- package/lib/registry/types.d.ts +4 -0
- package/lib/runtime/batch.d.ts +11 -0
- package/lib/runtime/batch.js +35 -0
- package/lib/runtime/batch.js.map +1 -0
- package/lib/runtime/behavior.d.ts +1 -1
- package/lib/runtime/behavior.js.map +1 -1
- package/lib/runtime/canvas.d.ts +13 -3
- package/lib/runtime/canvas.js +38 -11
- package/lib/runtime/canvas.js.map +1 -1
- package/lib/runtime/data.d.ts +8 -8
- package/lib/runtime/data.js +22 -24
- package/lib/runtime/data.js.map +1 -1
- package/lib/runtime/element.d.ts +6 -22
- package/lib/runtime/element.js +72 -176
- package/lib/runtime/element.js.map +1 -1
- package/lib/runtime/graph.d.ts +42 -5
- package/lib/runtime/graph.js +67 -9
- package/lib/runtime/graph.js.map +1 -1
- package/lib/runtime/layout.d.ts +5 -11
- package/lib/runtime/layout.js +29 -75
- package/lib/runtime/layout.js.map +1 -1
- package/lib/runtime/plugin.d.ts +1 -1
- package/lib/runtime/plugin.js.map +1 -1
- package/lib/runtime/transform.d.ts +11 -0
- package/lib/runtime/transform.js +24 -0
- package/lib/runtime/transform.js.map +1 -0
- package/lib/runtime/types.d.ts +14 -0
- package/lib/runtime/viewport.d.ts +1 -2
- package/lib/runtime/viewport.js.map +1 -1
- 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/lib/spec/index.d.ts +1 -0
- package/lib/spec/spec.d.ts +7 -0
- package/lib/spec/transform.d.ts +12 -0
- package/lib/spec/transform.js +3 -0
- package/lib/spec/transform.js.map +1 -0
- package/lib/themes/base.d.ts +1 -0
- package/lib/themes/base.js +11 -1
- package/lib/themes/base.js.map +1 -1
- package/lib/transforms/arrange-draw-order.d.ts +10 -0
- package/lib/transforms/arrange-draw-order.js +31 -0
- package/lib/transforms/arrange-draw-order.js.map +1 -0
- package/lib/transforms/base-transform.d.ts +7 -0
- package/lib/transforms/base-transform.js +11 -0
- package/lib/transforms/base-transform.js.map +1 -0
- package/lib/transforms/collapse-expand-combo.d.ts +10 -0
- package/lib/transforms/collapse-expand-combo.js +86 -0
- package/lib/transforms/collapse-expand-combo.js.map +1 -0
- package/lib/transforms/index.d.ts +6 -0
- package/lib/transforms/index.js +14 -0
- package/lib/transforms/index.js.map +1 -0
- package/lib/transforms/process-parallel-edges.d.ts +83 -0
- package/lib/transforms/process-parallel-edges.js +220 -0
- package/lib/transforms/process-parallel-edges.js.map +1 -0
- package/lib/transforms/types.d.ts +20 -0
- package/lib/transforms/types.js +15 -0
- package/lib/transforms/types.js.map +1 -0
- package/lib/transforms/update-related-edge.d.ts +9 -0
- package/lib/transforms/update-related-edge.js +24 -0
- package/lib/transforms/update-related-edge.js.map +1 -0
- package/lib/types/callable.d.ts +2 -2
- package/lib/types/canvas.d.ts +1 -1
- package/lib/types/change.d.ts +27 -10
- package/lib/types/data.d.ts +1 -1
- package/lib/types/element.d.ts +6 -140
- 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/node.d.ts +3 -3
- package/lib/types/point.d.ts +1 -0
- package/lib/types/style.d.ts +1 -3
- package/lib/utils/animation.d.ts +2 -2
- package/lib/utils/animation.js +7 -1
- package/lib/utils/animation.js.map +1 -1
- package/lib/utils/behaviors/brush.d.ts +18 -0
- package/lib/utils/behaviors/brush.js +30 -0
- package/lib/utils/behaviors/brush.js.map +1 -0
- package/lib/utils/behaviors/lasso.d.ts +12 -0
- package/lib/utils/behaviors/lasso.js +116 -0
- package/lib/utils/behaviors/lasso.js.map +1 -0
- package/lib/utils/behaviors/utils.d.ts +21 -0
- package/lib/utils/behaviors/utils.js +47 -0
- package/lib/utils/behaviors/utils.js.map +1 -0
- package/lib/utils/change.d.ts +9 -1
- package/lib/utils/change.js +30 -1
- package/lib/utils/change.js.map +1 -1
- package/lib/utils/combo.d.ts +5 -4
- package/lib/utils/combo.js.map +1 -1
- package/lib/utils/edge.d.ts +12 -2
- package/lib/utils/edge.js +2 -1
- package/lib/utils/edge.js.map +1 -1
- package/lib/utils/event/events.d.ts +1 -1
- package/lib/utils/event/events.js.map +1 -1
- package/lib/utils/extension.d.ts +1 -1
- package/lib/utils/extension.js.map +1 -1
- package/lib/utils/id.d.ts +4 -10
- package/lib/utils/id.js +10 -4
- package/lib/utils/id.js.map +1 -1
- package/lib/utils/line.d.ts +21 -0
- package/lib/utils/line.js +46 -0
- package/lib/utils/line.js.map +1 -0
- package/lib/utils/palette.d.ts +1 -2
- package/lib/utils/palette.js.map +1 -1
- package/lib/utils/path.d.ts +35 -0
- package/lib/utils/path.js +150 -0
- package/lib/utils/path.js.map +1 -0
- package/lib/utils/point.d.ts +74 -20
- package/lib/utils/point.js +178 -48
- package/lib/utils/point.js.map +1 -1
- package/lib/utils/polygon.d.ts +17 -0
- package/lib/utils/polygon.js +66 -0
- package/lib/utils/polygon.js.map +1 -0
- package/lib/utils/position.d.ts +14 -1
- package/lib/utils/position.js +18 -1
- package/lib/utils/position.js.map +1 -1
- package/lib/utils/prefix.d.ts +1 -1
- package/lib/utils/prefix.js.map +1 -1
- package/lib/utils/relation.d.ts +1 -2
- package/lib/utils/relation.js.map +1 -1
- package/lib/utils/shortcut.d.ts +1 -0
- package/lib/utils/shortcut.js +12 -1
- package/lib/utils/shortcut.js.map +1 -1
- package/lib/utils/style.js +3 -3
- package/lib/utils/style.js.map +1 -1
- package/lib/utils/vector.d.ts +3 -2
- package/lib/utils/vector.js +10 -3
- package/lib/utils/vector.js.map +1 -1
- package/package.json +5 -6
- package/src/behaviors/brush-select.ts +305 -0
- package/src/behaviors/click-element.ts +181 -0
- package/src/behaviors/collapse-expand.ts +1 -2
- package/src/behaviors/create-edge.ts +1 -2
- package/src/behaviors/drag-element-force.ts +69 -0
- package/src/behaviors/drag-element.ts +27 -18
- package/src/behaviors/focus-element.ts +1 -2
- package/src/behaviors/hover-element.ts +3 -5
- package/src/behaviors/index.ts +8 -0
- package/src/behaviors/lasso-select.ts +102 -0
- package/src/behaviors/types.ts +2 -0
- package/src/constants/change.ts +1 -1
- package/src/constants/events/animation.ts +0 -4
- package/src/constants/events/graph.ts +8 -8
- package/src/constants/registry.ts +2 -0
- package/src/elements/combos/base-combo.ts +59 -10
- package/src/elements/combos/circle.ts +8 -11
- package/src/elements/combos/rect.ts +5 -8
- package/src/elements/edges/base-edge.ts +70 -13
- package/src/elements/edges/cubic-horizontal.ts +2 -2
- package/src/elements/edges/cubic-vertical.ts +2 -2
- package/src/elements/edges/cubic.ts +2 -2
- package/src/elements/edges/polyline.ts +2 -2
- package/src/elements/edges/quadratic.ts +2 -2
- package/src/elements/nodes/base-node.ts +117 -21
- package/src/elements/nodes/circle.ts +5 -7
- package/src/elements/nodes/diamond.ts +4 -6
- package/src/elements/nodes/donut.ts +137 -0
- package/src/elements/nodes/ellipse.ts +6 -8
- package/src/elements/nodes/hexagon.ts +7 -9
- package/src/elements/nodes/html.ts +230 -0
- package/src/elements/nodes/image.ts +12 -13
- package/src/elements/nodes/index.ts +4 -0
- package/src/elements/nodes/polygon.ts +17 -11
- package/src/elements/nodes/rect.ts +3 -4
- package/src/elements/nodes/star.ts +9 -11
- package/src/elements/nodes/triangle.ts +7 -9
- package/src/exports.ts +24 -3
- package/src/layouts/index.ts +1 -0
- package/src/layouts/types.ts +7 -5
- package/src/palettes/index.ts +13 -0
- package/src/plugins/history/events.ts +25 -0
- package/src/plugins/history/index.ts +222 -0
- package/src/plugins/history/utils.ts +98 -0
- package/src/plugins/hull/index.ts +148 -0
- package/src/plugins/hull/shape.ts +96 -0
- package/src/plugins/hull/util.ts +222 -0
- package/src/plugins/index.ts +4 -0
- package/src/plugins/legend.ts +5 -5
- package/src/registry/build-in.ts +28 -4
- package/src/registry/extension/index.ts +1 -1
- package/src/registry/index.ts +1 -0
- package/src/registry/types.ts +2 -0
- package/src/runtime/batch.ts +38 -0
- package/src/runtime/behavior.ts +1 -1
- package/src/runtime/canvas.ts +55 -14
- package/src/runtime/data.ts +33 -37
- package/src/runtime/element.ts +90 -203
- package/src/runtime/graph.ts +78 -13
- package/src/runtime/layout.ts +50 -81
- package/src/runtime/plugin.ts +1 -1
- package/src/runtime/transform.ts +27 -0
- package/src/runtime/types.ts +14 -0
- package/src/runtime/viewport.ts +1 -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/index.ts +1 -0
- package/src/spec/spec.ts +7 -0
- package/src/spec/transform.ts +15 -0
- package/src/themes/base.ts +12 -1
- package/src/transforms/arrange-draw-order.ts +36 -0
- package/src/transforms/base-transform.ts +11 -0
- package/src/transforms/collapse-expand-combo.ts +87 -0
- package/src/transforms/index.ts +7 -0
- package/src/transforms/process-parallel-edges.ts +284 -0
- package/src/transforms/types.ts +23 -0
- package/src/transforms/update-related-edge.ts +27 -0
- package/src/types/callable.ts +2 -2
- package/src/types/canvas.ts +1 -1
- package/src/types/change.ts +28 -10
- package/src/types/data.ts +1 -1
- package/src/types/element.ts +6 -147
- package/src/types/id.ts +1 -0
- package/src/types/index.ts +1 -0
- package/src/types/node.ts +3 -3
- package/src/types/point.ts +1 -0
- package/src/types/style.ts +1 -3
- package/src/utils/animation.ts +8 -2
- package/src/utils/behaviors/brush.ts +28 -0
- package/src/utils/behaviors/lasso.ts +126 -0
- package/src/utils/behaviors/utils.ts +47 -0
- package/src/utils/change.ts +42 -2
- package/src/utils/combo.ts +6 -5
- package/src/utils/edge.ts +7 -2
- package/src/utils/event/events.ts +3 -1
- package/src/utils/extension.ts +1 -1
- package/src/utils/id.ts +11 -3
- package/src/utils/line.ts +50 -0
- package/src/utils/palette.ts +1 -1
- package/src/utils/path.ts +153 -0
- package/src/utils/point.ts +190 -51
- package/src/utils/polygon.ts +72 -0
- package/src/utils/position.ts +18 -1
- package/src/utils/prefix.ts +1 -1
- package/src/utils/relation.ts +1 -2
- package/src/utils/shortcut.ts +13 -2
- package/src/utils/style.ts +4 -4
- package/src/utils/vector.ts +10 -3
- package/dist/lib/runtime/index.d.ts +0 -6
- package/dist/lib/spec/element/base.d.ts +0 -6
- package/esm/elements/types.d.ts +0 -0
- package/esm/elements/types.js +0 -15
- package/esm/elements/types.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/lib/elements/types.d.ts +0 -0
- package/lib/elements/types.js +0 -15
- package/lib/elements/types.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/src/elements/types.ts +0 -21
- package/src/runtime/index.ts +0 -7
- package/src/spec/element/base.ts +0 -6
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { BaseStyleProps } from '@antv/g';
|
|
2
2
|
import { Rect } from '@antv/g';
|
|
3
|
-
import { ID } from '@antv/graphlib';
|
|
4
3
|
import { isFunction } from '@antv/util';
|
|
5
4
|
import { COMBO_KEY, CommonEvent } from '../constants';
|
|
6
|
-
import { RuntimeContext } from '../runtime/types';
|
|
7
|
-
import type { EdgeDirection, Element, IDragEvent, Point, PrefixObject } from '../types';
|
|
5
|
+
import type { RuntimeContext } from '../runtime/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';
|
|
@@ -96,11 +95,11 @@ export class DragElement extends BaseBehavior<DragElementOptions> {
|
|
|
96
95
|
shadowLineDash: [5, 5],
|
|
97
96
|
};
|
|
98
97
|
|
|
99
|
-
|
|
98
|
+
protected enable: boolean = false;
|
|
100
99
|
|
|
101
100
|
private enableElements = ['node', 'combo'];
|
|
102
101
|
|
|
103
|
-
|
|
102
|
+
protected target: ID[] = [];
|
|
104
103
|
|
|
105
104
|
private shadow?: Rect;
|
|
106
105
|
|
|
@@ -115,6 +114,11 @@ export class DragElement extends BaseBehavior<DragElementOptions> {
|
|
|
115
114
|
|
|
116
115
|
constructor(context: RuntimeContext, options: DragElementOptions) {
|
|
117
116
|
super(context, Object.assign({}, DragElement.defaultOptions, options));
|
|
117
|
+
this.onDragStart = this.onDragStart.bind(this);
|
|
118
|
+
this.onDrag = this.onDrag.bind(this);
|
|
119
|
+
this.onDragEnd = this.onDragEnd.bind(this);
|
|
120
|
+
this.onDrop = this.onDrop.bind(this);
|
|
121
|
+
|
|
118
122
|
this.bindEvents();
|
|
119
123
|
}
|
|
120
124
|
|
|
@@ -139,7 +143,7 @@ export class DragElement extends BaseBehavior<DragElementOptions> {
|
|
|
139
143
|
}
|
|
140
144
|
}
|
|
141
145
|
|
|
142
|
-
|
|
146
|
+
protected getSelectedNodeIDs(currTarget: ID[]) {
|
|
143
147
|
return Array.from(
|
|
144
148
|
new Set(
|
|
145
149
|
this.context.graph
|
|
@@ -150,27 +154,31 @@ export class DragElement extends BaseBehavior<DragElementOptions> {
|
|
|
150
154
|
);
|
|
151
155
|
}
|
|
152
156
|
|
|
153
|
-
|
|
157
|
+
protected getDelta(event: IElementDragEvent) {
|
|
158
|
+
const zoom = this.context.graph.getZoom();
|
|
159
|
+
return divide([event.dx, event.dy], zoom);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
protected onDragStart(event: IElementDragEvent) {
|
|
154
163
|
this.enable = this.validate(event);
|
|
155
164
|
if (!this.enable) return;
|
|
156
165
|
|
|
166
|
+
this.context.batch?.startBatch();
|
|
157
167
|
this.target = this.getSelectedNodeIDs([event.target.id]);
|
|
158
168
|
this.hideEdge();
|
|
159
169
|
this.context.graph.frontElement(this.target);
|
|
160
170
|
if (this.options.shadow) this.createShadow(this.target);
|
|
161
|
-
}
|
|
171
|
+
}
|
|
162
172
|
|
|
163
|
-
|
|
173
|
+
protected onDrag(event: IElementDragEvent) {
|
|
164
174
|
if (!this.enable) return;
|
|
165
|
-
const
|
|
166
|
-
const { dx, dy } = event;
|
|
167
|
-
const delta = divide([dx, dy], zoom);
|
|
175
|
+
const delta = this.getDelta(event);
|
|
168
176
|
|
|
169
177
|
if (this.options.shadow) this.moveShadow(delta);
|
|
170
178
|
else this.moveElement(this.target, delta);
|
|
171
|
-
}
|
|
179
|
+
}
|
|
172
180
|
|
|
173
|
-
|
|
181
|
+
protected onDragEnd() {
|
|
174
182
|
this.enable = false;
|
|
175
183
|
if (this.options.shadow) {
|
|
176
184
|
if (!this.shadow) return;
|
|
@@ -181,8 +189,9 @@ export class DragElement extends BaseBehavior<DragElementOptions> {
|
|
|
181
189
|
}
|
|
182
190
|
this.showEdges();
|
|
183
191
|
this.options.onFinish?.(this.target);
|
|
192
|
+
this.context.batch?.endBatch();
|
|
184
193
|
this.target = [];
|
|
185
|
-
}
|
|
194
|
+
}
|
|
186
195
|
|
|
187
196
|
private onDrop = async (event: IElementDragEvent) => {
|
|
188
197
|
if (this.options.dropEffect !== 'link') return;
|
|
@@ -200,14 +209,14 @@ export class DragElement extends BaseBehavior<DragElementOptions> {
|
|
|
200
209
|
await element?.draw({ animation: true });
|
|
201
210
|
};
|
|
202
211
|
|
|
203
|
-
|
|
212
|
+
protected validate(event: IElementDragEvent) {
|
|
204
213
|
if (this.destroyed) return false;
|
|
205
214
|
const { enable } = this.options;
|
|
206
215
|
if (isFunction(enable)) return enable(event);
|
|
207
216
|
return !!enable;
|
|
208
217
|
}
|
|
209
218
|
|
|
210
|
-
|
|
219
|
+
protected async moveElement(ids: ID[], offset: Point) {
|
|
211
220
|
const { model, element } = this.context;
|
|
212
221
|
const { dropEffect } = this.options;
|
|
213
222
|
ids.forEach((id) => {
|
|
@@ -262,7 +271,7 @@ export class DragElement extends BaseBehavior<DragElementOptions> {
|
|
|
262
271
|
this.hiddenEdges = [];
|
|
263
272
|
}
|
|
264
273
|
|
|
265
|
-
|
|
274
|
+
protected hideEdge() {
|
|
266
275
|
const { hideEdge, shadow } = this.options;
|
|
267
276
|
if (hideEdge === 'none' || shadow) return;
|
|
268
277
|
const { graph } = this.context;
|
|
@@ -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,10 +1,9 @@
|
|
|
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';
|
|
7
|
-
import {
|
|
5
|
+
import type { Element, ElementType, ID, IPointerEvent, State } from '../types';
|
|
6
|
+
import { idsOf } from '../utils/id';
|
|
8
7
|
import { getElementNthDegreeIds } from '../utils/relation';
|
|
9
8
|
import type { BaseBehaviorOptions } from './base-behavior';
|
|
10
9
|
import { BaseBehavior } from './base-behavior';
|
|
@@ -110,10 +109,9 @@ export class HoverElement extends BaseBehavior<HoverElementOptions> {
|
|
|
110
109
|
}
|
|
111
110
|
|
|
112
111
|
if (this.options.inactiveState) {
|
|
113
|
-
const inactiveIds =
|
|
112
|
+
const inactiveIds = idsOf(graph.getData(), true).filter((id) => !activeIds.includes(id));
|
|
114
113
|
Object.assign(states, this.getElementsState(inactiveIds, this.options.inactiveState, add));
|
|
115
114
|
}
|
|
116
|
-
|
|
117
115
|
graph.setElementState(states, this.options.animation);
|
|
118
116
|
};
|
|
119
117
|
|
package/src/behaviors/index.ts
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
export { BaseBehavior } from './base-behavior';
|
|
2
|
+
export { BrushSelect } from './brush-select';
|
|
3
|
+
export { ClickElement } from './click-element';
|
|
2
4
|
export { CollapseExpand } from './collapse-expand';
|
|
3
5
|
export { CreateEdge } from './create-edge';
|
|
4
6
|
export { DragCanvas } from './drag-canvas';
|
|
5
7
|
export { DragElement } from './drag-element';
|
|
8
|
+
export { DragElementForce } from './drag-element-force';
|
|
6
9
|
export { FocusElement } from './focus-element';
|
|
7
10
|
export { HoverElement } from './hover-element';
|
|
11
|
+
export { LassoSelect } from './lasso-select';
|
|
8
12
|
export { ZoomCanvas } from './zoom-canvas';
|
|
9
13
|
|
|
10
14
|
export type { BaseBehaviorOptions } from './base-behavior';
|
|
15
|
+
export type { BrushSelectOptions } from './brush-select';
|
|
16
|
+
export type { ClickElementOptions } from './click-element';
|
|
11
17
|
export type { CollapseExpandOptions } from './collapse-expand';
|
|
12
18
|
export type { CreateEdgeOptions } from './create-edge';
|
|
13
19
|
export type { DragCanvasOptions } from './drag-canvas';
|
|
14
20
|
export type { DragElementOptions } from './drag-element';
|
|
21
|
+
export type { DragElementForceOptions } from './drag-element-force';
|
|
15
22
|
export type { FocusElementOptions } from './focus-element';
|
|
16
23
|
export type { HoverElementOptions } from './hover-element';
|
|
24
|
+
export type { LassoSelectOptions } from './lasso-select';
|
|
17
25
|
export type { ZoomCanvasOptions } from './zoom-canvas';
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Path } from '@antv/g';
|
|
2
|
+
import { isBBoxIntersectPolygon } from '../utils/behaviors/lasso';
|
|
3
|
+
import { getAllElementState } from '../utils/behaviors/utils';
|
|
4
|
+
import { pointsToPath } from '../utils/path';
|
|
5
|
+
import { BrushSelect, DEFAULT_STYLE } from './brush-select';
|
|
6
|
+
|
|
7
|
+
import type { RuntimeContext } from '../runtime/types';
|
|
8
|
+
import type { ID, IPointerEvent, Points, State } from '../types';
|
|
9
|
+
import type { BrushSelectOptions } from './brush-select';
|
|
10
|
+
|
|
11
|
+
const SHOW_PATH_ID = 'g6-lasso-select-path-id';
|
|
12
|
+
|
|
13
|
+
export type States = Record<ID, State | State[]>;
|
|
14
|
+
|
|
15
|
+
export type LassoSelectOptions = BrushSelectOptions;
|
|
16
|
+
|
|
17
|
+
export class LassoSelect extends BrushSelect<LassoSelectOptions> {
|
|
18
|
+
static defaultOptions: Partial<LassoSelectOptions> = {
|
|
19
|
+
...BrushSelect.defaultOptions,
|
|
20
|
+
style: DEFAULT_STYLE,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
private points?: Points;
|
|
24
|
+
private pathShape?: Path;
|
|
25
|
+
|
|
26
|
+
public selectElementFn = isBBoxIntersectPolygon;
|
|
27
|
+
|
|
28
|
+
constructor(context: RuntimeContext, options: LassoSelectOptions) {
|
|
29
|
+
super(context, Object.assign({}, LassoSelect.defaultOptions, options));
|
|
30
|
+
this.bindEvents();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public pointerDown = async (event: IPointerEvent) => {
|
|
34
|
+
if (!this.validate(event) || !this.isKeydown() || this.points) return;
|
|
35
|
+
const { style, trigger } = this.options;
|
|
36
|
+
const triggers = (Array.isArray(trigger) ? trigger : [trigger]) as string[];
|
|
37
|
+
if (event.targetType !== 'canvas' && triggers.includes('drag')) return;
|
|
38
|
+
|
|
39
|
+
const { canvas } = this.context;
|
|
40
|
+
|
|
41
|
+
this.pathShape = new Path({
|
|
42
|
+
id: SHOW_PATH_ID,
|
|
43
|
+
style: {
|
|
44
|
+
...LassoSelect.defaultOptions.style,
|
|
45
|
+
fill: style.color || DEFAULT_STYLE.color,
|
|
46
|
+
...style,
|
|
47
|
+
pointerEvents: 'none',
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
canvas.appendChild(this.pathShape);
|
|
52
|
+
|
|
53
|
+
this.points = [[event.canvas.x, event.canvas.y]];
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
public pointerMove = async (event: IPointerEvent) => {
|
|
57
|
+
if (!this.points) return;
|
|
58
|
+
const { immediately, mode } = this.options;
|
|
59
|
+
const { element } = this.context;
|
|
60
|
+
|
|
61
|
+
this.points.push([event.canvas.x, event.canvas.y]);
|
|
62
|
+
|
|
63
|
+
this.pathShape?.setAttribute('path', pointsToPath(this.points));
|
|
64
|
+
|
|
65
|
+
if (immediately && mode === 'default') {
|
|
66
|
+
this.lassoUpdateElementState();
|
|
67
|
+
}
|
|
68
|
+
await element?.draw({ animation: false, silence: true });
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
public pointerUp = async () => {
|
|
72
|
+
if (!this.points) return;
|
|
73
|
+
if (this.points.length < 2) {
|
|
74
|
+
await this.clearLasso();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
this.lassoUpdateElementState();
|
|
79
|
+
|
|
80
|
+
await this.clearLasso();
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
public clearSelected = () => {
|
|
84
|
+
if (this.points) return;
|
|
85
|
+
|
|
86
|
+
const { graph } = this.context;
|
|
87
|
+
const selects = getAllElementState(graph, () => []);
|
|
88
|
+
|
|
89
|
+
graph.setElementState(selects, this.options.animation);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
private lassoUpdateElementState = () => {
|
|
93
|
+
if (!this.points || this.points?.length < 2) return;
|
|
94
|
+
this.updateElementState(this.points);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
private clearLasso = async () => {
|
|
98
|
+
this.pathShape?.remove();
|
|
99
|
+
this.pathShape = undefined;
|
|
100
|
+
this.points = undefined;
|
|
101
|
+
};
|
|
102
|
+
}
|
package/src/behaviors/types.ts
CHANGED
|
@@ -2,5 +2,7 @@ import type { BaseBehavior } from './base-behavior';
|
|
|
2
2
|
import type { DragCanvasOptions } from './drag-canvas';
|
|
3
3
|
import type { ZoomCanvasOptions } from './zoom-canvas';
|
|
4
4
|
|
|
5
|
+
export type { States } from './brush-select';
|
|
6
|
+
|
|
5
7
|
export type BuiltInBehaviorOptions = DragCanvasOptions | ZoomCanvasOptions;
|
|
6
8
|
export type Behavior = BaseBehavior<any>;
|
package/src/constants/change.ts
CHANGED
|
@@ -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
|
}
|
|
@@ -43,12 +43,12 @@ export enum GraphEvent {
|
|
|
43
43
|
BEFORE_TRANSFORM = 'beforetransform',
|
|
44
44
|
/** <zh/> 可视区域变化之后 | <en/> After the visible area changes */
|
|
45
45
|
AFTER_TRANSFORM = 'aftertransform',
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
/** <zh/> 状态变化之前 | <en/> Before the state changes */
|
|
47
|
+
BEFORE_ELEMENT_STATE_CHANGE = 'beforeelementstatechange',
|
|
48
|
+
/** <zh/> 状态变化之后 | <en/> After the state changes */
|
|
49
|
+
AFTER_ELEMENT_STATE_CHANGE = 'afterelementstatechange',
|
|
50
|
+
/** <zh/> 批处理开始 | <en/> Batch processing starts */
|
|
51
|
+
BATCH_START = 'batchstart',
|
|
52
|
+
/** <zh/> 批处理结束 | <en/> Batch processing ends */
|
|
53
|
+
BATCH_END = 'batchend',
|
|
54
54
|
}
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
-
import type { AABB,
|
|
1
|
+
import type { AABB, DisplayObject, DisplayObjectConfig, Group } from '@antv/g';
|
|
2
2
|
import { deepMix, isEmpty, isFunction } from '@antv/util';
|
|
3
3
|
import { COMBO_KEY } from '../../constants';
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
BaseElementStyleProps,
|
|
6
|
+
Combo,
|
|
7
|
+
Node,
|
|
8
|
+
NodeLikeData,
|
|
9
|
+
Padding,
|
|
10
|
+
Placement,
|
|
11
|
+
Position,
|
|
12
|
+
PrefixObject,
|
|
13
|
+
STDSize,
|
|
14
|
+
Size,
|
|
15
|
+
} from '../../types';
|
|
5
16
|
import { getBBoxHeight, getBBoxWidth, getCombinedBBox, getExpandedBBox } from '../../utils/bbox';
|
|
6
17
|
import { getXYByCollapsedOrigin } from '../../utils/combo';
|
|
7
18
|
import { idOf } from '../../utils/id';
|
|
@@ -14,6 +25,52 @@ import type { BaseNodeStyleProps } from '../nodes';
|
|
|
14
25
|
import { BaseNode } from '../nodes';
|
|
15
26
|
import { Icon, IconStyleProps } from '../shapes';
|
|
16
27
|
|
|
28
|
+
export type BaseComboStyleProps<T extends Record<string, unknown> = Record<string, any>> = T &
|
|
29
|
+
BaseElementStyleProps &
|
|
30
|
+
BaseNodeStyleProps<T> &
|
|
31
|
+
PrefixObject<T, 'collapsed'> &
|
|
32
|
+
PrefixObject<CollapsedMarkerStyleProps, 'collapsedMarker'> & {
|
|
33
|
+
/**
|
|
34
|
+
* <zh/> Combo 展开后的默认大小
|
|
35
|
+
*
|
|
36
|
+
* <en/> The default size of combo when expanded
|
|
37
|
+
*/
|
|
38
|
+
size?: Size;
|
|
39
|
+
/**
|
|
40
|
+
* <zh/> Combo 收起后的默认大小
|
|
41
|
+
*
|
|
42
|
+
* <en/> The default size of combo when collapsed
|
|
43
|
+
*/
|
|
44
|
+
collapsedSize?: Size;
|
|
45
|
+
/**
|
|
46
|
+
* <zh/> Combo 收起时的原点
|
|
47
|
+
* <en/> The origin of combo when collapsed
|
|
48
|
+
*/
|
|
49
|
+
collapsedOrigin?: Placement | [number, number];
|
|
50
|
+
/**
|
|
51
|
+
* <zh/> Combo 的子元素,可以是节点或者 Combo
|
|
52
|
+
*
|
|
53
|
+
* <en/> The children of combo, which can be nodes or combos
|
|
54
|
+
*/
|
|
55
|
+
childrenNode?: (Node | Combo)[];
|
|
56
|
+
/**
|
|
57
|
+
* <zh/> Combo 的子元素数据
|
|
58
|
+
*
|
|
59
|
+
* <en/> The data of the children of combo
|
|
60
|
+
* @description
|
|
61
|
+
* <zh/> 如果 combo 是收起状态,children 可能为空,通过 childrenData 能够获取完整的子元素数据
|
|
62
|
+
*
|
|
63
|
+
* <en/> If the combo is collapsed, children may be empty, and the complete child element data can be obtained through childrenData
|
|
64
|
+
*/
|
|
65
|
+
childrenData?: NodeLikeData[];
|
|
66
|
+
/**
|
|
67
|
+
* <zh/> Combo 的内边距,只在展开状态下生效
|
|
68
|
+
* <en/> The padding of combo, only effective when expanded
|
|
69
|
+
*/
|
|
70
|
+
padding?: Padding;
|
|
71
|
+
collapsedMarker?: boolean;
|
|
72
|
+
};
|
|
73
|
+
|
|
17
74
|
export type CollapsedMarkerStyleProps = IconStyleProps & {
|
|
18
75
|
/**
|
|
19
76
|
* <zh/> 标记类型
|
|
@@ -26,14 +83,6 @@ export type CollapsedMarkerStyleProps = IconStyleProps & {
|
|
|
26
83
|
*/
|
|
27
84
|
type?: 'child-count' | 'descendant-count' | 'node-count' | ((children: NodeLikeData[]) => string);
|
|
28
85
|
};
|
|
29
|
-
export type BaseComboStyleProps<KeyStyleProps extends BaseStyleProps = BaseStyleProps> = BaseComboProps &
|
|
30
|
-
PrefixObject<KeyStyleProps, 'collapsed'> & {
|
|
31
|
-
collapsedMarker?: boolean;
|
|
32
|
-
} & PrefixObject<CollapsedMarkerStyleProps, 'collapsedMarker'> &
|
|
33
|
-
BaseNodeStyleProps<KeyStyleProps>;
|
|
34
|
-
export type ParsedBaseComboStyleProps<KeyStyleProps extends BaseStyleProps> = Required<
|
|
35
|
-
BaseComboStyleProps<KeyStyleProps>
|
|
36
|
-
>;
|
|
37
86
|
|
|
38
87
|
export abstract class BaseCombo<S extends BaseComboStyleProps = BaseComboStyleProps> extends BaseNode<S> {
|
|
39
88
|
public type = 'combo';
|
|
@@ -6,24 +6,21 @@ import { getBBoxSize } from '../../utils/bbox';
|
|
|
6
6
|
import { getCircleCollapsedOrigin, getXYByCollapsedOrigin } from '../../utils/combo';
|
|
7
7
|
import { subStyleProps } from '../../utils/prefix';
|
|
8
8
|
import { parseSize } from '../../utils/size';
|
|
9
|
-
import type { BaseComboStyleProps
|
|
9
|
+
import type { BaseComboStyleProps } from './base-combo';
|
|
10
10
|
import { BaseCombo } from './base-combo';
|
|
11
11
|
|
|
12
|
-
export type CircleComboStyleProps = BaseComboStyleProps
|
|
13
|
-
type ParsedCircleComboStyleProps = ParsedBaseComboStyleProps<KeyStyleProps>;
|
|
14
|
-
type CircleComboOptions = DisplayObjectConfig<CircleComboStyleProps>;
|
|
15
|
-
type KeyStyleProps = GCircleStyleProps;
|
|
12
|
+
export type CircleComboStyleProps = BaseComboStyleProps;
|
|
16
13
|
|
|
17
14
|
export class CircleCombo extends BaseCombo<CircleComboStyleProps> {
|
|
18
|
-
constructor(options:
|
|
15
|
+
constructor(options: DisplayObjectConfig<CircleComboStyleProps>) {
|
|
19
16
|
super(options);
|
|
20
17
|
}
|
|
21
18
|
|
|
22
|
-
protected drawKeyShape(attributes:
|
|
19
|
+
protected drawKeyShape(attributes: Required<CircleComboStyleProps>, container: Group): GCircle | undefined {
|
|
23
20
|
return this.upsert('key', GCircle, this.getKeyStyle(attributes), container);
|
|
24
21
|
}
|
|
25
22
|
|
|
26
|
-
protected getKeyStyle(attributes:
|
|
23
|
+
protected getKeyStyle(attributes: Required<CircleComboStyleProps>): GCircleStyleProps {
|
|
27
24
|
const { collapsed } = attributes;
|
|
28
25
|
const keyStyle = super.getKeyStyle(attributes);
|
|
29
26
|
const collapsedStyle = subStyleProps(keyStyle, 'collapsed');
|
|
@@ -36,13 +33,13 @@ export class CircleCombo extends BaseCombo<CircleComboStyleProps> {
|
|
|
36
33
|
};
|
|
37
34
|
}
|
|
38
35
|
|
|
39
|
-
protected getCollapsedKeySize(attributes:
|
|
36
|
+
protected getCollapsedKeySize(attributes: Required<CircleComboStyleProps>): STDSize {
|
|
40
37
|
const [collapsedWidth, collapsedHeight] = parseSize(attributes.collapsedSize);
|
|
41
38
|
const collapsedR = Math.max(collapsedWidth, collapsedHeight) / 2;
|
|
42
39
|
return [collapsedR * 2, collapsedR * 2, 0];
|
|
43
40
|
}
|
|
44
41
|
|
|
45
|
-
protected getExpandedKeySize(attributes:
|
|
42
|
+
protected getExpandedKeySize(attributes: Required<CircleComboStyleProps>): STDSize {
|
|
46
43
|
if (!isEmpty(attributes.size)) {
|
|
47
44
|
const [expandedWidth, expandedHeight] = parseSize(attributes.size);
|
|
48
45
|
const expandedR = Math.sqrt(expandedWidth ** 2 + expandedHeight ** 2) / 2;
|
|
@@ -54,7 +51,7 @@ export class CircleCombo extends BaseCombo<CircleComboStyleProps> {
|
|
|
54
51
|
return [expandedR * 2, expandedR * 2, 0];
|
|
55
52
|
}
|
|
56
53
|
|
|
57
|
-
protected getCollapsedOriginPosition(attributes:
|
|
54
|
+
protected getCollapsedOriginPosition(attributes: Required<CircleComboStyleProps>): Position {
|
|
58
55
|
return getXYByCollapsedOrigin(
|
|
59
56
|
attributes.collapsedOrigin,
|
|
60
57
|
this.getContentBBox(attributes).center,
|
|
@@ -2,28 +2,25 @@ import type { DisplayObjectConfig, RectStyleProps as GRectStyleProps } from '@an
|
|
|
2
2
|
import { Rect as GRect, Group } from '@antv/g';
|
|
3
3
|
import { deepMix } from '@antv/util';
|
|
4
4
|
import { subStyleProps } from '../../utils/prefix';
|
|
5
|
-
import type { BaseComboStyleProps
|
|
5
|
+
import type { BaseComboStyleProps } from './base-combo';
|
|
6
6
|
import { BaseCombo } from './base-combo';
|
|
7
7
|
|
|
8
|
-
type
|
|
9
|
-
export type RectComboStyleProps = BaseComboStyleProps<KeyStyleProps>;
|
|
10
|
-
type ParsedRectComboStyleProps = ParsedBaseComboStyleProps<KeyStyleProps>;
|
|
11
|
-
type RectComboOptions = DisplayObjectConfig<RectComboStyleProps>;
|
|
8
|
+
export type RectComboStyleProps = BaseComboStyleProps;
|
|
12
9
|
|
|
13
10
|
export class RectCombo extends BaseCombo<RectComboStyleProps> {
|
|
14
11
|
static defaultStyleProps: Partial<RectComboStyleProps> = {
|
|
15
12
|
anchor: [0.5, 0.5],
|
|
16
13
|
};
|
|
17
14
|
|
|
18
|
-
constructor(options:
|
|
15
|
+
constructor(options: DisplayObjectConfig<RectComboStyleProps>) {
|
|
19
16
|
super(deepMix({}, { style: RectCombo.defaultStyleProps }, options));
|
|
20
17
|
}
|
|
21
18
|
|
|
22
|
-
protected drawKeyShape(attributes:
|
|
19
|
+
protected drawKeyShape(attributes: Required<RectComboStyleProps>, container: Group): GRect | undefined {
|
|
23
20
|
return this.upsert('key', GRect, this.getKeyStyle(attributes), container);
|
|
24
21
|
}
|
|
25
22
|
|
|
26
|
-
protected getKeyStyle(attributes:
|
|
23
|
+
protected getKeyStyle(attributes: Required<RectComboStyleProps>): GRectStyleProps {
|
|
27
24
|
const keyStyle = super.getKeyStyle(attributes);
|
|
28
25
|
const collapsedStyle = subStyleProps(keyStyle, 'collapsed');
|
|
29
26
|
|
|
@@ -10,11 +10,12 @@ import { Image, Path } from '@antv/g';
|
|
|
10
10
|
import type { PathArray } from '@antv/util';
|
|
11
11
|
import { deepMix, isEmpty, isFunction } from '@antv/util';
|
|
12
12
|
import type {
|
|
13
|
-
|
|
13
|
+
BaseElementStyleProps,
|
|
14
14
|
EdgeKey,
|
|
15
15
|
EdgeLabelStyleProps,
|
|
16
16
|
Keyframe,
|
|
17
17
|
LoopPlacement,
|
|
18
|
+
Node,
|
|
18
19
|
Point,
|
|
19
20
|
PrefixObject,
|
|
20
21
|
Size,
|
|
@@ -31,13 +32,78 @@ import type { LabelStyleProps } from '../shapes';
|
|
|
31
32
|
import { Label } from '../shapes';
|
|
32
33
|
import { BaseShape } from '../shapes/base-shape';
|
|
33
34
|
|
|
34
|
-
export type BaseEdgeStyleProps =
|
|
35
|
-
|
|
35
|
+
export type BaseEdgeStyleProps = BaseElementStyleProps &
|
|
36
|
+
Pick<
|
|
37
|
+
PathStyleProps,
|
|
38
|
+
'isBillboard' | 'markerStart' | 'markerStartOffset' | 'markerEnd' | 'markerEndOffset' | 'markerMid'
|
|
39
|
+
> &
|
|
36
40
|
PrefixObject<EdgeLabelStyleProps, 'label'> &
|
|
37
41
|
PrefixObject<PathStyleProps, 'halo'> &
|
|
38
42
|
PrefixObject<EdgeArrowStyleProps, 'startArrow'> &
|
|
39
43
|
PrefixObject<EdgeArrowStyleProps, 'endArrow'> &
|
|
40
|
-
PrefixObject<LoopStyleProps, 'loop'
|
|
44
|
+
PrefixObject<LoopStyleProps, 'loop'> & {
|
|
45
|
+
/**
|
|
46
|
+
* <zh/> 是否显示边的标签
|
|
47
|
+
*
|
|
48
|
+
* <en/> Whether to display the label of the edge
|
|
49
|
+
*/
|
|
50
|
+
label?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* <zh/> 是否显示边的光晕
|
|
53
|
+
*
|
|
54
|
+
* <en/> Whether to display the halo of the edge
|
|
55
|
+
*/
|
|
56
|
+
halo?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* <zh/> 是否显示边的起始箭头
|
|
59
|
+
*
|
|
60
|
+
* <en/> Whether to display the start arrow of the edge
|
|
61
|
+
*/
|
|
62
|
+
startArrow?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* <zh/> 是否显示边的结束箭头
|
|
65
|
+
*
|
|
66
|
+
* <en/> Whether to display the end arrow of the edge
|
|
67
|
+
*/
|
|
68
|
+
endArrow?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* <zh/> 起始箭头的偏移量
|
|
71
|
+
*
|
|
72
|
+
* <en/> Offset of the start arrow
|
|
73
|
+
*/
|
|
74
|
+
startArrowOffset?: number;
|
|
75
|
+
/**
|
|
76
|
+
* <zh/> 结束箭头的偏移量
|
|
77
|
+
*
|
|
78
|
+
* <en/> Offset of the end arrow
|
|
79
|
+
*/
|
|
80
|
+
endArrowOffset?: number;
|
|
81
|
+
/**
|
|
82
|
+
* <zh/> 主色
|
|
83
|
+
* <en/> Subject color
|
|
84
|
+
*/
|
|
85
|
+
color?: string;
|
|
86
|
+
/**
|
|
87
|
+
* <zh/> 边的起点 shape
|
|
88
|
+
* <en/> The source shape. Represents the start of the edge
|
|
89
|
+
*/
|
|
90
|
+
sourceNode: Node;
|
|
91
|
+
/**
|
|
92
|
+
* <zh/> 边的终点 shape
|
|
93
|
+
* <en/> The source shape. Represents the start of the edge
|
|
94
|
+
*/
|
|
95
|
+
targetNode: Node;
|
|
96
|
+
/**
|
|
97
|
+
* <zh/> 边起始连接的 port
|
|
98
|
+
* <en/> The Port of the source node
|
|
99
|
+
*/
|
|
100
|
+
sourcePort?: string;
|
|
101
|
+
/**
|
|
102
|
+
* <zh/> 边终点连接的 port
|
|
103
|
+
* <en/> The Port of the target node
|
|
104
|
+
*/
|
|
105
|
+
targetPort?: string;
|
|
106
|
+
};
|
|
41
107
|
|
|
42
108
|
type ParsedBaseEdgeStyleProps = Required<BaseEdgeStyleProps>;
|
|
43
109
|
|
|
@@ -290,12 +356,3 @@ export type LoopStyleProps = {
|
|
|
290
356
|
*/
|
|
291
357
|
dist?: number;
|
|
292
358
|
};
|
|
293
|
-
|
|
294
|
-
type ShapeSwitch = {
|
|
295
|
-
label?: boolean;
|
|
296
|
-
halo?: boolean;
|
|
297
|
-
startArrow?: boolean;
|
|
298
|
-
endArrow?: boolean;
|
|
299
|
-
startArrowOffset?: number;
|
|
300
|
-
endArrowOffset?: number;
|
|
301
|
-
};
|
|
@@ -4,7 +4,7 @@ import type { Point } from '../../types';
|
|
|
4
4
|
import type { BaseEdgeStyleProps } from './base-edge';
|
|
5
5
|
import { Cubic } from './cubic';
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export interface CubicHorizontalStyleProps extends BaseEdgeStyleProps {
|
|
8
8
|
/**
|
|
9
9
|
* <zh/> 控制点在两端点连线上的相对位置,范围为`0-1`
|
|
10
10
|
* <en/> The relative position of the control point on the line, ranging from `0-1`
|
|
@@ -15,7 +15,7 @@ export type CubicHorizontalStyleProps = BaseEdgeStyleProps & {
|
|
|
15
15
|
* <en/> The distance of the control point from the line
|
|
16
16
|
*/
|
|
17
17
|
curveOffset?: number | [number, number];
|
|
18
|
-
}
|
|
18
|
+
}
|
|
19
19
|
|
|
20
20
|
export class CubicHorizontal extends Cubic {
|
|
21
21
|
static defaultStyleProps: Partial<CubicHorizontalStyleProps> = {
|
|
@@ -4,7 +4,7 @@ import type { Point } from '../../types';
|
|
|
4
4
|
import type { BaseEdgeStyleProps } from './base-edge';
|
|
5
5
|
import { Cubic } from './cubic';
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export interface CubicVerticalStyleProps extends BaseEdgeStyleProps {
|
|
8
8
|
/**
|
|
9
9
|
* <zh/> 控制点在两端点连线上的相对位置,范围为`0-1`
|
|
10
10
|
* <en/> The relative position of the control point on the line, ranging from `0-1`
|
|
@@ -15,7 +15,7 @@ export type CubicVerticalStyleProps = BaseEdgeStyleProps & {
|
|
|
15
15
|
* <en/> The distance of the control point from the line
|
|
16
16
|
*/
|
|
17
17
|
curveOffset?: number | [number, number];
|
|
18
|
-
}
|
|
18
|
+
}
|
|
19
19
|
|
|
20
20
|
export class CubicVertical extends Cubic {
|
|
21
21
|
static defaultStyleProps: Partial<CubicVerticalStyleProps> = {
|