Skip to content

Commit

Permalink
Add new doShowMoreDrillDown prop to help properly control the "show m…
Browse files Browse the repository at this point in the history
…ore" action
  • Loading branch information
Teryn Gull committed Jan 27, 2021
1 parent 8ffe39d commit 6a3d00f
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 @@ -387,6 +387,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 @@ -764,6 +771,7 @@ class Calendar extends React.Component {
step: 30,
length: 30,

doShowMoreDrillDown: true,
drilldownView: views.DAY,

titleAccessor: 'title',
Expand Down Expand Up @@ -893,6 +901,7 @@ class Calendar extends React.Component {
length,
showMultiDayTimes,
onShowMore,
doShowMoreDrillDown,
components: _0,
formats: _1,
messages: _2,
Expand Down Expand Up @@ -950,6 +959,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 @@ -268,7 +268,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 @@ -278,7 +284,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 @@ -345,6 +351,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 6a3d00f

Please sign in to comment.