handsontable 0.0.0-next-2b3d6d8-20230623 → 0.0.0-next-74a68c1-20230627

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 (279) 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/base.js +2 -2
  52. package/base.mjs +2 -2
  53. package/core.d.ts +5 -3
  54. package/core.js +127 -309
  55. package/core.mjs +127 -309
  56. package/dataMap/metaManager/metaSchema.js +19 -0
  57. package/dataMap/metaManager/metaSchema.mjs +19 -0
  58. package/dist/handsontable.css +8 -3
  59. package/dist/handsontable.full.css +8 -3
  60. package/dist/handsontable.full.js +13762 -10716
  61. package/dist/handsontable.full.min.css +3 -3
  62. package/dist/handsontable.full.min.js +115 -115
  63. package/dist/handsontable.js +16626 -13580
  64. package/dist/handsontable.min.css +3 -3
  65. package/dist/handsontable.min.js +4 -4
  66. package/editorManager.js +21 -94
  67. package/editorManager.mjs +26 -98
  68. package/editors/textEditor/textEditor.js +3 -11
  69. package/editors/textEditor/textEditor.mjs +4 -12
  70. package/helpers/mixed.js +1 -1
  71. package/helpers/mixed.mjs +1 -1
  72. package/helpers/number.d.ts +1 -0
  73. package/helpers/number.js +18 -0
  74. package/helpers/number.mjs +17 -0
  75. package/package.json +1 -1
  76. package/pluginHooks.d.ts +5 -1
  77. package/pluginHooks.js +89 -1
  78. package/pluginHooks.mjs +89 -1
  79. package/plugins/collapsibleColumns/collapsibleColumns.js +81 -24
  80. package/plugins/collapsibleColumns/collapsibleColumns.mjs +81 -24
  81. package/plugins/columnSorting/columnSorting.js +50 -8
  82. package/plugins/columnSorting/columnSorting.mjs +49 -9
  83. package/plugins/columnSorting/index.js +4 -2
  84. package/plugins/columnSorting/index.mjs +1 -1
  85. package/plugins/comments/comments.js +11 -4
  86. package/plugins/comments/comments.mjs +11 -4
  87. package/plugins/contextMenu/contextMenu.d.ts +1 -1
  88. package/plugins/contextMenu/contextMenu.js +80 -29
  89. package/plugins/contextMenu/contextMenu.mjs +81 -30
  90. package/plugins/contextMenu/predefinedItems/alignment.js +7 -0
  91. package/plugins/contextMenu/predefinedItems/alignment.mjs +7 -0
  92. package/plugins/contextMenu/predefinedItems/clearColumn.js +5 -3
  93. package/plugins/contextMenu/predefinedItems/clearColumn.mjs +5 -3
  94. package/plugins/contextMenu/predefinedItems/columnLeft.js +5 -3
  95. package/plugins/contextMenu/predefinedItems/columnLeft.mjs +5 -3
  96. package/plugins/contextMenu/predefinedItems/columnRight.js +5 -3
  97. package/plugins/contextMenu/predefinedItems/columnRight.mjs +5 -3
  98. package/plugins/contextMenu/predefinedItems/readOnly.js +7 -0
  99. package/plugins/contextMenu/predefinedItems/readOnly.mjs +7 -0
  100. package/plugins/contextMenu/predefinedItems/removeColumn.js +7 -5
  101. package/plugins/contextMenu/predefinedItems/removeColumn.mjs +5 -3
  102. package/plugins/contextMenu/predefinedItems/removeRow.js +7 -5
  103. package/plugins/contextMenu/predefinedItems/removeRow.mjs +5 -3
  104. package/plugins/contextMenu/predefinedItems/rowAbove.js +5 -3
  105. package/plugins/contextMenu/predefinedItems/rowAbove.mjs +5 -3
  106. package/plugins/contextMenu/predefinedItems/rowBelow.js +5 -3
  107. package/plugins/contextMenu/predefinedItems/rowBelow.mjs +5 -3
  108. package/plugins/contextMenu/utils.js +25 -16
  109. package/plugins/contextMenu/utils.mjs +24 -15
  110. package/plugins/copyPaste/contextMenuItem/copy.js +7 -0
  111. package/plugins/copyPaste/contextMenuItem/copy.mjs +7 -0
  112. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.js +9 -1
  113. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs +9 -1
  114. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.js +9 -1
  115. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs +9 -1
  116. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.js +9 -1
  117. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs +9 -1
  118. package/plugins/copyPaste/contextMenuItem/cut.js +7 -0
  119. package/plugins/copyPaste/contextMenuItem/cut.mjs +7 -0
  120. package/plugins/copyPaste/copyPaste.js +5 -1
  121. package/plugins/copyPaste/copyPaste.mjs +5 -1
  122. package/plugins/customBorders/customBorders.js +25 -53
  123. package/plugins/customBorders/customBorders.mjs +26 -54
  124. package/plugins/dropdownMenu/dropdownMenu.d.ts +1 -1
  125. package/plugins/dropdownMenu/dropdownMenu.js +94 -30
  126. package/plugins/dropdownMenu/dropdownMenu.mjs +94 -30
  127. package/plugins/filters/filters.js +62 -42
  128. package/plugins/filters/filters.mjs +61 -41
  129. package/plugins/mergeCells/mergeCells.js +5 -18
  130. package/plugins/mergeCells/mergeCells.mjs +5 -18
  131. package/plugins/multiColumnSorting/multiColumnSorting.js +42 -3
  132. package/plugins/multiColumnSorting/multiColumnSorting.mjs +42 -3
  133. package/plugins/nestedHeaders/nestedHeaders.js +132 -10
  134. package/plugins/nestedHeaders/nestedHeaders.mjs +132 -10
  135. package/plugins/nestedHeaders/stateManager/index.js +37 -0
  136. package/plugins/nestedHeaders/stateManager/index.mjs +37 -0
  137. package/plugins/nestedRows/nestedRows.js +52 -7
  138. package/plugins/nestedRows/nestedRows.mjs +52 -7
  139. package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
  140. package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
  141. package/selection/highlight/highlight.js +312 -89
  142. package/selection/highlight/highlight.mjs +302 -85
  143. package/selection/highlight/types/activeHeader.js +10 -9
  144. package/selection/highlight/types/activeHeader.mjs +10 -8
  145. package/selection/highlight/types/area.js +12 -27
  146. package/selection/highlight/types/area.mjs +16 -30
  147. package/selection/highlight/types/areaLayered.js +54 -0
  148. package/selection/highlight/types/areaLayered.mjs +49 -0
  149. package/selection/highlight/types/column.js +50 -0
  150. package/selection/highlight/types/column.mjs +45 -0
  151. package/selection/highlight/types/customSelection.js +7 -10
  152. package/selection/highlight/types/customSelection.mjs +7 -9
  153. package/selection/highlight/types/fill.js +5 -8
  154. package/selection/highlight/types/fill.mjs +5 -7
  155. package/selection/highlight/types/{cell.js → focus.js} +5 -8
  156. package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
  157. package/selection/highlight/types/header.js +10 -20
  158. package/selection/highlight/types/header.mjs +10 -19
  159. package/selection/highlight/types/{index.js → row.js} +27 -31
  160. package/selection/highlight/types/{index.mjs → row.mjs} +24 -29
  161. package/selection/highlight/visualSelection.js +31 -27
  162. package/selection/highlight/visualSelection.mjs +31 -27
  163. package/selection/index.js +4 -7
  164. package/selection/index.mjs +2 -3
  165. package/selection/mouseEventHandler.js +1 -1
  166. package/selection/mouseEventHandler.mjs +1 -1
  167. package/selection/range.js +8 -8
  168. package/selection/range.mjs +8 -8
  169. package/selection/selection.js +315 -181
  170. package/selection/selection.mjs +310 -180
  171. package/selection/transformation.js +233 -96
  172. package/selection/transformation.mjs +230 -93
  173. package/selection/utils.js +12 -36
  174. package/selection/utils.mjs +13 -36
  175. package/settings.d.ts +1 -0
  176. package/shortcutContexts/commands/editor/closeAndSave.js +15 -0
  177. package/shortcutContexts/commands/editor/closeAndSave.mjs +10 -0
  178. package/shortcutContexts/commands/editor/closeWithoutSaving.js +13 -0
  179. package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +8 -0
  180. package/shortcutContexts/commands/editor/fastOpen.js +16 -0
  181. package/shortcutContexts/commands/editor/fastOpen.mjs +11 -0
  182. package/shortcutContexts/commands/editor/index.js +16 -0
  183. package/shortcutContexts/commands/editor/index.mjs +12 -0
  184. package/shortcutContexts/commands/editor/open.js +29 -0
  185. package/shortcutContexts/commands/editor/open.mjs +24 -0
  186. package/shortcutContexts/commands/emptySelectedCells.js +12 -0
  187. package/shortcutContexts/commands/emptySelectedCells.mjs +7 -0
  188. package/shortcutContexts/commands/extendCellsSelection/down.js +15 -0
  189. package/shortcutContexts/commands/extendCellsSelection/down.mjs +10 -0
  190. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +21 -0
  191. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +16 -0
  192. package/shortcutContexts/commands/extendCellsSelection/index.js +26 -0
  193. package/shortcutContexts/commands/extendCellsSelection/index.mjs +22 -0
  194. package/shortcutContexts/commands/extendCellsSelection/left.js +15 -0
  195. package/shortcutContexts/commands/extendCellsSelection/left.mjs +10 -0
  196. package/shortcutContexts/commands/extendCellsSelection/right.js +15 -0
  197. package/shortcutContexts/commands/extendCellsSelection/right.mjs +10 -0
  198. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +19 -0
  199. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +14 -0
  200. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +22 -0
  201. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +17 -0
  202. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +17 -0
  203. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +12 -0
  204. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +17 -0
  205. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +12 -0
  206. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +40 -0
  207. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +35 -0
  208. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +40 -0
  209. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +35 -0
  210. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +22 -0
  211. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +17 -0
  212. package/shortcutContexts/commands/extendCellsSelection/toRows.js +19 -0
  213. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +14 -0
  214. package/shortcutContexts/commands/extendCellsSelection/up.js +15 -0
  215. package/shortcutContexts/commands/extendCellsSelection/up.mjs +10 -0
  216. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +21 -0
  217. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +16 -0
  218. package/shortcutContexts/commands/index.js +53 -0
  219. package/shortcutContexts/commands/index.mjs +49 -0
  220. package/shortcutContexts/commands/moveCellSelection/down.js +12 -0
  221. package/shortcutContexts/commands/moveCellSelection/down.mjs +7 -0
  222. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +29 -0
  223. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +24 -0
  224. package/shortcutContexts/commands/moveCellSelection/index.js +28 -0
  225. package/shortcutContexts/commands/moveCellSelection/index.mjs +24 -0
  226. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +13 -0
  227. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -0
  228. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +13 -0
  229. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -0
  230. package/shortcutContexts/commands/moveCellSelection/left.js +11 -0
  231. package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -0
  232. package/shortcutContexts/commands/moveCellSelection/right.js +11 -0
  233. package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -0
  234. package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +16 -0
  235. package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +11 -0
  236. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +17 -0
  237. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +12 -0
  238. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +13 -0
  239. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +8 -0
  240. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +16 -0
  241. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +11 -0
  242. package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +36 -0
  243. package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +31 -0
  244. package/shortcutContexts/commands/moveCellSelection/toMostRight.js +36 -0
  245. package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +31 -0
  246. package/shortcutContexts/commands/moveCellSelection/toMostTop.js +16 -0
  247. package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +11 -0
  248. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +18 -0
  249. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +13 -0
  250. package/shortcutContexts/commands/moveCellSelection/up.js +12 -0
  251. package/shortcutContexts/commands/moveCellSelection/up.mjs +7 -0
  252. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +29 -0
  253. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +24 -0
  254. package/shortcutContexts/commands/populateSelectedCellsData.js +35 -0
  255. package/shortcutContexts/commands/populateSelectedCellsData.mjs +30 -0
  256. package/shortcutContexts/commands/scrollToFocusedCell.js +38 -0
  257. package/shortcutContexts/commands/scrollToFocusedCell.mjs +33 -0
  258. package/shortcutContexts/commands/selectAll.js +11 -0
  259. package/shortcutContexts/commands/selectAll.mjs +6 -0
  260. package/shortcutContexts/constants.js +19 -0
  261. package/shortcutContexts/constants.mjs +12 -0
  262. package/shortcutContexts/editor.js +29 -0
  263. package/shortcutContexts/editor.mjs +25 -0
  264. package/shortcutContexts/grid.js +252 -0
  265. package/shortcutContexts/grid.mjs +248 -0
  266. package/shortcutContexts/index.js +29 -0
  267. package/shortcutContexts/index.mjs +15 -0
  268. package/shortcuts/manager.js +2 -0
  269. package/shortcuts/manager.mjs +2 -0
  270. package/shortcuts/recorder.js +2 -2
  271. package/shortcuts/recorder.mjs +2 -2
  272. package/shortcuts/utils.js +21 -5
  273. package/shortcuts/utils.mjs +20 -4
  274. package/tableView.js +58 -9
  275. package/tableView.mjs +58 -9
  276. package/3rdparty/walkontable/src/selection.js +0 -355
  277. package/3rdparty/walkontable/src/selection.mjs +0 -349
  278. package/selection/highlight/constants.js +0 -16
  279. package/selection/highlight/constants.mjs +0 -6
@@ -6,6 +6,10 @@ import "core-js/modules/web.dom-collections.iterator.js";
6
6
  import "core-js/modules/es.array.join.js";
7
7
  import "core-js/modules/es.array.sort.js";
8
8
  import "core-js/modules/es.array.map.js";
9
+ import "core-js/modules/es.regexp.constructor.js";
10
+ import "core-js/modules/es.regexp.exec.js";
11
+ import "core-js/modules/es.regexp.to-string.js";
12
+ import "core-js/modules/es.string.replace.js";
9
13
  // This file handles key-name discrepancies between browsers.
10
14
  // For the list of discrepancies, go to: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values.
11
15
  var mappings = new Map([[' ', 'space'],
@@ -41,11 +45,23 @@ export var getKeysList = function getKeysList(normalizedKeys) {
41
45
  };
42
46
 
43
47
  /**
44
- * Normalize a `KeyboardEvent.key` property, to use it for keyboard shortcuts.
48
+ * The regex tests if the event.code matches to the pattern and it's used to extract letters and digits from
49
+ * the string.
50
+ */
51
+ var codeToKeyRegExp = new RegExp('^(?:Key|Digit)([A-Z0-9])$');
52
+
53
+ /**
54
+ * Normalizes a keyboard event key value to a key before its modification. When the keyboard event
55
+ * is triggered with Alt, Control or Shift keys the `key` property contains modified key e.g. for Alt+L
56
+ * it will be `ł`. But that value is only valid for polish keyboard layout. To fix that limitations, for
57
+ * letters and digits the value is taken from the `code` property which holds original value before
58
+ * transformation.
45
59
  *
46
- * @param {string} key KeyboardEvent's key property.
60
+ * @param {Event} event The KeyboardEvent object.
47
61
  * @returns {string}
48
62
  */
49
- export var normalizeEventKey = function normalizeEventKey(key) {
50
- return key.toLowerCase();
63
+ export var normalizeEventKey = function normalizeEventKey(_ref) {
64
+ var key = _ref.key,
65
+ code = _ref.code;
66
+ return (codeToKeyRegExp.test(code) ? code.replace(codeToKeyRegExp, '$1') : key).toLowerCase();
51
67
  };
package/tableView.js CHANGED
@@ -613,6 +613,44 @@ var TableView = /*#__PURE__*/function () {
613
613
  return this.countNotHiddenRowIndexes(visualFixedRowsBottom, 1);
614
614
  }
615
615
 
616
+ /**
617
+ * The function returns the number of renderable column indexes within the passed range of the visual indexes.
618
+ *
619
+ * @param {number} columnStart The column visual start index.
620
+ * @param {number} columnEnd The column visual end index.
621
+ * @returns {number}
622
+ */
623
+ }, {
624
+ key: "countRenderableColumnsInRange",
625
+ value: function countRenderableColumnsInRange(columnStart, columnEnd) {
626
+ var count = 0;
627
+ for (var column = columnStart; column <= columnEnd; column++) {
628
+ if (this.instance.columnIndexMapper.getRenderableFromVisualIndex(column) !== null) {
629
+ count += 1;
630
+ }
631
+ }
632
+ return count;
633
+ }
634
+
635
+ /**
636
+ * The function returns the number of renderable row indexes within the passed range of the visual indexes.
637
+ *
638
+ * @param {number} rowStart The row visual start index.
639
+ * @param {number} rowEnd The row visual end index.
640
+ * @returns {number}
641
+ */
642
+ }, {
643
+ key: "countRenderableRowsInRange",
644
+ value: function countRenderableRowsInRange(rowStart, rowEnd) {
645
+ var count = 0;
646
+ for (var row = rowStart; row <= rowEnd; row++) {
647
+ if (this.instance.rowIndexMapper.getRenderableFromVisualIndex(row) !== null) {
648
+ count += 1;
649
+ }
650
+ }
651
+ return count;
652
+ }
653
+
616
654
  /**
617
655
  * Checks if at least one cell than belongs to the main table is not covered by the top, left or
618
656
  * bottom overlay.
@@ -884,15 +922,29 @@ var TableView = /*#__PURE__*/function () {
884
922
  },
885
923
  onBeforeHighlightingRowHeader: function onBeforeHighlightingRowHeader(renderableRow, headerLevel, highlightMeta) {
886
924
  var rowMapper = _this2.instance.rowIndexMapper;
887
- var visualRow = rowMapper.getVisualFromRenderableIndex(renderableRow);
925
+ var areColumnHeadersSelected = renderableRow < 0;
926
+ var visualRow = renderableRow;
927
+ if (!areColumnHeadersSelected) {
928
+ visualRow = rowMapper.getVisualFromRenderableIndex(renderableRow);
929
+ }
888
930
  var newVisualRow = _this2.instance.runHooks('beforeHighlightingRowHeader', visualRow, headerLevel, highlightMeta);
889
- return rowMapper.getRenderableFromVisualIndex(rowMapper.getNearestNotHiddenIndex(newVisualRow, 1));
931
+ if (!areColumnHeadersSelected) {
932
+ return rowMapper.getRenderableFromVisualIndex(rowMapper.getNearestNotHiddenIndex(newVisualRow, 1));
933
+ }
934
+ return newVisualRow;
890
935
  },
891
936
  onBeforeHighlightingColumnHeader: function onBeforeHighlightingColumnHeader(renderableColumn, headerLevel, highlightMeta) {
892
937
  var columnMapper = _this2.instance.columnIndexMapper;
893
- var visualColumn = columnMapper.getVisualFromRenderableIndex(renderableColumn);
938
+ var areRowHeadersSelected = renderableColumn < 0;
939
+ var visualColumn = renderableColumn;
940
+ if (!areRowHeadersSelected) {
941
+ visualColumn = columnMapper.getVisualFromRenderableIndex(renderableColumn);
942
+ }
894
943
  var newVisualColumn = _this2.instance.runHooks('beforeHighlightingColumnHeader', visualColumn, headerLevel, highlightMeta);
895
- return columnMapper.getRenderableFromVisualIndex(columnMapper.getNearestNotHiddenIndex(newVisualColumn, 1));
944
+ if (!areRowHeadersSelected) {
945
+ return columnMapper.getRenderableFromVisualIndex(columnMapper.getNearestNotHiddenIndex(newVisualColumn, 1));
946
+ }
947
+ return newVisualColumn;
896
948
  },
897
949
  onAfterDrawSelection: function onAfterDrawSelection(currentRow, currentColumn, layerLevel) {
898
950
  var cornersOfSelection;
@@ -903,10 +955,7 @@ var TableView = /*#__PURE__*/function () {
903
955
  var selectedRange = _this2.instance.selection.getSelectedRange();
904
956
  var selectionRangeSize = selectedRange.size();
905
957
  if (selectionRangeSize > 0) {
906
- // Selection layers are stored from the "oldest" to the "newest". We should calculate the offset.
907
- // Please look at the `SelectedRange` class and it's method for getting selection's layer for more information.
908
- var selectionOffset = (layerLevel !== null && layerLevel !== void 0 ? layerLevel : 0) + 1 - selectionRangeSize;
909
- var selectionForLayer = selectedRange.peekByIndex(selectionOffset);
958
+ var selectionForLayer = selectedRange.peekByIndex(layerLevel !== null && layerLevel !== void 0 ? layerLevel : 0);
910
959
  cornersOfSelection = [selectionForLayer.from.row, selectionForLayer.from.col, selectionForLayer.to.row, selectionForLayer.to.col];
911
960
  }
912
961
  return _this2.instance.runHooks('afterDrawSelection', visualRowIndex, visualColumnIndex, cornersOfSelection, layerLevel);
@@ -1080,7 +1129,7 @@ var TableView = /*#__PURE__*/function () {
1080
1129
  key: "isSelectedOnlyCell",
1081
1130
  value: function isSelectedOnlyCell() {
1082
1131
  var _this$instance$getSel, _this$instance$getSel2;
1083
- return (_this$instance$getSel = (_this$instance$getSel2 = this.instance.getSelectedRangeLast()) === null || _this$instance$getSel2 === void 0 ? void 0 : _this$instance$getSel2.isSingle()) !== null && _this$instance$getSel !== void 0 ? _this$instance$getSel : false;
1132
+ return (_this$instance$getSel = (_this$instance$getSel2 = this.instance.getSelectedRangeLast()) === null || _this$instance$getSel2 === void 0 ? void 0 : _this$instance$getSel2.isSingleCell()) !== null && _this$instance$getSel !== void 0 ? _this$instance$getSel : false;
1084
1133
  }
1085
1134
 
1086
1135
  /**
package/tableView.mjs CHANGED
@@ -608,6 +608,44 @@ var TableView = /*#__PURE__*/function () {
608
608
  return this.countNotHiddenRowIndexes(visualFixedRowsBottom, 1);
609
609
  }
610
610
 
611
+ /**
612
+ * The function returns the number of renderable column indexes within the passed range of the visual indexes.
613
+ *
614
+ * @param {number} columnStart The column visual start index.
615
+ * @param {number} columnEnd The column visual end index.
616
+ * @returns {number}
617
+ */
618
+ }, {
619
+ key: "countRenderableColumnsInRange",
620
+ value: function countRenderableColumnsInRange(columnStart, columnEnd) {
621
+ var count = 0;
622
+ for (var column = columnStart; column <= columnEnd; column++) {
623
+ if (this.instance.columnIndexMapper.getRenderableFromVisualIndex(column) !== null) {
624
+ count += 1;
625
+ }
626
+ }
627
+ return count;
628
+ }
629
+
630
+ /**
631
+ * The function returns the number of renderable row indexes within the passed range of the visual indexes.
632
+ *
633
+ * @param {number} rowStart The row visual start index.
634
+ * @param {number} rowEnd The row visual end index.
635
+ * @returns {number}
636
+ */
637
+ }, {
638
+ key: "countRenderableRowsInRange",
639
+ value: function countRenderableRowsInRange(rowStart, rowEnd) {
640
+ var count = 0;
641
+ for (var row = rowStart; row <= rowEnd; row++) {
642
+ if (this.instance.rowIndexMapper.getRenderableFromVisualIndex(row) !== null) {
643
+ count += 1;
644
+ }
645
+ }
646
+ return count;
647
+ }
648
+
611
649
  /**
612
650
  * Checks if at least one cell than belongs to the main table is not covered by the top, left or
613
651
  * bottom overlay.
@@ -879,15 +917,29 @@ var TableView = /*#__PURE__*/function () {
879
917
  },
880
918
  onBeforeHighlightingRowHeader: function onBeforeHighlightingRowHeader(renderableRow, headerLevel, highlightMeta) {
881
919
  var rowMapper = _this2.instance.rowIndexMapper;
882
- var visualRow = rowMapper.getVisualFromRenderableIndex(renderableRow);
920
+ var areColumnHeadersSelected = renderableRow < 0;
921
+ var visualRow = renderableRow;
922
+ if (!areColumnHeadersSelected) {
923
+ visualRow = rowMapper.getVisualFromRenderableIndex(renderableRow);
924
+ }
883
925
  var newVisualRow = _this2.instance.runHooks('beforeHighlightingRowHeader', visualRow, headerLevel, highlightMeta);
884
- return rowMapper.getRenderableFromVisualIndex(rowMapper.getNearestNotHiddenIndex(newVisualRow, 1));
926
+ if (!areColumnHeadersSelected) {
927
+ return rowMapper.getRenderableFromVisualIndex(rowMapper.getNearestNotHiddenIndex(newVisualRow, 1));
928
+ }
929
+ return newVisualRow;
885
930
  },
886
931
  onBeforeHighlightingColumnHeader: function onBeforeHighlightingColumnHeader(renderableColumn, headerLevel, highlightMeta) {
887
932
  var columnMapper = _this2.instance.columnIndexMapper;
888
- var visualColumn = columnMapper.getVisualFromRenderableIndex(renderableColumn);
933
+ var areRowHeadersSelected = renderableColumn < 0;
934
+ var visualColumn = renderableColumn;
935
+ if (!areRowHeadersSelected) {
936
+ visualColumn = columnMapper.getVisualFromRenderableIndex(renderableColumn);
937
+ }
889
938
  var newVisualColumn = _this2.instance.runHooks('beforeHighlightingColumnHeader', visualColumn, headerLevel, highlightMeta);
890
- return columnMapper.getRenderableFromVisualIndex(columnMapper.getNearestNotHiddenIndex(newVisualColumn, 1));
939
+ if (!areRowHeadersSelected) {
940
+ return columnMapper.getRenderableFromVisualIndex(columnMapper.getNearestNotHiddenIndex(newVisualColumn, 1));
941
+ }
942
+ return newVisualColumn;
891
943
  },
892
944
  onAfterDrawSelection: function onAfterDrawSelection(currentRow, currentColumn, layerLevel) {
893
945
  var cornersOfSelection;
@@ -898,10 +950,7 @@ var TableView = /*#__PURE__*/function () {
898
950
  var selectedRange = _this2.instance.selection.getSelectedRange();
899
951
  var selectionRangeSize = selectedRange.size();
900
952
  if (selectionRangeSize > 0) {
901
- // Selection layers are stored from the "oldest" to the "newest". We should calculate the offset.
902
- // Please look at the `SelectedRange` class and it's method for getting selection's layer for more information.
903
- var selectionOffset = (layerLevel !== null && layerLevel !== void 0 ? layerLevel : 0) + 1 - selectionRangeSize;
904
- var selectionForLayer = selectedRange.peekByIndex(selectionOffset);
953
+ var selectionForLayer = selectedRange.peekByIndex(layerLevel !== null && layerLevel !== void 0 ? layerLevel : 0);
905
954
  cornersOfSelection = [selectionForLayer.from.row, selectionForLayer.from.col, selectionForLayer.to.row, selectionForLayer.to.col];
906
955
  }
907
956
  return _this2.instance.runHooks('afterDrawSelection', visualRowIndex, visualColumnIndex, cornersOfSelection, layerLevel);
@@ -1075,7 +1124,7 @@ var TableView = /*#__PURE__*/function () {
1075
1124
  key: "isSelectedOnlyCell",
1076
1125
  value: function isSelectedOnlyCell() {
1077
1126
  var _this$instance$getSel, _this$instance$getSel2;
1078
- return (_this$instance$getSel = (_this$instance$getSel2 = this.instance.getSelectedRangeLast()) === null || _this$instance$getSel2 === void 0 ? void 0 : _this$instance$getSel2.isSingle()) !== null && _this$instance$getSel !== void 0 ? _this$instance$getSel : false;
1127
+ return (_this$instance$getSel = (_this$instance$getSel2 = this.instance.getSelectedRangeLast()) === null || _this$instance$getSel2 === void 0 ? void 0 : _this$instance$getSel2.isSingleCell()) !== null && _this$instance$getSel !== void 0 ? _this$instance$getSel : false;
1079
1128
  }
1080
1129
 
1081
1130
  /**
@@ -1,355 +0,0 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.symbol.iterator.js");
4
- require("core-js/modules/es.array.iterator.js");
5
- require("core-js/modules/es.string.iterator.js");
6
- require("core-js/modules/web.dom-collections.iterator.js");
7
- require("core-js/modules/es.array.slice.js");
8
- require("core-js/modules/es.regexp.to-string.js");
9
- require("core-js/modules/es.function.name.js");
10
- require("core-js/modules/es.array.from.js");
11
- require("core-js/modules/es.regexp.exec.js");
12
- exports.__esModule = true;
13
- exports.default = void 0;
14
- require("core-js/modules/es.array.includes.js");
15
- require("core-js/modules/es.string.includes.js");
16
- require("core-js/modules/es.array.concat.js");
17
- require("core-js/modules/es.object.to-string.js");
18
- require("core-js/modules/web.dom-collections.for-each.js");
19
- require("core-js/modules/es.object.values.js");
20
- require("core-js/modules/es.symbol.to-primitive.js");
21
- require("core-js/modules/es.date.to-primitive.js");
22
- require("core-js/modules/es.symbol.js");
23
- require("core-js/modules/es.symbol.description.js");
24
- require("core-js/modules/es.number.constructor.js");
25
- var _element = require("./../../../helpers/dom/element");
26
- var _border = _interopRequireDefault(require("./border"));
27
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
28
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
29
- 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."); }
30
- 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); }
31
- 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; }
32
- 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; } }
33
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
34
- 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); }
35
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
36
- 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); } }
37
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
38
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
39
- 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); }
40
- /**
41
- * @class Selection
42
- */
43
- var Selection = /*#__PURE__*/function () {
44
- /**
45
- * @param {object} settings The selection settings object. @todo type.
46
- * @param {CellRange} cellRange The cell range instance.
47
- */
48
- function Selection(settings, cellRange) {
49
- _classCallCheck(this, Selection);
50
- this.settings = settings;
51
- this.cellRange = cellRange || null;
52
- this.instanceBorders = {};
53
- this.classNames = [this.settings.className];
54
- this.classNameGenerator = this.linearClassNameGenerator(this.settings.className, this.settings.layerLevel);
55
- }
56
-
57
- /**
58
- * Each Walkontable clone requires it's own border for every selection. This method creates and returns selection
59
- * borders per instance.
60
- *
61
- * @param {WalkontableFacade} wotInstance The Walkontable instance.
62
- * @returns {Border}
63
- */
64
- _createClass(Selection, [{
65
- key: "getBorder",
66
- value: function getBorder(wotInstance) {
67
- if (!this.instanceBorders[wotInstance.guid]) {
68
- this.instanceBorders[wotInstance.guid] = new _border.default(wotInstance, this.settings);
69
- }
70
- return this.instanceBorders[wotInstance.guid];
71
- }
72
-
73
- /**
74
- * Checks if selection is empty.
75
- *
76
- * @returns {boolean}
77
- */
78
- }, {
79
- key: "isEmpty",
80
- value: function isEmpty() {
81
- return this.cellRange === null;
82
- }
83
-
84
- /**
85
- * Adds a cell coords to the selection.
86
- *
87
- * @param {CellCoords} coords The cell coordinates to add.
88
- * @returns {Selection}
89
- */
90
- }, {
91
- key: "add",
92
- value: function add(coords) {
93
- if (this.isEmpty()) {
94
- this.cellRange = this.settings.createCellRange(coords);
95
- } else {
96
- this.cellRange.expand(coords);
97
- }
98
- return this;
99
- }
100
-
101
- /**
102
- * If selection range from or to property equals oldCoords, replace it with newCoords. Return boolean
103
- * information about success.
104
- *
105
- * @param {CellCoords} oldCoords An old cell coordinates to replace.
106
- * @param {CellCoords} newCoords The new cell coordinates.
107
- * @returns {boolean}
108
- */
109
- }, {
110
- key: "replace",
111
- value: function replace(oldCoords, newCoords) {
112
- if (!this.isEmpty()) {
113
- if (this.cellRange.from.isEqual(oldCoords)) {
114
- this.cellRange.from = newCoords;
115
- return true;
116
- }
117
- if (this.cellRange.to.isEqual(oldCoords)) {
118
- this.cellRange.to = newCoords;
119
- return true;
120
- }
121
- }
122
- return false;
123
- }
124
-
125
- /**
126
- * Clears selection.
127
- *
128
- * @returns {Selection}
129
- */
130
- }, {
131
- key: "clear",
132
- value: function clear() {
133
- this.cellRange = null;
134
- return this;
135
- }
136
-
137
- /**
138
- * Returns the top left (or top right in RTL) and bottom right (or bottom left in RTL) selection coordinates.
139
- *
140
- * @returns {Array} Returns array of coordinates for example `[1, 1, 5, 5]`.
141
- */
142
- }, {
143
- key: "getCorners",
144
- value: function getCorners() {
145
- var topStart = this.cellRange.getOuterTopStartCorner();
146
- var bottomEnd = this.cellRange.getOuterBottomEndCorner();
147
- return [topStart.row, topStart.col, bottomEnd.row, bottomEnd.col];
148
- }
149
-
150
- /**
151
- * Adds class name to cell element at given coords.
152
- *
153
- * @param {WalkontableFacade} wotInstance Walkontable instance.
154
- * @param {number} sourceRow Cell row coord.
155
- * @param {number} sourceColumn Cell column coord.
156
- * @param {string} className Class name.
157
- * @param {boolean} [markIntersections=false] If `true`, linear className generator will be used to add CSS classes
158
- * in a continuous way.
159
- * @returns {Selection}
160
- */
161
- }, {
162
- key: "addClassAtCoords",
163
- value: function addClassAtCoords(wotInstance, sourceRow, sourceColumn, className) {
164
- var markIntersections = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
165
- var TD = wotInstance.wtTable.getCell(this.settings.createCellCoords(sourceRow, sourceColumn));
166
- if (_typeof(TD) === 'object') {
167
- var cellClassName = className;
168
- if (markIntersections) {
169
- cellClassName = this.classNameGenerator(TD);
170
- if (!this.classNames.includes(cellClassName)) {
171
- this.classNames.push(cellClassName);
172
- }
173
- }
174
- (0, _element.addClass)(TD, cellClassName);
175
- }
176
- return this;
177
- }
178
-
179
- /**
180
- * Generate helper for calculating classNames based on previously added base className.
181
- * The generated className is always generated as a continuation of the previous className. For example, when
182
- * the currently checked element has 'area-2' className the generated new className will be 'area-3'. When
183
- * the element doesn't have any classNames than the base className will be returned ('area');.
184
- *
185
- * @param {string} baseClassName Base className to be used.
186
- * @param {number} layerLevelOwner Layer level which the instance of the Selection belongs to.
187
- * @returns {Function}
188
- */
189
- }, {
190
- key: "linearClassNameGenerator",
191
- value: function linearClassNameGenerator(baseClassName, layerLevelOwner) {
192
- // TODO: Make this recursive function Proper Tail Calls (TCO/PTC) friendly.
193
- return function calcClassName(element) {
194
- var previousIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
195
- if (layerLevelOwner === 0 || previousIndex === 0) {
196
- return baseClassName;
197
- }
198
- var index = previousIndex >= 0 ? previousIndex : layerLevelOwner;
199
- var className = baseClassName;
200
- index -= 1;
201
- var previousClassName = index === 0 ? baseClassName : "".concat(baseClassName, "-").concat(index);
202
- if ((0, _element.hasClass)(element, previousClassName)) {
203
- var currentLayer = index + 1;
204
- className = "".concat(baseClassName, "-").concat(currentLayer);
205
- } else {
206
- className = calcClassName(element, index);
207
- }
208
- return className;
209
- };
210
- }
211
-
212
- /**
213
- * @param {WalkontableFacade} wotInstance The Walkontable instance.
214
- */
215
- }, {
216
- key: "draw",
217
- value: function draw(wotInstance) {
218
- if (this.isEmpty()) {
219
- if (this.settings.border) {
220
- this.getBorder(wotInstance).disappear();
221
- }
222
- return;
223
- }
224
- var renderedRows = wotInstance.wtTable.getRenderedRowsCount();
225
- var renderedColumns = wotInstance.wtTable.getRenderedColumnsCount();
226
- var corners = this.getCorners();
227
- var _corners = _slicedToArray(corners, 4),
228
- topRow = _corners[0],
229
- topColumn = _corners[1],
230
- bottomRow = _corners[2],
231
- bottomColumn = _corners[3];
232
- var _this$settings = this.settings,
233
- highlightHeaderClassName = _this$settings.highlightHeaderClassName,
234
- highlightColumnClassName = _this$settings.highlightColumnClassName,
235
- highlightRowClassName = _this$settings.highlightRowClassName,
236
- highlightOnlyClosestHeader = _this$settings.highlightOnlyClosestHeader,
237
- selectionType = _this$settings.selectionType;
238
- var isHeaderSelectionType = selectionType === void 0 || ['active-header', 'header'].includes(selectionType);
239
- if (isHeaderSelectionType && topColumn !== null && bottomColumn !== null) {
240
- var selectionColumnCursor = 0;
241
- for (var column = 0; column < renderedColumns; column += 1) {
242
- var sourceCol = wotInstance.wtTable.columnFilter.renderedToSource(column);
243
- if (sourceCol >= topColumn && sourceCol <= bottomColumn) {
244
- var THs = wotInstance.wtTable.getColumnHeaders(sourceCol);
245
- var closestHeaderLevel = THs.length - 1;
246
- if (highlightOnlyClosestHeader && THs.length > 1) {
247
- THs = [THs[closestHeaderLevel]];
248
- }
249
- for (var headerLevel = 0; headerLevel < THs.length; headerLevel += 1) {
250
- var newClasses = [];
251
- var TH = THs[headerLevel];
252
- if (highlightHeaderClassName) {
253
- newClasses.push(highlightHeaderClassName);
254
- }
255
- if (highlightColumnClassName) {
256
- newClasses.push(highlightColumnClassName);
257
- }
258
- headerLevel = highlightOnlyClosestHeader ? closestHeaderLevel : headerLevel;
259
- var newSourceCol = wotInstance.getSetting('onBeforeHighlightingColumnHeader', sourceCol, headerLevel, {
260
- selectionType: selectionType,
261
- columnCursor: selectionColumnCursor,
262
- selectionWidth: bottomColumn - topColumn + 1,
263
- classNames: newClasses
264
- });
265
- if (newSourceCol !== sourceCol) {
266
- TH = wotInstance.wtTable.getColumnHeader(newSourceCol, headerLevel);
267
- }
268
- (0, _element.addClass)(TH, newClasses);
269
- }
270
- selectionColumnCursor += 1;
271
- }
272
- }
273
- }
274
- if (topRow !== null && bottomRow !== null) {
275
- var selectionRowCursor = 0;
276
- for (var row = 0; row < renderedRows; row += 1) {
277
- var sourceRow = wotInstance.wtTable.rowFilter.renderedToSource(row);
278
- if (isHeaderSelectionType && sourceRow >= topRow && sourceRow <= bottomRow) {
279
- var _THs = wotInstance.wtTable.getRowHeaders(sourceRow);
280
- var _closestHeaderLevel = _THs.length - 1;
281
- if (highlightOnlyClosestHeader && _THs.length > 1) {
282
- _THs = [_THs[_closestHeaderLevel]];
283
- }
284
- for (var _headerLevel = 0; _headerLevel < _THs.length; _headerLevel += 1) {
285
- var _newClasses = [];
286
- var _TH = _THs[_headerLevel];
287
- if (highlightHeaderClassName) {
288
- _newClasses.push(highlightHeaderClassName);
289
- }
290
- if (highlightRowClassName) {
291
- _newClasses.push(highlightRowClassName);
292
- }
293
- _headerLevel = highlightOnlyClosestHeader ? _closestHeaderLevel : _headerLevel;
294
- var newSourceRow = wotInstance.getSetting('onBeforeHighlightingRowHeader', sourceRow, _headerLevel, {
295
- selectionType: selectionType,
296
- rowCursor: selectionRowCursor,
297
- selectionHeight: bottomRow - topRow + 1,
298
- classNames: _newClasses
299
- });
300
- if (newSourceRow !== sourceRow) {
301
- _TH = wotInstance.wtTable.getRowHeader(newSourceRow, _headerLevel);
302
- }
303
- (0, _element.addClass)(_TH, _newClasses);
304
- }
305
- selectionRowCursor += 1;
306
- }
307
- if (topColumn !== null && bottomColumn !== null) {
308
- for (var _column = 0; _column < renderedColumns; _column += 1) {
309
- var _sourceCol = wotInstance.wtTable.columnFilter.renderedToSource(_column);
310
- if (sourceRow >= topRow && sourceRow <= bottomRow && _sourceCol >= topColumn && _sourceCol <= bottomColumn) {
311
- // selected cell
312
- if (this.settings.className) {
313
- this.addClassAtCoords(wotInstance, sourceRow, _sourceCol, this.settings.className, this.settings.markIntersections);
314
- }
315
- } else if (sourceRow >= topRow && sourceRow <= bottomRow) {
316
- // selection is in this row
317
- if (highlightRowClassName) {
318
- this.addClassAtCoords(wotInstance, sourceRow, _sourceCol, highlightRowClassName);
319
- }
320
- } else if (_sourceCol >= topColumn && _sourceCol <= bottomColumn) {
321
- // selection is in this column
322
- if (highlightColumnClassName) {
323
- this.addClassAtCoords(wotInstance, sourceRow, _sourceCol, highlightColumnClassName);
324
- }
325
- }
326
- var additionalSelectionClass = wotInstance.getSetting('onAfterDrawSelection', sourceRow, _sourceCol, this.settings.layerLevel);
327
- if (typeof additionalSelectionClass === 'string') {
328
- this.addClassAtCoords(wotInstance, sourceRow, _sourceCol, additionalSelectionClass);
329
- }
330
- }
331
- }
332
- }
333
- }
334
- wotInstance.getSetting('onBeforeDrawBorders', corners, this.settings.className);
335
- if (this.settings.border) {
336
- // warning! border.appear modifies corners!
337
- this.getBorder(wotInstance).appear(corners);
338
- }
339
- }
340
-
341
- /**
342
- * Cleans up all the DOM state related to a Selection instance. Call this prior to deleting a Selection instance.
343
- */
344
- }, {
345
- key: "destroy",
346
- value: function destroy() {
347
- Object.values(this.instanceBorders).forEach(function (border) {
348
- return border.destroy();
349
- });
350
- }
351
- }]);
352
- return Selection;
353
- }();
354
- var _default = Selection;
355
- exports.default = _default;