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

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

Potentially problematic release.


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

Files changed (216) hide show
  1. package/3rdparty/walkontable/src/cell/coords.d.ts +6 -1
  2. package/3rdparty/walkontable/src/cell/coords.js +61 -12
  3. package/3rdparty/walkontable/src/cell/coords.mjs +61 -12
  4. package/3rdparty/walkontable/src/cell/range.d.ts +9 -2
  5. package/3rdparty/walkontable/src/cell/range.js +44 -7
  6. package/3rdparty/walkontable/src/cell/range.mjs +44 -7
  7. package/3rdparty/walkontable/src/core/_base.js +9 -3
  8. package/3rdparty/walkontable/src/core/_base.mjs +9 -3
  9. package/3rdparty/walkontable/src/core/clone.js +2 -2
  10. package/3rdparty/walkontable/src/core/clone.mjs +2 -2
  11. package/3rdparty/walkontable/src/core/core.js +3 -2
  12. package/3rdparty/walkontable/src/core/core.mjs +3 -2
  13. package/3rdparty/walkontable/src/event.js +7 -7
  14. package/3rdparty/walkontable/src/event.mjs +7 -7
  15. package/3rdparty/walkontable/src/facade/core.js +2 -2
  16. package/3rdparty/walkontable/src/facade/core.mjs +2 -2
  17. package/3rdparty/walkontable/src/index.js +10 -2
  18. package/3rdparty/walkontable/src/index.mjs +2 -2
  19. package/3rdparty/walkontable/src/overlay/_base.js +1 -1
  20. package/3rdparty/walkontable/src/overlay/_base.mjs +1 -1
  21. package/3rdparty/walkontable/src/overlay/inlineStart.js +2 -4
  22. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +2 -4
  23. package/3rdparty/walkontable/src/overlay/top.js +2 -4
  24. package/3rdparty/walkontable/src/overlay/top.mjs +2 -4
  25. package/3rdparty/walkontable/src/{border.js → selection/border/border.js} +7 -12
  26. package/3rdparty/walkontable/src/{border.mjs → selection/border/border.mjs} +7 -12
  27. package/3rdparty/walkontable/src/selection/border/constants.js +18 -0
  28. package/3rdparty/walkontable/src/selection/border/constants.mjs +13 -0
  29. package/3rdparty/walkontable/src/selection/constants.js +63 -0
  30. package/3rdparty/walkontable/src/selection/constants.mjs +51 -0
  31. package/3rdparty/walkontable/src/selection/index.js +30 -0
  32. package/3rdparty/walkontable/src/selection/index.mjs +5 -0
  33. package/3rdparty/walkontable/src/selection/manager.js +328 -0
  34. package/3rdparty/walkontable/src/selection/manager.mjs +322 -0
  35. package/3rdparty/walkontable/src/selection/scanner.js +363 -0
  36. package/3rdparty/walkontable/src/selection/scanner.mjs +359 -0
  37. package/3rdparty/walkontable/src/selection/selection.js +133 -0
  38. package/3rdparty/walkontable/src/selection/selection.mjs +127 -0
  39. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +9 -0
  40. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +9 -0
  41. package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +9 -0
  42. package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +9 -0
  43. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +9 -0
  44. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +9 -0
  45. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +9 -0
  46. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +9 -0
  47. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +9 -0
  48. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +9 -0
  49. package/3rdparty/walkontable/src/table.js +7 -79
  50. package/3rdparty/walkontable/src/table.mjs +8 -80
  51. package/base.js +2 -2
  52. package/base.mjs +2 -2
  53. package/core.d.ts +5 -3
  54. package/core.js +82 -300
  55. package/core.mjs +82 -300
  56. package/dataMap/metaManager/metaSchema.js +15 -0
  57. package/dataMap/metaManager/metaSchema.mjs +15 -0
  58. package/dist/handsontable.css +8 -3
  59. package/dist/handsontable.full.css +8 -3
  60. package/dist/handsontable.full.js +12245 -9953
  61. package/dist/handsontable.full.min.css +3 -3
  62. package/dist/handsontable.full.min.js +120 -120
  63. package/dist/handsontable.js +15898 -13606
  64. package/dist/handsontable.min.css +3 -3
  65. package/dist/handsontable.min.js +4 -4
  66. package/editorManager.js +20 -82
  67. package/editorManager.mjs +25 -86
  68. package/editors/textEditor/textEditor.js +3 -11
  69. package/editors/textEditor/textEditor.mjs +4 -12
  70. package/helpers/mixed.js +1 -1
  71. package/helpers/mixed.mjs +1 -1
  72. package/helpers/number.d.ts +1 -0
  73. package/helpers/number.js +18 -0
  74. package/helpers/number.mjs +17 -0
  75. package/package.json +1 -1
  76. package/pluginHooks.js +1 -1
  77. package/pluginHooks.mjs +1 -1
  78. package/plugins/copyPaste/copyPaste.js +5 -1
  79. package/plugins/copyPaste/copyPaste.mjs +5 -1
  80. package/plugins/customBorders/customBorders.js +18 -52
  81. package/plugins/customBorders/customBorders.mjs +19 -53
  82. package/plugins/mergeCells/mergeCells.js +5 -18
  83. package/plugins/mergeCells/mergeCells.mjs +5 -18
  84. package/plugins/nestedHeaders/nestedHeaders.js +89 -9
  85. package/plugins/nestedHeaders/nestedHeaders.mjs +89 -9
  86. package/plugins/nestedHeaders/stateManager/index.js +37 -0
  87. package/plugins/nestedHeaders/stateManager/index.mjs +37 -0
  88. package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
  89. package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
  90. package/selection/highlight/highlight.js +311 -88
  91. package/selection/highlight/highlight.mjs +301 -84
  92. package/selection/highlight/types/activeHeader.js +10 -9
  93. package/selection/highlight/types/activeHeader.mjs +10 -8
  94. package/selection/highlight/types/area.js +12 -27
  95. package/selection/highlight/types/area.mjs +16 -30
  96. package/selection/highlight/types/areaLayered.js +54 -0
  97. package/selection/highlight/types/areaLayered.mjs +49 -0
  98. package/selection/highlight/types/column.js +50 -0
  99. package/selection/highlight/types/column.mjs +45 -0
  100. package/selection/highlight/types/customSelection.js +7 -10
  101. package/selection/highlight/types/customSelection.mjs +7 -9
  102. package/selection/highlight/types/fill.js +5 -8
  103. package/selection/highlight/types/fill.mjs +5 -7
  104. package/selection/highlight/types/{cell.js → focus.js} +5 -8
  105. package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
  106. package/selection/highlight/types/header.js +10 -20
  107. package/selection/highlight/types/header.mjs +10 -19
  108. package/selection/highlight/types/{index.js → row.js} +27 -31
  109. package/selection/highlight/types/{index.mjs → row.mjs} +24 -29
  110. package/selection/highlight/visualSelection.js +23 -28
  111. package/selection/highlight/visualSelection.mjs +23 -28
  112. package/selection/index.js +4 -7
  113. package/selection/index.mjs +2 -3
  114. package/selection/mouseEventHandler.js +1 -1
  115. package/selection/mouseEventHandler.mjs +1 -1
  116. package/selection/range.js +8 -8
  117. package/selection/range.mjs +8 -8
  118. package/selection/selection.js +296 -180
  119. package/selection/selection.mjs +291 -179
  120. package/selection/transformation.js +233 -96
  121. package/selection/transformation.mjs +230 -93
  122. package/selection/utils.js +12 -35
  123. package/selection/utils.mjs +13 -35
  124. package/settings.d.ts +1 -0
  125. package/shortcutContexts/commands/editor/closeAndSave.js +15 -0
  126. package/shortcutContexts/commands/editor/closeAndSave.mjs +10 -0
  127. package/shortcutContexts/commands/editor/closeWithoutSaving.js +13 -0
  128. package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +8 -0
  129. package/shortcutContexts/commands/editor/fastOpen.js +16 -0
  130. package/shortcutContexts/commands/editor/fastOpen.mjs +11 -0
  131. package/shortcutContexts/commands/editor/index.js +16 -0
  132. package/shortcutContexts/commands/editor/index.mjs +12 -0
  133. package/shortcutContexts/commands/editor/open.js +29 -0
  134. package/shortcutContexts/commands/editor/open.mjs +24 -0
  135. package/shortcutContexts/commands/emptySelectedCells.js +12 -0
  136. package/shortcutContexts/commands/emptySelectedCells.mjs +7 -0
  137. package/shortcutContexts/commands/extendCellsSelection/down.js +15 -0
  138. package/shortcutContexts/commands/extendCellsSelection/down.mjs +10 -0
  139. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +21 -0
  140. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +16 -0
  141. package/shortcutContexts/commands/extendCellsSelection/index.js +24 -0
  142. package/shortcutContexts/commands/extendCellsSelection/index.mjs +20 -0
  143. package/shortcutContexts/commands/extendCellsSelection/left.js +15 -0
  144. package/shortcutContexts/commands/extendCellsSelection/left.mjs +10 -0
  145. package/shortcutContexts/commands/extendCellsSelection/right.js +15 -0
  146. package/shortcutContexts/commands/extendCellsSelection/right.mjs +10 -0
  147. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +22 -0
  148. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +17 -0
  149. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +17 -0
  150. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +12 -0
  151. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +17 -0
  152. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +12 -0
  153. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +39 -0
  154. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +34 -0
  155. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +39 -0
  156. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +34 -0
  157. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +22 -0
  158. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +17 -0
  159. package/shortcutContexts/commands/extendCellsSelection/up.js +15 -0
  160. package/shortcutContexts/commands/extendCellsSelection/up.mjs +10 -0
  161. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +21 -0
  162. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +16 -0
  163. package/shortcutContexts/commands/index.js +51 -0
  164. package/shortcutContexts/commands/index.mjs +47 -0
  165. package/shortcutContexts/commands/moveCellSelection/down.js +12 -0
  166. package/shortcutContexts/commands/moveCellSelection/down.mjs +7 -0
  167. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +11 -0
  168. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +6 -0
  169. package/shortcutContexts/commands/moveCellSelection/index.js +28 -0
  170. package/shortcutContexts/commands/moveCellSelection/index.mjs +24 -0
  171. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +13 -0
  172. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -0
  173. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +13 -0
  174. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -0
  175. package/shortcutContexts/commands/moveCellSelection/left.js +11 -0
  176. package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -0
  177. package/shortcutContexts/commands/moveCellSelection/right.js +11 -0
  178. package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -0
  179. package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +16 -0
  180. package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +11 -0
  181. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +17 -0
  182. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +12 -0
  183. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +13 -0
  184. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +8 -0
  185. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +16 -0
  186. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +11 -0
  187. package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +35 -0
  188. package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +30 -0
  189. package/shortcutContexts/commands/moveCellSelection/toMostRight.js +35 -0
  190. package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +30 -0
  191. package/shortcutContexts/commands/moveCellSelection/toMostTop.js +16 -0
  192. package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +11 -0
  193. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +18 -0
  194. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +13 -0
  195. package/shortcutContexts/commands/moveCellSelection/up.js +12 -0
  196. package/shortcutContexts/commands/moveCellSelection/up.mjs +7 -0
  197. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +11 -0
  198. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +6 -0
  199. package/shortcutContexts/commands/populateSelectedCellsData.js +35 -0
  200. package/shortcutContexts/commands/populateSelectedCellsData.mjs +30 -0
  201. package/shortcutContexts/commands/selectAll.js +11 -0
  202. package/shortcutContexts/commands/selectAll.mjs +6 -0
  203. package/shortcutContexts/constants.js +19 -0
  204. package/shortcutContexts/constants.mjs +12 -0
  205. package/shortcutContexts/editor.js +29 -0
  206. package/shortcutContexts/editor.mjs +25 -0
  207. package/shortcutContexts/grid.js +232 -0
  208. package/shortcutContexts/grid.mjs +228 -0
  209. package/shortcutContexts/index.js +29 -0
  210. package/shortcutContexts/index.mjs +15 -0
  211. package/tableView.js +58 -9
  212. package/tableView.mjs +58 -9
  213. package/3rdparty/walkontable/src/selection.js +0 -354
  214. package/3rdparty/walkontable/src/selection.mjs +0 -348
  215. package/selection/highlight/constants.js +0 -16
  216. package/selection/highlight/constants.mjs +0 -6
@@ -15,7 +15,7 @@ import "core-js/modules/es.symbol.iterator.js";
15
15
  import "core-js/modules/es.array.iterator.js";
16
16
  import "core-js/modules/es.string.iterator.js";
17
17
  import "core-js/modules/web.dom-collections.iterator.js";
18
- var _excluded = ["headerClassName", "rowClassName", "columnClassName"];
18
+ var _excluded = ["headerClassName"];
19
19
  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
20
  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
21
  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; }
@@ -23,32 +23,23 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
23
23
  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
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
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 { HEADER_TYPE } from "../constants.mjs";
26
+ import { HIGHLIGHT_HEADER_TYPE } from "../../../3rdparty/walkontable/src/index.mjs";
27
27
  import VisualSelection from "../visualSelection.mjs";
28
28
  /**
29
- * Creates the new instance of Selection, responsible for highlighting row and column headers. This type of selection
30
- * can occur multiple times.
29
+ * Creates the new instance of Selection, responsible for highlighting column or row headers when
30
+ * any cell is selected.
31
+ * This type of selection can occur multiple times.
31
32
  *
32
33
  * @param {object} highlightParams A configuration object to create a highlight.
33
34
  * @param {string} highlightParams.headerClassName Highlighted headers' class name.
34
- * @param {string} highlightParams.rowClassName Highlighted row' class name.
35
- * @param {string} highlightParams.columnClassName Highlighted column' class name.
36
35
  * @returns {Selection}
37
36
  */
38
- function createHighlight(_ref) {
37
+ export function createHighlight(_ref) {
39
38
  var headerClassName = _ref.headerClassName,
40
- rowClassName = _ref.rowClassName,
41
- columnClassName = _ref.columnClassName,
42
39
  restOptions = _objectWithoutProperties(_ref, _excluded);
43
- var s = new VisualSelection(_objectSpread(_objectSpread({
44
- className: 'highlight',
45
- highlightHeaderClassName: headerClassName,
46
- highlightRowClassName: rowClassName,
47
- highlightColumnClassName: columnClassName
40
+ return new VisualSelection(_objectSpread(_objectSpread({
41
+ className: headerClassName
48
42
  }, restOptions), {}, {
49
- highlightOnlyClosestHeader: true,
50
- selectionType: HEADER_TYPE
43
+ selectionType: HIGHLIGHT_HEADER_TYPE
51
44
  }));
52
- return s;
53
- }
54
- export default createHighlight;
45
+ }
@@ -1,6 +1,14 @@
1
1
  "use strict";
2
2
 
3
+ 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); }
3
4
  require("core-js/modules/es.object.keys.js");
5
+ require("core-js/modules/es.array.index-of.js");
6
+ require("core-js/modules/es.symbol.js");
7
+ require("core-js/modules/es.symbol.to-primitive.js");
8
+ require("core-js/modules/es.date.to-primitive.js");
9
+ require("core-js/modules/es.symbol.description.js");
10
+ require("core-js/modules/es.object.to-string.js");
11
+ require("core-js/modules/es.number.constructor.js");
4
12
  require("core-js/modules/es.array.filter.js");
5
13
  require("core-js/modules/es.object.get-own-property-descriptor.js");
6
14
  require("core-js/modules/web.dom-collections.for-each.js");
@@ -11,44 +19,32 @@ require("core-js/modules/es.string.iterator.js");
11
19
  require("core-js/modules/web.dom-collections.iterator.js");
12
20
  exports.__esModule = true;
13
21
  exports.createHighlight = createHighlight;
14
- require("core-js/modules/es.symbol.to-primitive.js");
15
- require("core-js/modules/es.date.to-primitive.js");
16
- require("core-js/modules/es.symbol.js");
17
- require("core-js/modules/es.symbol.description.js");
18
- require("core-js/modules/es.object.to-string.js");
19
- require("core-js/modules/es.number.constructor.js");
20
- var _staticRegister2 = _interopRequireDefault(require("./../../../utils/staticRegister"));
21
- var _constants = require("../constants");
22
- var _activeHeader = _interopRequireDefault(require("./activeHeader"));
23
- var _area = _interopRequireDefault(require("./area"));
24
- var _cell = _interopRequireDefault(require("./cell"));
25
- var _customSelection = _interopRequireDefault(require("./customSelection"));
26
- var _fill = _interopRequireDefault(require("./fill"));
27
- var _header = _interopRequireDefault(require("./header"));
22
+ var _src = require("../../../3rdparty/walkontable/src");
23
+ var _visualSelection = _interopRequireDefault(require("../visualSelection"));
24
+ var _excluded = ["rowClassName"];
28
25
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
- 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); }
30
26
  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; }
31
27
  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; }
32
28
  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; }
33
29
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
34
30
  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); }
35
- var _staticRegister = (0, _staticRegister2.default)('highlight/types'),
36
- register = _staticRegister.register,
37
- getItem = _staticRegister.getItem;
38
- register(_constants.ACTIVE_HEADER_TYPE, _activeHeader.default);
39
- register(_constants.AREA_TYPE, _area.default);
40
- register(_constants.CELL_TYPE, _cell.default);
41
- register(_constants.CUSTOM_SELECTION_TYPE, _customSelection.default);
42
- register(_constants.FILL_TYPE, _fill.default);
43
- register(_constants.HEADER_TYPE, _header.default);
44
-
31
+ 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; }
32
+ 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; }
45
33
  /**
46
- * @param {string} highlightType The selection type.
47
- * @param {object} options The selection options.
34
+ * Creates the new instance of Selection, responsible for highlighting cells in a rows and
35
+ * row headers.
36
+ * This type of selection can occur multiple times.
37
+ *
38
+ * @param {object} highlightParams A configuration object to create a highlight.
39
+ * @param {string} highlightParams.rowClassName Highlighted row' class name.
48
40
  * @returns {Selection}
49
41
  */
50
- function createHighlight(highlightType, options) {
51
- return getItem(highlightType)(_objectSpread({
52
- type: highlightType
53
- }, options));
42
+ function createHighlight(_ref) {
43
+ var rowClassName = _ref.rowClassName,
44
+ restOptions = _objectWithoutProperties(_ref, _excluded);
45
+ return new _visualSelection.default(_objectSpread(_objectSpread({
46
+ className: rowClassName
47
+ }, restOptions), {}, {
48
+ selectionType: _src.HIGHLIGHT_ROW_TYPE
49
+ }));
54
50
  }
@@ -1,10 +1,12 @@
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";
1
5
  import "core-js/modules/es.symbol.to-primitive.js";
2
6
  import "core-js/modules/es.date.to-primitive.js";
3
- import "core-js/modules/es.symbol.js";
4
7
  import "core-js/modules/es.symbol.description.js";
5
8
  import "core-js/modules/es.object.to-string.js";
6
9
  import "core-js/modules/es.number.constructor.js";
7
- import "core-js/modules/es.object.keys.js";
8
10
  import "core-js/modules/es.array.filter.js";
9
11
  import "core-js/modules/es.object.get-own-property-descriptor.js";
10
12
  import "core-js/modules/web.dom-collections.for-each.js";
@@ -13,38 +15,31 @@ import "core-js/modules/es.symbol.iterator.js";
13
15
  import "core-js/modules/es.array.iterator.js";
14
16
  import "core-js/modules/es.string.iterator.js";
15
17
  import "core-js/modules/web.dom-collections.iterator.js";
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); }
18
+ var _excluded = ["rowClassName"];
17
19
  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; }
18
20
  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; }
19
21
  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; }
20
22
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
21
23
  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); }
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
-
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";
40
28
  /**
41
- * @param {string} highlightType The selection type.
42
- * @param {object} options The selection options.
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.
43
35
  * @returns {Selection}
44
36
  */
45
- function createHighlight(highlightType, options) {
46
- return getItem(highlightType)(_objectSpread({
47
- type: highlightType
48
- }, options));
49
- }
50
- export { createHighlight };
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
+ }
@@ -99,10 +99,6 @@ 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
- }
106
102
  visibleFromCoords = from;
107
103
  visibleToCoords = to;
108
104
  }
@@ -124,13 +120,13 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
124
120
  key: "getNearestNotHiddenCoords",
125
121
  value: function getNearestNotHiddenCoords(coords, rowSearchDirection) {
126
122
  var columnSearchDirection = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : rowSearchDirection;
127
- var nextVisibleRow = this.getNearestNotHiddenIndex(this.settings.rowIndexMapper(), coords.row, rowSearchDirection);
123
+ var nextVisibleRow = this.getNearestNotHiddenIndex(this.settings.rowIndexMapper, coords.row, rowSearchDirection);
128
124
 
129
125
  // There are no more visual rows in the range.
130
126
  if (nextVisibleRow === null) {
131
127
  return null;
132
128
  }
133
- var nextVisibleColumn = this.getNearestNotHiddenIndex(this.settings.columnIndexMapper(), coords.col, columnSearchDirection);
129
+ var nextVisibleColumn = this.getNearestNotHiddenIndex(this.settings.columnIndexMapper, coords.col, columnSearchDirection);
134
130
 
135
131
  // There are no more visual columns in the range.
136
132
  if (nextVisibleColumn === null) {
@@ -155,12 +151,7 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
155
151
  if (visualIndex < 0) {
156
152
  return visualIndex;
157
153
  }
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;
154
+ return indexMapper.getNearestNotHiddenIndex(visualIndex, searchDirection);
164
155
  }
165
156
 
166
157
  /**
@@ -201,24 +192,29 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
201
192
  }, {
202
193
  key: "syncWith",
203
194
  value: function syncWith(broaderCellRange) {
195
+ var coordsFrom = broaderCellRange.from.clone().normalize();
204
196
  var rowDirection = broaderCellRange.getVerticalDirection() === 'N-S' ? 1 : -1;
205
197
  var columnDirection = broaderCellRange.getHorizontalDirection() === 'W-E' ? 1 : -1;
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.
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.
209
209
  if (this.cellRange === null) {
210
- var singleCellRangeRenderable = this.settings.visualToRenderableCoords(singleCellRangeVisual);
211
- this.cellRange = this.settings.createCellRange(singleCellRangeRenderable);
210
+ var cellCoordsRenderable = this.settings.visualToRenderableCoords(currentHighlight);
211
+ this.cellRange = this.settings.createCellRange(cellCoordsRenderable);
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(singleCellRangeVisual);
217
- return this;
216
+ broaderCellRange.setHighlight(currentHighlight);
218
217
  }
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);
222
218
  return this;
223
219
  }
224
220
 
@@ -236,11 +232,7 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
236
232
  var _this$cellRange = this.cellRange,
237
233
  from = _this$cellRange.from,
238
234
  to = _this$cellRange.to;
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];
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)];
244
236
  }
245
237
 
246
238
  /**
@@ -265,13 +257,16 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
265
257
  * points to the beginning of the selection.
266
258
  * @param {CellCoords} visualToCoords The CellCoords object which contains coordinates that
267
259
  * points to the end of the selection.
268
- * @returns {CellRange}
260
+ * @returns {CellRange|null}
269
261
  */
270
262
  }, {
271
263
  key: "createRenderableCellRange",
272
264
  value: function createRenderableCellRange(visualFromCoords, visualToCoords) {
273
265
  var renderableFromCoords = this.settings.visualToRenderableCoords(visualFromCoords);
274
266
  var renderableToCoords = this.settings.visualToRenderableCoords(visualToCoords);
267
+ if (renderableFromCoords.row === null || renderableFromCoords.col === null || renderableToCoords.row === null || renderableToCoords.col === null) {
268
+ return null;
269
+ }
275
270
  return this.settings.createCellRange(renderableFromCoords, renderableFromCoords, renderableToCoords);
276
271
  }
277
272
  }]);
@@ -95,10 +95,6 @@ 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
- }
102
98
  visibleFromCoords = from;
103
99
  visibleToCoords = to;
104
100
  }
@@ -120,13 +116,13 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
120
116
  key: "getNearestNotHiddenCoords",
121
117
  value: function getNearestNotHiddenCoords(coords, rowSearchDirection) {
122
118
  var columnSearchDirection = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : rowSearchDirection;
123
- var nextVisibleRow = this.getNearestNotHiddenIndex(this.settings.rowIndexMapper(), coords.row, rowSearchDirection);
119
+ var nextVisibleRow = this.getNearestNotHiddenIndex(this.settings.rowIndexMapper, coords.row, rowSearchDirection);
124
120
 
125
121
  // There are no more visual rows in the range.
126
122
  if (nextVisibleRow === null) {
127
123
  return null;
128
124
  }
129
- var nextVisibleColumn = this.getNearestNotHiddenIndex(this.settings.columnIndexMapper(), coords.col, columnSearchDirection);
125
+ var nextVisibleColumn = this.getNearestNotHiddenIndex(this.settings.columnIndexMapper, coords.col, columnSearchDirection);
130
126
 
131
127
  // There are no more visual columns in the range.
132
128
  if (nextVisibleColumn === null) {
@@ -151,12 +147,7 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
151
147
  if (visualIndex < 0) {
152
148
  return visualIndex;
153
149
  }
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;
150
+ return indexMapper.getNearestNotHiddenIndex(visualIndex, searchDirection);
160
151
  }
161
152
 
162
153
  /**
@@ -197,24 +188,29 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
197
188
  }, {
198
189
  key: "syncWith",
199
190
  value: function syncWith(broaderCellRange) {
191
+ var coordsFrom = broaderCellRange.from.clone().normalize();
200
192
  var rowDirection = broaderCellRange.getVerticalDirection() === 'N-S' ? 1 : -1;
201
193
  var columnDirection = broaderCellRange.getHorizontalDirection() === 'W-E' ? 1 : -1;
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.
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.
205
205
  if (this.cellRange === null) {
206
- var singleCellRangeRenderable = this.settings.visualToRenderableCoords(singleCellRangeVisual);
207
- this.cellRange = this.settings.createCellRange(singleCellRangeRenderable);
206
+ var cellCoordsRenderable = this.settings.visualToRenderableCoords(currentHighlight);
207
+ this.cellRange = this.settings.createCellRange(cellCoordsRenderable);
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(singleCellRangeVisual);
213
- return this;
212
+ broaderCellRange.setHighlight(currentHighlight);
214
213
  }
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);
218
214
  return this;
219
215
  }
220
216
 
@@ -232,11 +228,7 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
232
228
  var _this$cellRange = this.cellRange,
233
229
  from = _this$cellRange.from,
234
230
  to = _this$cellRange.to;
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];
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)];
240
232
  }
241
233
 
242
234
  /**
@@ -261,13 +253,16 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
261
253
  * points to the beginning of the selection.
262
254
  * @param {CellCoords} visualToCoords The CellCoords object which contains coordinates that
263
255
  * points to the end of the selection.
264
- * @returns {CellRange}
256
+ * @returns {CellRange|null}
265
257
  */
266
258
  }, {
267
259
  key: "createRenderableCellRange",
268
260
  value: function createRenderableCellRange(visualFromCoords, visualToCoords) {
269
261
  var renderableFromCoords = this.settings.visualToRenderableCoords(visualFromCoords);
270
262
  var renderableToCoords = this.settings.visualToRenderableCoords(visualToCoords);
263
+ if (renderableFromCoords.row === null || renderableFromCoords.col === null || renderableToCoords.row === null || renderableToCoords.col === null) {
264
+ return null;
265
+ }
271
266
  return this.settings.createCellRange(renderableFromCoords, renderableFromCoords, renderableToCoords);
272
267
  }
273
268
  }]);
@@ -5,14 +5,11 @@ 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,
9
8
  Selection: true,
10
9
  handleMouseEvent: true,
11
10
  detectSelectionType: true,
12
11
  normalizeSelectionFactory: true
13
12
  };
14
- var _highlight = _interopRequireDefault(require("./highlight/highlight"));
15
- exports.Highlight = _highlight.default;
16
13
  var _selection = _interopRequireDefault(require("./selection"));
17
14
  exports.Selection = _selection.default;
18
15
  var _mouseEventHandler = require("./mouseEventHandler");
@@ -20,11 +17,11 @@ exports.handleMouseEvent = _mouseEventHandler.handleMouseEvent;
20
17
  var _utils = require("./utils");
21
18
  exports.detectSelectionType = _utils.detectSelectionType;
22
19
  exports.normalizeSelectionFactory = _utils.normalizeSelectionFactory;
23
- var _constants = require("./highlight/constants");
24
- Object.keys(_constants).forEach(function (key) {
20
+ var _highlight = require("./highlight/highlight");
21
+ Object.keys(_highlight).forEach(function (key) {
25
22
  if (key === "default" || key === "__esModule") return;
26
23
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
27
- if (key in exports && exports[key] === _constants[key]) return;
28
- exports[key] = _constants[key];
24
+ if (key in exports && exports[key] === _highlight[key]) return;
25
+ exports[key] = _highlight[key];
29
26
  });
30
27
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -1,6 +1,5 @@
1
- import Highlight from "./highlight/highlight.mjs";
2
1
  import Selection from "./selection.mjs";
3
2
  import { handleMouseEvent } from "./mouseEventHandler.mjs";
4
3
  import { detectSelectionType, normalizeSelectionFactory } from "./utils.mjs";
5
- export * from "./highlight/constants.mjs";
6
- export { handleMouseEvent, Highlight, Selection, detectSelectionType, normalizeSelectionFactory };
4
+ export * from "./highlight/highlight.mjs";
5
+ export { handleMouseEvent, 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(true, true);
71
+ selection.selectAll(coords.row, coords.col);
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(true, true);
65
+ selection.selectAll(coords.row, coords.col);
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(0);
101
+ return this.peekByIndex(this.size() - 1);
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(-1);
112
+ return this.peekByIndex(this.size() - 2);
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 offset where that coordinate resides in the collection.
154
+ * Peek the coordinates based on the index where that coordinate resides in the collection.
155
155
  *
156
- * @param {number} [offset=0] An offset where the coordinate will be retrieved from.
156
+ * @param {number} [index=0] An index where the coordinate will be retrieved from. The index '0' gets the
157
+ * latest range.
157
158
  * @returns {CellRange|undefined}
158
159
  */
159
160
  }, {
160
161
  key: "peekByIndex",
161
162
  value: function peekByIndex() {
162
- var offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
163
- var rangeIndex = this.size() + offset - 1;
163
+ var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
164
164
  var cellRange;
165
- if (rangeIndex >= 0) {
166
- cellRange = this.ranges[rangeIndex];
165
+ if (index >= 0 && index < this.size()) {
166
+ cellRange = this.ranges[index];
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(0);
97
+ return this.peekByIndex(this.size() - 1);
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(-1);
108
+ return this.peekByIndex(this.size() - 2);
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 offset where that coordinate resides in the collection.
150
+ * Peek the coordinates based on the index where that coordinate resides in the collection.
151
151
  *
152
- * @param {number} [offset=0] An offset where the coordinate will be retrieved from.
152
+ * @param {number} [index=0] An index where the coordinate will be retrieved from. The index '0' gets the
153
+ * latest range.
153
154
  * @returns {CellRange|undefined}
154
155
  */
155
156
  }, {
156
157
  key: "peekByIndex",
157
158
  value: function peekByIndex() {
158
- var offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
159
- var rangeIndex = this.size() + offset - 1;
159
+ var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
160
160
  var cellRange;
161
- if (rangeIndex >= 0) {
162
- cellRange = this.ranges[rangeIndex];
161
+ if (index >= 0 && index < this.size()) {
162
+ cellRange = this.ranges[index];
163
163
  }
164
164
  return cellRange;
165
165
  }