@cqa-lib/cqa-ui 1.0.89 → 1.0.90
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.
- package/esm2020/lib/dynamic-select/dynamic-select-field.component.mjs +38 -1
- package/fesm2015/cqa-lib-cqa-ui.mjs +39 -1
- package/fesm2015/cqa-lib-cqa-ui.mjs.map +1 -1
- package/fesm2020/cqa-lib-cqa-ui.mjs +37 -0
- package/fesm2020/cqa-lib-cqa-ui.mjs.map +1 -1
- package/lib/dynamic-select/dynamic-select-field.component.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1513,6 +1513,24 @@ class DynamicSelectFieldComponent {
|
|
|
1513
1513
|
this.searchTextByKey = {};
|
|
1514
1514
|
this.lastOptionsLength = 0;
|
|
1515
1515
|
this.loadingMore = false;
|
|
1516
|
+
this.onPanelScroll = () => {
|
|
1517
|
+
if (!this.config?.hasMore || this.loadingMore)
|
|
1518
|
+
return;
|
|
1519
|
+
const el = this.panelScrollEl;
|
|
1520
|
+
if (!el)
|
|
1521
|
+
return;
|
|
1522
|
+
const nearBottom = el.scrollTop + el.clientHeight >= el.scrollHeight - 48; // ~3 option rows
|
|
1523
|
+
if (nearBottom) {
|
|
1524
|
+
this.loadingMore = true;
|
|
1525
|
+
const key = this.config?.key || '';
|
|
1526
|
+
const q = this.searchTextByKey[key] || '';
|
|
1527
|
+
this.loadMore.emit({ key, query: q });
|
|
1528
|
+
try {
|
|
1529
|
+
this.config.onLoadMore?.(q);
|
|
1530
|
+
}
|
|
1531
|
+
catch { }
|
|
1532
|
+
}
|
|
1533
|
+
};
|
|
1516
1534
|
}
|
|
1517
1535
|
ngOnInit() {
|
|
1518
1536
|
if (!this.config || !this.config.key) {
|
|
@@ -1719,6 +1737,14 @@ class DynamicSelectFieldComponent {
|
|
|
1719
1737
|
catch { }
|
|
1720
1738
|
this.loadMoreObserver = undefined;
|
|
1721
1739
|
}
|
|
1740
|
+
// Remove scroll listener if attached
|
|
1741
|
+
if (this.panelScrollEl) {
|
|
1742
|
+
try {
|
|
1743
|
+
this.panelScrollEl.removeEventListener('scroll', this.onPanelScroll);
|
|
1744
|
+
}
|
|
1745
|
+
catch { }
|
|
1746
|
+
this.panelScrollEl = undefined;
|
|
1747
|
+
}
|
|
1722
1748
|
return;
|
|
1723
1749
|
}
|
|
1724
1750
|
// Focus the search box if enabled
|
|
@@ -1740,6 +1766,17 @@ class DynamicSelectFieldComponent {
|
|
|
1740
1766
|
}
|
|
1741
1767
|
// Setup infinite scroll observer on sentinel
|
|
1742
1768
|
setTimeout(() => this.setupLoadMoreObserver(), 0);
|
|
1769
|
+
// Also attach a scroll listener fallback for reliable load-more triggers
|
|
1770
|
+
setTimeout(() => {
|
|
1771
|
+
try {
|
|
1772
|
+
const panels = Array.from(document.querySelectorAll('.mat-select-panel'));
|
|
1773
|
+
this.panelScrollEl = panels.length ? panels[panels.length - 1] : undefined;
|
|
1774
|
+
if (this.panelScrollEl) {
|
|
1775
|
+
this.panelScrollEl.addEventListener('scroll', this.onPanelScroll, { passive: true });
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
catch { }
|
|
1779
|
+
}, 0);
|
|
1743
1780
|
}
|
|
1744
1781
|
onSearch(key, value) {
|
|
1745
1782
|
this.searchTextByKey[key] = value ?? '';
|