handsontable 0.0.0-next-1af4e47-20241125 → 0.0.0-next-fcb9b77-20241126

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.

@@ -25,8 +25,8 @@
25
25
  * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING FROM
26
26
  * USE OR INABILITY TO USE THIS SOFTWARE.
27
27
  *
28
- * Version: 0.0.0-next-1af4e47-20241125
29
- * Release date: 17/10/2024 (built at 25/11/2024 11:12:57)
28
+ * Version: 0.0.0-next-fcb9b77-20241126
29
+ * Release date: 17/10/2024 (built at 26/11/2024 09:17:24)
30
30
  */
31
31
  (function webpackUniversalModuleDefinition(root, factory) {
32
32
  if(typeof exports === 'object' && typeof module === 'object')
@@ -107,8 +107,8 @@ Handsontable.hooks = _hooks.Hooks.getSingleton();
107
107
  Handsontable.CellCoords = _src.CellCoords;
108
108
  Handsontable.CellRange = _src.CellRange;
109
109
  Handsontable.packageName = 'handsontable';
110
- Handsontable.buildDate = "25/11/2024 11:12:57";
111
- Handsontable.version = "0.0.0-next-1af4e47-20241125";
110
+ Handsontable.buildDate = "26/11/2024 09:17:24";
111
+ Handsontable.version = "0.0.0-next-fcb9b77-20241126";
112
112
  Handsontable.languages = {
113
113
  dictionaryKeys: _registry.dictionaryKeys,
114
114
  getLanguageDictionary: _registry.getLanguageDictionary,
@@ -4244,22 +4244,8 @@ function Core(rootElement, userSettings) {
4244
4244
  const {
4245
4245
  row,
4246
4246
  col,
4247
- verticalSnap,
4248
- horizontalSnap,
4249
4247
  considerHiddenIndexes
4250
4248
  } = (_options = options) !== null && _options !== void 0 ? _options : {};
4251
- let snapToTop;
4252
- let snapToBottom;
4253
- let snapToInlineStart;
4254
- let snapToInlineEnd;
4255
- if (verticalSnap !== undefined) {
4256
- snapToTop = verticalSnap === 'top';
4257
- snapToBottom = !snapToTop;
4258
- }
4259
- if (horizontalSnap !== undefined) {
4260
- snapToInlineStart = horizontalSnap === 'start';
4261
- snapToInlineEnd = !snapToInlineStart;
4262
- }
4263
4249
  let renderableRow = row;
4264
4250
  let renderableColumn = col;
4265
4251
  if (considerHiddenIndexes === undefined || considerHiddenIndexes) {
@@ -4276,13 +4262,13 @@ function Core(rootElement, userSettings) {
4276
4262
  const isRowInteger = Number.isInteger(renderableRow);
4277
4263
  const isColumnInteger = Number.isInteger(renderableColumn);
4278
4264
  if (isRowInteger && renderableRow >= 0 && isColumnInteger && renderableColumn >= 0) {
4279
- return instance.view.scrollViewport(instance._createCellCoords(renderableRow, renderableColumn), snapToTop, snapToInlineEnd, snapToBottom, snapToInlineStart);
4265
+ return instance.view.scrollViewport(instance._createCellCoords(renderableRow, renderableColumn), options.horizontalSnap, options.verticalSnap);
4280
4266
  }
4281
4267
  if (isRowInteger && renderableRow >= 0 && (isColumnInteger && renderableColumn < 0 || !isColumnInteger)) {
4282
- return instance.view.scrollViewportVertically(renderableRow, snapToTop, snapToBottom);
4268
+ return instance.view.scrollViewportVertically(renderableRow, options.verticalSnap);
4283
4269
  }
4284
4270
  if (isColumnInteger && renderableColumn >= 0 && (isRowInteger && renderableRow < 0 || !isRowInteger)) {
4285
- return instance.view.scrollViewportHorizontally(renderableColumn, snapToInlineEnd, snapToInlineStart);
4271
+ return instance.view.scrollViewportHorizontally(renderableColumn, options.horizontalSnap);
4286
4272
  }
4287
4273
  return false;
4288
4274
  };
@@ -10023,7 +10009,7 @@ const domMessages = {
10023
10009
  function _injectProductInfo(key, element) {
10024
10010
  const hasValidType = !isEmpty(key);
10025
10011
  const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
10026
- const hotVersion = "0.0.0-next-1af4e47-20241125";
10012
+ const hotVersion = "0.0.0-next-fcb9b77-20241126";
10027
10013
  let keyValidityDate;
10028
10014
  let consoleMessageState = 'invalid';
10029
10015
  let domMessageState = 'invalid';
@@ -13403,6 +13389,10 @@ const REGISTERED_HOOKS = exports.REGISTERED_HOOKS = [/* eslint-disable jsdoc/req
13403
13389
  * @since 14.0.0
13404
13390
  * @event Hooks#beforeViewportScrollVertically
13405
13391
  * @param {number} visualRow Visual row index.
13392
+ * @param {'auto' | 'top' | 'bottom'} [snapping='auto'] If `'top'`, viewport is scrolled to show
13393
+ * the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on
13394
+ * the bottom of the table. When `'auto'`, the viewport is scrolled only when the row is outside of
13395
+ * the viewport.
13406
13396
  * @returns {number | boolean} Returns modified row index (or the same as passed in the method argument) to which
13407
13397
  * the viewport will be scrolled. If the returned value is `false`, the scrolling will be canceled.
13408
13398
  */
@@ -13414,6 +13404,9 @@ const REGISTERED_HOOKS = exports.REGISTERED_HOOKS = [/* eslint-disable jsdoc/req
13414
13404
  * @since 14.0.0
13415
13405
  * @event Hooks#beforeViewportScrollHorizontally
13416
13406
  * @param {number} visualColumn Visual column index.
13407
+ * @param {'auto' | 'start' | 'end'} [snapping='auto'] If `'start'`, viewport is scrolled to show
13408
+ * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
13409
+ * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
13417
13410
  * @returns {number | boolean} Returns modified column index (or the same as passed in the method argument) to which
13418
13411
  * the viewport will be scrolled. If the returned value is `false`, the scrolling will be canceled.
13419
13412
  */
@@ -17828,38 +17821,43 @@ class TableView {
17828
17821
  * Scroll viewport to a cell.
17829
17822
  *
17830
17823
  * @param {CellCoords} coords Renderable cell coordinates.
17831
- * @param {boolean} [snapToTop] If `true`, viewport is scrolled to show the cell on the top of the table.
17832
- * @param {boolean} [snapToRight] If `true`, viewport is scrolled to show the cell on the right side of the table.
17833
- * @param {boolean} [snapToBottom] If `true`, viewport is scrolled to show the cell on the bottom side of the table.
17834
- * @param {boolean} [snapToLeft] If `true`, viewport is scrolled to show the cell on the left side of the table.
17824
+ * @param {'auto' | 'start' | 'end'} [horizontalSnap] If `'start'`, viewport is scrolled to show
17825
+ * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
17826
+ * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
17827
+ * @param {'auto' | 'top' | 'bottom'} [verticalSnap] If `'top'`, viewport is scrolled to show
17828
+ * the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on the bottom of
17829
+ * the table. When `'auto'`, the viewport is scrolled only when the row is outside of the viewport.
17835
17830
  * @returns {boolean}
17836
17831
  */
17837
- scrollViewport(coords, snapToTop, snapToRight, snapToBottom, snapToLeft) {
17838
- return this._wt.scrollViewport(coords, snapToTop, snapToRight, snapToBottom, snapToLeft);
17832
+ scrollViewport(coords, horizontalSnap, verticalSnap) {
17833
+ return this._wt.scrollViewport(coords, horizontalSnap, verticalSnap);
17839
17834
  }
17840
17835
 
17841
17836
  /**
17842
17837
  * Scroll viewport to a column.
17843
17838
  *
17844
17839
  * @param {number} column Renderable column index.
17845
- * @param {boolean} [snapToRight] If `true`, viewport is scrolled to show the cell on the right side of the table.
17846
- * @param {boolean} [snapToLeft] If `true`, viewport is scrolled to show the cell on the left side of the table.
17840
+ * @param {'auto' | 'start' | 'end'} [snap] If `'start'`, viewport is scrolled to show
17841
+ * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
17842
+ * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
17847
17843
  * @returns {boolean}
17848
17844
  */
17849
- scrollViewportHorizontally(column, snapToRight, snapToLeft) {
17850
- return this._wt.scrollViewportHorizontally(column, snapToRight, snapToLeft);
17845
+ scrollViewportHorizontally(column, snap) {
17846
+ return this._wt.scrollViewportHorizontally(column, snap);
17851
17847
  }
17852
17848
 
17853
17849
  /**
17854
17850
  * Scroll viewport to a row.
17855
17851
  *
17856
17852
  * @param {number} row Renderable row index.
17857
- * @param {boolean} [snapToTop] If `true`, viewport is scrolled to show the cell on the top of the table.
17858
- * @param {boolean} [snapToBottom] If `true`, viewport is scrolled to show the cell on the bottom side of the table.
17853
+ * @param {'auto' | 'top' | 'bottom'} [snap] If `'top'`, viewport is scrolled to show
17854
+ * the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on
17855
+ * the bottom of the table. When `'auto'`, the viewport is scrolled only when the row is outside of
17856
+ * the viewport.
17859
17857
  * @returns {boolean}
17860
17858
  */
17861
- scrollViewportVertically(row, snapToTop, snapToBottom) {
17862
- return this._wt.scrollViewportVertically(row, snapToTop, snapToBottom);
17859
+ scrollViewportVertically(row, snap) {
17860
+ return this._wt.scrollViewportVertically(row, snap);
17863
17861
  }
17864
17862
 
17865
17863
  /**
@@ -18450,7 +18448,7 @@ class TableView {
18450
18448
  },
18451
18449
  beforeDraw: (force, skipRender) => this.beforeRender(force, skipRender),
18452
18450
  onDraw: force => this.afterRender(force),
18453
- onBeforeViewportScrollVertically: renderableRow => {
18451
+ onBeforeViewportScrollVertically: (renderableRow, snapping) => {
18454
18452
  const rowMapper = this.hot.rowIndexMapper;
18455
18453
  const areColumnHeadersSelected = renderableRow < 0;
18456
18454
  let visualRow = renderableRow;
@@ -18462,14 +18460,14 @@ class TableView {
18462
18460
  return renderableRow;
18463
18461
  }
18464
18462
  }
18465
- visualRow = this.hot.runHooks('beforeViewportScrollVertically', visualRow);
18463
+ visualRow = this.hot.runHooks('beforeViewportScrollVertically', visualRow, snapping);
18466
18464
  this.hot.runHooks('beforeViewportScroll');
18467
18465
  if (!areColumnHeadersSelected) {
18468
18466
  return rowMapper.getRenderableFromVisualIndex(visualRow);
18469
18467
  }
18470
18468
  return visualRow;
18471
18469
  },
18472
- onBeforeViewportScrollHorizontally: renderableColumn => {
18470
+ onBeforeViewportScrollHorizontally: (renderableColumn, snapping) => {
18473
18471
  const columnMapper = this.hot.columnIndexMapper;
18474
18472
  const areRowHeadersSelected = renderableColumn < 0;
18475
18473
  let visualColumn = renderableColumn;
@@ -18481,7 +18479,7 @@ class TableView {
18481
18479
  return renderableColumn;
18482
18480
  }
18483
18481
  }
18484
- visualColumn = this.hot.runHooks('beforeViewportScrollHorizontally', visualColumn);
18482
+ visualColumn = this.hot.runHooks('beforeViewportScrollHorizontally', visualColumn, snapping);
18485
18483
  this.hot.runHooks('beforeViewportScroll');
18486
18484
  if (!areRowHeadersSelected) {
18487
18485
  return columnMapper.getRenderableFromVisualIndex(visualColumn);
@@ -21700,14 +21698,14 @@ class WalkontableFacade {
21700
21698
  let topmost = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
21701
21699
  return this._wot.getCell(coords, topmost);
21702
21700
  }
21703
- scrollViewport(coords, snapToTop, snapToRight, snapToBottom, snapToLeft) {
21704
- return this._wot.scrollViewport(coords, snapToTop, snapToRight, snapToBottom, snapToLeft);
21701
+ scrollViewport(coords, horizontalSnap, verticalSnap) {
21702
+ return this._wot.scrollViewport(coords, horizontalSnap, verticalSnap);
21705
21703
  }
21706
- scrollViewportHorizontally(column, snapToRight, snapToLeft) {
21707
- return this._wot.scrollViewportHorizontally(column, snapToRight, snapToLeft);
21704
+ scrollViewportHorizontally(column, snapping) {
21705
+ return this._wot.scrollViewportHorizontally(column, snapping);
21708
21706
  }
21709
- scrollViewportVertically(row, snapToTop, snapToBottom) {
21710
- return this._wot.scrollViewportVertically(row, snapToTop, snapToBottom);
21707
+ scrollViewportVertically(row, snapping) {
21708
+ return this._wot.scrollViewportVertically(row, snapping);
21711
21709
  }
21712
21710
  getViewport() {
21713
21711
  return this._wot.getViewport();
@@ -26958,47 +26956,43 @@ class CoreAbstract {
26958
26956
  * Scrolls the viewport to a cell (rerenders if needed).
26959
26957
  *
26960
26958
  * @param {CellCoords} coords The cell coordinates to scroll to.
26961
- * @param {boolean} [snapToTop] If `true`, viewport is scrolled to show the cell on the top of the table.
26962
- * @param {boolean} [snapToRight] If `true`, viewport is scrolled to show the cell on the right of the table.
26963
- * @param {boolean} [snapToBottom] If `true`, viewport is scrolled to show the cell on the bottom of the table.
26964
- * @param {boolean} [snapToLeft] If `true`, viewport is scrolled to show the cell on the left of the table.
26959
+ * @param {'auto' | 'start' | 'end'} [horizontalSnap='auto'] If `'start'`, viewport is scrolled to show
26960
+ * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
26961
+ * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
26962
+ * @param {'auto' | 'top' | 'bottom'} [verticalSnap='auto'] If `'top'`, viewport is scrolled to show
26963
+ * the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on the bottom of
26964
+ * the table. When `'auto'`, the viewport is scrolled only when the row is outside of the viewport.
26965
26965
  * @returns {boolean}
26966
26966
  */
26967
- scrollViewport(coords, snapToTop, snapToRight, snapToBottom, snapToLeft) {
26968
- if (coords.col < 0 || coords.row < 0) {
26969
- return false;
26970
- }
26971
- return this.wtScroll.scrollViewport(coords, snapToTop, snapToRight, snapToBottom, snapToLeft);
26967
+ scrollViewport(coords, horizontalSnap, verticalSnap) {
26968
+ return this.wtScroll.scrollViewport(coords, horizontalSnap, verticalSnap);
26972
26969
  }
26973
26970
 
26974
26971
  /**
26975
26972
  * Scrolls the viewport to a column (rerenders if needed).
26976
26973
  *
26977
26974
  * @param {number} column Visual column index.
26978
- * @param {boolean} [snapToRight] If `true`, viewport is scrolled to show the cell on the right of the table.
26979
- * @param {boolean} [snapToLeft] If `true`, viewport is scrolled to show the cell on the left of the table.
26975
+ * @param {'auto' | 'start' | 'end'} [snapping='auto'] If `'start'`, viewport is scrolled to show
26976
+ * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
26977
+ * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
26980
26978
  * @returns {boolean}
26981
26979
  */
26982
- scrollViewportHorizontally(column, snapToRight, snapToLeft) {
26983
- if (column < 0) {
26984
- return false;
26985
- }
26986
- return this.wtScroll.scrollViewportHorizontally(column, snapToRight, snapToLeft);
26980
+ scrollViewportHorizontally(column, snapping) {
26981
+ return this.wtScroll.scrollViewportHorizontally(column, snapping);
26987
26982
  }
26988
26983
 
26989
26984
  /**
26990
26985
  * Scrolls the viewport to a row (rerenders if needed).
26991
26986
  *
26992
26987
  * @param {number} row Visual row index.
26993
- * @param {boolean} [snapToTop] If `true`, viewport is scrolled to show the cell on the top of the table.
26994
- * @param {boolean} [snapToBottom] If `true`, viewport is scrolled to show the cell on the bottom of the table.
26988
+ * @param {'auto' | 'top' | 'bottom'} [snapping='auto'] If `'top'`, viewport is scrolled to show
26989
+ * the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on
26990
+ * the bottom of the table. When `'auto'`, the viewport is scrolled only when the row is outside of
26991
+ * the viewport.
26995
26992
  * @returns {boolean}
26996
26993
  */
26997
- scrollViewportVertically(row, snapToTop, snapToBottom) {
26998
- if (row < 0) {
26999
- return false;
27000
- }
27001
- return this.wtScroll.scrollViewportVertically(row, snapToTop, snapToBottom);
26994
+ scrollViewportVertically(row, snapping) {
26995
+ return this.wtScroll.scrollViewportVertically(row, snapping);
27002
26996
  }
27003
26997
 
27004
26998
  /**
@@ -27177,6 +27171,7 @@ exports.__esModule = true;
27177
27171
  __webpack_require__(8);
27178
27172
  var _defineProperty2 = _interopRequireDefault(__webpack_require__(173));
27179
27173
  var _element = __webpack_require__(158);
27174
+ var _object = __webpack_require__(168);
27180
27175
  function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
27181
27176
  function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
27182
27177
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
@@ -27210,15 +27205,20 @@ class Scroll {
27210
27205
  * Scrolls viewport to a cell.
27211
27206
  *
27212
27207
  * @param {CellCoords} coords The cell coordinates.
27213
- * @param {boolean} [snapToTop] If `true`, viewport is scrolled to show the cell on the top of the table.
27214
- * @param {boolean} [snapToRight] If `true`, viewport is scrolled to show the cell on the right of the table.
27215
- * @param {boolean} [snapToBottom] If `true`, viewport is scrolled to show the cell on the bottom of the table.
27216
- * @param {boolean} [snapToLeft] If `true`, viewport is scrolled to show the cell on the left of the table.
27208
+ * @param {'auto' | 'start' | 'end'} [horizontalSnap='auto'] If `'start'`, viewport is scrolled to show
27209
+ * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
27210
+ * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
27211
+ * @param {'auto' | 'top' | 'bottom'} [verticalSnap='auto'] If `'top'`, viewport is scrolled to show
27212
+ * the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on the bottom of
27213
+ * the table. When `'auto'`, the viewport is scrolled only when the row is outside of the viewport.
27217
27214
  * @returns {boolean}
27218
27215
  */
27219
- scrollViewport(coords, snapToTop, snapToRight, snapToBottom, snapToLeft) {
27220
- const scrolledHorizontally = this.scrollViewportHorizontally(coords.col, snapToRight, snapToLeft);
27221
- const scrolledVertically = this.scrollViewportVertically(coords.row, snapToTop, snapToBottom);
27216
+ scrollViewport(coords, horizontalSnap, verticalSnap) {
27217
+ if (coords.col < 0 || coords.row < 0) {
27218
+ return false;
27219
+ }
27220
+ const scrolledHorizontally = this.scrollViewportHorizontally(coords.col, horizontalSnap);
27221
+ const scrolledVertically = this.scrollViewportVertically(coords.row, verticalSnap);
27222
27222
  return scrolledHorizontally || scrolledVertically;
27223
27223
  }
27224
27224
 
@@ -27226,42 +27226,43 @@ class Scroll {
27226
27226
  * Scrolls viewport to a column.
27227
27227
  *
27228
27228
  * @param {number} column Visual column index.
27229
- * @param {boolean} [snapToRight] If `true`, viewport is scrolled to show the cell on the right of the table.
27230
- * @param {boolean} [snapToLeft] If `true`, viewport is scrolled to show the cell on the left of the table.
27229
+ * @param {'auto' | 'start' | 'end'} [snapping='auto'] If `'start'`, viewport is scrolled to show
27230
+ * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
27231
+ * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
27231
27232
  * @returns {boolean}
27232
27233
  */
27233
- scrollViewportHorizontally(column, snapToRight, snapToLeft) {
27234
+ scrollViewportHorizontally(column) {
27235
+ let snapping = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'auto';
27234
27236
  const {
27235
27237
  drawn,
27236
27238
  totalColumns
27237
27239
  } = this.dataAccessObject;
27238
-
27239
- // do not scroll the viewport when the column points to a range outside of the dataset
27240
- if (!drawn || !Number.isInteger(column) || column < 0 || column > totalColumns) {
27240
+ if (!drawn) {
27241
+ return false;
27242
+ }
27243
+ const snappingObject = (0, _object.createObjectPropListener)(snapping);
27244
+ column = this.dataAccessObject.wtSettings.getSetting('onBeforeViewportScrollHorizontally', column, snappingObject);
27245
+ if (!Number.isInteger(column) || column < 0 || column > totalColumns) {
27241
27246
  return false;
27242
27247
  }
27243
- const autoSnapping = snapToRight === undefined && snapToLeft === undefined;
27248
+ snapping = snappingObject.value;
27244
27249
  const {
27245
27250
  fixedColumnsStart,
27246
27251
  inlineStartOverlay
27247
27252
  } = this.dataAccessObject;
27253
+ const autoSnapping = snapping === 'auto';
27248
27254
 
27249
- // for auto-snapping (both snap* arguments are undefined) do not scroll the viewport
27250
- // when the columns points to the overlays
27255
+ // for auto-snapping do not scroll the viewport when the columns points to the overlays
27251
27256
  if (autoSnapping && column < fixedColumnsStart) {
27252
27257
  return false;
27253
27258
  }
27254
- column = this.dataAccessObject.wtSettings.getSetting('onBeforeViewportScrollHorizontally', column);
27255
- if (!Number.isInteger(column) || column < 0 || column > totalColumns) {
27256
- return false;
27257
- }
27258
27259
  const firstColumn = this.getFirstVisibleColumn();
27259
27260
  const lastColumn = this.getLastVisibleColumn();
27260
27261
  let result = false;
27261
27262
  if (autoSnapping && (column < firstColumn || column > lastColumn) || !autoSnapping) {
27262
27263
  // if there is at least one fully visible column determine the snapping direction based on
27263
- // that columns or by snapToRight/snapToLeft flags, if provided.
27264
- result = inlineStartOverlay.scrollTo(column, autoSnapping ? column >= this.getLastPartiallyVisibleColumn() : snapToRight);
27264
+ // that columns or by snapping flag, if provided.
27265
+ result = inlineStartOverlay.scrollTo(column, autoSnapping ? column >= this.getLastPartiallyVisibleColumn() : snapping === 'end');
27265
27266
  }
27266
27267
  return result;
27267
27268
  }
@@ -27270,43 +27271,45 @@ class Scroll {
27270
27271
  * Scrolls viewport to a row.
27271
27272
  *
27272
27273
  * @param {number} row Visual row index.
27273
- * @param {boolean} [snapToTop] If `true`, viewport is scrolled to show the cell on the top of the table.
27274
- * @param {boolean} [snapToBottom] If `true`, viewport is scrolled to show the cell on the bottom of the table.
27274
+ * @param {'auto' | 'top' | 'bottom'} [snapping='auto'] If `'top'`, viewport is scrolled to show
27275
+ * the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on
27276
+ * the bottom of the table. When `'auto'`, the viewport is scrolled only when the row is outside of
27277
+ * the viewport.
27275
27278
  * @returns {boolean}
27276
27279
  */
27277
- scrollViewportVertically(row, snapToTop, snapToBottom) {
27280
+ scrollViewportVertically(row) {
27281
+ let snapping = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'auto';
27278
27282
  const {
27279
27283
  drawn,
27280
27284
  totalRows
27281
27285
  } = this.dataAccessObject;
27282
-
27283
- // do not scroll the viewport when the row points to a range outside of the dataset
27284
- if (!drawn || !Number.isInteger(row) || row < 0 || row > totalRows) {
27286
+ if (!drawn) {
27285
27287
  return false;
27286
27288
  }
27287
- const autoSnapping = snapToTop === undefined && snapToBottom === undefined;
27289
+ const snappingObject = (0, _object.createObjectPropListener)(snapping);
27290
+ row = this.dataAccessObject.wtSettings.getSetting('onBeforeViewportScrollVertically', row, snappingObject);
27291
+ if (!Number.isInteger(row) || row < 0 || row > totalRows) {
27292
+ return false;
27293
+ }
27294
+ snapping = snappingObject.value;
27288
27295
  const {
27289
27296
  fixedRowsBottom,
27290
27297
  fixedRowsTop,
27291
27298
  topOverlay
27292
27299
  } = this.dataAccessObject;
27300
+ const autoSnapping = snapping === 'auto';
27293
27301
 
27294
- // for auto-snapping (both snap* arguments are undefined) do not scroll the viewport
27295
- // when the rows points to the overlays
27302
+ // for auto-snapping do not scroll the viewport when the rows points to the overlays
27296
27303
  if (autoSnapping && (row < fixedRowsTop || row > totalRows - fixedRowsBottom - 1)) {
27297
27304
  return false;
27298
27305
  }
27299
- row = this.dataAccessObject.wtSettings.getSetting('onBeforeViewportScrollVertically', row);
27300
- if (!Number.isInteger(row) || row < 0 || row > totalRows) {
27301
- return false;
27302
- }
27303
27306
  const firstRow = this.getFirstVisibleRow();
27304
27307
  const lastRow = this.getLastVisibleRow();
27305
27308
  let result = false;
27306
27309
  if (autoSnapping && (row < firstRow || row > lastRow) || !autoSnapping) {
27307
27310
  // if there is at least one fully visible row determine the snapping direction based on
27308
- // that rows or by snapToTop/snapToBottom flags, if provided.
27309
- result = topOverlay.scrollTo(row, autoSnapping ? row >= this.getLastPartiallyVisibleRow() : snapToBottom);
27311
+ // that rows or by snapping flag, if provided.
27312
+ result = topOverlay.scrollTo(row, autoSnapping ? row >= this.getLastPartiallyVisibleRow() : snapping === 'bottom');
27310
27313
  }
27311
27314
  return result;
27312
27315
  }
@@ -36222,9 +36225,11 @@ class Selection {
36222
36225
  if (!this.isSelected()) {
36223
36226
  return;
36224
36227
  }
36225
- const focusHighlight = this.highlight.getFocus();
36226
36228
  const currentLayer = this.getLayerLevel();
36227
- focusHighlight.commit().syncWith(this.selectedRange.current());
36229
+ const cellRange = this.selectedRange.current();
36230
+ if (this.highlight.isEnabledFor(_highlight.FOCUS_TYPE, cellRange.highlight)) {
36231
+ this.highlight.getFocus().commit().syncWith(cellRange);
36232
+ }
36228
36233
 
36229
36234
  // Rewriting rendered ranges going through all layers.
36230
36235
  for (let layerLevel = 0; layerLevel < this.selectedRange.size(); layerLevel += 1) {
@@ -61856,19 +61861,8 @@ function alignmentItem() {
61856
61861
  submenu: {
61857
61862
  items: [{
61858
61863
  key: `${KEY}:left`,
61859
- checkable: true,
61860
- ariaLabel() {
61861
- return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_LEFT);
61862
- },
61863
- ariaChecked() {
61864
- return (0, _utils.hasSelectionAClass)(this, 'htLeft');
61865
- },
61866
61864
  name() {
61867
- let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_LEFT);
61868
- if ((0, _utils.hasSelectionAClass)(this, 'htLeft')) {
61869
- label = (0, _utils.markLabelAsSelected)(label);
61870
- }
61871
- return label;
61865
+ return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_LEFT);
61872
61866
  },
61873
61867
  callback() {
61874
61868
  const selectedRange = this.getSelectedRange();
@@ -61882,19 +61876,8 @@ function alignmentItem() {
61882
61876
  disabled: false
61883
61877
  }, {
61884
61878
  key: `${KEY}:center`,
61885
- checkable: true,
61886
- ariaLabel() {
61887
- return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_CENTER);
61888
- },
61889
- ariaChecked() {
61890
- return (0, _utils.hasSelectionAClass)(this, 'htCenter');
61891
- },
61892
61879
  name() {
61893
- let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_CENTER);
61894
- if ((0, _utils.hasSelectionAClass)(this, 'htCenter')) {
61895
- label = (0, _utils.markLabelAsSelected)(label);
61896
- }
61897
- return label;
61880
+ return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_CENTER);
61898
61881
  },
61899
61882
  callback() {
61900
61883
  const selectedRange = this.getSelectedRange();
@@ -61908,19 +61891,8 @@ function alignmentItem() {
61908
61891
  disabled: false
61909
61892
  }, {
61910
61893
  key: `${KEY}:right`,
61911
- checkable: true,
61912
- ariaLabel() {
61913
- return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_RIGHT);
61914
- },
61915
- ariaChecked() {
61916
- return (0, _utils.hasSelectionAClass)(this, 'htRight');
61917
- },
61918
61894
  name() {
61919
- let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_RIGHT);
61920
- if ((0, _utils.hasSelectionAClass)(this, 'htRight')) {
61921
- label = (0, _utils.markLabelAsSelected)(label);
61922
- }
61923
- return label;
61895
+ return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_RIGHT);
61924
61896
  },
61925
61897
  callback() {
61926
61898
  const selectedRange = this.getSelectedRange();
@@ -61934,19 +61906,8 @@ function alignmentItem() {
61934
61906
  disabled: false
61935
61907
  }, {
61936
61908
  key: `${KEY}:justify`,
61937
- checkable: true,
61938
- ariaLabel() {
61939
- return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_JUSTIFY);
61940
- },
61941
- ariaChecked() {
61942
- return (0, _utils.hasSelectionAClass)(this, 'htJustify');
61943
- },
61944
61909
  name() {
61945
- let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_JUSTIFY);
61946
- if ((0, _utils.hasSelectionAClass)(this, 'htJustify')) {
61947
- label = (0, _utils.markLabelAsSelected)(label);
61948
- }
61949
- return label;
61910
+ return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_JUSTIFY);
61950
61911
  },
61951
61912
  callback() {
61952
61913
  const selectedRange = this.getSelectedRange();
@@ -61962,19 +61923,8 @@ function alignmentItem() {
61962
61923
  name: _separator.KEY
61963
61924
  }, {
61964
61925
  key: `${KEY}:top`,
61965
- checkable: true,
61966
- ariaLabel() {
61967
- return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_TOP);
61968
- },
61969
- ariaChecked() {
61970
- return (0, _utils.hasSelectionAClass)(this, 'htTop');
61971
- },
61972
61926
  name() {
61973
- let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_TOP);
61974
- if ((0, _utils.hasSelectionAClass)(this, 'htTop')) {
61975
- label = (0, _utils.markLabelAsSelected)(label);
61976
- }
61977
- return label;
61927
+ return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_TOP);
61978
61928
  },
61979
61929
  callback() {
61980
61930
  const selectedRange = this.getSelectedRange();
@@ -61988,19 +61938,8 @@ function alignmentItem() {
61988
61938
  disabled: false
61989
61939
  }, {
61990
61940
  key: `${KEY}:middle`,
61991
- checkable: true,
61992
- ariaLabel() {
61993
- return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_MIDDLE);
61994
- },
61995
- ariaChecked() {
61996
- return (0, _utils.hasSelectionAClass)(this, 'htMiddle');
61997
- },
61998
61941
  name() {
61999
- let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_MIDDLE);
62000
- if ((0, _utils.hasSelectionAClass)(this, 'htMiddle')) {
62001
- label = (0, _utils.markLabelAsSelected)(label);
62002
- }
62003
- return label;
61942
+ return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_MIDDLE);
62004
61943
  },
62005
61944
  callback() {
62006
61945
  const selectedRange = this.getSelectedRange();
@@ -62014,19 +61953,8 @@ function alignmentItem() {
62014
61953
  disabled: false
62015
61954
  }, {
62016
61955
  key: `${KEY}:bottom`,
62017
- checkable: true,
62018
- ariaLabel() {
62019
- return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_BOTTOM);
62020
- },
62021
- ariaChecked() {
62022
- return (0, _utils.hasSelectionAClass)(this, 'htBottom');
62023
- },
62024
61956
  name() {
62025
- let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_BOTTOM);
62026
- if ((0, _utils.hasSelectionAClass)(this, 'htBottom')) {
62027
- label = (0, _utils.markLabelAsSelected)(label);
62028
- }
62029
- return label;
61957
+ return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_BOTTOM);
62030
61958
  },
62031
61959
  callback() {
62032
61960
  const selectedRange = this.getSelectedRange();
@@ -62056,7 +61984,6 @@ exports.checkSelectionConsistency = checkSelectionConsistency;
62056
61984
  exports.getAlignmentClasses = getAlignmentClasses;
62057
61985
  exports.getAlignmentComparatorByClass = getAlignmentComparatorByClass;
62058
61986
  exports.getDocumentOffsetByElement = getDocumentOffsetByElement;
62059
- exports.hasSelectionAClass = hasSelectionAClass;
62060
61987
  exports.markLabelAsSelected = markLabelAsSelected;
62061
61988
  exports.prepareHorizontalAlignClass = prepareHorizontalAlignClass;
62062
61989
  exports.prepareVerticalAlignClass = prepareVerticalAlignClass;
@@ -62220,15 +62147,6 @@ function getAlignmentComparatorByClass(htClassName) {
62220
62147
  };
62221
62148
  }
62222
62149
 
62223
- /**
62224
- * @param {object} hot Handsontable instance.
62225
- * @param {string} htClassName The class name to check.
62226
- * @returns {boolean} Returns true if at least one cell has the provided class name.
62227
- */
62228
- function hasSelectionAClass(hot, htClassName) {
62229
- return checkSelectionConsistency(hot.getSelectedRange(), getAlignmentComparatorByClass(htClassName).bind(hot));
62230
- }
62231
-
62232
62150
  /***/ }),
62233
62151
  /* 550 */
62234
62152
  /***/ ((__unused_webpack_module, exports) => {
@@ -86441,6 +86359,7 @@ var _stateManager = /*#__PURE__*/new WeakMap();
86441
86359
  var _hidingIndexMapObserver = /*#__PURE__*/new WeakMap();
86442
86360
  var _focusInitialCoords = /*#__PURE__*/new WeakMap();
86443
86361
  var _isColumnsSelectionInProgress = /*#__PURE__*/new WeakMap();
86362
+ var _recentlyHighlightCoords = /*#__PURE__*/new WeakMap();
86444
86363
  var _NestedHeaders_brand = /*#__PURE__*/new WeakSet();
86445
86364
  class NestedHeaders extends _base.BasePlugin {
86446
86365
  constructor() {
@@ -86475,6 +86394,14 @@ class NestedHeaders extends _base.BasePlugin {
86475
86394
  * @type {boolean}
86476
86395
  */
86477
86396
  _classPrivateFieldInitSpec(this, _isColumnsSelectionInProgress, false);
86397
+ /**
86398
+ * Keeps the last highlight position made by column selection. The coords are necessary to scroll
86399
+ * the viewport to the correct position when the nested header is clicked when the `navigableHeaders`
86400
+ * option is disabled.
86401
+ *
86402
+ * @type {CellCoords | null}
86403
+ */
86404
+ _classPrivateFieldInitSpec(this, _recentlyHighlightCoords, null);
86478
86405
  /**
86479
86406
  * Custom helper for getting widths of the nested headers.
86480
86407
  *
@@ -86895,9 +86822,13 @@ function _updateFocusHighlightPosition() {
86895
86822
  * indexes are used.
86896
86823
  *
86897
86824
  * @param {number} visualColumn A visual column index to which the viewport will be scrolled.
86825
+ * @param {{ value: 'auto' | 'start' | 'end' }} snapping If `'start'`, viewport is scrolled to show
86826
+ * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
86827
+ * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
86898
86828
  * @returns {number}
86899
86829
  */
86900
- function _onBeforeViewportScrollHorizontally(visualColumn) {
86830
+ function _onBeforeViewportScrollHorizontally(visualColumn, snapping) {
86831
+ var _classPrivateFieldGet4;
86901
86832
  const selection = this.hot.getSelectedRangeLast();
86902
86833
  if (!selection) {
86903
86834
  return visualColumn;
@@ -86905,20 +86836,50 @@ function _onBeforeViewportScrollHorizontally(visualColumn) {
86905
86836
  const {
86906
86837
  highlight
86907
86838
  } = selection;
86908
- const isNestedHeadersRange = highlight.isHeader() && highlight.col >= 0;
86839
+ const {
86840
+ navigableHeaders
86841
+ } = this.hot.getSettings();
86842
+ const isSelectedByColumnHeader = this.hot.selection.isSelectedByColumnHeader();
86843
+ const highlightRow = navigableHeaders ? highlight.row : (_classPrivateFieldGet4 = _classPrivateFieldGet(_recentlyHighlightCoords, this)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.row;
86844
+ const highlightColumn = isSelectedByColumnHeader ? visualColumn : highlight.col;
86845
+ const isNestedHeadersRange = highlightRow < 0 && highlightColumn >= 0;
86846
+ _classPrivateFieldSet(_recentlyHighlightCoords, this, null);
86909
86847
  if (!isNestedHeadersRange) {
86910
86848
  return visualColumn;
86911
86849
  }
86912
- const firstColumn = this.hot.view.getFirstFullyVisibleColumn();
86913
- const lastColumn = this.hot.view.getLastFullyVisibleColumn();
86914
- const mostLeftColumnIndex = _classPrivateFieldGet(_stateManager, this).findLeftMostColumnIndex(highlight.row, highlight.col);
86915
- const mostRightColumnIndex = _classPrivateFieldGet(_stateManager, this).findRightMostColumnIndex(highlight.row, highlight.col);
86916
-
86917
- // do not scroll the viewport when the header is wider than the viewport
86918
- if (mostLeftColumnIndex < firstColumn && mostRightColumnIndex > lastColumn) {
86919
- return visualColumn;
86850
+ const firstVisibleColumn = this.hot.getFirstFullyVisibleColumn();
86851
+ const lastVisibleColumn = this.hot.getLastFullyVisibleColumn();
86852
+ const viewportWidth = lastVisibleColumn - firstVisibleColumn + 1;
86853
+ const mostLeftColumnIndex = _classPrivateFieldGet(_stateManager, this).findLeftMostColumnIndex(highlightRow, highlightColumn);
86854
+ const mostRightColumnIndex = _classPrivateFieldGet(_stateManager, this).findRightMostColumnIndex(highlightRow, highlightColumn);
86855
+ const headerWidth = mostRightColumnIndex - mostLeftColumnIndex + 1;
86856
+
86857
+ // scroll the viewport always to the left when the header is wider than the viewport
86858
+ if (mostLeftColumnIndex < firstVisibleColumn && mostRightColumnIndex > lastVisibleColumn) {
86859
+ return mostLeftColumnIndex;
86860
+ }
86861
+ if (isSelectedByColumnHeader) {
86862
+ let scrollColumnIndex = null;
86863
+ if (mostLeftColumnIndex >= firstVisibleColumn && mostRightColumnIndex > lastVisibleColumn) {
86864
+ if (headerWidth > viewportWidth) {
86865
+ snapping.value = 'start';
86866
+ scrollColumnIndex = mostLeftColumnIndex;
86867
+ } else {
86868
+ snapping.value = 'end';
86869
+ scrollColumnIndex = mostRightColumnIndex;
86870
+ }
86871
+ } else if (mostLeftColumnIndex < firstVisibleColumn && mostRightColumnIndex <= lastVisibleColumn) {
86872
+ if (headerWidth > viewportWidth) {
86873
+ snapping.value = 'end';
86874
+ scrollColumnIndex = mostRightColumnIndex;
86875
+ } else {
86876
+ snapping.value = 'start';
86877
+ scrollColumnIndex = mostLeftColumnIndex;
86878
+ }
86879
+ }
86880
+ return scrollColumnIndex;
86920
86881
  }
86921
- return mostLeftColumnIndex < firstColumn ? mostLeftColumnIndex : mostRightColumnIndex;
86882
+ return mostLeftColumnIndex <= firstVisibleColumn ? mostLeftColumnIndex : mostRightColumnIndex;
86922
86883
  }
86923
86884
  /**
86924
86885
  * Allows to control which header DOM element will be used to highlight.
@@ -86989,13 +86950,13 @@ function _onBeforeCopy(data, copyableRanges, _ref2) {
86989
86950
  }
86990
86951
  for (let column = startCol; column <= endCol; column++) {
86991
86952
  for (let row = startRow; row <= endRow; row++) {
86992
- var _classPrivateFieldGet4;
86953
+ var _classPrivateFieldGet5;
86993
86954
  const zeroBasedColumnHeaderLevel = rowsCount + row;
86994
86955
  const zeroBasedColumnIndex = column - startCol;
86995
86956
  if (zeroBasedColumnIndex === 0) {
86996
86957
  continue; // eslint-disable-line no-continue
86997
86958
  }
86998
- const isRoot = (_classPrivateFieldGet4 = _classPrivateFieldGet(_stateManager, this).getHeaderTreeNodeData(row, column)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.isRoot;
86959
+ const isRoot = (_classPrivateFieldGet5 = _classPrivateFieldGet(_stateManager, this).getHeaderTreeNodeData(row, column)) === null || _classPrivateFieldGet5 === void 0 ? void 0 : _classPrivateFieldGet5.isRoot;
86999
86960
  if (isRoot === false) {
87000
86961
  data[zeroBasedColumnHeaderLevel][zeroBasedColumnIndex] = '';
87001
86962
  }
@@ -87181,8 +87142,9 @@ function _onModifyTransformStart(delta) {
87181
87142
  *
87182
87143
  * @param {CellCoords} from The coords object where the selection starts.
87183
87144
  * @param {CellCoords} to The coords object where the selection ends.
87145
+ * @param {CellCoords} highlight The coords object where the focus is.
87184
87146
  */
87185
- function _onBeforeSelectColumns(from, to) {
87147
+ function _onBeforeSelectColumns(from, to, highlight) {
87186
87148
  const headerLevel = from.row;
87187
87149
  const startNodeData = this._getHeaderTreeNodeDataByCoords({
87188
87150
  row: headerLevel,
@@ -87192,6 +87154,7 @@ function _onBeforeSelectColumns(from, to) {
87192
87154
  row: headerLevel,
87193
87155
  col: to.col
87194
87156
  });
87157
+ _classPrivateFieldSet(_recentlyHighlightCoords, this, highlight.clone());
87195
87158
  if (to.col < from.col) {
87196
87159
  // Column selection from right to left
87197
87160
  if (startNodeData) {
@@ -87276,10 +87239,10 @@ function _onModifyColWidth(width, column) {
87276
87239
  * @returns {string} Returns the column header value to update.
87277
87240
  */
87278
87241
  function _onModifyColumnHeaderValue(value, visualColumnIndex, headerLevel) {
87279
- var _classPrivateFieldGet5;
87242
+ var _classPrivateFieldGet6;
87280
87243
  const {
87281
87244
  label
87282
- } = (_classPrivateFieldGet5 = _classPrivateFieldGet(_stateManager, this).getHeaderTreeNodeData(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet5 !== void 0 ? _classPrivateFieldGet5 : {
87245
+ } = (_classPrivateFieldGet6 = _classPrivateFieldGet(_stateManager, this).getHeaderTreeNodeData(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet6 !== void 0 ? _classPrivateFieldGet6 : {
87283
87246
  label: ''
87284
87247
  };
87285
87248
  return label;