diff --git a/packages/fiori/cypress/specs/SearchField.cy.tsx b/packages/fiori/cypress/specs/SearchField.cy.tsx
index db80dffd555b..aa35f8dc8ac2 100644
--- a/packages/fiori/cypress/specs/SearchField.cy.tsx
+++ b/packages/fiori/cypress/specs/SearchField.cy.tsx
@@ -507,4 +507,44 @@ describe("SearchField general interaction", () => {
.should("not.exist");
});
});
+
+ describe("Field Loading", () => {
+ it("shows loading indicator on button in collapsed mode", () => {
+ cy.mount();
+
+ cy.get("[ui5-search-field]")
+ .shadow()
+ .find("[ui5-button]")
+ .should("have.attr", "loading");
+ });
+
+ it("does not show loading indicator on button when fieldLoading is false in collapsed mode", () => {
+ cy.mount();
+
+ cy.get("[ui5-search-field]")
+ .shadow()
+ .find("[ui5-button]")
+ .should("not.have.attr", "loading");
+ });
+
+ it("shows BusyIndicator in expanded mode when fieldLoading is true", () => {
+ cy.mount();
+
+ cy.get("[ui5-search-field]")
+ .shadow()
+ .find("[ui5-busy-indicator]")
+ .should("exist")
+ .should("have.attr", "active");
+ });
+
+ it("BusyIndicator is not active in expanded mode when fieldLoading is false", () => {
+ cy.mount();
+
+ cy.get("[ui5-search-field]")
+ .shadow()
+ .find("[ui5-busy-indicator]")
+ .should("exist")
+ .should("not.have.attr", "active");
+ });
+ });
});
diff --git a/packages/fiori/src/SearchField.ts b/packages/fiori/src/SearchField.ts
index 4956195e1b9d..7e12153a94cb 100644
--- a/packages/fiori/src/SearchField.ts
+++ b/packages/fiori/src/SearchField.ts
@@ -101,6 +101,15 @@ class SearchField extends UI5Element {
"scope-change": SearchFieldScopeSelectionChangeDetails,
}
+ /**
+ * Indicates whether a loading indicator should be shown in the input field.
+ * @default false
+ * @since 2.19.0
+ * @public
+ */
+ @property({ type: Boolean })
+ fieldLoading = false
+
/**
* Defines whether the clear icon of the search will be shown.
* @default false
diff --git a/packages/fiori/src/SearchFieldTemplate.tsx b/packages/fiori/src/SearchFieldTemplate.tsx
index 89b78de79d01..df9e0b00cae8 100644
--- a/packages/fiori/src/SearchFieldTemplate.tsx
+++ b/packages/fiori/src/SearchFieldTemplate.tsx
@@ -6,6 +6,7 @@ import type SearchField from "./SearchField.js";
import decline from "@ui5/webcomponents-icons/dist/decline.js";
import search from "@ui5/webcomponents-icons/dist/search.js";
import ButtonDesign from "@ui5/webcomponents/dist/types/ButtonDesign.js";
+import BusyIndicator from "@ui5/webcomponents/dist/BusyIndicator.js";
export type SearchFieldTemplateOptions = {
/**
@@ -22,81 +23,84 @@ export default function SearchFieldTemplate(this: SearchField, options?: SearchF
icon={search}
design={ButtonDesign.Transparent}
data-sap-focus-ref
+ loading={this.fieldLoading}
onClick={this._handleSearchIconPress}
tooltip={this._effectiveIconTooltip}
accessibleName={this._effectiveIconTooltip}
accessibilityAttributes={this._searchButtonAccessibilityAttributes}
>
) : (
-
-
- {this.scopes?.length ? (
- <>
-
-
- >
- ) : this.filterButton?.length ? (
- <>
-
-
-
-
- >
- ) : null}
+
+
+
+ {this.scopes?.length ? (
+ <>
+
+
+ >
+ ) : this.filterButton?.length ? (
+ <>
+
+
+
+
+ >
+ ) : null}
-
+
+
+ {this._effectiveShowClearIcon &&
+
+ }
- {this._effectiveShowClearIcon &&
- }
-
-
+
-
+
)
);
}
diff --git a/packages/fiori/src/themes/SearchField.css b/packages/fiori/src/themes/SearchField.css
index 40ab2f434d2a..2794d8cfa3c9 100644
--- a/packages/fiori/src/themes/SearchField.css
+++ b/packages/fiori/src/themes/SearchField.css
@@ -25,6 +25,12 @@
position: relative;
}
+.ui5-search-field-busy-indicator {
+ width: 100%;
+ height: 100%;
+ border-radius: var(--_ui5_search_input_border_radius);
+}
+
.ui5-shellbar-search-field-wrapper {
flex: 1;
min-width: auto;
diff --git a/packages/fiori/test/pages/Search.html b/packages/fiori/test/pages/Search.html
index e05957aaeef8..e68a0e770df8 100644
--- a/packages/fiori/test/pages/Search.html
+++ b/packages/fiori/test/pages/Search.html
@@ -253,6 +253,11 @@
+
+ Search with field loading state (type and press Enter)
+
+
+
Search with lazy loaded Suggestions - Autocomplete and highlighting
@@ -450,6 +455,15 @@
}, 300);
}
});
+
+ const searchWithLoading = document.getElementById('search-with-loading');
+ searchWithLoading.addEventListener('ui5-search', async (e) => {
+ if (e.target.value) {
+ e.target.fieldLoading = true;
+ await new Promise(resolve => setTimeout(resolve, 2000));
+ e.target.fieldLoading = false;
+ }
+ });