提交 400b7b8a 编写于 作者: A afc163

Add notFountContent for transfer, close #1142

上级 dea88ba3
......@@ -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 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册