Skip to content

Commit

Permalink
fix: update entry file
Browse files Browse the repository at this point in the history
  • Loading branch information
baizn committed Jan 20, 2021
1 parent 3841692 commit edc5c6e
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 47 deletions.
2 changes: 1 addition & 1 deletion packages/graphin-graphscope/.fatherrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default {
entry: './src/index.tsx',
entry: './src/index.ts',
esm: 'babel',
cjs: 'babel',
};
3 changes: 1 addition & 2 deletions packages/graphin-graphscope/docs/demo/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react';
import GraphScopeComponent from '@antv/graphin-graphscope';
import { GraphScopeComponent } from '@antv/graphin-graphscope';
import { Utils } from '@antv/graphin';

const originData = Utils.mock(5)
Expand All @@ -17,7 +17,6 @@ export default () => {
const domRef = React.useRef(null);

const queryNeighbors = (nodeId: string, degree: number) => {
debugger;
const model = data.nodes.filter(node => node.id === nodeId);
const newData = Utils.mock(3)
.expand(model)
Expand Down
13 changes: 7 additions & 6 deletions packages/graphin-graphscope/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@antv/graphin-graphscope",
"version": "0.0.1",
"version": "0.0.3",
"description": "An Example for GraphScope",
"main": "src/index.tsx",
"main": "es/index.js",
"scripts": {
"start": " node --max_old_space_size=8192 ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --hot --env.NODE_ENV=development",
"build": "npm run clean && father build",
Expand All @@ -29,7 +29,7 @@
"babel-loader": "^8.0.6",
"babel-plugin-import": "^1.13.0",
"css-loader": "^3.2.0",
"father": "^2.30.1",
"father": "^2.23.1",
"file-loader": "^4.2.0",
"gh-pages": "^2.1.1",
"less": "^3.10.3",
Expand All @@ -43,9 +43,10 @@
"typescript": "^3.6.4"
},
"keywords": [
"example",
"graphene"
"Graphin",
"G6",
"AntV Graph"
],
"author": "Ant Financial",
"author": "AntV",
"license": "MIT"
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const defaultLayout = {
type: 'concentric',
},
animation: true,
defSpringLen: (_edge, source, target) => {
defSpringLen: (_edge: any, source: any, target: any) => {
/** 默认返回的是 200 的弹簧长度 */
/** 如果你要想要产生聚类的效果,可以考虑 根据边两边节点的度数来动态设置边的初始化长度:度数越小,则边越短 */

Expand Down Expand Up @@ -90,7 +90,7 @@ const layouts = [
alpha: 0.9, // 可选
alphaDecay: 0.3, // 可选
alphaMin: 0.01, // 可选
forceSimulation: null, // 可选
// forceSimulation: null, // 可选
onTick: () => {
// 可选
console.log('ticking');
Expand Down Expand Up @@ -175,7 +175,7 @@ interface IGraphProps {
nodeLabel?: string;
}

let refreshData = null;
let refreshData: any = null;

const GraphScope: React.FC<IGraphProps> = ({
data,
Expand All @@ -192,8 +192,8 @@ const GraphScope: React.FC<IGraphProps> = ({
data: {},
});

const transGraphData = data => {
const nodes = data.nodes.map((node, index) => {
const transGraphData = (data: any) => {
const nodes = data.nodes.map((node: any, index: number) => {
const primaryColor = colorSets[index > 10 ? 0 : index].mainFill;
// clusterColorMap.set(node.id, primaryColor);

Expand Down Expand Up @@ -241,12 +241,11 @@ const GraphScope: React.FC<IGraphProps> = ({
return nodes;
});

const edges = data.edges.map(edge => {
const size = Math.log(edge.count) || 0.5;
const edges = data.edges.map((edge: any) => {
return {
...edge,
label: '',
size: size > 0.5 ? size : 0.5,
size: 0.5,
color: '#AAB7C4', // '#545872',
style: {
endArrow: {
Expand Down Expand Up @@ -312,7 +311,7 @@ const GraphScope: React.FC<IGraphProps> = ({
neighbors(nodeId, degree);
};

const handleChangeLayout = value => {
const handleChangeLayout = (value: string) => {
const currentLayout = layouts.find(item => item.type === value);
setState(preState => {
return {
Expand Down
1 change: 1 addition & 0 deletions packages/graphin-graphscope/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as GraphScopeComponent } from './graph';
1 change: 1 addition & 0 deletions packages/graphin-graphscope/src/layoutSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ts-nocheck
import React from 'react';
import { Select } from 'antd'; // 引入Graphin CSS
import {
Expand Down
49 changes: 20 additions & 29 deletions packages/graphin-graphscope/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"strictNullChecks": false,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"sourceMap": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"downlevelIteration": true,
"noImplicitAny": false,
"jsx": "react",
"baseUrl": "./",
"paths": {
"@types": ["src/types.ts"],
"@service": ["src/Service/index.ts"],
"@service/*": ["src/Service/*"],
"@utils/*": ["src/Utils/*"],
"@com": ["src/Components/index.ts"],
"@com/*": ["src/Components/*"]
}
},
"include": ["src"]
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"allowJs": false,
"target": "es2015",
"moduleResolution": "node",
"jsx": "react",
"resolveJsonModule": true,
"strict": true,
"noImplicitAny": true,
"lib": ["dom", "esnext"],
"declaration": true,
"esModuleInterop": true,
"strictNullChecks": false,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"sourceMap": true,
"isolatedModules": true,
"downlevelIteration": true
},
"include": ["src"]
}

0 comments on commit edc5c6e

Please sign in to comment.