mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-11 17:17:26 +01:00
Add back plus button which retains filter text
This commit is contained in:
parent
026c213ea4
commit
ec4ec41552
5 changed files with 89 additions and 21 deletions
|
|
@ -39,6 +39,8 @@ export class SelectComponent extends AbstractInputComponent<number> {
|
|||
|
||||
public addItemRef: (name) => void
|
||||
|
||||
private _lastSearchTerm: string
|
||||
|
||||
get allowCreateNew(): boolean {
|
||||
return this.createNew.observers.length > 0
|
||||
}
|
||||
|
|
@ -52,7 +54,28 @@ export class SelectComponent extends AbstractInputComponent<number> {
|
|||
}
|
||||
|
||||
addItem(name: string) {
|
||||
this.createNew.next(name)
|
||||
if (name) this.createNew.next(name)
|
||||
else this.createNew.next(this._lastSearchTerm)
|
||||
this.clearLastSearchTerm()
|
||||
}
|
||||
|
||||
clickNew() {
|
||||
this.createNew.next(this._lastSearchTerm)
|
||||
this.clearLastSearchTerm()
|
||||
}
|
||||
|
||||
clearLastSearchTerm() {
|
||||
this._lastSearchTerm = null
|
||||
}
|
||||
|
||||
onSearch($event) {
|
||||
this._lastSearchTerm = $event.term
|
||||
}
|
||||
|
||||
onBlur() {
|
||||
setTimeout(() => {
|
||||
this.clearLastSearchTerm()
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue