+
{children}
)
}
+DayColumnWrapper.propTypes = {
+ innerRef: PropTypes.object.isRequired,
+}
+
export default DayColumnWrapper
diff --git a/src/Month.js b/src/Month.js
index 87264306f..94ee30e3f 100644
--- a/src/Month.js
+++ b/src/Month.js
@@ -1,6 +1,5 @@
import PropTypes from 'prop-types'
import React from 'react'
-import { findDOMNode } from 'react-dom'
import clsx from 'clsx'
import chunk from 'lodash/chunk'
@@ -28,6 +27,7 @@ class MonthView extends React.Component {
this._bgRows = []
this._pendingSelection = []
this.slotRowRef = React.createRef()
+ this.ref = React.createRef()
this.state = {
rowLimit: 5,
needLimitMeasure: true,
@@ -69,7 +69,7 @@ class MonthView extends React.Component {
}
getContainer = () => {
- return findDOMNode(this)
+ return this.ref.current
}
render() {
@@ -84,6 +84,7 @@ class MonthView extends React.Component {
className={clsx('rbc-month-view', className)}
role="table"
aria-label="Month View"
+ ref={this.ref}
>
{this.renderHeaders(weeks[0])}
@@ -290,7 +291,7 @@ class MonthView extends React.Component {
this.clearSelection()
if (popup) {
- let position = getPosition(cell, findDOMNode(this))
+ let position = getPosition(cell, this.ref.current)
this.setState({
overlay: { date, events, position, target },
diff --git a/src/TimeGrid.js b/src/TimeGrid.js
index b250b83b5..9dfab1515 100644
--- a/src/TimeGrid.js
+++ b/src/TimeGrid.js
@@ -2,7 +2,6 @@ import PropTypes from 'prop-types'
import clsx from 'clsx'
import * as animationFrame from 'dom-helpers/animationFrame'
import React, { Component } from 'react'
-import { findDOMNode } from 'react-dom'
import memoize from 'memoize-one'
import DayColumn from './DayColumn'
@@ -23,6 +22,7 @@ export default class TimeGrid extends Component {
this.scrollRef = React.createRef()
this.contentRef = React.createRef()
+ this.gutterRef = React.createRef()
this._scrollRatio = null
}
@@ -83,10 +83,6 @@ export default class TimeGrid extends Component {
}
}
- gutterRef = ref => {
- this.gutter = ref && findDOMNode(ref)
- }
-
handleSelectAlldayEvent = (...args) => {
//cancel any pending selections so only the event click goes through.
this.clearSelection()
@@ -260,7 +256,7 @@ export default class TimeGrid extends Component {
>
{
- const width = getWidth(this.gutter)
+ const width = getWidth(this.gutterRef.current)
if (width && this.state.gutterWidth !== width) {
this.setState({ gutterWidth: width })
diff --git a/src/TimeGridHeader.js b/src/TimeGridHeader.js
index ef511caa6..60f0c1e5f 100644
--- a/src/TimeGridHeader.js
+++ b/src/TimeGridHeader.js
@@ -14,7 +14,7 @@ class TimeGridHeader extends React.Component {
notify(this.props.onDrillDown, [date, view])
}
- renderHeaderCells(range) {
+ renderHeaderCells(range, resourceId) {
let {
localizer,
getDrilldownView,
@@ -29,7 +29,7 @@ class TimeGridHeader extends React.Component {
let drilldownView = getDrilldownView(date)
let label = localizer.format(date, 'dayFormat')
- const { className, style } = dayProp(date)
+ const { className, style } = dayProp(date, resourceId)
let header = (
@@ -164,7 +164,7 @@ class TimeGridHeader extends React.Component {
range.length <= 1 ? ' rbc-time-header-cell-single-day' : ''
}`}
>
- {this.renderHeaderCells(range)}
+ {this.renderHeaderCells(range, id)}
+
{this.slotMetrics.groups.map((grp, idx) => {
return (
{
diff --git a/src/addons/dragAndDrop/README.md b/src/addons/dragAndDrop/README.md
index d7db7fe63..40a5c7544 100644
--- a/src/addons/dragAndDrop/README.md
+++ b/src/addons/dragAndDrop/README.md
@@ -23,12 +23,14 @@ return (
Set `resizable` to false in your calendar if you don't want events to be resizable.
`resizable` is set to true by default.
-The HOC adds `onEventDrop`, `onEventResize`, and `onDragStart` callback properties if the events are
+The HOC adds `onEventDrop`, `onEventResize`, `onEventResizing`, `onEventDragging` and `onDragStart` callback properties if the events are
moved or resized. These callbacks are called with these signatures:
```js
function onEventDrop({ event, start, end, allDay }) {...}
- function onEventResize(type, { event, start, end, allDay }) {...} // type is always 'drop'
+ function onEventDragging({ event, start, end, resourceId }) {...} // when return "false" prevent dragging
+ function onEventResize({ event, start, end, allDay }) {...}
+ function onEventResizing({ event, start, end }) {...} // when return "false" prevent resizing
function onDragStart({ event, action, direction }) {...}
```
diff --git a/src/addons/dragAndDrop/withDragAndDrop.js b/src/addons/dragAndDrop/withDragAndDrop.js
index 77d418615..597abbbf0 100644
--- a/src/addons/dragAndDrop/withDragAndDrop.js
+++ b/src/addons/dragAndDrop/withDragAndDrop.js
@@ -19,6 +19,8 @@ export default function withDragAndDrop(Calendar) {
onDragStart: PropTypes.func,
onDragOver: PropTypes.func,
onDropFromOutside: PropTypes.func,
+ onEventResizing: PropTypes.func,
+ onEventDragging: PropTypes.func,
dragFromOutsideItem: PropTypes.func,
@@ -57,6 +59,8 @@ export default function withDragAndDrop(Calendar) {
onEnd: this.handleInteractionEnd,
onBeginAction: this.handleBeginAction,
onDropFromOutside: this.props.onDropFromOutside,
+ onResizing: this.props.onEventResizing,
+ onDragging: this.props.onEventDragging,
dragFromOutsideItem: this.props.dragFromOutsideItem,
draggableAccessor: this.props.draggableAccessor,
resizableAccessor: this.props.resizableAccessor,