Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

fix enter select

jonaswinkler7beb8a092996
diff --git a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.ts b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.ts
index 8fb2d25d9..e06f0d638 100644
--- a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.ts
+++ b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.ts
@@ -196,7 +196,9 @@ export class FilterableDropdownComponent {
setTimeout(() => {
this.listFilterTextInput.nativeElement.focus();
}, 0)
- this.selectionModel.reset()
+ if (this.editing) {
+ this.selectionModel.reset()
+ }
this.open.next()
} else {
this.filterText = ''
@@ -204,12 +206,14 @@ export class FilterableDropdownComponent {
}
listFilterEnter(): void {
- // let filtered = this.filterPipe.transform(this.toggleableItems, this.filterText)
- // if (filtered.length == 1) {
- // let toggleableItem = this.toggleableItems.find(ti => ti.item.id == filtered[0].item.id)
- // if (toggleableItem) toggleableItem.state = ToggleableItemState.Selected
- // this.toggleItem(filtered[0])
- // this.dropdown.close()
- // }
+ let filtered = this.filterPipe.transform(this.items, this.filterText)
+ if (filtered.length == 1) {
+ this.selectionModel.toggle(filtered[0].id)
+ if (this.editing) {
+ this.applyClicked()
+ } else {
+ this.dropdown.close()
+ }
+ }
}
}
diff --git a/src-ui/src/app/pipes/filter.pipe.ts b/src-ui/src/app/pipes/filter.pipe.ts
index 8465f1533..d83ccc07a 100644
--- a/src-ui/src/app/pipes/filter.pipe.ts
+++ b/src-ui/src/app/pipes/filter.pipe.ts
@@ -6,7 +6,7 @@ import { MatchingModel } from '../data/matching-model';
name: 'filter'
})
export class FilterPipe implements PipeTransform {
- transform(items: MatchingModel[], searchText: string): any[] {
+ transform(items: MatchingModel[], searchText: string): MatchingModel[] {
if (!items) return [];
if (!searchText) return items;