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

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

Potentially problematic release.


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

Files changed (216) hide show
  1. package/3rdparty/walkontable/src/{selection/border/border.js → border.js} +12 -7
  2. package/3rdparty/walkontable/src/{selection/border/border.mjs → border.mjs} +12 -7
  3. package/3rdparty/walkontable/src/cell/coords.d.ts +1 -6
  4. package/3rdparty/walkontable/src/cell/coords.js +12 -61
  5. package/3rdparty/walkontable/src/cell/coords.mjs +12 -61
  6. package/3rdparty/walkontable/src/cell/range.d.ts +2 -9
  7. package/3rdparty/walkontable/src/cell/range.js +7 -44
  8. package/3rdparty/walkontable/src/cell/range.mjs +7 -44
  9. package/3rdparty/walkontable/src/core/_base.js +3 -9
  10. package/3rdparty/walkontable/src/core/_base.mjs +3 -9
  11. package/3rdparty/walkontable/src/core/clone.js +2 -2
  12. package/3rdparty/walkontable/src/core/clone.mjs +2 -2
  13. package/3rdparty/walkontable/src/core/core.js +2 -3
  14. package/3rdparty/walkontable/src/core/core.mjs +2 -3
  15. package/3rdparty/walkontable/src/event.js +7 -7
  16. package/3rdparty/walkontable/src/event.mjs +7 -7
  17. package/3rdparty/walkontable/src/facade/core.js +2 -2
  18. package/3rdparty/walkontable/src/facade/core.mjs +2 -2
  19. package/3rdparty/walkontable/src/index.js +2 -10
  20. package/3rdparty/walkontable/src/index.mjs +2 -2
  21. package/3rdparty/walkontable/src/overlay/_base.js +1 -1
  22. package/3rdparty/walkontable/src/overlay/_base.mjs +1 -1
  23. package/3rdparty/walkontable/src/overlay/inlineStart.js +4 -2
  24. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +4 -2
  25. package/3rdparty/walkontable/src/overlay/top.js +4 -2
  26. package/3rdparty/walkontable/src/overlay/top.mjs +4 -2
  27. package/3rdparty/walkontable/src/selection.js +354 -0
  28. package/3rdparty/walkontable/src/selection.mjs +348 -0
  29. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +0 -9
  30. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +0 -9
  31. package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +0 -9
  32. package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +0 -9
  33. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +0 -9
  34. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +0 -9
  35. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +0 -9
  36. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +0 -9
  37. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +0 -9
  38. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +0 -9
  39. package/3rdparty/walkontable/src/table.js +79 -7
  40. package/3rdparty/walkontable/src/table.mjs +80 -8
  41. package/base.js +2 -2
  42. package/base.mjs +2 -2
  43. package/core.d.ts +3 -5
  44. package/core.js +300 -82
  45. package/core.mjs +300 -82
  46. package/dataMap/metaManager/metaSchema.js +0 -15
  47. package/dataMap/metaManager/metaSchema.mjs +0 -15
  48. package/dist/handsontable.css +3 -8
  49. package/dist/handsontable.full.css +3 -8
  50. package/dist/handsontable.full.js +9926 -12218
  51. package/dist/handsontable.full.min.css +3 -3
  52. package/dist/handsontable.full.min.js +120 -120
  53. package/dist/handsontable.js +14628 -16920
  54. package/dist/handsontable.min.css +3 -3
  55. package/dist/handsontable.min.js +4 -4
  56. package/editorManager.js +82 -20
  57. package/editorManager.mjs +86 -25
  58. package/editors/textEditor/textEditor.js +11 -3
  59. package/editors/textEditor/textEditor.mjs +12 -4
  60. package/helpers/mixed.js +1 -1
  61. package/helpers/mixed.mjs +1 -1
  62. package/helpers/number.d.ts +0 -1
  63. package/helpers/number.js +0 -18
  64. package/helpers/number.mjs +0 -17
  65. package/package.json +1 -1
  66. package/pluginHooks.js +1 -1
  67. package/pluginHooks.mjs +1 -1
  68. package/plugins/copyPaste/copyPaste.js +1 -5
  69. package/plugins/copyPaste/copyPaste.mjs +1 -5
  70. package/plugins/customBorders/customBorders.js +52 -18
  71. package/plugins/customBorders/customBorders.mjs +53 -19
  72. package/plugins/mergeCells/mergeCells.js +18 -5
  73. package/plugins/mergeCells/mergeCells.mjs +18 -5
  74. package/plugins/nestedHeaders/nestedHeaders.js +9 -89
  75. package/plugins/nestedHeaders/nestedHeaders.mjs +9 -89
  76. package/plugins/nestedHeaders/stateManager/index.js +0 -37
  77. package/plugins/nestedHeaders/stateManager/index.mjs +0 -37
  78. package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
  79. package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
  80. package/selection/highlight/constants.js +16 -0
  81. package/selection/highlight/constants.mjs +6 -0
  82. package/selection/highlight/highlight.js +88 -311
  83. package/selection/highlight/highlight.mjs +84 -301
  84. package/selection/highlight/types/activeHeader.js +9 -10
  85. package/selection/highlight/types/activeHeader.mjs +8 -10
  86. package/selection/highlight/types/area.js +27 -12
  87. package/selection/highlight/types/area.mjs +30 -16
  88. package/selection/highlight/types/{focus.js → cell.js} +8 -5
  89. package/selection/highlight/types/{focus.mjs → cell.mjs} +7 -5
  90. package/selection/highlight/types/customSelection.js +10 -7
  91. package/selection/highlight/types/customSelection.mjs +9 -7
  92. package/selection/highlight/types/fill.js +8 -5
  93. package/selection/highlight/types/fill.mjs +7 -5
  94. package/selection/highlight/types/header.js +20 -10
  95. package/selection/highlight/types/header.mjs +19 -10
  96. package/selection/highlight/types/{row.js → index.js} +31 -27
  97. package/selection/highlight/types/{row.mjs → index.mjs} +29 -24
  98. package/selection/highlight/visualSelection.js +28 -23
  99. package/selection/highlight/visualSelection.mjs +28 -23
  100. package/selection/index.js +7 -4
  101. package/selection/index.mjs +3 -2
  102. package/selection/mouseEventHandler.js +1 -1
  103. package/selection/mouseEventHandler.mjs +1 -1
  104. package/selection/range.js +8 -8
  105. package/selection/range.mjs +8 -8
  106. package/selection/selection.js +180 -296
  107. package/selection/selection.mjs +179 -291
  108. package/selection/transformation.js +96 -233
  109. package/selection/transformation.mjs +93 -230
  110. package/selection/utils.js +35 -12
  111. package/selection/utils.mjs +35 -13
  112. package/settings.d.ts +0 -1
  113. package/tableView.js +9 -58
  114. package/tableView.mjs +9 -58
  115. package/3rdparty/walkontable/src/selection/border/constants.js +0 -18
  116. package/3rdparty/walkontable/src/selection/border/constants.mjs +0 -13
  117. package/3rdparty/walkontable/src/selection/constants.js +0 -63
  118. package/3rdparty/walkontable/src/selection/constants.mjs +0 -51
  119. package/3rdparty/walkontable/src/selection/index.js +0 -30
  120. package/3rdparty/walkontable/src/selection/index.mjs +0 -5
  121. package/3rdparty/walkontable/src/selection/manager.js +0 -328
  122. package/3rdparty/walkontable/src/selection/manager.mjs +0 -322
  123. package/3rdparty/walkontable/src/selection/scanner.js +0 -363
  124. package/3rdparty/walkontable/src/selection/scanner.mjs +0 -359
  125. package/3rdparty/walkontable/src/selection/selection.js +0 -133
  126. package/3rdparty/walkontable/src/selection/selection.mjs +0 -127
  127. package/selection/highlight/types/areaLayered.js +0 -54
  128. package/selection/highlight/types/areaLayered.mjs +0 -49
  129. package/selection/highlight/types/column.js +0 -50
  130. package/selection/highlight/types/column.mjs +0 -45
  131. package/shortcutContexts/commands/editor/closeAndSave.js +0 -15
  132. package/shortcutContexts/commands/editor/closeAndSave.mjs +0 -10
  133. package/shortcutContexts/commands/editor/closeWithoutSaving.js +0 -13
  134. package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +0 -8
  135. package/shortcutContexts/commands/editor/fastOpen.js +0 -16
  136. package/shortcutContexts/commands/editor/fastOpen.mjs +0 -11
  137. package/shortcutContexts/commands/editor/index.js +0 -16
  138. package/shortcutContexts/commands/editor/index.mjs +0 -12
  139. package/shortcutContexts/commands/editor/open.js +0 -29
  140. package/shortcutContexts/commands/editor/open.mjs +0 -24
  141. package/shortcutContexts/commands/emptySelectedCells.js +0 -12
  142. package/shortcutContexts/commands/emptySelectedCells.mjs +0 -7
  143. package/shortcutContexts/commands/extendCellsSelection/down.js +0 -15
  144. package/shortcutContexts/commands/extendCellsSelection/down.mjs +0 -10
  145. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +0 -21
  146. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +0 -16
  147. package/shortcutContexts/commands/extendCellsSelection/index.js +0 -24
  148. package/shortcutContexts/commands/extendCellsSelection/index.mjs +0 -20
  149. package/shortcutContexts/commands/extendCellsSelection/left.js +0 -15
  150. package/shortcutContexts/commands/extendCellsSelection/left.mjs +0 -10
  151. package/shortcutContexts/commands/extendCellsSelection/right.js +0 -15
  152. package/shortcutContexts/commands/extendCellsSelection/right.mjs +0 -10
  153. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +0 -22
  154. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +0 -17
  155. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +0 -17
  156. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +0 -12
  157. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +0 -17
  158. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +0 -12
  159. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +0 -39
  160. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +0 -34
  161. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +0 -39
  162. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +0 -34
  163. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +0 -22
  164. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +0 -17
  165. package/shortcutContexts/commands/extendCellsSelection/up.js +0 -15
  166. package/shortcutContexts/commands/extendCellsSelection/up.mjs +0 -10
  167. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +0 -21
  168. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +0 -16
  169. package/shortcutContexts/commands/index.js +0 -51
  170. package/shortcutContexts/commands/index.mjs +0 -47
  171. package/shortcutContexts/commands/moveCellSelection/down.js +0 -12
  172. package/shortcutContexts/commands/moveCellSelection/down.mjs +0 -7
  173. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +0 -11
  174. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +0 -6
  175. package/shortcutContexts/commands/moveCellSelection/index.js +0 -28
  176. package/shortcutContexts/commands/moveCellSelection/index.mjs +0 -24
  177. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +0 -13
  178. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +0 -8
  179. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +0 -13
  180. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +0 -8
  181. package/shortcutContexts/commands/moveCellSelection/left.js +0 -11
  182. package/shortcutContexts/commands/moveCellSelection/left.mjs +0 -6
  183. package/shortcutContexts/commands/moveCellSelection/right.js +0 -11
  184. package/shortcutContexts/commands/moveCellSelection/right.mjs +0 -6
  185. package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +0 -16
  186. package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +0 -11
  187. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +0 -17
  188. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +0 -12
  189. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +0 -13
  190. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +0 -8
  191. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +0 -16
  192. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +0 -11
  193. package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +0 -35
  194. package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +0 -30
  195. package/shortcutContexts/commands/moveCellSelection/toMostRight.js +0 -35
  196. package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +0 -30
  197. package/shortcutContexts/commands/moveCellSelection/toMostTop.js +0 -16
  198. package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +0 -11
  199. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +0 -18
  200. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +0 -13
  201. package/shortcutContexts/commands/moveCellSelection/up.js +0 -12
  202. package/shortcutContexts/commands/moveCellSelection/up.mjs +0 -7
  203. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +0 -11
  204. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +0 -6
  205. package/shortcutContexts/commands/populateSelectedCellsData.js +0 -35
  206. package/shortcutContexts/commands/populateSelectedCellsData.mjs +0 -30
  207. package/shortcutContexts/commands/selectAll.js +0 -11
  208. package/shortcutContexts/commands/selectAll.mjs +0 -6
  209. package/shortcutContexts/constants.js +0 -19
  210. package/shortcutContexts/constants.mjs +0 -12
  211. package/shortcutContexts/editor.js +0 -29
  212. package/shortcutContexts/editor.mjs +0 -25
  213. package/shortcutContexts/grid.js +0 -232
  214. package/shortcutContexts/grid.mjs +0 -228
  215. package/shortcutContexts/index.js +0 -29
  216. package/shortcutContexts/index.mjs +0 -15
@@ -30,7 +30,6 @@ import Settings from "../settings.mjs";
30
30
  import MasterTable from "../table/master.mjs";
31
31
  import Viewport from "../viewport.mjs";
32
32
  import CoreAbstract from "./_base.mjs";
33
- import { SelectionManager } from "../selection/manager.mjs";
34
33
  import { objectEach } from "../../../../helpers/object.mjs";
35
34
  import { addClass, removeClass } from "../../../../helpers/dom/element.mjs";
36
35
  /**
@@ -51,8 +50,8 @@ var Walkontable = /*#__PURE__*/function (_CoreAbstract) {
51
50
 
52
51
  _this.wtTable = new MasterTable(_this.getTableDao(), facadeGetter, _this.domBindings, _this.wtSettings);
53
52
  _this.wtViewport = new Viewport(_this.getViewportDao(), _this.domBindings, _this.wtSettings, _this.eventManager, _this.wtTable);
54
- _this.selectionManager = new SelectionManager(_this.wtSettings.getSetting('selections'));
55
- _this.wtEvent = new Event(facadeGetter, _this.domBindings, _this.wtSettings, _this.eventManager, _this.wtTable, _this.selectionManager);
53
+ _this.selections = _this.wtSettings.getSetting('selections');
54
+ _this.wtEvent = new Event(facadeGetter, _this.domBindings, _this.wtSettings, _this.eventManager, _this.wtTable, _this.selections);
56
55
  _this.wtOverlays = new Overlays( // TODO create DAO and remove reference to the Walkontable instance.
57
56
  _assertThisInitialized(_this), facadeGetter, _this.domBindings, _this.wtSettings, _this.eventManager, _this.wtTable);
58
57
  _this.exportSettingsAsClassNames();
@@ -38,16 +38,16 @@ var Event = /*#__PURE__*/function () {
38
38
  * @param {Settings} wtSettings The walkontable settings.
39
39
  * @param {EventManager} eventManager The walkontable event manager.
40
40
  * @param {Table} wtTable The table.
41
- * @param {SelectionManager} selectionManager Selections.
41
+ * @param {Selections} selections Selections.
42
42
  * @param {Event} [parent=null] The main Event instance.
43
43
  */
44
- function Event(facadeGetter, domBindings, wtSettings, eventManager, wtTable, selectionManager) {
44
+ function Event(facadeGetter, domBindings, wtSettings, eventManager, wtTable, selections) {
45
45
  var parent = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
46
46
  _classCallCheck(this, Event);
47
47
  this.wtSettings = wtSettings;
48
48
  this.domBindings = domBindings;
49
49
  this.wtTable = wtTable;
50
- this.selectionManager = selectionManager;
50
+ this.selections = selections;
51
51
  this.parent = parent;
52
52
 
53
53
  /**
@@ -180,11 +180,11 @@ var Event = /*#__PURE__*/function () {
180
180
  cell.coords = this.wtTable.getCoords(TD);
181
181
  cell.TD = TD;
182
182
  } else if ((0, _element.hasClass)(elem, 'wtBorder') && (0, _element.hasClass)(elem, 'current')) {
183
- cell.coords = this.selectionManager.getFocusSelection().cellRange.highlight;
183
+ cell.coords = this.selections.getCell().cellRange.highlight;
184
184
  cell.TD = this.wtTable.getCell(cell.coords);
185
185
  } else if ((0, _element.hasClass)(elem, 'wtBorder') && (0, _element.hasClass)(elem, 'area')) {
186
- if (this.selectionManager.getAreaSelection().cellRange) {
187
- cell.coords = this.selectionManager.getAreaSelection().cellRange.to;
186
+ if (this.selections.createOrGetArea().cellRange) {
187
+ cell.coords = this.selections.createOrGetArea().cellRange.to;
188
188
  cell.TD = this.wtTable.getCell(cell.coords);
189
189
  }
190
190
  }
@@ -334,7 +334,7 @@ var Event = /*#__PURE__*/function () {
334
334
  key: "onTouchStart",
335
335
  value: function onTouchStart(event) {
336
336
  var priv = privatePool.get(this);
337
- priv.selectedCellBeforeTouchEnd = this.selectionManager.getFocusSelection().cellRange;
337
+ priv.selectedCellBeforeTouchEnd = this.selections.getCell().cellRange;
338
338
  this.touchApplied = true;
339
339
  this.onMouseDown(event);
340
340
  }
@@ -34,16 +34,16 @@ var Event = /*#__PURE__*/function () {
34
34
  * @param {Settings} wtSettings The walkontable settings.
35
35
  * @param {EventManager} eventManager The walkontable event manager.
36
36
  * @param {Table} wtTable The table.
37
- * @param {SelectionManager} selectionManager Selections.
37
+ * @param {Selections} selections Selections.
38
38
  * @param {Event} [parent=null] The main Event instance.
39
39
  */
40
- function Event(facadeGetter, domBindings, wtSettings, eventManager, wtTable, selectionManager) {
40
+ function Event(facadeGetter, domBindings, wtSettings, eventManager, wtTable, selections) {
41
41
  var parent = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
42
42
  _classCallCheck(this, Event);
43
43
  this.wtSettings = wtSettings;
44
44
  this.domBindings = domBindings;
45
45
  this.wtTable = wtTable;
46
- this.selectionManager = selectionManager;
46
+ this.selections = selections;
47
47
  this.parent = parent;
48
48
 
49
49
  /**
@@ -176,11 +176,11 @@ var Event = /*#__PURE__*/function () {
176
176
  cell.coords = this.wtTable.getCoords(TD);
177
177
  cell.TD = TD;
178
178
  } else if (hasClass(elem, 'wtBorder') && hasClass(elem, 'current')) {
179
- cell.coords = this.selectionManager.getFocusSelection().cellRange.highlight;
179
+ cell.coords = this.selections.getCell().cellRange.highlight;
180
180
  cell.TD = this.wtTable.getCell(cell.coords);
181
181
  } else if (hasClass(elem, 'wtBorder') && hasClass(elem, 'area')) {
182
- if (this.selectionManager.getAreaSelection().cellRange) {
183
- cell.coords = this.selectionManager.getAreaSelection().cellRange.to;
182
+ if (this.selections.createOrGetArea().cellRange) {
183
+ cell.coords = this.selections.createOrGetArea().cellRange.to;
184
184
  cell.TD = this.wtTable.getCell(cell.coords);
185
185
  }
186
186
  }
@@ -330,7 +330,7 @@ var Event = /*#__PURE__*/function () {
330
330
  key: "onTouchStart",
331
331
  value: function onTouchStart(event) {
332
332
  var priv = privatePool.get(this);
333
- priv.selectedCellBeforeTouchEnd = this.selectionManager.getFocusSelection().cellRange;
333
+ priv.selectedCellBeforeTouchEnd = this.selections.getCell().cellRange;
334
334
  this.touchApplied = true;
335
335
  this.onMouseDown(event);
336
336
  }
@@ -82,9 +82,9 @@ var WalkontableFacade = /*#__PURE__*/function () {
82
82
  return this._wot.cloneOverlay; // todo create facade
83
83
  }
84
84
  }, {
85
- key: "selectionManager",
85
+ key: "selections",
86
86
  get: function get() {
87
- return this._wot.selectionManager; // todo create facade
87
+ return this._wot.selections; // todo create facade
88
88
  }
89
89
  }, {
90
90
  key: "wtViewport",
@@ -77,9 +77,9 @@ var WalkontableFacade = /*#__PURE__*/function () {
77
77
  return this._wot.cloneOverlay; // todo create facade
78
78
  }
79
79
  }, {
80
- key: "selectionManager",
80
+ key: "selections",
81
81
  get: function get() {
82
- return this._wot.selectionManager; // todo create facade
82
+ return this._wot.selections; // todo create facade
83
83
  }
84
84
  }, {
85
85
  key: "wtViewport",
@@ -23,16 +23,8 @@ exports.CellRange = _range.default;
23
23
  var _core = _interopRequireDefault(require("./facade/core"));
24
24
  exports.default = _core.default;
25
25
  exports.Core = _core.default;
26
- var _selection = require("./selection");
27
- exports.Selection = _selection.Selection;
28
- exports.HIGHLIGHT_ACTIVE_HEADER_TYPE = _selection.ACTIVE_HEADER_TYPE;
29
- exports.HIGHLIGHT_AREA_TYPE = _selection.AREA_TYPE;
30
- exports.HIGHLIGHT_FOCUS_TYPE = _selection.FOCUS_TYPE;
31
- exports.HIGHLIGHT_FILL_TYPE = _selection.FILL_TYPE;
32
- exports.HIGHLIGHT_HEADER_TYPE = _selection.HEADER_TYPE;
33
- exports.HIGHLIGHT_ROW_TYPE = _selection.ROW_TYPE;
34
- exports.HIGHLIGHT_COLUMN_TYPE = _selection.COLUMN_TYPE;
35
- exports.HIGHLIGHT_CUSTOM_SELECTION_TYPE = _selection.CUSTOM_SELECTION_TYPE;
26
+ var _selection = _interopRequireDefault(require("./selection"));
27
+ exports.Selection = _selection.default;
36
28
  var Renderer = _interopRequireWildcard(require("./renderer"));
37
29
  exports.Renderer = Renderer;
38
30
  var _orderView = require("./utils/orderView");
@@ -3,8 +3,8 @@ import ViewportRowsCalculator from "./calculator/viewportRows.mjs";
3
3
  import CellCoords from "./cell/coords.mjs";
4
4
  import CellRange from "./cell/range.mjs";
5
5
  import Walkontable from "./facade/core.mjs";
6
- import { Selection, ACTIVE_HEADER_TYPE, AREA_TYPE, FOCUS_TYPE, FILL_TYPE, HEADER_TYPE, ROW_TYPE, COLUMN_TYPE, CUSTOM_SELECTION_TYPE } from "./selection/index.mjs";
6
+ import Selection from "./selection.mjs";
7
7
  import * as Renderer from "./renderer/index.mjs";
8
8
  import { OrderView, SharedOrderView } from "./utils/orderView/index.mjs";
9
9
  import { getListenersCounter } from "../../../eventManager.mjs";
10
- export { ViewportColumnsCalculator, ViewportRowsCalculator, CellCoords, CellRange, Walkontable as default, Walkontable as Core, Selection, ACTIVE_HEADER_TYPE as HIGHLIGHT_ACTIVE_HEADER_TYPE, AREA_TYPE as HIGHLIGHT_AREA_TYPE, FOCUS_TYPE as HIGHLIGHT_FOCUS_TYPE, FILL_TYPE as HIGHLIGHT_FILL_TYPE, HEADER_TYPE as HIGHLIGHT_HEADER_TYPE, ROW_TYPE as HIGHLIGHT_ROW_TYPE, COLUMN_TYPE as HIGHLIGHT_COLUMN_TYPE, CUSTOM_SELECTION_TYPE as HIGHLIGHT_CUSTOM_SELECTION_TYPE, Renderer, OrderView, SharedOrderView, getListenersCounter };
10
+ export { ViewportColumnsCalculator, ViewportRowsCalculator, CellCoords, CellRange, Walkontable as default, Walkontable as Core, Selection, Renderer, OrderView, SharedOrderView, getListenersCounter };
@@ -307,7 +307,7 @@ var Overlay = /*#__PURE__*/function () {
307
307
  // todo ioc , or factor func if used only here
308
308
  event: this.wot.wtEvent,
309
309
  // todo ioc , or factory func if used only here
310
- selectionManager: this.wot.selectionManager // todo ioc , or factory func if used only here
310
+ selections: this.wot.selections // todo ioc , or factory func if used only here
311
311
  });
312
312
  }
313
313
 
@@ -302,7 +302,7 @@ export var Overlay = /*#__PURE__*/function () {
302
302
  // todo ioc , or factor func if used only here
303
303
  event: this.wot.wtEvent,
304
304
  // todo ioc , or factory func if used only here
305
- selectionManager: this.wot.selectionManager // todo ioc , or factory func if used only here
305
+ selections: this.wot.selections // todo ioc , or factory func if used only here
306
306
  });
307
307
  }
308
308
 
@@ -19,7 +19,6 @@ require("core-js/modules/es.object.get-prototype-of.js");
19
19
  var _element = require("../../../../helpers/dom/element");
20
20
  var _inlineStart = _interopRequireDefault(require("../table/inlineStart"));
21
21
  var _base = require("./_base");
22
- var _selection = require("../selection");
23
22
  var _constants = require("./constants");
24
23
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
24
  function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
@@ -212,8 +211,11 @@ var InlineStartOverlay = /*#__PURE__*/function (_Overlay) {
212
211
  }, {
213
212
  key: "adjustRootChildrenSize",
214
213
  value: function adjustRootChildrenSize() {
214
+ var _selections$getCell$g;
215
215
  var holder = this.clone.wtTable.holder;
216
- var selectionCornerOffset = this.wot.selectionManager.getFocusSelection() ? parseInt(_selection.CORNER_DEFAULT_STYLE.width, 10) / 2 : 0;
216
+ var selections = this.wot.selections;
217
+ var facade = this.facadeGetter();
218
+ var selectionCornerOffset = Math.abs((_selections$getCell$g = selections === null || selections === void 0 ? void 0 : selections.getCell().getBorder(facade).cornerCenterPointOffset) !== null && _selections$getCell$g !== void 0 ? _selections$getCell$g : 0);
217
219
  this.clone.wtTable.hider.style.height = this.hider.style.height;
218
220
  holder.style.height = holder.parentNode.style.height;
219
221
  // Add selection corner protruding part to the holder total width to make sure that
@@ -28,7 +28,6 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
28
28
  import { addClass, getScrollbarWidth, getScrollLeft, getWindowScrollTop, hasClass, outerWidth, removeClass, setOverlayPosition, resetCssTransform } from "../../../../helpers/dom/element.mjs";
29
29
  import InlineStartOverlayTable from "../table/inlineStart.mjs";
30
30
  import { Overlay } from "./_base.mjs";
31
- import { CORNER_DEFAULT_STYLE } from "../selection/index.mjs";
32
31
  import { CLONE_INLINE_START } from "./constants.mjs";
33
32
  /**
34
33
  * @class InlineStartOverlay
@@ -207,8 +206,11 @@ export var InlineStartOverlay = /*#__PURE__*/function (_Overlay) {
207
206
  }, {
208
207
  key: "adjustRootChildrenSize",
209
208
  value: function adjustRootChildrenSize() {
209
+ var _selections$getCell$g;
210
210
  var holder = this.clone.wtTable.holder;
211
- var selectionCornerOffset = this.wot.selectionManager.getFocusSelection() ? parseInt(CORNER_DEFAULT_STYLE.width, 10) / 2 : 0;
211
+ var selections = this.wot.selections;
212
+ var facade = this.facadeGetter();
213
+ var selectionCornerOffset = Math.abs((_selections$getCell$g = selections === null || selections === void 0 ? void 0 : selections.getCell().getBorder(facade).cornerCenterPointOffset) !== null && _selections$getCell$g !== void 0 ? _selections$getCell$g : 0);
212
214
  this.clone.wtTable.hider.style.height = this.hider.style.height;
213
215
  holder.style.height = holder.parentNode.style.height;
214
216
  // Add selection corner protruding part to the holder total width to make sure that
@@ -18,7 +18,6 @@ require("core-js/modules/es.number.constructor.js");
18
18
  var _element = require("../../../../helpers/dom/element");
19
19
  var _top = _interopRequireDefault(require("./../table/top"));
20
20
  var _base = require("./_base");
21
- var _selection = require("../selection");
22
21
  var _constants = require("./constants");
23
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
23
  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); }
@@ -241,8 +240,11 @@ var TopOverlay = /*#__PURE__*/function (_Overlay) {
241
240
  }, {
242
241
  key: "adjustRootChildrenSize",
243
242
  value: function adjustRootChildrenSize() {
243
+ var _selections$getCell$g;
244
244
  var holder = this.clone.wtTable.holder;
245
- var selectionCornerOffset = this.wot.selectionManager.getFocusSelection() ? parseInt(_selection.CORNER_DEFAULT_STYLE.height, 10) / 2 : 0;
245
+ var selections = this.wot.selections;
246
+ var facade = this.facadeGetter();
247
+ var selectionCornerOffset = Math.abs((_selections$getCell$g = selections === null || selections === void 0 ? void 0 : selections.getCell().getBorder(facade).cornerCenterPointOffset) !== null && _selections$getCell$g !== void 0 ? _selections$getCell$g : 0);
246
248
  this.clone.wtTable.hider.style.width = this.hider.style.width;
247
249
  holder.style.width = holder.parentNode.style.width;
248
250
  // Add selection corner protruding part to the holder total height to make sure that
@@ -29,7 +29,6 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
29
29
  import { addClass, getScrollbarWidth, getScrollTop, getWindowScrollLeft, hasClass, outerHeight, removeClass, setOverlayPosition, resetCssTransform } from "../../../../helpers/dom/element.mjs";
30
30
  import TopOverlayTable from "./../table/top.mjs";
31
31
  import { Overlay } from "./_base.mjs";
32
- import { CORNER_DEFAULT_STYLE } from "../selection/index.mjs";
33
32
  import { CLONE_TOP } from "./constants.mjs";
34
33
  /**
35
34
  * @class TopOverlay
@@ -236,8 +235,11 @@ export var TopOverlay = /*#__PURE__*/function (_Overlay) {
236
235
  }, {
237
236
  key: "adjustRootChildrenSize",
238
237
  value: function adjustRootChildrenSize() {
238
+ var _selections$getCell$g;
239
239
  var holder = this.clone.wtTable.holder;
240
- var selectionCornerOffset = this.wot.selectionManager.getFocusSelection() ? parseInt(CORNER_DEFAULT_STYLE.height, 10) / 2 : 0;
240
+ var selections = this.wot.selections;
241
+ var facade = this.facadeGetter();
242
+ var selectionCornerOffset = Math.abs((_selections$getCell$g = selections === null || selections === void 0 ? void 0 : selections.getCell().getBorder(facade).cornerCenterPointOffset) !== null && _selections$getCell$g !== void 0 ? _selections$getCell$g : 0);
241
243
  this.clone.wtTable.hider.style.width = this.hider.style.width;
242
244
  holder.style.width = holder.parentNode.style.width;
243
245
  // Add selection corner protruding part to the holder total height to make sure that
@@ -0,0 +1,354 @@
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.function.name.js");
9
+ require("core-js/modules/es.array.from.js");
10
+ require("core-js/modules/es.regexp.exec.js");
11
+ exports.__esModule = true;
12
+ exports.default = void 0;
13
+ require("core-js/modules/es.array.includes.js");
14
+ require("core-js/modules/es.string.includes.js");
15
+ require("core-js/modules/es.array.concat.js");
16
+ require("core-js/modules/es.object.to-string.js");
17
+ require("core-js/modules/web.dom-collections.for-each.js");
18
+ require("core-js/modules/es.object.values.js");
19
+ require("core-js/modules/es.symbol.to-primitive.js");
20
+ require("core-js/modules/es.date.to-primitive.js");
21
+ require("core-js/modules/es.symbol.js");
22
+ require("core-js/modules/es.symbol.description.js");
23
+ require("core-js/modules/es.number.constructor.js");
24
+ var _element = require("./../../../helpers/dom/element");
25
+ var _border = _interopRequireDefault(require("./border"));
26
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
28
+ 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."); }
29
+ 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); }
30
+ 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; }
31
+ 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; } }
32
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
33
+ 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); }
34
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
35
+ 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); } }
36
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
37
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
38
+ 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); }
39
+ /**
40
+ * @class Selection
41
+ */
42
+ var Selection = /*#__PURE__*/function () {
43
+ /**
44
+ * @param {object} settings The selection settings object. @todo type.
45
+ * @param {CellRange} cellRange The cell range instance.
46
+ */
47
+ function Selection(settings, cellRange) {
48
+ _classCallCheck(this, Selection);
49
+ this.settings = settings;
50
+ this.cellRange = cellRange || null;
51
+ this.instanceBorders = {};
52
+ this.classNames = [this.settings.className];
53
+ this.classNameGenerator = this.linearClassNameGenerator(this.settings.className, this.settings.layerLevel);
54
+ }
55
+
56
+ /**
57
+ * Each Walkontable clone requires it's own border for every selection. This method creates and returns selection
58
+ * borders per instance.
59
+ *
60
+ * @param {WalkontableFacade} wotInstance The Walkontable instance.
61
+ * @returns {Border}
62
+ */
63
+ _createClass(Selection, [{
64
+ key: "getBorder",
65
+ value: function getBorder(wotInstance) {
66
+ if (!this.instanceBorders[wotInstance.guid]) {
67
+ this.instanceBorders[wotInstance.guid] = new _border.default(wotInstance, this.settings);
68
+ }
69
+ return this.instanceBorders[wotInstance.guid];
70
+ }
71
+
72
+ /**
73
+ * Checks if selection is empty.
74
+ *
75
+ * @returns {boolean}
76
+ */
77
+ }, {
78
+ key: "isEmpty",
79
+ value: function isEmpty() {
80
+ return this.cellRange === null;
81
+ }
82
+
83
+ /**
84
+ * Adds a cell coords to the selection.
85
+ *
86
+ * @param {CellCoords} coords The cell coordinates to add.
87
+ * @returns {Selection}
88
+ */
89
+ }, {
90
+ key: "add",
91
+ value: function add(coords) {
92
+ if (this.isEmpty()) {
93
+ this.cellRange = this.settings.createCellRange(coords);
94
+ } else {
95
+ this.cellRange.expand(coords);
96
+ }
97
+ return this;
98
+ }
99
+
100
+ /**
101
+ * If selection range from or to property equals oldCoords, replace it with newCoords. Return boolean
102
+ * information about success.
103
+ *
104
+ * @param {CellCoords} oldCoords An old cell coordinates to replace.
105
+ * @param {CellCoords} newCoords The new cell coordinates.
106
+ * @returns {boolean}
107
+ */
108
+ }, {
109
+ key: "replace",
110
+ value: function replace(oldCoords, newCoords) {
111
+ if (!this.isEmpty()) {
112
+ if (this.cellRange.from.isEqual(oldCoords)) {
113
+ this.cellRange.from = newCoords;
114
+ return true;
115
+ }
116
+ if (this.cellRange.to.isEqual(oldCoords)) {
117
+ this.cellRange.to = newCoords;
118
+ return true;
119
+ }
120
+ }
121
+ return false;
122
+ }
123
+
124
+ /**
125
+ * Clears selection.
126
+ *
127
+ * @returns {Selection}
128
+ */
129
+ }, {
130
+ key: "clear",
131
+ value: function clear() {
132
+ this.cellRange = null;
133
+ return this;
134
+ }
135
+
136
+ /**
137
+ * Returns the top left (or top right in RTL) and bottom right (or bottom left in RTL) selection coordinates.
138
+ *
139
+ * @returns {Array} Returns array of coordinates for example `[1, 1, 5, 5]`.
140
+ */
141
+ }, {
142
+ key: "getCorners",
143
+ value: function getCorners() {
144
+ var topStart = this.cellRange.getOuterTopStartCorner();
145
+ var bottomEnd = this.cellRange.getOuterBottomEndCorner();
146
+ return [topStart.row, topStart.col, bottomEnd.row, bottomEnd.col];
147
+ }
148
+
149
+ /**
150
+ * Adds class name to cell element at given coords.
151
+ *
152
+ * @param {WalkontableFacade} wotInstance Walkontable instance.
153
+ * @param {number} sourceRow Cell row coord.
154
+ * @param {number} sourceColumn Cell column coord.
155
+ * @param {string} className Class name.
156
+ * @param {boolean} [markIntersections=false] If `true`, linear className generator will be used to add CSS classes
157
+ * in a continuous way.
158
+ * @returns {Selection}
159
+ */
160
+ }, {
161
+ key: "addClassAtCoords",
162
+ value: function addClassAtCoords(wotInstance, sourceRow, sourceColumn, className) {
163
+ var markIntersections = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
164
+ var TD = wotInstance.wtTable.getCell(this.settings.createCellCoords(sourceRow, sourceColumn));
165
+ if (_typeof(TD) === 'object') {
166
+ var cellClassName = className;
167
+ if (markIntersections) {
168
+ cellClassName = this.classNameGenerator(TD);
169
+ if (!this.classNames.includes(cellClassName)) {
170
+ this.classNames.push(cellClassName);
171
+ }
172
+ }
173
+ (0, _element.addClass)(TD, cellClassName);
174
+ }
175
+ return this;
176
+ }
177
+
178
+ /**
179
+ * Generate helper for calculating classNames based on previously added base className.
180
+ * The generated className is always generated as a continuation of the previous className. For example, when
181
+ * the currently checked element has 'area-2' className the generated new className will be 'area-3'. When
182
+ * the element doesn't have any classNames than the base className will be returned ('area');.
183
+ *
184
+ * @param {string} baseClassName Base className to be used.
185
+ * @param {number} layerLevelOwner Layer level which the instance of the Selection belongs to.
186
+ * @returns {Function}
187
+ */
188
+ }, {
189
+ key: "linearClassNameGenerator",
190
+ value: function linearClassNameGenerator(baseClassName, layerLevelOwner) {
191
+ // TODO: Make this recursive function Proper Tail Calls (TCO/PTC) friendly.
192
+ return function calcClassName(element) {
193
+ var previousIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
194
+ if (layerLevelOwner === 0 || previousIndex === 0) {
195
+ return baseClassName;
196
+ }
197
+ var index = previousIndex >= 0 ? previousIndex : layerLevelOwner;
198
+ var className = baseClassName;
199
+ index -= 1;
200
+ var previousClassName = index === 0 ? baseClassName : "".concat(baseClassName, "-").concat(index);
201
+ if ((0, _element.hasClass)(element, previousClassName)) {
202
+ var currentLayer = index + 1;
203
+ className = "".concat(baseClassName, "-").concat(currentLayer);
204
+ } else {
205
+ className = calcClassName(element, index);
206
+ }
207
+ return className;
208
+ };
209
+ }
210
+
211
+ /**
212
+ * @param {WalkontableFacade} wotInstance The Walkontable instance.
213
+ */
214
+ }, {
215
+ key: "draw",
216
+ value: function draw(wotInstance) {
217
+ if (this.isEmpty()) {
218
+ if (this.settings.border) {
219
+ this.getBorder(wotInstance).disappear();
220
+ }
221
+ return;
222
+ }
223
+ var renderedRows = wotInstance.wtTable.getRenderedRowsCount();
224
+ var renderedColumns = wotInstance.wtTable.getRenderedColumnsCount();
225
+ var corners = this.getCorners();
226
+ var _corners = _slicedToArray(corners, 4),
227
+ topRow = _corners[0],
228
+ topColumn = _corners[1],
229
+ bottomRow = _corners[2],
230
+ bottomColumn = _corners[3];
231
+ var _this$settings = this.settings,
232
+ highlightHeaderClassName = _this$settings.highlightHeaderClassName,
233
+ highlightColumnClassName = _this$settings.highlightColumnClassName,
234
+ highlightRowClassName = _this$settings.highlightRowClassName,
235
+ highlightOnlyClosestHeader = _this$settings.highlightOnlyClosestHeader,
236
+ selectionType = _this$settings.selectionType;
237
+ var isHeaderSelectionType = selectionType === void 0 || ['active-header', 'header'].includes(selectionType);
238
+ if (isHeaderSelectionType && topColumn !== null && bottomColumn !== null) {
239
+ var selectionColumnCursor = 0;
240
+ for (var column = 0; column < renderedColumns; column += 1) {
241
+ var sourceCol = wotInstance.wtTable.columnFilter.renderedToSource(column);
242
+ if (sourceCol >= topColumn && sourceCol <= bottomColumn) {
243
+ var THs = wotInstance.wtTable.getColumnHeaders(sourceCol);
244
+ var closestHeaderLevel = THs.length - 1;
245
+ if (highlightOnlyClosestHeader && THs.length > 1) {
246
+ THs = [THs[closestHeaderLevel]];
247
+ }
248
+ for (var headerLevel = 0; headerLevel < THs.length; headerLevel += 1) {
249
+ var newClasses = [];
250
+ var TH = THs[headerLevel];
251
+ if (highlightHeaderClassName) {
252
+ newClasses.push(highlightHeaderClassName);
253
+ }
254
+ if (highlightColumnClassName) {
255
+ newClasses.push(highlightColumnClassName);
256
+ }
257
+ headerLevel = highlightOnlyClosestHeader ? closestHeaderLevel : headerLevel;
258
+ var newSourceCol = wotInstance.getSetting('onBeforeHighlightingColumnHeader', sourceCol, headerLevel, {
259
+ selectionType: selectionType,
260
+ columnCursor: selectionColumnCursor,
261
+ selectionWidth: bottomColumn - topColumn + 1,
262
+ classNames: newClasses
263
+ });
264
+ if (newSourceCol !== sourceCol) {
265
+ TH = wotInstance.wtTable.getColumnHeader(newSourceCol, headerLevel);
266
+ }
267
+ (0, _element.addClass)(TH, newClasses);
268
+ }
269
+ selectionColumnCursor += 1;
270
+ }
271
+ }
272
+ }
273
+ if (topRow !== null && bottomRow !== null) {
274
+ var selectionRowCursor = 0;
275
+ for (var row = 0; row < renderedRows; row += 1) {
276
+ var sourceRow = wotInstance.wtTable.rowFilter.renderedToSource(row);
277
+ if (isHeaderSelectionType && sourceRow >= topRow && sourceRow <= bottomRow) {
278
+ var _THs = wotInstance.wtTable.getRowHeaders(sourceRow);
279
+ var _closestHeaderLevel = _THs.length - 1;
280
+ if (highlightOnlyClosestHeader && _THs.length > 1) {
281
+ _THs = [_THs[_closestHeaderLevel]];
282
+ }
283
+ for (var _headerLevel = 0; _headerLevel < _THs.length; _headerLevel += 1) {
284
+ var _newClasses = [];
285
+ var _TH = _THs[_headerLevel];
286
+ if (highlightHeaderClassName) {
287
+ _newClasses.push(highlightHeaderClassName);
288
+ }
289
+ if (highlightRowClassName) {
290
+ _newClasses.push(highlightRowClassName);
291
+ }
292
+ _headerLevel = highlightOnlyClosestHeader ? _closestHeaderLevel : _headerLevel;
293
+ var newSourceRow = wotInstance.getSetting('onBeforeHighlightingRowHeader', sourceRow, _headerLevel, {
294
+ selectionType: selectionType,
295
+ rowCursor: selectionRowCursor,
296
+ selectionHeight: bottomRow - topRow + 1,
297
+ classNames: _newClasses
298
+ });
299
+ if (newSourceRow !== sourceRow) {
300
+ _TH = wotInstance.wtTable.getRowHeader(newSourceRow, _headerLevel);
301
+ }
302
+ (0, _element.addClass)(_TH, _newClasses);
303
+ }
304
+ selectionRowCursor += 1;
305
+ }
306
+ if (topColumn !== null && bottomColumn !== null) {
307
+ for (var _column = 0; _column < renderedColumns; _column += 1) {
308
+ var _sourceCol = wotInstance.wtTable.columnFilter.renderedToSource(_column);
309
+ if (sourceRow >= topRow && sourceRow <= bottomRow && _sourceCol >= topColumn && _sourceCol <= bottomColumn) {
310
+ // selected cell
311
+ if (this.settings.className) {
312
+ this.addClassAtCoords(wotInstance, sourceRow, _sourceCol, this.settings.className, this.settings.markIntersections);
313
+ }
314
+ } else if (sourceRow >= topRow && sourceRow <= bottomRow) {
315
+ // selection is in this row
316
+ if (highlightRowClassName) {
317
+ this.addClassAtCoords(wotInstance, sourceRow, _sourceCol, highlightRowClassName);
318
+ }
319
+ } else if (_sourceCol >= topColumn && _sourceCol <= bottomColumn) {
320
+ // selection is in this column
321
+ if (highlightColumnClassName) {
322
+ this.addClassAtCoords(wotInstance, sourceRow, _sourceCol, highlightColumnClassName);
323
+ }
324
+ }
325
+ var additionalSelectionClass = wotInstance.getSetting('onAfterDrawSelection', sourceRow, _sourceCol, this.settings.layerLevel);
326
+ if (typeof additionalSelectionClass === 'string') {
327
+ this.addClassAtCoords(wotInstance, sourceRow, _sourceCol, additionalSelectionClass);
328
+ }
329
+ }
330
+ }
331
+ }
332
+ }
333
+ wotInstance.getSetting('onBeforeDrawBorders', corners, this.settings.className);
334
+ if (this.settings.border) {
335
+ // warning! border.appear modifies corners!
336
+ this.getBorder(wotInstance).appear(corners);
337
+ }
338
+ }
339
+
340
+ /**
341
+ * Cleans up all the DOM state related to a Selection instance. Call this prior to deleting a Selection instance.
342
+ */
343
+ }, {
344
+ key: "destroy",
345
+ value: function destroy() {
346
+ Object.values(this.instanceBorders).forEach(function (border) {
347
+ return border.destroy();
348
+ });
349
+ }
350
+ }]);
351
+ return Selection;
352
+ }();
353
+ var _default = Selection;
354
+ exports.default = _default;