Skip to content

Commit

Permalink
🐛 fix(common): fix typing error
Browse files Browse the repository at this point in the history
  • Loading branch information
萌萌的老胖子 committed Mar 2, 2020
1 parent 03eb7d1 commit faf3266
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions packages/graphin-studio/package.json
Expand Up @@ -9,6 +9,7 @@
"deploy": "npm run build && gh-pages -d ./dist -r https://github.com/antvis/graphin-studio-site.git"
},
"dependencies": {
"@antv/g6": "^3.3.6",
"@antv/graphin": "^1.0.2",
"@antv/graphin-components": "^1.0.3",
"@types/classnames": "^2.2.9",
Expand Down
3 changes: 2 additions & 1 deletion packages/graphin-studio/src/Core/AddNodes/Normal.tsx
@@ -1,6 +1,7 @@
import React, { useState } from 'react';
import { Select, Input, Button } from 'antd';
import nodeTypes from '@service/Mock/nodeTypes';
import { GraphData } from '@antv/g6/lib/types';
import { Item } from '@com';
import service from '@service';
import { NormalProps, NormalState } from './interface';
Expand Down Expand Up @@ -29,7 +30,7 @@ const Normal: React.FC<NormalProps> = props => {
const ids = params.split(',');
const data = (await service.queryNodes(ids, type)) as NodeData[];
const preData = graph.save();
const { nodes, edges } = preData;
const { nodes, edges } = preData as GraphData;

dispatch({
type: 'graph/addNodes',
Expand Down
7 changes: 4 additions & 3 deletions packages/graphin-studio/src/Core/Styling/NodeColorPicker.tsx
@@ -1,5 +1,6 @@
import React, { useState } from 'react';
import { GraphNode } from '@antv/graphin';
import { GraphData, NodeConfig } from '@antv/g6/lib/types';
import { Node } from '@antv/graphin/dist/types';
import ColorPicker from './ColorPicker';
import Storage from '../../Service/Storage/index';
import { StylingProps } from './interface';
Expand Down Expand Up @@ -52,11 +53,11 @@ const NodeColorPicker: React.FC<StylingProps> = props => {
const matchBizType = newBizTypes.find(item => item.type === type);

const { graph, dispatch } = props;
const preData = graph.save();
const preData = graph.save() as GraphData;
const newNodes = preData.nodes.map(node => {
return {
...node,
style: node.data.type === type ? matchBizType.style : node.style,
style: ((node as unknown) as Node).data.type === type ? matchBizType.style : node.style,
};
});
const newData = {
Expand Down
2 changes: 1 addition & 1 deletion packages/graphin/package.json
@@ -1,6 +1,6 @@
{
"name": "@antv/graphin",
"version": "1.0.6-beta",
"version": "1.1.0",
"description": "the react toolkit for graph analysis based on g6",
"main": "./dist/index",
"types": "./dist/index.d",
Expand Down
4 changes: 2 additions & 2 deletions packages/graphin/src/layout/force/Elements.ts
Expand Up @@ -12,7 +12,7 @@ export class Node {

constructor(data: NodeType) {
this.id = data.id;
this.data = data || {};
this.data = data || ({} as NodeType);
this.x = data.x || 0;
this.y = data.y || 0;
}
Expand All @@ -31,6 +31,6 @@ export class Edge {
this.id = id;
this.source = source;
this.target = target;
this.data = data || {};
this.data = data || ({} as EdgeType);
}
}
2 changes: 1 addition & 1 deletion packages/graphin/src/layout/force/ForceLayout.ts
Expand Up @@ -77,7 +77,7 @@ interface Prop {
/** 力导结束后的回调函数 */
done?: () => void;
/** 忽略节点,不参加力导计算 */
ignore?: (node: NodeType) => void;
ignore?: (node: NodeType) => boolean;
}

interface IndexableProp extends Prop {
Expand Down

0 comments on commit faf3266

Please sign in to comment.