handsontable 0.0.0-next-5787854-20240205 → 0.0.0-next-7a416a0-20240206

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 (52) hide show
  1. package/base.js +2 -2
  2. package/base.mjs +2 -2
  3. package/core/viewportScroll/index.js +4 -1
  4. package/core/viewportScroll/index.mjs +4 -1
  5. package/core/viewportScroll/scrollStrategies/focusScroll.js +15 -0
  6. package/core/viewportScroll/scrollStrategies/focusScroll.mjs +11 -0
  7. package/core.js +14 -0
  8. package/core.mjs +14 -0
  9. package/dist/handsontable.css +2 -2
  10. package/dist/handsontable.full.css +2 -2
  11. package/dist/handsontable.full.js +1260 -1009
  12. package/dist/handsontable.full.min.css +2 -2
  13. package/dist/handsontable.full.min.js +48 -48
  14. package/dist/handsontable.js +1262 -1011
  15. package/dist/handsontable.min.css +2 -2
  16. package/dist/handsontable.min.js +32 -32
  17. package/helpers/mixed.js +1 -1
  18. package/helpers/mixed.mjs +1 -1
  19. package/package.json +1 -1
  20. package/pluginHooks.d.ts +1 -0
  21. package/pluginHooks.js +43 -1
  22. package/pluginHooks.mjs +43 -1
  23. package/plugins/collapsibleColumns/collapsibleColumns.js +7 -1
  24. package/plugins/collapsibleColumns/collapsibleColumns.mjs +7 -1
  25. package/plugins/columnSorting/columnSorting.js +6 -0
  26. package/plugins/columnSorting/columnSorting.mjs +6 -0
  27. package/plugins/contextMenu/menu/defaultShortcutsList.js +26 -10
  28. package/plugins/contextMenu/menu/defaultShortcutsList.mjs +26 -10
  29. package/plugins/mergeCells/mergeCells.js +3 -1
  30. package/plugins/mergeCells/mergeCells.mjs +3 -1
  31. package/plugins/multiColumnSorting/multiColumnSorting.js +6 -0
  32. package/plugins/multiColumnSorting/multiColumnSorting.mjs +6 -0
  33. package/plugins/nestedHeaders/nestedHeaders.js +1 -0
  34. package/plugins/nestedHeaders/nestedHeaders.mjs +1 -0
  35. package/plugins/nestedRows/nestedRows.js +7 -1
  36. package/plugins/nestedRows/nestedRows.mjs +7 -1
  37. package/renderers/checkboxRenderer/checkboxRenderer.js +4 -4
  38. package/renderers/checkboxRenderer/checkboxRenderer.mjs +4 -4
  39. package/selection/selection.js +144 -30
  40. package/selection/selection.mjs +143 -29
  41. package/selection/transformation.js +18 -27
  42. package/selection/transformation.mjs +18 -27
  43. package/shortcutContexts/commands/editor/open.js +14 -0
  44. package/shortcutContexts/commands/editor/open.mjs +14 -0
  45. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +5 -1
  46. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +5 -1
  47. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +5 -1
  48. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +5 -1
  49. package/shortcutContexts/grid.js +2 -2
  50. package/shortcutContexts/grid.mjs +2 -2
  51. package/shortcuts/context.js +2 -1
  52. package/shortcuts/context.mjs +2 -1
@@ -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; }
11
12
  function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
12
13
  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,7 +32,6 @@ 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();
36
35
  var _clampCoords = /*#__PURE__*/new WeakSet();
37
36
  var _getTableSize = /*#__PURE__*/new WeakSet();
38
37
  var _visualToZeroBasedCoords = /*#__PURE__*/new WeakSet();
@@ -67,13 +66,6 @@ class Transformation {
67
66
  * @returns {{rowDir: 1|0|-1, colDir: 1|0|-1}}
68
67
  */
69
68
  _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);
77
69
  /**
78
70
  * Instance of the SelectionRange, holder for visual coordinates applied to the table.
79
71
  *
@@ -121,10 +113,6 @@ class Transformation {
121
113
  */
122
114
  transformStart(rowDelta, colDelta) {
123
115
  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
- });
128
116
  const delta = _classPrivateFieldGet(this, _options).createCellCoords(rowDelta, colDelta);
129
117
  let visualCoords = _classPrivateFieldGet(this, _range).current().highlight;
130
118
  const highlightRenderableCoords = _classPrivateFieldGet(this, _options).visualToRenderableCoords(visualCoords);
@@ -204,10 +192,6 @@ class Transformation {
204
192
  * @returns {CellCoords} Visual coordinates after transformation.
205
193
  */
206
194
  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
- });
211
195
  const delta = _classPrivateFieldGet(this, _options).createCellCoords(rowDelta, colDelta);
212
196
  const cellRange = _classPrivateFieldGet(this, _range).current();
213
197
  const highlightRenderableCoords = _classPrivateFieldGet(this, _options).visualToRenderableCoords(cellRange.highlight);
@@ -240,16 +224,23 @@ class Transformation {
240
224
  this.runLocalHooks('afterTransformEnd', visualCoords, rowTransformDir, colTransformDir);
241
225
  return visualCoords;
242
226
  }
243
- }
244
- function _setOffsetSize2(_ref) {
245
- let {
246
- x,
247
- y
248
- } = _ref;
249
- _classPrivateFieldSet(this, _offset, {
250
- x,
251
- y
252
- });
227
+
228
+ /**
229
+ * Sets the additional offset in table size that may occur when the `navigableHeaders` option
230
+ * is enabled.
231
+ *
232
+ * @param {{x: number, y: number}} offset Offset as x and y properties.
233
+ */
234
+ setOffsetSize(_ref) {
235
+ let {
236
+ x,
237
+ y
238
+ } = _ref;
239
+ _classPrivateFieldSet(this, _offset, {
240
+ x,
241
+ y
242
+ });
243
+ }
253
244
  }
254
245
  function _clampCoords2(zeroBasedCoords) {
255
246
  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; }
5
6
  function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
6
7
  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,7 +28,6 @@ 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();
32
31
  var _clampCoords = /*#__PURE__*/new WeakSet();
33
32
  var _getTableSize = /*#__PURE__*/new WeakSet();
34
33
  var _visualToZeroBasedCoords = /*#__PURE__*/new WeakSet();
@@ -63,13 +62,6 @@ class Transformation {
63
62
  * @returns {{rowDir: 1|0|-1, colDir: 1|0|-1}}
64
63
  */
65
64
  _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);
73
65
  /**
74
66
  * Instance of the SelectionRange, holder for visual coordinates applied to the table.
75
67
  *
@@ -117,10 +109,6 @@ class Transformation {
117
109
  */
118
110
  transformStart(rowDelta, colDelta) {
119
111
  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
- });
124
112
  const delta = _classPrivateFieldGet(this, _options).createCellCoords(rowDelta, colDelta);
125
113
  let visualCoords = _classPrivateFieldGet(this, _range).current().highlight;
126
114
  const highlightRenderableCoords = _classPrivateFieldGet(this, _options).visualToRenderableCoords(visualCoords);
@@ -200,10 +188,6 @@ class Transformation {
200
188
  * @returns {CellCoords} Visual coordinates after transformation.
201
189
  */
202
190
  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
- });
207
191
  const delta = _classPrivateFieldGet(this, _options).createCellCoords(rowDelta, colDelta);
208
192
  const cellRange = _classPrivateFieldGet(this, _range).current();
209
193
  const highlightRenderableCoords = _classPrivateFieldGet(this, _options).visualToRenderableCoords(cellRange.highlight);
@@ -236,16 +220,23 @@ class Transformation {
236
220
  this.runLocalHooks('afterTransformEnd', visualCoords, rowTransformDir, colTransformDir);
237
221
  return visualCoords;
238
222
  }
239
- }
240
- function _setOffsetSize2(_ref) {
241
- let {
242
- x,
243
- y
244
- } = _ref;
245
- _classPrivateFieldSet(this, _offset, {
246
- x,
247
- y
248
- });
223
+
224
+ /**
225
+ * Sets the additional offset in table size that may occur when the `navigableHeaders` option
226
+ * is enabled.
227
+ *
228
+ * @param {{x: number, y: number}} offset Offset as x and y properties.
229
+ */
230
+ setOffsetSize(_ref) {
231
+ let {
232
+ x,
233
+ y
234
+ } = _ref;
235
+ _classPrivateFieldSet(this, _offset, {
236
+ x,
237
+ y
238
+ });
239
+ }
249
240
  }
250
241
  function _clampCoords2(zeroBasedCoords) {
251
242
  const {
@@ -9,9 +9,23 @@ const command = exports.command = {
9
9
  const {
10
10
  highlight
11
11
  } = hot.getSelectedRangeLast();
12
+
13
+ // supports for navigating with enter key when multiple cells are selected
14
+ if (hot.selection.isMultiple()) {
15
+ const settings = hot.getSettings();
16
+ const enterMoves = typeof settings.enterMoves === 'function' ? settings.enterMoves(event) : settings.enterMoves;
17
+ if (keys.includes('shift')) {
18
+ hot.selection.transformFocus(-enterMoves.row, -enterMoves.col);
19
+ } else {
20
+ hot.selection.transformFocus(enterMoves.row, enterMoves.col);
21
+ }
22
+ return;
23
+ }
12
24
  if (highlight.isHeader()) {
13
25
  return;
14
26
  }
27
+
28
+ // supports editor opening with enter key
15
29
  if (hot.getSettings().enterBeginsEditing) {
16
30
  if (editorManager.cellProperties.readOnly) {
17
31
  editorManager.moveSelectionAfterEnter();
@@ -6,9 +6,23 @@ export const command = {
6
6
  const {
7
7
  highlight
8
8
  } = hot.getSelectedRangeLast();
9
+
10
+ // supports for navigating with enter key when multiple cells are selected
11
+ if (hot.selection.isMultiple()) {
12
+ const settings = hot.getSettings();
13
+ const enterMoves = typeof settings.enterMoves === 'function' ? settings.enterMoves(event) : settings.enterMoves;
14
+ if (keys.includes('shift')) {
15
+ hot.selection.transformFocus(-enterMoves.row, -enterMoves.col);
16
+ } else {
17
+ hot.selection.transformFocus(enterMoves.row, enterMoves.col);
18
+ }
19
+ return;
20
+ }
9
21
  if (highlight.isHeader()) {
10
22
  return;
11
23
  }
24
+
25
+ // supports editor opening with enter key
12
26
  if (hot.getSettings().enterBeginsEditing) {
13
27
  if (editorManager.cellProperties.readOnly) {
14
28
  editorManager.moveSelectionAfterEnter();
@@ -6,6 +6,10 @@ const command = exports.command = {
6
6
  callback(hot, event) {
7
7
  const settings = hot.getSettings();
8
8
  const tabMoves = typeof settings.tabMoves === 'function' ? settings.tabMoves(event) : settings.tabMoves;
9
- hot.selection.transformStart(-tabMoves.row, -tabMoves.col);
9
+ if (hot.selection.isMultiple()) {
10
+ hot.selection.transformFocus(-tabMoves.row, -tabMoves.col);
11
+ } else {
12
+ hot.selection.transformStart(-tabMoves.row, -tabMoves.col);
13
+ }
10
14
  }
11
15
  };
@@ -3,6 +3,10 @@ export const command = {
3
3
  callback(hot, event) {
4
4
  const settings = hot.getSettings();
5
5
  const tabMoves = typeof settings.tabMoves === 'function' ? settings.tabMoves(event) : settings.tabMoves;
6
- hot.selection.transformStart(-tabMoves.row, -tabMoves.col);
6
+ if (hot.selection.isMultiple()) {
7
+ hot.selection.transformFocus(-tabMoves.row, -tabMoves.col);
8
+ } else {
9
+ hot.selection.transformStart(-tabMoves.row, -tabMoves.col);
10
+ }
7
11
  }
8
12
  };
@@ -6,6 +6,10 @@ const command = exports.command = {
6
6
  callback(hot, event) {
7
7
  const settings = hot.getSettings();
8
8
  const tabMoves = typeof settings.tabMoves === 'function' ? settings.tabMoves(event) : settings.tabMoves;
9
- hot.selection.transformStart(tabMoves.row, tabMoves.col);
9
+ if (hot.selection.isMultiple()) {
10
+ hot.selection.transformFocus(tabMoves.row, tabMoves.col);
11
+ } else {
12
+ hot.selection.transformStart(tabMoves.row, tabMoves.col);
13
+ }
10
14
  }
11
15
  };
@@ -3,6 +3,10 @@ export const command = {
3
3
  callback(hot, event) {
4
4
  const settings = hot.getSettings();
5
5
  const tabMoves = typeof settings.tabMoves === 'function' ? settings.tabMoves(event) : settings.tabMoves;
6
- hot.selection.transformStart(tabMoves.row, tabMoves.col);
6
+ if (hot.selection.isMultiple()) {
7
+ hot.selection.transformFocus(tabMoves.row, tabMoves.col);
8
+ } else {
9
+ hot.selection.transformStart(tabMoves.row, tabMoves.col);
10
+ }
7
11
  }
8
12
  };
@@ -157,12 +157,12 @@ function shortcutsGridContext(hot) {
157
157
  keys: [['Tab']],
158
158
  // The property value is controlled by focusCatcher module (https://github.com/handsontable/handsontable/blob/master/handsontable/src/core/focusCatcher/index.js)
159
159
  preventDefault: false,
160
- callback: () => commandsPool.moveCellSelectionInlineStart()
160
+ callback: event => commandsPool.moveCellSelectionInlineStart(event)
161
161
  }, {
162
162
  keys: [['Shift', 'Tab']],
163
163
  // The property value is controlled by focusCatcher module (https://github.com/handsontable/handsontable/blob/master/handsontable/src/core/focusCatcher/index.js)
164
164
  preventDefault: false,
165
- callback: () => commandsPool.moveCellSelectionInlineEnd()
165
+ callback: event => commandsPool.moveCellSelectionInlineEnd(event)
166
166
  }, {
167
167
  keys: [['Control/Meta', 'Backspace']],
168
168
  callback: () => commandsPool.scrollToFocusedCell()
@@ -153,12 +153,12 @@ export function shortcutsGridContext(hot) {
153
153
  keys: [['Tab']],
154
154
  // The property value is controlled by focusCatcher module (https://github.com/handsontable/handsontable/blob/master/handsontable/src/core/focusCatcher/index.js)
155
155
  preventDefault: false,
156
- callback: () => commandsPool.moveCellSelectionInlineStart()
156
+ callback: event => commandsPool.moveCellSelectionInlineStart(event)
157
157
  }, {
158
158
  keys: [['Shift', 'Tab']],
159
159
  // The property value is controlled by focusCatcher module (https://github.com/handsontable/handsontable/blob/master/handsontable/src/core/focusCatcher/index.js)
160
160
  preventDefault: false,
161
- callback: () => commandsPool.moveCellSelectionInlineEnd()
161
+ callback: event => commandsPool.moveCellSelectionInlineEnd(event)
162
162
  }, {
163
163
  keys: [['Control/Meta', 'Backspace']],
164
164
  callback: () => commandsPool.scrollToFocusedCell()
@@ -90,7 +90,8 @@ const createContext = name => {
90
90
  stopPropagation
91
91
  };
92
92
  if ((0, _mixed.isDefined)(relativeToGroup)) {
93
- [newShortcut.relativeToGroup, newShortcut.position] = [relativeToGroup, position];
93
+ newShortcut.relativeToGroup = relativeToGroup;
94
+ newShortcut.position = position;
94
95
  }
95
96
  if (isContextObject(forwardToContext)) {
96
97
  newShortcut.forwardToContext = forwardToContext;
@@ -86,7 +86,8 @@ export const createContext = name => {
86
86
  stopPropagation
87
87
  };
88
88
  if (isDefined(relativeToGroup)) {
89
- [newShortcut.relativeToGroup, newShortcut.position] = [relativeToGroup, position];
89
+ newShortcut.relativeToGroup = relativeToGroup;
90
+ newShortcut.position = position;
90
91
  }
91
92
  if (isContextObject(forwardToContext)) {
92
93
  newShortcut.forwardToContext = forwardToContext;