@antv/g6 5.0.0-beta.35 → 5.0.0-beta.37
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/LICENSE +21 -0
- package/dist/g6.min.js +2 -2
- package/dist/lib/animations/types.d.ts +4 -4
- package/dist/lib/behaviors/brush-select.d.ts +125 -57
- package/dist/lib/behaviors/click-element.d.ts +17 -17
- package/dist/lib/behaviors/collapse-expand.d.ts +15 -1
- package/dist/lib/behaviors/create-edge.d.ts +25 -4
- package/dist/lib/behaviors/drag-canvas.d.ts +27 -8
- package/dist/lib/behaviors/drag-element-force.d.ts +44 -4
- package/dist/lib/behaviors/drag-element.d.ts +105 -25
- package/dist/lib/behaviors/focus-element.d.ts +18 -6
- package/dist/lib/behaviors/hover-element.d.ts +28 -6
- package/dist/lib/behaviors/lasso-select.d.ts +34 -13
- package/dist/lib/behaviors/scroll-canvas.d.ts +33 -12
- package/dist/lib/behaviors/types.d.ts +0 -1
- package/dist/lib/behaviors/zoom-canvas.d.ts +42 -15
- package/dist/lib/constants/change.d.ts +50 -1
- package/dist/lib/constants/element.d.ts +3 -2
- package/dist/lib/constants/events/canvas.d.ts +90 -18
- package/dist/lib/constants/events/common.d.ts +100 -20
- package/dist/lib/constants/events/container.d.ts +10 -2
- package/dist/lib/constants/events/edge.d.ts +70 -14
- package/dist/lib/constants/events/graph.d.ts +140 -28
- package/dist/lib/constants/events/history.d.ts +38 -0
- package/dist/lib/constants/events/index.d.ts +1 -0
- package/dist/lib/constants/events/node.d.ts +85 -17
- package/dist/lib/constants/registry.d.ts +50 -10
- package/dist/lib/elements/combos/base-combo.d.ts +32 -22
- package/dist/lib/elements/combos/circle.d.ts +14 -2
- package/dist/lib/elements/combos/rect.d.ts +12 -2
- package/dist/lib/elements/edges/base-edge.d.ts +63 -27
- package/dist/lib/elements/edges/cubic-horizontal.d.ts +18 -0
- package/dist/lib/elements/edges/cubic-vertical.d.ts +18 -0
- package/dist/lib/elements/edges/cubic.d.ts +19 -1
- package/dist/lib/elements/edges/line.d.ts +12 -2
- package/dist/lib/elements/edges/polyline.d.ts +21 -0
- package/dist/lib/elements/edges/quadratic.d.ts +15 -0
- package/dist/lib/elements/nodes/base-node.d.ts +67 -61
- package/dist/lib/elements/nodes/circle.d.ts +10 -2
- package/dist/lib/elements/nodes/diamond.d.ts +12 -4
- package/dist/lib/elements/nodes/donut.d.ts +20 -20
- package/dist/lib/elements/nodes/ellipse.d.ts +12 -1
- package/dist/lib/elements/nodes/hexagon.d.ts +17 -7
- package/dist/lib/elements/nodes/html.d.ts +17 -4
- package/dist/lib/elements/nodes/image.d.ts +22 -2
- package/dist/lib/elements/nodes/rect.d.ts +10 -2
- package/dist/lib/elements/nodes/star.d.ts +18 -9
- package/dist/lib/elements/nodes/triangle.d.ts +17 -7
- package/dist/lib/elements/shapes/badge.d.ts +3 -2
- package/dist/lib/elements/shapes/base-shape.d.ts +2 -3
- package/dist/lib/elements/shapes/contour.d.ts +27 -10
- package/dist/lib/elements/shapes/icon.d.ts +3 -2
- package/dist/lib/elements/shapes/index.d.ts +1 -0
- package/dist/lib/elements/shapes/label.d.ts +14 -5
- package/dist/lib/elements/shapes/polygon.d.ts +29 -0
- package/dist/lib/exports.d.ts +18 -8
- package/dist/lib/layouts/base-layout.d.ts +10 -0
- package/dist/lib/layouts/index.d.ts +1 -0
- package/dist/lib/layouts/types.d.ts +11 -4
- package/dist/lib/plugins/base-plugin.d.ts +2 -1
- package/dist/lib/plugins/bubble-sets.d.ts +71 -0
- package/dist/lib/plugins/camera-setting.d.ts +24 -10
- package/dist/lib/plugins/contextmenu.d.ts +63 -40
- package/dist/lib/plugins/grid-line.d.ts +35 -2
- package/dist/lib/plugins/history/index.d.ts +48 -10
- package/dist/lib/plugins/history/utils.d.ts +1 -11
- package/dist/lib/plugins/hull/index.d.ts +28 -4
- package/dist/lib/plugins/legend.d.ts +95 -15
- package/dist/lib/plugins/timebar.d.ts +24 -15
- package/dist/lib/plugins/toolbar/index.d.ts +35 -28
- package/dist/lib/plugins/toolbar/util.d.ts +9 -10
- package/dist/lib/plugins/tooltip.d.ts +93 -18
- package/dist/lib/plugins/watermark.d.ts +173 -33
- package/dist/lib/registry/types.d.ts +2 -2
- package/dist/lib/runtime/behavior.d.ts +5 -1
- package/dist/lib/runtime/canvas.d.ts +2 -0
- package/dist/lib/runtime/data.d.ts +6 -6
- package/dist/lib/runtime/element.d.ts +3 -4
- package/dist/lib/runtime/graph.d.ts +7 -7
- package/dist/lib/runtime/layout.d.ts +5 -17
- package/dist/lib/spec/behavior.d.ts +20 -2
- package/dist/lib/spec/canvas.d.ts +9 -2
- package/dist/lib/spec/data.d.ts +93 -2
- package/dist/lib/spec/element/combo.d.ts +5 -13
- package/dist/lib/spec/element/edge.d.ts +1 -8
- package/dist/lib/spec/element/node.d.ts +1 -14
- package/dist/lib/spec/graph.d.ts +4 -4
- package/dist/lib/spec/plugin.d.ts +22 -2
- package/dist/lib/spec/viewport.d.ts +19 -23
- package/dist/lib/types/combo.d.ts +23 -0
- package/dist/lib/types/edge.d.ts +73 -9
- package/dist/lib/types/element.d.ts +3 -0
- package/dist/lib/types/event.d.ts +14 -2
- package/dist/lib/types/history.d.ts +51 -0
- package/dist/lib/types/index.d.ts +2 -0
- package/dist/lib/types/layout.d.ts +9 -0
- package/dist/lib/types/node.d.ts +111 -7
- package/dist/lib/types/point.d.ts +1 -2
- package/dist/lib/types/prefix.d.ts +11 -1
- package/dist/lib/types/viewport.d.ts +1 -3
- package/dist/lib/utils/animation.d.ts +2 -16
- package/dist/lib/utils/bbox.d.ts +1 -2
- package/dist/lib/utils/dom.d.ts +6 -0
- package/dist/lib/utils/edge.d.ts +11 -2
- package/dist/lib/utils/element.d.ts +7 -9
- package/dist/lib/utils/layout.d.ts +45 -0
- package/dist/lib/utils/point.d.ts +11 -2
- package/dist/lib/utils/transform.d.ts +10 -0
- package/dist/lib/utils/watermark.d.ts +1 -1
- package/esm/animations/executor.js +23 -11
- package/esm/animations/executor.js.map +1 -1
- package/esm/animations/types.d.ts +4 -4
- package/esm/behaviors/brush-select.d.ts +125 -57
- package/esm/behaviors/brush-select.js +182 -113
- package/esm/behaviors/brush-select.js.map +1 -1
- package/esm/behaviors/click-element.d.ts +17 -17
- package/esm/behaviors/click-element.js +3 -5
- package/esm/behaviors/click-element.js.map +1 -1
- package/esm/behaviors/collapse-expand.d.ts +15 -1
- package/esm/behaviors/collapse-expand.js +9 -0
- package/esm/behaviors/collapse-expand.js.map +1 -1
- package/esm/behaviors/create-edge.d.ts +25 -4
- package/esm/behaviors/create-edge.js +14 -0
- package/esm/behaviors/create-edge.js.map +1 -1
- package/esm/behaviors/drag-canvas.d.ts +27 -8
- package/esm/behaviors/drag-canvas.js +24 -0
- package/esm/behaviors/drag-canvas.js.map +1 -1
- package/esm/behaviors/drag-element-force.d.ts +44 -4
- package/esm/behaviors/drag-element-force.js +47 -8
- package/esm/behaviors/drag-element-force.js.map +1 -1
- package/esm/behaviors/drag-element.d.ts +105 -25
- package/esm/behaviors/drag-element.js +73 -0
- package/esm/behaviors/drag-element.js.map +1 -1
- package/esm/behaviors/focus-element.d.ts +18 -6
- package/esm/behaviors/focus-element.js +16 -15
- package/esm/behaviors/focus-element.js.map +1 -1
- package/esm/behaviors/hover-element.d.ts +28 -6
- package/esm/behaviors/hover-element.js +9 -0
- package/esm/behaviors/hover-element.js.map +1 -1
- package/esm/behaviors/lasso-select.d.ts +34 -13
- package/esm/behaviors/lasso-select.js +43 -56
- package/esm/behaviors/lasso-select.js.map +1 -1
- package/esm/behaviors/scroll-canvas.d.ts +33 -12
- package/esm/behaviors/scroll-canvas.js +21 -0
- package/esm/behaviors/scroll-canvas.js.map +1 -1
- package/esm/behaviors/types.d.ts +0 -1
- package/esm/behaviors/zoom-canvas.d.ts +42 -15
- package/esm/behaviors/zoom-canvas.js +26 -1
- package/esm/behaviors/zoom-canvas.js.map +1 -1
- package/esm/constants/change.d.ts +50 -1
- package/esm/constants/change.js +50 -1
- package/esm/constants/change.js.map +1 -1
- package/esm/constants/element.d.ts +3 -2
- package/esm/constants/element.js +3 -2
- package/esm/constants/element.js.map +1 -1
- package/esm/constants/events/canvas.d.ts +90 -18
- package/esm/constants/events/canvas.js +90 -18
- package/esm/constants/events/canvas.js.map +1 -1
- package/esm/constants/events/common.d.ts +100 -20
- package/esm/constants/events/common.js +100 -20
- package/esm/constants/events/common.js.map +1 -1
- package/esm/constants/events/container.d.ts +10 -2
- package/esm/constants/events/container.js +10 -2
- package/esm/constants/events/container.js.map +1 -1
- package/esm/constants/events/edge.d.ts +70 -14
- package/esm/constants/events/edge.js +70 -14
- package/esm/constants/events/edge.js.map +1 -1
- package/esm/constants/events/graph.d.ts +140 -28
- package/esm/constants/events/graph.js +140 -28
- package/esm/constants/events/graph.js.map +1 -1
- package/esm/constants/events/history.d.ts +38 -0
- package/esm/constants/events/history.js +40 -0
- package/esm/constants/events/history.js.map +1 -0
- package/esm/constants/events/index.d.ts +1 -0
- package/esm/constants/events/index.js +1 -0
- package/esm/constants/events/index.js.map +1 -1
- package/esm/constants/events/node.d.ts +85 -17
- package/esm/constants/events/node.js +85 -17
- package/esm/constants/events/node.js.map +1 -1
- package/esm/constants/registry.d.ts +50 -10
- package/esm/constants/registry.js +50 -10
- package/esm/constants/registry.js.map +1 -1
- package/esm/elements/combos/base-combo.d.ts +32 -22
- package/esm/elements/combos/base-combo.js +11 -1
- package/esm/elements/combos/base-combo.js.map +1 -1
- package/esm/elements/combos/circle.d.ts +14 -2
- package/esm/elements/combos/circle.js +10 -0
- package/esm/elements/combos/circle.js.map +1 -1
- package/esm/elements/combos/rect.d.ts +12 -2
- package/esm/elements/combos/rect.js +8 -5
- package/esm/elements/combos/rect.js.map +1 -1
- package/esm/elements/edges/base-edge.d.ts +63 -27
- package/esm/elements/edges/base-edge.js +9 -6
- package/esm/elements/edges/base-edge.js.map +1 -1
- package/esm/elements/edges/cubic-horizontal.d.ts +18 -0
- package/esm/elements/edges/cubic-horizontal.js +9 -0
- package/esm/elements/edges/cubic-horizontal.js.map +1 -1
- package/esm/elements/edges/cubic-vertical.d.ts +18 -0
- package/esm/elements/edges/cubic-vertical.js +9 -0
- package/esm/elements/edges/cubic-vertical.js.map +1 -1
- package/esm/elements/edges/cubic.d.ts +19 -1
- package/esm/elements/edges/cubic.js +8 -0
- package/esm/elements/edges/cubic.js.map +1 -1
- package/esm/elements/edges/line.d.ts +12 -2
- package/esm/elements/edges/line.js +5 -1
- package/esm/elements/edges/line.js.map +1 -1
- package/esm/elements/edges/polyline.d.ts +21 -0
- package/esm/elements/edges/polyline.js +5 -0
- package/esm/elements/edges/polyline.js.map +1 -1
- package/esm/elements/edges/quadratic.d.ts +15 -0
- package/esm/elements/edges/quadratic.js +5 -0
- package/esm/elements/edges/quadratic.js.map +1 -1
- package/esm/elements/nodes/base-node.d.ts +67 -61
- package/esm/elements/nodes/base-node.js +19 -5
- package/esm/elements/nodes/base-node.js.map +1 -1
- package/esm/elements/nodes/circle.d.ts +10 -2
- package/esm/elements/nodes/circle.js +3 -1
- package/esm/elements/nodes/circle.js.map +1 -1
- package/esm/elements/nodes/diamond.d.ts +12 -4
- package/esm/elements/nodes/diamond.js +4 -2
- package/esm/elements/nodes/diamond.js.map +1 -1
- package/esm/elements/nodes/donut.d.ts +20 -20
- package/esm/elements/nodes/donut.js +20 -7
- package/esm/elements/nodes/donut.js.map +1 -1
- package/esm/elements/nodes/ellipse.d.ts +12 -1
- package/esm/elements/nodes/ellipse.js +5 -0
- package/esm/elements/nodes/ellipse.js.map +1 -1
- package/esm/elements/nodes/hexagon.d.ts +17 -7
- package/esm/elements/nodes/hexagon.js +6 -1
- package/esm/elements/nodes/hexagon.js.map +1 -1
- package/esm/elements/nodes/html.d.ts +17 -4
- package/esm/elements/nodes/html.js +9 -3
- package/esm/elements/nodes/html.js.map +1 -1
- package/esm/elements/nodes/image.d.ts +22 -2
- package/esm/elements/nodes/image.js +10 -3
- package/esm/elements/nodes/image.js.map +1 -1
- package/esm/elements/nodes/rect.d.ts +10 -2
- package/esm/elements/nodes/rect.js +5 -2
- package/esm/elements/nodes/rect.js.map +1 -1
- package/esm/elements/nodes/star.d.ts +18 -9
- package/esm/elements/nodes/star.js +6 -1
- package/esm/elements/nodes/star.js.map +1 -1
- package/esm/elements/nodes/triangle.d.ts +17 -7
- package/esm/elements/nodes/triangle.js +6 -1
- package/esm/elements/nodes/triangle.js.map +1 -1
- package/esm/elements/shapes/badge.d.ts +3 -2
- package/esm/elements/shapes/base-shape.d.ts +2 -3
- package/esm/elements/shapes/base-shape.js +34 -5
- package/esm/elements/shapes/base-shape.js.map +1 -1
- package/esm/elements/shapes/contour.d.ts +27 -10
- package/esm/elements/shapes/contour.js +2 -2
- package/esm/elements/shapes/contour.js.map +1 -1
- package/esm/elements/shapes/icon.d.ts +3 -2
- package/esm/elements/shapes/icon.js +4 -1
- package/esm/elements/shapes/icon.js.map +1 -1
- package/esm/elements/shapes/index.d.ts +1 -0
- package/esm/elements/shapes/label.d.ts +14 -5
- package/esm/elements/shapes/label.js +2 -1
- package/esm/elements/shapes/label.js.map +1 -1
- package/esm/elements/shapes/polygon.d.ts +29 -0
- package/esm/elements/{nodes → shapes}/polygon.js +1 -1
- package/esm/elements/shapes/polygon.js.map +1 -0
- package/esm/exports.d.ts +18 -8
- package/esm/exports.js +4 -3
- package/esm/exports.js.map +1 -1
- package/esm/layouts/base-layout.d.ts +10 -0
- package/esm/layouts/base-layout.js +9 -0
- package/esm/layouts/base-layout.js.map +1 -0
- package/esm/layouts/index.d.ts +1 -0
- package/esm/layouts/index.js +1 -0
- package/esm/layouts/index.js.map +1 -1
- package/esm/layouts/types.d.ts +11 -4
- package/esm/plugins/base-plugin.d.ts +2 -1
- package/esm/plugins/bubble-sets.d.ts +71 -0
- package/esm/plugins/bubble-sets.js +70 -3
- package/esm/plugins/bubble-sets.js.map +1 -1
- package/esm/plugins/camera-setting.d.ts +24 -10
- package/esm/plugins/camera-setting.js +7 -0
- package/esm/plugins/camera-setting.js.map +1 -1
- package/esm/plugins/contextmenu.d.ts +63 -40
- package/esm/plugins/contextmenu.js +43 -34
- package/esm/plugins/contextmenu.js.map +1 -1
- package/esm/plugins/grid-line.d.ts +35 -2
- package/esm/plugins/grid-line.js +26 -7
- package/esm/plugins/grid-line.js.map +1 -1
- package/esm/plugins/history/index.d.ts +48 -10
- package/esm/plugins/history/index.js +38 -11
- package/esm/plugins/history/index.js.map +1 -1
- package/esm/plugins/history/utils.d.ts +1 -11
- package/esm/plugins/history/utils.js.map +1 -1
- package/esm/plugins/hull/index.d.ts +28 -4
- package/esm/plugins/hull/index.js +26 -5
- package/esm/plugins/hull/index.js.map +1 -1
- package/esm/plugins/legend.d.ts +95 -15
- package/esm/plugins/legend.js +64 -15
- package/esm/plugins/legend.js.map +1 -1
- package/esm/plugins/timebar.d.ts +24 -15
- package/esm/plugins/timebar.js +8 -0
- package/esm/plugins/timebar.js.map +1 -1
- package/esm/plugins/toolbar/index.d.ts +35 -28
- package/esm/plugins/toolbar/index.js +11 -8
- package/esm/plugins/toolbar/index.js.map +1 -1
- package/esm/plugins/toolbar/util.d.ts +9 -10
- package/esm/plugins/toolbar/util.js +2 -1
- package/esm/plugins/toolbar/util.js.map +1 -1
- package/esm/plugins/tooltip.d.ts +93 -18
- package/esm/plugins/tooltip.js +99 -36
- package/esm/plugins/tooltip.js.map +1 -1
- package/esm/plugins/watermark.d.ts +173 -33
- package/esm/plugins/watermark.js +23 -9
- package/esm/plugins/watermark.js.map +1 -1
- package/esm/registry/index.js +6 -4
- package/esm/registry/index.js.map +1 -1
- package/esm/registry/types.d.ts +2 -2
- package/esm/runtime/behavior.d.ts +5 -1
- package/esm/runtime/behavior.js +5 -1
- package/esm/runtime/behavior.js.map +1 -1
- package/esm/runtime/canvas.d.ts +2 -0
- package/esm/runtime/canvas.js +18 -2
- package/esm/runtime/canvas.js.map +1 -1
- package/esm/runtime/data.d.ts +6 -6
- package/esm/runtime/data.js +27 -30
- package/esm/runtime/data.js.map +1 -1
- package/esm/runtime/element.d.ts +3 -4
- package/esm/runtime/element.js +31 -27
- package/esm/runtime/element.js.map +1 -1
- package/esm/runtime/graph.d.ts +7 -7
- package/esm/runtime/graph.js +13 -17
- package/esm/runtime/graph.js.map +1 -1
- package/esm/runtime/layout.d.ts +5 -17
- package/esm/runtime/layout.js +38 -130
- package/esm/runtime/layout.js.map +1 -1
- package/esm/spec/behavior.d.ts +20 -2
- package/esm/spec/canvas.d.ts +9 -2
- package/esm/spec/data.d.ts +93 -2
- package/esm/spec/element/combo.d.ts +5 -13
- package/esm/spec/element/edge.d.ts +1 -8
- package/esm/spec/element/node.d.ts +1 -14
- package/esm/spec/graph.d.ts +4 -4
- package/esm/spec/plugin.d.ts +22 -2
- package/esm/spec/viewport.d.ts +19 -23
- package/esm/themes/base.js +17 -8
- package/esm/themes/base.js.map +1 -1
- package/esm/transforms/arrange-draw-order.js +17 -12
- package/esm/transforms/arrange-draw-order.js.map +1 -1
- package/esm/transforms/collapse-expand-combo.js +29 -20
- package/esm/transforms/collapse-expand-combo.js.map +1 -1
- package/esm/types/combo.d.ts +23 -0
- package/esm/types/combo.js +2 -0
- package/esm/types/combo.js.map +1 -0
- package/esm/types/edge.d.ts +73 -9
- package/esm/types/element.d.ts +3 -0
- package/esm/types/event.d.ts +14 -2
- package/esm/types/history.d.ts +51 -0
- package/esm/types/history.js +2 -0
- package/esm/types/history.js.map +1 -0
- package/esm/types/index.d.ts +2 -0
- package/esm/types/layout.d.ts +9 -0
- package/esm/types/layout.js +2 -0
- package/esm/types/layout.js.map +1 -0
- package/esm/types/node.d.ts +111 -7
- package/esm/types/point.d.ts +1 -2
- package/esm/types/prefix.d.ts +11 -1
- package/esm/types/viewport.d.ts +1 -3
- package/esm/utils/animation.d.ts +2 -16
- package/esm/utils/animation.js +0 -35
- package/esm/utils/animation.js.map +1 -1
- package/esm/utils/bbox.d.ts +1 -2
- package/esm/utils/bbox.js.map +1 -1
- package/esm/utils/dom.d.ts +6 -0
- package/esm/utils/dom.js +14 -0
- package/esm/utils/dom.js.map +1 -1
- package/esm/utils/edge.d.ts +11 -2
- package/esm/utils/edge.js +28 -4
- package/esm/utils/edge.js.map +1 -1
- package/esm/utils/element.d.ts +7 -9
- package/esm/utils/element.js +5 -4
- package/esm/utils/element.js.map +1 -1
- package/esm/utils/id.js +1 -1
- package/esm/utils/id.js.map +1 -1
- package/esm/utils/layout.d.ts +45 -0
- package/esm/utils/layout.js +167 -1
- package/esm/utils/layout.js.map +1 -1
- package/esm/utils/point.d.ts +11 -2
- package/esm/utils/point.js +30 -28
- package/esm/utils/point.js.map +1 -1
- package/esm/utils/polygon.js +3 -6
- package/esm/utils/polygon.js.map +1 -1
- package/esm/utils/prefix.js +15 -2
- package/esm/utils/prefix.js.map +1 -1
- package/esm/utils/symbol.js +27 -15
- package/esm/utils/symbol.js.map +1 -1
- package/esm/utils/transform.d.ts +10 -0
- package/esm/utils/transform.js +19 -0
- package/esm/utils/transform.js.map +1 -0
- package/esm/utils/tree.js +2 -2
- package/esm/utils/tree.js.map +1 -1
- package/esm/utils/watermark.d.ts +1 -1
- package/esm/utils/watermark.js +1 -1
- package/lib/animations/executor.js +22 -10
- package/lib/animations/executor.js.map +1 -1
- package/lib/animations/types.d.ts +4 -4
- package/lib/behaviors/brush-select.d.ts +125 -57
- package/lib/behaviors/brush-select.js +183 -113
- package/lib/behaviors/brush-select.js.map +1 -1
- package/lib/behaviors/click-element.d.ts +17 -17
- package/lib/behaviors/click-element.js +3 -5
- package/lib/behaviors/click-element.js.map +1 -1
- package/lib/behaviors/collapse-expand.d.ts +15 -1
- package/lib/behaviors/collapse-expand.js +9 -0
- package/lib/behaviors/collapse-expand.js.map +1 -1
- package/lib/behaviors/create-edge.d.ts +25 -4
- package/lib/behaviors/create-edge.js +14 -0
- package/lib/behaviors/create-edge.js.map +1 -1
- package/lib/behaviors/drag-canvas.d.ts +27 -8
- package/lib/behaviors/drag-canvas.js +24 -0
- package/lib/behaviors/drag-canvas.js.map +1 -1
- package/lib/behaviors/drag-element-force.d.ts +44 -4
- package/lib/behaviors/drag-element-force.js +47 -8
- package/lib/behaviors/drag-element-force.js.map +1 -1
- package/lib/behaviors/drag-element.d.ts +105 -25
- package/lib/behaviors/drag-element.js +73 -0
- package/lib/behaviors/drag-element.js.map +1 -1
- package/lib/behaviors/focus-element.d.ts +18 -6
- package/lib/behaviors/focus-element.js +16 -15
- package/lib/behaviors/focus-element.js.map +1 -1
- package/lib/behaviors/hover-element.d.ts +28 -6
- package/lib/behaviors/hover-element.js +9 -0
- package/lib/behaviors/hover-element.js.map +1 -1
- package/lib/behaviors/lasso-select.d.ts +34 -13
- package/lib/behaviors/lasso-select.js +42 -55
- package/lib/behaviors/lasso-select.js.map +1 -1
- package/lib/behaviors/scroll-canvas.d.ts +33 -12
- package/lib/behaviors/scroll-canvas.js +21 -0
- package/lib/behaviors/scroll-canvas.js.map +1 -1
- package/lib/behaviors/types.d.ts +0 -1
- package/lib/behaviors/zoom-canvas.d.ts +42 -15
- package/lib/behaviors/zoom-canvas.js +26 -1
- package/lib/behaviors/zoom-canvas.js.map +1 -1
- package/lib/constants/change.d.ts +50 -1
- package/lib/constants/change.js +50 -1
- package/lib/constants/change.js.map +1 -1
- package/lib/constants/element.d.ts +3 -2
- package/lib/constants/element.js +3 -2
- package/lib/constants/element.js.map +1 -1
- package/lib/constants/events/canvas.d.ts +90 -18
- package/lib/constants/events/canvas.js +90 -18
- package/lib/constants/events/canvas.js.map +1 -1
- package/lib/constants/events/common.d.ts +100 -20
- package/lib/constants/events/common.js +100 -20
- package/lib/constants/events/common.js.map +1 -1
- package/lib/constants/events/container.d.ts +10 -2
- package/lib/constants/events/container.js +10 -2
- package/lib/constants/events/container.js.map +1 -1
- package/lib/constants/events/edge.d.ts +70 -14
- package/lib/constants/events/edge.js +70 -14
- package/lib/constants/events/edge.js.map +1 -1
- package/lib/constants/events/graph.d.ts +140 -28
- package/lib/constants/events/graph.js +140 -28
- package/lib/constants/events/graph.js.map +1 -1
- package/lib/constants/events/history.d.ts +38 -0
- package/lib/constants/events/history.js +43 -0
- package/lib/constants/events/history.js.map +1 -0
- package/lib/constants/events/index.d.ts +1 -0
- package/lib/constants/events/index.js +3 -1
- package/lib/constants/events/index.js.map +1 -1
- package/lib/constants/events/node.d.ts +85 -17
- package/lib/constants/events/node.js +85 -17
- package/lib/constants/events/node.js.map +1 -1
- package/lib/constants/registry.d.ts +50 -10
- package/lib/constants/registry.js +50 -10
- package/lib/constants/registry.js.map +1 -1
- package/lib/elements/combos/base-combo.d.ts +32 -22
- package/lib/elements/combos/base-combo.js +11 -1
- package/lib/elements/combos/base-combo.js.map +1 -1
- package/lib/elements/combos/circle.d.ts +14 -2
- package/lib/elements/combos/circle.js +10 -0
- package/lib/elements/combos/circle.js.map +1 -1
- package/lib/elements/combos/rect.d.ts +12 -2
- package/lib/elements/combos/rect.js +8 -5
- package/lib/elements/combos/rect.js.map +1 -1
- package/lib/elements/edges/base-edge.d.ts +63 -27
- package/lib/elements/edges/base-edge.js +9 -6
- package/lib/elements/edges/base-edge.js.map +1 -1
- package/lib/elements/edges/cubic-horizontal.d.ts +18 -0
- package/lib/elements/edges/cubic-horizontal.js +9 -0
- package/lib/elements/edges/cubic-horizontal.js.map +1 -1
- package/lib/elements/edges/cubic-vertical.d.ts +18 -0
- package/lib/elements/edges/cubic-vertical.js +9 -0
- package/lib/elements/edges/cubic-vertical.js.map +1 -1
- package/lib/elements/edges/cubic.d.ts +19 -1
- package/lib/elements/edges/cubic.js +8 -0
- package/lib/elements/edges/cubic.js.map +1 -1
- package/lib/elements/edges/line.d.ts +12 -2
- package/lib/elements/edges/line.js +5 -1
- package/lib/elements/edges/line.js.map +1 -1
- package/lib/elements/edges/polyline.d.ts +21 -0
- package/lib/elements/edges/polyline.js +5 -0
- package/lib/elements/edges/polyline.js.map +1 -1
- package/lib/elements/edges/quadratic.d.ts +15 -0
- package/lib/elements/edges/quadratic.js +5 -0
- package/lib/elements/edges/quadratic.js.map +1 -1
- package/lib/elements/nodes/base-node.d.ts +67 -61
- package/lib/elements/nodes/base-node.js +19 -5
- package/lib/elements/nodes/base-node.js.map +1 -1
- package/lib/elements/nodes/circle.d.ts +10 -2
- package/lib/elements/nodes/circle.js +3 -1
- package/lib/elements/nodes/circle.js.map +1 -1
- package/lib/elements/nodes/diamond.d.ts +12 -4
- package/lib/elements/nodes/diamond.js +4 -2
- package/lib/elements/nodes/diamond.js.map +1 -1
- package/lib/elements/nodes/donut.d.ts +20 -20
- package/lib/elements/nodes/donut.js +20 -7
- package/lib/elements/nodes/donut.js.map +1 -1
- package/lib/elements/nodes/ellipse.d.ts +12 -1
- package/lib/elements/nodes/ellipse.js +5 -0
- package/lib/elements/nodes/ellipse.js.map +1 -1
- package/lib/elements/nodes/hexagon.d.ts +17 -7
- package/lib/elements/nodes/hexagon.js +6 -1
- package/lib/elements/nodes/hexagon.js.map +1 -1
- package/lib/elements/nodes/html.d.ts +17 -4
- package/lib/elements/nodes/html.js +8 -2
- package/lib/elements/nodes/html.js.map +1 -1
- package/lib/elements/nodes/image.d.ts +22 -2
- package/lib/elements/nodes/image.js +10 -3
- package/lib/elements/nodes/image.js.map +1 -1
- package/lib/elements/nodes/rect.d.ts +10 -2
- package/lib/elements/nodes/rect.js +5 -2
- package/lib/elements/nodes/rect.js.map +1 -1
- package/lib/elements/nodes/star.d.ts +18 -9
- package/lib/elements/nodes/star.js +6 -1
- package/lib/elements/nodes/star.js.map +1 -1
- package/lib/elements/nodes/triangle.d.ts +17 -7
- package/lib/elements/nodes/triangle.js +6 -1
- package/lib/elements/nodes/triangle.js.map +1 -1
- package/lib/elements/shapes/badge.d.ts +3 -2
- package/lib/elements/shapes/base-shape.d.ts +2 -3
- package/lib/elements/shapes/base-shape.js +33 -4
- package/lib/elements/shapes/base-shape.js.map +1 -1
- package/lib/elements/shapes/contour.d.ts +27 -10
- package/lib/elements/shapes/contour.js +2 -2
- package/lib/elements/shapes/contour.js.map +1 -1
- package/lib/elements/shapes/icon.d.ts +3 -2
- package/lib/elements/shapes/icon.js +4 -1
- package/lib/elements/shapes/icon.js.map +1 -1
- package/lib/elements/shapes/index.d.ts +1 -0
- package/lib/elements/shapes/label.d.ts +14 -5
- package/lib/elements/shapes/label.js +2 -1
- package/lib/elements/shapes/label.js.map +1 -1
- package/lib/elements/shapes/polygon.d.ts +29 -0
- package/lib/elements/{nodes → shapes}/polygon.js +1 -1
- package/lib/elements/shapes/polygon.js.map +1 -0
- package/lib/exports.d.ts +18 -8
- package/lib/exports.js +7 -2
- package/lib/exports.js.map +1 -1
- package/lib/layouts/base-layout.d.ts +10 -0
- package/lib/layouts/base-layout.js +13 -0
- package/lib/layouts/base-layout.js.map +1 -0
- package/lib/layouts/index.d.ts +1 -0
- package/lib/layouts/index.js +3 -1
- package/lib/layouts/index.js.map +1 -1
- package/lib/layouts/types.d.ts +11 -4
- package/lib/plugins/base-plugin.d.ts +2 -1
- package/lib/plugins/bubble-sets.d.ts +71 -0
- package/lib/plugins/bubble-sets.js +70 -3
- package/lib/plugins/bubble-sets.js.map +1 -1
- package/lib/plugins/camera-setting.d.ts +24 -10
- package/lib/plugins/camera-setting.js +7 -0
- package/lib/plugins/camera-setting.js.map +1 -1
- package/lib/plugins/contextmenu.d.ts +63 -40
- package/lib/plugins/contextmenu.js +43 -34
- package/lib/plugins/contextmenu.js.map +1 -1
- package/lib/plugins/grid-line.d.ts +35 -2
- package/lib/plugins/grid-line.js +25 -6
- package/lib/plugins/grid-line.js.map +1 -1
- package/lib/plugins/history/index.d.ts +48 -10
- package/lib/plugins/history/index.js +44 -17
- package/lib/plugins/history/index.js.map +1 -1
- package/lib/plugins/history/utils.d.ts +1 -11
- package/lib/plugins/history/utils.js.map +1 -1
- package/lib/plugins/hull/index.d.ts +28 -4
- package/lib/plugins/hull/index.js +26 -5
- package/lib/plugins/hull/index.js.map +1 -1
- package/lib/plugins/legend.d.ts +95 -15
- package/lib/plugins/legend.js +64 -15
- package/lib/plugins/legend.js.map +1 -1
- package/lib/plugins/timebar.d.ts +24 -15
- package/lib/plugins/timebar.js +8 -0
- package/lib/plugins/timebar.js.map +1 -1
- package/lib/plugins/toolbar/index.d.ts +35 -28
- package/lib/plugins/toolbar/index.js +11 -8
- package/lib/plugins/toolbar/index.js.map +1 -1
- package/lib/plugins/toolbar/util.d.ts +9 -10
- package/lib/plugins/toolbar/util.js +2 -1
- package/lib/plugins/toolbar/util.js.map +1 -1
- package/lib/plugins/tooltip.d.ts +93 -18
- package/lib/plugins/tooltip.js +99 -36
- package/lib/plugins/tooltip.js.map +1 -1
- package/lib/plugins/watermark.d.ts +173 -33
- package/lib/plugins/watermark.js +22 -8
- package/lib/plugins/watermark.js.map +1 -1
- package/lib/registry/index.js +6 -4
- package/lib/registry/index.js.map +1 -1
- package/lib/registry/types.d.ts +2 -2
- package/lib/runtime/behavior.d.ts +5 -1
- package/lib/runtime/behavior.js +5 -1
- package/lib/runtime/behavior.js.map +1 -1
- package/lib/runtime/canvas.d.ts +2 -0
- package/lib/runtime/canvas.js +18 -2
- package/lib/runtime/canvas.js.map +1 -1
- package/lib/runtime/data.d.ts +6 -6
- package/lib/runtime/data.js +27 -30
- package/lib/runtime/data.js.map +1 -1
- package/lib/runtime/element.d.ts +3 -4
- package/lib/runtime/element.js +29 -25
- package/lib/runtime/element.js.map +1 -1
- package/lib/runtime/graph.d.ts +7 -7
- package/lib/runtime/graph.js +12 -16
- package/lib/runtime/graph.js.map +1 -1
- package/lib/runtime/layout.d.ts +5 -17
- package/lib/runtime/layout.js +36 -128
- package/lib/runtime/layout.js.map +1 -1
- package/lib/spec/behavior.d.ts +20 -2
- package/lib/spec/canvas.d.ts +9 -2
- package/lib/spec/data.d.ts +93 -2
- package/lib/spec/element/combo.d.ts +5 -13
- package/lib/spec/element/edge.d.ts +1 -8
- package/lib/spec/element/node.d.ts +1 -14
- package/lib/spec/graph.d.ts +4 -4
- package/lib/spec/plugin.d.ts +22 -2
- package/lib/spec/viewport.d.ts +19 -23
- package/lib/themes/base.js +17 -8
- package/lib/themes/base.js.map +1 -1
- package/lib/transforms/arrange-draw-order.js +17 -12
- package/lib/transforms/arrange-draw-order.js.map +1 -1
- package/lib/transforms/collapse-expand-combo.js +29 -20
- package/lib/transforms/collapse-expand-combo.js.map +1 -1
- package/lib/types/combo.d.ts +23 -0
- package/lib/types/combo.js +3 -0
- package/lib/types/combo.js.map +1 -0
- package/lib/types/edge.d.ts +73 -9
- package/lib/types/element.d.ts +3 -0
- package/lib/types/event.d.ts +14 -2
- package/lib/types/history.d.ts +51 -0
- package/lib/types/history.js +3 -0
- package/lib/types/history.js.map +1 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/layout.d.ts +9 -0
- package/lib/types/layout.js +3 -0
- package/lib/types/layout.js.map +1 -0
- package/lib/types/node.d.ts +111 -7
- package/lib/types/point.d.ts +1 -2
- package/lib/types/prefix.d.ts +11 -1
- package/lib/types/viewport.d.ts +1 -3
- package/lib/utils/animation.d.ts +2 -16
- package/lib/utils/animation.js +1 -37
- package/lib/utils/animation.js.map +1 -1
- package/lib/utils/bbox.d.ts +1 -2
- package/lib/utils/bbox.js.map +1 -1
- package/lib/utils/dom.d.ts +6 -0
- package/lib/utils/dom.js +16 -1
- package/lib/utils/dom.js.map +1 -1
- package/lib/utils/edge.d.ts +11 -2
- package/lib/utils/edge.js +30 -5
- package/lib/utils/edge.js.map +1 -1
- package/lib/utils/element.d.ts +7 -9
- package/lib/utils/element.js +7 -6
- package/lib/utils/element.js.map +1 -1
- package/lib/utils/id.js +1 -1
- package/lib/utils/id.js.map +1 -1
- package/lib/utils/layout.d.ts +45 -0
- package/lib/utils/layout.js +171 -1
- package/lib/utils/layout.js.map +1 -1
- package/lib/utils/point.d.ts +11 -2
- package/lib/utils/point.js +32 -29
- package/lib/utils/point.js.map +1 -1
- package/lib/utils/polygon.js +3 -6
- package/lib/utils/polygon.js.map +1 -1
- package/lib/utils/prefix.js +15 -2
- package/lib/utils/prefix.js.map +1 -1
- package/lib/utils/symbol.js +27 -15
- package/lib/utils/symbol.js.map +1 -1
- package/lib/utils/transform.d.ts +10 -0
- package/lib/utils/transform.js +23 -0
- package/lib/utils/transform.js.map +1 -0
- package/lib/utils/tree.js +2 -2
- package/lib/utils/tree.js.map +1 -1
- package/lib/utils/watermark.d.ts +1 -1
- package/lib/utils/watermark.js +3 -3
- package/package.json +33 -34
- package/src/animations/executor.ts +34 -13
- package/src/animations/types.ts +4 -4
- package/src/behaviors/brush-select.ts +237 -167
- package/src/behaviors/click-element.ts +17 -17
- package/src/behaviors/collapse-expand.ts +15 -1
- package/src/behaviors/create-edge.ts +26 -7
- package/src/behaviors/drag-canvas.ts +31 -8
- package/src/behaviors/drag-element-force.ts +51 -13
- package/src/behaviors/drag-element.ts +106 -26
- package/src/behaviors/focus-element.ts +24 -25
- package/src/behaviors/hover-element.ts +28 -6
- package/src/behaviors/lasso-select.ts +49 -69
- package/src/behaviors/scroll-canvas.ts +37 -13
- package/src/behaviors/types.ts +0 -2
- package/src/behaviors/zoom-canvas.ts +53 -16
- package/src/constants/change.ts +50 -1
- package/src/constants/element.ts +3 -2
- package/src/constants/events/canvas.ts +90 -18
- package/src/constants/events/common.ts +100 -20
- package/src/constants/events/container.ts +10 -2
- package/src/constants/events/edge.ts +70 -14
- package/src/constants/events/graph.ts +140 -28
- package/src/constants/events/history.ts +38 -0
- package/src/constants/events/index.ts +1 -0
- package/src/constants/events/node.ts +85 -17
- package/src/constants/registry.ts +50 -10
- package/src/elements/combos/base-combo.ts +67 -59
- package/src/elements/combos/circle.ts +18 -2
- package/src/elements/combos/rect.ts +14 -7
- package/src/elements/edges/base-edge.ts +131 -105
- package/src/elements/edges/cubic-horizontal.ts +18 -0
- package/src/elements/edges/cubic-vertical.ts +18 -0
- package/src/elements/edges/cubic.ts +19 -1
- package/src/elements/edges/line.ts +11 -2
- package/src/elements/edges/polyline.ts +23 -2
- package/src/elements/edges/quadratic.ts +15 -0
- package/src/elements/nodes/base-node.ts +167 -156
- package/src/elements/nodes/circle.ts +9 -2
- package/src/elements/nodes/diamond.ts +11 -4
- package/src/elements/nodes/donut.ts +36 -28
- package/src/elements/nodes/ellipse.ts +12 -2
- package/src/elements/nodes/hexagon.ts +17 -7
- package/src/elements/nodes/html.ts +24 -6
- package/src/elements/nodes/image.ts +28 -6
- package/src/elements/nodes/rect.ts +11 -3
- package/src/elements/nodes/star.ts +18 -9
- package/src/elements/nodes/triangle.ts +17 -7
- package/src/elements/shapes/badge.ts +1 -1
- package/src/elements/shapes/base-shape.ts +39 -11
- package/src/elements/shapes/contour.ts +29 -12
- package/src/elements/shapes/icon.ts +5 -3
- package/src/elements/shapes/index.ts +1 -0
- package/src/elements/shapes/label.ts +18 -9
- package/src/elements/{nodes → shapes}/polygon.ts +22 -13
- package/src/exports.ts +44 -2
- package/src/layouts/base-layout.ts +18 -0
- package/src/layouts/index.ts +1 -0
- package/src/layouts/types.ts +14 -4
- package/src/plugins/base-plugin.ts +1 -1
- package/src/plugins/bubble-sets.ts +75 -10
- package/src/plugins/camera-setting.ts +24 -11
- package/src/plugins/contextmenu.ts +82 -59
- package/src/plugins/grid-line.ts +40 -9
- package/src/plugins/history/index.ts +51 -17
- package/src/plugins/history/utils.ts +1 -13
- package/src/plugins/hull/index.ts +35 -9
- package/src/plugins/legend.ts +120 -38
- package/src/plugins/timebar.ts +25 -15
- package/src/plugins/toolbar/index.ts +35 -29
- package/src/plugins/toolbar/util.ts +9 -11
- package/src/plugins/tooltip.ts +124 -50
- package/src/plugins/watermark.ts +177 -36
- package/src/registry/index.ts +4 -5
- package/src/registry/types.ts +2 -2
- package/src/runtime/behavior.ts +5 -1
- package/src/runtime/canvas.ts +21 -2
- package/src/runtime/data.ts +24 -27
- package/src/runtime/element.ts +37 -29
- package/src/runtime/graph.ts +18 -36
- package/src/runtime/layout.ts +53 -176
- package/src/spec/behavior.ts +20 -2
- package/src/spec/canvas.ts +9 -2
- package/src/spec/data.ts +93 -2
- package/src/spec/element/combo.ts +5 -13
- package/src/spec/element/edge.ts +1 -8
- package/src/spec/element/node.ts +1 -14
- package/src/spec/graph.ts +4 -4
- package/src/spec/plugin.ts +22 -2
- package/src/spec/viewport.ts +11 -20
- package/src/themes/base.ts +17 -8
- package/src/transforms/arrange-draw-order.ts +20 -14
- package/src/transforms/collapse-expand-combo.ts +32 -18
- package/src/types/combo.ts +24 -0
- package/src/types/edge.ts +86 -10
- package/src/types/element.ts +3 -0
- package/src/types/event.ts +14 -2
- package/src/types/history.ts +53 -0
- package/src/types/index.ts +2 -0
- package/src/types/layout.ts +12 -0
- package/src/types/node.ts +122 -7
- package/src/types/point.ts +1 -3
- package/src/types/prefix.ts +11 -1
- package/src/types/viewport.ts +1 -3
- package/src/utils/animation.ts +1 -45
- package/src/utils/bbox.ts +1 -2
- package/src/utils/dom.ts +14 -0
- package/src/utils/edge.ts +31 -6
- package/src/utils/element.ts +21 -12
- package/src/utils/id.ts +1 -1
- package/src/utils/layout.ts +203 -1
- package/src/utils/point.ts +28 -31
- package/src/utils/polygon.ts +3 -6
- package/src/utils/prefix.ts +16 -2
- package/src/utils/symbol.ts +27 -15
- package/src/utils/transform.ts +17 -0
- package/src/utils/tree.ts +3 -3
- package/src/utils/watermark.ts +1 -1
- package/dist/lib/elements/nodes/polygon.d.ts +0 -18
- package/dist/lib/plugins/history/events.d.ts +0 -21
- package/dist/lib/utils/behaviors/brush.d.ts +0 -18
- package/dist/lib/utils/behaviors/lasso.d.ts +0 -12
- package/dist/lib/utils/behaviors/utils.d.ts +0 -21
- package/esm/elements/nodes/polygon.d.ts +0 -18
- package/esm/elements/nodes/polygon.js.map +0 -1
- package/esm/plugins/history/events.d.ts +0 -21
- package/esm/plugins/history/events.js +0 -16
- package/esm/plugins/history/events.js.map +0 -1
- package/esm/utils/behaviors/brush.d.ts +0 -18
- package/esm/utils/behaviors/brush.js +0 -25
- package/esm/utils/behaviors/brush.js.map +0 -1
- package/esm/utils/behaviors/lasso.d.ts +0 -12
- package/esm/utils/behaviors/lasso.js +0 -112
- package/esm/utils/behaviors/lasso.js.map +0 -1
- package/esm/utils/behaviors/utils.d.ts +0 -21
- package/esm/utils/behaviors/utils.js +0 -42
- package/esm/utils/behaviors/utils.js.map +0 -1
- package/lib/elements/nodes/polygon.d.ts +0 -18
- package/lib/elements/nodes/polygon.js.map +0 -1
- package/lib/plugins/history/events.d.ts +0 -21
- package/lib/plugins/history/events.js +0 -19
- package/lib/plugins/history/events.js.map +0 -1
- package/lib/utils/behaviors/brush.d.ts +0 -18
- package/lib/utils/behaviors/brush.js +0 -30
- package/lib/utils/behaviors/brush.js.map +0 -1
- package/lib/utils/behaviors/lasso.d.ts +0 -12
- package/lib/utils/behaviors/lasso.js +0 -116
- package/lib/utils/behaviors/lasso.js.map +0 -1
- package/lib/utils/behaviors/utils.d.ts +0 -21
- package/lib/utils/behaviors/utils.js +0 -47
- package/lib/utils/behaviors/utils.js.map +0 -1
- package/src/plugins/history/events.ts +0 -25
- package/src/utils/behaviors/brush.ts +0 -28
- package/src/utils/behaviors/lasso.ts +0 -126
- package/src/utils/behaviors/utils.ts +0 -47
|
@@ -8,11 +8,31 @@ import type { IconStyleProps } from '../shapes';
|
|
|
8
8
|
import type { BaseNodeStyleProps } from './base-node';
|
|
9
9
|
import { BaseNode } from './base-node';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* <zh/> 图片节点样式配置项
|
|
13
|
+
*
|
|
14
|
+
* <en/> Image node style props
|
|
15
|
+
*/
|
|
16
|
+
export interface ImageStyleProps extends BaseNodeStyleProps {
|
|
17
|
+
/**
|
|
18
|
+
* <zh/> 图片来源,即图片地址字符串
|
|
19
|
+
*
|
|
20
|
+
* <en/> Image source, i.e. image address string
|
|
21
|
+
*/
|
|
12
22
|
img?: string | HTMLImageElement;
|
|
23
|
+
/**
|
|
24
|
+
* <zh/> 该属性为 img 的别名
|
|
25
|
+
*
|
|
26
|
+
* <en/> This property is an alias for img
|
|
27
|
+
*/
|
|
13
28
|
src?: string | HTMLImageElement;
|
|
14
|
-
}
|
|
29
|
+
}
|
|
15
30
|
|
|
31
|
+
/**
|
|
32
|
+
* <zh/> 图片节点
|
|
33
|
+
*
|
|
34
|
+
* <en/> Image node
|
|
35
|
+
*/
|
|
16
36
|
export class Image extends BaseNode<ImageStyleProps> {
|
|
17
37
|
static defaultStyleProps: Partial<ImageStyleProps> = {
|
|
18
38
|
size: 50,
|
|
@@ -24,12 +44,15 @@ export class Image extends BaseNode<ImageStyleProps> {
|
|
|
24
44
|
|
|
25
45
|
protected getKeyStyle(attributes: Required<ImageStyleProps>): GImageStyleProps {
|
|
26
46
|
const [width, height] = this.getSize(attributes);
|
|
27
|
-
const keyStyle = super.getKeyStyle(attributes);
|
|
47
|
+
const { fillOpacity, opacity = fillOpacity, ...keyStyle } = super.getKeyStyle(attributes);
|
|
48
|
+
|
|
28
49
|
return {
|
|
50
|
+
opacity,
|
|
29
51
|
...keyStyle,
|
|
30
52
|
width,
|
|
31
53
|
height,
|
|
32
|
-
|
|
54
|
+
x: -width / 2,
|
|
55
|
+
y: -height / 2,
|
|
33
56
|
};
|
|
34
57
|
}
|
|
35
58
|
|
|
@@ -40,8 +63,7 @@ export class Image extends BaseNode<ImageStyleProps> {
|
|
|
40
63
|
const haloLineWidth = Number(haloStyle.lineWidth);
|
|
41
64
|
const [width, height] = add(this.getSize(attributes), [haloLineWidth, haloLineWidth]);
|
|
42
65
|
const fill = 'transparent';
|
|
43
|
-
|
|
44
|
-
return { ...keyStyle, ...haloStyle, width, height, fill };
|
|
66
|
+
return { ...keyStyle, ...haloStyle, width, height, fill, x: -width / 2, y: -height / 2 };
|
|
45
67
|
}
|
|
46
68
|
|
|
47
69
|
protected getIconStyle(attributes: Required<ImageStyleProps>): false | IconStyleProps {
|
|
@@ -6,16 +6,22 @@ import type { IconStyleProps } from '../shapes';
|
|
|
6
6
|
import type { BaseNodeStyleProps } from './base-node';
|
|
7
7
|
import { BaseNode } from './base-node';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* <zh/> 矩形节点样式配置项
|
|
11
|
+
*
|
|
12
|
+
* <en/> Rect node style props
|
|
13
|
+
*/
|
|
14
|
+
export interface RectStyleProps extends BaseNodeStyleProps {}
|
|
10
15
|
type ParsedRectStyleProps = Required<RectStyleProps>;
|
|
11
16
|
|
|
12
17
|
/**
|
|
13
|
-
*
|
|
18
|
+
* <zh/> 矩形节点
|
|
19
|
+
*
|
|
20
|
+
* <en/> Rect node
|
|
14
21
|
*/
|
|
15
22
|
export class Rect extends BaseNode<RectStyleProps> {
|
|
16
23
|
static defaultStyleProps: Partial<RectStyleProps> = {
|
|
17
24
|
size: [48, 24],
|
|
18
|
-
anchor: [0.5, 0.5],
|
|
19
25
|
};
|
|
20
26
|
|
|
21
27
|
constructor(options: DisplayObjectConfig<RectStyleProps>) {
|
|
@@ -28,6 +34,8 @@ export class Rect extends BaseNode<RectStyleProps> {
|
|
|
28
34
|
...super.getKeyStyle(attributes),
|
|
29
35
|
width,
|
|
30
36
|
height,
|
|
37
|
+
x: -width / 2,
|
|
38
|
+
y: -height / 2,
|
|
31
39
|
};
|
|
32
40
|
}
|
|
33
41
|
|
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
import type { DisplayObjectConfig } from '@antv/g';
|
|
2
2
|
import { ICON_SIZE_RATIO } from '../../constants/element';
|
|
3
|
-
import type { Point, StarPortPlacement } from '../../types';
|
|
3
|
+
import type { NodePortStyleProps, Point, StarPortPlacement } from '../../types';
|
|
4
4
|
import { getPortXYByPlacement, getStarPoints, getStarPorts } from '../../utils/element';
|
|
5
|
-
import type { IconStyleProps } from '../shapes';
|
|
6
|
-
import {
|
|
7
|
-
import type { PolygonStyleProps } from './polygon';
|
|
8
|
-
import { Polygon } from './polygon';
|
|
5
|
+
import type { IconStyleProps, PolygonStyleProps } from '../shapes';
|
|
6
|
+
import { Polygon } from '../shapes/polygon';
|
|
9
7
|
|
|
10
|
-
|
|
8
|
+
/**
|
|
9
|
+
* <zh/> 五角星节点样式配置项
|
|
10
|
+
*
|
|
11
|
+
* <en/> Star node style props
|
|
12
|
+
*/
|
|
13
|
+
export interface StarStyleProps extends PolygonStyleProps {
|
|
11
14
|
/**
|
|
12
|
-
* <zh/>
|
|
13
|
-
*
|
|
15
|
+
* <zh/> 内半径,默认为外半径的 3/8
|
|
16
|
+
*
|
|
17
|
+
* <en/> Inner radius, default is 3/8 of the outer radius
|
|
14
18
|
*/
|
|
15
19
|
innerR?: number;
|
|
16
|
-
}
|
|
20
|
+
}
|
|
17
21
|
|
|
22
|
+
/**
|
|
23
|
+
* <zh/> 五角星节点
|
|
24
|
+
*
|
|
25
|
+
* <en/> Star node
|
|
26
|
+
*/
|
|
18
27
|
export class Star extends Polygon<StarStyleProps> {
|
|
19
28
|
constructor(options: DisplayObjectConfig<StarStyleProps>) {
|
|
20
29
|
super(options);
|
|
@@ -1,24 +1,34 @@
|
|
|
1
1
|
import type { DisplayObjectConfig } from '@antv/g';
|
|
2
2
|
import { deepMix, isEmpty } from '@antv/util';
|
|
3
3
|
import { ICON_SIZE_RATIO } from '../../constants/element';
|
|
4
|
-
import type { Point, TrianglePortPlacement } from '../../types';
|
|
4
|
+
import type { NodePortStyleProps, Point, TriangleDirection, TrianglePortPlacement } from '../../types';
|
|
5
5
|
import { getIncircleRadius, getTriangleCenter } from '../../utils/bbox';
|
|
6
6
|
import { getPortXYByPlacement, getTrianglePoints, getTrianglePorts } from '../../utils/element';
|
|
7
7
|
import { subStyleProps } from '../../utils/prefix';
|
|
8
|
+
import type { PolygonStyleProps } from '../shapes';
|
|
8
9
|
import { IconStyleProps } from '../shapes';
|
|
9
|
-
import
|
|
10
|
-
import type { PolygonStyleProps } from './polygon';
|
|
11
|
-
import { Polygon } from './polygon';
|
|
10
|
+
import { Polygon } from '../shapes/polygon';
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* <zh/> 三角形节点样式配置项
|
|
14
|
+
*
|
|
15
|
+
* <en/> Triangle node style props
|
|
16
|
+
*/
|
|
17
|
+
export interface TriangleStyleProps extends PolygonStyleProps {
|
|
14
18
|
/**
|
|
15
19
|
* <zh/> 三角形的方向
|
|
20
|
+
*
|
|
16
21
|
* <en/> The direction of the triangle
|
|
22
|
+
* @defaultValue 'up'
|
|
17
23
|
*/
|
|
18
24
|
direction?: TriangleDirection;
|
|
19
|
-
}
|
|
20
|
-
export type TriangleDirection = 'up' | 'left' | 'right' | 'down';
|
|
25
|
+
}
|
|
21
26
|
|
|
27
|
+
/**
|
|
28
|
+
* <zh/> 三角形节点
|
|
29
|
+
*
|
|
30
|
+
* <en/> Triangle node
|
|
31
|
+
*/
|
|
22
32
|
export class Triangle extends Polygon<TriangleStyleProps> {
|
|
23
33
|
static defaultStyleProps: Partial<TriangleStyleProps> = {
|
|
24
34
|
size: 40,
|
|
@@ -4,7 +4,7 @@ import { BaseShape } from './base-shape';
|
|
|
4
4
|
import type { LabelStyleProps } from './label';
|
|
5
5
|
import { Label } from './label';
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export interface BadgeStyleProps extends LabelStyleProps {}
|
|
8
8
|
type ParsedBadgeStyleProps = Required<BadgeStyleProps>;
|
|
9
9
|
type BadgeOptions = DisplayObjectConfig<BadgeStyleProps>;
|
|
10
10
|
|
|
@@ -1,26 +1,23 @@
|
|
|
1
1
|
import type { BaseStyleProps, DisplayObject, DisplayObjectConfig, Group, IAnimation } from '@antv/g';
|
|
2
2
|
import { CustomElement } from '@antv/g';
|
|
3
|
-
import {
|
|
3
|
+
import { isEmpty, isFunction, upperFirst } from '@antv/util';
|
|
4
4
|
import type { Keyframe } from '../../types';
|
|
5
5
|
import { createAnimationsProxy, preprocessKeyframes } from '../../utils/animation';
|
|
6
6
|
import { updateStyle } from '../../utils/element';
|
|
7
|
+
import { subObject } from '../../utils/prefix';
|
|
7
8
|
import { setVisibility } from '../../utils/visibility';
|
|
8
9
|
|
|
9
|
-
export interface BaseShapeStyleProps extends BaseStyleProps {
|
|
10
|
-
x?: number | string;
|
|
11
|
-
y?: number | string;
|
|
12
|
-
}
|
|
10
|
+
export interface BaseShapeStyleProps extends BaseStyleProps {}
|
|
13
11
|
|
|
14
12
|
export abstract class BaseShape<StyleProps extends BaseShapeStyleProps> extends CustomElement<StyleProps> {
|
|
15
13
|
constructor(options: DisplayObjectConfig<StyleProps>) {
|
|
16
14
|
super(options);
|
|
17
|
-
|
|
18
15
|
this.render(this.attributes as Required<StyleProps>, this);
|
|
19
16
|
this.setVisibility();
|
|
20
17
|
this.bindEvents();
|
|
21
18
|
}
|
|
22
19
|
|
|
23
|
-
get parsedAttributes() {
|
|
20
|
+
protected get parsedAttributes() {
|
|
24
21
|
return this.attributes as Required<StyleProps>;
|
|
25
22
|
}
|
|
26
23
|
|
|
@@ -81,7 +78,7 @@ export abstract class BaseShape<StyleProps extends BaseShapeStyleProps> extends
|
|
|
81
78
|
}
|
|
82
79
|
|
|
83
80
|
public update(attr: Partial<StyleProps> = {}): void {
|
|
84
|
-
this.attr(
|
|
81
|
+
this.attr(Object.assign({}, this.attributes, attr) as StyleProps);
|
|
85
82
|
this.render(this.attributes as Required<StyleProps>, this);
|
|
86
83
|
this.setVisibility();
|
|
87
84
|
}
|
|
@@ -113,6 +110,8 @@ export abstract class BaseShape<StyleProps extends BaseShapeStyleProps> extends
|
|
|
113
110
|
}
|
|
114
111
|
|
|
115
112
|
public animate(keyframes: Keyframe[], options?: number | KeyframeAnimationOptions): IAnimation | null {
|
|
113
|
+
if (keyframes.length === 0) return null;
|
|
114
|
+
|
|
116
115
|
const animationMap: IAnimation[] = [];
|
|
117
116
|
|
|
118
117
|
const result = super.animate(keyframes, options);
|
|
@@ -121,15 +120,15 @@ export abstract class BaseShape<StyleProps extends BaseShapeStyleProps> extends
|
|
|
121
120
|
if (Array.isArray(keyframes) && keyframes.length > 0) {
|
|
122
121
|
// 如果 keyframes 中仅存在 skippedAttrs 中的属性,则仅更新父元素属性(跳过子图形)
|
|
123
122
|
// if only skippedAttrs exist in keyframes, only update parent element attributes (skip child shapes)
|
|
124
|
-
const skippedAttrs = ['
|
|
123
|
+
const skippedAttrs = ['transform', 'transformOrigin', 'x', 'y', 'z', 'zIndex'];
|
|
125
124
|
if (Object.keys(keyframes[0]).some((attr) => !skippedAttrs.includes(attr))) {
|
|
126
125
|
Object.entries(this.shapeMap).forEach(([key, shape]) => {
|
|
127
126
|
// 如果存在方法名为 `get${key}Style` 的方法,则使用该方法获取样式,并自动为该图形实例创建动画
|
|
128
127
|
// if there is a method named `get${key}Style`, use this method to get style and automatically create animation for the shape instance
|
|
129
|
-
const methodName = `get${
|
|
128
|
+
const methodName = `get${upperFirst(key)}Style` as keyof this;
|
|
130
129
|
const method = this[methodName];
|
|
131
130
|
|
|
132
|
-
if (
|
|
131
|
+
if (isFunction(method)) {
|
|
133
132
|
const subKeyframes: Keyframe[] = keyframes.map((style) =>
|
|
134
133
|
method.call(this, { ...this.attributes, ...style }),
|
|
135
134
|
);
|
|
@@ -138,12 +137,41 @@ export abstract class BaseShape<StyleProps extends BaseShapeStyleProps> extends
|
|
|
138
137
|
if (result) animationMap.push(result);
|
|
139
138
|
}
|
|
140
139
|
});
|
|
140
|
+
|
|
141
|
+
// 针对 badges/ports 执行动画
|
|
142
|
+
const badges = subObject(this.shapeMap, 'badge-');
|
|
143
|
+
const ports = subObject(this.shapeMap, 'port-');
|
|
144
|
+
|
|
145
|
+
const handleShapeSet = (shapeSet: Record<string, DisplayObject>, name: string) => {
|
|
146
|
+
if (!isEmpty(shapeSet)) {
|
|
147
|
+
const methodName = `get${upperFirst(name)}Style` as keyof this;
|
|
148
|
+
const method = this[methodName];
|
|
149
|
+
if (isFunction(method)) {
|
|
150
|
+
const itemsKeyframes = keyframes.map((style) => method.call(this, { ...this.attributes, ...style }));
|
|
151
|
+
Object.entries(itemsKeyframes[0]).map(([key]) => {
|
|
152
|
+
const subKeyframes = itemsKeyframes.map((styles) => styles[key]);
|
|
153
|
+
const shape = shapeSet[key];
|
|
154
|
+
if (shape) {
|
|
155
|
+
const result = shape.animate(preprocessKeyframes(subKeyframes), options);
|
|
156
|
+
if (result) animationMap.push(result);
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
handleShapeSet(badges, 'badges');
|
|
164
|
+
handleShapeSet(ports, 'ports');
|
|
141
165
|
}
|
|
142
166
|
}
|
|
143
167
|
|
|
144
168
|
return createAnimationsProxy(animationMap);
|
|
145
169
|
}
|
|
146
170
|
|
|
171
|
+
public getShape(key: string): DisplayObject | undefined {
|
|
172
|
+
return this.shapeMap[key];
|
|
173
|
+
}
|
|
174
|
+
|
|
147
175
|
private setVisibility() {
|
|
148
176
|
const { visibility } = this.attributes;
|
|
149
177
|
setVisibility(this, visibility);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DisplayObjectConfig, Group, PathStyleProps } from '@antv/g';
|
|
2
2
|
import { Path } from '@antv/g';
|
|
3
3
|
import { deepMix } from '@antv/util';
|
|
4
|
-
import type { CardinalPlacement,
|
|
4
|
+
import type { CardinalPlacement, Prefix } from '../../types';
|
|
5
5
|
import { getPolygonTextStyleByPlacement } from '../../utils/polygon';
|
|
6
6
|
import { subStyleProps } from '../../utils/prefix';
|
|
7
7
|
import { getWordWrapWidthByBox } from '../../utils/text';
|
|
@@ -9,42 +9,59 @@ import type { LabelStyleProps } from '../shapes';
|
|
|
9
9
|
import { BaseShape } from './base-shape';
|
|
10
10
|
import { Label } from './label';
|
|
11
11
|
|
|
12
|
-
interface ContourLabelStyleProps extends LabelStyleProps {
|
|
12
|
+
export interface ContourLabelStyleProps extends LabelStyleProps {
|
|
13
13
|
/**
|
|
14
|
-
* <zh/>
|
|
15
|
-
*
|
|
14
|
+
* <zh/> 标签位置
|
|
15
|
+
*
|
|
16
|
+
* <en/> Label position
|
|
17
|
+
* @defaultValue 'bottom'
|
|
16
18
|
*/
|
|
17
19
|
placement?: CardinalPlacement | 'center';
|
|
18
20
|
/**
|
|
19
|
-
* <zh/>
|
|
20
|
-
*
|
|
21
|
+
* <zh/> 标签是否贴合轮廓
|
|
22
|
+
*
|
|
23
|
+
* <en/> Whether the label is close to the contour
|
|
24
|
+
* @defaultValue true
|
|
21
25
|
*/
|
|
22
26
|
closeToPath?: boolean;
|
|
23
27
|
/**
|
|
24
|
-
* <zh/>
|
|
25
|
-
*
|
|
28
|
+
* <zh/> 标签是否跟随轮廓旋转,仅在 closeToPath 为 true 时生效
|
|
29
|
+
*
|
|
30
|
+
* <en/> Whether the label rotates with the contour. Only effective when closeToPath is true
|
|
31
|
+
* @defaultValue true
|
|
26
32
|
*/
|
|
27
33
|
autoRotate?: boolean;
|
|
28
34
|
/**
|
|
29
35
|
* <zh/> x 轴偏移量
|
|
36
|
+
*
|
|
30
37
|
* <en/> Label x-axis offset
|
|
38
|
+
* @defaultValue 0
|
|
31
39
|
*/
|
|
32
40
|
offsetX?: number;
|
|
33
41
|
/**
|
|
34
42
|
* <zh/> y 轴偏移量
|
|
43
|
+
*
|
|
35
44
|
* <en/> Label y-axis offset
|
|
45
|
+
* @defaultValue 0
|
|
36
46
|
*/
|
|
37
47
|
offsetY?: number;
|
|
38
48
|
/**
|
|
39
49
|
* <zh/> 文本的最大宽度,超出会自动省略
|
|
50
|
+
*
|
|
40
51
|
* <en/> The maximum width of the text, which will be automatically ellipsis if exceeded
|
|
41
52
|
*/
|
|
42
53
|
maxWidth?: number;
|
|
43
54
|
}
|
|
44
55
|
|
|
45
|
-
export
|
|
56
|
+
export interface ContourStyleProps extends PathStyleProps, Prefix<'label', ContourLabelStyleProps> {
|
|
57
|
+
/**
|
|
58
|
+
* <zh/> 是否显示标签
|
|
59
|
+
*
|
|
60
|
+
* <en/> Whether to display the label
|
|
61
|
+
* @defaultValue true
|
|
62
|
+
*/
|
|
46
63
|
label?: boolean;
|
|
47
|
-
}
|
|
64
|
+
}
|
|
48
65
|
type ParsedContourStyleProps = Required<ContourStyleProps>;
|
|
49
66
|
type ContourOptions = DisplayObjectConfig<ContourStyleProps>;
|
|
50
67
|
|
|
@@ -63,7 +80,7 @@ export class Contour extends BaseShape<ContourStyleProps> {
|
|
|
63
80
|
}
|
|
64
81
|
|
|
65
82
|
protected getLabelStyle(attributes: ParsedContourStyleProps): LabelStyleProps | false {
|
|
66
|
-
if (!attributes.label || !attributes.
|
|
83
|
+
if (!attributes.label || !attributes.d || attributes.d.length === 0) return false;
|
|
67
84
|
const { maxWidth, offsetX, offsetY, autoRotate, placement, closeToPath, ...labelStyle } = subStyleProps<
|
|
68
85
|
Required<ContourLabelStyleProps>
|
|
69
86
|
>(this.getGraphicStyle(attributes), 'label');
|
|
@@ -72,7 +89,7 @@ export class Contour extends BaseShape<ContourStyleProps> {
|
|
|
72
89
|
const keyBounds = key?.getRenderBounds();
|
|
73
90
|
|
|
74
91
|
return Object.assign(
|
|
75
|
-
getPolygonTextStyleByPlacement(keyBounds, placement, offsetX, offsetY, closeToPath, attributes.
|
|
92
|
+
getPolygonTextStyleByPlacement(keyBounds, placement, offsetX, offsetY, closeToPath, attributes.d, autoRotate),
|
|
76
93
|
{ wordWrapWidth: getWordWrapWidthByBox(keyBounds, maxWidth) },
|
|
77
94
|
labelStyle,
|
|
78
95
|
);
|
|
@@ -2,7 +2,7 @@ import { DisplayObjectConfig, Image as GImage, Text as GText, Group, ImageStyleP
|
|
|
2
2
|
import type { BaseShapeStyleProps } from './base-shape';
|
|
3
3
|
import { BaseShape } from './base-shape';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export interface IconStyleProps extends BaseShapeStyleProps, Partial<TextStyleProps>, Omit<ImageStyleProps, 'z'> {}
|
|
6
6
|
|
|
7
7
|
type IconOptions = DisplayObjectConfig<IconStyleProps>;
|
|
8
8
|
|
|
@@ -16,11 +16,13 @@ export class Icon extends BaseShape<IconStyleProps> {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
protected getIconStyle(attributes: IconStyleProps = this.attributes): IconStyleProps {
|
|
19
|
+
const { x = 0, y = 0 } = attributes;
|
|
19
20
|
const style = this.getGraphicStyle(attributes);
|
|
20
|
-
|
|
21
|
+
const { width, height } = style;
|
|
21
22
|
if (this.isGImage()) {
|
|
22
23
|
return {
|
|
23
|
-
|
|
24
|
+
x: (x as number) - (width as number) / 2,
|
|
25
|
+
y: (y as number) - (height as number) / 2,
|
|
24
26
|
...style,
|
|
25
27
|
};
|
|
26
28
|
}
|
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
import { DisplayObjectConfig, Group, Rect, RectStyleProps, Text, TextStyleProps } from '@antv/g';
|
|
2
2
|
import { deepMix } from '@antv/util';
|
|
3
3
|
import type { Padding } from '../../types/padding';
|
|
4
|
-
import type {
|
|
4
|
+
import type { Prefix } from '../../types/prefix';
|
|
5
5
|
import { parsePadding } from '../../utils/padding';
|
|
6
6
|
import { omitStyleProps, startsWith, subStyleProps } from '../../utils/prefix';
|
|
7
|
-
import type { BaseShapeStyleProps } from './base-shape';
|
|
8
7
|
import { BaseShape } from './base-shape';
|
|
9
8
|
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
export interface LabelStyleProps extends TextStyleProps, Prefix<'background', RectStyleProps> {
|
|
10
|
+
/**
|
|
11
|
+
* <zh/> 是否显示背景
|
|
12
|
+
*
|
|
13
|
+
* <en/> Whether to show background
|
|
14
|
+
*/
|
|
15
|
+
background?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* <zh/> 标签内边距
|
|
18
|
+
*
|
|
19
|
+
* <en/> Label padding
|
|
20
|
+
* @defaultValue 0
|
|
21
|
+
*/
|
|
22
|
+
padding?: Padding;
|
|
23
|
+
}
|
|
16
24
|
type ParsedLabelStyleProps = Required<LabelStyleProps>;
|
|
17
25
|
type LabelOptions = DisplayObjectConfig<LabelStyleProps>;
|
|
18
26
|
|
|
@@ -60,11 +68,12 @@ export class Label extends BaseShape<LabelStyleProps> {
|
|
|
60
68
|
} = this.shapeMap.text.getGeometryBounds();
|
|
61
69
|
|
|
62
70
|
const [top, right, bottom, left] = parsePadding(padding);
|
|
71
|
+
const totalWidth = halfWidth * 2 + left + right;
|
|
63
72
|
|
|
64
73
|
Object.assign(backgroundStyle, {
|
|
65
74
|
x: minX - left,
|
|
66
75
|
y: minY - top,
|
|
67
|
-
width: wordWrap ? Math.min(
|
|
76
|
+
width: wordWrap ? Math.min(totalWidth, wordWrapWidth) : totalWidth,
|
|
68
77
|
height: halfHeight * 2 + top + bottom,
|
|
69
78
|
});
|
|
70
79
|
|
|
@@ -2,40 +2,49 @@ import type { DisplayObjectConfig, PolygonStyleProps as GPolygonStyleProps, Grou
|
|
|
2
2
|
import { Polygon as GPolygon } from '@antv/g';
|
|
3
3
|
import type { Point } from '../../types';
|
|
4
4
|
import { getPolygonIntersectPoint } from '../../utils/point';
|
|
5
|
-
import type { BaseNodeStyleProps } from '
|
|
6
|
-
import { BaseNode } from '
|
|
5
|
+
import type { BaseNodeStyleProps } from '../nodes/base-node';
|
|
6
|
+
import { BaseNode } from '../nodes/base-node';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
/**
|
|
9
|
+
* <zh/> 多边形节点样式配置项
|
|
10
|
+
*
|
|
11
|
+
* <en/> Polygon node style props
|
|
12
|
+
*/
|
|
13
|
+
export interface PolygonStyleProps extends BaseNodeStyleProps {
|
|
14
|
+
/**
|
|
15
|
+
* <zh/> 多边形的顶点坐标
|
|
16
|
+
*
|
|
17
|
+
* <en/> The vertex coordinates of the polygon
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
points?: ([number, number] | [number, number, number])[];
|
|
21
|
+
}
|
|
13
22
|
|
|
14
23
|
/**
|
|
15
24
|
* Abstract class for polygon nodes,i.e triangle, diamond, hexagon, etc.
|
|
16
25
|
*/
|
|
17
26
|
export abstract class Polygon<T extends PolygonStyleProps = PolygonStyleProps> extends BaseNode<T> {
|
|
18
|
-
constructor(options: DisplayObjectConfig<
|
|
27
|
+
constructor(options: DisplayObjectConfig<T>) {
|
|
19
28
|
super(options);
|
|
20
29
|
}
|
|
21
30
|
|
|
22
31
|
public get parsedAttributes() {
|
|
23
|
-
return this.attributes as unknown as Required<
|
|
32
|
+
return this.attributes as unknown as Required<T>;
|
|
24
33
|
}
|
|
25
34
|
|
|
26
|
-
protected drawKeyShape(attributes: Required<
|
|
35
|
+
protected drawKeyShape(attributes: Required<T>, container: Group) {
|
|
27
36
|
return this.upsert('key', GPolygon, this.getKeyStyle(attributes), container);
|
|
28
37
|
}
|
|
29
38
|
|
|
30
|
-
protected getKeyStyle(attributes: Required<
|
|
39
|
+
protected getKeyStyle(attributes: Required<T>): GPolygonStyleProps {
|
|
31
40
|
const keyStyle = super.getKeyStyle(attributes);
|
|
32
41
|
return { ...keyStyle, points: this.getPoints(attributes) };
|
|
33
42
|
}
|
|
34
43
|
|
|
35
|
-
protected abstract getPoints(attributes: Required<
|
|
44
|
+
protected abstract getPoints(attributes: Required<T>): Point[];
|
|
36
45
|
|
|
37
46
|
public getIntersectPoint(point: Point): Point {
|
|
38
|
-
const { points } = this.getKeyStyle(this.parsedAttributes as Required<
|
|
47
|
+
const { points } = this.getKeyStyle(this.parsedAttributes as Required<T>);
|
|
39
48
|
const center: Point = [+(this.attributes?.x || 0), +(this.attributes?.y || 0)];
|
|
40
49
|
return getPolygonIntersectPoint(point, center, points!).point;
|
|
41
50
|
}
|
package/src/exports.ts
CHANGED
|
@@ -10,6 +10,7 @@ export {
|
|
|
10
10
|
FocusElement,
|
|
11
11
|
HoverElement,
|
|
12
12
|
LassoSelect,
|
|
13
|
+
ScrollCanvas,
|
|
13
14
|
ZoomCanvas,
|
|
14
15
|
} from './behaviors';
|
|
15
16
|
export {
|
|
@@ -20,6 +21,7 @@ export {
|
|
|
20
21
|
EdgeEvent,
|
|
21
22
|
ExtensionCategory,
|
|
22
23
|
GraphEvent,
|
|
24
|
+
HistoryEvent,
|
|
23
25
|
NodeEvent,
|
|
24
26
|
} from './constants';
|
|
25
27
|
export { BaseCombo, CircleCombo, RectCombo } from './elements/combos';
|
|
@@ -40,6 +42,7 @@ export {
|
|
|
40
42
|
export { BaseShape } from './elements/shapes';
|
|
41
43
|
export {
|
|
42
44
|
AntVDagreLayout,
|
|
45
|
+
BaseLayout,
|
|
43
46
|
CircularLayout,
|
|
44
47
|
ComboCombinedLayout,
|
|
45
48
|
ConcentricLayout,
|
|
@@ -76,6 +79,7 @@ export { getExtension, getExtensions, register } from './registry';
|
|
|
76
79
|
export { Graph } from './runtime/graph';
|
|
77
80
|
export { BaseTransform } from './transforms';
|
|
78
81
|
export { idOf } from './utils/id';
|
|
82
|
+
export { invokeLayoutMethod } from './utils/layout';
|
|
79
83
|
export { omitStyleProps, subStyleProps } from './utils/prefix';
|
|
80
84
|
export { Shortcut } from './utils/shortcut';
|
|
81
85
|
export { parseSize } from './utils/size';
|
|
@@ -98,6 +102,8 @@ export type {
|
|
|
98
102
|
RadialLayoutOptions,
|
|
99
103
|
RandomLayoutOptions,
|
|
100
104
|
} from '@antv/layout';
|
|
105
|
+
export type { PathArray } from '@antv/util';
|
|
106
|
+
export type { AnimationContext, AnimationEffectTiming, AnimationExecutor } from './animations/types';
|
|
101
107
|
export type {
|
|
102
108
|
BaseBehaviorOptions,
|
|
103
109
|
BrushSelectOptions,
|
|
@@ -110,6 +116,7 @@ export type {
|
|
|
110
116
|
FocusElementOptions,
|
|
111
117
|
HoverElementOptions,
|
|
112
118
|
LassoSelectOptions,
|
|
119
|
+
ScrollCanvasOptions,
|
|
113
120
|
ZoomCanvasOptions,
|
|
114
121
|
} from './behaviors';
|
|
115
122
|
export type { BaseComboStyleProps, CircleComboStyleProps, RectComboStyleProps } from './elements/combos';
|
|
@@ -126,6 +133,7 @@ export type {
|
|
|
126
133
|
BaseNodeStyleProps,
|
|
127
134
|
CircleStyleProps,
|
|
128
135
|
DiamondStyleProps,
|
|
136
|
+
DonutStyleProps,
|
|
129
137
|
EllipseStyleProps,
|
|
130
138
|
HTMLStyleProps,
|
|
131
139
|
HexagonStyleProps,
|
|
@@ -134,7 +142,16 @@ export type {
|
|
|
134
142
|
StarStyleProps,
|
|
135
143
|
TriangleStyleProps,
|
|
136
144
|
} from './elements/nodes';
|
|
137
|
-
export type {
|
|
145
|
+
export type {
|
|
146
|
+
BadgeStyleProps,
|
|
147
|
+
BaseShapeStyleProps,
|
|
148
|
+
IconStyleProps,
|
|
149
|
+
LabelStyleProps,
|
|
150
|
+
PolygonStyleProps,
|
|
151
|
+
} from './elements/shapes';
|
|
152
|
+
export type { ContourLabelStyleProps, ContourStyleProps } from './elements/shapes/contour';
|
|
153
|
+
export type { AnimationOptions, BaseLayoutOptions, WebWorkerLayoutOptions } from './layouts/types';
|
|
154
|
+
export type { CategoricalPalette } from './palettes/types';
|
|
138
155
|
export type {
|
|
139
156
|
BasePluginOptions,
|
|
140
157
|
BubbleSetsOptions,
|
|
@@ -159,25 +176,36 @@ export type {
|
|
|
159
176
|
EdgeOptions,
|
|
160
177
|
GraphData,
|
|
161
178
|
GraphOptions,
|
|
162
|
-
LayoutOptions,
|
|
163
179
|
NodeData,
|
|
164
180
|
NodeOptions,
|
|
165
181
|
PluginOptions,
|
|
166
182
|
ThemeOptions,
|
|
167
183
|
ViewportOptions,
|
|
168
184
|
} from './spec';
|
|
185
|
+
export type { CustomBehaviorOption } from './spec/behavior';
|
|
186
|
+
export type { LayoutOptions, STDLayoutOptions, SingleLayoutOptions } from './spec/layout';
|
|
187
|
+
export type { CustomPluginOption } from './spec/plugin';
|
|
169
188
|
export type { BaseTransformOptions } from './transforms';
|
|
170
189
|
export type {
|
|
190
|
+
BaseElementStyleProps,
|
|
191
|
+
CallableValue,
|
|
171
192
|
CardinalPlacement,
|
|
193
|
+
CollapsedMarkerStyleProps,
|
|
172
194
|
Combo,
|
|
173
195
|
CornerPlacement,
|
|
174
196
|
DirectionalPlacement,
|
|
175
197
|
Edge,
|
|
198
|
+
EdgeArrowStyleProps,
|
|
199
|
+
EdgeLabelStyleProps,
|
|
176
200
|
Element,
|
|
201
|
+
ElementDatum,
|
|
177
202
|
ElementType,
|
|
203
|
+
FitViewOptions,
|
|
178
204
|
IAnimateEvent,
|
|
179
205
|
ID,
|
|
180
206
|
IDragEvent,
|
|
207
|
+
IElementDragEvent,
|
|
208
|
+
IElementEvent,
|
|
181
209
|
IElementLifeCycleEvent,
|
|
182
210
|
IEvent,
|
|
183
211
|
IGraphLifeCycleEvent,
|
|
@@ -185,13 +213,27 @@ export type {
|
|
|
185
213
|
IPointerEvent,
|
|
186
214
|
IViewportEvent,
|
|
187
215
|
IWheelEvent,
|
|
216
|
+
LoopPlacement,
|
|
217
|
+
LoopStyleProps,
|
|
188
218
|
Node,
|
|
219
|
+
NodeBadgeStyleProps,
|
|
220
|
+
NodeLabelStyleProps,
|
|
221
|
+
NodeLikeData,
|
|
222
|
+
NodePortStyleProps,
|
|
223
|
+
Padding,
|
|
189
224
|
Placement,
|
|
190
225
|
Point,
|
|
226
|
+
PortStyleProps,
|
|
227
|
+
Prefix,
|
|
228
|
+
PrefixKey,
|
|
191
229
|
RelativePlacement,
|
|
230
|
+
Size,
|
|
192
231
|
State,
|
|
232
|
+
TransformOptions,
|
|
233
|
+
TriangleDirection,
|
|
193
234
|
Vector2,
|
|
194
235
|
Vector3,
|
|
195
236
|
ViewportAnimationEffectTiming,
|
|
196
237
|
} from './types';
|
|
238
|
+
export type { Command, CommandData } from './types/history';
|
|
197
239
|
export type { ShortcutKey } from './utils/shortcut';
|