@tetacom/ng-components 1.0.105 → 1.0.107

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.
@@ -1231,6 +1231,11 @@ class DropdownBase {
1231
1231
  this._backdrop = null;
1232
1232
  this._open = false;
1233
1233
  this._alive = true;
1234
+ this.scrollListener = () => {
1235
+ if (this.open && this._head?.nativeElement && this._body) {
1236
+ this.setPosition(this._head.nativeElement, this._body);
1237
+ }
1238
+ };
1234
1239
  this._zone.onStable
1235
1240
  .pipe(takeWhile((_) => this._alive), throttleTime(10, undefined, { trailing: true }))
1236
1241
  .subscribe((_) => {
@@ -1242,6 +1247,7 @@ class DropdownBase {
1242
1247
  });
1243
1248
  }
1244
1249
  });
1250
+ this.addScrollListener();
1245
1251
  }
1246
1252
  set open(val) {
1247
1253
  if (val != null && val !== this._open && !this.disabled) {
@@ -1302,6 +1308,12 @@ class DropdownBase {
1302
1308
  this.closeDropdown();
1303
1309
  }
1304
1310
  }
1311
+ addScrollListener() {
1312
+ window.addEventListener('scroll', this.scrollListener, true);
1313
+ }
1314
+ removeScrollListener() {
1315
+ window.removeEventListener('scroll', this.scrollListener, true);
1316
+ }
1305
1317
  closeDropdown() {
1306
1318
  if (this.open && this._body && this.container.contains(this._body)) {
1307
1319
  this._renderer.removeChild(this.container, this._body);
@@ -1427,6 +1439,7 @@ class DropdownComponent extends DropdownBase {
1427
1439
  ngOnInit() { }
1428
1440
  ngOnDestroy() {
1429
1441
  this.closeDropdown();
1442
+ this.removeScrollListener();
1430
1443
  this._alive = false;
1431
1444
  }
1432
1445
  }
@@ -2572,6 +2585,7 @@ class DropdownDirective extends DropdownBase {
2572
2585
  }
2573
2586
  ngOnDestroy() {
2574
2587
  this.closeDropdown();
2588
+ this.removeScrollListener();
2575
2589
  this._alive = false;
2576
2590
  }
2577
2591
  ngAfterViewInit() {