@antv/g6 5.0.29 → 5.0.31
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 +29 -29
- package/dist/lib/animations/types.d.ts +7 -1
- package/dist/lib/elements/base-element.d.ts +3 -2
- package/dist/lib/elements/combos/base-combo.d.ts +0 -2
- package/dist/lib/elements/edges/base-edge.d.ts +3 -3
- package/dist/lib/elements/nodes/base-node.d.ts +3 -3
- package/dist/lib/elements/shapes/badge.d.ts +1 -1
- package/dist/lib/elements/shapes/base-shape.d.ts +1 -1
- package/dist/lib/exports.d.ts +3 -2
- package/dist/lib/layouts/fishbone.d.ts +72 -0
- package/dist/lib/layouts/index.d.ts +2 -0
- package/dist/lib/plugins/legend.d.ts +22 -14
- package/dist/lib/plugins/minimap/index.d.ts +2 -4
- package/dist/lib/plugins/timebar.d.ts +1 -2
- package/dist/lib/plugins/utils/canvas.d.ts +31 -0
- package/dist/lib/plugins/utils/dom.d.ts +22 -0
- package/dist/lib/runtime/data.d.ts +28 -0
- package/dist/lib/runtime/element.d.ts +0 -9
- package/dist/lib/types/element.d.ts +0 -8
- package/dist/lib/utils/dom.d.ts +0 -26
- package/dist/lib/utils/style.d.ts +1 -1
- package/dist/lib/utils/z-index.d.ts +8 -0
- package/dist/lib/version.d.ts +1 -1
- package/esm/animations/types.d.ts +7 -1
- package/esm/elements/base-element.d.ts +3 -2
- package/esm/elements/base-element.js +2 -1
- package/esm/elements/base-element.js.map +1 -1
- package/esm/elements/combos/base-combo.d.ts +0 -2
- package/esm/elements/combos/base-combo.js +7 -13
- package/esm/elements/combos/base-combo.js.map +1 -1
- package/esm/elements/edges/base-edge.d.ts +3 -3
- package/esm/elements/edges/base-edge.js +4 -4
- package/esm/elements/edges/base-edge.js.map +1 -1
- package/esm/elements/nodes/base-node.d.ts +3 -3
- package/esm/elements/nodes/base-node.js.map +1 -1
- package/esm/elements/shapes/badge.d.ts +1 -1
- package/esm/elements/shapes/base-shape.d.ts +1 -1
- package/esm/elements/shapes/base-shape.js.map +1 -1
- package/esm/exports.d.ts +3 -2
- package/esm/exports.js +1 -1
- package/esm/exports.js.map +1 -1
- package/esm/layouts/fishbone.d.ts +72 -0
- package/esm/layouts/fishbone.js +209 -0
- package/esm/layouts/fishbone.js.map +1 -0
- package/esm/layouts/index.d.ts +2 -0
- package/esm/layouts/index.js +1 -0
- package/esm/layouts/index.js.map +1 -1
- package/esm/plugins/background/index.js +2 -1
- package/esm/plugins/background/index.js.map +1 -1
- package/esm/plugins/contextmenu/index.js +1 -1
- package/esm/plugins/contextmenu/index.js.map +1 -1
- package/esm/plugins/edge-filter-lens/index.js +1 -0
- package/esm/plugins/edge-filter-lens/index.js.map +1 -1
- package/esm/plugins/grid-line.js +5 -3
- package/esm/plugins/grid-line.js.map +1 -1
- package/esm/plugins/legend.d.ts +22 -14
- package/esm/plugins/legend.js +39 -51
- package/esm/plugins/legend.js.map +1 -1
- package/esm/plugins/minimap/index.d.ts +2 -4
- package/esm/plugins/minimap/index.js +13 -30
- package/esm/plugins/minimap/index.js.map +1 -1
- package/esm/plugins/timebar.d.ts +1 -2
- package/esm/plugins/timebar.js +15 -47
- package/esm/plugins/timebar.js.map +1 -1
- package/esm/plugins/toolbar/index.js +1 -1
- package/esm/plugins/toolbar/index.js.map +1 -1
- package/esm/plugins/utils/canvas.d.ts +31 -0
- package/esm/plugins/utils/canvas.js +55 -0
- package/esm/plugins/utils/canvas.js.map +1 -0
- package/esm/plugins/utils/dom.d.ts +22 -0
- package/esm/plugins/utils/dom.js +52 -0
- package/esm/plugins/utils/dom.js.map +1 -0
- package/esm/plugins/watermark/index.js +1 -1
- package/esm/plugins/watermark/index.js.map +1 -1
- package/esm/preset.js +2 -0
- package/esm/preset.js.map +1 -1
- package/esm/registry/build-in.js +3 -2
- package/esm/registry/build-in.js.map +1 -1
- package/esm/runtime/animation.js +5 -2
- package/esm/runtime/animation.js.map +1 -1
- package/esm/runtime/data.d.ts +28 -0
- package/esm/runtime/data.js +131 -16
- package/esm/runtime/data.js.map +1 -1
- package/esm/runtime/element.d.ts +0 -9
- package/esm/runtime/element.js +7 -52
- package/esm/runtime/element.js.map +1 -1
- package/esm/runtime/graph.js +8 -9
- package/esm/runtime/graph.js.map +1 -1
- package/esm/types/element.d.ts +0 -8
- package/esm/utils/dom.d.ts +0 -26
- package/esm/utils/dom.js +0 -65
- package/esm/utils/dom.js.map +1 -1
- package/esm/utils/style.d.ts +1 -1
- package/esm/utils/style.js +2 -2
- package/esm/utils/style.js.map +1 -1
- package/esm/utils/z-index.d.ts +8 -0
- package/esm/utils/z-index.js +11 -0
- package/esm/utils/z-index.js.map +1 -0
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/lib/animations/types.d.ts +7 -1
- package/lib/elements/base-element.d.ts +3 -2
- package/lib/elements/base-element.js +2 -1
- package/lib/elements/base-element.js.map +1 -1
- package/lib/elements/combos/base-combo.d.ts +0 -2
- package/lib/elements/combos/base-combo.js +7 -13
- package/lib/elements/combos/base-combo.js.map +1 -1
- package/lib/elements/edges/base-edge.d.ts +3 -3
- package/lib/elements/edges/base-edge.js +4 -4
- package/lib/elements/edges/base-edge.js.map +1 -1
- package/lib/elements/nodes/base-node.d.ts +3 -3
- package/lib/elements/nodes/base-node.js.map +1 -1
- package/lib/elements/shapes/badge.d.ts +1 -1
- package/lib/elements/shapes/base-shape.d.ts +1 -1
- package/lib/elements/shapes/base-shape.js.map +1 -1
- package/lib/exports.d.ts +3 -2
- package/lib/exports.js +3 -2
- package/lib/exports.js.map +1 -1
- package/lib/layouts/fishbone.d.ts +72 -0
- package/lib/layouts/fishbone.js +213 -0
- package/lib/layouts/fishbone.js.map +1 -0
- package/lib/layouts/index.d.ts +2 -0
- package/lib/layouts/index.js +3 -1
- package/lib/layouts/index.js.map +1 -1
- package/lib/plugins/background/index.js +2 -1
- package/lib/plugins/background/index.js.map +1 -1
- package/lib/plugins/contextmenu/index.js +1 -1
- package/lib/plugins/contextmenu/index.js.map +1 -1
- package/lib/plugins/edge-filter-lens/index.js +1 -0
- package/lib/plugins/edge-filter-lens/index.js.map +1 -1
- package/lib/plugins/grid-line.js +5 -3
- package/lib/plugins/grid-line.js.map +1 -1
- package/lib/plugins/legend.d.ts +22 -14
- package/lib/plugins/legend.js +38 -50
- package/lib/plugins/legend.js.map +1 -1
- package/lib/plugins/minimap/index.d.ts +2 -4
- package/lib/plugins/minimap/index.js +13 -30
- package/lib/plugins/minimap/index.js.map +1 -1
- package/lib/plugins/timebar.d.ts +1 -2
- package/lib/plugins/timebar.js +15 -47
- package/lib/plugins/timebar.js.map +1 -1
- package/lib/plugins/toolbar/index.js +1 -1
- package/lib/plugins/toolbar/index.js.map +1 -1
- package/lib/plugins/utils/canvas.d.ts +31 -0
- package/lib/plugins/utils/canvas.js +58 -0
- package/lib/plugins/utils/canvas.js.map +1 -0
- package/lib/plugins/utils/dom.d.ts +22 -0
- package/lib/plugins/utils/dom.js +56 -0
- package/lib/plugins/utils/dom.js.map +1 -0
- package/lib/plugins/watermark/index.js +1 -1
- package/lib/plugins/watermark/index.js.map +1 -1
- package/lib/preset.js +2 -0
- package/lib/preset.js.map +1 -1
- package/lib/registry/build-in.js +2 -1
- package/lib/registry/build-in.js.map +1 -1
- package/lib/runtime/animation.js +5 -2
- package/lib/runtime/animation.js.map +1 -1
- package/lib/runtime/data.d.ts +28 -0
- package/lib/runtime/data.js +130 -15
- package/lib/runtime/data.js.map +1 -1
- package/lib/runtime/element.d.ts +0 -9
- package/lib/runtime/element.js +7 -52
- package/lib/runtime/element.js.map +1 -1
- package/lib/runtime/graph.js +8 -9
- package/lib/runtime/graph.js.map +1 -1
- package/lib/types/element.d.ts +0 -8
- package/lib/utils/dom.d.ts +0 -26
- package/lib/utils/dom.js +0 -68
- package/lib/utils/dom.js.map +1 -1
- package/lib/utils/style.d.ts +1 -1
- package/lib/utils/style.js +2 -2
- package/lib/utils/style.js.map +1 -1
- package/lib/utils/z-index.d.ts +8 -0
- package/lib/utils/z-index.js +14 -0
- package/lib/utils/z-index.js.map +1 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +6 -6
- package/src/animations/types.ts +7 -1
- package/src/elements/base-element.ts +5 -3
- package/src/elements/combos/base-combo.ts +7 -14
- package/src/elements/edges/base-edge.ts +6 -7
- package/src/elements/nodes/base-node.ts +2 -3
- package/src/elements/shapes/base-shape.ts +1 -4
- package/src/exports.ts +2 -1
- package/src/global.d.ts +5 -0
- package/src/layouts/fishbone.ts +295 -0
- package/src/layouts/index.ts +2 -0
- package/src/plugins/background/index.ts +2 -1
- package/src/plugins/contextmenu/index.ts +1 -1
- package/src/plugins/edge-filter-lens/index.ts +1 -0
- package/src/plugins/grid-line.ts +5 -3
- package/src/plugins/legend.ts +67 -55
- package/src/plugins/minimap/index.ts +16 -52
- package/src/plugins/timebar.ts +16 -47
- package/src/plugins/toolbar/index.ts +1 -1
- package/src/plugins/utils/canvas.ts +89 -0
- package/src/plugins/utils/dom.ts +65 -0
- package/src/plugins/watermark/index.ts +1 -1
- package/src/preset.ts +3 -0
- package/src/registry/build-in.ts +3 -1
- package/src/runtime/animation.ts +5 -2
- package/src/runtime/data.ts +145 -16
- package/src/runtime/element.ts +4 -59
- package/src/runtime/graph.ts +8 -8
- package/src/types/element.ts +0 -9
- package/src/utils/dom.ts +0 -80
- package/src/utils/style.ts +3 -6
- package/src/utils/z-index.ts +11 -0
- package/src/version.ts +1 -1
|
@@ -65,7 +65,13 @@ export interface AnimationContext {
|
|
|
65
65
|
*
|
|
66
66
|
* <en/> For example, before the element is destroyed, the final state opacity of the element needs to be set to 0
|
|
67
67
|
*/
|
|
68
|
-
modifiedStyle
|
|
68
|
+
modifiedStyle?: Record<string, unknown>;
|
|
69
|
+
/**
|
|
70
|
+
* <zh/> 变更样式
|
|
71
|
+
*
|
|
72
|
+
* <en/> Updated style
|
|
73
|
+
*/
|
|
74
|
+
updatedStyle?: Record<string, unknown>;
|
|
69
75
|
}
|
|
70
76
|
/**
|
|
71
77
|
* <zh/> 动画效果时序
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { IAnimation } from '@antv/g';
|
|
2
2
|
import type { RuntimeContext } from '../runtime/types';
|
|
3
|
-
import type {
|
|
3
|
+
import type { Keyframe } from '../types';
|
|
4
|
+
import type { BaseShapeStyleProps } from './shapes';
|
|
4
5
|
import { BaseShape } from './shapes';
|
|
5
|
-
export declare abstract class BaseElement<T extends
|
|
6
|
+
export declare abstract class BaseElement<T extends BaseShapeStyleProps> extends BaseShape<T> {
|
|
6
7
|
protected get context(): RuntimeContext;
|
|
7
8
|
protected get parsedAttributes(): Required<T>;
|
|
8
9
|
/**
|
|
@@ -75,13 +75,11 @@ export declare abstract class BaseCombo<S extends BaseComboStyleProps = BaseComb
|
|
|
75
75
|
protected drawCollapsedMarkerShape(attributes: Required<S>, container: Group): void;
|
|
76
76
|
protected getCollapsedMarkerStyle(attributes: Required<S>): IconStyleProps | false;
|
|
77
77
|
protected getCollapsedMarkerText(type: CollapsedMarkerStyleProps['type'], attributes: Required<S>): string;
|
|
78
|
-
protected getComboZIndex(attributes: Required<S>): number;
|
|
79
78
|
getComboPosition(attributes: Required<S>): Point;
|
|
80
79
|
protected getComboStyle(attributes: Required<S>): {
|
|
81
80
|
x: number;
|
|
82
81
|
y: number;
|
|
83
82
|
transform: (string | number)[][];
|
|
84
|
-
zIndex: number;
|
|
85
83
|
};
|
|
86
84
|
protected updateComboPosition(attributes: Required<S>): void;
|
|
87
85
|
render(attributes: Required<S>, container?: Group): void;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { DisplayObject, DisplayObjectConfig, Group, PathStyleProps } from '@antv/g';
|
|
2
2
|
import { Path } from '@antv/g';
|
|
3
3
|
import type { PathArray } from '@antv/util';
|
|
4
|
-
import type {
|
|
4
|
+
import type { Edge, EdgeArrowStyleProps, EdgeBadgeStyleProps, EdgeLabelStyleProps, ID, Keyframe, LoopStyleProps, Node, Point, Prefix } from '../../types';
|
|
5
5
|
import { BaseElement } from '../base-element';
|
|
6
|
-
import type { BadgeStyleProps, LabelStyleProps } from '../shapes';
|
|
6
|
+
import type { BadgeStyleProps, BaseShapeStyleProps, LabelStyleProps } from '../shapes';
|
|
7
7
|
/**
|
|
8
8
|
* <zh/> 边的通用样式属性
|
|
9
9
|
*
|
|
10
10
|
* <en/> Base style properties of the edge
|
|
11
11
|
*/
|
|
12
|
-
export interface BaseEdgeStyleProps extends
|
|
12
|
+
export interface BaseEdgeStyleProps extends BaseShapeStyleProps, Prefix<'label', EdgeLabelStyleProps>, Prefix<'halo', PathStyleProps>, Prefix<'badge', EdgeBadgeStyleProps>, Prefix<'startArrow', EdgeArrowStyleProps>, Prefix<'endArrow', EdgeArrowStyleProps>, Prefix<'loop', LoopStyleProps> {
|
|
13
13
|
/**
|
|
14
14
|
* <zh/> 是否显示边的标签
|
|
15
15
|
*
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { BaseStyleProps, DisplayObject, DisplayObjectConfig, Group } from '@antv/g';
|
|
2
2
|
import type { CategoricalPalette } from '../../palettes/types';
|
|
3
3
|
import type { NodeData } from '../../spec';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ID, Node, NodeBadgeStyleProps, NodeLabelStyleProps, NodePortStyleProps, Point, Port, PortStyleProps, Prefix, Size } from '../../types';
|
|
5
5
|
import { BaseElement } from '../base-element';
|
|
6
|
-
import type { BadgeStyleProps, IconStyleProps, LabelStyleProps } from '../shapes';
|
|
6
|
+
import type { BadgeStyleProps, BaseShapeStyleProps, IconStyleProps, LabelStyleProps } from '../shapes';
|
|
7
7
|
/**
|
|
8
8
|
* <zh/> 节点通用样式配置项
|
|
9
9
|
*
|
|
10
10
|
* <en/> Base node style props
|
|
11
11
|
*/
|
|
12
|
-
export interface BaseNodeStyleProps extends
|
|
12
|
+
export interface BaseNodeStyleProps extends BaseShapeStyleProps, Prefix<'label', NodeLabelStyleProps>, Prefix<'halo', BaseStyleProps>, Prefix<'icon', IconStyleProps>, Prefix<'badge', BadgeStyleProps>, Prefix<'port', PortStyleProps> {
|
|
13
13
|
/**
|
|
14
14
|
* <zh/> x 坐标
|
|
15
15
|
*
|
|
@@ -20,7 +20,7 @@ export interface BadgeStyleProps extends LabelStyleProps {
|
|
|
20
20
|
export declare class Badge extends BaseShape<BadgeStyleProps> {
|
|
21
21
|
static defaultStyleProps: Partial<BadgeStyleProps>;
|
|
22
22
|
constructor(options: DisplayObjectConfig<BadgeStyleProps>);
|
|
23
|
-
protected getBadgeStyle(attributes: Required<BadgeStyleProps>): Omit<Required<BadgeStyleProps>, "x" | "y" | "z" | "class" | "transform" | "transformOrigin" | "visibility" | "zIndex" | "
|
|
23
|
+
protected getBadgeStyle(attributes: Required<BadgeStyleProps>): Omit<Required<BadgeStyleProps>, "x" | "y" | "z" | "class" | "transform" | "transformOrigin" | "visibility" | "zIndex" | "className">;
|
|
24
24
|
render(attributes?: Required<BadgeStyleProps>, container?: Group): void;
|
|
25
25
|
getGeometryBounds(): import("@antv/g").AABB;
|
|
26
26
|
}
|
|
@@ -71,7 +71,7 @@ export declare abstract class BaseShape<StyleProps extends BaseShapeStyleProps>
|
|
|
71
71
|
* @param style - <zh/> 属性对象 | <en/> attribute object
|
|
72
72
|
* @returns <zh/> 仅包含样式属性的对象 | <en/> An object containing only the style properties.
|
|
73
73
|
*/
|
|
74
|
-
getGraphicStyle<T extends Record<string, any>>(style: T): Omit<T, 'x' | 'y' | 'z' | 'transform' | 'transformOrigin' | 'className' | 'class' | '
|
|
74
|
+
getGraphicStyle<T extends Record<string, any>>(style: T): Omit<T, 'x' | 'y' | 'z' | 'transform' | 'transformOrigin' | 'className' | 'class' | 'zIndex' | 'visibility'>;
|
|
75
75
|
/**
|
|
76
76
|
* Get the prefix pairs for composite shapes used to handle animation
|
|
77
77
|
* @returns tuples array where each tuple contains a key corresponding to a method `get${key}Style` and its shape prefix
|
package/dist/lib/exports.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { BaseEdge, Cubic, CubicHorizontal, CubicRadial, CubicVertical, Line, Pol
|
|
|
5
5
|
export { effect } from './elements/effect';
|
|
6
6
|
export { BaseNode, Circle, Diamond, Donut, Ellipse, HTML, Hexagon, Image, Rect, Star, Triangle, } from './elements/nodes';
|
|
7
7
|
export { Badge, BaseShape, Icon, Label } from './elements/shapes';
|
|
8
|
-
export { AntVDagreLayout, BaseLayout, CircularLayout, ComboCombinedLayout, compactBox as CompactBoxLayout, ConcentricLayout, D3ForceLayout, DagreLayout, dendrogram as DendrogramLayout, ForceAtlas2Layout, ForceLayout, FruchtermanLayout, GridLayout, indented as IndentedLayout, MDSLayout, mindmap as MindmapLayout, RadialLayout, RandomLayout, } from './layouts';
|
|
8
|
+
export { AntVDagreLayout, BaseLayout, CircularLayout, ComboCombinedLayout, compactBox as CompactBoxLayout, ConcentricLayout, D3ForceLayout, DagreLayout, dendrogram as DendrogramLayout, FishboneLayout, ForceAtlas2Layout, ForceLayout, FruchtermanLayout, GridLayout, indented as IndentedLayout, MDSLayout, mindmap as MindmapLayout, RadialLayout, RandomLayout, } from './layouts';
|
|
9
9
|
export { Background, BasePlugin, BubbleSets, CameraSetting, Contextmenu, EdgeBundling, EdgeFilterLens, Fisheye, Fullscreen, GridLine, History, Hull, Legend, Minimap, Snapline, Timebar, Toolbar, Tooltip, Watermark, } from './plugins';
|
|
10
10
|
export { getExtension, getExtensions } from './registry/get';
|
|
11
11
|
export { register } from './registry/register';
|
|
@@ -33,6 +33,7 @@ export type { BaseNodeStyleProps, CircleStyleProps, DiamondStyleProps, DonutStyl
|
|
|
33
33
|
export type { BadgeStyleProps, BaseShapeStyleProps, IconStyleProps, LabelStyleProps, PolygonStyleProps, } from './elements/shapes';
|
|
34
34
|
export type { UpsertHooks } from './elements/shapes/base-shape';
|
|
35
35
|
export type { ContourLabelStyleProps, ContourStyleProps } from './elements/shapes/contour';
|
|
36
|
+
export type { FishboneLayoutOptions } from './layouts';
|
|
36
37
|
export type { BaseLayoutOptions, WebWorkerLayoutOptions } from './layouts/types';
|
|
37
38
|
export type { CategoricalPalette } from './palettes/types';
|
|
38
39
|
export type { BackgroundOptions, BasePluginOptions, BubbleSetsOptions, CameraSettingOptions, ContextmenuOptions, EdgeBundlingOptions, EdgeFilterLensOptions, FisheyeOptions, FullscreenOptions, GridLineOptions, HistoryOptions, HullOptions, LegendOptions, MinimapOptions, SnaplineOptions, TimebarOptions, ToolbarOptions, TooltipOptions, WatermarkOptions, } from './plugins';
|
|
@@ -45,6 +46,6 @@ export type { LayoutOptions, STDLayoutOptions, SingleLayoutOptions } from './spe
|
|
|
45
46
|
export type { CustomPluginOption } from './spec/plugin';
|
|
46
47
|
export type { BaseTransformOptions, MapNodeSizeOptions, PlaceRadialLabelsOptions, ProcessParallelEdgesOptions, } from './transforms';
|
|
47
48
|
export type { DrawData } from './transforms/types';
|
|
48
|
-
export type {
|
|
49
|
+
export type { CardinalPlacement, CollapsedMarkerStyleProps, Combo, CornerPlacement, DirectionalPlacement, Edge, EdgeArrowStyleProps, EdgeDirection, EdgeLabelStyleProps, Element, ElementDatum, ElementHooks, ElementMethods, ElementType, FitViewOptions, HierarchyKey, IAnimateEvent, ID, IDragEvent, IElementDragEvent, IElementEvent, IElementLifeCycleEvent, IEvent, IGraphLifeCycleEvent, IKeyboardEvent, IPointerEvent, IViewportEvent, IWheelEvent, LoopPlacement, LoopStyleProps, Node, NodeBadgeStyleProps, NodeCentralityOptions, NodeLabelStyleProps, NodeLikeData, NodePortStyleProps, Padding, Placement, Point, PortStyleProps, Prefix, PrefixKey, RelativePlacement, Size, State, TransformOptions, TreeData, TriangleDirection, Vector2, Vector3, ViewportAnimationEffectTiming, } from './types';
|
|
49
50
|
export type { Command, CommandData } from './types/history';
|
|
50
51
|
export type { ShortcutKey } from './utils/shortcut';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { GraphData, NodeData } from '../spec';
|
|
2
|
+
import type { Size } from '../types';
|
|
3
|
+
import { BaseLayout } from './base-layout';
|
|
4
|
+
export interface FishboneLayoutOptions {
|
|
5
|
+
/**
|
|
6
|
+
* <zh/> 节点大小
|
|
7
|
+
*
|
|
8
|
+
* <en/> Node size
|
|
9
|
+
*/
|
|
10
|
+
nodeSize?: Size | ((node: NodeData) => Size);
|
|
11
|
+
/**
|
|
12
|
+
* <zh/> 排布方向
|
|
13
|
+
* - `'RL'` 从右到左,鱼头在右
|
|
14
|
+
* - `'LR'` 从左到右,鱼头在左
|
|
15
|
+
*
|
|
16
|
+
* <en/> Layout direction
|
|
17
|
+
* - `'RL'` From right to left, the fish head is on the right
|
|
18
|
+
* - `'LR'` From left to right, the fish head is on the left
|
|
19
|
+
* @defaultValue `'LR'`
|
|
20
|
+
*/
|
|
21
|
+
direction?: 'RL' | 'LR';
|
|
22
|
+
/**
|
|
23
|
+
* <zh/> 获取水平间距
|
|
24
|
+
*
|
|
25
|
+
* <en/> Get horizontal spacing
|
|
26
|
+
*/
|
|
27
|
+
hGap?: number;
|
|
28
|
+
/**
|
|
29
|
+
* <zh/> 获取垂直间距
|
|
30
|
+
*
|
|
31
|
+
* <en/> Get vertical spacing
|
|
32
|
+
*/
|
|
33
|
+
vGap?: number;
|
|
34
|
+
/**
|
|
35
|
+
* <zh/> 获取鱼骨间距
|
|
36
|
+
*
|
|
37
|
+
* <en/> Get rib separation
|
|
38
|
+
* @defaultValue () => 60
|
|
39
|
+
*/
|
|
40
|
+
getRibSep?: (node: NodeData) => number;
|
|
41
|
+
/**
|
|
42
|
+
* <zh/> 布局宽度
|
|
43
|
+
*
|
|
44
|
+
* <en/> Layout width
|
|
45
|
+
*/
|
|
46
|
+
width?: number;
|
|
47
|
+
/**
|
|
48
|
+
* <zh/> 布局高度
|
|
49
|
+
*
|
|
50
|
+
* <en/> Layout height
|
|
51
|
+
*/
|
|
52
|
+
height?: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* <zh/> 鱼骨图布局
|
|
56
|
+
*
|
|
57
|
+
* <en/> Fishbone layout
|
|
58
|
+
* @remarks
|
|
59
|
+
* <zh/> [鱼骨图布局](https://en.wikipedia.org/wiki/Ishikawa_diagram)是一种专门用于表示层次结构数据的图形布局方式。它通过模拟鱼骨的形状,将数据节点按照层次结构排列,使得数据的层次关系更加清晰直观。鱼骨图布局特别适用于需要展示因果关系、层次结构或分类信息的数据集。
|
|
60
|
+
*
|
|
61
|
+
* <en/> [Fishbone layout](https://en.wikipedia.org/wiki/Ishikawa_diagram) is a graphical layout method specifically designed to represent hierarchical data. By simulating the shape of a fishbone, it arranges data nodes according to their hierarchical structure, making the hierarchical relationships of the data clearer and more intuitive. The fishbone diagram layout is particularly suitable for datasets that need to display causal relationships, hierarchical structures, or classification information.
|
|
62
|
+
*/
|
|
63
|
+
export declare class FishboneLayout extends BaseLayout {
|
|
64
|
+
id: string;
|
|
65
|
+
static defaultOptions: Partial<FishboneLayoutOptions>;
|
|
66
|
+
private getRoot;
|
|
67
|
+
private formatSize;
|
|
68
|
+
private doLayout;
|
|
69
|
+
private placeAlterative;
|
|
70
|
+
private rightToLeft;
|
|
71
|
+
execute(data: GraphData, propOptions: FishboneLayoutOptions): Promise<GraphData>;
|
|
72
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { compactBox, dendrogram, indented, mindmap } from '@antv/hierarchy';
|
|
2
2
|
export { AntVDagreLayout, CircularLayout, ComboCombinedLayout, ConcentricLayout, D3ForceLayout, DagreLayout, ForceAtlas2Layout, ForceLayout, FruchtermanLayout, GridLayout, MDSLayout, RadialLayout, RandomLayout, } from '@antv/layout';
|
|
3
3
|
export { BaseLayout } from './base-layout';
|
|
4
|
+
export { FishboneLayout } from './fishbone';
|
|
5
|
+
export type { FishboneLayoutOptions } from './fishbone';
|
|
@@ -29,6 +29,24 @@ export interface LegendOptions extends BasePluginOptions, Omit<CategoryStyleProp
|
|
|
29
29
|
* @defaultValue 'bottom'
|
|
30
30
|
*/
|
|
31
31
|
position?: CardinalPlacement;
|
|
32
|
+
/**
|
|
33
|
+
* <zh/> 图例挂载的容器,无则挂载到 Graph 所在容器
|
|
34
|
+
*
|
|
35
|
+
* <en/> The container where the legend is mounted, if not, it will be mounted to the container where the Graph is located
|
|
36
|
+
*/
|
|
37
|
+
container?: HTMLElement | string;
|
|
38
|
+
/**
|
|
39
|
+
* <zh/> 图例画布类名,传入外置容器时不生效
|
|
40
|
+
*
|
|
41
|
+
* <en/> The class name of the legend canvas, which does not take effect when an external container is passed in
|
|
42
|
+
*/
|
|
43
|
+
className?: string;
|
|
44
|
+
/**
|
|
45
|
+
* <zh/> 图例的容器样式,传入外置容器时不生效
|
|
46
|
+
*
|
|
47
|
+
* <en/> The style of the legend container, which does not take effect when an external container is passed in
|
|
48
|
+
*/
|
|
49
|
+
containerStyle?: Partial<CSSStyleDeclaration>;
|
|
32
50
|
/**
|
|
33
51
|
* <zh/> 节点分类标识
|
|
34
52
|
*
|
|
@@ -60,10 +78,12 @@ export interface LegendOptions extends BasePluginOptions, Omit<CategoryStyleProp
|
|
|
60
78
|
export declare class Legend extends BasePlugin<LegendOptions> {
|
|
61
79
|
static defaultOptions: Partial<LegendOptions>;
|
|
62
80
|
private typePrefix;
|
|
63
|
-
private element;
|
|
64
81
|
private draw;
|
|
65
82
|
private fieldMap;
|
|
66
83
|
private selectedItems;
|
|
84
|
+
private category?;
|
|
85
|
+
private container?;
|
|
86
|
+
private canvas?;
|
|
67
87
|
constructor(context: RuntimeContext, options: LegendOptions);
|
|
68
88
|
/**
|
|
69
89
|
* <zh/> 更新图例配置
|
|
@@ -106,19 +126,7 @@ export declare class Legend extends BasePlugin<LegendOptions> {
|
|
|
106
126
|
private setFieldMap;
|
|
107
127
|
private getEvents;
|
|
108
128
|
private getMarkerData;
|
|
109
|
-
|
|
110
|
-
* <zh/> 图例布局
|
|
111
|
-
*
|
|
112
|
-
* <en/> Legend layout
|
|
113
|
-
* @param position - <zh/> 图例位置| <en/> Legend position
|
|
114
|
-
* @returns <zh/> 图例布局样式| <en/> Legend layout style
|
|
115
|
-
*/
|
|
116
|
-
layout: (position: CardinalPlacement) => {
|
|
117
|
-
display: string;
|
|
118
|
-
flexDirection: string;
|
|
119
|
-
justifyContent: string;
|
|
120
|
-
alignItems: string;
|
|
121
|
-
};
|
|
129
|
+
private upsertCanvas;
|
|
122
130
|
private createElement;
|
|
123
131
|
/**
|
|
124
132
|
* <zh/>销毁图例
|
|
@@ -55,9 +55,9 @@ export interface MinimapOptions extends BasePluginOptions {
|
|
|
55
55
|
*/
|
|
56
56
|
shape?: 'key' | ((id: string, elementType: ElementType) => DisplayObject);
|
|
57
57
|
/**
|
|
58
|
-
* <zh/>
|
|
58
|
+
* <zh/> 缩略图画布类名,传入外置容器时不生效
|
|
59
59
|
*
|
|
60
|
-
* <en/> The class name of the minimap canvas
|
|
60
|
+
* <en/> The class name of the minimap canvas, which does not take effect when an external container is passed in
|
|
61
61
|
*/
|
|
62
62
|
className?: string;
|
|
63
63
|
/**
|
|
@@ -117,8 +117,6 @@ export declare class Minimap extends BasePlugin<MinimapOptions> {
|
|
|
117
117
|
private getElements;
|
|
118
118
|
private setShapes;
|
|
119
119
|
private container;
|
|
120
|
-
private calculatePosition;
|
|
121
|
-
private createContainer;
|
|
122
120
|
private initCanvas;
|
|
123
121
|
private landmarkMap;
|
|
124
122
|
private createLandmark;
|
|
@@ -179,7 +179,7 @@ export declare class Timebar extends BasePlugin<TimebarOptions> {
|
|
|
179
179
|
static defaultOptions: Partial<TimebarOptions>;
|
|
180
180
|
private timebar?;
|
|
181
181
|
private canvas?;
|
|
182
|
-
private
|
|
182
|
+
private container?;
|
|
183
183
|
private originalData?;
|
|
184
184
|
private get padding();
|
|
185
185
|
constructor(context: RuntimeContext, options: TimebarOptions);
|
|
@@ -228,7 +228,6 @@ export declare class Timebar extends BasePlugin<TimebarOptions> {
|
|
|
228
228
|
*/
|
|
229
229
|
private backup;
|
|
230
230
|
private upsertTimebar;
|
|
231
|
-
private upsertWrapper;
|
|
232
231
|
private upsertCanvas;
|
|
233
232
|
private filterElements;
|
|
234
233
|
private hiddenElements;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { IRenderer } from '@antv/g';
|
|
2
|
+
import { Canvas as GCanvas } from '@antv/g';
|
|
3
|
+
import { Canvas } from '../../runtime/canvas';
|
|
4
|
+
import type { Placement } from '../../types';
|
|
5
|
+
interface Options {
|
|
6
|
+
/** <zh/> 插件宽度 | <en/> Plugin width */
|
|
7
|
+
width: number;
|
|
8
|
+
/** <zh/> 插件高度 | <en/> Plugin height */
|
|
9
|
+
height: number;
|
|
10
|
+
/** <zh/> 渲染器 | <en/> Render */
|
|
11
|
+
renderer?: IRenderer;
|
|
12
|
+
/** <zh/> 插件放置位置 | <en/> Plugin placement */
|
|
13
|
+
placement: Placement;
|
|
14
|
+
/** <zh/> 插件类名 | <en/> Plugin class name */
|
|
15
|
+
className: string;
|
|
16
|
+
/** <zh/> 指定插件放置容器 | <en/> Specify the plugin placement container */
|
|
17
|
+
container?: string | HTMLElement;
|
|
18
|
+
/** <zh/> 容器样式 | <en/> Container style */
|
|
19
|
+
containerStyle?: Partial<CSSStyleDeclaration>;
|
|
20
|
+
/** <zh/> G6 画布 | <en/> G6 canvas */
|
|
21
|
+
graphCanvas: Canvas;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* <zh/> 创建插件画布
|
|
25
|
+
*
|
|
26
|
+
* <en/> Create a plugin canvas
|
|
27
|
+
* @param options - <zh/> 配置项 | <en/> options
|
|
28
|
+
* @returns <zh/> [容器, 画布] | <en/> [container, canvas]
|
|
29
|
+
*/
|
|
30
|
+
export declare function createPluginCanvas(options: Options): [HTMLElement, GCanvas];
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <zh/> 创建插件容器
|
|
3
|
+
*
|
|
4
|
+
* <en/> Create a plugin container
|
|
5
|
+
* @param type - <zh/> 插件类型 | <en/> plugin type
|
|
6
|
+
* @param cover - <zh/> 容器是否覆盖整个画布 | <en/> Whether the container covers the entire canvas
|
|
7
|
+
* @param style - <zh/> 额外样式 | <en/> Additional style
|
|
8
|
+
* @returns <zh/> 插件容器 | <en/> plugin container
|
|
9
|
+
*/
|
|
10
|
+
export declare function createPluginContainer(type: string, cover?: boolean, style?: Partial<CSSStyleDeclaration>): HTMLElement;
|
|
11
|
+
/**
|
|
12
|
+
* <zh/> 创建 DOM 元素,如果存在则删除,再创建一个新的
|
|
13
|
+
*
|
|
14
|
+
* <en/> Create a DOM element, if exists, remove it and create a new one.
|
|
15
|
+
* @param id - <zh/> id | <en/> id
|
|
16
|
+
* @param tag - <zh/> 标签 | <en/> tag
|
|
17
|
+
* @param style - <zh/> 样式 | <en/> style
|
|
18
|
+
* @param innerHTML - <zh/> 内容 | <en/> innerHTML
|
|
19
|
+
* @param container - <zh/> 容器 | <en/> container
|
|
20
|
+
* @returns <zh/> 创建的 DOM 元素 | <en/> created DOM element
|
|
21
|
+
*/
|
|
22
|
+
export declare function insertDOM(id: string, tag?: string, style?: Partial<CSSStyleDeclaration>, innerHTML?: string, container?: HTMLElement): HTMLElement;
|
|
@@ -47,6 +47,7 @@ export declare class DataController {
|
|
|
47
47
|
getChanges(): DataChange[];
|
|
48
48
|
clearChanges(): void;
|
|
49
49
|
batch(callback: () => void): void;
|
|
50
|
+
protected isBatching(): boolean;
|
|
50
51
|
/**
|
|
51
52
|
* <zh/> 执行操作而不会留下记录
|
|
52
53
|
*
|
|
@@ -118,6 +119,33 @@ export declare class DataController {
|
|
|
118
119
|
addEdgeData(edges?: EdgeData[]): void;
|
|
119
120
|
addComboData(combos?: ComboData[]): void;
|
|
120
121
|
addChildrenData(parentId: ID, childrenData: NodeData[]): void;
|
|
122
|
+
/**
|
|
123
|
+
* <zh/> 计算 zIndex
|
|
124
|
+
*
|
|
125
|
+
* <en/> Calculate zIndex
|
|
126
|
+
* @param data - <zh/> 新增的数据 | <en/> newly added data
|
|
127
|
+
* @param type - <zh/> 操作类型 | <en/> operation type
|
|
128
|
+
* @param force - <zh/> 忽略批处理 | <en/> ignore batch processing
|
|
129
|
+
* @remarks
|
|
130
|
+
* <zh/> 调用该函数的情况:
|
|
131
|
+
* - 新增元素
|
|
132
|
+
* - 更新节点/组合的 combo
|
|
133
|
+
* - 更新节点的 children
|
|
134
|
+
*
|
|
135
|
+
* <en/> The situation of calling this function:
|
|
136
|
+
* - Add element
|
|
137
|
+
* - Update the combo of the node/combo
|
|
138
|
+
* - Update the children of the node
|
|
139
|
+
*/
|
|
140
|
+
protected computeZIndex(data: PartialGraphData, type: 'add' | 'update', force?: boolean): void;
|
|
141
|
+
/**
|
|
142
|
+
* <zh/> 计算元素置顶后的 zIndex
|
|
143
|
+
*
|
|
144
|
+
* <en/> Calculate the zIndex after the element is placed on top
|
|
145
|
+
* @param id - <zh/> 元素 ID | <en/> ID of the element
|
|
146
|
+
* @returns <zh/> zIndex | <en/> zIndex
|
|
147
|
+
*/
|
|
148
|
+
getFrontZIndex(id: ID): number;
|
|
121
149
|
protected updateNodeLikeHierarchy(data: NodeLikeData[]): void;
|
|
122
150
|
private enableUpdateNodeLikeHierarchy;
|
|
123
151
|
/**
|
|
@@ -51,7 +51,6 @@ export declare class ElementController {
|
|
|
51
51
|
getStateStyle(id: ID): Record<string, unknown>;
|
|
52
52
|
private computeStyle;
|
|
53
53
|
getElement<T extends Element>(id: ID): T | undefined;
|
|
54
|
-
getElementZIndex(id: ID): number;
|
|
55
54
|
getNodes(): Node[];
|
|
56
55
|
getEdges(): Edge[];
|
|
57
56
|
getCombos(): Combo[];
|
|
@@ -98,14 +97,6 @@ export declare class ElementController {
|
|
|
98
97
|
expandNode(id: ID, animation: boolean): Promise<void>;
|
|
99
98
|
collapseCombo(id: ID, animation: boolean): Promise<void>;
|
|
100
99
|
expandCombo(id: ID, animation: boolean): Promise<void>;
|
|
101
|
-
/**
|
|
102
|
-
* <zh/> 计算元素置顶后的 zIndex
|
|
103
|
-
*
|
|
104
|
-
* <en/> Calculate the zIndex after the element is placed on top
|
|
105
|
-
* @param id - <zh/> 元素 ID | <en/> ID of the element
|
|
106
|
-
* @returns <zh/> zIndex | <en/> zIndex
|
|
107
|
-
*/
|
|
108
|
-
getFrontZIndex(id: ID): number;
|
|
109
100
|
destroy(): void;
|
|
110
101
|
}
|
|
111
102
|
export interface DrawContext {
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { DisplayObject } from '@antv/g';
|
|
2
|
-
import { BaseShapeStyleProps } from '../elements/shapes';
|
|
3
|
-
import type { RuntimeContext } from '../runtime/types';
|
|
4
2
|
import type { ComboOptions, EdgeOptions, NodeOptions } from '../spec';
|
|
5
3
|
import type { Point, Port } from '../types';
|
|
6
4
|
/**
|
|
@@ -59,12 +57,6 @@ export interface Combo extends Node {
|
|
|
59
57
|
export type Element = Node | Edge | Combo;
|
|
60
58
|
export type ElementType = 'node' | 'edge' | 'combo';
|
|
61
59
|
export type ElementOptions = NodeOptions | EdgeOptions | ComboOptions;
|
|
62
|
-
export interface BaseElementStyleProps extends BaseShapeStyleProps {
|
|
63
|
-
/**
|
|
64
|
-
* @internal
|
|
65
|
-
*/
|
|
66
|
-
context?: RuntimeContext;
|
|
67
|
-
}
|
|
68
60
|
/**
|
|
69
61
|
* <zh/> 元素方法
|
|
70
62
|
*
|
package/dist/lib/utils/dom.d.ts
CHANGED
|
@@ -4,29 +4,3 @@
|
|
|
4
4
|
* @returns Size of Graph
|
|
5
5
|
*/
|
|
6
6
|
export declare function sizeOf(container: HTMLElement | null): [number, number];
|
|
7
|
-
/**
|
|
8
|
-
* <zh/> 创建插件容器
|
|
9
|
-
*
|
|
10
|
-
* <en/> Create a plugin container
|
|
11
|
-
* @param type - <zh/> 插件类型 | <en/> plugin type
|
|
12
|
-
* @param cover - <zh/> 容器是否覆盖整个画布 | <en/> Whether the container covers the entire canvas
|
|
13
|
-
* @param style - <zh/> 额外样式 | <en/> Additional style
|
|
14
|
-
* @returns <zh/> 插件容器 | <en/> plugin container
|
|
15
|
-
*/
|
|
16
|
-
export declare function createPluginContainer(type: string, cover?: boolean, style?: Partial<CSSStyleDeclaration>): HTMLElement;
|
|
17
|
-
/**
|
|
18
|
-
* Create a DOM element, if exists, remove it and create a new one.
|
|
19
|
-
* @param id - id
|
|
20
|
-
* @param tag - tag
|
|
21
|
-
* @param style - style
|
|
22
|
-
* @param innerHTML - innerHTML
|
|
23
|
-
* @param container - container
|
|
24
|
-
* @returns new DOM element
|
|
25
|
-
*/
|
|
26
|
-
export declare function insertDOM(id: string, tag?: string, style?: Partial<CSSStyleDeclaration>, innerHTML?: string, container?: HTMLElement): HTMLElement;
|
|
27
|
-
/**
|
|
28
|
-
* Insert a DOM element before the first child of the container.
|
|
29
|
-
* @param container - container
|
|
30
|
-
* @param element - element
|
|
31
|
-
*/
|
|
32
|
-
export declare function insertBefore(container: HTMLElement, element: HTMLElement): void;
|
|
@@ -35,4 +35,4 @@ export declare function mergeOptions(opt1: DisplayObjectConfig<any>, opt2: Displ
|
|
|
35
35
|
* <en/> Extracts the graphic style properties from a given attribute object.
|
|
36
36
|
* Removes specific properties like position, transformation, and class name.
|
|
37
37
|
*/
|
|
38
|
-
export declare function getSubShapeStyle<T extends Record<string, any>>(style: T): Omit<T, 'x' | 'y' | 'z' | 'transform' | 'transformOrigin' | 'className' | 'class' | '
|
|
38
|
+
export declare function getSubShapeStyle<T extends Record<string, any>>(style: T): Omit<T, 'x' | 'y' | 'z' | 'transform' | 'transformOrigin' | 'className' | 'class' | 'zIndex' | 'visibility'>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ElementDatum } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* <zh/> 获取元素的 zIndex
|
|
4
|
+
* <en/> Get the zIndex of the element
|
|
5
|
+
* @param datum - <zh/> 元素数据 | <en/> element data
|
|
6
|
+
* @returns - <zh/> zIndex | <en/> zIndex
|
|
7
|
+
*/
|
|
8
|
+
export declare function getZIndexOf(datum: ElementDatum): number;
|
package/dist/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.0.
|
|
1
|
+
export declare const version = "5.0.31";
|
|
@@ -65,7 +65,13 @@ export interface AnimationContext {
|
|
|
65
65
|
*
|
|
66
66
|
* <en/> For example, before the element is destroyed, the final state opacity of the element needs to be set to 0
|
|
67
67
|
*/
|
|
68
|
-
modifiedStyle
|
|
68
|
+
modifiedStyle?: Record<string, unknown>;
|
|
69
|
+
/**
|
|
70
|
+
* <zh/> 变更样式
|
|
71
|
+
*
|
|
72
|
+
* <en/> Updated style
|
|
73
|
+
*/
|
|
74
|
+
updatedStyle?: Record<string, unknown>;
|
|
69
75
|
}
|
|
70
76
|
/**
|
|
71
77
|
* <zh/> 动画效果时序
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { IAnimation } from '@antv/g';
|
|
2
2
|
import type { RuntimeContext } from '../runtime/types';
|
|
3
|
-
import type {
|
|
3
|
+
import type { Keyframe } from '../types';
|
|
4
|
+
import type { BaseShapeStyleProps } from './shapes';
|
|
4
5
|
import { BaseShape } from './shapes';
|
|
5
|
-
export declare abstract class BaseElement<T extends
|
|
6
|
+
export declare abstract class BaseElement<T extends BaseShapeStyleProps> extends BaseShape<T> {
|
|
6
7
|
protected get context(): RuntimeContext;
|
|
7
8
|
protected get parsedAttributes(): Required<T>;
|
|
8
9
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-element.js","sourceRoot":"src/","sources":["elements/base-element.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base-element.js","sourceRoot":"src/","sources":["elements/base-element.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,MAAM,OAAgB,WAA2C,SAAQ,SAAY;IACnF,IAAc,OAAO;QACnB,mCAAmC;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;IAC7B,CAAC;IAED,IAAc,gBAAgB;QAC5B,OAAO,IAAI,CAAC,UAAyB,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACO,OAAO,KAAI,CAAC;IAEf,OAAO,CAAC,SAAqB,EAAE,OAAuD;QAC3F,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAEpD,IAAI,SAAS,EAAE,CAAC;YACd,SAAS,CAAC,OAAO,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YACzC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QAChD,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -75,13 +75,11 @@ export declare abstract class BaseCombo<S extends BaseComboStyleProps = BaseComb
|
|
|
75
75
|
protected drawCollapsedMarkerShape(attributes: Required<S>, container: Group): void;
|
|
76
76
|
protected getCollapsedMarkerStyle(attributes: Required<S>): IconStyleProps | false;
|
|
77
77
|
protected getCollapsedMarkerText(type: CollapsedMarkerStyleProps['type'], attributes: Required<S>): string;
|
|
78
|
-
protected getComboZIndex(attributes: Required<S>): number;
|
|
79
78
|
getComboPosition(attributes: Required<S>): Point;
|
|
80
79
|
protected getComboStyle(attributes: Required<S>): {
|
|
81
80
|
x: number;
|
|
82
81
|
y: number;
|
|
83
82
|
transform: (string | number)[][];
|
|
84
|
-
zIndex: number;
|
|
85
83
|
};
|
|
86
84
|
protected updateComboPosition(attributes: Required<S>): void;
|
|
87
85
|
render(attributes: Required<S>, container?: Group): void;
|
|
@@ -11,7 +11,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { AABB } from '@antv/g';
|
|
13
13
|
import { isFunction } from '@antv/util';
|
|
14
|
-
import { COMBO_KEY } from '../../constants';
|
|
15
14
|
import { getBBoxHeight, getBBoxWidth, getCombinedBBox, getExpandedBBox } from '../../utils/bbox';
|
|
16
15
|
import { idOf } from '../../utils/id';
|
|
17
16
|
import { parsePadding } from '../../utils/padding';
|
|
@@ -58,8 +57,8 @@ export class BaseCombo extends BaseNode {
|
|
|
58
57
|
return [getBBoxWidth(contentBBox), getBBoxHeight(contentBBox), 0];
|
|
59
58
|
}
|
|
60
59
|
getContentBBox(attributes) {
|
|
61
|
-
const {
|
|
62
|
-
const children = childrenNode.map((id) => context.element.getElement(id)).filter(Boolean);
|
|
60
|
+
const { childrenNode = [], padding } = attributes;
|
|
61
|
+
const children = childrenNode.map((id) => this.context.element.getElement(id)).filter(Boolean);
|
|
63
62
|
if (children.length === 0) {
|
|
64
63
|
const bbox = new AABB();
|
|
65
64
|
const { x = 0, y = 0, size } = attributes;
|
|
@@ -93,8 +92,8 @@ export class BaseCombo extends BaseNode {
|
|
|
93
92
|
return style;
|
|
94
93
|
}
|
|
95
94
|
getCollapsedMarkerText(type, attributes) {
|
|
96
|
-
const {
|
|
97
|
-
const { model } = context;
|
|
95
|
+
const { childrenData = [] } = attributes;
|
|
96
|
+
const { model } = this.context;
|
|
98
97
|
if (type === 'descendant-count')
|
|
99
98
|
return model.getDescendantsData(this.id).length.toString();
|
|
100
99
|
if (type === 'child-count')
|
|
@@ -108,16 +107,12 @@ export class BaseCombo extends BaseNode {
|
|
|
108
107
|
return type(childrenData);
|
|
109
108
|
return '';
|
|
110
109
|
}
|
|
111
|
-
getComboZIndex(attributes) {
|
|
112
|
-
const ancestors = this.context.model.getAncestorsData(this.id, COMBO_KEY) || [];
|
|
113
|
-
return ancestors.length;
|
|
114
|
-
}
|
|
115
110
|
getComboPosition(attributes) {
|
|
116
|
-
const { x = 0, y = 0, collapsed,
|
|
111
|
+
const { x = 0, y = 0, collapsed, childrenData = [] } = attributes;
|
|
117
112
|
if (childrenData.length === 0)
|
|
118
113
|
return [+x, +y, 0];
|
|
119
114
|
if (collapsed) {
|
|
120
|
-
const { model } = context;
|
|
115
|
+
const { model } = this.context;
|
|
121
116
|
const descendants = model.getDescendantsData(this.id).filter((datum) => !model.isCombo(idOf(datum)));
|
|
122
117
|
if (descendants.length > 0 && descendants.some(hasPosition)) {
|
|
123
118
|
// combo 被收起,返回平均中心位置 / combo is collapsed, return the average center position
|
|
@@ -130,10 +125,9 @@ export class BaseCombo extends BaseNode {
|
|
|
130
125
|
return this.getContentBBox(attributes).center;
|
|
131
126
|
}
|
|
132
127
|
getComboStyle(attributes) {
|
|
133
|
-
const { zIndex = this.getComboZIndex(attributes) } = attributes;
|
|
134
128
|
const [x, y] = this.getComboPosition(attributes);
|
|
135
129
|
// x/y will be used to calculate position later.
|
|
136
|
-
return { x, y, transform: [['translate', x, y]]
|
|
130
|
+
return { x, y, transform: [['translate', x, y]] };
|
|
137
131
|
}
|
|
138
132
|
updateComboPosition(attributes) {
|
|
139
133
|
const comboStyle = this.getComboStyle(attributes);
|