Skip to content

Commit

Permalink
fix: types (#776)
Browse files Browse the repository at this point in the history
  • Loading branch information
lxfu1 authored Jul 27, 2021
1 parent 65aab26 commit 2151699
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
25 changes: 22 additions & 3 deletions src/graphs/flowAnalysisGraph/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,29 @@ import {
defaultNodeStyle,
} from '../constants';
import { registerIndicatorCardNode } from './customItem';
import { CommonConfig, EdgeConfig, NodeConfig, CardNodeCfg, FlowGraphDatum } from '../interface';
import {
CommonConfig,
EdgeConfig,
NodeConfig,
CardNodeCfg,
FlowGraphEdgeData,
NodeData,
CardItems,
} from '../interface';

export interface FlowAnalysisNodeData
extends NodeData<
Array<{
title?: string;
items?: CardItems;
}>
> {}

export interface FlowAnalysisGraphConfig extends Omit<CommonConfig, 'data'> {
data: FlowGraphDatum;
data: {
nodes: FlowAnalysisNodeData[];
edges: FlowGraphEdgeData[];
};
}

const graphs: any = {};
Expand Down Expand Up @@ -177,7 +196,7 @@ const FlowAnalysisGraph: React.FC<FlowAnalysisGraphConfig> = (props) => {
processMinimap(minimapCfg, graph);
bindStateEvents(graph, uProps as FlowAnalysisGraphConfig);
if (markerCfg) {
bindSourceMapCollapseEvents(graph, data as FlowGraphDatum);
bindSourceMapCollapseEvents(graph, data as FlowAnalysisGraphConfig['data']);
}
renderGraph(graph, data);
if (onReady) {
Expand Down
7 changes: 6 additions & 1 deletion src/graphs/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
} from './interface';
import { defaultMinimapCfg, defaultNodeSize, defaultCardStyle } from './constants';
import { FundFlowGraphConfig } from './fundFlowGraph';
import { FlowAnalysisGraphConfig } from './flowAnalysisGraph';

export const getGraphSize = (
width: number | undefined,
Expand Down Expand Up @@ -131,7 +132,11 @@ export const getMarkerPosition = (direction: string = 'right', size: number[]) =
type CollapsedNode = NodeData<unknown> & { collapsedLevel: number };
export const bindSourceMapCollapseEvents = (
graph: IGraph,
fullData: FundFlowGraphConfig['data'] | FlowGraphDatum | undefined,
fullData:
| FundFlowGraphConfig['data']
| FlowAnalysisGraphConfig['data']
| FlowGraphDatum
| undefined,
) => {
const controlData = deepClone(fullData);
const onClick = (e: IG6GraphEvent) => {
Expand Down

0 comments on commit 2151699

Please sign in to comment.