handsontable 0.0.0-next-74a68c1-20230627 → 0.0.0-next-208afb8-20230627
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/CHANGELOG.md +0 -31
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.d.ts +1 -0
- package/core.js +31 -2
- package/core.mjs +31 -2
- package/dataMap/metaManager/metaSchema.js +1 -1
- package/dataMap/metaManager/metaSchema.mjs +1 -1
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +3553 -3366
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +53 -53
- package/dist/handsontable.js +7968 -7781
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +4 -4
- package/editorManager.js +4 -10
- package/editorManager.mjs +4 -10
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/package.json +1 -1
- package/pluginHooks.d.ts +1 -0
- package/pluginHooks.js +11 -4
- package/pluginHooks.mjs +11 -4
- package/plugins/comments/commentEditor.js +1 -0
- package/plugins/comments/commentEditor.mjs +1 -0
- package/plugins/comments/comments.js +289 -231
- package/plugins/comments/comments.mjs +297 -241
- package/plugins/comments/contextMenuItem/addEditComment.js +51 -0
- package/plugins/comments/contextMenuItem/addEditComment.mjs +35 -0
- package/plugins/comments/contextMenuItem/readOnlyComment.js +63 -0
- package/plugins/comments/contextMenuItem/readOnlyComment.mjs +55 -0
- package/plugins/comments/contextMenuItem/removeComment.js +48 -0
- package/plugins/comments/contextMenuItem/removeComment.mjs +32 -0
- package/plugins/contextMenu/contextMenu.js +1 -0
- package/plugins/contextMenu/contextMenu.mjs +1 -0
- package/plugins/copyPaste/copyPaste.js +1 -1
- package/plugins/copyPaste/copyPaste.mjs +1 -1
- package/plugins/filters/filters.js +42 -62
- package/plugins/filters/filters.mjs +41 -61
- package/shortcutContexts/commands/index.js +1 -2
- package/shortcutContexts/commands/index.mjs +1 -2
- package/shortcutContexts/grid.js +0 -5
- package/shortcutContexts/grid.mjs +0 -5
- package/tableView.js +9 -4
- package/tableView.mjs +9 -4
- package/translations/indexMapper.d.ts +2 -0
- package/shortcutContexts/commands/scrollToFocusedCell.js +0 -38
- package/shortcutContexts/commands/scrollToFocusedCell.mjs +0 -33
@@ -67,7 +67,6 @@ import { CONDITION_NONE, CONDITION_BY_VALUE, OPERATION_AND, OPERATION_OR, OPERAT
|
|
67
67
|
import { TrimmingMap } from "../../translations/index.mjs";
|
68
68
|
export var PLUGIN_KEY = 'filters';
|
69
69
|
export var PLUGIN_PRIORITY = 250;
|
70
|
-
var SHORTCUTS_GROUP = PLUGIN_KEY;
|
71
70
|
|
72
71
|
/**
|
73
72
|
* @plugin Filters
|
@@ -283,7 +282,6 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
283
282
|
this.dropdownMenuPlugin.disablePlugin();
|
284
283
|
this.dropdownMenuPlugin.enablePlugin();
|
285
284
|
}
|
286
|
-
this.registerShortcuts();
|
287
285
|
_get(_getPrototypeOf(Filters.prototype), "enablePlugin", this).call(this);
|
288
286
|
}
|
289
287
|
|
@@ -307,41 +305,9 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
307
305
|
this.conditionCollection = null;
|
308
306
|
this.hot.rowIndexMapper.unregisterMap(this.pluginName);
|
309
307
|
}
|
310
|
-
this.unregisterShortcuts();
|
311
308
|
_get(_getPrototypeOf(Filters.prototype), "disablePlugin", this).call(this);
|
312
309
|
}
|
313
310
|
|
314
|
-
/**
|
315
|
-
* Register shortcuts responsible for clearing the filters.
|
316
|
-
*
|
317
|
-
* @private
|
318
|
-
*/
|
319
|
-
}, {
|
320
|
-
key: "registerShortcuts",
|
321
|
-
value: function registerShortcuts() {
|
322
|
-
var _this4 = this;
|
323
|
-
this.hot.getShortcutManager().getContext('grid').addShortcut({
|
324
|
-
keys: [['Alt', 'A']],
|
325
|
-
stopPropagation: true,
|
326
|
-
callback: function callback() {
|
327
|
-
_this4.clearConditions();
|
328
|
-
_this4.filter();
|
329
|
-
},
|
330
|
-
group: SHORTCUTS_GROUP
|
331
|
-
});
|
332
|
-
}
|
333
|
-
|
334
|
-
/**
|
335
|
-
* Unregister shortcuts responsible for clearing the filters.
|
336
|
-
*
|
337
|
-
* @private
|
338
|
-
*/
|
339
|
-
}, {
|
340
|
-
key: "unregisterShortcuts",
|
341
|
-
value: function unregisterShortcuts() {
|
342
|
-
this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);
|
343
|
-
}
|
344
|
-
|
345
311
|
/* eslint-disable jsdoc/require-description-complete-sentence */
|
346
312
|
/**
|
347
313
|
* @memberof Filters#
|
@@ -508,7 +474,7 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
508
474
|
}, {
|
509
475
|
key: "filter",
|
510
476
|
value: function filter() {
|
511
|
-
var
|
477
|
+
var _this4 = this;
|
512
478
|
var dataFilter = this._createDataFilter();
|
513
479
|
var needToFilter = !this.conditionCollection.isEmpty();
|
514
480
|
var visibleVisualRows = [];
|
@@ -518,18 +484,18 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
518
484
|
if (needToFilter) {
|
519
485
|
var trimmedRows = [];
|
520
486
|
this.hot.batchExecution(function () {
|
521
|
-
|
487
|
+
_this4.filtersRowsMap.clear();
|
522
488
|
visibleVisualRows = arrayMap(dataFilter.filter(), function (rowData) {
|
523
489
|
return rowData.meta.visualRow;
|
524
490
|
});
|
525
491
|
var visibleVisualRowsAssertion = createArrayAssertion(visibleVisualRows);
|
526
|
-
rangeEach(
|
492
|
+
rangeEach(_this4.hot.countSourceRows() - 1, function (row) {
|
527
493
|
if (!visibleVisualRowsAssertion(row)) {
|
528
494
|
trimmedRows.push(row);
|
529
495
|
}
|
530
496
|
});
|
531
497
|
arrayEach(trimmedRows, function (physicalRow) {
|
532
|
-
|
498
|
+
_this4.filtersRowsMap.setValueAtIndex(physicalRow, true);
|
533
499
|
});
|
534
500
|
}, true);
|
535
501
|
if (!visibleVisualRows.length) {
|
@@ -542,6 +508,7 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
542
508
|
this.hot.runHooks('afterFilter', conditions);
|
543
509
|
this.hot.view.adjustElementsSize(true);
|
544
510
|
this.hot.render();
|
511
|
+
this.clearColumnSelection();
|
545
512
|
}
|
546
513
|
|
547
514
|
/**
|
@@ -565,6 +532,20 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
565
532
|
};
|
566
533
|
}
|
567
534
|
|
535
|
+
/**
|
536
|
+
* Clears column selection.
|
537
|
+
*
|
538
|
+
* @private
|
539
|
+
*/
|
540
|
+
}, {
|
541
|
+
key: "clearColumnSelection",
|
542
|
+
value: function clearColumnSelection() {
|
543
|
+
var selectedColumn = this.getSelectedColumn();
|
544
|
+
if (selectedColumn !== null) {
|
545
|
+
this.hot.selectCell(0, selectedColumn.visualIndex);
|
546
|
+
}
|
547
|
+
}
|
548
|
+
|
568
549
|
/**
|
569
550
|
* Returns handsontable source data with cell meta based on current selection.
|
570
551
|
*
|
@@ -574,21 +555,21 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
574
555
|
}, {
|
575
556
|
key: "getDataMapAtColumn",
|
576
557
|
value: function getDataMapAtColumn(column) {
|
577
|
-
var
|
558
|
+
var _this5 = this;
|
578
559
|
var visualColumn = this.hot.toVisualColumn(column);
|
579
560
|
var data = [];
|
580
561
|
arrayEach(this.hot.getSourceDataAtCol(visualColumn), function (value, rowIndex) {
|
581
|
-
var
|
582
|
-
var
|
583
|
-
row =
|
584
|
-
col =
|
585
|
-
visualCol =
|
586
|
-
visualRow =
|
587
|
-
type =
|
588
|
-
instance =
|
589
|
-
dateFormat =
|
590
|
-
locale =
|
591
|
-
var dataValue = (
|
562
|
+
var _this5$hot$getDataAtC;
|
563
|
+
var _this5$hot$getCellMet = _this5.hot.getCellMeta(rowIndex, visualColumn),
|
564
|
+
row = _this5$hot$getCellMet.row,
|
565
|
+
col = _this5$hot$getCellMet.col,
|
566
|
+
visualCol = _this5$hot$getCellMet.visualCol,
|
567
|
+
visualRow = _this5$hot$getCellMet.visualRow,
|
568
|
+
type = _this5$hot$getCellMet.type,
|
569
|
+
instance = _this5$hot$getCellMet.instance,
|
570
|
+
dateFormat = _this5$hot$getCellMet.dateFormat,
|
571
|
+
locale = _this5$hot$getCellMet.locale;
|
572
|
+
var dataValue = (_this5$hot$getDataAtC = _this5.hot.getDataAtCell(_this5.hot.toVisualRow(rowIndex), visualColumn)) !== null && _this5$hot$getDataAtC !== void 0 ? _this5$hot$getDataAtC : value;
|
592
573
|
data.push({
|
593
574
|
meta: {
|
594
575
|
row: row,
|
@@ -615,14 +596,14 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
615
596
|
}, {
|
616
597
|
key: "onAfterChange",
|
617
598
|
value: function onAfterChange(changes) {
|
618
|
-
var
|
599
|
+
var _this6 = this;
|
619
600
|
if (changes) {
|
620
601
|
arrayEach(changes, function (change) {
|
621
602
|
var _change = _slicedToArray(change, 2),
|
622
603
|
prop = _change[1];
|
623
|
-
var columnIndex =
|
624
|
-
if (
|
625
|
-
|
604
|
+
var columnIndex = _this6.hot.propToCol(prop);
|
605
|
+
if (_this6.conditionCollection.hasConditions(columnIndex)) {
|
606
|
+
_this6.updateValueComponentCondition(columnIndex);
|
626
607
|
}
|
627
608
|
});
|
628
609
|
}
|
@@ -693,10 +674,10 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
693
674
|
}, {
|
694
675
|
key: "onBeforeDropdownMenuSetItems",
|
695
676
|
value: function onBeforeDropdownMenuSetItems() {
|
696
|
-
var
|
677
|
+
var _this7 = this;
|
697
678
|
if (this.dropdownMenuPlugin) {
|
698
679
|
this.dropdownMenuPlugin.menu.addLocalHook('afterOpen', function () {
|
699
|
-
|
680
|
+
_this7.dropdownMenuPlugin.menu.hotMenu.updateSettings({
|
700
681
|
hiddenRows: true
|
701
682
|
});
|
702
683
|
});
|
@@ -787,7 +768,6 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
787
768
|
});
|
788
769
|
this.filtersRowsMap.clear();
|
789
770
|
this.filter();
|
790
|
-
this.hot.selectCell(0, selectedColumn.visualIndex);
|
791
771
|
}
|
792
772
|
(_this$dropdownMenuPlu3 = this.dropdownMenuPlugin) === null || _this$dropdownMenuPlu3 === void 0 ? void 0 : _this$dropdownMenuPlu3.close();
|
793
773
|
}
|
@@ -880,10 +860,10 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
880
860
|
}, {
|
881
861
|
key: "_createDataFilter",
|
882
862
|
value: function _createDataFilter() {
|
883
|
-
var
|
863
|
+
var _this8 = this;
|
884
864
|
var conditionCollection = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.conditionCollection;
|
885
865
|
return new DataFilter(conditionCollection, function (physicalColumn) {
|
886
|
-
return
|
866
|
+
return _this8.getDataMapAtColumn(physicalColumn);
|
887
867
|
});
|
888
868
|
}
|
889
869
|
|
@@ -1015,12 +995,12 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
1015
995
|
}, {
|
1016
996
|
key: "destroy",
|
1017
997
|
value: function destroy() {
|
1018
|
-
var
|
998
|
+
var _this9 = this;
|
1019
999
|
if (this.enabled) {
|
1020
1000
|
this.components.forEach(function (component, key) {
|
1021
1001
|
if (component !== null) {
|
1022
1002
|
component.destroy();
|
1023
|
-
|
1003
|
+
_this9.components.set(key, null);
|
1024
1004
|
}
|
1025
1005
|
});
|
1026
1006
|
this.conditionCollection.destroy();
|
@@ -20,7 +20,6 @@ var _editor = require("./editor");
|
|
20
20
|
var _extendCellsSelection = require("./extendCellsSelection");
|
21
21
|
var _moveCellSelection = require("./moveCellSelection");
|
22
22
|
var _emptySelectedCells = require("./emptySelectedCells");
|
23
|
-
var _scrollToFocusedCell = require("./scrollToFocusedCell");
|
24
23
|
var _selectAll = require("./selectAll");
|
25
24
|
var _populateSelectedCellsData = require("./populateSelectedCellsData");
|
26
25
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
@@ -29,7 +28,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
29
28
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
30
29
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
31
30
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
32
|
-
var allCommands = [].concat(_toConsumableArray((0, _editor.getAllCommands)()), _toConsumableArray((0, _extendCellsSelection.getAllCommands)()), _toConsumableArray((0, _moveCellSelection.getAllCommands)()), [_emptySelectedCells.command,
|
31
|
+
var allCommands = [].concat(_toConsumableArray((0, _editor.getAllCommands)()), _toConsumableArray((0, _extendCellsSelection.getAllCommands)()), _toConsumableArray((0, _moveCellSelection.getAllCommands)()), [_emptySelectedCells.command, _selectAll.command, _populateSelectedCellsData.command]);
|
33
32
|
|
34
33
|
/**
|
35
34
|
* Prepares and creates an object with all available commands to trigger.
|
@@ -22,10 +22,9 @@ import { getAllCommands as getAllEditorCommands } from "./editor/index.mjs";
|
|
22
22
|
import { getAllCommands as getAllSelectionExtendCommands } from "./extendCellsSelection/index.mjs";
|
23
23
|
import { getAllCommands as getAllSelectionMoveCommands } from "./moveCellSelection/index.mjs";
|
24
24
|
import { command as emptySelectedCells } from "./emptySelectedCells.mjs";
|
25
|
-
import { command as scrollToFocusedCell } from "./scrollToFocusedCell.mjs";
|
26
25
|
import { command as selectAll } from "./selectAll.mjs";
|
27
26
|
import { command as populateSelectedCellsData } from "./populateSelectedCellsData.mjs";
|
28
|
-
var allCommands = [].concat(_toConsumableArray(getAllEditorCommands()), _toConsumableArray(getAllSelectionExtendCommands()), _toConsumableArray(getAllSelectionMoveCommands()), [emptySelectedCells,
|
27
|
+
var allCommands = [].concat(_toConsumableArray(getAllEditorCommands()), _toConsumableArray(getAllSelectionExtendCommands()), _toConsumableArray(getAllSelectionMoveCommands()), [emptySelectedCells, selectAll, populateSelectedCellsData]);
|
29
28
|
|
30
29
|
/**
|
31
30
|
* Prepares and creates an object with all available commands to trigger.
|
package/shortcutContexts/grid.js
CHANGED
@@ -243,10 +243,5 @@ function shortcutsGridContext(hot) {
|
|
243
243
|
callback: function callback() {
|
244
244
|
return commandsPool.moveCellSelectionInlineEnd();
|
245
245
|
}
|
246
|
-
}, {
|
247
|
-
keys: [['Control/Meta', 'Backspace']],
|
248
|
-
callback: function callback() {
|
249
|
-
return commandsPool.scrollToFocusedCell();
|
250
|
-
}
|
251
246
|
}], config);
|
252
247
|
}
|
@@ -239,10 +239,5 @@ export function shortcutsGridContext(hot) {
|
|
239
239
|
callback: function callback() {
|
240
240
|
return commandsPool.moveCellSelectionInlineEnd();
|
241
241
|
}
|
242
|
-
}, {
|
243
|
-
keys: [['Control/Meta', 'Backspace']],
|
244
|
-
callback: function callback() {
|
245
|
-
return commandsPool.scrollToFocusedCell();
|
246
|
-
}
|
247
242
|
}], config);
|
248
243
|
}
|
package/tableView.js
CHANGED
@@ -356,11 +356,14 @@ var TableView = /*#__PURE__*/function () {
|
|
356
356
|
});
|
357
357
|
this.eventManager.addEventListener(documentElement, 'mouseup', function (event) {
|
358
358
|
if (selection.isInProgress() && (0, _event.isLeftClick)(event)) {
|
359
|
-
// is left mouse button
|
360
359
|
selection.finish();
|
361
360
|
}
|
362
361
|
priv.mouseDown = false;
|
363
|
-
|
362
|
+
var isOutsideInputElement = (0, _element.isOutsideInput)(rootDocument.activeElement);
|
363
|
+
if (!isOutsideInputElement) {
|
364
|
+
return;
|
365
|
+
}
|
366
|
+
if (isOutsideInputElement || !selection.isSelected() && !selection.isSelectedByAnyHeader() && !rootElement.contains(event.target) && !(0, _event.isRightClick)(event)) {
|
364
367
|
_this.instance.unlisten();
|
365
368
|
}
|
366
369
|
});
|
@@ -912,10 +915,12 @@ var TableView = /*#__PURE__*/function () {
|
|
912
915
|
return _this2.afterRender(force);
|
913
916
|
},
|
914
917
|
onScrollVertically: function onScrollVertically() {
|
915
|
-
|
918
|
+
_this2.instance.runHooks('afterScrollVertically');
|
919
|
+
_this2.instance.runHooks('afterScroll');
|
916
920
|
},
|
917
921
|
onScrollHorizontally: function onScrollHorizontally() {
|
918
|
-
|
922
|
+
_this2.instance.runHooks('afterScrollHorizontally');
|
923
|
+
_this2.instance.runHooks('afterScroll');
|
919
924
|
},
|
920
925
|
onBeforeRemoveCellClassNames: function onBeforeRemoveCellClassNames() {
|
921
926
|
return _this2.instance.runHooks('beforeRemoveCellClassNames');
|
package/tableView.mjs
CHANGED
@@ -351,11 +351,14 @@ var TableView = /*#__PURE__*/function () {
|
|
351
351
|
});
|
352
352
|
this.eventManager.addEventListener(documentElement, 'mouseup', function (event) {
|
353
353
|
if (selection.isInProgress() && isLeftClick(event)) {
|
354
|
-
// is left mouse button
|
355
354
|
selection.finish();
|
356
355
|
}
|
357
356
|
priv.mouseDown = false;
|
358
|
-
|
357
|
+
var isOutsideInputElement = isOutsideInput(rootDocument.activeElement);
|
358
|
+
if (!isOutsideInputElement) {
|
359
|
+
return;
|
360
|
+
}
|
361
|
+
if (isOutsideInputElement || !selection.isSelected() && !selection.isSelectedByAnyHeader() && !rootElement.contains(event.target) && !isRightClick(event)) {
|
359
362
|
_this.instance.unlisten();
|
360
363
|
}
|
361
364
|
});
|
@@ -907,10 +910,12 @@ var TableView = /*#__PURE__*/function () {
|
|
907
910
|
return _this2.afterRender(force);
|
908
911
|
},
|
909
912
|
onScrollVertically: function onScrollVertically() {
|
910
|
-
|
913
|
+
_this2.instance.runHooks('afterScrollVertically');
|
914
|
+
_this2.instance.runHooks('afterScroll');
|
911
915
|
},
|
912
916
|
onScrollHorizontally: function onScrollHorizontally() {
|
913
|
-
|
917
|
+
_this2.instance.runHooks('afterScrollHorizontally');
|
918
|
+
_this2.instance.runHooks('afterScroll');
|
914
919
|
},
|
915
920
|
onBeforeRemoveCellClassNames: function onBeforeRemoveCellClassNames() {
|
916
921
|
return _this2.instance.runHooks('beforeRemoveCellClassNames');
|
@@ -28,6 +28,8 @@ export class IndexMapper {
|
|
28
28
|
getVisualFromPhysicalIndex(physicalIndex: number): number;
|
29
29
|
getVisualFromRenderableIndex(renderableIndex: number): number;
|
30
30
|
getRenderableFromVisualIndex(visualIndex: number): number;
|
31
|
+
getFirstNotHiddenIndex(fromVisualIndex: number, incrementBy: number,
|
32
|
+
searchAlsoOtherWayAround?: boolean, indexForNextSearch?: number): number | null;
|
31
33
|
getNearestNotHiddenIndex(fromVisualIndex: number, searchDirection: 1|-1,
|
32
34
|
searchAlsoOtherWayAround?: boolean): number | null;
|
33
35
|
initToLength(length?: number): void;
|
@@ -1,38 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
exports.__esModule = true;
|
4
|
-
exports.command = void 0;
|
5
|
-
require("core-js/modules/es.array.includes.js");
|
6
|
-
require("core-js/modules/es.string.includes.js");
|
7
|
-
var command = {
|
8
|
-
name: 'scrollToFocusedCell',
|
9
|
-
callback: function callback(hot) {
|
10
|
-
var _hot$getSelectedRange = hot.getSelectedRangeLast(),
|
11
|
-
highlight = _hot$getSelectedRange.highlight;
|
12
|
-
var firstVisibleRow = hot.view.getFirstFullyVisibleRow() - 1;
|
13
|
-
var firstVisibleColumn = hot.view.getFirstFullyVisibleColumn() - 1;
|
14
|
-
var lastVisibleRow = hot.view.getLastFullyVisibleRow() + 1;
|
15
|
-
var lastVisibleColumn = hot.view.getLastFullyVisibleColumn() + 1;
|
16
|
-
var visibleCoordsFrom = hot._createCellCoords(firstVisibleRow, firstVisibleColumn);
|
17
|
-
var visibleCoordsTo = hot._createCellCoords(lastVisibleRow, lastVisibleColumn);
|
18
|
-
var visibleRange = hot._createCellRange(visibleCoordsFrom, visibleCoordsFrom, visibleCoordsTo);
|
19
|
-
if (!visibleRange.includes(highlight) && (highlight.row >= 0 || highlight.col >= 0)) {
|
20
|
-
var offsetRows = Math.floor(hot.countVisibleRows() / 2);
|
21
|
-
var offsetColumns = Math.floor(hot.countVisibleCols() / 2);
|
22
|
-
var scrollX = Math.max(highlight.row - offsetRows, 0);
|
23
|
-
var scrollY = Math.max(highlight.col - offsetColumns, 0);
|
24
|
-
var scrollCoords = [scrollX, scrollY];
|
25
|
-
|
26
|
-
// for row header focus do not change the scroll Y position, leave as it is
|
27
|
-
if (highlight.col < 0) {
|
28
|
-
scrollCoords[1] = null;
|
29
|
-
|
30
|
-
// for column header focus do not change the scroll X position, leave as it is
|
31
|
-
} else if (highlight.row < 0) {
|
32
|
-
scrollCoords[0] = null;
|
33
|
-
}
|
34
|
-
hot.scrollViewportTo.apply(hot, scrollCoords);
|
35
|
-
}
|
36
|
-
}
|
37
|
-
};
|
38
|
-
exports.command = command;
|
@@ -1,33 +0,0 @@
|
|
1
|
-
import "core-js/modules/es.array.includes.js";
|
2
|
-
import "core-js/modules/es.string.includes.js";
|
3
|
-
export var command = {
|
4
|
-
name: 'scrollToFocusedCell',
|
5
|
-
callback: function callback(hot) {
|
6
|
-
var _hot$getSelectedRange = hot.getSelectedRangeLast(),
|
7
|
-
highlight = _hot$getSelectedRange.highlight;
|
8
|
-
var firstVisibleRow = hot.view.getFirstFullyVisibleRow() - 1;
|
9
|
-
var firstVisibleColumn = hot.view.getFirstFullyVisibleColumn() - 1;
|
10
|
-
var lastVisibleRow = hot.view.getLastFullyVisibleRow() + 1;
|
11
|
-
var lastVisibleColumn = hot.view.getLastFullyVisibleColumn() + 1;
|
12
|
-
var visibleCoordsFrom = hot._createCellCoords(firstVisibleRow, firstVisibleColumn);
|
13
|
-
var visibleCoordsTo = hot._createCellCoords(lastVisibleRow, lastVisibleColumn);
|
14
|
-
var visibleRange = hot._createCellRange(visibleCoordsFrom, visibleCoordsFrom, visibleCoordsTo);
|
15
|
-
if (!visibleRange.includes(highlight) && (highlight.row >= 0 || highlight.col >= 0)) {
|
16
|
-
var offsetRows = Math.floor(hot.countVisibleRows() / 2);
|
17
|
-
var offsetColumns = Math.floor(hot.countVisibleCols() / 2);
|
18
|
-
var scrollX = Math.max(highlight.row - offsetRows, 0);
|
19
|
-
var scrollY = Math.max(highlight.col - offsetColumns, 0);
|
20
|
-
var scrollCoords = [scrollX, scrollY];
|
21
|
-
|
22
|
-
// for row header focus do not change the scroll Y position, leave as it is
|
23
|
-
if (highlight.col < 0) {
|
24
|
-
scrollCoords[1] = null;
|
25
|
-
|
26
|
-
// for column header focus do not change the scroll X position, leave as it is
|
27
|
-
} else if (highlight.row < 0) {
|
28
|
-
scrollCoords[0] = null;
|
29
|
-
}
|
30
|
-
hot.scrollViewportTo.apply(hot, scrollCoords);
|
31
|
-
}
|
32
|
-
}
|
33
|
-
};
|