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