100479: Removed the default input values to make it possible to override them in themes

This commit is contained in:
Alexandre Vryghem
2023-03-24 16:47:42 +01:00
parent 38df774c9c
commit 80b90524b6
5 changed files with 50 additions and 73 deletions

View File

@@ -14,8 +14,8 @@ import { ThemeService } from '../theme-support/theme.service';
export class ThemedLoadingComponent extends ThemedComponent<LoadingComponent> { export class ThemedLoadingComponent extends ThemedComponent<LoadingComponent> {
@Input() message: string; @Input() message: string;
@Input() showMessage = true; @Input() showMessage: boolean;
@Input() spinner = false; @Input() spinner: boolean;
protected inAndOutputNames: (keyof LoadingComponent & keyof this)[] = ['message', 'showMessage', 'spinner']; protected inAndOutputNames: (keyof LoadingComponent & keyof this)[] = ['message', 'showMessage', 'spinner'];

View File

@@ -22,7 +22,7 @@ export class ThemedItemListPreviewComponent extends ThemedComponent<ItemListPrev
@Input() status: MyDspaceItemStatusType; @Input() status: MyDspaceItemStatusType;
@Input() showSubmitter = false; @Input() showSubmitter: boolean;
protected getComponentName(): string { protected getComponentName(): string {

View File

@@ -19,10 +19,6 @@ import {ListableObject} from '../object-collection/shared/listable-object.model'
templateUrl: '../theme-support/themed.component.html', templateUrl: '../theme-support/themed.component.html',
}) })
export class ThemedObjectListComponent extends ThemedComponent<ObjectListComponent> { export class ThemedObjectListComponent extends ThemedComponent<ObjectListComponent> {
/**
* The view mode of the this component
*/
viewMode = ViewMode.ListElement;
/** /**
* The current pagination configuration * The current pagination configuration
@@ -37,18 +33,20 @@ export class ThemedObjectListComponent extends ThemedComponent<ObjectListCompone
/** /**
* Whether or not the list elements have a border * Whether or not the list elements have a border
*/ */
@Input() hasBorder = false; @Input() hasBorder: boolean;
/** /**
* The whether or not the gear is hidden * 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 * Whether or not the pager is visible when there is only a single page of results
*/ */
@Input() hidePagerWhenSinglePage = true; @Input() hidePagerWhenSinglePage: boolean;
@Input() selectable = false;
@Input() selectable: boolean;
@Input() selectionConfig: { repeatable: boolean, listId: string }; @Input() selectionConfig: { repeatable: boolean, listId: string };
/** /**
@@ -64,12 +62,12 @@ export class ThemedObjectListComponent extends ThemedComponent<ObjectListCompone
/** /**
* Option for hiding the pagination detail * Option for hiding the pagination detail
*/ */
@Input() hidePaginationDetail = false; @Input() hidePaginationDetail: boolean;
/** /**
* Whether or not to add an import button to the object * Whether or not to add an import button to the object
*/ */
@Input() importable = false; @Input() importable: boolean;
/** /**
* Config used for the import button * Config used for the import button
@@ -79,42 +77,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 * 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. * 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 * 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 * If showPaginator is set to true, emit when the next button is clicked
*/ */
@Output() next = new EventEmitter<boolean>(); @Output() next: EventEmitter<boolean> = new EventEmitter();
/** @Input() objects: RemoteData<PaginatedList<ListableObject>>;
* 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;
}
/**
* Getter to return the current objects
*/
get objects() {
return this._objects;
}
/** /**
* An event fired when the page is changed. * An event fired when the page is changed.
@@ -123,48 +103,45 @@ export class ThemedObjectListComponent extends ThemedComponent<ObjectListCompone
@Output() change: EventEmitter<{ @Output() change: EventEmitter<{
pagination: PaginationComponentOptions, pagination: PaginationComponentOptions,
sort: SortOptions sort: SortOptions
}> = new EventEmitter<{ }> = new EventEmitter();
pagination: PaginationComponentOptions,
sort: SortOptions
}>();
/** /**
* An event fired when the page is changed. * An event fired when the page is changed.
* Event's payload equals to the newly selected page. * 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. * An event fired when the page wsize is changed.
* Event's payload equals to the newly selected page size. * 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. * An event fired when the sort direction is changed.
* Event's payload equals to the newly selected sort direction. * 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 * 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 * 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. * An event fired when the sort field is changed.
* Event's payload equals to the newly selected sort field. * 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)[] = [ inAndOutputNames: (keyof ObjectListComponent & keyof this)[] = [
'config', 'config',

View File

@@ -35,21 +35,21 @@ export class ThemedSearchResultsComponent extends ThemedComponent<SearchResultsC
@Input() configuration: string; @Input() configuration: string;
@Input() disableHeader = false; @Input() disableHeader: boolean;
@Input() selectable = false; @Input() selectable: boolean;
@Input() context: Context; @Input() context: Context;
@Input() hidePaginationDetail = false; @Input() hidePaginationDetail: boolean;
@Input() selectionConfig: SelectionConfig = null; @Input() selectionConfig: SelectionConfig;
@Output() contentChange: EventEmitter<ListableObject> = new EventEmitter<ListableObject>(); @Output() contentChange: EventEmitter<ListableObject> = 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();
protected getComponentName(): string { protected getComponentName(): string {
return 'SearchResultsComponent'; return 'SearchResultsComponent';

View File

@@ -21,49 +21,49 @@ import { ListableObject } from '../object-collection/shared/listable-object.mode
export class ThemedSearchComponent extends ThemedComponent<SearchComponent> { export class ThemedSearchComponent extends ThemedComponent<SearchComponent> {
protected inAndOutputNames: (keyof SearchComponent & keyof this)[] = ['configurationList', 'context', 'configuration', 'fixedFilterQuery', 'useCachedVersionIfAvailable', 'inPlaceSearch', 'linkType', 'paginationId', 'searchEnabled', 'sideBarWidth', 'searchFormPlaceholder', 'selectable', 'selectionConfig', 'showSidebar', 'showViewModes', 'useUniquePageId', 'viewModeList', 'showScopeSelector', 'resultFound', 'deselectObject', 'selectObject', 'trackStatistics']; protected inAndOutputNames: (keyof SearchComponent & keyof this)[] = ['configurationList', 'context', 'configuration', 'fixedFilterQuery', 'useCachedVersionIfAvailable', 'inPlaceSearch', 'linkType', 'paginationId', 'searchEnabled', 'sideBarWidth', 'searchFormPlaceholder', 'selectable', 'selectionConfig', 'showSidebar', 'showViewModes', 'useUniquePageId', 'viewModeList', 'showScopeSelector', 'resultFound', 'deselectObject', 'selectObject', 'trackStatistics'];
@Input() configurationList: SearchConfigurationOption[] = []; @Input() configurationList: SearchConfigurationOption[];
@Input() context: Context = Context.Search; @Input() context: Context;
@Input() configuration = 'default'; @Input() configuration: string;
@Input() fixedFilterQuery: string; @Input() fixedFilterQuery: string;
@Input() useCachedVersionIfAvailable = true; @Input() useCachedVersionIfAvailable: boolean;
@Input() inPlaceSearch = true; @Input() inPlaceSearch: boolean;
@Input() linkType: CollectionElementLinkType; @Input() linkType: CollectionElementLinkType;
@Input() paginationId = 'spc'; @Input() paginationId: string;
@Input() searchEnabled = true; @Input() searchEnabled: boolean;
@Input() sideBarWidth = 3; @Input() sideBarWidth: number;
@Input() searchFormPlaceholder = 'search.search-form.placeholder'; @Input() searchFormPlaceholder: string;
@Input() selectable = false; @Input() selectable: boolean;
@Input() selectionConfig: SelectionConfig; @Input() selectionConfig: SelectionConfig;
@Input() showSidebar = true; @Input() showSidebar: boolean;
@Input() showViewModes = true; @Input() showViewModes: boolean;
@Input() useUniquePageId: false; @Input() useUniquePageId: boolean;
@Input() viewModeList: ViewMode[]; @Input() viewModeList: ViewMode[];
@Input() showScopeSelector = true; @Input() showScopeSelector: boolean;
@Input() trackStatistics = false; @Input() trackStatistics: boolean;
@Output() resultFound: EventEmitter<SearchObjects<DSpaceObject>> = new EventEmitter<SearchObjects<DSpaceObject>>(); @Output() resultFound: EventEmitter<SearchObjects<DSpaceObject>> = 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();
protected getComponentName(): string { protected getComponentName(): string {
return 'SearchComponent'; return 'SearchComponent';