handsontable 0.0.0-next-5d8c97d-20231228 → 0.0.0-next-3388fcb-20240102

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of handsontable might be problematic. Click here for more details.

package/helpers/mixed.js CHANGED
@@ -134,7 +134,7 @@ const domMessages = {
134
134
  function _injectProductInfo(key, element) {
135
135
  const hasValidType = !isEmpty(key);
136
136
  const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
137
- const hotVersion = "0.0.0-next-5d8c97d-20231228";
137
+ const hotVersion = "0.0.0-next-3388fcb-20240102";
138
138
  let keyValidityDate;
139
139
  let consoleMessageState = 'invalid';
140
140
  let domMessageState = 'invalid';
package/helpers/mixed.mjs CHANGED
@@ -124,7 +124,7 @@ const domMessages = {
124
124
  export function _injectProductInfo(key, element) {
125
125
  const hasValidType = !isEmpty(key);
126
126
  const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
127
- const hotVersion = "0.0.0-next-5d8c97d-20231228";
127
+ const hotVersion = "0.0.0-next-3388fcb-20240102";
128
128
  let keyValidityDate;
129
129
  let consoleMessageState = 'invalid';
130
130
  let domMessageState = 'invalid';
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "url": "https://github.com/handsontable/handsontable/issues"
11
11
  },
12
12
  "author": "Handsoncode <hello@handsontable.com>",
13
- "version": "0.0.0-next-5d8c97d-20231228",
13
+ "version": "0.0.0-next-3388fcb-20240102",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",
package/pluginHooks.js CHANGED
@@ -414,7 +414,7 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
414
414
  */
415
415
  'afterUpdateData',
416
416
  /**
417
- * Fired after a scroll event, which is identified as a momentum scroll (e.g. On an iPad).
417
+ * Fired after a scroll event, which is identified as a momentum scroll.
418
418
  *
419
419
  * @event Hooks#afterMomentumScroll
420
420
  */
package/pluginHooks.mjs CHANGED
@@ -410,7 +410,7 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
410
410
  */
411
411
  'afterUpdateData',
412
412
  /**
413
- * Fired after a scroll event, which is identified as a momentum scroll (e.g. On an iPad).
413
+ * Fired after a scroll event, which is identified as a momentum scroll.
414
414
  *
415
415
  * @event Hooks#afterMomentumScroll
416
416
  */
@@ -1,6 +1,13 @@
1
1
  import Core from '../../core';
2
2
  import { BasePlugin } from '../base';
3
3
 
4
+ interface DOMBoundaries {
5
+ left: number;
6
+ right: number;
7
+ top: number;
8
+ bottom: number;
9
+ }
10
+
4
11
  export type Settings = boolean;
5
12
 
6
13
  export class DragToScroll extends BasePlugin {
@@ -9,7 +16,7 @@ export class DragToScroll extends BasePlugin {
9
16
  boundaries: DOMRect | undefined;
10
17
 
11
18
  isEnabled(): boolean;
12
- setBoundaries(boundaries: DOMRect): void;
19
+ setBoundaries(boundaries: DOMRect | DOMBoundaries): void;
13
20
  setCallback(callback: () => void): void;
14
21
  check(x: number, y: number): void;
15
22
  }
@@ -108,9 +108,16 @@ class DragToScroll extends _base.BasePlugin {
108
108
  /**
109
109
  * Sets the value of the visible element.
110
110
  *
111
- * @param {DOMRect} boundaries An object with coordinates compatible with DOMRect.
111
+ * @param {DOMRect|{left: number, right: number, top: number, bottom: number}} [boundaries] An object with
112
+ * coordinates. Contains the window boundaries by default. The object is compatible with DOMRect.
112
113
  */
113
- setBoundaries(boundaries) {
114
+ setBoundaries() {
115
+ let boundaries = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
116
+ left: 0,
117
+ right: this.hot.rootWindow.innerWidth,
118
+ top: 0,
119
+ bottom: this.hot.rootWindow.innerHeight
120
+ };
114
121
  this.boundaries = boundaries;
115
122
  }
116
123
 
@@ -124,7 +131,7 @@ class DragToScroll extends _base.BasePlugin {
124
131
  }
125
132
 
126
133
  /**
127
- * Checks if the mouse position (X, Y) is outside of the viewport and fires a callback with calculated X an Y diffs
134
+ * Checks if the mouse position (X, Y) is outside the viewport and fires a callback with calculated X an Y diffs
128
135
  * between passed boundaries.
129
136
  *
130
137
  * @param {number} x Mouse X coordinate to check.
@@ -229,24 +236,13 @@ function _setupListening2(event) {
229
236
  if ((0, _event.isRightClick)(event)) {
230
237
  return;
231
238
  }
232
- const scrollHandler = this.hot.view._wt.wtTable.holder; // native scroll
233
-
234
- if (scrollHandler === this.hot.rootWindow) {
235
- // not much we can do currently
236
- return;
237
- }
238
- this.setBoundaries(scrollHandler.getBoundingClientRect());
239
+ const scrollHandler = this.hot.view._wt.wtOverlays.topOverlay.mainTableScrollableElement;
240
+ this.setBoundaries(scrollHandler !== this.hot.rootWindow ? scrollHandler.getBoundingClientRect() : undefined);
239
241
  this.setCallback((scrollX, scrollY) => {
240
- if (scrollX < 0) {
241
- scrollHandler.scrollLeft -= 50;
242
- } else if (scrollX > 0) {
243
- scrollHandler.scrollLeft += 50;
244
- }
245
- if (scrollY < 0) {
246
- scrollHandler.scrollTop -= 20;
247
- } else if (scrollY > 0) {
248
- scrollHandler.scrollTop += 20;
249
- }
242
+ var _scrollHandler$scroll, _scrollHandler$scroll2;
243
+ const horizontalScrollValue = (_scrollHandler$scroll = scrollHandler.scrollLeft) !== null && _scrollHandler$scroll !== void 0 ? _scrollHandler$scroll : scrollHandler.scrollX;
244
+ const verticalScrollValue = (_scrollHandler$scroll2 = scrollHandler.scrollTop) !== null && _scrollHandler$scroll2 !== void 0 ? _scrollHandler$scroll2 : scrollHandler.scrollY;
245
+ scrollHandler.scroll(horizontalScrollValue + Math.sign(scrollX) * 50, verticalScrollValue + Math.sign(scrollY) * 20);
250
246
  });
251
247
  this.listen();
252
248
  }
@@ -105,9 +105,16 @@ export class DragToScroll extends BasePlugin {
105
105
  /**
106
106
  * Sets the value of the visible element.
107
107
  *
108
- * @param {DOMRect} boundaries An object with coordinates compatible with DOMRect.
108
+ * @param {DOMRect|{left: number, right: number, top: number, bottom: number}} [boundaries] An object with
109
+ * coordinates. Contains the window boundaries by default. The object is compatible with DOMRect.
109
110
  */
110
- setBoundaries(boundaries) {
111
+ setBoundaries() {
112
+ let boundaries = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
113
+ left: 0,
114
+ right: this.hot.rootWindow.innerWidth,
115
+ top: 0,
116
+ bottom: this.hot.rootWindow.innerHeight
117
+ };
111
118
  this.boundaries = boundaries;
112
119
  }
113
120
 
@@ -121,7 +128,7 @@ export class DragToScroll extends BasePlugin {
121
128
  }
122
129
 
123
130
  /**
124
- * Checks if the mouse position (X, Y) is outside of the viewport and fires a callback with calculated X an Y diffs
131
+ * Checks if the mouse position (X, Y) is outside the viewport and fires a callback with calculated X an Y diffs
125
132
  * between passed boundaries.
126
133
  *
127
134
  * @param {number} x Mouse X coordinate to check.
@@ -225,24 +232,13 @@ function _setupListening2(event) {
225
232
  if (isRightClick(event)) {
226
233
  return;
227
234
  }
228
- const scrollHandler = this.hot.view._wt.wtTable.holder; // native scroll
229
-
230
- if (scrollHandler === this.hot.rootWindow) {
231
- // not much we can do currently
232
- return;
233
- }
234
- this.setBoundaries(scrollHandler.getBoundingClientRect());
235
+ const scrollHandler = this.hot.view._wt.wtOverlays.topOverlay.mainTableScrollableElement;
236
+ this.setBoundaries(scrollHandler !== this.hot.rootWindow ? scrollHandler.getBoundingClientRect() : undefined);
235
237
  this.setCallback((scrollX, scrollY) => {
236
- if (scrollX < 0) {
237
- scrollHandler.scrollLeft -= 50;
238
- } else if (scrollX > 0) {
239
- scrollHandler.scrollLeft += 50;
240
- }
241
- if (scrollY < 0) {
242
- scrollHandler.scrollTop -= 20;
243
- } else if (scrollY > 0) {
244
- scrollHandler.scrollTop += 20;
245
- }
238
+ var _scrollHandler$scroll, _scrollHandler$scroll2;
239
+ const horizontalScrollValue = (_scrollHandler$scroll = scrollHandler.scrollLeft) !== null && _scrollHandler$scroll !== void 0 ? _scrollHandler$scroll : scrollHandler.scrollX;
240
+ const verticalScrollValue = (_scrollHandler$scroll2 = scrollHandler.scrollTop) !== null && _scrollHandler$scroll2 !== void 0 ? _scrollHandler$scroll2 : scrollHandler.scrollY;
241
+ scrollHandler.scroll(horizontalScrollValue + Math.sign(scrollX) * 50, verticalScrollValue + Math.sign(scrollY) * 20);
246
242
  });
247
243
  this.listen();
248
244
  }