handsontable 0.0.0-next-59715d3-20230523 → 0.0.0-next-93e34dc-20230601

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 (216) 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 +328 -0
  34. package/3rdparty/walkontable/src/selection/manager.mjs +322 -0
  35. package/3rdparty/walkontable/src/selection/scanner.js +363 -0
  36. package/3rdparty/walkontable/src/selection/scanner.mjs +359 -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 +82 -300
  55. package/core.mjs +82 -300
  56. package/dataMap/metaManager/metaSchema.js +15 -0
  57. package/dataMap/metaManager/metaSchema.mjs +15 -0
  58. package/dist/handsontable.css +8 -3
  59. package/dist/handsontable.full.css +8 -3
  60. package/dist/handsontable.full.js +12245 -9953
  61. package/dist/handsontable.full.min.css +3 -3
  62. package/dist/handsontable.full.min.js +120 -120
  63. package/dist/handsontable.js +15898 -13606
  64. package/dist/handsontable.min.css +3 -3
  65. package/dist/handsontable.min.js +4 -4
  66. package/editorManager.js +20 -82
  67. package/editorManager.mjs +25 -86
  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.js +1 -1
  77. package/pluginHooks.mjs +1 -1
  78. package/plugins/copyPaste/copyPaste.js +5 -1
  79. package/plugins/copyPaste/copyPaste.mjs +5 -1
  80. package/plugins/customBorders/customBorders.js +18 -52
  81. package/plugins/customBorders/customBorders.mjs +19 -53
  82. package/plugins/mergeCells/mergeCells.js +5 -18
  83. package/plugins/mergeCells/mergeCells.mjs +5 -18
  84. package/plugins/nestedHeaders/nestedHeaders.js +89 -9
  85. package/plugins/nestedHeaders/nestedHeaders.mjs +89 -9
  86. package/plugins/nestedHeaders/stateManager/index.js +37 -0
  87. package/plugins/nestedHeaders/stateManager/index.mjs +37 -0
  88. package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
  89. package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
  90. package/selection/highlight/highlight.js +311 -88
  91. package/selection/highlight/highlight.mjs +301 -84
  92. package/selection/highlight/types/activeHeader.js +10 -9
  93. package/selection/highlight/types/activeHeader.mjs +10 -8
  94. package/selection/highlight/types/area.js +12 -27
  95. package/selection/highlight/types/area.mjs +16 -30
  96. package/selection/highlight/types/areaLayered.js +54 -0
  97. package/selection/highlight/types/areaLayered.mjs +49 -0
  98. package/selection/highlight/types/column.js +50 -0
  99. package/selection/highlight/types/column.mjs +45 -0
  100. package/selection/highlight/types/customSelection.js +7 -10
  101. package/selection/highlight/types/customSelection.mjs +7 -9
  102. package/selection/highlight/types/fill.js +5 -8
  103. package/selection/highlight/types/fill.mjs +5 -7
  104. package/selection/highlight/types/{cell.js → focus.js} +5 -8
  105. package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
  106. package/selection/highlight/types/header.js +10 -20
  107. package/selection/highlight/types/header.mjs +10 -19
  108. package/selection/highlight/types/{index.js → row.js} +27 -31
  109. package/selection/highlight/types/{index.mjs → row.mjs} +24 -29
  110. package/selection/highlight/visualSelection.js +23 -28
  111. package/selection/highlight/visualSelection.mjs +23 -28
  112. package/selection/index.js +4 -7
  113. package/selection/index.mjs +2 -3
  114. package/selection/mouseEventHandler.js +1 -1
  115. package/selection/mouseEventHandler.mjs +1 -1
  116. package/selection/range.js +8 -8
  117. package/selection/range.mjs +8 -8
  118. package/selection/selection.js +296 -180
  119. package/selection/selection.mjs +291 -179
  120. package/selection/transformation.js +233 -96
  121. package/selection/transformation.mjs +230 -93
  122. package/selection/utils.js +12 -35
  123. package/selection/utils.mjs +13 -35
  124. package/settings.d.ts +1 -0
  125. package/shortcutContexts/commands/editor/closeAndSave.js +15 -0
  126. package/shortcutContexts/commands/editor/closeAndSave.mjs +10 -0
  127. package/shortcutContexts/commands/editor/closeWithoutSaving.js +13 -0
  128. package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +8 -0
  129. package/shortcutContexts/commands/editor/fastOpen.js +16 -0
  130. package/shortcutContexts/commands/editor/fastOpen.mjs +11 -0
  131. package/shortcutContexts/commands/editor/index.js +16 -0
  132. package/shortcutContexts/commands/editor/index.mjs +12 -0
  133. package/shortcutContexts/commands/editor/open.js +29 -0
  134. package/shortcutContexts/commands/editor/open.mjs +24 -0
  135. package/shortcutContexts/commands/emptySelectedCells.js +12 -0
  136. package/shortcutContexts/commands/emptySelectedCells.mjs +7 -0
  137. package/shortcutContexts/commands/extendCellsSelection/down.js +15 -0
  138. package/shortcutContexts/commands/extendCellsSelection/down.mjs +10 -0
  139. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +21 -0
  140. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +16 -0
  141. package/shortcutContexts/commands/extendCellsSelection/index.js +24 -0
  142. package/shortcutContexts/commands/extendCellsSelection/index.mjs +20 -0
  143. package/shortcutContexts/commands/extendCellsSelection/left.js +15 -0
  144. package/shortcutContexts/commands/extendCellsSelection/left.mjs +10 -0
  145. package/shortcutContexts/commands/extendCellsSelection/right.js +15 -0
  146. package/shortcutContexts/commands/extendCellsSelection/right.mjs +10 -0
  147. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +22 -0
  148. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +17 -0
  149. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +17 -0
  150. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +12 -0
  151. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +17 -0
  152. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +12 -0
  153. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +39 -0
  154. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +34 -0
  155. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +39 -0
  156. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +34 -0
  157. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +22 -0
  158. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +17 -0
  159. package/shortcutContexts/commands/extendCellsSelection/up.js +15 -0
  160. package/shortcutContexts/commands/extendCellsSelection/up.mjs +10 -0
  161. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +21 -0
  162. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +16 -0
  163. package/shortcutContexts/commands/index.js +51 -0
  164. package/shortcutContexts/commands/index.mjs +47 -0
  165. package/shortcutContexts/commands/moveCellSelection/down.js +12 -0
  166. package/shortcutContexts/commands/moveCellSelection/down.mjs +7 -0
  167. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +11 -0
  168. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +6 -0
  169. package/shortcutContexts/commands/moveCellSelection/index.js +28 -0
  170. package/shortcutContexts/commands/moveCellSelection/index.mjs +24 -0
  171. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +13 -0
  172. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -0
  173. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +13 -0
  174. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -0
  175. package/shortcutContexts/commands/moveCellSelection/left.js +11 -0
  176. package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -0
  177. package/shortcutContexts/commands/moveCellSelection/right.js +11 -0
  178. package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -0
  179. package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +16 -0
  180. package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +11 -0
  181. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +17 -0
  182. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +12 -0
  183. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +13 -0
  184. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +8 -0
  185. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +16 -0
  186. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +11 -0
  187. package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +35 -0
  188. package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +30 -0
  189. package/shortcutContexts/commands/moveCellSelection/toMostRight.js +35 -0
  190. package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +30 -0
  191. package/shortcutContexts/commands/moveCellSelection/toMostTop.js +16 -0
  192. package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +11 -0
  193. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +18 -0
  194. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +13 -0
  195. package/shortcutContexts/commands/moveCellSelection/up.js +12 -0
  196. package/shortcutContexts/commands/moveCellSelection/up.mjs +7 -0
  197. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +11 -0
  198. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +6 -0
  199. package/shortcutContexts/commands/populateSelectedCellsData.js +35 -0
  200. package/shortcutContexts/commands/populateSelectedCellsData.mjs +30 -0
  201. package/shortcutContexts/commands/selectAll.js +11 -0
  202. package/shortcutContexts/commands/selectAll.mjs +6 -0
  203. package/shortcutContexts/constants.js +19 -0
  204. package/shortcutContexts/constants.mjs +12 -0
  205. package/shortcutContexts/editor.js +29 -0
  206. package/shortcutContexts/editor.mjs +25 -0
  207. package/shortcutContexts/grid.js +232 -0
  208. package/shortcutContexts/grid.mjs +228 -0
  209. package/shortcutContexts/index.js +29 -0
  210. package/shortcutContexts/index.mjs +15 -0
  211. package/tableView.js +58 -9
  212. package/tableView.mjs +58 -9
  213. package/3rdparty/walkontable/src/selection.js +0 -354
  214. package/3rdparty/walkontable/src/selection.mjs +0 -348
  215. package/selection/highlight/constants.js +0 -16
  216. package/selection/highlight/constants.mjs +0 -6
package/core.js CHANGED
@@ -29,7 +29,6 @@ require("core-js/modules/es.array.reverse.js");
29
29
  require("core-js/modules/web.dom-collections.for-each.js");
30
30
  require("core-js/modules/web.timers.js");
31
31
  require("core-js/modules/web.immediate.js");
32
- require("core-js/modules/es.map.js");
33
32
  var _element = require("./helpers/dom/element");
34
33
  var _function = require("./helpers/function");
35
34
  var _mixed = require("./helpers/mixed");
@@ -60,6 +59,7 @@ var _selection = require("./selection");
60
59
  var _dataMap = require("./dataMap");
61
60
  var _uniqueMap = require("./utils/dataStructures/uniqueMap");
62
61
  var _shortcuts = require("./shortcuts");
62
+ var _shortcutContexts = require("./shortcutContexts");
63
63
  var _templateObject, _templateObject2;
64
64
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
65
65
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
@@ -74,7 +74,6 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
74
74
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
75
75
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
76
76
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
77
- var SHORTCUTS_GROUP = 'gridDefault';
78
77
  var activeGuid = null;
79
78
  var deprecationWarns = new Set();
80
79
 
@@ -291,12 +290,8 @@ function Core(rootElement, userSettings) {
291
290
  };
292
291
 
293
292
  var selection = new _selection.Selection(tableMeta, {
294
- rowIndexMapper: function rowIndexMapper() {
295
- return instance.rowIndexMapper;
296
- },
297
- columnIndexMapper: function columnIndexMapper() {
298
- return instance.columnIndexMapper;
299
- },
293
+ rowIndexMapper: instance.rowIndexMapper,
294
+ columnIndexMapper: instance.columnIndexMapper,
300
295
  countCols: function countCols() {
301
296
  return instance.countCols();
302
297
  },
@@ -309,12 +304,18 @@ function Core(rootElement, userSettings) {
309
304
  isEditorOpened: function isEditorOpened() {
310
305
  return instance.getActiveEditor() ? instance.getActiveEditor().isOpened() : false;
311
306
  },
312
- countColsTranslated: function countColsTranslated() {
307
+ countRenderableColumns: function countRenderableColumns() {
313
308
  return _this.view.countRenderableColumns();
314
309
  },
315
- countRowsTranslated: function countRowsTranslated() {
310
+ countRenderableRows: function countRenderableRows() {
316
311
  return _this.view.countRenderableRows();
317
312
  },
313
+ countRowHeaders: function countRowHeaders() {
314
+ return _this.countRowHeaders();
315
+ },
316
+ countColHeaders: function countColHeaders() {
317
+ return _this.countColHeaders();
318
+ },
318
319
  getShortcutManager: function getShortcutManager() {
319
320
  return instance.getShortcutManager();
320
321
  },
@@ -347,12 +348,6 @@ function Core(rootElement, userSettings) {
347
348
  });
348
349
  this.selection.addLocalHook('beforeSetRangeEnd', function (cellCoords) {
349
350
  _this.runHooks('beforeSetRangeEnd', cellCoords);
350
- if (cellCoords.row < 0) {
351
- cellCoords.row = _this.view._wt.wtTable.getFirstVisibleRow();
352
- }
353
- if (cellCoords.col < 0) {
354
- cellCoords.col = _this.view._wt.wtTable.getFirstVisibleColumn();
355
- }
356
351
  });
357
352
  this.selection.addLocalHook('afterSetRangeEnd', function (cellCoords) {
358
353
  var preventScrolling = (0, _object.createObjectPropListener)(false);
@@ -378,7 +373,14 @@ function Core(rootElement, userSettings) {
378
373
  if (scrollToCell !== false) {
379
374
  if (!isSelectedByAnyHeader) {
380
375
  if (currentSelectedRange && !_this.selection.isMultiple()) {
381
- _this.view.scrollViewport(visualToRenderableCoords(currentSelectedRange.from));
376
+ var renderableCoords = visualToRenderableCoords(currentSelectedRange.from);
377
+ if (renderableCoords.row < 0 && renderableCoords.col >= 0) {
378
+ _this.view.scrollViewportHorizontally(renderableCoords.col);
379
+ } else if (renderableCoords.col < 0 && renderableCoords.row >= 0) {
380
+ _this.view.scrollViewportVertically(renderableCoords.row);
381
+ } else {
382
+ _this.view.scrollViewport(renderableCoords);
383
+ }
382
384
  } else {
383
385
  _this.view.scrollViewport(visualToRenderableCoords(cellCoords));
384
386
  }
@@ -3732,6 +3734,30 @@ function Core(rootElement, userSettings) {
3732
3734
  return instance.view._wt.drawn ? instance.view._wt.wtTable.getVisibleColumnsCount() : -1;
3733
3735
  };
3734
3736
 
3737
+ /**
3738
+ * Returns the number of rendered row headers.
3739
+ *
3740
+ * @since 13.0.0
3741
+ * @memberof Core#
3742
+ * @function countRowHeaders
3743
+ * @returns {number} Number of row headers.
3744
+ */
3745
+ this.countRowHeaders = function () {
3746
+ return this.view.getRowHeadersCount();
3747
+ };
3748
+
3749
+ /**
3750
+ * Returns the number of rendered column headers.
3751
+ *
3752
+ * @since 13.0.0
3753
+ * @memberof Core#
3754
+ * @function countColHeaders
3755
+ * @returns {number} Number of column headers.
3756
+ */
3757
+ this.countColHeaders = function () {
3758
+ return this.view.getColumnHeadersCount();
3759
+ };
3760
+
3735
3761
  /**
3736
3762
  * Returns the number of empty rows. If the optional ending parameter is `true`, returns the
3737
3763
  * number of empty rows at the bottom of the table.
@@ -3936,6 +3962,8 @@ function Core(rootElement, userSettings) {
3936
3962
  * hot.selectColumns('id');
3937
3963
  * // Select range of columns using visual indexes.
3938
3964
  * hot.selectColumns(1, 4);
3965
+ * // Select range of columns using visual indexes and mark the header as highlighted.
3966
+ * hot.selectColumns(1, 2, -1);
3939
3967
  * // Select range of columns using column properties.
3940
3968
  * hot.selectColumns('id', 'last_name');
3941
3969
  * ```
@@ -3946,11 +3974,15 @@ function Core(rootElement, userSettings) {
3946
3974
  * @param {number} startColumn The visual column index from which the selection starts.
3947
3975
  * @param {number} [endColumn=startColumn] The visual column index to which the selection finishes. If `endColumn`
3948
3976
  * is not defined the column defined by `startColumn` will be selected.
3977
+ * @param {number} [headerLevel=0] The header level allows changing the cell/header highlight position. The value can
3978
+ * take 0 to -N, where 0 means highlighting the cell nearest the column header, -1
3979
+ * means the highlighting header starting from the header closest to the cells.
3949
3980
  * @returns {boolean} `true` if selection was successful, `false` otherwise.
3950
3981
  */
3951
3982
  this.selectColumns = function (startColumn) {
3952
3983
  var endColumn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startColumn;
3953
- return selection.selectColumns(startColumn, endColumn);
3984
+ var headerLevel = arguments.length > 2 ? arguments[2] : undefined;
3985
+ return selection.selectColumns(startColumn, endColumn, headerLevel);
3954
3986
  };
3955
3987
 
3956
3988
  /**
@@ -3962,6 +3994,8 @@ function Core(rootElement, userSettings) {
3962
3994
  * hot.selectRows(1);
3963
3995
  * // Select range of rows using visual indexes.
3964
3996
  * hot.selectRows(1, 4);
3997
+ * // Select range of rows using visual indexes and mark the header as highlighted.
3998
+ * hot.selectRows(1, 2, -1);
3965
3999
  * ```
3966
4000
  *
3967
4001
  * @memberof Core#
@@ -3970,11 +4004,15 @@ function Core(rootElement, userSettings) {
3970
4004
  * @param {number} startRow The visual row index from which the selection starts.
3971
4005
  * @param {number} [endRow=startRow] The visual row index to which the selection finishes. If `endRow`
3972
4006
  * is not defined the row defined by `startRow` will be selected.
4007
+ * @param {number} [headerLevel=0] The header level allows changing the cell/header highlight position. The value can
4008
+ * take 0 to -N, where 0 means highlighting the cell nearest the row header, -1
4009
+ * means the highlighting header starting from the header closest to the cells.
3973
4010
  * @returns {boolean} `true` if selection was successful, `false` otherwise.
3974
4011
  */
3975
4012
  this.selectRows = function (startRow) {
3976
4013
  var endRow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startRow;
3977
- return selection.selectRows(startRow, endRow);
4014
+ var headerLevel = arguments.length > 2 ? arguments[2] : undefined;
4015
+ return selection.selectRows(startRow, endRow, headerLevel);
3978
4016
  };
3979
4017
 
3980
4018
  /**
@@ -3993,9 +4031,16 @@ function Core(rootElement, userSettings) {
3993
4031
  * The previous selection is overwritten.
3994
4032
  *
3995
4033
  * ```js
3996
- * // select all cells in the table, including all headers
4034
+ * // select all cells in the table, including all headers with corner
3997
4035
  * hot.selectAll();
3998
4036
  *
4037
+ * // select all cells in the table, including row headers without corner
4038
+ * hot.selectAll(true, false);
4039
+ *
4040
+ * // select all cells in the table, including all headers with corner but move the focus
4041
+ * // highlight to position -2,-1
4042
+ * hot.selectAll(-2, -1);
4043
+ *
3999
4044
  * // select all cells in the table, without headers
4000
4045
  * hot.selectAll(false);
4001
4046
  * ```
@@ -4003,15 +4048,15 @@ function Core(rootElement, userSettings) {
4003
4048
  * @since 0.38.2
4004
4049
  * @memberof Core#
4005
4050
  * @function selectAll
4006
- * @param {boolean} [includeHeaders=true] `true`: include all row, column and corner headers.
4051
+ * @param {boolean|number} [rowHeaderLevel=true] `true`: include all row headers.
4052
+ * @param {boolean|number} [columnHeaderLevel=true] `true`: include all column headers.
4007
4053
  * `false`: don't include any headers.
4008
4054
  */
4009
4055
  this.selectAll = function () {
4010
- var includeHeaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
4011
- var includeRowHeaders = includeHeaders && this.hasRowHeaders();
4012
- var includeColumnHeaders = includeHeaders && this.hasColHeaders();
4056
+ var rowHeaderLevel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
4057
+ var columnHeaderLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : rowHeaderLevel;
4013
4058
  preventScrollingToCell = true;
4014
- selection.selectAll(includeRowHeaders, includeColumnHeaders);
4059
+ selection.selectAll(rowHeaderLevel, columnHeaderLevel);
4015
4060
  preventScrollingToCell = false;
4016
4061
  };
4017
4062
  var getIndexToScroll = function getIndexToScroll(indexMapper, visualIndex) {
@@ -4415,6 +4460,16 @@ function Core(rootElement, userSettings) {
4415
4460
  }
4416
4461
  };
4417
4462
 
4463
+ /**
4464
+ * Gets the instance of the EditorManager.
4465
+ *
4466
+ * @private
4467
+ * @returns {EditorManager}
4468
+ */
4469
+ this._getEditorManager = function () {
4470
+ return editorManager;
4471
+ };
4472
+
4418
4473
  /**
4419
4474
  * Check if currently it is RTL direction.
4420
4475
  *
@@ -4487,284 +4542,11 @@ function Core(rootElement, userSettings) {
4487
4542
  this.getShortcutManager = function () {
4488
4543
  return shortcutManager;
4489
4544
  };
4490
- var gridContext = shortcutManager.addContext('grid');
4491
- var gridConfig = {
4492
- runOnlyIf: function runOnlyIf() {
4493
- return (0, _mixed.isDefined)(instance.getSelected()) && instance.countRenderedRows() > 0 && instance.countRenderedCols() > 0;
4494
- },
4495
- group: SHORTCUTS_GROUP
4496
- };
4497
- shortcutManager.setActiveContextName('grid');
4498
- gridContext.addShortcuts([{
4499
- keys: [['Control/Meta', 'A']],
4500
- callback: function callback() {
4501
- instance.selectAll();
4502
- }
4503
- }, {
4504
- keys: [['Control/Meta', 'Enter']],
4505
- callback: function callback() {
4506
- var selectedRange = instance.getSelectedRange();
4507
- var _selectedRange$highli = selectedRange[selectedRange.length - 1].highlight,
4508
- highlightRow = _selectedRange$highli.row,
4509
- highlightColumn = _selectedRange$highli.col;
4510
- var valueToPopulate = instance.getDataAtCell(highlightRow, highlightColumn);
4511
- var cellValues = new Map();
4512
- for (var i = 0; i < selectedRange.length; i++) {
4513
- selectedRange[i].forAll(function (row, column) {
4514
- if (row >= 0 && column >= 0 && (row !== highlightRow || column !== highlightColumn)) {
4515
- var _instance$getCellMeta = instance.getCellMeta(row, column),
4516
- readOnly = _instance$getCellMeta.readOnly;
4517
- if (!readOnly) {
4518
- cellValues.set("".concat(row, "x").concat(column), [row, column, valueToPopulate]);
4519
- }
4520
- }
4521
- });
4522
- }
4523
- instance.setDataAtCell(Array.from(cellValues.values()));
4524
- },
4525
- runOnlyIf: function runOnlyIf() {
4526
- return instance.getSelectedRangeLast().getCellsCount() > 1;
4527
- }
4528
- }, {
4529
- keys: [['ArrowUp']],
4530
- callback: function callback() {
4531
- selection.transformStart(-1, 0);
4532
- }
4533
- }, {
4534
- keys: [['ArrowUp', 'Control/Meta']],
4535
- captureCtrl: true,
4536
- callback: function callback() {
4537
- selection.setRangeStart(instance._createCellCoords(instance.rowIndexMapper.getNearestNotHiddenIndex(0, 1), instance.getSelectedRangeLast().highlight.col));
4538
- }
4539
- }, {
4540
- keys: [['ArrowUp', 'Shift']],
4541
- callback: function callback() {
4542
- selection.transformEnd(-1, 0);
4543
- }
4544
- }, {
4545
- keys: [['ArrowUp', 'Shift', 'Control/Meta']],
4546
- captureCtrl: true,
4547
- callback: function callback() {
4548
- var _instance$getSelected = instance.getSelectedRangeLast(),
4549
- from = _instance$getSelected.from,
4550
- to = _instance$getSelected.to;
4551
- var row = instance.rowIndexMapper.getNearestNotHiddenIndex(0, 1);
4552
- selection.setRangeStart(from.clone());
4553
- selection.setRangeEnd(instance._createCellCoords(row, to.col));
4554
- },
4555
- runOnlyIf: function runOnlyIf() {
4556
- return !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByColumnHeader());
4557
- }
4558
- }, {
4559
- keys: [['ArrowDown']],
4560
- callback: function callback() {
4561
- selection.transformStart(1, 0);
4562
- }
4563
- }, {
4564
- keys: [['ArrowDown', 'Control/Meta']],
4565
- captureCtrl: true,
4566
- callback: function callback() {
4567
- selection.setRangeStart(instance._createCellCoords(instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - 1, -1), instance.getSelectedRangeLast().highlight.col));
4568
- }
4569
- }, {
4570
- keys: [['ArrowDown', 'Shift']],
4571
- callback: function callback() {
4572
- selection.transformEnd(1, 0);
4573
- }
4574
- }, {
4575
- keys: [['ArrowDown', 'Shift', 'Control/Meta']],
4576
- captureCtrl: true,
4577
- callback: function callback() {
4578
- var _instance$getSelected2 = instance.getSelectedRangeLast(),
4579
- from = _instance$getSelected2.from,
4580
- to = _instance$getSelected2.to;
4581
- var row = instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - 1, -1);
4582
- selection.setRangeStart(from.clone());
4583
- selection.setRangeEnd(instance._createCellCoords(row, to.col));
4584
- },
4585
- runOnlyIf: function runOnlyIf() {
4586
- return !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByColumnHeader());
4587
- }
4588
- }, {
4589
- keys: [['ArrowLeft']],
4590
- callback: function callback() {
4591
- selection.transformStart(0, -1 * instance.getDirectionFactor());
4592
- }
4593
- }, {
4594
- keys: [['ArrowLeft', 'Control/Meta']],
4595
- captureCtrl: true,
4596
- callback: function callback() {
4597
- var _instance$columnIndex;
4598
- var row = instance.getSelectedRangeLast().highlight.row;
4599
- var column = (_instance$columnIndex = instance.columnIndexMapper).getNearestNotHiddenIndex.apply(_instance$columnIndex, _toConsumableArray(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
4600
- selection.setRangeStart(instance._createCellCoords(row, column));
4601
- }
4602
- }, {
4603
- keys: [['ArrowLeft', 'Shift']],
4604
- callback: function callback() {
4605
- selection.transformEnd(0, -1 * instance.getDirectionFactor());
4606
- }
4607
- }, {
4608
- keys: [['ArrowLeft', 'Shift', 'Control/Meta']],
4609
- captureCtrl: true,
4610
- callback: function callback() {
4611
- var _instance$columnIndex2;
4612
- var _instance$getSelected3 = instance.getSelectedRangeLast(),
4613
- from = _instance$getSelected3.from,
4614
- to = _instance$getSelected3.to;
4615
- var column = (_instance$columnIndex2 = instance.columnIndexMapper).getNearestNotHiddenIndex.apply(_instance$columnIndex2, _toConsumableArray(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
4616
- selection.setRangeStart(from.clone());
4617
- selection.setRangeEnd(instance._createCellCoords(to.row, column));
4618
- },
4619
- runOnlyIf: function runOnlyIf() {
4620
- return !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByRowHeader());
4621
- }
4622
- }, {
4623
- keys: [['ArrowRight']],
4624
- callback: function callback() {
4625
- selection.transformStart(0, instance.getDirectionFactor());
4626
- }
4627
- }, {
4628
- keys: [['ArrowRight', 'Control/Meta']],
4629
- captureCtrl: true,
4630
- callback: function callback() {
4631
- var _instance$columnIndex3;
4632
- var row = instance.getSelectedRangeLast().highlight.row;
4633
- var column = (_instance$columnIndex3 = instance.columnIndexMapper).getNearestNotHiddenIndex.apply(_instance$columnIndex3, _toConsumableArray(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
4634
- selection.setRangeStart(instance._createCellCoords(row, column));
4635
- }
4636
- }, {
4637
- keys: [['ArrowRight', 'Shift']],
4638
- callback: function callback() {
4639
- selection.transformEnd(0, instance.getDirectionFactor());
4640
- }
4641
- }, {
4642
- keys: [['ArrowRight', 'Shift', 'Control/Meta']],
4643
- captureCtrl: true,
4644
- callback: function callback() {
4645
- var _instance$columnIndex4;
4646
- var _instance$getSelected4 = instance.getSelectedRangeLast(),
4647
- from = _instance$getSelected4.from,
4648
- to = _instance$getSelected4.to;
4649
- var column = (_instance$columnIndex4 = instance.columnIndexMapper).getNearestNotHiddenIndex.apply(_instance$columnIndex4, _toConsumableArray(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
4650
- selection.setRangeStart(from.clone());
4651
- selection.setRangeEnd(instance._createCellCoords(to.row, column));
4652
- },
4653
- runOnlyIf: function runOnlyIf() {
4654
- return !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByRowHeader());
4655
- }
4656
- }, {
4657
- keys: [['Home']],
4658
- captureCtrl: true,
4659
- callback: function callback() {
4660
- var fixedColumns = parseInt(instance.getSettings().fixedColumnsStart, 10);
4661
- var row = instance.getSelectedRangeLast().highlight.row;
4662
- var column = instance.columnIndexMapper.getNearestNotHiddenIndex(fixedColumns, 1);
4663
- selection.setRangeStart(instance._createCellCoords(row, column));
4664
- },
4665
- runOnlyIf: function runOnlyIf() {
4666
- return instance.view.isMainTableNotFullyCoveredByOverlays();
4667
- }
4668
- }, {
4669
- keys: [['Home', 'Shift']],
4670
- callback: function callback() {
4671
- selection.setRangeEnd(instance._createCellCoords(selection.selectedRange.current().from.row, instance.columnIndexMapper.getNearestNotHiddenIndex(0, 1)));
4672
- }
4673
- }, {
4674
- keys: [['Home', 'Control/Meta']],
4675
- captureCtrl: true,
4676
- callback: function callback() {
4677
- var fixedRows = parseInt(instance.getSettings().fixedRowsTop, 10);
4678
- var fixedColumns = parseInt(instance.getSettings().fixedColumnsStart, 10);
4679
- var row = instance.rowIndexMapper.getNearestNotHiddenIndex(fixedRows, 1);
4680
- var column = instance.columnIndexMapper.getNearestNotHiddenIndex(fixedColumns, 1);
4681
- selection.setRangeStart(instance._createCellCoords(row, column));
4682
- },
4683
- runOnlyIf: function runOnlyIf() {
4684
- return instance.view.isMainTableNotFullyCoveredByOverlays();
4685
- }
4686
- }, {
4687
- keys: [['End']],
4688
- captureCtrl: true,
4689
- callback: function callback() {
4690
- selection.setRangeStart(instance._createCellCoords(instance.getSelectedRangeLast().highlight.row, instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1)));
4691
- },
4692
- runOnlyIf: function runOnlyIf() {
4693
- return instance.view.isMainTableNotFullyCoveredByOverlays();
4694
- }
4695
- }, {
4696
- keys: [['End', 'Shift']],
4697
- callback: function callback() {
4698
- selection.setRangeEnd(instance._createCellCoords(selection.selectedRange.current().from.row, instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1)));
4699
- }
4700
- }, {
4701
- keys: [['End', 'Control/Meta']],
4702
- captureCtrl: true,
4703
- callback: function callback() {
4704
- var fixedRows = parseInt(instance.getSettings().fixedRowsBottom, 10);
4705
- var row = instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - fixedRows - 1, -1);
4706
- var column = instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1);
4707
- selection.setRangeStart(instance._createCellCoords(row, column));
4708
- },
4709
- runOnlyIf: function runOnlyIf() {
4710
- return instance.view.isMainTableNotFullyCoveredByOverlays();
4711
- }
4712
- }, {
4713
- keys: [['PageUp']],
4714
- callback: function callback() {
4715
- selection.transformStart(-instance.countVisibleRows(), 0);
4716
- }
4717
- }, {
4718
- keys: [['PageUp', 'Shift']],
4719
- callback: function callback() {
4720
- var _instance$getSelected5 = instance.getSelectedRangeLast(),
4721
- to = _instance$getSelected5.to;
4722
- var nextRowIndexToSelect = Math.max(to.row - instance.countVisibleRows(), 0);
4723
- var row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, 1);
4724
- if (row !== null) {
4725
- var coords = instance._createCellCoords(row, to.col);
4726
- var scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
4727
- var nextVerticalScroll = Math.max(coords.row - scrollPadding, 0);
4728
- selection.setRangeEnd(coords);
4729
- instance.scrollViewportTo(nextVerticalScroll);
4730
- }
4731
- }
4732
- }, {
4733
- keys: [['PageDown']],
4734
- callback: function callback() {
4735
- selection.transformStart(instance.countVisibleRows(), 0);
4736
- }
4737
- }, {
4738
- keys: [['PageDown', 'Shift']],
4739
- callback: function callback() {
4740
- var _instance$getSelected6 = instance.getSelectedRangeLast(),
4741
- to = _instance$getSelected6.to;
4742
- var nextRowIndexToSelect = Math.min(to.row + instance.countVisibleRows(), instance.countRows() - 1);
4743
- var row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, -1);
4744
- if (row !== null) {
4745
- var coords = instance._createCellCoords(row, to.col);
4746
- var scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
4747
- var nextVerticalScroll = Math.min(coords.row - scrollPadding, instance.countRows() - 1);
4748
- selection.setRangeEnd(coords);
4749
- instance.scrollViewportTo(nextVerticalScroll);
4750
- }
4751
- }
4752
- }, {
4753
- keys: [['Tab']],
4754
- callback: function callback(event) {
4755
- var tabMoves = typeof tableMeta.tabMoves === 'function' ? tableMeta.tabMoves(event) : tableMeta.tabMoves;
4756
- selection.transformStart(tabMoves.row, tabMoves.col, true);
4757
- }
4758
- }, {
4759
- keys: [['Shift', 'Tab']],
4760
- callback: function callback(event) {
4761
- var tabMoves = typeof tableMeta.tabMoves === 'function' ? tableMeta.tabMoves(event) : tableMeta.tabMoves;
4762
- selection.transformStart(-tabMoves.row, -tabMoves.col);
4763
- }
4764
- }], gridConfig);
4765
4545
  (0, _registry.getPluginsNames)().forEach(function (pluginName) {
4766
4546
  var PluginClass = (0, _registry.getPlugin)(pluginName);
4767
4547
  pluginsRegistry.addItem(pluginName, new PluginClass(_this));
4768
4548
  });
4549
+ (0, _shortcutContexts.registerAllShortcutContexts)(instance);
4550
+ shortcutManager.setActiveContextName('grid');
4769
4551
  _pluginHooks.default.getSingleton().run(instance, 'construct');
4770
4552
  }