handsontable 0.0.0-next-af5139c-20230620 → 0.0.0-next-06a64be-20230621

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

Potentially problematic release.


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

Files changed (239) 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 +355 -0
  28. package/3rdparty/walkontable/src/selection.mjs +349 -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 +309 -127
  45. package/core.mjs +309 -127
  46. package/dataMap/metaManager/metaSchema.js +0 -19
  47. package/dataMap/metaManager/metaSchema.mjs +0 -19
  48. package/dist/handsontable.css +3 -8
  49. package/dist/handsontable.full.css +3 -8
  50. package/dist/handsontable.full.js +9241 -11943
  51. package/dist/handsontable.full.min.css +3 -3
  52. package/dist/handsontable.full.min.js +107 -107
  53. package/dist/handsontable.js +12628 -15330
  54. package/dist/handsontable.min.css +3 -3
  55. package/dist/handsontable.min.js +4 -4
  56. package/editorManager.js +94 -21
  57. package/editorManager.mjs +98 -26
  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.d.ts +1 -5
  67. package/pluginHooks.js +1 -89
  68. package/pluginHooks.mjs +1 -89
  69. package/plugins/collapsibleColumns/collapsibleColumns.js +24 -81
  70. package/plugins/collapsibleColumns/collapsibleColumns.mjs +24 -81
  71. package/plugins/columnSorting/columnSorting.js +8 -50
  72. package/plugins/columnSorting/columnSorting.mjs +9 -49
  73. package/plugins/columnSorting/index.js +2 -4
  74. package/plugins/columnSorting/index.mjs +1 -1
  75. package/plugins/copyPaste/copyPaste.js +1 -5
  76. package/plugins/copyPaste/copyPaste.mjs +1 -5
  77. package/plugins/customBorders/customBorders.js +53 -18
  78. package/plugins/customBorders/customBorders.mjs +54 -19
  79. package/plugins/manualColumnResize/manualColumnResize.js +36 -5
  80. package/plugins/manualColumnResize/manualColumnResize.mjs +36 -5
  81. package/plugins/manualRowResize/manualRowResize.js +40 -9
  82. package/plugins/manualRowResize/manualRowResize.mjs +40 -9
  83. package/plugins/mergeCells/mergeCells.js +18 -5
  84. package/plugins/mergeCells/mergeCells.mjs +18 -5
  85. package/plugins/multiColumnSorting/multiColumnSorting.js +3 -42
  86. package/plugins/multiColumnSorting/multiColumnSorting.mjs +3 -42
  87. package/plugins/nestedHeaders/nestedHeaders.js +10 -132
  88. package/plugins/nestedHeaders/nestedHeaders.mjs +10 -132
  89. package/plugins/nestedHeaders/stateManager/index.js +0 -37
  90. package/plugins/nestedHeaders/stateManager/index.mjs +0 -37
  91. package/plugins/nestedRows/nestedRows.js +7 -52
  92. package/plugins/nestedRows/nestedRows.mjs +7 -52
  93. package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
  94. package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
  95. package/selection/highlight/constants.js +16 -0
  96. package/selection/highlight/constants.mjs +6 -0
  97. package/selection/highlight/highlight.js +89 -312
  98. package/selection/highlight/highlight.mjs +85 -302
  99. package/selection/highlight/types/activeHeader.js +9 -10
  100. package/selection/highlight/types/activeHeader.mjs +8 -10
  101. package/selection/highlight/types/area.js +27 -12
  102. package/selection/highlight/types/area.mjs +30 -16
  103. package/selection/highlight/types/{focus.js → cell.js} +8 -5
  104. package/selection/highlight/types/{focus.mjs → cell.mjs} +7 -5
  105. package/selection/highlight/types/customSelection.js +10 -7
  106. package/selection/highlight/types/customSelection.mjs +9 -7
  107. package/selection/highlight/types/fill.js +8 -5
  108. package/selection/highlight/types/fill.mjs +7 -5
  109. package/selection/highlight/types/header.js +20 -10
  110. package/selection/highlight/types/header.mjs +19 -10
  111. package/selection/highlight/types/{row.js → index.js} +31 -27
  112. package/selection/highlight/types/{row.mjs → index.mjs} +29 -24
  113. package/selection/highlight/visualSelection.js +27 -31
  114. package/selection/highlight/visualSelection.mjs +27 -31
  115. package/selection/index.js +7 -4
  116. package/selection/index.mjs +3 -2
  117. package/selection/mouseEventHandler.js +1 -1
  118. package/selection/mouseEventHandler.mjs +1 -1
  119. package/selection/range.js +8 -8
  120. package/selection/range.mjs +8 -8
  121. package/selection/selection.js +181 -315
  122. package/selection/selection.mjs +180 -310
  123. package/selection/transformation.js +96 -233
  124. package/selection/transformation.mjs +93 -230
  125. package/selection/utils.js +36 -12
  126. package/selection/utils.mjs +36 -13
  127. package/settings.d.ts +0 -1
  128. package/shortcuts/manager.js +0 -2
  129. package/shortcuts/manager.mjs +0 -2
  130. package/tableView.js +9 -58
  131. package/tableView.mjs +9 -58
  132. package/translations/indexMapper.js +9 -8
  133. package/translations/indexMapper.mjs +9 -8
  134. package/3rdparty/walkontable/src/selection/border/constants.js +0 -18
  135. package/3rdparty/walkontable/src/selection/border/constants.mjs +0 -13
  136. package/3rdparty/walkontable/src/selection/constants.js +0 -63
  137. package/3rdparty/walkontable/src/selection/constants.mjs +0 -51
  138. package/3rdparty/walkontable/src/selection/index.js +0 -30
  139. package/3rdparty/walkontable/src/selection/index.mjs +0 -5
  140. package/3rdparty/walkontable/src/selection/manager.js +0 -329
  141. package/3rdparty/walkontable/src/selection/manager.mjs +0 -323
  142. package/3rdparty/walkontable/src/selection/scanner.js +0 -364
  143. package/3rdparty/walkontable/src/selection/scanner.mjs +0 -360
  144. package/3rdparty/walkontable/src/selection/selection.js +0 -133
  145. package/3rdparty/walkontable/src/selection/selection.mjs +0 -127
  146. package/selection/highlight/types/areaLayered.js +0 -54
  147. package/selection/highlight/types/areaLayered.mjs +0 -49
  148. package/selection/highlight/types/column.js +0 -50
  149. package/selection/highlight/types/column.mjs +0 -45
  150. package/shortcutContexts/commands/editor/closeAndSave.js +0 -15
  151. package/shortcutContexts/commands/editor/closeAndSave.mjs +0 -10
  152. package/shortcutContexts/commands/editor/closeWithoutSaving.js +0 -13
  153. package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +0 -8
  154. package/shortcutContexts/commands/editor/fastOpen.js +0 -16
  155. package/shortcutContexts/commands/editor/fastOpen.mjs +0 -11
  156. package/shortcutContexts/commands/editor/index.js +0 -16
  157. package/shortcutContexts/commands/editor/index.mjs +0 -12
  158. package/shortcutContexts/commands/editor/open.js +0 -29
  159. package/shortcutContexts/commands/editor/open.mjs +0 -24
  160. package/shortcutContexts/commands/emptySelectedCells.js +0 -12
  161. package/shortcutContexts/commands/emptySelectedCells.mjs +0 -7
  162. package/shortcutContexts/commands/extendCellsSelection/down.js +0 -15
  163. package/shortcutContexts/commands/extendCellsSelection/down.mjs +0 -10
  164. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +0 -21
  165. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +0 -16
  166. package/shortcutContexts/commands/extendCellsSelection/index.js +0 -26
  167. package/shortcutContexts/commands/extendCellsSelection/index.mjs +0 -22
  168. package/shortcutContexts/commands/extendCellsSelection/left.js +0 -15
  169. package/shortcutContexts/commands/extendCellsSelection/left.mjs +0 -10
  170. package/shortcutContexts/commands/extendCellsSelection/right.js +0 -15
  171. package/shortcutContexts/commands/extendCellsSelection/right.mjs +0 -10
  172. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +0 -19
  173. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +0 -14
  174. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +0 -22
  175. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +0 -17
  176. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +0 -17
  177. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +0 -12
  178. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +0 -17
  179. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +0 -12
  180. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +0 -40
  181. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +0 -35
  182. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +0 -40
  183. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +0 -35
  184. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +0 -22
  185. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +0 -17
  186. package/shortcutContexts/commands/extendCellsSelection/toRows.js +0 -19
  187. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +0 -14
  188. package/shortcutContexts/commands/extendCellsSelection/up.js +0 -15
  189. package/shortcutContexts/commands/extendCellsSelection/up.mjs +0 -10
  190. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +0 -21
  191. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +0 -16
  192. package/shortcutContexts/commands/index.js +0 -52
  193. package/shortcutContexts/commands/index.mjs +0 -48
  194. package/shortcutContexts/commands/moveCellSelection/down.js +0 -12
  195. package/shortcutContexts/commands/moveCellSelection/down.mjs +0 -7
  196. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +0 -29
  197. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +0 -24
  198. package/shortcutContexts/commands/moveCellSelection/index.js +0 -28
  199. package/shortcutContexts/commands/moveCellSelection/index.mjs +0 -24
  200. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +0 -13
  201. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +0 -8
  202. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +0 -13
  203. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +0 -8
  204. package/shortcutContexts/commands/moveCellSelection/left.js +0 -11
  205. package/shortcutContexts/commands/moveCellSelection/left.mjs +0 -6
  206. package/shortcutContexts/commands/moveCellSelection/right.js +0 -11
  207. package/shortcutContexts/commands/moveCellSelection/right.mjs +0 -6
  208. package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +0 -16
  209. package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +0 -11
  210. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +0 -17
  211. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +0 -12
  212. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +0 -13
  213. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +0 -8
  214. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +0 -16
  215. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +0 -11
  216. package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +0 -36
  217. package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +0 -31
  218. package/shortcutContexts/commands/moveCellSelection/toMostRight.js +0 -36
  219. package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +0 -31
  220. package/shortcutContexts/commands/moveCellSelection/toMostTop.js +0 -16
  221. package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +0 -11
  222. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +0 -18
  223. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +0 -13
  224. package/shortcutContexts/commands/moveCellSelection/up.js +0 -12
  225. package/shortcutContexts/commands/moveCellSelection/up.mjs +0 -7
  226. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +0 -29
  227. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +0 -24
  228. package/shortcutContexts/commands/populateSelectedCellsData.js +0 -35
  229. package/shortcutContexts/commands/populateSelectedCellsData.mjs +0 -30
  230. package/shortcutContexts/commands/selectAll.js +0 -11
  231. package/shortcutContexts/commands/selectAll.mjs +0 -6
  232. package/shortcutContexts/constants.js +0 -19
  233. package/shortcutContexts/constants.mjs +0 -12
  234. package/shortcutContexts/editor.js +0 -29
  235. package/shortcutContexts/editor.mjs +0 -25
  236. package/shortcutContexts/grid.js +0 -244
  237. package/shortcutContexts/grid.mjs +0 -240
  238. package/shortcutContexts/index.js +0 -29
  239. 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,38 +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 renderableHighlight = this.settings.visualToRenderableCoords(this.visualCellRange.highlight);
199
- var cellCoordsVisual = null;
200
- if (renderableHighlight === null || renderableHighlight.col === null || renderableHighlight.row === null) {
201
- cellCoordsVisual = this.getNearestNotHiddenCoords(coordsFrom, rowDirection, columnDirection);
202
- }
203
- if (cellCoordsVisual !== null && broaderCellRange.overlaps(cellCoordsVisual)) {
204
- var currentHighlight = broaderCellRange.highlight.clone();
205
- if (currentHighlight.row >= 0) {
206
- currentHighlight.row = cellCoordsVisual.row;
207
- }
208
- if (currentHighlight.col >= 0) {
209
- currentHighlight.col = cellCoordsVisual.col;
210
- }
211
-
212
- // 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.
213
209
  if (this.cellRange === null) {
214
- var cellCoordsRenderable = this.settings.visualToRenderableCoords(currentHighlight);
215
- this.cellRange = this.settings.createCellRange(cellCoordsRenderable);
210
+ var singleCellRangeRenderable = this.settings.visualToRenderableCoords(singleCellRangeVisual);
211
+ this.cellRange = this.settings.createCellRange(singleCellRangeRenderable);
216
212
  }
217
213
 
218
214
  // We set new highlight as it might change (for example, when showing/hiding some cells from the broader selection range)
219
215
  // TODO: It is also handled by the `MergeCells` plugin while adjusting already modified coordinates. Should it?
220
- broaderCellRange.setHighlight(currentHighlight);
216
+ broaderCellRange.setHighlight(singleCellRangeVisual);
217
+ return this;
221
218
  }
222
219
 
223
- // Sync the highlight coords from the visual selection layer with logical coords.
224
- if (this.settings.selectionType === 'focus' && renderableHighlight !== null && cellCoordsVisual === null) {
225
- broaderCellRange.setHighlight(this.visualCellRange.highlight);
226
- }
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);
227
222
  return this;
228
223
  }
229
224
 
@@ -241,7 +236,11 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
241
236
  var _this$cellRange = this.cellRange,
242
237
  from = _this$cellRange.from,
243
238
  to = _this$cellRange.to;
244
- 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];
245
244
  }
246
245
 
247
246
  /**
@@ -266,16 +265,13 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
266
265
  * points to the beginning of the selection.
267
266
  * @param {CellCoords} visualToCoords The CellCoords object which contains coordinates that
268
267
  * points to the end of the selection.
269
- * @returns {CellRange|null}
268
+ * @returns {CellRange}
270
269
  */
271
270
  }, {
272
271
  key: "createRenderableCellRange",
273
272
  value: function createRenderableCellRange(visualFromCoords, visualToCoords) {
274
273
  var renderableFromCoords = this.settings.visualToRenderableCoords(visualFromCoords);
275
274
  var renderableToCoords = this.settings.visualToRenderableCoords(visualToCoords);
276
- if (renderableFromCoords.row === null || renderableFromCoords.col === null || renderableToCoords.row === null || renderableToCoords.col === null) {
277
- return null;
278
- }
279
275
  return this.settings.createCellRange(renderableFromCoords, renderableFromCoords, renderableToCoords);
280
276
  }
281
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,38 +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 renderableHighlight = this.settings.visualToRenderableCoords(this.visualCellRange.highlight);
195
- var cellCoordsVisual = null;
196
- if (renderableHighlight === null || renderableHighlight.col === null || renderableHighlight.row === null) {
197
- cellCoordsVisual = this.getNearestNotHiddenCoords(coordsFrom, rowDirection, columnDirection);
198
- }
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.
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.
209
205
  if (this.cellRange === null) {
210
- var cellCoordsRenderable = this.settings.visualToRenderableCoords(currentHighlight);
211
- this.cellRange = this.settings.createCellRange(cellCoordsRenderable);
206
+ var singleCellRangeRenderable = this.settings.visualToRenderableCoords(singleCellRangeVisual);
207
+ this.cellRange = this.settings.createCellRange(singleCellRangeRenderable);
212
208
  }
213
209
 
214
210
  // We set new highlight as it might change (for example, when showing/hiding some cells from the broader selection range)
215
211
  // TODO: It is also handled by the `MergeCells` plugin while adjusting already modified coordinates. Should it?
216
- broaderCellRange.setHighlight(currentHighlight);
212
+ broaderCellRange.setHighlight(singleCellRangeVisual);
213
+ return this;
217
214
  }
218
215
 
219
- // Sync the highlight coords from the visual selection layer with logical coords.
220
- if (this.settings.selectionType === 'focus' && renderableHighlight !== null && cellCoordsVisual === null) {
221
- broaderCellRange.setHighlight(this.visualCellRange.highlight);
222
- }
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);
223
218
  return this;
224
219
  }
225
220
 
@@ -237,7 +232,11 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
237
232
  var _this$cellRange = this.cellRange,
238
233
  from = _this$cellRange.from,
239
234
  to = _this$cellRange.to;
240
- 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];
241
240
  }
242
241
 
243
242
  /**
@@ -262,16 +261,13 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
262
261
  * points to the beginning of the selection.
263
262
  * @param {CellCoords} visualToCoords The CellCoords object which contains coordinates that
264
263
  * points to the end of the selection.
265
- * @returns {CellRange|null}
264
+ * @returns {CellRange}
266
265
  */
267
266
  }, {
268
267
  key: "createRenderableCellRange",
269
268
  value: function createRenderableCellRange(visualFromCoords, visualToCoords) {
270
269
  var renderableFromCoords = this.settings.visualToRenderableCoords(visualFromCoords);
271
270
  var renderableToCoords = this.settings.visualToRenderableCoords(visualToCoords);
272
- if (renderableFromCoords.row === null || renderableFromCoords.col === null || renderableToCoords.row === null || renderableToCoords.col === null) {
273
- return null;
274
- }
275
271
  return this.settings.createCellRange(renderableFromCoords, renderableFromCoords, renderableToCoords);
276
272
  }
277
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(true, true, coords);
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(true, true, coords);
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
  }