react-big-calendar
Advanced tools
Comparing version 1.11.2 to 1.11.3
@@ -0,1 +1,8 @@ | ||
## [1.11.3](https://github.com/jquense/react-big-calendar/compare/v1.11.2...v1.11.3) (2024-04-02) | ||
### Bug Fixes | ||
* **Selection:** handling of terminating event ([937b4c5](https://github.com/jquense/react-big-calendar/commit/937b4c5019a327310d7e27dbbf6f6bd71876aaf4)) | ||
## [1.11.2](https://github.com/jquense/react-big-calendar/compare/v1.11.1...v1.11.2) (2024-03-12) | ||
@@ -2,0 +9,0 @@ |
@@ -71,2 +71,4 @@ "use strict"; | ||
(0, _classCallCheck2.default)(this, Selection); | ||
this._initialEvent = null; | ||
this.selecting = false; | ||
this.isDetached = false; | ||
@@ -122,2 +124,7 @@ this.container = node; | ||
value: function teardown() { | ||
this._initialEvent = null; | ||
this._initialEventData = null; | ||
this._selectRect = null; | ||
this.selecting = false; | ||
this._lastClickData = null; | ||
this.isDetached = true; | ||
@@ -252,2 +259,3 @@ this._listeners = Object.create(null); | ||
value: function _handleInitialEvent(e) { | ||
this._initialEvent = e; | ||
if (this.isDetached) { | ||
@@ -326,18 +334,22 @@ return; | ||
value: function _handleTerminatingEvent(e) { | ||
var _getEventCoordinates4 = getEventCoordinates(e), | ||
pageX = _getEventCoordinates4.pageX, | ||
pageY = _getEventCoordinates4.pageY; | ||
var selecting = this.selecting; | ||
var bounds = this._selectRect; | ||
// If it's not in selecting state, it's a click event | ||
if (!selecting && e.type.includes('key')) { | ||
e = this._initialEvent; | ||
} | ||
this.selecting = false; | ||
this._removeEndListener && this._removeEndListener(); | ||
this._removeMoveListener && this._removeMoveListener(); | ||
if (!this._initialEventData) return; | ||
this._selectRect = null; | ||
this._initialEvent = null; | ||
this._initialEventData = null; | ||
this._lastClickData = null; | ||
if (!e) return; | ||
var inRoot = !this.container || (0, _contains.default)(this.container(), e.target); | ||
var isWithinValidContainer = this._isWithinValidContainer(e); | ||
var bounds = this._selectRect; | ||
var click = this.isClick(pageX, pageY); | ||
this._initialEventData = null; | ||
if (e.key === 'Escape' || !isWithinValidContainer) { | ||
return this.emit('reset'); | ||
} | ||
if (click && inRoot) { | ||
if (!selecting && inRoot) { | ||
return this._handleClickEvent(e); | ||
@@ -347,3 +359,3 @@ } | ||
// User drag-clicked in the Selectable area | ||
if (!click) return this.emit('select', bounds); | ||
if (selecting) return this.emit('select', bounds); | ||
return this.emit('reset'); | ||
@@ -354,7 +366,7 @@ } | ||
value: function _handleClickEvent(e) { | ||
var _getEventCoordinates5 = getEventCoordinates(e), | ||
pageX = _getEventCoordinates5.pageX, | ||
pageY = _getEventCoordinates5.pageY, | ||
clientX = _getEventCoordinates5.clientX, | ||
clientY = _getEventCoordinates5.clientY; | ||
var _getEventCoordinates4 = getEventCoordinates(e), | ||
pageX = _getEventCoordinates4.pageX, | ||
pageY = _getEventCoordinates4.pageY, | ||
clientX = _getEventCoordinates4.clientX, | ||
clientY = _getEventCoordinates4.clientY; | ||
var now = new Date().getTime(); | ||
@@ -392,5 +404,5 @@ if (this._lastClickData && now - this._lastClickData.timestamp < clickInterval) { | ||
y = _this$_initialEventDa.y; | ||
var _getEventCoordinates6 = getEventCoordinates(e), | ||
pageX = _getEventCoordinates6.pageX, | ||
pageY = _getEventCoordinates6.pageY; | ||
var _getEventCoordinates5 = getEventCoordinates(e), | ||
pageX = _getEventCoordinates5.pageX, | ||
pageY = _getEventCoordinates5.pageY; | ||
var w = Math.abs(x - pageX); | ||
@@ -401,21 +413,23 @@ var h = Math.abs(y - pageY); | ||
old = this.selecting; | ||
var click = this.isClick(pageX, pageY); | ||
// Prevent emitting selectStart event until mouse is moved. | ||
// in Chrome on Windows, mouseMove event may be fired just after mouseDown event. | ||
if (this.isClick(pageX, pageY) && !old && !(w || h)) { | ||
if (click && !old && !(w || h)) { | ||
return; | ||
} | ||
this.selecting = true; | ||
this._selectRect = { | ||
top: top, | ||
left: left, | ||
x: pageX, | ||
y: pageY, | ||
right: left + w, | ||
bottom: top + h | ||
}; | ||
if (!old) { | ||
if (!old && !click) { | ||
this.emit('selectStart', this._initialEventData); | ||
} | ||
if (!this.isClick(pageX, pageY)) this.emit('selecting', this._selectRect); | ||
if (!click) { | ||
this.selecting = true; | ||
this._selectRect = { | ||
top: top, | ||
left: left, | ||
x: pageX, | ||
y: pageY, | ||
right: left + w, | ||
bottom: top + h | ||
}; | ||
this.emit('selecting', this._selectRect); | ||
} | ||
e.preventDefault(); | ||
@@ -422,0 +436,0 @@ } |
{ | ||
"name": "react-big-calendar", | ||
"version": "1.11.2", | ||
"version": "1.11.3", | ||
"description": "Calendar! with events", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -168,3 +168,3 @@ # react-big-calendar | ||
Help us improve Big Calendar! Join us on [Slack](https://join.slack.com/t/bigcalendar/shared_invite/zt-2cerpqegz-mGzcbm7LxYLFPjcTa0gLgw). | ||
Help us improve Big Calendar! Join us on [Slack](https://join.slack.com/t/bigcalendar/shared_invite/zt-2fapdf4pj-oEF51KD2XgHKudkXEhk2lQ). | ||
(Slack invite links do expire. If you can't get in, just file an issue and we'll get a new link.) |
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
2544514
55779