handsontable 0.0.0-next-06a64be-20230621 → 0.0.0-next-d1c8e0e-20230621

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

Potentially problematic release.


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

Files changed (279) hide show
  1. package/3rdparty/walkontable/src/cell/coords.d.ts +6 -1
  2. package/3rdparty/walkontable/src/cell/coords.js +61 -12
  3. package/3rdparty/walkontable/src/cell/coords.mjs +61 -12
  4. package/3rdparty/walkontable/src/cell/range.d.ts +9 -2
  5. package/3rdparty/walkontable/src/cell/range.js +44 -7
  6. package/3rdparty/walkontable/src/cell/range.mjs +44 -7
  7. package/3rdparty/walkontable/src/core/_base.js +9 -3
  8. package/3rdparty/walkontable/src/core/_base.mjs +9 -3
  9. package/3rdparty/walkontable/src/core/clone.js +2 -2
  10. package/3rdparty/walkontable/src/core/clone.mjs +2 -2
  11. package/3rdparty/walkontable/src/core/core.js +3 -2
  12. package/3rdparty/walkontable/src/core/core.mjs +3 -2
  13. package/3rdparty/walkontable/src/event.js +7 -7
  14. package/3rdparty/walkontable/src/event.mjs +7 -7
  15. package/3rdparty/walkontable/src/facade/core.js +2 -2
  16. package/3rdparty/walkontable/src/facade/core.mjs +2 -2
  17. package/3rdparty/walkontable/src/index.js +10 -2
  18. package/3rdparty/walkontable/src/index.mjs +2 -2
  19. package/3rdparty/walkontable/src/overlay/_base.js +1 -1
  20. package/3rdparty/walkontable/src/overlay/_base.mjs +1 -1
  21. package/3rdparty/walkontable/src/overlay/inlineStart.js +2 -4
  22. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +2 -4
  23. package/3rdparty/walkontable/src/overlay/top.js +2 -4
  24. package/3rdparty/walkontable/src/overlay/top.mjs +2 -4
  25. package/3rdparty/walkontable/src/{border.js → selection/border/border.js} +7 -12
  26. package/3rdparty/walkontable/src/{border.mjs → selection/border/border.mjs} +7 -12
  27. package/3rdparty/walkontable/src/selection/border/constants.js +18 -0
  28. package/3rdparty/walkontable/src/selection/border/constants.mjs +13 -0
  29. package/3rdparty/walkontable/src/selection/constants.js +63 -0
  30. package/3rdparty/walkontable/src/selection/constants.mjs +51 -0
  31. package/3rdparty/walkontable/src/selection/index.js +30 -0
  32. package/3rdparty/walkontable/src/selection/index.mjs +5 -0
  33. package/3rdparty/walkontable/src/selection/manager.js +329 -0
  34. package/3rdparty/walkontable/src/selection/manager.mjs +323 -0
  35. package/3rdparty/walkontable/src/selection/scanner.js +364 -0
  36. package/3rdparty/walkontable/src/selection/scanner.mjs +360 -0
  37. package/3rdparty/walkontable/src/selection/selection.js +133 -0
  38. package/3rdparty/walkontable/src/selection/selection.mjs +127 -0
  39. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +9 -0
  40. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +9 -0
  41. package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +9 -0
  42. package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +9 -0
  43. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +9 -0
  44. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +9 -0
  45. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +9 -0
  46. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +9 -0
  47. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +9 -0
  48. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +9 -0
  49. package/3rdparty/walkontable/src/table.js +7 -79
  50. package/3rdparty/walkontable/src/table.mjs +8 -80
  51. package/base.js +2 -2
  52. package/base.mjs +2 -2
  53. package/core.d.ts +5 -3
  54. package/core.js +127 -309
  55. package/core.mjs +127 -309
  56. package/dataMap/metaManager/metaSchema.js +19 -0
  57. package/dataMap/metaManager/metaSchema.mjs +19 -0
  58. package/dist/handsontable.css +8 -3
  59. package/dist/handsontable.full.css +8 -3
  60. package/dist/handsontable.full.js +13658 -10651
  61. package/dist/handsontable.full.min.css +3 -3
  62. package/dist/handsontable.full.min.js +112 -112
  63. package/dist/handsontable.js +16566 -13559
  64. package/dist/handsontable.min.css +3 -3
  65. package/dist/handsontable.min.js +4 -4
  66. package/editorManager.js +21 -94
  67. package/editorManager.mjs +26 -98
  68. package/editors/textEditor/textEditor.js +3 -11
  69. package/editors/textEditor/textEditor.mjs +4 -12
  70. package/helpers/mixed.js +1 -1
  71. package/helpers/mixed.mjs +1 -1
  72. package/helpers/number.d.ts +1 -0
  73. package/helpers/number.js +18 -0
  74. package/helpers/number.mjs +17 -0
  75. package/package.json +1 -1
  76. package/pluginHooks.d.ts +5 -1
  77. package/pluginHooks.js +89 -1
  78. package/pluginHooks.mjs +89 -1
  79. package/plugins/collapsibleColumns/collapsibleColumns.js +81 -24
  80. package/plugins/collapsibleColumns/collapsibleColumns.mjs +81 -24
  81. package/plugins/columnSorting/columnSorting.js +50 -8
  82. package/plugins/columnSorting/columnSorting.mjs +49 -9
  83. package/plugins/columnSorting/index.js +4 -2
  84. package/plugins/columnSorting/index.mjs +1 -1
  85. package/plugins/comments/comments.js +11 -4
  86. package/plugins/comments/comments.mjs +11 -4
  87. package/plugins/contextMenu/contextMenu.d.ts +1 -1
  88. package/plugins/contextMenu/contextMenu.js +80 -29
  89. package/plugins/contextMenu/contextMenu.mjs +81 -30
  90. package/plugins/contextMenu/predefinedItems/alignment.js +7 -0
  91. package/plugins/contextMenu/predefinedItems/alignment.mjs +7 -0
  92. package/plugins/contextMenu/predefinedItems/clearColumn.js +5 -3
  93. package/plugins/contextMenu/predefinedItems/clearColumn.mjs +5 -3
  94. package/plugins/contextMenu/predefinedItems/columnLeft.js +5 -3
  95. package/plugins/contextMenu/predefinedItems/columnLeft.mjs +5 -3
  96. package/plugins/contextMenu/predefinedItems/columnRight.js +5 -3
  97. package/plugins/contextMenu/predefinedItems/columnRight.mjs +5 -3
  98. package/plugins/contextMenu/predefinedItems/readOnly.js +7 -0
  99. package/plugins/contextMenu/predefinedItems/readOnly.mjs +7 -0
  100. package/plugins/contextMenu/predefinedItems/removeColumn.js +7 -5
  101. package/plugins/contextMenu/predefinedItems/removeColumn.mjs +5 -3
  102. package/plugins/contextMenu/predefinedItems/removeRow.js +7 -5
  103. package/plugins/contextMenu/predefinedItems/removeRow.mjs +5 -3
  104. package/plugins/contextMenu/predefinedItems/rowAbove.js +5 -3
  105. package/plugins/contextMenu/predefinedItems/rowAbove.mjs +5 -3
  106. package/plugins/contextMenu/predefinedItems/rowBelow.js +5 -3
  107. package/plugins/contextMenu/predefinedItems/rowBelow.mjs +5 -3
  108. package/plugins/contextMenu/utils.js +25 -16
  109. package/plugins/contextMenu/utils.mjs +24 -15
  110. package/plugins/copyPaste/contextMenuItem/copy.js +7 -0
  111. package/plugins/copyPaste/contextMenuItem/copy.mjs +7 -0
  112. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.js +9 -1
  113. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs +9 -1
  114. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.js +9 -1
  115. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs +9 -1
  116. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.js +9 -1
  117. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs +9 -1
  118. package/plugins/copyPaste/contextMenuItem/cut.js +7 -0
  119. package/plugins/copyPaste/contextMenuItem/cut.mjs +7 -0
  120. package/plugins/copyPaste/copyPaste.js +5 -1
  121. package/plugins/copyPaste/copyPaste.mjs +5 -1
  122. package/plugins/customBorders/customBorders.js +25 -53
  123. package/plugins/customBorders/customBorders.mjs +26 -54
  124. package/plugins/dropdownMenu/dropdownMenu.d.ts +1 -1
  125. package/plugins/dropdownMenu/dropdownMenu.js +94 -30
  126. package/plugins/dropdownMenu/dropdownMenu.mjs +94 -30
  127. package/plugins/filters/filters.js +62 -42
  128. package/plugins/filters/filters.mjs +61 -41
  129. package/plugins/mergeCells/mergeCells.js +5 -18
  130. package/plugins/mergeCells/mergeCells.mjs +5 -18
  131. package/plugins/multiColumnSorting/multiColumnSorting.js +42 -3
  132. package/plugins/multiColumnSorting/multiColumnSorting.mjs +42 -3
  133. package/plugins/nestedHeaders/nestedHeaders.js +132 -10
  134. package/plugins/nestedHeaders/nestedHeaders.mjs +132 -10
  135. package/plugins/nestedHeaders/stateManager/index.js +37 -0
  136. package/plugins/nestedHeaders/stateManager/index.mjs +37 -0
  137. package/plugins/nestedRows/nestedRows.js +52 -7
  138. package/plugins/nestedRows/nestedRows.mjs +52 -7
  139. package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
  140. package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
  141. package/selection/highlight/highlight.js +312 -89
  142. package/selection/highlight/highlight.mjs +302 -85
  143. package/selection/highlight/types/activeHeader.js +10 -9
  144. package/selection/highlight/types/activeHeader.mjs +10 -8
  145. package/selection/highlight/types/area.js +12 -27
  146. package/selection/highlight/types/area.mjs +16 -30
  147. package/selection/highlight/types/areaLayered.js +54 -0
  148. package/selection/highlight/types/areaLayered.mjs +49 -0
  149. package/selection/highlight/types/column.js +50 -0
  150. package/selection/highlight/types/column.mjs +45 -0
  151. package/selection/highlight/types/customSelection.js +7 -10
  152. package/selection/highlight/types/customSelection.mjs +7 -9
  153. package/selection/highlight/types/fill.js +5 -8
  154. package/selection/highlight/types/fill.mjs +5 -7
  155. package/selection/highlight/types/{cell.js → focus.js} +5 -8
  156. package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
  157. package/selection/highlight/types/header.js +10 -20
  158. package/selection/highlight/types/header.mjs +10 -19
  159. package/selection/highlight/types/{index.js → row.js} +27 -31
  160. package/selection/highlight/types/{index.mjs → row.mjs} +24 -29
  161. package/selection/highlight/visualSelection.js +31 -27
  162. package/selection/highlight/visualSelection.mjs +31 -27
  163. package/selection/index.js +4 -7
  164. package/selection/index.mjs +2 -3
  165. package/selection/mouseEventHandler.js +1 -1
  166. package/selection/mouseEventHandler.mjs +1 -1
  167. package/selection/range.js +8 -8
  168. package/selection/range.mjs +8 -8
  169. package/selection/selection.js +315 -181
  170. package/selection/selection.mjs +310 -180
  171. package/selection/transformation.js +233 -96
  172. package/selection/transformation.mjs +230 -93
  173. package/selection/utils.js +12 -36
  174. package/selection/utils.mjs +13 -36
  175. package/settings.d.ts +1 -0
  176. package/shortcutContexts/commands/editor/closeAndSave.js +15 -0
  177. package/shortcutContexts/commands/editor/closeAndSave.mjs +10 -0
  178. package/shortcutContexts/commands/editor/closeWithoutSaving.js +13 -0
  179. package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +8 -0
  180. package/shortcutContexts/commands/editor/fastOpen.js +16 -0
  181. package/shortcutContexts/commands/editor/fastOpen.mjs +11 -0
  182. package/shortcutContexts/commands/editor/index.js +16 -0
  183. package/shortcutContexts/commands/editor/index.mjs +12 -0
  184. package/shortcutContexts/commands/editor/open.js +29 -0
  185. package/shortcutContexts/commands/editor/open.mjs +24 -0
  186. package/shortcutContexts/commands/emptySelectedCells.js +12 -0
  187. package/shortcutContexts/commands/emptySelectedCells.mjs +7 -0
  188. package/shortcutContexts/commands/extendCellsSelection/down.js +15 -0
  189. package/shortcutContexts/commands/extendCellsSelection/down.mjs +10 -0
  190. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +21 -0
  191. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +16 -0
  192. package/shortcutContexts/commands/extendCellsSelection/index.js +26 -0
  193. package/shortcutContexts/commands/extendCellsSelection/index.mjs +22 -0
  194. package/shortcutContexts/commands/extendCellsSelection/left.js +15 -0
  195. package/shortcutContexts/commands/extendCellsSelection/left.mjs +10 -0
  196. package/shortcutContexts/commands/extendCellsSelection/right.js +15 -0
  197. package/shortcutContexts/commands/extendCellsSelection/right.mjs +10 -0
  198. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +19 -0
  199. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +14 -0
  200. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +22 -0
  201. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +17 -0
  202. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +17 -0
  203. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +12 -0
  204. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +17 -0
  205. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +12 -0
  206. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +40 -0
  207. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +35 -0
  208. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +40 -0
  209. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +35 -0
  210. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +22 -0
  211. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +17 -0
  212. package/shortcutContexts/commands/extendCellsSelection/toRows.js +19 -0
  213. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +14 -0
  214. package/shortcutContexts/commands/extendCellsSelection/up.js +15 -0
  215. package/shortcutContexts/commands/extendCellsSelection/up.mjs +10 -0
  216. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +21 -0
  217. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +16 -0
  218. package/shortcutContexts/commands/index.js +52 -0
  219. package/shortcutContexts/commands/index.mjs +48 -0
  220. package/shortcutContexts/commands/moveCellSelection/down.js +12 -0
  221. package/shortcutContexts/commands/moveCellSelection/down.mjs +7 -0
  222. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +29 -0
  223. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +24 -0
  224. package/shortcutContexts/commands/moveCellSelection/index.js +28 -0
  225. package/shortcutContexts/commands/moveCellSelection/index.mjs +24 -0
  226. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +13 -0
  227. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -0
  228. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +13 -0
  229. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -0
  230. package/shortcutContexts/commands/moveCellSelection/left.js +11 -0
  231. package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -0
  232. package/shortcutContexts/commands/moveCellSelection/right.js +11 -0
  233. package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -0
  234. package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +16 -0
  235. package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +11 -0
  236. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +17 -0
  237. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +12 -0
  238. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +13 -0
  239. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +8 -0
  240. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +16 -0
  241. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +11 -0
  242. package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +36 -0
  243. package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +31 -0
  244. package/shortcutContexts/commands/moveCellSelection/toMostRight.js +36 -0
  245. package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +31 -0
  246. package/shortcutContexts/commands/moveCellSelection/toMostTop.js +16 -0
  247. package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +11 -0
  248. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +18 -0
  249. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +13 -0
  250. package/shortcutContexts/commands/moveCellSelection/up.js +12 -0
  251. package/shortcutContexts/commands/moveCellSelection/up.mjs +7 -0
  252. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +29 -0
  253. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +24 -0
  254. package/shortcutContexts/commands/populateSelectedCellsData.js +35 -0
  255. package/shortcutContexts/commands/populateSelectedCellsData.mjs +30 -0
  256. package/shortcutContexts/commands/selectAll.js +11 -0
  257. package/shortcutContexts/commands/selectAll.mjs +6 -0
  258. package/shortcutContexts/constants.js +19 -0
  259. package/shortcutContexts/constants.mjs +12 -0
  260. package/shortcutContexts/editor.js +29 -0
  261. package/shortcutContexts/editor.mjs +25 -0
  262. package/shortcutContexts/grid.js +247 -0
  263. package/shortcutContexts/grid.mjs +243 -0
  264. package/shortcutContexts/index.js +29 -0
  265. package/shortcutContexts/index.mjs +15 -0
  266. package/shortcuts/manager.js +2 -0
  267. package/shortcuts/manager.mjs +2 -0
  268. package/shortcuts/recorder.js +2 -2
  269. package/shortcuts/recorder.mjs +2 -2
  270. package/shortcuts/utils.js +21 -5
  271. package/shortcuts/utils.mjs +20 -4
  272. package/tableView.js +58 -9
  273. package/tableView.mjs +58 -9
  274. package/translations/indexMapper.js +8 -9
  275. package/translations/indexMapper.mjs +8 -9
  276. package/3rdparty/walkontable/src/selection.js +0 -355
  277. package/3rdparty/walkontable/src/selection.mjs +0 -349
  278. package/selection/highlight/constants.js +0 -16
  279. package/selection/highlight/constants.mjs +0 -6
@@ -19,7 +19,7 @@ require("core-js/modules/es.regexp.to-string.js");
19
19
  require("core-js/modules/es.function.name.js");
20
20
  require("core-js/modules/es.regexp.exec.js");
21
21
  exports.__esModule = true;
22
- exports.PLUGIN_PRIORITY = exports.PLUGIN_KEY = exports.ColumnSorting = void 0;
22
+ exports.REPLACE_COLUMN_CONFIG_STRATEGY = exports.PLUGIN_PRIORITY = exports.PLUGIN_KEY = exports.ColumnSorting = exports.APPEND_COLUMN_CONFIG_STRATEGY = void 0;
23
23
  require("core-js/modules/es.array.sort.js");
24
24
  require("core-js/modules/es.array.slice.js");
25
25
  require("core-js/modules/es.object.to-string.js");
@@ -79,7 +79,10 @@ exports.PLUGIN_KEY = PLUGIN_KEY;
79
79
  var PLUGIN_PRIORITY = 50;
80
80
  exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
81
81
  var APPEND_COLUMN_CONFIG_STRATEGY = 'append';
82
+ exports.APPEND_COLUMN_CONFIG_STRATEGY = APPEND_COLUMN_CONFIG_STRATEGY;
82
83
  var REPLACE_COLUMN_CONFIG_STRATEGY = 'replace';
84
+ exports.REPLACE_COLUMN_CONFIG_STRATEGY = REPLACE_COLUMN_CONFIG_STRATEGY;
85
+ var SHORTCUTS_GROUP = PLUGIN_KEY;
83
86
  (0, _sortService.registerRootComparator)(PLUGIN_KEY, _rootComparator.rootComparator);
84
87
  _pluginHooks.default.getSingleton().register('beforeColumnSort');
85
88
  _pluginHooks.default.getSingleton().register('afterColumnSort');
@@ -223,6 +226,7 @@ var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
223
226
  if (this.hot.view) {
224
227
  this.loadOrSortBySettings();
225
228
  }
229
+ this.registerShortcuts();
226
230
  _get(_getPrototypeOf(ColumnSorting.prototype), "enablePlugin", this).call(this);
227
231
  }
228
232
 
@@ -256,9 +260,47 @@ var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
256
260
  this.columnStatesManager.destroy();
257
261
  this.columnMetaCache = null;
258
262
  this.columnStatesManager = null;
263
+ this.unregisterShortcuts();
259
264
  _get(_getPrototypeOf(ColumnSorting.prototype), "disablePlugin", this).call(this);
260
265
  }
261
266
 
267
+ /**
268
+ * Register shortcuts responsible for toggling column sorting functionality.
269
+ *
270
+ * @private
271
+ */
272
+ }, {
273
+ key: "registerShortcuts",
274
+ value: function registerShortcuts() {
275
+ var _this4 = this;
276
+ this.hot.getShortcutManager().getContext('grid').addShortcut({
277
+ keys: [['Enter']],
278
+ callback: function callback() {
279
+ var _this4$hot$getSelecte = _this4.hot.getSelectedRangeLast(),
280
+ highlight = _this4$hot$getSelecte.highlight;
281
+ if (highlight.row === -1 && highlight.col >= 0) {
282
+ _this4.sort(_this4.getColumnNextConfig(highlight.col));
283
+ }
284
+ },
285
+ runOnlyIf: function runOnlyIf() {
286
+ var _this4$hot$getSelecte2;
287
+ return (_this4$hot$getSelecte2 = _this4.hot.getSelectedRangeLast()) === null || _this4$hot$getSelecte2 === void 0 ? void 0 : _this4$hot$getSelecte2.highlight.isHeader();
288
+ },
289
+ group: SHORTCUTS_GROUP
290
+ });
291
+ }
292
+
293
+ /**
294
+ * Unregister shortcuts responsible for toggling column sorting functionality.
295
+ *
296
+ * @private
297
+ */
298
+ }, {
299
+ key: "unregisterShortcuts",
300
+ value: function unregisterShortcuts() {
301
+ this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);
302
+ }
303
+
262
304
  // DIFF - MultiColumnSorting & ColumnSorting: changed function documentation.
263
305
  /**
264
306
  * Sorts the table by chosen columns and orders.
@@ -428,13 +470,13 @@ var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
428
470
  }, {
429
471
  key: "saveAllSortSettings",
430
472
  value: function saveAllSortSettings(sortConfigs) {
431
- var _this4 = this;
473
+ var _this5 = this;
432
474
  var allSortSettings = this.columnStatesManager.getAllColumnsProperties();
433
475
  var translateColumnToPhysical = function translateColumnToPhysical(_ref2) {
434
476
  var visualColumn = _ref2.column,
435
477
  restOfProperties = _objectWithoutProperties(_ref2, _excluded);
436
478
  return _objectSpread({
437
- column: _this4.hot.toPhysicalColumn(visualColumn)
479
+ column: _this5.hot.toPhysicalColumn(visualColumn)
438
480
  }, restOfProperties);
439
481
  };
440
482
  allSortSettings.initialConfig = (0, _array.arrayMap)(sortConfigs, translateColumnToPhysical);
@@ -452,7 +494,7 @@ var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
452
494
  }, {
453
495
  key: "getAllSavedSortSettings",
454
496
  value: function getAllSavedSortSettings() {
455
- var _this5 = this;
497
+ var _this6 = this;
456
498
  var storedAllSortSettings = {};
457
499
  this.hot.runHooks('persistentStateLoad', 'columnSorting', storedAllSortSettings);
458
500
  var allSortSettings = storedAllSortSettings.value;
@@ -460,7 +502,7 @@ var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
460
502
  var physicalColumn = _ref3.column,
461
503
  restOfProperties = _objectWithoutProperties(_ref3, _excluded2);
462
504
  return _objectSpread({
463
- column: _this5.hot.toVisualColumn(physicalColumn)
505
+ column: _this6.hot.toVisualColumn(physicalColumn)
464
506
  }, restOfProperties);
465
507
  };
466
508
  if ((0, _mixed.isDefined)(allSortSettings) && Array.isArray(allSortSettings.initialConfig)) {
@@ -625,7 +667,7 @@ var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
625
667
  }, {
626
668
  key: "sortByPresetSortStates",
627
669
  value: function sortByPresetSortStates(sortConfigs) {
628
- var _this6 = this;
670
+ var _this7 = this;
629
671
  if (sortConfigs.length === 0) {
630
672
  this.hot.rowIndexMapper.setIndexesSequence(this.indexesSequenceCache.getValues());
631
673
  return;
@@ -634,7 +676,7 @@ var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
634
676
  var numberOfRows = this.hot.countRows();
635
677
  var getDataForSortedColumns = function getDataForSortedColumns(visualRowIndex) {
636
678
  return (0, _array.arrayMap)(sortConfigs, function (sortConfig) {
637
- return _this6.hot.getDataAtCell(visualRowIndex, sortConfig.column);
679
+ return _this7.hot.getDataAtCell(visualRowIndex, sortConfig.column);
638
680
  });
639
681
  };
640
682
  for (var visualRowIndex = 0; visualRowIndex < this.getNumberOfRowsToSort(numberOfRows); visualRowIndex += 1) {
@@ -646,7 +688,7 @@ var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
646
688
  (0, _sortService.sort)(indexesWithData, this.pluginKey, (0, _array.arrayMap)(sortConfigs, function (sortConfig) {
647
689
  return sortConfig.sortOrder;
648
690
  }), (0, _array.arrayMap)(sortConfigs, function (sortConfig) {
649
- return _this6.getFirstCellSettings(sortConfig.column);
691
+ return _this7.getFirstCellSettings(sortConfig.column);
650
692
  }));
651
693
 
652
694
  // Append spareRows
@@ -71,8 +71,9 @@ import { rootComparator } from "./rootComparator.mjs";
71
71
  import { registerRootComparator, sort } from "./sortService/index.mjs";
72
72
  export var PLUGIN_KEY = 'columnSorting';
73
73
  export var PLUGIN_PRIORITY = 50;
74
- var APPEND_COLUMN_CONFIG_STRATEGY = 'append';
75
- var REPLACE_COLUMN_CONFIG_STRATEGY = 'replace';
74
+ export var APPEND_COLUMN_CONFIG_STRATEGY = 'append';
75
+ export var REPLACE_COLUMN_CONFIG_STRATEGY = 'replace';
76
+ var SHORTCUTS_GROUP = PLUGIN_KEY;
76
77
  registerRootComparator(PLUGIN_KEY, rootComparator);
77
78
  Hooks.getSingleton().register('beforeColumnSort');
78
79
  Hooks.getSingleton().register('afterColumnSort');
@@ -216,6 +217,7 @@ export var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
216
217
  if (this.hot.view) {
217
218
  this.loadOrSortBySettings();
218
219
  }
220
+ this.registerShortcuts();
219
221
  _get(_getPrototypeOf(ColumnSorting.prototype), "enablePlugin", this).call(this);
220
222
  }
221
223
 
@@ -249,9 +251,47 @@ export var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
249
251
  this.columnStatesManager.destroy();
250
252
  this.columnMetaCache = null;
251
253
  this.columnStatesManager = null;
254
+ this.unregisterShortcuts();
252
255
  _get(_getPrototypeOf(ColumnSorting.prototype), "disablePlugin", this).call(this);
253
256
  }
254
257
 
258
+ /**
259
+ * Register shortcuts responsible for toggling column sorting functionality.
260
+ *
261
+ * @private
262
+ */
263
+ }, {
264
+ key: "registerShortcuts",
265
+ value: function registerShortcuts() {
266
+ var _this4 = this;
267
+ this.hot.getShortcutManager().getContext('grid').addShortcut({
268
+ keys: [['Enter']],
269
+ callback: function callback() {
270
+ var _this4$hot$getSelecte = _this4.hot.getSelectedRangeLast(),
271
+ highlight = _this4$hot$getSelecte.highlight;
272
+ if (highlight.row === -1 && highlight.col >= 0) {
273
+ _this4.sort(_this4.getColumnNextConfig(highlight.col));
274
+ }
275
+ },
276
+ runOnlyIf: function runOnlyIf() {
277
+ var _this4$hot$getSelecte2;
278
+ return (_this4$hot$getSelecte2 = _this4.hot.getSelectedRangeLast()) === null || _this4$hot$getSelecte2 === void 0 ? void 0 : _this4$hot$getSelecte2.highlight.isHeader();
279
+ },
280
+ group: SHORTCUTS_GROUP
281
+ });
282
+ }
283
+
284
+ /**
285
+ * Unregister shortcuts responsible for toggling column sorting functionality.
286
+ *
287
+ * @private
288
+ */
289
+ }, {
290
+ key: "unregisterShortcuts",
291
+ value: function unregisterShortcuts() {
292
+ this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);
293
+ }
294
+
255
295
  // DIFF - MultiColumnSorting & ColumnSorting: changed function documentation.
256
296
  /**
257
297
  * Sorts the table by chosen columns and orders.
@@ -421,13 +461,13 @@ export var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
421
461
  }, {
422
462
  key: "saveAllSortSettings",
423
463
  value: function saveAllSortSettings(sortConfigs) {
424
- var _this4 = this;
464
+ var _this5 = this;
425
465
  var allSortSettings = this.columnStatesManager.getAllColumnsProperties();
426
466
  var translateColumnToPhysical = function translateColumnToPhysical(_ref2) {
427
467
  var visualColumn = _ref2.column,
428
468
  restOfProperties = _objectWithoutProperties(_ref2, _excluded);
429
469
  return _objectSpread({
430
- column: _this4.hot.toPhysicalColumn(visualColumn)
470
+ column: _this5.hot.toPhysicalColumn(visualColumn)
431
471
  }, restOfProperties);
432
472
  };
433
473
  allSortSettings.initialConfig = arrayMap(sortConfigs, translateColumnToPhysical);
@@ -445,7 +485,7 @@ export var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
445
485
  }, {
446
486
  key: "getAllSavedSortSettings",
447
487
  value: function getAllSavedSortSettings() {
448
- var _this5 = this;
488
+ var _this6 = this;
449
489
  var storedAllSortSettings = {};
450
490
  this.hot.runHooks('persistentStateLoad', 'columnSorting', storedAllSortSettings);
451
491
  var allSortSettings = storedAllSortSettings.value;
@@ -453,7 +493,7 @@ export var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
453
493
  var physicalColumn = _ref3.column,
454
494
  restOfProperties = _objectWithoutProperties(_ref3, _excluded2);
455
495
  return _objectSpread({
456
- column: _this5.hot.toVisualColumn(physicalColumn)
496
+ column: _this6.hot.toVisualColumn(physicalColumn)
457
497
  }, restOfProperties);
458
498
  };
459
499
  if (isDefined(allSortSettings) && Array.isArray(allSortSettings.initialConfig)) {
@@ -618,7 +658,7 @@ export var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
618
658
  }, {
619
659
  key: "sortByPresetSortStates",
620
660
  value: function sortByPresetSortStates(sortConfigs) {
621
- var _this6 = this;
661
+ var _this7 = this;
622
662
  if (sortConfigs.length === 0) {
623
663
  this.hot.rowIndexMapper.setIndexesSequence(this.indexesSequenceCache.getValues());
624
664
  return;
@@ -627,7 +667,7 @@ export var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
627
667
  var numberOfRows = this.hot.countRows();
628
668
  var getDataForSortedColumns = function getDataForSortedColumns(visualRowIndex) {
629
669
  return arrayMap(sortConfigs, function (sortConfig) {
630
- return _this6.hot.getDataAtCell(visualRowIndex, sortConfig.column);
670
+ return _this7.hot.getDataAtCell(visualRowIndex, sortConfig.column);
631
671
  });
632
672
  };
633
673
  for (var visualRowIndex = 0; visualRowIndex < this.getNumberOfRowsToSort(numberOfRows); visualRowIndex += 1) {
@@ -639,7 +679,7 @@ export var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
639
679
  sort(indexesWithData, this.pluginKey, arrayMap(sortConfigs, function (sortConfig) {
640
680
  return sortConfig.sortOrder;
641
681
  }), arrayMap(sortConfigs, function (sortConfig) {
642
- return _this6.getFirstCellSettings(sortConfig.column);
682
+ return _this7.getFirstCellSettings(sortConfig.column);
643
683
  }));
644
684
 
645
685
  // Append spareRows
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.PLUGIN_PRIORITY = exports.PLUGIN_KEY = exports.ColumnSorting = void 0;
4
+ exports.REPLACE_COLUMN_CONFIG_STRATEGY = exports.PLUGIN_PRIORITY = exports.PLUGIN_KEY = exports.ColumnSorting = exports.APPEND_COLUMN_CONFIG_STRATEGY = void 0;
5
5
  var _columnSorting = require("./columnSorting");
6
6
  exports.PLUGIN_KEY = _columnSorting.PLUGIN_KEY;
7
7
  exports.PLUGIN_PRIORITY = _columnSorting.PLUGIN_PRIORITY;
8
- exports.ColumnSorting = _columnSorting.ColumnSorting;
8
+ exports.ColumnSorting = _columnSorting.ColumnSorting;
9
+ exports.APPEND_COLUMN_CONFIG_STRATEGY = _columnSorting.APPEND_COLUMN_CONFIG_STRATEGY;
10
+ exports.REPLACE_COLUMN_CONFIG_STRATEGY = _columnSorting.REPLACE_COLUMN_CONFIG_STRATEGY;
@@ -1 +1 @@
1
- export { PLUGIN_KEY, PLUGIN_PRIORITY, ColumnSorting } from "./columnSorting.mjs";
1
+ export { PLUGIN_KEY, PLUGIN_PRIORITY, ColumnSorting, APPEND_COLUMN_CONFIG_STRATEGY, REPLACE_COLUMN_CONFIG_STRATEGY } from "./columnSorting.mjs";
@@ -835,7 +835,14 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
835
835
  key: "addToContextMenu",
836
836
  value: function addToContextMenu(defaultOptions) {
837
837
  var _this6 = this;
838
- var isThereAnyCellRendered = function isThereAnyCellRendered() {
838
+ var isThereAnySelectedCellToProcess = function isThereAnySelectedCellToProcess() {
839
+ var range = _this6.hot.getSelectedRangeLast();
840
+ if (!range) {
841
+ return false;
842
+ }
843
+ if (range.isSingleHeader() || range.highlight.isHeader()) {
844
+ return false;
845
+ }
839
846
  return _this6.hot.rowIndexMapper.getRenderableIndexesLength() > 0 && _this6.hot.columnIndexMapper.getRenderableIndexesLength() > 0;
840
847
  };
841
848
  defaultOptions.items.push({
@@ -852,7 +859,7 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
852
859
  return _this6.onContextMenuAddComment();
853
860
  },
854
861
  disabled: function disabled() {
855
- if (!isThereAnyCellRendered()) {
862
+ if (!isThereAnySelectedCellToProcess()) {
856
863
  return true;
857
864
  }
858
865
  return !(_this6.hot.getSelectedLast() && !_this6.hot.selection.isSelectedByCorner());
@@ -866,7 +873,7 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
866
873
  return _this6.onContextMenuRemoveComment();
867
874
  },
868
875
  disabled: function disabled() {
869
- if (!isThereAnyCellRendered()) {
876
+ if (!isThereAnySelectedCellToProcess()) {
870
877
  return true;
871
878
  }
872
879
  return !(_this6.hot.getSelectedLast() && !_this6.hot.selection.isSelectedByCorner());
@@ -894,7 +901,7 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
894
901
  return _this6.onContextMenuMakeReadOnly();
895
902
  },
896
903
  disabled: function disabled() {
897
- if (!isThereAnyCellRendered()) {
904
+ if (!isThereAnySelectedCellToProcess()) {
898
905
  return true;
899
906
  }
900
907
  return !(_this6.hot.getSelectedLast() && !_this6.hot.selection.isSelectedByCorner()) || !_this6.checkSelectionCommentsConsistency();
@@ -826,7 +826,14 @@ export var Comments = /*#__PURE__*/function (_BasePlugin) {
826
826
  key: "addToContextMenu",
827
827
  value: function addToContextMenu(defaultOptions) {
828
828
  var _this6 = this;
829
- var isThereAnyCellRendered = function isThereAnyCellRendered() {
829
+ var isThereAnySelectedCellToProcess = function isThereAnySelectedCellToProcess() {
830
+ var range = _this6.hot.getSelectedRangeLast();
831
+ if (!range) {
832
+ return false;
833
+ }
834
+ if (range.isSingleHeader() || range.highlight.isHeader()) {
835
+ return false;
836
+ }
830
837
  return _this6.hot.rowIndexMapper.getRenderableIndexesLength() > 0 && _this6.hot.columnIndexMapper.getRenderableIndexesLength() > 0;
831
838
  };
832
839
  defaultOptions.items.push({
@@ -843,7 +850,7 @@ export var Comments = /*#__PURE__*/function (_BasePlugin) {
843
850
  return _this6.onContextMenuAddComment();
844
851
  },
845
852
  disabled: function disabled() {
846
- if (!isThereAnyCellRendered()) {
853
+ if (!isThereAnySelectedCellToProcess()) {
847
854
  return true;
848
855
  }
849
856
  return !(_this6.hot.getSelectedLast() && !_this6.hot.selection.isSelectedByCorner());
@@ -857,7 +864,7 @@ export var Comments = /*#__PURE__*/function (_BasePlugin) {
857
864
  return _this6.onContextMenuRemoveComment();
858
865
  },
859
866
  disabled: function disabled() {
860
- if (!isThereAnyCellRendered()) {
867
+ if (!isThereAnySelectedCellToProcess()) {
861
868
  return true;
862
869
  }
863
870
  return !(_this6.hot.getSelectedLast() && !_this6.hot.selection.isSelectedByCorner());
@@ -885,7 +892,7 @@ export var Comments = /*#__PURE__*/function (_BasePlugin) {
885
892
  return _this6.onContextMenuMakeReadOnly();
886
893
  },
887
894
  disabled: function disabled() {
888
- if (!isThereAnyCellRendered()) {
895
+ if (!isThereAnySelectedCellToProcess()) {
889
896
  return true;
890
897
  }
891
898
  return !(_this6.hot.getSelectedLast() && !_this6.hot.selection.isSelectedByCorner()) || !_this6.checkSelectionCommentsConsistency();
@@ -60,7 +60,7 @@ export class ContextMenu extends BasePlugin {
60
60
 
61
61
  constructor(hotInstance: Core);
62
62
  isEnabled(): boolean;
63
- open(event: Event): void;
63
+ open(position: { left: number, top: number } | Event, offset?: { above?: number, below?: number, left?: number, right?: number }): void;
64
64
  close(): void;
65
65
  executeCommand(commandName: string, ...params: any): void;
66
66
  }
@@ -22,10 +22,12 @@ require("core-js/modules/es.object.get-prototype-of.js");
22
22
  var _base = require("../base");
23
23
  var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
24
24
  var _array = require("../../helpers/array");
25
+ var _object = require("../../helpers/object");
25
26
  var _commandExecutor = _interopRequireDefault(require("./commandExecutor"));
26
27
  var _eventManager = _interopRequireDefault(require("../../eventManager"));
27
28
  var _itemsFactory = _interopRequireDefault(require("./itemsFactory"));
28
29
  var _menu = _interopRequireDefault(require("./menu"));
30
+ var _utils = require("./utils");
29
31
  var _element = require("../../helpers/dom/element");
30
32
  var _predefinedItems = require("./predefinedItems");
31
33
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -47,6 +49,7 @@ var PLUGIN_KEY = 'contextMenu';
47
49
  exports.PLUGIN_KEY = PLUGIN_KEY;
48
50
  var PLUGIN_PRIORITY = 70;
49
51
  exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
52
+ var SHORTCUTS_GROUP = PLUGIN_KEY;
50
53
  _pluginHooks.default.getSingleton().register('afterContextMenuDefaultOptions');
51
54
  _pluginHooks.default.getSingleton().register('beforeContextMenuShow');
52
55
  _pluginHooks.default.getSingleton().register('afterContextMenuShow');
@@ -168,6 +171,7 @@ var ContextMenu = /*#__PURE__*/function (_BasePlugin) {
168
171
  this.addHook('afterOnCellContextMenu', function (event) {
169
172
  return _this2.onAfterOnCellContextMenu(event);
170
173
  });
174
+ this.registerShortcuts();
171
175
  _get(_getPrototypeOf(ContextMenu.prototype), "enablePlugin", this).call(this);
172
176
  }
173
177
 
@@ -182,6 +186,7 @@ var ContextMenu = /*#__PURE__*/function (_BasePlugin) {
182
186
  value: function updatePlugin() {
183
187
  this.disablePlugin();
184
188
  this.enablePlugin();
189
+ this.unregisterShortcuts();
185
190
  _get(_getPrototypeOf(ContextMenu.prototype), "updatePlugin", this).call(this);
186
191
  }
187
192
 
@@ -199,39 +204,83 @@ var ContextMenu = /*#__PURE__*/function (_BasePlugin) {
199
204
  _get(_getPrototypeOf(ContextMenu.prototype), "disablePlugin", this).call(this);
200
205
  }
201
206
 
207
+ /**
208
+ * Register shortcuts responsible for toggling context menu.
209
+ *
210
+ * @private
211
+ */
212
+ }, {
213
+ key: "registerShortcuts",
214
+ value: function registerShortcuts() {
215
+ var _this3 = this;
216
+ this.hot.getShortcutManager().getContext('grid').addShortcut({
217
+ keys: [['Control/Meta', 'Shift', '\\'], ['Shift', 'F10']],
218
+ callback: function callback() {
219
+ var _this3$hot$getSelecte = _this3.hot.getSelectedRangeLast(),
220
+ highlight = _this3$hot$getSelecte.highlight;
221
+ var rect = _this3.hot.getCell(highlight.row, highlight.col, true).getBoundingClientRect();
222
+ var offset = (0, _utils.getDocumentOffsetByElement)(_this3.menu.container, _this3.hot.rootDocument);
223
+ _this3.open({
224
+ left: rect.left + offset.left,
225
+ top: rect.top + offset.top - 1 + rect.height
226
+ }, {
227
+ left: rect.width,
228
+ above: -rect.height
229
+ });
230
+ _this3.hot._registerTimeout(function () {
231
+ _this3.menu.selectFirstCell();
232
+ });
233
+ },
234
+ runOnlyIf: function runOnlyIf() {
235
+ return _this3.hot.getSelectedRangeLast() && !_this3.menu.isOpened();
236
+ },
237
+ group: SHORTCUTS_GROUP
238
+ });
239
+ }
240
+
241
+ /**
242
+ * Unregister shortcuts responsible for toggling context menu.
243
+ *
244
+ * @private
245
+ */
246
+ }, {
247
+ key: "unregisterShortcuts",
248
+ value: function unregisterShortcuts() {
249
+ this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);
250
+ }
251
+
202
252
  /**
203
253
  * Opens menu and re-position it based on the passed coordinates.
204
254
  *
205
- * @param {Event} event The mouse event object.
255
+ * @param {{ top: number, left: number }|Event} position An object with `top` and `left` properties
256
+ * which contains coordinates relative to the browsers viewport (without included scroll offsets).
257
+ * Or if the native event is passed the menu will be positioned based on the `pageX` and `pageY`
258
+ * coordinates.
259
+ * @param {{ above: number, below: number, left: number, right: number }} offset An object allows applying
260
+ * the offset to the menu position.
261
+ * @fires Hooks#beforeContextMenuShow
262
+ * @fires Hooks#afterContextMenuShow
206
263
  */
207
264
  }, {
208
265
  key: "open",
209
- value: function open(event) {
210
- if (!this.menu) {
266
+ value: function open(position) {
267
+ var _this$menu,
268
+ _this4 = this;
269
+ var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
270
+ above: 0,
271
+ below: 0,
272
+ left: 0,
273
+ right: 0
274
+ };
275
+ if ((_this$menu = this.menu) !== null && _this$menu !== void 0 && _this$menu.isOpened()) {
211
276
  return;
212
277
  }
213
278
  this.prepareMenuItems();
214
279
  this.menu.open();
215
- if (!this.menu.isOpened()) {
216
- return;
217
- }
218
- var offsetTop = 0;
219
- var offsetLeft = 0;
220
- if (this.hot.rootDocument !== this.menu.container.ownerDocument) {
221
- var frameElement = this.hot.rootWindow.frameElement;
222
- var _frameElement$getBoun = frameElement.getBoundingClientRect(),
223
- top = _frameElement$getBoun.top,
224
- left = _frameElement$getBoun.left;
225
- offsetTop = top - (0, _element.getWindowScrollTop)(event.view);
226
- offsetLeft = left - (0, _element.getWindowScrollLeft)(event.view);
227
- } else {
228
- offsetTop = -1 * (0, _element.getWindowScrollTop)(this.menu.hotMenu.rootWindow);
229
- offsetLeft = -1 * (0, _element.getWindowScrollLeft)(this.menu.hotMenu.rootWindow);
230
- }
231
- this.menu.setPosition({
232
- top: parseInt(event.pageY, 10) + offsetTop,
233
- left: parseInt(event.pageX, 10) + offsetLeft
280
+ (0, _object.objectEach)(offset, function (value, key) {
281
+ _this4.menu.setOffset(key, value);
234
282
  });
283
+ this.menu.setPosition(position);
235
284
  }
236
285
 
237
286
  /**
@@ -240,10 +289,8 @@ var ContextMenu = /*#__PURE__*/function (_BasePlugin) {
240
289
  }, {
241
290
  key: "close",
242
291
  value: function close() {
243
- if (!this.menu) {
244
- return;
245
- }
246
- this.menu.close();
292
+ var _this$menu2;
293
+ (_this$menu2 = this.menu) === null || _this$menu2 === void 0 ? void 0 : _this$menu2.close();
247
294
  this.itemsFactory = null;
248
295
  }
249
296
 
@@ -300,7 +347,7 @@ var ContextMenu = /*#__PURE__*/function (_BasePlugin) {
300
347
  }, {
301
348
  key: "prepareMenuItems",
302
349
  value: function prepareMenuItems() {
303
- var _this3 = this;
350
+ var _this5 = this;
304
351
  this.itemsFactory = new _itemsFactory.default(this.hot, ContextMenu.DEFAULT_ITEMS);
305
352
  var settings = this.hot.getSettings()[PLUGIN_KEY];
306
353
  var predefinedItems = {
@@ -314,7 +361,7 @@ var ContextMenu = /*#__PURE__*/function (_BasePlugin) {
314
361
 
315
362
  // Register all commands. Predefined and added by user or by plugins
316
363
  (0, _array.arrayEach)(menuItems, function (command) {
317
- return _this3.commandExecutor.registerCommand(command.key, command);
364
+ return _this5.commandExecutor.registerCommand(command.key, command);
318
365
  });
319
366
  }
320
367
 
@@ -351,7 +398,11 @@ var ContextMenu = /*#__PURE__*/function (_BasePlugin) {
351
398
  return;
352
399
  }
353
400
  }
354
- this.open(event);
401
+ var offset = (0, _utils.getDocumentOffsetByElement)(this.menu.container, this.hot.rootDocument);
402
+ this.open({
403
+ top: event.clientY + offset.top,
404
+ left: event.clientX + offset.left
405
+ });
355
406
  }
356
407
 
357
408
  /**