@antv/g6 5.0.0-beta.33 → 5.0.0-beta.34
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/dist/lib/behaviors/brush-select.d.ts +2 -3
- package/dist/lib/behaviors/collapse-expand.d.ts +1 -2
- package/dist/lib/behaviors/create-edge.d.ts +1 -2
- package/dist/lib/behaviors/drag-element-force.d.ts +1 -2
- package/dist/lib/behaviors/drag-element.d.ts +2 -3
- package/dist/lib/behaviors/lasso-select.d.ts +2 -3
- package/dist/lib/constants/events/animation.d.ts +1 -4
- package/dist/lib/elements/nodes/base-node.d.ts +2 -3
- package/dist/lib/elements/nodes/donut.d.ts +45 -0
- package/dist/lib/elements/nodes/html.d.ts +27 -0
- package/dist/lib/elements/nodes/index.d.ts +4 -0
- package/dist/lib/exports.d.ts +4 -3
- package/dist/lib/plugins/hull/index.d.ts +1 -2
- package/dist/lib/runtime/data.d.ts +4 -4
- package/dist/lib/runtime/element.d.ts +3 -3
- package/dist/lib/runtime/graph.d.ts +2 -3
- package/dist/lib/runtime/viewport.d.ts +1 -2
- package/dist/lib/spec/data.d.ts +74 -1
- package/dist/lib/spec/element/combo.d.ts +17 -6
- package/dist/lib/spec/element/edge.d.ts +14 -2
- package/dist/lib/spec/element/node.d.ts +19 -3
- package/dist/lib/themes/base.d.ts +1 -0
- package/dist/lib/transforms/process-parallel-edges.d.ts +1 -2
- package/dist/lib/transforms/types.d.ts +1 -1
- package/dist/lib/types/callable.d.ts +2 -2
- package/dist/lib/types/data.d.ts +1 -1
- package/dist/lib/types/id.d.ts +1 -0
- package/dist/lib/types/index.d.ts +1 -0
- package/dist/lib/types/style.d.ts +1 -3
- package/dist/lib/utils/animation.d.ts +1 -1
- package/dist/lib/utils/behaviors/brush.d.ts +1 -2
- package/dist/lib/utils/behaviors/lasso.d.ts +1 -2
- package/dist/lib/utils/behaviors/utils.d.ts +1 -1
- package/dist/lib/utils/edge.d.ts +1 -2
- package/dist/lib/utils/id.d.ts +2 -3
- package/dist/lib/utils/palette.d.ts +1 -2
- package/dist/lib/utils/relation.d.ts +1 -2
- package/esm/behaviors/brush-select.d.ts +2 -3
- package/esm/behaviors/brush-select.js.map +1 -1
- package/esm/behaviors/click-element.js.map +1 -1
- package/esm/behaviors/collapse-expand.d.ts +1 -2
- package/esm/behaviors/collapse-expand.js.map +1 -1
- package/esm/behaviors/create-edge.d.ts +1 -2
- package/esm/behaviors/create-edge.js.map +1 -1
- package/esm/behaviors/drag-element-force.d.ts +1 -2
- package/esm/behaviors/drag-element-force.js.map +1 -1
- package/esm/behaviors/drag-element.d.ts +2 -3
- package/esm/behaviors/drag-element.js.map +1 -1
- package/esm/behaviors/focus-element.js.map +1 -1
- package/esm/behaviors/hover-element.js.map +1 -1
- package/esm/behaviors/lasso-select.d.ts +2 -3
- package/esm/behaviors/lasso-select.js.map +1 -1
- package/esm/constants/events/animation.d.ts +1 -4
- package/esm/constants/events/animation.js +0 -4
- package/esm/constants/events/animation.js.map +1 -1
- package/esm/elements/nodes/base-node.d.ts +2 -3
- package/esm/elements/nodes/base-node.js.map +1 -1
- package/esm/elements/nodes/donut.d.ts +45 -0
- package/esm/elements/nodes/donut.js +81 -0
- package/esm/elements/nodes/donut.js.map +1 -0
- package/esm/elements/nodes/html.d.ts +27 -0
- package/esm/elements/nodes/html.js +209 -0
- package/esm/elements/nodes/html.js.map +1 -0
- package/esm/elements/nodes/index.d.ts +4 -0
- package/esm/elements/nodes/index.js +2 -0
- package/esm/elements/nodes/index.js.map +1 -1
- package/esm/exports.d.ts +4 -3
- package/esm/exports.js +2 -1
- package/esm/exports.js.map +1 -1
- package/esm/plugins/hull/index.d.ts +1 -2
- package/esm/plugins/hull/index.js.map +1 -1
- package/esm/plugins/legend.js +3 -2
- package/esm/plugins/legend.js.map +1 -1
- package/esm/registry/build-in.js +5 -3
- package/esm/registry/build-in.js.map +1 -1
- package/esm/runtime/canvas.js +5 -2
- package/esm/runtime/canvas.js.map +1 -1
- package/esm/runtime/data.d.ts +4 -4
- package/esm/runtime/data.js.map +1 -1
- package/esm/runtime/element.d.ts +3 -3
- package/esm/runtime/element.js +59 -42
- package/esm/runtime/element.js.map +1 -1
- package/esm/runtime/graph.d.ts +2 -3
- package/esm/runtime/graph.js +11 -9
- package/esm/runtime/graph.js.map +1 -1
- package/esm/runtime/layout.js +2 -2
- package/esm/runtime/layout.js.map +1 -1
- package/esm/runtime/viewport.d.ts +1 -2
- package/esm/runtime/viewport.js.map +1 -1
- package/esm/spec/data.d.ts +74 -1
- package/esm/spec/element/combo.d.ts +17 -6
- package/esm/spec/element/edge.d.ts +14 -2
- package/esm/spec/element/node.d.ts +19 -3
- package/esm/themes/base.d.ts +1 -0
- package/esm/themes/base.js +2 -0
- package/esm/themes/base.js.map +1 -1
- package/esm/transforms/process-parallel-edges.d.ts +1 -2
- package/esm/transforms/process-parallel-edges.js +2 -4
- package/esm/transforms/process-parallel-edges.js.map +1 -1
- package/esm/transforms/types.d.ts +1 -1
- package/esm/transforms/update-related-edge.js.map +1 -1
- package/esm/types/callable.d.ts +2 -2
- package/esm/types/data.d.ts +1 -1
- package/esm/types/id.d.ts +1 -0
- package/esm/types/id.js +2 -0
- package/esm/types/id.js.map +1 -0
- package/esm/types/index.d.ts +1 -0
- package/esm/types/style.d.ts +1 -3
- package/esm/utils/animation.d.ts +1 -1
- package/esm/utils/animation.js +1 -1
- package/esm/utils/animation.js.map +1 -1
- package/esm/utils/behaviors/brush.d.ts +1 -2
- package/esm/utils/behaviors/brush.js.map +1 -1
- package/esm/utils/behaviors/lasso.d.ts +1 -2
- package/esm/utils/behaviors/lasso.js.map +1 -1
- package/esm/utils/behaviors/utils.d.ts +1 -1
- package/esm/utils/change.js.map +1 -1
- package/esm/utils/edge.d.ts +1 -2
- package/esm/utils/edge.js.map +1 -1
- package/esm/utils/id.d.ts +2 -3
- package/esm/utils/id.js.map +1 -1
- package/esm/utils/palette.d.ts +1 -2
- package/esm/utils/palette.js.map +1 -1
- package/esm/utils/relation.d.ts +1 -2
- package/esm/utils/relation.js.map +1 -1
- package/esm/utils/style.js +3 -3
- package/esm/utils/style.js.map +1 -1
- package/lib/behaviors/brush-select.d.ts +2 -3
- package/lib/behaviors/brush-select.js.map +1 -1
- package/lib/behaviors/click-element.js.map +1 -1
- package/lib/behaviors/collapse-expand.d.ts +1 -2
- package/lib/behaviors/collapse-expand.js.map +1 -1
- package/lib/behaviors/create-edge.d.ts +1 -2
- package/lib/behaviors/create-edge.js.map +1 -1
- package/lib/behaviors/drag-element-force.d.ts +1 -2
- package/lib/behaviors/drag-element-force.js.map +1 -1
- package/lib/behaviors/drag-element.d.ts +2 -3
- package/lib/behaviors/drag-element.js.map +1 -1
- package/lib/behaviors/focus-element.js.map +1 -1
- package/lib/behaviors/hover-element.js.map +1 -1
- package/lib/behaviors/lasso-select.d.ts +2 -3
- package/lib/behaviors/lasso-select.js.map +1 -1
- package/lib/constants/events/animation.d.ts +1 -4
- package/lib/constants/events/animation.js +0 -4
- package/lib/constants/events/animation.js.map +1 -1
- package/lib/elements/nodes/base-node.d.ts +2 -3
- package/lib/elements/nodes/base-node.js.map +1 -1
- package/lib/elements/nodes/donut.d.ts +45 -0
- package/lib/elements/nodes/donut.js +85 -0
- package/lib/elements/nodes/donut.js.map +1 -0
- package/lib/elements/nodes/html.d.ts +27 -0
- package/lib/elements/nodes/html.js +213 -0
- package/lib/elements/nodes/html.js.map +1 -0
- package/lib/elements/nodes/index.d.ts +4 -0
- package/lib/elements/nodes/index.js +5 -1
- package/lib/elements/nodes/index.js.map +1 -1
- package/lib/exports.d.ts +4 -3
- package/lib/exports.js +5 -1
- package/lib/exports.js.map +1 -1
- package/lib/plugins/hull/index.d.ts +1 -2
- package/lib/plugins/hull/index.js.map +1 -1
- package/lib/plugins/legend.js +3 -2
- package/lib/plugins/legend.js.map +1 -1
- package/lib/registry/build-in.js +4 -2
- package/lib/registry/build-in.js.map +1 -1
- package/lib/runtime/canvas.js +5 -2
- package/lib/runtime/canvas.js.map +1 -1
- package/lib/runtime/data.d.ts +4 -4
- package/lib/runtime/data.js.map +1 -1
- package/lib/runtime/element.d.ts +3 -3
- package/lib/runtime/element.js +58 -41
- package/lib/runtime/element.js.map +1 -1
- package/lib/runtime/graph.d.ts +2 -3
- package/lib/runtime/graph.js +10 -8
- package/lib/runtime/graph.js.map +1 -1
- package/lib/runtime/layout.js +2 -2
- package/lib/runtime/layout.js.map +1 -1
- package/lib/runtime/viewport.d.ts +1 -2
- package/lib/runtime/viewport.js.map +1 -1
- package/lib/spec/data.d.ts +74 -1
- package/lib/spec/element/combo.d.ts +17 -6
- package/lib/spec/element/edge.d.ts +14 -2
- package/lib/spec/element/node.d.ts +19 -3
- package/lib/themes/base.d.ts +1 -0
- package/lib/themes/base.js +2 -0
- package/lib/themes/base.js.map +1 -1
- package/lib/transforms/process-parallel-edges.d.ts +1 -2
- package/lib/transforms/process-parallel-edges.js +2 -4
- package/lib/transforms/process-parallel-edges.js.map +1 -1
- package/lib/transforms/types.d.ts +1 -1
- package/lib/transforms/update-related-edge.js.map +1 -1
- package/lib/types/callable.d.ts +2 -2
- package/lib/types/data.d.ts +1 -1
- package/lib/types/id.d.ts +1 -0
- package/lib/{spec/element/base.js → types/id.js} +1 -1
- package/lib/types/id.js.map +1 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/style.d.ts +1 -3
- package/lib/utils/animation.d.ts +1 -1
- package/lib/utils/animation.js +1 -1
- package/lib/utils/animation.js.map +1 -1
- package/lib/utils/behaviors/brush.d.ts +1 -2
- package/lib/utils/behaviors/brush.js.map +1 -1
- package/lib/utils/behaviors/lasso.d.ts +1 -2
- package/lib/utils/behaviors/lasso.js.map +1 -1
- package/lib/utils/behaviors/utils.d.ts +1 -1
- package/lib/utils/change.js.map +1 -1
- package/lib/utils/edge.d.ts +1 -2
- package/lib/utils/edge.js.map +1 -1
- package/lib/utils/id.d.ts +2 -3
- package/lib/utils/id.js.map +1 -1
- package/lib/utils/palette.d.ts +1 -2
- package/lib/utils/palette.js.map +1 -1
- package/lib/utils/relation.d.ts +1 -2
- package/lib/utils/relation.js.map +1 -1
- package/lib/utils/style.js +3 -3
- package/lib/utils/style.js.map +1 -1
- package/package.json +1 -1
- package/src/behaviors/brush-select.ts +1 -2
- package/src/behaviors/click-element.ts +1 -2
- package/src/behaviors/collapse-expand.ts +1 -2
- package/src/behaviors/create-edge.ts +1 -2
- package/src/behaviors/drag-element-force.ts +1 -2
- package/src/behaviors/drag-element.ts +1 -2
- package/src/behaviors/focus-element.ts +1 -2
- package/src/behaviors/hover-element.ts +1 -2
- package/src/behaviors/lasso-select.ts +1 -2
- package/src/constants/events/animation.ts +0 -4
- package/src/elements/nodes/base-node.ts +3 -3
- package/src/elements/nodes/donut.ts +137 -0
- package/src/elements/nodes/html.ts +230 -0
- package/src/elements/nodes/index.ts +4 -0
- package/src/exports.ts +20 -1
- package/src/plugins/hull/index.ts +1 -2
- package/src/plugins/legend.ts +4 -4
- package/src/registry/build-in.ts +6 -2
- package/src/runtime/canvas.ts +5 -2
- package/src/runtime/data.ts +2 -1
- package/src/runtime/element.ts +62 -36
- package/src/runtime/graph.ts +13 -10
- package/src/runtime/layout.ts +4 -4
- package/src/runtime/viewport.ts +1 -2
- package/src/spec/data.ts +74 -1
- package/src/spec/element/combo.ts +17 -6
- package/src/spec/element/edge.ts +14 -2
- package/src/spec/element/node.ts +19 -3
- package/src/themes/base.ts +3 -0
- package/src/transforms/arrange-draw-order.ts +1 -1
- package/src/transforms/process-parallel-edges.ts +4 -6
- package/src/transforms/types.ts +1 -1
- package/src/transforms/update-related-edge.ts +1 -2
- package/src/types/callable.ts +2 -2
- package/src/types/data.ts +1 -1
- package/src/types/id.ts +1 -0
- package/src/types/index.ts +1 -0
- package/src/types/style.ts +1 -3
- package/src/utils/animation.ts +2 -2
- package/src/utils/behaviors/brush.ts +1 -2
- package/src/utils/behaviors/lasso.ts +1 -2
- package/src/utils/behaviors/utils.ts +1 -1
- package/src/utils/change.ts +1 -2
- package/src/utils/edge.ts +1 -1
- package/src/utils/id.ts +1 -2
- package/src/utils/palette.ts +1 -1
- package/src/utils/relation.ts +1 -2
- package/src/utils/style.ts +3 -3
- package/dist/lib/runtime/index.d.ts +0 -6
- package/dist/lib/spec/element/base.d.ts +0 -6
- package/esm/runtime/index.d.ts +0 -6
- package/esm/runtime/index.js +0 -7
- package/esm/runtime/index.js.map +0 -1
- package/esm/spec/element/base.d.ts +0 -6
- package/esm/spec/element/base.js +0 -2
- package/esm/spec/element/base.js.map +0 -1
- package/lib/runtime/index.d.ts +0 -6
- package/lib/runtime/index.js +0 -8
- package/lib/runtime/index.js.map +0 -1
- package/lib/spec/element/base.d.ts +0 -6
- package/lib/spec/element/base.js.map +0 -1
- package/src/runtime/index.ts +0 -7
- package/src/spec/element/base.ts +0 -6
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Shortcut } from '../utils/shortcut';
|
|
2
2
|
import { BaseBehavior } from './base-behavior';
|
|
3
|
-
import type { ID } from '@antv/graphlib';
|
|
4
3
|
import type { Graph } from '../runtime/graph';
|
|
5
4
|
import type { RuntimeContext } from '../runtime/types';
|
|
6
5
|
import type { NodeStyle } from '../spec/element/node';
|
|
7
|
-
import type { ElementType, IPointerEvent, Points, State } from '../types';
|
|
6
|
+
import type { ElementType, ID, IPointerEvent, Points, State } from '../types';
|
|
8
7
|
import type { ShortcutKey } from '../utils/shortcut';
|
|
9
8
|
import type { BaseBehaviorOptions } from './base-behavior';
|
|
10
9
|
type SELECT_MODE = 'union' | 'intersect' | 'diff' | 'default';
|
|
@@ -94,7 +93,7 @@ export declare class BrushSelect<T extends BaseBehaviorOptions = BrushSelectOpti
|
|
|
94
93
|
clearSelected: () => void;
|
|
95
94
|
updateElementState: (points: Points) => void;
|
|
96
95
|
private clearBrush;
|
|
97
|
-
getPointsSelectIds: (graph: Graph, points: Points, itemTypes: ElementType[]) =>
|
|
96
|
+
getPointsSelectIds: (graph: Graph, points: Points, itemTypes: ElementType[]) => string[];
|
|
98
97
|
isKeydown(): boolean | undefined;
|
|
99
98
|
validate(event: IPointerEvent): any;
|
|
100
99
|
bindEvents(): void;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { ID } from '@antv/graphlib';
|
|
2
1
|
import type { RuntimeContext } from '../runtime/types';
|
|
3
|
-
import type { IPointerEvent } from '../types';
|
|
2
|
+
import type { ID, IPointerEvent } from '../types';
|
|
4
3
|
import type { BaseBehaviorOptions } from './base-behavior';
|
|
5
4
|
import { BaseBehavior } from './base-behavior';
|
|
6
5
|
export interface CollapseExpandOptions extends BaseBehaviorOptions {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { ID } from '@antv/graphlib';
|
|
2
1
|
import type { RuntimeContext } from '../runtime/types';
|
|
3
2
|
import type { EdgeData } from '../spec';
|
|
4
3
|
import type { EdgeStyle } from '../spec/element/edge';
|
|
5
|
-
import type { IPointerEvent } from '../types';
|
|
4
|
+
import type { ID, IPointerEvent } from '../types';
|
|
6
5
|
import type { BaseBehaviorOptions } from './base-behavior';
|
|
7
6
|
import { BaseBehavior } from './base-behavior';
|
|
8
7
|
export interface CreateEdgeOptions extends BaseBehaviorOptions {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { ID } from '
|
|
2
|
-
import type { Element, IDragEvent, Point } from '../types';
|
|
1
|
+
import type { Element, ID, IDragEvent, Point } from '../types';
|
|
3
2
|
import type { DragElementOptions } from './drag-element';
|
|
4
3
|
import { DragElement } from './drag-element';
|
|
5
4
|
export interface DragElementForceOptions extends Omit<DragElementOptions, 'animation' | 'dropEffect' | 'shadow'> {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { BaseStyleProps } from '@antv/g';
|
|
2
|
-
import type { ID } from '@antv/graphlib';
|
|
3
2
|
import type { RuntimeContext } from '../runtime/types';
|
|
4
|
-
import type { EdgeDirection, Element, IDragEvent, Point, PrefixObject } from '../types';
|
|
3
|
+
import type { EdgeDirection, Element, ID, IDragEvent, Point, PrefixObject } from '../types';
|
|
5
4
|
import type { BaseBehaviorOptions } from './base-behavior';
|
|
6
5
|
import { BaseBehavior } from './base-behavior';
|
|
7
6
|
export interface DragElementOptions extends BaseBehaviorOptions, PrefixObject<BaseStyleProps, 'shadow'> {
|
|
@@ -84,7 +83,7 @@ export declare class DragElement extends BaseBehavior<DragElementOptions> {
|
|
|
84
83
|
constructor(context: RuntimeContext, options: DragElementOptions);
|
|
85
84
|
update(options: Partial<DragElementOptions>): void;
|
|
86
85
|
private bindEvents;
|
|
87
|
-
protected getSelectedNodeIDs(currTarget: ID[]):
|
|
86
|
+
protected getSelectedNodeIDs(currTarget: ID[]): string[];
|
|
88
87
|
protected getDelta(event: IElementDragEvent): [number, number] | Float32Array | [number, number, number];
|
|
89
88
|
protected onDragStart(event: IElementDragEvent): void;
|
|
90
89
|
protected onDrag(event: IElementDragEvent): void;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BrushSelect } from './brush-select';
|
|
2
|
-
import type { ID } from '@antv/graphlib';
|
|
3
2
|
import type { RuntimeContext } from '../runtime/types';
|
|
4
|
-
import type { IPointerEvent, Points, State } from '../types';
|
|
3
|
+
import type { ID, IPointerEvent, Points, State } from '../types';
|
|
5
4
|
import type { BrushSelectOptions } from './brush-select';
|
|
6
5
|
export type States = Record<ID, State | State[]>;
|
|
7
6
|
export type LassoSelectOptions = BrushSelectOptions;
|
|
@@ -9,7 +8,7 @@ export declare class LassoSelect extends BrushSelect<LassoSelectOptions> {
|
|
|
9
8
|
static defaultOptions: Partial<LassoSelectOptions>;
|
|
10
9
|
private points?;
|
|
11
10
|
private pathShape?;
|
|
12
|
-
selectElementFn: (graph: import("..").Graph, id:
|
|
11
|
+
selectElementFn: (graph: import("..").Graph, id: string, points: Points) => boolean;
|
|
13
12
|
constructor(context: RuntimeContext, options: LassoSelectOptions);
|
|
14
13
|
pointerDown: (event: IPointerEvent) => Promise<void>;
|
|
15
14
|
pointerMove: (event: IPointerEvent) => Promise<void>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { DisplayObject, DisplayObjectConfig, Group } from '@antv/g';
|
|
2
|
-
import type { ID } from '@antv/graphlib';
|
|
3
2
|
import type { CategoricalPalette } from '../../palettes/types';
|
|
4
3
|
import type { NodeData } from '../../spec';
|
|
5
|
-
import type { BadgePlacement, BaseElementStyleProps, Keyframe, LabelPlacement, Node, Placement, Point, Port, PortStyleProps, PrefixObject, Size } from '../../types';
|
|
4
|
+
import type { BadgePlacement, BaseElementStyleProps, ID, Keyframe, LabelPlacement, Node, Placement, Point, Port, PortStyleProps, PrefixObject, Size } from '../../types';
|
|
6
5
|
import type { BadgeStyleProps, IconStyleProps, LabelStyleProps } from '../shapes';
|
|
7
6
|
import { BaseShape } from '../shapes';
|
|
8
7
|
export type BaseNodeStyleProps<T extends Record<string, unknown> = Record<string, any>> = T & BaseElementStyleProps & PrefixObject<NodeLabelStyleProps, 'label'> & PrefixObject<T, 'halo'> & PrefixObject<IconStyleProps, 'icon'> & PrefixObject<BadgeStyleProps, 'badge'> & PrefixObject<PortStyleProps, 'port'> & {
|
|
@@ -141,7 +140,7 @@ export declare abstract class BaseNode<S extends BaseNodeStyleProps = BaseNodeSt
|
|
|
141
140
|
* Get the key shape for the node.
|
|
142
141
|
* @returns Key shape.
|
|
143
142
|
*/
|
|
144
|
-
getKey():
|
|
143
|
+
getKey<T extends DisplayObject>(): T;
|
|
145
144
|
/**
|
|
146
145
|
* Get the ports for the node.
|
|
147
146
|
* @returns Ports shape map.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Circle } from './circle';
|
|
2
|
+
import type { BaseStyleProps, DisplayObjectConfig, Group } from '@antv/g';
|
|
3
|
+
import type { PrefixObject } from '../../types';
|
|
4
|
+
import type { CircleStyleProps } from './circle';
|
|
5
|
+
interface Round extends BaseStyleProps {
|
|
6
|
+
/**
|
|
7
|
+
* <zh/> 数值,用于计算比例
|
|
8
|
+
*
|
|
9
|
+
* <en/> Numerical value used to calculate the scale.
|
|
10
|
+
*/
|
|
11
|
+
value: number;
|
|
12
|
+
/**
|
|
13
|
+
* <zh/> 颜色
|
|
14
|
+
*
|
|
15
|
+
* <en/> Color.
|
|
16
|
+
*/
|
|
17
|
+
color?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface DonutStyleProps extends CircleStyleProps, PrefixObject<BaseStyleProps, 'donut'> {
|
|
20
|
+
/**
|
|
21
|
+
* <zh/> 内环半径,使用百分比或者像素值
|
|
22
|
+
*
|
|
23
|
+
* <en/> Inner ring radius, using percentage or pixel value.
|
|
24
|
+
*/
|
|
25
|
+
innerRadius?: string | number;
|
|
26
|
+
/**
|
|
27
|
+
* <zh/> 圆环数据
|
|
28
|
+
*
|
|
29
|
+
* <en/> Donut data.
|
|
30
|
+
*/
|
|
31
|
+
donuts?: number[] | Round[];
|
|
32
|
+
/**
|
|
33
|
+
* <zh/> 颜色或者色板名
|
|
34
|
+
*
|
|
35
|
+
* <en/> Color or palette.
|
|
36
|
+
*/
|
|
37
|
+
colors?: string | string[];
|
|
38
|
+
}
|
|
39
|
+
export declare class Donut extends Circle {
|
|
40
|
+
static defaultStyleProps: Partial<DonutStyleProps>;
|
|
41
|
+
constructor(options: DisplayObjectConfig<DonutStyleProps>);
|
|
42
|
+
protected drawDonutShape(attributes: Required<DonutStyleProps>, container: Group): void;
|
|
43
|
+
render(attributes: Required<DonutStyleProps>, container?: Group): void;
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DisplayObjectConfig, HTMLStyleProps as GHTMLStyleProps, Group } from '@antv/g';
|
|
2
|
+
import type { BaseNodeStyleProps } from './base-node';
|
|
3
|
+
import { BaseNode } from './base-node';
|
|
4
|
+
export type HTMLStyleProps = BaseNodeStyleProps<{
|
|
5
|
+
innerHTML: string | HTMLElement;
|
|
6
|
+
}>;
|
|
7
|
+
/**
|
|
8
|
+
* @see https://github.com/antvis/G/blob/next/packages/g-lite/src/plugins/EventPlugin.ts
|
|
9
|
+
*/
|
|
10
|
+
export declare class HTML extends BaseNode<HTMLStyleProps> {
|
|
11
|
+
static defaultStyleProps: Partial<HTMLStyleProps>;
|
|
12
|
+
constructor(options: DisplayObjectConfig<HTMLStyleProps>);
|
|
13
|
+
private rootPointerEvent;
|
|
14
|
+
private get eventService();
|
|
15
|
+
private get events();
|
|
16
|
+
protected getDomElement(): HTMLElement;
|
|
17
|
+
protected getKeyStyle(attributes: Required<HTMLStyleProps>): GHTMLStyleProps;
|
|
18
|
+
protected drawKeyShape(attributes: Required<HTMLStyleProps>, container: Group): any;
|
|
19
|
+
connectedCallback(): void;
|
|
20
|
+
attributeChangedCallback(name: any, oldValue: any, newValue: any): void;
|
|
21
|
+
onDestroy(): void;
|
|
22
|
+
private forwardEvents;
|
|
23
|
+
private normalizeToPointerEvent;
|
|
24
|
+
private transferMouseData;
|
|
25
|
+
private bootstrapEvent;
|
|
26
|
+
private getViewportXY;
|
|
27
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { BaseNode } from './base-node';
|
|
2
2
|
export { Circle } from './circle';
|
|
3
3
|
export { Diamond } from './diamond';
|
|
4
|
+
export { Donut } from './donut';
|
|
4
5
|
export { Ellipse } from './ellipse';
|
|
5
6
|
export { Hexagon } from './hexagon';
|
|
7
|
+
export { HTML } from './html';
|
|
6
8
|
export { Image } from './image';
|
|
7
9
|
export { Rect } from './rect';
|
|
8
10
|
export { Star } from './star';
|
|
@@ -10,8 +12,10 @@ export { Triangle } from './triangle';
|
|
|
10
12
|
export type { BaseNodeStyleProps } from './base-node';
|
|
11
13
|
export type { CircleStyleProps } from './circle';
|
|
12
14
|
export type { DiamondStyleProps } from './diamond';
|
|
15
|
+
export type { DonutStyleProps } from './donut';
|
|
13
16
|
export type { EllipseStyleProps } from './ellipse';
|
|
14
17
|
export type { HexagonStyleProps } from './hexagon';
|
|
18
|
+
export type { HTMLStyleProps } from './html';
|
|
15
19
|
export type { ImageStyleProps } from './image';
|
|
16
20
|
export type { RectStyleProps } from './rect';
|
|
17
21
|
export type { StarStyleProps } from './star';
|
package/dist/lib/exports.d.ts
CHANGED
|
@@ -5,23 +5,24 @@ export { BaseBehavior, DragCanvas, ZoomCanvas } from './behaviors';
|
|
|
5
5
|
export { CanvasEvent, ComboEvent, CommonEvent, ContainerEvent, EdgeEvent, ExtensionCategory, GraphEvent, NodeEvent, } from './constants';
|
|
6
6
|
export { BaseCombo, CircleCombo, RectCombo } from './elements/combos';
|
|
7
7
|
export { BaseEdge, Cubic, CubicHorizontal, CubicVertical, Line, Polyline, Quadratic } from './elements/edges';
|
|
8
|
-
export { BaseNode, Circle, Diamond, Ellipse, Hexagon, Image, Rect, Star, Triangle } from './elements/nodes';
|
|
8
|
+
export { BaseNode, Circle, Diamond, Donut, Ellipse, HTML, Hexagon, Image, Rect, Star, Triangle, } from './elements/nodes';
|
|
9
9
|
export { BaseShape } from './elements/shapes';
|
|
10
10
|
export { BasePlugin, CameraSetting, History } from './plugins';
|
|
11
11
|
export { getExtension, getExtensions, register } from './registry';
|
|
12
12
|
export { Graph } from './runtime/graph';
|
|
13
13
|
export { BaseTransform } from './transforms';
|
|
14
14
|
export { Shortcut } from './utils/shortcut';
|
|
15
|
+
export { parseSize } from './utils/size';
|
|
15
16
|
export type { BaseBehaviorOptions, DragCanvasOptions, ZoomCanvasOptions } from './behaviors';
|
|
16
17
|
export type { BaseComboStyleProps, CircleComboStyleProps, RectComboStyleProps } from './elements/combos';
|
|
17
18
|
export type { BaseEdgeStyleProps, CubicHorizontalStyleProps, CubicStyleProps, CubicVerticalStyleProps, LineStyleProps, PolylineStyleProps, QuadraticStyleProps, } from './elements/edges';
|
|
18
|
-
export type { BaseNodeStyleProps, CircleStyleProps, DiamondStyleProps, EllipseStyleProps, HexagonStyleProps, ImageStyleProps, RectStyleProps, StarStyleProps, TriangleStyleProps, } from './elements/nodes';
|
|
19
|
+
export type { BaseNodeStyleProps, CircleStyleProps, DiamondStyleProps, EllipseStyleProps, HTMLStyleProps, HexagonStyleProps, ImageStyleProps, RectStyleProps, StarStyleProps, TriangleStyleProps, } from './elements/nodes';
|
|
19
20
|
export type { BaseShapeStyleProps } from './elements/shapes';
|
|
20
21
|
export type { BasePluginOptions, CameraSettingOptions, Hull } from './plugins';
|
|
21
22
|
export type { RuntimeContext } from './runtime/types';
|
|
22
23
|
export type { BehaviorOptions, CanvasOptions, ComboData, ComboOptions, EdgeData, EdgeOptions, G6Spec, GraphData, LayoutOptions, NodeData, NodeOptions, PluginOptions, ThemeOptions, ViewportOptions, } from './spec';
|
|
23
24
|
export type { BaseTransformOptions } from './transforms';
|
|
24
|
-
export type { IAnimateEvent, IDragEvent, IElementLifeCycleEvent, IEvent, IGraphLifeCycleEvent, IKeyboardEvent, IPointerEvent, IViewportEvent, IWheelEvent, Point, Vector2, Vector3, ViewportAnimationEffectTiming, } from './types';
|
|
25
|
+
export type { Combo, Edge, Element, IAnimateEvent, ID, IDragEvent, IElementLifeCycleEvent, IEvent, IGraphLifeCycleEvent, IKeyboardEvent, IPointerEvent, IViewportEvent, IWheelEvent, Node, Point, Vector2, Vector3, ViewportAnimationEffectTiming, } from './types';
|
|
25
26
|
export type { ShortcutKey } from './utils/shortcut';
|
|
26
27
|
declare const Utils: {
|
|
27
28
|
idOf: typeof idOf;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { ID } from '@antv/graphlib';
|
|
2
1
|
import type { RuntimeContext } from '../../runtime/types';
|
|
3
|
-
import type { CallableValue } from '../../types';
|
|
2
|
+
import type { CallableValue, ID } from '../../types';
|
|
4
3
|
import type { BasePluginOptions } from '../base-plugin';
|
|
5
4
|
import { BasePlugin } from '../base-plugin';
|
|
6
5
|
import type { HullStyleProps } from './shape';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Graph as GraphLib
|
|
1
|
+
import { Graph as GraphLib } from '@antv/graphlib';
|
|
2
2
|
import { COMBO_KEY, TREE_KEY } from '../constants';
|
|
3
3
|
import type { ComboData, EdgeData, GraphData, NodeData } from '../spec';
|
|
4
|
-
import type { DataChange, DataID, ElementDatum, NodeLikeData, PartialEdgeData, PartialGraphData, PartialNodeLikeData, Position, State } from '../types';
|
|
4
|
+
import type { DataChange, DataID, ElementDatum, ID, NodeLikeData, PartialEdgeData, PartialGraphData, PartialNodeLikeData, Position, State } from '../types';
|
|
5
5
|
import type { EdgeDirection } from '../types/edge';
|
|
6
6
|
import type { ElementType } from '../types/element';
|
|
7
7
|
export declare class DataController {
|
|
@@ -17,8 +17,8 @@ export declare class DataController {
|
|
|
17
17
|
* <en/> When the combo is deleted, its id will be removed from comboIds. At this time, the NodeRemoved obtained according to the changes event of Graphlib cannot distinguish whether it is a combo or a node.
|
|
18
18
|
* Therefore, it is necessary to record the id of the last deleted combo and use it to judge isCombo
|
|
19
19
|
*/
|
|
20
|
-
protected latestRemovedComboIds: Set<
|
|
21
|
-
protected comboIds: Set<
|
|
20
|
+
protected latestRemovedComboIds: Set<string>;
|
|
21
|
+
protected comboIds: Set<string>;
|
|
22
22
|
/**
|
|
23
23
|
* <zh/> 获取详细数据变更
|
|
24
24
|
*
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { DisplayObject, IAnimation } from '@antv/g';
|
|
2
|
-
import type { ID } from '@antv/graphlib';
|
|
3
2
|
import type { AnimationStage } from '../spec/element/animation';
|
|
4
|
-
import type { Combo, Element, ElementDatum, ElementType, Node, State } from '../types';
|
|
3
|
+
import type { Combo, Element, ElementDatum, ElementType, ID, Node, State } from '../types';
|
|
5
4
|
import type { RuntimeContext } from './types';
|
|
6
5
|
export declare class ElementController {
|
|
7
6
|
private context;
|
|
@@ -12,6 +11,7 @@ export declare class ElementController {
|
|
|
12
11
|
init(): void;
|
|
13
12
|
private emit;
|
|
14
13
|
private forEachElementData;
|
|
14
|
+
getElementType(elementType: ElementType, datum: ElementDatum): string;
|
|
15
15
|
private getTheme;
|
|
16
16
|
getThemeStyle(elementType: ElementType): import("../spec/element/node").NodeStyle | import("../spec/element/edge").EdgeStyle;
|
|
17
17
|
getThemeStateStyle(elementType: ElementType, states: State[]): any;
|
|
@@ -28,7 +28,7 @@ export declare class ElementController {
|
|
|
28
28
|
*
|
|
29
29
|
* <en/> compute default style of single element
|
|
30
30
|
*/
|
|
31
|
-
private
|
|
31
|
+
private computeElementDefaultStyle;
|
|
32
32
|
private computeElementsDefaultStyle;
|
|
33
33
|
getDefaultStyle(id: ID): Record<string, unknown>;
|
|
34
34
|
private getElementState;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import EventEmitter from '@antv/event-emitter';
|
|
2
2
|
import type { AABB, BaseStyleProps } from '@antv/g';
|
|
3
|
-
import type { ID } from '@antv/graphlib';
|
|
4
3
|
import type { Plugin } from '../plugins/types';
|
|
5
4
|
import type { BehaviorOptions, ComboData, ComboOptions, EdgeData, EdgeOptions, G6Spec, GraphData, LayoutOptions, NodeData, NodeOptions, PluginOptions, ThemeOptions, TransformOptions } from '../spec';
|
|
6
5
|
import type { UpdateBehaviorOption } from '../spec/behavior';
|
|
7
6
|
import type { UpdatePluginOption } from '../spec/plugin';
|
|
8
7
|
import type { UpdateTransformOption } from '../spec/transform';
|
|
9
|
-
import type { CallableValue, DataID, EdgeDirection, ElementType, FitViewOptions, IEvent, NodeLikeData, PartialEdgeData, PartialGraphData, PartialNodeLikeData, Point, Position, State, ViewportAnimationEffectTiming } from '../types';
|
|
8
|
+
import type { CallableValue, DataID, EdgeDirection, ElementType, FitViewOptions, ID, IEvent, NodeLikeData, PartialEdgeData, PartialGraphData, PartialNodeLikeData, Point, Position, State, ViewportAnimationEffectTiming } from '../types';
|
|
10
9
|
import type { DataURLOptions } from './canvas';
|
|
11
10
|
import { Canvas } from './canvas';
|
|
12
11
|
import type { HierarchyKey } from './data';
|
|
@@ -178,7 +177,7 @@ export declare class Graph extends EventEmitter {
|
|
|
178
177
|
getElementDataByState(elementType: 'edge', state: State): EdgeData[];
|
|
179
178
|
getElementDataByState(elementType: 'combo', state: State): ComboData[];
|
|
180
179
|
private initCanvas;
|
|
181
|
-
private
|
|
180
|
+
private initRuntime;
|
|
182
181
|
private prepare;
|
|
183
182
|
/**
|
|
184
183
|
* <zh/> 执行渲染
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AABB } from '@antv/g';
|
|
2
|
-
import type { ID } from '
|
|
3
|
-
import type { FitViewOptions, Point, TransformOptions, ViewportAnimationEffectTiming } from '../types';
|
|
2
|
+
import type { FitViewOptions, ID, Point, TransformOptions, ViewportAnimationEffectTiming } from '../types';
|
|
4
3
|
import type { RuntimeContext } from './types';
|
|
5
4
|
export declare class ViewportController {
|
|
6
5
|
private context;
|
package/dist/lib/spec/data.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ID } from '
|
|
1
|
+
import type { ID } from '../types';
|
|
2
2
|
import type { ComboStyle } from './element/combo';
|
|
3
3
|
import type { EdgeStyle } from './element/edge';
|
|
4
4
|
import type { NodeStyle } from './element/node';
|
|
@@ -23,22 +23,95 @@ export interface GraphData {
|
|
|
23
23
|
combos?: ComboData[];
|
|
24
24
|
}
|
|
25
25
|
export interface NodeData {
|
|
26
|
+
/**
|
|
27
|
+
* <zh/> 节点 ID
|
|
28
|
+
*
|
|
29
|
+
* <en/> Node ID
|
|
30
|
+
*/
|
|
26
31
|
id: ID;
|
|
32
|
+
/**
|
|
33
|
+
* <zh/> 节点类型
|
|
34
|
+
*
|
|
35
|
+
* <en/> Node type
|
|
36
|
+
*/
|
|
37
|
+
type?: string;
|
|
38
|
+
/**
|
|
39
|
+
* <zh/> 节点数据
|
|
40
|
+
*
|
|
41
|
+
* <en/> Node data
|
|
42
|
+
*/
|
|
27
43
|
data?: Record<string, unknown>;
|
|
44
|
+
/**
|
|
45
|
+
* <zh/> 节点样式
|
|
46
|
+
*
|
|
47
|
+
* <en/> Node style
|
|
48
|
+
*/
|
|
28
49
|
style?: NodeStyle;
|
|
29
50
|
[key: string]: unknown;
|
|
30
51
|
}
|
|
31
52
|
export interface ComboData {
|
|
53
|
+
/**
|
|
54
|
+
* <zh/> Combo ID
|
|
55
|
+
*
|
|
56
|
+
* <en/> Combo ID
|
|
57
|
+
*/
|
|
32
58
|
id: ID;
|
|
59
|
+
/**
|
|
60
|
+
* <zh/> Combo 类型
|
|
61
|
+
*
|
|
62
|
+
* <en/> Combo type
|
|
63
|
+
*/
|
|
64
|
+
type?: string;
|
|
65
|
+
/**
|
|
66
|
+
* <zh/> Combo 数据
|
|
67
|
+
*
|
|
68
|
+
* <en/> Combo data
|
|
69
|
+
*/
|
|
33
70
|
data?: Record<string, unknown>;
|
|
71
|
+
/**
|
|
72
|
+
* <zh/> Combo 样式
|
|
73
|
+
*
|
|
74
|
+
* <en/> Combo style
|
|
75
|
+
*/
|
|
34
76
|
style?: ComboStyle;
|
|
35
77
|
[key: string]: unknown;
|
|
36
78
|
}
|
|
37
79
|
export interface EdgeData {
|
|
80
|
+
/**
|
|
81
|
+
* <zh/> 边 ID
|
|
82
|
+
*
|
|
83
|
+
* <en/> Edge ID
|
|
84
|
+
*/
|
|
38
85
|
id?: ID;
|
|
86
|
+
/**
|
|
87
|
+
* <zh/> 边源节点 ID
|
|
88
|
+
*
|
|
89
|
+
* <en/> Source node ID
|
|
90
|
+
*/
|
|
39
91
|
source: ID;
|
|
92
|
+
/**
|
|
93
|
+
* <zh/> 边目标节点 ID
|
|
94
|
+
*
|
|
95
|
+
* <en/> Target node ID
|
|
96
|
+
*/
|
|
40
97
|
target: ID;
|
|
98
|
+
/**
|
|
99
|
+
* <zh/> 边类型
|
|
100
|
+
*
|
|
101
|
+
* <en/> Edge type
|
|
102
|
+
*/
|
|
103
|
+
type?: string;
|
|
104
|
+
/**
|
|
105
|
+
* <zh/> 边数据
|
|
106
|
+
*
|
|
107
|
+
* <en/> Edge data
|
|
108
|
+
*/
|
|
41
109
|
data?: Record<string, unknown>;
|
|
110
|
+
/**
|
|
111
|
+
* <zh/> 边样式
|
|
112
|
+
*
|
|
113
|
+
* <en/> Edge style
|
|
114
|
+
*/
|
|
42
115
|
style?: EdgeStyle;
|
|
43
116
|
[key: string]: unknown;
|
|
44
117
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { ID } from '@antv/graphlib';
|
|
2
1
|
import type { BaseComboStyleProps } from '../../elements/combos';
|
|
2
|
+
import type { ID, State } from '../../types';
|
|
3
3
|
import type { CallableObject } from '../../types/callable';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ComboData } from '../data';
|
|
5
5
|
import type { AnimationOptions } from './animation';
|
|
6
|
-
import type { BaseElementStyle } from './base';
|
|
7
6
|
import type { PaletteOptions } from './palette';
|
|
8
7
|
/**
|
|
9
8
|
* <zh/> Combo 配置项
|
|
@@ -11,18 +10,24 @@ import type { PaletteOptions } from './palette';
|
|
|
11
10
|
* <en/> Combo spec
|
|
12
11
|
*/
|
|
13
12
|
export interface ComboOptions {
|
|
13
|
+
/**
|
|
14
|
+
* <zh/> Combo 类型
|
|
15
|
+
*
|
|
16
|
+
* <en/> Combo type
|
|
17
|
+
*/
|
|
18
|
+
type?: string | ((datum: ComboData) => string);
|
|
14
19
|
/**
|
|
15
20
|
* <zh/> Combo 样式
|
|
16
21
|
*
|
|
17
22
|
* <en/> Combo style
|
|
18
23
|
*/
|
|
19
|
-
style?: CallableObject<ComboStyle,
|
|
24
|
+
style?: CallableObject<ComboStyle, ComboData>;
|
|
20
25
|
/**
|
|
21
26
|
* <zh/> Combo 状态样式
|
|
22
27
|
*
|
|
23
28
|
* <en/> Combo state style
|
|
24
29
|
*/
|
|
25
|
-
state?: Record<string, CallableObject<ComboStyle,
|
|
30
|
+
state?: Record<string, CallableObject<ComboStyle, ComboData>>;
|
|
26
31
|
/**
|
|
27
32
|
* <zh/> Combo 动画
|
|
28
33
|
*
|
|
@@ -42,7 +47,13 @@ export interface StaticComboOptions {
|
|
|
42
47
|
animation?: AnimationOptions;
|
|
43
48
|
palette?: PaletteOptions;
|
|
44
49
|
}
|
|
45
|
-
export interface ComboStyle extends
|
|
50
|
+
export interface ComboStyle extends Partial<BaseComboStyleProps> {
|
|
51
|
+
/**
|
|
52
|
+
* <zh/> 初始状态
|
|
53
|
+
*
|
|
54
|
+
* <en/> Initial state
|
|
55
|
+
*/
|
|
56
|
+
states?: State[];
|
|
46
57
|
children?: ID[];
|
|
47
58
|
[key: string]: any;
|
|
48
59
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { BaseEdgeStyleProps } from '../../elements/edges';
|
|
2
|
+
import { State } from '../../types';
|
|
2
3
|
import type { CallableObject } from '../../types/callable';
|
|
3
4
|
import type { EdgeData } from '../data';
|
|
4
5
|
import type { AnimationOptions } from './animation';
|
|
5
|
-
import type { BaseElementStyle } from './base';
|
|
6
6
|
import type { PaletteOptions } from './palette';
|
|
7
7
|
/**
|
|
8
8
|
* <zh/> 边配置项
|
|
@@ -10,6 +10,12 @@ import type { PaletteOptions } from './palette';
|
|
|
10
10
|
* <en/> Edge spec
|
|
11
11
|
*/
|
|
12
12
|
export interface EdgeOptions {
|
|
13
|
+
/**
|
|
14
|
+
* <zh/> 边类型
|
|
15
|
+
*
|
|
16
|
+
* <en/> Edge type
|
|
17
|
+
*/
|
|
18
|
+
type?: string | ((datum: EdgeData) => string);
|
|
13
19
|
/**
|
|
14
20
|
* <zh/> 边样式
|
|
15
21
|
*
|
|
@@ -41,6 +47,12 @@ export interface StaticEdgeOptions {
|
|
|
41
47
|
animation?: AnimationOptions;
|
|
42
48
|
palette?: PaletteOptions;
|
|
43
49
|
}
|
|
44
|
-
export interface EdgeStyle extends
|
|
50
|
+
export interface EdgeStyle extends Partial<BaseEdgeStyleProps> {
|
|
51
|
+
/**
|
|
52
|
+
* <zh/> 初始状态
|
|
53
|
+
*
|
|
54
|
+
* <en/> Initial state
|
|
55
|
+
*/
|
|
56
|
+
states?: State[];
|
|
45
57
|
[key: string]: any;
|
|
46
58
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { ID } from '@antv/graphlib';
|
|
2
1
|
import type { BaseNodeStyleProps } from '../../elements/nodes';
|
|
2
|
+
import type { ID, State } from '../../types';
|
|
3
3
|
import type { CallableObject } from '../../types/callable';
|
|
4
4
|
import type { NodeData } from '../data';
|
|
5
5
|
import type { AnimationOptions } from './animation';
|
|
6
|
-
import type { BaseElementStyle } from './base';
|
|
7
6
|
import type { PaletteOptions } from './palette';
|
|
8
7
|
/**
|
|
9
8
|
* <zh/> 节点配置项
|
|
@@ -11,6 +10,12 @@ import type { PaletteOptions } from './palette';
|
|
|
11
10
|
* <en/> Node spec
|
|
12
11
|
*/
|
|
13
12
|
export interface NodeOptions {
|
|
13
|
+
/**
|
|
14
|
+
* <zh/> 节点类型
|
|
15
|
+
*
|
|
16
|
+
* <en/> Node type
|
|
17
|
+
*/
|
|
18
|
+
type?: string | ((datum: NodeData) => string);
|
|
14
19
|
/**
|
|
15
20
|
* <zh/> 节点样式
|
|
16
21
|
*
|
|
@@ -42,7 +47,18 @@ export interface StaticNodeOptions {
|
|
|
42
47
|
animation?: AnimationOptions;
|
|
43
48
|
palette?: PaletteOptions;
|
|
44
49
|
}
|
|
45
|
-
export interface NodeStyle extends
|
|
50
|
+
export interface NodeStyle extends Partial<BaseNodeStyleProps> {
|
|
51
|
+
/**
|
|
52
|
+
* <zh/> 初始状态
|
|
53
|
+
*
|
|
54
|
+
* <en/> Initial state
|
|
55
|
+
*/
|
|
56
|
+
states?: State[];
|
|
57
|
+
/**
|
|
58
|
+
* <zh/> 子节点 ID (树图专用)
|
|
59
|
+
*
|
|
60
|
+
* <en/> Child node ID (for tree graph)
|
|
61
|
+
*/
|
|
46
62
|
children?: ID[];
|
|
47
63
|
[key: string]: any;
|
|
48
64
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { PathStyleProps } from '@antv/g';
|
|
2
|
-
import type { ID } from '@antv/graphlib';
|
|
3
2
|
import type { RuntimeContext } from '../runtime/types';
|
|
4
3
|
import type { EdgeData } from '../spec';
|
|
5
|
-
import type { ElementDatum, ElementType } from '../types';
|
|
4
|
+
import type { ElementDatum, ElementType, ID } from '../types';
|
|
6
5
|
import type { BaseTransformOptions } from './base-transform';
|
|
7
6
|
import { BaseTransform } from './base-transform';
|
|
8
7
|
import type { DrawData } from './types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ID } from '@antv/graphlib';
|
|
2
1
|
import type { ComboData, EdgeData, NodeData } from '../spec';
|
|
2
|
+
import type { ID } from '../types';
|
|
3
3
|
import type { BaseTransform, BaseTransformOptions } from './base-transform';
|
|
4
4
|
export type BuiltInTransformOptions = BaseTransformOptions;
|
|
5
5
|
export type Transform = BaseTransform<any>;
|
|
@@ -25,6 +25,6 @@ export type CallableValue<Returns, Param = Returns> = Returns | ((args: Param) =
|
|
|
25
25
|
* fill: ({ model }) => model.value,
|
|
26
26
|
* }
|
|
27
27
|
*/
|
|
28
|
-
export type CallableObject<Obj extends Record<string, unknown>, T> = ((datum: T
|
|
29
|
-
[K in keyof Obj]: Obj[K] | ((datum: T
|
|
28
|
+
export type CallableObject<Obj extends Record<string, unknown>, T> = ((datum: T) => Obj) | {
|
|
29
|
+
[K in keyof Obj]: Obj[K] | ((datum: T) => NonNullable<Obj[K]>);
|
|
30
30
|
};
|
package/dist/lib/types/data.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ID = string;
|
|
@@ -9,6 +9,7 @@ export type * from './element';
|
|
|
9
9
|
export type * from './enum';
|
|
10
10
|
export type * from './event';
|
|
11
11
|
export type * from './graphlib';
|
|
12
|
+
export type * from './id';
|
|
12
13
|
export type * from './node';
|
|
13
14
|
export type * from './padding';
|
|
14
15
|
export type * from './placement';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ElementDatum } from './data';
|
|
2
2
|
/**
|
|
3
3
|
* <zh/> 样式计算迭代上下文
|
|
4
4
|
*
|
|
@@ -6,6 +6,4 @@ import type { ElementData, ElementDatum } from './data';
|
|
|
6
6
|
*/
|
|
7
7
|
export type StyleIterationContext = {
|
|
8
8
|
datum: ElementDatum;
|
|
9
|
-
index: number;
|
|
10
|
-
elementData: ElementData;
|
|
11
9
|
};
|