mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 07:56:28 +08:00
parent
73bf9fc327
commit
a987e34f6f
@ -93,7 +93,6 @@ const Page = React.createClass({
|
||||
<Transfer
|
||||
dataSource={[]}
|
||||
showSearch
|
||||
titles={['', '']}
|
||||
targetKeys={[]}
|
||||
render={item => item.title}
|
||||
/>
|
||||
|
@ -27,6 +27,7 @@ export default {
|
||||
cancelText: 'Cancel',
|
||||
},
|
||||
Transfer: {
|
||||
titles: ['Source', 'Target'],
|
||||
notFoundContent: 'Not Found',
|
||||
searchPlaceholder: 'Search here',
|
||||
itemUnit: 'item',
|
||||
|
@ -1,7 +1,11 @@
|
||||
module.exports = {
|
||||
Pagination: require('rc-pagination/lib/locale/en_US'),
|
||||
DatePicker: require('../date-picker/locale/en_US'),
|
||||
TimePicker: require('../time-picker/locale/en_US'),
|
||||
import Pagination from 'rc-pagination/lib/locale/en_US';
|
||||
import DatePicker from '../date-picker/locale/en_US';
|
||||
import TimePicker from '../time-picker/locale/en_US';
|
||||
|
||||
export default {
|
||||
Pagination,
|
||||
DatePicker,
|
||||
TimePicker,
|
||||
Table: {
|
||||
filterTitle: 'Filtrar Menu',
|
||||
filterConfirm: 'OK',
|
@ -37,6 +37,13 @@ export interface TransferProps {
|
||||
rowKey?: (record: any) => string;
|
||||
}
|
||||
|
||||
export interface TransferContext {
|
||||
antLocale?: {
|
||||
Transfer?: any,
|
||||
};
|
||||
}
|
||||
|
||||
const defaultTitles = ['源列表', '目的列表'];
|
||||
export default class Transfer extends React.Component<TransferProps, any> {
|
||||
static List = List;
|
||||
static Operation = Operation;
|
||||
@ -48,7 +55,6 @@ export default class Transfer extends React.Component<TransferProps, any> {
|
||||
render: noop,
|
||||
onChange: noop,
|
||||
onSelectChange: noop,
|
||||
titles: ['源列表', '目的列表'],
|
||||
operations: [],
|
||||
showSearch: false,
|
||||
body: noop,
|
||||
@ -75,6 +81,11 @@ export default class Transfer extends React.Component<TransferProps, any> {
|
||||
rowKey: PropTypes.func,
|
||||
};
|
||||
|
||||
static contextTypes = {
|
||||
antLocale: PropTypes.object,
|
||||
};
|
||||
|
||||
context: TransferContext;
|
||||
splitedDataSource: any;
|
||||
|
||||
constructor(props) {
|
||||
@ -227,9 +238,22 @@ export default class Transfer extends React.Component<TransferProps, any> {
|
||||
handleLeftSelect = (selectedItem, checked) => this.handleSelect('left', selectedItem, checked);
|
||||
handleRightSelect = (selectedItem, checked) => this.handleSelect('right', selectedItem, checked);
|
||||
|
||||
getTitles(): string[] {
|
||||
if (this.props.titles) {
|
||||
return this.props.titles;
|
||||
}
|
||||
if (this.context &&
|
||||
this.context.antLocale &&
|
||||
this.context.antLocale.Transfer
|
||||
) {
|
||||
return this.context.antLocale.Transfer.titles || [];
|
||||
}
|
||||
return defaultTitles;
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
prefixCls, titles, operations, showSearch, notFoundContent,
|
||||
prefixCls, operations, showSearch, notFoundContent,
|
||||
searchPlaceholder, body, footer, listStyle, className,
|
||||
filterOption, render,
|
||||
} = this.props;
|
||||
@ -244,6 +268,7 @@ export default class Transfer extends React.Component<TransferProps, any> {
|
||||
[prefixCls]: true,
|
||||
});
|
||||
|
||||
const titles = this.getTitles();
|
||||
return (
|
||||
<div className={cls}>
|
||||
<List titleText={titles[0]}
|
||||
|
@ -38,7 +38,7 @@ export interface TransferListProps {
|
||||
filterOption: (filterText: any, item: any) => boolean;
|
||||
}
|
||||
|
||||
export interface TransferContext {
|
||||
export interface TransferListContext {
|
||||
antLocale?: {
|
||||
Transfer?: any,
|
||||
};
|
||||
@ -80,8 +80,8 @@ export default class TransferList extends React.Component<TransferListProps, any
|
||||
antLocale: React.PropTypes.object,
|
||||
};
|
||||
|
||||
context: TransferContext;
|
||||
timer: any;
|
||||
context: TransferListContext;
|
||||
timer: number;
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
Loading…
Reference in New Issue
Block a user