Skip to content

Commit

Permalink
feat: click edge event
Browse files Browse the repository at this point in the history
  • Loading branch information
noonnightstorm committed Oct 29, 2021
1 parent 8689c27 commit 28fe704
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions example/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ class Com extends React.Component {
mappingData={mappingData1}
width={600}
height={600}
onEdgeClick={(data) => {
console.log(data);
}}
/>
</Col>
<Col flex={'600px'}>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-data-mapping",
"version": "1.3.0",
"version": "1.3.1",
"description": "数据/字段映射React组件",
"main": "dist/index.js",
"pack": "pack/index.js",
Expand Down
5 changes: 5 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ interface ComProps {
onChange(data: any): void,
onRowMouseOver?(row:any):void,
onRowMouseOut?(row:any):void,
onEdgeClick?(edge: any): void,
};

export default class DataMapping extends React.Component<ComProps, any> {
Expand Down Expand Up @@ -366,6 +367,10 @@ export default class DataMapping extends React.Component<ComProps, any> {
this.onChange();
});
});

this.canvas.on('system.link.click', (data?: any) => {
this.props.onEdgeClick && this.props.onEdgeClick((data || {}).edge);
})
}
render() {
return (
Expand Down

0 comments on commit 28fe704

Please sign in to comment.