book drop bulk select will auto-select if there is only one option
This commit is contained in:
+16
-1
@@ -75,7 +75,8 @@ export class BookdropFileReviewComponent implements OnInit {
|
||||
appSettings$: Observable<AppSettings | null> = this.appSettingsService.appSettings$;
|
||||
|
||||
uploadPattern = '';
|
||||
defaultLibraryId: string | null = null;
|
||||
_defaultLibraryId: string | null = null;
|
||||
|
||||
defaultPathId: string | null = null;
|
||||
libraries: Library[] = [];
|
||||
bookdropFileUis: BookdropFileUI[] = [];
|
||||
@@ -108,6 +109,20 @@ export class BookdropFileReviewComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
get defaultLibraryId() {
|
||||
return this._defaultLibraryId;
|
||||
}
|
||||
|
||||
set defaultLibraryId(value: string | null) {
|
||||
this._defaultLibraryId = value;
|
||||
|
||||
const selected = this.libraries.find((lib) => lib?.id && String(lib.id) === value)
|
||||
|
||||
if (selected && selected.paths.length ===1) {
|
||||
this.defaultPathId = String(selected.paths[0].id)
|
||||
}
|
||||
}
|
||||
|
||||
get libraryOptions() {
|
||||
if (!this.libraries) return [];
|
||||
return this.libraries.map(lib => ({label: lib.name, value: String(lib.id ?? '')}));
|
||||
|
||||
Reference in New Issue
Block a user