@trudb/tru-common-lib 0.0.891 → 0.0.892

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.
@@ -4949,6 +4949,35 @@ class TruDesktopWindow {
4949
4949
  *
4950
4950
  */
4951
4951
  onKeydown = (event) => {
4952
+ if (!this.window.active)
4953
+ return;
4954
+ if (event.altKey)
4955
+ event.preventDefault();
4956
+ var keySequence = this.desktopCtrl.getKeySequence(event);
4957
+ if (keySequence === 'ctrl+shift+s' || keySequence === 'meta+shift+s') { //Restore
4958
+ this.save();
4959
+ event.preventDefault();
4960
+ }
4961
+ if (keySequence === 'ctrl+shift+r' || keySequence === 'meta+shift+r') { //Save
4962
+ this.revert();
4963
+ event.preventDefault();
4964
+ }
4965
+ if (keySequence === 'alt+left') { //Previous View
4966
+ this.previousView();
4967
+ event.preventDefault();
4968
+ }
4969
+ if (keySequence === 'alt+right') { //Next View
4970
+ this.nextView();
4971
+ event.preventDefault();
4972
+ }
4973
+ if (keySequence === 'alt+up') { //First View
4974
+ this.firstView();
4975
+ event.preventDefault();
4976
+ }
4977
+ if (keySequence === 'alt+down') { //Last View
4978
+ this.lastView();
4979
+ event.preventDefault();
4980
+ }
4952
4981
  };
4953
4982
  /**
4954
4983
  * @tru.doc watch
@@ -5046,6 +5075,7 @@ class TruDesktopWindow {
5046
5075
  this.subs.push(this.truWindowEventHandler.onSetWindowTitle().subscribe((windowTitle) => {
5047
5076
  this.setWindowTitle(windowTitle);
5048
5077
  }));
5078
+ window.addEventListener('keydown', this.onKeydown);
5049
5079
  }
5050
5080
  ngAfterViewInit() {
5051
5081
  this.cd.detectChanges();
@@ -5053,6 +5083,7 @@ class TruDesktopWindow {
5053
5083
  ngOnDestroy() {
5054
5084
  document.removeEventListener('mousemove', this.mouseMove);
5055
5085
  document.removeEventListener('mouseup', this.mouseUp);
5086
+ window.removeEventListener('keydown', this.onKeydown);
5056
5087
  window.removeEventListener('resize', this.resizeEventHandler);
5057
5088
  this.subs.forEach(s => s.unsubscribe());
5058
5089
  }
@@ -5893,34 +5924,6 @@ class TruDesktop {
5893
5924
  this.closeWindow(activeWindow);
5894
5925
  event.preventDefault();
5895
5926
  }
5896
- if (keySequence === 'alt+left') { //Previous View
5897
- var activeWindow = this.getActiveWindow();
5898
- if (!activeWindow)
5899
- return;
5900
- activeWindow.previousView();
5901
- event.preventDefault();
5902
- }
5903
- if (keySequence === 'alt+right') { //Next View
5904
- var activeWindow = this.getActiveWindow();
5905
- if (!activeWindow)
5906
- return;
5907
- activeWindow.nextView();
5908
- event.preventDefault();
5909
- }
5910
- if (keySequence === 'alt+up') { //First View
5911
- var activeWindow = this.getActiveWindow();
5912
- if (!activeWindow)
5913
- return;
5914
- activeWindow.firstView();
5915
- event.preventDefault();
5916
- }
5917
- if (keySequence === 'alt+down') { //Last View
5918
- var activeWindow = this.getActiveWindow();
5919
- if (!activeWindow)
5920
- return;
5921
- activeWindow.lastView();
5922
- event.preventDefault();
5923
- }
5924
5927
  if (keySequence === 'alt+l') { //Maximize left
5925
5928
  var activeWindow = this.getActiveWindow();
5926
5929
  if (!activeWindow.maximized) {
@@ -5945,16 +5948,6 @@ class TruDesktop {
5945
5948
  this.restoreSavedPosition(activeWindow);
5946
5949
  event.preventDefault();
5947
5950
  }
5948
- if (keySequence === 'ctrl+shift+s' || keySequence === 'meta+shift+s') { //Restore
5949
- var activeWindow = this.getActiveWindow();
5950
- activeWindow.save();
5951
- event.preventDefault();
5952
- }
5953
- if (keySequence === 'ctrl+shift+r' || keySequence === 'meta+shift+r') { //Save
5954
- var activeWindow = this.getActiveWindow();
5955
- activeWindow.revert();
5956
- event.preventDefault();
5957
- }
5958
5951
  if (keySequence === 'alt+d') { //Toggle Desktop
5959
5952
  //this.desktopShown = this.hideShowAll();
5960
5953
  event.preventDefault();