handsontable 0.0.0-next-b66c79f-20230713 → 0.0.0-next-08765b9-20230714

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