From ad8e57a1c57f5541194c83c2dd012109da496587 Mon Sep 17 00:00:00 2001 From: "Mark H. Wood" Date: Wed, 21 Feb 2024 16:46:54 -0500 Subject: [PATCH] Make ItemSearchResultListElementComponent themeable. --- .../item/item-list-element.component.html | 2 +- ...em-search-result-list-element.component.ts | 37 +++++++++++++++++++ src/app/shared/shared.module.ts | 4 ++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 src/app/shared/object-list/search-result-list-element/item-search-result/item-types/item/themed-item-search-result-list-element.component.ts diff --git a/src/app/shared/object-list/item-list-element/item-types/item/item-list-element.component.html b/src/app/shared/object-list/item-list-element/item-types/item/item-list-element.component.html index 3877e2f335b..2f03f57de64 100644 --- a/src/app/shared/object-list/item-list-element/item-types/item/item-list-element.component.html +++ b/src/app/shared/object-list/item-list-element/item-types/item/item-list-element.component.html @@ -1 +1 @@ - + diff --git a/src/app/shared/object-list/search-result-list-element/item-search-result/item-types/item/themed-item-search-result-list-element.component.ts b/src/app/shared/object-list/search-result-list-element/item-search-result/item-types/item/themed-item-search-result-list-element.component.ts new file mode 100644 index 00000000000..65ce7c1e323 --- /dev/null +++ b/src/app/shared/object-list/search-result-list-element/item-search-result/item-types/item/themed-item-search-result-list-element.component.ts @@ -0,0 +1,37 @@ +import { Component, Input } from '@angular/core'; +import { CollectionElementLinkType } from 'src/app/shared/object-collection/collection-element-link.type'; +import { ThemedComponent } from 'src/app/shared/theme-support/themed.component'; +import { ItemSearchResultListElementComponent } from './item-search-result-list-element.component'; + +/* + * Themed wrapper for ItemSearchResultListElementComponent + */ + +@Component({ + selector: 'ds-themed-item-search-result-list-element', + styleUrls: [], + templateUrl: '../../../../../../../app/shared/theme-support/themed.component.html', +}) +export class ThemedItemSearchResultListElementComponent + extends ThemedComponent { + @Input() showLabel: boolean; + @Input() object: any; + @Input() linkType: CollectionElementLinkType; + protected inAndOutputNames: (keyof ItemSearchResultListElementComponent & keyof this)[] = [ + 'showLabel', + 'object', + 'linkType', + ]; + + protected getComponentName(): string { + return 'ItemSearchResultListElementComponent'; + } + + protected importThemedComponent(themeName: string): Promise { + return import(`../../../../../../../themes/${themeName}/app/shared/object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component`); + } + + protected importUnthemedComponent(): Promise { + return import('./item-search-result-list-element.component'); + } +} diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index f8fb2fbb32b..002001362e4 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -176,6 +176,9 @@ import { import { ItemSearchResultListElementComponent } from './object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component'; +import { + ThemedItemSearchResultListElementComponent +} from './object-list/search-result-list-element/item-search-result/item-types/item/themed-item-search-result-list-element.component'; import { ItemMetadataRepresentationListElementComponent } from './object-list/metadata-representation-list-element/item/item-metadata-representation-list-element.component'; @@ -422,6 +425,7 @@ const ENTRY_COMPONENTS = [ ItemGridElementComponent, BitstreamListItemComponent, ItemSearchResultListElementComponent, + ThemedItemSearchResultListElementComponent, ItemSearchResultGridElementComponent, BrowseEntryListElementComponent, SearchResultDetailElementComponent,