handsontable 0.0.0-next-59715d3-20230523 → 0.0.0-next-93e34dc-20230601

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 (216) hide show
  1. package/3rdparty/walkontable/src/cell/coords.d.ts +6 -1
  2. package/3rdparty/walkontable/src/cell/coords.js +61 -12
  3. package/3rdparty/walkontable/src/cell/coords.mjs +61 -12
  4. package/3rdparty/walkontable/src/cell/range.d.ts +9 -2
  5. package/3rdparty/walkontable/src/cell/range.js +44 -7
  6. package/3rdparty/walkontable/src/cell/range.mjs +44 -7
  7. package/3rdparty/walkontable/src/core/_base.js +9 -3
  8. package/3rdparty/walkontable/src/core/_base.mjs +9 -3
  9. package/3rdparty/walkontable/src/core/clone.js +2 -2
  10. package/3rdparty/walkontable/src/core/clone.mjs +2 -2
  11. package/3rdparty/walkontable/src/core/core.js +3 -2
  12. package/3rdparty/walkontable/src/core/core.mjs +3 -2
  13. package/3rdparty/walkontable/src/event.js +7 -7
  14. package/3rdparty/walkontable/src/event.mjs +7 -7
  15. package/3rdparty/walkontable/src/facade/core.js +2 -2
  16. package/3rdparty/walkontable/src/facade/core.mjs +2 -2
  17. package/3rdparty/walkontable/src/index.js +10 -2
  18. package/3rdparty/walkontable/src/index.mjs +2 -2
  19. package/3rdparty/walkontable/src/overlay/_base.js +1 -1
  20. package/3rdparty/walkontable/src/overlay/_base.mjs +1 -1
  21. package/3rdparty/walkontable/src/overlay/inlineStart.js +2 -4
  22. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +2 -4
  23. package/3rdparty/walkontable/src/overlay/top.js +2 -4
  24. package/3rdparty/walkontable/src/overlay/top.mjs +2 -4
  25. package/3rdparty/walkontable/src/{border.js → selection/border/border.js} +7 -12
  26. package/3rdparty/walkontable/src/{border.mjs → selection/border/border.mjs} +7 -12
  27. package/3rdparty/walkontable/src/selection/border/constants.js +18 -0
  28. package/3rdparty/walkontable/src/selection/border/constants.mjs +13 -0
  29. package/3rdparty/walkontable/src/selection/constants.js +63 -0
  30. package/3rdparty/walkontable/src/selection/constants.mjs +51 -0
  31. package/3rdparty/walkontable/src/selection/index.js +30 -0
  32. package/3rdparty/walkontable/src/selection/index.mjs +5 -0
  33. package/3rdparty/walkontable/src/selection/manager.js +328 -0
  34. package/3rdparty/walkontable/src/selection/manager.mjs +322 -0
  35. package/3rdparty/walkontable/src/selection/scanner.js +363 -0
  36. package/3rdparty/walkontable/src/selection/scanner.mjs +359 -0
  37. package/3rdparty/walkontable/src/selection/selection.js +133 -0
  38. package/3rdparty/walkontable/src/selection/selection.mjs +127 -0
  39. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +9 -0
  40. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +9 -0
  41. package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +9 -0
  42. package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +9 -0
  43. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +9 -0
  44. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +9 -0
  45. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +9 -0
  46. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +9 -0
  47. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +9 -0
  48. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +9 -0
  49. package/3rdparty/walkontable/src/table.js +7 -79
  50. package/3rdparty/walkontable/src/table.mjs +8 -80
  51. package/base.js +2 -2
  52. package/base.mjs +2 -2
  53. package/core.d.ts +5 -3
  54. package/core.js +82 -300
  55. package/core.mjs +82 -300
  56. package/dataMap/metaManager/metaSchema.js +15 -0
  57. package/dataMap/metaManager/metaSchema.mjs +15 -0
  58. package/dist/handsontable.css +8 -3
  59. package/dist/handsontable.full.css +8 -3
  60. package/dist/handsontable.full.js +12245 -9953
  61. package/dist/handsontable.full.min.css +3 -3
  62. package/dist/handsontable.full.min.js +120 -120
  63. package/dist/handsontable.js +15898 -13606
  64. package/dist/handsontable.min.css +3 -3
  65. package/dist/handsontable.min.js +4 -4
  66. package/editorManager.js +20 -82
  67. package/editorManager.mjs +25 -86
  68. package/editors/textEditor/textEditor.js +3 -11
  69. package/editors/textEditor/textEditor.mjs +4 -12
  70. package/helpers/mixed.js +1 -1
  71. package/helpers/mixed.mjs +1 -1
  72. package/helpers/number.d.ts +1 -0
  73. package/helpers/number.js +18 -0
  74. package/helpers/number.mjs +17 -0
  75. package/package.json +1 -1
  76. package/pluginHooks.js +1 -1
  77. package/pluginHooks.mjs +1 -1
  78. package/plugins/copyPaste/copyPaste.js +5 -1
  79. package/plugins/copyPaste/copyPaste.mjs +5 -1
  80. package/plugins/customBorders/customBorders.js +18 -52
  81. package/plugins/customBorders/customBorders.mjs +19 -53
  82. package/plugins/mergeCells/mergeCells.js +5 -18
  83. package/plugins/mergeCells/mergeCells.mjs +5 -18
  84. package/plugins/nestedHeaders/nestedHeaders.js +89 -9
  85. package/plugins/nestedHeaders/nestedHeaders.mjs +89 -9
  86. package/plugins/nestedHeaders/stateManager/index.js +37 -0
  87. package/plugins/nestedHeaders/stateManager/index.mjs +37 -0
  88. package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
  89. package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
  90. package/selection/highlight/highlight.js +311 -88
  91. package/selection/highlight/highlight.mjs +301 -84
  92. package/selection/highlight/types/activeHeader.js +10 -9
  93. package/selection/highlight/types/activeHeader.mjs +10 -8
  94. package/selection/highlight/types/area.js +12 -27
  95. package/selection/highlight/types/area.mjs +16 -30
  96. package/selection/highlight/types/areaLayered.js +54 -0
  97. package/selection/highlight/types/areaLayered.mjs +49 -0
  98. package/selection/highlight/types/column.js +50 -0
  99. package/selection/highlight/types/column.mjs +45 -0
  100. package/selection/highlight/types/customSelection.js +7 -10
  101. package/selection/highlight/types/customSelection.mjs +7 -9
  102. package/selection/highlight/types/fill.js +5 -8
  103. package/selection/highlight/types/fill.mjs +5 -7
  104. package/selection/highlight/types/{cell.js → focus.js} +5 -8
  105. package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
  106. package/selection/highlight/types/header.js +10 -20
  107. package/selection/highlight/types/header.mjs +10 -19
  108. package/selection/highlight/types/{index.js → row.js} +27 -31
  109. package/selection/highlight/types/{index.mjs → row.mjs} +24 -29
  110. package/selection/highlight/visualSelection.js +23 -28
  111. package/selection/highlight/visualSelection.mjs +23 -28
  112. package/selection/index.js +4 -7
  113. package/selection/index.mjs +2 -3
  114. package/selection/mouseEventHandler.js +1 -1
  115. package/selection/mouseEventHandler.mjs +1 -1
  116. package/selection/range.js +8 -8
  117. package/selection/range.mjs +8 -8
  118. package/selection/selection.js +296 -180
  119. package/selection/selection.mjs +291 -179
  120. package/selection/transformation.js +233 -96
  121. package/selection/transformation.mjs +230 -93
  122. package/selection/utils.js +12 -35
  123. package/selection/utils.mjs +13 -35
  124. package/settings.d.ts +1 -0
  125. package/shortcutContexts/commands/editor/closeAndSave.js +15 -0
  126. package/shortcutContexts/commands/editor/closeAndSave.mjs +10 -0
  127. package/shortcutContexts/commands/editor/closeWithoutSaving.js +13 -0
  128. package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +8 -0
  129. package/shortcutContexts/commands/editor/fastOpen.js +16 -0
  130. package/shortcutContexts/commands/editor/fastOpen.mjs +11 -0
  131. package/shortcutContexts/commands/editor/index.js +16 -0
  132. package/shortcutContexts/commands/editor/index.mjs +12 -0
  133. package/shortcutContexts/commands/editor/open.js +29 -0
  134. package/shortcutContexts/commands/editor/open.mjs +24 -0
  135. package/shortcutContexts/commands/emptySelectedCells.js +12 -0
  136. package/shortcutContexts/commands/emptySelectedCells.mjs +7 -0
  137. package/shortcutContexts/commands/extendCellsSelection/down.js +15 -0
  138. package/shortcutContexts/commands/extendCellsSelection/down.mjs +10 -0
  139. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +21 -0
  140. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +16 -0
  141. package/shortcutContexts/commands/extendCellsSelection/index.js +24 -0
  142. package/shortcutContexts/commands/extendCellsSelection/index.mjs +20 -0
  143. package/shortcutContexts/commands/extendCellsSelection/left.js +15 -0
  144. package/shortcutContexts/commands/extendCellsSelection/left.mjs +10 -0
  145. package/shortcutContexts/commands/extendCellsSelection/right.js +15 -0
  146. package/shortcutContexts/commands/extendCellsSelection/right.mjs +10 -0
  147. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +22 -0
  148. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +17 -0
  149. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +17 -0
  150. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +12 -0
  151. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +17 -0
  152. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +12 -0
  153. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +39 -0
  154. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +34 -0
  155. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +39 -0
  156. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +34 -0
  157. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +22 -0
  158. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +17 -0
  159. package/shortcutContexts/commands/extendCellsSelection/up.js +15 -0
  160. package/shortcutContexts/commands/extendCellsSelection/up.mjs +10 -0
  161. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +21 -0
  162. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +16 -0
  163. package/shortcutContexts/commands/index.js +51 -0
  164. package/shortcutContexts/commands/index.mjs +47 -0
  165. package/shortcutContexts/commands/moveCellSelection/down.js +12 -0
  166. package/shortcutContexts/commands/moveCellSelection/down.mjs +7 -0
  167. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +11 -0
  168. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +6 -0
  169. package/shortcutContexts/commands/moveCellSelection/index.js +28 -0
  170. package/shortcutContexts/commands/moveCellSelection/index.mjs +24 -0
  171. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +13 -0
  172. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -0
  173. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +13 -0
  174. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -0
  175. package/shortcutContexts/commands/moveCellSelection/left.js +11 -0
  176. package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -0
  177. package/shortcutContexts/commands/moveCellSelection/right.js +11 -0
  178. package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -0
  179. package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +16 -0
  180. package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +11 -0
  181. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +17 -0
  182. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +12 -0
  183. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +13 -0
  184. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +8 -0
  185. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +16 -0
  186. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +11 -0
  187. package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +35 -0
  188. package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +30 -0
  189. package/shortcutContexts/commands/moveCellSelection/toMostRight.js +35 -0
  190. package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +30 -0
  191. package/shortcutContexts/commands/moveCellSelection/toMostTop.js +16 -0
  192. package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +11 -0
  193. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +18 -0
  194. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +13 -0
  195. package/shortcutContexts/commands/moveCellSelection/up.js +12 -0
  196. package/shortcutContexts/commands/moveCellSelection/up.mjs +7 -0
  197. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +11 -0
  198. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +6 -0
  199. package/shortcutContexts/commands/populateSelectedCellsData.js +35 -0
  200. package/shortcutContexts/commands/populateSelectedCellsData.mjs +30 -0
  201. package/shortcutContexts/commands/selectAll.js +11 -0
  202. package/shortcutContexts/commands/selectAll.mjs +6 -0
  203. package/shortcutContexts/constants.js +19 -0
  204. package/shortcutContexts/constants.mjs +12 -0
  205. package/shortcutContexts/editor.js +29 -0
  206. package/shortcutContexts/editor.mjs +25 -0
  207. package/shortcutContexts/grid.js +232 -0
  208. package/shortcutContexts/grid.mjs +228 -0
  209. package/shortcutContexts/index.js +29 -0
  210. package/shortcutContexts/index.mjs +15 -0
  211. package/tableView.js +58 -9
  212. package/tableView.mjs +58 -9
  213. package/3rdparty/walkontable/src/selection.js +0 -354
  214. package/3rdparty/walkontable/src/selection.mjs +0 -348
  215. package/selection/highlight/constants.js +0 -16
  216. package/selection/highlight/constants.mjs +0 -6
@@ -0,0 +1,228 @@
1
+ import { isDefined } from "../helpers/mixed.mjs";
2
+ import { GRID_GROUP, EDITOR_EDIT_GROUP } from "./constants.mjs";
3
+ import { createKeyboardShortcutCommandsPool } from "./commands/index.mjs";
4
+ /**
5
+ * The context that defines shortcut list available for selected cell or cells.
6
+ *
7
+ * @param {Handsontable} hot The Handsontable instance.
8
+ */
9
+ export function shortcutsGridContext(hot) {
10
+ var context = hot.getShortcutManager().addContext('grid');
11
+ var commandsPool = createKeyboardShortcutCommandsPool(hot);
12
+ var config = {
13
+ runOnlyIf: function runOnlyIf() {
14
+ var _hot$getSettings = hot.getSettings(),
15
+ navigableHeaders = _hot$getSettings.navigableHeaders;
16
+ return isDefined(hot.getSelected()) && (navigableHeaders || !navigableHeaders && hot.countRenderedRows() > 0 && hot.countRenderedCols() > 0);
17
+ },
18
+ group: GRID_GROUP
19
+ };
20
+ context.addShortcuts([{
21
+ keys: [['F2']],
22
+ callback: function callback(event) {
23
+ return commandsPool.editorFastOpen(event);
24
+ }
25
+ }, {
26
+ keys: [['Enter'], ['Enter', 'Shift']],
27
+ callback: function callback(event, keys) {
28
+ return commandsPool.editorOpen(event, keys);
29
+ }
30
+ }, {
31
+ keys: [['Backspace'], ['Delete']],
32
+ callback: function callback() {
33
+ return commandsPool.emptySelectedCells();
34
+ }
35
+ }], {
36
+ group: EDITOR_EDIT_GROUP
37
+ });
38
+ context.addShortcuts([{
39
+ keys: [['Control/Meta', 'A'], ['Control/Meta', 'Shift', 'Space']],
40
+ callback: function callback() {
41
+ return commandsPool.selectAll();
42
+ }
43
+ }, {
44
+ keys: [['Control/Meta', 'Enter']],
45
+ callback: function callback() {
46
+ return commandsPool.populateSelectedCellsData();
47
+ },
48
+ runOnlyIf: function runOnlyIf() {
49
+ return hot.getSelectedRangeLast().getCellsCount() > 1;
50
+ }
51
+ }, {
52
+ keys: [['ArrowUp']],
53
+ callback: function callback() {
54
+ return commandsPool.moveCellSelectionUp();
55
+ }
56
+ }, {
57
+ keys: [['ArrowUp', 'Control/Meta']],
58
+ captureCtrl: true,
59
+ callback: function callback() {
60
+ return commandsPool.moveCellSelectionToMostTop();
61
+ }
62
+ }, {
63
+ keys: [['ArrowUp', 'Shift']],
64
+ callback: function callback() {
65
+ return commandsPool.extendCellsSelectionUp();
66
+ }
67
+ }, {
68
+ keys: [['ArrowUp', 'Shift', 'Control/Meta']],
69
+ captureCtrl: true,
70
+ callback: function callback() {
71
+ return commandsPool.extendCellsSelectionToMostTop();
72
+ },
73
+ runOnlyIf: function runOnlyIf() {
74
+ return !(hot.selection.isSelectedByCorner() || hot.selection.isSelectedByColumnHeader());
75
+ }
76
+ }, {
77
+ keys: [['ArrowDown']],
78
+ callback: function callback() {
79
+ return commandsPool.moveCellSelectionDown();
80
+ }
81
+ }, {
82
+ keys: [['ArrowDown', 'Control/Meta']],
83
+ captureCtrl: true,
84
+ callback: function callback() {
85
+ return commandsPool.moveCellSelectionToMostBottom();
86
+ }
87
+ }, {
88
+ keys: [['ArrowDown', 'Shift']],
89
+ callback: function callback() {
90
+ return commandsPool.extendCellsSelectionDown();
91
+ }
92
+ }, {
93
+ keys: [['ArrowDown', 'Shift', 'Control/Meta']],
94
+ captureCtrl: true,
95
+ callback: function callback() {
96
+ return commandsPool.extendCellsSelectionToMostBottom();
97
+ },
98
+ runOnlyIf: function runOnlyIf() {
99
+ return !(hot.selection.isSelectedByCorner() || hot.selection.isSelectedByColumnHeader());
100
+ }
101
+ }, {
102
+ keys: [['ArrowLeft']],
103
+ callback: function callback() {
104
+ return commandsPool.moveCellSelectionLeft();
105
+ }
106
+ }, {
107
+ keys: [['ArrowLeft', 'Control/Meta']],
108
+ captureCtrl: true,
109
+ callback: function callback() {
110
+ return commandsPool.moveCellSelectionToMostLeft();
111
+ }
112
+ }, {
113
+ keys: [['ArrowLeft', 'Shift']],
114
+ callback: function callback() {
115
+ return commandsPool.extendCellsSelectionLeft();
116
+ }
117
+ }, {
118
+ keys: [['ArrowLeft', 'Shift', 'Control/Meta']],
119
+ captureCtrl: true,
120
+ callback: function callback() {
121
+ return commandsPool.extendCellsSelectionToMostLeft();
122
+ },
123
+ runOnlyIf: function runOnlyIf() {
124
+ return !(hot.selection.isSelectedByCorner() || hot.selection.isSelectedByRowHeader());
125
+ }
126
+ }, {
127
+ keys: [['ArrowRight']],
128
+ callback: function callback() {
129
+ return commandsPool.moveCellSelectionRight();
130
+ }
131
+ }, {
132
+ keys: [['ArrowRight', 'Control/Meta']],
133
+ captureCtrl: true,
134
+ callback: function callback() {
135
+ return commandsPool.moveCellSelectionToMostRight();
136
+ }
137
+ }, {
138
+ keys: [['ArrowRight', 'Shift']],
139
+ callback: function callback() {
140
+ return commandsPool.extendCellsSelectionRight();
141
+ }
142
+ }, {
143
+ keys: [['ArrowRight', 'Shift', 'Control/Meta']],
144
+ captureCtrl: true,
145
+ callback: function callback() {
146
+ return commandsPool.extendCellsSelectionToMostRight();
147
+ },
148
+ runOnlyIf: function runOnlyIf() {
149
+ return !(hot.selection.isSelectedByCorner() || hot.selection.isSelectedByRowHeader());
150
+ }
151
+ }, {
152
+ keys: [['Home']],
153
+ captureCtrl: true,
154
+ callback: function callback() {
155
+ return commandsPool.moveCellSelectionToMostInlineStart();
156
+ },
157
+ runOnlyIf: function runOnlyIf() {
158
+ return hot.view.isMainTableNotFullyCoveredByOverlays();
159
+ }
160
+ }, {
161
+ keys: [['Home', 'Shift']],
162
+ callback: function callback() {
163
+ return commandsPool.extendCellsSelectionToMostInlineStart();
164
+ }
165
+ }, {
166
+ keys: [['Home', 'Control/Meta']],
167
+ captureCtrl: true,
168
+ callback: function callback() {
169
+ return commandsPool.moveCellSelectionToMostTopInlineStart();
170
+ },
171
+ runOnlyIf: function runOnlyIf() {
172
+ return hot.view.isMainTableNotFullyCoveredByOverlays();
173
+ }
174
+ }, {
175
+ keys: [['End']],
176
+ captureCtrl: true,
177
+ callback: function callback() {
178
+ return commandsPool.moveCellSelectionToMostInlineEnd();
179
+ },
180
+ runOnlyIf: function runOnlyIf() {
181
+ return hot.view.isMainTableNotFullyCoveredByOverlays();
182
+ }
183
+ }, {
184
+ keys: [['End', 'Shift']],
185
+ callback: function callback() {
186
+ return commandsPool.extendCellsSelectionToMostInlineEnd();
187
+ }
188
+ }, {
189
+ keys: [['End', 'Control/Meta']],
190
+ captureCtrl: true,
191
+ callback: function callback() {
192
+ return commandsPool.moveCellSelectionToMostBottomInlineEnd();
193
+ },
194
+ runOnlyIf: function runOnlyIf() {
195
+ return hot.view.isMainTableNotFullyCoveredByOverlays();
196
+ }
197
+ }, {
198
+ keys: [['PageUp']],
199
+ callback: function callback() {
200
+ return commandsPool.moveCellSelectionUpByViewportHight();
201
+ }
202
+ }, {
203
+ keys: [['PageUp', 'Shift']],
204
+ callback: function callback() {
205
+ return commandsPool.extendCellsSelectionUpByViewportHeight();
206
+ }
207
+ }, {
208
+ keys: [['PageDown']],
209
+ callback: function callback() {
210
+ return commandsPool.moveCellSelectionDownByViewportHeight();
211
+ }
212
+ }, {
213
+ keys: [['PageDown', 'Shift']],
214
+ callback: function callback() {
215
+ return commandsPool.extendCellsSelectionDownByViewportHeight();
216
+ }
217
+ }, {
218
+ keys: [['Tab']],
219
+ callback: function callback() {
220
+ return commandsPool.moveCellSelectionInlineStart();
221
+ }
222
+ }, {
223
+ keys: [['Shift', 'Tab']],
224
+ callback: function callback() {
225
+ return commandsPool.moveCellSelectionInlineEnd();
226
+ }
227
+ }], config);
228
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.object.keys.js");
4
+ exports.__esModule = true;
5
+ var _exportNames = {
6
+ registerAllShortcutContexts: true
7
+ };
8
+ exports.registerAllShortcutContexts = registerAllShortcutContexts;
9
+ require("core-js/modules/es.object.to-string.js");
10
+ require("core-js/modules/web.dom-collections.for-each.js");
11
+ var _editor = require("./editor");
12
+ var _grid = require("./grid");
13
+ var _constants = require("./constants");
14
+ Object.keys(_constants).forEach(function (key) {
15
+ if (key === "default" || key === "__esModule") return;
16
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
17
+ if (key in exports && exports[key] === _constants[key]) return;
18
+ exports[key] = _constants[key];
19
+ });
20
+ /**
21
+ * Register all shortcut contexts.
22
+ *
23
+ * @param {Handsontable} hotInstance The Handsontable instance.
24
+ */
25
+ function registerAllShortcutContexts(hotInstance) {
26
+ [_editor.shortcutsEditorContext, _grid.shortcutsGridContext].forEach(function (context) {
27
+ return context(hotInstance);
28
+ });
29
+ }
@@ -0,0 +1,15 @@
1
+ import "core-js/modules/es.object.to-string.js";
2
+ import "core-js/modules/web.dom-collections.for-each.js";
3
+ import { shortcutsEditorContext } from "./editor.mjs";
4
+ import { shortcutsGridContext } from "./grid.mjs";
5
+ export * from "./constants.mjs";
6
+ /**
7
+ * Register all shortcut contexts.
8
+ *
9
+ * @param {Handsontable} hotInstance The Handsontable instance.
10
+ */
11
+ export function registerAllShortcutContexts(hotInstance) {
12
+ [shortcutsEditorContext, shortcutsGridContext].forEach(function (context) {
13
+ return context(hotInstance);
14
+ });
15
+ }
package/tableView.js CHANGED
@@ -612,6 +612,44 @@ var TableView = /*#__PURE__*/function () {
612
612
  return this.countNotHiddenRowIndexes(visualFixedRowsBottom, 1);
613
613
  }
614
614
 
615
+ /**
616
+ * The function returns the number of renderable column indexes within the passed range of the visual indexes.
617
+ *
618
+ * @param {number} columnStart The column visual start index.
619
+ * @param {number} columnEnd The column visual end index.
620
+ * @returns {number}
621
+ */
622
+ }, {
623
+ key: "countRenderableColumnsInRange",
624
+ value: function countRenderableColumnsInRange(columnStart, columnEnd) {
625
+ var count = 0;
626
+ for (var column = columnStart; column <= columnEnd; column++) {
627
+ if (this.instance.columnIndexMapper.getRenderableFromVisualIndex(column) !== null) {
628
+ count += 1;
629
+ }
630
+ }
631
+ return count;
632
+ }
633
+
634
+ /**
635
+ * The function returns the number of renderable row indexes within the passed range of the visual indexes.
636
+ *
637
+ * @param {number} rowStart The row visual start index.
638
+ * @param {number} rowEnd The row visual end index.
639
+ * @returns {number}
640
+ */
641
+ }, {
642
+ key: "countRenderableRowsInRange",
643
+ value: function countRenderableRowsInRange(rowStart, rowEnd) {
644
+ var count = 0;
645
+ for (var row = rowStart; row <= rowEnd; row++) {
646
+ if (this.instance.rowIndexMapper.getRenderableFromVisualIndex(row) !== null) {
647
+ count += 1;
648
+ }
649
+ }
650
+ return count;
651
+ }
652
+
615
653
  /**
616
654
  * Checks if at least one cell than belongs to the main table is not covered by the top, left or
617
655
  * bottom overlay.
@@ -883,15 +921,29 @@ var TableView = /*#__PURE__*/function () {
883
921
  },
884
922
  onBeforeHighlightingRowHeader: function onBeforeHighlightingRowHeader(renderableRow, headerLevel, highlightMeta) {
885
923
  var rowMapper = _this2.instance.rowIndexMapper;
886
- var visualRow = rowMapper.getVisualFromRenderableIndex(renderableRow);
924
+ var areColumnHeadersSelected = renderableRow < 0;
925
+ var visualRow = renderableRow;
926
+ if (!areColumnHeadersSelected) {
927
+ visualRow = rowMapper.getVisualFromRenderableIndex(renderableRow);
928
+ }
887
929
  var newVisualRow = _this2.instance.runHooks('beforeHighlightingRowHeader', visualRow, headerLevel, highlightMeta);
888
- return rowMapper.getRenderableFromVisualIndex(rowMapper.getNearestNotHiddenIndex(newVisualRow, 1));
930
+ if (!areColumnHeadersSelected) {
931
+ return rowMapper.getRenderableFromVisualIndex(rowMapper.getNearestNotHiddenIndex(newVisualRow, 1));
932
+ }
933
+ return newVisualRow;
889
934
  },
890
935
  onBeforeHighlightingColumnHeader: function onBeforeHighlightingColumnHeader(renderableColumn, headerLevel, highlightMeta) {
891
936
  var columnMapper = _this2.instance.columnIndexMapper;
892
- var visualColumn = columnMapper.getVisualFromRenderableIndex(renderableColumn);
937
+ var areRowHeadersSelected = renderableColumn < 0;
938
+ var visualColumn = renderableColumn;
939
+ if (!areRowHeadersSelected) {
940
+ visualColumn = columnMapper.getVisualFromRenderableIndex(renderableColumn);
941
+ }
893
942
  var newVisualColumn = _this2.instance.runHooks('beforeHighlightingColumnHeader', visualColumn, headerLevel, highlightMeta);
894
- return columnMapper.getRenderableFromVisualIndex(columnMapper.getNearestNotHiddenIndex(newVisualColumn, 1));
943
+ if (!areRowHeadersSelected) {
944
+ return columnMapper.getRenderableFromVisualIndex(columnMapper.getNearestNotHiddenIndex(newVisualColumn, 1));
945
+ }
946
+ return newVisualColumn;
895
947
  },
896
948
  onAfterDrawSelection: function onAfterDrawSelection(currentRow, currentColumn, layerLevel) {
897
949
  var cornersOfSelection;
@@ -902,10 +954,7 @@ var TableView = /*#__PURE__*/function () {
902
954
  var selectedRange = _this2.instance.selection.getSelectedRange();
903
955
  var selectionRangeSize = selectedRange.size();
904
956
  if (selectionRangeSize > 0) {
905
- // Selection layers are stored from the "oldest" to the "newest". We should calculate the offset.
906
- // Please look at the `SelectedRange` class and it's method for getting selection's layer for more information.
907
- var selectionOffset = (layerLevel !== null && layerLevel !== void 0 ? layerLevel : 0) + 1 - selectionRangeSize;
908
- var selectionForLayer = selectedRange.peekByIndex(selectionOffset);
957
+ var selectionForLayer = selectedRange.peekByIndex(layerLevel !== null && layerLevel !== void 0 ? layerLevel : 0);
909
958
  cornersOfSelection = [selectionForLayer.from.row, selectionForLayer.from.col, selectionForLayer.to.row, selectionForLayer.to.col];
910
959
  }
911
960
  return _this2.instance.runHooks('afterDrawSelection', visualRowIndex, visualColumnIndex, cornersOfSelection, layerLevel);
@@ -1079,7 +1128,7 @@ var TableView = /*#__PURE__*/function () {
1079
1128
  key: "isSelectedOnlyCell",
1080
1129
  value: function isSelectedOnlyCell() {
1081
1130
  var _this$instance$getSel, _this$instance$getSel2;
1082
- return (_this$instance$getSel = (_this$instance$getSel2 = this.instance.getSelectedRangeLast()) === null || _this$instance$getSel2 === void 0 ? void 0 : _this$instance$getSel2.isSingle()) !== null && _this$instance$getSel !== void 0 ? _this$instance$getSel : false;
1131
+ return (_this$instance$getSel = (_this$instance$getSel2 = this.instance.getSelectedRangeLast()) === null || _this$instance$getSel2 === void 0 ? void 0 : _this$instance$getSel2.isSingleCell()) !== null && _this$instance$getSel !== void 0 ? _this$instance$getSel : false;
1083
1132
  }
1084
1133
 
1085
1134
  /**
package/tableView.mjs CHANGED
@@ -607,6 +607,44 @@ var TableView = /*#__PURE__*/function () {
607
607
  return this.countNotHiddenRowIndexes(visualFixedRowsBottom, 1);
608
608
  }
609
609
 
610
+ /**
611
+ * The function returns the number of renderable column indexes within the passed range of the visual indexes.
612
+ *
613
+ * @param {number} columnStart The column visual start index.
614
+ * @param {number} columnEnd The column visual end index.
615
+ * @returns {number}
616
+ */
617
+ }, {
618
+ key: "countRenderableColumnsInRange",
619
+ value: function countRenderableColumnsInRange(columnStart, columnEnd) {
620
+ var count = 0;
621
+ for (var column = columnStart; column <= columnEnd; column++) {
622
+ if (this.instance.columnIndexMapper.getRenderableFromVisualIndex(column) !== null) {
623
+ count += 1;
624
+ }
625
+ }
626
+ return count;
627
+ }
628
+
629
+ /**
630
+ * The function returns the number of renderable row indexes within the passed range of the visual indexes.
631
+ *
632
+ * @param {number} rowStart The row visual start index.
633
+ * @param {number} rowEnd The row visual end index.
634
+ * @returns {number}
635
+ */
636
+ }, {
637
+ key: "countRenderableRowsInRange",
638
+ value: function countRenderableRowsInRange(rowStart, rowEnd) {
639
+ var count = 0;
640
+ for (var row = rowStart; row <= rowEnd; row++) {
641
+ if (this.instance.rowIndexMapper.getRenderableFromVisualIndex(row) !== null) {
642
+ count += 1;
643
+ }
644
+ }
645
+ return count;
646
+ }
647
+
610
648
  /**
611
649
  * Checks if at least one cell than belongs to the main table is not covered by the top, left or
612
650
  * bottom overlay.
@@ -878,15 +916,29 @@ var TableView = /*#__PURE__*/function () {
878
916
  },
879
917
  onBeforeHighlightingRowHeader: function onBeforeHighlightingRowHeader(renderableRow, headerLevel, highlightMeta) {
880
918
  var rowMapper = _this2.instance.rowIndexMapper;
881
- var visualRow = rowMapper.getVisualFromRenderableIndex(renderableRow);
919
+ var areColumnHeadersSelected = renderableRow < 0;
920
+ var visualRow = renderableRow;
921
+ if (!areColumnHeadersSelected) {
922
+ visualRow = rowMapper.getVisualFromRenderableIndex(renderableRow);
923
+ }
882
924
  var newVisualRow = _this2.instance.runHooks('beforeHighlightingRowHeader', visualRow, headerLevel, highlightMeta);
883
- return rowMapper.getRenderableFromVisualIndex(rowMapper.getNearestNotHiddenIndex(newVisualRow, 1));
925
+ if (!areColumnHeadersSelected) {
926
+ return rowMapper.getRenderableFromVisualIndex(rowMapper.getNearestNotHiddenIndex(newVisualRow, 1));
927
+ }
928
+ return newVisualRow;
884
929
  },
885
930
  onBeforeHighlightingColumnHeader: function onBeforeHighlightingColumnHeader(renderableColumn, headerLevel, highlightMeta) {
886
931
  var columnMapper = _this2.instance.columnIndexMapper;
887
- var visualColumn = columnMapper.getVisualFromRenderableIndex(renderableColumn);
932
+ var areRowHeadersSelected = renderableColumn < 0;
933
+ var visualColumn = renderableColumn;
934
+ if (!areRowHeadersSelected) {
935
+ visualColumn = columnMapper.getVisualFromRenderableIndex(renderableColumn);
936
+ }
888
937
  var newVisualColumn = _this2.instance.runHooks('beforeHighlightingColumnHeader', visualColumn, headerLevel, highlightMeta);
889
- return columnMapper.getRenderableFromVisualIndex(columnMapper.getNearestNotHiddenIndex(newVisualColumn, 1));
938
+ if (!areRowHeadersSelected) {
939
+ return columnMapper.getRenderableFromVisualIndex(columnMapper.getNearestNotHiddenIndex(newVisualColumn, 1));
940
+ }
941
+ return newVisualColumn;
890
942
  },
891
943
  onAfterDrawSelection: function onAfterDrawSelection(currentRow, currentColumn, layerLevel) {
892
944
  var cornersOfSelection;
@@ -897,10 +949,7 @@ var TableView = /*#__PURE__*/function () {
897
949
  var selectedRange = _this2.instance.selection.getSelectedRange();
898
950
  var selectionRangeSize = selectedRange.size();
899
951
  if (selectionRangeSize > 0) {
900
- // Selection layers are stored from the "oldest" to the "newest". We should calculate the offset.
901
- // Please look at the `SelectedRange` class and it's method for getting selection's layer for more information.
902
- var selectionOffset = (layerLevel !== null && layerLevel !== void 0 ? layerLevel : 0) + 1 - selectionRangeSize;
903
- var selectionForLayer = selectedRange.peekByIndex(selectionOffset);
952
+ var selectionForLayer = selectedRange.peekByIndex(layerLevel !== null && layerLevel !== void 0 ? layerLevel : 0);
904
953
  cornersOfSelection = [selectionForLayer.from.row, selectionForLayer.from.col, selectionForLayer.to.row, selectionForLayer.to.col];
905
954
  }
906
955
  return _this2.instance.runHooks('afterDrawSelection', visualRowIndex, visualColumnIndex, cornersOfSelection, layerLevel);
@@ -1074,7 +1123,7 @@ var TableView = /*#__PURE__*/function () {
1074
1123
  key: "isSelectedOnlyCell",
1075
1124
  value: function isSelectedOnlyCell() {
1076
1125
  var _this$instance$getSel, _this$instance$getSel2;
1077
- return (_this$instance$getSel = (_this$instance$getSel2 = this.instance.getSelectedRangeLast()) === null || _this$instance$getSel2 === void 0 ? void 0 : _this$instance$getSel2.isSingle()) !== null && _this$instance$getSel !== void 0 ? _this$instance$getSel : false;
1126
+ return (_this$instance$getSel = (_this$instance$getSel2 = this.instance.getSelectedRangeLast()) === null || _this$instance$getSel2 === void 0 ? void 0 : _this$instance$getSel2.isSingleCell()) !== null && _this$instance$getSel !== void 0 ? _this$instance$getSel : false;
1078
1127
  }
1079
1128
 
1080
1129
  /**