handsontable 15.2.0 → 15.3.0-next-6f5f494-20250424

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/3rdparty/walkontable/src/cell/range.js +14 -0
  2. package/3rdparty/walkontable/src/cell/range.mjs +14 -0
  3. package/3rdparty/walkontable/src/core/_base.js +2 -2
  4. package/3rdparty/walkontable/src/core/_base.mjs +3 -3
  5. package/3rdparty/walkontable/src/overlay/_base.js +0 -2
  6. package/3rdparty/walkontable/src/overlay/_base.mjs +0 -2
  7. package/3rdparty/walkontable/src/overlay/bottom.js +9 -6
  8. package/3rdparty/walkontable/src/overlay/bottom.mjs +9 -6
  9. package/3rdparty/walkontable/src/overlay/inlineStart.js +8 -5
  10. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +8 -5
  11. package/3rdparty/walkontable/src/overlay/top.js +11 -6
  12. package/3rdparty/walkontable/src/overlay/top.mjs +11 -6
  13. package/3rdparty/walkontable/src/overlays.js +15 -11
  14. package/3rdparty/walkontable/src/overlays.mjs +15 -11
  15. package/3rdparty/walkontable/src/renderer/rowHeaders.js +4 -1
  16. package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +4 -1
  17. package/3rdparty/walkontable/src/selection/border/border.js +5 -0
  18. package/3rdparty/walkontable/src/selection/border/border.mjs +5 -0
  19. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +3 -4
  20. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +3 -4
  21. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +8 -10
  22. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +8 -10
  23. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +3 -4
  24. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +3 -4
  25. package/3rdparty/walkontable/src/table.js +5 -2
  26. package/3rdparty/walkontable/src/table.mjs +5 -2
  27. package/3rdparty/walkontable/src/utils/orderView/viewDiffer/viewOrder.js +0 -2
  28. package/3rdparty/walkontable/src/utils/orderView/viewDiffer/viewOrder.mjs +0 -2
  29. package/CHANGELOG.md +45 -1
  30. package/README.md +1 -1
  31. package/base.js +2 -2
  32. package/base.mjs +2 -2
  33. package/core/focusCatcher/focusDetector.js +1 -1
  34. package/core/focusCatcher/focusDetector.mjs +2 -2
  35. package/core/hooks/constants.js +8 -0
  36. package/core/hooks/constants.mjs +8 -0
  37. package/core/hooks/index.d.ts +1 -0
  38. package/core/viewportScroll/scrollStrategies/columnHeaderScroll.js +7 -5
  39. package/core/viewportScroll/scrollStrategies/columnHeaderScroll.mjs +7 -5
  40. package/core/viewportScroll/scrollStrategies/focusScroll.js +8 -1
  41. package/core/viewportScroll/scrollStrategies/focusScroll.mjs +8 -1
  42. package/core/viewportScroll/scrollStrategies/multipleScroll.js +13 -1
  43. package/core/viewportScroll/scrollStrategies/multipleScroll.mjs +13 -1
  44. package/core/viewportScroll/scrollStrategies/noncontiguousScroll.js +13 -1
  45. package/core/viewportScroll/scrollStrategies/noncontiguousScroll.mjs +13 -1
  46. package/core/viewportScroll/scrollStrategies/rowHeaderScroll.js +7 -5
  47. package/core/viewportScroll/scrollStrategies/rowHeaderScroll.mjs +7 -5
  48. package/core/viewportScroll/scrollStrategies/singleScroll.js +8 -4
  49. package/core/viewportScroll/scrollStrategies/singleScroll.mjs +8 -4
  50. package/core/viewportScroll/utils.js +111 -0
  51. package/core/viewportScroll/utils.mjs +106 -0
  52. package/core.d.ts +2 -3
  53. package/core.js +125 -71
  54. package/core.mjs +126 -72
  55. package/dataMap/dataMap.js +0 -7
  56. package/dataMap/dataMap.mjs +0 -7
  57. package/dataMap/metaManager/index.js +8 -9
  58. package/dataMap/metaManager/index.mjs +8 -9
  59. package/dataMap/metaManager/mods/dynamicCellMeta.js +4 -1
  60. package/dataMap/metaManager/mods/dynamicCellMeta.mjs +4 -1
  61. package/dist/handsontable.css +4 -15
  62. package/dist/handsontable.full.css +4 -17
  63. package/dist/handsontable.full.js +4573 -4013
  64. package/dist/handsontable.full.min.css +3 -3
  65. package/dist/handsontable.full.min.js +148 -148
  66. package/dist/handsontable.js +4287 -3730
  67. package/dist/handsontable.min.css +3 -3
  68. package/dist/handsontable.min.js +19 -19
  69. package/editorManager.js +1 -7
  70. package/editorManager.mjs +1 -7
  71. package/editors/autocompleteEditor/autocompleteEditor.js +31 -7
  72. package/editors/autocompleteEditor/autocompleteEditor.mjs +31 -7
  73. package/focusManager.js +4 -2
  74. package/focusManager.mjs +4 -2
  75. package/helpers/browser.js +1 -1
  76. package/helpers/browser.mjs +1 -1
  77. package/helpers/dom/element.d.ts +1 -0
  78. package/helpers/dom/element.js +20 -0
  79. package/helpers/dom/element.mjs +19 -0
  80. package/helpers/mixed.js +2 -2
  81. package/helpers/mixed.mjs +2 -2
  82. package/helpers/object.js +3 -0
  83. package/helpers/object.mjs +3 -0
  84. package/package.json +1 -1
  85. package/plugins/autoColumnSize/autoColumnSize.js +38 -17
  86. package/plugins/autoColumnSize/autoColumnSize.mjs +38 -17
  87. package/plugins/autoRowSize/autoRowSize.js +12 -6
  88. package/plugins/autoRowSize/autoRowSize.mjs +12 -6
  89. package/plugins/columnSorting/columnSorting.js +0 -4
  90. package/plugins/columnSorting/columnSorting.mjs +0 -4
  91. package/plugins/comments/comments.js +1 -0
  92. package/plugins/comments/comments.mjs +1 -0
  93. package/plugins/contextMenu/menu/defaultShortcutsList.js +2 -2
  94. package/plugins/contextMenu/menu/defaultShortcutsList.mjs +2 -2
  95. package/plugins/contextMenu/menu/menu.js +1 -0
  96. package/plugins/contextMenu/menu/menu.mjs +1 -0
  97. package/plugins/contextMenu/menu/positioner.js +10 -2
  98. package/plugins/contextMenu/menu/positioner.mjs +10 -2
  99. package/plugins/contextMenu/predefinedItems/redo.js +3 -3
  100. package/plugins/contextMenu/predefinedItems/redo.mjs +3 -3
  101. package/plugins/contextMenu/predefinedItems/undo.js +3 -3
  102. package/plugins/contextMenu/predefinedItems/undo.mjs +3 -3
  103. package/plugins/copyPaste/copyPaste.js +12 -9
  104. package/plugins/copyPaste/copyPaste.mjs +12 -9
  105. package/plugins/copyPaste/pasteEvent.js +3 -0
  106. package/plugins/copyPaste/pasteEvent.mjs +3 -0
  107. package/plugins/exportFile/exportFile.d.ts +1 -0
  108. package/plugins/exportFile/exportFile.js +2 -1
  109. package/plugins/exportFile/exportFile.mjs +2 -1
  110. package/plugins/exportFile/types/csv.js +76 -11
  111. package/plugins/exportFile/types/csv.mjs +76 -11
  112. package/plugins/filters/filters.js +24 -23
  113. package/plugins/filters/filters.mjs +24 -23
  114. package/plugins/filters/ui/multipleSelect.js +7 -1
  115. package/plugins/filters/ui/multipleSelect.mjs +7 -1
  116. package/plugins/formulas/formulas.d.ts +1 -1
  117. package/plugins/formulas/formulas.js +57 -60
  118. package/plugins/formulas/formulas.mjs +59 -62
  119. package/plugins/formulas/indexSyncer/axisSyncer.js +5 -1
  120. package/plugins/formulas/indexSyncer/axisSyncer.mjs +5 -1
  121. package/plugins/hiddenColumns/hiddenColumns.js +1 -1
  122. package/plugins/hiddenColumns/hiddenColumns.mjs +1 -1
  123. package/plugins/hiddenRows/hiddenRows.js +1 -1
  124. package/plugins/hiddenRows/hiddenRows.mjs +1 -1
  125. package/plugins/manualColumnResize/manualColumnResize.js +4 -6
  126. package/plugins/manualColumnResize/manualColumnResize.mjs +4 -6
  127. package/plugins/manualRowResize/manualRowResize.js +4 -6
  128. package/plugins/manualRowResize/manualRowResize.mjs +4 -6
  129. package/plugins/mergeCells/mergeCells.js +10 -30
  130. package/plugins/mergeCells/mergeCells.mjs +10 -30
  131. package/plugins/mergeCells/renderer.js +15 -0
  132. package/plugins/mergeCells/renderer.mjs +15 -0
  133. package/plugins/mergeCells/utils.js +31 -0
  134. package/plugins/mergeCells/utils.mjs +27 -0
  135. package/plugins/nestedRows/data/dataManager.js +2 -2
  136. package/plugins/nestedRows/data/dataManager.mjs +2 -2
  137. package/plugins/undoRedo/actions/index.js +0 -2
  138. package/plugins/undoRedo/actions/index.mjs +0 -2
  139. package/plugins/undoRedo/actions/removeColumn.js +19 -14
  140. package/plugins/undoRedo/actions/removeColumn.mjs +19 -14
  141. package/plugins/undoRedo/actions/removeRow.js +12 -4
  142. package/plugins/undoRedo/actions/removeRow.mjs +12 -4
  143. package/selection/selection.js +3 -1
  144. package/selection/selection.mjs +3 -1
  145. package/shortcutContexts/commands/extendCellsSelection/down.js +7 -2
  146. package/shortcutContexts/commands/extendCellsSelection/down.mjs +7 -2
  147. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +8 -2
  148. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +8 -2
  149. package/shortcutContexts/commands/extendCellsSelection/left.js +7 -2
  150. package/shortcutContexts/commands/extendCellsSelection/left.mjs +7 -2
  151. package/shortcutContexts/commands/extendCellsSelection/right.js +7 -2
  152. package/shortcutContexts/commands/extendCellsSelection/right.mjs +7 -2
  153. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +7 -2
  154. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +7 -2
  155. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +3 -1
  156. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +3 -1
  157. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +3 -1
  158. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +3 -1
  159. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +3 -1
  160. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +3 -1
  161. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +3 -1
  162. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +3 -1
  163. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +3 -1
  164. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +3 -1
  165. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +3 -1
  166. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +3 -1
  167. package/shortcutContexts/commands/extendCellsSelection/toRows.js +7 -2
  168. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +7 -2
  169. package/shortcutContexts/commands/extendCellsSelection/up.js +7 -2
  170. package/shortcutContexts/commands/extendCellsSelection/up.mjs +7 -2
  171. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +8 -2
  172. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +8 -2
  173. package/shortcutContexts/commands/index.js +0 -2
  174. package/shortcutContexts/commands/index.mjs +0 -2
  175. package/shortcutContexts/commands/moveCellSelection/down.js +2 -0
  176. package/shortcutContexts/commands/moveCellSelection/down.mjs +2 -0
  177. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +6 -1
  178. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +6 -1
  179. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +8 -3
  180. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -3
  181. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +8 -3
  182. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -3
  183. package/shortcutContexts/commands/moveCellSelection/left.js +6 -1
  184. package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -1
  185. package/shortcutContexts/commands/moveCellSelection/right.js +6 -1
  186. package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -1
  187. package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +4 -1
  188. package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +4 -1
  189. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +2 -0
  190. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +2 -0
  191. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +2 -0
  192. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +2 -0
  193. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +2 -0
  194. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +2 -0
  195. package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +2 -0
  196. package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +2 -0
  197. package/shortcutContexts/commands/moveCellSelection/toMostRight.js +2 -0
  198. package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +2 -0
  199. package/shortcutContexts/commands/moveCellSelection/toMostTop.js +6 -1
  200. package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +6 -1
  201. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +2 -0
  202. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +2 -0
  203. package/shortcutContexts/commands/moveCellSelection/up.js +2 -0
  204. package/shortcutContexts/commands/moveCellSelection/up.mjs +2 -0
  205. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +6 -1
  206. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +6 -1
  207. package/shortcutContexts/commands/selectAllCells.js +7 -2
  208. package/shortcutContexts/commands/selectAllCells.mjs +7 -2
  209. package/shortcutContexts/commands/selectAllCellsAndHeaders.js +7 -2
  210. package/shortcutContexts/commands/selectAllCellsAndHeaders.mjs +7 -2
  211. package/shortcutContexts/index.js +2 -2
  212. package/shortcutContexts/index.mjs +0 -2
  213. package/styles/handsontable.css +15 -17
  214. package/styles/handsontable.min.css +3 -3
  215. package/styles/ht-theme-horizon.css +2 -2
  216. package/styles/ht-theme-horizon.min.css +2 -2
  217. package/styles/ht-theme-main.css +2 -2
  218. package/styles/ht-theme-main.min.css +2 -2
  219. package/tableView.js +5 -8
  220. package/tableView.mjs +5 -8
  221. package/translations/indexMapper.js +0 -1
  222. package/translations/indexMapper.mjs +0 -1
  223. package/utils/ghostTable.js +3 -0
  224. package/utils/ghostTable.mjs +3 -0
@@ -1,4 +1,6 @@
1
1
  import { isObject } from "../../helpers/object.mjs";
2
+ import { isSafari } from "../../helpers/browser.mjs";
3
+ import { sumCellsHeights } from "./utils.mjs";
2
4
  /**
3
5
  * Creates a renderer object for the `MergeCells` plugin.
4
6
  *
@@ -14,6 +16,7 @@ export function createMergeCellRenderer(plugin) {
14
16
  rowIndexMapper: rowMapper,
15
17
  columnIndexMapper: columnMapper
16
18
  } = hot;
19
+ const updateNextCellsHeight = new Map();
17
20
 
18
21
  /**
19
22
  * Runs before the cell is rendered.
@@ -35,6 +38,10 @@ export function createMergeCellRenderer(plugin) {
35
38
  if (!isObject(mergedCell)) {
36
39
  TD.removeAttribute('rowspan');
37
40
  TD.removeAttribute('colspan');
41
+ if (isSafari() && updateNextCellsHeight.has(row) && !hot.getSettings().rowHeaders) {
42
+ TD.style.height = `${updateNextCellsHeight.get(row)}px`;
43
+ updateNextCellsHeight.delete(row);
44
+ }
38
45
  TD.style.display = '';
39
46
  return;
40
47
  }
@@ -46,6 +53,14 @@ export function createMergeCellRenderer(plugin) {
46
53
  } = mergedCell;
47
54
  const [lastMergedRowIndex, lastMergedColumnIndex] = plugin.translateMergedCellToRenderable(origRow, origRowspan, origColumn, origColspan);
48
55
  const isVirtualRenderingEnabled = plugin.getSetting('virtualized');
56
+
57
+ // Safari bug fix - the height of the cells next to the merged cell must be defined
58
+ // so that their height is proportional to the height of the merged cell
59
+ // (this emulates default behavior in Chrome, FF etc.)
60
+ if (isSafari() && origColumn === 0 && !hot.getSettings().rowHeaders) {
61
+ const height = sumCellsHeights(hot, origRow, origRowspan);
62
+ updateNextCellsHeight.set(row, height / origRowspan);
63
+ }
49
64
  const renderedRowIndex = rowMapper.getRenderableFromVisualIndex(row);
50
65
  const renderedColumnIndex = columnMapper.getRenderableFromVisualIndex(col);
51
66
  const maxRowSpan = lastMergedRowIndex - renderedRowIndex + 1; // Number of rendered columns.
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.sumCellsHeights = sumCellsHeights;
5
+ /**
6
+ * Calculates the total height of the merged cell.
7
+ *
8
+ * @param {Core} hotInstance The Handsontable instance.
9
+ * @param {*} row The merged cell's row index.
10
+ * @param {*} rowspan The merged cell height.
11
+ * @returns {number}
12
+ */
13
+ function sumCellsHeights(hotInstance, row, rowspan) {
14
+ const {
15
+ view,
16
+ rowIndexMapper
17
+ } = hotInstance;
18
+ const stylesHandler = view.getStylesHandler();
19
+ const defaultHeight = view.getDefaultRowHeight();
20
+ let height = 0;
21
+ for (let i = row; i < row + rowspan; i++) {
22
+ if (!rowIndexMapper.isHidden(i)) {
23
+ var _hotInstance$getRowHe;
24
+ height += (_hotInstance$getRowHe = hotInstance.getRowHeight(i)) !== null && _hotInstance$getRowHe !== void 0 ? _hotInstance$getRowHe : defaultHeight;
25
+ if (i === 0 && !stylesHandler.isClassicTheme()) {
26
+ height += 1; // border-top-width
27
+ }
28
+ }
29
+ }
30
+ return height;
31
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Calculates the total height of the merged cell.
3
+ *
4
+ * @param {Core} hotInstance The Handsontable instance.
5
+ * @param {*} row The merged cell's row index.
6
+ * @param {*} rowspan The merged cell height.
7
+ * @returns {number}
8
+ */
9
+ export function sumCellsHeights(hotInstance, row, rowspan) {
10
+ const {
11
+ view,
12
+ rowIndexMapper
13
+ } = hotInstance;
14
+ const stylesHandler = view.getStylesHandler();
15
+ const defaultHeight = view.getDefaultRowHeight();
16
+ let height = 0;
17
+ for (let i = row; i < row + rowspan; i++) {
18
+ if (!rowIndexMapper.isHidden(i)) {
19
+ var _hotInstance$getRowHe;
20
+ height += (_hotInstance$getRowHe = hotInstance.getRowHeight(i)) !== null && _hotInstance$getRowHe !== void 0 ? _hotInstance$getRowHe : defaultHeight;
21
+ if (i === 0 && !stylesHandler.isClassicTheme()) {
22
+ height += 1; // border-top-width
23
+ }
24
+ }
25
+ }
26
+ return height;
27
+ }
@@ -627,7 +627,7 @@ class DataManager {
627
627
  */
628
628
  syncRowWithRawSource(rowElement) {
629
629
  let upmostParent = rowElement;
630
- let tempParent = null;
630
+ let tempParent = upmostParent;
631
631
  do {
632
632
  tempParent = this.getRowParent(tempParent);
633
633
  if (tempParent !== null) {
@@ -635,7 +635,7 @@ class DataManager {
635
635
  }
636
636
  } while (tempParent !== null);
637
637
  this.plugin.disableCoreAPIModifiers();
638
- this.hot.setSourceDataAtCell(this.getRowIndex(upmostParent), '__children', upmostParent.__children, 'NestedRows.syncRowWithRawSource');
638
+ this.hot.setSourceDataAtCell(this.getRowIndexWithinParent(upmostParent), '__children', upmostParent.__children, 'NestedRows.syncRowWithRawSource');
639
639
  this.plugin.enableCoreAPIModifiers();
640
640
  }
641
641
 
@@ -624,7 +624,7 @@ class DataManager {
624
624
  */
625
625
  syncRowWithRawSource(rowElement) {
626
626
  let upmostParent = rowElement;
627
- let tempParent = null;
627
+ let tempParent = upmostParent;
628
628
  do {
629
629
  tempParent = this.getRowParent(tempParent);
630
630
  if (tempParent !== null) {
@@ -632,7 +632,7 @@ class DataManager {
632
632
  }
633
633
  } while (tempParent !== null);
634
634
  this.plugin.disableCoreAPIModifiers();
635
- this.hot.setSourceDataAtCell(this.getRowIndex(upmostParent), '__children', upmostParent.__children, 'NestedRows.syncRowWithRawSource');
635
+ this.hot.setSourceDataAtCell(this.getRowIndexWithinParent(upmostParent), '__children', upmostParent.__children, 'NestedRows.syncRowWithRawSource');
636
636
  this.plugin.enableCoreAPIModifiers();
637
637
  }
638
638
 
@@ -2,8 +2,6 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.registerActions = registerActions;
5
- require("core-js/modules/esnext.iterator.constructor.js");
6
- require("core-js/modules/esnext.iterator.for-each.js");
7
5
  var _cellAlignment = require("./cellAlignment");
8
6
  var _columnMove = require("./columnMove");
9
7
  var _columnSort = require("./columnSort");
@@ -1,5 +1,3 @@
1
- import "core-js/modules/esnext.iterator.constructor.js";
2
- import "core-js/modules/esnext.iterator.for-each.js";
3
1
  import { CellAlignmentAction } from "./cellAlignment.mjs";
4
2
  import { ColumnMoveAction } from "./columnMove.mjs";
5
3
  import { ColumnSortAction } from "./columnSort.mjs";
@@ -37,7 +37,7 @@ class RemoveColumnAction extends _base.BaseAction {
37
37
  */
38
38
  _defineProperty(this, "index", void 0);
39
39
  /**
40
- * @param {number[]} indexes The visual column indexes.
40
+ * @param {number[]} indexes The physical column indexes.
41
41
  */
42
42
  _defineProperty(this, "indexes", void 0);
43
43
  /**
@@ -103,16 +103,14 @@ class RemoveColumnAction extends _base.BaseAction {
103
103
  headers.push(hot.getSettings().colHeaders[hot.toPhysicalColumn(columnIndex + i)] || null);
104
104
  });
105
105
  }
106
- const columnsMap = hot.columnIndexMapper.getIndexesSequence();
107
- const rowsMap = hot.rowIndexMapper.getIndexesSequence();
108
106
  return new RemoveColumnAction({
109
107
  index: columnIndex,
110
108
  indexes,
111
109
  data: removedData,
112
110
  amount,
113
111
  headers,
114
- columnPositions: columnsMap,
115
- rowPositions: rowsMap,
112
+ columnPositions: hot.columnIndexMapper.getIndexesSequence(),
113
+ rowPositions: hot.rowIndexMapper.getIndexesSequence(),
116
114
  fixedColumnsStart: hot.getSettings().fixedColumnsStart,
117
115
  removedCellMetas: (0, _utils.getCellMetas)(hot, 0, hot.countRows(), columnIndex, lastColumnIndex)
118
116
  });
@@ -139,14 +137,27 @@ class RemoveColumnAction extends _base.BaseAction {
139
137
  }
140
138
  const sortedHeaders = (0, _array.arrayMap)(this.headers, sortByIndexes);
141
139
  const changes = [];
142
- hot.alter('insert_col_start', this.indexes[0], this.indexes.length, 'UndoRedo.undo');
140
+
141
+ // The indexes sequence have to be applied twice.
142
+ // * First for proper index translation. The alter method accepts a visual index
143
+ // and we are able to retrieve the correct index indicating where to add a new row based
144
+ // only on the previous order state of the columns;
145
+ // * The alter method shifts the indexes (a side-effect), so we need to reapply the indexes sequence
146
+ // the same as it was in the previous state;
147
+ hot.columnIndexMapper.setIndexesSequence(this.columnPositions);
148
+ hot.alter('insert_col_start', hot.toVisualColumn(this.indexes[0]), this.indexes.length, 'UndoRedo.undo');
149
+ hot.batchExecution(() => {
150
+ // Restore row sequence in a case when all columns are removed. the original
151
+ // row sequence is lost in that case.
152
+ hot.rowIndexMapper.setIndexesSequence(this.rowPositions);
153
+ hot.columnIndexMapper.setIndexesSequence(this.columnPositions);
154
+ }, true);
143
155
  (0, _array.arrayEach)(hot.getSourceDataArray(), (rowData, rowIndex) => {
144
156
  (0, _array.arrayEach)(ascendingIndexes, (changedIndex, contiquesIndex) => {
145
157
  rowData[changedIndex] = sortedData[rowIndex][contiquesIndex];
146
158
  changes.push([rowIndex, changedIndex, rowData[changedIndex]]);
147
159
  });
148
160
  });
149
- hot.setSourceDataAtCell(changes, undefined, undefined, 'UndoRedo.undo');
150
161
  if (typeof this.headers !== 'undefined') {
151
162
  (0, _array.arrayEach)(sortedHeaders, (headerData, columnIndex) => {
152
163
  hot.getSettings().colHeaders[ascendingIndexes[columnIndex]] = headerData;
@@ -156,14 +167,8 @@ class RemoveColumnAction extends _base.BaseAction {
156
167
  let [rowIndex, columnIndex, cellMeta] = _ref2;
157
168
  hot.setCellMetaObject(rowIndex, columnIndex, cellMeta);
158
169
  });
159
- hot.batchExecution(() => {
160
- // Restore row sequence in a case when all columns are removed. the original
161
- // row sequence is lost in that case.
162
- hot.rowIndexMapper.setIndexesSequence(this.rowPositions);
163
- hot.columnIndexMapper.setIndexesSequence(this.columnPositions);
164
- }, true);
165
170
  hot.addHookOnce('afterViewRender', undoneCallback);
166
- hot.render();
171
+ hot.setSourceDataAtCell(changes, null, null, 'UndoRedo.undo');
167
172
  }
168
173
 
169
174
  /**
@@ -34,7 +34,7 @@ export class RemoveColumnAction extends BaseAction {
34
34
  */
35
35
  _defineProperty(this, "index", void 0);
36
36
  /**
37
- * @param {number[]} indexes The visual column indexes.
37
+ * @param {number[]} indexes The physical column indexes.
38
38
  */
39
39
  _defineProperty(this, "indexes", void 0);
40
40
  /**
@@ -100,16 +100,14 @@ export class RemoveColumnAction extends BaseAction {
100
100
  headers.push(hot.getSettings().colHeaders[hot.toPhysicalColumn(columnIndex + i)] || null);
101
101
  });
102
102
  }
103
- const columnsMap = hot.columnIndexMapper.getIndexesSequence();
104
- const rowsMap = hot.rowIndexMapper.getIndexesSequence();
105
103
  return new RemoveColumnAction({
106
104
  index: columnIndex,
107
105
  indexes,
108
106
  data: removedData,
109
107
  amount,
110
108
  headers,
111
- columnPositions: columnsMap,
112
- rowPositions: rowsMap,
109
+ columnPositions: hot.columnIndexMapper.getIndexesSequence(),
110
+ rowPositions: hot.rowIndexMapper.getIndexesSequence(),
113
111
  fixedColumnsStart: hot.getSettings().fixedColumnsStart,
114
112
  removedCellMetas: getCellMetas(hot, 0, hot.countRows(), columnIndex, lastColumnIndex)
115
113
  });
@@ -136,14 +134,27 @@ export class RemoveColumnAction extends BaseAction {
136
134
  }
137
135
  const sortedHeaders = arrayMap(this.headers, sortByIndexes);
138
136
  const changes = [];
139
- hot.alter('insert_col_start', this.indexes[0], this.indexes.length, 'UndoRedo.undo');
137
+
138
+ // The indexes sequence have to be applied twice.
139
+ // * First for proper index translation. The alter method accepts a visual index
140
+ // and we are able to retrieve the correct index indicating where to add a new row based
141
+ // only on the previous order state of the columns;
142
+ // * The alter method shifts the indexes (a side-effect), so we need to reapply the indexes sequence
143
+ // the same as it was in the previous state;
144
+ hot.columnIndexMapper.setIndexesSequence(this.columnPositions);
145
+ hot.alter('insert_col_start', hot.toVisualColumn(this.indexes[0]), this.indexes.length, 'UndoRedo.undo');
146
+ hot.batchExecution(() => {
147
+ // Restore row sequence in a case when all columns are removed. the original
148
+ // row sequence is lost in that case.
149
+ hot.rowIndexMapper.setIndexesSequence(this.rowPositions);
150
+ hot.columnIndexMapper.setIndexesSequence(this.columnPositions);
151
+ }, true);
140
152
  arrayEach(hot.getSourceDataArray(), (rowData, rowIndex) => {
141
153
  arrayEach(ascendingIndexes, (changedIndex, contiquesIndex) => {
142
154
  rowData[changedIndex] = sortedData[rowIndex][contiquesIndex];
143
155
  changes.push([rowIndex, changedIndex, rowData[changedIndex]]);
144
156
  });
145
157
  });
146
- hot.setSourceDataAtCell(changes, undefined, undefined, 'UndoRedo.undo');
147
158
  if (typeof this.headers !== 'undefined') {
148
159
  arrayEach(sortedHeaders, (headerData, columnIndex) => {
149
160
  hot.getSettings().colHeaders[ascendingIndexes[columnIndex]] = headerData;
@@ -153,14 +164,8 @@ export class RemoveColumnAction extends BaseAction {
153
164
  let [rowIndex, columnIndex, cellMeta] = _ref2;
154
165
  hot.setCellMetaObject(rowIndex, columnIndex, cellMeta);
155
166
  });
156
- hot.batchExecution(() => {
157
- // Restore row sequence in a case when all columns are removed. the original
158
- // row sequence is lost in that case.
159
- hot.rowIndexMapper.setIndexesSequence(this.rowPositions);
160
- hot.columnIndexMapper.setIndexesSequence(this.columnPositions);
161
- }, true);
162
167
  hot.addHookOnce('afterViewRender', undoneCallback);
163
- hot.render();
168
+ hot.setSourceDataAtCell(changes, null, null, 'UndoRedo.undo');
164
169
  }
165
170
 
166
171
  /**
@@ -29,7 +29,7 @@ class RemoveRowAction extends _base.BaseAction {
29
29
  } = _ref;
30
30
  super('remove_row');
31
31
  /**
32
- * @param {number} index The visual row index.
32
+ * @param {number} index The physical row index.
33
33
  */
34
34
  _defineProperty(this, "index", void 0);
35
35
  /**
@@ -97,14 +97,22 @@ class RemoveRowAction extends _base.BaseAction {
97
97
  changes.push([this.index + rowIndexDelta, isNaN(columnIndex) ? columnProp : columnIndex, dataRow[columnProp]]);
98
98
  });
99
99
  });
100
- hot.alter('insert_row_above', this.index, this.data.length, 'UndoRedo.undo');
100
+
101
+ // The indexes sequence have to be applied twice.
102
+ // * First for proper index translation. The alter method accepts a visual index
103
+ // and we are able to retrieve the correct index indicating where to add a new row based
104
+ // only on the previous order state of the rows;
105
+ // * The alter method shifts the indexes (a side-effect), so we need to reapply the indexes sequence
106
+ // the same as it was in the previous state;
107
+ hot.rowIndexMapper.setIndexesSequence(this.rowIndexesSequence);
108
+ hot.alter('insert_row_above', hot.toVisualRow(this.index), this.data.length, 'UndoRedo.undo');
109
+ hot.rowIndexMapper.setIndexesSequence(this.rowIndexesSequence);
101
110
  this.removedCellMetas.forEach(_ref2 => {
102
111
  let [rowIndex, columnIndex, cellMeta] = _ref2;
103
112
  hot.setCellMetaObject(rowIndex, columnIndex, cellMeta);
104
113
  });
105
114
  hot.addHookOnce('afterViewRender', undoneCallback);
106
115
  hot.setSourceDataAtCell(changes, null, null, 'UndoRedo.undo');
107
- hot.rowIndexMapper.setIndexesSequence(this.rowIndexesSequence);
108
116
  }
109
117
 
110
118
  /**
@@ -113,7 +121,7 @@ class RemoveRowAction extends _base.BaseAction {
113
121
  */
114
122
  redo(hot, redoneCallback) {
115
123
  hot.addHookOnce('afterRemoveRow', redoneCallback);
116
- hot.alter('remove_row', this.index, this.data.length, 'UndoRedo.redo');
124
+ hot.alter('remove_row', hot.toVisualRow(this.index), this.data.length, 'UndoRedo.redo');
117
125
  }
118
126
  }
119
127
  exports.RemoveRowAction = RemoveRowAction;
@@ -26,7 +26,7 @@ export class RemoveRowAction extends BaseAction {
26
26
  } = _ref;
27
27
  super('remove_row');
28
28
  /**
29
- * @param {number} index The visual row index.
29
+ * @param {number} index The physical row index.
30
30
  */
31
31
  _defineProperty(this, "index", void 0);
32
32
  /**
@@ -94,14 +94,22 @@ export class RemoveRowAction extends BaseAction {
94
94
  changes.push([this.index + rowIndexDelta, isNaN(columnIndex) ? columnProp : columnIndex, dataRow[columnProp]]);
95
95
  });
96
96
  });
97
- hot.alter('insert_row_above', this.index, this.data.length, 'UndoRedo.undo');
97
+
98
+ // The indexes sequence have to be applied twice.
99
+ // * First for proper index translation. The alter method accepts a visual index
100
+ // and we are able to retrieve the correct index indicating where to add a new row based
101
+ // only on the previous order state of the rows;
102
+ // * The alter method shifts the indexes (a side-effect), so we need to reapply the indexes sequence
103
+ // the same as it was in the previous state;
104
+ hot.rowIndexMapper.setIndexesSequence(this.rowIndexesSequence);
105
+ hot.alter('insert_row_above', hot.toVisualRow(this.index), this.data.length, 'UndoRedo.undo');
106
+ hot.rowIndexMapper.setIndexesSequence(this.rowIndexesSequence);
98
107
  this.removedCellMetas.forEach(_ref2 => {
99
108
  let [rowIndex, columnIndex, cellMeta] = _ref2;
100
109
  hot.setCellMetaObject(rowIndex, columnIndex, cellMeta);
101
110
  });
102
111
  hot.addHookOnce('afterViewRender', undoneCallback);
103
112
  hot.setSourceDataAtCell(changes, null, null, 'UndoRedo.undo');
104
- hot.rowIndexMapper.setIndexesSequence(this.rowIndexesSequence);
105
113
  }
106
114
 
107
115
  /**
@@ -110,6 +118,6 @@ export class RemoveRowAction extends BaseAction {
110
118
  */
111
119
  redo(hot, redoneCallback) {
112
120
  hot.addHookOnce('afterRemoveRow', redoneCallback);
113
- hot.alter('remove_row', this.index, this.data.length, 'UndoRedo.redo');
121
+ hot.alter('remove_row', hot.toVisualRow(this.index), this.data.length, 'UndoRedo.redo');
114
122
  }
115
123
  }
@@ -1192,7 +1192,9 @@ class Selection {
1192
1192
  col: (0, _number.clamp)(to.col, 0, countColumns - 1)
1193
1193
  });
1194
1194
  this.selectedRange.ranges.push(range);
1195
- this.highlight.getFocus().add(highlight).commit().syncWith(range);
1195
+ if (this.highlight.isEnabledFor(_highlight.FOCUS_TYPE, this.selectedRange.current().highlight)) {
1196
+ this.highlight.getFocus().add(highlight).commit().syncWith(range);
1197
+ }
1196
1198
  this.applyAndCommit(range);
1197
1199
  }
1198
1200
 
@@ -1186,7 +1186,9 @@ class Selection {
1186
1186
  col: clamp(to.col, 0, countColumns - 1)
1187
1187
  });
1188
1188
  this.selectedRange.ranges.push(range);
1189
- this.highlight.getFocus().add(highlight).commit().syncWith(range);
1189
+ if (this.highlight.isEnabledFor(FOCUS_TYPE, this.selectedRange.current().highlight)) {
1190
+ this.highlight.getFocus().add(highlight).commit().syncWith(range);
1191
+ }
1190
1192
  this.applyAndCommit(range);
1191
1193
  }
1192
1194
 
@@ -4,11 +4,16 @@ exports.__esModule = true;
4
4
  const command = exports.command = {
5
5
  name: 'extendCellsSelectionDown',
6
6
  callback(hot) {
7
+ const {
8
+ selection
9
+ } = hot;
7
10
  const {
8
11
  highlight
9
12
  } = hot.getSelectedRangeLast();
10
- if (!hot.selection.isSelectedByColumnHeader() && !hot.selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByRowHeader())) {
11
- hot.selection.transformEnd(1, 0);
13
+ if (!selection.isSelectedByColumnHeader() && !selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && selection.isSelectedByRowHeader())) {
14
+ selection.markSource('keyboard');
15
+ selection.transformEnd(1, 0);
16
+ selection.markEndSource();
12
17
  }
13
18
  }
14
19
  };
@@ -1,11 +1,16 @@
1
1
  export const command = {
2
2
  name: 'extendCellsSelectionDown',
3
3
  callback(hot) {
4
+ const {
5
+ selection
6
+ } = hot;
4
7
  const {
5
8
  highlight
6
9
  } = hot.getSelectedRangeLast();
7
- if (!hot.selection.isSelectedByColumnHeader() && !hot.selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByRowHeader())) {
8
- hot.selection.transformEnd(1, 0);
10
+ if (!selection.isSelectedByColumnHeader() && !selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && selection.isSelectedByRowHeader())) {
11
+ selection.markSource('keyboard');
12
+ selection.transformEnd(1, 0);
13
+ selection.markEndSource();
9
14
  }
10
15
  }
11
16
  };
@@ -4,16 +4,22 @@ exports.__esModule = true;
4
4
  const command = exports.command = {
5
5
  name: 'extendCellsSelectionDownByViewportHeight',
6
6
  callback(hot) {
7
+ const {
8
+ selection,
9
+ rowIndexMapper
10
+ } = hot;
7
11
  const {
8
12
  to
9
13
  } = hot.getSelectedRangeLast();
10
14
  const nextRowIndexToSelect = Math.min(to.row + hot.countVisibleRows(), hot.countRows() - 1);
11
- const row = hot.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, -1);
15
+ const row = rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, -1);
12
16
  if (row !== null) {
13
17
  const coords = hot._createCellCoords(row, to.col);
14
18
  const scrollPadding = to.row - hot.getFirstFullyVisibleRow();
15
19
  const nextVerticalScroll = Math.min(coords.row - scrollPadding, hot.countRows() - 1);
16
- hot.selection.setRangeEnd(coords);
20
+ selection.markSource('keyboard');
21
+ selection.setRangeEnd(coords);
22
+ selection.markEndSource();
17
23
  hot.scrollViewportTo({
18
24
  row: nextVerticalScroll,
19
25
  verticalSnap: 'top',
@@ -1,16 +1,22 @@
1
1
  export const command = {
2
2
  name: 'extendCellsSelectionDownByViewportHeight',
3
3
  callback(hot) {
4
+ const {
5
+ selection,
6
+ rowIndexMapper
7
+ } = hot;
4
8
  const {
5
9
  to
6
10
  } = hot.getSelectedRangeLast();
7
11
  const nextRowIndexToSelect = Math.min(to.row + hot.countVisibleRows(), hot.countRows() - 1);
8
- const row = hot.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, -1);
12
+ const row = rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, -1);
9
13
  if (row !== null) {
10
14
  const coords = hot._createCellCoords(row, to.col);
11
15
  const scrollPadding = to.row - hot.getFirstFullyVisibleRow();
12
16
  const nextVerticalScroll = Math.min(coords.row - scrollPadding, hot.countRows() - 1);
13
- hot.selection.setRangeEnd(coords);
17
+ selection.markSource('keyboard');
18
+ selection.setRangeEnd(coords);
19
+ selection.markEndSource();
14
20
  hot.scrollViewportTo({
15
21
  row: nextVerticalScroll,
16
22
  verticalSnap: 'top',
@@ -4,11 +4,16 @@ exports.__esModule = true;
4
4
  const command = exports.command = {
5
5
  name: 'extendCellsSelectionLeft',
6
6
  callback(hot) {
7
+ const {
8
+ selection
9
+ } = hot;
7
10
  const {
8
11
  highlight
9
12
  } = hot.getSelectedRangeLast();
10
- if (!hot.selection.isSelectedByRowHeader() && !hot.selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByColumnHeader())) {
11
- hot.selection.transformEnd(0, -1 * hot.getDirectionFactor());
13
+ if (!selection.isSelectedByRowHeader() && !selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && selection.isSelectedByColumnHeader())) {
14
+ selection.markSource('keyboard');
15
+ selection.transformEnd(0, -1 * hot.getDirectionFactor());
16
+ selection.markEndSource();
12
17
  }
13
18
  }
14
19
  };
@@ -1,11 +1,16 @@
1
1
  export const command = {
2
2
  name: 'extendCellsSelectionLeft',
3
3
  callback(hot) {
4
+ const {
5
+ selection
6
+ } = hot;
4
7
  const {
5
8
  highlight
6
9
  } = hot.getSelectedRangeLast();
7
- if (!hot.selection.isSelectedByRowHeader() && !hot.selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByColumnHeader())) {
8
- hot.selection.transformEnd(0, -1 * hot.getDirectionFactor());
10
+ if (!selection.isSelectedByRowHeader() && !selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && selection.isSelectedByColumnHeader())) {
11
+ selection.markSource('keyboard');
12
+ selection.transformEnd(0, -1 * hot.getDirectionFactor());
13
+ selection.markEndSource();
9
14
  }
10
15
  }
11
16
  };
@@ -4,11 +4,16 @@ exports.__esModule = true;
4
4
  const command = exports.command = {
5
5
  name: 'extendCellsSelectionRight',
6
6
  callback(hot) {
7
+ const {
8
+ selection
9
+ } = hot;
7
10
  const {
8
11
  highlight
9
12
  } = hot.getSelectedRangeLast();
10
- if (!hot.selection.isSelectedByRowHeader() && !hot.selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByColumnHeader())) {
11
- hot.selection.transformEnd(0, hot.getDirectionFactor());
13
+ if (!selection.isSelectedByRowHeader() && !selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && selection.isSelectedByColumnHeader())) {
14
+ selection.markSource('keyboard');
15
+ selection.transformEnd(0, hot.getDirectionFactor());
16
+ selection.markEndSource();
12
17
  }
13
18
  }
14
19
  };
@@ -1,11 +1,16 @@
1
1
  export const command = {
2
2
  name: 'extendCellsSelectionRight',
3
3
  callback(hot) {
4
+ const {
5
+ selection
6
+ } = hot;
4
7
  const {
5
8
  highlight
6
9
  } = hot.getSelectedRangeLast();
7
- if (!hot.selection.isSelectedByRowHeader() && !hot.selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByColumnHeader())) {
8
- hot.selection.transformEnd(0, hot.getDirectionFactor());
10
+ if (!selection.isSelectedByRowHeader() && !selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && selection.isSelectedByColumnHeader())) {
11
+ selection.markSource('keyboard');
12
+ selection.transformEnd(0, hot.getDirectionFactor());
13
+ selection.markEndSource();
9
14
  }
10
15
  }
11
16
  };
@@ -4,15 +4,20 @@ exports.__esModule = true;
4
4
  const command = exports.command = {
5
5
  name: 'extendCellsSelectionToColumns',
6
6
  callback(hot) {
7
+ const {
8
+ selection
9
+ } = hot;
7
10
  const {
8
11
  highlight,
9
12
  from,
10
13
  to
11
14
  } = hot.getSelectedRangeLast();
12
- if (hot.selection.isSelectedByRowHeader()) {
13
- hot.selection.selectAll(true, true);
15
+ selection.markSource('keyboard');
16
+ if (selection.isSelectedByRowHeader()) {
17
+ selection.selectAll(true, true);
14
18
  } else {
15
19
  hot.selectColumns(from.col, to.col, highlight);
16
20
  }
21
+ selection.markEndSource();
17
22
  }
18
23
  };
@@ -1,15 +1,20 @@
1
1
  export const command = {
2
2
  name: 'extendCellsSelectionToColumns',
3
3
  callback(hot) {
4
+ const {
5
+ selection
6
+ } = hot;
4
7
  const {
5
8
  highlight,
6
9
  from,
7
10
  to
8
11
  } = hot.getSelectedRangeLast();
9
- if (hot.selection.isSelectedByRowHeader()) {
10
- hot.selection.selectAll(true, true);
12
+ selection.markSource('keyboard');
13
+ if (selection.isSelectedByRowHeader()) {
14
+ selection.selectAll(true, true);
11
15
  } else {
12
16
  hot.selectColumns(from.col, to.col, highlight);
13
17
  }
18
+ selection.markEndSource();
14
19
  }
15
20
  };
@@ -13,11 +13,12 @@ const command = exports.command = {
13
13
  from,
14
14
  to
15
15
  } = hot.getSelectedRangeLast();
16
- const isFocusHighlightedByHeader = highlight.isHeader() && hot.selection.isSelectedByRowHeader();
16
+ const isFocusHighlightedByHeader = highlight.isHeader() && selection.isSelectedByRowHeader();
17
17
  if (highlight.isCell() || isFocusHighlightedByHeader) {
18
18
  const row = rowIndexMapper.getNearestNotHiddenIndex(hot.countRows() - 1, -1);
19
19
  const newFrom = from.clone();
20
20
  newFrom.row = highlight.row;
21
+ selection.markSource('keyboard');
21
22
  selection.setRangeStart(newFrom, undefined, false, highlight.clone());
22
23
 
23
24
  // Restore the row highlight by header flag after setting up a new selection.
@@ -25,6 +26,7 @@ const command = exports.command = {
25
26
  selection.selectedByRowHeader.add(selection.getLayerLevel());
26
27
  }
27
28
  selection.setRangeEnd(hot._createCellCoords(row, to.col));
29
+ selection.markEndSource();
28
30
  }
29
31
  }
30
32
  };