handsontable 0.0.0-next-010265d-20231005 → 0.0.0-next-9379dd1-20231020

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 (414) 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 +12 -10
  14. package/3rdparty/walkontable/src/event.mjs +12 -10
  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 +13 -2
  20. package/3rdparty/walkontable/src/overlay/_base.mjs +14 -3
  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/renderer/cells.js +10 -0
  26. package/3rdparty/walkontable/src/renderer/cells.mjs +11 -1
  27. package/3rdparty/walkontable/src/renderer/columnHeaders.js +10 -0
  28. package/3rdparty/walkontable/src/renderer/columnHeaders.mjs +11 -1
  29. package/3rdparty/walkontable/src/renderer/rowHeaders.js +5 -0
  30. package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +5 -0
  31. package/3rdparty/walkontable/src/renderer/rows.js +13 -0
  32. package/3rdparty/walkontable/src/renderer/rows.mjs +13 -0
  33. package/3rdparty/walkontable/src/renderer/table.js +9 -0
  34. package/3rdparty/walkontable/src/renderer/table.mjs +9 -0
  35. package/3rdparty/walkontable/src/scroll.js +2 -0
  36. package/3rdparty/walkontable/src/scroll.mjs +2 -0
  37. package/3rdparty/walkontable/src/{border.js → selection/border/border.js} +7 -12
  38. package/3rdparty/walkontable/src/{border.mjs → selection/border/border.mjs} +7 -12
  39. package/3rdparty/walkontable/src/selection/border/constants.js +16 -0
  40. package/3rdparty/walkontable/src/selection/border/constants.mjs +12 -0
  41. package/3rdparty/walkontable/src/selection/constants.js +62 -0
  42. package/3rdparty/walkontable/src/selection/constants.mjs +51 -0
  43. package/3rdparty/walkontable/src/selection/index.js +26 -0
  44. package/3rdparty/walkontable/src/selection/index.mjs +5 -0
  45. package/3rdparty/walkontable/src/selection/manager.js +274 -0
  46. package/3rdparty/walkontable/src/selection/manager.mjs +269 -0
  47. package/3rdparty/walkontable/src/selection/scanner.js +270 -0
  48. package/3rdparty/walkontable/src/selection/scanner.mjs +267 -0
  49. package/3rdparty/walkontable/src/selection/selection.js +101 -0
  50. package/3rdparty/walkontable/src/selection/selection.mjs +96 -0
  51. package/3rdparty/walkontable/src/settings.js +13 -4
  52. package/3rdparty/walkontable/src/settings.mjs +13 -4
  53. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +9 -0
  54. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +9 -0
  55. package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +9 -0
  56. package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +9 -0
  57. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +9 -0
  58. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +9 -0
  59. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +9 -0
  60. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +9 -0
  61. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +9 -0
  62. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +9 -0
  63. package/3rdparty/walkontable/src/table.js +19 -78
  64. package/3rdparty/walkontable/src/table.mjs +20 -79
  65. package/base.js +2 -2
  66. package/base.mjs +2 -2
  67. package/cellTypes/dateType/dateType.d.ts +3 -3
  68. package/cellTypes/dateType/dateType.js +2 -2
  69. package/cellTypes/dateType/dateType.mjs +2 -2
  70. package/cellTypes/handsontableType/handsontableType.d.ts +3 -3
  71. package/cellTypes/handsontableType/handsontableType.js +2 -2
  72. package/cellTypes/handsontableType/handsontableType.mjs +2 -2
  73. package/cellTypes/index.d.ts +3 -0
  74. package/cellTypes/index.js +4 -0
  75. package/cellTypes/index.mjs +3 -1
  76. package/cellTypes/selectType/index.d.ts +1 -0
  77. package/cellTypes/selectType/index.js +6 -0
  78. package/cellTypes/selectType/index.mjs +1 -0
  79. package/cellTypes/selectType/selectType.d.ts +14 -0
  80. package/cellTypes/selectType/selectType.js +13 -0
  81. package/cellTypes/selectType/selectType.mjs +8 -0
  82. package/core/focusCatcher/focusDetector.js +63 -0
  83. package/core/focusCatcher/focusDetector.mjs +59 -0
  84. package/core/focusCatcher/index.js +142 -0
  85. package/core/focusCatcher/index.mjs +138 -0
  86. package/core/index.js +9 -0
  87. package/core/index.mjs +1 -0
  88. package/core.d.ts +9 -4
  89. package/core.js +285 -327
  90. package/core.mjs +285 -327
  91. package/dataMap/metaManager/metaSchema.js +65 -0
  92. package/dataMap/metaManager/metaSchema.mjs +65 -0
  93. package/dataMap/metaManager/mods/extendMetaProperties.js +7 -1
  94. package/dataMap/metaManager/mods/extendMetaProperties.mjs +7 -1
  95. package/dataMap/replaceData.js +5 -0
  96. package/dataMap/replaceData.mjs +5 -0
  97. package/dist/handsontable.css +40 -5
  98. package/dist/handsontable.full.css +40 -5
  99. package/dist/handsontable.full.js +11744 -6945
  100. package/dist/handsontable.full.min.css +4 -4
  101. package/dist/handsontable.full.min.js +141 -141
  102. package/dist/handsontable.js +14036 -9237
  103. package/dist/handsontable.min.css +3 -3
  104. package/dist/handsontable.min.js +21 -21
  105. package/dist/languages/all.js +6 -2
  106. package/dist/languages/all.min.js +1 -1
  107. package/dist/languages/en-US.js +3 -1
  108. package/dist/languages/en-US.min.js +1 -1
  109. package/dist/languages/pl-PL.js +3 -1
  110. package/dist/languages/pl-PL.min.js +1 -1
  111. package/editorManager.js +15 -87
  112. package/editorManager.mjs +16 -87
  113. package/editors/autocompleteEditor/autocompleteEditor.js +53 -2
  114. package/editors/autocompleteEditor/autocompleteEditor.mjs +54 -3
  115. package/editors/dateEditor/dateEditor.js +26 -7
  116. package/editors/dateEditor/dateEditor.mjs +27 -8
  117. package/editors/handsontableEditor/handsontableEditor.js +9 -1
  118. package/editors/handsontableEditor/handsontableEditor.mjs +10 -2
  119. package/editors/textEditor/textEditor.js +19 -27
  120. package/editors/textEditor/textEditor.mjs +22 -30
  121. package/focusManager.d.ts +12 -0
  122. package/focusManager.js +265 -0
  123. package/focusManager.mjs +261 -0
  124. package/helpers/a11y.js +79 -0
  125. package/helpers/a11y.mjs +38 -0
  126. package/helpers/dom/element.js +188 -9
  127. package/helpers/dom/element.mjs +182 -9
  128. package/helpers/mixed.js +1 -1
  129. package/helpers/mixed.mjs +1 -1
  130. package/helpers/number.d.ts +1 -0
  131. package/helpers/number.js +18 -0
  132. package/helpers/number.mjs +17 -0
  133. package/i18n/constants.js +7 -1
  134. package/i18n/constants.mjs +4 -1
  135. package/i18n/languages/en-US.js +3 -1
  136. package/i18n/languages/en-US.mjs +3 -1
  137. package/i18n/languages/pl-PL.js +3 -1
  138. package/i18n/languages/pl-PL.mjs +3 -1
  139. package/languages/all.js +6 -2
  140. package/languages/en-US.js +3 -1
  141. package/languages/en-US.mjs +3 -1
  142. package/languages/index.js +6 -2
  143. package/languages/pl-PL.js +3 -1
  144. package/languages/pl-PL.mjs +3 -1
  145. package/package.json +21 -1
  146. package/pluginHooks.d.ts +12 -1
  147. package/pluginHooks.js +152 -1
  148. package/pluginHooks.mjs +152 -1
  149. package/plugins/collapsibleColumns/collapsibleColumns.js +74 -4
  150. package/plugins/collapsibleColumns/collapsibleColumns.mjs +75 -5
  151. package/plugins/columnSorting/columnSorting.js +43 -0
  152. package/plugins/columnSorting/columnSorting.mjs +44 -3
  153. package/plugins/columnSorting/index.js +3 -1
  154. package/plugins/columnSorting/index.mjs +1 -1
  155. package/plugins/comments/commentEditor.js +1 -0
  156. package/plugins/comments/commentEditor.mjs +1 -0
  157. package/plugins/comments/comments.js +252 -189
  158. package/plugins/comments/comments.mjs +251 -190
  159. package/plugins/comments/contextMenuItem/addEditComment.js +41 -0
  160. package/plugins/comments/contextMenuItem/addEditComment.mjs +35 -0
  161. package/plugins/comments/contextMenuItem/readOnlyComment.js +49 -0
  162. package/plugins/comments/contextMenuItem/readOnlyComment.mjs +43 -0
  163. package/plugins/comments/contextMenuItem/removeComment.js +38 -0
  164. package/plugins/comments/contextMenuItem/removeComment.mjs +32 -0
  165. package/plugins/contextMenu/commandExecutor.js +2 -3
  166. package/plugins/contextMenu/commandExecutor.mjs +2 -3
  167. package/plugins/contextMenu/contextMenu.d.ts +1 -1
  168. package/plugins/contextMenu/contextMenu.js +75 -36
  169. package/plugins/contextMenu/contextMenu.mjs +74 -35
  170. package/plugins/contextMenu/itemsFactory.js +2 -3
  171. package/plugins/contextMenu/itemsFactory.mjs +3 -4
  172. package/plugins/contextMenu/{cursor.mjs → menu/cursor.js} +6 -4
  173. package/plugins/contextMenu/{cursor.js → menu/cursor.mjs} +4 -10
  174. package/plugins/contextMenu/menu/index.js +9 -0
  175. package/plugins/contextMenu/menu/index.mjs +1 -0
  176. package/plugins/contextMenu/{menu.js → menu/menu.js} +96 -308
  177. package/plugins/contextMenu/{menu.mjs → menu/menu.mjs} +97 -309
  178. package/plugins/contextMenu/menu/navigator.js +152 -0
  179. package/plugins/contextMenu/menu/navigator.mjs +148 -0
  180. package/plugins/contextMenu/menu/positioner.js +213 -0
  181. package/plugins/contextMenu/menu/positioner.mjs +209 -0
  182. package/plugins/contextMenu/menu/utils.js +177 -0
  183. package/plugins/contextMenu/menu/utils.mjs +163 -0
  184. package/plugins/contextMenu/predefinedItems/alignment.js +7 -0
  185. package/plugins/contextMenu/predefinedItems/alignment.mjs +7 -0
  186. package/plugins/contextMenu/predefinedItems/clearColumn.js +5 -3
  187. package/plugins/contextMenu/predefinedItems/clearColumn.mjs +5 -3
  188. package/plugins/contextMenu/predefinedItems/columnLeft.js +5 -3
  189. package/plugins/contextMenu/predefinedItems/columnLeft.mjs +5 -3
  190. package/plugins/contextMenu/predefinedItems/columnRight.js +5 -3
  191. package/plugins/contextMenu/predefinedItems/columnRight.mjs +5 -3
  192. package/plugins/contextMenu/{predefinedItems.js → predefinedItems/index.js} +14 -14
  193. package/plugins/contextMenu/predefinedItems/index.mjs +68 -0
  194. package/plugins/contextMenu/predefinedItems/readOnly.js +7 -0
  195. package/plugins/contextMenu/predefinedItems/readOnly.mjs +7 -0
  196. package/plugins/contextMenu/predefinedItems/removeColumn.js +7 -5
  197. package/plugins/contextMenu/predefinedItems/removeColumn.mjs +5 -3
  198. package/plugins/contextMenu/predefinedItems/removeRow.js +7 -5
  199. package/plugins/contextMenu/predefinedItems/removeRow.mjs +5 -3
  200. package/plugins/contextMenu/predefinedItems/rowAbove.js +5 -3
  201. package/plugins/contextMenu/predefinedItems/rowAbove.mjs +5 -3
  202. package/plugins/contextMenu/predefinedItems/rowBelow.js +5 -3
  203. package/plugins/contextMenu/predefinedItems/rowBelow.mjs +5 -3
  204. package/plugins/contextMenu/utils.js +35 -151
  205. package/plugins/contextMenu/utils.mjs +35 -144
  206. package/plugins/copyPaste/contextMenuItem/copy.js +7 -0
  207. package/plugins/copyPaste/contextMenuItem/copy.mjs +7 -0
  208. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.js +9 -1
  209. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs +9 -1
  210. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.js +9 -1
  211. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs +9 -1
  212. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.js +9 -1
  213. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs +9 -1
  214. package/plugins/copyPaste/contextMenuItem/cut.js +7 -0
  215. package/plugins/copyPaste/contextMenuItem/cut.mjs +7 -0
  216. package/plugins/copyPaste/copyPaste.js +127 -78
  217. package/plugins/copyPaste/copyPaste.mjs +128 -79
  218. package/plugins/customBorders/customBorders.js +23 -20
  219. package/plugins/customBorders/customBorders.mjs +24 -21
  220. package/plugins/dropdownMenu/dropdownMenu.d.ts +1 -1
  221. package/plugins/dropdownMenu/dropdownMenu.js +97 -38
  222. package/plugins/dropdownMenu/dropdownMenu.mjs +96 -37
  223. package/plugins/filters/constants.mjs +1 -1
  224. package/plugins/filters/filters.js +31 -14
  225. package/plugins/filters/filters.mjs +31 -14
  226. package/plugins/filters/ui/select.js +3 -3
  227. package/plugins/filters/ui/select.mjs +2 -2
  228. package/plugins/hiddenColumns/hiddenColumns.mjs +1 -1
  229. package/plugins/hiddenRows/hiddenRows.mjs +1 -1
  230. package/plugins/manualColumnMove/manualColumnMove.js +3 -1
  231. package/plugins/manualColumnMove/manualColumnMove.mjs +3 -1
  232. package/plugins/mergeCells/mergeCells.js +5 -16
  233. package/plugins/mergeCells/mergeCells.mjs +5 -16
  234. package/plugins/multiColumnSorting/multiColumnSorting.js +37 -2
  235. package/plugins/multiColumnSorting/multiColumnSorting.mjs +37 -2
  236. package/plugins/nestedHeaders/nestedHeaders.js +240 -10
  237. package/plugins/nestedHeaders/nestedHeaders.mjs +241 -11
  238. package/plugins/nestedHeaders/stateManager/index.js +102 -3
  239. package/plugins/nestedHeaders/stateManager/index.mjs +102 -3
  240. package/plugins/nestedRows/nestedRows.js +41 -0
  241. package/plugins/nestedRows/nestedRows.mjs +41 -0
  242. package/plugins/nestedRows/ui/headers.js +11 -0
  243. package/plugins/nestedRows/ui/headers.mjs +12 -1
  244. package/renderers/autocompleteRenderer/autocompleteRenderer.js +8 -0
  245. package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +8 -0
  246. package/renderers/baseRenderer/baseRenderer.js +17 -0
  247. package/renderers/baseRenderer/baseRenderer.mjs +18 -1
  248. package/renderers/checkboxRenderer/checkboxRenderer.js +9 -4
  249. package/renderers/checkboxRenderer/checkboxRenderer.mjs +9 -4
  250. package/renderers/dateRenderer/dateRenderer.d.ts +5 -0
  251. package/renderers/dateRenderer/dateRenderer.js +29 -0
  252. package/renderers/dateRenderer/dateRenderer.mjs +24 -0
  253. package/renderers/dateRenderer/index.d.ts +1 -0
  254. package/renderers/dateRenderer/index.js +6 -0
  255. package/renderers/dateRenderer/index.mjs +1 -0
  256. package/renderers/handsontableRenderer/handsontableRenderer.d.ts +5 -0
  257. package/renderers/handsontableRenderer/handsontableRenderer.js +29 -0
  258. package/renderers/handsontableRenderer/handsontableRenderer.mjs +24 -0
  259. package/renderers/handsontableRenderer/index.d.ts +1 -0
  260. package/renderers/handsontableRenderer/index.js +6 -0
  261. package/renderers/handsontableRenderer/index.mjs +1 -0
  262. package/renderers/index.d.ts +9 -0
  263. package/renderers/selectRenderer/index.d.ts +1 -0
  264. package/renderers/selectRenderer/index.js +6 -0
  265. package/renderers/selectRenderer/index.mjs +1 -0
  266. package/renderers/selectRenderer/selectRenderer.d.ts +5 -0
  267. package/renderers/selectRenderer/selectRenderer.js +27 -0
  268. package/renderers/selectRenderer/selectRenderer.mjs +22 -0
  269. package/selection/highlight/highlight.js +256 -71
  270. package/selection/highlight/highlight.mjs +250 -71
  271. package/selection/highlight/types/activeHeader.js +10 -8
  272. package/selection/highlight/types/activeHeader.mjs +10 -8
  273. package/selection/highlight/types/area.js +6 -18
  274. package/selection/highlight/types/area.mjs +6 -18
  275. package/selection/highlight/types/areaLayered.js +31 -0
  276. package/selection/highlight/types/areaLayered.mjs +26 -0
  277. package/selection/highlight/types/column.js +27 -0
  278. package/selection/highlight/types/column.mjs +22 -0
  279. package/selection/highlight/types/customSelection.js +7 -9
  280. package/selection/highlight/types/customSelection.mjs +7 -9
  281. package/selection/highlight/types/fill.js +5 -7
  282. package/selection/highlight/types/fill.mjs +5 -7
  283. package/selection/highlight/types/{cell.js → focus.js} +5 -7
  284. package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
  285. package/selection/highlight/types/header.js +9 -18
  286. package/selection/highlight/types/header.mjs +9 -18
  287. package/selection/highlight/types/row.js +27 -0
  288. package/selection/highlight/types/row.mjs +22 -0
  289. package/selection/highlight/visualSelection.js +31 -27
  290. package/selection/highlight/visualSelection.mjs +31 -27
  291. package/selection/index.js +4 -7
  292. package/selection/index.mjs +2 -3
  293. package/selection/mouseEventHandler.js +7 -1
  294. package/selection/mouseEventHandler.mjs +7 -1
  295. package/selection/range.js +8 -8
  296. package/selection/range.mjs +8 -8
  297. package/selection/selection.js +321 -152
  298. package/selection/selection.mjs +318 -151
  299. package/selection/transformation.js +232 -90
  300. package/selection/transformation.mjs +232 -90
  301. package/selection/utils.js +15 -21
  302. package/selection/utils.mjs +16 -21
  303. package/settings.d.ts +4 -0
  304. package/shortcutContexts/commands/editor/closeAndSave.js +12 -0
  305. package/shortcutContexts/commands/editor/closeAndSave.mjs +8 -0
  306. package/shortcutContexts/commands/editor/closeWithoutSaving.js +12 -0
  307. package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +8 -0
  308. package/shortcutContexts/commands/editor/fastOpen.js +16 -0
  309. package/shortcutContexts/commands/editor/fastOpen.mjs +12 -0
  310. package/shortcutContexts/commands/editor/index.js +16 -0
  311. package/shortcutContexts/commands/editor/index.mjs +12 -0
  312. package/shortcutContexts/commands/editor/open.js +27 -0
  313. package/shortcutContexts/commands/editor/open.mjs +23 -0
  314. package/shortcutContexts/commands/emptySelectedCells.js +11 -0
  315. package/shortcutContexts/commands/emptySelectedCells.mjs +7 -0
  316. package/shortcutContexts/commands/extendCellsSelection/down.js +15 -0
  317. package/shortcutContexts/commands/extendCellsSelection/down.mjs +11 -0
  318. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +25 -0
  319. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +21 -0
  320. package/shortcutContexts/commands/extendCellsSelection/index.js +26 -0
  321. package/shortcutContexts/commands/extendCellsSelection/index.mjs +22 -0
  322. package/shortcutContexts/commands/extendCellsSelection/left.js +15 -0
  323. package/shortcutContexts/commands/extendCellsSelection/left.mjs +11 -0
  324. package/shortcutContexts/commands/extendCellsSelection/right.js +15 -0
  325. package/shortcutContexts/commands/extendCellsSelection/right.mjs +11 -0
  326. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +19 -0
  327. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +15 -0
  328. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +29 -0
  329. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +25 -0
  330. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +19 -0
  331. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +15 -0
  332. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +19 -0
  333. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +15 -0
  334. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +29 -0
  335. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +25 -0
  336. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +29 -0
  337. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +25 -0
  338. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +29 -0
  339. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +25 -0
  340. package/shortcutContexts/commands/extendCellsSelection/toRows.js +19 -0
  341. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +15 -0
  342. package/shortcutContexts/commands/extendCellsSelection/up.js +15 -0
  343. package/shortcutContexts/commands/extendCellsSelection/up.mjs +11 -0
  344. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +25 -0
  345. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +21 -0
  346. package/shortcutContexts/commands/index.js +35 -0
  347. package/shortcutContexts/commands/index.mjs +31 -0
  348. package/shortcutContexts/commands/moveCellSelection/down.js +13 -0
  349. package/shortcutContexts/commands/moveCellSelection/down.mjs +9 -0
  350. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +33 -0
  351. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +29 -0
  352. package/shortcutContexts/commands/moveCellSelection/index.js +28 -0
  353. package/shortcutContexts/commands/moveCellSelection/index.mjs +24 -0
  354. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +12 -0
  355. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -0
  356. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +12 -0
  357. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -0
  358. package/shortcutContexts/commands/moveCellSelection/left.js +10 -0
  359. package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -0
  360. package/shortcutContexts/commands/moveCellSelection/right.js +10 -0
  361. package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -0
  362. package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +17 -0
  363. package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +13 -0
  364. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +18 -0
  365. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +14 -0
  366. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +14 -0
  367. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +10 -0
  368. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +17 -0
  369. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +13 -0
  370. package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +19 -0
  371. package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +15 -0
  372. package/shortcutContexts/commands/moveCellSelection/toMostRight.js +21 -0
  373. package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +17 -0
  374. package/shortcutContexts/commands/moveCellSelection/toMostTop.js +17 -0
  375. package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +13 -0
  376. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +19 -0
  377. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +15 -0
  378. package/shortcutContexts/commands/moveCellSelection/up.js +13 -0
  379. package/shortcutContexts/commands/moveCellSelection/up.mjs +9 -0
  380. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +33 -0
  381. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +29 -0
  382. package/shortcutContexts/commands/populateSelectedCellsData.js +29 -0
  383. package/shortcutContexts/commands/populateSelectedCellsData.mjs +25 -0
  384. package/shortcutContexts/commands/scrollToFocusedCell.js +35 -0
  385. package/shortcutContexts/commands/scrollToFocusedCell.mjs +31 -0
  386. package/shortcutContexts/commands/selectAll.js +12 -0
  387. package/shortcutContexts/commands/selectAll.mjs +8 -0
  388. package/shortcutContexts/constants.js +13 -0
  389. package/shortcutContexts/constants.mjs +8 -0
  390. package/shortcutContexts/editor.js +25 -0
  391. package/shortcutContexts/editor.mjs +21 -0
  392. package/shortcutContexts/grid.js +163 -0
  393. package/shortcutContexts/grid.mjs +159 -0
  394. package/shortcutContexts/index.js +24 -0
  395. package/shortcutContexts/index.mjs +11 -0
  396. package/shortcuts/context.js +20 -2
  397. package/shortcuts/context.mjs +20 -3
  398. package/shortcuts/manager.js +25 -7
  399. package/shortcuts/manager.mjs +26 -7
  400. package/shortcuts/recorder.js +3 -3
  401. package/shortcuts/recorder.mjs +3 -3
  402. package/shortcuts/utils.js +19 -5
  403. package/shortcuts/utils.mjs +18 -4
  404. package/tableView.js +111 -13
  405. package/tableView.mjs +112 -14
  406. package/3rdparty/walkontable/src/selection.js +0 -295
  407. package/3rdparty/walkontable/src/selection.mjs +0 -290
  408. package/plugins/contextMenu/predefinedItems.mjs +0 -68
  409. package/plugins/copyPaste/focusableElement.js +0 -186
  410. package/plugins/copyPaste/focusableElement.mjs +0 -180
  411. package/selection/highlight/constants.js +0 -15
  412. package/selection/highlight/constants.mjs +0 -6
  413. package/selection/highlight/types/index.js +0 -35
  414. package/selection/highlight/types/index.mjs +0 -31
package/core.js CHANGED
@@ -12,6 +12,7 @@ var _browser = require("./helpers/browser");
12
12
  var _editorManager = _interopRequireDefault(require("./editorManager"));
13
13
  var _eventManager = _interopRequireDefault(require("./eventManager"));
14
14
  var _object = require("./helpers/object");
15
+ var _focusManager = require("./focusManager");
15
16
  var _array = require("./helpers/array");
16
17
  var _parseTable = require("./utils/parseTable");
17
18
  var _registry = require("./plugins/registry");
@@ -31,12 +32,22 @@ var _registry5 = require("./i18n/registry");
31
32
  var _utils = require("./i18n/utils");
32
33
  var _selection = require("./selection");
33
34
  var _dataMap = require("./dataMap");
35
+ var _index3 = require("./core/index");
34
36
  var _uniqueMap = require("./utils/dataStructures/uniqueMap");
35
37
  var _shortcuts = require("./shortcuts");
38
+ var _shortcutContexts = require("./shortcutContexts");
36
39
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
- const SHORTCUTS_GROUP = 'gridDefault';
38
40
  let activeGuid = null;
39
41
 
42
+ /**
43
+ * Keeps the collection of the all Handsontable instances created on the same page. The
44
+ * list is then used to trigger the "afterUnlisten" hook when the "listen()" method was
45
+ * called on another instance.
46
+ *
47
+ * @type {Map<string, Core>}
48
+ */
49
+ const foreignHotInstances = new Map();
50
+
40
51
  /**
41
52
  * A set of deprecated feature names.
42
53
  *
@@ -96,7 +107,8 @@ const deprecationWarns = new Set();
96
107
  * @param {boolean} [rootInstanceSymbol=false] Indicates if the instance is root of all later instances created.
97
108
  */
98
109
  function Core(rootElement, userSettings) {
99
- var _userSettings$layoutD;
110
+ var _userSettings$layoutD,
111
+ _this = this;
100
112
  let rootInstanceSymbol = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
101
113
  let preventScrollingToCell = false;
102
114
  let instance = this;
@@ -105,6 +117,7 @@ function Core(rootElement, userSettings) {
105
117
  let dataSource;
106
118
  let grid;
107
119
  let editorManager;
120
+ let focusManager;
108
121
  let firstRun = true;
109
122
  if ((0, _rootInstance.hasValidParameter)(rootInstanceSymbol)) {
110
123
  (0, _rootInstance.registerAsRootInstance)(this);
@@ -213,6 +226,8 @@ function Core(rootElement, userSettings) {
213
226
  }
214
227
  this.guid = `ht_${(0, _string.randomString)()}`; // this is the namespace for global events
215
228
 
229
+ foreignHotInstances.set(this.guid, this);
230
+
216
231
  /**
217
232
  * Instance of index mapper which is responsible for managing the column indexes.
218
233
  *
@@ -261,14 +276,16 @@ function Core(rootElement, userSettings) {
261
276
  };
262
277
 
263
278
  let selection = new _selection.Selection(tableMeta, {
264
- rowIndexMapper: () => instance.rowIndexMapper,
265
- columnIndexMapper: () => instance.columnIndexMapper,
279
+ rowIndexMapper: instance.rowIndexMapper,
280
+ columnIndexMapper: instance.columnIndexMapper,
266
281
  countCols: () => instance.countCols(),
267
282
  countRows: () => instance.countRows(),
268
283
  propToCol: prop => datamap.propToCol(prop),
269
284
  isEditorOpened: () => instance.getActiveEditor() ? instance.getActiveEditor().isOpened() : false,
270
- countColsTranslated: () => this.view.countRenderableColumns(),
271
- countRowsTranslated: () => this.view.countRenderableRows(),
285
+ countRenderableColumns: () => this.view.countRenderableColumns(),
286
+ countRenderableRows: () => this.view.countRenderableRows(),
287
+ countRowHeaders: () => this.countRowHeaders(),
288
+ countColHeaders: () => this.countColHeaders(),
272
289
  getShortcutManager: () => instance.getShortcutManager(),
273
290
  createCellCoords: (row, column) => instance._createCellCoords(row, column),
274
291
  createCellRange: (highlight, from, to) => instance._createCellRange(highlight, from, to),
@@ -287,6 +304,9 @@ function Core(rootElement, userSettings) {
287
304
  };
288
305
  this.columnIndexMapper.addLocalHook('cacheUpdated', onIndexMapperCacheUpdate);
289
306
  this.rowIndexMapper.addLocalHook('cacheUpdated', onIndexMapperCacheUpdate);
307
+ this.selection.addLocalHook('beforeHighlightSet', () => {
308
+ this.runHooks('beforeSelectionHighlightSet');
309
+ });
290
310
  this.selection.addLocalHook('beforeSetRangeStart', cellCoords => {
291
311
  this.runHooks('beforeSetRangeStart', cellCoords);
292
312
  });
@@ -295,12 +315,6 @@ function Core(rootElement, userSettings) {
295
315
  });
296
316
  this.selection.addLocalHook('beforeSetRangeEnd', cellCoords => {
297
317
  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
318
  });
305
319
  this.selection.addLocalHook('afterSetRangeEnd', cellCoords => {
306
320
  const preventScrolling = (0, _object.createObjectPropListener)(false);
@@ -313,8 +327,6 @@ function Core(rootElement, userSettings) {
313
327
  this.runHooks('afterSelection', from.row, from.col, to.row, to.col, preventScrolling, selectionLayerLevel);
314
328
  this.runHooks('afterSelectionByProp', from.row, instance.colToProp(from.col), to.row, instance.colToProp(to.col), preventScrolling, selectionLayerLevel); // eslint-disable-line max-len
315
329
 
316
- const isSelectedByAnyHeader = this.selection.isSelectedByAnyHeader();
317
- const currentSelectedRange = this.selection.selectedRange.current();
318
330
  let scrollToCell = true;
319
331
  if (preventScrollingToCell) {
320
332
  scrollToCell = false;
@@ -322,19 +334,42 @@ function Core(rootElement, userSettings) {
322
334
  if (preventScrolling.isTouched()) {
323
335
  scrollToCell = !preventScrolling.value;
324
336
  }
337
+ const currentSelectedRange = this.selection.selectedRange.current();
338
+ const isSelectedByAnyHeader = this.selection.isSelectedByAnyHeader();
325
339
  const isSelectedByRowHeader = this.selection.isSelectedByRowHeader();
326
340
  const isSelectedByColumnHeader = this.selection.isSelectedByColumnHeader();
327
341
  if (scrollToCell !== false) {
328
342
  if (!isSelectedByAnyHeader) {
329
343
  if (currentSelectedRange && !this.selection.isMultiple()) {
330
- this.view.scrollViewport(visualToRenderableCoords(currentSelectedRange.from));
344
+ const {
345
+ row,
346
+ col
347
+ } = currentSelectedRange.from;
348
+ if (row < 0 && col >= 0) {
349
+ this.scrollViewportTo({
350
+ col
351
+ });
352
+ } else if (col < 0 && row >= 0) {
353
+ this.scrollViewportTo({
354
+ row
355
+ });
356
+ } else {
357
+ this.scrollViewportTo({
358
+ row,
359
+ col
360
+ });
361
+ }
331
362
  } else {
332
- this.view.scrollViewport(visualToRenderableCoords(cellCoords));
363
+ this.scrollViewportTo(cellCoords.toObject());
333
364
  }
334
365
  } else if (isSelectedByRowHeader) {
335
- this.view.scrollViewportVertically(instance.rowIndexMapper.getRenderableFromVisualIndex(cellCoords.row));
366
+ this.scrollViewportTo({
367
+ row: cellCoords.row
368
+ });
336
369
  } else if (isSelectedByColumnHeader) {
337
- this.view.scrollViewportHorizontally(instance.columnIndexMapper.getRenderableFromVisualIndex(cellCoords.col));
370
+ this.scrollViewportTo({
371
+ col: cellCoords.col
372
+ });
338
373
  }
339
374
  }
340
375
 
@@ -369,6 +404,30 @@ function Core(rootElement, userSettings) {
369
404
  isMultiple.value = changedIsMultiple;
370
405
  }
371
406
  });
407
+ this.selection.addLocalHook('beforeSelectColumns', function () {
408
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
409
+ args[_key] = arguments[_key];
410
+ }
411
+ return _this.runHooks('beforeSelectColumns', ...args);
412
+ });
413
+ this.selection.addLocalHook('afterSelectColumns', function () {
414
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
415
+ args[_key2] = arguments[_key2];
416
+ }
417
+ return _this.runHooks('afterSelectColumns', ...args);
418
+ });
419
+ this.selection.addLocalHook('beforeSelectRows', function () {
420
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
421
+ args[_key3] = arguments[_key3];
422
+ }
423
+ return _this.runHooks('beforeSelectRows', ...args);
424
+ });
425
+ this.selection.addLocalHook('afterSelectRows', function () {
426
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
427
+ args[_key4] = arguments[_key4];
428
+ }
429
+ return _this.runHooks('afterSelectRows', ...args);
430
+ });
372
431
  this.selection.addLocalHook('beforeModifyTransformStart', cellCoordsDelta => {
373
432
  this.runHooks('modifyTransformStart', cellCoordsDelta);
374
433
  });
@@ -474,7 +533,9 @@ function Core(rootElement, userSettings) {
474
533
  const currentFromRow = currentFromRange === null || currentFromRange === void 0 ? void 0 : currentFromRange.row;
475
534
  const startVisualRowIndex = instance.toVisualRow(startRowPhysicalIndex);
476
535
  if (selection.isSelectedByCorner()) {
477
- instance.selectAll();
536
+ selection.selectAll(true, true, {
537
+ disableHeadersHighlight: true
538
+ });
478
539
  } else if ((0, _mixed.isDefined)(currentFromRow) && currentFromRow >= startVisualRowIndex) {
479
540
  // Moving the selection (if it exists) downward – it should be applied to the "old" row.
480
541
  // TODO: The logic here should be handled by selection module.
@@ -528,7 +589,9 @@ function Core(rootElement, userSettings) {
528
589
  const currentFromColumn = currentFromRange === null || currentFromRange === void 0 ? void 0 : currentFromRange.col;
529
590
  const startVisualColumnIndex = instance.toVisualColumn(startColumnPhysicalIndex);
530
591
  if (selection.isSelectedByCorner()) {
531
- instance.selectAll();
592
+ selection.selectAll(true, true, {
593
+ disableHeadersHighlight: true
594
+ });
532
595
  } else if ((0, _mixed.isDefined)(currentFromColumn) && currentFromColumn >= startVisualColumnIndex) {
533
596
  // Moving the selection (if it exists) rightward – it should be applied to the "old" column.
534
597
  // TODO: The logic here should be handled by selection module.
@@ -1018,6 +1081,10 @@ function Core(rootElement, userSettings) {
1018
1081
  this.updateSettings(tableMeta, true);
1019
1082
  this.view = new _tableView.default(this);
1020
1083
  editorManager = _editorManager.default.getInstance(instance, tableMeta, selection);
1084
+ focusManager = new _focusManager.FocusManager(instance);
1085
+ if ((0, _rootInstance.isRootInstance)(this)) {
1086
+ (0, _index3.installFocusCatcher)(instance);
1087
+ }
1021
1088
  instance.runHooks('init');
1022
1089
  this.forceFullRender = true; // used when data was changed
1023
1090
  this.view.render();
@@ -1431,6 +1498,11 @@ function Core(rootElement, userSettings) {
1431
1498
  */
1432
1499
  this.listen = function () {
1433
1500
  if (instance && !instance.isListening()) {
1501
+ foreignHotInstances.forEach(foreignHot => {
1502
+ if (instance !== foreignHot) {
1503
+ foreignHot.unlisten();
1504
+ }
1505
+ });
1434
1506
  activeGuid = instance.guid;
1435
1507
  instance.runHooks('afterListen');
1436
1508
  }
@@ -1515,8 +1587,8 @@ function Core(rootElement, userSettings) {
1515
1587
  * @returns {Array} Returns removed portion of columns.
1516
1588
  */
1517
1589
  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];
1590
+ for (var _len5 = arguments.length, elements = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
1591
+ elements[_key5 - 3] = arguments[_key5];
1520
1592
  }
1521
1593
  return datamap.spliceCol(column, index, amount, ...elements);
1522
1594
  };
@@ -1533,8 +1605,8 @@ function Core(rootElement, userSettings) {
1533
1605
  * @returns {Array} Returns removed portion of rows.
1534
1606
  */
1535
1607
  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];
1608
+ for (var _len6 = arguments.length, elements = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
1609
+ elements[_key6 - 3] = arguments[_key6];
1538
1610
  }
1539
1611
  return datamap.spliceRow(row, index, amount, ...elements);
1540
1612
  };
@@ -1631,6 +1703,9 @@ function Core(rootElement, userSettings) {
1631
1703
  }
1632
1704
  const changes = [];
1633
1705
  (0, _array.arrayEach)(selection.getSelectedRange(), cellRange => {
1706
+ if (cellRange.isSingleHeader()) {
1707
+ return;
1708
+ }
1634
1709
  const topStart = cellRange.getTopStartCorner();
1635
1710
  const bottomEnd = cellRange.getBottomEndCorner();
1636
1711
  (0, _number.rangeEach)(topStart.row, bottomEnd.row, row => {
@@ -2928,8 +3003,8 @@ function Core(rootElement, userSettings) {
2928
3003
  */
2929
3004
  this.spliceCellsMeta = function (visualIndex) {
2930
3005
  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];
3006
+ for (var _len7 = arguments.length, cellMetaRows = new Array(_len7 > 2 ? _len7 - 2 : 0), _key7 = 2; _key7 < _len7; _key7++) {
3007
+ cellMetaRows[_key7 - 2] = arguments[_key7];
2933
3008
  }
2934
3009
  if (cellMetaRows.length > 0 && !Array.isArray(cellMetaRows[0])) {
2935
3010
  throw new Error('The 3rd argument (cellMetaRows) has to be passed as an array of cell meta objects array.');
@@ -3620,6 +3695,30 @@ function Core(rootElement, userSettings) {
3620
3695
  return instance.view._wt.drawn ? instance.view._wt.wtTable.getVisibleColumnsCount() : -1;
3621
3696
  };
3622
3697
 
3698
+ /**
3699
+ * Returns the number of rendered row headers.
3700
+ *
3701
+ * @since 14.0.0
3702
+ * @memberof Core#
3703
+ * @function countRowHeaders
3704
+ * @returns {number} Number of row headers.
3705
+ */
3706
+ this.countRowHeaders = function () {
3707
+ return this.view.getRowHeadersCount();
3708
+ };
3709
+
3710
+ /**
3711
+ * Returns the number of rendered column headers.
3712
+ *
3713
+ * @since 14.0.0
3714
+ * @memberof Core#
3715
+ * @function countColHeaders
3716
+ * @returns {number} Number of column headers.
3717
+ */
3718
+ this.countColHeaders = function () {
3719
+ return this.view.getColumnHeadersCount();
3720
+ };
3721
+
3623
3722
  /**
3624
3723
  * Returns the number of empty rows. If the optional ending parameter is `true`, returns the
3625
3724
  * number of empty rows at the bottom of the table.
@@ -3824,6 +3923,10 @@ function Core(rootElement, userSettings) {
3824
3923
  * hot.selectColumns('id');
3825
3924
  * // Select range of columns using visual indexes.
3826
3925
  * hot.selectColumns(1, 4);
3926
+ * // Select range of columns using visual indexes and mark the first header as highlighted.
3927
+ * hot.selectColumns(1, 2, -1);
3928
+ * // Select range of columns using visual indexes and mark the second cell as highlighted.
3929
+ * hot.selectColumns(2, 1, 1);
3827
3930
  * // Select range of columns using column properties.
3828
3931
  * hot.selectColumns('id', 'last_name');
3829
3932
  * ```
@@ -3834,11 +3937,15 @@ function Core(rootElement, userSettings) {
3834
3937
  * @param {number} startColumn The visual column index from which the selection starts.
3835
3938
  * @param {number} [endColumn=startColumn] The visual column index to which the selection finishes. If `endColumn`
3836
3939
  * is not defined the column defined by `startColumn` will be selected.
3940
+ * @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
3941
+ * The value can take visual row index from -N to N, where negative values
3942
+ * point to the headers and positive values point to the cell range.
3837
3943
  * @returns {boolean} `true` if selection was successful, `false` otherwise.
3838
3944
  */
3839
3945
  this.selectColumns = function (startColumn) {
3840
3946
  let endColumn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startColumn;
3841
- return selection.selectColumns(startColumn, endColumn);
3947
+ let focusPosition = arguments.length > 2 ? arguments[2] : undefined;
3948
+ return selection.selectColumns(startColumn, endColumn, focusPosition);
3842
3949
  };
3843
3950
 
3844
3951
  /**
@@ -3848,8 +3955,12 @@ function Core(rootElement, userSettings) {
3848
3955
  * ```js
3849
3956
  * // Select row using visual index.
3850
3957
  * hot.selectRows(1);
3851
- * // Select range of rows using visual indexes.
3958
+ * // select a range of rows, using visual indexes.
3852
3959
  * hot.selectRows(1, 4);
3960
+ * // select a range of rows, using visual indexes, and mark the header as highlighted.
3961
+ * hot.selectRows(1, 2, -1);
3962
+ * // Select range of rows using visual indexes and mark the second cell as highlighted.
3963
+ * hot.selectRows(2, 1, 1);
3853
3964
  * ```
3854
3965
  *
3855
3966
  * @memberof Core#
@@ -3858,11 +3969,15 @@ function Core(rootElement, userSettings) {
3858
3969
  * @param {number} startRow The visual row index from which the selection starts.
3859
3970
  * @param {number} [endRow=startRow] The visual row index to which the selection finishes. If `endRow`
3860
3971
  * is not defined the row defined by `startRow` will be selected.
3972
+ * @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
3973
+ * The value can take visual column index from -N to N, where negative values
3974
+ * point to the headers and positive values point to the cell range.
3861
3975
  * @returns {boolean} `true` if selection was successful, `false` otherwise.
3862
3976
  */
3863
3977
  this.selectRows = function (startRow) {
3864
3978
  let endRow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startRow;
3865
- return selection.selectRows(startRow, endRow);
3979
+ let focusPosition = arguments.length > 2 ? arguments[2] : undefined;
3980
+ return selection.selectRows(startRow, endRow, focusPosition);
3866
3981
  };
3867
3982
 
3868
3983
  /**
@@ -3881,9 +3996,16 @@ function Core(rootElement, userSettings) {
3881
3996
  * The previous selection is overwritten.
3882
3997
  *
3883
3998
  * ```js
3884
- * // select all cells in the table, including all headers
3999
+ * // select all cells in the table, including all headers and the corner cell
3885
4000
  * hot.selectAll();
3886
4001
  *
4002
+ * // select all cells in the table, including row headers but excluding the corner cell
4003
+ * hot.selectAll(true, false);
4004
+ *
4005
+ * // select all cells in the table, including all headers and the corner cell, but move the focus
4006
+ * // highlight to position -2, -1
4007
+ * hot.selectAll(-2, -1);
4008
+ *
3887
4009
  * // select all cells in the table, without headers
3888
4010
  * hot.selectAll(false);
3889
4011
  * ```
@@ -3891,15 +4013,25 @@ function Core(rootElement, userSettings) {
3891
4013
  * @since 0.38.2
3892
4014
  * @memberof Core#
3893
4015
  * @function selectAll
3894
- * @param {boolean} [includeHeaders=true] `true`: include all row, column and corner headers.
3895
- * `false`: don't include any headers.
4016
+ * @param {boolean} [includeRowHeaders=false] `true` If the selection should include the row headers,
4017
+ * `false` otherwise.
4018
+ * @param {boolean} [includeColumnHeaders=false] `true` If the selection should include the column
4019
+ * headers, `false` otherwise.
4020
+ *
4021
+ * @param {object} [options] Additional object with options.
4022
+ * @param {{row: number, col: number} | boolean} [options.focusPosition] The argument allows changing the cell/header
4023
+ * focus position. The value takes an object with a `row` and `col` properties from -N to N, where
4024
+ * negative values point to the headers and positive values point to the cell range. If `false`, the focus
4025
+ * position won't be changed.
4026
+ * @param {boolean} [options.disableHeadersHighlight] If `true`, disables highlighting the headers even when
4027
+ * the logical coordinates points on them.
3896
4028
  */
3897
4029
  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();
4030
+ let includeRowHeaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
4031
+ let includeColumnHeaders = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : includeRowHeaders;
4032
+ let options = arguments.length > 2 ? arguments[2] : undefined;
3901
4033
  preventScrollingToCell = true;
3902
- selection.selectAll(includeRowHeaders, includeColumnHeaders);
4034
+ selection.selectAll(includeRowHeaders, includeColumnHeaders, options);
3903
4035
  preventScrollingToCell = false;
3904
4036
  };
3905
4037
  const getIndexToScroll = (indexMapper, visualIndex) => {
@@ -3908,55 +4040,117 @@ function Core(rootElement, userSettings) {
3908
4040
  };
3909
4041
 
3910
4042
  /**
3911
- * Scroll viewport to coordinates specified by the `row` and `column` arguments.
4043
+ * Scroll viewport to coordinates specified by the `row` and/or `col` object properties.
4044
+ *
4045
+ * ```js
4046
+ * // scroll the viewport to the visual row index (leave the horizontal scroll untouched)
4047
+ * hot.scrollViewportTo({ row: 50 });
4048
+ *
4049
+ * // scroll the viewport to the passed coordinates so that the cell at 50, 50 will be snapped to
4050
+ * // the bottom-end table's edge.
4051
+ * hot.scrollViewportTo({
4052
+ * row: 50,
4053
+ * col: 50,
4054
+ * verticalSnap: 'bottom',
4055
+ * horizontalSnap: 'end',
4056
+ * });
4057
+ * ```
3912
4058
  *
3913
4059
  * @memberof Core#
3914
4060
  * @function scrollViewportTo
3915
- * @param {number} [row] Row index. If the last argument isn't defined we treat the index as a visual row index. Otherwise,
3916
- * we are using the index for numbering only this rows which may be rendered (we don't consider hidden rows).
3917
- * @param {number} [column] Column index. If the last argument isn't defined we treat the index as a visual column index.
3918
- * Otherwise, we are using the index for numbering only this columns which may be rendered (we don't consider hidden columns).
3919
- * @param {boolean} [snapToBottom=false] If `true`, the viewport is scrolled to show the cell at the bottom of the table.
3920
- * However, if the cell's height is greater than the table's viewport height, the cell is snapped to the top edge.
3921
- * @param {boolean} [snapToRight=false] If `true`, the viewport is scrolled to show the cell at the right side of the table.
3922
- * However, if the cell is wider than the table's viewport width, the cell is snapped to the left edge (or to the right edge, if the layout direction is set to `rtl`).
3923
- * @param {boolean} [considerHiddenIndexes=true] If `true`, we handle visual indexes, otherwise we handle only indexes which
4061
+ * @param {object} options A dictionary containing the following parameters:
4062
+ * @param {number} [options.row] Specifies the number of visual rows along the Y axis to scroll the viewport.
4063
+ * @param {number} [options.col] Specifies the number of visual columns along the X axis to scroll the viewport.
4064
+ * @param {'top' | 'bottom'} [options.verticalSnap] Determines to which edge of the table the viewport will be scrolled based on the passed coordinates.
4065
+ * This option is a string which must take one of the following values:
4066
+ * - `top`: The viewport will be scrolled to a row in such a way that it will be positioned on the top of the viewport;
4067
+ * - `bottom`: The viewport will be scrolled to a row in such a way that it will be positioned on the bottom of the viewport;
4068
+ * - If the property is not defined the vertical auto-snapping is enabled. Depending on where the viewport is scrolled from, a row will
4069
+ * be positioned at the top or bottom of the viewport.
4070
+ * @param {'start' | 'end'} [options.horizontalSnap] Determines to which edge of the table the viewport will be scrolled based on the passed coordinates.
4071
+ * This option is a string which must take one of the following values:
4072
+ * - `start`: The viewport will be scrolled to a column in such a way that it will be positioned on the start (left edge or right, if the layout direction is set to `rtl`) of the viewport;
4073
+ * - `end`: The viewport will be scrolled to a column in such a way that it will be positioned on the end (right edge or left, if the layout direction is set to `rtl`) of the viewport;
4074
+ * - If the property is not defined the horizontal auto-snapping is enabled. Depending on where the viewport is scrolled from, a column will
4075
+ * be positioned at the start or end of the viewport.
4076
+ * @param {boolean} [options.considerHiddenIndexes=true] If `true`, we handle visual indexes, otherwise we handle only indexes which
3924
4077
  * may be rendered when they are in the viewport (we don't consider hidden indexes as they aren't rendered).
3925
- * @returns {boolean} `true` if scroll was successful, `false` otherwise.
3926
- */
3927
- this.scrollViewportTo = function (row, column) {
3928
- let snapToBottom = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
3929
- let snapToRight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
3930
- let considerHiddenIndexes = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
3931
- const snapToTop = !snapToBottom;
3932
- const snapToLeft = !snapToRight;
4078
+ * @returns {boolean} `true` if viewport was scrolled, `false` otherwise.
4079
+ */
4080
+ this.scrollViewportTo = function () {
4081
+ let {
4082
+ row,
4083
+ col,
4084
+ verticalSnap,
4085
+ horizontalSnap,
4086
+ considerHiddenIndexes
4087
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4088
+ let snapToTop;
4089
+ let snapToBottom;
4090
+ let snapToInlineStart;
4091
+ let snapToInlineEnd;
4092
+ if (verticalSnap !== undefined) {
4093
+ snapToTop = verticalSnap === 'top';
4094
+ snapToBottom = !snapToTop;
4095
+ }
4096
+ if (horizontalSnap !== undefined) {
4097
+ snapToInlineStart = horizontalSnap === 'start';
4098
+ snapToInlineEnd = !snapToInlineStart;
4099
+ }
3933
4100
  let renderableRow = row;
3934
- let renderableColumn = column;
3935
- if (considerHiddenIndexes) {
3936
- const isRowInteger = Number.isInteger(row);
3937
- const isColumnInteger = Number.isInteger(column);
3938
- const visualRowToScroll = isRowInteger ? getIndexToScroll(this.rowIndexMapper, row) : void 0;
3939
- const visualColumnToScroll = isColumnInteger ? getIndexToScroll(this.columnIndexMapper, column) : void 0;
4101
+ let renderableColumn = col;
4102
+ if (considerHiddenIndexes === undefined || considerHiddenIndexes) {
4103
+ const isValidRowGrid = Number.isInteger(row) && row >= 0;
4104
+ const isValidColumnGrid = Number.isInteger(col) && col >= 0;
4105
+ const visualRowToScroll = isValidRowGrid ? getIndexToScroll(this.rowIndexMapper, row) : undefined;
4106
+ const visualColumnToScroll = isValidColumnGrid ? getIndexToScroll(this.columnIndexMapper, col) : undefined;
3940
4107
  if (visualRowToScroll === null || visualColumnToScroll === null) {
3941
4108
  return false;
3942
4109
  }
3943
- renderableRow = isRowInteger ? instance.rowIndexMapper.getRenderableFromVisualIndex(visualRowToScroll) : void 0;
3944
- renderableColumn = isColumnInteger ? instance.columnIndexMapper.getRenderableFromVisualIndex(visualColumnToScroll) : void 0;
4110
+ renderableRow = isValidRowGrid ? instance.rowIndexMapper.getRenderableFromVisualIndex(visualRowToScroll) : row;
4111
+ renderableColumn = isValidColumnGrid ? instance.columnIndexMapper.getRenderableFromVisualIndex(visualColumnToScroll) : col;
3945
4112
  }
3946
4113
  const isRowInteger = Number.isInteger(renderableRow);
3947
4114
  const isColumnInteger = Number.isInteger(renderableColumn);
3948
- if (isRowInteger && isColumnInteger) {
3949
- return instance.view.scrollViewport(instance._createCellCoords(renderableRow, renderableColumn), snapToTop, snapToRight, snapToBottom, snapToLeft);
4115
+ if (isRowInteger && renderableRow >= 0 && isColumnInteger && renderableColumn >= 0) {
4116
+ return instance.view.scrollViewport(instance._createCellCoords(renderableRow, renderableColumn), snapToTop, snapToInlineEnd, snapToBottom, snapToInlineStart);
3950
4117
  }
3951
- if (isRowInteger && isColumnInteger === false) {
4118
+ if (isRowInteger && renderableRow >= 0 && (isColumnInteger && renderableColumn < 0 || !isColumnInteger)) {
3952
4119
  return instance.view.scrollViewportVertically(renderableRow, snapToTop, snapToBottom);
3953
4120
  }
3954
- if (isColumnInteger && isRowInteger === false) {
3955
- return instance.view.scrollViewportHorizontally(renderableColumn, snapToRight, snapToLeft);
4121
+ if (isColumnInteger && renderableColumn >= 0 && (isRowInteger && renderableRow < 0 || !isRowInteger)) {
4122
+ return instance.view.scrollViewportHorizontally(renderableColumn, snapToInlineEnd, snapToInlineStart);
3956
4123
  }
3957
4124
  return false;
3958
4125
  };
3959
4126
 
4127
+ /**
4128
+ * Scrolls the viewport to coordinates specified by the currently focused cell.
4129
+ *
4130
+ * @since 14.0.0
4131
+ * @memberof Core#
4132
+ * @fires Hooks#afterScroll
4133
+ * @function scrollToFocusedCell
4134
+ * @param {Function} callback The callback function to call after the viewport is scrolled.
4135
+ */
4136
+ this.scrollToFocusedCell = function () {
4137
+ let callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : () => {};
4138
+ if (!this.selection.isSelected()) {
4139
+ return;
4140
+ }
4141
+ this.addHookOnce('afterScroll', callback);
4142
+ const {
4143
+ highlight
4144
+ } = this.getSelectedRangeLast();
4145
+ const isScrolled = this.scrollViewportTo(highlight.toObject());
4146
+ if (isScrolled) {
4147
+ this.view.render();
4148
+ } else {
4149
+ this.removeHook('afterScroll', callback);
4150
+ this._registerImmediate(() => callback());
4151
+ }
4152
+ };
4153
+
3960
4154
  /**
3961
4155
  * Removes the table from the DOM and destroys the instance of the Handsontable.
3962
4156
  *
@@ -3977,6 +4171,7 @@ function Core(rootElement, userSettings) {
3977
4171
  dataSource = null;
3978
4172
  this.getShortcutManager().destroy();
3979
4173
  metaManager.clearCache();
4174
+ foreignHotInstances.delete(this.guid);
3980
4175
  if ((0, _rootInstance.isRootInstance)(instance)) {
3981
4176
  const licenseInfo = this.rootDocument.querySelector('.hot-display-license-info');
3982
4177
  if (licenseInfo) {
@@ -4300,6 +4495,16 @@ function Core(rootElement, userSettings) {
4300
4495
  }
4301
4496
  };
4302
4497
 
4498
+ /**
4499
+ * Gets the instance of the EditorManager.
4500
+ *
4501
+ * @private
4502
+ * @returns {EditorManager}
4503
+ */
4504
+ this._getEditorManager = function () {
4505
+ return editorManager;
4506
+ };
4507
+
4303
4508
  /**
4304
4509
  * Check if currently it is RTL direction.
4305
4510
  *
@@ -4370,270 +4575,23 @@ function Core(rootElement, userSettings) {
4370
4575
  this.getShortcutManager = function () {
4371
4576
  return shortcutManager;
4372
4577
  };
4373
- const gridContext = shortcutManager.addContext('grid');
4374
- const gridConfig = {
4375
- runOnlyIf: () => {
4376
- return (0, _mixed.isDefined)(instance.getSelected()) && instance.countRenderedRows() > 0 && instance.countRenderedCols() > 0;
4377
- },
4378
- group: SHORTCUTS_GROUP
4578
+
4579
+ /**
4580
+ * Return the Focus Manager responsible for managing the browser's focus in the table.
4581
+ *
4582
+ * @memberof Core#
4583
+ * @since 14.0.0
4584
+ * @function getFocusManager
4585
+ * @returns {FocusManager}
4586
+ */
4587
+ this.getFocusManager = function () {
4588
+ return focusManager;
4379
4589
  };
4380
- shortcutManager.setActiveContextName('grid');
4381
- gridContext.addShortcuts([{
4382
- keys: [['Control/Meta', 'A']],
4383
- callback: () => {
4384
- instance.selectAll();
4385
- }
4386
- }, {
4387
- keys: [['Control/Meta', 'Enter']],
4388
- callback: () => {
4389
- const selectedRange = instance.getSelectedRange();
4390
- const {
4391
- row: highlightRow,
4392
- col: highlightColumn
4393
- } = selectedRange[selectedRange.length - 1].highlight;
4394
- const valueToPopulate = instance.getDataAtCell(highlightRow, highlightColumn);
4395
- const cellValues = new Map();
4396
- for (let i = 0; i < selectedRange.length; i++) {
4397
- selectedRange[i].forAll((row, column) => {
4398
- if (row >= 0 && column >= 0 && (row !== highlightRow || column !== highlightColumn)) {
4399
- const {
4400
- readOnly
4401
- } = instance.getCellMeta(row, column);
4402
- if (!readOnly) {
4403
- cellValues.set(`${row}x${column}`, [row, column, valueToPopulate]);
4404
- }
4405
- }
4406
- });
4407
- }
4408
- instance.setDataAtCell(Array.from(cellValues.values()));
4409
- },
4410
- runOnlyIf: () => instance.getSelectedRangeLast().getCellsCount() > 1
4411
- }, {
4412
- keys: [['ArrowUp']],
4413
- callback: () => {
4414
- selection.transformStart(-1, 0);
4415
- }
4416
- }, {
4417
- keys: [['ArrowUp', 'Control/Meta']],
4418
- captureCtrl: true,
4419
- callback: () => {
4420
- selection.setRangeStart(instance._createCellCoords(instance.rowIndexMapper.getNearestNotHiddenIndex(0, 1), instance.getSelectedRangeLast().highlight.col));
4421
- }
4422
- }, {
4423
- keys: [['ArrowUp', 'Shift']],
4424
- callback: () => {
4425
- selection.transformEnd(-1, 0);
4426
- }
4427
- }, {
4428
- keys: [['ArrowUp', 'Shift', 'Control/Meta']],
4429
- captureCtrl: true,
4430
- callback: () => {
4431
- const {
4432
- from,
4433
- to
4434
- } = instance.getSelectedRangeLast();
4435
- const row = instance.rowIndexMapper.getNearestNotHiddenIndex(0, 1);
4436
- selection.setRangeStart(from.clone());
4437
- selection.setRangeEnd(instance._createCellCoords(row, to.col));
4438
- },
4439
- runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByColumnHeader())
4440
- }, {
4441
- keys: [['ArrowDown']],
4442
- callback: () => {
4443
- selection.transformStart(1, 0);
4444
- }
4445
- }, {
4446
- keys: [['ArrowDown', 'Control/Meta']],
4447
- captureCtrl: true,
4448
- callback: () => {
4449
- selection.setRangeStart(instance._createCellCoords(instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - 1, -1), instance.getSelectedRangeLast().highlight.col));
4450
- }
4451
- }, {
4452
- keys: [['ArrowDown', 'Shift']],
4453
- callback: () => {
4454
- selection.transformEnd(1, 0);
4455
- }
4456
- }, {
4457
- keys: [['ArrowDown', 'Shift', 'Control/Meta']],
4458
- captureCtrl: true,
4459
- callback: () => {
4460
- const {
4461
- from,
4462
- to
4463
- } = instance.getSelectedRangeLast();
4464
- const row = instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - 1, -1);
4465
- selection.setRangeStart(from.clone());
4466
- selection.setRangeEnd(instance._createCellCoords(row, to.col));
4467
- },
4468
- runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByColumnHeader())
4469
- }, {
4470
- keys: [['ArrowLeft']],
4471
- callback: () => {
4472
- selection.transformStart(0, -1 * instance.getDirectionFactor());
4473
- }
4474
- }, {
4475
- keys: [['ArrowLeft', 'Control/Meta']],
4476
- captureCtrl: true,
4477
- callback: () => {
4478
- const row = instance.getSelectedRangeLast().highlight.row;
4479
- const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
4480
- selection.setRangeStart(instance._createCellCoords(row, column));
4481
- }
4482
- }, {
4483
- keys: [['ArrowLeft', 'Shift']],
4484
- callback: () => {
4485
- selection.transformEnd(0, -1 * instance.getDirectionFactor());
4486
- }
4487
- }, {
4488
- keys: [['ArrowLeft', 'Shift', 'Control/Meta']],
4489
- captureCtrl: true,
4490
- callback: () => {
4491
- const {
4492
- from,
4493
- to
4494
- } = instance.getSelectedRangeLast();
4495
- const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
4496
- selection.setRangeStart(from.clone());
4497
- selection.setRangeEnd(instance._createCellCoords(to.row, column));
4498
- },
4499
- runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByRowHeader())
4500
- }, {
4501
- keys: [['ArrowRight']],
4502
- callback: () => {
4503
- selection.transformStart(0, instance.getDirectionFactor());
4504
- }
4505
- }, {
4506
- keys: [['ArrowRight', 'Control/Meta']],
4507
- captureCtrl: true,
4508
- callback: () => {
4509
- const row = instance.getSelectedRangeLast().highlight.row;
4510
- const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
4511
- selection.setRangeStart(instance._createCellCoords(row, column));
4512
- }
4513
- }, {
4514
- keys: [['ArrowRight', 'Shift']],
4515
- callback: () => {
4516
- selection.transformEnd(0, instance.getDirectionFactor());
4517
- }
4518
- }, {
4519
- keys: [['ArrowRight', 'Shift', 'Control/Meta']],
4520
- captureCtrl: true,
4521
- callback: () => {
4522
- const {
4523
- from,
4524
- to
4525
- } = instance.getSelectedRangeLast();
4526
- const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
4527
- selection.setRangeStart(from.clone());
4528
- selection.setRangeEnd(instance._createCellCoords(to.row, column));
4529
- },
4530
- runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByRowHeader())
4531
- }, {
4532
- keys: [['Home']],
4533
- captureCtrl: true,
4534
- callback: () => {
4535
- const fixedColumns = parseInt(instance.getSettings().fixedColumnsStart, 10);
4536
- const row = instance.getSelectedRangeLast().highlight.row;
4537
- const column = instance.columnIndexMapper.getNearestNotHiddenIndex(fixedColumns, 1);
4538
- selection.setRangeStart(instance._createCellCoords(row, column));
4539
- },
4540
- runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
4541
- }, {
4542
- keys: [['Home', 'Shift']],
4543
- callback: () => {
4544
- selection.setRangeEnd(instance._createCellCoords(selection.selectedRange.current().from.row, instance.columnIndexMapper.getNearestNotHiddenIndex(0, 1)));
4545
- }
4546
- }, {
4547
- keys: [['Home', 'Control/Meta']],
4548
- captureCtrl: true,
4549
- callback: () => {
4550
- const fixedRows = parseInt(instance.getSettings().fixedRowsTop, 10);
4551
- const fixedColumns = parseInt(instance.getSettings().fixedColumnsStart, 10);
4552
- const row = instance.rowIndexMapper.getNearestNotHiddenIndex(fixedRows, 1);
4553
- const column = instance.columnIndexMapper.getNearestNotHiddenIndex(fixedColumns, 1);
4554
- selection.setRangeStart(instance._createCellCoords(row, column));
4555
- },
4556
- runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
4557
- }, {
4558
- keys: [['End']],
4559
- captureCtrl: true,
4560
- callback: () => {
4561
- selection.setRangeStart(instance._createCellCoords(instance.getSelectedRangeLast().highlight.row, instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1)));
4562
- },
4563
- runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
4564
- }, {
4565
- keys: [['End', 'Shift']],
4566
- callback: () => {
4567
- selection.setRangeEnd(instance._createCellCoords(selection.selectedRange.current().from.row, instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1)));
4568
- }
4569
- }, {
4570
- keys: [['End', 'Control/Meta']],
4571
- captureCtrl: true,
4572
- callback: () => {
4573
- const fixedRows = parseInt(instance.getSettings().fixedRowsBottom, 10);
4574
- const row = instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - fixedRows - 1, -1);
4575
- const column = instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1);
4576
- selection.setRangeStart(instance._createCellCoords(row, column));
4577
- },
4578
- runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
4579
- }, {
4580
- keys: [['PageUp']],
4581
- callback: () => {
4582
- selection.transformStart(-instance.countVisibleRows(), 0);
4583
- }
4584
- }, {
4585
- keys: [['PageUp', 'Shift']],
4586
- callback: () => {
4587
- const {
4588
- to
4589
- } = instance.getSelectedRangeLast();
4590
- const nextRowIndexToSelect = Math.max(to.row - instance.countVisibleRows(), 0);
4591
- const row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, 1);
4592
- if (row !== null) {
4593
- const coords = instance._createCellCoords(row, to.col);
4594
- const scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
4595
- const nextVerticalScroll = Math.max(coords.row - scrollPadding, 0);
4596
- selection.setRangeEnd(coords);
4597
- instance.scrollViewportTo(nextVerticalScroll);
4598
- }
4599
- }
4600
- }, {
4601
- keys: [['PageDown']],
4602
- callback: () => {
4603
- selection.transformStart(instance.countVisibleRows(), 0);
4604
- }
4605
- }, {
4606
- keys: [['PageDown', 'Shift']],
4607
- callback: () => {
4608
- const {
4609
- to
4610
- } = instance.getSelectedRangeLast();
4611
- const nextRowIndexToSelect = Math.min(to.row + instance.countVisibleRows(), instance.countRows() - 1);
4612
- const row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, -1);
4613
- if (row !== null) {
4614
- const coords = instance._createCellCoords(row, to.col);
4615
- const scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
4616
- const nextVerticalScroll = Math.min(coords.row - scrollPadding, instance.countRows() - 1);
4617
- selection.setRangeEnd(coords);
4618
- instance.scrollViewportTo(nextVerticalScroll);
4619
- }
4620
- }
4621
- }, {
4622
- keys: [['Tab']],
4623
- callback: event => {
4624
- const tabMoves = typeof tableMeta.tabMoves === 'function' ? tableMeta.tabMoves(event) : tableMeta.tabMoves;
4625
- selection.transformStart(tabMoves.row, tabMoves.col, true);
4626
- }
4627
- }, {
4628
- keys: [['Shift', 'Tab']],
4629
- callback: event => {
4630
- const tabMoves = typeof tableMeta.tabMoves === 'function' ? tableMeta.tabMoves(event) : tableMeta.tabMoves;
4631
- selection.transformStart(-tabMoves.row, -tabMoves.col);
4632
- }
4633
- }], gridConfig);
4634
4590
  (0, _registry.getPluginsNames)().forEach(pluginName => {
4635
4591
  const PluginClass = (0, _registry.getPlugin)(pluginName);
4636
4592
  pluginsRegistry.addItem(pluginName, new PluginClass(this));
4637
4593
  });
4594
+ (0, _shortcutContexts.registerAllShortcutContexts)(instance);
4595
+ shortcutManager.setActiveContextName('grid');
4638
4596
  _pluginHooks.default.getSingleton().run(instance, 'construct');
4639
4597
  }