handsontable 0.0.0-next-a1e4b4f-20230628 → 0.0.0-next-e697250-20230707

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 (456) hide show
  1. package/3rdparty/walkontable/src/cell/coords.d.ts +6 -1
  2. package/3rdparty/walkontable/src/cell/coords.js +50 -28
  3. package/3rdparty/walkontable/src/cell/coords.mjs +50 -28
  4. package/3rdparty/walkontable/src/cell/range.d.ts +9 -2
  5. package/3rdparty/walkontable/src/cell/range.js +69 -36
  6. package/3rdparty/walkontable/src/cell/range.mjs +68 -35
  7. package/3rdparty/walkontable/src/event.js +3 -5
  8. package/3rdparty/walkontable/src/event.mjs +3 -5
  9. package/3rdparty/walkontable/src/overlay/_base.js +6 -7
  10. package/3rdparty/walkontable/src/overlay/_base.mjs +6 -7
  11. package/3rdparty/walkontable/src/overlay/bottom.js +6 -7
  12. package/3rdparty/walkontable/src/overlay/bottom.mjs +6 -7
  13. package/3rdparty/walkontable/src/overlay/top.js +6 -7
  14. package/3rdparty/walkontable/src/overlay/top.mjs +6 -7
  15. package/3rdparty/walkontable/src/overlay/topInlineStartCorner.js +10 -12
  16. package/3rdparty/walkontable/src/overlay/topInlineStartCorner.mjs +10 -12
  17. package/3rdparty/walkontable/src/overlays.js +55 -64
  18. package/3rdparty/walkontable/src/overlays.mjs +55 -64
  19. package/3rdparty/walkontable/src/renderer/table.js +0 -2
  20. package/3rdparty/walkontable/src/renderer/table.mjs +0 -2
  21. package/3rdparty/walkontable/src/scroll.js +20 -23
  22. package/3rdparty/walkontable/src/scroll.mjs +20 -23
  23. package/3rdparty/walkontable/src/selection/border/border.js +1 -0
  24. package/3rdparty/walkontable/src/selection/border/border.mjs +1 -0
  25. package/3rdparty/walkontable/src/selection/manager.js +40 -45
  26. package/3rdparty/walkontable/src/selection/manager.mjs +33 -38
  27. package/3rdparty/walkontable/src/selection/scanner.js +5 -4
  28. package/3rdparty/walkontable/src/selection/scanner.mjs +1 -0
  29. package/3rdparty/walkontable/src/settings.js +13 -15
  30. package/3rdparty/walkontable/src/settings.mjs +13 -15
  31. package/3rdparty/walkontable/src/table.js +23 -26
  32. package/3rdparty/walkontable/src/table.mjs +23 -26
  33. package/CHANGELOG.md +56 -0
  34. package/base.js +2 -4
  35. package/base.mjs +2 -2
  36. package/common.d.ts +1 -1
  37. package/core.d.ts +7 -9
  38. package/core.js +241 -439
  39. package/core.mjs +245 -443
  40. package/dataMap/dataMap.js +1 -0
  41. package/dataMap/dataMap.mjs +1 -0
  42. package/dataMap/dataSource.js +5 -5
  43. package/dataMap/dataSource.mjs +5 -5
  44. package/dataMap/metaManager/lazyFactoryMap.js +1 -0
  45. package/dataMap/metaManager/lazyFactoryMap.mjs +1 -0
  46. package/dataMap/metaManager/metaLayers/cellMeta.js +1 -0
  47. package/dataMap/metaManager/metaLayers/cellMeta.mjs +1 -0
  48. package/dataMap/metaManager/metaSchema.js +33 -24
  49. package/dataMap/metaManager/metaSchema.mjs +33 -24
  50. package/dist/handsontable.css +25 -3
  51. package/dist/handsontable.full.css +25 -3
  52. package/dist/handsontable.full.js +14539 -11358
  53. package/dist/handsontable.full.min.css +5 -5
  54. package/dist/handsontable.full.min.js +137 -125
  55. package/dist/handsontable.js +31414 -28455
  56. package/dist/handsontable.min.css +5 -5
  57. package/dist/handsontable.min.js +11 -3
  58. package/dist/languages/all.js +133 -0
  59. package/dist/languages/ar-AR.js +7 -0
  60. package/dist/languages/cs-CZ.js +7 -0
  61. package/dist/languages/de-CH.js +7 -0
  62. package/dist/languages/de-DE.js +7 -0
  63. package/dist/languages/en-US.js +7 -0
  64. package/dist/languages/es-MX.js +7 -0
  65. package/dist/languages/fr-FR.js +7 -0
  66. package/dist/languages/it-IT.js +7 -0
  67. package/dist/languages/ja-JP.js +7 -0
  68. package/dist/languages/ko-KR.js +7 -0
  69. package/dist/languages/lv-LV.js +7 -0
  70. package/dist/languages/nb-NO.js +7 -0
  71. package/dist/languages/nl-NL.js +7 -0
  72. package/dist/languages/pl-PL.js +7 -0
  73. package/dist/languages/pt-BR.js +7 -0
  74. package/dist/languages/ru-RU.js +7 -0
  75. package/dist/languages/sr-SP.js +7 -0
  76. package/dist/languages/zh-CN.js +7 -0
  77. package/dist/languages/zh-TW.js +7 -0
  78. package/editorManager.js +19 -89
  79. package/editorManager.mjs +24 -93
  80. package/editors/baseEditor/baseEditor.js +1 -0
  81. package/editors/baseEditor/baseEditor.mjs +1 -0
  82. package/editors/textEditor/textEditor.js +14 -20
  83. package/editors/textEditor/textEditor.mjs +16 -22
  84. package/helpers/dom/element.js +0 -11
  85. package/helpers/dom/element.mjs +0 -10
  86. package/helpers/mixed.js +2 -2
  87. package/helpers/mixed.mjs +2 -2
  88. package/helpers/number.d.ts +1 -0
  89. package/helpers/number.js +18 -0
  90. package/helpers/number.mjs +17 -0
  91. package/helpers/object.js +2 -0
  92. package/helpers/object.mjs +2 -0
  93. package/i18n/languages/ar-AR.js +7 -1
  94. package/i18n/languages/cs-CZ.js +7 -1
  95. package/i18n/languages/de-CH.js +7 -1
  96. package/i18n/languages/de-DE.js +7 -1
  97. package/i18n/languages/en-US.js +7 -1
  98. package/i18n/languages/es-MX.js +7 -1
  99. package/i18n/languages/fr-FR.js +7 -1
  100. package/i18n/languages/it-IT.js +7 -1
  101. package/i18n/languages/ja-JP.js +7 -1
  102. package/i18n/languages/ko-KR.js +7 -1
  103. package/i18n/languages/lv-LV.js +7 -1
  104. package/i18n/languages/nb-NO.js +7 -1
  105. package/i18n/languages/nl-NL.js +7 -1
  106. package/i18n/languages/pl-PL.js +7 -1
  107. package/i18n/languages/pt-BR.js +7 -1
  108. package/i18n/languages/ru-RU.js +7 -1
  109. package/i18n/languages/sr-SP.js +7 -1
  110. package/i18n/languages/zh-CN.js +7 -1
  111. package/i18n/languages/zh-TW.js +7 -1
  112. package/languages/all.js +133 -0
  113. package/languages/ar-AR.js +7 -0
  114. package/languages/cs-CZ.js +7 -0
  115. package/languages/de-CH.js +7 -0
  116. package/languages/de-DE.js +7 -0
  117. package/languages/en-US.js +7 -0
  118. package/languages/es-MX.js +7 -0
  119. package/languages/fr-FR.js +7 -0
  120. package/languages/index.js +133 -0
  121. package/languages/it-IT.js +7 -0
  122. package/languages/ja-JP.js +7 -0
  123. package/languages/ko-KR.js +7 -0
  124. package/languages/lv-LV.js +7 -0
  125. package/languages/nb-NO.js +7 -0
  126. package/languages/nl-NL.js +7 -0
  127. package/languages/pl-PL.js +7 -0
  128. package/languages/pt-BR.js +7 -0
  129. package/languages/ru-RU.js +7 -0
  130. package/languages/sr-SP.js +7 -0
  131. package/languages/zh-CN.js +7 -0
  132. package/languages/zh-TW.js +7 -0
  133. package/package.json +3 -2
  134. package/pluginHooks.d.ts +8 -2
  135. package/pluginHooks.js +116 -18
  136. package/pluginHooks.mjs +115 -15
  137. package/plugins/autoColumnSize/autoColumnSize.js +1 -0
  138. package/plugins/autoColumnSize/autoColumnSize.mjs +1 -0
  139. package/plugins/autoRowSize/autoRowSize.js +3 -2
  140. package/plugins/autoRowSize/autoRowSize.mjs +3 -2
  141. package/plugins/autofill/autofill.js +2 -2
  142. package/plugins/autofill/autofill.mjs +3 -3
  143. package/plugins/autofill/utils.js +1 -39
  144. package/plugins/autofill/utils.mjs +0 -37
  145. package/plugins/base/base.js +1 -0
  146. package/plugins/base/base.mjs +1 -0
  147. package/plugins/bindRowsWithHeaders/maps/strictBindsMap.js +1 -0
  148. package/plugins/bindRowsWithHeaders/maps/strictBindsMap.mjs +1 -0
  149. package/plugins/collapsibleColumns/collapsibleColumns.js +82 -24
  150. package/plugins/collapsibleColumns/collapsibleColumns.mjs +82 -24
  151. package/plugins/columnSorting/columnSorting.js +51 -8
  152. package/plugins/columnSorting/columnSorting.mjs +50 -9
  153. package/plugins/columnSorting/columnStatesManager.js +1 -0
  154. package/plugins/columnSorting/columnStatesManager.mjs +1 -0
  155. package/plugins/columnSorting/index.js +4 -2
  156. package/plugins/columnSorting/index.mjs +1 -1
  157. package/plugins/columnSorting/rootComparator.js +1 -0
  158. package/plugins/columnSorting/rootComparator.mjs +1 -0
  159. package/plugins/comments/commentEditor.js +1 -0
  160. package/plugins/comments/commentEditor.mjs +1 -0
  161. package/plugins/comments/comments.js +289 -224
  162. package/plugins/comments/comments.mjs +297 -234
  163. package/plugins/comments/contextMenuItem/addEditComment.js +51 -0
  164. package/plugins/comments/contextMenuItem/addEditComment.mjs +35 -0
  165. package/plugins/comments/contextMenuItem/readOnlyComment.js +63 -0
  166. package/plugins/comments/contextMenuItem/readOnlyComment.mjs +55 -0
  167. package/plugins/comments/contextMenuItem/removeComment.js +48 -0
  168. package/plugins/comments/contextMenuItem/removeComment.mjs +32 -0
  169. package/plugins/contextMenu/contextMenu.d.ts +1 -1
  170. package/plugins/contextMenu/contextMenu.js +81 -29
  171. package/plugins/contextMenu/contextMenu.mjs +82 -30
  172. package/plugins/contextMenu/predefinedItems/alignment.js +7 -0
  173. package/plugins/contextMenu/predefinedItems/alignment.mjs +7 -0
  174. package/plugins/contextMenu/predefinedItems/clearColumn.js +5 -3
  175. package/plugins/contextMenu/predefinedItems/clearColumn.mjs +5 -3
  176. package/plugins/contextMenu/predefinedItems/columnLeft.js +5 -3
  177. package/plugins/contextMenu/predefinedItems/columnLeft.mjs +5 -3
  178. package/plugins/contextMenu/predefinedItems/columnRight.js +5 -3
  179. package/plugins/contextMenu/predefinedItems/columnRight.mjs +5 -3
  180. package/plugins/contextMenu/predefinedItems/readOnly.js +7 -0
  181. package/plugins/contextMenu/predefinedItems/readOnly.mjs +7 -0
  182. package/plugins/contextMenu/predefinedItems/removeColumn.js +8 -5
  183. package/plugins/contextMenu/predefinedItems/removeColumn.mjs +6 -3
  184. package/plugins/contextMenu/predefinedItems/removeRow.js +8 -5
  185. package/plugins/contextMenu/predefinedItems/removeRow.mjs +6 -3
  186. package/plugins/contextMenu/predefinedItems/rowAbove.js +5 -3
  187. package/plugins/contextMenu/predefinedItems/rowAbove.mjs +5 -3
  188. package/plugins/contextMenu/predefinedItems/rowBelow.js +5 -3
  189. package/plugins/contextMenu/predefinedItems/rowBelow.mjs +5 -3
  190. package/plugins/contextMenu/utils.js +25 -16
  191. package/plugins/contextMenu/utils.mjs +24 -15
  192. package/plugins/copyPaste/contextMenuItem/copy.js +7 -0
  193. package/plugins/copyPaste/contextMenuItem/copy.mjs +7 -0
  194. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.js +9 -1
  195. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs +9 -1
  196. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.js +9 -1
  197. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs +9 -1
  198. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.js +9 -1
  199. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs +9 -1
  200. package/plugins/copyPaste/contextMenuItem/cut.js +7 -0
  201. package/plugins/copyPaste/contextMenuItem/cut.mjs +7 -0
  202. package/plugins/copyPaste/copyPaste.js +100 -14
  203. package/plugins/copyPaste/copyPaste.mjs +100 -14
  204. package/plugins/copyPaste/copyableRanges.js +25 -31
  205. package/plugins/copyPaste/copyableRanges.mjs +18 -24
  206. package/plugins/copyPaste/focusableElement.js +219 -0
  207. package/plugins/copyPaste/focusableElement.mjs +213 -0
  208. package/plugins/customBorders/customBorders.d.ts +2 -0
  209. package/plugins/customBorders/customBorders.js +19 -50
  210. package/plugins/customBorders/customBorders.mjs +19 -50
  211. package/plugins/dropdownMenu/dropdownMenu.d.ts +1 -1
  212. package/plugins/dropdownMenu/dropdownMenu.js +94 -30
  213. package/plugins/dropdownMenu/dropdownMenu.mjs +94 -30
  214. package/plugins/exportFile/dataProvider.js +1 -0
  215. package/plugins/exportFile/dataProvider.mjs +1 -0
  216. package/plugins/filters/component/value.js +1 -0
  217. package/plugins/filters/component/value.mjs +1 -0
  218. package/plugins/filters/condition/beginsWith.js +1 -0
  219. package/plugins/filters/condition/beginsWith.mjs +1 -0
  220. package/plugins/filters/condition/between.js +1 -0
  221. package/plugins/filters/condition/between.mjs +1 -0
  222. package/plugins/filters/condition/byValue.js +1 -0
  223. package/plugins/filters/condition/byValue.mjs +1 -0
  224. package/plugins/filters/condition/contains.js +1 -0
  225. package/plugins/filters/condition/contains.mjs +1 -0
  226. package/plugins/filters/condition/date/after.js +1 -0
  227. package/plugins/filters/condition/date/after.mjs +1 -0
  228. package/plugins/filters/condition/date/before.js +1 -0
  229. package/plugins/filters/condition/date/before.mjs +1 -0
  230. package/plugins/filters/condition/endsWith.js +1 -0
  231. package/plugins/filters/condition/endsWith.mjs +1 -0
  232. package/plugins/filters/condition/equal.js +1 -0
  233. package/plugins/filters/condition/equal.mjs +1 -0
  234. package/plugins/filters/condition/greaterThan.js +1 -0
  235. package/plugins/filters/condition/greaterThan.mjs +1 -0
  236. package/plugins/filters/condition/greaterThanOrEqual.js +1 -0
  237. package/plugins/filters/condition/greaterThanOrEqual.mjs +1 -0
  238. package/plugins/filters/condition/lessThan.js +1 -0
  239. package/plugins/filters/condition/lessThan.mjs +1 -0
  240. package/plugins/filters/condition/lessThanOrEqual.js +1 -0
  241. package/plugins/filters/condition/lessThanOrEqual.mjs +1 -0
  242. package/plugins/filters/conditionCollection.js +1 -0
  243. package/plugins/filters/conditionCollection.mjs +1 -0
  244. package/plugins/filters/filters.js +68 -42
  245. package/plugins/filters/filters.mjs +67 -41
  246. package/plugins/filters/ui/multipleSelect.js +1 -0
  247. package/plugins/filters/ui/multipleSelect.mjs +1 -0
  248. package/plugins/formulas/formulas.js +191 -168
  249. package/plugins/formulas/formulas.mjs +191 -168
  250. package/plugins/formulas/indexSyncer/axisSyncer.js +379 -0
  251. package/plugins/formulas/indexSyncer/axisSyncer.mjs +374 -0
  252. package/plugins/formulas/indexSyncer/index.js +225 -0
  253. package/plugins/formulas/indexSyncer/index.mjs +219 -0
  254. package/plugins/hiddenColumns/contextMenuItem/hideColumn.js +1 -0
  255. package/plugins/hiddenColumns/contextMenuItem/hideColumn.mjs +1 -0
  256. package/plugins/hiddenColumns/contextMenuItem/showColumn.js +1 -0
  257. package/plugins/hiddenColumns/contextMenuItem/showColumn.mjs +1 -0
  258. package/plugins/hiddenRows/contextMenuItem/hideRow.js +1 -0
  259. package/plugins/hiddenRows/contextMenuItem/hideRow.mjs +1 -0
  260. package/plugins/hiddenRows/contextMenuItem/showRow.js +1 -0
  261. package/plugins/hiddenRows/contextMenuItem/showRow.mjs +1 -0
  262. package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +1 -0
  263. package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.mjs +1 -0
  264. package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +1 -0
  265. package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.mjs +1 -0
  266. package/plugins/manualColumnResize/manualColumnResize.js +36 -5
  267. package/plugins/manualColumnResize/manualColumnResize.mjs +36 -5
  268. package/plugins/manualRowMove/manualRowMove.js +31 -12
  269. package/plugins/manualRowMove/manualRowMove.mjs +32 -13
  270. package/plugins/manualRowResize/manualRowResize.js +40 -9
  271. package/plugins/manualRowResize/manualRowResize.mjs +40 -9
  272. package/plugins/mergeCells/calculations/autofill.js +1 -0
  273. package/plugins/mergeCells/calculations/autofill.mjs +1 -0
  274. package/plugins/mergeCells/cellsCollection.js +1 -0
  275. package/plugins/mergeCells/cellsCollection.mjs +1 -0
  276. package/plugins/mergeCells/mergeCells.js +6 -2
  277. package/plugins/mergeCells/mergeCells.mjs +6 -2
  278. package/plugins/multiColumnSorting/multiColumnSorting.js +42 -3
  279. package/plugins/multiColumnSorting/multiColumnSorting.mjs +42 -3
  280. package/plugins/multiColumnSorting/rootComparator.js +1 -0
  281. package/plugins/multiColumnSorting/rootComparator.mjs +1 -0
  282. package/plugins/nestedHeaders/nestedHeaders.js +129 -6
  283. package/plugins/nestedHeaders/nestedHeaders.mjs +129 -6
  284. package/plugins/nestedHeaders/stateManager/headersTree.js +24 -26
  285. package/plugins/nestedHeaders/stateManager/headersTree.mjs +21 -23
  286. package/plugins/nestedHeaders/stateManager/index.js +40 -3
  287. package/plugins/nestedHeaders/stateManager/index.mjs +37 -0
  288. package/plugins/nestedHeaders/stateManager/matrixGenerator.js +1 -0
  289. package/plugins/nestedHeaders/stateManager/settingsNormalizer.js +2 -1
  290. package/plugins/nestedHeaders/stateManager/settingsNormalizer.mjs +1 -0
  291. package/plugins/nestedHeaders/utils/ghostTable.js +30 -35
  292. package/plugins/nestedHeaders/utils/ghostTable.mjs +30 -35
  293. package/plugins/nestedRows/data/dataManager.js +1 -0
  294. package/plugins/nestedRows/data/dataManager.mjs +1 -0
  295. package/plugins/nestedRows/nestedRows.js +53 -7
  296. package/plugins/nestedRows/nestedRows.mjs +53 -7
  297. package/plugins/nestedRows/ui/collapsing.js +1 -0
  298. package/plugins/nestedRows/ui/collapsing.mjs +1 -0
  299. package/plugins/nestedRows/utils/rowMoveController.js +1 -0
  300. package/plugins/nestedRows/utils/rowMoveController.mjs +1 -0
  301. package/plugins/persistentState/storage.js +1 -0
  302. package/plugins/persistentState/storage.mjs +1 -0
  303. package/plugins/registry.js +4 -1
  304. package/plugins/registry.mjs +1 -0
  305. package/plugins/undoRedo/undoRedo.js +1 -1
  306. package/plugins/undoRedo/undoRedo.mjs +1 -1
  307. package/renderers/baseRenderer/baseRenderer.js +0 -3
  308. package/renderers/baseRenderer/baseRenderer.mjs +0 -3
  309. package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
  310. package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
  311. package/selection/highlight/highlight.js +120 -98
  312. package/selection/highlight/highlight.mjs +118 -96
  313. package/selection/highlight/visualSelection.js +30 -17
  314. package/selection/highlight/visualSelection.mjs +30 -17
  315. package/selection/mouseEventHandler.js +1 -1
  316. package/selection/mouseEventHandler.mjs +1 -1
  317. package/selection/range.js +8 -8
  318. package/selection/range.mjs +8 -8
  319. package/selection/selection.js +246 -153
  320. package/selection/selection.mjs +247 -154
  321. package/selection/transformation.js +233 -96
  322. package/selection/transformation.mjs +230 -93
  323. package/selection/utils.js +12 -35
  324. package/selection/utils.mjs +13 -35
  325. package/settings.d.ts +2 -1
  326. package/shortcutContexts/commands/editor/closeAndSave.js +15 -0
  327. package/shortcutContexts/commands/editor/closeAndSave.mjs +10 -0
  328. package/shortcutContexts/commands/editor/closeWithoutSaving.js +13 -0
  329. package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +8 -0
  330. package/shortcutContexts/commands/editor/fastOpen.js +16 -0
  331. package/shortcutContexts/commands/editor/fastOpen.mjs +11 -0
  332. package/shortcutContexts/commands/editor/index.js +16 -0
  333. package/shortcutContexts/commands/editor/index.mjs +12 -0
  334. package/shortcutContexts/commands/editor/open.js +29 -0
  335. package/shortcutContexts/commands/editor/open.mjs +24 -0
  336. package/shortcutContexts/commands/emptySelectedCells.js +12 -0
  337. package/shortcutContexts/commands/emptySelectedCells.mjs +7 -0
  338. package/shortcutContexts/commands/extendCellsSelection/down.js +15 -0
  339. package/shortcutContexts/commands/extendCellsSelection/down.mjs +10 -0
  340. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +21 -0
  341. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +16 -0
  342. package/shortcutContexts/commands/extendCellsSelection/index.js +26 -0
  343. package/shortcutContexts/commands/extendCellsSelection/index.mjs +22 -0
  344. package/shortcutContexts/commands/extendCellsSelection/left.js +15 -0
  345. package/shortcutContexts/commands/extendCellsSelection/left.mjs +10 -0
  346. package/shortcutContexts/commands/extendCellsSelection/right.js +15 -0
  347. package/shortcutContexts/commands/extendCellsSelection/right.mjs +10 -0
  348. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +19 -0
  349. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +14 -0
  350. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +22 -0
  351. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +17 -0
  352. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +17 -0
  353. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +12 -0
  354. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +17 -0
  355. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +12 -0
  356. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +40 -0
  357. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +35 -0
  358. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +40 -0
  359. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +35 -0
  360. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +22 -0
  361. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +17 -0
  362. package/shortcutContexts/commands/extendCellsSelection/toRows.js +19 -0
  363. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +14 -0
  364. package/shortcutContexts/commands/extendCellsSelection/up.js +15 -0
  365. package/shortcutContexts/commands/extendCellsSelection/up.mjs +10 -0
  366. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +21 -0
  367. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +16 -0
  368. package/shortcutContexts/commands/index.js +53 -0
  369. package/shortcutContexts/commands/index.mjs +49 -0
  370. package/shortcutContexts/commands/moveCellSelection/down.js +12 -0
  371. package/shortcutContexts/commands/moveCellSelection/down.mjs +7 -0
  372. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +29 -0
  373. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +24 -0
  374. package/shortcutContexts/commands/moveCellSelection/index.js +28 -0
  375. package/shortcutContexts/commands/moveCellSelection/index.mjs +24 -0
  376. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +13 -0
  377. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -0
  378. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +13 -0
  379. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -0
  380. package/shortcutContexts/commands/moveCellSelection/left.js +11 -0
  381. package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -0
  382. package/shortcutContexts/commands/moveCellSelection/right.js +11 -0
  383. package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -0
  384. package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +16 -0
  385. package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +11 -0
  386. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +17 -0
  387. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +12 -0
  388. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +13 -0
  389. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +8 -0
  390. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +16 -0
  391. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +11 -0
  392. package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +36 -0
  393. package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +31 -0
  394. package/shortcutContexts/commands/moveCellSelection/toMostRight.js +36 -0
  395. package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +31 -0
  396. package/shortcutContexts/commands/moveCellSelection/toMostTop.js +16 -0
  397. package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +11 -0
  398. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +18 -0
  399. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +13 -0
  400. package/shortcutContexts/commands/moveCellSelection/up.js +12 -0
  401. package/shortcutContexts/commands/moveCellSelection/up.mjs +7 -0
  402. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +29 -0
  403. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +24 -0
  404. package/shortcutContexts/commands/populateSelectedCellsData.js +35 -0
  405. package/shortcutContexts/commands/populateSelectedCellsData.mjs +30 -0
  406. package/shortcutContexts/commands/scrollToFocusedCell.js +38 -0
  407. package/shortcutContexts/commands/scrollToFocusedCell.mjs +33 -0
  408. package/shortcutContexts/commands/selectAll.js +11 -0
  409. package/shortcutContexts/commands/selectAll.mjs +6 -0
  410. package/shortcutContexts/constants.js +19 -0
  411. package/shortcutContexts/constants.mjs +12 -0
  412. package/shortcutContexts/editor.js +29 -0
  413. package/shortcutContexts/editor.mjs +25 -0
  414. package/shortcutContexts/grid.js +252 -0
  415. package/shortcutContexts/grid.mjs +248 -0
  416. package/shortcutContexts/index.js +29 -0
  417. package/shortcutContexts/index.mjs +15 -0
  418. package/shortcuts/context.js +1 -0
  419. package/shortcuts/context.mjs +1 -0
  420. package/shortcuts/manager.js +2 -0
  421. package/shortcuts/manager.mjs +2 -0
  422. package/shortcuts/recorder.js +2 -2
  423. package/shortcuts/recorder.mjs +2 -2
  424. package/shortcuts/utils.js +21 -5
  425. package/shortcuts/utils.mjs +20 -4
  426. package/tableView.js +112 -82
  427. package/tableView.mjs +112 -82
  428. package/translations/changesObservable/observable.js +41 -46
  429. package/translations/changesObservable/observable.mjs +36 -41
  430. package/translations/changesObservable/observer.js +1 -1
  431. package/translations/indexMapper.d.ts +0 -2
  432. package/translations/indexMapper.js +38 -64
  433. package/translations/indexMapper.mjs +39 -64
  434. package/translations/maps/linkedPhysicalIndexToValueMap.js +1 -0
  435. package/translations/maps/linkedPhysicalIndexToValueMap.mjs +1 -0
  436. package/translations/maps/utils/indexesSequence.js +1 -0
  437. package/translations/maps/utils/indexesSequence.mjs +1 -0
  438. package/translations/maps/utils/physicallyIndexed.js +1 -0
  439. package/translations/maps/utils/physicallyIndexed.mjs +1 -0
  440. package/utils/dataStructures/priorityMap.js +1 -0
  441. package/utils/dataStructures/priorityMap.mjs +1 -0
  442. package/utils/dataStructures/tree.js +16 -18
  443. package/utils/dataStructures/tree.mjs +16 -18
  444. package/utils/dataStructures/uniqueMap.js +1 -0
  445. package/utils/dataStructures/uniqueMap.mjs +1 -0
  446. package/utils/dataStructures/uniqueSet.js +1 -0
  447. package/utils/dataStructures/uniqueSet.mjs +1 -0
  448. package/utils/ghostTable.js +1 -0
  449. package/utils/ghostTable.mjs +1 -0
  450. package/utils/parseTable.js +5 -1
  451. package/utils/parseTable.mjs +5 -1
  452. package/utils/staticRegister.js +1 -0
  453. package/utils/staticRegister.mjs +1 -0
  454. package/focusManager.d.ts +0 -12
  455. package/focusManager.js +0 -275
  456. package/focusManager.mjs +0 -270
package/core.mjs CHANGED
@@ -1,11 +1,4 @@
1
- import "core-js/modules/es.symbol.js";
2
- import "core-js/modules/es.symbol.description.js";
3
- import "core-js/modules/es.symbol.iterator.js";
4
- import "core-js/modules/es.function.name.js";
5
- import "core-js/modules/es.object.freeze.js";
6
- var _templateObject, _templateObject2;
7
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
8
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
9
2
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
3
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
4
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
@@ -22,33 +15,35 @@ import "core-js/modules/es.set.js";
22
15
  import "core-js/modules/es.string.iterator.js";
23
16
  import "core-js/modules/web.dom-collections.iterator.js";
24
17
  import "core-js/modules/es.array.includes.js";
18
+ import "core-js/modules/es.array.concat.js";
25
19
  import "core-js/modules/es.array.sort.js";
26
20
  import "core-js/modules/es.array.splice.js";
27
21
  import "core-js/modules/es.number.is-integer.js";
28
22
  import "core-js/modules/es.number.constructor.js";
29
23
  import "core-js/modules/es.array.slice.js";
30
- import "core-js/modules/es.array.concat.js";
31
24
  import "core-js/modules/es.array.fill.js";
32
25
  import "core-js/modules/es.array.map.js";
33
26
  import "core-js/modules/es.regexp.exec.js";
34
27
  import "core-js/modules/es.string.replace.js";
28
+ import "core-js/modules/es.array.filter.js";
35
29
  import "core-js/modules/es.array.from.js";
36
30
  import "core-js/modules/es.array.index-of.js";
37
31
  import "core-js/modules/es.array.reverse.js";
38
32
  import "core-js/modules/web.dom-collections.for-each.js";
39
33
  import "core-js/modules/web.timers.js";
40
34
  import "core-js/modules/web.immediate.js";
41
- import "core-js/modules/es.map.js";
35
+ import "core-js/modules/es.symbol.js";
36
+ import "core-js/modules/es.symbol.description.js";
37
+ import "core-js/modules/es.symbol.iterator.js";
38
+ import "core-js/modules/es.regexp.to-string.js";
39
+ import "core-js/modules/es.function.name.js";
42
40
  import { addClass, empty, observeVisibilityChangeOnce, removeClass } from "./helpers/dom/element.mjs";
43
41
  import { isFunction } from "./helpers/function.mjs";
44
42
  import { isDefined, isUndefined, isRegExp, _injectProductInfo, isEmpty } from "./helpers/mixed.mjs";
45
43
  import { isMobileBrowser, isIpadOS } from "./helpers/browser.mjs";
46
- import { warn } from "./helpers/console.mjs";
47
- import { toSingleLine } from "./helpers/templateLiteralTag.mjs";
48
44
  import EditorManager from "./editorManager.mjs";
49
45
  import EventManager from "./eventManager.mjs";
50
46
  import { deepClone, duckSchema, isObjectEqual, isObject, deepObjectSize, hasOwnProperty, createObjectPropListener, objectEach } from "./helpers/object.mjs";
51
- import { FocusManager } from "./focusManager.mjs";
52
47
  import { arrayMap, arrayEach, arrayReduce, getDifferenceOfArrays, stringToArray, pivot } from "./helpers/array.mjs";
53
48
  import { instanceToHTML } from "./utils/parseTable.mjs";
54
49
  import { getPlugin, getPluginsNames } from "./plugins/registry.mjs";
@@ -70,8 +65,15 @@ import { Selection } from "./selection/index.mjs";
70
65
  import { MetaManager, DynamicCellMetaMod, ExtendMetaPropertiesMod, replaceData } from "./dataMap/index.mjs";
71
66
  import { createUniqueMap } from "./utils/dataStructures/uniqueMap.mjs";
72
67
  import { createShortcutManager } from "./shortcuts/index.mjs";
73
- var SHORTCUTS_GROUP = 'gridDefault';
68
+ import { registerAllShortcutContexts } from "./shortcutContexts/index.mjs";
74
69
  var activeGuid = null;
70
+
71
+ /**
72
+ * A set of deprecated feature names.
73
+ *
74
+ * @type {Set<string>}
75
+ */
76
+ // eslint-disable-next-line no-unused-vars
75
77
  var deprecationWarns = new Set();
76
78
 
77
79
  /* eslint-disable jsdoc/require-description-complete-sentence */
@@ -103,7 +105,7 @@ var deprecationWarns = new Set();
103
105
  * :::
104
106
  *
105
107
  * ::: only-for react
106
- * ```jsx{3,7,13}
108
+ * ```jsx
107
109
  * import { useRef } from 'react';
108
110
  *
109
111
  * const hotTableComponent = useRef(null);
@@ -135,7 +137,6 @@ export default function Core(rootElement, userSettings) {
135
137
  var dataSource;
136
138
  var grid;
137
139
  var editorManager;
138
- var focusManager;
139
140
  var firstRun = true;
140
141
  if (hasValidParameter(rootInstanceSymbol)) {
141
142
  registerAsRootInstance(this);
@@ -260,6 +261,12 @@ export default function Core(rootElement, userSettings) {
260
261
  * @type {IndexMapper}
261
262
  */
262
263
  this.rowIndexMapper = new IndexMapper();
264
+ this.columnIndexMapper.addLocalHook('indexesSequenceChange', function (source) {
265
+ instance.runHooks('afterColumnSequenceChange', source);
266
+ });
267
+ this.rowIndexMapper.addLocalHook('indexesSequenceChange', function (source) {
268
+ instance.runHooks('afterRowSequenceChange', source);
269
+ });
263
270
  dataSource = new DataSource(instance);
264
271
  if (!this.rootElement.id || this.rootElement.id.substring(0, 3) === 'ht_') {
265
272
  this.rootElement.id = this.guid; // if root element does not have an id, assign a random id
@@ -282,12 +289,8 @@ export default function Core(rootElement, userSettings) {
282
289
  };
283
290
 
284
291
  var selection = new Selection(tableMeta, {
285
- rowIndexMapper: function rowIndexMapper() {
286
- return instance.rowIndexMapper;
287
- },
288
- columnIndexMapper: function columnIndexMapper() {
289
- return instance.columnIndexMapper;
290
- },
292
+ rowIndexMapper: instance.rowIndexMapper,
293
+ columnIndexMapper: instance.columnIndexMapper,
291
294
  countCols: function countCols() {
292
295
  return instance.countCols();
293
296
  },
@@ -300,10 +303,10 @@ export default function Core(rootElement, userSettings) {
300
303
  isEditorOpened: function isEditorOpened() {
301
304
  return instance.getActiveEditor() ? instance.getActiveEditor().isOpened() : false;
302
305
  },
303
- countColsTranslated: function countColsTranslated() {
306
+ countRenderableColumns: function countRenderableColumns() {
304
307
  return _this.view.countRenderableColumns();
305
308
  },
306
- countRowsTranslated: function countRowsTranslated() {
309
+ countRenderableRows: function countRenderableRows() {
307
310
  return _this.view.countRenderableRows();
308
311
  },
309
312
  countRowHeaders: function countRowHeaders() {
@@ -344,12 +347,6 @@ export default function Core(rootElement, userSettings) {
344
347
  });
345
348
  this.selection.addLocalHook('beforeSetRangeEnd', function (cellCoords) {
346
349
  _this.runHooks('beforeSetRangeEnd', cellCoords);
347
- if (cellCoords.row < 0) {
348
- cellCoords.row = _this.view._wt.wtTable.getFirstVisibleRow();
349
- }
350
- if (cellCoords.col < 0) {
351
- cellCoords.col = _this.view._wt.wtTable.getFirstVisibleColumn();
352
- }
353
350
  });
354
351
  this.selection.addLocalHook('afterSetRangeEnd', function (cellCoords) {
355
352
  var preventScrolling = createObjectPropListener(false);
@@ -375,7 +372,14 @@ export default function Core(rootElement, userSettings) {
375
372
  if (scrollToCell !== false) {
376
373
  if (!isSelectedByAnyHeader) {
377
374
  if (currentSelectedRange && !_this.selection.isMultiple()) {
378
- _this.view.scrollViewport(visualToRenderableCoords(currentSelectedRange.from));
375
+ var renderableCoords = visualToRenderableCoords(currentSelectedRange.from);
376
+ if (renderableCoords.row < 0 && renderableCoords.col >= 0) {
377
+ _this.view.scrollViewportHorizontally(renderableCoords.col);
378
+ } else if (renderableCoords.col < 0 && renderableCoords.row >= 0) {
379
+ _this.view.scrollViewportVertically(renderableCoords.row);
380
+ } else {
381
+ _this.view.scrollViewport(renderableCoords);
382
+ }
379
383
  } else {
380
384
  _this.view.scrollViewport(visualToRenderableCoords(cellCoords));
381
385
  }
@@ -416,6 +420,30 @@ export default function Core(rootElement, userSettings) {
416
420
  isMultiple.value = changedIsMultiple;
417
421
  }
418
422
  });
423
+ this.selection.addLocalHook('beforeSelectColumns', function () {
424
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
425
+ args[_key] = arguments[_key];
426
+ }
427
+ return _this.runHooks.apply(_this, ['beforeSelectColumns'].concat(args));
428
+ });
429
+ this.selection.addLocalHook('afterSelectColumns', function () {
430
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
431
+ args[_key2] = arguments[_key2];
432
+ }
433
+ return _this.runHooks.apply(_this, ['afterSelectColumns'].concat(args));
434
+ });
435
+ this.selection.addLocalHook('beforeSelectRows', function () {
436
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
437
+ args[_key3] = arguments[_key3];
438
+ }
439
+ return _this.runHooks.apply(_this, ['beforeSelectRows'].concat(args));
440
+ });
441
+ this.selection.addLocalHook('afterSelectRows', function () {
442
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
443
+ args[_key4] = arguments[_key4];
444
+ }
445
+ return _this.runHooks.apply(_this, ['afterSelectRows'].concat(args));
446
+ });
419
447
  this.selection.addLocalHook('beforeModifyTransformStart', function (cellCoordsDelta) {
420
448
  _this.runHooks('modifyTransformStart', cellCoordsDelta);
421
449
  });
@@ -501,13 +529,6 @@ export default function Core(rootElement, userSettings) {
501
529
 
502
530
  /* eslint-disable no-case-declarations */
503
531
  switch (action) {
504
- case 'insert_row':
505
- // backward compatibility
506
- if (!deprecationWarns.has(action)) {
507
- deprecationWarns.add(action);
508
- warn(toSingleLine(_templateObject || (_templateObject = _taggedTemplateLiteral(["The `", "` action of the `alter()` method is deprecated and will be removed \n in the next major release of Handsontable. Use the `insert_row_above` action instead."], ["The \\`", "\\` action of the \\`alter()\\` method is deprecated and will be removed\\x20\n in the next major release of Handsontable. Use the \\`insert_row_above\\` action instead."])), action));
509
- }
510
- // falls through
511
532
  case 'insert_row_below':
512
533
  case 'insert_row_above':
513
534
  var numberOfSourceRows = instance.countSourceRows();
@@ -518,11 +539,9 @@ export default function Core(rootElement, userSettings) {
518
539
  // `above` is the default behavior for creating new rows
519
540
  var insertRowMode = action === 'insert_row_below' ? 'below' : 'above';
520
541
 
521
- // The line below ensures backward compatibility of the `alter()` method's `insert_row` action.
522
- // Calling the `insert_row` action with no arguments adds a new row at the end of the data set.
523
542
  // Calling the `insert_row_above` action adds a new row at the beginning of the data set.
524
543
  // eslint-disable-next-line no-param-reassign
525
- index = (_index = index) !== null && _index !== void 0 ? _index : action === 'insert_row' || insertRowMode === 'below' ? numberOfSourceRows : 0;
544
+ index = (_index = index) !== null && _index !== void 0 ? _index : insertRowMode === 'below' ? numberOfSourceRows : 0;
526
545
  var _datamap$createRow = datamap.createRow(index, amount, {
527
546
  source: source,
528
547
  mode: insertRowMode
@@ -561,23 +580,14 @@ export default function Core(rootElement, userSettings) {
561
580
  }
562
581
 
563
582
  break;
564
- case 'insert_col':
565
- // backward compatibility
566
- if (!deprecationWarns.has(action)) {
567
- deprecationWarns.add(action);
568
- warn(toSingleLine(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["The `", "` action of the `alter()` method is deprecated and will be removed \n in the next major release of Handsontable. Use the `insert_col_start` action instead."], ["The \\`", "\\` action of the \\`alter()\\` method is deprecated and will be removed\\x20\n in the next major release of Handsontable. Use the \\`insert_col_start\\` action instead."])), action));
569
- }
570
- // falls through
571
583
  case 'insert_col_start':
572
584
  case 'insert_col_end':
573
585
  // "start" is a default behavior for creating new columns
574
586
  var insertColumnMode = action === 'insert_col_end' ? 'end' : 'start';
575
587
 
576
- // The line below ensures backward compatibility of the `alter()` method's `insert_col` action.
577
- // Calling the `insert_col` action with no arguments adds a new column to the right of the data set.
578
588
  // Calling the `insert_col_start` action adds a new column to the left of the data set.
579
589
  // eslint-disable-next-line no-param-reassign
580
- index = (_index2 = index) !== null && _index2 !== void 0 ? _index2 : action === 'insert_col' || insertColumnMode === 'end' ? instance.countSourceCols() : 0;
590
+ index = (_index2 = index) !== null && _index2 !== void 0 ? _index2 : insertColumnMode === 'end' ? instance.countSourceCols() : 0;
581
591
  var _datamap$createCol = datamap.createCol(index, amount, {
582
592
  source: source,
583
593
  mode: insertColumnMode
@@ -848,13 +858,9 @@ export default function Core(rootElement, userSettings) {
848
858
  * @param {object} [end] End selection position (only for drag-down mode). Visual indexes.
849
859
  * @param {string} [source="populateFromArray"] Source information string.
850
860
  * @param {string} [method="overwrite"] Populate method. Possible options: `shift_down`, `shift_right`, `overwrite`.
851
- * @param {string} direction (left|right|up|down) String specifying the direction.
852
- * @param {Array} deltas The deltas array. A difference between values of adjacent cells.
853
- * Useful **only** when the type of handled cells is `numeric`.
854
861
  * @returns {object|undefined} Ending td in pasted area (only if any cell was changed).
855
862
  */
856
- populateFromArray: function populateFromArray(start, input, end, source, method, direction, deltas) {
857
- // TODO: either remove or implement the `direction` argument. Currently it's not working at all.
863
+ populateFromArray: function populateFromArray(start, input, end, source, method) {
858
864
  var r;
859
865
  var rlen;
860
866
  var c;
@@ -942,11 +948,6 @@ export default function Core(rootElement, userSettings) {
942
948
  // overwrite and other not specified options
943
949
  current.row = start.row;
944
950
  current.col = start.col;
945
- var selected = {
946
- // selected range
947
- row: end && start ? end.row - start.row + 1 : 1,
948
- col: end && start ? end.col - start.col + 1 : 1
949
- };
950
951
  var skippedRow = 0;
951
952
  var skippedColumn = 0;
952
953
  var pushData = true;
@@ -1007,16 +1008,6 @@ export default function Core(rootElement, userSettings) {
1007
1008
  var visualColumn = c - skippedColumn;
1008
1009
  var value = getInputValue(visualRow, visualColumn);
1009
1010
  var orgValue = instance.getDataAtCell(current.row, current.col);
1010
- var index = {
1011
- row: visualRow,
1012
- col: visualColumn
1013
- };
1014
- if (source === 'Autofill.fill') {
1015
- var result = instance.runHooks('beforeAutofillInsidePopulate', index, direction, input, deltas, {}, selected);
1016
- if (result) {
1017
- value = isUndefined(result.value) ? value : result.value;
1018
- }
1019
- }
1020
1011
  if (value !== null && _typeof(value) === 'object') {
1021
1012
  // when 'value' is array and 'orgValue' is null, set 'orgValue' to
1022
1013
  // an empty array so that the null value can be compared to 'value'
@@ -1110,7 +1101,6 @@ export default function Core(rootElement, userSettings) {
1110
1101
  this.updateSettings(tableMeta, true);
1111
1102
  this.view = new TableView(this);
1112
1103
  editorManager = EditorManager.getInstance(instance, tableMeta, selection);
1113
- focusManager = new FocusManager(instance);
1114
1104
  instance.runHooks('init');
1115
1105
  this.forceFullRender = true; // used when data was changed
1116
1106
  this.view.render();
@@ -1187,15 +1177,8 @@ export default function Core(rootElement, userSettings) {
1187
1177
  return;
1188
1178
  }
1189
1179
  var activeEditor = instance.getActiveEditor();
1190
- var beforeChangeResult = instance.runHooks('beforeChange', changes, source || 'edit');
1191
- var shouldBeCanceled = true;
1192
- if (beforeChangeResult === false) {
1193
- if (activeEditor) {
1194
- activeEditor.cancelChanges();
1195
- }
1196
- return;
1197
- }
1198
1180
  var waitingForValidator = new ValidatorsQueue();
1181
+ var shouldBeCanceled = true;
1199
1182
  waitingForValidator.onQueueEmpty = function (isValid) {
1200
1183
  if (activeEditor && shouldBeCanceled) {
1201
1184
  activeEditor.cancelChanges();
@@ -1204,43 +1187,37 @@ export default function Core(rootElement, userSettings) {
1204
1187
  };
1205
1188
 
1206
1189
  for (var i = changes.length - 1; i >= 0; i--) {
1207
- if (changes[i] === null) {
1208
- changes.splice(i, 1);
1209
- } else {
1210
- var _changes$i = _slicedToArray(changes[i], 4),
1211
- row = _changes$i[0],
1212
- prop = _changes$i[1],
1213
- newValue = _changes$i[3];
1214
- var col = datamap.propToCol(prop);
1215
- var cellProperties = instance.getCellMeta(row, col);
1216
- if (cellProperties.type === 'numeric' && typeof newValue === 'string' && isNumericLike(newValue)) {
1217
- changes[i][3] = getParsedNumber(newValue);
1218
- }
1190
+ var _changes$i = _slicedToArray(changes[i], 4),
1191
+ row = _changes$i[0],
1192
+ prop = _changes$i[1],
1193
+ newValue = _changes$i[3];
1194
+ var col = datamap.propToCol(prop);
1195
+ var cellProperties = instance.getCellMeta(row, col);
1196
+ if (cellProperties.type === 'numeric' && typeof newValue === 'string' && isNumericLike(newValue)) {
1197
+ changes[i][3] = getParsedNumber(newValue);
1198
+ }
1219
1199
 
1220
- /* eslint-disable no-loop-func */
1221
- if (instance.getCellValidator(cellProperties)) {
1222
- waitingForValidator.addValidatorToQueue();
1223
- instance.validateCell(changes[i][3], cellProperties, function (index, cellPropertiesReference) {
1224
- return function (result) {
1225
- if (typeof result !== 'boolean') {
1226
- throw new Error('Validation error: result is not boolean');
1227
- }
1228
- if (result === false && cellPropertiesReference.allowInvalid === false) {
1229
- shouldBeCanceled = false;
1230
- changes.splice(index, 1); // cancel the change
1231
- cellPropertiesReference.valid = true; // we cancelled the change, so cell value is still valid
1232
-
1233
- var cell = instance.getCell(cellPropertiesReference.visualRow, cellPropertiesReference.visualCol);
1234
- if (cell !== null) {
1235
- removeClass(cell, tableMeta.invalidCellClassName);
1236
- }
1237
- // index -= 1;
1200
+ /* eslint-disable no-loop-func */
1201
+ if (instance.getCellValidator(cellProperties)) {
1202
+ waitingForValidator.addValidatorToQueue();
1203
+ instance.validateCell(changes[i][3], cellProperties, function (index, cellPropertiesReference) {
1204
+ return function (result) {
1205
+ if (typeof result !== 'boolean') {
1206
+ throw new Error('Validation error: result is not boolean');
1207
+ }
1208
+ if (result === false && cellPropertiesReference.allowInvalid === false) {
1209
+ shouldBeCanceled = false;
1210
+ changes.splice(index, 1); // cancel the change
1211
+ cellPropertiesReference.valid = true; // we cancelled the change, so cell value is still valid
1212
+
1213
+ var cell = instance.getCell(cellPropertiesReference.visualRow, cellPropertiesReference.visualCol);
1214
+ if (cell !== null) {
1215
+ removeClass(cell, tableMeta.invalidCellClassName);
1238
1216
  }
1239
-
1240
- waitingForValidator.removeValidatorFormQueue();
1241
- };
1242
- }(i, cellProperties), source);
1243
- }
1217
+ }
1218
+ waitingForValidator.removeValidatorFormQueue();
1219
+ };
1220
+ }(i, cellProperties), source);
1244
1221
  }
1245
1222
  }
1246
1223
  waitingForValidator.checkIfQueueIsEmpty();
@@ -1430,6 +1407,31 @@ export default function Core(rootElement, userSettings) {
1430
1407
  return [[row, propOrCol, value]];
1431
1408
  }
1432
1409
 
1410
+ /**
1411
+ * Process changes prepared for applying to the dataset (unifying list of changes, closing an editor - when needed,
1412
+ * calling a hook).
1413
+ *
1414
+ * @private
1415
+ * @param {Array} changes Array of changes in format `[[row, col, value],...]`.
1416
+ * @param {string} [source] String that identifies how this change will be described in the changes array (useful in afterChange or beforeChange callback). Set to 'edit' if left empty.
1417
+ * @returns {Array} List of changes finally applied to the dataset.
1418
+ */
1419
+ function processChanges(changes, source) {
1420
+ var activeEditor = instance.getActiveEditor();
1421
+ var beforeChangeResult = instance.runHooks('beforeChange', changes, source || 'edit');
1422
+ // The `beforeChange` hook could add a `null` for purpose of cancelling some dataset's change.
1423
+ var filteredChanges = changes.filter(function (change) {
1424
+ return change !== null;
1425
+ });
1426
+ if (beforeChangeResult === false || filteredChanges.length === 0) {
1427
+ if (activeEditor) {
1428
+ activeEditor.cancelChanges();
1429
+ }
1430
+ return [];
1431
+ }
1432
+ return filteredChanges;
1433
+ }
1434
+
1433
1435
  /**
1434
1436
  * @description
1435
1437
  * Set new value to a cell. To change many cells at once (recommended way), pass an array of `changes` in format
@@ -1467,9 +1469,10 @@ export default function Core(rootElement, userSettings) {
1467
1469
  if (!changeSource && _typeof(row) === 'object') {
1468
1470
  changeSource = column;
1469
1471
  }
1470
- instance.runHooks('afterSetDataAtCell', changes, changeSource);
1471
- validateChanges(changes, changeSource, function () {
1472
- applyChanges(changes, changeSource);
1472
+ var processedChanges = processChanges(changes, source);
1473
+ instance.runHooks('afterSetDataAtCell', processedChanges, changeSource);
1474
+ validateChanges(processedChanges, changeSource, function () {
1475
+ applyChanges(processedChanges, changeSource);
1473
1476
  });
1474
1477
  };
1475
1478
 
@@ -1497,9 +1500,10 @@ export default function Core(rootElement, userSettings) {
1497
1500
  if (!changeSource && _typeof(row) === 'object') {
1498
1501
  changeSource = prop;
1499
1502
  }
1500
- instance.runHooks('afterSetDataAtRowProp', changes, changeSource);
1501
- validateChanges(changes, changeSource, function () {
1502
- applyChanges(changes, changeSource);
1503
+ var processedChanges = processChanges(changes, source);
1504
+ instance.runHooks('afterSetDataAtRowProp', processedChanges, changeSource);
1505
+ validateChanges(processedChanges, changeSource, function () {
1506
+ applyChanges(processedChanges, changeSource);
1503
1507
  });
1504
1508
  };
1505
1509
 
@@ -1574,18 +1578,15 @@ export default function Core(rootElement, userSettings) {
1574
1578
  * @param {number} [endCol] End visual column index (use when you want to cut input when certain column is reached).
1575
1579
  * @param {string} [source=populateFromArray] Used to identify this call in the resulting events (beforeChange, afterChange).
1576
1580
  * @param {string} [method=overwrite] Populate method, possible values: `'shift_down'`, `'shift_right'`, `'overwrite'`.
1577
- * @param {string} direction Populate direction, possible values: `'left'`, `'right'`, `'up'`, `'down'`.
1578
- * @param {Array} deltas The deltas array. A difference between values of adjacent cells.
1579
- * Useful **only** when the type of handled cells is `numeric`.
1580
1581
  * @returns {object|undefined} Ending td in pasted area (only if any cell was changed).
1581
1582
  */
1582
- this.populateFromArray = function (row, column, input, endRow, endCol, source, method, direction, deltas) {
1583
+ this.populateFromArray = function (row, column, input, endRow, endCol, source, method) {
1583
1584
  if (!(_typeof(input) === 'object' && _typeof(input[0]) === 'object')) {
1584
1585
  throw new Error('populateFromArray parameter `input` must be an array of arrays'); // API changed in 0.9-beta2, let's check if you use it correctly
1585
1586
  }
1586
1587
 
1587
1588
  var c = typeof endRow === 'number' ? instance._createCellCoords(endRow, endCol) : null;
1588
- return grid.populateFromArray(instance._createCellCoords(row, column), input, c, source, method, direction, deltas);
1589
+ return grid.populateFromArray(instance._createCellCoords(row, column), input, c, source, method);
1589
1590
  };
1590
1591
 
1591
1592
  /**
@@ -1601,8 +1602,8 @@ export default function Core(rootElement, userSettings) {
1601
1602
  */
1602
1603
  this.spliceCol = function (column, index, amount) {
1603
1604
  var _datamap;
1604
- for (var _len = arguments.length, elements = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
1605
- elements[_key - 3] = arguments[_key];
1605
+ for (var _len5 = arguments.length, elements = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
1606
+ elements[_key5 - 3] = arguments[_key5];
1606
1607
  }
1607
1608
  return (_datamap = datamap).spliceCol.apply(_datamap, [column, index, amount].concat(elements));
1608
1609
  };
@@ -1620,8 +1621,8 @@ export default function Core(rootElement, userSettings) {
1620
1621
  */
1621
1622
  this.spliceRow = function (row, index, amount) {
1622
1623
  var _datamap2;
1623
- for (var _len2 = arguments.length, elements = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
1624
- elements[_key2 - 3] = arguments[_key2];
1624
+ for (var _len6 = arguments.length, elements = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
1625
+ elements[_key6 - 3] = arguments[_key6];
1625
1626
  }
1626
1627
  return (_datamap2 = datamap).spliceRow.apply(_datamap2, [row, index, amount].concat(elements));
1627
1628
  };
@@ -1717,6 +1718,9 @@ export default function Core(rootElement, userSettings) {
1717
1718
  }
1718
1719
  var changes = [];
1719
1720
  arrayEach(selection.getSelectedRange(), function (cellRange) {
1721
+ if (cellRange.isSingleHeader()) {
1722
+ return;
1723
+ }
1720
1724
  var topStart = cellRange.getTopStartCorner();
1721
1725
  var bottomEnd = cellRange.getBottomEndCorner();
1722
1726
  rangeEach(topStart.row, bottomEnd.row, function (row) {
@@ -2446,11 +2450,13 @@ export default function Core(rootElement, userSettings) {
2446
2450
  };
2447
2451
 
2448
2452
  /**
2449
- * Get value from the selected cell.
2453
+ * Gets the value of the currently focused cell.
2454
+ *
2455
+ * For column headers and row headers, returns `null`.
2450
2456
  *
2451
2457
  * @memberof Core#
2452
2458
  * @function getValue
2453
- * @returns {*} Value of selected cell.
2459
+ * @returns {*} The value of the focused cell.
2454
2460
  */
2455
2461
  this.getValue = function () {
2456
2462
  var sel = instance.getSelectedLast();
@@ -2509,10 +2515,11 @@ export default function Core(rootElement, userSettings) {
2509
2515
  * | `'insert_col_start'` | Inserts columns before the `index` column. | Inserts columns before the first column. |
2510
2516
  * | `'insert_col_end'` | Inserts columns after the `index` column. | Inserts columns after the last column. |
2511
2517
  * | `'remove_col'` | Removes columns, starting from the `index` column. | Removes columns, starting from the last column. |
2512
- * | `'insert_row'` (<b>Deprecated</b>) | Inserts rows above the `index` row. | Inserts rows below the last row. |
2513
- * | `'insert_col'` (<b>Deprecated</b>) | Inserts columns before the `index` column. | Inserts columns after the last column. |
2514
2518
  *
2515
- * The behavior of `'insert_col_start'`, `'insert_col_end'`, and `'insert_col'` depends on your [`layoutDirection`](@/api/options.md#layoutdirection).
2519
+ * Additional information about `'insert_col_start'` and `'insert_col_end'`:
2520
+ * - Their behavior depends on your [`layoutDirection`](@/api/options.md#layoutdirection).
2521
+ * - If the provided `index` is higher than the actual number of columns, Handsontable doesn't generate
2522
+ * the columns missing in between. Instead, the new columns are inserted next to the last column.
2516
2523
  *
2517
2524
  * @memberof Core#
2518
2525
  * @function alter
@@ -2524,8 +2531,6 @@ export default function Core(rootElement, userSettings) {
2524
2531
  * <li> `'insert_col_start'` </li>
2525
2532
  * <li> `'insert_col_end'` </li>
2526
2533
  * <li> `'remove_col'` </li>
2527
- * <li> `'insert_row'` (<b>Deprecated</b>) </li>
2528
- * <li> `'insert_col'` (<b>Deprecated</b>) </li>
2529
2534
  * </ul>
2530
2535
  * @param {number|number[]} [index] A visual index of the row/column before or after which the new row/column will be
2531
2536
  * inserted or removed. Can also be an array of arrays, in format `[[index, amount],...]`.
@@ -2793,6 +2798,11 @@ export default function Core(rootElement, userSettings) {
2793
2798
  * __Note__: This method does not participate in data transformation. If the visual data of the table is reordered,
2794
2799
  * sorted or trimmed only physical indexes are correct.
2795
2800
  *
2801
+ * __Note__: This method may return incorrect values for cells that contain
2802
+ * [formulas](@/guides/formulas/formula-calculation.md). This is because `getSourceData()`
2803
+ * operates on source data ([physical indexes](@/api/indexMapper.md)),
2804
+ * whereas formulas operate on visual data (visual indexes).
2805
+ *
2796
2806
  * @memberof Core#
2797
2807
  * @function getSourceData
2798
2808
  * @param {number} [row] From physical row index.
@@ -3025,8 +3035,8 @@ export default function Core(rootElement, userSettings) {
3025
3035
  this.spliceCellsMeta = function (visualIndex) {
3026
3036
  var _this5 = this;
3027
3037
  var deleteAmount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
3028
- for (var _len3 = arguments.length, cellMetaRows = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
3029
- cellMetaRows[_key3 - 2] = arguments[_key3];
3038
+ for (var _len7 = arguments.length, cellMetaRows = new Array(_len7 > 2 ? _len7 - 2 : 0), _key7 = 2; _key7 < _len7; _key7++) {
3039
+ cellMetaRows[_key7 - 2] = arguments[_key7];
3030
3040
  }
3031
3041
  if (cellMetaRows.length > 0 && !Array.isArray(cellMetaRows[0])) {
3032
3042
  throw new Error('The 3rd argument (cellMetaRows) has to be passed as an array of cell meta objects array.');
@@ -3142,7 +3152,13 @@ export default function Core(rootElement, userSettings) {
3142
3152
  };
3143
3153
 
3144
3154
  /**
3145
- * Checks if the data format and config allows user to modify the column structure.
3155
+ * Checks if your [data format](@/guides/getting-started/binding-to-data.md#compatible-data-types)
3156
+ * and [configuration options](@/guides/getting-started/configuration-options.md)
3157
+ * allow for changing the number of columns.
3158
+ *
3159
+ * Returns `false` when your data is an array of objects,
3160
+ * or when you use the [`columns`](@/api/options.md#columns) option.
3161
+ * Otherwise, returns `true`.
3146
3162
  *
3147
3163
  * @memberof Core#
3148
3164
  * @function isColumnModificationAllowed
@@ -3225,10 +3241,16 @@ export default function Core(rootElement, userSettings) {
3225
3241
  };
3226
3242
 
3227
3243
  /**
3228
- * Validates all cells using their validator functions and calls callback when finished.
3244
+ * Validates every cell in the data set,
3245
+ * using a [validator function](@/guides/cell-functions/cell-validator.md) configured for each cell.
3229
3246
  *
3230
- * If one of the cells is invalid, the callback will be fired with `'valid'` arguments as `false` - otherwise it
3231
- * would equal `true`.
3247
+ * Doesn't validate cells that are currently [trimmed](@/guides/rows/row-trimming.md),
3248
+ * [hidden](@/guides/rows/row-hiding.md), or [filtered](@/guides/columns/column-filter.md),
3249
+ * as such cells are not included in the data set until you bring them back again.
3250
+ *
3251
+ * After the validation, the `callback` function is fired, with the `valid` argument set to:
3252
+ * - `true` for valid cells
3253
+ * - `false` for invalid cells
3232
3254
  *
3233
3255
  * @memberof Core#
3234
3256
  * @function validateCells
@@ -3711,7 +3733,7 @@ export default function Core(rootElement, userSettings) {
3711
3733
  /**
3712
3734
  * Returns the number of rendered row headers.
3713
3735
  *
3714
- * @since 13.0.0
3736
+ * @since 14.0.0
3715
3737
  * @memberof Core#
3716
3738
  * @function countRowHeaders
3717
3739
  * @returns {number} Number of row headers.
@@ -3723,7 +3745,7 @@ export default function Core(rootElement, userSettings) {
3723
3745
  /**
3724
3746
  * Returns the number of rendered column headers.
3725
3747
  *
3726
- * @since 13.0.0
3748
+ * @since 14.0.0
3727
3749
  * @memberof Core#
3728
3750
  * @function countColHeaders
3729
3751
  * @returns {number} Number of column headers.
@@ -3936,6 +3958,10 @@ export default function Core(rootElement, userSettings) {
3936
3958
  * hot.selectColumns('id');
3937
3959
  * // Select range of columns using visual indexes.
3938
3960
  * hot.selectColumns(1, 4);
3961
+ * // Select range of columns using visual indexes and mark the first header as highlighted.
3962
+ * hot.selectColumns(1, 2, -1);
3963
+ * // Select range of columns using visual indexes and mark the second cell as highlighted.
3964
+ * hot.selectColumns(2, 1, 1);
3939
3965
  * // Select range of columns using column properties.
3940
3966
  * hot.selectColumns('id', 'last_name');
3941
3967
  * ```
@@ -3946,11 +3972,15 @@ export default function Core(rootElement, userSettings) {
3946
3972
  * @param {number} startColumn The visual column index from which the selection starts.
3947
3973
  * @param {number} [endColumn=startColumn] The visual column index to which the selection finishes. If `endColumn`
3948
3974
  * is not defined the column defined by `startColumn` will be selected.
3975
+ * @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
3976
+ * The value can take visual row index from -N to N, where negative values
3977
+ * point to the headers and positive values point to the cell range.
3949
3978
  * @returns {boolean} `true` if selection was successful, `false` otherwise.
3950
3979
  */
3951
3980
  this.selectColumns = function (startColumn) {
3952
3981
  var endColumn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startColumn;
3953
- return selection.selectColumns(startColumn, endColumn);
3982
+ var focusPosition = arguments.length > 2 ? arguments[2] : undefined;
3983
+ return selection.selectColumns(startColumn, endColumn, focusPosition);
3954
3984
  };
3955
3985
 
3956
3986
  /**
@@ -3960,8 +3990,12 @@ export default function Core(rootElement, userSettings) {
3960
3990
  * ```js
3961
3991
  * // Select row using visual index.
3962
3992
  * hot.selectRows(1);
3963
- * // Select range of rows using visual indexes.
3993
+ * // select a range of rows, using visual indexes.
3964
3994
  * hot.selectRows(1, 4);
3995
+ * // select a range of rows, using visual indexes, and mark the header as highlighted.
3996
+ * hot.selectRows(1, 2, -1);
3997
+ * // Select range of rows using visual indexes and mark the second cell as highlighted.
3998
+ * hot.selectRows(2, 1, 1);
3965
3999
  * ```
3966
4000
  *
3967
4001
  * @memberof Core#
@@ -3970,11 +4004,15 @@ export default function Core(rootElement, userSettings) {
3970
4004
  * @param {number} startRow The visual row index from which the selection starts.
3971
4005
  * @param {number} [endRow=startRow] The visual row index to which the selection finishes. If `endRow`
3972
4006
  * is not defined the row defined by `startRow` will be selected.
4007
+ * @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
4008
+ * The value can take visual column index from -N to N, where negative values
4009
+ * point to the headers and positive values point to the cell range.
3973
4010
  * @returns {boolean} `true` if selection was successful, `false` otherwise.
3974
4011
  */
3975
4012
  this.selectRows = function (startRow) {
3976
4013
  var endRow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startRow;
3977
- return selection.selectRows(startRow, endRow);
4014
+ var focusPosition = arguments.length > 2 ? arguments[2] : undefined;
4015
+ return selection.selectRows(startRow, endRow, focusPosition);
3978
4016
  };
3979
4017
 
3980
4018
  /**
@@ -3993,9 +4031,16 @@ export default function Core(rootElement, userSettings) {
3993
4031
  * The previous selection is overwritten.
3994
4032
  *
3995
4033
  * ```js
3996
- * // select all cells in the table, including all headers
4034
+ * // select all cells in the table, including all headers and the corner cell
3997
4035
  * hot.selectAll();
3998
4036
  *
4037
+ * // select all cells in the table, including row headers but excluding the corner cell
4038
+ * hot.selectAll(true, false);
4039
+ *
4040
+ * // select all cells in the table, including all headers and the corner cell, but move the focus
4041
+ * // highlight to position -2, -1
4042
+ * hot.selectAll(-2, -1);
4043
+ *
3999
4044
  * // select all cells in the table, without headers
4000
4045
  * hot.selectAll(false);
4001
4046
  * ```
@@ -4003,15 +4048,20 @@ export default function Core(rootElement, userSettings) {
4003
4048
  * @since 0.38.2
4004
4049
  * @memberof Core#
4005
4050
  * @function selectAll
4006
- * @param {boolean} [includeHeaders=true] `true`: include all row, column and corner headers.
4007
- * `false`: don't include any headers.
4051
+ * @param {boolean} [includeRowHeaders=false] `true` If the selection should include the row headers,
4052
+ * `false` otherwise.
4053
+ * @param {boolean} [includeColumnHeaders=false] `true` If the selection should include the column
4054
+ * headers, `false` otherwise.
4055
+ * @param {{row: number, col: number}} [focusPosition] The argument allows changing the cell/header
4056
+ * focus position. The value takes an object with a `row` and `col` properties (visual indexes)
4057
+ * from -N to N, where negative values point to the headers and positive values point to the cell range.
4008
4058
  */
4009
4059
  this.selectAll = function () {
4010
- var includeHeaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
4011
- var includeRowHeaders = includeHeaders && this.hasRowHeaders();
4012
- var includeColumnHeaders = includeHeaders && this.hasColHeaders();
4060
+ var includeRowHeaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
4061
+ var includeColumnHeaders = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : includeRowHeaders;
4062
+ var focusPosition = arguments.length > 2 ? arguments[2] : undefined;
4013
4063
  preventScrollingToCell = true;
4014
- selection.selectAll(includeRowHeaders, includeColumnHeaders);
4064
+ selection.selectAll(includeRowHeaders, includeColumnHeaders, focusPosition);
4015
4065
  preventScrollingToCell = false;
4016
4066
  };
4017
4067
  var getIndexToScroll = function getIndexToScroll(indexMapper, visualIndex) {
@@ -4069,6 +4119,35 @@ export default function Core(rootElement, userSettings) {
4069
4119
  return false;
4070
4120
  };
4071
4121
 
4122
+ /**
4123
+ * Scrolls the viewport to coordinates specified by the currently focused cell.
4124
+ *
4125
+ * @since 14.0.0
4126
+ * @memberof Core#
4127
+ * @function scrollToFocusedCell
4128
+ * @param {Function} callback The callback function to call after the viewport is scrolled.
4129
+ */
4130
+ this.scrollToFocusedCell = function () {
4131
+ var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
4132
+ if (!this.selection.isSelected()) {
4133
+ return;
4134
+ }
4135
+ this.addHookOnce('afterScroll', callback);
4136
+ var _this$getSelectedRang = this.getSelectedRangeLast(),
4137
+ highlight = _this$getSelectedRang.highlight;
4138
+ var renderableRowIndex = this.rowIndexMapper.getRenderableFromVisualIndex(highlight.row);
4139
+ var renderableColumnIndex = this.columnIndexMapper.getRenderableFromVisualIndex(highlight.col);
4140
+ var isScrolled = this.view.scrollViewport(this._createCellCoords(renderableRowIndex, renderableColumnIndex));
4141
+ if (isScrolled) {
4142
+ this.view.render();
4143
+ } else {
4144
+ this.removeHook('afterScroll', callback);
4145
+ this._registerImmediate(function () {
4146
+ return callback();
4147
+ });
4148
+ }
4149
+ };
4150
+
4072
4151
  /**
4073
4152
  * Removes the table from the DOM and destroys the instance of the Handsontable.
4074
4153
  *
@@ -4132,8 +4211,6 @@ export default function Core(rootElement, userSettings) {
4132
4211
  if (datamap) {
4133
4212
  datamap.destroy();
4134
4213
  }
4135
- instance.rowIndexMapper = null;
4136
- instance.columnIndexMapper = null;
4137
4214
  datamap = null;
4138
4215
  grid = null;
4139
4216
  selection = null;
@@ -4417,6 +4494,16 @@ export default function Core(rootElement, userSettings) {
4417
4494
  }
4418
4495
  };
4419
4496
 
4497
+ /**
4498
+ * Gets the instance of the EditorManager.
4499
+ *
4500
+ * @private
4501
+ * @returns {EditorManager}
4502
+ */
4503
+ this._getEditorManager = function () {
4504
+ return editorManager;
4505
+ };
4506
+
4420
4507
  /**
4421
4508
  * Check if currently it is RTL direction.
4422
4509
  *
@@ -4489,296 +4576,11 @@ export default function Core(rootElement, userSettings) {
4489
4576
  this.getShortcutManager = function () {
4490
4577
  return shortcutManager;
4491
4578
  };
4492
-
4493
- /**
4494
- * Return the Focus Manager responsible for managing the browser's focus in the table.
4495
- *
4496
- * @memberof Core#
4497
- * @since 13.0.0
4498
- * @function getFocusManager
4499
- * @returns {FocusManager}
4500
- */
4501
- this.getFocusManager = function () {
4502
- return focusManager;
4503
- };
4504
- var gridContext = shortcutManager.addContext('grid');
4505
- var gridConfig = {
4506
- runOnlyIf: function runOnlyIf() {
4507
- return isDefined(instance.getSelected()) && instance.countRenderedRows() > 0 && instance.countRenderedCols() > 0;
4508
- },
4509
- group: SHORTCUTS_GROUP
4510
- };
4511
- shortcutManager.setActiveContextName('grid');
4512
- gridContext.addShortcuts([{
4513
- keys: [['Control/Meta', 'A'], ['Control/Meta', 'Shift', 'Space']],
4514
- callback: function callback() {
4515
- instance.selectAll();
4516
- }
4517
- }, {
4518
- keys: [['Control/Meta', 'Enter']],
4519
- callback: function callback() {
4520
- var selectedRange = instance.getSelectedRange();
4521
- var _selectedRange$highli = selectedRange[selectedRange.length - 1].highlight,
4522
- highlightRow = _selectedRange$highli.row,
4523
- highlightColumn = _selectedRange$highli.col;
4524
- var valueToPopulate = instance.getDataAtCell(highlightRow, highlightColumn);
4525
- var cellValues = new Map();
4526
- for (var i = 0; i < selectedRange.length; i++) {
4527
- selectedRange[i].forAll(function (row, column) {
4528
- if (row >= 0 && column >= 0 && (row !== highlightRow || column !== highlightColumn)) {
4529
- var _instance$getCellMeta = instance.getCellMeta(row, column),
4530
- readOnly = _instance$getCellMeta.readOnly;
4531
- if (!readOnly) {
4532
- cellValues.set("".concat(row, "x").concat(column), [row, column, valueToPopulate]);
4533
- }
4534
- }
4535
- });
4536
- }
4537
- instance.setDataAtCell(Array.from(cellValues.values()));
4538
- },
4539
- runOnlyIf: function runOnlyIf() {
4540
- return instance.getSelectedRangeLast().getCellsCount() > 1;
4541
- }
4542
- }, {
4543
- keys: [['ArrowUp']],
4544
- callback: function callback() {
4545
- selection.transformStart(-1, 0);
4546
- }
4547
- }, {
4548
- keys: [['ArrowUp', 'Control/Meta']],
4549
- captureCtrl: true,
4550
- callback: function callback() {
4551
- selection.setRangeStart(instance._createCellCoords(instance.rowIndexMapper.getNearestNotHiddenIndex(0, 1), instance.getSelectedRangeLast().highlight.col));
4552
- }
4553
- }, {
4554
- keys: [['ArrowUp', 'Shift']],
4555
- callback: function callback() {
4556
- selection.transformEnd(-1, 0);
4557
- }
4558
- }, {
4559
- keys: [['ArrowUp', 'Shift', 'Control/Meta']],
4560
- captureCtrl: true,
4561
- callback: function callback() {
4562
- var _instance$getSelected = instance.getSelectedRangeLast(),
4563
- from = _instance$getSelected.from,
4564
- to = _instance$getSelected.to;
4565
- var row = instance.rowIndexMapper.getNearestNotHiddenIndex(0, 1);
4566
- selection.setRangeStart(from.clone());
4567
- selection.setRangeEnd(instance._createCellCoords(row, to.col));
4568
- },
4569
- runOnlyIf: function runOnlyIf() {
4570
- return !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByColumnHeader());
4571
- }
4572
- }, {
4573
- keys: [['ArrowDown']],
4574
- callback: function callback() {
4575
- selection.transformStart(1, 0);
4576
- }
4577
- }, {
4578
- keys: [['ArrowDown', 'Control/Meta']],
4579
- captureCtrl: true,
4580
- callback: function callback() {
4581
- selection.setRangeStart(instance._createCellCoords(instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - 1, -1), instance.getSelectedRangeLast().highlight.col));
4582
- }
4583
- }, {
4584
- keys: [['ArrowDown', 'Shift']],
4585
- callback: function callback() {
4586
- selection.transformEnd(1, 0);
4587
- }
4588
- }, {
4589
- keys: [['ArrowDown', 'Shift', 'Control/Meta']],
4590
- captureCtrl: true,
4591
- callback: function callback() {
4592
- var _instance$getSelected2 = instance.getSelectedRangeLast(),
4593
- from = _instance$getSelected2.from,
4594
- to = _instance$getSelected2.to;
4595
- var row = instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - 1, -1);
4596
- selection.setRangeStart(from.clone());
4597
- selection.setRangeEnd(instance._createCellCoords(row, to.col));
4598
- },
4599
- runOnlyIf: function runOnlyIf() {
4600
- return !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByColumnHeader());
4601
- }
4602
- }, {
4603
- keys: [['ArrowLeft']],
4604
- callback: function callback() {
4605
- selection.transformStart(0, -1 * instance.getDirectionFactor());
4606
- }
4607
- }, {
4608
- keys: [['ArrowLeft', 'Control/Meta']],
4609
- captureCtrl: true,
4610
- callback: function callback() {
4611
- var _instance$columnIndex;
4612
- var row = instance.getSelectedRangeLast().highlight.row;
4613
- var column = (_instance$columnIndex = instance.columnIndexMapper).getNearestNotHiddenIndex.apply(_instance$columnIndex, _toConsumableArray(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
4614
- selection.setRangeStart(instance._createCellCoords(row, column));
4615
- }
4616
- }, {
4617
- keys: [['ArrowLeft', 'Shift']],
4618
- callback: function callback() {
4619
- selection.transformEnd(0, -1 * instance.getDirectionFactor());
4620
- }
4621
- }, {
4622
- keys: [['ArrowLeft', 'Shift', 'Control/Meta']],
4623
- captureCtrl: true,
4624
- callback: function callback() {
4625
- var _instance$columnIndex2;
4626
- var _instance$getSelected3 = instance.getSelectedRangeLast(),
4627
- from = _instance$getSelected3.from,
4628
- to = _instance$getSelected3.to;
4629
- var column = (_instance$columnIndex2 = instance.columnIndexMapper).getNearestNotHiddenIndex.apply(_instance$columnIndex2, _toConsumableArray(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
4630
- selection.setRangeStart(from.clone());
4631
- selection.setRangeEnd(instance._createCellCoords(to.row, column));
4632
- },
4633
- runOnlyIf: function runOnlyIf() {
4634
- return !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByRowHeader());
4635
- }
4636
- }, {
4637
- keys: [['ArrowRight']],
4638
- callback: function callback() {
4639
- selection.transformStart(0, instance.getDirectionFactor());
4640
- }
4641
- }, {
4642
- keys: [['ArrowRight', 'Control/Meta']],
4643
- captureCtrl: true,
4644
- callback: function callback() {
4645
- var _instance$columnIndex3;
4646
- var row = instance.getSelectedRangeLast().highlight.row;
4647
- var column = (_instance$columnIndex3 = instance.columnIndexMapper).getNearestNotHiddenIndex.apply(_instance$columnIndex3, _toConsumableArray(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
4648
- selection.setRangeStart(instance._createCellCoords(row, column));
4649
- }
4650
- }, {
4651
- keys: [['ArrowRight', 'Shift']],
4652
- callback: function callback() {
4653
- selection.transformEnd(0, instance.getDirectionFactor());
4654
- }
4655
- }, {
4656
- keys: [['ArrowRight', 'Shift', 'Control/Meta']],
4657
- captureCtrl: true,
4658
- callback: function callback() {
4659
- var _instance$columnIndex4;
4660
- var _instance$getSelected4 = instance.getSelectedRangeLast(),
4661
- from = _instance$getSelected4.from,
4662
- to = _instance$getSelected4.to;
4663
- var column = (_instance$columnIndex4 = instance.columnIndexMapper).getNearestNotHiddenIndex.apply(_instance$columnIndex4, _toConsumableArray(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
4664
- selection.setRangeStart(from.clone());
4665
- selection.setRangeEnd(instance._createCellCoords(to.row, column));
4666
- },
4667
- runOnlyIf: function runOnlyIf() {
4668
- return !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByRowHeader());
4669
- }
4670
- }, {
4671
- keys: [['Home']],
4672
- captureCtrl: true,
4673
- callback: function callback() {
4674
- var fixedColumns = parseInt(instance.getSettings().fixedColumnsStart, 10);
4675
- var row = instance.getSelectedRangeLast().highlight.row;
4676
- var column = instance.columnIndexMapper.getNearestNotHiddenIndex(fixedColumns, 1);
4677
- selection.setRangeStart(instance._createCellCoords(row, column));
4678
- },
4679
- runOnlyIf: function runOnlyIf() {
4680
- return instance.view.isMainTableNotFullyCoveredByOverlays();
4681
- }
4682
- }, {
4683
- keys: [['Home', 'Shift']],
4684
- callback: function callback() {
4685
- selection.setRangeEnd(instance._createCellCoords(selection.selectedRange.current().from.row, instance.columnIndexMapper.getNearestNotHiddenIndex(0, 1)));
4686
- }
4687
- }, {
4688
- keys: [['Home', 'Control/Meta']],
4689
- captureCtrl: true,
4690
- callback: function callback() {
4691
- var fixedRows = parseInt(instance.getSettings().fixedRowsTop, 10);
4692
- var fixedColumns = parseInt(instance.getSettings().fixedColumnsStart, 10);
4693
- var row = instance.rowIndexMapper.getNearestNotHiddenIndex(fixedRows, 1);
4694
- var column = instance.columnIndexMapper.getNearestNotHiddenIndex(fixedColumns, 1);
4695
- selection.setRangeStart(instance._createCellCoords(row, column));
4696
- },
4697
- runOnlyIf: function runOnlyIf() {
4698
- return instance.view.isMainTableNotFullyCoveredByOverlays();
4699
- }
4700
- }, {
4701
- keys: [['End']],
4702
- captureCtrl: true,
4703
- callback: function callback() {
4704
- selection.setRangeStart(instance._createCellCoords(instance.getSelectedRangeLast().highlight.row, instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1)));
4705
- },
4706
- runOnlyIf: function runOnlyIf() {
4707
- return instance.view.isMainTableNotFullyCoveredByOverlays();
4708
- }
4709
- }, {
4710
- keys: [['End', 'Shift']],
4711
- callback: function callback() {
4712
- selection.setRangeEnd(instance._createCellCoords(selection.selectedRange.current().from.row, instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1)));
4713
- }
4714
- }, {
4715
- keys: [['End', 'Control/Meta']],
4716
- captureCtrl: true,
4717
- callback: function callback() {
4718
- var fixedRows = parseInt(instance.getSettings().fixedRowsBottom, 10);
4719
- var row = instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - fixedRows - 1, -1);
4720
- var column = instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1);
4721
- selection.setRangeStart(instance._createCellCoords(row, column));
4722
- },
4723
- runOnlyIf: function runOnlyIf() {
4724
- return instance.view.isMainTableNotFullyCoveredByOverlays();
4725
- }
4726
- }, {
4727
- keys: [['PageUp']],
4728
- callback: function callback() {
4729
- selection.transformStart(-instance.countVisibleRows(), 0);
4730
- }
4731
- }, {
4732
- keys: [['PageUp', 'Shift']],
4733
- callback: function callback() {
4734
- var _instance$getSelected5 = instance.getSelectedRangeLast(),
4735
- to = _instance$getSelected5.to;
4736
- var nextRowIndexToSelect = Math.max(to.row - instance.countVisibleRows(), 0);
4737
- var row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, 1);
4738
- if (row !== null) {
4739
- var coords = instance._createCellCoords(row, to.col);
4740
- var scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
4741
- var nextVerticalScroll = Math.max(coords.row - scrollPadding, 0);
4742
- selection.setRangeEnd(coords);
4743
- instance.scrollViewportTo(nextVerticalScroll);
4744
- }
4745
- }
4746
- }, {
4747
- keys: [['PageDown']],
4748
- callback: function callback() {
4749
- selection.transformStart(instance.countVisibleRows(), 0);
4750
- }
4751
- }, {
4752
- keys: [['PageDown', 'Shift']],
4753
- callback: function callback() {
4754
- var _instance$getSelected6 = instance.getSelectedRangeLast(),
4755
- to = _instance$getSelected6.to;
4756
- var nextRowIndexToSelect = Math.min(to.row + instance.countVisibleRows(), instance.countRows() - 1);
4757
- var row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, -1);
4758
- if (row !== null) {
4759
- var coords = instance._createCellCoords(row, to.col);
4760
- var scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
4761
- var nextVerticalScroll = Math.min(coords.row - scrollPadding, instance.countRows() - 1);
4762
- selection.setRangeEnd(coords);
4763
- instance.scrollViewportTo(nextVerticalScroll);
4764
- }
4765
- }
4766
- }, {
4767
- keys: [['Tab']],
4768
- callback: function callback(event) {
4769
- var tabMoves = typeof tableMeta.tabMoves === 'function' ? tableMeta.tabMoves(event) : tableMeta.tabMoves;
4770
- selection.transformStart(tabMoves.row, tabMoves.col, true);
4771
- }
4772
- }, {
4773
- keys: [['Shift', 'Tab']],
4774
- callback: function callback(event) {
4775
- var tabMoves = typeof tableMeta.tabMoves === 'function' ? tableMeta.tabMoves(event) : tableMeta.tabMoves;
4776
- selection.transformStart(-tabMoves.row, -tabMoves.col);
4777
- }
4778
- }], gridConfig);
4779
4579
  getPluginsNames().forEach(function (pluginName) {
4780
4580
  var PluginClass = getPlugin(pluginName);
4781
4581
  pluginsRegistry.addItem(pluginName, new PluginClass(_this));
4782
4582
  });
4583
+ registerAllShortcutContexts(instance);
4584
+ shortcutManager.setActiveContextName('grid');
4783
4585
  Hooks.getSingleton().run(instance, 'construct');
4784
4586
  }