canvas-datagrid 0.27.0 → 0.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,23 @@ All notable changes to this project will be documented in this file.
7
7
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
8
8
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
9
9
 
10
+ ## 0.27.1 - 2026-11-07
11
+
12
+ ### Fixed
13
+
14
+ - The mouse wheel over a tree grid or cell grid that has reached the end of
15
+ its scroll range now scrolls the parent grid, and the wheel over a top-level
16
+ grid at the end of its range scrolls the page, the way nested scrolling
17
+ elements chain in HTML. 0.27.0 kept the wheel on the hovered grid even when
18
+ it had nothing left to scroll. The page no longer scrolls along while a tree
19
+ grid or cell grid is scrolling.
20
+ - Documentation: cell grids are created only for columns whose schema `type`
21
+ is `canvas-datagrid`; an array value on its own does not create one. The
22
+ `data` property docs claimed it did, and the `cellGridAttributes` and
23
+ `header.type` docs did not mention the type. The `rendercellgrid` event
24
+ fires on every draw, not once per cell grid. The "Cell Grids" section now
25
+ has an example and there is a "Create a cell grid" tutorial.
26
+
10
27
  ## 0.27.0 - 2026-11-07
11
28
 
12
29
  ### Changed
@@ -6396,26 +6396,41 @@ __webpack_require__.r(__webpack_exports__);
6396
6396
  if (self.disposed) {
6397
6397
  return;
6398
6398
  }
6399
+ //BUG Issue 42: https://github.com/TonyGermaneri/canvas-datagrid/issues/42
6400
+ //https://stackoverflow.com/questions/20110224/what-is-the-height-of-a-line-in-a-wheel-event-deltamode-dom-delta-line
6401
+ if (deltaMode === 1) {
6402
+ // line mode = 17 pixels per line
6403
+ deltaY = deltaY * 17;
6404
+ }
6399
6405
  // A child grid receives the wheel through its parent's `wheel` grid
6400
- // event (`ev`), not from the DOM. Cancelling and marking that event tells
6401
- // every ancestor that the grid under the pointer owns this wheel, so only
6402
- // the hovered grid scrolls, even when it has nothing left to scroll.
6406
+ // event (`ev`), not from the DOM. It leaves two marks on that event for
6407
+ // its ancestors: `hovered` says the pointer is over this grid or one of
6408
+ // its descendants, so the ancestor is not the hovered grid itself;
6409
+ // `claim` says this grid consumed the wheel, so no ancestor scrolls and
6410
+ // neither does the page. A hovered grid with nothing left to scroll in
6411
+ // the wheel's direction only marks itself hovered, so the wheel moves on
6412
+ // to the parent grid, and from the top-level grid to the page, the way
6413
+ // nested scrolling elements chain in HTML.
6414
+ function hovered() {
6415
+ if (ev !== e) {
6416
+ ev.hoveredChildGrid = true;
6417
+ }
6418
+ }
6403
6419
  function claim() {
6420
+ e.preventDefault();
6404
6421
  if (ev !== e) {
6405
6422
  ev.claimedByChildGrid = true;
6406
6423
  ev.preventDefault();
6407
6424
  }
6408
6425
  }
6409
- if (wheeling) {
6410
- if (ev === e) {
6411
- e.preventDefault();
6412
- } else {
6413
- claim();
6414
- }
6415
- return;
6426
+ function canScroll() {
6427
+ var box = self.scrollBox;
6428
+ return box.scrollTop < box.scrollHeight && deltaY > 0 || box.scrollLeft < box.scrollWidth && deltaX > 0 || box.scrollTop > 0 && deltaY < 0 || box.scrollLeft > 0 && deltaX < 0;
6416
6429
  }
6417
- if (self.hasFocus) {
6430
+ if (wheeling) {
6431
+ // still applying the previous wheel, this one belongs here too
6418
6432
  claim();
6433
+ return;
6419
6434
  }
6420
6435
  childEvent = {
6421
6436
  NativeEvent: e
@@ -6427,23 +6442,20 @@ __webpack_require__.r(__webpack_exports__);
6427
6442
  return;
6428
6443
  }
6429
6444
  self.touchHaltAnimation = true;
6445
+ if (!self.hasFocus && !childEvent.hoveredChildGrid) {
6446
+ return;
6447
+ }
6448
+ hovered();
6449
+ if (!canScroll()) {
6450
+ return;
6451
+ }
6452
+ claim();
6430
6453
  l = self.scrollBox.scrollLeft;
6431
6454
  t = self.scrollBox.scrollTop;
6432
- if (self.hasFocus) {
6433
- //BUG Issue 42: https://github.com/TonyGermaneri/canvas-datagrid/issues/42
6434
- //https://stackoverflow.com/questions/20110224/what-is-the-height-of-a-line-in-a-wheel-event-deltamode-dom-delta-line
6435
- if (deltaMode === 1) {
6436
- // line mode = 17 pixels per line
6437
- deltaY = deltaY * 17;
6438
- }
6439
- if (self.scrollBox.scrollTop < self.scrollBox.scrollHeight && deltaY > 0 || self.scrollBox.scrollLeft < self.scrollBox.scrollWidth && deltaX > 0 || self.scrollBox.scrollTop > 0 && deltaY < 0 || self.scrollBox.scrollLeft > 0 && deltaX < 0) {
6440
- ev.preventDefault(e);
6441
- }
6442
- wheeling = setTimeout(function () {
6443
- wheeling = undefined;
6444
- self.scrollBox.scrollTo(deltaX + l, deltaY + t);
6445
- }, 1);
6446
- }
6455
+ wheeling = setTimeout(function () {
6456
+ wheeling = undefined;
6457
+ self.scrollBox.scrollTo(deltaX + l, deltaY + t);
6458
+ }, 1);
6447
6459
  };
6448
6460
  self.pasteData = function (pasteValue, mimeType, startRowIndex, startColIndex, minRowsLength = 0, minColumnsLength = 0) {
6449
6461
  if (mimeType === 'text/html' && !(0,_util__WEBPACK_IMPORTED_MODULE_1__.isSupportedHtml)(pasteValue)) {