handsontable 0.0.0-next-221e46b-20240307 → 0.0.0-next-2becb78-20240313
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 +1 -0
- 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 +81 -21
- package/core.mjs +81 -21
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +2721 -1361
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +152 -152
- package/dist/handsontable.js +2721 -1361
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +32 -32
- 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 +1 -0
- package/pluginHooks.js +43 -1
- package/pluginHooks.mjs +43 -1
- package/plugins/collapsibleColumns/collapsibleColumns.js +7 -1
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +7 -1
- package/plugins/columnSorting/columnSorting.js +6 -0
- package/plugins/columnSorting/columnSorting.mjs +6 -0
- 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 +327 -0
- package/plugins/mergeCells/focusOrder.mjs +322 -0
- package/plugins/mergeCells/mergeCells.js +392 -197
- package/plugins/mergeCells/mergeCells.mjs +392 -197
- package/plugins/multiColumnSorting/multiColumnSorting.js +6 -0
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +6 -0
- package/plugins/nestedHeaders/nestedHeaders.js +1 -0
- package/plugins/nestedHeaders/nestedHeaders.mjs +1 -0
- package/plugins/nestedRows/nestedRows.js +7 -1
- package/plugins/nestedRows/nestedRows.mjs +7 -1
- package/renderers/checkboxRenderer/checkboxRenderer.js +8 -5
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +8 -5
- package/selection/highlight/visualSelection.js +16 -2
- package/selection/highlight/visualSelection.mjs +16 -2
- package/selection/selection.js +228 -44
- package/selection/selection.mjs +227 -43
- package/selection/transformation.js +86 -32
- package/selection/transformation.mjs +86 -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/tableView.js +20 -0
- package/tableView.mjs +20 -0
- package/utils/dataStructures/linkedList.js +6 -1
- package/utils/dataStructures/linkedList.mjs +6 -1
@@ -26,6 +26,7 @@ import { rangeEach } from "../../helpers/number.mjs";
|
|
26
26
|
import { applySpanProperties } from "./utils.mjs";
|
27
27
|
import { getStyle } from "../../helpers/dom/element.mjs";
|
28
28
|
import { isChrome } from "../../helpers/browser.mjs";
|
29
|
+
import { FocusOrder } from "./focusOrder.mjs";
|
29
30
|
Hooks.getSingleton().register('beforeMergeCells');
|
30
31
|
Hooks.getSingleton().register('afterMergeCells');
|
31
32
|
Hooks.getSingleton().register('beforeUnmergeCells');
|
@@ -71,16 +72,23 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
|
|
71
72
|
* ```
|
72
73
|
* :::
|
73
74
|
*/
|
74
|
-
var
|
75
|
+
var _lastSelectedFocus = /*#__PURE__*/new WeakMap();
|
76
|
+
var _lastDelta = /*#__PURE__*/new WeakMap();
|
77
|
+
var _focusOrder = /*#__PURE__*/new WeakMap();
|
75
78
|
var _onAfterInit = /*#__PURE__*/new WeakSet();
|
76
79
|
var _onAfterIsMultipleSelection = /*#__PURE__*/new WeakSet();
|
80
|
+
var _onModifyTransformFocus = /*#__PURE__*/new WeakSet();
|
77
81
|
var _onModifyTransformStart = /*#__PURE__*/new WeakSet();
|
78
82
|
var _onModifyTransformEnd = /*#__PURE__*/new WeakSet();
|
83
|
+
var _onModifyTransformEndRestDelta = /*#__PURE__*/new WeakSet();
|
84
|
+
var _onBeforeSelectionHighlightSet = /*#__PURE__*/new WeakSet();
|
79
85
|
var _onModifyGetCellCoords = /*#__PURE__*/new WeakSet();
|
80
86
|
var _addMergeActionsToContextMenu = /*#__PURE__*/new WeakSet();
|
81
87
|
var _onAfterRenderer = /*#__PURE__*/new WeakSet();
|
82
88
|
var _onBeforeSetRangeStart = /*#__PURE__*/new WeakSet();
|
83
|
-
var
|
89
|
+
var _onBeforeSelectionFocusSet = /*#__PURE__*/new WeakSet();
|
90
|
+
var _onAfterSelectionFocusSet = /*#__PURE__*/new WeakSet();
|
91
|
+
var _onAfterSelectionEnd = /*#__PURE__*/new WeakSet();
|
84
92
|
var _onAfterGetCellMeta = /*#__PURE__*/new WeakSet();
|
85
93
|
var _onAfterViewportRowCalculatorOverride = /*#__PURE__*/new WeakSet();
|
86
94
|
var _onAfterViewportColumnCalculatorOverride = /*#__PURE__*/new WeakSet();
|
@@ -91,7 +99,6 @@ var _onAfterCreateRow = /*#__PURE__*/new WeakSet();
|
|
91
99
|
var _onAfterRemoveRow = /*#__PURE__*/new WeakSet();
|
92
100
|
var _onAfterChange = /*#__PURE__*/new WeakSet();
|
93
101
|
var _onBeforeDrawAreaBorders = /*#__PURE__*/new WeakSet();
|
94
|
-
var _onAfterModifyTransformStart = /*#__PURE__*/new WeakSet();
|
95
102
|
var _onAfterDrawSelection = /*#__PURE__*/new WeakSet();
|
96
103
|
var _onBeforeRemoveCellClassNames = /*#__PURE__*/new WeakSet();
|
97
104
|
var _onBeforeBeginEditing = /*#__PURE__*/new WeakSet();
|
@@ -127,17 +134,6 @@ export class MergeCells extends BasePlugin {
|
|
127
134
|
* processed cell.
|
128
135
|
*/
|
129
136
|
_classPrivateMethodInitSpec(this, _onAfterDrawSelection);
|
130
|
-
/**
|
131
|
-
* `afterModifyTransformStart` hook callback. Fixes a problem with navigating through merged cells at the edges of
|
132
|
-
* the table with the <kbd>**Enter**</kbd>/<kbd>**Shift**</kbd>+<kbd>**Enter**</kbd>/<kbd>**Tab**</kbd>/<kbd>**Shift**</kbd>+<kbd>**Tab**</kbd> keys.
|
133
|
-
*
|
134
|
-
* @param {CellCoords} coords Coordinates of the to-be-selected cell.
|
135
|
-
* @param {number} rowTransformDir Row transformation direction (negative value = up, 0 = none, positive value =
|
136
|
-
* down).
|
137
|
-
* @param {number} colTransformDir Column transformation direction (negative value = up, 0 = none, positive value =
|
138
|
-
* down).
|
139
|
-
*/
|
140
|
-
_classPrivateMethodInitSpec(this, _onAfterModifyTransformStart);
|
141
137
|
/**
|
142
138
|
* `beforeDrawAreaBorders` hook callback.
|
143
139
|
*
|
@@ -210,20 +206,23 @@ export class MergeCells extends BasePlugin {
|
|
210
206
|
*/
|
211
207
|
_classPrivateMethodInitSpec(this, _onAfterGetCellMeta);
|
212
208
|
/**
|
213
|
-
*
|
214
|
-
* While selecting cells with keyboard or mouse, make sure that rectangular area is expanded to the extent of the
|
215
|
-
* merged cell.
|
216
|
-
*
|
217
|
-
* Note: Please keep in mind that callback may modify both start and end range coordinates by the reference.
|
218
|
-
*
|
219
|
-
* @param {object} coords Cell coords.
|
209
|
+
* Creates the horizontal and vertical cells order matrix (linked lists) for focused cell.
|
220
210
|
*/
|
221
|
-
_classPrivateMethodInitSpec(this,
|
211
|
+
_classPrivateMethodInitSpec(this, _onAfterSelectionEnd);
|
222
212
|
/**
|
223
|
-
*
|
224
|
-
* A selection within merge area should be rewritten to the start of merge area.
|
213
|
+
* Changes the focus selection to the next or previous cell or merged cell position.
|
225
214
|
*
|
226
|
-
* @param {
|
215
|
+
* @param {number} row The visual row index.
|
216
|
+
* @param {number} column The visual column index.
|
217
|
+
*/
|
218
|
+
_classPrivateMethodInitSpec(this, _onAfterSelectionFocusSet);
|
219
|
+
/**
|
220
|
+
* Detects if the last selected cell was a header cell if so update the order list active node for further
|
221
|
+
* computations.
|
222
|
+
*/
|
223
|
+
_classPrivateMethodInitSpec(this, _onBeforeSelectionFocusSet);
|
224
|
+
/**
|
225
|
+
* Clears the last selected coordinates before setting a new selection range.
|
227
226
|
*/
|
228
227
|
_classPrivateMethodInitSpec(this, _onBeforeSetRangeStart);
|
229
228
|
/**
|
@@ -249,9 +248,23 @@ export class MergeCells extends BasePlugin {
|
|
249
248
|
*/
|
250
249
|
_classPrivateMethodInitSpec(this, _onModifyGetCellCoords);
|
251
250
|
/**
|
252
|
-
*
|
251
|
+
* The hook corrects the range (before drawing it) after the selection was made on the merged cells.
|
252
|
+
* It expands the range to cover the entire area of the selected merged cells.
|
253
|
+
*/
|
254
|
+
_classPrivateMethodInitSpec(this, _onBeforeSelectionHighlightSet);
|
255
|
+
/**
|
256
|
+
* The hooks allows to modify the delta transformation object necessary for correct selection end transformations.
|
253
257
|
*
|
254
|
-
* @param {
|
258
|
+
* @param {{ row: number, col: number }} restDelta The transformation delta for the rest of the selection.
|
259
|
+
* @param {{ row: number, col: number }} delta The general transformation delta.
|
260
|
+
* @param {CellCoords} coords The coordinates of the next position of the end selection.
|
261
|
+
*/
|
262
|
+
_classPrivateMethodInitSpec(this, _onModifyTransformEndRestDelta);
|
263
|
+
/**
|
264
|
+
* The hook allows to modify the delta transformation object necessary for correct selection end transformations.
|
265
|
+
* The logic here handles "jumping over" merged merged cells, while selecting.
|
266
|
+
*
|
267
|
+
* @param {{ row: number, col: number }} delta The transformation delta.
|
255
268
|
*/
|
256
269
|
_classPrivateMethodInitSpec(this, _onModifyTransformEnd);
|
257
270
|
/**
|
@@ -260,6 +273,12 @@ export class MergeCells extends BasePlugin {
|
|
260
273
|
* @param {object} delta The transformation delta.
|
261
274
|
*/
|
262
275
|
_classPrivateMethodInitSpec(this, _onModifyTransformStart);
|
276
|
+
/**
|
277
|
+
* `modifyTransformFocus` hook callback.
|
278
|
+
*
|
279
|
+
* @param {object} delta The transformation delta.
|
280
|
+
*/
|
281
|
+
_classPrivateMethodInitSpec(this, _onModifyTransformFocus);
|
263
282
|
/**
|
264
283
|
* Modifies the information on whether the current selection contains multiple cells. The `afterIsMultipleSelection`
|
265
284
|
* hook callback.
|
@@ -294,12 +313,41 @@ export class MergeCells extends BasePlugin {
|
|
294
313
|
*/
|
295
314
|
_defineProperty(this, "selectionCalculations", null);
|
296
315
|
/**
|
316
|
+
* The holder for the last selected focus coordinates. This allows keeping the correct coordinates in cases after the
|
317
|
+
* focus is moved out of the merged cell.
|
318
|
+
*
|
297
319
|
* @type {CellCoords}
|
298
320
|
*/
|
299
|
-
_classPrivateFieldInitSpec(this,
|
321
|
+
_classPrivateFieldInitSpec(this, _lastSelectedFocus, {
|
300
322
|
writable: true,
|
301
323
|
value: null
|
302
324
|
});
|
325
|
+
/**
|
326
|
+
* The last used transformation delta.
|
327
|
+
*
|
328
|
+
* @type {{ row: number, col: number }}
|
329
|
+
*/
|
330
|
+
_classPrivateFieldInitSpec(this, _lastDelta, {
|
331
|
+
writable: true,
|
332
|
+
value: {
|
333
|
+
row: 0,
|
334
|
+
col: 0
|
335
|
+
}
|
336
|
+
});
|
337
|
+
/**
|
338
|
+
* The module responsible for providing the correct focus order (vertical and horizontal) within a selection that
|
339
|
+
* contains merged cells.
|
340
|
+
*
|
341
|
+
* @type {FocusOrder}
|
342
|
+
*/
|
343
|
+
_classPrivateFieldInitSpec(this, _focusOrder, {
|
344
|
+
writable: true,
|
345
|
+
value: new FocusOrder({
|
346
|
+
mergedCellsGetter: (row, column) => this.mergedCellsCollection.get(row, column),
|
347
|
+
rowIndexMapper: this.hot.rowIndexMapper,
|
348
|
+
columnIndexMapper: this.hot.columnIndexMapper
|
349
|
+
})
|
350
|
+
});
|
303
351
|
}
|
304
352
|
static get PLUGIN_KEY() {
|
305
353
|
return PLUGIN_KEY;
|
@@ -334,17 +382,17 @@ export class MergeCells extends BasePlugin {
|
|
334
382
|
}
|
335
383
|
return _classPrivateMethodGet(_this, _onAfterInit, _onAfterInit2).call(_this, ...args);
|
336
384
|
});
|
337
|
-
this.addHook('
|
385
|
+
this.addHook('modifyTransformFocus', function () {
|
338
386
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
339
387
|
args[_key2] = arguments[_key2];
|
340
388
|
}
|
341
|
-
return _classPrivateMethodGet(_this,
|
389
|
+
return _classPrivateMethodGet(_this, _onModifyTransformFocus, _onModifyTransformFocus2).call(_this, ...args);
|
342
390
|
});
|
343
|
-
this.addHook('
|
391
|
+
this.addHook('modifyTransformStart', function () {
|
344
392
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
345
393
|
args[_key3] = arguments[_key3];
|
346
394
|
}
|
347
|
-
return _classPrivateMethodGet(_this,
|
395
|
+
return _classPrivateMethodGet(_this, _onModifyTransformStart, _onModifyTransformStart2).call(_this, ...args);
|
348
396
|
});
|
349
397
|
this.addHook('modifyTransformEnd', function () {
|
350
398
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
@@ -352,124 +400,148 @@ export class MergeCells extends BasePlugin {
|
|
352
400
|
}
|
353
401
|
return _classPrivateMethodGet(_this, _onModifyTransformEnd, _onModifyTransformEnd2).call(_this, ...args);
|
354
402
|
});
|
355
|
-
this.addHook('
|
403
|
+
this.addHook('modifyTransformEndRestDelta', function () {
|
356
404
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
357
405
|
args[_key5] = arguments[_key5];
|
358
406
|
}
|
359
|
-
return _classPrivateMethodGet(_this,
|
407
|
+
return _classPrivateMethodGet(_this, _onModifyTransformEndRestDelta, _onModifyTransformEndRestDelta2).call(_this, ...args);
|
360
408
|
});
|
361
|
-
this.addHook('
|
409
|
+
this.addHook('beforeSelectionHighlightSet', function () {
|
362
410
|
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
363
411
|
args[_key6] = arguments[_key6];
|
364
412
|
}
|
365
|
-
return _classPrivateMethodGet(_this,
|
413
|
+
return _classPrivateMethodGet(_this, _onBeforeSelectionHighlightSet, _onBeforeSelectionHighlightSet2).call(_this, ...args);
|
366
414
|
});
|
367
|
-
this.addHook('
|
415
|
+
this.addHook('beforeSetRangeStart', function () {
|
368
416
|
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
369
417
|
args[_key7] = arguments[_key7];
|
370
418
|
}
|
371
419
|
return _classPrivateMethodGet(_this, _onBeforeSetRangeStart, _onBeforeSetRangeStart2).call(_this, ...args);
|
372
420
|
});
|
373
|
-
this.addHook('
|
421
|
+
this.addHook('beforeSetRangeStartOnly', function () {
|
374
422
|
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
375
423
|
args[_key8] = arguments[_key8];
|
376
424
|
}
|
377
|
-
return _classPrivateMethodGet(_this,
|
425
|
+
return _classPrivateMethodGet(_this, _onBeforeSetRangeStart, _onBeforeSetRangeStart2).call(_this, ...args);
|
378
426
|
});
|
379
|
-
this.addHook('
|
427
|
+
this.addHook('beforeSelectionFocusSet', function () {
|
380
428
|
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
381
429
|
args[_key9] = arguments[_key9];
|
382
430
|
}
|
383
|
-
return _classPrivateMethodGet(_this,
|
431
|
+
return _classPrivateMethodGet(_this, _onBeforeSelectionFocusSet, _onBeforeSelectionFocusSet2).call(_this, ...args);
|
384
432
|
});
|
385
|
-
this.addHook('
|
433
|
+
this.addHook('afterSelectionFocusSet', function () {
|
386
434
|
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
387
435
|
args[_key10] = arguments[_key10];
|
388
436
|
}
|
389
|
-
return _classPrivateMethodGet(_this,
|
437
|
+
return _classPrivateMethodGet(_this, _onAfterSelectionFocusSet, _onAfterSelectionFocusSet2).call(_this, ...args);
|
390
438
|
});
|
391
|
-
this.addHook('
|
439
|
+
this.addHook('afterSelectionEnd', function () {
|
392
440
|
for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
|
393
441
|
args[_key11] = arguments[_key11];
|
394
442
|
}
|
395
|
-
return _classPrivateMethodGet(_this,
|
443
|
+
return _classPrivateMethodGet(_this, _onAfterSelectionEnd, _onAfterSelectionEnd2).call(_this, ...args);
|
396
444
|
});
|
397
|
-
this.addHook('
|
445
|
+
this.addHook('modifyGetCellCoords', function () {
|
398
446
|
for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
|
399
447
|
args[_key12] = arguments[_key12];
|
400
448
|
}
|
401
|
-
return _classPrivateMethodGet(_this,
|
449
|
+
return _classPrivateMethodGet(_this, _onModifyGetCellCoords, _onModifyGetCellCoords2).call(_this, ...args);
|
402
450
|
});
|
403
|
-
this.addHook('
|
451
|
+
this.addHook('afterIsMultipleSelection', function () {
|
404
452
|
for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
|
405
453
|
args[_key13] = arguments[_key13];
|
406
454
|
}
|
407
|
-
return _classPrivateMethodGet(_this,
|
455
|
+
return _classPrivateMethodGet(_this, _onAfterIsMultipleSelection, _onAfterIsMultipleSelection2).call(_this, ...args);
|
408
456
|
});
|
409
|
-
this.addHook('
|
457
|
+
this.addHook('afterRenderer', function () {
|
410
458
|
for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
|
411
459
|
args[_key14] = arguments[_key14];
|
412
460
|
}
|
413
|
-
return _classPrivateMethodGet(_this,
|
461
|
+
return _classPrivateMethodGet(_this, _onAfterRenderer, _onAfterRenderer2).call(_this, ...args);
|
414
462
|
});
|
415
|
-
this.addHook('
|
463
|
+
this.addHook('afterContextMenuDefaultOptions', function () {
|
416
464
|
for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
|
417
465
|
args[_key15] = arguments[_key15];
|
418
466
|
}
|
419
|
-
return _classPrivateMethodGet(_this,
|
467
|
+
return _classPrivateMethodGet(_this, _addMergeActionsToContextMenu, _addMergeActionsToContextMenu2).call(_this, ...args);
|
420
468
|
});
|
421
|
-
this.addHook('
|
469
|
+
this.addHook('afterGetCellMeta', function () {
|
422
470
|
for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {
|
423
471
|
args[_key16] = arguments[_key16];
|
424
472
|
}
|
425
|
-
return _classPrivateMethodGet(_this,
|
473
|
+
return _classPrivateMethodGet(_this, _onAfterGetCellMeta, _onAfterGetCellMeta2).call(_this, ...args);
|
426
474
|
});
|
427
|
-
this.addHook('
|
475
|
+
this.addHook('afterViewportRowCalculatorOverride', function () {
|
428
476
|
for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {
|
429
477
|
args[_key17] = arguments[_key17];
|
430
478
|
}
|
431
|
-
return _classPrivateMethodGet(_this,
|
479
|
+
return _classPrivateMethodGet(_this, _onAfterViewportRowCalculatorOverride, _onAfterViewportRowCalculatorOverride2).call(_this, ...args);
|
432
480
|
});
|
433
|
-
this.addHook('
|
481
|
+
this.addHook('afterViewportColumnCalculatorOverride', function () {
|
434
482
|
for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {
|
435
483
|
args[_key18] = arguments[_key18];
|
436
484
|
}
|
437
|
-
return _classPrivateMethodGet(_this,
|
485
|
+
return _classPrivateMethodGet(_this, _onAfterViewportColumnCalculatorOverride, _onAfterViewportColumnCalculatorOverride2).call(_this, ...args);
|
438
486
|
});
|
439
|
-
this.addHook('
|
487
|
+
this.addHook('modifyAutofillRange', function () {
|
440
488
|
for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {
|
441
489
|
args[_key19] = arguments[_key19];
|
442
490
|
}
|
443
|
-
return _classPrivateMethodGet(_this,
|
491
|
+
return _classPrivateMethodGet(_this, _onModifyAutofillRange, _onModifyAutofillRange2).call(_this, ...args);
|
444
492
|
});
|
445
|
-
this.addHook('
|
493
|
+
this.addHook('afterCreateCol', function () {
|
446
494
|
for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {
|
447
495
|
args[_key20] = arguments[_key20];
|
448
496
|
}
|
449
|
-
return _classPrivateMethodGet(_this,
|
497
|
+
return _classPrivateMethodGet(_this, _onAfterCreateCol, _onAfterCreateCol2).call(_this, ...args);
|
450
498
|
});
|
451
|
-
this.addHook('
|
499
|
+
this.addHook('afterRemoveCol', function () {
|
452
500
|
for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {
|
453
501
|
args[_key21] = arguments[_key21];
|
454
502
|
}
|
455
|
-
return _classPrivateMethodGet(_this,
|
503
|
+
return _classPrivateMethodGet(_this, _onAfterRemoveCol, _onAfterRemoveCol2).call(_this, ...args);
|
456
504
|
});
|
457
|
-
this.addHook('
|
505
|
+
this.addHook('afterCreateRow', function () {
|
458
506
|
for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {
|
459
507
|
args[_key22] = arguments[_key22];
|
460
508
|
}
|
461
|
-
return _classPrivateMethodGet(_this,
|
509
|
+
return _classPrivateMethodGet(_this, _onAfterCreateRow, _onAfterCreateRow2).call(_this, ...args);
|
462
510
|
});
|
463
|
-
this.addHook('
|
511
|
+
this.addHook('afterRemoveRow', function () {
|
464
512
|
for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {
|
465
513
|
args[_key23] = arguments[_key23];
|
466
514
|
}
|
467
|
-
return _classPrivateMethodGet(_this,
|
515
|
+
return _classPrivateMethodGet(_this, _onAfterRemoveRow, _onAfterRemoveRow2).call(_this, ...args);
|
468
516
|
});
|
469
|
-
this.addHook('
|
517
|
+
this.addHook('afterChange', function () {
|
470
518
|
for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {
|
471
519
|
args[_key24] = arguments[_key24];
|
472
520
|
}
|
521
|
+
return _classPrivateMethodGet(_this, _onAfterChange, _onAfterChange2).call(_this, ...args);
|
522
|
+
});
|
523
|
+
this.addHook('beforeDrawBorders', function () {
|
524
|
+
for (var _len25 = arguments.length, args = new Array(_len25), _key25 = 0; _key25 < _len25; _key25++) {
|
525
|
+
args[_key25] = arguments[_key25];
|
526
|
+
}
|
527
|
+
return _classPrivateMethodGet(_this, _onBeforeDrawAreaBorders, _onBeforeDrawAreaBorders2).call(_this, ...args);
|
528
|
+
});
|
529
|
+
this.addHook('afterDrawSelection', function () {
|
530
|
+
for (var _len26 = arguments.length, args = new Array(_len26), _key26 = 0; _key26 < _len26; _key26++) {
|
531
|
+
args[_key26] = arguments[_key26];
|
532
|
+
}
|
533
|
+
return _classPrivateMethodGet(_this, _onAfterDrawSelection, _onAfterDrawSelection2).call(_this, ...args);
|
534
|
+
});
|
535
|
+
this.addHook('beforeRemoveCellClassNames', function () {
|
536
|
+
for (var _len27 = arguments.length, args = new Array(_len27), _key27 = 0; _key27 < _len27; _key27++) {
|
537
|
+
args[_key27] = arguments[_key27];
|
538
|
+
}
|
539
|
+
return _classPrivateMethodGet(_this, _onBeforeRemoveCellClassNames, _onBeforeRemoveCellClassNames2).call(_this, ...args);
|
540
|
+
});
|
541
|
+
this.addHook('beforeBeginEditing', function () {
|
542
|
+
for (var _len28 = arguments.length, args = new Array(_len28), _key28 = 0; _key28 < _len28; _key28++) {
|
543
|
+
args[_key28] = arguments[_key28];
|
544
|
+
}
|
473
545
|
return _classPrivateMethodGet(_this, _onBeforeBeginEditing, _onBeforeBeginEditing2).call(_this, ...args);
|
474
546
|
});
|
475
547
|
this.addHook('beforeUndoStackChange', (action, source) => {
|
@@ -638,25 +710,6 @@ export class MergeCells extends BasePlugin {
|
|
638
710
|
return auto ? true : this.validateSetting(newMergedCellInfo);
|
639
711
|
}
|
640
712
|
|
641
|
-
/**
|
642
|
-
* Merge or unmerge, based on last selected range.
|
643
|
-
*
|
644
|
-
* @private
|
645
|
-
*/
|
646
|
-
toggleMergeOnSelection() {
|
647
|
-
const currentRange = this.hot.getSelectedRangeLast();
|
648
|
-
if (!currentRange) {
|
649
|
-
return;
|
650
|
-
}
|
651
|
-
currentRange.setDirection(this.hot.isRtl() ? 'NE-SW' : 'NW-SE');
|
652
|
-
const {
|
653
|
-
from,
|
654
|
-
to
|
655
|
-
} = currentRange;
|
656
|
-
this.toggleMerge(currentRange);
|
657
|
-
this.hot.selectCell(from.row, from.col, to.row, to.col, false);
|
658
|
-
}
|
659
|
-
|
660
713
|
/**
|
661
714
|
* Merges the selection provided as a cell range.
|
662
715
|
*
|
@@ -1026,84 +1079,198 @@ function _onAfterIsMultipleSelection2(isMultiple) {
|
|
1026
1079
|
if (isMultiple) {
|
1027
1080
|
const mergedCells = this.mergedCellsCollection.mergedCells;
|
1028
1081
|
const selectionRange = this.hot.getSelectedRangeLast();
|
1082
|
+
const topStartCoords = selectionRange.getTopStartCorner();
|
1083
|
+
const bottomEndCoords = selectionRange.getBottomEndCorner();
|
1029
1084
|
for (let group = 0; group < mergedCells.length; group += 1) {
|
1030
|
-
if (
|
1085
|
+
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) {
|
1031
1086
|
return false;
|
1032
1087
|
}
|
1033
1088
|
}
|
1034
1089
|
}
|
1035
1090
|
return isMultiple;
|
1036
1091
|
}
|
1092
|
+
function _onModifyTransformFocus2(delta) {
|
1093
|
+
_classPrivateFieldGet(this, _lastDelta).row = delta.row;
|
1094
|
+
_classPrivateFieldGet(this, _lastDelta).col = delta.col;
|
1095
|
+
}
|
1037
1096
|
function _onModifyTransformStart2(delta) {
|
1038
|
-
const
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1097
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
1098
|
+
const {
|
1099
|
+
highlight
|
1100
|
+
} = selectedRange;
|
1101
|
+
const {
|
1102
|
+
columnIndexMapper,
|
1103
|
+
rowIndexMapper
|
1104
|
+
} = this.hot;
|
1105
|
+
if (_classPrivateFieldGet(this, _lastSelectedFocus)) {
|
1106
|
+
if (rowIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(this, _lastSelectedFocus).row) !== null) {
|
1107
|
+
highlight.row = _classPrivateFieldGet(this, _lastSelectedFocus).row;
|
1108
|
+
}
|
1109
|
+
if (columnIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(this, _lastSelectedFocus).col) !== null) {
|
1110
|
+
highlight.col = _classPrivateFieldGet(this, _lastSelectedFocus).col;
|
1111
|
+
}
|
1112
|
+
_classPrivateFieldSet(this, _lastSelectedFocus, null);
|
1113
|
+
}
|
1114
|
+
const mergedParent = this.mergedCellsCollection.get(highlight.row, highlight.col);
|
1115
|
+
if (!mergedParent) {
|
1116
|
+
return;
|
1117
|
+
}
|
1118
|
+
const visualColumnIndexStart = mergedParent.col;
|
1119
|
+
const visualColumnIndexEnd = mergedParent.col + mergedParent.colspan - 1;
|
1120
|
+
if (delta.col < 0) {
|
1121
|
+
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexStart - 1 : visualColumnIndexEnd;
|
1122
|
+
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
1123
|
+
if (notHiddenColumnIndex === null) {
|
1124
|
+
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
1125
|
+
// be processed by the selection Transformer class as a move selection to the previous row (if autoWrapRow is enabled).
|
1126
|
+
delta.col = -this.hot.view.countRenderableColumnsInRange(0, highlight.col);
|
1127
|
+
} else {
|
1128
|
+
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1, 1);
|
1129
|
+
}
|
1130
|
+
} else if (delta.col > 0) {
|
1131
|
+
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexEnd + 1 : visualColumnIndexStart;
|
1132
|
+
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
1133
|
+
if (notHiddenColumnIndex === null) {
|
1134
|
+
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
1135
|
+
// be processed by the selection Transformer class as a move selection to the next row (if autoWrapRow is enabled).
|
1136
|
+
delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, this.hot.countCols());
|
1137
|
+
} else {
|
1138
|
+
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1, 1);
|
1139
|
+
}
|
1140
|
+
}
|
1141
|
+
const visualRowIndexStart = mergedParent.row;
|
1142
|
+
const visualRowIndexEnd = mergedParent.row + mergedParent.rowspan - 1;
|
1143
|
+
if (delta.row < 0) {
|
1144
|
+
const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexStart - 1 : visualRowIndexEnd;
|
1145
|
+
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, -1);
|
1146
|
+
if (notHiddenRowIndex === null) {
|
1147
|
+
// There are no visible rows anymore, so move the selection out of the table edge. This will
|
1148
|
+
// be processed by the selection Transformer class as a move selection to the previous column (if autoWrapCol is enabled).
|
1149
|
+
delta.row = -this.hot.view.countRenderableRowsInRange(0, highlight.row);
|
1150
|
+
} else {
|
1151
|
+
delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, highlight.row) - 1, 1);
|
1152
|
+
}
|
1153
|
+
} else if (delta.row > 0) {
|
1154
|
+
const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexEnd + 1 : visualRowIndexStart;
|
1155
|
+
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, 1);
|
1156
|
+
if (notHiddenRowIndex === null) {
|
1157
|
+
// There are no visible rows anymore, so move the selection out of the table edge. This will
|
1158
|
+
// be processed by the selection Transformer class as a move selection to the next column (if autoWrapCol is enabled).
|
1159
|
+
delta.row = this.hot.view.countRenderableRowsInRange(highlight.row, this.hot.countRows());
|
1160
|
+
} else {
|
1161
|
+
delta.row = Math.max(this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowIndex) - 1, 1);
|
1162
|
+
}
|
1163
|
+
}
|
1164
|
+
}
|
1165
|
+
function _onModifyTransformEnd2(delta) {
|
1166
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
1167
|
+
const cloneRange = selectedRange.clone();
|
1168
|
+
const {
|
1169
|
+
to
|
1170
|
+
} = selectedRange;
|
1171
|
+
const {
|
1172
|
+
columnIndexMapper,
|
1173
|
+
rowIndexMapper
|
1174
|
+
} = this.hot;
|
1175
|
+
const expandCloneRange = (row, col) => {
|
1176
|
+
cloneRange.expand(this.hot._createCellCoords(row, col));
|
1177
|
+
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1178
|
+
cloneRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange());
|
1179
|
+
}
|
1042
1180
|
};
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1181
|
+
if (delta.col < 0) {
|
1182
|
+
let nextColumn = this.mergedCellsCollection.getStartMostColumnIndex(selectedRange, to.col) + delta.col;
|
1183
|
+
expandCloneRange(to.row, nextColumn);
|
1184
|
+
if (selectedRange.getHorizontalDirection() === 'E-W' && cloneRange.getHorizontalDirection() === 'E-W') {
|
1185
|
+
nextColumn = cloneRange.getTopStartCorner().col;
|
1186
|
+
}
|
1187
|
+
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
1188
|
+
if (notHiddenColumnIndex !== null) {
|
1189
|
+
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, to.col) - 1, 1);
|
1190
|
+
}
|
1191
|
+
} else if (delta.col > 0) {
|
1192
|
+
let nextColumn = this.mergedCellsCollection.getEndMostColumnIndex(selectedRange, to.col) + delta.col;
|
1193
|
+
expandCloneRange(to.row, nextColumn);
|
1194
|
+
if (selectedRange.getHorizontalDirection() === 'W-E' && cloneRange.getHorizontalDirection() === 'W-E') {
|
1195
|
+
nextColumn = cloneRange.getBottomEndCorner().col;
|
1196
|
+
}
|
1197
|
+
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
1198
|
+
if (notHiddenColumnIndex !== null) {
|
1199
|
+
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(to.col, notHiddenColumnIndex) - 1, 1);
|
1200
|
+
}
|
1048
1201
|
}
|
1049
|
-
if (
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1202
|
+
if (delta.row < 0) {
|
1203
|
+
let nextRow = this.mergedCellsCollection.getTopMostRowIndex(selectedRange, to.row) + delta.row;
|
1204
|
+
expandCloneRange(nextRow, to.col);
|
1205
|
+
if (selectedRange.getVerticalDirection() === 'S-N' && cloneRange.getVerticalDirection() === 'S-N') {
|
1206
|
+
nextRow = cloneRange.getTopStartCorner().row;
|
1207
|
+
}
|
1208
|
+
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, 1);
|
1209
|
+
if (notHiddenRowIndex !== null) {
|
1210
|
+
delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, to.row) - 1, 1);
|
1056
1211
|
}
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
} else if (delta.row < 0) {
|
1063
|
-
// moving up
|
1064
|
-
newDelta.row = currentPosition.row - mergedParent.row + delta.row;
|
1212
|
+
} else if (delta.row > 0) {
|
1213
|
+
let nextRow = this.mergedCellsCollection.getBottomMostRowIndex(selectedRange, to.row) + delta.row;
|
1214
|
+
expandCloneRange(nextRow, to.col);
|
1215
|
+
if (selectedRange.getVerticalDirection() === 'N-S' && cloneRange.getVerticalDirection() === 'N-S') {
|
1216
|
+
nextRow = cloneRange.getBottomStartCorner().row;
|
1065
1217
|
}
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
} else if (delta.col < 0) {
|
1070
|
-
// moving left
|
1071
|
-
newDelta.col = currentPosition.col - mergedParent.col + delta.col;
|
1218
|
+
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, -1);
|
1219
|
+
if (notHiddenRowIndex !== null) {
|
1220
|
+
delta.row = Math.max(this.hot.view.countRenderableRowsInRange(to.row, notHiddenRowIndex) - 1, 1);
|
1072
1221
|
}
|
1073
1222
|
}
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
};
|
1223
|
+
}
|
1224
|
+
function _onModifyTransformEndRestDelta2(restDelta, delta, coords) {
|
1225
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
1226
|
+
const {
|
1227
|
+
highlight
|
1228
|
+
} = selectedRange;
|
1229
|
+
const mergeParent = this.mergedCellsCollection.get(highlight.row, highlight.col);
|
1230
|
+
if (!mergeParent) {
|
1231
|
+
return;
|
1084
1232
|
}
|
1085
|
-
|
1086
|
-
|
1233
|
+
const topStartCorner = selectedRange.getTopStartCorner();
|
1234
|
+
const topEndCorner = selectedRange.getTopEndCorner();
|
1235
|
+
const bottomEndCorner = selectedRange.getBottomEndCorner();
|
1236
|
+
if (delta.col > 0) {
|
1237
|
+
const renderableColumns = this.hot.view.countRenderableColumnsInRange(topEndCorner.col, coords.col) - 1;
|
1238
|
+
restDelta.col = Math.max(renderableColumns, 1);
|
1239
|
+
} else if (delta.col < 0) {
|
1240
|
+
const renderableColumns = this.hot.view.countRenderableColumnsInRange(coords.col, topStartCorner.col) - 1;
|
1241
|
+
restDelta.col = -Math.max(renderableColumns, 1);
|
1087
1242
|
}
|
1088
|
-
if (
|
1089
|
-
|
1243
|
+
if (delta.row > 0) {
|
1244
|
+
const renderableRows = this.hot.view.countRenderableRowsInRange(bottomEndCorner.row, coords.row) - 1;
|
1245
|
+
restDelta.row = Math.max(renderableRows, 1);
|
1246
|
+
} else if (delta.row < 0) {
|
1247
|
+
const renderableRows = this.hot.view.countRenderableRowsInRange(coords.row, topStartCorner.row) - 1;
|
1248
|
+
restDelta.row = -Math.max(renderableRows, 1);
|
1090
1249
|
}
|
1091
1250
|
}
|
1092
|
-
function
|
1093
|
-
const
|
1094
|
-
const
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1251
|
+
function _onBeforeSelectionHighlightSet2() {
|
1252
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
1253
|
+
const {
|
1254
|
+
highlight
|
1255
|
+
} = selectedRange;
|
1256
|
+
if (this.hot.selection.isSelectedByColumnHeader() || this.hot.selection.isSelectedByRowHeader()) {
|
1257
|
+
_classPrivateFieldSet(this, _lastSelectedFocus, highlight.clone());
|
1258
|
+
return;
|
1259
|
+
}
|
1260
|
+
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1261
|
+
selectedRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange(), false);
|
1262
|
+
}
|
1263
|
+
// TODO: This is a workaround for an issue with the selection not being extended properly.
|
1264
|
+
// In some cases when the merge cells are defined in random order the selection is not
|
1265
|
+
// extended in that way that it covers all overlapped merge cells.
|
1266
|
+
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1267
|
+
selectedRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange(), false);
|
1268
|
+
}
|
1269
|
+
const mergedParent = this.mergedCellsCollection.get(highlight.row, highlight.col);
|
1270
|
+
_classPrivateFieldSet(this, _lastSelectedFocus, highlight.clone());
|
1271
|
+
if (mergedParent) {
|
1272
|
+
highlight.assign(mergedParent);
|
1273
|
+
}
|
1107
1274
|
}
|
1108
1275
|
function _onModifyGetCellCoords2(row, column) {
|
1109
1276
|
if (row < 0 || column < 0) {
|
@@ -1162,37 +1329,86 @@ function _onAfterRenderer2(TD, row, col) {
|
|
1162
1329
|
}
|
1163
1330
|
applySpanProperties(TD, mergedCellCopy, row, col);
|
1164
1331
|
}
|
1165
|
-
function _onBeforeSetRangeStart2(
|
1166
|
-
|
1167
|
-
// could set start point of the selection to the start of the merge area. However, logic inside `expandByRange` need
|
1168
|
-
// an initial start point. Click on the merge cell when there are some hidden indexes break the logic in some cases.
|
1169
|
-
// Please take a look at #7010 for more information. I'm not sure if selection directions are calculated properly
|
1170
|
-
// and what was idea for flipping direction inside `expandByRange` method.
|
1171
|
-
if (this.mergedCellsCollection.isFirstRenderableMergedCell(coords.row, coords.col)) {
|
1172
|
-
const mergeParent = this.mergedCellsCollection.get(coords.row, coords.col);
|
1173
|
-
[coords.row, coords.col] = [mergeParent.row, mergeParent.col];
|
1174
|
-
}
|
1332
|
+
function _onBeforeSetRangeStart2() {
|
1333
|
+
_classPrivateFieldSet(this, _lastSelectedFocus, null);
|
1175
1334
|
}
|
1176
|
-
function
|
1177
|
-
|
1178
|
-
selRange.highlight = this.hot._createCellCoords(selRange.highlight.row, selRange.highlight.col); // clone in case we will modify its reference
|
1179
|
-
selRange.to = coords;
|
1180
|
-
let rangeExpanded = false;
|
1181
|
-
if (this.hot.selection.isSelectedByColumnHeader() || this.hot.selection.isSelectedByRowHeader()) {
|
1335
|
+
function _onBeforeSelectionFocusSet2() {
|
1336
|
+
if (_classPrivateFieldGet(this, _lastSelectedFocus).isCell()) {
|
1182
1337
|
return;
|
1183
1338
|
}
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1339
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
1340
|
+
const verticalDir = selectedRange.getVerticalDirection();
|
1341
|
+
const horizontalDir = selectedRange.getHorizontalDirection();
|
1342
|
+
const focusCoords = _classPrivateFieldGet(this, _lastSelectedFocus).clone().normalize();
|
1343
|
+
_classPrivateFieldGet(this, _focusOrder).setActiveNode(focusCoords.row, focusCoords.col);
|
1344
|
+
if (_classPrivateFieldGet(this, _lastDelta).row > 0 || _classPrivateFieldGet(this, _lastDelta).col > 0) {
|
1345
|
+
_classPrivateFieldGet(this, _focusOrder).setPrevNodeAsActive();
|
1346
|
+
} else if (horizontalDir === 'E-W' && _classPrivateFieldGet(this, _lastDelta).col < 0 || verticalDir === 'S-N' && _classPrivateFieldGet(this, _lastDelta).row < 0) {
|
1347
|
+
_classPrivateFieldGet(this, _focusOrder).setNextNodeAsActive();
|
1348
|
+
}
|
1349
|
+
}
|
1350
|
+
function _onAfterSelectionFocusSet2(row, column) {
|
1351
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
1352
|
+
const {
|
1353
|
+
columnIndexMapper,
|
1354
|
+
rowIndexMapper
|
1355
|
+
} = this.hot;
|
1356
|
+
let notHiddenRowIndex = null;
|
1357
|
+
let notHiddenColumnIndex = null;
|
1358
|
+
if (_classPrivateFieldGet(this, _lastDelta).col < 0) {
|
1359
|
+
const {
|
1360
|
+
rowEnd,
|
1361
|
+
colEnd
|
1362
|
+
} = _classPrivateFieldGet(this, _focusOrder).getPrevHorizontalNode();
|
1363
|
+
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colEnd, -1);
|
1364
|
+
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowEnd, -1);
|
1365
|
+
} else if (_classPrivateFieldGet(this, _lastDelta).col > 0) {
|
1366
|
+
const {
|
1367
|
+
rowStart,
|
1368
|
+
colStart
|
1369
|
+
} = _classPrivateFieldGet(this, _focusOrder).getNextHorizontalNode();
|
1370
|
+
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);
|
1371
|
+
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);
|
1372
|
+
} else if (_classPrivateFieldGet(this, _lastDelta).row < 0) {
|
1373
|
+
const {
|
1374
|
+
rowEnd,
|
1375
|
+
colEnd
|
1376
|
+
} = _classPrivateFieldGet(this, _focusOrder).getPrevVerticalNode();
|
1377
|
+
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colEnd, -1);
|
1378
|
+
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowEnd, -1);
|
1379
|
+
} else if (_classPrivateFieldGet(this, _lastDelta).row > 0) {
|
1380
|
+
const {
|
1381
|
+
rowStart,
|
1382
|
+
colStart
|
1383
|
+
} = _classPrivateFieldGet(this, _focusOrder).getNextVerticalNode();
|
1384
|
+
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);
|
1385
|
+
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);
|
1386
|
+
}
|
1387
|
+
if (notHiddenRowIndex !== null || notHiddenColumnIndex !== null) {
|
1388
|
+
const coords = this.hot._createCellCoords(notHiddenRowIndex, notHiddenColumnIndex);
|
1389
|
+
const mergeParent = this.mergedCellsCollection.get(coords.row, coords.col);
|
1390
|
+
const focusHighlight = this.hot.selection.highlight.getFocus();
|
1391
|
+
row = coords.row;
|
1392
|
+
column = coords.col;
|
1393
|
+
if (mergeParent) {
|
1394
|
+
selectedRange.highlight.assign(mergeParent);
|
1395
|
+
} else {
|
1396
|
+
selectedRange.highlight.assign(coords);
|
1194
1397
|
}
|
1195
|
-
|
1398
|
+
focusHighlight.clear();
|
1399
|
+
focusHighlight.add(coords).commit();
|
1400
|
+
}
|
1401
|
+
_classPrivateFieldGet(this, _focusOrder).setActiveNode(row, column);
|
1402
|
+
_classPrivateFieldSet(this, _lastDelta, {
|
1403
|
+
row: 0,
|
1404
|
+
col: 0
|
1405
|
+
});
|
1406
|
+
}
|
1407
|
+
function _onAfterSelectionEnd2() {
|
1408
|
+
const selection = this.hot.getSelectedRangeLast();
|
1409
|
+
if (!selection.isHeader()) {
|
1410
|
+
_classPrivateFieldGet(this, _focusOrder).buildFocusOrder(this.hot.getSelectedRangeLast());
|
1411
|
+
}
|
1196
1412
|
}
|
1197
1413
|
function _onAfterGetCellMeta2(row, col, cellProperties) {
|
1198
1414
|
const mergeParent = this.mergedCellsCollection.get(row, col);
|
@@ -1272,27 +1488,6 @@ function _onBeforeDrawAreaBorders2(corners, className) {
|
|
1272
1488
|
});
|
1273
1489
|
}
|
1274
1490
|
}
|
1275
|
-
function _onAfterModifyTransformStart2(coords, rowTransformDir, colTransformDir) {
|
1276
|
-
if (!this.enabled) {
|
1277
|
-
return;
|
1278
|
-
}
|
1279
|
-
const mergedCellAtCoords = this.mergedCellsCollection.get(coords.row, coords.col);
|
1280
|
-
if (!mergedCellAtCoords) {
|
1281
|
-
return;
|
1282
|
-
}
|
1283
|
-
const goingDown = rowTransformDir > 0;
|
1284
|
-
const goingUp = rowTransformDir < 0;
|
1285
|
-
const goingLeft = colTransformDir < 0;
|
1286
|
-
const goingRight = colTransformDir > 0;
|
1287
|
-
const mergedCellOnBottomEdge = mergedCellAtCoords.row + mergedCellAtCoords.rowspan - 1 === this.hot.countRows() - 1;
|
1288
|
-
const mergedCellOnTopEdge = mergedCellAtCoords.row === 0;
|
1289
|
-
const mergedCellOnRightEdge = mergedCellAtCoords.col + mergedCellAtCoords.colspan - 1 === this.hot.countCols() - 1;
|
1290
|
-
const mergedCellOnLeftEdge = mergedCellAtCoords.col === 0;
|
1291
|
-
if (goingDown && mergedCellOnBottomEdge || goingUp && mergedCellOnTopEdge || goingRight && mergedCellOnRightEdge || goingLeft && mergedCellOnLeftEdge) {
|
1292
|
-
coords.row = mergedCellAtCoords.row;
|
1293
|
-
coords.col = mergedCellAtCoords.col;
|
1294
|
-
}
|
1295
|
-
}
|
1296
1491
|
function _onAfterDrawSelection2(currentRow, currentColumn, cornersOfSelection, layerLevel) {
|
1297
1492
|
// Nothing's selected (hook might be triggered by the custom borders)
|
1298
1493
|
if (!cornersOfSelection) {
|