From d6147e52364a3533d1b843f166470fe2fd6ae741 Mon Sep 17 00:00:00 2001 From: Alexandre Vryghem Date: Wed, 8 Feb 2023 15:21:07 +0100 Subject: [PATCH 1/4] Fixed default @Input() values not working for themed components --- src/app/shared/theme-support/themed.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/shared/theme-support/themed.component.ts b/src/app/shared/theme-support/themed.component.ts index 2ff0713f460..3a0bc368866 100644 --- a/src/app/shared/theme-support/themed.component.ts +++ b/src/app/shared/theme-support/themed.component.ts @@ -103,7 +103,7 @@ export abstract class ThemedComponent implements OnInit, OnDestroy, OnChanges protected connectInputsAndOutputs(): void { if (isNotEmpty(this.inAndOutputNames) && hasValue(this.compRef) && hasValue(this.compRef.instance)) { - this.inAndOutputNames.forEach((name: any) => { + this.inAndOutputNames.filter((name: any) => this[name] !== undefined).forEach((name: any) => { this.compRef.instance[name] = this[name]; }); } From 1752b1afd4d49d68f0264f9e1d189bc2bb27e0b0 Mon Sep 17 00:00:00 2001 From: Alexandre Vryghem Date: Fri, 24 Mar 2023 16:47:42 +0100 Subject: [PATCH 2/4] 100479: Removed the default input values to make it possible to override them in themes --- src/app/footer/themed-footer.component.ts | 4 ++-- .../themed-header-navbar-wrapper.component.ts | 6 +++--- src/app/home-page/themed-home-page.component.ts | 2 -- .../my-dspace-page/themed-my-dspace-page.component.ts | 1 - .../themed-configuration-search-page.component.ts | 9 ++++----- src/app/shared/search/search.component.ts | 2 +- 6 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/app/footer/themed-footer.component.ts b/src/app/footer/themed-footer.component.ts index c52a0af29f5..e8f64f3434b 100644 --- a/src/app/footer/themed-footer.component.ts +++ b/src/app/footer/themed-footer.component.ts @@ -7,7 +7,7 @@ import { FooterComponent } from './footer.component'; */ @Component({ selector: 'ds-themed-footer', - styleUrls: ['footer.component.scss'], + styleUrls: [], templateUrl: '../shared/theme-support/themed.component.html', }) export class ThemedFooterComponent extends ThemedComponent { @@ -20,6 +20,6 @@ export class ThemedFooterComponent extends ThemedComponent { } protected importUnthemedComponent(): Promise { - return import(`./footer.component`); + return import('./footer.component'); } } diff --git a/src/app/header-nav-wrapper/themed-header-navbar-wrapper.component.ts b/src/app/header-nav-wrapper/themed-header-navbar-wrapper.component.ts index 7f9c181fe2e..02d09c44ef4 100644 --- a/src/app/header-nav-wrapper/themed-header-navbar-wrapper.component.ts +++ b/src/app/header-nav-wrapper/themed-header-navbar-wrapper.component.ts @@ -3,11 +3,11 @@ import { ThemedComponent } from '../shared/theme-support/themed.component'; import { HeaderNavbarWrapperComponent } from './header-navbar-wrapper.component'; /** - * Themed wrapper for BreadcrumbsComponent + * Themed wrapper for {@link HeaderNavbarWrapperComponent} */ @Component({ selector: 'ds-themed-header-navbar-wrapper', - styleUrls: ['./themed-header-navbar-wrapper.component.scss'], + styleUrls: [], templateUrl: '../shared/theme-support/themed.component.html', }) export class ThemedHeaderNavbarWrapperComponent extends ThemedComponent { @@ -20,6 +20,6 @@ export class ThemedHeaderNavbarWrapperComponent extends ThemedComponent { - return import(`./header-navbar-wrapper.component`); + return import('./header-navbar-wrapper.component'); } } diff --git a/src/app/home-page/themed-home-page.component.ts b/src/app/home-page/themed-home-page.component.ts index e50f955cb13..c0ef723b383 100644 --- a/src/app/home-page/themed-home-page.component.ts +++ b/src/app/home-page/themed-home-page.component.ts @@ -8,8 +8,6 @@ import { Component } from '@angular/core'; templateUrl: '../shared/theme-support/themed.component.html', }) export class ThemedHomePageComponent extends ThemedComponent { - protected inAndOutputNames: (keyof HomePageComponent & keyof this)[]; - protected getComponentName(): string { return 'HomePageComponent'; diff --git a/src/app/my-dspace-page/themed-my-dspace-page.component.ts b/src/app/my-dspace-page/themed-my-dspace-page.component.ts index 2c74da052e8..55ebc51c8d6 100644 --- a/src/app/my-dspace-page/themed-my-dspace-page.component.ts +++ b/src/app/my-dspace-page/themed-my-dspace-page.component.ts @@ -11,7 +11,6 @@ import { MyDSpacePageComponent } from './my-dspace-page.component'; templateUrl: './../shared/theme-support/themed.component.html' }) export class ThemedMyDSpacePageComponent extends ThemedComponent { - protected inAndOutputNames: (keyof MyDSpacePageComponent & keyof this)[]; protected getComponentName(): string { return 'MyDSpacePageComponent'; diff --git a/src/app/search-page/themed-configuration-search-page.component.ts b/src/app/search-page/themed-configuration-search-page.component.ts index e4d6e93402a..e367ee52387 100644 --- a/src/app/search-page/themed-configuration-search-page.component.ts +++ b/src/app/search-page/themed-configuration-search-page.component.ts @@ -28,19 +28,18 @@ export class ThemedConfigurationSearchPageComponent extends ThemedComponent { - return import(`./configuration-search-page.component`); + return import('./configuration-search-page.component'); } } diff --git a/src/app/shared/search/search.component.ts b/src/app/shared/search/search.component.ts index c017a5065ba..b04575f5463 100644 --- a/src/app/shared/search/search.component.ts +++ b/src/app/shared/search/search.component.ts @@ -127,7 +127,7 @@ export class SearchComponent implements OnInit { /** * List of available view mode */ - @Input() useUniquePageId: false; + @Input() useUniquePageId: boolean; /** * List of available view mode From 80b90524b653d220f4269965f29d1697238aa79a Mon Sep 17 00:00:00 2001 From: Alexandre Vryghem Date: Fri, 24 Mar 2023 16:47:42 +0100 Subject: [PATCH 3/4] 100479: Removed the default input values to make it possible to override them in themes --- .../loading/themed-loading.component.ts | 4 +- .../themed-item-list-preview.component.ts | 2 +- .../themed-object-list.component.ts | 67 ++++++------------- .../themed-search-results.component.ts | 14 ++-- .../shared/search/themed-search.component.ts | 36 +++++----- 5 files changed, 50 insertions(+), 73 deletions(-) diff --git a/src/app/shared/loading/themed-loading.component.ts b/src/app/shared/loading/themed-loading.component.ts index ffdf9d3cbe6..48773d75c81 100644 --- a/src/app/shared/loading/themed-loading.component.ts +++ b/src/app/shared/loading/themed-loading.component.ts @@ -14,8 +14,8 @@ import { ThemeService } from '../theme-support/theme.service'; export class ThemedLoadingComponent extends ThemedComponent { @Input() message: string; - @Input() showMessage = true; - @Input() spinner = false; + @Input() showMessage: boolean; + @Input() spinner: boolean; protected inAndOutputNames: (keyof LoadingComponent & keyof this)[] = ['message', 'showMessage', 'spinner']; diff --git a/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/themed-item-list-preview.component.ts b/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/themed-item-list-preview.component.ts index 3fe825d2367..eff5911dca1 100644 --- a/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/themed-item-list-preview.component.ts +++ b/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/themed-item-list-preview.component.ts @@ -22,7 +22,7 @@ export class ThemedItemListPreviewComponent extends ThemedComponent { - /** - * The view mode of the this component - */ - viewMode = ViewMode.ListElement; /** * The current pagination configuration @@ -37,18 +33,20 @@ export class ThemedObjectListComponent extends ThemedComponent