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