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