104312: DsDynamicLookupRelationExternalSourceTabComponent should have the form value already filled in the search input

This commit is contained in:
Alexandre Vryghem
2023-07-19 14:01:41 +02:00
parent c6ecc0cbd4
commit 648925f3e1
2 changed files with 13 additions and 2 deletions

View File

@@ -42,6 +42,7 @@
[collection]="collection" [collection]="collection"
[relationship]="relationshipOptions" [relationship]="relationshipOptions"
[context]="context" [context]="context"
[query]="query"
[externalSource]="source" [externalSource]="source"
(importedObject)="imported($event)" (importedObject)="imported($event)"
class="d-block pt-3"> class="d-block pt-3">

View File

@@ -74,6 +74,12 @@ export class DsDynamicLookupRelationExternalSourceTabComponent implements OnInit
* The context to displaying lists for * The context to displaying lists for
*/ */
@Input() context: Context; @Input() context: Context;
/**
* The search query
*/
@Input() query: string;
@Input() repeatable: boolean; @Input() repeatable: boolean;
/** /**
* Emit an event when an object has been imported (or selected from similar local entries) * Emit an event when an object has been imported (or selected from similar local entries)
@@ -147,8 +153,12 @@ export class DsDynamicLookupRelationExternalSourceTabComponent implements OnInit
this.resetRoute(); this.resetRoute();
this.entriesRD$ = this.searchConfigService.paginatedSearchOptions.pipe( this.entriesRD$ = this.searchConfigService.paginatedSearchOptions.pipe(
switchMap((searchOptions: PaginatedSearchOptions) => switchMap((searchOptions: PaginatedSearchOptions) => {
this.externalSourceService.getExternalSourceEntries(this.externalSource.id, searchOptions).pipe(startWith(undefined))) if (searchOptions.query === '') {
searchOptions.query = this.query;
}
return this.externalSourceService.getExternalSourceEntries(this.externalSource.id, searchOptions).pipe(startWith(undefined));
})
); );
this.currentPagination$ = this.paginationService.getCurrentPagination(this.searchConfigService.paginationID, this.initialPagination); this.currentPagination$ = this.paginationService.getCurrentPagination(this.searchConfigService.paginationID, this.initialPagination);
this.importConfig = { this.importConfig = {