mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 11:46:42 +00:00
Trim search inputs (#20825)
This commit is contained in:
parent
ae9e1b724f
commit
2113cf5280
@ -407,7 +407,7 @@ export class HaEntityPicker extends LitElement {
|
||||
|
||||
private _valueChanged(ev: ValueChangedEvent<string>) {
|
||||
ev.stopPropagation();
|
||||
const newValue = ev.detail.value;
|
||||
const newValue = ev.detail.value.trim();
|
||||
|
||||
if (newValue && newValue.startsWith(CREATE_ID)) {
|
||||
const domain = newValue.substring(CREATE_ID.length);
|
||||
@ -427,7 +427,7 @@ export class HaEntityPicker extends LitElement {
|
||||
|
||||
private _filterChanged(ev: CustomEvent): void {
|
||||
const target = ev.target as HaComboBox;
|
||||
const filterString = ev.detail.value.toLowerCase();
|
||||
const filterString = ev.detail.value.trim().toLowerCase();
|
||||
target.filteredItems = filterString.length
|
||||
? fuzzyFilterSort<HassEntityWithCachedName>(filterString, this._states)
|
||||
: this._states;
|
||||
|
@ -79,7 +79,7 @@ class SearchInputOutlined extends LitElement {
|
||||
}
|
||||
|
||||
private async _filterInputChanged(e) {
|
||||
this._filterChanged(e.target.value);
|
||||
this._filterChanged(e.target.value?.trim());
|
||||
}
|
||||
|
||||
private async _clearSearch() {
|
||||
|
@ -67,7 +67,7 @@ class SearchInput extends LitElement {
|
||||
}
|
||||
|
||||
private async _filterInputChanged(e) {
|
||||
this._filterChanged(e.target.value);
|
||||
this._filterChanged(e.target.value?.trim());
|
||||
}
|
||||
|
||||
private async _clearSearch() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user