import { Statistic, StatisticProps } from "antd"
import React from "react"

interface Props extends Omit<StatisticProps, 'value'> {
    data: any
    field: string
}

const StatisticNull: React.FC<Props> = ({ field, data, ...props }) => {
    if (data?.[field] !== undefined && data?.[field] !== null) {
        return <Statistic value={data?.[field] || 0} {...props}/>
    } else {
        return <span>--</span>
    }
}

export default React.memo(StatisticNull)