handsontable 0.0.0-next-2b3d6d8-20230623 → 0.0.0-next-c3d199b-20230626

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 (285) 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 +329 -0
  34. package/3rdparty/walkontable/src/selection/manager.mjs +323 -0
  35. package/3rdparty/walkontable/src/selection/scanner.js +364 -0
  36. package/3rdparty/walkontable/src/selection/scanner.mjs +360 -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/CHANGELOG.md +0 -31
  52. package/base.js +2 -2
  53. package/base.mjs +2 -2
  54. package/core.d.ts +5 -3
  55. package/core.js +127 -309
  56. package/core.mjs +127 -309
  57. package/dataMap/metaManager/metaSchema.js +19 -0
  58. package/dataMap/metaManager/metaSchema.mjs +19 -0
  59. package/dist/handsontable.css +8 -3
  60. package/dist/handsontable.full.css +8 -3
  61. package/dist/handsontable.full.js +15283 -12109
  62. package/dist/handsontable.full.min.css +3 -3
  63. package/dist/handsontable.full.min.js +115 -115
  64. package/dist/handsontable.js +23364 -20190
  65. package/dist/handsontable.min.css +3 -3
  66. package/dist/handsontable.min.js +4 -4
  67. package/editorManager.js +21 -94
  68. package/editorManager.mjs +26 -98
  69. package/editors/textEditor/textEditor.js +3 -11
  70. package/editors/textEditor/textEditor.mjs +4 -12
  71. package/helpers/mixed.js +2 -2
  72. package/helpers/mixed.mjs +2 -2
  73. package/helpers/number.d.ts +1 -0
  74. package/helpers/number.js +18 -0
  75. package/helpers/number.mjs +17 -0
  76. package/package.json +1 -1
  77. package/pluginHooks.d.ts +5 -1
  78. package/pluginHooks.js +89 -1
  79. package/pluginHooks.mjs +89 -1
  80. package/plugins/collapsibleColumns/collapsibleColumns.js +81 -24
  81. package/plugins/collapsibleColumns/collapsibleColumns.mjs +81 -24
  82. package/plugins/columnSorting/columnSorting.js +50 -8
  83. package/plugins/columnSorting/columnSorting.mjs +49 -9
  84. package/plugins/columnSorting/index.js +4 -2
  85. package/plugins/columnSorting/index.mjs +1 -1
  86. package/plugins/comments/commentEditor.js +1 -0
  87. package/plugins/comments/commentEditor.mjs +1 -0
  88. package/plugins/comments/comments.js +263 -224
  89. package/plugins/comments/comments.mjs +271 -234
  90. package/plugins/comments/contextMenuItem/addEditComment.js +51 -0
  91. package/plugins/comments/contextMenuItem/addEditComment.mjs +35 -0
  92. package/plugins/comments/contextMenuItem/readOnlyComment.js +63 -0
  93. package/plugins/comments/contextMenuItem/readOnlyComment.mjs +55 -0
  94. package/plugins/comments/contextMenuItem/removeComment.js +48 -0
  95. package/plugins/comments/contextMenuItem/removeComment.mjs +32 -0
  96. package/plugins/contextMenu/contextMenu.d.ts +1 -1
  97. package/plugins/contextMenu/contextMenu.js +80 -29
  98. package/plugins/contextMenu/contextMenu.mjs +81 -30
  99. package/plugins/contextMenu/predefinedItems/alignment.js +7 -0
  100. package/plugins/contextMenu/predefinedItems/alignment.mjs +7 -0
  101. package/plugins/contextMenu/predefinedItems/clearColumn.js +5 -3
  102. package/plugins/contextMenu/predefinedItems/clearColumn.mjs +5 -3
  103. package/plugins/contextMenu/predefinedItems/columnLeft.js +5 -3
  104. package/plugins/contextMenu/predefinedItems/columnLeft.mjs +5 -3
  105. package/plugins/contextMenu/predefinedItems/columnRight.js +5 -3
  106. package/plugins/contextMenu/predefinedItems/columnRight.mjs +5 -3
  107. package/plugins/contextMenu/predefinedItems/readOnly.js +7 -0
  108. package/plugins/contextMenu/predefinedItems/readOnly.mjs +7 -0
  109. package/plugins/contextMenu/predefinedItems/removeColumn.js +7 -5
  110. package/plugins/contextMenu/predefinedItems/removeColumn.mjs +5 -3
  111. package/plugins/contextMenu/predefinedItems/removeRow.js +7 -5
  112. package/plugins/contextMenu/predefinedItems/removeRow.mjs +5 -3
  113. package/plugins/contextMenu/predefinedItems/rowAbove.js +5 -3
  114. package/plugins/contextMenu/predefinedItems/rowAbove.mjs +5 -3
  115. package/plugins/contextMenu/predefinedItems/rowBelow.js +5 -3
  116. package/plugins/contextMenu/predefinedItems/rowBelow.mjs +5 -3
  117. package/plugins/contextMenu/utils.js +25 -16
  118. package/plugins/contextMenu/utils.mjs +24 -15
  119. package/plugins/copyPaste/contextMenuItem/copy.js +7 -0
  120. package/plugins/copyPaste/contextMenuItem/copy.mjs +7 -0
  121. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.js +9 -1
  122. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs +9 -1
  123. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.js +9 -1
  124. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs +9 -1
  125. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.js +9 -1
  126. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs +9 -1
  127. package/plugins/copyPaste/contextMenuItem/cut.js +7 -0
  128. package/plugins/copyPaste/contextMenuItem/cut.mjs +7 -0
  129. package/plugins/copyPaste/copyPaste.js +6 -2
  130. package/plugins/copyPaste/copyPaste.mjs +6 -2
  131. package/plugins/customBorders/customBorders.js +25 -53
  132. package/plugins/customBorders/customBorders.mjs +26 -54
  133. package/plugins/dropdownMenu/dropdownMenu.d.ts +1 -1
  134. package/plugins/dropdownMenu/dropdownMenu.js +94 -30
  135. package/plugins/dropdownMenu/dropdownMenu.mjs +94 -30
  136. package/plugins/mergeCells/mergeCells.js +5 -18
  137. package/plugins/mergeCells/mergeCells.mjs +5 -18
  138. package/plugins/multiColumnSorting/multiColumnSorting.js +42 -3
  139. package/plugins/multiColumnSorting/multiColumnSorting.mjs +42 -3
  140. package/plugins/nestedHeaders/nestedHeaders.js +132 -10
  141. package/plugins/nestedHeaders/nestedHeaders.mjs +132 -10
  142. package/plugins/nestedHeaders/stateManager/index.js +37 -0
  143. package/plugins/nestedHeaders/stateManager/index.mjs +37 -0
  144. package/plugins/nestedRows/nestedRows.js +52 -7
  145. package/plugins/nestedRows/nestedRows.mjs +52 -7
  146. package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
  147. package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
  148. package/selection/highlight/highlight.js +312 -89
  149. package/selection/highlight/highlight.mjs +302 -85
  150. package/selection/highlight/types/activeHeader.js +10 -9
  151. package/selection/highlight/types/activeHeader.mjs +10 -8
  152. package/selection/highlight/types/area.js +12 -27
  153. package/selection/highlight/types/area.mjs +16 -30
  154. package/selection/highlight/types/areaLayered.js +54 -0
  155. package/selection/highlight/types/areaLayered.mjs +49 -0
  156. package/selection/highlight/types/column.js +50 -0
  157. package/selection/highlight/types/column.mjs +45 -0
  158. package/selection/highlight/types/customSelection.js +7 -10
  159. package/selection/highlight/types/customSelection.mjs +7 -9
  160. package/selection/highlight/types/fill.js +5 -8
  161. package/selection/highlight/types/fill.mjs +5 -7
  162. package/selection/highlight/types/{cell.js → focus.js} +5 -8
  163. package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
  164. package/selection/highlight/types/header.js +10 -20
  165. package/selection/highlight/types/header.mjs +10 -19
  166. package/selection/highlight/types/{index.js → row.js} +27 -31
  167. package/selection/highlight/types/{index.mjs → row.mjs} +24 -29
  168. package/selection/highlight/visualSelection.js +31 -27
  169. package/selection/highlight/visualSelection.mjs +31 -27
  170. package/selection/index.js +4 -7
  171. package/selection/index.mjs +2 -3
  172. package/selection/mouseEventHandler.js +1 -1
  173. package/selection/mouseEventHandler.mjs +1 -1
  174. package/selection/range.js +8 -8
  175. package/selection/range.mjs +8 -8
  176. package/selection/selection.js +315 -181
  177. package/selection/selection.mjs +310 -180
  178. package/selection/transformation.js +233 -96
  179. package/selection/transformation.mjs +230 -93
  180. package/selection/utils.js +12 -36
  181. package/selection/utils.mjs +13 -36
  182. package/settings.d.ts +1 -0
  183. package/shortcutContexts/commands/editor/closeAndSave.js +15 -0
  184. package/shortcutContexts/commands/editor/closeAndSave.mjs +10 -0
  185. package/shortcutContexts/commands/editor/closeWithoutSaving.js +13 -0
  186. package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +8 -0
  187. package/shortcutContexts/commands/editor/fastOpen.js +16 -0
  188. package/shortcutContexts/commands/editor/fastOpen.mjs +11 -0
  189. package/shortcutContexts/commands/editor/index.js +16 -0
  190. package/shortcutContexts/commands/editor/index.mjs +12 -0
  191. package/shortcutContexts/commands/editor/open.js +29 -0
  192. package/shortcutContexts/commands/editor/open.mjs +24 -0
  193. package/shortcutContexts/commands/emptySelectedCells.js +12 -0
  194. package/shortcutContexts/commands/emptySelectedCells.mjs +7 -0
  195. package/shortcutContexts/commands/extendCellsSelection/down.js +15 -0
  196. package/shortcutContexts/commands/extendCellsSelection/down.mjs +10 -0
  197. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +21 -0
  198. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +16 -0
  199. package/shortcutContexts/commands/extendCellsSelection/index.js +26 -0
  200. package/shortcutContexts/commands/extendCellsSelection/index.mjs +22 -0
  201. package/shortcutContexts/commands/extendCellsSelection/left.js +15 -0
  202. package/shortcutContexts/commands/extendCellsSelection/left.mjs +10 -0
  203. package/shortcutContexts/commands/extendCellsSelection/right.js +15 -0
  204. package/shortcutContexts/commands/extendCellsSelection/right.mjs +10 -0
  205. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +19 -0
  206. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +14 -0
  207. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +22 -0
  208. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +17 -0
  209. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +17 -0
  210. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +12 -0
  211. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +17 -0
  212. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +12 -0
  213. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +40 -0
  214. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +35 -0
  215. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +40 -0
  216. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +35 -0
  217. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +22 -0
  218. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +17 -0
  219. package/shortcutContexts/commands/extendCellsSelection/toRows.js +19 -0
  220. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +14 -0
  221. package/shortcutContexts/commands/extendCellsSelection/up.js +15 -0
  222. package/shortcutContexts/commands/extendCellsSelection/up.mjs +10 -0
  223. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +21 -0
  224. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +16 -0
  225. package/shortcutContexts/commands/index.js +52 -0
  226. package/shortcutContexts/commands/index.mjs +48 -0
  227. package/shortcutContexts/commands/moveCellSelection/down.js +12 -0
  228. package/shortcutContexts/commands/moveCellSelection/down.mjs +7 -0
  229. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +29 -0
  230. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +24 -0
  231. package/shortcutContexts/commands/moveCellSelection/index.js +28 -0
  232. package/shortcutContexts/commands/moveCellSelection/index.mjs +24 -0
  233. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +13 -0
  234. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -0
  235. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +13 -0
  236. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -0
  237. package/shortcutContexts/commands/moveCellSelection/left.js +11 -0
  238. package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -0
  239. package/shortcutContexts/commands/moveCellSelection/right.js +11 -0
  240. package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -0
  241. package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +16 -0
  242. package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +11 -0
  243. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +17 -0
  244. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +12 -0
  245. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +13 -0
  246. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +8 -0
  247. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +16 -0
  248. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +11 -0
  249. package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +36 -0
  250. package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +31 -0
  251. package/shortcutContexts/commands/moveCellSelection/toMostRight.js +36 -0
  252. package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +31 -0
  253. package/shortcutContexts/commands/moveCellSelection/toMostTop.js +16 -0
  254. package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +11 -0
  255. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +18 -0
  256. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +13 -0
  257. package/shortcutContexts/commands/moveCellSelection/up.js +12 -0
  258. package/shortcutContexts/commands/moveCellSelection/up.mjs +7 -0
  259. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +29 -0
  260. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +24 -0
  261. package/shortcutContexts/commands/populateSelectedCellsData.js +35 -0
  262. package/shortcutContexts/commands/populateSelectedCellsData.mjs +30 -0
  263. package/shortcutContexts/commands/selectAll.js +11 -0
  264. package/shortcutContexts/commands/selectAll.mjs +6 -0
  265. package/shortcutContexts/constants.js +19 -0
  266. package/shortcutContexts/constants.mjs +12 -0
  267. package/shortcutContexts/editor.js +29 -0
  268. package/shortcutContexts/editor.mjs +25 -0
  269. package/shortcutContexts/grid.js +247 -0
  270. package/shortcutContexts/grid.mjs +243 -0
  271. package/shortcutContexts/index.js +29 -0
  272. package/shortcutContexts/index.mjs +15 -0
  273. package/shortcuts/manager.js +2 -0
  274. package/shortcuts/manager.mjs +2 -0
  275. package/shortcuts/recorder.js +2 -2
  276. package/shortcuts/recorder.mjs +2 -2
  277. package/shortcuts/utils.js +21 -5
  278. package/shortcuts/utils.mjs +20 -4
  279. package/tableView.js +63 -11
  280. package/tableView.mjs +63 -11
  281. package/translations/indexMapper.d.ts +2 -0
  282. package/3rdparty/walkontable/src/selection.js +0 -355
  283. package/3rdparty/walkontable/src/selection.mjs +0 -349
  284. package/selection/highlight/constants.js +0 -16
  285. package/selection/highlight/constants.mjs +0 -6
@@ -3,9 +3,8 @@
3
3
  require("core-js/modules/es.array.slice.js");
4
4
  require("core-js/modules/es.object.freeze.js");
5
5
  require("core-js/modules/es.symbol.iterator.js");
6
- require("core-js/modules/es.regexp.to-string.js");
7
- require("core-js/modules/es.function.name.js");
8
- require("core-js/modules/es.regexp.exec.js");
6
+ require("core-js/modules/es.weak-map.js");
7
+ require("core-js/modules/es.object.get-own-property-descriptor.js");
9
8
  exports.__esModule = true;
10
9
  exports.default = void 0;
11
10
  require("core-js/modules/es.array.iterator.js");
@@ -24,11 +23,12 @@ require("core-js/modules/es.symbol.to-primitive.js");
24
23
  require("core-js/modules/es.date.to-primitive.js");
25
24
  require("core-js/modules/es.symbol.js");
26
25
  require("core-js/modules/es.symbol.description.js");
27
- var _highlight = _interopRequireDefault(require("./highlight/highlight"));
28
- var _constants = require("./highlight/constants");
26
+ var _src = require("./../3rdparty/walkontable/src");
27
+ var _highlight = _interopRequireWildcard(require("./highlight/highlight"));
29
28
  var _range = _interopRequireDefault(require("./range"));
30
29
  var _object = require("./../helpers/object");
31
30
  var _mixed = require("./../helpers/mixed");
31
+ var _number = require("./../helpers/number");
32
32
  var _array = require("./../helpers/array");
33
33
  var _localHooks = _interopRequireDefault(require("./../mixins/localHooks"));
34
34
  var _transformation = _interopRequireDefault(require("./transformation"));
@@ -36,17 +36,14 @@ var _utils = require("./utils");
36
36
  var _templateLiteralTag = require("./../helpers/templateLiteralTag");
37
37
  var _templateObject;
38
38
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
39
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
40
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
39
41
  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); }
40
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
41
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
42
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
43
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
44
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
45
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
46
42
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
47
43
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
48
44
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
49
45
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
46
+ 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; }
50
47
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
51
48
  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); }
52
49
  /**
@@ -62,57 +59,62 @@ var Selection = /*#__PURE__*/function () {
62
59
  *
63
60
  * @type {GridSettings}
64
61
  */
65
- this.settings = settings;
62
+ _defineProperty(this, "settings", void 0);
66
63
  /**
67
64
  * An additional object with dynamically defined properties which describes table state.
68
65
  *
69
66
  * @type {object}
70
67
  */
71
- this.tableProps = tableProps;
68
+ _defineProperty(this, "tableProps", void 0);
72
69
  /**
73
70
  * The flag which determines if the selection is in progress.
74
71
  *
75
72
  * @type {boolean}
76
73
  */
77
- this.inProgress = false;
74
+ _defineProperty(this, "inProgress", false);
78
75
  /**
79
- * The flag indicates that selection was performed by clicking the corner overlay.
76
+ * Selection data layer (handle visual coordinates).
80
77
  *
81
- * @type {boolean}
78
+ * @type {SelectionRange}
82
79
  */
83
- this.selectedByCorner = false;
80
+ _defineProperty(this, "selectedRange", new _range.default(function (highlight, from, to) {
81
+ return _this.tableProps.createCellRange(highlight, from, to);
82
+ }));
84
83
  /**
85
- * The collection of the selection layer levels where the whole row was selected using the row header or
86
- * the corner header.
84
+ * Visualization layer.
87
85
  *
88
- * @type {Set.<number>}
86
+ * @type {Highlight}
89
87
  */
90
- this.selectedByRowHeader = new Set();
88
+ _defineProperty(this, "highlight", void 0);
91
89
  /**
92
- * The collection of the selection layer levels where the whole column was selected using the column header or
93
- * the corner header.
90
+ * The module for modifying coordinates.
94
91
  *
95
- * @type {Set.<number>}
92
+ * @type {Transformation}
96
93
  */
97
- this.selectedByColumnHeader = new Set();
94
+ _defineProperty(this, "transformation", void 0);
98
95
  /**
99
- * Selection data layer (handle visual coordinates).
96
+ * The collection of the selection layer levels where the whole row was selected using the row header or
97
+ * the corner header.
100
98
  *
101
- * @type {SelectionRange}
99
+ * @type {Set<number>}
102
100
  */
103
- this.selectedRange = new _range.default(function (highlight, from, to) {
104
- return _this.tableProps.createCellRange(highlight, from, to);
105
- });
101
+ _defineProperty(this, "selectedByRowHeader", new Set());
106
102
  /**
107
- * Visualization layer.
103
+ * The collection of the selection layer levels where the whole column was selected using the column header or
104
+ * the corner header.
108
105
  *
109
- * @type {Highlight}
106
+ * @type {Set<number>}
110
107
  */
108
+ _defineProperty(this, "selectedByColumnHeader", new Set());
109
+ this.settings = settings;
110
+ this.tableProps = tableProps;
111
111
  this.highlight = new _highlight.default({
112
112
  headerClassName: settings.currentHeaderClassName,
113
113
  activeHeaderClassName: settings.activeHeaderClassName,
114
114
  rowClassName: settings.currentRowClassName,
115
115
  columnClassName: settings.currentColClassName,
116
+ rowIndexMapper: this.tableProps.rowIndexMapper,
117
+ columnIndexMapper: this.tableProps.columnIndexMapper,
116
118
  disabledCellSelection: function disabledCellSelection(row, column) {
117
119
  return _this.tableProps.isDisabledCellSelection(row, column);
118
120
  },
@@ -133,25 +135,22 @@ var Selection = /*#__PURE__*/function () {
133
135
  },
134
136
  createCellRange: function createCellRange(highlight, from, to) {
135
137
  return _this.tableProps.createCellRange(highlight, from, to);
136
- },
137
- rowIndexMapper: function rowIndexMapper() {
138
- return _this.tableProps.rowIndexMapper();
139
- },
140
- columnIndexMapper: function columnIndexMapper() {
141
- return _this.tableProps.columnIndexMapper();
142
138
  }
143
139
  });
144
- /**
145
- * The module for modifying coordinates.
146
- *
147
- * @type {Transformation}
148
- */
149
140
  this.transformation = new _transformation.default(this.selectedRange, {
150
- countRows: function countRows() {
151
- return _this.tableProps.countRowsTranslated();
141
+ rowIndexMapper: this.tableProps.rowIndexMapper,
142
+ columnIndexMapper: this.tableProps.columnIndexMapper,
143
+ countRenderableRows: function countRenderableRows() {
144
+ return _this.tableProps.countRenderableRows();
145
+ },
146
+ countRenderableColumns: function countRenderableColumns() {
147
+ return _this.tableProps.countRenderableColumns();
148
+ },
149
+ countRowHeaders: function countRowHeaders() {
150
+ return _this.tableProps.countRowHeaders();
152
151
  },
153
- countCols: function countCols() {
154
- return _this.tableProps.countColsTranslated();
152
+ countColHeaders: function countColHeaders() {
153
+ return _this.tableProps.countColHeaders();
155
154
  },
156
155
  visualToRenderableCoords: function visualToRenderableCoords(coords) {
157
156
  return _this.tableProps.visualToRenderableCoords(coords);
@@ -162,6 +161,9 @@ var Selection = /*#__PURE__*/function () {
162
161
  createCellCoords: function createCellCoords(row, column) {
163
162
  return _this.tableProps.createCellCoords(row, column);
164
163
  },
164
+ navigableHeaders: function navigableHeaders() {
165
+ return settings.navigableHeaders;
166
+ },
165
167
  fixedRowsBottom: function fixedRowsBottom() {
166
168
  return settings.fixedRowsBottom;
167
169
  },
@@ -228,7 +230,7 @@ var Selection = /*#__PURE__*/function () {
228
230
  }
229
231
 
230
232
  /**
231
- * Indicate that selection process began. It sets internaly `.inProgress` property to `true`.
233
+ * Indicate that selection process began. It sets internally `.inProgress` property to `true`.
232
234
  */
233
235
  }, {
234
236
  key: "begin",
@@ -237,7 +239,7 @@ var Selection = /*#__PURE__*/function () {
237
239
  }
238
240
 
239
241
  /**
240
- * Indicate that selection process finished. It sets internaly `.inProgress` property to `false`.
242
+ * Indicate that selection process finished. It sets internally `.inProgress` property to `false`.
241
243
  */
242
244
  }, {
243
245
  key: "finish",
@@ -266,35 +268,27 @@ var Selection = /*#__PURE__*/function () {
266
268
  * the default trigger will be used.
267
269
  * @param {boolean} [fragment=false] If `true`, the selection will be treated as a partial selection where the
268
270
  * `setRangeEnd` method won't be called on every `setRangeStart` call.
271
+ * @param {CellCoords} [highlightCoords] If set, allows changing the coordinates of the highlight/focus cell.
269
272
  */
270
273
  }, {
271
274
  key: "setRangeStart",
272
275
  value: function setRangeStart(coords, multipleSelection) {
273
276
  var fragment = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
277
+ var highlightCoords = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : coords;
274
278
  var isMultipleMode = this.settings.selectionMode === 'multiple';
275
279
  var isMultipleSelection = (0, _mixed.isUndefined)(multipleSelection) ? this.tableProps.getShortcutManager().isCtrlPressed() : multipleSelection;
276
- var isRowNegative = coords.row < 0;
277
- var isColumnNegative = coords.col < 0;
278
- var selectedByCorner = isRowNegative && isColumnNegative;
279
280
  // We are creating copy. We would like to modify just the start of the selection by below hook. Then original coords
280
281
  // should be handled by next methods.
281
282
  var coordsClone = coords.clone();
282
- this.selectedByCorner = selectedByCorner;
283
283
  this.runLocalHooks("beforeSetRangeStart".concat(fragment ? 'Only' : ''), coordsClone);
284
284
  if (!isMultipleMode || isMultipleMode && !isMultipleSelection && (0, _mixed.isUndefined)(multipleSelection)) {
285
285
  this.selectedRange.clear();
286
286
  }
287
- this.selectedRange.add(coordsClone);
287
+ this.selectedRange.add(coordsClone).current().setHighlight(highlightCoords.clone());
288
288
  if (this.getLayerLevel() === 0) {
289
289
  this.selectedByRowHeader.clear();
290
290
  this.selectedByColumnHeader.clear();
291
291
  }
292
- if (!selectedByCorner && isColumnNegative) {
293
- this.selectedByRowHeader.add(this.getLayerLevel());
294
- }
295
- if (!selectedByCorner && isRowNegative) {
296
- this.selectedByColumnHeader.add(this.getLayerLevel());
297
- }
298
292
  if (!fragment) {
299
293
  this.setRangeEnd(coords);
300
294
  }
@@ -307,11 +301,13 @@ var Selection = /*#__PURE__*/function () {
307
301
  * @param {boolean} [multipleSelection] If `true`, selection will be worked in 'multiple' mode. This option works
308
302
  * only when 'selectionMode' is set as 'multiple'. If the argument is not defined
309
303
  * the default trigger will be used.
304
+ * @param {CellCoords} [highlightCoords] If set, allows changing the coordinates of the highlight/focus cell.
310
305
  */
311
306
  }, {
312
307
  key: "setRangeStartOnly",
313
308
  value: function setRangeStartOnly(coords, multipleSelection) {
314
- this.setRangeStart(coords, multipleSelection, true);
309
+ var highlightCoords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : coords;
310
+ this.setRangeStart(coords, multipleSelection, true, highlightCoords);
315
311
  }
316
312
 
317
313
  /**
@@ -325,21 +321,39 @@ var Selection = /*#__PURE__*/function () {
325
321
  if (this.selectedRange.isEmpty()) {
326
322
  return;
327
323
  }
328
-
329
- // We are creating copy. We would like to modify just the end of the selection by below hook. Then original coords
330
- // should be handled by next methods.
331
324
  var coordsClone = coords.clone();
325
+ var countRows = this.tableProps.countRows();
326
+ var countCols = this.tableProps.countCols();
327
+ var isSingle = this.selectedRange.current().clone().setTo(coords).isSingleHeader();
328
+
329
+ // Ignore processing the end range when the header selection starts overlapping the corner and
330
+ // the selection is not a single header highlight.
331
+ if ((countRows > 0 || countCols > 0) && (countRows === 0 && coordsClone.col < 0 && !isSingle || countCols === 0 && coordsClone.row < 0 && !isSingle)) {
332
+ return;
333
+ }
332
334
  this.runLocalHooks('beforeSetRangeEnd', coordsClone);
333
335
  this.begin();
334
336
  var cellRange = this.selectedRange.current();
335
- if (this.settings.selectionMode !== 'single') {
336
- cellRange.setTo(this.tableProps.createCellCoords(coordsClone.row, coordsClone.col));
337
+ if (!this.settings.navigableHeaders) {
338
+ cellRange.highlight.normalize();
339
+ }
340
+ if (this.settings.selectionMode === 'single') {
341
+ cellRange.setFrom(cellRange.highlight);
342
+ cellRange.setTo(cellRange.highlight);
343
+ } else {
344
+ cellRange.setTo(coordsClone);
337
345
  }
338
346
 
339
- // Set up current selection.
340
- this.highlight.getCell().clear();
341
- if (this.highlight.isEnabledFor(_constants.CELL_TYPE, cellRange.highlight)) {
342
- this.highlight.getCell().add(this.selectedRange.current().highlight).commit().syncWith(cellRange);
347
+ // Prevent creating "area" selection that overlaps headers.
348
+ if (countRows > 0 && countCols > 0) {
349
+ if (!this.settings.navigableHeaders || this.settings.navigableHeaders && !cellRange.isSingleHeader()) {
350
+ cellRange.to.normalize();
351
+ }
352
+ }
353
+ var focusHighlight = this.highlight.getFocus();
354
+ focusHighlight.clear();
355
+ if (this.highlight.isEnabledFor(_highlight.FOCUS_TYPE, cellRange.highlight)) {
356
+ focusHighlight.add(this.selectedRange.current().highlight).commit().syncWith(cellRange);
343
357
  }
344
358
  var layerLevel = this.getLayerLevel();
345
359
 
@@ -349,73 +363,96 @@ var Selection = /*#__PURE__*/function () {
349
363
  (0, _array.arrayEach)(this.highlight.getAreas(), function (highlight) {
350
364
  return void highlight.clear();
351
365
  });
352
- (0, _array.arrayEach)(this.highlight.getHeaders(), function (highlight) {
366
+ (0, _array.arrayEach)(this.highlight.getLayeredAreas(), function (highlight) {
367
+ return void highlight.clear();
368
+ });
369
+ (0, _array.arrayEach)(this.highlight.getRowHeaders(), function (highlight) {
370
+ return void highlight.clear();
371
+ });
372
+ (0, _array.arrayEach)(this.highlight.getColumnHeaders(), function (highlight) {
373
+ return void highlight.clear();
374
+ });
375
+ (0, _array.arrayEach)(this.highlight.getActiveRowHeaders(), function (highlight) {
376
+ return void highlight.clear();
377
+ });
378
+ (0, _array.arrayEach)(this.highlight.getActiveColumnHeaders(), function (highlight) {
379
+ return void highlight.clear();
380
+ });
381
+ (0, _array.arrayEach)(this.highlight.getActiveCornerHeaders(), function (highlight) {
353
382
  return void highlight.clear();
354
383
  });
355
- (0, _array.arrayEach)(this.highlight.getActiveHeaders(), function (highlight) {
384
+ (0, _array.arrayEach)(this.highlight.getRowHighlights(), function (highlight) {
385
+ return void highlight.clear();
386
+ });
387
+ (0, _array.arrayEach)(this.highlight.getColumnHighlights(), function (highlight) {
356
388
  return void highlight.clear();
357
389
  });
358
390
  }
359
391
  this.highlight.useLayerLevel(layerLevel);
360
- var areaHighlight = this.highlight.createOrGetArea();
361
- var headerHighlight = this.highlight.createOrGetHeader();
362
- var activeHeaderHighlight = this.highlight.createOrGetActiveHeader();
392
+ var areaHighlight = this.highlight.createArea();
393
+ var layeredAreaHighlight = this.highlight.createLayeredArea();
394
+ var rowHeaderHighlight = this.highlight.createRowHeader();
395
+ var columnHeaderHighlight = this.highlight.createColumnHeader();
396
+ var activeRowHeaderHighlight = this.highlight.createActiveRowHeader();
397
+ var activeColumnHeaderHighlight = this.highlight.createActiveColumnHeader();
398
+ var activeCornerHeaderHighlight = this.highlight.createActiveCornerHeader();
399
+ var rowHighlight = this.highlight.createRowHighlight();
400
+ var columnHighlight = this.highlight.createColumnHighlight();
363
401
  areaHighlight.clear();
364
- headerHighlight.clear();
365
- activeHeaderHighlight.clear();
366
- if (this.highlight.isEnabledFor(_constants.AREA_TYPE, cellRange.highlight) && (this.isMultiple() || layerLevel >= 1)) {
402
+ layeredAreaHighlight.clear();
403
+ rowHeaderHighlight.clear();
404
+ columnHeaderHighlight.clear();
405
+ activeRowHeaderHighlight.clear();
406
+ activeColumnHeaderHighlight.clear();
407
+ activeCornerHeaderHighlight.clear();
408
+ rowHighlight.clear();
409
+ columnHighlight.clear();
410
+ if (this.highlight.isEnabledFor(_highlight.AREA_TYPE, cellRange.highlight) && (this.isMultiple() || layerLevel >= 1)) {
367
411
  areaHighlight.add(cellRange.from).add(cellRange.to).commit();
412
+ layeredAreaHighlight.add(cellRange.from).add(cellRange.to).commit();
368
413
  if (layerLevel === 1) {
369
414
  // For single cell selection in the same layer, we do not create area selection to prevent blue background.
370
415
  // When non-consecutive selection is performed we have to add that missing area selection to the previous layer
371
416
  // based on previous coordinates. It only occurs when the previous selection wasn't select multiple cells.
372
417
  var previousRange = this.selectedRange.previous();
373
- this.highlight.useLayerLevel(layerLevel - 1).createOrGetArea().add(previousRange.from).commit()
418
+ this.highlight.useLayerLevel(layerLevel - 1);
419
+ this.highlight.createArea().add(previousRange.from).commit()
420
+ // Range may start with hidden indexes. Commit would not found start point (as we add just the `from` coords).
421
+ .syncWith(previousRange);
422
+ this.highlight.createLayeredArea().add(previousRange.from).commit()
374
423
  // Range may start with hidden indexes. Commit would not found start point (as we add just the `from` coords).
375
424
  .syncWith(previousRange);
376
425
  this.highlight.useLayerLevel(layerLevel);
377
426
  }
378
427
  }
379
- if (this.highlight.isEnabledFor(_constants.HEADER_TYPE, cellRange.highlight)) {
380
- // The header selection generally contains cell selection. In a case when all rows (or columns)
381
- // are hidden that visual coordinates are translated to renderable coordinates that do not exist.
382
- // Hence no header highlight is generated. In that case, to make a column (or a row) header
383
- // highlight, the row and column index has to point to the header (the negative value). See #7052.
384
- var areAnyRowsRendered = this.tableProps.countRowsTranslated() === 0;
385
- var areAnyColumnsRendered = this.tableProps.countColsTranslated() === 0;
386
- var headerCellRange = cellRange;
387
- if (areAnyRowsRendered || areAnyColumnsRendered) {
388
- headerCellRange = cellRange.clone();
389
- }
390
- if (areAnyRowsRendered) {
391
- headerCellRange.from.row = -1;
392
- }
393
- if (areAnyColumnsRendered) {
394
- headerCellRange.from.col = -1;
395
- }
396
- if (this.settings.selectionMode === 'single') {
397
- if (this.isSelectedByAnyHeader()) {
398
- headerCellRange.from.normalize();
428
+ if (this.highlight.isEnabledFor(_highlight.HEADER_TYPE, cellRange.highlight)) {
429
+ if (!cellRange.isSingleHeader()) {
430
+ var rowCoordsFrom = this.tableProps.createCellCoords(Math.max(cellRange.from.row, 0), -1);
431
+ var rowCoordsTo = this.tableProps.createCellCoords(cellRange.to.row, -1);
432
+ var columnCoordsFrom = this.tableProps.createCellCoords(-1, Math.max(cellRange.from.col, 0));
433
+ var columnCoordsTo = this.tableProps.createCellCoords(-1, cellRange.to.col);
434
+ if (this.settings.selectionMode === 'single') {
435
+ rowHeaderHighlight.add(rowCoordsFrom).commit();
436
+ columnHeaderHighlight.add(columnCoordsFrom).commit();
437
+ rowHighlight.add(rowCoordsFrom).commit();
438
+ columnHighlight.add(columnCoordsFrom).commit();
439
+ } else {
440
+ rowHeaderHighlight.add(rowCoordsFrom).add(rowCoordsTo).commit();
441
+ columnHeaderHighlight.add(columnCoordsFrom).add(columnCoordsTo).commit();
442
+ rowHighlight.add(rowCoordsFrom).add(rowCoordsTo).commit();
443
+ columnHighlight.add(columnCoordsFrom).add(columnCoordsTo).commit();
399
444
  }
400
- headerHighlight.add(headerCellRange.from).commit();
401
- } else {
402
- headerHighlight.add(headerCellRange.from).add(headerCellRange.to).commit();
403
445
  }
404
- if (this.isEntireRowSelected()) {
405
- var isRowSelected = this.tableProps.countCols() === cellRange.getWidth();
406
-
407
- // Make sure that the whole row is selected (in case where selectionMode is set to 'single')
408
- if (isRowSelected) {
409
- activeHeaderHighlight.add(this.tableProps.createCellCoords(cellRange.from.row, -1)).add(this.tableProps.createCellCoords(cellRange.to.row, -1)).commit();
410
- }
446
+ var highlightRowHeaders = this.isEntireRowSelected() && (countCols > 0 && countCols === cellRange.getWidth() || countCols === 0 && (this.isSelectedByRowHeader() || this.isSelectedByCorner()));
447
+ var highlightColumnHeaders = this.isEntireColumnSelected() && (countRows > 0 && countRows === cellRange.getHeight() || countRows === 0 && (this.isSelectedByColumnHeader() || this.isSelectedByCorner()));
448
+ if (highlightRowHeaders) {
449
+ activeRowHeaderHighlight.add(this.tableProps.createCellCoords(Math.max(cellRange.from.row, 0), Math.min(-this.tableProps.countRowHeaders(), -1))).add(this.tableProps.createCellCoords(Math.max(cellRange.to.row, 0), -1)).commit();
411
450
  }
412
- if (this.isEntireColumnSelected()) {
413
- var isColumnSelected = this.tableProps.countRows() === cellRange.getHeight();
414
-
415
- // Make sure that the whole column is selected (in case where selectionMode is set to 'single')
416
- if (isColumnSelected) {
417
- activeHeaderHighlight.add(this.tableProps.createCellCoords(-1, cellRange.from.col)).add(this.tableProps.createCellCoords(-1, cellRange.to.col)).commit();
418
- }
451
+ if (highlightColumnHeaders) {
452
+ activeColumnHeaderHighlight.add(this.tableProps.createCellCoords(Math.min(-this.tableProps.countColHeaders(), -1), Math.max(cellRange.from.col, 0))).add(this.tableProps.createCellCoords(-1, Math.max(cellRange.to.col, 0))).commit();
453
+ }
454
+ if (highlightRowHeaders && highlightColumnHeaders) {
455
+ activeCornerHeaderHighlight.add(this.tableProps.createCellCoords(-this.tableProps.countColHeaders(), -this.tableProps.countRowHeaders())).add(this.tableProps.createCellCoords(-1, -1)).commit();
419
456
  }
420
457
  }
421
458
  this.runLocalHooks('afterSetRangeEnd', coords);
@@ -440,14 +477,14 @@ var Selection = /*#__PURE__*/function () {
440
477
  *
441
478
  * @param {number} rowDelta Rows number to move, value can be passed as negative number.
442
479
  * @param {number} colDelta Columns number to move, value can be passed as negative number.
443
- * @param {boolean} [force=false] If `true` the new rows/columns will be created if necessary. Otherwise, row/column will
444
- * be created according to `minSpareRows/minSpareCols` settings of Handsontable.
480
+ * @param {boolean} [createMissingRecords=false] If `true` the new rows/columns will be created if necessary.
481
+ * Otherwise, row/column will be created according to `minSpareRows/minSpareCols` settings of Handsontable.
445
482
  */
446
483
  }, {
447
484
  key: "transformStart",
448
485
  value: function transformStart(rowDelta, colDelta) {
449
- var force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
450
- this.setRangeStart(this.transformation.transformStart(rowDelta, colDelta, force));
486
+ var createMissingRecords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
487
+ this.setRangeStart(this.transformation.transformStart(rowDelta, colDelta, createMissingRecords));
451
488
  }
452
489
 
453
490
  /**
@@ -496,7 +533,7 @@ var Selection = /*#__PURE__*/function () {
496
533
  key: "isSelectedByRowHeader",
497
534
  value: function isSelectedByRowHeader() {
498
535
  var layerLevel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getLayerLevel();
499
- return !this.isSelectedByCorner(layerLevel) && this.isEntireRowSelected(layerLevel);
536
+ return !this.isSelectedByCorner(layerLevel) && (layerLevel === -1 ? this.selectedByRowHeader.size > 0 : this.selectedByRowHeader.has(layerLevel));
500
537
  }
501
538
 
502
539
  /**
@@ -509,8 +546,22 @@ var Selection = /*#__PURE__*/function () {
509
546
  }, {
510
547
  key: "isEntireRowSelected",
511
548
  value: function isEntireRowSelected() {
549
+ var _this2 = this;
512
550
  var layerLevel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getLayerLevel();
513
- return layerLevel === -1 ? this.selectedByRowHeader.size > 0 : this.selectedByRowHeader.has(layerLevel);
551
+ var tester = function tester(range) {
552
+ var _range$getOuterTopSta = range.getOuterTopStartCorner(),
553
+ col = _range$getOuterTopSta.col;
554
+ var rowHeaders = _this2.tableProps.countRowHeaders();
555
+ var countCols = _this2.tableProps.countCols();
556
+ return (rowHeaders > 0 && col < 0 || rowHeaders === 0) && range.getWidth() === countCols;
557
+ };
558
+ if (layerLevel === -1) {
559
+ return Array.from(this.selectedRange).some(function (range) {
560
+ return tester(range);
561
+ });
562
+ }
563
+ var range = this.selectedRange.peekByIndex(layerLevel);
564
+ return range ? tester(range) : false;
514
565
  }
515
566
 
516
567
  /**
@@ -525,7 +576,7 @@ var Selection = /*#__PURE__*/function () {
525
576
  key: "isSelectedByColumnHeader",
526
577
  value: function isSelectedByColumnHeader() {
527
578
  var layerLevel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getLayerLevel();
528
- return !this.isSelectedByCorner() && this.isEntireColumnSelected(layerLevel);
579
+ return !this.isSelectedByCorner() && (layerLevel === -1 ? this.selectedByColumnHeader.size > 0 : this.selectedByColumnHeader.has(layerLevel));
529
580
  }
530
581
 
531
582
  /**
@@ -538,8 +589,22 @@ var Selection = /*#__PURE__*/function () {
538
589
  }, {
539
590
  key: "isEntireColumnSelected",
540
591
  value: function isEntireColumnSelected() {
592
+ var _this3 = this;
541
593
  var layerLevel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getLayerLevel();
542
- return layerLevel === -1 ? this.selectedByColumnHeader.size > 0 : this.selectedByColumnHeader.has(layerLevel);
594
+ var tester = function tester(range) {
595
+ var _range$getOuterTopSta2 = range.getOuterTopStartCorner(),
596
+ row = _range$getOuterTopSta2.row;
597
+ var colHeaders = _this3.tableProps.countColHeaders();
598
+ var countRows = _this3.tableProps.countRows();
599
+ return (colHeaders > 0 && row < 0 || colHeaders === 0) && range.getHeight() === countRows;
600
+ };
601
+ if (layerLevel === -1) {
602
+ return Array.from(this.selectedRange).some(function (range) {
603
+ return tester(range);
604
+ });
605
+ }
606
+ var range = this.selectedRange.peekByIndex(layerLevel);
607
+ return range ? tester(range) : false;
543
608
  }
544
609
 
545
610
  /**
@@ -561,7 +626,7 @@ var Selection = /*#__PURE__*/function () {
561
626
  }, {
562
627
  key: "isSelectedByCorner",
563
628
  value: function isSelectedByCorner() {
564
- return this.selectedByCorner;
629
+ return this.selectedByColumnHeader.has(this.getLayerLevel()) && this.selectedByRowHeader.has(this.getLayerLevel());
565
630
  }
566
631
 
567
632
  /**
@@ -630,31 +695,49 @@ var Selection = /*#__PURE__*/function () {
630
695
  }
631
696
 
632
697
  /**
633
- * Select all cells.
698
+ * Selects all cells and headers.
634
699
  *
635
- * @param {boolean} [includeRowHeaders=false] `true` If the selection should include the row headers, `false`
636
- * otherwise.
637
- * @param {boolean} [includeColumnHeaders=false] `true` If the selection should include the column headers, `false`
638
- * otherwise.
700
+ * @param {boolean} [includeRowHeaders=false] `true` If the selection should include the row headers,
701
+ * `false` otherwise.
702
+ * @param {boolean} [includeColumnHeaders=false] `true` If the selection should include the column
703
+ * headers, `false` otherwise.
704
+ * @param {{row: number, col: number}} [focusPosition] The argument allows changing the cell/header
705
+ * focus position. The value takes an object with a `row` and `col` properties from -N to N, where
706
+ * negative values point to the headers and positive values point to the cell range.
639
707
  */
640
708
  }, {
641
709
  key: "selectAll",
642
710
  value: function selectAll() {
643
711
  var includeRowHeaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
644
712
  var includeColumnHeaders = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
713
+ var focusPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
714
+ row: this.tableProps.countColHeaders() > 0 ? -this.tableProps.countColHeaders() : 0,
715
+ col: this.tableProps.countRowHeaders() > 0 ? -this.tableProps.countRowHeaders() : 0
716
+ };
645
717
  var nrOfRows = this.tableProps.countRows();
646
718
  var nrOfColumns = this.tableProps.countCols();
719
+ var countRowHeaders = this.tableProps.countRowHeaders();
720
+ var countColHeaders = this.tableProps.countColHeaders();
721
+ var rowFrom = includeRowHeaders ? -countColHeaders : 0;
722
+ var columnFrom = includeColumnHeaders ? -countRowHeaders : 0;
647
723
 
648
724
  // We can't select cells when there is no data.
649
- if (!includeRowHeaders && !includeColumnHeaders && (nrOfRows === 0 || nrOfColumns === 0)) {
725
+ if (rowFrom === 0 && columnFrom === 0 && (nrOfRows === 0 || nrOfColumns === 0)) {
650
726
  return;
651
727
  }
652
- var startCoords = this.tableProps.createCellCoords(includeColumnHeaders ? -1 : 0, includeRowHeaders ? -1 : 0);
728
+ var highlightRow = Number.isInteger(focusPosition.row) ? focusPosition.row : 0;
729
+ var highlightColumn = Number.isInteger(focusPosition.col) ? focusPosition.col : 0;
730
+ var startCoords = this.tableProps.createCellCoords(rowFrom, columnFrom);
731
+ var highlight = this.tableProps.createCellCoords((0, _number.clamp)(highlightRow, rowFrom, nrOfRows - 1), (0, _number.clamp)(highlightColumn, columnFrom, nrOfColumns - 1));
653
732
  var endCoords = this.tableProps.createCellCoords(nrOfRows - 1, nrOfColumns - 1);
654
733
  this.clear();
655
- this.setRangeStartOnly(startCoords);
656
- this.selectedByRowHeader.add(this.getLayerLevel());
657
- this.selectedByColumnHeader.add(this.getLayerLevel());
734
+ this.setRangeStartOnly(startCoords, void 0, highlight);
735
+ if (columnFrom < 0) {
736
+ this.selectedByRowHeader.add(this.getLayerLevel());
737
+ }
738
+ if (rowFrom < 0) {
739
+ this.selectedByColumnHeader.add(this.getLayerLevel());
740
+ }
658
741
  this.setRangeEnd(endCoords);
659
742
  this.finish();
660
743
  }
@@ -671,7 +754,7 @@ var Selection = /*#__PURE__*/function () {
671
754
  }, {
672
755
  key: "selectCells",
673
756
  value: function selectCells(selectionRanges) {
674
- var _this2 = this;
757
+ var _this4 = this;
675
758
  var selectionType = (0, _utils.detectSelectionType)(selectionRanges);
676
759
  if (selectionType === _utils.SELECTION_TYPE_EMPTY) {
677
760
  return false;
@@ -680,36 +763,33 @@ var Selection = /*#__PURE__*/function () {
680
763
  }
681
764
  var selectionSchemaNormalizer = (0, _utils.normalizeSelectionFactory)(selectionType, {
682
765
  propToCol: function propToCol(prop) {
683
- return _this2.tableProps.propToCol(prop);
766
+ return _this4.tableProps.propToCol(prop);
684
767
  },
685
768
  keepDirection: true
686
769
  });
687
- var nrOfRows = this.tableProps.countRows();
688
- var nrOfColumns = this.tableProps.countCols();
770
+ var navigableHeaders = this.settings.navigableHeaders;
771
+ var tableParams = {
772
+ countRows: this.tableProps.countRows(),
773
+ countCols: this.tableProps.countCols(),
774
+ countRowHeaders: navigableHeaders ? this.tableProps.countRowHeaders() : 0,
775
+ countColHeaders: navigableHeaders ? this.tableProps.countColHeaders() : 0
776
+ };
689
777
 
690
778
  // Check if every layer of the coordinates are valid.
691
779
  var isValid = !selectionRanges.some(function (selection) {
692
- var _selectionSchemaNorma = selectionSchemaNormalizer(selection),
693
- _selectionSchemaNorma2 = _slicedToArray(_selectionSchemaNorma, 4),
694
- rowStart = _selectionSchemaNorma2[0],
695
- columnStart = _selectionSchemaNorma2[1],
696
- rowEnd = _selectionSchemaNorma2[2],
697
- columnEnd = _selectionSchemaNorma2[3];
698
- var _isValid = (0, _utils.isValidCoord)(rowStart, nrOfRows) && (0, _utils.isValidCoord)(columnStart, nrOfColumns) && (0, _utils.isValidCoord)(rowEnd, nrOfRows) && (0, _utils.isValidCoord)(columnEnd, nrOfColumns);
699
- return !_isValid;
780
+ var cellRange = selectionSchemaNormalizer(selection);
781
+ var rangeValidity = cellRange.isValid(tableParams);
782
+ return !(rangeValidity && !cellRange.containsHeaders() || rangeValidity && cellRange.containsHeaders() && cellRange.isSingleHeader());
700
783
  });
701
784
  if (isValid) {
702
785
  this.clear();
703
786
  (0, _array.arrayEach)(selectionRanges, function (selection) {
704
- var _selectionSchemaNorma3 = selectionSchemaNormalizer(selection),
705
- _selectionSchemaNorma4 = _slicedToArray(_selectionSchemaNorma3, 4),
706
- rowStart = _selectionSchemaNorma4[0],
707
- columnStart = _selectionSchemaNorma4[1],
708
- rowEnd = _selectionSchemaNorma4[2],
709
- columnEnd = _selectionSchemaNorma4[3];
710
- _this2.setRangeStartOnly(_this2.tableProps.createCellCoords(rowStart, columnStart), false);
711
- _this2.setRangeEnd(_this2.tableProps.createCellCoords(rowEnd, columnEnd));
712
- _this2.finish();
787
+ var _selectionSchemaNorma = selectionSchemaNormalizer(selection),
788
+ from = _selectionSchemaNorma.from,
789
+ to = _selectionSchemaNorma.to;
790
+ _this4.setRangeStartOnly(from.clone(), false);
791
+ _this4.setRangeEnd(to.clone());
792
+ _this4.finish();
713
793
  });
714
794
  }
715
795
  return isValid;
@@ -721,24 +801,45 @@ var Selection = /*#__PURE__*/function () {
721
801
  *
722
802
  * @param {number|string} startColumn Visual column index or column property from which the selection starts.
723
803
  * @param {number|string} [endColumn] Visual column index or column property from to the selection finishes.
724
- * @param {number} [headerLevel=-1] A row header index that triggers the column selection. The value can
725
- * take -1 to -N, where -1 means the header closest to the cells.
726
- *
804
+ * @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
805
+ * The value can take visual row index from -N to N, where negative values
806
+ * point to the headers and positive values point to the cell range.
727
807
  * @returns {boolean} Returns `true` if selection was successful, `false` otherwise.
728
808
  */
729
809
  }, {
730
810
  key: "selectColumns",
731
811
  value: function selectColumns(startColumn) {
732
812
  var endColumn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startColumn;
733
- var headerLevel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
813
+ var focusPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
734
814
  var start = typeof startColumn === 'string' ? this.tableProps.propToCol(startColumn) : startColumn;
735
815
  var end = typeof endColumn === 'string' ? this.tableProps.propToCol(endColumn) : endColumn;
736
- var nrOfColumns = this.tableProps.countCols();
737
- var nrOfRows = this.tableProps.countRows();
738
- var isValid = (0, _utils.isValidCoord)(start, nrOfColumns) && (0, _utils.isValidCoord)(end, nrOfColumns);
816
+ var countRows = this.tableProps.countRows();
817
+ var countCols = this.tableProps.countCols();
818
+ var countColHeaders = this.tableProps.countColHeaders();
819
+ var columnHeaderLastIndex = countColHeaders === 0 ? 0 : -countColHeaders;
820
+ var fromCoords = new _src.CellCoords(columnHeaderLastIndex, start);
821
+ var toCoords = new _src.CellCoords(countRows - 1, end);
822
+ var isValid = new _src.CellRange(fromCoords, fromCoords, toCoords).isValid({
823
+ countRows: countRows,
824
+ countCols: countCols,
825
+ countRowHeaders: 0,
826
+ countColHeaders: countColHeaders
827
+ });
739
828
  if (isValid) {
740
- this.setRangeStartOnly(this.tableProps.createCellCoords(headerLevel, start));
741
- this.setRangeEnd(this.tableProps.createCellCoords(nrOfRows - 1, end));
829
+ var fromRow = countColHeaders === 0 ? 0 : (0, _number.clamp)(focusPosition, columnHeaderLastIndex, -1);
830
+ var toRow = countRows - 1;
831
+ var from = this.tableProps.createCellCoords(fromRow, start);
832
+ var to = this.tableProps.createCellCoords(toRow, end);
833
+ var highlight = this.tableProps.createCellCoords((0, _number.clamp)(focusPosition, columnHeaderLastIndex, countRows - 1), start);
834
+ this.runLocalHooks('beforeSelectColumns', from, to, highlight);
835
+
836
+ // disallow modifying row axis for that hooks
837
+ from.row = fromRow;
838
+ to.row = toRow;
839
+ this.setRangeStartOnly(from, void 0, highlight);
840
+ this.selectedByColumnHeader.add(this.getLayerLevel());
841
+ this.setRangeEnd(to);
842
+ this.runLocalHooks('afterSelectColumns', from, to, highlight);
742
843
  this.finish();
743
844
  }
744
845
  return isValid;
@@ -749,22 +850,43 @@ var Selection = /*#__PURE__*/function () {
749
850
  *
750
851
  * @param {number} startRow Visual row index from which the selection starts.
751
852
  * @param {number} [endRow] Visual row index from to the selection finishes.
752
- * @param {number} [headerLevel=-1] A column header index that triggers the row selection.
753
- * The value can take -1 to -N, where -1 means the header
754
- * closest to the cells.
853
+ * @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
854
+ * The value can take visual column index from -N to N, where negative values
855
+ * point to the headers and positive values point to the cell range.
755
856
  * @returns {boolean} Returns `true` if selection was successful, `false` otherwise.
756
857
  */
757
858
  }, {
758
859
  key: "selectRows",
759
860
  value: function selectRows(startRow) {
760
861
  var endRow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startRow;
761
- var headerLevel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
762
- var nrOfRows = this.tableProps.countRows();
763
- var nrOfColumns = this.tableProps.countCols();
764
- var isValid = (0, _utils.isValidCoord)(startRow, nrOfRows) && (0, _utils.isValidCoord)(endRow, nrOfRows);
862
+ var focusPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
863
+ var countRows = this.tableProps.countRows();
864
+ var countCols = this.tableProps.countCols();
865
+ var countRowHeaders = this.tableProps.countRowHeaders();
866
+ var rowHeaderLastIndex = countRowHeaders === 0 ? 0 : -countRowHeaders;
867
+ var fromCoords = new _src.CellCoords(startRow, rowHeaderLastIndex);
868
+ var toCoords = new _src.CellCoords(endRow, countCols - 1);
869
+ var isValid = new _src.CellRange(fromCoords, fromCoords, toCoords).isValid({
870
+ countRows: countRows,
871
+ countCols: countCols,
872
+ countRowHeaders: countRowHeaders,
873
+ countColHeaders: 0
874
+ });
765
875
  if (isValid) {
766
- this.setRangeStartOnly(this.tableProps.createCellCoords(startRow, headerLevel));
767
- this.setRangeEnd(this.tableProps.createCellCoords(endRow, nrOfColumns - 1));
876
+ var fromColumn = countRowHeaders === 0 ? 0 : (0, _number.clamp)(focusPosition, rowHeaderLastIndex, -1);
877
+ var toColumn = countCols - 1;
878
+ var from = this.tableProps.createCellCoords(startRow, fromColumn);
879
+ var to = this.tableProps.createCellCoords(endRow, toColumn);
880
+ var highlight = this.tableProps.createCellCoords(startRow, (0, _number.clamp)(focusPosition, rowHeaderLastIndex, countCols - 1));
881
+ this.runLocalHooks('beforeSelectRows', from, to, highlight);
882
+
883
+ // disallow modifying column axis for that hooks
884
+ from.col = fromColumn;
885
+ to.col = toColumn;
886
+ this.setRangeStartOnly(from, void 0, highlight);
887
+ this.selectedByRowHeader.add(this.getLayerLevel());
888
+ this.setRangeEnd(to);
889
+ this.runLocalHooks('afterSelectRows', from, to, highlight);
768
890
  this.finish();
769
891
  }
770
892
  return isValid;
@@ -783,19 +905,31 @@ var Selection = /*#__PURE__*/function () {
783
905
  if (!this.isSelected()) {
784
906
  return;
785
907
  }
786
- var cellHighlight = this.highlight.getCell();
908
+ var focusHighlight = this.highlight.getFocus();
787
909
  var currentLayer = this.getLayerLevel();
788
- cellHighlight.commit().syncWith(this.selectedRange.current());
910
+ focusHighlight.commit().syncWith(this.selectedRange.current());
789
911
 
790
912
  // Rewriting rendered ranges going through all layers.
791
913
  for (var layerLevel = 0; layerLevel < this.selectedRange.size(); layerLevel += 1) {
792
914
  this.highlight.useLayerLevel(layerLevel);
793
- var areaHighlight = this.highlight.createOrGetArea();
794
- var headerHighlight = this.highlight.createOrGetHeader();
795
- var activeHeaderHighlight = this.highlight.createOrGetActiveHeader();
915
+ var areaHighlight = this.highlight.createArea();
916
+ var areaLayeredHighlight = this.highlight.createLayeredArea();
917
+ var rowHeaderHighlight = this.highlight.createRowHeader();
918
+ var columnHeaderHighlight = this.highlight.createColumnHeader();
919
+ var activeRowHeaderHighlight = this.highlight.createActiveRowHeader();
920
+ var activeColumnHeaderHighlight = this.highlight.createActiveColumnHeader();
921
+ var activeCornerHeaderHighlight = this.highlight.createActiveCornerHeader();
922
+ var rowHighlight = this.highlight.createRowHighlight();
923
+ var columnHighlight = this.highlight.createColumnHighlight();
796
924
  areaHighlight.commit();
797
- headerHighlight.commit();
798
- activeHeaderHighlight.commit();
925
+ areaLayeredHighlight.commit();
926
+ rowHeaderHighlight.commit();
927
+ columnHeaderHighlight.commit();
928
+ activeRowHeaderHighlight.commit();
929
+ activeColumnHeaderHighlight.commit();
930
+ activeCornerHeaderHighlight.commit();
931
+ rowHighlight.commit();
932
+ columnHighlight.commit();
799
933
  }
800
934
 
801
935
  // Reverting starting layer for the Highlight.