@mozaic-ds/angular 2.0.20 → 2.0.21
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.
|
@@ -10617,6 +10617,9 @@ class MozComboboxComponent {
|
|
|
10617
10617
|
_labelCache = new Map();
|
|
10618
10618
|
/** Tracks whether items have ever been provided (distinguishes async-on-demand from pre-loaded) */
|
|
10619
10619
|
_hasReceivedItems = signal(false, ...(ngDevMode ? [{ debugName: "_hasReceivedItems" }] : []));
|
|
10620
|
+
/** True while waiting for external search results (prevents empty-state flash during debounce) */
|
|
10621
|
+
_searchPending = signal(false, ...(ngDevMode ? [{ debugName: "_searchPending" }] : []));
|
|
10622
|
+
_searchPendingTimer = null;
|
|
10620
10623
|
/** CVA callbacks */
|
|
10621
10624
|
_onChange = () => { };
|
|
10622
10625
|
_onTouched = () => { };
|
|
@@ -10723,6 +10726,7 @@ class MozComboboxComponent {
|
|
|
10723
10726
|
/** Whether to display the empty-state message (no results) */
|
|
10724
10727
|
showEmptyState = computed(() => this.filteredItems().length === 0 &&
|
|
10725
10728
|
!this.loading() &&
|
|
10729
|
+
!this._searchPending() &&
|
|
10726
10730
|
(this._hasReceivedItems() || this.searchQuery() !== ''), ...(ngDevMode ? [{ debugName: "showEmptyState" }] : []));
|
|
10727
10731
|
/** Viewport height: capped to VIEWPORT_HEIGHT_PX, shrinks for small lists */
|
|
10728
10732
|
viewportHeight = computed(() => {
|
|
@@ -10792,8 +10796,19 @@ class MozComboboxComponent {
|
|
|
10792
10796
|
}
|
|
10793
10797
|
if (flat.length > 0) {
|
|
10794
10798
|
this._hasReceivedItems.set(true);
|
|
10799
|
+
this._searchPending.set(false);
|
|
10795
10800
|
}
|
|
10796
10801
|
});
|
|
10802
|
+
// In externalSearch mode, mark search as pending when query changes
|
|
10803
|
+
// to give the consumer time to respond (debounce) before showing empty state.
|
|
10804
|
+
effect(() => {
|
|
10805
|
+
if (!this.externalSearch())
|
|
10806
|
+
return;
|
|
10807
|
+
this._searchPending.set(true);
|
|
10808
|
+
if (this._searchPendingTimer)
|
|
10809
|
+
clearTimeout(this._searchPendingTimer);
|
|
10810
|
+
this._searchPendingTimer = setTimeout(() => this._searchPending.set(false), 500);
|
|
10811
|
+
});
|
|
10797
10812
|
// Inject global overlay styles — CDK teleports content outside the
|
|
10798
10813
|
// component host so scoped CSS never reaches .cdk-overlay-pane.
|
|
10799
10814
|
// Check DOM each render — Storybook may remove the tag on navigation.
|