vue2-excel-grid 2.2.1 → 2.2.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-excel-grid",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "Excel-style grid component for Vue 2.6.14 with virtual scrolling",
5
5
  "license": "MIT",
6
6
  "author": "Fozilbek Raimberdiyev",
@@ -3648,46 +3648,57 @@ const ExcelGridComponent = {
3648
3648
  return
3649
3649
  }
3650
3650
  const key = e.key
3651
-
3652
- if ((e.ctrlKey || e.metaKey) && key === 'z' && !e.shiftKey) {
3651
+ // Layout-independent letter for the Ctrl/Cmd shortcuts below (z/y/a/c/x/v/d/r).
3652
+ // e.key reports the character a layout PRODUCES — on a non-Latin layout
3653
+ // (Cyrillic, etc.) the physical C key can report e.key: 'с' (Cyrillic es)
3654
+ // even with Ctrl held and the physical key/position unchanged, silently
3655
+ // breaking `key === 'c'`. e.code is the physical key position and is
3656
+ // immune to layout, so it's used here instead wherever available;
3657
+ // falls back to e.key when e.code is missing (e.g. synthetic events in
3658
+ // tests that don't set it).
3659
+ const shortcutKey = (e.code && e.code.length === 4 && e.code.slice(0, 3) === 'Key')
3660
+ ? e.code.charAt(3).toLowerCase()
3661
+ : key
3662
+
3663
+ if ((e.ctrlKey || e.metaKey) && shortcutKey === 'z' && !e.shiftKey) {
3653
3664
  e.preventDefault()
3654
3665
  this.undo()
3655
3666
  return
3656
3667
  }
3657
- if ((e.ctrlKey || e.metaKey) && (key === 'y' || (key === 'z' && e.shiftKey))) {
3668
+ if ((e.ctrlKey || e.metaKey) && (shortcutKey === 'y' || (shortcutKey === 'z' && e.shiftKey))) {
3658
3669
  e.preventDefault()
3659
3670
  this.redo()
3660
3671
  return
3661
3672
  }
3662
3673
 
3663
- if (key === 'a' && (e.ctrlKey || e.metaKey)) {
3674
+ if (shortcutKey === 'a' && (e.ctrlKey || e.metaKey)) {
3664
3675
  e.preventDefault()
3665
3676
  this.selectAll()
3666
3677
  return
3667
3678
  }
3668
3679
 
3669
- if (key === 'c' && (e.ctrlKey || e.metaKey)) {
3680
+ if (shortcutKey === 'c' && (e.ctrlKey || e.metaKey)) {
3670
3681
  e.preventDefault()
3671
3682
  this.copySelection()
3672
3683
  return
3673
3684
  }
3674
- if (key === 'x' && (e.ctrlKey || e.metaKey)) {
3685
+ if (shortcutKey === 'x' && (e.ctrlKey || e.metaKey)) {
3675
3686
  e.preventDefault()
3676
3687
  this.cutSelection()
3677
3688
  return
3678
3689
  }
3679
- if (key === 'v' && (e.ctrlKey || e.metaKey)) {
3690
+ if (shortcutKey === 'v' && (e.ctrlKey || e.metaKey)) {
3680
3691
  e.preventDefault()
3681
3692
  this.pasteAt(this.activeCell.row, this.activeCell.col)
3682
3693
  return
3683
3694
  }
3684
3695
 
3685
- if (key === 'd' && (e.ctrlKey || e.metaKey)) {
3696
+ if (shortcutKey === 'd' && (e.ctrlKey || e.metaKey)) {
3686
3697
  e.preventDefault()
3687
3698
  this.fillDown()
3688
3699
  return
3689
3700
  }
3690
- if (key === 'r' && (e.ctrlKey || e.metaKey)) {
3701
+ if (shortcutKey === 'r' && (e.ctrlKey || e.metaKey)) {
3691
3702
  e.preventDefault()
3692
3703
  this.fillRight()
3693
3704
  return