mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
Add LocaleProvider support for RangePicker
This commit is contained in:
parent
5c7209c161
commit
655e4d5a7d
@ -7,8 +7,6 @@ import classNames from 'classnames';
|
||||
export default class RangePicker extends React.Component {
|
||||
static defaultProps = {
|
||||
defaultValue: [],
|
||||
startPlaceholder: '开始日期',
|
||||
endPlaceholder: '结束日期',
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
@ -56,7 +54,7 @@ export default class RangePicker extends React.Component {
|
||||
let defaultCalendarValue = new GregorianCalendar(locale);
|
||||
defaultCalendarValue.setTime(Date.now());
|
||||
|
||||
const { disabledDate, showTime, startPlaceholder, endPlaceholder, getCalendarContainer,
|
||||
const { disabledDate, showTime, getCalendarContainer,
|
||||
transitionName, disabled, popupStyle, align, style, onOk } = this.props;
|
||||
const state = this.state;
|
||||
|
||||
@ -83,6 +81,11 @@ export default class RangePicker extends React.Component {
|
||||
calendarHandler = {};
|
||||
}
|
||||
|
||||
const startPlaceholder = ('startPlaceholder' in this.props)
|
||||
? props.startPlaceholder : locale.lang.rangePlaceholder[0];
|
||||
const endPlaceholder = ('endPlaceholder' in props)
|
||||
? props.endPlaceholder : locale.lang.rangePlaceholder[1];
|
||||
|
||||
const calendar = (
|
||||
<RangeCalendar
|
||||
prefixCls="ant-calendar"
|
||||
|
@ -6,6 +6,7 @@ let locale = { ...GregorianCalendarLocale };
|
||||
locale.lang = {
|
||||
placeholder: 'Select date',
|
||||
timePlaceholder: 'Select time',
|
||||
rangePlaceholder: ['Start date', 'End date'],
|
||||
...CalendarLocale,
|
||||
};
|
||||
|
||||
|
@ -6,6 +6,7 @@ let locale = { ...GregorianCalendarLocale };
|
||||
locale.lang = {
|
||||
placeholder: '请选择日期',
|
||||
timePlaceholder: '请选择时间',
|
||||
rangePlaceholder: ['开始日期', '结束日期'],
|
||||
...CalendarLocale,
|
||||
};
|
||||
|
||||
|
@ -10,6 +10,7 @@ import { LocaleProvider, Pagination, DatePicker, TimePicker, Calendar,
|
||||
Popconfirm, Table, Modal, Button, Select, Transfer } from 'antd';
|
||||
import enUS from 'antd/lib/locale-provider/en_US';
|
||||
const Option = Select.Option;
|
||||
const RangePicker = DatePicker.RangePicker;
|
||||
|
||||
const columns = [{
|
||||
title: 'Name',
|
||||
@ -56,6 +57,9 @@ const Page = React.createClass({
|
||||
<div className="example">
|
||||
<DatePicker />
|
||||
<TimePicker />
|
||||
<RangePicker style={{ width: 200 }} />
|
||||
</div>
|
||||
<div className="example">
|
||||
<Button type="primary" onClick={this.showModal}>Show Modal</Button>
|
||||
<Button onClick={info}>Show info</Button>
|
||||
<Button onClick={confirm}>Show confirm</Button>
|
||||
|
Loading…
Reference in New Issue
Block a user