handsontable 14.2.0-next-75c8bcd-20240306 → 14.3.0-next-13fe676-20240409

Sign up to get free protection for your applications and to get access to all the features.
Files changed (469) hide show
  1. package/3rdparty/walkontable/src/calculator/renderAllColumns.js +1 -1
  2. package/3rdparty/walkontable/src/calculator/renderAllColumns.mjs +1 -1
  3. package/3rdparty/walkontable/src/calculator/renderAllRows.js +1 -1
  4. package/3rdparty/walkontable/src/calculator/renderAllRows.mjs +1 -1
  5. package/3rdparty/walkontable/src/calculator/viewportColumns.js +13 -18
  6. package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +13 -18
  7. package/3rdparty/walkontable/src/calculator/viewportRows.js +11 -16
  8. package/3rdparty/walkontable/src/calculator/viewportRows.mjs +11 -16
  9. package/3rdparty/walkontable/src/cell/coords.js +13 -18
  10. package/3rdparty/walkontable/src/cell/coords.mjs +13 -18
  11. package/3rdparty/walkontable/src/cell/range.d.ts +2 -1
  12. package/3rdparty/walkontable/src/cell/range.js +42 -30
  13. package/3rdparty/walkontable/src/cell/range.mjs +42 -30
  14. package/3rdparty/walkontable/src/core/_base.js +2 -2
  15. package/3rdparty/walkontable/src/core/_base.mjs +2 -2
  16. package/3rdparty/walkontable/src/core/clone.js +1 -1
  17. package/3rdparty/walkontable/src/core/clone.mjs +1 -1
  18. package/3rdparty/walkontable/src/event.js +72 -104
  19. package/3rdparty/walkontable/src/event.mjs +72 -104
  20. package/3rdparty/walkontable/src/filter/column.js +1 -1
  21. package/3rdparty/walkontable/src/filter/column.mjs +1 -1
  22. package/3rdparty/walkontable/src/filter/row.js +1 -1
  23. package/3rdparty/walkontable/src/filter/row.mjs +1 -1
  24. package/3rdparty/walkontable/src/index.js +1 -1
  25. package/3rdparty/walkontable/src/overlay/_base.js +1 -1
  26. package/3rdparty/walkontable/src/overlay/_base.mjs +1 -1
  27. package/3rdparty/walkontable/src/overlay/bottom.js +1 -1
  28. package/3rdparty/walkontable/src/overlay/bottom.mjs +1 -1
  29. package/3rdparty/walkontable/src/overlay/inlineStart.js +15 -1
  30. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +16 -2
  31. package/3rdparty/walkontable/src/overlay/top.js +12 -1
  32. package/3rdparty/walkontable/src/overlay/top.mjs +13 -2
  33. package/3rdparty/walkontable/src/overlay/topInlineStartCorner.js +1 -1
  34. package/3rdparty/walkontable/src/overlay/topInlineStartCorner.mjs +1 -1
  35. package/3rdparty/walkontable/src/overlays.js +47 -5
  36. package/3rdparty/walkontable/src/overlays.mjs +47 -5
  37. package/3rdparty/walkontable/src/renderer/_base.js +1 -1
  38. package/3rdparty/walkontable/src/renderer/_base.mjs +1 -1
  39. package/3rdparty/walkontable/src/renderer/cells.js +1 -1
  40. package/3rdparty/walkontable/src/renderer/cells.mjs +1 -1
  41. package/3rdparty/walkontable/src/renderer/rowHeaders.js +1 -1
  42. package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +1 -1
  43. package/3rdparty/walkontable/src/renderer/rows.js +1 -1
  44. package/3rdparty/walkontable/src/renderer/rows.mjs +1 -1
  45. package/3rdparty/walkontable/src/renderer/table.js +1 -1
  46. package/3rdparty/walkontable/src/renderer/table.mjs +1 -1
  47. package/3rdparty/walkontable/src/scroll.js +16 -18
  48. package/3rdparty/walkontable/src/scroll.mjs +16 -18
  49. package/3rdparty/walkontable/src/selection/manager.js +48 -69
  50. package/3rdparty/walkontable/src/selection/manager.mjs +48 -69
  51. package/3rdparty/walkontable/src/selection/scanner.js +33 -42
  52. package/3rdparty/walkontable/src/selection/scanner.mjs +33 -42
  53. package/3rdparty/walkontable/src/settings.js +1 -1
  54. package/3rdparty/walkontable/src/settings.mjs +1 -1
  55. package/3rdparty/walkontable/src/table.js +1 -1
  56. package/3rdparty/walkontable/src/table.mjs +1 -1
  57. package/3rdparty/walkontable/src/utils/column.js +1 -1
  58. package/3rdparty/walkontable/src/utils/column.mjs +1 -1
  59. package/3rdparty/walkontable/src/utils/columnStretching.js +28 -45
  60. package/3rdparty/walkontable/src/utils/columnStretching.mjs +28 -45
  61. package/3rdparty/walkontable/src/utils/nodesPool.js +1 -1
  62. package/3rdparty/walkontable/src/utils/nodesPool.mjs +1 -1
  63. package/3rdparty/walkontable/src/utils/orderView/view.js +2 -2
  64. package/3rdparty/walkontable/src/utils/orderView/view.mjs +2 -2
  65. package/3rdparty/walkontable/src/utils/orderView/viewSize.js +1 -1
  66. package/3rdparty/walkontable/src/utils/orderView/viewSize.mjs +1 -1
  67. package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.js +1 -1
  68. package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.mjs +1 -1
  69. package/3rdparty/walkontable/src/utils/row.js +1 -1
  70. package/3rdparty/walkontable/src/utils/row.mjs +1 -1
  71. package/CHANGELOG.md +20 -0
  72. package/base.js +2 -2
  73. package/base.mjs +2 -2
  74. package/core/viewportScroll/index.js +4 -1
  75. package/core/viewportScroll/index.mjs +4 -1
  76. package/core/viewportScroll/scrollStrategies/focusScroll.js +15 -0
  77. package/core/viewportScroll/scrollStrategies/focusScroll.mjs +11 -0
  78. package/core.d.ts +4 -3
  79. package/core.js +98 -43
  80. package/core.mjs +98 -43
  81. package/dataMap/dataMap.js +1 -1
  82. package/dataMap/dataMap.mjs +1 -1
  83. package/dataMap/dataSource.js +2 -2
  84. package/dataMap/dataSource.mjs +2 -2
  85. package/dataMap/metaManager/lazyFactoryMap.js +3 -5
  86. package/dataMap/metaManager/lazyFactoryMap.mjs +2 -4
  87. package/dataMap/metaManager/metaLayers/cellMeta.js +2 -2
  88. package/dataMap/metaManager/metaLayers/cellMeta.mjs +2 -2
  89. package/dataMap/metaManager/metaLayers/columnMeta.js +1 -1
  90. package/dataMap/metaManager/metaLayers/columnMeta.mjs +1 -1
  91. package/dataMap/metaManager/metaLayers/globalMeta.js +1 -1
  92. package/dataMap/metaManager/metaLayers/globalMeta.mjs +1 -1
  93. package/dataMap/metaManager/metaLayers/tableMeta.js +1 -1
  94. package/dataMap/metaManager/metaLayers/tableMeta.mjs +1 -1
  95. package/dataMap/metaManager/metaSchema.js +272 -272
  96. package/dataMap/metaManager/metaSchema.mjs +272 -272
  97. package/dataMap/metaManager/mods/dynamicCellMeta.js +1 -1
  98. package/dataMap/metaManager/mods/dynamicCellMeta.mjs +1 -1
  99. package/dataMap/metaManager/mods/extendMetaProperties.js +1 -1
  100. package/dataMap/metaManager/mods/extendMetaProperties.mjs +1 -1
  101. package/dataMap/replaceData.js +1 -1
  102. package/dataMap/replaceData.mjs +1 -1
  103. package/dist/handsontable.css +4 -4
  104. package/dist/handsontable.full.css +4 -4
  105. package/dist/handsontable.full.js +9800 -10020
  106. package/dist/handsontable.full.min.css +3 -3
  107. package/dist/handsontable.full.min.js +292 -292
  108. package/dist/handsontable.js +7470 -7056
  109. package/dist/handsontable.min.css +3 -3
  110. package/dist/handsontable.min.js +25 -25
  111. package/dist/languages/all.min.js +1 -1
  112. package/dist/languages/ar-AR.min.js +1 -1
  113. package/dist/languages/cs-CZ.min.js +1 -1
  114. package/dist/languages/de-CH.min.js +1 -1
  115. package/dist/languages/de-DE.min.js +1 -1
  116. package/dist/languages/en-US.min.js +1 -1
  117. package/dist/languages/es-MX.min.js +1 -1
  118. package/dist/languages/fr-FR.min.js +1 -1
  119. package/dist/languages/hr-HR.min.js +1 -1
  120. package/dist/languages/it-IT.min.js +1 -1
  121. package/dist/languages/ja-JP.min.js +1 -1
  122. package/dist/languages/ko-KR.min.js +1 -1
  123. package/dist/languages/lv-LV.min.js +1 -1
  124. package/dist/languages/nb-NO.min.js +1 -1
  125. package/dist/languages/nl-NL.min.js +1 -1
  126. package/dist/languages/pl-PL.min.js +1 -1
  127. package/dist/languages/pt-BR.min.js +1 -1
  128. package/dist/languages/ru-RU.min.js +1 -1
  129. package/dist/languages/sr-SP.min.js +1 -1
  130. package/dist/languages/zh-CN.min.js +1 -1
  131. package/dist/languages/zh-TW.min.js +1 -1
  132. package/editorManager.js +26 -24
  133. package/editorManager.mjs +26 -24
  134. package/editors/autocompleteEditor/autocompleteEditor.js +7 -11
  135. package/editors/autocompleteEditor/autocompleteEditor.mjs +7 -11
  136. package/editors/baseEditor/baseEditor.js +1 -1
  137. package/editors/baseEditor/baseEditor.mjs +1 -1
  138. package/editors/dateEditor/dateEditor.js +35 -11
  139. package/editors/dateEditor/dateEditor.mjs +35 -11
  140. package/editors/selectEditor/selectEditor.js +20 -19
  141. package/editors/selectEditor/selectEditor.mjs +20 -19
  142. package/editors/textEditor/textEditor.js +1 -1
  143. package/editors/textEditor/textEditor.mjs +1 -1
  144. package/eventManager.js +2 -2
  145. package/eventManager.mjs +2 -2
  146. package/focusManager.js +64 -82
  147. package/focusManager.mjs +64 -82
  148. package/helpers/dom/element.js +23 -1
  149. package/helpers/dom/element.mjs +21 -1
  150. package/helpers/mixed.js +2 -2
  151. package/helpers/mixed.mjs +2 -2
  152. package/helpers/object.js +2 -2
  153. package/helpers/object.mjs +2 -2
  154. package/i18n/languages/ar-AR.d.ts +5 -0
  155. package/i18n/languages/ar-AR.js +1 -1
  156. package/i18n/languages/cs-CZ.d.ts +5 -0
  157. package/i18n/languages/cs-CZ.js +1 -1
  158. package/i18n/languages/de-CH.js +1 -1
  159. package/i18n/languages/de-DE.js +1 -1
  160. package/i18n/languages/en-US.js +1 -1
  161. package/i18n/languages/es-MX.js +1 -1
  162. package/i18n/languages/fr-FR.js +1 -1
  163. package/i18n/languages/hr-HR.d.ts +5 -0
  164. package/i18n/languages/hr-HR.js +1 -1
  165. package/i18n/languages/it-IT.js +1 -1
  166. package/i18n/languages/ja-JP.js +1 -1
  167. package/i18n/languages/ko-KR.js +1 -1
  168. package/i18n/languages/lv-LV.js +1 -1
  169. package/i18n/languages/nb-NO.js +1 -1
  170. package/i18n/languages/nl-NL.js +1 -1
  171. package/i18n/languages/pl-PL.js +1 -1
  172. package/i18n/languages/pt-BR.js +1 -1
  173. package/i18n/languages/ru-RU.js +1 -1
  174. package/i18n/languages/sr-SP.d.ts +5 -0
  175. package/i18n/languages/sr-SP.js +1 -1
  176. package/i18n/languages/zh-CN.js +1 -1
  177. package/i18n/languages/zh-TW.js +1 -1
  178. package/i18n/registry.js +1 -1
  179. package/index.d.ts +10 -0
  180. package/index.js +1 -1
  181. package/package.json +14 -10
  182. package/pluginHooks.d.ts +4 -3
  183. package/pluginHooks.js +143 -82
  184. package/pluginHooks.mjs +143 -82
  185. package/plugins/autoColumnSize/autoColumnSize.js +50 -66
  186. package/plugins/autoColumnSize/autoColumnSize.mjs +50 -66
  187. package/plugins/autoRowSize/autoRowSize.js +29 -35
  188. package/plugins/autoRowSize/autoRowSize.mjs +29 -35
  189. package/plugins/autofill/autofill.js +31 -39
  190. package/plugins/autofill/autofill.mjs +31 -39
  191. package/plugins/base/base.js +13 -18
  192. package/plugins/base/base.mjs +13 -18
  193. package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +6 -6
  194. package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +6 -6
  195. package/plugins/collapsibleColumns/collapsibleColumns.js +60 -51
  196. package/plugins/collapsibleColumns/collapsibleColumns.mjs +60 -51
  197. package/plugins/columnSorting/columnSorting.js +50 -46
  198. package/plugins/columnSorting/columnSorting.mjs +50 -46
  199. package/plugins/columnSorting/columnStatesManager.js +1 -1
  200. package/plugins/columnSorting/columnStatesManager.mjs +1 -1
  201. package/plugins/columnSummary/columnSummary.js +36 -40
  202. package/plugins/columnSummary/columnSummary.mjs +36 -40
  203. package/plugins/columnSummary/endpoints.js +1 -1
  204. package/plugins/columnSummary/endpoints.mjs +1 -1
  205. package/plugins/comments/commentEditor.js +1 -1
  206. package/plugins/comments/commentEditor.mjs +1 -1
  207. package/plugins/comments/comments.js +117 -159
  208. package/plugins/comments/comments.mjs +117 -159
  209. package/plugins/comments/contextMenuItem/addEditComment.js +1 -1
  210. package/plugins/comments/contextMenuItem/readOnlyComment.js +1 -1
  211. package/plugins/comments/contextMenuItem/removeComment.js +1 -1
  212. package/plugins/comments/displaySwitch.js +1 -1
  213. package/plugins/comments/displaySwitch.mjs +1 -1
  214. package/plugins/contextMenu/commandExecutor.js +1 -1
  215. package/plugins/contextMenu/commandExecutor.mjs +1 -1
  216. package/plugins/contextMenu/contextMenu.js +24 -30
  217. package/plugins/contextMenu/contextMenu.mjs +24 -30
  218. package/plugins/contextMenu/itemsFactory.js +2 -2
  219. package/plugins/contextMenu/itemsFactory.mjs +2 -2
  220. package/plugins/contextMenu/menu/cursor.js +1 -1
  221. package/plugins/contextMenu/menu/cursor.mjs +1 -1
  222. package/plugins/contextMenu/menu/defaultShortcutsList.js +26 -10
  223. package/plugins/contextMenu/menu/defaultShortcutsList.mjs +26 -10
  224. package/plugins/contextMenu/menu/menu.js +14 -22
  225. package/plugins/contextMenu/menu/menu.mjs +14 -22
  226. package/plugins/contextMenu/menu/positioner.js +41 -58
  227. package/plugins/contextMenu/menu/positioner.mjs +41 -58
  228. package/plugins/contextMenu/predefinedItems/alignment.js +1 -1
  229. package/plugins/contextMenu/predefinedItems/clearColumn.js +1 -1
  230. package/plugins/contextMenu/predefinedItems/columnLeft.js +1 -1
  231. package/plugins/contextMenu/predefinedItems/columnRight.js +1 -1
  232. package/plugins/contextMenu/predefinedItems/index.js +1 -1
  233. package/plugins/contextMenu/predefinedItems/readOnly.js +1 -1
  234. package/plugins/contextMenu/predefinedItems/redo.js +1 -1
  235. package/plugins/contextMenu/predefinedItems/removeColumn.js +1 -1
  236. package/plugins/contextMenu/predefinedItems/removeRow.js +1 -1
  237. package/plugins/contextMenu/predefinedItems/rowAbove.js +1 -1
  238. package/plugins/contextMenu/predefinedItems/rowBelow.js +1 -1
  239. package/plugins/contextMenu/predefinedItems/undo.js +1 -1
  240. package/plugins/copyPaste/contextMenuItem/cut.js +1 -1
  241. package/plugins/copyPaste/copyPaste.js +120 -161
  242. package/plugins/copyPaste/copyPaste.mjs +120 -161
  243. package/plugins/copyPaste/copyableRanges.js +43 -66
  244. package/plugins/copyPaste/copyableRanges.mjs +43 -66
  245. package/plugins/customBorders/contextMenuItem/bottom.js +1 -1
  246. package/plugins/customBorders/contextMenuItem/left.js +1 -1
  247. package/plugins/customBorders/contextMenuItem/noBorders.js +1 -1
  248. package/plugins/customBorders/contextMenuItem/right.js +1 -1
  249. package/plugins/customBorders/contextMenuItem/top.js +1 -1
  250. package/plugins/customBorders/customBorders.js +14 -16
  251. package/plugins/customBorders/customBorders.mjs +13 -15
  252. package/plugins/dragToScroll/dragToScroll.js +7 -7
  253. package/plugins/dragToScroll/dragToScroll.mjs +7 -7
  254. package/plugins/dropdownMenu/dropdownMenu.js +84 -110
  255. package/plugins/dropdownMenu/dropdownMenu.mjs +84 -110
  256. package/plugins/exportFile/dataProvider.js +2 -2
  257. package/plugins/exportFile/dataProvider.mjs +2 -2
  258. package/plugins/exportFile/exportFile.js +2 -2
  259. package/plugins/exportFile/exportFile.mjs +1 -1
  260. package/plugins/exportFile/types/_base.js +1 -1
  261. package/plugins/exportFile/types/_base.mjs +1 -1
  262. package/plugins/filters/component/_base.js +1 -1
  263. package/plugins/filters/component/_base.mjs +1 -1
  264. package/plugins/filters/component/actionBar.js +11 -11
  265. package/plugins/filters/component/actionBar.mjs +9 -9
  266. package/plugins/filters/component/condition.js +15 -17
  267. package/plugins/filters/component/condition.mjs +14 -16
  268. package/plugins/filters/component/operators.js +7 -7
  269. package/plugins/filters/component/operators.mjs +7 -7
  270. package/plugins/filters/component/value.js +26 -30
  271. package/plugins/filters/component/value.mjs +25 -29
  272. package/plugins/filters/condition/beginsWith.js +1 -1
  273. package/plugins/filters/condition/between.js +1 -1
  274. package/plugins/filters/condition/contains.js +1 -1
  275. package/plugins/filters/condition/date/after.js +1 -1
  276. package/plugins/filters/condition/date/before.js +1 -1
  277. package/plugins/filters/condition/date/today.js +1 -1
  278. package/plugins/filters/condition/date/tomorrow.js +1 -1
  279. package/plugins/filters/condition/date/yesterday.js +1 -1
  280. package/plugins/filters/condition/empty.js +1 -1
  281. package/plugins/filters/condition/endsWith.js +1 -1
  282. package/plugins/filters/condition/equal.js +1 -1
  283. package/plugins/filters/condition/greaterThan.js +1 -1
  284. package/plugins/filters/condition/greaterThanOrEqual.js +1 -1
  285. package/plugins/filters/condition/lessThan.js +1 -1
  286. package/plugins/filters/condition/lessThanOrEqual.js +1 -1
  287. package/plugins/filters/condition/none.js +1 -1
  288. package/plugins/filters/condition/notBetween.js +1 -1
  289. package/plugins/filters/condition/notContains.js +1 -1
  290. package/plugins/filters/condition/notEmpty.js +1 -1
  291. package/plugins/filters/condition/notEqual.js +1 -1
  292. package/plugins/filters/conditionCollection.js +1 -1
  293. package/plugins/filters/conditionCollection.mjs +1 -1
  294. package/plugins/filters/conditionUpdateObserver.js +23 -25
  295. package/plugins/filters/conditionUpdateObserver.mjs +23 -25
  296. package/plugins/filters/dataFilter.js +2 -2
  297. package/plugins/filters/dataFilter.mjs +2 -2
  298. package/plugins/filters/filters.js +84 -98
  299. package/plugins/filters/filters.mjs +83 -97
  300. package/plugins/filters/logicalOperations/conjunction.js +1 -1
  301. package/plugins/filters/logicalOperations/disjunction.js +1 -1
  302. package/plugins/filters/logicalOperations/disjunctionWithExtraCondition.js +1 -1
  303. package/plugins/filters/ui/_base.js +2 -2
  304. package/plugins/filters/ui/_base.mjs +1 -1
  305. package/plugins/filters/ui/input.js +13 -19
  306. package/plugins/filters/ui/input.mjs +13 -19
  307. package/plugins/filters/ui/link.js +8 -13
  308. package/plugins/filters/ui/link.mjs +8 -13
  309. package/plugins/filters/ui/multipleSelect.js +86 -113
  310. package/plugins/filters/ui/multipleSelect.mjs +85 -112
  311. package/plugins/filters/ui/radioInput.js +12 -20
  312. package/plugins/filters/ui/radioInput.mjs +12 -20
  313. package/plugins/filters/ui/select.js +51 -73
  314. package/plugins/filters/ui/select.mjs +49 -71
  315. package/plugins/formulas/formulas.js +270 -328
  316. package/plugins/formulas/formulas.mjs +271 -329
  317. package/plugins/formulas/indexSyncer/axisSyncer.js +38 -61
  318. package/plugins/formulas/indexSyncer/axisSyncer.mjs +38 -61
  319. package/plugins/formulas/indexSyncer/index.js +25 -48
  320. package/plugins/formulas/indexSyncer/index.mjs +25 -48
  321. package/plugins/hiddenColumns/contextMenuItem/hideColumn.js +1 -1
  322. package/plugins/hiddenColumns/contextMenuItem/showColumn.js +1 -1
  323. package/plugins/hiddenColumns/hiddenColumns.js +68 -87
  324. package/plugins/hiddenColumns/hiddenColumns.mjs +68 -87
  325. package/plugins/hiddenRows/contextMenuItem/hideRow.js +1 -1
  326. package/plugins/hiddenRows/contextMenuItem/showRow.js +1 -1
  327. package/plugins/hiddenRows/hiddenRows.js +67 -86
  328. package/plugins/hiddenRows/hiddenRows.mjs +67 -86
  329. package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +1 -1
  330. package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +1 -1
  331. package/plugins/manualColumnFreeze/manualColumnFreeze.js +24 -32
  332. package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +25 -33
  333. package/plugins/manualColumnMove/manualColumnMove.js +133 -177
  334. package/plugins/manualColumnMove/manualColumnMove.mjs +133 -177
  335. package/plugins/manualColumnMove/ui/_base.js +1 -1
  336. package/plugins/manualColumnMove/ui/_base.mjs +1 -1
  337. package/plugins/manualColumnResize/manualColumnResize.js +169 -230
  338. package/plugins/manualColumnResize/manualColumnResize.mjs +169 -230
  339. package/plugins/manualRowMove/manualRowMove.js +106 -135
  340. package/plugins/manualRowMove/manualRowMove.mjs +106 -135
  341. package/plugins/manualRowMove/ui/_base.js +1 -1
  342. package/plugins/manualRowMove/ui/_base.mjs +1 -1
  343. package/plugins/manualRowResize/manualRowResize.js +150 -209
  344. package/plugins/manualRowResize/manualRowResize.mjs +150 -209
  345. package/plugins/mergeCells/calculations/autofill.js +1 -1
  346. package/plugins/mergeCells/calculations/autofill.mjs +1 -1
  347. package/plugins/mergeCells/calculations/selection.js +3 -72
  348. package/plugins/mergeCells/calculations/selection.mjs +3 -72
  349. package/plugins/mergeCells/cellCoords.js +1 -1
  350. package/plugins/mergeCells/cellCoords.mjs +1 -1
  351. package/plugins/mergeCells/cellsCollection.js +118 -2
  352. package/plugins/mergeCells/cellsCollection.mjs +118 -2
  353. package/plugins/mergeCells/contextMenuItem/toggleMerge.js +12 -2
  354. package/plugins/mergeCells/contextMenuItem/toggleMerge.mjs +11 -1
  355. package/plugins/mergeCells/focusOrder.js +305 -0
  356. package/plugins/mergeCells/focusOrder.mjs +300 -0
  357. package/plugins/mergeCells/mergeCells.js +500 -398
  358. package/plugins/mergeCells/mergeCells.mjs +500 -398
  359. package/plugins/multiColumnSorting/multiColumnSorting.js +9 -3
  360. package/plugins/multiColumnSorting/multiColumnSorting.mjs +9 -3
  361. package/plugins/multipleSelectionHandles/multipleSelectionHandles.js +2 -2
  362. package/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs +2 -2
  363. package/plugins/nestedHeaders/nestedHeaders.js +206 -254
  364. package/plugins/nestedHeaders/nestedHeaders.mjs +207 -255
  365. package/plugins/nestedHeaders/stateManager/headersTree.js +21 -32
  366. package/plugins/nestedHeaders/stateManager/headersTree.mjs +21 -32
  367. package/plugins/nestedHeaders/stateManager/index.js +30 -41
  368. package/plugins/nestedHeaders/stateManager/index.mjs +30 -41
  369. package/plugins/nestedHeaders/stateManager/sourceSettings.js +19 -30
  370. package/plugins/nestedHeaders/stateManager/sourceSettings.mjs +19 -30
  371. package/plugins/nestedHeaders/utils/ghostTable.js +1 -1
  372. package/plugins/nestedHeaders/utils/ghostTable.mjs +1 -1
  373. package/plugins/nestedRows/data/dataManager.js +2 -2
  374. package/plugins/nestedRows/data/dataManager.mjs +2 -2
  375. package/plugins/nestedRows/nestedRows.js +154 -185
  376. package/plugins/nestedRows/nestedRows.mjs +155 -186
  377. package/plugins/nestedRows/ui/_base.js +1 -1
  378. package/plugins/nestedRows/ui/_base.mjs +1 -1
  379. package/plugins/nestedRows/ui/contextMenu.js +13 -17
  380. package/plugins/nestedRows/ui/contextMenu.mjs +11 -15
  381. package/plugins/nestedRows/utils/rowMoveController.js +6 -6
  382. package/plugins/nestedRows/utils/rowMoveController.mjs +6 -6
  383. package/plugins/persistentState/persistentState.js +1 -1
  384. package/plugins/persistentState/persistentState.mjs +1 -1
  385. package/plugins/persistentState/storage.js +3 -3
  386. package/plugins/persistentState/storage.mjs +3 -3
  387. package/plugins/search/search.js +8 -8
  388. package/plugins/search/search.mjs +8 -8
  389. package/plugins/touchScroll/touchScroll.js +16 -20
  390. package/plugins/touchScroll/touchScroll.mjs +17 -21
  391. package/plugins/trimRows/trimRows.js +7 -7
  392. package/plugins/trimRows/trimRows.mjs +7 -7
  393. package/plugins/undoRedo/index.js +1 -1
  394. package/renderers/checkboxRenderer/checkboxRenderer.js +8 -5
  395. package/renderers/checkboxRenderer/checkboxRenderer.mjs +8 -5
  396. package/selection/highlight/highlight.js +16 -18
  397. package/selection/highlight/highlight.mjs +15 -17
  398. package/selection/highlight/visualSelection.js +3 -1
  399. package/selection/highlight/visualSelection.mjs +3 -1
  400. package/selection/range.js +3 -5
  401. package/selection/range.mjs +2 -4
  402. package/selection/selection.js +227 -69
  403. package/selection/selection.mjs +225 -67
  404. package/selection/transformation.js +149 -118
  405. package/selection/transformation.mjs +149 -118
  406. package/shortcutContexts/commands/editor/closeAndSave.js +2 -2
  407. package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -2
  408. package/shortcutContexts/commands/editor/open.js +18 -3
  409. package/shortcutContexts/commands/editor/open.mjs +18 -3
  410. package/shortcutContexts/commands/extendCellsSelection/down.js +1 -1
  411. package/shortcutContexts/commands/extendCellsSelection/down.mjs +1 -1
  412. package/shortcutContexts/commands/extendCellsSelection/left.js +1 -1
  413. package/shortcutContexts/commands/extendCellsSelection/left.mjs +1 -1
  414. package/shortcutContexts/commands/extendCellsSelection/right.js +1 -1
  415. package/shortcutContexts/commands/extendCellsSelection/right.mjs +1 -1
  416. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +1 -1
  417. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +1 -1
  418. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +3 -1
  419. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +3 -1
  420. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +9 -3
  421. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +9 -3
  422. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +10 -3
  423. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +10 -3
  424. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +3 -1
  425. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +3 -1
  426. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +3 -1
  427. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +3 -1
  428. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +3 -1
  429. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +3 -1
  430. package/shortcutContexts/commands/extendCellsSelection/toRows.js +1 -1
  431. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +1 -1
  432. package/shortcutContexts/commands/extendCellsSelection/up.js +1 -1
  433. package/shortcutContexts/commands/extendCellsSelection/up.mjs +1 -1
  434. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +6 -1
  435. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +6 -1
  436. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +6 -1
  437. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +6 -1
  438. package/shortcutContexts/grid.js +9 -3
  439. package/shortcutContexts/grid.mjs +9 -3
  440. package/shortcuts/context.js +3 -2
  441. package/shortcuts/context.mjs +3 -2
  442. package/shortcuts/manager.js +2 -2
  443. package/shortcuts/manager.mjs +2 -2
  444. package/tableView.js +53 -79
  445. package/tableView.mjs +53 -79
  446. package/translations/changesObservable/observable.js +21 -38
  447. package/translations/changesObservable/observable.mjs +21 -38
  448. package/translations/changesObservable/observer.js +7 -12
  449. package/translations/changesObservable/observer.mjs +6 -11
  450. package/translations/indexMapper.js +1 -1
  451. package/translations/indexMapper.mjs +1 -1
  452. package/translations/mapCollections/aggregatedCollection.js +2 -2
  453. package/translations/mapCollections/aggregatedCollection.mjs +2 -2
  454. package/translations/mapCollections/mapCollection.js +1 -1
  455. package/translations/mapCollections/mapCollection.mjs +1 -1
  456. package/translations/maps/indexMap.js +2 -2
  457. package/translations/maps/indexMap.mjs +2 -2
  458. package/translations/maps/linkedPhysicalIndexToValueMap.js +1 -1
  459. package/translations/maps/linkedPhysicalIndexToValueMap.mjs +1 -1
  460. package/utils/dataStructures/linkedList.js +7 -2
  461. package/utils/dataStructures/linkedList.mjs +7 -2
  462. package/utils/dataStructures/tree.js +2 -2
  463. package/utils/dataStructures/tree.mjs +2 -2
  464. package/utils/ghostTable.js +1 -1
  465. package/utils/ghostTable.mjs +1 -1
  466. package/utils/interval.js +27 -45
  467. package/utils/interval.mjs +27 -45
  468. package/utils/samplesGenerator.js +1 -1
  469. package/utils/samplesGenerator.mjs +1 -1
@@ -1,17 +1,14 @@
1
- import "core-js/modules/es.array.push.js";
2
1
  import "core-js/modules/es.error.cause.js";
2
+ import "core-js/modules/es.array.push.js";
3
3
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
4
4
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
5
5
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
6
6
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
8
8
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
- function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
10
- function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
11
- function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
12
- function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
13
- function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
14
- function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
9
+ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
10
+ function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
11
+ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
15
12
  import { BasePlugin } from "../base/index.mjs";
16
13
  import Hooks from "../../pluginHooks.mjs";
17
14
  import MergedCellsCollection from "./cellsCollection.mjs";
@@ -26,6 +23,7 @@ import { rangeEach } from "../../helpers/number.mjs";
26
23
  import { applySpanProperties } from "./utils.mjs";
27
24
  import { getStyle } from "../../helpers/dom/element.mjs";
28
25
  import { isChrome } from "../../helpers/browser.mjs";
26
+ import { FocusOrder } from "./focusOrder.mjs";
29
27
  Hooks.getSingleton().register('beforeMergeCells');
30
28
  Hooks.getSingleton().register('afterMergeCells');
31
29
  Hooks.getSingleton().register('beforeUnmergeCells');
@@ -71,207 +69,17 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
71
69
  * ```
72
70
  * :::
73
71
  */
74
- var _lastDesiredCoords = /*#__PURE__*/new WeakMap();
75
- var _onAfterInit = /*#__PURE__*/new WeakSet();
76
- var _onAfterIsMultipleSelection = /*#__PURE__*/new WeakSet();
77
- var _onModifyTransformStart = /*#__PURE__*/new WeakSet();
78
- var _onModifyTransformEnd = /*#__PURE__*/new WeakSet();
79
- var _onModifyGetCellCoords = /*#__PURE__*/new WeakSet();
80
- var _addMergeActionsToContextMenu = /*#__PURE__*/new WeakSet();
81
- var _onAfterRenderer = /*#__PURE__*/new WeakSet();
82
- var _onBeforeSetRangeStart = /*#__PURE__*/new WeakSet();
83
- var _onBeforeSetRangeEnd = /*#__PURE__*/new WeakSet();
84
- var _onAfterGetCellMeta = /*#__PURE__*/new WeakSet();
85
- var _onAfterViewportRowCalculatorOverride = /*#__PURE__*/new WeakSet();
86
- var _onAfterViewportColumnCalculatorOverride = /*#__PURE__*/new WeakSet();
87
- var _onModifyAutofillRange = /*#__PURE__*/new WeakSet();
88
- var _onAfterCreateCol = /*#__PURE__*/new WeakSet();
89
- var _onAfterRemoveCol = /*#__PURE__*/new WeakSet();
90
- var _onAfterCreateRow = /*#__PURE__*/new WeakSet();
91
- var _onAfterRemoveRow = /*#__PURE__*/new WeakSet();
92
- var _onAfterChange = /*#__PURE__*/new WeakSet();
93
- var _onBeforeDrawAreaBorders = /*#__PURE__*/new WeakSet();
94
- var _onAfterModifyTransformStart = /*#__PURE__*/new WeakSet();
95
- var _onAfterDrawSelection = /*#__PURE__*/new WeakSet();
96
- var _onBeforeRemoveCellClassNames = /*#__PURE__*/new WeakSet();
97
- var _onBeforeBeginEditing = /*#__PURE__*/new WeakSet();
72
+ var _lastSelectedFocus = /*#__PURE__*/new WeakMap();
73
+ var _lastFocusDelta = /*#__PURE__*/new WeakMap();
74
+ var _focusOrder = /*#__PURE__*/new WeakMap();
75
+ var _MergeCells_brand = /*#__PURE__*/new WeakSet();
98
76
  export class MergeCells extends BasePlugin {
99
77
  constructor() {
100
78
  super(...arguments);
101
- /**
102
- * Allows to prevent opening the editor while more than one merged cell is selected.
103
- *
104
- * @param {number} row Visual row index of the edited cell.
105
- * @param {number} column Visual column index of the edited cell.
106
- * @param {string | null} initialValue The initial editor value.
107
- * @param {MouseEvent | KeyboardEvent} event The event which was responsible for opening the editor.
108
- * @returns {boolean | undefined}
109
- */
110
- _classPrivateMethodInitSpec(this, _onBeforeBeginEditing);
111
- /**
112
- * `beforeRemoveCellClassNames` hook callback. Used to remove additional class name from all cells in the table.
113
- *
114
- * @returns {string[]} An `Array` of `String`s. Each of these strings will act like class names to be removed from
115
- * all the cells in the table.
116
- */
117
- _classPrivateMethodInitSpec(this, _onBeforeRemoveCellClassNames);
118
- /**
119
- * `afterDrawSelection` hook callback. Used to add the additional class name for the entirely-selected merged cells.
120
- *
121
- * @param {number} currentRow Visual row index of the currently processed cell.
122
- * @param {number} currentColumn Visual column index of the currently cell.
123
- * @param {Array} cornersOfSelection Array of the current selection in a form of `[startRow, startColumn, endRow,
124
- * endColumn]`.
125
- * @param {number|undefined} layerLevel Number indicating which layer of selection is currently processed.
126
- * @returns {string|undefined} A `String`, which will act as an additional `className` to be added to the currently
127
- * processed cell.
128
- */
129
- _classPrivateMethodInitSpec(this, _onAfterDrawSelection);
130
- /**
131
- * `afterModifyTransformStart` hook callback. Fixes a problem with navigating through merged cells at the edges of
132
- * the table with the <kbd>**Enter**</kbd>/<kbd>**Shift**</kbd>+<kbd>**Enter**</kbd>/<kbd>**Tab**</kbd>/<kbd>**Shift**</kbd>+<kbd>**Tab**</kbd> keys.
133
- *
134
- * @param {CellCoords} coords Coordinates of the to-be-selected cell.
135
- * @param {number} rowTransformDir Row transformation direction (negative value = up, 0 = none, positive value =
136
- * down).
137
- * @param {number} colTransformDir Column transformation direction (negative value = up, 0 = none, positive value =
138
- * down).
139
- */
140
- _classPrivateMethodInitSpec(this, _onAfterModifyTransformStart);
141
- /**
142
- * `beforeDrawAreaBorders` hook callback.
143
- *
144
- * @param {Array} corners Visual coordinates of the area corners.
145
- * @param {string} className Class name for the area.
146
- */
147
- _classPrivateMethodInitSpec(this, _onBeforeDrawAreaBorders);
148
- /**
149
- * `afterChange` hook callback. Used to propagate merged cells after using Autofill.
150
- *
151
- * @param {Array} changes The changes array.
152
- * @param {string} source Determines the source of the change.
153
- */
154
- _classPrivateMethodInitSpec(this, _onAfterChange);
155
- /**
156
- * `afterRemoveRow` hook callback.
157
- *
158
- * @param {number} row Row index.
159
- * @param {number} count Number of removed rows.
160
- */
161
- _classPrivateMethodInitSpec(this, _onAfterRemoveRow);
162
- /**
163
- * `afterCreateRow` hook callback.
164
- *
165
- * @param {number} row Row index.
166
- * @param {number} count Number of created rows.
167
- * @param {string} source Source of change.
168
- */
169
- _classPrivateMethodInitSpec(this, _onAfterCreateRow);
170
- /**
171
- * `afterRemoveCol` hook callback.
172
- *
173
- * @param {number} column Column index.
174
- * @param {number} count Number of removed columns.
175
- */
176
- _classPrivateMethodInitSpec(this, _onAfterRemoveCol);
177
- /**
178
- * `afterCreateCol` hook callback.
179
- *
180
- * @param {number} column Column index.
181
- * @param {number} count Number of created columns.
182
- */
183
- _classPrivateMethodInitSpec(this, _onAfterCreateCol);
184
- /**
185
- * The `modifyAutofillRange` hook callback.
186
- *
187
- * @param {Array} drag The drag area coordinates.
188
- * @param {Array} select The selection information.
189
- * @returns {Array} The new drag area.
190
- */
191
- _classPrivateMethodInitSpec(this, _onModifyAutofillRange);
192
- /**
193
- * `afterViewportColumnCalculatorOverride` hook callback.
194
- *
195
- * @param {object} calc The column calculator object.
196
- */
197
- _classPrivateMethodInitSpec(this, _onAfterViewportColumnCalculatorOverride);
198
- /**
199
- * `afterViewportRowCalculatorOverride` hook callback.
200
- *
201
- * @param {object} calc The row calculator object.
202
- */
203
- _classPrivateMethodInitSpec(this, _onAfterViewportRowCalculatorOverride);
204
- /**
205
- * The `afterGetCellMeta` hook callback.
206
- *
207
- * @param {number} row Row index.
208
- * @param {number} col Column index.
209
- * @param {object} cellProperties The cell properties object.
210
- */
211
- _classPrivateMethodInitSpec(this, _onAfterGetCellMeta);
212
- /**
213
- * `beforeSetRangeEnd` hook callback.
214
- * While selecting cells with keyboard or mouse, make sure that rectangular area is expanded to the extent of the
215
- * merged cell.
216
- *
217
- * Note: Please keep in mind that callback may modify both start and end range coordinates by the reference.
218
- *
219
- * @param {object} coords Cell coords.
220
- */
221
- _classPrivateMethodInitSpec(this, _onBeforeSetRangeEnd);
222
- /**
223
- * `beforeSetRangeStart` and `beforeSetRangeStartOnly` hook callback.
224
- * A selection within merge area should be rewritten to the start of merge area.
225
- *
226
- * @param {object} coords Cell coords.
227
- */
228
- _classPrivateMethodInitSpec(this, _onBeforeSetRangeStart);
229
- /**
230
- * `afterRenderer` hook callback.
231
- *
232
- * @param {HTMLElement} TD The cell to be modified.
233
- * @param {number} row Row index.
234
- * @param {number} col Visual column index.
235
- */
236
- _classPrivateMethodInitSpec(this, _onAfterRenderer);
237
- /**
238
- * `afterContextMenuDefaultOptions` hook callback.
239
- *
240
- * @param {object} defaultOptions The default context menu options.
241
- */
242
- _classPrivateMethodInitSpec(this, _addMergeActionsToContextMenu);
243
- /**
244
- * `modifyGetCellCoords` hook callback. Swaps the `getCell` coords with the merged parent coords.
245
- *
246
- * @param {number} row Row index.
247
- * @param {number} column Visual column index.
248
- * @returns {Array|undefined} Visual coordinates of the merge.
249
- */
250
- _classPrivateMethodInitSpec(this, _onModifyGetCellCoords);
251
- /**
252
- * `modifyTransformEnd` hook callback. Needed to handle "jumping over" merged merged cells, while selecting.
253
- *
254
- * @param {object} delta The transformation delta.
255
- */
256
- _classPrivateMethodInitSpec(this, _onModifyTransformEnd);
257
- /**
258
- * `modifyTransformStart` hook callback.
259
- *
260
- * @param {object} delta The transformation delta.
261
- */
262
- _classPrivateMethodInitSpec(this, _onModifyTransformStart);
263
- /**
264
- * Modifies the information on whether the current selection contains multiple cells. The `afterIsMultipleSelection`
265
- * hook callback.
266
- *
267
- * @param {boolean} isMultiple Determines whether the current selection contains multiple cells.
268
- * @returns {boolean}
269
- */
270
- _classPrivateMethodInitSpec(this, _onAfterIsMultipleSelection);
271
79
  /**
272
80
  * `afterInit` hook callback.
273
81
  */
274
- _classPrivateMethodInitSpec(this, _onAfterInit);
82
+ _classPrivateMethodInitSpec(this, _MergeCells_brand);
275
83
  /**
276
84
  * A container for all the merged cells.
277
85
  *
@@ -294,12 +102,32 @@ export class MergeCells extends BasePlugin {
294
102
  */
295
103
  _defineProperty(this, "selectionCalculations", null);
296
104
  /**
105
+ * The holder for the last selected focus coordinates. This allows keeping the correct coordinates in cases after the
106
+ * focus is moved out of the merged cell.
107
+ *
297
108
  * @type {CellCoords}
298
109
  */
299
- _classPrivateFieldInitSpec(this, _lastDesiredCoords, {
300
- writable: true,
301
- value: null
110
+ _classPrivateFieldInitSpec(this, _lastSelectedFocus, null);
111
+ /**
112
+ * The last used transformation delta.
113
+ *
114
+ * @type {{ row: number, col: number }}
115
+ */
116
+ _classPrivateFieldInitSpec(this, _lastFocusDelta, {
117
+ row: 0,
118
+ col: 0
302
119
  });
120
+ /**
121
+ * The module responsible for providing the correct focus order (vertical and horizontal) within a selection that
122
+ * contains merged cells.
123
+ *
124
+ * @type {FocusOrder}
125
+ */
126
+ _classPrivateFieldInitSpec(this, _focusOrder, new FocusOrder({
127
+ mergedCellsGetter: (row, column) => this.mergedCellsCollection.get(row, column),
128
+ rowIndexMapper: this.hot.rowIndexMapper,
129
+ columnIndexMapper: this.hot.columnIndexMapper
130
+ }));
303
131
  }
304
132
  static get PLUGIN_KEY() {
305
133
  return PLUGIN_KEY;
@@ -332,145 +160,163 @@ export class MergeCells extends BasePlugin {
332
160
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
333
161
  args[_key] = arguments[_key];
334
162
  }
335
- return _classPrivateMethodGet(_this, _onAfterInit, _onAfterInit2).call(_this, ...args);
163
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterInit).call(_this, ...args);
336
164
  });
337
- this.addHook('modifyTransformStart', function () {
165
+ this.addHook('modifyTransformFocus', function () {
338
166
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
339
167
  args[_key2] = arguments[_key2];
340
168
  }
341
- return _classPrivateMethodGet(_this, _onModifyTransformStart, _onModifyTransformStart2).call(_this, ...args);
169
+ return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformFocus).call(_this, ...args);
342
170
  });
343
- this.addHook('afterModifyTransformStart', function () {
171
+ this.addHook('modifyTransformStart', function () {
344
172
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
345
173
  args[_key3] = arguments[_key3];
346
174
  }
347
- return _classPrivateMethodGet(_this, _onAfterModifyTransformStart, _onAfterModifyTransformStart2).call(_this, ...args);
175
+ return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformStart).call(_this, ...args);
348
176
  });
349
177
  this.addHook('modifyTransformEnd', function () {
350
178
  for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
351
179
  args[_key4] = arguments[_key4];
352
180
  }
353
- return _classPrivateMethodGet(_this, _onModifyTransformEnd, _onModifyTransformEnd2).call(_this, ...args);
181
+ return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformEnd).call(_this, ...args);
354
182
  });
355
- this.addHook('modifyGetCellCoords', function () {
183
+ this.addHook('beforeSelectionHighlightSet', function () {
356
184
  for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
357
185
  args[_key5] = arguments[_key5];
358
186
  }
359
- return _classPrivateMethodGet(_this, _onModifyGetCellCoords, _onModifyGetCellCoords2).call(_this, ...args);
187
+ return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSelectionHighlightSet).call(_this, ...args);
360
188
  });
361
189
  this.addHook('beforeSetRangeStart', function () {
362
190
  for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
363
191
  args[_key6] = arguments[_key6];
364
192
  }
365
- return _classPrivateMethodGet(_this, _onBeforeSetRangeStart, _onBeforeSetRangeStart2).call(_this, ...args);
193
+ return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSetRangeStart).call(_this, ...args);
366
194
  });
367
195
  this.addHook('beforeSetRangeStartOnly', function () {
368
196
  for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
369
197
  args[_key7] = arguments[_key7];
370
198
  }
371
- return _classPrivateMethodGet(_this, _onBeforeSetRangeStart, _onBeforeSetRangeStart2).call(_this, ...args);
199
+ return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSetRangeStart).call(_this, ...args);
372
200
  });
373
- this.addHook('beforeSetRangeEnd', function () {
201
+ this.addHook('beforeSelectionFocusSet', function () {
374
202
  for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
375
203
  args[_key8] = arguments[_key8];
376
204
  }
377
- return _classPrivateMethodGet(_this, _onBeforeSetRangeEnd, _onBeforeSetRangeEnd2).call(_this, ...args);
205
+ return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSelectionFocusSet).call(_this, ...args);
378
206
  });
379
- this.addHook('afterIsMultipleSelection', function () {
207
+ this.addHook('afterSelectionFocusSet', function () {
380
208
  for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
381
209
  args[_key9] = arguments[_key9];
382
210
  }
383
- return _classPrivateMethodGet(_this, _onAfterIsMultipleSelection, _onAfterIsMultipleSelection2).call(_this, ...args);
211
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterSelectionFocusSet).call(_this, ...args);
384
212
  });
385
- this.addHook('afterRenderer', function () {
213
+ this.addHook('afterSelectionEnd', function () {
386
214
  for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
387
215
  args[_key10] = arguments[_key10];
388
216
  }
389
- return _classPrivateMethodGet(_this, _onAfterRenderer, _onAfterRenderer2).call(_this, ...args);
217
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterSelectionEnd).call(_this, ...args);
390
218
  });
391
- this.addHook('afterContextMenuDefaultOptions', function () {
219
+ this.addHook('modifyGetCellCoords', function () {
392
220
  for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
393
221
  args[_key11] = arguments[_key11];
394
222
  }
395
- return _classPrivateMethodGet(_this, _addMergeActionsToContextMenu, _addMergeActionsToContextMenu2).call(_this, ...args);
223
+ return _assertClassBrand(_MergeCells_brand, _this, _onModifyGetCellCoords).call(_this, ...args);
396
224
  });
397
- this.addHook('afterGetCellMeta', function () {
225
+ this.addHook('afterIsMultipleSelection', function () {
398
226
  for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
399
227
  args[_key12] = arguments[_key12];
400
228
  }
401
- return _classPrivateMethodGet(_this, _onAfterGetCellMeta, _onAfterGetCellMeta2).call(_this, ...args);
229
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterIsMultipleSelection).call(_this, ...args);
402
230
  });
403
- this.addHook('afterViewportRowCalculatorOverride', function () {
231
+ this.addHook('afterRenderer', function () {
404
232
  for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
405
233
  args[_key13] = arguments[_key13];
406
234
  }
407
- return _classPrivateMethodGet(_this, _onAfterViewportRowCalculatorOverride, _onAfterViewportRowCalculatorOverride2).call(_this, ...args);
235
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterRenderer).call(_this, ...args);
408
236
  });
409
- this.addHook('afterViewportColumnCalculatorOverride', function () {
237
+ this.addHook('afterContextMenuDefaultOptions', function () {
410
238
  for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
411
239
  args[_key14] = arguments[_key14];
412
240
  }
413
- return _classPrivateMethodGet(_this, _onAfterViewportColumnCalculatorOverride, _onAfterViewportColumnCalculatorOverride2).call(_this, ...args);
241
+ return _assertClassBrand(_MergeCells_brand, _this, _addMergeActionsToContextMenu).call(_this, ...args);
414
242
  });
415
- this.addHook('modifyAutofillRange', function () {
243
+ this.addHook('afterGetCellMeta', function () {
416
244
  for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
417
245
  args[_key15] = arguments[_key15];
418
246
  }
419
- return _classPrivateMethodGet(_this, _onModifyAutofillRange, _onModifyAutofillRange2).call(_this, ...args);
247
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterGetCellMeta).call(_this, ...args);
420
248
  });
421
- this.addHook('afterCreateCol', function () {
249
+ this.addHook('afterViewportRowCalculatorOverride', function () {
422
250
  for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {
423
251
  args[_key16] = arguments[_key16];
424
252
  }
425
- return _classPrivateMethodGet(_this, _onAfterCreateCol, _onAfterCreateCol2).call(_this, ...args);
253
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterViewportRowCalculatorOverride).call(_this, ...args);
426
254
  });
427
- this.addHook('afterRemoveCol', function () {
255
+ this.addHook('afterViewportColumnCalculatorOverride', function () {
428
256
  for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {
429
257
  args[_key17] = arguments[_key17];
430
258
  }
431
- return _classPrivateMethodGet(_this, _onAfterRemoveCol, _onAfterRemoveCol2).call(_this, ...args);
259
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterViewportColumnCalculatorOverride).call(_this, ...args);
432
260
  });
433
- this.addHook('afterCreateRow', function () {
261
+ this.addHook('modifyAutofillRange', function () {
434
262
  for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {
435
263
  args[_key18] = arguments[_key18];
436
264
  }
437
- return _classPrivateMethodGet(_this, _onAfterCreateRow, _onAfterCreateRow2).call(_this, ...args);
265
+ return _assertClassBrand(_MergeCells_brand, _this, _onModifyAutofillRange).call(_this, ...args);
438
266
  });
439
- this.addHook('afterRemoveRow', function () {
267
+ this.addHook('afterCreateCol', function () {
440
268
  for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {
441
269
  args[_key19] = arguments[_key19];
442
270
  }
443
- return _classPrivateMethodGet(_this, _onAfterRemoveRow, _onAfterRemoveRow2).call(_this, ...args);
271
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterCreateCol).call(_this, ...args);
444
272
  });
445
- this.addHook('afterChange', function () {
273
+ this.addHook('afterRemoveCol', function () {
446
274
  for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {
447
275
  args[_key20] = arguments[_key20];
448
276
  }
449
- return _classPrivateMethodGet(_this, _onAfterChange, _onAfterChange2).call(_this, ...args);
277
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterRemoveCol).call(_this, ...args);
450
278
  });
451
- this.addHook('beforeDrawBorders', function () {
279
+ this.addHook('afterCreateRow', function () {
452
280
  for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {
453
281
  args[_key21] = arguments[_key21];
454
282
  }
455
- return _classPrivateMethodGet(_this, _onBeforeDrawAreaBorders, _onBeforeDrawAreaBorders2).call(_this, ...args);
283
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterCreateRow).call(_this, ...args);
456
284
  });
457
- this.addHook('afterDrawSelection', function () {
285
+ this.addHook('afterRemoveRow', function () {
458
286
  for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {
459
287
  args[_key22] = arguments[_key22];
460
288
  }
461
- return _classPrivateMethodGet(_this, _onAfterDrawSelection, _onAfterDrawSelection2).call(_this, ...args);
289
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterRemoveRow).call(_this, ...args);
462
290
  });
463
- this.addHook('beforeRemoveCellClassNames', function () {
291
+ this.addHook('afterChange', function () {
464
292
  for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {
465
293
  args[_key23] = arguments[_key23];
466
294
  }
467
- return _classPrivateMethodGet(_this, _onBeforeRemoveCellClassNames, _onBeforeRemoveCellClassNames2).call(_this, ...args);
295
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterChange).call(_this, ...args);
468
296
  });
469
- this.addHook('beforeBeginEditing', function () {
297
+ this.addHook('beforeDrawBorders', function () {
470
298
  for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {
471
299
  args[_key24] = arguments[_key24];
472
300
  }
473
- return _classPrivateMethodGet(_this, _onBeforeBeginEditing, _onBeforeBeginEditing2).call(_this, ...args);
301
+ return _assertClassBrand(_MergeCells_brand, _this, _onBeforeDrawAreaBorders).call(_this, ...args);
302
+ });
303
+ this.addHook('afterDrawSelection', function () {
304
+ for (var _len25 = arguments.length, args = new Array(_len25), _key25 = 0; _key25 < _len25; _key25++) {
305
+ args[_key25] = arguments[_key25];
306
+ }
307
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterDrawSelection).call(_this, ...args);
308
+ });
309
+ this.addHook('beforeRemoveCellClassNames', function () {
310
+ for (var _len26 = arguments.length, args = new Array(_len26), _key26 = 0; _key26 < _len26; _key26++) {
311
+ args[_key26] = arguments[_key26];
312
+ }
313
+ return _assertClassBrand(_MergeCells_brand, _this, _onBeforeRemoveCellClassNames).call(_this, ...args);
314
+ });
315
+ this.addHook('beforeBeginEditing', function () {
316
+ for (var _len27 = arguments.length, args = new Array(_len27), _key27 = 0; _key27 < _len27; _key27++) {
317
+ args[_key27] = arguments[_key27];
318
+ }
319
+ return _assertClassBrand(_MergeCells_brand, _this, _onBeforeBeginEditing).call(_this, ...args);
474
320
  });
475
321
  this.addHook('beforeUndoStackChange', (action, source) => {
476
322
  if (source === 'MergeCells') {
@@ -614,7 +460,9 @@ export class MergeCells extends BasePlugin {
614
460
  if (populatedNulls.length === 0) {
615
461
  return;
616
462
  }
617
- this.hot.setDataAtCell(populatedNulls);
463
+
464
+ // TODO: Change the `source` argument to a more meaningful value, e.g. `${this.pluginName}.clearCells`.
465
+ this.hot.setDataAtCell(populatedNulls, undefined, undefined, this.pluginName);
618
466
  }
619
467
  }
620
468
 
@@ -638,25 +486,6 @@ export class MergeCells extends BasePlugin {
638
486
  return auto ? true : this.validateSetting(newMergedCellInfo);
639
487
  }
640
488
 
641
- /**
642
- * Merge or unmerge, based on last selected range.
643
- *
644
- * @private
645
- */
646
- toggleMergeOnSelection() {
647
- const currentRange = this.hot.getSelectedRangeLast();
648
- if (!currentRange) {
649
- return;
650
- }
651
- currentRange.setDirection(this.hot.isRtl() ? 'NE-SW' : 'NW-SE');
652
- const {
653
- from,
654
- to
655
- } = currentRange;
656
- this.toggleMerge(currentRange);
657
- this.hot.selectCell(from.row, from.col, to.row, to.col, false);
658
- }
659
-
660
489
  /**
661
490
  * Merges the selection provided as a cell range.
662
491
  *
@@ -745,6 +574,7 @@ export class MergeCells extends BasePlugin {
745
574
  if (preventPopulation) {
746
575
  populationInfo = [mergeParent.row, mergeParent.col, clearedData];
747
576
  } else {
577
+ // TODO: Change the `source` argument to a more meaningful value, e.g. `${this.pluginName}.clearCells`.
748
578
  this.hot.populateFromArray(mergeParent.row, mergeParent.col, clearedData, undefined, undefined, this.pluginName);
749
579
  }
750
580
  if (!auto) {
@@ -867,6 +697,15 @@ export class MergeCells extends BasePlugin {
867
697
  const gridContext = shortcutManager.getContext('grid');
868
698
  gridContext.removeShortcutsByGroup(SHORTCUTS_GROUP);
869
699
  }
700
+
701
+ /**
702
+ * Modifies the information on whether the current selection contains multiple cells. The `afterIsMultipleSelection`
703
+ * hook callback.
704
+ *
705
+ * @param {boolean} isMultiple Determines whether the current selection contains multiple cells.
706
+ * @returns {boolean}
707
+ */
708
+
870
709
  /**
871
710
  * Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.
872
711
  *
@@ -923,6 +762,13 @@ export class MergeCells extends BasePlugin {
923
762
  }
924
763
  }
925
764
  }
765
+
766
+ /**
767
+ * `afterViewportColumnCalculatorOverride` hook callback.
768
+ *
769
+ * @param {object} calc The column calculator object.
770
+ */
771
+
926
772
  /**
927
773
  * Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.
928
774
  *
@@ -1017,95 +863,217 @@ export class MergeCells extends BasePlugin {
1017
863
  const renderableColumn = parentColumn >= 0 ? columnMapper.getRenderableFromVisualIndex(firstNonHiddenColumn) : parentColumn;
1018
864
  return [renderableRow, renderableColumn];
1019
865
  }
866
+
867
+ /**
868
+ * The `modifyAutofillRange` hook callback.
869
+ *
870
+ * @param {Array} drag The drag area coordinates.
871
+ * @param {Array} select The selection information.
872
+ * @returns {Array} The new drag area.
873
+ */
1020
874
  }
1021
- function _onAfterInit2() {
875
+ function _onAfterInit() {
1022
876
  this.generateFromSettings(this.hot.getSettings()[PLUGIN_KEY]);
1023
877
  this.hot.render();
1024
878
  }
1025
- function _onAfterIsMultipleSelection2(isMultiple) {
879
+ function _onAfterIsMultipleSelection(isMultiple) {
1026
880
  if (isMultiple) {
1027
881
  const mergedCells = this.mergedCellsCollection.mergedCells;
1028
882
  const selectionRange = this.hot.getSelectedRangeLast();
883
+ const topStartCoords = selectionRange.getTopStartCorner();
884
+ const bottomEndCoords = selectionRange.getBottomEndCorner();
1029
885
  for (let group = 0; group < mergedCells.length; group += 1) {
1030
- if (selectionRange.from.row === mergedCells[group].row && selectionRange.from.col === mergedCells[group].col && selectionRange.to.row === mergedCells[group].row + mergedCells[group].rowspan - 1 && selectionRange.to.col === mergedCells[group].col + mergedCells[group].colspan - 1) {
886
+ if (topStartCoords.row === mergedCells[group].row && topStartCoords.col === mergedCells[group].col && bottomEndCoords.row === mergedCells[group].row + mergedCells[group].rowspan - 1 && bottomEndCoords.col === mergedCells[group].col + mergedCells[group].colspan - 1) {
1031
887
  return false;
1032
888
  }
1033
889
  }
1034
890
  }
1035
891
  return isMultiple;
1036
892
  }
1037
- function _onModifyTransformStart2(delta) {
1038
- const currentlySelectedRange = this.hot.getSelectedRangeLast();
1039
- let newDelta = {
1040
- row: delta.row,
1041
- col: delta.col
893
+ /**
894
+ * `modifyTransformFocus` hook callback.
895
+ *
896
+ * @param {object} delta The transformation delta.
897
+ */
898
+ function _onModifyTransformFocus(delta) {
899
+ _classPrivateFieldGet(_lastFocusDelta, this).row = delta.row;
900
+ _classPrivateFieldGet(_lastFocusDelta, this).col = delta.col;
901
+ }
902
+ /**
903
+ * `modifyTransformStart` hook callback.
904
+ *
905
+ * @param {object} delta The transformation delta.
906
+ */
907
+ function _onModifyTransformStart(delta) {
908
+ const selectedRange = this.hot.getSelectedRangeLast();
909
+ const {
910
+ highlight
911
+ } = selectedRange;
912
+ const {
913
+ columnIndexMapper,
914
+ rowIndexMapper
915
+ } = this.hot;
916
+ if (_classPrivateFieldGet(_lastSelectedFocus, this)) {
917
+ if (rowIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(_lastSelectedFocus, this).row) !== null) {
918
+ highlight.row = _classPrivateFieldGet(_lastSelectedFocus, this).row;
919
+ }
920
+ if (columnIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(_lastSelectedFocus, this).col) !== null) {
921
+ highlight.col = _classPrivateFieldGet(_lastSelectedFocus, this).col;
922
+ }
923
+ _classPrivateFieldSet(_lastSelectedFocus, this, null);
924
+ }
925
+ const mergedParent = this.mergedCellsCollection.get(highlight.row, highlight.col);
926
+ if (!mergedParent) {
927
+ return;
928
+ }
929
+ const visualColumnIndexStart = mergedParent.col;
930
+ const visualColumnIndexEnd = mergedParent.col + mergedParent.colspan - 1;
931
+ if (delta.col < 0) {
932
+ const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexStart - 1 : visualColumnIndexEnd;
933
+ const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
934
+ if (notHiddenColumnIndex === null) {
935
+ // There are no visible columns anymore, so move the selection out of the table edge. This will
936
+ // be processed by the selection Transformer class as a move selection to the previous row (if autoWrapRow is enabled).
937
+ delta.col = -this.hot.view.countRenderableColumnsInRange(0, highlight.col);
938
+ } else {
939
+ delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1, 1);
940
+ }
941
+ } else if (delta.col > 0) {
942
+ const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexEnd + 1 : visualColumnIndexStart;
943
+ const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
944
+ if (notHiddenColumnIndex === null) {
945
+ // There are no visible columns anymore, so move the selection out of the table edge. This will
946
+ // be processed by the selection Transformer class as a move selection to the next row (if autoWrapRow is enabled).
947
+ delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, this.hot.countCols());
948
+ } else {
949
+ delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1, 1);
950
+ }
951
+ }
952
+ const visualRowIndexStart = mergedParent.row;
953
+ const visualRowIndexEnd = mergedParent.row + mergedParent.rowspan - 1;
954
+ if (delta.row < 0) {
955
+ const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexStart - 1 : visualRowIndexEnd;
956
+ const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, -1);
957
+ if (notHiddenRowIndex === null) {
958
+ // There are no visible rows anymore, so move the selection out of the table edge. This will
959
+ // be processed by the selection Transformer class as a move selection to the previous column (if autoWrapCol is enabled).
960
+ delta.row = -this.hot.view.countRenderableRowsInRange(0, highlight.row);
961
+ } else {
962
+ delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, highlight.row) - 1, 1);
963
+ }
964
+ } else if (delta.row > 0) {
965
+ const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexEnd + 1 : visualRowIndexStart;
966
+ const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, 1);
967
+ if (notHiddenRowIndex === null) {
968
+ // There are no visible rows anymore, so move the selection out of the table edge. This will
969
+ // be processed by the selection Transformer class as a move selection to the next column (if autoWrapCol is enabled).
970
+ delta.row = this.hot.view.countRenderableRowsInRange(highlight.row, this.hot.countRows());
971
+ } else {
972
+ delta.row = Math.max(this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowIndex) - 1, 1);
973
+ }
974
+ }
975
+ }
976
+ /**
977
+ * The hook allows to modify the delta transformation object necessary for correct selection end transformations.
978
+ * The logic here handles "jumping over" merged merged cells, while selecting.
979
+ *
980
+ * @param {{ row: number, col: number }} delta The transformation delta.
981
+ */
982
+ function _onModifyTransformEnd(delta) {
983
+ const selectedRange = this.hot.getSelectedRangeLast();
984
+ const cloneRange = selectedRange.clone();
985
+ const {
986
+ to
987
+ } = selectedRange;
988
+ const {
989
+ columnIndexMapper,
990
+ rowIndexMapper
991
+ } = this.hot;
992
+ const expandCloneRange = (row, col) => {
993
+ cloneRange.expand(this.hot._createCellCoords(row, col));
994
+ for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
995
+ cloneRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange());
996
+ }
1042
997
  };
1043
- let nextPosition = null;
1044
- const currentPosition = this.hot._createCellCoords(currentlySelectedRange.highlight.row, currentlySelectedRange.highlight.col);
1045
- const mergedParent = this.mergedCellsCollection.get(currentPosition.row, currentPosition.col);
1046
- if (!_classPrivateFieldGet(this, _lastDesiredCoords)) {
1047
- _classPrivateFieldSet(this, _lastDesiredCoords, this.hot._createCellCoords(null, null));
998
+ if (delta.col < 0) {
999
+ let nextColumn = this.mergedCellsCollection.getStartMostColumnIndex(selectedRange, to.col) + delta.col;
1000
+ expandCloneRange(to.row, nextColumn);
1001
+ if (selectedRange.getHorizontalDirection() === 'E-W' && cloneRange.getHorizontalDirection() === 'E-W') {
1002
+ nextColumn = cloneRange.getTopStartCorner().col;
1003
+ }
1004
+ const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
1005
+ if (notHiddenColumnIndex !== null) {
1006
+ delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, to.col) - 1, 1);
1007
+ }
1008
+ } else if (delta.col > 0) {
1009
+ let nextColumn = this.mergedCellsCollection.getEndMostColumnIndex(selectedRange, to.col) + delta.col;
1010
+ expandCloneRange(to.row, nextColumn);
1011
+ if (selectedRange.getHorizontalDirection() === 'W-E' && cloneRange.getHorizontalDirection() === 'W-E') {
1012
+ nextColumn = cloneRange.getBottomEndCorner().col;
1013
+ }
1014
+ const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
1015
+ if (notHiddenColumnIndex !== null) {
1016
+ delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(to.col, notHiddenColumnIndex) - 1, 1);
1017
+ }
1048
1018
  }
1049
- if (mergedParent) {
1050
- // only merge selected
1051
- const mergeTopLeft = this.hot._createCellCoords(mergedParent.row, mergedParent.col);
1052
- const mergeBottomRight = this.hot._createCellCoords(mergedParent.row + mergedParent.rowspan - 1, mergedParent.col + mergedParent.colspan - 1);
1053
- const mergeRange = this.hot._createCellRange(mergeTopLeft, mergeTopLeft, mergeBottomRight);
1054
- if (!mergeRange.includes(_classPrivateFieldGet(this, _lastDesiredCoords))) {
1055
- _classPrivateFieldSet(this, _lastDesiredCoords, this.hot._createCellCoords(null, null)); // reset outdated version of lastDesiredCoords
1019
+ if (delta.row < 0) {
1020
+ let nextRow = this.mergedCellsCollection.getTopMostRowIndex(selectedRange, to.row) + delta.row;
1021
+ expandCloneRange(nextRow, to.col);
1022
+ if (selectedRange.getVerticalDirection() === 'S-N' && cloneRange.getVerticalDirection() === 'S-N') {
1023
+ nextRow = cloneRange.getTopStartCorner().row;
1056
1024
  }
1057
- newDelta.row = _classPrivateFieldGet(this, _lastDesiredCoords).row ? _classPrivateFieldGet(this, _lastDesiredCoords).row - currentPosition.row : newDelta.row;
1058
- newDelta.col = _classPrivateFieldGet(this, _lastDesiredCoords).col ? _classPrivateFieldGet(this, _lastDesiredCoords).col - currentPosition.col : newDelta.col;
1059
- if (delta.row > 0) {
1060
- // moving down
1061
- newDelta.row = mergedParent.row + mergedParent.rowspan - 1 - currentPosition.row + delta.row;
1062
- } else if (delta.row < 0) {
1063
- // moving up
1064
- newDelta.row = currentPosition.row - mergedParent.row + delta.row;
1025
+ const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, 1);
1026
+ if (notHiddenRowIndex !== null) {
1027
+ delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, to.row) - 1, 1);
1065
1028
  }
1066
- if (delta.col > 0) {
1067
- // moving right
1068
- newDelta.col = mergedParent.col + mergedParent.colspan - 1 - currentPosition.col + delta.col;
1069
- } else if (delta.col < 0) {
1070
- // moving left
1071
- newDelta.col = currentPosition.col - mergedParent.col + delta.col;
1029
+ } else if (delta.row > 0) {
1030
+ let nextRow = this.mergedCellsCollection.getBottomMostRowIndex(selectedRange, to.row) + delta.row;
1031
+ expandCloneRange(nextRow, to.col);
1032
+ if (selectedRange.getVerticalDirection() === 'N-S' && cloneRange.getVerticalDirection() === 'N-S') {
1033
+ nextRow = cloneRange.getBottomStartCorner().row;
1034
+ }
1035
+ const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, -1);
1036
+ if (notHiddenRowIndex !== null) {
1037
+ delta.row = Math.max(this.hot.view.countRenderableRowsInRange(to.row, notHiddenRowIndex) - 1, 1);
1072
1038
  }
1073
1039
  }
1074
- nextPosition = this.hot._createCellCoords(currentlySelectedRange.highlight.row + newDelta.row, currentlySelectedRange.highlight.col + newDelta.col);
1075
- const nextPositionMergedCell = this.mergedCellsCollection.get(nextPosition.row, nextPosition.col);
1076
- if (nextPositionMergedCell) {
1077
- // skipping the invisible cells in the merge range
1078
- const firstRenderableCoords = this.mergedCellsCollection.getFirstRenderableCoords(nextPositionMergedCell.row, nextPositionMergedCell.col);
1079
- _classPrivateFieldSet(this, _lastDesiredCoords, nextPosition);
1080
- newDelta = {
1081
- row: firstRenderableCoords.row - currentPosition.row,
1082
- col: firstRenderableCoords.col - currentPosition.col
1083
- };
1040
+ }
1041
+ /**
1042
+ * The hook corrects the range (before drawing it) after the selection was made on the merged cells.
1043
+ * It expands the range to cover the entire area of the selected merged cells.
1044
+ */
1045
+ function _onBeforeSelectionHighlightSet() {
1046
+ const selectedRange = this.hot.getSelectedRangeLast();
1047
+ const {
1048
+ highlight
1049
+ } = selectedRange;
1050
+ if (this.hot.selection.isSelectedByColumnHeader() || this.hot.selection.isSelectedByRowHeader()) {
1051
+ _classPrivateFieldSet(_lastSelectedFocus, this, highlight.clone());
1052
+ return;
1084
1053
  }
1085
- if (newDelta.row !== 0) {
1086
- delta.row = newDelta.row;
1054
+ for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
1055
+ selectedRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange(), false);
1087
1056
  }
1088
- if (newDelta.col !== 0) {
1089
- delta.col = newDelta.col;
1057
+ // TODO: This is a workaround for an issue with the selection not being extended properly.
1058
+ // In some cases when the merge cells are defined in random order the selection is not
1059
+ // extended in that way that it covers all overlapped merge cells.
1060
+ for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
1061
+ selectedRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange(), false);
1062
+ }
1063
+ const mergedParent = this.mergedCellsCollection.get(highlight.row, highlight.col);
1064
+ _classPrivateFieldSet(_lastSelectedFocus, this, highlight.clone());
1065
+ if (mergedParent) {
1066
+ highlight.assign(mergedParent);
1090
1067
  }
1091
1068
  }
1092
- function _onModifyTransformEnd2(delta) {
1093
- const currentSelectionRange = this.hot.getSelectedRangeLast();
1094
- const newDelta = clone(delta);
1095
- const newSelectionRange = this.selectionCalculations.getUpdatedSelectionRange(currentSelectionRange, delta);
1096
- let tempDelta = clone(newDelta);
1097
- const mergedCellsWithinRange = this.mergedCellsCollection.getWithinRange(newSelectionRange, true);
1098
- do {
1099
- tempDelta = clone(newDelta);
1100
- this.selectionCalculations.getUpdatedSelectionRange(currentSelectionRange, newDelta);
1101
- arrayEach(mergedCellsWithinRange, mergedCell => {
1102
- this.selectionCalculations.snapDelta(newDelta, currentSelectionRange, mergedCell);
1103
- });
1104
- } while (newDelta.row !== tempDelta.row || newDelta.col !== tempDelta.col);
1105
- delta.row = newDelta.row;
1106
- delta.col = newDelta.col;
1107
- }
1108
- function _onModifyGetCellCoords2(row, column) {
1069
+ /**
1070
+ * `modifyGetCellCoords` hook callback. Swaps the `getCell` coords with the merged parent coords.
1071
+ *
1072
+ * @param {number} row Row index.
1073
+ * @param {number} column Visual column index.
1074
+ * @returns {Array|undefined} Visual coordinates of the merge.
1075
+ */
1076
+ function _onModifyGetCellCoords(row, column) {
1109
1077
  if (row < 0 || column < 0) {
1110
1078
  return;
1111
1079
  }
@@ -1125,12 +1093,24 @@ function _onModifyGetCellCoords2(row, column) {
1125
1093
  // Most bottom-right merged cell coords.
1126
1094
  mergeRow + rowspan - 1, mergeColumn + colspan - 1];
1127
1095
  }
1128
- function _addMergeActionsToContextMenu2(defaultOptions) {
1096
+ /**
1097
+ * `afterContextMenuDefaultOptions` hook callback.
1098
+ *
1099
+ * @param {object} defaultOptions The default context menu options.
1100
+ */
1101
+ function _addMergeActionsToContextMenu(defaultOptions) {
1129
1102
  defaultOptions.items.push({
1130
1103
  name: '---------'
1131
1104
  }, toggleMergeItem(this));
1132
1105
  }
1133
- function _onAfterRenderer2(TD, row, col) {
1106
+ /**
1107
+ * `afterRenderer` hook callback.
1108
+ *
1109
+ * @param {HTMLElement} TD The cell to be modified.
1110
+ * @param {number} row Row index.
1111
+ * @param {number} col Visual column index.
1112
+ */
1113
+ function _onAfterRenderer(TD, row, col) {
1134
1114
  const mergedCell = this.mergedCellsCollection.get(row, col);
1135
1115
  // We shouldn't override data in the collection.
1136
1116
  const mergedCellCopy = isObject(mergedCell) ? clone(mergedCell) : undefined;
@@ -1162,39 +1142,114 @@ function _onAfterRenderer2(TD, row, col) {
1162
1142
  }
1163
1143
  applySpanProperties(TD, mergedCellCopy, row, col);
1164
1144
  }
1165
- function _onBeforeSetRangeStart2(coords) {
1166
- // TODO: It is a workaround, but probably this hook may be needed. Every selection on the merge area
1167
- // could set start point of the selection to the start of the merge area. However, logic inside `expandByRange` need
1168
- // an initial start point. Click on the merge cell when there are some hidden indexes break the logic in some cases.
1169
- // Please take a look at #7010 for more information. I'm not sure if selection directions are calculated properly
1170
- // and what was idea for flipping direction inside `expandByRange` method.
1171
- if (this.mergedCellsCollection.isFirstRenderableMergedCell(coords.row, coords.col)) {
1172
- const mergeParent = this.mergedCellsCollection.get(coords.row, coords.col);
1173
- [coords.row, coords.col] = [mergeParent.row, mergeParent.col];
1174
- }
1145
+ /**
1146
+ * Clears the last selected coordinates before setting a new selection range.
1147
+ */
1148
+ function _onBeforeSetRangeStart() {
1149
+ _classPrivateFieldSet(_lastSelectedFocus, this, null);
1175
1150
  }
1176
- function _onBeforeSetRangeEnd2(coords) {
1177
- const selRange = this.hot.getSelectedRangeLast();
1178
- selRange.highlight = this.hot._createCellCoords(selRange.highlight.row, selRange.highlight.col); // clone in case we will modify its reference
1179
- selRange.to = coords;
1180
- let rangeExpanded = false;
1181
- if (this.hot.selection.isSelectedByColumnHeader() || this.hot.selection.isSelectedByRowHeader()) {
1151
+ /**
1152
+ * Detects if the last selected cell was a header cell if so update the order list active node for further
1153
+ * computations.
1154
+ */
1155
+ function _onBeforeSelectionFocusSet() {
1156
+ if (_classPrivateFieldGet(_lastSelectedFocus, this).isCell()) {
1182
1157
  return;
1183
1158
  }
1184
- do {
1185
- rangeExpanded = false;
1186
- for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
1187
- const cellInfo = this.mergedCellsCollection.mergedCells[i];
1188
- const mergedCellRange = cellInfo.getRange();
1189
- if (selRange.expandByRange(mergedCellRange)) {
1190
- coords.row = selRange.to.row;
1191
- coords.col = selRange.to.col;
1192
- rangeExpanded = true;
1193
- }
1159
+ const selectedRange = this.hot.getSelectedRangeLast();
1160
+ const verticalDir = selectedRange.getVerticalDirection();
1161
+ const horizontalDir = selectedRange.getHorizontalDirection();
1162
+ const focusCoords = _classPrivateFieldGet(_lastSelectedFocus, this).clone().normalize();
1163
+ _classPrivateFieldGet(_focusOrder, this).setActiveNode(focusCoords.row, focusCoords.col);
1164
+ if (_classPrivateFieldGet(_lastFocusDelta, this).row > 0 || _classPrivateFieldGet(_lastFocusDelta, this).col > 0) {
1165
+ _classPrivateFieldGet(_focusOrder, this).setPrevNodeAsActive();
1166
+ } else if (horizontalDir === 'E-W' && _classPrivateFieldGet(_lastFocusDelta, this).col < 0 || verticalDir === 'S-N' && _classPrivateFieldGet(_lastFocusDelta, this).row < 0) {
1167
+ _classPrivateFieldGet(_focusOrder, this).setNextNodeAsActive();
1168
+ }
1169
+ }
1170
+ /**
1171
+ * Changes the focus selection to the next or previous cell or merged cell position.
1172
+ *
1173
+ * @param {number} row The visual row index.
1174
+ * @param {number} column The visual column index.
1175
+ */
1176
+ function _onAfterSelectionFocusSet(row, column) {
1177
+ const selectedRange = this.hot.getSelectedRangeLast();
1178
+ const {
1179
+ columnIndexMapper,
1180
+ rowIndexMapper
1181
+ } = this.hot;
1182
+ let notHiddenRowIndex = null;
1183
+ let notHiddenColumnIndex = null;
1184
+ if (_classPrivateFieldGet(_lastFocusDelta, this).col < 0) {
1185
+ const {
1186
+ rowEnd,
1187
+ colEnd
1188
+ } = _classPrivateFieldGet(_focusOrder, this).getPrevHorizontalNode();
1189
+ notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colEnd, -1);
1190
+ notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowEnd, -1);
1191
+ } else if (_classPrivateFieldGet(_lastFocusDelta, this).col > 0) {
1192
+ const {
1193
+ rowStart,
1194
+ colStart
1195
+ } = _classPrivateFieldGet(_focusOrder, this).getNextHorizontalNode();
1196
+ notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);
1197
+ notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);
1198
+ } else if (_classPrivateFieldGet(_lastFocusDelta, this).row < 0) {
1199
+ const {
1200
+ rowEnd,
1201
+ colEnd
1202
+ } = _classPrivateFieldGet(_focusOrder, this).getPrevVerticalNode();
1203
+ notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colEnd, -1);
1204
+ notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowEnd, -1);
1205
+ } else if (_classPrivateFieldGet(_lastFocusDelta, this).row > 0) {
1206
+ const {
1207
+ rowStart,
1208
+ colStart
1209
+ } = _classPrivateFieldGet(_focusOrder, this).getNextVerticalNode();
1210
+ notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);
1211
+ notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);
1212
+ }
1213
+ if (notHiddenRowIndex !== null || notHiddenColumnIndex !== null) {
1214
+ const coords = this.hot._createCellCoords(notHiddenRowIndex, notHiddenColumnIndex);
1215
+ const mergeParent = this.mergedCellsCollection.get(coords.row, coords.col);
1216
+ const focusHighlight = this.hot.selection.highlight.getFocus();
1217
+ row = coords.row;
1218
+ column = coords.col;
1219
+ if (mergeParent) {
1220
+ selectedRange.highlight.assign({
1221
+ row: this.hot.rowIndexMapper.getNearestNotHiddenIndex(mergeParent.row, 1),
1222
+ col: this.hot.columnIndexMapper.getNearestNotHiddenIndex(mergeParent.col, 1)
1223
+ });
1224
+ } else {
1225
+ selectedRange.highlight.assign(coords);
1194
1226
  }
1195
- } while (rangeExpanded);
1227
+ focusHighlight.clear();
1228
+ focusHighlight.add(coords).commit();
1229
+ }
1230
+ _classPrivateFieldGet(_focusOrder, this).setActiveNode(row, column);
1231
+ _classPrivateFieldSet(_lastFocusDelta, this, {
1232
+ row: 0,
1233
+ col: 0
1234
+ });
1196
1235
  }
1197
- function _onAfterGetCellMeta2(row, col, cellProperties) {
1236
+ /**
1237
+ * Creates the horizontal and vertical cells order matrix (linked lists) for focused cell.
1238
+ */
1239
+ function _onAfterSelectionEnd() {
1240
+ const selection = this.hot.getSelectedRangeLast();
1241
+ if (!selection.isHeader()) {
1242
+ _classPrivateFieldGet(_focusOrder, this).buildFocusOrder(this.hot.getSelectedRangeLast());
1243
+ }
1244
+ }
1245
+ /**
1246
+ * The `afterGetCellMeta` hook callback.
1247
+ *
1248
+ * @param {number} row Row index.
1249
+ * @param {number} col Column index.
1250
+ * @param {object} cellProperties The cell properties object.
1251
+ */
1252
+ function _onAfterGetCellMeta(row, col, cellProperties) {
1198
1253
  const mergeParent = this.mergedCellsCollection.get(row, col);
1199
1254
  if (mergeParent) {
1200
1255
  if (mergeParent.row !== row || mergeParent.col !== col) {
@@ -1205,17 +1260,22 @@ function _onAfterGetCellMeta2(row, col, cellProperties) {
1205
1260
  }
1206
1261
  }
1207
1262
  }
1208
- function _onAfterViewportRowCalculatorOverride2(calc) {
1263
+ /**
1264
+ * `afterViewportRowCalculatorOverride` hook callback.
1265
+ *
1266
+ * @param {object} calc The row calculator object.
1267
+ */
1268
+ function _onAfterViewportRowCalculatorOverride(calc) {
1209
1269
  const nrOfColumns = this.hot.countCols();
1210
1270
  this.modifyViewportRowStart(calc, nrOfColumns);
1211
1271
  this.modifyViewportRowEnd(calc, nrOfColumns);
1212
1272
  }
1213
- function _onAfterViewportColumnCalculatorOverride2(calc) {
1273
+ function _onAfterViewportColumnCalculatorOverride(calc) {
1214
1274
  const nrOfRows = this.hot.countRows();
1215
1275
  this.modifyViewportColumnStart(calc, nrOfRows);
1216
1276
  this.modifyViewportColumnEnd(calc, nrOfRows);
1217
1277
  }
1218
- function _onModifyAutofillRange2(drag, select) {
1278
+ function _onModifyAutofillRange(drag, select) {
1219
1279
  this.autofillCalculations.correctSelectionAreaSize(select);
1220
1280
  const dragDirection = this.autofillCalculations.getDirection(select, drag);
1221
1281
  let dragArea = drag;
@@ -1239,28 +1299,65 @@ function _onModifyAutofillRange2(drag, select) {
1239
1299
  dragArea = this.autofillCalculations.snapDragArea(select, dragArea, dragDirection, mergedCellsWithinSelectionArea);
1240
1300
  return dragArea;
1241
1301
  }
1242
- function _onAfterCreateCol2(column, count) {
1302
+ /**
1303
+ * `afterCreateCol` hook callback.
1304
+ *
1305
+ * @param {number} column Column index.
1306
+ * @param {number} count Number of created columns.
1307
+ */
1308
+ function _onAfterCreateCol(column, count) {
1243
1309
  this.mergedCellsCollection.shiftCollections('right', column, count);
1244
1310
  }
1245
- function _onAfterRemoveCol2(column, count) {
1311
+ /**
1312
+ * `afterRemoveCol` hook callback.
1313
+ *
1314
+ * @param {number} column Column index.
1315
+ * @param {number} count Number of removed columns.
1316
+ */
1317
+ function _onAfterRemoveCol(column, count) {
1246
1318
  this.mergedCellsCollection.shiftCollections('left', column, count);
1247
1319
  }
1248
- function _onAfterCreateRow2(row, count, source) {
1320
+ /**
1321
+ * `afterCreateRow` hook callback.
1322
+ *
1323
+ * @param {number} row Row index.
1324
+ * @param {number} count Number of created rows.
1325
+ * @param {string} source Source of change.
1326
+ */
1327
+ function _onAfterCreateRow(row, count, source) {
1249
1328
  if (source === 'auto') {
1250
1329
  return;
1251
1330
  }
1252
1331
  this.mergedCellsCollection.shiftCollections('down', row, count);
1253
1332
  }
1254
- function _onAfterRemoveRow2(row, count) {
1333
+ /**
1334
+ * `afterRemoveRow` hook callback.
1335
+ *
1336
+ * @param {number} row Row index.
1337
+ * @param {number} count Number of removed rows.
1338
+ */
1339
+ function _onAfterRemoveRow(row, count) {
1255
1340
  this.mergedCellsCollection.shiftCollections('up', row, count);
1256
1341
  }
1257
- function _onAfterChange2(changes, source) {
1342
+ /**
1343
+ * `afterChange` hook callback. Used to propagate merged cells after using Autofill.
1344
+ *
1345
+ * @param {Array} changes The changes array.
1346
+ * @param {string} source Determines the source of the change.
1347
+ */
1348
+ function _onAfterChange(changes, source) {
1258
1349
  if (source !== 'Autofill.fill') {
1259
1350
  return;
1260
1351
  }
1261
1352
  this.autofillCalculations.recreateAfterDataPopulation(changes);
1262
1353
  }
1263
- function _onBeforeDrawAreaBorders2(corners, className) {
1354
+ /**
1355
+ * `beforeDrawAreaBorders` hook callback.
1356
+ *
1357
+ * @param {Array} corners Visual coordinates of the area corners.
1358
+ * @param {string} className Class name for the area.
1359
+ */
1360
+ function _onBeforeDrawAreaBorders(corners, className) {
1264
1361
  if (className && className === 'area') {
1265
1362
  const selectedRange = this.hot.getSelectedRangeLast();
1266
1363
  const mergedCellsWithinRange = this.mergedCellsCollection.getWithinRange(selectedRange);
@@ -1272,38 +1369,43 @@ function _onBeforeDrawAreaBorders2(corners, className) {
1272
1369
  });
1273
1370
  }
1274
1371
  }
1275
- function _onAfterModifyTransformStart2(coords, rowTransformDir, colTransformDir) {
1276
- if (!this.enabled) {
1277
- return;
1278
- }
1279
- const mergedCellAtCoords = this.mergedCellsCollection.get(coords.row, coords.col);
1280
- if (!mergedCellAtCoords) {
1281
- return;
1282
- }
1283
- const goingDown = rowTransformDir > 0;
1284
- const goingUp = rowTransformDir < 0;
1285
- const goingLeft = colTransformDir < 0;
1286
- const goingRight = colTransformDir > 0;
1287
- const mergedCellOnBottomEdge = mergedCellAtCoords.row + mergedCellAtCoords.rowspan - 1 === this.hot.countRows() - 1;
1288
- const mergedCellOnTopEdge = mergedCellAtCoords.row === 0;
1289
- const mergedCellOnRightEdge = mergedCellAtCoords.col + mergedCellAtCoords.colspan - 1 === this.hot.countCols() - 1;
1290
- const mergedCellOnLeftEdge = mergedCellAtCoords.col === 0;
1291
- if (goingDown && mergedCellOnBottomEdge || goingUp && mergedCellOnTopEdge || goingRight && mergedCellOnRightEdge || goingLeft && mergedCellOnLeftEdge) {
1292
- coords.row = mergedCellAtCoords.row;
1293
- coords.col = mergedCellAtCoords.col;
1294
- }
1295
- }
1296
- function _onAfterDrawSelection2(currentRow, currentColumn, cornersOfSelection, layerLevel) {
1372
+ /**
1373
+ * `afterDrawSelection` hook callback. Used to add the additional class name for the entirely-selected merged cells.
1374
+ *
1375
+ * @param {number} currentRow Visual row index of the currently processed cell.
1376
+ * @param {number} currentColumn Visual column index of the currently cell.
1377
+ * @param {Array} cornersOfSelection Array of the current selection in a form of `[startRow, startColumn, endRow,
1378
+ * endColumn]`.
1379
+ * @param {number|undefined} layerLevel Number indicating which layer of selection is currently processed.
1380
+ * @returns {string|undefined} A `String`, which will act as an additional `className` to be added to the currently
1381
+ * processed cell.
1382
+ */
1383
+ function _onAfterDrawSelection(currentRow, currentColumn, cornersOfSelection, layerLevel) {
1297
1384
  // Nothing's selected (hook might be triggered by the custom borders)
1298
1385
  if (!cornersOfSelection) {
1299
1386
  return;
1300
1387
  }
1301
1388
  return this.selectionCalculations.getSelectedMergedCellClassName(currentRow, currentColumn, cornersOfSelection, layerLevel);
1302
1389
  }
1303
- function _onBeforeRemoveCellClassNames2() {
1390
+ /**
1391
+ * `beforeRemoveCellClassNames` hook callback. Used to remove additional class name from all cells in the table.
1392
+ *
1393
+ * @returns {string[]} An `Array` of `String`s. Each of these strings will act like class names to be removed from
1394
+ * all the cells in the table.
1395
+ */
1396
+ function _onBeforeRemoveCellClassNames() {
1304
1397
  return this.selectionCalculations.getSelectedMergedCellClassNameToRemove();
1305
1398
  }
1306
- function _onBeforeBeginEditing2(row, column, initialValue, event) {
1399
+ /**
1400
+ * Allows to prevent opening the editor while more than one merged cell is selected.
1401
+ *
1402
+ * @param {number} row Visual row index of the edited cell.
1403
+ * @param {number} column Visual column index of the edited cell.
1404
+ * @param {string | null} initialValue The initial editor value.
1405
+ * @param {MouseEvent | KeyboardEvent} event The event which was responsible for opening the editor.
1406
+ * @returns {boolean | undefined}
1407
+ */
1408
+ function _onBeforeBeginEditing(row, column, initialValue, event) {
1307
1409
  if (!(event instanceof MouseEvent)) {
1308
1410
  return;
1309
1411
  }