You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
983 B
35 lines
983 B
6 years ago
|
import * as React from 'react';
|
||
|
import Empty from '../empty';
|
||
3 years ago
|
import type { ConfigConsumerProps } from '.';
|
||
|
import { ConfigConsumer } from '.';
|
||
6 years ago
|
|
||
3 years ago
|
const defaultRenderEmpty = (componentName?: string): React.ReactNode => (
|
||
6 years ago
|
<ConfigConsumer>
|
||
|
{({ getPrefixCls }: ConfigConsumerProps) => {
|
||
|
const prefix = getPrefixCls('empty');
|
||
|
|
||
|
switch (componentName) {
|
||
|
case 'Table':
|
||
|
case 'List':
|
||
6 years ago
|
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;
|
||
6 years ago
|
|
||
|
case 'Select':
|
||
|
case 'TreeSelect':
|
||
|
case 'Cascader':
|
||
|
case 'Transfer':
|
||
6 years ago
|
case 'Mentions':
|
||
6 years ago
|
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} className={`${prefix}-small`} />;
|
||
3 years ago
|
|
||
|
/* istanbul ignore next */
|
||
6 years ago
|
default:
|
||
3 years ago
|
// Should never hit if we take all the component into consider.
|
||
6 years ago
|
return <Empty />;
|
||
|
}
|
||
|
}}
|
||
|
</ConfigConsumer>
|
||
|
);
|
||
|
|
||
3 years ago
|
export type RenderEmptyHandler = typeof defaultRenderEmpty;
|
||
6 years ago
|
|
||
3 years ago
|
export default defaultRenderEmpty;
|