mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-11 17:17:26 +01:00
Support passing current term from input-select search to create dialog e.g. for doc type / correspondent
This commit is contained in:
parent
cd72ed2cec
commit
52bc1a62e1
4 changed files with 27 additions and 9 deletions
|
|
@ -34,7 +34,9 @@ export class SelectComponent extends AbstractInputComponent<number> {
|
|||
suggestions: number[]
|
||||
|
||||
@Output()
|
||||
createNew = new EventEmitter()
|
||||
createNew = new EventEmitter<string>()
|
||||
|
||||
private _lastSearchTerm: string
|
||||
|
||||
showPlusButton(): boolean {
|
||||
return this.createNew.observers.length > 0
|
||||
|
|
@ -48,4 +50,17 @@ export class SelectComponent extends AbstractInputComponent<number> {
|
|||
}
|
||||
}
|
||||
|
||||
clickNew() {
|
||||
this.createNew.next(this._lastSearchTerm)
|
||||
this._lastSearchTerm = null
|
||||
}
|
||||
|
||||
onFocus() {
|
||||
this._lastSearchTerm = null
|
||||
}
|
||||
|
||||
onSearch($event) {
|
||||
this._lastSearchTerm = $event.term
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue