react-big-calendar
Advanced tools
Comparing version 1.11.3 to 1.11.4
@@ -0,1 +1,8 @@ | ||
## [1.11.4](https://github.com/jquense/react-big-calendar/compare/v1.11.3...v1.11.4) (2024-04-15) | ||
### Bug Fixes | ||
* Correct selection issues ([def4934](https://github.com/jquense/react-big-calendar/commit/def4934b45804c1ccdeaa4c5c8ddb52b346b0d08)) | ||
## [1.11.3](https://github.com/jquense/react-big-calendar/compare/v1.11.2...v1.11.3) (2024-04-02) | ||
@@ -2,0 +9,0 @@ |
@@ -14,2 +14,3 @@ "use strict"; | ||
var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/callSuper")); | ||
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
@@ -29,3 +30,2 @@ var _react = _interopRequireWildcard(require("react")); | ||
_excluded2 = ["eventContainerWrapper"]; | ||
var slotMetrics; | ||
var DayColumn = /*#__PURE__*/function (_React$Component) { | ||
@@ -59,2 +59,4 @@ (0, _inherits2.default)(DayColumn, _React$Component); | ||
resizable = _this$props.resizable; | ||
var _assertThisInitialize = (0, _assertThisInitialized2.default)(_this), | ||
slotMetrics = _assertThisInitialize.slotMetrics; | ||
var messages = localizer.messages; | ||
@@ -143,3 +145,3 @@ var styledEvents = DayEventLayout.getStyledEvents({ | ||
var selectionState = function selectionState(point) { | ||
var currentSlot = slotMetrics.closestSlotFromPoint(point, (0, _Selection.getBoundsForNode)(node)); | ||
var currentSlot = _this.slotMetrics.closestSlotFromPoint(point, (0, _Selection.getBoundsForNode)(node)); | ||
if (!_this.state.selecting) { | ||
@@ -150,7 +152,7 @@ _this._initialSlot = currentSlot; | ||
if (localizer.lte(initialSlot, currentSlot)) { | ||
currentSlot = slotMetrics.nextSlot(currentSlot); | ||
currentSlot = _this.slotMetrics.nextSlot(currentSlot); | ||
} else if (localizer.gt(initialSlot, currentSlot)) { | ||
initialSlot = slotMetrics.nextSlot(initialSlot); | ||
initialSlot = _this.slotMetrics.nextSlot(initialSlot); | ||
} | ||
var selectRange = slotMetrics.getRange(localizer.min(initialSlot, currentSlot), localizer.max(initialSlot, currentSlot)); | ||
var selectRange = _this.slotMetrics.getRange(localizer.min(initialSlot, currentSlot), localizer.max(initialSlot, currentSlot)); | ||
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, selectRange), {}, { | ||
@@ -254,2 +256,3 @@ selecting: true, | ||
}; | ||
_this.slotMetrics = TimeSlotUtils.getSlotMetrics(_this.props); | ||
_this.containerRef = /*#__PURE__*/(0, _react.createRef)(); | ||
@@ -329,3 +332,3 @@ return _this; | ||
if (current >= min && current <= max) { | ||
var top = slotMetrics.getCurrentTimePosition(current); | ||
var top = this.slotMetrics.getCurrentTimePosition(current); | ||
this.intervalTriggered = true; | ||
@@ -356,2 +359,4 @@ this.setState({ | ||
components = (0, _objectWithoutProperties2.default)(_this$props5$componen, _excluded2); | ||
this.slotMetrics = this.slotMetrics.update(this.props); | ||
var slotMetrics = this.slotMetrics; | ||
var _this$state = this.state, | ||
@@ -414,8 +419,2 @@ selecting = _this$state.selecting, | ||
} | ||
}], [{ | ||
key: "getDerivedStateFromProps", | ||
value: function getDerivedStateFromProps(nextProps) { | ||
slotMetrics = slotMetrics ? slotMetrics.update(nextProps) : TimeSlotUtils.getSlotMetrics(nextProps); | ||
return null; | ||
} | ||
}]); | ||
@@ -422,0 +421,0 @@ return DayColumn; |
@@ -66,5 +66,9 @@ "use strict"; | ||
nextSlot: function nextSlot(slot) { | ||
var next = slots[Math.min(slots.indexOf(slot) + 1, slots.length - 1)]; | ||
// We cannot guarantee that the slot object must be in slots, | ||
// because after each update, a new slots array will be created. | ||
var next = slots[Math.min(slots.findIndex(function (s) { | ||
return s === slot || localizer.eq(s, slot); | ||
}) + 1, slots.length - 1)]; | ||
// in the case of the last slot we won't a long enough range so manually get it | ||
if (next === slot) next = localizer.add(slot, step, 'minutes'); | ||
if (localizer.eq(next, slot)) next = localizer.add(slot, step, 'minutes'); | ||
return next; | ||
@@ -71,0 +75,0 @@ }, |
{ | ||
"name": "react-big-calendar", | ||
"version": "1.11.3", | ||
"version": "1.11.4", | ||
"description": "Calendar! with events", | ||
@@ -5,0 +5,0 @@ "author": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
2545973
55787