handsontable 0.0.0-next-9059914-20231025 → 0.0.0-next-21d91d0-20231025

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 (446) 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 +51 -15
  98. package/dist/handsontable.full.css +51 -15
  99. package/dist/handsontable.full.js +13360 -7840
  100. package/dist/handsontable.full.min.css +7 -7
  101. package/dist/handsontable.full.min.js +136 -136
  102. package/dist/handsontable.js +20955 -15435
  103. package/dist/handsontable.min.css +6 -6
  104. package/dist/handsontable.min.js +24 -24
  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/defaultShortcutsList.js +88 -0
  175. package/plugins/contextMenu/menu/defaultShortcutsList.mjs +84 -0
  176. package/plugins/contextMenu/menu/index.js +9 -0
  177. package/plugins/contextMenu/menu/index.mjs +1 -0
  178. package/plugins/contextMenu/{menu.js → menu/menu.js} +145 -421
  179. package/plugins/contextMenu/{menu.mjs → menu/menu.mjs} +146 -422
  180. package/plugins/contextMenu/menu/menuItemRenderer.js +58 -0
  181. package/plugins/contextMenu/menu/menuItemRenderer.mjs +54 -0
  182. package/plugins/contextMenu/menu/navigator.js +27 -0
  183. package/plugins/contextMenu/menu/navigator.mjs +23 -0
  184. package/plugins/contextMenu/menu/positioner.js +213 -0
  185. package/plugins/contextMenu/menu/positioner.mjs +209 -0
  186. package/plugins/contextMenu/menu/shortcuts.js +114 -0
  187. package/plugins/contextMenu/menu/shortcuts.mjs +110 -0
  188. package/plugins/contextMenu/menu/utils.js +177 -0
  189. package/plugins/contextMenu/menu/utils.mjs +163 -0
  190. package/plugins/contextMenu/predefinedItems/alignment.js +7 -0
  191. package/plugins/contextMenu/predefinedItems/alignment.mjs +7 -0
  192. package/plugins/contextMenu/predefinedItems/clearColumn.js +5 -3
  193. package/plugins/contextMenu/predefinedItems/clearColumn.mjs +5 -3
  194. package/plugins/contextMenu/predefinedItems/columnLeft.js +5 -3
  195. package/plugins/contextMenu/predefinedItems/columnLeft.mjs +5 -3
  196. package/plugins/contextMenu/predefinedItems/columnRight.js +5 -3
  197. package/plugins/contextMenu/predefinedItems/columnRight.mjs +5 -3
  198. package/plugins/contextMenu/{predefinedItems.js → predefinedItems/index.js} +14 -14
  199. package/plugins/contextMenu/predefinedItems/index.mjs +68 -0
  200. package/plugins/contextMenu/predefinedItems/readOnly.js +7 -0
  201. package/plugins/contextMenu/predefinedItems/readOnly.mjs +7 -0
  202. package/plugins/contextMenu/predefinedItems/removeColumn.js +7 -5
  203. package/plugins/contextMenu/predefinedItems/removeColumn.mjs +5 -3
  204. package/plugins/contextMenu/predefinedItems/removeRow.js +7 -5
  205. package/plugins/contextMenu/predefinedItems/removeRow.mjs +5 -3
  206. package/plugins/contextMenu/predefinedItems/rowAbove.js +5 -3
  207. package/plugins/contextMenu/predefinedItems/rowAbove.mjs +5 -3
  208. package/plugins/contextMenu/predefinedItems/rowBelow.js +5 -3
  209. package/plugins/contextMenu/predefinedItems/rowBelow.mjs +5 -3
  210. package/plugins/contextMenu/utils.js +35 -151
  211. package/plugins/contextMenu/utils.mjs +35 -144
  212. package/plugins/copyPaste/contextMenuItem/copy.js +7 -0
  213. package/plugins/copyPaste/contextMenuItem/copy.mjs +7 -0
  214. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.js +9 -1
  215. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs +9 -1
  216. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.js +9 -1
  217. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs +9 -1
  218. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.js +9 -1
  219. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs +9 -1
  220. package/plugins/copyPaste/contextMenuItem/cut.js +7 -0
  221. package/plugins/copyPaste/contextMenuItem/cut.mjs +7 -0
  222. package/plugins/copyPaste/copyPaste.js +127 -78
  223. package/plugins/copyPaste/copyPaste.mjs +128 -79
  224. package/plugins/customBorders/customBorders.js +23 -20
  225. package/plugins/customBorders/customBorders.mjs +24 -21
  226. package/plugins/dropdownMenu/dropdownMenu.d.ts +1 -1
  227. package/plugins/dropdownMenu/dropdownMenu.js +127 -40
  228. package/plugins/dropdownMenu/dropdownMenu.mjs +126 -39
  229. package/plugins/filters/component/_base.js +23 -8
  230. package/plugins/filters/component/_base.mjs +23 -8
  231. package/plugins/filters/component/actionBar.js +29 -27
  232. package/plugins/filters/component/actionBar.mjs +26 -23
  233. package/plugins/filters/component/condition.js +46 -59
  234. package/plugins/filters/component/condition.mjs +40 -52
  235. package/plugins/filters/component/operators.js +21 -22
  236. package/plugins/filters/component/operators.mjs +18 -18
  237. package/plugins/filters/component/value.js +35 -26
  238. package/plugins/filters/component/value.mjs +32 -22
  239. package/plugins/filters/constants.mjs +1 -1
  240. package/plugins/filters/filters.js +106 -62
  241. package/plugins/filters/filters.mjs +99 -55
  242. package/plugins/filters/menu/focusController.js +123 -0
  243. package/plugins/filters/menu/focusController.mjs +119 -0
  244. package/plugins/filters/menu/focusNavigator.js +30 -0
  245. package/plugins/filters/menu/focusNavigator.mjs +26 -0
  246. package/plugins/filters/ui/_base.js +35 -13
  247. package/plugins/filters/ui/_base.mjs +35 -13
  248. package/plugins/filters/ui/input.js +43 -32
  249. package/plugins/filters/ui/input.mjs +42 -30
  250. package/plugins/filters/ui/link.js +44 -12
  251. package/plugins/filters/ui/link.mjs +44 -11
  252. package/plugins/filters/ui/multipleSelect.js +234 -129
  253. package/plugins/filters/ui/multipleSelect.mjs +232 -127
  254. package/plugins/filters/ui/radioInput.js +42 -18
  255. package/plugins/filters/ui/radioInput.mjs +42 -17
  256. package/plugins/filters/ui/select.js +144 -75
  257. package/plugins/filters/ui/select.mjs +142 -72
  258. package/plugins/hiddenColumns/hiddenColumns.mjs +1 -1
  259. package/plugins/hiddenRows/hiddenRows.mjs +1 -1
  260. package/plugins/manualColumnMove/manualColumnMove.js +3 -1
  261. package/plugins/manualColumnMove/manualColumnMove.mjs +3 -1
  262. package/plugins/mergeCells/mergeCells.js +5 -16
  263. package/plugins/mergeCells/mergeCells.mjs +5 -16
  264. package/plugins/multiColumnSorting/multiColumnSorting.js +37 -2
  265. package/plugins/multiColumnSorting/multiColumnSorting.mjs +37 -2
  266. package/plugins/nestedHeaders/nestedHeaders.js +240 -10
  267. package/plugins/nestedHeaders/nestedHeaders.mjs +241 -11
  268. package/plugins/nestedHeaders/stateManager/index.js +102 -3
  269. package/plugins/nestedHeaders/stateManager/index.mjs +102 -3
  270. package/plugins/nestedRows/nestedRows.js +41 -0
  271. package/plugins/nestedRows/nestedRows.mjs +41 -0
  272. package/plugins/nestedRows/ui/headers.js +11 -0
  273. package/plugins/nestedRows/ui/headers.mjs +12 -1
  274. package/renderers/autocompleteRenderer/autocompleteRenderer.js +8 -0
  275. package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +8 -0
  276. package/renderers/baseRenderer/baseRenderer.js +17 -0
  277. package/renderers/baseRenderer/baseRenderer.mjs +18 -1
  278. package/renderers/checkboxRenderer/checkboxRenderer.js +9 -4
  279. package/renderers/checkboxRenderer/checkboxRenderer.mjs +9 -4
  280. package/renderers/dateRenderer/dateRenderer.d.ts +5 -0
  281. package/renderers/dateRenderer/dateRenderer.js +29 -0
  282. package/renderers/dateRenderer/dateRenderer.mjs +24 -0
  283. package/renderers/dateRenderer/index.d.ts +1 -0
  284. package/renderers/dateRenderer/index.js +6 -0
  285. package/renderers/dateRenderer/index.mjs +1 -0
  286. package/renderers/handsontableRenderer/handsontableRenderer.d.ts +5 -0
  287. package/renderers/handsontableRenderer/handsontableRenderer.js +29 -0
  288. package/renderers/handsontableRenderer/handsontableRenderer.mjs +24 -0
  289. package/renderers/handsontableRenderer/index.d.ts +1 -0
  290. package/renderers/handsontableRenderer/index.js +6 -0
  291. package/renderers/handsontableRenderer/index.mjs +1 -0
  292. package/renderers/index.d.ts +9 -0
  293. package/renderers/selectRenderer/index.d.ts +1 -0
  294. package/renderers/selectRenderer/index.js +6 -0
  295. package/renderers/selectRenderer/index.mjs +1 -0
  296. package/renderers/selectRenderer/selectRenderer.d.ts +5 -0
  297. package/renderers/selectRenderer/selectRenderer.js +27 -0
  298. package/renderers/selectRenderer/selectRenderer.mjs +22 -0
  299. package/selection/highlight/highlight.js +256 -71
  300. package/selection/highlight/highlight.mjs +250 -71
  301. package/selection/highlight/types/activeHeader.js +10 -8
  302. package/selection/highlight/types/activeHeader.mjs +10 -8
  303. package/selection/highlight/types/area.js +6 -18
  304. package/selection/highlight/types/area.mjs +6 -18
  305. package/selection/highlight/types/areaLayered.js +31 -0
  306. package/selection/highlight/types/areaLayered.mjs +26 -0
  307. package/selection/highlight/types/column.js +27 -0
  308. package/selection/highlight/types/column.mjs +22 -0
  309. package/selection/highlight/types/customSelection.js +7 -9
  310. package/selection/highlight/types/customSelection.mjs +7 -9
  311. package/selection/highlight/types/fill.js +5 -7
  312. package/selection/highlight/types/fill.mjs +5 -7
  313. package/selection/highlight/types/{cell.js → focus.js} +5 -7
  314. package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
  315. package/selection/highlight/types/header.js +9 -18
  316. package/selection/highlight/types/header.mjs +9 -18
  317. package/selection/highlight/types/row.js +27 -0
  318. package/selection/highlight/types/row.mjs +22 -0
  319. package/selection/highlight/visualSelection.js +31 -27
  320. package/selection/highlight/visualSelection.mjs +31 -27
  321. package/selection/index.js +4 -7
  322. package/selection/index.mjs +2 -3
  323. package/selection/mouseEventHandler.js +7 -1
  324. package/selection/mouseEventHandler.mjs +7 -1
  325. package/selection/range.js +8 -8
  326. package/selection/range.mjs +8 -8
  327. package/selection/selection.js +321 -152
  328. package/selection/selection.mjs +318 -151
  329. package/selection/transformation.js +232 -90
  330. package/selection/transformation.mjs +232 -90
  331. package/selection/utils.js +15 -21
  332. package/selection/utils.mjs +16 -21
  333. package/settings.d.ts +4 -0
  334. package/shortcutContexts/commands/editor/closeAndSave.js +12 -0
  335. package/shortcutContexts/commands/editor/closeAndSave.mjs +8 -0
  336. package/shortcutContexts/commands/editor/closeWithoutSaving.js +12 -0
  337. package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +8 -0
  338. package/shortcutContexts/commands/editor/fastOpen.js +16 -0
  339. package/shortcutContexts/commands/editor/fastOpen.mjs +12 -0
  340. package/shortcutContexts/commands/editor/index.js +16 -0
  341. package/shortcutContexts/commands/editor/index.mjs +12 -0
  342. package/shortcutContexts/commands/editor/open.js +27 -0
  343. package/shortcutContexts/commands/editor/open.mjs +23 -0
  344. package/shortcutContexts/commands/emptySelectedCells.js +11 -0
  345. package/shortcutContexts/commands/emptySelectedCells.mjs +7 -0
  346. package/shortcutContexts/commands/extendCellsSelection/down.js +15 -0
  347. package/shortcutContexts/commands/extendCellsSelection/down.mjs +11 -0
  348. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +25 -0
  349. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +21 -0
  350. package/shortcutContexts/commands/extendCellsSelection/index.js +26 -0
  351. package/shortcutContexts/commands/extendCellsSelection/index.mjs +22 -0
  352. package/shortcutContexts/commands/extendCellsSelection/left.js +15 -0
  353. package/shortcutContexts/commands/extendCellsSelection/left.mjs +11 -0
  354. package/shortcutContexts/commands/extendCellsSelection/right.js +15 -0
  355. package/shortcutContexts/commands/extendCellsSelection/right.mjs +11 -0
  356. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +19 -0
  357. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +15 -0
  358. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +29 -0
  359. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +25 -0
  360. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +19 -0
  361. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +15 -0
  362. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +19 -0
  363. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +15 -0
  364. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +29 -0
  365. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +25 -0
  366. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +29 -0
  367. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +25 -0
  368. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +29 -0
  369. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +25 -0
  370. package/shortcutContexts/commands/extendCellsSelection/toRows.js +19 -0
  371. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +15 -0
  372. package/shortcutContexts/commands/extendCellsSelection/up.js +15 -0
  373. package/shortcutContexts/commands/extendCellsSelection/up.mjs +11 -0
  374. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +25 -0
  375. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +21 -0
  376. package/shortcutContexts/commands/index.js +35 -0
  377. package/shortcutContexts/commands/index.mjs +31 -0
  378. package/shortcutContexts/commands/moveCellSelection/down.js +13 -0
  379. package/shortcutContexts/commands/moveCellSelection/down.mjs +9 -0
  380. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +33 -0
  381. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +29 -0
  382. package/shortcutContexts/commands/moveCellSelection/index.js +28 -0
  383. package/shortcutContexts/commands/moveCellSelection/index.mjs +24 -0
  384. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +12 -0
  385. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -0
  386. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +12 -0
  387. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -0
  388. package/shortcutContexts/commands/moveCellSelection/left.js +10 -0
  389. package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -0
  390. package/shortcutContexts/commands/moveCellSelection/right.js +10 -0
  391. package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -0
  392. package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +17 -0
  393. package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +13 -0
  394. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +18 -0
  395. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +14 -0
  396. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +14 -0
  397. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +10 -0
  398. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +17 -0
  399. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +13 -0
  400. package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +19 -0
  401. package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +15 -0
  402. package/shortcutContexts/commands/moveCellSelection/toMostRight.js +21 -0
  403. package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +17 -0
  404. package/shortcutContexts/commands/moveCellSelection/toMostTop.js +17 -0
  405. package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +13 -0
  406. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +19 -0
  407. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +15 -0
  408. package/shortcutContexts/commands/moveCellSelection/up.js +13 -0
  409. package/shortcutContexts/commands/moveCellSelection/up.mjs +9 -0
  410. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +33 -0
  411. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +29 -0
  412. package/shortcutContexts/commands/populateSelectedCellsData.js +29 -0
  413. package/shortcutContexts/commands/populateSelectedCellsData.mjs +25 -0
  414. package/shortcutContexts/commands/scrollToFocusedCell.js +35 -0
  415. package/shortcutContexts/commands/scrollToFocusedCell.mjs +31 -0
  416. package/shortcutContexts/commands/selectAll.js +12 -0
  417. package/shortcutContexts/commands/selectAll.mjs +8 -0
  418. package/shortcutContexts/constants.js +13 -0
  419. package/shortcutContexts/constants.mjs +8 -0
  420. package/shortcutContexts/editor.js +25 -0
  421. package/shortcutContexts/editor.mjs +21 -0
  422. package/shortcutContexts/grid.js +163 -0
  423. package/shortcutContexts/grid.mjs +159 -0
  424. package/shortcutContexts/index.js +24 -0
  425. package/shortcutContexts/index.mjs +11 -0
  426. package/shortcuts/context.js +23 -4
  427. package/shortcuts/context.mjs +23 -5
  428. package/shortcuts/manager.js +25 -7
  429. package/shortcuts/manager.mjs +26 -7
  430. package/shortcuts/recorder.js +3 -3
  431. package/shortcuts/recorder.mjs +3 -3
  432. package/shortcuts/utils.js +19 -5
  433. package/shortcuts/utils.mjs +18 -4
  434. package/tableView.js +111 -13
  435. package/tableView.mjs +112 -14
  436. package/utils/paginator.js +151 -0
  437. package/utils/paginator.mjs +147 -0
  438. package/3rdparty/walkontable/src/selection.js +0 -295
  439. package/3rdparty/walkontable/src/selection.mjs +0 -290
  440. package/plugins/contextMenu/predefinedItems.mjs +0 -68
  441. package/plugins/copyPaste/focusableElement.js +0 -186
  442. package/plugins/copyPaste/focusableElement.mjs +0 -180
  443. package/selection/highlight/constants.js +0 -15
  444. package/selection/highlight/constants.mjs +0 -6
  445. package/selection/highlight/types/index.js +0 -35
  446. package/selection/highlight/types/index.mjs +0 -31
package/core.mjs CHANGED
@@ -8,6 +8,7 @@ import { isMobileBrowser, isIpadOS } from "./helpers/browser.mjs";
8
8
  import EditorManager from "./editorManager.mjs";
9
9
  import EventManager from "./eventManager.mjs";
10
10
  import { deepClone, duckSchema, isObjectEqual, isObject, deepObjectSize, hasOwnProperty, createObjectPropListener, objectEach } from "./helpers/object.mjs";
11
+ import { FocusManager } from "./focusManager.mjs";
11
12
  import { arrayMap, arrayEach, arrayReduce, getDifferenceOfArrays, stringToArray, pivot } from "./helpers/array.mjs";
12
13
  import { instanceToHTML } from "./utils/parseTable.mjs";
13
14
  import { getPlugin, getPluginsNames } from "./plugins/registry.mjs";
@@ -27,11 +28,21 @@ import { hasLanguageDictionary, getValidLanguageCode, getTranslatedPhrase } from
27
28
  import { warnUserAboutLanguageRegistration, normalizeLanguageCode } from "./i18n/utils.mjs";
28
29
  import { Selection } from "./selection/index.mjs";
29
30
  import { MetaManager, DynamicCellMetaMod, ExtendMetaPropertiesMod, replaceData } from "./dataMap/index.mjs";
31
+ import { installFocusCatcher } from "./core/index.mjs";
30
32
  import { createUniqueMap } from "./utils/dataStructures/uniqueMap.mjs";
31
33
  import { createShortcutManager } from "./shortcuts/index.mjs";
32
- const SHORTCUTS_GROUP = 'gridDefault';
34
+ import { registerAllShortcutContexts } from "./shortcutContexts/index.mjs";
33
35
  let activeGuid = null;
34
36
 
37
+ /**
38
+ * Keeps the collection of the all Handsontable instances created on the same page. The
39
+ * list is then used to trigger the "afterUnlisten" hook when the "listen()" method was
40
+ * called on another instance.
41
+ *
42
+ * @type {Map<string, Core>}
43
+ */
44
+ const foreignHotInstances = new Map();
45
+
35
46
  /**
36
47
  * A set of deprecated feature names.
37
48
  *
@@ -91,7 +102,8 @@ const deprecationWarns = new Set();
91
102
  * @param {boolean} [rootInstanceSymbol=false] Indicates if the instance is root of all later instances created.
92
103
  */
93
104
  export default function Core(rootElement, userSettings) {
94
- var _userSettings$layoutD;
105
+ var _userSettings$layoutD,
106
+ _this = this;
95
107
  let rootInstanceSymbol = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
96
108
  let preventScrollingToCell = false;
97
109
  let instance = this;
@@ -100,6 +112,7 @@ export default function Core(rootElement, userSettings) {
100
112
  let dataSource;
101
113
  let grid;
102
114
  let editorManager;
115
+ let focusManager;
103
116
  let firstRun = true;
104
117
  if (hasValidParameter(rootInstanceSymbol)) {
105
118
  registerAsRootInstance(this);
@@ -208,6 +221,8 @@ export default function Core(rootElement, userSettings) {
208
221
  }
209
222
  this.guid = `ht_${randomString()}`; // this is the namespace for global events
210
223
 
224
+ foreignHotInstances.set(this.guid, this);
225
+
211
226
  /**
212
227
  * Instance of index mapper which is responsible for managing the column indexes.
213
228
  *
@@ -256,14 +271,16 @@ export default function Core(rootElement, userSettings) {
256
271
  };
257
272
 
258
273
  let selection = new Selection(tableMeta, {
259
- rowIndexMapper: () => instance.rowIndexMapper,
260
- columnIndexMapper: () => instance.columnIndexMapper,
274
+ rowIndexMapper: instance.rowIndexMapper,
275
+ columnIndexMapper: instance.columnIndexMapper,
261
276
  countCols: () => instance.countCols(),
262
277
  countRows: () => instance.countRows(),
263
278
  propToCol: prop => datamap.propToCol(prop),
264
279
  isEditorOpened: () => instance.getActiveEditor() ? instance.getActiveEditor().isOpened() : false,
265
- countColsTranslated: () => this.view.countRenderableColumns(),
266
- countRowsTranslated: () => this.view.countRenderableRows(),
280
+ countRenderableColumns: () => this.view.countRenderableColumns(),
281
+ countRenderableRows: () => this.view.countRenderableRows(),
282
+ countRowHeaders: () => this.countRowHeaders(),
283
+ countColHeaders: () => this.countColHeaders(),
267
284
  getShortcutManager: () => instance.getShortcutManager(),
268
285
  createCellCoords: (row, column) => instance._createCellCoords(row, column),
269
286
  createCellRange: (highlight, from, to) => instance._createCellRange(highlight, from, to),
@@ -282,6 +299,9 @@ export default function Core(rootElement, userSettings) {
282
299
  };
283
300
  this.columnIndexMapper.addLocalHook('cacheUpdated', onIndexMapperCacheUpdate);
284
301
  this.rowIndexMapper.addLocalHook('cacheUpdated', onIndexMapperCacheUpdate);
302
+ this.selection.addLocalHook('beforeHighlightSet', () => {
303
+ this.runHooks('beforeSelectionHighlightSet');
304
+ });
285
305
  this.selection.addLocalHook('beforeSetRangeStart', cellCoords => {
286
306
  this.runHooks('beforeSetRangeStart', cellCoords);
287
307
  });
@@ -290,12 +310,6 @@ export default function Core(rootElement, userSettings) {
290
310
  });
291
311
  this.selection.addLocalHook('beforeSetRangeEnd', cellCoords => {
292
312
  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
- }
299
313
  });
300
314
  this.selection.addLocalHook('afterSetRangeEnd', cellCoords => {
301
315
  const preventScrolling = createObjectPropListener(false);
@@ -308,8 +322,6 @@ export default function Core(rootElement, userSettings) {
308
322
  this.runHooks('afterSelection', from.row, from.col, to.row, to.col, preventScrolling, selectionLayerLevel);
309
323
  this.runHooks('afterSelectionByProp', from.row, instance.colToProp(from.col), to.row, instance.colToProp(to.col), preventScrolling, selectionLayerLevel); // eslint-disable-line max-len
310
324
 
311
- const isSelectedByAnyHeader = this.selection.isSelectedByAnyHeader();
312
- const currentSelectedRange = this.selection.selectedRange.current();
313
325
  let scrollToCell = true;
314
326
  if (preventScrollingToCell) {
315
327
  scrollToCell = false;
@@ -317,19 +329,42 @@ export default function Core(rootElement, userSettings) {
317
329
  if (preventScrolling.isTouched()) {
318
330
  scrollToCell = !preventScrolling.value;
319
331
  }
332
+ const currentSelectedRange = this.selection.selectedRange.current();
333
+ const isSelectedByAnyHeader = this.selection.isSelectedByAnyHeader();
320
334
  const isSelectedByRowHeader = this.selection.isSelectedByRowHeader();
321
335
  const isSelectedByColumnHeader = this.selection.isSelectedByColumnHeader();
322
336
  if (scrollToCell !== false) {
323
337
  if (!isSelectedByAnyHeader) {
324
338
  if (currentSelectedRange && !this.selection.isMultiple()) {
325
- this.view.scrollViewport(visualToRenderableCoords(currentSelectedRange.from));
339
+ const {
340
+ row,
341
+ col
342
+ } = currentSelectedRange.from;
343
+ if (row < 0 && col >= 0) {
344
+ this.scrollViewportTo({
345
+ col
346
+ });
347
+ } else if (col < 0 && row >= 0) {
348
+ this.scrollViewportTo({
349
+ row
350
+ });
351
+ } else {
352
+ this.scrollViewportTo({
353
+ row,
354
+ col
355
+ });
356
+ }
326
357
  } else {
327
- this.view.scrollViewport(visualToRenderableCoords(cellCoords));
358
+ this.scrollViewportTo(cellCoords.toObject());
328
359
  }
329
360
  } else if (isSelectedByRowHeader) {
330
- this.view.scrollViewportVertically(instance.rowIndexMapper.getRenderableFromVisualIndex(cellCoords.row));
361
+ this.scrollViewportTo({
362
+ row: cellCoords.row
363
+ });
331
364
  } else if (isSelectedByColumnHeader) {
332
- this.view.scrollViewportHorizontally(instance.columnIndexMapper.getRenderableFromVisualIndex(cellCoords.col));
365
+ this.scrollViewportTo({
366
+ col: cellCoords.col
367
+ });
333
368
  }
334
369
  }
335
370
 
@@ -364,6 +399,30 @@ export default function Core(rootElement, userSettings) {
364
399
  isMultiple.value = changedIsMultiple;
365
400
  }
366
401
  });
402
+ this.selection.addLocalHook('beforeSelectColumns', function () {
403
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
404
+ args[_key] = arguments[_key];
405
+ }
406
+ return _this.runHooks('beforeSelectColumns', ...args);
407
+ });
408
+ this.selection.addLocalHook('afterSelectColumns', function () {
409
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
410
+ args[_key2] = arguments[_key2];
411
+ }
412
+ return _this.runHooks('afterSelectColumns', ...args);
413
+ });
414
+ this.selection.addLocalHook('beforeSelectRows', function () {
415
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
416
+ args[_key3] = arguments[_key3];
417
+ }
418
+ return _this.runHooks('beforeSelectRows', ...args);
419
+ });
420
+ this.selection.addLocalHook('afterSelectRows', function () {
421
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
422
+ args[_key4] = arguments[_key4];
423
+ }
424
+ return _this.runHooks('afterSelectRows', ...args);
425
+ });
367
426
  this.selection.addLocalHook('beforeModifyTransformStart', cellCoordsDelta => {
368
427
  this.runHooks('modifyTransformStart', cellCoordsDelta);
369
428
  });
@@ -469,7 +528,9 @@ export default function Core(rootElement, userSettings) {
469
528
  const currentFromRow = currentFromRange === null || currentFromRange === void 0 ? void 0 : currentFromRange.row;
470
529
  const startVisualRowIndex = instance.toVisualRow(startRowPhysicalIndex);
471
530
  if (selection.isSelectedByCorner()) {
472
- instance.selectAll();
531
+ selection.selectAll(true, true, {
532
+ disableHeadersHighlight: true
533
+ });
473
534
  } else if (isDefined(currentFromRow) && currentFromRow >= startVisualRowIndex) {
474
535
  // Moving the selection (if it exists) downward – it should be applied to the "old" row.
475
536
  // TODO: The logic here should be handled by selection module.
@@ -523,7 +584,9 @@ export default function Core(rootElement, userSettings) {
523
584
  const currentFromColumn = currentFromRange === null || currentFromRange === void 0 ? void 0 : currentFromRange.col;
524
585
  const startVisualColumnIndex = instance.toVisualColumn(startColumnPhysicalIndex);
525
586
  if (selection.isSelectedByCorner()) {
526
- instance.selectAll();
587
+ selection.selectAll(true, true, {
588
+ disableHeadersHighlight: true
589
+ });
527
590
  } else if (isDefined(currentFromColumn) && currentFromColumn >= startVisualColumnIndex) {
528
591
  // Moving the selection (if it exists) rightward – it should be applied to the "old" column.
529
592
  // TODO: The logic here should be handled by selection module.
@@ -1013,6 +1076,10 @@ export default function Core(rootElement, userSettings) {
1013
1076
  this.updateSettings(tableMeta, true);
1014
1077
  this.view = new TableView(this);
1015
1078
  editorManager = EditorManager.getInstance(instance, tableMeta, selection);
1079
+ focusManager = new FocusManager(instance);
1080
+ if (isRootInstance(this)) {
1081
+ installFocusCatcher(instance);
1082
+ }
1016
1083
  instance.runHooks('init');
1017
1084
  this.forceFullRender = true; // used when data was changed
1018
1085
  this.view.render();
@@ -1426,6 +1493,11 @@ export default function Core(rootElement, userSettings) {
1426
1493
  */
1427
1494
  this.listen = function () {
1428
1495
  if (instance && !instance.isListening()) {
1496
+ foreignHotInstances.forEach(foreignHot => {
1497
+ if (instance !== foreignHot) {
1498
+ foreignHot.unlisten();
1499
+ }
1500
+ });
1429
1501
  activeGuid = instance.guid;
1430
1502
  instance.runHooks('afterListen');
1431
1503
  }
@@ -1510,8 +1582,8 @@ export default function Core(rootElement, userSettings) {
1510
1582
  * @returns {Array} Returns removed portion of columns.
1511
1583
  */
1512
1584
  this.spliceCol = function (column, index, amount) {
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];
1585
+ for (var _len5 = arguments.length, elements = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
1586
+ elements[_key5 - 3] = arguments[_key5];
1515
1587
  }
1516
1588
  return datamap.spliceCol(column, index, amount, ...elements);
1517
1589
  };
@@ -1528,8 +1600,8 @@ export default function Core(rootElement, userSettings) {
1528
1600
  * @returns {Array} Returns removed portion of rows.
1529
1601
  */
1530
1602
  this.spliceRow = function (row, index, amount) {
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];
1603
+ for (var _len6 = arguments.length, elements = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
1604
+ elements[_key6 - 3] = arguments[_key6];
1533
1605
  }
1534
1606
  return datamap.spliceRow(row, index, amount, ...elements);
1535
1607
  };
@@ -1626,6 +1698,9 @@ export default function Core(rootElement, userSettings) {
1626
1698
  }
1627
1699
  const changes = [];
1628
1700
  arrayEach(selection.getSelectedRange(), cellRange => {
1701
+ if (cellRange.isSingleHeader()) {
1702
+ return;
1703
+ }
1629
1704
  const topStart = cellRange.getTopStartCorner();
1630
1705
  const bottomEnd = cellRange.getBottomEndCorner();
1631
1706
  rangeEach(topStart.row, bottomEnd.row, row => {
@@ -2923,8 +2998,8 @@ export default function Core(rootElement, userSettings) {
2923
2998
  */
2924
2999
  this.spliceCellsMeta = function (visualIndex) {
2925
3000
  let deleteAmount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
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];
3001
+ for (var _len7 = arguments.length, cellMetaRows = new Array(_len7 > 2 ? _len7 - 2 : 0), _key7 = 2; _key7 < _len7; _key7++) {
3002
+ cellMetaRows[_key7 - 2] = arguments[_key7];
2928
3003
  }
2929
3004
  if (cellMetaRows.length > 0 && !Array.isArray(cellMetaRows[0])) {
2930
3005
  throw new Error('The 3rd argument (cellMetaRows) has to be passed as an array of cell meta objects array.');
@@ -3615,6 +3690,30 @@ export default function Core(rootElement, userSettings) {
3615
3690
  return instance.view._wt.drawn ? instance.view._wt.wtTable.getVisibleColumnsCount() : -1;
3616
3691
  };
3617
3692
 
3693
+ /**
3694
+ * Returns the number of rendered row headers.
3695
+ *
3696
+ * @since 14.0.0
3697
+ * @memberof Core#
3698
+ * @function countRowHeaders
3699
+ * @returns {number} Number of row headers.
3700
+ */
3701
+ this.countRowHeaders = function () {
3702
+ return this.view.getRowHeadersCount();
3703
+ };
3704
+
3705
+ /**
3706
+ * Returns the number of rendered column headers.
3707
+ *
3708
+ * @since 14.0.0
3709
+ * @memberof Core#
3710
+ * @function countColHeaders
3711
+ * @returns {number} Number of column headers.
3712
+ */
3713
+ this.countColHeaders = function () {
3714
+ return this.view.getColumnHeadersCount();
3715
+ };
3716
+
3618
3717
  /**
3619
3718
  * Returns the number of empty rows. If the optional ending parameter is `true`, returns the
3620
3719
  * number of empty rows at the bottom of the table.
@@ -3819,6 +3918,10 @@ export default function Core(rootElement, userSettings) {
3819
3918
  * hot.selectColumns('id');
3820
3919
  * // Select range of columns using visual indexes.
3821
3920
  * hot.selectColumns(1, 4);
3921
+ * // Select range of columns using visual indexes and mark the first header as highlighted.
3922
+ * hot.selectColumns(1, 2, -1);
3923
+ * // Select range of columns using visual indexes and mark the second cell as highlighted.
3924
+ * hot.selectColumns(2, 1, 1);
3822
3925
  * // Select range of columns using column properties.
3823
3926
  * hot.selectColumns('id', 'last_name');
3824
3927
  * ```
@@ -3829,11 +3932,15 @@ export default function Core(rootElement, userSettings) {
3829
3932
  * @param {number} startColumn The visual column index from which the selection starts.
3830
3933
  * @param {number} [endColumn=startColumn] The visual column index to which the selection finishes. If `endColumn`
3831
3934
  * is not defined the column defined by `startColumn` will be selected.
3935
+ * @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
3936
+ * The value can take visual row index from -N to N, where negative values
3937
+ * point to the headers and positive values point to the cell range.
3832
3938
  * @returns {boolean} `true` if selection was successful, `false` otherwise.
3833
3939
  */
3834
3940
  this.selectColumns = function (startColumn) {
3835
3941
  let endColumn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startColumn;
3836
- return selection.selectColumns(startColumn, endColumn);
3942
+ let focusPosition = arguments.length > 2 ? arguments[2] : undefined;
3943
+ return selection.selectColumns(startColumn, endColumn, focusPosition);
3837
3944
  };
3838
3945
 
3839
3946
  /**
@@ -3843,8 +3950,12 @@ export default function Core(rootElement, userSettings) {
3843
3950
  * ```js
3844
3951
  * // Select row using visual index.
3845
3952
  * hot.selectRows(1);
3846
- * // Select range of rows using visual indexes.
3953
+ * // select a range of rows, using visual indexes.
3847
3954
  * hot.selectRows(1, 4);
3955
+ * // select a range of rows, using visual indexes, and mark the header as highlighted.
3956
+ * hot.selectRows(1, 2, -1);
3957
+ * // Select range of rows using visual indexes and mark the second cell as highlighted.
3958
+ * hot.selectRows(2, 1, 1);
3848
3959
  * ```
3849
3960
  *
3850
3961
  * @memberof Core#
@@ -3853,11 +3964,15 @@ export default function Core(rootElement, userSettings) {
3853
3964
  * @param {number} startRow The visual row index from which the selection starts.
3854
3965
  * @param {number} [endRow=startRow] The visual row index to which the selection finishes. If `endRow`
3855
3966
  * is not defined the row defined by `startRow` will be selected.
3967
+ * @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
3968
+ * The value can take visual column index from -N to N, where negative values
3969
+ * point to the headers and positive values point to the cell range.
3856
3970
  * @returns {boolean} `true` if selection was successful, `false` otherwise.
3857
3971
  */
3858
3972
  this.selectRows = function (startRow) {
3859
3973
  let endRow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startRow;
3860
- return selection.selectRows(startRow, endRow);
3974
+ let focusPosition = arguments.length > 2 ? arguments[2] : undefined;
3975
+ return selection.selectRows(startRow, endRow, focusPosition);
3861
3976
  };
3862
3977
 
3863
3978
  /**
@@ -3876,9 +3991,16 @@ export default function Core(rootElement, userSettings) {
3876
3991
  * The previous selection is overwritten.
3877
3992
  *
3878
3993
  * ```js
3879
- * // select all cells in the table, including all headers
3994
+ * // select all cells in the table, including all headers and the corner cell
3880
3995
  * hot.selectAll();
3881
3996
  *
3997
+ * // select all cells in the table, including row headers but excluding the corner cell
3998
+ * hot.selectAll(true, false);
3999
+ *
4000
+ * // select all cells in the table, including all headers and the corner cell, but move the focus
4001
+ * // highlight to position -2, -1
4002
+ * hot.selectAll(-2, -1);
4003
+ *
3882
4004
  * // select all cells in the table, without headers
3883
4005
  * hot.selectAll(false);
3884
4006
  * ```
@@ -3886,15 +4008,25 @@ export default function Core(rootElement, userSettings) {
3886
4008
  * @since 0.38.2
3887
4009
  * @memberof Core#
3888
4010
  * @function selectAll
3889
- * @param {boolean} [includeHeaders=true] `true`: include all row, column and corner headers.
3890
- * `false`: don't include any headers.
4011
+ * @param {boolean} [includeRowHeaders=false] `true` If the selection should include the row headers,
4012
+ * `false` otherwise.
4013
+ * @param {boolean} [includeColumnHeaders=false] `true` If the selection should include the column
4014
+ * headers, `false` otherwise.
4015
+ *
4016
+ * @param {object} [options] Additional object with options.
4017
+ * @param {{row: number, col: number} | boolean} [options.focusPosition] The argument allows changing the cell/header
4018
+ * focus position. The value takes an object with a `row` and `col` properties from -N to N, where
4019
+ * negative values point to the headers and positive values point to the cell range. If `false`, the focus
4020
+ * position won't be changed.
4021
+ * @param {boolean} [options.disableHeadersHighlight] If `true`, disables highlighting the headers even when
4022
+ * the logical coordinates points on them.
3891
4023
  */
3892
4024
  this.selectAll = function () {
3893
- let includeHeaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
3894
- const includeRowHeaders = includeHeaders && this.hasRowHeaders();
3895
- const includeColumnHeaders = includeHeaders && this.hasColHeaders();
4025
+ let includeRowHeaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
4026
+ let includeColumnHeaders = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : includeRowHeaders;
4027
+ let options = arguments.length > 2 ? arguments[2] : undefined;
3896
4028
  preventScrollingToCell = true;
3897
- selection.selectAll(includeRowHeaders, includeColumnHeaders);
4029
+ selection.selectAll(includeRowHeaders, includeColumnHeaders, options);
3898
4030
  preventScrollingToCell = false;
3899
4031
  };
3900
4032
  const getIndexToScroll = (indexMapper, visualIndex) => {
@@ -3903,55 +4035,117 @@ export default function Core(rootElement, userSettings) {
3903
4035
  };
3904
4036
 
3905
4037
  /**
3906
- * Scroll viewport to coordinates specified by the `row` and `column` arguments.
4038
+ * Scroll viewport to coordinates specified by the `row` and/or `col` object properties.
4039
+ *
4040
+ * ```js
4041
+ * // scroll the viewport to the visual row index (leave the horizontal scroll untouched)
4042
+ * hot.scrollViewportTo({ row: 50 });
4043
+ *
4044
+ * // scroll the viewport to the passed coordinates so that the cell at 50, 50 will be snapped to
4045
+ * // the bottom-end table's edge.
4046
+ * hot.scrollViewportTo({
4047
+ * row: 50,
4048
+ * col: 50,
4049
+ * verticalSnap: 'bottom',
4050
+ * horizontalSnap: 'end',
4051
+ * });
4052
+ * ```
3907
4053
  *
3908
4054
  * @memberof Core#
3909
4055
  * @function scrollViewportTo
3910
- * @param {number} [row] Row index. If the last argument isn't defined we treat the index as a visual row index. Otherwise,
3911
- * we are using the index for numbering only this rows which may be rendered (we don't consider hidden rows).
3912
- * @param {number} [column] Column index. If the last argument isn't defined we treat the index as a visual column index.
3913
- * Otherwise, we are using the index for numbering only this columns which may be rendered (we don't consider hidden columns).
3914
- * @param {boolean} [snapToBottom=false] If `true`, the viewport is scrolled to show the cell at the bottom of the table.
3915
- * However, if the cell's height is greater than the table's viewport height, the cell is snapped to the top edge.
3916
- * @param {boolean} [snapToRight=false] If `true`, the viewport is scrolled to show the cell at the right side of the table.
3917
- * 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`).
3918
- * @param {boolean} [considerHiddenIndexes=true] If `true`, we handle visual indexes, otherwise we handle only indexes which
4056
+ * @param {object} options A dictionary containing the following parameters:
4057
+ * @param {number} [options.row] Specifies the number of visual rows along the Y axis to scroll the viewport.
4058
+ * @param {number} [options.col] Specifies the number of visual columns along the X axis to scroll the viewport.
4059
+ * @param {'top' | 'bottom'} [options.verticalSnap] Determines to which edge of the table the viewport will be scrolled based on the passed coordinates.
4060
+ * This option is a string which must take one of the following values:
4061
+ * - `top`: The viewport will be scrolled to a row in such a way that it will be positioned on the top of the viewport;
4062
+ * - `bottom`: The viewport will be scrolled to a row in such a way that it will be positioned on the bottom of the viewport;
4063
+ * - If the property is not defined the vertical auto-snapping is enabled. Depending on where the viewport is scrolled from, a row will
4064
+ * be positioned at the top or bottom of the viewport.
4065
+ * @param {'start' | 'end'} [options.horizontalSnap] Determines to which edge of the table the viewport will be scrolled based on the passed coordinates.
4066
+ * This option is a string which must take one of the following values:
4067
+ * - `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;
4068
+ * - `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;
4069
+ * - If the property is not defined the horizontal auto-snapping is enabled. Depending on where the viewport is scrolled from, a column will
4070
+ * be positioned at the start or end of the viewport.
4071
+ * @param {boolean} [options.considerHiddenIndexes=true] If `true`, we handle visual indexes, otherwise we handle only indexes which
3919
4072
  * may be rendered when they are in the viewport (we don't consider hidden indexes as they aren't rendered).
3920
- * @returns {boolean} `true` if scroll was successful, `false` otherwise.
3921
- */
3922
- this.scrollViewportTo = function (row, column) {
3923
- let snapToBottom = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
3924
- let snapToRight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
3925
- let considerHiddenIndexes = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
3926
- const snapToTop = !snapToBottom;
3927
- const snapToLeft = !snapToRight;
4073
+ * @returns {boolean} `true` if viewport was scrolled, `false` otherwise.
4074
+ */
4075
+ this.scrollViewportTo = function () {
4076
+ let {
4077
+ row,
4078
+ col,
4079
+ verticalSnap,
4080
+ horizontalSnap,
4081
+ considerHiddenIndexes
4082
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4083
+ let snapToTop;
4084
+ let snapToBottom;
4085
+ let snapToInlineStart;
4086
+ let snapToInlineEnd;
4087
+ if (verticalSnap !== undefined) {
4088
+ snapToTop = verticalSnap === 'top';
4089
+ snapToBottom = !snapToTop;
4090
+ }
4091
+ if (horizontalSnap !== undefined) {
4092
+ snapToInlineStart = horizontalSnap === 'start';
4093
+ snapToInlineEnd = !snapToInlineStart;
4094
+ }
3928
4095
  let renderableRow = row;
3929
- let renderableColumn = column;
3930
- if (considerHiddenIndexes) {
3931
- const isRowInteger = Number.isInteger(row);
3932
- const isColumnInteger = Number.isInteger(column);
3933
- const visualRowToScroll = isRowInteger ? getIndexToScroll(this.rowIndexMapper, row) : void 0;
3934
- const visualColumnToScroll = isColumnInteger ? getIndexToScroll(this.columnIndexMapper, column) : void 0;
4096
+ let renderableColumn = col;
4097
+ if (considerHiddenIndexes === undefined || considerHiddenIndexes) {
4098
+ const isValidRowGrid = Number.isInteger(row) && row >= 0;
4099
+ const isValidColumnGrid = Number.isInteger(col) && col >= 0;
4100
+ const visualRowToScroll = isValidRowGrid ? getIndexToScroll(this.rowIndexMapper, row) : undefined;
4101
+ const visualColumnToScroll = isValidColumnGrid ? getIndexToScroll(this.columnIndexMapper, col) : undefined;
3935
4102
  if (visualRowToScroll === null || visualColumnToScroll === null) {
3936
4103
  return false;
3937
4104
  }
3938
- renderableRow = isRowInteger ? instance.rowIndexMapper.getRenderableFromVisualIndex(visualRowToScroll) : void 0;
3939
- renderableColumn = isColumnInteger ? instance.columnIndexMapper.getRenderableFromVisualIndex(visualColumnToScroll) : void 0;
4105
+ renderableRow = isValidRowGrid ? instance.rowIndexMapper.getRenderableFromVisualIndex(visualRowToScroll) : row;
4106
+ renderableColumn = isValidColumnGrid ? instance.columnIndexMapper.getRenderableFromVisualIndex(visualColumnToScroll) : col;
3940
4107
  }
3941
4108
  const isRowInteger = Number.isInteger(renderableRow);
3942
4109
  const isColumnInteger = Number.isInteger(renderableColumn);
3943
- if (isRowInteger && isColumnInteger) {
3944
- return instance.view.scrollViewport(instance._createCellCoords(renderableRow, renderableColumn), snapToTop, snapToRight, snapToBottom, snapToLeft);
4110
+ if (isRowInteger && renderableRow >= 0 && isColumnInteger && renderableColumn >= 0) {
4111
+ return instance.view.scrollViewport(instance._createCellCoords(renderableRow, renderableColumn), snapToTop, snapToInlineEnd, snapToBottom, snapToInlineStart);
3945
4112
  }
3946
- if (isRowInteger && isColumnInteger === false) {
4113
+ if (isRowInteger && renderableRow >= 0 && (isColumnInteger && renderableColumn < 0 || !isColumnInteger)) {
3947
4114
  return instance.view.scrollViewportVertically(renderableRow, snapToTop, snapToBottom);
3948
4115
  }
3949
- if (isColumnInteger && isRowInteger === false) {
3950
- return instance.view.scrollViewportHorizontally(renderableColumn, snapToRight, snapToLeft);
4116
+ if (isColumnInteger && renderableColumn >= 0 && (isRowInteger && renderableRow < 0 || !isRowInteger)) {
4117
+ return instance.view.scrollViewportHorizontally(renderableColumn, snapToInlineEnd, snapToInlineStart);
3951
4118
  }
3952
4119
  return false;
3953
4120
  };
3954
4121
 
4122
+ /**
4123
+ * Scrolls the viewport to coordinates specified by the currently focused cell.
4124
+ *
4125
+ * @since 14.0.0
4126
+ * @memberof Core#
4127
+ * @fires Hooks#afterScroll
4128
+ * @function scrollToFocusedCell
4129
+ * @param {Function} callback The callback function to call after the viewport is scrolled.
4130
+ */
4131
+ this.scrollToFocusedCell = function () {
4132
+ let callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : () => {};
4133
+ if (!this.selection.isSelected()) {
4134
+ return;
4135
+ }
4136
+ this.addHookOnce('afterScroll', callback);
4137
+ const {
4138
+ highlight
4139
+ } = this.getSelectedRangeLast();
4140
+ const isScrolled = this.scrollViewportTo(highlight.toObject());
4141
+ if (isScrolled) {
4142
+ this.view.render();
4143
+ } else {
4144
+ this.removeHook('afterScroll', callback);
4145
+ this._registerImmediate(() => callback());
4146
+ }
4147
+ };
4148
+
3955
4149
  /**
3956
4150
  * Removes the table from the DOM and destroys the instance of the Handsontable.
3957
4151
  *
@@ -3972,6 +4166,7 @@ export default function Core(rootElement, userSettings) {
3972
4166
  dataSource = null;
3973
4167
  this.getShortcutManager().destroy();
3974
4168
  metaManager.clearCache();
4169
+ foreignHotInstances.delete(this.guid);
3975
4170
  if (isRootInstance(instance)) {
3976
4171
  const licenseInfo = this.rootDocument.querySelector('.hot-display-license-info');
3977
4172
  if (licenseInfo) {
@@ -4295,6 +4490,16 @@ export default function Core(rootElement, userSettings) {
4295
4490
  }
4296
4491
  };
4297
4492
 
4493
+ /**
4494
+ * Gets the instance of the EditorManager.
4495
+ *
4496
+ * @private
4497
+ * @returns {EditorManager}
4498
+ */
4499
+ this._getEditorManager = function () {
4500
+ return editorManager;
4501
+ };
4502
+
4298
4503
  /**
4299
4504
  * Check if currently it is RTL direction.
4300
4505
  *
@@ -4365,270 +4570,23 @@ export default function Core(rootElement, userSettings) {
4365
4570
  this.getShortcutManager = function () {
4366
4571
  return shortcutManager;
4367
4572
  };
4368
- const gridContext = shortcutManager.addContext('grid');
4369
- const gridConfig = {
4370
- runOnlyIf: () => {
4371
- return isDefined(instance.getSelected()) && instance.countRenderedRows() > 0 && instance.countRenderedCols() > 0;
4372
- },
4373
- group: SHORTCUTS_GROUP
4573
+
4574
+ /**
4575
+ * Return the Focus Manager responsible for managing the browser's focus in the table.
4576
+ *
4577
+ * @memberof Core#
4578
+ * @since 14.0.0
4579
+ * @function getFocusManager
4580
+ * @returns {FocusManager}
4581
+ */
4582
+ this.getFocusManager = function () {
4583
+ return focusManager;
4374
4584
  };
4375
- shortcutManager.setActiveContextName('grid');
4376
- gridContext.addShortcuts([{
4377
- keys: [['Control/Meta', 'A']],
4378
- callback: () => {
4379
- instance.selectAll();
4380
- }
4381
- }, {
4382
- keys: [['Control/Meta', 'Enter']],
4383
- callback: () => {
4384
- const selectedRange = instance.getSelectedRange();
4385
- const {
4386
- row: highlightRow,
4387
- col: highlightColumn
4388
- } = selectedRange[selectedRange.length - 1].highlight;
4389
- const valueToPopulate = instance.getDataAtCell(highlightRow, highlightColumn);
4390
- const cellValues = new Map();
4391
- for (let i = 0; i < selectedRange.length; i++) {
4392
- selectedRange[i].forAll((row, column) => {
4393
- if (row >= 0 && column >= 0 && (row !== highlightRow || column !== highlightColumn)) {
4394
- const {
4395
- readOnly
4396
- } = instance.getCellMeta(row, column);
4397
- if (!readOnly) {
4398
- cellValues.set(`${row}x${column}`, [row, column, valueToPopulate]);
4399
- }
4400
- }
4401
- });
4402
- }
4403
- instance.setDataAtCell(Array.from(cellValues.values()));
4404
- },
4405
- runOnlyIf: () => instance.getSelectedRangeLast().getCellsCount() > 1
4406
- }, {
4407
- keys: [['ArrowUp']],
4408
- callback: () => {
4409
- selection.transformStart(-1, 0);
4410
- }
4411
- }, {
4412
- keys: [['ArrowUp', 'Control/Meta']],
4413
- captureCtrl: true,
4414
- callback: () => {
4415
- selection.setRangeStart(instance._createCellCoords(instance.rowIndexMapper.getNearestNotHiddenIndex(0, 1), instance.getSelectedRangeLast().highlight.col));
4416
- }
4417
- }, {
4418
- keys: [['ArrowUp', 'Shift']],
4419
- callback: () => {
4420
- selection.transformEnd(-1, 0);
4421
- }
4422
- }, {
4423
- keys: [['ArrowUp', 'Shift', 'Control/Meta']],
4424
- captureCtrl: true,
4425
- callback: () => {
4426
- const {
4427
- from,
4428
- to
4429
- } = instance.getSelectedRangeLast();
4430
- const row = instance.rowIndexMapper.getNearestNotHiddenIndex(0, 1);
4431
- selection.setRangeStart(from.clone());
4432
- selection.setRangeEnd(instance._createCellCoords(row, to.col));
4433
- },
4434
- runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByColumnHeader())
4435
- }, {
4436
- keys: [['ArrowDown']],
4437
- callback: () => {
4438
- selection.transformStart(1, 0);
4439
- }
4440
- }, {
4441
- keys: [['ArrowDown', 'Control/Meta']],
4442
- captureCtrl: true,
4443
- callback: () => {
4444
- selection.setRangeStart(instance._createCellCoords(instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - 1, -1), instance.getSelectedRangeLast().highlight.col));
4445
- }
4446
- }, {
4447
- keys: [['ArrowDown', 'Shift']],
4448
- callback: () => {
4449
- selection.transformEnd(1, 0);
4450
- }
4451
- }, {
4452
- keys: [['ArrowDown', 'Shift', 'Control/Meta']],
4453
- captureCtrl: true,
4454
- callback: () => {
4455
- const {
4456
- from,
4457
- to
4458
- } = instance.getSelectedRangeLast();
4459
- const row = instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - 1, -1);
4460
- selection.setRangeStart(from.clone());
4461
- selection.setRangeEnd(instance._createCellCoords(row, to.col));
4462
- },
4463
- runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByColumnHeader())
4464
- }, {
4465
- keys: [['ArrowLeft']],
4466
- callback: () => {
4467
- selection.transformStart(0, -1 * instance.getDirectionFactor());
4468
- }
4469
- }, {
4470
- keys: [['ArrowLeft', 'Control/Meta']],
4471
- captureCtrl: true,
4472
- callback: () => {
4473
- const row = instance.getSelectedRangeLast().highlight.row;
4474
- const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
4475
- selection.setRangeStart(instance._createCellCoords(row, column));
4476
- }
4477
- }, {
4478
- keys: [['ArrowLeft', 'Shift']],
4479
- callback: () => {
4480
- selection.transformEnd(0, -1 * instance.getDirectionFactor());
4481
- }
4482
- }, {
4483
- keys: [['ArrowLeft', 'Shift', 'Control/Meta']],
4484
- captureCtrl: true,
4485
- callback: () => {
4486
- const {
4487
- from,
4488
- to
4489
- } = instance.getSelectedRangeLast();
4490
- const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
4491
- selection.setRangeStart(from.clone());
4492
- selection.setRangeEnd(instance._createCellCoords(to.row, column));
4493
- },
4494
- runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByRowHeader())
4495
- }, {
4496
- keys: [['ArrowRight']],
4497
- callback: () => {
4498
- selection.transformStart(0, instance.getDirectionFactor());
4499
- }
4500
- }, {
4501
- keys: [['ArrowRight', 'Control/Meta']],
4502
- captureCtrl: true,
4503
- callback: () => {
4504
- const row = instance.getSelectedRangeLast().highlight.row;
4505
- const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
4506
- selection.setRangeStart(instance._createCellCoords(row, column));
4507
- }
4508
- }, {
4509
- keys: [['ArrowRight', 'Shift']],
4510
- callback: () => {
4511
- selection.transformEnd(0, instance.getDirectionFactor());
4512
- }
4513
- }, {
4514
- keys: [['ArrowRight', 'Shift', 'Control/Meta']],
4515
- captureCtrl: true,
4516
- callback: () => {
4517
- const {
4518
- from,
4519
- to
4520
- } = instance.getSelectedRangeLast();
4521
- const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
4522
- selection.setRangeStart(from.clone());
4523
- selection.setRangeEnd(instance._createCellCoords(to.row, column));
4524
- },
4525
- runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByRowHeader())
4526
- }, {
4527
- keys: [['Home']],
4528
- captureCtrl: true,
4529
- callback: () => {
4530
- const fixedColumns = parseInt(instance.getSettings().fixedColumnsStart, 10);
4531
- const row = instance.getSelectedRangeLast().highlight.row;
4532
- const column = instance.columnIndexMapper.getNearestNotHiddenIndex(fixedColumns, 1);
4533
- selection.setRangeStart(instance._createCellCoords(row, column));
4534
- },
4535
- runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
4536
- }, {
4537
- keys: [['Home', 'Shift']],
4538
- callback: () => {
4539
- selection.setRangeEnd(instance._createCellCoords(selection.selectedRange.current().from.row, instance.columnIndexMapper.getNearestNotHiddenIndex(0, 1)));
4540
- }
4541
- }, {
4542
- keys: [['Home', 'Control/Meta']],
4543
- captureCtrl: true,
4544
- callback: () => {
4545
- const fixedRows = parseInt(instance.getSettings().fixedRowsTop, 10);
4546
- const fixedColumns = parseInt(instance.getSettings().fixedColumnsStart, 10);
4547
- const row = instance.rowIndexMapper.getNearestNotHiddenIndex(fixedRows, 1);
4548
- const column = instance.columnIndexMapper.getNearestNotHiddenIndex(fixedColumns, 1);
4549
- selection.setRangeStart(instance._createCellCoords(row, column));
4550
- },
4551
- runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
4552
- }, {
4553
- keys: [['End']],
4554
- captureCtrl: true,
4555
- callback: () => {
4556
- selection.setRangeStart(instance._createCellCoords(instance.getSelectedRangeLast().highlight.row, instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1)));
4557
- },
4558
- runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
4559
- }, {
4560
- keys: [['End', 'Shift']],
4561
- callback: () => {
4562
- selection.setRangeEnd(instance._createCellCoords(selection.selectedRange.current().from.row, instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1)));
4563
- }
4564
- }, {
4565
- keys: [['End', 'Control/Meta']],
4566
- captureCtrl: true,
4567
- callback: () => {
4568
- const fixedRows = parseInt(instance.getSettings().fixedRowsBottom, 10);
4569
- const row = instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - fixedRows - 1, -1);
4570
- const column = instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1);
4571
- selection.setRangeStart(instance._createCellCoords(row, column));
4572
- },
4573
- runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
4574
- }, {
4575
- keys: [['PageUp']],
4576
- callback: () => {
4577
- selection.transformStart(-instance.countVisibleRows(), 0);
4578
- }
4579
- }, {
4580
- keys: [['PageUp', 'Shift']],
4581
- callback: () => {
4582
- const {
4583
- to
4584
- } = instance.getSelectedRangeLast();
4585
- const nextRowIndexToSelect = Math.max(to.row - instance.countVisibleRows(), 0);
4586
- const row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, 1);
4587
- if (row !== null) {
4588
- const coords = instance._createCellCoords(row, to.col);
4589
- const scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
4590
- const nextVerticalScroll = Math.max(coords.row - scrollPadding, 0);
4591
- selection.setRangeEnd(coords);
4592
- instance.scrollViewportTo(nextVerticalScroll);
4593
- }
4594
- }
4595
- }, {
4596
- keys: [['PageDown']],
4597
- callback: () => {
4598
- selection.transformStart(instance.countVisibleRows(), 0);
4599
- }
4600
- }, {
4601
- keys: [['PageDown', 'Shift']],
4602
- callback: () => {
4603
- const {
4604
- to
4605
- } = instance.getSelectedRangeLast();
4606
- const nextRowIndexToSelect = Math.min(to.row + instance.countVisibleRows(), instance.countRows() - 1);
4607
- const row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, -1);
4608
- if (row !== null) {
4609
- const coords = instance._createCellCoords(row, to.col);
4610
- const scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
4611
- const nextVerticalScroll = Math.min(coords.row - scrollPadding, instance.countRows() - 1);
4612
- selection.setRangeEnd(coords);
4613
- instance.scrollViewportTo(nextVerticalScroll);
4614
- }
4615
- }
4616
- }, {
4617
- keys: [['Tab']],
4618
- callback: event => {
4619
- const tabMoves = typeof tableMeta.tabMoves === 'function' ? tableMeta.tabMoves(event) : tableMeta.tabMoves;
4620
- selection.transformStart(tabMoves.row, tabMoves.col, true);
4621
- }
4622
- }, {
4623
- keys: [['Shift', 'Tab']],
4624
- callback: event => {
4625
- const tabMoves = typeof tableMeta.tabMoves === 'function' ? tableMeta.tabMoves(event) : tableMeta.tabMoves;
4626
- selection.transformStart(-tabMoves.row, -tabMoves.col);
4627
- }
4628
- }], gridConfig);
4629
4585
  getPluginsNames().forEach(pluginName => {
4630
4586
  const PluginClass = getPlugin(pluginName);
4631
4587
  pluginsRegistry.addItem(pluginName, new PluginClass(this));
4632
4588
  });
4589
+ registerAllShortcutContexts(instance);
4590
+ shortcutManager.setActiveContextName('grid');
4633
4591
  Hooks.getSingleton().run(instance, 'construct');
4634
4592
  }