2019-03-08 13:48:55 +08:00
|
|
|
import PropTypes from '../_util/vue-types';
|
|
|
|
import Empty from '../empty';
|
2019-09-05 22:18:27 +08:00
|
|
|
import { ConfigConsumerProps } from './';
|
2019-03-08 13:48:55 +08:00
|
|
|
|
2019-03-15 10:04:14 +08:00
|
|
|
const RenderEmpty = {
|
2019-03-08 13:48:55 +08:00
|
|
|
functional: true,
|
2019-03-15 10:04:14 +08:00
|
|
|
inject: {
|
2019-09-11 22:35:25 +08:00
|
|
|
configProvider: { default: () => ConfigConsumerProps },
|
2019-03-15 10:04:14 +08:00
|
|
|
},
|
2019-03-08 13:48:55 +08:00
|
|
|
props: {
|
|
|
|
componentName: PropTypes.string,
|
|
|
|
},
|
|
|
|
render(createElement, context) {
|
|
|
|
const { props, injections } = context;
|
|
|
|
function renderHtml(componentName) {
|
2019-09-11 22:35:25 +08:00
|
|
|
const getPrefixCls = injections.configProvider.getPrefixCls;
|
2019-03-15 10:04:14 +08:00
|
|
|
const prefix = getPrefixCls('empty');
|
2019-03-08 13:48:55 +08:00
|
|
|
switch (componentName) {
|
|
|
|
case 'Table':
|
|
|
|
case 'List':
|
2020-03-07 19:45:13 +08:00
|
|
|
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;
|
2019-03-08 13:48:55 +08:00
|
|
|
|
|
|
|
case 'Select':
|
|
|
|
case 'TreeSelect':
|
|
|
|
case 'Cascader':
|
|
|
|
case 'Transfer':
|
2020-03-07 19:45:13 +08:00
|
|
|
case 'Mentions':
|
|
|
|
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} class={`${prefix}-small`} />;
|
2019-03-08 13:48:55 +08:00
|
|
|
|
|
|
|
default:
|
|
|
|
return <Empty />;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return renderHtml(props.componentName);
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2019-03-15 10:04:14 +08:00
|
|
|
function renderEmpty(h, componentName) {
|
|
|
|
return <RenderEmpty componentName={componentName} />;
|
|
|
|
}
|
|
|
|
|
2019-03-08 13:48:55 +08:00
|
|
|
export default renderEmpty;
|