handsontable 0.0.0-next-a2cc849-20240208 → 0.0.0-next-d255844-20240209

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 (69) hide show
  1. package/3rdparty/walkontable/src/cell/range.d.ts +0 -1
  2. package/3rdparty/walkontable/src/cell/range.js +0 -12
  3. package/3rdparty/walkontable/src/cell/range.mjs +0 -12
  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.js +0 -14
  9. package/core.mjs +0 -14
  10. package/dataMap/metaManager/index.js +1 -1
  11. package/dataMap/metaManager/index.mjs +1 -1
  12. package/dist/handsontable.css +2 -2
  13. package/dist/handsontable.full.css +2 -2
  14. package/dist/handsontable.full.js +1113 -1323
  15. package/dist/handsontable.full.min.css +2 -2
  16. package/dist/handsontable.full.min.js +151 -151
  17. package/dist/handsontable.js +1115 -1325
  18. package/dist/handsontable.min.css +2 -2
  19. package/dist/handsontable.min.js +32 -32
  20. package/editorManager.js +8 -12
  21. package/editorManager.mjs +8 -12
  22. package/helpers/mixed.js +1 -1
  23. package/helpers/mixed.mjs +1 -1
  24. package/package.json +1 -1
  25. package/pluginHooks.d.ts +1 -1
  26. package/pluginHooks.js +11 -43
  27. package/pluginHooks.mjs +11 -43
  28. package/plugins/collapsibleColumns/collapsibleColumns.js +1 -7
  29. package/plugins/collapsibleColumns/collapsibleColumns.mjs +1 -7
  30. package/plugins/columnSorting/columnSorting.js +0 -6
  31. package/plugins/columnSorting/columnSorting.mjs +0 -6
  32. package/plugins/contextMenu/menu/defaultShortcutsList.js +10 -26
  33. package/plugins/contextMenu/menu/defaultShortcutsList.mjs +10 -26
  34. package/plugins/filters/component/value.js +51 -5
  35. package/plugins/filters/component/value.mjs +51 -5
  36. package/plugins/filters/utils.js +1 -1
  37. package/plugins/filters/utils.mjs +1 -1
  38. package/plugins/mergeCells/mergeCells.js +1 -3
  39. package/plugins/mergeCells/mergeCells.mjs +1 -3
  40. package/plugins/multiColumnSorting/multiColumnSorting.js +0 -6
  41. package/plugins/multiColumnSorting/multiColumnSorting.mjs +0 -6
  42. package/plugins/nestedHeaders/nestedHeaders.js +0 -1
  43. package/plugins/nestedHeaders/nestedHeaders.mjs +0 -1
  44. package/plugins/nestedRows/nestedRows.js +1 -7
  45. package/plugins/nestedRows/nestedRows.mjs +1 -7
  46. package/renderers/checkboxRenderer/checkboxRenderer.js +4 -4
  47. package/renderers/checkboxRenderer/checkboxRenderer.mjs +4 -4
  48. package/renderers/numericRenderer/index.js +2 -1
  49. package/renderers/numericRenderer/index.mjs +1 -1
  50. package/renderers/numericRenderer/numericRenderer.js +27 -12
  51. package/renderers/numericRenderer/numericRenderer.mjs +26 -12
  52. package/selection/selection.js +30 -156
  53. package/selection/selection.mjs +29 -155
  54. package/selection/transformation.js +27 -18
  55. package/selection/transformation.mjs +27 -18
  56. package/shortcutContexts/commands/editor/closeAndSave.js +2 -2
  57. package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -2
  58. package/shortcutContexts/commands/editor/open.js +3 -18
  59. package/shortcutContexts/commands/editor/open.mjs +3 -18
  60. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +1 -6
  61. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +1 -6
  62. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +1 -6
  63. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +1 -6
  64. package/shortcutContexts/grid.js +2 -2
  65. package/shortcutContexts/grid.mjs +2 -2
  66. package/shortcuts/context.js +1 -2
  67. package/shortcuts/context.mjs +1 -2
  68. package/core/viewportScroll/scrollStrategies/focusScroll.js +0 -15
  69. package/core/viewportScroll/scrollStrategies/focusScroll.mjs +0 -11
@@ -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");
@@ -30,9 +30,6 @@ function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.
30
30
  * @class Selection
31
31
  * @util
32
32
  */
33
- var _transformation = /*#__PURE__*/new WeakMap();
34
- var _focusTransformation = /*#__PURE__*/new WeakMap();
35
- var _isFocusSelectionChanged = /*#__PURE__*/new WeakMap();
36
33
  var _disableHeadersHighlight = /*#__PURE__*/new WeakMap();
37
34
  var _selectionSource = /*#__PURE__*/new WeakMap();
38
35
  var _expectedLayersCount = /*#__PURE__*/new WeakMap();
@@ -72,23 +69,11 @@ class Selection {
72
69
  */
73
70
  _defineProperty(this, "highlight", void 0);
74
71
  /**
75
- * The module for modifying coordinates of the start and end selection.
72
+ * The module for modifying coordinates.
76
73
  *
77
74
  * @type {Transformation}
78
75
  */
79
- _classPrivateFieldInitSpec(this, _transformation, {
80
- writable: true,
81
- value: void 0
82
- });
83
- /**
84
- * The module for modifying coordinates of the focus selection.
85
- *
86
- * @type {Transformation}
87
- */
88
- _classPrivateFieldInitSpec(this, _focusTransformation, {
89
- writable: true,
90
- value: void 0
91
- });
76
+ _defineProperty(this, "transformation", void 0);
92
77
  /**
93
78
  * The collection of the selection layer levels where the whole row was selected using the row header or
94
79
  * the corner header.
@@ -103,15 +88,6 @@ class Selection {
103
88
  * @type {Set<number>}
104
89
  */
105
90
  _defineProperty(this, "selectedByColumnHeader", new Set());
106
- /**
107
- * The flag which determines if the focus selection was changed.
108
- *
109
- * @type {boolean}
110
- */
111
- _classPrivateFieldInitSpec(this, _isFocusSelectionChanged, {
112
- writable: true,
113
- value: false
114
- });
115
91
  /**
116
92
  * When sets disable highlighting the headers even when the logical coordinates points on them.
117
93
  *
@@ -162,100 +138,71 @@ class Selection {
162
138
  createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
163
139
  createCellRange: (highlight, from, to) => this.tableProps.createCellRange(highlight, from, to)
164
140
  });
165
- _classPrivateFieldSet(this, _transformation, new _transformation2.default(this.selectedRange, {
141
+ this.transformation = new _transformation.default(this.selectedRange, {
166
142
  rowIndexMapper: this.tableProps.rowIndexMapper,
167
143
  columnIndexMapper: this.tableProps.columnIndexMapper,
168
144
  countRenderableRows: () => this.tableProps.countRenderableRows(),
169
145
  countRenderableColumns: () => this.tableProps.countRenderableColumns(),
146
+ countRowHeaders: () => this.tableProps.countRowHeaders(),
147
+ countColHeaders: () => this.tableProps.countColHeaders(),
170
148
  visualToRenderableCoords: coords => this.tableProps.visualToRenderableCoords(coords),
171
149
  renderableToVisualCoords: coords => this.tableProps.renderableToVisualCoords(coords),
172
150
  createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
151
+ navigableHeaders: () => settings.navigableHeaders,
173
152
  fixedRowsBottom: () => settings.fixedRowsBottom,
174
153
  minSpareRows: () => settings.minSpareRows,
175
154
  minSpareCols: () => settings.minSpareCols,
176
155
  autoWrapRow: () => settings.autoWrapRow,
177
156
  autoWrapCol: () => settings.autoWrapCol
178
- }));
179
- _classPrivateFieldSet(this, _focusTransformation, new _transformation2.default(this.selectedRange, {
180
- rowIndexMapper: this.tableProps.rowIndexMapper,
181
- columnIndexMapper: this.tableProps.columnIndexMapper,
182
- countRenderableRows: () => {
183
- const range = this.selectedRange.current();
184
- return this.tableProps.countRenderableRowsInRange(0, range.getOuterBottomEndCorner().row);
185
- },
186
- countRenderableColumns: () => {
187
- const range = this.selectedRange.current();
188
- return this.tableProps.countRenderableColumnsInRange(0, range.getOuterBottomEndCorner().col);
189
- },
190
- visualToRenderableCoords: coords => this.tableProps.visualToRenderableCoords(coords),
191
- renderableToVisualCoords: coords => this.tableProps.renderableToVisualCoords(coords),
192
- createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
193
- fixedRowsBottom: () => 0,
194
- minSpareRows: () => 0,
195
- minSpareCols: () => 0,
196
- autoWrapRow: () => true,
197
- autoWrapCol: () => true
198
- }));
199
- _classPrivateFieldGet(this, _transformation).addLocalHook('beforeTransformStart', function () {
157
+ });
158
+ this.transformation.addLocalHook('beforeTransformStart', function () {
200
159
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
201
160
  args[_key] = arguments[_key];
202
161
  }
203
162
  return _this.runLocalHooks('beforeModifyTransformStart', ...args);
204
163
  });
205
- _classPrivateFieldGet(this, _transformation).addLocalHook('afterTransformStart', function () {
164
+ this.transformation.addLocalHook('afterTransformStart', function () {
206
165
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
207
166
  args[_key2] = arguments[_key2];
208
167
  }
209
168
  return _this.runLocalHooks('afterModifyTransformStart', ...args);
210
169
  });
211
- _classPrivateFieldGet(this, _transformation).addLocalHook('beforeTransformEnd', function () {
170
+ this.transformation.addLocalHook('beforeTransformEnd', function () {
212
171
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
213
172
  args[_key3] = arguments[_key3];
214
173
  }
215
174
  return _this.runLocalHooks('beforeModifyTransformEnd', ...args);
216
175
  });
217
- _classPrivateFieldGet(this, _transformation).addLocalHook('afterTransformEnd', function () {
176
+ this.transformation.addLocalHook('afterTransformEnd', function () {
218
177
  for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
219
178
  args[_key4] = arguments[_key4];
220
179
  }
221
180
  return _this.runLocalHooks('afterModifyTransformEnd', ...args);
222
181
  });
223
- _classPrivateFieldGet(this, _transformation).addLocalHook('insertRowRequire', function () {
182
+ this.transformation.addLocalHook('insertRowRequire', function () {
224
183
  for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
225
184
  args[_key5] = arguments[_key5];
226
185
  }
227
186
  return _this.runLocalHooks('insertRowRequire', ...args);
228
187
  });
229
- _classPrivateFieldGet(this, _transformation).addLocalHook('insertColRequire', function () {
188
+ this.transformation.addLocalHook('insertColRequire', function () {
230
189
  for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
231
190
  args[_key6] = arguments[_key6];
232
191
  }
233
192
  return _this.runLocalHooks('insertColRequire', ...args);
234
193
  });
235
- _classPrivateFieldGet(this, _transformation).addLocalHook('beforeRowWrap', function () {
194
+ this.transformation.addLocalHook('beforeRowWrap', function () {
236
195
  for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
237
196
  args[_key7] = arguments[_key7];
238
197
  }
239
198
  return _this.runLocalHooks('beforeRowWrap', ...args);
240
199
  });
241
- _classPrivateFieldGet(this, _transformation).addLocalHook('beforeColumnWrap', function () {
200
+ this.transformation.addLocalHook('beforeColumnWrap', function () {
242
201
  for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
243
202
  args[_key8] = arguments[_key8];
244
203
  }
245
204
  return _this.runLocalHooks('beforeColumnWrap', ...args);
246
205
  });
247
- _classPrivateFieldGet(this, _focusTransformation).addLocalHook('beforeTransformStart', function () {
248
- for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
249
- args[_key9] = arguments[_key9];
250
- }
251
- return _this.runLocalHooks('beforeModifyTransformStart', ...args);
252
- });
253
- _classPrivateFieldGet(this, _focusTransformation).addLocalHook('afterTransformStart', function () {
254
- for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
255
- args[_key10] = arguments[_key10];
256
- }
257
- return _this.runLocalHooks('afterModifyTransformStart', ...args);
258
- });
259
206
  }
260
207
 
261
208
  /**
@@ -346,7 +293,6 @@ class Selection {
346
293
  // We are creating copy. We would like to modify just the start of the selection by below hook. Then original coords
347
294
  // should be handled by next methods.
348
295
  const coordsClone = coords.clone();
349
- _classPrivateFieldSet(this, _isFocusSelectionChanged, false);
350
296
  this.runLocalHooks(`beforeSetRangeStart${fragment ? 'Only' : ''}`, coordsClone);
351
297
  if (!isMultipleMode || isMultipleMode && !isMultipleSelection && (0, _mixed.isUndefined)(multipleSelection)) {
352
298
  this.selectedRange.clear();
@@ -414,7 +360,11 @@ class Selection {
414
360
  }
415
361
  }
416
362
  this.runLocalHooks('beforeHighlightSet');
417
- this.setRangeFocus(this.selectedRange.current().highlight);
363
+ const focusHighlight = this.highlight.getFocus();
364
+ focusHighlight.clear();
365
+ if (this.highlight.isEnabledFor(_highlight.FOCUS_TYPE, cellRange.highlight)) {
366
+ focusHighlight.add(this.selectedRange.current().highlight).commit().syncWith(cellRange);
367
+ }
418
368
  const layerLevel = this.getLayerLevel();
419
369
 
420
370
  // If the next layer level is lower than previous then clear all area and header highlights. This is the
@@ -502,24 +452,15 @@ class Selection {
502
452
  }
503
453
 
504
454
  /**
505
- * Sets the selection focus position at the specified coordinates.
455
+ * Returns information if we have a multiselection. This method check multiselection only on the latest layer of
456
+ * the selection.
506
457
  *
507
- * @param {CellCoords} coords The CellCoords instance with defined visual coordinates.
458
+ * @returns {boolean}
508
459
  */
509
- setRangeFocus(coords) {
510
- if (this.selectedRange.isEmpty()) {
511
- return;
512
- }
513
- const cellRange = this.selectedRange.current();
514
- const focusHighlight = this.highlight.getFocus();
515
- focusHighlight.clear();
516
- if (this.highlight.isEnabledFor(_highlight.FOCUS_TYPE, cellRange.highlight)) {
517
- focusHighlight.add(coords).commit().syncWith(cellRange);
518
- }
519
- if (!this.inProgress) {
520
- _classPrivateFieldSet(this, _isFocusSelectionChanged, true);
521
- this.runLocalHooks('afterSetFocus', coords);
522
- }
460
+ isMultiple() {
461
+ const isMultipleListener = (0, _object.createObjectPropListener)(!this.selectedRange.current().isSingle());
462
+ this.runLocalHooks('afterIsMultipleSelection', isMultipleListener);
463
+ return isMultipleListener.value;
523
464
  }
524
465
 
525
466
  /**
@@ -532,13 +473,7 @@ class Selection {
532
473
  */
533
474
  transformStart(rowDelta, colDelta) {
534
475
  let createMissingRecords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
535
- if (this.settings.navigableHeaders) {
536
- _classPrivateFieldGet(this, _transformation).setOffsetSize({
537
- x: this.tableProps.countRowHeaders(),
538
- y: this.tableProps.countColHeaders()
539
- });
540
- }
541
- this.setRangeStart(_classPrivateFieldGet(this, _transformation).transformStart(rowDelta, colDelta, createMissingRecords));
476
+ this.setRangeStart(this.transformation.transformStart(rowDelta, colDelta, createMissingRecords));
542
477
  }
543
478
 
544
479
  /**
@@ -548,44 +483,7 @@ class Selection {
548
483
  * @param {number} colDelta Columns number to move, value can be passed as negative number.
549
484
  */
550
485
  transformEnd(rowDelta, colDelta) {
551
- if (this.settings.navigableHeaders) {
552
- _classPrivateFieldGet(this, _transformation).setOffsetSize({
553
- x: this.tableProps.countRowHeaders(),
554
- y: this.tableProps.countColHeaders()
555
- });
556
- }
557
- this.setRangeEnd(_classPrivateFieldGet(this, _transformation).transformEnd(rowDelta, colDelta));
558
- }
559
-
560
- /**
561
- * Transforms the focus cell selection relative to the current focus position.
562
- *
563
- * @param {number} rowDelta Rows number to move, value can be passed as negative number.
564
- * @param {number} colDelta Columns number to move, value can be passed as negative number.
565
- */
566
- transformFocus(rowDelta, colDelta) {
567
- const range = this.selectedRange.current();
568
- const {
569
- row,
570
- col
571
- } = range.getOuterTopStartCorner();
572
- const columnsInRange = this.tableProps.countRenderableColumnsInRange(0, col - 1);
573
- const rowsInRange = this.tableProps.countRenderableRowsInRange(0, row - 1);
574
- if (range.highlight.isHeader()) {
575
- // for header focus selection calculate the new coords based on the selection including headers
576
- _classPrivateFieldGet(this, _focusTransformation).setOffsetSize({
577
- x: col < 0 ? Math.abs(col) : -columnsInRange,
578
- y: row < 0 ? Math.abs(row) : -rowsInRange
579
- });
580
- } else {
581
- // for focus selection in cells calculate the new coords only based on the selected cells
582
- _classPrivateFieldGet(this, _focusTransformation).setOffsetSize({
583
- x: col < 0 ? 0 : -columnsInRange,
584
- y: row < 0 ? 0 : -rowsInRange
585
- });
586
- }
587
- const focusCoords = _classPrivateFieldGet(this, _focusTransformation).transformStart(rowDelta, colDelta);
588
- this.setRangeFocus(focusCoords.normalize());
486
+ this.setRangeEnd(this.transformation.transformEnd(rowDelta, colDelta));
589
487
  }
590
488
 
591
489
  /**
@@ -606,30 +504,6 @@ class Selection {
606
504
  return !this.selectedRange.isEmpty();
607
505
  }
608
506
 
609
- /**
610
- * Returns information if we have a multi-selection. This method check multi-selection only on the latest layer of
611
- * the selection.
612
- *
613
- * @returns {boolean}
614
- */
615
- isMultiple() {
616
- if (!this.isSelected()) {
617
- return false;
618
- }
619
- const isMultipleListener = (0, _object.createObjectPropListener)(!this.selectedRange.current().isSingle());
620
- this.runLocalHooks('afterIsMultipleSelection', isMultipleListener);
621
- return isMultipleListener.value;
622
- }
623
-
624
- /**
625
- * Checks if the last selection involves changing the focus cell position only.
626
- *
627
- * @returns {boolean}
628
- */
629
- isFocusSelectionChanged() {
630
- return this.isSelected() && _classPrivateFieldGet(this, _isFocusSelectionChanged);
631
- }
632
-
633
507
  /**
634
508
  * Returns `true` if the selection was applied by clicking to the row header. If the `layerLevel`
635
509
  * argument is passed then only that layer will be checked. Otherwise, it checks if any row header
@@ -24,9 +24,6 @@ import { A11Y_SELECTED } from "../helpers/a11y.mjs";
24
24
  * @class Selection
25
25
  * @util
26
26
  */
27
- var _transformation = /*#__PURE__*/new WeakMap();
28
- var _focusTransformation = /*#__PURE__*/new WeakMap();
29
- var _isFocusSelectionChanged = /*#__PURE__*/new WeakMap();
30
27
  var _disableHeadersHighlight = /*#__PURE__*/new WeakMap();
31
28
  var _selectionSource = /*#__PURE__*/new WeakMap();
32
29
  var _expectedLayersCount = /*#__PURE__*/new WeakMap();
@@ -66,23 +63,11 @@ class Selection {
66
63
  */
67
64
  _defineProperty(this, "highlight", void 0);
68
65
  /**
69
- * The module for modifying coordinates of the start and end selection.
66
+ * The module for modifying coordinates.
70
67
  *
71
68
  * @type {Transformation}
72
69
  */
73
- _classPrivateFieldInitSpec(this, _transformation, {
74
- writable: true,
75
- value: void 0
76
- });
77
- /**
78
- * The module for modifying coordinates of the focus selection.
79
- *
80
- * @type {Transformation}
81
- */
82
- _classPrivateFieldInitSpec(this, _focusTransformation, {
83
- writable: true,
84
- value: void 0
85
- });
70
+ _defineProperty(this, "transformation", void 0);
86
71
  /**
87
72
  * The collection of the selection layer levels where the whole row was selected using the row header or
88
73
  * the corner header.
@@ -97,15 +82,6 @@ class Selection {
97
82
  * @type {Set<number>}
98
83
  */
99
84
  _defineProperty(this, "selectedByColumnHeader", new Set());
100
- /**
101
- * The flag which determines if the focus selection was changed.
102
- *
103
- * @type {boolean}
104
- */
105
- _classPrivateFieldInitSpec(this, _isFocusSelectionChanged, {
106
- writable: true,
107
- value: false
108
- });
109
85
  /**
110
86
  * When sets disable highlighting the headers even when the logical coordinates points on them.
111
87
  *
@@ -156,100 +132,71 @@ class Selection {
156
132
  createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
157
133
  createCellRange: (highlight, from, to) => this.tableProps.createCellRange(highlight, from, to)
158
134
  });
159
- _classPrivateFieldSet(this, _transformation, new Transformation(this.selectedRange, {
135
+ this.transformation = new Transformation(this.selectedRange, {
160
136
  rowIndexMapper: this.tableProps.rowIndexMapper,
161
137
  columnIndexMapper: this.tableProps.columnIndexMapper,
162
138
  countRenderableRows: () => this.tableProps.countRenderableRows(),
163
139
  countRenderableColumns: () => this.tableProps.countRenderableColumns(),
140
+ countRowHeaders: () => this.tableProps.countRowHeaders(),
141
+ countColHeaders: () => this.tableProps.countColHeaders(),
164
142
  visualToRenderableCoords: coords => this.tableProps.visualToRenderableCoords(coords),
165
143
  renderableToVisualCoords: coords => this.tableProps.renderableToVisualCoords(coords),
166
144
  createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
145
+ navigableHeaders: () => settings.navigableHeaders,
167
146
  fixedRowsBottom: () => settings.fixedRowsBottom,
168
147
  minSpareRows: () => settings.minSpareRows,
169
148
  minSpareCols: () => settings.minSpareCols,
170
149
  autoWrapRow: () => settings.autoWrapRow,
171
150
  autoWrapCol: () => settings.autoWrapCol
172
- }));
173
- _classPrivateFieldSet(this, _focusTransformation, new Transformation(this.selectedRange, {
174
- rowIndexMapper: this.tableProps.rowIndexMapper,
175
- columnIndexMapper: this.tableProps.columnIndexMapper,
176
- countRenderableRows: () => {
177
- const range = this.selectedRange.current();
178
- return this.tableProps.countRenderableRowsInRange(0, range.getOuterBottomEndCorner().row);
179
- },
180
- countRenderableColumns: () => {
181
- const range = this.selectedRange.current();
182
- return this.tableProps.countRenderableColumnsInRange(0, range.getOuterBottomEndCorner().col);
183
- },
184
- visualToRenderableCoords: coords => this.tableProps.visualToRenderableCoords(coords),
185
- renderableToVisualCoords: coords => this.tableProps.renderableToVisualCoords(coords),
186
- createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
187
- fixedRowsBottom: () => 0,
188
- minSpareRows: () => 0,
189
- minSpareCols: () => 0,
190
- autoWrapRow: () => true,
191
- autoWrapCol: () => true
192
- }));
193
- _classPrivateFieldGet(this, _transformation).addLocalHook('beforeTransformStart', function () {
151
+ });
152
+ this.transformation.addLocalHook('beforeTransformStart', function () {
194
153
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
195
154
  args[_key] = arguments[_key];
196
155
  }
197
156
  return _this.runLocalHooks('beforeModifyTransformStart', ...args);
198
157
  });
199
- _classPrivateFieldGet(this, _transformation).addLocalHook('afterTransformStart', function () {
158
+ this.transformation.addLocalHook('afterTransformStart', function () {
200
159
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
201
160
  args[_key2] = arguments[_key2];
202
161
  }
203
162
  return _this.runLocalHooks('afterModifyTransformStart', ...args);
204
163
  });
205
- _classPrivateFieldGet(this, _transformation).addLocalHook('beforeTransformEnd', function () {
164
+ this.transformation.addLocalHook('beforeTransformEnd', function () {
206
165
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
207
166
  args[_key3] = arguments[_key3];
208
167
  }
209
168
  return _this.runLocalHooks('beforeModifyTransformEnd', ...args);
210
169
  });
211
- _classPrivateFieldGet(this, _transformation).addLocalHook('afterTransformEnd', function () {
170
+ this.transformation.addLocalHook('afterTransformEnd', function () {
212
171
  for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
213
172
  args[_key4] = arguments[_key4];
214
173
  }
215
174
  return _this.runLocalHooks('afterModifyTransformEnd', ...args);
216
175
  });
217
- _classPrivateFieldGet(this, _transformation).addLocalHook('insertRowRequire', function () {
176
+ this.transformation.addLocalHook('insertRowRequire', function () {
218
177
  for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
219
178
  args[_key5] = arguments[_key5];
220
179
  }
221
180
  return _this.runLocalHooks('insertRowRequire', ...args);
222
181
  });
223
- _classPrivateFieldGet(this, _transformation).addLocalHook('insertColRequire', function () {
182
+ this.transformation.addLocalHook('insertColRequire', function () {
224
183
  for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
225
184
  args[_key6] = arguments[_key6];
226
185
  }
227
186
  return _this.runLocalHooks('insertColRequire', ...args);
228
187
  });
229
- _classPrivateFieldGet(this, _transformation).addLocalHook('beforeRowWrap', function () {
188
+ this.transformation.addLocalHook('beforeRowWrap', function () {
230
189
  for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
231
190
  args[_key7] = arguments[_key7];
232
191
  }
233
192
  return _this.runLocalHooks('beforeRowWrap', ...args);
234
193
  });
235
- _classPrivateFieldGet(this, _transformation).addLocalHook('beforeColumnWrap', function () {
194
+ this.transformation.addLocalHook('beforeColumnWrap', function () {
236
195
  for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
237
196
  args[_key8] = arguments[_key8];
238
197
  }
239
198
  return _this.runLocalHooks('beforeColumnWrap', ...args);
240
199
  });
241
- _classPrivateFieldGet(this, _focusTransformation).addLocalHook('beforeTransformStart', function () {
242
- for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
243
- args[_key9] = arguments[_key9];
244
- }
245
- return _this.runLocalHooks('beforeModifyTransformStart', ...args);
246
- });
247
- _classPrivateFieldGet(this, _focusTransformation).addLocalHook('afterTransformStart', function () {
248
- for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
249
- args[_key10] = arguments[_key10];
250
- }
251
- return _this.runLocalHooks('afterModifyTransformStart', ...args);
252
- });
253
200
  }
254
201
 
255
202
  /**
@@ -340,7 +287,6 @@ class Selection {
340
287
  // We are creating copy. We would like to modify just the start of the selection by below hook. Then original coords
341
288
  // should be handled by next methods.
342
289
  const coordsClone = coords.clone();
343
- _classPrivateFieldSet(this, _isFocusSelectionChanged, false);
344
290
  this.runLocalHooks(`beforeSetRangeStart${fragment ? 'Only' : ''}`, coordsClone);
345
291
  if (!isMultipleMode || isMultipleMode && !isMultipleSelection && isUndefined(multipleSelection)) {
346
292
  this.selectedRange.clear();
@@ -408,7 +354,11 @@ class Selection {
408
354
  }
409
355
  }
410
356
  this.runLocalHooks('beforeHighlightSet');
411
- this.setRangeFocus(this.selectedRange.current().highlight);
357
+ const focusHighlight = this.highlight.getFocus();
358
+ focusHighlight.clear();
359
+ if (this.highlight.isEnabledFor(FOCUS_TYPE, cellRange.highlight)) {
360
+ focusHighlight.add(this.selectedRange.current().highlight).commit().syncWith(cellRange);
361
+ }
412
362
  const layerLevel = this.getLayerLevel();
413
363
 
414
364
  // If the next layer level is lower than previous then clear all area and header highlights. This is the
@@ -496,24 +446,15 @@ class Selection {
496
446
  }
497
447
 
498
448
  /**
499
- * Sets the selection focus position at the specified coordinates.
449
+ * Returns information if we have a multiselection. This method check multiselection only on the latest layer of
450
+ * the selection.
500
451
  *
501
- * @param {CellCoords} coords The CellCoords instance with defined visual coordinates.
452
+ * @returns {boolean}
502
453
  */
503
- setRangeFocus(coords) {
504
- if (this.selectedRange.isEmpty()) {
505
- return;
506
- }
507
- const cellRange = this.selectedRange.current();
508
- const focusHighlight = this.highlight.getFocus();
509
- focusHighlight.clear();
510
- if (this.highlight.isEnabledFor(FOCUS_TYPE, cellRange.highlight)) {
511
- focusHighlight.add(coords).commit().syncWith(cellRange);
512
- }
513
- if (!this.inProgress) {
514
- _classPrivateFieldSet(this, _isFocusSelectionChanged, true);
515
- this.runLocalHooks('afterSetFocus', coords);
516
- }
454
+ isMultiple() {
455
+ const isMultipleListener = createObjectPropListener(!this.selectedRange.current().isSingle());
456
+ this.runLocalHooks('afterIsMultipleSelection', isMultipleListener);
457
+ return isMultipleListener.value;
517
458
  }
518
459
 
519
460
  /**
@@ -526,13 +467,7 @@ class Selection {
526
467
  */
527
468
  transformStart(rowDelta, colDelta) {
528
469
  let createMissingRecords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
529
- if (this.settings.navigableHeaders) {
530
- _classPrivateFieldGet(this, _transformation).setOffsetSize({
531
- x: this.tableProps.countRowHeaders(),
532
- y: this.tableProps.countColHeaders()
533
- });
534
- }
535
- this.setRangeStart(_classPrivateFieldGet(this, _transformation).transformStart(rowDelta, colDelta, createMissingRecords));
470
+ this.setRangeStart(this.transformation.transformStart(rowDelta, colDelta, createMissingRecords));
536
471
  }
537
472
 
538
473
  /**
@@ -542,44 +477,7 @@ class Selection {
542
477
  * @param {number} colDelta Columns number to move, value can be passed as negative number.
543
478
  */
544
479
  transformEnd(rowDelta, colDelta) {
545
- if (this.settings.navigableHeaders) {
546
- _classPrivateFieldGet(this, _transformation).setOffsetSize({
547
- x: this.tableProps.countRowHeaders(),
548
- y: this.tableProps.countColHeaders()
549
- });
550
- }
551
- this.setRangeEnd(_classPrivateFieldGet(this, _transformation).transformEnd(rowDelta, colDelta));
552
- }
553
-
554
- /**
555
- * Transforms the focus cell selection relative to the current focus position.
556
- *
557
- * @param {number} rowDelta Rows number to move, value can be passed as negative number.
558
- * @param {number} colDelta Columns number to move, value can be passed as negative number.
559
- */
560
- transformFocus(rowDelta, colDelta) {
561
- const range = this.selectedRange.current();
562
- const {
563
- row,
564
- col
565
- } = range.getOuterTopStartCorner();
566
- const columnsInRange = this.tableProps.countRenderableColumnsInRange(0, col - 1);
567
- const rowsInRange = this.tableProps.countRenderableRowsInRange(0, row - 1);
568
- if (range.highlight.isHeader()) {
569
- // for header focus selection calculate the new coords based on the selection including headers
570
- _classPrivateFieldGet(this, _focusTransformation).setOffsetSize({
571
- x: col < 0 ? Math.abs(col) : -columnsInRange,
572
- y: row < 0 ? Math.abs(row) : -rowsInRange
573
- });
574
- } else {
575
- // for focus selection in cells calculate the new coords only based on the selected cells
576
- _classPrivateFieldGet(this, _focusTransformation).setOffsetSize({
577
- x: col < 0 ? 0 : -columnsInRange,
578
- y: row < 0 ? 0 : -rowsInRange
579
- });
580
- }
581
- const focusCoords = _classPrivateFieldGet(this, _focusTransformation).transformStart(rowDelta, colDelta);
582
- this.setRangeFocus(focusCoords.normalize());
480
+ this.setRangeEnd(this.transformation.transformEnd(rowDelta, colDelta));
583
481
  }
584
482
 
585
483
  /**
@@ -600,30 +498,6 @@ class Selection {
600
498
  return !this.selectedRange.isEmpty();
601
499
  }
602
500
 
603
- /**
604
- * Returns information if we have a multi-selection. This method check multi-selection only on the latest layer of
605
- * the selection.
606
- *
607
- * @returns {boolean}
608
- */
609
- isMultiple() {
610
- if (!this.isSelected()) {
611
- return false;
612
- }
613
- const isMultipleListener = createObjectPropListener(!this.selectedRange.current().isSingle());
614
- this.runLocalHooks('afterIsMultipleSelection', isMultipleListener);
615
- return isMultipleListener.value;
616
- }
617
-
618
- /**
619
- * Checks if the last selection involves changing the focus cell position only.
620
- *
621
- * @returns {boolean}
622
- */
623
- isFocusSelectionChanged() {
624
- return this.isSelected() && _classPrivateFieldGet(this, _isFocusSelectionChanged);
625
- }
626
-
627
501
  /**
628
502
  * Returns `true` if the selection was applied by clicking to the row header. If the `layerLevel`
629
503
  * argument is passed then only that layer will be checked. Otherwise, it checks if any row header