Skip to content

Commit

Permalink
Merge pull request #1850 from teryngull/master
Browse files Browse the repository at this point in the history
feat: Add new Calendar prop: `doShowMoreDrillDown`
  • Loading branch information
pietrofxq authored May 27, 2021
2 parents cf090ef + 6a3d00f commit 7e87e48
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,13 @@ class Calendar extends React.Component {
*/
views: componentViews,

/**
* Determines whether the drill down should occur when clicking on the "+_x_ more" link.
* If `popup` is false, and `doShowMoreDrillDown` is true, the drill down will occur as usual.
* If `popup` is false, and `doShowMoreDrillDown` is false, the drill down will not occur and the `onShowMore` function will trigger.
*/
doShowMoreDrillDown: PropTypes.bool,

/**
* The string name of the destination view for drill-down actions, such
* as clicking a date header, or the truncated events links. If
Expand Down Expand Up @@ -788,6 +795,7 @@ class Calendar extends React.Component {
step: 30,
length: 30,

doShowMoreDrillDown: true,
drilldownView: views.DAY,

titleAccessor: 'title',
Expand Down Expand Up @@ -924,6 +932,7 @@ class Calendar extends React.Component {
length,
showMultiDayTimes,
onShowMore,
doShowMoreDrillDown,
components: _0,
formats: _1,
messages: _2,
Expand Down Expand Up @@ -982,6 +991,7 @@ class Calendar extends React.Component {
onKeyPressEvent={this.handleKeyPressEvent}
onSelectSlot={this.handleSelectSlot}
onShowMore={onShowMore}
doShowMoreDrillDown={doShowMoreDrillDown}
/>
</div>
)
Expand Down
11 changes: 9 additions & 2 deletions src/Month.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,13 @@ class MonthView extends React.Component {
}

handleShowMore = (events, date, cell, slot, target) => {
const { popup, onDrillDown, onShowMore, getDrilldownView } = this.props
const {
popup,
onDrillDown,
onShowMore,
getDrilldownView,
doShowMoreDrillDown,
} = this.props
//cancel any pending selections so only the event click goes through.
this.clearSelection()

Expand All @@ -283,7 +289,7 @@ class MonthView extends React.Component {
this.setState({
overlay: { date, events, position, target },
})
} else {
} else if (doShowMoreDrillDown) {
notify(onDrillDown, [date, getDrilldownView(date) || views.DAY])
}

Expand Down Expand Up @@ -354,6 +360,7 @@ MonthView.propTypes = {
onKeyPressEvent: PropTypes.func,
onShowMore: PropTypes.func,
showAllEvents: PropTypes.bool,
doShowMoreDrillDown: PropTypes.bool,
onDrillDown: PropTypes.func,
getDrilldownView: PropTypes.func.isRequired,

Expand Down

0 comments on commit 7e87e48

Please sign in to comment.