@antv/g6 4.8.14-beta.0 → 5.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/g6.min.js +19 -3
- package/esm/constant/index.d.ts +1 -0
- package/esm/constant/index.js +2 -0
- package/esm/constant/index.js.map +1 -0
- package/esm/constant/shape.d.ts +27 -0
- package/esm/constant/shape.js +26 -0
- package/esm/constant/shape.js.map +1 -0
- package/esm/index.d.ts +124 -0
- package/esm/index.js +11 -0
- package/esm/index.js.map +1 -0
- package/esm/item/combo.d.ts +4 -0
- package/esm/item/combo.js +4 -0
- package/esm/item/combo.js.map +1 -0
- package/esm/item/edge.d.ts +54 -0
- package/esm/item/edge.js +113 -0
- package/esm/item/edge.js.map +1 -0
- package/esm/item/item.d.ts +189 -0
- package/esm/item/item.js +636 -0
- package/esm/item/item.js.map +1 -0
- package/esm/item/node.d.ts +54 -0
- package/esm/item/node.js +170 -0
- package/esm/item/node.js.map +1 -0
- package/esm/runtime/controller/data.d.ts +65 -0
- package/esm/runtime/controller/data.js +489 -0
- package/esm/runtime/controller/data.js.map +1 -0
- package/esm/runtime/controller/extension.d.ts +9 -0
- package/esm/runtime/controller/extension.js +11 -0
- package/esm/runtime/controller/extension.js.map +1 -0
- package/esm/runtime/controller/index.d.ts +7 -0
- package/esm/runtime/controller/index.js +8 -0
- package/esm/runtime/controller/index.js.map +1 -0
- package/esm/runtime/controller/interaction.d.ts +51 -0
- package/esm/runtime/controller/interaction.js +259 -0
- package/esm/runtime/controller/interaction.js.map +1 -0
- package/esm/runtime/controller/item.d.ts +101 -0
- package/esm/runtime/controller/item.js +537 -0
- package/esm/runtime/controller/item.js.map +1 -0
- package/esm/runtime/controller/layout.d.ts +30 -0
- package/esm/runtime/controller/layout.js +204 -0
- package/esm/runtime/controller/layout.js.map +1 -0
- package/esm/runtime/controller/plugin.d.ts +34 -0
- package/esm/runtime/controller/plugin.js +140 -0
- package/esm/runtime/controller/plugin.js.map +1 -0
- package/esm/runtime/controller/theme.d.ts +29 -0
- package/esm/runtime/controller/theme.js +54 -0
- package/esm/runtime/controller/theme.js.map +1 -0
- package/esm/runtime/controller/viewport.d.ts +11 -0
- package/esm/runtime/controller/viewport.js +102 -0
- package/esm/runtime/controller/viewport.js.map +1 -0
- package/esm/runtime/graph.d.ts +462 -0
- package/esm/runtime/graph.js +1077 -0
- package/esm/runtime/graph.js.map +1 -0
- package/esm/runtime/hooks.d.ts +33 -0
- package/esm/runtime/hooks.js +74 -0
- package/esm/runtime/hooks.js.map +1 -0
- package/esm/stdlib/behavior/activate-relations.d.ts +62 -0
- package/esm/stdlib/behavior/activate-relations.js +81 -0
- package/esm/stdlib/behavior/activate-relations.js.map +1 -0
- package/esm/stdlib/behavior/brush-select.d.ts +110 -0
- package/esm/stdlib/behavior/brush-select.js +268 -0
- package/esm/stdlib/behavior/brush-select.js.map +1 -0
- package/esm/stdlib/behavior/click-select.d.ts +71 -0
- package/esm/stdlib/behavior/click-select.js +143 -0
- package/esm/stdlib/behavior/click-select.js.map +1 -0
- package/esm/stdlib/behavior/drag-canvas.d.ts +82 -0
- package/esm/stdlib/behavior/drag-canvas.js +246 -0
- package/esm/stdlib/behavior/drag-canvas.js.map +1 -0
- package/esm/stdlib/behavior/drag-node.d.ts +80 -0
- package/esm/stdlib/behavior/drag-node.js +250 -0
- package/esm/stdlib/behavior/drag-node.js.map +1 -0
- package/esm/stdlib/behavior/hover-activate.d.ts +41 -0
- package/esm/stdlib/behavior/hover-activate.js +63 -0
- package/esm/stdlib/behavior/hover-activate.js.map +1 -0
- package/esm/stdlib/behavior/lasso-select.d.ts +27 -0
- package/esm/stdlib/behavior/lasso-select.js +79 -0
- package/esm/stdlib/behavior/lasso-select.js.map +1 -0
- package/esm/stdlib/behavior/orbit-canvas-3d.d.ts +37 -0
- package/esm/stdlib/behavior/orbit-canvas-3d.js +62 -0
- package/esm/stdlib/behavior/orbit-canvas-3d.js.map +1 -0
- package/esm/stdlib/behavior/rotate-canvas-3d.d.ts +61 -0
- package/esm/stdlib/behavior/rotate-canvas-3d.js +123 -0
- package/esm/stdlib/behavior/rotate-canvas-3d.js.map +1 -0
- package/esm/stdlib/behavior/track-canvas-3d.d.ts +37 -0
- package/esm/stdlib/behavior/track-canvas-3d.js +62 -0
- package/esm/stdlib/behavior/track-canvas-3d.js.map +1 -0
- package/esm/stdlib/behavior/zoom-canvas-3d.d.ts +51 -0
- package/esm/stdlib/behavior/zoom-canvas-3d.js +74 -0
- package/esm/stdlib/behavior/zoom-canvas-3d.js.map +1 -0
- package/esm/stdlib/behavior/zoom-canvas.d.ts +61 -0
- package/esm/stdlib/behavior/zoom-canvas.js +160 -0
- package/esm/stdlib/behavior/zoom-canvas.js.map +1 -0
- package/esm/stdlib/data/comboFromNode.d.ts +9 -0
- package/esm/stdlib/data/comboFromNode.js +28 -0
- package/esm/stdlib/data/comboFromNode.js.map +1 -0
- package/esm/stdlib/index.d.ts +80 -0
- package/esm/stdlib/index.js +82 -0
- package/esm/stdlib/index.js.map +1 -0
- package/esm/stdlib/item/edge/base.d.ts +111 -0
- package/esm/stdlib/item/edge/base.js +341 -0
- package/esm/stdlib/item/edge/base.js.map +1 -0
- package/esm/stdlib/item/edge/index.d.ts +1 -0
- package/esm/stdlib/item/edge/index.js +2 -0
- package/esm/stdlib/item/edge/index.js.map +1 -0
- package/esm/stdlib/item/edge/line.d.ts +33 -0
- package/esm/stdlib/item/edge/line.js +45 -0
- package/esm/stdlib/item/edge/line.js.map +1 -0
- package/esm/stdlib/item/node/base.d.ts +137 -0
- package/esm/stdlib/item/node/base.js +414 -0
- package/esm/stdlib/item/node/base.js.map +1 -0
- package/esm/stdlib/item/node/base3d.d.ts +72 -0
- package/esm/stdlib/item/node/base3d.js +113 -0
- package/esm/stdlib/item/node/base3d.js.map +1 -0
- package/esm/stdlib/item/node/circle.d.ts +30 -0
- package/esm/stdlib/item/node/circle.js +56 -0
- package/esm/stdlib/item/node/circle.js.map +1 -0
- package/esm/stdlib/item/node/index.d.ts +2 -0
- package/esm/stdlib/item/node/index.js +3 -0
- package/esm/stdlib/item/node/index.js.map +1 -0
- package/esm/stdlib/item/node/sphere.d.ts +33 -0
- package/esm/stdlib/item/node/sphere.js +52 -0
- package/esm/stdlib/item/node/sphere.js.map +1 -0
- package/esm/stdlib/plugin/legend/index.d.ts +121 -0
- package/esm/stdlib/plugin/legend/index.js +587 -0
- package/esm/stdlib/plugin/legend/index.js.map +1 -0
- package/esm/stdlib/plugin/minimap/index.d.ts +106 -0
- package/esm/stdlib/plugin/minimap/index.js +578 -0
- package/esm/stdlib/plugin/minimap/index.js.map +1 -0
- package/esm/stdlib/selector/lasso.d.ts +15 -0
- package/esm/stdlib/selector/lasso.js +61 -0
- package/esm/stdlib/selector/lasso.js.map +1 -0
- package/esm/stdlib/selector/rect.d.ts +16 -0
- package/esm/stdlib/selector/rect.js +54 -0
- package/esm/stdlib/selector/rect.js.map +1 -0
- package/esm/stdlib/theme/dark.d.ts +3 -0
- package/esm/stdlib/theme/dark.js +279 -0
- package/esm/stdlib/theme/dark.js.map +1 -0
- package/esm/stdlib/theme/light.d.ts +3 -0
- package/esm/stdlib/theme/light.js +274 -0
- package/esm/stdlib/theme/light.js.map +1 -0
- package/esm/stdlib/themeSolver/base.d.ts +15 -0
- package/esm/stdlib/themeSolver/base.js +11 -0
- package/esm/stdlib/themeSolver/base.js.map +1 -0
- package/esm/stdlib/themeSolver/spec.d.ts +37 -0
- package/esm/stdlib/themeSolver/spec.js +66 -0
- package/esm/stdlib/themeSolver/spec.js.map +1 -0
- package/esm/stdlib/themeSolver/subject.d.ts +43 -0
- package/esm/stdlib/themeSolver/subject.js +396 -0
- package/esm/stdlib/themeSolver/subject.js.map +1 -0
- package/esm/types/animate.d.ts +59 -0
- package/esm/types/animate.js +2 -0
- package/esm/types/animate.js.map +1 -0
- package/esm/types/behavior.d.ts +45 -0
- package/esm/types/behavior.js +14 -0
- package/esm/types/behavior.js.map +1 -0
- package/esm/types/combo.d.ts +87 -0
- package/esm/types/combo.js +2 -0
- package/esm/types/combo.js.map +1 -0
- package/esm/types/common.d.ts +6 -0
- package/esm/types/common.js +2 -0
- package/esm/types/common.js.map +1 -0
- package/esm/types/data.d.ts +21 -0
- package/esm/types/data.js +2 -0
- package/esm/types/data.js.map +1 -0
- package/esm/types/edge.d.ts +100 -0
- package/esm/types/edge.js +2 -0
- package/esm/types/edge.js.map +1 -0
- package/esm/types/event.d.ts +30 -0
- package/esm/types/event.js +31 -0
- package/esm/types/event.js.map +1 -0
- package/esm/types/graph.d.ts +445 -0
- package/esm/types/graph.js +2 -0
- package/esm/types/graph.js.map +1 -0
- package/esm/types/hook.d.ts +97 -0
- package/esm/types/hook.js +2 -0
- package/esm/types/hook.js.map +1 -0
- package/esm/types/index.d.ts +10 -0
- package/esm/types/index.js +2 -0
- package/esm/types/index.js.map +1 -0
- package/esm/types/item.d.ts +229 -0
- package/esm/types/item.js +16 -0
- package/esm/types/item.js.map +1 -0
- package/esm/types/layout.d.ts +69 -0
- package/esm/types/layout.js +20 -0
- package/esm/types/layout.js.map +1 -0
- package/esm/types/node.d.ts +134 -0
- package/esm/types/node.js +2 -0
- package/esm/types/node.js.map +1 -0
- package/esm/types/plugin.d.ts +40 -0
- package/esm/types/plugin.js +53 -0
- package/esm/types/plugin.js.map +1 -0
- package/esm/types/render.d.ts +1 -0
- package/esm/types/render.js +2 -0
- package/esm/types/render.js.map +1 -0
- package/esm/types/spec.d.ts +65 -0
- package/esm/types/spec.js +2 -0
- package/esm/types/spec.js.map +1 -0
- package/esm/types/stdlib.d.ts +13 -0
- package/esm/types/stdlib.js +2 -0
- package/esm/types/stdlib.js.map +1 -0
- package/esm/types/theme.d.ts +102 -0
- package/esm/types/theme.js +15 -0
- package/esm/types/theme.js.map +1 -0
- package/esm/types/view.d.ts +23 -0
- package/esm/types/view.js +2 -0
- package/esm/types/view.js.map +1 -0
- package/esm/util/animate.d.ts +101 -0
- package/esm/util/animate.js +350 -0
- package/esm/util/animate.js.map +1 -0
- package/esm/util/array.d.ts +20 -0
- package/esm/util/array.js +60 -0
- package/esm/util/array.js.map +1 -0
- package/esm/util/canvas.d.ts +20 -0
- package/esm/util/canvas.js +81 -0
- package/esm/util/canvas.js.map +1 -0
- package/esm/util/event.d.ts +12 -0
- package/esm/util/event.js +26 -0
- package/esm/util/event.js.map +1 -0
- package/esm/util/extend.d.ts +21 -0
- package/esm/util/extend.js +22 -0
- package/esm/util/extend.js.map +1 -0
- package/esm/util/extension.d.ts +10 -0
- package/esm/util/extension.js +24 -0
- package/esm/util/extension.js.map +1 -0
- package/esm/util/index.d.ts +14 -0
- package/esm/util/index.js +5 -0
- package/esm/util/index.js.map +1 -0
- package/esm/util/item.d.ts +14 -0
- package/esm/util/item.js +42 -0
- package/esm/util/item.js.map +1 -0
- package/esm/util/mapper.d.ts +17 -0
- package/esm/util/mapper.js +60 -0
- package/esm/util/mapper.js.map +1 -0
- package/esm/util/math.d.ts +8 -0
- package/esm/util/math.js +9 -0
- package/esm/util/math.js.map +1 -0
- package/esm/util/point.d.ts +61 -0
- package/esm/util/point.js +160 -0
- package/esm/util/point.js.map +1 -0
- package/esm/util/shape.d.ts +105 -0
- package/esm/util/shape.js +504 -0
- package/esm/util/shape.js.map +1 -0
- package/esm/util/shape3d.d.ts +23 -0
- package/esm/util/shape3d.js +147 -0
- package/esm/util/shape3d.js.map +1 -0
- package/esm/util/text.d.ts +18 -0
- package/esm/util/text.js +36 -0
- package/esm/util/text.js.map +1 -0
- package/esm/util/type.d.ts +2 -0
- package/esm/util/type.js +2 -0
- package/esm/util/type.js.map +1 -0
- package/esm/util/zoom.d.ts +17 -0
- package/esm/util/zoom.js +36 -0
- package/esm/util/zoom.js.map +1 -0
- package/lib/constant/index.d.ts +1 -0
- package/lib/constant/index.js +18 -0
- package/lib/constant/index.js.map +1 -0
- package/lib/constant/shape.d.ts +27 -0
- package/lib/constant/shape.js +29 -0
- package/lib/constant/shape.js.map +1 -0
- package/lib/index.d.ts +124 -4
- package/lib/index.js +30 -27
- package/lib/index.js.map +1 -0
- package/lib/item/combo.d.ts +4 -0
- package/lib/item/combo.js +10 -0
- package/lib/item/combo.js.map +1 -0
- package/lib/item/edge.d.ts +54 -0
- package/lib/item/edge.js +119 -0
- package/lib/item/edge.js.map +1 -0
- package/lib/item/item.d.ts +189 -0
- package/lib/item/item.js +639 -0
- package/lib/item/item.js.map +1 -0
- package/lib/item/node.d.ts +54 -0
- package/lib/item/node.js +176 -0
- package/lib/item/node.js.map +1 -0
- package/lib/runtime/controller/data.d.ts +65 -0
- package/lib/runtime/controller/data.js +493 -0
- package/lib/runtime/controller/data.js.map +1 -0
- package/lib/runtime/controller/extension.d.ts +9 -0
- package/lib/runtime/controller/extension.js +15 -0
- package/lib/runtime/controller/extension.js.map +1 -0
- package/lib/runtime/controller/index.d.ts +7 -0
- package/lib/runtime/controller/index.js +24 -0
- package/lib/runtime/controller/index.js.map +1 -0
- package/lib/runtime/controller/interaction.d.ts +51 -0
- package/lib/runtime/controller/interaction.js +263 -0
- package/lib/runtime/controller/interaction.js.map +1 -0
- package/lib/runtime/controller/item.d.ts +101 -0
- package/lib/runtime/controller/item.js +544 -0
- package/lib/runtime/controller/item.js.map +1 -0
- package/lib/runtime/controller/layout.d.ts +30 -0
- package/lib/runtime/controller/layout.js +208 -0
- package/lib/runtime/controller/layout.js.map +1 -0
- package/lib/runtime/controller/plugin.d.ts +34 -0
- package/lib/runtime/controller/plugin.js +147 -0
- package/lib/runtime/controller/plugin.js.map +1 -0
- package/lib/runtime/controller/theme.d.ts +29 -0
- package/lib/runtime/controller/theme.js +61 -0
- package/lib/runtime/controller/theme.js.map +1 -0
- package/lib/runtime/controller/viewport.d.ts +11 -0
- package/lib/runtime/controller/viewport.js +106 -0
- package/lib/runtime/controller/viewport.js.map +1 -0
- package/lib/runtime/graph.d.ts +462 -0
- package/lib/runtime/graph.js +1083 -0
- package/lib/runtime/graph.js.map +1 -0
- package/lib/runtime/hooks.d.ts +33 -0
- package/lib/runtime/hooks.js +77 -0
- package/lib/runtime/hooks.js.map +1 -0
- package/lib/stdlib/behavior/activate-relations.d.ts +62 -0
- package/lib/stdlib/behavior/activate-relations.js +84 -0
- package/lib/stdlib/behavior/activate-relations.js.map +1 -0
- package/lib/stdlib/behavior/brush-select.d.ts +110 -0
- package/lib/stdlib/behavior/brush-select.js +271 -0
- package/lib/stdlib/behavior/brush-select.js.map +1 -0
- package/lib/stdlib/behavior/click-select.d.ts +71 -0
- package/lib/stdlib/behavior/click-select.js +146 -0
- package/lib/stdlib/behavior/click-select.js.map +1 -0
- package/lib/stdlib/behavior/drag-canvas.d.ts +82 -0
- package/lib/stdlib/behavior/drag-canvas.js +249 -0
- package/lib/stdlib/behavior/drag-canvas.js.map +1 -0
- package/lib/stdlib/behavior/drag-node.d.ts +80 -0
- package/lib/stdlib/behavior/drag-node.js +253 -0
- package/lib/stdlib/behavior/drag-node.js.map +1 -0
- package/lib/stdlib/behavior/hover-activate.d.ts +41 -0
- package/lib/stdlib/behavior/hover-activate.js +67 -0
- package/lib/stdlib/behavior/hover-activate.js.map +1 -0
- package/lib/stdlib/behavior/lasso-select.d.ts +27 -0
- package/lib/stdlib/behavior/lasso-select.js +85 -0
- package/lib/stdlib/behavior/lasso-select.js.map +1 -0
- package/lib/stdlib/behavior/orbit-canvas-3d.d.ts +37 -0
- package/lib/stdlib/behavior/orbit-canvas-3d.js +68 -0
- package/lib/stdlib/behavior/orbit-canvas-3d.js.map +1 -0
- package/lib/stdlib/behavior/rotate-canvas-3d.d.ts +61 -0
- package/lib/stdlib/behavior/rotate-canvas-3d.js +126 -0
- package/lib/stdlib/behavior/rotate-canvas-3d.js.map +1 -0
- package/lib/stdlib/behavior/track-canvas-3d.d.ts +37 -0
- package/lib/stdlib/behavior/track-canvas-3d.js +68 -0
- package/lib/stdlib/behavior/track-canvas-3d.js.map +1 -0
- package/lib/stdlib/behavior/zoom-canvas-3d.d.ts +51 -0
- package/lib/stdlib/behavior/zoom-canvas-3d.js +77 -0
- package/lib/stdlib/behavior/zoom-canvas-3d.js.map +1 -0
- package/lib/stdlib/behavior/zoom-canvas.d.ts +61 -0
- package/lib/stdlib/behavior/zoom-canvas.js +163 -0
- package/lib/stdlib/behavior/zoom-canvas.js.map +1 -0
- package/lib/stdlib/data/comboFromNode.d.ts +9 -0
- package/lib/stdlib/data/comboFromNode.js +32 -0
- package/lib/stdlib/data/comboFromNode.js.map +1 -0
- package/lib/stdlib/index.d.ts +80 -0
- package/lib/stdlib/index.js +90 -0
- package/lib/stdlib/index.js.map +1 -0
- package/lib/stdlib/item/edge/base.d.ts +111 -0
- package/lib/stdlib/item/edge/base.js +345 -0
- package/lib/stdlib/item/edge/base.js.map +1 -0
- package/lib/stdlib/item/edge/index.d.ts +1 -0
- package/lib/stdlib/item/edge/index.js +18 -0
- package/lib/stdlib/item/edge/index.js.map +1 -0
- package/lib/stdlib/item/edge/line.d.ts +33 -0
- package/lib/stdlib/item/edge/line.js +49 -0
- package/lib/stdlib/item/edge/line.js.map +1 -0
- package/lib/stdlib/item/node/base.d.ts +137 -0
- package/lib/stdlib/item/node/base.js +418 -0
- package/lib/stdlib/item/node/base.js.map +1 -0
- package/lib/stdlib/item/node/base3d.d.ts +72 -0
- package/lib/stdlib/item/node/base3d.js +117 -0
- package/lib/stdlib/item/node/base3d.js.map +1 -0
- package/lib/stdlib/item/node/circle.d.ts +30 -0
- package/lib/stdlib/item/node/circle.js +60 -0
- package/lib/stdlib/item/node/circle.js.map +1 -0
- package/lib/stdlib/item/node/index.d.ts +2 -0
- package/lib/stdlib/item/node/index.js +19 -0
- package/lib/stdlib/item/node/index.js.map +1 -0
- package/lib/stdlib/item/node/sphere.d.ts +33 -0
- package/lib/stdlib/item/node/sphere.js +56 -0
- package/lib/stdlib/item/node/sphere.js.map +1 -0
- package/lib/stdlib/plugin/legend/index.d.ts +121 -0
- package/lib/stdlib/plugin/legend/index.js +590 -0
- package/lib/stdlib/plugin/legend/index.js.map +1 -0
- package/lib/stdlib/plugin/minimap/index.d.ts +106 -0
- package/lib/stdlib/plugin/minimap/index.js +581 -0
- package/lib/stdlib/plugin/minimap/index.js.map +1 -0
- package/lib/stdlib/selector/lasso.d.ts +15 -0
- package/lib/stdlib/selector/lasso.js +63 -0
- package/lib/stdlib/selector/lasso.js.map +1 -0
- package/lib/stdlib/selector/rect.d.ts +16 -0
- package/lib/stdlib/selector/rect.js +56 -0
- package/lib/stdlib/selector/rect.js.map +1 -0
- package/lib/stdlib/theme/dark.d.ts +3 -0
- package/lib/stdlib/theme/dark.js +281 -0
- package/lib/stdlib/theme/dark.js.map +1 -0
- package/lib/stdlib/theme/light.d.ts +3 -0
- package/lib/stdlib/theme/light.js +276 -0
- package/lib/stdlib/theme/light.js.map +1 -0
- package/lib/stdlib/themeSolver/base.d.ts +15 -0
- package/lib/stdlib/themeSolver/base.js +14 -0
- package/lib/stdlib/themeSolver/base.js.map +1 -0
- package/lib/stdlib/themeSolver/spec.d.ts +37 -0
- package/lib/stdlib/themeSolver/spec.js +72 -0
- package/lib/stdlib/themeSolver/spec.js.map +1 -0
- package/lib/stdlib/themeSolver/subject.d.ts +43 -0
- package/lib/stdlib/themeSolver/subject.js +404 -0
- package/lib/stdlib/themeSolver/subject.js.map +1 -0
- package/lib/types/animate.d.ts +59 -0
- package/lib/types/animate.js +3 -0
- package/lib/types/animate.js.map +1 -0
- package/lib/types/behavior.d.ts +45 -0
- package/lib/types/behavior.js +18 -0
- package/lib/types/behavior.js.map +1 -0
- package/lib/types/combo.d.ts +87 -0
- package/lib/types/combo.js +3 -0
- package/lib/types/combo.js.map +1 -0
- package/lib/types/common.d.ts +6 -0
- package/lib/types/common.js +3 -0
- package/lib/types/common.js.map +1 -0
- package/lib/types/data.d.ts +21 -0
- package/lib/types/data.js +3 -0
- package/lib/types/data.js.map +1 -0
- package/lib/types/edge.d.ts +100 -0
- package/lib/types/edge.js +3 -0
- package/lib/types/edge.js.map +1 -0
- package/lib/types/event.d.ts +30 -0
- package/lib/types/event.js +34 -0
- package/lib/types/event.js.map +1 -0
- package/lib/types/graph.d.ts +445 -0
- package/lib/types/graph.js +3 -0
- package/lib/types/graph.js.map +1 -0
- package/lib/types/hook.d.ts +97 -0
- package/lib/types/hook.js +3 -0
- package/lib/types/hook.js.map +1 -0
- package/lib/types/index.d.ts +10 -0
- package/lib/types/index.js +7 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/item.d.ts +229 -0
- package/lib/types/item.js +19 -0
- package/lib/types/item.js.map +1 -0
- package/lib/types/layout.d.ts +69 -0
- package/lib/types/layout.js +25 -0
- package/lib/types/layout.js.map +1 -0
- package/lib/types/node.d.ts +134 -0
- package/lib/types/node.js +3 -0
- package/lib/types/node.js.map +1 -0
- package/lib/types/plugin.d.ts +40 -0
- package/lib/types/plugin.js +57 -0
- package/lib/types/plugin.js.map +1 -0
- package/lib/types/render.d.ts +1 -0
- package/lib/types/render.js +3 -0
- package/lib/types/render.js.map +1 -0
- package/lib/types/spec.d.ts +65 -0
- package/lib/types/spec.js +3 -0
- package/lib/types/spec.js.map +1 -0
- package/lib/types/stdlib.d.ts +13 -0
- package/lib/types/stdlib.js +3 -0
- package/lib/types/stdlib.js.map +1 -0
- package/lib/types/theme.d.ts +102 -0
- package/lib/types/theme.js +19 -0
- package/lib/types/theme.js.map +1 -0
- package/lib/types/view.d.ts +23 -0
- package/lib/types/view.js +3 -0
- package/lib/types/view.js.map +1 -0
- package/lib/util/animate.d.ts +101 -0
- package/lib/util/animate.js +358 -0
- package/lib/util/animate.js.map +1 -0
- package/lib/util/array.d.ts +20 -0
- package/lib/util/array.js +68 -0
- package/lib/util/array.js.map +1 -0
- package/lib/util/canvas.d.ts +20 -0
- package/lib/util/canvas.js +86 -0
- package/lib/util/canvas.js.map +1 -0
- package/lib/util/event.d.ts +12 -0
- package/lib/util/event.js +30 -0
- package/lib/util/event.js.map +1 -0
- package/lib/util/extend.d.ts +21 -0
- package/lib/util/extend.js +29 -0
- package/lib/util/extend.js.map +1 -0
- package/lib/util/extension.d.ts +10 -0
- package/lib/util/extension.js +29 -0
- package/lib/util/extension.js.map +1 -0
- package/lib/util/index.d.ts +14 -0
- package/lib/util/index.js +7 -0
- package/lib/util/index.js.map +1 -0
- package/lib/util/item.d.ts +14 -0
- package/lib/util/item.js +47 -0
- package/lib/util/item.js.map +1 -0
- package/lib/util/mapper.d.ts +17 -0
- package/lib/util/mapper.js +63 -0
- package/lib/util/mapper.js.map +1 -0
- package/lib/util/math.d.ts +8 -0
- package/lib/util/math.js +13 -0
- package/lib/util/math.js.map +1 -0
- package/lib/util/point.d.ts +61 -0
- package/lib/util/point.js +169 -0
- package/lib/util/point.js.map +1 -0
- package/lib/util/shape.d.ts +105 -0
- package/lib/util/shape.js +519 -0
- package/lib/util/shape.js.map +1 -0
- package/lib/util/shape3d.d.ts +23 -0
- package/lib/util/shape3d.js +153 -0
- package/lib/util/shape3d.js.map +1 -0
- package/lib/util/text.d.ts +18 -0
- package/lib/util/text.js +41 -0
- package/lib/util/text.js.map +1 -0
- package/lib/util/type.d.ts +2 -0
- package/lib/util/type.js +6 -0
- package/lib/util/type.js.map +1 -0
- package/lib/util/zoom.d.ts +17 -0
- package/lib/util/zoom.js +41 -0
- package/lib/util/zoom.js.map +1 -0
- package/package.json +82 -50
- package/src/constant/index.ts +1 -0
- package/src/constant/shape.ts +33 -0
- package/src/index.ts +13 -0
- package/src/item/combo.ts +5 -0
- package/src/item/edge.ts +177 -0
- package/src/item/item.ts +812 -0
- package/src/item/node.ts +275 -0
- package/src/runtime/controller/data.ts +575 -0
- package/src/runtime/controller/extension.ts +14 -0
- package/src/runtime/controller/index.ts +7 -0
- package/src/runtime/controller/interaction.ts +343 -0
- package/src/runtime/controller/item.ts +780 -0
- package/src/runtime/controller/layout.ts +251 -0
- package/src/runtime/controller/plugin.ts +171 -0
- package/src/runtime/controller/theme.ts +69 -0
- package/src/runtime/controller/viewport.ts +131 -0
- package/src/runtime/graph.ts +1439 -0
- package/src/runtime/hooks.ts +64 -0
- package/src/stdlib/behavior/activate-relations.ts +139 -0
- package/src/stdlib/behavior/brush-select.ts +386 -0
- package/src/stdlib/behavior/click-select.ts +201 -0
- package/src/stdlib/behavior/drag-canvas.ts +333 -0
- package/src/stdlib/behavior/drag-node.ts +402 -0
- package/src/stdlib/behavior/hover-activate.ts +106 -0
- package/src/stdlib/behavior/lasso-select.ts +94 -0
- package/src/stdlib/behavior/orbit-canvas-3d.ts +104 -0
- package/src/stdlib/behavior/rotate-canvas-3d.ts +172 -0
- package/src/stdlib/behavior/track-canvas-3d.ts +104 -0
- package/src/stdlib/behavior/zoom-canvas-3d.ts +127 -0
- package/src/stdlib/behavior/zoom-canvas.ts +244 -0
- package/src/stdlib/data/comboFromNode.ts +28 -0
- package/src/stdlib/index.ts +87 -0
- package/src/stdlib/item/edge/base.ts +571 -0
- package/src/stdlib/item/edge/index.ts +1 -0
- package/src/stdlib/item/edge/line.ts +98 -0
- package/src/stdlib/item/node/base.ts +726 -0
- package/src/stdlib/item/node/base3d.ts +192 -0
- package/src/stdlib/item/node/circle.ts +113 -0
- package/src/stdlib/item/node/index.ts +2 -0
- package/src/stdlib/item/node/sphere.ts +99 -0
- package/src/stdlib/plugin/legend/index.ts +733 -0
- package/src/stdlib/plugin/minimap/index.ts +689 -0
- package/src/stdlib/selector/lasso.ts +75 -0
- package/src/stdlib/selector/rect.ts +78 -0
- package/src/stdlib/theme/dark.ts +340 -0
- package/src/stdlib/theme/light.ts +333 -0
- package/src/stdlib/themeSolver/base.ts +22 -0
- package/src/stdlib/themeSolver/spec.ts +110 -0
- package/src/stdlib/themeSolver/subject.ts +502 -0
- package/src/types/animate.ts +71 -0
- package/src/types/behavior.ts +49 -0
- package/src/types/combo.ts +120 -0
- package/src/types/common.ts +7 -0
- package/src/types/data.ts +35 -0
- package/src/types/edge.ts +119 -0
- package/src/types/event.ts +47 -0
- package/src/types/graph.ts +573 -0
- package/src/types/hook.ts +98 -0
- package/src/types/index.ts +29 -0
- package/src/types/item.ts +324 -0
- package/src/types/layout.ts +138 -0
- package/src/types/node.ts +162 -0
- package/src/types/plugin.ts +77 -0
- package/src/types/render.ts +1 -0
- package/src/types/spec.ts +116 -0
- package/src/types/stdlib.ts +25 -0
- package/src/types/theme.ts +101 -0
- package/src/types/view.ts +31 -0
- package/src/util/animate.ts +430 -0
- package/src/util/array.ts +57 -0
- package/src/util/canvas.ts +95 -0
- package/src/util/event.ts +34 -0
- package/src/util/extend.ts +42 -0
- package/src/util/extension.ts +29 -0
- package/src/util/index.ts +4 -0
- package/src/util/item.ts +70 -0
- package/src/util/mapper.ts +61 -0
- package/src/util/math.ts +9 -0
- package/src/util/point.ts +195 -0
- package/src/util/shape.ts +609 -0
- package/src/util/shape3d.ts +198 -0
- package/src/util/text.ts +49 -0
- package/src/util/type.ts +4 -0
- package/src/util/zoom.ts +39 -0
- package/README.en-US.md +0 -170
- package/README.md +0 -177
- package/dist/g6.min.js.map +0 -1
- package/es/index.d.ts +0 -4
- package/es/index.js +0 -5
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { ID } from '@antv/graphlib';
|
|
2
|
+
import {
|
|
3
|
+
AABB,
|
|
4
|
+
CircleStyleProps,
|
|
5
|
+
RectStyleProps,
|
|
6
|
+
EllipseStyleProps,
|
|
7
|
+
PolygonStyleProps,
|
|
8
|
+
LineStyleProps,
|
|
9
|
+
PathStyleProps,
|
|
10
|
+
PolylineStyleProps,
|
|
11
|
+
TextStyleProps,
|
|
12
|
+
ImageStyleProps,
|
|
13
|
+
Group,
|
|
14
|
+
DisplayObject,
|
|
15
|
+
IAnimation,
|
|
16
|
+
} from '@antv/g';
|
|
17
|
+
import { AnimateCfg, IAnimates } from './animate';
|
|
18
|
+
import {
|
|
19
|
+
ComboDisplayModel,
|
|
20
|
+
ComboEncode,
|
|
21
|
+
ComboModel,
|
|
22
|
+
ComboModelData,
|
|
23
|
+
ComboUserModel,
|
|
24
|
+
} from './combo';
|
|
25
|
+
import {
|
|
26
|
+
EdgeDisplayModel,
|
|
27
|
+
EdgeEncode,
|
|
28
|
+
EdgeModel,
|
|
29
|
+
EdgeModelData,
|
|
30
|
+
EdgeShapeMap,
|
|
31
|
+
EdgeUserModel,
|
|
32
|
+
} from './edge';
|
|
33
|
+
import {
|
|
34
|
+
NodeDisplayModel,
|
|
35
|
+
NodeEncode,
|
|
36
|
+
NodeModel,
|
|
37
|
+
NodeModelData,
|
|
38
|
+
NodeShapeMap,
|
|
39
|
+
NodeUserModel,
|
|
40
|
+
} from './node';
|
|
41
|
+
import {
|
|
42
|
+
CubeGeometryProps,
|
|
43
|
+
PlaneGeometryProps,
|
|
44
|
+
SphereGeometryProps,
|
|
45
|
+
TorusGeometryProps,
|
|
46
|
+
} from '@antv/g-plugin-3d';
|
|
47
|
+
|
|
48
|
+
export type GShapeStyle = CircleStyleProps &
|
|
49
|
+
RectStyleProps &
|
|
50
|
+
EllipseStyleProps &
|
|
51
|
+
PolygonStyleProps &
|
|
52
|
+
LineStyleProps &
|
|
53
|
+
PolylineStyleProps &
|
|
54
|
+
TextStyleProps &
|
|
55
|
+
ImageStyleProps &
|
|
56
|
+
PathStyleProps &
|
|
57
|
+
SphereGeometryProps &
|
|
58
|
+
CubeGeometryProps &
|
|
59
|
+
PlaneGeometryProps;
|
|
60
|
+
|
|
61
|
+
export type ShapeStyle = Partial<
|
|
62
|
+
GShapeStyle & {
|
|
63
|
+
animates?: IAnimates;
|
|
64
|
+
lod?: number;
|
|
65
|
+
visible?: boolean;
|
|
66
|
+
}
|
|
67
|
+
>;
|
|
68
|
+
export interface Encode<T> {
|
|
69
|
+
fields: string[];
|
|
70
|
+
formatter: (values: NodeUserModel | EdgeUserModel | ComboUserModel) => T;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface ShapeAttrEncode {
|
|
74
|
+
[shapeAttr: string]: unknown | Encode<unknown>;
|
|
75
|
+
animates?: IAnimates | Encode<IAnimates>;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface LabelBackground {
|
|
79
|
+
fill?: string;
|
|
80
|
+
stroke?: string;
|
|
81
|
+
lineWidth?: number;
|
|
82
|
+
radius?: number[] | number;
|
|
83
|
+
padding?: number[] | number;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface ShapesEncode {
|
|
87
|
+
keyShape?: ShapeAttrEncode | Encode<ShapeStyle>;
|
|
88
|
+
iconShape?: ShapeAttrEncode | Encode<ShapeStyle>;
|
|
89
|
+
otherShapes?: {
|
|
90
|
+
[shapeId: string]: {
|
|
91
|
+
[shapeAtrr: string]: unknown | Encode<unknown>;
|
|
92
|
+
animates: IAnimates | Encode<IAnimates>;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
export type SHAPE_TYPE =
|
|
97
|
+
| 'rect'
|
|
98
|
+
| 'circle'
|
|
99
|
+
| 'ellipse'
|
|
100
|
+
| 'polygon'
|
|
101
|
+
| 'image'
|
|
102
|
+
| 'polyline'
|
|
103
|
+
| 'line'
|
|
104
|
+
| 'path'
|
|
105
|
+
| 'text';
|
|
106
|
+
|
|
107
|
+
export type SHAPE_TYPE_3D = 'sphere' | 'cube' | 'plane';
|
|
108
|
+
|
|
109
|
+
export type ITEM_TYPE = 'node' | 'edge' | 'combo';
|
|
110
|
+
|
|
111
|
+
export type ItemModelData = NodeModelData | EdgeModelData | ComboModelData;
|
|
112
|
+
|
|
113
|
+
export type ItemModel = NodeModel | EdgeModel | ComboModel;
|
|
114
|
+
|
|
115
|
+
export type ItemDisplayModel =
|
|
116
|
+
| NodeDisplayModel
|
|
117
|
+
| EdgeDisplayModel
|
|
118
|
+
| ComboDisplayModel;
|
|
119
|
+
|
|
120
|
+
export type DisplayMapper =
|
|
121
|
+
| ((model: ItemModel) => ItemDisplayModel)
|
|
122
|
+
| NodeEncode
|
|
123
|
+
| EdgeEncode
|
|
124
|
+
| ComboEncode;
|
|
125
|
+
|
|
126
|
+
export type State = {
|
|
127
|
+
name: string;
|
|
128
|
+
value: boolean | string | number;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export enum BadgePosition {
|
|
132
|
+
rightTop = 'rightTop',
|
|
133
|
+
right = 'right',
|
|
134
|
+
rightBottom = 'rightBottom',
|
|
135
|
+
bottomRight = 'bottomRight',
|
|
136
|
+
bottom = 'bottom',
|
|
137
|
+
bottomLeft = 'bottomLeft',
|
|
138
|
+
leftBottom = 'leftBottom',
|
|
139
|
+
left = 'left',
|
|
140
|
+
leftTop = 'leftTop',
|
|
141
|
+
topLeft = 'topLeft',
|
|
142
|
+
top = 'top',
|
|
143
|
+
topRight = 'topRight',
|
|
144
|
+
}
|
|
145
|
+
export type IBadgePosition = `${BadgePosition}`;
|
|
146
|
+
|
|
147
|
+
/** Shape styles for an item. */
|
|
148
|
+
export type ItemShapeStyles = {
|
|
149
|
+
// labelShape, labelBackgroundShape, badgeShapes, overwrote by node / edge / combo
|
|
150
|
+
// anchorShapes, overwrote by node / combo
|
|
151
|
+
keyShape?: ShapeStyle;
|
|
152
|
+
iconShape?: Partial<
|
|
153
|
+
TextStyleProps &
|
|
154
|
+
ImageStyleProps & {
|
|
155
|
+
offsetX?: number;
|
|
156
|
+
offsetY?: number;
|
|
157
|
+
lod?: number;
|
|
158
|
+
}
|
|
159
|
+
>;
|
|
160
|
+
haloShape?: ShapeStyle;
|
|
161
|
+
group?: ShapeStyle;
|
|
162
|
+
otherShapes?: {
|
|
163
|
+
[shapeId: string]: ShapeStyle;
|
|
164
|
+
};
|
|
165
|
+
animates?: IAnimates;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export interface LodStrategy {
|
|
169
|
+
levels: {
|
|
170
|
+
zoomRange: [number, number];
|
|
171
|
+
primary?: boolean;
|
|
172
|
+
}[];
|
|
173
|
+
animateCfg: AnimateCfg;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface lodStrategyObj {
|
|
177
|
+
levels: {
|
|
178
|
+
[levelIdx: number]: [number, number];
|
|
179
|
+
};
|
|
180
|
+
animateCfg: AnimateCfg;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Base item of node / edge / combo.
|
|
185
|
+
*/
|
|
186
|
+
export interface IItem {
|
|
187
|
+
destroyed: boolean;
|
|
188
|
+
/** Inner model. */
|
|
189
|
+
model: ItemModel;
|
|
190
|
+
/** Display model, user will not touch it. */
|
|
191
|
+
displayModel: ItemDisplayModel;
|
|
192
|
+
/** The style mapper configured at graph with field name 'node' / 'edge' / 'combo'. */
|
|
193
|
+
mapper: DisplayMapper;
|
|
194
|
+
/** The state sstyle mapper configured at traph with field name 'nodeState' / 'edgeState' / 'comboState'. */
|
|
195
|
+
stateMapper: {
|
|
196
|
+
[stateName: string]: DisplayMapper;
|
|
197
|
+
};
|
|
198
|
+
/** The graphic group for item drawing. */
|
|
199
|
+
group: Group;
|
|
200
|
+
/** The keyShape of the item. */
|
|
201
|
+
keyShape: DisplayObject;
|
|
202
|
+
/** render extension for this item. */
|
|
203
|
+
renderExt;
|
|
204
|
+
/** Visibility. */
|
|
205
|
+
visible: boolean;
|
|
206
|
+
/** The states on the item. */
|
|
207
|
+
states: {
|
|
208
|
+
name: string;
|
|
209
|
+
value: string | boolean;
|
|
210
|
+
}[];
|
|
211
|
+
/** The map caches the shapes of the item. The key is the shape id, the value is the g shape. */
|
|
212
|
+
shapeMap: NodeShapeMap | EdgeShapeMap;
|
|
213
|
+
afterDrawShapeMap: Object;
|
|
214
|
+
/** Item's type. Set to different value in implements. */
|
|
215
|
+
type: ITEM_TYPE;
|
|
216
|
+
/** Render extensions where could the renderExt be selected from according to the type. */
|
|
217
|
+
renderExtensions: any;
|
|
218
|
+
/** Cache the animation instances to stop at next lifecycle. */
|
|
219
|
+
animations: IAnimation[];
|
|
220
|
+
/** Theme styles to response the state changes. */
|
|
221
|
+
themeStyles: {
|
|
222
|
+
default?: ItemShapeStyles;
|
|
223
|
+
[stateName: string]: ItemShapeStyles;
|
|
224
|
+
};
|
|
225
|
+
/** The zoom strategy to show and hide shapes according to their lod. */
|
|
226
|
+
lodStrategy: lodStrategyObj;
|
|
227
|
+
/** Last zoom ratio. */
|
|
228
|
+
zoom: number;
|
|
229
|
+
/** Cache the chaging states which are not consomed by draw */
|
|
230
|
+
changedStates: string[];
|
|
231
|
+
/** The listener for the animations frames. */
|
|
232
|
+
onframe: Function;
|
|
233
|
+
|
|
234
|
+
/** Gets the inner model. */
|
|
235
|
+
// getModel: () => ItemModel;
|
|
236
|
+
/** Gets the id in model. */
|
|
237
|
+
getID: () => ID;
|
|
238
|
+
/** Gets the item's type. */
|
|
239
|
+
getType: () => ITEM_TYPE;
|
|
240
|
+
/** Initiate the item. */
|
|
241
|
+
init: (props) => void;
|
|
242
|
+
/**
|
|
243
|
+
* Draws the shapes.
|
|
244
|
+
* @internal
|
|
245
|
+
* */
|
|
246
|
+
draw: (
|
|
247
|
+
displayModel: ItemDisplayModel,
|
|
248
|
+
diffData?: { previous: ItemModelData; current: ItemModelData },
|
|
249
|
+
diffState?: { previous: State[]; current: State[] },
|
|
250
|
+
) => void;
|
|
251
|
+
/**
|
|
252
|
+
* Updates the shapes.
|
|
253
|
+
* @internal
|
|
254
|
+
* */
|
|
255
|
+
update: (
|
|
256
|
+
model: ItemModel,
|
|
257
|
+
diffData: { previous: ItemModelData; current: ItemModelData },
|
|
258
|
+
isUpdate?: boolean,
|
|
259
|
+
) => void;
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Update the group's position, e.g. node, combo.
|
|
263
|
+
* @param displayModel
|
|
264
|
+
* @param diffData
|
|
265
|
+
* @param onfinish
|
|
266
|
+
* @returns
|
|
267
|
+
*/
|
|
268
|
+
updatePosition: (
|
|
269
|
+
displayModel: ItemDisplayModel,
|
|
270
|
+
diffData?: { previous: ItemModelData; current: ItemModelData },
|
|
271
|
+
onfinish?: Function,
|
|
272
|
+
) => void;
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Maps (mapper will be function, value, or encode format) model to displayModel and find out the shapes to be update for incremental updating.
|
|
276
|
+
* @param model inner model
|
|
277
|
+
* @param diffData changes from graphCore changed event
|
|
278
|
+
* @param isReplace whether replace the whole data or partial update
|
|
279
|
+
* @returns
|
|
280
|
+
*/
|
|
281
|
+
getDisplayModelAndChanges: (
|
|
282
|
+
innerModel: ItemModel,
|
|
283
|
+
diffData?: { previous: ItemModelData; current: ItemModelData },
|
|
284
|
+
isReplace?: boolean,
|
|
285
|
+
) => {
|
|
286
|
+
model: ItemDisplayModel;
|
|
287
|
+
typeChange?: boolean;
|
|
288
|
+
};
|
|
289
|
+
/** Show the item. */
|
|
290
|
+
show: (animate: boolean) => void;
|
|
291
|
+
/** Hides the item. */
|
|
292
|
+
hide: (animate: boolean) => void;
|
|
293
|
+
/** Returns the visibility of the item. */
|
|
294
|
+
isVisible: () => boolean;
|
|
295
|
+
/** Puts the item to the front in its graphic group. */
|
|
296
|
+
toFront: () => void;
|
|
297
|
+
/** Puts the item to the back in its graphic group. */
|
|
298
|
+
toBack: () => void;
|
|
299
|
+
/** Sets a state value to the item. */
|
|
300
|
+
setState: (state: string, value: string | boolean) => void;
|
|
301
|
+
/** Returns the state if it is true/string. Returns false otherwise. */
|
|
302
|
+
hasState: (state: string) => string | boolean;
|
|
303
|
+
/** Get all the true or string states of the item. */
|
|
304
|
+
getStates: () => {
|
|
305
|
+
name: string;
|
|
306
|
+
value: boolean | string;
|
|
307
|
+
}[];
|
|
308
|
+
/** Set all the state to false. */
|
|
309
|
+
clearStates: (states?: string[]) => void;
|
|
310
|
+
/** Get the rendering bounding box for the keyShape. */
|
|
311
|
+
getKeyBBox: () => AABB;
|
|
312
|
+
/** Get the local bounding box for the keyShape. */
|
|
313
|
+
getLocalKeyBBox: () => AABB;
|
|
314
|
+
/** Get the rendering bounding box for the whole item. */
|
|
315
|
+
getBBox: () => AABB;
|
|
316
|
+
/** Stop all the animations on the item. */
|
|
317
|
+
stopAnimations: () => void;
|
|
318
|
+
/** Animations' frame listemer. */
|
|
319
|
+
animateFrameListener: Function;
|
|
320
|
+
/** Call render extension's onZoom to response the graph zooming. */
|
|
321
|
+
updateZoom: (zoom: number) => void;
|
|
322
|
+
/** Destroy the item. */
|
|
323
|
+
destroy: () => void;
|
|
324
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { IAnimationEffectTiming } from '@antv/g';
|
|
2
|
+
import {
|
|
3
|
+
CircularLayoutOptions,
|
|
4
|
+
ConcentricLayoutOptions,
|
|
5
|
+
D3ForceLayoutOptions,
|
|
6
|
+
ForceAtlas2LayoutOptions,
|
|
7
|
+
ForceLayoutOptions,
|
|
8
|
+
FruchtermanLayoutOptions,
|
|
9
|
+
GridLayoutOptions,
|
|
10
|
+
LayoutMapping,
|
|
11
|
+
MDSLayoutOptions,
|
|
12
|
+
RadialLayoutOptions,
|
|
13
|
+
RandomLayoutOptions,
|
|
14
|
+
} from '@antv/layout';
|
|
15
|
+
import { GraphCore } from './data';
|
|
16
|
+
|
|
17
|
+
type Animatable = {
|
|
18
|
+
/**
|
|
19
|
+
* Make layout animated. For layouts with iterations, transitions will happen between ticks.
|
|
20
|
+
*/
|
|
21
|
+
animated?: boolean;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Effect timing of animation for layouts without iterations.
|
|
25
|
+
* @see https://g.antv.antgroup.com/api/animation/waapi#effecttiming
|
|
26
|
+
*/
|
|
27
|
+
animationEffectTiming?: Partial<IAnimationEffectTiming>;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
type Workerized = {
|
|
31
|
+
/**
|
|
32
|
+
* Make layout running in WebWorker.
|
|
33
|
+
*/
|
|
34
|
+
workerEnabled?: boolean;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Iterations for iteratable layouts such as Force.
|
|
38
|
+
*/
|
|
39
|
+
iterations?: number;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type ImmediatelyInvokedLayoutOptions = {
|
|
43
|
+
/**
|
|
44
|
+
* like an IIFE.
|
|
45
|
+
*/
|
|
46
|
+
execute: (graph: GraphCore, options?: any) => Promise<LayoutMapping>;
|
|
47
|
+
} & Animatable;
|
|
48
|
+
|
|
49
|
+
type CustomLayout = {
|
|
50
|
+
type: string;
|
|
51
|
+
[option: string]: any;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export type StandardLayoutOptions =
|
|
55
|
+
| (
|
|
56
|
+
| CircularLayout
|
|
57
|
+
| RandomLayout
|
|
58
|
+
| ConcentricLayout
|
|
59
|
+
| GridLayout
|
|
60
|
+
| MDSLayout
|
|
61
|
+
| RadialLayout
|
|
62
|
+
| FruchtermanLayout
|
|
63
|
+
| D3ForceLayout
|
|
64
|
+
| ForceLayout
|
|
65
|
+
| ForceAtlas2
|
|
66
|
+
| CustomLayout
|
|
67
|
+
) &
|
|
68
|
+
Animatable &
|
|
69
|
+
Workerized;
|
|
70
|
+
|
|
71
|
+
export type LayoutOptions =
|
|
72
|
+
| StandardLayoutOptions
|
|
73
|
+
| ImmediatelyInvokedLayoutOptions;
|
|
74
|
+
|
|
75
|
+
export function isImmediatelyInvokedLayoutOptions(
|
|
76
|
+
options: any,
|
|
77
|
+
): options is ImmediatelyInvokedLayoutOptions {
|
|
78
|
+
return !!options.execute;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function isLayoutWorkerized(options: StandardLayoutOptions) {
|
|
82
|
+
return (
|
|
83
|
+
[
|
|
84
|
+
'circular',
|
|
85
|
+
'random',
|
|
86
|
+
'grid',
|
|
87
|
+
'mds',
|
|
88
|
+
'concentric',
|
|
89
|
+
'radial',
|
|
90
|
+
'fruchterman',
|
|
91
|
+
'fruchtermanGPU',
|
|
92
|
+
'd3force',
|
|
93
|
+
'force',
|
|
94
|
+
'gforce',
|
|
95
|
+
'forceAtlas2',
|
|
96
|
+
].indexOf(options.type) > -1
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
interface CircularLayout extends CircularLayoutOptions {
|
|
101
|
+
type: 'circular';
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
interface RandomLayout extends RandomLayoutOptions {
|
|
105
|
+
type: 'random';
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
interface GridLayout extends GridLayoutOptions {
|
|
109
|
+
type: 'grid';
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
interface MDSLayout extends MDSLayoutOptions {
|
|
113
|
+
type: 'mds';
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
interface ConcentricLayout extends ConcentricLayoutOptions {
|
|
117
|
+
type: 'concentric';
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
interface RadialLayout extends RadialLayoutOptions {
|
|
121
|
+
type: 'radial';
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
interface FruchtermanLayout extends FruchtermanLayoutOptions {
|
|
125
|
+
type: 'fruchterman' | 'fruchtermanGPU';
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
interface D3ForceLayout extends D3ForceLayoutOptions {
|
|
129
|
+
type: 'd3force';
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
interface ForceLayout extends ForceLayoutOptions {
|
|
133
|
+
type: 'force' | 'gforce';
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
interface ForceAtlas2 extends ForceAtlas2LayoutOptions {
|
|
137
|
+
type: 'forceAtlas2';
|
|
138
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { DisplayObject, Point } from '@antv/g';
|
|
2
|
+
import { Node as GNode, PlainObject } from '@antv/graphlib';
|
|
3
|
+
import { IAnimates } from './animate';
|
|
4
|
+
import {
|
|
5
|
+
BadgePosition,
|
|
6
|
+
Encode,
|
|
7
|
+
IBadgePosition,
|
|
8
|
+
IItem,
|
|
9
|
+
ItemShapeStyles,
|
|
10
|
+
ShapeAttrEncode,
|
|
11
|
+
ShapesEncode,
|
|
12
|
+
ShapeStyle,
|
|
13
|
+
LodStrategy,
|
|
14
|
+
} from './item';
|
|
15
|
+
|
|
16
|
+
export type NodeLabelPosition = 'bottom' | 'center' | 'top' | 'left' | 'right';
|
|
17
|
+
|
|
18
|
+
/** Data in user input model. */
|
|
19
|
+
export interface NodeUserModelData extends PlainObject {
|
|
20
|
+
/**
|
|
21
|
+
* Node position.
|
|
22
|
+
*/
|
|
23
|
+
x?: number;
|
|
24
|
+
y?: number;
|
|
25
|
+
z?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Node type, e.g. 'circle'.
|
|
28
|
+
*/
|
|
29
|
+
type?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Subject color for the keyShape and anchor points.
|
|
32
|
+
* More styles should be configured in node mapper.
|
|
33
|
+
*/
|
|
34
|
+
color?: string;
|
|
35
|
+
/**
|
|
36
|
+
* The text to show on the node.
|
|
37
|
+
* More styles should be configured in node mapper.
|
|
38
|
+
*/
|
|
39
|
+
label?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Whether show the node by default.
|
|
42
|
+
*/
|
|
43
|
+
visible?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Reserved for combo.
|
|
46
|
+
*/
|
|
47
|
+
parentId?: string;
|
|
48
|
+
/**
|
|
49
|
+
* The icon to show on the node.
|
|
50
|
+
* More styles should be configured in node mapper.
|
|
51
|
+
*/
|
|
52
|
+
icon?: {
|
|
53
|
+
type: 'icon' | 'text';
|
|
54
|
+
text?: string;
|
|
55
|
+
img?: string;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* The ratio position of the keyShape for related edges linking into.
|
|
59
|
+
* More styles should be configured in node mapper.
|
|
60
|
+
*/
|
|
61
|
+
anchorPoints?: number[][];
|
|
62
|
+
/**
|
|
63
|
+
* The badges to show on the node.
|
|
64
|
+
* More styles should be configured in node mapper.
|
|
65
|
+
*/
|
|
66
|
+
badges?: {
|
|
67
|
+
type: 'icon' | 'text';
|
|
68
|
+
text: string;
|
|
69
|
+
position: BadgePosition;
|
|
70
|
+
}[];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Data in inner model. Same format to the user data. */
|
|
74
|
+
export interface NodeModelData extends NodeUserModelData {}
|
|
75
|
+
|
|
76
|
+
export interface NodeShapeStyles extends ItemShapeStyles {
|
|
77
|
+
// keyShape, iconShape, haloShape are defined in ItemShapeStyles
|
|
78
|
+
labelShape?: ShapeStyle & {
|
|
79
|
+
position?: 'top' | 'bottom' | 'left' | 'right' | 'center';
|
|
80
|
+
offsetX?: number;
|
|
81
|
+
offsetY?: number;
|
|
82
|
+
offsetZ?: number;
|
|
83
|
+
// string means the percentage of the keyShape, number means pixel
|
|
84
|
+
maxWidth?: string | number;
|
|
85
|
+
};
|
|
86
|
+
labelBackgroundShape?: ShapeStyle & {
|
|
87
|
+
padding?: number | number[];
|
|
88
|
+
};
|
|
89
|
+
badgeShapes?: ShapeStyle & {
|
|
90
|
+
// common badge styles
|
|
91
|
+
color?: string;
|
|
92
|
+
textColor?: string;
|
|
93
|
+
// individual styles and their position
|
|
94
|
+
[key: number]: ShapeStyle & {
|
|
95
|
+
position?: IBadgePosition;
|
|
96
|
+
color?: string;
|
|
97
|
+
textColor?: string;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
anchorShapes?: ShapeStyle & {
|
|
101
|
+
// common badge styles
|
|
102
|
+
color?: string;
|
|
103
|
+
textColor?: string;
|
|
104
|
+
size?: number;
|
|
105
|
+
offsetX?: number;
|
|
106
|
+
offsetY?: number;
|
|
107
|
+
offsetZ?: number;
|
|
108
|
+
// individual styles and their position
|
|
109
|
+
[key: number]: ShapeStyle & {
|
|
110
|
+
position?: BadgePosition;
|
|
111
|
+
color?: string;
|
|
112
|
+
textColor?: string;
|
|
113
|
+
size?: number;
|
|
114
|
+
offsetX?: number;
|
|
115
|
+
offsetY?: number;
|
|
116
|
+
offsetZ?: number;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** Data in display model. */
|
|
122
|
+
export type NodeDisplayModelData = NodeModelData &
|
|
123
|
+
NodeShapeStyles & { lodStrategy?: LodStrategy };
|
|
124
|
+
|
|
125
|
+
/** User input model. */
|
|
126
|
+
export type NodeUserModel = GNode<NodeUserModelData>;
|
|
127
|
+
|
|
128
|
+
/** Inner node model, clone and transform from user data. */
|
|
129
|
+
export type NodeModel = GNode<NodeModelData>;
|
|
130
|
+
|
|
131
|
+
/** Displayed model, only for drawing and not received by users. */
|
|
132
|
+
export type NodeDisplayModel = GNode<NodeDisplayModelData>;
|
|
133
|
+
|
|
134
|
+
interface NodeLabelShapeAttrEncode extends ShapeAttrEncode {
|
|
135
|
+
// TODO: extends Text shape attr, import from G
|
|
136
|
+
position?: NodeLabelPosition | Encode<NodeLabelPosition>;
|
|
137
|
+
offsetX?: number | Encode<number>;
|
|
138
|
+
offsetY?: number | Encode<number>;
|
|
139
|
+
offsetZ?: number | Encode<number>;
|
|
140
|
+
}
|
|
141
|
+
export interface NodeShapesEncode extends ShapesEncode {
|
|
142
|
+
labelShape?: NodeLabelShapeAttrEncode | Encode<ShapeStyle>;
|
|
143
|
+
labelBackgroundShape?: ShapeAttrEncode[] | Encode<ShapeStyle[]>;
|
|
144
|
+
anchorShapes?: ShapeAttrEncode[] | Encode<ShapeStyle[]>;
|
|
145
|
+
badgeShapes?: ShapeAttrEncode[] | Encode<ShapeStyle[]>;
|
|
146
|
+
}
|
|
147
|
+
export interface NodeEncode extends NodeShapesEncode {
|
|
148
|
+
type?: string | Encode<string>;
|
|
149
|
+
animates?: IAnimates;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export interface NodeShapeMap {
|
|
153
|
+
keyShape: DisplayObject;
|
|
154
|
+
labelShape?: DisplayObject;
|
|
155
|
+
iconShape?: DisplayObject;
|
|
156
|
+
|
|
157
|
+
// TODO other badge shapes
|
|
158
|
+
[otherShapeId: string]: DisplayObject;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// TODO
|
|
162
|
+
export type INode = IItem;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { each, deepMix } from '@antv/util';
|
|
2
|
+
import { IGraph } from './graph';
|
|
3
|
+
|
|
4
|
+
export interface IPluginBaseConfig {
|
|
5
|
+
container?: HTMLDivElement | string | null;
|
|
6
|
+
className?: string;
|
|
7
|
+
graph?: IGraph;
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface EventMapType {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export abstract class Plugin {
|
|
16
|
+
private events: EventMapType;
|
|
17
|
+
|
|
18
|
+
public options: IPluginBaseConfig;
|
|
19
|
+
|
|
20
|
+
public destroyed: boolean;
|
|
21
|
+
|
|
22
|
+
public graph: IGraph;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Constructor for the Plugin Base Class.
|
|
26
|
+
* @param options options for the plugin
|
|
27
|
+
*/
|
|
28
|
+
constructor(options?: IPluginBaseConfig) {
|
|
29
|
+
this.options = deepMix(this.getDefaultCfgs(), options);
|
|
30
|
+
this.events = {};
|
|
31
|
+
this.destroyed = false;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Update the options for the plugin.
|
|
36
|
+
* @param options
|
|
37
|
+
*/
|
|
38
|
+
public updateCfgs(options?: IPluginBaseConfig) {
|
|
39
|
+
this.options = deepMix(this.options, options);
|
|
40
|
+
this.init(this.graph);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Get the defualt options of the plugin.
|
|
45
|
+
*/
|
|
46
|
+
public getDefaultCfgs() {
|
|
47
|
+
return {};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Init.
|
|
52
|
+
*/
|
|
53
|
+
public init(graph: IGraph) {
|
|
54
|
+
this.graph = graph;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Returns the key(graph event name) value(listener) map.
|
|
59
|
+
* Should be implemented by the plugin.
|
|
60
|
+
*/
|
|
61
|
+
public getEvents() {
|
|
62
|
+
return {};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Destroy method, should be implemented by the plugin.
|
|
66
|
+
*/
|
|
67
|
+
public destroy() {
|
|
68
|
+
const { graph } = this;
|
|
69
|
+
const events = this.events;
|
|
70
|
+
each(events, (v, k) => {
|
|
71
|
+
graph.off(k, v);
|
|
72
|
+
});
|
|
73
|
+
(this.events as EventMapType | null) = null;
|
|
74
|
+
(this.options as IPluginBaseConfig | null) = null;
|
|
75
|
+
this.destroyed = true;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type RendererName = 'canvas' | 'svg' | 'webgl' | 'webgl-3d';
|