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.js CHANGED
@@ -3,8 +3,8 @@
3
3
  require("core-js/modules/es.symbol.js");
4
4
  require("core-js/modules/es.symbol.description.js");
5
5
  require("core-js/modules/es.symbol.iterator.js");
6
+ require("core-js/modules/es.regexp.to-string.js");
6
7
  require("core-js/modules/es.function.name.js");
7
- require("core-js/modules/es.object.freeze.js");
8
8
  exports.__esModule = true;
9
9
  exports.default = Core;
10
10
  require("core-js/modules/es.array.iterator.js");
@@ -13,33 +13,30 @@ require("core-js/modules/es.set.js");
13
13
  require("core-js/modules/es.string.iterator.js");
14
14
  require("core-js/modules/web.dom-collections.iterator.js");
15
15
  require("core-js/modules/es.array.includes.js");
16
+ require("core-js/modules/es.array.concat.js");
16
17
  require("core-js/modules/es.array.sort.js");
17
18
  require("core-js/modules/es.array.splice.js");
18
19
  require("core-js/modules/es.number.is-integer.js");
19
20
  require("core-js/modules/es.number.constructor.js");
20
21
  require("core-js/modules/es.array.slice.js");
21
- require("core-js/modules/es.array.concat.js");
22
22
  require("core-js/modules/es.array.fill.js");
23
23
  require("core-js/modules/es.array.map.js");
24
24
  require("core-js/modules/es.regexp.exec.js");
25
25
  require("core-js/modules/es.string.replace.js");
26
+ require("core-js/modules/es.array.filter.js");
26
27
  require("core-js/modules/es.array.from.js");
27
28
  require("core-js/modules/es.array.index-of.js");
28
29
  require("core-js/modules/es.array.reverse.js");
29
30
  require("core-js/modules/web.dom-collections.for-each.js");
30
31
  require("core-js/modules/web.timers.js");
31
32
  require("core-js/modules/web.immediate.js");
32
- require("core-js/modules/es.map.js");
33
33
  var _element = require("./helpers/dom/element");
34
34
  var _function = require("./helpers/function");
35
35
  var _mixed = require("./helpers/mixed");
36
36
  var _browser = require("./helpers/browser");
37
- var _console = require("./helpers/console");
38
- var _templateLiteralTag = require("./helpers/templateLiteralTag");
39
37
  var _editorManager = _interopRequireDefault(require("./editorManager"));
40
38
  var _eventManager = _interopRequireDefault(require("./eventManager"));
41
39
  var _object = require("./helpers/object");
42
- var _focusManager = require("./focusManager");
43
40
  var _array = require("./helpers/array");
44
41
  var _parseTable = require("./utils/parseTable");
45
42
  var _registry = require("./plugins/registry");
@@ -61,10 +58,9 @@ var _selection = require("./selection");
61
58
  var _dataMap = require("./dataMap");
62
59
  var _uniqueMap = require("./utils/dataStructures/uniqueMap");
63
60
  var _shortcuts = require("./shortcuts");
64
- var _templateObject, _templateObject2;
61
+ var _shortcutContexts = require("./shortcutContexts");
65
62
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
66
63
  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); }
67
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
68
64
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
69
65
  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."); }
70
66
  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; } }
@@ -75,8 +71,14 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
75
71
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
76
72
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
77
73
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
78
- var SHORTCUTS_GROUP = 'gridDefault';
79
74
  var activeGuid = null;
75
+
76
+ /**
77
+ * A set of deprecated feature names.
78
+ *
79
+ * @type {Set<string>}
80
+ */
81
+ // eslint-disable-next-line no-unused-vars
80
82
  var deprecationWarns = new Set();
81
83
 
82
84
  /* eslint-disable jsdoc/require-description-complete-sentence */
@@ -108,7 +110,7 @@ var deprecationWarns = new Set();
108
110
  * :::
109
111
  *
110
112
  * ::: only-for react
111
- * ```jsx{3,7,13}
113
+ * ```jsx
112
114
  * import { useRef } from 'react';
113
115
  *
114
116
  * const hotTableComponent = useRef(null);
@@ -140,7 +142,6 @@ function Core(rootElement, userSettings) {
140
142
  var dataSource;
141
143
  var grid;
142
144
  var editorManager;
143
- var focusManager;
144
145
  var firstRun = true;
145
146
  if ((0, _rootInstance.hasValidParameter)(rootInstanceSymbol)) {
146
147
  (0, _rootInstance.registerAsRootInstance)(this);
@@ -265,6 +266,12 @@ function Core(rootElement, userSettings) {
265
266
  * @type {IndexMapper}
266
267
  */
267
268
  this.rowIndexMapper = new _translations.IndexMapper();
269
+ this.columnIndexMapper.addLocalHook('indexesSequenceChange', function (source) {
270
+ instance.runHooks('afterColumnSequenceChange', source);
271
+ });
272
+ this.rowIndexMapper.addLocalHook('indexesSequenceChange', function (source) {
273
+ instance.runHooks('afterRowSequenceChange', source);
274
+ });
268
275
  dataSource = new _dataSource.default(instance);
269
276
  if (!this.rootElement.id || this.rootElement.id.substring(0, 3) === 'ht_') {
270
277
  this.rootElement.id = this.guid; // if root element does not have an id, assign a random id
@@ -287,12 +294,8 @@ function Core(rootElement, userSettings) {
287
294
  };
288
295
 
289
296
  var selection = new _selection.Selection(tableMeta, {
290
- rowIndexMapper: function rowIndexMapper() {
291
- return instance.rowIndexMapper;
292
- },
293
- columnIndexMapper: function columnIndexMapper() {
294
- return instance.columnIndexMapper;
295
- },
297
+ rowIndexMapper: instance.rowIndexMapper,
298
+ columnIndexMapper: instance.columnIndexMapper,
296
299
  countCols: function countCols() {
297
300
  return instance.countCols();
298
301
  },
@@ -305,10 +308,10 @@ function Core(rootElement, userSettings) {
305
308
  isEditorOpened: function isEditorOpened() {
306
309
  return instance.getActiveEditor() ? instance.getActiveEditor().isOpened() : false;
307
310
  },
308
- countColsTranslated: function countColsTranslated() {
311
+ countRenderableColumns: function countRenderableColumns() {
309
312
  return _this.view.countRenderableColumns();
310
313
  },
311
- countRowsTranslated: function countRowsTranslated() {
314
+ countRenderableRows: function countRenderableRows() {
312
315
  return _this.view.countRenderableRows();
313
316
  },
314
317
  countRowHeaders: function countRowHeaders() {
@@ -349,12 +352,6 @@ function Core(rootElement, userSettings) {
349
352
  });
350
353
  this.selection.addLocalHook('beforeSetRangeEnd', function (cellCoords) {
351
354
  _this.runHooks('beforeSetRangeEnd', cellCoords);
352
- if (cellCoords.row < 0) {
353
- cellCoords.row = _this.view._wt.wtTable.getFirstVisibleRow();
354
- }
355
- if (cellCoords.col < 0) {
356
- cellCoords.col = _this.view._wt.wtTable.getFirstVisibleColumn();
357
- }
358
355
  });
359
356
  this.selection.addLocalHook('afterSetRangeEnd', function (cellCoords) {
360
357
  var preventScrolling = (0, _object.createObjectPropListener)(false);
@@ -380,7 +377,14 @@ function Core(rootElement, userSettings) {
380
377
  if (scrollToCell !== false) {
381
378
  if (!isSelectedByAnyHeader) {
382
379
  if (currentSelectedRange && !_this.selection.isMultiple()) {
383
- _this.view.scrollViewport(visualToRenderableCoords(currentSelectedRange.from));
380
+ var renderableCoords = visualToRenderableCoords(currentSelectedRange.from);
381
+ if (renderableCoords.row < 0 && renderableCoords.col >= 0) {
382
+ _this.view.scrollViewportHorizontally(renderableCoords.col);
383
+ } else if (renderableCoords.col < 0 && renderableCoords.row >= 0) {
384
+ _this.view.scrollViewportVertically(renderableCoords.row);
385
+ } else {
386
+ _this.view.scrollViewport(renderableCoords);
387
+ }
384
388
  } else {
385
389
  _this.view.scrollViewport(visualToRenderableCoords(cellCoords));
386
390
  }
@@ -421,6 +425,30 @@ function Core(rootElement, userSettings) {
421
425
  isMultiple.value = changedIsMultiple;
422
426
  }
423
427
  });
428
+ this.selection.addLocalHook('beforeSelectColumns', function () {
429
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
430
+ args[_key] = arguments[_key];
431
+ }
432
+ return _this.runHooks.apply(_this, ['beforeSelectColumns'].concat(args));
433
+ });
434
+ this.selection.addLocalHook('afterSelectColumns', function () {
435
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
436
+ args[_key2] = arguments[_key2];
437
+ }
438
+ return _this.runHooks.apply(_this, ['afterSelectColumns'].concat(args));
439
+ });
440
+ this.selection.addLocalHook('beforeSelectRows', function () {
441
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
442
+ args[_key3] = arguments[_key3];
443
+ }
444
+ return _this.runHooks.apply(_this, ['beforeSelectRows'].concat(args));
445
+ });
446
+ this.selection.addLocalHook('afterSelectRows', function () {
447
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
448
+ args[_key4] = arguments[_key4];
449
+ }
450
+ return _this.runHooks.apply(_this, ['afterSelectRows'].concat(args));
451
+ });
424
452
  this.selection.addLocalHook('beforeModifyTransformStart', function (cellCoordsDelta) {
425
453
  _this.runHooks('modifyTransformStart', cellCoordsDelta);
426
454
  });
@@ -506,13 +534,6 @@ function Core(rootElement, userSettings) {
506
534
 
507
535
  /* eslint-disable no-case-declarations */
508
536
  switch (action) {
509
- case 'insert_row':
510
- // backward compatibility
511
- if (!deprecationWarns.has(action)) {
512
- deprecationWarns.add(action);
513
- (0, _console.warn)((0, _templateLiteralTag.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));
514
- }
515
- // falls through
516
537
  case 'insert_row_below':
517
538
  case 'insert_row_above':
518
539
  var numberOfSourceRows = instance.countSourceRows();
@@ -523,11 +544,9 @@ function Core(rootElement, userSettings) {
523
544
  // `above` is the default behavior for creating new rows
524
545
  var insertRowMode = action === 'insert_row_below' ? 'below' : 'above';
525
546
 
526
- // The line below ensures backward compatibility of the `alter()` method's `insert_row` action.
527
- // Calling the `insert_row` action with no arguments adds a new row at the end of the data set.
528
547
  // Calling the `insert_row_above` action adds a new row at the beginning of the data set.
529
548
  // eslint-disable-next-line no-param-reassign
530
- index = (_index = index) !== null && _index !== void 0 ? _index : action === 'insert_row' || insertRowMode === 'below' ? numberOfSourceRows : 0;
549
+ index = (_index = index) !== null && _index !== void 0 ? _index : insertRowMode === 'below' ? numberOfSourceRows : 0;
531
550
  var _datamap$createRow = datamap.createRow(index, amount, {
532
551
  source: source,
533
552
  mode: insertRowMode
@@ -566,23 +585,14 @@ function Core(rootElement, userSettings) {
566
585
  }
567
586
 
568
587
  break;
569
- case 'insert_col':
570
- // backward compatibility
571
- if (!deprecationWarns.has(action)) {
572
- deprecationWarns.add(action);
573
- (0, _console.warn)((0, _templateLiteralTag.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));
574
- }
575
- // falls through
576
588
  case 'insert_col_start':
577
589
  case 'insert_col_end':
578
590
  // "start" is a default behavior for creating new columns
579
591
  var insertColumnMode = action === 'insert_col_end' ? 'end' : 'start';
580
592
 
581
- // The line below ensures backward compatibility of the `alter()` method's `insert_col` action.
582
- // Calling the `insert_col` action with no arguments adds a new column to the right of the data set.
583
593
  // Calling the `insert_col_start` action adds a new column to the left of the data set.
584
594
  // eslint-disable-next-line no-param-reassign
585
- index = (_index2 = index) !== null && _index2 !== void 0 ? _index2 : action === 'insert_col' || insertColumnMode === 'end' ? instance.countSourceCols() : 0;
595
+ index = (_index2 = index) !== null && _index2 !== void 0 ? _index2 : insertColumnMode === 'end' ? instance.countSourceCols() : 0;
586
596
  var _datamap$createCol = datamap.createCol(index, amount, {
587
597
  source: source,
588
598
  mode: insertColumnMode
@@ -853,13 +863,9 @@ function Core(rootElement, userSettings) {
853
863
  * @param {object} [end] End selection position (only for drag-down mode). Visual indexes.
854
864
  * @param {string} [source="populateFromArray"] Source information string.
855
865
  * @param {string} [method="overwrite"] Populate method. Possible options: `shift_down`, `shift_right`, `overwrite`.
856
- * @param {string} direction (left|right|up|down) String specifying the direction.
857
- * @param {Array} deltas The deltas array. A difference between values of adjacent cells.
858
- * Useful **only** when the type of handled cells is `numeric`.
859
866
  * @returns {object|undefined} Ending td in pasted area (only if any cell was changed).
860
867
  */
861
- populateFromArray: function populateFromArray(start, input, end, source, method, direction, deltas) {
862
- // TODO: either remove or implement the `direction` argument. Currently it's not working at all.
868
+ populateFromArray: function populateFromArray(start, input, end, source, method) {
863
869
  var r;
864
870
  var rlen;
865
871
  var c;
@@ -947,11 +953,6 @@ function Core(rootElement, userSettings) {
947
953
  // overwrite and other not specified options
948
954
  current.row = start.row;
949
955
  current.col = start.col;
950
- var selected = {
951
- // selected range
952
- row: end && start ? end.row - start.row + 1 : 1,
953
- col: end && start ? end.col - start.col + 1 : 1
954
- };
955
956
  var skippedRow = 0;
956
957
  var skippedColumn = 0;
957
958
  var pushData = true;
@@ -1012,16 +1013,6 @@ function Core(rootElement, userSettings) {
1012
1013
  var visualColumn = c - skippedColumn;
1013
1014
  var value = getInputValue(visualRow, visualColumn);
1014
1015
  var orgValue = instance.getDataAtCell(current.row, current.col);
1015
- var index = {
1016
- row: visualRow,
1017
- col: visualColumn
1018
- };
1019
- if (source === 'Autofill.fill') {
1020
- var result = instance.runHooks('beforeAutofillInsidePopulate', index, direction, input, deltas, {}, selected);
1021
- if (result) {
1022
- value = (0, _mixed.isUndefined)(result.value) ? value : result.value;
1023
- }
1024
- }
1025
1016
  if (value !== null && _typeof(value) === 'object') {
1026
1017
  // when 'value' is array and 'orgValue' is null, set 'orgValue' to
1027
1018
  // an empty array so that the null value can be compared to 'value'
@@ -1115,7 +1106,6 @@ function Core(rootElement, userSettings) {
1115
1106
  this.updateSettings(tableMeta, true);
1116
1107
  this.view = new _tableView.default(this);
1117
1108
  editorManager = _editorManager.default.getInstance(instance, tableMeta, selection);
1118
- focusManager = new _focusManager.FocusManager(instance);
1119
1109
  instance.runHooks('init');
1120
1110
  this.forceFullRender = true; // used when data was changed
1121
1111
  this.view.render();
@@ -1192,15 +1182,8 @@ function Core(rootElement, userSettings) {
1192
1182
  return;
1193
1183
  }
1194
1184
  var activeEditor = instance.getActiveEditor();
1195
- var beforeChangeResult = instance.runHooks('beforeChange', changes, source || 'edit');
1196
- var shouldBeCanceled = true;
1197
- if (beforeChangeResult === false) {
1198
- if (activeEditor) {
1199
- activeEditor.cancelChanges();
1200
- }
1201
- return;
1202
- }
1203
1185
  var waitingForValidator = new ValidatorsQueue();
1186
+ var shouldBeCanceled = true;
1204
1187
  waitingForValidator.onQueueEmpty = function (isValid) {
1205
1188
  if (activeEditor && shouldBeCanceled) {
1206
1189
  activeEditor.cancelChanges();
@@ -1209,43 +1192,37 @@ function Core(rootElement, userSettings) {
1209
1192
  };
1210
1193
 
1211
1194
  for (var i = changes.length - 1; i >= 0; i--) {
1212
- if (changes[i] === null) {
1213
- changes.splice(i, 1);
1214
- } else {
1215
- var _changes$i = _slicedToArray(changes[i], 4),
1216
- row = _changes$i[0],
1217
- prop = _changes$i[1],
1218
- newValue = _changes$i[3];
1219
- var col = datamap.propToCol(prop);
1220
- var cellProperties = instance.getCellMeta(row, col);
1221
- if (cellProperties.type === 'numeric' && typeof newValue === 'string' && (0, _number.isNumericLike)(newValue)) {
1222
- changes[i][3] = getParsedNumber(newValue);
1223
- }
1195
+ var _changes$i = _slicedToArray(changes[i], 4),
1196
+ row = _changes$i[0],
1197
+ prop = _changes$i[1],
1198
+ newValue = _changes$i[3];
1199
+ var col = datamap.propToCol(prop);
1200
+ var cellProperties = instance.getCellMeta(row, col);
1201
+ if (cellProperties.type === 'numeric' && typeof newValue === 'string' && (0, _number.isNumericLike)(newValue)) {
1202
+ changes[i][3] = getParsedNumber(newValue);
1203
+ }
1224
1204
 
1225
- /* eslint-disable no-loop-func */
1226
- if (instance.getCellValidator(cellProperties)) {
1227
- waitingForValidator.addValidatorToQueue();
1228
- instance.validateCell(changes[i][3], cellProperties, function (index, cellPropertiesReference) {
1229
- return function (result) {
1230
- if (typeof result !== 'boolean') {
1231
- throw new Error('Validation error: result is not boolean');
1232
- }
1233
- if (result === false && cellPropertiesReference.allowInvalid === false) {
1234
- shouldBeCanceled = false;
1235
- changes.splice(index, 1); // cancel the change
1236
- cellPropertiesReference.valid = true; // we cancelled the change, so cell value is still valid
1237
-
1238
- var cell = instance.getCell(cellPropertiesReference.visualRow, cellPropertiesReference.visualCol);
1239
- if (cell !== null) {
1240
- (0, _element.removeClass)(cell, tableMeta.invalidCellClassName);
1241
- }
1242
- // index -= 1;
1205
+ /* eslint-disable no-loop-func */
1206
+ if (instance.getCellValidator(cellProperties)) {
1207
+ waitingForValidator.addValidatorToQueue();
1208
+ instance.validateCell(changes[i][3], cellProperties, function (index, cellPropertiesReference) {
1209
+ return function (result) {
1210
+ if (typeof result !== 'boolean') {
1211
+ throw new Error('Validation error: result is not boolean');
1212
+ }
1213
+ if (result === false && cellPropertiesReference.allowInvalid === false) {
1214
+ shouldBeCanceled = false;
1215
+ changes.splice(index, 1); // cancel the change
1216
+ cellPropertiesReference.valid = true; // we cancelled the change, so cell value is still valid
1217
+
1218
+ var cell = instance.getCell(cellPropertiesReference.visualRow, cellPropertiesReference.visualCol);
1219
+ if (cell !== null) {
1220
+ (0, _element.removeClass)(cell, tableMeta.invalidCellClassName);
1243
1221
  }
1244
-
1245
- waitingForValidator.removeValidatorFormQueue();
1246
- };
1247
- }(i, cellProperties), source);
1248
- }
1222
+ }
1223
+ waitingForValidator.removeValidatorFormQueue();
1224
+ };
1225
+ }(i, cellProperties), source);
1249
1226
  }
1250
1227
  }
1251
1228
  waitingForValidator.checkIfQueueIsEmpty();
@@ -1435,6 +1412,31 @@ function Core(rootElement, userSettings) {
1435
1412
  return [[row, propOrCol, value]];
1436
1413
  }
1437
1414
 
1415
+ /**
1416
+ * Process changes prepared for applying to the dataset (unifying list of changes, closing an editor - when needed,
1417
+ * calling a hook).
1418
+ *
1419
+ * @private
1420
+ * @param {Array} changes Array of changes in format `[[row, col, value],...]`.
1421
+ * @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.
1422
+ * @returns {Array} List of changes finally applied to the dataset.
1423
+ */
1424
+ function processChanges(changes, source) {
1425
+ var activeEditor = instance.getActiveEditor();
1426
+ var beforeChangeResult = instance.runHooks('beforeChange', changes, source || 'edit');
1427
+ // The `beforeChange` hook could add a `null` for purpose of cancelling some dataset's change.
1428
+ var filteredChanges = changes.filter(function (change) {
1429
+ return change !== null;
1430
+ });
1431
+ if (beforeChangeResult === false || filteredChanges.length === 0) {
1432
+ if (activeEditor) {
1433
+ activeEditor.cancelChanges();
1434
+ }
1435
+ return [];
1436
+ }
1437
+ return filteredChanges;
1438
+ }
1439
+
1438
1440
  /**
1439
1441
  * @description
1440
1442
  * Set new value to a cell. To change many cells at once (recommended way), pass an array of `changes` in format
@@ -1472,9 +1474,10 @@ function Core(rootElement, userSettings) {
1472
1474
  if (!changeSource && _typeof(row) === 'object') {
1473
1475
  changeSource = column;
1474
1476
  }
1475
- instance.runHooks('afterSetDataAtCell', changes, changeSource);
1476
- validateChanges(changes, changeSource, function () {
1477
- applyChanges(changes, changeSource);
1477
+ var processedChanges = processChanges(changes, source);
1478
+ instance.runHooks('afterSetDataAtCell', processedChanges, changeSource);
1479
+ validateChanges(processedChanges, changeSource, function () {
1480
+ applyChanges(processedChanges, changeSource);
1478
1481
  });
1479
1482
  };
1480
1483
 
@@ -1502,9 +1505,10 @@ function Core(rootElement, userSettings) {
1502
1505
  if (!changeSource && _typeof(row) === 'object') {
1503
1506
  changeSource = prop;
1504
1507
  }
1505
- instance.runHooks('afterSetDataAtRowProp', changes, changeSource);
1506
- validateChanges(changes, changeSource, function () {
1507
- applyChanges(changes, changeSource);
1508
+ var processedChanges = processChanges(changes, source);
1509
+ instance.runHooks('afterSetDataAtRowProp', processedChanges, changeSource);
1510
+ validateChanges(processedChanges, changeSource, function () {
1511
+ applyChanges(processedChanges, changeSource);
1508
1512
  });
1509
1513
  };
1510
1514
 
@@ -1579,18 +1583,15 @@ function Core(rootElement, userSettings) {
1579
1583
  * @param {number} [endCol] End visual column index (use when you want to cut input when certain column is reached).
1580
1584
  * @param {string} [source=populateFromArray] Used to identify this call in the resulting events (beforeChange, afterChange).
1581
1585
  * @param {string} [method=overwrite] Populate method, possible values: `'shift_down'`, `'shift_right'`, `'overwrite'`.
1582
- * @param {string} direction Populate direction, possible values: `'left'`, `'right'`, `'up'`, `'down'`.
1583
- * @param {Array} deltas The deltas array. A difference between values of adjacent cells.
1584
- * Useful **only** when the type of handled cells is `numeric`.
1585
1586
  * @returns {object|undefined} Ending td in pasted area (only if any cell was changed).
1586
1587
  */
1587
- this.populateFromArray = function (row, column, input, endRow, endCol, source, method, direction, deltas) {
1588
+ this.populateFromArray = function (row, column, input, endRow, endCol, source, method) {
1588
1589
  if (!(_typeof(input) === 'object' && _typeof(input[0]) === 'object')) {
1589
1590
  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
1590
1591
  }
1591
1592
 
1592
1593
  var c = typeof endRow === 'number' ? instance._createCellCoords(endRow, endCol) : null;
1593
- return grid.populateFromArray(instance._createCellCoords(row, column), input, c, source, method, direction, deltas);
1594
+ return grid.populateFromArray(instance._createCellCoords(row, column), input, c, source, method);
1594
1595
  };
1595
1596
 
1596
1597
  /**
@@ -1606,8 +1607,8 @@ function Core(rootElement, userSettings) {
1606
1607
  */
1607
1608
  this.spliceCol = function (column, index, amount) {
1608
1609
  var _datamap;
1609
- for (var _len = arguments.length, elements = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
1610
- elements[_key - 3] = arguments[_key];
1610
+ for (var _len5 = arguments.length, elements = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
1611
+ elements[_key5 - 3] = arguments[_key5];
1611
1612
  }
1612
1613
  return (_datamap = datamap).spliceCol.apply(_datamap, [column, index, amount].concat(elements));
1613
1614
  };
@@ -1625,8 +1626,8 @@ function Core(rootElement, userSettings) {
1625
1626
  */
1626
1627
  this.spliceRow = function (row, index, amount) {
1627
1628
  var _datamap2;
1628
- for (var _len2 = arguments.length, elements = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
1629
- elements[_key2 - 3] = arguments[_key2];
1629
+ for (var _len6 = arguments.length, elements = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
1630
+ elements[_key6 - 3] = arguments[_key6];
1630
1631
  }
1631
1632
  return (_datamap2 = datamap).spliceRow.apply(_datamap2, [row, index, amount].concat(elements));
1632
1633
  };
@@ -1722,6 +1723,9 @@ function Core(rootElement, userSettings) {
1722
1723
  }
1723
1724
  var changes = [];
1724
1725
  (0, _array.arrayEach)(selection.getSelectedRange(), function (cellRange) {
1726
+ if (cellRange.isSingleHeader()) {
1727
+ return;
1728
+ }
1725
1729
  var topStart = cellRange.getTopStartCorner();
1726
1730
  var bottomEnd = cellRange.getBottomEndCorner();
1727
1731
  (0, _number.rangeEach)(topStart.row, bottomEnd.row, function (row) {
@@ -2451,11 +2455,13 @@ function Core(rootElement, userSettings) {
2451
2455
  };
2452
2456
 
2453
2457
  /**
2454
- * Get value from the selected cell.
2458
+ * Gets the value of the currently focused cell.
2459
+ *
2460
+ * For column headers and row headers, returns `null`.
2455
2461
  *
2456
2462
  * @memberof Core#
2457
2463
  * @function getValue
2458
- * @returns {*} Value of selected cell.
2464
+ * @returns {*} The value of the focused cell.
2459
2465
  */
2460
2466
  this.getValue = function () {
2461
2467
  var sel = instance.getSelectedLast();
@@ -2514,10 +2520,11 @@ function Core(rootElement, userSettings) {
2514
2520
  * | `'insert_col_start'` | Inserts columns before the `index` column. | Inserts columns before the first column. |
2515
2521
  * | `'insert_col_end'` | Inserts columns after the `index` column. | Inserts columns after the last column. |
2516
2522
  * | `'remove_col'` | Removes columns, starting from the `index` column. | Removes columns, starting from the last column. |
2517
- * | `'insert_row'` (<b>Deprecated</b>) | Inserts rows above the `index` row. | Inserts rows below the last row. |
2518
- * | `'insert_col'` (<b>Deprecated</b>) | Inserts columns before the `index` column. | Inserts columns after the last column. |
2519
2523
  *
2520
- * The behavior of `'insert_col_start'`, `'insert_col_end'`, and `'insert_col'` depends on your [`layoutDirection`](@/api/options.md#layoutdirection).
2524
+ * Additional information about `'insert_col_start'` and `'insert_col_end'`:
2525
+ * - Their behavior depends on your [`layoutDirection`](@/api/options.md#layoutdirection).
2526
+ * - If the provided `index` is higher than the actual number of columns, Handsontable doesn't generate
2527
+ * the columns missing in between. Instead, the new columns are inserted next to the last column.
2521
2528
  *
2522
2529
  * @memberof Core#
2523
2530
  * @function alter
@@ -2529,8 +2536,6 @@ function Core(rootElement, userSettings) {
2529
2536
  * <li> `'insert_col_start'` </li>
2530
2537
  * <li> `'insert_col_end'` </li>
2531
2538
  * <li> `'remove_col'` </li>
2532
- * <li> `'insert_row'` (<b>Deprecated</b>) </li>
2533
- * <li> `'insert_col'` (<b>Deprecated</b>) </li>
2534
2539
  * </ul>
2535
2540
  * @param {number|number[]} [index] A visual index of the row/column before or after which the new row/column will be
2536
2541
  * inserted or removed. Can also be an array of arrays, in format `[[index, amount],...]`.
@@ -2798,6 +2803,11 @@ function Core(rootElement, userSettings) {
2798
2803
  * __Note__: This method does not participate in data transformation. If the visual data of the table is reordered,
2799
2804
  * sorted or trimmed only physical indexes are correct.
2800
2805
  *
2806
+ * __Note__: This method may return incorrect values for cells that contain
2807
+ * [formulas](@/guides/formulas/formula-calculation.md). This is because `getSourceData()`
2808
+ * operates on source data ([physical indexes](@/api/indexMapper.md)),
2809
+ * whereas formulas operate on visual data (visual indexes).
2810
+ *
2801
2811
  * @memberof Core#
2802
2812
  * @function getSourceData
2803
2813
  * @param {number} [row] From physical row index.
@@ -3030,8 +3040,8 @@ function Core(rootElement, userSettings) {
3030
3040
  this.spliceCellsMeta = function (visualIndex) {
3031
3041
  var _this5 = this;
3032
3042
  var deleteAmount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
3033
- for (var _len3 = arguments.length, cellMetaRows = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
3034
- cellMetaRows[_key3 - 2] = arguments[_key3];
3043
+ for (var _len7 = arguments.length, cellMetaRows = new Array(_len7 > 2 ? _len7 - 2 : 0), _key7 = 2; _key7 < _len7; _key7++) {
3044
+ cellMetaRows[_key7 - 2] = arguments[_key7];
3035
3045
  }
3036
3046
  if (cellMetaRows.length > 0 && !Array.isArray(cellMetaRows[0])) {
3037
3047
  throw new Error('The 3rd argument (cellMetaRows) has to be passed as an array of cell meta objects array.');
@@ -3147,7 +3157,13 @@ function Core(rootElement, userSettings) {
3147
3157
  };
3148
3158
 
3149
3159
  /**
3150
- * Checks if the data format and config allows user to modify the column structure.
3160
+ * Checks if your [data format](@/guides/getting-started/binding-to-data.md#compatible-data-types)
3161
+ * and [configuration options](@/guides/getting-started/configuration-options.md)
3162
+ * allow for changing the number of columns.
3163
+ *
3164
+ * Returns `false` when your data is an array of objects,
3165
+ * or when you use the [`columns`](@/api/options.md#columns) option.
3166
+ * Otherwise, returns `true`.
3151
3167
  *
3152
3168
  * @memberof Core#
3153
3169
  * @function isColumnModificationAllowed
@@ -3230,10 +3246,16 @@ function Core(rootElement, userSettings) {
3230
3246
  };
3231
3247
 
3232
3248
  /**
3233
- * Validates all cells using their validator functions and calls callback when finished.
3249
+ * Validates every cell in the data set,
3250
+ * using a [validator function](@/guides/cell-functions/cell-validator.md) configured for each cell.
3234
3251
  *
3235
- * If one of the cells is invalid, the callback will be fired with `'valid'` arguments as `false` - otherwise it
3236
- * would equal `true`.
3252
+ * Doesn't validate cells that are currently [trimmed](@/guides/rows/row-trimming.md),
3253
+ * [hidden](@/guides/rows/row-hiding.md), or [filtered](@/guides/columns/column-filter.md),
3254
+ * as such cells are not included in the data set until you bring them back again.
3255
+ *
3256
+ * After the validation, the `callback` function is fired, with the `valid` argument set to:
3257
+ * - `true` for valid cells
3258
+ * - `false` for invalid cells
3237
3259
  *
3238
3260
  * @memberof Core#
3239
3261
  * @function validateCells
@@ -3716,7 +3738,7 @@ function Core(rootElement, userSettings) {
3716
3738
  /**
3717
3739
  * Returns the number of rendered row headers.
3718
3740
  *
3719
- * @since 13.0.0
3741
+ * @since 14.0.0
3720
3742
  * @memberof Core#
3721
3743
  * @function countRowHeaders
3722
3744
  * @returns {number} Number of row headers.
@@ -3728,7 +3750,7 @@ function Core(rootElement, userSettings) {
3728
3750
  /**
3729
3751
  * Returns the number of rendered column headers.
3730
3752
  *
3731
- * @since 13.0.0
3753
+ * @since 14.0.0
3732
3754
  * @memberof Core#
3733
3755
  * @function countColHeaders
3734
3756
  * @returns {number} Number of column headers.
@@ -3941,6 +3963,10 @@ function Core(rootElement, userSettings) {
3941
3963
  * hot.selectColumns('id');
3942
3964
  * // Select range of columns using visual indexes.
3943
3965
  * hot.selectColumns(1, 4);
3966
+ * // Select range of columns using visual indexes and mark the first header as highlighted.
3967
+ * hot.selectColumns(1, 2, -1);
3968
+ * // Select range of columns using visual indexes and mark the second cell as highlighted.
3969
+ * hot.selectColumns(2, 1, 1);
3944
3970
  * // Select range of columns using column properties.
3945
3971
  * hot.selectColumns('id', 'last_name');
3946
3972
  * ```
@@ -3951,11 +3977,15 @@ function Core(rootElement, userSettings) {
3951
3977
  * @param {number} startColumn The visual column index from which the selection starts.
3952
3978
  * @param {number} [endColumn=startColumn] The visual column index to which the selection finishes. If `endColumn`
3953
3979
  * is not defined the column defined by `startColumn` will be selected.
3980
+ * @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
3981
+ * The value can take visual row index from -N to N, where negative values
3982
+ * point to the headers and positive values point to the cell range.
3954
3983
  * @returns {boolean} `true` if selection was successful, `false` otherwise.
3955
3984
  */
3956
3985
  this.selectColumns = function (startColumn) {
3957
3986
  var endColumn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startColumn;
3958
- return selection.selectColumns(startColumn, endColumn);
3987
+ var focusPosition = arguments.length > 2 ? arguments[2] : undefined;
3988
+ return selection.selectColumns(startColumn, endColumn, focusPosition);
3959
3989
  };
3960
3990
 
3961
3991
  /**
@@ -3965,8 +3995,12 @@ function Core(rootElement, userSettings) {
3965
3995
  * ```js
3966
3996
  * // Select row using visual index.
3967
3997
  * hot.selectRows(1);
3968
- * // Select range of rows using visual indexes.
3998
+ * // select a range of rows, using visual indexes.
3969
3999
  * hot.selectRows(1, 4);
4000
+ * // select a range of rows, using visual indexes, and mark the header as highlighted.
4001
+ * hot.selectRows(1, 2, -1);
4002
+ * // Select range of rows using visual indexes and mark the second cell as highlighted.
4003
+ * hot.selectRows(2, 1, 1);
3970
4004
  * ```
3971
4005
  *
3972
4006
  * @memberof Core#
@@ -3975,11 +4009,15 @@ function Core(rootElement, userSettings) {
3975
4009
  * @param {number} startRow The visual row index from which the selection starts.
3976
4010
  * @param {number} [endRow=startRow] The visual row index to which the selection finishes. If `endRow`
3977
4011
  * is not defined the row defined by `startRow` will be selected.
4012
+ * @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
4013
+ * The value can take visual column index from -N to N, where negative values
4014
+ * point to the headers and positive values point to the cell range.
3978
4015
  * @returns {boolean} `true` if selection was successful, `false` otherwise.
3979
4016
  */
3980
4017
  this.selectRows = function (startRow) {
3981
4018
  var endRow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startRow;
3982
- return selection.selectRows(startRow, endRow);
4019
+ var focusPosition = arguments.length > 2 ? arguments[2] : undefined;
4020
+ return selection.selectRows(startRow, endRow, focusPosition);
3983
4021
  };
3984
4022
 
3985
4023
  /**
@@ -3998,9 +4036,16 @@ function Core(rootElement, userSettings) {
3998
4036
  * The previous selection is overwritten.
3999
4037
  *
4000
4038
  * ```js
4001
- * // select all cells in the table, including all headers
4039
+ * // select all cells in the table, including all headers and the corner cell
4002
4040
  * hot.selectAll();
4003
4041
  *
4042
+ * // select all cells in the table, including row headers but excluding the corner cell
4043
+ * hot.selectAll(true, false);
4044
+ *
4045
+ * // select all cells in the table, including all headers and the corner cell, but move the focus
4046
+ * // highlight to position -2, -1
4047
+ * hot.selectAll(-2, -1);
4048
+ *
4004
4049
  * // select all cells in the table, without headers
4005
4050
  * hot.selectAll(false);
4006
4051
  * ```
@@ -4008,15 +4053,20 @@ function Core(rootElement, userSettings) {
4008
4053
  * @since 0.38.2
4009
4054
  * @memberof Core#
4010
4055
  * @function selectAll
4011
- * @param {boolean} [includeHeaders=true] `true`: include all row, column and corner headers.
4012
- * `false`: don't include any headers.
4056
+ * @param {boolean} [includeRowHeaders=false] `true` If the selection should include the row headers,
4057
+ * `false` otherwise.
4058
+ * @param {boolean} [includeColumnHeaders=false] `true` If the selection should include the column
4059
+ * headers, `false` otherwise.
4060
+ * @param {{row: number, col: number}} [focusPosition] The argument allows changing the cell/header
4061
+ * focus position. The value takes an object with a `row` and `col` properties (visual indexes)
4062
+ * from -N to N, where negative values point to the headers and positive values point to the cell range.
4013
4063
  */
4014
4064
  this.selectAll = function () {
4015
- var includeHeaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
4016
- var includeRowHeaders = includeHeaders && this.hasRowHeaders();
4017
- var includeColumnHeaders = includeHeaders && this.hasColHeaders();
4065
+ var includeRowHeaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
4066
+ var includeColumnHeaders = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : includeRowHeaders;
4067
+ var focusPosition = arguments.length > 2 ? arguments[2] : undefined;
4018
4068
  preventScrollingToCell = true;
4019
- selection.selectAll(includeRowHeaders, includeColumnHeaders);
4069
+ selection.selectAll(includeRowHeaders, includeColumnHeaders, focusPosition);
4020
4070
  preventScrollingToCell = false;
4021
4071
  };
4022
4072
  var getIndexToScroll = function getIndexToScroll(indexMapper, visualIndex) {
@@ -4074,6 +4124,35 @@ function Core(rootElement, userSettings) {
4074
4124
  return false;
4075
4125
  };
4076
4126
 
4127
+ /**
4128
+ * Scrolls the viewport to coordinates specified by the currently focused cell.
4129
+ *
4130
+ * @since 14.0.0
4131
+ * @memberof Core#
4132
+ * @function scrollToFocusedCell
4133
+ * @param {Function} callback The callback function to call after the viewport is scrolled.
4134
+ */
4135
+ this.scrollToFocusedCell = function () {
4136
+ var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
4137
+ if (!this.selection.isSelected()) {
4138
+ return;
4139
+ }
4140
+ this.addHookOnce('afterScroll', callback);
4141
+ var _this$getSelectedRang = this.getSelectedRangeLast(),
4142
+ highlight = _this$getSelectedRang.highlight;
4143
+ var renderableRowIndex = this.rowIndexMapper.getRenderableFromVisualIndex(highlight.row);
4144
+ var renderableColumnIndex = this.columnIndexMapper.getRenderableFromVisualIndex(highlight.col);
4145
+ var isScrolled = this.view.scrollViewport(this._createCellCoords(renderableRowIndex, renderableColumnIndex));
4146
+ if (isScrolled) {
4147
+ this.view.render();
4148
+ } else {
4149
+ this.removeHook('afterScroll', callback);
4150
+ this._registerImmediate(function () {
4151
+ return callback();
4152
+ });
4153
+ }
4154
+ };
4155
+
4077
4156
  /**
4078
4157
  * Removes the table from the DOM and destroys the instance of the Handsontable.
4079
4158
  *
@@ -4137,8 +4216,6 @@ function Core(rootElement, userSettings) {
4137
4216
  if (datamap) {
4138
4217
  datamap.destroy();
4139
4218
  }
4140
- instance.rowIndexMapper = null;
4141
- instance.columnIndexMapper = null;
4142
4219
  datamap = null;
4143
4220
  grid = null;
4144
4221
  selection = null;
@@ -4422,6 +4499,16 @@ function Core(rootElement, userSettings) {
4422
4499
  }
4423
4500
  };
4424
4501
 
4502
+ /**
4503
+ * Gets the instance of the EditorManager.
4504
+ *
4505
+ * @private
4506
+ * @returns {EditorManager}
4507
+ */
4508
+ this._getEditorManager = function () {
4509
+ return editorManager;
4510
+ };
4511
+
4425
4512
  /**
4426
4513
  * Check if currently it is RTL direction.
4427
4514
  *
@@ -4494,296 +4581,11 @@ function Core(rootElement, userSettings) {
4494
4581
  this.getShortcutManager = function () {
4495
4582
  return shortcutManager;
4496
4583
  };
4497
-
4498
- /**
4499
- * Return the Focus Manager responsible for managing the browser's focus in the table.
4500
- *
4501
- * @memberof Core#
4502
- * @since 13.0.0
4503
- * @function getFocusManager
4504
- * @returns {FocusManager}
4505
- */
4506
- this.getFocusManager = function () {
4507
- return focusManager;
4508
- };
4509
- var gridContext = shortcutManager.addContext('grid');
4510
- var gridConfig = {
4511
- runOnlyIf: function runOnlyIf() {
4512
- return (0, _mixed.isDefined)(instance.getSelected()) && instance.countRenderedRows() > 0 && instance.countRenderedCols() > 0;
4513
- },
4514
- group: SHORTCUTS_GROUP
4515
- };
4516
- shortcutManager.setActiveContextName('grid');
4517
- gridContext.addShortcuts([{
4518
- keys: [['Control/Meta', 'A'], ['Control/Meta', 'Shift', 'Space']],
4519
- callback: function callback() {
4520
- instance.selectAll();
4521
- }
4522
- }, {
4523
- keys: [['Control/Meta', 'Enter']],
4524
- callback: function callback() {
4525
- var selectedRange = instance.getSelectedRange();
4526
- var _selectedRange$highli = selectedRange[selectedRange.length - 1].highlight,
4527
- highlightRow = _selectedRange$highli.row,
4528
- highlightColumn = _selectedRange$highli.col;
4529
- var valueToPopulate = instance.getDataAtCell(highlightRow, highlightColumn);
4530
- var cellValues = new Map();
4531
- for (var i = 0; i < selectedRange.length; i++) {
4532
- selectedRange[i].forAll(function (row, column) {
4533
- if (row >= 0 && column >= 0 && (row !== highlightRow || column !== highlightColumn)) {
4534
- var _instance$getCellMeta = instance.getCellMeta(row, column),
4535
- readOnly = _instance$getCellMeta.readOnly;
4536
- if (!readOnly) {
4537
- cellValues.set("".concat(row, "x").concat(column), [row, column, valueToPopulate]);
4538
- }
4539
- }
4540
- });
4541
- }
4542
- instance.setDataAtCell(Array.from(cellValues.values()));
4543
- },
4544
- runOnlyIf: function runOnlyIf() {
4545
- return instance.getSelectedRangeLast().getCellsCount() > 1;
4546
- }
4547
- }, {
4548
- keys: [['ArrowUp']],
4549
- callback: function callback() {
4550
- selection.transformStart(-1, 0);
4551
- }
4552
- }, {
4553
- keys: [['ArrowUp', 'Control/Meta']],
4554
- captureCtrl: true,
4555
- callback: function callback() {
4556
- selection.setRangeStart(instance._createCellCoords(instance.rowIndexMapper.getNearestNotHiddenIndex(0, 1), instance.getSelectedRangeLast().highlight.col));
4557
- }
4558
- }, {
4559
- keys: [['ArrowUp', 'Shift']],
4560
- callback: function callback() {
4561
- selection.transformEnd(-1, 0);
4562
- }
4563
- }, {
4564
- keys: [['ArrowUp', 'Shift', 'Control/Meta']],
4565
- captureCtrl: true,
4566
- callback: function callback() {
4567
- var _instance$getSelected = instance.getSelectedRangeLast(),
4568
- from = _instance$getSelected.from,
4569
- to = _instance$getSelected.to;
4570
- var row = instance.rowIndexMapper.getNearestNotHiddenIndex(0, 1);
4571
- selection.setRangeStart(from.clone());
4572
- selection.setRangeEnd(instance._createCellCoords(row, to.col));
4573
- },
4574
- runOnlyIf: function runOnlyIf() {
4575
- return !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByColumnHeader());
4576
- }
4577
- }, {
4578
- keys: [['ArrowDown']],
4579
- callback: function callback() {
4580
- selection.transformStart(1, 0);
4581
- }
4582
- }, {
4583
- keys: [['ArrowDown', 'Control/Meta']],
4584
- captureCtrl: true,
4585
- callback: function callback() {
4586
- selection.setRangeStart(instance._createCellCoords(instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - 1, -1), instance.getSelectedRangeLast().highlight.col));
4587
- }
4588
- }, {
4589
- keys: [['ArrowDown', 'Shift']],
4590
- callback: function callback() {
4591
- selection.transformEnd(1, 0);
4592
- }
4593
- }, {
4594
- keys: [['ArrowDown', 'Shift', 'Control/Meta']],
4595
- captureCtrl: true,
4596
- callback: function callback() {
4597
- var _instance$getSelected2 = instance.getSelectedRangeLast(),
4598
- from = _instance$getSelected2.from,
4599
- to = _instance$getSelected2.to;
4600
- var row = instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - 1, -1);
4601
- selection.setRangeStart(from.clone());
4602
- selection.setRangeEnd(instance._createCellCoords(row, to.col));
4603
- },
4604
- runOnlyIf: function runOnlyIf() {
4605
- return !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByColumnHeader());
4606
- }
4607
- }, {
4608
- keys: [['ArrowLeft']],
4609
- callback: function callback() {
4610
- selection.transformStart(0, -1 * instance.getDirectionFactor());
4611
- }
4612
- }, {
4613
- keys: [['ArrowLeft', 'Control/Meta']],
4614
- captureCtrl: true,
4615
- callback: function callback() {
4616
- var _instance$columnIndex;
4617
- var row = instance.getSelectedRangeLast().highlight.row;
4618
- var column = (_instance$columnIndex = instance.columnIndexMapper).getNearestNotHiddenIndex.apply(_instance$columnIndex, _toConsumableArray(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
4619
- selection.setRangeStart(instance._createCellCoords(row, column));
4620
- }
4621
- }, {
4622
- keys: [['ArrowLeft', 'Shift']],
4623
- callback: function callback() {
4624
- selection.transformEnd(0, -1 * instance.getDirectionFactor());
4625
- }
4626
- }, {
4627
- keys: [['ArrowLeft', 'Shift', 'Control/Meta']],
4628
- captureCtrl: true,
4629
- callback: function callback() {
4630
- var _instance$columnIndex2;
4631
- var _instance$getSelected3 = instance.getSelectedRangeLast(),
4632
- from = _instance$getSelected3.from,
4633
- to = _instance$getSelected3.to;
4634
- var column = (_instance$columnIndex2 = instance.columnIndexMapper).getNearestNotHiddenIndex.apply(_instance$columnIndex2, _toConsumableArray(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
4635
- selection.setRangeStart(from.clone());
4636
- selection.setRangeEnd(instance._createCellCoords(to.row, column));
4637
- },
4638
- runOnlyIf: function runOnlyIf() {
4639
- return !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByRowHeader());
4640
- }
4641
- }, {
4642
- keys: [['ArrowRight']],
4643
- callback: function callback() {
4644
- selection.transformStart(0, instance.getDirectionFactor());
4645
- }
4646
- }, {
4647
- keys: [['ArrowRight', 'Control/Meta']],
4648
- captureCtrl: true,
4649
- callback: function callback() {
4650
- var _instance$columnIndex3;
4651
- var row = instance.getSelectedRangeLast().highlight.row;
4652
- var column = (_instance$columnIndex3 = instance.columnIndexMapper).getNearestNotHiddenIndex.apply(_instance$columnIndex3, _toConsumableArray(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
4653
- selection.setRangeStart(instance._createCellCoords(row, column));
4654
- }
4655
- }, {
4656
- keys: [['ArrowRight', 'Shift']],
4657
- callback: function callback() {
4658
- selection.transformEnd(0, instance.getDirectionFactor());
4659
- }
4660
- }, {
4661
- keys: [['ArrowRight', 'Shift', 'Control/Meta']],
4662
- captureCtrl: true,
4663
- callback: function callback() {
4664
- var _instance$columnIndex4;
4665
- var _instance$getSelected4 = instance.getSelectedRangeLast(),
4666
- from = _instance$getSelected4.from,
4667
- to = _instance$getSelected4.to;
4668
- var column = (_instance$columnIndex4 = instance.columnIndexMapper).getNearestNotHiddenIndex.apply(_instance$columnIndex4, _toConsumableArray(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
4669
- selection.setRangeStart(from.clone());
4670
- selection.setRangeEnd(instance._createCellCoords(to.row, column));
4671
- },
4672
- runOnlyIf: function runOnlyIf() {
4673
- return !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByRowHeader());
4674
- }
4675
- }, {
4676
- keys: [['Home']],
4677
- captureCtrl: true,
4678
- callback: function callback() {
4679
- var fixedColumns = parseInt(instance.getSettings().fixedColumnsStart, 10);
4680
- var row = instance.getSelectedRangeLast().highlight.row;
4681
- var column = instance.columnIndexMapper.getNearestNotHiddenIndex(fixedColumns, 1);
4682
- selection.setRangeStart(instance._createCellCoords(row, column));
4683
- },
4684
- runOnlyIf: function runOnlyIf() {
4685
- return instance.view.isMainTableNotFullyCoveredByOverlays();
4686
- }
4687
- }, {
4688
- keys: [['Home', 'Shift']],
4689
- callback: function callback() {
4690
- selection.setRangeEnd(instance._createCellCoords(selection.selectedRange.current().from.row, instance.columnIndexMapper.getNearestNotHiddenIndex(0, 1)));
4691
- }
4692
- }, {
4693
- keys: [['Home', 'Control/Meta']],
4694
- captureCtrl: true,
4695
- callback: function callback() {
4696
- var fixedRows = parseInt(instance.getSettings().fixedRowsTop, 10);
4697
- var fixedColumns = parseInt(instance.getSettings().fixedColumnsStart, 10);
4698
- var row = instance.rowIndexMapper.getNearestNotHiddenIndex(fixedRows, 1);
4699
- var column = instance.columnIndexMapper.getNearestNotHiddenIndex(fixedColumns, 1);
4700
- selection.setRangeStart(instance._createCellCoords(row, column));
4701
- },
4702
- runOnlyIf: function runOnlyIf() {
4703
- return instance.view.isMainTableNotFullyCoveredByOverlays();
4704
- }
4705
- }, {
4706
- keys: [['End']],
4707
- captureCtrl: true,
4708
- callback: function callback() {
4709
- selection.setRangeStart(instance._createCellCoords(instance.getSelectedRangeLast().highlight.row, instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1)));
4710
- },
4711
- runOnlyIf: function runOnlyIf() {
4712
- return instance.view.isMainTableNotFullyCoveredByOverlays();
4713
- }
4714
- }, {
4715
- keys: [['End', 'Shift']],
4716
- callback: function callback() {
4717
- selection.setRangeEnd(instance._createCellCoords(selection.selectedRange.current().from.row, instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1)));
4718
- }
4719
- }, {
4720
- keys: [['End', 'Control/Meta']],
4721
- captureCtrl: true,
4722
- callback: function callback() {
4723
- var fixedRows = parseInt(instance.getSettings().fixedRowsBottom, 10);
4724
- var row = instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - fixedRows - 1, -1);
4725
- var column = instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1);
4726
- selection.setRangeStart(instance._createCellCoords(row, column));
4727
- },
4728
- runOnlyIf: function runOnlyIf() {
4729
- return instance.view.isMainTableNotFullyCoveredByOverlays();
4730
- }
4731
- }, {
4732
- keys: [['PageUp']],
4733
- callback: function callback() {
4734
- selection.transformStart(-instance.countVisibleRows(), 0);
4735
- }
4736
- }, {
4737
- keys: [['PageUp', 'Shift']],
4738
- callback: function callback() {
4739
- var _instance$getSelected5 = instance.getSelectedRangeLast(),
4740
- to = _instance$getSelected5.to;
4741
- var nextRowIndexToSelect = Math.max(to.row - instance.countVisibleRows(), 0);
4742
- var row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, 1);
4743
- if (row !== null) {
4744
- var coords = instance._createCellCoords(row, to.col);
4745
- var scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
4746
- var nextVerticalScroll = Math.max(coords.row - scrollPadding, 0);
4747
- selection.setRangeEnd(coords);
4748
- instance.scrollViewportTo(nextVerticalScroll);
4749
- }
4750
- }
4751
- }, {
4752
- keys: [['PageDown']],
4753
- callback: function callback() {
4754
- selection.transformStart(instance.countVisibleRows(), 0);
4755
- }
4756
- }, {
4757
- keys: [['PageDown', 'Shift']],
4758
- callback: function callback() {
4759
- var _instance$getSelected6 = instance.getSelectedRangeLast(),
4760
- to = _instance$getSelected6.to;
4761
- var nextRowIndexToSelect = Math.min(to.row + instance.countVisibleRows(), instance.countRows() - 1);
4762
- var row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, -1);
4763
- if (row !== null) {
4764
- var coords = instance._createCellCoords(row, to.col);
4765
- var scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
4766
- var nextVerticalScroll = Math.min(coords.row - scrollPadding, instance.countRows() - 1);
4767
- selection.setRangeEnd(coords);
4768
- instance.scrollViewportTo(nextVerticalScroll);
4769
- }
4770
- }
4771
- }, {
4772
- keys: [['Tab']],
4773
- callback: function callback(event) {
4774
- var tabMoves = typeof tableMeta.tabMoves === 'function' ? tableMeta.tabMoves(event) : tableMeta.tabMoves;
4775
- selection.transformStart(tabMoves.row, tabMoves.col, true);
4776
- }
4777
- }, {
4778
- keys: [['Shift', 'Tab']],
4779
- callback: function callback(event) {
4780
- var tabMoves = typeof tableMeta.tabMoves === 'function' ? tableMeta.tabMoves(event) : tableMeta.tabMoves;
4781
- selection.transformStart(-tabMoves.row, -tabMoves.col);
4782
- }
4783
- }], gridConfig);
4784
4584
  (0, _registry.getPluginsNames)().forEach(function (pluginName) {
4785
4585
  var PluginClass = (0, _registry.getPlugin)(pluginName);
4786
4586
  pluginsRegistry.addItem(pluginName, new PluginClass(_this));
4787
4587
  });
4588
+ (0, _shortcutContexts.registerAllShortcutContexts)(instance);
4589
+ shortcutManager.setActiveContextName('grid');
4788
4590
  _pluginHooks.default.getSingleton().run(instance, 'construct');
4789
4591
  }