handsontable 0.0.0-next-612100d-20240219 → 0.0.0-next-d96e9b5-20240220
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 +12 -0
- package/3rdparty/walkontable/src/cell/range.mjs +12 -0
- 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.js +14 -0
- package/core.mjs +14 -0
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +1606 -1328
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +151 -151
- package/dist/handsontable.js +1606 -1328
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +19 -19
- package/editorManager.js +12 -8
- package/editorManager.mjs +12 -8
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/pluginHooks.d.ts +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/contextMenuItem/toggleMerge.js +11 -1
- package/plugins/mergeCells/contextMenuItem/toggleMerge.mjs +11 -1
- package/plugins/mergeCells/mergeCells.js +182 -207
- package/plugins/mergeCells/mergeCells.mjs +182 -207
- 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 +4 -4
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +4 -4
- package/selection/highlight/visualSelection.js +2 -0
- package/selection/highlight/visualSelection.mjs +2 -0
- package/selection/selection.js +195 -34
- package/selection/selection.mjs +194 -33
- package/selection/transformation.js +45 -30
- package/selection/transformation.mjs +45 -30
- 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
@@ -25,7 +25,17 @@ function toggleMergeItem(plugin) {
|
|
25
25
|
return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_MERGE_CELLS);
|
26
26
|
},
|
27
27
|
callback() {
|
28
|
-
|
28
|
+
const currentRange = this.getSelectedRangeLast();
|
29
|
+
if (!currentRange) {
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
currentRange.setDirection(this.isRtl() ? 'NE-SW' : 'NW-SE');
|
33
|
+
const {
|
34
|
+
from,
|
35
|
+
to
|
36
|
+
} = currentRange;
|
37
|
+
plugin.toggleMerge(currentRange);
|
38
|
+
this.selectCell(from.row, from.col, to.row, to.col, false);
|
29
39
|
},
|
30
40
|
disabled() {
|
31
41
|
const sel = this.getSelectedLast();
|
@@ -18,7 +18,17 @@ export default function toggleMergeItem(plugin) {
|
|
18
18
|
return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_MERGE_CELLS);
|
19
19
|
},
|
20
20
|
callback() {
|
21
|
-
|
21
|
+
const currentRange = this.getSelectedRangeLast();
|
22
|
+
if (!currentRange) {
|
23
|
+
return;
|
24
|
+
}
|
25
|
+
currentRange.setDirection(this.isRtl() ? 'NE-SW' : 'NW-SE');
|
26
|
+
const {
|
27
|
+
from,
|
28
|
+
to
|
29
|
+
} = currentRange;
|
30
|
+
plugin.toggleMerge(currentRange);
|
31
|
+
this.selectCell(from.row, from.col, to.row, to.col, false);
|
22
32
|
},
|
23
33
|
disabled() {
|
24
34
|
const sel = this.getSelectedLast();
|
@@ -75,16 +75,16 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
|
|
75
75
|
* ```
|
76
76
|
* :::
|
77
77
|
*/
|
78
|
-
var
|
78
|
+
var _lastSelectedCoords = /*#__PURE__*/new WeakMap();
|
79
79
|
var _onAfterInit = /*#__PURE__*/new WeakSet();
|
80
80
|
var _onAfterIsMultipleSelection = /*#__PURE__*/new WeakSet();
|
81
81
|
var _onModifyTransformStart = /*#__PURE__*/new WeakSet();
|
82
82
|
var _onModifyTransformEnd = /*#__PURE__*/new WeakSet();
|
83
|
+
var _onBeforeSelectionHighlightSet = /*#__PURE__*/new WeakSet();
|
83
84
|
var _onModifyGetCellCoords = /*#__PURE__*/new WeakSet();
|
84
85
|
var _addMergeActionsToContextMenu = /*#__PURE__*/new WeakSet();
|
85
86
|
var _onAfterRenderer = /*#__PURE__*/new WeakSet();
|
86
87
|
var _onBeforeSetRangeStart = /*#__PURE__*/new WeakSet();
|
87
|
-
var _onBeforeSetRangeEnd = /*#__PURE__*/new WeakSet();
|
88
88
|
var _onAfterGetCellMeta = /*#__PURE__*/new WeakSet();
|
89
89
|
var _onAfterViewportRowCalculatorOverride = /*#__PURE__*/new WeakSet();
|
90
90
|
var _onAfterViewportColumnCalculatorOverride = /*#__PURE__*/new WeakSet();
|
@@ -95,7 +95,6 @@ var _onAfterCreateRow = /*#__PURE__*/new WeakSet();
|
|
95
95
|
var _onAfterRemoveRow = /*#__PURE__*/new WeakSet();
|
96
96
|
var _onAfterChange = /*#__PURE__*/new WeakSet();
|
97
97
|
var _onBeforeDrawAreaBorders = /*#__PURE__*/new WeakSet();
|
98
|
-
var _onAfterModifyTransformStart = /*#__PURE__*/new WeakSet();
|
99
98
|
var _onAfterDrawSelection = /*#__PURE__*/new WeakSet();
|
100
99
|
var _onBeforeRemoveCellClassNames = /*#__PURE__*/new WeakSet();
|
101
100
|
var _onBeforeBeginEditing = /*#__PURE__*/new WeakSet();
|
@@ -131,17 +130,6 @@ class MergeCells extends _base.BasePlugin {
|
|
131
130
|
* processed cell.
|
132
131
|
*/
|
133
132
|
_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
133
|
/**
|
146
134
|
* `beforeDrawAreaBorders` hook callback.
|
147
135
|
*
|
@@ -214,20 +202,7 @@ class MergeCells extends _base.BasePlugin {
|
|
214
202
|
*/
|
215
203
|
_classPrivateMethodInitSpec(this, _onAfterGetCellMeta);
|
216
204
|
/**
|
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.
|
224
|
-
*/
|
225
|
-
_classPrivateMethodInitSpec(this, _onBeforeSetRangeEnd);
|
226
|
-
/**
|
227
|
-
* `beforeSetRangeStart` and `beforeSetRangeStartOnly` hook callback.
|
228
|
-
* A selection within merge area should be rewritten to the start of merge area.
|
229
|
-
*
|
230
|
-
* @param {object} coords Cell coords.
|
205
|
+
* Clears the last selected coordinates before setting a new selection range.
|
231
206
|
*/
|
232
207
|
_classPrivateMethodInitSpec(this, _onBeforeSetRangeStart);
|
233
208
|
/**
|
@@ -252,6 +227,11 @@ class MergeCells extends _base.BasePlugin {
|
|
252
227
|
* @returns {Array|undefined} Visual coordinates of the merge.
|
253
228
|
*/
|
254
229
|
_classPrivateMethodInitSpec(this, _onModifyGetCellCoords);
|
230
|
+
/**
|
231
|
+
* The hook corrects the range (before drawing it) after the selection was made on the merged cells.
|
232
|
+
* It expands the range to cover the entire area of the selected merged cells.
|
233
|
+
*/
|
234
|
+
_classPrivateMethodInitSpec(this, _onBeforeSelectionHighlightSet);
|
255
235
|
/**
|
256
236
|
* `modifyTransformEnd` hook callback. Needed to handle "jumping over" merged merged cells, while selecting.
|
257
237
|
*
|
@@ -298,9 +278,12 @@ class MergeCells extends _base.BasePlugin {
|
|
298
278
|
*/
|
299
279
|
_defineProperty(this, "selectionCalculations", null);
|
300
280
|
/**
|
281
|
+
* The holder for the last selected coordinates. This allows keeping the correct coordinates in cases after the
|
282
|
+
* focus is moved out of the merged cell.
|
283
|
+
*
|
301
284
|
* @type {CellCoords}
|
302
285
|
*/
|
303
|
-
_classPrivateFieldInitSpec(this,
|
286
|
+
_classPrivateFieldInitSpec(this, _lastSelectedCoords, {
|
304
287
|
writable: true,
|
305
288
|
value: null
|
306
289
|
});
|
@@ -344,135 +327,129 @@ class MergeCells extends _base.BasePlugin {
|
|
344
327
|
}
|
345
328
|
return _classPrivateMethodGet(_this, _onModifyTransformStart, _onModifyTransformStart2).call(_this, ...args);
|
346
329
|
});
|
347
|
-
this.addHook('
|
330
|
+
this.addHook('modifyTransformEnd', function () {
|
348
331
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
349
332
|
args[_key3] = arguments[_key3];
|
350
333
|
}
|
351
|
-
return _classPrivateMethodGet(_this,
|
334
|
+
return _classPrivateMethodGet(_this, _onModifyTransformEnd, _onModifyTransformEnd2).call(_this, ...args);
|
352
335
|
});
|
353
|
-
this.addHook('
|
336
|
+
this.addHook('beforeSelectionHighlightSet', function () {
|
354
337
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
355
338
|
args[_key4] = arguments[_key4];
|
356
339
|
}
|
357
|
-
return _classPrivateMethodGet(_this,
|
340
|
+
return _classPrivateMethodGet(_this, _onBeforeSelectionHighlightSet, _onBeforeSelectionHighlightSet2).call(_this, ...args);
|
358
341
|
});
|
359
|
-
this.addHook('
|
342
|
+
this.addHook('beforeSetRangeStart', function () {
|
360
343
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
361
344
|
args[_key5] = arguments[_key5];
|
362
345
|
}
|
363
|
-
return _classPrivateMethodGet(_this,
|
346
|
+
return _classPrivateMethodGet(_this, _onBeforeSetRangeStart, _onBeforeSetRangeStart2).call(_this, ...args);
|
364
347
|
});
|
365
|
-
this.addHook('
|
348
|
+
this.addHook('beforeSetRangeStartOnly', function () {
|
366
349
|
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
367
350
|
args[_key6] = arguments[_key6];
|
368
351
|
}
|
369
352
|
return _classPrivateMethodGet(_this, _onBeforeSetRangeStart, _onBeforeSetRangeStart2).call(_this, ...args);
|
370
353
|
});
|
371
|
-
this.addHook('
|
354
|
+
this.addHook('modifyGetCellCoords', function () {
|
372
355
|
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
373
356
|
args[_key7] = arguments[_key7];
|
374
357
|
}
|
375
|
-
return _classPrivateMethodGet(_this,
|
358
|
+
return _classPrivateMethodGet(_this, _onModifyGetCellCoords, _onModifyGetCellCoords2).call(_this, ...args);
|
376
359
|
});
|
377
|
-
this.addHook('
|
360
|
+
this.addHook('afterIsMultipleSelection', function () {
|
378
361
|
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
379
362
|
args[_key8] = arguments[_key8];
|
380
363
|
}
|
381
|
-
return _classPrivateMethodGet(_this, _onBeforeSetRangeEnd, _onBeforeSetRangeEnd2).call(_this, ...args);
|
382
|
-
});
|
383
|
-
this.addHook('afterIsMultipleSelection', function () {
|
384
|
-
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
385
|
-
args[_key9] = arguments[_key9];
|
386
|
-
}
|
387
364
|
return _classPrivateMethodGet(_this, _onAfterIsMultipleSelection, _onAfterIsMultipleSelection2).call(_this, ...args);
|
388
365
|
});
|
389
366
|
this.addHook('afterRenderer', function () {
|
390
|
-
for (var
|
391
|
-
args[
|
367
|
+
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
368
|
+
args[_key9] = arguments[_key9];
|
392
369
|
}
|
393
370
|
return _classPrivateMethodGet(_this, _onAfterRenderer, _onAfterRenderer2).call(_this, ...args);
|
394
371
|
});
|
395
372
|
this.addHook('afterContextMenuDefaultOptions', function () {
|
396
|
-
for (var
|
397
|
-
args[
|
373
|
+
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
374
|
+
args[_key10] = arguments[_key10];
|
398
375
|
}
|
399
376
|
return _classPrivateMethodGet(_this, _addMergeActionsToContextMenu, _addMergeActionsToContextMenu2).call(_this, ...args);
|
400
377
|
});
|
401
378
|
this.addHook('afterGetCellMeta', function () {
|
402
|
-
for (var
|
403
|
-
args[
|
379
|
+
for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
|
380
|
+
args[_key11] = arguments[_key11];
|
404
381
|
}
|
405
382
|
return _classPrivateMethodGet(_this, _onAfterGetCellMeta, _onAfterGetCellMeta2).call(_this, ...args);
|
406
383
|
});
|
407
384
|
this.addHook('afterViewportRowCalculatorOverride', function () {
|
408
|
-
for (var
|
409
|
-
args[
|
385
|
+
for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
|
386
|
+
args[_key12] = arguments[_key12];
|
410
387
|
}
|
411
388
|
return _classPrivateMethodGet(_this, _onAfterViewportRowCalculatorOverride, _onAfterViewportRowCalculatorOverride2).call(_this, ...args);
|
412
389
|
});
|
413
390
|
this.addHook('afterViewportColumnCalculatorOverride', function () {
|
414
|
-
for (var
|
415
|
-
args[
|
391
|
+
for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
|
392
|
+
args[_key13] = arguments[_key13];
|
416
393
|
}
|
417
394
|
return _classPrivateMethodGet(_this, _onAfterViewportColumnCalculatorOverride, _onAfterViewportColumnCalculatorOverride2).call(_this, ...args);
|
418
395
|
});
|
419
396
|
this.addHook('modifyAutofillRange', function () {
|
420
|
-
for (var
|
421
|
-
args[
|
397
|
+
for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
|
398
|
+
args[_key14] = arguments[_key14];
|
422
399
|
}
|
423
400
|
return _classPrivateMethodGet(_this, _onModifyAutofillRange, _onModifyAutofillRange2).call(_this, ...args);
|
424
401
|
});
|
425
402
|
this.addHook('afterCreateCol', function () {
|
426
|
-
for (var
|
427
|
-
args[
|
403
|
+
for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
|
404
|
+
args[_key15] = arguments[_key15];
|
428
405
|
}
|
429
406
|
return _classPrivateMethodGet(_this, _onAfterCreateCol, _onAfterCreateCol2).call(_this, ...args);
|
430
407
|
});
|
431
408
|
this.addHook('afterRemoveCol', function () {
|
432
|
-
for (var
|
433
|
-
args[
|
409
|
+
for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {
|
410
|
+
args[_key16] = arguments[_key16];
|
434
411
|
}
|
435
412
|
return _classPrivateMethodGet(_this, _onAfterRemoveCol, _onAfterRemoveCol2).call(_this, ...args);
|
436
413
|
});
|
437
414
|
this.addHook('afterCreateRow', function () {
|
438
|
-
for (var
|
439
|
-
args[
|
415
|
+
for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {
|
416
|
+
args[_key17] = arguments[_key17];
|
440
417
|
}
|
441
418
|
return _classPrivateMethodGet(_this, _onAfterCreateRow, _onAfterCreateRow2).call(_this, ...args);
|
442
419
|
});
|
443
420
|
this.addHook('afterRemoveRow', function () {
|
444
|
-
for (var
|
445
|
-
args[
|
421
|
+
for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {
|
422
|
+
args[_key18] = arguments[_key18];
|
446
423
|
}
|
447
424
|
return _classPrivateMethodGet(_this, _onAfterRemoveRow, _onAfterRemoveRow2).call(_this, ...args);
|
448
425
|
});
|
449
426
|
this.addHook('afterChange', function () {
|
450
|
-
for (var
|
451
|
-
args[
|
427
|
+
for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {
|
428
|
+
args[_key19] = arguments[_key19];
|
452
429
|
}
|
453
430
|
return _classPrivateMethodGet(_this, _onAfterChange, _onAfterChange2).call(_this, ...args);
|
454
431
|
});
|
455
432
|
this.addHook('beforeDrawBorders', function () {
|
456
|
-
for (var
|
457
|
-
args[
|
433
|
+
for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {
|
434
|
+
args[_key20] = arguments[_key20];
|
458
435
|
}
|
459
436
|
return _classPrivateMethodGet(_this, _onBeforeDrawAreaBorders, _onBeforeDrawAreaBorders2).call(_this, ...args);
|
460
437
|
});
|
461
438
|
this.addHook('afterDrawSelection', function () {
|
462
|
-
for (var
|
463
|
-
args[
|
439
|
+
for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {
|
440
|
+
args[_key21] = arguments[_key21];
|
464
441
|
}
|
465
442
|
return _classPrivateMethodGet(_this, _onAfterDrawSelection, _onAfterDrawSelection2).call(_this, ...args);
|
466
443
|
});
|
467
444
|
this.addHook('beforeRemoveCellClassNames', function () {
|
468
|
-
for (var
|
469
|
-
args[
|
445
|
+
for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {
|
446
|
+
args[_key22] = arguments[_key22];
|
470
447
|
}
|
471
448
|
return _classPrivateMethodGet(_this, _onBeforeRemoveCellClassNames, _onBeforeRemoveCellClassNames2).call(_this, ...args);
|
472
449
|
});
|
473
450
|
this.addHook('beforeBeginEditing', function () {
|
474
|
-
for (var
|
475
|
-
args[
|
451
|
+
for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {
|
452
|
+
args[_key23] = arguments[_key23];
|
476
453
|
}
|
477
454
|
return _classPrivateMethodGet(_this, _onBeforeBeginEditing, _onBeforeBeginEditing2).call(_this, ...args);
|
478
455
|
});
|
@@ -642,25 +619,6 @@ class MergeCells extends _base.BasePlugin {
|
|
642
619
|
return auto ? true : this.validateSetting(newMergedCellInfo);
|
643
620
|
}
|
644
621
|
|
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
622
|
/**
|
665
623
|
* Merges the selection provided as a cell range.
|
666
624
|
*
|
@@ -1031,8 +989,10 @@ function _onAfterIsMultipleSelection2(isMultiple) {
|
|
1031
989
|
if (isMultiple) {
|
1032
990
|
const mergedCells = this.mergedCellsCollection.mergedCells;
|
1033
991
|
const selectionRange = this.hot.getSelectedRangeLast();
|
992
|
+
const topStartCoords = selectionRange.getTopStartCorner();
|
993
|
+
const bottomEndCoords = selectionRange.getBottomEndCorner();
|
1034
994
|
for (let group = 0; group < mergedCells.length; group += 1) {
|
1035
|
-
if (
|
995
|
+
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
996
|
return false;
|
1037
997
|
}
|
1038
998
|
}
|
@@ -1040,75 +1000,140 @@ function _onAfterIsMultipleSelection2(isMultiple) {
|
|
1040
1000
|
return isMultiple;
|
1041
1001
|
}
|
1042
1002
|
function _onModifyTransformStart2(delta) {
|
1043
|
-
const
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
const mergedParent = this.mergedCellsCollection.get(currentPosition.row, currentPosition.col);
|
1051
|
-
if (!_classPrivateFieldGet(this, _lastDesiredCoords)) {
|
1052
|
-
_classPrivateFieldSet(this, _lastDesiredCoords, this.hot._createCellCoords(null, null));
|
1003
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
1004
|
+
const {
|
1005
|
+
highlight
|
1006
|
+
} = selectedRange;
|
1007
|
+
if (_classPrivateFieldGet(this, _lastSelectedCoords)) {
|
1008
|
+
highlight.assign(_classPrivateFieldGet(this, _lastSelectedCoords));
|
1009
|
+
_classPrivateFieldSet(this, _lastSelectedCoords, null);
|
1053
1010
|
}
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1011
|
+
const mergedParent = this.mergedCellsCollection.get(highlight.row, highlight.col);
|
1012
|
+
if (!mergedParent) {
|
1013
|
+
return;
|
1014
|
+
}
|
1015
|
+
const visualColumnIndexStart = mergedParent.col;
|
1016
|
+
const visualColumnIndexEnd = mergedParent.col + mergedParent.colspan - 1;
|
1017
|
+
if (delta.col < 0) {
|
1018
|
+
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexStart - 1 : visualColumnIndexEnd;
|
1019
|
+
const notHiddenColumnIndex = this.hot.columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
1020
|
+
if (notHiddenColumnIndex === null) {
|
1021
|
+
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
1022
|
+
// be processed by the selection Transformer class as a move selection to the previous row (if autoWrapRow is enabled).
|
1023
|
+
delta.col = -this.hot.view.countRenderableColumnsInRange(0, highlight.col);
|
1024
|
+
} else {
|
1025
|
+
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1, 1);
|
1061
1026
|
}
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1027
|
+
} else if (delta.col > 0) {
|
1028
|
+
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexEnd + 1 : visualColumnIndexStart;
|
1029
|
+
const notHiddenColumnIndex = this.hot.columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
1030
|
+
if (notHiddenColumnIndex === null) {
|
1031
|
+
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
1032
|
+
// be processed by the selection Transformer class as a move selection to the next row (if autoWrapRow is enabled).
|
1033
|
+
delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, this.hot.countCols());
|
1034
|
+
} else {
|
1035
|
+
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1, 1);
|
1070
1036
|
}
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1037
|
+
}
|
1038
|
+
const visualRowIndexStart = mergedParent.row;
|
1039
|
+
const visualRowIndexEnd = mergedParent.row + mergedParent.rowspan - 1;
|
1040
|
+
if (delta.row < 0) {
|
1041
|
+
const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexStart - 1 : visualRowIndexEnd;
|
1042
|
+
const notHiddenRowIndex = this.hot.rowIndexMapper.getNearestNotHiddenIndex(nextRow, -1);
|
1043
|
+
if (notHiddenRowIndex === null) {
|
1044
|
+
// There are no visible rows anymore, so move the selection out of the table edge. This will
|
1045
|
+
// be processed by the selection Transformer class as a move selection to the previous column (if autoWrapCol is enabled).
|
1046
|
+
delta.row = -this.hot.view.countRenderableRowsInRange(0, highlight.row);
|
1047
|
+
} else {
|
1048
|
+
delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, highlight.row) - 1, 1);
|
1049
|
+
}
|
1050
|
+
} else if (delta.row > 0) {
|
1051
|
+
const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexEnd + 1 : visualRowIndexStart;
|
1052
|
+
const notHiddenRowIndex = this.hot.rowIndexMapper.getNearestNotHiddenIndex(nextRow, 1);
|
1053
|
+
if (notHiddenRowIndex === null) {
|
1054
|
+
// There are no visible rows anymore, so move the selection out of the table edge. This will
|
1055
|
+
// be processed by the selection Transformer class as a move selection to the next column (if autoWrapCol is enabled).
|
1056
|
+
delta.row = this.hot.view.countRenderableRowsInRange(highlight.row, this.hot.countRows());
|
1057
|
+
} else {
|
1058
|
+
delta.row = Math.max(this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowIndex) - 1, 1);
|
1077
1059
|
}
|
1078
1060
|
}
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1061
|
+
}
|
1062
|
+
function _onModifyTransformEnd2(delta) {
|
1063
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
1064
|
+
const {
|
1065
|
+
to
|
1066
|
+
} = selectedRange;
|
1067
|
+
const nextTo = this.hot._createCellCoords(to.row + delta.row, to.col + delta.col);
|
1068
|
+
const mergedParentCurrent = this.mergedCellsCollection.get(to.row, to.col);
|
1069
|
+
const mergedParentNext = this.mergedCellsCollection.get(nextTo.row, nextTo.col);
|
1070
|
+
if (!(mergedParentCurrent && mergedParentNext && mergedParentCurrent === mergedParentNext)) {
|
1071
|
+
return;
|
1089
1072
|
}
|
1090
|
-
|
1091
|
-
|
1073
|
+
const visualColumnIndexStart = mergedParentCurrent.col;
|
1074
|
+
const visualColumnIndexEnd = mergedParentCurrent.col + mergedParentCurrent.colspan - 1;
|
1075
|
+
if (delta.col < 0) {
|
1076
|
+
const nextColumn = nextTo.col >= visualColumnIndexStart && nextTo.col <= visualColumnIndexEnd ? visualColumnIndexStart - 1 : visualColumnIndexEnd;
|
1077
|
+
const notHiddenColumnIndex = this.hot.columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
1078
|
+
if (notHiddenColumnIndex === null) {
|
1079
|
+
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
1080
|
+
// be processed by the selection Transformer class as a move selection to the previous row (if autoWrapRow is enabled).
|
1081
|
+
delta.col = -this.hot.view.countRenderableColumnsInRange(0, to.col);
|
1082
|
+
} else {
|
1083
|
+
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, to.col) - 1, 1);
|
1084
|
+
}
|
1085
|
+
} else if (delta.col > 0) {
|
1086
|
+
const nextColumn = nextTo.col >= visualColumnIndexStart && nextTo.col <= visualColumnIndexEnd ? visualColumnIndexEnd + 1 : visualColumnIndexStart;
|
1087
|
+
const notHiddenColumnIndex = this.hot.columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
1088
|
+
if (notHiddenColumnIndex === null) {
|
1089
|
+
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
1090
|
+
// be processed by the selection Transformer class as a move selection to the next row (if autoWrapRow is enabled).
|
1091
|
+
delta.col = this.hot.view.countRenderableColumnsInRange(to.col, this.hot.countCols());
|
1092
|
+
} else {
|
1093
|
+
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(to.col, notHiddenColumnIndex) - 1, 1);
|
1094
|
+
}
|
1092
1095
|
}
|
1093
|
-
|
1094
|
-
|
1096
|
+
const visualRowIndexStart = mergedParentCurrent.row;
|
1097
|
+
const visualRowIndexEnd = mergedParentCurrent.row + mergedParentCurrent.rowspan - 1;
|
1098
|
+
if (delta.row < 0) {
|
1099
|
+
const nextRow = nextTo.row >= visualRowIndexStart && nextTo.row <= visualRowIndexEnd ? visualRowIndexStart - 1 : visualRowIndexEnd;
|
1100
|
+
const notHiddenRowIndex = this.hot.rowIndexMapper.getNearestNotHiddenIndex(nextRow, -1);
|
1101
|
+
if (notHiddenRowIndex === null) {
|
1102
|
+
// There are no visible rows anymore, so move the selection out of the table edge. This will
|
1103
|
+
// be processed by the selection Transformer class as a move selection to the previous column (if autoWrapCol is enabled).
|
1104
|
+
delta.row = -this.hot.view.countRenderableRowsInRange(0, to.row);
|
1105
|
+
} else {
|
1106
|
+
delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, to.row) - 1, 1);
|
1107
|
+
}
|
1108
|
+
} else if (delta.row > 0) {
|
1109
|
+
const nextRow = nextTo.row >= visualRowIndexStart && nextTo.row <= visualRowIndexEnd ? visualRowIndexEnd + 1 : visualRowIndexStart;
|
1110
|
+
const notHiddenRowIndex = this.hot.rowIndexMapper.getNearestNotHiddenIndex(nextRow, 1);
|
1111
|
+
if (notHiddenRowIndex === null) {
|
1112
|
+
// There are no visible rows anymore, so move the selection out of the table edge. This will
|
1113
|
+
// be processed by the selection Transformer class as a move selection to the next column (if autoWrapCol is enabled).
|
1114
|
+
delta.row = this.hot.view.countRenderableRowsInRange(to.row, this.hot.countRows());
|
1115
|
+
} else {
|
1116
|
+
delta.row = Math.max(this.hot.view.countRenderableRowsInRange(to.row, notHiddenRowIndex) - 1, 1);
|
1117
|
+
}
|
1095
1118
|
}
|
1096
1119
|
}
|
1097
|
-
function
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
const
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1120
|
+
function _onBeforeSelectionHighlightSet2() {
|
1121
|
+
if (this.hot.selection.isSelectedByColumnHeader() || this.hot.selection.isSelectedByRowHeader()) {
|
1122
|
+
return;
|
1123
|
+
}
|
1124
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
1125
|
+
const {
|
1126
|
+
highlight
|
1127
|
+
} = selectedRange;
|
1128
|
+
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1129
|
+
const cellInfo = this.mergedCellsCollection.mergedCells[i];
|
1130
|
+
selectedRange.expandByRange(cellInfo.getRange());
|
1131
|
+
}
|
1132
|
+
const mergedParent = this.mergedCellsCollection.get(highlight.row, highlight.col);
|
1133
|
+
_classPrivateFieldSet(this, _lastSelectedCoords, highlight.clone());
|
1134
|
+
if (mergedParent) {
|
1135
|
+
highlight.assign(mergedParent);
|
1136
|
+
}
|
1112
1137
|
}
|
1113
1138
|
function _onModifyGetCellCoords2(row, column) {
|
1114
1139
|
if (row < 0 || column < 0) {
|
@@ -1167,37 +1192,8 @@ function _onAfterRenderer2(TD, row, col) {
|
|
1167
1192
|
}
|
1168
1193
|
(0, _utils.applySpanProperties)(TD, mergedCellCopy, row, col);
|
1169
1194
|
}
|
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
|
-
}
|
1180
|
-
}
|
1181
|
-
function _onBeforeSetRangeEnd2(coords) {
|
1182
|
-
const selRange = this.hot.getSelectedRangeLast();
|
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()) {
|
1187
|
-
return;
|
1188
|
-
}
|
1189
|
-
do {
|
1190
|
-
rangeExpanded = false;
|
1191
|
-
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1192
|
-
const cellInfo = this.mergedCellsCollection.mergedCells[i];
|
1193
|
-
const mergedCellRange = cellInfo.getRange();
|
1194
|
-
if (selRange.expandByRange(mergedCellRange)) {
|
1195
|
-
coords.row = selRange.to.row;
|
1196
|
-
coords.col = selRange.to.col;
|
1197
|
-
rangeExpanded = true;
|
1198
|
-
}
|
1199
|
-
}
|
1200
|
-
} while (rangeExpanded);
|
1195
|
+
function _onBeforeSetRangeStart2() {
|
1196
|
+
_classPrivateFieldSet(this, _lastSelectedCoords, null);
|
1201
1197
|
}
|
1202
1198
|
function _onAfterGetCellMeta2(row, col, cellProperties) {
|
1203
1199
|
const mergeParent = this.mergedCellsCollection.get(row, col);
|
@@ -1277,27 +1273,6 @@ function _onBeforeDrawAreaBorders2(corners, className) {
|
|
1277
1273
|
});
|
1278
1274
|
}
|
1279
1275
|
}
|
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
1276
|
function _onAfterDrawSelection2(currentRow, currentColumn, cornersOfSelection, layerLevel) {
|
1302
1277
|
// Nothing's selected (hook might be triggered by the custom borders)
|
1303
1278
|
if (!cornersOfSelection) {
|