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

Add notFountContent for transfer, close #1142

上级 dea88ba3
...@@ -44,6 +44,7 @@ const App = React.createClass({ ...@@ -44,6 +44,7 @@ const App = React.createClass({
<Transfer <Transfer
dataSource={this.state.mockData} dataSource={this.state.mockData}
showSearch showSearch
notFoundContent="xxxxxx"
targetKeys={this.state.targetKeys} targetKeys={this.state.targetKeys}
onChange={this.handleChange} onChange={this.handleChange}
render={item => item.title} /> render={item => item.title} />
......
...@@ -147,7 +147,7 @@ class Transfer extends Component { ...@@ -147,7 +147,7 @@ class Transfer extends Component {
render() { render() {
const { const {
prefixCls, titles, operations, showSearch, prefixCls, titles, operations, showSearch, notFoundContent,
searchPlaceholder, body, footer, listStyle, className, searchPlaceholder, body, footer, listStyle, className,
} = this.props; } = this.props;
const { leftFilter, rightFilter, leftCheckedKeys, rightCheckedKeys } = this.state; const { leftFilter, rightFilter, leftCheckedKeys, rightCheckedKeys } = this.state;
...@@ -180,6 +180,7 @@ class Transfer extends Component { ...@@ -180,6 +180,7 @@ class Transfer extends Component {
render={this.props.render} render={this.props.render}
showSearch={showSearch} showSearch={showSearch}
searchPlaceholder={searchPlaceholder} searchPlaceholder={searchPlaceholder}
notFoundContent={notFoundContent}
body={body} body={body}
footer={footer} footer={footer}
prefixCls={`${prefixCls}-list`} /> prefixCls={`${prefixCls}-list`} />
...@@ -204,6 +205,7 @@ class Transfer extends Component { ...@@ -204,6 +205,7 @@ class Transfer extends Component {
render={this.props.render} render={this.props.render}
showSearch={showSearch} showSearch={showSearch}
searchPlaceholder={searchPlaceholder} searchPlaceholder={searchPlaceholder}
notFoundContent={notFoundContent}
body={body} body={body}
footer={footer} footer={footer}
prefixCls={`${prefixCls}-list`} /> prefixCls={`${prefixCls}-list`} />
...@@ -222,7 +224,7 @@ Transfer.defaultProps = { ...@@ -222,7 +224,7 @@ Transfer.defaultProps = {
operations: [], operations: [],
showSearch: false, showSearch: false,
searchPlaceholder: '请输入搜索内容', searchPlaceholder: '请输入搜索内容',
notFoundContent: '请输入搜索内容', notFoundContent: 'Not Found',
body: noop, body: noop,
footer: noop, footer: noop,
}; };
...@@ -240,6 +242,7 @@ Transfer.propTypes = { ...@@ -240,6 +242,7 @@ Transfer.propTypes = {
operations: PropTypes.array, operations: PropTypes.array,
showSearch: PropTypes.bool, showSearch: PropTypes.bool,
searchPlaceholder: PropTypes.string, searchPlaceholder: PropTypes.string,
notFoundContent: PropTypes.node,
body: PropTypes.func, body: PropTypes.func,
footer: PropTypes.func, footer: PropTypes.func,
}; };
......
...@@ -28,4 +28,5 @@ ...@@ -28,4 +28,5 @@
| operations | 操作文案集合,顺序从上至下 | Array | [] | | operations | 操作文案集合,顺序从上至下 | Array | [] |
| showSearch | 是否显示搜索框 | Boolean | false | | showSearch | 是否显示搜索框 | Boolean | false |
| searchPlaceholder | 搜索框的默认值 | String | 请输入搜索的内容 | | searchPlaceholder | 搜索框的默认值 | String | 请输入搜索的内容 |
| notFoundContent | 当列表为空时显示的内容 | React.node | 'Not Found' |
| footer | 底部渲染函数 | Function(props) | | | | footer | 底部渲染函数 | Function(props) | | |
...@@ -69,7 +69,7 @@ class TransferList extends Component { ...@@ -69,7 +69,7 @@ class TransferList extends Component {
} }
render() { render() {
const { prefixCls, dataSource, titleText, filter, checkedKeys, const { prefixCls, dataSource, titleText, filter, checkedKeys, notFoundContent,
checkStatus, body, footer, showSearch, searchPlaceholder } = this.props; checkStatus, body, footer, showSearch, searchPlaceholder } = this.props;
// Custom Layout // Custom Layout
...@@ -118,7 +118,7 @@ class TransferList extends Component { ...@@ -118,7 +118,7 @@ class TransferList extends Component {
<Animate component="ul" <Animate component="ul"
transitionName={this.state.mounted ? `${prefixCls}-highlight` : ''} transitionName={this.state.mounted ? `${prefixCls}-highlight` : ''}
transitionLeave={false}> 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> </Animate>
</div>} </div>}
{ footerDom ? <div className={`${prefixCls}-footer`}> { footerDom ? <div className={`${prefixCls}-footer`}>
......
...@@ -66,9 +66,10 @@ ...@@ -66,9 +66,10 @@
} }
&-not-found { &-not-found {
margin-top: 24px; padding-top: 24px;
color: #ccc; color: #ccc;
text-align: center; text-align: center;
height: 100%;
} }
ul { ul {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册