Browse Source

upgrade deps

pull/534/head
yiminghe 9 years ago
parent
commit
4aafe71030
  1. 22
      components/datepicker/demo/locale.md
  2. 13
      components/datepicker/index.jsx
  3. 12
      components/datepicker/locale/en_US.js
  4. 0
      components/datepicker/locale/zh_CN.js
  5. 20
      components/pagination/demo/locale.md
  6. 21
      components/pagination/index.jsx
  7. 1
      components/pagination/locale/en_US.js
  8. 1
      components/pagination/locale/zh_CN.js
  9. 36
      package.json
  10. 1
      scripts/sync-rc.sh
  11. 2
      scripts/update-rc.sh
  12. 2
      site/templates/layout.html

22
components/datepicker/demo/locale.md

@ -2,27 +2,29 @@
- order: 9
通过 `locale` 配置时区、语言等,[默认配置](https://github.com/ant-design/ant-design/issues/424)。
通过 `locale` 配置时区、语言等, 默认支持 en_US, zh_CN
---
````jsx
import { Datepicker } from 'antd';
import enUS from 'antd/lib/datepicker/locale/en_US';
function assign(target, source) {
for(var s in source) {
target[s] = source[s];
}
return target;
}
const App = React.createClass({
getInitialState() {
return {
locale: {
locale: assign({
timezoneOffset: 0 * 60,
firstDayOfWeek: 0,
minimalDaysInFirstWeek: 1,
lang: {
today: 'Today',
now: 'Now',
ok: 'OK',
clear: 'Clear'
}
}
minimalDaysInFirstWeek: 1
}, enUS)
};
},
render() {

13
components/datepicker/index.jsx

@ -3,7 +3,8 @@ import Calendar from 'rc-calendar';
import MonthCalendar from 'rc-calendar/lib/MonthCalendar';
import Datepicker from 'rc-calendar/lib/Picker';
import GregorianCalendar from 'gregorian-calendar';
import defaultLocale from './locale';
import defaultLocale from './locale/zh_CN';
import pickerEnUsLocale from './locale/en_US';
import CalendarLocale from 'rc-calendar/lib/locale/zh_CN';
import DateTimeFormat from 'gregorian-calendar-format';
import objectAssign from 'object-assign';
@ -129,7 +130,7 @@ function createPicker(TheCalendar) {
{
({value}) => {
return (
<span>
<span>
<input disabled={this.props.disabled}
onChange={this.handleInputChange}
value={value && this.getFormatter().format(value)}
@ -137,7 +138,7 @@ function createPicker(TheCalendar) {
className={'ant-calendar-picker-input ant-input' + sizeClass}/>
<span className="ant-calendar-picker-icon"/>
</span>
);
);
}
}
</Datepicker>
@ -164,4 +165,10 @@ const AntCalendar = React.createClass({
AntDatePicker.Calendar = AntCalendar;
AntDatePicker.MonthPicker = AntMonthPicker;
// TODO. remove after https://github.com/ant-design/ant-design/issues/487
AntDatePicker.locale = {
en_US: pickerEnUsLocale,
zh_CN: defaultLocale,
};
export default AntDatePicker;

12
components/datepicker/locale/en_US.js

@ -0,0 +1,12 @@
import objectAssign from 'object-assign';
import GregorianCalendarLocale from 'gregorian-calendar/lib/locale/en_US';
import CalendarLocale from 'rc-calendar/lib/locale/en_US';
// 统一合并为完整的 Locale
let locale = objectAssign({}, GregorianCalendarLocale);
locale.lang = objectAssign({}, CalendarLocale);
// All settings at:
// https://github.com/ant-design/ant-design/issues/424
export default locale;

0
components/datepicker/locale.js → components/datepicker/locale/zh_CN.js

20
components/pagination/demo/locale.md

@ -0,0 +1,20 @@
# 国际化
- order: 6
通过 `locale` 配置时区、语言等, 默认支持 en_US, zh_CN
---
````jsx
import { Pagination } from 'antd';
import enUS from 'antd/lib/pagination/locale/en_US';
function onChange(page) {
console.log(page);
}
ReactDOM.render(
<Pagination onChange={onChange} total={50} locale={enUS} />,
document.getElementById('components-pagination-demo-locale'));
````

21
components/pagination/index.jsx

@ -1,18 +1,31 @@
import React from 'react';
import Pagination from 'rc-pagination';
import Select from 'rc-select';
import zhCN from './locale/zh_CN';
import enUS from './locale/en_US';
const prefixCls = 'ant-pagination';
export default class AntPagination extends React.Component {
class AntPagination extends React.Component {
render() {
let className = this.props.className;
if (this.props.size === 'small') {
className += ' mini';
}
return <Pagination selectComponentClass={Select}
selectPrefixCls="ant-select"
prefixCls={prefixCls}
{...this.props} className={className} />;
selectPrefixCls="ant-select"
prefixCls={prefixCls}
{...this.props} className={className}/>;
}
}
AntPagination.defaultProps = {
locale: zhCN,
};
AntPagination.locale = {
en_US: enUS,
zh_CN: zhCN,
};
export default AntPagination;

1
components/pagination/locale/en_US.js

@ -0,0 +1 @@
module.exports = require('rc-pagination/lib/locale/en_US');

1
components/pagination/locale/zh_CN.js

@ -0,0 +1 @@
module.exports = require('rc-pagination/lib/locale/zh_CN');

36
package.json

@ -37,28 +37,28 @@
"gregorian-calendar": "~4.0.1",
"gregorian-calendar-format": "~4.0.4",
"object-assign": "~4.0.1",
"rc-animate": "~2.0.0",
"rc-calendar": "4.0.0-alpha18",
"rc-animate": "~2.0.2",
"rc-calendar": "~4.0.0-alpha19",
"rc-checkbox": "~1.1.1",
"rc-collapse": "~1.4.0",
"rc-dialog": "~5.2.0",
"rc-collapse": "~1.4.3",
"rc-dialog": "~5.2.2",
"rc-dropdown": "~1.4.3",
"rc-form-validation": "~2.4.7",
"rc-input-number": "~2.3.0",
"rc-menu": "~4.8.0",
"rc-notification": "~1.2.0",
"rc-pagination": "~1.1.0",
"rc-progress": "~1.0.0",
"rc-form-validation": "~2.5.0",
"rc-input-number": "~2.4.0",
"rc-menu": "~4.8.1",
"rc-notification": "~1.3.0",
"rc-pagination": "~1.2.1",
"rc-progress": "~1.0.4",
"rc-queue-anim": "~0.11.0",
"rc-radio": "~2.0.0",
"rc-select": "~5.1.0",
"rc-slider": "~2.0.0",
"rc-steps": "~1.4.0",
"rc-switch": "~1.2.0",
"rc-table": "~3.5.0",
"rc-select": "~5.1.1",
"rc-slider": "~2.3.2",
"rc-steps": "~1.4.1",
"rc-switch": "~1.3.1",
"rc-table": "~3.6.1",
"rc-tabs": "~5.5.0",
"rc-tooltip": "~3.1.0",
"rc-tree": "~0.18.1",
"rc-tooltip": "~3.2.0",
"rc-tree": "~0.19.0",
"rc-trigger": "~1.0.6",
"rc-upload": "~1.7.0",
"rc-util": "~3.0.1",
@ -87,8 +87,10 @@
"expect.js": "~0.3.1",
"extract-text-webpack-plugin": "^0.8.1",
"gh-pages": "^0.3.1",
"history": "~1.13.1",
"jest-cli": "~0.6.1",
"json-loader": "^0.5.1",
"less": "~2.5.3",
"less-loader": "^2.2.0",
"lodash": "^3.10.0",
"nico-jsx": "~0.6.0",

1
scripts/sync-rc.sh

@ -0,0 +1 @@
tnpm sync rc-dropdown rc-switch rc-calendar rc-input-number rc-menu rc-notification rc-form-validation rc-dialog rc-slider rc-tabs rc-progress rc-tooltip rc-select

2
scripts/update-rc.sh

@ -0,0 +1,2 @@
rm -rf node_modules/rc-*
tnpm install rc-collapse@latest rc-steps@latest rc-animate@latest rc-dialog@latest rc-queue-anim@latest rc-tree@latest rc-notification@latest rc-table@latest rc-upload@latest rc-pagination@latest rc-checkbox@latest rc-radio@latest rc-dropdown@latest rc-util@latest rc-switch@latest rc-calendar@latest rc-input-number@latest rc-menu@latest rc-notification@latest rc-form-validation@latest rc-dialog@latest rc-slider@latest rc-tabs@latest rc-progress@latest rc-tooltip@latest rc-select@latest --save

2
site/templates/layout.html

@ -51,7 +51,7 @@
var result = window;
var namespaces = path.split('/');
namespaces.forEach(function (key, i) {
if (i !== 0 && i === namespaces.length - 1) {
if (i === 2) {
key = capitalizeFirstLetter(key);
}
if (key !== 'lib') {

Loading…
Cancel
Save