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.
- 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 +2611 -1352
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +64 -64
- package/dist/handsontable.js +2615 -1356
- 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/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 +69 -1
- package/pluginHooks.mjs +69 -1
- 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 +303 -0
- package/plugins/mergeCells/focusOrder.mjs +298 -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) => {
|
@@ -444,25 +488,6 @@ class MergeCells extends _base.BasePlugin {
|
|
444
488
|
return auto ? true : this.validateSetting(newMergedCellInfo);
|
445
489
|
}
|
446
490
|
|
447
|
-
/**
|
448
|
-
* Merge or unmerge, based on last selected range.
|
449
|
-
*
|
450
|
-
* @private
|
451
|
-
*/
|
452
|
-
toggleMergeOnSelection() {
|
453
|
-
const currentRange = this.hot.getSelectedRangeLast();
|
454
|
-
if (!currentRange) {
|
455
|
-
return;
|
456
|
-
}
|
457
|
-
currentRange.setDirection(this.hot.isRtl() ? 'NE-SW' : 'NW-SE');
|
458
|
-
const {
|
459
|
-
from,
|
460
|
-
to
|
461
|
-
} = currentRange;
|
462
|
-
this.toggleMerge(currentRange);
|
463
|
-
this.hot.selectCell(from.row, from.col, to.row, to.col, false);
|
464
|
-
}
|
465
|
-
|
466
491
|
/**
|
467
492
|
* Merges the selection provided as a cell range.
|
468
493
|
*
|
@@ -857,94 +882,191 @@ function _onAfterIsMultipleSelection(isMultiple) {
|
|
857
882
|
if (isMultiple) {
|
858
883
|
const mergedCells = this.mergedCellsCollection.mergedCells;
|
859
884
|
const selectionRange = this.hot.getSelectedRangeLast();
|
885
|
+
const topStartCoords = selectionRange.getTopStartCorner();
|
886
|
+
const bottomEndCoords = selectionRange.getBottomEndCorner();
|
860
887
|
for (let group = 0; group < mergedCells.length; group += 1) {
|
861
|
-
if (
|
888
|
+
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) {
|
862
889
|
return false;
|
863
890
|
}
|
864
891
|
}
|
865
892
|
}
|
866
893
|
return isMultiple;
|
867
894
|
}
|
895
|
+
/**
|
896
|
+
* `modifyTransformFocus` hook callback.
|
897
|
+
*
|
898
|
+
* @param {object} delta The transformation delta.
|
899
|
+
*/
|
900
|
+
function _onModifyTransformFocus(delta) {
|
901
|
+
_classPrivateFieldGet(_lastFocusDelta, this).row = delta.row;
|
902
|
+
_classPrivateFieldGet(_lastFocusDelta, this).col = delta.col;
|
903
|
+
}
|
868
904
|
/**
|
869
905
|
* `modifyTransformStart` hook callback.
|
870
906
|
*
|
871
907
|
* @param {object} delta The transformation delta.
|
872
908
|
*/
|
873
909
|
function _onModifyTransformStart(delta) {
|
874
|
-
const
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
if (
|
883
|
-
|
884
|
-
|
885
|
-
if (mergedParent) {
|
886
|
-
// only merge selected
|
887
|
-
const mergeTopLeft = this.hot._createCellCoords(mergedParent.row, mergedParent.col);
|
888
|
-
const mergeBottomRight = this.hot._createCellCoords(mergedParent.row + mergedParent.rowspan - 1, mergedParent.col + mergedParent.colspan - 1);
|
889
|
-
const mergeRange = this.hot._createCellRange(mergeTopLeft, mergeTopLeft, mergeBottomRight);
|
890
|
-
if (!mergeRange.includes(_classPrivateFieldGet(_lastDesiredCoords, this))) {
|
891
|
-
_classPrivateFieldSet(_lastDesiredCoords, this, this.hot._createCellCoords(null, null)); // reset outdated version of lastDesiredCoords
|
892
|
-
}
|
893
|
-
newDelta.row = _classPrivateFieldGet(_lastDesiredCoords, this).row ? _classPrivateFieldGet(_lastDesiredCoords, this).row - currentPosition.row : newDelta.row;
|
894
|
-
newDelta.col = _classPrivateFieldGet(_lastDesiredCoords, this).col ? _classPrivateFieldGet(_lastDesiredCoords, this).col - currentPosition.col : newDelta.col;
|
895
|
-
if (delta.row > 0) {
|
896
|
-
// moving down
|
897
|
-
newDelta.row = mergedParent.row + mergedParent.rowspan - 1 - currentPosition.row + delta.row;
|
898
|
-
} else if (delta.row < 0) {
|
899
|
-
// moving up
|
900
|
-
newDelta.row = currentPosition.row - mergedParent.row + delta.row;
|
910
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
911
|
+
const {
|
912
|
+
highlight
|
913
|
+
} = selectedRange;
|
914
|
+
const {
|
915
|
+
columnIndexMapper,
|
916
|
+
rowIndexMapper
|
917
|
+
} = this.hot;
|
918
|
+
if (_classPrivateFieldGet(_lastSelectedFocus, this)) {
|
919
|
+
if (rowIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(_lastSelectedFocus, this).row) !== null) {
|
920
|
+
highlight.row = _classPrivateFieldGet(_lastSelectedFocus, this).row;
|
901
921
|
}
|
902
|
-
if (
|
903
|
-
|
904
|
-
newDelta.col = mergedParent.col + mergedParent.colspan - 1 - currentPosition.col + delta.col;
|
905
|
-
} else if (delta.col < 0) {
|
906
|
-
// moving left
|
907
|
-
newDelta.col = currentPosition.col - mergedParent.col + delta.col;
|
922
|
+
if (columnIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(_lastSelectedFocus, this).col) !== null) {
|
923
|
+
highlight.col = _classPrivateFieldGet(_lastSelectedFocus, this).col;
|
908
924
|
}
|
925
|
+
_classPrivateFieldSet(_lastSelectedFocus, this, null);
|
909
926
|
}
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
// skipping the invisible cells in the merge range
|
914
|
-
const firstRenderableCoords = this.mergedCellsCollection.getFirstRenderableCoords(nextPositionMergedCell.row, nextPositionMergedCell.col);
|
915
|
-
_classPrivateFieldSet(_lastDesiredCoords, this, nextPosition);
|
916
|
-
newDelta = {
|
917
|
-
row: firstRenderableCoords.row - currentPosition.row,
|
918
|
-
col: firstRenderableCoords.col - currentPosition.col
|
919
|
-
};
|
927
|
+
const mergedParent = this.mergedCellsCollection.get(highlight.row, highlight.col);
|
928
|
+
if (!mergedParent) {
|
929
|
+
return;
|
920
930
|
}
|
921
|
-
|
922
|
-
|
931
|
+
const visualColumnIndexStart = mergedParent.col;
|
932
|
+
const visualColumnIndexEnd = mergedParent.col + mergedParent.colspan - 1;
|
933
|
+
if (delta.col < 0) {
|
934
|
+
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexStart - 1 : visualColumnIndexEnd;
|
935
|
+
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
936
|
+
if (notHiddenColumnIndex === null) {
|
937
|
+
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
938
|
+
// be processed by the selection Transformer class as a move selection to the previous row (if autoWrapRow is enabled).
|
939
|
+
delta.col = -this.hot.view.countRenderableColumnsInRange(0, highlight.col);
|
940
|
+
} else {
|
941
|
+
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1, 1);
|
942
|
+
}
|
943
|
+
} else if (delta.col > 0) {
|
944
|
+
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexEnd + 1 : visualColumnIndexStart;
|
945
|
+
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
946
|
+
if (notHiddenColumnIndex === null) {
|
947
|
+
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
948
|
+
// be processed by the selection Transformer class as a move selection to the next row (if autoWrapRow is enabled).
|
949
|
+
delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, this.hot.countCols());
|
950
|
+
} else {
|
951
|
+
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1, 1);
|
952
|
+
}
|
923
953
|
}
|
924
|
-
|
925
|
-
|
954
|
+
const visualRowIndexStart = mergedParent.row;
|
955
|
+
const visualRowIndexEnd = mergedParent.row + mergedParent.rowspan - 1;
|
956
|
+
if (delta.row < 0) {
|
957
|
+
const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexStart - 1 : visualRowIndexEnd;
|
958
|
+
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, -1);
|
959
|
+
if (notHiddenRowIndex === null) {
|
960
|
+
// There are no visible rows anymore, so move the selection out of the table edge. This will
|
961
|
+
// be processed by the selection Transformer class as a move selection to the previous column (if autoWrapCol is enabled).
|
962
|
+
delta.row = -this.hot.view.countRenderableRowsInRange(0, highlight.row);
|
963
|
+
} else {
|
964
|
+
delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, highlight.row) - 1, 1);
|
965
|
+
}
|
966
|
+
} else if (delta.row > 0) {
|
967
|
+
const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexEnd + 1 : visualRowIndexStart;
|
968
|
+
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, 1);
|
969
|
+
if (notHiddenRowIndex === null) {
|
970
|
+
// There are no visible rows anymore, so move the selection out of the table edge. This will
|
971
|
+
// be processed by the selection Transformer class as a move selection to the next column (if autoWrapCol is enabled).
|
972
|
+
delta.row = this.hot.view.countRenderableRowsInRange(highlight.row, this.hot.countRows());
|
973
|
+
} else {
|
974
|
+
delta.row = Math.max(this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowIndex) - 1, 1);
|
975
|
+
}
|
926
976
|
}
|
927
977
|
}
|
928
978
|
/**
|
929
|
-
*
|
979
|
+
* The hook allows to modify the delta transformation object necessary for correct selection end transformations.
|
980
|
+
* The logic here handles "jumping over" merged merged cells, while selecting.
|
930
981
|
*
|
931
|
-
* @param {
|
982
|
+
* @param {{ row: number, col: number }} delta The transformation delta.
|
932
983
|
*/
|
933
984
|
function _onModifyTransformEnd(delta) {
|
934
|
-
const
|
935
|
-
const
|
936
|
-
const
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
985
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
986
|
+
const cloneRange = selectedRange.clone();
|
987
|
+
const {
|
988
|
+
to
|
989
|
+
} = selectedRange;
|
990
|
+
const {
|
991
|
+
columnIndexMapper,
|
992
|
+
rowIndexMapper
|
993
|
+
} = this.hot;
|
994
|
+
const expandCloneRange = (row, col) => {
|
995
|
+
cloneRange.expand(this.hot._createCellCoords(row, col));
|
996
|
+
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
997
|
+
cloneRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange());
|
998
|
+
}
|
999
|
+
};
|
1000
|
+
if (delta.col < 0) {
|
1001
|
+
let nextColumn = this.mergedCellsCollection.getStartMostColumnIndex(selectedRange, to.col) + delta.col;
|
1002
|
+
expandCloneRange(to.row, nextColumn);
|
1003
|
+
if (selectedRange.getHorizontalDirection() === 'E-W' && cloneRange.getHorizontalDirection() === 'E-W') {
|
1004
|
+
nextColumn = cloneRange.getTopStartCorner().col;
|
1005
|
+
}
|
1006
|
+
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
1007
|
+
if (notHiddenColumnIndex !== null) {
|
1008
|
+
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, to.col) - 1, 1);
|
1009
|
+
}
|
1010
|
+
} else if (delta.col > 0) {
|
1011
|
+
let nextColumn = this.mergedCellsCollection.getEndMostColumnIndex(selectedRange, to.col) + delta.col;
|
1012
|
+
expandCloneRange(to.row, nextColumn);
|
1013
|
+
if (selectedRange.getHorizontalDirection() === 'W-E' && cloneRange.getHorizontalDirection() === 'W-E') {
|
1014
|
+
nextColumn = cloneRange.getBottomEndCorner().col;
|
1015
|
+
}
|
1016
|
+
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
1017
|
+
if (notHiddenColumnIndex !== null) {
|
1018
|
+
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(to.col, notHiddenColumnIndex) - 1, 1);
|
1019
|
+
}
|
1020
|
+
}
|
1021
|
+
if (delta.row < 0) {
|
1022
|
+
let nextRow = this.mergedCellsCollection.getTopMostRowIndex(selectedRange, to.row) + delta.row;
|
1023
|
+
expandCloneRange(nextRow, to.col);
|
1024
|
+
if (selectedRange.getVerticalDirection() === 'S-N' && cloneRange.getVerticalDirection() === 'S-N') {
|
1025
|
+
nextRow = cloneRange.getTopStartCorner().row;
|
1026
|
+
}
|
1027
|
+
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, 1);
|
1028
|
+
if (notHiddenRowIndex !== null) {
|
1029
|
+
delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, to.row) - 1, 1);
|
1030
|
+
}
|
1031
|
+
} else if (delta.row > 0) {
|
1032
|
+
let nextRow = this.mergedCellsCollection.getBottomMostRowIndex(selectedRange, to.row) + delta.row;
|
1033
|
+
expandCloneRange(nextRow, to.col);
|
1034
|
+
if (selectedRange.getVerticalDirection() === 'N-S' && cloneRange.getVerticalDirection() === 'N-S') {
|
1035
|
+
nextRow = cloneRange.getBottomStartCorner().row;
|
1036
|
+
}
|
1037
|
+
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, -1);
|
1038
|
+
if (notHiddenRowIndex !== null) {
|
1039
|
+
delta.row = Math.max(this.hot.view.countRenderableRowsInRange(to.row, notHiddenRowIndex) - 1, 1);
|
1040
|
+
}
|
1041
|
+
}
|
1042
|
+
}
|
1043
|
+
/**
|
1044
|
+
* The hook corrects the range (before drawing it) after the selection was made on the merged cells.
|
1045
|
+
* It expands the range to cover the entire area of the selected merged cells.
|
1046
|
+
*/
|
1047
|
+
function _onBeforeSelectionHighlightSet() {
|
1048
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
1049
|
+
const {
|
1050
|
+
highlight
|
1051
|
+
} = selectedRange;
|
1052
|
+
if (this.hot.selection.isSelectedByColumnHeader() || this.hot.selection.isSelectedByRowHeader()) {
|
1053
|
+
_classPrivateFieldSet(_lastSelectedFocus, this, highlight.clone());
|
1054
|
+
return;
|
1055
|
+
}
|
1056
|
+
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1057
|
+
selectedRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange(), false);
|
1058
|
+
}
|
1059
|
+
// TODO: This is a workaround for an issue with the selection not being extended properly.
|
1060
|
+
// In some cases when the merge cells are defined in random order the selection is not
|
1061
|
+
// extended in that way that it covers all overlapped merge cells.
|
1062
|
+
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1063
|
+
selectedRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange(), false);
|
1064
|
+
}
|
1065
|
+
const mergedParent = this.mergedCellsCollection.get(highlight.row, highlight.col);
|
1066
|
+
_classPrivateFieldSet(_lastSelectedFocus, this, highlight.clone());
|
1067
|
+
if (mergedParent) {
|
1068
|
+
highlight.assign(mergedParent);
|
1069
|
+
}
|
948
1070
|
}
|
949
1071
|
/**
|
950
1072
|
* `modifyGetCellCoords` hook callback. Swaps the `getCell` coords with the merged parent coords.
|
@@ -1023,51 +1145,104 @@ function _onAfterRenderer(TD, row, col) {
|
|
1023
1145
|
(0, _utils.applySpanProperties)(TD, mergedCellCopy, row, col);
|
1024
1146
|
}
|
1025
1147
|
/**
|
1026
|
-
*
|
1027
|
-
* A selection within merge area should be rewritten to the start of merge area.
|
1028
|
-
*
|
1029
|
-
* @param {object} coords Cell coords.
|
1148
|
+
* Clears the last selected coordinates before setting a new selection range.
|
1030
1149
|
*/
|
1031
|
-
function _onBeforeSetRangeStart(
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1150
|
+
function _onBeforeSetRangeStart() {
|
1151
|
+
_classPrivateFieldSet(_lastSelectedFocus, this, null);
|
1152
|
+
}
|
1153
|
+
/**
|
1154
|
+
* Detects if the last selected cell was a header cell if so update the order list active node for further
|
1155
|
+
* computations.
|
1156
|
+
*/
|
1157
|
+
function _onBeforeSelectionFocusSet() {
|
1158
|
+
if (_classPrivateFieldGet(_lastSelectedFocus, this).isCell()) {
|
1159
|
+
return;
|
1160
|
+
}
|
1161
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
1162
|
+
const verticalDir = selectedRange.getVerticalDirection();
|
1163
|
+
const horizontalDir = selectedRange.getHorizontalDirection();
|
1164
|
+
const focusCoords = _classPrivateFieldGet(_lastSelectedFocus, this).clone().normalize();
|
1165
|
+
_classPrivateFieldGet(_focusOrder, this).setActiveNode(focusCoords.row, focusCoords.col);
|
1166
|
+
if (_classPrivateFieldGet(_lastFocusDelta, this).row > 0 || _classPrivateFieldGet(_lastFocusDelta, this).col > 0) {
|
1167
|
+
_classPrivateFieldGet(_focusOrder, this).setPrevNodeAsActive();
|
1168
|
+
} else if (horizontalDir === 'E-W' && _classPrivateFieldGet(_lastFocusDelta, this).col < 0 || verticalDir === 'S-N' && _classPrivateFieldGet(_lastFocusDelta, this).row < 0) {
|
1169
|
+
_classPrivateFieldGet(_focusOrder, this).setNextNodeAsActive();
|
1040
1170
|
}
|
1041
1171
|
}
|
1042
1172
|
/**
|
1043
|
-
*
|
1044
|
-
* While selecting cells with keyboard or mouse, make sure that rectangular area is expanded to the extent of the
|
1045
|
-
* merged cell.
|
1046
|
-
*
|
1047
|
-
* Note: Please keep in mind that callback may modify both start and end range coordinates by the reference.
|
1173
|
+
* Changes the focus selection to the next or previous cell or merged cell position.
|
1048
1174
|
*
|
1049
|
-
* @param {
|
1175
|
+
* @param {number} row The visual row index.
|
1176
|
+
* @param {number} column The visual column index.
|
1050
1177
|
*/
|
1051
|
-
function
|
1052
|
-
const
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1178
|
+
function _onAfterSelectionFocusSet(row, column) {
|
1179
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
1180
|
+
const {
|
1181
|
+
columnIndexMapper,
|
1182
|
+
rowIndexMapper
|
1183
|
+
} = this.hot;
|
1184
|
+
let notHiddenRowIndex = null;
|
1185
|
+
let notHiddenColumnIndex = null;
|
1186
|
+
if (_classPrivateFieldGet(_lastFocusDelta, this).col < 0) {
|
1187
|
+
const {
|
1188
|
+
rowEnd,
|
1189
|
+
colEnd
|
1190
|
+
} = _classPrivateFieldGet(_focusOrder, this).getPrevHorizontalNode();
|
1191
|
+
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colEnd, -1);
|
1192
|
+
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowEnd, -1);
|
1193
|
+
} else if (_classPrivateFieldGet(_lastFocusDelta, this).col > 0) {
|
1194
|
+
const {
|
1195
|
+
rowStart,
|
1196
|
+
colStart
|
1197
|
+
} = _classPrivateFieldGet(_focusOrder, this).getNextHorizontalNode();
|
1198
|
+
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);
|
1199
|
+
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);
|
1200
|
+
} else if (_classPrivateFieldGet(_lastFocusDelta, this).row < 0) {
|
1201
|
+
const {
|
1202
|
+
rowEnd,
|
1203
|
+
colEnd
|
1204
|
+
} = _classPrivateFieldGet(_focusOrder, this).getPrevVerticalNode();
|
1205
|
+
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colEnd, -1);
|
1206
|
+
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowEnd, -1);
|
1207
|
+
} else if (_classPrivateFieldGet(_lastFocusDelta, this).row > 0) {
|
1208
|
+
const {
|
1209
|
+
rowStart,
|
1210
|
+
colStart
|
1211
|
+
} = _classPrivateFieldGet(_focusOrder, this).getNextVerticalNode();
|
1212
|
+
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);
|
1213
|
+
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);
|
1058
1214
|
}
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1215
|
+
if (notHiddenRowIndex !== null || notHiddenColumnIndex !== null) {
|
1216
|
+
const coords = this.hot._createCellCoords(notHiddenRowIndex, notHiddenColumnIndex);
|
1217
|
+
const mergeParent = this.mergedCellsCollection.get(coords.row, coords.col);
|
1218
|
+
const focusHighlight = this.hot.selection.highlight.getFocus();
|
1219
|
+
row = coords.row;
|
1220
|
+
column = coords.col;
|
1221
|
+
if (mergeParent) {
|
1222
|
+
selectedRange.highlight.assign({
|
1223
|
+
row: this.hot.rowIndexMapper.getNearestNotHiddenIndex(mergeParent.row, 1),
|
1224
|
+
col: this.hot.columnIndexMapper.getNearestNotHiddenIndex(mergeParent.col, 1)
|
1225
|
+
});
|
1226
|
+
} else {
|
1227
|
+
selectedRange.highlight.assign(coords);
|
1069
1228
|
}
|
1070
|
-
|
1229
|
+
focusHighlight.clear();
|
1230
|
+
focusHighlight.add(coords).commit();
|
1231
|
+
}
|
1232
|
+
_classPrivateFieldGet(_focusOrder, this).setActiveNode(row, column);
|
1233
|
+
_classPrivateFieldSet(_lastFocusDelta, this, {
|
1234
|
+
row: 0,
|
1235
|
+
col: 0
|
1236
|
+
});
|
1237
|
+
}
|
1238
|
+
/**
|
1239
|
+
* Creates the horizontal and vertical cells order matrix (linked lists) for focused cell.
|
1240
|
+
*/
|
1241
|
+
function _onAfterSelectionEnd() {
|
1242
|
+
const selection = this.hot.getSelectedRangeLast();
|
1243
|
+
if (!selection.isHeader()) {
|
1244
|
+
_classPrivateFieldGet(_focusOrder, this).buildFocusOrder(this.hot.getSelectedRangeLast());
|
1245
|
+
}
|
1071
1246
|
}
|
1072
1247
|
/**
|
1073
1248
|
* The `afterGetCellMeta` hook callback.
|
@@ -1196,37 +1371,6 @@ function _onBeforeDrawAreaBorders(corners, className) {
|
|
1196
1371
|
});
|
1197
1372
|
}
|
1198
1373
|
}
|
1199
|
-
/**
|
1200
|
-
* `afterModifyTransformStart` hook callback. Fixes a problem with navigating through merged cells at the edges of
|
1201
|
-
* the table with the <kbd>**Enter**</kbd>/<kbd>**Shift**</kbd>+<kbd>**Enter**</kbd>/<kbd>**Tab**</kbd>/<kbd>**Shift**</kbd>+<kbd>**Tab**</kbd> keys.
|
1202
|
-
*
|
1203
|
-
* @param {CellCoords} coords Coordinates of the to-be-selected cell.
|
1204
|
-
* @param {number} rowTransformDir Row transformation direction (negative value = up, 0 = none, positive value =
|
1205
|
-
* down).
|
1206
|
-
* @param {number} colTransformDir Column transformation direction (negative value = up, 0 = none, positive value =
|
1207
|
-
* down).
|
1208
|
-
*/
|
1209
|
-
function _onAfterModifyTransformStart(coords, rowTransformDir, colTransformDir) {
|
1210
|
-
if (!this.enabled) {
|
1211
|
-
return;
|
1212
|
-
}
|
1213
|
-
const mergedCellAtCoords = this.mergedCellsCollection.get(coords.row, coords.col);
|
1214
|
-
if (!mergedCellAtCoords) {
|
1215
|
-
return;
|
1216
|
-
}
|
1217
|
-
const goingDown = rowTransformDir > 0;
|
1218
|
-
const goingUp = rowTransformDir < 0;
|
1219
|
-
const goingLeft = colTransformDir < 0;
|
1220
|
-
const goingRight = colTransformDir > 0;
|
1221
|
-
const mergedCellOnBottomEdge = mergedCellAtCoords.row + mergedCellAtCoords.rowspan - 1 === this.hot.countRows() - 1;
|
1222
|
-
const mergedCellOnTopEdge = mergedCellAtCoords.row === 0;
|
1223
|
-
const mergedCellOnRightEdge = mergedCellAtCoords.col + mergedCellAtCoords.colspan - 1 === this.hot.countCols() - 1;
|
1224
|
-
const mergedCellOnLeftEdge = mergedCellAtCoords.col === 0;
|
1225
|
-
if (goingDown && mergedCellOnBottomEdge || goingUp && mergedCellOnTopEdge || goingRight && mergedCellOnRightEdge || goingLeft && mergedCellOnLeftEdge) {
|
1226
|
-
coords.row = mergedCellAtCoords.row;
|
1227
|
-
coords.col = mergedCellAtCoords.col;
|
1228
|
-
}
|
1229
|
-
}
|
1230
1374
|
/**
|
1231
1375
|
* `afterDrawSelection` hook callback. Used to add the additional class name for the entirely-selected merged cells.
|
1232
1376
|
*
|