import {Handle, type NodeProps, Position} from '@xyflow/react' import type {Schema} from 'amis' import {Card, Dropdown} from 'antd' import {DeleteFilled, EditFilled} from '@ant-design/icons' import {isEqual} from 'licia' export type AmisNodeType = 'normal' | 'start' | 'end' const AmisNode = ( props: NodeProps, type: AmisNodeType, name: String, description?: String, columnSchema?: Schema[], ) => { const {id, data} = props const {getDataById, removeNode, editNode} = data return (
, }, { key: 'remove', label: '删除', icon: , }, ], onClick: menu => { switch (menu.key) { case 'edit': // @ts-ignore editNode(id, name, description, columnSchema) break case 'remove': // @ts-ignore removeNode(id) break } }, }} >
{description}
{isEqual(type, 'start') || isEqual(type, 'normal') ? : undefined} {isEqual(type, 'end') || isEqual(type, 'normal') ? : undefined}
) } export default AmisNode