handsontable 0.0.0-next-5a535ed-20240403 → 0.0.0-next-c2810a1-20240403

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (284) hide show
  1. package/3rdparty/walkontable/src/calculator/viewportColumns.js +12 -17
  2. package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +12 -17
  3. package/3rdparty/walkontable/src/calculator/viewportRows.js +10 -15
  4. package/3rdparty/walkontable/src/calculator/viewportRows.mjs +10 -15
  5. package/3rdparty/walkontable/src/cell/coords.js +12 -17
  6. package/3rdparty/walkontable/src/cell/coords.mjs +12 -17
  7. package/3rdparty/walkontable/src/cell/range.d.ts +2 -1
  8. package/3rdparty/walkontable/src/cell/range.js +40 -28
  9. package/3rdparty/walkontable/src/cell/range.mjs +40 -28
  10. package/3rdparty/walkontable/src/core/_base.js +1 -1
  11. package/3rdparty/walkontable/src/core/_base.mjs +1 -1
  12. package/3rdparty/walkontable/src/event.js +72 -104
  13. package/3rdparty/walkontable/src/event.mjs +72 -104
  14. package/3rdparty/walkontable/src/overlay/inlineStart.js +15 -1
  15. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +16 -2
  16. package/3rdparty/walkontable/src/overlay/top.js +11 -0
  17. package/3rdparty/walkontable/src/overlay/top.mjs +12 -1
  18. package/3rdparty/walkontable/src/overlays.js +46 -4
  19. package/3rdparty/walkontable/src/overlays.mjs +46 -4
  20. package/3rdparty/walkontable/src/scroll.js +15 -17
  21. package/3rdparty/walkontable/src/scroll.mjs +15 -17
  22. package/3rdparty/walkontable/src/selection/manager.js +48 -69
  23. package/3rdparty/walkontable/src/selection/manager.mjs +48 -69
  24. package/3rdparty/walkontable/src/selection/scanner.js +33 -42
  25. package/3rdparty/walkontable/src/selection/scanner.mjs +33 -42
  26. package/3rdparty/walkontable/src/utils/columnStretching.js +27 -44
  27. package/3rdparty/walkontable/src/utils/columnStretching.mjs +27 -44
  28. package/3rdparty/walkontable/src/utils/orderView/view.js +1 -1
  29. package/3rdparty/walkontable/src/utils/orderView/view.mjs +1 -1
  30. package/base.js +2 -2
  31. package/base.mjs +2 -2
  32. package/core/viewportScroll/index.js +4 -1
  33. package/core/viewportScroll/index.mjs +4 -1
  34. package/core/viewportScroll/scrollStrategies/focusScroll.js +15 -0
  35. package/core/viewportScroll/scrollStrategies/focusScroll.mjs +11 -0
  36. package/core.d.ts +4 -3
  37. package/core.js +77 -22
  38. package/core.mjs +77 -22
  39. package/dataMap/dataSource.js +1 -1
  40. package/dataMap/dataSource.mjs +1 -1
  41. package/dataMap/metaManager/metaLayers/cellMeta.js +1 -1
  42. package/dataMap/metaManager/metaLayers/cellMeta.mjs +1 -1
  43. package/dataMap/metaManager/metaSchema.js +1 -1
  44. package/dataMap/metaManager/metaSchema.mjs +1 -1
  45. package/dataMap/replaceData.js +1 -1
  46. package/dataMap/replaceData.mjs +1 -1
  47. package/dist/handsontable.css +4 -4
  48. package/dist/handsontable.full.css +4 -4
  49. package/dist/handsontable.full.js +9063 -9122
  50. package/dist/handsontable.full.min.css +3 -3
  51. package/dist/handsontable.full.min.js +292 -292
  52. package/dist/handsontable.js +6968 -6574
  53. package/dist/handsontable.min.css +3 -3
  54. package/dist/handsontable.min.js +25 -25
  55. package/dist/languages/all.min.js +1 -1
  56. package/dist/languages/ar-AR.min.js +1 -1
  57. package/dist/languages/cs-CZ.min.js +1 -1
  58. package/dist/languages/de-CH.min.js +1 -1
  59. package/dist/languages/de-DE.min.js +1 -1
  60. package/dist/languages/en-US.min.js +1 -1
  61. package/dist/languages/es-MX.min.js +1 -1
  62. package/dist/languages/fr-FR.min.js +1 -1
  63. package/dist/languages/hr-HR.min.js +1 -1
  64. package/dist/languages/it-IT.min.js +1 -1
  65. package/dist/languages/ja-JP.min.js +1 -1
  66. package/dist/languages/ko-KR.min.js +1 -1
  67. package/dist/languages/lv-LV.min.js +1 -1
  68. package/dist/languages/nb-NO.min.js +1 -1
  69. package/dist/languages/nl-NL.min.js +1 -1
  70. package/dist/languages/pl-PL.min.js +1 -1
  71. package/dist/languages/pt-BR.min.js +1 -1
  72. package/dist/languages/ru-RU.min.js +1 -1
  73. package/dist/languages/sr-SP.min.js +1 -1
  74. package/dist/languages/zh-CN.min.js +1 -1
  75. package/dist/languages/zh-TW.min.js +1 -1
  76. package/editorManager.js +25 -23
  77. package/editorManager.mjs +25 -23
  78. package/editors/autocompleteEditor/autocompleteEditor.js +6 -10
  79. package/editors/autocompleteEditor/autocompleteEditor.mjs +6 -10
  80. package/editors/selectEditor/selectEditor.js +20 -19
  81. package/editors/selectEditor/selectEditor.mjs +20 -19
  82. package/eventManager.js +1 -1
  83. package/eventManager.mjs +1 -1
  84. package/focusManager.js +64 -82
  85. package/focusManager.mjs +64 -82
  86. package/helpers/dom/element.js +23 -1
  87. package/helpers/dom/element.mjs +21 -1
  88. package/helpers/mixed.js +1 -1
  89. package/helpers/mixed.mjs +1 -1
  90. package/helpers/object.js +2 -2
  91. package/helpers/object.mjs +2 -2
  92. package/i18n/languages/ar-AR.d.ts +5 -0
  93. package/i18n/languages/cs-CZ.d.ts +5 -0
  94. package/i18n/languages/hr-HR.d.ts +5 -0
  95. package/i18n/languages/sr-SP.d.ts +5 -0
  96. package/index.d.ts +10 -0
  97. package/package.json +7 -2
  98. package/pluginHooks.d.ts +4 -3
  99. package/pluginHooks.js +99 -38
  100. package/pluginHooks.mjs +99 -38
  101. package/plugins/autoColumnSize/autoColumnSize.js +49 -65
  102. package/plugins/autoColumnSize/autoColumnSize.mjs +49 -65
  103. package/plugins/autoRowSize/autoRowSize.js +28 -34
  104. package/plugins/autoRowSize/autoRowSize.mjs +28 -34
  105. package/plugins/autofill/autofill.js +30 -38
  106. package/plugins/autofill/autofill.mjs +30 -38
  107. package/plugins/base/base.js +12 -17
  108. package/plugins/base/base.mjs +12 -17
  109. package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +5 -5
  110. package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +5 -5
  111. package/plugins/collapsibleColumns/collapsibleColumns.js +59 -50
  112. package/plugins/collapsibleColumns/collapsibleColumns.mjs +59 -50
  113. package/plugins/columnSorting/columnSorting.js +49 -45
  114. package/plugins/columnSorting/columnSorting.mjs +49 -45
  115. package/plugins/columnSummary/columnSummary.js +22 -26
  116. package/plugins/columnSummary/columnSummary.mjs +22 -26
  117. package/plugins/comments/comments.js +116 -158
  118. package/plugins/comments/comments.mjs +116 -158
  119. package/plugins/contextMenu/contextMenu.js +20 -26
  120. package/plugins/contextMenu/contextMenu.mjs +20 -26
  121. package/plugins/contextMenu/itemsFactory.js +1 -1
  122. package/plugins/contextMenu/itemsFactory.mjs +1 -1
  123. package/plugins/contextMenu/menu/defaultShortcutsList.js +26 -10
  124. package/plugins/contextMenu/menu/defaultShortcutsList.mjs +26 -10
  125. package/plugins/contextMenu/menu/menu.js +13 -21
  126. package/plugins/contextMenu/menu/menu.mjs +13 -21
  127. package/plugins/contextMenu/menu/positioner.js +41 -58
  128. package/plugins/contextMenu/menu/positioner.mjs +41 -58
  129. package/plugins/copyPaste/copyPaste.js +116 -157
  130. package/plugins/copyPaste/copyPaste.mjs +116 -157
  131. package/plugins/copyPaste/copyableRanges.js +43 -66
  132. package/plugins/copyPaste/copyableRanges.mjs +43 -66
  133. package/plugins/customBorders/customBorders.js +11 -13
  134. package/plugins/customBorders/customBorders.mjs +11 -13
  135. package/plugins/dragToScroll/dragToScroll.js +6 -6
  136. package/plugins/dragToScroll/dragToScroll.mjs +6 -6
  137. package/plugins/dropdownMenu/dropdownMenu.js +81 -107
  138. package/plugins/dropdownMenu/dropdownMenu.mjs +81 -107
  139. package/plugins/exportFile/dataProvider.js +1 -1
  140. package/plugins/exportFile/dataProvider.mjs +1 -1
  141. package/plugins/filters/component/actionBar.js +9 -9
  142. package/plugins/filters/component/actionBar.mjs +8 -8
  143. package/plugins/filters/component/condition.js +13 -15
  144. package/plugins/filters/component/condition.mjs +13 -15
  145. package/plugins/filters/component/operators.js +6 -6
  146. package/plugins/filters/component/operators.mjs +6 -6
  147. package/plugins/filters/component/value.js +24 -28
  148. package/plugins/filters/component/value.mjs +24 -28
  149. package/plugins/filters/conditionUpdateObserver.js +22 -24
  150. package/plugins/filters/conditionUpdateObserver.mjs +22 -24
  151. package/plugins/filters/dataFilter.js +1 -1
  152. package/plugins/filters/dataFilter.mjs +1 -1
  153. package/plugins/filters/filters.js +81 -95
  154. package/plugins/filters/filters.mjs +81 -95
  155. package/plugins/filters/ui/input.js +13 -19
  156. package/plugins/filters/ui/input.mjs +13 -19
  157. package/plugins/filters/ui/link.js +8 -13
  158. package/plugins/filters/ui/link.mjs +8 -13
  159. package/plugins/filters/ui/multipleSelect.js +85 -112
  160. package/plugins/filters/ui/multipleSelect.mjs +85 -112
  161. package/plugins/filters/ui/radioInput.js +12 -20
  162. package/plugins/filters/ui/radioInput.mjs +12 -20
  163. package/plugins/filters/ui/select.js +50 -72
  164. package/plugins/filters/ui/select.mjs +49 -71
  165. package/plugins/formulas/formulas.js +268 -326
  166. package/plugins/formulas/formulas.mjs +269 -327
  167. package/plugins/formulas/indexSyncer/axisSyncer.js +38 -61
  168. package/plugins/formulas/indexSyncer/axisSyncer.mjs +38 -61
  169. package/plugins/formulas/indexSyncer/index.js +25 -48
  170. package/plugins/formulas/indexSyncer/index.mjs +25 -48
  171. package/plugins/hiddenColumns/hiddenColumns.js +64 -83
  172. package/plugins/hiddenColumns/hiddenColumns.mjs +64 -83
  173. package/plugins/hiddenRows/hiddenRows.js +63 -82
  174. package/plugins/hiddenRows/hiddenRows.mjs +63 -82
  175. package/plugins/manualColumnFreeze/manualColumnFreeze.js +24 -32
  176. package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +25 -33
  177. package/plugins/manualColumnMove/manualColumnMove.js +126 -170
  178. package/plugins/manualColumnMove/manualColumnMove.mjs +126 -170
  179. package/plugins/manualColumnResize/manualColumnResize.js +169 -230
  180. package/plugins/manualColumnResize/manualColumnResize.mjs +169 -230
  181. package/plugins/manualRowMove/manualRowMove.js +99 -128
  182. package/plugins/manualRowMove/manualRowMove.mjs +99 -128
  183. package/plugins/manualRowResize/manualRowResize.js +150 -209
  184. package/plugins/manualRowResize/manualRowResize.mjs +150 -209
  185. package/plugins/mergeCells/calculations/selection.js +2 -71
  186. package/plugins/mergeCells/calculations/selection.mjs +2 -71
  187. package/plugins/mergeCells/cellsCollection.js +117 -1
  188. package/plugins/mergeCells/cellsCollection.mjs +117 -1
  189. package/plugins/mergeCells/contextMenuItem/toggleMerge.js +11 -1
  190. package/plugins/mergeCells/contextMenuItem/toggleMerge.mjs +11 -1
  191. package/plugins/mergeCells/focusOrder.js +305 -0
  192. package/plugins/mergeCells/focusOrder.mjs +300 -0
  193. package/plugins/mergeCells/mergeCells.js +499 -397
  194. package/plugins/mergeCells/mergeCells.mjs +499 -397
  195. package/plugins/multiColumnSorting/multiColumnSorting.js +8 -2
  196. package/plugins/multiColumnSorting/multiColumnSorting.mjs +8 -2
  197. package/plugins/multipleSelectionHandles/multipleSelectionHandles.js +1 -1
  198. package/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs +1 -1
  199. package/plugins/nestedHeaders/nestedHeaders.js +205 -253
  200. package/plugins/nestedHeaders/nestedHeaders.mjs +206 -254
  201. package/plugins/nestedHeaders/stateManager/headersTree.js +21 -32
  202. package/plugins/nestedHeaders/stateManager/headersTree.mjs +21 -32
  203. package/plugins/nestedHeaders/stateManager/index.js +30 -41
  204. package/plugins/nestedHeaders/stateManager/index.mjs +30 -41
  205. package/plugins/nestedHeaders/stateManager/sourceSettings.js +19 -30
  206. package/plugins/nestedHeaders/stateManager/sourceSettings.mjs +19 -30
  207. package/plugins/nestedRows/data/dataManager.js +1 -1
  208. package/plugins/nestedRows/data/dataManager.mjs +1 -1
  209. package/plugins/nestedRows/nestedRows.js +151 -182
  210. package/plugins/nestedRows/nestedRows.mjs +152 -183
  211. package/plugins/nestedRows/ui/contextMenu.js +11 -15
  212. package/plugins/nestedRows/ui/contextMenu.mjs +10 -14
  213. package/plugins/nestedRows/utils/rowMoveController.js +1 -1
  214. package/plugins/nestedRows/utils/rowMoveController.mjs +1 -1
  215. package/plugins/persistentState/storage.js +2 -2
  216. package/plugins/persistentState/storage.mjs +2 -2
  217. package/plugins/search/search.js +7 -7
  218. package/plugins/search/search.mjs +7 -7
  219. package/plugins/touchScroll/touchScroll.js +15 -19
  220. package/plugins/touchScroll/touchScroll.mjs +16 -20
  221. package/plugins/trimRows/trimRows.js +6 -6
  222. package/plugins/trimRows/trimRows.mjs +6 -6
  223. package/renderers/checkboxRenderer/checkboxRenderer.js +8 -5
  224. package/renderers/checkboxRenderer/checkboxRenderer.mjs +8 -5
  225. package/selection/highlight/highlight.js +14 -14
  226. package/selection/highlight/highlight.mjs +13 -13
  227. package/selection/highlight/visualSelection.js +2 -0
  228. package/selection/highlight/visualSelection.mjs +2 -0
  229. package/selection/selection.js +225 -67
  230. package/selection/selection.mjs +224 -66
  231. package/selection/transformation.js +149 -118
  232. package/selection/transformation.mjs +149 -118
  233. package/shortcutContexts/commands/editor/closeAndSave.js +2 -2
  234. package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -2
  235. package/shortcutContexts/commands/editor/open.js +18 -3
  236. package/shortcutContexts/commands/editor/open.mjs +18 -3
  237. package/shortcutContexts/commands/extendCellsSelection/down.js +1 -1
  238. package/shortcutContexts/commands/extendCellsSelection/down.mjs +1 -1
  239. package/shortcutContexts/commands/extendCellsSelection/left.js +1 -1
  240. package/shortcutContexts/commands/extendCellsSelection/left.mjs +1 -1
  241. package/shortcutContexts/commands/extendCellsSelection/right.js +1 -1
  242. package/shortcutContexts/commands/extendCellsSelection/right.mjs +1 -1
  243. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +1 -1
  244. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +1 -1
  245. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +3 -1
  246. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +3 -1
  247. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +9 -3
  248. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +9 -3
  249. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +10 -3
  250. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +10 -3
  251. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +3 -1
  252. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +3 -1
  253. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +3 -1
  254. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +3 -1
  255. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +3 -1
  256. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +3 -1
  257. package/shortcutContexts/commands/extendCellsSelection/toRows.js +1 -1
  258. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +1 -1
  259. package/shortcutContexts/commands/extendCellsSelection/up.js +1 -1
  260. package/shortcutContexts/commands/extendCellsSelection/up.mjs +1 -1
  261. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +6 -1
  262. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +6 -1
  263. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +6 -1
  264. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +6 -1
  265. package/shortcutContexts/grid.js +9 -3
  266. package/shortcutContexts/grid.mjs +9 -3
  267. package/shortcuts/context.js +2 -1
  268. package/shortcuts/context.mjs +2 -1
  269. package/tableView.js +52 -78
  270. package/tableView.mjs +52 -78
  271. package/translations/changesObservable/observable.js +21 -38
  272. package/translations/changesObservable/observable.mjs +21 -38
  273. package/translations/changesObservable/observer.js +7 -12
  274. package/translations/changesObservable/observer.mjs +6 -11
  275. package/translations/mapCollections/aggregatedCollection.js +1 -1
  276. package/translations/mapCollections/aggregatedCollection.mjs +1 -1
  277. package/translations/maps/indexMap.js +1 -1
  278. package/translations/maps/indexMap.mjs +1 -1
  279. package/utils/dataStructures/linkedList.js +6 -1
  280. package/utils/dataStructures/linkedList.mjs +6 -1
  281. package/utils/dataStructures/tree.js +1 -1
  282. package/utils/dataStructures/tree.mjs +1 -1
  283. package/utils/interval.js +26 -44
  284. package/utils/interval.mjs +26 -44
@@ -6,18 +6,16 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
6
6
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
7
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
8
8
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
- function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
10
- function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
11
- function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
12
- function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
13
- function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
14
- function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
9
+ function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
10
+ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
11
+ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
15
12
  import { BasePlugin } from "../base/index.mjs";
16
13
  import { arrayEach, arrayFilter, arrayUnique } from "../../helpers/array.mjs";
17
14
  import { rangeEach } from "../../helpers/number.mjs";
18
15
  import { warn } from "../../helpers/console.mjs";
19
16
  import { addClass, hasClass, removeClass, fastInnerText, removeAttribute, setAttribute } from "../../helpers/dom/element.mjs";
20
17
  import { stopImmediatePropagation } from "../../helpers/dom/event.mjs";
18
+ import { EDITOR_EDIT_GROUP as SHORTCUTS_GROUP_EDITOR } from "../../shortcutContexts/index.mjs";
21
19
  import { A11Y_EXPANDED, A11Y_HIDDEN } from "../../helpers/a11y.mjs";
22
20
  export const PLUGIN_KEY = 'collapsibleColumns';
23
21
  export const PLUGIN_PRIORITY = 290;
@@ -106,32 +104,10 @@ const actionDictionary = new Map([['collapse', {
106
104
  * :::
107
105
  */
108
106
  var _collapsedColumnsMap = /*#__PURE__*/new WeakMap();
109
- var _onAfterGetColHeader = /*#__PURE__*/new WeakSet();
110
- var _onBeforeOnCellMouseDown = /*#__PURE__*/new WeakSet();
111
- var _onInit = /*#__PURE__*/new WeakSet();
112
- var _onAfterLoadData = /*#__PURE__*/new WeakSet();
107
+ var _CollapsibleColumns_brand = /*#__PURE__*/new WeakSet();
113
108
  export class CollapsibleColumns extends BasePlugin {
114
109
  constructor() {
115
110
  super(...arguments);
116
- /**
117
- * Updates the plugin state after new dataset load.
118
- *
119
- * @param {Array[]} sourceData Array of arrays or array of objects containing data.
120
- * @param {boolean} initialLoad Flag that determines whether the data has been loaded
121
- * during the initialization.
122
- */
123
- _classPrivateMethodInitSpec(this, _onAfterLoadData);
124
- /**
125
- * Updates the plugin state after HoT initialization.
126
- */
127
- _classPrivateMethodInitSpec(this, _onInit);
128
- /**
129
- * Indicator mouse event callback.
130
- *
131
- * @param {object} event Mouse event.
132
- * @param {object} coords Event coordinates.
133
- */
134
- _classPrivateMethodInitSpec(this, _onBeforeOnCellMouseDown);
135
111
  /**
136
112
  * Adds the indicator to the headers.
137
113
  *
@@ -140,7 +116,7 @@ export class CollapsibleColumns extends BasePlugin {
140
116
  * @param {number} headerLevel The index of header level counting from the top (positive
141
117
  * values counting from 0 to N).
142
118
  */
143
- _classPrivateMethodInitSpec(this, _onAfterGetColHeader);
119
+ _classPrivateMethodInitSpec(this, _CollapsibleColumns_brand);
144
120
  /**
145
121
  * Cached reference to the NestedHeaders plugin.
146
122
  *
@@ -161,10 +137,7 @@ export class CollapsibleColumns extends BasePlugin {
161
137
  * @private
162
138
  * @type {HidingMap|null}
163
139
  */
164
- _classPrivateFieldInitSpec(this, _collapsedColumnsMap, {
165
- writable: true,
166
- value: null
167
- });
140
+ _classPrivateFieldInitSpec(this, _collapsedColumnsMap, null);
168
141
  }
169
142
  static get PLUGIN_KEY() {
170
143
  return PLUGIN_KEY;
@@ -202,23 +175,23 @@ export class CollapsibleColumns extends BasePlugin {
202
175
  if (!nestedHeaders) {
203
176
  warn('You need to configure the Nested Headers plugin in order to use collapsible headers.');
204
177
  }
205
- _classPrivateFieldSet(this, _collapsedColumnsMap, this.hot.columnIndexMapper.createAndRegisterIndexMap(this.pluginName, 'hiding'));
178
+ _classPrivateFieldSet(_collapsedColumnsMap, this, this.hot.columnIndexMapper.createAndRegisterIndexMap(this.pluginName, 'hiding'));
206
179
  this.nestedHeadersPlugin = this.hot.getPlugin('nestedHeaders');
207
180
  this.headerStateManager = this.nestedHeadersPlugin.getStateManager();
208
- this.addHook('init', () => _classPrivateMethodGet(this, _onInit, _onInit2).call(this));
181
+ this.addHook('init', () => _assertClassBrand(_CollapsibleColumns_brand, this, _onInit).call(this));
209
182
  this.addHook('afterLoadData', function () {
210
183
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
211
184
  args[_key] = arguments[_key];
212
185
  }
213
- return _classPrivateMethodGet(_this, _onAfterLoadData, _onAfterLoadData2).call(_this, ...args);
186
+ return _assertClassBrand(_CollapsibleColumns_brand, _this, _onAfterLoadData).call(_this, ...args);
214
187
  });
215
188
  this.addHook('afterGetColHeader', function () {
216
189
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
217
190
  args[_key2] = arguments[_key2];
218
191
  }
219
- return _classPrivateMethodGet(_this, _onAfterGetColHeader, _onAfterGetColHeader2).call(_this, ...args);
192
+ return _assertClassBrand(_CollapsibleColumns_brand, _this, _onAfterGetColHeader).call(_this, ...args);
220
193
  });
221
- this.addHook('beforeOnCellMouseDown', (event, coords, TD) => _classPrivateMethodGet(this, _onBeforeOnCellMouseDown, _onBeforeOnCellMouseDown2).call(this, event, coords, TD));
194
+ this.addHook('beforeOnCellMouseDown', (event, coords, TD) => _assertClassBrand(_CollapsibleColumns_brand, this, _onBeforeOnCellMouseDown).call(this, event, coords, TD));
222
195
  this.registerShortcuts();
223
196
  super.enablePlugin();
224
197
  // @TODO: Workaround for broken plugin initialization abstraction (#6806).
@@ -265,7 +238,7 @@ export class CollapsibleColumns extends BasePlugin {
265
238
  */
266
239
  disablePlugin() {
267
240
  this.hot.columnIndexMapper.unregisterMap(this.pluginName);
268
- _classPrivateFieldSet(this, _collapsedColumnsMap, null);
241
+ _classPrivateFieldSet(_collapsedColumnsMap, this, null);
269
242
  this.nestedHeadersPlugin = null;
270
243
  this.unregisterShortcuts();
271
244
  this.clearButtons();
@@ -305,12 +278,17 @@ export class CollapsibleColumns extends BasePlugin {
305
278
  col: columnIndex
306
279
  });
307
280
  }
281
+
282
+ // prevent default Enter behavior (move to the next row within a selection range)
283
+ return false;
308
284
  },
309
285
  runOnlyIf: () => {
310
- var _this$hot$getSelected;
311
- return (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight.isHeader();
286
+ var _this$hot$getSelected, _this$hot$getSelected2;
287
+ return ((_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.isSingle()) && ((_this$hot$getSelected2 = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected2 === void 0 ? void 0 : _this$hot$getSelected2.highlight.isHeader());
312
288
  },
313
- group: SHORTCUTS_GROUP
289
+ group: SHORTCUTS_GROUP,
290
+ relativeToGroup: SHORTCUTS_GROUP_EDITOR,
291
+ position: 'before'
314
292
  });
315
293
  }
316
294
 
@@ -494,10 +472,25 @@ export class CollapsibleColumns extends BasePlugin {
494
472
  }
495
473
  this.hot.batchExecution(() => {
496
474
  arrayEach(affectedColumnsIndexes, visualColumn => {
497
- _classPrivateFieldGet(this, _collapsedColumnsMap).setValueAtIndex(this.hot.toPhysicalColumn(visualColumn), actionTranslator.hideColumn);
475
+ _classPrivateFieldGet(_collapsedColumnsMap, this).setValueAtIndex(this.hot.toPhysicalColumn(visualColumn), actionTranslator.hideColumn);
498
476
  });
499
477
  }, true);
500
478
  const isActionPerformed = this.getCollapsedColumns().length !== currentCollapsedColumns.length;
479
+ const selectionRange = this.hot.getSelectedRangeLast();
480
+ if (action === 'collapse' && isActionPerformed && selectionRange) {
481
+ const {
482
+ row,
483
+ col
484
+ } = selectionRange.highlight;
485
+ const isHidden = this.hot.rowIndexMapper.isHidden(row) || this.hot.columnIndexMapper.isHidden(col);
486
+ if (isHidden && affectedColumnsIndexes.includes(col)) {
487
+ const nextRow = row >= 0 ? this.hot.rowIndexMapper.getNearestNotHiddenIndex(row, 1, true) : row;
488
+ const nextColumn = col >= 0 ? this.hot.columnIndexMapper.getNearestNotHiddenIndex(col, 1, true) : col;
489
+ if (nextRow !== null && nextColumn !== null) {
490
+ this.hot.selectCell(nextRow, nextColumn);
491
+ }
492
+ }
493
+ }
501
494
  this.hot.runHooks(actionTranslator.afterHook, currentCollapsedColumns, destinationCollapsedColumns, isActionPossible, isActionPerformed);
502
495
  this.hot.render();
503
496
  this.hot.view.adjustElementsSize(true);
@@ -510,17 +503,17 @@ export class CollapsibleColumns extends BasePlugin {
510
503
  * @returns {number[]}
511
504
  */
512
505
  getCollapsedColumns() {
513
- return _classPrivateFieldGet(this, _collapsedColumnsMap).getHiddenIndexes();
506
+ return _classPrivateFieldGet(_collapsedColumnsMap, this).getHiddenIndexes();
514
507
  }
515
508
  /**
516
509
  * Destroys the plugin instance.
517
510
  */
518
511
  destroy() {
519
- _classPrivateFieldSet(this, _collapsedColumnsMap, null);
512
+ _classPrivateFieldSet(_collapsedColumnsMap, this, null);
520
513
  super.destroy();
521
514
  }
522
515
  }
523
- function _onAfterGetColHeader2(column, TH, headerLevel) {
516
+ function _onAfterGetColHeader(column, TH, headerLevel) {
524
517
  var _this$headerStateMana3;
525
518
  const {
526
519
  collapsible,
@@ -563,7 +556,13 @@ function _onAfterGetColHeader2(column, TH, headerLevel) {
563
556
  (_collapsibleElement = collapsibleElement) === null || _collapsibleElement === void 0 || _collapsibleElement.remove();
564
557
  }
565
558
  }
566
- function _onBeforeOnCellMouseDown2(event, coords) {
559
+ /**
560
+ * Indicator mouse event callback.
561
+ *
562
+ * @param {object} event Mouse event.
563
+ * @param {object} coords Event coordinates.
564
+ */
565
+ function _onBeforeOnCellMouseDown(event, coords) {
567
566
  if (hasClass(event.target, COLLAPSIBLE_ELEMENT_CLASS)) {
568
567
  if (hasClass(event.target, 'expanded')) {
569
568
  this.eventManager.fireEvent(event.target, 'mouseup');
@@ -575,11 +574,21 @@ function _onBeforeOnCellMouseDown2(event, coords) {
575
574
  stopImmediatePropagation(event);
576
575
  }
577
576
  }
578
- function _onInit2() {
577
+ /**
578
+ * Updates the plugin state after HoT initialization.
579
+ */
580
+ function _onInit() {
579
581
  // @TODO: Workaround for broken plugin initialization abstraction (#6806).
580
582
  this.updatePlugin();
581
583
  }
582
- function _onAfterLoadData2(sourceData, initialLoad) {
584
+ /**
585
+ * Updates the plugin state after new dataset load.
586
+ *
587
+ * @param {Array[]} sourceData Array of arrays or array of objects containing data.
588
+ * @param {boolean} initialLoad Flag that determines whether the data has been loaded
589
+ * during the initialization.
590
+ */
591
+ function _onAfterLoadData(sourceData, initialLoad) {
583
592
  if (!initialLoad) {
584
593
  this.updatePlugin();
585
594
  }
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- require("core-js/modules/es.array.push.js");
5
4
  require("core-js/modules/es.error.cause.js");
5
+ require("core-js/modules/es.array.push.js");
6
6
  var _element = require("../../helpers/dom/element");
7
7
  var _mixed = require("../../helpers/mixed");
8
8
  var _object = require("../../helpers/object");
@@ -12,6 +12,7 @@ var _base = require("../base");
12
12
  var _translations = require("../../translations");
13
13
  var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
14
14
  var _columnStatesManager = require("./columnStatesManager");
15
+ var _shortcutContexts = require("../../shortcutContexts");
15
16
  var _utils = require("./utils");
16
17
  var _domHelpers = require("./domHelpers");
17
18
  var _rootComparator = require("./rootComparator");
@@ -23,7 +24,7 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
23
24
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
24
25
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
25
26
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
26
- function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
27
+ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
27
28
  const PLUGIN_KEY = exports.PLUGIN_KEY = 'columnSorting';
28
29
  const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 50;
29
30
  const APPEND_COLUMN_CONFIG_STRATEGY = exports.APPEND_COLUMN_CONFIG_STRATEGY = 'append';
@@ -83,40 +84,14 @@ _pluginHooks.default.getSingleton().register('afterColumnSort');
83
84
  * }]
84
85
  * ```
85
86
  */
86
- var _loadOrSortBySettings = /*#__PURE__*/new WeakSet();
87
- var _onAfterGetColHeader = /*#__PURE__*/new WeakSet();
88
- var _onAfterLoadData = /*#__PURE__*/new WeakSet();
89
- var _onBeforeOnCellMouseDown = /*#__PURE__*/new WeakSet();
87
+ var _ColumnSorting_brand = /*#__PURE__*/new WeakSet();
90
88
  class ColumnSorting extends _base.BasePlugin {
91
89
  constructor() {
92
90
  super(...arguments);
93
- /**
94
- * Changes the behavior of selection / dragging.
95
- *
96
- * @param {MouseEvent} event The `mousedown` event.
97
- * @param {CellCoords} coords Visual coordinates.
98
- * @param {HTMLElement} TD The cell element.
99
- * @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains
100
- * a boolean value that allows or disallows changing the selection for that particular area.
101
- */
102
- _classPrivateMethodInitSpec(this, _onBeforeOnCellMouseDown);
103
- /**
104
- * Callback for the `afterLoadData` hook.
105
- *
106
- * @param {boolean} initialLoad Flag that determines whether the data has been loaded during the initialization.
107
- */
108
- _classPrivateMethodInitSpec(this, _onAfterLoadData);
109
- /**
110
- * Callback for the `onAfterGetColHeader` hook. Adds column sorting CSS classes.
111
- *
112
- * @param {number} column Visual column index.
113
- * @param {Element} TH TH HTML element.
114
- */
115
- _classPrivateMethodInitSpec(this, _onAfterGetColHeader);
116
91
  /**
117
92
  * Load saved settings or sort by predefined plugin configuration.
118
93
  */
119
- _classPrivateMethodInitSpec(this, _loadOrSortBySettings);
94
+ _classPrivateMethodInitSpec(this, _ColumnSorting_brand);
120
95
  /**
121
96
  * Instance of column state manager.
122
97
  *
@@ -179,25 +154,25 @@ class ColumnSorting extends _base.BasePlugin {
179
154
  return this.getMergedPluginSettings(visualIndex);
180
155
  });
181
156
  this.hot.columnIndexMapper.registerMap(`${this.pluginKey}.columnMeta`, this.columnMetaCache);
182
- this.addHook('afterGetColHeader', (column, TH) => _classPrivateMethodGet(this, _onAfterGetColHeader, _onAfterGetColHeader2).call(this, column, TH));
157
+ this.addHook('afterGetColHeader', (column, TH) => _assertClassBrand(_ColumnSorting_brand, this, _onAfterGetColHeader).call(this, column, TH));
183
158
  this.addHook('beforeOnCellMouseDown', function () {
184
159
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
185
160
  args[_key] = arguments[_key];
186
161
  }
187
- return _classPrivateMethodGet(_this, _onBeforeOnCellMouseDown, _onBeforeOnCellMouseDown2).call(_this, ...args);
162
+ return _assertClassBrand(_ColumnSorting_brand, _this, _onBeforeOnCellMouseDown).call(_this, ...args);
188
163
  });
189
164
  this.addHook('afterOnCellMouseDown', (event, target) => this.onAfterOnCellMouseDown(event, target));
190
- this.addHook('afterInit', () => _classPrivateMethodGet(this, _loadOrSortBySettings, _loadOrSortBySettings2).call(this));
165
+ this.addHook('afterInit', () => _assertClassBrand(_ColumnSorting_brand, this, _loadOrSortBySettings).call(this));
191
166
  this.addHook('afterLoadData', function () {
192
167
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
193
168
  args[_key2] = arguments[_key2];
194
169
  }
195
- return _classPrivateMethodGet(_this, _onAfterLoadData, _onAfterLoadData2).call(_this, ...args);
170
+ return _assertClassBrand(_ColumnSorting_brand, _this, _onAfterLoadData).call(_this, ...args);
196
171
  });
197
172
 
198
173
  // TODO: Workaround? It should be refactored / described.
199
174
  if (this.hot.view) {
200
- _classPrivateMethodGet(this, _loadOrSortBySettings, _loadOrSortBySettings2).call(this);
175
+ _assertClassBrand(_ColumnSorting_brand, this, _loadOrSortBySettings).call(this);
201
176
  }
202
177
  this.registerShortcuts();
203
178
  super.enablePlugin();
@@ -246,15 +221,18 @@ class ColumnSorting extends _base.BasePlugin {
246
221
  const {
247
222
  highlight
248
223
  } = this.hot.getSelectedRangeLast();
249
- if (highlight.row === -1 && highlight.col >= 0) {
250
- this.sort(this.getColumnNextConfig(highlight.col));
251
- }
224
+ this.sort(this.getColumnNextConfig(highlight.col));
225
+
226
+ // prevent default Enter behavior (move to the next row within a selection range)
227
+ return false;
252
228
  },
253
229
  runOnlyIf: () => {
254
- var _this$hot$getSelected;
230
+ var _this$hot$getSelected, _this$hot$getSelected2;
255
231
  const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
256
- return highlight && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
232
+ return highlight && ((_this$hot$getSelected2 = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected2 === void 0 ? void 0 : _this$hot$getSelected2.isSingle()) && this.hot.selection.isCellVisible(highlight) && highlight.row === -1 && highlight.col >= 0;
257
233
  },
234
+ relativeToGroup: _shortcutContexts.EDITOR_EDIT_GROUP,
235
+ position: 'before',
258
236
  group: SHORTCUTS_GROUP
259
237
  });
260
238
  }
@@ -654,6 +632,14 @@ class ColumnSorting extends _base.BasePlugin {
654
632
  this.hot.render();
655
633
  }
656
634
  }
635
+
636
+ /**
637
+ * Callback for the `onAfterGetColHeader` hook. Adds column sorting CSS classes.
638
+ *
639
+ * @param {number} column Visual column index.
640
+ * @param {Element} TH TH HTML element.
641
+ */
642
+
657
643
  /**
658
644
  * Update header classes.
659
645
  *
@@ -688,6 +674,13 @@ class ColumnSorting extends _base.BasePlugin {
688
674
  this.sortBySettings(newSettings[this.pluginKey]);
689
675
  }
690
676
  }
677
+
678
+ /**
679
+ * Callback for the `afterLoadData` hook.
680
+ *
681
+ * @param {boolean} initialLoad Flag that determines whether the data has been loaded during the initialization.
682
+ */
683
+
691
684
  /**
692
685
  * Indicates if clickable header was clicked.
693
686
  *
@@ -701,6 +694,17 @@ class ColumnSorting extends _base.BasePlugin {
701
694
  const headerActionEnabled = pluginSettingsForColumn.headerAction;
702
695
  return headerActionEnabled && (0, _element.hasClass)(event.target, _utils.HEADER_SPAN_CLASS);
703
696
  }
697
+
698
+ /**
699
+ * Changes the behavior of selection / dragging.
700
+ *
701
+ * @param {MouseEvent} event The `mousedown` event.
702
+ * @param {CellCoords} coords Visual coordinates.
703
+ * @param {HTMLElement} TD The cell element.
704
+ * @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains
705
+ * a boolean value that allows or disallows changing the selection for that particular area.
706
+ */
707
+
704
708
  /**
705
709
  * Callback for the `onAfterOnCellMouseDown` hook.
706
710
  *
@@ -733,7 +737,7 @@ class ColumnSorting extends _base.BasePlugin {
733
737
  }
734
738
  }
735
739
  exports.ColumnSorting = ColumnSorting;
736
- function _loadOrSortBySettings2() {
740
+ function _loadOrSortBySettings() {
737
741
  const storedAllSortSettings = this.getAllSavedSortSettings();
738
742
  if ((0, _object.isObject)(storedAllSortSettings)) {
739
743
  this.sortBySettings(storedAllSortSettings);
@@ -742,7 +746,7 @@ function _loadOrSortBySettings2() {
742
746
  this.sortBySettings(allSortSettings);
743
747
  }
744
748
  }
745
- function _onAfterGetColHeader2(column, TH) {
749
+ function _onAfterGetColHeader(column, TH) {
746
750
  const headerSpanElement = (0, _utils.getHeaderSpanElement)(TH);
747
751
  if ((0, _utils.isFirstLevelColumnHeader)(column, TH) === false || headerSpanElement === null) {
748
752
  return;
@@ -756,15 +760,15 @@ function _onAfterGetColHeader2(column, TH) {
756
760
  (0, _element.setAttribute)(TH, ...(0, _a11y.A11Y_SORT)(currentSortState ? `${currentSortState}ending` : 'none'));
757
761
  }
758
762
  }
759
- function _onAfterLoadData2(initialLoad) {
763
+ function _onAfterLoadData(initialLoad) {
760
764
  if (initialLoad === true) {
761
765
  // TODO: Workaround? It should be refactored / described.
762
766
  if (this.hot.view) {
763
- _classPrivateMethodGet(this, _loadOrSortBySettings, _loadOrSortBySettings2).call(this);
767
+ _assertClassBrand(_ColumnSorting_brand, this, _loadOrSortBySettings).call(this);
764
768
  }
765
769
  }
766
770
  }
767
- function _onBeforeOnCellMouseDown2(event, coords, TD, controller) {
771
+ function _onBeforeOnCellMouseDown(event, coords, TD, controller) {
768
772
  if ((0, _utils.wasHeaderClickedProperly)(coords.row, coords.col, event) === false) {
769
773
  return;
770
774
  }
@@ -1,11 +1,11 @@
1
- import "core-js/modules/es.array.push.js";
2
1
  import "core-js/modules/es.error.cause.js";
2
+ import "core-js/modules/es.array.push.js";
3
3
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
4
4
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
5
5
  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; }
6
6
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
7
7
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
- function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
8
+ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
9
9
  import { addClass, hasClass, removeClass, setAttribute } from "../../helpers/dom/element.mjs";
10
10
  import { isUndefined, isDefined } from "../../helpers/mixed.mjs";
11
11
  import { isObject } from "../../helpers/object.mjs";
@@ -15,6 +15,7 @@ import { BasePlugin } from "../base/index.mjs";
15
15
  import { IndexesSequence, PhysicalIndexToValueMap as IndexToValueMap } from "../../translations/index.mjs";
16
16
  import Hooks from "../../pluginHooks.mjs";
17
17
  import { ColumnStatesManager } from "./columnStatesManager.mjs";
18
+ import { EDITOR_EDIT_GROUP as SHORTCUTS_GROUP_EDITOR } from "../../shortcutContexts/index.mjs";
18
19
  import { HEADER_SPAN_CLASS, getNextSortOrder, areValidSortStates, getHeaderSpanElement, isFirstLevelColumnHeader, wasHeaderClickedProperly } from "./utils.mjs";
19
20
  import { getClassesToRemove, getClassesToAdd } from "./domHelpers.mjs";
20
21
  import { rootComparator } from "./rootComparator.mjs";
@@ -79,40 +80,14 @@ Hooks.getSingleton().register('afterColumnSort');
79
80
  * }]
80
81
  * ```
81
82
  */
82
- var _loadOrSortBySettings = /*#__PURE__*/new WeakSet();
83
- var _onAfterGetColHeader = /*#__PURE__*/new WeakSet();
84
- var _onAfterLoadData = /*#__PURE__*/new WeakSet();
85
- var _onBeforeOnCellMouseDown = /*#__PURE__*/new WeakSet();
83
+ var _ColumnSorting_brand = /*#__PURE__*/new WeakSet();
86
84
  export class ColumnSorting extends BasePlugin {
87
85
  constructor() {
88
86
  super(...arguments);
89
- /**
90
- * Changes the behavior of selection / dragging.
91
- *
92
- * @param {MouseEvent} event The `mousedown` event.
93
- * @param {CellCoords} coords Visual coordinates.
94
- * @param {HTMLElement} TD The cell element.
95
- * @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains
96
- * a boolean value that allows or disallows changing the selection for that particular area.
97
- */
98
- _classPrivateMethodInitSpec(this, _onBeforeOnCellMouseDown);
99
- /**
100
- * Callback for the `afterLoadData` hook.
101
- *
102
- * @param {boolean} initialLoad Flag that determines whether the data has been loaded during the initialization.
103
- */
104
- _classPrivateMethodInitSpec(this, _onAfterLoadData);
105
- /**
106
- * Callback for the `onAfterGetColHeader` hook. Adds column sorting CSS classes.
107
- *
108
- * @param {number} column Visual column index.
109
- * @param {Element} TH TH HTML element.
110
- */
111
- _classPrivateMethodInitSpec(this, _onAfterGetColHeader);
112
87
  /**
113
88
  * Load saved settings or sort by predefined plugin configuration.
114
89
  */
115
- _classPrivateMethodInitSpec(this, _loadOrSortBySettings);
90
+ _classPrivateMethodInitSpec(this, _ColumnSorting_brand);
116
91
  /**
117
92
  * Instance of column state manager.
118
93
  *
@@ -175,25 +150,25 @@ export class ColumnSorting extends BasePlugin {
175
150
  return this.getMergedPluginSettings(visualIndex);
176
151
  });
177
152
  this.hot.columnIndexMapper.registerMap(`${this.pluginKey}.columnMeta`, this.columnMetaCache);
178
- this.addHook('afterGetColHeader', (column, TH) => _classPrivateMethodGet(this, _onAfterGetColHeader, _onAfterGetColHeader2).call(this, column, TH));
153
+ this.addHook('afterGetColHeader', (column, TH) => _assertClassBrand(_ColumnSorting_brand, this, _onAfterGetColHeader).call(this, column, TH));
179
154
  this.addHook('beforeOnCellMouseDown', function () {
180
155
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
181
156
  args[_key] = arguments[_key];
182
157
  }
183
- return _classPrivateMethodGet(_this, _onBeforeOnCellMouseDown, _onBeforeOnCellMouseDown2).call(_this, ...args);
158
+ return _assertClassBrand(_ColumnSorting_brand, _this, _onBeforeOnCellMouseDown).call(_this, ...args);
184
159
  });
185
160
  this.addHook('afterOnCellMouseDown', (event, target) => this.onAfterOnCellMouseDown(event, target));
186
- this.addHook('afterInit', () => _classPrivateMethodGet(this, _loadOrSortBySettings, _loadOrSortBySettings2).call(this));
161
+ this.addHook('afterInit', () => _assertClassBrand(_ColumnSorting_brand, this, _loadOrSortBySettings).call(this));
187
162
  this.addHook('afterLoadData', function () {
188
163
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
189
164
  args[_key2] = arguments[_key2];
190
165
  }
191
- return _classPrivateMethodGet(_this, _onAfterLoadData, _onAfterLoadData2).call(_this, ...args);
166
+ return _assertClassBrand(_ColumnSorting_brand, _this, _onAfterLoadData).call(_this, ...args);
192
167
  });
193
168
 
194
169
  // TODO: Workaround? It should be refactored / described.
195
170
  if (this.hot.view) {
196
- _classPrivateMethodGet(this, _loadOrSortBySettings, _loadOrSortBySettings2).call(this);
171
+ _assertClassBrand(_ColumnSorting_brand, this, _loadOrSortBySettings).call(this);
197
172
  }
198
173
  this.registerShortcuts();
199
174
  super.enablePlugin();
@@ -242,15 +217,18 @@ export class ColumnSorting extends BasePlugin {
242
217
  const {
243
218
  highlight
244
219
  } = this.hot.getSelectedRangeLast();
245
- if (highlight.row === -1 && highlight.col >= 0) {
246
- this.sort(this.getColumnNextConfig(highlight.col));
247
- }
220
+ this.sort(this.getColumnNextConfig(highlight.col));
221
+
222
+ // prevent default Enter behavior (move to the next row within a selection range)
223
+ return false;
248
224
  },
249
225
  runOnlyIf: () => {
250
- var _this$hot$getSelected;
226
+ var _this$hot$getSelected, _this$hot$getSelected2;
251
227
  const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
252
- return highlight && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
228
+ return highlight && ((_this$hot$getSelected2 = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected2 === void 0 ? void 0 : _this$hot$getSelected2.isSingle()) && this.hot.selection.isCellVisible(highlight) && highlight.row === -1 && highlight.col >= 0;
253
229
  },
230
+ relativeToGroup: SHORTCUTS_GROUP_EDITOR,
231
+ position: 'before',
254
232
  group: SHORTCUTS_GROUP
255
233
  });
256
234
  }
@@ -650,6 +628,14 @@ export class ColumnSorting extends BasePlugin {
650
628
  this.hot.render();
651
629
  }
652
630
  }
631
+
632
+ /**
633
+ * Callback for the `onAfterGetColHeader` hook. Adds column sorting CSS classes.
634
+ *
635
+ * @param {number} column Visual column index.
636
+ * @param {Element} TH TH HTML element.
637
+ */
638
+
653
639
  /**
654
640
  * Update header classes.
655
641
  *
@@ -684,6 +670,13 @@ export class ColumnSorting extends BasePlugin {
684
670
  this.sortBySettings(newSettings[this.pluginKey]);
685
671
  }
686
672
  }
673
+
674
+ /**
675
+ * Callback for the `afterLoadData` hook.
676
+ *
677
+ * @param {boolean} initialLoad Flag that determines whether the data has been loaded during the initialization.
678
+ */
679
+
687
680
  /**
688
681
  * Indicates if clickable header was clicked.
689
682
  *
@@ -697,6 +690,17 @@ export class ColumnSorting extends BasePlugin {
697
690
  const headerActionEnabled = pluginSettingsForColumn.headerAction;
698
691
  return headerActionEnabled && hasClass(event.target, HEADER_SPAN_CLASS);
699
692
  }
693
+
694
+ /**
695
+ * Changes the behavior of selection / dragging.
696
+ *
697
+ * @param {MouseEvent} event The `mousedown` event.
698
+ * @param {CellCoords} coords Visual coordinates.
699
+ * @param {HTMLElement} TD The cell element.
700
+ * @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains
701
+ * a boolean value that allows or disallows changing the selection for that particular area.
702
+ */
703
+
700
704
  /**
701
705
  * Callback for the `onAfterOnCellMouseDown` hook.
702
706
  *
@@ -728,7 +732,7 @@ export class ColumnSorting extends BasePlugin {
728
732
  super.destroy();
729
733
  }
730
734
  }
731
- function _loadOrSortBySettings2() {
735
+ function _loadOrSortBySettings() {
732
736
  const storedAllSortSettings = this.getAllSavedSortSettings();
733
737
  if (isObject(storedAllSortSettings)) {
734
738
  this.sortBySettings(storedAllSortSettings);
@@ -737,7 +741,7 @@ function _loadOrSortBySettings2() {
737
741
  this.sortBySettings(allSortSettings);
738
742
  }
739
743
  }
740
- function _onAfterGetColHeader2(column, TH) {
744
+ function _onAfterGetColHeader(column, TH) {
741
745
  const headerSpanElement = getHeaderSpanElement(TH);
742
746
  if (isFirstLevelColumnHeader(column, TH) === false || headerSpanElement === null) {
743
747
  return;
@@ -751,15 +755,15 @@ function _onAfterGetColHeader2(column, TH) {
751
755
  setAttribute(TH, ...A11Y_SORT(currentSortState ? `${currentSortState}ending` : 'none'));
752
756
  }
753
757
  }
754
- function _onAfterLoadData2(initialLoad) {
758
+ function _onAfterLoadData(initialLoad) {
755
759
  if (initialLoad === true) {
756
760
  // TODO: Workaround? It should be refactored / described.
757
761
  if (this.hot.view) {
758
- _classPrivateMethodGet(this, _loadOrSortBySettings, _loadOrSortBySettings2).call(this);
762
+ _assertClassBrand(_ColumnSorting_brand, this, _loadOrSortBySettings).call(this);
759
763
  }
760
764
  }
761
765
  }
762
- function _onBeforeOnCellMouseDown2(event, coords, TD, controller) {
766
+ function _onBeforeOnCellMouseDown(event, coords, TD, controller) {
763
767
  if (wasHeaderClickedProperly(coords.row, coords.col, event) === false) {
764
768
  return;
765
769
  }