handsontable 14.2.0 → 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,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- require("core-js/modules/es.array.push.js");
5
4
  require("core-js/modules/es.error.cause.js");
5
+ require("core-js/modules/es.array.push.js");
6
6
  var _base = require("../base");
7
7
  var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
8
8
  var _cellsCollection = _interopRequireDefault(require("./cellsCollection"));
@@ -17,19 +17,17 @@ var _number = require("../../helpers/number");
17
17
  var _utils = require("./utils");
18
18
  var _element = require("../../helpers/dom/element");
19
19
  var _browser = require("../../helpers/browser");
20
+ var _focusOrder2 = require("./focusOrder");
20
21
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
22
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
22
23
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
23
24
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
24
25
  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; }
25
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
26
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
26
27
  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); }
27
- function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
28
- 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; } }
29
- function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
30
- function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
31
- function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
32
- function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
28
+ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
29
+ function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
30
+ 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"); }
33
31
  _pluginHooks.default.getSingleton().register('beforeMergeCells');
34
32
  _pluginHooks.default.getSingleton().register('afterMergeCells');
35
33
  _pluginHooks.default.getSingleton().register('beforeUnmergeCells');
@@ -75,207 +73,17 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
75
73
  * ```
76
74
  * :::
77
75
  */
78
- var _lastDesiredCoords = /*#__PURE__*/new WeakMap();
79
- var _onAfterInit = /*#__PURE__*/new WeakSet();
80
- var _onAfterIsMultipleSelection = /*#__PURE__*/new WeakSet();
81
- var _onModifyTransformStart = /*#__PURE__*/new WeakSet();
82
- var _onModifyTransformEnd = /*#__PURE__*/new WeakSet();
83
- var _onModifyGetCellCoords = /*#__PURE__*/new WeakSet();
84
- var _addMergeActionsToContextMenu = /*#__PURE__*/new WeakSet();
85
- var _onAfterRenderer = /*#__PURE__*/new WeakSet();
86
- var _onBeforeSetRangeStart = /*#__PURE__*/new WeakSet();
87
- var _onBeforeSetRangeEnd = /*#__PURE__*/new WeakSet();
88
- var _onAfterGetCellMeta = /*#__PURE__*/new WeakSet();
89
- var _onAfterViewportRowCalculatorOverride = /*#__PURE__*/new WeakSet();
90
- var _onAfterViewportColumnCalculatorOverride = /*#__PURE__*/new WeakSet();
91
- var _onModifyAutofillRange = /*#__PURE__*/new WeakSet();
92
- var _onAfterCreateCol = /*#__PURE__*/new WeakSet();
93
- var _onAfterRemoveCol = /*#__PURE__*/new WeakSet();
94
- var _onAfterCreateRow = /*#__PURE__*/new WeakSet();
95
- var _onAfterRemoveRow = /*#__PURE__*/new WeakSet();
96
- var _onAfterChange = /*#__PURE__*/new WeakSet();
97
- var _onBeforeDrawAreaBorders = /*#__PURE__*/new WeakSet();
98
- var _onAfterModifyTransformStart = /*#__PURE__*/new WeakSet();
99
- var _onAfterDrawSelection = /*#__PURE__*/new WeakSet();
100
- var _onBeforeRemoveCellClassNames = /*#__PURE__*/new WeakSet();
101
- var _onBeforeBeginEditing = /*#__PURE__*/new WeakSet();
76
+ var _lastSelectedFocus = /*#__PURE__*/new WeakMap();
77
+ var _lastFocusDelta = /*#__PURE__*/new WeakMap();
78
+ var _focusOrder = /*#__PURE__*/new WeakMap();
79
+ var _MergeCells_brand = /*#__PURE__*/new WeakSet();
102
80
  class MergeCells extends _base.BasePlugin {
103
81
  constructor() {
104
82
  super(...arguments);
105
- /**
106
- * Allows to prevent opening the editor while more than one merged cell is selected.
107
- *
108
- * @param {number} row Visual row index of the edited cell.
109
- * @param {number} column Visual column index of the edited cell.
110
- * @param {string | null} initialValue The initial editor value.
111
- * @param {MouseEvent | KeyboardEvent} event The event which was responsible for opening the editor.
112
- * @returns {boolean | undefined}
113
- */
114
- _classPrivateMethodInitSpec(this, _onBeforeBeginEditing);
115
- /**
116
- * `beforeRemoveCellClassNames` hook callback. Used to remove additional class name from all cells in the table.
117
- *
118
- * @returns {string[]} An `Array` of `String`s. Each of these strings will act like class names to be removed from
119
- * all the cells in the table.
120
- */
121
- _classPrivateMethodInitSpec(this, _onBeforeRemoveCellClassNames);
122
- /**
123
- * `afterDrawSelection` hook callback. Used to add the additional class name for the entirely-selected merged cells.
124
- *
125
- * @param {number} currentRow Visual row index of the currently processed cell.
126
- * @param {number} currentColumn Visual column index of the currently cell.
127
- * @param {Array} cornersOfSelection Array of the current selection in a form of `[startRow, startColumn, endRow,
128
- * endColumn]`.
129
- * @param {number|undefined} layerLevel Number indicating which layer of selection is currently processed.
130
- * @returns {string|undefined} A `String`, which will act as an additional `className` to be added to the currently
131
- * processed cell.
132
- */
133
- _classPrivateMethodInitSpec(this, _onAfterDrawSelection);
134
- /**
135
- * `afterModifyTransformStart` hook callback. Fixes a problem with navigating through merged cells at the edges of
136
- * the table with the <kbd>**Enter**</kbd>/<kbd>**Shift**</kbd>+<kbd>**Enter**</kbd>/<kbd>**Tab**</kbd>/<kbd>**Shift**</kbd>+<kbd>**Tab**</kbd> keys.
137
- *
138
- * @param {CellCoords} coords Coordinates of the to-be-selected cell.
139
- * @param {number} rowTransformDir Row transformation direction (negative value = up, 0 = none, positive value =
140
- * down).
141
- * @param {number} colTransformDir Column transformation direction (negative value = up, 0 = none, positive value =
142
- * down).
143
- */
144
- _classPrivateMethodInitSpec(this, _onAfterModifyTransformStart);
145
- /**
146
- * `beforeDrawAreaBorders` hook callback.
147
- *
148
- * @param {Array} corners Visual coordinates of the area corners.
149
- * @param {string} className Class name for the area.
150
- */
151
- _classPrivateMethodInitSpec(this, _onBeforeDrawAreaBorders);
152
- /**
153
- * `afterChange` hook callback. Used to propagate merged cells after using Autofill.
154
- *
155
- * @param {Array} changes The changes array.
156
- * @param {string} source Determines the source of the change.
157
- */
158
- _classPrivateMethodInitSpec(this, _onAfterChange);
159
- /**
160
- * `afterRemoveRow` hook callback.
161
- *
162
- * @param {number} row Row index.
163
- * @param {number} count Number of removed rows.
164
- */
165
- _classPrivateMethodInitSpec(this, _onAfterRemoveRow);
166
- /**
167
- * `afterCreateRow` hook callback.
168
- *
169
- * @param {number} row Row index.
170
- * @param {number} count Number of created rows.
171
- * @param {string} source Source of change.
172
- */
173
- _classPrivateMethodInitSpec(this, _onAfterCreateRow);
174
- /**
175
- * `afterRemoveCol` hook callback.
176
- *
177
- * @param {number} column Column index.
178
- * @param {number} count Number of removed columns.
179
- */
180
- _classPrivateMethodInitSpec(this, _onAfterRemoveCol);
181
- /**
182
- * `afterCreateCol` hook callback.
183
- *
184
- * @param {number} column Column index.
185
- * @param {number} count Number of created columns.
186
- */
187
- _classPrivateMethodInitSpec(this, _onAfterCreateCol);
188
- /**
189
- * The `modifyAutofillRange` hook callback.
190
- *
191
- * @param {Array} drag The drag area coordinates.
192
- * @param {Array} select The selection information.
193
- * @returns {Array} The new drag area.
194
- */
195
- _classPrivateMethodInitSpec(this, _onModifyAutofillRange);
196
- /**
197
- * `afterViewportColumnCalculatorOverride` hook callback.
198
- *
199
- * @param {object} calc The column calculator object.
200
- */
201
- _classPrivateMethodInitSpec(this, _onAfterViewportColumnCalculatorOverride);
202
- /**
203
- * `afterViewportRowCalculatorOverride` hook callback.
204
- *
205
- * @param {object} calc The row calculator object.
206
- */
207
- _classPrivateMethodInitSpec(this, _onAfterViewportRowCalculatorOverride);
208
- /**
209
- * The `afterGetCellMeta` hook callback.
210
- *
211
- * @param {number} row Row index.
212
- * @param {number} col Column index.
213
- * @param {object} cellProperties The cell properties object.
214
- */
215
- _classPrivateMethodInitSpec(this, _onAfterGetCellMeta);
216
- /**
217
- * `beforeSetRangeEnd` hook callback.
218
- * While selecting cells with keyboard or mouse, make sure that rectangular area is expanded to the extent of the
219
- * merged cell.
220
- *
221
- * Note: Please keep in mind that callback may modify both start and end range coordinates by the reference.
222
- *
223
- * @param {object} coords Cell coords.
224
- */
225
- _classPrivateMethodInitSpec(this, _onBeforeSetRangeEnd);
226
- /**
227
- * `beforeSetRangeStart` and `beforeSetRangeStartOnly` hook callback.
228
- * A selection within merge area should be rewritten to the start of merge area.
229
- *
230
- * @param {object} coords Cell coords.
231
- */
232
- _classPrivateMethodInitSpec(this, _onBeforeSetRangeStart);
233
- /**
234
- * `afterRenderer` hook callback.
235
- *
236
- * @param {HTMLElement} TD The cell to be modified.
237
- * @param {number} row Row index.
238
- * @param {number} col Visual column index.
239
- */
240
- _classPrivateMethodInitSpec(this, _onAfterRenderer);
241
- /**
242
- * `afterContextMenuDefaultOptions` hook callback.
243
- *
244
- * @param {object} defaultOptions The default context menu options.
245
- */
246
- _classPrivateMethodInitSpec(this, _addMergeActionsToContextMenu);
247
- /**
248
- * `modifyGetCellCoords` hook callback. Swaps the `getCell` coords with the merged parent coords.
249
- *
250
- * @param {number} row Row index.
251
- * @param {number} column Visual column index.
252
- * @returns {Array|undefined} Visual coordinates of the merge.
253
- */
254
- _classPrivateMethodInitSpec(this, _onModifyGetCellCoords);
255
- /**
256
- * `modifyTransformEnd` hook callback. Needed to handle "jumping over" merged merged cells, while selecting.
257
- *
258
- * @param {object} delta The transformation delta.
259
- */
260
- _classPrivateMethodInitSpec(this, _onModifyTransformEnd);
261
- /**
262
- * `modifyTransformStart` hook callback.
263
- *
264
- * @param {object} delta The transformation delta.
265
- */
266
- _classPrivateMethodInitSpec(this, _onModifyTransformStart);
267
- /**
268
- * Modifies the information on whether the current selection contains multiple cells. The `afterIsMultipleSelection`
269
- * hook callback.
270
- *
271
- * @param {boolean} isMultiple Determines whether the current selection contains multiple cells.
272
- * @returns {boolean}
273
- */
274
- _classPrivateMethodInitSpec(this, _onAfterIsMultipleSelection);
275
83
  /**
276
84
  * `afterInit` hook callback.
277
85
  */
278
- _classPrivateMethodInitSpec(this, _onAfterInit);
86
+ _classPrivateMethodInitSpec(this, _MergeCells_brand);
279
87
  /**
280
88
  * A container for all the merged cells.
281
89
  *
@@ -298,12 +106,32 @@ class MergeCells extends _base.BasePlugin {
298
106
  */
299
107
  _defineProperty(this, "selectionCalculations", null);
300
108
  /**
109
+ * The holder for the last selected focus coordinates. This allows keeping the correct coordinates in cases after the
110
+ * focus is moved out of the merged cell.
111
+ *
301
112
  * @type {CellCoords}
302
113
  */
303
- _classPrivateFieldInitSpec(this, _lastDesiredCoords, {
304
- writable: true,
305
- value: null
114
+ _classPrivateFieldInitSpec(this, _lastSelectedFocus, null);
115
+ /**
116
+ * The last used transformation delta.
117
+ *
118
+ * @type {{ row: number, col: number }}
119
+ */
120
+ _classPrivateFieldInitSpec(this, _lastFocusDelta, {
121
+ row: 0,
122
+ col: 0
306
123
  });
124
+ /**
125
+ * The module responsible for providing the correct focus order (vertical and horizontal) within a selection that
126
+ * contains merged cells.
127
+ *
128
+ * @type {FocusOrder}
129
+ */
130
+ _classPrivateFieldInitSpec(this, _focusOrder, new _focusOrder2.FocusOrder({
131
+ mergedCellsGetter: (row, column) => this.mergedCellsCollection.get(row, column),
132
+ rowIndexMapper: this.hot.rowIndexMapper,
133
+ columnIndexMapper: this.hot.columnIndexMapper
134
+ }));
307
135
  }
308
136
  static get PLUGIN_KEY() {
309
137
  return PLUGIN_KEY;
@@ -336,145 +164,163 @@ class MergeCells extends _base.BasePlugin {
336
164
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
337
165
  args[_key] = arguments[_key];
338
166
  }
339
- return _classPrivateMethodGet(_this, _onAfterInit, _onAfterInit2).call(_this, ...args);
167
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterInit).call(_this, ...args);
340
168
  });
341
- this.addHook('modifyTransformStart', function () {
169
+ this.addHook('modifyTransformFocus', function () {
342
170
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
343
171
  args[_key2] = arguments[_key2];
344
172
  }
345
- return _classPrivateMethodGet(_this, _onModifyTransformStart, _onModifyTransformStart2).call(_this, ...args);
173
+ return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformFocus).call(_this, ...args);
346
174
  });
347
- this.addHook('afterModifyTransformStart', function () {
175
+ this.addHook('modifyTransformStart', function () {
348
176
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
349
177
  args[_key3] = arguments[_key3];
350
178
  }
351
- return _classPrivateMethodGet(_this, _onAfterModifyTransformStart, _onAfterModifyTransformStart2).call(_this, ...args);
179
+ return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformStart).call(_this, ...args);
352
180
  });
353
181
  this.addHook('modifyTransformEnd', function () {
354
182
  for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
355
183
  args[_key4] = arguments[_key4];
356
184
  }
357
- return _classPrivateMethodGet(_this, _onModifyTransformEnd, _onModifyTransformEnd2).call(_this, ...args);
185
+ return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformEnd).call(_this, ...args);
358
186
  });
359
- this.addHook('modifyGetCellCoords', function () {
187
+ this.addHook('beforeSelectionHighlightSet', function () {
360
188
  for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
361
189
  args[_key5] = arguments[_key5];
362
190
  }
363
- return _classPrivateMethodGet(_this, _onModifyGetCellCoords, _onModifyGetCellCoords2).call(_this, ...args);
191
+ return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSelectionHighlightSet).call(_this, ...args);
364
192
  });
365
193
  this.addHook('beforeSetRangeStart', function () {
366
194
  for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
367
195
  args[_key6] = arguments[_key6];
368
196
  }
369
- return _classPrivateMethodGet(_this, _onBeforeSetRangeStart, _onBeforeSetRangeStart2).call(_this, ...args);
197
+ return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSetRangeStart).call(_this, ...args);
370
198
  });
371
199
  this.addHook('beforeSetRangeStartOnly', function () {
372
200
  for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
373
201
  args[_key7] = arguments[_key7];
374
202
  }
375
- return _classPrivateMethodGet(_this, _onBeforeSetRangeStart, _onBeforeSetRangeStart2).call(_this, ...args);
203
+ return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSetRangeStart).call(_this, ...args);
376
204
  });
377
- this.addHook('beforeSetRangeEnd', function () {
205
+ this.addHook('beforeSelectionFocusSet', function () {
378
206
  for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
379
207
  args[_key8] = arguments[_key8];
380
208
  }
381
- return _classPrivateMethodGet(_this, _onBeforeSetRangeEnd, _onBeforeSetRangeEnd2).call(_this, ...args);
209
+ return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSelectionFocusSet).call(_this, ...args);
382
210
  });
383
- this.addHook('afterIsMultipleSelection', function () {
211
+ this.addHook('afterSelectionFocusSet', function () {
384
212
  for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
385
213
  args[_key9] = arguments[_key9];
386
214
  }
387
- return _classPrivateMethodGet(_this, _onAfterIsMultipleSelection, _onAfterIsMultipleSelection2).call(_this, ...args);
215
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterSelectionFocusSet).call(_this, ...args);
388
216
  });
389
- this.addHook('afterRenderer', function () {
217
+ this.addHook('afterSelectionEnd', function () {
390
218
  for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
391
219
  args[_key10] = arguments[_key10];
392
220
  }
393
- return _classPrivateMethodGet(_this, _onAfterRenderer, _onAfterRenderer2).call(_this, ...args);
221
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterSelectionEnd).call(_this, ...args);
394
222
  });
395
- this.addHook('afterContextMenuDefaultOptions', function () {
223
+ this.addHook('modifyGetCellCoords', function () {
396
224
  for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
397
225
  args[_key11] = arguments[_key11];
398
226
  }
399
- return _classPrivateMethodGet(_this, _addMergeActionsToContextMenu, _addMergeActionsToContextMenu2).call(_this, ...args);
227
+ return _assertClassBrand(_MergeCells_brand, _this, _onModifyGetCellCoords).call(_this, ...args);
400
228
  });
401
- this.addHook('afterGetCellMeta', function () {
229
+ this.addHook('afterIsMultipleSelection', function () {
402
230
  for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
403
231
  args[_key12] = arguments[_key12];
404
232
  }
405
- return _classPrivateMethodGet(_this, _onAfterGetCellMeta, _onAfterGetCellMeta2).call(_this, ...args);
233
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterIsMultipleSelection).call(_this, ...args);
406
234
  });
407
- this.addHook('afterViewportRowCalculatorOverride', function () {
235
+ this.addHook('afterRenderer', function () {
408
236
  for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
409
237
  args[_key13] = arguments[_key13];
410
238
  }
411
- return _classPrivateMethodGet(_this, _onAfterViewportRowCalculatorOverride, _onAfterViewportRowCalculatorOverride2).call(_this, ...args);
239
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterRenderer).call(_this, ...args);
412
240
  });
413
- this.addHook('afterViewportColumnCalculatorOverride', function () {
241
+ this.addHook('afterContextMenuDefaultOptions', function () {
414
242
  for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
415
243
  args[_key14] = arguments[_key14];
416
244
  }
417
- return _classPrivateMethodGet(_this, _onAfterViewportColumnCalculatorOverride, _onAfterViewportColumnCalculatorOverride2).call(_this, ...args);
245
+ return _assertClassBrand(_MergeCells_brand, _this, _addMergeActionsToContextMenu).call(_this, ...args);
418
246
  });
419
- this.addHook('modifyAutofillRange', function () {
247
+ this.addHook('afterGetCellMeta', function () {
420
248
  for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
421
249
  args[_key15] = arguments[_key15];
422
250
  }
423
- return _classPrivateMethodGet(_this, _onModifyAutofillRange, _onModifyAutofillRange2).call(_this, ...args);
251
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterGetCellMeta).call(_this, ...args);
424
252
  });
425
- this.addHook('afterCreateCol', function () {
253
+ this.addHook('afterViewportRowCalculatorOverride', function () {
426
254
  for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {
427
255
  args[_key16] = arguments[_key16];
428
256
  }
429
- return _classPrivateMethodGet(_this, _onAfterCreateCol, _onAfterCreateCol2).call(_this, ...args);
257
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterViewportRowCalculatorOverride).call(_this, ...args);
430
258
  });
431
- this.addHook('afterRemoveCol', function () {
259
+ this.addHook('afterViewportColumnCalculatorOverride', function () {
432
260
  for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {
433
261
  args[_key17] = arguments[_key17];
434
262
  }
435
- return _classPrivateMethodGet(_this, _onAfterRemoveCol, _onAfterRemoveCol2).call(_this, ...args);
263
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterViewportColumnCalculatorOverride).call(_this, ...args);
436
264
  });
437
- this.addHook('afterCreateRow', function () {
265
+ this.addHook('modifyAutofillRange', function () {
438
266
  for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {
439
267
  args[_key18] = arguments[_key18];
440
268
  }
441
- return _classPrivateMethodGet(_this, _onAfterCreateRow, _onAfterCreateRow2).call(_this, ...args);
269
+ return _assertClassBrand(_MergeCells_brand, _this, _onModifyAutofillRange).call(_this, ...args);
442
270
  });
443
- this.addHook('afterRemoveRow', function () {
271
+ this.addHook('afterCreateCol', function () {
444
272
  for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {
445
273
  args[_key19] = arguments[_key19];
446
274
  }
447
- return _classPrivateMethodGet(_this, _onAfterRemoveRow, _onAfterRemoveRow2).call(_this, ...args);
275
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterCreateCol).call(_this, ...args);
448
276
  });
449
- this.addHook('afterChange', function () {
277
+ this.addHook('afterRemoveCol', function () {
450
278
  for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {
451
279
  args[_key20] = arguments[_key20];
452
280
  }
453
- return _classPrivateMethodGet(_this, _onAfterChange, _onAfterChange2).call(_this, ...args);
281
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterRemoveCol).call(_this, ...args);
454
282
  });
455
- this.addHook('beforeDrawBorders', function () {
283
+ this.addHook('afterCreateRow', function () {
456
284
  for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {
457
285
  args[_key21] = arguments[_key21];
458
286
  }
459
- return _classPrivateMethodGet(_this, _onBeforeDrawAreaBorders, _onBeforeDrawAreaBorders2).call(_this, ...args);
287
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterCreateRow).call(_this, ...args);
460
288
  });
461
- this.addHook('afterDrawSelection', function () {
289
+ this.addHook('afterRemoveRow', function () {
462
290
  for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {
463
291
  args[_key22] = arguments[_key22];
464
292
  }
465
- return _classPrivateMethodGet(_this, _onAfterDrawSelection, _onAfterDrawSelection2).call(_this, ...args);
293
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterRemoveRow).call(_this, ...args);
466
294
  });
467
- this.addHook('beforeRemoveCellClassNames', function () {
295
+ this.addHook('afterChange', function () {
468
296
  for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {
469
297
  args[_key23] = arguments[_key23];
470
298
  }
471
- return _classPrivateMethodGet(_this, _onBeforeRemoveCellClassNames, _onBeforeRemoveCellClassNames2).call(_this, ...args);
299
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterChange).call(_this, ...args);
472
300
  });
473
- this.addHook('beforeBeginEditing', function () {
301
+ this.addHook('beforeDrawBorders', function () {
474
302
  for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {
475
303
  args[_key24] = arguments[_key24];
476
304
  }
477
- return _classPrivateMethodGet(_this, _onBeforeBeginEditing, _onBeforeBeginEditing2).call(_this, ...args);
305
+ return _assertClassBrand(_MergeCells_brand, _this, _onBeforeDrawAreaBorders).call(_this, ...args);
306
+ });
307
+ this.addHook('afterDrawSelection', function () {
308
+ for (var _len25 = arguments.length, args = new Array(_len25), _key25 = 0; _key25 < _len25; _key25++) {
309
+ args[_key25] = arguments[_key25];
310
+ }
311
+ return _assertClassBrand(_MergeCells_brand, _this, _onAfterDrawSelection).call(_this, ...args);
312
+ });
313
+ this.addHook('beforeRemoveCellClassNames', function () {
314
+ for (var _len26 = arguments.length, args = new Array(_len26), _key26 = 0; _key26 < _len26; _key26++) {
315
+ args[_key26] = arguments[_key26];
316
+ }
317
+ return _assertClassBrand(_MergeCells_brand, _this, _onBeforeRemoveCellClassNames).call(_this, ...args);
318
+ });
319
+ this.addHook('beforeBeginEditing', function () {
320
+ for (var _len27 = arguments.length, args = new Array(_len27), _key27 = 0; _key27 < _len27; _key27++) {
321
+ args[_key27] = arguments[_key27];
322
+ }
323
+ return _assertClassBrand(_MergeCells_brand, _this, _onBeforeBeginEditing).call(_this, ...args);
478
324
  });
479
325
  this.addHook('beforeUndoStackChange', (action, source) => {
480
326
  if (source === 'MergeCells') {
@@ -618,7 +464,9 @@ class MergeCells extends _base.BasePlugin {
618
464
  if (populatedNulls.length === 0) {
619
465
  return;
620
466
  }
621
- this.hot.setDataAtCell(populatedNulls);
467
+
468
+ // TODO: Change the `source` argument to a more meaningful value, e.g. `${this.pluginName}.clearCells`.
469
+ this.hot.setDataAtCell(populatedNulls, undefined, undefined, this.pluginName);
622
470
  }
623
471
  }
624
472
 
@@ -642,25 +490,6 @@ class MergeCells extends _base.BasePlugin {
642
490
  return auto ? true : this.validateSetting(newMergedCellInfo);
643
491
  }
644
492
 
645
- /**
646
- * Merge or unmerge, based on last selected range.
647
- *
648
- * @private
649
- */
650
- toggleMergeOnSelection() {
651
- const currentRange = this.hot.getSelectedRangeLast();
652
- if (!currentRange) {
653
- return;
654
- }
655
- currentRange.setDirection(this.hot.isRtl() ? 'NE-SW' : 'NW-SE');
656
- const {
657
- from,
658
- to
659
- } = currentRange;
660
- this.toggleMerge(currentRange);
661
- this.hot.selectCell(from.row, from.col, to.row, to.col, false);
662
- }
663
-
664
493
  /**
665
494
  * Merges the selection provided as a cell range.
666
495
  *
@@ -749,6 +578,7 @@ class MergeCells extends _base.BasePlugin {
749
578
  if (preventPopulation) {
750
579
  populationInfo = [mergeParent.row, mergeParent.col, clearedData];
751
580
  } else {
581
+ // TODO: Change the `source` argument to a more meaningful value, e.g. `${this.pluginName}.clearCells`.
752
582
  this.hot.populateFromArray(mergeParent.row, mergeParent.col, clearedData, undefined, undefined, this.pluginName);
753
583
  }
754
584
  if (!auto) {
@@ -871,6 +701,15 @@ class MergeCells extends _base.BasePlugin {
871
701
  const gridContext = shortcutManager.getContext('grid');
872
702
  gridContext.removeShortcutsByGroup(SHORTCUTS_GROUP);
873
703
  }
704
+
705
+ /**
706
+ * Modifies the information on whether the current selection contains multiple cells. The `afterIsMultipleSelection`
707
+ * hook callback.
708
+ *
709
+ * @param {boolean} isMultiple Determines whether the current selection contains multiple cells.
710
+ * @returns {boolean}
711
+ */
712
+
874
713
  /**
875
714
  * Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.
876
715
  *
@@ -927,6 +766,13 @@ class MergeCells extends _base.BasePlugin {
927
766
  }
928
767
  }
929
768
  }
769
+
770
+ /**
771
+ * `afterViewportColumnCalculatorOverride` hook callback.
772
+ *
773
+ * @param {object} calc The column calculator object.
774
+ */
775
+
930
776
  /**
931
777
  * Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.
932
778
  *
@@ -1021,96 +867,218 @@ class MergeCells extends _base.BasePlugin {
1021
867
  const renderableColumn = parentColumn >= 0 ? columnMapper.getRenderableFromVisualIndex(firstNonHiddenColumn) : parentColumn;
1022
868
  return [renderableRow, renderableColumn];
1023
869
  }
870
+
871
+ /**
872
+ * The `modifyAutofillRange` hook callback.
873
+ *
874
+ * @param {Array} drag The drag area coordinates.
875
+ * @param {Array} select The selection information.
876
+ * @returns {Array} The new drag area.
877
+ */
1024
878
  }
1025
879
  exports.MergeCells = MergeCells;
1026
- function _onAfterInit2() {
880
+ function _onAfterInit() {
1027
881
  this.generateFromSettings(this.hot.getSettings()[PLUGIN_KEY]);
1028
882
  this.hot.render();
1029
883
  }
1030
- function _onAfterIsMultipleSelection2(isMultiple) {
884
+ function _onAfterIsMultipleSelection(isMultiple) {
1031
885
  if (isMultiple) {
1032
886
  const mergedCells = this.mergedCellsCollection.mergedCells;
1033
887
  const selectionRange = this.hot.getSelectedRangeLast();
888
+ const topStartCoords = selectionRange.getTopStartCorner();
889
+ const bottomEndCoords = selectionRange.getBottomEndCorner();
1034
890
  for (let group = 0; group < mergedCells.length; group += 1) {
1035
- 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) {
891
+ 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) {
1036
892
  return false;
1037
893
  }
1038
894
  }
1039
895
  }
1040
896
  return isMultiple;
1041
897
  }
1042
- function _onModifyTransformStart2(delta) {
1043
- const currentlySelectedRange = this.hot.getSelectedRangeLast();
1044
- let newDelta = {
1045
- row: delta.row,
1046
- col: delta.col
898
+ /**
899
+ * `modifyTransformFocus` hook callback.
900
+ *
901
+ * @param {object} delta The transformation delta.
902
+ */
903
+ function _onModifyTransformFocus(delta) {
904
+ _classPrivateFieldGet(_lastFocusDelta, this).row = delta.row;
905
+ _classPrivateFieldGet(_lastFocusDelta, this).col = delta.col;
906
+ }
907
+ /**
908
+ * `modifyTransformStart` hook callback.
909
+ *
910
+ * @param {object} delta The transformation delta.
911
+ */
912
+ function _onModifyTransformStart(delta) {
913
+ const selectedRange = this.hot.getSelectedRangeLast();
914
+ const {
915
+ highlight
916
+ } = selectedRange;
917
+ const {
918
+ columnIndexMapper,
919
+ rowIndexMapper
920
+ } = this.hot;
921
+ if (_classPrivateFieldGet(_lastSelectedFocus, this)) {
922
+ if (rowIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(_lastSelectedFocus, this).row) !== null) {
923
+ highlight.row = _classPrivateFieldGet(_lastSelectedFocus, this).row;
924
+ }
925
+ if (columnIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(_lastSelectedFocus, this).col) !== null) {
926
+ highlight.col = _classPrivateFieldGet(_lastSelectedFocus, this).col;
927
+ }
928
+ _classPrivateFieldSet(_lastSelectedFocus, this, null);
929
+ }
930
+ const mergedParent = this.mergedCellsCollection.get(highlight.row, highlight.col);
931
+ if (!mergedParent) {
932
+ return;
933
+ }
934
+ const visualColumnIndexStart = mergedParent.col;
935
+ const visualColumnIndexEnd = mergedParent.col + mergedParent.colspan - 1;
936
+ if (delta.col < 0) {
937
+ const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexStart - 1 : visualColumnIndexEnd;
938
+ const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
939
+ if (notHiddenColumnIndex === null) {
940
+ // There are no visible columns anymore, so move the selection out of the table edge. This will
941
+ // be processed by the selection Transformer class as a move selection to the previous row (if autoWrapRow is enabled).
942
+ delta.col = -this.hot.view.countRenderableColumnsInRange(0, highlight.col);
943
+ } else {
944
+ delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1, 1);
945
+ }
946
+ } else if (delta.col > 0) {
947
+ const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexEnd + 1 : visualColumnIndexStart;
948
+ const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
949
+ if (notHiddenColumnIndex === null) {
950
+ // There are no visible columns anymore, so move the selection out of the table edge. This will
951
+ // be processed by the selection Transformer class as a move selection to the next row (if autoWrapRow is enabled).
952
+ delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, this.hot.countCols());
953
+ } else {
954
+ delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1, 1);
955
+ }
956
+ }
957
+ const visualRowIndexStart = mergedParent.row;
958
+ const visualRowIndexEnd = mergedParent.row + mergedParent.rowspan - 1;
959
+ if (delta.row < 0) {
960
+ const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexStart - 1 : visualRowIndexEnd;
961
+ const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, -1);
962
+ if (notHiddenRowIndex === null) {
963
+ // There are no visible rows anymore, so move the selection out of the table edge. This will
964
+ // be processed by the selection Transformer class as a move selection to the previous column (if autoWrapCol is enabled).
965
+ delta.row = -this.hot.view.countRenderableRowsInRange(0, highlight.row);
966
+ } else {
967
+ delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, highlight.row) - 1, 1);
968
+ }
969
+ } else if (delta.row > 0) {
970
+ const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexEnd + 1 : visualRowIndexStart;
971
+ const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, 1);
972
+ if (notHiddenRowIndex === null) {
973
+ // There are no visible rows anymore, so move the selection out of the table edge. This will
974
+ // be processed by the selection Transformer class as a move selection to the next column (if autoWrapCol is enabled).
975
+ delta.row = this.hot.view.countRenderableRowsInRange(highlight.row, this.hot.countRows());
976
+ } else {
977
+ delta.row = Math.max(this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowIndex) - 1, 1);
978
+ }
979
+ }
980
+ }
981
+ /**
982
+ * The hook allows to modify the delta transformation object necessary for correct selection end transformations.
983
+ * The logic here handles "jumping over" merged merged cells, while selecting.
984
+ *
985
+ * @param {{ row: number, col: number }} delta The transformation delta.
986
+ */
987
+ function _onModifyTransformEnd(delta) {
988
+ const selectedRange = this.hot.getSelectedRangeLast();
989
+ const cloneRange = selectedRange.clone();
990
+ const {
991
+ to
992
+ } = selectedRange;
993
+ const {
994
+ columnIndexMapper,
995
+ rowIndexMapper
996
+ } = this.hot;
997
+ const expandCloneRange = (row, col) => {
998
+ cloneRange.expand(this.hot._createCellCoords(row, col));
999
+ for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
1000
+ cloneRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange());
1001
+ }
1047
1002
  };
1048
- let nextPosition = null;
1049
- const currentPosition = this.hot._createCellCoords(currentlySelectedRange.highlight.row, currentlySelectedRange.highlight.col);
1050
- const mergedParent = this.mergedCellsCollection.get(currentPosition.row, currentPosition.col);
1051
- if (!_classPrivateFieldGet(this, _lastDesiredCoords)) {
1052
- _classPrivateFieldSet(this, _lastDesiredCoords, this.hot._createCellCoords(null, null));
1003
+ if (delta.col < 0) {
1004
+ let nextColumn = this.mergedCellsCollection.getStartMostColumnIndex(selectedRange, to.col) + delta.col;
1005
+ expandCloneRange(to.row, nextColumn);
1006
+ if (selectedRange.getHorizontalDirection() === 'E-W' && cloneRange.getHorizontalDirection() === 'E-W') {
1007
+ nextColumn = cloneRange.getTopStartCorner().col;
1008
+ }
1009
+ const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
1010
+ if (notHiddenColumnIndex !== null) {
1011
+ delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, to.col) - 1, 1);
1012
+ }
1013
+ } else if (delta.col > 0) {
1014
+ let nextColumn = this.mergedCellsCollection.getEndMostColumnIndex(selectedRange, to.col) + delta.col;
1015
+ expandCloneRange(to.row, nextColumn);
1016
+ if (selectedRange.getHorizontalDirection() === 'W-E' && cloneRange.getHorizontalDirection() === 'W-E') {
1017
+ nextColumn = cloneRange.getBottomEndCorner().col;
1018
+ }
1019
+ const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
1020
+ if (notHiddenColumnIndex !== null) {
1021
+ delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(to.col, notHiddenColumnIndex) - 1, 1);
1022
+ }
1053
1023
  }
1054
- if (mergedParent) {
1055
- // only merge selected
1056
- const mergeTopLeft = this.hot._createCellCoords(mergedParent.row, mergedParent.col);
1057
- const mergeBottomRight = this.hot._createCellCoords(mergedParent.row + mergedParent.rowspan - 1, mergedParent.col + mergedParent.colspan - 1);
1058
- const mergeRange = this.hot._createCellRange(mergeTopLeft, mergeTopLeft, mergeBottomRight);
1059
- if (!mergeRange.includes(_classPrivateFieldGet(this, _lastDesiredCoords))) {
1060
- _classPrivateFieldSet(this, _lastDesiredCoords, this.hot._createCellCoords(null, null)); // reset outdated version of lastDesiredCoords
1024
+ if (delta.row < 0) {
1025
+ let nextRow = this.mergedCellsCollection.getTopMostRowIndex(selectedRange, to.row) + delta.row;
1026
+ expandCloneRange(nextRow, to.col);
1027
+ if (selectedRange.getVerticalDirection() === 'S-N' && cloneRange.getVerticalDirection() === 'S-N') {
1028
+ nextRow = cloneRange.getTopStartCorner().row;
1061
1029
  }
1062
- newDelta.row = _classPrivateFieldGet(this, _lastDesiredCoords).row ? _classPrivateFieldGet(this, _lastDesiredCoords).row - currentPosition.row : newDelta.row;
1063
- newDelta.col = _classPrivateFieldGet(this, _lastDesiredCoords).col ? _classPrivateFieldGet(this, _lastDesiredCoords).col - currentPosition.col : newDelta.col;
1064
- if (delta.row > 0) {
1065
- // moving down
1066
- newDelta.row = mergedParent.row + mergedParent.rowspan - 1 - currentPosition.row + delta.row;
1067
- } else if (delta.row < 0) {
1068
- // moving up
1069
- newDelta.row = currentPosition.row - mergedParent.row + delta.row;
1030
+ const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, 1);
1031
+ if (notHiddenRowIndex !== null) {
1032
+ delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, to.row) - 1, 1);
1070
1033
  }
1071
- if (delta.col > 0) {
1072
- // moving right
1073
- newDelta.col = mergedParent.col + mergedParent.colspan - 1 - currentPosition.col + delta.col;
1074
- } else if (delta.col < 0) {
1075
- // moving left
1076
- newDelta.col = currentPosition.col - mergedParent.col + delta.col;
1034
+ } else if (delta.row > 0) {
1035
+ let nextRow = this.mergedCellsCollection.getBottomMostRowIndex(selectedRange, to.row) + delta.row;
1036
+ expandCloneRange(nextRow, to.col);
1037
+ if (selectedRange.getVerticalDirection() === 'N-S' && cloneRange.getVerticalDirection() === 'N-S') {
1038
+ nextRow = cloneRange.getBottomStartCorner().row;
1039
+ }
1040
+ const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, -1);
1041
+ if (notHiddenRowIndex !== null) {
1042
+ delta.row = Math.max(this.hot.view.countRenderableRowsInRange(to.row, notHiddenRowIndex) - 1, 1);
1077
1043
  }
1078
1044
  }
1079
- nextPosition = this.hot._createCellCoords(currentlySelectedRange.highlight.row + newDelta.row, currentlySelectedRange.highlight.col + newDelta.col);
1080
- const nextPositionMergedCell = this.mergedCellsCollection.get(nextPosition.row, nextPosition.col);
1081
- if (nextPositionMergedCell) {
1082
- // skipping the invisible cells in the merge range
1083
- const firstRenderableCoords = this.mergedCellsCollection.getFirstRenderableCoords(nextPositionMergedCell.row, nextPositionMergedCell.col);
1084
- _classPrivateFieldSet(this, _lastDesiredCoords, nextPosition);
1085
- newDelta = {
1086
- row: firstRenderableCoords.row - currentPosition.row,
1087
- col: firstRenderableCoords.col - currentPosition.col
1088
- };
1045
+ }
1046
+ /**
1047
+ * The hook corrects the range (before drawing it) after the selection was made on the merged cells.
1048
+ * It expands the range to cover the entire area of the selected merged cells.
1049
+ */
1050
+ function _onBeforeSelectionHighlightSet() {
1051
+ const selectedRange = this.hot.getSelectedRangeLast();
1052
+ const {
1053
+ highlight
1054
+ } = selectedRange;
1055
+ if (this.hot.selection.isSelectedByColumnHeader() || this.hot.selection.isSelectedByRowHeader()) {
1056
+ _classPrivateFieldSet(_lastSelectedFocus, this, highlight.clone());
1057
+ return;
1089
1058
  }
1090
- if (newDelta.row !== 0) {
1091
- delta.row = newDelta.row;
1059
+ for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
1060
+ selectedRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange(), false);
1092
1061
  }
1093
- if (newDelta.col !== 0) {
1094
- delta.col = newDelta.col;
1062
+ // TODO: This is a workaround for an issue with the selection not being extended properly.
1063
+ // In some cases when the merge cells are defined in random order the selection is not
1064
+ // extended in that way that it covers all overlapped merge cells.
1065
+ for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
1066
+ selectedRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange(), false);
1067
+ }
1068
+ const mergedParent = this.mergedCellsCollection.get(highlight.row, highlight.col);
1069
+ _classPrivateFieldSet(_lastSelectedFocus, this, highlight.clone());
1070
+ if (mergedParent) {
1071
+ highlight.assign(mergedParent);
1095
1072
  }
1096
1073
  }
1097
- function _onModifyTransformEnd2(delta) {
1098
- const currentSelectionRange = this.hot.getSelectedRangeLast();
1099
- const newDelta = (0, _object.clone)(delta);
1100
- const newSelectionRange = this.selectionCalculations.getUpdatedSelectionRange(currentSelectionRange, delta);
1101
- let tempDelta = (0, _object.clone)(newDelta);
1102
- const mergedCellsWithinRange = this.mergedCellsCollection.getWithinRange(newSelectionRange, true);
1103
- do {
1104
- tempDelta = (0, _object.clone)(newDelta);
1105
- this.selectionCalculations.getUpdatedSelectionRange(currentSelectionRange, newDelta);
1106
- (0, _array.arrayEach)(mergedCellsWithinRange, mergedCell => {
1107
- this.selectionCalculations.snapDelta(newDelta, currentSelectionRange, mergedCell);
1108
- });
1109
- } while (newDelta.row !== tempDelta.row || newDelta.col !== tempDelta.col);
1110
- delta.row = newDelta.row;
1111
- delta.col = newDelta.col;
1112
- }
1113
- function _onModifyGetCellCoords2(row, column) {
1074
+ /**
1075
+ * `modifyGetCellCoords` hook callback. Swaps the `getCell` coords with the merged parent coords.
1076
+ *
1077
+ * @param {number} row Row index.
1078
+ * @param {number} column Visual column index.
1079
+ * @returns {Array|undefined} Visual coordinates of the merge.
1080
+ */
1081
+ function _onModifyGetCellCoords(row, column) {
1114
1082
  if (row < 0 || column < 0) {
1115
1083
  return;
1116
1084
  }
@@ -1130,12 +1098,24 @@ function _onModifyGetCellCoords2(row, column) {
1130
1098
  // Most bottom-right merged cell coords.
1131
1099
  mergeRow + rowspan - 1, mergeColumn + colspan - 1];
1132
1100
  }
1133
- function _addMergeActionsToContextMenu2(defaultOptions) {
1101
+ /**
1102
+ * `afterContextMenuDefaultOptions` hook callback.
1103
+ *
1104
+ * @param {object} defaultOptions The default context menu options.
1105
+ */
1106
+ function _addMergeActionsToContextMenu(defaultOptions) {
1134
1107
  defaultOptions.items.push({
1135
1108
  name: '---------'
1136
1109
  }, (0, _toggleMerge.default)(this));
1137
1110
  }
1138
- function _onAfterRenderer2(TD, row, col) {
1111
+ /**
1112
+ * `afterRenderer` hook callback.
1113
+ *
1114
+ * @param {HTMLElement} TD The cell to be modified.
1115
+ * @param {number} row Row index.
1116
+ * @param {number} col Visual column index.
1117
+ */
1118
+ function _onAfterRenderer(TD, row, col) {
1139
1119
  const mergedCell = this.mergedCellsCollection.get(row, col);
1140
1120
  // We shouldn't override data in the collection.
1141
1121
  const mergedCellCopy = (0, _object.isObject)(mergedCell) ? (0, _object.clone)(mergedCell) : undefined;
@@ -1167,39 +1147,114 @@ function _onAfterRenderer2(TD, row, col) {
1167
1147
  }
1168
1148
  (0, _utils.applySpanProperties)(TD, mergedCellCopy, row, col);
1169
1149
  }
1170
- function _onBeforeSetRangeStart2(coords) {
1171
- // TODO: It is a workaround, but probably this hook may be needed. Every selection on the merge area
1172
- // could set start point of the selection to the start of the merge area. However, logic inside `expandByRange` need
1173
- // an initial start point. Click on the merge cell when there are some hidden indexes break the logic in some cases.
1174
- // Please take a look at #7010 for more information. I'm not sure if selection directions are calculated properly
1175
- // and what was idea for flipping direction inside `expandByRange` method.
1176
- if (this.mergedCellsCollection.isFirstRenderableMergedCell(coords.row, coords.col)) {
1177
- const mergeParent = this.mergedCellsCollection.get(coords.row, coords.col);
1178
- [coords.row, coords.col] = [mergeParent.row, mergeParent.col];
1179
- }
1150
+ /**
1151
+ * Clears the last selected coordinates before setting a new selection range.
1152
+ */
1153
+ function _onBeforeSetRangeStart() {
1154
+ _classPrivateFieldSet(_lastSelectedFocus, this, null);
1180
1155
  }
1181
- function _onBeforeSetRangeEnd2(coords) {
1182
- const selRange = this.hot.getSelectedRangeLast();
1183
- selRange.highlight = this.hot._createCellCoords(selRange.highlight.row, selRange.highlight.col); // clone in case we will modify its reference
1184
- selRange.to = coords;
1185
- let rangeExpanded = false;
1186
- if (this.hot.selection.isSelectedByColumnHeader() || this.hot.selection.isSelectedByRowHeader()) {
1156
+ /**
1157
+ * Detects if the last selected cell was a header cell if so update the order list active node for further
1158
+ * computations.
1159
+ */
1160
+ function _onBeforeSelectionFocusSet() {
1161
+ if (_classPrivateFieldGet(_lastSelectedFocus, this).isCell()) {
1187
1162
  return;
1188
1163
  }
1189
- do {
1190
- rangeExpanded = false;
1191
- for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
1192
- const cellInfo = this.mergedCellsCollection.mergedCells[i];
1193
- const mergedCellRange = cellInfo.getRange();
1194
- if (selRange.expandByRange(mergedCellRange)) {
1195
- coords.row = selRange.to.row;
1196
- coords.col = selRange.to.col;
1197
- rangeExpanded = true;
1198
- }
1164
+ const selectedRange = this.hot.getSelectedRangeLast();
1165
+ const verticalDir = selectedRange.getVerticalDirection();
1166
+ const horizontalDir = selectedRange.getHorizontalDirection();
1167
+ const focusCoords = _classPrivateFieldGet(_lastSelectedFocus, this).clone().normalize();
1168
+ _classPrivateFieldGet(_focusOrder, this).setActiveNode(focusCoords.row, focusCoords.col);
1169
+ if (_classPrivateFieldGet(_lastFocusDelta, this).row > 0 || _classPrivateFieldGet(_lastFocusDelta, this).col > 0) {
1170
+ _classPrivateFieldGet(_focusOrder, this).setPrevNodeAsActive();
1171
+ } else if (horizontalDir === 'E-W' && _classPrivateFieldGet(_lastFocusDelta, this).col < 0 || verticalDir === 'S-N' && _classPrivateFieldGet(_lastFocusDelta, this).row < 0) {
1172
+ _classPrivateFieldGet(_focusOrder, this).setNextNodeAsActive();
1173
+ }
1174
+ }
1175
+ /**
1176
+ * Changes the focus selection to the next or previous cell or merged cell position.
1177
+ *
1178
+ * @param {number} row The visual row index.
1179
+ * @param {number} column The visual column index.
1180
+ */
1181
+ function _onAfterSelectionFocusSet(row, column) {
1182
+ const selectedRange = this.hot.getSelectedRangeLast();
1183
+ const {
1184
+ columnIndexMapper,
1185
+ rowIndexMapper
1186
+ } = this.hot;
1187
+ let notHiddenRowIndex = null;
1188
+ let notHiddenColumnIndex = null;
1189
+ if (_classPrivateFieldGet(_lastFocusDelta, this).col < 0) {
1190
+ const {
1191
+ rowEnd,
1192
+ colEnd
1193
+ } = _classPrivateFieldGet(_focusOrder, this).getPrevHorizontalNode();
1194
+ notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colEnd, -1);
1195
+ notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowEnd, -1);
1196
+ } else if (_classPrivateFieldGet(_lastFocusDelta, this).col > 0) {
1197
+ const {
1198
+ rowStart,
1199
+ colStart
1200
+ } = _classPrivateFieldGet(_focusOrder, this).getNextHorizontalNode();
1201
+ notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);
1202
+ notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);
1203
+ } else if (_classPrivateFieldGet(_lastFocusDelta, this).row < 0) {
1204
+ const {
1205
+ rowEnd,
1206
+ colEnd
1207
+ } = _classPrivateFieldGet(_focusOrder, this).getPrevVerticalNode();
1208
+ notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colEnd, -1);
1209
+ notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowEnd, -1);
1210
+ } else if (_classPrivateFieldGet(_lastFocusDelta, this).row > 0) {
1211
+ const {
1212
+ rowStart,
1213
+ colStart
1214
+ } = _classPrivateFieldGet(_focusOrder, this).getNextVerticalNode();
1215
+ notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);
1216
+ notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);
1217
+ }
1218
+ if (notHiddenRowIndex !== null || notHiddenColumnIndex !== null) {
1219
+ const coords = this.hot._createCellCoords(notHiddenRowIndex, notHiddenColumnIndex);
1220
+ const mergeParent = this.mergedCellsCollection.get(coords.row, coords.col);
1221
+ const focusHighlight = this.hot.selection.highlight.getFocus();
1222
+ row = coords.row;
1223
+ column = coords.col;
1224
+ if (mergeParent) {
1225
+ selectedRange.highlight.assign({
1226
+ row: this.hot.rowIndexMapper.getNearestNotHiddenIndex(mergeParent.row, 1),
1227
+ col: this.hot.columnIndexMapper.getNearestNotHiddenIndex(mergeParent.col, 1)
1228
+ });
1229
+ } else {
1230
+ selectedRange.highlight.assign(coords);
1199
1231
  }
1200
- } while (rangeExpanded);
1232
+ focusHighlight.clear();
1233
+ focusHighlight.add(coords).commit();
1234
+ }
1235
+ _classPrivateFieldGet(_focusOrder, this).setActiveNode(row, column);
1236
+ _classPrivateFieldSet(_lastFocusDelta, this, {
1237
+ row: 0,
1238
+ col: 0
1239
+ });
1201
1240
  }
1202
- function _onAfterGetCellMeta2(row, col, cellProperties) {
1241
+ /**
1242
+ * Creates the horizontal and vertical cells order matrix (linked lists) for focused cell.
1243
+ */
1244
+ function _onAfterSelectionEnd() {
1245
+ const selection = this.hot.getSelectedRangeLast();
1246
+ if (!selection.isHeader()) {
1247
+ _classPrivateFieldGet(_focusOrder, this).buildFocusOrder(this.hot.getSelectedRangeLast());
1248
+ }
1249
+ }
1250
+ /**
1251
+ * The `afterGetCellMeta` hook callback.
1252
+ *
1253
+ * @param {number} row Row index.
1254
+ * @param {number} col Column index.
1255
+ * @param {object} cellProperties The cell properties object.
1256
+ */
1257
+ function _onAfterGetCellMeta(row, col, cellProperties) {
1203
1258
  const mergeParent = this.mergedCellsCollection.get(row, col);
1204
1259
  if (mergeParent) {
1205
1260
  if (mergeParent.row !== row || mergeParent.col !== col) {
@@ -1210,17 +1265,22 @@ function _onAfterGetCellMeta2(row, col, cellProperties) {
1210
1265
  }
1211
1266
  }
1212
1267
  }
1213
- function _onAfterViewportRowCalculatorOverride2(calc) {
1268
+ /**
1269
+ * `afterViewportRowCalculatorOverride` hook callback.
1270
+ *
1271
+ * @param {object} calc The row calculator object.
1272
+ */
1273
+ function _onAfterViewportRowCalculatorOverride(calc) {
1214
1274
  const nrOfColumns = this.hot.countCols();
1215
1275
  this.modifyViewportRowStart(calc, nrOfColumns);
1216
1276
  this.modifyViewportRowEnd(calc, nrOfColumns);
1217
1277
  }
1218
- function _onAfterViewportColumnCalculatorOverride2(calc) {
1278
+ function _onAfterViewportColumnCalculatorOverride(calc) {
1219
1279
  const nrOfRows = this.hot.countRows();
1220
1280
  this.modifyViewportColumnStart(calc, nrOfRows);
1221
1281
  this.modifyViewportColumnEnd(calc, nrOfRows);
1222
1282
  }
1223
- function _onModifyAutofillRange2(drag, select) {
1283
+ function _onModifyAutofillRange(drag, select) {
1224
1284
  this.autofillCalculations.correctSelectionAreaSize(select);
1225
1285
  const dragDirection = this.autofillCalculations.getDirection(select, drag);
1226
1286
  let dragArea = drag;
@@ -1244,28 +1304,65 @@ function _onModifyAutofillRange2(drag, select) {
1244
1304
  dragArea = this.autofillCalculations.snapDragArea(select, dragArea, dragDirection, mergedCellsWithinSelectionArea);
1245
1305
  return dragArea;
1246
1306
  }
1247
- function _onAfterCreateCol2(column, count) {
1307
+ /**
1308
+ * `afterCreateCol` hook callback.
1309
+ *
1310
+ * @param {number} column Column index.
1311
+ * @param {number} count Number of created columns.
1312
+ */
1313
+ function _onAfterCreateCol(column, count) {
1248
1314
  this.mergedCellsCollection.shiftCollections('right', column, count);
1249
1315
  }
1250
- function _onAfterRemoveCol2(column, count) {
1316
+ /**
1317
+ * `afterRemoveCol` hook callback.
1318
+ *
1319
+ * @param {number} column Column index.
1320
+ * @param {number} count Number of removed columns.
1321
+ */
1322
+ function _onAfterRemoveCol(column, count) {
1251
1323
  this.mergedCellsCollection.shiftCollections('left', column, count);
1252
1324
  }
1253
- function _onAfterCreateRow2(row, count, source) {
1325
+ /**
1326
+ * `afterCreateRow` hook callback.
1327
+ *
1328
+ * @param {number} row Row index.
1329
+ * @param {number} count Number of created rows.
1330
+ * @param {string} source Source of change.
1331
+ */
1332
+ function _onAfterCreateRow(row, count, source) {
1254
1333
  if (source === 'auto') {
1255
1334
  return;
1256
1335
  }
1257
1336
  this.mergedCellsCollection.shiftCollections('down', row, count);
1258
1337
  }
1259
- function _onAfterRemoveRow2(row, count) {
1338
+ /**
1339
+ * `afterRemoveRow` hook callback.
1340
+ *
1341
+ * @param {number} row Row index.
1342
+ * @param {number} count Number of removed rows.
1343
+ */
1344
+ function _onAfterRemoveRow(row, count) {
1260
1345
  this.mergedCellsCollection.shiftCollections('up', row, count);
1261
1346
  }
1262
- function _onAfterChange2(changes, source) {
1347
+ /**
1348
+ * `afterChange` hook callback. Used to propagate merged cells after using Autofill.
1349
+ *
1350
+ * @param {Array} changes The changes array.
1351
+ * @param {string} source Determines the source of the change.
1352
+ */
1353
+ function _onAfterChange(changes, source) {
1263
1354
  if (source !== 'Autofill.fill') {
1264
1355
  return;
1265
1356
  }
1266
1357
  this.autofillCalculations.recreateAfterDataPopulation(changes);
1267
1358
  }
1268
- function _onBeforeDrawAreaBorders2(corners, className) {
1359
+ /**
1360
+ * `beforeDrawAreaBorders` hook callback.
1361
+ *
1362
+ * @param {Array} corners Visual coordinates of the area corners.
1363
+ * @param {string} className Class name for the area.
1364
+ */
1365
+ function _onBeforeDrawAreaBorders(corners, className) {
1269
1366
  if (className && className === 'area') {
1270
1367
  const selectedRange = this.hot.getSelectedRangeLast();
1271
1368
  const mergedCellsWithinRange = this.mergedCellsCollection.getWithinRange(selectedRange);
@@ -1277,38 +1374,43 @@ function _onBeforeDrawAreaBorders2(corners, className) {
1277
1374
  });
1278
1375
  }
1279
1376
  }
1280
- function _onAfterModifyTransformStart2(coords, rowTransformDir, colTransformDir) {
1281
- if (!this.enabled) {
1282
- return;
1283
- }
1284
- const mergedCellAtCoords = this.mergedCellsCollection.get(coords.row, coords.col);
1285
- if (!mergedCellAtCoords) {
1286
- return;
1287
- }
1288
- const goingDown = rowTransformDir > 0;
1289
- const goingUp = rowTransformDir < 0;
1290
- const goingLeft = colTransformDir < 0;
1291
- const goingRight = colTransformDir > 0;
1292
- const mergedCellOnBottomEdge = mergedCellAtCoords.row + mergedCellAtCoords.rowspan - 1 === this.hot.countRows() - 1;
1293
- const mergedCellOnTopEdge = mergedCellAtCoords.row === 0;
1294
- const mergedCellOnRightEdge = mergedCellAtCoords.col + mergedCellAtCoords.colspan - 1 === this.hot.countCols() - 1;
1295
- const mergedCellOnLeftEdge = mergedCellAtCoords.col === 0;
1296
- if (goingDown && mergedCellOnBottomEdge || goingUp && mergedCellOnTopEdge || goingRight && mergedCellOnRightEdge || goingLeft && mergedCellOnLeftEdge) {
1297
- coords.row = mergedCellAtCoords.row;
1298
- coords.col = mergedCellAtCoords.col;
1299
- }
1300
- }
1301
- function _onAfterDrawSelection2(currentRow, currentColumn, cornersOfSelection, layerLevel) {
1377
+ /**
1378
+ * `afterDrawSelection` hook callback. Used to add the additional class name for the entirely-selected merged cells.
1379
+ *
1380
+ * @param {number} currentRow Visual row index of the currently processed cell.
1381
+ * @param {number} currentColumn Visual column index of the currently cell.
1382
+ * @param {Array} cornersOfSelection Array of the current selection in a form of `[startRow, startColumn, endRow,
1383
+ * endColumn]`.
1384
+ * @param {number|undefined} layerLevel Number indicating which layer of selection is currently processed.
1385
+ * @returns {string|undefined} A `String`, which will act as an additional `className` to be added to the currently
1386
+ * processed cell.
1387
+ */
1388
+ function _onAfterDrawSelection(currentRow, currentColumn, cornersOfSelection, layerLevel) {
1302
1389
  // Nothing's selected (hook might be triggered by the custom borders)
1303
1390
  if (!cornersOfSelection) {
1304
1391
  return;
1305
1392
  }
1306
1393
  return this.selectionCalculations.getSelectedMergedCellClassName(currentRow, currentColumn, cornersOfSelection, layerLevel);
1307
1394
  }
1308
- function _onBeforeRemoveCellClassNames2() {
1395
+ /**
1396
+ * `beforeRemoveCellClassNames` hook callback. Used to remove additional class name from all cells in the table.
1397
+ *
1398
+ * @returns {string[]} An `Array` of `String`s. Each of these strings will act like class names to be removed from
1399
+ * all the cells in the table.
1400
+ */
1401
+ function _onBeforeRemoveCellClassNames() {
1309
1402
  return this.selectionCalculations.getSelectedMergedCellClassNameToRemove();
1310
1403
  }
1311
- function _onBeforeBeginEditing2(row, column, initialValue, event) {
1404
+ /**
1405
+ * Allows to prevent opening the editor while more than one merged cell is selected.
1406
+ *
1407
+ * @param {number} row Visual row index of the edited cell.
1408
+ * @param {number} column Visual column index of the edited cell.
1409
+ * @param {string | null} initialValue The initial editor value.
1410
+ * @param {MouseEvent | KeyboardEvent} event The event which was responsible for opening the editor.
1411
+ * @returns {boolean | undefined}
1412
+ */
1413
+ function _onBeforeBeginEditing(row, column, initialValue, event) {
1312
1414
  if (!(event instanceof MouseEvent)) {
1313
1415
  return;
1314
1416
  }