diff --git a/docs/transfer/demo/search.md b/docs/transfer/demo/search.md index 57406bc5a4..821d6a90b6 100644 --- a/docs/transfer/demo/search.md +++ b/docs/transfer/demo/search.md @@ -43,7 +43,7 @@ class Demo extends React.Component { } render() { - return (); } diff --git a/docs/transfer/index.en-us.md b/docs/transfer/index.en-us.md index fcd09c4681..ab8f6809b8 100644 --- a/docs/transfer/index.en-us.md +++ b/docs/transfer/index.en-us.md @@ -26,8 +26,8 @@ Move the items in two panels in an intuitive way to select. | onChange | callback function triggered when value change

**signatures**:
Function(value: Array, data: Array, extra: Object) => void
**params**:
_value_: {Array} value of right panel
_data_: {Array} data of right panel
_extra_: {Object} extra parmas
_extra.leftValue_: {Array} value of left panel
_extra.leftData_: {Array} data of left panel
_extra.movedValue_: {Array} moved value
_extra.movedData_: {Object} moved data
_extra.direction_: {String} move direction, 'left' or 'right' | Function | - | | onSelect | callback function triggered when item checked

**signatures**:
Function(sourceSelectedValue: Array, targetSelectedValue: Array, trigger: String) => void
**params**:
_sourceSelectedValue_: {Array} value of checked items in source panel
_targetSelectedValue_: {Array} value of checked items in target panel
_trigger_: {String} trigger panel `source|target`
| Function | - | | itemRender | item render function

**signatures**:
Function(data: Object) => ReactNode
**params**:
_data_: {Object} data
**returns**:
{ReactNode} content of item
| Function | data => data.label | -| showSearch | whether to show the search box | Boolean | false | -| searchProps | props passed to Search when showSearch is true | Object | - | +| showSearch | whether to show the search box | Boolean/Array<Boolean> | false | +| searchProps | props passed to Search when showSearch is true | Object/Array<Object> | - | | filter | custom search function

**signatures**:
Function(searchedValue: String, data: Object) => Boolean
**params**:
_searchedValue_: {String} search keyword
_data_: {Object} data
**returns**:
{Boolean} whether is matched
| Function | filter by label | | onSearch | callback function triggered when search

**signatures**:
Function(searchedValue: String, position: String) => void
**params**:
_searchedValue_: {String} search keyword
_position_: {String} position of the search box | Function | () => {} | | searchPlaceholder | placeholder of the search box | String | - | diff --git a/docs/transfer/index.md b/docs/transfer/index.md index 8b50d9cc32..fc3f95fc9d 100644 --- a/docs/transfer/index.md +++ b/docs/transfer/index.md @@ -31,8 +31,8 @@ | leftDisabled | 是否禁用左侧面板 | Boolean | false | | rightDisabled | 是否禁用右侧面板 | Boolean | false | | itemRender | 列表项渲染函数

**签名**:
Function(data: Object) => ReactNode
**参数**:
_data_: {Object} 数据
**返回值**:
{ReactNode} 列表项内容
| Function | data => data.label | -| showSearch | 是否显示搜索框 | Boolean | false | -| searchProps | 搜索框配置项,同 Search 组件 props | Object | - | +| showSearch | 是否显示搜索框 | Boolean/Array<Boolean> | false | +| searchProps | 搜索框配置项,同 Search 组件 props | Object/Array<Object> | - | | filter | 自定义搜索函数

**签名**:
Function(searchedValue: String, data: Object) => Boolean
**参数**:
_searchedValue_: {String} 搜索的内容
_data_: {Object} 数据
**返回值**:
{Boolean} 是否匹配到
| Function | 根据 label 属性匹配 | | onSearch | 搜索框输入时触发的回调函数

**签名**:
Function(searchedValue: String, position: String) => void
**参数**:
_searchedValue_: {String} 搜索的内容
_position_: {String} 搜索面板的位置 | Function | () => {} | | searchPlaceholder | 搜索框占位符 | String | - | diff --git a/src/transfer/view/transfer.jsx b/src/transfer/view/transfer.jsx index 6fefa78aa1..3f6ad6836c 100644 --- a/src/transfer/view/transfer.jsx +++ b/src/transfer/view/transfer.jsx @@ -112,11 +112,11 @@ class Transfer extends Component { /** * 是否显示搜索框 */ - showSearch: PropTypes.bool, + showSearch: PropTypes.bool | PropTypes.arrayOf(PropTypes.bool), /** * 搜索框配置项,同 Search 组件 props */ - searchProps: PropTypes.object, + searchProps: PropTypes.object | PropTypes.arrayOf(PropTypes.object), /** * 自定义搜索函数 * @param {String} searchedValue 搜索的内容 @@ -506,8 +506,8 @@ class Transfer extends Component { className, dataSource, locale, - showSearch, - searchProps, + showSearch = false, + searchProps = {}, filter, onSearch, leftDisabled, @@ -533,8 +533,6 @@ class Transfer extends Component { prefix, mode, locale, - showSearch, - searchProps, filter, onSearch, searchPlaceholder, @@ -557,6 +555,8 @@ class Transfer extends Component { if (rtl) { others.dir = 'rtl'; } + const _showSearch = Array.isArray(showSearch) ? showSearch : [showSearch, showSearch]; + const _searchProps = Array.isArray(searchProps) ? searchProps : [searchProps, searchProps]; return (
{this.renderCenter()} @@ -574,6 +576,8 @@ class Transfer extends Component { dataSource={rightDatasource} disabled={rightDisabled || disabled} value={rightCheckedValue} + showSearch={_showSearch[1]} + searchProps={_searchProps[1]} title={titles[1]} />