Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit

Permalink
add adjustOrientOnCalendarOverflow
Browse files Browse the repository at this point in the history
  • Loading branch information
yiminghe committed Jul 2, 2015
1 parent 67eef26 commit f4205d9
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
5 changes: 5 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# History
----

## 3.10.1 / 2015-07-02

add adjustOrientOnCalendarOverflow prop for picker

## 3.10.0 / 2015-07-01

`new` support picker animation [#39](https://github.com/react-component/calendar/issues/39)
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@ http://react-component.github.io/calendar/examples/index.html
<td></td>
<td></td>
</tr>
<tr>
<td>adjustOrientOnCalendarOverflow</td>
<td>Boolean</td>
<td>true</td>
<td>whether adjust calendar orient if there is not enough space to show. better false if animation is 'slide-up'</td>
</tr>
<tr>
<td>animation</td>
<td>String</td>
Expand Down
1 change: 1 addition & 0 deletions examples/ant-design-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ var Test = React.createClass({
marginBottom: 22
}}>
<DatePicker
adjustOrientOnCalendarOverflow={false}
animation="slide-up"
trigger={<span className="rc-calendar-picker-icon" />}
formatter={this.props.formatter} calendar={calendar}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rc-calendar",
"version": "3.10.0",
"version": "3.10.1",
"description": "calendar ui component for react",
"keywords": [
"react",
Expand Down
10 changes: 6 additions & 4 deletions src/Picker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ class Picker extends React.Component {
points = ['br', 'tr'];
offset = [0, -5];
}

var adjustOrientOnCalendarOverflow = this.props.adjustOrientOnCalendarOverflow;
var align = domAlign(React.findDOMNode(this.calendarInstance), React.findDOMNode(this.inputInstance), {
points: points,
offset: offset,
overflow: {
adjustX: 1,
adjustY: 1
adjustX: adjustOrientOnCalendarOverflow,
adjustY: adjustOrientOnCalendarOverflow
}
});
points = align.points;
Expand Down Expand Up @@ -327,11 +327,13 @@ function prevent(e) {

Picker.propTypes = {
onChange: React.PropTypes.func,
renderCalendarToBody: React.PropTypes.bool
renderCalendarToBody: React.PropTypes.bool,
adjustOrientOnCalendarOverflow: React.PropTypes.bool
};

Picker.defaultProps = {
prefixCls: 'rc-calendar-picker',
adjustOrientOnCalendarOverflow: true,
renderCalendarToBody: false,
onChange() {
},
Expand Down

0 comments on commit f4205d9

Please sign in to comment.