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