handsontable 0.0.0-next-93e34dc-20230601 → 0.0.0-next-b7cca45-20230605

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 (216) hide show
  1. package/3rdparty/walkontable/src/{selection/border/border.js → border.js} +12 -7
  2. package/3rdparty/walkontable/src/{selection/border/border.mjs → border.mjs} +12 -7
  3. package/3rdparty/walkontable/src/cell/coords.d.ts +1 -6
  4. package/3rdparty/walkontable/src/cell/coords.js +12 -61
  5. package/3rdparty/walkontable/src/cell/coords.mjs +12 -61
  6. package/3rdparty/walkontable/src/cell/range.d.ts +2 -9
  7. package/3rdparty/walkontable/src/cell/range.js +7 -44
  8. package/3rdparty/walkontable/src/cell/range.mjs +7 -44
  9. package/3rdparty/walkontable/src/core/_base.js +3 -9
  10. package/3rdparty/walkontable/src/core/_base.mjs +3 -9
  11. package/3rdparty/walkontable/src/core/clone.js +2 -2
  12. package/3rdparty/walkontable/src/core/clone.mjs +2 -2
  13. package/3rdparty/walkontable/src/core/core.js +2 -3
  14. package/3rdparty/walkontable/src/core/core.mjs +2 -3
  15. package/3rdparty/walkontable/src/event.js +7 -7
  16. package/3rdparty/walkontable/src/event.mjs +7 -7
  17. package/3rdparty/walkontable/src/facade/core.js +2 -2
  18. package/3rdparty/walkontable/src/facade/core.mjs +2 -2
  19. package/3rdparty/walkontable/src/index.js +2 -10
  20. package/3rdparty/walkontable/src/index.mjs +2 -2
  21. package/3rdparty/walkontable/src/overlay/_base.js +1 -1
  22. package/3rdparty/walkontable/src/overlay/_base.mjs +1 -1
  23. package/3rdparty/walkontable/src/overlay/inlineStart.js +4 -2
  24. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +4 -2
  25. package/3rdparty/walkontable/src/overlay/top.js +4 -2
  26. package/3rdparty/walkontable/src/overlay/top.mjs +4 -2
  27. package/3rdparty/walkontable/src/selection.js +354 -0
  28. package/3rdparty/walkontable/src/selection.mjs +348 -0
  29. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +0 -9
  30. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +0 -9
  31. package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +0 -9
  32. package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +0 -9
  33. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +0 -9
  34. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +0 -9
  35. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +0 -9
  36. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +0 -9
  37. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +0 -9
  38. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +0 -9
  39. package/3rdparty/walkontable/src/table.js +79 -7
  40. package/3rdparty/walkontable/src/table.mjs +80 -8
  41. package/base.js +2 -2
  42. package/base.mjs +2 -2
  43. package/core.d.ts +3 -5
  44. package/core.js +300 -82
  45. package/core.mjs +300 -82
  46. package/dataMap/metaManager/metaSchema.js +0 -15
  47. package/dataMap/metaManager/metaSchema.mjs +0 -15
  48. package/dist/handsontable.css +3 -8
  49. package/dist/handsontable.full.css +3 -8
  50. package/dist/handsontable.full.js +9926 -12218
  51. package/dist/handsontable.full.min.css +3 -3
  52. package/dist/handsontable.full.min.js +120 -120
  53. package/dist/handsontable.js +14628 -16920
  54. package/dist/handsontable.min.css +3 -3
  55. package/dist/handsontable.min.js +4 -4
  56. package/editorManager.js +82 -20
  57. package/editorManager.mjs +86 -25
  58. package/editors/textEditor/textEditor.js +11 -3
  59. package/editors/textEditor/textEditor.mjs +12 -4
  60. package/helpers/mixed.js +1 -1
  61. package/helpers/mixed.mjs +1 -1
  62. package/helpers/number.d.ts +0 -1
  63. package/helpers/number.js +0 -18
  64. package/helpers/number.mjs +0 -17
  65. package/package.json +1 -1
  66. package/pluginHooks.js +1 -1
  67. package/pluginHooks.mjs +1 -1
  68. package/plugins/copyPaste/copyPaste.js +1 -5
  69. package/plugins/copyPaste/copyPaste.mjs +1 -5
  70. package/plugins/customBorders/customBorders.js +52 -18
  71. package/plugins/customBorders/customBorders.mjs +53 -19
  72. package/plugins/mergeCells/mergeCells.js +18 -5
  73. package/plugins/mergeCells/mergeCells.mjs +18 -5
  74. package/plugins/nestedHeaders/nestedHeaders.js +9 -89
  75. package/plugins/nestedHeaders/nestedHeaders.mjs +9 -89
  76. package/plugins/nestedHeaders/stateManager/index.js +0 -37
  77. package/plugins/nestedHeaders/stateManager/index.mjs +0 -37
  78. package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
  79. package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
  80. package/selection/highlight/constants.js +16 -0
  81. package/selection/highlight/constants.mjs +6 -0
  82. package/selection/highlight/highlight.js +88 -311
  83. package/selection/highlight/highlight.mjs +84 -301
  84. package/selection/highlight/types/activeHeader.js +9 -10
  85. package/selection/highlight/types/activeHeader.mjs +8 -10
  86. package/selection/highlight/types/area.js +27 -12
  87. package/selection/highlight/types/area.mjs +30 -16
  88. package/selection/highlight/types/{focus.js → cell.js} +8 -5
  89. package/selection/highlight/types/{focus.mjs → cell.mjs} +7 -5
  90. package/selection/highlight/types/customSelection.js +10 -7
  91. package/selection/highlight/types/customSelection.mjs +9 -7
  92. package/selection/highlight/types/fill.js +8 -5
  93. package/selection/highlight/types/fill.mjs +7 -5
  94. package/selection/highlight/types/header.js +20 -10
  95. package/selection/highlight/types/header.mjs +19 -10
  96. package/selection/highlight/types/{row.js → index.js} +31 -27
  97. package/selection/highlight/types/{row.mjs → index.mjs} +29 -24
  98. package/selection/highlight/visualSelection.js +28 -23
  99. package/selection/highlight/visualSelection.mjs +28 -23
  100. package/selection/index.js +7 -4
  101. package/selection/index.mjs +3 -2
  102. package/selection/mouseEventHandler.js +1 -1
  103. package/selection/mouseEventHandler.mjs +1 -1
  104. package/selection/range.js +8 -8
  105. package/selection/range.mjs +8 -8
  106. package/selection/selection.js +180 -296
  107. package/selection/selection.mjs +179 -291
  108. package/selection/transformation.js +96 -233
  109. package/selection/transformation.mjs +93 -230
  110. package/selection/utils.js +35 -12
  111. package/selection/utils.mjs +35 -13
  112. package/settings.d.ts +0 -1
  113. package/tableView.js +9 -58
  114. package/tableView.mjs +9 -58
  115. package/3rdparty/walkontable/src/selection/border/constants.js +0 -18
  116. package/3rdparty/walkontable/src/selection/border/constants.mjs +0 -13
  117. package/3rdparty/walkontable/src/selection/constants.js +0 -63
  118. package/3rdparty/walkontable/src/selection/constants.mjs +0 -51
  119. package/3rdparty/walkontable/src/selection/index.js +0 -30
  120. package/3rdparty/walkontable/src/selection/index.mjs +0 -5
  121. package/3rdparty/walkontable/src/selection/manager.js +0 -328
  122. package/3rdparty/walkontable/src/selection/manager.mjs +0 -322
  123. package/3rdparty/walkontable/src/selection/scanner.js +0 -363
  124. package/3rdparty/walkontable/src/selection/scanner.mjs +0 -359
  125. package/3rdparty/walkontable/src/selection/selection.js +0 -133
  126. package/3rdparty/walkontable/src/selection/selection.mjs +0 -127
  127. package/selection/highlight/types/areaLayered.js +0 -54
  128. package/selection/highlight/types/areaLayered.mjs +0 -49
  129. package/selection/highlight/types/column.js +0 -50
  130. package/selection/highlight/types/column.mjs +0 -45
  131. package/shortcutContexts/commands/editor/closeAndSave.js +0 -15
  132. package/shortcutContexts/commands/editor/closeAndSave.mjs +0 -10
  133. package/shortcutContexts/commands/editor/closeWithoutSaving.js +0 -13
  134. package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +0 -8
  135. package/shortcutContexts/commands/editor/fastOpen.js +0 -16
  136. package/shortcutContexts/commands/editor/fastOpen.mjs +0 -11
  137. package/shortcutContexts/commands/editor/index.js +0 -16
  138. package/shortcutContexts/commands/editor/index.mjs +0 -12
  139. package/shortcutContexts/commands/editor/open.js +0 -29
  140. package/shortcutContexts/commands/editor/open.mjs +0 -24
  141. package/shortcutContexts/commands/emptySelectedCells.js +0 -12
  142. package/shortcutContexts/commands/emptySelectedCells.mjs +0 -7
  143. package/shortcutContexts/commands/extendCellsSelection/down.js +0 -15
  144. package/shortcutContexts/commands/extendCellsSelection/down.mjs +0 -10
  145. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +0 -21
  146. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +0 -16
  147. package/shortcutContexts/commands/extendCellsSelection/index.js +0 -24
  148. package/shortcutContexts/commands/extendCellsSelection/index.mjs +0 -20
  149. package/shortcutContexts/commands/extendCellsSelection/left.js +0 -15
  150. package/shortcutContexts/commands/extendCellsSelection/left.mjs +0 -10
  151. package/shortcutContexts/commands/extendCellsSelection/right.js +0 -15
  152. package/shortcutContexts/commands/extendCellsSelection/right.mjs +0 -10
  153. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +0 -22
  154. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +0 -17
  155. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +0 -17
  156. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +0 -12
  157. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +0 -17
  158. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +0 -12
  159. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +0 -39
  160. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +0 -34
  161. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +0 -39
  162. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +0 -34
  163. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +0 -22
  164. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +0 -17
  165. package/shortcutContexts/commands/extendCellsSelection/up.js +0 -15
  166. package/shortcutContexts/commands/extendCellsSelection/up.mjs +0 -10
  167. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +0 -21
  168. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +0 -16
  169. package/shortcutContexts/commands/index.js +0 -51
  170. package/shortcutContexts/commands/index.mjs +0 -47
  171. package/shortcutContexts/commands/moveCellSelection/down.js +0 -12
  172. package/shortcutContexts/commands/moveCellSelection/down.mjs +0 -7
  173. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +0 -11
  174. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +0 -6
  175. package/shortcutContexts/commands/moveCellSelection/index.js +0 -28
  176. package/shortcutContexts/commands/moveCellSelection/index.mjs +0 -24
  177. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +0 -13
  178. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +0 -8
  179. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +0 -13
  180. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +0 -8
  181. package/shortcutContexts/commands/moveCellSelection/left.js +0 -11
  182. package/shortcutContexts/commands/moveCellSelection/left.mjs +0 -6
  183. package/shortcutContexts/commands/moveCellSelection/right.js +0 -11
  184. package/shortcutContexts/commands/moveCellSelection/right.mjs +0 -6
  185. package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +0 -16
  186. package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +0 -11
  187. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +0 -17
  188. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +0 -12
  189. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +0 -13
  190. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +0 -8
  191. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +0 -16
  192. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +0 -11
  193. package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +0 -35
  194. package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +0 -30
  195. package/shortcutContexts/commands/moveCellSelection/toMostRight.js +0 -35
  196. package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +0 -30
  197. package/shortcutContexts/commands/moveCellSelection/toMostTop.js +0 -16
  198. package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +0 -11
  199. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +0 -18
  200. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +0 -13
  201. package/shortcutContexts/commands/moveCellSelection/up.js +0 -12
  202. package/shortcutContexts/commands/moveCellSelection/up.mjs +0 -7
  203. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +0 -11
  204. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +0 -6
  205. package/shortcutContexts/commands/populateSelectedCellsData.js +0 -35
  206. package/shortcutContexts/commands/populateSelectedCellsData.mjs +0 -30
  207. package/shortcutContexts/commands/selectAll.js +0 -11
  208. package/shortcutContexts/commands/selectAll.mjs +0 -6
  209. package/shortcutContexts/constants.js +0 -19
  210. package/shortcutContexts/constants.mjs +0 -12
  211. package/shortcutContexts/editor.js +0 -29
  212. package/shortcutContexts/editor.mjs +0 -25
  213. package/shortcutContexts/grid.js +0 -232
  214. package/shortcutContexts/grid.mjs +0 -228
  215. package/shortcutContexts/index.js +0 -29
  216. package/shortcutContexts/index.mjs +0 -15
@@ -1,5 +1,11 @@
1
1
  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); }
2
2
  var _templateObject;
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+ 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; }
7
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
8
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
3
9
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
4
10
  import "core-js/modules/es.array.iterator.js";
5
11
  import "core-js/modules/es.object.to-string.js";
@@ -20,22 +26,22 @@ import "core-js/modules/es.symbol.description.js";
20
26
  import "core-js/modules/es.array.slice.js";
21
27
  import "core-js/modules/es.object.freeze.js";
22
28
  import "core-js/modules/es.symbol.iterator.js";
29
+ import "core-js/modules/es.function.name.js";
30
+ import "core-js/modules/es.regexp.exec.js";
23
31
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
24
32
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
25
33
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
26
- 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; }
27
34
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
28
35
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
29
- import { CellCoords, CellRange } from "./../3rdparty/walkontable/src/index.mjs";
30
- import Highlight, { AREA_TYPE, HEADER_TYPE, FOCUS_TYPE } from "./highlight/highlight.mjs";
36
+ import Highlight from "./highlight/highlight.mjs";
37
+ import { AREA_TYPE, HEADER_TYPE, CELL_TYPE } from "./highlight/constants.mjs";
31
38
  import SelectionRange from "./range.mjs";
32
39
  import { createObjectPropListener, mixin } from "./../helpers/object.mjs";
33
40
  import { isUndefined } from "./../helpers/mixed.mjs";
34
- import { clamp } from "./../helpers/number.mjs";
35
41
  import { arrayEach } from "./../helpers/array.mjs";
36
42
  import localHooks from "./../mixins/localHooks.mjs";
37
43
  import Transformation from "./transformation.mjs";
38
- import { detectSelectionType, normalizeSelectionFactory, SELECTION_TYPE_EMPTY, SELECTION_TYPE_UNRECOGNIZED } from "./utils.mjs";
44
+ import { detectSelectionType, isValidCoord, normalizeSelectionFactory, SELECTION_TYPE_EMPTY, SELECTION_TYPE_UNRECOGNIZED } from "./utils.mjs";
39
45
  import { toSingleLine } from "./../helpers/templateLiteralTag.mjs";
40
46
  /**
41
47
  * @class Selection
@@ -50,62 +56,57 @@ var Selection = /*#__PURE__*/function () {
50
56
  *
51
57
  * @type {GridSettings}
52
58
  */
53
- _defineProperty(this, "settings", void 0);
59
+ this.settings = settings;
54
60
  /**
55
61
  * An additional object with dynamically defined properties which describes table state.
56
62
  *
57
63
  * @type {object}
58
64
  */
59
- _defineProperty(this, "tableProps", void 0);
65
+ this.tableProps = tableProps;
60
66
  /**
61
67
  * The flag which determines if the selection is in progress.
62
68
  *
63
69
  * @type {boolean}
64
70
  */
65
- _defineProperty(this, "inProgress", false);
71
+ this.inProgress = false;
66
72
  /**
67
- * Selection data layer (handle visual coordinates).
73
+ * The flag indicates that selection was performed by clicking the corner overlay.
68
74
  *
69
- * @type {SelectionRange}
75
+ * @type {boolean}
70
76
  */
71
- _defineProperty(this, "selectedRange", new SelectionRange(function (highlight, from, to) {
72
- return _this.tableProps.createCellRange(highlight, from, to);
73
- }));
77
+ this.selectedByCorner = false;
74
78
  /**
75
- * Visualization layer.
79
+ * The collection of the selection layer levels where the whole row was selected using the row header or
80
+ * the corner header.
76
81
  *
77
- * @type {Highlight}
82
+ * @type {Set.<number>}
78
83
  */
79
- _defineProperty(this, "highlight", void 0);
84
+ this.selectedByRowHeader = new Set();
80
85
  /**
81
- * The module for modifying coordinates.
86
+ * The collection of the selection layer levels where the whole column was selected using the column header or
87
+ * the corner header.
82
88
  *
83
- * @type {Transformation}
89
+ * @type {Set.<number>}
84
90
  */
85
- _defineProperty(this, "transformation", void 0);
91
+ this.selectedByColumnHeader = new Set();
86
92
  /**
87
- * The collection of the selection layer levels where the whole row was selected using the row header or
88
- * the corner header.
93
+ * Selection data layer (handle visual coordinates).
89
94
  *
90
- * @type {Set<number>}
95
+ * @type {SelectionRange}
91
96
  */
92
- _defineProperty(this, "selectedByRowHeader", new Set());
97
+ this.selectedRange = new SelectionRange(function (highlight, from, to) {
98
+ return _this.tableProps.createCellRange(highlight, from, to);
99
+ });
93
100
  /**
94
- * The collection of the selection layer levels where the whole column was selected using the column header or
95
- * the corner header.
101
+ * Visualization layer.
96
102
  *
97
- * @type {Set<number>}
103
+ * @type {Highlight}
98
104
  */
99
- _defineProperty(this, "selectedByColumnHeader", new Set());
100
- this.settings = settings;
101
- this.tableProps = tableProps;
102
105
  this.highlight = new Highlight({
103
106
  headerClassName: settings.currentHeaderClassName,
104
107
  activeHeaderClassName: settings.activeHeaderClassName,
105
108
  rowClassName: settings.currentRowClassName,
106
109
  columnClassName: settings.currentColClassName,
107
- rowIndexMapper: this.tableProps.rowIndexMapper,
108
- columnIndexMapper: this.tableProps.columnIndexMapper,
109
110
  disabledCellSelection: function disabledCellSelection(row, column) {
110
111
  return _this.tableProps.isDisabledCellSelection(row, column);
111
112
  },
@@ -126,22 +127,25 @@ var Selection = /*#__PURE__*/function () {
126
127
  },
127
128
  createCellRange: function createCellRange(highlight, from, to) {
128
129
  return _this.tableProps.createCellRange(highlight, from, to);
130
+ },
131
+ rowIndexMapper: function rowIndexMapper() {
132
+ return _this.tableProps.rowIndexMapper();
133
+ },
134
+ columnIndexMapper: function columnIndexMapper() {
135
+ return _this.tableProps.columnIndexMapper();
129
136
  }
130
137
  });
138
+ /**
139
+ * The module for modifying coordinates.
140
+ *
141
+ * @type {Transformation}
142
+ */
131
143
  this.transformation = new Transformation(this.selectedRange, {
132
- rowIndexMapper: this.tableProps.rowIndexMapper,
133
- columnIndexMapper: this.tableProps.columnIndexMapper,
134
- countRenderableRows: function countRenderableRows() {
135
- return _this.tableProps.countRenderableRows();
144
+ countRows: function countRows() {
145
+ return _this.tableProps.countRowsTranslated();
136
146
  },
137
- countRenderableColumns: function countRenderableColumns() {
138
- return _this.tableProps.countRenderableColumns();
139
- },
140
- countRowHeaders: function countRowHeaders() {
141
- return _this.tableProps.countRowHeaders();
142
- },
143
- countColHeaders: function countColHeaders() {
144
- return _this.tableProps.countColHeaders();
147
+ countCols: function countCols() {
148
+ return _this.tableProps.countColsTranslated();
145
149
  },
146
150
  visualToRenderableCoords: function visualToRenderableCoords(coords) {
147
151
  return _this.tableProps.visualToRenderableCoords(coords);
@@ -152,9 +156,6 @@ var Selection = /*#__PURE__*/function () {
152
156
  createCellCoords: function createCellCoords(row, column) {
153
157
  return _this.tableProps.createCellCoords(row, column);
154
158
  },
155
- navigableHeaders: function navigableHeaders() {
156
- return settings.navigableHeaders;
157
- },
158
159
  fixedRowsBottom: function fixedRowsBottom() {
159
160
  return settings.fixedRowsBottom;
160
161
  },
@@ -259,27 +260,35 @@ var Selection = /*#__PURE__*/function () {
259
260
  * the default trigger will be used.
260
261
  * @param {boolean} [fragment=false] If `true`, the selection will be treated as a partial selection where the
261
262
  * `setRangeEnd` method won't be called on every `setRangeStart` call.
262
- * @param {CellCoords} [highlightCoords] If set, allows changing the coordinates of the highlight/focus cell.
263
263
  */
264
264
  }, {
265
265
  key: "setRangeStart",
266
266
  value: function setRangeStart(coords, multipleSelection) {
267
267
  var fragment = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
268
- var highlightCoords = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : coords;
269
268
  var isMultipleMode = this.settings.selectionMode === 'multiple';
270
269
  var isMultipleSelection = isUndefined(multipleSelection) ? this.tableProps.getShortcutManager().isCtrlPressed() : multipleSelection;
270
+ var isRowNegative = coords.row < 0;
271
+ var isColumnNegative = coords.col < 0;
272
+ var selectedByCorner = isRowNegative && isColumnNegative;
271
273
  // We are creating copy. We would like to modify just the start of the selection by below hook. Then original coords
272
274
  // should be handled by next methods.
273
275
  var coordsClone = coords.clone();
276
+ this.selectedByCorner = selectedByCorner;
274
277
  this.runLocalHooks("beforeSetRangeStart".concat(fragment ? 'Only' : ''), coordsClone);
275
278
  if (!isMultipleMode || isMultipleMode && !isMultipleSelection && isUndefined(multipleSelection)) {
276
279
  this.selectedRange.clear();
277
280
  }
278
- this.selectedRange.add(coordsClone).current().setHighlight(highlightCoords.clone());
281
+ this.selectedRange.add(coordsClone);
279
282
  if (this.getLayerLevel() === 0) {
280
283
  this.selectedByRowHeader.clear();
281
284
  this.selectedByColumnHeader.clear();
282
285
  }
286
+ if (!selectedByCorner && isColumnNegative) {
287
+ this.selectedByRowHeader.add(this.getLayerLevel());
288
+ }
289
+ if (!selectedByCorner && isRowNegative) {
290
+ this.selectedByColumnHeader.add(this.getLayerLevel());
291
+ }
283
292
  if (!fragment) {
284
293
  this.setRangeEnd(coords);
285
294
  }
@@ -292,13 +301,11 @@ var Selection = /*#__PURE__*/function () {
292
301
  * @param {boolean} [multipleSelection] If `true`, selection will be worked in 'multiple' mode. This option works
293
302
  * only when 'selectionMode' is set as 'multiple'. If the argument is not defined
294
303
  * the default trigger will be used.
295
- * @param {CellCoords} [highlightCoords] If set, allows changing the coordinates of the highlight/focus cell.
296
304
  */
297
305
  }, {
298
306
  key: "setRangeStartOnly",
299
307
  value: function setRangeStartOnly(coords, multipleSelection) {
300
- var highlightCoords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : coords;
301
- this.setRangeStart(coords, multipleSelection, true, highlightCoords);
308
+ this.setRangeStart(coords, multipleSelection, true);
302
309
  }
303
310
 
304
311
  /**
@@ -312,39 +319,21 @@ var Selection = /*#__PURE__*/function () {
312
319
  if (this.selectedRange.isEmpty()) {
313
320
  return;
314
321
  }
315
- var coordsClone = coords.clone();
316
- var countRows = this.tableProps.countRows();
317
- var countCols = this.tableProps.countCols();
318
- var isSingle = this.selectedRange.current().clone().setTo(coords).isSingleHeader();
319
322
 
320
- // Ignore processing the end range when the header selection starts overlapping the corner and
321
- // the selection is not a single header highlight.
322
- if ((countRows > 0 || countCols > 0) && (countRows === 0 && coordsClone.col < 0 && !isSingle || countCols === 0 && coordsClone.row < 0 && !isSingle)) {
323
- return;
324
- }
323
+ // We are creating copy. We would like to modify just the end of the selection by below hook. Then original coords
324
+ // should be handled by next methods.
325
+ var coordsClone = coords.clone();
325
326
  this.runLocalHooks('beforeSetRangeEnd', coordsClone);
326
327
  this.begin();
327
328
  var cellRange = this.selectedRange.current();
328
- if (!this.settings.navigableHeaders) {
329
- cellRange.highlight.normalize();
330
- }
331
- if (this.settings.selectionMode === 'single') {
332
- cellRange.setFrom(cellRange.highlight);
333
- cellRange.setTo(cellRange.highlight);
334
- } else {
335
- cellRange.setTo(coordsClone);
329
+ if (this.settings.selectionMode !== 'single') {
330
+ cellRange.setTo(this.tableProps.createCellCoords(coordsClone.row, coordsClone.col));
336
331
  }
337
332
 
338
- // Prevent creating "area" selection that overlaps headers.
339
- if (countRows > 0 && countCols > 0) {
340
- if (!this.settings.navigableHeaders || this.settings.navigableHeaders && !cellRange.isSingleHeader()) {
341
- cellRange.to.normalize();
342
- }
343
- }
344
- var focusHighlight = this.highlight.getFocus();
345
- focusHighlight.clear();
346
- if (this.highlight.isEnabledFor(FOCUS_TYPE, cellRange.highlight)) {
347
- focusHighlight.add(this.selectedRange.current().highlight).commit().syncWith(cellRange);
333
+ // Set up current selection.
334
+ this.highlight.getCell().clear();
335
+ if (this.highlight.isEnabledFor(CELL_TYPE, cellRange.highlight)) {
336
+ this.highlight.getCell().add(this.selectedRange.current().highlight).commit().syncWith(cellRange);
348
337
  }
349
338
  var layerLevel = this.getLayerLevel();
350
339
 
@@ -354,96 +343,73 @@ var Selection = /*#__PURE__*/function () {
354
343
  arrayEach(this.highlight.getAreas(), function (highlight) {
355
344
  return void highlight.clear();
356
345
  });
357
- arrayEach(this.highlight.getLayeredAreas(), function (highlight) {
358
- return void highlight.clear();
359
- });
360
- arrayEach(this.highlight.getRowHeaders(), function (highlight) {
361
- return void highlight.clear();
362
- });
363
- arrayEach(this.highlight.getColumnHeaders(), function (highlight) {
364
- return void highlight.clear();
365
- });
366
- arrayEach(this.highlight.getActiveRowHeaders(), function (highlight) {
367
- return void highlight.clear();
368
- });
369
- arrayEach(this.highlight.getActiveColumnHeaders(), function (highlight) {
346
+ arrayEach(this.highlight.getHeaders(), function (highlight) {
370
347
  return void highlight.clear();
371
348
  });
372
- arrayEach(this.highlight.getActiveCornerHeaders(), function (highlight) {
373
- return void highlight.clear();
374
- });
375
- arrayEach(this.highlight.getRowHighlights(), function (highlight) {
376
- return void highlight.clear();
377
- });
378
- arrayEach(this.highlight.getColumnHighlights(), function (highlight) {
349
+ arrayEach(this.highlight.getActiveHeaders(), function (highlight) {
379
350
  return void highlight.clear();
380
351
  });
381
352
  }
382
353
  this.highlight.useLayerLevel(layerLevel);
383
- var areaHighlight = this.highlight.createArea();
384
- var layeredAreaHighlight = this.highlight.createLayeredArea();
385
- var rowHeaderHighlight = this.highlight.createRowHeader();
386
- var columnHeaderHighlight = this.highlight.createColumnHeader();
387
- var activeRowHeaderHighlight = this.highlight.createActiveRowHeader();
388
- var activeColumnHeaderHighlight = this.highlight.createActiveColumnHeader();
389
- var activeCornerHeaderHighlight = this.highlight.createActiveCornerHeader();
390
- var rowHighlight = this.highlight.createRowHighlight();
391
- var columnHighlight = this.highlight.createColumnHighlight();
354
+ var areaHighlight = this.highlight.createOrGetArea();
355
+ var headerHighlight = this.highlight.createOrGetHeader();
356
+ var activeHeaderHighlight = this.highlight.createOrGetActiveHeader();
392
357
  areaHighlight.clear();
393
- layeredAreaHighlight.clear();
394
- rowHeaderHighlight.clear();
395
- columnHeaderHighlight.clear();
396
- activeRowHeaderHighlight.clear();
397
- activeColumnHeaderHighlight.clear();
398
- activeCornerHeaderHighlight.clear();
399
- rowHighlight.clear();
400
- columnHighlight.clear();
358
+ headerHighlight.clear();
359
+ activeHeaderHighlight.clear();
401
360
  if (this.highlight.isEnabledFor(AREA_TYPE, cellRange.highlight) && (this.isMultiple() || layerLevel >= 1)) {
402
361
  areaHighlight.add(cellRange.from).add(cellRange.to).commit();
403
- layeredAreaHighlight.add(cellRange.from).add(cellRange.to).commit();
404
362
  if (layerLevel === 1) {
405
363
  // For single cell selection in the same layer, we do not create area selection to prevent blue background.
406
364
  // When non-consecutive selection is performed we have to add that missing area selection to the previous layer
407
365
  // based on previous coordinates. It only occurs when the previous selection wasn't select multiple cells.
408
366
  var previousRange = this.selectedRange.previous();
409
- this.highlight.useLayerLevel(layerLevel - 1);
410
- this.highlight.createArea().add(previousRange.from).commit()
411
- // Range may start with hidden indexes. Commit would not found start point (as we add just the `from` coords).
412
- .syncWith(previousRange);
413
- this.highlight.createLayeredArea().add(previousRange.from).commit()
367
+ this.highlight.useLayerLevel(layerLevel - 1).createOrGetArea().add(previousRange.from).commit()
414
368
  // Range may start with hidden indexes. Commit would not found start point (as we add just the `from` coords).
415
369
  .syncWith(previousRange);
416
370
  this.highlight.useLayerLevel(layerLevel);
417
371
  }
418
372
  }
419
373
  if (this.highlight.isEnabledFor(HEADER_TYPE, cellRange.highlight)) {
420
- if (!cellRange.isSingleHeader()) {
421
- var rowCoordsFrom = this.tableProps.createCellCoords(Math.max(cellRange.from.row, 0), -1);
422
- var rowCoordsTo = this.tableProps.createCellCoords(cellRange.to.row, -1);
423
- var columnCoordsFrom = this.tableProps.createCellCoords(-1, Math.max(cellRange.from.col, 0));
424
- var columnCoordsTo = this.tableProps.createCellCoords(-1, cellRange.to.col);
425
- if (this.settings.selectionMode === 'single') {
426
- rowHeaderHighlight.add(rowCoordsFrom).commit();
427
- columnHeaderHighlight.add(columnCoordsFrom).commit();
428
- rowHighlight.add(rowCoordsFrom).commit();
429
- columnHighlight.add(columnCoordsFrom).commit();
430
- } else {
431
- rowHeaderHighlight.add(rowCoordsFrom).add(rowCoordsTo).commit();
432
- columnHeaderHighlight.add(columnCoordsFrom).add(columnCoordsTo).commit();
433
- rowHighlight.add(rowCoordsFrom).add(rowCoordsTo).commit();
434
- columnHighlight.add(columnCoordsFrom).add(columnCoordsTo).commit();
435
- }
374
+ // The header selection generally contains cell selection. In a case when all rows (or columns)
375
+ // are hidden that visual coordinates are translated to renderable coordinates that do not exist.
376
+ // Hence no header highlight is generated. In that case, to make a column (or a row) header
377
+ // highlight, the row and column index has to point to the header (the negative value). See #7052.
378
+ var areAnyRowsRendered = this.tableProps.countRowsTranslated() === 0;
379
+ var areAnyColumnsRendered = this.tableProps.countColsTranslated() === 0;
380
+ var headerCellRange = cellRange;
381
+ if (areAnyRowsRendered || areAnyColumnsRendered) {
382
+ headerCellRange = cellRange.clone();
383
+ }
384
+ if (areAnyRowsRendered) {
385
+ headerCellRange.from.row = -1;
436
386
  }
437
- var highlightRowHeaders = this.isEntireRowSelected() && (countCols > 0 && countCols === cellRange.getWidth() || countCols === 0 && (this.isSelectedByRowHeader() || this.isSelectedByCorner()));
438
- var highlightColumnHeaders = this.isEntireColumnSelected() && (countRows > 0 && countRows === cellRange.getHeight() || countRows === 0 && (this.isSelectedByColumnHeader() || this.isSelectedByCorner()));
439
- if (highlightRowHeaders) {
440
- activeRowHeaderHighlight.add(this.tableProps.createCellCoords(Math.max(cellRange.from.row, 0), Math.min(-this.tableProps.countRowHeaders(), -1))).add(this.tableProps.createCellCoords(Math.max(cellRange.to.row, 0), -1)).commit();
387
+ if (areAnyColumnsRendered) {
388
+ headerCellRange.from.col = -1;
441
389
  }
442
- if (highlightColumnHeaders) {
443
- activeColumnHeaderHighlight.add(this.tableProps.createCellCoords(Math.min(-this.tableProps.countColHeaders(), -1), Math.max(cellRange.from.col, 0))).add(this.tableProps.createCellCoords(-1, Math.max(cellRange.to.col, 0))).commit();
390
+ if (this.settings.selectionMode === 'single') {
391
+ if (this.isSelectedByAnyHeader()) {
392
+ headerCellRange.from.normalize();
393
+ }
394
+ headerHighlight.add(headerCellRange.from).commit();
395
+ } else {
396
+ headerHighlight.add(headerCellRange.from).add(headerCellRange.to).commit();
444
397
  }
445
- if (highlightRowHeaders && highlightColumnHeaders) {
446
- activeCornerHeaderHighlight.add(this.tableProps.createCellCoords(-this.tableProps.countColHeaders(), -this.tableProps.countRowHeaders())).add(this.tableProps.createCellCoords(-1, -1)).commit();
398
+ if (this.isEntireRowSelected()) {
399
+ var isRowSelected = this.tableProps.countCols() === cellRange.getWidth();
400
+
401
+ // Make sure that the whole row is selected (in case where selectionMode is set to 'single')
402
+ if (isRowSelected) {
403
+ activeHeaderHighlight.add(this.tableProps.createCellCoords(cellRange.from.row, -1)).add(this.tableProps.createCellCoords(cellRange.to.row, -1)).commit();
404
+ }
405
+ }
406
+ if (this.isEntireColumnSelected()) {
407
+ var isColumnSelected = this.tableProps.countRows() === cellRange.getHeight();
408
+
409
+ // Make sure that the whole column is selected (in case where selectionMode is set to 'single')
410
+ if (isColumnSelected) {
411
+ activeHeaderHighlight.add(this.tableProps.createCellCoords(-1, cellRange.from.col)).add(this.tableProps.createCellCoords(-1, cellRange.to.col)).commit();
412
+ }
447
413
  }
448
414
  }
449
415
  this.runLocalHooks('afterSetRangeEnd', coords);
@@ -468,14 +434,14 @@ var Selection = /*#__PURE__*/function () {
468
434
  *
469
435
  * @param {number} rowDelta Rows number to move, value can be passed as negative number.
470
436
  * @param {number} colDelta Columns number to move, value can be passed as negative number.
471
- * @param {boolean} [createMissingRecords=false] If `true` the new rows/columns will be created if necessary.
472
- * Otherwise, row/column will be created according to `minSpareRows/minSpareCols` settings of Handsontable.
437
+ * @param {boolean} [force=false] If `true` the new rows/columns will be created if necessary. Otherwise, row/column will
438
+ * be created according to `minSpareRows/minSpareCols` settings of Handsontable.
473
439
  */
474
440
  }, {
475
441
  key: "transformStart",
476
442
  value: function transformStart(rowDelta, colDelta) {
477
- var createMissingRecords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
478
- this.setRangeStart(this.transformation.transformStart(rowDelta, colDelta, createMissingRecords));
443
+ var force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
444
+ this.setRangeStart(this.transformation.transformStart(rowDelta, colDelta, force));
479
445
  }
480
446
 
481
447
  /**
@@ -524,7 +490,7 @@ var Selection = /*#__PURE__*/function () {
524
490
  key: "isSelectedByRowHeader",
525
491
  value: function isSelectedByRowHeader() {
526
492
  var layerLevel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getLayerLevel();
527
- return !this.isSelectedByCorner(layerLevel) && (layerLevel === -1 ? this.selectedByRowHeader.size > 0 : this.selectedByRowHeader.has(layerLevel));
493
+ return !this.isSelectedByCorner(layerLevel) && this.isEntireRowSelected(layerLevel);
528
494
  }
529
495
 
530
496
  /**
@@ -537,22 +503,8 @@ var Selection = /*#__PURE__*/function () {
537
503
  }, {
538
504
  key: "isEntireRowSelected",
539
505
  value: function isEntireRowSelected() {
540
- var _this2 = this;
541
506
  var layerLevel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getLayerLevel();
542
- var tester = function tester(range) {
543
- var _range$getOuterTopSta = range.getOuterTopStartCorner(),
544
- col = _range$getOuterTopSta.col;
545
- var rowHeaders = _this2.tableProps.countRowHeaders();
546
- var countCols = _this2.tableProps.countCols();
547
- return (rowHeaders > 0 && col < 0 || rowHeaders === 0) && range.getWidth() === countCols;
548
- };
549
- if (layerLevel === -1) {
550
- return Array.from(this.selectedRange).some(function (range) {
551
- return tester(range);
552
- });
553
- }
554
- var range = this.selectedRange.peekByIndex(layerLevel);
555
- return range ? tester(range) : false;
507
+ return layerLevel === -1 ? this.selectedByRowHeader.size > 0 : this.selectedByRowHeader.has(layerLevel);
556
508
  }
557
509
 
558
510
  /**
@@ -567,7 +519,7 @@ var Selection = /*#__PURE__*/function () {
567
519
  key: "isSelectedByColumnHeader",
568
520
  value: function isSelectedByColumnHeader() {
569
521
  var layerLevel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getLayerLevel();
570
- return !this.isSelectedByCorner() && (layerLevel === -1 ? this.selectedByColumnHeader.size > 0 : this.selectedByColumnHeader.has(layerLevel));
522
+ return !this.isSelectedByCorner() && this.isEntireColumnSelected(layerLevel);
571
523
  }
572
524
 
573
525
  /**
@@ -580,22 +532,8 @@ var Selection = /*#__PURE__*/function () {
580
532
  }, {
581
533
  key: "isEntireColumnSelected",
582
534
  value: function isEntireColumnSelected() {
583
- var _this3 = this;
584
535
  var layerLevel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getLayerLevel();
585
- var tester = function tester(range) {
586
- var _range$getOuterTopSta2 = range.getOuterTopStartCorner(),
587
- row = _range$getOuterTopSta2.row;
588
- var colHeaders = _this3.tableProps.countColHeaders();
589
- var countRows = _this3.tableProps.countRows();
590
- return (colHeaders > 0 && row < 0 || colHeaders === 0) && range.getHeight() === countRows;
591
- };
592
- if (layerLevel === -1) {
593
- return Array.from(this.selectedRange).some(function (range) {
594
- return tester(range);
595
- });
596
- }
597
- var range = this.selectedRange.peekByIndex(layerLevel);
598
- return range ? tester(range) : false;
536
+ return layerLevel === -1 ? this.selectedByColumnHeader.size > 0 : this.selectedByColumnHeader.has(layerLevel);
599
537
  }
600
538
 
601
539
  /**
@@ -617,7 +555,7 @@ var Selection = /*#__PURE__*/function () {
617
555
  }, {
618
556
  key: "isSelectedByCorner",
619
557
  value: function isSelectedByCorner() {
620
- return this.selectedByColumnHeader.has(this.getLayerLevel()) && this.selectedByRowHeader.has(this.getLayerLevel());
558
+ return this.selectedByCorner;
621
559
  }
622
560
 
623
561
  /**
@@ -686,48 +624,31 @@ var Selection = /*#__PURE__*/function () {
686
624
  }
687
625
 
688
626
  /**
689
- * Selects all cells and headers.
627
+ * Select all cells.
690
628
  *
691
- * @param {number|boolean} [rowHeaderLevel=false] If passed as `true`, it selects all row headers.
692
- * If a value is passed as a number (from -1 to -N), then it additionally allows moving the cell
693
- * focus (highlight) to the header (available when the `navigableHeaders` is enabled).
694
- * @param {number|boolean} [columnHeaderLevel=false] If passed as `true`, it selects all column headers.
695
- * If a value is passed as a number (from -1 to -N), then it additionally allows moving the cell
696
- * focus (highlight) to the header (available when the `navigableHeaders` is enabled).
629
+ * @param {boolean} [includeRowHeaders=false] `true` If the selection should include the row headers, `false`
630
+ * otherwise.
631
+ * @param {boolean} [includeColumnHeaders=false] `true` If the selection should include the column headers, `false`
632
+ * otherwise.
697
633
  */
698
634
  }, {
699
635
  key: "selectAll",
700
636
  value: function selectAll() {
701
- var rowHeaderLevel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
702
- var columnHeaderLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
637
+ var includeRowHeaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
638
+ var includeColumnHeaders = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
703
639
  var nrOfRows = this.tableProps.countRows();
704
640
  var nrOfColumns = this.tableProps.countCols();
705
- var countRowHeaders = this.tableProps.countRowHeaders();
706
- var countColHeaders = this.tableProps.countColHeaders();
707
- var rowFrom = rowHeaderLevel ? -countColHeaders : 0;
708
- if (Number.isInteger(rowHeaderLevel)) {
709
- rowFrom = clamp(rowHeaderLevel, -countColHeaders, -1);
710
- }
711
- var columnFrom = columnHeaderLevel ? -countRowHeaders : 0;
712
- if (Number.isInteger(columnHeaderLevel)) {
713
- columnFrom = clamp(columnHeaderLevel, -countRowHeaders, -1);
714
- }
715
641
 
716
642
  // We can't select cells when there is no data.
717
- if (rowFrom === 0 && columnFrom === 0 && (nrOfRows === 0 || nrOfColumns === 0)) {
643
+ if (!includeRowHeaders && !includeColumnHeaders && (nrOfRows === 0 || nrOfColumns === 0)) {
718
644
  return;
719
645
  }
720
- var startCoords = this.tableProps.createCellCoords(rowFrom < 0 ? -countColHeaders : 0, columnFrom < 0 ? -countRowHeaders : 0);
721
- var highlight = this.tableProps.createCellCoords(rowFrom, columnFrom);
646
+ var startCoords = this.tableProps.createCellCoords(includeColumnHeaders ? -1 : 0, includeRowHeaders ? -1 : 0);
722
647
  var endCoords = this.tableProps.createCellCoords(nrOfRows - 1, nrOfColumns - 1);
723
648
  this.clear();
724
- this.setRangeStartOnly(startCoords, void 0, highlight);
725
- if (columnFrom < 0) {
726
- this.selectedByRowHeader.add(this.getLayerLevel());
727
- }
728
- if (rowFrom < 0) {
729
- this.selectedByColumnHeader.add(this.getLayerLevel());
730
- }
649
+ this.setRangeStartOnly(startCoords);
650
+ this.selectedByRowHeader.add(this.getLayerLevel());
651
+ this.selectedByColumnHeader.add(this.getLayerLevel());
731
652
  this.setRangeEnd(endCoords);
732
653
  this.finish();
733
654
  }
@@ -744,7 +665,7 @@ var Selection = /*#__PURE__*/function () {
744
665
  }, {
745
666
  key: "selectCells",
746
667
  value: function selectCells(selectionRanges) {
747
- var _this4 = this;
668
+ var _this2 = this;
748
669
  var selectionType = detectSelectionType(selectionRanges);
749
670
  if (selectionType === SELECTION_TYPE_EMPTY) {
750
671
  return false;
@@ -753,33 +674,36 @@ var Selection = /*#__PURE__*/function () {
753
674
  }
754
675
  var selectionSchemaNormalizer = normalizeSelectionFactory(selectionType, {
755
676
  propToCol: function propToCol(prop) {
756
- return _this4.tableProps.propToCol(prop);
677
+ return _this2.tableProps.propToCol(prop);
757
678
  },
758
679
  keepDirection: true
759
680
  });
760
- var navigableHeaders = this.settings.navigableHeaders;
761
- var tableParams = {
762
- countRows: this.tableProps.countRows(),
763
- countCols: this.tableProps.countCols(),
764
- countRowHeaders: navigableHeaders ? this.tableProps.countRowHeaders() : 0,
765
- countColHeaders: navigableHeaders ? this.tableProps.countColHeaders() : 0
766
- };
681
+ var nrOfRows = this.tableProps.countRows();
682
+ var nrOfColumns = this.tableProps.countCols();
767
683
 
768
684
  // Check if every layer of the coordinates are valid.
769
685
  var isValid = !selectionRanges.some(function (selection) {
770
- var cellRange = selectionSchemaNormalizer(selection);
771
- var rangeValidity = cellRange.isValid(tableParams);
772
- return !(rangeValidity && !cellRange.containsHeaders() || rangeValidity && cellRange.containsHeaders() && cellRange.isSingleHeader());
686
+ var _selectionSchemaNorma = selectionSchemaNormalizer(selection),
687
+ _selectionSchemaNorma2 = _slicedToArray(_selectionSchemaNorma, 4),
688
+ rowStart = _selectionSchemaNorma2[0],
689
+ columnStart = _selectionSchemaNorma2[1],
690
+ rowEnd = _selectionSchemaNorma2[2],
691
+ columnEnd = _selectionSchemaNorma2[3];
692
+ var _isValid = isValidCoord(rowStart, nrOfRows) && isValidCoord(columnStart, nrOfColumns) && isValidCoord(rowEnd, nrOfRows) && isValidCoord(columnEnd, nrOfColumns);
693
+ return !_isValid;
773
694
  });
774
695
  if (isValid) {
775
696
  this.clear();
776
697
  arrayEach(selectionRanges, function (selection) {
777
- var _selectionSchemaNorma = selectionSchemaNormalizer(selection),
778
- from = _selectionSchemaNorma.from,
779
- to = _selectionSchemaNorma.to;
780
- _this4.setRangeStartOnly(from.clone(), false);
781
- _this4.setRangeEnd(to.clone());
782
- _this4.finish();
698
+ var _selectionSchemaNorma3 = selectionSchemaNormalizer(selection),
699
+ _selectionSchemaNorma4 = _slicedToArray(_selectionSchemaNorma3, 4),
700
+ rowStart = _selectionSchemaNorma4[0],
701
+ columnStart = _selectionSchemaNorma4[1],
702
+ rowEnd = _selectionSchemaNorma4[2],
703
+ columnEnd = _selectionSchemaNorma4[3];
704
+ _this2.setRangeStartOnly(_this2.tableProps.createCellCoords(rowStart, columnStart), false);
705
+ _this2.setRangeEnd(_this2.tableProps.createCellCoords(rowEnd, columnEnd));
706
+ _this2.finish();
783
707
  });
784
708
  }
785
709
  return isValid;
@@ -791,36 +715,24 @@ var Selection = /*#__PURE__*/function () {
791
715
  *
792
716
  * @param {number|string} startColumn Visual column index or column property from which the selection starts.
793
717
  * @param {number|string} [endColumn] Visual column index or column property from to the selection finishes.
794
- * @param {number} [headerLevel=0] The header level allows changing the cell/header highlight position. The value can
795
- * take 0 to -N, where 0 means highlighting the cell nearest the column header, -1
796
- * means the highlighting header starting from the header closest to the cells.
718
+ * @param {number} [headerLevel=-1] A row header index that triggers the column selection. The value can
719
+ * take -1 to -N, where -1 means the header closest to the cells.
720
+ *
797
721
  * @returns {boolean} Returns `true` if selection was successful, `false` otherwise.
798
722
  */
799
723
  }, {
800
724
  key: "selectColumns",
801
725
  value: function selectColumns(startColumn) {
802
726
  var endColumn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startColumn;
803
- var headerLevel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
727
+ var headerLevel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
804
728
  var start = typeof startColumn === 'string' ? this.tableProps.propToCol(startColumn) : startColumn;
805
729
  var end = typeof endColumn === 'string' ? this.tableProps.propToCol(endColumn) : endColumn;
806
- var countRows = this.tableProps.countRows();
807
- var countCols = this.tableProps.countCols();
808
- var countColHeaders = this.tableProps.countColHeaders();
809
- var columnHeaderLastIndex = countColHeaders === 0 ? 0 : -countColHeaders;
810
- var fromCoords = new CellCoords(columnHeaderLastIndex, start);
811
- var toCoords = new CellCoords(countRows - 1, end);
812
- var isValid = new CellRange(fromCoords, fromCoords, toCoords).isValid({
813
- countRows: countRows,
814
- countCols: countCols,
815
- countRowHeaders: 0,
816
- countColHeaders: countColHeaders
817
- });
730
+ var nrOfColumns = this.tableProps.countCols();
731
+ var nrOfRows = this.tableProps.countRows();
732
+ var isValid = isValidCoord(start, nrOfColumns) && isValidCoord(end, nrOfColumns);
818
733
  if (isValid) {
819
- var from = this.tableProps.createCellCoords(countColHeaders === 0 ? 0 : clamp(headerLevel, columnHeaderLastIndex, -1), start);
820
- var highlight = this.tableProps.createCellCoords(clamp(headerLevel, columnHeaderLastIndex, 0), start);
821
- this.setRangeStartOnly(from, void 0, highlight);
822
- this.selectedByColumnHeader.add(this.getLayerLevel());
823
- this.setRangeEnd(this.tableProps.createCellCoords(countRows - 1, end));
734
+ this.setRangeStartOnly(this.tableProps.createCellCoords(headerLevel, start));
735
+ this.setRangeEnd(this.tableProps.createCellCoords(nrOfRows - 1, end));
824
736
  this.finish();
825
737
  }
826
738
  return isValid;
@@ -831,34 +743,22 @@ var Selection = /*#__PURE__*/function () {
831
743
  *
832
744
  * @param {number} startRow Visual row index from which the selection starts.
833
745
  * @param {number} [endRow] Visual row index from to the selection finishes.
834
- * @param {number} [headerLevel=0] The header level allows changing the cell/header highlight position. The value can
835
- * take 0 to -N, where 0 means highlighting the cell nearest the row header, -1
836
- * means the highlighting header starting from the header closest to the cells.
746
+ * @param {number} [headerLevel=-1] A column header index that triggers the row selection.
747
+ * The value can take -1 to -N, where -1 means the header
748
+ * closest to the cells.
837
749
  * @returns {boolean} Returns `true` if selection was successful, `false` otherwise.
838
750
  */
839
751
  }, {
840
752
  key: "selectRows",
841
753
  value: function selectRows(startRow) {
842
754
  var endRow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startRow;
843
- var headerLevel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
844
- var countRows = this.tableProps.countRows();
845
- var countCols = this.tableProps.countCols();
846
- var countRowHeaders = this.tableProps.countRowHeaders();
847
- var rowHeaderLastIndex = countRowHeaders === 0 ? 0 : -countRowHeaders;
848
- var fromCoords = new CellCoords(startRow, rowHeaderLastIndex);
849
- var toCoords = new CellCoords(endRow, countCols - 1);
850
- var isValid = new CellRange(fromCoords, fromCoords, toCoords).isValid({
851
- countRows: countRows,
852
- countCols: countCols,
853
- countRowHeaders: countRowHeaders,
854
- countColHeaders: 0
855
- });
755
+ var headerLevel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
756
+ var nrOfRows = this.tableProps.countRows();
757
+ var nrOfColumns = this.tableProps.countCols();
758
+ var isValid = isValidCoord(startRow, nrOfRows) && isValidCoord(endRow, nrOfRows);
856
759
  if (isValid) {
857
- var from = this.tableProps.createCellCoords(startRow, countRowHeaders === 0 ? 0 : clamp(headerLevel, rowHeaderLastIndex, -1));
858
- var highlight = this.tableProps.createCellCoords(startRow, clamp(headerLevel, rowHeaderLastIndex, 0));
859
- this.setRangeStartOnly(from, void 0, highlight);
860
- this.selectedByRowHeader.add(this.getLayerLevel());
861
- this.setRangeEnd(this.tableProps.createCellCoords(endRow, countCols - 1));
760
+ this.setRangeStartOnly(this.tableProps.createCellCoords(startRow, headerLevel));
761
+ this.setRangeEnd(this.tableProps.createCellCoords(endRow, nrOfColumns - 1));
862
762
  this.finish();
863
763
  }
864
764
  return isValid;
@@ -877,31 +777,19 @@ var Selection = /*#__PURE__*/function () {
877
777
  if (!this.isSelected()) {
878
778
  return;
879
779
  }
880
- var focusHighlight = this.highlight.getFocus();
780
+ var cellHighlight = this.highlight.getCell();
881
781
  var currentLayer = this.getLayerLevel();
882
- focusHighlight.commit().syncWith(this.selectedRange.current());
782
+ cellHighlight.commit().syncWith(this.selectedRange.current());
883
783
 
884
784
  // Rewriting rendered ranges going through all layers.
885
785
  for (var layerLevel = 0; layerLevel < this.selectedRange.size(); layerLevel += 1) {
886
786
  this.highlight.useLayerLevel(layerLevel);
887
- var areaHighlight = this.highlight.createArea();
888
- var areaLayeredHighlight = this.highlight.createLayeredArea();
889
- var rowHeaderHighlight = this.highlight.createRowHeader();
890
- var columnHeaderHighlight = this.highlight.createColumnHeader();
891
- var activeRowHeaderHighlight = this.highlight.createActiveRowHeader();
892
- var activeColumnHeaderHighlight = this.highlight.createActiveColumnHeader();
893
- var activeCornerHeaderHighlight = this.highlight.createActiveCornerHeader();
894
- var rowHighlight = this.highlight.createRowHighlight();
895
- var columnHighlight = this.highlight.createColumnHighlight();
787
+ var areaHighlight = this.highlight.createOrGetArea();
788
+ var headerHighlight = this.highlight.createOrGetHeader();
789
+ var activeHeaderHighlight = this.highlight.createOrGetActiveHeader();
896
790
  areaHighlight.commit();
897
- areaLayeredHighlight.commit();
898
- rowHeaderHighlight.commit();
899
- columnHeaderHighlight.commit();
900
- activeRowHeaderHighlight.commit();
901
- activeColumnHeaderHighlight.commit();
902
- activeCornerHeaderHighlight.commit();
903
- rowHighlight.commit();
904
- columnHighlight.commit();
791
+ headerHighlight.commit();
792
+ activeHeaderHighlight.commit();
905
793
  }
906
794
 
907
795
  // Reverting starting layer for the Highlight.