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

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/{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,12 +1,10 @@
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
- import "core-js/modules/es.object.keys.js";
3
- import "core-js/modules/es.array.index-of.js";
4
- import "core-js/modules/es.symbol.js";
5
1
  import "core-js/modules/es.symbol.to-primitive.js";
6
2
  import "core-js/modules/es.date.to-primitive.js";
3
+ import "core-js/modules/es.symbol.js";
7
4
  import "core-js/modules/es.symbol.description.js";
8
5
  import "core-js/modules/es.object.to-string.js";
9
6
  import "core-js/modules/es.number.constructor.js";
7
+ import "core-js/modules/es.object.keys.js";
10
8
  import "core-js/modules/es.array.filter.js";
11
9
  import "core-js/modules/es.object.get-own-property-descriptor.js";
12
10
  import "core-js/modules/web.dom-collections.for-each.js";
@@ -15,31 +13,38 @@ import "core-js/modules/es.symbol.iterator.js";
15
13
  import "core-js/modules/es.array.iterator.js";
16
14
  import "core-js/modules/es.string.iterator.js";
17
15
  import "core-js/modules/web.dom-collections.iterator.js";
18
- var _excluded = ["rowClassName"];
16
+ 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); }
19
17
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
20
18
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
21
19
  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; }
22
20
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
23
21
  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); }
24
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
25
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
26
- import { HIGHLIGHT_ROW_TYPE } from "../../../3rdparty/walkontable/src/index.mjs";
27
- import VisualSelection from "../visualSelection.mjs";
22
+ import staticRegister from "./../../../utils/staticRegister.mjs";
23
+ import { ACTIVE_HEADER_TYPE, AREA_TYPE, CELL_TYPE, CUSTOM_SELECTION_TYPE, FILL_TYPE, HEADER_TYPE } from "../constants.mjs";
24
+ import activeHeaderHighlight from "./activeHeader.mjs";
25
+ import areaHighlight from "./area.mjs";
26
+ import cellHighlight from "./cell.mjs";
27
+ import customSelection from "./customSelection.mjs";
28
+ import fillHighlight from "./fill.mjs";
29
+ import headerHighlight from "./header.mjs";
30
+ var _staticRegister = staticRegister('highlight/types'),
31
+ register = _staticRegister.register,
32
+ getItem = _staticRegister.getItem;
33
+ register(ACTIVE_HEADER_TYPE, activeHeaderHighlight);
34
+ register(AREA_TYPE, areaHighlight);
35
+ register(CELL_TYPE, cellHighlight);
36
+ register(CUSTOM_SELECTION_TYPE, customSelection);
37
+ register(FILL_TYPE, fillHighlight);
38
+ register(HEADER_TYPE, headerHighlight);
39
+
28
40
  /**
29
- * Creates the new instance of Selection, responsible for highlighting cells in a rows and
30
- * row headers.
31
- * This type of selection can occur multiple times.
32
- *
33
- * @param {object} highlightParams A configuration object to create a highlight.
34
- * @param {string} highlightParams.rowClassName Highlighted row' class name.
41
+ * @param {string} highlightType The selection type.
42
+ * @param {object} options The selection options.
35
43
  * @returns {Selection}
36
44
  */
37
- export function createHighlight(_ref) {
38
- var rowClassName = _ref.rowClassName,
39
- restOptions = _objectWithoutProperties(_ref, _excluded);
40
- return new VisualSelection(_objectSpread(_objectSpread({
41
- className: rowClassName
42
- }, restOptions), {}, {
43
- selectionType: HIGHLIGHT_ROW_TYPE
44
- }));
45
- }
45
+ function createHighlight(highlightType, options) {
46
+ return getItem(highlightType)(_objectSpread({
47
+ type: highlightType
48
+ }, options));
49
+ }
50
+ export { createHighlight };
@@ -99,6 +99,10 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
99
99
  return null;
100
100
  }
101
101
  if (visibleFromCoords.row > visibleToCoords.row || visibleFromCoords.col > visibleToCoords.col) {
102
+ var isHeaderTypeSelection = this.settings.type === 'header' || this.settings.type === 'active-header';
103
+ if (!isHeaderTypeSelection) {
104
+ return null;
105
+ }
102
106
  visibleFromCoords = from;
103
107
  visibleToCoords = to;
104
108
  }
@@ -120,13 +124,13 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
120
124
  key: "getNearestNotHiddenCoords",
121
125
  value: function getNearestNotHiddenCoords(coords, rowSearchDirection) {
122
126
  var columnSearchDirection = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : rowSearchDirection;
123
- var nextVisibleRow = this.getNearestNotHiddenIndex(this.settings.rowIndexMapper, coords.row, rowSearchDirection);
127
+ var nextVisibleRow = this.getNearestNotHiddenIndex(this.settings.rowIndexMapper(), coords.row, rowSearchDirection);
124
128
 
125
129
  // There are no more visual rows in the range.
126
130
  if (nextVisibleRow === null) {
127
131
  return null;
128
132
  }
129
- var nextVisibleColumn = this.getNearestNotHiddenIndex(this.settings.columnIndexMapper, coords.col, columnSearchDirection);
133
+ var nextVisibleColumn = this.getNearestNotHiddenIndex(this.settings.columnIndexMapper(), coords.col, columnSearchDirection);
130
134
 
131
135
  // There are no more visual columns in the range.
132
136
  if (nextVisibleColumn === null) {
@@ -151,7 +155,12 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
151
155
  if (visualIndex < 0) {
152
156
  return visualIndex;
153
157
  }
154
- return indexMapper.getNearestNotHiddenIndex(visualIndex, searchDirection);
158
+ var nearestVisualIndex = indexMapper.getNearestNotHiddenIndex(visualIndex, searchDirection);
159
+ var isHeaderSelectionType = this.settings.type === 'header' || this.settings.type === 'active-header';
160
+ if (isHeaderSelectionType && nearestVisualIndex === null) {
161
+ return -1;
162
+ }
163
+ return nearestVisualIndex;
155
164
  }
156
165
 
157
166
  /**
@@ -192,29 +201,24 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
192
201
  }, {
193
202
  key: "syncWith",
194
203
  value: function syncWith(broaderCellRange) {
195
- var coordsFrom = broaderCellRange.from.clone().normalize();
196
204
  var rowDirection = broaderCellRange.getVerticalDirection() === 'N-S' ? 1 : -1;
197
205
  var columnDirection = broaderCellRange.getHorizontalDirection() === 'W-E' ? 1 : -1;
198
- var cellCoordsVisual = this.getNearestNotHiddenCoords(coordsFrom, rowDirection, columnDirection);
199
- if (cellCoordsVisual !== null && broaderCellRange.overlaps(cellCoordsVisual)) {
200
- var currentHighlight = broaderCellRange.highlight.clone();
201
- if (currentHighlight.row >= 0) {
202
- currentHighlight.row = cellCoordsVisual.row;
203
- }
204
- if (currentHighlight.col >= 0) {
205
- currentHighlight.col = cellCoordsVisual.col;
206
- }
207
-
208
- // We can't show selection visually now, but we found first visible range in the broader cell range.
206
+ var singleCellRangeVisual = this.getNearestNotHiddenCoords(broaderCellRange.from.clone().normalize(), rowDirection, columnDirection);
207
+ if (singleCellRangeVisual !== null && broaderCellRange.overlaps(singleCellRangeVisual)) {
208
+ // We can't show selection visually now, but we found fist visible range in the broader cell range.
209
209
  if (this.cellRange === null) {
210
- var cellCoordsRenderable = this.settings.visualToRenderableCoords(currentHighlight);
211
- this.cellRange = this.settings.createCellRange(cellCoordsRenderable);
210
+ var singleCellRangeRenderable = this.settings.visualToRenderableCoords(singleCellRangeVisual);
211
+ this.cellRange = this.settings.createCellRange(singleCellRangeRenderable);
212
212
  }
213
213
 
214
214
  // We set new highlight as it might change (for example, when showing/hiding some cells from the broader selection range)
215
215
  // TODO: It is also handled by the `MergeCells` plugin while adjusting already modified coordinates. Should it?
216
- broaderCellRange.setHighlight(currentHighlight);
216
+ broaderCellRange.setHighlight(singleCellRangeVisual);
217
+ return this;
217
218
  }
219
+
220
+ // Fallback to the start of the range. It resets the previous highlight (for example, when all columns have been hidden).
221
+ broaderCellRange.setHighlight(broaderCellRange.from);
218
222
  return this;
219
223
  }
220
224
 
@@ -232,7 +236,11 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
232
236
  var _this$cellRange = this.cellRange,
233
237
  from = _this$cellRange.from,
234
238
  to = _this$cellRange.to;
235
- return [Math.min(from.row, to.row), Math.min(from.col, to.col), Math.max(from.row, to.row), Math.max(from.col, to.col)];
239
+ var isRowUndefined = from.row === null || to.row === null;
240
+ var isColumnUndefined = from.col === null || to.col === null;
241
+ var topLeftCorner = this.settings.createCellCoords(isRowUndefined ? null : Math.min(from.row, to.row), isColumnUndefined ? null : Math.min(from.col, to.col));
242
+ var bottomRightCorner = this.settings.createCellCoords(isRowUndefined ? null : Math.max(from.row, to.row), isColumnUndefined ? null : Math.max(from.col, to.col));
243
+ return [topLeftCorner.row, topLeftCorner.col, bottomRightCorner.row, bottomRightCorner.col];
236
244
  }
237
245
 
238
246
  /**
@@ -257,16 +265,13 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
257
265
  * points to the beginning of the selection.
258
266
  * @param {CellCoords} visualToCoords The CellCoords object which contains coordinates that
259
267
  * points to the end of the selection.
260
- * @returns {CellRange|null}
268
+ * @returns {CellRange}
261
269
  */
262
270
  }, {
263
271
  key: "createRenderableCellRange",
264
272
  value: function createRenderableCellRange(visualFromCoords, visualToCoords) {
265
273
  var renderableFromCoords = this.settings.visualToRenderableCoords(visualFromCoords);
266
274
  var renderableToCoords = this.settings.visualToRenderableCoords(visualToCoords);
267
- if (renderableFromCoords.row === null || renderableFromCoords.col === null || renderableToCoords.row === null || renderableToCoords.col === null) {
268
- return null;
269
- }
270
275
  return this.settings.createCellRange(renderableFromCoords, renderableFromCoords, renderableToCoords);
271
276
  }
272
277
  }]);
@@ -95,6 +95,10 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
95
95
  return null;
96
96
  }
97
97
  if (visibleFromCoords.row > visibleToCoords.row || visibleFromCoords.col > visibleToCoords.col) {
98
+ var isHeaderTypeSelection = this.settings.type === 'header' || this.settings.type === 'active-header';
99
+ if (!isHeaderTypeSelection) {
100
+ return null;
101
+ }
98
102
  visibleFromCoords = from;
99
103
  visibleToCoords = to;
100
104
  }
@@ -116,13 +120,13 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
116
120
  key: "getNearestNotHiddenCoords",
117
121
  value: function getNearestNotHiddenCoords(coords, rowSearchDirection) {
118
122
  var columnSearchDirection = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : rowSearchDirection;
119
- var nextVisibleRow = this.getNearestNotHiddenIndex(this.settings.rowIndexMapper, coords.row, rowSearchDirection);
123
+ var nextVisibleRow = this.getNearestNotHiddenIndex(this.settings.rowIndexMapper(), coords.row, rowSearchDirection);
120
124
 
121
125
  // There are no more visual rows in the range.
122
126
  if (nextVisibleRow === null) {
123
127
  return null;
124
128
  }
125
- var nextVisibleColumn = this.getNearestNotHiddenIndex(this.settings.columnIndexMapper, coords.col, columnSearchDirection);
129
+ var nextVisibleColumn = this.getNearestNotHiddenIndex(this.settings.columnIndexMapper(), coords.col, columnSearchDirection);
126
130
 
127
131
  // There are no more visual columns in the range.
128
132
  if (nextVisibleColumn === null) {
@@ -147,7 +151,12 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
147
151
  if (visualIndex < 0) {
148
152
  return visualIndex;
149
153
  }
150
- return indexMapper.getNearestNotHiddenIndex(visualIndex, searchDirection);
154
+ var nearestVisualIndex = indexMapper.getNearestNotHiddenIndex(visualIndex, searchDirection);
155
+ var isHeaderSelectionType = this.settings.type === 'header' || this.settings.type === 'active-header';
156
+ if (isHeaderSelectionType && nearestVisualIndex === null) {
157
+ return -1;
158
+ }
159
+ return nearestVisualIndex;
151
160
  }
152
161
 
153
162
  /**
@@ -188,29 +197,24 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
188
197
  }, {
189
198
  key: "syncWith",
190
199
  value: function syncWith(broaderCellRange) {
191
- var coordsFrom = broaderCellRange.from.clone().normalize();
192
200
  var rowDirection = broaderCellRange.getVerticalDirection() === 'N-S' ? 1 : -1;
193
201
  var columnDirection = broaderCellRange.getHorizontalDirection() === 'W-E' ? 1 : -1;
194
- var cellCoordsVisual = this.getNearestNotHiddenCoords(coordsFrom, rowDirection, columnDirection);
195
- if (cellCoordsVisual !== null && broaderCellRange.overlaps(cellCoordsVisual)) {
196
- var currentHighlight = broaderCellRange.highlight.clone();
197
- if (currentHighlight.row >= 0) {
198
- currentHighlight.row = cellCoordsVisual.row;
199
- }
200
- if (currentHighlight.col >= 0) {
201
- currentHighlight.col = cellCoordsVisual.col;
202
- }
203
-
204
- // We can't show selection visually now, but we found first visible range in the broader cell range.
202
+ var singleCellRangeVisual = this.getNearestNotHiddenCoords(broaderCellRange.from.clone().normalize(), rowDirection, columnDirection);
203
+ if (singleCellRangeVisual !== null && broaderCellRange.overlaps(singleCellRangeVisual)) {
204
+ // We can't show selection visually now, but we found fist visible range in the broader cell range.
205
205
  if (this.cellRange === null) {
206
- var cellCoordsRenderable = this.settings.visualToRenderableCoords(currentHighlight);
207
- this.cellRange = this.settings.createCellRange(cellCoordsRenderable);
206
+ var singleCellRangeRenderable = this.settings.visualToRenderableCoords(singleCellRangeVisual);
207
+ this.cellRange = this.settings.createCellRange(singleCellRangeRenderable);
208
208
  }
209
209
 
210
210
  // We set new highlight as it might change (for example, when showing/hiding some cells from the broader selection range)
211
211
  // TODO: It is also handled by the `MergeCells` plugin while adjusting already modified coordinates. Should it?
212
- broaderCellRange.setHighlight(currentHighlight);
212
+ broaderCellRange.setHighlight(singleCellRangeVisual);
213
+ return this;
213
214
  }
215
+
216
+ // Fallback to the start of the range. It resets the previous highlight (for example, when all columns have been hidden).
217
+ broaderCellRange.setHighlight(broaderCellRange.from);
214
218
  return this;
215
219
  }
216
220
 
@@ -228,7 +232,11 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
228
232
  var _this$cellRange = this.cellRange,
229
233
  from = _this$cellRange.from,
230
234
  to = _this$cellRange.to;
231
- return [Math.min(from.row, to.row), Math.min(from.col, to.col), Math.max(from.row, to.row), Math.max(from.col, to.col)];
235
+ var isRowUndefined = from.row === null || to.row === null;
236
+ var isColumnUndefined = from.col === null || to.col === null;
237
+ var topLeftCorner = this.settings.createCellCoords(isRowUndefined ? null : Math.min(from.row, to.row), isColumnUndefined ? null : Math.min(from.col, to.col));
238
+ var bottomRightCorner = this.settings.createCellCoords(isRowUndefined ? null : Math.max(from.row, to.row), isColumnUndefined ? null : Math.max(from.col, to.col));
239
+ return [topLeftCorner.row, topLeftCorner.col, bottomRightCorner.row, bottomRightCorner.col];
232
240
  }
233
241
 
234
242
  /**
@@ -253,16 +261,13 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
253
261
  * points to the beginning of the selection.
254
262
  * @param {CellCoords} visualToCoords The CellCoords object which contains coordinates that
255
263
  * points to the end of the selection.
256
- * @returns {CellRange|null}
264
+ * @returns {CellRange}
257
265
  */
258
266
  }, {
259
267
  key: "createRenderableCellRange",
260
268
  value: function createRenderableCellRange(visualFromCoords, visualToCoords) {
261
269
  var renderableFromCoords = this.settings.visualToRenderableCoords(visualFromCoords);
262
270
  var renderableToCoords = this.settings.visualToRenderableCoords(visualToCoords);
263
- if (renderableFromCoords.row === null || renderableFromCoords.col === null || renderableToCoords.row === null || renderableToCoords.col === null) {
264
- return null;
265
- }
266
271
  return this.settings.createCellRange(renderableFromCoords, renderableFromCoords, renderableToCoords);
267
272
  }
268
273
  }]);
@@ -5,11 +5,14 @@ require("core-js/modules/web.dom-collections.for-each.js");
5
5
  require("core-js/modules/es.object.keys.js");
6
6
  exports.__esModule = true;
7
7
  var _exportNames = {
8
+ Highlight: true,
8
9
  Selection: true,
9
10
  handleMouseEvent: true,
10
11
  detectSelectionType: true,
11
12
  normalizeSelectionFactory: true
12
13
  };
14
+ var _highlight = _interopRequireDefault(require("./highlight/highlight"));
15
+ exports.Highlight = _highlight.default;
13
16
  var _selection = _interopRequireDefault(require("./selection"));
14
17
  exports.Selection = _selection.default;
15
18
  var _mouseEventHandler = require("./mouseEventHandler");
@@ -17,11 +20,11 @@ exports.handleMouseEvent = _mouseEventHandler.handleMouseEvent;
17
20
  var _utils = require("./utils");
18
21
  exports.detectSelectionType = _utils.detectSelectionType;
19
22
  exports.normalizeSelectionFactory = _utils.normalizeSelectionFactory;
20
- var _highlight = require("./highlight/highlight");
21
- Object.keys(_highlight).forEach(function (key) {
23
+ var _constants = require("./highlight/constants");
24
+ Object.keys(_constants).forEach(function (key) {
22
25
  if (key === "default" || key === "__esModule") return;
23
26
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
24
- if (key in exports && exports[key] === _highlight[key]) return;
25
- exports[key] = _highlight[key];
27
+ if (key in exports && exports[key] === _constants[key]) return;
28
+ exports[key] = _constants[key];
26
29
  });
27
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -1,5 +1,6 @@
1
+ import Highlight from "./highlight/highlight.mjs";
1
2
  import Selection from "./selection.mjs";
2
3
  import { handleMouseEvent } from "./mouseEventHandler.mjs";
3
4
  import { detectSelectionType, normalizeSelectionFactory } from "./utils.mjs";
4
- export * from "./highlight/highlight.mjs";
5
- export { handleMouseEvent, Selection, detectSelectionType, normalizeSelectionFactory };
5
+ export * from "./highlight/constants.mjs";
6
+ export { handleMouseEvent, Highlight, Selection, detectSelectionType, normalizeSelectionFactory };
@@ -68,7 +68,7 @@ function mouseDown(_ref) {
68
68
  selection.setRangeStart(coords);
69
69
  }
70
70
  } else if (coords.col < 0 && coords.row < 0) {
71
- selection.selectAll(coords.row, coords.col);
71
+ selection.selectAll(true, true);
72
72
  }
73
73
  }
74
74
  }
@@ -62,7 +62,7 @@ export function mouseDown(_ref) {
62
62
  selection.setRangeStart(coords);
63
63
  }
64
64
  } else if (coords.col < 0 && coords.row < 0) {
65
- selection.selectAll(coords.row, coords.col);
65
+ selection.selectAll(true, true);
66
66
  }
67
67
  }
68
68
  }
@@ -98,7 +98,7 @@ var SelectionRange = /*#__PURE__*/function (_Symbol$iterator) {
98
98
  }, {
99
99
  key: "current",
100
100
  value: function current() {
101
- return this.peekByIndex(this.size() - 1);
101
+ return this.peekByIndex(0);
102
102
  }
103
103
 
104
104
  /**
@@ -109,7 +109,7 @@ var SelectionRange = /*#__PURE__*/function (_Symbol$iterator) {
109
109
  }, {
110
110
  key: "previous",
111
111
  value: function previous() {
112
- return this.peekByIndex(this.size() - 2);
112
+ return this.peekByIndex(-1);
113
113
  }
114
114
 
115
115
  /**
@@ -151,19 +151,19 @@ var SelectionRange = /*#__PURE__*/function (_Symbol$iterator) {
151
151
  }
152
152
 
153
153
  /**
154
- * Peek the coordinates based on the index where that coordinate resides in the collection.
154
+ * Peek the coordinates based on the offset where that coordinate resides in the collection.
155
155
  *
156
- * @param {number} [index=0] An index where the coordinate will be retrieved from. The index '0' gets the
157
- * latest range.
156
+ * @param {number} [offset=0] An offset where the coordinate will be retrieved from.
158
157
  * @returns {CellRange|undefined}
159
158
  */
160
159
  }, {
161
160
  key: "peekByIndex",
162
161
  value: function peekByIndex() {
163
- var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
162
+ var offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
163
+ var rangeIndex = this.size() + offset - 1;
164
164
  var cellRange;
165
- if (index >= 0 && index < this.size()) {
166
- cellRange = this.ranges[index];
165
+ if (rangeIndex >= 0) {
166
+ cellRange = this.ranges[rangeIndex];
167
167
  }
168
168
  return cellRange;
169
169
  }
@@ -94,7 +94,7 @@ var SelectionRange = /*#__PURE__*/function (_Symbol$iterator) {
94
94
  }, {
95
95
  key: "current",
96
96
  value: function current() {
97
- return this.peekByIndex(this.size() - 1);
97
+ return this.peekByIndex(0);
98
98
  }
99
99
 
100
100
  /**
@@ -105,7 +105,7 @@ var SelectionRange = /*#__PURE__*/function (_Symbol$iterator) {
105
105
  }, {
106
106
  key: "previous",
107
107
  value: function previous() {
108
- return this.peekByIndex(this.size() - 2);
108
+ return this.peekByIndex(-1);
109
109
  }
110
110
 
111
111
  /**
@@ -147,19 +147,19 @@ var SelectionRange = /*#__PURE__*/function (_Symbol$iterator) {
147
147
  }
148
148
 
149
149
  /**
150
- * Peek the coordinates based on the index where that coordinate resides in the collection.
150
+ * Peek the coordinates based on the offset where that coordinate resides in the collection.
151
151
  *
152
- * @param {number} [index=0] An index where the coordinate will be retrieved from. The index '0' gets the
153
- * latest range.
152
+ * @param {number} [offset=0] An offset where the coordinate will be retrieved from.
154
153
  * @returns {CellRange|undefined}
155
154
  */
156
155
  }, {
157
156
  key: "peekByIndex",
158
157
  value: function peekByIndex() {
159
- var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
158
+ var offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
159
+ var rangeIndex = this.size() + offset - 1;
160
160
  var cellRange;
161
- if (index >= 0 && index < this.size()) {
162
- cellRange = this.ranges[index];
161
+ if (rangeIndex >= 0) {
162
+ cellRange = this.ranges[rangeIndex];
163
163
  }
164
164
  return cellRange;
165
165
  }