handsontable 0.0.0-next-bff5041-20240315 → 0.0.0-next-f748da8-20240318

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 (96) hide show
  1. package/3rdparty/walkontable/src/cell/range.d.ts +2 -1
  2. package/3rdparty/walkontable/src/cell/range.js +22 -5
  3. package/3rdparty/walkontable/src/cell/range.mjs +22 -5
  4. package/base.js +2 -2
  5. package/base.mjs +2 -2
  6. package/core/viewportScroll/index.js +4 -1
  7. package/core/viewportScroll/index.mjs +4 -1
  8. package/core/viewportScroll/scrollStrategies/focusScroll.js +15 -0
  9. package/core/viewportScroll/scrollStrategies/focusScroll.mjs +11 -0
  10. package/core.d.ts +4 -3
  11. package/core.js +76 -21
  12. package/core.mjs +76 -21
  13. package/dist/handsontable.css +2 -2
  14. package/dist/handsontable.full.css +2 -2
  15. package/dist/handsontable.full.js +2611 -1352
  16. package/dist/handsontable.full.min.css +2 -2
  17. package/dist/handsontable.full.min.js +64 -64
  18. package/dist/handsontable.js +2615 -1356
  19. package/dist/handsontable.min.css +2 -2
  20. package/dist/handsontable.min.js +19 -19
  21. package/editorManager.js +12 -8
  22. package/editorManager.mjs +12 -8
  23. package/helpers/mixed.js +1 -1
  24. package/helpers/mixed.mjs +1 -1
  25. package/package.json +1 -1
  26. package/pluginHooks.d.ts +4 -0
  27. package/pluginHooks.js +69 -1
  28. package/pluginHooks.mjs +69 -1
  29. package/plugins/collapsibleColumns/collapsibleColumns.js +9 -3
  30. package/plugins/collapsibleColumns/collapsibleColumns.mjs +9 -3
  31. package/plugins/columnSorting/columnSorting.js +8 -2
  32. package/plugins/columnSorting/columnSorting.mjs +8 -2
  33. package/plugins/contextMenu/menu/defaultShortcutsList.js +26 -10
  34. package/plugins/contextMenu/menu/defaultShortcutsList.mjs +26 -10
  35. package/plugins/mergeCells/calculations/selection.js +1 -70
  36. package/plugins/mergeCells/calculations/selection.mjs +1 -70
  37. package/plugins/mergeCells/cellsCollection.js +116 -0
  38. package/plugins/mergeCells/cellsCollection.mjs +116 -0
  39. package/plugins/mergeCells/contextMenuItem/toggleMerge.js +11 -1
  40. package/plugins/mergeCells/contextMenuItem/toggleMerge.mjs +11 -1
  41. package/plugins/mergeCells/focusOrder.js +303 -0
  42. package/plugins/mergeCells/focusOrder.mjs +298 -0
  43. package/plugins/mergeCells/mergeCells.js +336 -192
  44. package/plugins/mergeCells/mergeCells.mjs +336 -192
  45. package/plugins/multiColumnSorting/multiColumnSorting.js +8 -2
  46. package/plugins/multiColumnSorting/multiColumnSorting.mjs +8 -2
  47. package/plugins/nestedHeaders/nestedHeaders.js +1 -0
  48. package/plugins/nestedHeaders/nestedHeaders.mjs +1 -0
  49. package/plugins/nestedRows/nestedRows.js +9 -3
  50. package/plugins/nestedRows/nestedRows.mjs +9 -3
  51. package/renderers/checkboxRenderer/checkboxRenderer.js +8 -5
  52. package/renderers/checkboxRenderer/checkboxRenderer.mjs +8 -5
  53. package/selection/highlight/visualSelection.js +2 -0
  54. package/selection/highlight/visualSelection.mjs +2 -0
  55. package/selection/selection.js +209 -40
  56. package/selection/selection.mjs +208 -39
  57. package/selection/transformation.js +83 -32
  58. package/selection/transformation.mjs +83 -32
  59. package/shortcutContexts/commands/editor/closeAndSave.js +2 -2
  60. package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -2
  61. package/shortcutContexts/commands/editor/open.js +18 -3
  62. package/shortcutContexts/commands/editor/open.mjs +18 -3
  63. package/shortcutContexts/commands/extendCellsSelection/down.js +1 -1
  64. package/shortcutContexts/commands/extendCellsSelection/down.mjs +1 -1
  65. package/shortcutContexts/commands/extendCellsSelection/left.js +1 -1
  66. package/shortcutContexts/commands/extendCellsSelection/left.mjs +1 -1
  67. package/shortcutContexts/commands/extendCellsSelection/right.js +1 -1
  68. package/shortcutContexts/commands/extendCellsSelection/right.mjs +1 -1
  69. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +1 -1
  70. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +1 -1
  71. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +3 -1
  72. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +3 -1
  73. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +9 -3
  74. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +9 -3
  75. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +10 -3
  76. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +10 -3
  77. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +3 -1
  78. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +3 -1
  79. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +3 -1
  80. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +3 -1
  81. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +3 -1
  82. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +3 -1
  83. package/shortcutContexts/commands/extendCellsSelection/toRows.js +1 -1
  84. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +1 -1
  85. package/shortcutContexts/commands/extendCellsSelection/up.js +1 -1
  86. package/shortcutContexts/commands/extendCellsSelection/up.mjs +1 -1
  87. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +6 -1
  88. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +6 -1
  89. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +6 -1
  90. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +6 -1
  91. package/shortcutContexts/grid.js +2 -2
  92. package/shortcutContexts/grid.mjs +2 -2
  93. package/shortcuts/context.js +2 -1
  94. package/shortcuts/context.mjs +2 -1
  95. package/utils/dataStructures/linkedList.js +6 -1
  96. package/utils/dataStructures/linkedList.mjs +6 -1
package/editorManager.js CHANGED
@@ -310,18 +310,22 @@ class EditorManager {
310
310
  }
311
311
 
312
312
  /**
313
- * Controls selection's behaviour after clicking `Enter`.
313
+ * Controls selection's behavior after clicking `Enter`.
314
314
  *
315
315
  * @private
316
- * @param {boolean} isShiftPressed If `true`, then the selection will move up after hit enter.
316
+ * @param {KeyboardEvent} event The keyboard event object.
317
317
  */
318
- moveSelectionAfterEnter(isShiftPressed) {
319
- const enterMoves = typeof this.tableMeta.enterMoves === 'function' ? this.tableMeta.enterMoves(event) : this.tableMeta.enterMoves;
320
- if (isShiftPressed) {
321
- // move selection up
322
- this.selection.transformStart(-enterMoves.row, -enterMoves.col);
318
+ moveSelectionAfterEnter(event) {
319
+ const enterMoves = {
320
+ ...(typeof this.tableMeta.enterMoves === 'function' ? this.tableMeta.enterMoves(event) : this.tableMeta.enterMoves)
321
+ };
322
+ if (event.shiftKey) {
323
+ enterMoves.row = -enterMoves.row;
324
+ enterMoves.col = -enterMoves.col;
325
+ }
326
+ if (this.hot.selection.isMultiple()) {
327
+ this.selection.transformFocus(enterMoves.row, enterMoves.col);
323
328
  } else {
324
- // move selection down (add a new row if needed)
325
329
  this.selection.transformStart(enterMoves.row, enterMoves.col, true);
326
330
  }
327
331
  }
package/editorManager.mjs CHANGED
@@ -306,18 +306,22 @@ class EditorManager {
306
306
  }
307
307
 
308
308
  /**
309
- * Controls selection's behaviour after clicking `Enter`.
309
+ * Controls selection's behavior after clicking `Enter`.
310
310
  *
311
311
  * @private
312
- * @param {boolean} isShiftPressed If `true`, then the selection will move up after hit enter.
312
+ * @param {KeyboardEvent} event The keyboard event object.
313
313
  */
314
- moveSelectionAfterEnter(isShiftPressed) {
315
- const enterMoves = typeof this.tableMeta.enterMoves === 'function' ? this.tableMeta.enterMoves(event) : this.tableMeta.enterMoves;
316
- if (isShiftPressed) {
317
- // move selection up
318
- this.selection.transformStart(-enterMoves.row, -enterMoves.col);
314
+ moveSelectionAfterEnter(event) {
315
+ const enterMoves = {
316
+ ...(typeof this.tableMeta.enterMoves === 'function' ? this.tableMeta.enterMoves(event) : this.tableMeta.enterMoves)
317
+ };
318
+ if (event.shiftKey) {
319
+ enterMoves.row = -enterMoves.row;
320
+ enterMoves.col = -enterMoves.col;
321
+ }
322
+ if (this.hot.selection.isMultiple()) {
323
+ this.selection.transformFocus(enterMoves.row, enterMoves.col);
319
324
  } else {
320
- // move selection down (add a new row if needed)
321
325
  this.selection.transformStart(enterMoves.row, enterMoves.col, true);
322
326
  }
323
327
  }
package/helpers/mixed.js CHANGED
@@ -134,7 +134,7 @@ const domMessages = {
134
134
  function _injectProductInfo(key, element) {
135
135
  const hasValidType = !isEmpty(key);
136
136
  const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
137
- const hotVersion = "0.0.0-next-bff5041-20240315";
137
+ const hotVersion = "0.0.0-next-f748da8-20240318";
138
138
  let keyValidityDate;
139
139
  let consoleMessageState = 'invalid';
140
140
  let domMessageState = 'invalid';
package/helpers/mixed.mjs CHANGED
@@ -124,7 +124,7 @@ const domMessages = {
124
124
  export function _injectProductInfo(key, element) {
125
125
  const hasValidType = !isEmpty(key);
126
126
  const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
127
- const hotVersion = "0.0.0-next-bff5041-20240315";
127
+ const hotVersion = "0.0.0-next-f748da8-20240318";
128
128
  let keyValidityDate;
129
129
  let consoleMessageState = 'invalid';
130
130
  let domMessageState = 'invalid';
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "url": "https://github.com/handsontable/handsontable/issues"
11
11
  },
12
12
  "author": "Handsoncode <hello@handsontable.com>",
13
- "version": "0.0.0-next-bff5041-20240315",
13
+ "version": "0.0.0-next-f748da8-20240318",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",
package/pluginHooks.d.ts CHANGED
@@ -98,6 +98,7 @@ export interface Events {
98
98
  afterLoadData?: (sourceData: CellValue[], initialLoad: boolean, source: string | undefined) => void;
99
99
  afterMergeCells?: (cellRange: CellRange, mergeParent: MergeCellsSettings, auto: boolean) => void;
100
100
  afterModifyTransformEnd?: (coords: CellCoords, rowTransformDir: -1 | 0, colTransformDir: -1 | 0) => void;
101
+ afterModifyTransformFocus?: (coords: CellCoords, rowTransformDir: -1 | 0, colTransformDir: -1 | 0) => void;
101
102
  afterModifyTransformStart?: (coords: CellCoords, rowTransformDir: -1 | 0, colTransformDir: -1 | 0) => void;
102
103
  afterMomentumScroll?: () => void;
103
104
  afterNamedExpressionAdded?: (namedExpressionName: string, changes: ExportedChange[]) => void;
@@ -130,6 +131,7 @@ export interface Events {
130
131
  afterSelectionByProp?: (row: number, prop: string, row2: number, prop2: string, preventScrolling: { value: boolean }, selectionLayerLevel: number) => void;
131
132
  afterSelectionEnd?: (row: number, column: number, row2: number, column2: number, selectionLayerLevel: number) => void;
132
133
  afterSelectionEndByProp?: (row: number, prop: string, row2: number, prop2: string, selectionLayerLevel: number) => void;
134
+ afterSelectionFocusSet?: (row: number, column: number, preventScrolling: { value: boolean }) => void;
133
135
  afterSelectRows?: (from: CellCoords, to: CellCoords, highlight: CellCoords) => void;
134
136
  afterSetCellMeta?: (row: number, column: number, key: string, value: any) => void;
135
137
  afterSetDataAtCell?: (changes: CellChange[], source?: ChangeSource) => void;
@@ -208,6 +210,7 @@ export interface Events {
208
210
  beforeRowResize?: (newSize: number, row: number, isDoubleClick: boolean) => number | void;
209
211
  beforeRowWrap?: (isActionInterrupted: { value: boolean }, newCoords: CellCoords, isRowFlipped: boolean) => void;
210
212
  beforeSelectColumns?: (from: CellCoords, to: CellCoords, highlight: CellCoords) => void;
213
+ beforeSelectionFocusSet?: (coords: CellCoords) => void;
211
214
  beforeSelectionHighlightSet?: () => void;
212
215
  beforeSelectRows?: (from: CellCoords, to: CellCoords, highlight: CellCoords) => void;
213
216
  beforeSetCellMeta?: (row: number, column: number, key: string, value: any) => boolean | void;
@@ -250,6 +253,7 @@ export interface Events {
250
253
  modifyRowHeight?: (height: number, row: number) => void;
251
254
  modifySourceData?: (row: number, column: number, valueHolder: { value: CellValue }, ioMode: 'get' | 'set') => void;
252
255
  modifyTransformEnd?: (delta: CellCoords) => void;
256
+ modifyTransformFocus?: (delta: CellCoords) => void;
253
257
  modifyTransformStart?: (delta: CellCoords) => void;
254
258
  persistentStateLoad?: (key: string, valuePlaceholder: { value: any }) => void;
255
259
  persistentStateReset?: (key: string) => void;
package/pluginHooks.js CHANGED
@@ -650,7 +650,9 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
650
650
  * @param {string} prop Selection start data source object property name.
651
651
  * @param {number} row2 Selection end visual row index.
652
652
  * @param {string} prop2 Selection end data source object property name.
653
- * @param {object} preventScrolling Object with `value` property where its value change will be observed.
653
+ * @param {object} preventScrolling A reference to the observable object with the `value` property.
654
+ * Property `preventScrolling.value` expects a boolean value that
655
+ * Handsontable uses to control scroll behavior after selection.
654
656
  * @param {number} selectionLayerLevel The number which indicates what selection layer is currently modified.
655
657
  * @example
656
658
  * ```js
@@ -700,6 +702,46 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
700
702
  * @param {number} selectionLayerLevel The number which indicates what selection layer is currently modified.
701
703
  */
702
704
  'afterSelectionEndByProp',
705
+ /**
706
+ * Fired after the focus position within a selected range is changed.
707
+ *
708
+ * @since 14.2.0
709
+ * @event Hooks#afterSelectionFocusSet
710
+ * @param {number} row The focus visual row index position.
711
+ * @param {number} column The focus visual column index position.
712
+ * @param {object} preventScrolling A reference to the observable object with the `value` property.
713
+ * Property `preventScrolling.value` expects a boolean value that
714
+ * Handsontable uses to control scroll behavior after selection.
715
+ * @example
716
+ * ```js
717
+ * ::: only-for javascript
718
+ * new Handsontable(element, {
719
+ * afterSelectionFocusSet: (row, column, preventScrolling) => {
720
+ * // If set to `false` (default): when focused cell selection is outside the viewport,
721
+ * // Handsontable scrolls the viewport to that cell.
722
+ * // If set to `true`: when focused cell selection is outside the viewport,
723
+ * // Handsontable doesn't scroll the viewport.
724
+ * preventScrolling.value = true;
725
+ * }
726
+ * })
727
+ * ```
728
+ * :::
729
+ *
730
+ * ::: only-for react
731
+ * ```jsx
732
+ * <HotTable
733
+ * afterSelectionFocusSet={(row, column, preventScrolling) => {
734
+ * // If set to `false` (default): when focused cell selection is outside the viewport,
735
+ * // Handsontable scrolls the viewport to that cell.
736
+ * // If set to `true`: when focused cell selection is outside the viewport,
737
+ * // Handsontable doesn't scroll the viewport.
738
+ * preventScrolling.value = true;
739
+ * }}
740
+ * />
741
+ * ```
742
+ * :::
743
+ */
744
+ 'afterSelectionFocusSet',
703
745
  /**
704
746
  * Fired before one or more columns are selected (e.g. During mouse header click or {@link Core#selectColumns} API call).
705
747
  *
@@ -1254,6 +1296,14 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
1254
1296
  * @returns {boolean|undefined} If false is returned the action is canceled.
1255
1297
  */
1256
1298
  'beforeSetCellMeta',
1299
+ /**
1300
+ * Fired before setting focus selection.
1301
+ *
1302
+ * @since 14.3.0
1303
+ * @event Hooks#beforeSelectionFocusSet
1304
+ * @param {CellCoords} coords CellCoords instance.
1305
+ */
1306
+ 'beforeSelectionFocusSet',
1257
1307
  /**
1258
1308
  * Fired before setting range is started but not finished yet.
1259
1309
  *
@@ -2163,6 +2213,14 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
2163
2213
  * @param {number} rowHeaderWidth Row header width.
2164
2214
  */
2165
2215
  'modifyRowHeaderWidth',
2216
+ /**
2217
+ * Fired when the focus of the selection is being modified (e.g. Moving the focus with the enter/tab keys).
2218
+ *
2219
+ * @since 14.3.0
2220
+ * @event Hooks#modifyTransformFocus
2221
+ * @param {CellCoords} delta Cell coords object declaring the delta of the new selection relative to the previous one.
2222
+ */
2223
+ 'modifyTransformFocus',
2166
2224
  /**
2167
2225
  * Fired when the start of the selection is being modified (e.g. Moving the selection with the arrow keys).
2168
2226
  *
@@ -2177,6 +2235,16 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
2177
2235
  * @param {CellCoords} delta Cell coords object declaring the delta of the new selection relative to the previous one.
2178
2236
  */
2179
2237
  'modifyTransformEnd',
2238
+ /**
2239
+ * Fired after the focus of the selection is being modified (e.g. Moving the focus with the enter/tab keys).
2240
+ *
2241
+ * @since 14.3.0
2242
+ * @event Hooks#afterModifyTransformFocus
2243
+ * @param {CellCoords} coords Coords of the freshly focused cell.
2244
+ * @param {number} rowTransformDir `-1` if trying to focus a cell with a negative row index. `0` otherwise.
2245
+ * @param {number} colTransformDir `-1` if trying to focus a cell with a negative column index. `0` otherwise.
2246
+ */
2247
+ 'afterModifyTransformFocus',
2180
2248
  /**
2181
2249
  * Fired after the start of the selection is being modified (e.g. Moving the selection with the arrow keys).
2182
2250
  *
package/pluginHooks.mjs CHANGED
@@ -646,7 +646,9 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
646
646
  * @param {string} prop Selection start data source object property name.
647
647
  * @param {number} row2 Selection end visual row index.
648
648
  * @param {string} prop2 Selection end data source object property name.
649
- * @param {object} preventScrolling Object with `value` property where its value change will be observed.
649
+ * @param {object} preventScrolling A reference to the observable object with the `value` property.
650
+ * Property `preventScrolling.value` expects a boolean value that
651
+ * Handsontable uses to control scroll behavior after selection.
650
652
  * @param {number} selectionLayerLevel The number which indicates what selection layer is currently modified.
651
653
  * @example
652
654
  * ```js
@@ -696,6 +698,46 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
696
698
  * @param {number} selectionLayerLevel The number which indicates what selection layer is currently modified.
697
699
  */
698
700
  'afterSelectionEndByProp',
701
+ /**
702
+ * Fired after the focus position within a selected range is changed.
703
+ *
704
+ * @since 14.2.0
705
+ * @event Hooks#afterSelectionFocusSet
706
+ * @param {number} row The focus visual row index position.
707
+ * @param {number} column The focus visual column index position.
708
+ * @param {object} preventScrolling A reference to the observable object with the `value` property.
709
+ * Property `preventScrolling.value` expects a boolean value that
710
+ * Handsontable uses to control scroll behavior after selection.
711
+ * @example
712
+ * ```js
713
+ * ::: only-for javascript
714
+ * new Handsontable(element, {
715
+ * afterSelectionFocusSet: (row, column, preventScrolling) => {
716
+ * // If set to `false` (default): when focused cell selection is outside the viewport,
717
+ * // Handsontable scrolls the viewport to that cell.
718
+ * // If set to `true`: when focused cell selection is outside the viewport,
719
+ * // Handsontable doesn't scroll the viewport.
720
+ * preventScrolling.value = true;
721
+ * }
722
+ * })
723
+ * ```
724
+ * :::
725
+ *
726
+ * ::: only-for react
727
+ * ```jsx
728
+ * <HotTable
729
+ * afterSelectionFocusSet={(row, column, preventScrolling) => {
730
+ * // If set to `false` (default): when focused cell selection is outside the viewport,
731
+ * // Handsontable scrolls the viewport to that cell.
732
+ * // If set to `true`: when focused cell selection is outside the viewport,
733
+ * // Handsontable doesn't scroll the viewport.
734
+ * preventScrolling.value = true;
735
+ * }}
736
+ * />
737
+ * ```
738
+ * :::
739
+ */
740
+ 'afterSelectionFocusSet',
699
741
  /**
700
742
  * Fired before one or more columns are selected (e.g. During mouse header click or {@link Core#selectColumns} API call).
701
743
  *
@@ -1250,6 +1292,14 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
1250
1292
  * @returns {boolean|undefined} If false is returned the action is canceled.
1251
1293
  */
1252
1294
  'beforeSetCellMeta',
1295
+ /**
1296
+ * Fired before setting focus selection.
1297
+ *
1298
+ * @since 14.3.0
1299
+ * @event Hooks#beforeSelectionFocusSet
1300
+ * @param {CellCoords} coords CellCoords instance.
1301
+ */
1302
+ 'beforeSelectionFocusSet',
1253
1303
  /**
1254
1304
  * Fired before setting range is started but not finished yet.
1255
1305
  *
@@ -2159,6 +2209,14 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
2159
2209
  * @param {number} rowHeaderWidth Row header width.
2160
2210
  */
2161
2211
  'modifyRowHeaderWidth',
2212
+ /**
2213
+ * Fired when the focus of the selection is being modified (e.g. Moving the focus with the enter/tab keys).
2214
+ *
2215
+ * @since 14.3.0
2216
+ * @event Hooks#modifyTransformFocus
2217
+ * @param {CellCoords} delta Cell coords object declaring the delta of the new selection relative to the previous one.
2218
+ */
2219
+ 'modifyTransformFocus',
2162
2220
  /**
2163
2221
  * Fired when the start of the selection is being modified (e.g. Moving the selection with the arrow keys).
2164
2222
  *
@@ -2173,6 +2231,16 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
2173
2231
  * @param {CellCoords} delta Cell coords object declaring the delta of the new selection relative to the previous one.
2174
2232
  */
2175
2233
  'modifyTransformEnd',
2234
+ /**
2235
+ * Fired after the focus of the selection is being modified (e.g. Moving the focus with the enter/tab keys).
2236
+ *
2237
+ * @since 14.3.0
2238
+ * @event Hooks#afterModifyTransformFocus
2239
+ * @param {CellCoords} coords Coords of the freshly focused cell.
2240
+ * @param {number} rowTransformDir `-1` if trying to focus a cell with a negative row index. `0` otherwise.
2241
+ * @param {number} colTransformDir `-1` if trying to focus a cell with a negative column index. `0` otherwise.
2242
+ */
2243
+ 'afterModifyTransformFocus',
2176
2244
  /**
2177
2245
  * Fired after the start of the selection is being modified (e.g. Moving the selection with the arrow keys).
2178
2246
  *
@@ -9,6 +9,7 @@ var _number = require("../../helpers/number");
9
9
  var _console = require("../../helpers/console");
10
10
  var _element = require("../../helpers/dom/element");
11
11
  var _event = require("../../helpers/dom/event");
12
+ var _shortcutContexts = require("../../shortcutContexts");
12
13
  var _a11y = require("../../helpers/a11y");
13
14
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
14
15
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
@@ -280,12 +281,17 @@ class CollapsibleColumns extends _base.BasePlugin {
280
281
  col: columnIndex
281
282
  });
282
283
  }
284
+
285
+ // prevent default Enter behavior (move to the next row within a selection range)
286
+ return false;
283
287
  },
284
288
  runOnlyIf: () => {
285
- var _this$hot$getSelected;
286
- return (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight.isHeader();
289
+ var _this$hot$getSelected, _this$hot$getSelected2;
290
+ return ((_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.isSingle()) && ((_this$hot$getSelected2 = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected2 === void 0 ? void 0 : _this$hot$getSelected2.highlight.isHeader());
287
291
  },
288
- group: SHORTCUTS_GROUP
292
+ group: SHORTCUTS_GROUP,
293
+ relativeToGroup: _shortcutContexts.EDITOR_EDIT_GROUP,
294
+ position: 'before'
289
295
  });
290
296
  }
291
297
 
@@ -15,6 +15,7 @@ import { rangeEach } from "../../helpers/number.mjs";
15
15
  import { warn } from "../../helpers/console.mjs";
16
16
  import { addClass, hasClass, removeClass, fastInnerText, removeAttribute, setAttribute } from "../../helpers/dom/element.mjs";
17
17
  import { stopImmediatePropagation } from "../../helpers/dom/event.mjs";
18
+ import { EDITOR_EDIT_GROUP as SHORTCUTS_GROUP_EDITOR } from "../../shortcutContexts/index.mjs";
18
19
  import { A11Y_EXPANDED, A11Y_HIDDEN } from "../../helpers/a11y.mjs";
19
20
  export const PLUGIN_KEY = 'collapsibleColumns';
20
21
  export const PLUGIN_PRIORITY = 290;
@@ -277,12 +278,17 @@ export class CollapsibleColumns extends BasePlugin {
277
278
  col: columnIndex
278
279
  });
279
280
  }
281
+
282
+ // prevent default Enter behavior (move to the next row within a selection range)
283
+ return false;
280
284
  },
281
285
  runOnlyIf: () => {
282
- var _this$hot$getSelected;
283
- return (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight.isHeader();
286
+ var _this$hot$getSelected, _this$hot$getSelected2;
287
+ return ((_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.isSingle()) && ((_this$hot$getSelected2 = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected2 === void 0 ? void 0 : _this$hot$getSelected2.highlight.isHeader());
284
288
  },
285
- group: SHORTCUTS_GROUP
289
+ group: SHORTCUTS_GROUP,
290
+ relativeToGroup: SHORTCUTS_GROUP_EDITOR,
291
+ position: 'before'
286
292
  });
287
293
  }
288
294
 
@@ -12,6 +12,7 @@ var _base = require("../base");
12
12
  var _translations = require("../../translations");
13
13
  var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
14
14
  var _columnStatesManager = require("./columnStatesManager");
15
+ var _shortcutContexts = require("../../shortcutContexts");
15
16
  var _utils = require("./utils");
16
17
  var _domHelpers = require("./domHelpers");
17
18
  var _rootComparator = require("./rootComparator");
@@ -223,12 +224,17 @@ class ColumnSorting extends _base.BasePlugin {
223
224
  if (highlight.row === -1 && highlight.col >= 0) {
224
225
  this.sort(this.getColumnNextConfig(highlight.col));
225
226
  }
227
+
228
+ // prevent default Enter behavior (move to the next row within a selection range)
229
+ return false;
226
230
  },
227
231
  runOnlyIf: () => {
228
- var _this$hot$getSelected;
232
+ var _this$hot$getSelected, _this$hot$getSelected2;
229
233
  const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
230
- return highlight && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
234
+ return highlight && ((_this$hot$getSelected2 = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected2 === void 0 ? void 0 : _this$hot$getSelected2.isSingle()) && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
231
235
  },
236
+ relativeToGroup: _shortcutContexts.EDITOR_EDIT_GROUP,
237
+ position: 'before',
232
238
  group: SHORTCUTS_GROUP
233
239
  });
234
240
  }
@@ -15,6 +15,7 @@ import { BasePlugin } from "../base/index.mjs";
15
15
  import { IndexesSequence, PhysicalIndexToValueMap as IndexToValueMap } from "../../translations/index.mjs";
16
16
  import Hooks from "../../pluginHooks.mjs";
17
17
  import { ColumnStatesManager } from "./columnStatesManager.mjs";
18
+ import { EDITOR_EDIT_GROUP as SHORTCUTS_GROUP_EDITOR } from "../../shortcutContexts/index.mjs";
18
19
  import { HEADER_SPAN_CLASS, getNextSortOrder, areValidSortStates, getHeaderSpanElement, isFirstLevelColumnHeader, wasHeaderClickedProperly } from "./utils.mjs";
19
20
  import { getClassesToRemove, getClassesToAdd } from "./domHelpers.mjs";
20
21
  import { rootComparator } from "./rootComparator.mjs";
@@ -219,12 +220,17 @@ export class ColumnSorting extends BasePlugin {
219
220
  if (highlight.row === -1 && highlight.col >= 0) {
220
221
  this.sort(this.getColumnNextConfig(highlight.col));
221
222
  }
223
+
224
+ // prevent default Enter behavior (move to the next row within a selection range)
225
+ return false;
222
226
  },
223
227
  runOnlyIf: () => {
224
- var _this$hot$getSelected;
228
+ var _this$hot$getSelected, _this$hot$getSelected2;
225
229
  const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
226
- return highlight && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
230
+ return highlight && ((_this$hot$getSelected2 = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected2 === void 0 ? void 0 : _this$hot$getSelected2.isSingle()) && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
227
231
  },
232
+ relativeToGroup: SHORTCUTS_GROUP_EDITOR,
233
+ position: 'before',
228
234
  group: SHORTCUTS_GROUP
229
235
  });
230
236
  }
@@ -9,10 +9,26 @@ exports.createDefaultShortcutsList = createDefaultShortcutsList;
9
9
  * @returns {KeyboardShortcut[]}
10
10
  */
11
11
  function createDefaultShortcutsList(menu) {
12
+ const {
13
+ hot,
14
+ hotMenu
15
+ } = menu;
12
16
  return [{
13
- keys: [['Tab'], ['Shift', 'Tab'], ['Control/Meta', 'A']],
14
- forwardToContext: menu.hot.getShortcutManager().getContext('grid'),
17
+ keys: [['Control/Meta', 'A']],
18
+ forwardToContext: hot.getShortcutManager().getContext('grid'),
15
19
  callback: () => menu.close(true)
20
+ }, {
21
+ keys: [['Tab'], ['Shift', 'Tab']],
22
+ callback: (event, keys) => {
23
+ const settings = hot.getSettings();
24
+ const tabMoves = typeof settings.tabMoves === 'function' ? settings.tabMoves(event) : settings.tabMoves;
25
+ if (keys.includes('shift')) {
26
+ hot.selection.transformStart(-tabMoves.row, -tabMoves.col);
27
+ } else {
28
+ hot.selection.transformStart(tabMoves.row, tabMoves.col);
29
+ }
30
+ menu.close(true);
31
+ }
16
32
  }, {
17
33
  keys: [['Escape']],
18
34
  callback: () => menu.close()
@@ -25,7 +41,7 @@ function createDefaultShortcutsList(menu) {
25
41
  }, {
26
42
  keys: [['ArrowRight']],
27
43
  callback: () => {
28
- const selection = menu.hotMenu.getSelectedLast();
44
+ const selection = hotMenu.getSelectedLast();
29
45
  if (selection) {
30
46
  const subMenu = menu.openSubMenu(selection[0]);
31
47
  if (subMenu) {
@@ -36,7 +52,7 @@ function createDefaultShortcutsList(menu) {
36
52
  }, {
37
53
  keys: [['ArrowLeft']],
38
54
  callback: () => {
39
- const selection = menu.hotMenu.getSelectedLast();
55
+ const selection = hotMenu.getSelectedLast();
40
56
  if (selection && menu.isSubMenu()) {
41
57
  menu.close();
42
58
  if (menu.isSubMenu()) {
@@ -53,11 +69,11 @@ function createDefaultShortcutsList(menu) {
53
69
  }, {
54
70
  keys: [['Enter'], ['Space']],
55
71
  callback: event => {
56
- const selection = menu.hotMenu.getSelectedLast();
72
+ const selection = hotMenu.getSelectedLast();
57
73
  if (!selection) {
58
74
  return;
59
75
  }
60
- if (menu.hotMenu.getSourceDataAtRow(selection[0]).submenu) {
76
+ if (hotMenu.getSourceDataAtRow(selection[0]).submenu) {
61
77
  menu.openSubMenu(selection[0]).getNavigator().toFirstItem();
62
78
  } else {
63
79
  menu.executeCommand(event);
@@ -67,9 +83,9 @@ function createDefaultShortcutsList(menu) {
67
83
  }, {
68
84
  keys: [['PageUp']],
69
85
  callback: () => {
70
- const selection = menu.hotMenu.getSelectedLast();
86
+ const selection = hotMenu.getSelectedLast();
71
87
  if (selection) {
72
- menu.hotMenu.selection.transformStart(-menu.hotMenu.countVisibleRows(), 0);
88
+ hotMenu.selection.transformStart(-hotMenu.countVisibleRows(), 0);
73
89
  } else {
74
90
  menu.getNavigator().toFirstItem();
75
91
  }
@@ -77,9 +93,9 @@ function createDefaultShortcutsList(menu) {
77
93
  }, {
78
94
  keys: [['PageDown']],
79
95
  callback: () => {
80
- const selection = menu.hotMenu.getSelectedLast();
96
+ const selection = hotMenu.getSelectedLast();
81
97
  if (selection) {
82
- menu.hotMenu.selection.transformStart(menu.hotMenu.countVisibleRows(), 0);
98
+ hotMenu.selection.transformStart(hotMenu.countVisibleRows(), 0);
83
99
  } else {
84
100
  menu.getNavigator().toLastItem();
85
101
  }
@@ -5,10 +5,26 @@
5
5
  * @returns {KeyboardShortcut[]}
6
6
  */
7
7
  export function createDefaultShortcutsList(menu) {
8
+ const {
9
+ hot,
10
+ hotMenu
11
+ } = menu;
8
12
  return [{
9
- keys: [['Tab'], ['Shift', 'Tab'], ['Control/Meta', 'A']],
10
- forwardToContext: menu.hot.getShortcutManager().getContext('grid'),
13
+ keys: [['Control/Meta', 'A']],
14
+ forwardToContext: hot.getShortcutManager().getContext('grid'),
11
15
  callback: () => menu.close(true)
16
+ }, {
17
+ keys: [['Tab'], ['Shift', 'Tab']],
18
+ callback: (event, keys) => {
19
+ const settings = hot.getSettings();
20
+ const tabMoves = typeof settings.tabMoves === 'function' ? settings.tabMoves(event) : settings.tabMoves;
21
+ if (keys.includes('shift')) {
22
+ hot.selection.transformStart(-tabMoves.row, -tabMoves.col);
23
+ } else {
24
+ hot.selection.transformStart(tabMoves.row, tabMoves.col);
25
+ }
26
+ menu.close(true);
27
+ }
12
28
  }, {
13
29
  keys: [['Escape']],
14
30
  callback: () => menu.close()
@@ -21,7 +37,7 @@ export function createDefaultShortcutsList(menu) {
21
37
  }, {
22
38
  keys: [['ArrowRight']],
23
39
  callback: () => {
24
- const selection = menu.hotMenu.getSelectedLast();
40
+ const selection = hotMenu.getSelectedLast();
25
41
  if (selection) {
26
42
  const subMenu = menu.openSubMenu(selection[0]);
27
43
  if (subMenu) {
@@ -32,7 +48,7 @@ export function createDefaultShortcutsList(menu) {
32
48
  }, {
33
49
  keys: [['ArrowLeft']],
34
50
  callback: () => {
35
- const selection = menu.hotMenu.getSelectedLast();
51
+ const selection = hotMenu.getSelectedLast();
36
52
  if (selection && menu.isSubMenu()) {
37
53
  menu.close();
38
54
  if (menu.isSubMenu()) {
@@ -49,11 +65,11 @@ export function createDefaultShortcutsList(menu) {
49
65
  }, {
50
66
  keys: [['Enter'], ['Space']],
51
67
  callback: event => {
52
- const selection = menu.hotMenu.getSelectedLast();
68
+ const selection = hotMenu.getSelectedLast();
53
69
  if (!selection) {
54
70
  return;
55
71
  }
56
- if (menu.hotMenu.getSourceDataAtRow(selection[0]).submenu) {
72
+ if (hotMenu.getSourceDataAtRow(selection[0]).submenu) {
57
73
  menu.openSubMenu(selection[0]).getNavigator().toFirstItem();
58
74
  } else {
59
75
  menu.executeCommand(event);
@@ -63,9 +79,9 @@ export function createDefaultShortcutsList(menu) {
63
79
  }, {
64
80
  keys: [['PageUp']],
65
81
  callback: () => {
66
- const selection = menu.hotMenu.getSelectedLast();
82
+ const selection = hotMenu.getSelectedLast();
67
83
  if (selection) {
68
- menu.hotMenu.selection.transformStart(-menu.hotMenu.countVisibleRows(), 0);
84
+ hotMenu.selection.transformStart(-hotMenu.countVisibleRows(), 0);
69
85
  } else {
70
86
  menu.getNavigator().toFirstItem();
71
87
  }
@@ -73,9 +89,9 @@ export function createDefaultShortcutsList(menu) {
73
89
  }, {
74
90
  keys: [['PageDown']],
75
91
  callback: () => {
76
- const selection = menu.hotMenu.getSelectedLast();
92
+ const selection = hotMenu.getSelectedLast();
77
93
  if (selection) {
78
- menu.hotMenu.selection.transformStart(menu.hotMenu.countVisibleRows(), 0);
94
+ hotMenu.selection.transformStart(hotMenu.countVisibleRows(), 0);
79
95
  } else {
80
96
  menu.getNavigator().toLastItem();
81
97
  }