@porscheinformatik/clr-addons 15.2.0 → 15.2.1

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.
@@ -636,7 +636,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
636
636
  }] });
637
637
 
638
638
  /*
639
- * Copyright (c) 2018-2022 Porsche Informatik. All Rights Reserved.
639
+ * Copyright (c) 2018-2023 Porsche Informatik. All Rights Reserved.
640
640
  * This software is released under MIT license.
641
641
  * The full license information can be found in LICENSE in the root directory of this project.
642
642
  */
@@ -646,8 +646,9 @@ class ClrDropdownOverflowDirective {
646
646
  this.defaultItemMinHeightRem = 1.5;
647
647
  this.marginBottomRem = 0.1;
648
648
  this.destroy$ = new Subject();
649
+ this.alreadyChecked = false;
649
650
  }
650
- ngAfterContentInit() {
651
+ ngAfterContentChecked() {
651
652
  // first trigger manually because the subscription lower only triggers after first change
652
653
  if (!this.nestedDropdownChildren?.length) {
653
654
  this.applyDropdownOverflowStyles();
@@ -669,14 +670,17 @@ class ClrDropdownOverflowDirective {
669
670
  applyDropdownOverflowStyles() {
670
671
  // the vertical position of our element in the current window
671
672
  const y = this.elRef.nativeElement.getBoundingClientRect().y;
672
- const itemMinHeightPx = this.getItemMinHeight(this.clrDropdownMenuItemMinHeight);
673
- // see https://stackoverflow.com/questions/22754315/for-loop-for-htmlcollection-elements
674
- for (const item of this.getAllChildDropdownMenuItems()) {
675
- item.style.minHeight = itemMinHeightPx + 'px';
673
+ if (y !== 0 && !this.alreadyChecked) {
674
+ const itemMinHeightPx = this.getItemMinHeight(this.clrDropdownMenuItemMinHeight);
675
+ // see https://stackoverflow.com/questions/22754315/for-loop-for-htmlcollection-elements
676
+ for (const item of this.getAllChildDropdownMenuItems()) {
677
+ item.style.minHeight = itemMinHeightPx + 'px';
678
+ }
679
+ this.elRef.nativeElement.style.maxHeight =
680
+ this.getMenuMaxHeight(this.clrDropdownMenuMaxHeight, window.innerHeight - y - this.convertRemToPixels(this.marginBottomRem)) + 'px';
681
+ this.elRef.nativeElement.style.overflowY = 'auto';
682
+ this.alreadyChecked = true;
676
683
  }
677
- this.elRef.nativeElement.style.maxHeight =
678
- this.getMenuMaxHeight(this.clrDropdownMenuMaxHeight, window.innerHeight - y - this.convertRemToPixels(this.marginBottomRem)) + 'px';
679
- this.elRef.nativeElement.style.overflowY = 'auto';
680
684
  }
681
685
  removeDropdownOverflowStyles() {
682
686
  for (const item of this.getAllChildDropdownMenuItems()) {