handsontable 0.0.0-next-8dc7078-20240322 → 0.0.0-next-28fc088-20240325

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.

Files changed (98) hide show
  1. package/3rdparty/walkontable/src/cell/range.d.ts +2 -1
  2. package/3rdparty/walkontable/src/cell/range.js +22 -5
  3. package/3rdparty/walkontable/src/cell/range.mjs +22 -5
  4. package/base.js +2 -2
  5. package/base.mjs +2 -2
  6. package/core/viewportScroll/index.js +4 -1
  7. package/core/viewportScroll/index.mjs +4 -1
  8. package/core/viewportScroll/scrollStrategies/focusScroll.js +15 -0
  9. package/core/viewportScroll/scrollStrategies/focusScroll.mjs +11 -0
  10. package/core.d.ts +4 -3
  11. package/core.js +76 -21
  12. package/core.mjs +76 -21
  13. package/dist/handsontable.css +2 -2
  14. package/dist/handsontable.full.css +2 -2
  15. package/dist/handsontable.full.js +2649 -1389
  16. package/dist/handsontable.full.min.css +2 -2
  17. package/dist/handsontable.full.min.js +71 -71
  18. package/dist/handsontable.js +2653 -1393
  19. package/dist/handsontable.min.css +2 -2
  20. package/dist/handsontable.min.js +19 -19
  21. package/editorManager.js +12 -8
  22. package/editorManager.mjs +12 -8
  23. package/focusManager.js +7 -1
  24. package/focusManager.mjs +7 -1
  25. package/helpers/mixed.js +1 -1
  26. package/helpers/mixed.mjs +1 -1
  27. package/package.json +1 -1
  28. package/pluginHooks.d.ts +4 -0
  29. package/pluginHooks.js +98 -37
  30. package/pluginHooks.mjs +98 -37
  31. package/plugins/collapsibleColumns/collapsibleColumns.js +9 -3
  32. package/plugins/collapsibleColumns/collapsibleColumns.mjs +9 -3
  33. package/plugins/columnSorting/columnSorting.js +8 -2
  34. package/plugins/columnSorting/columnSorting.mjs +8 -2
  35. package/plugins/contextMenu/menu/defaultShortcutsList.js +26 -10
  36. package/plugins/contextMenu/menu/defaultShortcutsList.mjs +26 -10
  37. package/plugins/mergeCells/calculations/selection.js +1 -70
  38. package/plugins/mergeCells/calculations/selection.mjs +1 -70
  39. package/plugins/mergeCells/cellsCollection.js +116 -0
  40. package/plugins/mergeCells/cellsCollection.mjs +116 -0
  41. package/plugins/mergeCells/contextMenuItem/toggleMerge.js +11 -1
  42. package/plugins/mergeCells/contextMenuItem/toggleMerge.mjs +11 -1
  43. package/plugins/mergeCells/focusOrder.js +305 -0
  44. package/plugins/mergeCells/focusOrder.mjs +300 -0
  45. package/plugins/mergeCells/mergeCells.js +336 -192
  46. package/plugins/mergeCells/mergeCells.mjs +336 -192
  47. package/plugins/multiColumnSorting/multiColumnSorting.js +8 -2
  48. package/plugins/multiColumnSorting/multiColumnSorting.mjs +8 -2
  49. package/plugins/nestedHeaders/nestedHeaders.js +1 -0
  50. package/plugins/nestedHeaders/nestedHeaders.mjs +1 -0
  51. package/plugins/nestedRows/nestedRows.js +9 -3
  52. package/plugins/nestedRows/nestedRows.mjs +9 -3
  53. package/renderers/checkboxRenderer/checkboxRenderer.js +8 -5
  54. package/renderers/checkboxRenderer/checkboxRenderer.mjs +8 -5
  55. package/selection/highlight/visualSelection.js +2 -0
  56. package/selection/highlight/visualSelection.mjs +2 -0
  57. package/selection/selection.js +209 -40
  58. package/selection/selection.mjs +208 -39
  59. package/selection/transformation.js +83 -32
  60. package/selection/transformation.mjs +83 -32
  61. package/shortcutContexts/commands/editor/closeAndSave.js +2 -2
  62. package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -2
  63. package/shortcutContexts/commands/editor/open.js +18 -3
  64. package/shortcutContexts/commands/editor/open.mjs +18 -3
  65. package/shortcutContexts/commands/extendCellsSelection/down.js +1 -1
  66. package/shortcutContexts/commands/extendCellsSelection/down.mjs +1 -1
  67. package/shortcutContexts/commands/extendCellsSelection/left.js +1 -1
  68. package/shortcutContexts/commands/extendCellsSelection/left.mjs +1 -1
  69. package/shortcutContexts/commands/extendCellsSelection/right.js +1 -1
  70. package/shortcutContexts/commands/extendCellsSelection/right.mjs +1 -1
  71. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +1 -1
  72. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +1 -1
  73. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +3 -1
  74. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +3 -1
  75. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +9 -3
  76. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +9 -3
  77. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +10 -3
  78. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +10 -3
  79. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +3 -1
  80. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +3 -1
  81. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +3 -1
  82. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +3 -1
  83. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +3 -1
  84. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +3 -1
  85. package/shortcutContexts/commands/extendCellsSelection/toRows.js +1 -1
  86. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +1 -1
  87. package/shortcutContexts/commands/extendCellsSelection/up.js +1 -1
  88. package/shortcutContexts/commands/extendCellsSelection/up.mjs +1 -1
  89. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +6 -1
  90. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +6 -1
  91. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +6 -1
  92. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +6 -1
  93. package/shortcutContexts/grid.js +2 -2
  94. package/shortcutContexts/grid.mjs +2 -2
  95. package/shortcuts/context.js +2 -1
  96. package/shortcuts/context.mjs +2 -1
  97. package/utils/dataStructures/linkedList.js +6 -1
  98. package/utils/dataStructures/linkedList.mjs +6 -1
@@ -29,10 +29,10 @@ var _Transformation_brand = /*#__PURE__*/new WeakSet();
29
29
  class Transformation {
30
30
  constructor(range, options) {
31
31
  /**
32
- * Sets the additional offset in table size that may occur when the `navigableHeaders` option
33
- * is enabled.
32
+ * Clamps the coords to make sure they points to the cell (or header) in the table range.
34
33
  *
35
- * @param {{x: number, y: number}} offset Offset as x and y properties.
34
+ * @param {CellCoords} zeroBasedCoords The coords object to clamp.
35
+ * @returns {{rowDir: 1|0|-1, colDir: 1|0|-1}}
36
36
  */
37
37
  _classPrivateMethodInitSpec(this, _Transformation_brand);
38
38
  /**
@@ -73,10 +73,6 @@ class Transformation {
73
73
  */
74
74
  transformStart(rowDelta, colDelta) {
75
75
  let createMissingRecords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
76
- _assertClassBrand(_Transformation_brand, this, _setOffsetSize).call(this, {
77
- x: _classPrivateFieldGet(_options, this).navigableHeaders() ? _classPrivateFieldGet(_options, this).countRowHeaders() : 0,
78
- y: _classPrivateFieldGet(_options, this).navigableHeaders() ? _classPrivateFieldGet(_options, this).countColHeaders() : 0
79
- });
80
76
  const delta = _classPrivateFieldGet(_options, this).createCellCoords(rowDelta, colDelta);
81
77
  let visualCoords = _classPrivateFieldGet(_range, this).current().highlight;
82
78
  const highlightRenderableCoords = _classPrivateFieldGet(_options, this).visualToRenderableCoords(visualCoords);
@@ -156,23 +152,46 @@ class Transformation {
156
152
  * @returns {CellCoords} Visual coordinates after transformation.
157
153
  */
158
154
  transformEnd(rowDelta, colDelta) {
159
- _assertClassBrand(_Transformation_brand, this, _setOffsetSize).call(this, {
160
- x: _classPrivateFieldGet(_options, this).navigableHeaders() ? _classPrivateFieldGet(_options, this).countRowHeaders() : 0,
161
- y: _classPrivateFieldGet(_options, this).navigableHeaders() ? _classPrivateFieldGet(_options, this).countColHeaders() : 0
162
- });
163
155
  const delta = _classPrivateFieldGet(_options, this).createCellCoords(rowDelta, colDelta);
164
156
  const cellRange = _classPrivateFieldGet(_range, this).current();
165
157
  const highlightRenderableCoords = _classPrivateFieldGet(_options, this).visualToRenderableCoords(cellRange.highlight);
158
+ const toRow = _assertClassBrand(_Transformation_brand, this, _findFirstNonHiddenZeroBasedRow).call(this, cellRange.to.row, cellRange.from.row);
159
+ const toColumn = _assertClassBrand(_Transformation_brand, this, _findFirstNonHiddenZeroBasedColumn).call(this, cellRange.to.col, cellRange.from.col);
166
160
  const visualCoords = cellRange.to.clone();
167
161
  let rowTransformDir = 0;
168
162
  let colTransformDir = 0;
169
163
  this.runLocalHooks('beforeTransformEnd', delta);
170
- if (highlightRenderableCoords.row !== null && highlightRenderableCoords.col !== null) {
164
+ if (highlightRenderableCoords.row !== null && highlightRenderableCoords.col !== null && toRow !== null && toColumn !== null) {
171
165
  const {
172
- row,
173
- col
174
- } = _assertClassBrand(_Transformation_brand, this, _visualToZeroBasedCoords).call(this, cellRange.to);
175
- const coords = _classPrivateFieldGet(_options, this).createCellCoords(row + delta.row, col + delta.col);
166
+ row: highlightRow,
167
+ col: highlightColumn
168
+ } = _assertClassBrand(_Transformation_brand, this, _visualToZeroBasedCoords).call(this, cellRange.highlight);
169
+ const coords = _classPrivateFieldGet(_options, this).createCellCoords(toRow + delta.row, toColumn + delta.col);
170
+ const topStartCorner = cellRange.getTopStartCorner();
171
+ const topEndCorner = cellRange.getTopEndCorner();
172
+ const bottomEndCorner = cellRange.getBottomEndCorner();
173
+ const restDelta = {
174
+ row: coords.row - highlightRow,
175
+ col: coords.col - highlightColumn
176
+ };
177
+ if (delta.col < 0) {
178
+ if (toColumn >= highlightColumn && coords.col < highlightColumn) {
179
+ coords.col = _assertClassBrand(_Transformation_brand, this, _findFirstNonHiddenZeroBasedColumn).call(this, topStartCorner.col, topEndCorner.col) + restDelta.col;
180
+ }
181
+ } else if (delta.col > 0) {
182
+ if (toColumn <= highlightColumn && coords.col > highlightColumn) {
183
+ coords.col = _assertClassBrand(_Transformation_brand, this, _findFirstNonHiddenZeroBasedColumn).call(this, topEndCorner.col, topStartCorner.col) + restDelta.col;
184
+ }
185
+ }
186
+ if (delta.row < 0) {
187
+ if (toRow >= highlightRow && coords.row < highlightRow) {
188
+ coords.row = _assertClassBrand(_Transformation_brand, this, _findFirstNonHiddenZeroBasedRow).call(this, topStartCorner.row, bottomEndCorner.row) + restDelta.row;
189
+ }
190
+ } else if (delta.row > 0) {
191
+ if (toRow <= highlightRow && coords.row > highlightRow) {
192
+ coords.row = _assertClassBrand(_Transformation_brand, this, _findFirstNonHiddenZeroBasedRow).call(this, bottomEndCorner.row, topStartCorner.row) + restDelta.row;
193
+ }
194
+ }
176
195
  const {
177
196
  rowDir,
178
197
  colDir
@@ -192,23 +211,24 @@ class Transformation {
192
211
  this.runLocalHooks('afterTransformEnd', visualCoords, rowTransformDir, colTransformDir);
193
212
  return visualCoords;
194
213
  }
214
+
215
+ /**
216
+ * Sets the additional offset in table size that may occur when the `navigableHeaders` option
217
+ * is enabled.
218
+ *
219
+ * @param {{x: number, y: number}} offset Offset as x and y properties.
220
+ */
221
+ setOffsetSize(_ref) {
222
+ let {
223
+ x,
224
+ y
225
+ } = _ref;
226
+ _classPrivateFieldSet(_offset, this, {
227
+ x,
228
+ y
229
+ });
230
+ }
195
231
  }
196
- function _setOffsetSize(_ref) {
197
- let {
198
- x,
199
- y
200
- } = _ref;
201
- _classPrivateFieldSet(_offset, this, {
202
- x,
203
- y
204
- });
205
- }
206
- /**
207
- * Clamps the coords to make sure they points to the cell (or header) in the table range.
208
- *
209
- * @param {CellCoords} zeroBasedCoords The coords object to clamp.
210
- * @returns {{rowDir: 1|0|-1, colDir: 1|0|-1}}
211
- */
212
232
  function _clampCoords(zeroBasedCoords) {
213
233
  const {
214
234
  width,
@@ -247,6 +267,34 @@ function _getTableSize() {
247
267
  height: _classPrivateFieldGet(_offset, this).y + _classPrivateFieldGet(_options, this).countRenderableRows()
248
268
  };
249
269
  }
270
+ /**
271
+ * Finds the first non-hidden zero-based row in the table range.
272
+ *
273
+ * @param {number} visualRowFrom The visual row from which the search should start.
274
+ * @param {number} visualRowTo The visual row to which the search should end.
275
+ * @returns {number | null}
276
+ */
277
+ function _findFirstNonHiddenZeroBasedRow(visualRowFrom, visualRowTo) {
278
+ const row = _classPrivateFieldGet(_options, this).findFirstNonHiddenRenderableRow(visualRowFrom, visualRowTo);
279
+ if (row === null) {
280
+ return null;
281
+ }
282
+ return _classPrivateFieldGet(_offset, this).y + row;
283
+ }
284
+ /**
285
+ * Finds the first non-hidden zero-based column in the table range.
286
+ *
287
+ * @param {number} visualColumnFrom The visual column from which the search should start.
288
+ * @param {number} visualColumnTo The visual column to which the search should end.
289
+ * @returns {number | null}
290
+ */
291
+ function _findFirstNonHiddenZeroBasedColumn(visualColumnFrom, visualColumnTo) {
292
+ const column = _classPrivateFieldGet(_options, this).findFirstNonHiddenRenderableColumn(visualColumnFrom, visualColumnTo);
293
+ if (column === null) {
294
+ return null;
295
+ }
296
+ return _classPrivateFieldGet(_offset, this).x + column;
297
+ }
250
298
  /**
251
299
  * Translates the visual coordinates to zero-based ones.
252
300
  *
@@ -258,6 +306,9 @@ function _visualToZeroBasedCoords(visualCoords) {
258
306
  row,
259
307
  col
260
308
  } = _classPrivateFieldGet(_options, this).visualToRenderableCoords(visualCoords);
309
+ if (row === null || col === null) {
310
+ throw new Error('Renderable coords are not visible.');
311
+ }
261
312
  return _classPrivateFieldGet(_options, this).createCellCoords(_classPrivateFieldGet(_offset, this).y + row, _classPrivateFieldGet(_offset, this).x + col);
262
313
  }
263
314
  /**
@@ -3,9 +3,9 @@
3
3
  exports.__esModule = true;
4
4
  const command = exports.command = {
5
5
  name: 'editorCloseAndSave',
6
- callback(hot, event, keys) {
6
+ callback(hot, event) {
7
7
  const editorManager = hot._getEditorManager();
8
8
  editorManager.closeEditorAndSaveChanges(event.ctrlKey || event.metaKey);
9
- editorManager.moveSelectionAfterEnter(keys.includes('shift'));
9
+ editorManager.moveSelectionAfterEnter(event);
10
10
  }
11
11
  };
@@ -1,8 +1,8 @@
1
1
  export const command = {
2
2
  name: 'editorCloseAndSave',
3
- callback(hot, event, keys) {
3
+ callback(hot, event) {
4
4
  const editorManager = hot._getEditorManager();
5
5
  editorManager.closeEditorAndSaveChanges(event.ctrlKey || event.metaKey);
6
- editorManager.moveSelectionAfterEnter(keys.includes('shift'));
6
+ editorManager.moveSelectionAfterEnter(event);
7
7
  }
8
8
  };
@@ -6,20 +6,35 @@ const command = exports.command = {
6
6
  name: 'editorOpen',
7
7
  callback(hot, event, keys) {
8
8
  const editorManager = hot._getEditorManager();
9
+ const selectedRange = hot.getSelectedRangeLast();
9
10
  const {
10
11
  highlight
11
- } = hot.getSelectedRangeLast();
12
+ } = selectedRange;
13
+
14
+ // supports for navigating with enter key when multiple cells are selected
15
+ if (hot.selection.isMultiple() && !selectedRange.isHeader() && hot.countRenderedCols() > 0 && hot.countRenderedRows() > 0) {
16
+ const settings = hot.getSettings();
17
+ const enterMoves = typeof settings.enterMoves === 'function' ? settings.enterMoves(event) : settings.enterMoves;
18
+ if (keys.includes('shift')) {
19
+ hot.selection.transformFocus(-enterMoves.row, -enterMoves.col);
20
+ } else {
21
+ hot.selection.transformFocus(enterMoves.row, enterMoves.col);
22
+ }
23
+ return;
24
+ }
12
25
  if (highlight.isHeader()) {
13
26
  return;
14
27
  }
28
+
29
+ // supports editor opening with enter key
15
30
  if (hot.getSettings().enterBeginsEditing) {
16
31
  if (editorManager.cellProperties.readOnly) {
17
- editorManager.moveSelectionAfterEnter();
32
+ editorManager.moveSelectionAfterEnter(event);
18
33
  } else {
19
34
  editorManager.openEditor(null, event, true);
20
35
  }
21
36
  } else {
22
- editorManager.moveSelectionAfterEnter(keys.includes('shift'));
37
+ editorManager.moveSelectionAfterEnter(event);
23
38
  }
24
39
  (0, _event.stopImmediatePropagation)(event); // required by HandsontableEditor
25
40
  }
@@ -3,20 +3,35 @@ export const command = {
3
3
  name: 'editorOpen',
4
4
  callback(hot, event, keys) {
5
5
  const editorManager = hot._getEditorManager();
6
+ const selectedRange = hot.getSelectedRangeLast();
6
7
  const {
7
8
  highlight
8
- } = hot.getSelectedRangeLast();
9
+ } = selectedRange;
10
+
11
+ // supports for navigating with enter key when multiple cells are selected
12
+ if (hot.selection.isMultiple() && !selectedRange.isHeader() && hot.countRenderedCols() > 0 && hot.countRenderedRows() > 0) {
13
+ const settings = hot.getSettings();
14
+ const enterMoves = typeof settings.enterMoves === 'function' ? settings.enterMoves(event) : settings.enterMoves;
15
+ if (keys.includes('shift')) {
16
+ hot.selection.transformFocus(-enterMoves.row, -enterMoves.col);
17
+ } else {
18
+ hot.selection.transformFocus(enterMoves.row, enterMoves.col);
19
+ }
20
+ return;
21
+ }
9
22
  if (highlight.isHeader()) {
10
23
  return;
11
24
  }
25
+
26
+ // supports editor opening with enter key
12
27
  if (hot.getSettings().enterBeginsEditing) {
13
28
  if (editorManager.cellProperties.readOnly) {
14
- editorManager.moveSelectionAfterEnter();
29
+ editorManager.moveSelectionAfterEnter(event);
15
30
  } else {
16
31
  editorManager.openEditor(null, event, true);
17
32
  }
18
33
  } else {
19
- editorManager.moveSelectionAfterEnter(keys.includes('shift'));
34
+ editorManager.moveSelectionAfterEnter(event);
20
35
  }
21
36
  stopImmediatePropagation(event); // required by HandsontableEditor
22
37
  }
@@ -7,7 +7,7 @@ const command = exports.command = {
7
7
  const {
8
8
  highlight
9
9
  } = hot.getSelectedRangeLast();
10
- if (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByRowHeader()) {
10
+ if (!hot.selection.isSelectedByColumnHeader() && !hot.selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByRowHeader())) {
11
11
  hot.selection.transformEnd(1, 0);
12
12
  }
13
13
  }
@@ -4,7 +4,7 @@ export const command = {
4
4
  const {
5
5
  highlight
6
6
  } = hot.getSelectedRangeLast();
7
- if (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByRowHeader()) {
7
+ if (!hot.selection.isSelectedByColumnHeader() && !hot.selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByRowHeader())) {
8
8
  hot.selection.transformEnd(1, 0);
9
9
  }
10
10
  }
@@ -7,7 +7,7 @@ const command = exports.command = {
7
7
  const {
8
8
  highlight
9
9
  } = hot.getSelectedRangeLast();
10
- if (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByColumnHeader()) {
10
+ if (!hot.selection.isSelectedByRowHeader() && !hot.selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByColumnHeader())) {
11
11
  hot.selection.transformEnd(0, -1 * hot.getDirectionFactor());
12
12
  }
13
13
  }
@@ -4,7 +4,7 @@ export const command = {
4
4
  const {
5
5
  highlight
6
6
  } = hot.getSelectedRangeLast();
7
- if (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByColumnHeader()) {
7
+ if (!hot.selection.isSelectedByRowHeader() && !hot.selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByColumnHeader())) {
8
8
  hot.selection.transformEnd(0, -1 * hot.getDirectionFactor());
9
9
  }
10
10
  }
@@ -7,7 +7,7 @@ const command = exports.command = {
7
7
  const {
8
8
  highlight
9
9
  } = hot.getSelectedRangeLast();
10
- if (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByColumnHeader()) {
10
+ if (!hot.selection.isSelectedByRowHeader() && !hot.selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByColumnHeader())) {
11
11
  hot.selection.transformEnd(0, hot.getDirectionFactor());
12
12
  }
13
13
  }
@@ -4,7 +4,7 @@ export const command = {
4
4
  const {
5
5
  highlight
6
6
  } = hot.getSelectedRangeLast();
7
- if (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByColumnHeader()) {
7
+ if (!hot.selection.isSelectedByRowHeader() && !hot.selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByColumnHeader())) {
8
8
  hot.selection.transformEnd(0, hot.getDirectionFactor());
9
9
  }
10
10
  }
@@ -12,7 +12,7 @@ const command = exports.command = {
12
12
  if (hot.selection.isSelectedByRowHeader()) {
13
13
  hot.selection.selectAll(true, true);
14
14
  } else {
15
- hot.selectColumns(from.col, to.col, highlight.row);
15
+ hot.selectColumns(from.col, to.col, highlight);
16
16
  }
17
17
  }
18
18
  };
@@ -9,7 +9,7 @@ export const command = {
9
9
  if (hot.selection.isSelectedByRowHeader()) {
10
10
  hot.selection.selectAll(true, true);
11
11
  } else {
12
- hot.selectColumns(from.col, to.col, highlight.row);
12
+ hot.selectColumns(from.col, to.col, highlight);
13
13
  }
14
14
  }
15
15
  };
@@ -16,7 +16,9 @@ const command = exports.command = {
16
16
  const isFocusHighlightedByHeader = highlight.isHeader() && hot.selection.isSelectedByRowHeader();
17
17
  if (highlight.isCell() || isFocusHighlightedByHeader) {
18
18
  const row = rowIndexMapper.getNearestNotHiddenIndex(hot.countRows() - 1, -1);
19
- selection.setRangeStart(from.clone());
19
+ const newFrom = from.clone();
20
+ newFrom.row = highlight.row;
21
+ selection.setRangeStart(newFrom, undefined, false, highlight.clone());
20
22
 
21
23
  // Restore the row highlight by header flag after setting up a new selection.
22
24
  if (isFocusHighlightedByHeader) {
@@ -13,7 +13,9 @@ export const command = {
13
13
  const isFocusHighlightedByHeader = highlight.isHeader() && hot.selection.isSelectedByRowHeader();
14
14
  if (highlight.isCell() || isFocusHighlightedByHeader) {
15
15
  const row = rowIndexMapper.getNearestNotHiddenIndex(hot.countRows() - 1, -1);
16
- selection.setRangeStart(from.clone());
16
+ const newFrom = from.clone();
17
+ newFrom.row = highlight.row;
18
+ selection.setRangeStart(newFrom, undefined, false, highlight.clone());
17
19
 
18
20
  // Restore the row highlight by header flag after setting up a new selection.
19
21
  if (isFocusHighlightedByHeader) {
@@ -9,10 +9,16 @@ const command = exports.command = {
9
9
  columnIndexMapper
10
10
  } = hot;
11
11
  const {
12
- highlight
12
+ highlight,
13
+ from,
14
+ to
13
15
  } = hot.getSelectedRangeLast();
14
- if (highlight.isCell()) {
15
- selection.setRangeEnd(hot._createCellCoords(selection.selectedRange.current().from.row, columnIndexMapper.getNearestNotHiddenIndex(hot.countCols() - 1, -1)));
16
+ if (!hot.selection.isSelectedByRowHeader() && !hot.selection.isSelectedByCorner() && highlight.isCell()) {
17
+ const column = columnIndexMapper.getNearestNotHiddenIndex(hot.countCols() - 1, -1);
18
+ const newFrom = from.clone();
19
+ newFrom.col = highlight.col;
20
+ selection.setRangeStart(newFrom, undefined, false, highlight.clone());
21
+ selection.setRangeEnd(hot._createCellCoords(to.row, column));
16
22
  }
17
23
  }
18
24
  };
@@ -6,10 +6,16 @@ export const command = {
6
6
  columnIndexMapper
7
7
  } = hot;
8
8
  const {
9
- highlight
9
+ highlight,
10
+ from,
11
+ to
10
12
  } = hot.getSelectedRangeLast();
11
- if (highlight.isCell()) {
12
- selection.setRangeEnd(hot._createCellCoords(selection.selectedRange.current().from.row, columnIndexMapper.getNearestNotHiddenIndex(hot.countCols() - 1, -1)));
13
+ if (!hot.selection.isSelectedByRowHeader() && !hot.selection.isSelectedByCorner() && highlight.isCell()) {
14
+ const column = columnIndexMapper.getNearestNotHiddenIndex(hot.countCols() - 1, -1);
15
+ const newFrom = from.clone();
16
+ newFrom.col = highlight.col;
17
+ selection.setRangeStart(newFrom, undefined, false, highlight.clone());
18
+ selection.setRangeEnd(hot._createCellCoords(to.row, column));
13
19
  }
14
20
  }
15
21
  };
@@ -9,10 +9,17 @@ const command = exports.command = {
9
9
  columnIndexMapper
10
10
  } = hot;
11
11
  const {
12
- highlight
12
+ highlight,
13
+ from,
14
+ to
13
15
  } = hot.getSelectedRangeLast();
14
- if (highlight.isCell()) {
15
- selection.setRangeEnd(hot._createCellCoords(selection.selectedRange.current().from.row, columnIndexMapper.getNearestNotHiddenIndex(0, 1)));
16
+ if (!hot.selection.isSelectedByRowHeader() && !hot.selection.isSelectedByCorner() && highlight.isCell()) {
17
+ const fixedColumns = parseInt(hot.getSettings().fixedColumnsStart, 10);
18
+ const column = columnIndexMapper.getNearestNotHiddenIndex(fixedColumns, 1);
19
+ const newFrom = from.clone();
20
+ newFrom.col = highlight.col;
21
+ selection.setRangeStart(newFrom, undefined, false, highlight.clone());
22
+ selection.setRangeEnd(hot._createCellCoords(to.row, column));
16
23
  }
17
24
  }
18
25
  };
@@ -6,10 +6,17 @@ export const command = {
6
6
  columnIndexMapper
7
7
  } = hot;
8
8
  const {
9
- highlight
9
+ highlight,
10
+ from,
11
+ to
10
12
  } = hot.getSelectedRangeLast();
11
- if (highlight.isCell()) {
12
- selection.setRangeEnd(hot._createCellCoords(selection.selectedRange.current().from.row, columnIndexMapper.getNearestNotHiddenIndex(0, 1)));
13
+ if (!hot.selection.isSelectedByRowHeader() && !hot.selection.isSelectedByCorner() && highlight.isCell()) {
14
+ const fixedColumns = parseInt(hot.getSettings().fixedColumnsStart, 10);
15
+ const column = columnIndexMapper.getNearestNotHiddenIndex(fixedColumns, 1);
16
+ const newFrom = from.clone();
17
+ newFrom.col = highlight.col;
18
+ selection.setRangeStart(newFrom, undefined, false, highlight.clone());
19
+ selection.setRangeEnd(hot._createCellCoords(to.row, column));
13
20
  }
14
21
  }
15
22
  };
@@ -16,7 +16,9 @@ const command = exports.command = {
16
16
  const isFocusHighlightedByHeader = highlight.isHeader() && hot.selection.isSelectedByColumnHeader();
17
17
  if (highlight.isCell() || isFocusHighlightedByHeader) {
18
18
  const column = columnIndexMapper.getNearestNotHiddenIndex(...(hot.isRtl() ? [hot.countCols() - 1, -1] : [0, 1]));
19
- selection.setRangeStart(from.clone());
19
+ const newFrom = from.clone();
20
+ newFrom.col = highlight.col;
21
+ selection.setRangeStart(newFrom, undefined, false, highlight.clone());
20
22
 
21
23
  // Restore the column highlight by header flag after setting up a new selection.
22
24
  if (isFocusHighlightedByHeader) {
@@ -13,7 +13,9 @@ export const command = {
13
13
  const isFocusHighlightedByHeader = highlight.isHeader() && hot.selection.isSelectedByColumnHeader();
14
14
  if (highlight.isCell() || isFocusHighlightedByHeader) {
15
15
  const column = columnIndexMapper.getNearestNotHiddenIndex(...(hot.isRtl() ? [hot.countCols() - 1, -1] : [0, 1]));
16
- selection.setRangeStart(from.clone());
16
+ const newFrom = from.clone();
17
+ newFrom.col = highlight.col;
18
+ selection.setRangeStart(newFrom, undefined, false, highlight.clone());
17
19
 
18
20
  // Restore the column highlight by header flag after setting up a new selection.
19
21
  if (isFocusHighlightedByHeader) {
@@ -16,7 +16,9 @@ const command = exports.command = {
16
16
  const isFocusHighlightedByHeader = highlight.isHeader() && hot.selection.isSelectedByColumnHeader();
17
17
  if (highlight.isCell() || isFocusHighlightedByHeader) {
18
18
  const column = columnIndexMapper.getNearestNotHiddenIndex(...(hot.isRtl() ? [0, 1] : [hot.countCols() - 1, -1]));
19
- selection.setRangeStart(from.clone());
19
+ const newFrom = from.clone();
20
+ newFrom.col = highlight.col;
21
+ selection.setRangeStart(newFrom, undefined, false, highlight.clone());
20
22
 
21
23
  // Restore the column highlight by header flag after setting up a new selection.
22
24
  if (isFocusHighlightedByHeader) {
@@ -13,7 +13,9 @@ export const command = {
13
13
  const isFocusHighlightedByHeader = highlight.isHeader() && hot.selection.isSelectedByColumnHeader();
14
14
  if (highlight.isCell() || isFocusHighlightedByHeader) {
15
15
  const column = columnIndexMapper.getNearestNotHiddenIndex(...(hot.isRtl() ? [0, 1] : [hot.countCols() - 1, -1]));
16
- selection.setRangeStart(from.clone());
16
+ const newFrom = from.clone();
17
+ newFrom.col = highlight.col;
18
+ selection.setRangeStart(newFrom, undefined, false, highlight.clone());
17
19
 
18
20
  // Restore the column highlight by header flag after setting up a new selection.
19
21
  if (isFocusHighlightedByHeader) {
@@ -16,7 +16,9 @@ const command = exports.command = {
16
16
  const isFocusHighlightedByHeader = highlight.isHeader() && hot.selection.isSelectedByRowHeader();
17
17
  if (highlight.isCell() || isFocusHighlightedByHeader) {
18
18
  const row = rowIndexMapper.getNearestNotHiddenIndex(0, 1);
19
- selection.setRangeStart(from.clone());
19
+ const newFrom = from.clone();
20
+ newFrom.row = highlight.row;
21
+ selection.setRangeStart(newFrom, undefined, false, highlight.clone());
20
22
 
21
23
  // Restore the row highlight by header flag after setting up a new selection.
22
24
  if (isFocusHighlightedByHeader) {
@@ -13,7 +13,9 @@ export const command = {
13
13
  const isFocusHighlightedByHeader = highlight.isHeader() && hot.selection.isSelectedByRowHeader();
14
14
  if (highlight.isCell() || isFocusHighlightedByHeader) {
15
15
  const row = rowIndexMapper.getNearestNotHiddenIndex(0, 1);
16
- selection.setRangeStart(from.clone());
16
+ const newFrom = from.clone();
17
+ newFrom.row = highlight.row;
18
+ selection.setRangeStart(newFrom, undefined, false, highlight.clone());
17
19
 
18
20
  // Restore the row highlight by header flag after setting up a new selection.
19
21
  if (isFocusHighlightedByHeader) {
@@ -12,7 +12,7 @@ const command = exports.command = {
12
12
  if (hot.selection.isSelectedByColumnHeader()) {
13
13
  hot.selection.selectAll(true, true);
14
14
  } else {
15
- hot.selectRows(from.row, to.row, highlight.col);
15
+ hot.selectRows(from.row, to.row, highlight);
16
16
  }
17
17
  }
18
18
  };
@@ -9,7 +9,7 @@ export const command = {
9
9
  if (hot.selection.isSelectedByColumnHeader()) {
10
10
  hot.selection.selectAll(true, true);
11
11
  } else {
12
- hot.selectRows(from.row, to.row, highlight.col);
12
+ hot.selectRows(from.row, to.row, highlight);
13
13
  }
14
14
  }
15
15
  };
@@ -7,7 +7,7 @@ const command = exports.command = {
7
7
  const {
8
8
  highlight
9
9
  } = hot.getSelectedRangeLast();
10
- if (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByRowHeader()) {
10
+ if (!hot.selection.isSelectedByColumnHeader() && !hot.selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByRowHeader())) {
11
11
  hot.selection.transformEnd(-1, 0);
12
12
  }
13
13
  }
@@ -4,7 +4,7 @@ export const command = {
4
4
  const {
5
5
  highlight
6
6
  } = hot.getSelectedRangeLast();
7
- if (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByRowHeader()) {
7
+ if (!hot.selection.isSelectedByColumnHeader() && !hot.selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByRowHeader())) {
8
8
  hot.selection.transformEnd(-1, 0);
9
9
  }
10
10
  }
@@ -5,7 +5,12 @@ const command = exports.command = {
5
5
  name: 'moveCellSelectionInlineEnd',
6
6
  callback(hot, event) {
7
7
  const settings = hot.getSettings();
8
+ const selectedRange = hot.getSelectedRangeLast();
8
9
  const tabMoves = typeof settings.tabMoves === 'function' ? settings.tabMoves(event) : settings.tabMoves;
9
- hot.selection.transformStart(-tabMoves.row, -tabMoves.col);
10
+ if (hot.selection.isMultiple() && !selectedRange.isHeader() && hot.countRenderedCols() > 0 && hot.countRenderedRows() > 0) {
11
+ hot.selection.transformFocus(-tabMoves.row, -tabMoves.col);
12
+ } else {
13
+ hot.selection.transformStart(-tabMoves.row, -tabMoves.col);
14
+ }
10
15
  }
11
16
  };
@@ -2,7 +2,12 @@ export const command = {
2
2
  name: 'moveCellSelectionInlineEnd',
3
3
  callback(hot, event) {
4
4
  const settings = hot.getSettings();
5
+ const selectedRange = hot.getSelectedRangeLast();
5
6
  const tabMoves = typeof settings.tabMoves === 'function' ? settings.tabMoves(event) : settings.tabMoves;
6
- hot.selection.transformStart(-tabMoves.row, -tabMoves.col);
7
+ if (hot.selection.isMultiple() && !selectedRange.isHeader() && hot.countRenderedCols() > 0 && hot.countRenderedRows() > 0) {
8
+ hot.selection.transformFocus(-tabMoves.row, -tabMoves.col);
9
+ } else {
10
+ hot.selection.transformStart(-tabMoves.row, -tabMoves.col);
11
+ }
7
12
  }
8
13
  };
@@ -5,7 +5,12 @@ const command = exports.command = {
5
5
  name: 'moveCellSelectionInlineStart',
6
6
  callback(hot, event) {
7
7
  const settings = hot.getSettings();
8
+ const selectedRange = hot.getSelectedRangeLast();
8
9
  const tabMoves = typeof settings.tabMoves === 'function' ? settings.tabMoves(event) : settings.tabMoves;
9
- hot.selection.transformStart(tabMoves.row, tabMoves.col);
10
+ if (hot.selection.isMultiple() && !selectedRange.isHeader() && hot.countRenderedCols() > 0 && hot.countRenderedRows() > 0) {
11
+ hot.selection.transformFocus(tabMoves.row, tabMoves.col);
12
+ } else {
13
+ hot.selection.transformStart(tabMoves.row, tabMoves.col);
14
+ }
10
15
  }
11
16
  };
@@ -2,7 +2,12 @@ export const command = {
2
2
  name: 'moveCellSelectionInlineStart',
3
3
  callback(hot, event) {
4
4
  const settings = hot.getSettings();
5
+ const selectedRange = hot.getSelectedRangeLast();
5
6
  const tabMoves = typeof settings.tabMoves === 'function' ? settings.tabMoves(event) : settings.tabMoves;
6
- hot.selection.transformStart(tabMoves.row, tabMoves.col);
7
+ if (hot.selection.isMultiple() && !selectedRange.isHeader() && hot.countRenderedCols() > 0 && hot.countRenderedRows() > 0) {
8
+ hot.selection.transformFocus(tabMoves.row, tabMoves.col);
9
+ } else {
10
+ hot.selection.transformStart(tabMoves.row, tabMoves.col);
11
+ }
7
12
  }
8
13
  };