import React from 'react' import type { NsGraph } from '@antv/xflow' import type { EntityCanvasModel, EntityProperty } from '../interface' import { BarsOutlined, DeleteOutlined } from '@ant-design/icons' import { EntityType } from '../const' import './Entity.less' interface OwnProps { deleteNode: Function } type Props = OwnProps & NsGraph.IReactNodeProps const Entity = (props: Props) => { const entity: EntityCanvasModel = props?.data const getCls = () => { if (entity?.entityType === EntityType.FACT) { return 'fact' } if (entity?.entityType === EntityType.DIM) { return 'dim' } if (entity?.entityType === EntityType.OTHER) { return 'other' } return '' } return (
{entity?.entityName}
props.deleteNode(entity?.id)}>
{entity?.properties?.map((property: EntityProperty) => { return (
{property?.isPK && PK} {property?.isFK && FK} {property?.propertyName}
{property.propertyType}
) })}
) } export default Entity