@antv/g6 5.0.0-beta.32 → 5.0.0-beta.33
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 +104 -0
- package/dist/lib/behaviors/click-element.d.ts +77 -0
- package/dist/lib/behaviors/drag-element-force.d.ts +14 -0
- package/dist/lib/behaviors/drag-element.d.ts +13 -12
- package/dist/lib/behaviors/index.d.ts +8 -0
- package/dist/lib/behaviors/lasso-select.d.ts +20 -0
- package/dist/lib/behaviors/types.d.ts +1 -0
- package/dist/lib/constants/change.d.ts +1 -1
- 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 -13
- 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/ellipse.d.ts +5 -8
- package/dist/lib/elements/nodes/hexagon.d.ts +6 -9
- package/dist/lib/elements/nodes/image.d.ts +9 -11
- 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 +4 -2
- 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 +59 -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 +4 -4
- package/dist/lib/runtime/element.d.ts +3 -19
- package/dist/lib/runtime/graph.d.ts +40 -2
- 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/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/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 +84 -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/canvas.d.ts +1 -1
- package/dist/lib/types/change.d.ts +27 -10
- package/dist/lib/types/element.d.ts +6 -140
- package/dist/lib/types/node.d.ts +3 -3
- package/dist/lib/types/point.d.ts +1 -0
- package/dist/lib/utils/animation.d.ts +1 -1
- package/dist/lib/utils/behaviors/brush.d.ts +19 -0
- package/dist/lib/utils/behaviors/lasso.d.ts +13 -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 +11 -0
- 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 +3 -8
- package/dist/lib/utils/line.d.ts +21 -0
- 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/shortcut.d.ts +1 -0
- package/dist/lib/utils/vector.d.ts +3 -2
- package/esm/behaviors/brush-select.d.ts +104 -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/drag-element-force.d.ts +14 -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 +13 -12
- package/esm/behaviors/drag-element.js +17 -9
- package/esm/behaviors/drag-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 +20 -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/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 -13
- 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/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/image.d.ts +9 -11
- package/esm/elements/nodes/image.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 +4 -2
- package/esm/exports.js +2 -1
- 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 +59 -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.map +1 -1
- package/esm/registry/build-in.js +19 -4
- 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 +36 -12
- package/esm/runtime/canvas.js.map +1 -1
- package/esm/runtime/data.d.ts +4 -4
- package/esm/runtime/data.js +23 -25
- package/esm/runtime/data.js.map +1 -1
- package/esm/runtime/element.d.ts +3 -19
- package/esm/runtime/element.js +16 -137
- package/esm/runtime/element.js.map +1 -1
- package/esm/runtime/graph.d.ts +40 -2
- package/esm/runtime/graph.js +57 -1
- package/esm/runtime/graph.js.map +1 -1
- package/esm/runtime/layout.d.ts +5 -11
- package/esm/runtime/layout.js +29 -75
- 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/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.js +9 -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 +84 -0
- package/esm/transforms/process-parallel-edges.js +215 -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/canvas.d.ts +1 -1
- package/esm/types/change.d.ts +27 -10
- package/esm/types/element.d.ts +6 -140
- package/esm/types/node.d.ts +3 -3
- package/esm/types/point.d.ts +1 -0
- package/esm/utils/animation.d.ts +1 -1
- package/esm/utils/animation.js +6 -0
- package/esm/utils/animation.js.map +1 -1
- package/esm/utils/behaviors/brush.d.ts +19 -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 +13 -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 +11 -0
- 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 +3 -8
- 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/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/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.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 +104 -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/drag-element-force.d.ts +14 -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 +13 -12
- package/lib/behaviors/drag-element.js +17 -9
- package/lib/behaviors/drag-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 +20 -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/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 -13
- 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/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/image.d.ts +9 -11
- package/lib/elements/nodes/image.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 +4 -2
- package/lib/exports.js +4 -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 +59 -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.map +1 -1
- package/lib/registry/build-in.js +15 -0
- 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 +34 -10
- package/lib/runtime/canvas.js.map +1 -1
- package/lib/runtime/data.d.ts +4 -4
- package/lib/runtime/data.js +22 -24
- package/lib/runtime/data.js.map +1 -1
- package/lib/runtime/element.d.ts +3 -19
- package/lib/runtime/element.js +16 -137
- package/lib/runtime/element.js.map +1 -1
- package/lib/runtime/graph.d.ts +40 -2
- package/lib/runtime/graph.js +57 -1
- package/lib/runtime/graph.js.map +1 -1
- package/lib/runtime/layout.d.ts +5 -11
- package/lib/runtime/layout.js +27 -73
- 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/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.js +9 -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 +84 -0
- package/lib/transforms/process-parallel-edges.js +222 -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/canvas.d.ts +1 -1
- package/lib/types/change.d.ts +27 -10
- package/lib/types/element.d.ts +6 -140
- package/lib/types/node.d.ts +3 -3
- package/lib/types/point.d.ts +1 -0
- package/lib/utils/animation.d.ts +1 -1
- package/lib/utils/animation.js +6 -0
- package/lib/utils/animation.js.map +1 -1
- package/lib/utils/behaviors/brush.d.ts +19 -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 +13 -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 +11 -0
- 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 +3 -8
- 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/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/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.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 +306 -0
- package/src/behaviors/click-element.ts +182 -0
- package/src/behaviors/drag-element-force.ts +70 -0
- package/src/behaviors/drag-element.ts +27 -17
- package/src/behaviors/hover-element.ts +2 -3
- package/src/behaviors/index.ts +8 -0
- package/src/behaviors/lasso-select.ts +103 -0
- package/src/behaviors/types.ts +2 -0
- package/src/constants/change.ts +1 -1
- 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 +115 -19
- package/src/elements/nodes/circle.ts +5 -7
- package/src/elements/nodes/diamond.ts +4 -6
- package/src/elements/nodes/ellipse.ts +6 -8
- package/src/elements/nodes/hexagon.ts +7 -9
- package/src/elements/nodes/image.ts +12 -13
- 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 +4 -2
- 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 +149 -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 +1 -1
- package/src/registry/build-in.ts +22 -2
- 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 +51 -13
- package/src/runtime/data.ts +31 -36
- package/src/runtime/element.ts +28 -167
- package/src/runtime/graph.ts +65 -3
- package/src/runtime/layout.ts +48 -79
- package/src/runtime/plugin.ts +1 -1
- package/src/runtime/transform.ts +27 -0
- package/src/runtime/types.ts +14 -0
- 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 +9 -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 +286 -0
- package/src/transforms/types.ts +23 -0
- package/src/transforms/update-related-edge.ts +28 -0
- package/src/types/canvas.ts +1 -1
- package/src/types/change.ts +28 -10
- package/src/types/element.ts +6 -147
- package/src/types/node.ts +3 -3
- package/src/types/point.ts +1 -0
- package/src/utils/animation.ts +6 -0
- package/src/utils/behaviors/brush.ts +29 -0
- package/src/utils/behaviors/lasso.ts +127 -0
- package/src/utils/behaviors/utils.ts +47 -0
- package/src/utils/change.ts +42 -1
- package/src/utils/combo.ts +6 -5
- package/src/utils/edge.ts +6 -1
- package/src/utils/event/events.ts +3 -1
- package/src/utils/extension.ts +1 -1
- package/src/utils/id.ts +11 -2
- package/src/utils/line.ts +50 -0
- 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/shortcut.ts +13 -2
- package/src/utils/style.ts +1 -1
- package/src/utils/vector.ts +10 -3
- package/esm/elements/types.d.ts +0 -0
- package/esm/elements/types.js +0 -15
- package/esm/elements/types.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/src/elements/types.ts +0 -21
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { BaseStyleProps } from '@antv/g';
|
|
2
2
|
import { Rect } from '@antv/g';
|
|
3
|
-
import { ID } from '@antv/graphlib';
|
|
3
|
+
import type { ID } from '@antv/graphlib';
|
|
4
4
|
import { isFunction } from '@antv/util';
|
|
5
5
|
import { COMBO_KEY, CommonEvent } from '../constants';
|
|
6
|
-
import { RuntimeContext } from '../runtime/types';
|
|
6
|
+
import type { RuntimeContext } from '../runtime/types';
|
|
7
7
|
import type { EdgeDirection, Element, IDragEvent, Point, PrefixObject } from '../types';
|
|
8
8
|
import { getBBoxSize, getCombinedBBox } from '../utils/bbox';
|
|
9
9
|
import { idOf } from '../utils/id';
|
|
@@ -96,11 +96,11 @@ export class DragElement extends BaseBehavior<DragElementOptions> {
|
|
|
96
96
|
shadowLineDash: [5, 5],
|
|
97
97
|
};
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
protected enable: boolean = false;
|
|
100
100
|
|
|
101
101
|
private enableElements = ['node', 'combo'];
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
protected target: ID[] = [];
|
|
104
104
|
|
|
105
105
|
private shadow?: Rect;
|
|
106
106
|
|
|
@@ -115,6 +115,11 @@ export class DragElement extends BaseBehavior<DragElementOptions> {
|
|
|
115
115
|
|
|
116
116
|
constructor(context: RuntimeContext, options: DragElementOptions) {
|
|
117
117
|
super(context, Object.assign({}, DragElement.defaultOptions, options));
|
|
118
|
+
this.onDragStart = this.onDragStart.bind(this);
|
|
119
|
+
this.onDrag = this.onDrag.bind(this);
|
|
120
|
+
this.onDragEnd = this.onDragEnd.bind(this);
|
|
121
|
+
this.onDrop = this.onDrop.bind(this);
|
|
122
|
+
|
|
118
123
|
this.bindEvents();
|
|
119
124
|
}
|
|
120
125
|
|
|
@@ -139,7 +144,7 @@ export class DragElement extends BaseBehavior<DragElementOptions> {
|
|
|
139
144
|
}
|
|
140
145
|
}
|
|
141
146
|
|
|
142
|
-
|
|
147
|
+
protected getSelectedNodeIDs(currTarget: ID[]) {
|
|
143
148
|
return Array.from(
|
|
144
149
|
new Set(
|
|
145
150
|
this.context.graph
|
|
@@ -150,27 +155,31 @@ export class DragElement extends BaseBehavior<DragElementOptions> {
|
|
|
150
155
|
);
|
|
151
156
|
}
|
|
152
157
|
|
|
153
|
-
|
|
158
|
+
protected getDelta(event: IElementDragEvent) {
|
|
159
|
+
const zoom = this.context.graph.getZoom();
|
|
160
|
+
return divide([event.dx, event.dy], zoom);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
protected onDragStart(event: IElementDragEvent) {
|
|
154
164
|
this.enable = this.validate(event);
|
|
155
165
|
if (!this.enable) return;
|
|
156
166
|
|
|
167
|
+
this.context.batch?.startBatch();
|
|
157
168
|
this.target = this.getSelectedNodeIDs([event.target.id]);
|
|
158
169
|
this.hideEdge();
|
|
159
170
|
this.context.graph.frontElement(this.target);
|
|
160
171
|
if (this.options.shadow) this.createShadow(this.target);
|
|
161
|
-
}
|
|
172
|
+
}
|
|
162
173
|
|
|
163
|
-
|
|
174
|
+
protected onDrag(event: IElementDragEvent) {
|
|
164
175
|
if (!this.enable) return;
|
|
165
|
-
const
|
|
166
|
-
const { dx, dy } = event;
|
|
167
|
-
const delta = divide([dx, dy], zoom);
|
|
176
|
+
const delta = this.getDelta(event);
|
|
168
177
|
|
|
169
178
|
if (this.options.shadow) this.moveShadow(delta);
|
|
170
179
|
else this.moveElement(this.target, delta);
|
|
171
|
-
}
|
|
180
|
+
}
|
|
172
181
|
|
|
173
|
-
|
|
182
|
+
protected onDragEnd() {
|
|
174
183
|
this.enable = false;
|
|
175
184
|
if (this.options.shadow) {
|
|
176
185
|
if (!this.shadow) return;
|
|
@@ -181,8 +190,9 @@ export class DragElement extends BaseBehavior<DragElementOptions> {
|
|
|
181
190
|
}
|
|
182
191
|
this.showEdges();
|
|
183
192
|
this.options.onFinish?.(this.target);
|
|
193
|
+
this.context.batch?.endBatch();
|
|
184
194
|
this.target = [];
|
|
185
|
-
}
|
|
195
|
+
}
|
|
186
196
|
|
|
187
197
|
private onDrop = async (event: IElementDragEvent) => {
|
|
188
198
|
if (this.options.dropEffect !== 'link') return;
|
|
@@ -200,14 +210,14 @@ export class DragElement extends BaseBehavior<DragElementOptions> {
|
|
|
200
210
|
await element?.draw({ animation: true });
|
|
201
211
|
};
|
|
202
212
|
|
|
203
|
-
|
|
213
|
+
protected validate(event: IElementDragEvent) {
|
|
204
214
|
if (this.destroyed) return false;
|
|
205
215
|
const { enable } = this.options;
|
|
206
216
|
if (isFunction(enable)) return enable(event);
|
|
207
217
|
return !!enable;
|
|
208
218
|
}
|
|
209
219
|
|
|
210
|
-
|
|
220
|
+
protected async moveElement(ids: ID[], offset: Point) {
|
|
211
221
|
const { model, element } = this.context;
|
|
212
222
|
const { dropEffect } = this.options;
|
|
213
223
|
ids.forEach((id) => {
|
|
@@ -262,7 +272,7 @@ export class DragElement extends BaseBehavior<DragElementOptions> {
|
|
|
262
272
|
this.hiddenEdges = [];
|
|
263
273
|
}
|
|
264
274
|
|
|
265
|
-
|
|
275
|
+
protected hideEdge() {
|
|
266
276
|
const { hideEdge, shadow } = this.options;
|
|
267
277
|
if (hideEdge === 'none' || shadow) return;
|
|
268
278
|
const { graph } = this.context;
|
|
@@ -4,7 +4,7 @@ import { CommonEvent } from '../constants';
|
|
|
4
4
|
import { ELEMENT_TYPES } from '../constants/element';
|
|
5
5
|
import type { RuntimeContext } from '../runtime/types';
|
|
6
6
|
import type { Element, ElementType, IPointerEvent, State } from '../types';
|
|
7
|
-
import {
|
|
7
|
+
import { idsOf } from '../utils/id';
|
|
8
8
|
import { getElementNthDegreeIds } from '../utils/relation';
|
|
9
9
|
import type { BaseBehaviorOptions } from './base-behavior';
|
|
10
10
|
import { BaseBehavior } from './base-behavior';
|
|
@@ -110,10 +110,9 @@ export class HoverElement extends BaseBehavior<HoverElementOptions> {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
if (this.options.inactiveState) {
|
|
113
|
-
const inactiveIds =
|
|
113
|
+
const inactiveIds = idsOf(graph.getData(), true).filter((id) => !activeIds.includes(id));
|
|
114
114
|
Object.assign(states, this.getElementsState(inactiveIds, this.options.inactiveState, add));
|
|
115
115
|
}
|
|
116
|
-
|
|
117
116
|
graph.setElementState(states, this.options.animation);
|
|
118
117
|
};
|
|
119
118
|
|
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,103 @@
|
|
|
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 { ID } from '@antv/graphlib';
|
|
8
|
+
import type { RuntimeContext } from '../runtime/types';
|
|
9
|
+
import type { IPointerEvent, Points, State } from '../types';
|
|
10
|
+
import type { BrushSelectOptions } from './brush-select';
|
|
11
|
+
|
|
12
|
+
const SHOW_PATH_ID = 'g6-lasso-select-path-id';
|
|
13
|
+
|
|
14
|
+
export type States = Record<ID, State | State[]>;
|
|
15
|
+
|
|
16
|
+
export type LassoSelectOptions = BrushSelectOptions;
|
|
17
|
+
|
|
18
|
+
export class LassoSelect extends BrushSelect<LassoSelectOptions> {
|
|
19
|
+
static defaultOptions: Partial<LassoSelectOptions> = {
|
|
20
|
+
...BrushSelect.defaultOptions,
|
|
21
|
+
style: DEFAULT_STYLE,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
private points?: Points;
|
|
25
|
+
private pathShape?: Path;
|
|
26
|
+
|
|
27
|
+
public selectElementFn = isBBoxIntersectPolygon;
|
|
28
|
+
|
|
29
|
+
constructor(context: RuntimeContext, options: LassoSelectOptions) {
|
|
30
|
+
super(context, Object.assign({}, LassoSelect.defaultOptions, options));
|
|
31
|
+
this.bindEvents();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public pointerDown = async (event: IPointerEvent) => {
|
|
35
|
+
if (!this.validate(event) || !this.isKeydown() || this.points) return;
|
|
36
|
+
const { style, trigger } = this.options;
|
|
37
|
+
const triggers = (Array.isArray(trigger) ? trigger : [trigger]) as string[];
|
|
38
|
+
if (event.targetType !== 'canvas' && triggers.includes('drag')) return;
|
|
39
|
+
|
|
40
|
+
const { canvas } = this.context;
|
|
41
|
+
|
|
42
|
+
this.pathShape = new Path({
|
|
43
|
+
id: SHOW_PATH_ID,
|
|
44
|
+
style: {
|
|
45
|
+
...LassoSelect.defaultOptions.style,
|
|
46
|
+
fill: style.color || DEFAULT_STYLE.color,
|
|
47
|
+
...style,
|
|
48
|
+
pointerEvents: 'none',
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
canvas.appendChild(this.pathShape);
|
|
53
|
+
|
|
54
|
+
this.points = [[event.canvas.x, event.canvas.y]];
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
public pointerMove = async (event: IPointerEvent) => {
|
|
58
|
+
if (!this.points) return;
|
|
59
|
+
const { immediately, mode } = this.options;
|
|
60
|
+
const { element } = this.context;
|
|
61
|
+
|
|
62
|
+
this.points.push([event.canvas.x, event.canvas.y]);
|
|
63
|
+
|
|
64
|
+
this.pathShape?.setAttribute('path', pointsToPath(this.points));
|
|
65
|
+
|
|
66
|
+
if (immediately && mode === 'default') {
|
|
67
|
+
this.lassoUpdateElementState();
|
|
68
|
+
}
|
|
69
|
+
await element?.draw({ animation: false, silence: true });
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
public pointerUp = async () => {
|
|
73
|
+
if (!this.points) return;
|
|
74
|
+
if (this.points.length < 2) {
|
|
75
|
+
await this.clearLasso();
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
this.lassoUpdateElementState();
|
|
80
|
+
|
|
81
|
+
await this.clearLasso();
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
public clearSelected = () => {
|
|
85
|
+
if (this.points) return;
|
|
86
|
+
|
|
87
|
+
const { graph } = this.context;
|
|
88
|
+
const selects = getAllElementState(graph, () => []);
|
|
89
|
+
|
|
90
|
+
graph.setElementState(selects, this.options.animation);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
private lassoUpdateElementState = () => {
|
|
94
|
+
if (!this.points || this.points?.length < 2) return;
|
|
95
|
+
this.updateElementState(this.points);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
private clearLasso = async () => {
|
|
99
|
+
this.pathShape?.remove();
|
|
100
|
+
this.pathShape = undefined;
|
|
101
|
+
this.points = undefined;
|
|
102
|
+
};
|
|
103
|
+
}
|
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
|
@@ -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> = {
|
|
@@ -6,7 +6,7 @@ import { getCubicPath, getCurveControlPoint, parseCurveOffset, parseCurvePositio
|
|
|
6
6
|
import type { BaseEdgeStyleProps } from './base-edge';
|
|
7
7
|
import { BaseEdge } from './base-edge';
|
|
8
8
|
|
|
9
|
-
export
|
|
9
|
+
export interface CubicStyleProps extends BaseEdgeStyleProps {
|
|
10
10
|
/**
|
|
11
11
|
* <zh/> 控制点数组,用于定义曲线的形状。如果不指定,将会通过`curveOffset`和`curvePosition`来计算控制点
|
|
12
12
|
* <en/> Control points. Used to define the shape of the curve. If not specified, it will be calculated using `curveOffset` and `curvePosition`.
|
|
@@ -22,7 +22,7 @@ export type CubicStyleProps = BaseEdgeStyleProps & {
|
|
|
22
22
|
* <en/> The distance of the control point from the line
|
|
23
23
|
*/
|
|
24
24
|
curveOffset?: number | [number, number];
|
|
25
|
-
}
|
|
25
|
+
}
|
|
26
26
|
|
|
27
27
|
type ParsedCubicStyleProps = Required<CubicStyleProps>;
|
|
28
28
|
|