Made SearchSidebarComponent themeable

This commit is contained in:
lotte
2023-01-11 14:46:37 +01:00
parent 9fdac08c67
commit cb982d6552
6 changed files with 87 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { ThemedComponent } from '../../theme-support/themed.component';
import { SearchSidebarComponent } from './search-sidebar.component';
import { SearchConfigurationOption } from '../search-switch-configuration/search-configuration-option.model';
import { SortOptions } from '../../../core/cache/models/sort-options.model';
import { ViewMode } from '../../../core/shared/view-mode.model';
import { PaginatedSearchOptions } from '../models/paginated-search-options.model';
import { Observable } from 'rxjs';
/**
* Themed wrapper for SearchSidebarComponent
*/
@Component({
selector: 'ds-themed-search-sidebar',
styleUrls: [],
templateUrl: '../../theme-support/themed.component.html',
})
export class ThemedSearchSidebarComponent extends ThemedComponent<SearchSidebarComponent> {
@Input() configuration;
@Input() configurationList: SearchConfigurationOption[];
@Input() currentScope: string;
@Input() currentSortOption: SortOptions;
@Input() resultCount;
@Input() viewModeList: ViewMode[];
@Input() showViewModes = true;
@Input() inPlaceSearch;
@Input() searchOptions: PaginatedSearchOptions;
@Input() sortOptionsList: SortOptions[];
@Input() refreshFilters: Observable<any>;
@Output() toggleSidebar = new EventEmitter<boolean>();
@Output() changeConfiguration: EventEmitter<SearchConfigurationOption> = new EventEmitter<SearchConfigurationOption>();
@Output() changeViewMode: EventEmitter<ViewMode> = new EventEmitter<ViewMode>();
protected inAndOutputNames: (keyof SearchSidebarComponent & keyof this)[] = [
'configuration', 'configurationList', 'currentScope', 'currentSortOption',
'resultCount', 'viewModeList', 'showViewModes', 'inPlaceSearch',
'searchOptions', 'sortOptionsList', 'refreshFilters', 'toggleSidebar', 'changeConfiguration', 'changeViewMode'];
protected getComponentName(): string {
return 'SearchSidebarComponent';
}
protected importThemedComponent(themeName: string): Promise<any> {
return import(`../../../../themes/${themeName}/app/shared/search/search-sidebar/search-sidebar.component`);
}
protected importUnthemedComponent(): Promise<any> {
return import('./search-sidebar.component');
}
}

View File

@@ -30,6 +30,7 @@ import { SearchResultsComponent } from './search-results/search-results.componen
import { SearchComponent } from './search.component'; import { SearchComponent } from './search.component';
import { ThemedSearchComponent } from './themed-search.component'; import { ThemedSearchComponent } from './themed-search.component';
import { ThemedSearchFiltersComponent } from './search-filters/themed-search-filters.component'; import { ThemedSearchFiltersComponent } from './search-filters/themed-search-filters.component';
import { ThemedSearchSidebarComponent } from './search-sidebar/themed-search-sidebar.component';
const COMPONENTS = [ const COMPONENTS = [
SearchComponent, SearchComponent,
@@ -55,6 +56,7 @@ const COMPONENTS = [
ConfigurationSearchPageComponent, ConfigurationSearchPageComponent,
ThemedConfigurationSearchPageComponent, ThemedConfigurationSearchPageComponent,
ThemedSearchFiltersComponent, ThemedSearchFiltersComponent,
ThemedSearchSidebarComponent,
]; ];
const ENTRY_COMPONENTS = [ const ENTRY_COMPONENTS = [

View File

@@ -0,0 +1,32 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE_ATMIRE and NOTICE_ATMIRE files at the root of the source
* tree and available online at
*
* https://www.atmire.com/software-license/
*/
import { Component } from '@angular/core';
import {
SearchSidebarComponent as BaseComponent,
} from '../../../../../../app/shared/search/search-sidebar/search-sidebar.component';
import { SEARCH_CONFIG_SERVICE } from '../../../../../../app/my-dspace-page/my-dspace-page.component';
import { SearchConfigurationService } from '../../../../../../app/core/shared/search/search-configuration.service';
@Component({
selector: 'ds-search-sidebar',
// styleUrls: ['./search-sidebar.component.scss'],
styleUrls: ['../../../../../../app/shared/search/search-sidebar/search-sidebar.component.scss'],
// templateUrl: './search-sidebar.component.html',
templateUrl: '../../../../../../app/shared/search/search-sidebar/search-sidebar.component.html',
providers: [
{
provide: SEARCH_CONFIG_SERVICE,
useClass: SearchConfigurationService
}
]
})
export class SearchSidebarComponent extends BaseComponent {
}

View File

@@ -85,6 +85,7 @@ import { ResourcePoliciesModule } from '../../app/shared/resource-policies/resou
import { ComcolModule } from '../../app/shared/comcol/comcol.module'; import { ComcolModule } from '../../app/shared/comcol/comcol.module';
import { FeedbackComponent } from './app/info/feedback/feedback.component'; import { FeedbackComponent } from './app/info/feedback/feedback.component';
import { SearchFiltersComponent } from './app/shared/search/search-filters/search-filters.component'; import { SearchFiltersComponent } from './app/shared/search/search-filters/search-filters.component';
import { SearchSidebarComponent } from './app/shared/search/search-sidebar/search-sidebar.component';
const DECLARATIONS = [ const DECLARATIONS = [
FileSectionComponent, FileSectionComponent,
@@ -129,6 +130,7 @@ const DECLARATIONS = [
BreadcrumbsComponent, BreadcrumbsComponent,
FeedbackComponent, FeedbackComponent,
SearchFiltersComponent, SearchFiltersComponent,
SearchSidebarComponent,
]; ];
@NgModule({ @NgModule({