mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
Add notFountContent for transfer, close #1142
This commit is contained in:
parent
dea88ba37e
commit
400b7b8a27
@ -44,6 +44,7 @@ const App = React.createClass({
|
||||
<Transfer
|
||||
dataSource={this.state.mockData}
|
||||
showSearch
|
||||
notFoundContent="xxxxxx"
|
||||
targetKeys={this.state.targetKeys}
|
||||
onChange={this.handleChange}
|
||||
render={item => item.title} />
|
||||
|
@ -147,7 +147,7 @@ class Transfer extends Component {
|
||||
|
||||
render() {
|
||||
const {
|
||||
prefixCls, titles, operations, showSearch,
|
||||
prefixCls, titles, operations, showSearch, notFoundContent,
|
||||
searchPlaceholder, body, footer, listStyle, className,
|
||||
} = this.props;
|
||||
const { leftFilter, rightFilter, leftCheckedKeys, rightCheckedKeys } = this.state;
|
||||
@ -180,6 +180,7 @@ class Transfer extends Component {
|
||||
render={this.props.render}
|
||||
showSearch={showSearch}
|
||||
searchPlaceholder={searchPlaceholder}
|
||||
notFoundContent={notFoundContent}
|
||||
body={body}
|
||||
footer={footer}
|
||||
prefixCls={`${prefixCls}-list`} />
|
||||
@ -204,6 +205,7 @@ class Transfer extends Component {
|
||||
render={this.props.render}
|
||||
showSearch={showSearch}
|
||||
searchPlaceholder={searchPlaceholder}
|
||||
notFoundContent={notFoundContent}
|
||||
body={body}
|
||||
footer={footer}
|
||||
prefixCls={`${prefixCls}-list`} />
|
||||
@ -222,7 +224,7 @@ Transfer.defaultProps = {
|
||||
operations: [],
|
||||
showSearch: false,
|
||||
searchPlaceholder: '请输入搜索内容',
|
||||
notFoundContent: '请输入搜索内容',
|
||||
notFoundContent: 'Not Found',
|
||||
body: noop,
|
||||
footer: noop,
|
||||
};
|
||||
@ -240,6 +242,7 @@ Transfer.propTypes = {
|
||||
operations: PropTypes.array,
|
||||
showSearch: PropTypes.bool,
|
||||
searchPlaceholder: PropTypes.string,
|
||||
notFoundContent: PropTypes.node,
|
||||
body: PropTypes.func,
|
||||
footer: PropTypes.func,
|
||||
};
|
||||
|
@ -28,4 +28,5 @@
|
||||
| operations | 操作文案集合,顺序从上至下 | Array | [] |
|
||||
| showSearch | 是否显示搜索框 | Boolean | false |
|
||||
| searchPlaceholder | 搜索框的默认值 | String | 请输入搜索的内容 |
|
||||
| notFoundContent | 当列表为空时显示的内容 | React.node | 'Not Found' |
|
||||
| footer | 底部渲染函数 | Function(props) | | |
|
||||
|
@ -69,7 +69,7 @@ class TransferList extends Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { prefixCls, dataSource, titleText, filter, checkedKeys,
|
||||
const { prefixCls, dataSource, titleText, filter, checkedKeys, notFoundContent,
|
||||
checkStatus, body, footer, showSearch, searchPlaceholder } = this.props;
|
||||
|
||||
// Custom Layout
|
||||
@ -118,7 +118,7 @@ class TransferList extends Component {
|
||||
<Animate component="ul"
|
||||
transitionName={this.state.mounted ? `${prefixCls}-highlight` : ''}
|
||||
transitionLeave={false}>
|
||||
{showItems.length > 0 ? showItems : <div className={`${prefixCls}-body-not-found`}>Not Found</div>}
|
||||
{showItems.length > 0 ? showItems : <div className={`${prefixCls}-body-not-found`}>{notFoundContent}</div>}
|
||||
</Animate>
|
||||
</div>}
|
||||
{ footerDom ? <div className={`${prefixCls}-footer`}>
|
||||
|
@ -66,9 +66,10 @@
|
||||
}
|
||||
|
||||
&-not-found {
|
||||
margin-top: 24px;
|
||||
padding-top: 24px;
|
||||
color: #ccc;
|
||||
text-align: center;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
ul {
|
||||
|
Loading…
Reference in New Issue
Block a user