handsontable 0.0.0-next-af5139c-20230620 → 0.0.0-next-be250b6-20230621
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/base.js +2 -2
- package/base.mjs +2 -2
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +815 -700
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +14 -14
- package/dist/handsontable.js +820 -705
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +4 -4
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/plugins/manualColumnResize/manualColumnResize.js +36 -5
- package/plugins/manualColumnResize/manualColumnResize.mjs +36 -5
- package/plugins/manualRowResize/manualRowResize.js +40 -9
- package/plugins/manualRowResize/manualRowResize.mjs +40 -9
- package/shortcutContexts/commands/index.js +2 -1
- package/shortcutContexts/commands/index.mjs +2 -1
- package/shortcutContexts/commands/scrollToFocusedCell.js +38 -0
- package/shortcutContexts/commands/scrollToFocusedCell.mjs +33 -0
- package/shortcutContexts/grid.js +9 -1
- package/shortcutContexts/grid.mjs +9 -1
package/helpers/mixed.js
CHANGED
@@ -152,7 +152,7 @@ var domMessages = {
|
|
152
152
|
function _injectProductInfo(key, element) {
|
153
153
|
var hasValidType = !isEmpty(key);
|
154
154
|
var isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
|
155
|
-
var hotVersion = "0.0.0-next-
|
155
|
+
var hotVersion = "0.0.0-next-be250b6-20230621";
|
156
156
|
var keyValidityDate;
|
157
157
|
var consoleMessageState = 'invalid';
|
158
158
|
var domMessageState = 'invalid';
|
package/helpers/mixed.mjs
CHANGED
@@ -142,7 +142,7 @@ var domMessages = {
|
|
142
142
|
export function _injectProductInfo(key, element) {
|
143
143
|
var hasValidType = !isEmpty(key);
|
144
144
|
var isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
|
145
|
-
var hotVersion = "0.0.0-next-
|
145
|
+
var hotVersion = "0.0.0-next-be250b6-20230621";
|
146
146
|
var keyValidityDate;
|
147
147
|
var consoleMessageState = 'invalid';
|
148
148
|
var domMessageState = 'invalid';
|
package/package.json
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
"url": "https://github.com/handsontable/handsontable/issues"
|
11
11
|
},
|
12
12
|
"author": "Handsoncode <hello@handsontable.com>",
|
13
|
-
"version": "0.0.0-next-
|
13
|
+
"version": "0.0.0-next-be250b6-20230621",
|
14
14
|
"main": "index",
|
15
15
|
"module": "index.mjs",
|
16
16
|
"jsnext:main": "index.mjs",
|
@@ -87,6 +87,7 @@ var ManualColumnResize = /*#__PURE__*/function (_BasePlugin) {
|
|
87
87
|
_this.guide = rootDocument.createElement('DIV');
|
88
88
|
_this.eventManager = new _eventManager.default(_assertThisInitialized(_this));
|
89
89
|
_this.pressed = null;
|
90
|
+
_this.isTriggeredByRMB = false;
|
90
91
|
_this.dblclick = 0;
|
91
92
|
_this.autoresizeTimeout = null;
|
92
93
|
|
@@ -437,6 +438,11 @@ var ManualColumnResize = /*#__PURE__*/function (_BasePlugin) {
|
|
437
438
|
if ((0, _element.isDetached)(event.target)) {
|
438
439
|
return;
|
439
440
|
}
|
441
|
+
|
442
|
+
// A "mouseover" action is triggered right after executing "contextmenu" event. It should be ignored.
|
443
|
+
if (this.isTriggeredByRMB === true) {
|
444
|
+
return;
|
445
|
+
}
|
440
446
|
if (this.checkIfColumnHeader(event.target)) {
|
441
447
|
var th = this.getClosestTHParent(event.target);
|
442
448
|
if (!th) {
|
@@ -593,6 +599,28 @@ var ManualColumnResize = /*#__PURE__*/function (_BasePlugin) {
|
|
593
599
|
}
|
594
600
|
}
|
595
601
|
|
602
|
+
/**
|
603
|
+
* Callback for "contextmenu" event triggered on element showing move handle. It removes handle and guide elements.
|
604
|
+
*
|
605
|
+
* @private
|
606
|
+
*/
|
607
|
+
}, {
|
608
|
+
key: "onContextMenu",
|
609
|
+
value: function onContextMenu() {
|
610
|
+
var _this9 = this;
|
611
|
+
this.hideHandleAndGuide();
|
612
|
+
this.hot.rootElement.removeChild(this.handle);
|
613
|
+
this.hot.rootElement.removeChild(this.guide);
|
614
|
+
this.pressed = false;
|
615
|
+
this.isTriggeredByRMB = true;
|
616
|
+
|
617
|
+
// There is thrown "mouseover" event right after opening a context menu. This flag inform that handle
|
618
|
+
// shouldn't be drawn just after removing it.
|
619
|
+
this.hot._registerImmediate(function () {
|
620
|
+
_this9.isTriggeredByRMB = false;
|
621
|
+
});
|
622
|
+
}
|
623
|
+
|
596
624
|
/**
|
597
625
|
* Binds the mouse events.
|
598
626
|
*
|
@@ -601,21 +629,24 @@ var ManualColumnResize = /*#__PURE__*/function (_BasePlugin) {
|
|
601
629
|
}, {
|
602
630
|
key: "bindEvents",
|
603
631
|
value: function bindEvents() {
|
604
|
-
var
|
632
|
+
var _this10 = this;
|
605
633
|
var _this$hot = this.hot,
|
606
634
|
rootWindow = _this$hot.rootWindow,
|
607
635
|
rootElement = _this$hot.rootElement;
|
608
636
|
this.eventManager.addEventListener(rootElement, 'mouseover', function (e) {
|
609
|
-
return
|
637
|
+
return _this10.onMouseOver(e);
|
610
638
|
});
|
611
639
|
this.eventManager.addEventListener(rootElement, 'mousedown', function (e) {
|
612
|
-
return
|
640
|
+
return _this10.onMouseDown(e);
|
613
641
|
});
|
614
642
|
this.eventManager.addEventListener(rootWindow, 'mousemove', function (e) {
|
615
|
-
return
|
643
|
+
return _this10.onMouseMove(e);
|
616
644
|
});
|
617
645
|
this.eventManager.addEventListener(rootWindow, 'mouseup', function () {
|
618
|
-
return
|
646
|
+
return _this10.onMouseUp();
|
647
|
+
});
|
648
|
+
this.eventManager.addEventListener(this.handle, 'contextmenu', function () {
|
649
|
+
return _this10.onContextMenu();
|
619
650
|
});
|
620
651
|
}
|
621
652
|
|
@@ -78,6 +78,7 @@ export var ManualColumnResize = /*#__PURE__*/function (_BasePlugin) {
|
|
78
78
|
_this.guide = rootDocument.createElement('DIV');
|
79
79
|
_this.eventManager = new EventManager(_assertThisInitialized(_this));
|
80
80
|
_this.pressed = null;
|
81
|
+
_this.isTriggeredByRMB = false;
|
81
82
|
_this.dblclick = 0;
|
82
83
|
_this.autoresizeTimeout = null;
|
83
84
|
|
@@ -428,6 +429,11 @@ export var ManualColumnResize = /*#__PURE__*/function (_BasePlugin) {
|
|
428
429
|
if (isDetached(event.target)) {
|
429
430
|
return;
|
430
431
|
}
|
432
|
+
|
433
|
+
// A "mouseover" action is triggered right after executing "contextmenu" event. It should be ignored.
|
434
|
+
if (this.isTriggeredByRMB === true) {
|
435
|
+
return;
|
436
|
+
}
|
431
437
|
if (this.checkIfColumnHeader(event.target)) {
|
432
438
|
var th = this.getClosestTHParent(event.target);
|
433
439
|
if (!th) {
|
@@ -584,6 +590,28 @@ export var ManualColumnResize = /*#__PURE__*/function (_BasePlugin) {
|
|
584
590
|
}
|
585
591
|
}
|
586
592
|
|
593
|
+
/**
|
594
|
+
* Callback for "contextmenu" event triggered on element showing move handle. It removes handle and guide elements.
|
595
|
+
*
|
596
|
+
* @private
|
597
|
+
*/
|
598
|
+
}, {
|
599
|
+
key: "onContextMenu",
|
600
|
+
value: function onContextMenu() {
|
601
|
+
var _this9 = this;
|
602
|
+
this.hideHandleAndGuide();
|
603
|
+
this.hot.rootElement.removeChild(this.handle);
|
604
|
+
this.hot.rootElement.removeChild(this.guide);
|
605
|
+
this.pressed = false;
|
606
|
+
this.isTriggeredByRMB = true;
|
607
|
+
|
608
|
+
// There is thrown "mouseover" event right after opening a context menu. This flag inform that handle
|
609
|
+
// shouldn't be drawn just after removing it.
|
610
|
+
this.hot._registerImmediate(function () {
|
611
|
+
_this9.isTriggeredByRMB = false;
|
612
|
+
});
|
613
|
+
}
|
614
|
+
|
587
615
|
/**
|
588
616
|
* Binds the mouse events.
|
589
617
|
*
|
@@ -592,21 +620,24 @@ export var ManualColumnResize = /*#__PURE__*/function (_BasePlugin) {
|
|
592
620
|
}, {
|
593
621
|
key: "bindEvents",
|
594
622
|
value: function bindEvents() {
|
595
|
-
var
|
623
|
+
var _this10 = this;
|
596
624
|
var _this$hot = this.hot,
|
597
625
|
rootWindow = _this$hot.rootWindow,
|
598
626
|
rootElement = _this$hot.rootElement;
|
599
627
|
this.eventManager.addEventListener(rootElement, 'mouseover', function (e) {
|
600
|
-
return
|
628
|
+
return _this10.onMouseOver(e);
|
601
629
|
});
|
602
630
|
this.eventManager.addEventListener(rootElement, 'mousedown', function (e) {
|
603
|
-
return
|
631
|
+
return _this10.onMouseDown(e);
|
604
632
|
});
|
605
633
|
this.eventManager.addEventListener(rootWindow, 'mousemove', function (e) {
|
606
|
-
return
|
634
|
+
return _this10.onMouseMove(e);
|
607
635
|
});
|
608
636
|
this.eventManager.addEventListener(rootWindow, 'mouseup', function () {
|
609
|
-
return
|
637
|
+
return _this10.onMouseUp();
|
638
|
+
});
|
639
|
+
this.eventManager.addEventListener(this.handle, 'contextmenu', function () {
|
640
|
+
return _this10.onContextMenu();
|
610
641
|
});
|
611
642
|
}
|
612
643
|
|
@@ -88,6 +88,7 @@ var ManualRowResize = /*#__PURE__*/function (_BasePlugin) {
|
|
88
88
|
_this.guide = rootDocument.createElement('DIV');
|
89
89
|
_this.eventManager = new _eventManager.default(_assertThisInitialized(_this));
|
90
90
|
_this.pressed = null;
|
91
|
+
_this.isTriggeredByRMB = false;
|
91
92
|
_this.dblclick = 0;
|
92
93
|
_this.autoresizeTimeout = null;
|
93
94
|
|
@@ -409,6 +410,11 @@ var ManualRowResize = /*#__PURE__*/function (_BasePlugin) {
|
|
409
410
|
if ((0, _element.isDetached)(event.target)) {
|
410
411
|
return;
|
411
412
|
}
|
413
|
+
|
414
|
+
// A "mouseover" action is triggered right after executing "contextmenu" event. It should be ignored.
|
415
|
+
if (this.isTriggeredByRMB === true) {
|
416
|
+
return;
|
417
|
+
}
|
412
418
|
if (this.checkIfRowHeader(event.target)) {
|
413
419
|
var th = this.getClosestTHParent(event.target);
|
414
420
|
if (th) {
|
@@ -555,6 +561,28 @@ var ManualRowResize = /*#__PURE__*/function (_BasePlugin) {
|
|
555
561
|
}
|
556
562
|
}
|
557
563
|
|
564
|
+
/**
|
565
|
+
* Callback for "contextmenu" event triggered on element showing move handle. It removes handle and guide elements.
|
566
|
+
*
|
567
|
+
* @private
|
568
|
+
*/
|
569
|
+
}, {
|
570
|
+
key: "onContextMenu",
|
571
|
+
value: function onContextMenu() {
|
572
|
+
var _this8 = this;
|
573
|
+
this.hideHandleAndGuide();
|
574
|
+
this.hot.rootElement.removeChild(this.handle);
|
575
|
+
this.hot.rootElement.removeChild(this.guide);
|
576
|
+
this.pressed = false;
|
577
|
+
this.isTriggeredByRMB = true;
|
578
|
+
|
579
|
+
// There is thrown "mouseover" event right after opening a context menu. This flag inform that handle
|
580
|
+
// shouldn't be drawn just after removing it.
|
581
|
+
this.hot._registerImmediate(function () {
|
582
|
+
_this8.isTriggeredByRMB = false;
|
583
|
+
});
|
584
|
+
}
|
585
|
+
|
558
586
|
/**
|
559
587
|
* Binds the mouse events.
|
560
588
|
*
|
@@ -563,21 +591,24 @@ var ManualRowResize = /*#__PURE__*/function (_BasePlugin) {
|
|
563
591
|
}, {
|
564
592
|
key: "bindEvents",
|
565
593
|
value: function bindEvents() {
|
566
|
-
var
|
594
|
+
var _this9 = this;
|
567
595
|
var _this$hot = this.hot,
|
568
596
|
rootElement = _this$hot.rootElement,
|
569
597
|
rootWindow = _this$hot.rootWindow;
|
570
598
|
this.eventManager.addEventListener(rootElement, 'mouseover', function (e) {
|
571
|
-
return
|
599
|
+
return _this9.onMouseOver(e);
|
572
600
|
});
|
573
601
|
this.eventManager.addEventListener(rootElement, 'mousedown', function (e) {
|
574
|
-
return
|
602
|
+
return _this9.onMouseDown(e);
|
575
603
|
});
|
576
604
|
this.eventManager.addEventListener(rootWindow, 'mousemove', function (e) {
|
577
|
-
return
|
605
|
+
return _this9.onMouseMove(e);
|
578
606
|
});
|
579
607
|
this.eventManager.addEventListener(rootWindow, 'mouseup', function () {
|
580
|
-
return
|
608
|
+
return _this9.onMouseUp();
|
609
|
+
});
|
610
|
+
this.eventManager.addEventListener(this.handle, 'contextmenu', function () {
|
611
|
+
return _this9.onContextMenu();
|
581
612
|
});
|
582
613
|
}
|
583
614
|
|
@@ -611,23 +642,23 @@ var ManualRowResize = /*#__PURE__*/function (_BasePlugin) {
|
|
611
642
|
}, {
|
612
643
|
key: "onMapInit",
|
613
644
|
value: function onMapInit() {
|
614
|
-
var
|
645
|
+
var _this10 = this;
|
615
646
|
var priv = privatePool.get(this);
|
616
647
|
var initialSetting = this.hot.getSettings()[PLUGIN_KEY];
|
617
648
|
var loadedManualRowHeights = this.loadManualRowHeights();
|
618
649
|
this.hot.batchExecution(function () {
|
619
650
|
if (typeof loadedManualRowHeights !== 'undefined') {
|
620
651
|
loadedManualRowHeights.forEach(function (height, index) {
|
621
|
-
|
652
|
+
_this10.rowHeightsMap.setValueAtIndex(index, height);
|
622
653
|
});
|
623
654
|
} else if (Array.isArray(initialSetting)) {
|
624
655
|
initialSetting.forEach(function (height, index) {
|
625
|
-
|
656
|
+
_this10.rowHeightsMap.setValueAtIndex(index, height);
|
626
657
|
});
|
627
658
|
priv.config = initialSetting;
|
628
659
|
} else if (initialSetting === true && Array.isArray(priv.config)) {
|
629
660
|
priv.config.forEach(function (height, index) {
|
630
|
-
|
661
|
+
_this10.rowHeightsMap.setValueAtIndex(index, height);
|
631
662
|
});
|
632
663
|
}
|
633
664
|
}, true);
|
@@ -79,6 +79,7 @@ export var ManualRowResize = /*#__PURE__*/function (_BasePlugin) {
|
|
79
79
|
_this.guide = rootDocument.createElement('DIV');
|
80
80
|
_this.eventManager = new EventManager(_assertThisInitialized(_this));
|
81
81
|
_this.pressed = null;
|
82
|
+
_this.isTriggeredByRMB = false;
|
82
83
|
_this.dblclick = 0;
|
83
84
|
_this.autoresizeTimeout = null;
|
84
85
|
|
@@ -400,6 +401,11 @@ export var ManualRowResize = /*#__PURE__*/function (_BasePlugin) {
|
|
400
401
|
if (isDetached(event.target)) {
|
401
402
|
return;
|
402
403
|
}
|
404
|
+
|
405
|
+
// A "mouseover" action is triggered right after executing "contextmenu" event. It should be ignored.
|
406
|
+
if (this.isTriggeredByRMB === true) {
|
407
|
+
return;
|
408
|
+
}
|
403
409
|
if (this.checkIfRowHeader(event.target)) {
|
404
410
|
var th = this.getClosestTHParent(event.target);
|
405
411
|
if (th) {
|
@@ -546,6 +552,28 @@ export var ManualRowResize = /*#__PURE__*/function (_BasePlugin) {
|
|
546
552
|
}
|
547
553
|
}
|
548
554
|
|
555
|
+
/**
|
556
|
+
* Callback for "contextmenu" event triggered on element showing move handle. It removes handle and guide elements.
|
557
|
+
*
|
558
|
+
* @private
|
559
|
+
*/
|
560
|
+
}, {
|
561
|
+
key: "onContextMenu",
|
562
|
+
value: function onContextMenu() {
|
563
|
+
var _this8 = this;
|
564
|
+
this.hideHandleAndGuide();
|
565
|
+
this.hot.rootElement.removeChild(this.handle);
|
566
|
+
this.hot.rootElement.removeChild(this.guide);
|
567
|
+
this.pressed = false;
|
568
|
+
this.isTriggeredByRMB = true;
|
569
|
+
|
570
|
+
// There is thrown "mouseover" event right after opening a context menu. This flag inform that handle
|
571
|
+
// shouldn't be drawn just after removing it.
|
572
|
+
this.hot._registerImmediate(function () {
|
573
|
+
_this8.isTriggeredByRMB = false;
|
574
|
+
});
|
575
|
+
}
|
576
|
+
|
549
577
|
/**
|
550
578
|
* Binds the mouse events.
|
551
579
|
*
|
@@ -554,21 +582,24 @@ export var ManualRowResize = /*#__PURE__*/function (_BasePlugin) {
|
|
554
582
|
}, {
|
555
583
|
key: "bindEvents",
|
556
584
|
value: function bindEvents() {
|
557
|
-
var
|
585
|
+
var _this9 = this;
|
558
586
|
var _this$hot = this.hot,
|
559
587
|
rootElement = _this$hot.rootElement,
|
560
588
|
rootWindow = _this$hot.rootWindow;
|
561
589
|
this.eventManager.addEventListener(rootElement, 'mouseover', function (e) {
|
562
|
-
return
|
590
|
+
return _this9.onMouseOver(e);
|
563
591
|
});
|
564
592
|
this.eventManager.addEventListener(rootElement, 'mousedown', function (e) {
|
565
|
-
return
|
593
|
+
return _this9.onMouseDown(e);
|
566
594
|
});
|
567
595
|
this.eventManager.addEventListener(rootWindow, 'mousemove', function (e) {
|
568
|
-
return
|
596
|
+
return _this9.onMouseMove(e);
|
569
597
|
});
|
570
598
|
this.eventManager.addEventListener(rootWindow, 'mouseup', function () {
|
571
|
-
return
|
599
|
+
return _this9.onMouseUp();
|
600
|
+
});
|
601
|
+
this.eventManager.addEventListener(this.handle, 'contextmenu', function () {
|
602
|
+
return _this9.onContextMenu();
|
572
603
|
});
|
573
604
|
}
|
574
605
|
|
@@ -602,23 +633,23 @@ export var ManualRowResize = /*#__PURE__*/function (_BasePlugin) {
|
|
602
633
|
}, {
|
603
634
|
key: "onMapInit",
|
604
635
|
value: function onMapInit() {
|
605
|
-
var
|
636
|
+
var _this10 = this;
|
606
637
|
var priv = privatePool.get(this);
|
607
638
|
var initialSetting = this.hot.getSettings()[PLUGIN_KEY];
|
608
639
|
var loadedManualRowHeights = this.loadManualRowHeights();
|
609
640
|
this.hot.batchExecution(function () {
|
610
641
|
if (typeof loadedManualRowHeights !== 'undefined') {
|
611
642
|
loadedManualRowHeights.forEach(function (height, index) {
|
612
|
-
|
643
|
+
_this10.rowHeightsMap.setValueAtIndex(index, height);
|
613
644
|
});
|
614
645
|
} else if (Array.isArray(initialSetting)) {
|
615
646
|
initialSetting.forEach(function (height, index) {
|
616
|
-
|
647
|
+
_this10.rowHeightsMap.setValueAtIndex(index, height);
|
617
648
|
});
|
618
649
|
priv.config = initialSetting;
|
619
650
|
} else if (initialSetting === true && Array.isArray(priv.config)) {
|
620
651
|
priv.config.forEach(function (height, index) {
|
621
|
-
|
652
|
+
_this10.rowHeightsMap.setValueAtIndex(index, height);
|
622
653
|
});
|
623
654
|
}
|
624
655
|
}, true);
|
@@ -20,6 +20,7 @@ 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");
|
23
24
|
var _selectAll = require("./selectAll");
|
24
25
|
var _populateSelectedCellsData = require("./populateSelectedCellsData");
|
25
26
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
@@ -28,7 +29,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
28
29
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
29
30
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
30
31
|
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; }
|
31
|
-
var allCommands = [].concat(_toConsumableArray((0, _editor.getAllCommands)()), _toConsumableArray((0, _extendCellsSelection.getAllCommands)()), _toConsumableArray((0, _moveCellSelection.getAllCommands)()), [_emptySelectedCells.command, _selectAll.command, _populateSelectedCellsData.command]);
|
32
|
+
var allCommands = [].concat(_toConsumableArray((0, _editor.getAllCommands)()), _toConsumableArray((0, _extendCellsSelection.getAllCommands)()), _toConsumableArray((0, _moveCellSelection.getAllCommands)()), [_emptySelectedCells.command, _scrollToFocusedCell.command, _selectAll.command, _populateSelectedCellsData.command]);
|
32
33
|
|
33
34
|
/**
|
34
35
|
* Prepares and creates an object with all available commands to trigger.
|
@@ -22,9 +22,10 @@ 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";
|
25
26
|
import { command as selectAll } from "./selectAll.mjs";
|
26
27
|
import { command as populateSelectedCellsData } from "./populateSelectedCellsData.mjs";
|
27
|
-
var allCommands = [].concat(_toConsumableArray(getAllEditorCommands()), _toConsumableArray(getAllSelectionExtendCommands()), _toConsumableArray(getAllSelectionMoveCommands()), [emptySelectedCells, selectAll, populateSelectedCellsData]);
|
28
|
+
var allCommands = [].concat(_toConsumableArray(getAllEditorCommands()), _toConsumableArray(getAllSelectionExtendCommands()), _toConsumableArray(getAllSelectionMoveCommands()), [emptySelectedCells, scrollToFocusedCell, selectAll, populateSelectedCellsData]);
|
28
29
|
|
29
30
|
/**
|
30
31
|
* Prepares and creates an object with all available commands to trigger.
|
@@ -0,0 +1,38 @@
|
|
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;
|
@@ -0,0 +1,33 @@
|
|
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
|
+
};
|
package/shortcutContexts/grid.js
CHANGED
@@ -37,7 +37,10 @@ function shortcutsGridContext(hot) {
|
|
37
37
|
return commandsPool.emptySelectedCells();
|
38
38
|
}
|
39
39
|
}], {
|
40
|
-
group: _constants.EDITOR_EDIT_GROUP
|
40
|
+
group: _constants.EDITOR_EDIT_GROUP,
|
41
|
+
runOnlyIf: function runOnlyIf() {
|
42
|
+
return (0, _mixed.isDefined)(hot.getSelected());
|
43
|
+
}
|
41
44
|
});
|
42
45
|
context.addShortcuts([{
|
43
46
|
keys: [['Control/Meta', 'A'], ['Control/Meta', 'Shift', 'Space']],
|
@@ -240,5 +243,10 @@ function shortcutsGridContext(hot) {
|
|
240
243
|
callback: function callback() {
|
241
244
|
return commandsPool.moveCellSelectionInlineEnd();
|
242
245
|
}
|
246
|
+
}, {
|
247
|
+
keys: [['Control/Meta', 'Backspace']],
|
248
|
+
callback: function callback() {
|
249
|
+
return commandsPool.scrollToFocusedCell();
|
250
|
+
}
|
243
251
|
}], config);
|
244
252
|
}
|
@@ -33,7 +33,10 @@ export function shortcutsGridContext(hot) {
|
|
33
33
|
return commandsPool.emptySelectedCells();
|
34
34
|
}
|
35
35
|
}], {
|
36
|
-
group: EDITOR_EDIT_GROUP
|
36
|
+
group: EDITOR_EDIT_GROUP,
|
37
|
+
runOnlyIf: function runOnlyIf() {
|
38
|
+
return isDefined(hot.getSelected());
|
39
|
+
}
|
37
40
|
});
|
38
41
|
context.addShortcuts([{
|
39
42
|
keys: [['Control/Meta', 'A'], ['Control/Meta', 'Shift', 'Space']],
|
@@ -236,5 +239,10 @@ export function shortcutsGridContext(hot) {
|
|
236
239
|
callback: function callback() {
|
237
240
|
return commandsPool.moveCellSelectionInlineEnd();
|
238
241
|
}
|
242
|
+
}, {
|
243
|
+
keys: [['Control/Meta', 'Backspace']],
|
244
|
+
callback: function callback() {
|
245
|
+
return commandsPool.scrollToFocusedCell();
|
246
|
+
}
|
239
247
|
}], config);
|
240
248
|
}
|