handsontable 0.0.0-next-08765b9-20230809 → 0.0.0-next-7e1ba35-20230821

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 (299) hide show
  1. package/3rdparty/walkontable/src/{selection/border/border.js → border.js} +12 -7
  2. package/3rdparty/walkontable/src/{selection/border/border.mjs → border.mjs} +12 -7
  3. package/3rdparty/walkontable/src/cell/coords.d.ts +1 -6
  4. package/3rdparty/walkontable/src/cell/coords.js +11 -50
  5. package/3rdparty/walkontable/src/cell/coords.mjs +11 -50
  6. package/3rdparty/walkontable/src/cell/range.d.ts +2 -9
  7. package/3rdparty/walkontable/src/cell/range.js +7 -38
  8. package/3rdparty/walkontable/src/cell/range.mjs +7 -38
  9. package/3rdparty/walkontable/src/core/_base.js +3 -9
  10. package/3rdparty/walkontable/src/core/_base.mjs +3 -9
  11. package/3rdparty/walkontable/src/core/clone.js +2 -2
  12. package/3rdparty/walkontable/src/core/clone.mjs +2 -2
  13. package/3rdparty/walkontable/src/core/core.js +2 -3
  14. package/3rdparty/walkontable/src/core/core.mjs +2 -3
  15. package/3rdparty/walkontable/src/event.js +7 -7
  16. package/3rdparty/walkontable/src/event.mjs +7 -7
  17. package/3rdparty/walkontable/src/facade/core.js +2 -2
  18. package/3rdparty/walkontable/src/facade/core.mjs +2 -2
  19. package/3rdparty/walkontable/src/index.js +2 -10
  20. package/3rdparty/walkontable/src/index.mjs +2 -2
  21. package/3rdparty/walkontable/src/overlay/_base.js +1 -1
  22. package/3rdparty/walkontable/src/overlay/_base.mjs +1 -1
  23. package/3rdparty/walkontable/src/overlay/inlineStart.js +6 -2
  24. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +6 -2
  25. package/3rdparty/walkontable/src/overlay/top.js +6 -2
  26. package/3rdparty/walkontable/src/overlay/top.mjs +6 -2
  27. package/3rdparty/walkontable/src/selection.js +295 -0
  28. package/3rdparty/walkontable/src/selection.mjs +290 -0
  29. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +0 -9
  30. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +0 -9
  31. package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +0 -9
  32. package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +0 -9
  33. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +0 -9
  34. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +0 -9
  35. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +0 -9
  36. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +0 -9
  37. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +0 -9
  38. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +0 -9
  39. package/3rdparty/walkontable/src/table.js +78 -6
  40. package/3rdparty/walkontable/src/table.mjs +79 -7
  41. package/base.js +2 -2
  42. package/base.mjs +2 -2
  43. package/common.d.ts +1 -1
  44. package/core.d.ts +3 -6
  45. package/core.js +290 -173
  46. package/core.mjs +290 -173
  47. package/dataMap/metaManager/metaSchema.js +0 -41
  48. package/dataMap/metaManager/metaSchema.mjs +0 -41
  49. package/dist/handsontable.css +4 -24
  50. package/dist/handsontable.full.css +4 -24
  51. package/dist/handsontable.full.js +5384 -8679
  52. package/dist/handsontable.full.min.css +3 -4
  53. package/dist/handsontable.full.min.js +960 -29
  54. package/dist/handsontable.js +8132 -11427
  55. package/dist/handsontable.min.css +3 -4
  56. package/dist/handsontable.min.js +61 -24
  57. package/editorManager.js +75 -11
  58. package/editorManager.mjs +74 -11
  59. package/editors/baseEditor/baseEditor.d.ts +1 -0
  60. package/editors/textEditor/textEditor.js +11 -3
  61. package/editors/textEditor/textEditor.mjs +12 -4
  62. package/helpers/mixed.js +1 -1
  63. package/helpers/mixed.mjs +1 -1
  64. package/helpers/number.d.ts +0 -1
  65. package/helpers/number.js +0 -18
  66. package/helpers/number.mjs +0 -17
  67. package/package.json +1 -1
  68. package/pluginHooks.d.ts +1 -7
  69. package/pluginHooks.js +1 -106
  70. package/pluginHooks.mjs +1 -106
  71. package/plugins/collapsibleColumns/collapsibleColumns.js +4 -58
  72. package/plugins/collapsibleColumns/collapsibleColumns.mjs +4 -58
  73. package/plugins/columnSorting/columnSorting.js +0 -38
  74. package/plugins/columnSorting/columnSorting.mjs +2 -38
  75. package/plugins/columnSorting/index.js +1 -3
  76. package/plugins/columnSorting/index.mjs +1 -1
  77. package/plugins/comments/commentEditor.js +0 -1
  78. package/plugins/comments/commentEditor.mjs +0 -1
  79. package/plugins/comments/comments.js +189 -251
  80. package/plugins/comments/comments.mjs +190 -250
  81. package/plugins/contextMenu/contextMenu.d.ts +1 -1
  82. package/plugins/contextMenu/contextMenu.js +30 -72
  83. package/plugins/contextMenu/contextMenu.mjs +31 -73
  84. package/plugins/contextMenu/predefinedItems/alignment.js +0 -7
  85. package/plugins/contextMenu/predefinedItems/alignment.mjs +0 -7
  86. package/plugins/contextMenu/predefinedItems/clearColumn.js +3 -5
  87. package/plugins/contextMenu/predefinedItems/clearColumn.mjs +3 -5
  88. package/plugins/contextMenu/predefinedItems/columnLeft.js +3 -5
  89. package/plugins/contextMenu/predefinedItems/columnLeft.mjs +3 -5
  90. package/plugins/contextMenu/predefinedItems/columnRight.js +3 -5
  91. package/plugins/contextMenu/predefinedItems/columnRight.mjs +3 -5
  92. package/plugins/contextMenu/predefinedItems/readOnly.js +0 -7
  93. package/plugins/contextMenu/predefinedItems/readOnly.mjs +0 -7
  94. package/plugins/contextMenu/predefinedItems/removeColumn.js +5 -7
  95. package/plugins/contextMenu/predefinedItems/removeColumn.mjs +3 -5
  96. package/plugins/contextMenu/predefinedItems/removeRow.js +5 -7
  97. package/plugins/contextMenu/predefinedItems/removeRow.mjs +3 -5
  98. package/plugins/contextMenu/predefinedItems/rowAbove.js +3 -5
  99. package/plugins/contextMenu/predefinedItems/rowAbove.mjs +3 -5
  100. package/plugins/contextMenu/predefinedItems/rowBelow.js +3 -5
  101. package/plugins/contextMenu/predefinedItems/rowBelow.mjs +3 -5
  102. package/plugins/contextMenu/utils.js +16 -28
  103. package/plugins/contextMenu/utils.mjs +15 -27
  104. package/plugins/copyPaste/contextMenuItem/copy.js +0 -7
  105. package/plugins/copyPaste/contextMenuItem/copy.mjs +0 -7
  106. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.js +1 -9
  107. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs +1 -9
  108. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.js +1 -9
  109. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs +1 -9
  110. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.js +1 -9
  111. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs +1 -9
  112. package/plugins/copyPaste/contextMenuItem/cut.js +0 -7
  113. package/plugins/copyPaste/contextMenuItem/cut.mjs +0 -7
  114. package/plugins/copyPaste/copyPaste.js +10 -14
  115. package/plugins/copyPaste/copyPaste.mjs +10 -14
  116. package/plugins/customBorders/customBorders.js +20 -23
  117. package/plugins/customBorders/customBorders.mjs +21 -24
  118. package/plugins/dropdownMenu/dropdownMenu.d.ts +1 -1
  119. package/plugins/dropdownMenu/dropdownMenu.js +32 -89
  120. package/plugins/dropdownMenu/dropdownMenu.mjs +32 -89
  121. package/plugins/filters/filters.js +14 -31
  122. package/plugins/filters/filters.mjs +13 -30
  123. package/plugins/manualColumnResize/manualColumnResize.js +6 -0
  124. package/plugins/manualColumnResize/manualColumnResize.mjs +7 -1
  125. package/plugins/mergeCells/mergeCells.js +17 -5
  126. package/plugins/mergeCells/mergeCells.mjs +17 -5
  127. package/plugins/multiColumnSorting/multiColumnSorting.js +2 -37
  128. package/plugins/multiColumnSorting/multiColumnSorting.mjs +2 -37
  129. package/plugins/nestedHeaders/nestedHeaders.js +8 -121
  130. package/plugins/nestedHeaders/nestedHeaders.mjs +8 -121
  131. package/plugins/nestedHeaders/stateManager/index.js +0 -37
  132. package/plugins/nestedHeaders/stateManager/index.mjs +0 -37
  133. package/plugins/nestedRows/nestedRows.js +0 -41
  134. package/plugins/nestedRows/nestedRows.mjs +0 -41
  135. package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
  136. package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
  137. package/selection/highlight/constants.js +15 -0
  138. package/selection/highlight/constants.mjs +6 -0
  139. package/selection/highlight/highlight.js +71 -256
  140. package/selection/highlight/highlight.mjs +71 -250
  141. package/selection/highlight/types/activeHeader.js +8 -10
  142. package/selection/highlight/types/activeHeader.mjs +8 -10
  143. package/selection/highlight/types/area.js +18 -6
  144. package/selection/highlight/types/area.mjs +18 -6
  145. package/selection/highlight/types/{focus.js → cell.js} +7 -5
  146. package/selection/highlight/types/{focus.mjs → cell.mjs} +7 -5
  147. package/selection/highlight/types/customSelection.js +9 -7
  148. package/selection/highlight/types/customSelection.mjs +9 -7
  149. package/selection/highlight/types/fill.js +7 -5
  150. package/selection/highlight/types/fill.mjs +7 -5
  151. package/selection/highlight/types/header.js +18 -9
  152. package/selection/highlight/types/header.mjs +18 -9
  153. package/selection/highlight/types/index.js +35 -0
  154. package/selection/highlight/types/index.mjs +31 -0
  155. package/selection/highlight/visualSelection.js +27 -31
  156. package/selection/highlight/visualSelection.mjs +27 -31
  157. package/selection/index.js +7 -4
  158. package/selection/index.mjs +3 -2
  159. package/selection/mouseEventHandler.js +1 -1
  160. package/selection/mouseEventHandler.mjs +1 -1
  161. package/selection/range.js +8 -8
  162. package/selection/range.mjs +8 -8
  163. package/selection/selection.js +154 -290
  164. package/selection/selection.mjs +153 -287
  165. package/selection/transformation.js +90 -232
  166. package/selection/transformation.mjs +90 -232
  167. package/selection/utils.js +21 -15
  168. package/selection/utils.mjs +21 -16
  169. package/settings.d.ts +0 -2
  170. package/shortcuts/manager.js +0 -2
  171. package/shortcuts/manager.mjs +0 -2
  172. package/shortcuts/recorder.js +2 -2
  173. package/shortcuts/recorder.mjs +2 -2
  174. package/shortcuts/utils.js +5 -19
  175. package/shortcuts/utils.mjs +4 -18
  176. package/tableView.js +13 -67
  177. package/tableView.mjs +13 -67
  178. package/3rdparty/walkontable/src/selection/border/constants.js +0 -16
  179. package/3rdparty/walkontable/src/selection/border/constants.mjs +0 -12
  180. package/3rdparty/walkontable/src/selection/constants.js +0 -62
  181. package/3rdparty/walkontable/src/selection/constants.mjs +0 -51
  182. package/3rdparty/walkontable/src/selection/index.js +0 -26
  183. package/3rdparty/walkontable/src/selection/index.mjs +0 -5
  184. package/3rdparty/walkontable/src/selection/manager.js +0 -259
  185. package/3rdparty/walkontable/src/selection/manager.mjs +0 -254
  186. package/3rdparty/walkontable/src/selection/scanner.js +0 -270
  187. package/3rdparty/walkontable/src/selection/scanner.mjs +0 -267
  188. package/3rdparty/walkontable/src/selection/selection.js +0 -101
  189. package/3rdparty/walkontable/src/selection/selection.mjs +0 -96
  190. package/core/focusCatcher/focusDetector.js +0 -58
  191. package/core/focusCatcher/focusDetector.mjs +0 -54
  192. package/core/focusCatcher/index.js +0 -142
  193. package/core/focusCatcher/index.mjs +0 -138
  194. package/core/index.js +0 -9
  195. package/core/index.mjs +0 -1
  196. package/plugins/comments/contextMenuItem/addEditComment.js +0 -41
  197. package/plugins/comments/contextMenuItem/addEditComment.mjs +0 -35
  198. package/plugins/comments/contextMenuItem/readOnlyComment.js +0 -49
  199. package/plugins/comments/contextMenuItem/readOnlyComment.mjs +0 -43
  200. package/plugins/comments/contextMenuItem/removeComment.js +0 -38
  201. package/plugins/comments/contextMenuItem/removeComment.mjs +0 -32
  202. package/selection/highlight/types/areaLayered.js +0 -31
  203. package/selection/highlight/types/areaLayered.mjs +0 -26
  204. package/selection/highlight/types/column.js +0 -27
  205. package/selection/highlight/types/column.mjs +0 -22
  206. package/selection/highlight/types/row.js +0 -27
  207. package/selection/highlight/types/row.mjs +0 -22
  208. package/shortcutContexts/commands/editor/closeAndSave.js +0 -12
  209. package/shortcutContexts/commands/editor/closeAndSave.mjs +0 -8
  210. package/shortcutContexts/commands/editor/closeWithoutSaving.js +0 -12
  211. package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +0 -8
  212. package/shortcutContexts/commands/editor/fastOpen.js +0 -16
  213. package/shortcutContexts/commands/editor/fastOpen.mjs +0 -12
  214. package/shortcutContexts/commands/editor/index.js +0 -16
  215. package/shortcutContexts/commands/editor/index.mjs +0 -12
  216. package/shortcutContexts/commands/editor/open.js +0 -27
  217. package/shortcutContexts/commands/editor/open.mjs +0 -23
  218. package/shortcutContexts/commands/emptySelectedCells.js +0 -11
  219. package/shortcutContexts/commands/emptySelectedCells.mjs +0 -7
  220. package/shortcutContexts/commands/extendCellsSelection/down.js +0 -15
  221. package/shortcutContexts/commands/extendCellsSelection/down.mjs +0 -11
  222. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +0 -21
  223. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +0 -17
  224. package/shortcutContexts/commands/extendCellsSelection/index.js +0 -26
  225. package/shortcutContexts/commands/extendCellsSelection/index.mjs +0 -22
  226. package/shortcutContexts/commands/extendCellsSelection/left.js +0 -15
  227. package/shortcutContexts/commands/extendCellsSelection/left.mjs +0 -11
  228. package/shortcutContexts/commands/extendCellsSelection/right.js +0 -15
  229. package/shortcutContexts/commands/extendCellsSelection/right.mjs +0 -11
  230. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +0 -19
  231. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +0 -15
  232. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +0 -29
  233. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +0 -25
  234. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +0 -19
  235. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +0 -15
  236. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +0 -19
  237. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +0 -15
  238. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +0 -29
  239. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +0 -25
  240. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +0 -29
  241. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +0 -25
  242. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +0 -29
  243. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +0 -25
  244. package/shortcutContexts/commands/extendCellsSelection/toRows.js +0 -19
  245. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +0 -15
  246. package/shortcutContexts/commands/extendCellsSelection/up.js +0 -15
  247. package/shortcutContexts/commands/extendCellsSelection/up.mjs +0 -11
  248. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +0 -21
  249. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +0 -17
  250. package/shortcutContexts/commands/index.js +0 -35
  251. package/shortcutContexts/commands/index.mjs +0 -31
  252. package/shortcutContexts/commands/moveCellSelection/down.js +0 -13
  253. package/shortcutContexts/commands/moveCellSelection/down.mjs +0 -9
  254. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +0 -31
  255. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +0 -27
  256. package/shortcutContexts/commands/moveCellSelection/index.js +0 -28
  257. package/shortcutContexts/commands/moveCellSelection/index.mjs +0 -24
  258. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +0 -12
  259. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +0 -8
  260. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +0 -12
  261. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +0 -8
  262. package/shortcutContexts/commands/moveCellSelection/left.js +0 -10
  263. package/shortcutContexts/commands/moveCellSelection/left.mjs +0 -6
  264. package/shortcutContexts/commands/moveCellSelection/right.js +0 -10
  265. package/shortcutContexts/commands/moveCellSelection/right.mjs +0 -6
  266. package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +0 -17
  267. package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +0 -13
  268. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +0 -18
  269. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +0 -14
  270. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +0 -14
  271. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +0 -10
  272. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +0 -17
  273. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +0 -13
  274. package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +0 -19
  275. package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +0 -15
  276. package/shortcutContexts/commands/moveCellSelection/toMostRight.js +0 -21
  277. package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +0 -17
  278. package/shortcutContexts/commands/moveCellSelection/toMostTop.js +0 -17
  279. package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +0 -13
  280. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +0 -19
  281. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +0 -15
  282. package/shortcutContexts/commands/moveCellSelection/up.js +0 -13
  283. package/shortcutContexts/commands/moveCellSelection/up.mjs +0 -9
  284. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +0 -31
  285. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +0 -27
  286. package/shortcutContexts/commands/populateSelectedCellsData.js +0 -29
  287. package/shortcutContexts/commands/populateSelectedCellsData.mjs +0 -25
  288. package/shortcutContexts/commands/scrollToFocusedCell.js +0 -36
  289. package/shortcutContexts/commands/scrollToFocusedCell.mjs +0 -32
  290. package/shortcutContexts/commands/selectAll.js +0 -10
  291. package/shortcutContexts/commands/selectAll.mjs +0 -6
  292. package/shortcutContexts/constants.js +0 -13
  293. package/shortcutContexts/constants.mjs +0 -8
  294. package/shortcutContexts/editor.js +0 -25
  295. package/shortcutContexts/editor.mjs +0 -21
  296. package/shortcutContexts/grid.js +0 -163
  297. package/shortcutContexts/grid.mjs +0 -159
  298. package/shortcutContexts/index.js +0 -24
  299. package/shortcutContexts/index.mjs +0 -11
package/core.mjs CHANGED
@@ -27,21 +27,11 @@ import { hasLanguageDictionary, getValidLanguageCode, getTranslatedPhrase } from
27
27
  import { warnUserAboutLanguageRegistration, normalizeLanguageCode } from "./i18n/utils.mjs";
28
28
  import { Selection } from "./selection/index.mjs";
29
29
  import { MetaManager, DynamicCellMetaMod, ExtendMetaPropertiesMod, replaceData } from "./dataMap/index.mjs";
30
- import { installFocusCatcher } from "./core/index.mjs";
31
30
  import { createUniqueMap } from "./utils/dataStructures/uniqueMap.mjs";
32
31
  import { createShortcutManager } from "./shortcuts/index.mjs";
33
- import { registerAllShortcutContexts } from "./shortcutContexts/index.mjs";
32
+ const SHORTCUTS_GROUP = 'gridDefault';
34
33
  let activeGuid = null;
35
34
 
36
- /**
37
- * Keeps the collection of the all Handsontable instances created on the same page. The
38
- * list is then used to trigger the "afterUnlisten" hook when the "listen()" method was
39
- * called on another instance.
40
- *
41
- * @type {Map<string, Core>}
42
- */
43
- const foreignHotInstances = new Map();
44
-
45
35
  /**
46
36
  * A set of deprecated feature names.
47
37
  *
@@ -101,8 +91,7 @@ const deprecationWarns = new Set();
101
91
  * @param {boolean} [rootInstanceSymbol=false] Indicates if the instance is root of all later instances created.
102
92
  */
103
93
  export default function Core(rootElement, userSettings) {
104
- var _userSettings$layoutD,
105
- _this = this;
94
+ var _userSettings$layoutD;
106
95
  let rootInstanceSymbol = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
107
96
  let preventScrollingToCell = false;
108
97
  let instance = this;
@@ -219,8 +208,6 @@ export default function Core(rootElement, userSettings) {
219
208
  }
220
209
  this.guid = `ht_${randomString()}`; // this is the namespace for global events
221
210
 
222
- foreignHotInstances.set(this.guid, this);
223
-
224
211
  /**
225
212
  * Instance of index mapper which is responsible for managing the column indexes.
226
213
  *
@@ -269,16 +256,14 @@ export default function Core(rootElement, userSettings) {
269
256
  };
270
257
 
271
258
  let selection = new Selection(tableMeta, {
272
- rowIndexMapper: instance.rowIndexMapper,
273
- columnIndexMapper: instance.columnIndexMapper,
259
+ rowIndexMapper: () => instance.rowIndexMapper,
260
+ columnIndexMapper: () => instance.columnIndexMapper,
274
261
  countCols: () => instance.countCols(),
275
262
  countRows: () => instance.countRows(),
276
263
  propToCol: prop => datamap.propToCol(prop),
277
264
  isEditorOpened: () => instance.getActiveEditor() ? instance.getActiveEditor().isOpened() : false,
278
- countRenderableColumns: () => this.view.countRenderableColumns(),
279
- countRenderableRows: () => this.view.countRenderableRows(),
280
- countRowHeaders: () => this.countRowHeaders(),
281
- countColHeaders: () => this.countColHeaders(),
265
+ countColsTranslated: () => this.view.countRenderableColumns(),
266
+ countRowsTranslated: () => this.view.countRenderableRows(),
282
267
  getShortcutManager: () => instance.getShortcutManager(),
283
268
  createCellCoords: (row, column) => instance._createCellCoords(row, column),
284
269
  createCellRange: (highlight, from, to) => instance._createCellRange(highlight, from, to),
@@ -305,6 +290,12 @@ export default function Core(rootElement, userSettings) {
305
290
  });
306
291
  this.selection.addLocalHook('beforeSetRangeEnd', cellCoords => {
307
292
  this.runHooks('beforeSetRangeEnd', cellCoords);
293
+ if (cellCoords.row < 0) {
294
+ cellCoords.row = this.view._wt.wtTable.getFirstVisibleRow();
295
+ }
296
+ if (cellCoords.col < 0) {
297
+ cellCoords.col = this.view._wt.wtTable.getFirstVisibleColumn();
298
+ }
308
299
  });
309
300
  this.selection.addLocalHook('afterSetRangeEnd', cellCoords => {
310
301
  const preventScrolling = createObjectPropListener(false);
@@ -331,14 +322,7 @@ export default function Core(rootElement, userSettings) {
331
322
  if (scrollToCell !== false) {
332
323
  if (!isSelectedByAnyHeader) {
333
324
  if (currentSelectedRange && !this.selection.isMultiple()) {
334
- const renderableCoords = visualToRenderableCoords(currentSelectedRange.from);
335
- if (renderableCoords.row < 0 && renderableCoords.col >= 0) {
336
- this.view.scrollViewportHorizontally(renderableCoords.col);
337
- } else if (renderableCoords.col < 0 && renderableCoords.row >= 0) {
338
- this.view.scrollViewportVertically(renderableCoords.row);
339
- } else {
340
- this.view.scrollViewport(renderableCoords);
341
- }
325
+ this.view.scrollViewport(visualToRenderableCoords(currentSelectedRange.from));
342
326
  } else {
343
327
  this.view.scrollViewport(visualToRenderableCoords(cellCoords));
344
328
  }
@@ -380,30 +364,6 @@ export default function Core(rootElement, userSettings) {
380
364
  isMultiple.value = changedIsMultiple;
381
365
  }
382
366
  });
383
- this.selection.addLocalHook('beforeSelectColumns', function () {
384
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
385
- args[_key] = arguments[_key];
386
- }
387
- return _this.runHooks('beforeSelectColumns', ...args);
388
- });
389
- this.selection.addLocalHook('afterSelectColumns', function () {
390
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
391
- args[_key2] = arguments[_key2];
392
- }
393
- return _this.runHooks('afterSelectColumns', ...args);
394
- });
395
- this.selection.addLocalHook('beforeSelectRows', function () {
396
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
397
- args[_key3] = arguments[_key3];
398
- }
399
- return _this.runHooks('beforeSelectRows', ...args);
400
- });
401
- this.selection.addLocalHook('afterSelectRows', function () {
402
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
403
- args[_key4] = arguments[_key4];
404
- }
405
- return _this.runHooks('afterSelectRows', ...args);
406
- });
407
367
  this.selection.addLocalHook('beforeModifyTransformStart', cellCoordsDelta => {
408
368
  this.runHooks('modifyTransformStart', cellCoordsDelta);
409
369
  });
@@ -1053,9 +1013,6 @@ export default function Core(rootElement, userSettings) {
1053
1013
  this.updateSettings(tableMeta, true);
1054
1014
  this.view = new TableView(this);
1055
1015
  editorManager = EditorManager.getInstance(instance, tableMeta, selection);
1056
- if (isRootInstance(this)) {
1057
- installFocusCatcher(instance);
1058
- }
1059
1016
  instance.runHooks('init');
1060
1017
  this.forceFullRender = true; // used when data was changed
1061
1018
  this.view.render();
@@ -1469,11 +1426,6 @@ export default function Core(rootElement, userSettings) {
1469
1426
  */
1470
1427
  this.listen = function () {
1471
1428
  if (instance && !instance.isListening()) {
1472
- foreignHotInstances.forEach(foreignHot => {
1473
- if (instance !== foreignHot) {
1474
- foreignHot.unlisten();
1475
- }
1476
- });
1477
1429
  activeGuid = instance.guid;
1478
1430
  instance.runHooks('afterListen');
1479
1431
  }
@@ -1558,8 +1510,8 @@ export default function Core(rootElement, userSettings) {
1558
1510
  * @returns {Array} Returns removed portion of columns.
1559
1511
  */
1560
1512
  this.spliceCol = function (column, index, amount) {
1561
- for (var _len5 = arguments.length, elements = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
1562
- elements[_key5 - 3] = arguments[_key5];
1513
+ for (var _len = arguments.length, elements = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
1514
+ elements[_key - 3] = arguments[_key];
1563
1515
  }
1564
1516
  return datamap.spliceCol(column, index, amount, ...elements);
1565
1517
  };
@@ -1576,8 +1528,8 @@ export default function Core(rootElement, userSettings) {
1576
1528
  * @returns {Array} Returns removed portion of rows.
1577
1529
  */
1578
1530
  this.spliceRow = function (row, index, amount) {
1579
- for (var _len6 = arguments.length, elements = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
1580
- elements[_key6 - 3] = arguments[_key6];
1531
+ for (var _len2 = arguments.length, elements = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
1532
+ elements[_key2 - 3] = arguments[_key2];
1581
1533
  }
1582
1534
  return datamap.spliceRow(row, index, amount, ...elements);
1583
1535
  };
@@ -1674,9 +1626,6 @@ export default function Core(rootElement, userSettings) {
1674
1626
  }
1675
1627
  const changes = [];
1676
1628
  arrayEach(selection.getSelectedRange(), cellRange => {
1677
- if (cellRange.isSingleHeader()) {
1678
- return;
1679
- }
1680
1629
  const topStart = cellRange.getTopStartCorner();
1681
1630
  const bottomEnd = cellRange.getBottomEndCorner();
1682
1631
  rangeEach(topStart.row, bottomEnd.row, row => {
@@ -2974,8 +2923,8 @@ export default function Core(rootElement, userSettings) {
2974
2923
  */
2975
2924
  this.spliceCellsMeta = function (visualIndex) {
2976
2925
  let deleteAmount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2977
- for (var _len7 = arguments.length, cellMetaRows = new Array(_len7 > 2 ? _len7 - 2 : 0), _key7 = 2; _key7 < _len7; _key7++) {
2978
- cellMetaRows[_key7 - 2] = arguments[_key7];
2926
+ for (var _len3 = arguments.length, cellMetaRows = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
2927
+ cellMetaRows[_key3 - 2] = arguments[_key3];
2979
2928
  }
2980
2929
  if (cellMetaRows.length > 0 && !Array.isArray(cellMetaRows[0])) {
2981
2930
  throw new Error('The 3rd argument (cellMetaRows) has to be passed as an array of cell meta objects array.');
@@ -3666,30 +3615,6 @@ export default function Core(rootElement, userSettings) {
3666
3615
  return instance.view._wt.drawn ? instance.view._wt.wtTable.getVisibleColumnsCount() : -1;
3667
3616
  };
3668
3617
 
3669
- /**
3670
- * Returns the number of rendered row headers.
3671
- *
3672
- * @since 14.0.0
3673
- * @memberof Core#
3674
- * @function countRowHeaders
3675
- * @returns {number} Number of row headers.
3676
- */
3677
- this.countRowHeaders = function () {
3678
- return this.view.getRowHeadersCount();
3679
- };
3680
-
3681
- /**
3682
- * Returns the number of rendered column headers.
3683
- *
3684
- * @since 14.0.0
3685
- * @memberof Core#
3686
- * @function countColHeaders
3687
- * @returns {number} Number of column headers.
3688
- */
3689
- this.countColHeaders = function () {
3690
- return this.view.getColumnHeadersCount();
3691
- };
3692
-
3693
3618
  /**
3694
3619
  * Returns the number of empty rows. If the optional ending parameter is `true`, returns the
3695
3620
  * number of empty rows at the bottom of the table.
@@ -3894,10 +3819,6 @@ export default function Core(rootElement, userSettings) {
3894
3819
  * hot.selectColumns('id');
3895
3820
  * // Select range of columns using visual indexes.
3896
3821
  * hot.selectColumns(1, 4);
3897
- * // Select range of columns using visual indexes and mark the first header as highlighted.
3898
- * hot.selectColumns(1, 2, -1);
3899
- * // Select range of columns using visual indexes and mark the second cell as highlighted.
3900
- * hot.selectColumns(2, 1, 1);
3901
3822
  * // Select range of columns using column properties.
3902
3823
  * hot.selectColumns('id', 'last_name');
3903
3824
  * ```
@@ -3908,15 +3829,11 @@ export default function Core(rootElement, userSettings) {
3908
3829
  * @param {number} startColumn The visual column index from which the selection starts.
3909
3830
  * @param {number} [endColumn=startColumn] The visual column index to which the selection finishes. If `endColumn`
3910
3831
  * is not defined the column defined by `startColumn` will be selected.
3911
- * @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
3912
- * The value can take visual row index from -N to N, where negative values
3913
- * point to the headers and positive values point to the cell range.
3914
3832
  * @returns {boolean} `true` if selection was successful, `false` otherwise.
3915
3833
  */
3916
3834
  this.selectColumns = function (startColumn) {
3917
3835
  let endColumn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startColumn;
3918
- let focusPosition = arguments.length > 2 ? arguments[2] : undefined;
3919
- return selection.selectColumns(startColumn, endColumn, focusPosition);
3836
+ return selection.selectColumns(startColumn, endColumn);
3920
3837
  };
3921
3838
 
3922
3839
  /**
@@ -3926,12 +3843,8 @@ export default function Core(rootElement, userSettings) {
3926
3843
  * ```js
3927
3844
  * // Select row using visual index.
3928
3845
  * hot.selectRows(1);
3929
- * // select a range of rows, using visual indexes.
3846
+ * // Select range of rows using visual indexes.
3930
3847
  * hot.selectRows(1, 4);
3931
- * // select a range of rows, using visual indexes, and mark the header as highlighted.
3932
- * hot.selectRows(1, 2, -1);
3933
- * // Select range of rows using visual indexes and mark the second cell as highlighted.
3934
- * hot.selectRows(2, 1, 1);
3935
3848
  * ```
3936
3849
  *
3937
3850
  * @memberof Core#
@@ -3940,15 +3853,11 @@ export default function Core(rootElement, userSettings) {
3940
3853
  * @param {number} startRow The visual row index from which the selection starts.
3941
3854
  * @param {number} [endRow=startRow] The visual row index to which the selection finishes. If `endRow`
3942
3855
  * is not defined the row defined by `startRow` will be selected.
3943
- * @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
3944
- * The value can take visual column index from -N to N, where negative values
3945
- * point to the headers and positive values point to the cell range.
3946
3856
  * @returns {boolean} `true` if selection was successful, `false` otherwise.
3947
3857
  */
3948
3858
  this.selectRows = function (startRow) {
3949
3859
  let endRow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startRow;
3950
- let focusPosition = arguments.length > 2 ? arguments[2] : undefined;
3951
- return selection.selectRows(startRow, endRow, focusPosition);
3860
+ return selection.selectRows(startRow, endRow);
3952
3861
  };
3953
3862
 
3954
3863
  /**
@@ -3967,16 +3876,9 @@ export default function Core(rootElement, userSettings) {
3967
3876
  * The previous selection is overwritten.
3968
3877
  *
3969
3878
  * ```js
3970
- * // select all cells in the table, including all headers and the corner cell
3879
+ * // select all cells in the table, including all headers
3971
3880
  * hot.selectAll();
3972
3881
  *
3973
- * // select all cells in the table, including row headers but excluding the corner cell
3974
- * hot.selectAll(true, false);
3975
- *
3976
- * // select all cells in the table, including all headers and the corner cell, but move the focus
3977
- * // highlight to position -2, -1
3978
- * hot.selectAll(-2, -1);
3979
- *
3980
3882
  * // select all cells in the table, without headers
3981
3883
  * hot.selectAll(false);
3982
3884
  * ```
@@ -3984,20 +3886,15 @@ export default function Core(rootElement, userSettings) {
3984
3886
  * @since 0.38.2
3985
3887
  * @memberof Core#
3986
3888
  * @function selectAll
3987
- * @param {boolean} [includeRowHeaders=false] `true` If the selection should include the row headers,
3988
- * `false` otherwise.
3989
- * @param {boolean} [includeColumnHeaders=false] `true` If the selection should include the column
3990
- * headers, `false` otherwise.
3991
- * @param {{row: number, col: number}} [focusPosition] The argument allows changing the cell/header
3992
- * focus position. The value takes an object with a `row` and `col` properties (visual indexes)
3993
- * from -N to N, where negative values point to the headers and positive values point to the cell range.
3889
+ * @param {boolean} [includeHeaders=true] `true`: include all row, column and corner headers.
3890
+ * `false`: don't include any headers.
3994
3891
  */
3995
3892
  this.selectAll = function () {
3996
- let includeRowHeaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
3997
- let includeColumnHeaders = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : includeRowHeaders;
3998
- let focusPosition = arguments.length > 2 ? arguments[2] : undefined;
3893
+ let includeHeaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
3894
+ const includeRowHeaders = includeHeaders && this.hasRowHeaders();
3895
+ const includeColumnHeaders = includeHeaders && this.hasColHeaders();
3999
3896
  preventScrollingToCell = true;
4000
- selection.selectAll(includeRowHeaders, includeColumnHeaders, focusPosition);
3897
+ selection.selectAll(includeRowHeaders, includeColumnHeaders);
4001
3898
  preventScrollingToCell = false;
4002
3899
  };
4003
3900
  const getIndexToScroll = (indexMapper, visualIndex) => {
@@ -4055,34 +3952,6 @@ export default function Core(rootElement, userSettings) {
4055
3952
  return false;
4056
3953
  };
4057
3954
 
4058
- /**
4059
- * Scrolls the viewport to coordinates specified by the currently focused cell.
4060
- *
4061
- * @since 14.0.0
4062
- * @memberof Core#
4063
- * @function scrollToFocusedCell
4064
- * @param {Function} callback The callback function to call after the viewport is scrolled.
4065
- */
4066
- this.scrollToFocusedCell = function () {
4067
- let callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : () => {};
4068
- if (!this.selection.isSelected()) {
4069
- return;
4070
- }
4071
- this.addHookOnce('afterScroll', callback);
4072
- const {
4073
- highlight
4074
- } = this.getSelectedRangeLast();
4075
- const renderableRowIndex = this.rowIndexMapper.getRenderableFromVisualIndex(highlight.row);
4076
- const renderableColumnIndex = this.columnIndexMapper.getRenderableFromVisualIndex(highlight.col);
4077
- const isScrolled = this.view.scrollViewport(this._createCellCoords(renderableRowIndex, renderableColumnIndex));
4078
- if (isScrolled) {
4079
- this.view.render();
4080
- } else {
4081
- this.removeHook('afterScroll', callback);
4082
- this._registerImmediate(() => callback());
4083
- }
4084
- };
4085
-
4086
3955
  /**
4087
3956
  * Removes the table from the DOM and destroys the instance of the Handsontable.
4088
3957
  *
@@ -4103,7 +3972,6 @@ export default function Core(rootElement, userSettings) {
4103
3972
  dataSource = null;
4104
3973
  this.getShortcutManager().destroy();
4105
3974
  metaManager.clearCache();
4106
- foreignHotInstances.delete(this.guid);
4107
3975
  if (isRootInstance(instance)) {
4108
3976
  const licenseInfo = this.rootDocument.querySelector('.hot-display-license-info');
4109
3977
  if (licenseInfo) {
@@ -4427,16 +4295,6 @@ export default function Core(rootElement, userSettings) {
4427
4295
  }
4428
4296
  };
4429
4297
 
4430
- /**
4431
- * Gets the instance of the EditorManager.
4432
- *
4433
- * @private
4434
- * @returns {EditorManager}
4435
- */
4436
- this._getEditorManager = function () {
4437
- return editorManager;
4438
- };
4439
-
4440
4298
  /**
4441
4299
  * Check if currently it is RTL direction.
4442
4300
  *
@@ -4509,11 +4367,270 @@ export default function Core(rootElement, userSettings) {
4509
4367
  this.getShortcutManager = function () {
4510
4368
  return shortcutManager;
4511
4369
  };
4370
+ const gridContext = shortcutManager.addContext('grid');
4371
+ const gridConfig = {
4372
+ runOnlyIf: () => {
4373
+ return isDefined(instance.getSelected()) && instance.countRenderedRows() > 0 && instance.countRenderedCols() > 0;
4374
+ },
4375
+ group: SHORTCUTS_GROUP
4376
+ };
4377
+ shortcutManager.setActiveContextName('grid');
4378
+ gridContext.addShortcuts([{
4379
+ keys: [['Control/Meta', 'A']],
4380
+ callback: () => {
4381
+ instance.selectAll();
4382
+ }
4383
+ }, {
4384
+ keys: [['Control/Meta', 'Enter']],
4385
+ callback: () => {
4386
+ const selectedRange = instance.getSelectedRange();
4387
+ const {
4388
+ row: highlightRow,
4389
+ col: highlightColumn
4390
+ } = selectedRange[selectedRange.length - 1].highlight;
4391
+ const valueToPopulate = instance.getDataAtCell(highlightRow, highlightColumn);
4392
+ const cellValues = new Map();
4393
+ for (let i = 0; i < selectedRange.length; i++) {
4394
+ selectedRange[i].forAll((row, column) => {
4395
+ if (row >= 0 && column >= 0 && (row !== highlightRow || column !== highlightColumn)) {
4396
+ const {
4397
+ readOnly
4398
+ } = instance.getCellMeta(row, column);
4399
+ if (!readOnly) {
4400
+ cellValues.set(`${row}x${column}`, [row, column, valueToPopulate]);
4401
+ }
4402
+ }
4403
+ });
4404
+ }
4405
+ instance.setDataAtCell(Array.from(cellValues.values()));
4406
+ },
4407
+ runOnlyIf: () => instance.getSelectedRangeLast().getCellsCount() > 1
4408
+ }, {
4409
+ keys: [['ArrowUp']],
4410
+ callback: () => {
4411
+ selection.transformStart(-1, 0);
4412
+ }
4413
+ }, {
4414
+ keys: [['ArrowUp', 'Control/Meta']],
4415
+ captureCtrl: true,
4416
+ callback: () => {
4417
+ selection.setRangeStart(instance._createCellCoords(instance.rowIndexMapper.getNearestNotHiddenIndex(0, 1), instance.getSelectedRangeLast().highlight.col));
4418
+ }
4419
+ }, {
4420
+ keys: [['ArrowUp', 'Shift']],
4421
+ callback: () => {
4422
+ selection.transformEnd(-1, 0);
4423
+ }
4424
+ }, {
4425
+ keys: [['ArrowUp', 'Shift', 'Control/Meta']],
4426
+ captureCtrl: true,
4427
+ callback: () => {
4428
+ const {
4429
+ from,
4430
+ to
4431
+ } = instance.getSelectedRangeLast();
4432
+ const row = instance.rowIndexMapper.getNearestNotHiddenIndex(0, 1);
4433
+ selection.setRangeStart(from.clone());
4434
+ selection.setRangeEnd(instance._createCellCoords(row, to.col));
4435
+ },
4436
+ runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByColumnHeader())
4437
+ }, {
4438
+ keys: [['ArrowDown']],
4439
+ callback: () => {
4440
+ selection.transformStart(1, 0);
4441
+ }
4442
+ }, {
4443
+ keys: [['ArrowDown', 'Control/Meta']],
4444
+ captureCtrl: true,
4445
+ callback: () => {
4446
+ selection.setRangeStart(instance._createCellCoords(instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - 1, -1), instance.getSelectedRangeLast().highlight.col));
4447
+ }
4448
+ }, {
4449
+ keys: [['ArrowDown', 'Shift']],
4450
+ callback: () => {
4451
+ selection.transformEnd(1, 0);
4452
+ }
4453
+ }, {
4454
+ keys: [['ArrowDown', 'Shift', 'Control/Meta']],
4455
+ captureCtrl: true,
4456
+ callback: () => {
4457
+ const {
4458
+ from,
4459
+ to
4460
+ } = instance.getSelectedRangeLast();
4461
+ const row = instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - 1, -1);
4462
+ selection.setRangeStart(from.clone());
4463
+ selection.setRangeEnd(instance._createCellCoords(row, to.col));
4464
+ },
4465
+ runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByColumnHeader())
4466
+ }, {
4467
+ keys: [['ArrowLeft']],
4468
+ callback: () => {
4469
+ selection.transformStart(0, -1 * instance.getDirectionFactor());
4470
+ }
4471
+ }, {
4472
+ keys: [['ArrowLeft', 'Control/Meta']],
4473
+ captureCtrl: true,
4474
+ callback: () => {
4475
+ const row = instance.getSelectedRangeLast().highlight.row;
4476
+ const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
4477
+ selection.setRangeStart(instance._createCellCoords(row, column));
4478
+ }
4479
+ }, {
4480
+ keys: [['ArrowLeft', 'Shift']],
4481
+ callback: () => {
4482
+ selection.transformEnd(0, -1 * instance.getDirectionFactor());
4483
+ }
4484
+ }, {
4485
+ keys: [['ArrowLeft', 'Shift', 'Control/Meta']],
4486
+ captureCtrl: true,
4487
+ callback: () => {
4488
+ const {
4489
+ from,
4490
+ to
4491
+ } = instance.getSelectedRangeLast();
4492
+ const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
4493
+ selection.setRangeStart(from.clone());
4494
+ selection.setRangeEnd(instance._createCellCoords(to.row, column));
4495
+ },
4496
+ runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByRowHeader())
4497
+ }, {
4498
+ keys: [['ArrowRight']],
4499
+ callback: () => {
4500
+ selection.transformStart(0, instance.getDirectionFactor());
4501
+ }
4502
+ }, {
4503
+ keys: [['ArrowRight', 'Control/Meta']],
4504
+ captureCtrl: true,
4505
+ callback: () => {
4506
+ const row = instance.getSelectedRangeLast().highlight.row;
4507
+ const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
4508
+ selection.setRangeStart(instance._createCellCoords(row, column));
4509
+ }
4510
+ }, {
4511
+ keys: [['ArrowRight', 'Shift']],
4512
+ callback: () => {
4513
+ selection.transformEnd(0, instance.getDirectionFactor());
4514
+ }
4515
+ }, {
4516
+ keys: [['ArrowRight', 'Shift', 'Control/Meta']],
4517
+ captureCtrl: true,
4518
+ callback: () => {
4519
+ const {
4520
+ from,
4521
+ to
4522
+ } = instance.getSelectedRangeLast();
4523
+ const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
4524
+ selection.setRangeStart(from.clone());
4525
+ selection.setRangeEnd(instance._createCellCoords(to.row, column));
4526
+ },
4527
+ runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByRowHeader())
4528
+ }, {
4529
+ keys: [['Home']],
4530
+ captureCtrl: true,
4531
+ callback: () => {
4532
+ const fixedColumns = parseInt(instance.getSettings().fixedColumnsStart, 10);
4533
+ const row = instance.getSelectedRangeLast().highlight.row;
4534
+ const column = instance.columnIndexMapper.getNearestNotHiddenIndex(fixedColumns, 1);
4535
+ selection.setRangeStart(instance._createCellCoords(row, column));
4536
+ },
4537
+ runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
4538
+ }, {
4539
+ keys: [['Home', 'Shift']],
4540
+ callback: () => {
4541
+ selection.setRangeEnd(instance._createCellCoords(selection.selectedRange.current().from.row, instance.columnIndexMapper.getNearestNotHiddenIndex(0, 1)));
4542
+ }
4543
+ }, {
4544
+ keys: [['Home', 'Control/Meta']],
4545
+ captureCtrl: true,
4546
+ callback: () => {
4547
+ const fixedRows = parseInt(instance.getSettings().fixedRowsTop, 10);
4548
+ const fixedColumns = parseInt(instance.getSettings().fixedColumnsStart, 10);
4549
+ const row = instance.rowIndexMapper.getNearestNotHiddenIndex(fixedRows, 1);
4550
+ const column = instance.columnIndexMapper.getNearestNotHiddenIndex(fixedColumns, 1);
4551
+ selection.setRangeStart(instance._createCellCoords(row, column));
4552
+ },
4553
+ runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
4554
+ }, {
4555
+ keys: [['End']],
4556
+ captureCtrl: true,
4557
+ callback: () => {
4558
+ selection.setRangeStart(instance._createCellCoords(instance.getSelectedRangeLast().highlight.row, instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1)));
4559
+ },
4560
+ runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
4561
+ }, {
4562
+ keys: [['End', 'Shift']],
4563
+ callback: () => {
4564
+ selection.setRangeEnd(instance._createCellCoords(selection.selectedRange.current().from.row, instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1)));
4565
+ }
4566
+ }, {
4567
+ keys: [['End', 'Control/Meta']],
4568
+ captureCtrl: true,
4569
+ callback: () => {
4570
+ const fixedRows = parseInt(instance.getSettings().fixedRowsBottom, 10);
4571
+ const row = instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - fixedRows - 1, -1);
4572
+ const column = instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1);
4573
+ selection.setRangeStart(instance._createCellCoords(row, column));
4574
+ },
4575
+ runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
4576
+ }, {
4577
+ keys: [['PageUp']],
4578
+ callback: () => {
4579
+ selection.transformStart(-instance.countVisibleRows(), 0);
4580
+ }
4581
+ }, {
4582
+ keys: [['PageUp', 'Shift']],
4583
+ callback: () => {
4584
+ const {
4585
+ to
4586
+ } = instance.getSelectedRangeLast();
4587
+ const nextRowIndexToSelect = Math.max(to.row - instance.countVisibleRows(), 0);
4588
+ const row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, 1);
4589
+ if (row !== null) {
4590
+ const coords = instance._createCellCoords(row, to.col);
4591
+ const scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
4592
+ const nextVerticalScroll = Math.max(coords.row - scrollPadding, 0);
4593
+ selection.setRangeEnd(coords);
4594
+ instance.scrollViewportTo(nextVerticalScroll);
4595
+ }
4596
+ }
4597
+ }, {
4598
+ keys: [['PageDown']],
4599
+ callback: () => {
4600
+ selection.transformStart(instance.countVisibleRows(), 0);
4601
+ }
4602
+ }, {
4603
+ keys: [['PageDown', 'Shift']],
4604
+ callback: () => {
4605
+ const {
4606
+ to
4607
+ } = instance.getSelectedRangeLast();
4608
+ const nextRowIndexToSelect = Math.min(to.row + instance.countVisibleRows(), instance.countRows() - 1);
4609
+ const row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, -1);
4610
+ if (row !== null) {
4611
+ const coords = instance._createCellCoords(row, to.col);
4612
+ const scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
4613
+ const nextVerticalScroll = Math.min(coords.row - scrollPadding, instance.countRows() - 1);
4614
+ selection.setRangeEnd(coords);
4615
+ instance.scrollViewportTo(nextVerticalScroll);
4616
+ }
4617
+ }
4618
+ }, {
4619
+ keys: [['Tab']],
4620
+ callback: event => {
4621
+ const tabMoves = typeof tableMeta.tabMoves === 'function' ? tableMeta.tabMoves(event) : tableMeta.tabMoves;
4622
+ selection.transformStart(tabMoves.row, tabMoves.col, true);
4623
+ }
4624
+ }, {
4625
+ keys: [['Shift', 'Tab']],
4626
+ callback: event => {
4627
+ const tabMoves = typeof tableMeta.tabMoves === 'function' ? tableMeta.tabMoves(event) : tableMeta.tabMoves;
4628
+ selection.transformStart(-tabMoves.row, -tabMoves.col);
4629
+ }
4630
+ }], gridConfig);
4512
4631
  getPluginsNames().forEach(pluginName => {
4513
4632
  const PluginClass = getPlugin(pluginName);
4514
4633
  pluginsRegistry.addItem(pluginName, new PluginClass(this));
4515
4634
  });
4516
- registerAllShortcutContexts(instance);
4517
- shortcutManager.setActiveContextName('grid');
4518
4635
  Hooks.getSingleton().run(instance, 'construct');
4519
4636
  }