2017-03-17 15:23:25 +08:00
|
|
|
import React, { PropTypes } from 'react';
|
2016-09-30 17:45:58 +08:00
|
|
|
import classNames from 'classnames';
|
2017-03-17 15:23:25 +08:00
|
|
|
import List, { TransferListProps } from './list';
|
2015-12-25 17:53:35 +08:00
|
|
|
import Operation from './operation';
|
|
|
|
import Search from './search';
|
2017-03-17 15:23:25 +08:00
|
|
|
import injectLocale from '../locale-provider/injectLocale';
|
2016-07-01 20:52:17 +08:00
|
|
|
|
2015-11-25 23:17:06 +08:00
|
|
|
function noop() {
|
|
|
|
}
|
|
|
|
|
2016-07-01 20:52:17 +08:00
|
|
|
export interface TransferItem {
|
2016-10-24 16:30:38 +08:00
|
|
|
key: string;
|
2016-07-13 11:14:24 +08:00
|
|
|
title: string;
|
|
|
|
description?: string;
|
2016-09-19 17:52:20 +08:00
|
|
|
disabled?: boolean;
|
2016-07-01 20:52:17 +08:00
|
|
|
}
|
|
|
|
|
2016-07-07 20:25:03 +08:00
|
|
|
export interface TransferProps {
|
2016-12-07 18:08:52 +08:00
|
|
|
prefixCls?: string;
|
|
|
|
className?: string;
|
2016-09-19 17:52:20 +08:00
|
|
|
dataSource: TransferItem[];
|
2016-09-18 10:44:22 +08:00
|
|
|
targetKeys: string[];
|
2016-11-04 17:46:01 +08:00
|
|
|
selectedKeys?: string[];
|
2016-11-04 17:06:57 +08:00
|
|
|
render?: (record: TransferItem) => React.ReactNode;
|
|
|
|
onChange?: (targetKeys: string[], direction: string, moveKeys: any) => void;
|
2016-09-18 10:44:22 +08:00
|
|
|
onSelectChange?: (sourceSelectedKeys: string[], targetSelectedKeys: string[]) => void;
|
2016-12-07 18:08:52 +08:00
|
|
|
style?: React.CSSProperties;
|
2016-07-13 11:14:24 +08:00
|
|
|
listStyle?: React.CSSProperties;
|
2016-09-19 17:52:20 +08:00
|
|
|
titles?: string[];
|
|
|
|
operations?: string[];
|
2016-07-13 11:14:24 +08:00
|
|
|
showSearch?: boolean;
|
2016-12-07 18:08:52 +08:00
|
|
|
filterOption: (inputValue: any, item: any) => boolean;
|
2016-07-13 11:14:24 +08:00
|
|
|
searchPlaceholder?: string;
|
2016-09-19 17:52:20 +08:00
|
|
|
notFoundContent?: React.ReactNode;
|
2016-12-07 18:08:52 +08:00
|
|
|
footer?: (props: TransferListProps) => React.ReactNode;
|
|
|
|
body?: (props: TransferListProps) => React.ReactNode;
|
|
|
|
rowKey?: (record: TransferItem) => string;
|
2017-01-04 18:41:28 +08:00
|
|
|
onSearchChange?: (direction: 'left' | 'right', e: Event) => void;
|
2016-11-03 16:05:59 +08:00
|
|
|
lazy?: {};
|
2017-03-01 11:07:19 +08:00
|
|
|
onScroll?: (direction: 'left' | 'right', e: Event) => void;
|
2016-07-01 20:52:17 +08:00
|
|
|
}
|
|
|
|
|
2017-03-17 15:23:25 +08:00
|
|
|
abstract class Transfer extends React.Component<TransferProps, any> {
|
2016-11-04 17:06:57 +08:00
|
|
|
// For high-level customized Transfer @dqaria
|
2016-03-29 14:01:10 +08:00
|
|
|
static List = List;
|
|
|
|
static Operation = Operation;
|
|
|
|
static Search = Search;
|
|
|
|
|
|
|
|
static defaultProps = {
|
|
|
|
dataSource: [],
|
|
|
|
render: noop,
|
|
|
|
showSearch: false,
|
2016-05-12 11:09:27 +08:00
|
|
|
};
|
2016-03-29 14:01:10 +08:00
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
prefixCls: PropTypes.string,
|
|
|
|
dataSource: PropTypes.array,
|
|
|
|
render: PropTypes.func,
|
|
|
|
targetKeys: PropTypes.array,
|
|
|
|
onChange: PropTypes.func,
|
|
|
|
height: PropTypes.number,
|
|
|
|
listStyle: PropTypes.object,
|
|
|
|
className: PropTypes.string,
|
|
|
|
titles: PropTypes.array,
|
|
|
|
operations: PropTypes.array,
|
|
|
|
showSearch: PropTypes.bool,
|
2016-08-05 10:49:54 +08:00
|
|
|
filterOption: PropTypes.func,
|
2016-03-29 14:01:10 +08:00
|
|
|
searchPlaceholder: PropTypes.string,
|
|
|
|
notFoundContent: PropTypes.node,
|
|
|
|
body: PropTypes.func,
|
|
|
|
footer: PropTypes.func,
|
2016-05-30 16:59:21 +08:00
|
|
|
rowKey: PropTypes.func,
|
2016-12-16 17:59:52 +08:00
|
|
|
lazy: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]),
|
2016-05-12 11:09:27 +08:00
|
|
|
};
|
2015-11-25 23:17:06 +08:00
|
|
|
|
2016-08-08 14:42:29 +08:00
|
|
|
splitedDataSource: any;
|
|
|
|
|
2016-11-04 17:46:01 +08:00
|
|
|
constructor(props: TransferProps) {
|
2015-11-25 23:17:06 +08:00
|
|
|
super(props);
|
2016-11-04 17:46:01 +08:00
|
|
|
|
|
|
|
const { selectedKeys = [], targetKeys = [] } = props;
|
2015-11-25 23:17:06 +08:00
|
|
|
this.state = {
|
2015-11-26 16:07:11 +08:00
|
|
|
leftFilter: '',
|
|
|
|
rightFilter: '',
|
2016-11-04 17:46:01 +08:00
|
|
|
sourceSelectedKeys: selectedKeys.filter(key => targetKeys.indexOf(key) === -1),
|
|
|
|
targetSelectedKeys: selectedKeys.filter(key => targetKeys.indexOf(key) > -1),
|
2015-11-25 23:17:06 +08:00
|
|
|
};
|
|
|
|
}
|
2016-07-15 14:01:51 +08:00
|
|
|
|
2017-03-17 15:23:25 +08:00
|
|
|
abstract getLocale()
|
|
|
|
|
2016-11-04 17:46:01 +08:00
|
|
|
componentWillReceiveProps(nextProps: TransferProps) {
|
2016-11-04 17:06:57 +08:00
|
|
|
const { sourceSelectedKeys, targetSelectedKeys } = this.state;
|
2016-06-21 17:41:39 +08:00
|
|
|
if (nextProps.targetKeys !== this.props.targetKeys ||
|
|
|
|
nextProps.dataSource !== this.props.dataSource) {
|
|
|
|
// clear cached splited dataSource
|
|
|
|
this.splitedDataSource = null;
|
|
|
|
|
2016-09-30 17:45:58 +08:00
|
|
|
const { dataSource, targetKeys = [] } = nextProps;
|
|
|
|
function existInDateSourcekey(key) {
|
2016-12-07 18:08:52 +08:00
|
|
|
return dataSource.some(item => item.key === key);
|
2016-09-30 17:45:58 +08:00
|
|
|
}
|
2016-06-21 17:41:39 +08:00
|
|
|
// clear key nolonger existed
|
|
|
|
// clear checkedKeys according to targetKeys
|
|
|
|
this.setState({
|
2016-11-04 17:06:57 +08:00
|
|
|
sourceSelectedKeys: sourceSelectedKeys.filter(existInDateSourcekey)
|
2016-06-21 17:41:39 +08:00
|
|
|
.filter(data => targetKeys.filter(key => key === data).length === 0),
|
2016-11-04 17:06:57 +08:00
|
|
|
targetSelectedKeys: targetSelectedKeys.filter(existInDateSourcekey)
|
2016-06-21 17:41:39 +08:00
|
|
|
.filter(data => targetKeys.filter(key => key === data).length > 0),
|
|
|
|
});
|
|
|
|
}
|
2016-11-04 17:46:01 +08:00
|
|
|
if (nextProps.selectedKeys) {
|
|
|
|
const targetKeys = nextProps.targetKeys;
|
|
|
|
this.setState({
|
|
|
|
sourceSelectedKeys: nextProps.selectedKeys.filter(key => targetKeys.indexOf(key) === -1),
|
|
|
|
targetSelectedKeys: nextProps.selectedKeys.filter(key => targetKeys.indexOf(key) > -1),
|
|
|
|
});
|
|
|
|
}
|
2016-05-06 12:09:26 +08:00
|
|
|
}
|
2016-10-24 16:30:38 +08:00
|
|
|
splitDataSource(props: TransferProps) {
|
2016-06-21 17:41:39 +08:00
|
|
|
if (this.splitedDataSource) {
|
|
|
|
return this.splitedDataSource;
|
|
|
|
}
|
2015-11-26 11:18:37 +08:00
|
|
|
|
2016-10-24 16:30:38 +08:00
|
|
|
const { rowKey, dataSource, targetKeys = [] } = props;
|
|
|
|
if (rowKey) {
|
2016-09-19 17:52:20 +08:00
|
|
|
dataSource.forEach(record => {
|
2016-10-24 16:30:38 +08:00
|
|
|
record.key = rowKey(record);
|
2015-12-17 16:08:16 +08:00
|
|
|
});
|
|
|
|
}
|
2015-12-21 15:29:02 +08:00
|
|
|
|
2016-09-19 17:52:20 +08:00
|
|
|
const leftDataSource = dataSource.filter(({ key }) => targetKeys.indexOf(key) === -1);
|
2016-10-24 16:30:38 +08:00
|
|
|
const rightDataSource: TransferItem[] = [];
|
2016-09-26 10:24:18 +08:00
|
|
|
targetKeys.forEach((targetKey) => {
|
|
|
|
const targetItem = dataSource.filter(record => record.key === targetKey)[0];
|
|
|
|
if (targetItem) {
|
|
|
|
rightDataSource.push(targetItem);
|
|
|
|
}
|
|
|
|
});
|
2016-09-19 17:52:20 +08:00
|
|
|
|
2016-06-21 17:41:39 +08:00
|
|
|
this.splitedDataSource = {
|
2016-01-07 17:46:46 +08:00
|
|
|
leftDataSource,
|
|
|
|
rightDataSource,
|
2015-12-21 15:29:02 +08:00
|
|
|
};
|
2016-06-21 17:41:39 +08:00
|
|
|
|
|
|
|
return this.splitedDataSource;
|
2015-12-16 23:02:49 +08:00
|
|
|
}
|
|
|
|
|
2016-03-23 19:50:44 +08:00
|
|
|
moveTo = (direction) => {
|
2017-02-24 19:08:02 +08:00
|
|
|
const { targetKeys = [], dataSource = [], onChange } = this.props;
|
2016-11-04 17:06:57 +08:00
|
|
|
const { sourceSelectedKeys, targetSelectedKeys } = this.state;
|
|
|
|
const moveKeys = direction === 'right' ? sourceSelectedKeys : targetSelectedKeys;
|
2017-02-24 19:08:02 +08:00
|
|
|
// filter the disabled options
|
|
|
|
const newMoveKeys = moveKeys.filter(key => !dataSource.some(data => !!(key === data.key && data.disabled)));
|
2015-12-21 15:29:02 +08:00
|
|
|
// move items to target box
|
2016-02-01 14:07:17 +08:00
|
|
|
const newTargetKeys = direction === 'right'
|
2017-02-24 19:08:02 +08:00
|
|
|
? newMoveKeys.concat(targetKeys)
|
|
|
|
: targetKeys.filter(targetKey => newMoveKeys.indexOf(targetKey) === -1);
|
2015-12-21 15:29:02 +08:00
|
|
|
|
|
|
|
// empty checked keys
|
2016-09-18 10:44:22 +08:00
|
|
|
const oppositeDirection = direction === 'right' ? 'left' : 'right';
|
2015-12-21 15:29:02 +08:00
|
|
|
this.setState({
|
2016-11-04 17:06:57 +08:00
|
|
|
[this.getSelectedKeysName(oppositeDirection)]: [],
|
2015-12-21 15:29:02 +08:00
|
|
|
});
|
2016-09-18 10:44:22 +08:00
|
|
|
this.handleSelectChange(oppositeDirection, []);
|
2015-12-21 15:29:02 +08:00
|
|
|
|
2016-10-24 16:30:38 +08:00
|
|
|
if (onChange) {
|
2017-02-24 19:08:02 +08:00
|
|
|
onChange(newTargetKeys, direction, newMoveKeys);
|
2016-10-24 16:30:38 +08:00
|
|
|
}
|
2015-11-25 23:17:06 +08:00
|
|
|
}
|
|
|
|
|
2017-03-23 21:15:49 +08:00
|
|
|
moveToLeft = () => this.moveTo('left');
|
|
|
|
moveToRight = () => this.moveTo('right');
|
2016-03-30 17:06:19 +08:00
|
|
|
|
2016-09-18 10:44:22 +08:00
|
|
|
handleSelectChange(direction: string, holder: string[]) {
|
2016-11-04 17:06:57 +08:00
|
|
|
const { sourceSelectedKeys, targetSelectedKeys } = this.state;
|
2016-09-18 10:44:22 +08:00
|
|
|
const onSelectChange = this.props.onSelectChange;
|
2016-10-24 16:30:38 +08:00
|
|
|
if (!onSelectChange) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-09-18 10:44:22 +08:00
|
|
|
if (direction === 'left') {
|
2016-11-04 17:06:57 +08:00
|
|
|
onSelectChange(holder, targetSelectedKeys);
|
2016-09-18 10:44:22 +08:00
|
|
|
} else {
|
2016-11-04 17:06:57 +08:00
|
|
|
onSelectChange(sourceSelectedKeys, holder);
|
2016-09-18 10:44:22 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-15 15:07:31 +08:00
|
|
|
handleSelectAll = (direction, filteredDataSource, checkAll) => {
|
|
|
|
const holder = checkAll ? [] : filteredDataSource.map(item => item.key);
|
2016-09-18 10:44:22 +08:00
|
|
|
this.handleSelectChange(direction, holder);
|
2016-11-04 17:46:01 +08:00
|
|
|
|
|
|
|
if (!this.props.selectedKeys) {
|
|
|
|
this.setState({
|
|
|
|
[this.getSelectedKeysName(direction)]: holder,
|
|
|
|
});
|
|
|
|
}
|
2015-11-25 23:17:06 +08:00
|
|
|
}
|
|
|
|
|
2016-08-08 14:42:29 +08:00
|
|
|
handleLeftSelectAll = (filteredDataSource, checkAll) => (
|
|
|
|
this.handleSelectAll('left', filteredDataSource, checkAll)
|
2017-03-23 21:15:49 +08:00
|
|
|
);
|
2016-08-08 14:42:29 +08:00
|
|
|
handleRightSelectAll = (filteredDataSource, checkAll) => (
|
|
|
|
this.handleSelectAll('right', filteredDataSource, checkAll)
|
2017-03-23 21:15:49 +08:00
|
|
|
);
|
2016-03-30 17:06:19 +08:00
|
|
|
|
2016-03-23 19:50:44 +08:00
|
|
|
handleFilter = (direction, e) => {
|
2015-12-21 15:29:02 +08:00
|
|
|
this.setState({
|
2015-12-23 19:41:56 +08:00
|
|
|
// add filter
|
2016-02-17 18:04:42 +08:00
|
|
|
[`${direction}Filter`]: e.target.value,
|
2015-12-21 15:29:02 +08:00
|
|
|
});
|
2017-01-04 18:41:28 +08:00
|
|
|
if (this.props.onSearchChange) {
|
|
|
|
this.props.onSearchChange(direction, e);
|
|
|
|
}
|
2015-11-26 16:07:11 +08:00
|
|
|
}
|
|
|
|
|
2017-03-23 21:15:49 +08:00
|
|
|
handleLeftFilter = (e) => this.handleFilter('left', e);
|
|
|
|
handleRightFilter = (e) => this.handleFilter('right', e);
|
2016-03-30 17:06:19 +08:00
|
|
|
|
2016-03-23 19:50:44 +08:00
|
|
|
handleClear = (direction) => {
|
2015-12-21 15:29:02 +08:00
|
|
|
this.setState({
|
2016-02-17 18:04:42 +08:00
|
|
|
[`${direction}Filter`]: '',
|
2015-11-25 23:17:06 +08:00
|
|
|
});
|
2015-12-21 15:29:02 +08:00
|
|
|
}
|
2015-11-25 23:17:06 +08:00
|
|
|
|
2017-03-23 21:15:49 +08:00
|
|
|
handleLeftClear = () => this.handleClear('left');
|
|
|
|
handleRightClear = () => this.handleClear('right');
|
2016-03-30 17:06:19 +08:00
|
|
|
|
2016-03-23 19:50:44 +08:00
|
|
|
handleSelect = (direction, selectedItem, checked) => {
|
2016-11-04 17:06:57 +08:00
|
|
|
const { sourceSelectedKeys, targetSelectedKeys } = this.state;
|
|
|
|
const holder = direction === 'left' ? [...sourceSelectedKeys] : [...targetSelectedKeys];
|
2016-11-15 15:21:13 +08:00
|
|
|
const index = holder.indexOf(selectedItem.key);
|
2016-01-07 17:46:46 +08:00
|
|
|
if (index > -1) {
|
2015-12-21 15:29:02 +08:00
|
|
|
holder.splice(index, 1);
|
|
|
|
}
|
2016-01-07 17:46:46 +08:00
|
|
|
if (checked) {
|
2015-12-21 15:29:02 +08:00
|
|
|
holder.push(selectedItem.key);
|
|
|
|
}
|
2016-09-18 10:44:22 +08:00
|
|
|
this.handleSelectChange(direction, holder);
|
2016-11-04 17:46:01 +08:00
|
|
|
|
|
|
|
if (!this.props.selectedKeys) {
|
|
|
|
this.setState({
|
|
|
|
[this.getSelectedKeysName(direction)]: holder,
|
|
|
|
});
|
|
|
|
}
|
2015-11-25 23:17:06 +08:00
|
|
|
}
|
|
|
|
|
2016-03-30 17:06:19 +08:00
|
|
|
handleLeftSelect = (selectedItem, checked) => this.handleSelect('left', selectedItem, checked);
|
|
|
|
handleRightSelect = (selectedItem, checked) => this.handleSelect('right', selectedItem, checked);
|
|
|
|
|
2017-03-01 11:07:19 +08:00
|
|
|
handleScroll = (direction, e) => {
|
|
|
|
const { onScroll } = this.props;
|
|
|
|
if (onScroll) {
|
|
|
|
onScroll(direction, e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
handleLeftScroll = (e) => this.handleScroll('left', e);
|
|
|
|
handleRightScroll = (e) => this.handleScroll('right', e);
|
|
|
|
|
2016-10-08 10:42:13 +08:00
|
|
|
getTitles(): string[] {
|
2017-03-17 15:23:25 +08:00
|
|
|
const { props } = this;
|
2016-12-07 18:08:52 +08:00
|
|
|
if (props.titles) {
|
|
|
|
return props.titles;
|
2016-10-08 10:42:13 +08:00
|
|
|
}
|
2017-03-17 15:23:25 +08:00
|
|
|
const transferLocale = this.getLocale();
|
|
|
|
return transferLocale.titles;
|
2016-10-08 10:42:13 +08:00
|
|
|
}
|
|
|
|
|
2016-11-04 17:06:57 +08:00
|
|
|
getSelectedKeysName(direction) {
|
|
|
|
return direction === 'left' ? 'sourceSelectedKeys' : 'targetSelectedKeys';
|
|
|
|
}
|
|
|
|
|
2015-11-25 23:17:06 +08:00
|
|
|
render() {
|
2017-03-17 15:23:25 +08:00
|
|
|
const locale = this.getLocale();
|
2015-12-24 17:44:54 +08:00
|
|
|
const {
|
2017-03-17 15:23:25 +08:00
|
|
|
prefixCls = 'ant-transfer',
|
|
|
|
className,
|
|
|
|
operations = [],
|
|
|
|
showSearch,
|
|
|
|
notFoundContent = locale.notFoundContent,
|
|
|
|
searchPlaceholder = locale.searchPlaceholder,
|
|
|
|
body,
|
|
|
|
footer,
|
|
|
|
listStyle,
|
|
|
|
filterOption,
|
|
|
|
render,
|
|
|
|
lazy,
|
2015-12-24 17:44:54 +08:00
|
|
|
} = this.props;
|
2016-11-04 17:06:57 +08:00
|
|
|
const { leftFilter, rightFilter, sourceSelectedKeys, targetSelectedKeys } = this.state;
|
2015-11-25 23:17:06 +08:00
|
|
|
|
2016-05-06 12:09:26 +08:00
|
|
|
const { leftDataSource, rightDataSource } = this.splitDataSource(this.props);
|
2016-11-04 17:06:57 +08:00
|
|
|
const leftActive = targetSelectedKeys.length > 0;
|
|
|
|
const rightActive = sourceSelectedKeys.length > 0;
|
2015-12-23 19:41:56 +08:00
|
|
|
|
2016-11-30 10:20:23 +08:00
|
|
|
const cls = classNames(className, prefixCls);
|
2015-12-24 17:44:54 +08:00
|
|
|
|
2016-10-08 10:42:13 +08:00
|
|
|
const titles = this.getTitles();
|
2016-01-07 14:21:29 +08:00
|
|
|
return (
|
|
|
|
<div className={cls}>
|
2016-11-03 16:05:59 +08:00
|
|
|
<List
|
2017-03-17 15:23:25 +08:00
|
|
|
prefixCls={`${prefixCls}-list`}
|
2016-11-03 16:05:59 +08:00
|
|
|
titleText={titles[0]}
|
2016-01-07 17:46:46 +08:00
|
|
|
dataSource={leftDataSource}
|
|
|
|
filter={leftFilter}
|
2016-08-05 10:49:54 +08:00
|
|
|
filterOption={filterOption}
|
2016-01-07 17:46:46 +08:00
|
|
|
style={listStyle}
|
2016-11-04 17:06:57 +08:00
|
|
|
checkedKeys={sourceSelectedKeys}
|
2016-03-30 17:06:19 +08:00
|
|
|
handleFilter={this.handleLeftFilter}
|
|
|
|
handleClear={this.handleLeftClear}
|
|
|
|
handleSelect={this.handleLeftSelect}
|
|
|
|
handleSelectAll={this.handleLeftSelectAll}
|
2016-05-12 11:09:27 +08:00
|
|
|
render={render}
|
2016-01-07 17:46:46 +08:00
|
|
|
showSearch={showSearch}
|
|
|
|
searchPlaceholder={searchPlaceholder}
|
2016-03-07 12:01:49 +08:00
|
|
|
notFoundContent={notFoundContent}
|
2017-03-17 15:23:25 +08:00
|
|
|
itemUnit={locale.itemUnit}
|
|
|
|
itemsUnit={locale.itemsUnit}
|
2016-01-07 17:46:46 +08:00
|
|
|
body={body}
|
|
|
|
footer={footer}
|
2016-11-03 16:05:59 +08:00
|
|
|
lazy={lazy}
|
2017-03-01 11:07:19 +08:00
|
|
|
onScroll={this.handleLeftScroll}
|
2016-06-06 13:54:10 +08:00
|
|
|
/>
|
2016-11-03 16:05:59 +08:00
|
|
|
<Operation
|
2017-03-17 15:23:25 +08:00
|
|
|
className={`${prefixCls}-operation`}
|
2016-11-03 16:05:59 +08:00
|
|
|
rightActive={rightActive}
|
2016-01-07 17:46:46 +08:00
|
|
|
rightArrowText={operations[0]}
|
2016-03-30 17:06:19 +08:00
|
|
|
moveToRight={this.moveToRight}
|
2016-01-07 17:46:46 +08:00
|
|
|
leftActive={leftActive}
|
|
|
|
leftArrowText={operations[1]}
|
2016-03-30 17:06:19 +08:00
|
|
|
moveToLeft={this.moveToLeft}
|
2016-06-06 13:54:10 +08:00
|
|
|
/>
|
2016-11-03 16:05:59 +08:00
|
|
|
<List
|
2017-03-17 15:23:25 +08:00
|
|
|
prefixCls={`${prefixCls}-list`}
|
2016-11-03 16:05:59 +08:00
|
|
|
titleText={titles[1]}
|
2016-01-07 17:46:46 +08:00
|
|
|
dataSource={rightDataSource}
|
|
|
|
filter={rightFilter}
|
2016-08-05 10:49:54 +08:00
|
|
|
filterOption={filterOption}
|
2016-01-07 17:46:46 +08:00
|
|
|
style={listStyle}
|
2016-11-04 17:06:57 +08:00
|
|
|
checkedKeys={targetSelectedKeys}
|
2016-03-30 17:06:19 +08:00
|
|
|
handleFilter={this.handleRightFilter}
|
|
|
|
handleClear={this.handleRightClear}
|
|
|
|
handleSelect={this.handleRightSelect}
|
|
|
|
handleSelectAll={this.handleRightSelectAll}
|
2016-05-12 11:09:27 +08:00
|
|
|
render={render}
|
2016-01-07 17:46:46 +08:00
|
|
|
showSearch={showSearch}
|
|
|
|
searchPlaceholder={searchPlaceholder}
|
2016-03-07 12:01:49 +08:00
|
|
|
notFoundContent={notFoundContent}
|
2017-03-17 15:23:25 +08:00
|
|
|
itemUnit={locale.itemUnit}
|
|
|
|
itemsUnit={locale.itemsUnit}
|
2016-01-07 17:46:46 +08:00
|
|
|
body={body}
|
|
|
|
footer={footer}
|
2016-11-03 16:05:59 +08:00
|
|
|
lazy={lazy}
|
2017-03-01 11:07:19 +08:00
|
|
|
onScroll={this.handleRightScroll}
|
2016-06-06 13:54:10 +08:00
|
|
|
/>
|
2016-01-07 14:21:29 +08:00
|
|
|
</div>
|
|
|
|
);
|
2015-11-25 23:17:06 +08:00
|
|
|
}
|
|
|
|
}
|
2017-03-17 15:23:25 +08:00
|
|
|
|
|
|
|
const injectTransferLocale = injectLocale('Transfer', {
|
|
|
|
titles: ['', ''],
|
|
|
|
searchPlaceholder: 'Search',
|
|
|
|
notFoundContent: 'Not Found',
|
|
|
|
});
|
|
|
|
export default injectTransferLocale<TransferProps>(Transfer as any);
|