import classNames from 'classnames'; import * as React from 'react'; import { ConfigContext } from '../config-provider'; import LocaleReceiver from '../locale-provider/LocaleReceiver'; import DefaultEmptyImg from './empty'; import SimpleEmptyImg from './simple'; const defaultEmptyImg = ; const simpleEmptyImg = ; export interface TransferLocale { description: string; } export interface EmptyProps { prefixCls?: string; className?: string; style?: React.CSSProperties; /** @since 3.16.0 */ imageStyle?: React.CSSProperties; image?: React.ReactNode; description?: React.ReactNode; children?: React.ReactNode; } interface EmptyType extends React.FC { PRESENTED_IMAGE_DEFAULT: React.ReactNode; PRESENTED_IMAGE_SIMPLE: React.ReactNode; } const Empty: EmptyType = ({ className, prefixCls: customizePrefixCls, image = defaultEmptyImg, description, children, imageStyle, ...restProps }) => { const { getPrefixCls, direction } = React.useContext(ConfigContext); return ( {contextLocale => { const prefixCls = getPrefixCls('empty', customizePrefixCls); const des = typeof description !== 'undefined' ? description : contextLocale.description; const alt = typeof des === 'string' ? des : 'empty'; let imageNode: React.ReactNode = null; if (typeof image === 'string') { imageNode = {alt}; } else { imageNode = image; } return (
{imageNode}
{des &&
{des}
} {children &&
{children}
}
); }}
); }; Empty.PRESENTED_IMAGE_DEFAULT = defaultEmptyImg; Empty.PRESENTED_IMAGE_SIMPLE = simpleEmptyImg; export default Empty;