handsontable 0.0.0-next-c3d199b-20230626 → 0.0.0-next-74a68c1-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.

Files changed (37) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/base.js +2 -2
  3. package/base.mjs +2 -2
  4. package/dist/handsontable.css +2 -2
  5. package/dist/handsontable.full.css +2 -2
  6. package/dist/handsontable.full.js +3347 -3475
  7. package/dist/handsontable.full.min.css +2 -2
  8. package/dist/handsontable.full.min.js +53 -53
  9. package/dist/handsontable.js +5524 -5652
  10. package/dist/handsontable.min.css +2 -2
  11. package/dist/handsontable.min.js +4 -4
  12. package/helpers/mixed.js +2 -2
  13. package/helpers/mixed.mjs +2 -2
  14. package/package.json +1 -1
  15. package/plugins/comments/commentEditor.js +0 -1
  16. package/plugins/comments/commentEditor.mjs +0 -1
  17. package/plugins/comments/comments.js +231 -263
  18. package/plugins/comments/comments.mjs +241 -271
  19. package/plugins/copyPaste/copyPaste.js +1 -1
  20. package/plugins/copyPaste/copyPaste.mjs +1 -1
  21. package/plugins/filters/filters.js +62 -42
  22. package/plugins/filters/filters.mjs +61 -41
  23. package/shortcutContexts/commands/index.js +2 -1
  24. package/shortcutContexts/commands/index.mjs +2 -1
  25. package/shortcutContexts/commands/scrollToFocusedCell.js +38 -0
  26. package/shortcutContexts/commands/scrollToFocusedCell.mjs +33 -0
  27. package/shortcutContexts/grid.js +5 -0
  28. package/shortcutContexts/grid.mjs +5 -0
  29. package/tableView.js +2 -5
  30. package/tableView.mjs +2 -5
  31. package/translations/indexMapper.d.ts +0 -2
  32. package/plugins/comments/contextMenuItem/addEditComment.js +0 -51
  33. package/plugins/comments/contextMenuItem/addEditComment.mjs +0 -35
  34. package/plugins/comments/contextMenuItem/readOnlyComment.js +0 -63
  35. package/plugins/comments/contextMenuItem/readOnlyComment.mjs +0 -55
  36. package/plugins/comments/contextMenuItem/removeComment.js +0 -48
  37. package/plugins/comments/contextMenuItem/removeComment.mjs +0 -32
@@ -735,7 +735,7 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
735
735
  }, {
736
736
  key: "onPaste",
737
737
  value: function onPaste(event) {
738
- if (!this.hot.isListening() || this.isEditorOpened() || !this.hot.getSelected()) {
738
+ if (!this.hot.isListening() || this.isEditorOpened()) {
739
739
  return;
740
740
  }
741
741
  if (event && event.preventDefault) {
@@ -728,7 +728,7 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
728
728
  }, {
729
729
  key: "onPaste",
730
730
  value: function onPaste(event) {
731
- if (!this.hot.isListening() || this.isEditorOpened() || !this.hot.getSelected()) {
731
+ if (!this.hot.isListening() || this.isEditorOpened()) {
732
732
  return;
733
733
  }
734
734
  if (event && event.preventDefault) {
@@ -76,6 +76,8 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
76
76
  var PLUGIN_KEY = 'filters';
77
77
  exports.PLUGIN_KEY = PLUGIN_KEY;
78
78
  var PLUGIN_PRIORITY = 250;
79
+ exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
80
+ var SHORTCUTS_GROUP = PLUGIN_KEY;
79
81
 
80
82
  /**
81
83
  * @plugin Filters
@@ -112,7 +114,6 @@ var PLUGIN_PRIORITY = 250;
112
114
  * ```
113
115
  * :::
114
116
  */
115
- exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
116
117
  var Filters = /*#__PURE__*/function (_BasePlugin) {
117
118
  _inherits(Filters, _BasePlugin);
118
119
  var _super = _createSuper(Filters);
@@ -292,6 +293,7 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
292
293
  this.dropdownMenuPlugin.disablePlugin();
293
294
  this.dropdownMenuPlugin.enablePlugin();
294
295
  }
296
+ this.registerShortcuts();
295
297
  _get(_getPrototypeOf(Filters.prototype), "enablePlugin", this).call(this);
296
298
  }
297
299
 
@@ -315,9 +317,41 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
315
317
  this.conditionCollection = null;
316
318
  this.hot.rowIndexMapper.unregisterMap(this.pluginName);
317
319
  }
320
+ this.unregisterShortcuts();
318
321
  _get(_getPrototypeOf(Filters.prototype), "disablePlugin", this).call(this);
319
322
  }
320
323
 
324
+ /**
325
+ * Register shortcuts responsible for clearing the filters.
326
+ *
327
+ * @private
328
+ */
329
+ }, {
330
+ key: "registerShortcuts",
331
+ value: function registerShortcuts() {
332
+ var _this4 = this;
333
+ this.hot.getShortcutManager().getContext('grid').addShortcut({
334
+ keys: [['Alt', 'A']],
335
+ stopPropagation: true,
336
+ callback: function callback() {
337
+ _this4.clearConditions();
338
+ _this4.filter();
339
+ },
340
+ group: SHORTCUTS_GROUP
341
+ });
342
+ }
343
+
344
+ /**
345
+ * Unregister shortcuts responsible for clearing the filters.
346
+ *
347
+ * @private
348
+ */
349
+ }, {
350
+ key: "unregisterShortcuts",
351
+ value: function unregisterShortcuts() {
352
+ this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);
353
+ }
354
+
321
355
  /* eslint-disable jsdoc/require-description-complete-sentence */
322
356
  /**
323
357
  * @memberof Filters#
@@ -484,7 +518,7 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
484
518
  }, {
485
519
  key: "filter",
486
520
  value: function filter() {
487
- var _this4 = this;
521
+ var _this5 = this;
488
522
  var dataFilter = this._createDataFilter();
489
523
  var needToFilter = !this.conditionCollection.isEmpty();
490
524
  var visibleVisualRows = [];
@@ -494,18 +528,18 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
494
528
  if (needToFilter) {
495
529
  var trimmedRows = [];
496
530
  this.hot.batchExecution(function () {
497
- _this4.filtersRowsMap.clear();
531
+ _this5.filtersRowsMap.clear();
498
532
  visibleVisualRows = (0, _array.arrayMap)(dataFilter.filter(), function (rowData) {
499
533
  return rowData.meta.visualRow;
500
534
  });
501
535
  var visibleVisualRowsAssertion = (0, _utils.createArrayAssertion)(visibleVisualRows);
502
- (0, _number.rangeEach)(_this4.hot.countSourceRows() - 1, function (row) {
536
+ (0, _number.rangeEach)(_this5.hot.countSourceRows() - 1, function (row) {
503
537
  if (!visibleVisualRowsAssertion(row)) {
504
538
  trimmedRows.push(row);
505
539
  }
506
540
  });
507
541
  (0, _array.arrayEach)(trimmedRows, function (physicalRow) {
508
- _this4.filtersRowsMap.setValueAtIndex(physicalRow, true);
542
+ _this5.filtersRowsMap.setValueAtIndex(physicalRow, true);
509
543
  });
510
544
  }, true);
511
545
  if (!visibleVisualRows.length) {
@@ -518,7 +552,6 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
518
552
  this.hot.runHooks('afterFilter', conditions);
519
553
  this.hot.view.adjustElementsSize(true);
520
554
  this.hot.render();
521
- this.clearColumnSelection();
522
555
  }
523
556
 
524
557
  /**
@@ -542,20 +575,6 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
542
575
  };
543
576
  }
544
577
 
545
- /**
546
- * Clears column selection.
547
- *
548
- * @private
549
- */
550
- }, {
551
- key: "clearColumnSelection",
552
- value: function clearColumnSelection() {
553
- var selectedColumn = this.getSelectedColumn();
554
- if (selectedColumn !== null) {
555
- this.hot.selectCell(0, selectedColumn.visualIndex);
556
- }
557
- }
558
-
559
578
  /**
560
579
  * Returns handsontable source data with cell meta based on current selection.
561
580
  *
@@ -565,21 +584,21 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
565
584
  }, {
566
585
  key: "getDataMapAtColumn",
567
586
  value: function getDataMapAtColumn(column) {
568
- var _this5 = this;
587
+ var _this6 = this;
569
588
  var visualColumn = this.hot.toVisualColumn(column);
570
589
  var data = [];
571
590
  (0, _array.arrayEach)(this.hot.getSourceDataAtCol(visualColumn), function (value, rowIndex) {
572
- var _this5$hot$getDataAtC;
573
- var _this5$hot$getCellMet = _this5.hot.getCellMeta(rowIndex, visualColumn),
574
- row = _this5$hot$getCellMet.row,
575
- col = _this5$hot$getCellMet.col,
576
- visualCol = _this5$hot$getCellMet.visualCol,
577
- visualRow = _this5$hot$getCellMet.visualRow,
578
- type = _this5$hot$getCellMet.type,
579
- instance = _this5$hot$getCellMet.instance,
580
- dateFormat = _this5$hot$getCellMet.dateFormat,
581
- locale = _this5$hot$getCellMet.locale;
582
- var dataValue = (_this5$hot$getDataAtC = _this5.hot.getDataAtCell(_this5.hot.toVisualRow(rowIndex), visualColumn)) !== null && _this5$hot$getDataAtC !== void 0 ? _this5$hot$getDataAtC : value;
591
+ var _this6$hot$getDataAtC;
592
+ var _this6$hot$getCellMet = _this6.hot.getCellMeta(rowIndex, visualColumn),
593
+ row = _this6$hot$getCellMet.row,
594
+ col = _this6$hot$getCellMet.col,
595
+ visualCol = _this6$hot$getCellMet.visualCol,
596
+ visualRow = _this6$hot$getCellMet.visualRow,
597
+ type = _this6$hot$getCellMet.type,
598
+ instance = _this6$hot$getCellMet.instance,
599
+ dateFormat = _this6$hot$getCellMet.dateFormat,
600
+ locale = _this6$hot$getCellMet.locale;
601
+ var dataValue = (_this6$hot$getDataAtC = _this6.hot.getDataAtCell(_this6.hot.toVisualRow(rowIndex), visualColumn)) !== null && _this6$hot$getDataAtC !== void 0 ? _this6$hot$getDataAtC : value;
583
602
  data.push({
584
603
  meta: {
585
604
  row: row,
@@ -606,14 +625,14 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
606
625
  }, {
607
626
  key: "onAfterChange",
608
627
  value: function onAfterChange(changes) {
609
- var _this6 = this;
628
+ var _this7 = this;
610
629
  if (changes) {
611
630
  (0, _array.arrayEach)(changes, function (change) {
612
631
  var _change = _slicedToArray(change, 2),
613
632
  prop = _change[1];
614
- var columnIndex = _this6.hot.propToCol(prop);
615
- if (_this6.conditionCollection.hasConditions(columnIndex)) {
616
- _this6.updateValueComponentCondition(columnIndex);
633
+ var columnIndex = _this7.hot.propToCol(prop);
634
+ if (_this7.conditionCollection.hasConditions(columnIndex)) {
635
+ _this7.updateValueComponentCondition(columnIndex);
617
636
  }
618
637
  });
619
638
  }
@@ -684,10 +703,10 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
684
703
  }, {
685
704
  key: "onBeforeDropdownMenuSetItems",
686
705
  value: function onBeforeDropdownMenuSetItems() {
687
- var _this7 = this;
706
+ var _this8 = this;
688
707
  if (this.dropdownMenuPlugin) {
689
708
  this.dropdownMenuPlugin.menu.addLocalHook('afterOpen', function () {
690
- _this7.dropdownMenuPlugin.menu.hotMenu.updateSettings({
709
+ _this8.dropdownMenuPlugin.menu.hotMenu.updateSettings({
691
710
  hiddenRows: true
692
711
  });
693
712
  });
@@ -778,6 +797,7 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
778
797
  });
779
798
  this.filtersRowsMap.clear();
780
799
  this.filter();
800
+ this.hot.selectCell(0, selectedColumn.visualIndex);
781
801
  }
782
802
  (_this$dropdownMenuPlu3 = this.dropdownMenuPlugin) === null || _this$dropdownMenuPlu3 === void 0 ? void 0 : _this$dropdownMenuPlu3.close();
783
803
  }
@@ -870,10 +890,10 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
870
890
  }, {
871
891
  key: "_createDataFilter",
872
892
  value: function _createDataFilter() {
873
- var _this8 = this;
893
+ var _this9 = this;
874
894
  var conditionCollection = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.conditionCollection;
875
895
  return new _dataFilter.default(conditionCollection, function (physicalColumn) {
876
- return _this8.getDataMapAtColumn(physicalColumn);
896
+ return _this9.getDataMapAtColumn(physicalColumn);
877
897
  });
878
898
  }
879
899
 
@@ -1005,12 +1025,12 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
1005
1025
  }, {
1006
1026
  key: "destroy",
1007
1027
  value: function destroy() {
1008
- var _this9 = this;
1028
+ var _this10 = this;
1009
1029
  if (this.enabled) {
1010
1030
  this.components.forEach(function (component, key) {
1011
1031
  if (component !== null) {
1012
1032
  component.destroy();
1013
- _this9.components.set(key, null);
1033
+ _this10.components.set(key, null);
1014
1034
  }
1015
1035
  });
1016
1036
  this.conditionCollection.destroy();
@@ -67,6 +67,7 @@ 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;
70
71
 
71
72
  /**
72
73
  * @plugin Filters
@@ -282,6 +283,7 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
282
283
  this.dropdownMenuPlugin.disablePlugin();
283
284
  this.dropdownMenuPlugin.enablePlugin();
284
285
  }
286
+ this.registerShortcuts();
285
287
  _get(_getPrototypeOf(Filters.prototype), "enablePlugin", this).call(this);
286
288
  }
287
289
 
@@ -305,9 +307,41 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
305
307
  this.conditionCollection = null;
306
308
  this.hot.rowIndexMapper.unregisterMap(this.pluginName);
307
309
  }
310
+ this.unregisterShortcuts();
308
311
  _get(_getPrototypeOf(Filters.prototype), "disablePlugin", this).call(this);
309
312
  }
310
313
 
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
+
311
345
  /* eslint-disable jsdoc/require-description-complete-sentence */
312
346
  /**
313
347
  * @memberof Filters#
@@ -474,7 +508,7 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
474
508
  }, {
475
509
  key: "filter",
476
510
  value: function filter() {
477
- var _this4 = this;
511
+ var _this5 = this;
478
512
  var dataFilter = this._createDataFilter();
479
513
  var needToFilter = !this.conditionCollection.isEmpty();
480
514
  var visibleVisualRows = [];
@@ -484,18 +518,18 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
484
518
  if (needToFilter) {
485
519
  var trimmedRows = [];
486
520
  this.hot.batchExecution(function () {
487
- _this4.filtersRowsMap.clear();
521
+ _this5.filtersRowsMap.clear();
488
522
  visibleVisualRows = arrayMap(dataFilter.filter(), function (rowData) {
489
523
  return rowData.meta.visualRow;
490
524
  });
491
525
  var visibleVisualRowsAssertion = createArrayAssertion(visibleVisualRows);
492
- rangeEach(_this4.hot.countSourceRows() - 1, function (row) {
526
+ rangeEach(_this5.hot.countSourceRows() - 1, function (row) {
493
527
  if (!visibleVisualRowsAssertion(row)) {
494
528
  trimmedRows.push(row);
495
529
  }
496
530
  });
497
531
  arrayEach(trimmedRows, function (physicalRow) {
498
- _this4.filtersRowsMap.setValueAtIndex(physicalRow, true);
532
+ _this5.filtersRowsMap.setValueAtIndex(physicalRow, true);
499
533
  });
500
534
  }, true);
501
535
  if (!visibleVisualRows.length) {
@@ -508,7 +542,6 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
508
542
  this.hot.runHooks('afterFilter', conditions);
509
543
  this.hot.view.adjustElementsSize(true);
510
544
  this.hot.render();
511
- this.clearColumnSelection();
512
545
  }
513
546
 
514
547
  /**
@@ -532,20 +565,6 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
532
565
  };
533
566
  }
534
567
 
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
-
549
568
  /**
550
569
  * Returns handsontable source data with cell meta based on current selection.
551
570
  *
@@ -555,21 +574,21 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
555
574
  }, {
556
575
  key: "getDataMapAtColumn",
557
576
  value: function getDataMapAtColumn(column) {
558
- var _this5 = this;
577
+ var _this6 = this;
559
578
  var visualColumn = this.hot.toVisualColumn(column);
560
579
  var data = [];
561
580
  arrayEach(this.hot.getSourceDataAtCol(visualColumn), function (value, rowIndex) {
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;
581
+ var _this6$hot$getDataAtC;
582
+ var _this6$hot$getCellMet = _this6.hot.getCellMeta(rowIndex, visualColumn),
583
+ row = _this6$hot$getCellMet.row,
584
+ col = _this6$hot$getCellMet.col,
585
+ visualCol = _this6$hot$getCellMet.visualCol,
586
+ visualRow = _this6$hot$getCellMet.visualRow,
587
+ type = _this6$hot$getCellMet.type,
588
+ instance = _this6$hot$getCellMet.instance,
589
+ dateFormat = _this6$hot$getCellMet.dateFormat,
590
+ locale = _this6$hot$getCellMet.locale;
591
+ var dataValue = (_this6$hot$getDataAtC = _this6.hot.getDataAtCell(_this6.hot.toVisualRow(rowIndex), visualColumn)) !== null && _this6$hot$getDataAtC !== void 0 ? _this6$hot$getDataAtC : value;
573
592
  data.push({
574
593
  meta: {
575
594
  row: row,
@@ -596,14 +615,14 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
596
615
  }, {
597
616
  key: "onAfterChange",
598
617
  value: function onAfterChange(changes) {
599
- var _this6 = this;
618
+ var _this7 = this;
600
619
  if (changes) {
601
620
  arrayEach(changes, function (change) {
602
621
  var _change = _slicedToArray(change, 2),
603
622
  prop = _change[1];
604
- var columnIndex = _this6.hot.propToCol(prop);
605
- if (_this6.conditionCollection.hasConditions(columnIndex)) {
606
- _this6.updateValueComponentCondition(columnIndex);
623
+ var columnIndex = _this7.hot.propToCol(prop);
624
+ if (_this7.conditionCollection.hasConditions(columnIndex)) {
625
+ _this7.updateValueComponentCondition(columnIndex);
607
626
  }
608
627
  });
609
628
  }
@@ -674,10 +693,10 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
674
693
  }, {
675
694
  key: "onBeforeDropdownMenuSetItems",
676
695
  value: function onBeforeDropdownMenuSetItems() {
677
- var _this7 = this;
696
+ var _this8 = this;
678
697
  if (this.dropdownMenuPlugin) {
679
698
  this.dropdownMenuPlugin.menu.addLocalHook('afterOpen', function () {
680
- _this7.dropdownMenuPlugin.menu.hotMenu.updateSettings({
699
+ _this8.dropdownMenuPlugin.menu.hotMenu.updateSettings({
681
700
  hiddenRows: true
682
701
  });
683
702
  });
@@ -768,6 +787,7 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
768
787
  });
769
788
  this.filtersRowsMap.clear();
770
789
  this.filter();
790
+ this.hot.selectCell(0, selectedColumn.visualIndex);
771
791
  }
772
792
  (_this$dropdownMenuPlu3 = this.dropdownMenuPlugin) === null || _this$dropdownMenuPlu3 === void 0 ? void 0 : _this$dropdownMenuPlu3.close();
773
793
  }
@@ -860,10 +880,10 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
860
880
  }, {
861
881
  key: "_createDataFilter",
862
882
  value: function _createDataFilter() {
863
- var _this8 = this;
883
+ var _this9 = this;
864
884
  var conditionCollection = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.conditionCollection;
865
885
  return new DataFilter(conditionCollection, function (physicalColumn) {
866
- return _this8.getDataMapAtColumn(physicalColumn);
886
+ return _this9.getDataMapAtColumn(physicalColumn);
867
887
  });
868
888
  }
869
889
 
@@ -995,12 +1015,12 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
995
1015
  }, {
996
1016
  key: "destroy",
997
1017
  value: function destroy() {
998
- var _this9 = this;
1018
+ var _this10 = this;
999
1019
  if (this.enabled) {
1000
1020
  this.components.forEach(function (component, key) {
1001
1021
  if (component !== null) {
1002
1022
  component.destroy();
1003
- _this9.components.set(key, null);
1023
+ _this10.components.set(key, null);
1004
1024
  }
1005
1025
  });
1006
1026
  this.conditionCollection.destroy();
@@ -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
+ };
@@ -243,5 +243,10 @@ 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
+ }
246
251
  }], config);
247
252
  }
@@ -239,5 +239,10 @@ 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
+ }
242
247
  }], config);
243
248
  }
package/tableView.js CHANGED
@@ -356,14 +356,11 @@ 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
359
360
  selection.finish();
360
361
  }
361
362
  priv.mouseDown = false;
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)) {
363
+ if ((0, _element.isOutsideInput)(rootDocument.activeElement) || !selection.isSelected() && !selection.isSelectedByAnyHeader() && !rootElement.contains(event.target) && !(0, _event.isRightClick)(event)) {
367
364
  _this.instance.unlisten();
368
365
  }
369
366
  });
package/tableView.mjs CHANGED
@@ -351,14 +351,11 @@ 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
354
355
  selection.finish();
355
356
  }
356
357
  priv.mouseDown = false;
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)) {
358
+ if (isOutsideInput(rootDocument.activeElement) || !selection.isSelected() && !selection.isSelectedByAnyHeader() && !rootElement.contains(event.target) && !isRightClick(event)) {
362
359
  _this.instance.unlisten();
363
360
  }
364
361
  });
@@ -28,8 +28,6 @@ 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;
33
31
  getNearestNotHiddenIndex(fromVisualIndex: number, searchDirection: 1|-1,
34
32
  searchAlsoOtherWayAround?: boolean): number | null;
35
33
  initToLength(length?: number): void;