handsontable 0.0.0-next-7026906-20231107 → 0.0.0-next-7b93b7d-20231107

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of handsontable might be problematic. Click here for more details.

Files changed (316) 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/core/clone.js +6 -0
  10. package/3rdparty/walkontable/src/core/clone.mjs +6 -0
  11. package/3rdparty/walkontable/src/event.js +125 -74
  12. package/3rdparty/walkontable/src/event.mjs +125 -74
  13. package/3rdparty/walkontable/src/filter/column.js +16 -0
  14. package/3rdparty/walkontable/src/filter/column.mjs +16 -0
  15. package/3rdparty/walkontable/src/filter/row.js +16 -0
  16. package/3rdparty/walkontable/src/filter/row.mjs +16 -0
  17. package/3rdparty/walkontable/src/overlay/bottom.js +1 -1
  18. package/3rdparty/walkontable/src/overlay/bottom.mjs +1 -1
  19. package/3rdparty/walkontable/src/overlay/top.js +1 -1
  20. package/3rdparty/walkontable/src/overlay/top.mjs +1 -1
  21. package/3rdparty/walkontable/src/renderer/_base.js +12 -5
  22. package/3rdparty/walkontable/src/renderer/_base.mjs +12 -5
  23. package/3rdparty/walkontable/src/renderer/cells.js +6 -2
  24. package/3rdparty/walkontable/src/renderer/cells.mjs +6 -2
  25. package/3rdparty/walkontable/src/renderer/rowHeaders.js +6 -2
  26. package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +6 -2
  27. package/3rdparty/walkontable/src/renderer/rows.js +5 -0
  28. package/3rdparty/walkontable/src/renderer/rows.mjs +5 -0
  29. package/3rdparty/walkontable/src/renderer/table.js +24 -17
  30. package/3rdparty/walkontable/src/renderer/table.mjs +24 -17
  31. package/3rdparty/walkontable/src/scroll.js +2 -2
  32. package/3rdparty/walkontable/src/scroll.mjs +2 -2
  33. package/3rdparty/walkontable/src/selection/border/border.js +1 -1
  34. package/3rdparty/walkontable/src/selection/border/border.mjs +1 -1
  35. package/3rdparty/walkontable/src/settings.js +10 -10
  36. package/3rdparty/walkontable/src/settings.mjs +10 -10
  37. package/3rdparty/walkontable/src/table.js +3 -3
  38. package/3rdparty/walkontable/src/table.mjs +3 -3
  39. package/3rdparty/walkontable/src/utils/column.js +19 -4
  40. package/3rdparty/walkontable/src/utils/column.mjs +19 -4
  41. package/3rdparty/walkontable/src/utils/nodesPool.js +5 -0
  42. package/3rdparty/walkontable/src/utils/nodesPool.mjs +5 -0
  43. package/3rdparty/walkontable/src/utils/orderView/view.js +13 -6
  44. package/3rdparty/walkontable/src/utils/orderView/view.mjs +13 -6
  45. package/3rdparty/walkontable/src/utils/orderView/viewSize.js +9 -6
  46. package/3rdparty/walkontable/src/utils/orderView/viewSize.mjs +9 -6
  47. package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.js +7 -4
  48. package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.mjs +7 -4
  49. package/3rdparty/walkontable/src/utils/row.js +14 -2
  50. package/3rdparty/walkontable/src/utils/row.mjs +14 -2
  51. package/3rdparty/walkontable/src/viewport.js +9 -9
  52. package/3rdparty/walkontable/src/viewport.mjs +9 -9
  53. package/base.js +2 -2
  54. package/base.mjs +2 -2
  55. package/core.js +25 -25
  56. package/core.mjs +25 -25
  57. package/dataMap/dataMap.js +99 -90
  58. package/dataMap/dataMap.mjs +99 -90
  59. package/dataMap/dataSource.js +14 -8
  60. package/dataMap/dataSource.mjs +14 -8
  61. package/dataMap/metaManager/lazyFactoryMap.js +19 -7
  62. package/dataMap/metaManager/lazyFactoryMap.mjs +19 -7
  63. package/dataMap/metaManager/metaLayers/cellMeta.js +8 -3
  64. package/dataMap/metaManager/metaLayers/cellMeta.mjs +8 -3
  65. package/dataMap/metaManager/metaLayers/columnMeta.js +7 -1
  66. package/dataMap/metaManager/metaLayers/columnMeta.mjs +7 -1
  67. package/dataMap/metaManager/metaLayers/globalMeta.js +6 -1
  68. package/dataMap/metaManager/metaLayers/globalMeta.mjs +6 -1
  69. package/dataMap/metaManager/metaLayers/tableMeta.js +6 -2
  70. package/dataMap/metaManager/metaLayers/tableMeta.mjs +6 -2
  71. package/dataMap/metaManager/metaSchema.js +55 -55
  72. package/dataMap/metaManager/metaSchema.mjs +55 -55
  73. package/dataMap/metaManager/mods/dynamicCellMeta.js +7 -2
  74. package/dataMap/metaManager/mods/dynamicCellMeta.mjs +7 -2
  75. package/dataMap/metaManager/mods/extendMetaProperties.js +8 -4
  76. package/dataMap/metaManager/mods/extendMetaProperties.mjs +8 -4
  77. package/dataMap/metaManager/utils.js +2 -2
  78. package/dataMap/metaManager/utils.mjs +2 -2
  79. package/dist/handsontable.css +2 -2
  80. package/dist/handsontable.full.css +2 -2
  81. package/dist/handsontable.full.js +7244 -6347
  82. package/dist/handsontable.full.min.css +2 -2
  83. package/dist/handsontable.full.min.js +120 -120
  84. package/dist/handsontable.js +7243 -6346
  85. package/dist/handsontable.min.css +2 -2
  86. package/dist/handsontable.min.js +28 -28
  87. package/editorManager.js +105 -95
  88. package/editorManager.mjs +105 -95
  89. package/editors/autocompleteEditor/autocompleteEditor.js +47 -46
  90. package/editors/autocompleteEditor/autocompleteEditor.mjs +46 -45
  91. package/editors/baseEditor/baseEditor.js +23 -26
  92. package/editors/baseEditor/baseEditor.mjs +23 -26
  93. package/editors/dateEditor/dateEditor.js +24 -15
  94. package/editors/dateEditor/dateEditor.mjs +24 -15
  95. package/editors/dropdownEditor/dropdownEditor.js +1 -1
  96. package/editors/dropdownEditor/dropdownEditor.mjs +1 -1
  97. package/editors/handsontableEditor/handsontableEditor.js +4 -4
  98. package/editors/handsontableEditor/handsontableEditor.mjs +4 -4
  99. package/editors/textEditor/textEditor.js +23 -17
  100. package/editors/textEditor/textEditor.mjs +24 -18
  101. package/eventManager.js +8 -0
  102. package/eventManager.mjs +8 -0
  103. package/helpers/array.js +2 -2
  104. package/helpers/array.mjs +2 -2
  105. package/helpers/dom/element.js +7 -7
  106. package/helpers/dom/element.mjs +7 -7
  107. package/helpers/function.js +1 -1
  108. package/helpers/function.mjs +1 -1
  109. package/helpers/mixed.js +1 -1
  110. package/helpers/mixed.mjs +1 -1
  111. package/helpers/object.js +4 -4
  112. package/helpers/object.mjs +4 -4
  113. package/helpers/string.js +1 -1
  114. package/helpers/string.mjs +1 -1
  115. package/package.json +1 -1
  116. package/pluginHooks.d.ts +0 -2
  117. package/pluginHooks.js +12 -3
  118. package/pluginHooks.mjs +12 -3
  119. package/plugins/autoColumnSize/autoColumnSize.js +141 -130
  120. package/plugins/autoColumnSize/autoColumnSize.mjs +140 -129
  121. package/plugins/autoRowSize/autoRowSize.js +112 -125
  122. package/plugins/autoRowSize/autoRowSize.mjs +110 -123
  123. package/plugins/autofill/autofill.js +97 -102
  124. package/plugins/autofill/autofill.mjs +96 -101
  125. package/plugins/base/base.js +57 -22
  126. package/plugins/base/base.mjs +56 -22
  127. package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +29 -24
  128. package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +28 -23
  129. package/plugins/collapsibleColumns/collapsibleColumns.js +104 -107
  130. package/plugins/collapsibleColumns/collapsibleColumns.mjs +102 -104
  131. package/plugins/columnSorting/columnSorting.js +105 -98
  132. package/plugins/columnSorting/columnSorting.mjs +104 -97
  133. package/plugins/columnSorting/columnStatesManager.js +12 -6
  134. package/plugins/columnSorting/columnStatesManager.mjs +12 -6
  135. package/plugins/columnSummary/columnSummary.js +71 -58
  136. package/plugins/columnSummary/columnSummary.mjs +70 -57
  137. package/plugins/columnSummary/endpoints.js +20 -14
  138. package/plugins/columnSummary/endpoints.mjs +20 -14
  139. package/plugins/comments/commentEditor.js +30 -2
  140. package/plugins/comments/commentEditor.mjs +30 -2
  141. package/plugins/comments/comments.js +158 -169
  142. package/plugins/comments/comments.mjs +157 -168
  143. package/plugins/comments/displaySwitch.js +7 -3
  144. package/plugins/comments/displaySwitch.mjs +7 -3
  145. package/plugins/contextMenu/commandExecutor.js +15 -2
  146. package/plugins/contextMenu/commandExecutor.mjs +15 -2
  147. package/plugins/contextMenu/contextMenu.js +91 -101
  148. package/plugins/contextMenu/contextMenu.mjs +90 -100
  149. package/plugins/contextMenu/itemsFactory.js +19 -4
  150. package/plugins/contextMenu/itemsFactory.mjs +19 -4
  151. package/plugins/contextMenu/menu/cursor.js +36 -0
  152. package/plugins/contextMenu/menu/cursor.mjs +36 -0
  153. package/plugins/contextMenu/menu/menu.js +57 -5
  154. package/plugins/contextMenu/menu/menu.mjs +57 -5
  155. package/plugins/copyPaste/copyPaste.js +74 -75
  156. package/plugins/copyPaste/copyPaste.mjs +74 -75
  157. package/plugins/customBorders/customBorders.js +49 -48
  158. package/plugins/customBorders/customBorders.mjs +48 -47
  159. package/plugins/dragToScroll/dragToScroll.js +50 -54
  160. package/plugins/dragToScroll/dragToScroll.mjs +49 -52
  161. package/plugins/dropdownMenu/dropdownMenu.js +132 -129
  162. package/plugins/dropdownMenu/dropdownMenu.mjs +132 -129
  163. package/plugins/exportFile/dataProvider.js +7 -2
  164. package/plugins/exportFile/dataProvider.mjs +7 -2
  165. package/plugins/exportFile/exportFile.js +1 -1
  166. package/plugins/exportFile/exportFile.mjs +1 -1
  167. package/plugins/exportFile/types/_base.js +14 -6
  168. package/plugins/exportFile/types/_base.mjs +14 -6
  169. package/plugins/filters/component/actionBar.js +9 -0
  170. package/plugins/filters/component/actionBar.mjs +9 -0
  171. package/plugins/filters/component/condition.js +13 -0
  172. package/plugins/filters/component/condition.mjs +13 -0
  173. package/plugins/filters/component/operators.js +9 -0
  174. package/plugins/filters/component/operators.mjs +9 -0
  175. package/plugins/filters/component/value.js +9 -0
  176. package/plugins/filters/component/value.mjs +9 -0
  177. package/plugins/filters/conditionCollection.js +9 -4
  178. package/plugins/filters/conditionCollection.mjs +9 -4
  179. package/plugins/filters/conditionUpdateObserver.js +53 -42
  180. package/plugins/filters/conditionUpdateObserver.mjs +53 -42
  181. package/plugins/filters/dataFilter.js +9 -3
  182. package/plugins/filters/dataFilter.mjs +9 -3
  183. package/plugins/filters/filters.js +184 -189
  184. package/plugins/filters/filters.mjs +182 -187
  185. package/plugins/filters/ui/_base.js +1 -1
  186. package/plugins/filters/ui/_base.mjs +1 -1
  187. package/plugins/filters/utils.js +1 -1
  188. package/plugins/filters/utils.mjs +1 -1
  189. package/plugins/formulas/engine/settings.js +1 -1
  190. package/plugins/formulas/engine/settings.mjs +1 -1
  191. package/plugins/formulas/formulas.js +684 -602
  192. package/plugins/formulas/formulas.mjs +682 -600
  193. package/plugins/hiddenColumns/hiddenColumns.js +174 -169
  194. package/plugins/hiddenColumns/hiddenColumns.mjs +173 -168
  195. package/plugins/hiddenRows/hiddenRows.js +170 -165
  196. package/plugins/hiddenRows/hiddenRows.mjs +169 -164
  197. package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +1 -1
  198. package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.mjs +1 -1
  199. package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +1 -1
  200. package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.mjs +1 -1
  201. package/plugins/manualColumnFreeze/manualColumnFreeze.js +67 -54
  202. package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +64 -51
  203. package/plugins/manualColumnMove/manualColumnMove.js +287 -232
  204. package/plugins/manualColumnMove/manualColumnMove.mjs +286 -231
  205. package/plugins/manualColumnMove/ui/_base.js +9 -3
  206. package/plugins/manualColumnMove/ui/_base.mjs +9 -3
  207. package/plugins/manualColumnResize/manualColumnResize.js +291 -246
  208. package/plugins/manualColumnResize/manualColumnResize.mjs +290 -244
  209. package/plugins/manualRowMove/manualRowMove.js +223 -208
  210. package/plugins/manualRowMove/manualRowMove.mjs +222 -207
  211. package/plugins/manualRowMove/ui/_base.js +10 -5
  212. package/plugins/manualRowMove/ui/_base.mjs +10 -5
  213. package/plugins/manualRowResize/manualRowResize.js +254 -209
  214. package/plugins/manualRowResize/manualRowResize.mjs +253 -207
  215. package/plugins/mergeCells/calculations/autofill.js +9 -3
  216. package/plugins/mergeCells/calculations/autofill.mjs +9 -3
  217. package/plugins/mergeCells/calculations/selection.js +10 -4
  218. package/plugins/mergeCells/calculations/selection.mjs +10 -4
  219. package/plugins/mergeCells/cellCoords.js +16 -6
  220. package/plugins/mergeCells/cellCoords.mjs +16 -6
  221. package/plugins/mergeCells/cellsCollection.js +10 -4
  222. package/plugins/mergeCells/cellsCollection.mjs +10 -4
  223. package/plugins/mergeCells/mergeCells.js +582 -502
  224. package/plugins/mergeCells/mergeCells.mjs +580 -500
  225. package/plugins/multiColumnSorting/multiColumnSorting.js +13 -10
  226. package/plugins/multiColumnSorting/multiColumnSorting.mjs +13 -10
  227. package/plugins/multipleSelectionHandles/multipleSelectionHandles.js +16 -28
  228. package/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs +16 -27
  229. package/plugins/nestedHeaders/nestedHeaders.js +542 -499
  230. package/plugins/nestedHeaders/nestedHeaders.mjs +554 -511
  231. package/plugins/nestedHeaders/stateManager/index.js +1 -1
  232. package/plugins/nestedHeaders/stateManager/index.mjs +1 -1
  233. package/plugins/nestedRows/data/dataManager.js +21 -15
  234. package/plugins/nestedRows/data/dataManager.mjs +21 -15
  235. package/plugins/nestedRows/nestedRows.js +326 -278
  236. package/plugins/nestedRows/nestedRows.mjs +325 -277
  237. package/plugins/nestedRows/ui/_base.js +7 -1
  238. package/plugins/nestedRows/ui/_base.mjs +7 -1
  239. package/plugins/nestedRows/ui/collapsing.js +2 -2
  240. package/plugins/nestedRows/ui/collapsing.mjs +2 -2
  241. package/plugins/nestedRows/ui/contextMenu.js +28 -18
  242. package/plugins/nestedRows/ui/contextMenu.mjs +28 -18
  243. package/plugins/nestedRows/utils/rowMoveController.js +12 -4
  244. package/plugins/nestedRows/utils/rowMoveController.mjs +12 -4
  245. package/plugins/persistentState/persistentState.js +14 -11
  246. package/plugins/persistentState/persistentState.mjs +14 -11
  247. package/plugins/persistentState/storage.js +11 -6
  248. package/plugins/persistentState/storage.mjs +11 -6
  249. package/plugins/registry.js +2 -2
  250. package/plugins/registry.mjs +2 -2
  251. package/plugins/search/search.js +57 -46
  252. package/plugins/search/search.mjs +56 -45
  253. package/plugins/touchScroll/touchScroll.js +102 -100
  254. package/plugins/touchScroll/touchScroll.mjs +100 -98
  255. package/plugins/trimRows/trimRows.js +33 -28
  256. package/plugins/trimRows/trimRows.mjs +32 -27
  257. package/plugins/undoRedo/undoRedo.js +2 -2
  258. package/plugins/undoRedo/undoRedo.mjs +2 -2
  259. package/renderers/autocompleteRenderer/autocompleteRenderer.js +11 -11
  260. package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +11 -11
  261. package/renderers/baseRenderer/baseRenderer.js +2 -2
  262. package/renderers/baseRenderer/baseRenderer.mjs +2 -2
  263. package/renderers/checkboxRenderer/checkboxRenderer.js +23 -23
  264. package/renderers/checkboxRenderer/checkboxRenderer.mjs +23 -23
  265. package/renderers/dateRenderer/dateRenderer.js +4 -4
  266. package/renderers/dateRenderer/dateRenderer.mjs +4 -4
  267. package/renderers/handsontableRenderer/handsontableRenderer.js +4 -4
  268. package/renderers/handsontableRenderer/handsontableRenderer.mjs +4 -4
  269. package/renderers/htmlRenderer/htmlRenderer.js +4 -4
  270. package/renderers/htmlRenderer/htmlRenderer.mjs +4 -4
  271. package/renderers/numericRenderer/numericRenderer.js +3 -3
  272. package/renderers/numericRenderer/numericRenderer.mjs +3 -3
  273. package/renderers/passwordRenderer/passwordRenderer.js +3 -3
  274. package/renderers/passwordRenderer/passwordRenderer.mjs +3 -3
  275. package/renderers/selectRenderer/selectRenderer.js +4 -4
  276. package/renderers/selectRenderer/selectRenderer.mjs +4 -4
  277. package/renderers/textRenderer/textRenderer.js +5 -5
  278. package/renderers/textRenderer/textRenderer.mjs +5 -5
  279. package/renderers/timeRenderer/timeRenderer.js +3 -3
  280. package/renderers/timeRenderer/timeRenderer.mjs +3 -3
  281. package/selection/range.js +12 -2
  282. package/selection/range.mjs +12 -2
  283. package/selection/selection.js +3 -3
  284. package/selection/selection.mjs +3 -3
  285. package/tableView.js +208 -200
  286. package/tableView.mjs +208 -200
  287. package/translations/changesObservable/utils.js +2 -2
  288. package/translations/changesObservable/utils.mjs +2 -2
  289. package/translations/indexMapper.js +25 -22
  290. package/translations/indexMapper.mjs +25 -22
  291. package/translations/mapCollections/aggregatedCollection.js +8 -2
  292. package/translations/mapCollections/aggregatedCollection.mjs +8 -2
  293. package/translations/mapCollections/mapCollection.js +5 -2
  294. package/translations/mapCollections/mapCollection.mjs +5 -2
  295. package/translations/maps/indexMap.js +6 -1
  296. package/translations/maps/indexMap.mjs +6 -1
  297. package/translations/maps/utils/physicallyIndexed.js +2 -2
  298. package/translations/maps/utils/physicallyIndexed.mjs +2 -2
  299. package/utils/dataStructures/linkedList.js +10 -6
  300. package/utils/dataStructures/linkedList.mjs +10 -6
  301. package/utils/dataStructures/queue.js +1 -1
  302. package/utils/dataStructures/queue.mjs +1 -1
  303. package/utils/dataStructures/stack.js +1 -1
  304. package/utils/dataStructures/stack.mjs +1 -1
  305. package/utils/ghostTable.js +2 -2
  306. package/utils/ghostTable.mjs +2 -2
  307. package/utils/interval.js +73 -36
  308. package/utils/interval.mjs +73 -36
  309. package/utils/parseTable.js +1 -1
  310. package/utils/parseTable.mjs +1 -1
  311. package/validators/autocompleteValidator/autocompleteValidator.js +1 -1
  312. package/validators/autocompleteValidator/autocompleteValidator.mjs +1 -1
  313. package/validators/dateValidator/dateValidator.js +1 -1
  314. package/validators/dateValidator/dateValidator.mjs +1 -1
  315. package/validators/numericValidator/numericValidator.js +1 -1
  316. package/validators/numericValidator/numericValidator.mjs +1 -1
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.error.cause.js");
4
3
  exports.__esModule = true;
4
+ require("core-js/modules/es.error.cause.js");
5
5
  require("core-js/modules/es.array.push.js");
6
6
  var _element = require("../../helpers/dom/element");
7
7
  var _number = require("../../helpers/number");
@@ -13,6 +13,7 @@ var _base = require("../base");
13
13
  var _stateManager2 = _interopRequireDefault(require("./stateManager"));
14
14
  var _ghostTable = _interopRequireDefault(require("./utils/ghostTable"));
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
16
17
  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; }
17
18
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
18
19
  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); }
@@ -23,6 +24,7 @@ function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.
23
24
  function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
24
25
  function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
25
26
  function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
27
+ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
26
28
  const PLUGIN_KEY = 'nestedHeaders';
27
29
  exports.PLUGIN_KEY = PLUGIN_KEY;
28
30
  const PLUGIN_PRIORITY = 280;
@@ -77,9 +79,166 @@ var _stateManager = /*#__PURE__*/new WeakMap();
77
79
  var _hidingIndexMapObserver = /*#__PURE__*/new WeakMap();
78
80
  var _focusInitialCoords = /*#__PURE__*/new WeakMap();
79
81
  var _isColumnsSelectionInProgress = /*#__PURE__*/new WeakMap();
82
+ var _updateFocusHighlightPosition = /*#__PURE__*/new WeakSet();
83
+ var _onBeforeViewportScrollHorizontally = /*#__PURE__*/new WeakSet();
84
+ var _onBeforeHighlightingColumnHeader = /*#__PURE__*/new WeakSet();
85
+ var _onBeforeCopy = /*#__PURE__*/new WeakSet();
86
+ var _onBeforeOnCellMouseDown = /*#__PURE__*/new WeakSet();
87
+ var _onAfterOnCellMouseDown = /*#__PURE__*/new WeakSet();
88
+ var _onBeforeOnCellMouseOver = /*#__PURE__*/new WeakSet();
89
+ var _onBeforeOnCellMouseUp = /*#__PURE__*/new WeakSet();
90
+ var _onBeforeSelectionHighlightSet = /*#__PURE__*/new WeakSet();
91
+ var _onModifyTransformStart = /*#__PURE__*/new WeakSet();
92
+ var _onBeforeSelectColumns = /*#__PURE__*/new WeakSet();
93
+ var _onAfterGetColumnHeaderRenderers = /*#__PURE__*/new WeakSet();
94
+ var _onAfterViewportColumnCalculatorOverride = /*#__PURE__*/new WeakSet();
95
+ var _onModifyColWidth = /*#__PURE__*/new WeakSet();
96
+ var _onModifyColumnHeaderValue = /*#__PURE__*/new WeakSet();
97
+ var _onModifyFocusedElement = /*#__PURE__*/new WeakSet();
98
+ var _onInit = /*#__PURE__*/new WeakSet();
99
+ var _onAfterLoadData = /*#__PURE__*/new WeakSet();
80
100
  class NestedHeaders extends _base.BasePlugin {
81
101
  constructor() {
82
102
  super(...arguments);
103
+ /**
104
+ * Updates the plugin state after new dataset load.
105
+ *
106
+ * @param {Array[]} sourceData Array of arrays or array of objects containing data.
107
+ * @param {boolean} initialLoad Flag that determines whether the data has been loaded
108
+ * during the initialization.
109
+ */
110
+ _classPrivateMethodInitSpec(this, _onAfterLoadData);
111
+ /**
112
+ * Updates the plugin state after HoT initialization.
113
+ */
114
+ _classPrivateMethodInitSpec(this, _onInit);
115
+ /**
116
+ * `modifyFocusedElement` hook callback.
117
+ *
118
+ * @param {number} row Row index.
119
+ * @param {number} column Column index.
120
+ * @returns {HTMLTableCellElement} The `TH` element to be focused.
121
+ */
122
+ _classPrivateMethodInitSpec(this, _onModifyFocusedElement);
123
+ /**
124
+ * Listens the `modifyColumnHeaderValue` hook that overwrites the column headers values based on
125
+ * the internal state and settings of the plugin.
126
+ *
127
+ * @param {string} value The column header value.
128
+ * @param {number} visualColumnIndex The visual column index.
129
+ * @param {number} headerLevel The index of header level. The header level accepts positive (0 to N)
130
+ * and negative (-1 to -N) values. For positive values, 0 points to the
131
+ * top most header, and for negative direction, -1 points to the most bottom
132
+ * header (the header closest to the cells).
133
+ * @returns {string} Returns the column header value to update.
134
+ */
135
+ _classPrivateMethodInitSpec(this, _onModifyColumnHeaderValue);
136
+ /**
137
+ * `modifyColWidth` hook callback - returns width from cache, when is greater than incoming from hook.
138
+ *
139
+ * @param {number} width Width from hook.
140
+ * @param {number} column Visual index of an column.
141
+ * @returns {number}
142
+ */
143
+ _classPrivateMethodInitSpec(this, _onModifyColWidth);
144
+ /**
145
+ * Make the renderer render the first nested column in its entirety.
146
+ *
147
+ * @param {object} calc Viewport column calculator.
148
+ */
149
+ _classPrivateMethodInitSpec(this, _onAfterViewportColumnCalculatorOverride);
150
+ /**
151
+ * `afterGetColumnHeader` hook callback - prepares the header structure.
152
+ *
153
+ * @param {Array} renderersArray Array of renderers.
154
+ */
155
+ _classPrivateMethodInitSpec(this, _onAfterGetColumnHeaderRenderers);
156
+ /**
157
+ * The hook observes the column selection from the Selection API and modifies the column range to
158
+ * ensure that the whole nested column will be covered.
159
+ *
160
+ * @param {CellCoords} from The coords object where the selection starts.
161
+ * @param {CellCoords} to The coords object where the selection ends.
162
+ */
163
+ _classPrivateMethodInitSpec(this, _onBeforeSelectColumns);
164
+ /**
165
+ * `modifyTransformStart` hook is called every time the keyboard navigation is used.
166
+ *
167
+ * @param {object} delta The transformation delta.
168
+ */
169
+ _classPrivateMethodInitSpec(this, _onModifyTransformStart);
170
+ /**
171
+ * The hook checks and ensures that the focus position that depends on the selected columns
172
+ * range is always positioned within the range.
173
+ */
174
+ _classPrivateMethodInitSpec(this, _onBeforeSelectionHighlightSet);
175
+ /**
176
+ * Switches internal flag about selection progress to `false`.
177
+ */
178
+ _classPrivateMethodInitSpec(this, _onBeforeOnCellMouseUp);
179
+ /**
180
+ * Makes the header-selection properly select the nested headers.
181
+ *
182
+ * @param {MouseEvent} event Mouse event.
183
+ * @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell.
184
+ * @param {HTMLElement} TD The cell element.
185
+ * @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains
186
+ * a boolean value that allows or disallows changing the selection for that particular area.
187
+ */
188
+ _classPrivateMethodInitSpec(this, _onBeforeOnCellMouseOver);
189
+ /**
190
+ * Allows to control how the column selection based on the coordinates and the nested headers is made.
191
+ *
192
+ * @param {MouseEvent} event Mouse event.
193
+ * @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell.
194
+ */
195
+ _classPrivateMethodInitSpec(this, _onAfterOnCellMouseDown);
196
+ /**
197
+ * Allows blocking the column selection that is controlled by the core Selection module.
198
+ *
199
+ * @param {MouseEvent} event Mouse event.
200
+ * @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell.
201
+ * @param {CellCoords} TD The table cell or header element.
202
+ * @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains
203
+ * a boolean value that allows or disallows changing the selection for that particular area.
204
+ */
205
+ _classPrivateMethodInitSpec(this, _onBeforeOnCellMouseDown);
206
+ /**
207
+ * Listens the `beforeCopy` hook that allows processing the copied column headers so that the
208
+ * merged column headers do not propagate the value for each column but only once at the beginning
209
+ * of the column.
210
+ *
211
+ * @private
212
+ * @param {Array[]} data An array of arrays which contains data to copied.
213
+ * @param {object[]} copyableRanges An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
214
+ * which will copied.
215
+ * @param {{ columnHeadersCount: number }} copiedHeadersCount An object with keys that holds information with
216
+ * the number of copied headers.
217
+ */
218
+ _classPrivateMethodInitSpec(this, _onBeforeCopy);
219
+ /**
220
+ * Allows to control which header DOM element will be used to highlight.
221
+ *
222
+ * @param {number} visualColumn A visual column index of the highlighted row header.
223
+ * @param {number} headerLevel A row header level that is currently highlighted.
224
+ * @param {object} highlightMeta An object with meta data that describes the highlight state.
225
+ * @returns {number}
226
+ */
227
+ _classPrivateMethodInitSpec(this, _onBeforeHighlightingColumnHeader);
228
+ /**
229
+ * Allows to control to which column index the viewport will be scrolled. To ensure that the viewport
230
+ * is scrolled to the correct column for the nested header the most left and the most right visual column
231
+ * indexes are used.
232
+ *
233
+ * @param {number} visualColumn A visual column index to which the viewport will be scrolled.
234
+ * @returns {number}
235
+ */
236
+ _classPrivateMethodInitSpec(this, _onBeforeViewportScrollHorizontally);
237
+ /**
238
+ * Updates the selection focus highlight position to point to the nested header root element (TH)
239
+ * even when the logical coordinates point in-between the header.
240
+ */
241
+ _classPrivateMethodInitSpec(this, _updateFocusHighlightPosition);
83
242
  /**
84
243
  * The state manager for the nested headers.
85
244
  *
@@ -163,56 +322,101 @@ class NestedHeaders extends _base.BasePlugin {
163
322
  (0, _console.warn)((0, _templateLiteralTag.toSingleLine)`Your Nested Headers plugin configuration is invalid. The settings has to be\x20
164
323
  passed as an array of arrays e.q. [['A1', { label: 'A2', colspan: 2 }]]`);
165
324
  }
166
- this.addHook('init', () => this.onInit());
325
+ this.addHook('init', () => _classPrivateMethodGet(this, _onInit, _onInit2).call(this));
167
326
  this.addHook('afterLoadData', function () {
168
- return _this.onAfterLoadData(...arguments);
327
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
328
+ args[_key] = arguments[_key];
329
+ }
330
+ return _classPrivateMethodGet(_this, _onAfterLoadData, _onAfterLoadData2).call(_this, ...args);
169
331
  });
170
332
  this.addHook('beforeOnCellMouseDown', function () {
171
- return _this.onBeforeOnCellMouseDown(...arguments);
333
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
334
+ args[_key2] = arguments[_key2];
335
+ }
336
+ return _classPrivateMethodGet(_this, _onBeforeOnCellMouseDown, _onBeforeOnCellMouseDown2).call(_this, ...args);
172
337
  });
173
338
  this.addHook('afterOnCellMouseDown', function () {
174
- return _this.onAfterOnCellMouseDown(...arguments);
339
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
340
+ args[_key3] = arguments[_key3];
341
+ }
342
+ return _classPrivateMethodGet(_this, _onAfterOnCellMouseDown, _onAfterOnCellMouseDown2).call(_this, ...args);
175
343
  });
176
344
  this.addHook('beforeOnCellMouseOver', function () {
177
- return _this.onBeforeOnCellMouseOver(...arguments);
345
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
346
+ args[_key4] = arguments[_key4];
347
+ }
348
+ return _classPrivateMethodGet(_this, _onBeforeOnCellMouseOver, _onBeforeOnCellMouseOver2).call(_this, ...args);
178
349
  });
179
350
  this.addHook('beforeOnCellMouseUp', function () {
180
- return _this.onBeforeOnCellMouseUp(...arguments);
351
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
352
+ args[_key5] = arguments[_key5];
353
+ }
354
+ return _classPrivateMethodGet(_this, _onBeforeOnCellMouseUp, _onBeforeOnCellMouseUp2).call(_this, ...args);
181
355
  });
182
356
  this.addHook('beforeSelectionHighlightSet', function () {
183
- return _this.onBeforeSelectionHighlightSet(...arguments);
357
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
358
+ args[_key6] = arguments[_key6];
359
+ }
360
+ return _classPrivateMethodGet(_this, _onBeforeSelectionHighlightSet, _onBeforeSelectionHighlightSet2).call(_this, ...args);
184
361
  });
185
362
  this.addHook('modifyTransformStart', function () {
186
- return _this.onModifyTransformStart(...arguments);
363
+ for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
364
+ args[_key7] = arguments[_key7];
365
+ }
366
+ return _classPrivateMethodGet(_this, _onModifyTransformStart, _onModifyTransformStart2).call(_this, ...args);
187
367
  });
188
- this.addHook('afterSelection', () => this.updateFocusHighlightPosition());
368
+ this.addHook('afterSelection', () => _classPrivateMethodGet(this, _updateFocusHighlightPosition, _updateFocusHighlightPosition2).call(this));
189
369
  this.addHook('beforeViewportScrollHorizontally', function () {
190
- return _this.onBeforeViewportScrollHorizontally(...arguments);
370
+ for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
371
+ args[_key8] = arguments[_key8];
372
+ }
373
+ return _classPrivateMethodGet(_this, _onBeforeViewportScrollHorizontally, _onBeforeViewportScrollHorizontally2).call(_this, ...args);
191
374
  });
192
- this.addHook('afterGetColumnHeaderRenderers', array => this.onAfterGetColumnHeaderRenderers(array));
375
+ this.addHook('afterGetColumnHeaderRenderers', array => _classPrivateMethodGet(this, _onAfterGetColumnHeaderRenderers, _onAfterGetColumnHeaderRenderers2).call(this, array));
193
376
  this.addHook('modifyColWidth', function () {
194
- return _this.onModifyColWidth(...arguments);
377
+ for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
378
+ args[_key9] = arguments[_key9];
379
+ }
380
+ return _classPrivateMethodGet(_this, _onModifyColWidth, _onModifyColWidth2).call(_this, ...args);
195
381
  });
196
382
  this.addHook('modifyColumnHeaderValue', function () {
197
- return _this.onModifyColumnHeaderValue(...arguments);
383
+ for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
384
+ args[_key10] = arguments[_key10];
385
+ }
386
+ return _classPrivateMethodGet(_this, _onModifyColumnHeaderValue, _onModifyColumnHeaderValue2).call(_this, ...args);
198
387
  });
199
388
  this.addHook('beforeHighlightingColumnHeader', function () {
200
- return _this.onBeforeHighlightingColumnHeader(...arguments);
389
+ for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
390
+ args[_key11] = arguments[_key11];
391
+ }
392
+ return _classPrivateMethodGet(_this, _onBeforeHighlightingColumnHeader, _onBeforeHighlightingColumnHeader2).call(_this, ...args);
201
393
  });
202
394
  this.addHook('beforeCopy', function () {
203
- return _this.onBeforeCopy(...arguments);
395
+ for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
396
+ args[_key12] = arguments[_key12];
397
+ }
398
+ return _classPrivateMethodGet(_this, _onBeforeCopy, _onBeforeCopy2).call(_this, ...args);
204
399
  });
205
400
  this.addHook('beforeSelectColumns', function () {
206
- return _this.onBeforeSelectColumns(...arguments);
401
+ for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
402
+ args[_key13] = arguments[_key13];
403
+ }
404
+ return _classPrivateMethodGet(_this, _onBeforeSelectColumns, _onBeforeSelectColumns2).call(_this, ...args);
207
405
  });
208
406
  this.addHook('afterViewportColumnCalculatorOverride', function () {
209
- return _this.onAfterViewportColumnCalculatorOverride(...arguments);
407
+ for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
408
+ args[_key14] = arguments[_key14];
409
+ }
410
+ return _classPrivateMethodGet(_this, _onAfterViewportColumnCalculatorOverride, _onAfterViewportColumnCalculatorOverride2).call(_this, ...args);
210
411
  });
211
412
  this.addHook('modifyFocusedElement', function () {
212
- return _this.onModifyFocusedElement(...arguments);
413
+ for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
414
+ args[_key15] = arguments[_key15];
415
+ }
416
+ return _classPrivateMethodGet(_this, _onModifyFocusedElement, _onModifyFocusedElement2).call(_this, ...args);
213
417
  });
214
- this.hot.columnIndexMapper.addLocalHook('cacheUpdated', () => this.updateFocusHighlightPosition());
215
- this.hot.rowIndexMapper.addLocalHook('cacheUpdated', () => this.updateFocusHighlightPosition());
418
+ this.hot.columnIndexMapper.addLocalHook('cacheUpdated', () => _classPrivateMethodGet(this, _updateFocusHighlightPosition, _updateFocusHighlightPosition2).call(this));
419
+ this.hot.rowIndexMapper.addLocalHook('cacheUpdated', () => _classPrivateMethodGet(this, _updateFocusHighlightPosition, _updateFocusHighlightPosition2).call(this));
216
420
  super.enablePlugin();
217
421
  this.updatePlugin(); // @TODO: Workaround for broken plugin initialization abstraction.
218
422
  }
@@ -427,522 +631,361 @@ class NestedHeaders extends _base.BasePlugin {
427
631
  }
428
632
  return this.hot.getColHeader(visualColumnIndex, headerLevel);
429
633
  }
430
-
431
634
  /**
432
- * Updates the selection focus highlight position to point to the nested header root element (TH)
433
- * even when the logical coordinates point in-between the header.
434
- *
435
- * @private
635
+ * Destroys the plugin instance.
436
636
  */
437
- updateFocusHighlightPosition() {
438
- var _this$hot;
439
- const selection = (_this$hot = this.hot) === null || _this$hot === void 0 ? void 0 : _this$hot.getSelectedRangeLast();
440
- if (!selection) {
441
- return;
442
- }
443
- const {
444
- highlight
445
- } = selection;
446
- const isNestedHeadersRange = highlight.isHeader() && highlight.col >= 0;
447
- if (isNestedHeadersRange) {
448
- const columnIndex = _classPrivateFieldGet(this, _stateManager).findLeftMostColumnIndex(highlight.row, highlight.col);
449
- const focusHighlight = this.hot.selection.highlight.getFocus();
450
-
451
- // Correct the highlight/focus selection to highlight the correct TH element
452
- focusHighlight.visualCellRange.highlight.col = columnIndex;
453
- focusHighlight.visualCellRange.from.col = columnIndex;
454
- focusHighlight.visualCellRange.to.col = columnIndex;
455
- focusHighlight.commit();
637
+ destroy() {
638
+ _classPrivateFieldSet(this, _stateManager, null);
639
+ if (_classPrivateFieldGet(this, _hidingIndexMapObserver) !== null) {
640
+ _classPrivateFieldGet(this, _hidingIndexMapObserver).unsubscribe();
641
+ _classPrivateFieldSet(this, _hidingIndexMapObserver, null);
456
642
  }
643
+ super.destroy();
457
644
  }
458
645
 
459
646
  /**
460
- * Allows to control to which column index the viewport will be scrolled. To ensure that the viewport
461
- * is scrolled to the correct column for the nested header the most left and the most right visual column
462
- * indexes are used.
647
+ * Gets the tree data that belongs to the column headers pointed by the passed coordinates.
463
648
  *
464
649
  * @private
465
- * @param {number} visualColumn A visual column index to which the viewport will be scrolled.
466
- * @returns {number}
650
+ * @param {CellCoords} coords The CellCoords instance.
651
+ * @returns {object|undefined}
467
652
  */
468
- onBeforeViewportScrollHorizontally(visualColumn) {
469
- const selection = this.hot.getSelectedRangeLast();
470
- if (!selection) {
471
- return visualColumn;
472
- }
473
- const {
474
- highlight
475
- } = selection;
476
- const isNestedHeadersRange = highlight.isHeader() && highlight.col >= 0;
477
- if (!isNestedHeadersRange) {
478
- return visualColumn;
479
- }
480
- const firstColumn = this.hot.view.getFirstFullyVisibleColumn();
481
- const lastColumn = this.hot.view.getLastFullyVisibleColumn();
482
- const mostLeftColumnIndex = _classPrivateFieldGet(this, _stateManager).findLeftMostColumnIndex(highlight.row, highlight.col);
483
- const mostRightColumnIndex = _classPrivateFieldGet(this, _stateManager).findRightMostColumnIndex(highlight.row, highlight.col);
484
-
485
- // do not scroll the viewport when the header is wider than the viewport
486
- if (mostLeftColumnIndex < firstColumn && mostRightColumnIndex > lastColumn) {
487
- return visualColumn;
653
+ _getHeaderTreeNodeDataByCoords(coords) {
654
+ if (coords.row >= 0 || coords.col < 0) {
655
+ return;
488
656
  }
489
- return mostLeftColumnIndex < firstColumn ? mostLeftColumnIndex : mostRightColumnIndex;
657
+ return _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(coords.row, coords.col);
490
658
  }
491
-
492
- /**
493
- * Allows to control which header DOM element will be used to highlight.
494
- *
495
- * @private
496
- * @param {number} visualColumn A visual column index of the highlighted row header.
497
- * @param {number} headerLevel A row header level that is currently highlighted.
498
- * @param {object} highlightMeta An object with meta data that describes the highlight state.
499
- * @returns {number}
500
- */
501
- onBeforeHighlightingColumnHeader(visualColumn, headerLevel, highlightMeta) {
502
- const headerNodeData = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(headerLevel, visualColumn);
503
- if (!headerNodeData) {
504
- return visualColumn;
505
- }
506
- const {
507
- columnCursor,
508
- selectionType,
509
- selectionWidth
510
- } = highlightMeta;
511
- const {
512
- isRoot,
513
- colspan
514
- } = _classPrivateFieldGet(this, _stateManager).getHeaderSettings(headerLevel, visualColumn);
515
- if (selectionType === _selection.HEADER_TYPE) {
516
- if (!isRoot) {
517
- return headerNodeData.columnIndex;
518
- }
519
- } else if (selectionType === _selection.ACTIVE_HEADER_TYPE) {
520
- if (colspan > selectionWidth - columnCursor || !isRoot) {
521
- // Prevents adding any CSS class names to the TH element
522
- return null;
523
- }
524
- }
659
+ }
660
+ exports.NestedHeaders = NestedHeaders;
661
+ function _updateFocusHighlightPosition2() {
662
+ var _this$hot;
663
+ const selection = (_this$hot = this.hot) === null || _this$hot === void 0 ? void 0 : _this$hot.getSelectedRangeLast();
664
+ if (!selection) {
665
+ return;
666
+ }
667
+ const {
668
+ highlight
669
+ } = selection;
670
+ const isNestedHeadersRange = highlight.isHeader() && highlight.col >= 0;
671
+ if (isNestedHeadersRange) {
672
+ const columnIndex = _classPrivateFieldGet(this, _stateManager).findLeftMostColumnIndex(highlight.row, highlight.col);
673
+ const focusHighlight = this.hot.selection.highlight.getFocus();
674
+
675
+ // Correct the highlight/focus selection to highlight the correct TH element
676
+ focusHighlight.visualCellRange.highlight.col = columnIndex;
677
+ focusHighlight.visualCellRange.from.col = columnIndex;
678
+ focusHighlight.visualCellRange.to.col = columnIndex;
679
+ focusHighlight.commit();
680
+ }
681
+ }
682
+ function _onBeforeViewportScrollHorizontally2(visualColumn) {
683
+ const selection = this.hot.getSelectedRangeLast();
684
+ if (!selection) {
525
685
  return visualColumn;
526
686
  }
527
-
528
- /**
529
- * Listens the `beforeCopy` hook that allows processing the copied column headers so that the
530
- * merged column headers do not propagate the value for each column but only once at the beginning
531
- * of the column.
532
- *
533
- * @private
534
- * @param {Array[]} data An array of arrays which contains data to copied.
535
- * @param {object[]} copyableRanges An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
536
- * which will copied.
537
- * @param {{ columnHeadersCount: number }} copiedHeadersCount An object with keys that holds information with
538
- * the number of copied headers.
539
- */
540
- onBeforeCopy(data, copyableRanges, _ref2) {
541
- let {
542
- columnHeadersCount
543
- } = _ref2;
544
- if (columnHeadersCount === 0) {
545
- return;
546
- }
547
- for (let rangeIndex = 0; rangeIndex < copyableRanges.length; rangeIndex++) {
548
- const {
549
- startRow,
550
- startCol,
551
- endRow,
552
- endCol
553
- } = copyableRanges[rangeIndex];
554
- const rowsCount = endRow - startRow + 1;
555
- const columnsCount = startCol - endCol + 1;
556
-
557
- // do not process dataset ranges and column headers where only one column is copied
558
- if (startRow >= 0 || columnsCount === 1) {
559
- break;
560
- }
561
- for (let column = startCol; column <= endCol; column++) {
562
- for (let row = startRow; row <= endRow; row++) {
563
- var _classPrivateFieldGet4;
564
- const zeroBasedColumnHeaderLevel = rowsCount + row;
565
- const zeroBasedColumnIndex = column - startCol;
566
- if (zeroBasedColumnIndex === 0) {
567
- continue; // eslint-disable-line no-continue
568
- }
569
-
570
- const isRoot = (_classPrivateFieldGet4 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(row, column)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.isRoot;
571
- if (isRoot === false) {
572
- data[zeroBasedColumnHeaderLevel][zeroBasedColumnIndex] = '';
573
- }
574
- }
575
- }
576
- }
687
+ const {
688
+ highlight
689
+ } = selection;
690
+ const isNestedHeadersRange = highlight.isHeader() && highlight.col >= 0;
691
+ if (!isNestedHeadersRange) {
692
+ return visualColumn;
577
693
  }
694
+ const firstColumn = this.hot.view.getFirstFullyVisibleColumn();
695
+ const lastColumn = this.hot.view.getLastFullyVisibleColumn();
696
+ const mostLeftColumnIndex = _classPrivateFieldGet(this, _stateManager).findLeftMostColumnIndex(highlight.row, highlight.col);
697
+ const mostRightColumnIndex = _classPrivateFieldGet(this, _stateManager).findRightMostColumnIndex(highlight.row, highlight.col);
578
698
 
579
- /**
580
- * Allows blocking the column selection that is controlled by the core Selection module.
581
- *
582
- * @private
583
- * @param {MouseEvent} event Mouse event.
584
- * @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell.
585
- * @param {CellCoords} TD The table cell or header element.
586
- * @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains
587
- * a boolean value that allows or disallows changing the selection for that particular area.
588
- */
589
- onBeforeOnCellMouseDown(event, coords, TD, controller) {
590
- const headerNodeData = this._getHeaderTreeNodeDataByCoords(coords);
591
- if (headerNodeData) {
592
- // Block the Selection module in controlling how the columns are selected. Pass the
593
- // responsibility of the column selection to this plugin (see "onAfterOnCellMouseDown" hook).
594
- controller.column = true;
595
- }
699
+ // do not scroll the viewport when the header is wider than the viewport
700
+ if (mostLeftColumnIndex < firstColumn && mostRightColumnIndex > lastColumn) {
701
+ return visualColumn;
596
702
  }
597
-
598
- /**
599
- * Allows to control how the column selection based on the coordinates and the nested headers is made.
600
- *
601
- * @private
602
- * @param {MouseEvent} event Mouse event.
603
- * @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell.
604
- */
605
- onAfterOnCellMouseDown(event, coords) {
606
- const headerNodeData = this._getHeaderTreeNodeDataByCoords(coords);
607
- if (!headerNodeData) {
608
- return;
609
- }
610
- _classPrivateFieldSet(this, _focusInitialCoords, coords.clone());
611
- _classPrivateFieldSet(this, _isColumnsSelectionInProgress, true);
612
- const {
613
- selection
614
- } = this.hot;
615
- const currentSelection = selection.isSelected() ? selection.getSelectedRange().current() : null;
616
- const columnsToSelect = [];
703
+ return mostLeftColumnIndex < firstColumn ? mostLeftColumnIndex : mostRightColumnIndex;
704
+ }
705
+ function _onBeforeHighlightingColumnHeader2(visualColumn, headerLevel, highlightMeta) {
706
+ const headerNodeData = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(headerLevel, visualColumn);
707
+ if (!headerNodeData) {
708
+ return visualColumn;
709
+ }
710
+ const {
711
+ columnCursor,
712
+ selectionType,
713
+ selectionWidth
714
+ } = highlightMeta;
715
+ const {
716
+ isRoot,
717
+ colspan
718
+ } = _classPrivateFieldGet(this, _stateManager).getHeaderSettings(headerLevel, visualColumn);
719
+ if (selectionType === _selection.HEADER_TYPE) {
720
+ if (!isRoot) {
721
+ return headerNodeData.columnIndex;
722
+ }
723
+ } else if (selectionType === _selection.ACTIVE_HEADER_TYPE) {
724
+ if (colspan > selectionWidth - columnCursor || !isRoot) {
725
+ // Prevents adding any CSS class names to the TH element
726
+ return null;
727
+ }
728
+ }
729
+ return visualColumn;
730
+ }
731
+ function _onBeforeCopy2(data, copyableRanges, _ref2) {
732
+ let {
733
+ columnHeadersCount
734
+ } = _ref2;
735
+ if (columnHeadersCount === 0) {
736
+ return;
737
+ }
738
+ for (let rangeIndex = 0; rangeIndex < copyableRanges.length; rangeIndex++) {
617
739
  const {
618
- columnIndex,
619
- origColspan
620
- } = headerNodeData;
740
+ startRow,
741
+ startCol,
742
+ endRow,
743
+ endCol
744
+ } = copyableRanges[rangeIndex];
745
+ const rowsCount = endRow - startRow + 1;
746
+ const columnsCount = startCol - endCol + 1;
747
+
748
+ // do not process dataset ranges and column headers where only one column is copied
749
+ if (startRow >= 0 || columnsCount === 1) {
750
+ break;
751
+ }
752
+ for (let column = startCol; column <= endCol; column++) {
753
+ for (let row = startRow; row <= endRow; row++) {
754
+ var _classPrivateFieldGet4;
755
+ const zeroBasedColumnHeaderLevel = rowsCount + row;
756
+ const zeroBasedColumnIndex = column - startCol;
757
+ if (zeroBasedColumnIndex === 0) {
758
+ continue; // eslint-disable-line no-continue
759
+ }
621
760
 
622
- // The Selection module doesn't allow it to extend its behavior easily. That's why here we need
623
- // to re-implement the "click" and "shift" behavior. As a workaround, the logic for the nested
624
- // headers must implement a similar logic as in the original Selection handler
625
- // (see src/selection/mouseEventHandler.js).
626
- const allowRightClickSelection = !selection.inInSelection(coords);
627
- if (event.shiftKey && currentSelection) {
628
- if (coords.col < currentSelection.from.col) {
629
- columnsToSelect.push(currentSelection.getTopEndCorner().col, columnIndex, coords.row);
630
- } else if (coords.col > currentSelection.from.col) {
631
- columnsToSelect.push(currentSelection.getTopStartCorner().col, columnIndex + origColspan - 1, coords.row);
632
- } else {
633
- columnsToSelect.push(columnIndex, columnIndex + origColspan - 1, coords.row);
761
+ const isRoot = (_classPrivateFieldGet4 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(row, column)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.isRoot;
762
+ if (isRoot === false) {
763
+ data[zeroBasedColumnHeaderLevel][zeroBasedColumnIndex] = '';
764
+ }
634
765
  }
635
- } else if ((0, _event.isLeftClick)(event) || (0, _event.isRightClick)(event) && allowRightClickSelection) {
636
- columnsToSelect.push(columnIndex, columnIndex + origColspan - 1, coords.row);
637
766
  }
638
-
639
- // The plugin takes control of how the columns are selected.
640
- selection.selectColumns(...columnsToSelect);
641
767
  }
642
-
643
- /**
644
- * Makes the header-selection properly select the nested headers.
645
- *
646
- * @private
647
- * @param {MouseEvent} event Mouse event.
648
- * @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell.
649
- * @param {HTMLElement} TD The cell element.
650
- * @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains
651
- * a boolean value that allows or disallows changing the selection for that particular area.
652
- */
653
- onBeforeOnCellMouseOver(event, coords, TD, controller) {
654
- if (!this.hot.view.isMouseDown()) {
655
- return;
656
- }
657
- const headerNodeData = this._getHeaderTreeNodeDataByCoords(coords);
658
- if (!headerNodeData) {
659
- return;
660
- }
661
- const {
662
- columnIndex,
663
- origColspan
664
- } = headerNodeData;
665
- const selectedRange = this.hot.getSelectedRangeLast();
666
- const topStartCoords = selectedRange.getTopStartCorner();
667
- const bottomEndCoords = selectedRange.getBottomEndCorner();
668
- const {
669
- from
670
- } = selectedRange;
671
-
672
- // Block the Selection module in controlling how the columns and cells are selected.
673
- // From now on, the plugin is responsible for the selection.
768
+ }
769
+ function _onBeforeOnCellMouseDown2(event, coords, TD, controller) {
770
+ const headerNodeData = this._getHeaderTreeNodeDataByCoords(coords);
771
+ if (headerNodeData) {
772
+ // Block the Selection module in controlling how the columns are selected. Pass the
773
+ // responsibility of the column selection to this plugin (see "onAfterOnCellMouseDown" hook).
674
774
  controller.column = true;
675
- controller.cell = true;
676
- const columnsToSelect = [];
677
- const headerLevel = (0, _number.clamp)(coords.row, -Infinity, -1);
678
- if (coords.col < from.col) {
679
- columnsToSelect.push(bottomEndCoords.col, columnIndex, headerLevel);
680
- } else if (coords.col > from.col) {
681
- columnsToSelect.push(topStartCoords.col, columnIndex + origColspan - 1, headerLevel);
775
+ }
776
+ }
777
+ function _onAfterOnCellMouseDown2(event, coords) {
778
+ const headerNodeData = this._getHeaderTreeNodeDataByCoords(coords);
779
+ if (!headerNodeData) {
780
+ return;
781
+ }
782
+ _classPrivateFieldSet(this, _focusInitialCoords, coords.clone());
783
+ _classPrivateFieldSet(this, _isColumnsSelectionInProgress, true);
784
+ const {
785
+ selection
786
+ } = this.hot;
787
+ const currentSelection = selection.isSelected() ? selection.getSelectedRange().current() : null;
788
+ const columnsToSelect = [];
789
+ const {
790
+ columnIndex,
791
+ origColspan
792
+ } = headerNodeData;
793
+
794
+ // The Selection module doesn't allow it to extend its behavior easily. That's why here we need
795
+ // to re-implement the "click" and "shift" behavior. As a workaround, the logic for the nested
796
+ // headers must implement a similar logic as in the original Selection handler
797
+ // (see src/selection/mouseEventHandler.js).
798
+ const allowRightClickSelection = !selection.inInSelection(coords);
799
+ if (event.shiftKey && currentSelection) {
800
+ if (coords.col < currentSelection.from.col) {
801
+ columnsToSelect.push(currentSelection.getTopEndCorner().col, columnIndex, coords.row);
802
+ } else if (coords.col > currentSelection.from.col) {
803
+ columnsToSelect.push(currentSelection.getTopStartCorner().col, columnIndex + origColspan - 1, coords.row);
682
804
  } else {
683
- columnsToSelect.push(columnIndex, columnIndex + origColspan - 1, headerLevel);
805
+ columnsToSelect.push(columnIndex, columnIndex + origColspan - 1, coords.row);
684
806
  }
685
- this.hot.selection.selectColumns(...columnsToSelect);
807
+ } else if ((0, _event.isLeftClick)(event) || (0, _event.isRightClick)(event) && allowRightClickSelection) {
808
+ columnsToSelect.push(columnIndex, columnIndex + origColspan - 1, coords.row);
686
809
  }
687
810
 
688
- /**
689
- * Switches internal flag about selection progress to `false`.
690
- *
691
- * @private
692
- */
693
- onBeforeOnCellMouseUp() {
694
- _classPrivateFieldSet(this, _isColumnsSelectionInProgress, false);
811
+ // The plugin takes control of how the columns are selected.
812
+ selection.selectColumns(...columnsToSelect);
813
+ }
814
+ function _onBeforeOnCellMouseOver2(event, coords, TD, controller) {
815
+ if (!this.hot.view.isMouseDown()) {
816
+ return;
817
+ }
818
+ const headerNodeData = this._getHeaderTreeNodeDataByCoords(coords);
819
+ if (!headerNodeData) {
820
+ return;
821
+ }
822
+ const {
823
+ columnIndex,
824
+ origColspan
825
+ } = headerNodeData;
826
+ const selectedRange = this.hot.getSelectedRangeLast();
827
+ const topStartCoords = selectedRange.getTopStartCorner();
828
+ const bottomEndCoords = selectedRange.getBottomEndCorner();
829
+ const {
830
+ from
831
+ } = selectedRange;
832
+
833
+ // Block the Selection module in controlling how the columns and cells are selected.
834
+ // From now on, the plugin is responsible for the selection.
835
+ controller.column = true;
836
+ controller.cell = true;
837
+ const columnsToSelect = [];
838
+ const headerLevel = (0, _number.clamp)(coords.row, -Infinity, -1);
839
+ if (coords.col < from.col) {
840
+ columnsToSelect.push(bottomEndCoords.col, columnIndex, headerLevel);
841
+ } else if (coords.col > from.col) {
842
+ columnsToSelect.push(topStartCoords.col, columnIndex + origColspan - 1, headerLevel);
843
+ } else {
844
+ columnsToSelect.push(columnIndex, columnIndex + origColspan - 1, headerLevel);
845
+ }
846
+ this.hot.selection.selectColumns(...columnsToSelect);
847
+ }
848
+ function _onBeforeOnCellMouseUp2() {
849
+ _classPrivateFieldSet(this, _isColumnsSelectionInProgress, false);
850
+ }
851
+ function _onBeforeSelectionHighlightSet2() {
852
+ const {
853
+ navigableHeaders
854
+ } = this.hot.getSettings();
855
+ if (!this.hot.view.isMouseDown() || !_classPrivateFieldGet(this, _isColumnsSelectionInProgress) || !navigableHeaders) {
856
+ return;
857
+ }
858
+ const selectedRange = this.hot.getSelectedRangeLast();
859
+ const columnStart = selectedRange.getTopStartCorner().col;
860
+ const columnEnd = selectedRange.getBottomEndCorner().col;
861
+ const {
862
+ columnIndex,
863
+ origColspan
864
+ } = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(_classPrivateFieldGet(this, _focusInitialCoords).row, _classPrivateFieldGet(this, _focusInitialCoords).col);
865
+ selectedRange.setHighlight(_classPrivateFieldGet(this, _focusInitialCoords));
866
+ if (origColspan > selectedRange.getWidth() || columnIndex < columnStart || columnIndex + origColspan - 1 > columnEnd) {
867
+ const headerLevel = _classPrivateFieldGet(this, _stateManager).findTopMostEntireHeaderLevel((0, _number.clamp)(columnStart, columnIndex, columnIndex + origColspan - 1), (0, _number.clamp)(columnEnd, columnIndex, columnIndex + origColspan - 1));
868
+ selectedRange.highlight.row = headerLevel;
869
+ selectedRange.highlight.col = selectedRange.from.col;
695
870
  }
696
-
697
- /**
698
- * The hook checks and ensures that the focus position that depends on the selected columns
699
- * range is always positioned within the range.
700
- *
701
- * @private
702
- */
703
- onBeforeSelectionHighlightSet() {
704
- const {
705
- navigableHeaders
706
- } = this.hot.getSettings();
707
- if (!this.hot.view.isMouseDown() || !_classPrivateFieldGet(this, _isColumnsSelectionInProgress) || !navigableHeaders) {
708
- return;
709
- }
710
- const selectedRange = this.hot.getSelectedRangeLast();
711
- const columnStart = selectedRange.getTopStartCorner().col;
712
- const columnEnd = selectedRange.getBottomEndCorner().col;
713
- const {
714
- columnIndex,
715
- origColspan
716
- } = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(_classPrivateFieldGet(this, _focusInitialCoords).row, _classPrivateFieldGet(this, _focusInitialCoords).col);
717
- selectedRange.setHighlight(_classPrivateFieldGet(this, _focusInitialCoords));
718
- if (origColspan > selectedRange.getWidth() || columnIndex < columnStart || columnIndex + origColspan - 1 > columnEnd) {
719
- const headerLevel = _classPrivateFieldGet(this, _stateManager).findTopMostEntireHeaderLevel((0, _number.clamp)(columnStart, columnIndex, columnIndex + origColspan - 1), (0, _number.clamp)(columnEnd, columnIndex, columnIndex + origColspan - 1));
720
- selectedRange.highlight.row = headerLevel;
721
- selectedRange.highlight.col = selectedRange.from.col;
871
+ }
872
+ function _onModifyTransformStart2(delta) {
873
+ const {
874
+ highlight
875
+ } = this.hot.getSelectedRangeLast();
876
+ const nextCoords = this.hot._createCellCoords(highlight.row + delta.row, highlight.col + delta.col);
877
+ const isNestedHeadersRange = nextCoords.isHeader() && nextCoords.col >= 0;
878
+ if (!isNestedHeadersRange) {
879
+ return;
880
+ }
881
+ const visualColumnIndexStart = _classPrivateFieldGet(this, _stateManager).findLeftMostColumnIndex(nextCoords.row, nextCoords.col);
882
+ const visualColumnIndexEnd = _classPrivateFieldGet(this, _stateManager).findRightMostColumnIndex(nextCoords.row, nextCoords.col);
883
+ if (delta.col < 0) {
884
+ const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexStart - 1 : visualColumnIndexEnd;
885
+ const notHiddenColumnIndex = this.hot.columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
886
+ if (notHiddenColumnIndex === null) {
887
+ // There are no visible columns anymore, so move the selection out of the table edge. This will
888
+ // be processed by the selection Transformer class as a move selection to the previous row (if autoWrapRow is enabled).
889
+ delta.col = -this.hot.view.countRenderableColumnsInRange(0, highlight.col);
890
+ } else {
891
+ delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1, 1);
892
+ }
893
+ } else if (delta.col > 0) {
894
+ const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexEnd + 1 : visualColumnIndexStart;
895
+ const notHiddenColumnIndex = this.hot.columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
896
+ if (notHiddenColumnIndex === null) {
897
+ // There are no visible columns anymore, so move the selection out of the table edge. This will
898
+ // be processed by the selection Transformer class as a move selection to the next row (if autoWrapRow is enabled).
899
+ delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, this.hot.countCols());
900
+ } else {
901
+ delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1, 1);
722
902
  }
723
903
  }
724
-
725
- /**
726
- * `modifyTransformStart` hook is called every time the keyboard navigation is used.
727
- *
728
- * @private
729
- * @param {object} delta The transformation delta.
730
- */
731
- onModifyTransformStart(delta) {
732
- const {
733
- highlight
734
- } = this.hot.getSelectedRangeLast();
735
- const nextCoords = this.hot._createCellCoords(highlight.row + delta.row, highlight.col + delta.col);
736
- const isNestedHeadersRange = nextCoords.isHeader() && nextCoords.col >= 0;
737
- if (!isNestedHeadersRange) {
738
- return;
739
- }
740
- const visualColumnIndexStart = _classPrivateFieldGet(this, _stateManager).findLeftMostColumnIndex(nextCoords.row, nextCoords.col);
741
- const visualColumnIndexEnd = _classPrivateFieldGet(this, _stateManager).findRightMostColumnIndex(nextCoords.row, nextCoords.col);
742
- if (delta.col < 0) {
743
- const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexStart - 1 : visualColumnIndexEnd;
744
- const notHiddenColumnIndex = this.hot.columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
745
- if (notHiddenColumnIndex === null) {
746
- // There are no visible columns anymore, so move the selection out of the table edge. This will
747
- // be processed by the selection Transformer class as a move selection to the previous row (if autoWrapRow is enabled).
748
- delta.col = -this.hot.view.countRenderableColumnsInRange(0, highlight.col);
749
- } else {
750
- delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1, 1);
751
- }
752
- } else if (delta.col > 0) {
753
- const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexEnd + 1 : visualColumnIndexStart;
754
- const notHiddenColumnIndex = this.hot.columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
755
- if (notHiddenColumnIndex === null) {
756
- // There are no visible columns anymore, so move the selection out of the table edge. This will
757
- // be processed by the selection Transformer class as a move selection to the next row (if autoWrapRow is enabled).
758
- delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, this.hot.countCols());
759
- } else {
760
- delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1, 1);
761
- }
904
+ }
905
+ function _onBeforeSelectColumns2(from, to) {
906
+ const headerLevel = from.row;
907
+ const startNodeData = this._getHeaderTreeNodeDataByCoords({
908
+ row: headerLevel,
909
+ col: from.col
910
+ });
911
+ const endNodeData = this._getHeaderTreeNodeDataByCoords({
912
+ row: headerLevel,
913
+ col: to.col
914
+ });
915
+ if (to.col < from.col) {
916
+ // Column selection from right to left
917
+ if (startNodeData) {
918
+ from.col = startNodeData.columnIndex + startNodeData.origColspan - 1;
919
+ }
920
+ if (endNodeData) {
921
+ to.col = endNodeData.columnIndex;
922
+ }
923
+ } else if (to.col >= from.col) {
924
+ // Column selection from left to right or a single column selection
925
+ if (startNodeData) {
926
+ from.col = startNodeData.columnIndex;
927
+ }
928
+ if (endNodeData) {
929
+ to.col = endNodeData.columnIndex + endNodeData.origColspan - 1;
762
930
  }
763
931
  }
764
-
765
- /**
766
- * The hook observes the column selection from the Selection API and modifies the column range to
767
- * ensure that the whole nested column will be covered.
768
- *
769
- * @private
770
- * @param {CellCoords} from The coords object where the selection starts.
771
- * @param {CellCoords} to The coords object where the selection ends.
772
- */
773
- onBeforeSelectColumns(from, to) {
774
- const headerLevel = from.row;
775
- const startNodeData = this._getHeaderTreeNodeDataByCoords({
776
- row: headerLevel,
777
- col: from.col
778
- });
779
- const endNodeData = this._getHeaderTreeNodeDataByCoords({
780
- row: headerLevel,
781
- col: to.col
782
- });
783
- if (to.col < from.col) {
784
- // Column selection from right to left
785
- if (startNodeData) {
786
- from.col = startNodeData.columnIndex + startNodeData.origColspan - 1;
787
- }
788
- if (endNodeData) {
789
- to.col = endNodeData.columnIndex;
790
- }
791
- } else if (to.col >= from.col) {
792
- // Column selection from left to right or a single column selection
793
- if (startNodeData) {
794
- from.col = startNodeData.columnIndex;
795
- }
796
- if (endNodeData) {
797
- to.col = endNodeData.columnIndex + endNodeData.origColspan - 1;
798
- }
799
- }
932
+ }
933
+ function _onAfterGetColumnHeaderRenderers2(renderersArray) {
934
+ renderersArray.length = 0;
935
+ for (let headerLayer = 0; headerLayer < _classPrivateFieldGet(this, _stateManager).getLayersCount(); headerLayer++) {
936
+ renderersArray.push(this.headerRendererFactory(headerLayer));
800
937
  }
938
+ }
939
+ function _onAfterViewportColumnCalculatorOverride2(calc) {
940
+ const headerLayersCount = _classPrivateFieldGet(this, _stateManager).getLayersCount();
941
+ let newStartColumn = calc.startColumn;
942
+ let nonRenderable = !!headerLayersCount;
943
+ for (let headerLayer = 0; headerLayer < headerLayersCount; headerLayer++) {
944
+ const startColumn = _classPrivateFieldGet(this, _stateManager).findLeftMostColumnIndex(headerLayer, calc.startColumn);
945
+ const renderedStartColumn = this.hot.columnIndexMapper.getRenderableFromVisualIndex(startColumn);
801
946
 
802
- /**
803
- * `afterGetColumnHeader` hook callback - prepares the header structure.
804
- *
805
- * @private
806
- * @param {Array} renderersArray Array of renderers.
807
- */
808
- onAfterGetColumnHeaderRenderers(renderersArray) {
809
- renderersArray.length = 0;
810
- for (let headerLayer = 0; headerLayer < _classPrivateFieldGet(this, _stateManager).getLayersCount(); headerLayer++) {
811
- renderersArray.push(this.headerRendererFactory(headerLayer));
947
+ // If any of the headers for that column index is rendered, all of them should be rendered properly, see
948
+ // comment below.
949
+ if (startColumn >= 0) {
950
+ nonRenderable = false;
812
951
  }
813
- }
814
952
 
815
- /**
816
- * Make the renderer render the first nested column in its entirety.
817
- *
818
- * @private
819
- * @param {object} calc Viewport column calculator.
820
- */
821
- onAfterViewportColumnCalculatorOverride(calc) {
822
- const headerLayersCount = _classPrivateFieldGet(this, _stateManager).getLayersCount();
823
- let newStartColumn = calc.startColumn;
824
- let nonRenderable = !!headerLayersCount;
825
- for (let headerLayer = 0; headerLayer < headerLayersCount; headerLayer++) {
826
- const startColumn = _classPrivateFieldGet(this, _stateManager).findLeftMostColumnIndex(headerLayer, calc.startColumn);
827
- const renderedStartColumn = this.hot.columnIndexMapper.getRenderableFromVisualIndex(startColumn);
828
-
829
- // If any of the headers for that column index is rendered, all of them should be rendered properly, see
830
- // comment below.
831
- if (startColumn >= 0) {
832
- nonRenderable = false;
833
- }
834
-
835
- // `renderedStartColumn` can be `null` if the leftmost columns are hidden. In that case -> ignore that header
836
- // level, as it should be handled by the "parent" header
837
- if ((0, _number.isNumeric)(renderedStartColumn) && renderedStartColumn < calc.startColumn) {
838
- newStartColumn = renderedStartColumn;
839
- break;
840
- }
953
+ // `renderedStartColumn` can be `null` if the leftmost columns are hidden. In that case -> ignore that header
954
+ // level, as it should be handled by the "parent" header
955
+ if ((0, _number.isNumeric)(renderedStartColumn) && renderedStartColumn < calc.startColumn) {
956
+ newStartColumn = renderedStartColumn;
957
+ break;
841
958
  }
842
-
843
- // If no headers for the provided column index are renderable, start rendering from the beginning of the upmost
844
- // header for that position.
845
- calc.startColumn = nonRenderable ? _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(0, newStartColumn).columnIndex : newStartColumn;
846
959
  }
847
960
 
848
- /**
849
- * `modifyColWidth` hook callback - returns width from cache, when is greater than incoming from hook.
850
- *
851
- * @private
852
- * @param {number} width Width from hook.
853
- * @param {number} column Visual index of an column.
854
- * @returns {number}
855
- */
856
- onModifyColWidth(width, column) {
857
- const cachedWidth = this.ghostTable.getWidth(column);
858
- return width > cachedWidth ? width : cachedWidth;
859
- }
860
-
861
- /**
862
- * Listens the `modifyColumnHeaderValue` hook that overwrites the column headers values based on
863
- * the internal state and settings of the plugin.
864
- *
865
- * @private
866
- * @param {string} value The column header value.
867
- * @param {number} visualColumnIndex The visual column index.
868
- * @param {number} headerLevel The index of header level. The header level accepts positive (0 to N)
869
- * and negative (-1 to -N) values. For positive values, 0 points to the
870
- * top most header, and for negative direction, -1 points to the most bottom
871
- * header (the header closest to the cells).
872
- * @returns {string} Returns the column header value to update.
873
- */
874
- onModifyColumnHeaderValue(value, visualColumnIndex, headerLevel) {
875
- var _classPrivateFieldGet5;
876
- const {
877
- label
878
- } = (_classPrivateFieldGet5 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet5 !== void 0 ? _classPrivateFieldGet5 : {
879
- label: ''
880
- };
881
- return label;
882
- }
883
-
884
- /**
885
- * `modifyFocusedElement` hook callback.
886
- *
887
- * @private
888
- * @param {number} row Row index.
889
- * @param {number} column Column index.
890
- * @returns {HTMLTableCellElement} The `TH` element to be focused.
891
- */
892
- onModifyFocusedElement(row, column) {
893
- if (row < 0) {
894
- return this.hot.getCell(row, _classPrivateFieldGet(this, _stateManager).findLeftMostColumnIndex(row, column), true);
895
- }
961
+ // If no headers for the provided column index are renderable, start rendering from the beginning of the upmost
962
+ // header for that position.
963
+ calc.startColumn = nonRenderable ? _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(0, newStartColumn).columnIndex : newStartColumn;
964
+ }
965
+ function _onModifyColWidth2(width, column) {
966
+ const cachedWidth = this.ghostTable.getWidth(column);
967
+ return width > cachedWidth ? width : cachedWidth;
968
+ }
969
+ function _onModifyColumnHeaderValue2(value, visualColumnIndex, headerLevel) {
970
+ var _classPrivateFieldGet5;
971
+ const {
972
+ label
973
+ } = (_classPrivateFieldGet5 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet5 !== void 0 ? _classPrivateFieldGet5 : {
974
+ label: ''
975
+ };
976
+ return label;
977
+ }
978
+ function _onModifyFocusedElement2(row, column) {
979
+ if (row < 0) {
980
+ return this.hot.getCell(row, _classPrivateFieldGet(this, _stateManager).findLeftMostColumnIndex(row, column), true);
896
981
  }
897
-
898
- /**
899
- * Updates the plugin state after HoT initialization.
900
- *
901
- * @private
902
- */
903
- onInit() {
904
- // @TODO: Workaround for broken plugin initialization abstraction.
982
+ }
983
+ function _onInit2() {
984
+ // @TODO: Workaround for broken plugin initialization abstraction.
985
+ this.updatePlugin();
986
+ }
987
+ function _onAfterLoadData2(sourceData, initialLoad) {
988
+ if (!initialLoad) {
905
989
  this.updatePlugin();
906
990
  }
907
-
908
- /**
909
- * Updates the plugin state after new dataset load.
910
- *
911
- * @private
912
- * @param {Array[]} sourceData Array of arrays or array of objects containing data.
913
- * @param {boolean} initialLoad Flag that determines whether the data has been loaded
914
- * during the initialization.
915
- */
916
- onAfterLoadData(sourceData, initialLoad) {
917
- if (!initialLoad) {
918
- this.updatePlugin();
919
- }
920
- }
921
-
922
- /**
923
- * Destroys the plugin instance.
924
- */
925
- destroy() {
926
- _classPrivateFieldSet(this, _stateManager, null);
927
- if (_classPrivateFieldGet(this, _hidingIndexMapObserver) !== null) {
928
- _classPrivateFieldGet(this, _hidingIndexMapObserver).unsubscribe();
929
- _classPrivateFieldSet(this, _hidingIndexMapObserver, null);
930
- }
931
- super.destroy();
932
- }
933
-
934
- /**
935
- * Gets the tree data that belongs to the column headers pointed by the passed coordinates.
936
- *
937
- * @private
938
- * @param {CellCoords} coords The CellCoords instance.
939
- * @returns {object|undefined}
940
- */
941
- _getHeaderTreeNodeDataByCoords(coords) {
942
- if (coords.row >= 0 || coords.col < 0) {
943
- return;
944
- }
945
- return _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(coords.row, coords.col);
946
- }
947
- }
948
- exports.NestedHeaders = NestedHeaders;
991
+ }