handsontable 0.0.0-next-a2cc849-20240208 → 0.0.0-next-fd66c90-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 (59) 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 +1022 -1304
  13. package/dist/handsontable.full.min.css +2 -2
  14. package/dist/handsontable.full.min.js +151 -151
  15. package/dist/handsontable.js +1024 -1306
  16. package/dist/handsontable.min.css +2 -2
  17. package/dist/handsontable.min.js +32 -32
  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/mergeCells.js +1 -3
  33. package/plugins/mergeCells/mergeCells.mjs +1 -3
  34. package/plugins/multiColumnSorting/multiColumnSorting.js +0 -6
  35. package/plugins/multiColumnSorting/multiColumnSorting.mjs +0 -6
  36. package/plugins/nestedHeaders/nestedHeaders.js +0 -1
  37. package/plugins/nestedHeaders/nestedHeaders.mjs +0 -1
  38. package/plugins/nestedRows/nestedRows.js +1 -7
  39. package/plugins/nestedRows/nestedRows.mjs +1 -7
  40. package/renderers/checkboxRenderer/checkboxRenderer.js +4 -4
  41. package/renderers/checkboxRenderer/checkboxRenderer.mjs +4 -4
  42. package/selection/selection.js +30 -156
  43. package/selection/selection.mjs +29 -155
  44. package/selection/transformation.js +27 -18
  45. package/selection/transformation.mjs +27 -18
  46. package/shortcutContexts/commands/editor/closeAndSave.js +2 -2
  47. package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -2
  48. package/shortcutContexts/commands/editor/open.js +3 -18
  49. package/shortcutContexts/commands/editor/open.mjs +3 -18
  50. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +1 -6
  51. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +1 -6
  52. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +1 -6
  53. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +1 -6
  54. package/shortcutContexts/grid.js +2 -2
  55. package/shortcutContexts/grid.mjs +2 -2
  56. package/shortcuts/context.js +1 -2
  57. package/shortcuts/context.mjs +1 -2
  58. package/core/viewportScroll/scrollStrategies/focusScroll.js +0 -15
  59. package/core/viewportScroll/scrollStrategies/focusScroll.mjs +0 -11
@@ -20,7 +20,6 @@ import ContextMenuUI from "./ui/contextMenu.mjs";
20
20
  import { error } from "../../helpers/console.mjs";
21
21
  import { isArrayOfObjects } from "../../helpers/data.mjs";
22
22
  import { TrimmingMap } from "../../translations/index.mjs";
23
- import { EDITOR_EDIT_GROUP as SHORTCUTS_GROUP_EDITOR } from "../../shortcutContexts/index.mjs";
24
23
  import RowMoveController from "./utils/rowMoveController.mjs";
25
24
  export const PLUGIN_KEY = 'nestedRows';
26
25
  export const PLUGIN_PRIORITY = 300;
@@ -397,18 +396,13 @@ export class NestedRows extends BasePlugin {
397
396
  this.collapsingUI.collapseChildren(row);
398
397
  }
399
398
  }
400
-
401
- // prevent default Enter behavior (move to the next row within a selection range)
402
- return false;
403
399
  },
404
400
  runOnlyIf: () => {
405
401
  var _this$hot$getSelected;
406
402
  const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
407
403
  return highlight && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
408
404
  },
409
- group: SHORTCUTS_GROUP,
410
- relativeToGroup: SHORTCUTS_GROUP_EDITOR,
411
- position: 'before'
405
+ group: SHORTCUTS_GROUP
412
406
  });
413
407
  }
414
408
 
@@ -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']],
@@ -161,7 +159,9 @@ function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellProperties
161
159
  callback: () => {
162
160
  changeSelectedCheckboxesState(true);
163
161
  return !areSelectedCheckboxCells(); // False blocks next action associated with the keyboard shortcut.
164
- }
162
+ },
163
+ relativeToGroup: _shortcutContexts.EDITOR_EDIT_GROUP,
164
+ position: 'before'
165
165
  }], config);
166
166
  }
167
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']],
@@ -156,7 +154,9 @@ export function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellPro
156
154
  callback: () => {
157
155
  changeSelectedCheckboxesState(true);
158
156
  return !areSelectedCheckboxCells(); // False blocks next action associated with the keyboard shortcut.
159
- }
157
+ },
158
+ relativeToGroup: SHORTCUTS_GROUP_EDITOR,
159
+ position: 'before'
160
160
  }], config);
161
161
  }
162
162
 
@@ -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