@antv/g6 5.0.0-beta.32 → 5.0.0-beta.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/g6.min.js +2 -2
- package/dist/lib/behaviors/brush-select.d.ts +103 -0
- package/dist/lib/behaviors/click-element.d.ts +77 -0
- package/dist/lib/behaviors/collapse-expand.d.ts +1 -2
- package/dist/lib/behaviors/create-edge.d.ts +1 -2
- package/dist/lib/behaviors/drag-element-force.d.ts +13 -0
- package/dist/lib/behaviors/drag-element.d.ts +12 -12
- package/dist/lib/behaviors/index.d.ts +8 -0
- package/dist/lib/behaviors/lasso-select.d.ts +19 -0
- package/dist/lib/behaviors/types.d.ts +1 -0
- package/dist/lib/constants/change.d.ts +1 -1
- package/dist/lib/constants/events/animation.d.ts +1 -4
- package/dist/lib/constants/events/graph.d.ts +9 -7
- package/dist/lib/constants/registry.d.ts +3 -1
- package/dist/lib/elements/combos/base-combo.d.ts +43 -6
- package/dist/lib/elements/combos/circle.d.ts +8 -12
- package/dist/lib/elements/combos/rect.d.ts +5 -9
- package/dist/lib/elements/edges/base-edge.d.ts +64 -10
- package/dist/lib/elements/edges/cubic-horizontal.d.ts +2 -2
- package/dist/lib/elements/edges/cubic-vertical.d.ts +2 -2
- package/dist/lib/elements/edges/cubic.d.ts +2 -2
- package/dist/lib/elements/edges/polyline.d.ts +2 -2
- package/dist/lib/elements/edges/quadratic.d.ts +2 -2
- package/dist/lib/elements/nodes/base-node.d.ts +104 -14
- package/dist/lib/elements/nodes/circle.d.ts +5 -8
- package/dist/lib/elements/nodes/diamond.d.ts +2 -4
- package/dist/lib/elements/nodes/donut.d.ts +45 -0
- package/dist/lib/elements/nodes/ellipse.d.ts +5 -8
- package/dist/lib/elements/nodes/hexagon.d.ts +6 -9
- package/dist/lib/elements/nodes/html.d.ts +27 -0
- package/dist/lib/elements/nodes/image.d.ts +9 -11
- package/dist/lib/elements/nodes/index.d.ts +4 -0
- package/dist/lib/elements/nodes/polygon.d.ts +9 -8
- package/dist/lib/elements/nodes/rect.d.ts +2 -3
- package/dist/lib/elements/nodes/star.d.ts +7 -10
- package/dist/lib/elements/nodes/triangle.d.ts +7 -10
- package/dist/lib/exports.d.ts +8 -5
- package/dist/lib/layouts/index.d.ts +1 -1
- package/dist/lib/layouts/types.d.ts +6 -6
- package/dist/lib/palettes/index.d.ts +1 -0
- package/dist/lib/plugins/history/events.d.ts +21 -0
- package/dist/lib/plugins/history/index.d.ts +82 -0
- package/dist/lib/plugins/history/utils.d.ts +31 -0
- package/dist/lib/plugins/hull/index.d.ts +58 -0
- package/dist/lib/plugins/hull/shape.d.ts +49 -0
- package/dist/lib/plugins/hull/util.d.ts +12 -0
- package/dist/lib/plugins/index.d.ts +4 -0
- package/dist/lib/registry/extension/index.d.ts +1 -1
- package/dist/lib/registry/types.d.ts +4 -0
- package/dist/lib/runtime/batch.d.ts +11 -0
- package/dist/lib/runtime/behavior.d.ts +1 -1
- package/dist/lib/runtime/canvas.d.ts +13 -3
- package/dist/lib/runtime/data.d.ts +8 -8
- package/dist/lib/runtime/element.d.ts +6 -22
- package/dist/lib/runtime/graph.d.ts +42 -5
- package/dist/lib/runtime/layout.d.ts +5 -11
- package/dist/lib/runtime/plugin.d.ts +1 -1
- package/dist/lib/runtime/transform.d.ts +11 -0
- package/dist/lib/runtime/types.d.ts +14 -0
- package/dist/lib/runtime/viewport.d.ts +1 -2
- package/dist/lib/spec/data.d.ts +74 -1
- package/dist/lib/spec/element/combo.d.ts +17 -6
- package/dist/lib/spec/element/edge.d.ts +14 -2
- package/dist/lib/spec/element/node.d.ts +19 -3
- package/dist/lib/spec/index.d.ts +1 -0
- package/dist/lib/spec/spec.d.ts +7 -0
- package/dist/lib/spec/transform.d.ts +12 -0
- package/dist/lib/themes/base.d.ts +1 -0
- package/dist/lib/transforms/arrange-draw-order.d.ts +10 -0
- package/dist/lib/transforms/base-transform.d.ts +7 -0
- package/dist/lib/transforms/collapse-expand-combo.d.ts +10 -0
- package/dist/lib/transforms/index.d.ts +6 -0
- package/dist/lib/transforms/process-parallel-edges.d.ts +83 -0
- package/dist/lib/transforms/types.d.ts +20 -0
- package/dist/lib/transforms/update-related-edge.d.ts +9 -0
- package/dist/lib/types/callable.d.ts +2 -2
- package/dist/lib/types/canvas.d.ts +1 -1
- package/dist/lib/types/change.d.ts +27 -10
- package/dist/lib/types/data.d.ts +1 -1
- package/dist/lib/types/element.d.ts +6 -140
- package/dist/lib/types/id.d.ts +1 -0
- package/dist/lib/types/index.d.ts +1 -0
- package/dist/lib/types/node.d.ts +3 -3
- package/dist/lib/types/point.d.ts +1 -0
- package/dist/lib/types/style.d.ts +1 -3
- package/dist/lib/utils/animation.d.ts +2 -2
- package/dist/lib/utils/behaviors/brush.d.ts +18 -0
- package/dist/lib/utils/behaviors/lasso.d.ts +12 -0
- package/dist/lib/utils/behaviors/utils.d.ts +21 -0
- package/dist/lib/utils/change.d.ts +9 -1
- package/dist/lib/utils/combo.d.ts +5 -4
- package/dist/lib/utils/edge.d.ts +12 -2
- package/dist/lib/utils/event/events.d.ts +1 -1
- package/dist/lib/utils/extension.d.ts +1 -1
- package/dist/lib/utils/id.d.ts +4 -10
- package/dist/lib/utils/line.d.ts +21 -0
- package/dist/lib/utils/palette.d.ts +1 -2
- package/dist/lib/utils/path.d.ts +35 -0
- package/dist/lib/utils/point.d.ts +74 -20
- package/dist/lib/utils/polygon.d.ts +17 -0
- package/dist/lib/utils/position.d.ts +14 -1
- package/dist/lib/utils/prefix.d.ts +1 -1
- package/dist/lib/utils/relation.d.ts +1 -2
- package/dist/lib/utils/shortcut.d.ts +1 -0
- package/dist/lib/utils/vector.d.ts +3 -2
- package/esm/behaviors/brush-select.d.ts +103 -0
- package/esm/behaviors/brush-select.js +199 -0
- package/esm/behaviors/brush-select.js.map +1 -0
- package/esm/behaviors/click-element.d.ts +77 -0
- package/esm/behaviors/click-element.js +108 -0
- package/esm/behaviors/click-element.js.map +1 -0
- package/esm/behaviors/collapse-expand.d.ts +1 -2
- package/esm/behaviors/collapse-expand.js.map +1 -1
- package/esm/behaviors/create-edge.d.ts +1 -2
- package/esm/behaviors/create-edge.js.map +1 -1
- package/esm/behaviors/drag-element-force.d.ts +13 -0
- package/esm/behaviors/drag-element-force.js +55 -0
- package/esm/behaviors/drag-element-force.js.map +1 -0
- package/esm/behaviors/drag-element.d.ts +12 -12
- package/esm/behaviors/drag-element.js +17 -9
- package/esm/behaviors/drag-element.js.map +1 -1
- package/esm/behaviors/focus-element.js.map +1 -1
- package/esm/behaviors/hover-element.js +2 -2
- package/esm/behaviors/hover-element.js.map +1 -1
- package/esm/behaviors/index.d.ts +8 -0
- package/esm/behaviors/index.js +4 -0
- package/esm/behaviors/index.js.map +1 -1
- package/esm/behaviors/lasso-select.d.ts +19 -0
- package/esm/behaviors/lasso-select.js +79 -0
- package/esm/behaviors/lasso-select.js.map +1 -0
- package/esm/behaviors/types.d.ts +1 -0
- package/esm/constants/change.d.ts +1 -1
- package/esm/constants/change.js +12 -12
- package/esm/constants/change.js.map +1 -1
- package/esm/constants/events/animation.d.ts +1 -4
- package/esm/constants/events/animation.js +0 -4
- package/esm/constants/events/animation.js.map +1 -1
- package/esm/constants/events/graph.d.ts +9 -7
- package/esm/constants/events/graph.js +8 -8
- package/esm/constants/events/graph.js.map +1 -1
- package/esm/constants/registry.d.ts +3 -1
- package/esm/constants/registry.js +2 -0
- package/esm/constants/registry.js.map +1 -1
- package/esm/elements/combos/base-combo.d.ts +43 -6
- package/esm/elements/combos/base-combo.js.map +1 -1
- package/esm/elements/combos/circle.d.ts +8 -12
- package/esm/elements/combos/circle.js.map +1 -1
- package/esm/elements/combos/rect.d.ts +5 -9
- package/esm/elements/combos/rect.js.map +1 -1
- package/esm/elements/edges/base-edge.d.ts +64 -10
- package/esm/elements/edges/base-edge.js.map +1 -1
- package/esm/elements/edges/cubic-horizontal.d.ts +2 -2
- package/esm/elements/edges/cubic-vertical.d.ts +2 -2
- package/esm/elements/edges/cubic.d.ts +2 -2
- package/esm/elements/edges/polyline.d.ts +2 -2
- package/esm/elements/edges/quadratic.d.ts +2 -2
- package/esm/elements/nodes/base-node.d.ts +104 -14
- package/esm/elements/nodes/base-node.js +4 -1
- package/esm/elements/nodes/base-node.js.map +1 -1
- package/esm/elements/nodes/circle.d.ts +5 -8
- package/esm/elements/nodes/circle.js.map +1 -1
- package/esm/elements/nodes/diamond.d.ts +2 -4
- package/esm/elements/nodes/diamond.js +2 -2
- package/esm/elements/nodes/diamond.js.map +1 -1
- package/esm/elements/nodes/donut.d.ts +45 -0
- package/esm/elements/nodes/donut.js +81 -0
- package/esm/elements/nodes/donut.js.map +1 -0
- package/esm/elements/nodes/ellipse.d.ts +5 -8
- package/esm/elements/nodes/ellipse.js +1 -1
- package/esm/elements/nodes/ellipse.js.map +1 -1
- package/esm/elements/nodes/hexagon.d.ts +6 -9
- package/esm/elements/nodes/hexagon.js.map +1 -1
- package/esm/elements/nodes/html.d.ts +27 -0
- package/esm/elements/nodes/html.js +209 -0
- package/esm/elements/nodes/html.js.map +1 -0
- package/esm/elements/nodes/image.d.ts +9 -11
- package/esm/elements/nodes/image.js.map +1 -1
- package/esm/elements/nodes/index.d.ts +4 -0
- package/esm/elements/nodes/index.js +2 -0
- package/esm/elements/nodes/index.js.map +1 -1
- package/esm/elements/nodes/polygon.d.ts +9 -8
- package/esm/elements/nodes/polygon.js +4 -1
- package/esm/elements/nodes/polygon.js.map +1 -1
- package/esm/elements/nodes/rect.d.ts +2 -3
- package/esm/elements/nodes/rect.js.map +1 -1
- package/esm/elements/nodes/star.d.ts +7 -10
- package/esm/elements/nodes/star.js.map +1 -1
- package/esm/elements/nodes/triangle.d.ts +7 -10
- package/esm/elements/nodes/triangle.js.map +1 -1
- package/esm/exports.d.ts +8 -5
- package/esm/exports.js +4 -2
- package/esm/exports.js.map +1 -1
- package/esm/layouts/index.d.ts +1 -1
- package/esm/layouts/index.js +1 -1
- package/esm/layouts/index.js.map +1 -1
- package/esm/layouts/types.d.ts +6 -6
- package/esm/palettes/index.d.ts +1 -0
- package/esm/palettes/index.js +12 -0
- package/esm/palettes/index.js.map +1 -1
- package/esm/plugins/history/events.d.ts +21 -0
- package/esm/plugins/history/events.js +16 -0
- package/esm/plugins/history/events.js.map +1 -0
- package/esm/plugins/history/index.d.ts +82 -0
- package/esm/plugins/history/index.js +168 -0
- package/esm/plugins/history/index.js.map +1 -0
- package/esm/plugins/history/utils.d.ts +31 -0
- package/esm/plugins/history/utils.js +79 -0
- package/esm/plugins/history/utils.js.map +1 -0
- package/esm/plugins/hull/index.d.ts +58 -0
- package/esm/plugins/hull/index.js +107 -0
- package/esm/plugins/hull/index.js.map +1 -0
- package/esm/plugins/hull/shape.d.ts +49 -0
- package/esm/plugins/hull/shape.js +35 -0
- package/esm/plugins/hull/shape.js.map +1 -0
- package/esm/plugins/hull/util.d.ts +12 -0
- package/esm/plugins/hull/util.js +203 -0
- package/esm/plugins/hull/util.js.map +1 -0
- package/esm/plugins/index.d.ts +4 -0
- package/esm/plugins/index.js +2 -0
- package/esm/plugins/index.js.map +1 -1
- package/esm/plugins/legend.js +3 -2
- package/esm/plugins/legend.js.map +1 -1
- package/esm/registry/build-in.js +24 -7
- package/esm/registry/build-in.js.map +1 -1
- package/esm/registry/extension/index.d.ts +1 -1
- package/esm/registry/index.js +1 -0
- package/esm/registry/index.js.map +1 -1
- package/esm/registry/types.d.ts +4 -0
- package/esm/runtime/batch.d.ts +11 -0
- package/esm/runtime/batch.js +31 -0
- package/esm/runtime/batch.js.map +1 -0
- package/esm/runtime/behavior.d.ts +1 -1
- package/esm/runtime/behavior.js.map +1 -1
- package/esm/runtime/canvas.d.ts +13 -3
- package/esm/runtime/canvas.js +40 -13
- package/esm/runtime/canvas.js.map +1 -1
- package/esm/runtime/data.d.ts +8 -8
- package/esm/runtime/data.js +23 -25
- package/esm/runtime/data.js.map +1 -1
- package/esm/runtime/element.d.ts +6 -22
- package/esm/runtime/element.js +73 -177
- package/esm/runtime/element.js.map +1 -1
- package/esm/runtime/graph.d.ts +42 -5
- package/esm/runtime/graph.js +68 -10
- package/esm/runtime/graph.js.map +1 -1
- package/esm/runtime/layout.d.ts +5 -11
- package/esm/runtime/layout.js +31 -77
- package/esm/runtime/layout.js.map +1 -1
- package/esm/runtime/plugin.d.ts +1 -1
- package/esm/runtime/plugin.js.map +1 -1
- package/esm/runtime/transform.d.ts +11 -0
- package/esm/runtime/transform.js +20 -0
- package/esm/runtime/transform.js.map +1 -0
- package/esm/runtime/types.d.ts +14 -0
- package/esm/runtime/viewport.d.ts +1 -2
- package/esm/runtime/viewport.js.map +1 -1
- package/esm/spec/data.d.ts +74 -1
- package/esm/spec/element/combo.d.ts +17 -6
- package/esm/spec/element/edge.d.ts +14 -2
- package/esm/spec/element/node.d.ts +19 -3
- package/esm/spec/index.d.ts +1 -0
- package/esm/spec/spec.d.ts +7 -0
- package/esm/spec/transform.d.ts +12 -0
- package/esm/spec/transform.js +2 -0
- package/esm/spec/transform.js.map +1 -0
- package/esm/themes/base.d.ts +1 -0
- package/esm/themes/base.js +11 -1
- package/esm/themes/base.js.map +1 -1
- package/esm/transforms/arrange-draw-order.d.ts +10 -0
- package/esm/transforms/arrange-draw-order.js +27 -0
- package/esm/transforms/arrange-draw-order.js.map +1 -0
- package/esm/transforms/base-transform.d.ts +7 -0
- package/esm/transforms/base-transform.js +7 -0
- package/esm/transforms/base-transform.js.map +1 -0
- package/esm/transforms/collapse-expand-combo.d.ts +10 -0
- package/esm/transforms/collapse-expand-combo.js +82 -0
- package/esm/transforms/collapse-expand-combo.js.map +1 -0
- package/esm/transforms/index.d.ts +6 -0
- package/esm/transforms/index.js +6 -0
- package/esm/transforms/index.js.map +1 -0
- package/esm/transforms/process-parallel-edges.d.ts +83 -0
- package/esm/transforms/process-parallel-edges.js +213 -0
- package/esm/transforms/process-parallel-edges.js.map +1 -0
- package/esm/transforms/types.d.ts +20 -0
- package/esm/transforms/types.js +11 -0
- package/esm/transforms/types.js.map +1 -0
- package/esm/transforms/update-related-edge.d.ts +9 -0
- package/esm/transforms/update-related-edge.js +20 -0
- package/esm/transforms/update-related-edge.js.map +1 -0
- package/esm/types/callable.d.ts +2 -2
- package/esm/types/canvas.d.ts +1 -1
- package/esm/types/change.d.ts +27 -10
- package/esm/types/data.d.ts +1 -1
- package/esm/types/element.d.ts +6 -140
- package/esm/types/id.d.ts +1 -0
- package/esm/types/id.js +2 -0
- package/esm/types/id.js.map +1 -0
- package/esm/types/index.d.ts +1 -0
- package/esm/types/node.d.ts +3 -3
- package/esm/types/point.d.ts +1 -0
- package/esm/types/style.d.ts +1 -3
- package/esm/utils/animation.d.ts +2 -2
- package/esm/utils/animation.js +7 -1
- package/esm/utils/animation.js.map +1 -1
- package/esm/utils/behaviors/brush.d.ts +18 -0
- package/esm/utils/behaviors/brush.js +25 -0
- package/esm/utils/behaviors/brush.js.map +1 -0
- package/esm/utils/behaviors/lasso.d.ts +12 -0
- package/esm/utils/behaviors/lasso.js +112 -0
- package/esm/utils/behaviors/lasso.js.map +1 -0
- package/esm/utils/behaviors/utils.d.ts +21 -0
- package/esm/utils/behaviors/utils.js +42 -0
- package/esm/utils/behaviors/utils.js.map +1 -0
- package/esm/utils/change.d.ts +9 -1
- package/esm/utils/change.js +28 -0
- package/esm/utils/change.js.map +1 -1
- package/esm/utils/combo.d.ts +5 -4
- package/esm/utils/combo.js.map +1 -1
- package/esm/utils/edge.d.ts +12 -2
- package/esm/utils/edge.js +1 -1
- package/esm/utils/edge.js.map +1 -1
- package/esm/utils/event/events.d.ts +1 -1
- package/esm/utils/event/events.js.map +1 -1
- package/esm/utils/extension.d.ts +1 -1
- package/esm/utils/extension.js.map +1 -1
- package/esm/utils/id.d.ts +4 -10
- package/esm/utils/id.js +8 -2
- package/esm/utils/id.js.map +1 -1
- package/esm/utils/line.d.ts +21 -0
- package/esm/utils/line.js +41 -0
- package/esm/utils/line.js.map +1 -0
- package/esm/utils/palette.d.ts +1 -2
- package/esm/utils/palette.js.map +1 -1
- package/esm/utils/path.d.ts +35 -0
- package/esm/utils/path.js +143 -0
- package/esm/utils/path.js.map +1 -0
- package/esm/utils/point.d.ts +74 -20
- package/esm/utils/point.js +168 -44
- package/esm/utils/point.js.map +1 -1
- package/esm/utils/polygon.d.ts +17 -0
- package/esm/utils/polygon.js +62 -0
- package/esm/utils/polygon.js.map +1 -0
- package/esm/utils/position.d.ts +14 -1
- package/esm/utils/position.js +16 -0
- package/esm/utils/position.js.map +1 -1
- package/esm/utils/prefix.d.ts +1 -1
- package/esm/utils/prefix.js.map +1 -1
- package/esm/utils/relation.d.ts +1 -2
- package/esm/utils/relation.js.map +1 -1
- package/esm/utils/shortcut.d.ts +1 -0
- package/esm/utils/shortcut.js +13 -2
- package/esm/utils/shortcut.js.map +1 -1
- package/esm/utils/style.js +3 -3
- package/esm/utils/style.js.map +1 -1
- package/esm/utils/vector.d.ts +3 -2
- package/esm/utils/vector.js +10 -3
- package/esm/utils/vector.js.map +1 -1
- package/lib/behaviors/brush-select.d.ts +103 -0
- package/lib/behaviors/brush-select.js +203 -0
- package/lib/behaviors/brush-select.js.map +1 -0
- package/lib/behaviors/click-element.d.ts +77 -0
- package/lib/behaviors/click-element.js +112 -0
- package/lib/behaviors/click-element.js.map +1 -0
- package/lib/behaviors/collapse-expand.d.ts +1 -2
- package/lib/behaviors/collapse-expand.js.map +1 -1
- package/lib/behaviors/create-edge.d.ts +1 -2
- package/lib/behaviors/create-edge.js.map +1 -1
- package/lib/behaviors/drag-element-force.d.ts +13 -0
- package/lib/behaviors/drag-element-force.js +59 -0
- package/lib/behaviors/drag-element-force.js.map +1 -0
- package/lib/behaviors/drag-element.d.ts +12 -12
- package/lib/behaviors/drag-element.js +17 -9
- package/lib/behaviors/drag-element.js.map +1 -1
- package/lib/behaviors/focus-element.js.map +1 -1
- package/lib/behaviors/hover-element.js +1 -1
- package/lib/behaviors/hover-element.js.map +1 -1
- package/lib/behaviors/index.d.ts +8 -0
- package/lib/behaviors/index.js +9 -1
- package/lib/behaviors/index.js.map +1 -1
- package/lib/behaviors/lasso-select.d.ts +19 -0
- package/lib/behaviors/lasso-select.js +83 -0
- package/lib/behaviors/lasso-select.js.map +1 -0
- package/lib/behaviors/types.d.ts +1 -0
- package/lib/constants/change.d.ts +1 -1
- package/lib/constants/change.js +13 -13
- package/lib/constants/change.js.map +1 -1
- package/lib/constants/events/animation.d.ts +1 -4
- package/lib/constants/events/animation.js +0 -4
- package/lib/constants/events/animation.js.map +1 -1
- package/lib/constants/events/graph.d.ts +9 -7
- package/lib/constants/events/graph.js +9 -9
- package/lib/constants/events/graph.js.map +1 -1
- package/lib/constants/registry.d.ts +3 -1
- package/lib/constants/registry.js +2 -0
- package/lib/constants/registry.js.map +1 -1
- package/lib/elements/combos/base-combo.d.ts +43 -6
- package/lib/elements/combos/base-combo.js.map +1 -1
- package/lib/elements/combos/circle.d.ts +8 -12
- package/lib/elements/combos/circle.js.map +1 -1
- package/lib/elements/combos/rect.d.ts +5 -9
- package/lib/elements/combos/rect.js.map +1 -1
- package/lib/elements/edges/base-edge.d.ts +64 -10
- package/lib/elements/edges/base-edge.js.map +1 -1
- package/lib/elements/edges/cubic-horizontal.d.ts +2 -2
- package/lib/elements/edges/cubic-vertical.d.ts +2 -2
- package/lib/elements/edges/cubic.d.ts +2 -2
- package/lib/elements/edges/polyline.d.ts +2 -2
- package/lib/elements/edges/quadratic.d.ts +2 -2
- package/lib/elements/nodes/base-node.d.ts +104 -14
- package/lib/elements/nodes/base-node.js +4 -1
- package/lib/elements/nodes/base-node.js.map +1 -1
- package/lib/elements/nodes/circle.d.ts +5 -8
- package/lib/elements/nodes/circle.js.map +1 -1
- package/lib/elements/nodes/diamond.d.ts +2 -4
- package/lib/elements/nodes/diamond.js +2 -2
- package/lib/elements/nodes/diamond.js.map +1 -1
- package/lib/elements/nodes/donut.d.ts +45 -0
- package/lib/elements/nodes/donut.js +85 -0
- package/lib/elements/nodes/donut.js.map +1 -0
- package/lib/elements/nodes/ellipse.d.ts +5 -8
- package/lib/elements/nodes/ellipse.js +1 -1
- package/lib/elements/nodes/ellipse.js.map +1 -1
- package/lib/elements/nodes/hexagon.d.ts +6 -9
- package/lib/elements/nodes/hexagon.js.map +1 -1
- package/lib/elements/nodes/html.d.ts +27 -0
- package/lib/elements/nodes/html.js +213 -0
- package/lib/elements/nodes/html.js.map +1 -0
- package/lib/elements/nodes/image.d.ts +9 -11
- package/lib/elements/nodes/image.js.map +1 -1
- package/lib/elements/nodes/index.d.ts +4 -0
- package/lib/elements/nodes/index.js +5 -1
- package/lib/elements/nodes/index.js.map +1 -1
- package/lib/elements/nodes/polygon.d.ts +9 -8
- package/lib/elements/nodes/polygon.js +4 -1
- package/lib/elements/nodes/polygon.js.map +1 -1
- package/lib/elements/nodes/rect.d.ts +2 -3
- package/lib/elements/nodes/rect.js.map +1 -1
- package/lib/elements/nodes/star.d.ts +7 -10
- package/lib/elements/nodes/star.js.map +1 -1
- package/lib/elements/nodes/triangle.d.ts +7 -10
- package/lib/elements/nodes/triangle.js.map +1 -1
- package/lib/exports.d.ts +8 -5
- package/lib/exports.js +8 -1
- package/lib/exports.js.map +1 -1
- package/lib/layouts/index.d.ts +1 -1
- package/lib/layouts/index.js +2 -1
- package/lib/layouts/index.js.map +1 -1
- package/lib/layouts/types.d.ts +6 -6
- package/lib/palettes/index.d.ts +1 -0
- package/lib/palettes/index.js +13 -1
- package/lib/palettes/index.js.map +1 -1
- package/lib/plugins/history/events.d.ts +21 -0
- package/lib/plugins/history/events.js +19 -0
- package/lib/plugins/history/events.js.map +1 -0
- package/lib/plugins/history/index.d.ts +82 -0
- package/lib/plugins/history/index.js +175 -0
- package/lib/plugins/history/index.js.map +1 -0
- package/lib/plugins/history/utils.d.ts +31 -0
- package/lib/plugins/history/utils.js +84 -0
- package/lib/plugins/history/utils.js.map +1 -0
- package/lib/plugins/hull/index.d.ts +58 -0
- package/lib/plugins/hull/index.js +114 -0
- package/lib/plugins/hull/index.js.map +1 -0
- package/lib/plugins/hull/shape.d.ts +49 -0
- package/lib/plugins/hull/shape.js +39 -0
- package/lib/plugins/hull/shape.js.map +1 -0
- package/lib/plugins/hull/util.d.ts +12 -0
- package/lib/plugins/hull/util.js +207 -0
- package/lib/plugins/hull/util.js.map +1 -0
- package/lib/plugins/index.d.ts +4 -0
- package/lib/plugins/index.js +5 -1
- package/lib/plugins/index.js.map +1 -1
- package/lib/plugins/legend.js +3 -2
- package/lib/plugins/legend.js.map +1 -1
- package/lib/registry/build-in.js +19 -2
- package/lib/registry/build-in.js.map +1 -1
- package/lib/registry/extension/index.d.ts +1 -1
- package/lib/registry/index.js +1 -0
- package/lib/registry/index.js.map +1 -1
- package/lib/registry/types.d.ts +4 -0
- package/lib/runtime/batch.d.ts +11 -0
- package/lib/runtime/batch.js +35 -0
- package/lib/runtime/batch.js.map +1 -0
- package/lib/runtime/behavior.d.ts +1 -1
- package/lib/runtime/behavior.js.map +1 -1
- package/lib/runtime/canvas.d.ts +13 -3
- package/lib/runtime/canvas.js +38 -11
- package/lib/runtime/canvas.js.map +1 -1
- package/lib/runtime/data.d.ts +8 -8
- package/lib/runtime/data.js +22 -24
- package/lib/runtime/data.js.map +1 -1
- package/lib/runtime/element.d.ts +6 -22
- package/lib/runtime/element.js +72 -176
- package/lib/runtime/element.js.map +1 -1
- package/lib/runtime/graph.d.ts +42 -5
- package/lib/runtime/graph.js +67 -9
- package/lib/runtime/graph.js.map +1 -1
- package/lib/runtime/layout.d.ts +5 -11
- package/lib/runtime/layout.js +29 -75
- package/lib/runtime/layout.js.map +1 -1
- package/lib/runtime/plugin.d.ts +1 -1
- package/lib/runtime/plugin.js.map +1 -1
- package/lib/runtime/transform.d.ts +11 -0
- package/lib/runtime/transform.js +24 -0
- package/lib/runtime/transform.js.map +1 -0
- package/lib/runtime/types.d.ts +14 -0
- package/lib/runtime/viewport.d.ts +1 -2
- package/lib/runtime/viewport.js.map +1 -1
- package/lib/spec/data.d.ts +74 -1
- package/lib/spec/element/combo.d.ts +17 -6
- package/lib/spec/element/edge.d.ts +14 -2
- package/lib/spec/element/node.d.ts +19 -3
- package/lib/spec/index.d.ts +1 -0
- package/lib/spec/spec.d.ts +7 -0
- package/lib/spec/transform.d.ts +12 -0
- package/lib/spec/transform.js +3 -0
- package/lib/spec/transform.js.map +1 -0
- package/lib/themes/base.d.ts +1 -0
- package/lib/themes/base.js +11 -1
- package/lib/themes/base.js.map +1 -1
- package/lib/transforms/arrange-draw-order.d.ts +10 -0
- package/lib/transforms/arrange-draw-order.js +31 -0
- package/lib/transforms/arrange-draw-order.js.map +1 -0
- package/lib/transforms/base-transform.d.ts +7 -0
- package/lib/transforms/base-transform.js +11 -0
- package/lib/transforms/base-transform.js.map +1 -0
- package/lib/transforms/collapse-expand-combo.d.ts +10 -0
- package/lib/transforms/collapse-expand-combo.js +86 -0
- package/lib/transforms/collapse-expand-combo.js.map +1 -0
- package/lib/transforms/index.d.ts +6 -0
- package/lib/transforms/index.js +14 -0
- package/lib/transforms/index.js.map +1 -0
- package/lib/transforms/process-parallel-edges.d.ts +83 -0
- package/lib/transforms/process-parallel-edges.js +220 -0
- package/lib/transforms/process-parallel-edges.js.map +1 -0
- package/lib/transforms/types.d.ts +20 -0
- package/lib/transforms/types.js +15 -0
- package/lib/transforms/types.js.map +1 -0
- package/lib/transforms/update-related-edge.d.ts +9 -0
- package/lib/transforms/update-related-edge.js +24 -0
- package/lib/transforms/update-related-edge.js.map +1 -0
- package/lib/types/callable.d.ts +2 -2
- package/lib/types/canvas.d.ts +1 -1
- package/lib/types/change.d.ts +27 -10
- package/lib/types/data.d.ts +1 -1
- package/lib/types/element.d.ts +6 -140
- package/lib/types/id.d.ts +1 -0
- package/lib/{spec/element/base.js → types/id.js} +1 -1
- package/lib/types/id.js.map +1 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/node.d.ts +3 -3
- package/lib/types/point.d.ts +1 -0
- package/lib/types/style.d.ts +1 -3
- package/lib/utils/animation.d.ts +2 -2
- package/lib/utils/animation.js +7 -1
- package/lib/utils/animation.js.map +1 -1
- package/lib/utils/behaviors/brush.d.ts +18 -0
- package/lib/utils/behaviors/brush.js +30 -0
- package/lib/utils/behaviors/brush.js.map +1 -0
- package/lib/utils/behaviors/lasso.d.ts +12 -0
- package/lib/utils/behaviors/lasso.js +116 -0
- package/lib/utils/behaviors/lasso.js.map +1 -0
- package/lib/utils/behaviors/utils.d.ts +21 -0
- package/lib/utils/behaviors/utils.js +47 -0
- package/lib/utils/behaviors/utils.js.map +1 -0
- package/lib/utils/change.d.ts +9 -1
- package/lib/utils/change.js +30 -1
- package/lib/utils/change.js.map +1 -1
- package/lib/utils/combo.d.ts +5 -4
- package/lib/utils/combo.js.map +1 -1
- package/lib/utils/edge.d.ts +12 -2
- package/lib/utils/edge.js +2 -1
- package/lib/utils/edge.js.map +1 -1
- package/lib/utils/event/events.d.ts +1 -1
- package/lib/utils/event/events.js.map +1 -1
- package/lib/utils/extension.d.ts +1 -1
- package/lib/utils/extension.js.map +1 -1
- package/lib/utils/id.d.ts +4 -10
- package/lib/utils/id.js +10 -4
- package/lib/utils/id.js.map +1 -1
- package/lib/utils/line.d.ts +21 -0
- package/lib/utils/line.js +46 -0
- package/lib/utils/line.js.map +1 -0
- package/lib/utils/palette.d.ts +1 -2
- package/lib/utils/palette.js.map +1 -1
- package/lib/utils/path.d.ts +35 -0
- package/lib/utils/path.js +150 -0
- package/lib/utils/path.js.map +1 -0
- package/lib/utils/point.d.ts +74 -20
- package/lib/utils/point.js +178 -48
- package/lib/utils/point.js.map +1 -1
- package/lib/utils/polygon.d.ts +17 -0
- package/lib/utils/polygon.js +66 -0
- package/lib/utils/polygon.js.map +1 -0
- package/lib/utils/position.d.ts +14 -1
- package/lib/utils/position.js +18 -1
- package/lib/utils/position.js.map +1 -1
- package/lib/utils/prefix.d.ts +1 -1
- package/lib/utils/prefix.js.map +1 -1
- package/lib/utils/relation.d.ts +1 -2
- package/lib/utils/relation.js.map +1 -1
- package/lib/utils/shortcut.d.ts +1 -0
- package/lib/utils/shortcut.js +12 -1
- package/lib/utils/shortcut.js.map +1 -1
- package/lib/utils/style.js +3 -3
- package/lib/utils/style.js.map +1 -1
- package/lib/utils/vector.d.ts +3 -2
- package/lib/utils/vector.js +10 -3
- package/lib/utils/vector.js.map +1 -1
- package/package.json +5 -6
- package/src/behaviors/brush-select.ts +305 -0
- package/src/behaviors/click-element.ts +181 -0
- package/src/behaviors/collapse-expand.ts +1 -2
- package/src/behaviors/create-edge.ts +1 -2
- package/src/behaviors/drag-element-force.ts +69 -0
- package/src/behaviors/drag-element.ts +27 -18
- package/src/behaviors/focus-element.ts +1 -2
- package/src/behaviors/hover-element.ts +3 -5
- package/src/behaviors/index.ts +8 -0
- package/src/behaviors/lasso-select.ts +102 -0
- package/src/behaviors/types.ts +2 -0
- package/src/constants/change.ts +1 -1
- package/src/constants/events/animation.ts +0 -4
- package/src/constants/events/graph.ts +8 -8
- package/src/constants/registry.ts +2 -0
- package/src/elements/combos/base-combo.ts +59 -10
- package/src/elements/combos/circle.ts +8 -11
- package/src/elements/combos/rect.ts +5 -8
- package/src/elements/edges/base-edge.ts +70 -13
- package/src/elements/edges/cubic-horizontal.ts +2 -2
- package/src/elements/edges/cubic-vertical.ts +2 -2
- package/src/elements/edges/cubic.ts +2 -2
- package/src/elements/edges/polyline.ts +2 -2
- package/src/elements/edges/quadratic.ts +2 -2
- package/src/elements/nodes/base-node.ts +117 -21
- package/src/elements/nodes/circle.ts +5 -7
- package/src/elements/nodes/diamond.ts +4 -6
- package/src/elements/nodes/donut.ts +137 -0
- package/src/elements/nodes/ellipse.ts +6 -8
- package/src/elements/nodes/hexagon.ts +7 -9
- package/src/elements/nodes/html.ts +230 -0
- package/src/elements/nodes/image.ts +12 -13
- package/src/elements/nodes/index.ts +4 -0
- package/src/elements/nodes/polygon.ts +17 -11
- package/src/elements/nodes/rect.ts +3 -4
- package/src/elements/nodes/star.ts +9 -11
- package/src/elements/nodes/triangle.ts +7 -9
- package/src/exports.ts +24 -3
- package/src/layouts/index.ts +1 -0
- package/src/layouts/types.ts +7 -5
- package/src/palettes/index.ts +13 -0
- package/src/plugins/history/events.ts +25 -0
- package/src/plugins/history/index.ts +222 -0
- package/src/plugins/history/utils.ts +98 -0
- package/src/plugins/hull/index.ts +148 -0
- package/src/plugins/hull/shape.ts +96 -0
- package/src/plugins/hull/util.ts +222 -0
- package/src/plugins/index.ts +4 -0
- package/src/plugins/legend.ts +5 -5
- package/src/registry/build-in.ts +28 -4
- package/src/registry/extension/index.ts +1 -1
- package/src/registry/index.ts +1 -0
- package/src/registry/types.ts +2 -0
- package/src/runtime/batch.ts +38 -0
- package/src/runtime/behavior.ts +1 -1
- package/src/runtime/canvas.ts +55 -14
- package/src/runtime/data.ts +33 -37
- package/src/runtime/element.ts +90 -203
- package/src/runtime/graph.ts +78 -13
- package/src/runtime/layout.ts +50 -81
- package/src/runtime/plugin.ts +1 -1
- package/src/runtime/transform.ts +27 -0
- package/src/runtime/types.ts +14 -0
- package/src/runtime/viewport.ts +1 -2
- package/src/spec/data.ts +74 -1
- package/src/spec/element/combo.ts +17 -6
- package/src/spec/element/edge.ts +14 -2
- package/src/spec/element/node.ts +19 -3
- package/src/spec/index.ts +1 -0
- package/src/spec/spec.ts +7 -0
- package/src/spec/transform.ts +15 -0
- package/src/themes/base.ts +12 -1
- package/src/transforms/arrange-draw-order.ts +36 -0
- package/src/transforms/base-transform.ts +11 -0
- package/src/transforms/collapse-expand-combo.ts +87 -0
- package/src/transforms/index.ts +7 -0
- package/src/transforms/process-parallel-edges.ts +284 -0
- package/src/transforms/types.ts +23 -0
- package/src/transforms/update-related-edge.ts +27 -0
- package/src/types/callable.ts +2 -2
- package/src/types/canvas.ts +1 -1
- package/src/types/change.ts +28 -10
- package/src/types/data.ts +1 -1
- package/src/types/element.ts +6 -147
- package/src/types/id.ts +1 -0
- package/src/types/index.ts +1 -0
- package/src/types/node.ts +3 -3
- package/src/types/point.ts +1 -0
- package/src/types/style.ts +1 -3
- package/src/utils/animation.ts +8 -2
- package/src/utils/behaviors/brush.ts +28 -0
- package/src/utils/behaviors/lasso.ts +126 -0
- package/src/utils/behaviors/utils.ts +47 -0
- package/src/utils/change.ts +42 -2
- package/src/utils/combo.ts +6 -5
- package/src/utils/edge.ts +7 -2
- package/src/utils/event/events.ts +3 -1
- package/src/utils/extension.ts +1 -1
- package/src/utils/id.ts +11 -3
- package/src/utils/line.ts +50 -0
- package/src/utils/palette.ts +1 -1
- package/src/utils/path.ts +153 -0
- package/src/utils/point.ts +190 -51
- package/src/utils/polygon.ts +72 -0
- package/src/utils/position.ts +18 -1
- package/src/utils/prefix.ts +1 -1
- package/src/utils/relation.ts +1 -2
- package/src/utils/shortcut.ts +13 -2
- package/src/utils/style.ts +4 -4
- package/src/utils/vector.ts +10 -3
- package/dist/lib/runtime/index.d.ts +0 -6
- package/dist/lib/spec/element/base.d.ts +0 -6
- package/esm/elements/types.d.ts +0 -0
- package/esm/elements/types.js +0 -15
- package/esm/elements/types.js.map +0 -1
- package/esm/runtime/index.d.ts +0 -6
- package/esm/runtime/index.js +0 -7
- package/esm/runtime/index.js.map +0 -1
- package/esm/spec/element/base.d.ts +0 -6
- package/esm/spec/element/base.js +0 -2
- package/esm/spec/element/base.js.map +0 -1
- package/lib/elements/types.d.ts +0 -0
- package/lib/elements/types.js +0 -15
- package/lib/elements/types.js.map +0 -1
- package/lib/runtime/index.d.ts +0 -6
- package/lib/runtime/index.js +0 -8
- package/lib/runtime/index.js.map +0 -1
- package/lib/spec/element/base.d.ts +0 -6
- package/lib/spec/element/base.js.map +0 -1
- package/src/elements/types.ts +0 -21
- package/src/runtime/index.ts +0 -7
- package/src/spec/element/base.ts +0 -6
|
@@ -11,6 +11,9 @@ class Polygon extends base_node_1.BaseNode {
|
|
|
11
11
|
constructor(options) {
|
|
12
12
|
super(options);
|
|
13
13
|
}
|
|
14
|
+
get parsedAttributes() {
|
|
15
|
+
return this.attributes;
|
|
16
|
+
}
|
|
14
17
|
drawKeyShape(attributes, container) {
|
|
15
18
|
return this.upsert('key', g_1.Polygon, this.getKeyStyle(attributes), container);
|
|
16
19
|
}
|
|
@@ -21,7 +24,7 @@ class Polygon extends base_node_1.BaseNode {
|
|
|
21
24
|
getIntersectPoint(point) {
|
|
22
25
|
const { points } = this.getKeyStyle(this.parsedAttributes);
|
|
23
26
|
const center = [+(this.attributes?.x || 0), +(this.attributes?.y || 0)];
|
|
24
|
-
return (0, point_1.getPolygonIntersectPoint)(point, center, points);
|
|
27
|
+
return (0, point_1.getPolygonIntersectPoint)(point, center, points).point;
|
|
25
28
|
}
|
|
26
29
|
}
|
|
27
30
|
exports.Polygon = Polygon;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polygon.js","sourceRoot":"src/","sources":["elements/nodes/polygon.ts"],"names":[],"mappings":";;;AACA,+BAA8C;AAE9C,6CAA6D;AAE7D,2CAAuC;
|
|
1
|
+
{"version":3,"file":"polygon.js","sourceRoot":"src/","sources":["elements/nodes/polygon.ts"],"names":[],"mappings":";;;AACA,+BAA8C;AAE9C,6CAA6D;AAE7D,2CAAuC;AAQvC;;GAEG;AACH,MAAsB,OAAyD,SAAQ,oBAAW;IAChG,YAAY,OAAkD;QAC5D,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAED,IAAW,gBAAgB;QACzB,OAAO,IAAI,CAAC,UAAuD,CAAC;IACtE,CAAC;IAES,YAAY,CAAC,UAA0C,EAAE,SAAgB;QACjF,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,WAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,SAAS,CAAC,CAAC;IAC/E,CAAC;IAES,WAAW,CAAC,UAA0C;QAC9D,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAC/C,OAAO,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;IAC7D,CAAC;IAIM,iBAAiB,CAAC,KAAY;QACnC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,gBAAkD,CAAC,CAAC;QAC7F,MAAM,MAAM,GAAU,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC/E,OAAO,IAAA,gCAAwB,EAAC,KAAK,EAAE,MAAM,EAAE,MAAO,CAAC,CAAC,KAAK,CAAC;IAChE,CAAC;CACF;AAzBD,0BAyBC"}
|
|
@@ -3,16 +3,15 @@ import { Rect as GRect } from '@antv/g';
|
|
|
3
3
|
import type { IconStyleProps } from '../shapes';
|
|
4
4
|
import type { BaseNodeStyleProps } from './base-node';
|
|
5
5
|
import { BaseNode } from './base-node';
|
|
6
|
-
export type RectStyleProps = BaseNodeStyleProps
|
|
6
|
+
export type RectStyleProps = BaseNodeStyleProps;
|
|
7
7
|
type ParsedRectStyleProps = Required<RectStyleProps>;
|
|
8
|
-
type KeyStyleProps = GRectStyleProps;
|
|
9
8
|
/**
|
|
10
9
|
* Draw Rect based on BaseNode, override drawKeyShape.
|
|
11
10
|
*/
|
|
12
11
|
export declare class Rect extends BaseNode<RectStyleProps> {
|
|
13
12
|
static defaultStyleProps: Partial<RectStyleProps>;
|
|
14
13
|
constructor(options: DisplayObjectConfig<RectStyleProps>);
|
|
15
|
-
protected getKeyStyle(attributes: ParsedRectStyleProps):
|
|
14
|
+
protected getKeyStyle(attributes: ParsedRectStyleProps): GRectStyleProps;
|
|
16
15
|
protected getIconStyle(attributes: ParsedRectStyleProps): false | IconStyleProps;
|
|
17
16
|
protected drawKeyShape(attributes: ParsedRectStyleProps, container: Group): GRect | undefined;
|
|
18
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rect.js","sourceRoot":"src/","sources":["elements/nodes/rect.ts"],"names":[],"mappings":";;;AACA,+BAAwC;AACxC,qCAAqC;AACrC,qDAA0D;AAG1D,2CAAuC;
|
|
1
|
+
{"version":3,"file":"rect.js","sourceRoot":"src/","sources":["elements/nodes/rect.ts"],"names":[],"mappings":";;;AACA,+BAAwC;AACxC,qCAAqC;AACrC,qDAA0D;AAG1D,2CAAuC;AAKvC;;GAEG;AACH,MAAa,IAAK,SAAQ,oBAAwB;IAChD,MAAM,CAAC,iBAAiB,GAA4B;QAClD,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;QACd,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;KACnB,CAAC;IAEF,YAAY,OAA4C;QACtD,KAAK,CAAC,IAAA,cAAO,EAAC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,iBAAiB,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;IACjE,CAAC;IAES,WAAW,CAAC,UAAgC;QACpD,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACjD,OAAO;YACL,GAAG,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC;YAChC,KAAK;YACL,MAAM;SACP,CAAC;IACJ,CAAC;IAES,YAAY,CAAC,UAAgC;QACrD,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;QAC7C,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAEvD,OAAO,KAAK;YACV,CAAC,CAAE;gBACC,KAAK,EAAG,KAAgB,GAAG,yBAAe;gBAC1C,MAAM,EAAG,MAAiB,GAAG,yBAAe;gBAC5C,GAAG,KAAK;aACU;YACtB,CAAC,CAAC,KAAK,CAAC;IACZ,CAAC;IAES,YAAY,CAAC,UAAgC,EAAE,SAAgB;QACvE,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,QAAK,EAAE,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,SAAS,CAAC,CAAC;IAC5E,CAAC;;AAlCH,oBAmCC"}
|
|
@@ -2,23 +2,20 @@ import type { DisplayObjectConfig } from '@antv/g';
|
|
|
2
2
|
import type { Point } from '../../types';
|
|
3
3
|
import type { IconStyleProps } from '../shapes';
|
|
4
4
|
import { NodePortStyleProps } from './base-node';
|
|
5
|
-
import type {
|
|
5
|
+
import type { PolygonStyleProps } from './polygon';
|
|
6
6
|
import { Polygon } from './polygon';
|
|
7
|
-
export type StarStyleProps = PolygonStyleProps
|
|
8
|
-
type ParsedStarStyleProps = ParsedPolygonStyleProps & Required<ExtendsStyleProps>;
|
|
9
|
-
type ExtendsStyleProps = {
|
|
7
|
+
export type StarStyleProps = PolygonStyleProps<{
|
|
10
8
|
/**
|
|
11
9
|
* <zh/> 内半径
|
|
12
10
|
* <en/> Inner radius
|
|
13
11
|
*/
|
|
14
12
|
innerR?: number;
|
|
15
|
-
}
|
|
16
|
-
export declare class Star extends Polygon {
|
|
13
|
+
}>;
|
|
14
|
+
export declare class Star extends Polygon<StarStyleProps> {
|
|
17
15
|
constructor(options: DisplayObjectConfig<StarStyleProps>);
|
|
18
16
|
private getInnerR;
|
|
19
17
|
private getOuterR;
|
|
20
|
-
protected getPoints(attributes:
|
|
21
|
-
protected getIconStyle(attributes:
|
|
22
|
-
protected getPortXY(attributes:
|
|
18
|
+
protected getPoints(attributes: Required<StarStyleProps>): Point[];
|
|
19
|
+
protected getIconStyle(attributes: Required<StarStyleProps>): false | IconStyleProps;
|
|
20
|
+
protected getPortXY(attributes: Required<StarStyleProps>, style: NodePortStyleProps): Point;
|
|
23
21
|
}
|
|
24
|
-
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"star.js","sourceRoot":"src/","sources":["elements/nodes/star.ts"],"names":[],"mappings":";;;AACA,qDAA0D;AAE1D,iDAAwF;AAIxF,uCAAoC;
|
|
1
|
+
{"version":3,"file":"star.js","sourceRoot":"src/","sources":["elements/nodes/star.ts"],"names":[],"mappings":";;;AACA,qDAA0D;AAE1D,iDAAwF;AAIxF,uCAAoC;AAUpC,MAAa,IAAK,SAAQ,iBAAuB;IAC/C,YAAY,OAA4C;QACtD,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAEO,SAAS,CAAC,UAAoC;QACpD,OAAO,UAAU,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IACnE,CAAC;IAEO,SAAS,CAAC,UAAoC;QACpD,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC;IACnD,CAAC;IAES,SAAS,CAAC,UAAoC;QACtD,OAAO,IAAA,uBAAa,EAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IAC/E,CAAC;IAES,YAAY,CAAC,UAAoC;QACzD,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;QAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,yBAAe,CAAC;QAC9D,OAAO,KAAK,CAAC,CAAC,CAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,EAAqB,CAAC,CAAC,CAAC,KAAK,CAAC;IACrF,CAAC;IAES,SAAS,CAAC,UAAoC,EAAE,KAAyB;QACjF,MAAM,EAAE,SAAS,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC;QACpC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,cAAc,EAAE,CAAC;QAC5C,MAAM,KAAK,GAAG,IAAA,sBAAY,EAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;QACnF,OAAO,IAAA,8BAAoB,EAAC,IAAI,EAAE,SAA8B,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAClF,CAAC;CACF;AA7BD,oBA6BC"}
|
|
@@ -2,23 +2,20 @@ import type { DisplayObjectConfig } from '@antv/g';
|
|
|
2
2
|
import type { Point } from '../../types';
|
|
3
3
|
import { IconStyleProps } from '../shapes';
|
|
4
4
|
import type { NodePortStyleProps } from './base-node';
|
|
5
|
-
import type {
|
|
5
|
+
import type { PolygonStyleProps } from './polygon';
|
|
6
6
|
import { Polygon } from './polygon';
|
|
7
|
-
export type TriangleStyleProps = PolygonStyleProps
|
|
8
|
-
type ParsedTriangleStyleProps = ParsedPolygonStyleProps & Required<ExtendsStyleProps>;
|
|
9
|
-
type ExtendsStyleProps = {
|
|
7
|
+
export type TriangleStyleProps = PolygonStyleProps<{
|
|
10
8
|
/**
|
|
11
9
|
* <zh/> 三角形的方向
|
|
12
10
|
* <en/> The direction of the triangle
|
|
13
11
|
*/
|
|
14
12
|
direction?: TriangleDirection;
|
|
15
|
-
}
|
|
13
|
+
}>;
|
|
16
14
|
export type TriangleDirection = 'up' | 'left' | 'right' | 'down';
|
|
17
|
-
export declare class Triangle extends Polygon {
|
|
15
|
+
export declare class Triangle extends Polygon<TriangleStyleProps> {
|
|
18
16
|
static defaultStyleProps: Partial<TriangleStyleProps>;
|
|
19
17
|
constructor(options: DisplayObjectConfig<TriangleStyleProps>);
|
|
20
|
-
protected getPoints(attributes:
|
|
21
|
-
protected getPortXY(attributes:
|
|
22
|
-
protected getIconStyle(attributes:
|
|
18
|
+
protected getPoints(attributes: Required<TriangleStyleProps>): Point[];
|
|
19
|
+
protected getPortXY(attributes: Required<TriangleStyleProps>, style: NodePortStyleProps): Point;
|
|
20
|
+
protected getIconStyle(attributes: Required<TriangleStyleProps>): false | IconStyleProps;
|
|
23
21
|
}
|
|
24
|
-
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"triangle.js","sourceRoot":"src/","sources":["elements/nodes/triangle.ts"],"names":[],"mappings":";;;AACA,qCAA8C;AAC9C,qDAA0D;AAE1D,2CAAwE;AACxE,iDAAgG;AAChG,+CAAmD;AAInD,uCAAoC;
|
|
1
|
+
{"version":3,"file":"triangle.js","sourceRoot":"src/","sources":["elements/nodes/triangle.ts"],"names":[],"mappings":";;;AACA,qCAA8C;AAC9C,qDAA0D;AAE1D,2CAAwE;AACxE,iDAAgG;AAChG,+CAAmD;AAInD,uCAAoC;AAWpC,MAAa,QAAS,SAAQ,iBAA2B;IACvD,MAAM,CAAC,iBAAiB,GAAgC;QACtD,IAAI,EAAE,EAAE;QACR,SAAS,EAAE,IAAI;KAChB,CAAC;IAEF,YAAY,OAAgD;QAC1D,KAAK,CAAC,IAAA,cAAO,EAAC,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,iBAAiB,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;IACrE,CAAC;IAES,SAAS,CAAC,UAAwC;QAC1D,MAAM,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC;QACjC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACjD,OAAO,IAAA,2BAAiB,EAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACrD,CAAC;IAES,SAAS,CAAC,UAAwC,EAAE,KAAyB;QACrF,MAAM,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC;QACjC,MAAM,EAAE,SAAS,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC;QACpC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,cAAc,EAAE,CAAC;QAC5C,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACjD,MAAM,KAAK,GAAG,IAAA,0BAAgB,EAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;QACzD,OAAO,IAAA,8BAAoB,EAAC,IAAI,EAAE,SAAkC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IACtF,CAAC;IAED,kBAAkB;IAClB,0CAA0C;IAChC,YAAY,CAAC,UAAwC;QAC7D,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC;QAE1D,IAAI,IAAI,KAAK,KAAK,IAAI,IAAA,cAAO,EAAC,QAAQ,IAAI,OAAO,CAAC;YAAE,OAAO,KAAK,CAAC;QAEjE,MAAM,SAAS,GAAG,IAAA,sBAAa,EAAiB,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,CAAC;QAC1F,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,cAAc,EAAE,CAAC;QAC5C,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAA,wBAAiB,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAClD,MAAM,IAAI,GAAG,IAAA,wBAAiB,EAAC,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC,GAAG,yBAAe,CAAC;QAEtE,OAAO;YACL,CAAC;YACD,CAAC;YACD,KAAK,EAAE,IAAI;YACX,MAAM,EAAE,IAAI;YACZ,GAAG,SAAS;SACb,CAAC;IACJ,CAAC;;AA5CH,4BA6CC"}
|
package/lib/exports.d.ts
CHANGED
|
@@ -5,21 +5,24 @@ export { BaseBehavior, DragCanvas, ZoomCanvas } from './behaviors';
|
|
|
5
5
|
export { CanvasEvent, ComboEvent, CommonEvent, ContainerEvent, EdgeEvent, ExtensionCategory, GraphEvent, NodeEvent, } from './constants';
|
|
6
6
|
export { BaseCombo, CircleCombo, RectCombo } from './elements/combos';
|
|
7
7
|
export { BaseEdge, Cubic, CubicHorizontal, CubicVertical, Line, Polyline, Quadratic } from './elements/edges';
|
|
8
|
-
export { BaseNode, Circle, Diamond, Ellipse, Hexagon, Image, Rect, Star, Triangle } from './elements/nodes';
|
|
8
|
+
export { BaseNode, Circle, Diamond, Donut, Ellipse, HTML, Hexagon, Image, Rect, Star, Triangle, } from './elements/nodes';
|
|
9
9
|
export { BaseShape } from './elements/shapes';
|
|
10
|
-
export { BasePlugin, CameraSetting } from './plugins';
|
|
10
|
+
export { BasePlugin, CameraSetting, History } from './plugins';
|
|
11
11
|
export { getExtension, getExtensions, register } from './registry';
|
|
12
12
|
export { Graph } from './runtime/graph';
|
|
13
|
+
export { BaseTransform } from './transforms';
|
|
13
14
|
export { Shortcut } from './utils/shortcut';
|
|
15
|
+
export { parseSize } from './utils/size';
|
|
14
16
|
export type { BaseBehaviorOptions, DragCanvasOptions, ZoomCanvasOptions } from './behaviors';
|
|
15
17
|
export type { BaseComboStyleProps, CircleComboStyleProps, RectComboStyleProps } from './elements/combos';
|
|
16
18
|
export type { BaseEdgeStyleProps, CubicHorizontalStyleProps, CubicStyleProps, CubicVerticalStyleProps, LineStyleProps, PolylineStyleProps, QuadraticStyleProps, } from './elements/edges';
|
|
17
|
-
export type { BaseNodeStyleProps, CircleStyleProps, DiamondStyleProps, EllipseStyleProps, HexagonStyleProps, ImageStyleProps, RectStyleProps, StarStyleProps, TriangleStyleProps, } from './elements/nodes';
|
|
19
|
+
export type { BaseNodeStyleProps, CircleStyleProps, DiamondStyleProps, EllipseStyleProps, HTMLStyleProps, HexagonStyleProps, ImageStyleProps, RectStyleProps, StarStyleProps, TriangleStyleProps, } from './elements/nodes';
|
|
18
20
|
export type { BaseShapeStyleProps } from './elements/shapes';
|
|
19
|
-
export type { BasePluginOptions, CameraSettingOptions } from './plugins';
|
|
21
|
+
export type { BasePluginOptions, CameraSettingOptions, Hull } from './plugins';
|
|
20
22
|
export type { RuntimeContext } from './runtime/types';
|
|
21
23
|
export type { BehaviorOptions, CanvasOptions, ComboData, ComboOptions, EdgeData, EdgeOptions, G6Spec, GraphData, LayoutOptions, NodeData, NodeOptions, PluginOptions, ThemeOptions, ViewportOptions, } from './spec';
|
|
22
|
-
export type {
|
|
24
|
+
export type { BaseTransformOptions } from './transforms';
|
|
25
|
+
export type { Combo, Edge, Element, IAnimateEvent, ID, IDragEvent, IElementLifeCycleEvent, IEvent, IGraphLifeCycleEvent, IKeyboardEvent, IPointerEvent, IViewportEvent, IWheelEvent, Node, Point, Vector2, Vector3, ViewportAnimationEffectTiming, } from './types';
|
|
23
26
|
export type { ShortcutKey } from './utils/shortcut';
|
|
24
27
|
declare const Utils: {
|
|
25
28
|
idOf: typeof idOf;
|
package/lib/exports.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Utils = exports.Theme = exports.Shortcut = exports.Graph = exports.register = exports.getExtensions = exports.getExtension = exports.CameraSetting = exports.BasePlugin = exports.BaseShape = exports.Triangle = exports.Star = exports.Rect = exports.Image = exports.Hexagon = exports.Ellipse = exports.Diamond = exports.Circle = exports.BaseNode = exports.Quadratic = exports.Polyline = exports.Line = exports.CubicVertical = exports.CubicHorizontal = exports.Cubic = exports.BaseEdge = exports.RectCombo = exports.CircleCombo = exports.BaseCombo = exports.NodeEvent = exports.GraphEvent = exports.ExtensionCategory = exports.EdgeEvent = exports.ContainerEvent = exports.CommonEvent = exports.ComboEvent = exports.CanvasEvent = exports.ZoomCanvas = exports.DragCanvas = exports.BaseBehavior = void 0;
|
|
3
|
+
exports.Utils = exports.Theme = exports.parseSize = exports.Shortcut = exports.BaseTransform = exports.Graph = exports.register = exports.getExtensions = exports.getExtension = exports.History = exports.CameraSetting = exports.BasePlugin = exports.BaseShape = exports.Triangle = exports.Star = exports.Rect = exports.Image = exports.Hexagon = exports.HTML = exports.Ellipse = exports.Donut = exports.Diamond = exports.Circle = exports.BaseNode = exports.Quadratic = exports.Polyline = exports.Line = exports.CubicVertical = exports.CubicHorizontal = exports.Cubic = exports.BaseEdge = exports.RectCombo = exports.CircleCombo = exports.BaseCombo = exports.NodeEvent = exports.GraphEvent = exports.ExtensionCategory = exports.EdgeEvent = exports.ContainerEvent = exports.CommonEvent = exports.ComboEvent = exports.CanvasEvent = exports.ZoomCanvas = exports.DragCanvas = exports.BaseBehavior = void 0;
|
|
4
4
|
const themes_1 = require("./themes");
|
|
5
5
|
const id_1 = require("./utils/id");
|
|
6
6
|
const prefix_1 = require("./utils/prefix");
|
|
@@ -34,7 +34,9 @@ var nodes_1 = require("./elements/nodes");
|
|
|
34
34
|
Object.defineProperty(exports, "BaseNode", { enumerable: true, get: function () { return nodes_1.BaseNode; } });
|
|
35
35
|
Object.defineProperty(exports, "Circle", { enumerable: true, get: function () { return nodes_1.Circle; } });
|
|
36
36
|
Object.defineProperty(exports, "Diamond", { enumerable: true, get: function () { return nodes_1.Diamond; } });
|
|
37
|
+
Object.defineProperty(exports, "Donut", { enumerable: true, get: function () { return nodes_1.Donut; } });
|
|
37
38
|
Object.defineProperty(exports, "Ellipse", { enumerable: true, get: function () { return nodes_1.Ellipse; } });
|
|
39
|
+
Object.defineProperty(exports, "HTML", { enumerable: true, get: function () { return nodes_1.HTML; } });
|
|
38
40
|
Object.defineProperty(exports, "Hexagon", { enumerable: true, get: function () { return nodes_1.Hexagon; } });
|
|
39
41
|
Object.defineProperty(exports, "Image", { enumerable: true, get: function () { return nodes_1.Image; } });
|
|
40
42
|
Object.defineProperty(exports, "Rect", { enumerable: true, get: function () { return nodes_1.Rect; } });
|
|
@@ -45,14 +47,19 @@ Object.defineProperty(exports, "BaseShape", { enumerable: true, get: function ()
|
|
|
45
47
|
var plugins_1 = require("./plugins");
|
|
46
48
|
Object.defineProperty(exports, "BasePlugin", { enumerable: true, get: function () { return plugins_1.BasePlugin; } });
|
|
47
49
|
Object.defineProperty(exports, "CameraSetting", { enumerable: true, get: function () { return plugins_1.CameraSetting; } });
|
|
50
|
+
Object.defineProperty(exports, "History", { enumerable: true, get: function () { return plugins_1.History; } });
|
|
48
51
|
var registry_1 = require("./registry");
|
|
49
52
|
Object.defineProperty(exports, "getExtension", { enumerable: true, get: function () { return registry_1.getExtension; } });
|
|
50
53
|
Object.defineProperty(exports, "getExtensions", { enumerable: true, get: function () { return registry_1.getExtensions; } });
|
|
51
54
|
Object.defineProperty(exports, "register", { enumerable: true, get: function () { return registry_1.register; } });
|
|
52
55
|
var graph_1 = require("./runtime/graph");
|
|
53
56
|
Object.defineProperty(exports, "Graph", { enumerable: true, get: function () { return graph_1.Graph; } });
|
|
57
|
+
var transforms_1 = require("./transforms");
|
|
58
|
+
Object.defineProperty(exports, "BaseTransform", { enumerable: true, get: function () { return transforms_1.BaseTransform; } });
|
|
54
59
|
var shortcut_1 = require("./utils/shortcut");
|
|
55
60
|
Object.defineProperty(exports, "Shortcut", { enumerable: true, get: function () { return shortcut_1.Shortcut; } });
|
|
61
|
+
var size_1 = require("./utils/size");
|
|
62
|
+
Object.defineProperty(exports, "parseSize", { enumerable: true, get: function () { return size_1.parseSize; } });
|
|
56
63
|
const Utils = {
|
|
57
64
|
idOf: id_1.idOf,
|
|
58
65
|
treeToGraphData: tree_1.treeToGraphData,
|
package/lib/exports.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.js","sourceRoot":"src/","sources":["exports.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AACvC,mCAAkC;AAClC,2CAA+D;AAC/D,uCAA+C;AAE/C,yCAAmE;AAA1D,yGAAA,YAAY,OAAA;AAAE,uGAAA,UAAU,OAAA;AAAE,uGAAA,UAAU,OAAA;AAC7C,yCASqB;AARnB,wGAAA,WAAW,OAAA;AACX,uGAAA,UAAU,OAAA;AACV,wGAAA,WAAW,OAAA;AACX,2GAAA,cAAc,OAAA;AACd,sGAAA,SAAS,OAAA;AACT,8GAAA,iBAAiB,OAAA;AACjB,uGAAA,UAAU,OAAA;AACV,sGAAA,SAAS,OAAA;AAEX,4CAAsE;AAA7D,mGAAA,SAAS,OAAA;AAAE,qGAAA,WAAW,OAAA;AAAE,mGAAA,SAAS,OAAA;AAC1C,0CAA8G;AAArG,iGAAA,QAAQ,OAAA;AAAE,8FAAA,KAAK,OAAA;AAAE,wGAAA,eAAe,OAAA;AAAE,sGAAA,aAAa,OAAA;AAAE,6FAAA,IAAI,OAAA;AAAE,iGAAA,QAAQ,OAAA;AAAE,kGAAA,SAAS,OAAA;AACnF,
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"src/","sources":["exports.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AACvC,mCAAkC;AAClC,2CAA+D;AAC/D,uCAA+C;AAE/C,yCAAmE;AAA1D,yGAAA,YAAY,OAAA;AAAE,uGAAA,UAAU,OAAA;AAAE,uGAAA,UAAU,OAAA;AAC7C,yCASqB;AARnB,wGAAA,WAAW,OAAA;AACX,uGAAA,UAAU,OAAA;AACV,wGAAA,WAAW,OAAA;AACX,2GAAA,cAAc,OAAA;AACd,sGAAA,SAAS,OAAA;AACT,8GAAA,iBAAiB,OAAA;AACjB,uGAAA,UAAU,OAAA;AACV,sGAAA,SAAS,OAAA;AAEX,4CAAsE;AAA7D,mGAAA,SAAS,OAAA;AAAE,qGAAA,WAAW,OAAA;AAAE,mGAAA,SAAS,OAAA;AAC1C,0CAA8G;AAArG,iGAAA,QAAQ,OAAA;AAAE,8FAAA,KAAK,OAAA;AAAE,wGAAA,eAAe,OAAA;AAAE,sGAAA,aAAa,OAAA;AAAE,6FAAA,IAAI,OAAA;AAAE,iGAAA,QAAQ,OAAA;AAAE,kGAAA,SAAS,OAAA;AACnF,0CAY0B;AAXxB,iGAAA,QAAQ,OAAA;AACR,+FAAA,MAAM,OAAA;AACN,gGAAA,OAAO,OAAA;AACP,8FAAA,KAAK,OAAA;AACL,gGAAA,OAAO,OAAA;AACP,6FAAA,IAAI,OAAA;AACJ,gGAAA,OAAO,OAAA;AACP,8FAAA,KAAK,OAAA;AACL,6FAAA,IAAI,OAAA;AACJ,6FAAA,IAAI,OAAA;AACJ,iGAAA,QAAQ,OAAA;AAEV,4CAA8C;AAArC,mGAAA,SAAS,OAAA;AAClB,qCAA+D;AAAtD,qGAAA,UAAU,OAAA;AAAE,wGAAA,aAAa,OAAA;AAAE,kGAAA,OAAO,OAAA;AAC3C,uCAAmE;AAA1D,wGAAA,YAAY,OAAA;AAAE,yGAAA,aAAa,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAC9C,yCAAwC;AAA/B,8FAAA,KAAK,OAAA;AACd,2CAA6C;AAApC,2GAAA,aAAa,OAAA;AACtB,6CAA4C;AAAnC,oGAAA,QAAQ,OAAA;AACjB,qCAAyC;AAAhC,iGAAA,SAAS,OAAA;AAmElB,MAAM,KAAK,GAAG;IACZ,IAAI,EAAJ,SAAI;IACJ,eAAe,EAAf,sBAAe;IACf,aAAa,EAAb,sBAAa;IACb,cAAc,EAAd,uBAAc;CACf,CAAC;AAOc,sBAAK;AALrB,MAAM,KAAK,GAAG;IACZ,IAAI,EAAJ,aAAI;IACJ,KAAK,EAAL,cAAK;CACN,CAAC;AAEO,sBAAK"}
|
package/lib/layouts/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="src/layouts/hierarchy" />
|
|
2
2
|
export { compactBox, dendrogram, indented, mindmap } from '@antv/hierarchy';
|
|
3
|
-
export { AntVDagreLayout, CircularLayout, ComboCombinedLayout, ConcentricLayout, D3ForceLayout, DagreLayout, ForceAtlas2Layout, ForceLayout, FruchtermanLayout, GridLayout, MDSLayout, RadialLayout, RandomLayout, } from '@antv/layout';
|
|
3
|
+
export { AntVDagreLayout, CircularLayout, ComboCombinedLayout, ConcentricLayout, D3Force3DLayout, D3ForceLayout, DagreLayout, ForceAtlas2Layout, ForceLayout, FruchtermanLayout, GridLayout, MDSLayout, RadialLayout, RandomLayout, } from '@antv/layout';
|
package/lib/layouts/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RandomLayout = exports.RadialLayout = exports.MDSLayout = exports.GridLayout = exports.FruchtermanLayout = exports.ForceLayout = exports.ForceAtlas2Layout = exports.DagreLayout = exports.D3ForceLayout = exports.ConcentricLayout = exports.ComboCombinedLayout = exports.CircularLayout = exports.AntVDagreLayout = exports.mindmap = exports.indented = exports.dendrogram = exports.compactBox = void 0;
|
|
3
|
+
exports.RandomLayout = exports.RadialLayout = exports.MDSLayout = exports.GridLayout = exports.FruchtermanLayout = exports.ForceLayout = exports.ForceAtlas2Layout = exports.DagreLayout = exports.D3ForceLayout = exports.D3Force3DLayout = exports.ConcentricLayout = exports.ComboCombinedLayout = exports.CircularLayout = exports.AntVDagreLayout = exports.mindmap = exports.indented = exports.dendrogram = exports.compactBox = void 0;
|
|
4
4
|
var hierarchy_1 = require("@antv/hierarchy");
|
|
5
5
|
Object.defineProperty(exports, "compactBox", { enumerable: true, get: function () { return hierarchy_1.compactBox; } });
|
|
6
6
|
Object.defineProperty(exports, "dendrogram", { enumerable: true, get: function () { return hierarchy_1.dendrogram; } });
|
|
@@ -11,6 +11,7 @@ Object.defineProperty(exports, "AntVDagreLayout", { enumerable: true, get: funct
|
|
|
11
11
|
Object.defineProperty(exports, "CircularLayout", { enumerable: true, get: function () { return layout_1.CircularLayout; } });
|
|
12
12
|
Object.defineProperty(exports, "ComboCombinedLayout", { enumerable: true, get: function () { return layout_1.ComboCombinedLayout; } });
|
|
13
13
|
Object.defineProperty(exports, "ConcentricLayout", { enumerable: true, get: function () { return layout_1.ConcentricLayout; } });
|
|
14
|
+
Object.defineProperty(exports, "D3Force3DLayout", { enumerable: true, get: function () { return layout_1.D3Force3DLayout; } });
|
|
14
15
|
Object.defineProperty(exports, "D3ForceLayout", { enumerable: true, get: function () { return layout_1.D3ForceLayout; } });
|
|
15
16
|
Object.defineProperty(exports, "DagreLayout", { enumerable: true, get: function () { return layout_1.DagreLayout; } });
|
|
16
17
|
Object.defineProperty(exports, "ForceAtlas2Layout", { enumerable: true, get: function () { return layout_1.ForceAtlas2Layout; } });
|
package/lib/layouts/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["layouts/index.ts"],"names":[],"mappings":";;;AAAA,6CAA4E;AAAnE,uGAAA,UAAU,OAAA;AAAE,uGAAA,UAAU,OAAA;AAAE,qGAAA,QAAQ,OAAA;AAAE,oGAAA,OAAO,OAAA;AAClD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["layouts/index.ts"],"names":[],"mappings":";;;AAAA,6CAA4E;AAAnE,uGAAA,UAAU,OAAA;AAAE,uGAAA,UAAU,OAAA;AAAE,qGAAA,QAAQ,OAAA;AAAE,oGAAA,OAAO,OAAA;AAClD,uCAesB;AAdpB,yGAAA,eAAe,OAAA;AACf,wGAAA,cAAc,OAAA;AACd,6GAAA,mBAAmB,OAAA;AACnB,0GAAA,gBAAgB,OAAA;AAChB,yGAAA,eAAe,OAAA;AACf,uGAAA,aAAa,OAAA;AACb,qGAAA,WAAW,OAAA;AACX,2GAAA,iBAAiB,OAAA;AACjB,qGAAA,WAAW,OAAA;AACX,2GAAA,iBAAiB,OAAA;AACjB,oGAAA,UAAU,OAAA;AACV,mGAAA,SAAS,OAAA;AACT,sGAAA,YAAY,OAAA;AACZ,sGAAA,YAAY,OAAA"}
|
package/lib/layouts/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { AntVDagreLayoutOptions, CircularLayoutOptions, ConcentricLayoutOptions, D3ForceLayoutOptions, DagreLayoutOptions, ForceAtlas2LayoutOptions, ForceLayoutOptions, FruchtermanLayoutOptions, GridLayoutOptions, MDSLayoutOptions, RadialLayoutOptions, RandomLayoutOptions } from '@antv/layout';
|
|
1
|
+
import type { AntVDagreLayoutOptions, CircularLayoutOptions, ConcentricLayoutOptions, D3Force3DLayoutOptions, D3ForceLayoutOptions, DagreLayoutOptions, ForceAtlas2LayoutOptions, ForceLayoutOptions, FruchtermanLayoutOptions, GridLayoutOptions, MDSLayoutOptions, RadialLayoutOptions, RandomLayoutOptions } from '@antv/layout';
|
|
2
2
|
import type { NodeData } from '../spec/data';
|
|
3
|
-
export type BuiltInLayoutOptions = AntVDagreLayout | CircularLayout | ConcentricLayout | D3ForceLayout | DagreLayout | ForceAtlas2 | ForceLayout | FruchtermanLayout | GridLayout | MDSLayout | RadialLayout | RandomLayout;
|
|
4
|
-
export interface BaseLayoutOptions extends AnimationOptions, WebWorkerLayoutOptions
|
|
3
|
+
export type BuiltInLayoutOptions = AntVDagreLayout | CircularLayout | ConcentricLayout | D3ForceLayout | D3Force3DLayout | DagreLayout | ForceAtlas2 | ForceLayout | FruchtermanLayout | GridLayout | MDSLayout | RadialLayout | RandomLayout;
|
|
4
|
+
export interface BaseLayoutOptions extends AnimationOptions, WebWorkerLayoutOptions {
|
|
5
5
|
type: string;
|
|
6
6
|
/**
|
|
7
7
|
* <zh/> 参与该布局的节点
|
|
@@ -37,6 +37,9 @@ interface FruchtermanLayout extends BaseLayoutOptions, FruchtermanLayoutOptions
|
|
|
37
37
|
interface D3ForceLayout extends BaseLayoutOptions, D3ForceLayoutOptions {
|
|
38
38
|
type: 'd3force';
|
|
39
39
|
}
|
|
40
|
+
interface D3Force3DLayout extends BaseLayoutOptions, D3Force3DLayoutOptions {
|
|
41
|
+
type: 'd3force3d';
|
|
42
|
+
}
|
|
40
43
|
interface ForceLayout extends BaseLayoutOptions, ForceLayoutOptions {
|
|
41
44
|
type: 'force' | 'gforce';
|
|
42
45
|
}
|
|
@@ -49,9 +52,6 @@ interface AntVDagreLayout extends BaseLayoutOptions, AntVDagreLayoutOptions {
|
|
|
49
52
|
interface DagreLayout extends BaseLayoutOptions, DagreLayoutOptions {
|
|
50
53
|
type: 'dagre';
|
|
51
54
|
}
|
|
52
|
-
export interface PresetLayoutOptions {
|
|
53
|
-
presetLayout?: BaseLayoutOptions;
|
|
54
|
-
}
|
|
55
55
|
export interface AnimationOptions {
|
|
56
56
|
/**
|
|
57
57
|
* <zh/> 启用布局动画,对于迭代布局,会在两次迭代之间进行动画过渡
|
package/lib/palettes/index.d.ts
CHANGED
package/lib/palettes/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.blues = exports.greens = exports.oranges = exports.spectral = void 0;
|
|
3
|
+
exports.blues = exports.greens = exports.oranges = exports.tableau = exports.spectral = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* <zh/> 内置色板
|
|
6
6
|
*
|
|
@@ -19,6 +19,18 @@ exports.spectral = [
|
|
|
19
19
|
'rgb(50, 136, 189)',
|
|
20
20
|
'rgb(94, 79, 162)',
|
|
21
21
|
];
|
|
22
|
+
exports.tableau = [
|
|
23
|
+
'rgb(78, 121, 167)',
|
|
24
|
+
'rgb(242, 142, 44)',
|
|
25
|
+
'rgb(225, 87, 89)',
|
|
26
|
+
'rgb(118, 183, 178)',
|
|
27
|
+
'rgb(89, 161, 79)',
|
|
28
|
+
'rgb(237, 201, 73)',
|
|
29
|
+
'rgb(175, 122, 161)',
|
|
30
|
+
'rgb(255, 157, 167)',
|
|
31
|
+
'rgb(156, 117, 95)',
|
|
32
|
+
'rgb(186, 176, 171)',
|
|
33
|
+
];
|
|
22
34
|
exports.oranges = [
|
|
23
35
|
'rgb(255, 245, 235)',
|
|
24
36
|
'rgb(254, 230, 206)',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["palettes/index.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACU,QAAA,QAAQ,GAAG;IACtB,iBAAiB;IACjB,kBAAkB;IAClB,mBAAmB;IACnB,mBAAmB;IACnB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,mBAAmB;IACnB,kBAAkB;CACnB,CAAC;AAEW,QAAA,OAAO,GAAG;IACrB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,mBAAmB;IACnB,mBAAmB;IACnB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;CAClB,CAAC;AAEW,QAAA,MAAM,GAAG;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,kBAAkB;IAClB,kBAAkB;IAClB,iBAAiB;IACjB,gBAAgB;CACjB,CAAC;AAEW,QAAA,KAAK,GAAG;IACnB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,mBAAmB;IACnB,mBAAmB;IACnB,iBAAiB;IACjB,iBAAiB;CAClB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["palettes/index.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACU,QAAA,QAAQ,GAAG;IACtB,iBAAiB;IACjB,kBAAkB;IAClB,mBAAmB;IACnB,mBAAmB;IACnB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,mBAAmB;IACnB,kBAAkB;CACnB,CAAC;AAEW,QAAA,OAAO,GAAG;IACrB,mBAAmB;IACnB,mBAAmB;IACnB,kBAAkB;IAClB,oBAAoB;IACpB,kBAAkB;IAClB,mBAAmB;IACnB,oBAAoB;IACpB,oBAAoB;IACpB,mBAAmB;IACnB,oBAAoB;CACrB,CAAC;AAEW,QAAA,OAAO,GAAG;IACrB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,mBAAmB;IACnB,mBAAmB;IACnB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;CAClB,CAAC;AAEW,QAAA,MAAM,GAAG;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,kBAAkB;IAClB,kBAAkB;IAClB,iBAAiB;IACjB,gBAAgB;CACjB,CAAC;AAEW,QAAA,KAAK,GAAG;IACnB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,mBAAmB;IACnB,mBAAmB;IACnB,iBAAiB;IACjB,iBAAiB;CAClB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Loosen } from '../../types';
|
|
2
|
+
import type { Command } from './utils';
|
|
3
|
+
export interface IHistoryEvent {
|
|
4
|
+
cmd?: Command | null;
|
|
5
|
+
}
|
|
6
|
+
export type HistoryEventHandler = (e: IHistoryEvent) => void;
|
|
7
|
+
export declare enum HistoryEvent {
|
|
8
|
+
/** <zh/> 当命令被撤销时 | <en/> When the command is undone */
|
|
9
|
+
UNDO = "undo",
|
|
10
|
+
/** <zh/> 当命令被重做时 | <en/> When the command is redone */
|
|
11
|
+
REDO = "redo",
|
|
12
|
+
/** <zh/> 当命令被取消时 | <en/> When the command is canceled */
|
|
13
|
+
CANCEL = "cancel",
|
|
14
|
+
/** <zh/> 当命令被添加到队列时 | <en/> When the command is added */
|
|
15
|
+
ADD = "add",
|
|
16
|
+
/** <zh/> 当历史队列被清空时 | <en/> When the command queue is cleared */
|
|
17
|
+
CLEAR = "clear",
|
|
18
|
+
/** <zh/> 当历史队列发生变化时 | <en/> When the command queue changes */
|
|
19
|
+
CHANGE = "change"
|
|
20
|
+
}
|
|
21
|
+
export type HistoryEventName = Loosen<HistoryEvent>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HistoryEvent = void 0;
|
|
4
|
+
var HistoryEvent;
|
|
5
|
+
(function (HistoryEvent) {
|
|
6
|
+
/** <zh/> 当命令被撤销时 | <en/> When the command is undone */
|
|
7
|
+
HistoryEvent["UNDO"] = "undo";
|
|
8
|
+
/** <zh/> 当命令被重做时 | <en/> When the command is redone */
|
|
9
|
+
HistoryEvent["REDO"] = "redo";
|
|
10
|
+
/** <zh/> 当命令被取消时 | <en/> When the command is canceled */
|
|
11
|
+
HistoryEvent["CANCEL"] = "cancel";
|
|
12
|
+
/** <zh/> 当命令被添加到队列时 | <en/> When the command is added */
|
|
13
|
+
HistoryEvent["ADD"] = "add";
|
|
14
|
+
/** <zh/> 当历史队列被清空时 | <en/> When the command queue is cleared */
|
|
15
|
+
HistoryEvent["CLEAR"] = "clear";
|
|
16
|
+
/** <zh/> 当历史队列发生变化时 | <en/> When the command queue changes */
|
|
17
|
+
HistoryEvent["CHANGE"] = "change";
|
|
18
|
+
})(HistoryEvent || (exports.HistoryEvent = HistoryEvent = {}));
|
|
19
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"src/","sources":["plugins/history/events.ts"],"names":[],"mappings":";;;AASA,IAAY,YAaX;AAbD,WAAY,YAAY;IACtB,uDAAuD;IACvD,6BAAa,CAAA;IACb,uDAAuD;IACvD,6BAAa,CAAA;IACb,yDAAyD;IACzD,iCAAiB,CAAA;IACjB,yDAAyD;IACzD,2BAAW,CAAA;IACX,gEAAgE;IAChE,+BAAe,CAAA;IACf,8DAA8D;IAC9D,iCAAiB,CAAA;AACnB,CAAC,EAbW,YAAY,4BAAZ,YAAY,QAavB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { RuntimeContext } from '../../runtime/types';
|
|
2
|
+
import type { BasePluginOptions } from '../base-plugin';
|
|
3
|
+
import { BasePlugin } from '../base-plugin';
|
|
4
|
+
import type { HistoryEventHandler, HistoryEventName } from './events';
|
|
5
|
+
import type { Command } from './utils';
|
|
6
|
+
export interface HistoryOptions extends BasePluginOptions {
|
|
7
|
+
/**
|
|
8
|
+
* <zh/> 最多记录该数据长度的历史记录,默认为 0 表示不做限制
|
|
9
|
+
*/
|
|
10
|
+
stackSize?: number;
|
|
11
|
+
/**
|
|
12
|
+
* <zh/> 当一个命令被添加到 Undo/Redo 队列前被调用,如果该方法返回 false,那么这个命令将不会被添加到队列中。revert 为 true 时表示撤销操作,为 false 时表示重做操作
|
|
13
|
+
*
|
|
14
|
+
* <en/> Called before a command is added to the Undo/Redo queue. If this method returns false, the command will not be added to the queue. revert is true for undo operations and false for redo operations
|
|
15
|
+
*/
|
|
16
|
+
beforeAddCommand?: (cmd: Command, revert?: boolean) => boolean | void;
|
|
17
|
+
/**
|
|
18
|
+
* <zh/> 当一个命令被添加到 Undo/Redo 队列后被调用。revert 为 true 时表示撤销操作,为 false 时表示重做操作
|
|
19
|
+
*
|
|
20
|
+
* <en/> Called after a command is added to the Undo/Redo queue. revert is true for undo operations and false for redo operations
|
|
21
|
+
*/
|
|
22
|
+
afterAddCommand?: (cmd: Command, revert?: boolean) => void;
|
|
23
|
+
/**
|
|
24
|
+
* <zh/> 执行命令时的回调函数
|
|
25
|
+
*
|
|
26
|
+
* <en/> Callback function when executing a command
|
|
27
|
+
*/
|
|
28
|
+
executeCommand?: (cmd: Command) => void;
|
|
29
|
+
}
|
|
30
|
+
export declare class History extends BasePlugin<HistoryOptions> {
|
|
31
|
+
static defaultOptions: Partial<HistoryOptions>;
|
|
32
|
+
private emitter;
|
|
33
|
+
private batchChanges;
|
|
34
|
+
private batchAnimation;
|
|
35
|
+
undoStack: Command[];
|
|
36
|
+
redoStack: Command[];
|
|
37
|
+
private isFirstDraw;
|
|
38
|
+
private freezed;
|
|
39
|
+
constructor(context: RuntimeContext, options: HistoryOptions);
|
|
40
|
+
/**
|
|
41
|
+
* <zh/> 是否可以执行撤销操作
|
|
42
|
+
* <en/> Whether undo can be done
|
|
43
|
+
* @returns <zh/> 是否可以执行撤销操作 | <en/> Whether undo can be done
|
|
44
|
+
*/
|
|
45
|
+
canUndo: () => boolean;
|
|
46
|
+
/**
|
|
47
|
+
* <zh/> 是否可以执行重做操作
|
|
48
|
+
* <en/> Whether redo can be done
|
|
49
|
+
* @returns <zh/> 是否可以执行重做操作 | <en/> Whether redo can be done
|
|
50
|
+
*/
|
|
51
|
+
canRedo: () => boolean;
|
|
52
|
+
/**
|
|
53
|
+
* <zh/> 执行撤销
|
|
54
|
+
* <en/> Execute undo
|
|
55
|
+
* @returns <zh/> 返回当前实例 | <en/> Return the current instance
|
|
56
|
+
*/
|
|
57
|
+
undo: () => this;
|
|
58
|
+
/**
|
|
59
|
+
* <zh/> 执行重做
|
|
60
|
+
* <en/> Execute redo
|
|
61
|
+
* @returns <zh/> 返回当前实例 | <en/> Return the current instance
|
|
62
|
+
*/
|
|
63
|
+
redo: () => this;
|
|
64
|
+
/**
|
|
65
|
+
* <zh/> 执行撤销且不计入历史记录
|
|
66
|
+
* <en/> Execute undo and do not record in history
|
|
67
|
+
* @returns <zh/> 返回当前实例 | <en/> Return the current instance
|
|
68
|
+
*/
|
|
69
|
+
undoAndCancel: () => this;
|
|
70
|
+
private executeCommand;
|
|
71
|
+
private addCommand;
|
|
72
|
+
private initBatchCommand;
|
|
73
|
+
private undoStackPush;
|
|
74
|
+
/**
|
|
75
|
+
* <zh/> 清空历史记录
|
|
76
|
+
* <en/> Clear history
|
|
77
|
+
*/
|
|
78
|
+
clear(): void;
|
|
79
|
+
protected notify(event: HistoryEventName, cmd: Command | null): void;
|
|
80
|
+
on(event: HistoryEventName, handler: HistoryEventHandler): void;
|
|
81
|
+
destroy(): void;
|
|
82
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.History = void 0;
|
|
7
|
+
const event_emitter_1 = __importDefault(require("@antv/event-emitter"));
|
|
8
|
+
const constants_1 = require("../../constants");
|
|
9
|
+
const id_1 = require("../../utils/id");
|
|
10
|
+
const base_plugin_1 = require("../base-plugin");
|
|
11
|
+
const events_1 = require("./events");
|
|
12
|
+
const utils_1 = require("./utils");
|
|
13
|
+
class History extends base_plugin_1.BasePlugin {
|
|
14
|
+
static defaultOptions = {
|
|
15
|
+
stackSize: 0,
|
|
16
|
+
};
|
|
17
|
+
emitter;
|
|
18
|
+
batchChanges = null;
|
|
19
|
+
batchAnimation = false;
|
|
20
|
+
undoStack = [];
|
|
21
|
+
redoStack = [];
|
|
22
|
+
isFirstDraw = true;
|
|
23
|
+
freezed = false;
|
|
24
|
+
constructor(context, options) {
|
|
25
|
+
super(context, Object.assign({}, History.defaultOptions, options));
|
|
26
|
+
this.emitter = new event_emitter_1.default();
|
|
27
|
+
const { graph } = this.context;
|
|
28
|
+
graph.on(constants_1.GraphEvent.AFTER_DRAW, this.addCommand);
|
|
29
|
+
graph.on(constants_1.GraphEvent.BATCH_START, this.initBatchCommand);
|
|
30
|
+
graph.on(constants_1.GraphEvent.BATCH_END, this.addCommand);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* <zh/> 是否可以执行撤销操作
|
|
34
|
+
* <en/> Whether undo can be done
|
|
35
|
+
* @returns <zh/> 是否可以执行撤销操作 | <en/> Whether undo can be done
|
|
36
|
+
*/
|
|
37
|
+
canUndo = () => {
|
|
38
|
+
return this.undoStack.length > 0;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* <zh/> 是否可以执行重做操作
|
|
42
|
+
* <en/> Whether redo can be done
|
|
43
|
+
* @returns <zh/> 是否可以执行重做操作 | <en/> Whether redo can be done
|
|
44
|
+
*/
|
|
45
|
+
canRedo = () => {
|
|
46
|
+
return this.redoStack.length > 0;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* <zh/> 执行撤销
|
|
50
|
+
* <en/> Execute undo
|
|
51
|
+
* @returns <zh/> 返回当前实例 | <en/> Return the current instance
|
|
52
|
+
*/
|
|
53
|
+
undo = () => {
|
|
54
|
+
const cmd = this.undoStack.pop();
|
|
55
|
+
if (cmd) {
|
|
56
|
+
this.executeCommand(cmd);
|
|
57
|
+
this.options.beforeAddCommand?.(cmd, false);
|
|
58
|
+
this.redoStack.push(cmd);
|
|
59
|
+
this.options.afterAddCommand?.(cmd, false);
|
|
60
|
+
this.notify(events_1.HistoryEvent.UNDO, cmd);
|
|
61
|
+
}
|
|
62
|
+
return this;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* <zh/> 执行重做
|
|
66
|
+
* <en/> Execute redo
|
|
67
|
+
* @returns <zh/> 返回当前实例 | <en/> Return the current instance
|
|
68
|
+
*/
|
|
69
|
+
redo = () => {
|
|
70
|
+
const cmd = this.redoStack.pop();
|
|
71
|
+
if (cmd) {
|
|
72
|
+
this.executeCommand(cmd, false);
|
|
73
|
+
this.undoStackPush(cmd);
|
|
74
|
+
this.notify(events_1.HistoryEvent.REDO, cmd);
|
|
75
|
+
}
|
|
76
|
+
return this;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* <zh/> 执行撤销且不计入历史记录
|
|
80
|
+
* <en/> Execute undo and do not record in history
|
|
81
|
+
* @returns <zh/> 返回当前实例 | <en/> Return the current instance
|
|
82
|
+
*/
|
|
83
|
+
undoAndCancel = () => {
|
|
84
|
+
const cmd = this.undoStack.pop();
|
|
85
|
+
if (cmd) {
|
|
86
|
+
this.executeCommand(cmd, false);
|
|
87
|
+
this.redoStack = [];
|
|
88
|
+
this.notify(events_1.HistoryEvent.CANCEL, cmd);
|
|
89
|
+
}
|
|
90
|
+
return this;
|
|
91
|
+
};
|
|
92
|
+
executeCommand = (cmd, revert = true) => {
|
|
93
|
+
this.freezed = true;
|
|
94
|
+
this.options.executeCommand?.(cmd);
|
|
95
|
+
const values = revert ? cmd.original : cmd.current;
|
|
96
|
+
this.context.graph.addData(values.add);
|
|
97
|
+
this.context.graph.updateData(values.update);
|
|
98
|
+
this.context.graph.removeData((0, id_1.idsOf)(values.remove, false));
|
|
99
|
+
this.context.element?.draw({ silence: true, animation: cmd.animation });
|
|
100
|
+
this.freezed = false;
|
|
101
|
+
};
|
|
102
|
+
addCommand = (event) => {
|
|
103
|
+
if (this.isFirstDraw) {
|
|
104
|
+
this.isFirstDraw = false;
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (this.freezed)
|
|
108
|
+
return;
|
|
109
|
+
if (event.type === constants_1.GraphEvent.AFTER_DRAW) {
|
|
110
|
+
const { dataChanges = [], animation = true } = event.data;
|
|
111
|
+
if (this.context.batch?.isBatching) {
|
|
112
|
+
if (!this.batchChanges)
|
|
113
|
+
return;
|
|
114
|
+
this.batchChanges.push(dataChanges);
|
|
115
|
+
this.batchAnimation &&= animation;
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
this.batchChanges = [dataChanges];
|
|
119
|
+
this.batchAnimation = animation;
|
|
120
|
+
}
|
|
121
|
+
this.undoStackPush((0, utils_1.parseCommand)(this.batchChanges.flat(), this.batchAnimation, this.context));
|
|
122
|
+
this.notify(events_1.HistoryEvent.ADD, this.undoStack[this.undoStack.length - 1]);
|
|
123
|
+
};
|
|
124
|
+
initBatchCommand = (event) => {
|
|
125
|
+
const { initiate } = event.data;
|
|
126
|
+
this.batchAnimation = false;
|
|
127
|
+
if (initiate) {
|
|
128
|
+
this.batchChanges = [];
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
const cmd = this.undoStack.pop();
|
|
132
|
+
if (!cmd)
|
|
133
|
+
this.batchChanges = null;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
undoStackPush(cmd) {
|
|
137
|
+
const { stackSize } = this.options;
|
|
138
|
+
if (stackSize !== 0 && this.undoStack.length >= stackSize) {
|
|
139
|
+
this.undoStack.shift();
|
|
140
|
+
}
|
|
141
|
+
this.options.beforeAddCommand?.(cmd, true);
|
|
142
|
+
this.undoStack.push(cmd);
|
|
143
|
+
this.options.afterAddCommand?.(cmd, true);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* <zh/> 清空历史记录
|
|
147
|
+
* <en/> Clear history
|
|
148
|
+
*/
|
|
149
|
+
clear() {
|
|
150
|
+
this.undoStack = [];
|
|
151
|
+
this.redoStack = [];
|
|
152
|
+
this.batchChanges = null;
|
|
153
|
+
this.batchAnimation = false;
|
|
154
|
+
this.notify(events_1.HistoryEvent.CLEAR, null);
|
|
155
|
+
}
|
|
156
|
+
notify(event, cmd) {
|
|
157
|
+
this.emitter.emit(event, { cmd });
|
|
158
|
+
this.emitter.emit(events_1.HistoryEvent.CHANGE, { cmd });
|
|
159
|
+
}
|
|
160
|
+
on(event, handler) {
|
|
161
|
+
this.emitter.on(event, handler);
|
|
162
|
+
}
|
|
163
|
+
destroy() {
|
|
164
|
+
const { graph } = this.context;
|
|
165
|
+
graph.off(constants_1.GraphEvent.AFTER_DRAW, this.addCommand);
|
|
166
|
+
graph.off(constants_1.GraphEvent.BATCH_START, this.initBatchCommand);
|
|
167
|
+
graph.off(constants_1.GraphEvent.BATCH_END, this.addCommand);
|
|
168
|
+
this.emitter.off();
|
|
169
|
+
super.destroy();
|
|
170
|
+
this.undoStack = [];
|
|
171
|
+
this.redoStack = [];
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
exports.History = History;
|
|
175
|
+
//# sourceMappingURL=index.js.map
|