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