Skip to content

Commit

Permalink
Merge pull request #2164 from alexandrevryghem/fixed-default-input-va…
Browse files Browse the repository at this point in the history
…lues-not-working_contribute-main

Fixed some themeable component default values not being overridable
  • Loading branch information
tdonohue authored Apr 19, 2023
2 parents ade9533 + fc7997d commit d9f6386
Show file tree
Hide file tree
Showing 15 changed files with 72 additions and 134 deletions.
4 changes: 2 additions & 2 deletions src/app/footer/themed-footer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<FooterComponent> {
Expand All @@ -20,6 +20,6 @@ export class ThemedFooterComponent extends ThemedComponent<FooterComponent> {
}

protected importUnthemedComponent(): Promise<any> {
return import(`./footer.component`);
return import('./footer.component');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<HeaderNavbarWrapperComponent> {
Expand All @@ -20,6 +20,6 @@ export class ThemedHeaderNavbarWrapperComponent extends ThemedComponent<HeaderNa
}

protected importUnthemedComponent(): Promise<any> {
return import(`./header-navbar-wrapper.component`);
return import('./header-navbar-wrapper.component');
}
}
2 changes: 0 additions & 2 deletions src/app/home-page/themed-home-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import { Component } from '@angular/core';
templateUrl: '../shared/theme-support/themed.component.html',
})
export class ThemedHomePageComponent extends ThemedComponent<HomePageComponent> {
protected inAndOutputNames: (keyof HomePageComponent & keyof this)[];


protected getComponentName(): string {
return 'HomePageComponent';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class ThemedMetadataRepresentationListComponent extends ThemedComponent<M

@Input() label: string;

@Input() incrementBy = 10;
@Input() incrementBy: number;

protected getComponentName(): string {
return 'MetadataRepresentationListComponent';
Expand Down
1 change: 0 additions & 1 deletion src/app/my-dspace-page/themed-my-dspace-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { MyDSpacePageComponent } from './my-dspace-page.component';
templateUrl: './../shared/theme-support/themed.component.html'
})
export class ThemedMyDSpacePageComponent extends ThemedComponent<MyDSpacePageComponent> {
protected inAndOutputNames: (keyof MyDSpacePageComponent & keyof this)[];

protected getComponentName(): string {
return 'MyDSpacePageComponent';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,18 @@ export class ThemedConfigurationSearchPageComponent extends ThemedComponent<Conf
/**
* True when the search component should show results on the current page
*/
@Input() inPlaceSearch = true;
@Input() inPlaceSearch: boolean;

/**
* Whether or not the search bar should be visible
*/
@Input()
searchEnabled = true;
@Input() searchEnabled: boolean;

/**
* The width of the sidebar (bootstrap columns)
*/
@Input()
sideBarWidth = 3;
sideBarWidth: number;

/**
* The currently applied configuration (determines title of search)
Expand All @@ -66,7 +65,7 @@ export class ThemedConfigurationSearchPageComponent extends ThemedComponent<Conf
}

protected importUnthemedComponent(): Promise<any> {
return import(`./configuration-search-page.component`);
return import('./configuration-search-page.component');
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ export class ThemedCollectionDropdownComponent extends ThemedComponent<Collectio

@Input() entityType: string;

@Output() searchComplete = new EventEmitter<any>();
@Output() searchComplete: EventEmitter<any> = new EventEmitter();

@Output() theOnlySelectable = new EventEmitter<CollectionListEntry>();
@Output() theOnlySelectable: EventEmitter<CollectionListEntry> = new EventEmitter();

@Output() selectionChange = new EventEmitter<CollectionListEntry>();
@Output() selectionChange = new EventEmitter();

protected inAndOutputNames: (keyof CollectionDropdownComponent & keyof this)[] = ['entityType', 'searchComplete', 'theOnlySelectable', 'selectionChange'];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,14 @@ import { RelationshipOptions } from '../../../models/relationship-options.model'
import { ListableObject } from '../../../../../object-collection/shared/listable-object.model';
import { Context } from '../../../../../../core/shared/context.model';
import { Item } from '../../../../../../core/shared/item.model';
import { SEARCH_CONFIG_SERVICE } from '../../../../../../my-dspace-page/my-dspace-page.component';
import { SearchConfigurationService } from '../../../../../../core/shared/search/search-configuration.service';
import { Collection } from '../../../../../../core/shared/collection.model';
import { ExternalSource } from '../../../../../../core/shared/external-source.model';
import { DsDynamicLookupRelationExternalSourceTabComponent } from './dynamic-lookup-relation-external-source-tab.component';
import { fadeIn, fadeInOut } from '../../../../../animations/fade';

@Component({
selector: 'ds-themed-dynamic-lookup-relation-external-source-tab',
styleUrls: [],
templateUrl: '../../../../../theme-support/themed.component.html',
providers: [
{
provide: SEARCH_CONFIG_SERVICE,
useClass: SearchConfigurationService
}
],
animations: [
fadeIn,
fadeInOut
]
})
export class ThemedDynamicLookupRelationExternalSourceTabComponent extends ThemedComponent<DsDynamicLookupRelationExternalSourceTabComponent> {
protected inAndOutputNames: (keyof DsDynamicLookupRelationExternalSourceTabComponent & keyof this)[] = ['label', 'listId',
Expand All @@ -44,7 +31,7 @@ export class ThemedDynamicLookupRelationExternalSourceTabComponent extends Theme

@Input() repeatable: boolean;

@Output() importedObject: EventEmitter<ListableObject> = new EventEmitter<ListableObject>();
@Output() importedObject: EventEmitter<ListableObject> = new EventEmitter();

@Input() externalSource: ExternalSource;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,11 @@ import { Item } from '../../../../../../core/shared/item.model';
import { SearchResult } from '../../../../../search/models/search-result.model';
import { SearchObjects } from '../../../../../search/models/search-objects.model';
import { DSpaceObject } from '../../../../../../core/shared/dspace-object.model';
import { SEARCH_CONFIG_SERVICE } from '../../../../../../my-dspace-page/my-dspace-page.component';
import { SearchConfigurationService } from '../../../../../../core/shared/search/search-configuration.service';

@Component({
selector: 'ds-themed-dynamic-lookup-relation-search-tab',
styleUrls: [],
templateUrl: '../../../../../theme-support/themed.component.html',
providers: [
{
provide: SEARCH_CONFIG_SERVICE,
useClass: SearchConfigurationService
}
]
})
export class ThemedDynamicLookupRelationSearchTabComponent extends ThemedComponent<DsDynamicLookupRelationSearchTabComponent> {
protected inAndOutputNames: (keyof DsDynamicLookupRelationSearchTabComponent & keyof this)[] = ['relationship', 'listId',
Expand Down Expand Up @@ -51,11 +43,11 @@ export class ThemedDynamicLookupRelationSearchTabComponent extends ThemedCompone

@Input() isEditRelationship: boolean;

@Output() deselectObject: EventEmitter<ListableObject> = new EventEmitter<ListableObject>();
@Output() deselectObject: EventEmitter<ListableObject> = new EventEmitter();

@Output() selectObject: EventEmitter<ListableObject> = new EventEmitter<ListableObject>();
@Output() selectObject: EventEmitter<ListableObject> = new EventEmitter();

@Output() resultFound: EventEmitter<SearchObjects<DSpaceObject>> = new EventEmitter<SearchObjects<DSpaceObject>>();
@Output() resultFound: EventEmitter<SearchObjects<DSpaceObject>> = new EventEmitter();

protected getComponentName(): string {
return 'DsDynamicLookupRelationSearchTabComponent';
Expand Down
4 changes: 2 additions & 2 deletions src/app/shared/loading/themed-loading.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { ThemeService } from '../theme-support/theme.service';
export class ThemedLoadingComponent extends ThemedComponent<LoadingComponent> {

@Input() message: string;
@Input() showMessage = true;
@Input() spinner = false;
@Input() showMessage: boolean;
@Input() spinner: boolean;

protected inAndOutputNames: (keyof LoadingComponent & keyof this)[] = ['message', 'showMessage', 'spinner'];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { ChangeDetectorRef, Component, ComponentFactoryResolver, Input } from '@angular/core';
import { Component, Input } from '@angular/core';
import { ThemedComponent } from '../../../theme-support/themed.component';
import { ItemListPreviewComponent } from './item-list-preview.component';
import { Item } from '../../../../core/shared/item.model';
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
import { SearchResult } from '../../../search/models/search-result.model';
import { WorkflowItem } from 'src/app/core/submission/models/workflowitem.model';
import { ThemeService } from 'src/app/shared/theme-support/theme.service';

/**
* Themed wrapper for ItemListPreviewComponent
Expand All @@ -24,22 +23,10 @@ export class ThemedItemListPreviewComponent extends ThemedComponent<ItemListPrev

@Input() status: MyDspaceItemStatusType;

@Input() showSubmitter = false;
@Input() showSubmitter: boolean;

@Input() workflowItem: WorkflowItem;

constructor(
protected resolver: ComponentFactoryResolver,
protected cdr: ChangeDetectorRef,
protected themeService: ThemeService,
) {
super(resolver, cdr, themeService);
}

ngOnInit() {
super.ngOnInit();
}

protected getComponentName(): string {
return 'ItemListPreviewComponent';
}
Expand Down
68 changes: 22 additions & 46 deletions src/app/shared/object-list/themed-object-list.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {Component, EventEmitter, Input, Output} from '@angular/core';
import { ObjectListComponent } from './object-list.component';
import { ThemedComponent } from '../theme-support/themed.component';
import {ViewMode} from '../../core/shared/view-mode.model';
import {PaginationComponentOptions} from '../pagination/pagination-component-options.model';
import {SortDirection, SortOptions} from '../../core/cache/models/sort-options.model';
import {CollectionElementLinkType} from '../object-collection/collection-element-link.type';
Expand All @@ -19,10 +18,6 @@ import {ListableObject} from '../object-collection/shared/listable-object.model'
templateUrl: '../theme-support/themed.component.html',
})
export class ThemedObjectListComponent extends ThemedComponent<ObjectListComponent> {
/**
* The view mode of the this component
*/
viewMode = ViewMode.ListElement;

/**
* The current pagination configuration
Expand All @@ -37,18 +32,20 @@ export class ThemedObjectListComponent extends ThemedComponent<ObjectListCompone
/**
* Whether or not the list elements have a border
*/
@Input() hasBorder = false;
@Input() hasBorder: boolean;

/**
* The whether or not the gear is hidden
*/
@Input() hideGear = false;
@Input() hideGear: boolean;

/**
* Whether or not the pager is visible when there is only a single page of results
*/
@Input() hidePagerWhenSinglePage = true;
@Input() selectable = false;
@Input() hidePagerWhenSinglePage: boolean;

@Input() selectable: boolean;

@Input() selectionConfig: { repeatable: boolean, listId: string };

/**
Expand All @@ -64,12 +61,12 @@ export class ThemedObjectListComponent extends ThemedComponent<ObjectListCompone
/**
* Option for hiding the pagination detail
*/
@Input() hidePaginationDetail = false;
@Input() hidePaginationDetail: boolean;

/**
* Whether or not to add an import button to the object
*/
@Input() importable = false;
@Input() importable: boolean;

/**
* Config used for the import button
Expand All @@ -79,42 +76,24 @@ export class ThemedObjectListComponent extends ThemedComponent<ObjectListCompone
/**
* Whether or not the pagination should be rendered as simple previous and next buttons instead of the normal pagination
*/
@Input() showPaginator = true;
@Input() showPaginator: boolean;

/**
* Emit when one of the listed object has changed.
*/
@Output() contentChange = new EventEmitter<any>();
@Output() contentChange: EventEmitter<any> = new EventEmitter();

/**
* If showPaginator is set to true, emit when the previous button is clicked
*/
@Output() prev = new EventEmitter<boolean>();
@Output() prev: EventEmitter<boolean> = new EventEmitter();

/**
* If showPaginator is set to true, emit when the next button is clicked
*/
@Output() next = new EventEmitter<boolean>();

/**
* The current listable objects
*/
private _objects: RemoteData<PaginatedList<ListableObject>>;

/**
* Setter for the objects
* @param objects The new objects
*/
@Input() set objects(objects: RemoteData<PaginatedList<ListableObject>>) {
this._objects = objects;
}
@Output() next: EventEmitter<boolean> = new EventEmitter();

/**
* Getter to return the current objects
*/
get objects() {
return this._objects;
}
@Input() objects: RemoteData<PaginatedList<ListableObject>>;

/**
* An event fired when the page is changed.
Expand All @@ -123,48 +102,45 @@ export class ThemedObjectListComponent extends ThemedComponent<ObjectListCompone
@Output() change: EventEmitter<{
pagination: PaginationComponentOptions,
sort: SortOptions
}> = new EventEmitter<{
pagination: PaginationComponentOptions,
sort: SortOptions
}>();
}> = new EventEmitter();

/**
* An event fired when the page is changed.
* Event's payload equals to the newly selected page.
*/
@Output() pageChange: EventEmitter<number> = new EventEmitter<number>();
@Output() pageChange: EventEmitter<number> = new EventEmitter();

/**
* An event fired when the page wsize is changed.
* Event's payload equals to the newly selected page size.
*/
@Output() pageSizeChange: EventEmitter<number> = new EventEmitter<number>();
@Output() pageSizeChange: EventEmitter<number> = new EventEmitter();

/**
* An event fired when the sort direction is changed.
* Event's payload equals to the newly selected sort direction.
*/
@Output() sortDirectionChange: EventEmitter<SortDirection> = new EventEmitter<SortDirection>();
@Output() sortDirectionChange: EventEmitter<SortDirection> = new EventEmitter();

/**
* An event fired when on of the pagination parameters changes
*/
@Output() paginationChange: EventEmitter<any> = new EventEmitter<any>();
@Output() paginationChange: EventEmitter<any> = new EventEmitter();

@Output() deselectObject: EventEmitter<ListableObject> = new EventEmitter<ListableObject>();
@Output() deselectObject: EventEmitter<ListableObject> = new EventEmitter();

@Output() selectObject: EventEmitter<ListableObject> = new EventEmitter<ListableObject>();
@Output() selectObject: EventEmitter<ListableObject> = new EventEmitter();

/**
* Send an import event to the parent component
*/
@Output() importObject: EventEmitter<ListableObject> = new EventEmitter<ListableObject>();
@Output() importObject: EventEmitter<ListableObject> = new EventEmitter();

/**
* An event fired when the sort field is changed.
* Event's payload equals to the newly selected sort field.
*/
@Output() sortFieldChange: EventEmitter<string> = new EventEmitter<string>();
@Output() sortFieldChange: EventEmitter<string> = new EventEmitter();

inAndOutputNames: (keyof ObjectListComponent & keyof this)[] = [
'config',
Expand Down
Loading

0 comments on commit d9f6386

Please sign in to comment.