2024-06-05 10:46:06 +08:00
|
|
|
import classNames from 'classnames';
|
2024-04-28 19:03:54 +08:00
|
|
|
import { Handle, NodeProps, Position } from 'reactflow';
|
|
|
|
|
|
2024-06-11 18:01:19 +08:00
|
|
|
import { Space } from 'antd';
|
|
|
|
|
import { Operator } from '../../constant';
|
|
|
|
|
import OperatorIcon from '../../operator-icon';
|
2024-04-28 19:03:54 +08:00
|
|
|
import styles from './index.less';
|
|
|
|
|
|
|
|
|
|
export function TextUpdaterNode({
|
|
|
|
|
data,
|
|
|
|
|
isConnectable = true,
|
2024-06-05 10:46:06 +08:00
|
|
|
selected,
|
2024-05-27 08:21:30 +08:00
|
|
|
}: NodeProps<{ label: string }>) {
|
2024-04-28 19:03:54 +08:00
|
|
|
return (
|
2024-06-11 18:01:19 +08:00
|
|
|
<section
|
2024-06-05 10:46:06 +08:00
|
|
|
className={classNames(styles.textUpdaterNode, {
|
|
|
|
|
[styles.selectedNode]: selected,
|
|
|
|
|
})}
|
|
|
|
|
>
|
2024-04-28 19:03:54 +08:00
|
|
|
<Handle
|
|
|
|
|
type="target"
|
2024-05-27 08:21:30 +08:00
|
|
|
position={Position.Left}
|
2024-04-28 19:03:54 +08:00
|
|
|
isConnectable={isConnectable}
|
2024-06-05 10:46:06 +08:00
|
|
|
className={styles.handle}
|
|
|
|
|
>
|
|
|
|
|
{/* <PlusCircleOutlined style={{ fontSize: 10 }} /> */}
|
|
|
|
|
</Handle>
|
2024-04-28 19:03:54 +08:00
|
|
|
<Handle
|
|
|
|
|
type="source"
|
2024-05-27 08:21:30 +08:00
|
|
|
position={Position.Right}
|
2024-04-28 19:03:54 +08:00
|
|
|
isConnectable={isConnectable}
|
2024-06-05 10:46:06 +08:00
|
|
|
className={styles.handle}
|
|
|
|
|
>
|
|
|
|
|
{/* <PlusCircleOutlined style={{ fontSize: 10 }} /> */}
|
|
|
|
|
</Handle>
|
2024-06-11 18:01:19 +08:00
|
|
|
<div>
|
|
|
|
|
<Space>
|
|
|
|
|
<OperatorIcon
|
|
|
|
|
name={data.label as Operator}
|
|
|
|
|
fontSize={12}
|
|
|
|
|
></OperatorIcon>
|
|
|
|
|
{data.label}
|
|
|
|
|
</Space>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
2024-04-28 19:03:54 +08:00
|
|
|
);
|
|
|
|
|
}
|