mirror of
https://github.com/projectstorm/react-diagrams.git
synced 2025-08-19 03:33:57 +08:00
33 lines
634 B
TypeScript
33 lines
634 B
TypeScript
import * as React from "react";
|
|
|
|
export interface TrayItemWidgetProps {
|
|
model: any;
|
|
color?: string;
|
|
name: string;
|
|
}
|
|
|
|
export interface TrayItemWidgetState {
|
|
}
|
|
|
|
export class TrayItemWidget extends React.Component<TrayItemWidgetProps, TrayItemWidgetState> {
|
|
|
|
constructor(props: TrayItemWidgetProps) {
|
|
super(props);
|
|
this.state = {}
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<div
|
|
style={{borderColor: this.props.color}}
|
|
draggable={true}
|
|
onDragStart={(event) => {
|
|
event.dataTransfer.setData("storm-diagram-node", JSON.stringify(this.props.model));
|
|
}}
|
|
className="tray-item"
|
|
>
|
|
{this.props.name}
|
|
</div>
|
|
);
|
|
}
|
|
} |