mirror of
https://gitee.com/antv/g6.git
synced 2024-11-30 10:48:24 +08:00
feat: fix typing error (#4883)
This commit is contained in:
parent
9b6eb1ed28
commit
b9274e9ab2
@ -72,8 +72,8 @@
|
||||
"@antv/g-webgl": "^1.9.18",
|
||||
"@antv/graphlib": "^2.0.2",
|
||||
"@antv/gui": "^0.5.0-alpha.16",
|
||||
"@antv/hierarchy": "latest",
|
||||
"@antv/layout": "^1.2.9",
|
||||
"@antv/hierarchy": "latest",
|
||||
"@antv/layout-gpu": "^1.1.5",
|
||||
"@antv/layout-wasm": "1.3.1",
|
||||
"@antv/matrix-util": "^3.0.4",
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { runtime } from '@antv/g';
|
||||
import EmptyGraph from './runtime/graph';
|
||||
import { stdLib, Extensions } from './stdlib';
|
||||
import { Extensions, stdLib } from './stdlib';
|
||||
import Util from './util';
|
||||
import { extend } from './util/extend';
|
||||
export * from './types';
|
||||
@ -13,11 +13,11 @@ runtime.enableCSSParsing = false;
|
||||
/**
|
||||
* Extend the graph class with std lib
|
||||
*/
|
||||
// @ts-ignore
|
||||
const Graph = extend(EmptyGraph<{}, {}>, stdLib);
|
||||
|
||||
const Graph = extend(EmptyGraph, stdLib);
|
||||
|
||||
const G6 = { Graph, Util, stdLib, Extensions, extend };
|
||||
|
||||
export { Graph, Util, stdLib, Extensions, extend };
|
||||
export { Extensions, Graph, Util, extend, stdLib };
|
||||
|
||||
export default G6;
|
||||
|
@ -1,24 +1,57 @@
|
||||
import * as Layouts from '@antv/layout';
|
||||
import Hierarchy from '@antv/hierarchy';
|
||||
import * as Layouts from '@antv/layout';
|
||||
import { Lib } from '../types/stdlib';
|
||||
|
||||
import * as Transforms from './data';
|
||||
import * as Nodes from './item/node';
|
||||
import * as Edges from './item/edge';
|
||||
import * as Combos from './item/combo';
|
||||
import * as Behaviors from './behavior';
|
||||
import * as Transforms from './data';
|
||||
import * as Combos from './item/combo';
|
||||
import * as Edges from './item/edge';
|
||||
import * as Nodes from './item/node';
|
||||
import * as Plugins from './plugin';
|
||||
import * as Themes from './theme';
|
||||
import * as ThemeSolvers from './themeSolver';
|
||||
import * as Plugins from './plugin';
|
||||
|
||||
const { ValidateData, TransformV4Data, MapNodeSize } = Transforms;
|
||||
|
||||
const { compactBox, dendrogram, indented, mindmap } = Hierarchy;
|
||||
|
||||
const { DarkTheme, LightTheme } = Themes;
|
||||
const { SpecThemeSolver, SubjectThemeSolver } = ThemeSolvers;
|
||||
const { CircleNode, RectNode } = Nodes;
|
||||
const { LineEdge } = Edges;
|
||||
|
||||
const {
|
||||
CircleNode,
|
||||
RectNode,
|
||||
DiamondNode,
|
||||
DonutNode,
|
||||
SphereNode,
|
||||
StarNode,
|
||||
HexagonNode,
|
||||
TriangleNode,
|
||||
EllipseNode,
|
||||
ModelRectNode,
|
||||
} = Nodes;
|
||||
|
||||
const {
|
||||
LineEdge,
|
||||
CubicEdge,
|
||||
CubicHorizontalEdge,
|
||||
CubicVerticalEdge,
|
||||
LoopEdge,
|
||||
PolylineEdge,
|
||||
QuadraticEdge,
|
||||
} = Edges;
|
||||
const { CircleCombo, RectCombo } = Combos;
|
||||
const {
|
||||
ActivateRelations,
|
||||
BrushSelect,
|
||||
HoverActivate,
|
||||
LassoSelect,
|
||||
OrbitCanvas3D,
|
||||
RotateCanvas3D,
|
||||
TrackCanvas3D,
|
||||
ZoomCanvas3D,
|
||||
ZoomCanvas,
|
||||
|
||||
DragCanvas,
|
||||
CollapseExpandTree,
|
||||
CollapseExpandCombo,
|
||||
@ -26,7 +59,9 @@ const {
|
||||
DragCombo,
|
||||
ClickSelect,
|
||||
} = Behaviors;
|
||||
const { History } = Plugins;
|
||||
const { History, Tooltip, Minimap, Grid, Menu, Fisheye, Legend, Toolbar } =
|
||||
Plugins;
|
||||
|
||||
const { ForceLayout, GridLayout, CircularLayout, ConcentricLayout } = Layouts;
|
||||
|
||||
import lassoSelector from './selector/lasso';
|
||||
@ -137,17 +172,87 @@ const utils = {
|
||||
};
|
||||
|
||||
const registery = { useLib };
|
||||
// const Extensions = {
|
||||
// ...Transforms,
|
||||
// ...Themes,
|
||||
// ...ThemeSolvers,
|
||||
// ...Nodes,
|
||||
// ...Edges,
|
||||
// ...Combos,
|
||||
// ...Behaviors,
|
||||
// ...Plugins,
|
||||
// ...Layouts,
|
||||
// ...Hierarchy,
|
||||
// };
|
||||
|
||||
const Extensions = {
|
||||
...Transforms,
|
||||
...Themes,
|
||||
...ThemeSolvers,
|
||||
...Nodes,
|
||||
...Edges,
|
||||
...Combos,
|
||||
...Behaviors,
|
||||
...Plugins,
|
||||
...Layouts,
|
||||
...Hierarchy,
|
||||
// transforms
|
||||
ValidateData,
|
||||
TransformV4Data,
|
||||
MapNodeSize,
|
||||
//themes
|
||||
LightTheme,
|
||||
DarkTheme,
|
||||
//themeSolvers
|
||||
SpecThemeSolver,
|
||||
SubjectThemeSolver,
|
||||
//layout
|
||||
ForceLayout,
|
||||
GridLayout,
|
||||
CircularLayout,
|
||||
ConcentricLayout,
|
||||
//Hierarchy
|
||||
compactBox,
|
||||
dendrogram,
|
||||
indented,
|
||||
mindmap,
|
||||
//nodes
|
||||
CircleNode,
|
||||
RectNode,
|
||||
DiamondNode,
|
||||
DonutNode,
|
||||
SphereNode,
|
||||
StarNode,
|
||||
HexagonNode,
|
||||
TriangleNode,
|
||||
EllipseNode,
|
||||
ModelRectNode,
|
||||
// edges
|
||||
LineEdge,
|
||||
CubicEdge,
|
||||
CubicHorizontalEdge,
|
||||
CubicVerticalEdge,
|
||||
LoopEdge,
|
||||
PolylineEdge,
|
||||
QuadraticEdge,
|
||||
// combos
|
||||
CircleCombo,
|
||||
RectCombo,
|
||||
//behaviors
|
||||
ActivateRelations,
|
||||
BrushSelect,
|
||||
HoverActivate,
|
||||
LassoSelect,
|
||||
OrbitCanvas3D,
|
||||
RotateCanvas3D,
|
||||
TrackCanvas3D,
|
||||
ZoomCanvas3D,
|
||||
ZoomCanvas,
|
||||
DragCanvas,
|
||||
CollapseExpandTree,
|
||||
CollapseExpandCombo,
|
||||
DragNode,
|
||||
DragCombo,
|
||||
//plugins
|
||||
History,
|
||||
Toolbar,
|
||||
Tooltip,
|
||||
Minimap,
|
||||
Grid,
|
||||
Menu,
|
||||
Fisheye,
|
||||
Legend,
|
||||
};
|
||||
|
||||
export default registery;
|
||||
export { registery, stdLib, utils, Extensions };
|
||||
export { Extensions, registery, stdLib, utils };
|
||||
|
@ -3,6 +3,18 @@ import insertCss from 'insert-css';
|
||||
import { IGraph } from '../../../types';
|
||||
import { Plugin as Base, IPluginBaseConfig } from '../../../types/plugin';
|
||||
|
||||
/**
|
||||
* @example
|
||||
* const {Graph} from '@antv/g6';
|
||||
* const toolbar:ToolbarConfig = {
|
||||
* type:"toolbar",
|
||||
* handleClick:()=>{}
|
||||
* }
|
||||
* new Graph({
|
||||
* plugins:[toolbar]
|
||||
* })
|
||||
*
|
||||
*/
|
||||
export interface ToolbarConfig extends IPluginBaseConfig {
|
||||
/**
|
||||
* toolbar config
|
||||
@ -12,8 +24,18 @@ export interface ToolbarConfig extends IPluginBaseConfig {
|
||||
*/
|
||||
handleClick?: (code: string, graph: IGraph) => void;
|
||||
getContent: (graph?: IGraph) => HTMLDivElement | string;
|
||||
/**
|
||||
* @default 10
|
||||
*/
|
||||
zoomSensitivity: number;
|
||||
/**
|
||||
* @default 0.00001
|
||||
*/
|
||||
minZoom: number;
|
||||
/**
|
||||
* 最小缩放比率
|
||||
* @default 1000
|
||||
*/
|
||||
maxZoom: number;
|
||||
}
|
||||
|
||||
|
@ -7,10 +7,10 @@ import {
|
||||
IItem,
|
||||
ItemShapeStyles,
|
||||
LabelBackground,
|
||||
ShapeAttrEncode,
|
||||
ShapesEncode,
|
||||
ShapeStyle,
|
||||
LodStrategy,
|
||||
ShapeAttrEncode,
|
||||
ShapeStyle,
|
||||
ShapesEncode,
|
||||
} from './item';
|
||||
|
||||
export interface EdgeUserModelData extends PlainObject {
|
||||
@ -139,5 +139,5 @@ export type ArrowStyle = PathStyleProps & {
|
||||
};
|
||||
|
||||
export interface EdgeRegistry {
|
||||
[key: string]: BaseEdge;
|
||||
[key: string]: typeof BaseEdge;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { DisplayObject, Point } from '@antv/g';
|
||||
import { DisplayObject } from '@antv/g';
|
||||
import { Node as GNode, ID, PlainObject } from '@antv/graphlib';
|
||||
import { BaseNode } from '../stdlib/item/node/base';
|
||||
import { BaseNode3D } from '../stdlib/item/node/base3d';
|
||||
@ -9,10 +9,10 @@ import {
|
||||
IBadgePosition,
|
||||
IItem,
|
||||
ItemShapeStyles,
|
||||
ShapeAttrEncode,
|
||||
ShapesEncode,
|
||||
ShapeStyle,
|
||||
LodStrategy,
|
||||
ShapeAttrEncode,
|
||||
ShapeStyle,
|
||||
ShapesEncode,
|
||||
} from './item';
|
||||
|
||||
export type NodeLabelPosition = 'bottom' | 'center' | 'top' | 'left' | 'right';
|
||||
@ -180,5 +180,5 @@ export interface IAnchorPositionMap {
|
||||
}
|
||||
|
||||
export interface NodeRegistry {
|
||||
[key: string]: BaseNode | BaseNode3D;
|
||||
[key: string]: typeof BaseNode | typeof BaseNode3D;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { each, deepMix } from '@antv/util';
|
||||
import { deepMix, each } from '@antv/util';
|
||||
import { IGraph } from './graph';
|
||||
|
||||
export interface IPluginBaseConfig {
|
||||
@ -77,5 +77,5 @@ export abstract class Plugin {
|
||||
}
|
||||
|
||||
export interface PluginRegistry {
|
||||
[key: string]: Plugin;
|
||||
[key: string]: typeof Plugin;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user