handsontable 0.0.0-next-8dc7078-20240322 → 0.0.0-next-28fc088-20240325
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.
- package/3rdparty/walkontable/src/cell/range.d.ts +2 -1
- package/3rdparty/walkontable/src/cell/range.js +22 -5
- package/3rdparty/walkontable/src/cell/range.mjs +22 -5
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core/viewportScroll/index.js +4 -1
- package/core/viewportScroll/index.mjs +4 -1
- package/core/viewportScroll/scrollStrategies/focusScroll.js +15 -0
- package/core/viewportScroll/scrollStrategies/focusScroll.mjs +11 -0
- package/core.d.ts +4 -3
- package/core.js +76 -21
- package/core.mjs +76 -21
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +2649 -1389
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +71 -71
- package/dist/handsontable.js +2653 -1393
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +19 -19
- package/editorManager.js +12 -8
- package/editorManager.mjs +12 -8
- package/focusManager.js +7 -1
- package/focusManager.mjs +7 -1
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/pluginHooks.d.ts +4 -0
- package/pluginHooks.js +98 -37
- package/pluginHooks.mjs +98 -37
- package/plugins/collapsibleColumns/collapsibleColumns.js +9 -3
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +9 -3
- package/plugins/columnSorting/columnSorting.js +8 -2
- package/plugins/columnSorting/columnSorting.mjs +8 -2
- package/plugins/contextMenu/menu/defaultShortcutsList.js +26 -10
- package/plugins/contextMenu/menu/defaultShortcutsList.mjs +26 -10
- package/plugins/mergeCells/calculations/selection.js +1 -70
- package/plugins/mergeCells/calculations/selection.mjs +1 -70
- package/plugins/mergeCells/cellsCollection.js +116 -0
- package/plugins/mergeCells/cellsCollection.mjs +116 -0
- package/plugins/mergeCells/contextMenuItem/toggleMerge.js +11 -1
- package/plugins/mergeCells/contextMenuItem/toggleMerge.mjs +11 -1
- package/plugins/mergeCells/focusOrder.js +305 -0
- package/plugins/mergeCells/focusOrder.mjs +300 -0
- package/plugins/mergeCells/mergeCells.js +336 -192
- package/plugins/mergeCells/mergeCells.mjs +336 -192
- package/plugins/multiColumnSorting/multiColumnSorting.js +8 -2
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +8 -2
- package/plugins/nestedHeaders/nestedHeaders.js +1 -0
- package/plugins/nestedHeaders/nestedHeaders.mjs +1 -0
- package/plugins/nestedRows/nestedRows.js +9 -3
- package/plugins/nestedRows/nestedRows.mjs +9 -3
- package/renderers/checkboxRenderer/checkboxRenderer.js +8 -5
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +8 -5
- package/selection/highlight/visualSelection.js +2 -0
- package/selection/highlight/visualSelection.mjs +2 -0
- package/selection/selection.js +209 -40
- package/selection/selection.mjs +208 -39
- package/selection/transformation.js +83 -32
- package/selection/transformation.mjs +83 -32
- package/shortcutContexts/commands/editor/closeAndSave.js +2 -2
- package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -2
- package/shortcutContexts/commands/editor/open.js +18 -3
- package/shortcutContexts/commands/editor/open.mjs +18 -3
- package/shortcutContexts/commands/extendCellsSelection/down.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/down.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/left.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/left.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/right.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/right.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toColumns.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +9 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +9 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +10 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +10 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toRows.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/up.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/up.mjs +1 -1
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +6 -1
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +6 -1
- package/shortcutContexts/commands/moveCellSelection/inlineStart.js +6 -1
- package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +6 -1
- package/shortcutContexts/grid.js +2 -2
- package/shortcutContexts/grid.mjs +2 -2
- package/shortcuts/context.js +2 -1
- package/shortcuts/context.mjs +2 -1
- package/utils/dataStructures/linkedList.js +6 -1
- package/utils/dataStructures/linkedList.mjs +6 -1
@@ -17,6 +17,7 @@ var _number = require("../../helpers/number");
|
|
17
17
|
var _utils = require("./utils");
|
18
18
|
var _element = require("../../helpers/dom/element");
|
19
19
|
var _browser = require("../../helpers/browser");
|
20
|
+
var _focusOrder2 = require("./focusOrder");
|
20
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
22
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
22
23
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
@@ -72,7 +73,9 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
|
|
72
73
|
* ```
|
73
74
|
* :::
|
74
75
|
*/
|
75
|
-
var
|
76
|
+
var _lastSelectedFocus = /*#__PURE__*/new WeakMap();
|
77
|
+
var _lastFocusDelta = /*#__PURE__*/new WeakMap();
|
78
|
+
var _focusOrder = /*#__PURE__*/new WeakMap();
|
76
79
|
var _MergeCells_brand = /*#__PURE__*/new WeakSet();
|
77
80
|
class MergeCells extends _base.BasePlugin {
|
78
81
|
constructor() {
|
@@ -103,9 +106,32 @@ class MergeCells extends _base.BasePlugin {
|
|
103
106
|
*/
|
104
107
|
_defineProperty(this, "selectionCalculations", null);
|
105
108
|
/**
|
109
|
+
* The holder for the last selected focus coordinates. This allows keeping the correct coordinates in cases after the
|
110
|
+
* focus is moved out of the merged cell.
|
111
|
+
*
|
106
112
|
* @type {CellCoords}
|
107
113
|
*/
|
108
|
-
_classPrivateFieldInitSpec(this,
|
114
|
+
_classPrivateFieldInitSpec(this, _lastSelectedFocus, null);
|
115
|
+
/**
|
116
|
+
* The last used transformation delta.
|
117
|
+
*
|
118
|
+
* @type {{ row: number, col: number }}
|
119
|
+
*/
|
120
|
+
_classPrivateFieldInitSpec(this, _lastFocusDelta, {
|
121
|
+
row: 0,
|
122
|
+
col: 0
|
123
|
+
});
|
124
|
+
/**
|
125
|
+
* The module responsible for providing the correct focus order (vertical and horizontal) within a selection that
|
126
|
+
* contains merged cells.
|
127
|
+
*
|
128
|
+
* @type {FocusOrder}
|
129
|
+
*/
|
130
|
+
_classPrivateFieldInitSpec(this, _focusOrder, new _focusOrder2.FocusOrder({
|
131
|
+
mergedCellsGetter: (row, column) => this.mergedCellsCollection.get(row, column),
|
132
|
+
rowIndexMapper: this.hot.rowIndexMapper,
|
133
|
+
columnIndexMapper: this.hot.columnIndexMapper
|
134
|
+
}));
|
109
135
|
}
|
110
136
|
static get PLUGIN_KEY() {
|
111
137
|
return PLUGIN_KEY;
|
@@ -140,17 +166,17 @@ class MergeCells extends _base.BasePlugin {
|
|
140
166
|
}
|
141
167
|
return _assertClassBrand(_MergeCells_brand, _this, _onAfterInit).call(_this, ...args);
|
142
168
|
});
|
143
|
-
this.addHook('
|
169
|
+
this.addHook('modifyTransformFocus', function () {
|
144
170
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
145
171
|
args[_key2] = arguments[_key2];
|
146
172
|
}
|
147
|
-
return _assertClassBrand(_MergeCells_brand, _this,
|
173
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformFocus).call(_this, ...args);
|
148
174
|
});
|
149
|
-
this.addHook('
|
175
|
+
this.addHook('modifyTransformStart', function () {
|
150
176
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
151
177
|
args[_key3] = arguments[_key3];
|
152
178
|
}
|
153
|
-
return _assertClassBrand(_MergeCells_brand, _this,
|
179
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformStart).call(_this, ...args);
|
154
180
|
});
|
155
181
|
this.addHook('modifyTransformEnd', function () {
|
156
182
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
@@ -158,11 +184,11 @@ class MergeCells extends _base.BasePlugin {
|
|
158
184
|
}
|
159
185
|
return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformEnd).call(_this, ...args);
|
160
186
|
});
|
161
|
-
this.addHook('
|
187
|
+
this.addHook('beforeSelectionHighlightSet', function () {
|
162
188
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
163
189
|
args[_key5] = arguments[_key5];
|
164
190
|
}
|
165
|
-
return _assertClassBrand(_MergeCells_brand, _this,
|
191
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSelectionHighlightSet).call(_this, ...args);
|
166
192
|
});
|
167
193
|
this.addHook('beforeSetRangeStart', function () {
|
168
194
|
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
@@ -176,106 +202,124 @@ class MergeCells extends _base.BasePlugin {
|
|
176
202
|
}
|
177
203
|
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSetRangeStart).call(_this, ...args);
|
178
204
|
});
|
179
|
-
this.addHook('
|
205
|
+
this.addHook('beforeSelectionFocusSet', function () {
|
180
206
|
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
181
207
|
args[_key8] = arguments[_key8];
|
182
208
|
}
|
183
|
-
return _assertClassBrand(_MergeCells_brand, _this,
|
209
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSelectionFocusSet).call(_this, ...args);
|
184
210
|
});
|
185
|
-
this.addHook('
|
211
|
+
this.addHook('afterSelectionFocusSet', function () {
|
186
212
|
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
187
213
|
args[_key9] = arguments[_key9];
|
188
214
|
}
|
189
|
-
return _assertClassBrand(_MergeCells_brand, _this,
|
215
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterSelectionFocusSet).call(_this, ...args);
|
190
216
|
});
|
191
|
-
this.addHook('
|
217
|
+
this.addHook('afterSelectionEnd', function () {
|
192
218
|
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
193
219
|
args[_key10] = arguments[_key10];
|
194
220
|
}
|
195
|
-
return _assertClassBrand(_MergeCells_brand, _this,
|
221
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterSelectionEnd).call(_this, ...args);
|
196
222
|
});
|
197
|
-
this.addHook('
|
223
|
+
this.addHook('modifyGetCellCoords', function () {
|
198
224
|
for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
|
199
225
|
args[_key11] = arguments[_key11];
|
200
226
|
}
|
201
|
-
return _assertClassBrand(_MergeCells_brand, _this,
|
227
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyGetCellCoords).call(_this, ...args);
|
202
228
|
});
|
203
|
-
this.addHook('
|
229
|
+
this.addHook('afterIsMultipleSelection', function () {
|
204
230
|
for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
|
205
231
|
args[_key12] = arguments[_key12];
|
206
232
|
}
|
207
|
-
return _assertClassBrand(_MergeCells_brand, _this,
|
233
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterIsMultipleSelection).call(_this, ...args);
|
208
234
|
});
|
209
|
-
this.addHook('
|
235
|
+
this.addHook('afterRenderer', function () {
|
210
236
|
for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
|
211
237
|
args[_key13] = arguments[_key13];
|
212
238
|
}
|
213
|
-
return _assertClassBrand(_MergeCells_brand, _this,
|
239
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterRenderer).call(_this, ...args);
|
214
240
|
});
|
215
|
-
this.addHook('
|
241
|
+
this.addHook('afterContextMenuDefaultOptions', function () {
|
216
242
|
for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
|
217
243
|
args[_key14] = arguments[_key14];
|
218
244
|
}
|
219
|
-
return _assertClassBrand(_MergeCells_brand, _this,
|
245
|
+
return _assertClassBrand(_MergeCells_brand, _this, _addMergeActionsToContextMenu).call(_this, ...args);
|
220
246
|
});
|
221
|
-
this.addHook('
|
247
|
+
this.addHook('afterGetCellMeta', function () {
|
222
248
|
for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
|
223
249
|
args[_key15] = arguments[_key15];
|
224
250
|
}
|
225
|
-
return _assertClassBrand(_MergeCells_brand, _this,
|
251
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterGetCellMeta).call(_this, ...args);
|
226
252
|
});
|
227
|
-
this.addHook('
|
253
|
+
this.addHook('afterViewportRowCalculatorOverride', function () {
|
228
254
|
for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {
|
229
255
|
args[_key16] = arguments[_key16];
|
230
256
|
}
|
231
|
-
return _assertClassBrand(_MergeCells_brand, _this,
|
257
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterViewportRowCalculatorOverride).call(_this, ...args);
|
232
258
|
});
|
233
|
-
this.addHook('
|
259
|
+
this.addHook('afterViewportColumnCalculatorOverride', function () {
|
234
260
|
for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {
|
235
261
|
args[_key17] = arguments[_key17];
|
236
262
|
}
|
237
|
-
return _assertClassBrand(_MergeCells_brand, _this,
|
263
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterViewportColumnCalculatorOverride).call(_this, ...args);
|
238
264
|
});
|
239
|
-
this.addHook('
|
265
|
+
this.addHook('modifyAutofillRange', function () {
|
240
266
|
for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {
|
241
267
|
args[_key18] = arguments[_key18];
|
242
268
|
}
|
243
|
-
return _assertClassBrand(_MergeCells_brand, _this,
|
269
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyAutofillRange).call(_this, ...args);
|
244
270
|
});
|
245
|
-
this.addHook('
|
271
|
+
this.addHook('afterCreateCol', function () {
|
246
272
|
for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {
|
247
273
|
args[_key19] = arguments[_key19];
|
248
274
|
}
|
249
|
-
return _assertClassBrand(_MergeCells_brand, _this,
|
275
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterCreateCol).call(_this, ...args);
|
250
276
|
});
|
251
|
-
this.addHook('
|
277
|
+
this.addHook('afterRemoveCol', function () {
|
252
278
|
for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {
|
253
279
|
args[_key20] = arguments[_key20];
|
254
280
|
}
|
255
|
-
return _assertClassBrand(_MergeCells_brand, _this,
|
281
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterRemoveCol).call(_this, ...args);
|
256
282
|
});
|
257
|
-
this.addHook('
|
283
|
+
this.addHook('afterCreateRow', function () {
|
258
284
|
for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {
|
259
285
|
args[_key21] = arguments[_key21];
|
260
286
|
}
|
261
|
-
return _assertClassBrand(_MergeCells_brand, _this,
|
287
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterCreateRow).call(_this, ...args);
|
262
288
|
});
|
263
|
-
this.addHook('
|
289
|
+
this.addHook('afterRemoveRow', function () {
|
264
290
|
for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {
|
265
291
|
args[_key22] = arguments[_key22];
|
266
292
|
}
|
267
|
-
return _assertClassBrand(_MergeCells_brand, _this,
|
293
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterRemoveRow).call(_this, ...args);
|
268
294
|
});
|
269
|
-
this.addHook('
|
295
|
+
this.addHook('afterChange', function () {
|
270
296
|
for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {
|
271
297
|
args[_key23] = arguments[_key23];
|
272
298
|
}
|
273
|
-
return _assertClassBrand(_MergeCells_brand, _this,
|
299
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterChange).call(_this, ...args);
|
274
300
|
});
|
275
|
-
this.addHook('
|
301
|
+
this.addHook('beforeDrawBorders', function () {
|
276
302
|
for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {
|
277
303
|
args[_key24] = arguments[_key24];
|
278
304
|
}
|
305
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeDrawAreaBorders).call(_this, ...args);
|
306
|
+
});
|
307
|
+
this.addHook('afterDrawSelection', function () {
|
308
|
+
for (var _len25 = arguments.length, args = new Array(_len25), _key25 = 0; _key25 < _len25; _key25++) {
|
309
|
+
args[_key25] = arguments[_key25];
|
310
|
+
}
|
311
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterDrawSelection).call(_this, ...args);
|
312
|
+
});
|
313
|
+
this.addHook('beforeRemoveCellClassNames', function () {
|
314
|
+
for (var _len26 = arguments.length, args = new Array(_len26), _key26 = 0; _key26 < _len26; _key26++) {
|
315
|
+
args[_key26] = arguments[_key26];
|
316
|
+
}
|
317
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeRemoveCellClassNames).call(_this, ...args);
|
318
|
+
});
|
319
|
+
this.addHook('beforeBeginEditing', function () {
|
320
|
+
for (var _len27 = arguments.length, args = new Array(_len27), _key27 = 0; _key27 < _len27; _key27++) {
|
321
|
+
args[_key27] = arguments[_key27];
|
322
|
+
}
|
279
323
|
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeBeginEditing).call(_this, ...args);
|
280
324
|
});
|
281
325
|
this.addHook('beforeUndoStackChange', (action, source) => {
|
@@ -446,25 +490,6 @@ class MergeCells extends _base.BasePlugin {
|
|
446
490
|
return auto ? true : this.validateSetting(newMergedCellInfo);
|
447
491
|
}
|
448
492
|
|
449
|
-
/**
|
450
|
-
* Merge or unmerge, based on last selected range.
|
451
|
-
*
|
452
|
-
* @private
|
453
|
-
*/
|
454
|
-
toggleMergeOnSelection() {
|
455
|
-
const currentRange = this.hot.getSelectedRangeLast();
|
456
|
-
if (!currentRange) {
|
457
|
-
return;
|
458
|
-
}
|
459
|
-
currentRange.setDirection(this.hot.isRtl() ? 'NE-SW' : 'NW-SE');
|
460
|
-
const {
|
461
|
-
from,
|
462
|
-
to
|
463
|
-
} = currentRange;
|
464
|
-
this.toggleMerge(currentRange);
|
465
|
-
this.hot.selectCell(from.row, from.col, to.row, to.col, false);
|
466
|
-
}
|
467
|
-
|
468
493
|
/**
|
469
494
|
* Merges the selection provided as a cell range.
|
470
495
|
*
|
@@ -860,94 +885,191 @@ function _onAfterIsMultipleSelection(isMultiple) {
|
|
860
885
|
if (isMultiple) {
|
861
886
|
const mergedCells = this.mergedCellsCollection.mergedCells;
|
862
887
|
const selectionRange = this.hot.getSelectedRangeLast();
|
888
|
+
const topStartCoords = selectionRange.getTopStartCorner();
|
889
|
+
const bottomEndCoords = selectionRange.getBottomEndCorner();
|
863
890
|
for (let group = 0; group < mergedCells.length; group += 1) {
|
864
|
-
if (
|
891
|
+
if (topStartCoords.row === mergedCells[group].row && topStartCoords.col === mergedCells[group].col && bottomEndCoords.row === mergedCells[group].row + mergedCells[group].rowspan - 1 && bottomEndCoords.col === mergedCells[group].col + mergedCells[group].colspan - 1) {
|
865
892
|
return false;
|
866
893
|
}
|
867
894
|
}
|
868
895
|
}
|
869
896
|
return isMultiple;
|
870
897
|
}
|
898
|
+
/**
|
899
|
+
* `modifyTransformFocus` hook callback.
|
900
|
+
*
|
901
|
+
* @param {object} delta The transformation delta.
|
902
|
+
*/
|
903
|
+
function _onModifyTransformFocus(delta) {
|
904
|
+
_classPrivateFieldGet(_lastFocusDelta, this).row = delta.row;
|
905
|
+
_classPrivateFieldGet(_lastFocusDelta, this).col = delta.col;
|
906
|
+
}
|
871
907
|
/**
|
872
908
|
* `modifyTransformStart` hook callback.
|
873
909
|
*
|
874
910
|
* @param {object} delta The transformation delta.
|
875
911
|
*/
|
876
912
|
function _onModifyTransformStart(delta) {
|
877
|
-
const
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
if (
|
886
|
-
|
887
|
-
|
888
|
-
if (mergedParent) {
|
889
|
-
// only merge selected
|
890
|
-
const mergeTopLeft = this.hot._createCellCoords(mergedParent.row, mergedParent.col);
|
891
|
-
const mergeBottomRight = this.hot._createCellCoords(mergedParent.row + mergedParent.rowspan - 1, mergedParent.col + mergedParent.colspan - 1);
|
892
|
-
const mergeRange = this.hot._createCellRange(mergeTopLeft, mergeTopLeft, mergeBottomRight);
|
893
|
-
if (!mergeRange.includes(_classPrivateFieldGet(_lastDesiredCoords, this))) {
|
894
|
-
_classPrivateFieldSet(_lastDesiredCoords, this, this.hot._createCellCoords(null, null)); // reset outdated version of lastDesiredCoords
|
895
|
-
}
|
896
|
-
newDelta.row = _classPrivateFieldGet(_lastDesiredCoords, this).row ? _classPrivateFieldGet(_lastDesiredCoords, this).row - currentPosition.row : newDelta.row;
|
897
|
-
newDelta.col = _classPrivateFieldGet(_lastDesiredCoords, this).col ? _classPrivateFieldGet(_lastDesiredCoords, this).col - currentPosition.col : newDelta.col;
|
898
|
-
if (delta.row > 0) {
|
899
|
-
// moving down
|
900
|
-
newDelta.row = mergedParent.row + mergedParent.rowspan - 1 - currentPosition.row + delta.row;
|
901
|
-
} else if (delta.row < 0) {
|
902
|
-
// moving up
|
903
|
-
newDelta.row = currentPosition.row - mergedParent.row + delta.row;
|
913
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
914
|
+
const {
|
915
|
+
highlight
|
916
|
+
} = selectedRange;
|
917
|
+
const {
|
918
|
+
columnIndexMapper,
|
919
|
+
rowIndexMapper
|
920
|
+
} = this.hot;
|
921
|
+
if (_classPrivateFieldGet(_lastSelectedFocus, this)) {
|
922
|
+
if (rowIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(_lastSelectedFocus, this).row) !== null) {
|
923
|
+
highlight.row = _classPrivateFieldGet(_lastSelectedFocus, this).row;
|
904
924
|
}
|
905
|
-
if (
|
906
|
-
|
907
|
-
newDelta.col = mergedParent.col + mergedParent.colspan - 1 - currentPosition.col + delta.col;
|
908
|
-
} else if (delta.col < 0) {
|
909
|
-
// moving left
|
910
|
-
newDelta.col = currentPosition.col - mergedParent.col + delta.col;
|
925
|
+
if (columnIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(_lastSelectedFocus, this).col) !== null) {
|
926
|
+
highlight.col = _classPrivateFieldGet(_lastSelectedFocus, this).col;
|
911
927
|
}
|
928
|
+
_classPrivateFieldSet(_lastSelectedFocus, this, null);
|
912
929
|
}
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
// skipping the invisible cells in the merge range
|
917
|
-
const firstRenderableCoords = this.mergedCellsCollection.getFirstRenderableCoords(nextPositionMergedCell.row, nextPositionMergedCell.col);
|
918
|
-
_classPrivateFieldSet(_lastDesiredCoords, this, nextPosition);
|
919
|
-
newDelta = {
|
920
|
-
row: firstRenderableCoords.row - currentPosition.row,
|
921
|
-
col: firstRenderableCoords.col - currentPosition.col
|
922
|
-
};
|
930
|
+
const mergedParent = this.mergedCellsCollection.get(highlight.row, highlight.col);
|
931
|
+
if (!mergedParent) {
|
932
|
+
return;
|
923
933
|
}
|
924
|
-
|
925
|
-
|
934
|
+
const visualColumnIndexStart = mergedParent.col;
|
935
|
+
const visualColumnIndexEnd = mergedParent.col + mergedParent.colspan - 1;
|
936
|
+
if (delta.col < 0) {
|
937
|
+
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexStart - 1 : visualColumnIndexEnd;
|
938
|
+
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
939
|
+
if (notHiddenColumnIndex === null) {
|
940
|
+
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
941
|
+
// be processed by the selection Transformer class as a move selection to the previous row (if autoWrapRow is enabled).
|
942
|
+
delta.col = -this.hot.view.countRenderableColumnsInRange(0, highlight.col);
|
943
|
+
} else {
|
944
|
+
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1, 1);
|
945
|
+
}
|
946
|
+
} else if (delta.col > 0) {
|
947
|
+
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexEnd + 1 : visualColumnIndexStart;
|
948
|
+
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
949
|
+
if (notHiddenColumnIndex === null) {
|
950
|
+
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
951
|
+
// be processed by the selection Transformer class as a move selection to the next row (if autoWrapRow is enabled).
|
952
|
+
delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, this.hot.countCols());
|
953
|
+
} else {
|
954
|
+
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1, 1);
|
955
|
+
}
|
926
956
|
}
|
927
|
-
|
928
|
-
|
957
|
+
const visualRowIndexStart = mergedParent.row;
|
958
|
+
const visualRowIndexEnd = mergedParent.row + mergedParent.rowspan - 1;
|
959
|
+
if (delta.row < 0) {
|
960
|
+
const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexStart - 1 : visualRowIndexEnd;
|
961
|
+
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, -1);
|
962
|
+
if (notHiddenRowIndex === null) {
|
963
|
+
// There are no visible rows anymore, so move the selection out of the table edge. This will
|
964
|
+
// be processed by the selection Transformer class as a move selection to the previous column (if autoWrapCol is enabled).
|
965
|
+
delta.row = -this.hot.view.countRenderableRowsInRange(0, highlight.row);
|
966
|
+
} else {
|
967
|
+
delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, highlight.row) - 1, 1);
|
968
|
+
}
|
969
|
+
} else if (delta.row > 0) {
|
970
|
+
const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexEnd + 1 : visualRowIndexStart;
|
971
|
+
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, 1);
|
972
|
+
if (notHiddenRowIndex === null) {
|
973
|
+
// There are no visible rows anymore, so move the selection out of the table edge. This will
|
974
|
+
// be processed by the selection Transformer class as a move selection to the next column (if autoWrapCol is enabled).
|
975
|
+
delta.row = this.hot.view.countRenderableRowsInRange(highlight.row, this.hot.countRows());
|
976
|
+
} else {
|
977
|
+
delta.row = Math.max(this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowIndex) - 1, 1);
|
978
|
+
}
|
929
979
|
}
|
930
980
|
}
|
931
981
|
/**
|
932
|
-
*
|
982
|
+
* The hook allows to modify the delta transformation object necessary for correct selection end transformations.
|
983
|
+
* The logic here handles "jumping over" merged merged cells, while selecting.
|
933
984
|
*
|
934
|
-
* @param {
|
985
|
+
* @param {{ row: number, col: number }} delta The transformation delta.
|
935
986
|
*/
|
936
987
|
function _onModifyTransformEnd(delta) {
|
937
|
-
const
|
938
|
-
const
|
939
|
-
const
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
988
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
989
|
+
const cloneRange = selectedRange.clone();
|
990
|
+
const {
|
991
|
+
to
|
992
|
+
} = selectedRange;
|
993
|
+
const {
|
994
|
+
columnIndexMapper,
|
995
|
+
rowIndexMapper
|
996
|
+
} = this.hot;
|
997
|
+
const expandCloneRange = (row, col) => {
|
998
|
+
cloneRange.expand(this.hot._createCellCoords(row, col));
|
999
|
+
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1000
|
+
cloneRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange());
|
1001
|
+
}
|
1002
|
+
};
|
1003
|
+
if (delta.col < 0) {
|
1004
|
+
let nextColumn = this.mergedCellsCollection.getStartMostColumnIndex(selectedRange, to.col) + delta.col;
|
1005
|
+
expandCloneRange(to.row, nextColumn);
|
1006
|
+
if (selectedRange.getHorizontalDirection() === 'E-W' && cloneRange.getHorizontalDirection() === 'E-W') {
|
1007
|
+
nextColumn = cloneRange.getTopStartCorner().col;
|
1008
|
+
}
|
1009
|
+
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
1010
|
+
if (notHiddenColumnIndex !== null) {
|
1011
|
+
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, to.col) - 1, 1);
|
1012
|
+
}
|
1013
|
+
} else if (delta.col > 0) {
|
1014
|
+
let nextColumn = this.mergedCellsCollection.getEndMostColumnIndex(selectedRange, to.col) + delta.col;
|
1015
|
+
expandCloneRange(to.row, nextColumn);
|
1016
|
+
if (selectedRange.getHorizontalDirection() === 'W-E' && cloneRange.getHorizontalDirection() === 'W-E') {
|
1017
|
+
nextColumn = cloneRange.getBottomEndCorner().col;
|
1018
|
+
}
|
1019
|
+
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
1020
|
+
if (notHiddenColumnIndex !== null) {
|
1021
|
+
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(to.col, notHiddenColumnIndex) - 1, 1);
|
1022
|
+
}
|
1023
|
+
}
|
1024
|
+
if (delta.row < 0) {
|
1025
|
+
let nextRow = this.mergedCellsCollection.getTopMostRowIndex(selectedRange, to.row) + delta.row;
|
1026
|
+
expandCloneRange(nextRow, to.col);
|
1027
|
+
if (selectedRange.getVerticalDirection() === 'S-N' && cloneRange.getVerticalDirection() === 'S-N') {
|
1028
|
+
nextRow = cloneRange.getTopStartCorner().row;
|
1029
|
+
}
|
1030
|
+
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, 1);
|
1031
|
+
if (notHiddenRowIndex !== null) {
|
1032
|
+
delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, to.row) - 1, 1);
|
1033
|
+
}
|
1034
|
+
} else if (delta.row > 0) {
|
1035
|
+
let nextRow = this.mergedCellsCollection.getBottomMostRowIndex(selectedRange, to.row) + delta.row;
|
1036
|
+
expandCloneRange(nextRow, to.col);
|
1037
|
+
if (selectedRange.getVerticalDirection() === 'N-S' && cloneRange.getVerticalDirection() === 'N-S') {
|
1038
|
+
nextRow = cloneRange.getBottomStartCorner().row;
|
1039
|
+
}
|
1040
|
+
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, -1);
|
1041
|
+
if (notHiddenRowIndex !== null) {
|
1042
|
+
delta.row = Math.max(this.hot.view.countRenderableRowsInRange(to.row, notHiddenRowIndex) - 1, 1);
|
1043
|
+
}
|
1044
|
+
}
|
1045
|
+
}
|
1046
|
+
/**
|
1047
|
+
* The hook corrects the range (before drawing it) after the selection was made on the merged cells.
|
1048
|
+
* It expands the range to cover the entire area of the selected merged cells.
|
1049
|
+
*/
|
1050
|
+
function _onBeforeSelectionHighlightSet() {
|
1051
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
1052
|
+
const {
|
1053
|
+
highlight
|
1054
|
+
} = selectedRange;
|
1055
|
+
if (this.hot.selection.isSelectedByColumnHeader() || this.hot.selection.isSelectedByRowHeader()) {
|
1056
|
+
_classPrivateFieldSet(_lastSelectedFocus, this, highlight.clone());
|
1057
|
+
return;
|
1058
|
+
}
|
1059
|
+
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1060
|
+
selectedRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange(), false);
|
1061
|
+
}
|
1062
|
+
// TODO: This is a workaround for an issue with the selection not being extended properly.
|
1063
|
+
// In some cases when the merge cells are defined in random order the selection is not
|
1064
|
+
// extended in that way that it covers all overlapped merge cells.
|
1065
|
+
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1066
|
+
selectedRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange(), false);
|
1067
|
+
}
|
1068
|
+
const mergedParent = this.mergedCellsCollection.get(highlight.row, highlight.col);
|
1069
|
+
_classPrivateFieldSet(_lastSelectedFocus, this, highlight.clone());
|
1070
|
+
if (mergedParent) {
|
1071
|
+
highlight.assign(mergedParent);
|
1072
|
+
}
|
951
1073
|
}
|
952
1074
|
/**
|
953
1075
|
* `modifyGetCellCoords` hook callback. Swaps the `getCell` coords with the merged parent coords.
|
@@ -1026,51 +1148,104 @@ function _onAfterRenderer(TD, row, col) {
|
|
1026
1148
|
(0, _utils.applySpanProperties)(TD, mergedCellCopy, row, col);
|
1027
1149
|
}
|
1028
1150
|
/**
|
1029
|
-
*
|
1030
|
-
* A selection within merge area should be rewritten to the start of merge area.
|
1031
|
-
*
|
1032
|
-
* @param {object} coords Cell coords.
|
1151
|
+
* Clears the last selected coordinates before setting a new selection range.
|
1033
1152
|
*/
|
1034
|
-
function _onBeforeSetRangeStart(
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1153
|
+
function _onBeforeSetRangeStart() {
|
1154
|
+
_classPrivateFieldSet(_lastSelectedFocus, this, null);
|
1155
|
+
}
|
1156
|
+
/**
|
1157
|
+
* Detects if the last selected cell was a header cell if so update the order list active node for further
|
1158
|
+
* computations.
|
1159
|
+
*/
|
1160
|
+
function _onBeforeSelectionFocusSet() {
|
1161
|
+
if (_classPrivateFieldGet(_lastSelectedFocus, this).isCell()) {
|
1162
|
+
return;
|
1163
|
+
}
|
1164
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
1165
|
+
const verticalDir = selectedRange.getVerticalDirection();
|
1166
|
+
const horizontalDir = selectedRange.getHorizontalDirection();
|
1167
|
+
const focusCoords = _classPrivateFieldGet(_lastSelectedFocus, this).clone().normalize();
|
1168
|
+
_classPrivateFieldGet(_focusOrder, this).setActiveNode(focusCoords.row, focusCoords.col);
|
1169
|
+
if (_classPrivateFieldGet(_lastFocusDelta, this).row > 0 || _classPrivateFieldGet(_lastFocusDelta, this).col > 0) {
|
1170
|
+
_classPrivateFieldGet(_focusOrder, this).setPrevNodeAsActive();
|
1171
|
+
} else if (horizontalDir === 'E-W' && _classPrivateFieldGet(_lastFocusDelta, this).col < 0 || verticalDir === 'S-N' && _classPrivateFieldGet(_lastFocusDelta, this).row < 0) {
|
1172
|
+
_classPrivateFieldGet(_focusOrder, this).setNextNodeAsActive();
|
1043
1173
|
}
|
1044
1174
|
}
|
1045
1175
|
/**
|
1046
|
-
*
|
1047
|
-
* While selecting cells with keyboard or mouse, make sure that rectangular area is expanded to the extent of the
|
1048
|
-
* merged cell.
|
1049
|
-
*
|
1050
|
-
* Note: Please keep in mind that callback may modify both start and end range coordinates by the reference.
|
1176
|
+
* Changes the focus selection to the next or previous cell or merged cell position.
|
1051
1177
|
*
|
1052
|
-
* @param {
|
1178
|
+
* @param {number} row The visual row index.
|
1179
|
+
* @param {number} column The visual column index.
|
1053
1180
|
*/
|
1054
|
-
function
|
1055
|
-
const
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1181
|
+
function _onAfterSelectionFocusSet(row, column) {
|
1182
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
1183
|
+
const {
|
1184
|
+
columnIndexMapper,
|
1185
|
+
rowIndexMapper
|
1186
|
+
} = this.hot;
|
1187
|
+
let notHiddenRowIndex = null;
|
1188
|
+
let notHiddenColumnIndex = null;
|
1189
|
+
if (_classPrivateFieldGet(_lastFocusDelta, this).col < 0) {
|
1190
|
+
const {
|
1191
|
+
rowEnd,
|
1192
|
+
colEnd
|
1193
|
+
} = _classPrivateFieldGet(_focusOrder, this).getPrevHorizontalNode();
|
1194
|
+
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colEnd, -1);
|
1195
|
+
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowEnd, -1);
|
1196
|
+
} else if (_classPrivateFieldGet(_lastFocusDelta, this).col > 0) {
|
1197
|
+
const {
|
1198
|
+
rowStart,
|
1199
|
+
colStart
|
1200
|
+
} = _classPrivateFieldGet(_focusOrder, this).getNextHorizontalNode();
|
1201
|
+
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);
|
1202
|
+
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);
|
1203
|
+
} else if (_classPrivateFieldGet(_lastFocusDelta, this).row < 0) {
|
1204
|
+
const {
|
1205
|
+
rowEnd,
|
1206
|
+
colEnd
|
1207
|
+
} = _classPrivateFieldGet(_focusOrder, this).getPrevVerticalNode();
|
1208
|
+
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colEnd, -1);
|
1209
|
+
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowEnd, -1);
|
1210
|
+
} else if (_classPrivateFieldGet(_lastFocusDelta, this).row > 0) {
|
1211
|
+
const {
|
1212
|
+
rowStart,
|
1213
|
+
colStart
|
1214
|
+
} = _classPrivateFieldGet(_focusOrder, this).getNextVerticalNode();
|
1215
|
+
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);
|
1216
|
+
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);
|
1061
1217
|
}
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1218
|
+
if (notHiddenRowIndex !== null || notHiddenColumnIndex !== null) {
|
1219
|
+
const coords = this.hot._createCellCoords(notHiddenRowIndex, notHiddenColumnIndex);
|
1220
|
+
const mergeParent = this.mergedCellsCollection.get(coords.row, coords.col);
|
1221
|
+
const focusHighlight = this.hot.selection.highlight.getFocus();
|
1222
|
+
row = coords.row;
|
1223
|
+
column = coords.col;
|
1224
|
+
if (mergeParent) {
|
1225
|
+
selectedRange.highlight.assign({
|
1226
|
+
row: this.hot.rowIndexMapper.getNearestNotHiddenIndex(mergeParent.row, 1),
|
1227
|
+
col: this.hot.columnIndexMapper.getNearestNotHiddenIndex(mergeParent.col, 1)
|
1228
|
+
});
|
1229
|
+
} else {
|
1230
|
+
selectedRange.highlight.assign(coords);
|
1072
1231
|
}
|
1073
|
-
|
1232
|
+
focusHighlight.clear();
|
1233
|
+
focusHighlight.add(coords).commit();
|
1234
|
+
}
|
1235
|
+
_classPrivateFieldGet(_focusOrder, this).setActiveNode(row, column);
|
1236
|
+
_classPrivateFieldSet(_lastFocusDelta, this, {
|
1237
|
+
row: 0,
|
1238
|
+
col: 0
|
1239
|
+
});
|
1240
|
+
}
|
1241
|
+
/**
|
1242
|
+
* Creates the horizontal and vertical cells order matrix (linked lists) for focused cell.
|
1243
|
+
*/
|
1244
|
+
function _onAfterSelectionEnd() {
|
1245
|
+
const selection = this.hot.getSelectedRangeLast();
|
1246
|
+
if (!selection.isHeader()) {
|
1247
|
+
_classPrivateFieldGet(_focusOrder, this).buildFocusOrder(this.hot.getSelectedRangeLast());
|
1248
|
+
}
|
1074
1249
|
}
|
1075
1250
|
/**
|
1076
1251
|
* The `afterGetCellMeta` hook callback.
|
@@ -1199,37 +1374,6 @@ function _onBeforeDrawAreaBorders(corners, className) {
|
|
1199
1374
|
});
|
1200
1375
|
}
|
1201
1376
|
}
|
1202
|
-
/**
|
1203
|
-
* `afterModifyTransformStart` hook callback. Fixes a problem with navigating through merged cells at the edges of
|
1204
|
-
* the table with the <kbd>**Enter**</kbd>/<kbd>**Shift**</kbd>+<kbd>**Enter**</kbd>/<kbd>**Tab**</kbd>/<kbd>**Shift**</kbd>+<kbd>**Tab**</kbd> keys.
|
1205
|
-
*
|
1206
|
-
* @param {CellCoords} coords Coordinates of the to-be-selected cell.
|
1207
|
-
* @param {number} rowTransformDir Row transformation direction (negative value = up, 0 = none, positive value =
|
1208
|
-
* down).
|
1209
|
-
* @param {number} colTransformDir Column transformation direction (negative value = up, 0 = none, positive value =
|
1210
|
-
* down).
|
1211
|
-
*/
|
1212
|
-
function _onAfterModifyTransformStart(coords, rowTransformDir, colTransformDir) {
|
1213
|
-
if (!this.enabled) {
|
1214
|
-
return;
|
1215
|
-
}
|
1216
|
-
const mergedCellAtCoords = this.mergedCellsCollection.get(coords.row, coords.col);
|
1217
|
-
if (!mergedCellAtCoords) {
|
1218
|
-
return;
|
1219
|
-
}
|
1220
|
-
const goingDown = rowTransformDir > 0;
|
1221
|
-
const goingUp = rowTransformDir < 0;
|
1222
|
-
const goingLeft = colTransformDir < 0;
|
1223
|
-
const goingRight = colTransformDir > 0;
|
1224
|
-
const mergedCellOnBottomEdge = mergedCellAtCoords.row + mergedCellAtCoords.rowspan - 1 === this.hot.countRows() - 1;
|
1225
|
-
const mergedCellOnTopEdge = mergedCellAtCoords.row === 0;
|
1226
|
-
const mergedCellOnRightEdge = mergedCellAtCoords.col + mergedCellAtCoords.colspan - 1 === this.hot.countCols() - 1;
|
1227
|
-
const mergedCellOnLeftEdge = mergedCellAtCoords.col === 0;
|
1228
|
-
if (goingDown && mergedCellOnBottomEdge || goingUp && mergedCellOnTopEdge || goingRight && mergedCellOnRightEdge || goingLeft && mergedCellOnLeftEdge) {
|
1229
|
-
coords.row = mergedCellAtCoords.row;
|
1230
|
-
coords.col = mergedCellAtCoords.col;
|
1231
|
-
}
|
1232
|
-
}
|
1233
1377
|
/**
|
1234
1378
|
* `afterDrawSelection` hook callback. Used to add the additional class name for the entirely-selected merged cells.
|
1235
1379
|
*
|