Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 8 additions & 0 deletions src/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,14 @@ class Calendar extends React.Component {
*/
onShowMore: PropTypes.func,

/**
* Displays all events on the month view instead of
* having some hidden behind +{count} more. This will
* cause the rows in the month view to be scrollable if
* the number of events exceed the height of the row.
*/
showAllEvents: PropTypes.bool,

/**
* The selected event, if any.
*/
Expand Down
46 changes: 32 additions & 14 deletions src/DateContentRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,15 @@ class DateContentRow extends React.Component {
}

renderDummy = () => {
let { className, range, renderHeader } = this.props
let { className, range, renderHeader, showAllEvents } = this.props
return (
<div className={className}>
<div className="rbc-row-content">
<div
className={clsx(
'rbc-row-content',
showAllEvents && 'rbc-row-content-scrollable'
)}
>
{renderHeader && (
<div className="rbc-row" ref={this.createHeadingRef}>
{range.map(this.renderHeadingCell)}
Expand Down Expand Up @@ -118,6 +123,7 @@ class DateContentRow extends React.Component {
longPressThreshold,
isAllDay,
resizable,
showAllEvents,
} = this.props

if (renderForMeasure) return this.renderDummy()
Expand Down Expand Up @@ -159,24 +165,35 @@ class DateContentRow extends React.Component {
resourceId={resourceId}
/>

<div className="rbc-row-content">
<div
className={clsx(
'rbc-row-content',
showAllEvents && 'rbc-row-content-scrollable'
)}
>
{renderHeader && (
<div className="rbc-row " ref={this.createHeadingRef}>
{range.map(this.renderHeadingCell)}
</div>
)}
<WeekWrapper isAllDay={isAllDay} {...eventRowProps}>
{levels.map((segs, idx) => (
<EventRow key={idx} segments={segs} {...eventRowProps} />
))}
{!!extra.length && (
<EventEndingRow
segments={extra}
onShowMore={this.handleShowMore}
{...eventRowProps}
/>
<div
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we only add this wrapper if needed? I don't want to have to deal with potential flex box issues in other browsers due to a new div here

className={clsx(
showAllEvents && 'rbc-row-content-scroll-container'
)}
</WeekWrapper>
>
<WeekWrapper isAllDay={isAllDay} {...eventRowProps}>
{levels.map((segs, idx) => (
<EventRow key={idx} segments={segs} {...eventRowProps} />
))}
{!!extra.length && (
<EventEndingRow
segments={extra}
onShowMore={this.handleShowMore}
{...eventRowProps}
/>
)}
</WeekWrapper>
</div>
</div>
</div>
)
Expand All @@ -200,6 +217,7 @@ DateContentRow.propTypes = {
longPressThreshold: PropTypes.number,

onShowMore: PropTypes.func,
showAllEvents: PropTypes.bool,
onSelectSlot: PropTypes.func,
onSelect: PropTypes.func,
onSelectEnd: PropTypes.func,
Expand Down
5 changes: 4 additions & 1 deletion src/Month.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class MonthView extends React.Component {
longPressThreshold,
accessors,
getters,
showAllEvents,
} = this.props

const { needLimitMeasure, rowLimit } = this.state
Expand All @@ -120,7 +121,7 @@ class MonthView extends React.Component {
date={date}
range={week}
events={events}
maxRows={rowLimit}
maxRows={showAllEvents ? Infinity : rowLimit}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you double check that no code assumes this number is bounded? e.g. uses it as the upper bound in a loop

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just confirmed that no code assumes this number is bound. It is only used when determining "extra" segments here

selected={selected}
selectable={selectable}
components={components}
Expand All @@ -137,6 +138,7 @@ class MonthView extends React.Component {
longPressThreshold={longPressThreshold}
rtl={this.props.rtl}
resizable={this.props.resizable}
showAllEvents={showAllEvents}
/>
)
}
Expand Down Expand Up @@ -342,6 +344,7 @@ MonthView.propTypes = {
onDoubleClickEvent: PropTypes.func,
onKeyPressEvent: PropTypes.func,
onShowMore: PropTypes.func,
showAllEvents: PropTypes.bool,
onDrillDown: PropTypes.func,
getDrilldownView: PropTypes.func.isRequired,

Expand Down
10 changes: 10 additions & 0 deletions src/less/styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@
z-index: 4;
}

.rbc-row-content-scrollable {
display: flex;
flex-direction: column;
height: 100%;

.rbc-row-content-scroll-container {
overflow-y: scroll;
}
}

.rbc-today {
background-color: @today-highlight-bg;
}
Expand Down
10 changes: 10 additions & 0 deletions src/sass/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@
z-index: 4;
}

.rbc-row-content-scrollable {
display: flex;
flex-direction: column;
height: 100%;

.rbc-row-content-scroll-container {
overflow-y: scroll;
}
}

.rbc-today {
background-color: $today-highlight-bg;
}
Expand Down