Merge 1.x-stable

This commit is contained in:
afc163 2016-07-07 17:26:16 +08:00
commit d68d42f69b
3 changed files with 18 additions and 6 deletions

View File

@ -3,6 +3,7 @@ import GregorianCalendar from 'gregorian-calendar';
import RangeCalendar from 'rc-calendar/lib/RangeCalendar';
import RcDatePicker from 'rc-calendar/lib/Picker';
import classNames from 'classnames';
import Icon from '../icon';
export default class RangePicker extends React.Component {
static defaultProps = {
@ -33,6 +34,13 @@ export default class RangePicker extends React.Component {
}
}
clearSelection = (e) => {
e.preventDefault();
e.stopPropagation();
this.setState({ value: [] });
this.handleChange([]);
}
handleChange = (value) => {
const props = this.props;
if (!('value' in props)) {
@ -100,6 +108,13 @@ export default class RangePicker extends React.Component {
/>
);
const clearIcon = (!props.disabled && state.value && (state.value[0] || state.value[1]))
? <Icon
type="cross-circle"
className="ant-calendar-picker-clear"
onClick={this.clearSelection}
/> : null;
return (<span className={props.pickerClass} style={style}>
<RcDatePicker
formatter={props.getFormatter()}
@ -136,6 +151,7 @@ export default class RangePicker extends React.Component {
placeholder={endPlaceholder}
className="ant-calendar-range-picker-input"
/>
{clearIcon}
<span className="ant-calendar-picker-icon" />
</span>
);

View File

@ -4,6 +4,7 @@ import ValueMixin from './ValueMixin';
import createDOMForm from 'rc-form/lib/createDOMForm';
import assign from 'object-assign';
import { FIELD_META_PROP } from './constants';
Form.create = (o = {}) => {
const options = assign({}, o, {
fieldNameProp: 'id',

View File

@ -7,17 +7,12 @@ export default class Steps extends React.Component {
static defaultProps = {
prefixCls: 'ant-steps',
iconPrefix: 'ant',
maxDescriptionWidth: 100,
current: 0,
}
render() {
let maxDescriptionWidth = this.props.maxDescriptionWidth;
if (this.props.direction === 'vertical') {
maxDescriptionWidth = 'auto';
}
return (
<RcSteps {...this.props} maxDescriptionWidth={maxDescriptionWidth} />
<RcSteps {...this.props} />
);
}
}