handsontable 0.0.0-next-e5dbebc-20240319 → 0.0.0-next-a7270c3-20240320

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (98) hide show
  1. package/3rdparty/walkontable/src/cell/range.d.ts +1 -2
  2. package/3rdparty/walkontable/src/cell/range.js +5 -22
  3. package/3rdparty/walkontable/src/cell/range.mjs +5 -22
  4. package/base.js +2 -2
  5. package/base.mjs +2 -2
  6. package/core/viewportScroll/index.js +1 -4
  7. package/core/viewportScroll/index.mjs +1 -4
  8. package/core.d.ts +3 -4
  9. package/core.js +21 -76
  10. package/core.mjs +21 -76
  11. package/dist/handsontable.css +2 -2
  12. package/dist/handsontable.full.css +2 -2
  13. package/dist/handsontable.full.js +1357 -2619
  14. package/dist/handsontable.full.min.css +2 -2
  15. package/dist/handsontable.full.min.js +71 -71
  16. package/dist/handsontable.js +1361 -2623
  17. package/dist/handsontable.min.css +2 -2
  18. package/dist/handsontable.min.js +19 -19
  19. package/editorManager.js +8 -12
  20. package/editorManager.mjs +8 -12
  21. package/focusManager.js +1 -7
  22. package/focusManager.mjs +1 -7
  23. package/helpers/mixed.js +1 -1
  24. package/helpers/mixed.mjs +1 -1
  25. package/package.json +1 -1
  26. package/pluginHooks.d.ts +0 -4
  27. package/pluginHooks.js +1 -69
  28. package/pluginHooks.mjs +1 -69
  29. package/plugins/collapsibleColumns/collapsibleColumns.js +3 -9
  30. package/plugins/collapsibleColumns/collapsibleColumns.mjs +3 -9
  31. package/plugins/columnSorting/columnSorting.js +2 -8
  32. package/plugins/columnSorting/columnSorting.mjs +2 -8
  33. package/plugins/contextMenu/menu/defaultShortcutsList.js +10 -26
  34. package/plugins/contextMenu/menu/defaultShortcutsList.mjs +10 -26
  35. package/plugins/mergeCells/calculations/selection.js +70 -1
  36. package/plugins/mergeCells/calculations/selection.mjs +70 -1
  37. package/plugins/mergeCells/cellsCollection.js +0 -116
  38. package/plugins/mergeCells/cellsCollection.mjs +0 -116
  39. package/plugins/mergeCells/contextMenuItem/toggleMerge.js +1 -11
  40. package/plugins/mergeCells/contextMenuItem/toggleMerge.mjs +1 -11
  41. package/plugins/mergeCells/mergeCells.js +196 -337
  42. package/plugins/mergeCells/mergeCells.mjs +196 -337
  43. package/plugins/multiColumnSorting/multiColumnSorting.js +2 -8
  44. package/plugins/multiColumnSorting/multiColumnSorting.mjs +2 -8
  45. package/plugins/nestedHeaders/nestedHeaders.js +0 -1
  46. package/plugins/nestedHeaders/nestedHeaders.mjs +0 -1
  47. package/plugins/nestedRows/nestedRows.js +3 -9
  48. package/plugins/nestedRows/nestedRows.mjs +3 -9
  49. package/renderers/checkboxRenderer/checkboxRenderer.js +5 -8
  50. package/renderers/checkboxRenderer/checkboxRenderer.mjs +5 -8
  51. package/selection/highlight/visualSelection.js +0 -2
  52. package/selection/highlight/visualSelection.mjs +0 -2
  53. package/selection/selection.js +40 -209
  54. package/selection/selection.mjs +39 -208
  55. package/selection/transformation.js +32 -83
  56. package/selection/transformation.mjs +32 -83
  57. package/shortcutContexts/commands/editor/closeAndSave.js +2 -2
  58. package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -2
  59. package/shortcutContexts/commands/editor/open.js +3 -18
  60. package/shortcutContexts/commands/editor/open.mjs +3 -18
  61. package/shortcutContexts/commands/extendCellsSelection/down.js +1 -1
  62. package/shortcutContexts/commands/extendCellsSelection/down.mjs +1 -1
  63. package/shortcutContexts/commands/extendCellsSelection/left.js +1 -1
  64. package/shortcutContexts/commands/extendCellsSelection/left.mjs +1 -1
  65. package/shortcutContexts/commands/extendCellsSelection/right.js +1 -1
  66. package/shortcutContexts/commands/extendCellsSelection/right.mjs +1 -1
  67. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +1 -1
  68. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +1 -1
  69. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +1 -3
  70. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +1 -3
  71. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +3 -9
  72. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +3 -9
  73. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +3 -10
  74. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +3 -10
  75. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +1 -3
  76. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +1 -3
  77. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +1 -3
  78. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +1 -3
  79. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +1 -3
  80. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +1 -3
  81. package/shortcutContexts/commands/extendCellsSelection/toRows.js +1 -1
  82. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +1 -1
  83. package/shortcutContexts/commands/extendCellsSelection/up.js +1 -1
  84. package/shortcutContexts/commands/extendCellsSelection/up.mjs +1 -1
  85. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +1 -6
  86. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +1 -6
  87. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +1 -6
  88. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +1 -6
  89. package/shortcutContexts/grid.js +2 -2
  90. package/shortcutContexts/grid.mjs +2 -2
  91. package/shortcuts/context.js +1 -2
  92. package/shortcuts/context.mjs +1 -2
  93. package/utils/dataStructures/linkedList.js +1 -6
  94. package/utils/dataStructures/linkedList.mjs +1 -6
  95. package/core/viewportScroll/scrollStrategies/focusScroll.js +0 -15
  96. package/core/viewportScroll/scrollStrategies/focusScroll.mjs +0 -11
  97. package/plugins/mergeCells/focusOrder.js +0 -303
  98. package/plugins/mergeCells/focusOrder.mjs +0 -298
@@ -9,7 +9,6 @@ var _element = require("../../helpers/dom/element");
9
9
  var _rootComparator = require("./rootComparator");
10
10
  var _utils2 = require("./utils");
11
11
  var _domHelpers = require("./domHelpers");
12
- var _shortcutContexts = require("../../shortcutContexts");
13
12
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
14
13
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
15
14
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
@@ -131,17 +130,12 @@ class MultiColumnSorting extends _columnSorting.ColumnSorting {
131
130
  if (highlight.row === -1 && highlight.col >= 0) {
132
131
  this.sort(this.getNextSortConfig(highlight.col, _columnSorting.APPEND_COLUMN_CONFIG_STRATEGY));
133
132
  }
134
-
135
- // prevent default Enter behavior (move to the next row within a selection range)
136
- return false;
137
133
  },
138
134
  runOnlyIf: () => {
139
- var _this$hot$getSelected, _this$hot$getSelected2;
135
+ var _this$hot$getSelected;
140
136
  const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
141
- return highlight && ((_this$hot$getSelected2 = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected2 === void 0 ? void 0 : _this$hot$getSelected2.isSingle()) && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
137
+ return highlight && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
142
138
  },
143
- relativeToGroup: _shortcutContexts.EDITOR_EDIT_GROUP,
144
- position: 'before',
145
139
  group: SHORTCUTS_GROUP
146
140
  });
147
141
  }
@@ -9,7 +9,6 @@ import { addClass, removeClass } from "../../helpers/dom/element.mjs";
9
9
  import { rootComparator } from "./rootComparator.mjs";
10
10
  import { warnAboutPluginsConflict } from "./utils.mjs";
11
11
  import { getClassesToAdd, getClassesToRemove } from "./domHelpers.mjs";
12
- import { EDITOR_EDIT_GROUP as SHORTCUTS_GROUP_EDITOR } from "../../shortcutContexts/index.mjs";
13
12
  export const PLUGIN_KEY = 'multiColumnSorting';
14
13
  export const PLUGIN_PRIORITY = 170;
15
14
  const CONFLICTED_PLUGIN_KEY = 'columnSorting';
@@ -128,17 +127,12 @@ export class MultiColumnSorting extends ColumnSorting {
128
127
  if (highlight.row === -1 && highlight.col >= 0) {
129
128
  this.sort(this.getNextSortConfig(highlight.col, APPEND_COLUMN_CONFIG_STRATEGY));
130
129
  }
131
-
132
- // prevent default Enter behavior (move to the next row within a selection range)
133
- return false;
134
130
  },
135
131
  runOnlyIf: () => {
136
- var _this$hot$getSelected, _this$hot$getSelected2;
132
+ var _this$hot$getSelected;
137
133
  const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
138
- return highlight && ((_this$hot$getSelected2 = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected2 === void 0 ? void 0 : _this$hot$getSelected2.isSingle()) && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
134
+ return highlight && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
139
135
  },
140
- relativeToGroup: SHORTCUTS_GROUP_EDITOR,
141
- position: 'before',
142
136
  group: SHORTCUTS_GROUP
143
137
  });
144
138
  }
@@ -198,7 +198,6 @@ class NestedHeaders extends _base.BasePlugin {
198
198
  return _assertClassBrand(_NestedHeaders_brand, _this, _onModifyTransformStart).call(_this, ...args);
199
199
  });
200
200
  this.addHook('afterSelection', () => _assertClassBrand(_NestedHeaders_brand, this, _updateFocusHighlightPosition).call(this));
201
- this.addHook('afterSelectionFocusSet', () => _assertClassBrand(_NestedHeaders_brand, this, _updateFocusHighlightPosition).call(this));
202
201
  this.addHook('beforeViewportScrollHorizontally', function () {
203
202
  for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
204
203
  args[_key8] = arguments[_key8];
@@ -194,7 +194,6 @@ export class NestedHeaders extends BasePlugin {
194
194
  return _assertClassBrand(_NestedHeaders_brand, _this, _onModifyTransformStart).call(_this, ...args);
195
195
  });
196
196
  this.addHook('afterSelection', () => _assertClassBrand(_NestedHeaders_brand, this, _updateFocusHighlightPosition).call(this));
197
- this.addHook('afterSelectionFocusSet', () => _assertClassBrand(_NestedHeaders_brand, this, _updateFocusHighlightPosition).call(this));
198
197
  this.addHook('beforeViewportScrollHorizontally', function () {
199
198
  for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
200
199
  args[_key8] = arguments[_key8];
@@ -11,7 +11,6 @@ var _contextMenu = _interopRequireDefault(require("./ui/contextMenu"));
11
11
  var _console = require("../../helpers/console");
12
12
  var _data = require("../../helpers/data");
13
13
  var _translations = require("../../translations");
14
- var _shortcutContexts = require("../../shortcutContexts");
15
14
  var _rowMoveController = _interopRequireDefault(require("./utils/rowMoveController"));
16
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
16
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
@@ -277,18 +276,13 @@ class NestedRows extends _base.BasePlugin {
277
276
  this.collapsingUI.collapseChildren(row);
278
277
  }
279
278
  }
280
-
281
- // prevent default Enter behavior (move to the next row within a selection range)
282
- return false;
283
279
  },
284
280
  runOnlyIf: () => {
285
- var _this$hot$getSelected, _this$hot$getSelected2;
281
+ var _this$hot$getSelected;
286
282
  const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
287
- return highlight && ((_this$hot$getSelected2 = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected2 === void 0 ? void 0 : _this$hot$getSelected2.isSingle()) && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
283
+ return highlight && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
288
284
  },
289
- group: SHORTCUTS_GROUP,
290
- relativeToGroup: _shortcutContexts.EDITOR_EDIT_GROUP,
291
- position: 'before'
285
+ group: SHORTCUTS_GROUP
292
286
  });
293
287
  }
294
288
 
@@ -17,7 +17,6 @@ import ContextMenuUI from "./ui/contextMenu.mjs";
17
17
  import { error } from "../../helpers/console.mjs";
18
18
  import { isArrayOfObjects } from "../../helpers/data.mjs";
19
19
  import { TrimmingMap } from "../../translations/index.mjs";
20
- import { EDITOR_EDIT_GROUP as SHORTCUTS_GROUP_EDITOR } from "../../shortcutContexts/index.mjs";
21
20
  import RowMoveController from "./utils/rowMoveController.mjs";
22
21
  export const PLUGIN_KEY = 'nestedRows';
23
22
  export const PLUGIN_PRIORITY = 300;
@@ -273,18 +272,13 @@ export class NestedRows extends BasePlugin {
273
272
  this.collapsingUI.collapseChildren(row);
274
273
  }
275
274
  }
276
-
277
- // prevent default Enter behavior (move to the next row within a selection range)
278
- return false;
279
275
  },
280
276
  runOnlyIf: () => {
281
- var _this$hot$getSelected, _this$hot$getSelected2;
277
+ var _this$hot$getSelected;
282
278
  const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
283
- return highlight && ((_this$hot$getSelected2 = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected2 === void 0 ? void 0 : _this$hot$getSelected2.isSingle()) && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
279
+ return highlight && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
284
280
  },
285
- group: SHORTCUTS_GROUP,
286
- relativeToGroup: SHORTCUTS_GROUP_EDITOR,
287
- position: 'before'
281
+ group: SHORTCUTS_GROUP
288
282
  });
289
283
  }
290
284
 
@@ -139,9 +139,7 @@ function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellProperties
139
139
  const shortcutManager = hotInstance.getShortcutManager();
140
140
  const gridContext = shortcutManager.getContext('grid');
141
141
  const config = {
142
- group: SHORTCUTS_GROUP,
143
- relativeToGroup: _shortcutContexts.EDITOR_EDIT_GROUP,
144
- position: 'before'
142
+ group: SHORTCUTS_GROUP
145
143
  };
146
144
  gridContext.addShortcuts([{
147
145
  keys: [['space']],
@@ -155,16 +153,15 @@ function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellProperties
155
153
  changeSelectedCheckboxesState();
156
154
  return !areSelectedCheckboxCells(); // False blocks next action associated with the keyboard shortcut.
157
155
  },
158
- runOnlyIf: () => {
159
- var _hotInstance$getSelec;
160
- return hotInstance.getSettings().enterBeginsEditing && ((_hotInstance$getSelec = hotInstance.getSelectedRangeLast()) === null || _hotInstance$getSelec === void 0 ? void 0 : _hotInstance$getSelec.isSingle());
161
- }
156
+ runOnlyIf: () => hotInstance.getSettings().enterBeginsEditing
162
157
  }, {
163
158
  keys: [['delete'], ['backspace']],
164
159
  callback: () => {
165
160
  changeSelectedCheckboxesState(true);
166
161
  return !areSelectedCheckboxCells(); // False blocks next action associated with the keyboard shortcut.
167
- }
162
+ },
163
+ relativeToGroup: _shortcutContexts.EDITOR_EDIT_GROUP,
164
+ position: 'before'
168
165
  }], config);
169
166
  }
170
167
 
@@ -134,9 +134,7 @@ export function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellPro
134
134
  const shortcutManager = hotInstance.getShortcutManager();
135
135
  const gridContext = shortcutManager.getContext('grid');
136
136
  const config = {
137
- group: SHORTCUTS_GROUP,
138
- relativeToGroup: SHORTCUTS_GROUP_EDITOR,
139
- position: 'before'
137
+ group: SHORTCUTS_GROUP
140
138
  };
141
139
  gridContext.addShortcuts([{
142
140
  keys: [['space']],
@@ -150,16 +148,15 @@ export function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellPro
150
148
  changeSelectedCheckboxesState();
151
149
  return !areSelectedCheckboxCells(); // False blocks next action associated with the keyboard shortcut.
152
150
  },
153
- runOnlyIf: () => {
154
- var _hotInstance$getSelec;
155
- return hotInstance.getSettings().enterBeginsEditing && ((_hotInstance$getSelec = hotInstance.getSelectedRangeLast()) === null || _hotInstance$getSelec === void 0 ? void 0 : _hotInstance$getSelec.isSingle());
156
- }
151
+ runOnlyIf: () => hotInstance.getSettings().enterBeginsEditing
157
152
  }, {
158
153
  keys: [['delete'], ['backspace']],
159
154
  callback: () => {
160
155
  changeSelectedCheckboxesState(true);
161
156
  return !areSelectedCheckboxCells(); // False blocks next action associated with the keyboard shortcut.
162
- }
157
+ },
158
+ relativeToGroup: SHORTCUTS_GROUP_EDITOR,
159
+ position: 'before'
163
160
  }], config);
164
161
  }
165
162
 
@@ -170,13 +170,11 @@ class VisualSelection extends _src.Selection {
170
170
  this.cellRange = this.settings.createCellRange(cellCoordsRenderable);
171
171
  }
172
172
 
173
- // TODO
174
173
  // We set new highlight as it might change (for example, when showing/hiding some cells from the broader selection range)
175
174
  // TODO: It is also handled by the `MergeCells` plugin while adjusting already modified coordinates. Should it?
176
175
  broaderCellRange.setHighlight(currentHighlight);
177
176
  }
178
177
 
179
- // TODO
180
178
  // Sync the highlight coords from the visual selection layer with logical coords.
181
179
  if (this.settings.selectionType === 'focus' && renderableHighlight !== null && cellCoordsVisual === null) {
182
180
  broaderCellRange.setHighlight(this.visualCellRange.highlight);
@@ -167,13 +167,11 @@ class VisualSelection extends Selection {
167
167
  this.cellRange = this.settings.createCellRange(cellCoordsRenderable);
168
168
  }
169
169
 
170
- // TODO
171
170
  // We set new highlight as it might change (for example, when showing/hiding some cells from the broader selection range)
172
171
  // TODO: It is also handled by the `MergeCells` plugin while adjusting already modified coordinates. Should it?
173
172
  broaderCellRange.setHighlight(currentHighlight);
174
173
  }
175
174
 
176
- // TODO
177
175
  // Sync the highlight coords from the visual selection layer with logical coords.
178
176
  if (this.settings.selectionType === 'focus' && renderableHighlight !== null && cellCoordsVisual === null) {
179
177
  broaderCellRange.setHighlight(this.visualCellRange.highlight);
@@ -9,7 +9,7 @@ var _mixed = require("./../helpers/mixed");
9
9
  var _number = require("./../helpers/number");
10
10
  var _array = require("./../helpers/array");
11
11
  var _localHooks = _interopRequireDefault(require("./../mixins/localHooks"));
12
- var _transformation2 = _interopRequireDefault(require("./transformation"));
12
+ var _transformation = _interopRequireDefault(require("./transformation"));
13
13
  var _utils = require("./utils");
14
14
  var _templateLiteralTag = require("./../helpers/templateLiteralTag");
15
15
  var _a11y = require("../helpers/a11y");
@@ -28,9 +28,6 @@ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.h
28
28
  * @class Selection
29
29
  * @util
30
30
  */
31
- var _transformation = /*#__PURE__*/new WeakMap();
32
- var _focusTransformation = /*#__PURE__*/new WeakMap();
33
- var _isFocusSelectionChanged = /*#__PURE__*/new WeakMap();
34
31
  var _disableHeadersHighlight = /*#__PURE__*/new WeakMap();
35
32
  var _selectionSource = /*#__PURE__*/new WeakMap();
36
33
  var _expectedLayersCount = /*#__PURE__*/new WeakMap();
@@ -70,17 +67,11 @@ class Selection {
70
67
  */
71
68
  _defineProperty(this, "highlight", void 0);
72
69
  /**
73
- * The module for modifying coordinates of the start and end selection.
70
+ * The module for modifying coordinates.
74
71
  *
75
72
  * @type {Transformation}
76
73
  */
77
- _classPrivateFieldInitSpec(this, _transformation, void 0);
78
- /**
79
- * The module for modifying coordinates of the focus selection.
80
- *
81
- * @type {Transformation}
82
- */
83
- _classPrivateFieldInitSpec(this, _focusTransformation, void 0);
74
+ _defineProperty(this, "transformation", void 0);
84
75
  /**
85
76
  * The collection of the selection layer levels where the whole row was selected using the row header or
86
77
  * the corner header.
@@ -95,12 +86,6 @@ class Selection {
95
86
  * @type {Set<number>}
96
87
  */
97
88
  _defineProperty(this, "selectedByColumnHeader", new Set());
98
- /**
99
- * The flag which determines if the focus selection was changed.
100
- *
101
- * @type {boolean}
102
- */
103
- _classPrivateFieldInitSpec(this, _isFocusSelectionChanged, false);
104
89
  /**
105
90
  * When sets disable highlighting the headers even when the logical coordinates points on them.
106
91
  *
@@ -142,112 +127,71 @@ class Selection {
142
127
  createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
143
128
  createCellRange: (highlight, from, to) => this.tableProps.createCellRange(highlight, from, to)
144
129
  });
145
- _classPrivateFieldSet(_transformation, this, new _transformation2.default(this.selectedRange, {
130
+ this.transformation = new _transformation.default(this.selectedRange, {
146
131
  rowIndexMapper: this.tableProps.rowIndexMapper,
147
132
  columnIndexMapper: this.tableProps.columnIndexMapper,
148
133
  countRenderableRows: () => this.tableProps.countRenderableRows(),
149
134
  countRenderableColumns: () => this.tableProps.countRenderableColumns(),
135
+ countRowHeaders: () => this.tableProps.countRowHeaders(),
136
+ countColHeaders: () => this.tableProps.countColHeaders(),
150
137
  visualToRenderableCoords: coords => this.tableProps.visualToRenderableCoords(coords),
151
138
  renderableToVisualCoords: coords => this.tableProps.renderableToVisualCoords(coords),
152
- findFirstNonHiddenRenderableRow: function () {
153
- return _this.tableProps.findFirstNonHiddenRenderableRow(...arguments);
154
- },
155
- findFirstNonHiddenRenderableColumn: function () {
156
- return _this.tableProps.findFirstNonHiddenRenderableColumn(...arguments);
157
- },
158
139
  createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
140
+ navigableHeaders: () => settings.navigableHeaders,
159
141
  fixedRowsBottom: () => settings.fixedRowsBottom,
160
142
  minSpareRows: () => settings.minSpareRows,
161
143
  minSpareCols: () => settings.minSpareCols,
162
144
  autoWrapRow: () => settings.autoWrapRow,
163
145
  autoWrapCol: () => settings.autoWrapCol
164
- }));
165
- _classPrivateFieldSet(_focusTransformation, this, new _transformation2.default(this.selectedRange, {
166
- rowIndexMapper: this.tableProps.rowIndexMapper,
167
- columnIndexMapper: this.tableProps.columnIndexMapper,
168
- countRenderableRows: () => {
169
- const range = this.selectedRange.current();
170
- return this.tableProps.countRenderableRowsInRange(0, range.getOuterBottomEndCorner().row);
171
- },
172
- countRenderableColumns: () => {
173
- const range = this.selectedRange.current();
174
- return this.tableProps.countRenderableColumnsInRange(0, range.getOuterBottomEndCorner().col);
175
- },
176
- visualToRenderableCoords: coords => this.tableProps.visualToRenderableCoords(coords),
177
- renderableToVisualCoords: coords => this.tableProps.renderableToVisualCoords(coords),
178
- findFirstNonHiddenRenderableRow: function () {
179
- return _this.tableProps.findFirstNonHiddenRenderableRow(...arguments);
180
- },
181
- findFirstNonHiddenRenderableColumn: function () {
182
- return _this.tableProps.findFirstNonHiddenRenderableColumn(...arguments);
183
- },
184
- createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
185
- fixedRowsBottom: () => 0,
186
- minSpareRows: () => 0,
187
- minSpareCols: () => 0,
188
- autoWrapRow: () => true,
189
- autoWrapCol: () => true
190
- }));
191
- _classPrivateFieldGet(_transformation, this).addLocalHook('beforeTransformStart', function () {
146
+ });
147
+ this.transformation.addLocalHook('beforeTransformStart', function () {
192
148
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
193
149
  args[_key] = arguments[_key];
194
150
  }
195
151
  return _this.runLocalHooks('beforeModifyTransformStart', ...args);
196
152
  });
197
- _classPrivateFieldGet(_transformation, this).addLocalHook('afterTransformStart', function () {
153
+ this.transformation.addLocalHook('afterTransformStart', function () {
198
154
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
199
155
  args[_key2] = arguments[_key2];
200
156
  }
201
157
  return _this.runLocalHooks('afterModifyTransformStart', ...args);
202
158
  });
203
- _classPrivateFieldGet(_transformation, this).addLocalHook('beforeTransformEnd', function () {
159
+ this.transformation.addLocalHook('beforeTransformEnd', function () {
204
160
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
205
161
  args[_key3] = arguments[_key3];
206
162
  }
207
163
  return _this.runLocalHooks('beforeModifyTransformEnd', ...args);
208
164
  });
209
- _classPrivateFieldGet(_transformation, this).addLocalHook('afterTransformEnd', function () {
165
+ this.transformation.addLocalHook('afterTransformEnd', function () {
210
166
  for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
211
167
  args[_key4] = arguments[_key4];
212
168
  }
213
169
  return _this.runLocalHooks('afterModifyTransformEnd', ...args);
214
170
  });
215
- _classPrivateFieldGet(_transformation, this).addLocalHook('insertRowRequire', function () {
171
+ this.transformation.addLocalHook('insertRowRequire', function () {
216
172
  for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
217
173
  args[_key5] = arguments[_key5];
218
174
  }
219
175
  return _this.runLocalHooks('insertRowRequire', ...args);
220
176
  });
221
- _classPrivateFieldGet(_transformation, this).addLocalHook('insertColRequire', function () {
177
+ this.transformation.addLocalHook('insertColRequire', function () {
222
178
  for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
223
179
  args[_key6] = arguments[_key6];
224
180
  }
225
181
  return _this.runLocalHooks('insertColRequire', ...args);
226
182
  });
227
- _classPrivateFieldGet(_transformation, this).addLocalHook('beforeRowWrap', function () {
183
+ this.transformation.addLocalHook('beforeRowWrap', function () {
228
184
  for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
229
185
  args[_key7] = arguments[_key7];
230
186
  }
231
187
  return _this.runLocalHooks('beforeRowWrap', ...args);
232
188
  });
233
- _classPrivateFieldGet(_transformation, this).addLocalHook('beforeColumnWrap', function () {
189
+ this.transformation.addLocalHook('beforeColumnWrap', function () {
234
190
  for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
235
191
  args[_key8] = arguments[_key8];
236
192
  }
237
193
  return _this.runLocalHooks('beforeColumnWrap', ...args);
238
194
  });
239
- _classPrivateFieldGet(_focusTransformation, this).addLocalHook('beforeTransformStart', function () {
240
- for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
241
- args[_key9] = arguments[_key9];
242
- }
243
- return _this.runLocalHooks('beforeModifyTransformFocus', ...args);
244
- });
245
- _classPrivateFieldGet(_focusTransformation, this).addLocalHook('afterTransformStart', function () {
246
- for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
247
- args[_key10] = arguments[_key10];
248
- }
249
- return _this.runLocalHooks('afterModifyTransformFocus', ...args);
250
- });
251
195
  }
252
196
 
253
197
  /**
@@ -338,7 +282,6 @@ class Selection {
338
282
  // We are creating copy. We would like to modify just the start of the selection by below hook. Then original coords
339
283
  // should be handled by next methods.
340
284
  const coordsClone = coords.clone();
341
- _classPrivateFieldSet(_isFocusSelectionChanged, this, false);
342
285
  this.runLocalHooks(`beforeSetRangeStart${fragment ? 'Only' : ''}`, coordsClone);
343
286
  if (!isMultipleMode || isMultipleMode && !isMultipleSelection && (0, _mixed.isUndefined)(multipleSelection)) {
344
287
  this.selectedRange.clear();
@@ -396,20 +339,7 @@ class Selection {
396
339
  cellRange.setFrom(cellRange.highlight);
397
340
  cellRange.setTo(cellRange.highlight);
398
341
  } else {
399
- const horizontalDir = cellRange.getHorizontalDirection();
400
- const verticalDir = cellRange.getVerticalDirection();
401
- const isMultiple = this.isMultiple();
402
342
  cellRange.setTo(coordsClone);
403
- if (isMultiple && (horizontalDir !== cellRange.getHorizontalDirection() || cellRange.getWidth() === 1 && !cellRange.includes(cellRange.highlight))) {
404
- cellRange.from.assign({
405
- col: cellRange.highlight.col
406
- });
407
- }
408
- if (isMultiple && (verticalDir !== cellRange.getVerticalDirection() || cellRange.getHeight() === 1 && !cellRange.includes(cellRange.highlight))) {
409
- cellRange.from.assign({
410
- row: cellRange.highlight.row
411
- });
412
- }
413
343
  }
414
344
 
415
345
  // Prevent creating "area" selection that overlaps headers.
@@ -419,7 +349,11 @@ class Selection {
419
349
  }
420
350
  }
421
351
  this.runLocalHooks('beforeHighlightSet');
422
- this.setRangeFocus(this.selectedRange.current().highlight);
352
+ const focusHighlight = this.highlight.getFocus();
353
+ focusHighlight.clear();
354
+ if (this.highlight.isEnabledFor(_highlight.FOCUS_TYPE, cellRange.highlight)) {
355
+ focusHighlight.add(this.selectedRange.current().highlight).commit().syncWith(cellRange);
356
+ }
423
357
  const layerLevel = this.getLayerLevel();
424
358
 
425
359
  // If the next layer level is lower than previous then clear all area and header highlights. This is the
@@ -507,31 +441,15 @@ class Selection {
507
441
  }
508
442
 
509
443
  /**
510
- * Sets the selection focus position at the specified coordinates.
444
+ * Returns information if we have a multiselection. This method check multiselection only on the latest layer of
445
+ * the selection.
511
446
  *
512
- * @param {CellCoords} coords The CellCoords instance with defined visual coordinates.
447
+ * @returns {boolean}
513
448
  */
514
- setRangeFocus(coords) {
515
- if (this.selectedRange.isEmpty()) {
516
- return;
517
- }
518
- const cellRange = this.selectedRange.current();
519
- if (!this.inProgress) {
520
- this.runLocalHooks('beforeSetFocus', coords);
521
- }
522
- const focusHighlight = this.highlight.getFocus();
523
- focusHighlight.clear();
524
- cellRange.setHighlight(coords);
525
- if (!this.inProgress) {
526
- this.runLocalHooks('beforeHighlightSet');
527
- }
528
- if (this.highlight.isEnabledFor(_highlight.FOCUS_TYPE, cellRange.highlight)) {
529
- focusHighlight.add(cellRange.highlight).commit().syncWith(cellRange);
530
- }
531
- if (!this.inProgress) {
532
- _classPrivateFieldSet(_isFocusSelectionChanged, this, true);
533
- this.runLocalHooks('afterSetFocus', cellRange.highlight);
534
- }
449
+ isMultiple() {
450
+ const isMultipleListener = (0, _object.createObjectPropListener)(!this.selectedRange.current().isSingle());
451
+ this.runLocalHooks('afterIsMultipleSelection', isMultipleListener);
452
+ return isMultipleListener.value;
535
453
  }
536
454
 
537
455
  /**
@@ -544,13 +462,7 @@ class Selection {
544
462
  */
545
463
  transformStart(rowDelta, colDelta) {
546
464
  let createMissingRecords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
547
- if (this.settings.navigableHeaders) {
548
- _classPrivateFieldGet(_transformation, this).setOffsetSize({
549
- x: this.tableProps.countRowHeaders(),
550
- y: this.tableProps.countColHeaders()
551
- });
552
- }
553
- this.setRangeStart(_classPrivateFieldGet(_transformation, this).transformStart(rowDelta, colDelta, createMissingRecords));
465
+ this.setRangeStart(this.transformation.transformStart(rowDelta, colDelta, createMissingRecords));
554
466
  }
555
467
 
556
468
  /**
@@ -560,44 +472,7 @@ class Selection {
560
472
  * @param {number} colDelta Columns number to move, value can be passed as negative number.
561
473
  */
562
474
  transformEnd(rowDelta, colDelta) {
563
- if (this.settings.navigableHeaders) {
564
- _classPrivateFieldGet(_transformation, this).setOffsetSize({
565
- x: this.tableProps.countRowHeaders(),
566
- y: this.tableProps.countColHeaders()
567
- });
568
- }
569
- this.setRangeEnd(_classPrivateFieldGet(_transformation, this).transformEnd(rowDelta, colDelta));
570
- }
571
-
572
- /**
573
- * Transforms the focus cell selection relative to the current focus position.
574
- *
575
- * @param {number} rowDelta Rows number to move, value can be passed as negative number.
576
- * @param {number} colDelta Columns number to move, value can be passed as negative number.
577
- */
578
- transformFocus(rowDelta, colDelta) {
579
- const range = this.selectedRange.current();
580
- const {
581
- row,
582
- col
583
- } = range.getOuterTopStartCorner();
584
- const columnsInRange = this.tableProps.countRenderableColumnsInRange(0, col - 1);
585
- const rowsInRange = this.tableProps.countRenderableRowsInRange(0, row - 1);
586
- if (range.highlight.isHeader()) {
587
- // for header focus selection calculate the new coords based on the selection including headers
588
- _classPrivateFieldGet(_focusTransformation, this).setOffsetSize({
589
- x: col < 0 ? Math.abs(col) : -columnsInRange,
590
- y: row < 0 ? Math.abs(row) : -rowsInRange
591
- });
592
- } else {
593
- // for focus selection in cells calculate the new coords only based on the selected cells
594
- _classPrivateFieldGet(_focusTransformation, this).setOffsetSize({
595
- x: col < 0 ? 0 : -columnsInRange,
596
- y: row < 0 ? 0 : -rowsInRange
597
- });
598
- }
599
- const focusCoords = _classPrivateFieldGet(_focusTransformation, this).transformStart(rowDelta, colDelta);
600
- this.setRangeFocus(focusCoords.normalize());
475
+ this.setRangeEnd(this.transformation.transformEnd(rowDelta, colDelta));
601
476
  }
602
477
 
603
478
  /**
@@ -618,30 +493,6 @@ class Selection {
618
493
  return !this.selectedRange.isEmpty();
619
494
  }
620
495
 
621
- /**
622
- * Returns information if we have a multi-selection. This method check multi-selection only on the latest layer of
623
- * the selection.
624
- *
625
- * @returns {boolean}
626
- */
627
- isMultiple() {
628
- if (!this.isSelected()) {
629
- return false;
630
- }
631
- const isMultipleListener = (0, _object.createObjectPropListener)(!this.selectedRange.current().isSingle());
632
- this.runLocalHooks('afterIsMultipleSelection', isMultipleListener);
633
- return isMultipleListener.value;
634
- }
635
-
636
- /**
637
- * Checks if the last selection involves changing the focus cell position only.
638
- *
639
- * @returns {boolean}
640
- */
641
- isFocusSelectionChanged() {
642
- return this.isSelected() && _classPrivateFieldGet(_isFocusSelectionChanged, this);
643
- }
644
-
645
496
  /**
646
497
  * Returns `true` if the selection was applied by clicking to the row header. If the `layerLevel`
647
498
  * argument is passed then only that layer will be checked. Otherwise, it checks if any row header
@@ -924,10 +775,9 @@ class Selection {
924
775
  *
925
776
  * @param {number|string} startColumn Visual column index or column property from which the selection starts.
926
777
  * @param {number|string} [endColumn] Visual column index or column property from to the selection finishes.
927
- * @param {number | { row: number, col: number }} [focusPosition=0] The argument allows changing the cell/header focus
928
- * position. The value can take visual row index from -N to N, where negative values point to the headers and positive
929
- * values point to the cell range. An object with `row` and `col` properties also can be passed to change the focus
930
- * position horizontally.
778
+ * @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
779
+ * The value can take visual row index from -N to N, where negative values
780
+ * point to the headers and positive values point to the cell range.
931
781
  * @returns {boolean} Returns `true` if selection was successful, `false` otherwise.
932
782
  */
933
783
  selectColumns(startColumn) {
@@ -948,20 +798,11 @@ class Selection {
948
798
  countColHeaders
949
799
  });
950
800
  if (isValid) {
951
- let highlightRow = 0;
952
- let highlightColumn = 0;
953
- if (Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.row) && Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.col)) {
954
- highlightRow = (0, _number.clamp)(focusPosition.row, columnHeaderLastIndex, countRows - 1);
955
- highlightColumn = (0, _number.clamp)(focusPosition.col, Math.min(start, end), Math.max(start, end));
956
- } else {
957
- highlightRow = (0, _number.clamp)(focusPosition, columnHeaderLastIndex, countRows - 1);
958
- highlightColumn = start;
959
- }
960
- const highlight = this.tableProps.createCellCoords(highlightRow, highlightColumn);
961
- const fromRow = countColHeaders === 0 ? 0 : (0, _number.clamp)(highlight.row, columnHeaderLastIndex, -1);
801
+ const fromRow = countColHeaders === 0 ? 0 : (0, _number.clamp)(focusPosition, columnHeaderLastIndex, -1);
962
802
  const toRow = countRows - 1;
963
803
  const from = this.tableProps.createCellCoords(fromRow, start);
964
804
  const to = this.tableProps.createCellCoords(toRow, end);
805
+ const highlight = this.tableProps.createCellCoords((0, _number.clamp)(focusPosition, columnHeaderLastIndex, countRows - 1), start);
965
806
  this.runLocalHooks('beforeSelectColumns', from, to, highlight);
966
807
 
967
808
  // disallow modifying row axis for that hooks
@@ -981,10 +822,9 @@ class Selection {
981
822
  *
982
823
  * @param {number} startRow Visual row index from which the selection starts.
983
824
  * @param {number} [endRow] Visual row index from to the selection finishes.
984
- * @param {number | { row: number, col: number }} [focusPosition=0] The argument allows changing the cell/header focus
985
- * position. The value can take visual row index from -N to N, where negative values point to the headers and positive
986
- * values point to the cell range. An object with `row` and `col` properties also can be passed to change the focus
987
- * position horizontally.
825
+ * @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
826
+ * The value can take visual column index from -N to N, where negative values
827
+ * point to the headers and positive values point to the cell range.
988
828
  * @returns {boolean} Returns `true` if selection was successful, `false` otherwise.
989
829
  */
990
830
  selectRows(startRow) {
@@ -1003,20 +843,11 @@ class Selection {
1003
843
  countColHeaders: 0
1004
844
  });
1005
845
  if (isValid) {
1006
- let highlightRow = 0;
1007
- let highlightColumn = 0;
1008
- if (Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.row) && Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.col)) {
1009
- highlightRow = (0, _number.clamp)(focusPosition.row, Math.min(startRow, endRow), Math.max(startRow, endRow));
1010
- highlightColumn = (0, _number.clamp)(focusPosition.col, rowHeaderLastIndex, countCols - 1);
1011
- } else {
1012
- highlightRow = startRow;
1013
- highlightColumn = (0, _number.clamp)(focusPosition, rowHeaderLastIndex, countCols - 1);
1014
- }
1015
- const highlight = this.tableProps.createCellCoords(highlightRow, highlightColumn);
1016
- const fromColumn = countRowHeaders === 0 ? 0 : (0, _number.clamp)(highlight.col, rowHeaderLastIndex, -1);
846
+ const fromColumn = countRowHeaders === 0 ? 0 : (0, _number.clamp)(focusPosition, rowHeaderLastIndex, -1);
1017
847
  const toColumn = countCols - 1;
1018
848
  const from = this.tableProps.createCellCoords(startRow, fromColumn);
1019
849
  const to = this.tableProps.createCellCoords(endRow, toColumn);
850
+ const highlight = this.tableProps.createCellCoords(startRow, (0, _number.clamp)(focusPosition, rowHeaderLastIndex, countCols - 1));
1020
851
  this.runLocalHooks('beforeSelectRows', from, to, highlight);
1021
852
 
1022
853
  // disallow modifying column axis for that hooks