Skip to content

Commit

Permalink
[fixed] all day event selection
Browse files Browse the repository at this point in the history
  • Loading branch information
jquense committed Jan 12, 2017
1 parent 6b4724d commit 5578559
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
2 changes: 0 additions & 2 deletions src/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ import {
, dateRangeFormat
, views as componentViews } from './utils/propTypes';

import localizer from './localizer'
import { notify } from './utils/helpers';
import { navigate, views } from './utils/constants';
import dates from './utils/dates';
import defaultFormats from './formats';
import viewLabel from './utils/viewLabel';
import moveDate from './utils/move';
Expand Down
25 changes: 13 additions & 12 deletions src/TimeGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@ export default class TimeGrid extends Component {
}
}

handleSelectAllDaySlot = (slots) => {
const { onSelectSlot } = this.props;
notify(onSelectSlot, {
slots,
start: slots[0],
end: slots[slots.length - 1]
})
}

render() {
let {
events
Expand Down Expand Up @@ -213,22 +222,13 @@ export default class TimeGrid extends Component {
}

renderHeader(range, events, width) {
let { messages, rtl, onSelectSlot, selectable, components } = this.props;
let { messages, rtl, selectable, components } = this.props;
let { isOverflowing } = this.state || {};

let style = {};
if (isOverflowing)
style[rtl ? 'marginLeft' : 'marginRight'] = scrollbarSize() + 'px';

function handleSelectSlot({ start, end }) {
let slots = range.slice(start, end + 1)
notify(onSelectSlot, {
slots,
start: slots[0],
end: slots[slots.length - 1]
})
}

return (
<div
ref='headerCell'
Expand Down Expand Up @@ -260,7 +260,7 @@ export default class TimeGrid extends Component {
events={events}
className='rbc-allday-cell'
selectable={selectable}
onSelectSlot={handleSelectSlot}
onSelectSlot={this.handleSelectAllDaySlot}
dateCellWrapper={components.dateCellWrapper}
eventComponent={this.props.components.event}
eventWrapperComponent={this.props.components.eventWrapper}
Expand Down Expand Up @@ -296,7 +296,8 @@ export default class TimeGrid extends Component {
label={localizer.format(date, dayFormat, culture)}
localizer={localizer}
format={dayFormat}
culture={culture} />
culture={culture}
/>
</a>
</div>
)
Expand Down

0 comments on commit 5578559

Please sign in to comment.