Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add new Calendar prop: doShowMoreDrillDown #1850

Merged
merged 1 commit into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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