@antv/g6 5.0.0-beta.9 → 5.0.0
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/executor.d.ts +11 -0
- package/dist/lib/animations/index.d.ts +32 -0
- package/dist/lib/animations/types.d.ts +113 -0
- package/dist/lib/behaviors/base-behavior.d.ts +6 -0
- package/dist/lib/behaviors/brush-select.d.ts +189 -0
- package/dist/lib/behaviors/click-select.d.ts +116 -0
- package/dist/lib/behaviors/collapse-expand.d.ts +64 -0
- package/dist/lib/behaviors/create-edge.d.ts +75 -0
- package/dist/lib/behaviors/drag-canvas.d.ts +83 -0
- package/dist/lib/behaviors/drag-element-force.d.ts +53 -0
- package/dist/lib/behaviors/drag-element.d.ts +209 -0
- package/dist/lib/behaviors/focus-element.d.ts +42 -0
- package/dist/lib/behaviors/hover-activate.d.ts +84 -0
- package/dist/lib/behaviors/index.d.ts +26 -0
- package/dist/lib/behaviors/lasso-select.d.ts +41 -0
- package/dist/lib/behaviors/scroll-canvas.d.ts +85 -0
- package/dist/lib/behaviors/types.d.ts +6 -0
- package/dist/lib/behaviors/zoom-canvas.d.ts +98 -0
- package/dist/lib/constants/animation.d.ts +3 -0
- package/dist/lib/constants/change.d.ts +64 -0
- package/dist/lib/constants/element.d.ts +7 -0
- package/dist/lib/constants/events/animation.d.ts +6 -0
- package/dist/lib/constants/events/canvas.d.ts +115 -0
- package/dist/lib/constants/events/combo.d.ts +109 -0
- package/dist/lib/constants/events/common.d.ts +122 -0
- package/dist/lib/constants/events/container.d.ts +14 -0
- package/dist/lib/constants/events/edge.d.ts +91 -0
- package/dist/lib/constants/events/graph.d.ts +158 -0
- package/dist/lib/constants/events/history.d.ts +38 -0
- package/dist/lib/constants/events/index.d.ts +9 -0
- package/dist/lib/constants/events/node.d.ts +109 -0
- package/dist/lib/constants/graphlib.d.ts +2 -0
- package/dist/lib/constants/index.d.ts +5 -0
- package/dist/lib/constants/registry.d.ts +62 -0
- package/dist/lib/elements/base-element.d.ts +35 -0
- package/dist/lib/elements/combos/base-combo.d.ts +91 -0
- package/dist/lib/elements/combos/circle.d.ts +25 -0
- package/dist/lib/elements/combos/index.d.ts +6 -0
- package/dist/lib/elements/combos/rect.d.ts +21 -0
- package/dist/lib/elements/edges/base-edge.d.ts +164 -0
- package/dist/lib/elements/edges/cubic-horizontal.d.ts +39 -0
- package/dist/lib/elements/edges/cubic-vertical.d.ts +39 -0
- package/dist/lib/elements/edges/cubic.d.ts +48 -0
- package/dist/lib/elements/edges/index.d.ts +14 -0
- package/dist/lib/elements/edges/line.d.ts +25 -0
- package/dist/lib/elements/edges/polyline.d.ts +63 -0
- package/dist/lib/elements/edges/quadratic.d.ts +44 -0
- package/dist/lib/elements/index.d.ts +3 -0
- package/dist/lib/elements/nodes/base-node.d.ts +193 -0
- package/dist/lib/elements/nodes/circle.d.ts +26 -0
- package/dist/lib/elements/nodes/diamond.d.ts +21 -0
- package/dist/lib/elements/nodes/donut.d.ts +45 -0
- package/dist/lib/elements/nodes/ellipse.d.ts +26 -0
- package/dist/lib/elements/nodes/hexagon.d.ts +28 -0
- package/dist/lib/elements/nodes/html.d.ts +41 -0
- package/dist/lib/elements/nodes/image.d.ts +38 -0
- package/dist/lib/elements/nodes/index.d.ts +22 -0
- package/dist/lib/elements/nodes/rect.d.ts +25 -0
- package/dist/lib/elements/nodes/star.d.ts +30 -0
- package/dist/lib/elements/nodes/triangle.d.ts +31 -0
- package/dist/lib/elements/shapes/badge.d.ts +15 -0
- package/dist/lib/elements/shapes/base-shape.d.ts +63 -0
- package/dist/lib/elements/shapes/contour.d.ts +66 -0
- package/dist/lib/elements/shapes/icon.d.ts +13 -0
- package/dist/lib/elements/shapes/index.d.ts +16 -0
- package/dist/lib/elements/shapes/label.d.ts +32 -0
- package/dist/lib/elements/shapes/polygon.d.ts +30 -0
- package/dist/lib/exports.d.ts +40 -0
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/layouts/base-layout.d.ts +10 -0
- package/dist/lib/layouts/index.d.ts +4 -0
- package/dist/lib/layouts/types.d.ts +84 -0
- package/dist/lib/palettes/index.d.ts +10 -0
- package/dist/lib/palettes/types.d.ts +5 -0
- package/dist/lib/plugins/background/index.d.ts +38 -0
- package/dist/lib/plugins/base-plugin.d.ts +6 -0
- package/dist/lib/plugins/bubble-sets.d.ts +116 -0
- package/dist/lib/plugins/camera-setting.d.ts +111 -0
- package/dist/lib/plugins/contextmenu/index.d.ts +115 -0
- package/dist/lib/plugins/contextmenu/util.d.ts +26 -0
- package/dist/lib/plugins/fullscreen/index.d.ts +79 -0
- package/dist/lib/plugins/grid-line.d.ts +106 -0
- package/dist/lib/plugins/history/index.d.ts +120 -0
- package/dist/lib/plugins/history/util.d.ts +21 -0
- package/dist/lib/plugins/hull/index.d.ts +114 -0
- package/dist/lib/plugins/hull/util.d.ts +12 -0
- package/dist/lib/plugins/index.d.ts +28 -0
- package/dist/lib/plugins/legend.d.ts +129 -0
- package/dist/lib/plugins/timebar.d.ts +241 -0
- package/dist/lib/plugins/toolbar/index.d.ts +69 -0
- package/dist/lib/plugins/toolbar/util.d.ts +33 -0
- package/dist/lib/plugins/tooltip.d.ts +116 -0
- package/dist/lib/plugins/types.d.ts +4 -0
- package/dist/lib/plugins/watermark/index.d.ts +191 -0
- package/dist/lib/plugins/watermark/util.d.ts +18 -0
- package/dist/lib/preset.d.ts +1 -0
- package/dist/lib/registry/build-in.d.ts +6 -0
- package/dist/lib/registry/extension/index.d.ts +33 -0
- package/dist/lib/registry/extension/types.d.ts +38 -0
- package/dist/lib/registry/index.d.ts +59 -0
- package/dist/lib/registry/types.d.ts +39 -0
- package/dist/lib/runtime/animation.d.ts +54 -0
- package/dist/lib/runtime/batch.d.ts +11 -0
- package/dist/lib/runtime/behavior.d.ts +20 -0
- package/dist/lib/runtime/canvas.d.ts +60 -0
- package/dist/lib/runtime/data.d.ts +202 -0
- package/dist/lib/runtime/element.d.ts +102 -0
- package/dist/lib/runtime/graph.d.ts +1011 -0
- package/dist/lib/runtime/layout.d.ts +38 -0
- package/dist/lib/runtime/plugin.d.ts +10 -0
- package/dist/lib/runtime/transform.d.ts +12 -0
- package/dist/lib/runtime/types.d.ts +90 -0
- package/dist/lib/runtime/viewport.d.ts +58 -0
- package/dist/lib/spec/behavior.d.ts +30 -0
- package/dist/lib/spec/canvas.d.ts +53 -0
- package/dist/lib/spec/data.d.ts +222 -0
- package/dist/lib/spec/element/animation.d.ts +6 -0
- package/dist/lib/spec/element/combo.d.ts +52 -0
- package/dist/lib/spec/element/edge.d.ts +52 -0
- package/dist/lib/spec/element/node.d.ts +52 -0
- package/dist/lib/spec/element/palette.d.ts +53 -0
- package/dist/lib/spec/graph.d.ts +91 -0
- package/dist/lib/spec/index.d.ts +12 -0
- package/dist/lib/spec/layout.d.ts +4 -0
- package/dist/lib/spec/plugin.d.ts +32 -0
- package/dist/lib/spec/theme.d.ts +7 -0
- package/dist/lib/spec/transform.d.ts +12 -0
- package/dist/lib/spec/viewport.d.ts +82 -0
- package/dist/lib/themes/base.d.ts +34 -0
- package/dist/lib/themes/dark.d.ts +2 -0
- package/dist/lib/themes/index.d.ts +2 -0
- package/dist/lib/themes/light.d.ts +2 -0
- package/dist/lib/themes/types.d.ts +9 -0
- package/dist/lib/transforms/arrange-draw-order.d.ts +10 -0
- package/dist/lib/transforms/base-transform.d.ts +8 -0
- package/dist/lib/transforms/collapse-expand-combo.d.ts +11 -0
- package/dist/lib/transforms/collapse-expand-node.d.ts +12 -0
- package/dist/lib/transforms/get-edge-actual-ends.d.ts +13 -0
- package/dist/lib/transforms/index.d.ts +8 -0
- package/dist/lib/transforms/process-parallel-edges.d.ts +85 -0
- package/dist/lib/transforms/types.d.ts +20 -0
- package/dist/lib/transforms/update-related-edge.d.ts +10 -0
- package/dist/lib/transforms/utils.d.ts +13 -0
- package/dist/lib/types/anchor.d.ts +3 -0
- package/dist/lib/types/animation.d.ts +5 -0
- package/dist/lib/types/callable.d.ts +30 -0
- package/dist/lib/types/canvas.d.ts +1 -0
- package/dist/lib/types/change.d.ts +68 -0
- package/dist/lib/types/combo.d.ts +23 -0
- package/dist/lib/types/data.d.ts +44 -0
- package/dist/lib/types/edge.d.ts +127 -0
- package/dist/lib/types/element.d.ts +18 -0
- package/dist/lib/types/enum.d.ts +1 -0
- package/dist/lib/types/event.d.ts +55 -0
- package/dist/lib/types/graphlib.d.ts +16 -0
- package/dist/lib/types/history.d.ts +51 -0
- package/dist/lib/types/id.d.ts +1 -0
- package/dist/lib/types/index.d.ts +26 -0
- package/dist/lib/types/layout.d.ts +9 -0
- package/dist/lib/types/node.d.ts +144 -0
- package/dist/lib/types/padding.d.ts +2 -0
- package/dist/lib/types/placement.d.ts +5 -0
- package/dist/lib/types/plugin.d.ts +5 -0
- package/dist/lib/types/point.d.ts +2 -0
- package/dist/lib/types/position.d.ts +2 -0
- package/dist/lib/types/prefix.d.ts +17 -0
- package/dist/lib/types/size.d.ts +3 -0
- package/dist/lib/types/state.d.ts +1 -0
- package/dist/lib/types/style.d.ts +9 -0
- package/dist/lib/types/tree.d.ts +5 -0
- package/dist/lib/types/vector.d.ts +2 -0
- package/dist/lib/types/viewport.d.ts +36 -0
- package/dist/lib/utils/anchor.d.ts +9 -0
- package/dist/lib/utils/animation.d.ts +47 -0
- package/dist/lib/utils/array.d.ts +9 -0
- package/dist/lib/utils/bbox.d.ts +108 -0
- package/dist/lib/utils/cache.d.ts +36 -0
- package/dist/lib/utils/change.d.ts +17 -0
- package/dist/lib/utils/collapsibility.d.ts +9 -0
- package/dist/lib/utils/data.d.ts +34 -0
- package/dist/lib/utils/diff.d.ts +15 -0
- package/dist/lib/utils/dom.d.ts +29 -0
- package/dist/lib/utils/edge.d.ts +192 -0
- package/dist/lib/utils/element.d.ts +231 -0
- package/dist/lib/utils/event/events.d.ts +26 -0
- package/dist/lib/utils/event/index.d.ts +29 -0
- package/dist/lib/utils/extension.d.ts +10 -0
- package/dist/lib/utils/graphlib.d.ts +14 -0
- package/dist/lib/utils/id.d.ts +20 -0
- package/dist/lib/utils/is.d.ts +34 -0
- package/dist/lib/utils/layout.d.ts +70 -0
- package/dist/lib/utils/line.d.ts +21 -0
- package/dist/lib/utils/math.d.ts +10 -0
- package/dist/lib/utils/node.d.ts +11 -0
- package/dist/lib/utils/padding.d.ts +9 -0
- package/dist/lib/utils/palette.d.ts +32 -0
- package/dist/lib/utils/path.d.ts +35 -0
- package/dist/lib/utils/placement.d.ts +9 -0
- package/dist/lib/utils/point.d.ts +192 -0
- package/dist/lib/utils/polygon.d.ts +17 -0
- package/dist/lib/utils/position.d.ts +50 -0
- package/dist/lib/utils/prefix.d.ts +66 -0
- package/dist/lib/utils/relation.d.ts +33 -0
- package/dist/lib/utils/router/orth.d.ts +103 -0
- package/dist/lib/utils/shape.d.ts +9 -0
- package/dist/lib/utils/shortcut.d.ts +31 -0
- package/dist/lib/utils/size.d.ts +7 -0
- package/dist/lib/utils/style.d.ts +30 -0
- package/dist/lib/utils/symbol.d.ts +30 -0
- package/dist/lib/utils/text.d.ts +26 -0
- package/dist/lib/utils/theme.d.ts +9 -0
- package/dist/lib/utils/transform.d.ts +24 -0
- package/dist/lib/utils/traverse.d.ts +23 -0
- package/dist/lib/utils/tree.d.ts +17 -0
- package/dist/lib/utils/vector.d.ts +143 -0
- package/dist/lib/utils/visibility.d.ts +13 -0
- package/esm/animations/executor.d.ts +11 -0
- package/esm/animations/executor.js +70 -0
- package/esm/animations/executor.js.map +1 -0
- package/esm/animations/index.d.ts +32 -0
- package/esm/animations/index.js +15 -0
- package/esm/animations/index.js.map +1 -0
- package/esm/animations/types.d.ts +113 -0
- package/esm/animations/types.js.map +1 -0
- package/esm/behaviors/base-behavior.d.ts +6 -0
- package/esm/behaviors/base-behavior.js +4 -0
- package/esm/behaviors/base-behavior.js.map +1 -0
- package/esm/behaviors/brush-select.d.ts +189 -0
- package/esm/behaviors/brush-select.js +273 -0
- package/esm/behaviors/brush-select.js.map +1 -0
- package/esm/behaviors/click-select.d.ts +116 -0
- package/esm/behaviors/click-select.js +133 -0
- package/esm/behaviors/click-select.js.map +1 -0
- package/esm/behaviors/collapse-expand.d.ts +64 -0
- package/esm/behaviors/collapse-expand.js +76 -0
- package/esm/behaviors/collapse-expand.js.map +1 -0
- package/esm/behaviors/create-edge.d.ts +75 -0
- package/esm/behaviors/create-edge.js +155 -0
- package/esm/behaviors/create-edge.js.map +1 -0
- package/esm/behaviors/drag-canvas.d.ts +83 -0
- package/esm/behaviors/drag-canvas.js +97 -0
- package/esm/behaviors/drag-canvas.js.map +1 -0
- package/esm/behaviors/drag-element-force.d.ts +53 -0
- package/esm/behaviors/drag-element-force.js +94 -0
- package/esm/behaviors/drag-element-force.js.map +1 -0
- package/esm/behaviors/drag-element.d.ts +209 -0
- package/esm/behaviors/drag-element.js +310 -0
- package/esm/behaviors/drag-element.js.map +1 -0
- package/esm/behaviors/focus-element.d.ts +42 -0
- package/esm/behaviors/focus-element.js +58 -0
- package/esm/behaviors/focus-element.js.map +1 -0
- package/esm/behaviors/hover-activate.d.ts +84 -0
- package/esm/behaviors/hover-activate.js +104 -0
- package/esm/behaviors/hover-activate.js.map +1 -0
- package/esm/behaviors/index.d.ts +26 -0
- package/esm/behaviors/index.js +14 -0
- package/esm/behaviors/index.js.map +1 -0
- package/esm/behaviors/lasso-select.d.ts +41 -0
- package/esm/behaviors/lasso-select.js +66 -0
- package/esm/behaviors/lasso-select.js.map +1 -0
- package/esm/behaviors/scroll-canvas.d.ts +85 -0
- package/esm/behaviors/scroll-canvas.js +100 -0
- package/esm/behaviors/scroll-canvas.js.map +1 -0
- package/esm/behaviors/types.d.ts +6 -0
- package/esm/behaviors/types.js.map +1 -0
- package/esm/behaviors/zoom-canvas.d.ts +98 -0
- package/esm/behaviors/zoom-canvas.js +110 -0
- package/esm/behaviors/zoom-canvas.js.map +1 -0
- package/esm/constants/animation.d.ts +3 -0
- package/esm/constants/animation.js +10 -0
- package/esm/constants/animation.js.map +1 -0
- package/esm/constants/change.d.ts +64 -0
- package/esm/constants/change.js +66 -0
- package/esm/constants/change.js.map +1 -0
- package/esm/constants/element.d.ts +7 -0
- package/esm/constants/element.js +8 -0
- package/esm/constants/element.js.map +1 -0
- package/esm/constants/events/animation.d.ts +6 -0
- package/esm/constants/events/animation.js +8 -0
- package/esm/constants/events/animation.js.map +1 -0
- package/esm/constants/events/canvas.d.ts +115 -0
- package/esm/constants/events/canvas.js +117 -0
- package/esm/constants/events/canvas.js.map +1 -0
- package/esm/constants/events/combo.d.ts +109 -0
- package/esm/constants/events/combo.js +111 -0
- package/esm/constants/events/combo.js.map +1 -0
- package/esm/constants/events/common.d.ts +122 -0
- package/esm/constants/events/common.js +124 -0
- package/esm/constants/events/common.js.map +1 -0
- package/esm/constants/events/container.d.ts +14 -0
- package/esm/constants/events/container.js +16 -0
- package/esm/constants/events/container.js.map +1 -0
- package/esm/constants/events/edge.d.ts +91 -0
- package/esm/constants/events/edge.js +93 -0
- package/esm/constants/events/edge.js.map +1 -0
- package/esm/constants/events/graph.d.ts +158 -0
- package/esm/constants/events/graph.js +160 -0
- package/esm/constants/events/graph.js.map +1 -0
- 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 +9 -0
- package/esm/constants/events/index.js +10 -0
- package/esm/constants/events/index.js.map +1 -0
- package/esm/constants/events/node.d.ts +109 -0
- package/esm/constants/events/node.js +111 -0
- package/esm/constants/events/node.js.map +1 -0
- package/esm/constants/graphlib.d.ts +2 -0
- package/esm/constants/graphlib.js +3 -0
- package/esm/constants/graphlib.js.map +1 -0
- package/esm/constants/index.d.ts +5 -0
- package/esm/constants/index.js +6 -0
- package/esm/constants/index.js.map +1 -0
- package/esm/constants/registry.d.ts +62 -0
- package/esm/constants/registry.js +64 -0
- package/esm/constants/registry.js.map +1 -0
- package/esm/elements/base-element.d.ts +35 -0
- package/esm/elements/base-element.js +42 -0
- package/esm/elements/base-element.js.map +1 -0
- package/esm/elements/combos/base-combo.d.ts +91 -0
- package/esm/elements/combos/base-combo.js +162 -0
- package/esm/elements/combos/base-combo.js.map +1 -0
- package/esm/elements/combos/circle.d.ts +25 -0
- package/esm/elements/combos/circle.js +45 -0
- package/esm/elements/combos/circle.js.map +1 -0
- package/esm/elements/combos/index.d.ts +6 -0
- package/esm/elements/combos/index.js +4 -0
- package/esm/elements/combos/index.js.map +1 -0
- package/esm/elements/combos/rect.d.ts +21 -0
- package/esm/elements/combos/rect.js +29 -0
- package/esm/elements/combos/rect.js.map +1 -0
- package/esm/elements/edges/base-edge.d.ts +164 -0
- package/esm/elements/edges/base-edge.js +205 -0
- package/esm/elements/edges/base-edge.js.map +1 -0
- package/esm/elements/edges/cubic-horizontal.d.ts +39 -0
- package/esm/elements/edges/cubic-horizontal.js +28 -0
- package/esm/elements/edges/cubic-horizontal.js.map +1 -0
- package/esm/elements/edges/cubic-vertical.d.ts +39 -0
- package/esm/elements/edges/cubic-vertical.js +28 -0
- package/esm/elements/edges/cubic-vertical.js.map +1 -0
- package/esm/elements/edges/cubic.d.ts +48 -0
- package/esm/elements/edges/cubic.js +35 -0
- package/esm/elements/edges/cubic.js.map +1 -0
- package/esm/elements/edges/index.d.ts +14 -0
- package/esm/elements/edges/index.js +8 -0
- package/esm/elements/edges/index.js.map +1 -0
- package/esm/elements/edges/line.d.ts +25 -0
- package/esm/elements/edges/line.js +23 -0
- package/esm/elements/edges/line.js.map +1 -0
- package/esm/elements/edges/polyline.d.ts +63 -0
- package/esm/elements/edges/polyline.js +67 -0
- package/esm/elements/edges/polyline.js.map +1 -0
- package/esm/elements/edges/quadratic.d.ts +44 -0
- package/esm/elements/edges/quadratic.js +24 -0
- package/esm/elements/edges/quadratic.js.map +1 -0
- package/esm/elements/index.d.ts +3 -0
- package/esm/elements/index.js +4 -0
- package/esm/elements/index.js.map +1 -0
- package/esm/elements/nodes/base-node.d.ts +193 -0
- package/esm/elements/nodes/base-node.js +218 -0
- package/esm/elements/nodes/base-node.js.map +1 -0
- package/esm/elements/nodes/circle.d.ts +26 -0
- package/esm/elements/nodes/circle.js +36 -0
- package/esm/elements/nodes/circle.js.map +1 -0
- package/esm/elements/nodes/diamond.d.ts +21 -0
- package/esm/elements/nodes/diamond.js +23 -0
- package/esm/elements/nodes/diamond.js.map +1 -0
- package/esm/elements/nodes/donut.d.ts +45 -0
- package/esm/elements/nodes/donut.js +95 -0
- package/esm/elements/nodes/donut.js.map +1 -0
- package/esm/elements/nodes/ellipse.d.ts +26 -0
- package/esm/elements/nodes/ellipse.js +41 -0
- package/esm/elements/nodes/ellipse.js.map +1 -0
- package/esm/elements/nodes/hexagon.d.ts +28 -0
- package/esm/elements/nodes/hexagon.js +25 -0
- package/esm/elements/nodes/hexagon.js.map +1 -0
- package/esm/elements/nodes/html.d.ts +41 -0
- package/esm/elements/nodes/html.js +222 -0
- package/esm/elements/nodes/html.js.map +1 -0
- package/esm/elements/nodes/image.d.ts +38 -0
- package/esm/elements/nodes/image.js +59 -0
- package/esm/elements/nodes/image.js.map +1 -0
- package/esm/elements/nodes/index.d.ts +22 -0
- package/esm/elements/nodes/index.js +12 -0
- package/esm/elements/nodes/index.js.map +1 -0
- package/esm/elements/nodes/rect.d.ts +25 -0
- package/esm/elements/nodes/rect.js +38 -0
- package/esm/elements/nodes/rect.js.map +1 -0
- package/esm/elements/nodes/star.d.ts +30 -0
- package/esm/elements/nodes/star.js +34 -0
- package/esm/elements/nodes/star.js.map +1 -0
- package/esm/elements/nodes/triangle.d.ts +31 -0
- package/esm/elements/nodes/triangle.js +53 -0
- package/esm/elements/nodes/triangle.js.map +1 -0
- package/esm/elements/shapes/badge.d.ts +15 -0
- package/esm/elements/shapes/badge.js +27 -0
- package/esm/elements/shapes/badge.js.map +1 -0
- package/esm/elements/shapes/base-shape.d.ts +63 -0
- package/esm/elements/shapes/base-shape.js +160 -0
- package/esm/elements/shapes/base-shape.js.map +1 -0
- package/esm/elements/shapes/contour.d.ts +66 -0
- package/esm/elements/shapes/contour.js +36 -0
- package/esm/elements/shapes/contour.js.map +1 -0
- package/esm/elements/shapes/icon.d.ts +13 -0
- package/esm/elements/shapes/icon.js +31 -0
- package/esm/elements/shapes/icon.js.map +1 -0
- package/esm/elements/shapes/index.d.ts +16 -0
- package/esm/elements/shapes/index.js +11 -0
- package/esm/elements/shapes/index.js.map +1 -0
- package/esm/elements/shapes/label.d.ts +32 -0
- package/esm/elements/shapes/label.js +71 -0
- package/esm/elements/shapes/label.js.map +1 -0
- package/esm/elements/shapes/polygon.d.ts +30 -0
- package/esm/elements/shapes/polygon.js +27 -0
- package/esm/elements/shapes/polygon.js.map +1 -0
- package/esm/exports.d.ts +40 -0
- package/esm/exports.js +18 -0
- package/esm/exports.js.map +1 -0
- package/esm/index.d.ts +3 -259
- package/esm/index.js +3 -18
- package/esm/index.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 +4 -0
- package/esm/layouts/index.js +4 -0
- package/esm/layouts/index.js.map +1 -0
- package/esm/layouts/types.d.ts +84 -0
- package/esm/layouts/types.js.map +1 -0
- package/esm/palettes/index.d.ts +10 -0
- package/esm/palettes/index.js +64 -0
- package/esm/palettes/index.js.map +1 -0
- package/esm/palettes/types.d.ts +5 -0
- package/esm/palettes/types.js +2 -0
- package/esm/palettes/types.js.map +1 -0
- package/esm/plugins/background/index.d.ts +38 -0
- package/esm/plugins/background/index.js +48 -0
- package/esm/plugins/background/index.js.map +1 -0
- package/esm/plugins/base-plugin.d.ts +6 -0
- package/esm/plugins/base-plugin.js +4 -0
- package/esm/plugins/base-plugin.js.map +1 -0
- package/esm/plugins/bubble-sets.d.ts +116 -0
- package/esm/plugins/bubble-sets.js +279 -0
- package/esm/plugins/bubble-sets.js.map +1 -0
- package/esm/plugins/camera-setting.d.ts +111 -0
- package/esm/plugins/camera-setting.js +72 -0
- package/esm/plugins/camera-setting.js.map +1 -0
- package/esm/plugins/contextmenu/index.d.ts +115 -0
- package/esm/plugins/contextmenu/index.js +132 -0
- package/esm/plugins/contextmenu/index.js.map +1 -0
- package/esm/plugins/contextmenu/util.d.ts +26 -0
- package/esm/plugins/contextmenu/util.js +45 -0
- package/esm/plugins/contextmenu/util.js.map +1 -0
- package/esm/plugins/fullscreen/index.d.ts +79 -0
- package/esm/plugins/fullscreen/index.js +112 -0
- package/esm/plugins/fullscreen/index.js.map +1 -0
- package/esm/plugins/grid-line.d.ts +106 -0
- package/esm/plugins/grid-line.js +78 -0
- package/esm/plugins/grid-line.js.map +1 -0
- package/esm/plugins/history/index.d.ts +120 -0
- package/esm/plugins/history/index.js +195 -0
- package/esm/plugins/history/index.js.map +1 -0
- package/esm/plugins/history/util.d.ts +21 -0
- package/esm/plugins/history/util.js +83 -0
- package/esm/plugins/history/util.js.map +1 -0
- package/esm/plugins/hull/index.d.ts +114 -0
- package/esm/plugins/hull/index.js +161 -0
- package/esm/plugins/hull/index.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 +28 -0
- package/esm/plugins/index.js +15 -0
- package/esm/plugins/index.js.map +1 -0
- package/esm/plugins/legend.d.ts +129 -0
- package/esm/plugins/legend.js +318 -0
- package/esm/plugins/legend.js.map +1 -0
- package/esm/plugins/timebar.d.ts +241 -0
- package/esm/plugins/timebar.js +267 -0
- package/esm/plugins/timebar.js.map +1 -0
- package/esm/plugins/toolbar/index.d.ts +69 -0
- package/esm/plugins/toolbar/index.js +71 -0
- package/esm/plugins/toolbar/index.js.map +1 -0
- package/esm/plugins/toolbar/util.d.ts +33 -0
- package/esm/plugins/toolbar/util.js +93 -0
- package/esm/plugins/toolbar/util.js.map +1 -0
- package/esm/plugins/tooltip.d.ts +116 -0
- package/esm/plugins/tooltip.js +294 -0
- package/esm/plugins/tooltip.js.map +1 -0
- package/esm/plugins/types.d.ts +4 -0
- package/esm/plugins/types.js +2 -0
- package/esm/plugins/types.js.map +1 -0
- package/esm/plugins/watermark/index.d.ts +191 -0
- package/esm/plugins/watermark/index.js +67 -0
- package/esm/plugins/watermark/index.js.map +1 -0
- package/esm/plugins/watermark/util.d.ts +18 -0
- package/esm/plugins/watermark/util.js +73 -0
- package/esm/plugins/watermark/util.js.map +1 -0
- package/esm/preset.d.ts +1 -0
- package/esm/preset.js +5 -0
- package/esm/preset.js.map +1 -0
- package/esm/registry/build-in.d.ts +6 -0
- package/esm/registry/build-in.js +115 -0
- package/esm/registry/build-in.js.map +1 -0
- package/esm/registry/extension/index.d.ts +33 -0
- package/esm/registry/extension/index.js +84 -0
- package/esm/registry/extension/index.js.map +1 -0
- package/esm/registry/extension/types.d.ts +38 -0
- package/esm/registry/extension/types.js +2 -0
- package/esm/registry/extension/types.js.map +1 -0
- package/esm/registry/index.d.ts +59 -0
- package/esm/registry/index.js +97 -0
- package/esm/registry/index.js.map +1 -0
- package/esm/registry/types.d.ts +39 -0
- package/esm/registry/types.js +2 -0
- package/esm/registry/types.js.map +1 -0
- package/esm/runtime/animation.d.ts +54 -0
- package/esm/runtime/animation.js +139 -0
- package/esm/runtime/animation.js.map +1 -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 +20 -0
- package/esm/runtime/behavior.js +119 -0
- package/esm/runtime/behavior.js.map +1 -0
- package/esm/runtime/canvas.d.ts +60 -0
- package/esm/runtime/canvas.js +258 -0
- package/esm/runtime/canvas.js.map +1 -0
- package/esm/runtime/data.d.ts +202 -0
- package/esm/runtime/data.js +694 -0
- package/esm/runtime/data.js.map +1 -0
- package/esm/runtime/element.d.ts +102 -0
- package/esm/runtime/element.js +553 -0
- package/esm/runtime/element.js.map +1 -0
- package/esm/runtime/graph.d.ts +826 -536
- package/esm/runtime/graph.js +1029 -1832
- package/esm/runtime/graph.js.map +1 -1
- package/esm/runtime/layout.d.ts +38 -0
- package/esm/runtime/layout.js +236 -0
- package/esm/runtime/layout.js.map +1 -0
- package/esm/runtime/plugin.d.ts +10 -0
- package/esm/runtime/plugin.js +15 -0
- package/esm/runtime/plugin.js.map +1 -0
- package/esm/runtime/transform.d.ts +12 -0
- package/esm/runtime/transform.js +27 -0
- package/esm/runtime/transform.js.map +1 -0
- package/esm/runtime/types.d.ts +90 -0
- package/esm/runtime/types.js +2 -0
- package/esm/runtime/types.js.map +1 -0
- package/esm/runtime/viewport.d.ts +58 -0
- package/esm/runtime/viewport.js +241 -0
- package/esm/runtime/viewport.js.map +1 -0
- package/esm/spec/behavior.d.ts +30 -0
- package/esm/spec/behavior.js +2 -0
- package/esm/spec/behavior.js.map +1 -0
- package/esm/spec/canvas.d.ts +53 -0
- package/esm/spec/canvas.js +2 -0
- package/esm/spec/canvas.js.map +1 -0
- package/esm/spec/data.d.ts +222 -0
- package/esm/spec/data.js +2 -0
- package/esm/spec/data.js.map +1 -0
- package/esm/spec/element/animation.d.ts +6 -0
- package/esm/spec/element/animation.js +2 -0
- package/esm/spec/element/animation.js.map +1 -0
- package/esm/spec/element/combo.d.ts +52 -0
- package/esm/spec/element/combo.js +2 -0
- package/esm/spec/element/combo.js.map +1 -0
- package/esm/spec/element/edge.d.ts +52 -0
- package/esm/spec/element/edge.js +2 -0
- package/esm/spec/element/edge.js.map +1 -0
- package/esm/spec/element/node.d.ts +52 -0
- package/esm/spec/element/node.js +2 -0
- package/esm/spec/element/node.js.map +1 -0
- package/esm/spec/element/palette.d.ts +53 -0
- package/esm/spec/element/palette.js +2 -0
- package/esm/spec/element/palette.js.map +1 -0
- package/esm/spec/graph.d.ts +91 -0
- package/esm/spec/graph.js.map +1 -0
- package/esm/spec/index.d.ts +12 -0
- package/esm/spec/index.js +2 -0
- package/esm/spec/index.js.map +1 -0
- package/esm/spec/layout.d.ts +4 -0
- package/esm/spec/layout.js.map +1 -0
- package/esm/spec/plugin.d.ts +32 -0
- package/esm/spec/plugin.js +2 -0
- package/esm/spec/plugin.js.map +1 -0
- package/esm/spec/theme.d.ts +7 -0
- package/esm/spec/theme.js +2 -0
- package/esm/spec/theme.js.map +1 -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/spec/viewport.d.ts +82 -0
- package/esm/spec/viewport.js +2 -0
- package/esm/spec/viewport.js.map +1 -0
- package/esm/themes/base.d.ts +34 -0
- package/esm/themes/base.js +253 -0
- package/esm/themes/base.js.map +1 -0
- package/esm/themes/dark.d.ts +2 -0
- package/esm/themes/dark.js +39 -0
- package/esm/themes/dark.js.map +1 -0
- package/esm/themes/index.d.ts +2 -0
- package/esm/themes/index.js +3 -0
- package/esm/themes/index.js.map +1 -0
- package/esm/themes/light.d.ts +2 -0
- package/esm/themes/light.js +22 -0
- package/esm/themes/light.js.map +1 -0
- package/esm/themes/types.d.ts +9 -0
- package/esm/themes/types.js +2 -0
- package/esm/themes/types.js.map +1 -0
- package/esm/transforms/arrange-draw-order.d.ts +10 -0
- package/esm/transforms/arrange-draw-order.js +32 -0
- package/esm/transforms/arrange-draw-order.js.map +1 -0
- package/esm/transforms/base-transform.d.ts +8 -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 +11 -0
- package/esm/transforms/collapse-expand-combo.js +75 -0
- package/esm/transforms/collapse-expand-combo.js.map +1 -0
- package/esm/transforms/collapse-expand-node.d.ts +12 -0
- package/esm/transforms/collapse-expand-node.js +91 -0
- package/esm/transforms/collapse-expand-node.js.map +1 -0
- package/esm/transforms/get-edge-actual-ends.d.ts +13 -0
- package/esm/transforms/get-edge-actual-ends.js +36 -0
- package/esm/transforms/get-edge-actual-ends.js.map +1 -0
- package/esm/transforms/index.d.ts +8 -0
- package/esm/transforms/index.js +8 -0
- package/esm/transforms/index.js.map +1 -0
- package/esm/transforms/process-parallel-edges.d.ts +85 -0
- package/esm/transforms/process-parallel-edges.js +228 -0
- package/esm/transforms/process-parallel-edges.js.map +1 -0
- package/esm/transforms/types.d.ts +20 -0
- package/esm/transforms/types.js +2 -0
- package/esm/transforms/types.js.map +1 -0
- package/esm/transforms/update-related-edge.d.ts +10 -0
- package/esm/transforms/update-related-edge.js +23 -0
- package/esm/transforms/update-related-edge.js.map +1 -0
- package/esm/transforms/utils.d.ts +13 -0
- package/esm/transforms/utils.js +25 -0
- package/esm/transforms/utils.js.map +1 -0
- package/esm/types/anchor.d.ts +3 -0
- package/esm/types/anchor.js +2 -0
- package/esm/types/anchor.js.map +1 -0
- package/esm/types/animation.d.ts +5 -0
- package/esm/types/animation.js +2 -0
- package/esm/types/animation.js.map +1 -0
- package/esm/types/callable.d.ts +30 -0
- package/esm/types/callable.js +2 -0
- package/esm/types/callable.js.map +1 -0
- package/esm/types/canvas.d.ts +1 -0
- package/esm/types/canvas.js +2 -0
- package/esm/types/canvas.js.map +1 -0
- package/esm/types/change.d.ts +68 -0
- package/esm/types/change.js +2 -0
- package/esm/types/change.js.map +1 -0
- package/esm/types/combo.d.ts +20 -132
- package/esm/types/data.d.ts +44 -27
- package/esm/types/edge.d.ts +110 -97
- package/esm/types/element.d.ts +18 -0
- package/esm/types/element.js +2 -0
- package/esm/types/element.js.map +1 -0
- package/esm/types/enum.d.ts +1 -0
- package/esm/types/enum.js +2 -0
- package/esm/types/enum.js.map +1 -0
- package/esm/types/event.d.ts +54 -38
- package/esm/types/event.js +1 -30
- package/esm/types/event.js.map +1 -1
- package/esm/types/graphlib.d.ts +16 -0
- package/esm/types/graphlib.js +2 -0
- package/esm/types/graphlib.js.map +1 -0
- package/esm/types/history.d.ts +49 -26
- package/esm/types/history.js +1 -5
- package/esm/types/history.js.map +1 -1
- 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 +26 -16
- package/esm/types/index.js +1 -1
- package/esm/types/index.js.map +1 -1
- package/esm/types/layout.d.ts +8 -71
- package/esm/types/layout.js +1 -19
- package/esm/types/layout.js.map +1 -1
- package/esm/types/node.d.ts +132 -203
- package/esm/types/padding.d.ts +2 -0
- package/esm/types/padding.js +2 -0
- package/esm/types/padding.js.map +1 -0
- package/esm/types/placement.d.ts +5 -0
- package/esm/types/placement.js +2 -0
- package/esm/types/placement.js.map +1 -0
- package/esm/types/plugin.d.ts +5 -44
- package/esm/types/plugin.js +1 -52
- package/esm/types/plugin.js.map +1 -1
- package/esm/types/point.d.ts +2 -0
- package/esm/types/point.js +2 -0
- package/esm/types/point.js.map +1 -0
- package/esm/types/position.d.ts +2 -0
- package/esm/types/position.js +2 -0
- package/esm/types/position.js.map +1 -0
- package/esm/types/prefix.d.ts +17 -0
- package/esm/types/prefix.js +2 -0
- package/esm/types/prefix.js.map +1 -0
- package/esm/types/size.d.ts +3 -0
- package/esm/types/size.js +2 -0
- package/esm/types/size.js.map +1 -0
- package/esm/types/state.d.ts +1 -0
- package/esm/types/state.js +2 -0
- package/esm/types/state.js.map +1 -0
- package/esm/types/style.d.ts +9 -0
- package/esm/types/style.js +2 -0
- package/esm/types/style.js.map +1 -0
- package/esm/types/tree.d.ts +5 -0
- package/esm/types/tree.js +2 -0
- package/esm/types/tree.js.map +1 -0
- package/esm/types/vector.d.ts +2 -0
- package/esm/types/vector.js +2 -0
- package/esm/types/vector.js.map +1 -0
- package/esm/types/viewport.d.ts +36 -0
- package/esm/types/viewport.js +2 -0
- package/esm/types/viewport.js.map +1 -0
- package/esm/utils/anchor.d.ts +9 -0
- package/esm/utils/anchor.js +16 -0
- package/esm/utils/anchor.js.map +1 -0
- package/esm/utils/animation.d.ts +47 -0
- package/esm/utils/animation.js +189 -0
- package/esm/utils/animation.js.map +1 -0
- package/esm/utils/array.d.ts +9 -0
- package/esm/utils/array.js +16 -0
- package/esm/utils/array.js.map +1 -0
- package/esm/utils/bbox.d.ts +108 -0
- package/esm/utils/bbox.js +206 -0
- package/esm/utils/bbox.js.map +1 -0
- package/esm/utils/cache.d.ts +36 -0
- package/esm/utils/cache.js +52 -0
- package/esm/utils/cache.js.map +1 -0
- package/esm/utils/change.d.ts +17 -0
- package/esm/utils/change.js +91 -0
- package/esm/utils/change.js.map +1 -0
- package/esm/utils/collapsibility.d.ts +9 -0
- package/esm/utils/collapsibility.js +11 -0
- package/esm/utils/collapsibility.js.map +1 -0
- package/esm/utils/data.d.ts +34 -0
- package/esm/utils/data.js +59 -0
- package/esm/utils/data.js.map +1 -0
- package/esm/utils/diff.d.ts +15 -0
- package/esm/utils/diff.js +40 -0
- package/esm/utils/diff.js.map +1 -0
- package/esm/utils/dom.d.ts +29 -0
- package/esm/utils/dom.js +92 -0
- package/esm/utils/dom.js.map +1 -0
- package/esm/utils/edge.d.ts +192 -0
- package/esm/utils/edge.js +516 -0
- package/esm/utils/edge.js.map +1 -0
- package/esm/utils/element.d.ts +231 -0
- package/esm/utils/element.js +469 -0
- package/esm/utils/element.js.map +1 -0
- package/esm/utils/event/events.d.ts +26 -0
- package/esm/utils/event/events.js +41 -0
- package/esm/utils/event/events.js.map +1 -0
- package/esm/utils/event/index.d.ts +29 -0
- package/esm/utils/event/index.js +45 -0
- package/esm/utils/event/index.js.map +1 -0
- package/esm/utils/extension.d.ts +10 -0
- package/esm/utils/extension.js +25 -0
- package/esm/utils/extension.js.map +1 -0
- package/esm/utils/graphlib.d.ts +14 -0
- package/esm/utils/graphlib.js +44 -0
- package/esm/utils/graphlib.js.map +1 -0
- package/esm/utils/id.d.ts +20 -0
- package/esm/utils/id.js +41 -0
- package/esm/utils/id.js.map +1 -0
- package/esm/utils/is.d.ts +34 -0
- package/esm/utils/is.js +48 -0
- package/esm/utils/is.js.map +1 -0
- package/esm/utils/layout.d.ts +70 -0
- package/esm/utils/layout.js +204 -0
- package/esm/utils/layout.js.map +1 -0
- 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/math.d.ts +10 -0
- package/esm/utils/math.js +13 -0
- package/esm/utils/math.js.map +1 -0
- package/esm/utils/node.d.ts +11 -0
- package/esm/utils/node.js +19 -0
- package/esm/utils/node.js.map +1 -0
- package/esm/utils/padding.d.ts +9 -0
- package/esm/utils/padding.js +15 -0
- package/esm/utils/padding.js.map +1 -0
- package/esm/utils/palette.d.ts +32 -0
- package/esm/utils/palette.js +111 -0
- package/esm/utils/palette.js.map +1 -0
- package/esm/utils/path.d.ts +35 -0
- package/esm/utils/path.js +143 -0
- package/esm/utils/path.js.map +1 -0
- package/esm/utils/placement.d.ts +9 -0
- package/esm/utils/placement.js +18 -0
- package/esm/utils/placement.js.map +1 -0
- package/esm/utils/point.d.ts +192 -0
- package/esm/utils/point.js +342 -0
- package/esm/utils/point.js.map +1 -0
- package/esm/utils/polygon.d.ts +17 -0
- package/esm/utils/polygon.js +59 -0
- package/esm/utils/polygon.js.map +1 -0
- package/esm/utils/position.d.ts +50 -0
- package/esm/utils/position.js +67 -0
- package/esm/utils/position.js.map +1 -0
- package/esm/utils/prefix.d.ts +66 -0
- package/esm/utils/prefix.js +131 -0
- package/esm/utils/prefix.js.map +1 -0
- package/esm/utils/relation.d.ts +33 -0
- package/esm/utils/relation.js +72 -0
- package/esm/utils/relation.js.map +1 -0
- package/esm/utils/router/orth.d.ts +103 -0
- package/esm/utils/router/orth.js +280 -0
- package/esm/utils/router/orth.js.map +1 -0
- package/esm/utils/shape.d.ts +9 -0
- package/esm/utils/shape.js +22 -0
- package/esm/utils/shape.js.map +1 -0
- package/esm/utils/shortcut.d.ts +31 -0
- package/esm/utils/shortcut.js +88 -0
- package/esm/utils/shortcut.js.map +1 -0
- package/esm/utils/size.d.ts +7 -0
- package/esm/utils/size.js +12 -0
- package/esm/utils/size.js.map +1 -0
- package/esm/utils/style.d.ts +30 -0
- package/esm/utils/style.js +46 -0
- package/esm/utils/style.js.map +1 -0
- package/esm/utils/symbol.d.ts +30 -0
- package/esm/utils/symbol.js +75 -0
- package/esm/utils/symbol.js.map +1 -0
- package/esm/utils/text.d.ts +26 -0
- package/esm/utils/text.js +44 -0
- package/esm/utils/text.js.map +1 -0
- package/esm/utils/theme.d.ts +9 -0
- package/esm/utils/theme.js +17 -0
- package/esm/utils/theme.js.map +1 -0
- package/esm/utils/transform.d.ts +24 -0
- package/esm/utils/transform.js +43 -0
- package/esm/utils/transform.js.map +1 -0
- package/esm/utils/traverse.d.ts +23 -0
- package/esm/utils/traverse.js +44 -0
- package/esm/utils/traverse.js.map +1 -0
- package/esm/utils/tree.d.ts +17 -0
- package/esm/utils/tree.js +28 -0
- package/esm/utils/tree.js.map +1 -0
- package/esm/utils/vector.d.ts +143 -0
- package/esm/utils/vector.js +191 -0
- package/esm/utils/vector.js.map +1 -0
- package/esm/utils/visibility.d.ts +13 -0
- package/esm/utils/visibility.js +28 -0
- package/esm/utils/visibility.js.map +1 -0
- package/lib/animations/executor.d.ts +11 -0
- package/lib/animations/executor.js +74 -0
- package/lib/animations/executor.js.map +1 -0
- package/lib/animations/index.d.ts +32 -0
- package/lib/animations/index.js +19 -0
- package/lib/animations/index.js.map +1 -0
- package/lib/animations/types.d.ts +113 -0
- package/lib/animations/types.js.map +1 -0
- package/lib/behaviors/base-behavior.d.ts +6 -0
- package/lib/behaviors/base-behavior.js +8 -0
- package/lib/behaviors/base-behavior.js.map +1 -0
- package/lib/behaviors/brush-select.d.ts +189 -0
- package/lib/behaviors/brush-select.js +278 -0
- package/lib/behaviors/brush-select.js.map +1 -0
- package/lib/behaviors/click-select.d.ts +116 -0
- package/lib/behaviors/click-select.js +137 -0
- package/lib/behaviors/click-select.js.map +1 -0
- package/lib/behaviors/collapse-expand.d.ts +64 -0
- package/lib/behaviors/collapse-expand.js +80 -0
- package/lib/behaviors/collapse-expand.js.map +1 -0
- package/lib/behaviors/create-edge.d.ts +75 -0
- package/lib/behaviors/create-edge.js +159 -0
- package/lib/behaviors/create-edge.js.map +1 -0
- package/lib/behaviors/drag-canvas.d.ts +83 -0
- package/lib/behaviors/drag-canvas.js +101 -0
- package/lib/behaviors/drag-canvas.js.map +1 -0
- package/lib/behaviors/drag-element-force.d.ts +53 -0
- package/lib/behaviors/drag-element-force.js +98 -0
- package/lib/behaviors/drag-element-force.js.map +1 -0
- package/lib/behaviors/drag-element.d.ts +209 -0
- package/lib/behaviors/drag-element.js +314 -0
- package/lib/behaviors/drag-element.js.map +1 -0
- package/lib/behaviors/focus-element.d.ts +42 -0
- package/lib/behaviors/focus-element.js +62 -0
- package/lib/behaviors/focus-element.js.map +1 -0
- package/lib/behaviors/hover-activate.d.ts +84 -0
- package/lib/behaviors/hover-activate.js +108 -0
- package/lib/behaviors/hover-activate.js.map +1 -0
- package/lib/behaviors/index.d.ts +26 -0
- package/lib/behaviors/index.js +30 -0
- package/lib/behaviors/index.js.map +1 -0
- package/lib/behaviors/lasso-select.d.ts +41 -0
- package/lib/behaviors/lasso-select.js +70 -0
- package/lib/behaviors/lasso-select.js.map +1 -0
- package/lib/behaviors/scroll-canvas.d.ts +85 -0
- package/lib/behaviors/scroll-canvas.js +104 -0
- package/lib/behaviors/scroll-canvas.js.map +1 -0
- package/lib/behaviors/types.d.ts +6 -0
- package/lib/behaviors/types.js.map +1 -0
- package/lib/behaviors/zoom-canvas.d.ts +98 -0
- package/lib/behaviors/zoom-canvas.js +114 -0
- package/lib/behaviors/zoom-canvas.js.map +1 -0
- package/lib/constants/animation.d.ts +3 -0
- package/lib/constants/animation.js +13 -0
- package/lib/constants/animation.js.map +1 -0
- package/lib/constants/change.d.ts +64 -0
- package/lib/constants/change.js +69 -0
- package/lib/constants/change.js.map +1 -0
- package/lib/constants/element.d.ts +7 -0
- package/lib/constants/element.js +11 -0
- package/lib/constants/element.js.map +1 -0
- package/lib/constants/events/animation.d.ts +6 -0
- package/lib/constants/events/animation.js +11 -0
- package/lib/constants/events/animation.js.map +1 -0
- package/lib/constants/events/canvas.d.ts +115 -0
- package/lib/constants/events/canvas.js +120 -0
- package/lib/constants/events/canvas.js.map +1 -0
- package/lib/constants/events/combo.d.ts +109 -0
- package/lib/constants/events/combo.js +114 -0
- package/lib/constants/events/combo.js.map +1 -0
- package/lib/constants/events/common.d.ts +122 -0
- package/lib/constants/events/common.js +127 -0
- package/lib/constants/events/common.js.map +1 -0
- package/lib/constants/events/container.d.ts +14 -0
- package/lib/constants/events/container.js +19 -0
- package/lib/constants/events/container.js.map +1 -0
- package/lib/constants/events/edge.d.ts +91 -0
- package/lib/constants/events/edge.js +96 -0
- package/lib/constants/events/edge.js.map +1 -0
- package/lib/constants/events/graph.d.ts +158 -0
- package/lib/constants/events/graph.js +163 -0
- package/lib/constants/events/graph.js.map +1 -0
- 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 +9 -0
- package/lib/constants/events/index.js +22 -0
- package/lib/constants/events/index.js.map +1 -0
- package/lib/constants/events/node.d.ts +109 -0
- package/lib/constants/events/node.js +114 -0
- package/lib/constants/events/node.js.map +1 -0
- package/lib/constants/graphlib.d.ts +2 -0
- package/lib/constants/graphlib.js +6 -0
- package/lib/constants/graphlib.js.map +1 -0
- package/lib/constants/index.d.ts +5 -0
- package/lib/constants/index.js +22 -0
- package/lib/constants/index.js.map +1 -0
- package/lib/constants/registry.d.ts +62 -0
- package/lib/constants/registry.js +67 -0
- package/lib/constants/registry.js.map +1 -0
- package/lib/elements/base-element.d.ts +35 -0
- package/lib/elements/base-element.js +46 -0
- package/lib/elements/base-element.js.map +1 -0
- package/lib/elements/combos/base-combo.d.ts +91 -0
- package/lib/elements/combos/base-combo.js +166 -0
- package/lib/elements/combos/base-combo.js.map +1 -0
- package/lib/elements/combos/circle.d.ts +25 -0
- package/lib/elements/combos/circle.js +49 -0
- package/lib/elements/combos/circle.js.map +1 -0
- package/lib/elements/combos/index.d.ts +6 -0
- package/lib/elements/combos/index.js +10 -0
- package/lib/elements/combos/index.js.map +1 -0
- package/lib/elements/combos/rect.d.ts +21 -0
- package/lib/elements/combos/rect.js +33 -0
- package/lib/elements/combos/rect.js.map +1 -0
- package/lib/elements/edges/base-edge.d.ts +164 -0
- package/lib/elements/edges/base-edge.js +232 -0
- package/lib/elements/edges/base-edge.js.map +1 -0
- package/lib/elements/edges/cubic-horizontal.d.ts +39 -0
- package/lib/elements/edges/cubic-horizontal.js +32 -0
- package/lib/elements/edges/cubic-horizontal.js.map +1 -0
- package/lib/elements/edges/cubic-vertical.d.ts +39 -0
- package/lib/elements/edges/cubic-vertical.js +32 -0
- package/lib/elements/edges/cubic-vertical.js.map +1 -0
- package/lib/elements/edges/cubic.d.ts +48 -0
- package/lib/elements/edges/cubic.js +39 -0
- package/lib/elements/edges/cubic.js.map +1 -0
- package/lib/elements/edges/index.d.ts +14 -0
- package/lib/elements/edges/index.js +18 -0
- package/lib/elements/edges/index.js.map +1 -0
- package/lib/elements/edges/line.d.ts +25 -0
- package/lib/elements/edges/line.js +27 -0
- package/lib/elements/edges/line.js.map +1 -0
- package/lib/elements/edges/polyline.d.ts +63 -0
- package/lib/elements/edges/polyline.js +71 -0
- package/lib/elements/edges/polyline.js.map +1 -0
- package/lib/elements/edges/quadratic.d.ts +44 -0
- package/lib/elements/edges/quadratic.js +28 -0
- package/lib/elements/edges/quadratic.js.map +1 -0
- package/lib/elements/index.d.ts +3 -0
- package/lib/elements/index.js +20 -0
- package/lib/elements/index.js.map +1 -0
- package/lib/elements/nodes/base-node.d.ts +193 -0
- package/lib/elements/nodes/base-node.js +222 -0
- package/lib/elements/nodes/base-node.js.map +1 -0
- package/lib/elements/nodes/circle.d.ts +26 -0
- package/lib/elements/nodes/circle.js +40 -0
- package/lib/elements/nodes/circle.js.map +1 -0
- package/lib/elements/nodes/diamond.d.ts +21 -0
- package/lib/elements/nodes/diamond.js +27 -0
- package/lib/elements/nodes/diamond.js.map +1 -0
- package/lib/elements/nodes/donut.d.ts +45 -0
- package/lib/elements/nodes/donut.js +99 -0
- package/lib/elements/nodes/donut.js.map +1 -0
- package/lib/elements/nodes/ellipse.d.ts +26 -0
- package/lib/elements/nodes/ellipse.js +45 -0
- package/lib/elements/nodes/ellipse.js.map +1 -0
- package/lib/elements/nodes/hexagon.d.ts +28 -0
- package/lib/elements/nodes/hexagon.js +29 -0
- package/lib/elements/nodes/hexagon.js.map +1 -0
- package/lib/elements/nodes/html.d.ts +41 -0
- package/lib/elements/nodes/html.js +226 -0
- package/lib/elements/nodes/html.js.map +1 -0
- package/lib/elements/nodes/image.d.ts +38 -0
- package/lib/elements/nodes/image.js +63 -0
- package/lib/elements/nodes/image.js.map +1 -0
- package/lib/elements/nodes/index.d.ts +22 -0
- package/lib/elements/nodes/index.js +26 -0
- package/lib/elements/nodes/index.js.map +1 -0
- package/lib/elements/nodes/rect.d.ts +25 -0
- package/lib/elements/nodes/rect.js +42 -0
- package/lib/elements/nodes/rect.js.map +1 -0
- package/lib/elements/nodes/star.d.ts +30 -0
- package/lib/elements/nodes/star.js +38 -0
- package/lib/elements/nodes/star.js.map +1 -0
- package/lib/elements/nodes/triangle.d.ts +31 -0
- package/lib/elements/nodes/triangle.js +57 -0
- package/lib/elements/nodes/triangle.js.map +1 -0
- package/lib/elements/shapes/badge.d.ts +15 -0
- package/lib/elements/shapes/badge.js +31 -0
- package/lib/elements/shapes/badge.js.map +1 -0
- package/lib/elements/shapes/base-shape.d.ts +63 -0
- package/lib/elements/shapes/base-shape.js +164 -0
- package/lib/elements/shapes/base-shape.js.map +1 -0
- package/lib/elements/shapes/contour.d.ts +66 -0
- package/lib/elements/shapes/contour.js +40 -0
- package/lib/elements/shapes/contour.js.map +1 -0
- package/lib/elements/shapes/icon.d.ts +13 -0
- package/lib/elements/shapes/icon.js +35 -0
- package/lib/elements/shapes/icon.js.map +1 -0
- package/lib/elements/shapes/index.d.ts +16 -0
- package/lib/elements/shapes/index.js +19 -0
- package/lib/elements/shapes/index.js.map +1 -0
- package/lib/elements/shapes/label.d.ts +32 -0
- package/lib/elements/shapes/label.js +75 -0
- package/lib/elements/shapes/label.js.map +1 -0
- package/lib/elements/shapes/polygon.d.ts +30 -0
- package/lib/elements/shapes/polygon.js +31 -0
- package/lib/elements/shapes/polygon.js.map +1 -0
- package/lib/exports.d.ts +40 -0
- package/lib/exports.js +109 -0
- package/lib/exports.js.map +1 -0
- package/lib/index.d.ts +3 -259
- package/lib/index.js +4 -27
- package/lib/index.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 +4 -0
- package/lib/layouts/index.js +25 -0
- package/lib/layouts/index.js.map +1 -0
- package/lib/layouts/types.d.ts +84 -0
- package/lib/layouts/types.js.map +1 -0
- package/lib/palettes/index.d.ts +10 -0
- package/lib/palettes/index.js +67 -0
- package/lib/palettes/index.js.map +1 -0
- package/lib/palettes/types.d.ts +5 -0
- package/lib/palettes/types.js +3 -0
- package/lib/palettes/types.js.map +1 -0
- package/lib/plugins/background/index.d.ts +38 -0
- package/lib/plugins/background/index.js +52 -0
- package/lib/plugins/background/index.js.map +1 -0
- package/lib/plugins/base-plugin.d.ts +6 -0
- package/lib/plugins/base-plugin.js +8 -0
- package/lib/plugins/base-plugin.js.map +1 -0
- package/lib/plugins/bubble-sets.d.ts +116 -0
- package/lib/plugins/bubble-sets.js +283 -0
- package/lib/plugins/bubble-sets.js.map +1 -0
- package/lib/plugins/camera-setting.d.ts +111 -0
- package/lib/plugins/camera-setting.js +76 -0
- package/lib/plugins/camera-setting.js.map +1 -0
- package/lib/plugins/contextmenu/index.d.ts +115 -0
- package/lib/plugins/contextmenu/index.js +136 -0
- package/lib/plugins/contextmenu/index.js.map +1 -0
- package/lib/plugins/contextmenu/util.d.ts +26 -0
- package/lib/plugins/contextmenu/util.js +49 -0
- package/lib/plugins/contextmenu/util.js.map +1 -0
- package/lib/plugins/fullscreen/index.d.ts +79 -0
- package/lib/plugins/fullscreen/index.js +116 -0
- package/lib/plugins/fullscreen/index.js.map +1 -0
- package/lib/plugins/grid-line.d.ts +106 -0
- package/lib/plugins/grid-line.js +82 -0
- package/lib/plugins/grid-line.js.map +1 -0
- package/lib/plugins/history/index.d.ts +120 -0
- package/lib/plugins/history/index.js +202 -0
- package/lib/plugins/history/index.js.map +1 -0
- package/lib/plugins/history/util.d.ts +21 -0
- package/lib/plugins/history/util.js +88 -0
- package/lib/plugins/history/util.js.map +1 -0
- package/lib/plugins/hull/index.d.ts +114 -0
- package/lib/plugins/hull/index.js +168 -0
- package/lib/plugins/hull/index.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 +28 -0
- package/lib/plugins/index.js +32 -0
- package/lib/plugins/index.js.map +1 -0
- package/lib/plugins/legend.d.ts +129 -0
- package/lib/plugins/legend.js +322 -0
- package/lib/plugins/legend.js.map +1 -0
- package/lib/plugins/timebar.d.ts +241 -0
- package/lib/plugins/timebar.js +271 -0
- package/lib/plugins/timebar.js.map +1 -0
- package/lib/plugins/toolbar/index.d.ts +69 -0
- package/lib/plugins/toolbar/index.js +75 -0
- package/lib/plugins/toolbar/index.js.map +1 -0
- package/lib/plugins/toolbar/util.d.ts +33 -0
- package/lib/plugins/toolbar/util.js +97 -0
- package/lib/plugins/toolbar/util.js.map +1 -0
- package/lib/plugins/tooltip.d.ts +116 -0
- package/lib/plugins/tooltip.js +298 -0
- package/lib/plugins/tooltip.js.map +1 -0
- package/lib/plugins/types.d.ts +4 -0
- package/lib/plugins/types.js +3 -0
- package/lib/plugins/types.js.map +1 -0
- package/lib/plugins/watermark/index.d.ts +191 -0
- package/lib/plugins/watermark/index.js +71 -0
- package/lib/plugins/watermark/index.js.map +1 -0
- package/lib/plugins/watermark/util.d.ts +18 -0
- package/lib/plugins/watermark/util.js +78 -0
- package/lib/plugins/watermark/util.js.map +1 -0
- package/lib/preset.d.ts +1 -0
- package/lib/preset.js +7 -0
- package/lib/preset.js.map +1 -0
- package/lib/registry/build-in.d.ts +6 -0
- package/lib/registry/build-in.js +118 -0
- package/lib/registry/build-in.js.map +1 -0
- package/lib/registry/extension/index.d.ts +33 -0
- package/lib/registry/extension/index.js +89 -0
- package/lib/registry/extension/index.js.map +1 -0
- package/lib/registry/extension/types.d.ts +38 -0
- package/lib/registry/extension/types.js +3 -0
- package/lib/registry/extension/types.js.map +1 -0
- package/lib/registry/index.d.ts +59 -0
- package/lib/registry/index.js +104 -0
- package/lib/registry/index.js.map +1 -0
- package/lib/registry/types.d.ts +39 -0
- package/lib/registry/types.js +3 -0
- package/lib/registry/types.js.map +1 -0
- package/lib/runtime/animation.d.ts +54 -0
- package/lib/runtime/animation.js +143 -0
- package/lib/runtime/animation.js.map +1 -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 +20 -0
- package/lib/runtime/behavior.js +123 -0
- package/lib/runtime/behavior.js.map +1 -0
- package/lib/runtime/canvas.d.ts +60 -0
- package/lib/runtime/canvas.js +262 -0
- package/lib/runtime/canvas.js.map +1 -0
- package/lib/runtime/data.d.ts +202 -0
- package/lib/runtime/data.js +698 -0
- package/lib/runtime/data.js.map +1 -0
- package/lib/runtime/element.d.ts +102 -0
- package/lib/runtime/element.js +557 -0
- package/lib/runtime/element.js.map +1 -0
- package/lib/runtime/graph.d.ts +826 -536
- package/lib/runtime/graph.js +1028 -1830
- package/lib/runtime/graph.js.map +1 -1
- package/lib/runtime/layout.d.ts +38 -0
- package/lib/runtime/layout.js +240 -0
- package/lib/runtime/layout.js.map +1 -0
- package/lib/runtime/plugin.d.ts +10 -0
- package/lib/runtime/plugin.js +19 -0
- package/lib/runtime/plugin.js.map +1 -0
- package/lib/runtime/transform.d.ts +12 -0
- package/lib/runtime/transform.js +31 -0
- package/lib/runtime/transform.js.map +1 -0
- package/lib/runtime/types.d.ts +90 -0
- package/lib/runtime/types.js +3 -0
- package/lib/runtime/types.js.map +1 -0
- package/lib/runtime/viewport.d.ts +58 -0
- package/lib/runtime/viewport.js +245 -0
- package/lib/runtime/viewport.js.map +1 -0
- package/lib/spec/behavior.d.ts +30 -0
- package/lib/spec/behavior.js +3 -0
- package/lib/spec/behavior.js.map +1 -0
- package/lib/spec/canvas.d.ts +53 -0
- package/lib/spec/canvas.js +3 -0
- package/lib/spec/canvas.js.map +1 -0
- package/lib/spec/data.d.ts +222 -0
- package/lib/spec/data.js +3 -0
- package/lib/spec/data.js.map +1 -0
- package/lib/spec/element/animation.d.ts +6 -0
- package/lib/spec/element/animation.js +3 -0
- package/lib/spec/element/animation.js.map +1 -0
- package/lib/spec/element/combo.d.ts +52 -0
- package/lib/spec/element/combo.js +3 -0
- package/lib/spec/element/combo.js.map +1 -0
- package/lib/spec/element/edge.d.ts +52 -0
- package/lib/spec/element/edge.js +3 -0
- package/lib/spec/element/edge.js.map +1 -0
- package/lib/spec/element/node.d.ts +52 -0
- package/lib/spec/element/node.js +3 -0
- package/lib/spec/element/node.js.map +1 -0
- package/lib/spec/element/palette.d.ts +53 -0
- package/lib/spec/element/palette.js +3 -0
- package/lib/spec/element/palette.js.map +1 -0
- package/lib/spec/graph.d.ts +91 -0
- package/lib/spec/graph.js.map +1 -0
- package/lib/spec/index.d.ts +12 -0
- package/lib/spec/index.js +3 -0
- package/lib/spec/index.js.map +1 -0
- package/lib/spec/layout.d.ts +4 -0
- package/lib/spec/layout.js.map +1 -0
- package/lib/spec/plugin.d.ts +32 -0
- package/lib/spec/plugin.js +3 -0
- package/lib/spec/plugin.js.map +1 -0
- package/lib/spec/theme.d.ts +7 -0
- package/lib/spec/theme.js +3 -0
- package/lib/spec/theme.js.map +1 -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/spec/viewport.d.ts +82 -0
- package/lib/spec/viewport.js +3 -0
- package/lib/spec/viewport.js.map +1 -0
- package/lib/themes/base.d.ts +34 -0
- package/lib/themes/base.js +257 -0
- package/lib/themes/base.js.map +1 -0
- package/lib/themes/dark.d.ts +2 -0
- package/lib/themes/dark.js +42 -0
- package/lib/themes/dark.js.map +1 -0
- package/lib/themes/index.d.ts +2 -0
- package/lib/themes/index.js +8 -0
- package/lib/themes/index.js.map +1 -0
- package/lib/themes/light.d.ts +2 -0
- package/lib/themes/light.js +25 -0
- package/lib/themes/light.js.map +1 -0
- package/lib/themes/types.d.ts +9 -0
- package/lib/themes/types.js +3 -0
- package/lib/themes/types.js.map +1 -0
- package/lib/transforms/arrange-draw-order.d.ts +10 -0
- package/lib/transforms/arrange-draw-order.js +36 -0
- package/lib/transforms/arrange-draw-order.js.map +1 -0
- package/lib/transforms/base-transform.d.ts +8 -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 +11 -0
- package/lib/transforms/collapse-expand-combo.js +79 -0
- package/lib/transforms/collapse-expand-combo.js.map +1 -0
- package/lib/transforms/collapse-expand-node.d.ts +12 -0
- package/lib/transforms/collapse-expand-node.js +95 -0
- package/lib/transforms/collapse-expand-node.js.map +1 -0
- package/lib/transforms/get-edge-actual-ends.d.ts +13 -0
- package/lib/transforms/get-edge-actual-ends.js +41 -0
- package/lib/transforms/get-edge-actual-ends.js.map +1 -0
- package/lib/transforms/index.d.ts +8 -0
- package/lib/transforms/index.js +18 -0
- package/lib/transforms/index.js.map +1 -0
- package/lib/transforms/process-parallel-edges.d.ts +85 -0
- package/lib/transforms/process-parallel-edges.js +235 -0
- package/lib/transforms/process-parallel-edges.js.map +1 -0
- package/lib/transforms/types.d.ts +20 -0
- package/lib/transforms/types.js +3 -0
- package/lib/transforms/types.js.map +1 -0
- package/lib/transforms/update-related-edge.d.ts +10 -0
- package/lib/transforms/update-related-edge.js +27 -0
- package/lib/transforms/update-related-edge.js.map +1 -0
- package/lib/transforms/utils.d.ts +13 -0
- package/lib/transforms/utils.js +29 -0
- package/lib/transforms/utils.js.map +1 -0
- package/lib/types/anchor.d.ts +3 -0
- package/lib/types/anchor.js +3 -0
- package/lib/types/anchor.js.map +1 -0
- package/lib/types/animation.d.ts +5 -0
- package/lib/types/animation.js +3 -0
- package/lib/types/animation.js.map +1 -0
- package/lib/types/callable.d.ts +30 -0
- package/lib/types/callable.js +3 -0
- package/lib/types/callable.js.map +1 -0
- package/lib/types/canvas.d.ts +1 -0
- package/lib/types/canvas.js +3 -0
- package/lib/types/canvas.js.map +1 -0
- package/lib/types/change.d.ts +68 -0
- package/lib/types/change.js +3 -0
- package/lib/types/change.js.map +1 -0
- package/lib/types/combo.d.ts +20 -132
- package/lib/types/data.d.ts +44 -27
- package/lib/types/edge.d.ts +110 -97
- package/lib/types/element.d.ts +18 -0
- package/lib/types/element.js +3 -0
- package/lib/types/element.js.map +1 -0
- package/lib/types/enum.d.ts +1 -0
- package/lib/types/enum.js +3 -0
- package/lib/types/enum.js.map +1 -0
- package/lib/types/event.d.ts +54 -38
- package/lib/types/event.js +0 -31
- package/lib/types/event.js.map +1 -1
- package/lib/types/graphlib.d.ts +16 -0
- package/lib/types/graphlib.js +3 -0
- package/lib/types/graphlib.js.map +1 -0
- package/lib/types/history.d.ts +49 -26
- package/lib/types/history.js +0 -6
- package/lib/types/history.js.map +1 -1
- package/lib/types/id.d.ts +1 -0
- package/lib/types/id.js +3 -0
- package/lib/types/id.js.map +1 -0
- package/lib/types/index.d.ts +26 -16
- package/lib/types/index.js +0 -4
- package/lib/types/index.js.map +1 -1
- package/lib/types/layout.d.ts +8 -71
- package/lib/types/layout.js +0 -22
- package/lib/types/layout.js.map +1 -1
- package/lib/types/node.d.ts +132 -203
- package/lib/types/padding.d.ts +2 -0
- package/lib/types/padding.js +3 -0
- package/lib/types/padding.js.map +1 -0
- package/lib/types/placement.d.ts +5 -0
- package/lib/types/placement.js +3 -0
- package/lib/types/placement.js.map +1 -0
- package/lib/types/plugin.d.ts +5 -44
- package/lib/types/plugin.js +0 -54
- package/lib/types/plugin.js.map +1 -1
- package/lib/types/point.d.ts +2 -0
- package/lib/types/point.js +3 -0
- package/lib/types/point.js.map +1 -0
- package/lib/types/position.d.ts +2 -0
- package/lib/types/position.js +3 -0
- package/lib/types/position.js.map +1 -0
- package/lib/types/prefix.d.ts +17 -0
- package/lib/types/prefix.js +3 -0
- package/lib/types/prefix.js.map +1 -0
- package/lib/types/size.d.ts +3 -0
- package/lib/types/size.js +3 -0
- package/lib/types/size.js.map +1 -0
- package/lib/types/state.d.ts +1 -0
- package/lib/types/state.js +3 -0
- package/lib/types/state.js.map +1 -0
- package/lib/types/style.d.ts +9 -0
- package/lib/types/style.js +3 -0
- package/lib/types/style.js.map +1 -0
- package/lib/types/tree.d.ts +5 -0
- package/lib/types/tree.js +3 -0
- package/lib/types/tree.js.map +1 -0
- package/lib/types/vector.d.ts +2 -0
- package/lib/types/vector.js +3 -0
- package/lib/types/vector.js.map +1 -0
- package/lib/types/viewport.d.ts +36 -0
- package/lib/types/viewport.js +3 -0
- package/lib/types/viewport.js.map +1 -0
- package/lib/utils/anchor.d.ts +9 -0
- package/lib/utils/anchor.js +20 -0
- package/lib/utils/anchor.js.map +1 -0
- package/lib/utils/animation.d.ts +47 -0
- package/lib/utils/animation.js +197 -0
- package/lib/utils/animation.js.map +1 -0
- package/lib/utils/array.d.ts +9 -0
- package/lib/utils/array.js +20 -0
- package/lib/utils/array.js.map +1 -0
- package/lib/utils/bbox.d.ts +108 -0
- package/lib/utils/bbox.js +222 -0
- package/lib/utils/bbox.js.map +1 -0
- package/lib/utils/cache.d.ts +36 -0
- package/lib/utils/cache.js +59 -0
- package/lib/utils/cache.js.map +1 -0
- package/lib/utils/change.d.ts +17 -0
- package/lib/utils/change.js +96 -0
- package/lib/utils/change.js.map +1 -0
- package/lib/utils/collapsibility.d.ts +9 -0
- package/lib/utils/collapsibility.js +15 -0
- package/lib/utils/collapsibility.js.map +1 -0
- package/lib/utils/data.d.ts +34 -0
- package/lib/utils/data.js +65 -0
- package/lib/utils/data.js.map +1 -0
- package/lib/utils/diff.d.ts +15 -0
- package/lib/utils/diff.js +44 -0
- package/lib/utils/diff.js.map +1 -0
- package/lib/utils/dom.d.ts +29 -0
- package/lib/utils/dom.js +99 -0
- package/lib/utils/dom.js.map +1 -0
- package/lib/utils/edge.d.ts +192 -0
- package/lib/utils/edge.js +537 -0
- package/lib/utils/edge.js.map +1 -0
- package/lib/utils/element.d.ts +231 -0
- package/lib/utils/element.js +498 -0
- package/lib/utils/element.js.map +1 -0
- package/lib/utils/event/events.d.ts +26 -0
- package/lib/utils/event/events.js +49 -0
- package/lib/utils/event/events.js.map +1 -0
- package/lib/utils/event/index.d.ts +29 -0
- package/lib/utils/event/index.js +64 -0
- package/lib/utils/event/index.js.map +1 -0
- package/lib/utils/extension.d.ts +10 -0
- package/lib/utils/extension.js +29 -0
- package/lib/utils/extension.js.map +1 -0
- package/lib/utils/graphlib.d.ts +14 -0
- package/lib/utils/graphlib.js +50 -0
- package/lib/utils/graphlib.js.map +1 -0
- package/lib/utils/id.d.ts +20 -0
- package/lib/utils/id.js +47 -0
- package/lib/utils/id.js.map +1 -0
- package/lib/utils/is.d.ts +34 -0
- package/lib/utils/is.js +55 -0
- package/lib/utils/is.js.map +1 -0
- package/lib/utils/layout.d.ts +70 -0
- package/lib/utils/layout.js +214 -0
- package/lib/utils/layout.js.map +1 -0
- 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/math.d.ts +10 -0
- package/lib/utils/math.js +17 -0
- package/lib/utils/math.js.map +1 -0
- package/lib/utils/node.d.ts +11 -0
- package/lib/utils/node.js +23 -0
- package/lib/utils/node.js.map +1 -0
- package/lib/utils/padding.d.ts +9 -0
- package/lib/utils/padding.js +19 -0
- package/lib/utils/padding.js.map +1 -0
- package/lib/utils/palette.d.ts +32 -0
- package/lib/utils/palette.js +117 -0
- package/lib/utils/palette.js.map +1 -0
- package/lib/utils/path.d.ts +35 -0
- package/lib/utils/path.js +150 -0
- package/lib/utils/path.js.map +1 -0
- package/lib/utils/placement.d.ts +9 -0
- package/lib/utils/placement.js +22 -0
- package/lib/utils/placement.js.map +1 -0
- package/lib/utils/point.d.ts +192 -0
- package/lib/utils/point.js +366 -0
- package/lib/utils/point.js.map +1 -0
- package/lib/utils/polygon.d.ts +17 -0
- package/lib/utils/polygon.js +63 -0
- package/lib/utils/polygon.js.map +1 -0
- package/lib/utils/position.d.ts +50 -0
- package/lib/utils/position.js +75 -0
- package/lib/utils/position.js.map +1 -0
- package/lib/utils/prefix.d.ts +66 -0
- package/lib/utils/prefix.js +141 -0
- package/lib/utils/prefix.js.map +1 -0
- package/lib/utils/relation.d.ts +33 -0
- package/lib/utils/relation.js +77 -0
- package/lib/utils/relation.js.map +1 -0
- package/lib/utils/router/orth.d.ts +103 -0
- package/lib/utils/router/orth.js +292 -0
- package/lib/utils/router/orth.js.map +1 -0
- package/lib/utils/shape.d.ts +9 -0
- package/lib/utils/shape.js +26 -0
- package/lib/utils/shape.js.map +1 -0
- package/lib/utils/shortcut.d.ts +31 -0
- package/lib/utils/shortcut.js +92 -0
- package/lib/utils/shortcut.js.map +1 -0
- package/lib/utils/size.d.ts +7 -0
- package/lib/utils/size.js +16 -0
- package/lib/utils/size.js.map +1 -0
- package/lib/utils/style.d.ts +30 -0
- package/lib/utils/style.js +52 -0
- package/lib/utils/style.js.map +1 -0
- package/lib/utils/symbol.d.ts +30 -0
- package/lib/utils/symbol.js +85 -0
- package/lib/utils/symbol.js.map +1 -0
- package/lib/utils/text.d.ts +26 -0
- package/lib/utils/text.js +50 -0
- package/lib/utils/text.js.map +1 -0
- package/lib/utils/theme.d.ts +9 -0
- package/lib/utils/theme.js +21 -0
- package/lib/utils/theme.js.map +1 -0
- package/lib/utils/transform.d.ts +24 -0
- package/lib/utils/transform.js +48 -0
- package/lib/utils/transform.js.map +1 -0
- package/lib/utils/traverse.d.ts +23 -0
- package/lib/utils/traverse.js +49 -0
- package/lib/utils/traverse.js.map +1 -0
- package/lib/utils/tree.d.ts +17 -0
- package/lib/utils/tree.js +32 -0
- package/lib/utils/tree.js.map +1 -0
- package/lib/utils/vector.d.ts +143 -0
- package/lib/utils/vector.js +210 -0
- package/lib/utils/vector.js.map +1 -0
- package/lib/utils/visibility.d.ts +13 -0
- package/lib/utils/visibility.js +32 -0
- package/lib/utils/visibility.js.map +1 -0
- package/package.json +56 -104
- package/src/animations/executor.ts +94 -0
- package/src/animations/index.ts +23 -0
- package/src/animations/types.ts +122 -0
- package/src/behaviors/base-behavior.ts +6 -0
- package/src/behaviors/brush-select.ts +394 -0
- package/src/behaviors/click-select.ts +245 -0
- package/src/behaviors/collapse-expand.ts +124 -0
- package/src/behaviors/create-edge.ts +224 -0
- package/src/behaviors/drag-canvas.ts +157 -0
- package/src/behaviors/drag-element-force.ts +107 -0
- package/src/behaviors/drag-element.ts +438 -0
- package/src/behaviors/focus-element.ts +88 -0
- package/src/behaviors/hover-activate.ts +185 -0
- package/src/behaviors/index.ts +27 -0
- package/src/behaviors/lasso-select.ts +82 -0
- package/src/behaviors/scroll-canvas.ts +166 -0
- package/src/behaviors/types.ts +7 -0
- package/src/behaviors/zoom-canvas.ts +190 -0
- package/src/constants/animation.ts +12 -0
- package/src/constants/change.ts +65 -0
- package/src/constants/element.ts +8 -0
- package/src/constants/events/animation.ts +6 -0
- package/src/constants/events/canvas.ts +115 -0
- package/src/constants/events/combo.ts +109 -0
- package/src/constants/events/common.ts +122 -0
- package/src/constants/events/container.ts +14 -0
- package/src/constants/events/edge.ts +91 -0
- package/src/constants/events/graph.ts +158 -0
- package/src/constants/events/history.ts +38 -0
- package/src/constants/events/index.ts +9 -0
- package/src/constants/events/node.ts +109 -0
- package/src/constants/graphlib.ts +3 -0
- package/src/constants/index.ts +5 -0
- package/src/constants/registry.ts +62 -0
- package/src/elements/base-element.ts +52 -0
- package/src/elements/combos/base-combo.ts +260 -0
- package/src/elements/combos/circle.ts +61 -0
- package/src/elements/combos/index.ts +7 -0
- package/src/elements/combos/rect.ts +41 -0
- package/src/elements/edges/base-edge.ts +420 -0
- package/src/elements/edges/cubic-horizontal.ts +60 -0
- package/src/elements/edges/cubic-vertical.ts +60 -0
- package/src/elements/edges/cubic.ts +86 -0
- package/src/elements/edges/index.ts +15 -0
- package/src/elements/edges/line.ts +37 -0
- package/src/elements/edges/polyline.ts +143 -0
- package/src/elements/edges/quadratic.ts +61 -0
- package/src/elements/index.ts +3 -0
- package/src/elements/nodes/base-node.ts +426 -0
- package/src/elements/nodes/circle.ts +52 -0
- package/src/elements/nodes/diamond.ts +35 -0
- package/src/elements/nodes/donut.ts +147 -0
- package/src/elements/nodes/ellipse.ts +58 -0
- package/src/elements/nodes/hexagon.ts +45 -0
- package/src/elements/nodes/html.ts +256 -0
- package/src/elements/nodes/image.ts +89 -0
- package/src/elements/nodes/index.ts +23 -0
- package/src/elements/nodes/rect.ts +53 -0
- package/src/elements/nodes/star.ts +56 -0
- package/src/elements/nodes/triangle.ts +78 -0
- package/src/elements/shapes/badge.ts +37 -0
- package/src/elements/shapes/base-shape.ts +199 -0
- package/src/elements/shapes/contour.ts +106 -0
- package/src/elements/shapes/icon.ts +39 -0
- package/src/elements/shapes/index.ts +18 -0
- package/src/elements/shapes/label.ts +106 -0
- package/src/elements/shapes/polygon.ts +51 -0
- package/src/exports.ts +241 -0
- package/src/index.ts +3 -23
- package/src/layouts/base-layout.ts +18 -0
- package/src/layouts/hierarchy.d.ts +10 -0
- package/src/layouts/index.ts +17 -0
- package/src/layouts/types.ts +131 -0
- package/src/palettes/index.ts +67 -0
- package/src/palettes/types.ts +9 -0
- package/src/plugins/background/index.ts +64 -0
- package/src/plugins/base-plugin.ts +6 -0
- package/src/plugins/bubble-sets.ts +333 -0
- package/src/plugins/camera-setting.ts +168 -0
- package/src/plugins/contextmenu/index.ts +225 -0
- package/src/plugins/contextmenu/util.ts +62 -0
- package/src/plugins/fullscreen/index.ts +168 -0
- package/src/plugins/grid-line.ts +165 -0
- package/src/plugins/history/index.ts +256 -0
- package/src/plugins/history/util.ts +90 -0
- package/src/plugins/hull/index.ts +214 -0
- package/src/plugins/hull/util.ts +222 -0
- package/src/plugins/index.ts +29 -0
- package/src/plugins/legend.ts +405 -0
- package/src/plugins/timebar.ts +471 -0
- package/src/plugins/toolbar/index.ts +131 -0
- package/src/plugins/toolbar/util.ts +119 -0
- package/src/plugins/tooltip.ts +343 -0
- package/src/plugins/types.ts +5 -0
- package/src/plugins/watermark/index.ts +239 -0
- package/src/plugins/watermark/util.ts +93 -0
- package/src/preset.ts +5 -0
- package/src/registry/build-in.ts +186 -0
- package/src/registry/extension/index.ts +112 -0
- package/src/registry/extension/types.ts +45 -0
- package/src/registry/index.ts +109 -0
- package/src/registry/types.ts +26 -0
- package/src/runtime/animation.ts +186 -0
- package/src/runtime/batch.ts +38 -0
- package/src/runtime/behavior.ts +136 -0
- package/src/runtime/canvas.ts +348 -0
- package/src/runtime/data.ts +789 -0
- package/src/runtime/element.ts +738 -0
- package/src/runtime/graph.ts +1309 -2353
- package/src/runtime/layout.ts +299 -0
- package/src/runtime/plugin.ts +21 -0
- package/src/runtime/transform.ts +35 -0
- package/src/runtime/types.ts +91 -0
- package/src/runtime/viewport.ts +282 -0
- package/src/spec/behavior.ts +33 -0
- package/src/spec/canvas.ts +54 -0
- package/src/spec/data.ts +225 -0
- package/src/spec/element/animation.ts +6 -0
- package/src/spec/element/combo.ts +55 -0
- package/src/spec/element/edge.ts +55 -0
- package/src/spec/element/node.ts +55 -0
- package/src/spec/element/palette.ts +57 -0
- package/src/spec/graph.ts +93 -0
- package/src/spec/index.ts +12 -0
- package/src/spec/layout.ts +7 -0
- package/src/spec/plugin.ts +35 -0
- package/src/spec/theme.ts +7 -0
- package/src/spec/transform.ts +15 -0
- package/src/spec/viewport.ts +76 -0
- package/src/themes/base.ts +305 -0
- package/src/themes/dark.ts +43 -0
- package/src/themes/index.ts +2 -0
- package/src/themes/light.ts +24 -0
- package/src/themes/types.ts +10 -0
- package/src/transforms/arrange-draw-order.ts +42 -0
- package/src/transforms/base-transform.ts +12 -0
- package/src/transforms/collapse-expand-combo.ts +80 -0
- package/src/transforms/collapse-expand-node.ts +107 -0
- package/src/transforms/get-edge-actual-ends.ts +45 -0
- package/src/transforms/index.ts +9 -0
- package/src/transforms/process-parallel-edges.ts +298 -0
- package/src/transforms/types.ts +23 -0
- package/src/transforms/update-related-edge.ts +31 -0
- package/src/transforms/utils.ts +31 -0
- package/src/types/anchor.ts +5 -0
- package/src/types/animation.ts +7 -0
- package/src/types/callable.ts +33 -0
- package/src/types/canvas.ts +1 -0
- package/src/types/change.ts +82 -0
- package/src/types/combo.ts +21 -174
- package/src/types/data.ts +53 -56
- package/src/types/edge.ts +124 -122
- package/src/types/element.ts +25 -0
- package/src/types/enum.ts +1 -0
- package/src/types/event.ts +73 -43
- package/src/types/graphlib.ts +28 -0
- package/src/types/history.ts +50 -27
- package/src/types/id.ts +1 -0
- package/src/types/index.ts +26 -54
- package/src/types/layout.ts +8 -138
- package/src/types/node.ts +140 -225
- package/src/types/padding.ts +3 -0
- package/src/types/placement.ts +17 -0
- package/src/types/plugin.ts +5 -82
- package/src/types/point.ts +2 -0
- package/src/types/position.ts +3 -0
- package/src/types/prefix.ts +19 -0
- package/src/types/size.ts +5 -0
- package/src/types/state.ts +1 -0
- package/src/types/style.ts +10 -0
- package/src/types/tree.ts +5 -0
- package/src/types/vector.ts +3 -0
- package/src/types/viewport.ts +41 -0
- package/src/utils/anchor.ts +19 -0
- package/src/utils/animation.ts +208 -0
- package/src/utils/array.ts +15 -0
- package/src/utils/bbox.ts +228 -0
- package/src/utils/cache.ts +57 -0
- package/src/utils/change.ts +101 -0
- package/src/utils/collapsibility.ts +12 -0
- package/src/utils/data.ts +64 -0
- package/src/utils/diff.ts +43 -0
- package/src/utils/dom.ts +115 -0
- package/src/utils/edge.ts +621 -0
- package/src/utils/element.ts +527 -0
- package/src/utils/event/events.ts +72 -0
- package/src/utils/event/index.ts +50 -0
- package/src/utils/extension.ts +26 -0
- package/src/utils/graphlib.ts +54 -0
- package/src/utils/id.ts +46 -0
- package/src/utils/is.ts +53 -0
- package/src/utils/layout.ts +241 -0
- package/src/utils/line.ts +50 -0
- package/src/utils/math.ts +12 -0
- package/src/utils/node.ts +23 -0
- package/src/utils/padding.ts +16 -0
- package/src/utils/palette.ts +126 -0
- package/src/utils/path.ts +153 -0
- package/src/utils/placement.ts +19 -0
- package/src/utils/point.ts +374 -0
- package/src/utils/polygon.ts +69 -0
- package/src/utils/position.ts +73 -0
- package/src/utils/prefix.ts +141 -0
- package/src/utils/relation.ts +83 -0
- package/src/utils/router/orth.ts +323 -0
- package/src/utils/shape.ts +26 -0
- package/src/utils/shortcut.ts +113 -0
- package/src/utils/size.ts +12 -0
- package/src/utils/style.ts +55 -0
- package/src/utils/symbol.ts +86 -0
- package/src/utils/text.ts +51 -0
- package/src/utils/theme.ts +18 -0
- package/src/utils/transform.ts +50 -0
- package/src/utils/traverse.ts +59 -0
- package/src/utils/tree.ts +47 -0
- package/src/utils/vector.ts +208 -0
- package/src/utils/visibility.ts +31 -0
- package/esm/api-doc/behaviors.d.ts +0 -2
- package/esm/api-doc/behaviors.js +0 -2
- package/esm/api-doc/behaviors.js.map +0 -1
- package/esm/api-doc/graph.d.ts +0 -4
- package/esm/api-doc/graph.js +0 -4
- package/esm/api-doc/graph.js.map +0 -1
- package/esm/api-doc/item.d.ts +0 -11
- package/esm/api-doc/item.js +0 -5
- package/esm/api-doc/item.js.map +0 -1
- package/esm/api-doc/layout.d.ts +0 -1
- package/esm/api-doc/layout.js.map +0 -1
- package/esm/api-doc/plugins.d.ts +0 -1
- package/esm/api-doc/plugins.js +0 -2
- package/esm/api-doc/plugins.js.map +0 -1
- package/esm/api-doc/types.d.ts +0 -0
- package/esm/api-doc/types.js +0 -3
- package/esm/api-doc/types.js.map +0 -1
- package/esm/api-doc/util.d.ts +0 -3
- package/esm/api-doc/util.js +0 -4
- package/esm/api-doc/util.js.map +0 -1
- package/esm/constant/index.d.ts +0 -1
- package/esm/constant/index.js +0 -2
- package/esm/constant/index.js.map +0 -1
- package/esm/constant/shape.d.ts +0 -23
- package/esm/constant/shape.js +0 -27
- package/esm/constant/shape.js.map +0 -1
- package/esm/item/combo.d.ts +0 -81
- package/esm/item/combo.js +0 -195
- package/esm/item/combo.js.map +0 -1
- package/esm/item/edge.d.ts +0 -74
- package/esm/item/edge.js +0 -198
- package/esm/item/edge.js.map +0 -1
- package/esm/item/item.d.ts +0 -192
- package/esm/item/item.js +0 -711
- package/esm/item/item.js.map +0 -1
- package/esm/item/node.d.ts +0 -64
- package/esm/item/node.js +0 -208
- package/esm/item/node.js.map +0 -1
- package/esm/runtime/controller/data.d.ts +0 -86
- package/esm/runtime/controller/data.js +0 -722
- package/esm/runtime/controller/data.js.map +0 -1
- package/esm/runtime/controller/extension.d.ts +0 -9
- package/esm/runtime/controller/extension.js +0 -11
- package/esm/runtime/controller/extension.js.map +0 -1
- package/esm/runtime/controller/index.d.ts +0 -7
- package/esm/runtime/controller/index.js +0 -8
- package/esm/runtime/controller/index.js.map +0 -1
- package/esm/runtime/controller/interaction.d.ts +0 -52
- package/esm/runtime/controller/interaction.js +0 -274
- package/esm/runtime/controller/interaction.js.map +0 -1
- package/esm/runtime/controller/item.d.ts +0 -144
- package/esm/runtime/controller/item.js +0 -1257
- package/esm/runtime/controller/item.js.map +0 -1
- package/esm/runtime/controller/layout.d.ts +0 -33
- package/esm/runtime/controller/layout.js +0 -300
- package/esm/runtime/controller/layout.js.map +0 -1
- package/esm/runtime/controller/plugin.d.ts +0 -45
- package/esm/runtime/controller/plugin.js +0 -173
- package/esm/runtime/controller/plugin.js.map +0 -1
- package/esm/runtime/controller/theme.d.ts +0 -29
- package/esm/runtime/controller/theme.js +0 -58
- package/esm/runtime/controller/theme.js.map +0 -1
- package/esm/runtime/controller/viewport.d.ts +0 -11
- package/esm/runtime/controller/viewport.js +0 -102
- package/esm/runtime/controller/viewport.js.map +0 -1
- package/esm/runtime/hooks.d.ts +0 -33
- package/esm/runtime/hooks.js +0 -74
- package/esm/runtime/hooks.js.map +0 -1
- package/esm/stdlib/behavior/activate-relations.d.ts +0 -61
- package/esm/stdlib/behavior/activate-relations.js +0 -85
- package/esm/stdlib/behavior/activate-relations.js.map +0 -1
- package/esm/stdlib/behavior/brush-select.d.ts +0 -109
- package/esm/stdlib/behavior/brush-select.js +0 -267
- package/esm/stdlib/behavior/brush-select.js.map +0 -1
- package/esm/stdlib/behavior/click-select.d.ts +0 -73
- package/esm/stdlib/behavior/click-select.js +0 -157
- package/esm/stdlib/behavior/click-select.js.map +0 -1
- package/esm/stdlib/behavior/collapse-expand-combo.d.ts +0 -28
- package/esm/stdlib/behavior/collapse-expand-combo.js +0 -35
- package/esm/stdlib/behavior/collapse-expand-combo.js.map +0 -1
- package/esm/stdlib/behavior/collapse-expand-tree.d.ts +0 -44
- package/esm/stdlib/behavior/collapse-expand-tree.js +0 -69
- package/esm/stdlib/behavior/collapse-expand-tree.js.map +0 -1
- package/esm/stdlib/behavior/create-edge.d.ts +0 -57
- package/esm/stdlib/behavior/create-edge.js +0 -207
- package/esm/stdlib/behavior/create-edge.js.map +0 -1
- package/esm/stdlib/behavior/drag-canvas.d.ts +0 -82
- package/esm/stdlib/behavior/drag-canvas.js +0 -281
- package/esm/stdlib/behavior/drag-canvas.js.map +0 -1
- package/esm/stdlib/behavior/drag-combo.d.ts +0 -111
- package/esm/stdlib/behavior/drag-combo.js +0 -391
- package/esm/stdlib/behavior/drag-combo.js.map +0 -1
- package/esm/stdlib/behavior/drag-node.d.ts +0 -100
- package/esm/stdlib/behavior/drag-node.js +0 -452
- package/esm/stdlib/behavior/drag-node.js.map +0 -1
- package/esm/stdlib/behavior/hover-activate.d.ts +0 -42
- package/esm/stdlib/behavior/hover-activate.js +0 -64
- package/esm/stdlib/behavior/hover-activate.js.map +0 -1
- package/esm/stdlib/behavior/index.d.ts +0 -18
- package/esm/stdlib/behavior/index.js +0 -19
- package/esm/stdlib/behavior/index.js.map +0 -1
- package/esm/stdlib/behavior/lasso-select.d.ts +0 -31
- package/esm/stdlib/behavior/lasso-select.js +0 -78
- package/esm/stdlib/behavior/lasso-select.js.map +0 -1
- package/esm/stdlib/behavior/orbit-canvas-3d.d.ts +0 -36
- package/esm/stdlib/behavior/orbit-canvas-3d.js +0 -62
- package/esm/stdlib/behavior/orbit-canvas-3d.js.map +0 -1
- package/esm/stdlib/behavior/rotate-canvas-3d.d.ts +0 -60
- package/esm/stdlib/behavior/rotate-canvas-3d.js +0 -123
- package/esm/stdlib/behavior/rotate-canvas-3d.js.map +0 -1
- package/esm/stdlib/behavior/scroll-canvas.d.ts +0 -67
- package/esm/stdlib/behavior/scroll-canvas.js +0 -266
- package/esm/stdlib/behavior/scroll-canvas.js.map +0 -1
- package/esm/stdlib/behavior/shortcuts-call.d.ts +0 -38
- package/esm/stdlib/behavior/shortcuts-call.js +0 -80
- package/esm/stdlib/behavior/shortcuts-call.js.map +0 -1
- package/esm/stdlib/behavior/track-canvas-3d.d.ts +0 -36
- package/esm/stdlib/behavior/track-canvas-3d.js +0 -62
- package/esm/stdlib/behavior/track-canvas-3d.js.map +0 -1
- package/esm/stdlib/behavior/types.d.ts +0 -13
- package/esm/stdlib/behavior/types.js.map +0 -1
- package/esm/stdlib/behavior/zoom-canvas-3d.d.ts +0 -58
- package/esm/stdlib/behavior/zoom-canvas-3d.js +0 -98
- package/esm/stdlib/behavior/zoom-canvas-3d.js.map +0 -1
- package/esm/stdlib/behavior/zoom-canvas.d.ts +0 -69
- package/esm/stdlib/behavior/zoom-canvas.js +0 -200
- package/esm/stdlib/behavior/zoom-canvas.js.map +0 -1
- package/esm/stdlib/data/index.d.ts +0 -3
- package/esm/stdlib/data/index.js +0 -4
- package/esm/stdlib/data/index.js.map +0 -1
- package/esm/stdlib/data/mapNodeSize.d.ts +0 -12
- package/esm/stdlib/data/mapNodeSize.js +0 -43
- package/esm/stdlib/data/mapNodeSize.js.map +0 -1
- package/esm/stdlib/data/transformV4Data.d.ts +0 -9
- package/esm/stdlib/data/transformV4Data.js +0 -142
- package/esm/stdlib/data/transformV4Data.js.map +0 -1
- package/esm/stdlib/data/validateData.d.ts +0 -9
- package/esm/stdlib/data/validateData.js +0 -103
- package/esm/stdlib/data/validateData.js.map +0 -1
- package/esm/stdlib/index.d.ts +0 -156
- package/esm/stdlib/index.js +0 -211
- package/esm/stdlib/index.js.map +0 -1
- package/esm/stdlib/item/combo/circle.d.ts +0 -29
- package/esm/stdlib/item/combo/circle.js +0 -56
- package/esm/stdlib/item/combo/circle.js.map +0 -1
- package/esm/stdlib/item/combo/index.d.ts +0 -2
- package/esm/stdlib/item/combo/index.js +0 -3
- package/esm/stdlib/item/combo/index.js.map +0 -1
- package/esm/stdlib/item/combo/rect.d.ts +0 -31
- package/esm/stdlib/item/combo/rect.js +0 -65
- package/esm/stdlib/item/combo/rect.js.map +0 -1
- package/esm/stdlib/item/edge/base.d.ts +0 -210
- package/esm/stdlib/item/edge/base.js +0 -448
- package/esm/stdlib/item/edge/base.js.map +0 -1
- package/esm/stdlib/item/edge/cubic-horizontal.d.ts +0 -36
- package/esm/stdlib/item/edge/cubic-horizontal.js +0 -56
- package/esm/stdlib/item/edge/cubic-horizontal.js.map +0 -1
- package/esm/stdlib/item/edge/cubic-vertical.d.ts +0 -36
- package/esm/stdlib/item/edge/cubic-vertical.js +0 -56
- package/esm/stdlib/item/edge/cubic-vertical.js.map +0 -1
- package/esm/stdlib/item/edge/cubic.d.ts +0 -59
- package/esm/stdlib/item/edge/cubic.js +0 -116
- package/esm/stdlib/item/edge/cubic.js.map +0 -1
- package/esm/stdlib/item/edge/index.d.ts +0 -7
- package/esm/stdlib/item/edge/index.js +0 -8
- package/esm/stdlib/item/edge/index.js.map +0 -1
- package/esm/stdlib/item/edge/line.d.ts +0 -33
- package/esm/stdlib/item/edge/line.js +0 -63
- package/esm/stdlib/item/edge/line.js.map +0 -1
- package/esm/stdlib/item/edge/loop.d.ts +0 -32
- package/esm/stdlib/item/edge/loop.js +0 -115
- package/esm/stdlib/item/edge/loop.js.map +0 -1
- package/esm/stdlib/item/edge/polyline.d.ts +0 -45
- package/esm/stdlib/item/edge/polyline.js +0 -92
- package/esm/stdlib/item/edge/polyline.js.map +0 -1
- package/esm/stdlib/item/edge/quadratic.d.ts +0 -40
- package/esm/stdlib/item/edge/quadratic.js +0 -78
- package/esm/stdlib/item/edge/quadratic.js.map +0 -1
- package/esm/stdlib/item/node/base.d.ts +0 -256
- package/esm/stdlib/item/node/base.js +0 -595
- package/esm/stdlib/item/node/base.js.map +0 -1
- package/esm/stdlib/item/node/base3d.d.ts +0 -97
- package/esm/stdlib/item/node/base3d.js +0 -130
- package/esm/stdlib/item/node/base3d.js.map +0 -1
- package/esm/stdlib/item/node/circle.d.ts +0 -30
- package/esm/stdlib/item/node/circle.js +0 -56
- package/esm/stdlib/item/node/circle.js.map +0 -1
- package/esm/stdlib/item/node/diamond.d.ts +0 -32
- package/esm/stdlib/item/node/diamond.js +0 -79
- package/esm/stdlib/item/node/diamond.js.map +0 -1
- package/esm/stdlib/item/node/donut.d.ts +0 -70
- package/esm/stdlib/item/node/donut.js +0 -207
- package/esm/stdlib/item/node/donut.js.map +0 -1
- package/esm/stdlib/item/node/ellipse.d.ts +0 -32
- package/esm/stdlib/item/node/ellipse.js +0 -71
- package/esm/stdlib/item/node/ellipse.js.map +0 -1
- package/esm/stdlib/item/node/hexagon.d.ts +0 -33
- package/esm/stdlib/item/node/hexagon.js +0 -109
- package/esm/stdlib/item/node/hexagon.js.map +0 -1
- package/esm/stdlib/item/node/image.d.ts +0 -40
- package/esm/stdlib/item/node/image.js +0 -110
- package/esm/stdlib/item/node/image.js.map +0 -1
- package/esm/stdlib/item/node/index.d.ts +0 -11
- package/esm/stdlib/item/node/index.js +0 -12
- package/esm/stdlib/item/node/index.js.map +0 -1
- package/esm/stdlib/item/node/modelRect.d.ts +0 -61
- package/esm/stdlib/item/node/modelRect.js +0 -186
- package/esm/stdlib/item/node/modelRect.js.map +0 -1
- package/esm/stdlib/item/node/rect.d.ts +0 -32
- package/esm/stdlib/item/node/rect.js +0 -75
- package/esm/stdlib/item/node/rect.js.map +0 -1
- package/esm/stdlib/item/node/sphere.d.ts +0 -33
- package/esm/stdlib/item/node/sphere.js +0 -52
- package/esm/stdlib/item/node/sphere.js.map +0 -1
- package/esm/stdlib/item/node/star.d.ts +0 -34
- package/esm/stdlib/item/node/star.js +0 -115
- package/esm/stdlib/item/node/star.js.map +0 -1
- package/esm/stdlib/item/node/triangle.d.ts +0 -44
- package/esm/stdlib/item/node/triangle.js +0 -177
- package/esm/stdlib/item/node/triangle.js.map +0 -1
- package/esm/stdlib/plugin/fisheye/index.d.ts +0 -130
- package/esm/stdlib/plugin/fisheye/index.js +0 -488
- package/esm/stdlib/plugin/fisheye/index.js.map +0 -1
- package/esm/stdlib/plugin/grid/index.d.ts +0 -36
- package/esm/stdlib/plugin/grid/index.js +0 -81
- package/esm/stdlib/plugin/grid/index.js.map +0 -1
- package/esm/stdlib/plugin/history/combo-command.d.ts +0 -9
- package/esm/stdlib/plugin/history/combo-command.js +0 -21
- package/esm/stdlib/plugin/history/combo-command.js.map +0 -1
- package/esm/stdlib/plugin/history/command.d.ts +0 -18
- package/esm/stdlib/plugin/history/command.js +0 -51
- package/esm/stdlib/plugin/history/command.js.map +0 -1
- package/esm/stdlib/plugin/history/index.d.ts +0 -112
- package/esm/stdlib/plugin/history/index.js +0 -275
- package/esm/stdlib/plugin/history/index.js.map +0 -1
- package/esm/stdlib/plugin/history/item-data-command.d.ts +0 -14
- package/esm/stdlib/plugin/history/item-data-command.js +0 -72
- package/esm/stdlib/plugin/history/item-data-command.js.map +0 -1
- package/esm/stdlib/plugin/history/layer-updated-command.d.ts +0 -9
- package/esm/stdlib/plugin/history/layer-updated-command.js +0 -21
- package/esm/stdlib/plugin/history/layer-updated-command.js.map +0 -1
- package/esm/stdlib/plugin/history/state-updated-command.d.ts +0 -9
- package/esm/stdlib/plugin/history/state-updated-command.js +0 -20
- package/esm/stdlib/plugin/history/state-updated-command.js.map +0 -1
- package/esm/stdlib/plugin/history/visibility-updated-command.d.ts +0 -10
- package/esm/stdlib/plugin/history/visibility-updated-command.js +0 -23
- package/esm/stdlib/plugin/history/visibility-updated-command.js.map +0 -1
- package/esm/stdlib/plugin/hull/bubbleset.d.ts +0 -9
- package/esm/stdlib/plugin/hull/bubbleset.js +0 -592
- package/esm/stdlib/plugin/hull/bubbleset.js.map +0 -1
- package/esm/stdlib/plugin/hull/convexHull.d.ts +0 -14
- package/esm/stdlib/plugin/hull/convexHull.js +0 -56
- package/esm/stdlib/plugin/hull/convexHull.js.map +0 -1
- package/esm/stdlib/plugin/hull/hullComponent.d.ts +0 -87
- package/esm/stdlib/plugin/hull/hullComponent.js +0 -379
- package/esm/stdlib/plugin/hull/hullComponent.js.map +0 -1
- package/esm/stdlib/plugin/hull/index.d.ts +0 -59
- package/esm/stdlib/plugin/hull/index.js +0 -161
- package/esm/stdlib/plugin/hull/index.js.map +0 -1
- package/esm/stdlib/plugin/hull/types.d.ts +0 -15
- package/esm/stdlib/plugin/hull/types.js.map +0 -1
- package/esm/stdlib/plugin/hull/util.d.ts +0 -77
- package/esm/stdlib/plugin/hull/util.js +0 -401
- package/esm/stdlib/plugin/hull/util.js.map +0 -1
- package/esm/stdlib/plugin/index.d.ts +0 -10
- package/esm/stdlib/plugin/index.js +0 -11
- package/esm/stdlib/plugin/index.js.map +0 -1
- package/esm/stdlib/plugin/legend/index.d.ts +0 -163
- package/esm/stdlib/plugin/legend/index.js +0 -594
- package/esm/stdlib/plugin/legend/index.js.map +0 -1
- package/esm/stdlib/plugin/menu/index.d.ts +0 -55
- package/esm/stdlib/plugin/menu/index.js +0 -237
- package/esm/stdlib/plugin/menu/index.js.map +0 -1
- package/esm/stdlib/plugin/minimap/index.d.ts +0 -118
- package/esm/stdlib/plugin/minimap/index.js +0 -683
- package/esm/stdlib/plugin/minimap/index.js.map +0 -1
- package/esm/stdlib/plugin/snapline/index.d.ts +0 -167
- package/esm/stdlib/plugin/snapline/index.js +0 -1063
- package/esm/stdlib/plugin/snapline/index.js.map +0 -1
- package/esm/stdlib/plugin/timebar/index.d.ts +0 -98
- package/esm/stdlib/plugin/timebar/index.js +0 -303
- package/esm/stdlib/plugin/timebar/index.js.map +0 -1
- package/esm/stdlib/plugin/toolbar/index.d.ts +0 -59
- package/esm/stdlib/plugin/toolbar/index.js +0 -215
- package/esm/stdlib/plugin/toolbar/index.js.map +0 -1
- package/esm/stdlib/plugin/tooltip/index.d.ts +0 -96
- package/esm/stdlib/plugin/tooltip/index.js +0 -378
- package/esm/stdlib/plugin/tooltip/index.js.map +0 -1
- package/esm/stdlib/plugin/types.d.ts +0 -10
- package/esm/stdlib/plugin/types.js.map +0 -1
- package/esm/stdlib/selector/lasso.d.ts +0 -15
- package/esm/stdlib/selector/lasso.js +0 -61
- package/esm/stdlib/selector/lasso.js.map +0 -1
- package/esm/stdlib/selector/rect.d.ts +0 -16
- package/esm/stdlib/selector/rect.js +0 -54
- package/esm/stdlib/selector/rect.js.map +0 -1
- package/esm/stdlib/theme/dark.d.ts +0 -2
- package/esm/stdlib/theme/dark.js +0 -332
- package/esm/stdlib/theme/dark.js.map +0 -1
- package/esm/stdlib/theme/index.d.ts +0 -2
- package/esm/stdlib/theme/index.js +0 -3
- package/esm/stdlib/theme/index.js.map +0 -1
- package/esm/stdlib/theme/light.d.ts +0 -2
- package/esm/stdlib/theme/light.js +0 -330
- package/esm/stdlib/theme/light.js.map +0 -1
- package/esm/stdlib/themeSolver/base.d.ts +0 -15
- package/esm/stdlib/themeSolver/base.js +0 -11
- package/esm/stdlib/themeSolver/base.js.map +0 -1
- package/esm/stdlib/themeSolver/index.d.ts +0 -3
- package/esm/stdlib/themeSolver/index.js +0 -4
- package/esm/stdlib/themeSolver/index.js.map +0 -1
- package/esm/stdlib/themeSolver/spec.d.ts +0 -35
- package/esm/stdlib/themeSolver/spec.js +0 -66
- package/esm/stdlib/themeSolver/spec.js.map +0 -1
- package/esm/stdlib/themeSolver/subject.d.ts +0 -41
- package/esm/stdlib/themeSolver/subject.js +0 -396
- package/esm/stdlib/themeSolver/subject.js.map +0 -1
- package/esm/types/animate.d.ts +0 -59
- package/esm/types/animate.js +0 -2
- package/esm/types/animate.js.map +0 -1
- package/esm/types/behavior.d.ts +0 -45
- package/esm/types/behavior.js +0 -14
- package/esm/types/behavior.js.map +0 -1
- package/esm/types/common.d.ts +0 -17
- package/esm/types/common.js +0 -2
- package/esm/types/common.js.map +0 -1
- package/esm/types/graph.d.ts +0 -620
- package/esm/types/graph.js.map +0 -1
- package/esm/types/hook.d.ts +0 -144
- package/esm/types/hook.js +0 -2
- package/esm/types/hook.js.map +0 -1
- package/esm/types/item.d.ts +0 -241
- package/esm/types/item.js +0 -16
- package/esm/types/item.js.map +0 -1
- package/esm/types/loop.d.ts +0 -21
- package/esm/types/loop.js +0 -12
- package/esm/types/loop.js.map +0 -1
- package/esm/types/render.d.ts +0 -1
- package/esm/types/render.js +0 -2
- package/esm/types/render.js.map +0 -1
- package/esm/types/spec.d.ts +0 -98
- package/esm/types/spec.js +0 -2
- package/esm/types/spec.js.map +0 -1
- package/esm/types/stdlib.d.ts +0 -13
- package/esm/types/stdlib.js +0 -2
- package/esm/types/stdlib.js.map +0 -1
- package/esm/types/theme.d.ts +0 -168
- package/esm/types/theme.js +0 -14
- package/esm/types/theme.js.map +0 -1
- package/esm/types/view.d.ts +0 -28
- package/esm/types/view.js +0 -2
- package/esm/types/view.js.map +0 -1
- package/esm/util/animate.d.ts +0 -106
- package/esm/util/animate.js +0 -391
- package/esm/util/animate.js.map +0 -1
- package/esm/util/array.d.ts +0 -28
- package/esm/util/array.js +0 -70
- package/esm/util/array.js.map +0 -1
- package/esm/util/arrow.d.ts +0 -17
- package/esm/util/arrow.js +0 -56
- package/esm/util/arrow.js.map +0 -1
- package/esm/util/bbox.d.ts +0 -121
- package/esm/util/bbox.js +0 -284
- package/esm/util/bbox.js.map +0 -1
- package/esm/util/behavior.d.ts +0 -2
- package/esm/util/behavior.js +0 -12
- package/esm/util/behavior.js.map +0 -1
- package/esm/util/canvas.d.ts +0 -19
- package/esm/util/canvas.js +0 -66
- package/esm/util/canvas.js.map +0 -1
- package/esm/util/data.d.ts +0 -96
- package/esm/util/data.js +0 -262
- package/esm/util/data.js.map +0 -1
- package/esm/util/event.d.ts +0 -42
- package/esm/util/event.js +0 -103
- package/esm/util/event.js.map +0 -1
- package/esm/util/extend.d.ts +0 -27
- package/esm/util/extend.js +0 -22
- package/esm/util/extend.js.map +0 -1
- package/esm/util/extension.d.ts +0 -10
- package/esm/util/extension.js +0 -24
- package/esm/util/extension.js.map +0 -1
- package/esm/util/index.d.ts +0 -52
- package/esm/util/index.js +0 -24
- package/esm/util/index.js.map +0 -1
- package/esm/util/item.d.ts +0 -30
- package/esm/util/item.js +0 -90
- package/esm/util/item.js.map +0 -1
- package/esm/util/layout.d.ts +0 -51
- package/esm/util/layout.js +0 -205
- package/esm/util/layout.js.map +0 -1
- package/esm/util/loop.d.ts +0 -37
- package/esm/util/loop.js +0 -104
- package/esm/util/loop.js.map +0 -1
- package/esm/util/mapper.d.ts +0 -17
- package/esm/util/mapper.js +0 -55
- package/esm/util/mapper.js.map +0 -1
- package/esm/util/math.d.ts +0 -23
- package/esm/util/math.js +0 -23
- package/esm/util/math.js.map +0 -1
- package/esm/util/mock.d.ts +0 -30
- package/esm/util/mock.js +0 -69
- package/esm/util/mock.js.map +0 -1
- package/esm/util/path.d.ts +0 -11
- package/esm/util/path.js +0 -44
- package/esm/util/path.js.map +0 -1
- package/esm/util/point.d.ts +0 -83
- package/esm/util/point.js +0 -192
- package/esm/util/point.js.map +0 -1
- package/esm/util/polyline.d.ts +0 -113
- package/esm/util/polyline.js +0 -505
- package/esm/util/polyline.js.map +0 -1
- package/esm/util/router.d.ts +0 -32
- package/esm/util/router.js +0 -383
- package/esm/util/router.js.map +0 -1
- package/esm/util/shape.d.ts +0 -140
- package/esm/util/shape.js +0 -616
- package/esm/util/shape.js.map +0 -1
- package/esm/util/shape3d.d.ts +0 -23
- package/esm/util/shape3d.js +0 -153
- package/esm/util/shape3d.js.map +0 -1
- package/esm/util/text.d.ts +0 -18
- package/esm/util/text.js +0 -36
- package/esm/util/text.js.map +0 -1
- package/esm/util/type.d.ts +0 -8
- package/esm/util/type.js +0 -8
- package/esm/util/type.js.map +0 -1
- package/esm/util/warn.d.ts +0 -14
- package/esm/util/warn.js +0 -4
- package/esm/util/warn.js.map +0 -1
- package/esm/util/zoom.d.ts +0 -17
- package/esm/util/zoom.js +0 -40
- package/esm/util/zoom.js.map +0 -1
- package/lib/api-doc/behaviors.d.ts +0 -2
- package/lib/api-doc/behaviors.js +0 -18
- package/lib/api-doc/behaviors.js.map +0 -1
- package/lib/api-doc/graph.d.ts +0 -4
- package/lib/api-doc/graph.js +0 -11
- package/lib/api-doc/graph.js.map +0 -1
- package/lib/api-doc/item.d.ts +0 -11
- package/lib/api-doc/item.js +0 -25
- package/lib/api-doc/item.js.map +0 -1
- package/lib/api-doc/layout.d.ts +0 -1
- package/lib/api-doc/layout.js.map +0 -1
- package/lib/api-doc/plugins.d.ts +0 -1
- package/lib/api-doc/plugins.js +0 -18
- package/lib/api-doc/plugins.js.map +0 -1
- package/lib/api-doc/types.d.ts +0 -0
- package/lib/api-doc/types.js +0 -3
- package/lib/api-doc/types.js.map +0 -1
- package/lib/api-doc/util.d.ts +0 -3
- package/lib/api-doc/util.js +0 -10
- package/lib/api-doc/util.js.map +0 -1
- package/lib/constant/index.d.ts +0 -1
- package/lib/constant/index.js +0 -18
- package/lib/constant/index.js.map +0 -1
- package/lib/constant/shape.d.ts +0 -23
- package/lib/constant/shape.js +0 -30
- package/lib/constant/shape.js.map +0 -1
- package/lib/item/combo.d.ts +0 -81
- package/lib/item/combo.js +0 -201
- package/lib/item/combo.js.map +0 -1
- package/lib/item/edge.d.ts +0 -74
- package/lib/item/edge.js +0 -204
- package/lib/item/edge.js.map +0 -1
- package/lib/item/item.d.ts +0 -192
- package/lib/item/item.js +0 -714
- package/lib/item/item.js.map +0 -1
- package/lib/item/node.d.ts +0 -64
- package/lib/item/node.js +0 -214
- package/lib/item/node.js.map +0 -1
- package/lib/runtime/controller/data.d.ts +0 -86
- package/lib/runtime/controller/data.js +0 -726
- package/lib/runtime/controller/data.js.map +0 -1
- package/lib/runtime/controller/extension.d.ts +0 -9
- package/lib/runtime/controller/extension.js +0 -15
- package/lib/runtime/controller/extension.js.map +0 -1
- package/lib/runtime/controller/index.d.ts +0 -7
- package/lib/runtime/controller/index.js +0 -24
- package/lib/runtime/controller/index.js.map +0 -1
- package/lib/runtime/controller/interaction.d.ts +0 -52
- package/lib/runtime/controller/interaction.js +0 -278
- package/lib/runtime/controller/interaction.js.map +0 -1
- package/lib/runtime/controller/item.d.ts +0 -144
- package/lib/runtime/controller/item.js +0 -1264
- package/lib/runtime/controller/item.js.map +0 -1
- package/lib/runtime/controller/layout.d.ts +0 -33
- package/lib/runtime/controller/layout.js +0 -327
- package/lib/runtime/controller/layout.js.map +0 -1
- package/lib/runtime/controller/plugin.d.ts +0 -45
- package/lib/runtime/controller/plugin.js +0 -180
- package/lib/runtime/controller/plugin.js.map +0 -1
- package/lib/runtime/controller/theme.d.ts +0 -29
- package/lib/runtime/controller/theme.js +0 -65
- package/lib/runtime/controller/theme.js.map +0 -1
- package/lib/runtime/controller/viewport.d.ts +0 -11
- package/lib/runtime/controller/viewport.js +0 -106
- package/lib/runtime/controller/viewport.js.map +0 -1
- package/lib/runtime/hooks.d.ts +0 -33
- package/lib/runtime/hooks.js +0 -77
- package/lib/runtime/hooks.js.map +0 -1
- package/lib/stdlib/behavior/activate-relations.d.ts +0 -61
- package/lib/stdlib/behavior/activate-relations.js +0 -89
- package/lib/stdlib/behavior/activate-relations.js.map +0 -1
- package/lib/stdlib/behavior/brush-select.d.ts +0 -109
- package/lib/stdlib/behavior/brush-select.js +0 -271
- package/lib/stdlib/behavior/brush-select.js.map +0 -1
- package/lib/stdlib/behavior/click-select.d.ts +0 -73
- package/lib/stdlib/behavior/click-select.js +0 -161
- package/lib/stdlib/behavior/click-select.js.map +0 -1
- package/lib/stdlib/behavior/collapse-expand-combo.d.ts +0 -28
- package/lib/stdlib/behavior/collapse-expand-combo.js +0 -39
- package/lib/stdlib/behavior/collapse-expand-combo.js.map +0 -1
- package/lib/stdlib/behavior/collapse-expand-tree.d.ts +0 -44
- package/lib/stdlib/behavior/collapse-expand-tree.js +0 -73
- package/lib/stdlib/behavior/collapse-expand-tree.js.map +0 -1
- package/lib/stdlib/behavior/create-edge.d.ts +0 -57
- package/lib/stdlib/behavior/create-edge.js +0 -211
- package/lib/stdlib/behavior/create-edge.js.map +0 -1
- package/lib/stdlib/behavior/drag-canvas.d.ts +0 -82
- package/lib/stdlib/behavior/drag-canvas.js +0 -285
- package/lib/stdlib/behavior/drag-canvas.js.map +0 -1
- package/lib/stdlib/behavior/drag-combo.d.ts +0 -111
- package/lib/stdlib/behavior/drag-combo.js +0 -395
- package/lib/stdlib/behavior/drag-combo.js.map +0 -1
- package/lib/stdlib/behavior/drag-node.d.ts +0 -100
- package/lib/stdlib/behavior/drag-node.js +0 -456
- package/lib/stdlib/behavior/drag-node.js.map +0 -1
- package/lib/stdlib/behavior/hover-activate.d.ts +0 -42
- package/lib/stdlib/behavior/hover-activate.js +0 -68
- package/lib/stdlib/behavior/hover-activate.js.map +0 -1
- package/lib/stdlib/behavior/index.d.ts +0 -18
- package/lib/stdlib/behavior/index.js +0 -35
- package/lib/stdlib/behavior/index.js.map +0 -1
- package/lib/stdlib/behavior/lasso-select.d.ts +0 -31
- package/lib/stdlib/behavior/lasso-select.js +0 -82
- package/lib/stdlib/behavior/lasso-select.js.map +0 -1
- package/lib/stdlib/behavior/orbit-canvas-3d.d.ts +0 -36
- package/lib/stdlib/behavior/orbit-canvas-3d.js +0 -66
- package/lib/stdlib/behavior/orbit-canvas-3d.js.map +0 -1
- package/lib/stdlib/behavior/rotate-canvas-3d.d.ts +0 -60
- package/lib/stdlib/behavior/rotate-canvas-3d.js +0 -127
- package/lib/stdlib/behavior/rotate-canvas-3d.js.map +0 -1
- package/lib/stdlib/behavior/scroll-canvas.d.ts +0 -67
- package/lib/stdlib/behavior/scroll-canvas.js +0 -270
- package/lib/stdlib/behavior/scroll-canvas.js.map +0 -1
- package/lib/stdlib/behavior/shortcuts-call.d.ts +0 -38
- package/lib/stdlib/behavior/shortcuts-call.js +0 -84
- package/lib/stdlib/behavior/shortcuts-call.js.map +0 -1
- package/lib/stdlib/behavior/track-canvas-3d.d.ts +0 -36
- package/lib/stdlib/behavior/track-canvas-3d.js +0 -66
- package/lib/stdlib/behavior/track-canvas-3d.js.map +0 -1
- package/lib/stdlib/behavior/types.d.ts +0 -13
- package/lib/stdlib/behavior/types.js.map +0 -1
- package/lib/stdlib/behavior/zoom-canvas-3d.d.ts +0 -58
- package/lib/stdlib/behavior/zoom-canvas-3d.js +0 -102
- package/lib/stdlib/behavior/zoom-canvas-3d.js.map +0 -1
- package/lib/stdlib/behavior/zoom-canvas.d.ts +0 -69
- package/lib/stdlib/behavior/zoom-canvas.js +0 -204
- package/lib/stdlib/behavior/zoom-canvas.js.map +0 -1
- package/lib/stdlib/data/index.d.ts +0 -3
- package/lib/stdlib/data/index.js +0 -20
- package/lib/stdlib/data/index.js.map +0 -1
- package/lib/stdlib/data/mapNodeSize.d.ts +0 -12
- package/lib/stdlib/data/mapNodeSize.js +0 -47
- package/lib/stdlib/data/mapNodeSize.js.map +0 -1
- package/lib/stdlib/data/transformV4Data.d.ts +0 -9
- package/lib/stdlib/data/transformV4Data.js +0 -146
- package/lib/stdlib/data/transformV4Data.js.map +0 -1
- package/lib/stdlib/data/validateData.d.ts +0 -9
- package/lib/stdlib/data/validateData.js +0 -107
- package/lib/stdlib/data/validateData.js.map +0 -1
- package/lib/stdlib/index.d.ts +0 -156
- package/lib/stdlib/index.js +0 -243
- package/lib/stdlib/index.js.map +0 -1
- package/lib/stdlib/item/combo/circle.d.ts +0 -29
- package/lib/stdlib/item/combo/circle.js +0 -60
- package/lib/stdlib/item/combo/circle.js.map +0 -1
- package/lib/stdlib/item/combo/index.d.ts +0 -2
- package/lib/stdlib/item/combo/index.js +0 -19
- package/lib/stdlib/item/combo/index.js.map +0 -1
- package/lib/stdlib/item/combo/rect.d.ts +0 -31
- package/lib/stdlib/item/combo/rect.js +0 -69
- package/lib/stdlib/item/combo/rect.js.map +0 -1
- package/lib/stdlib/item/edge/base.d.ts +0 -210
- package/lib/stdlib/item/edge/base.js +0 -452
- package/lib/stdlib/item/edge/base.js.map +0 -1
- package/lib/stdlib/item/edge/cubic-horizontal.d.ts +0 -36
- package/lib/stdlib/item/edge/cubic-horizontal.js +0 -60
- package/lib/stdlib/item/edge/cubic-horizontal.js.map +0 -1
- package/lib/stdlib/item/edge/cubic-vertical.d.ts +0 -36
- package/lib/stdlib/item/edge/cubic-vertical.js +0 -60
- package/lib/stdlib/item/edge/cubic-vertical.js.map +0 -1
- package/lib/stdlib/item/edge/cubic.d.ts +0 -59
- package/lib/stdlib/item/edge/cubic.js +0 -120
- package/lib/stdlib/item/edge/cubic.js.map +0 -1
- package/lib/stdlib/item/edge/index.d.ts +0 -7
- package/lib/stdlib/item/edge/index.js +0 -24
- package/lib/stdlib/item/edge/index.js.map +0 -1
- package/lib/stdlib/item/edge/line.d.ts +0 -33
- package/lib/stdlib/item/edge/line.js +0 -67
- package/lib/stdlib/item/edge/line.js.map +0 -1
- package/lib/stdlib/item/edge/loop.d.ts +0 -32
- package/lib/stdlib/item/edge/loop.js +0 -119
- package/lib/stdlib/item/edge/loop.js.map +0 -1
- package/lib/stdlib/item/edge/polyline.d.ts +0 -45
- package/lib/stdlib/item/edge/polyline.js +0 -96
- package/lib/stdlib/item/edge/polyline.js.map +0 -1
- package/lib/stdlib/item/edge/quadratic.d.ts +0 -40
- package/lib/stdlib/item/edge/quadratic.js +0 -82
- package/lib/stdlib/item/edge/quadratic.js.map +0 -1
- package/lib/stdlib/item/node/base.d.ts +0 -256
- package/lib/stdlib/item/node/base.js +0 -599
- package/lib/stdlib/item/node/base.js.map +0 -1
- package/lib/stdlib/item/node/base3d.d.ts +0 -97
- package/lib/stdlib/item/node/base3d.js +0 -134
- package/lib/stdlib/item/node/base3d.js.map +0 -1
- package/lib/stdlib/item/node/circle.d.ts +0 -30
- package/lib/stdlib/item/node/circle.js +0 -60
- package/lib/stdlib/item/node/circle.js.map +0 -1
- package/lib/stdlib/item/node/diamond.d.ts +0 -32
- package/lib/stdlib/item/node/diamond.js +0 -83
- package/lib/stdlib/item/node/diamond.js.map +0 -1
- package/lib/stdlib/item/node/donut.d.ts +0 -70
- package/lib/stdlib/item/node/donut.js +0 -211
- package/lib/stdlib/item/node/donut.js.map +0 -1
- package/lib/stdlib/item/node/ellipse.d.ts +0 -32
- package/lib/stdlib/item/node/ellipse.js +0 -75
- package/lib/stdlib/item/node/ellipse.js.map +0 -1
- package/lib/stdlib/item/node/hexagon.d.ts +0 -33
- package/lib/stdlib/item/node/hexagon.js +0 -113
- package/lib/stdlib/item/node/hexagon.js.map +0 -1
- package/lib/stdlib/item/node/image.d.ts +0 -40
- package/lib/stdlib/item/node/image.js +0 -114
- package/lib/stdlib/item/node/image.js.map +0 -1
- package/lib/stdlib/item/node/index.d.ts +0 -11
- package/lib/stdlib/item/node/index.js +0 -28
- package/lib/stdlib/item/node/index.js.map +0 -1
- package/lib/stdlib/item/node/modelRect.d.ts +0 -61
- package/lib/stdlib/item/node/modelRect.js +0 -190
- package/lib/stdlib/item/node/modelRect.js.map +0 -1
- package/lib/stdlib/item/node/rect.d.ts +0 -32
- package/lib/stdlib/item/node/rect.js +0 -79
- package/lib/stdlib/item/node/rect.js.map +0 -1
- package/lib/stdlib/item/node/sphere.d.ts +0 -33
- package/lib/stdlib/item/node/sphere.js +0 -56
- package/lib/stdlib/item/node/sphere.js.map +0 -1
- package/lib/stdlib/item/node/star.d.ts +0 -34
- package/lib/stdlib/item/node/star.js +0 -119
- package/lib/stdlib/item/node/star.js.map +0 -1
- package/lib/stdlib/item/node/triangle.d.ts +0 -44
- package/lib/stdlib/item/node/triangle.js +0 -181
- package/lib/stdlib/item/node/triangle.js.map +0 -1
- package/lib/stdlib/plugin/fisheye/index.d.ts +0 -130
- package/lib/stdlib/plugin/fisheye/index.js +0 -492
- package/lib/stdlib/plugin/fisheye/index.js.map +0 -1
- package/lib/stdlib/plugin/grid/index.d.ts +0 -36
- package/lib/stdlib/plugin/grid/index.js +0 -85
- package/lib/stdlib/plugin/grid/index.js.map +0 -1
- package/lib/stdlib/plugin/history/combo-command.d.ts +0 -9
- package/lib/stdlib/plugin/history/combo-command.js +0 -25
- package/lib/stdlib/plugin/history/combo-command.js.map +0 -1
- package/lib/stdlib/plugin/history/command.d.ts +0 -18
- package/lib/stdlib/plugin/history/command.js +0 -54
- package/lib/stdlib/plugin/history/command.js.map +0 -1
- package/lib/stdlib/plugin/history/index.d.ts +0 -112
- package/lib/stdlib/plugin/history/index.js +0 -283
- package/lib/stdlib/plugin/history/index.js.map +0 -1
- package/lib/stdlib/plugin/history/item-data-command.d.ts +0 -14
- package/lib/stdlib/plugin/history/item-data-command.js +0 -76
- package/lib/stdlib/plugin/history/item-data-command.js.map +0 -1
- package/lib/stdlib/plugin/history/layer-updated-command.d.ts +0 -9
- package/lib/stdlib/plugin/history/layer-updated-command.js +0 -25
- package/lib/stdlib/plugin/history/layer-updated-command.js.map +0 -1
- package/lib/stdlib/plugin/history/state-updated-command.d.ts +0 -9
- package/lib/stdlib/plugin/history/state-updated-command.js +0 -24
- package/lib/stdlib/plugin/history/state-updated-command.js.map +0 -1
- package/lib/stdlib/plugin/history/visibility-updated-command.d.ts +0 -10
- package/lib/stdlib/plugin/history/visibility-updated-command.js +0 -27
- package/lib/stdlib/plugin/history/visibility-updated-command.js.map +0 -1
- package/lib/stdlib/plugin/hull/bubbleset.d.ts +0 -9
- package/lib/stdlib/plugin/hull/bubbleset.js +0 -596
- package/lib/stdlib/plugin/hull/bubbleset.js.map +0 -1
- package/lib/stdlib/plugin/hull/convexHull.d.ts +0 -14
- package/lib/stdlib/plugin/hull/convexHull.js +0 -61
- package/lib/stdlib/plugin/hull/convexHull.js.map +0 -1
- package/lib/stdlib/plugin/hull/hullComponent.d.ts +0 -87
- package/lib/stdlib/plugin/hull/hullComponent.js +0 -382
- package/lib/stdlib/plugin/hull/hullComponent.js.map +0 -1
- package/lib/stdlib/plugin/hull/index.d.ts +0 -59
- package/lib/stdlib/plugin/hull/index.js +0 -167
- package/lib/stdlib/plugin/hull/index.js.map +0 -1
- package/lib/stdlib/plugin/hull/types.d.ts +0 -15
- package/lib/stdlib/plugin/hull/types.js.map +0 -1
- package/lib/stdlib/plugin/hull/util.d.ts +0 -77
- package/lib/stdlib/plugin/hull/util.js +0 -419
- package/lib/stdlib/plugin/hull/util.js.map +0 -1
- package/lib/stdlib/plugin/index.d.ts +0 -10
- package/lib/stdlib/plugin/index.js +0 -27
- package/lib/stdlib/plugin/index.js.map +0 -1
- package/lib/stdlib/plugin/legend/index.d.ts +0 -163
- package/lib/stdlib/plugin/legend/index.js +0 -598
- package/lib/stdlib/plugin/legend/index.js.map +0 -1
- package/lib/stdlib/plugin/menu/index.d.ts +0 -55
- package/lib/stdlib/plugin/menu/index.js +0 -244
- package/lib/stdlib/plugin/menu/index.js.map +0 -1
- package/lib/stdlib/plugin/minimap/index.d.ts +0 -118
- package/lib/stdlib/plugin/minimap/index.js +0 -687
- package/lib/stdlib/plugin/minimap/index.js.map +0 -1
- package/lib/stdlib/plugin/snapline/index.d.ts +0 -167
- package/lib/stdlib/plugin/snapline/index.js +0 -1067
- package/lib/stdlib/plugin/snapline/index.js.map +0 -1
- package/lib/stdlib/plugin/timebar/index.d.ts +0 -98
- package/lib/stdlib/plugin/timebar/index.js +0 -307
- package/lib/stdlib/plugin/timebar/index.js.map +0 -1
- package/lib/stdlib/plugin/toolbar/index.d.ts +0 -59
- package/lib/stdlib/plugin/toolbar/index.js +0 -222
- package/lib/stdlib/plugin/toolbar/index.js.map +0 -1
- package/lib/stdlib/plugin/tooltip/index.d.ts +0 -96
- package/lib/stdlib/plugin/tooltip/index.js +0 -385
- package/lib/stdlib/plugin/tooltip/index.js.map +0 -1
- package/lib/stdlib/plugin/types.d.ts +0 -10
- package/lib/stdlib/plugin/types.js.map +0 -1
- package/lib/stdlib/selector/lasso.d.ts +0 -15
- package/lib/stdlib/selector/lasso.js +0 -63
- package/lib/stdlib/selector/lasso.js.map +0 -1
- package/lib/stdlib/selector/rect.d.ts +0 -16
- package/lib/stdlib/selector/rect.js +0 -56
- package/lib/stdlib/selector/rect.js.map +0 -1
- package/lib/stdlib/theme/dark.d.ts +0 -2
- package/lib/stdlib/theme/dark.js +0 -335
- package/lib/stdlib/theme/dark.js.map +0 -1
- package/lib/stdlib/theme/index.d.ts +0 -2
- package/lib/stdlib/theme/index.js +0 -19
- package/lib/stdlib/theme/index.js.map +0 -1
- package/lib/stdlib/theme/light.d.ts +0 -2
- package/lib/stdlib/theme/light.js +0 -333
- package/lib/stdlib/theme/light.js.map +0 -1
- package/lib/stdlib/themeSolver/base.d.ts +0 -15
- package/lib/stdlib/themeSolver/base.js +0 -15
- package/lib/stdlib/themeSolver/base.js.map +0 -1
- package/lib/stdlib/themeSolver/index.d.ts +0 -3
- package/lib/stdlib/themeSolver/index.js +0 -20
- package/lib/stdlib/themeSolver/index.js.map +0 -1
- package/lib/stdlib/themeSolver/spec.d.ts +0 -35
- package/lib/stdlib/themeSolver/spec.js +0 -70
- package/lib/stdlib/themeSolver/spec.js.map +0 -1
- package/lib/stdlib/themeSolver/subject.d.ts +0 -41
- package/lib/stdlib/themeSolver/subject.js +0 -404
- package/lib/stdlib/themeSolver/subject.js.map +0 -1
- package/lib/types/animate.d.ts +0 -59
- package/lib/types/animate.js +0 -3
- package/lib/types/animate.js.map +0 -1
- package/lib/types/behavior.d.ts +0 -45
- package/lib/types/behavior.js +0 -18
- package/lib/types/behavior.js.map +0 -1
- package/lib/types/common.d.ts +0 -17
- package/lib/types/common.js +0 -3
- package/lib/types/common.js.map +0 -1
- package/lib/types/graph.d.ts +0 -620
- package/lib/types/graph.js.map +0 -1
- package/lib/types/hook.d.ts +0 -144
- package/lib/types/hook.js +0 -3
- package/lib/types/hook.js.map +0 -1
- package/lib/types/item.d.ts +0 -241
- package/lib/types/item.js +0 -19
- package/lib/types/item.js.map +0 -1
- package/lib/types/loop.d.ts +0 -21
- package/lib/types/loop.js +0 -15
- package/lib/types/loop.js.map +0 -1
- package/lib/types/render.d.ts +0 -1
- package/lib/types/render.js +0 -3
- package/lib/types/render.js.map +0 -1
- package/lib/types/spec.d.ts +0 -98
- package/lib/types/spec.js +0 -3
- package/lib/types/spec.js.map +0 -1
- package/lib/types/stdlib.d.ts +0 -13
- package/lib/types/stdlib.js +0 -3
- package/lib/types/stdlib.js.map +0 -1
- package/lib/types/theme.d.ts +0 -168
- package/lib/types/theme.js +0 -18
- package/lib/types/theme.js.map +0 -1
- package/lib/types/view.d.ts +0 -28
- package/lib/types/view.js +0 -3
- package/lib/types/view.js.map +0 -1
- package/lib/util/animate.d.ts +0 -106
- package/lib/util/animate.js +0 -400
- package/lib/util/animate.js.map +0 -1
- package/lib/util/array.d.ts +0 -28
- package/lib/util/array.js +0 -79
- package/lib/util/array.js.map +0 -1
- package/lib/util/arrow.d.ts +0 -17
- package/lib/util/arrow.js +0 -60
- package/lib/util/arrow.js.map +0 -1
- package/lib/util/bbox.d.ts +0 -121
- package/lib/util/bbox.js +0 -304
- package/lib/util/bbox.js.map +0 -1
- package/lib/util/behavior.d.ts +0 -2
- package/lib/util/behavior.js +0 -16
- package/lib/util/behavior.js.map +0 -1
- package/lib/util/canvas.d.ts +0 -19
- package/lib/util/canvas.js +0 -71
- package/lib/util/canvas.js.map +0 -1
- package/lib/util/data.d.ts +0 -96
- package/lib/util/data.js +0 -276
- package/lib/util/data.js.map +0 -1
- package/lib/util/event.d.ts +0 -42
- package/lib/util/event.js +0 -109
- package/lib/util/event.js.map +0 -1
- package/lib/util/extend.d.ts +0 -27
- package/lib/util/extend.js +0 -29
- package/lib/util/extend.js.map +0 -1
- package/lib/util/extension.d.ts +0 -10
- package/lib/util/extension.js +0 -29
- package/lib/util/extension.js.map +0 -1
- package/lib/util/index.d.ts +0 -52
- package/lib/util/index.js +0 -26
- package/lib/util/index.js.map +0 -1
- package/lib/util/item.d.ts +0 -30
- package/lib/util/item.js +0 -96
- package/lib/util/item.js.map +0 -1
- package/lib/util/layout.d.ts +0 -51
- package/lib/util/layout.js +0 -218
- package/lib/util/layout.js.map +0 -1
- package/lib/util/loop.d.ts +0 -37
- package/lib/util/loop.js +0 -111
- package/lib/util/loop.js.map +0 -1
- package/lib/util/mapper.d.ts +0 -17
- package/lib/util/mapper.js +0 -58
- package/lib/util/mapper.js.map +0 -1
- package/lib/util/math.d.ts +0 -23
- package/lib/util/math.js +0 -29
- package/lib/util/math.js.map +0 -1
- package/lib/util/mock.d.ts +0 -30
- package/lib/util/mock.js +0 -73
- package/lib/util/mock.js.map +0 -1
- package/lib/util/path.d.ts +0 -11
- package/lib/util/path.js +0 -49
- package/lib/util/path.js.map +0 -1
- package/lib/util/point.d.ts +0 -83
- package/lib/util/point.js +0 -204
- package/lib/util/point.js.map +0 -1
- package/lib/util/polyline.d.ts +0 -113
- package/lib/util/polyline.js +0 -524
- package/lib/util/polyline.js.map +0 -1
- package/lib/util/router.d.ts +0 -32
- package/lib/util/router.js +0 -387
- package/lib/util/router.js.map +0 -1
- package/lib/util/shape.d.ts +0 -140
- package/lib/util/shape.js +0 -634
- package/lib/util/shape.js.map +0 -1
- package/lib/util/shape3d.d.ts +0 -23
- package/lib/util/shape3d.js +0 -159
- package/lib/util/shape3d.js.map +0 -1
- package/lib/util/text.d.ts +0 -18
- package/lib/util/text.js +0 -41
- package/lib/util/text.js.map +0 -1
- package/lib/util/type.d.ts +0 -8
- package/lib/util/type.js +0 -13
- package/lib/util/type.js.map +0 -1
- package/lib/util/warn.d.ts +0 -14
- package/lib/util/warn.js +0 -8
- package/lib/util/warn.js.map +0 -1
- package/lib/util/zoom.d.ts +0 -17
- package/lib/util/zoom.js +0 -45
- package/lib/util/zoom.js.map +0 -1
- package/src/api-doc/behaviors.ts +0 -2
- package/src/api-doc/graph.ts +0 -4
- package/src/api-doc/item.ts +0 -45
- package/src/api-doc/layout.ts +0 -13
- package/src/api-doc/plugins.ts +0 -1
- package/src/api-doc/types.ts +0 -2
- package/src/api-doc/util.ts +0 -3
- package/src/constant/index.ts +0 -1
- package/src/constant/shape.ts +0 -37
- package/src/item/combo.ts +0 -315
- package/src/item/edge.ts +0 -301
- package/src/item/item.ts +0 -915
- package/src/item/node.ts +0 -358
- package/src/runtime/controller/data.ts +0 -850
- package/src/runtime/controller/extension.ts +0 -14
- package/src/runtime/controller/index.ts +0 -7
- package/src/runtime/controller/interaction.ts +0 -367
- package/src/runtime/controller/item.ts +0 -1775
- package/src/runtime/controller/layout.ts +0 -403
- package/src/runtime/controller/plugin.ts +0 -220
- package/src/runtime/controller/theme.ts +0 -73
- package/src/runtime/controller/viewport.ts +0 -131
- package/src/runtime/hooks.ts +0 -64
- package/src/stdlib/behavior/activate-relations.ts +0 -142
- package/src/stdlib/behavior/brush-select.ts +0 -387
- package/src/stdlib/behavior/click-select.ts +0 -216
- package/src/stdlib/behavior/collapse-expand-combo.ts +0 -57
- package/src/stdlib/behavior/collapse-expand-tree.ts +0 -106
- package/src/stdlib/behavior/create-edge.ts +0 -296
- package/src/stdlib/behavior/drag-canvas.ts +0 -384
- package/src/stdlib/behavior/drag-combo.ts +0 -589
- package/src/stdlib/behavior/drag-node.ts +0 -676
- package/src/stdlib/behavior/hover-activate.ts +0 -102
- package/src/stdlib/behavior/index.ts +0 -18
- package/src/stdlib/behavior/lasso-select.ts +0 -100
- package/src/stdlib/behavior/orbit-canvas-3d.ts +0 -102
- package/src/stdlib/behavior/rotate-canvas-3d.ts +0 -170
- package/src/stdlib/behavior/scroll-canvas.ts +0 -348
- package/src/stdlib/behavior/shortcuts-call.ts +0 -120
- package/src/stdlib/behavior/track-canvas-3d.ts +0 -102
- package/src/stdlib/behavior/types.ts +0 -15
- package/src/stdlib/behavior/zoom-canvas-3d.ts +0 -168
- package/src/stdlib/behavior/zoom-canvas.ts +0 -306
- package/src/stdlib/data/index.ts +0 -3
- package/src/stdlib/data/mapNodeSize.ts +0 -67
- package/src/stdlib/data/transformV4Data.ts +0 -207
- package/src/stdlib/data/validateData.ts +0 -151
- package/src/stdlib/index.ts +0 -295
- package/src/stdlib/item/combo/circle.ts +0 -113
- package/src/stdlib/item/combo/index.ts +0 -2
- package/src/stdlib/item/combo/rect.ts +0 -123
- package/src/stdlib/item/edge/base.ts +0 -735
- package/src/stdlib/item/edge/cubic-horizontal.ts +0 -86
- package/src/stdlib/item/edge/cubic-vertical.ts +0 -85
- package/src/stdlib/item/edge/cubic.ts +0 -198
- package/src/stdlib/item/edge/index.ts +0 -7
- package/src/stdlib/item/edge/line.ts +0 -103
- package/src/stdlib/item/edge/loop.ts +0 -162
- package/src/stdlib/item/edge/polyline.ts +0 -163
- package/src/stdlib/item/edge/quadratic.ts +0 -133
- package/src/stdlib/item/node/base.ts +0 -996
- package/src/stdlib/item/node/base3d.ts +0 -211
- package/src/stdlib/item/node/circle.ts +0 -113
- package/src/stdlib/item/node/diamond.ts +0 -144
- package/src/stdlib/item/node/donut.ts +0 -368
- package/src/stdlib/item/node/ellipse.ts +0 -128
- package/src/stdlib/item/node/hexagon.ts +0 -176
- package/src/stdlib/item/node/image.ts +0 -190
- package/src/stdlib/item/node/index.ts +0 -11
- package/src/stdlib/item/node/modelRect.ts +0 -405
- package/src/stdlib/item/node/rect.ts +0 -141
- package/src/stdlib/item/node/sphere.ts +0 -99
- package/src/stdlib/item/node/star.ts +0 -181
- package/src/stdlib/item/node/triangle.ts +0 -265
- package/src/stdlib/plugin/fisheye/index.ts +0 -607
- package/src/stdlib/plugin/grid/index.ts +0 -125
- package/src/stdlib/plugin/history/combo-command.ts +0 -28
- package/src/stdlib/plugin/history/command.ts +0 -81
- package/src/stdlib/plugin/history/index.ts +0 -347
- package/src/stdlib/plugin/history/item-data-command.ts +0 -114
- package/src/stdlib/plugin/history/layer-updated-command.ts +0 -28
- package/src/stdlib/plugin/history/state-updated-command.ts +0 -36
- package/src/stdlib/plugin/history/visibility-updated-command.ts +0 -41
- package/src/stdlib/plugin/hull/bubbleset.ts +0 -828
- package/src/stdlib/plugin/hull/convexHull.ts +0 -68
- package/src/stdlib/plugin/hull/hullComponent.ts +0 -504
- package/src/stdlib/plugin/hull/index.ts +0 -234
- package/src/stdlib/plugin/hull/types.ts +0 -15
- package/src/stdlib/plugin/hull/util.ts +0 -511
- package/src/stdlib/plugin/index.ts +0 -10
- package/src/stdlib/plugin/legend/index.ts +0 -795
- package/src/stdlib/plugin/menu/index.ts +0 -275
- package/src/stdlib/plugin/minimap/index.ts +0 -808
- package/src/stdlib/plugin/snapline/index.ts +0 -1297
- package/src/stdlib/plugin/timebar/index.ts +0 -473
- package/src/stdlib/plugin/toolbar/index.ts +0 -257
- package/src/stdlib/plugin/tooltip/index.ts +0 -444
- package/src/stdlib/plugin/types.ts +0 -10
- package/src/stdlib/selector/lasso.ts +0 -75
- package/src/stdlib/selector/rect.ts +0 -78
- package/src/stdlib/theme/dark.ts +0 -418
- package/src/stdlib/theme/index.ts +0 -2
- package/src/stdlib/theme/light.ts +0 -413
- package/src/stdlib/themeSolver/base.ts +0 -22
- package/src/stdlib/themeSolver/index.ts +0 -3
- package/src/stdlib/themeSolver/spec.ts +0 -107
- package/src/stdlib/themeSolver/subject.ts +0 -499
- package/src/types/animate.ts +0 -71
- package/src/types/behavior.ts +0 -48
- package/src/types/common.ts +0 -21
- package/src/types/graph.ts +0 -814
- package/src/types/hook.ts +0 -148
- package/src/types/item.ts +0 -348
- package/src/types/loop.ts +0 -23
- package/src/types/render.ts +0 -1
- package/src/types/spec.ts +0 -152
- package/src/types/stdlib.ts +0 -25
- package/src/types/theme.ts +0 -171
- package/src/types/view.ts +0 -36
- package/src/util/animate.ts +0 -477
- package/src/util/array.ts +0 -68
- package/src/util/arrow.ts +0 -62
- package/src/util/bbox.ts +0 -335
- package/src/util/behavior.ts +0 -14
- package/src/util/canvas.ts +0 -87
- package/src/util/data.ts +0 -307
- package/src/util/event.ts +0 -160
- package/src/util/extend.ts +0 -48
- package/src/util/extension.ts +0 -29
- package/src/util/index.ts +0 -34
- package/src/util/item.ts +0 -173
- package/src/util/layout.ts +0 -210
- package/src/util/loop.ts +0 -145
- package/src/util/mapper.ts +0 -62
- package/src/util/math.ts +0 -33
- package/src/util/mock.ts +0 -72
- package/src/util/path.ts +0 -52
- package/src/util/point.ts +0 -231
- package/src/util/polyline.ts +0 -676
- package/src/util/router.ts +0 -561
- package/src/util/shape.ts +0 -764
- package/src/util/shape3d.ts +0 -203
- package/src/util/text.ts +0 -49
- package/src/util/type.ts +0 -11
- package/src/util/warn.ts +0 -20
- package/src/util/zoom.ts +0 -43
- /package/esm/{stdlib/behavior → animations}/types.js +0 -0
- /package/esm/{stdlib/plugin/hull → behaviors}/types.js +0 -0
- /package/esm/{stdlib/plugin → layouts}/types.js +0 -0
- /package/esm/{types → spec}/graph.js +0 -0
- /package/esm/{api-doc → spec}/layout.js +0 -0
- /package/lib/{stdlib/behavior → animations}/types.js +0 -0
- /package/lib/{stdlib/plugin/hull → behaviors}/types.js +0 -0
- /package/lib/{stdlib/plugin → layouts}/types.js +0 -0
- /package/lib/{types → spec}/graph.js +0 -0
- /package/lib/{api-doc → spec}/layout.js +0 -0
package/src/runtime/graph.ts
CHANGED
|
@@ -1,2713 +1,1669 @@
|
|
|
1
1
|
import EventEmitter from '@antv/event-emitter';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
PointLike,
|
|
8
|
-
Rect,
|
|
9
|
-
Cursor,
|
|
10
|
-
} from '@antv/g';
|
|
11
|
-
import { GraphChange, ID } from '@antv/graphlib';
|
|
12
|
-
import {
|
|
13
|
-
clone,
|
|
14
|
-
groupBy,
|
|
15
|
-
isArray,
|
|
16
|
-
isEmpty,
|
|
17
|
-
isEqual,
|
|
18
|
-
isNil,
|
|
19
|
-
isNumber,
|
|
20
|
-
isObject,
|
|
21
|
-
isString,
|
|
22
|
-
map,
|
|
23
|
-
} from '@antv/util';
|
|
24
|
-
import { createDom } from '@antv/dom-util';
|
|
25
|
-
import { History } from '../stdlib/plugin/history';
|
|
26
|
-
import { Command } from '../stdlib/plugin/history/command';
|
|
2
|
+
import type { AABB, BaseStyleProps } from '@antv/g';
|
|
3
|
+
import { debounce, isEqual, isFunction, isNumber, isObject, isString, omit } from '@antv/util';
|
|
4
|
+
import { COMBO_KEY, GraphEvent } from '../constants';
|
|
5
|
+
import type { Plugin } from '../plugins/types';
|
|
6
|
+
import { getExtension } from '../registry';
|
|
27
7
|
import type {
|
|
28
|
-
|
|
29
|
-
|
|
8
|
+
BehaviorOptions,
|
|
9
|
+
ComboData,
|
|
10
|
+
ComboOptions,
|
|
11
|
+
EdgeData,
|
|
12
|
+
EdgeOptions,
|
|
30
13
|
GraphData,
|
|
31
|
-
|
|
32
|
-
NodeUserModel,
|
|
33
|
-
Specification,
|
|
34
|
-
} from '../types';
|
|
35
|
-
import type { CameraAnimationOptions } from '../types/animate';
|
|
36
|
-
import type { BehaviorOptionsOf, BehaviorRegistry } from '../types/behavior';
|
|
37
|
-
import type { ComboDisplayModel, ComboModel } from '../types/combo';
|
|
38
|
-
import type { Bounds, Padding, Point } from '../types/common';
|
|
39
|
-
import type { DataChangeType, DataConfig, GraphCore } from '../types/data';
|
|
40
|
-
import type { EdgeDisplayModel, EdgeModel, EdgeModelData } from '../types/edge';
|
|
41
|
-
import type { StackType } from '../types/history';
|
|
42
|
-
import type { Hooks, ViewportChangeHookParams } from '../types/hook';
|
|
43
|
-
import type { ITEM_TYPE, SHAPE_TYPE, ShapeStyle } from '../types/item';
|
|
44
|
-
import type {
|
|
45
|
-
ImmediatelyInvokedLayoutOptions,
|
|
14
|
+
GraphOptions,
|
|
46
15
|
LayoutOptions,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
16
|
+
NodeData,
|
|
17
|
+
NodeOptions,
|
|
18
|
+
PluginOptions,
|
|
19
|
+
ThemeOptions,
|
|
20
|
+
TransformOptions,
|
|
21
|
+
} from '../spec';
|
|
22
|
+
import type { UpdateBehaviorOption } from '../spec/behavior';
|
|
23
|
+
import type { UpdatePluginOption } from '../spec/plugin';
|
|
24
|
+
import type { UpdateTransformOption } from '../spec/transform';
|
|
51
25
|
import type {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
} from '
|
|
71
|
-
import {
|
|
72
|
-
import
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
{
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
private
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
private defaultSpecification = {
|
|
105
|
-
theme: {
|
|
106
|
-
type: 'spec',
|
|
107
|
-
base: 'light',
|
|
108
|
-
},
|
|
109
|
-
enableStack: true,
|
|
26
|
+
CallableValue,
|
|
27
|
+
DataID,
|
|
28
|
+
EdgeDirection,
|
|
29
|
+
ElementDatum,
|
|
30
|
+
ElementType,
|
|
31
|
+
FitViewOptions,
|
|
32
|
+
ID,
|
|
33
|
+
IEvent,
|
|
34
|
+
NodeLikeData,
|
|
35
|
+
PartialEdgeData,
|
|
36
|
+
PartialGraphData,
|
|
37
|
+
PartialNodeLikeData,
|
|
38
|
+
Point,
|
|
39
|
+
Position,
|
|
40
|
+
State,
|
|
41
|
+
Vector2,
|
|
42
|
+
ViewportAnimationEffectTiming,
|
|
43
|
+
} from '../types';
|
|
44
|
+
import { isCollapsed } from '../utils/collapsibility';
|
|
45
|
+
import { sizeOf } from '../utils/dom';
|
|
46
|
+
import { GraphLifeCycleEvent, emit } from '../utils/event';
|
|
47
|
+
import { idOf } from '../utils/id';
|
|
48
|
+
import { parsePoint, toPointObject } from '../utils/point';
|
|
49
|
+
import { zIndexOf } from '../utils/style';
|
|
50
|
+
import { subtract } from '../utils/vector';
|
|
51
|
+
import { Animation } from './animation';
|
|
52
|
+
import { BatchController } from './batch';
|
|
53
|
+
import { BehaviorController } from './behavior';
|
|
54
|
+
import type { DataURLOptions } from './canvas';
|
|
55
|
+
import { Canvas } from './canvas';
|
|
56
|
+
import type { HierarchyKey } from './data';
|
|
57
|
+
import { DataController } from './data';
|
|
58
|
+
import { ElementController } from './element';
|
|
59
|
+
import { LayoutController } from './layout';
|
|
60
|
+
import { PluginController } from './plugin';
|
|
61
|
+
import { TransformController } from './transform';
|
|
62
|
+
import { RuntimeContext } from './types';
|
|
63
|
+
import { ViewportController } from './viewport';
|
|
64
|
+
|
|
65
|
+
export class Graph extends EventEmitter {
|
|
66
|
+
private options: GraphOptions;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
static defaultOptions: GraphOptions = {
|
|
72
|
+
autoResize: false,
|
|
73
|
+
theme: 'light',
|
|
74
|
+
rotation: 0,
|
|
75
|
+
zoom: 1,
|
|
76
|
+
zoomRange: [0.01, 10],
|
|
110
77
|
};
|
|
111
78
|
|
|
112
|
-
constructor(spec: Specification<B, T>) {
|
|
113
|
-
super();
|
|
114
|
-
|
|
115
|
-
this.specification = Object.assign(
|
|
116
|
-
{},
|
|
117
|
-
this.defaultSpecification,
|
|
118
|
-
this.formatSpecification(spec),
|
|
119
|
-
);
|
|
120
|
-
this.initHooks();
|
|
121
|
-
this.initCanvas();
|
|
122
|
-
this.initControllers();
|
|
123
|
-
this.initHistory();
|
|
124
|
-
|
|
125
|
-
this.hooks.init.emit({
|
|
126
|
-
canvases: {
|
|
127
|
-
background: this.backgroundCanvas,
|
|
128
|
-
main: this.canvas,
|
|
129
|
-
transient: this.transientCanvas,
|
|
130
|
-
},
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
const { data } = spec;
|
|
134
|
-
if (data) {
|
|
135
|
-
// TODO: handle multiple type data configs
|
|
136
|
-
this.read(data as GraphData);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
79
|
/**
|
|
141
|
-
*
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
this.layoutController = new LayoutController(this);
|
|
147
|
-
this.themeController = new ThemeController(this);
|
|
148
|
-
this.itemController = new ItemController(this);
|
|
149
|
-
this.viewportController = new ViewportController(this);
|
|
150
|
-
this.extensionController = new ExtensionController(this);
|
|
151
|
-
this.pluginController = new PluginController(this);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
private initCanvas() {
|
|
155
|
-
const {
|
|
156
|
-
renderer,
|
|
157
|
-
container,
|
|
158
|
-
canvas,
|
|
159
|
-
backgroundCanvas,
|
|
160
|
-
transientCanvas,
|
|
161
|
-
width,
|
|
162
|
-
height,
|
|
163
|
-
} = this.specification;
|
|
164
|
-
|
|
165
|
-
let pixelRatio: number;
|
|
166
|
-
if (renderer && !isString(renderer)) {
|
|
167
|
-
// @ts-ignore
|
|
168
|
-
this.rendererType = renderer.type || 'canvas';
|
|
169
|
-
// @ts-ignore
|
|
170
|
-
pixelRatio = renderer.pixelRatio;
|
|
171
|
-
} else {
|
|
172
|
-
// @ts-ignore
|
|
173
|
-
this.rendererType = renderer || 'canvas';
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* These 3 canvases can be passed in by users, e.g. when doing serverside rendering we can't use DOM API.
|
|
178
|
-
*/
|
|
179
|
-
if (canvas) {
|
|
180
|
-
this.canvas = canvas;
|
|
181
|
-
this.backgroundCanvas = backgroundCanvas;
|
|
182
|
-
this.transientCanvas = transientCanvas;
|
|
183
|
-
this.container = container as HTMLDivElement;
|
|
184
|
-
} else {
|
|
185
|
-
const containerDOM = isString(container)
|
|
186
|
-
? document.getElementById(container as string)
|
|
187
|
-
: (container as HTMLElement);
|
|
80
|
+
* <zh/> 当前图实例是否已经被销毁
|
|
81
|
+
*
|
|
82
|
+
* <en/> Whether the current graph instance has been destroyed
|
|
83
|
+
*/
|
|
84
|
+
public destroyed = false;
|
|
188
85
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
this.destroy();
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
this.container = containerDOM;
|
|
198
|
-
const size = [width, height];
|
|
199
|
-
if (size[0] === undefined) {
|
|
200
|
-
size[0] = containerDOM.scrollWidth;
|
|
201
|
-
}
|
|
202
|
-
if (size[1] === undefined) {
|
|
203
|
-
size[1] = containerDOM.scrollHeight;
|
|
204
|
-
}
|
|
205
|
-
this.backgroundCanvas = createCanvas(
|
|
206
|
-
this.rendererType,
|
|
207
|
-
containerDOM,
|
|
208
|
-
size[0],
|
|
209
|
-
size[1],
|
|
210
|
-
pixelRatio,
|
|
211
|
-
);
|
|
212
|
-
this.canvas = createCanvas(
|
|
213
|
-
this.rendererType,
|
|
214
|
-
containerDOM,
|
|
215
|
-
size[0],
|
|
216
|
-
size[1],
|
|
217
|
-
pixelRatio,
|
|
218
|
-
);
|
|
219
|
-
this.transientCanvas = createCanvas(
|
|
220
|
-
this.rendererType,
|
|
221
|
-
containerDOM,
|
|
222
|
-
size[0],
|
|
223
|
-
size[1],
|
|
224
|
-
pixelRatio,
|
|
225
|
-
);
|
|
226
|
-
}
|
|
86
|
+
// @ts-expect-error will be initialized in createRuntime
|
|
87
|
+
private context: RuntimeContext = {
|
|
88
|
+
model: new DataController(),
|
|
89
|
+
};
|
|
227
90
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
[this.backgroundCanvas, this.canvas, this.transientCanvas].forEach(
|
|
234
|
-
(canvas, i) => {
|
|
235
|
-
const $domElement = canvas
|
|
236
|
-
.getContextService()
|
|
237
|
-
.getDomElement() as unknown as HTMLElement;
|
|
238
|
-
if ($domElement && $domElement.style) {
|
|
239
|
-
$domElement.style.position = 'fixed';
|
|
240
|
-
$domElement.style.outline = 'none';
|
|
241
|
-
$domElement.tabIndex = 1; // Enable keyboard events
|
|
242
|
-
// Transient canvas should let interactive events go through.
|
|
243
|
-
if (i === 2) {
|
|
244
|
-
$domElement.style.pointerEvents = 'none';
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
},
|
|
248
|
-
);
|
|
249
|
-
|
|
250
|
-
this.canvasReady = true;
|
|
251
|
-
});
|
|
252
|
-
}
|
|
91
|
+
constructor(options: GraphOptions) {
|
|
92
|
+
super();
|
|
93
|
+
this.options = Object.assign({}, Graph.defaultOptions, options);
|
|
94
|
+
this.setOptions(this.options);
|
|
95
|
+
this.context.graph = this;
|
|
253
96
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
if (enableStack) {
|
|
257
|
-
const history = {
|
|
258
|
-
type: 'history',
|
|
259
|
-
key: 'history',
|
|
260
|
-
enableStack,
|
|
261
|
-
stackCfg,
|
|
262
|
-
};
|
|
263
|
-
if (!this.specification.plugins) {
|
|
264
|
-
this.specification.plugins = [];
|
|
265
|
-
}
|
|
266
|
-
this.specification.plugins.push(history);
|
|
267
|
-
}
|
|
97
|
+
// Listening window.resize to autoResize.
|
|
98
|
+
this.options.autoResize && window.addEventListener('resize', this.onResize);
|
|
268
99
|
}
|
|
269
100
|
|
|
270
101
|
/**
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
102
|
+
* <zh/> 获取配置项
|
|
103
|
+
*
|
|
104
|
+
* <en/> Get options
|
|
105
|
+
* @returns <zh/> 配置项 | <en/> options
|
|
106
|
+
* @apiCategory option
|
|
274
107
|
*/
|
|
275
|
-
public
|
|
276
|
-
this.
|
|
277
|
-
changeRenderer(this.rendererType, this.canvas);
|
|
108
|
+
public getOptions(): GraphOptions {
|
|
109
|
+
return this.options;
|
|
278
110
|
}
|
|
279
111
|
|
|
280
112
|
/**
|
|
281
|
-
*
|
|
113
|
+
* <zh/> 设置配置项
|
|
114
|
+
*
|
|
115
|
+
* <en/> Set options
|
|
116
|
+
* @param options - <zh/> 配置项 | <en/> options
|
|
117
|
+
* @remarks
|
|
118
|
+
* <zh/> 要更新 devicePixelRatio、container 属性请销毁后重新创建实例
|
|
119
|
+
*
|
|
120
|
+
* <en/> To update devicePixelRatio and container properties, please destroy and recreate the instance
|
|
121
|
+
* @apiCategory option
|
|
282
122
|
*/
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
canvases: {
|
|
287
|
-
background: Canvas;
|
|
288
|
-
main: Canvas;
|
|
289
|
-
transient: Canvas;
|
|
290
|
-
};
|
|
291
|
-
}>({ name: 'init' }),
|
|
292
|
-
datachange: new Hook<{ data: GraphData; type: DataChangeType }>({
|
|
293
|
-
name: 'datachange',
|
|
294
|
-
}),
|
|
295
|
-
itemchange: new Hook<{
|
|
296
|
-
type: ITEM_TYPE;
|
|
297
|
-
changes: GraphChange<NodeModelData, EdgeModelData>[];
|
|
298
|
-
graphCore: GraphCore;
|
|
299
|
-
theme: ThemeSpecification;
|
|
300
|
-
animate?: boolean;
|
|
301
|
-
upsertAncestors?: boolean;
|
|
302
|
-
}>({ name: 'itemchange' }),
|
|
303
|
-
render: new Hook<{
|
|
304
|
-
graphCore: GraphCore;
|
|
305
|
-
theme: ThemeSpecification;
|
|
306
|
-
transientCanvas: Canvas;
|
|
307
|
-
}>({
|
|
308
|
-
name: 'render',
|
|
309
|
-
}),
|
|
310
|
-
layout: new Hook<{
|
|
311
|
-
graphCore: GraphCore;
|
|
312
|
-
options?: LayoutOptions;
|
|
313
|
-
animate?: boolean;
|
|
314
|
-
}>({ name: 'layout' }),
|
|
315
|
-
viewportchange: new Hook<ViewportChangeHookParams>({ name: 'viewport' }),
|
|
316
|
-
modechange: new Hook<{ mode: string }>({ name: 'modechange' }),
|
|
317
|
-
behaviorchange: new Hook<{
|
|
318
|
-
action: 'update' | 'add' | 'remove';
|
|
319
|
-
modes: string[];
|
|
320
|
-
behaviors: (string | BehaviorOptionsOf<{}>)[];
|
|
321
|
-
}>({ name: 'behaviorchange' }),
|
|
322
|
-
itemstatechange: new Hook<{
|
|
323
|
-
ids: ID[];
|
|
324
|
-
states?: string[];
|
|
325
|
-
value?: boolean;
|
|
326
|
-
}>({
|
|
327
|
-
name: 'itemstatechange',
|
|
328
|
-
}),
|
|
329
|
-
itemvisibilitychange: new Hook<{ ids: ID[]; value: boolean }>({
|
|
330
|
-
name: 'itemvisibilitychange',
|
|
331
|
-
}),
|
|
332
|
-
itemzindexchange: new Hook<{
|
|
333
|
-
ids: ID[];
|
|
334
|
-
action: 'front' | 'back';
|
|
335
|
-
graphCore: GraphCore;
|
|
336
|
-
}>({
|
|
337
|
-
name: 'itemzindexchange',
|
|
338
|
-
}),
|
|
339
|
-
transientupdate: new Hook<{
|
|
340
|
-
type: ITEM_TYPE | SHAPE_TYPE;
|
|
341
|
-
id: ID;
|
|
342
|
-
config: {
|
|
343
|
-
style: ShapeStyle;
|
|
344
|
-
action: 'remove' | 'add' | 'update' | undefined;
|
|
345
|
-
};
|
|
346
|
-
canvas: Canvas;
|
|
347
|
-
graphCore: GraphCore;
|
|
348
|
-
}>({ name: 'transientupdate' }),
|
|
349
|
-
pluginchange: new Hook<{
|
|
350
|
-
action: 'update' | 'add' | 'remove';
|
|
351
|
-
plugins: (
|
|
352
|
-
| string
|
|
353
|
-
| { key: string; type: string; [cfgName: string]: unknown }
|
|
354
|
-
)[];
|
|
355
|
-
}>({ name: 'pluginchange' }),
|
|
356
|
-
themechange: new Hook<{
|
|
357
|
-
theme: ThemeSpecification;
|
|
358
|
-
canvases: {
|
|
359
|
-
background: Canvas;
|
|
360
|
-
main: Canvas;
|
|
361
|
-
transient: Canvas;
|
|
362
|
-
};
|
|
363
|
-
}>({ name: 'themechange' }),
|
|
364
|
-
mapperchange: new Hook<{
|
|
365
|
-
type: ITEM_TYPE;
|
|
366
|
-
mapper: NodeMapper | EdgeMapper | ComboMapper;
|
|
367
|
-
}>({ name: 'mapperchange' }),
|
|
368
|
-
treecollapseexpand: new Hook<{
|
|
369
|
-
ids: ID[];
|
|
370
|
-
animate: boolean;
|
|
371
|
-
action: 'collapse' | 'expand';
|
|
372
|
-
graphCore: GraphCore;
|
|
373
|
-
}>({ name: 'treecollapseexpand' }),
|
|
374
|
-
destroy: new Hook<{}>({ name: 'destroy' }),
|
|
375
|
-
};
|
|
376
|
-
}
|
|
123
|
+
public setOptions(options: GraphOptions): void {
|
|
124
|
+
const { background, behaviors, combo, data, edge, height, layout, node, plugins, theme, transforms, width } =
|
|
125
|
+
options;
|
|
377
126
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
127
|
+
Object.assign(this.options, options);
|
|
128
|
+
|
|
129
|
+
if (background) this.setBackground(background);
|
|
130
|
+
if (behaviors) this.setBehaviors(behaviors);
|
|
131
|
+
if (combo) this.setCombo(combo);
|
|
132
|
+
if (data) this.setData(data);
|
|
133
|
+
if (edge) this.setEdge(edge);
|
|
134
|
+
if (layout) this.setLayout(layout);
|
|
135
|
+
if (node) this.setNode(node);
|
|
136
|
+
if (theme) this.setTheme(theme);
|
|
137
|
+
if (plugins) this.setPlugins(plugins);
|
|
138
|
+
if (transforms) this.setTransforms(transforms);
|
|
139
|
+
if (isNumber(width) || isNumber(height))
|
|
140
|
+
this.setSize(width ?? this.options.width ?? 0, height ?? this.options.height ?? 0);
|
|
391
141
|
}
|
|
392
142
|
|
|
393
143
|
/**
|
|
394
|
-
*
|
|
144
|
+
* <zh/> 设置画布背景色
|
|
145
|
+
*
|
|
146
|
+
* <en/> Set canvas background color
|
|
147
|
+
* @param background - <zh/> 背景色 | <en/> background color
|
|
148
|
+
* @apiCategory canvas
|
|
395
149
|
*/
|
|
396
|
-
public
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
this.formatSpecification(spec),
|
|
400
|
-
);
|
|
401
|
-
// TODO: update something
|
|
402
|
-
return newSpec;
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* Update the theme specs (configurations).
|
|
406
|
-
*/
|
|
407
|
-
public updateTheme(theme: ThemeOptionsOf<T>) {
|
|
408
|
-
this.specification.theme = theme;
|
|
409
|
-
// const { specification } = this.themeController;
|
|
410
|
-
// notifiying the themeController
|
|
411
|
-
this.hooks.themechange.emit({
|
|
412
|
-
canvases: {
|
|
413
|
-
background: this.backgroundCanvas,
|
|
414
|
-
main: this.canvas,
|
|
415
|
-
transient: this.transientCanvas,
|
|
416
|
-
},
|
|
417
|
-
});
|
|
418
|
-
// theme is formatted by themeController, notify the item controller to update the items
|
|
419
|
-
this.hooks.themechange.emit({
|
|
420
|
-
theme: this.themeController.specification,
|
|
421
|
-
});
|
|
150
|
+
public setBackground(background: GraphOptions['background']): void {
|
|
151
|
+
this.options.background = background;
|
|
152
|
+
this.context.canvas?.setBackground(background);
|
|
422
153
|
}
|
|
423
154
|
|
|
424
155
|
/**
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
switch (type) {
|
|
434
|
-
case 'node':
|
|
435
|
-
this.specification.node = mapper as NodeMapper;
|
|
436
|
-
break;
|
|
437
|
-
case 'edge':
|
|
438
|
-
this.specification.edge = mapper as EdgeMapper;
|
|
439
|
-
break;
|
|
440
|
-
case 'combo':
|
|
441
|
-
this.specification.combo = mapper as ComboMapper;
|
|
442
|
-
break;
|
|
443
|
-
}
|
|
444
|
-
this.hooks.mapperchange.emit({
|
|
445
|
-
type,
|
|
446
|
-
mapper,
|
|
447
|
-
});
|
|
156
|
+
* <zh/> 获取画布背景色
|
|
157
|
+
*
|
|
158
|
+
* <en/> Get canvas background color
|
|
159
|
+
* @returns <zh/> 背景色 | <en/> background color
|
|
160
|
+
* @apiCategory canvas
|
|
161
|
+
*/
|
|
162
|
+
public getBackground(): GraphOptions['background'] {
|
|
163
|
+
return this.options.background;
|
|
448
164
|
}
|
|
449
165
|
|
|
450
166
|
/**
|
|
451
|
-
*
|
|
452
|
-
*
|
|
167
|
+
* <zh/> 获取当前图容器的大小
|
|
168
|
+
*
|
|
169
|
+
* <en/> Get the size of the current canvas container
|
|
170
|
+
* @returns <zh/> 画布尺寸 | <en/> canvas size
|
|
171
|
+
* @apiCategory canvas
|
|
453
172
|
*/
|
|
454
|
-
public
|
|
455
|
-
return this.
|
|
173
|
+
public getSize(): [number, number] {
|
|
174
|
+
if (this.context.canvas) return this.context.canvas.getSize();
|
|
175
|
+
return [this.options.width || 0, this.options.height || 0];
|
|
456
176
|
}
|
|
457
177
|
|
|
458
178
|
/**
|
|
459
|
-
*
|
|
460
|
-
*
|
|
461
|
-
*
|
|
462
|
-
* @
|
|
463
|
-
* @
|
|
179
|
+
* <zh/> 获取当前图容器的大小
|
|
180
|
+
*
|
|
181
|
+
* <en/> Get the size of the current canvas container
|
|
182
|
+
* @param width - <zh/> 画布宽度 | <en/> canvas width
|
|
183
|
+
* @param height - <zh/> 画布高度 | <en/> canvas height
|
|
184
|
+
* @apiCategory canvas
|
|
464
185
|
*/
|
|
465
|
-
public
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
this.hooks.datachange.emit({ data, type: 'replace' });
|
|
469
|
-
const emitRender = async () => {
|
|
470
|
-
await this.hooks.render.emitLinearAsync({
|
|
471
|
-
graphCore: this.dataController.graphCore,
|
|
472
|
-
theme: this.themeController.specification,
|
|
473
|
-
transientCanvas: this.transientCanvas,
|
|
474
|
-
tileOptimize: {
|
|
475
|
-
tileFirstRender,
|
|
476
|
-
tileFirstRenderSize,
|
|
477
|
-
},
|
|
478
|
-
});
|
|
479
|
-
this.emit('afterrender');
|
|
480
|
-
|
|
481
|
-
this.once('afterlayout', async () => {
|
|
482
|
-
const { autoFit } = this.specification;
|
|
483
|
-
if (autoFit) {
|
|
484
|
-
if (autoFit === 'view') {
|
|
485
|
-
await this.fitView({ rules: { boundsType: 'layout' } });
|
|
486
|
-
} else if (autoFit === 'center') {
|
|
487
|
-
await this.fitCenter('layout');
|
|
488
|
-
} else {
|
|
489
|
-
const { type, effectTiming, ...others } = autoFit;
|
|
490
|
-
if (type === 'view') {
|
|
491
|
-
const { padding, rules } = others as {
|
|
492
|
-
padding: Padding;
|
|
493
|
-
rules: FitViewRules;
|
|
494
|
-
};
|
|
495
|
-
await this.fitView(
|
|
496
|
-
{
|
|
497
|
-
padding,
|
|
498
|
-
rules: {
|
|
499
|
-
...rules,
|
|
500
|
-
boundsType: 'layout',
|
|
501
|
-
},
|
|
502
|
-
},
|
|
503
|
-
effectTiming,
|
|
504
|
-
);
|
|
505
|
-
} else if (type === 'center') {
|
|
506
|
-
await this.fitCenter('layout', effectTiming);
|
|
507
|
-
} else if (type === 'position') {
|
|
508
|
-
// TODO: align
|
|
509
|
-
await this.translateTo((others as any).position, effectTiming);
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
});
|
|
514
|
-
await this.layout();
|
|
515
|
-
};
|
|
516
|
-
if (this.canvasReady) {
|
|
517
|
-
await emitRender();
|
|
518
|
-
} else {
|
|
519
|
-
await Promise.all(
|
|
520
|
-
[this.backgroundCanvas, this.canvas, this.transientCanvas].map(
|
|
521
|
-
(canvas) => canvas.ready,
|
|
522
|
-
),
|
|
523
|
-
);
|
|
524
|
-
await emitRender();
|
|
525
|
-
}
|
|
186
|
+
public setSize(width: number, height: number): void {
|
|
187
|
+
Object.assign(this.options, { width, height });
|
|
188
|
+
this.context.canvas?.resize(width, height);
|
|
526
189
|
}
|
|
527
190
|
|
|
528
191
|
/**
|
|
529
|
-
*
|
|
530
|
-
*
|
|
531
|
-
*
|
|
532
|
-
* @
|
|
533
|
-
* @
|
|
534
|
-
*/
|
|
535
|
-
public
|
|
536
|
-
|
|
537
|
-
type: 'replace' | 'mergeReplace' = 'mergeReplace',
|
|
538
|
-
) {
|
|
539
|
-
const { tileFirstRender, tileFirstRenderSize } =
|
|
540
|
-
this.specification.optimize || {};
|
|
541
|
-
this.hooks.datachange.emit({ data, type });
|
|
542
|
-
this.hooks.render.emit({
|
|
543
|
-
graphCore: this.dataController.graphCore,
|
|
544
|
-
theme: this.themeController.specification,
|
|
545
|
-
transientCanvas: this.transientCanvas,
|
|
546
|
-
tileOptimize: {
|
|
547
|
-
tileFirstRender,
|
|
548
|
-
tileFirstRenderSize,
|
|
549
|
-
},
|
|
550
|
-
});
|
|
551
|
-
this.emit('afterrender');
|
|
552
|
-
|
|
553
|
-
await this.layout();
|
|
192
|
+
* <zh/> 获取当前图的缩放区间
|
|
193
|
+
*
|
|
194
|
+
* <en/> Get the zoom range of the current graph
|
|
195
|
+
* @param zoomRange - <zh/> 缩放区间 | <en/> zoom range
|
|
196
|
+
* @apiCategory viewport
|
|
197
|
+
*/
|
|
198
|
+
public setZoomRange(zoomRange: GraphOptions['zoomRange']): void {
|
|
199
|
+
this.options.zoomRange = zoomRange;
|
|
554
200
|
}
|
|
555
201
|
|
|
556
202
|
/**
|
|
557
|
-
*
|
|
558
|
-
*
|
|
203
|
+
* <zh/> 获取当前图的缩放区间
|
|
204
|
+
*
|
|
205
|
+
* <en/> Get the zoom range of the current graph
|
|
206
|
+
* @returns <zh/> 缩放区间 | <en/> zoom range
|
|
207
|
+
* @apiCategory viewport
|
|
559
208
|
*/
|
|
560
|
-
public
|
|
561
|
-
this.
|
|
562
|
-
this.removeData(
|
|
563
|
-
'edge',
|
|
564
|
-
this.getAllEdgesData().map((edge) => edge.id),
|
|
565
|
-
);
|
|
566
|
-
this.removeData(
|
|
567
|
-
'node',
|
|
568
|
-
this.getAllNodesData().map((node) => node.id),
|
|
569
|
-
);
|
|
570
|
-
this.removeData(
|
|
571
|
-
'combo',
|
|
572
|
-
this.getAllCombosData().map((combo) => combo.id),
|
|
573
|
-
);
|
|
574
|
-
this.stopHistoryBatch();
|
|
209
|
+
public getZoomRange(): GraphOptions['zoomRange'] {
|
|
210
|
+
return this.options.zoomRange;
|
|
575
211
|
}
|
|
576
212
|
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
):
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
transform: options,
|
|
588
|
-
effectTiming,
|
|
589
|
-
tileLodSize,
|
|
590
|
-
});
|
|
591
|
-
this.emit('viewportchange', options);
|
|
213
|
+
/**
|
|
214
|
+
* <zh/> 设置节点样式映射
|
|
215
|
+
*
|
|
216
|
+
* <en/> Set node mapper
|
|
217
|
+
* @param node - <zh/> 节点配置 | <en/> node configuration
|
|
218
|
+
* @apiCategory element
|
|
219
|
+
*/
|
|
220
|
+
public setNode(node: NodeOptions): void {
|
|
221
|
+
this.options.node = node;
|
|
222
|
+
this.context.model.refreshData();
|
|
592
223
|
}
|
|
593
224
|
|
|
594
225
|
/**
|
|
595
|
-
*
|
|
226
|
+
* <zh/> 设置边样式映射
|
|
227
|
+
*
|
|
228
|
+
* <en/> Set edge mapper
|
|
229
|
+
* @param edge - <zh/> 边配置 | <en/> edge configuration
|
|
230
|
+
* @apiCategory element
|
|
596
231
|
*/
|
|
597
|
-
public
|
|
598
|
-
this.
|
|
232
|
+
public setEdge(edge: EdgeOptions): void {
|
|
233
|
+
this.options.edge = edge;
|
|
234
|
+
this.context.model.refreshData();
|
|
599
235
|
}
|
|
600
236
|
|
|
601
237
|
/**
|
|
602
|
-
*
|
|
603
|
-
*
|
|
604
|
-
*
|
|
605
|
-
* @param
|
|
238
|
+
* <zh/> 设置组合样式映射
|
|
239
|
+
*
|
|
240
|
+
* <en/> Set combo mapper
|
|
241
|
+
* @param combo - <zh/> 组合配置 | <en/> combo configuration
|
|
242
|
+
* @apiCategory element
|
|
606
243
|
*/
|
|
607
|
-
public
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
dy: number;
|
|
611
|
-
dz: number;
|
|
612
|
-
}>,
|
|
613
|
-
effectTiming?: CameraAnimationOptions,
|
|
614
|
-
) {
|
|
615
|
-
await this.transform(
|
|
616
|
-
{
|
|
617
|
-
translate: distance,
|
|
618
|
-
},
|
|
619
|
-
effectTiming,
|
|
620
|
-
);
|
|
244
|
+
public setCombo(combo: ComboOptions): void {
|
|
245
|
+
this.options.combo = combo;
|
|
246
|
+
this.context.model.refreshData();
|
|
621
247
|
}
|
|
622
248
|
|
|
623
249
|
/**
|
|
624
|
-
*
|
|
625
|
-
*
|
|
626
|
-
*
|
|
250
|
+
* <zh/> 获取主题
|
|
251
|
+
*
|
|
252
|
+
* <en/> Get theme
|
|
253
|
+
* @returns <zh/> 主题配置 | <en/> theme configuration
|
|
254
|
+
* @apiCategory theme
|
|
627
255
|
*/
|
|
628
|
-
public
|
|
629
|
-
|
|
630
|
-
effectTiming?: CameraAnimationOptions,
|
|
631
|
-
) {
|
|
632
|
-
const { x: cx, y: cy } = this.getViewportCenter();
|
|
633
|
-
await this.translate({ dx: cx - x, dy: cy - y }, effectTiming);
|
|
256
|
+
public getTheme(): ThemeOptions {
|
|
257
|
+
return this.options.theme!;
|
|
634
258
|
}
|
|
635
259
|
|
|
636
260
|
/**
|
|
637
|
-
*
|
|
638
|
-
*
|
|
639
|
-
*
|
|
640
|
-
* @param
|
|
261
|
+
* <zh/> 设置主题
|
|
262
|
+
*
|
|
263
|
+
* <en/> Set theme
|
|
264
|
+
* @param theme - <zh/> 主题配置 | <en/> theme configuration
|
|
265
|
+
* @apiCategory theme
|
|
641
266
|
*/
|
|
642
|
-
public
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
zoom: {
|
|
650
|
-
ratio,
|
|
651
|
-
},
|
|
652
|
-
origin,
|
|
653
|
-
},
|
|
654
|
-
effectTiming,
|
|
655
|
-
);
|
|
267
|
+
public setTheme(theme: CallableValue<ThemeOptions>): void {
|
|
268
|
+
this.options.theme = isFunction(theme) ? theme(this.getTheme()) : theme;
|
|
269
|
+
|
|
270
|
+
const { background } = getExtension('theme', this.options.theme) || {};
|
|
271
|
+
if (background && !this.options.background) {
|
|
272
|
+
this.setBackground(background);
|
|
273
|
+
}
|
|
656
274
|
}
|
|
657
275
|
|
|
658
276
|
/**
|
|
659
|
-
*
|
|
660
|
-
*
|
|
661
|
-
*
|
|
662
|
-
* @param
|
|
277
|
+
* <zh/> 设置布局
|
|
278
|
+
*
|
|
279
|
+
* <en/> Set layout
|
|
280
|
+
* @param layout - <zh/> 布局配置 | <en/> layout configuration
|
|
281
|
+
* @apiCategory layout
|
|
663
282
|
*/
|
|
664
|
-
public
|
|
665
|
-
|
|
666
|
-
origin?: PointLike,
|
|
667
|
-
effectTiming?: CameraAnimationOptions,
|
|
668
|
-
) {
|
|
669
|
-
await this.zoom(
|
|
670
|
-
zoom / this.canvas.getCamera().getZoom(),
|
|
671
|
-
origin,
|
|
672
|
-
effectTiming,
|
|
673
|
-
);
|
|
283
|
+
public setLayout(layout: CallableValue<LayoutOptions>): void {
|
|
284
|
+
this.options.layout = isFunction(layout) ? layout(this.getLayout()) : layout;
|
|
674
285
|
}
|
|
675
286
|
|
|
676
287
|
/**
|
|
677
|
-
*
|
|
678
|
-
*
|
|
288
|
+
* <zh/> 获取布局
|
|
289
|
+
*
|
|
290
|
+
* <en/> Get layout
|
|
291
|
+
* @returns <zh/> 布局配置 | <en/> layout configuration
|
|
292
|
+
* @apiCategory layout
|
|
679
293
|
*/
|
|
680
|
-
public
|
|
681
|
-
return this.
|
|
294
|
+
public getLayout(): LayoutOptions {
|
|
295
|
+
return this.options.layout!;
|
|
682
296
|
}
|
|
683
297
|
|
|
684
298
|
/**
|
|
685
|
-
*
|
|
686
|
-
*
|
|
687
|
-
*
|
|
688
|
-
* @param
|
|
299
|
+
* <zh/> 设置交互
|
|
300
|
+
*
|
|
301
|
+
* <en/> Set behaviors
|
|
302
|
+
* @param behaviors - <zh/> 交互配置 | <en/> behavior configuration
|
|
303
|
+
* @apiCategory behavior
|
|
689
304
|
*/
|
|
690
|
-
public
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
effectTiming?: CameraAnimationOptions,
|
|
694
|
-
) {
|
|
695
|
-
await this.transform(
|
|
696
|
-
{
|
|
697
|
-
rotate: {
|
|
698
|
-
angle,
|
|
699
|
-
},
|
|
700
|
-
origin,
|
|
701
|
-
},
|
|
702
|
-
effectTiming,
|
|
703
|
-
);
|
|
305
|
+
public setBehaviors(behaviors: CallableValue<BehaviorOptions>): void {
|
|
306
|
+
this.options.behaviors = isFunction(behaviors) ? behaviors(this.getBehaviors()) : behaviors;
|
|
307
|
+
this.context.behavior?.setBehaviors(this.options.behaviors);
|
|
704
308
|
}
|
|
705
309
|
|
|
706
310
|
/**
|
|
707
|
-
*
|
|
708
|
-
*
|
|
709
|
-
*
|
|
710
|
-
* @param
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
311
|
+
* <zh/> 更新交互
|
|
312
|
+
*
|
|
313
|
+
* <en/> Update behavior
|
|
314
|
+
* @param behavior - <zh/> 交互配置 | <en/> behavior configuration
|
|
315
|
+
* @apiCategory behavior
|
|
316
|
+
*/
|
|
317
|
+
public updateBehavior(behavior: UpdateBehaviorOption): void {
|
|
318
|
+
this.setBehaviors((behaviors) =>
|
|
319
|
+
behaviors.map((_behavior) => {
|
|
320
|
+
if (isObject(_behavior) && _behavior.key === behavior.key) {
|
|
321
|
+
return { ..._behavior, ...behavior };
|
|
322
|
+
}
|
|
323
|
+
return _behavior;
|
|
324
|
+
}),
|
|
721
325
|
);
|
|
722
326
|
}
|
|
723
327
|
|
|
724
328
|
/**
|
|
725
|
-
*
|
|
726
|
-
*
|
|
727
|
-
*
|
|
728
|
-
* @
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
rules?: FitViewRules;
|
|
734
|
-
},
|
|
735
|
-
effectTiming?: CameraAnimationOptions,
|
|
736
|
-
) {
|
|
737
|
-
const { padding, rules } = options || {};
|
|
738
|
-
const [top, right, bottom, left] = padding
|
|
739
|
-
? formatPadding(padding)
|
|
740
|
-
: [0, 0, 0, 0];
|
|
741
|
-
const {
|
|
742
|
-
direction = 'both',
|
|
743
|
-
ratioRule = 'min',
|
|
744
|
-
boundsType = 'render',
|
|
745
|
-
} = rules || {};
|
|
746
|
-
|
|
747
|
-
const {
|
|
748
|
-
center: [graphCenterX, graphCenterY],
|
|
749
|
-
halfExtents,
|
|
750
|
-
} =
|
|
751
|
-
boundsType === 'render'
|
|
752
|
-
? // Get the bounds of the whole graph content.
|
|
753
|
-
this.canvas.document.documentElement.getBounds()
|
|
754
|
-
: // Get the bounds of the nodes positions while the graph content is not ready.
|
|
755
|
-
getLayoutBounds(this);
|
|
756
|
-
const origin = this.canvas.canvas2Viewport({
|
|
757
|
-
x: graphCenterX,
|
|
758
|
-
y: graphCenterY,
|
|
759
|
-
});
|
|
760
|
-
const { width: viewportWidth, height: viewportHeight } =
|
|
761
|
-
this.canvas.getConfig();
|
|
762
|
-
|
|
763
|
-
const graphWidth = halfExtents[0] * 2;
|
|
764
|
-
const graphHeight = halfExtents[1] * 2;
|
|
765
|
-
const tlInCanvas = this.canvas.viewport2Canvas({ x: left, y: top });
|
|
766
|
-
const brInCanvas = this.canvas.viewport2Canvas({
|
|
767
|
-
x: viewportWidth! - right,
|
|
768
|
-
y: viewportHeight! - bottom,
|
|
769
|
-
});
|
|
770
|
-
|
|
771
|
-
const targetViewWidth = brInCanvas.x - tlInCanvas.x;
|
|
772
|
-
const targetViewHeight = brInCanvas.y - tlInCanvas.y;
|
|
773
|
-
|
|
774
|
-
const wRatio = targetViewWidth / graphWidth;
|
|
775
|
-
const hRatio = targetViewHeight / graphHeight;
|
|
776
|
-
|
|
777
|
-
let ratio: number;
|
|
778
|
-
if (direction === 'x') {
|
|
779
|
-
ratio = wRatio;
|
|
780
|
-
} else if (direction === 'y') {
|
|
781
|
-
ratio = hRatio;
|
|
782
|
-
} else {
|
|
783
|
-
ratio =
|
|
784
|
-
ratioRule === 'max'
|
|
785
|
-
? Math.max(wRatio, hRatio)
|
|
786
|
-
: Math.min(wRatio, hRatio);
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
await this.transform(
|
|
790
|
-
{
|
|
791
|
-
translate: {
|
|
792
|
-
dx: viewportWidth! / 2 - origin.x,
|
|
793
|
-
dy: viewportHeight! / 2 - origin.y,
|
|
794
|
-
},
|
|
795
|
-
zoom: {
|
|
796
|
-
ratio,
|
|
797
|
-
},
|
|
798
|
-
},
|
|
799
|
-
effectTiming,
|
|
800
|
-
);
|
|
329
|
+
* <zh/> 获取交互
|
|
330
|
+
*
|
|
331
|
+
* <en/> Get behaviors
|
|
332
|
+
* @returns <zh/> 交互配置 | <en/> behavior configuration
|
|
333
|
+
* @apiCategory behavior
|
|
334
|
+
*/
|
|
335
|
+
public getBehaviors(): BehaviorOptions {
|
|
336
|
+
return this.options.behaviors || [];
|
|
801
337
|
}
|
|
338
|
+
|
|
802
339
|
/**
|
|
803
|
-
*
|
|
804
|
-
*
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
) {
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
} =
|
|
813
|
-
boundsType === 'render'
|
|
814
|
-
? // Get the bounds of the whole graph content.
|
|
815
|
-
this.canvas.document.documentElement.getBounds()
|
|
816
|
-
: // Get the bounds of the nodes positions while the graph content is not ready.
|
|
817
|
-
getLayoutBounds(this);
|
|
818
|
-
await this.translateTo(
|
|
819
|
-
this.canvas.canvas2Viewport({ x: graphCenterX, y: graphCenterY }),
|
|
820
|
-
effectTiming,
|
|
821
|
-
);
|
|
340
|
+
* <zh/> 设置插件
|
|
341
|
+
*
|
|
342
|
+
* <en/> Set plugins
|
|
343
|
+
* @param plugins - <zh/> 插件配置 | <en/> plugin configuration
|
|
344
|
+
* @apiCategory plugin
|
|
345
|
+
*/
|
|
346
|
+
public setPlugins(plugins: CallableValue<PluginOptions>): void {
|
|
347
|
+
this.options.plugins = isFunction(plugins) ? plugins(this.getPlugins()) : plugins;
|
|
348
|
+
this.context.plugin?.setPlugins(this.options.plugins);
|
|
822
349
|
}
|
|
350
|
+
|
|
823
351
|
/**
|
|
824
|
-
*
|
|
825
|
-
*
|
|
826
|
-
*
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
bounds = itemBounds;
|
|
836
|
-
} else {
|
|
837
|
-
bounds.add(itemBounds);
|
|
352
|
+
* <zh/> 更新插件
|
|
353
|
+
*
|
|
354
|
+
* <en/> Update plugin
|
|
355
|
+
* @param plugin - <zh/> 插件配置 | <en/> plugin configuration
|
|
356
|
+
* @apiCategory plugin
|
|
357
|
+
*/
|
|
358
|
+
public updatePlugin(plugin: UpdatePluginOption): void {
|
|
359
|
+
this.setPlugins((plugins) =>
|
|
360
|
+
plugins.map((_plugin) => {
|
|
361
|
+
if (isObject(_plugin) && _plugin.key === plugin.key) {
|
|
362
|
+
return { ..._plugin, ...plugin };
|
|
838
363
|
}
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
if (bounds) {
|
|
843
|
-
const {
|
|
844
|
-
center: [itemCenterX, itemCenterY],
|
|
845
|
-
} = bounds;
|
|
846
|
-
await this.translateTo(
|
|
847
|
-
this.canvas.canvas2Viewport({ x: itemCenterX, y: itemCenterY }),
|
|
848
|
-
effectTiming,
|
|
849
|
-
);
|
|
850
|
-
}
|
|
364
|
+
return _plugin;
|
|
365
|
+
}),
|
|
366
|
+
);
|
|
851
367
|
}
|
|
852
368
|
|
|
853
369
|
/**
|
|
854
|
-
*
|
|
855
|
-
*
|
|
856
|
-
*
|
|
370
|
+
* <zh/> 获取插件
|
|
371
|
+
*
|
|
372
|
+
* <en/> Get plugins
|
|
373
|
+
* @returns <zh/> 插件配置 | <en/> plugin configuration
|
|
374
|
+
* @apiCategory plugin
|
|
857
375
|
*/
|
|
858
|
-
|
|
859
|
-
return this.
|
|
376
|
+
public getPlugins(): PluginOptions {
|
|
377
|
+
return this.options.plugins || [];
|
|
860
378
|
}
|
|
861
379
|
|
|
862
380
|
/**
|
|
863
|
-
*
|
|
864
|
-
*
|
|
865
|
-
*
|
|
381
|
+
* <zh/> 获取插件实例
|
|
382
|
+
*
|
|
383
|
+
* <en/> Get plugin instance
|
|
384
|
+
* @param key - <zh/> 插件 key | <en/> plugin key
|
|
385
|
+
* @returns <zh/> 插件实例 | <en/> plugin instance
|
|
386
|
+
* @apiCategory plugin
|
|
866
387
|
*/
|
|
867
|
-
public
|
|
868
|
-
|
|
869
|
-
return [width, height];
|
|
388
|
+
public getPluginInstance<T extends Plugin>(key: string) {
|
|
389
|
+
return this.context.plugin!.getPluginInstance(key) as unknown as T;
|
|
870
390
|
}
|
|
871
391
|
|
|
872
392
|
/**
|
|
873
|
-
*
|
|
874
|
-
*
|
|
875
|
-
*
|
|
393
|
+
* <zh/> 设置数据转换器
|
|
394
|
+
*
|
|
395
|
+
* <en/> Set data transforms
|
|
396
|
+
* @param transforms - <zh/> 数据转换配置 | <en/> data transform configuration
|
|
397
|
+
* @apiCategory transform
|
|
876
398
|
*/
|
|
877
|
-
public
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
`Failed to setSize. The parameter size: ${size} is invalid. It must be an array with 2 number elements.`,
|
|
881
|
-
);
|
|
882
|
-
return;
|
|
883
|
-
}
|
|
884
|
-
this.specification.width = size[0];
|
|
885
|
-
this.specification.height = size[1];
|
|
886
|
-
this.canvas.resize(size[0], size[1]);
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
public getCanvasRange(): Bounds {
|
|
890
|
-
const [width, height] = this.getSize();
|
|
891
|
-
const leftTop = this.getCanvasByViewport({ x: 0, y: 0 });
|
|
892
|
-
const rightBottom = this.getCanvasByViewport({ x: width, y: height });
|
|
893
|
-
return {
|
|
894
|
-
min: [leftTop.x, leftTop.y, leftTop.z],
|
|
895
|
-
max: [rightBottom.x, rightBottom.y, rightBottom.z],
|
|
896
|
-
center: [
|
|
897
|
-
(leftTop.x + rightBottom.x) / 2,
|
|
898
|
-
(leftTop.y + rightBottom.y) / 2,
|
|
899
|
-
(leftTop.z + rightBottom.z) / 2,
|
|
900
|
-
],
|
|
901
|
-
halfExtents: [
|
|
902
|
-
(rightBottom.x - leftTop.x) / 2,
|
|
903
|
-
(rightBottom.y - leftTop.y) / 2,
|
|
904
|
-
(rightBottom.z - leftTop.z) / 2,
|
|
905
|
-
],
|
|
906
|
-
};
|
|
399
|
+
public setTransforms(transforms: CallableValue<TransformOptions>): void {
|
|
400
|
+
this.options.transforms = isFunction(transforms) ? transforms(this.getTransforms()) : transforms;
|
|
401
|
+
this.context.transform?.setTransforms(this.options.transforms);
|
|
907
402
|
}
|
|
908
403
|
|
|
909
404
|
/**
|
|
910
|
-
*
|
|
911
|
-
*
|
|
912
|
-
*
|
|
913
|
-
* @
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
405
|
+
* <zh/> 更新数据转换器
|
|
406
|
+
*
|
|
407
|
+
* <en/> Update data transform
|
|
408
|
+
* @param transform - <zh/> 数据转换配置 | <en/> data transform configuration
|
|
409
|
+
* @apiCategory transform
|
|
410
|
+
*/
|
|
411
|
+
public updateTransform(transform: UpdateTransformOption): void {
|
|
412
|
+
this.setTransforms((transforms) =>
|
|
413
|
+
transforms.map((_transform) => {
|
|
414
|
+
if (isObject(_transform) && _transform.key === transform.key) {
|
|
415
|
+
return { ..._transform, ...transform };
|
|
416
|
+
}
|
|
417
|
+
return _transform;
|
|
418
|
+
}),
|
|
419
|
+
);
|
|
420
|
+
this.context.model.refreshData();
|
|
917
421
|
}
|
|
918
422
|
|
|
919
423
|
/**
|
|
920
|
-
*
|
|
921
|
-
*
|
|
922
|
-
*
|
|
923
|
-
* @
|
|
424
|
+
* <zh/> 获取数据转换器
|
|
425
|
+
*
|
|
426
|
+
* <en/> Get data transforms
|
|
427
|
+
* @returns <zh/> 数据转换器实例 | <en/> data transform instance
|
|
428
|
+
* @apiCategory transform
|
|
924
429
|
*/
|
|
925
|
-
public
|
|
926
|
-
return this.
|
|
430
|
+
public getTransforms(): TransformOptions {
|
|
431
|
+
return this.options.transforms || [];
|
|
927
432
|
}
|
|
928
433
|
|
|
929
434
|
/**
|
|
930
|
-
*
|
|
931
|
-
*
|
|
932
|
-
*
|
|
933
|
-
* @
|
|
435
|
+
* <zh/> 获取数据
|
|
436
|
+
*
|
|
437
|
+
* <en/> Get data
|
|
438
|
+
* @returns <zh/> 数据 | <en/> data
|
|
439
|
+
* @apiCategory data
|
|
934
440
|
*/
|
|
935
|
-
public
|
|
936
|
-
|
|
937
|
-
return this.canvas.viewport2Client(viewportPoint as any);
|
|
441
|
+
public getData(): GraphData {
|
|
442
|
+
return this.context.model.getData();
|
|
938
443
|
}
|
|
939
444
|
|
|
940
445
|
/**
|
|
941
|
-
*
|
|
942
|
-
*
|
|
943
|
-
*
|
|
944
|
-
* @
|
|
446
|
+
* <zh/> 获取单个元素数据
|
|
447
|
+
*
|
|
448
|
+
* <en/> Get element data by ID
|
|
449
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
450
|
+
* @returns <zh/> 元素数据 | <en/> element data
|
|
451
|
+
* @apiCategory data
|
|
452
|
+
*/
|
|
453
|
+
public getElementData(id: ID): ElementDatum;
|
|
454
|
+
/**
|
|
455
|
+
* <zh/> 批量获取多个元素数据
|
|
456
|
+
*
|
|
457
|
+
* <en/> Get multiple element data in batch
|
|
458
|
+
* @param ids - <zh/> 元素 ID 数组 | <en/> element ID array
|
|
459
|
+
* @apiCategory data
|
|
945
460
|
*/
|
|
946
|
-
public
|
|
947
|
-
|
|
948
|
-
return this.
|
|
461
|
+
public getElementData(ids: ID[]): ElementDatum[];
|
|
462
|
+
public getElementData(ids: ID | ID[]): ElementDatum | ElementDatum[] {
|
|
463
|
+
if (Array.isArray(ids)) return ids.map((id) => this.context.model.getElementDataById(id));
|
|
464
|
+
return this.context.model.getElementDataById(ids);
|
|
949
465
|
}
|
|
950
466
|
|
|
951
|
-
// ===== item operations =====
|
|
952
467
|
/**
|
|
953
|
-
*
|
|
954
|
-
*
|
|
955
|
-
*
|
|
956
|
-
* @
|
|
468
|
+
* <zh/> 获取所有节点数据
|
|
469
|
+
*
|
|
470
|
+
* <en/> Get all node data
|
|
471
|
+
* @returns <zh/> 节点数据 | <en/> node data
|
|
472
|
+
* @apiCategory data
|
|
957
473
|
*/
|
|
958
|
-
public getNodeData(
|
|
959
|
-
const conds =
|
|
960
|
-
isString(condition) || isNumber(condition) ? [condition] : condition;
|
|
961
|
-
return this.dataController.findData('node', conds)?.[0] as NodeModel;
|
|
962
|
-
}
|
|
474
|
+
public getNodeData(): NodeData[];
|
|
963
475
|
/**
|
|
964
|
-
*
|
|
965
|
-
*
|
|
966
|
-
*
|
|
967
|
-
* @
|
|
476
|
+
* <zh/> 获取单个节点数据
|
|
477
|
+
*
|
|
478
|
+
* <en/> Get single node data
|
|
479
|
+
* @param id - <zh/> 节点 ID | <en/> node ID
|
|
480
|
+
* @returns <zh/> 节点数据 | <en/> node data
|
|
481
|
+
* @apiCategory data
|
|
968
482
|
*/
|
|
969
|
-
public
|
|
970
|
-
const conds =
|
|
971
|
-
isString(condition) || isNumber(condition) || isNumber(condition)
|
|
972
|
-
? [condition]
|
|
973
|
-
: condition;
|
|
974
|
-
return this.dataController.findData('edge', conds)?.[0] as EdgeModel;
|
|
975
|
-
}
|
|
483
|
+
public getNodeData(id: ID): NodeData;
|
|
976
484
|
/**
|
|
977
|
-
*
|
|
978
|
-
*
|
|
979
|
-
*
|
|
980
|
-
* @
|
|
485
|
+
* <zh/> 批量获取多个节点数据
|
|
486
|
+
*
|
|
487
|
+
* <en/> Get multiple node data in batch
|
|
488
|
+
* @param ids - <zh/> 节点 ID 数组 | <en/> node ID array
|
|
489
|
+
* @returns <zh/> 节点数据 | <en/> node data
|
|
490
|
+
* @apiCategory data
|
|
981
491
|
*/
|
|
982
|
-
public
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
return this.
|
|
492
|
+
public getNodeData(ids: ID[]): NodeData[];
|
|
493
|
+
public getNodeData(id?: ID | ID[]): NodeData | NodeData[] {
|
|
494
|
+
if (id === undefined) return this.context.model.getNodeData();
|
|
495
|
+
if (Array.isArray(id)) return this.context.model.getNodeData(id);
|
|
496
|
+
return this.context.model.getNodeData([id])?.[0];
|
|
986
497
|
}
|
|
498
|
+
|
|
987
499
|
/**
|
|
988
|
-
*
|
|
989
|
-
*
|
|
990
|
-
*
|
|
500
|
+
* <zh/> 获取所有边数据
|
|
501
|
+
*
|
|
502
|
+
* <en/> Get all edge data
|
|
503
|
+
* @returns <zh/> 边数据 | <en/> edge data
|
|
504
|
+
* @apiCategory data
|
|
991
505
|
*/
|
|
992
|
-
public
|
|
993
|
-
return this.dataController.findAllData('node') as NodeModel[];
|
|
994
|
-
}
|
|
506
|
+
public getEdgeData(): EdgeData[];
|
|
995
507
|
/**
|
|
996
|
-
*
|
|
997
|
-
*
|
|
998
|
-
*
|
|
508
|
+
* <zh/> 获取单条边数据
|
|
509
|
+
*
|
|
510
|
+
* <en/> Get single edge data
|
|
511
|
+
* @param id - <zh/> 边 ID | <en/> edge ID
|
|
512
|
+
* @returns <zh/> 边数据 | <en/> edge data
|
|
513
|
+
* @apiCategory data
|
|
999
514
|
*/
|
|
1000
|
-
public
|
|
1001
|
-
return this.dataController.findAllData('edge') as EdgeModel[];
|
|
1002
|
-
}
|
|
515
|
+
public getEdgeData(id: ID): EdgeData;
|
|
1003
516
|
/**
|
|
1004
|
-
*
|
|
1005
|
-
*
|
|
1006
|
-
*
|
|
517
|
+
* <zh/> 批量获取多条边数据
|
|
518
|
+
*
|
|
519
|
+
* <en/> Get multiple edge data in batch
|
|
520
|
+
* @param ids - <zh/> 边 ID 数组 | <en/> edge ID array
|
|
521
|
+
* @returns <zh/> 边数据 | <en/> edge data
|
|
522
|
+
* @apiCategory data
|
|
1007
523
|
*/
|
|
1008
|
-
public
|
|
1009
|
-
|
|
524
|
+
public getEdgeData(ids: ID[]): EdgeData[];
|
|
525
|
+
public getEdgeData(id?: ID | ID[]): EdgeData | EdgeData[] {
|
|
526
|
+
if (id === undefined) return this.context.model.getEdgeData();
|
|
527
|
+
if (Array.isArray(id)) return this.context.model.getEdgeData(id);
|
|
528
|
+
return this.context.model.getEdgeData([id])?.[0];
|
|
1010
529
|
}
|
|
530
|
+
|
|
1011
531
|
/**
|
|
1012
|
-
*
|
|
1013
|
-
*
|
|
1014
|
-
*
|
|
1015
|
-
* @
|
|
532
|
+
* <zh/> 获取所有组合数据
|
|
533
|
+
*
|
|
534
|
+
* <en/> Get all combo data
|
|
535
|
+
* @returns <zh/> 组合数据 | <en/> combo data
|
|
536
|
+
* @apiCategory data
|
|
1016
537
|
*/
|
|
1017
|
-
public
|
|
1018
|
-
nodeId: ID,
|
|
1019
|
-
direction: 'in' | 'out' | 'both' = 'both',
|
|
1020
|
-
): EdgeModel[] {
|
|
1021
|
-
return this.dataController.findRelatedEdges(nodeId, direction);
|
|
1022
|
-
}
|
|
538
|
+
public getComboData(): ComboData[];
|
|
1023
539
|
/**
|
|
1024
|
-
*
|
|
1025
|
-
*
|
|
1026
|
-
*
|
|
1027
|
-
* @
|
|
540
|
+
* <zh/> 获取单个组合数据
|
|
541
|
+
*
|
|
542
|
+
* <en/> Get single combo data
|
|
543
|
+
* @param id - <zh/> 组合ID | <en/> combo ID
|
|
544
|
+
* @returns <zh/> 组合数据 | <en/> combo data
|
|
545
|
+
* @apiCategory data
|
|
1028
546
|
*/
|
|
1029
|
-
public
|
|
1030
|
-
nodeId: ID,
|
|
1031
|
-
direction: 'in' | 'out' | 'both' = 'both',
|
|
1032
|
-
): NodeModel[] {
|
|
1033
|
-
return this.dataController.findNeighborNodes(nodeId, direction);
|
|
1034
|
-
}
|
|
547
|
+
public getComboData(id: ID): ComboData;
|
|
1035
548
|
/**
|
|
1036
|
-
*
|
|
1037
|
-
*
|
|
1038
|
-
*
|
|
1039
|
-
* @
|
|
549
|
+
* <zh/> 批量获取多个组合数据
|
|
550
|
+
*
|
|
551
|
+
* <en/> Get multiple combo data in batch
|
|
552
|
+
* @param ids - <zh/> 组合ID 数组 | <en/> combo ID array
|
|
553
|
+
* @returns <zh/> 组合数据 | <en/> combo data
|
|
554
|
+
* @apiCategory data
|
|
1040
555
|
*/
|
|
1041
|
-
public
|
|
1042
|
-
|
|
556
|
+
public getComboData(ids: ID[]): ComboData[];
|
|
557
|
+
public getComboData(id?: ID | ID[]): ComboData | ComboData[] {
|
|
558
|
+
if (id === undefined) return this.context.model.getComboData();
|
|
559
|
+
if (Array.isArray(id)) return this.context.model.getComboData(id);
|
|
560
|
+
return this.context.model.getComboData([id])?.[0];
|
|
1043
561
|
}
|
|
1044
562
|
|
|
1045
|
-
|
|
1046
|
-
*
|
|
1047
|
-
*
|
|
1048
|
-
*
|
|
1049
|
-
* @
|
|
563
|
+
/**
|
|
564
|
+
* <zh/> 设置全量数据
|
|
565
|
+
*
|
|
566
|
+
* <en/> Set full data
|
|
567
|
+
* @param data - <zh/> 数据 | <en/> data
|
|
568
|
+
* @apiCategory data
|
|
1050
569
|
*/
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
): NodeDisplayModel | EdgeDisplayModel | ComboDisplayModel {
|
|
1054
|
-
return this.itemController.findDisplayModel(id);
|
|
570
|
+
public setData(data: CallableValue<GraphData>): void {
|
|
571
|
+
this.context.model.setData(isFunction(data) ? data(this.getData()) : data);
|
|
1055
572
|
}
|
|
1056
573
|
|
|
1057
574
|
/**
|
|
1058
|
-
*
|
|
1059
|
-
*
|
|
1060
|
-
*
|
|
575
|
+
* <zh/> 新增元素数据
|
|
576
|
+
*
|
|
577
|
+
* <en/> Add element data
|
|
578
|
+
* @param data - <zh/> 元素数据 | <en/> element data
|
|
579
|
+
* @apiCategory data
|
|
1061
580
|
*/
|
|
1062
|
-
public
|
|
1063
|
-
|
|
1064
|
-
return this.itemController.findNearEdgesByNode(nodeId, graphCore);
|
|
581
|
+
public addData(data: CallableValue<GraphData>): void {
|
|
582
|
+
this.context.model.addData(isFunction(data) ? data(this.getData()) : data);
|
|
1065
583
|
}
|
|
1066
584
|
|
|
1067
585
|
/**
|
|
1068
|
-
*
|
|
1069
|
-
*
|
|
1070
|
-
*
|
|
1071
|
-
* @param
|
|
1072
|
-
* @
|
|
1073
|
-
* @group Item
|
|
586
|
+
* <zh/> 新增节点数据
|
|
587
|
+
*
|
|
588
|
+
* <en/> Add node data
|
|
589
|
+
* @param data - <zh/> 节点数据 | <en/> node data
|
|
590
|
+
* @apiCategory data
|
|
1074
591
|
*/
|
|
1075
|
-
public
|
|
1076
|
-
|
|
1077
|
-
state: string,
|
|
1078
|
-
value: string | boolean = true,
|
|
1079
|
-
additionalFilter?: (item: NodeModel | EdgeModel | ComboModel) => boolean,
|
|
1080
|
-
): ID[] {
|
|
1081
|
-
let ids = this.itemController.findIdByState(itemType, state, value);
|
|
1082
|
-
if (additionalFilter) {
|
|
1083
|
-
let getDataFunc: any = this.getEdgeData;
|
|
1084
|
-
if (itemType === 'node') getDataFunc = this.getNodeData;
|
|
1085
|
-
else if (itemType === 'combo') getDataFunc = this.getComboData;
|
|
1086
|
-
ids = ids.filter((id) => additionalFilter(getDataFunc(id)));
|
|
1087
|
-
}
|
|
1088
|
-
return ids;
|
|
1089
|
-
}
|
|
1090
|
-
/**
|
|
1091
|
-
* Add one or more node/edge/combo data to the graph.
|
|
1092
|
-
* @param itemType item type
|
|
1093
|
-
* @param model user data
|
|
1094
|
-
* @returns whether success
|
|
1095
|
-
* @group Data
|
|
1096
|
-
*/
|
|
1097
|
-
public addData(
|
|
1098
|
-
itemType: ITEM_TYPE,
|
|
1099
|
-
models:
|
|
1100
|
-
| NodeUserModel
|
|
1101
|
-
| EdgeUserModel
|
|
1102
|
-
| ComboUserModel
|
|
1103
|
-
| NodeUserModel[]
|
|
1104
|
-
| EdgeUserModel[]
|
|
1105
|
-
| ComboUserModel[],
|
|
1106
|
-
):
|
|
1107
|
-
| NodeModel
|
|
1108
|
-
| EdgeModel
|
|
1109
|
-
| ComboModel
|
|
1110
|
-
| NodeModel[]
|
|
1111
|
-
| EdgeModel[]
|
|
1112
|
-
| ComboModel[] {
|
|
1113
|
-
// data controller and item controller subscribe additem in order
|
|
1114
|
-
|
|
1115
|
-
const { graphCore } = this.dataController;
|
|
1116
|
-
const { specification } = this.themeController;
|
|
1117
|
-
graphCore.once('changed', (event) => {
|
|
1118
|
-
if (!event.changes.length) return;
|
|
1119
|
-
const changes = event.changes;
|
|
1120
|
-
const timingParameters = {
|
|
1121
|
-
type: itemType,
|
|
1122
|
-
action: 'add',
|
|
1123
|
-
models,
|
|
1124
|
-
apiName: 'addData',
|
|
1125
|
-
changes,
|
|
1126
|
-
};
|
|
1127
|
-
this.emit('beforeitemchange', timingParameters);
|
|
1128
|
-
this.hooks.itemchange.emit({
|
|
1129
|
-
type: itemType,
|
|
1130
|
-
changes: graphCore.reduceChanges(event.changes),
|
|
1131
|
-
graphCore,
|
|
1132
|
-
theme: specification,
|
|
1133
|
-
});
|
|
1134
|
-
this.emit('afteritemchange', timingParameters);
|
|
1135
|
-
});
|
|
1136
|
-
|
|
1137
|
-
const modelArr = isArray(models) ? models : [models];
|
|
1138
|
-
const data = { nodes: [], edges: [], combos: [] };
|
|
1139
|
-
data[`${itemType}s`] = modelArr;
|
|
1140
|
-
this.hooks.datachange.emit({
|
|
1141
|
-
data,
|
|
1142
|
-
type: 'union',
|
|
1143
|
-
});
|
|
1144
|
-
const dataList = this.dataController.findData(
|
|
1145
|
-
itemType,
|
|
1146
|
-
modelArr.map((model) => model.id),
|
|
1147
|
-
);
|
|
1148
|
-
return isArray(models) ? dataList : dataList[0];
|
|
1149
|
-
}
|
|
1150
|
-
/**
|
|
1151
|
-
* Remove one or more node/edge/combo data from the graph.
|
|
1152
|
-
* @param item the item to be removed
|
|
1153
|
-
* @returns whether success
|
|
1154
|
-
* @group Data
|
|
1155
|
-
*/
|
|
1156
|
-
public removeData(itemType: ITEM_TYPE, ids: ID | ID[]) {
|
|
1157
|
-
const idArr = isArray(ids) ? ids : [ids];
|
|
1158
|
-
const data = { nodes: [], edges: [], combos: [] };
|
|
1159
|
-
const { graphCore } = this.dataController;
|
|
1160
|
-
const { specification } = this.themeController;
|
|
1161
|
-
const getItem = itemType === 'edge' ? graphCore.getEdge : graphCore.getNode;
|
|
1162
|
-
const hasItem = itemType === 'edge' ? graphCore.hasEdge : graphCore.hasNode;
|
|
1163
|
-
data[`${itemType}s`] = idArr
|
|
1164
|
-
.map((id) => {
|
|
1165
|
-
if (!hasItem.bind(graphCore)(id)) {
|
|
1166
|
-
console.warn(
|
|
1167
|
-
`The ${itemType} data with id ${id} does not exist. It will be ignored`,
|
|
1168
|
-
);
|
|
1169
|
-
return;
|
|
1170
|
-
}
|
|
1171
|
-
return getItem.bind(graphCore)(id);
|
|
1172
|
-
})
|
|
1173
|
-
.filter(Boolean);
|
|
1174
|
-
graphCore.once('changed', (event) => {
|
|
1175
|
-
if (!event.changes.length) return;
|
|
1176
|
-
const changes = event.changes;
|
|
1177
|
-
const timingParameters = {
|
|
1178
|
-
type: itemType,
|
|
1179
|
-
action: 'remove',
|
|
1180
|
-
ids: idArr,
|
|
1181
|
-
apiName: 'removeData',
|
|
1182
|
-
changes,
|
|
1183
|
-
};
|
|
1184
|
-
this.emit('beforeitemchange', timingParameters);
|
|
1185
|
-
this.hooks.itemchange.emit({
|
|
1186
|
-
type: itemType,
|
|
1187
|
-
changes: event.changes,
|
|
1188
|
-
graphCore,
|
|
1189
|
-
theme: specification,
|
|
1190
|
-
});
|
|
1191
|
-
this.emit('afteritemchange', timingParameters);
|
|
1192
|
-
});
|
|
1193
|
-
this.hooks.datachange.emit({
|
|
1194
|
-
data,
|
|
1195
|
-
type: 'remove',
|
|
1196
|
-
});
|
|
592
|
+
public addNodeData(data: CallableValue<NodeData[]>): void {
|
|
593
|
+
this.context.model.addNodeData(isFunction(data) ? data(this.getNodeData()) : data);
|
|
1197
594
|
}
|
|
1198
|
-
/**
|
|
1199
|
-
* Extends the fields of oldValue and newValue
|
|
1200
|
-
* to make sure they both contain the union set of their original fields.
|
|
1201
|
-
* The missing fields' values are filled using data from displayModel data.
|
|
1202
|
-
* @param changes
|
|
1203
|
-
* @returns
|
|
1204
|
-
*/
|
|
1205
|
-
private extendChanges(changes) {
|
|
1206
|
-
return changes
|
|
1207
|
-
.map((change) => {
|
|
1208
|
-
const { id, propertyName, oldValue, newValue } = change;
|
|
1209
|
-
if (!oldValue || !newValue) return change;
|
|
1210
|
-
if (propertyName) {
|
|
1211
|
-
if (oldValue !== newValue) return change;
|
|
1212
|
-
return false;
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
const displayData = this.getItemById(id).displayModel.data;
|
|
1216
|
-
const oldFields = Object.keys(oldValue);
|
|
1217
|
-
const newFields = Object.keys(newValue);
|
|
1218
|
-
const commonFields = [...new Set([...oldFields, ...newFields])];
|
|
1219
|
-
|
|
1220
|
-
commonFields.forEach((field) => {
|
|
1221
|
-
if (!Object.prototype.hasOwnProperty.call(oldValue, field)) {
|
|
1222
|
-
oldValue[field] = displayData[field];
|
|
1223
|
-
}
|
|
1224
|
-
if (!Object.prototype.hasOwnProperty.call(newValue, field)) {
|
|
1225
|
-
newValue[field] = displayData[field];
|
|
1226
|
-
}
|
|
1227
|
-
});
|
|
1228
595
|
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
oldValue.y = 0;
|
|
1239
|
-
if (Number.isNaN(newValue.x)) delete newValue.x;
|
|
1240
|
-
if (Number.isNaN(newValue.y)) delete newValue.y;
|
|
1241
|
-
|
|
1242
|
-
if (isEqual(newValue, oldValue)) return false;
|
|
1243
|
-
|
|
1244
|
-
return {
|
|
1245
|
-
...change,
|
|
1246
|
-
newValue,
|
|
1247
|
-
oldValue,
|
|
1248
|
-
};
|
|
1249
|
-
})
|
|
1250
|
-
.filter(Boolean);
|
|
1251
|
-
}
|
|
1252
|
-
/**
|
|
1253
|
-
* Update one or more node/edge/combo data on the graph.
|
|
1254
|
-
* @param {ITEM_TYPE} itemType 'node' | 'edge' | 'combo'
|
|
1255
|
-
* @param models new configurations for every node/edge/combo, which has id field to indicate the specific item
|
|
1256
|
-
* @group Data
|
|
1257
|
-
*/
|
|
1258
|
-
public updateData(
|
|
1259
|
-
itemType: ITEM_TYPE,
|
|
1260
|
-
models:
|
|
1261
|
-
| Partial<NodeUserModel>
|
|
1262
|
-
| Partial<EdgeUserModel>
|
|
1263
|
-
| Partial<
|
|
1264
|
-
| ComboUserModel
|
|
1265
|
-
| Partial<NodeUserModel>[]
|
|
1266
|
-
| Partial<EdgeUserModel>[]
|
|
1267
|
-
| Partial<ComboUserModel>[]
|
|
1268
|
-
>,
|
|
1269
|
-
):
|
|
1270
|
-
| NodeModel
|
|
1271
|
-
| EdgeModel
|
|
1272
|
-
| ComboModel
|
|
1273
|
-
| NodeModel[]
|
|
1274
|
-
| EdgeModel[]
|
|
1275
|
-
| ComboModel[] {
|
|
1276
|
-
const modelArr = isArray(models) ? models : [models];
|
|
1277
|
-
const data = { nodes: [], edges: [], combos: [] };
|
|
1278
|
-
data[`${itemType}s`] = modelArr;
|
|
1279
|
-
|
|
1280
|
-
const { graphCore } = this.dataController;
|
|
1281
|
-
const { specification } = this.themeController;
|
|
1282
|
-
graphCore.once('changed', (event) => {
|
|
1283
|
-
const changes = this.extendChanges(clone(event.changes));
|
|
1284
|
-
const timingParameters = {
|
|
1285
|
-
type: itemType,
|
|
1286
|
-
action: 'update',
|
|
1287
|
-
models,
|
|
1288
|
-
apiName: 'updateData',
|
|
1289
|
-
changes,
|
|
1290
|
-
};
|
|
1291
|
-
this.emit('beforeitemchange', timingParameters);
|
|
1292
|
-
this.hooks.itemchange.emit({
|
|
1293
|
-
type: itemType,
|
|
1294
|
-
changes: event.changes,
|
|
1295
|
-
graphCore,
|
|
1296
|
-
theme: specification,
|
|
1297
|
-
});
|
|
1298
|
-
this.emit('afteritemchange', timingParameters);
|
|
1299
|
-
});
|
|
1300
|
-
|
|
1301
|
-
this.hooks.datachange.emit({
|
|
1302
|
-
data,
|
|
1303
|
-
type: 'update',
|
|
1304
|
-
});
|
|
1305
|
-
const dataList = this.dataController.findData(
|
|
1306
|
-
itemType,
|
|
1307
|
-
modelArr.map((model) => model.id),
|
|
1308
|
-
);
|
|
1309
|
-
return isArray(models) ? dataList : dataList[0];
|
|
1310
|
-
}
|
|
1311
|
-
|
|
1312
|
-
/**
|
|
1313
|
-
* Update one or more nodes' positions,
|
|
1314
|
-
* do not update other styles which leads to better performance than updating positions by updateData.
|
|
1315
|
-
* @param models new configurations with x and y for every node, which has id field to indicate the specific item
|
|
1316
|
-
* @group Data
|
|
1317
|
-
*/
|
|
1318
|
-
public updateNodePosition(
|
|
1319
|
-
models:
|
|
1320
|
-
| Partial<NodeUserModel>
|
|
1321
|
-
| Partial<
|
|
1322
|
-
ComboUserModel | Partial<NodeUserModel>[] | Partial<ComboUserModel>[]
|
|
1323
|
-
>,
|
|
1324
|
-
upsertAncestors?: boolean,
|
|
1325
|
-
disableAnimate = false,
|
|
1326
|
-
callback?: (
|
|
1327
|
-
model: NodeModel | EdgeModel | ComboModel,
|
|
1328
|
-
canceled?: boolean,
|
|
1329
|
-
) => void,
|
|
1330
|
-
stack?: boolean,
|
|
1331
|
-
) {
|
|
1332
|
-
return this.updatePosition(
|
|
1333
|
-
'node',
|
|
1334
|
-
models,
|
|
1335
|
-
upsertAncestors,
|
|
1336
|
-
disableAnimate,
|
|
1337
|
-
callback,
|
|
1338
|
-
stack,
|
|
1339
|
-
);
|
|
596
|
+
/**
|
|
597
|
+
* <zh/> 新增边数据
|
|
598
|
+
*
|
|
599
|
+
* <en/> Add edge data
|
|
600
|
+
* @param data - <zh/> 边数据 | <en/> edge data
|
|
601
|
+
* @apiCategory data
|
|
602
|
+
*/
|
|
603
|
+
public addEdgeData(data: CallableValue<EdgeData[]>): void {
|
|
604
|
+
this.context.model.addEdgeData(isFunction(data) ? data(this.getEdgeData()) : data);
|
|
1340
605
|
}
|
|
1341
606
|
|
|
1342
607
|
/**
|
|
1343
|
-
*
|
|
1344
|
-
*
|
|
1345
|
-
*
|
|
1346
|
-
* @param
|
|
1347
|
-
* @
|
|
1348
|
-
*/
|
|
1349
|
-
public
|
|
1350
|
-
|
|
1351
|
-
| Partial<NodeUserModel>
|
|
1352
|
-
| Partial<
|
|
1353
|
-
ComboUserModel | Partial<NodeUserModel>[] | Partial<ComboUserModel>[]
|
|
1354
|
-
>,
|
|
1355
|
-
upsertAncestors?: boolean,
|
|
1356
|
-
disableAnimate = false,
|
|
1357
|
-
callback?: (model: NodeModel | EdgeModel | ComboModel) => void,
|
|
1358
|
-
stack?: boolean,
|
|
1359
|
-
) {
|
|
1360
|
-
return this.updatePosition(
|
|
1361
|
-
'combo',
|
|
1362
|
-
models,
|
|
1363
|
-
upsertAncestors,
|
|
1364
|
-
disableAnimate,
|
|
1365
|
-
callback,
|
|
1366
|
-
stack,
|
|
1367
|
-
);
|
|
608
|
+
* <zh/> 新增组合数据
|
|
609
|
+
*
|
|
610
|
+
* <en/> Add combo data
|
|
611
|
+
* @param data - <zh/> 组合数据 | <en/> combo data
|
|
612
|
+
* @apiCategory data
|
|
613
|
+
*/
|
|
614
|
+
public addComboData(data: CallableValue<ComboData[]>): void {
|
|
615
|
+
this.context.model.addComboData(isFunction(data) ? data(this.getComboData()) : data);
|
|
1368
616
|
}
|
|
1369
617
|
|
|
1370
618
|
/**
|
|
1371
|
-
*
|
|
619
|
+
* <zh/> 更新元素数据
|
|
620
|
+
*
|
|
621
|
+
* <en/> Update element data
|
|
622
|
+
* @param data - <zh/> 元素数据 | <en/> element data
|
|
623
|
+
* @apiCategory data
|
|
1372
624
|
*/
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
!this.specification.enableStack ||
|
|
1376
|
-
!this.pluginController.hasPlugin('history')
|
|
1377
|
-
) {
|
|
1378
|
-
console.error('The history plugin is not loaded or initialized.');
|
|
1379
|
-
return;
|
|
1380
|
-
}
|
|
1381
|
-
return this.pluginController.getPlugin('history') as History;
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1384
|
-
private updatePosition(
|
|
1385
|
-
type: 'node' | 'combo',
|
|
1386
|
-
models:
|
|
1387
|
-
| Partial<NodeUserModel>
|
|
1388
|
-
| Partial<
|
|
1389
|
-
ComboUserModel | Partial<NodeUserModel>[] | Partial<ComboUserModel>[]
|
|
1390
|
-
>,
|
|
1391
|
-
upsertAncestors?: boolean,
|
|
1392
|
-
disableAnimate = false,
|
|
1393
|
-
callback?: (
|
|
1394
|
-
model: NodeModel | EdgeModel | ComboModel,
|
|
1395
|
-
canceled?: boolean,
|
|
1396
|
-
) => void,
|
|
1397
|
-
stack?: boolean,
|
|
1398
|
-
) {
|
|
1399
|
-
const modelArr = isArray(models) ? models : [models];
|
|
1400
|
-
const { graphCore } = this.dataController;
|
|
1401
|
-
const { specification } = this.themeController;
|
|
1402
|
-
graphCore.once('changed', (event) => {
|
|
1403
|
-
if (!event.changes.length) return;
|
|
1404
|
-
const changes = event.changes.filter(
|
|
1405
|
-
(change) => !isEqual(change.newValue, change.oldValue),
|
|
1406
|
-
);
|
|
1407
|
-
const timingParameters = {
|
|
1408
|
-
type,
|
|
1409
|
-
action: 'updatePosition',
|
|
1410
|
-
upsertAncestors,
|
|
1411
|
-
models,
|
|
1412
|
-
apiName: 'updatePosition',
|
|
1413
|
-
changes,
|
|
1414
|
-
};
|
|
1415
|
-
this.emit('beforeitemchange', timingParameters);
|
|
1416
|
-
this.hooks.itemchange.emit({
|
|
1417
|
-
type,
|
|
1418
|
-
changes: event.changes,
|
|
1419
|
-
graphCore,
|
|
1420
|
-
theme: specification,
|
|
1421
|
-
upsertAncestors,
|
|
1422
|
-
action: 'updatePosition',
|
|
1423
|
-
animate: !disableAnimate,
|
|
1424
|
-
callback,
|
|
1425
|
-
});
|
|
1426
|
-
this.emit('afteritemchange', timingParameters);
|
|
1427
|
-
});
|
|
1428
|
-
|
|
1429
|
-
this.hooks.datachange.emit({
|
|
1430
|
-
data: {
|
|
1431
|
-
nodes: type === 'node' ? (modelArr as NodeUserModel[]) : [],
|
|
1432
|
-
edges: [],
|
|
1433
|
-
combos: type === 'combo' ? (modelArr as ComboUserModel[]) : [],
|
|
1434
|
-
},
|
|
1435
|
-
type: 'update',
|
|
1436
|
-
});
|
|
1437
|
-
const dataList = this.dataController.findData(
|
|
1438
|
-
type,
|
|
1439
|
-
modelArr.map((model) => model.id),
|
|
1440
|
-
);
|
|
1441
|
-
return isArray(models) ? dataList : dataList[0];
|
|
625
|
+
public updateData(data: CallableValue<PartialGraphData>): void {
|
|
626
|
+
this.context.model.updateData(isFunction(data) ? data(this.getData()) : data);
|
|
1442
627
|
}
|
|
1443
628
|
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
});
|
|
1454
|
-
}
|
|
1455
|
-
return values;
|
|
629
|
+
/**
|
|
630
|
+
* <zh/> 更新节点数据
|
|
631
|
+
*
|
|
632
|
+
* <en/> Update node data
|
|
633
|
+
* @param data - <zh/> 节点数据 | <en/> node data
|
|
634
|
+
* @apiCategory data
|
|
635
|
+
*/
|
|
636
|
+
public updateNodeData(data: CallableValue<PartialNodeLikeData<NodeData>[]>): void {
|
|
637
|
+
this.context.model.updateNodeData(isFunction(data) ? data(this.getNodeData()) : data);
|
|
1456
638
|
}
|
|
1457
639
|
|
|
1458
640
|
/**
|
|
1459
|
-
*
|
|
1460
|
-
*
|
|
1461
|
-
*
|
|
1462
|
-
* @
|
|
641
|
+
* <zh/> 更新边数据
|
|
642
|
+
*
|
|
643
|
+
* <en/> Update edge data
|
|
644
|
+
* @param data - <zh/> 边数据 | <en/> edge data
|
|
645
|
+
* @apiCategory data
|
|
1463
646
|
*/
|
|
1464
|
-
public
|
|
1465
|
-
|
|
1466
|
-
if (isEmpty(idArr)) return;
|
|
1467
|
-
const changes = {
|
|
1468
|
-
newValue: [{ ids: idArr, visible: true }],
|
|
1469
|
-
oldValue: this.getItemPreviousVisibility(idArr),
|
|
1470
|
-
};
|
|
1471
|
-
this.hooks.itemvisibilitychange.emit({
|
|
1472
|
-
ids: idArr as ID[],
|
|
1473
|
-
value: true,
|
|
1474
|
-
graphCore: this.dataController.graphCore,
|
|
1475
|
-
animate: !disableAnimate,
|
|
1476
|
-
});
|
|
1477
|
-
this.emit('afteritemvisibilitychange', {
|
|
1478
|
-
ids,
|
|
1479
|
-
value: true,
|
|
1480
|
-
animate: !disableAnimate,
|
|
1481
|
-
action: 'updateVisibility',
|
|
1482
|
-
apiName: 'showItem',
|
|
1483
|
-
changes,
|
|
1484
|
-
});
|
|
647
|
+
public updateEdgeData(data: CallableValue<PartialEdgeData<EdgeData>[]>): void {
|
|
648
|
+
this.context.model.updateEdgeData(isFunction(data) ? data(this.getEdgeData()) : data);
|
|
1485
649
|
}
|
|
650
|
+
|
|
1486
651
|
/**
|
|
1487
|
-
*
|
|
1488
|
-
*
|
|
1489
|
-
*
|
|
1490
|
-
* @
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
keepKeyShape = false,
|
|
1496
|
-
) {
|
|
1497
|
-
const idArr = isArray(ids) ? ids : [ids];
|
|
1498
|
-
if (isEmpty(idArr)) return;
|
|
1499
|
-
const changes = {
|
|
1500
|
-
newValue: [{ ids: idArr, visible: false }],
|
|
1501
|
-
oldValue: this.getItemPreviousVisibility(idArr),
|
|
1502
|
-
};
|
|
1503
|
-
this.hooks.itemvisibilitychange.emit({
|
|
1504
|
-
ids: idArr as ID[],
|
|
1505
|
-
value: false,
|
|
1506
|
-
graphCore: this.dataController.graphCore,
|
|
1507
|
-
animate: !disableAnimate,
|
|
1508
|
-
keepKeyShape,
|
|
1509
|
-
});
|
|
1510
|
-
this.emit('afteritemvisibilitychange', {
|
|
1511
|
-
ids,
|
|
1512
|
-
value: false,
|
|
1513
|
-
animate: !disableAnimate,
|
|
1514
|
-
action: 'updateVisibility',
|
|
1515
|
-
apiName: 'hideItem',
|
|
1516
|
-
keepKeyShape,
|
|
1517
|
-
changes,
|
|
1518
|
-
});
|
|
652
|
+
* <zh/> 更新组合数据
|
|
653
|
+
*
|
|
654
|
+
* <en/> Update combo data
|
|
655
|
+
* @param data - <zh/> 组合数据 | <en/> combo data
|
|
656
|
+
* @apiCategory data
|
|
657
|
+
*/
|
|
658
|
+
public updateComboData(data: CallableValue<PartialNodeLikeData<ComboData>[]>): void {
|
|
659
|
+
this.context.model.updateComboData(isFunction(data) ? data(this.getComboData()) : data);
|
|
1519
660
|
}
|
|
1520
661
|
|
|
1521
662
|
/**
|
|
1522
|
-
*
|
|
1523
|
-
*
|
|
1524
|
-
*
|
|
1525
|
-
* @
|
|
663
|
+
* <zh/> 删除多条元素数据
|
|
664
|
+
*
|
|
665
|
+
* <en/> Remove multiple element data
|
|
666
|
+
* @param ids - <zh/> 元素 ID 数组 | <en/> element ID array
|
|
667
|
+
* @apiCategory data
|
|
1526
668
|
*/
|
|
1527
|
-
public
|
|
1528
|
-
|
|
1529
|
-
this.hooks.itemzindexchange.emit({
|
|
1530
|
-
ids: idArr as ID[],
|
|
1531
|
-
action: 'front',
|
|
1532
|
-
graphCore: this.dataController.graphCore,
|
|
1533
|
-
});
|
|
1534
|
-
this.emit('afteritemzindexchange', {
|
|
1535
|
-
ids: idArr,
|
|
1536
|
-
action: 'front',
|
|
1537
|
-
apiName: 'frontItem',
|
|
1538
|
-
});
|
|
669
|
+
public removeData(ids: DataID | ((data: GraphData) => DataID)): void {
|
|
670
|
+
this.context.model.removeData(isFunction(ids) ? ids(this.getData()) : ids);
|
|
1539
671
|
}
|
|
672
|
+
|
|
1540
673
|
/**
|
|
1541
|
-
*
|
|
1542
|
-
*
|
|
1543
|
-
*
|
|
1544
|
-
* @
|
|
674
|
+
* <zh/> 删除多条节点数据
|
|
675
|
+
*
|
|
676
|
+
* <en/> Remove multiple node data
|
|
677
|
+
* @param ids - <zh/> 节点 ID 数组 | <en/> node ID array
|
|
678
|
+
* @apiCategory data
|
|
1545
679
|
*/
|
|
1546
|
-
public
|
|
1547
|
-
|
|
1548
|
-
this.hooks.itemzindexchange.emit({
|
|
1549
|
-
ids: idArr as ID[],
|
|
1550
|
-
action: 'back',
|
|
1551
|
-
graphCore: this.dataController.graphCore,
|
|
1552
|
-
});
|
|
1553
|
-
this.emit('afteritemzindexchange', {
|
|
1554
|
-
ids: idArr,
|
|
1555
|
-
action: 'back',
|
|
1556
|
-
apiName: 'backItem',
|
|
1557
|
-
});
|
|
680
|
+
public removeNodeData(ids: ID[] | ((data: NodeData[]) => ID[])): void {
|
|
681
|
+
this.context.model.removeNodeData(isFunction(ids) ? ids(this.getNodeData()) : ids);
|
|
1558
682
|
}
|
|
1559
683
|
|
|
1560
|
-
private getItemPreviousStates(stateOption: {
|
|
1561
|
-
ids: ID | ID[];
|
|
1562
|
-
states: string | string[];
|
|
1563
|
-
value: boolean;
|
|
1564
|
-
}) {
|
|
1565
|
-
const { ids, states } = stateOption;
|
|
1566
|
-
const idArr = Array.isArray(ids) ? ids : [ids];
|
|
1567
|
-
const stateArr = Array.isArray(states) ? states : [states];
|
|
1568
|
-
if (isEmpty(idArr)) return;
|
|
1569
|
-
return idArr.flatMap((id) => {
|
|
1570
|
-
return stateArr.map((state) => ({
|
|
1571
|
-
ids: id,
|
|
1572
|
-
states: state,
|
|
1573
|
-
value: this.getItemState(id, state),
|
|
1574
|
-
}));
|
|
1575
|
-
});
|
|
1576
|
-
}
|
|
1577
684
|
/**
|
|
1578
|
-
*
|
|
1579
|
-
*
|
|
1580
|
-
*
|
|
1581
|
-
* @param
|
|
1582
|
-
* @
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
ids: ID | ID[],
|
|
1587
|
-
states: string | string[],
|
|
1588
|
-
value: boolean,
|
|
1589
|
-
) {
|
|
1590
|
-
const idArr = isArray(ids) ? ids : [ids];
|
|
1591
|
-
const stateArr = isArray(states) ? states : [states];
|
|
1592
|
-
const stateOption = { ids: idArr, states: stateArr, value };
|
|
1593
|
-
const changes = {
|
|
1594
|
-
newValue: [stateOption],
|
|
1595
|
-
oldValue: this.getItemPreviousStates(stateOption),
|
|
1596
|
-
};
|
|
1597
|
-
this.hooks.itemstatechange.emit({
|
|
1598
|
-
ids: idArr as ID[],
|
|
1599
|
-
states: stateArr as string[],
|
|
1600
|
-
value,
|
|
1601
|
-
});
|
|
1602
|
-
this.emit('afteritemstatechange', {
|
|
1603
|
-
ids,
|
|
1604
|
-
states,
|
|
1605
|
-
value,
|
|
1606
|
-
action: 'updateState',
|
|
1607
|
-
apiName: 'setItemState',
|
|
1608
|
-
changes,
|
|
1609
|
-
});
|
|
685
|
+
* <zh/> 删除多条边数据
|
|
686
|
+
*
|
|
687
|
+
* <en/> Remove multiple edge data
|
|
688
|
+
* @param ids - <zh/> 边 ID 数组 | <en/> edge ID array
|
|
689
|
+
* @apiCategory data
|
|
690
|
+
*/
|
|
691
|
+
public removeEdgeData(ids: ID[] | ((data: EdgeData[]) => ID[])): void {
|
|
692
|
+
this.context.model.removeEdgeData(isFunction(ids) ? ids(this.getEdgeData()) : ids);
|
|
1610
693
|
}
|
|
694
|
+
|
|
1611
695
|
/**
|
|
1612
|
-
*
|
|
1613
|
-
*
|
|
1614
|
-
*
|
|
1615
|
-
* @
|
|
1616
|
-
* @
|
|
696
|
+
* <zh/> 删除多条组合数据
|
|
697
|
+
*
|
|
698
|
+
* <en/> Remove multiple combo data
|
|
699
|
+
* @param ids - <zh/> 组合 ID 数组 | <en/> 组合 ID array
|
|
700
|
+
* @apiCategory data
|
|
1617
701
|
*/
|
|
1618
|
-
public
|
|
1619
|
-
|
|
702
|
+
public removeComboData(ids: ID[] | ((data: ComboData[]) => ID[])): void {
|
|
703
|
+
this.context.model.removeComboData(isFunction(ids) ? ids(this.getComboData()) : ids);
|
|
1620
704
|
}
|
|
1621
705
|
|
|
1622
706
|
/**
|
|
1623
|
-
*
|
|
1624
|
-
*
|
|
1625
|
-
*
|
|
1626
|
-
* @
|
|
707
|
+
* <zh/> 获取元素类型
|
|
708
|
+
*
|
|
709
|
+
* <en/> Get element type
|
|
710
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
711
|
+
* @returns <zh/> 元素类型 | <en/> element type
|
|
712
|
+
* @apiCategory element
|
|
1627
713
|
*/
|
|
1628
|
-
public
|
|
1629
|
-
return this.
|
|
714
|
+
public getElementType(id: ID): ElementType {
|
|
715
|
+
return this.context.model.getElementType(id);
|
|
1630
716
|
}
|
|
1631
717
|
|
|
1632
718
|
/**
|
|
1633
|
-
*
|
|
1634
|
-
*
|
|
1635
|
-
*
|
|
1636
|
-
* @
|
|
1637
|
-
* @
|
|
719
|
+
* <zh/> 获取节点或组合关联边的数据
|
|
720
|
+
*
|
|
721
|
+
* <en/> Get edge data related to the node or combo
|
|
722
|
+
* @param id - <zh/> 节点或组合ID | <en/> node or combo ID
|
|
723
|
+
* @param direction - <zh/> 边的方向 | <en/> edge direction
|
|
724
|
+
* @returns <zh/> 边数据 | <en/> edge data
|
|
725
|
+
* @apiCategory data
|
|
1638
726
|
*/
|
|
1639
|
-
public
|
|
1640
|
-
|
|
1641
|
-
const stateOptions = { ids: idArr, states, value: false };
|
|
1642
|
-
const changes = {
|
|
1643
|
-
newValue: [stateOptions],
|
|
1644
|
-
oldValue: this.getItemPreviousStates(stateOptions),
|
|
1645
|
-
};
|
|
1646
|
-
this.hooks.itemstatechange.emit({
|
|
1647
|
-
ids: idArr as ID[],
|
|
1648
|
-
states,
|
|
1649
|
-
value: false,
|
|
1650
|
-
});
|
|
1651
|
-
this.emit('afteritemstatechange', {
|
|
1652
|
-
ids,
|
|
1653
|
-
states,
|
|
1654
|
-
value: false,
|
|
1655
|
-
action: 'updateState',
|
|
1656
|
-
apiName: 'clearItemState',
|
|
1657
|
-
changes,
|
|
1658
|
-
});
|
|
727
|
+
public getRelatedEdgesData(id: ID, direction: EdgeDirection = 'both'): EdgeData[] {
|
|
728
|
+
return this.context.model.getRelatedEdgesData(id, direction);
|
|
1659
729
|
}
|
|
1660
730
|
|
|
1661
731
|
/**
|
|
1662
|
-
*
|
|
1663
|
-
*
|
|
1664
|
-
*
|
|
1665
|
-
* @
|
|
732
|
+
* <zh/> 获取节点或组合的一跳邻居节点数据
|
|
733
|
+
*
|
|
734
|
+
* <en/> Get the one-hop neighbor node data of the node or combo
|
|
735
|
+
* @param id - <zh/> 节点或组合ID | <en/> node or combo ID
|
|
736
|
+
* @returns <zh/> 邻居节点数据 | <en/> neighbor node data
|
|
737
|
+
* @apiCategory data
|
|
1666
738
|
*/
|
|
1667
|
-
public
|
|
1668
|
-
id
|
|
1669
|
-
onlyKeyShape = false,
|
|
1670
|
-
isTransient = false,
|
|
1671
|
-
): AABB | false {
|
|
1672
|
-
if (!id) return this.canvas.getRoot().getRenderBounds();
|
|
1673
|
-
return this.itemController.getItemBBox(id, onlyKeyShape, isTransient);
|
|
739
|
+
public getNeighborNodesData(id: ID): NodeData[] {
|
|
740
|
+
return this.context.model.getNeighborNodesData(id);
|
|
1674
741
|
}
|
|
1675
742
|
|
|
1676
743
|
/**
|
|
1677
|
-
*
|
|
1678
|
-
*
|
|
1679
|
-
*
|
|
1680
|
-
* @
|
|
744
|
+
* <zh/> 获取节点或组合的祖先元素数据
|
|
745
|
+
*
|
|
746
|
+
* <en/> Get the ancestor element data of the node or combo
|
|
747
|
+
* @param id - <zh/> 节点或组合ID | <en/> node or combo ID
|
|
748
|
+
* @param hierarchy - <zh/> 指定树图层级关系还是组合层级关系 | <en/> specify tree or combo hierarchy relationship
|
|
749
|
+
* @returns <zh/> 祖先元素数据 | <en/> ancestor element data
|
|
750
|
+
* @remarks
|
|
751
|
+
* <zh/> 数组中的顺序是从父节点到祖先节点
|
|
752
|
+
*
|
|
753
|
+
* <en/> The order in the array is from the parent node to the ancestor node
|
|
754
|
+
* @apiCategory data
|
|
1681
755
|
*/
|
|
1682
|
-
public
|
|
1683
|
-
return this.
|
|
756
|
+
public getAncestorsData(id: ID, hierarchy: HierarchyKey): NodeLikeData[] {
|
|
757
|
+
return this.context.model.getAncestorsData(id, hierarchy);
|
|
1684
758
|
}
|
|
1685
759
|
|
|
1686
|
-
// ===== combo operations =====
|
|
1687
|
-
|
|
1688
760
|
/**
|
|
1689
|
-
*
|
|
1690
|
-
*
|
|
1691
|
-
*
|
|
1692
|
-
* @
|
|
1693
|
-
* @
|
|
761
|
+
* <zh/> 获取节点或组合的父元素数据
|
|
762
|
+
*
|
|
763
|
+
* <en/> Get the parent element data of the node or combo
|
|
764
|
+
* @param id - <zh/> 节点或组合ID | <en/> node or combo ID
|
|
765
|
+
* @param hierarchy - <zh/> 指定树图层级关系还是组合层级关系 | <en/> specify tree or combo hierarchy relationship
|
|
766
|
+
* @returns <zh/> 父元素数据 | <en/> parent element data
|
|
767
|
+
* @apiCategory data
|
|
1694
768
|
*/
|
|
1695
|
-
public
|
|
1696
|
-
|
|
1697
|
-
const { specification } = this.themeController;
|
|
1698
|
-
graphCore.once('changed', (event) => {
|
|
1699
|
-
if (!event.changes.length) return;
|
|
1700
|
-
const changes = event.changes;
|
|
1701
|
-
const timingParameters = {
|
|
1702
|
-
type: 'combo',
|
|
1703
|
-
action: 'add',
|
|
1704
|
-
models: [model],
|
|
1705
|
-
apiName: 'addCombo',
|
|
1706
|
-
changes,
|
|
1707
|
-
};
|
|
1708
|
-
this.emit('beforeitemchange', timingParameters);
|
|
1709
|
-
this.hooks.itemchange.emit({
|
|
1710
|
-
type: 'combo',
|
|
1711
|
-
changes: graphCore.reduceChanges(event.changes),
|
|
1712
|
-
graphCore,
|
|
1713
|
-
theme: specification,
|
|
1714
|
-
});
|
|
1715
|
-
this.emit('afteritemchange', timingParameters);
|
|
1716
|
-
});
|
|
1717
|
-
|
|
1718
|
-
const data = {
|
|
1719
|
-
nodes: [],
|
|
1720
|
-
edges: [],
|
|
1721
|
-
combos: [
|
|
1722
|
-
{
|
|
1723
|
-
...model,
|
|
1724
|
-
data: {
|
|
1725
|
-
...model.data,
|
|
1726
|
-
_children: childrenIds,
|
|
1727
|
-
},
|
|
1728
|
-
},
|
|
1729
|
-
],
|
|
1730
|
-
};
|
|
1731
|
-
this.hooks.datachange.emit({
|
|
1732
|
-
data,
|
|
1733
|
-
type: 'addCombo',
|
|
1734
|
-
});
|
|
1735
|
-
return this.dataController.findData('combo', [model.id])[0] as ComboModel;
|
|
769
|
+
public getParentData(id: ID, hierarchy: HierarchyKey): NodeLikeData | undefined {
|
|
770
|
+
return this.context.model.getParentData(id, hierarchy);
|
|
1736
771
|
}
|
|
772
|
+
|
|
1737
773
|
/**
|
|
1738
|
-
*
|
|
1739
|
-
*
|
|
1740
|
-
*
|
|
774
|
+
* <zh/> 获取节点或组合的子元素数据
|
|
775
|
+
*
|
|
776
|
+
* <en/> Get the child element data of the node or combo
|
|
777
|
+
* @param id - <zh/> 节点或组合ID | <en/> node or combo ID
|
|
778
|
+
* @returns <zh/> 子元素数据 | <en/> child element data
|
|
779
|
+
* @apiCategory data
|
|
1741
780
|
*/
|
|
1742
|
-
public
|
|
1743
|
-
|
|
1744
|
-
this.executeWithNoStack(() => {
|
|
1745
|
-
this.updateData(
|
|
1746
|
-
'combo',
|
|
1747
|
-
ids.map((id) => ({ id, data: { collapsed: true } })),
|
|
1748
|
-
);
|
|
1749
|
-
});
|
|
1750
|
-
this.emit('aftercollapsecombo', {
|
|
1751
|
-
type: 'combo',
|
|
1752
|
-
action: 'collapseCombo',
|
|
1753
|
-
ids: comboIds,
|
|
1754
|
-
apiName: 'collapseCombo',
|
|
1755
|
-
});
|
|
781
|
+
public getChildrenData(id: ID): NodeLikeData[] {
|
|
782
|
+
return this.context.model.getChildrenData(id);
|
|
1756
783
|
}
|
|
784
|
+
|
|
1757
785
|
/**
|
|
1758
|
-
*
|
|
1759
|
-
*
|
|
1760
|
-
*
|
|
786
|
+
* <zh/> 获取指定状态下的节点数据
|
|
787
|
+
*
|
|
788
|
+
* <en/> Get node data in a specific state
|
|
789
|
+
* @param state - <zh/> 状态 | <en/> state
|
|
790
|
+
* @returns <zh/> 节点数据 | <en/> node data
|
|
791
|
+
* @apiCategory data
|
|
1761
792
|
*/
|
|
1762
|
-
public
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
793
|
+
public getElementDataByState(elementType: 'node', state: State): NodeData[];
|
|
794
|
+
/**
|
|
795
|
+
* <zh/> 获取指定状态下的边数据
|
|
796
|
+
*
|
|
797
|
+
* <en/> Get edge data in a specific state
|
|
798
|
+
* @param state - <zh/> 状态 | <en/> state
|
|
799
|
+
* @returns <zh/> 边数据 | <en/> edge data
|
|
800
|
+
* @apiCategory data
|
|
801
|
+
*/
|
|
802
|
+
public getElementDataByState(elementType: 'edge', state: State): EdgeData[];
|
|
803
|
+
/**
|
|
804
|
+
* <zh/> 获取指定状态下的组合数据
|
|
805
|
+
*
|
|
806
|
+
* <en/> Get combo data in a specific state
|
|
807
|
+
* @param state - <zh/> 状态 | <en/> state
|
|
808
|
+
* @returns <zh/> 组合数据 | <en/> combo data
|
|
809
|
+
* @apiCategory data
|
|
810
|
+
*/
|
|
811
|
+
public getElementDataByState(elementType: 'combo', state: State): ComboData[];
|
|
812
|
+
public getElementDataByState(elementType: ElementType, state: State): ElementDatum[] {
|
|
813
|
+
return this.context.model.getElementDataByState(elementType, state);
|
|
1776
814
|
}
|
|
1777
815
|
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
if (!event.changes.length) return;
|
|
1800
|
-
const changes = this.extendChanges(clone(event.changes));
|
|
1801
|
-
const timingParameters = {
|
|
1802
|
-
type: 'combo',
|
|
1803
|
-
ids: idArr,
|
|
1804
|
-
dx,
|
|
1805
|
-
dy,
|
|
1806
|
-
action: 'updatePosition',
|
|
1807
|
-
upsertAncestors,
|
|
1808
|
-
apiName: 'moveCombo',
|
|
1809
|
-
changes,
|
|
1810
|
-
};
|
|
1811
|
-
this.emit('beforeitemchange', timingParameters);
|
|
1812
|
-
this.hooks.itemchange.emit({
|
|
1813
|
-
type: 'combo',
|
|
1814
|
-
changes: event.changes,
|
|
1815
|
-
graphCore,
|
|
1816
|
-
theme: specification,
|
|
1817
|
-
upsertAncestors,
|
|
1818
|
-
action: 'updatePosition',
|
|
1819
|
-
callback,
|
|
816
|
+
private async initCanvas() {
|
|
817
|
+
if (this.context.canvas) return await this.context.canvas.init();
|
|
818
|
+
|
|
819
|
+
const { container = 'container', width, height, renderer, background } = this.options;
|
|
820
|
+
|
|
821
|
+
if (container instanceof Canvas) {
|
|
822
|
+
this.context.canvas = container;
|
|
823
|
+
container.setBackground(background);
|
|
824
|
+
await container.init();
|
|
825
|
+
} else {
|
|
826
|
+
const $container = isString(container) ? document.getElementById(container!) : container;
|
|
827
|
+
const containerSize = sizeOf($container!);
|
|
828
|
+
|
|
829
|
+
this.emit(GraphEvent.BEFORE_CANVAS_INIT, { container: $container, width, height });
|
|
830
|
+
|
|
831
|
+
const canvas = new Canvas({
|
|
832
|
+
container: $container!,
|
|
833
|
+
width: width || containerSize[0],
|
|
834
|
+
height: height || containerSize[1],
|
|
835
|
+
background,
|
|
836
|
+
renderer,
|
|
1820
837
|
});
|
|
1821
|
-
this.emit('afteritemchange', timingParameters);
|
|
1822
|
-
});
|
|
1823
838
|
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
edges: [],
|
|
1828
|
-
combos: idArr.map((id) => ({ id, data: { dx, dy } })),
|
|
1829
|
-
},
|
|
1830
|
-
type: 'moveCombo',
|
|
1831
|
-
});
|
|
1832
|
-
return this.dataController.findData('combo', idArr) as ComboModel[];
|
|
1833
|
-
}
|
|
1834
|
-
|
|
1835
|
-
// ===== layout =====
|
|
1836
|
-
/**
|
|
1837
|
-
* Layout the graph (with current configurations if cfg is not assigned).
|
|
1838
|
-
*/
|
|
1839
|
-
public async layout(options?: LayoutOptions, disableAnimate = false) {
|
|
1840
|
-
this.emit('beforelayout');
|
|
1841
|
-
const { graphCore } = this.dataController;
|
|
1842
|
-
const formattedOptions = {
|
|
1843
|
-
...this.getSpecification().layout,
|
|
1844
|
-
...options,
|
|
1845
|
-
} as LayoutOptions;
|
|
1846
|
-
|
|
1847
|
-
this.updateSpecification({ layout: formattedOptions });
|
|
1848
|
-
|
|
1849
|
-
const layoutUnset =
|
|
1850
|
-
(!options && !this.getSpecification().layout) ||
|
|
1851
|
-
!Object.keys(formattedOptions).length;
|
|
1852
|
-
if (layoutUnset) {
|
|
1853
|
-
const nodes = graphCore.getAllNodes();
|
|
1854
|
-
if (nodes.every((node) => isNil(node.data.x) && isNil(node.data.y))) {
|
|
1855
|
-
// Use `grid` layout as default when x/y of each node is unset.
|
|
1856
|
-
(formattedOptions as StandardLayoutOptions).type = 'grid';
|
|
1857
|
-
} else {
|
|
1858
|
-
// Use user-defined position(x/y default to 0).
|
|
1859
|
-
(formattedOptions as ImmediatelyInvokedLayoutOptions).execute = async (
|
|
1860
|
-
graph,
|
|
1861
|
-
) => {
|
|
1862
|
-
const nodes = graph.getAllNodes();
|
|
1863
|
-
return {
|
|
1864
|
-
nodes: nodes.map((node) => ({
|
|
1865
|
-
id: node.id,
|
|
1866
|
-
data: {
|
|
1867
|
-
x: Number(node.data.x) || 0,
|
|
1868
|
-
y: Number(node.data.y) || 0,
|
|
1869
|
-
},
|
|
1870
|
-
})),
|
|
1871
|
-
edges: [],
|
|
1872
|
-
};
|
|
1873
|
-
};
|
|
1874
|
-
}
|
|
839
|
+
this.context.canvas = canvas;
|
|
840
|
+
await canvas.init();
|
|
841
|
+
this.emit(GraphEvent.AFTER_CANVAS_INIT, { canvas });
|
|
1875
842
|
}
|
|
843
|
+
}
|
|
1876
844
|
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
845
|
+
private initRuntime() {
|
|
846
|
+
this.context.options = this.options;
|
|
847
|
+
if (!this.context.batch) this.context.batch = new BatchController(this.context);
|
|
848
|
+
if (!this.context.plugin) this.context.plugin = new PluginController(this.context);
|
|
849
|
+
if (!this.context.viewport) this.context.viewport = new ViewportController(this.context);
|
|
850
|
+
if (!this.context.transform) this.context.transform = new TransformController(this.context);
|
|
851
|
+
if (!this.context.element) this.context.element = new ElementController(this.context);
|
|
852
|
+
if (!this.context.animation) this.context.animation = new Animation(this.context);
|
|
853
|
+
if (!this.context.layout) this.context.layout = new LayoutController(this.context);
|
|
854
|
+
if (!this.context.behavior) this.context.behavior = new BehaviorController(this.context);
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
private async prepare(): Promise<void> {
|
|
858
|
+
// 等待同步任务执行完成,避免 render 后立即调用 destroy 导致的问题
|
|
859
|
+
// Wait for synchronous tasks to complete, to avoid problems caused by calling destroy immediately after render
|
|
860
|
+
await Promise.resolve();
|
|
1882
861
|
|
|
1883
|
-
this.
|
|
862
|
+
if (this.destroyed) throw new Error('Graph has been destroyed');
|
|
863
|
+
|
|
864
|
+
await this.initCanvas();
|
|
865
|
+
this.initRuntime();
|
|
1884
866
|
}
|
|
1885
867
|
|
|
1886
868
|
/**
|
|
1887
|
-
*
|
|
869
|
+
* <zh/> 执行渲染
|
|
870
|
+
*
|
|
871
|
+
* <en/> Render
|
|
872
|
+
* @remarks
|
|
873
|
+
* <zh/> 此过程会执行数据更新、绘制元素、执行布局
|
|
874
|
+
*
|
|
875
|
+
* <en/> This process will execute data update, element rendering, and layout execution
|
|
876
|
+
* @apiCategory render
|
|
1888
877
|
*/
|
|
1889
|
-
public
|
|
1890
|
-
this.
|
|
878
|
+
public async render(): Promise<void> {
|
|
879
|
+
await this.prepare();
|
|
880
|
+
emit(this, new GraphLifeCycleEvent(GraphEvent.BEFORE_RENDER));
|
|
881
|
+
const animation = this.context.element!.draw();
|
|
882
|
+
await Promise.all([animation?.finished, this.context.layout!.layout()]);
|
|
883
|
+
await this.autoFit();
|
|
884
|
+
emit(this, new GraphLifeCycleEvent(GraphEvent.AFTER_RENDER));
|
|
1891
885
|
}
|
|
1892
886
|
|
|
1893
887
|
/**
|
|
888
|
+
* <zh/> 绘制元素
|
|
1894
889
|
*
|
|
1895
|
-
*
|
|
890
|
+
* <en/> Draw elements
|
|
891
|
+
* @returns <zh/> 渲染结果 | <en/> draw result
|
|
892
|
+
* @apiCategory element
|
|
1896
893
|
*/
|
|
1897
|
-
public
|
|
1898
|
-
|
|
894
|
+
public async draw(): Promise<void> {
|
|
895
|
+
await this.prepare();
|
|
896
|
+
await this.context.element!.draw()?.finished;
|
|
897
|
+
await this.autoFit();
|
|
1899
898
|
}
|
|
1900
899
|
|
|
1901
900
|
/**
|
|
1902
|
-
*
|
|
1903
|
-
*
|
|
1904
|
-
*
|
|
1905
|
-
* @
|
|
901
|
+
* <zh/> 执行布局
|
|
902
|
+
*
|
|
903
|
+
* <en/> Execute layout
|
|
904
|
+
* @apiCategory layout
|
|
1906
905
|
*/
|
|
1907
|
-
public
|
|
1908
|
-
this.
|
|
906
|
+
public async layout() {
|
|
907
|
+
await this.context.layout!.layout();
|
|
1909
908
|
}
|
|
1910
909
|
|
|
1911
910
|
/**
|
|
1912
|
-
*
|
|
1913
|
-
*
|
|
1914
|
-
*
|
|
911
|
+
* <zh/> 停止布局
|
|
912
|
+
*
|
|
913
|
+
* <en/> Stop layout
|
|
914
|
+
* @remarks
|
|
915
|
+
* <zh/> 适用于带有迭代动画的布局,目前有 `force` 属于此类布局,即停止力导布局的迭代,一般用于布局迭代时间过长情况下的手动停止迭代动画,例如在点击画布/节点的监听中调用
|
|
916
|
+
*
|
|
917
|
+
* <en/> Suitable for layouts with iterative animations. Currently, `force` belongs to this type of layout, that is, stop the iteration of the force-directed layout. It is generally used to manually stop the iteration animation when the layout iteration time is too long, such as calling in the click canvas/node listener
|
|
918
|
+
* @apiCategory layout
|
|
1915
919
|
*/
|
|
1916
|
-
public
|
|
1917
|
-
|
|
920
|
+
public stopLayout() {
|
|
921
|
+
this.context.layout!.stopLayout();
|
|
1918
922
|
}
|
|
1919
923
|
|
|
1920
924
|
/**
|
|
1921
|
-
*
|
|
1922
|
-
*
|
|
925
|
+
* <zh/> 清空画布元素
|
|
926
|
+
*
|
|
927
|
+
* <en/> Clear canvas elements
|
|
928
|
+
* @apiCategory canvas
|
|
1923
929
|
*/
|
|
1924
|
-
public
|
|
1925
|
-
this.
|
|
1926
|
-
this.
|
|
930
|
+
public async clear(): Promise<void> {
|
|
931
|
+
this.context.model.setData({});
|
|
932
|
+
await this.draw();
|
|
1927
933
|
}
|
|
1928
934
|
|
|
1929
935
|
/**
|
|
1930
|
-
*
|
|
1931
|
-
*
|
|
1932
|
-
*
|
|
1933
|
-
* @
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
}
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
936
|
+
* <zh/> 销毁当前图实例
|
|
937
|
+
*
|
|
938
|
+
* <en/> Destroy the current graph instance
|
|
939
|
+
* @apiCategory instance
|
|
940
|
+
*/
|
|
941
|
+
public destroy(): void {
|
|
942
|
+
emit(this, new GraphLifeCycleEvent(GraphEvent.BEFORE_DESTROY));
|
|
943
|
+
|
|
944
|
+
const { layout, animation, element, model, canvas, behavior, plugin } = this.context;
|
|
945
|
+
plugin?.destroy();
|
|
946
|
+
behavior?.destroy();
|
|
947
|
+
layout?.destroy();
|
|
948
|
+
animation?.destroy();
|
|
949
|
+
element?.destroy();
|
|
950
|
+
model.destroy();
|
|
951
|
+
canvas?.destroy();
|
|
952
|
+
this.options = {};
|
|
953
|
+
// @ts-expect-error force delete
|
|
954
|
+
this.context = {};
|
|
955
|
+
|
|
956
|
+
this.off();
|
|
957
|
+
window.removeEventListener('resize', this.onResize);
|
|
958
|
+
|
|
959
|
+
this.destroyed = true;
|
|
960
|
+
|
|
961
|
+
emit(this, new GraphLifeCycleEvent(GraphEvent.AFTER_DESTROY));
|
|
1954
962
|
}
|
|
963
|
+
|
|
1955
964
|
/**
|
|
1956
|
-
*
|
|
1957
|
-
*
|
|
1958
|
-
*
|
|
1959
|
-
* @returns
|
|
1960
|
-
* @
|
|
965
|
+
* <zh/> 获取画布实例
|
|
966
|
+
*
|
|
967
|
+
* <en/> Get canvas instance
|
|
968
|
+
* @returns - <zh/> 画布实例 | <en/> canvas instance
|
|
969
|
+
* @apiCategory canvas
|
|
1961
970
|
*/
|
|
1962
|
-
public
|
|
1963
|
-
|
|
1964
|
-
this.hooks.behaviorchange.emit({
|
|
1965
|
-
action: 'remove',
|
|
1966
|
-
modes: modesArr,
|
|
1967
|
-
behaviors: behaviorKeys,
|
|
1968
|
-
});
|
|
1969
|
-
// update the graph specification
|
|
1970
|
-
modesArr.forEach((mode) => {
|
|
1971
|
-
behaviorKeys.forEach((key) => {
|
|
1972
|
-
const oldBehavior = this.specification.modes[mode].find(
|
|
1973
|
-
(behavior) => isObject(behavior) && behavior.key === key,
|
|
1974
|
-
);
|
|
1975
|
-
const indexOfOldBehavior =
|
|
1976
|
-
this.specification.modes[mode].indexOf(oldBehavior);
|
|
1977
|
-
this.specification.modes[mode].splice(indexOfOldBehavior, 1);
|
|
1978
|
-
});
|
|
1979
|
-
});
|
|
971
|
+
public getCanvas(): Canvas {
|
|
972
|
+
return this.context.canvas;
|
|
1980
973
|
}
|
|
1981
974
|
|
|
1982
975
|
/**
|
|
1983
|
-
*
|
|
1984
|
-
*
|
|
1985
|
-
*
|
|
1986
|
-
* @
|
|
1987
|
-
* @group Interaction
|
|
976
|
+
* <zh/> 调整画布大小为图容器大小
|
|
977
|
+
*
|
|
978
|
+
* <en/> Resize the canvas to the size of the graph container
|
|
979
|
+
* @apiCategory viewport
|
|
1988
980
|
*/
|
|
1989
|
-
public
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
/**
|
|
2006
|
-
* Add plugin(s) to graph.
|
|
2007
|
-
* @param pluginCfgs
|
|
2008
|
-
* @returns
|
|
2009
|
-
* @group Plugin
|
|
2010
|
-
*/
|
|
2011
|
-
public addPlugins(
|
|
2012
|
-
pluginCfgs: (
|
|
2013
|
-
| {
|
|
2014
|
-
key: string;
|
|
2015
|
-
type: string;
|
|
2016
|
-
[cfgName: string]: unknown; // TODO: configs from plugins
|
|
2017
|
-
}
|
|
2018
|
-
| string
|
|
2019
|
-
)[],
|
|
2020
|
-
) {
|
|
2021
|
-
const pluginsArr = isArray(pluginCfgs) ? pluginCfgs : [pluginCfgs];
|
|
2022
|
-
|
|
2023
|
-
// update the graph specification
|
|
2024
|
-
if (!this.specification.plugins) this.specification.plugins = [];
|
|
2025
|
-
const oldPlugins = this.specification.plugins;
|
|
2026
|
-
const validPlugins: (
|
|
2027
|
-
| {
|
|
2028
|
-
key: string;
|
|
2029
|
-
type: string;
|
|
2030
|
-
[cfgName: string]: unknown; // TODO: configs from plugins
|
|
2031
|
-
}
|
|
2032
|
-
| string
|
|
2033
|
-
)[] = [];
|
|
2034
|
-
pluginsArr.forEach((config) => {
|
|
2035
|
-
const oldPlugin = oldPlugins.find((oldPlugin) => {
|
|
2036
|
-
if (typeof oldPlugin === 'string' || typeof config === 'string')
|
|
2037
|
-
return false;
|
|
2038
|
-
return oldPlugin.key === config.key;
|
|
2039
|
-
});
|
|
2040
|
-
if (oldPlugin) {
|
|
2041
|
-
console.warn(
|
|
2042
|
-
`Add plugin with key ${
|
|
2043
|
-
(config as any).key
|
|
2044
|
-
} failed, the key is duplicated to the existing plugins on the graph.`,
|
|
2045
|
-
);
|
|
2046
|
-
return;
|
|
2047
|
-
}
|
|
2048
|
-
validPlugins.push(config);
|
|
2049
|
-
});
|
|
2050
|
-
this.specification.plugins = oldPlugins.concat(validPlugins);
|
|
2051
|
-
|
|
2052
|
-
this.hooks.pluginchange.emit({
|
|
2053
|
-
action: 'add',
|
|
2054
|
-
plugins: validPlugins,
|
|
2055
|
-
});
|
|
981
|
+
public resize(): void;
|
|
982
|
+
/**
|
|
983
|
+
* <zh/> 调整画布大小为指定宽高
|
|
984
|
+
*
|
|
985
|
+
* <en/> Resize the canvas to the specified width and height
|
|
986
|
+
* @param width - <zh/> 宽度 | <en/> width
|
|
987
|
+
* @param height - <zh/> 高度 | <en/> height
|
|
988
|
+
* @apiCategory viewport
|
|
989
|
+
*/
|
|
990
|
+
public resize(width: number, height: number): void;
|
|
991
|
+
public resize(width?: number, height?: number): void {
|
|
992
|
+
const size: Vector2 = !width || !height ? sizeOf(this.context.canvas!.getContainer()!) : [width, height];
|
|
993
|
+
if (isEqual(size, this.getSize())) return;
|
|
994
|
+
emit(this, new GraphLifeCycleEvent(GraphEvent.BEFORE_SIZE_CHANGE, { size }));
|
|
995
|
+
this.context.canvas.resize(...size);
|
|
996
|
+
emit(this, new GraphLifeCycleEvent(GraphEvent.AFTER_SIZE_CHANGE, { size }));
|
|
2056
997
|
}
|
|
2057
998
|
|
|
2058
999
|
/**
|
|
2059
|
-
*
|
|
2060
|
-
*
|
|
2061
|
-
*
|
|
2062
|
-
* @
|
|
1000
|
+
* <zh/> 将图缩放至合适大小并平移至视口中心
|
|
1001
|
+
*
|
|
1002
|
+
* <en/> Zoom the graph to fit the viewport and move it to the center of the viewport
|
|
1003
|
+
* @param options - <zh/> 适配配置 | <en/> fit options
|
|
1004
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
1005
|
+
* @apiCategory viewport
|
|
2063
1006
|
*/
|
|
2064
|
-
public
|
|
2065
|
-
|
|
2066
|
-
this.hooks.pluginchange.emit({
|
|
2067
|
-
action: 'remove',
|
|
2068
|
-
plugins: pluginArr,
|
|
2069
|
-
});
|
|
2070
|
-
// update the graph specification
|
|
2071
|
-
const { plugins } = this.specification;
|
|
2072
|
-
this.specification.plugins = plugins?.filter((plugin) => {
|
|
2073
|
-
if (isObject(plugin))
|
|
2074
|
-
return !(
|
|
2075
|
-
pluginArr.includes(plugin.key) ||
|
|
2076
|
-
pluginArr.includes(plugin as PluginBase)
|
|
2077
|
-
);
|
|
2078
|
-
return !pluginArr.includes(plugin);
|
|
2079
|
-
});
|
|
1007
|
+
public async fitView(options?: FitViewOptions, animation?: ViewportAnimationEffectTiming): Promise<void> {
|
|
1008
|
+
await this.context.viewport?.fitView(options, animation);
|
|
2080
1009
|
}
|
|
2081
1010
|
|
|
2082
1011
|
/**
|
|
2083
|
-
*
|
|
2084
|
-
*
|
|
2085
|
-
*
|
|
2086
|
-
* @
|
|
1012
|
+
* <zh/> 将图平移至视口中心
|
|
1013
|
+
*
|
|
1014
|
+
* <en/> Move the graph to the center of the viewport
|
|
1015
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
1016
|
+
* @apiCategory viewport
|
|
2087
1017
|
*/
|
|
2088
|
-
public
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
key: string;
|
|
2092
|
-
type: string;
|
|
2093
|
-
[cfg: string]: unknown;
|
|
2094
|
-
}
|
|
2095
|
-
| PluginBase,
|
|
2096
|
-
) {
|
|
2097
|
-
const { plugins } = this.specification;
|
|
2098
|
-
const { key } = plugin;
|
|
2099
|
-
if (!key) {
|
|
2100
|
-
console.warn(
|
|
2101
|
-
'Update plugin failed, the key for the plugin to be updated should be assign.',
|
|
2102
|
-
);
|
|
2103
|
-
return;
|
|
2104
|
-
}
|
|
2105
|
-
if (!plugins) {
|
|
2106
|
-
console.warn(
|
|
2107
|
-
'Update plugin failed, the plugin to be updated does not exist.',
|
|
2108
|
-
);
|
|
2109
|
-
return;
|
|
2110
|
-
}
|
|
2111
|
-
const oldPlugin = plugins?.find((p) => {
|
|
2112
|
-
if (typeof p === 'string') return p === key;
|
|
2113
|
-
return p.key === key;
|
|
2114
|
-
});
|
|
2115
|
-
if (!oldPlugin) {
|
|
2116
|
-
console.warn(
|
|
2117
|
-
'Update plugin failed, the key for the plugin to be updated should be assign.',
|
|
2118
|
-
);
|
|
2119
|
-
return;
|
|
2120
|
-
}
|
|
2121
|
-
const idx = plugins.indexOf(oldPlugin);
|
|
2122
|
-
plugins[idx] = {
|
|
2123
|
-
// TODO: update type define.
|
|
2124
|
-
// @ts-ignore
|
|
2125
|
-
...oldPlugin,
|
|
2126
|
-
...plugin,
|
|
2127
|
-
};
|
|
1018
|
+
public async fitCenter(animation?: ViewportAnimationEffectTiming): Promise<void> {
|
|
1019
|
+
await this.context.viewport?.fitCenter(animation);
|
|
1020
|
+
}
|
|
2128
1021
|
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
1022
|
+
private async autoFit(): Promise<void> {
|
|
1023
|
+
const { autoFit } = this.context.options;
|
|
1024
|
+
if (!autoFit) return;
|
|
1025
|
+
|
|
1026
|
+
if (isString(autoFit)) {
|
|
1027
|
+
if (autoFit === 'view') await this.fitView();
|
|
1028
|
+
else if (autoFit === 'center') await this.fitCenter();
|
|
1029
|
+
} else {
|
|
1030
|
+
const { type, animation } = autoFit;
|
|
1031
|
+
if (type === 'view') await this.fitView(autoFit.options, animation);
|
|
1032
|
+
else if (type === 'center') await this.fitCenter(animation);
|
|
1033
|
+
}
|
|
2133
1034
|
}
|
|
2134
1035
|
|
|
2135
1036
|
/**
|
|
2136
|
-
*
|
|
2137
|
-
*
|
|
2138
|
-
*
|
|
2139
|
-
* @
|
|
2140
|
-
* @
|
|
1037
|
+
* <zh/> 移动图,使得元素对齐到视口中心
|
|
1038
|
+
*
|
|
1039
|
+
* <en/> Move the graph so that the element is aligned to the center of the viewport
|
|
1040
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
1041
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
1042
|
+
* @apiCategory viewport
|
|
2141
1043
|
*/
|
|
2142
|
-
public
|
|
2143
|
-
|
|
2144
|
-
id: ID,
|
|
2145
|
-
config: {
|
|
2146
|
-
action?: 'remove' | 'add' | 'update' | undefined;
|
|
2147
|
-
/** Data to be merged into the transient item. */
|
|
2148
|
-
data?: Record<string, any>;
|
|
2149
|
-
/** Style to be merged into the transient shape. */
|
|
2150
|
-
style?: ShapeStyle;
|
|
2151
|
-
/** For type: 'edge' */
|
|
2152
|
-
drawSource?: boolean;
|
|
2153
|
-
/** For type: 'edge' */
|
|
2154
|
-
drawTarget?: boolean;
|
|
2155
|
-
/** Only shape with id in shapeIds will be cloned while type is ITEM_TYPE. If shapeIds is not assigned, the whole item will be cloned. */
|
|
2156
|
-
shapeIds?: string[];
|
|
2157
|
-
/** Whether show the shapes in shapeIds. True by default. */
|
|
2158
|
-
visible?: boolean;
|
|
2159
|
-
upsertAncestors?: boolean;
|
|
2160
|
-
},
|
|
2161
|
-
canvas?: Canvas,
|
|
2162
|
-
): DisplayObject {
|
|
2163
|
-
this.hooks.transientupdate.emit({
|
|
2164
|
-
type,
|
|
2165
|
-
id,
|
|
2166
|
-
config,
|
|
2167
|
-
canvas: canvas || this.transientCanvas,
|
|
2168
|
-
graphCore: this.dataController.graphCore,
|
|
2169
|
-
});
|
|
2170
|
-
return this.itemController.getTransient(String(id));
|
|
1044
|
+
public async focusElement(id: ID | ID[], animation?: ViewportAnimationEffectTiming): Promise<void> {
|
|
1045
|
+
await this.context.viewport?.focusElements(Array.isArray(id) ? id : [id], animation);
|
|
2171
1046
|
}
|
|
2172
1047
|
|
|
2173
|
-
// ===== download operations =====
|
|
2174
1048
|
/**
|
|
2175
|
-
*
|
|
2176
|
-
*
|
|
2177
|
-
*
|
|
2178
|
-
* @
|
|
1049
|
+
* <zh/> 基于当前缩放比例进行缩放
|
|
1050
|
+
*
|
|
1051
|
+
* <en/> Zoom based on the current zoom ratio
|
|
1052
|
+
* @param ratio - <zh/> 缩放比例 | <en/> zoom ratio
|
|
1053
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
1054
|
+
* @param origin - <zh/> 缩放中心(视口坐标) | <en/> zoom center(viewport coordinates)
|
|
1055
|
+
* @remarks
|
|
1056
|
+
* <zh/>
|
|
1057
|
+
* - ratio > 1 放大
|
|
1058
|
+
* - ratio < 1 缩小
|
|
1059
|
+
*
|
|
1060
|
+
* <en/>
|
|
1061
|
+
* - ratio > 1 zoom in
|
|
1062
|
+
* - ratio < 1 zoom out
|
|
1063
|
+
* @apiCategory viewport
|
|
2179
1064
|
*/
|
|
2180
|
-
public async
|
|
2181
|
-
|
|
2182
|
-
const canvas = this.canvas;
|
|
2183
|
-
const transientCanvas = this.transientCanvas;
|
|
2184
|
-
const rendererType = this.rendererType;
|
|
2185
|
-
|
|
2186
|
-
const pixelRatio =
|
|
2187
|
-
typeof window !== 'undefined' ? window.devicePixelRatio : 1;
|
|
2188
|
-
const width = this.getSize()[0];
|
|
2189
|
-
const height = this.getSize()[1];
|
|
2190
|
-
|
|
2191
|
-
const vContainerDOM: HTMLDivElement = createDom(
|
|
2192
|
-
'<div id="virtual-image"></div>',
|
|
2193
|
-
);
|
|
2194
|
-
const vCanvas = createCanvas(
|
|
2195
|
-
rendererType,
|
|
2196
|
-
vContainerDOM,
|
|
2197
|
-
width,
|
|
2198
|
-
height,
|
|
2199
|
-
pixelRatio,
|
|
2200
|
-
);
|
|
2201
|
-
const vCanvasContextService = vCanvas.getContextService();
|
|
2202
|
-
let bgRect;
|
|
2203
|
-
if (rendererType !== 'svg') {
|
|
2204
|
-
bgRect = new Rect({
|
|
2205
|
-
style: {
|
|
2206
|
-
x: 0,
|
|
2207
|
-
y: 0,
|
|
2208
|
-
z: -1,
|
|
2209
|
-
width: vCanvasContextService.getDomElement().width,
|
|
2210
|
-
height: vCanvasContextService.getDomElement().height,
|
|
2211
|
-
//@ts-ignore
|
|
2212
|
-
fill: backgroundCanvas.getContextService().getDomElement().style[
|
|
2213
|
-
'background-color'
|
|
2214
|
-
],
|
|
2215
|
-
},
|
|
2216
|
-
});
|
|
2217
|
-
vCanvas.appendChild(bgRect);
|
|
2218
|
-
}
|
|
2219
|
-
const backgroundClonedGroup = backgroundCanvas.getRoot().cloneNode(true);
|
|
2220
|
-
const clonedGroup = canvas.getRoot().cloneNode(true);
|
|
2221
|
-
const transientClonedGroup = transientCanvas.getRoot().cloneNode(true);
|
|
2222
|
-
vCanvas.appendChild(backgroundClonedGroup);
|
|
2223
|
-
vCanvas.appendChild(clonedGroup);
|
|
2224
|
-
vCanvas.appendChild(transientClonedGroup);
|
|
2225
|
-
vCanvas.render();
|
|
2226
|
-
|
|
2227
|
-
if (!type) type = 'image/png';
|
|
2228
|
-
let dataURL = '';
|
|
2229
|
-
await vCanvasContextService.toDataURL({ type }).then((url) => {
|
|
2230
|
-
dataURL = url;
|
|
2231
|
-
});
|
|
2232
|
-
return dataURL;
|
|
2233
|
-
}
|
|
2234
|
-
|
|
2235
|
-
/**
|
|
2236
|
-
* Asynchronously generates a Data URL representation of the full canvas content,
|
|
2237
|
-
* including background, main content, and transient canvas, with optional padding.
|
|
2238
|
-
* @param type The type of the Data URL (e.g., 'image/png', 'image/jpeg').
|
|
2239
|
-
* @param imageConfig Configuration options for the image (optional).
|
|
2240
|
-
* @returns A Promise that resolves to the Data URL string.
|
|
2241
|
-
*/
|
|
2242
|
-
public async toFullDataURL(
|
|
2243
|
-
type?: DataURLType,
|
|
2244
|
-
imageConfig?: { padding?: number | number[] },
|
|
2245
|
-
) {
|
|
2246
|
-
const backgroundCanvas = this.backgroundCanvas;
|
|
2247
|
-
const canvas = this.canvas;
|
|
2248
|
-
const transientCanvas = this.transientCanvas;
|
|
2249
|
-
const backgroundRoot = canvas.getRoot();
|
|
2250
|
-
const root = canvas.getRoot();
|
|
2251
|
-
const transientRoot = transientCanvas.getRoot();
|
|
2252
|
-
const rendererType = this.rendererType;
|
|
2253
|
-
|
|
2254
|
-
const backgroundBBox = backgroundRoot.getBBox();
|
|
2255
|
-
const BBox = root.getBBox();
|
|
2256
|
-
const transientBBox = transientRoot.getBBox();
|
|
2257
|
-
|
|
2258
|
-
let padding = imageConfig ? imageConfig.padding : undefined;
|
|
2259
|
-
if (!padding) {
|
|
2260
|
-
padding = [0, 0, 0, 0];
|
|
2261
|
-
} else if (isNumber(padding)) {
|
|
2262
|
-
padding = [padding, padding, padding, padding];
|
|
2263
|
-
}
|
|
2264
|
-
|
|
2265
|
-
const left =
|
|
2266
|
-
(transientBBox.left
|
|
2267
|
-
? backgroundBBox.left
|
|
2268
|
-
? Math.min(backgroundBBox.left, BBox.left, transientBBox.left)
|
|
2269
|
-
: Math.min(BBox.left, transientBBox.left)
|
|
2270
|
-
: BBox.left) - padding[3];
|
|
2271
|
-
const right =
|
|
2272
|
-
(transientBBox.right
|
|
2273
|
-
? backgroundBBox.right
|
|
2274
|
-
? Math.max(backgroundBBox.right, BBox.right, transientBBox.right)
|
|
2275
|
-
: Math.max(BBox.right, transientBBox.right)
|
|
2276
|
-
: BBox.right) + padding[1];
|
|
2277
|
-
const top =
|
|
2278
|
-
(transientBBox.top
|
|
2279
|
-
? backgroundBBox.top
|
|
2280
|
-
? Math.min(backgroundBBox.top, BBox.top, transientBBox.top)
|
|
2281
|
-
: Math.min(BBox.top, transientBBox.top)
|
|
2282
|
-
: BBox.top) - padding[0];
|
|
2283
|
-
const bottom =
|
|
2284
|
-
(transientBBox.bottom
|
|
2285
|
-
? backgroundBBox.bottom
|
|
2286
|
-
? Math.max(backgroundBBox.bottom, BBox.bottom, transientBBox.bottom)
|
|
2287
|
-
: Math.max(BBox.bottom, transientBBox.bottom)
|
|
2288
|
-
: BBox.bottom) + padding[2];
|
|
2289
|
-
|
|
2290
|
-
const graphCenterX = (left + right) / 2;
|
|
2291
|
-
const graphCenterY = (top + bottom) / 2;
|
|
2292
|
-
const halfX = (right - left) / 2;
|
|
2293
|
-
const halfY = (bottom - top) / 2;
|
|
2294
|
-
|
|
2295
|
-
const pixelRatio =
|
|
2296
|
-
typeof window !== 'undefined' ? window.devicePixelRatio : 1;
|
|
2297
|
-
const vWidth = halfX * 2;
|
|
2298
|
-
const vHeight = halfY * 2;
|
|
2299
|
-
const vContainerDOM: HTMLDivElement = createDom(
|
|
2300
|
-
'<div id="virtual-image"></div>',
|
|
2301
|
-
);
|
|
2302
|
-
const vCanvas = createCanvas(
|
|
2303
|
-
rendererType,
|
|
2304
|
-
vContainerDOM,
|
|
2305
|
-
vWidth,
|
|
2306
|
-
vHeight,
|
|
2307
|
-
pixelRatio,
|
|
2308
|
-
);
|
|
2309
|
-
const vCanvasContextService = vCanvas.getContextService();
|
|
2310
|
-
if (rendererType !== 'svg') {
|
|
2311
|
-
const bgRect = new Rect({
|
|
2312
|
-
style: {
|
|
2313
|
-
x: 0,
|
|
2314
|
-
y: 0,
|
|
2315
|
-
z: -1,
|
|
2316
|
-
width: vCanvasContextService.getDomElement().width,
|
|
2317
|
-
height: vCanvasContextService.getDomElement().height,
|
|
2318
|
-
//@ts-ignore
|
|
2319
|
-
fill: backgroundCanvas.getContextService().getDomElement().style[
|
|
2320
|
-
'background-color'
|
|
2321
|
-
],
|
|
2322
|
-
},
|
|
2323
|
-
});
|
|
2324
|
-
vCanvas.appendChild(bgRect);
|
|
2325
|
-
}
|
|
2326
|
-
const backgroundClonedGroup = backgroundRoot.cloneNode(true);
|
|
2327
|
-
const clonedGroup = root.cloneNode(true);
|
|
2328
|
-
const transientClonedGroup = transientRoot.cloneNode(true);
|
|
2329
|
-
const transPosition: [number, number] = [
|
|
2330
|
-
-graphCenterX + halfX,
|
|
2331
|
-
-graphCenterY + halfY,
|
|
2332
|
-
];
|
|
2333
|
-
backgroundClonedGroup.setPosition(transPosition);
|
|
2334
|
-
clonedGroup.setPosition(transPosition);
|
|
2335
|
-
transientClonedGroup.setPosition(transPosition);
|
|
2336
|
-
vCanvas.appendChild(backgroundClonedGroup);
|
|
2337
|
-
vCanvas.appendChild(clonedGroup);
|
|
2338
|
-
vCanvas.appendChild(transientClonedGroup);
|
|
2339
|
-
vCanvas.render();
|
|
2340
|
-
|
|
2341
|
-
if (!type) type = 'image/png';
|
|
2342
|
-
let dataURL = '';
|
|
2343
|
-
await vCanvasContextService.toDataURL({ type }).then((url) => {
|
|
2344
|
-
dataURL = url;
|
|
2345
|
-
});
|
|
2346
|
-
return dataURL;
|
|
1065
|
+
public async zoomBy(ratio: number, animation?: ViewportAnimationEffectTiming, origin?: Point): Promise<void> {
|
|
1066
|
+
await this.context.viewport!.transform({ mode: 'relative', scale: ratio, origin }, animation);
|
|
2347
1067
|
}
|
|
2348
1068
|
|
|
2349
1069
|
/**
|
|
2350
|
-
*
|
|
2351
|
-
*
|
|
2352
|
-
*
|
|
2353
|
-
* @param
|
|
2354
|
-
* @param
|
|
1070
|
+
* <zh/> 缩放画布至指定比例
|
|
1071
|
+
*
|
|
1072
|
+
* <en/> Zoom the canvas to the specified ratio
|
|
1073
|
+
* @param zoom - <zh/> 指定缩放比例 | <en/> specified zoom ratio
|
|
1074
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
1075
|
+
* @param origin - <zh/> 缩放中心(视口坐标) | <en/> zoom center(viewport coordinates)
|
|
1076
|
+
* @remarks
|
|
1077
|
+
* <zh/>
|
|
1078
|
+
* - zoom = 1 默认大小
|
|
1079
|
+
* - zoom > 1 放大
|
|
1080
|
+
* - zoom < 1 缩小
|
|
1081
|
+
*
|
|
1082
|
+
* <en/>
|
|
1083
|
+
* - zoom = 1 default size
|
|
1084
|
+
* - zoom > 1 zoom in
|
|
1085
|
+
* - zoom < 1 zoom out
|
|
1086
|
+
* @apiCategory viewport
|
|
2355
1087
|
*/
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
console.error(
|
|
2359
|
-
'Download image failed. The graph is too large or there is invalid attribute values in graph items',
|
|
2360
|
-
);
|
|
2361
|
-
return;
|
|
2362
|
-
}
|
|
2363
|
-
|
|
2364
|
-
if (typeof window !== 'undefined') {
|
|
2365
|
-
if (window.Blob && window.URL && renderer !== 'svg') {
|
|
2366
|
-
const arr = dataURL.split(',');
|
|
2367
|
-
let mime = '';
|
|
2368
|
-
if (arr && arr.length > 0) {
|
|
2369
|
-
const match = arr[0].match(/:(.*?);/);
|
|
2370
|
-
// eslint-disable-next-line prefer-destructuring
|
|
2371
|
-
if (match && match.length >= 2) mime = match[1];
|
|
2372
|
-
}
|
|
2373
|
-
|
|
2374
|
-
const bstr = atob(arr[1]);
|
|
2375
|
-
let n = bstr.length;
|
|
2376
|
-
const u8arr = new Uint8Array(n);
|
|
2377
|
-
|
|
2378
|
-
while (n--) {
|
|
2379
|
-
u8arr[n] = bstr.charCodeAt(n);
|
|
2380
|
-
}
|
|
2381
|
-
|
|
2382
|
-
const blobObj = new Blob([u8arr], { type: mime });
|
|
2383
|
-
|
|
2384
|
-
if ((window.navigator as any).msSaveBlob) {
|
|
2385
|
-
(window.navigator as any).msSaveBlob(blobObj, fileName);
|
|
2386
|
-
} else {
|
|
2387
|
-
link.addEventListener('click', () => {
|
|
2388
|
-
link.download = fileName;
|
|
2389
|
-
link.href = window.URL.createObjectURL(blobObj);
|
|
2390
|
-
});
|
|
2391
|
-
}
|
|
2392
|
-
} else {
|
|
2393
|
-
link.addEventListener('click', () => {
|
|
2394
|
-
link.download = fileName;
|
|
2395
|
-
link.href = dataURL;
|
|
2396
|
-
});
|
|
2397
|
-
}
|
|
2398
|
-
}
|
|
1088
|
+
public async zoomTo(zoom: number, animation?: ViewportAnimationEffectTiming, origin?: Point): Promise<void> {
|
|
1089
|
+
this.context.viewport!.transform({ mode: 'absolute', scale: zoom, origin }, animation);
|
|
2399
1090
|
}
|
|
2400
1091
|
|
|
2401
1092
|
/**
|
|
2402
|
-
*
|
|
2403
|
-
*
|
|
2404
|
-
*
|
|
1093
|
+
* <zh/> 获取当前缩放比例
|
|
1094
|
+
*
|
|
1095
|
+
* <en/> Get the current zoom ratio
|
|
1096
|
+
* @returns <zh/> 缩放比例 | <en/> zoom ratio
|
|
1097
|
+
* @apiCategory viewport
|
|
2405
1098
|
*/
|
|
2406
|
-
public
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
const rendererType = this.rendererType;
|
|
2411
|
-
if (!type) type = 'image/png';
|
|
1099
|
+
public getZoom(): number {
|
|
1100
|
+
return this.context.viewport!.getZoom();
|
|
1101
|
+
}
|
|
2412
1102
|
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
1103
|
+
/**
|
|
1104
|
+
* <zh/> 基于当前旋转角度进行旋转
|
|
1105
|
+
*
|
|
1106
|
+
* <en/> Rotate based on the current rotation angle
|
|
1107
|
+
* @param angle - <zh/> 旋转角度 | <en/> rotation angle
|
|
1108
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
1109
|
+
* @param origin - <zh/> 旋转中心(视口坐标) | <en/> rotation center(viewport coordinates)
|
|
1110
|
+
* @apiCategory viewport
|
|
1111
|
+
*/
|
|
1112
|
+
public async rotateBy(angle: number, animation?: ViewportAnimationEffectTiming, origin?: Point): Promise<void> {
|
|
1113
|
+
await this.context.viewport!.transform({ mode: 'relative', rotate: angle, origin }, animation);
|
|
1114
|
+
}
|
|
2416
1115
|
|
|
2417
|
-
|
|
1116
|
+
/**
|
|
1117
|
+
* <zh/> 旋转画布至指定角度
|
|
1118
|
+
*
|
|
1119
|
+
* <en/> Rotate the canvas to the specified angle
|
|
1120
|
+
* @param angle - <zh/> 目标角度 | <en/> target angle
|
|
1121
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
1122
|
+
* @param origin - <zh/> 旋转中心(视口坐标) | <en/> rotation center(viewport coordinates)
|
|
1123
|
+
* @apiCategory viewport
|
|
1124
|
+
*/
|
|
1125
|
+
public async rotateTo(angle: number, animation?: ViewportAnimationEffectTiming, origin?: Point): Promise<void> {
|
|
1126
|
+
await this.context.viewport!.transform({ mode: 'absolute', rotate: angle, origin }, animation);
|
|
1127
|
+
}
|
|
2418
1128
|
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
1129
|
+
/**
|
|
1130
|
+
* <zh/> 获取当前旋转角度
|
|
1131
|
+
*
|
|
1132
|
+
* <en/> Get the current rotation angle
|
|
1133
|
+
* @returns <zh/> 旋转角度 | <en/> rotation angle
|
|
1134
|
+
* @apiCategory viewport
|
|
1135
|
+
*/
|
|
1136
|
+
public getRotation(): number {
|
|
1137
|
+
return this.context.viewport!.getRotation();
|
|
2425
1138
|
}
|
|
2426
1139
|
|
|
2427
1140
|
/**
|
|
2428
|
-
*
|
|
2429
|
-
*
|
|
2430
|
-
*
|
|
2431
|
-
* @param
|
|
1141
|
+
* <zh/> 将图平移指定距离
|
|
1142
|
+
*
|
|
1143
|
+
* <en/> Translate the graph by the specified distance
|
|
1144
|
+
* @param offset - <zh/> 偏移量 | <en/> offset
|
|
1145
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
1146
|
+
* @apiCategory viewport
|
|
2432
1147
|
*/
|
|
2433
|
-
public
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
imageConfig?: { padding?: number | number[] },
|
|
2437
|
-
): void {
|
|
2438
|
-
const self = this;
|
|
1148
|
+
public async translateBy(offset: Point, animation?: ViewportAnimationEffectTiming): Promise<void> {
|
|
1149
|
+
await this.context.viewport!.transform({ mode: 'relative', translate: offset }, animation);
|
|
1150
|
+
}
|
|
2439
1151
|
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
1152
|
+
/**
|
|
1153
|
+
* <zh/> 将图平移至指定位置
|
|
1154
|
+
*
|
|
1155
|
+
* <en/> Translate the graph to the specified position
|
|
1156
|
+
* @param position - <zh/> 指定位置 | <en/> specified position
|
|
1157
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
1158
|
+
* @apiCategory viewport
|
|
1159
|
+
*/
|
|
1160
|
+
public async translateTo(position: Point, animation?: ViewportAnimationEffectTiming): Promise<void> {
|
|
1161
|
+
await this.context.viewport!.transform({ mode: 'absolute', translate: position }, animation);
|
|
1162
|
+
}
|
|
2446
1163
|
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
1164
|
+
/**
|
|
1165
|
+
* <zh/> 获取图的位置
|
|
1166
|
+
*
|
|
1167
|
+
* <en/> Get the position of the graph
|
|
1168
|
+
* @returns <zh/> 图的位置 | <en/> position of the graph
|
|
1169
|
+
* @remarks
|
|
1170
|
+
* <zh/> 默认状态下,图的位置为 [0, 0]
|
|
1171
|
+
*
|
|
1172
|
+
* <en/> By default, the position of the graph is [0, 0]
|
|
1173
|
+
* @apiCategory viewport
|
|
1174
|
+
*/
|
|
1175
|
+
public getPosition(): Point {
|
|
1176
|
+
return subtract([0, 0], this.getCanvasByViewport([0, 0]));
|
|
2453
1177
|
}
|
|
2454
1178
|
|
|
2455
1179
|
/**
|
|
2456
|
-
*
|
|
2457
|
-
*
|
|
2458
|
-
*
|
|
1180
|
+
* <zh/> 将元素平移指定距离
|
|
1181
|
+
*
|
|
1182
|
+
* <en/> Translate the element by the specified distance
|
|
1183
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
1184
|
+
* @param offset - <zh/> 偏移量 | <en/> offset
|
|
1185
|
+
* @param animation - <zh/> 是否启用动画 | <en/> whether to enable animation
|
|
1186
|
+
* @apiCategory element
|
|
2459
1187
|
*/
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
1188
|
+
public async translateElementBy(id: ID, offset: Position, animation?: boolean): Promise<void>;
|
|
1189
|
+
/**
|
|
1190
|
+
* <zh/> 批量将元素平移指定距离
|
|
1191
|
+
*
|
|
1192
|
+
* <en/> Batch translate elements by the specified distance
|
|
1193
|
+
* @param offsets - <zh/> 偏移量配置 | <en/> offset configuration
|
|
1194
|
+
* @param animation - <zh/> 是否启用动画 | <en/> whether to enable animation
|
|
1195
|
+
* @apiCategory element
|
|
1196
|
+
*/
|
|
1197
|
+
public async translateElementBy(offsets: Record<ID, Position>, animation?: boolean): Promise<void>;
|
|
1198
|
+
public async translateElementBy(
|
|
1199
|
+
args1: ID | Record<ID, Position>,
|
|
1200
|
+
args2?: Position | boolean,
|
|
1201
|
+
args3: boolean = true,
|
|
1202
|
+
): Promise<void> {
|
|
1203
|
+
const [config, animation] = isObject(args1)
|
|
1204
|
+
? [args1, (args2 as boolean) ?? true]
|
|
1205
|
+
: [{ [args1 as ID]: args2 as Position }, args3];
|
|
2463
1206
|
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
dataURL = url;
|
|
2467
|
-
});
|
|
2468
|
-
if (callback) callback(dataURL);
|
|
2469
|
-
}, 16);
|
|
1207
|
+
Object.entries(config).forEach(([id, offset]) => this.context.model.translateNodeBy(id, offset));
|
|
1208
|
+
await this.context.element!.draw({ animation })?.finished;
|
|
2470
1209
|
}
|
|
2471
1210
|
|
|
2472
1211
|
/**
|
|
2473
|
-
*
|
|
2474
|
-
*
|
|
2475
|
-
*
|
|
2476
|
-
* @param
|
|
2477
|
-
* @param
|
|
1212
|
+
* <zh/> 将元素平移至指定位置
|
|
1213
|
+
*
|
|
1214
|
+
* <en/> Translate the element to the specified position
|
|
1215
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
1216
|
+
* @param position - <zh/> 指定位置 | <en/> specified position
|
|
1217
|
+
* @param animation - <zh/> 是否启用动画 | <en/> whether to enable animation
|
|
1218
|
+
* @apiCategory element
|
|
2478
1219
|
*/
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
1220
|
+
public async translateElementTo(id: ID, position: Position, animation?: boolean): Promise<void>;
|
|
1221
|
+
/**
|
|
1222
|
+
* <zh/> 批量将元素平移至指定位置
|
|
1223
|
+
*
|
|
1224
|
+
* <en/> Batch translate elements to the specified position
|
|
1225
|
+
* @param positions - <zh/> 位置配置 | <en/> position configuration
|
|
1226
|
+
* @param animation - <zh/> 是否启用动画 | <en/> whether to enable animation
|
|
1227
|
+
* @apiCategory element
|
|
1228
|
+
*/
|
|
1229
|
+
public async translateElementTo(positions: Record<ID, Position>, animation?: boolean): Promise<void>;
|
|
1230
|
+
public async translateElementTo(
|
|
1231
|
+
args1: ID | Record<ID, Position>,
|
|
1232
|
+
args2?: boolean | Position,
|
|
1233
|
+
args3: boolean = true,
|
|
1234
|
+
): Promise<void> {
|
|
1235
|
+
const [config, animation] = isObject(args1)
|
|
1236
|
+
? [args1, (args2 as boolean) ?? true]
|
|
1237
|
+
: [{ [args1 as ID]: args2 as Position }, args3];
|
|
2486
1238
|
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
dataURL = url;
|
|
2490
|
-
});
|
|
2491
|
-
if (callback) callback(dataURL);
|
|
2492
|
-
}, 16);
|
|
1239
|
+
Object.entries(config).forEach(([id, position]) => this.context.model.translateNodeTo(id, position));
|
|
1240
|
+
await this.context.element!.draw({ animation })?.finished;
|
|
2493
1241
|
}
|
|
2494
1242
|
|
|
2495
|
-
// ===== history operations =====
|
|
2496
|
-
|
|
2497
1243
|
/**
|
|
2498
|
-
*
|
|
1244
|
+
* <zh/> 获取元素位置
|
|
1245
|
+
*
|
|
1246
|
+
* <en/> Get element position
|
|
1247
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
1248
|
+
* @returns <zh/> 元素位置 | <en/> element position
|
|
1249
|
+
* @apiCategory element
|
|
2499
1250
|
*/
|
|
2500
|
-
public
|
|
2501
|
-
|
|
2502
|
-
return history?.isEnable();
|
|
1251
|
+
public getElementPosition(id: ID): Position {
|
|
1252
|
+
return this.context.model.getElementPosition(id);
|
|
2503
1253
|
}
|
|
2504
1254
|
|
|
2505
1255
|
/**
|
|
2506
|
-
*
|
|
2507
|
-
*
|
|
2508
|
-
*
|
|
2509
|
-
* @param
|
|
1256
|
+
* <zh/> 获取元素渲染样式
|
|
1257
|
+
*
|
|
1258
|
+
* <en/> Get element rendering style
|
|
1259
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
1260
|
+
* @returns <zh/> 元素渲染样式 | <en/> element rendering style
|
|
1261
|
+
* @apiCategory element
|
|
2510
1262
|
*/
|
|
2511
|
-
public
|
|
2512
|
-
|
|
2513
|
-
return history?.push(cmd, stackType, isNew);
|
|
1263
|
+
public getElementRenderStyle(id: ID) {
|
|
1264
|
+
return omit(this.context.element!.getElement(id)!.attributes, ['context']);
|
|
2514
1265
|
}
|
|
2515
1266
|
|
|
2516
1267
|
/**
|
|
2517
|
-
*
|
|
1268
|
+
* <zh/> 设置元素可见性
|
|
1269
|
+
*
|
|
1270
|
+
* <en/> Set element visibility
|
|
1271
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
1272
|
+
* @param visibility - <zh/> 可见性 | <en/> visibility
|
|
1273
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
1274
|
+
* @apiCategory element
|
|
2518
1275
|
*/
|
|
2519
|
-
public
|
|
2520
|
-
|
|
2521
|
-
|
|
1276
|
+
public async setElementVisibility(
|
|
1277
|
+
id: ID,
|
|
1278
|
+
visibility: BaseStyleProps['visibility'],
|
|
1279
|
+
animation?: boolean,
|
|
1280
|
+
): Promise<void>;
|
|
1281
|
+
/**
|
|
1282
|
+
* <zh/> 批量设置元素可见性
|
|
1283
|
+
*
|
|
1284
|
+
* <en/> Batch set element visibility
|
|
1285
|
+
* @param visibility - <zh/> 可见性配置 | <en/> visibility configuration
|
|
1286
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
1287
|
+
* @apiCategory element
|
|
1288
|
+
*/
|
|
1289
|
+
public async setElementVisibility(
|
|
1290
|
+
visibility: Record<ID, BaseStyleProps['visibility']>,
|
|
1291
|
+
animation?: boolean,
|
|
1292
|
+
): Promise<void>;
|
|
1293
|
+
public async setElementVisibility(
|
|
1294
|
+
args1: ID | Record<ID, BaseStyleProps['visibility']>,
|
|
1295
|
+
args2?: boolean | BaseStyleProps['visibility'],
|
|
1296
|
+
args3: boolean = true,
|
|
1297
|
+
): Promise<void> {
|
|
1298
|
+
const [config, animation] = isObject(args1)
|
|
1299
|
+
? [args1, (args2 as boolean) ?? true]
|
|
1300
|
+
: [{ [args1]: args2 as BaseStyleProps['visibility'] }, args3];
|
|
1301
|
+
|
|
1302
|
+
const dataToUpdate: Required<PartialGraphData> = { nodes: [], edges: [], combos: [] };
|
|
1303
|
+
Object.entries(config).forEach(([id, value]) => {
|
|
1304
|
+
const elementType = this.getElementType(id);
|
|
1305
|
+
dataToUpdate[`${elementType}s`].push({ id, style: { visibility: value } });
|
|
1306
|
+
});
|
|
1307
|
+
|
|
1308
|
+
const { model, element } = this.context;
|
|
1309
|
+
model.preventUpdateNodeLikeHierarchy(() => {
|
|
1310
|
+
model.updateData(dataToUpdate);
|
|
1311
|
+
});
|
|
1312
|
+
await element!.draw({ animation, stage: 'visibility' })?.finished;
|
|
2522
1313
|
}
|
|
2523
1314
|
|
|
2524
1315
|
/**
|
|
2525
|
-
*
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
1316
|
+
* <zh/> 显示元素
|
|
1317
|
+
*
|
|
1318
|
+
* <en/> Show element
|
|
1319
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
1320
|
+
* @param animation - <zh/> 是否启用动画 | <en/> whether to enable animation
|
|
1321
|
+
* @apiCategory element
|
|
1322
|
+
*/
|
|
1323
|
+
public async showElement(id: ID | ID[], animation?: boolean): Promise<void> {
|
|
1324
|
+
const ids = Array.isArray(id) ? id : [id];
|
|
1325
|
+
await this.setElementVisibility(
|
|
1326
|
+
Object.fromEntries(ids.map((_id) => [_id, 'visible'] as [ID, BaseStyleProps['visibility']])),
|
|
1327
|
+
animation,
|
|
1328
|
+
);
|
|
2530
1329
|
}
|
|
2531
1330
|
|
|
2532
1331
|
/**
|
|
2533
|
-
*
|
|
2534
|
-
*
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
1332
|
+
* <zh/> 隐藏元素
|
|
1333
|
+
*
|
|
1334
|
+
* <en/> Hide element
|
|
1335
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
1336
|
+
* @param animation - <zh/> 是否启用动画 | <en/> whether to enable animation
|
|
1337
|
+
* @apiCategory element
|
|
1338
|
+
*/
|
|
1339
|
+
public async hideElement(id: ID | ID[], animation?: boolean): Promise<void> {
|
|
1340
|
+
const ids = Array.isArray(id) ? id : [id];
|
|
1341
|
+
await this.setElementVisibility(
|
|
1342
|
+
Object.fromEntries(ids.map((_id) => [_id, 'hidden'] as [ID, BaseStyleProps['visibility']])),
|
|
1343
|
+
animation,
|
|
1344
|
+
);
|
|
1345
|
+
}
|
|
2545
1346
|
|
|
2546
1347
|
/**
|
|
2547
|
-
*
|
|
1348
|
+
* <zh/> 获取元素可见性
|
|
1349
|
+
*
|
|
1350
|
+
* <en/> Get element visibility
|
|
1351
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
1352
|
+
* @returns <zh/> 元素可见性 | <en/> element visibility
|
|
1353
|
+
* @apiCategory element
|
|
2548
1354
|
*/
|
|
2549
|
-
public
|
|
2550
|
-
const
|
|
2551
|
-
return
|
|
1355
|
+
public getElementVisibility(id: ID): BaseStyleProps['visibility'] {
|
|
1356
|
+
const element = this.context.element!.getElement(id)!;
|
|
1357
|
+
return element?.style?.visibility ?? 'visible';
|
|
2552
1358
|
}
|
|
2553
1359
|
|
|
2554
1360
|
/**
|
|
2555
|
-
*
|
|
1361
|
+
* <zh/> 设置元素层级
|
|
1362
|
+
*
|
|
1363
|
+
* <en/> Set element z-index
|
|
1364
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
1365
|
+
* @param zIndex - <zh/> 层级 | <en/> z-index
|
|
1366
|
+
* @apiCategory element
|
|
2556
1367
|
*/
|
|
2557
|
-
public
|
|
2558
|
-
|
|
2559
|
-
|
|
1368
|
+
public async setElementZIndex(id: ID, zIndex: number): Promise<void>;
|
|
1369
|
+
/**
|
|
1370
|
+
* <zh/> 批量设置元素层级
|
|
1371
|
+
*
|
|
1372
|
+
* <en/> Batch set element z-index
|
|
1373
|
+
* @param zIndex - <zh/> 层级配置 | <en/> z-index configuration
|
|
1374
|
+
* @apiCategory element
|
|
1375
|
+
*/
|
|
1376
|
+
public async setElementZIndex(zIndex: Record<ID, number>): Promise<void>;
|
|
1377
|
+
public async setElementZIndex(args1: ID | Record<ID, number>, args2?: number): Promise<void> {
|
|
1378
|
+
const dataToUpdate: Required<PartialGraphData> = { nodes: [], edges: [], combos: [] };
|
|
1379
|
+
const config = isObject(args1) ? args1 : { [args1 as ID]: args2 as number };
|
|
1380
|
+
|
|
1381
|
+
Object.entries(config).forEach(([id, value]) => {
|
|
1382
|
+
const elementType = this.getElementType(id);
|
|
1383
|
+
dataToUpdate[`${elementType}s`].push({ id, style: { zIndex: value } });
|
|
1384
|
+
});
|
|
1385
|
+
|
|
1386
|
+
const { model, element } = this.context;
|
|
1387
|
+
model.preventUpdateNodeLikeHierarchy(() => model.updateData(dataToUpdate));
|
|
1388
|
+
await element!.draw({ animation: false })?.finished;
|
|
2560
1389
|
}
|
|
2561
1390
|
|
|
2562
1391
|
/**
|
|
2563
|
-
*
|
|
2564
|
-
*
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
1392
|
+
* <zh/> 将元素置于最顶层
|
|
1393
|
+
*
|
|
1394
|
+
* <en/> Bring the element to the front
|
|
1395
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
1396
|
+
* @apiCategory element
|
|
1397
|
+
*/
|
|
1398
|
+
public async frontElement(id: ID | ID[]): Promise<void> {
|
|
1399
|
+
const ids = Array.isArray(id) ? id : [id];
|
|
1400
|
+
const { model } = this.context;
|
|
1401
|
+
const config: Record<ID, number> = {};
|
|
1402
|
+
|
|
1403
|
+
ids.map((_id) => {
|
|
1404
|
+
const zIndex = model.getFrontZIndex(_id);
|
|
1405
|
+
const elementType = model.getElementType(_id);
|
|
1406
|
+
if (elementType === 'combo') {
|
|
1407
|
+
const ancestor = model.getAncestorsData(_id, COMBO_KEY).at(-1) || this.getComboData(_id);
|
|
1408
|
+
const combos = [ancestor, ...model.getDescendantsData(idOf(ancestor))].filter((datum) =>
|
|
1409
|
+
model.isCombo(idOf(datum)),
|
|
1410
|
+
);
|
|
1411
|
+
const delta = zIndex - zIndexOf(ancestor);
|
|
1412
|
+
combos.forEach((combo) => {
|
|
1413
|
+
config[idOf(combo)] = zIndexOf(combo) + delta;
|
|
1414
|
+
});
|
|
1415
|
+
} else config[_id] = zIndex;
|
|
1416
|
+
});
|
|
1417
|
+
|
|
1418
|
+
await this.setElementZIndex(config);
|
|
2569
1419
|
}
|
|
2570
1420
|
|
|
2571
1421
|
/**
|
|
2572
|
-
*
|
|
2573
|
-
*
|
|
2574
|
-
*
|
|
1422
|
+
* <zh/> 获取元素层级
|
|
1423
|
+
*
|
|
1424
|
+
* <en/> Get element z-index
|
|
1425
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
1426
|
+
* @returns <zh/> 元素层级 | <en/> element z-index
|
|
1427
|
+
* @apiCategory element
|
|
2575
1428
|
*/
|
|
2576
|
-
public
|
|
2577
|
-
|
|
2578
|
-
history?.undo();
|
|
1429
|
+
public getElementZIndex(id: ID): number {
|
|
1430
|
+
return zIndexOf(this.context.model.getElementDataById(id));
|
|
2579
1431
|
}
|
|
2580
1432
|
|
|
2581
1433
|
/**
|
|
2582
|
-
*
|
|
2583
|
-
*
|
|
2584
|
-
*
|
|
1434
|
+
* <zh/> 设置元素状态
|
|
1435
|
+
*
|
|
1436
|
+
* <en/> Set element state
|
|
1437
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
1438
|
+
* @param state - <zh/> 状态 | <en/> state
|
|
1439
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
1440
|
+
* @apiCategory element
|
|
2585
1441
|
*/
|
|
2586
|
-
public
|
|
2587
|
-
|
|
2588
|
-
|
|
1442
|
+
public async setElementState(id: ID, state: State | State[], animation?: boolean): Promise<void>;
|
|
1443
|
+
/**
|
|
1444
|
+
* <zh/> 批量设置元素状态
|
|
1445
|
+
*
|
|
1446
|
+
* <en/> Batch set element state
|
|
1447
|
+
* @param state - <zh/> 状态配置 | <en/> state configuration
|
|
1448
|
+
* @param animation - <zh/> 动画配置 | <en/> animation configuration
|
|
1449
|
+
* @apiCategory element
|
|
1450
|
+
*/
|
|
1451
|
+
public async setElementState(state: Record<ID, State | State[]>, animation?: boolean): Promise<void>;
|
|
1452
|
+
public async setElementState(
|
|
1453
|
+
args1: ID | Record<ID, State | State[]>,
|
|
1454
|
+
args2?: boolean | State | State[],
|
|
1455
|
+
args3: boolean = true,
|
|
1456
|
+
): Promise<void> {
|
|
1457
|
+
const [config, animation] = isObject(args1)
|
|
1458
|
+
? [args1, (args2 as boolean) ?? true]
|
|
1459
|
+
: [{ [args1]: args2 as State | State[] }, args3];
|
|
1460
|
+
|
|
1461
|
+
const parseState = (state: State | State[]) => {
|
|
1462
|
+
if (!state) return [];
|
|
1463
|
+
return Array.isArray(state) ? state : [state];
|
|
1464
|
+
};
|
|
1465
|
+
|
|
1466
|
+
const dataToUpdate: Required<PartialGraphData> = { nodes: [], edges: [], combos: [] };
|
|
1467
|
+
Object.entries(config).forEach(([id, value]) => {
|
|
1468
|
+
const elementType = this.getElementType(id);
|
|
1469
|
+
dataToUpdate[`${elementType}s`].push({ id, states: parseState(value) });
|
|
1470
|
+
});
|
|
1471
|
+
this.updateData(dataToUpdate);
|
|
1472
|
+
|
|
1473
|
+
await this.context.element!.draw({ animation })?.finished;
|
|
2589
1474
|
}
|
|
2590
1475
|
|
|
2591
1476
|
/**
|
|
2592
|
-
*
|
|
1477
|
+
* <zh/> 获取元素状态
|
|
1478
|
+
*
|
|
1479
|
+
* <en/> Get element state
|
|
1480
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
1481
|
+
* @returns <zh/> 元素状态 | <en/> element state
|
|
1482
|
+
* @apiCategory element
|
|
2593
1483
|
*/
|
|
2594
|
-
public
|
|
2595
|
-
|
|
2596
|
-
return history?.canUndo();
|
|
1484
|
+
public getElementState(id: ID): State[] {
|
|
1485
|
+
return this.context.model.getElementState(id);
|
|
2597
1486
|
}
|
|
2598
1487
|
|
|
2599
1488
|
/**
|
|
2600
|
-
*
|
|
1489
|
+
* <zh/> 获取元素自身以及子节点在世界坐标系下的渲染包围盒
|
|
1490
|
+
*
|
|
1491
|
+
* <en/> Get the rendering bounding box of the element itself and its child nodes in the world coordinate system
|
|
1492
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
1493
|
+
* @returns <zh/> 渲染包围盒 | <en/> render bounding box
|
|
1494
|
+
* @apiCategory element
|
|
2601
1495
|
*/
|
|
2602
|
-
public
|
|
2603
|
-
|
|
2604
|
-
return history?.canRedo();
|
|
1496
|
+
public getElementRenderBounds(id: ID): AABB {
|
|
1497
|
+
return this.context.element!.getElement(id)!.getRenderBounds();
|
|
2605
1498
|
}
|
|
2606
1499
|
|
|
1500
|
+
private isCollapsingExpanding = false;
|
|
1501
|
+
|
|
2607
1502
|
/**
|
|
2608
|
-
*
|
|
2609
|
-
*
|
|
2610
|
-
*
|
|
1503
|
+
* <zh/> 收起 Combo
|
|
1504
|
+
*
|
|
1505
|
+
* <en/> Collapse Combo
|
|
1506
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
1507
|
+
* @param animation - <zh/> 是否启用动画 | <en/> whether to enable animation
|
|
1508
|
+
* @apiCategory element
|
|
2611
1509
|
*/
|
|
2612
|
-
public
|
|
2613
|
-
const
|
|
2614
|
-
|
|
1510
|
+
public async collapseElement(id: ID, animation: boolean = true): Promise<void> {
|
|
1511
|
+
const { model, element } = this.context;
|
|
1512
|
+
if (isCollapsed(model.getNodeLikeData([id])[0])) return;
|
|
1513
|
+
|
|
1514
|
+
if (this.isCollapsingExpanding) return;
|
|
1515
|
+
|
|
1516
|
+
const elementType = model.getElementType(id);
|
|
1517
|
+
|
|
1518
|
+
this.isCollapsingExpanding = true;
|
|
1519
|
+
this.setElementCollapsibility(id, true);
|
|
1520
|
+
if (elementType === 'node') await element!.collapseNode(id, animation);
|
|
1521
|
+
else if (elementType === 'combo') await element!.collapseCombo(id, animation);
|
|
1522
|
+
|
|
1523
|
+
this.isCollapsingExpanding = false;
|
|
2615
1524
|
}
|
|
2616
1525
|
|
|
2617
1526
|
/**
|
|
2618
|
-
*
|
|
2619
|
-
*
|
|
2620
|
-
*
|
|
1527
|
+
* <zh/> 展开 Combo
|
|
1528
|
+
*
|
|
1529
|
+
* <en/> Expand Combo
|
|
1530
|
+
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
1531
|
+
* @param animation - <zh/> 是否启用动画 | <en/> whether to enable animation
|
|
1532
|
+
* @apiCategory element
|
|
2621
1533
|
*/
|
|
2622
|
-
public
|
|
2623
|
-
const
|
|
2624
|
-
|
|
1534
|
+
public async expandElement(id: ID, animation: boolean = true): Promise<void> {
|
|
1535
|
+
const { model, element } = this.context;
|
|
1536
|
+
if (!isCollapsed(model.getNodeLikeData([id])[0])) return;
|
|
1537
|
+
|
|
1538
|
+
if (this.isCollapsingExpanding) return;
|
|
1539
|
+
|
|
1540
|
+
const elementType = model.getElementType(id);
|
|
1541
|
+
|
|
1542
|
+
this.isCollapsingExpanding = true;
|
|
1543
|
+
this.setElementCollapsibility(id, false);
|
|
1544
|
+
if (elementType === 'node') await element!.expandNode(id, animation);
|
|
1545
|
+
else if (elementType === 'combo') await element!.expandCombo(id, animation);
|
|
1546
|
+
|
|
1547
|
+
this.isCollapsingExpanding = false;
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
private setElementCollapsibility(id: ID, collapsed: boolean) {
|
|
1551
|
+
const elementType = this.getElementType(id);
|
|
1552
|
+
if (elementType === 'node') this.updateNodeData([{ id, style: { collapsed } }]);
|
|
1553
|
+
else if (elementType === 'combo') this.updateComboData([{ id, style: { collapsed } }]);
|
|
2625
1554
|
}
|
|
2626
1555
|
|
|
2627
1556
|
/**
|
|
2628
|
-
*
|
|
2629
|
-
*
|
|
2630
|
-
*
|
|
2631
|
-
* @param
|
|
1557
|
+
* <zh/> 导出画布内容为 DataURL
|
|
1558
|
+
*
|
|
1559
|
+
* <en/> Export canvas content as DataURL
|
|
1560
|
+
* @param options - <zh/> 导出配置 | <en/> export configuration
|
|
1561
|
+
* @returns <zh/> DataURL | <en/> DataURL
|
|
1562
|
+
* @apiCategory exportImage
|
|
2632
1563
|
*/
|
|
2633
|
-
public
|
|
2634
|
-
|
|
2635
|
-
history?.historyBatch(callback);
|
|
1564
|
+
public async toDataURL(options: Partial<DataURLOptions> = {}): Promise<string> {
|
|
1565
|
+
return this.context.canvas!.toDataURL(options);
|
|
2636
1566
|
}
|
|
2637
1567
|
|
|
2638
1568
|
/**
|
|
2639
|
-
*
|
|
2640
|
-
*
|
|
1569
|
+
* <zh/> 给定的视窗 DOM 坐标,转换为画布上的绘制坐标
|
|
1570
|
+
*
|
|
1571
|
+
* <en/> Convert the given viewport DOM coordinates to the drawing coordinates on the canvas
|
|
1572
|
+
* @param point - <zh/> 视窗坐标 | <en/> viewport coordinates
|
|
1573
|
+
* @returns <zh/> 画布上的绘制坐标 | <en/> drawing coordinates on the canvas
|
|
1574
|
+
* @apiCategory viewport
|
|
2641
1575
|
*/
|
|
2642
|
-
public
|
|
2643
|
-
|
|
2644
|
-
if (!stackType) return history?.clear();
|
|
2645
|
-
return stackType === 'undo'
|
|
2646
|
-
? history?.clearUndoStack()
|
|
2647
|
-
: history?.clearRedoStack();
|
|
1576
|
+
public getCanvasByViewport(point: Point): Point {
|
|
1577
|
+
return parsePoint(this.context.canvas!.viewport2Canvas(toPointObject(point)));
|
|
2648
1578
|
}
|
|
2649
1579
|
|
|
2650
1580
|
/**
|
|
2651
|
-
*
|
|
2652
|
-
*
|
|
2653
|
-
*
|
|
2654
|
-
* @param
|
|
2655
|
-
* @returns
|
|
2656
|
-
* @
|
|
1581
|
+
* <zh/> 给定画布上的绘制坐标,转换为视窗 DOM 的坐标
|
|
1582
|
+
*
|
|
1583
|
+
* <en/> Convert the given drawing coordinates on the canvas to the coordinates of the viewport DOM
|
|
1584
|
+
* @param point - <zh/> 画布坐标 | <en/> canvas coordinates
|
|
1585
|
+
* @returns <zh/> 视窗 DOM 的坐标 | <en/> coordinates of the viewport DOM
|
|
1586
|
+
* @apiCategory viewport
|
|
2657
1587
|
*/
|
|
2658
|
-
public
|
|
2659
|
-
this.
|
|
2660
|
-
ids: isArray(ids) ? ids : [ids],
|
|
2661
|
-
action: 'collapse',
|
|
2662
|
-
animate: !disableAnimate,
|
|
2663
|
-
graphCore: this.dataController.graphCore,
|
|
2664
|
-
});
|
|
1588
|
+
public getViewportByCanvas(point: Point): Point {
|
|
1589
|
+
return parsePoint(this.context.canvas.canvas2Viewport(toPointObject(point)));
|
|
2665
1590
|
}
|
|
1591
|
+
|
|
2666
1592
|
/**
|
|
2667
|
-
*
|
|
2668
|
-
*
|
|
2669
|
-
*
|
|
2670
|
-
* @param
|
|
2671
|
-
* @returns
|
|
2672
|
-
* @
|
|
1593
|
+
* <zh/> 给定画布上的绘制坐标,转换为浏览器坐标
|
|
1594
|
+
*
|
|
1595
|
+
* <en/> Convert the given drawing coordinates on the canvas to browser coordinates
|
|
1596
|
+
* @param point - <zh/> 画布坐标 | <en/> canvas coordinates
|
|
1597
|
+
* @returns <zh/> 浏览器坐标 | <en/> browser coordinates
|
|
1598
|
+
* @apiCategory viewport
|
|
2673
1599
|
*/
|
|
2674
|
-
public
|
|
2675
|
-
this.
|
|
2676
|
-
|
|
2677
|
-
action: 'expand',
|
|
2678
|
-
animate: !disableAnimate,
|
|
2679
|
-
graphCore: this.dataController.graphCore,
|
|
2680
|
-
});
|
|
1600
|
+
public getClientByCanvas(point: Point): Point {
|
|
1601
|
+
const viewportPoint = this.context.canvas.canvas2Viewport(toPointObject(point));
|
|
1602
|
+
return parsePoint(this.context.canvas.viewport2Canvas(viewportPoint));
|
|
2681
1603
|
}
|
|
2682
1604
|
|
|
2683
1605
|
/**
|
|
2684
|
-
*
|
|
2685
|
-
*
|
|
2686
|
-
*
|
|
1606
|
+
* <zh/> 给定的浏览器坐标,转换为画布上的绘制坐标
|
|
1607
|
+
*
|
|
1608
|
+
* <en/> Convert the given browser coordinates to drawing coordinates on the canvas
|
|
1609
|
+
* @param point - <zh/> 浏览器坐标 | <en/> browser coordinates
|
|
1610
|
+
* @returns <zh/> 画布上的绘制坐标 | <en/> drawing coordinates on the canvas
|
|
1611
|
+
* @apiCategory viewport
|
|
2687
1612
|
*/
|
|
2688
|
-
public
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
this.backgroundCanvas.destroy();
|
|
2693
|
-
this.transientCanvas.destroy();
|
|
1613
|
+
public getCanvasByClient(point: Point): Point {
|
|
1614
|
+
const viewportPoint = this.context.canvas.client2Viewport(toPointObject(point));
|
|
1615
|
+
return parsePoint(this.context.canvas.viewport2Canvas(viewportPoint));
|
|
1616
|
+
}
|
|
2694
1617
|
|
|
2695
|
-
|
|
2696
|
-
|
|
1618
|
+
/**
|
|
1619
|
+
* <zh/> 获取视口中心的画布坐标
|
|
1620
|
+
*
|
|
1621
|
+
* <en/> Get the canvas coordinates of the viewport center
|
|
1622
|
+
* @returns <zh/> 视口中心的画布坐标 | <en/> Canvas coordinates of the viewport center
|
|
1623
|
+
* @apiCategory viewport
|
|
1624
|
+
*/
|
|
1625
|
+
public getViewportCenter(): Point {
|
|
1626
|
+
return this.context.viewport!.getViewportCenter();
|
|
1627
|
+
}
|
|
2697
1628
|
|
|
2698
|
-
|
|
2699
|
-
|
|
1629
|
+
/**
|
|
1630
|
+
* <zh/> 获取画布中心的画布坐标
|
|
1631
|
+
*
|
|
1632
|
+
* <en/> Get the canvas coordinates of the canvas center
|
|
1633
|
+
* @returns <zh/> 画布中心的画布坐标 | <en/> Canvas coordinates of the canvas center
|
|
1634
|
+
* @apiCategory viewport
|
|
1635
|
+
*/
|
|
1636
|
+
public getCanvasCenter(): Point {
|
|
1637
|
+
return this.context.viewport!.getCanvasCenter();
|
|
1638
|
+
}
|
|
2700
1639
|
|
|
2701
|
-
|
|
1640
|
+
private onResize = debounce(() => {
|
|
1641
|
+
this.resize();
|
|
1642
|
+
}, 300);
|
|
2702
1643
|
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
1644
|
+
/**
|
|
1645
|
+
* <zh/> 监听事件
|
|
1646
|
+
*
|
|
1647
|
+
* <en/> Listen to events
|
|
1648
|
+
* @param eventName - <zh/> 事件名称 | <en/> event name
|
|
1649
|
+
* @param callback - <zh/> 回调函数 | <en/> callback function
|
|
1650
|
+
* @returns <zh/> Graph 实例 | <en/> Graph instance
|
|
1651
|
+
* @apiCategory event
|
|
1652
|
+
*/
|
|
1653
|
+
public on<T extends IEvent = IEvent>(eventName: string, callback: (event: T) => void) {
|
|
1654
|
+
return super.on(eventName, callback);
|
|
1655
|
+
}
|
|
2710
1656
|
|
|
2711
|
-
|
|
1657
|
+
/**
|
|
1658
|
+
* <zh/> 一次性监听事件
|
|
1659
|
+
*
|
|
1660
|
+
* <en/> Listen to events once
|
|
1661
|
+
* @param eventName - <zh/> 事件名称 | <en/> event name
|
|
1662
|
+
* @param callback - <zh/> 回调函数 | <en/> callback function
|
|
1663
|
+
* @returns <zh/> Graph 实例 | <en/> Graph instance
|
|
1664
|
+
* @apiCategory event
|
|
1665
|
+
*/
|
|
1666
|
+
public once<T extends IEvent = IEvent>(eventName: string, callback: (event: T) => void) {
|
|
1667
|
+
return super.once(eventName, callback);
|
|
2712
1668
|
}
|
|
2713
1669
|
}
|