mirror of
https://github.com/projectstorm/react-diagrams.git
synced 2025-08-14 16:51:29 +08:00
32 lines
634 B
TypeScript
32 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>
|
|
);
|
|
}
|
|
}
|