osl-base-extended 1.1.45 → 1.1.47
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.
|
@@ -1607,11 +1607,23 @@ class OslAutocomplete extends baseComponent {
|
|
|
1607
1607
|
dropdownStyle = {};
|
|
1608
1608
|
filteredItems = [];
|
|
1609
1609
|
touched = false;
|
|
1610
|
+
scrollHandler = (event) => {
|
|
1611
|
+
if (!this._showDropdown)
|
|
1612
|
+
return;
|
|
1613
|
+
const dropdown = this.elRef.nativeElement.querySelector('.dropdown');
|
|
1614
|
+
if (dropdown && dropdown.contains(event.target))
|
|
1615
|
+
return;
|
|
1616
|
+
this._showDropdown = false;
|
|
1617
|
+
this.cdr.markForCheck();
|
|
1618
|
+
};
|
|
1610
1619
|
constructor(elRef, cdr) {
|
|
1611
1620
|
super();
|
|
1612
1621
|
this.elRef = elRef;
|
|
1613
1622
|
this.cdr = cdr;
|
|
1614
1623
|
}
|
|
1624
|
+
ngOnDestroy() {
|
|
1625
|
+
document.removeEventListener('scroll', this.scrollHandler, true);
|
|
1626
|
+
}
|
|
1615
1627
|
updateDropdownPosition() {
|
|
1616
1628
|
const wrapper = this.elRef.nativeElement.querySelector('.autocomplete-wrapper');
|
|
1617
1629
|
if (!wrapper)
|
|
@@ -1643,6 +1655,7 @@ class OslAutocomplete extends baseComponent {
|
|
|
1643
1655
|
});
|
|
1644
1656
|
}
|
|
1645
1657
|
ngOnInit() {
|
|
1658
|
+
document.addEventListener('scroll', this.scrollHandler, { capture: true, passive: true });
|
|
1646
1659
|
if (this.searchType === 'Api' && this.methodName && this.service) {
|
|
1647
1660
|
this.placeholder = this.isLister ? 'Type to Search Or Press Enter' : 'Type to Search';
|
|
1648
1661
|
// Fix: [formControl] already updates inputControl on user input, so valueChanges
|