From 6a3d00f24ea2664185500dd89f9eeff8734040f8 Mon Sep 17 00:00:00 2001 From: Teryn Gull Date: Wed, 27 Jan 2021 15:48:26 -0700 Subject: [PATCH] Add new doShowMoreDrillDown prop to help properly control the "show more" action --- src/Calendar.js | 10 ++++++++++ src/Month.js | 11 +++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Calendar.js b/src/Calendar.js index 81b75f9d4..aa7b281f6 100644 --- a/src/Calendar.js +++ b/src/Calendar.js @@ -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 @@ -764,6 +771,7 @@ class Calendar extends React.Component { step: 30, length: 30, + doShowMoreDrillDown: true, drilldownView: views.DAY, titleAccessor: 'title', @@ -893,6 +901,7 @@ class Calendar extends React.Component { length, showMultiDayTimes, onShowMore, + doShowMoreDrillDown, components: _0, formats: _1, messages: _2, @@ -950,6 +959,7 @@ class Calendar extends React.Component { onKeyPressEvent={this.handleKeyPressEvent} onSelectSlot={this.handleSelectSlot} onShowMore={onShowMore} + doShowMoreDrillDown={doShowMoreDrillDown} /> ) diff --git a/src/Month.js b/src/Month.js index 70cc667c2..4e03245c5 100644 --- a/src/Month.js +++ b/src/Month.js @@ -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() @@ -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]) } @@ -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,