import { Typography } from "antd"
import React from "react"
import { copy } from "@/utils/utils"

interface Props {
    value?: string | number,
    isCopy?: boolean
}
/**
 * 表格溢出展示
 * @returns 
 */
const WidthEllipsis: React.FC<Props> = (props) => {

    /*********************************/
    const { value, isCopy } = props
    return <Typography.Text ellipsis={{ tooltip: true }} style={isCopy ? { color: '#1890ff' } : { color: 'inherit' }} onClick={() => { if(isCopy) copy((value || '') as any) }}>{value || '--'}</Typography.Text>
}

export default React.memo(WidthEllipsis)