handsontable 0.0.0-next-8d0643b-20230809 → 0.0.0-next-be16baf-20230809

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 (297) hide show
  1. package/3rdparty/walkontable/src/cell/coords.d.ts +6 -1
  2. package/3rdparty/walkontable/src/cell/coords.js +50 -11
  3. package/3rdparty/walkontable/src/cell/coords.mjs +50 -11
  4. package/3rdparty/walkontable/src/cell/range.d.ts +9 -2
  5. package/3rdparty/walkontable/src/cell/range.js +38 -7
  6. package/3rdparty/walkontable/src/cell/range.mjs +38 -7
  7. package/3rdparty/walkontable/src/core/_base.js +9 -3
  8. package/3rdparty/walkontable/src/core/_base.mjs +9 -3
  9. package/3rdparty/walkontable/src/core/clone.js +2 -2
  10. package/3rdparty/walkontable/src/core/clone.mjs +2 -2
  11. package/3rdparty/walkontable/src/core/core.js +3 -2
  12. package/3rdparty/walkontable/src/core/core.mjs +3 -2
  13. package/3rdparty/walkontable/src/event.js +7 -7
  14. package/3rdparty/walkontable/src/event.mjs +7 -7
  15. package/3rdparty/walkontable/src/facade/core.js +2 -2
  16. package/3rdparty/walkontable/src/facade/core.mjs +2 -2
  17. package/3rdparty/walkontable/src/index.js +10 -2
  18. package/3rdparty/walkontable/src/index.mjs +2 -2
  19. package/3rdparty/walkontable/src/overlay/_base.js +1 -1
  20. package/3rdparty/walkontable/src/overlay/_base.mjs +1 -1
  21. package/3rdparty/walkontable/src/overlay/inlineStart.js +2 -6
  22. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +2 -6
  23. package/3rdparty/walkontable/src/overlay/top.js +2 -6
  24. package/3rdparty/walkontable/src/overlay/top.mjs +2 -6
  25. package/3rdparty/walkontable/src/{border.js → selection/border/border.js} +7 -12
  26. package/3rdparty/walkontable/src/{border.mjs → selection/border/border.mjs} +7 -12
  27. package/3rdparty/walkontable/src/selection/border/constants.js +16 -0
  28. package/3rdparty/walkontable/src/selection/border/constants.mjs +12 -0
  29. package/3rdparty/walkontable/src/selection/constants.js +62 -0
  30. package/3rdparty/walkontable/src/selection/constants.mjs +51 -0
  31. package/3rdparty/walkontable/src/selection/index.js +26 -0
  32. package/3rdparty/walkontable/src/selection/index.mjs +5 -0
  33. package/3rdparty/walkontable/src/selection/manager.js +259 -0
  34. package/3rdparty/walkontable/src/selection/manager.mjs +254 -0
  35. package/3rdparty/walkontable/src/selection/scanner.js +270 -0
  36. package/3rdparty/walkontable/src/selection/scanner.mjs +267 -0
  37. package/3rdparty/walkontable/src/selection/selection.js +101 -0
  38. package/3rdparty/walkontable/src/selection/selection.mjs +96 -0
  39. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +9 -0
  40. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +9 -0
  41. package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +9 -0
  42. package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +9 -0
  43. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +9 -0
  44. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +9 -0
  45. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +9 -0
  46. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +9 -0
  47. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +9 -0
  48. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +9 -0
  49. package/3rdparty/walkontable/src/table.js +6 -78
  50. package/3rdparty/walkontable/src/table.mjs +7 -79
  51. package/base.js +2 -2
  52. package/base.mjs +2 -2
  53. package/common.d.ts +1 -1
  54. package/core/focusCatcher/focusDetector.js +58 -0
  55. package/core/focusCatcher/focusDetector.mjs +54 -0
  56. package/core/focusCatcher/index.js +142 -0
  57. package/core/focusCatcher/index.mjs +138 -0
  58. package/core/index.js +9 -0
  59. package/core/index.mjs +1 -0
  60. package/core.d.ts +6 -3
  61. package/core.js +176 -293
  62. package/core.mjs +176 -293
  63. package/dataMap/metaManager/metaSchema.js +41 -0
  64. package/dataMap/metaManager/metaSchema.mjs +41 -0
  65. package/dist/handsontable.css +24 -4
  66. package/dist/handsontable.full.css +24 -4
  67. package/dist/handsontable.full.js +8682 -5378
  68. package/dist/handsontable.full.min.css +3 -3
  69. package/dist/handsontable.full.min.js +25 -25
  70. package/dist/handsontable.js +10989 -7685
  71. package/dist/handsontable.min.css +3 -3
  72. package/dist/handsontable.min.js +19 -19
  73. package/editorManager.js +11 -75
  74. package/editorManager.mjs +11 -74
  75. package/editors/baseEditor/baseEditor.d.ts +0 -1
  76. package/editors/textEditor/textEditor.js +3 -11
  77. package/editors/textEditor/textEditor.mjs +4 -12
  78. package/helpers/mixed.js +1 -1
  79. package/helpers/mixed.mjs +1 -1
  80. package/helpers/number.d.ts +1 -0
  81. package/helpers/number.js +18 -0
  82. package/helpers/number.mjs +17 -0
  83. package/package.json +1 -1
  84. package/pluginHooks.d.ts +7 -1
  85. package/pluginHooks.js +106 -1
  86. package/pluginHooks.mjs +106 -1
  87. package/plugins/collapsibleColumns/collapsibleColumns.js +58 -4
  88. package/plugins/collapsibleColumns/collapsibleColumns.mjs +58 -4
  89. package/plugins/columnSorting/columnSorting.js +38 -0
  90. package/plugins/columnSorting/columnSorting.mjs +38 -2
  91. package/plugins/columnSorting/index.js +3 -1
  92. package/plugins/columnSorting/index.mjs +1 -1
  93. package/plugins/comments/commentEditor.js +1 -0
  94. package/plugins/comments/commentEditor.mjs +1 -0
  95. package/plugins/comments/comments.js +251 -189
  96. package/plugins/comments/comments.mjs +250 -190
  97. package/plugins/comments/contextMenuItem/addEditComment.js +41 -0
  98. package/plugins/comments/contextMenuItem/addEditComment.mjs +35 -0
  99. package/plugins/comments/contextMenuItem/readOnlyComment.js +49 -0
  100. package/plugins/comments/contextMenuItem/readOnlyComment.mjs +43 -0
  101. package/plugins/comments/contextMenuItem/removeComment.js +38 -0
  102. package/plugins/comments/contextMenuItem/removeComment.mjs +32 -0
  103. package/plugins/contextMenu/contextMenu.d.ts +1 -1
  104. package/plugins/contextMenu/contextMenu.js +72 -30
  105. package/plugins/contextMenu/contextMenu.mjs +73 -31
  106. package/plugins/contextMenu/predefinedItems/alignment.js +7 -0
  107. package/plugins/contextMenu/predefinedItems/alignment.mjs +7 -0
  108. package/plugins/contextMenu/predefinedItems/clearColumn.js +5 -3
  109. package/plugins/contextMenu/predefinedItems/clearColumn.mjs +5 -3
  110. package/plugins/contextMenu/predefinedItems/columnLeft.js +5 -3
  111. package/plugins/contextMenu/predefinedItems/columnLeft.mjs +5 -3
  112. package/plugins/contextMenu/predefinedItems/columnRight.js +5 -3
  113. package/plugins/contextMenu/predefinedItems/columnRight.mjs +5 -3
  114. package/plugins/contextMenu/predefinedItems/readOnly.js +7 -0
  115. package/plugins/contextMenu/predefinedItems/readOnly.mjs +7 -0
  116. package/plugins/contextMenu/predefinedItems/removeColumn.js +7 -5
  117. package/plugins/contextMenu/predefinedItems/removeColumn.mjs +5 -3
  118. package/plugins/contextMenu/predefinedItems/removeRow.js +7 -5
  119. package/plugins/contextMenu/predefinedItems/removeRow.mjs +5 -3
  120. package/plugins/contextMenu/predefinedItems/rowAbove.js +5 -3
  121. package/plugins/contextMenu/predefinedItems/rowAbove.mjs +5 -3
  122. package/plugins/contextMenu/predefinedItems/rowBelow.js +5 -3
  123. package/plugins/contextMenu/predefinedItems/rowBelow.mjs +5 -3
  124. package/plugins/contextMenu/utils.js +28 -16
  125. package/plugins/contextMenu/utils.mjs +27 -15
  126. package/plugins/copyPaste/contextMenuItem/copy.js +7 -0
  127. package/plugins/copyPaste/contextMenuItem/copy.mjs +7 -0
  128. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.js +9 -1
  129. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs +9 -1
  130. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.js +9 -1
  131. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs +9 -1
  132. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.js +9 -1
  133. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs +9 -1
  134. package/plugins/copyPaste/contextMenuItem/cut.js +7 -0
  135. package/plugins/copyPaste/contextMenuItem/cut.mjs +7 -0
  136. package/plugins/copyPaste/copyPaste.js +14 -10
  137. package/plugins/copyPaste/copyPaste.mjs +14 -10
  138. package/plugins/customBorders/customBorders.js +23 -20
  139. package/plugins/customBorders/customBorders.mjs +24 -21
  140. package/plugins/dropdownMenu/dropdownMenu.d.ts +1 -1
  141. package/plugins/dropdownMenu/dropdownMenu.js +89 -32
  142. package/plugins/dropdownMenu/dropdownMenu.mjs +89 -32
  143. package/plugins/filters/filters.js +31 -14
  144. package/plugins/filters/filters.mjs +30 -13
  145. package/plugins/mergeCells/mergeCells.js +5 -17
  146. package/plugins/mergeCells/mergeCells.mjs +5 -17
  147. package/plugins/multiColumnSorting/multiColumnSorting.js +37 -2
  148. package/plugins/multiColumnSorting/multiColumnSorting.mjs +37 -2
  149. package/plugins/nestedHeaders/nestedHeaders.js +121 -8
  150. package/plugins/nestedHeaders/nestedHeaders.mjs +121 -8
  151. package/plugins/nestedHeaders/stateManager/index.js +37 -0
  152. package/plugins/nestedHeaders/stateManager/index.mjs +37 -0
  153. package/plugins/nestedRows/nestedRows.js +41 -0
  154. package/plugins/nestedRows/nestedRows.mjs +41 -0
  155. package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
  156. package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
  157. package/selection/highlight/highlight.js +256 -71
  158. package/selection/highlight/highlight.mjs +250 -71
  159. package/selection/highlight/types/activeHeader.js +10 -8
  160. package/selection/highlight/types/activeHeader.mjs +10 -8
  161. package/selection/highlight/types/area.js +6 -18
  162. package/selection/highlight/types/area.mjs +6 -18
  163. package/selection/highlight/types/areaLayered.js +31 -0
  164. package/selection/highlight/types/areaLayered.mjs +26 -0
  165. package/selection/highlight/types/column.js +27 -0
  166. package/selection/highlight/types/column.mjs +22 -0
  167. package/selection/highlight/types/customSelection.js +7 -9
  168. package/selection/highlight/types/customSelection.mjs +7 -9
  169. package/selection/highlight/types/fill.js +5 -7
  170. package/selection/highlight/types/fill.mjs +5 -7
  171. package/selection/highlight/types/{cell.js → focus.js} +5 -7
  172. package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
  173. package/selection/highlight/types/header.js +9 -18
  174. package/selection/highlight/types/header.mjs +9 -18
  175. package/selection/highlight/types/row.js +27 -0
  176. package/selection/highlight/types/row.mjs +22 -0
  177. package/selection/highlight/visualSelection.js +31 -27
  178. package/selection/highlight/visualSelection.mjs +31 -27
  179. package/selection/index.js +4 -7
  180. package/selection/index.mjs +2 -3
  181. package/selection/mouseEventHandler.js +1 -1
  182. package/selection/mouseEventHandler.mjs +1 -1
  183. package/selection/range.js +8 -8
  184. package/selection/range.mjs +8 -8
  185. package/selection/selection.js +293 -154
  186. package/selection/selection.mjs +290 -153
  187. package/selection/transformation.js +232 -90
  188. package/selection/transformation.mjs +232 -90
  189. package/selection/utils.js +15 -21
  190. package/selection/utils.mjs +16 -21
  191. package/settings.d.ts +2 -0
  192. package/shortcutContexts/commands/editor/closeAndSave.js +12 -0
  193. package/shortcutContexts/commands/editor/closeAndSave.mjs +8 -0
  194. package/shortcutContexts/commands/editor/closeWithoutSaving.js +12 -0
  195. package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +8 -0
  196. package/shortcutContexts/commands/editor/fastOpen.js +16 -0
  197. package/shortcutContexts/commands/editor/fastOpen.mjs +12 -0
  198. package/shortcutContexts/commands/editor/index.js +16 -0
  199. package/shortcutContexts/commands/editor/index.mjs +12 -0
  200. package/shortcutContexts/commands/editor/open.js +27 -0
  201. package/shortcutContexts/commands/editor/open.mjs +23 -0
  202. package/shortcutContexts/commands/emptySelectedCells.js +11 -0
  203. package/shortcutContexts/commands/emptySelectedCells.mjs +7 -0
  204. package/shortcutContexts/commands/extendCellsSelection/down.js +15 -0
  205. package/shortcutContexts/commands/extendCellsSelection/down.mjs +11 -0
  206. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +21 -0
  207. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +17 -0
  208. package/shortcutContexts/commands/extendCellsSelection/index.js +26 -0
  209. package/shortcutContexts/commands/extendCellsSelection/index.mjs +22 -0
  210. package/shortcutContexts/commands/extendCellsSelection/left.js +15 -0
  211. package/shortcutContexts/commands/extendCellsSelection/left.mjs +11 -0
  212. package/shortcutContexts/commands/extendCellsSelection/right.js +15 -0
  213. package/shortcutContexts/commands/extendCellsSelection/right.mjs +11 -0
  214. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +19 -0
  215. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +15 -0
  216. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +29 -0
  217. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +25 -0
  218. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +19 -0
  219. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +15 -0
  220. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +19 -0
  221. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +15 -0
  222. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +29 -0
  223. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +25 -0
  224. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +29 -0
  225. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +25 -0
  226. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +29 -0
  227. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +25 -0
  228. package/shortcutContexts/commands/extendCellsSelection/toRows.js +19 -0
  229. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +15 -0
  230. package/shortcutContexts/commands/extendCellsSelection/up.js +15 -0
  231. package/shortcutContexts/commands/extendCellsSelection/up.mjs +11 -0
  232. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +21 -0
  233. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +17 -0
  234. package/shortcutContexts/commands/index.js +35 -0
  235. package/shortcutContexts/commands/index.mjs +31 -0
  236. package/shortcutContexts/commands/moveCellSelection/down.js +13 -0
  237. package/shortcutContexts/commands/moveCellSelection/down.mjs +9 -0
  238. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +31 -0
  239. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +27 -0
  240. package/shortcutContexts/commands/moveCellSelection/index.js +28 -0
  241. package/shortcutContexts/commands/moveCellSelection/index.mjs +24 -0
  242. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +12 -0
  243. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -0
  244. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +12 -0
  245. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -0
  246. package/shortcutContexts/commands/moveCellSelection/left.js +10 -0
  247. package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -0
  248. package/shortcutContexts/commands/moveCellSelection/right.js +10 -0
  249. package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -0
  250. package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +17 -0
  251. package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +13 -0
  252. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +18 -0
  253. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +14 -0
  254. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +14 -0
  255. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +10 -0
  256. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +17 -0
  257. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +13 -0
  258. package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +19 -0
  259. package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +15 -0
  260. package/shortcutContexts/commands/moveCellSelection/toMostRight.js +21 -0
  261. package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +17 -0
  262. package/shortcutContexts/commands/moveCellSelection/toMostTop.js +17 -0
  263. package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +13 -0
  264. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +19 -0
  265. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +15 -0
  266. package/shortcutContexts/commands/moveCellSelection/up.js +13 -0
  267. package/shortcutContexts/commands/moveCellSelection/up.mjs +9 -0
  268. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +31 -0
  269. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +27 -0
  270. package/shortcutContexts/commands/populateSelectedCellsData.js +29 -0
  271. package/shortcutContexts/commands/populateSelectedCellsData.mjs +25 -0
  272. package/shortcutContexts/commands/scrollToFocusedCell.js +36 -0
  273. package/shortcutContexts/commands/scrollToFocusedCell.mjs +32 -0
  274. package/shortcutContexts/commands/selectAll.js +10 -0
  275. package/shortcutContexts/commands/selectAll.mjs +6 -0
  276. package/shortcutContexts/constants.js +13 -0
  277. package/shortcutContexts/constants.mjs +8 -0
  278. package/shortcutContexts/editor.js +25 -0
  279. package/shortcutContexts/editor.mjs +21 -0
  280. package/shortcutContexts/grid.js +163 -0
  281. package/shortcutContexts/grid.mjs +159 -0
  282. package/shortcutContexts/index.js +24 -0
  283. package/shortcutContexts/index.mjs +11 -0
  284. package/shortcuts/manager.js +2 -0
  285. package/shortcuts/manager.mjs +2 -0
  286. package/shortcuts/recorder.js +2 -2
  287. package/shortcuts/recorder.mjs +2 -2
  288. package/shortcuts/utils.js +19 -5
  289. package/shortcuts/utils.mjs +18 -4
  290. package/tableView.js +67 -13
  291. package/tableView.mjs +67 -13
  292. package/3rdparty/walkontable/src/selection.js +0 -295
  293. package/3rdparty/walkontable/src/selection.mjs +0 -290
  294. package/selection/highlight/constants.js +0 -15
  295. package/selection/highlight/constants.mjs +0 -6
  296. package/selection/highlight/types/index.js +0 -35
  297. package/selection/highlight/types/index.mjs +0 -31
package/core.js CHANGED
@@ -31,12 +31,22 @@ var _registry5 = require("./i18n/registry");
31
31
  var _utils = require("./i18n/utils");
32
32
  var _selection = require("./selection");
33
33
  var _dataMap = require("./dataMap");
34
+ var _index3 = require("./core/index");
34
35
  var _uniqueMap = require("./utils/dataStructures/uniqueMap");
35
36
  var _shortcuts = require("./shortcuts");
37
+ var _shortcutContexts = require("./shortcutContexts");
36
38
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
- const SHORTCUTS_GROUP = 'gridDefault';
38
39
  let activeGuid = null;
39
40
 
41
+ /**
42
+ * Keeps the collection of the all Handsontable instances created on the same page. The
43
+ * list is then used to trigger the "afterUnlisten" hook when the "listen()" method was
44
+ * called on another instance.
45
+ *
46
+ * @type {Map<string, Core>}
47
+ */
48
+ const foreignHotInstances = new Map();
49
+
40
50
  /**
41
51
  * A set of deprecated feature names.
42
52
  *
@@ -96,7 +106,8 @@ const deprecationWarns = new Set();
96
106
  * @param {boolean} [rootInstanceSymbol=false] Indicates if the instance is root of all later instances created.
97
107
  */
98
108
  function Core(rootElement, userSettings) {
99
- var _userSettings$layoutD;
109
+ var _userSettings$layoutD,
110
+ _this = this;
100
111
  let rootInstanceSymbol = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
101
112
  let preventScrollingToCell = false;
102
113
  let instance = this;
@@ -213,6 +224,8 @@ function Core(rootElement, userSettings) {
213
224
  }
214
225
  this.guid = `ht_${(0, _string.randomString)()}`; // this is the namespace for global events
215
226
 
227
+ foreignHotInstances.set(this.guid, this);
228
+
216
229
  /**
217
230
  * Instance of index mapper which is responsible for managing the column indexes.
218
231
  *
@@ -261,14 +274,16 @@ function Core(rootElement, userSettings) {
261
274
  };
262
275
 
263
276
  let selection = new _selection.Selection(tableMeta, {
264
- rowIndexMapper: () => instance.rowIndexMapper,
265
- columnIndexMapper: () => instance.columnIndexMapper,
277
+ rowIndexMapper: instance.rowIndexMapper,
278
+ columnIndexMapper: instance.columnIndexMapper,
266
279
  countCols: () => instance.countCols(),
267
280
  countRows: () => instance.countRows(),
268
281
  propToCol: prop => datamap.propToCol(prop),
269
282
  isEditorOpened: () => instance.getActiveEditor() ? instance.getActiveEditor().isOpened() : false,
270
- countColsTranslated: () => this.view.countRenderableColumns(),
271
- countRowsTranslated: () => this.view.countRenderableRows(),
283
+ countRenderableColumns: () => this.view.countRenderableColumns(),
284
+ countRenderableRows: () => this.view.countRenderableRows(),
285
+ countRowHeaders: () => this.countRowHeaders(),
286
+ countColHeaders: () => this.countColHeaders(),
272
287
  getShortcutManager: () => instance.getShortcutManager(),
273
288
  createCellCoords: (row, column) => instance._createCellCoords(row, column),
274
289
  createCellRange: (highlight, from, to) => instance._createCellRange(highlight, from, to),
@@ -295,12 +310,6 @@ function Core(rootElement, userSettings) {
295
310
  });
296
311
  this.selection.addLocalHook('beforeSetRangeEnd', cellCoords => {
297
312
  this.runHooks('beforeSetRangeEnd', cellCoords);
298
- if (cellCoords.row < 0) {
299
- cellCoords.row = this.view._wt.wtTable.getFirstVisibleRow();
300
- }
301
- if (cellCoords.col < 0) {
302
- cellCoords.col = this.view._wt.wtTable.getFirstVisibleColumn();
303
- }
304
313
  });
305
314
  this.selection.addLocalHook('afterSetRangeEnd', cellCoords => {
306
315
  const preventScrolling = (0, _object.createObjectPropListener)(false);
@@ -327,7 +336,14 @@ function Core(rootElement, userSettings) {
327
336
  if (scrollToCell !== false) {
328
337
  if (!isSelectedByAnyHeader) {
329
338
  if (currentSelectedRange && !this.selection.isMultiple()) {
330
- this.view.scrollViewport(visualToRenderableCoords(currentSelectedRange.from));
339
+ const renderableCoords = visualToRenderableCoords(currentSelectedRange.from);
340
+ if (renderableCoords.row < 0 && renderableCoords.col >= 0) {
341
+ this.view.scrollViewportHorizontally(renderableCoords.col);
342
+ } else if (renderableCoords.col < 0 && renderableCoords.row >= 0) {
343
+ this.view.scrollViewportVertically(renderableCoords.row);
344
+ } else {
345
+ this.view.scrollViewport(renderableCoords);
346
+ }
331
347
  } else {
332
348
  this.view.scrollViewport(visualToRenderableCoords(cellCoords));
333
349
  }
@@ -369,6 +385,30 @@ function Core(rootElement, userSettings) {
369
385
  isMultiple.value = changedIsMultiple;
370
386
  }
371
387
  });
388
+ this.selection.addLocalHook('beforeSelectColumns', function () {
389
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
390
+ args[_key] = arguments[_key];
391
+ }
392
+ return _this.runHooks('beforeSelectColumns', ...args);
393
+ });
394
+ this.selection.addLocalHook('afterSelectColumns', function () {
395
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
396
+ args[_key2] = arguments[_key2];
397
+ }
398
+ return _this.runHooks('afterSelectColumns', ...args);
399
+ });
400
+ this.selection.addLocalHook('beforeSelectRows', function () {
401
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
402
+ args[_key3] = arguments[_key3];
403
+ }
404
+ return _this.runHooks('beforeSelectRows', ...args);
405
+ });
406
+ this.selection.addLocalHook('afterSelectRows', function () {
407
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
408
+ args[_key4] = arguments[_key4];
409
+ }
410
+ return _this.runHooks('afterSelectRows', ...args);
411
+ });
372
412
  this.selection.addLocalHook('beforeModifyTransformStart', cellCoordsDelta => {
373
413
  this.runHooks('modifyTransformStart', cellCoordsDelta);
374
414
  });
@@ -474,7 +514,7 @@ function Core(rootElement, userSettings) {
474
514
  const currentFromRow = currentFromRange === null || currentFromRange === void 0 ? void 0 : currentFromRange.row;
475
515
  const startVisualRowIndex = instance.toVisualRow(startRowPhysicalIndex);
476
516
  if (selection.isSelectedByCorner()) {
477
- instance.selectAll();
517
+ instance.selectAll(false, false);
478
518
  } else if ((0, _mixed.isDefined)(currentFromRow) && currentFromRow >= startVisualRowIndex) {
479
519
  // Moving the selection (if it exists) downward – it should be applied to the "old" row.
480
520
  // TODO: The logic here should be handled by selection module.
@@ -528,7 +568,7 @@ function Core(rootElement, userSettings) {
528
568
  const currentFromColumn = currentFromRange === null || currentFromRange === void 0 ? void 0 : currentFromRange.col;
529
569
  const startVisualColumnIndex = instance.toVisualColumn(startColumnPhysicalIndex);
530
570
  if (selection.isSelectedByCorner()) {
531
- instance.selectAll();
571
+ instance.selectAll(false, false);
532
572
  } else if ((0, _mixed.isDefined)(currentFromColumn) && currentFromColumn >= startVisualColumnIndex) {
533
573
  // Moving the selection (if it exists) rightward – it should be applied to the "old" column.
534
574
  // TODO: The logic here should be handled by selection module.
@@ -1018,6 +1058,9 @@ function Core(rootElement, userSettings) {
1018
1058
  this.updateSettings(tableMeta, true);
1019
1059
  this.view = new _tableView.default(this);
1020
1060
  editorManager = _editorManager.default.getInstance(instance, tableMeta, selection);
1061
+ if ((0, _rootInstance.isRootInstance)(this)) {
1062
+ (0, _index3.installFocusCatcher)(instance);
1063
+ }
1021
1064
  instance.runHooks('init');
1022
1065
  this.forceFullRender = true; // used when data was changed
1023
1066
  this.view.render();
@@ -1431,6 +1474,11 @@ function Core(rootElement, userSettings) {
1431
1474
  */
1432
1475
  this.listen = function () {
1433
1476
  if (instance && !instance.isListening()) {
1477
+ foreignHotInstances.forEach(foreignHot => {
1478
+ if (instance !== foreignHot) {
1479
+ foreignHot.unlisten();
1480
+ }
1481
+ });
1434
1482
  activeGuid = instance.guid;
1435
1483
  instance.runHooks('afterListen');
1436
1484
  }
@@ -1515,8 +1563,8 @@ function Core(rootElement, userSettings) {
1515
1563
  * @returns {Array} Returns removed portion of columns.
1516
1564
  */
1517
1565
  this.spliceCol = function (column, index, amount) {
1518
- for (var _len = arguments.length, elements = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
1519
- elements[_key - 3] = arguments[_key];
1566
+ for (var _len5 = arguments.length, elements = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
1567
+ elements[_key5 - 3] = arguments[_key5];
1520
1568
  }
1521
1569
  return datamap.spliceCol(column, index, amount, ...elements);
1522
1570
  };
@@ -1533,8 +1581,8 @@ function Core(rootElement, userSettings) {
1533
1581
  * @returns {Array} Returns removed portion of rows.
1534
1582
  */
1535
1583
  this.spliceRow = function (row, index, amount) {
1536
- for (var _len2 = arguments.length, elements = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
1537
- elements[_key2 - 3] = arguments[_key2];
1584
+ for (var _len6 = arguments.length, elements = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
1585
+ elements[_key6 - 3] = arguments[_key6];
1538
1586
  }
1539
1587
  return datamap.spliceRow(row, index, amount, ...elements);
1540
1588
  };
@@ -1631,6 +1679,9 @@ function Core(rootElement, userSettings) {
1631
1679
  }
1632
1680
  const changes = [];
1633
1681
  (0, _array.arrayEach)(selection.getSelectedRange(), cellRange => {
1682
+ if (cellRange.isSingleHeader()) {
1683
+ return;
1684
+ }
1634
1685
  const topStart = cellRange.getTopStartCorner();
1635
1686
  const bottomEnd = cellRange.getBottomEndCorner();
1636
1687
  (0, _number.rangeEach)(topStart.row, bottomEnd.row, row => {
@@ -2400,7 +2451,7 @@ function Core(rootElement, userSettings) {
2400
2451
  * @function clear
2401
2452
  */
2402
2453
  this.clear = function () {
2403
- this.selectAll();
2454
+ this.selectAll(false, false);
2404
2455
  this.emptySelectedCells();
2405
2456
  };
2406
2457
 
@@ -2928,8 +2979,8 @@ function Core(rootElement, userSettings) {
2928
2979
  */
2929
2980
  this.spliceCellsMeta = function (visualIndex) {
2930
2981
  let deleteAmount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2931
- for (var _len3 = arguments.length, cellMetaRows = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
2932
- cellMetaRows[_key3 - 2] = arguments[_key3];
2982
+ for (var _len7 = arguments.length, cellMetaRows = new Array(_len7 > 2 ? _len7 - 2 : 0), _key7 = 2; _key7 < _len7; _key7++) {
2983
+ cellMetaRows[_key7 - 2] = arguments[_key7];
2933
2984
  }
2934
2985
  if (cellMetaRows.length > 0 && !Array.isArray(cellMetaRows[0])) {
2935
2986
  throw new Error('The 3rd argument (cellMetaRows) has to be passed as an array of cell meta objects array.');
@@ -3620,6 +3671,30 @@ function Core(rootElement, userSettings) {
3620
3671
  return instance.view._wt.drawn ? instance.view._wt.wtTable.getVisibleColumnsCount() : -1;
3621
3672
  };
3622
3673
 
3674
+ /**
3675
+ * Returns the number of rendered row headers.
3676
+ *
3677
+ * @since 14.0.0
3678
+ * @memberof Core#
3679
+ * @function countRowHeaders
3680
+ * @returns {number} Number of row headers.
3681
+ */
3682
+ this.countRowHeaders = function () {
3683
+ return this.view.getRowHeadersCount();
3684
+ };
3685
+
3686
+ /**
3687
+ * Returns the number of rendered column headers.
3688
+ *
3689
+ * @since 14.0.0
3690
+ * @memberof Core#
3691
+ * @function countColHeaders
3692
+ * @returns {number} Number of column headers.
3693
+ */
3694
+ this.countColHeaders = function () {
3695
+ return this.view.getColumnHeadersCount();
3696
+ };
3697
+
3623
3698
  /**
3624
3699
  * Returns the number of empty rows. If the optional ending parameter is `true`, returns the
3625
3700
  * number of empty rows at the bottom of the table.
@@ -3824,6 +3899,10 @@ function Core(rootElement, userSettings) {
3824
3899
  * hot.selectColumns('id');
3825
3900
  * // Select range of columns using visual indexes.
3826
3901
  * hot.selectColumns(1, 4);
3902
+ * // Select range of columns using visual indexes and mark the first header as highlighted.
3903
+ * hot.selectColumns(1, 2, -1);
3904
+ * // Select range of columns using visual indexes and mark the second cell as highlighted.
3905
+ * hot.selectColumns(2, 1, 1);
3827
3906
  * // Select range of columns using column properties.
3828
3907
  * hot.selectColumns('id', 'last_name');
3829
3908
  * ```
@@ -3834,11 +3913,15 @@ function Core(rootElement, userSettings) {
3834
3913
  * @param {number} startColumn The visual column index from which the selection starts.
3835
3914
  * @param {number} [endColumn=startColumn] The visual column index to which the selection finishes. If `endColumn`
3836
3915
  * is not defined the column defined by `startColumn` will be selected.
3916
+ * @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
3917
+ * The value can take visual row index from -N to N, where negative values
3918
+ * point to the headers and positive values point to the cell range.
3837
3919
  * @returns {boolean} `true` if selection was successful, `false` otherwise.
3838
3920
  */
3839
3921
  this.selectColumns = function (startColumn) {
3840
3922
  let endColumn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startColumn;
3841
- return selection.selectColumns(startColumn, endColumn);
3923
+ let focusPosition = arguments.length > 2 ? arguments[2] : undefined;
3924
+ return selection.selectColumns(startColumn, endColumn, focusPosition);
3842
3925
  };
3843
3926
 
3844
3927
  /**
@@ -3848,8 +3931,12 @@ function Core(rootElement, userSettings) {
3848
3931
  * ```js
3849
3932
  * // Select row using visual index.
3850
3933
  * hot.selectRows(1);
3851
- * // Select range of rows using visual indexes.
3934
+ * // select a range of rows, using visual indexes.
3852
3935
  * hot.selectRows(1, 4);
3936
+ * // select a range of rows, using visual indexes, and mark the header as highlighted.
3937
+ * hot.selectRows(1, 2, -1);
3938
+ * // Select range of rows using visual indexes and mark the second cell as highlighted.
3939
+ * hot.selectRows(2, 1, 1);
3853
3940
  * ```
3854
3941
  *
3855
3942
  * @memberof Core#
@@ -3858,11 +3945,15 @@ function Core(rootElement, userSettings) {
3858
3945
  * @param {number} startRow The visual row index from which the selection starts.
3859
3946
  * @param {number} [endRow=startRow] The visual row index to which the selection finishes. If `endRow`
3860
3947
  * is not defined the row defined by `startRow` will be selected.
3948
+ * @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
3949
+ * The value can take visual column index from -N to N, where negative values
3950
+ * point to the headers and positive values point to the cell range.
3861
3951
  * @returns {boolean} `true` if selection was successful, `false` otherwise.
3862
3952
  */
3863
3953
  this.selectRows = function (startRow) {
3864
3954
  let endRow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startRow;
3865
- return selection.selectRows(startRow, endRow);
3955
+ let focusPosition = arguments.length > 2 ? arguments[2] : undefined;
3956
+ return selection.selectRows(startRow, endRow, focusPosition);
3866
3957
  };
3867
3958
 
3868
3959
  /**
@@ -3881,9 +3972,16 @@ function Core(rootElement, userSettings) {
3881
3972
  * The previous selection is overwritten.
3882
3973
  *
3883
3974
  * ```js
3884
- * // select all cells in the table, including all headers
3975
+ * // select all cells in the table, including all headers and the corner cell
3885
3976
  * hot.selectAll();
3886
3977
  *
3978
+ * // select all cells in the table, including row headers but excluding the corner cell
3979
+ * hot.selectAll(true, false);
3980
+ *
3981
+ * // select all cells in the table, including all headers and the corner cell, but move the focus
3982
+ * // highlight to position -2, -1
3983
+ * hot.selectAll(-2, -1);
3984
+ *
3887
3985
  * // select all cells in the table, without headers
3888
3986
  * hot.selectAll(false);
3889
3987
  * ```
@@ -3891,15 +3989,20 @@ function Core(rootElement, userSettings) {
3891
3989
  * @since 0.38.2
3892
3990
  * @memberof Core#
3893
3991
  * @function selectAll
3894
- * @param {boolean} [includeHeaders=true] `true`: include all row, column and corner headers.
3895
- * `false`: don't include any headers.
3992
+ * @param {boolean} [includeRowHeaders=false] `true` If the selection should include the row headers,
3993
+ * `false` otherwise.
3994
+ * @param {boolean} [includeColumnHeaders=false] `true` If the selection should include the column
3995
+ * headers, `false` otherwise.
3996
+ * @param {{row: number, col: number}} [focusPosition] The argument allows changing the cell/header
3997
+ * focus position. The value takes an object with a `row` and `col` properties (visual indexes)
3998
+ * from -N to N, where negative values point to the headers and positive values point to the cell range.
3896
3999
  */
3897
4000
  this.selectAll = function () {
3898
- let includeHeaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
3899
- const includeRowHeaders = includeHeaders && this.hasRowHeaders();
3900
- const includeColumnHeaders = includeHeaders && this.hasColHeaders();
4001
+ let includeRowHeaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
4002
+ let includeColumnHeaders = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : includeRowHeaders;
4003
+ let focusPosition = arguments.length > 2 ? arguments[2] : undefined;
3901
4004
  preventScrollingToCell = true;
3902
- selection.selectAll(includeRowHeaders, includeColumnHeaders);
4005
+ selection.selectAll(includeRowHeaders, includeColumnHeaders, focusPosition);
3903
4006
  preventScrollingToCell = false;
3904
4007
  };
3905
4008
  const getIndexToScroll = (indexMapper, visualIndex) => {
@@ -3957,6 +4060,34 @@ function Core(rootElement, userSettings) {
3957
4060
  return false;
3958
4061
  };
3959
4062
 
4063
+ /**
4064
+ * Scrolls the viewport to coordinates specified by the currently focused cell.
4065
+ *
4066
+ * @since 14.0.0
4067
+ * @memberof Core#
4068
+ * @function scrollToFocusedCell
4069
+ * @param {Function} callback The callback function to call after the viewport is scrolled.
4070
+ */
4071
+ this.scrollToFocusedCell = function () {
4072
+ let callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : () => {};
4073
+ if (!this.selection.isSelected()) {
4074
+ return;
4075
+ }
4076
+ this.addHookOnce('afterScroll', callback);
4077
+ const {
4078
+ highlight
4079
+ } = this.getSelectedRangeLast();
4080
+ const renderableRowIndex = this.rowIndexMapper.getRenderableFromVisualIndex(highlight.row);
4081
+ const renderableColumnIndex = this.columnIndexMapper.getRenderableFromVisualIndex(highlight.col);
4082
+ const isScrolled = this.view.scrollViewport(this._createCellCoords(renderableRowIndex, renderableColumnIndex));
4083
+ if (isScrolled) {
4084
+ this.view.render();
4085
+ } else {
4086
+ this.removeHook('afterScroll', callback);
4087
+ this._registerImmediate(() => callback());
4088
+ }
4089
+ };
4090
+
3960
4091
  /**
3961
4092
  * Removes the table from the DOM and destroys the instance of the Handsontable.
3962
4093
  *
@@ -3977,6 +4108,7 @@ function Core(rootElement, userSettings) {
3977
4108
  dataSource = null;
3978
4109
  this.getShortcutManager().destroy();
3979
4110
  metaManager.clearCache();
4111
+ foreignHotInstances.delete(this.guid);
3980
4112
  if ((0, _rootInstance.isRootInstance)(instance)) {
3981
4113
  const licenseInfo = this.rootDocument.querySelector('.hot-display-license-info');
3982
4114
  if (licenseInfo) {
@@ -4300,6 +4432,16 @@ function Core(rootElement, userSettings) {
4300
4432
  }
4301
4433
  };
4302
4434
 
4435
+ /**
4436
+ * Gets the instance of the EditorManager.
4437
+ *
4438
+ * @private
4439
+ * @returns {EditorManager}
4440
+ */
4441
+ this._getEditorManager = function () {
4442
+ return editorManager;
4443
+ };
4444
+
4303
4445
  /**
4304
4446
  * Check if currently it is RTL direction.
4305
4447
  *
@@ -4372,270 +4514,11 @@ function Core(rootElement, userSettings) {
4372
4514
  this.getShortcutManager = function () {
4373
4515
  return shortcutManager;
4374
4516
  };
4375
- const gridContext = shortcutManager.addContext('grid');
4376
- const gridConfig = {
4377
- runOnlyIf: () => {
4378
- return (0, _mixed.isDefined)(instance.getSelected()) && instance.countRenderedRows() > 0 && instance.countRenderedCols() > 0;
4379
- },
4380
- group: SHORTCUTS_GROUP
4381
- };
4382
- shortcutManager.setActiveContextName('grid');
4383
- gridContext.addShortcuts([{
4384
- keys: [['Control/Meta', 'A']],
4385
- callback: () => {
4386
- instance.selectAll();
4387
- }
4388
- }, {
4389
- keys: [['Control/Meta', 'Enter']],
4390
- callback: () => {
4391
- const selectedRange = instance.getSelectedRange();
4392
- const {
4393
- row: highlightRow,
4394
- col: highlightColumn
4395
- } = selectedRange[selectedRange.length - 1].highlight;
4396
- const valueToPopulate = instance.getDataAtCell(highlightRow, highlightColumn);
4397
- const cellValues = new Map();
4398
- for (let i = 0; i < selectedRange.length; i++) {
4399
- selectedRange[i].forAll((row, column) => {
4400
- if (row >= 0 && column >= 0 && (row !== highlightRow || column !== highlightColumn)) {
4401
- const {
4402
- readOnly
4403
- } = instance.getCellMeta(row, column);
4404
- if (!readOnly) {
4405
- cellValues.set(`${row}x${column}`, [row, column, valueToPopulate]);
4406
- }
4407
- }
4408
- });
4409
- }
4410
- instance.setDataAtCell(Array.from(cellValues.values()));
4411
- },
4412
- runOnlyIf: () => instance.getSelectedRangeLast().getCellsCount() > 1
4413
- }, {
4414
- keys: [['ArrowUp']],
4415
- callback: () => {
4416
- selection.transformStart(-1, 0);
4417
- }
4418
- }, {
4419
- keys: [['ArrowUp', 'Control/Meta']],
4420
- captureCtrl: true,
4421
- callback: () => {
4422
- selection.setRangeStart(instance._createCellCoords(instance.rowIndexMapper.getNearestNotHiddenIndex(0, 1), instance.getSelectedRangeLast().highlight.col));
4423
- }
4424
- }, {
4425
- keys: [['ArrowUp', 'Shift']],
4426
- callback: () => {
4427
- selection.transformEnd(-1, 0);
4428
- }
4429
- }, {
4430
- keys: [['ArrowUp', 'Shift', 'Control/Meta']],
4431
- captureCtrl: true,
4432
- callback: () => {
4433
- const {
4434
- from,
4435
- to
4436
- } = instance.getSelectedRangeLast();
4437
- const row = instance.rowIndexMapper.getNearestNotHiddenIndex(0, 1);
4438
- selection.setRangeStart(from.clone());
4439
- selection.setRangeEnd(instance._createCellCoords(row, to.col));
4440
- },
4441
- runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByColumnHeader())
4442
- }, {
4443
- keys: [['ArrowDown']],
4444
- callback: () => {
4445
- selection.transformStart(1, 0);
4446
- }
4447
- }, {
4448
- keys: [['ArrowDown', 'Control/Meta']],
4449
- captureCtrl: true,
4450
- callback: () => {
4451
- selection.setRangeStart(instance._createCellCoords(instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - 1, -1), instance.getSelectedRangeLast().highlight.col));
4452
- }
4453
- }, {
4454
- keys: [['ArrowDown', 'Shift']],
4455
- callback: () => {
4456
- selection.transformEnd(1, 0);
4457
- }
4458
- }, {
4459
- keys: [['ArrowDown', 'Shift', 'Control/Meta']],
4460
- captureCtrl: true,
4461
- callback: () => {
4462
- const {
4463
- from,
4464
- to
4465
- } = instance.getSelectedRangeLast();
4466
- const row = instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - 1, -1);
4467
- selection.setRangeStart(from.clone());
4468
- selection.setRangeEnd(instance._createCellCoords(row, to.col));
4469
- },
4470
- runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByColumnHeader())
4471
- }, {
4472
- keys: [['ArrowLeft']],
4473
- callback: () => {
4474
- selection.transformStart(0, -1 * instance.getDirectionFactor());
4475
- }
4476
- }, {
4477
- keys: [['ArrowLeft', 'Control/Meta']],
4478
- captureCtrl: true,
4479
- callback: () => {
4480
- const row = instance.getSelectedRangeLast().highlight.row;
4481
- const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
4482
- selection.setRangeStart(instance._createCellCoords(row, column));
4483
- }
4484
- }, {
4485
- keys: [['ArrowLeft', 'Shift']],
4486
- callback: () => {
4487
- selection.transformEnd(0, -1 * instance.getDirectionFactor());
4488
- }
4489
- }, {
4490
- keys: [['ArrowLeft', 'Shift', 'Control/Meta']],
4491
- captureCtrl: true,
4492
- callback: () => {
4493
- const {
4494
- from,
4495
- to
4496
- } = instance.getSelectedRangeLast();
4497
- const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
4498
- selection.setRangeStart(from.clone());
4499
- selection.setRangeEnd(instance._createCellCoords(to.row, column));
4500
- },
4501
- runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByRowHeader())
4502
- }, {
4503
- keys: [['ArrowRight']],
4504
- callback: () => {
4505
- selection.transformStart(0, instance.getDirectionFactor());
4506
- }
4507
- }, {
4508
- keys: [['ArrowRight', 'Control/Meta']],
4509
- captureCtrl: true,
4510
- callback: () => {
4511
- const row = instance.getSelectedRangeLast().highlight.row;
4512
- const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
4513
- selection.setRangeStart(instance._createCellCoords(row, column));
4514
- }
4515
- }, {
4516
- keys: [['ArrowRight', 'Shift']],
4517
- callback: () => {
4518
- selection.transformEnd(0, instance.getDirectionFactor());
4519
- }
4520
- }, {
4521
- keys: [['ArrowRight', 'Shift', 'Control/Meta']],
4522
- captureCtrl: true,
4523
- callback: () => {
4524
- const {
4525
- from,
4526
- to
4527
- } = instance.getSelectedRangeLast();
4528
- const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
4529
- selection.setRangeStart(from.clone());
4530
- selection.setRangeEnd(instance._createCellCoords(to.row, column));
4531
- },
4532
- runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByRowHeader())
4533
- }, {
4534
- keys: [['Home']],
4535
- captureCtrl: true,
4536
- callback: () => {
4537
- const fixedColumns = parseInt(instance.getSettings().fixedColumnsStart, 10);
4538
- const row = instance.getSelectedRangeLast().highlight.row;
4539
- const column = instance.columnIndexMapper.getNearestNotHiddenIndex(fixedColumns, 1);
4540
- selection.setRangeStart(instance._createCellCoords(row, column));
4541
- },
4542
- runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
4543
- }, {
4544
- keys: [['Home', 'Shift']],
4545
- callback: () => {
4546
- selection.setRangeEnd(instance._createCellCoords(selection.selectedRange.current().from.row, instance.columnIndexMapper.getNearestNotHiddenIndex(0, 1)));
4547
- }
4548
- }, {
4549
- keys: [['Home', 'Control/Meta']],
4550
- captureCtrl: true,
4551
- callback: () => {
4552
- const fixedRows = parseInt(instance.getSettings().fixedRowsTop, 10);
4553
- const fixedColumns = parseInt(instance.getSettings().fixedColumnsStart, 10);
4554
- const row = instance.rowIndexMapper.getNearestNotHiddenIndex(fixedRows, 1);
4555
- const column = instance.columnIndexMapper.getNearestNotHiddenIndex(fixedColumns, 1);
4556
- selection.setRangeStart(instance._createCellCoords(row, column));
4557
- },
4558
- runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
4559
- }, {
4560
- keys: [['End']],
4561
- captureCtrl: true,
4562
- callback: () => {
4563
- selection.setRangeStart(instance._createCellCoords(instance.getSelectedRangeLast().highlight.row, instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1)));
4564
- },
4565
- runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
4566
- }, {
4567
- keys: [['End', 'Shift']],
4568
- callback: () => {
4569
- selection.setRangeEnd(instance._createCellCoords(selection.selectedRange.current().from.row, instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1)));
4570
- }
4571
- }, {
4572
- keys: [['End', 'Control/Meta']],
4573
- captureCtrl: true,
4574
- callback: () => {
4575
- const fixedRows = parseInt(instance.getSettings().fixedRowsBottom, 10);
4576
- const row = instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - fixedRows - 1, -1);
4577
- const column = instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1);
4578
- selection.setRangeStart(instance._createCellCoords(row, column));
4579
- },
4580
- runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
4581
- }, {
4582
- keys: [['PageUp']],
4583
- callback: () => {
4584
- selection.transformStart(-instance.countVisibleRows(), 0);
4585
- }
4586
- }, {
4587
- keys: [['PageUp', 'Shift']],
4588
- callback: () => {
4589
- const {
4590
- to
4591
- } = instance.getSelectedRangeLast();
4592
- const nextRowIndexToSelect = Math.max(to.row - instance.countVisibleRows(), 0);
4593
- const row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, 1);
4594
- if (row !== null) {
4595
- const coords = instance._createCellCoords(row, to.col);
4596
- const scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
4597
- const nextVerticalScroll = Math.max(coords.row - scrollPadding, 0);
4598
- selection.setRangeEnd(coords);
4599
- instance.scrollViewportTo(nextVerticalScroll);
4600
- }
4601
- }
4602
- }, {
4603
- keys: [['PageDown']],
4604
- callback: () => {
4605
- selection.transformStart(instance.countVisibleRows(), 0);
4606
- }
4607
- }, {
4608
- keys: [['PageDown', 'Shift']],
4609
- callback: () => {
4610
- const {
4611
- to
4612
- } = instance.getSelectedRangeLast();
4613
- const nextRowIndexToSelect = Math.min(to.row + instance.countVisibleRows(), instance.countRows() - 1);
4614
- const row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, -1);
4615
- if (row !== null) {
4616
- const coords = instance._createCellCoords(row, to.col);
4617
- const scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
4618
- const nextVerticalScroll = Math.min(coords.row - scrollPadding, instance.countRows() - 1);
4619
- selection.setRangeEnd(coords);
4620
- instance.scrollViewportTo(nextVerticalScroll);
4621
- }
4622
- }
4623
- }, {
4624
- keys: [['Tab']],
4625
- callback: event => {
4626
- const tabMoves = typeof tableMeta.tabMoves === 'function' ? tableMeta.tabMoves(event) : tableMeta.tabMoves;
4627
- selection.transformStart(tabMoves.row, tabMoves.col, true);
4628
- }
4629
- }, {
4630
- keys: [['Shift', 'Tab']],
4631
- callback: event => {
4632
- const tabMoves = typeof tableMeta.tabMoves === 'function' ? tableMeta.tabMoves(event) : tableMeta.tabMoves;
4633
- selection.transformStart(-tabMoves.row, -tabMoves.col);
4634
- }
4635
- }], gridConfig);
4636
4517
  (0, _registry.getPluginsNames)().forEach(pluginName => {
4637
4518
  const PluginClass = (0, _registry.getPlugin)(pluginName);
4638
4519
  pluginsRegistry.addItem(pluginName, new PluginClass(this));
4639
4520
  });
4521
+ (0, _shortcutContexts.registerAllShortcutContexts)(instance);
4522
+ shortcutManager.setActiveContextName('grid');
4640
4523
  _pluginHooks.default.getSingleton().run(instance, 'construct');
4641
4524
  }