@antv/g6 5.0.0-beta.31 → 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/collapse-expand.d.ts +4 -5
- package/dist/lib/behaviors/create-edge.d.ts +55 -0
- package/dist/lib/behaviors/drag-canvas.d.ts +6 -6
- package/dist/lib/behaviors/drag-element-force.d.ts +14 -0
- package/dist/lib/behaviors/drag-element.d.ts +17 -14
- package/dist/lib/behaviors/focus-element.d.ts +4 -3
- package/dist/lib/behaviors/hover-element.d.ts +4 -5
- package/dist/lib/behaviors/index.d.ts +10 -0
- package/dist/lib/behaviors/lasso-select.d.ts +20 -0
- package/dist/lib/behaviors/types.d.ts +1 -0
- package/dist/lib/behaviors/zoom-canvas.d.ts +7 -6
- package/dist/lib/constants/change.d.ts +1 -1
- package/dist/lib/constants/events/graph.d.ts +9 -15
- package/dist/lib/constants/index.d.ts +1 -0
- package/dist/lib/constants/registry.d.ts +22 -0
- package/dist/lib/elements/combos/base-combo.d.ts +64 -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 +85 -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 +125 -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 +18 -14
- 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/camera-setting.d.ts +95 -0
- package/dist/lib/plugins/contextmenu.d.ts +8 -5
- 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 +8 -0
- package/dist/lib/plugins/legend.d.ts +49 -0
- package/dist/lib/plugins/tooltip.d.ts +12 -10
- package/dist/lib/registry/extension/index.d.ts +3 -3
- package/dist/lib/registry/index.d.ts +6 -4
- package/dist/lib/registry/types.d.ts +4 -6
- 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 +15 -4
- package/dist/lib/runtime/data.d.ts +4 -4
- package/dist/lib/runtime/element.d.ts +6 -23
- package/dist/lib/runtime/graph.d.ts +71 -6
- package/dist/lib/runtime/layout.d.ts +5 -11
- package/dist/lib/runtime/plugin.d.ts +2 -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/event.d.ts +42 -7
- package/dist/lib/types/index.d.ts +0 -1
- 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/bbox.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/element.d.ts +19 -11
- package/dist/lib/utils/event/events.d.ts +9 -14
- 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 +11 -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/collapse-expand.d.ts +4 -5
- package/esm/behaviors/collapse-expand.js +8 -4
- package/esm/behaviors/collapse-expand.js.map +1 -1
- package/esm/behaviors/create-edge.d.ts +55 -0
- package/esm/behaviors/create-edge.js +141 -0
- package/esm/behaviors/create-edge.js.map +1 -0
- package/esm/behaviors/drag-canvas.d.ts +6 -6
- package/esm/behaviors/drag-canvas.js +15 -7
- package/esm/behaviors/drag-canvas.js.map +1 -1
- 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 +17 -14
- package/esm/behaviors/drag-element.js +17 -9
- package/esm/behaviors/drag-element.js.map +1 -1
- package/esm/behaviors/focus-element.d.ts +4 -3
- package/esm/behaviors/focus-element.js.map +1 -1
- package/esm/behaviors/hover-element.d.ts +4 -5
- package/esm/behaviors/hover-element.js +2 -2
- package/esm/behaviors/hover-element.js.map +1 -1
- package/esm/behaviors/index.d.ts +10 -0
- package/esm/behaviors/index.js +5 -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/behaviors/zoom-canvas.d.ts +7 -6
- package/esm/behaviors/zoom-canvas.js +6 -2
- package/esm/behaviors/zoom-canvas.js.map +1 -1
- 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 -15
- package/esm/constants/events/graph.js +8 -16
- package/esm/constants/events/graph.js.map +1 -1
- package/esm/constants/index.d.ts +1 -0
- package/esm/constants/index.js +1 -0
- package/esm/constants/index.js.map +1 -1
- package/esm/constants/registry.d.ts +22 -0
- package/esm/constants/registry.js +24 -0
- package/esm/constants/registry.js.map +1 -0
- package/esm/elements/combos/base-combo.d.ts +64 -6
- package/esm/elements/combos/base-combo.js +21 -0
- 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 +85 -10
- package/esm/elements/edges/base-edge.js +21 -0
- 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 +125 -13
- package/esm/elements/nodes/base-node.js +25 -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 +18 -14
- package/esm/exports.js +8 -6
- 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/camera-setting.d.ts +95 -0
- package/esm/plugins/camera-setting.js +65 -0
- package/esm/plugins/camera-setting.js.map +1 -0
- package/esm/plugins/contextmenu.d.ts +8 -5
- package/esm/plugins/contextmenu.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 +8 -0
- package/esm/plugins/index.js +4 -0
- package/esm/plugins/index.js.map +1 -1
- package/esm/plugins/legend.d.ts +49 -0
- package/esm/plugins/legend.js +267 -0
- package/esm/plugins/legend.js.map +1 -0
- package/esm/plugins/tooltip.d.ts +12 -10
- package/esm/plugins/tooltip.js +0 -1
- package/esm/plugins/tooltip.js.map +1 -1
- package/esm/preset.js +2 -5
- package/esm/preset.js.map +1 -1
- package/esm/registry/build-in.js +21 -4
- package/esm/registry/build-in.js.map +1 -1
- package/esm/registry/extension/index.d.ts +3 -3
- package/esm/registry/extension/index.js.map +1 -1
- package/esm/registry/index.d.ts +6 -4
- package/esm/registry/index.js +1 -0
- package/esm/registry/index.js.map +1 -1
- package/esm/registry/types.d.ts +4 -6
- 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 +3 -2
- package/esm/runtime/behavior.js.map +1 -1
- package/esm/runtime/canvas.d.ts +15 -4
- package/esm/runtime/canvas.js +103 -41
- 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 +6 -23
- package/esm/runtime/element.js +48 -150
- package/esm/runtime/element.js.map +1 -1
- package/esm/runtime/graph.d.ts +71 -6
- package/esm/runtime/graph.js +105 -10
- 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 +2 -1
- package/esm/runtime/plugin.js +3 -0
- 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/event.d.ts +42 -7
- package/esm/types/index.d.ts +0 -1
- 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/bbox.d.ts +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/element.d.ts +19 -11
- package/esm/utils/element.js +19 -9
- package/esm/utils/element.js.map +1 -1
- package/esm/utils/event/events.d.ts +9 -14
- package/esm/utils/event/events.js +3 -8
- 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 +11 -0
- package/esm/utils/shortcut.js +37 -5
- 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/collapse-expand.d.ts +4 -5
- package/lib/behaviors/collapse-expand.js +8 -4
- package/lib/behaviors/collapse-expand.js.map +1 -1
- package/lib/behaviors/create-edge.d.ts +55 -0
- package/lib/behaviors/create-edge.js +145 -0
- package/lib/behaviors/create-edge.js.map +1 -0
- package/lib/behaviors/drag-canvas.d.ts +6 -6
- package/lib/behaviors/drag-canvas.js +15 -7
- package/lib/behaviors/drag-canvas.js.map +1 -1
- 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 +17 -14
- package/lib/behaviors/drag-element.js +17 -9
- package/lib/behaviors/drag-element.js.map +1 -1
- package/lib/behaviors/focus-element.d.ts +4 -3
- package/lib/behaviors/focus-element.js.map +1 -1
- package/lib/behaviors/hover-element.d.ts +4 -5
- package/lib/behaviors/hover-element.js +1 -1
- package/lib/behaviors/hover-element.js.map +1 -1
- package/lib/behaviors/index.d.ts +10 -0
- package/lib/behaviors/index.js +11 -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/behaviors/zoom-canvas.d.ts +7 -6
- package/lib/behaviors/zoom-canvas.js +6 -2
- package/lib/behaviors/zoom-canvas.js.map +1 -1
- 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 -15
- package/lib/constants/events/graph.js +9 -17
- package/lib/constants/events/graph.js.map +1 -1
- package/lib/constants/index.d.ts +1 -0
- package/lib/constants/index.js +1 -0
- package/lib/constants/index.js.map +1 -1
- package/lib/constants/registry.d.ts +22 -0
- package/lib/constants/registry.js +27 -0
- package/lib/constants/registry.js.map +1 -0
- package/lib/elements/combos/base-combo.d.ts +64 -6
- package/lib/elements/combos/base-combo.js +21 -0
- 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 +85 -10
- package/lib/elements/edges/base-edge.js +21 -0
- 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 +125 -13
- package/lib/elements/nodes/base-node.js +25 -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 +18 -14
- package/lib/exports.js +26 -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/camera-setting.d.ts +95 -0
- package/lib/plugins/camera-setting.js +69 -0
- package/lib/plugins/camera-setting.js.map +1 -0
- package/lib/plugins/contextmenu.d.ts +8 -5
- package/lib/plugins/contextmenu.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 +8 -0
- package/lib/plugins/index.js +9 -1
- package/lib/plugins/index.js.map +1 -1
- package/lib/plugins/legend.d.ts +49 -0
- package/lib/plugins/legend.js +271 -0
- package/lib/plugins/legend.js.map +1 -0
- package/lib/plugins/tooltip.d.ts +12 -10
- package/lib/plugins/tooltip.js +0 -1
- package/lib/plugins/tooltip.js.map +1 -1
- package/lib/preset.js +2 -5
- package/lib/preset.js.map +1 -1
- package/lib/registry/build-in.js +17 -0
- package/lib/registry/build-in.js.map +1 -1
- package/lib/registry/extension/index.d.ts +3 -3
- package/lib/registry/extension/index.js.map +1 -1
- package/lib/registry/index.d.ts +6 -4
- package/lib/registry/index.js +1 -0
- package/lib/registry/index.js.map +1 -1
- package/lib/registry/types.d.ts +4 -6
- 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 +3 -2
- package/lib/runtime/behavior.js.map +1 -1
- package/lib/runtime/canvas.d.ts +15 -4
- package/lib/runtime/canvas.js +101 -39
- 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 +6 -23
- package/lib/runtime/element.js +47 -149
- package/lib/runtime/element.js.map +1 -1
- package/lib/runtime/graph.d.ts +71 -6
- package/lib/runtime/graph.js +104 -9
- 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 +2 -1
- package/lib/runtime/plugin.js +3 -0
- 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/{types/behavior.js → spec/transform.js} +1 -1
- 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/event.d.ts +42 -7
- package/lib/types/index.d.ts +0 -1
- 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/bbox.d.ts +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/element.d.ts +19 -11
- package/lib/utils/element.js +21 -10
- package/lib/utils/element.js.map +1 -1
- package/lib/utils/event/events.d.ts +9 -14
- package/lib/utils/event/events.js +4 -10
- 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 +11 -0
- package/lib/utils/shortcut.js +36 -4
- 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 +6 -7
- package/src/behaviors/brush-select.ts +306 -0
- package/src/behaviors/click-element.ts +182 -0
- package/src/behaviors/collapse-expand.ts +13 -11
- package/src/behaviors/create-edge.ts +206 -0
- package/src/behaviors/drag-canvas.ts +22 -14
- package/src/behaviors/drag-element-force.ts +70 -0
- package/src/behaviors/drag-element.ts +32 -25
- package/src/behaviors/focus-element.ts +7 -6
- package/src/behaviors/hover-element.ts +16 -13
- package/src/behaviors/index.ts +10 -0
- package/src/behaviors/lasso-select.ts +103 -0
- package/src/behaviors/types.ts +2 -0
- package/src/behaviors/zoom-canvas.ts +14 -9
- package/src/constants/change.ts +1 -1
- package/src/constants/events/graph.ts +8 -16
- package/src/constants/index.ts +1 -0
- package/src/constants/registry.ts +22 -0
- package/src/elements/combos/base-combo.ts +83 -10
- package/src/elements/combos/circle.ts +8 -11
- package/src/elements/combos/rect.ts +5 -8
- package/src/elements/edges/base-edge.ts +95 -14
- 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 +140 -20
- 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 +57 -12
- package/src/layouts/index.ts +1 -0
- package/src/layouts/types.ts +7 -5
- package/src/palettes/index.ts +13 -0
- package/src/plugins/camera-setting.ts +153 -0
- package/src/plugins/contextmenu.ts +10 -7
- 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 +8 -0
- package/src/plugins/legend.ts +321 -0
- package/src/plugins/tooltip.ts +16 -15
- package/src/preset.ts +2 -6
- package/src/registry/build-in.ts +33 -3
- package/src/registry/extension/index.ts +5 -5
- package/src/registry/index.ts +11 -4
- package/src/registry/types.ts +2 -7
- package/src/runtime/batch.ts +38 -0
- package/src/runtime/behavior.ts +4 -3
- package/src/runtime/canvas.ts +130 -52
- package/src/runtime/data.ts +31 -36
- package/src/runtime/element.ts +78 -185
- package/src/runtime/graph.ts +121 -15
- package/src/runtime/layout.ts +48 -79
- package/src/runtime/plugin.ts +5 -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/event.ts +62 -7
- package/src/types/index.ts +0 -1
- package/src/types/node.ts +3 -3
- package/src/types/point.ts +1 -0
- package/src/utils/animation.ts +6 -0
- package/src/utils/bbox.ts +1 -1
- 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/element.ts +22 -11
- package/src/utils/event/events.ts +18 -18
- 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 +41 -5
- package/src/utils/style.ts +1 -1
- package/src/utils/vector.ts +10 -3
- package/dist/lib/types/behavior.d.ts +0 -5
- 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/types/behavior.d.ts +0 -5
- package/esm/types/behavior.js +0 -2
- package/esm/types/behavior.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/types/behavior.d.ts +0 -5
- package/lib/types/behavior.js.map +0 -1
- package/src/elements/types.ts +0 -21
- package/src/types/behavior.ts +0 -6
|
@@ -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';
|
|
@@ -183,4 +232,28 @@ export abstract class BaseCombo<S extends BaseComboStyleProps = BaseComboStylePr
|
|
|
183
232
|
// collapsed marker
|
|
184
233
|
this.drawCollapsedMarkerShape(attributes, container);
|
|
185
234
|
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* <zh/> 在元素完成创建并执行完入场动画后调用
|
|
238
|
+
*
|
|
239
|
+
* <en/> Called after the element is created and the entrance animation is completed
|
|
240
|
+
* @override
|
|
241
|
+
*/
|
|
242
|
+
public onCreate() {}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* <zh/> 在元素更新并执行完过渡动画后调用
|
|
246
|
+
*
|
|
247
|
+
* <en/> Called after the element is updated and the transition animation is completed
|
|
248
|
+
* @override
|
|
249
|
+
*/
|
|
250
|
+
public onUpdate() {}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* <zh/> 在元素完成退场动画并销毁后调用
|
|
254
|
+
*
|
|
255
|
+
* <en/> Called after the element completes the exit animation and is destroyed
|
|
256
|
+
* @override
|
|
257
|
+
*/
|
|
258
|
+
public onDestroy() {}
|
|
186
259
|
}
|
|
@@ -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
|
|
|
@@ -227,7 +293,31 @@ export abstract class BaseEdge extends BaseShape<BaseEdgeStyleProps> {
|
|
|
227
293
|
this.drawHaloShape(attributes, container);
|
|
228
294
|
}
|
|
229
295
|
|
|
230
|
-
|
|
296
|
+
/**
|
|
297
|
+
* <zh/> 在元素完成创建并执行完入场动画后调用
|
|
298
|
+
*
|
|
299
|
+
* <en/> Called after the element is created and the entrance animation is completed
|
|
300
|
+
* @override
|
|
301
|
+
*/
|
|
302
|
+
public onCreate() {}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* <zh/> 在元素更新并执行完过渡动画后调用
|
|
306
|
+
*
|
|
307
|
+
* <en/> Called after the element is updated and the transition animation is completed
|
|
308
|
+
* @override
|
|
309
|
+
*/
|
|
310
|
+
public onUpdate() {}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* <zh/> 在元素完成退场动画并销毁后调用
|
|
314
|
+
*
|
|
315
|
+
* <en/> Called after the element completes the exit animation and is destroyed
|
|
316
|
+
* @override
|
|
317
|
+
*/
|
|
318
|
+
public onDestroy() {}
|
|
319
|
+
|
|
320
|
+
public animate(keyframes: Keyframe[], options?: number | KeyframeAnimationOptions) {
|
|
231
321
|
const result = super.animate(keyframes, options);
|
|
232
322
|
|
|
233
323
|
if (result) {
|
|
@@ -266,12 +356,3 @@ export type LoopStyleProps = {
|
|
|
266
356
|
*/
|
|
267
357
|
dist?: number;
|
|
268
358
|
};
|
|
269
|
-
|
|
270
|
-
type ShapeSwitch = {
|
|
271
|
-
label?: boolean;
|
|
272
|
-
halo?: boolean;
|
|
273
|
-
startArrow?: boolean;
|
|
274
|
-
endArrow?: boolean;
|
|
275
|
-
startArrowOffset?: number;
|
|
276
|
-
endArrowOffset?: number;
|
|
277
|
-
};
|
|
@@ -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
|
|
|
@@ -10,7 +10,7 @@ import { orth } from '../../utils/router/orth';
|
|
|
10
10
|
import type { BaseEdgeStyleProps, LoopStyleProps } from './base-edge';
|
|
11
11
|
import { BaseEdge } from './base-edge';
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export interface PolylineStyleProps extends BaseEdgeStyleProps {
|
|
14
14
|
/**
|
|
15
15
|
* <zh/> 圆角半径
|
|
16
16
|
* <en/> The radius of the rounded corner
|
|
@@ -36,7 +36,7 @@ export type PolylineStyleProps = BaseEdgeStyleProps & {
|
|
|
36
36
|
* <en/> Padding for routing calculation
|
|
37
37
|
*/
|
|
38
38
|
routerPadding?: Padding;
|
|
39
|
-
}
|
|
39
|
+
}
|
|
40
40
|
type ParsedPolylineStyleProps = Required<PolylineStyleProps>;
|
|
41
41
|
|
|
42
42
|
export class Polyline extends BaseEdge {
|
|
@@ -6,7 +6,7 @@ import { getCurveControlPoint, getQuadraticPath } from '../../utils/edge';
|
|
|
6
6
|
import type { BaseEdgeStyleProps } from './base-edge';
|
|
7
7
|
import { BaseEdge } from './base-edge';
|
|
8
8
|
|
|
9
|
-
export
|
|
9
|
+
export interface QuadraticStyleProps extends BaseEdgeStyleProps {
|
|
10
10
|
/**
|
|
11
11
|
* <zh/> 控制点,用于定义曲线的形状。如果不指定,将会通过`curveOffset`和`curvePosition`来计算控制点
|
|
12
12
|
* <en/> Control point. 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 QuadraticStyleProps = BaseEdgeStyleProps & {
|
|
|
22
22
|
* <en/> The distance of the control point from the line
|
|
23
23
|
*/
|
|
24
24
|
curveOffset?: number;
|
|
25
|
-
}
|
|
25
|
+
}
|
|
26
26
|
|
|
27
27
|
type ParsedQuadraticStyleProps = Required<QuadraticStyleProps>;
|
|
28
28
|
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DisplayObject, DisplayObjectConfig, Group } from '@antv/g';
|
|
2
2
|
import { Circle as GCircle } from '@antv/g';
|
|
3
|
+
import type { ID } from '@antv/graphlib';
|
|
3
4
|
import { deepMix, isEmpty } from '@antv/util';
|
|
4
5
|
import type { CategoricalPalette } from '../../palettes/types';
|
|
6
|
+
import type { NodeData } from '../../spec';
|
|
5
7
|
import type {
|
|
6
8
|
BadgePlacement,
|
|
7
|
-
|
|
9
|
+
BaseElementStyleProps,
|
|
8
10
|
Keyframe,
|
|
9
11
|
LabelPlacement,
|
|
12
|
+
Node,
|
|
10
13
|
Placement,
|
|
11
14
|
Point,
|
|
12
15
|
Port,
|
|
13
16
|
PortPlacement,
|
|
14
17
|
PortStyleProps,
|
|
15
18
|
PrefixObject,
|
|
19
|
+
Size,
|
|
16
20
|
} from '../../types';
|
|
17
21
|
import { getPortXYByPlacement, getTextStyleByPlacement, isSimplePort } from '../../utils/element';
|
|
18
22
|
import { getPaletteColors } from '../../utils/palette';
|
|
@@ -24,8 +28,108 @@ import { getWordWrapWidthByBox } from '../../utils/text';
|
|
|
24
28
|
import type { BadgeStyleProps, IconStyleProps, LabelStyleProps } from '../shapes';
|
|
25
29
|
import { Badge, BaseShape, Icon, Label } from '../shapes';
|
|
26
30
|
|
|
27
|
-
export type BaseNodeStyleProps<
|
|
28
|
-
|
|
31
|
+
export type BaseNodeStyleProps<T extends Record<string, unknown> = Record<string, any>> = T &
|
|
32
|
+
BaseElementStyleProps &
|
|
33
|
+
PrefixObject<NodeLabelStyleProps, 'label'> &
|
|
34
|
+
PrefixObject<T, 'halo'> &
|
|
35
|
+
PrefixObject<IconStyleProps, 'icon'> &
|
|
36
|
+
PrefixObject<BadgeStyleProps, 'badge'> &
|
|
37
|
+
PrefixObject<PortStyleProps, 'port'> & {
|
|
38
|
+
/**
|
|
39
|
+
* <zh/> x 坐标
|
|
40
|
+
*
|
|
41
|
+
* <en/> The x-coordinate of node
|
|
42
|
+
*/
|
|
43
|
+
x?: number | string;
|
|
44
|
+
/**
|
|
45
|
+
* <zh/> y 坐标
|
|
46
|
+
*
|
|
47
|
+
* <en/> The y-coordinate of node
|
|
48
|
+
*/
|
|
49
|
+
y?: number | string;
|
|
50
|
+
/**
|
|
51
|
+
* <zh/> z 坐标
|
|
52
|
+
*
|
|
53
|
+
* <en/> The z-coordinate of node
|
|
54
|
+
*/
|
|
55
|
+
z?: number;
|
|
56
|
+
/**
|
|
57
|
+
* <zh/> 节点大小,快捷设置节点宽高
|
|
58
|
+
*
|
|
59
|
+
* <en/> The size of node, which is a shortcut to set the width and height of node
|
|
60
|
+
*/
|
|
61
|
+
size?: Size;
|
|
62
|
+
/**
|
|
63
|
+
* <zh/> 主色
|
|
64
|
+
*
|
|
65
|
+
* <en/> Subject color
|
|
66
|
+
*/
|
|
67
|
+
color?: string;
|
|
68
|
+
/**
|
|
69
|
+
* @deprecated
|
|
70
|
+
* <zh/> 解决类型 style.getPropertyValue 问题,不要使用该属性
|
|
71
|
+
*
|
|
72
|
+
* <en/> Solve the problem of style.getPropertyValue, do not use this property
|
|
73
|
+
* @description
|
|
74
|
+
* <zh/> 移除该属性会导致 Polygon 及其子类与 Node 不兼容
|
|
75
|
+
*
|
|
76
|
+
* <en/> Removing this property will cause Polygon and its subclasses to be incompatible with Node
|
|
77
|
+
* @ignore
|
|
78
|
+
*/
|
|
79
|
+
points?: ([number, number] | [number, number, number])[];
|
|
80
|
+
/**
|
|
81
|
+
* <zh/> 父节点 id
|
|
82
|
+
* <en/> The id of the parent node/combo
|
|
83
|
+
*/
|
|
84
|
+
parentId?: ID;
|
|
85
|
+
/**
|
|
86
|
+
* <zh/> 是否收起
|
|
87
|
+
*
|
|
88
|
+
* <en/> Indicates whether the node is collapsed
|
|
89
|
+
*/
|
|
90
|
+
collapsed?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* <zh/> 子节点实例
|
|
93
|
+
*
|
|
94
|
+
* <en/> The instance of the child node
|
|
95
|
+
*/
|
|
96
|
+
childrenNode?: Node[];
|
|
97
|
+
/**
|
|
98
|
+
* <zh/> 子节点数据
|
|
99
|
+
*
|
|
100
|
+
* <en/> The data of the child node
|
|
101
|
+
*/
|
|
102
|
+
childrenData?: NodeData[];
|
|
103
|
+
/**
|
|
104
|
+
* <zh/> 是否显示节点标签
|
|
105
|
+
*
|
|
106
|
+
* <en/> Whether to show the node label
|
|
107
|
+
*/
|
|
108
|
+
label?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* <zh/> 是否显示节点光环
|
|
111
|
+
*
|
|
112
|
+
* <en/> Whether to show the node halo
|
|
113
|
+
*/
|
|
114
|
+
halo?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* <zh/> 是否显示节点图标
|
|
117
|
+
*
|
|
118
|
+
* <en/> Whether to show the node icon
|
|
119
|
+
*/
|
|
120
|
+
icon?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* <zh/> 是否显示节点徽标
|
|
123
|
+
*
|
|
124
|
+
* <en/> Whether to show the node badge
|
|
125
|
+
*/
|
|
126
|
+
badge?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* <zh/> 是否显示连接桩
|
|
129
|
+
*
|
|
130
|
+
* <en/> Whether to show the node port
|
|
131
|
+
*/
|
|
132
|
+
port?: boolean;
|
|
29
133
|
/**
|
|
30
134
|
* <zh/> 连接桩
|
|
31
135
|
* <en/> Port
|
|
@@ -41,11 +145,7 @@ export type BaseNodeStyleProps<H extends BaseStyleProps = BaseNodeProps> = BaseN
|
|
|
41
145
|
* <en/> Badge background color palette
|
|
42
146
|
*/
|
|
43
147
|
badgePalette?: string[] | CategoricalPalette;
|
|
44
|
-
}
|
|
45
|
-
PrefixObject<H, 'halo'> &
|
|
46
|
-
PrefixObject<IconStyleProps, 'icon'> &
|
|
47
|
-
PrefixObject<BadgeStyleProps, 'badge'> &
|
|
48
|
-
PrefixObject<PortStyleProps, 'port'>;
|
|
148
|
+
};
|
|
49
149
|
|
|
50
150
|
/**
|
|
51
151
|
* Design document: https://www.yuque.com/antv/g6/gl1iof1xpzg6ed98
|
|
@@ -53,7 +153,7 @@ export type BaseNodeStyleProps<H extends BaseStyleProps = BaseNodeProps> = BaseN
|
|
|
53
153
|
* The P is the StyleProps of Key Shape.
|
|
54
154
|
* The KeyShape is the type of the key shape.
|
|
55
155
|
*/
|
|
56
|
-
export abstract class BaseNode<S extends BaseNodeStyleProps =
|
|
156
|
+
export abstract class BaseNode<S extends BaseNodeStyleProps = BaseNodeStyleProps> extends BaseShape<S> {
|
|
57
157
|
public type = 'node';
|
|
58
158
|
|
|
59
159
|
static defaultStyleProps: Partial<BaseNodeStyleProps> = {
|
|
@@ -90,7 +190,11 @@ export abstract class BaseNode<S extends BaseNodeStyleProps = any> extends BaseS
|
|
|
90
190
|
super(deepMix({}, { style: BaseNode.defaultStyleProps }, options));
|
|
91
191
|
}
|
|
92
192
|
|
|
93
|
-
|
|
193
|
+
public get parsedAttributes() {
|
|
194
|
+
return this.attributes as Required<S>;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
protected getSize(attributes = this.attributes) {
|
|
94
198
|
const { size } = attributes;
|
|
95
199
|
return parseSize(size);
|
|
96
200
|
}
|
|
@@ -283,7 +387,31 @@ export abstract class BaseNode<S extends BaseNodeStyleProps = any> extends BaseS
|
|
|
283
387
|
this.drawPortShapes(attributes, container);
|
|
284
388
|
}
|
|
285
389
|
|
|
286
|
-
|
|
390
|
+
/**
|
|
391
|
+
* <zh/> 在元素完成创建并执行完入场动画后调用
|
|
392
|
+
*
|
|
393
|
+
* <en/> Called after the element is created and the entrance animation is completed
|
|
394
|
+
* @override
|
|
395
|
+
*/
|
|
396
|
+
public onCreate() {}
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* <zh/> 在元素更新并执行完过渡动画后调用
|
|
400
|
+
*
|
|
401
|
+
* <en/> Called after the element is updated and the transition animation is completed
|
|
402
|
+
* @override
|
|
403
|
+
*/
|
|
404
|
+
public onUpdate() {}
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* <zh/> 在元素完成退场动画并销毁后调用
|
|
408
|
+
*
|
|
409
|
+
* <en/> Called after the element completes the exit animation and is destroyed
|
|
410
|
+
* @override
|
|
411
|
+
*/
|
|
412
|
+
public onDestroy() {}
|
|
413
|
+
|
|
414
|
+
public animate(keyframes: Keyframe[], options?: number | KeyframeAnimationOptions) {
|
|
287
415
|
const result = super.animate(keyframes, options);
|
|
288
416
|
|
|
289
417
|
if (result) {
|
|
@@ -328,11 +456,3 @@ export type NodePortStyleProps = Partial<PortStyleProps> & {
|
|
|
328
456
|
*/
|
|
329
457
|
placement: Placement;
|
|
330
458
|
};
|
|
331
|
-
|
|
332
|
-
type ShapeSwitch = {
|
|
333
|
-
label?: boolean;
|
|
334
|
-
halo?: boolean;
|
|
335
|
-
icon?: boolean;
|
|
336
|
-
badge?: boolean;
|
|
337
|
-
port?: boolean;
|
|
338
|
-
};
|