@ngrdt/menu 0.0.69 → 0.0.72

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.
@@ -11,7 +11,7 @@ import * as i3 from '@ngrdt/router';
11
11
  import { RdtRouterService, RdtAnyRouteActiveDirective } from '@ngrdt/router';
12
12
  import * as i4 from '@ngrdt/shortcuts';
13
13
  import { RdtShortcutService, RdtShortcut, RdtKeyListenerDirective } from '@ngrdt/shortcuts';
14
- import { RdtStringUtils, KB_CODE, RdtObjectUtils, RdtDomUtils } from '@ngrdt/utils';
14
+ import { RdtStringUtils, KB_CODE, RdtObjectUtils } from '@ngrdt/utils';
15
15
  import { delay, of, map, first, merge, fromEvent, throttleTime, animationFrameScheduler, switchMap, withLatestFrom } from 'rxjs';
16
16
  import { RDT_BUTTON_BASE_PROVIDER } from '@ngrdt/button';
17
17
 
@@ -306,6 +306,7 @@ class RdtMenuOverlayComponent {
306
306
  return this.topLevelMenu.bodyMargin.top;
307
307
  }
308
308
  getMaxOffsetTop() {
309
+ console.log(this.item().label, this.topLevelMenu.clientSize.height, this._box.height, this.topLevelMenu.bodyMargin.bottom);
309
310
  return (this.topLevelMenu.clientSize.height -
310
311
  this._box.height -
311
312
  this.topLevelMenu.bodyMargin.bottom);
@@ -803,9 +804,9 @@ class RdtMenuBaseComponent {
803
804
  }
804
805
  });
805
806
  get clientSize() {
806
- return this._clientSize;
807
+ return this._windowSize;
807
808
  }
808
- _clientSize;
809
+ _windowSize;
809
810
  get bodyMargin() {
810
811
  return this._bodyMargin;
811
812
  }
@@ -833,10 +834,14 @@ class RdtMenuBaseComponent {
833
834
  constructor() {
834
835
  this.listenShortcuts();
835
836
  afterNextRender(() => {
836
- this.listenResizeScroll();
837
+ this.listenWindowResizeScroll();
837
838
  this.measure();
838
839
  this.recalculateChildren();
839
840
  });
841
+ setTimeout(() => {
842
+ this.measure();
843
+ this.recalculateChildren();
844
+ }, 1000);
840
845
  }
841
846
  recalcChildrenEffect = effect(() => this.recalculateChildren());
842
847
  recalculateChildren() {
@@ -1047,6 +1052,7 @@ class RdtMenuBaseComponent {
1047
1052
  this.measureButtonContainer();
1048
1053
  this.measureClientSize();
1049
1054
  this.readMargin();
1055
+ console.log('containerRect', this.buttonContainerRect);
1050
1056
  }
1051
1057
  readMargin() {
1052
1058
  const computedStyle = getComputedStyle(this.elRef.nativeElement);
@@ -1062,9 +1068,9 @@ class RdtMenuBaseComponent {
1062
1068
  };
1063
1069
  }
1064
1070
  measureClientSize() {
1065
- this._clientSize = {
1066
- width: this.document.body.clientWidth,
1067
- height: this.document.body.clientHeight,
1071
+ this._windowSize = {
1072
+ width: window.innerWidth,
1073
+ height: window.innerHeight,
1068
1074
  };
1069
1075
  }
1070
1076
  measureButtonContainer() {
@@ -1076,9 +1082,8 @@ class RdtMenuBaseComponent {
1076
1082
  this._buttonContainerRect = undefined;
1077
1083
  }
1078
1084
  }
1079
- listenResizeScroll() {
1080
- const element = this.elRef.nativeElement;
1081
- merge(RdtDomUtils.getResizeEvent$(element), fromEvent(window, 'scroll'))
1085
+ listenWindowResizeScroll() {
1086
+ merge(fromEvent(window, 'resize'), fromEvent(window, 'scroll'))
1082
1087
  .pipe(throttleTime(0, animationFrameScheduler, { trailing: true }), takeUntilDestroyed(this.destroyRef))
1083
1088
  .subscribe(() => {
1084
1089
  this.measure();