Merge branch 'master' of gitlab.alipay-inc.com:react-ui/ant-design

This commit is contained in:
本杰 2016-04-27 14:53:43 +08:00
commit 288d5ff2bc
7 changed files with 32 additions and 20 deletions

View File

@ -2,30 +2,24 @@
- order: 10 - order: 10
通过 `locale` 配置时区、语言等, 默认支持 en_US, zh_CN 通过 `locale` 配置时区、语言等, 默认支持 `en_US``zh_CN`。
--- ---
````jsx ````jsx
import { DatePicker } from 'antd'; import { DatePicker } from 'antd';
import enUS from 'antd/lib/date-picker/locale/en_US'; import enUS from 'antd/lib/date-picker/locale/en_US';
import assign from 'object-assign';
const App = React.createClass({ const App = React.createClass({
getInitialState() {
return {
locale: assign({}, enUS, {
timezoneOffset: 0 * 60,
firstDayOfWeek: 0,
minimalDaysInFirstWeek: 1,
})
};
},
render() { render() {
return <DatePicker locale={this.state.locale} />; const customLocale = {
timezoneOffset: 0 * 60,
firstDayOfWeek: 0,
minimalDaysInFirstWeek: 1,
};
return <DatePicker locale={{ ...enUS, ...customLocale }} />;
} }
}); });
ReactDOM.render(<App />, mountNode); ReactDOM.render(<App />, mountNode);
```` ````

View File

@ -47,6 +47,11 @@ class FormItem extends React.Component {
); );
} }
renderExtra() {
const { prefixCls, extra } = this.props;
return <div className={prefixClsFn(prefixCls, 'extra')}>{extra}</div>;
}
getValidateStatus() { getValidateStatus() {
const { isFieldValidating, getFieldError, getFieldValue } = this.context.form; const { isFieldValidating, getFieldError, getFieldValue } = this.context.form;
const field = this.getId(); const field = this.getId();
@ -142,7 +147,7 @@ class FormItem extends React.Component {
this.renderValidateWrapper( this.renderValidateWrapper(
children, children,
this.renderHelp(), this.renderHelp(),
props.extra this.renderExtra()
) )
), ),
]; ];

View File

@ -49,7 +49,7 @@ const rowSelection = {
}, },
onSelectAll(selected, selectedRows, changeRows) { onSelectAll(selected, selectedRows, changeRows) {
console.log(selected, selectedRows, changeRows); console.log(selected, selectedRows, changeRows);
} },
}; };
ReactDOM.render(<Table rowSelection={rowSelection} columns={columns} dataSource={data} /> ReactDOM.render(<Table rowSelection={rowSelection} columns={columns} dataSource={data} />

View File

@ -13,6 +13,11 @@ import { flatArray } from './util';
function noop() { function noop() {
} }
function stopPropagation(e) {
e.stopPropagation();
e.nativeEvent.stopImmediatePropagation();
}
const defaultLocale = { const defaultLocale = {
filterTitle: '筛选', filterTitle: '筛选',
filterConfirm: '确定', filterConfirm: '确定',
@ -31,7 +36,7 @@ let AntTable = React.createClass({
getInitialState() { getInitialState() {
return { return {
// //
selectedRowKeys: this.props.selectedRowKeys || [], selectedRowKeys: (this.props.rowSelection || {}).selectedRowKeys || [],
filters: {}, filters: {},
selectionDirty: false, selectionDirty: false,
sortColumn: '', sortColumn: '',
@ -305,7 +310,7 @@ let AntTable = React.createClass({
this.getDefaultSelection().indexOf(rowIndex) >= 0); this.getDefaultSelection().indexOf(rowIndex) >= 0);
} }
return ( return (
<Radio disabled={props.disabled} <Radio disabled={props.disabled} onClick={stopPropagation}
onChange={this.handleRadioSelect.bind(this, record, rowIndex)} onChange={this.handleRadioSelect.bind(this, record, rowIndex)}
value={rowIndex} checked={checked} /> value={rowIndex} checked={checked} />
); );
@ -325,7 +330,7 @@ let AntTable = React.createClass({
props = this.props.rowSelection.getCheckboxProps.call(this, record); props = this.props.rowSelection.getCheckboxProps.call(this, record);
} }
return ( return (
<Checkbox checked={checked} disabled={props.disabled} <Checkbox checked={checked} disabled={props.disabled} onClick={stopPropagation}
onChange={this.handleSelect.bind(this, record, rowIndex)} /> onChange={this.handleSelect.bind(this, record, rowIndex)} />
); );
}, },

View File

@ -48,12 +48,15 @@
} }
} }
&-anim-active {
transition: height .2s @ease-out;
}
&-content { &-content {
overflow: hidden; overflow: hidden;
color: @text-color; color: @text-color;
padding: 0 16px; padding: 0 16px;
background-color: #fff; background-color: #fff;
transition: height .2s @ease-out;
& > &-box { & > &-box {
padding-top: 16px; padding-top: 16px;

View File

@ -102,6 +102,11 @@ input[type="checkbox"] {
margin-top: 3px; margin-top: 3px;
} }
.@{css-prefix}form-explain,
.@{css-prefix}form-extra {
color: #999;
}
.@{css-prefix}form-text { .@{css-prefix}form-text {
display: inline-block; display: inline-block;
padding-right: 8px; padding-right: 8px;

View File

@ -22,7 +22,7 @@
// ICONFONT // ICONFONT
@iconfont-css-prefix : anticon; @iconfont-css-prefix : anticon;
@icon-url : "//at.alicdn.com/t/font_1457169990_5499172"; @icon-url : "//at.alicdn.com/t/font_1461567603_8950496";
// LINK // LINK
@link-color : #2db7f5; @link-color : #2db7f5;