handsontable 14.0.0-next-c080457-20231107 → 14.0.0-next-bfad250-20231108

Sign up to get free protection for your applications and to get access to all the features.
Files changed (327) hide show
  1. package/3rdparty/SheetClip/SheetClip.js +2 -2
  2. package/3rdparty/SheetClip/SheetClip.mjs +2 -2
  3. package/3rdparty/autoResize/autoResize.js +2 -2
  4. package/3rdparty/autoResize/autoResize.mjs +2 -2
  5. package/3rdparty/walkontable/src/calculator/viewportColumns.js +108 -85
  6. package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +108 -85
  7. package/3rdparty/walkontable/src/calculator/viewportRows.js +60 -52
  8. package/3rdparty/walkontable/src/calculator/viewportRows.mjs +60 -52
  9. package/3rdparty/walkontable/src/cell/coords.js +7 -5
  10. package/3rdparty/walkontable/src/cell/coords.mjs +7 -5
  11. package/3rdparty/walkontable/src/core/clone.js +6 -0
  12. package/3rdparty/walkontable/src/core/clone.mjs +6 -0
  13. package/3rdparty/walkontable/src/event.js +125 -74
  14. package/3rdparty/walkontable/src/event.mjs +125 -74
  15. package/3rdparty/walkontable/src/filter/column.js +16 -0
  16. package/3rdparty/walkontable/src/filter/column.mjs +16 -0
  17. package/3rdparty/walkontable/src/filter/row.js +16 -0
  18. package/3rdparty/walkontable/src/filter/row.mjs +16 -0
  19. package/3rdparty/walkontable/src/overlay/bottom.js +1 -1
  20. package/3rdparty/walkontable/src/overlay/bottom.mjs +1 -1
  21. package/3rdparty/walkontable/src/overlay/top.js +1 -1
  22. package/3rdparty/walkontable/src/overlay/top.mjs +1 -1
  23. package/3rdparty/walkontable/src/renderer/_base.js +12 -5
  24. package/3rdparty/walkontable/src/renderer/_base.mjs +12 -5
  25. package/3rdparty/walkontable/src/renderer/cells.js +6 -2
  26. package/3rdparty/walkontable/src/renderer/cells.mjs +6 -2
  27. package/3rdparty/walkontable/src/renderer/rowHeaders.js +6 -2
  28. package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +6 -2
  29. package/3rdparty/walkontable/src/renderer/rows.js +5 -0
  30. package/3rdparty/walkontable/src/renderer/rows.mjs +5 -0
  31. package/3rdparty/walkontable/src/renderer/table.js +24 -17
  32. package/3rdparty/walkontable/src/renderer/table.mjs +24 -17
  33. package/3rdparty/walkontable/src/scroll.js +2 -2
  34. package/3rdparty/walkontable/src/scroll.mjs +2 -2
  35. package/3rdparty/walkontable/src/selection/border/border.js +1 -1
  36. package/3rdparty/walkontable/src/selection/border/border.mjs +1 -1
  37. package/3rdparty/walkontable/src/settings.js +10 -10
  38. package/3rdparty/walkontable/src/settings.mjs +10 -10
  39. package/3rdparty/walkontable/src/table.js +3 -3
  40. package/3rdparty/walkontable/src/table.mjs +3 -3
  41. package/3rdparty/walkontable/src/utils/column.js +19 -4
  42. package/3rdparty/walkontable/src/utils/column.mjs +19 -4
  43. package/3rdparty/walkontable/src/utils/nodesPool.js +5 -0
  44. package/3rdparty/walkontable/src/utils/nodesPool.mjs +5 -0
  45. package/3rdparty/walkontable/src/utils/orderView/view.js +13 -6
  46. package/3rdparty/walkontable/src/utils/orderView/view.mjs +13 -6
  47. package/3rdparty/walkontable/src/utils/orderView/viewSize.js +9 -6
  48. package/3rdparty/walkontable/src/utils/orderView/viewSize.mjs +9 -6
  49. package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.js +7 -4
  50. package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.mjs +7 -4
  51. package/3rdparty/walkontable/src/utils/row.js +14 -2
  52. package/3rdparty/walkontable/src/utils/row.mjs +14 -2
  53. package/3rdparty/walkontable/src/viewport.js +9 -9
  54. package/3rdparty/walkontable/src/viewport.mjs +9 -9
  55. package/base.js +2 -2
  56. package/base.mjs +2 -2
  57. package/core.js +25 -25
  58. package/core.mjs +25 -25
  59. package/dataMap/dataMap.js +99 -90
  60. package/dataMap/dataMap.mjs +99 -90
  61. package/dataMap/dataSource.js +14 -8
  62. package/dataMap/dataSource.mjs +14 -8
  63. package/dataMap/metaManager/lazyFactoryMap.js +19 -7
  64. package/dataMap/metaManager/lazyFactoryMap.mjs +19 -7
  65. package/dataMap/metaManager/metaLayers/cellMeta.js +8 -3
  66. package/dataMap/metaManager/metaLayers/cellMeta.mjs +8 -3
  67. package/dataMap/metaManager/metaLayers/columnMeta.js +7 -1
  68. package/dataMap/metaManager/metaLayers/columnMeta.mjs +7 -1
  69. package/dataMap/metaManager/metaLayers/globalMeta.js +6 -1
  70. package/dataMap/metaManager/metaLayers/globalMeta.mjs +6 -1
  71. package/dataMap/metaManager/metaLayers/tableMeta.js +6 -2
  72. package/dataMap/metaManager/metaLayers/tableMeta.mjs +6 -2
  73. package/dataMap/metaManager/metaSchema.js +55 -55
  74. package/dataMap/metaManager/metaSchema.mjs +55 -55
  75. package/dataMap/metaManager/mods/dynamicCellMeta.js +7 -2
  76. package/dataMap/metaManager/mods/dynamicCellMeta.mjs +7 -2
  77. package/dataMap/metaManager/mods/extendMetaProperties.js +8 -4
  78. package/dataMap/metaManager/mods/extendMetaProperties.mjs +8 -4
  79. package/dataMap/metaManager/utils.js +2 -2
  80. package/dataMap/metaManager/utils.mjs +2 -2
  81. package/dist/handsontable.css +2 -2
  82. package/dist/handsontable.full.css +2 -2
  83. package/dist/handsontable.full.js +7337 -6389
  84. package/dist/handsontable.full.min.css +2 -2
  85. package/dist/handsontable.full.min.js +154 -154
  86. package/dist/handsontable.js +7336 -6388
  87. package/dist/handsontable.min.css +2 -2
  88. package/dist/handsontable.min.js +28 -28
  89. package/editorManager.js +105 -95
  90. package/editorManager.mjs +105 -95
  91. package/editors/autocompleteEditor/autocompleteEditor.js +47 -46
  92. package/editors/autocompleteEditor/autocompleteEditor.mjs +46 -45
  93. package/editors/baseEditor/baseEditor.js +23 -26
  94. package/editors/baseEditor/baseEditor.mjs +23 -26
  95. package/editors/dateEditor/dateEditor.js +24 -15
  96. package/editors/dateEditor/dateEditor.mjs +24 -15
  97. package/editors/dropdownEditor/dropdownEditor.js +1 -1
  98. package/editors/dropdownEditor/dropdownEditor.mjs +1 -1
  99. package/editors/handsontableEditor/handsontableEditor.js +4 -4
  100. package/editors/handsontableEditor/handsontableEditor.mjs +4 -4
  101. package/editors/textEditor/textEditor.js +23 -17
  102. package/editors/textEditor/textEditor.mjs +24 -18
  103. package/eventManager.js +8 -0
  104. package/eventManager.mjs +8 -0
  105. package/helpers/array.js +2 -2
  106. package/helpers/array.mjs +2 -2
  107. package/helpers/dom/element.js +7 -7
  108. package/helpers/dom/element.mjs +7 -7
  109. package/helpers/function.js +1 -1
  110. package/helpers/function.mjs +1 -1
  111. package/helpers/mixed.js +1 -1
  112. package/helpers/mixed.mjs +1 -1
  113. package/helpers/object.js +4 -4
  114. package/helpers/object.mjs +4 -4
  115. package/helpers/string.js +1 -1
  116. package/helpers/string.mjs +1 -1
  117. package/package.json +1 -1
  118. package/pluginHooks.d.ts +0 -2
  119. package/pluginHooks.js +12 -3
  120. package/pluginHooks.mjs +12 -3
  121. package/plugins/autoColumnSize/autoColumnSize.js +141 -130
  122. package/plugins/autoColumnSize/autoColumnSize.mjs +140 -129
  123. package/plugins/autoRowSize/autoRowSize.js +112 -125
  124. package/plugins/autoRowSize/autoRowSize.mjs +110 -123
  125. package/plugins/autofill/autofill.d.ts +0 -1
  126. package/plugins/autofill/autofill.js +98 -102
  127. package/plugins/autofill/autofill.mjs +97 -101
  128. package/plugins/base/base.js +61 -28
  129. package/plugins/base/base.mjs +60 -28
  130. package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +29 -24
  131. package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +28 -23
  132. package/plugins/collapsibleColumns/collapsibleColumns.js +104 -107
  133. package/plugins/collapsibleColumns/collapsibleColumns.mjs +102 -104
  134. package/plugins/columnSorting/columnSorting.js +107 -99
  135. package/plugins/columnSorting/columnSorting.mjs +106 -98
  136. package/plugins/columnSorting/columnStatesManager.js +12 -6
  137. package/plugins/columnSorting/columnStatesManager.mjs +12 -6
  138. package/plugins/columnSummary/columnSummary.js +71 -58
  139. package/plugins/columnSummary/columnSummary.mjs +70 -57
  140. package/plugins/columnSummary/endpoints.js +20 -14
  141. package/plugins/columnSummary/endpoints.mjs +20 -14
  142. package/plugins/comments/commentEditor.js +30 -2
  143. package/plugins/comments/commentEditor.mjs +30 -2
  144. package/plugins/comments/comments.js +158 -169
  145. package/plugins/comments/comments.mjs +157 -168
  146. package/plugins/comments/displaySwitch.js +7 -3
  147. package/plugins/comments/displaySwitch.mjs +7 -3
  148. package/plugins/contextMenu/commandExecutor.js +15 -2
  149. package/plugins/contextMenu/commandExecutor.mjs +15 -2
  150. package/plugins/contextMenu/contextMenu.js +96 -102
  151. package/plugins/contextMenu/contextMenu.mjs +95 -101
  152. package/plugins/contextMenu/itemsFactory.js +19 -4
  153. package/plugins/contextMenu/itemsFactory.mjs +19 -4
  154. package/plugins/contextMenu/menu/cursor.js +36 -0
  155. package/plugins/contextMenu/menu/cursor.mjs +36 -0
  156. package/plugins/contextMenu/menu/menu.js +57 -5
  157. package/plugins/contextMenu/menu/menu.mjs +57 -5
  158. package/plugins/contextMenu/predefinedItems/removeColumn.js +1 -1
  159. package/plugins/contextMenu/predefinedItems/removeColumn.mjs +1 -1
  160. package/plugins/contextMenu/predefinedItems/removeRow.js +1 -1
  161. package/plugins/contextMenu/predefinedItems/removeRow.mjs +1 -1
  162. package/plugins/copyPaste/copyPaste.js +74 -75
  163. package/plugins/copyPaste/copyPaste.mjs +74 -75
  164. package/plugins/customBorders/customBorders.js +57 -50
  165. package/plugins/customBorders/customBorders.mjs +56 -49
  166. package/plugins/dragToScroll/dragToScroll.js +50 -54
  167. package/plugins/dragToScroll/dragToScroll.mjs +49 -52
  168. package/plugins/dropdownMenu/dropdownMenu.js +136 -131
  169. package/plugins/dropdownMenu/dropdownMenu.mjs +136 -131
  170. package/plugins/exportFile/dataProvider.js +7 -2
  171. package/plugins/exportFile/dataProvider.mjs +7 -2
  172. package/plugins/exportFile/exportFile.js +1 -1
  173. package/plugins/exportFile/exportFile.mjs +1 -1
  174. package/plugins/exportFile/types/_base.js +14 -6
  175. package/plugins/exportFile/types/_base.mjs +14 -6
  176. package/plugins/filters/component/actionBar.js +9 -0
  177. package/plugins/filters/component/actionBar.mjs +9 -0
  178. package/plugins/filters/component/condition.js +13 -0
  179. package/plugins/filters/component/condition.mjs +13 -0
  180. package/plugins/filters/component/operators.js +9 -0
  181. package/plugins/filters/component/operators.mjs +9 -0
  182. package/plugins/filters/component/value.js +9 -0
  183. package/plugins/filters/component/value.mjs +9 -0
  184. package/plugins/filters/conditionCollection.js +9 -4
  185. package/plugins/filters/conditionCollection.mjs +9 -4
  186. package/plugins/filters/conditionUpdateObserver.js +53 -42
  187. package/plugins/filters/conditionUpdateObserver.mjs +53 -42
  188. package/plugins/filters/dataFilter.js +9 -3
  189. package/plugins/filters/dataFilter.mjs +9 -3
  190. package/plugins/filters/filters.js +184 -189
  191. package/plugins/filters/filters.mjs +182 -187
  192. package/plugins/filters/ui/_base.js +1 -1
  193. package/plugins/filters/ui/_base.mjs +1 -1
  194. package/plugins/filters/utils.js +1 -1
  195. package/plugins/filters/utils.mjs +1 -1
  196. package/plugins/formulas/engine/settings.js +1 -1
  197. package/plugins/formulas/engine/settings.mjs +1 -1
  198. package/plugins/formulas/formulas.js +684 -602
  199. package/plugins/formulas/formulas.mjs +682 -600
  200. package/plugins/hiddenColumns/hiddenColumns.js +174 -169
  201. package/plugins/hiddenColumns/hiddenColumns.mjs +173 -168
  202. package/plugins/hiddenRows/hiddenRows.js +170 -165
  203. package/plugins/hiddenRows/hiddenRows.mjs +169 -164
  204. package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +1 -1
  205. package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.mjs +1 -1
  206. package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +1 -1
  207. package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.mjs +1 -1
  208. package/plugins/manualColumnFreeze/manualColumnFreeze.js +66 -53
  209. package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +64 -51
  210. package/plugins/manualColumnMove/manualColumnMove.js +287 -232
  211. package/plugins/manualColumnMove/manualColumnMove.mjs +286 -231
  212. package/plugins/manualColumnMove/ui/_base.js +9 -3
  213. package/plugins/manualColumnMove/ui/_base.mjs +9 -3
  214. package/plugins/manualColumnResize/manualColumnResize.js +291 -246
  215. package/plugins/manualColumnResize/manualColumnResize.mjs +290 -244
  216. package/plugins/manualRowMove/manualRowMove.js +223 -208
  217. package/plugins/manualRowMove/manualRowMove.mjs +222 -207
  218. package/plugins/manualRowMove/ui/_base.js +10 -5
  219. package/plugins/manualRowMove/ui/_base.mjs +10 -5
  220. package/plugins/manualRowResize/manualRowResize.js +254 -209
  221. package/plugins/manualRowResize/manualRowResize.mjs +253 -207
  222. package/plugins/mergeCells/calculations/autofill.js +9 -3
  223. package/plugins/mergeCells/calculations/autofill.mjs +9 -3
  224. package/plugins/mergeCells/calculations/selection.js +10 -4
  225. package/plugins/mergeCells/calculations/selection.mjs +10 -4
  226. package/plugins/mergeCells/cellCoords.js +16 -6
  227. package/plugins/mergeCells/cellCoords.mjs +16 -6
  228. package/plugins/mergeCells/cellsCollection.js +10 -4
  229. package/plugins/mergeCells/cellsCollection.mjs +10 -4
  230. package/plugins/mergeCells/mergeCells.js +582 -502
  231. package/plugins/mergeCells/mergeCells.mjs +580 -500
  232. package/plugins/multiColumnSorting/multiColumnSorting.js +15 -11
  233. package/plugins/multiColumnSorting/multiColumnSorting.mjs +15 -11
  234. package/plugins/multipleSelectionHandles/multipleSelectionHandles.js +16 -28
  235. package/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs +16 -27
  236. package/plugins/nestedHeaders/nestedHeaders.js +542 -499
  237. package/plugins/nestedHeaders/nestedHeaders.mjs +554 -511
  238. package/plugins/nestedHeaders/stateManager/index.js +1 -1
  239. package/plugins/nestedHeaders/stateManager/index.mjs +1 -1
  240. package/plugins/nestedRows/data/dataManager.js +21 -15
  241. package/plugins/nestedRows/data/dataManager.mjs +21 -15
  242. package/plugins/nestedRows/nestedRows.js +335 -279
  243. package/plugins/nestedRows/nestedRows.mjs +334 -278
  244. package/plugins/nestedRows/ui/_base.js +7 -1
  245. package/plugins/nestedRows/ui/_base.mjs +7 -1
  246. package/plugins/nestedRows/ui/collapsing.js +2 -2
  247. package/plugins/nestedRows/ui/collapsing.mjs +2 -2
  248. package/plugins/nestedRows/ui/contextMenu.js +28 -18
  249. package/plugins/nestedRows/ui/contextMenu.mjs +28 -18
  250. package/plugins/nestedRows/utils/rowMoveController.js +12 -4
  251. package/plugins/nestedRows/utils/rowMoveController.mjs +12 -4
  252. package/plugins/persistentState/persistentState.js +14 -11
  253. package/plugins/persistentState/persistentState.mjs +14 -11
  254. package/plugins/persistentState/storage.js +11 -6
  255. package/plugins/persistentState/storage.mjs +11 -6
  256. package/plugins/registry.js +2 -2
  257. package/plugins/registry.mjs +2 -2
  258. package/plugins/search/search.js +57 -46
  259. package/plugins/search/search.mjs +56 -45
  260. package/plugins/touchScroll/touchScroll.js +102 -100
  261. package/plugins/touchScroll/touchScroll.mjs +100 -98
  262. package/plugins/trimRows/trimRows.js +33 -28
  263. package/plugins/trimRows/trimRows.mjs +32 -27
  264. package/plugins/undoRedo/undoRedo.js +2 -2
  265. package/plugins/undoRedo/undoRedo.mjs +2 -2
  266. package/renderers/autocompleteRenderer/autocompleteRenderer.js +11 -11
  267. package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +11 -11
  268. package/renderers/baseRenderer/baseRenderer.js +2 -2
  269. package/renderers/baseRenderer/baseRenderer.mjs +2 -2
  270. package/renderers/checkboxRenderer/checkboxRenderer.js +23 -23
  271. package/renderers/checkboxRenderer/checkboxRenderer.mjs +23 -23
  272. package/renderers/dateRenderer/dateRenderer.js +4 -4
  273. package/renderers/dateRenderer/dateRenderer.mjs +4 -4
  274. package/renderers/handsontableRenderer/handsontableRenderer.js +4 -4
  275. package/renderers/handsontableRenderer/handsontableRenderer.mjs +4 -4
  276. package/renderers/htmlRenderer/htmlRenderer.js +4 -4
  277. package/renderers/htmlRenderer/htmlRenderer.mjs +4 -4
  278. package/renderers/numericRenderer/numericRenderer.js +3 -3
  279. package/renderers/numericRenderer/numericRenderer.mjs +3 -3
  280. package/renderers/passwordRenderer/passwordRenderer.js +3 -3
  281. package/renderers/passwordRenderer/passwordRenderer.mjs +3 -3
  282. package/renderers/selectRenderer/selectRenderer.js +4 -4
  283. package/renderers/selectRenderer/selectRenderer.mjs +4 -4
  284. package/renderers/textRenderer/textRenderer.js +5 -5
  285. package/renderers/textRenderer/textRenderer.mjs +5 -5
  286. package/renderers/timeRenderer/timeRenderer.js +3 -3
  287. package/renderers/timeRenderer/timeRenderer.mjs +3 -3
  288. package/selection/range.js +12 -2
  289. package/selection/range.mjs +12 -2
  290. package/selection/selection.js +28 -10
  291. package/selection/selection.mjs +28 -10
  292. package/selection/utils.js +24 -14
  293. package/selection/utils.mjs +25 -15
  294. package/shortcuts/manager.js +1 -1
  295. package/shortcuts/manager.mjs +1 -1
  296. package/tableView.js +208 -200
  297. package/tableView.mjs +208 -200
  298. package/translations/changesObservable/utils.js +2 -2
  299. package/translations/changesObservable/utils.mjs +2 -2
  300. package/translations/indexMapper.js +25 -22
  301. package/translations/indexMapper.mjs +25 -22
  302. package/translations/mapCollections/aggregatedCollection.js +8 -2
  303. package/translations/mapCollections/aggregatedCollection.mjs +8 -2
  304. package/translations/mapCollections/mapCollection.js +5 -2
  305. package/translations/mapCollections/mapCollection.mjs +5 -2
  306. package/translations/maps/indexMap.js +6 -1
  307. package/translations/maps/indexMap.mjs +6 -1
  308. package/translations/maps/utils/physicallyIndexed.js +2 -2
  309. package/translations/maps/utils/physicallyIndexed.mjs +2 -2
  310. package/utils/dataStructures/linkedList.js +10 -6
  311. package/utils/dataStructures/linkedList.mjs +10 -6
  312. package/utils/dataStructures/queue.js +1 -1
  313. package/utils/dataStructures/queue.mjs +1 -1
  314. package/utils/dataStructures/stack.js +1 -1
  315. package/utils/dataStructures/stack.mjs +1 -1
  316. package/utils/ghostTable.js +2 -2
  317. package/utils/ghostTable.mjs +2 -2
  318. package/utils/interval.js +73 -36
  319. package/utils/interval.mjs +73 -36
  320. package/utils/parseTable.js +1 -1
  321. package/utils/parseTable.mjs +1 -1
  322. package/validators/autocompleteValidator/autocompleteValidator.js +1 -1
  323. package/validators/autocompleteValidator/autocompleteValidator.mjs +1 -1
  324. package/validators/dateValidator/dateValidator.js +1 -1
  325. package/validators/dateValidator/dateValidator.mjs +1 -1
  326. package/validators/numericValidator/numericValidator.js +1 -1
  327. package/validators/numericValidator/numericValidator.mjs +1 -1
@@ -2,6 +2,7 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  require("core-js/modules/es.array.push.js");
5
+ require("core-js/modules/es.error.cause.js");
5
6
  var _base = require("../base");
6
7
  var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
7
8
  var _cellsCollection = _interopRequireDefault(require("./cellsCollection"));
@@ -17,13 +18,24 @@ var _utils = require("./utils");
17
18
  var _element = require("../../helpers/dom/element");
18
19
  var _browser = require("../../helpers/browser");
19
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+ function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
22
+ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
23
+ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
24
+ 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(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
26
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
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; }
20
33
  _pluginHooks.default.getSingleton().register('beforeMergeCells');
21
34
  _pluginHooks.default.getSingleton().register('afterMergeCells');
22
35
  _pluginHooks.default.getSingleton().register('beforeUnmergeCells');
23
36
  _pluginHooks.default.getSingleton().register('afterUnmergeCells');
24
37
  const PLUGIN_KEY = exports.PLUGIN_KEY = 'mergeCells';
25
38
  const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 150;
26
- const privatePool = new WeakMap();
27
39
  const SHORTCUTS_GROUP = PLUGIN_KEY;
28
40
 
29
41
  /* eslint-disable jsdoc/require-description-complete-sentence */
@@ -63,42 +75,231 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
63
75
  * ```
64
76
  * :::
65
77
  */
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();
66
101
  class MergeCells extends _base.BasePlugin {
67
- static get PLUGIN_KEY() {
68
- return PLUGIN_KEY;
69
- }
70
- static get PLUGIN_PRIORITY() {
71
- return PLUGIN_PRIORITY;
72
- }
73
- constructor(hotInstance) {
74
- super(hotInstance);
75
- privatePool.set(this, {
76
- lastDesiredCoords: null
77
- });
78
-
102
+ constructor() {
103
+ super(...arguments);
104
+ /**
105
+ * `beforeRemoveCellClassNames` hook callback. Used to remove additional class name from all cells in the table.
106
+ *
107
+ * @returns {string[]} An `Array` of `String`s. Each of these strings will act like class names to be removed from
108
+ * all the cells in the table.
109
+ */
110
+ _classPrivateMethodInitSpec(this, _onBeforeRemoveCellClassNames);
111
+ /**
112
+ * `afterDrawSelection` hook callback. Used to add the additional class name for the entirely-selected merged cells.
113
+ *
114
+ * @param {number} currentRow Visual row index of the currently processed cell.
115
+ * @param {number} currentColumn Visual column index of the currently cell.
116
+ * @param {Array} cornersOfSelection Array of the current selection in a form of `[startRow, startColumn, endRow,
117
+ * endColumn]`.
118
+ * @param {number|undefined} layerLevel Number indicating which layer of selection is currently processed.
119
+ * @returns {string|undefined} A `String`, which will act as an additional `className` to be added to the currently
120
+ * processed cell.
121
+ */
122
+ _classPrivateMethodInitSpec(this, _onAfterDrawSelection);
123
+ /**
124
+ * `afterModifyTransformStart` hook callback. Fixes a problem with navigating through merged cells at the edges of
125
+ * the table with the ENTER/SHIFT+ENTER/TAB/SHIFT+TAB keys.
126
+ *
127
+ * @param {CellCoords} coords Coordinates of the to-be-selected cell.
128
+ * @param {number} rowTransformDir Row transformation direction (negative value = up, 0 = none, positive value =
129
+ * down).
130
+ * @param {number} colTransformDir Column transformation direction (negative value = up, 0 = none, positive value =
131
+ * down).
132
+ */
133
+ _classPrivateMethodInitSpec(this, _onAfterModifyTransformStart);
134
+ /**
135
+ * `beforeDrawAreaBorders` hook callback.
136
+ *
137
+ * @param {Array} corners Visual coordinates of the area corners.
138
+ * @param {string} className Class name for the area.
139
+ */
140
+ _classPrivateMethodInitSpec(this, _onBeforeDrawAreaBorders);
141
+ /**
142
+ * `afterChange` hook callback. Used to propagate merged cells after using Autofill.
143
+ *
144
+ * @param {Array} changes The changes array.
145
+ * @param {string} source Determines the source of the change.
146
+ */
147
+ _classPrivateMethodInitSpec(this, _onAfterChange);
148
+ /**
149
+ * `afterRemoveRow` hook callback.
150
+ *
151
+ * @param {number} row Row index.
152
+ * @param {number} count Number of removed rows.
153
+ */
154
+ _classPrivateMethodInitSpec(this, _onAfterRemoveRow);
155
+ /**
156
+ * `afterCreateRow` hook callback.
157
+ *
158
+ * @param {number} row Row index.
159
+ * @param {number} count Number of created rows.
160
+ * @param {string} source Source of change.
161
+ */
162
+ _classPrivateMethodInitSpec(this, _onAfterCreateRow);
163
+ /**
164
+ * `afterRemoveCol` hook callback.
165
+ *
166
+ * @param {number} column Column index.
167
+ * @param {number} count Number of removed columns.
168
+ */
169
+ _classPrivateMethodInitSpec(this, _onAfterRemoveCol);
170
+ /**
171
+ * `afterCreateCol` hook callback.
172
+ *
173
+ * @param {number} column Column index.
174
+ * @param {number} count Number of created columns.
175
+ */
176
+ _classPrivateMethodInitSpec(this, _onAfterCreateCol);
177
+ /**
178
+ * The `modifyAutofillRange` hook callback.
179
+ *
180
+ * @param {Array} drag The drag area coordinates.
181
+ * @param {Array} select The selection information.
182
+ * @returns {Array} The new drag area.
183
+ */
184
+ _classPrivateMethodInitSpec(this, _onModifyAutofillRange);
185
+ /**
186
+ * `afterViewportColumnCalculatorOverride` hook callback.
187
+ *
188
+ * @param {object} calc The column calculator object.
189
+ */
190
+ _classPrivateMethodInitSpec(this, _onAfterViewportColumnCalculatorOverride);
191
+ /**
192
+ * `afterViewportRowCalculatorOverride` hook callback.
193
+ *
194
+ * @param {object} calc The row calculator object.
195
+ */
196
+ _classPrivateMethodInitSpec(this, _onAfterViewportRowCalculatorOverride);
197
+ /**
198
+ * The `afterGetCellMeta` hook callback.
199
+ *
200
+ * @param {number} row Row index.
201
+ * @param {number} col Column index.
202
+ * @param {object} cellProperties The cell properties object.
203
+ */
204
+ _classPrivateMethodInitSpec(this, _onAfterGetCellMeta);
205
+ /**
206
+ * `beforeSetRangeEnd` hook callback.
207
+ * While selecting cells with keyboard or mouse, make sure that rectangular area is expanded to the extent of the
208
+ * merged cell.
209
+ *
210
+ * Note: Please keep in mind that callback may modify both start and end range coordinates by the reference.
211
+ *
212
+ * @param {object} coords Cell coords.
213
+ */
214
+ _classPrivateMethodInitSpec(this, _onBeforeSetRangeEnd);
215
+ /**
216
+ * `beforeSetRangeStart` and `beforeSetRangeStartOnly` hook callback.
217
+ * A selection within merge area should be rewritten to the start of merge area.
218
+ *
219
+ * @param {object} coords Cell coords.
220
+ */
221
+ _classPrivateMethodInitSpec(this, _onBeforeSetRangeStart);
222
+ /**
223
+ * `afterRenderer` hook callback.
224
+ *
225
+ * @param {HTMLElement} TD The cell to be modified.
226
+ * @param {number} row Row index.
227
+ * @param {number} col Visual column index.
228
+ */
229
+ _classPrivateMethodInitSpec(this, _onAfterRenderer);
230
+ /**
231
+ * `afterContextMenuDefaultOptions` hook callback.
232
+ *
233
+ * @param {object} defaultOptions The default context menu options.
234
+ */
235
+ _classPrivateMethodInitSpec(this, _addMergeActionsToContextMenu);
236
+ /**
237
+ * `modifyGetCellCoords` hook callback. Swaps the `getCell` coords with the merged parent coords.
238
+ *
239
+ * @param {number} row Row index.
240
+ * @param {number} column Visual column index.
241
+ * @returns {Array|undefined} Visual coordinates of the merge.
242
+ */
243
+ _classPrivateMethodInitSpec(this, _onModifyGetCellCoords);
244
+ /**
245
+ * `modifyTransformEnd` hook callback. Needed to handle "jumping over" merged merged cells, while selecting.
246
+ *
247
+ * @param {object} delta The transformation delta.
248
+ */
249
+ _classPrivateMethodInitSpec(this, _onModifyTransformEnd);
250
+ /**
251
+ * `modifyTransformStart` hook callback.
252
+ *
253
+ * @param {object} delta The transformation delta.
254
+ */
255
+ _classPrivateMethodInitSpec(this, _onModifyTransformStart);
256
+ /**
257
+ * Modifies the information on whether the current selection contains multiple cells. The `afterIsMultipleSelection`
258
+ * hook callback.
259
+ *
260
+ * @param {boolean} isMultiple Determines whether the current selection contains multiple cells.
261
+ * @returns {boolean}
262
+ */
263
+ _classPrivateMethodInitSpec(this, _onAfterIsMultipleSelection);
264
+ /**
265
+ * `afterInit` hook callback.
266
+ */
267
+ _classPrivateMethodInitSpec(this, _onAfterInit);
79
268
  /**
80
269
  * A container for all the merged cells.
81
270
  *
82
271
  * @private
83
272
  * @type {MergedCellsCollection}
84
273
  */
85
- this.mergedCellsCollection = null;
274
+ _defineProperty(this, "mergedCellsCollection", null);
86
275
  /**
87
276
  * Instance of the class responsible for all the autofill-related calculations.
88
277
  *
89
278
  * @private
90
279
  * @type {AutofillCalculations}
91
280
  */
92
- this.autofillCalculations = null;
281
+ _defineProperty(this, "autofillCalculations", null);
93
282
  /**
94
283
  * Instance of the class responsible for the selection-related calculations.
95
284
  *
96
285
  * @private
97
286
  * @type {SelectionCalculations}
98
287
  */
99
- this.selectionCalculations = null;
288
+ _defineProperty(this, "selectionCalculations", null);
289
+ /**
290
+ * @type {CellCoords}
291
+ */
292
+ _classPrivateFieldInitSpec(this, _lastDesiredCoords, {
293
+ writable: true,
294
+ value: null
295
+ });
296
+ }
297
+ static get PLUGIN_KEY() {
298
+ return PLUGIN_KEY;
299
+ }
300
+ static get PLUGIN_PRIORITY() {
301
+ return PLUGIN_PRIORITY;
100
302
  }
101
-
102
303
  /**
103
304
  * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
104
305
  * hook and if it returns `true` then the {@link MergeCells#enablePlugin} method is called.
@@ -121,73 +322,142 @@ class MergeCells extends _base.BasePlugin {
121
322
  this.autofillCalculations = new _autofill.default(this);
122
323
  this.selectionCalculations = new _selection.default(this);
123
324
  this.addHook('afterInit', function () {
124
- return _this.onAfterInit(...arguments);
325
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
326
+ args[_key] = arguments[_key];
327
+ }
328
+ return _classPrivateMethodGet(_this, _onAfterInit, _onAfterInit2).call(_this, ...args);
125
329
  });
126
330
  this.addHook('modifyTransformStart', function () {
127
- return _this.onModifyTransformStart(...arguments);
331
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
332
+ args[_key2] = arguments[_key2];
333
+ }
334
+ return _classPrivateMethodGet(_this, _onModifyTransformStart, _onModifyTransformStart2).call(_this, ...args);
128
335
  });
129
336
  this.addHook('afterModifyTransformStart', function () {
130
- return _this.onAfterModifyTransformStart(...arguments);
337
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
338
+ args[_key3] = arguments[_key3];
339
+ }
340
+ return _classPrivateMethodGet(_this, _onAfterModifyTransformStart, _onAfterModifyTransformStart2).call(_this, ...args);
131
341
  });
132
342
  this.addHook('modifyTransformEnd', function () {
133
- return _this.onModifyTransformEnd(...arguments);
343
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
344
+ args[_key4] = arguments[_key4];
345
+ }
346
+ return _classPrivateMethodGet(_this, _onModifyTransformEnd, _onModifyTransformEnd2).call(_this, ...args);
134
347
  });
135
348
  this.addHook('modifyGetCellCoords', function () {
136
- return _this.onModifyGetCellCoords(...arguments);
349
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
350
+ args[_key5] = arguments[_key5];
351
+ }
352
+ return _classPrivateMethodGet(_this, _onModifyGetCellCoords, _onModifyGetCellCoords2).call(_this, ...args);
137
353
  });
138
354
  this.addHook('beforeSetRangeStart', function () {
139
- return _this.onBeforeSetRangeStart(...arguments);
355
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
356
+ args[_key6] = arguments[_key6];
357
+ }
358
+ return _classPrivateMethodGet(_this, _onBeforeSetRangeStart, _onBeforeSetRangeStart2).call(_this, ...args);
140
359
  });
141
360
  this.addHook('beforeSetRangeStartOnly', function () {
142
- return _this.onBeforeSetRangeStart(...arguments);
361
+ for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
362
+ args[_key7] = arguments[_key7];
363
+ }
364
+ return _classPrivateMethodGet(_this, _onBeforeSetRangeStart, _onBeforeSetRangeStart2).call(_this, ...args);
143
365
  });
144
366
  this.addHook('beforeSetRangeEnd', function () {
145
- return _this.onBeforeSetRangeEnd(...arguments);
367
+ for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
368
+ args[_key8] = arguments[_key8];
369
+ }
370
+ return _classPrivateMethodGet(_this, _onBeforeSetRangeEnd, _onBeforeSetRangeEnd2).call(_this, ...args);
146
371
  });
147
372
  this.addHook('afterIsMultipleSelection', function () {
148
- return _this.onAfterIsMultipleSelection(...arguments);
373
+ for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
374
+ args[_key9] = arguments[_key9];
375
+ }
376
+ return _classPrivateMethodGet(_this, _onAfterIsMultipleSelection, _onAfterIsMultipleSelection2).call(_this, ...args);
149
377
  });
150
378
  this.addHook('afterRenderer', function () {
151
- return _this.onAfterRenderer(...arguments);
379
+ for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
380
+ args[_key10] = arguments[_key10];
381
+ }
382
+ return _classPrivateMethodGet(_this, _onAfterRenderer, _onAfterRenderer2).call(_this, ...args);
152
383
  });
153
384
  this.addHook('afterContextMenuDefaultOptions', function () {
154
- return _this.addMergeActionsToContextMenu(...arguments);
385
+ for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
386
+ args[_key11] = arguments[_key11];
387
+ }
388
+ return _classPrivateMethodGet(_this, _addMergeActionsToContextMenu, _addMergeActionsToContextMenu2).call(_this, ...args);
155
389
  });
156
390
  this.addHook('afterGetCellMeta', function () {
157
- return _this.onAfterGetCellMeta(...arguments);
391
+ for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
392
+ args[_key12] = arguments[_key12];
393
+ }
394
+ return _classPrivateMethodGet(_this, _onAfterGetCellMeta, _onAfterGetCellMeta2).call(_this, ...args);
158
395
  });
159
396
  this.addHook('afterViewportRowCalculatorOverride', function () {
160
- return _this.onAfterViewportRowCalculatorOverride(...arguments);
397
+ for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
398
+ args[_key13] = arguments[_key13];
399
+ }
400
+ return _classPrivateMethodGet(_this, _onAfterViewportRowCalculatorOverride, _onAfterViewportRowCalculatorOverride2).call(_this, ...args);
161
401
  });
162
402
  this.addHook('afterViewportColumnCalculatorOverride', function () {
163
- return _this.onAfterViewportColumnCalculatorOverride(...arguments);
403
+ for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
404
+ args[_key14] = arguments[_key14];
405
+ }
406
+ return _classPrivateMethodGet(_this, _onAfterViewportColumnCalculatorOverride, _onAfterViewportColumnCalculatorOverride2).call(_this, ...args);
164
407
  });
165
408
  this.addHook('modifyAutofillRange', function () {
166
- return _this.onModifyAutofillRange(...arguments);
409
+ for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
410
+ args[_key15] = arguments[_key15];
411
+ }
412
+ return _classPrivateMethodGet(_this, _onModifyAutofillRange, _onModifyAutofillRange2).call(_this, ...args);
167
413
  });
168
414
  this.addHook('afterCreateCol', function () {
169
- return _this.onAfterCreateCol(...arguments);
415
+ for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {
416
+ args[_key16] = arguments[_key16];
417
+ }
418
+ return _classPrivateMethodGet(_this, _onAfterCreateCol, _onAfterCreateCol2).call(_this, ...args);
170
419
  });
171
420
  this.addHook('afterRemoveCol', function () {
172
- return _this.onAfterRemoveCol(...arguments);
421
+ for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {
422
+ args[_key17] = arguments[_key17];
423
+ }
424
+ return _classPrivateMethodGet(_this, _onAfterRemoveCol, _onAfterRemoveCol2).call(_this, ...args);
173
425
  });
174
426
  this.addHook('afterCreateRow', function () {
175
- return _this.onAfterCreateRow(...arguments);
427
+ for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {
428
+ args[_key18] = arguments[_key18];
429
+ }
430
+ return _classPrivateMethodGet(_this, _onAfterCreateRow, _onAfterCreateRow2).call(_this, ...args);
176
431
  });
177
432
  this.addHook('afterRemoveRow', function () {
178
- return _this.onAfterRemoveRow(...arguments);
433
+ for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {
434
+ args[_key19] = arguments[_key19];
435
+ }
436
+ return _classPrivateMethodGet(_this, _onAfterRemoveRow, _onAfterRemoveRow2).call(_this, ...args);
179
437
  });
180
438
  this.addHook('afterChange', function () {
181
- return _this.onAfterChange(...arguments);
439
+ for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {
440
+ args[_key20] = arguments[_key20];
441
+ }
442
+ return _classPrivateMethodGet(_this, _onAfterChange, _onAfterChange2).call(_this, ...args);
182
443
  });
183
444
  this.addHook('beforeDrawBorders', function () {
184
- return _this.onBeforeDrawAreaBorders(...arguments);
445
+ for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {
446
+ args[_key21] = arguments[_key21];
447
+ }
448
+ return _classPrivateMethodGet(_this, _onBeforeDrawAreaBorders, _onBeforeDrawAreaBorders2).call(_this, ...args);
185
449
  });
186
450
  this.addHook('afterDrawSelection', function () {
187
- return _this.onAfterDrawSelection(...arguments);
451
+ for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {
452
+ args[_key22] = arguments[_key22];
453
+ }
454
+ return _classPrivateMethodGet(_this, _onAfterDrawSelection, _onAfterDrawSelection2).call(_this, ...args);
188
455
  });
189
456
  this.addHook('beforeRemoveCellClassNames', function () {
190
- return _this.onBeforeRemoveCellClassNames(...arguments);
457
+ for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {
458
+ args[_key23] = arguments[_key23];
459
+ }
460
+ return _classPrivateMethodGet(_this, _onBeforeRemoveCellClassNames, _onBeforeRemoveCellClassNames2).call(_this, ...args);
191
461
  });
192
462
  this.addHook('beforeUndoStackChange', (action, source) => {
193
463
  if (source === 'MergeCells') {
@@ -462,7 +732,7 @@ class MergeCells extends _base.BasePlugin {
462
732
  if (preventPopulation) {
463
733
  populationInfo = [mergeParent.row, mergeParent.col, clearedData];
464
734
  } else {
465
- this.hot.populateFromArray(mergeParent.row, mergeParent.col, clearedData, void 0, void 0, this.pluginName);
735
+ this.hot.populateFromArray(mergeParent.row, mergeParent.col, clearedData, undefined, undefined, this.pluginName);
466
736
  }
467
737
  if (!auto) {
468
738
  this.ifChromeForceRepaint();
@@ -551,17 +821,6 @@ class MergeCells extends _base.BasePlugin {
551
821
  const end = this.hot._createCellCoords(endRow, endColumn);
552
822
  this.unmergeRange(this.hot._createCellRange(start, start, end));
553
823
  }
554
-
555
- /**
556
- * `afterInit` hook callback.
557
- *
558
- * @private
559
- */
560
- onAfterInit() {
561
- this.generateFromSettings(this.hot.getSettings()[PLUGIN_KEY]);
562
- this.hot.render();
563
- }
564
-
565
824
  /**
566
825
  * Register shortcuts responsible for toggling a merge.
567
826
  *
@@ -595,280 +854,6 @@ class MergeCells extends _base.BasePlugin {
595
854
  const gridContext = shortcutManager.getContext('grid');
596
855
  gridContext.removeShortcutsByGroup(SHORTCUTS_GROUP);
597
856
  }
598
-
599
- /**
600
- * Modifies the information on whether the current selection contains multiple cells. The `afterIsMultipleSelection`
601
- * hook callback.
602
- *
603
- * @private
604
- * @param {boolean} isMultiple Determines whether the current selection contains multiple cells.
605
- * @returns {boolean}
606
- */
607
- onAfterIsMultipleSelection(isMultiple) {
608
- if (isMultiple) {
609
- const mergedCells = this.mergedCellsCollection.mergedCells;
610
- const selectionRange = this.hot.getSelectedRangeLast();
611
- for (let group = 0; group < mergedCells.length; group += 1) {
612
- 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) {
613
- return false;
614
- }
615
- }
616
- }
617
- return isMultiple;
618
- }
619
-
620
- /**
621
- * `modifyTransformStart` hook callback.
622
- *
623
- * @private
624
- * @param {object} delta The transformation delta.
625
- */
626
- onModifyTransformStart(delta) {
627
- const priv = privatePool.get(this);
628
- const currentlySelectedRange = this.hot.getSelectedRangeLast();
629
- let newDelta = {
630
- row: delta.row,
631
- col: delta.col
632
- };
633
- let nextPosition = null;
634
- const currentPosition = this.hot._createCellCoords(currentlySelectedRange.highlight.row, currentlySelectedRange.highlight.col);
635
- const mergedParent = this.mergedCellsCollection.get(currentPosition.row, currentPosition.col);
636
- if (!priv.lastDesiredCoords) {
637
- priv.lastDesiredCoords = this.hot._createCellCoords(null, null);
638
- }
639
- if (mergedParent) {
640
- // only merge selected
641
- const mergeTopLeft = this.hot._createCellCoords(mergedParent.row, mergedParent.col);
642
- const mergeBottomRight = this.hot._createCellCoords(mergedParent.row + mergedParent.rowspan - 1, mergedParent.col + mergedParent.colspan - 1);
643
- const mergeRange = this.hot._createCellRange(mergeTopLeft, mergeTopLeft, mergeBottomRight);
644
- if (!mergeRange.includes(priv.lastDesiredCoords)) {
645
- priv.lastDesiredCoords = this.hot._createCellCoords(null, null); // reset outdated version of lastDesiredCoords
646
- }
647
-
648
- newDelta.row = priv.lastDesiredCoords.row ? priv.lastDesiredCoords.row - currentPosition.row : newDelta.row;
649
- newDelta.col = priv.lastDesiredCoords.col ? priv.lastDesiredCoords.col - currentPosition.col : newDelta.col;
650
- if (delta.row > 0) {
651
- // moving down
652
- newDelta.row = mergedParent.row + mergedParent.rowspan - 1 - currentPosition.row + delta.row;
653
- } else if (delta.row < 0) {
654
- // moving up
655
- newDelta.row = currentPosition.row - mergedParent.row + delta.row;
656
- }
657
- if (delta.col > 0) {
658
- // moving right
659
- newDelta.col = mergedParent.col + mergedParent.colspan - 1 - currentPosition.col + delta.col;
660
- } else if (delta.col < 0) {
661
- // moving left
662
- newDelta.col = currentPosition.col - mergedParent.col + delta.col;
663
- }
664
- }
665
- nextPosition = this.hot._createCellCoords(currentlySelectedRange.highlight.row + newDelta.row, currentlySelectedRange.highlight.col + newDelta.col);
666
- const nextPositionMergedCell = this.mergedCellsCollection.get(nextPosition.row, nextPosition.col);
667
- if (nextPositionMergedCell) {
668
- // skipping the invisible cells in the merge range
669
- const firstRenderableCoords = this.mergedCellsCollection.getFirstRenderableCoords(nextPositionMergedCell.row, nextPositionMergedCell.col);
670
- priv.lastDesiredCoords = nextPosition;
671
- newDelta = {
672
- row: firstRenderableCoords.row - currentPosition.row,
673
- col: firstRenderableCoords.col - currentPosition.col
674
- };
675
- }
676
- if (newDelta.row !== 0) {
677
- delta.row = newDelta.row;
678
- }
679
- if (newDelta.col !== 0) {
680
- delta.col = newDelta.col;
681
- }
682
- }
683
-
684
- /**
685
- * `modifyTransformEnd` hook callback. Needed to handle "jumping over" merged merged cells, while selecting.
686
- *
687
- * @private
688
- * @param {object} delta The transformation delta.
689
- */
690
- onModifyTransformEnd(delta) {
691
- const currentSelectionRange = this.hot.getSelectedRangeLast();
692
- const newDelta = (0, _object.clone)(delta);
693
- const newSelectionRange = this.selectionCalculations.getUpdatedSelectionRange(currentSelectionRange, delta);
694
- let tempDelta = (0, _object.clone)(newDelta);
695
- const mergedCellsWithinRange = this.mergedCellsCollection.getWithinRange(newSelectionRange, true);
696
- do {
697
- tempDelta = (0, _object.clone)(newDelta);
698
- this.selectionCalculations.getUpdatedSelectionRange(currentSelectionRange, newDelta);
699
- (0, _array.arrayEach)(mergedCellsWithinRange, mergedCell => {
700
- this.selectionCalculations.snapDelta(newDelta, currentSelectionRange, mergedCell);
701
- });
702
- } while (newDelta.row !== tempDelta.row || newDelta.col !== tempDelta.col);
703
- delta.row = newDelta.row;
704
- delta.col = newDelta.col;
705
- }
706
-
707
- /**
708
- * `modifyGetCellCoords` hook callback. Swaps the `getCell` coords with the merged parent coords.
709
- *
710
- * @private
711
- * @param {number} row Row index.
712
- * @param {number} column Visual column index.
713
- * @returns {Array|undefined} Visual coordinates of the merge.
714
- */
715
- onModifyGetCellCoords(row, column) {
716
- if (row < 0 || column < 0) {
717
- return;
718
- }
719
- const mergeParent = this.mergedCellsCollection.get(row, column);
720
- if (!mergeParent) {
721
- return;
722
- }
723
- const {
724
- row: mergeRow,
725
- col: mergeColumn,
726
- colspan,
727
- rowspan
728
- } = mergeParent;
729
- return [
730
- // Most top-left merged cell coords.
731
- mergeRow, mergeColumn,
732
- // Most bottom-right merged cell coords.
733
- mergeRow + rowspan - 1, mergeColumn + colspan - 1];
734
- }
735
-
736
- /**
737
- * `afterContextMenuDefaultOptions` hook callback.
738
- *
739
- * @private
740
- * @param {object} defaultOptions The default context menu options.
741
- */
742
- addMergeActionsToContextMenu(defaultOptions) {
743
- defaultOptions.items.push({
744
- name: '---------'
745
- }, (0, _toggleMerge.default)(this));
746
- }
747
-
748
- /**
749
- * `afterRenderer` hook callback.
750
- *
751
- * @private
752
- * @param {HTMLElement} TD The cell to be modified.
753
- * @param {number} row Row index.
754
- * @param {number} col Visual column index.
755
- */
756
- onAfterRenderer(TD, row, col) {
757
- const mergedCell = this.mergedCellsCollection.get(row, col);
758
- // We shouldn't override data in the collection.
759
- const mergedCellCopy = (0, _object.isObject)(mergedCell) ? (0, _object.clone)(mergedCell) : void 0;
760
- if ((0, _object.isObject)(mergedCellCopy)) {
761
- const {
762
- rowIndexMapper: rowMapper,
763
- columnIndexMapper: columnMapper
764
- } = this.hot;
765
- const {
766
- row: mergeRow,
767
- col: mergeColumn,
768
- colspan,
769
- rowspan
770
- } = mergedCellCopy;
771
- const [lastMergedRowIndex, lastMergedColumnIndex] = this.translateMergedCellToRenderable(mergeRow, rowspan, mergeColumn, colspan);
772
- const renderedRowIndex = rowMapper.getRenderableFromVisualIndex(row);
773
- const renderedColumnIndex = columnMapper.getRenderableFromVisualIndex(col);
774
- const maxRowSpan = lastMergedRowIndex - renderedRowIndex + 1; // Number of rendered columns.
775
- const maxColSpan = lastMergedColumnIndex - renderedColumnIndex + 1; // Number of rendered columns.
776
-
777
- // We just try to determine some values basing on the actual number of rendered indexes (some columns may be hidden).
778
- mergedCellCopy.row = rowMapper.getNearestNotHiddenIndex(mergedCellCopy.row, 1);
779
- // We just try to determine some values basing on the actual number of rendered indexes (some columns may be hidden).
780
- mergedCellCopy.col = columnMapper.getNearestNotHiddenIndex(mergedCellCopy.col, 1);
781
- // The `rowSpan` property for a `TD` element should be at most equal to number of rendered rows in the merge area.
782
- mergedCellCopy.rowspan = Math.min(mergedCellCopy.rowspan, maxRowSpan);
783
- // The `colSpan` property for a `TD` element should be at most equal to number of rendered columns in the merge area.
784
- mergedCellCopy.colspan = Math.min(mergedCellCopy.colspan, maxColSpan);
785
- }
786
- (0, _utils.applySpanProperties)(TD, mergedCellCopy, row, col);
787
- }
788
-
789
- /**
790
- * `beforeSetRangeStart` and `beforeSetRangeStartOnly` hook callback.
791
- * A selection within merge area should be rewritten to the start of merge area.
792
- *
793
- * @private
794
- * @param {object} coords Cell coords.
795
- */
796
- onBeforeSetRangeStart(coords) {
797
- // TODO: It is a workaround, but probably this hook may be needed. Every selection on the merge area
798
- // could set start point of the selection to the start of the merge area. However, logic inside `expandByRange` need
799
- // an initial start point. Click on the merge cell when there are some hidden indexes break the logic in some cases.
800
- // Please take a look at #7010 for more information. I'm not sure if selection directions are calculated properly
801
- // and what was idea for flipping direction inside `expandByRange` method.
802
- if (this.mergedCellsCollection.isFirstRenderableMergedCell(coords.row, coords.col)) {
803
- const mergeParent = this.mergedCellsCollection.get(coords.row, coords.col);
804
- [coords.row, coords.col] = [mergeParent.row, mergeParent.col];
805
- }
806
- }
807
-
808
- /**
809
- * `beforeSetRangeEnd` hook callback.
810
- * While selecting cells with keyboard or mouse, make sure that rectangular area is expanded to the extent of the
811
- * merged cell.
812
- *
813
- * Note: Please keep in mind that callback may modify both start and end range coordinates by the reference.
814
- *
815
- * @private
816
- * @param {object} coords Cell coords.
817
- */
818
- onBeforeSetRangeEnd(coords) {
819
- const selRange = this.hot.getSelectedRangeLast();
820
- selRange.highlight = this.hot._createCellCoords(selRange.highlight.row, selRange.highlight.col); // clone in case we will modify its reference
821
- selRange.to = coords;
822
- let rangeExpanded = false;
823
- if (this.hot.selection.isSelectedByColumnHeader() || this.hot.selection.isSelectedByRowHeader()) {
824
- return;
825
- }
826
- do {
827
- rangeExpanded = false;
828
- for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
829
- const cellInfo = this.mergedCellsCollection.mergedCells[i];
830
- const mergedCellRange = cellInfo.getRange();
831
- if (selRange.expandByRange(mergedCellRange)) {
832
- coords.row = selRange.to.row;
833
- coords.col = selRange.to.col;
834
- rangeExpanded = true;
835
- }
836
- }
837
- } while (rangeExpanded);
838
- }
839
-
840
- /**
841
- * The `afterGetCellMeta` hook callback.
842
- *
843
- * @private
844
- * @param {number} row Row index.
845
- * @param {number} col Column index.
846
- * @param {object} cellProperties The cell properties object.
847
- */
848
- onAfterGetCellMeta(row, col, cellProperties) {
849
- const mergeParent = this.mergedCellsCollection.get(row, col);
850
- if (mergeParent) {
851
- if (mergeParent.row !== row || mergeParent.col !== col) {
852
- cellProperties.copyable = false;
853
- } else {
854
- cellProperties.rowspan = mergeParent.rowspan;
855
- cellProperties.colspan = mergeParent.colspan;
856
- }
857
- }
858
- }
859
-
860
- /**
861
- * `afterViewportRowCalculatorOverride` hook callback.
862
- *
863
- * @private
864
- * @param {object} calc The row calculator object.
865
- */
866
- onAfterViewportRowCalculatorOverride(calc) {
867
- const nrOfColumns = this.hot.countCols();
868
- this.modifyViewportRowStart(calc, nrOfColumns);
869
- this.modifyViewportRowEnd(calc, nrOfColumns);
870
- }
871
-
872
857
  /**
873
858
  * Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.
874
859
  *
@@ -926,18 +911,6 @@ class MergeCells extends _base.BasePlugin {
926
911
  }
927
912
  }
928
913
 
929
- /**
930
- * `afterViewportColumnCalculatorOverride` hook callback.
931
- *
932
- * @private
933
- * @param {object} calc The column calculator object.
934
- */
935
- onAfterViewportColumnCalculatorOverride(calc) {
936
- const nrOfRows = this.hot.countRows();
937
- this.modifyViewportColumnStart(calc, nrOfRows);
938
- this.modifyViewportColumnEnd(calc, nrOfRows);
939
- }
940
-
941
914
  /**
942
915
  * Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.
943
916
  *
@@ -1032,184 +1005,291 @@ class MergeCells extends _base.BasePlugin {
1032
1005
  const renderableColumn = parentColumn >= 0 ? columnMapper.getRenderableFromVisualIndex(firstNonHiddenColumn) : parentColumn;
1033
1006
  return [renderableRow, renderableColumn];
1034
1007
  }
1035
-
1036
- /**
1037
- * The `modifyAutofillRange` hook callback.
1038
- *
1039
- * @private
1040
- * @param {Array} drag The drag area coordinates.
1041
- * @param {Array} select The selection information.
1042
- * @returns {Array} The new drag area.
1043
- */
1044
- onModifyAutofillRange(drag, select) {
1045
- this.autofillCalculations.correctSelectionAreaSize(select);
1046
- const dragDirection = this.autofillCalculations.getDirection(select, drag);
1047
- let dragArea = drag;
1048
- if (this.autofillCalculations.dragAreaOverlapsCollections(select, dragArea, dragDirection)) {
1049
- dragArea = select;
1050
- return dragArea;
1051
- }
1052
- const mergedCellsWithinSelectionArea = this.mergedCellsCollection.getWithinRange({
1053
- from: {
1054
- row: select[0],
1055
- col: select[1]
1056
- },
1057
- to: {
1058
- row: select[2],
1059
- col: select[3]
1008
+ }
1009
+ exports.MergeCells = MergeCells;
1010
+ function _onAfterInit2() {
1011
+ this.generateFromSettings(this.hot.getSettings()[PLUGIN_KEY]);
1012
+ this.hot.render();
1013
+ }
1014
+ function _onAfterIsMultipleSelection2(isMultiple) {
1015
+ if (isMultiple) {
1016
+ const mergedCells = this.mergedCellsCollection.mergedCells;
1017
+ const selectionRange = this.hot.getSelectedRangeLast();
1018
+ for (let group = 0; group < mergedCells.length; group += 1) {
1019
+ 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) {
1020
+ return false;
1060
1021
  }
1061
- });
1062
- if (!mergedCellsWithinSelectionArea) {
1063
- return dragArea;
1064
1022
  }
1065
- dragArea = this.autofillCalculations.snapDragArea(select, dragArea, dragDirection, mergedCellsWithinSelectionArea);
1066
- return dragArea;
1067
1023
  }
1068
-
1069
- /**
1070
- * `afterCreateCol` hook callback.
1071
- *
1072
- * @private
1073
- * @param {number} column Column index.
1074
- * @param {number} count Number of created columns.
1075
- */
1076
- onAfterCreateCol(column, count) {
1077
- this.mergedCellsCollection.shiftCollections('right', column, count);
1078
- }
1079
-
1080
- /**
1081
- * `afterRemoveCol` hook callback.
1082
- *
1083
- * @private
1084
- * @param {number} column Column index.
1085
- * @param {number} count Number of removed columns.
1086
- */
1087
- onAfterRemoveCol(column, count) {
1088
- this.mergedCellsCollection.shiftCollections('left', column, count);
1024
+ return isMultiple;
1025
+ }
1026
+ function _onModifyTransformStart2(delta) {
1027
+ const currentlySelectedRange = this.hot.getSelectedRangeLast();
1028
+ let newDelta = {
1029
+ row: delta.row,
1030
+ col: delta.col
1031
+ };
1032
+ let nextPosition = null;
1033
+ const currentPosition = this.hot._createCellCoords(currentlySelectedRange.highlight.row, currentlySelectedRange.highlight.col);
1034
+ const mergedParent = this.mergedCellsCollection.get(currentPosition.row, currentPosition.col);
1035
+ if (!_classPrivateFieldGet(this, _lastDesiredCoords)) {
1036
+ _classPrivateFieldSet(this, _lastDesiredCoords, this.hot._createCellCoords(null, null));
1089
1037
  }
1038
+ if (mergedParent) {
1039
+ // only merge selected
1040
+ const mergeTopLeft = this.hot._createCellCoords(mergedParent.row, mergedParent.col);
1041
+ const mergeBottomRight = this.hot._createCellCoords(mergedParent.row + mergedParent.rowspan - 1, mergedParent.col + mergedParent.colspan - 1);
1042
+ const mergeRange = this.hot._createCellRange(mergeTopLeft, mergeTopLeft, mergeBottomRight);
1043
+ if (!mergeRange.includes(_classPrivateFieldGet(this, _lastDesiredCoords))) {
1044
+ _classPrivateFieldSet(this, _lastDesiredCoords, this.hot._createCellCoords(null, null)); // reset outdated version of lastDesiredCoords
1045
+ }
1090
1046
 
1091
- /**
1092
- * `afterCreateRow` hook callback.
1093
- *
1094
- * @private
1095
- * @param {number} row Row index.
1096
- * @param {number} count Number of created rows.
1097
- * @param {string} source Source of change.
1098
- */
1099
- onAfterCreateRow(row, count, source) {
1100
- if (source === 'auto') {
1101
- return;
1047
+ newDelta.row = _classPrivateFieldGet(this, _lastDesiredCoords).row ? _classPrivateFieldGet(this, _lastDesiredCoords).row - currentPosition.row : newDelta.row;
1048
+ newDelta.col = _classPrivateFieldGet(this, _lastDesiredCoords).col ? _classPrivateFieldGet(this, _lastDesiredCoords).col - currentPosition.col : newDelta.col;
1049
+ if (delta.row > 0) {
1050
+ // moving down
1051
+ newDelta.row = mergedParent.row + mergedParent.rowspan - 1 - currentPosition.row + delta.row;
1052
+ } else if (delta.row < 0) {
1053
+ // moving up
1054
+ newDelta.row = currentPosition.row - mergedParent.row + delta.row;
1055
+ }
1056
+ if (delta.col > 0) {
1057
+ // moving right
1058
+ newDelta.col = mergedParent.col + mergedParent.colspan - 1 - currentPosition.col + delta.col;
1059
+ } else if (delta.col < 0) {
1060
+ // moving left
1061
+ newDelta.col = currentPosition.col - mergedParent.col + delta.col;
1102
1062
  }
1103
- this.mergedCellsCollection.shiftCollections('down', row, count);
1104
1063
  }
1105
-
1106
- /**
1107
- * `afterRemoveRow` hook callback.
1108
- *
1109
- * @private
1110
- * @param {number} row Row index.
1111
- * @param {number} count Number of removed rows.
1112
- */
1113
- onAfterRemoveRow(row, count) {
1114
- this.mergedCellsCollection.shiftCollections('up', row, count);
1064
+ nextPosition = this.hot._createCellCoords(currentlySelectedRange.highlight.row + newDelta.row, currentlySelectedRange.highlight.col + newDelta.col);
1065
+ const nextPositionMergedCell = this.mergedCellsCollection.get(nextPosition.row, nextPosition.col);
1066
+ if (nextPositionMergedCell) {
1067
+ // skipping the invisible cells in the merge range
1068
+ const firstRenderableCoords = this.mergedCellsCollection.getFirstRenderableCoords(nextPositionMergedCell.row, nextPositionMergedCell.col);
1069
+ _classPrivateFieldSet(this, _lastDesiredCoords, nextPosition);
1070
+ newDelta = {
1071
+ row: firstRenderableCoords.row - currentPosition.row,
1072
+ col: firstRenderableCoords.col - currentPosition.col
1073
+ };
1115
1074
  }
1116
-
1117
- /**
1118
- * `afterChange` hook callback. Used to propagate merged cells after using Autofill.
1119
- *
1120
- * @private
1121
- * @param {Array} changes The changes array.
1122
- * @param {string} source Determines the source of the change.
1123
- */
1124
- onAfterChange(changes, source) {
1125
- if (source !== 'Autofill.fill') {
1126
- return;
1127
- }
1128
- this.autofillCalculations.recreateAfterDataPopulation(changes);
1075
+ if (newDelta.row !== 0) {
1076
+ delta.row = newDelta.row;
1129
1077
  }
1130
-
1131
- /**
1132
- * `beforeDrawAreaBorders` hook callback.
1133
- *
1134
- * @private
1135
- * @param {Array} corners Visual coordinates of the area corners.
1136
- * @param {string} className Class name for the area.
1137
- */
1138
- onBeforeDrawAreaBorders(corners, className) {
1139
- if (className && className === 'area') {
1140
- const selectedRange = this.hot.getSelectedRangeLast();
1141
- const mergedCellsWithinRange = this.mergedCellsCollection.getWithinRange(selectedRange);
1142
- (0, _array.arrayEach)(mergedCellsWithinRange, mergedCell => {
1143
- if (selectedRange.getBottomEndCorner().row === mergedCell.getLastRow() && selectedRange.getBottomEndCorner().col === mergedCell.getLastColumn()) {
1144
- corners[2] = mergedCell.row;
1145
- corners[3] = mergedCell.col;
1146
- }
1147
- });
1148
- }
1078
+ if (newDelta.col !== 0) {
1079
+ delta.col = newDelta.col;
1149
1080
  }
1150
-
1151
- /**
1152
- * `afterModifyTransformStart` hook callback. Fixes a problem with navigating through merged cells at the edges of
1153
- * the table with the ENTER/SHIFT+ENTER/TAB/SHIFT+TAB keys.
1154
- *
1155
- * @private
1156
- * @param {CellCoords} coords Coordinates of the to-be-selected cell.
1157
- * @param {number} rowTransformDir Row transformation direction (negative value = up, 0 = none, positive value =
1158
- * down).
1159
- * @param {number} colTransformDir Column transformation direction (negative value = up, 0 = none, positive value =
1160
- * down).
1161
- */
1162
- onAfterModifyTransformStart(coords, rowTransformDir, colTransformDir) {
1163
- if (!this.enabled) {
1164
- return;
1165
- }
1166
- const mergedCellAtCoords = this.mergedCellsCollection.get(coords.row, coords.col);
1167
- if (!mergedCellAtCoords) {
1168
- return;
1081
+ }
1082
+ function _onModifyTransformEnd2(delta) {
1083
+ const currentSelectionRange = this.hot.getSelectedRangeLast();
1084
+ const newDelta = (0, _object.clone)(delta);
1085
+ const newSelectionRange = this.selectionCalculations.getUpdatedSelectionRange(currentSelectionRange, delta);
1086
+ let tempDelta = (0, _object.clone)(newDelta);
1087
+ const mergedCellsWithinRange = this.mergedCellsCollection.getWithinRange(newSelectionRange, true);
1088
+ do {
1089
+ tempDelta = (0, _object.clone)(newDelta);
1090
+ this.selectionCalculations.getUpdatedSelectionRange(currentSelectionRange, newDelta);
1091
+ (0, _array.arrayEach)(mergedCellsWithinRange, mergedCell => {
1092
+ this.selectionCalculations.snapDelta(newDelta, currentSelectionRange, mergedCell);
1093
+ });
1094
+ } while (newDelta.row !== tempDelta.row || newDelta.col !== tempDelta.col);
1095
+ delta.row = newDelta.row;
1096
+ delta.col = newDelta.col;
1097
+ }
1098
+ function _onModifyGetCellCoords2(row, column) {
1099
+ if (row < 0 || column < 0) {
1100
+ return;
1101
+ }
1102
+ const mergeParent = this.mergedCellsCollection.get(row, column);
1103
+ if (!mergeParent) {
1104
+ return;
1105
+ }
1106
+ const {
1107
+ row: mergeRow,
1108
+ col: mergeColumn,
1109
+ colspan,
1110
+ rowspan
1111
+ } = mergeParent;
1112
+ return [
1113
+ // Most top-left merged cell coords.
1114
+ mergeRow, mergeColumn,
1115
+ // Most bottom-right merged cell coords.
1116
+ mergeRow + rowspan - 1, mergeColumn + colspan - 1];
1117
+ }
1118
+ function _addMergeActionsToContextMenu2(defaultOptions) {
1119
+ defaultOptions.items.push({
1120
+ name: '---------'
1121
+ }, (0, _toggleMerge.default)(this));
1122
+ }
1123
+ function _onAfterRenderer2(TD, row, col) {
1124
+ const mergedCell = this.mergedCellsCollection.get(row, col);
1125
+ // We shouldn't override data in the collection.
1126
+ const mergedCellCopy = (0, _object.isObject)(mergedCell) ? (0, _object.clone)(mergedCell) : undefined;
1127
+ if ((0, _object.isObject)(mergedCellCopy)) {
1128
+ const {
1129
+ rowIndexMapper: rowMapper,
1130
+ columnIndexMapper: columnMapper
1131
+ } = this.hot;
1132
+ const {
1133
+ row: mergeRow,
1134
+ col: mergeColumn,
1135
+ colspan,
1136
+ rowspan
1137
+ } = mergedCellCopy;
1138
+ const [lastMergedRowIndex, lastMergedColumnIndex] = this.translateMergedCellToRenderable(mergeRow, rowspan, mergeColumn, colspan);
1139
+ const renderedRowIndex = rowMapper.getRenderableFromVisualIndex(row);
1140
+ const renderedColumnIndex = columnMapper.getRenderableFromVisualIndex(col);
1141
+ const maxRowSpan = lastMergedRowIndex - renderedRowIndex + 1; // Number of rendered columns.
1142
+ const maxColSpan = lastMergedColumnIndex - renderedColumnIndex + 1; // Number of rendered columns.
1143
+
1144
+ // We just try to determine some values basing on the actual number of rendered indexes (some columns may be hidden).
1145
+ mergedCellCopy.row = rowMapper.getNearestNotHiddenIndex(mergedCellCopy.row, 1);
1146
+ // We just try to determine some values basing on the actual number of rendered indexes (some columns may be hidden).
1147
+ mergedCellCopy.col = columnMapper.getNearestNotHiddenIndex(mergedCellCopy.col, 1);
1148
+ // The `rowSpan` property for a `TD` element should be at most equal to number of rendered rows in the merge area.
1149
+ mergedCellCopy.rowspan = Math.min(mergedCellCopy.rowspan, maxRowSpan);
1150
+ // The `colSpan` property for a `TD` element should be at most equal to number of rendered columns in the merge area.
1151
+ mergedCellCopy.colspan = Math.min(mergedCellCopy.colspan, maxColSpan);
1152
+ }
1153
+ (0, _utils.applySpanProperties)(TD, mergedCellCopy, row, col);
1154
+ }
1155
+ function _onBeforeSetRangeStart2(coords) {
1156
+ // TODO: It is a workaround, but probably this hook may be needed. Every selection on the merge area
1157
+ // could set start point of the selection to the start of the merge area. However, logic inside `expandByRange` need
1158
+ // an initial start point. Click on the merge cell when there are some hidden indexes break the logic in some cases.
1159
+ // Please take a look at #7010 for more information. I'm not sure if selection directions are calculated properly
1160
+ // and what was idea for flipping direction inside `expandByRange` method.
1161
+ if (this.mergedCellsCollection.isFirstRenderableMergedCell(coords.row, coords.col)) {
1162
+ const mergeParent = this.mergedCellsCollection.get(coords.row, coords.col);
1163
+ [coords.row, coords.col] = [mergeParent.row, mergeParent.col];
1164
+ }
1165
+ }
1166
+ function _onBeforeSetRangeEnd2(coords) {
1167
+ const selRange = this.hot.getSelectedRangeLast();
1168
+ selRange.highlight = this.hot._createCellCoords(selRange.highlight.row, selRange.highlight.col); // clone in case we will modify its reference
1169
+ selRange.to = coords;
1170
+ let rangeExpanded = false;
1171
+ if (this.hot.selection.isSelectedByColumnHeader() || this.hot.selection.isSelectedByRowHeader()) {
1172
+ return;
1173
+ }
1174
+ do {
1175
+ rangeExpanded = false;
1176
+ for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
1177
+ const cellInfo = this.mergedCellsCollection.mergedCells[i];
1178
+ const mergedCellRange = cellInfo.getRange();
1179
+ if (selRange.expandByRange(mergedCellRange)) {
1180
+ coords.row = selRange.to.row;
1181
+ coords.col = selRange.to.col;
1182
+ rangeExpanded = true;
1183
+ }
1169
1184
  }
1170
- const goingDown = rowTransformDir > 0;
1171
- const goingUp = rowTransformDir < 0;
1172
- const goingLeft = colTransformDir < 0;
1173
- const goingRight = colTransformDir > 0;
1174
- const mergedCellOnBottomEdge = mergedCellAtCoords.row + mergedCellAtCoords.rowspan - 1 === this.hot.countRows() - 1;
1175
- const mergedCellOnTopEdge = mergedCellAtCoords.row === 0;
1176
- const mergedCellOnRightEdge = mergedCellAtCoords.col + mergedCellAtCoords.colspan - 1 === this.hot.countCols() - 1;
1177
- const mergedCellOnLeftEdge = mergedCellAtCoords.col === 0;
1178
- if (goingDown && mergedCellOnBottomEdge || goingUp && mergedCellOnTopEdge || goingRight && mergedCellOnRightEdge || goingLeft && mergedCellOnLeftEdge) {
1179
- coords.row = mergedCellAtCoords.row;
1180
- coords.col = mergedCellAtCoords.col;
1185
+ } while (rangeExpanded);
1186
+ }
1187
+ function _onAfterGetCellMeta2(row, col, cellProperties) {
1188
+ const mergeParent = this.mergedCellsCollection.get(row, col);
1189
+ if (mergeParent) {
1190
+ if (mergeParent.row !== row || mergeParent.col !== col) {
1191
+ cellProperties.copyable = false;
1192
+ } else {
1193
+ cellProperties.rowspan = mergeParent.rowspan;
1194
+ cellProperties.colspan = mergeParent.colspan;
1181
1195
  }
1182
1196
  }
1183
-
1184
- /**
1185
- * `afterDrawSelection` hook callback. Used to add the additional class name for the entirely-selected merged cells.
1186
- *
1187
- * @private
1188
- * @param {number} currentRow Visual row index of the currently processed cell.
1189
- * @param {number} currentColumn Visual column index of the currently cell.
1190
- * @param {Array} cornersOfSelection Array of the current selection in a form of `[startRow, startColumn, endRow,
1191
- * endColumn]`.
1192
- * @param {number|undefined} layerLevel Number indicating which layer of selection is currently processed.
1193
- * @returns {string|undefined} A `String`, which will act as an additional `className` to be added to the currently
1194
- * processed cell.
1195
- */
1196
- onAfterDrawSelection(currentRow, currentColumn, cornersOfSelection, layerLevel) {
1197
- // Nothing's selected (hook might be triggered by the custom borders)
1198
- if (!cornersOfSelection) {
1199
- return;
1197
+ }
1198
+ function _onAfterViewportRowCalculatorOverride2(calc) {
1199
+ const nrOfColumns = this.hot.countCols();
1200
+ this.modifyViewportRowStart(calc, nrOfColumns);
1201
+ this.modifyViewportRowEnd(calc, nrOfColumns);
1202
+ }
1203
+ function _onAfterViewportColumnCalculatorOverride2(calc) {
1204
+ const nrOfRows = this.hot.countRows();
1205
+ this.modifyViewportColumnStart(calc, nrOfRows);
1206
+ this.modifyViewportColumnEnd(calc, nrOfRows);
1207
+ }
1208
+ function _onModifyAutofillRange2(drag, select) {
1209
+ this.autofillCalculations.correctSelectionAreaSize(select);
1210
+ const dragDirection = this.autofillCalculations.getDirection(select, drag);
1211
+ let dragArea = drag;
1212
+ if (this.autofillCalculations.dragAreaOverlapsCollections(select, dragArea, dragDirection)) {
1213
+ dragArea = select;
1214
+ return dragArea;
1215
+ }
1216
+ const mergedCellsWithinSelectionArea = this.mergedCellsCollection.getWithinRange({
1217
+ from: {
1218
+ row: select[0],
1219
+ col: select[1]
1220
+ },
1221
+ to: {
1222
+ row: select[2],
1223
+ col: select[3]
1200
1224
  }
1201
- return this.selectionCalculations.getSelectedMergedCellClassName(currentRow, currentColumn, cornersOfSelection, layerLevel);
1225
+ });
1226
+ if (!mergedCellsWithinSelectionArea) {
1227
+ return dragArea;
1202
1228
  }
1203
-
1204
- /**
1205
- * `beforeRemoveCellClassNames` hook callback. Used to remove additional class name from all cells in the table.
1206
- *
1207
- * @private
1208
- * @returns {string[]} An `Array` of `String`s. Each of these strings will act like class names to be removed from
1209
- * all the cells in the table.
1210
- */
1211
- onBeforeRemoveCellClassNames() {
1212
- return this.selectionCalculations.getSelectedMergedCellClassNameToRemove();
1229
+ dragArea = this.autofillCalculations.snapDragArea(select, dragArea, dragDirection, mergedCellsWithinSelectionArea);
1230
+ return dragArea;
1231
+ }
1232
+ function _onAfterCreateCol2(column, count) {
1233
+ this.mergedCellsCollection.shiftCollections('right', column, count);
1234
+ }
1235
+ function _onAfterRemoveCol2(column, count) {
1236
+ this.mergedCellsCollection.shiftCollections('left', column, count);
1237
+ }
1238
+ function _onAfterCreateRow2(row, count, source) {
1239
+ if (source === 'auto') {
1240
+ return;
1241
+ }
1242
+ this.mergedCellsCollection.shiftCollections('down', row, count);
1243
+ }
1244
+ function _onAfterRemoveRow2(row, count) {
1245
+ this.mergedCellsCollection.shiftCollections('up', row, count);
1246
+ }
1247
+ function _onAfterChange2(changes, source) {
1248
+ if (source !== 'Autofill.fill') {
1249
+ return;
1250
+ }
1251
+ this.autofillCalculations.recreateAfterDataPopulation(changes);
1252
+ }
1253
+ function _onBeforeDrawAreaBorders2(corners, className) {
1254
+ if (className && className === 'area') {
1255
+ const selectedRange = this.hot.getSelectedRangeLast();
1256
+ const mergedCellsWithinRange = this.mergedCellsCollection.getWithinRange(selectedRange);
1257
+ (0, _array.arrayEach)(mergedCellsWithinRange, mergedCell => {
1258
+ if (selectedRange.getBottomEndCorner().row === mergedCell.getLastRow() && selectedRange.getBottomEndCorner().col === mergedCell.getLastColumn()) {
1259
+ corners[2] = mergedCell.row;
1260
+ corners[3] = mergedCell.col;
1261
+ }
1262
+ });
1263
+ }
1264
+ }
1265
+ function _onAfterModifyTransformStart2(coords, rowTransformDir, colTransformDir) {
1266
+ if (!this.enabled) {
1267
+ return;
1268
+ }
1269
+ const mergedCellAtCoords = this.mergedCellsCollection.get(coords.row, coords.col);
1270
+ if (!mergedCellAtCoords) {
1271
+ return;
1272
+ }
1273
+ const goingDown = rowTransformDir > 0;
1274
+ const goingUp = rowTransformDir < 0;
1275
+ const goingLeft = colTransformDir < 0;
1276
+ const goingRight = colTransformDir > 0;
1277
+ const mergedCellOnBottomEdge = mergedCellAtCoords.row + mergedCellAtCoords.rowspan - 1 === this.hot.countRows() - 1;
1278
+ const mergedCellOnTopEdge = mergedCellAtCoords.row === 0;
1279
+ const mergedCellOnRightEdge = mergedCellAtCoords.col + mergedCellAtCoords.colspan - 1 === this.hot.countCols() - 1;
1280
+ const mergedCellOnLeftEdge = mergedCellAtCoords.col === 0;
1281
+ if (goingDown && mergedCellOnBottomEdge || goingUp && mergedCellOnTopEdge || goingRight && mergedCellOnRightEdge || goingLeft && mergedCellOnLeftEdge) {
1282
+ coords.row = mergedCellAtCoords.row;
1283
+ coords.col = mergedCellAtCoords.col;
1284
+ }
1285
+ }
1286
+ function _onAfterDrawSelection2(currentRow, currentColumn, cornersOfSelection, layerLevel) {
1287
+ // Nothing's selected (hook might be triggered by the custom borders)
1288
+ if (!cornersOfSelection) {
1289
+ return;
1213
1290
  }
1291
+ return this.selectionCalculations.getSelectedMergedCellClassName(currentRow, currentColumn, cornersOfSelection, layerLevel);
1214
1292
  }
1215
- exports.MergeCells = MergeCells;
1293
+ function _onBeforeRemoveCellClassNames2() {
1294
+ return this.selectionCalculations.getSelectedMergedCellClassNameToRemove();
1295
+ }