@antv/g6 5.0.0-beta.0 → 5.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/g6.min.js +2 -2
- package/esm/api-doc/item.d.ts +2 -0
- package/esm/api-doc/item.js +2 -0
- package/esm/api-doc/item.js.map +1 -1
- package/esm/constant/shape.d.ts +4 -1
- package/esm/constant/shape.js.map +1 -1
- package/esm/index.d.ts +22 -7
- package/esm/index.js +3 -2
- package/esm/index.js.map +1 -1
- package/esm/item/combo.d.ts +1 -1
- package/esm/item/combo.js +16 -9
- package/esm/item/combo.js.map +1 -1
- package/esm/item/edge.d.ts +20 -3
- package/esm/item/edge.js +99 -43
- package/esm/item/edge.js.map +1 -1
- package/esm/item/item.d.ts +3 -2
- package/esm/item/item.js +21 -11
- package/esm/item/item.js.map +1 -1
- package/esm/item/node.d.ts +2 -1
- package/esm/item/node.js +33 -16
- package/esm/item/node.js.map +1 -1
- package/esm/runtime/controller/data.d.ts +7 -10
- package/esm/runtime/controller/data.js +127 -283
- package/esm/runtime/controller/data.js.map +1 -1
- package/esm/runtime/controller/item.d.ts +1 -0
- package/esm/runtime/controller/item.js +267 -151
- package/esm/runtime/controller/item.js.map +1 -1
- package/esm/runtime/controller/plugin.js +3 -3
- package/esm/runtime/controller/plugin.js.map +1 -1
- package/esm/runtime/graph.d.ts +103 -23
- package/esm/runtime/graph.js +460 -88
- package/esm/runtime/graph.js.map +1 -1
- package/esm/stdlib/behavior/activate-relations.d.ts +9 -9
- package/esm/stdlib/behavior/activate-relations.js +8 -8
- package/esm/stdlib/behavior/activate-relations.js.map +1 -1
- package/esm/stdlib/behavior/brush-select.js +1 -2
- package/esm/stdlib/behavior/brush-select.js.map +1 -1
- package/esm/stdlib/behavior/click-select.js +1 -1
- package/esm/stdlib/behavior/click-select.js.map +1 -1
- package/esm/stdlib/behavior/create-edge.d.ts +57 -0
- package/esm/stdlib/behavior/create-edge.js +207 -0
- package/esm/stdlib/behavior/create-edge.js.map +1 -0
- package/esm/stdlib/behavior/drag-canvas.d.ts +2 -1
- package/esm/stdlib/behavior/drag-canvas.js +57 -26
- package/esm/stdlib/behavior/drag-canvas.js.map +1 -1
- package/esm/stdlib/behavior/drag-combo.d.ts +2 -2
- package/esm/stdlib/behavior/drag-combo.js +43 -32
- package/esm/stdlib/behavior/drag-combo.js.map +1 -1
- package/esm/stdlib/behavior/drag-node.d.ts +3 -3
- package/esm/stdlib/behavior/drag-node.js +76 -63
- package/esm/stdlib/behavior/drag-node.js.map +1 -1
- package/esm/stdlib/behavior/index.d.ts +3 -0
- package/esm/stdlib/behavior/index.js +3 -0
- package/esm/stdlib/behavior/index.js.map +1 -1
- package/esm/stdlib/behavior/lasso-select.d.ts +1 -1
- package/esm/stdlib/behavior/lasso-select.js +1 -2
- package/esm/stdlib/behavior/lasso-select.js.map +1 -1
- package/esm/stdlib/behavior/scroll-canvas.d.ts +67 -0
- package/esm/stdlib/behavior/scroll-canvas.js +266 -0
- package/esm/stdlib/behavior/scroll-canvas.js.map +1 -0
- package/esm/stdlib/behavior/shortcuts-call.d.ts +38 -0
- package/esm/stdlib/behavior/shortcuts-call.js +80 -0
- package/esm/stdlib/behavior/shortcuts-call.js.map +1 -0
- package/esm/stdlib/behavior/zoom-canvas.d.ts +2 -1
- package/esm/stdlib/behavior/zoom-canvas.js +55 -24
- package/esm/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/esm/stdlib/data/mapNodeSize.d.ts +2 -2
- package/esm/stdlib/data/mapNodeSize.js +2 -2
- package/esm/stdlib/data/mapNodeSize.js.map +1 -1
- package/esm/stdlib/data/transformV4Data.d.ts +2 -2
- package/esm/stdlib/data/transformV4Data.js +2 -2
- package/esm/stdlib/data/transformV4Data.js.map +1 -1
- package/esm/stdlib/data/validateData.d.ts +2 -2
- package/esm/stdlib/data/validateData.js +16 -11
- package/esm/stdlib/data/validateData.js.map +1 -1
- package/esm/stdlib/index.d.ts +16 -6
- package/esm/stdlib/index.js +20 -10
- package/esm/stdlib/index.js.map +1 -1
- package/esm/stdlib/item/edge/base.d.ts +96 -6
- package/esm/stdlib/item/edge/base.js +92 -19
- package/esm/stdlib/item/edge/base.js.map +1 -1
- package/esm/stdlib/item/edge/line.js +5 -2
- package/esm/stdlib/item/edge/line.js.map +1 -1
- package/esm/stdlib/item/edge/polyline.d.ts +3 -2
- package/esm/stdlib/item/edge/polyline.js +3 -3
- package/esm/stdlib/item/edge/polyline.js.map +1 -1
- package/esm/stdlib/item/node/base.d.ts +90 -16
- package/esm/stdlib/item/node/base.js +91 -41
- package/esm/stdlib/item/node/base.js.map +1 -1
- package/esm/stdlib/item/node/base3d.d.ts +24 -0
- package/esm/stdlib/item/node/base3d.js +24 -8
- package/esm/stdlib/item/node/base3d.js.map +1 -1
- package/esm/stdlib/item/node/diamond.js +1 -1
- package/esm/stdlib/item/node/ellipse.js +2 -2
- package/esm/stdlib/item/node/hexagon.js +12 -5
- package/esm/stdlib/item/node/hexagon.js.map +1 -1
- package/esm/stdlib/item/node/image.d.ts +40 -0
- package/esm/stdlib/item/node/image.js +110 -0
- package/esm/stdlib/item/node/image.js.map +1 -0
- package/esm/stdlib/item/node/index.d.ts +1 -0
- package/esm/stdlib/item/node/index.js +1 -0
- package/esm/stdlib/item/node/index.js.map +1 -1
- package/esm/stdlib/plugin/history/combo-command.js +2 -2
- package/esm/stdlib/plugin/history/combo-command.js.map +1 -1
- package/esm/stdlib/plugin/history/index.d.ts +10 -10
- package/esm/stdlib/plugin/history/index.js +14 -14
- package/esm/stdlib/plugin/history/index.js.map +1 -1
- package/esm/stdlib/plugin/history/item-data-command.js +25 -16
- package/esm/stdlib/plugin/history/item-data-command.js.map +1 -1
- package/esm/stdlib/plugin/history/layer-updated-command.js +2 -2
- package/esm/stdlib/plugin/history/layer-updated-command.js.map +1 -1
- package/esm/stdlib/plugin/history/state-updated-command.js +1 -1
- package/esm/stdlib/plugin/history/state-updated-command.js.map +1 -1
- package/esm/stdlib/plugin/history/visibility-updated-command.js +2 -2
- package/esm/stdlib/plugin/history/visibility-updated-command.js.map +1 -1
- package/esm/stdlib/plugin/hull/hullComponent.d.ts +1 -1
- package/esm/stdlib/plugin/hull/hullComponent.js +3 -6
- package/esm/stdlib/plugin/hull/hullComponent.js.map +1 -1
- package/esm/stdlib/plugin/index.d.ts +2 -0
- package/esm/stdlib/plugin/index.js +2 -0
- package/esm/stdlib/plugin/index.js.map +1 -1
- package/esm/stdlib/plugin/legend/index.js +5 -3
- package/esm/stdlib/plugin/legend/index.js.map +1 -1
- package/esm/stdlib/plugin/map/index.d.ts +118 -0
- package/esm/stdlib/plugin/map/index.js +683 -0
- package/esm/stdlib/plugin/map/index.js.map +1 -0
- package/esm/stdlib/plugin/minimap/index.d.ts +5 -1
- package/esm/stdlib/plugin/minimap/index.js +116 -9
- package/esm/stdlib/plugin/minimap/index.js.map +1 -1
- package/esm/stdlib/plugin/snapline/index.d.ts +167 -0
- package/esm/stdlib/plugin/snapline/index.js +1063 -0
- package/esm/stdlib/plugin/snapline/index.js.map +1 -0
- package/esm/stdlib/plugin/timebar/index.d.ts +98 -0
- package/esm/stdlib/plugin/timebar/index.js +303 -0
- package/esm/stdlib/plugin/timebar/index.js.map +1 -0
- package/esm/stdlib/plugin/toolbar/index.js +1 -1
- package/esm/stdlib/plugin/toolbar/index.js.map +1 -1
- package/esm/stdlib/plugin/types.d.ts +2 -0
- package/esm/stdlib/theme/dark.js +42 -2
- package/esm/stdlib/theme/dark.js.map +1 -1
- package/esm/stdlib/theme/light.js +4 -4
- package/esm/types/common.d.ts +1 -0
- package/esm/types/event.d.ts +1 -0
- package/esm/types/graph.d.ts +48 -22
- package/esm/types/hook.d.ts +22 -2
- package/esm/types/item.d.ts +6 -0
- package/esm/types/item.js.map +1 -1
- package/esm/types/spec.d.ts +20 -4
- package/esm/types/view.d.ts +5 -0
- package/esm/util/bbox.d.ts +16 -1
- package/esm/util/bbox.js +29 -0
- package/esm/util/bbox.js.map +1 -1
- package/esm/util/canvas.d.ts +2 -2
- package/esm/util/canvas.js +5 -11
- package/esm/util/canvas.js.map +1 -1
- package/esm/util/event.d.ts +3 -1
- package/esm/util/event.js +8 -1
- package/esm/util/event.js.map +1 -1
- package/esm/util/item.d.ts +16 -1
- package/esm/util/item.js +31 -8
- package/esm/util/item.js.map +1 -1
- package/esm/util/layout.d.ts +11 -0
- package/esm/util/layout.js +45 -0
- package/esm/util/layout.js.map +1 -1
- package/esm/util/point.js +9 -2
- package/esm/util/point.js.map +1 -1
- package/esm/util/router.d.ts +4 -3
- package/esm/util/router.js +8 -5
- package/esm/util/router.js.map +1 -1
- package/esm/util/shape.d.ts +3 -3
- package/esm/util/shape.js +8 -12
- package/esm/util/shape.js.map +1 -1
- package/esm/util/warn.d.ts +14 -0
- package/esm/util/warn.js +4 -0
- package/esm/util/warn.js.map +1 -0
- package/lib/api-doc/item.d.ts +2 -0
- package/lib/api-doc/item.js +5 -1
- package/lib/api-doc/item.js.map +1 -1
- package/lib/constant/shape.d.ts +4 -1
- package/lib/constant/shape.js.map +1 -1
- package/lib/index.d.ts +22 -7
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/item/combo.d.ts +1 -1
- package/lib/item/combo.js +16 -9
- package/lib/item/combo.js.map +1 -1
- package/lib/item/edge.d.ts +20 -3
- package/lib/item/edge.js +98 -42
- package/lib/item/edge.js.map +1 -1
- package/lib/item/item.d.ts +3 -2
- package/lib/item/item.js +21 -11
- package/lib/item/item.js.map +1 -1
- package/lib/item/node.d.ts +2 -1
- package/lib/item/node.js +33 -16
- package/lib/item/node.js.map +1 -1
- package/lib/runtime/controller/data.d.ts +7 -10
- package/lib/runtime/controller/data.js +127 -283
- package/lib/runtime/controller/data.js.map +1 -1
- package/lib/runtime/controller/item.d.ts +1 -0
- package/lib/runtime/controller/item.js +266 -150
- package/lib/runtime/controller/item.js.map +1 -1
- package/lib/runtime/controller/plugin.js +3 -3
- package/lib/runtime/controller/plugin.js.map +1 -1
- package/lib/runtime/graph.d.ts +103 -23
- package/lib/runtime/graph.js +460 -88
- package/lib/runtime/graph.js.map +1 -1
- package/lib/stdlib/behavior/activate-relations.d.ts +9 -9
- package/lib/stdlib/behavior/activate-relations.js +8 -8
- package/lib/stdlib/behavior/activate-relations.js.map +1 -1
- package/lib/stdlib/behavior/brush-select.js +1 -2
- package/lib/stdlib/behavior/brush-select.js.map +1 -1
- package/lib/stdlib/behavior/click-select.js +1 -1
- package/lib/stdlib/behavior/click-select.js.map +1 -1
- package/lib/stdlib/behavior/create-edge.d.ts +57 -0
- package/lib/stdlib/behavior/create-edge.js +211 -0
- package/lib/stdlib/behavior/create-edge.js.map +1 -0
- package/lib/stdlib/behavior/drag-canvas.d.ts +2 -1
- package/lib/stdlib/behavior/drag-canvas.js +57 -26
- package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
- package/lib/stdlib/behavior/drag-combo.d.ts +2 -2
- package/lib/stdlib/behavior/drag-combo.js +43 -32
- package/lib/stdlib/behavior/drag-combo.js.map +1 -1
- package/lib/stdlib/behavior/drag-node.d.ts +3 -3
- package/lib/stdlib/behavior/drag-node.js +76 -63
- package/lib/stdlib/behavior/drag-node.js.map +1 -1
- package/lib/stdlib/behavior/index.d.ts +3 -0
- package/lib/stdlib/behavior/index.js +3 -0
- package/lib/stdlib/behavior/index.js.map +1 -1
- package/lib/stdlib/behavior/lasso-select.d.ts +1 -1
- package/lib/stdlib/behavior/lasso-select.js +1 -2
- package/lib/stdlib/behavior/lasso-select.js.map +1 -1
- package/lib/stdlib/behavior/scroll-canvas.d.ts +67 -0
- package/lib/stdlib/behavior/scroll-canvas.js +270 -0
- package/lib/stdlib/behavior/scroll-canvas.js.map +1 -0
- package/lib/stdlib/behavior/shortcuts-call.d.ts +38 -0
- package/lib/stdlib/behavior/shortcuts-call.js +84 -0
- package/lib/stdlib/behavior/shortcuts-call.js.map +1 -0
- package/lib/stdlib/behavior/zoom-canvas.d.ts +2 -1
- package/lib/stdlib/behavior/zoom-canvas.js +55 -24
- package/lib/stdlib/behavior/zoom-canvas.js.map +1 -1
- package/lib/stdlib/data/mapNodeSize.d.ts +2 -2
- package/lib/stdlib/data/mapNodeSize.js +2 -2
- package/lib/stdlib/data/mapNodeSize.js.map +1 -1
- package/lib/stdlib/data/transformV4Data.d.ts +2 -2
- package/lib/stdlib/data/transformV4Data.js +2 -2
- package/lib/stdlib/data/transformV4Data.js.map +1 -1
- package/lib/stdlib/data/validateData.d.ts +2 -2
- package/lib/stdlib/data/validateData.js +16 -11
- package/lib/stdlib/data/validateData.js.map +1 -1
- package/lib/stdlib/index.d.ts +16 -6
- package/lib/stdlib/index.js +20 -10
- package/lib/stdlib/index.js.map +1 -1
- package/lib/stdlib/item/edge/base.d.ts +96 -6
- package/lib/stdlib/item/edge/base.js +92 -19
- package/lib/stdlib/item/edge/base.js.map +1 -1
- package/lib/stdlib/item/edge/line.js +5 -2
- package/lib/stdlib/item/edge/line.js.map +1 -1
- package/lib/stdlib/item/edge/polyline.d.ts +3 -2
- package/lib/stdlib/item/edge/polyline.js +3 -3
- package/lib/stdlib/item/edge/polyline.js.map +1 -1
- package/lib/stdlib/item/node/base.d.ts +90 -16
- package/lib/stdlib/item/node/base.js +91 -41
- package/lib/stdlib/item/node/base.js.map +1 -1
- package/lib/stdlib/item/node/base3d.d.ts +24 -0
- package/lib/stdlib/item/node/base3d.js +24 -8
- package/lib/stdlib/item/node/base3d.js.map +1 -1
- package/lib/stdlib/item/node/diamond.js +1 -1
- package/lib/stdlib/item/node/ellipse.js +2 -2
- package/lib/stdlib/item/node/hexagon.js +12 -5
- package/lib/stdlib/item/node/hexagon.js.map +1 -1
- package/lib/stdlib/item/node/image.d.ts +40 -0
- package/lib/stdlib/item/node/image.js +114 -0
- package/lib/stdlib/item/node/image.js.map +1 -0
- package/lib/stdlib/item/node/index.d.ts +1 -0
- package/lib/stdlib/item/node/index.js +1 -0
- package/lib/stdlib/item/node/index.js.map +1 -1
- package/lib/stdlib/plugin/history/combo-command.js +2 -2
- package/lib/stdlib/plugin/history/combo-command.js.map +1 -1
- package/lib/stdlib/plugin/history/index.d.ts +10 -10
- package/lib/stdlib/plugin/history/index.js +14 -14
- package/lib/stdlib/plugin/history/index.js.map +1 -1
- package/lib/stdlib/plugin/history/item-data-command.js +25 -16
- package/lib/stdlib/plugin/history/item-data-command.js.map +1 -1
- package/lib/stdlib/plugin/history/layer-updated-command.js +2 -2
- package/lib/stdlib/plugin/history/layer-updated-command.js.map +1 -1
- package/lib/stdlib/plugin/history/state-updated-command.js +1 -1
- package/lib/stdlib/plugin/history/state-updated-command.js.map +1 -1
- package/lib/stdlib/plugin/history/visibility-updated-command.js +2 -2
- package/lib/stdlib/plugin/history/visibility-updated-command.js.map +1 -1
- package/lib/stdlib/plugin/hull/hullComponent.d.ts +1 -1
- package/lib/stdlib/plugin/hull/hullComponent.js +3 -6
- package/lib/stdlib/plugin/hull/hullComponent.js.map +1 -1
- package/lib/stdlib/plugin/index.d.ts +2 -0
- package/lib/stdlib/plugin/index.js +2 -0
- package/lib/stdlib/plugin/index.js.map +1 -1
- package/lib/stdlib/plugin/legend/index.js +5 -3
- package/lib/stdlib/plugin/legend/index.js.map +1 -1
- package/lib/stdlib/plugin/map/index.d.ts +118 -0
- package/lib/stdlib/plugin/map/index.js +687 -0
- package/lib/stdlib/plugin/map/index.js.map +1 -0
- package/lib/stdlib/plugin/minimap/index.d.ts +5 -1
- package/lib/stdlib/plugin/minimap/index.js +116 -9
- package/lib/stdlib/plugin/minimap/index.js.map +1 -1
- package/lib/stdlib/plugin/snapline/index.d.ts +167 -0
- package/lib/stdlib/plugin/snapline/index.js +1067 -0
- package/lib/stdlib/plugin/snapline/index.js.map +1 -0
- package/lib/stdlib/plugin/timebar/index.d.ts +98 -0
- package/lib/stdlib/plugin/timebar/index.js +307 -0
- package/lib/stdlib/plugin/timebar/index.js.map +1 -0
- package/lib/stdlib/plugin/toolbar/index.js +1 -1
- package/lib/stdlib/plugin/toolbar/index.js.map +1 -1
- package/lib/stdlib/plugin/types.d.ts +2 -0
- package/lib/stdlib/theme/dark.js +42 -2
- package/lib/stdlib/theme/dark.js.map +1 -1
- package/lib/stdlib/theme/light.js +4 -4
- package/lib/types/common.d.ts +1 -0
- package/lib/types/event.d.ts +1 -0
- package/lib/types/graph.d.ts +48 -22
- package/lib/types/hook.d.ts +22 -2
- package/lib/types/item.d.ts +6 -0
- package/lib/types/item.js.map +1 -1
- package/lib/types/spec.d.ts +20 -4
- package/lib/types/view.d.ts +5 -0
- package/lib/util/bbox.d.ts +16 -1
- package/lib/util/bbox.js +32 -1
- package/lib/util/bbox.js.map +1 -1
- package/lib/util/canvas.d.ts +2 -2
- package/lib/util/canvas.js +5 -11
- package/lib/util/canvas.js.map +1 -1
- package/lib/util/event.d.ts +3 -1
- package/lib/util/event.js +8 -1
- package/lib/util/event.js.map +1 -1
- package/lib/util/item.d.ts +16 -1
- package/lib/util/item.js +33 -9
- package/lib/util/item.js.map +1 -1
- package/lib/util/layout.d.ts +11 -0
- package/lib/util/layout.js +47 -1
- package/lib/util/layout.js.map +1 -1
- package/lib/util/point.js +9 -2
- package/lib/util/point.js.map +1 -1
- package/lib/util/router.d.ts +4 -3
- package/lib/util/router.js +8 -5
- package/lib/util/router.js.map +1 -1
- package/lib/util/shape.d.ts +3 -3
- package/lib/util/shape.js +8 -12
- package/lib/util/shape.js.map +1 -1
- package/lib/util/warn.d.ts +14 -0
- package/lib/util/warn.js +8 -0
- package/lib/util/warn.js.map +1 -0
- package/package.json +10 -10
- package/src/api-doc/item.ts +2 -0
- package/src/constant/shape.ts +2 -1
- package/src/index.ts +4 -2
- package/src/item/combo.ts +14 -9
- package/src/item/edge.ts +131 -57
- package/src/item/item.ts +24 -15
- package/src/item/node.ts +38 -24
- package/src/runtime/controller/data.ts +142 -341
- package/src/runtime/controller/item.ts +236 -72
- package/src/runtime/controller/plugin.ts +15 -3
- package/src/runtime/graph.ts +592 -96
- package/src/stdlib/behavior/activate-relations.ts +8 -8
- package/src/stdlib/behavior/brush-select.ts +4 -2
- package/src/stdlib/behavior/click-select.ts +1 -1
- package/src/stdlib/behavior/create-edge.ts +296 -0
- package/src/stdlib/behavior/drag-canvas.ts +76 -27
- package/src/stdlib/behavior/drag-combo.ts +10 -10
- package/src/stdlib/behavior/drag-node.ts +18 -18
- package/src/stdlib/behavior/index.ts +3 -0
- package/src/stdlib/behavior/lasso-select.ts +5 -3
- package/src/stdlib/behavior/scroll-canvas.ts +348 -0
- package/src/stdlib/behavior/shortcuts-call.ts +120 -0
- package/src/stdlib/behavior/zoom-canvas.ts +72 -25
- package/src/stdlib/data/mapNodeSize.ts +2 -2
- package/src/stdlib/data/transformV4Data.ts +2 -2
- package/src/stdlib/data/validateData.ts +16 -11
- package/src/stdlib/index.ts +33 -9
- package/src/stdlib/item/edge/base.ts +118 -19
- package/src/stdlib/item/edge/line.ts +8 -2
- package/src/stdlib/item/edge/polyline.ts +7 -5
- package/src/stdlib/item/node/base.ts +117 -46
- package/src/stdlib/item/node/base3d.ts +24 -9
- package/src/stdlib/item/node/diamond.ts +1 -1
- package/src/stdlib/item/node/ellipse.ts +2 -2
- package/src/stdlib/item/node/hexagon.ts +14 -6
- package/src/stdlib/item/node/image.ts +190 -0
- package/src/stdlib/item/node/index.ts +1 -0
- package/src/stdlib/plugin/history/combo-command.ts +2 -2
- package/src/stdlib/plugin/history/index.ts +14 -14
- package/src/stdlib/plugin/history/item-data-command.ts +35 -17
- package/src/stdlib/plugin/history/layer-updated-command.ts +2 -2
- package/src/stdlib/plugin/history/state-updated-command.ts +1 -1
- package/src/stdlib/plugin/history/visibility-updated-command.ts +2 -2
- package/src/stdlib/plugin/hull/hullComponent.ts +8 -5
- package/src/stdlib/plugin/index.ts +2 -0
- package/src/stdlib/plugin/legend/index.ts +5 -4
- package/src/stdlib/plugin/map/index.ts +808 -0
- package/src/stdlib/plugin/minimap/index.ts +120 -10
- package/src/stdlib/plugin/snapline/index.ts +1297 -0
- package/src/stdlib/plugin/timebar/index.ts +473 -0
- package/src/stdlib/plugin/toolbar/index.ts +1 -1
- package/src/stdlib/plugin/types.ts +2 -0
- package/src/stdlib/theme/dark.ts +66 -2
- package/src/stdlib/theme/light.ts +4 -4
- package/src/types/common.ts +1 -0
- package/src/types/event.ts +1 -0
- package/src/types/graph.ts +59 -25
- package/src/types/hook.ts +22 -2
- package/src/types/item.ts +10 -0
- package/src/types/spec.ts +23 -4
- package/src/types/view.ts +8 -3
- package/src/util/bbox.ts +38 -1
- package/src/util/canvas.ts +5 -5
- package/src/util/event.ts +14 -1
- package/src/util/item.ts +65 -28
- package/src/util/layout.ts +45 -0
- package/src/util/point.ts +8 -3
- package/src/util/router.ts +15 -6
- package/src/util/shape.ts +16 -14
- package/src/util/warn.ts +20 -0
- package/src/api-doc/readme.md +0 -59
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { DisplayObject } from '@antv/g';
|
|
2
|
+
import { ComboDisplayModel, NodeDisplayModel } from '../../../types';
|
|
3
|
+
import { State } from '../../../types/item';
|
|
4
|
+
import {
|
|
5
|
+
NodeModelData,
|
|
6
|
+
NodeShapeMap,
|
|
7
|
+
NodeShapeStyles,
|
|
8
|
+
} from '../../../types/node';
|
|
9
|
+
import { convertToNumber } from '../../../util/type';
|
|
10
|
+
import { ComboModelData, ComboShapeMap } from '../../../types/combo';
|
|
11
|
+
import { ShapeTagMap } from '../../../util/shape';
|
|
12
|
+
import { BaseNode } from './base';
|
|
13
|
+
|
|
14
|
+
export class ImageNode extends BaseNode {
|
|
15
|
+
override defaultStyles = {
|
|
16
|
+
keyShape: {
|
|
17
|
+
x: 0,
|
|
18
|
+
y: 0,
|
|
19
|
+
width: 32,
|
|
20
|
+
height: 32,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
mergedStyles: NodeShapeStyles;
|
|
24
|
+
constructor(props) {
|
|
25
|
+
super(props);
|
|
26
|
+
// suggest to merge default styles like this to avoid style value missing
|
|
27
|
+
// this.defaultStyles = mergeStyles([this.baseDefaultStyles, this.defaultStyles]);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public override drawKeyShape(
|
|
31
|
+
model: NodeDisplayModel,
|
|
32
|
+
shapeMap: NodeShapeMap,
|
|
33
|
+
diffData?: { previous: NodeModelData; current: NodeModelData },
|
|
34
|
+
diffState?: { previous: State[]; current: State[] },
|
|
35
|
+
): DisplayObject {
|
|
36
|
+
const clipCfg = this.mergedStyles.keyShape?.clipCfg;
|
|
37
|
+
let clipPath: DisplayObject | undefined;
|
|
38
|
+
if (clipCfg) {
|
|
39
|
+
const { type, ...rest } = clipCfg;
|
|
40
|
+
clipPath = new ShapeTagMap[type]();
|
|
41
|
+
clipPath.attr(rest);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const shape = this.upsertShape(
|
|
45
|
+
'image',
|
|
46
|
+
'keyShape',
|
|
47
|
+
{
|
|
48
|
+
...this.mergedStyles.keyShape,
|
|
49
|
+
x: this.mergedStyles.keyShape!.x,
|
|
50
|
+
y: this.mergedStyles.keyShape!.y,
|
|
51
|
+
anchor: '0.5 0.5',
|
|
52
|
+
},
|
|
53
|
+
shapeMap,
|
|
54
|
+
model,
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
if (clipPath) {
|
|
58
|
+
shape.appendChild(clipPath);
|
|
59
|
+
shape.attr('clipPath', clipPath);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return shape;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public override calculateAnchorPosition(keyShapeStyle) {
|
|
66
|
+
const x = convertToNumber(keyShapeStyle.x);
|
|
67
|
+
const y = convertToNumber(keyShapeStyle.y);
|
|
68
|
+
const height = keyShapeStyle.height;
|
|
69
|
+
const width = keyShapeStyle.width;
|
|
70
|
+
const anchorPositionMap = {};
|
|
71
|
+
anchorPositionMap['top'] = [x, y - height / 2];
|
|
72
|
+
anchorPositionMap['left'] = [x - width / 2, y];
|
|
73
|
+
anchorPositionMap['right'] = anchorPositionMap['default'] = [
|
|
74
|
+
x + width / 2,
|
|
75
|
+
y,
|
|
76
|
+
];
|
|
77
|
+
anchorPositionMap['bottom'] = [x, y + height / 2];
|
|
78
|
+
return anchorPositionMap;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public draw(
|
|
82
|
+
model: NodeDisplayModel,
|
|
83
|
+
shapeMap: NodeShapeMap,
|
|
84
|
+
diffData?: { previous: NodeModelData; current: NodeModelData },
|
|
85
|
+
diffState?: { previous: State[]; current: State[] },
|
|
86
|
+
): NodeShapeMap {
|
|
87
|
+
const { data = {} } = model;
|
|
88
|
+
let shapes: NodeShapeMap = { keyShape: undefined };
|
|
89
|
+
|
|
90
|
+
// keyShape
|
|
91
|
+
shapes.keyShape = this.drawKeyShape(model, shapeMap, diffData);
|
|
92
|
+
|
|
93
|
+
// labelShape
|
|
94
|
+
if (data.labelShape) {
|
|
95
|
+
shapes.labelShape = this.drawLabelShape(model, shapeMap, diffData);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// haloShape
|
|
99
|
+
if (data.haloShape && this.drawHaloShape) {
|
|
100
|
+
shapes.haloShape = this.drawHaloShape(model, shapeMap, diffData);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// labelBackgroundShape
|
|
104
|
+
if (data.labelBackgroundShape) {
|
|
105
|
+
shapes.labelBackgroundShape = this.drawLabelBackgroundShape(
|
|
106
|
+
model,
|
|
107
|
+
shapeMap,
|
|
108
|
+
diffData,
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// anchor shapes
|
|
113
|
+
if (data.anchorShapes) {
|
|
114
|
+
const anchorShapes = this.drawAnchorShapes(
|
|
115
|
+
model,
|
|
116
|
+
shapeMap,
|
|
117
|
+
diffData,
|
|
118
|
+
diffState,
|
|
119
|
+
);
|
|
120
|
+
shapes = {
|
|
121
|
+
...shapes,
|
|
122
|
+
...anchorShapes,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// iconShape
|
|
127
|
+
if (data.iconShape) {
|
|
128
|
+
shapes.iconShape = this.drawIconShape(model, shapeMap, diffData);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// badgeShape
|
|
132
|
+
if (data.badgeShapes) {
|
|
133
|
+
const badgeShapes = this.drawBadgeShapes(
|
|
134
|
+
model,
|
|
135
|
+
shapeMap,
|
|
136
|
+
diffData,
|
|
137
|
+
diffState,
|
|
138
|
+
);
|
|
139
|
+
shapes = {
|
|
140
|
+
...shapes,
|
|
141
|
+
...badgeShapes,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// otherShapes
|
|
146
|
+
if (data.otherShapes && this.drawOtherShapes) {
|
|
147
|
+
shapes = {
|
|
148
|
+
...shapes,
|
|
149
|
+
...this.drawOtherShapes(model, shapeMap, diffData),
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
return shapes;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
public drawHaloShape(
|
|
156
|
+
model: NodeDisplayModel | ComboDisplayModel,
|
|
157
|
+
shapeMap: NodeShapeMap | ComboShapeMap,
|
|
158
|
+
diffData?: {
|
|
159
|
+
previous: NodeModelData | ComboModelData;
|
|
160
|
+
current: NodeModelData | ComboModelData;
|
|
161
|
+
},
|
|
162
|
+
diffState?: { previous: State[]; current: State[] },
|
|
163
|
+
): DisplayObject {
|
|
164
|
+
const { keyShape } = shapeMap;
|
|
165
|
+
const { haloShape: haloShapeStyle, keyShape: keyShapeStyle } =
|
|
166
|
+
this.mergedStyles;
|
|
167
|
+
if (haloShapeStyle?.visible === false) return;
|
|
168
|
+
|
|
169
|
+
const clipShape = haloShapeStyle?.clipCfg?.type || 'rect';
|
|
170
|
+
const { attributes } = keyShape;
|
|
171
|
+
const { x, y, fill } = attributes;
|
|
172
|
+
|
|
173
|
+
return this.upsertShape(
|
|
174
|
+
clipShape,
|
|
175
|
+
'haloShape',
|
|
176
|
+
{
|
|
177
|
+
...attributes,
|
|
178
|
+
...keyShapeStyle,
|
|
179
|
+
x,
|
|
180
|
+
y,
|
|
181
|
+
stroke: fill,
|
|
182
|
+
...haloShapeStyle,
|
|
183
|
+
fill: 'transparent',
|
|
184
|
+
batchKey: 'halo',
|
|
185
|
+
},
|
|
186
|
+
shapeMap,
|
|
187
|
+
model,
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
@@ -11,7 +11,7 @@ export class ComboCommand implements Command {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
undo(graph: IGraph) {
|
|
14
|
-
graph.
|
|
14
|
+
graph.executeWithNoStack(() => {
|
|
15
15
|
this.action === 'expandCombo'
|
|
16
16
|
? graph.collapseCombo(this.ids)
|
|
17
17
|
: graph.expandCombo(this.ids);
|
|
@@ -19,7 +19,7 @@ export class ComboCommand implements Command {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
redo(graph: IGraph) {
|
|
22
|
-
graph.
|
|
22
|
+
graph.executeWithNoStack(() => {
|
|
23
23
|
this.action === 'collapseCombo'
|
|
24
24
|
? graph.collapseCombo(this.ids)
|
|
25
25
|
: graph.expandCombo(this.ids);
|
|
@@ -200,7 +200,7 @@ export class History extends Base {
|
|
|
200
200
|
/**
|
|
201
201
|
* Pause stacking operations.
|
|
202
202
|
*/
|
|
203
|
-
|
|
203
|
+
pauseStack(): void {
|
|
204
204
|
this.withoutStackingCounter++;
|
|
205
205
|
|
|
206
206
|
if (this.withoutStackingCounter === 1) {
|
|
@@ -212,7 +212,7 @@ export class History extends Base {
|
|
|
212
212
|
/**
|
|
213
213
|
* Resume stacking operations.
|
|
214
214
|
*/
|
|
215
|
-
|
|
215
|
+
resumeStack(): void {
|
|
216
216
|
if (this.withoutStackingCounter > 0) {
|
|
217
217
|
this.withoutStackingCounter--;
|
|
218
218
|
}
|
|
@@ -260,14 +260,14 @@ export class History extends Base {
|
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
/**
|
|
263
|
-
* Begin a
|
|
264
|
-
* Any operations performed between `
|
|
263
|
+
* Begin a historyBatch operation.
|
|
264
|
+
* Any operations performed between `startHistoryBatch` and `stopHistoryBatch` are grouped together.
|
|
265
265
|
* treated as a single operation when undoing or redoing.
|
|
266
266
|
*/
|
|
267
|
-
public
|
|
267
|
+
public startHistoryBatch() {
|
|
268
268
|
if (this.isBatching) {
|
|
269
269
|
throw new Error(
|
|
270
|
-
'Ensure that
|
|
270
|
+
'Ensure that historyBatch processing is stopped before starting.',
|
|
271
271
|
);
|
|
272
272
|
}
|
|
273
273
|
this.initBatchCommands();
|
|
@@ -275,14 +275,14 @@ export class History extends Base {
|
|
|
275
275
|
}
|
|
276
276
|
|
|
277
277
|
/**
|
|
278
|
-
* End a
|
|
279
|
-
* Any operations performed between `
|
|
278
|
+
* End a historyBatch operation.
|
|
279
|
+
* Any operations performed between `startHistoryBatch` and `stopHistoryBatch` are grouped together.
|
|
280
280
|
* treated as a single operation when undoing or redoing.
|
|
281
281
|
*/
|
|
282
|
-
public
|
|
282
|
+
public stopHistoryBatch() {
|
|
283
283
|
if (!this.isBatching) {
|
|
284
284
|
throw new Error(
|
|
285
|
-
'Ensure that
|
|
285
|
+
'Ensure that historyBatch processing is started before stopping.',
|
|
286
286
|
);
|
|
287
287
|
}
|
|
288
288
|
this.push(this.batchCommands);
|
|
@@ -290,13 +290,13 @@ export class History extends Base {
|
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
/**
|
|
293
|
-
* Execute the provided function in a
|
|
293
|
+
* Execute the provided function in a historyBatch mode
|
|
294
294
|
* @param callback
|
|
295
295
|
*/
|
|
296
|
-
public
|
|
297
|
-
this.
|
|
296
|
+
public historyBatch(callback) {
|
|
297
|
+
this.startHistoryBatch();
|
|
298
298
|
callback();
|
|
299
|
-
this.
|
|
299
|
+
this.stopHistoryBatch();
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
public getEvents() {
|
|
@@ -26,14 +26,14 @@ export class ItemDataCommand implements Command {
|
|
|
26
26
|
|
|
27
27
|
private removeChangedData(graph) {
|
|
28
28
|
const ids = this.changes.map((data) => data.value?.id).filter(Boolean);
|
|
29
|
-
graph.
|
|
29
|
+
graph.executeWithNoStack(() => {
|
|
30
30
|
graph.removeData(this.type, ids);
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
private addChangedData(graph) {
|
|
35
35
|
const models = this.changes.map((data) => data.value).filter(Boolean);
|
|
36
|
-
graph.
|
|
36
|
+
graph.executeWithNoStack(() => {
|
|
37
37
|
graph.addData(this.type, models);
|
|
38
38
|
});
|
|
39
39
|
}
|
|
@@ -43,31 +43,49 @@ export class ItemDataCommand implements Command {
|
|
|
43
43
|
operationType: StackType,
|
|
44
44
|
onlyMove = false,
|
|
45
45
|
) {
|
|
46
|
-
|
|
46
|
+
const modelMap = new Map();
|
|
47
47
|
if (this.type === 'combo' && !onlyMove) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
data
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
this.changes.forEach((data) => {
|
|
49
|
+
const model = modelMap.get(data.nodeId) || {};
|
|
50
|
+
modelMap.set(data.nodeId, {
|
|
51
|
+
id: data.nodeId,
|
|
52
|
+
data: {
|
|
53
|
+
...model.data,
|
|
54
|
+
parentId: STACK_TYPE.undo ? data.oldParentId : data.newParentId,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
});
|
|
54
58
|
} else {
|
|
55
|
-
|
|
56
|
-
|
|
59
|
+
this.changes.forEach((data) => {
|
|
60
|
+
const value =
|
|
61
|
+
operationType === STACK_TYPE.undo ? data.oldValue : data.newValue;
|
|
62
|
+
if (
|
|
63
|
+
(typeof value === 'number' && isNaN(value)) ||
|
|
64
|
+
(['x', 'y'].includes(data.propertyName) && value === undefined)
|
|
65
|
+
) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const model = modelMap.get(data.nodeId) || {};
|
|
70
|
+
modelMap.set(data.id, {
|
|
57
71
|
id: data.id,
|
|
58
|
-
data:
|
|
59
|
-
|
|
60
|
-
|
|
72
|
+
data: {
|
|
73
|
+
...model.data,
|
|
74
|
+
[data.propertyName]: value,
|
|
75
|
+
},
|
|
76
|
+
});
|
|
61
77
|
});
|
|
62
78
|
}
|
|
63
79
|
|
|
64
|
-
graph.
|
|
80
|
+
graph.pauseStack();
|
|
81
|
+
const models = Array.from(modelMap.values());
|
|
65
82
|
if (onlyMove) {
|
|
66
|
-
|
|
83
|
+
// No matter it is node or combo, update the nodes' positions
|
|
84
|
+
graph.updateNodePosition(models, this.upsertAncestors);
|
|
67
85
|
} else {
|
|
68
86
|
graph.updateData(this.type, models);
|
|
69
87
|
}
|
|
70
|
-
graph.
|
|
88
|
+
graph.resumeStack();
|
|
71
89
|
}
|
|
72
90
|
|
|
73
91
|
undo(graph: IGraph) {
|
|
@@ -11,7 +11,7 @@ export class LayerUpdatedCommand implements Command {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
undo(graph: IGraph) {
|
|
14
|
-
graph.
|
|
14
|
+
graph.executeWithNoStack(() => {
|
|
15
15
|
this.action === 'front'
|
|
16
16
|
? graph.backItem(this.ids)
|
|
17
17
|
: graph.frontItem(this.ids);
|
|
@@ -19,7 +19,7 @@ export class LayerUpdatedCommand implements Command {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
redo(graph: IGraph) {
|
|
22
|
-
graph.
|
|
22
|
+
graph.executeWithNoStack(() => {
|
|
23
23
|
this.action === 'front'
|
|
24
24
|
? graph.frontItem(this.ids)
|
|
25
25
|
: graph.backItem(this.ids);
|
|
@@ -20,7 +20,7 @@ export class StateUpdatedCommand implements Command {
|
|
|
20
20
|
private updateItemsStates(graph, stateOptions) {
|
|
21
21
|
stateOptions?.map((option) => {
|
|
22
22
|
const { ids, states, value } = option;
|
|
23
|
-
graph.
|
|
23
|
+
graph.executeWithNoStack(() => {
|
|
24
24
|
graph.setItemState(ids, states, value);
|
|
25
25
|
});
|
|
26
26
|
});
|
|
@@ -20,13 +20,13 @@ export class VisibilityUpdatedCommand implements Command {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
private toggleItemsVisible(graph: IGraph, values) {
|
|
23
|
-
graph.
|
|
23
|
+
graph.pauseStack();
|
|
24
24
|
each(values, (value) =>
|
|
25
25
|
value.visible
|
|
26
26
|
? graph.showItem(value.ids, this.disableAnimate)
|
|
27
27
|
: graph.hideItem(value.ids, this.disableAnimate),
|
|
28
28
|
);
|
|
29
|
-
graph.
|
|
29
|
+
graph.resumeStack();
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
undo(graph: IGraph) {
|
|
@@ -51,7 +51,8 @@ interface HullComponentFullOptions extends HullComponentOptions {
|
|
|
51
51
|
export default class Hull {
|
|
52
52
|
graph: IGraph;
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
// TODO: PathArray is not exported by @antv/util 2.x but by 3.x. Correct the type String | PathArray after upgrading @antv/util
|
|
55
|
+
path: any;
|
|
55
56
|
|
|
56
57
|
members: (NodeModel | ComboModel)[];
|
|
57
58
|
|
|
@@ -172,9 +173,9 @@ export default class Hull {
|
|
|
172
173
|
const shape = this.graph.drawTransient('path', this.options.id, {
|
|
173
174
|
style: {
|
|
174
175
|
path: this.path,
|
|
176
|
+
pointerEvents: 'none',
|
|
175
177
|
...this.options.style,
|
|
176
178
|
},
|
|
177
|
-
capture: false,
|
|
178
179
|
});
|
|
179
180
|
const { labelShape } = this.options;
|
|
180
181
|
if (labelShape?.text) {
|
|
@@ -183,10 +184,10 @@ export default class Hull {
|
|
|
183
184
|
const formattedLabelStyle = this.getLabelStyle(labelShape, shapeBounds);
|
|
184
185
|
this.graph.drawTransient('text', `${this.options.id}-label`, {
|
|
185
186
|
style: {
|
|
187
|
+
pointerEvents: 'none',
|
|
186
188
|
...labelShapeStyle,
|
|
187
189
|
...formattedLabelStyle,
|
|
188
190
|
},
|
|
189
|
-
capture: false,
|
|
190
191
|
});
|
|
191
192
|
}
|
|
192
193
|
shape.toBack();
|
|
@@ -426,8 +427,10 @@ export default class Hull {
|
|
|
426
427
|
|
|
427
428
|
public updateStyle(style: ShapeStyle) {
|
|
428
429
|
this.graph.drawTransient('path', this.options.id, {
|
|
429
|
-
style
|
|
430
|
-
|
|
430
|
+
style: {
|
|
431
|
+
...style,
|
|
432
|
+
pointerEvents: 'none',
|
|
433
|
+
},
|
|
431
434
|
});
|
|
432
435
|
}
|
|
433
436
|
|
|
@@ -235,7 +235,7 @@ export class Legend extends Base {
|
|
|
235
235
|
canvasSize[0],
|
|
236
236
|
canvasSize[1],
|
|
237
237
|
undefined,
|
|
238
|
-
background,
|
|
238
|
+
{ background },
|
|
239
239
|
);
|
|
240
240
|
}
|
|
241
241
|
|
|
@@ -574,9 +574,10 @@ export class Legend extends Base {
|
|
|
574
574
|
firstItem.legend.childNodes[1].childNodes[0]
|
|
575
575
|
.childNodes[0] as DisplayObject
|
|
576
576
|
).getRenderBounds();
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
577
|
+
if (firstItemBounds) {
|
|
578
|
+
const firstBottom = firstItemBounds.max[1] + firstItem.padding[2];
|
|
579
|
+
secondItem.legend.translateLocal([0, firstBottom]);
|
|
580
|
+
}
|
|
580
581
|
} else {
|
|
581
582
|
firstItem.legend.translateLocal([
|
|
582
583
|
-bbox.min[0] + firstItem.padding[3],
|