add button to clear search

This commit is contained in:
marlon-erler
2026-09-21 20:55:52 +02:00
parent dac38c3d12
commit ea422b3de6
9 changed files with 22 additions and 2 deletions
Binary file not shown.
Binary file not shown.
+8
View File
@@ -18,6 +18,10 @@ export default class SearchViewModel<T> {
[this.searchInput, this.appliedQuery],
() => this.searchInput.value == this.appliedQuery.value,
);
cannotClear: React.State<boolean> = React.createProxyState(
[this.searchInput],
() => this.searchInput.value == "",
);
// methods
search = (searchTerm: string): void => {
@@ -37,6 +41,10 @@ export default class SearchViewModel<T> {
}
};
clear = (): void => {
this.searchInput.value = "";
}
// init
constructor(
allObjects: React.ListState<T> | React.MapState<T>,