94688: Added ThemedSearchFormComponent

This commit is contained in:
Alexandre Vryghem
2022-12-01 10:27:10 +01:00
parent ca864379c8
commit e96954cf60
7 changed files with 61 additions and 9 deletions

View File

@@ -28,14 +28,14 @@
<ng-template ngbNavContent> <ng-template ngbNavContent>
<div class="row mt-2"> <div class="row mt-2">
<div class="col-12 col-lg-6"> <div class="col-12 col-lg-6">
<ds-search-form id="search-form" <ds-themed-search-form id="search-form"
[query]="(searchOptions$ | async)?.query" [query]="(searchOptions$ | async)?.query"
[scope]="(searchOptions$ | async)?.scope" [scope]="(searchOptions$ | async)?.scope"
[currentUrl]="'./'" [currentUrl]="'./'"
[inPlaceSearch]="true" [inPlaceSearch]="true"
[searchPlaceholder]="'collection.edit.item-mapper.search-form.placeholder' | translate" [searchPlaceholder]="'collection.edit.item-mapper.search-form.placeholder' | translate"
(submitSearch)="performedSearch = true"> (submitSearch)="performedSearch = true">
</ds-search-form> </ds-themed-search-form>
</div> </div>
</div> </div>

View File

@@ -3,7 +3,7 @@
<ng-container *ngIf="(site$ | async) as site"> <ng-container *ngIf="(site$ | async) as site">
<ds-view-tracker [object]="site"></ds-view-tracker> <ds-view-tracker [object]="site"></ds-view-tracker>
</ng-container> </ng-container>
<ds-search-form [inPlaceSearch]="false" [searchPlaceholder]="'home.search-form.placeholder' | translate"></ds-search-form> <ds-themed-search-form [inPlaceSearch]="false" [searchPlaceholder]="'home.search-form.placeholder' | translate"></ds-themed-search-form>
<ds-top-level-community-list></ds-top-level-community-list> <ds-top-level-community-list></ds-top-level-community-list>
<ds-recent-item-list *ngIf="recentSubmissionspageSize>0"></ds-recent-item-list> <ds-recent-item-list *ngIf="recentSubmissionspageSize>0"></ds-recent-item-list>
</div> </div>

View File

@@ -27,13 +27,13 @@
<ng-template ngbNavContent> <ng-template ngbNavContent>
<div class="row mt-2"> <div class="row mt-2">
<div class="col-12 col-lg-6"> <div class="col-12 col-lg-6">
<ds-search-form id="search-form" <ds-themed-search-form id="search-form"
[query]="(searchOptions$ | async)?.query" [query]="(searchOptions$ | async)?.query"
[currentUrl]="'./'" [currentUrl]="'./'"
[inPlaceSearch]="true" [inPlaceSearch]="true"
[searchPlaceholder]="'item.edit.item-mapper.search-form.placeholder' | translate" [searchPlaceholder]="'item.edit.item-mapper.search-form.placeholder' | translate"
(submitSearch)="performedSearch = true"> (submitSearch)="performedSearch = true">
</ds-search-form> </ds-themed-search-form>
</div> </div>
</div> </div>

View File

@@ -4,10 +4,10 @@
<ds-page-size-selector></ds-page-size-selector> <ds-page-size-selector></ds-page-size-selector>
</div> </div>
<div class="col-8"> <div class="col-8">
<ds-search-form [query]="(searchConfigService.paginatedSearchOptions | async)?.query" <ds-themed-search-form [query]="(searchConfigService.paginatedSearchOptions | async)?.query"
[inPlaceSearch]="true" [inPlaceSearch]="true"
[searchPlaceholder]="'submission.sections.describe.relationship-lookup.selection-tab.search-form.placeholder' | translate"> [searchPlaceholder]="'submission.sections.describe.relationship-lookup.selection-tab.search-form.placeholder' | translate">
</ds-search-form> </ds-themed-search-form>
<div> <div>
<h3>{{ 'submission.sections.describe.relationship-lookup.selection-tab.title.' + externalSource.id | translate}}</h3> <h3>{{ 'submission.sections.describe.relationship-lookup.selection-tab.title.' + externalSource.id | translate}}</h3>
<ng-container *ngVar="(entriesRD$ | async) as entriesRD"> <ng-container *ngVar="(entriesRD$ | async) as entriesRD">

View File

@@ -0,0 +1,50 @@
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { ThemedComponent } from '../theme-support/themed.component';
import { SearchFormComponent } from './search-form.component';
/**
* Themed wrapper for {@link SearchFormComponent}
*/
@Component({
selector: 'ds-themed-search-form',
styleUrls: [],
templateUrl: '../../shared/theme-support/themed.component.html',
})
export class ThemedSearchFormComponent extends ThemedComponent<SearchFormComponent> {
@Input() query: string;
@Input() inPlaceSearch;
@Input() scope = '';
@Input() currentUrl: string;
@Input() large = false;
@Input() brandColor = 'primary';
@Input() searchPlaceholder: string;
@Input() showScopeSelector = false;
@Output() submitSearch = new EventEmitter<any>();
protected inAndOutputNames: (keyof SearchFormComponent & keyof this)[] = [
'query', 'inPlaceSearch', 'scope', 'currentUrl', 'large', 'brandColor', 'searchPlaceholder', 'showScopeSelector',
'submitSearch',
];
protected getComponentName(): string {
return 'SearchFormComponent';
}
protected importThemedComponent(themeName: string): Promise<any> {
return import(`../../../themes/${themeName}/app/shared/search-form/search-form.component`);
}
protected importUnthemedComponent(): Promise<any> {
return import('./search-form.component');
}
}

View File

@@ -79,14 +79,14 @@
</ng-template> </ng-template>
<ng-template #searchForm> <ng-template #searchForm>
<ds-search-form *ngIf="searchEnabled" id="search-form" <ds-themed-search-form *ngIf="searchEnabled" id="search-form"
[query]="(searchOptions$ | async)?.query" [query]="(searchOptions$ | async)?.query"
[scope]="(searchOptions$ | async)?.scope" [scope]="(searchOptions$ | async)?.scope"
[currentUrl]="searchLink" [currentUrl]="searchLink"
[showScopeSelector]="showScopeSelector" [showScopeSelector]="showScopeSelector"
[inPlaceSearch]="inPlaceSearch" [inPlaceSearch]="inPlaceSearch"
[searchPlaceholder]="searchFormPlaceholder | translate"> [searchPlaceholder]="searchFormPlaceholder | translate">
</ds-search-form> </ds-themed-search-form>
<div class="row mb-3 mb-md-1"> <div class="row mb-3 mb-md-1">
<div class="labels col-sm-9"> <div class="labels col-sm-9">
<ds-search-labels *ngIf="searchEnabled" [inPlaceSearch]="inPlaceSearch"></ds-search-labels> <ds-search-labels *ngIf="searchEnabled" [inPlaceSearch]="inPlaceSearch"></ds-search-labels>

View File

@@ -60,6 +60,7 @@ import { LoadingComponent } from './loading/loading.component';
import { PaginationComponent } from './pagination/pagination.component'; import { PaginationComponent } from './pagination/pagination.component';
import { ThumbnailComponent } from '../thumbnail/thumbnail.component'; import { ThumbnailComponent } from '../thumbnail/thumbnail.component';
import { SearchFormComponent } from './search-form/search-form.component'; import { SearchFormComponent } from './search-form/search-form.component';
import { ThemedSearchFormComponent } from './search-form/themed-search-form.component';
import { import {
SearchResultGridElementComponent SearchResultGridElementComponent
} from './object-grid/search-result-grid-element/search-result-grid-element.component'; } from './object-grid/search-result-grid-element/search-result-grid-element.component';
@@ -396,6 +397,7 @@ const COMPONENTS = [
PaginationComponent, PaginationComponent,
RSSComponent, RSSComponent,
SearchFormComponent, SearchFormComponent,
ThemedSearchFormComponent,
PageWithSidebarComponent, PageWithSidebarComponent,
SidebarDropdownComponent, SidebarDropdownComponent,
SidebarFilterComponent, SidebarFilterComponent,