@antv/g6 5.0.0-beta.2 → 5.0.0-beta.20
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/graph.d.ts +3 -3
- package/esm/api-doc/graph.js +3 -3
- package/esm/api-doc/graph.js.map +1 -1
- package/esm/api-doc/types.d.ts +1 -0
- package/esm/api-doc/types.js +1 -2
- package/esm/api-doc/types.js.map +1 -1
- package/esm/constant/shape.d.ts +3 -1
- package/esm/index.d.ts +24 -63
- package/esm/index.js +4 -5
- package/esm/index.js.map +1 -1
- package/esm/item/combo.d.ts +1 -1
- package/esm/item/combo.js +18 -14
- package/esm/item/combo.js.map +1 -1
- package/esm/item/edge.d.ts +19 -2
- package/esm/item/edge.js +100 -44
- package/esm/item/edge.js.map +1 -1
- package/esm/item/item.d.ts +3 -2
- package/esm/item/item.js +27 -13
- package/esm/item/item.js.map +1 -1
- package/esm/item/node.d.ts +2 -8
- package/esm/item/node.js +31 -19
- package/esm/item/node.js.map +1 -1
- package/esm/runtime/controller/data.d.ts +7 -10
- package/esm/runtime/controller/data.js +125 -281
- package/esm/runtime/controller/data.js.map +1 -1
- package/esm/runtime/controller/interaction.js +9 -4
- package/esm/runtime/controller/interaction.js.map +1 -1
- package/esm/runtime/controller/item.d.ts +1 -0
- package/esm/runtime/controller/item.js +285 -150
- package/esm/runtime/controller/item.js.map +1 -1
- package/esm/runtime/controller/layout.js +1 -3
- package/esm/runtime/controller/layout.js.map +1 -1
- package/esm/runtime/controller/plugin.js +9 -5
- package/esm/runtime/controller/plugin.js.map +1 -1
- package/esm/runtime/graph.d.ts +104 -24
- package/esm/runtime/graph.js +472 -94
- package/esm/runtime/graph.js.map +1 -1
- package/esm/stdlib/behavior/activate-relations.d.ts +1 -1
- package/esm/stdlib/behavior/activate-relations.js +2 -2
- package/esm/stdlib/behavior/activate-relations.js.map +1 -1
- package/esm/stdlib/behavior/brush-select.d.ts +9 -3
- package/esm/stdlib/behavior/brush-select.js +10 -12
- package/esm/stdlib/behavior/brush-select.js.map +1 -1
- package/esm/stdlib/behavior/click-select.d.ts +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/collapse-expand-combo.d.ts +1 -1
- package/esm/stdlib/behavior/collapse-expand-tree.d.ts +1 -1
- package/esm/stdlib/behavior/create-edge.d.ts +57 -0
- package/esm/stdlib/behavior/create-edge.js +215 -0
- package/esm/stdlib/behavior/create-edge.js.map +1 -0
- package/esm/stdlib/behavior/drag-canvas.d.ts +3 -1
- package/esm/stdlib/behavior/drag-canvas.js +78 -33
- package/esm/stdlib/behavior/drag-canvas.js.map +1 -1
- package/esm/stdlib/behavior/drag-combo.d.ts +3 -3
- 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 +4 -4
- package/esm/stdlib/behavior/drag-node.js +80 -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 +3 -4
- 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 +87 -0
- package/esm/stdlib/behavior/shortcuts-call.js.map +1 -0
- package/esm/stdlib/behavior/zoom-canvas-3d.js +4 -1
- package/esm/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
- package/esm/stdlib/behavior/zoom-canvas.d.ts +3 -1
- package/esm/stdlib/behavior/zoom-canvas.js +70 -26
- 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 +13 -12
- package/esm/stdlib/data/validateData.js.map +1 -1
- package/esm/stdlib/index.d.ts +18 -6
- package/esm/stdlib/index.js +22 -10
- package/esm/stdlib/index.js.map +1 -1
- package/esm/stdlib/item/edge/base.d.ts +3 -5
- package/esm/stdlib/item/edge/base.js +32 -31
- package/esm/stdlib/item/edge/base.js.map +1 -1
- package/esm/stdlib/item/edge/cubic-horizontal.js.map +1 -1
- package/esm/stdlib/item/edge/cubic-vertical.js.map +1 -1
- package/esm/stdlib/item/edge/cubic.js +1 -1
- package/esm/stdlib/item/edge/cubic.js.map +1 -1
- package/esm/stdlib/item/edge/loop.js +1 -1
- package/esm/stdlib/item/edge/loop.js.map +1 -1
- package/esm/stdlib/item/node/base.d.ts +3 -6
- package/esm/stdlib/item/node/base.js +30 -60
- package/esm/stdlib/item/node/base.js.map +1 -1
- package/esm/stdlib/item/node/base3d.d.ts +1 -0
- package/esm/stdlib/item/node/base3d.js +1 -0
- package/esm/stdlib/item/node/base3d.js.map +1 -1
- package/esm/stdlib/item/node/cube.d.ts +35 -0
- package/esm/stdlib/item/node/cube.js +54 -0
- package/esm/stdlib/item/node/cube.js.map +1 -0
- package/esm/stdlib/item/node/diamond.js +1 -1
- package/esm/stdlib/item/node/donut.d.ts +3 -3
- package/esm/stdlib/item/node/ellipse.js +2 -2
- package/esm/stdlib/item/node/hexagon.js +6 -2
- 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 +4 -0
- package/esm/stdlib/item/node/index.js +4 -0
- package/esm/stdlib/item/node/index.js.map +1 -1
- package/esm/stdlib/plugin/edgeFilterLens/index.d.ts +66 -0
- package/esm/stdlib/plugin/edgeFilterLens/index.js +309 -0
- package/esm/stdlib/plugin/edgeFilterLens/index.js.map +1 -0
- package/esm/stdlib/plugin/grid/index.d.ts +1 -1
- package/esm/stdlib/plugin/grid/index.js +3 -4
- package/esm/stdlib/plugin/grid/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/convexHull.d.ts +1 -1
- package/esm/stdlib/plugin/hull/hullComponent.d.ts +2 -2
- package/esm/stdlib/plugin/hull/hullComponent.js +5 -9
- package/esm/stdlib/plugin/hull/hullComponent.js.map +1 -1
- package/esm/stdlib/plugin/hull/util.d.ts +2 -2
- package/esm/stdlib/plugin/hull/util.js +6 -2
- package/esm/stdlib/plugin/hull/util.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.d.ts +3 -3
- package/esm/stdlib/plugin/legend/index.js +3 -3
- package/esm/stdlib/plugin/legend/index.js.map +1 -1
- package/esm/stdlib/plugin/menu/index.d.ts +4 -4
- package/esm/stdlib/plugin/menu/index.js +3 -3
- package/esm/stdlib/plugin/menu/index.js.map +1 -1
- package/esm/stdlib/plugin/minimap/index.d.ts +6 -2
- package/esm/stdlib/plugin/minimap/index.js +119 -12
- 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 +4 -4
- package/esm/stdlib/plugin/timebar/index.js +6 -6
- package/esm/stdlib/plugin/timebar/index.js.map +1 -1
- package/esm/stdlib/plugin/toolbar/index.d.ts +3 -3
- package/esm/stdlib/plugin/toolbar/index.js +4 -4
- package/esm/stdlib/plugin/toolbar/index.js.map +1 -1
- package/esm/stdlib/plugin/tooltip/index.d.ts +5 -5
- package/esm/stdlib/plugin/tooltip/index.js +3 -4
- package/esm/stdlib/plugin/tooltip/index.js.map +1 -1
- package/esm/stdlib/plugin/types.d.ts +2 -0
- package/esm/stdlib/plugin/watermaker/index.d.ts +78 -0
- package/esm/stdlib/plugin/watermaker/index.js +243 -0
- package/esm/stdlib/plugin/watermaker/index.js.map +1 -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/animate.d.ts +2 -2
- package/esm/types/behavior.d.ts +1 -1
- package/esm/types/combo.d.ts +7 -7
- package/esm/types/common.d.ts +5 -5
- package/esm/types/data.d.ts +6 -6
- package/esm/types/edge.d.ts +9 -9
- package/esm/types/event.d.ts +2 -1
- package/esm/types/graph.d.ts +48 -22
- package/esm/types/history.d.ts +2 -2
- package/esm/types/hook.d.ts +23 -3
- package/esm/types/index.d.ts +2 -1
- package/esm/types/index.js +1 -0
- package/esm/types/index.js.map +1 -1
- package/esm/types/item.d.ts +18 -12
- package/esm/types/item.js.map +1 -1
- package/esm/types/layout.d.ts +6 -6
- package/esm/types/loop.d.ts +2 -2
- package/esm/types/node.d.ts +7 -7
- package/esm/types/plugin.d.ts +1 -1
- package/esm/types/render.d.ts +1 -1
- package/esm/types/spec.d.ts +19 -3
- package/esm/types/stdlib.d.ts +1 -1
- package/esm/types/theme.d.ts +8 -8
- package/esm/types/view.d.ts +7 -2
- package/esm/util/bbox.d.ts +16 -1
- package/esm/util/bbox.js +33 -5
- package/esm/util/bbox.js.map +1 -1
- package/esm/util/behavior.d.ts +2 -2
- package/esm/util/behavior.js +2 -2
- package/esm/util/behavior.js.map +1 -1
- package/esm/util/data.d.ts +2 -2
- package/esm/util/data.js.map +1 -1
- package/esm/util/dom.d.ts +15 -0
- package/esm/util/dom.js +29 -0
- package/esm/util/dom.js.map +1 -0
- package/esm/util/event.d.ts +5 -3
- package/esm/util/event.js +8 -1
- package/esm/util/event.js.map +1 -1
- package/esm/util/extend.d.ts +1 -1
- package/esm/util/extend.js +0 -1
- package/esm/util/extend.js.map +1 -1
- package/esm/util/index.d.ts +7 -52
- package/esm/util/index.js +7 -23
- package/esm/util/index.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 +13 -2
- package/esm/util/layout.js +45 -0
- package/esm/util/layout.js.map +1 -1
- package/esm/util/loop.d.ts +1 -1
- package/esm/util/loop.js +4 -0
- package/esm/util/loop.js.map +1 -1
- package/esm/util/math.d.ts +1 -1
- package/esm/util/matrix.d.ts +6 -0
- package/esm/util/matrix.js +48 -0
- package/esm/util/matrix.js.map +1 -0
- package/esm/util/path.js +1 -1
- package/esm/util/path.js.map +1 -1
- package/esm/util/point.d.ts +1 -1
- package/esm/util/point.js +9 -2
- package/esm/util/point.js.map +1 -1
- package/esm/util/polyline.d.ts +2 -1
- package/esm/util/polyline.js +2 -1
- package/esm/util/polyline.js.map +1 -1
- package/esm/util/router.d.ts +1 -1
- package/esm/util/shape.d.ts +1 -2
- package/esm/util/shape.js +15 -25
- package/esm/util/shape.js.map +1 -1
- package/esm/util/shape3d.js +16 -17
- package/esm/util/shape3d.js.map +1 -1
- package/esm/util/text.d.ts +1 -1
- package/esm/util/text.js +3 -2
- package/esm/util/text.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/graph.d.ts +3 -3
- package/lib/api-doc/graph.js +27 -7
- package/lib/api-doc/graph.js.map +1 -1
- package/lib/api-doc/types.d.ts +1 -0
- package/lib/api-doc/types.js +2 -2
- package/lib/api-doc/types.js.map +1 -1
- package/lib/constant/shape.d.ts +3 -1
- package/lib/index.d.ts +24 -63
- package/lib/index.js +18 -10
- package/lib/index.js.map +1 -1
- package/lib/item/combo.d.ts +1 -1
- package/lib/item/combo.js +18 -14
- package/lib/item/combo.js.map +1 -1
- package/lib/item/edge.d.ts +19 -2
- package/lib/item/edge.js +99 -43
- package/lib/item/edge.js.map +1 -1
- package/lib/item/item.d.ts +3 -2
- package/lib/item/item.js +27 -13
- package/lib/item/item.js.map +1 -1
- package/lib/item/node.d.ts +2 -8
- package/lib/item/node.js +31 -19
- package/lib/item/node.js.map +1 -1
- package/lib/runtime/controller/data.d.ts +7 -10
- package/lib/runtime/controller/data.js +125 -281
- package/lib/runtime/controller/data.js.map +1 -1
- package/lib/runtime/controller/interaction.js +9 -4
- package/lib/runtime/controller/interaction.js.map +1 -1
- package/lib/runtime/controller/item.d.ts +1 -0
- package/lib/runtime/controller/item.js +284 -149
- package/lib/runtime/controller/item.js.map +1 -1
- package/lib/runtime/controller/layout.js +1 -3
- package/lib/runtime/controller/layout.js.map +1 -1
- package/lib/runtime/controller/plugin.js +9 -5
- package/lib/runtime/controller/plugin.js.map +1 -1
- package/lib/runtime/graph.d.ts +104 -24
- package/lib/runtime/graph.js +473 -94
- package/lib/runtime/graph.js.map +1 -1
- package/lib/stdlib/behavior/activate-relations.d.ts +1 -1
- package/lib/stdlib/behavior/activate-relations.js +2 -2
- package/lib/stdlib/behavior/activate-relations.js.map +1 -1
- package/lib/stdlib/behavior/brush-select.d.ts +9 -3
- package/lib/stdlib/behavior/brush-select.js +13 -12
- package/lib/stdlib/behavior/brush-select.js.map +1 -1
- package/lib/stdlib/behavior/click-select.d.ts +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/collapse-expand-combo.d.ts +1 -1
- package/lib/stdlib/behavior/collapse-expand-tree.d.ts +1 -1
- package/lib/stdlib/behavior/create-edge.d.ts +57 -0
- package/lib/stdlib/behavior/create-edge.js +219 -0
- package/lib/stdlib/behavior/create-edge.js.map +1 -0
- package/lib/stdlib/behavior/drag-canvas.d.ts +3 -1
- package/lib/stdlib/behavior/drag-canvas.js +78 -33
- package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
- package/lib/stdlib/behavior/drag-combo.d.ts +3 -3
- 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 +4 -4
- package/lib/stdlib/behavior/drag-node.js +80 -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 +6 -4
- 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 +91 -0
- package/lib/stdlib/behavior/shortcuts-call.js.map +1 -0
- package/lib/stdlib/behavior/zoom-canvas-3d.js +4 -1
- package/lib/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
- package/lib/stdlib/behavior/zoom-canvas.d.ts +3 -1
- package/lib/stdlib/behavior/zoom-canvas.js +70 -26
- 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 +13 -12
- package/lib/stdlib/data/validateData.js.map +1 -1
- package/lib/stdlib/index.d.ts +18 -6
- package/lib/stdlib/index.js +22 -10
- package/lib/stdlib/index.js.map +1 -1
- package/lib/stdlib/item/edge/base.d.ts +3 -5
- package/lib/stdlib/item/edge/base.js +30 -29
- package/lib/stdlib/item/edge/base.js.map +1 -1
- package/lib/stdlib/item/edge/cubic-horizontal.js.map +1 -1
- package/lib/stdlib/item/edge/cubic-vertical.js.map +1 -1
- package/lib/stdlib/item/edge/cubic.js +2 -2
- package/lib/stdlib/item/edge/cubic.js.map +1 -1
- package/lib/stdlib/item/edge/loop.js +3 -3
- package/lib/stdlib/item/edge/loop.js.map +1 -1
- package/lib/stdlib/item/node/base.d.ts +3 -6
- package/lib/stdlib/item/node/base.js +29 -59
- package/lib/stdlib/item/node/base.js.map +1 -1
- package/lib/stdlib/item/node/base3d.d.ts +1 -0
- package/lib/stdlib/item/node/base3d.js +1 -0
- package/lib/stdlib/item/node/base3d.js.map +1 -1
- package/lib/stdlib/item/node/cube.d.ts +35 -0
- package/lib/stdlib/item/node/cube.js +58 -0
- package/lib/stdlib/item/node/cube.js.map +1 -0
- package/lib/stdlib/item/node/diamond.js +1 -1
- package/lib/stdlib/item/node/donut.d.ts +3 -3
- package/lib/stdlib/item/node/ellipse.js +2 -2
- package/lib/stdlib/item/node/hexagon.js +6 -2
- 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 +4 -0
- package/lib/stdlib/item/node/index.js +4 -0
- package/lib/stdlib/item/node/index.js.map +1 -1
- package/lib/stdlib/plugin/edgeFilterLens/index.d.ts +66 -0
- package/lib/stdlib/plugin/edgeFilterLens/index.js +313 -0
- package/lib/stdlib/plugin/edgeFilterLens/index.js.map +1 -0
- package/lib/stdlib/plugin/grid/index.d.ts +1 -1
- package/lib/stdlib/plugin/grid/index.js +6 -7
- package/lib/stdlib/plugin/grid/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/convexHull.d.ts +1 -1
- package/lib/stdlib/plugin/hull/hullComponent.d.ts +2 -2
- package/lib/stdlib/plugin/hull/hullComponent.js +5 -9
- package/lib/stdlib/plugin/hull/hullComponent.js.map +1 -1
- package/lib/stdlib/plugin/hull/util.d.ts +2 -2
- package/lib/stdlib/plugin/hull/util.js +26 -22
- package/lib/stdlib/plugin/hull/util.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.d.ts +3 -3
- package/lib/stdlib/plugin/legend/index.js +3 -3
- package/lib/stdlib/plugin/legend/index.js.map +1 -1
- package/lib/stdlib/plugin/menu/index.d.ts +4 -4
- package/lib/stdlib/plugin/menu/index.js +6 -6
- package/lib/stdlib/plugin/menu/index.js.map +1 -1
- package/lib/stdlib/plugin/minimap/index.d.ts +6 -2
- package/lib/stdlib/plugin/minimap/index.js +121 -14
- 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 +4 -4
- package/lib/stdlib/plugin/timebar/index.js +6 -6
- package/lib/stdlib/plugin/timebar/index.js.map +1 -1
- package/lib/stdlib/plugin/toolbar/index.d.ts +3 -3
- package/lib/stdlib/plugin/toolbar/index.js +5 -5
- package/lib/stdlib/plugin/toolbar/index.js.map +1 -1
- package/lib/stdlib/plugin/tooltip/index.d.ts +5 -5
- package/lib/stdlib/plugin/tooltip/index.js +10 -11
- package/lib/stdlib/plugin/tooltip/index.js.map +1 -1
- package/lib/stdlib/plugin/types.d.ts +2 -0
- package/lib/stdlib/plugin/watermaker/index.d.ts +78 -0
- package/lib/stdlib/plugin/watermaker/index.js +247 -0
- package/lib/stdlib/plugin/watermaker/index.js.map +1 -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/animate.d.ts +2 -2
- package/lib/types/behavior.d.ts +1 -1
- package/lib/types/combo.d.ts +7 -7
- package/lib/types/common.d.ts +5 -5
- package/lib/types/data.d.ts +6 -6
- package/lib/types/edge.d.ts +9 -9
- package/lib/types/event.d.ts +2 -1
- package/lib/types/event.js +2 -2
- package/lib/types/event.js.map +1 -1
- package/lib/types/graph.d.ts +48 -22
- package/lib/types/history.d.ts +2 -2
- package/lib/types/history.js +1 -1
- package/lib/types/history.js.map +1 -1
- package/lib/types/hook.d.ts +23 -3
- package/lib/types/index.d.ts +2 -1
- package/lib/types/index.js +3 -1
- package/lib/types/index.js.map +1 -1
- package/lib/types/item.d.ts +18 -12
- package/lib/types/item.js +1 -1
- package/lib/types/item.js.map +1 -1
- package/lib/types/layout.d.ts +6 -6
- package/lib/types/loop.d.ts +2 -2
- package/lib/types/loop.js +1 -1
- package/lib/types/loop.js.map +1 -1
- package/lib/types/node.d.ts +7 -7
- package/lib/types/plugin.d.ts +1 -1
- package/lib/types/render.d.ts +1 -1
- package/lib/types/spec.d.ts +19 -3
- package/lib/types/stdlib.d.ts +1 -1
- package/lib/types/theme.d.ts +8 -8
- package/lib/types/view.d.ts +7 -2
- package/lib/util/bbox.d.ts +16 -1
- package/lib/util/bbox.js +36 -6
- package/lib/util/bbox.js.map +1 -1
- package/lib/util/behavior.d.ts +2 -2
- package/lib/util/behavior.js +2 -2
- package/lib/util/behavior.js.map +1 -1
- package/lib/util/data.d.ts +2 -2
- package/lib/util/data.js.map +1 -1
- package/lib/util/dom.d.ts +15 -0
- package/lib/util/dom.js +34 -0
- package/lib/util/dom.js.map +1 -0
- package/lib/util/event.d.ts +5 -3
- package/lib/util/event.js +8 -1
- package/lib/util/event.js.map +1 -1
- package/lib/util/extend.d.ts +1 -1
- package/lib/util/extend.js +0 -1
- package/lib/util/extend.js.map +1 -1
- package/lib/util/index.d.ts +7 -52
- package/lib/util/index.js +23 -23
- package/lib/util/index.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 +13 -2
- package/lib/util/layout.js +47 -1
- package/lib/util/layout.js.map +1 -1
- package/lib/util/loop.d.ts +1 -1
- package/lib/util/loop.js +4 -0
- package/lib/util/loop.js.map +1 -1
- package/lib/util/math.d.ts +1 -1
- package/lib/util/matrix.d.ts +6 -0
- package/lib/util/matrix.js +52 -0
- package/lib/util/matrix.js.map +1 -0
- package/lib/util/path.js +2 -2
- package/lib/util/path.js.map +1 -1
- package/lib/util/point.d.ts +1 -1
- package/lib/util/point.js +9 -2
- package/lib/util/point.js.map +1 -1
- package/lib/util/polyline.d.ts +2 -1
- package/lib/util/polyline.js +2 -1
- package/lib/util/polyline.js.map +1 -1
- package/lib/util/router.d.ts +1 -1
- package/lib/util/shape.d.ts +1 -2
- package/lib/util/shape.js +16 -26
- package/lib/util/shape.js.map +1 -1
- package/lib/util/shape3d.js +15 -16
- package/lib/util/shape3d.js.map +1 -1
- package/lib/util/text.d.ts +1 -1
- package/lib/util/text.js +3 -2
- package/lib/util/text.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 +41 -50
- package/src/api-doc/graph.ts +4 -3
- package/src/api-doc/types.ts +1 -0
- package/src/constant/shape.ts +1 -1
- package/src/index.ts +5 -6
- package/src/item/combo.ts +16 -15
- package/src/item/edge.ts +135 -57
- package/src/item/item.ts +32 -19
- package/src/item/node.ts +36 -50
- package/src/runtime/controller/data.ts +140 -339
- package/src/runtime/controller/interaction.ts +10 -4
- package/src/runtime/controller/item.ts +261 -78
- package/src/runtime/controller/layout.ts +1 -5
- package/src/runtime/controller/plugin.ts +15 -4
- package/src/runtime/graph.ts +605 -103
- package/src/stdlib/behavior/activate-relations.ts +2 -2
- package/src/stdlib/behavior/brush-select.ts +14 -13
- package/src/stdlib/behavior/click-select.ts +1 -1
- package/src/stdlib/behavior/create-edge.ts +305 -0
- package/src/stdlib/behavior/drag-canvas.ts +107 -35
- package/src/stdlib/behavior/drag-combo.ts +10 -10
- package/src/stdlib/behavior/drag-node.ts +27 -18
- package/src/stdlib/behavior/index.ts +3 -0
- package/src/stdlib/behavior/lasso-select.ts +7 -5
- package/src/stdlib/behavior/scroll-canvas.ts +348 -0
- package/src/stdlib/behavior/shortcuts-call.ts +129 -0
- package/src/stdlib/behavior/zoom-canvas-3d.ts +4 -1
- package/src/stdlib/behavior/zoom-canvas.ts +98 -27
- package/src/stdlib/data/mapNodeSize.ts +2 -2
- package/src/stdlib/data/transformV4Data.ts +2 -2
- package/src/stdlib/data/validateData.ts +16 -16
- package/src/stdlib/index.ts +28 -7
- package/src/stdlib/item/edge/base.ts +32 -41
- package/src/stdlib/item/edge/cubic-horizontal.ts +0 -1
- package/src/stdlib/item/edge/cubic-vertical.ts +0 -1
- package/src/stdlib/item/edge/cubic.ts +1 -1
- package/src/stdlib/item/edge/loop.ts +1 -1
- package/src/stdlib/item/node/base.ts +38 -65
- package/src/stdlib/item/node/base3d.ts +1 -0
- package/src/stdlib/item/node/cube.ts +102 -0
- 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 +6 -2
- package/src/stdlib/item/node/image.ts +190 -0
- package/src/stdlib/item/node/index.ts +4 -0
- package/src/stdlib/plugin/edgeFilterLens/index.ts +387 -0
- package/src/stdlib/plugin/grid/index.ts +6 -6
- 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/convexHull.ts +1 -1
- package/src/stdlib/plugin/hull/hullComponent.ts +10 -8
- package/src/stdlib/plugin/hull/util.ts +6 -2
- package/src/stdlib/plugin/index.ts +2 -0
- package/src/stdlib/plugin/legend/index.ts +6 -6
- package/src/stdlib/plugin/menu/index.ts +13 -13
- package/src/stdlib/plugin/minimap/index.ts +126 -16
- package/src/stdlib/plugin/snapline/index.ts +1297 -0
- package/src/stdlib/plugin/timebar/index.ts +4 -4
- package/src/stdlib/plugin/toolbar/index.ts +8 -8
- package/src/stdlib/plugin/tooltip/index.ts +10 -10
- package/src/stdlib/plugin/types.ts +2 -0
- package/src/stdlib/plugin/watermaker/index.ts +302 -0
- package/src/stdlib/theme/dark.ts +66 -2
- package/src/stdlib/theme/light.ts +4 -4
- package/src/types/event.ts +1 -0
- package/src/types/graph.ts +62 -25
- package/src/types/hook.ts +22 -2
- package/src/types/index.ts +2 -1
- package/src/types/item.ts +10 -0
- package/src/types/plugin.ts +1 -1
- package/src/types/spec.ts +22 -3
- package/src/types/view.ts +8 -3
- package/src/util/bbox.ts +42 -6
- package/src/util/behavior.ts +4 -4
- package/src/util/data.ts +2 -3
- package/src/util/dom.ts +33 -0
- package/src/util/event.ts +14 -1
- package/src/util/extend.ts +2 -3
- package/src/util/index.ts +7 -24
- package/src/util/item.ts +65 -28
- package/src/util/layout.ts +48 -2
- package/src/util/loop.ts +5 -1
- package/src/util/math.ts +1 -1
- package/src/util/matrix.ts +66 -0
- package/src/util/path.ts +1 -1
- package/src/util/point.ts +9 -4
- package/src/util/polyline.ts +2 -1
- package/src/util/router.ts +1 -1
- package/src/util/shape.ts +22 -26
- package/src/util/shape3d.ts +20 -20
- package/src/util/text.ts +3 -1
- package/src/util/warn.ts +20 -0
|
@@ -14,7 +14,6 @@ import { clone, isArray, isObject } from '@antv/util';
|
|
|
14
14
|
import { registery as registry } from '../../stdlib';
|
|
15
15
|
import { deconstructData, graphComboTreeDfs, graphData2TreeData, traverse, treeData2GraphData, validateComboStrucutre, } from '../../util/data';
|
|
16
16
|
import { getExtension } from '../../util/extension';
|
|
17
|
-
import { convertToNumber } from '../../util/type';
|
|
18
17
|
import { isTreeLayout } from '../../util/layout';
|
|
19
18
|
import { hasTreeBehaviors } from '../../util/behavior';
|
|
20
19
|
/**
|
|
@@ -129,7 +128,7 @@ export class DataController {
|
|
|
129
128
|
*/
|
|
130
129
|
onDataChange(param) {
|
|
131
130
|
const { data, type: changeType } = param;
|
|
132
|
-
const {
|
|
131
|
+
const { graphCore } = this;
|
|
133
132
|
const change = () => {
|
|
134
133
|
switch (changeType) {
|
|
135
134
|
case 'remove':
|
|
@@ -150,8 +149,8 @@ export class DataController {
|
|
|
150
149
|
break;
|
|
151
150
|
}
|
|
152
151
|
};
|
|
153
|
-
if (
|
|
154
|
-
|
|
152
|
+
if (graphCore) {
|
|
153
|
+
graphCore.batch(change);
|
|
155
154
|
}
|
|
156
155
|
else {
|
|
157
156
|
change();
|
|
@@ -160,21 +159,21 @@ export class DataController {
|
|
|
160
159
|
onTreeCollapseExpand(params) {
|
|
161
160
|
const { ids, action } = params;
|
|
162
161
|
ids.forEach((id) => {
|
|
163
|
-
this.
|
|
162
|
+
this.graphCore.mergeNodeData(id, {
|
|
164
163
|
collapsed: action === 'collapse',
|
|
165
164
|
});
|
|
166
165
|
});
|
|
167
166
|
}
|
|
168
167
|
onLayout({ options }) {
|
|
169
168
|
if (this.treeDirtyFlag && isTreeLayout(options)) {
|
|
170
|
-
this.
|
|
169
|
+
this.establishGraphCoreTree();
|
|
171
170
|
}
|
|
172
171
|
}
|
|
173
172
|
onGraphInit() {
|
|
174
173
|
const { modes = {} } = this.graph.getSpecification();
|
|
175
174
|
const mode = this.graph.getMode() || 'default';
|
|
176
175
|
if (hasTreeBehaviors(modes[mode])) {
|
|
177
|
-
this.
|
|
176
|
+
this.establishGraphCoreTree();
|
|
178
177
|
}
|
|
179
178
|
}
|
|
180
179
|
onBehaviorChange(param) {
|
|
@@ -183,31 +182,29 @@ export class DataController {
|
|
|
183
182
|
if (action !== 'add' || !modes.includes(mode))
|
|
184
183
|
return;
|
|
185
184
|
if (hasTreeBehaviors(behaviors)) {
|
|
186
|
-
this.
|
|
185
|
+
this.establishGraphCoreTree();
|
|
187
186
|
}
|
|
188
187
|
}
|
|
189
188
|
onModeChange(param) {
|
|
190
189
|
const { modes = {} } = this.graph.getSpecification();
|
|
191
190
|
if (hasTreeBehaviors(modes[param.mode])) {
|
|
192
|
-
this.
|
|
191
|
+
this.establishGraphCoreTree();
|
|
193
192
|
}
|
|
194
193
|
}
|
|
195
|
-
|
|
194
|
+
establishGraphCoreTree() {
|
|
196
195
|
if (!this.treeDirtyFlag)
|
|
197
196
|
return;
|
|
198
|
-
const nodes = this.
|
|
199
|
-
const edges = this.
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
(
|
|
209
|
-
this.userGraphCore.setParent(child.id, node.id, 'tree');
|
|
210
|
-
});
|
|
197
|
+
const nodes = this.graphCore.getAllNodes();
|
|
198
|
+
const edges = this.graphCore.getAllEdges();
|
|
199
|
+
// graph data to tree structure and storing
|
|
200
|
+
const rootIds = nodes
|
|
201
|
+
.filter((node) => node.data.isRoot)
|
|
202
|
+
.map((node) => node.id);
|
|
203
|
+
graphData2TreeData({}, { nodes, edges }, rootIds).forEach((tree) => {
|
|
204
|
+
traverse(tree, (node) => {
|
|
205
|
+
var _a;
|
|
206
|
+
(_a = node.children) === null || _a === void 0 ? void 0 : _a.forEach((child) => {
|
|
207
|
+
this.graphCore.setParent(child.id, node.id, 'tree');
|
|
211
208
|
});
|
|
212
209
|
});
|
|
213
210
|
});
|
|
@@ -223,16 +220,9 @@ export class DataController {
|
|
|
223
220
|
const { type: dataType, data } = this.formatData(dataConfig) || {};
|
|
224
221
|
if (!dataType)
|
|
225
222
|
return;
|
|
223
|
+
this.dataType = dataType;
|
|
226
224
|
const { nodes = [], edges = [], combos = [] } = this.transformData(data);
|
|
227
225
|
if (changeType === 'replace') {
|
|
228
|
-
this.userGraphCore = new GraphLib({
|
|
229
|
-
nodes: nodes.concat((combos === null || combos === void 0 ? void 0 : combos.map((combo) => ({
|
|
230
|
-
id: combo.id,
|
|
231
|
-
data: Object.assign(Object.assign({}, combo.data), { _isCombo: true }),
|
|
232
|
-
}))) || []),
|
|
233
|
-
edges,
|
|
234
|
-
onChanged: (event) => this.updateGraphCore(event),
|
|
235
|
-
});
|
|
236
226
|
this.graphCore = new GraphLib(clone({
|
|
237
227
|
nodes: nodes.concat((combos === null || combos === void 0 ? void 0 : combos.map((combo) => ({
|
|
238
228
|
id: combo.id,
|
|
@@ -265,9 +255,9 @@ export class DataController {
|
|
|
265
255
|
}
|
|
266
256
|
}
|
|
267
257
|
else {
|
|
268
|
-
const {
|
|
258
|
+
const { graphCore } = this;
|
|
269
259
|
const prevData = deconstructData({
|
|
270
|
-
nodes:
|
|
260
|
+
nodes: graphCore.getAllNodes(),
|
|
271
261
|
edges: [],
|
|
272
262
|
});
|
|
273
263
|
const nodesAndCombos = nodes.concat(combos.map((combo) => ({
|
|
@@ -276,94 +266,124 @@ export class DataController {
|
|
|
276
266
|
})));
|
|
277
267
|
// =========== node & combos ============
|
|
278
268
|
if (!prevData.nodes.length) {
|
|
279
|
-
|
|
269
|
+
graphCore.addNodes(nodesAndCombos);
|
|
280
270
|
}
|
|
281
271
|
else {
|
|
282
272
|
if (changeType === 'mergeReplace') {
|
|
283
|
-
// remove the nodes which are not in data but in
|
|
273
|
+
// remove the nodes which are not in incoming data but in graphCore
|
|
284
274
|
const nodeAndComboIds = nodesAndCombos.map((node) => node.id);
|
|
285
275
|
prevData.nodes.forEach((prevNode) => {
|
|
286
|
-
if (!nodeAndComboIds.includes(prevNode.id))
|
|
287
|
-
|
|
276
|
+
if (!nodeAndComboIds.includes(prevNode.id)) {
|
|
277
|
+
this.removeNode(prevNode);
|
|
278
|
+
}
|
|
288
279
|
});
|
|
289
280
|
}
|
|
290
281
|
// add or update node
|
|
291
282
|
nodesAndCombos.forEach((item) => {
|
|
292
|
-
if (
|
|
283
|
+
if (graphCore.hasNode(item.id)) {
|
|
293
284
|
// update node which is in the graphCore
|
|
294
|
-
|
|
285
|
+
graphCore.mergeNodeData(item.id, item.data);
|
|
295
286
|
}
|
|
296
287
|
else {
|
|
297
288
|
// add node which is in data but not in graphCore
|
|
298
|
-
|
|
289
|
+
graphCore.addNode(item);
|
|
299
290
|
}
|
|
300
291
|
});
|
|
301
292
|
}
|
|
302
293
|
// =========== edge ============
|
|
303
|
-
prevData.edges =
|
|
294
|
+
prevData.edges = graphCore.getAllEdges();
|
|
304
295
|
if (!prevData.edges.length) {
|
|
305
|
-
|
|
296
|
+
graphCore.addEdges(edges);
|
|
306
297
|
}
|
|
307
298
|
else {
|
|
308
299
|
if (changeType === 'mergeReplace') {
|
|
309
|
-
// remove the edges which are not in data but in
|
|
300
|
+
// remove the edges which are not in incoming data but in graphCore
|
|
310
301
|
const edgeIds = edges.map((edge) => edge.id);
|
|
311
302
|
prevData.edges.forEach((prevEdge) => {
|
|
312
303
|
if (!edgeIds.includes(prevEdge.id))
|
|
313
|
-
|
|
304
|
+
graphCore.removeEdge(prevEdge.id);
|
|
314
305
|
});
|
|
315
306
|
}
|
|
316
307
|
// add or update edge
|
|
317
308
|
edges.forEach((edge) => {
|
|
318
|
-
if (
|
|
309
|
+
if (graphCore.hasEdge(edge.id)) {
|
|
319
310
|
// update edge which is in the graphCore
|
|
320
|
-
|
|
311
|
+
graphCore.mergeEdgeData(edge.id, edge.data);
|
|
321
312
|
}
|
|
322
313
|
else {
|
|
323
314
|
// add edge which is in data but not in graphCore
|
|
324
|
-
|
|
315
|
+
graphCore.addEdge(edge);
|
|
325
316
|
}
|
|
326
317
|
});
|
|
327
318
|
}
|
|
328
319
|
}
|
|
329
320
|
if ((_a = data.edges) === null || _a === void 0 ? void 0 : _a.length) {
|
|
330
|
-
const {
|
|
321
|
+
const { graphCore } = this;
|
|
331
322
|
// convert and store tree structure to graphCore
|
|
332
323
|
this.updateTreeGraph(dataType, {
|
|
333
|
-
nodes:
|
|
334
|
-
edges:
|
|
324
|
+
nodes: graphCore.getAllNodes(),
|
|
325
|
+
edges: graphCore.getAllEdges(),
|
|
335
326
|
});
|
|
336
327
|
}
|
|
337
328
|
}
|
|
329
|
+
removeNode(nodeModel) {
|
|
330
|
+
const { id, data } = nodeModel;
|
|
331
|
+
const { graphCore } = this;
|
|
332
|
+
if (graphCore.hasTreeStructure('combo')) {
|
|
333
|
+
// remove from its parent's children list
|
|
334
|
+
graphCore.setParent(id, undefined, 'combo');
|
|
335
|
+
const { parentId } = data;
|
|
336
|
+
// move the children to the grandparent's children list
|
|
337
|
+
graphCore.getChildren(id, 'combo').forEach((child) => {
|
|
338
|
+
graphCore.setParent(child.id, parentId, 'combo');
|
|
339
|
+
graphCore.mergeNodeData(child.id, { parentId });
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
if (graphCore.hasTreeStructure('tree')) {
|
|
343
|
+
const succeedIds = [];
|
|
344
|
+
graphCore.dfsTree(id, (child) => {
|
|
345
|
+
succeedIds.push(child.id);
|
|
346
|
+
}, 'tree');
|
|
347
|
+
const succeedEdgeIds = graphCore
|
|
348
|
+
.getAllEdges()
|
|
349
|
+
.filter(({ source, target }) => succeedIds.includes(source) && succeedIds.includes(target))
|
|
350
|
+
.map((edge) => edge.id);
|
|
351
|
+
this.graph.showItem(succeedIds
|
|
352
|
+
.filter((succeedId) => succeedId !== id)
|
|
353
|
+
.concat(succeedEdgeIds));
|
|
354
|
+
// for tree graph view, remove the node from the parent's children list
|
|
355
|
+
graphCore.setParent(id, undefined, 'tree');
|
|
356
|
+
// for tree graph view, make the its children to be roots
|
|
357
|
+
graphCore
|
|
358
|
+
.getChildren(id, 'tree')
|
|
359
|
+
.forEach((child) => graphCore.setParent(child.id, undefined, 'tree'));
|
|
360
|
+
}
|
|
361
|
+
graphCore.removeNode(id);
|
|
362
|
+
}
|
|
338
363
|
/**
|
|
339
364
|
* Remove part of old data.
|
|
340
365
|
* @param data data to be removed which is part of old one
|
|
341
366
|
*/
|
|
342
367
|
removeData(data) {
|
|
343
|
-
const {
|
|
368
|
+
const { graphCore } = this;
|
|
344
369
|
const { nodes = [], edges = [], combos = [] } = data;
|
|
345
370
|
const nodesAndCombos = nodes.concat(combos);
|
|
346
|
-
const prevNodesAndCombos =
|
|
347
|
-
const prevEdges =
|
|
371
|
+
const prevNodesAndCombos = graphCore.getAllNodes();
|
|
372
|
+
const prevEdges = graphCore.getAllEdges();
|
|
348
373
|
if (prevNodesAndCombos.length && nodesAndCombos.length) {
|
|
349
|
-
// update
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
this.graphCore.getChildren(item.id, 'combo').forEach((child) => {
|
|
354
|
-
userGraphCore.mergeNodeData(child.id, { parentId });
|
|
355
|
-
});
|
|
356
|
-
});
|
|
357
|
-
}
|
|
374
|
+
// update combo tree view and tree graph view
|
|
375
|
+
nodesAndCombos.forEach((item) => {
|
|
376
|
+
this.removeNode(item);
|
|
377
|
+
});
|
|
358
378
|
// remove the node
|
|
359
|
-
|
|
379
|
+
// graphCore.removeNodes(nodesAndCombos.map((node) => node.id));
|
|
360
380
|
}
|
|
361
381
|
if (prevEdges.length && edges.length) {
|
|
362
382
|
// add or update edge
|
|
363
383
|
const ids = edges
|
|
364
384
|
.map((edge) => edge.id)
|
|
365
|
-
.filter((id) =>
|
|
366
|
-
|
|
385
|
+
.filter((id) => graphCore.hasEdge(id));
|
|
386
|
+
graphCore.removeEdges(ids);
|
|
367
387
|
}
|
|
368
388
|
}
|
|
369
389
|
/**
|
|
@@ -371,39 +391,42 @@ export class DataController {
|
|
|
371
391
|
* @param data data to be updated which is part of old one
|
|
372
392
|
*/
|
|
373
393
|
updateData(dataConfig) {
|
|
374
|
-
const {
|
|
394
|
+
const { graphCore } = this;
|
|
375
395
|
const { type: dataType, data } = this.formatData(dataConfig);
|
|
376
396
|
if (!dataType)
|
|
377
397
|
return;
|
|
378
398
|
const { nodes = [], edges = [], combos = [] } = data; //this.transformData(data as GraphData);
|
|
379
399
|
const { nodes: prevNodes, edges: prevEdges, combos: prevCombos, } = deconstructData({
|
|
380
|
-
nodes:
|
|
381
|
-
edges:
|
|
400
|
+
nodes: graphCore.getAllNodes(),
|
|
401
|
+
edges: graphCore.getAllEdges(),
|
|
382
402
|
});
|
|
383
403
|
if (prevNodes.length) {
|
|
384
404
|
// update node
|
|
385
405
|
nodes.forEach((newModel) => {
|
|
386
406
|
const { id, data } = newModel;
|
|
387
407
|
if (data) {
|
|
388
|
-
const mergedData = mergeOneLevelData(
|
|
389
|
-
|
|
408
|
+
const mergedData = mergeOneLevelData(graphCore.getNode(id), newModel);
|
|
409
|
+
graphCore.mergeNodeData(id, mergedData);
|
|
410
|
+
}
|
|
411
|
+
if (data.hasOwnProperty('parentId')) {
|
|
412
|
+
graphCore.setParent(id, data.parentId, 'combo');
|
|
390
413
|
}
|
|
391
414
|
});
|
|
392
415
|
}
|
|
393
416
|
if (prevEdges.length) {
|
|
394
417
|
// update edge
|
|
395
418
|
edges.forEach((newModel) => {
|
|
396
|
-
const oldModel =
|
|
419
|
+
const oldModel = graphCore.getEdge(newModel.id);
|
|
397
420
|
if (!oldModel)
|
|
398
421
|
return;
|
|
399
422
|
const { id, source, target, data } = newModel;
|
|
400
423
|
if (source && oldModel.source !== source)
|
|
401
|
-
|
|
424
|
+
graphCore.updateEdgeSource(id, source);
|
|
402
425
|
if (target && oldModel.target !== target)
|
|
403
|
-
|
|
426
|
+
graphCore.updateEdgeTarget(id, target);
|
|
404
427
|
if (data) {
|
|
405
|
-
const mergedData = mergeOneLevelData(
|
|
406
|
-
|
|
428
|
+
const mergedData = mergeOneLevelData(graphCore.getEdge(id), newModel);
|
|
429
|
+
graphCore.mergeEdgeData(id, mergedData);
|
|
407
430
|
}
|
|
408
431
|
});
|
|
409
432
|
}
|
|
@@ -412,6 +435,8 @@ export class DataController {
|
|
|
412
435
|
const modelsToMove = [];
|
|
413
436
|
combos.forEach((newModel) => {
|
|
414
437
|
const { id, data } = newModel;
|
|
438
|
+
if (!data)
|
|
439
|
+
return;
|
|
415
440
|
const { x: comboNewX, y: comboNewY } = data, others = __rest(data, ["x", "y"]);
|
|
416
441
|
if (comboNewX !== undefined || comboNewY !== undefined) {
|
|
417
442
|
if (this.graphCore.getChildren(id, 'combo').length) {
|
|
@@ -448,24 +473,27 @@ export class DataController {
|
|
|
448
473
|
}
|
|
449
474
|
// update other properties
|
|
450
475
|
if (Object.keys(others).length) {
|
|
451
|
-
const mergedData = mergeOneLevelData(
|
|
476
|
+
const mergedData = mergeOneLevelData(graphCore.getNode(id), {
|
|
452
477
|
id,
|
|
453
478
|
data: others,
|
|
454
479
|
});
|
|
455
|
-
|
|
480
|
+
graphCore.mergeNodeData(id, mergedData);
|
|
481
|
+
if (others.hasOwnProperty('parentId')) {
|
|
482
|
+
graphCore.setParent(id, others.parentId, 'combo');
|
|
483
|
+
}
|
|
456
484
|
}
|
|
457
485
|
});
|
|
458
486
|
// update succeed nodes
|
|
459
487
|
modelsToMove.forEach((newModel) => {
|
|
460
488
|
const { id, data } = newModel;
|
|
461
|
-
|
|
489
|
+
graphCore.mergeNodeData(id, data);
|
|
462
490
|
});
|
|
463
491
|
}
|
|
464
492
|
if (edges === null || edges === void 0 ? void 0 : edges.filter((edge) => edge.hasOwnProperty('source') || edge.hasOwnProperty('target')).length) {
|
|
465
493
|
// convert and store tree structure to graphCore
|
|
466
494
|
this.updateTreeGraph(dataType, {
|
|
467
|
-
nodes: this.
|
|
468
|
-
edges: this.
|
|
495
|
+
nodes: this.graphCore.getAllNodes(),
|
|
496
|
+
edges: this.graphCore.getAllEdges(),
|
|
469
497
|
});
|
|
470
498
|
}
|
|
471
499
|
}
|
|
@@ -486,7 +514,7 @@ export class DataController {
|
|
|
486
514
|
return;
|
|
487
515
|
}
|
|
488
516
|
return {
|
|
489
|
-
type: type || 'graphData',
|
|
517
|
+
type: type || this.dataType || 'graphData',
|
|
490
518
|
data: data,
|
|
491
519
|
};
|
|
492
520
|
}
|
|
@@ -531,12 +559,12 @@ export class DataController {
|
|
|
531
559
|
}
|
|
532
560
|
});
|
|
533
561
|
// update succeed nodes
|
|
534
|
-
const {
|
|
562
|
+
const { graphCore } = this;
|
|
535
563
|
succeedNodesModels.forEach((newModel) => {
|
|
536
564
|
const { id, data } = newModel;
|
|
537
565
|
if (data) {
|
|
538
|
-
const mergedData = mergeOneLevelData(
|
|
539
|
-
|
|
566
|
+
const mergedData = mergeOneLevelData(graphCore.getNode(id), newModel);
|
|
567
|
+
graphCore.mergeNodeData(id, mergedData);
|
|
540
568
|
}
|
|
541
569
|
});
|
|
542
570
|
}
|
|
@@ -544,17 +572,20 @@ export class DataController {
|
|
|
544
572
|
const { combos = [] } = data;
|
|
545
573
|
if (!(combos === null || combos === void 0 ? void 0 : combos.length))
|
|
546
574
|
return;
|
|
547
|
-
const {
|
|
575
|
+
const { graphCore } = this;
|
|
548
576
|
const { id, data: comboData } = combos[0];
|
|
549
577
|
const { _children = [] } = comboData, others = __rest(comboData, ["_children"]);
|
|
578
|
+
if (!graphCore.hasTreeStructure('combo')) {
|
|
579
|
+
graphCore.attachTreeStructure('combo');
|
|
580
|
+
}
|
|
550
581
|
// add or update combo
|
|
551
|
-
if (
|
|
582
|
+
if (graphCore.hasNode(id)) {
|
|
552
583
|
// update node which is in the graphCore
|
|
553
|
-
|
|
584
|
+
graphCore.mergeNodeData(id, Object.assign(Object.assign({}, others), { _isCombo: true }));
|
|
554
585
|
}
|
|
555
586
|
else {
|
|
556
587
|
// add node which is in data but not in graphCore
|
|
557
|
-
|
|
588
|
+
graphCore.addNode({ id, data: Object.assign(Object.assign({}, others), { _isCombo: true }) });
|
|
558
589
|
}
|
|
559
590
|
// update strucutre
|
|
560
591
|
_children.forEach((childId) => {
|
|
@@ -562,206 +593,19 @@ export class DataController {
|
|
|
562
593
|
console.warn(`Adding child ${childId} to combo ${id} failed. The child ${childId} does not exist`);
|
|
563
594
|
return;
|
|
564
595
|
}
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
}
|
|
568
|
-
/**
|
|
569
|
-
* Update graphCore with transformed userGraphCore data.
|
|
570
|
-
*/
|
|
571
|
-
updateGraphCore(event) {
|
|
572
|
-
const { graphCore } = this;
|
|
573
|
-
const { nodes = [], edges = [], combos = [], } = deconstructData({
|
|
574
|
-
nodes: this.userGraphCore.getAllNodes(),
|
|
575
|
-
edges: this.userGraphCore.getAllEdges(),
|
|
576
|
-
});
|
|
577
|
-
const prevNodesAndCombos = graphCore.getAllNodes();
|
|
578
|
-
// function to update one data in graphCore with different model type ('node' or 'edge')
|
|
579
|
-
const syncUpdateToGraphCore = (id, newValue, oldValue, isNodeOrCombo, diff = []) => {
|
|
580
|
-
if (isNodeOrCombo) {
|
|
581
|
-
if (newValue.data)
|
|
582
|
-
graphCore.updateNodeData(id, Object.assign({}, newValue.data));
|
|
583
|
-
}
|
|
584
|
-
else {
|
|
585
|
-
if (diff.includes('data'))
|
|
586
|
-
graphCore.updateEdgeData(id, Object.assign({}, newValue.data));
|
|
587
|
-
// source and target may be changed
|
|
588
|
-
if (diff.includes('source'))
|
|
589
|
-
graphCore.updateEdgeSource(id, newValue.source);
|
|
590
|
-
if (diff.includes('target'))
|
|
591
|
-
graphCore.updateEdgeTarget(id, newValue.target);
|
|
592
|
-
}
|
|
593
|
-
};
|
|
594
|
-
graphCore.batch(() => {
|
|
595
|
-
// === step 3: sync to graphCore according to the changes in userGraphCore ==
|
|
596
|
-
const newModelMap = {};
|
|
597
|
-
const parentMap = {};
|
|
598
|
-
const changeMap = {};
|
|
599
|
-
const treeChanges = [];
|
|
600
|
-
event.changes.forEach((change) => {
|
|
601
|
-
var _a;
|
|
602
|
-
const id = change.id || ((_a = change.value) === null || _a === void 0 ? void 0 : _a.id);
|
|
603
|
-
if (id !== undefined) {
|
|
604
|
-
changeMap[id] = true;
|
|
605
|
-
return;
|
|
606
|
-
}
|
|
607
|
-
if ([
|
|
608
|
-
'TreeStructureAttached',
|
|
609
|
-
'TreeStructureChanged',
|
|
610
|
-
'TreeStructureChanged',
|
|
611
|
-
].includes(change.type)) {
|
|
612
|
-
treeChanges.push(change);
|
|
613
|
-
}
|
|
614
|
-
});
|
|
615
|
-
nodes.forEach((model) => {
|
|
616
|
-
newModelMap[model.id] = { type: 'node', model };
|
|
617
|
-
if (model.data.hasOwnProperty('parentId')) {
|
|
618
|
-
parentMap[model.id] = {
|
|
619
|
-
new: model.data.parentId,
|
|
620
|
-
old: undefined,
|
|
621
|
-
};
|
|
622
|
-
}
|
|
623
|
-
});
|
|
624
|
-
edges.forEach((model) => (newModelMap[model.id] = { type: 'edge', model }));
|
|
625
|
-
combos.forEach((model) => {
|
|
626
|
-
newModelMap[model.id] = { type: 'combo', model };
|
|
627
|
-
if (model.data.hasOwnProperty('parentId')) {
|
|
628
|
-
parentMap[model.id] = {
|
|
629
|
-
new: model.data.parentId,
|
|
630
|
-
old: undefined,
|
|
631
|
-
};
|
|
632
|
-
}
|
|
633
|
-
});
|
|
634
|
-
prevNodesAndCombos.forEach((prevModel) => {
|
|
635
|
-
var _a, _b;
|
|
636
|
-
const { id } = prevModel;
|
|
637
|
-
if (((_a = parentMap[id]) === null || _a === void 0 ? void 0 : _a.new) !== undefined ||
|
|
638
|
-
prevModel.data.parentId !== undefined) {
|
|
639
|
-
parentMap[id] = {
|
|
640
|
-
new: (_b = parentMap[id]) === null || _b === void 0 ? void 0 : _b.new,
|
|
641
|
-
old: prevModel.data.parentId,
|
|
642
|
-
};
|
|
643
|
-
}
|
|
644
|
-
else {
|
|
645
|
-
delete parentMap[id];
|
|
646
|
-
}
|
|
647
|
-
const { model: newModel } = newModelMap[id] || {};
|
|
648
|
-
// remove
|
|
649
|
-
if (!newModel) {
|
|
650
|
-
// remove a combo, put the children to upper parent
|
|
651
|
-
if (prevModel.data._isCombo) {
|
|
652
|
-
graphCore.getChildren(id, 'combo').forEach((child) => {
|
|
653
|
-
parentMap[child.id] = Object.assign(Object.assign({}, parentMap[child.id]), { new: prevModel.data.parentId });
|
|
654
|
-
});
|
|
655
|
-
}
|
|
656
|
-
// if it has combo parent, remove it from the parent's children list
|
|
657
|
-
if (prevModel.data.parentId) {
|
|
658
|
-
graphCore.setParent(id, undefined, 'combo');
|
|
659
|
-
}
|
|
660
|
-
// for tree graph view, show the succeed nodes and edges
|
|
661
|
-
const succeedIds = [];
|
|
662
|
-
if (graphCore.hasTreeStructure('tree')) {
|
|
663
|
-
graphCore.dfsTree(id, (child) => {
|
|
664
|
-
succeedIds.push(child.id);
|
|
665
|
-
}, 'tree');
|
|
666
|
-
const succeedEdgeIds = graphCore
|
|
667
|
-
.getAllEdges()
|
|
668
|
-
.filter(({ source, target }) => succeedIds.includes(source) && succeedIds.includes(target))
|
|
669
|
-
.map((edge) => edge.id);
|
|
670
|
-
this.graph.showItem(succeedIds
|
|
671
|
-
.filter((succeedId) => succeedId !== id)
|
|
672
|
-
.concat(succeedEdgeIds));
|
|
673
|
-
// for tree graph view, remove the node from the parent's children list
|
|
674
|
-
graphCore.setParent(id, undefined, 'tree');
|
|
675
|
-
// for tree graph view, make the its children to be roots
|
|
676
|
-
graphCore
|
|
677
|
-
.getChildren(id, 'tree')
|
|
678
|
-
.forEach((child) => graphCore.setParent(child.id, undefined, 'tree'));
|
|
679
|
-
}
|
|
680
|
-
// remove the node data
|
|
681
|
-
graphCore.removeNode(id);
|
|
682
|
-
delete parentMap[prevModel.id];
|
|
683
|
-
}
|
|
684
|
-
// update
|
|
685
|
-
// || diffAt(newModel, prevModel, true)?.length
|
|
686
|
-
else if (changeMap[id])
|
|
687
|
-
syncUpdateToGraphCore(id, newModel, prevModel, true);
|
|
688
|
-
// delete from the map indicates this model is visited
|
|
689
|
-
delete newModelMap[id];
|
|
690
|
-
});
|
|
691
|
-
graphCore.getAllEdges().forEach((prevEdge) => {
|
|
692
|
-
const { id } = prevEdge;
|
|
693
|
-
const { model: newModel } = newModelMap[id] || {};
|
|
694
|
-
// remove
|
|
695
|
-
if (!newModel)
|
|
696
|
-
graphCore.removeEdge(id);
|
|
697
|
-
// update
|
|
698
|
-
else {
|
|
699
|
-
const diff = diffAt(newModel, prevEdge, false);
|
|
700
|
-
if (diff === null || diff === void 0 ? void 0 : diff.length)
|
|
701
|
-
syncUpdateToGraphCore(id, newModel, prevEdge, false, diff);
|
|
702
|
-
}
|
|
703
|
-
// delete from the map indicates this model is visited
|
|
704
|
-
delete newModelMap[id];
|
|
705
|
-
});
|
|
706
|
-
// add
|
|
707
|
-
Object.values(newModelMap).forEach(({ type, model }) => {
|
|
708
|
-
if (type === 'node' || type === 'combo')
|
|
709
|
-
graphCore.addNode(model);
|
|
710
|
-
else if (type === 'edge')
|
|
711
|
-
graphCore.addEdge(model);
|
|
712
|
-
});
|
|
713
|
-
// update parents after adding all items
|
|
714
|
-
Object.keys(parentMap).forEach((id) => {
|
|
715
|
-
var _a;
|
|
716
|
-
if (parentMap[id].new === parentMap[id].old)
|
|
717
|
-
return;
|
|
718
|
-
if (!validateComboStrucutre(this.graph, id, parentMap[id].new)) {
|
|
719
|
-
graphCore.mergeNodeData(id, { parentId: parentMap[id].old });
|
|
720
|
-
return;
|
|
721
|
-
}
|
|
722
|
-
graphCore.mergeNodeData(id, { parentId: parentMap[id].new });
|
|
723
|
-
graphCore.setParent(id, parentMap[id].new, 'combo');
|
|
724
|
-
// after remove from parent's children list, check whether the parent is empty
|
|
725
|
-
// if so, update parent's position to be the child's
|
|
726
|
-
if (parentMap[id].old !== undefined) {
|
|
727
|
-
const parentChildren = graphCore.getChildren(parentMap[id].old, 'combo');
|
|
728
|
-
const { x = 0, y = 0, z = 0, } = ((_a = this.graph.getDisplayModel(parentMap[id].old)) === null || _a === void 0 ? void 0 : _a.data) || {};
|
|
729
|
-
if (!parentChildren.length) {
|
|
730
|
-
graphCore.mergeNodeData(parentMap[id].old, {
|
|
731
|
-
x: convertToNumber(x),
|
|
732
|
-
y: convertToNumber(y),
|
|
733
|
-
z: convertToNumber(z),
|
|
734
|
-
});
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
});
|
|
738
|
-
// update tree structure
|
|
739
|
-
treeChanges.forEach((change) => {
|
|
740
|
-
const { type, treeKey, nodeId, newParentId } = change;
|
|
741
|
-
if (type === 'TreeStructureAttached') {
|
|
742
|
-
graphCore.attachTreeStructure(treeKey);
|
|
743
|
-
return;
|
|
744
|
-
}
|
|
745
|
-
else if (type === 'TreeStructureChanged') {
|
|
746
|
-
graphCore.setParent(nodeId, newParentId, treeKey);
|
|
747
|
-
return;
|
|
748
|
-
}
|
|
749
|
-
else if (type === 'TreeStructureDetached') {
|
|
750
|
-
graphCore.detachTreeStructure(treeKey);
|
|
751
|
-
return;
|
|
752
|
-
}
|
|
753
|
-
});
|
|
596
|
+
graphCore.setParent(childId, id, 'combo');
|
|
597
|
+
graphCore.mergeNodeData(childId, { parentId: id });
|
|
754
598
|
});
|
|
755
599
|
}
|
|
756
600
|
/**
|
|
757
|
-
* Clone data from
|
|
601
|
+
* Clone data from graphCore, and run transforms
|
|
758
602
|
* @returns transformed data and the id map list
|
|
759
603
|
*/
|
|
760
604
|
transformData(data) {
|
|
761
605
|
let dataCloned = clone(data);
|
|
762
606
|
// transform the data with transform extensions, output innerData and idMaps ===
|
|
763
607
|
this.extensions.forEach(({ func, config }) => {
|
|
764
|
-
dataCloned = func(dataCloned, config, this.
|
|
608
|
+
dataCloned = func(dataCloned, config, this.graphCore);
|
|
765
609
|
});
|
|
766
610
|
return dataCloned;
|
|
767
611
|
}
|
|
@@ -771,12 +615,12 @@ export class DataController {
|
|
|
771
615
|
* @param data
|
|
772
616
|
*/
|
|
773
617
|
updateTreeGraph(dataType, data) {
|
|
774
|
-
this.
|
|
618
|
+
this.graphCore.attachTreeStructure('tree');
|
|
775
619
|
if (dataType === 'treeData') {
|
|
776
620
|
// tree structure storing
|
|
777
621
|
data.edges.forEach((edge) => {
|
|
778
622
|
const { source, target } = edge;
|
|
779
|
-
this.
|
|
623
|
+
this.graphCore.setParent(target, source, 'tree');
|
|
780
624
|
});
|
|
781
625
|
}
|
|
782
626
|
else {
|