Skip to content

Commit

Permalink
fix: update graphin-component build problem
Browse files Browse the repository at this point in the history
  • Loading branch information
baizn committed Jan 20, 2021
1 parent 703cb4b commit ffac2ab
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
9 changes: 3 additions & 6 deletions packages/graphin-components/.fatherrc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
export default {
esm: {
type: 'rollup',
file: 'index',
},
lessInRollupMode: {},
extractCSS: true,
entry: './src/index.ts',
esm: 'babel',
cjs: 'babel',
};
2 changes: 1 addition & 1 deletion packages/graphin-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"types": "./dist/index.d.ts",
"scripts": {
"start": "father build --watch",
"build": "father build && npm run build:umd",
"build": "father build",
"build:umd": "node --max_old_space_size=8192 ./node_modules/webpack/bin/webpack.js --env.NODE_ENV=production -c ./webpack.config.js ",
"test": "jest"
},
Expand Down
9 changes: 5 additions & 4 deletions packages/graphin-components/src/CreateEdge/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// @ts-nocheck
import React from 'react';

import { GraphinContext } from '@antv/graphin';

interface Props {
onChange: {
(value: Graphin.Props['data']['edges']): void;
(value: any): void;
};
}
const CreateEdge: React.FunctionComponent<Props> = (props) => {
const CreateEdge: React.FunctionComponent<Props> = props => {
const { children } = props;
const [state, setState] = React.useState({
active: false,
Expand All @@ -18,13 +19,13 @@ const CreateEdge: React.FunctionComponent<Props> = (props) => {
const graphin = React.useContext(GraphinContext);
// @ts-ignore
const { graph } = graphin;
graph.on('aftercreateedge', (e) => {
graph.on('aftercreateedge', e => {
const { edges } = graph.save();
// TODO:边的处理,等G6拆包之后
// G6.Util.processParallelEdges(edges);
const newEdges = graph.getEdges();
newEdges.forEach((edge, i) => {
graph.updateItem(edge, edges[i]);
graph.updateItem(edge, (edges as any)[i]);
});
props.onChange && props.onChange(newEdges);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ const Demo = () => {
];
return (
<div className="App">
<Graphin data={Utils.mock(10).circle().graphin()}>
<Graphin
data={Utils.mock(10)
.circle()
.graphin()}
>
<Hull options={hullOptions} />
</Graphin>
</div>
Expand Down
7 changes: 5 additions & 2 deletions packages/graphin-components/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
"noImplicitAny": false,
"lib": ["dom", "esnext"],
"module": "esnext",
"esModuleInterop": true
"esModuleInterop": true,
"skipLibCheck": true,
"isolatedModules": false
},
"include": ["src","src/**/demo/*.tsx"]
"include": ["src"],
"exclude": ["src/**/demos/*.tsx"]
}

0 comments on commit ffac2ab

Please sign in to comment.