handsontable 0.0.0-next-200799f-20240311 → 0.0.0-next-bff5041-20240315

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.

Potentially problematic release.


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

Files changed (272) hide show
  1. package/3rdparty/walkontable/src/calculator/viewportColumns.js +12 -17
  2. package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +12 -17
  3. package/3rdparty/walkontable/src/calculator/viewportRows.js +10 -15
  4. package/3rdparty/walkontable/src/calculator/viewportRows.mjs +10 -15
  5. package/3rdparty/walkontable/src/cell/coords.js +12 -17
  6. package/3rdparty/walkontable/src/cell/coords.mjs +12 -17
  7. package/3rdparty/walkontable/src/cell/range.d.ts +0 -1
  8. package/3rdparty/walkontable/src/cell/range.js +23 -45
  9. package/3rdparty/walkontable/src/cell/range.mjs +23 -45
  10. package/3rdparty/walkontable/src/core/_base.js +1 -1
  11. package/3rdparty/walkontable/src/core/_base.mjs +1 -1
  12. package/3rdparty/walkontable/src/event.js +72 -104
  13. package/3rdparty/walkontable/src/event.mjs +72 -104
  14. package/3rdparty/walkontable/src/overlays.js +1 -1
  15. package/3rdparty/walkontable/src/overlays.mjs +1 -1
  16. package/3rdparty/walkontable/src/scroll.js +15 -17
  17. package/3rdparty/walkontable/src/scroll.mjs +15 -17
  18. package/3rdparty/walkontable/src/selection/manager.js +48 -69
  19. package/3rdparty/walkontable/src/selection/manager.mjs +48 -69
  20. package/3rdparty/walkontable/src/selection/scanner.js +33 -42
  21. package/3rdparty/walkontable/src/selection/scanner.mjs +33 -42
  22. package/3rdparty/walkontable/src/utils/columnStretching.js +27 -44
  23. package/3rdparty/walkontable/src/utils/columnStretching.mjs +27 -44
  24. package/3rdparty/walkontable/src/utils/orderView/view.js +1 -1
  25. package/3rdparty/walkontable/src/utils/orderView/view.mjs +1 -1
  26. package/base.js +2 -2
  27. package/base.mjs +2 -2
  28. package/core/viewportScroll/index.js +1 -4
  29. package/core/viewportScroll/index.mjs +1 -4
  30. package/core.d.ts +3 -4
  31. package/core.js +22 -79
  32. package/core.mjs +22 -79
  33. package/dataMap/dataSource.js +1 -1
  34. package/dataMap/dataSource.mjs +1 -1
  35. package/dataMap/metaManager/metaLayers/cellMeta.js +1 -1
  36. package/dataMap/metaManager/metaLayers/cellMeta.mjs +1 -1
  37. package/dataMap/replaceData.js +1 -1
  38. package/dataMap/replaceData.mjs +1 -1
  39. package/dist/handsontable.css +2 -2
  40. package/dist/handsontable.full.css +2 -2
  41. package/dist/handsontable.full.js +7620 -10327
  42. package/dist/handsontable.full.min.css +2 -2
  43. package/dist/handsontable.full.min.js +277 -277
  44. package/dist/handsontable.js +5525 -7779
  45. package/dist/handsontable.min.css +2 -2
  46. package/dist/handsontable.min.js +33 -33
  47. package/dist/languages/all.min.js +1 -1
  48. package/dist/languages/ar-AR.min.js +1 -1
  49. package/dist/languages/cs-CZ.min.js +1 -1
  50. package/dist/languages/de-CH.min.js +1 -1
  51. package/dist/languages/de-DE.min.js +1 -1
  52. package/dist/languages/en-US.min.js +1 -1
  53. package/dist/languages/es-MX.min.js +1 -1
  54. package/dist/languages/fr-FR.min.js +1 -1
  55. package/dist/languages/hr-HR.min.js +1 -1
  56. package/dist/languages/it-IT.min.js +1 -1
  57. package/dist/languages/ja-JP.min.js +1 -1
  58. package/dist/languages/ko-KR.min.js +1 -1
  59. package/dist/languages/lv-LV.min.js +1 -1
  60. package/dist/languages/nb-NO.min.js +1 -1
  61. package/dist/languages/nl-NL.min.js +1 -1
  62. package/dist/languages/pl-PL.min.js +1 -1
  63. package/dist/languages/pt-BR.min.js +1 -1
  64. package/dist/languages/ru-RU.min.js +1 -1
  65. package/dist/languages/sr-SP.min.js +1 -1
  66. package/dist/languages/zh-CN.min.js +1 -1
  67. package/dist/languages/zh-TW.min.js +1 -1
  68. package/editorManager.js +21 -27
  69. package/editorManager.mjs +21 -27
  70. package/editors/autocompleteEditor/autocompleteEditor.js +6 -10
  71. package/editors/autocompleteEditor/autocompleteEditor.mjs +6 -10
  72. package/eventManager.js +1 -1
  73. package/eventManager.mjs +1 -1
  74. package/focusManager.js +58 -82
  75. package/focusManager.mjs +58 -82
  76. package/helpers/dom/element.js +1 -1
  77. package/helpers/dom/element.mjs +1 -1
  78. package/helpers/mixed.js +1 -1
  79. package/helpers/mixed.mjs +1 -1
  80. package/helpers/object.js +2 -2
  81. package/helpers/object.mjs +2 -2
  82. package/index.d.ts +10 -0
  83. package/package.json +2 -1
  84. package/pluginHooks.d.ts +0 -4
  85. package/pluginHooks.js +2 -44
  86. package/pluginHooks.mjs +2 -44
  87. package/plugins/autoColumnSize/autoColumnSize.js +49 -65
  88. package/plugins/autoColumnSize/autoColumnSize.mjs +49 -65
  89. package/plugins/autoRowSize/autoRowSize.js +28 -34
  90. package/plugins/autoRowSize/autoRowSize.mjs +28 -34
  91. package/plugins/autofill/autofill.js +30 -38
  92. package/plugins/autofill/autofill.mjs +30 -38
  93. package/plugins/base/base.js +12 -17
  94. package/plugins/base/base.mjs +12 -17
  95. package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +5 -5
  96. package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +5 -5
  97. package/plugins/collapsibleColumns/collapsibleColumns.js +36 -54
  98. package/plugins/collapsibleColumns/collapsibleColumns.mjs +36 -54
  99. package/plugins/columnSorting/columnSorting.js +40 -46
  100. package/plugins/columnSorting/columnSorting.mjs +40 -46
  101. package/plugins/columnSummary/columnSummary.js +22 -26
  102. package/plugins/columnSummary/columnSummary.mjs +22 -26
  103. package/plugins/comments/comments.js +116 -158
  104. package/plugins/comments/comments.mjs +116 -158
  105. package/plugins/contextMenu/contextMenu.js +20 -26
  106. package/plugins/contextMenu/contextMenu.mjs +20 -26
  107. package/plugins/contextMenu/itemsFactory.js +1 -1
  108. package/plugins/contextMenu/itemsFactory.mjs +1 -1
  109. package/plugins/contextMenu/menu/defaultShortcutsList.js +10 -26
  110. package/plugins/contextMenu/menu/defaultShortcutsList.mjs +10 -26
  111. package/plugins/contextMenu/menu/menu.js +13 -21
  112. package/plugins/contextMenu/menu/menu.mjs +13 -21
  113. package/plugins/contextMenu/menu/positioner.js +41 -58
  114. package/plugins/contextMenu/menu/positioner.mjs +41 -58
  115. package/plugins/copyPaste/copyPaste.js +113 -154
  116. package/plugins/copyPaste/copyPaste.mjs +113 -154
  117. package/plugins/copyPaste/copyableRanges.js +43 -66
  118. package/plugins/copyPaste/copyableRanges.mjs +43 -66
  119. package/plugins/customBorders/customBorders.js +11 -13
  120. package/plugins/customBorders/customBorders.mjs +11 -13
  121. package/plugins/dragToScroll/dragToScroll.js +6 -6
  122. package/plugins/dragToScroll/dragToScroll.mjs +6 -6
  123. package/plugins/dropdownMenu/dropdownMenu.js +78 -100
  124. package/plugins/dropdownMenu/dropdownMenu.mjs +78 -100
  125. package/plugins/exportFile/dataProvider.js +1 -1
  126. package/plugins/exportFile/dataProvider.mjs +1 -1
  127. package/plugins/filters/component/actionBar.js +9 -9
  128. package/plugins/filters/component/actionBar.mjs +8 -8
  129. package/plugins/filters/component/condition.js +13 -15
  130. package/plugins/filters/component/condition.mjs +13 -15
  131. package/plugins/filters/component/operators.js +6 -6
  132. package/plugins/filters/component/operators.mjs +6 -6
  133. package/plugins/filters/component/value.js +24 -28
  134. package/plugins/filters/component/value.mjs +24 -28
  135. package/plugins/filters/conditionUpdateObserver.js +22 -24
  136. package/plugins/filters/conditionUpdateObserver.mjs +22 -24
  137. package/plugins/filters/dataFilter.js +1 -1
  138. package/plugins/filters/dataFilter.mjs +1 -1
  139. package/plugins/filters/filters.js +81 -95
  140. package/plugins/filters/filters.mjs +81 -95
  141. package/plugins/filters/ui/input.js +13 -19
  142. package/plugins/filters/ui/input.mjs +13 -19
  143. package/plugins/filters/ui/link.js +8 -13
  144. package/plugins/filters/ui/link.mjs +8 -13
  145. package/plugins/filters/ui/multipleSelect.js +85 -112
  146. package/plugins/filters/ui/multipleSelect.mjs +85 -112
  147. package/plugins/filters/ui/radioInput.js +12 -20
  148. package/plugins/filters/ui/radioInput.mjs +12 -20
  149. package/plugins/filters/ui/select.js +50 -72
  150. package/plugins/filters/ui/select.mjs +49 -71
  151. package/plugins/formulas/formulas.js +268 -326
  152. package/plugins/formulas/formulas.mjs +269 -327
  153. package/plugins/formulas/indexSyncer/axisSyncer.js +38 -61
  154. package/plugins/formulas/indexSyncer/axisSyncer.mjs +38 -61
  155. package/plugins/formulas/indexSyncer/index.js +25 -48
  156. package/plugins/formulas/indexSyncer/index.mjs +25 -48
  157. package/plugins/hiddenColumns/hiddenColumns.js +64 -83
  158. package/plugins/hiddenColumns/hiddenColumns.mjs +64 -83
  159. package/plugins/hiddenRows/hiddenRows.js +63 -82
  160. package/plugins/hiddenRows/hiddenRows.mjs +63 -82
  161. package/plugins/manualColumnFreeze/manualColumnFreeze.js +24 -32
  162. package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +25 -33
  163. package/plugins/manualColumnMove/manualColumnMove.js +126 -170
  164. package/plugins/manualColumnMove/manualColumnMove.mjs +126 -170
  165. package/plugins/manualColumnResize/manualColumnResize.js +169 -230
  166. package/plugins/manualColumnResize/manualColumnResize.mjs +169 -230
  167. package/plugins/manualRowMove/manualRowMove.js +99 -128
  168. package/plugins/manualRowMove/manualRowMove.mjs +99 -128
  169. package/plugins/manualRowResize/manualRowResize.js +150 -209
  170. package/plugins/manualRowResize/manualRowResize.mjs +150 -209
  171. package/plugins/mergeCells/calculations/selection.js +71 -2
  172. package/plugins/mergeCells/calculations/selection.mjs +71 -2
  173. package/plugins/mergeCells/cellsCollection.js +1 -117
  174. package/plugins/mergeCells/cellsCollection.mjs +1 -117
  175. package/plugins/mergeCells/contextMenuItem/toggleMerge.js +1 -11
  176. package/plugins/mergeCells/contextMenuItem/toggleMerge.mjs +1 -11
  177. package/plugins/mergeCells/mergeCells.js +355 -595
  178. package/plugins/mergeCells/mergeCells.mjs +355 -595
  179. package/plugins/multiColumnSorting/multiColumnSorting.js +0 -6
  180. package/plugins/multiColumnSorting/multiColumnSorting.mjs +0 -6
  181. package/plugins/multipleSelectionHandles/multipleSelectionHandles.js +1 -1
  182. package/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs +1 -1
  183. package/plugins/nestedHeaders/nestedHeaders.js +204 -254
  184. package/plugins/nestedHeaders/nestedHeaders.mjs +205 -255
  185. package/plugins/nestedHeaders/stateManager/headersTree.js +21 -32
  186. package/plugins/nestedHeaders/stateManager/headersTree.mjs +21 -32
  187. package/plugins/nestedHeaders/stateManager/index.js +30 -41
  188. package/plugins/nestedHeaders/stateManager/index.mjs +30 -41
  189. package/plugins/nestedHeaders/stateManager/sourceSettings.js +19 -30
  190. package/plugins/nestedHeaders/stateManager/sourceSettings.mjs +19 -30
  191. package/plugins/nestedRows/data/dataManager.js +1 -1
  192. package/plugins/nestedRows/data/dataManager.mjs +1 -1
  193. package/plugins/nestedRows/nestedRows.js +138 -179
  194. package/plugins/nestedRows/nestedRows.mjs +139 -180
  195. package/plugins/nestedRows/ui/contextMenu.js +11 -15
  196. package/plugins/nestedRows/ui/contextMenu.mjs +10 -14
  197. package/plugins/nestedRows/utils/rowMoveController.js +1 -1
  198. package/plugins/nestedRows/utils/rowMoveController.mjs +1 -1
  199. package/plugins/persistentState/storage.js +2 -2
  200. package/plugins/persistentState/storage.mjs +2 -2
  201. package/plugins/search/search.js +7 -7
  202. package/plugins/search/search.mjs +7 -7
  203. package/plugins/touchScroll/touchScroll.js +15 -19
  204. package/plugins/touchScroll/touchScroll.mjs +16 -20
  205. package/plugins/trimRows/trimRows.js +6 -6
  206. package/plugins/trimRows/trimRows.mjs +6 -6
  207. package/renderers/checkboxRenderer/checkboxRenderer.js +4 -4
  208. package/renderers/checkboxRenderer/checkboxRenderer.mjs +4 -4
  209. package/selection/highlight/highlight.js +14 -14
  210. package/selection/highlight/highlight.mjs +13 -13
  211. package/selection/highlight/visualSelection.js +2 -16
  212. package/selection/highlight/visualSelection.mjs +2 -16
  213. package/selection/selection.js +60 -252
  214. package/selection/selection.mjs +59 -251
  215. package/selection/transformation.js +101 -175
  216. package/selection/transformation.mjs +101 -175
  217. package/shortcutContexts/commands/editor/closeAndSave.js +2 -2
  218. package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -2
  219. package/shortcutContexts/commands/editor/open.js +3 -18
  220. package/shortcutContexts/commands/editor/open.mjs +3 -18
  221. package/shortcutContexts/commands/extendCellsSelection/down.js +1 -1
  222. package/shortcutContexts/commands/extendCellsSelection/down.mjs +1 -1
  223. package/shortcutContexts/commands/extendCellsSelection/left.js +1 -1
  224. package/shortcutContexts/commands/extendCellsSelection/left.mjs +1 -1
  225. package/shortcutContexts/commands/extendCellsSelection/right.js +1 -1
  226. package/shortcutContexts/commands/extendCellsSelection/right.mjs +1 -1
  227. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +1 -1
  228. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +1 -1
  229. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +1 -3
  230. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +1 -3
  231. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +3 -9
  232. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +3 -9
  233. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +3 -10
  234. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +3 -10
  235. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +1 -3
  236. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +1 -3
  237. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +1 -3
  238. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +1 -3
  239. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +1 -3
  240. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +1 -3
  241. package/shortcutContexts/commands/extendCellsSelection/toRows.js +1 -1
  242. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +1 -1
  243. package/shortcutContexts/commands/extendCellsSelection/up.js +1 -1
  244. package/shortcutContexts/commands/extendCellsSelection/up.mjs +1 -1
  245. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +1 -6
  246. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +1 -6
  247. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +1 -6
  248. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +1 -6
  249. package/shortcutContexts/grid.js +2 -2
  250. package/shortcutContexts/grid.mjs +2 -2
  251. package/shortcuts/context.js +1 -2
  252. package/shortcuts/context.mjs +1 -2
  253. package/tableView.js +52 -98
  254. package/tableView.mjs +52 -98
  255. package/translations/changesObservable/observable.js +21 -38
  256. package/translations/changesObservable/observable.mjs +21 -38
  257. package/translations/changesObservable/observer.js +7 -12
  258. package/translations/changesObservable/observer.mjs +6 -11
  259. package/translations/mapCollections/aggregatedCollection.js +1 -1
  260. package/translations/mapCollections/aggregatedCollection.mjs +1 -1
  261. package/translations/maps/indexMap.js +1 -1
  262. package/translations/maps/indexMap.mjs +1 -1
  263. package/utils/dataStructures/linkedList.js +1 -6
  264. package/utils/dataStructures/linkedList.mjs +1 -6
  265. package/utils/dataStructures/tree.js +1 -1
  266. package/utils/dataStructures/tree.mjs +1 -1
  267. package/utils/interval.js +26 -44
  268. package/utils/interval.mjs +26 -44
  269. package/core/viewportScroll/scrollStrategies/focusScroll.js +0 -15
  270. package/core/viewportScroll/scrollStrategies/focusScroll.mjs +0 -11
  271. package/plugins/mergeCells/focusOrder.js +0 -258
  272. package/plugins/mergeCells/focusOrder.mjs +0 -253
@@ -4,11 +4,9 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
4
4
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
6
6
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
- function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
8
- function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
9
- function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
10
- function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
11
- function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
7
+ function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
8
+ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
9
+ 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"); }
12
10
  import Highlight, { AREA_TYPE, HEADER_TYPE, FOCUS_TYPE } from "./highlight/highlight.mjs";
13
11
  import SelectionRange from "./range.mjs";
14
12
  import { createObjectPropListener, mixin } from "./../helpers/object.mjs";
@@ -24,9 +22,6 @@ import { A11Y_SELECTED } from "../helpers/a11y.mjs";
24
22
  * @class Selection
25
23
  * @util
26
24
  */
27
- var _transformation = /*#__PURE__*/new WeakMap();
28
- var _focusTransformation = /*#__PURE__*/new WeakMap();
29
- var _isFocusSelectionChanged = /*#__PURE__*/new WeakMap();
30
25
  var _disableHeadersHighlight = /*#__PURE__*/new WeakMap();
31
26
  var _selectionSource = /*#__PURE__*/new WeakMap();
32
27
  var _expectedLayersCount = /*#__PURE__*/new WeakMap();
@@ -66,23 +61,11 @@ class Selection {
66
61
  */
67
62
  _defineProperty(this, "highlight", void 0);
68
63
  /**
69
- * The module for modifying coordinates of the start and end selection.
64
+ * The module for modifying coordinates.
70
65
  *
71
66
  * @type {Transformation}
72
67
  */
73
- _classPrivateFieldInitSpec(this, _transformation, {
74
- writable: true,
75
- value: void 0
76
- });
77
- /**
78
- * The module for modifying coordinates of the focus selection.
79
- *
80
- * @type {Transformation}
81
- */
82
- _classPrivateFieldInitSpec(this, _focusTransformation, {
83
- writable: true,
84
- value: void 0
85
- });
68
+ _defineProperty(this, "transformation", void 0);
86
69
  /**
87
70
  * The collection of the selection layer levels where the whole row was selected using the row header or
88
71
  * the corner header.
@@ -97,43 +80,25 @@ class Selection {
97
80
  * @type {Set<number>}
98
81
  */
99
82
  _defineProperty(this, "selectedByColumnHeader", new Set());
100
- /**
101
- * The flag which determines if the focus selection was changed.
102
- *
103
- * @type {boolean}
104
- */
105
- _classPrivateFieldInitSpec(this, _isFocusSelectionChanged, {
106
- writable: true,
107
- value: false
108
- });
109
83
  /**
110
84
  * When sets disable highlighting the headers even when the logical coordinates points on them.
111
85
  *
112
86
  * @type {boolean}
113
87
  */
114
- _classPrivateFieldInitSpec(this, _disableHeadersHighlight, {
115
- writable: true,
116
- value: false
117
- });
88
+ _classPrivateFieldInitSpec(this, _disableHeadersHighlight, false);
118
89
  /**
119
90
  * The source of the selection. It can be one of the following values: `mouse`, `unknown` or any other string.
120
91
  *
121
92
  * @type {'mouse' | 'unknown' | string}
122
93
  */
123
- _classPrivateFieldInitSpec(this, _selectionSource, {
124
- writable: true,
125
- value: 'unknown'
126
- });
94
+ _classPrivateFieldInitSpec(this, _selectionSource, 'unknown');
127
95
  /**
128
96
  * The number of expected layers. It is used mostly to track when the last selection layer of non-contiguous
129
97
  * selection is applied, thus the viewport scroll is triggered.
130
98
  *
131
99
  * @param {number}
132
100
  */
133
- _classPrivateFieldInitSpec(this, _expectedLayersCount, {
134
- writable: true,
135
- value: -1
136
- });
101
+ _classPrivateFieldInitSpec(this, _expectedLayersCount, -1);
137
102
  this.settings = settings;
138
103
  this.tableProps = tableProps;
139
104
  this.highlight = new Highlight({
@@ -156,118 +121,71 @@ class Selection {
156
121
  createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
157
122
  createCellRange: (highlight, from, to) => this.tableProps.createCellRange(highlight, from, to)
158
123
  });
159
- _classPrivateFieldSet(this, _transformation, new Transformation(this.selectedRange, {
124
+ this.transformation = new Transformation(this.selectedRange, {
160
125
  rowIndexMapper: this.tableProps.rowIndexMapper,
161
126
  columnIndexMapper: this.tableProps.columnIndexMapper,
162
127
  countRenderableRows: () => this.tableProps.countRenderableRows(),
163
128
  countRenderableColumns: () => this.tableProps.countRenderableColumns(),
129
+ countRowHeaders: () => this.tableProps.countRowHeaders(),
130
+ countColHeaders: () => this.tableProps.countColHeaders(),
164
131
  visualToRenderableCoords: coords => this.tableProps.visualToRenderableCoords(coords),
165
132
  renderableToVisualCoords: coords => this.tableProps.renderableToVisualCoords(coords),
166
- findFirstNonHiddenRenderableRow: function () {
167
- return _this.tableProps.findFirstNonHiddenRenderableRow(...arguments);
168
- },
169
- findFirstNonHiddenRenderableColumn: function () {
170
- return _this.tableProps.findFirstNonHiddenRenderableColumn(...arguments);
171
- },
172
133
  createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
134
+ navigableHeaders: () => settings.navigableHeaders,
173
135
  fixedRowsBottom: () => settings.fixedRowsBottom,
174
136
  minSpareRows: () => settings.minSpareRows,
175
137
  minSpareCols: () => settings.minSpareCols,
176
138
  autoWrapRow: () => settings.autoWrapRow,
177
139
  autoWrapCol: () => settings.autoWrapCol
178
- }));
179
- _classPrivateFieldSet(this, _focusTransformation, new Transformation(this.selectedRange, {
180
- rowIndexMapper: this.tableProps.rowIndexMapper,
181
- columnIndexMapper: this.tableProps.columnIndexMapper,
182
- countRenderableRows: () => {
183
- const range = this.selectedRange.current();
184
- return this.tableProps.countRenderableRowsInRange(0, range.getOuterBottomEndCorner().row);
185
- },
186
- countRenderableColumns: () => {
187
- const range = this.selectedRange.current();
188
- return this.tableProps.countRenderableColumnsInRange(0, range.getOuterBottomEndCorner().col);
189
- },
190
- visualToRenderableCoords: coords => this.tableProps.visualToRenderableCoords(coords),
191
- renderableToVisualCoords: coords => this.tableProps.renderableToVisualCoords(coords),
192
- findFirstNonHiddenRenderableRow: function () {
193
- return _this.tableProps.findFirstNonHiddenRenderableRow(...arguments);
194
- },
195
- findFirstNonHiddenRenderableColumn: function () {
196
- return _this.tableProps.findFirstNonHiddenRenderableColumn(...arguments);
197
- },
198
- createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
199
- fixedRowsBottom: () => 0,
200
- minSpareRows: () => 0,
201
- minSpareCols: () => 0,
202
- autoWrapRow: () => true,
203
- autoWrapCol: () => true
204
- }));
205
- _classPrivateFieldGet(this, _transformation).addLocalHook('beforeTransformStart', function () {
140
+ });
141
+ this.transformation.addLocalHook('beforeTransformStart', function () {
206
142
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
207
143
  args[_key] = arguments[_key];
208
144
  }
209
145
  return _this.runLocalHooks('beforeModifyTransformStart', ...args);
210
146
  });
211
- _classPrivateFieldGet(this, _transformation).addLocalHook('afterTransformStart', function () {
147
+ this.transformation.addLocalHook('afterTransformStart', function () {
212
148
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
213
149
  args[_key2] = arguments[_key2];
214
150
  }
215
151
  return _this.runLocalHooks('afterModifyTransformStart', ...args);
216
152
  });
217
- _classPrivateFieldGet(this, _transformation).addLocalHook('beforeTransformEnd', function () {
153
+ this.transformation.addLocalHook('beforeTransformEnd', function () {
218
154
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
219
155
  args[_key3] = arguments[_key3];
220
156
  }
221
157
  return _this.runLocalHooks('beforeModifyTransformEnd', ...args);
222
158
  });
223
- _classPrivateFieldGet(this, _transformation).addLocalHook('modifyTransformEndRestDelta', function () {
159
+ this.transformation.addLocalHook('afterTransformEnd', function () {
224
160
  for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
225
161
  args[_key4] = arguments[_key4];
226
162
  }
227
- return _this.runLocalHooks('modifyTransformEndRestDelta', ...args);
163
+ return _this.runLocalHooks('afterModifyTransformEnd', ...args);
228
164
  });
229
- _classPrivateFieldGet(this, _transformation).addLocalHook('afterTransformEnd', function () {
165
+ this.transformation.addLocalHook('insertRowRequire', function () {
230
166
  for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
231
167
  args[_key5] = arguments[_key5];
232
168
  }
233
- return _this.runLocalHooks('afterModifyTransformEnd', ...args);
169
+ return _this.runLocalHooks('insertRowRequire', ...args);
234
170
  });
235
- _classPrivateFieldGet(this, _transformation).addLocalHook('insertRowRequire', function () {
171
+ this.transformation.addLocalHook('insertColRequire', function () {
236
172
  for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
237
173
  args[_key6] = arguments[_key6];
238
174
  }
239
- return _this.runLocalHooks('insertRowRequire', ...args);
175
+ return _this.runLocalHooks('insertColRequire', ...args);
240
176
  });
241
- _classPrivateFieldGet(this, _transformation).addLocalHook('insertColRequire', function () {
177
+ this.transformation.addLocalHook('beforeRowWrap', function () {
242
178
  for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
243
179
  args[_key7] = arguments[_key7];
244
180
  }
245
- return _this.runLocalHooks('insertColRequire', ...args);
181
+ return _this.runLocalHooks('beforeRowWrap', ...args);
246
182
  });
247
- _classPrivateFieldGet(this, _transformation).addLocalHook('beforeRowWrap', function () {
183
+ this.transformation.addLocalHook('beforeColumnWrap', function () {
248
184
  for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
249
185
  args[_key8] = arguments[_key8];
250
186
  }
251
- return _this.runLocalHooks('beforeRowWrap', ...args);
252
- });
253
- _classPrivateFieldGet(this, _transformation).addLocalHook('beforeColumnWrap', function () {
254
- for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
255
- args[_key9] = arguments[_key9];
256
- }
257
187
  return _this.runLocalHooks('beforeColumnWrap', ...args);
258
188
  });
259
- _classPrivateFieldGet(this, _focusTransformation).addLocalHook('beforeTransformStart', function () {
260
- for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
261
- args[_key10] = arguments[_key10];
262
- }
263
- return _this.runLocalHooks('beforeModifyTransformFocus', ...args);
264
- });
265
- _classPrivateFieldGet(this, _focusTransformation).addLocalHook('afterTransformStart', function () {
266
- for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
267
- args[_key11] = arguments[_key11];
268
- }
269
- return _this.runLocalHooks('afterModifyTransformFocus', ...args);
270
- });
271
189
  }
272
190
 
273
191
  /**
@@ -285,14 +203,14 @@ class Selection {
285
203
  * @param {'mouse' | 'unknown' | string} sourceName The source name.
286
204
  */
287
205
  markSource(sourceName) {
288
- _classPrivateFieldSet(this, _selectionSource, sourceName);
206
+ _classPrivateFieldSet(_selectionSource, this, sourceName);
289
207
  }
290
208
 
291
209
  /**
292
210
  * Marks end of the selection source. It restores the selection source to default value which is 'unknown'.
293
211
  */
294
212
  markEndSource() {
295
- _classPrivateFieldSet(this, _selectionSource, 'unknown');
213
+ _classPrivateFieldSet(_selectionSource, this, 'unknown');
296
214
  }
297
215
 
298
216
  /**
@@ -301,7 +219,7 @@ class Selection {
301
219
  * @returns {'mouse' | 'unknown' | string}
302
220
  */
303
221
  getSelectionSource() {
304
- return _classPrivateFieldGet(this, _selectionSource);
222
+ return _classPrivateFieldGet(_selectionSource, this);
305
223
  }
306
224
 
307
225
  /**
@@ -311,7 +229,7 @@ class Selection {
311
229
  * @param {number} layersCount The number of expected layers.
312
230
  */
313
231
  setExpectedLayers(layersCount) {
314
- _classPrivateFieldSet(this, _expectedLayersCount, layersCount);
232
+ _classPrivateFieldSet(_expectedLayersCount, this, layersCount);
315
233
  }
316
234
 
317
235
  /**
@@ -327,7 +245,7 @@ class Selection {
327
245
  finish() {
328
246
  this.runLocalHooks('afterSelectionFinished', Array.from(this.selectedRange));
329
247
  this.inProgress = false;
330
- _classPrivateFieldSet(this, _expectedLayersCount, -1);
248
+ _classPrivateFieldSet(_expectedLayersCount, this, -1);
331
249
  }
332
250
 
333
251
  /**
@@ -358,7 +276,6 @@ class Selection {
358
276
  // We are creating copy. We would like to modify just the start of the selection by below hook. Then original coords
359
277
  // should be handled by next methods.
360
278
  const coordsClone = coords.clone();
361
- _classPrivateFieldSet(this, _isFocusSelectionChanged, false);
362
279
  this.runLocalHooks(`beforeSetRangeStart${fragment ? 'Only' : ''}`, coordsClone);
363
280
  if (!isMultipleMode || isMultipleMode && !isMultipleSelection && isUndefined(multipleSelection)) {
364
281
  this.selectedRange.clear();
@@ -416,20 +333,7 @@ class Selection {
416
333
  cellRange.setFrom(cellRange.highlight);
417
334
  cellRange.setTo(cellRange.highlight);
418
335
  } else {
419
- const horizontalDir = cellRange.getHorizontalDirection();
420
- const verticalDir = cellRange.getVerticalDirection();
421
- const isMultiple = this.isMultiple();
422
336
  cellRange.setTo(coordsClone);
423
- if (isMultiple && horizontalDir !== cellRange.getHorizontalDirection()) {
424
- cellRange.from.assign({
425
- col: cellRange.highlight.col
426
- });
427
- }
428
- if (isMultiple && verticalDir !== cellRange.getVerticalDirection()) {
429
- cellRange.from.assign({
430
- row: cellRange.highlight.row
431
- });
432
- }
433
337
  }
434
338
 
435
339
  // Prevent creating "area" selection that overlaps headers.
@@ -439,7 +343,11 @@ class Selection {
439
343
  }
440
344
  }
441
345
  this.runLocalHooks('beforeHighlightSet');
442
- this.setRangeFocus(this.selectedRange.current().highlight);
346
+ const focusHighlight = this.highlight.getFocus();
347
+ focusHighlight.clear();
348
+ if (this.highlight.isEnabledFor(FOCUS_TYPE, cellRange.highlight)) {
349
+ focusHighlight.add(this.selectedRange.current().highlight).commit().syncWith(cellRange);
350
+ }
443
351
  const layerLevel = this.getLayerLevel();
444
352
 
445
353
  // If the next layer level is lower than previous then clear all area and header highlights. This is the
@@ -510,8 +418,8 @@ class Selection {
510
418
  columnHighlight.add(columnCoordsFrom).add(columnCoordsTo).commit();
511
419
  }
512
420
  }
513
- const highlightRowHeaders = !_classPrivateFieldGet(this, _disableHeadersHighlight) && this.isEntireRowSelected() && (countCols > 0 && countCols === cellRange.getWidth() || countCols === 0 && this.isSelectedByRowHeader());
514
- const highlightColumnHeaders = !_classPrivateFieldGet(this, _disableHeadersHighlight) && this.isEntireColumnSelected() && (countRows > 0 && countRows === cellRange.getHeight() || countRows === 0 && this.isSelectedByColumnHeader());
421
+ const highlightRowHeaders = !_classPrivateFieldGet(_disableHeadersHighlight, this) && this.isEntireRowSelected() && (countCols > 0 && countCols === cellRange.getWidth() || countCols === 0 && this.isSelectedByRowHeader());
422
+ const highlightColumnHeaders = !_classPrivateFieldGet(_disableHeadersHighlight, this) && this.isEntireColumnSelected() && (countRows > 0 && countRows === cellRange.getHeight() || countRows === 0 && this.isSelectedByColumnHeader());
515
423
  if (highlightRowHeaders) {
516
424
  activeRowHeaderHighlight.add(this.tableProps.createCellCoords(Math.max(cellRange.from.row, 0), Math.min(-this.tableProps.countRowHeaders(), -1))).add(this.tableProps.createCellCoords(Math.max(cellRange.to.row, 0), -1)).commit();
517
425
  }
@@ -522,33 +430,20 @@ class Selection {
522
430
  activeCornerHeaderHighlight.add(this.tableProps.createCellCoords(-this.tableProps.countColHeaders(), -this.tableProps.countRowHeaders())).add(this.tableProps.createCellCoords(-1, -1)).commit();
523
431
  }
524
432
  }
525
- const isLastLayer = _classPrivateFieldGet(this, _expectedLayersCount) === -1 || this.selectedRange.size() === _classPrivateFieldGet(this, _expectedLayersCount);
433
+ const isLastLayer = _classPrivateFieldGet(_expectedLayersCount, this) === -1 || this.selectedRange.size() === _classPrivateFieldGet(_expectedLayersCount, this);
526
434
  this.runLocalHooks('afterSetRangeEnd', coords, isLastLayer);
527
435
  }
528
436
 
529
437
  /**
530
- * Sets the selection focus position at the specified coordinates.
438
+ * Returns information if we have a multiselection. This method check multiselection only on the latest layer of
439
+ * the selection.
531
440
  *
532
- * @param {CellCoords} coords The CellCoords instance with defined visual coordinates.
441
+ * @returns {boolean}
533
442
  */
534
- setRangeFocus(coords) {
535
- if (this.selectedRange.isEmpty()) {
536
- return;
537
- }
538
- const cellRange = this.selectedRange.current();
539
- const focusHighlight = this.highlight.getFocus();
540
- focusHighlight.clear();
541
- cellRange.setHighlight(coords);
542
- if (!this.inProgress) {
543
- this.runLocalHooks('beforeHighlightSet');
544
- }
545
- if (this.highlight.isEnabledFor(FOCUS_TYPE, cellRange.highlight)) {
546
- focusHighlight.add(cellRange.highlight).commit().syncWith(cellRange);
547
- }
548
- if (!this.inProgress) {
549
- _classPrivateFieldSet(this, _isFocusSelectionChanged, true);
550
- this.runLocalHooks('afterSetFocus', cellRange.highlight);
551
- }
443
+ isMultiple() {
444
+ const isMultipleListener = createObjectPropListener(!this.selectedRange.current().isSingle());
445
+ this.runLocalHooks('afterIsMultipleSelection', isMultipleListener);
446
+ return isMultipleListener.value;
552
447
  }
553
448
 
554
449
  /**
@@ -561,13 +456,7 @@ class Selection {
561
456
  */
562
457
  transformStart(rowDelta, colDelta) {
563
458
  let createMissingRecords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
564
- if (this.settings.navigableHeaders) {
565
- _classPrivateFieldGet(this, _transformation).setOffsetSize({
566
- x: this.tableProps.countRowHeaders(),
567
- y: this.tableProps.countColHeaders()
568
- });
569
- }
570
- this.setRangeStart(_classPrivateFieldGet(this, _transformation).transformStart(rowDelta, colDelta, createMissingRecords));
459
+ this.setRangeStart(this.transformation.transformStart(rowDelta, colDelta, createMissingRecords));
571
460
  }
572
461
 
573
462
  /**
@@ -577,44 +466,7 @@ class Selection {
577
466
  * @param {number} colDelta Columns number to move, value can be passed as negative number.
578
467
  */
579
468
  transformEnd(rowDelta, colDelta) {
580
- if (this.settings.navigableHeaders) {
581
- _classPrivateFieldGet(this, _transformation).setOffsetSize({
582
- x: this.tableProps.countRowHeaders(),
583
- y: this.tableProps.countColHeaders()
584
- });
585
- }
586
- this.setRangeEnd(_classPrivateFieldGet(this, _transformation).transformEnd(rowDelta, colDelta));
587
- }
588
-
589
- /**
590
- * Transforms the focus cell selection relative to the current focus position.
591
- *
592
- * @param {number} rowDelta Rows number to move, value can be passed as negative number.
593
- * @param {number} colDelta Columns number to move, value can be passed as negative number.
594
- */
595
- transformFocus(rowDelta, colDelta) {
596
- const range = this.selectedRange.current();
597
- const {
598
- row,
599
- col
600
- } = range.getOuterTopStartCorner();
601
- const columnsInRange = this.tableProps.countRenderableColumnsInRange(0, col - 1);
602
- const rowsInRange = this.tableProps.countRenderableRowsInRange(0, row - 1);
603
- if (range.highlight.isHeader()) {
604
- // for header focus selection calculate the new coords based on the selection including headers
605
- _classPrivateFieldGet(this, _focusTransformation).setOffsetSize({
606
- x: col < 0 ? Math.abs(col) : -columnsInRange,
607
- y: row < 0 ? Math.abs(row) : -rowsInRange
608
- });
609
- } else {
610
- // for focus selection in cells calculate the new coords only based on the selected cells
611
- _classPrivateFieldGet(this, _focusTransformation).setOffsetSize({
612
- x: col < 0 ? 0 : -columnsInRange,
613
- y: row < 0 ? 0 : -rowsInRange
614
- });
615
- }
616
- const focusCoords = _classPrivateFieldGet(this, _focusTransformation).transformStart(rowDelta, colDelta);
617
- this.setRangeFocus(focusCoords.normalize());
469
+ this.setRangeEnd(this.transformation.transformEnd(rowDelta, colDelta));
618
470
  }
619
471
 
620
472
  /**
@@ -635,30 +487,6 @@ class Selection {
635
487
  return !this.selectedRange.isEmpty();
636
488
  }
637
489
 
638
- /**
639
- * Returns information if we have a multi-selection. This method check multi-selection only on the latest layer of
640
- * the selection.
641
- *
642
- * @returns {boolean}
643
- */
644
- isMultiple() {
645
- if (!this.isSelected()) {
646
- return false;
647
- }
648
- const isMultipleListener = createObjectPropListener(!this.selectedRange.current().isSingle());
649
- this.runLocalHooks('afterIsMultipleSelection', isMultipleListener);
650
- return isMultipleListener.value;
651
- }
652
-
653
- /**
654
- * Checks if the last selection involves changing the focus cell position only.
655
- *
656
- * @returns {boolean}
657
- */
658
- isFocusSelectionChanged() {
659
- return this.isSelected() && _classPrivateFieldGet(this, _isFocusSelectionChanged);
660
- }
661
-
662
490
  /**
663
491
  * Returns `true` if the selection was applied by clicking to the row header. If the `layerLevel`
664
492
  * argument is passed then only that layer will be checked. Otherwise, it checks if any row header
@@ -857,7 +685,7 @@ class Selection {
857
685
  focusPosition,
858
686
  disableHeadersHighlight
859
687
  } = options;
860
- _classPrivateFieldSet(this, _disableHeadersHighlight, disableHeadersHighlight);
688
+ _classPrivateFieldSet(_disableHeadersHighlight, this, disableHeadersHighlight);
861
689
  if (focusPosition && Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.row) && Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.col)) {
862
690
  highlight = this.tableProps.createCellCoords(clamp(focusPosition.row, rowFrom, nrOfRows - 1), clamp(focusPosition.col, columnFrom, nrOfColumns - 1));
863
691
  }
@@ -873,7 +701,7 @@ class Selection {
873
701
  }
874
702
  this.setRangeEnd(endCoords);
875
703
  this.finish();
876
- _classPrivateFieldSet(this, _disableHeadersHighlight, false);
704
+ _classPrivateFieldSet(_disableHeadersHighlight, this, false);
877
705
  }
878
706
 
879
707
  /**
@@ -941,10 +769,9 @@ class Selection {
941
769
  *
942
770
  * @param {number|string} startColumn Visual column index or column property from which the selection starts.
943
771
  * @param {number|string} [endColumn] Visual column index or column property from to the selection finishes.
944
- * @param {number | { row: number, col: number }} [focusPosition=0] The argument allows changing the cell/header focus
945
- * position. The value can take visual row index from -N to N, where negative values point to the headers and positive
946
- * values point to the cell range. An object with `row` and `col` properties also can be passed to change the focus
947
- * position horizontally.
772
+ * @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
773
+ * The value can take visual row index from -N to N, where negative values
774
+ * point to the headers and positive values point to the cell range.
948
775
  * @returns {boolean} Returns `true` if selection was successful, `false` otherwise.
949
776
  */
950
777
  selectColumns(startColumn) {
@@ -965,20 +792,11 @@ class Selection {
965
792
  countColHeaders
966
793
  });
967
794
  if (isValid) {
968
- let highlightRow = 0;
969
- let highlightColumn = 0;
970
- if (Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.row) && Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.col)) {
971
- highlightRow = clamp(focusPosition.row, columnHeaderLastIndex, countRows - 1);
972
- highlightColumn = clamp(focusPosition.col, Math.min(start, end), Math.max(start, end));
973
- } else {
974
- highlightRow = clamp(focusPosition, columnHeaderLastIndex, countRows - 1);
975
- highlightColumn = start;
976
- }
977
- const highlight = this.tableProps.createCellCoords(highlightRow, highlightColumn);
978
- const fromRow = countColHeaders === 0 ? 0 : clamp(highlight.row, columnHeaderLastIndex, -1);
795
+ const fromRow = countColHeaders === 0 ? 0 : clamp(focusPosition, columnHeaderLastIndex, -1);
979
796
  const toRow = countRows - 1;
980
797
  const from = this.tableProps.createCellCoords(fromRow, start);
981
798
  const to = this.tableProps.createCellCoords(toRow, end);
799
+ const highlight = this.tableProps.createCellCoords(clamp(focusPosition, columnHeaderLastIndex, countRows - 1), start);
982
800
  this.runLocalHooks('beforeSelectColumns', from, to, highlight);
983
801
 
984
802
  // disallow modifying row axis for that hooks
@@ -998,10 +816,9 @@ class Selection {
998
816
  *
999
817
  * @param {number} startRow Visual row index from which the selection starts.
1000
818
  * @param {number} [endRow] Visual row index from to the selection finishes.
1001
- * @param {number | { row: number, col: number }} [focusPosition=0] The argument allows changing the cell/header focus
1002
- * position. The value can take visual row index from -N to N, where negative values point to the headers and positive
1003
- * values point to the cell range. An object with `row` and `col` properties also can be passed to change the focus
1004
- * position horizontally.
819
+ * @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
820
+ * The value can take visual column index from -N to N, where negative values
821
+ * point to the headers and positive values point to the cell range.
1005
822
  * @returns {boolean} Returns `true` if selection was successful, `false` otherwise.
1006
823
  */
1007
824
  selectRows(startRow) {
@@ -1020,20 +837,11 @@ class Selection {
1020
837
  countColHeaders: 0
1021
838
  });
1022
839
  if (isValid) {
1023
- let highlightRow = 0;
1024
- let highlightColumn = 0;
1025
- if (Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.row) && Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.col)) {
1026
- highlightRow = clamp(focusPosition.row, Math.min(startRow, endRow), Math.max(startRow, endRow));
1027
- highlightColumn = clamp(focusPosition.col, rowHeaderLastIndex, countCols - 1);
1028
- } else {
1029
- highlightRow = startRow;
1030
- highlightColumn = clamp(focusPosition, rowHeaderLastIndex, countCols - 1);
1031
- }
1032
- const highlight = this.tableProps.createCellCoords(highlightRow, highlightColumn);
1033
- const fromColumn = countRowHeaders === 0 ? 0 : clamp(highlight.col, rowHeaderLastIndex, -1);
840
+ const fromColumn = countRowHeaders === 0 ? 0 : clamp(focusPosition, rowHeaderLastIndex, -1);
1034
841
  const toColumn = countCols - 1;
1035
842
  const from = this.tableProps.createCellCoords(startRow, fromColumn);
1036
843
  const to = this.tableProps.createCellCoords(endRow, toColumn);
844
+ const highlight = this.tableProps.createCellCoords(startRow, clamp(focusPosition, rowHeaderLastIndex, countCols - 1));
1037
845
  this.runLocalHooks('beforeSelectRows', from, to, highlight);
1038
846
 
1039
847
  // disallow modifying column axis for that hooks