handsontable 0.0.0-next-d96e9b5-20240220 → 0.0.0-next-d4816a9-20240221

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 (89) 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/dist/handsontable.css +2 -2
  11. package/dist/handsontable.full.css +2 -2
  12. package/dist/handsontable.full.js +1328 -1606
  13. package/dist/handsontable.full.min.css +2 -2
  14. package/dist/handsontable.full.min.js +151 -151
  15. package/dist/handsontable.js +1328 -1606
  16. package/dist/handsontable.min.css +2 -2
  17. package/dist/handsontable.min.js +19 -19
  18. package/editorManager.js +8 -12
  19. package/editorManager.mjs +8 -12
  20. package/helpers/mixed.js +1 -1
  21. package/helpers/mixed.mjs +1 -1
  22. package/package.json +1 -1
  23. package/pluginHooks.d.ts +0 -1
  24. package/pluginHooks.js +1 -43
  25. package/pluginHooks.mjs +1 -43
  26. package/plugins/collapsibleColumns/collapsibleColumns.js +1 -7
  27. package/plugins/collapsibleColumns/collapsibleColumns.mjs +1 -7
  28. package/plugins/columnSorting/columnSorting.js +0 -6
  29. package/plugins/columnSorting/columnSorting.mjs +0 -6
  30. package/plugins/contextMenu/menu/defaultShortcutsList.js +10 -26
  31. package/plugins/contextMenu/menu/defaultShortcutsList.mjs +10 -26
  32. package/plugins/mergeCells/calculations/selection.js +70 -1
  33. package/plugins/mergeCells/calculations/selection.mjs +70 -1
  34. package/plugins/mergeCells/contextMenuItem/toggleMerge.js +1 -11
  35. package/plugins/mergeCells/contextMenuItem/toggleMerge.mjs +1 -11
  36. package/plugins/mergeCells/mergeCells.js +207 -182
  37. package/plugins/mergeCells/mergeCells.mjs +207 -182
  38. package/plugins/multiColumnSorting/multiColumnSorting.js +0 -6
  39. package/plugins/multiColumnSorting/multiColumnSorting.mjs +0 -6
  40. package/plugins/nestedHeaders/nestedHeaders.js +0 -1
  41. package/plugins/nestedHeaders/nestedHeaders.mjs +0 -1
  42. package/plugins/nestedRows/nestedRows.js +1 -7
  43. package/plugins/nestedRows/nestedRows.mjs +1 -7
  44. package/renderers/checkboxRenderer/checkboxRenderer.js +4 -4
  45. package/renderers/checkboxRenderer/checkboxRenderer.mjs +4 -4
  46. package/selection/highlight/visualSelection.js +0 -2
  47. package/selection/highlight/visualSelection.mjs +0 -2
  48. package/selection/selection.js +34 -195
  49. package/selection/selection.mjs +33 -194
  50. package/selection/transformation.js +30 -45
  51. package/selection/transformation.mjs +30 -45
  52. package/shortcutContexts/commands/editor/closeAndSave.js +2 -2
  53. package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -2
  54. package/shortcutContexts/commands/editor/open.js +3 -18
  55. package/shortcutContexts/commands/editor/open.mjs +3 -18
  56. package/shortcutContexts/commands/extendCellsSelection/down.js +1 -1
  57. package/shortcutContexts/commands/extendCellsSelection/down.mjs +1 -1
  58. package/shortcutContexts/commands/extendCellsSelection/left.js +1 -1
  59. package/shortcutContexts/commands/extendCellsSelection/left.mjs +1 -1
  60. package/shortcutContexts/commands/extendCellsSelection/right.js +1 -1
  61. package/shortcutContexts/commands/extendCellsSelection/right.mjs +1 -1
  62. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +1 -1
  63. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +1 -1
  64. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +1 -3
  65. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +1 -3
  66. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +3 -9
  67. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +3 -9
  68. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +3 -10
  69. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +3 -10
  70. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +1 -3
  71. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +1 -3
  72. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +1 -3
  73. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +1 -3
  74. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +1 -3
  75. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +1 -3
  76. package/shortcutContexts/commands/extendCellsSelection/toRows.js +1 -1
  77. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +1 -1
  78. package/shortcutContexts/commands/extendCellsSelection/up.js +1 -1
  79. package/shortcutContexts/commands/extendCellsSelection/up.mjs +1 -1
  80. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +1 -6
  81. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +1 -6
  82. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +1 -6
  83. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +1 -6
  84. package/shortcutContexts/grid.js +2 -2
  85. package/shortcutContexts/grid.mjs +2 -2
  86. package/shortcuts/context.js +1 -2
  87. package/shortcuts/context.mjs +1 -2
  88. package/core/viewportScroll/scrollStrategies/focusScroll.js +0 -15
  89. package/core/viewportScroll/scrollStrategies/focusScroll.mjs +0 -11
@@ -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();
@@ -398,20 +344,7 @@ class Selection {
398
344
  cellRange.setFrom(cellRange.highlight);
399
345
  cellRange.setTo(cellRange.highlight);
400
346
  } else {
401
- const horizontalDir = cellRange.getHorizontalDirection();
402
- const verticalDir = cellRange.getVerticalDirection();
403
- const isMultiple = this.isMultiple();
404
347
  cellRange.setTo(coordsClone);
405
- if (isMultiple && horizontalDir !== cellRange.getHorizontalDirection()) {
406
- cellRange.from.assign({
407
- col: cellRange.highlight.col
408
- });
409
- }
410
- if (isMultiple && verticalDir !== cellRange.getVerticalDirection()) {
411
- cellRange.from.assign({
412
- row: cellRange.highlight.row
413
- });
414
- }
415
348
  }
416
349
 
417
350
  // Prevent creating "area" selection that overlaps headers.
@@ -421,7 +354,11 @@ class Selection {
421
354
  }
422
355
  }
423
356
  this.runLocalHooks('beforeHighlightSet');
424
- 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
+ }
425
362
  const layerLevel = this.getLayerLevel();
426
363
 
427
364
  // If the next layer level is lower than previous then clear all area and header highlights. This is the
@@ -509,28 +446,15 @@ class Selection {
509
446
  }
510
447
 
511
448
  /**
512
- * 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.
513
451
  *
514
- * @param {CellCoords} coords The CellCoords instance with defined visual coordinates.
452
+ * @returns {boolean}
515
453
  */
516
- setRangeFocus(coords) {
517
- if (this.selectedRange.isEmpty()) {
518
- return;
519
- }
520
- const cellRange = this.selectedRange.current();
521
- const focusHighlight = this.highlight.getFocus();
522
- focusHighlight.clear();
523
- cellRange.setHighlight(coords);
524
- if (!this.inProgress) {
525
- this.runLocalHooks('beforeHighlightSet');
526
- }
527
- if (this.highlight.isEnabledFor(FOCUS_TYPE, cellRange.highlight)) {
528
- focusHighlight.add(cellRange.highlight).commit().syncWith(cellRange);
529
- }
530
- if (!this.inProgress) {
531
- _classPrivateFieldSet(this, _isFocusSelectionChanged, true);
532
- this.runLocalHooks('afterSetFocus', cellRange.highlight);
533
- }
454
+ isMultiple() {
455
+ const isMultipleListener = createObjectPropListener(!this.selectedRange.current().isSingle());
456
+ this.runLocalHooks('afterIsMultipleSelection', isMultipleListener);
457
+ return isMultipleListener.value;
534
458
  }
535
459
 
536
460
  /**
@@ -543,13 +467,7 @@ class Selection {
543
467
  */
544
468
  transformStart(rowDelta, colDelta) {
545
469
  let createMissingRecords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
546
- if (this.settings.navigableHeaders) {
547
- _classPrivateFieldGet(this, _transformation).setOffsetSize({
548
- x: this.tableProps.countRowHeaders(),
549
- y: this.tableProps.countColHeaders()
550
- });
551
- }
552
- this.setRangeStart(_classPrivateFieldGet(this, _transformation).transformStart(rowDelta, colDelta, createMissingRecords));
470
+ this.setRangeStart(this.transformation.transformStart(rowDelta, colDelta, createMissingRecords));
553
471
  }
554
472
 
555
473
  /**
@@ -559,44 +477,7 @@ class Selection {
559
477
  * @param {number} colDelta Columns number to move, value can be passed as negative number.
560
478
  */
561
479
  transformEnd(rowDelta, colDelta) {
562
- if (this.settings.navigableHeaders) {
563
- _classPrivateFieldGet(this, _transformation).setOffsetSize({
564
- x: this.tableProps.countRowHeaders(),
565
- y: this.tableProps.countColHeaders()
566
- });
567
- }
568
- this.setRangeEnd(_classPrivateFieldGet(this, _transformation).transformEnd(rowDelta, colDelta));
569
- }
570
-
571
- /**
572
- * Transforms the focus cell selection relative to the current focus position.
573
- *
574
- * @param {number} rowDelta Rows number to move, value can be passed as negative number.
575
- * @param {number} colDelta Columns number to move, value can be passed as negative number.
576
- */
577
- transformFocus(rowDelta, colDelta) {
578
- const range = this.selectedRange.current();
579
- const {
580
- row,
581
- col
582
- } = range.getOuterTopStartCorner();
583
- const columnsInRange = this.tableProps.countRenderableColumnsInRange(0, col - 1);
584
- const rowsInRange = this.tableProps.countRenderableRowsInRange(0, row - 1);
585
- if (range.highlight.isHeader()) {
586
- // for header focus selection calculate the new coords based on the selection including headers
587
- _classPrivateFieldGet(this, _focusTransformation).setOffsetSize({
588
- x: col < 0 ? Math.abs(col) : -columnsInRange,
589
- y: row < 0 ? Math.abs(row) : -rowsInRange
590
- });
591
- } else {
592
- // for focus selection in cells calculate the new coords only based on the selected cells
593
- _classPrivateFieldGet(this, _focusTransformation).setOffsetSize({
594
- x: col < 0 ? 0 : -columnsInRange,
595
- y: row < 0 ? 0 : -rowsInRange
596
- });
597
- }
598
- const focusCoords = _classPrivateFieldGet(this, _focusTransformation).transformStart(rowDelta, colDelta);
599
- this.setRangeFocus(focusCoords.normalize());
480
+ this.setRangeEnd(this.transformation.transformEnd(rowDelta, colDelta));
600
481
  }
601
482
 
602
483
  /**
@@ -617,30 +498,6 @@ class Selection {
617
498
  return !this.selectedRange.isEmpty();
618
499
  }
619
500
 
620
- /**
621
- * Returns information if we have a multi-selection. This method check multi-selection only on the latest layer of
622
- * the selection.
623
- *
624
- * @returns {boolean}
625
- */
626
- isMultiple() {
627
- if (!this.isSelected()) {
628
- return false;
629
- }
630
- const isMultipleListener = createObjectPropListener(!this.selectedRange.current().isSingle());
631
- this.runLocalHooks('afterIsMultipleSelection', isMultipleListener);
632
- return isMultipleListener.value;
633
- }
634
-
635
- /**
636
- * Checks if the last selection involves changing the focus cell position only.
637
- *
638
- * @returns {boolean}
639
- */
640
- isFocusSelectionChanged() {
641
- return this.isSelected() && _classPrivateFieldGet(this, _isFocusSelectionChanged);
642
- }
643
-
644
501
  /**
645
502
  * Returns `true` if the selection was applied by clicking to the row header. If the `layerLevel`
646
503
  * argument is passed then only that layer will be checked. Otherwise, it checks if any row header
@@ -946,20 +803,11 @@ class Selection {
946
803
  countColHeaders
947
804
  });
948
805
  if (isValid) {
949
- let highlightRow = 0;
950
- let highlightColumn = 0;
951
- if (Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.row) && Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.col)) {
952
- highlightRow = clamp(focusPosition.row, columnHeaderLastIndex, countRows - 1);
953
- highlightColumn = clamp(focusPosition.col, Math.min(start, end), Math.max(start, end));
954
- } else {
955
- highlightRow = clamp(focusPosition, columnHeaderLastIndex, countRows - 1);
956
- highlightColumn = start;
957
- }
958
- const highlight = this.tableProps.createCellCoords(highlightRow, highlightColumn);
959
- const fromRow = countColHeaders === 0 ? 0 : clamp(highlight.row, columnHeaderLastIndex, -1);
806
+ const fromRow = countColHeaders === 0 ? 0 : clamp(focusPosition, columnHeaderLastIndex, -1);
960
807
  const toRow = countRows - 1;
961
808
  const from = this.tableProps.createCellCoords(fromRow, start);
962
809
  const to = this.tableProps.createCellCoords(toRow, end);
810
+ const highlight = this.tableProps.createCellCoords(clamp(focusPosition, columnHeaderLastIndex, countRows - 1), start);
963
811
  this.runLocalHooks('beforeSelectColumns', from, to, highlight);
964
812
 
965
813
  // disallow modifying row axis for that hooks
@@ -1000,20 +848,11 @@ class Selection {
1000
848
  countColHeaders: 0
1001
849
  });
1002
850
  if (isValid) {
1003
- let highlightRow = 0;
1004
- let highlightColumn = 0;
1005
- if (Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.row) && Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.col)) {
1006
- highlightRow = clamp(focusPosition.row, Math.min(startRow, endRow), Math.max(startRow, endRow));
1007
- highlightColumn = clamp(focusPosition.col, rowHeaderLastIndex, countCols - 1);
1008
- } else {
1009
- highlightRow = startRow;
1010
- highlightColumn = clamp(focusPosition, rowHeaderLastIndex, countCols - 1);
1011
- }
1012
- const highlight = this.tableProps.createCellCoords(highlightRow, highlightColumn);
1013
- const fromColumn = countRowHeaders === 0 ? 0 : clamp(highlight.col, rowHeaderLastIndex, -1);
851
+ const fromColumn = countRowHeaders === 0 ? 0 : clamp(focusPosition, rowHeaderLastIndex, -1);
1014
852
  const toColumn = countCols - 1;
1015
853
  const from = this.tableProps.createCellCoords(startRow, fromColumn);
1016
854
  const to = this.tableProps.createCellCoords(endRow, toColumn);
855
+ const highlight = this.tableProps.createCellCoords(startRow, clamp(focusPosition, rowHeaderLastIndex, countCols - 1));
1017
856
  this.runLocalHooks('beforeSelectRows', from, to, highlight);
1018
857
 
1019
858
  // disallow modifying column axis for that hooks
@@ -8,9 +8,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
8
8
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
9
9
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
10
10
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
11
- function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
12
11
  function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
13
12
  function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
13
+ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
14
14
  function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
15
15
  function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
16
16
  function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
@@ -32,6 +32,7 @@ function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.
32
32
  var _range = /*#__PURE__*/new WeakMap();
33
33
  var _options = /*#__PURE__*/new WeakMap();
34
34
  var _offset = /*#__PURE__*/new WeakMap();
35
+ var _setOffsetSize = /*#__PURE__*/new WeakSet();
35
36
  var _clampCoords = /*#__PURE__*/new WeakSet();
36
37
  var _getTableSize = /*#__PURE__*/new WeakSet();
37
38
  var _visualToZeroBasedCoords = /*#__PURE__*/new WeakSet();
@@ -66,6 +67,13 @@ class Transformation {
66
67
  * @returns {{rowDir: 1|0|-1, colDir: 1|0|-1}}
67
68
  */
68
69
  _classPrivateMethodInitSpec(this, _clampCoords);
70
+ /**
71
+ * Sets the additional offset in table size that may occur when the `navigableHeaders` option
72
+ * is enabled.
73
+ *
74
+ * @param {{x: number, y: number}} offset Offset as x and y properties.
75
+ */
76
+ _classPrivateMethodInitSpec(this, _setOffsetSize);
69
77
  /**
70
78
  * Instance of the SelectionRange, holder for visual coordinates applied to the table.
71
79
  *
@@ -113,6 +121,10 @@ class Transformation {
113
121
  */
114
122
  transformStart(rowDelta, colDelta) {
115
123
  let createMissingRecords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
124
+ _classPrivateMethodGet(this, _setOffsetSize, _setOffsetSize2).call(this, {
125
+ x: _classPrivateFieldGet(this, _options).navigableHeaders() ? _classPrivateFieldGet(this, _options).countRowHeaders() : 0,
126
+ y: _classPrivateFieldGet(this, _options).navigableHeaders() ? _classPrivateFieldGet(this, _options).countColHeaders() : 0
127
+ });
116
128
  const delta = _classPrivateFieldGet(this, _options).createCellCoords(rowDelta, colDelta);
117
129
  let visualCoords = _classPrivateFieldGet(this, _range).current().highlight;
118
130
  const highlightRenderableCoords = _classPrivateFieldGet(this, _options).visualToRenderableCoords(visualCoords);
@@ -192,6 +204,10 @@ class Transformation {
192
204
  * @returns {CellCoords} Visual coordinates after transformation.
193
205
  */
194
206
  transformEnd(rowDelta, colDelta) {
207
+ _classPrivateMethodGet(this, _setOffsetSize, _setOffsetSize2).call(this, {
208
+ x: _classPrivateFieldGet(this, _options).navigableHeaders() ? _classPrivateFieldGet(this, _options).countRowHeaders() : 0,
209
+ y: _classPrivateFieldGet(this, _options).navigableHeaders() ? _classPrivateFieldGet(this, _options).countColHeaders() : 0
210
+ });
195
211
  const delta = _classPrivateFieldGet(this, _options).createCellCoords(rowDelta, colDelta);
196
212
  const cellRange = _classPrivateFieldGet(this, _range).current();
197
213
  const highlightRenderableCoords = _classPrivateFieldGet(this, _options).visualToRenderableCoords(cellRange.highlight);
@@ -201,34 +217,10 @@ class Transformation {
201
217
  this.runLocalHooks('beforeTransformEnd', delta);
202
218
  if (highlightRenderableCoords.row !== null && highlightRenderableCoords.col !== null) {
203
219
  const {
204
- row: toRow,
205
- col: toColumn
220
+ row,
221
+ col
206
222
  } = _classPrivateMethodGet(this, _visualToZeroBasedCoords, _visualToZeroBasedCoords2).call(this, cellRange.to);
207
- const {
208
- row: highlightRow,
209
- col: highlightColumn
210
- } = _classPrivateMethodGet(this, _visualToZeroBasedCoords, _visualToZeroBasedCoords2).call(this, cellRange.highlight);
211
- const coords = _classPrivateFieldGet(this, _options).createCellCoords(toRow + delta.row, toColumn + delta.col);
212
- const columnDeltaRest = coords.col - highlightColumn;
213
- const rowDeltaRest = coords.row - highlightRow;
214
- if (delta.col < 0) {
215
- if (toColumn >= highlightColumn && coords.col < highlightColumn) {
216
- coords.col = _classPrivateMethodGet(this, _visualToZeroBasedCoords, _visualToZeroBasedCoords2).call(this, cellRange.getTopStartCorner()).col + columnDeltaRest;
217
- }
218
- } else if (delta.col > 0) {
219
- if (toColumn <= highlightColumn && coords.col > highlightColumn) {
220
- coords.col = _classPrivateMethodGet(this, _visualToZeroBasedCoords, _visualToZeroBasedCoords2).call(this, cellRange.getTopEndCorner()).col + columnDeltaRest;
221
- }
222
- }
223
- if (delta.row < 0) {
224
- if (toRow >= highlightRow && coords.row < highlightRow) {
225
- coords.row = _classPrivateMethodGet(this, _visualToZeroBasedCoords, _visualToZeroBasedCoords2).call(this, cellRange.getTopStartCorner()).row + rowDeltaRest;
226
- }
227
- } else if (delta.row > 0) {
228
- if (toRow <= highlightRow && coords.row > highlightRow) {
229
- coords.row = _classPrivateMethodGet(this, _visualToZeroBasedCoords, _visualToZeroBasedCoords2).call(this, cellRange.getBottomStartCorner()).row + rowDeltaRest;
230
- }
231
- }
223
+ const coords = _classPrivateFieldGet(this, _options).createCellCoords(row + delta.row, col + delta.col);
232
224
  const {
233
225
  rowDir,
234
226
  colDir
@@ -248,23 +240,16 @@ class Transformation {
248
240
  this.runLocalHooks('afterTransformEnd', visualCoords, rowTransformDir, colTransformDir);
249
241
  return visualCoords;
250
242
  }
251
-
252
- /**
253
- * Sets the additional offset in table size that may occur when the `navigableHeaders` option
254
- * is enabled.
255
- *
256
- * @param {{x: number, y: number}} offset Offset as x and y properties.
257
- */
258
- setOffsetSize(_ref) {
259
- let {
260
- x,
261
- y
262
- } = _ref;
263
- _classPrivateFieldSet(this, _offset, {
264
- x,
265
- y
266
- });
267
- }
243
+ }
244
+ function _setOffsetSize2(_ref) {
245
+ let {
246
+ x,
247
+ y
248
+ } = _ref;
249
+ _classPrivateFieldSet(this, _offset, {
250
+ x,
251
+ y
252
+ });
268
253
  }
269
254
  function _clampCoords2(zeroBasedCoords) {
270
255
  const {
@@ -2,9 +2,9 @@ import "core-js/modules/es.error.cause.js";
2
2
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
3
3
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
4
4
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
5
- function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
6
5
  function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
7
6
  function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
7
+ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
8
8
  function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
9
9
  function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
10
10
  function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
@@ -28,6 +28,7 @@ import localHooks from "./../mixins/localHooks.mjs";
28
28
  var _range = /*#__PURE__*/new WeakMap();
29
29
  var _options = /*#__PURE__*/new WeakMap();
30
30
  var _offset = /*#__PURE__*/new WeakMap();
31
+ var _setOffsetSize = /*#__PURE__*/new WeakSet();
31
32
  var _clampCoords = /*#__PURE__*/new WeakSet();
32
33
  var _getTableSize = /*#__PURE__*/new WeakSet();
33
34
  var _visualToZeroBasedCoords = /*#__PURE__*/new WeakSet();
@@ -62,6 +63,13 @@ class Transformation {
62
63
  * @returns {{rowDir: 1|0|-1, colDir: 1|0|-1}}
63
64
  */
64
65
  _classPrivateMethodInitSpec(this, _clampCoords);
66
+ /**
67
+ * Sets the additional offset in table size that may occur when the `navigableHeaders` option
68
+ * is enabled.
69
+ *
70
+ * @param {{x: number, y: number}} offset Offset as x and y properties.
71
+ */
72
+ _classPrivateMethodInitSpec(this, _setOffsetSize);
65
73
  /**
66
74
  * Instance of the SelectionRange, holder for visual coordinates applied to the table.
67
75
  *
@@ -109,6 +117,10 @@ class Transformation {
109
117
  */
110
118
  transformStart(rowDelta, colDelta) {
111
119
  let createMissingRecords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
120
+ _classPrivateMethodGet(this, _setOffsetSize, _setOffsetSize2).call(this, {
121
+ x: _classPrivateFieldGet(this, _options).navigableHeaders() ? _classPrivateFieldGet(this, _options).countRowHeaders() : 0,
122
+ y: _classPrivateFieldGet(this, _options).navigableHeaders() ? _classPrivateFieldGet(this, _options).countColHeaders() : 0
123
+ });
112
124
  const delta = _classPrivateFieldGet(this, _options).createCellCoords(rowDelta, colDelta);
113
125
  let visualCoords = _classPrivateFieldGet(this, _range).current().highlight;
114
126
  const highlightRenderableCoords = _classPrivateFieldGet(this, _options).visualToRenderableCoords(visualCoords);
@@ -188,6 +200,10 @@ class Transformation {
188
200
  * @returns {CellCoords} Visual coordinates after transformation.
189
201
  */
190
202
  transformEnd(rowDelta, colDelta) {
203
+ _classPrivateMethodGet(this, _setOffsetSize, _setOffsetSize2).call(this, {
204
+ x: _classPrivateFieldGet(this, _options).navigableHeaders() ? _classPrivateFieldGet(this, _options).countRowHeaders() : 0,
205
+ y: _classPrivateFieldGet(this, _options).navigableHeaders() ? _classPrivateFieldGet(this, _options).countColHeaders() : 0
206
+ });
191
207
  const delta = _classPrivateFieldGet(this, _options).createCellCoords(rowDelta, colDelta);
192
208
  const cellRange = _classPrivateFieldGet(this, _range).current();
193
209
  const highlightRenderableCoords = _classPrivateFieldGet(this, _options).visualToRenderableCoords(cellRange.highlight);
@@ -197,34 +213,10 @@ class Transformation {
197
213
  this.runLocalHooks('beforeTransformEnd', delta);
198
214
  if (highlightRenderableCoords.row !== null && highlightRenderableCoords.col !== null) {
199
215
  const {
200
- row: toRow,
201
- col: toColumn
216
+ row,
217
+ col
202
218
  } = _classPrivateMethodGet(this, _visualToZeroBasedCoords, _visualToZeroBasedCoords2).call(this, cellRange.to);
203
- const {
204
- row: highlightRow,
205
- col: highlightColumn
206
- } = _classPrivateMethodGet(this, _visualToZeroBasedCoords, _visualToZeroBasedCoords2).call(this, cellRange.highlight);
207
- const coords = _classPrivateFieldGet(this, _options).createCellCoords(toRow + delta.row, toColumn + delta.col);
208
- const columnDeltaRest = coords.col - highlightColumn;
209
- const rowDeltaRest = coords.row - highlightRow;
210
- if (delta.col < 0) {
211
- if (toColumn >= highlightColumn && coords.col < highlightColumn) {
212
- coords.col = _classPrivateMethodGet(this, _visualToZeroBasedCoords, _visualToZeroBasedCoords2).call(this, cellRange.getTopStartCorner()).col + columnDeltaRest;
213
- }
214
- } else if (delta.col > 0) {
215
- if (toColumn <= highlightColumn && coords.col > highlightColumn) {
216
- coords.col = _classPrivateMethodGet(this, _visualToZeroBasedCoords, _visualToZeroBasedCoords2).call(this, cellRange.getTopEndCorner()).col + columnDeltaRest;
217
- }
218
- }
219
- if (delta.row < 0) {
220
- if (toRow >= highlightRow && coords.row < highlightRow) {
221
- coords.row = _classPrivateMethodGet(this, _visualToZeroBasedCoords, _visualToZeroBasedCoords2).call(this, cellRange.getTopStartCorner()).row + rowDeltaRest;
222
- }
223
- } else if (delta.row > 0) {
224
- if (toRow <= highlightRow && coords.row > highlightRow) {
225
- coords.row = _classPrivateMethodGet(this, _visualToZeroBasedCoords, _visualToZeroBasedCoords2).call(this, cellRange.getBottomStartCorner()).row + rowDeltaRest;
226
- }
227
- }
219
+ const coords = _classPrivateFieldGet(this, _options).createCellCoords(row + delta.row, col + delta.col);
228
220
  const {
229
221
  rowDir,
230
222
  colDir
@@ -244,23 +236,16 @@ class Transformation {
244
236
  this.runLocalHooks('afterTransformEnd', visualCoords, rowTransformDir, colTransformDir);
245
237
  return visualCoords;
246
238
  }
247
-
248
- /**
249
- * Sets the additional offset in table size that may occur when the `navigableHeaders` option
250
- * is enabled.
251
- *
252
- * @param {{x: number, y: number}} offset Offset as x and y properties.
253
- */
254
- setOffsetSize(_ref) {
255
- let {
256
- x,
257
- y
258
- } = _ref;
259
- _classPrivateFieldSet(this, _offset, {
260
- x,
261
- y
262
- });
263
- }
239
+ }
240
+ function _setOffsetSize2(_ref) {
241
+ let {
242
+ x,
243
+ y
244
+ } = _ref;
245
+ _classPrivateFieldSet(this, _offset, {
246
+ x,
247
+ y
248
+ });
264
249
  }
265
250
  function _clampCoords2(zeroBasedCoords) {
266
251
  const {
@@ -3,9 +3,9 @@
3
3
  exports.__esModule = true;
4
4
  const command = exports.command = {
5
5
  name: 'editorCloseAndSave',
6
- callback(hot, event) {
6
+ callback(hot, event, keys) {
7
7
  const editorManager = hot._getEditorManager();
8
8
  editorManager.closeEditorAndSaveChanges(event.ctrlKey || event.metaKey);
9
- editorManager.moveSelectionAfterEnter(event);
9
+ editorManager.moveSelectionAfterEnter(keys.includes('shift'));
10
10
  }
11
11
  };
@@ -1,8 +1,8 @@
1
1
  export const command = {
2
2
  name: 'editorCloseAndSave',
3
- callback(hot, event) {
3
+ callback(hot, event, keys) {
4
4
  const editorManager = hot._getEditorManager();
5
5
  editorManager.closeEditorAndSaveChanges(event.ctrlKey || event.metaKey);
6
- editorManager.moveSelectionAfterEnter(event);
6
+ editorManager.moveSelectionAfterEnter(keys.includes('shift'));
7
7
  }
8
8
  };