mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-03 04:30:06 +08:00
add box width
This commit is contained in:
parent
a7f010dd36
commit
24975d1d15
@ -144,7 +144,7 @@ class Transfer extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { prefixCls, titles, operations, showSearch, searchPlaceholder, body, footer } = this.props;
|
const { prefixCls, titles, operations, showSearch, searchPlaceholder, body, footer, boxWidth } = this.props;
|
||||||
const { leftFilter, rightFilter, leftCheckedKeys, rightCheckedKeys } = this.state;
|
const { leftFilter, rightFilter, leftCheckedKeys, rightCheckedKeys } = this.state;
|
||||||
|
|
||||||
const { leftDataSource, rightDataSource } = this.splitDataSource();
|
const { leftDataSource, rightDataSource } = this.splitDataSource();
|
||||||
@ -158,6 +158,7 @@ class Transfer extends Component {
|
|||||||
<List title={titles[0]}
|
<List title={titles[0]}
|
||||||
dataSource={leftDataSource}
|
dataSource={leftDataSource}
|
||||||
filter={leftFilter}
|
filter={leftFilter}
|
||||||
|
width={boxWidth}
|
||||||
checkedKeys={leftCheckedKeys}
|
checkedKeys={leftCheckedKeys}
|
||||||
checkStatus={leftCheckStatus}
|
checkStatus={leftCheckStatus}
|
||||||
handleFilter={this.handleFilter.bind(this, 'left')}
|
handleFilter={this.handleFilter.bind(this, 'left')}
|
||||||
@ -176,6 +177,7 @@ class Transfer extends Component {
|
|||||||
<List title={titles[1]}
|
<List title={titles[1]}
|
||||||
dataSource={rightDataSource}
|
dataSource={rightDataSource}
|
||||||
filter={rightFilter}
|
filter={rightFilter}
|
||||||
|
width={boxWidth}
|
||||||
checkedKeys={rightCheckedKeys}
|
checkedKeys={rightCheckedKeys}
|
||||||
checkStatus={rightCheckStatus}
|
checkStatus={rightCheckStatus}
|
||||||
handleFilter={this.handleFilter.bind(this, 'right')}
|
handleFilter={this.handleFilter.bind(this, 'right')}
|
||||||
@ -199,6 +201,7 @@ Transfer.defaultProps = {
|
|||||||
render: noop,
|
render: noop,
|
||||||
targetKeys: [],
|
targetKeys: [],
|
||||||
onChange: noop,
|
onChange: noop,
|
||||||
|
boxWidth: 160,
|
||||||
titles: ['源列表', '目的列表'],
|
titles: ['源列表', '目的列表'],
|
||||||
operations: [],
|
operations: [],
|
||||||
showSearch: false,
|
showSearch: false,
|
||||||
@ -213,6 +216,7 @@ Transfer.propTypes = {
|
|||||||
render: PropTypes.func,
|
render: PropTypes.func,
|
||||||
targetKeys: PropTypes.array,
|
targetKeys: PropTypes.array,
|
||||||
onChange: PropTypes.func,
|
onChange: PropTypes.func,
|
||||||
|
boxWidth: PropTypes.number,
|
||||||
titles: PropTypes.array,
|
titles: PropTypes.array,
|
||||||
operations: PropTypes.array,
|
operations: PropTypes.array,
|
||||||
showSearch: PropTypes.bool,
|
showSearch: PropTypes.bool,
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
| render | 渲染每行数据 | Function(record) | false |
|
| render | 渲染每行数据 | Function(record) | false |
|
||||||
| targetKeys | 显示在右侧框的数据 | Array | [] |
|
| targetKeys | 显示在右侧框的数据 | Array | [] |
|
||||||
| onChange | 变化时回调函数 | Function(e:Event) | |
|
| onChange | 变化时回调函数 | Function(e:Event) | |
|
||||||
|
| boxWidth | 单个穿梭框的宽度 | Number | 160 |
|
||||||
| titles | 标题集合,顺序从左至右 | Array | ['源列表', '目的列表'] |
|
| titles | 标题集合,顺序从左至右 | Array | ['源列表', '目的列表'] |
|
||||||
| operations | 操作文案集合,顺序从上至下 | Array | [] |
|
| operations | 操作文案集合,顺序从上至下 | Array | [] |
|
||||||
| showSearch | 是否显示搜索框 | Boolean | false |
|
| showSearch | 是否显示搜索框 | Boolean | false |
|
||||||
|
@ -57,13 +57,13 @@ class TransferList extends Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
let self = this;
|
let self = this;
|
||||||
const { prefixCls, dataSource, title, filter, checkedKeys, checkStatus, body, footer, showSearch } = this.props;
|
const { prefixCls, dataSource, title, filter, width, checkedKeys, checkStatus, body, footer, showSearch } = this.props;
|
||||||
|
|
||||||
// Custom Layout
|
// Custom Layout
|
||||||
const footerDom = footer({...this.props});
|
const footerDom = footer({...this.props});
|
||||||
const bodyDom = body({...this.props});
|
const bodyDom = body({...this.props});
|
||||||
|
|
||||||
return (<div className={prefixCls} {...this.props}>
|
return (<div className={prefixCls} {...this.props} style={{width: width}}>
|
||||||
<div className={`${prefixCls}-header`}>
|
<div className={`${prefixCls}-header`}>
|
||||||
{this.renderCheckbox({
|
{this.renderCheckbox({
|
||||||
prefixCls: 'ant-tree',
|
prefixCls: 'ant-tree',
|
||||||
@ -109,6 +109,7 @@ TransferList.defaultProps = {
|
|||||||
dataSource: [],
|
dataSource: [],
|
||||||
showSearch: false,
|
showSearch: false,
|
||||||
searchPlaceholder: '',
|
searchPlaceholder: '',
|
||||||
|
width: 160,
|
||||||
handleFilter: noop,
|
handleFilter: noop,
|
||||||
handleSelect: noop,
|
handleSelect: noop,
|
||||||
handleSelectAll: noop,
|
handleSelectAll: noop,
|
||||||
@ -123,6 +124,7 @@ TransferList.propTypes = {
|
|||||||
dataSource: PropTypes.array,
|
dataSource: PropTypes.array,
|
||||||
showSearch: PropTypes.bool,
|
showSearch: PropTypes.bool,
|
||||||
searchPlaceholder: PropTypes.string,
|
searchPlaceholder: PropTypes.string,
|
||||||
|
width: PropTypes.number,
|
||||||
handleFilter: PropTypes.func,
|
handleFilter: PropTypes.func,
|
||||||
handleSelect: PropTypes.func,
|
handleSelect: PropTypes.func,
|
||||||
handleSelectAll: PropTypes.func,
|
handleSelectAll: PropTypes.func,
|
||||||
|
Loading…
Reference in New Issue
Block a user