handsontable 0.0.0-next-1af4e47-20241125 → 0.0.0-next-c3d40ad-20241127

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-c3d40ad-20241127
29
+ * Release date: 17/10/2024 (built at 27/11/2024 10:03:20)
30
30
  */
31
31
  (function webpackUniversalModuleDefinition(root, factory) {
32
32
  if(typeof exports === 'object' && typeof module === 'object')
@@ -42679,8 +42679,8 @@ Handsontable.hooks = _hooks.Hooks.getSingleton();
42679
42679
  Handsontable.CellCoords = _src.CellCoords;
42680
42680
  Handsontable.CellRange = _src.CellRange;
42681
42681
  Handsontable.packageName = 'handsontable';
42682
- Handsontable.buildDate = "25/11/2024 11:12:57";
42683
- Handsontable.version = "0.0.0-next-1af4e47-20241125";
42682
+ Handsontable.buildDate = "27/11/2024 10:03:20";
42683
+ Handsontable.version = "0.0.0-next-c3d40ad-20241127";
42684
42684
  Handsontable.languages = {
42685
42685
  dictionaryKeys: _registry.dictionaryKeys,
42686
42686
  getLanguageDictionary: _registry.getLanguageDictionary,
@@ -46816,22 +46816,8 @@ function Core(rootElement, userSettings) {
46816
46816
  const {
46817
46817
  row,
46818
46818
  col,
46819
- verticalSnap,
46820
- horizontalSnap,
46821
46819
  considerHiddenIndexes
46822
46820
  } = (_options = options) !== null && _options !== void 0 ? _options : {};
46823
- let snapToTop;
46824
- let snapToBottom;
46825
- let snapToInlineStart;
46826
- let snapToInlineEnd;
46827
- if (verticalSnap !== undefined) {
46828
- snapToTop = verticalSnap === 'top';
46829
- snapToBottom = !snapToTop;
46830
- }
46831
- if (horizontalSnap !== undefined) {
46832
- snapToInlineStart = horizontalSnap === 'start';
46833
- snapToInlineEnd = !snapToInlineStart;
46834
- }
46835
46821
  let renderableRow = row;
46836
46822
  let renderableColumn = col;
46837
46823
  if (considerHiddenIndexes === undefined || considerHiddenIndexes) {
@@ -46848,13 +46834,13 @@ function Core(rootElement, userSettings) {
46848
46834
  const isRowInteger = Number.isInteger(renderableRow);
46849
46835
  const isColumnInteger = Number.isInteger(renderableColumn);
46850
46836
  if (isRowInteger && renderableRow >= 0 && isColumnInteger && renderableColumn >= 0) {
46851
- return instance.view.scrollViewport(instance._createCellCoords(renderableRow, renderableColumn), snapToTop, snapToInlineEnd, snapToBottom, snapToInlineStart);
46837
+ return instance.view.scrollViewport(instance._createCellCoords(renderableRow, renderableColumn), options.horizontalSnap, options.verticalSnap);
46852
46838
  }
46853
46839
  if (isRowInteger && renderableRow >= 0 && (isColumnInteger && renderableColumn < 0 || !isColumnInteger)) {
46854
- return instance.view.scrollViewportVertically(renderableRow, snapToTop, snapToBottom);
46840
+ return instance.view.scrollViewportVertically(renderableRow, options.verticalSnap);
46855
46841
  }
46856
46842
  if (isColumnInteger && renderableColumn >= 0 && (isRowInteger && renderableRow < 0 || !isRowInteger)) {
46857
- return instance.view.scrollViewportHorizontally(renderableColumn, snapToInlineEnd, snapToInlineStart);
46843
+ return instance.view.scrollViewportHorizontally(renderableColumn, options.horizontalSnap);
46858
46844
  }
46859
46845
  return false;
46860
46846
  };
@@ -54158,7 +54144,7 @@ const domMessages = {
54158
54144
  function _injectProductInfo(key, element) {
54159
54145
  const hasValidType = !isEmpty(key);
54160
54146
  const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
54161
- const hotVersion = "0.0.0-next-1af4e47-20241125";
54147
+ const hotVersion = "0.0.0-next-c3d40ad-20241127";
54162
54148
  let keyValidityDate;
54163
54149
  let consoleMessageState = 'invalid';
54164
54150
  let domMessageState = 'invalid';
@@ -64351,6 +64337,10 @@ const REGISTERED_HOOKS = exports.REGISTERED_HOOKS = [/* eslint-disable jsdoc/req
64351
64337
  * @since 14.0.0
64352
64338
  * @event Hooks#beforeViewportScrollVertically
64353
64339
  * @param {number} visualRow Visual row index.
64340
+ * @param {'auto' | 'top' | 'bottom'} [snapping='auto'] If `'top'`, viewport is scrolled to show
64341
+ * the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on
64342
+ * the bottom of the table. When `'auto'`, the viewport is scrolled only when the row is outside of
64343
+ * the viewport.
64354
64344
  * @returns {number | boolean} Returns modified row index (or the same as passed in the method argument) to which
64355
64345
  * the viewport will be scrolled. If the returned value is `false`, the scrolling will be canceled.
64356
64346
  */
@@ -64362,6 +64352,9 @@ const REGISTERED_HOOKS = exports.REGISTERED_HOOKS = [/* eslint-disable jsdoc/req
64362
64352
  * @since 14.0.0
64363
64353
  * @event Hooks#beforeViewportScrollHorizontally
64364
64354
  * @param {number} visualColumn Visual column index.
64355
+ * @param {'auto' | 'start' | 'end'} [snapping='auto'] If `'start'`, viewport is scrolled to show
64356
+ * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
64357
+ * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
64365
64358
  * @returns {number | boolean} Returns modified column index (or the same as passed in the method argument) to which
64366
64359
  * the viewport will be scrolled. If the returned value is `false`, the scrolling will be canceled.
64367
64360
  */
@@ -68776,38 +68769,43 @@ class TableView {
68776
68769
  * Scroll viewport to a cell.
68777
68770
  *
68778
68771
  * @param {CellCoords} coords Renderable cell coordinates.
68779
- * @param {boolean} [snapToTop] If `true`, viewport is scrolled to show the cell on the top of the table.
68780
- * @param {boolean} [snapToRight] If `true`, viewport is scrolled to show the cell on the right side of the table.
68781
- * @param {boolean} [snapToBottom] If `true`, viewport is scrolled to show the cell on the bottom side of the table.
68782
- * @param {boolean} [snapToLeft] If `true`, viewport is scrolled to show the cell on the left side of the table.
68772
+ * @param {'auto' | 'start' | 'end'} [horizontalSnap] If `'start'`, viewport is scrolled to show
68773
+ * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
68774
+ * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
68775
+ * @param {'auto' | 'top' | 'bottom'} [verticalSnap] If `'top'`, viewport is scrolled to show
68776
+ * the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on the bottom of
68777
+ * the table. When `'auto'`, the viewport is scrolled only when the row is outside of the viewport.
68783
68778
  * @returns {boolean}
68784
68779
  */
68785
- scrollViewport(coords, snapToTop, snapToRight, snapToBottom, snapToLeft) {
68786
- return this._wt.scrollViewport(coords, snapToTop, snapToRight, snapToBottom, snapToLeft);
68780
+ scrollViewport(coords, horizontalSnap, verticalSnap) {
68781
+ return this._wt.scrollViewport(coords, horizontalSnap, verticalSnap);
68787
68782
  }
68788
68783
 
68789
68784
  /**
68790
68785
  * Scroll viewport to a column.
68791
68786
  *
68792
68787
  * @param {number} column Renderable column index.
68793
- * @param {boolean} [snapToRight] If `true`, viewport is scrolled to show the cell on the right side of the table.
68794
- * @param {boolean} [snapToLeft] If `true`, viewport is scrolled to show the cell on the left side of the table.
68788
+ * @param {'auto' | 'start' | 'end'} [snap] If `'start'`, viewport is scrolled to show
68789
+ * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
68790
+ * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
68795
68791
  * @returns {boolean}
68796
68792
  */
68797
- scrollViewportHorizontally(column, snapToRight, snapToLeft) {
68798
- return this._wt.scrollViewportHorizontally(column, snapToRight, snapToLeft);
68793
+ scrollViewportHorizontally(column, snap) {
68794
+ return this._wt.scrollViewportHorizontally(column, snap);
68799
68795
  }
68800
68796
 
68801
68797
  /**
68802
68798
  * Scroll viewport to a row.
68803
68799
  *
68804
68800
  * @param {number} row Renderable row index.
68805
- * @param {boolean} [snapToTop] If `true`, viewport is scrolled to show the cell on the top of the table.
68806
- * @param {boolean} [snapToBottom] If `true`, viewport is scrolled to show the cell on the bottom side of the table.
68801
+ * @param {'auto' | 'top' | 'bottom'} [snap] If `'top'`, viewport is scrolled to show
68802
+ * the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on
68803
+ * the bottom of the table. When `'auto'`, the viewport is scrolled only when the row is outside of
68804
+ * the viewport.
68807
68805
  * @returns {boolean}
68808
68806
  */
68809
- scrollViewportVertically(row, snapToTop, snapToBottom) {
68810
- return this._wt.scrollViewportVertically(row, snapToTop, snapToBottom);
68807
+ scrollViewportVertically(row, snap) {
68808
+ return this._wt.scrollViewportVertically(row, snap);
68811
68809
  }
68812
68810
 
68813
68811
  /**
@@ -69398,7 +69396,7 @@ class TableView {
69398
69396
  },
69399
69397
  beforeDraw: (force, skipRender) => this.beforeRender(force, skipRender),
69400
69398
  onDraw: force => this.afterRender(force),
69401
- onBeforeViewportScrollVertically: renderableRow => {
69399
+ onBeforeViewportScrollVertically: (renderableRow, snapping) => {
69402
69400
  const rowMapper = this.hot.rowIndexMapper;
69403
69401
  const areColumnHeadersSelected = renderableRow < 0;
69404
69402
  let visualRow = renderableRow;
@@ -69410,14 +69408,14 @@ class TableView {
69410
69408
  return renderableRow;
69411
69409
  }
69412
69410
  }
69413
- visualRow = this.hot.runHooks('beforeViewportScrollVertically', visualRow);
69411
+ visualRow = this.hot.runHooks('beforeViewportScrollVertically', visualRow, snapping);
69414
69412
  this.hot.runHooks('beforeViewportScroll');
69415
69413
  if (!areColumnHeadersSelected) {
69416
69414
  return rowMapper.getRenderableFromVisualIndex(visualRow);
69417
69415
  }
69418
69416
  return visualRow;
69419
69417
  },
69420
- onBeforeViewportScrollHorizontally: renderableColumn => {
69418
+ onBeforeViewportScrollHorizontally: (renderableColumn, snapping) => {
69421
69419
  const columnMapper = this.hot.columnIndexMapper;
69422
69420
  const areRowHeadersSelected = renderableColumn < 0;
69423
69421
  let visualColumn = renderableColumn;
@@ -69429,7 +69427,7 @@ class TableView {
69429
69427
  return renderableColumn;
69430
69428
  }
69431
69429
  }
69432
- visualColumn = this.hot.runHooks('beforeViewportScrollHorizontally', visualColumn);
69430
+ visualColumn = this.hot.runHooks('beforeViewportScrollHorizontally', visualColumn, snapping);
69433
69431
  this.hot.runHooks('beforeViewportScroll');
69434
69432
  if (!areRowHeadersSelected) {
69435
69433
  return columnMapper.getRenderableFromVisualIndex(visualColumn);
@@ -72648,14 +72646,14 @@ class WalkontableFacade {
72648
72646
  let topmost = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
72649
72647
  return this._wot.getCell(coords, topmost);
72650
72648
  }
72651
- scrollViewport(coords, snapToTop, snapToRight, snapToBottom, snapToLeft) {
72652
- return this._wot.scrollViewport(coords, snapToTop, snapToRight, snapToBottom, snapToLeft);
72649
+ scrollViewport(coords, horizontalSnap, verticalSnap) {
72650
+ return this._wot.scrollViewport(coords, horizontalSnap, verticalSnap);
72653
72651
  }
72654
- scrollViewportHorizontally(column, snapToRight, snapToLeft) {
72655
- return this._wot.scrollViewportHorizontally(column, snapToRight, snapToLeft);
72652
+ scrollViewportHorizontally(column, snapping) {
72653
+ return this._wot.scrollViewportHorizontally(column, snapping);
72656
72654
  }
72657
- scrollViewportVertically(row, snapToTop, snapToBottom) {
72658
- return this._wot.scrollViewportVertically(row, snapToTop, snapToBottom);
72655
+ scrollViewportVertically(row, snapping) {
72656
+ return this._wot.scrollViewportVertically(row, snapping);
72659
72657
  }
72660
72658
  getViewport() {
72661
72659
  return this._wot.getViewport();
@@ -77906,47 +77904,43 @@ class CoreAbstract {
77906
77904
  * Scrolls the viewport to a cell (rerenders if needed).
77907
77905
  *
77908
77906
  * @param {CellCoords} coords The cell coordinates to scroll to.
77909
- * @param {boolean} [snapToTop] If `true`, viewport is scrolled to show the cell on the top of the table.
77910
- * @param {boolean} [snapToRight] If `true`, viewport is scrolled to show the cell on the right of the table.
77911
- * @param {boolean} [snapToBottom] If `true`, viewport is scrolled to show the cell on the bottom of the table.
77912
- * @param {boolean} [snapToLeft] If `true`, viewport is scrolled to show the cell on the left of the table.
77907
+ * @param {'auto' | 'start' | 'end'} [horizontalSnap='auto'] If `'start'`, viewport is scrolled to show
77908
+ * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
77909
+ * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
77910
+ * @param {'auto' | 'top' | 'bottom'} [verticalSnap='auto'] If `'top'`, viewport is scrolled to show
77911
+ * the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on the bottom of
77912
+ * the table. When `'auto'`, the viewport is scrolled only when the row is outside of the viewport.
77913
77913
  * @returns {boolean}
77914
77914
  */
77915
- scrollViewport(coords, snapToTop, snapToRight, snapToBottom, snapToLeft) {
77916
- if (coords.col < 0 || coords.row < 0) {
77917
- return false;
77918
- }
77919
- return this.wtScroll.scrollViewport(coords, snapToTop, snapToRight, snapToBottom, snapToLeft);
77915
+ scrollViewport(coords, horizontalSnap, verticalSnap) {
77916
+ return this.wtScroll.scrollViewport(coords, horizontalSnap, verticalSnap);
77920
77917
  }
77921
77918
 
77922
77919
  /**
77923
77920
  * Scrolls the viewport to a column (rerenders if needed).
77924
77921
  *
77925
77922
  * @param {number} column Visual column index.
77926
- * @param {boolean} [snapToRight] If `true`, viewport is scrolled to show the cell on the right of the table.
77927
- * @param {boolean} [snapToLeft] If `true`, viewport is scrolled to show the cell on the left of the table.
77923
+ * @param {'auto' | 'start' | 'end'} [snapping='auto'] If `'start'`, viewport is scrolled to show
77924
+ * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
77925
+ * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
77928
77926
  * @returns {boolean}
77929
77927
  */
77930
- scrollViewportHorizontally(column, snapToRight, snapToLeft) {
77931
- if (column < 0) {
77932
- return false;
77933
- }
77934
- return this.wtScroll.scrollViewportHorizontally(column, snapToRight, snapToLeft);
77928
+ scrollViewportHorizontally(column, snapping) {
77929
+ return this.wtScroll.scrollViewportHorizontally(column, snapping);
77935
77930
  }
77936
77931
 
77937
77932
  /**
77938
77933
  * Scrolls the viewport to a row (rerenders if needed).
77939
77934
  *
77940
77935
  * @param {number} row Visual row index.
77941
- * @param {boolean} [snapToTop] If `true`, viewport is scrolled to show the cell on the top of the table.
77942
- * @param {boolean} [snapToBottom] If `true`, viewport is scrolled to show the cell on the bottom of the table.
77936
+ * @param {'auto' | 'top' | 'bottom'} [snapping='auto'] If `'top'`, viewport is scrolled to show
77937
+ * the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on
77938
+ * the bottom of the table. When `'auto'`, the viewport is scrolled only when the row is outside of
77939
+ * the viewport.
77943
77940
  * @returns {boolean}
77944
77941
  */
77945
- scrollViewportVertically(row, snapToTop, snapToBottom) {
77946
- if (row < 0) {
77947
- return false;
77948
- }
77949
- return this.wtScroll.scrollViewportVertically(row, snapToTop, snapToBottom);
77942
+ scrollViewportVertically(row, snapping) {
77943
+ return this.wtScroll.scrollViewportVertically(row, snapping);
77950
77944
  }
77951
77945
 
77952
77946
  /**
@@ -78125,6 +78119,7 @@ exports.__esModule = true;
78125
78119
  __webpack_require__(204);
78126
78120
  var _defineProperty2 = _interopRequireDefault(__webpack_require__(507));
78127
78121
  var _element = __webpack_require__(354);
78122
+ var _object = __webpack_require__(502);
78128
78123
  function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
78129
78124
  function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
78130
78125
  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"); }
@@ -78158,15 +78153,20 @@ class Scroll {
78158
78153
  * Scrolls viewport to a cell.
78159
78154
  *
78160
78155
  * @param {CellCoords} coords The cell coordinates.
78161
- * @param {boolean} [snapToTop] If `true`, viewport is scrolled to show the cell on the top of the table.
78162
- * @param {boolean} [snapToRight] If `true`, viewport is scrolled to show the cell on the right of the table.
78163
- * @param {boolean} [snapToBottom] If `true`, viewport is scrolled to show the cell on the bottom of the table.
78164
- * @param {boolean} [snapToLeft] If `true`, viewport is scrolled to show the cell on the left of the table.
78156
+ * @param {'auto' | 'start' | 'end'} [horizontalSnap='auto'] If `'start'`, viewport is scrolled to show
78157
+ * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
78158
+ * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
78159
+ * @param {'auto' | 'top' | 'bottom'} [verticalSnap='auto'] If `'top'`, viewport is scrolled to show
78160
+ * the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on the bottom of
78161
+ * the table. When `'auto'`, the viewport is scrolled only when the row is outside of the viewport.
78165
78162
  * @returns {boolean}
78166
78163
  */
78167
- scrollViewport(coords, snapToTop, snapToRight, snapToBottom, snapToLeft) {
78168
- const scrolledHorizontally = this.scrollViewportHorizontally(coords.col, snapToRight, snapToLeft);
78169
- const scrolledVertically = this.scrollViewportVertically(coords.row, snapToTop, snapToBottom);
78164
+ scrollViewport(coords, horizontalSnap, verticalSnap) {
78165
+ if (coords.col < 0 || coords.row < 0) {
78166
+ return false;
78167
+ }
78168
+ const scrolledHorizontally = this.scrollViewportHorizontally(coords.col, horizontalSnap);
78169
+ const scrolledVertically = this.scrollViewportVertically(coords.row, verticalSnap);
78170
78170
  return scrolledHorizontally || scrolledVertically;
78171
78171
  }
78172
78172
 
@@ -78174,42 +78174,43 @@ class Scroll {
78174
78174
  * Scrolls viewport to a column.
78175
78175
  *
78176
78176
  * @param {number} column Visual column index.
78177
- * @param {boolean} [snapToRight] If `true`, viewport is scrolled to show the cell on the right of the table.
78178
- * @param {boolean} [snapToLeft] If `true`, viewport is scrolled to show the cell on the left of the table.
78177
+ * @param {'auto' | 'start' | 'end'} [snapping='auto'] If `'start'`, viewport is scrolled to show
78178
+ * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
78179
+ * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
78179
78180
  * @returns {boolean}
78180
78181
  */
78181
- scrollViewportHorizontally(column, snapToRight, snapToLeft) {
78182
+ scrollViewportHorizontally(column) {
78183
+ let snapping = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'auto';
78182
78184
  const {
78183
78185
  drawn,
78184
78186
  totalColumns
78185
78187
  } = this.dataAccessObject;
78186
-
78187
- // do not scroll the viewport when the column points to a range outside of the dataset
78188
- if (!drawn || !Number.isInteger(column) || column < 0 || column > totalColumns) {
78188
+ if (!drawn) {
78189
+ return false;
78190
+ }
78191
+ const snappingObject = (0, _object.createObjectPropListener)(snapping);
78192
+ column = this.dataAccessObject.wtSettings.getSetting('onBeforeViewportScrollHorizontally', column, snappingObject);
78193
+ if (!Number.isInteger(column) || column < 0 || column > totalColumns) {
78189
78194
  return false;
78190
78195
  }
78191
- const autoSnapping = snapToRight === undefined && snapToLeft === undefined;
78196
+ snapping = snappingObject.value;
78192
78197
  const {
78193
78198
  fixedColumnsStart,
78194
78199
  inlineStartOverlay
78195
78200
  } = this.dataAccessObject;
78201
+ const autoSnapping = snapping === 'auto';
78196
78202
 
78197
- // for auto-snapping (both snap* arguments are undefined) do not scroll the viewport
78198
- // when the columns points to the overlays
78203
+ // for auto-snapping do not scroll the viewport when the columns points to the overlays
78199
78204
  if (autoSnapping && column < fixedColumnsStart) {
78200
78205
  return false;
78201
78206
  }
78202
- column = this.dataAccessObject.wtSettings.getSetting('onBeforeViewportScrollHorizontally', column);
78203
- if (!Number.isInteger(column) || column < 0 || column > totalColumns) {
78204
- return false;
78205
- }
78206
78207
  const firstColumn = this.getFirstVisibleColumn();
78207
78208
  const lastColumn = this.getLastVisibleColumn();
78208
78209
  let result = false;
78209
78210
  if (autoSnapping && (column < firstColumn || column > lastColumn) || !autoSnapping) {
78210
78211
  // if there is at least one fully visible column determine the snapping direction based on
78211
- // that columns or by snapToRight/snapToLeft flags, if provided.
78212
- result = inlineStartOverlay.scrollTo(column, autoSnapping ? column >= this.getLastPartiallyVisibleColumn() : snapToRight);
78212
+ // that columns or by snapping flag, if provided.
78213
+ result = inlineStartOverlay.scrollTo(column, autoSnapping ? column >= this.getLastPartiallyVisibleColumn() : snapping === 'end');
78213
78214
  }
78214
78215
  return result;
78215
78216
  }
@@ -78218,43 +78219,45 @@ class Scroll {
78218
78219
  * Scrolls viewport to a row.
78219
78220
  *
78220
78221
  * @param {number} row Visual row index.
78221
- * @param {boolean} [snapToTop] If `true`, viewport is scrolled to show the cell on the top of the table.
78222
- * @param {boolean} [snapToBottom] If `true`, viewport is scrolled to show the cell on the bottom of the table.
78222
+ * @param {'auto' | 'top' | 'bottom'} [snapping='auto'] If `'top'`, viewport is scrolled to show
78223
+ * the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on
78224
+ * the bottom of the table. When `'auto'`, the viewport is scrolled only when the row is outside of
78225
+ * the viewport.
78223
78226
  * @returns {boolean}
78224
78227
  */
78225
- scrollViewportVertically(row, snapToTop, snapToBottom) {
78228
+ scrollViewportVertically(row) {
78229
+ let snapping = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'auto';
78226
78230
  const {
78227
78231
  drawn,
78228
78232
  totalRows
78229
78233
  } = this.dataAccessObject;
78230
-
78231
- // do not scroll the viewport when the row points to a range outside of the dataset
78232
- if (!drawn || !Number.isInteger(row) || row < 0 || row > totalRows) {
78234
+ if (!drawn) {
78233
78235
  return false;
78234
78236
  }
78235
- const autoSnapping = snapToTop === undefined && snapToBottom === undefined;
78237
+ const snappingObject = (0, _object.createObjectPropListener)(snapping);
78238
+ row = this.dataAccessObject.wtSettings.getSetting('onBeforeViewportScrollVertically', row, snappingObject);
78239
+ if (!Number.isInteger(row) || row < 0 || row > totalRows) {
78240
+ return false;
78241
+ }
78242
+ snapping = snappingObject.value;
78236
78243
  const {
78237
78244
  fixedRowsBottom,
78238
78245
  fixedRowsTop,
78239
78246
  topOverlay
78240
78247
  } = this.dataAccessObject;
78248
+ const autoSnapping = snapping === 'auto';
78241
78249
 
78242
- // for auto-snapping (both snap* arguments are undefined) do not scroll the viewport
78243
- // when the rows points to the overlays
78250
+ // for auto-snapping do not scroll the viewport when the rows points to the overlays
78244
78251
  if (autoSnapping && (row < fixedRowsTop || row > totalRows - fixedRowsBottom - 1)) {
78245
78252
  return false;
78246
78253
  }
78247
- row = this.dataAccessObject.wtSettings.getSetting('onBeforeViewportScrollVertically', row);
78248
- if (!Number.isInteger(row) || row < 0 || row > totalRows) {
78249
- return false;
78250
- }
78251
78254
  const firstRow = this.getFirstVisibleRow();
78252
78255
  const lastRow = this.getLastVisibleRow();
78253
78256
  let result = false;
78254
78257
  if (autoSnapping && (row < firstRow || row > lastRow) || !autoSnapping) {
78255
78258
  // if there is at least one fully visible row determine the snapping direction based on
78256
- // that rows or by snapToTop/snapToBottom flags, if provided.
78257
- result = topOverlay.scrollTo(row, autoSnapping ? row >= this.getLastPartiallyVisibleRow() : snapToBottom);
78259
+ // that rows or by snapping flag, if provided.
78260
+ result = topOverlay.scrollTo(row, autoSnapping ? row >= this.getLastPartiallyVisibleRow() : snapping === 'bottom');
78258
78261
  }
78259
78262
  return result;
78260
78263
  }
@@ -87170,9 +87173,11 @@ class Selection {
87170
87173
  if (!this.isSelected()) {
87171
87174
  return;
87172
87175
  }
87173
- const focusHighlight = this.highlight.getFocus();
87174
87176
  const currentLayer = this.getLayerLevel();
87175
- focusHighlight.commit().syncWith(this.selectedRange.current());
87177
+ const cellRange = this.selectedRange.current();
87178
+ if (this.highlight.isEnabledFor(_highlight.FOCUS_TYPE, cellRange.highlight)) {
87179
+ this.highlight.getFocus().commit().syncWith(cellRange);
87180
+ }
87176
87181
 
87177
87182
  // Rewriting rendered ranges going through all layers.
87178
87183
  for (let layerLevel = 0; layerLevel < this.selectedRange.size(); layerLevel += 1) {
@@ -119213,19 +119218,8 @@ function alignmentItem() {
119213
119218
  submenu: {
119214
119219
  items: [{
119215
119220
  key: `${KEY}:left`,
119216
- checkable: true,
119217
- ariaLabel() {
119218
- return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_LEFT);
119219
- },
119220
- ariaChecked() {
119221
- return (0, _utils.hasSelectionAClass)(this, 'htLeft');
119222
- },
119223
119221
  name() {
119224
- let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_LEFT);
119225
- if ((0, _utils.hasSelectionAClass)(this, 'htLeft')) {
119226
- label = (0, _utils.markLabelAsSelected)(label);
119227
- }
119228
- return label;
119222
+ return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_LEFT);
119229
119223
  },
119230
119224
  callback() {
119231
119225
  const selectedRange = this.getSelectedRange();
@@ -119239,19 +119233,8 @@ function alignmentItem() {
119239
119233
  disabled: false
119240
119234
  }, {
119241
119235
  key: `${KEY}:center`,
119242
- checkable: true,
119243
- ariaLabel() {
119244
- return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_CENTER);
119245
- },
119246
- ariaChecked() {
119247
- return (0, _utils.hasSelectionAClass)(this, 'htCenter');
119248
- },
119249
119236
  name() {
119250
- let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_CENTER);
119251
- if ((0, _utils.hasSelectionAClass)(this, 'htCenter')) {
119252
- label = (0, _utils.markLabelAsSelected)(label);
119253
- }
119254
- return label;
119237
+ return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_CENTER);
119255
119238
  },
119256
119239
  callback() {
119257
119240
  const selectedRange = this.getSelectedRange();
@@ -119265,19 +119248,8 @@ function alignmentItem() {
119265
119248
  disabled: false
119266
119249
  }, {
119267
119250
  key: `${KEY}:right`,
119268
- checkable: true,
119269
- ariaLabel() {
119270
- return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_RIGHT);
119271
- },
119272
- ariaChecked() {
119273
- return (0, _utils.hasSelectionAClass)(this, 'htRight');
119274
- },
119275
119251
  name() {
119276
- let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_RIGHT);
119277
- if ((0, _utils.hasSelectionAClass)(this, 'htRight')) {
119278
- label = (0, _utils.markLabelAsSelected)(label);
119279
- }
119280
- return label;
119252
+ return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_RIGHT);
119281
119253
  },
119282
119254
  callback() {
119283
119255
  const selectedRange = this.getSelectedRange();
@@ -119291,19 +119263,8 @@ function alignmentItem() {
119291
119263
  disabled: false
119292
119264
  }, {
119293
119265
  key: `${KEY}:justify`,
119294
- checkable: true,
119295
- ariaLabel() {
119296
- return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_JUSTIFY);
119297
- },
119298
- ariaChecked() {
119299
- return (0, _utils.hasSelectionAClass)(this, 'htJustify');
119300
- },
119301
119266
  name() {
119302
- let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_JUSTIFY);
119303
- if ((0, _utils.hasSelectionAClass)(this, 'htJustify')) {
119304
- label = (0, _utils.markLabelAsSelected)(label);
119305
- }
119306
- return label;
119267
+ return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_JUSTIFY);
119307
119268
  },
119308
119269
  callback() {
119309
119270
  const selectedRange = this.getSelectedRange();
@@ -119319,19 +119280,8 @@ function alignmentItem() {
119319
119280
  name: _separator.KEY
119320
119281
  }, {
119321
119282
  key: `${KEY}:top`,
119322
- checkable: true,
119323
- ariaLabel() {
119324
- return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_TOP);
119325
- },
119326
- ariaChecked() {
119327
- return (0, _utils.hasSelectionAClass)(this, 'htTop');
119328
- },
119329
119283
  name() {
119330
- let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_TOP);
119331
- if ((0, _utils.hasSelectionAClass)(this, 'htTop')) {
119332
- label = (0, _utils.markLabelAsSelected)(label);
119333
- }
119334
- return label;
119284
+ return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_TOP);
119335
119285
  },
119336
119286
  callback() {
119337
119287
  const selectedRange = this.getSelectedRange();
@@ -119345,19 +119295,8 @@ function alignmentItem() {
119345
119295
  disabled: false
119346
119296
  }, {
119347
119297
  key: `${KEY}:middle`,
119348
- checkable: true,
119349
- ariaLabel() {
119350
- return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_MIDDLE);
119351
- },
119352
- ariaChecked() {
119353
- return (0, _utils.hasSelectionAClass)(this, 'htMiddle');
119354
- },
119355
119298
  name() {
119356
- let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_MIDDLE);
119357
- if ((0, _utils.hasSelectionAClass)(this, 'htMiddle')) {
119358
- label = (0, _utils.markLabelAsSelected)(label);
119359
- }
119360
- return label;
119299
+ return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_MIDDLE);
119361
119300
  },
119362
119301
  callback() {
119363
119302
  const selectedRange = this.getSelectedRange();
@@ -119371,19 +119310,8 @@ function alignmentItem() {
119371
119310
  disabled: false
119372
119311
  }, {
119373
119312
  key: `${KEY}:bottom`,
119374
- checkable: true,
119375
- ariaLabel() {
119376
- return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_BOTTOM);
119377
- },
119378
- ariaChecked() {
119379
- return (0, _utils.hasSelectionAClass)(this, 'htBottom');
119380
- },
119381
119313
  name() {
119382
- let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_BOTTOM);
119383
- if ((0, _utils.hasSelectionAClass)(this, 'htBottom')) {
119384
- label = (0, _utils.markLabelAsSelected)(label);
119385
- }
119386
- return label;
119314
+ return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_BOTTOM);
119387
119315
  },
119388
119316
  callback() {
119389
119317
  const selectedRange = this.getSelectedRange();
@@ -119413,7 +119341,6 @@ exports.checkSelectionConsistency = checkSelectionConsistency;
119413
119341
  exports.getAlignmentClasses = getAlignmentClasses;
119414
119342
  exports.getAlignmentComparatorByClass = getAlignmentComparatorByClass;
119415
119343
  exports.getDocumentOffsetByElement = getDocumentOffsetByElement;
119416
- exports.hasSelectionAClass = hasSelectionAClass;
119417
119344
  exports.markLabelAsSelected = markLabelAsSelected;
119418
119345
  exports.prepareHorizontalAlignClass = prepareHorizontalAlignClass;
119419
119346
  exports.prepareVerticalAlignClass = prepareVerticalAlignClass;
@@ -119577,15 +119504,6 @@ function getAlignmentComparatorByClass(htClassName) {
119577
119504
  };
119578
119505
  }
119579
119506
 
119580
- /**
119581
- * @param {object} hot Handsontable instance.
119582
- * @param {string} htClassName The class name to check.
119583
- * @returns {boolean} Returns true if at least one cell has the provided class name.
119584
- */
119585
- function hasSelectionAClass(hot, htClassName) {
119586
- return checkSelectionConsistency(hot.getSelectedRange(), getAlignmentComparatorByClass(htClassName).bind(hot));
119587
- }
119588
-
119589
119507
  /***/ }),
119590
119508
  /* 884 */
119591
119509
  /***/ ((__unused_webpack_module, exports) => {
@@ -143798,6 +143716,7 @@ var _stateManager = /*#__PURE__*/new WeakMap();
143798
143716
  var _hidingIndexMapObserver = /*#__PURE__*/new WeakMap();
143799
143717
  var _focusInitialCoords = /*#__PURE__*/new WeakMap();
143800
143718
  var _isColumnsSelectionInProgress = /*#__PURE__*/new WeakMap();
143719
+ var _recentlyHighlightCoords = /*#__PURE__*/new WeakMap();
143801
143720
  var _NestedHeaders_brand = /*#__PURE__*/new WeakSet();
143802
143721
  class NestedHeaders extends _base.BasePlugin {
143803
143722
  constructor() {
@@ -143832,6 +143751,14 @@ class NestedHeaders extends _base.BasePlugin {
143832
143751
  * @type {boolean}
143833
143752
  */
143834
143753
  _classPrivateFieldInitSpec(this, _isColumnsSelectionInProgress, false);
143754
+ /**
143755
+ * Keeps the last highlight position made by column selection. The coords are necessary to scroll
143756
+ * the viewport to the correct position when the nested header is clicked when the `navigableHeaders`
143757
+ * option is disabled.
143758
+ *
143759
+ * @type {CellCoords | null}
143760
+ */
143761
+ _classPrivateFieldInitSpec(this, _recentlyHighlightCoords, null);
143835
143762
  /**
143836
143763
  * Custom helper for getting widths of the nested headers.
143837
143764
  *
@@ -144252,9 +144179,13 @@ function _updateFocusHighlightPosition() {
144252
144179
  * indexes are used.
144253
144180
  *
144254
144181
  * @param {number} visualColumn A visual column index to which the viewport will be scrolled.
144182
+ * @param {{ value: 'auto' | 'start' | 'end' }} snapping If `'start'`, viewport is scrolled to show
144183
+ * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
144184
+ * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
144255
144185
  * @returns {number}
144256
144186
  */
144257
- function _onBeforeViewportScrollHorizontally(visualColumn) {
144187
+ function _onBeforeViewportScrollHorizontally(visualColumn, snapping) {
144188
+ var _classPrivateFieldGet4;
144258
144189
  const selection = this.hot.getSelectedRangeLast();
144259
144190
  if (!selection) {
144260
144191
  return visualColumn;
@@ -144262,20 +144193,50 @@ function _onBeforeViewportScrollHorizontally(visualColumn) {
144262
144193
  const {
144263
144194
  highlight
144264
144195
  } = selection;
144265
- const isNestedHeadersRange = highlight.isHeader() && highlight.col >= 0;
144196
+ const {
144197
+ navigableHeaders
144198
+ } = this.hot.getSettings();
144199
+ const isSelectedByColumnHeader = this.hot.selection.isSelectedByColumnHeader();
144200
+ const highlightRow = navigableHeaders ? highlight.row : (_classPrivateFieldGet4 = _classPrivateFieldGet(_recentlyHighlightCoords, this)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.row;
144201
+ const highlightColumn = isSelectedByColumnHeader ? visualColumn : highlight.col;
144202
+ const isNestedHeadersRange = highlightRow < 0 && highlightColumn >= 0;
144203
+ _classPrivateFieldSet(_recentlyHighlightCoords, this, null);
144266
144204
  if (!isNestedHeadersRange) {
144267
144205
  return visualColumn;
144268
144206
  }
144269
- const firstColumn = this.hot.view.getFirstFullyVisibleColumn();
144270
- const lastColumn = this.hot.view.getLastFullyVisibleColumn();
144271
- const mostLeftColumnIndex = _classPrivateFieldGet(_stateManager, this).findLeftMostColumnIndex(highlight.row, highlight.col);
144272
- const mostRightColumnIndex = _classPrivateFieldGet(_stateManager, this).findRightMostColumnIndex(highlight.row, highlight.col);
144273
-
144274
- // do not scroll the viewport when the header is wider than the viewport
144275
- if (mostLeftColumnIndex < firstColumn && mostRightColumnIndex > lastColumn) {
144276
- return visualColumn;
144207
+ const firstVisibleColumn = this.hot.getFirstFullyVisibleColumn();
144208
+ const lastVisibleColumn = this.hot.getLastFullyVisibleColumn();
144209
+ const viewportWidth = lastVisibleColumn - firstVisibleColumn + 1;
144210
+ const mostLeftColumnIndex = _classPrivateFieldGet(_stateManager, this).findLeftMostColumnIndex(highlightRow, highlightColumn);
144211
+ const mostRightColumnIndex = _classPrivateFieldGet(_stateManager, this).findRightMostColumnIndex(highlightRow, highlightColumn);
144212
+ const headerWidth = mostRightColumnIndex - mostLeftColumnIndex + 1;
144213
+
144214
+ // scroll the viewport always to the left when the header is wider than the viewport
144215
+ if (mostLeftColumnIndex < firstVisibleColumn && mostRightColumnIndex > lastVisibleColumn) {
144216
+ return mostLeftColumnIndex;
144217
+ }
144218
+ if (isSelectedByColumnHeader) {
144219
+ let scrollColumnIndex = null;
144220
+ if (mostLeftColumnIndex >= firstVisibleColumn && mostRightColumnIndex > lastVisibleColumn) {
144221
+ if (headerWidth > viewportWidth) {
144222
+ snapping.value = 'start';
144223
+ scrollColumnIndex = mostLeftColumnIndex;
144224
+ } else {
144225
+ snapping.value = 'end';
144226
+ scrollColumnIndex = mostRightColumnIndex;
144227
+ }
144228
+ } else if (mostLeftColumnIndex < firstVisibleColumn && mostRightColumnIndex <= lastVisibleColumn) {
144229
+ if (headerWidth > viewportWidth) {
144230
+ snapping.value = 'end';
144231
+ scrollColumnIndex = mostRightColumnIndex;
144232
+ } else {
144233
+ snapping.value = 'start';
144234
+ scrollColumnIndex = mostLeftColumnIndex;
144235
+ }
144236
+ }
144237
+ return scrollColumnIndex;
144277
144238
  }
144278
- return mostLeftColumnIndex < firstColumn ? mostLeftColumnIndex : mostRightColumnIndex;
144239
+ return mostLeftColumnIndex <= firstVisibleColumn ? mostLeftColumnIndex : mostRightColumnIndex;
144279
144240
  }
144280
144241
  /**
144281
144242
  * Allows to control which header DOM element will be used to highlight.
@@ -144346,13 +144307,13 @@ function _onBeforeCopy(data, copyableRanges, _ref2) {
144346
144307
  }
144347
144308
  for (let column = startCol; column <= endCol; column++) {
144348
144309
  for (let row = startRow; row <= endRow; row++) {
144349
- var _classPrivateFieldGet4;
144310
+ var _classPrivateFieldGet5;
144350
144311
  const zeroBasedColumnHeaderLevel = rowsCount + row;
144351
144312
  const zeroBasedColumnIndex = column - startCol;
144352
144313
  if (zeroBasedColumnIndex === 0) {
144353
144314
  continue; // eslint-disable-line no-continue
144354
144315
  }
144355
- const isRoot = (_classPrivateFieldGet4 = _classPrivateFieldGet(_stateManager, this).getHeaderTreeNodeData(row, column)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.isRoot;
144316
+ const isRoot = (_classPrivateFieldGet5 = _classPrivateFieldGet(_stateManager, this).getHeaderTreeNodeData(row, column)) === null || _classPrivateFieldGet5 === void 0 ? void 0 : _classPrivateFieldGet5.isRoot;
144356
144317
  if (isRoot === false) {
144357
144318
  data[zeroBasedColumnHeaderLevel][zeroBasedColumnIndex] = '';
144358
144319
  }
@@ -144538,8 +144499,9 @@ function _onModifyTransformStart(delta) {
144538
144499
  *
144539
144500
  * @param {CellCoords} from The coords object where the selection starts.
144540
144501
  * @param {CellCoords} to The coords object where the selection ends.
144502
+ * @param {CellCoords} highlight The coords object where the focus is.
144541
144503
  */
144542
- function _onBeforeSelectColumns(from, to) {
144504
+ function _onBeforeSelectColumns(from, to, highlight) {
144543
144505
  const headerLevel = from.row;
144544
144506
  const startNodeData = this._getHeaderTreeNodeDataByCoords({
144545
144507
  row: headerLevel,
@@ -144549,6 +144511,7 @@ function _onBeforeSelectColumns(from, to) {
144549
144511
  row: headerLevel,
144550
144512
  col: to.col
144551
144513
  });
144514
+ _classPrivateFieldSet(_recentlyHighlightCoords, this, highlight.clone());
144552
144515
  if (to.col < from.col) {
144553
144516
  // Column selection from right to left
144554
144517
  if (startNodeData) {
@@ -144633,10 +144596,10 @@ function _onModifyColWidth(width, column) {
144633
144596
  * @returns {string} Returns the column header value to update.
144634
144597
  */
144635
144598
  function _onModifyColumnHeaderValue(value, visualColumnIndex, headerLevel) {
144636
- var _classPrivateFieldGet5;
144599
+ var _classPrivateFieldGet6;
144637
144600
  const {
144638
144601
  label
144639
- } = (_classPrivateFieldGet5 = _classPrivateFieldGet(_stateManager, this).getHeaderTreeNodeData(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet5 !== void 0 ? _classPrivateFieldGet5 : {
144602
+ } = (_classPrivateFieldGet6 = _classPrivateFieldGet(_stateManager, this).getHeaderTreeNodeData(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet6 !== void 0 ? _classPrivateFieldGet6 : {
144640
144603
  label: ''
144641
144604
  };
144642
144605
  return label;