-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
/
Copy pathrenderEmpty.tsx
37 lines (30 loc) · 1004 Bytes
/
renderEmpty.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import Empty from '../empty';
import type { VueNode } from '../_util/type';
import useConfigInject from '../_util/hooks/useConfigInject';
export interface RenderEmptyProps {
componentName?: string;
}
const RenderEmpty = (props: RenderEmptyProps) => {
const { prefixCls } = useConfigInject('empty', props);
const renderHtml = (componentName?: string) => {
switch (componentName) {
case 'Table':
case 'List':
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;
case 'Select':
case 'TreeSelect':
case 'Cascader':
case 'Transfer':
case 'Mentions':
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} class={`${prefixCls.value}-small`} />;
default:
return <Empty />;
}
};
return renderHtml(props.componentName);
};
function renderEmpty(componentName?: string): VueNode {
return <RenderEmpty componentName={componentName} />;
}
export type RenderEmptyHandler = typeof renderEmpty;
export default renderEmpty;