1
0

[CST-9636] Add flag to show or not thumbnail along list element by component's input firstly

This commit is contained in:
Giuseppe Digilio
2022-11-22 14:59:40 +01:00
parent 301863fb80
commit 40cb6a18be
24 changed files with 75 additions and 87 deletions

View File

@@ -14,14 +14,4 @@ import { ItemSearchResultListElementComponent } from '../../../../../shared/obje
*/ */
export class JournalIssueSearchResultListElementComponent extends ItemSearchResultListElementComponent { export class JournalIssueSearchResultListElementComponent extends ItemSearchResultListElementComponent {
/**
* Display thumbnails if required by configuration
*/
showThumbnails: boolean;
ngOnInit(): void {
super.ngOnInit();
this.showThumbnails = this.appConfig.browseBy.showThumbnails;
}
} }

View File

@@ -14,14 +14,4 @@ import { ItemSearchResultListElementComponent } from '../../../../../shared/obje
*/ */
export class JournalVolumeSearchResultListElementComponent extends ItemSearchResultListElementComponent { export class JournalVolumeSearchResultListElementComponent extends ItemSearchResultListElementComponent {
/**
* Display thumbnails if required by configuration
*/
showThumbnails: boolean;
ngOnInit(): void {
super.ngOnInit();
this.showThumbnails = this.appConfig.browseBy.showThumbnails;
}
} }

View File

@@ -14,14 +14,4 @@ import { ItemSearchResultListElementComponent } from '../../../../../shared/obje
*/ */
export class JournalSearchResultListElementComponent extends ItemSearchResultListElementComponent { export class JournalSearchResultListElementComponent extends ItemSearchResultListElementComponent {
/**
* Display thumbnails if required by configuration
*/
showThumbnails: boolean;
ngOnInit(): void {
super.ngOnInit();
this.showThumbnails = this.appConfig.browseBy.showThumbnails;
}
} }

View File

@@ -14,14 +14,4 @@ import { ItemSearchResultListElementComponent } from '../../../../../shared/obje
*/ */
export class OrgUnitSearchResultListElementComponent extends ItemSearchResultListElementComponent { export class OrgUnitSearchResultListElementComponent extends ItemSearchResultListElementComponent {
/**
* Display thumbnail if required by configuration
*/
showThumbnails: boolean;
ngOnInit(): void {
super.ngOnInit();
this.showThumbnails = this.appConfig.browseBy.showThumbnails;
}
} }

View File

@@ -1,4 +1,4 @@
import { Component, Inject } from '@angular/core'; import { Component } from '@angular/core';
import { import {
listableObjectComponent listableObjectComponent
} from '../../../../../shared/object-collection/shared/listable-object/listable-object.decorator'; } from '../../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
@@ -6,9 +6,6 @@ import { ViewMode } from '../../../../../core/shared/view-mode.model';
import { import {
ItemSearchResultListElementComponent ItemSearchResultListElementComponent
} from '../../../../../shared/object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component'; } from '../../../../../shared/object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component';
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
import { APP_CONFIG, AppConfig } from '../../../../../../config/app-config.interface';
@listableObjectComponent('PersonSearchResult', ViewMode.ListElement) @listableObjectComponent('PersonSearchResult', ViewMode.ListElement)
@Component({ @Component({
@@ -21,21 +18,4 @@ import { APP_CONFIG, AppConfig } from '../../../../../../config/app-config.inter
*/ */
export class PersonSearchResultListElementComponent extends ItemSearchResultListElementComponent { export class PersonSearchResultListElementComponent extends ItemSearchResultListElementComponent {
public constructor(
protected truncatableService: TruncatableService,
protected dsoNameService: DSONameService,
@Inject(APP_CONFIG) protected appConfig: AppConfig
) {
super(truncatableService, dsoNameService, appConfig);
}
/**
* Display thumbnail if required by configuration
*/
showThumbnails: boolean;
ngOnInit(): void {
super.ngOnInit();
this.showThumbnails = this.appConfig.browseBy.showThumbnails;
}
} }

View File

@@ -14,14 +14,4 @@ import { ItemSearchResultListElementComponent } from '../../../../../shared/obje
*/ */
export class ProjectSearchResultListElementComponent extends ItemSearchResultListElementComponent { export class ProjectSearchResultListElementComponent extends ItemSearchResultListElementComponent {
/**
* Display thumbnail if required by configuration
*/
showThumbnails: boolean;
ngOnInit(): void {
super.ngOnInit();
this.showThumbnails = this.appConfig.browseBy.showThumbnails;
}
} }

View File

@@ -8,6 +8,7 @@
[context]="context" [context]="context"
[hidePaginationDetail]="hidePaginationDetail" [hidePaginationDetail]="hidePaginationDetail"
[showPaginator]="showPaginator" [showPaginator]="showPaginator"
[showThumbnails]="showThumbnails"
(paginationChange)="onPaginationChange($event)" (paginationChange)="onPaginationChange($event)"
(pageChange)="onPageChange($event)" (pageChange)="onPageChange($event)"
(pageSizeChange)="onPageSizeChange($event)" (pageSizeChange)="onPageSizeChange($event)"
@@ -34,6 +35,7 @@
[context]="context" [context]="context"
[hidePaginationDetail]="hidePaginationDetail" [hidePaginationDetail]="hidePaginationDetail"
[showPaginator]="showPaginator" [showPaginator]="showPaginator"
[showThumbnails]="showThumbnails"
(paginationChange)="onPaginationChange($event)" (paginationChange)="onPaginationChange($event)"
(pageChange)="onPageChange($event)" (pageChange)="onPageChange($event)"
(pageSizeChange)="onPageSizeChange($event)" (pageSizeChange)="onPageSizeChange($event)"
@@ -50,6 +52,7 @@
[context]="context" [context]="context"
[hidePaginationDetail]="hidePaginationDetail" [hidePaginationDetail]="hidePaginationDetail"
[showPaginator]="showPaginator" [showPaginator]="showPaginator"
[showThumbnails]="showThumbnails"
(contentChange)="contentChange.emit($event)" (contentChange)="contentChange.emit($event)"
*ngIf="(currentMode$ | async) === viewModeEnum.DetailedListElement"> *ngIf="(currentMode$ | async) === viewModeEnum.DetailedListElement">
</ds-object-detail> </ds-object-detail>

View File

@@ -107,6 +107,11 @@ export class ObjectCollectionComponent implements OnInit {
*/ */
@Input() showPaginator = true; @Input() showPaginator = true;
/**
* Whether to show the thumbnail preview
*/
@Input() showThumbnails;
/** /**
* the page info of the list * the page info of the list
*/ */

View File

@@ -71,6 +71,11 @@ export class ListableObjectComponentLoaderComponent implements OnInit, OnChanges
*/ */
@Input() showLabel = true; @Input() showLabel = true;
/**
* Whether to show the thumbnail preview
*/
@Input() showThumbnails;
/** /**
* The value to display for this element * The value to display for this element
*/ */
@@ -127,6 +132,7 @@ export class ListableObjectComponentLoaderComponent implements OnInit, OnChanges
'linkType', 'linkType',
'listID', 'listID',
'showLabel', 'showLabel',
'showThumbnails',
'context', 'context',
'viewMode', 'viewMode',
'value', 'value',

View File

@@ -41,6 +41,11 @@ export class AbstractListableElementComponent<T extends ListableObject> {
*/ */
@Input() showLabel = true; @Input() showLabel = true;
/**
* Whether to show the thumbnail preview
*/
@Input() showThumbnails;
/** /**
* The context we matched on to get this component * The context we matched on to get this component
*/ */

View File

@@ -21,6 +21,7 @@
<ds-listable-object-component-loader [object]="object" <ds-listable-object-component-loader [object]="object"
[viewMode]="viewMode" [viewMode]="viewMode"
[context]="context" [context]="context"
[showThumbnails]="showThumbnails"
(contentChange)="contentChange.emit($event)"></ds-listable-object-component-loader> (contentChange)="contentChange.emit($event)"></ds-listable-object-component-loader>
</div> </div>
</div> </div>

View File

@@ -64,6 +64,11 @@ export class ObjectDetailComponent {
*/ */
@Input() showPaginator = true; @Input() showPaginator = true;
/**
* Whether to show the thumbnail preview
*/
@Input() showThumbnails;
/** /**
* Emit when one of the listed object has changed. * Emit when one of the listed object has changed.
*/ */

View File

@@ -19,7 +19,11 @@
<div class="card-columns row" *ngIf="objects?.hasSucceeded"> <div class="card-columns row" *ngIf="objects?.hasSucceeded">
<div class="card-column col col-sm-6 col-lg-4" *ngFor="let column of (columns$ | async)" @fadeIn> <div class="card-column col col-sm-6 col-lg-4" *ngFor="let column of (columns$ | async)" @fadeIn>
<div class="card-element" *ngFor="let object of column" [attr.data-test]="'grid-object' | dsBrowserOnly"> <div class="card-element" *ngFor="let object of column" [attr.data-test]="'grid-object' | dsBrowserOnly">
<ds-listable-object-component-loader [object]="object" [viewMode]="viewMode" [context]="context" [linkType]="linkType"></ds-listable-object-component-loader> <ds-listable-object-component-loader [object]="object"
[viewMode]="viewMode"
[context]="context"
[showThumbnails]="showThumbnails"
[linkType]="linkType"></ds-listable-object-component-loader>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -1,11 +1,12 @@
import { combineLatest as observableCombineLatest, BehaviorSubject, Observable } from 'rxjs'; import { BehaviorSubject, combineLatest as observableCombineLatest, Observable } from 'rxjs';
import { startWith, distinctUntilChanged, map } from 'rxjs/operators'; import { distinctUntilChanged, map, startWith } from 'rxjs/operators';
import { import {
ChangeDetectionStrategy, ChangeDetectionStrategy,
Component, Component,
EventEmitter, EventEmitter,
Input, OnInit, Input,
OnInit,
Output, Output,
ViewEncapsulation ViewEncapsulation
} from '@angular/core'; } from '@angular/core';
@@ -54,6 +55,11 @@ export class ObjectGridComponent implements OnInit {
*/ */
@Input() showPaginator = true; @Input() showPaginator = true;
/**
* Whether to show the thumbnail preview
*/
@Input() showThumbnails;
/** /**
* The whether or not the gear is hidden * The whether or not the gear is hidden
*/ */

View File

@@ -25,12 +25,13 @@
<ds-importable-list-item-control *ngIf="importable" [object]="object" <ds-importable-list-item-control *ngIf="importable" [object]="object"
[importConfig]="importConfig" [importConfig]="importConfig"
(importObject)="importObject.emit($event)"></ds-importable-list-item-control> (importObject)="importObject.emit($event)"></ds-importable-list-item-control>
<ds-listable-object-component-loader [object]="object" <ds-listable-object-component-loader [context]="context"
[viewMode]="viewMode"
[index]="i"
[context]="context"
[linkType]="linkType" [linkType]="linkType"
[listID]="selectionConfig?.listId" [listID]="selectionConfig?.listId"
[index]="i"
[object]="object"
[showThumbnails]="showThumbnails"
[viewMode]="viewMode"
(contentChange)="contentChange.emit($event)"></ds-listable-object-component-loader> (contentChange)="contentChange.emit($event)"></ds-listable-object-component-loader>
</li> </li>
</ul> </ul>

View File

@@ -81,6 +81,11 @@ export class ObjectListComponent {
*/ */
@Input() showPaginator = true; @Input() showPaginator = true;
/**
* Whether to show the thumbnail preview
*/
@Input() showThumbnails;
/** /**
* Emit when one of the listed object has changed. * Emit when one of the listed object has changed.
*/ */

View File

@@ -22,14 +22,9 @@ export class ItemSearchResultListElementComponent extends SearchResultListElemen
*/ */
itemPageRoute: string; itemPageRoute: string;
/**
* Display thumbnails if required by configuration
*/
showThumbnails: boolean;
ngOnInit(): void { ngOnInit(): void {
super.ngOnInit(); super.ngOnInit();
this.showThumbnails = this.appConfig.browseBy.showThumbnails; this.showThumbnails = this.showThumbnails ?? this.appConfig.browseBy.showThumbnails;
this.itemPageRoute = getItemPageRoute(this.dso); this.itemPageRoute = getItemPageRoute(this.dso);
} }
} }

View File

@@ -78,6 +78,11 @@ export class ThemedObjectListComponent extends ThemedComponent<ObjectListCompone
*/ */
@Input() showPaginator: boolean; @Input() showPaginator: boolean;
/**
* Whether to show the thumbnail preview
*/
@Input() showThumbnails;
/** /**
* Emit when one of the listed object has changed. * Emit when one of the listed object has changed.
*/ */
@@ -156,6 +161,7 @@ export class ThemedObjectListComponent extends ThemedComponent<ObjectListCompone
'importable', 'importable',
'importConfig', 'importConfig',
'showPaginator', 'showPaginator',
'showThumbnails',
'contentChange', 'contentChange',
'prev', 'prev',
'next', 'next',

View File

@@ -13,6 +13,7 @@
[linkType]="linkType" [linkType]="linkType"
[context]="context" [context]="context"
[hidePaginationDetail]="hidePaginationDetail" [hidePaginationDetail]="hidePaginationDetail"
[showThumbnails]="showThumbnails"
(contentChange)="contentChange.emit($event)" (contentChange)="contentChange.emit($event)"
(deselectObject)="deselectObject.emit($event)" (deselectObject)="deselectObject.emit($event)"
(selectObject)="selectObject.emit($event)"> (selectObject)="selectObject.emit($event)">

View File

@@ -52,6 +52,11 @@ export class SearchResultsComponent {
*/ */
@Input() showCsvExport = false; @Input() showCsvExport = false;
/**
* Whether to show the thumbnail preview
*/
@Input() showThumbnails;
/** /**
* The current sorting configuration of the search * The current sorting configuration of the search
*/ */

View File

@@ -21,7 +21,7 @@ import { ListableObject } from '../../object-collection/shared/listable-object.m
templateUrl: '../../theme-support/themed.component.html', templateUrl: '../../theme-support/themed.component.html',
}) })
export class ThemedSearchResultsComponent extends ThemedComponent<SearchResultsComponent> { export class ThemedSearchResultsComponent extends ThemedComponent<SearchResultsComponent> {
protected inAndOutputNames: (keyof SearchResultsComponent & keyof this)[] = ['linkType', 'searchResults', 'searchConfig', 'showCsvExport', 'sortConfig', 'viewMode', 'configuration', 'disableHeader', 'selectable', 'context', 'hidePaginationDetail', 'selectionConfig', 'contentChange', 'deselectObject', 'selectObject']; protected inAndOutputNames: (keyof SearchResultsComponent & keyof this)[] = ['linkType', 'searchResults', 'searchConfig', 'showCsvExport', 'showThumbnails', 'sortConfig', 'viewMode', 'configuration', 'disableHeader', 'selectable', 'context', 'hidePaginationDetail', 'selectionConfig', 'contentChange', 'deselectObject', 'selectObject'];
@Input() linkType: CollectionElementLinkType; @Input() linkType: CollectionElementLinkType;
@@ -31,6 +31,8 @@ export class ThemedSearchResultsComponent extends ThemedComponent<SearchResultsC
@Input() showCsvExport: boolean; @Input() showCsvExport: boolean;
@Input() showThumbnails: boolean;
@Input() sortConfig: SortOptions; @Input() sortConfig: SortOptions;
@Input() viewMode: ViewMode; @Input() viewMode: ViewMode;

View File

@@ -38,6 +38,7 @@
[selectable]="selectable" [selectable]="selectable"
[selectionConfig]="selectionConfig" [selectionConfig]="selectionConfig"
[showCsvExport]="showCsvExport" [showCsvExport]="showCsvExport"
[showThumbnails]="showThumbnails"
(contentChange)="onContentChange($event)" (contentChange)="onContentChange($event)"
(deselectObject)="deselectObject.emit($event)" (deselectObject)="deselectObject.emit($event)"
(selectObject)="selectObject.emit($event)"></ds-themed-search-results> (selectObject)="selectObject.emit($event)"></ds-themed-search-results>

View File

@@ -128,6 +128,11 @@ export class SearchComponent implements OnInit {
*/ */
@Input() showSidebar = true; @Input() showSidebar = true;
/**
* Whether to show the thumbnail preview
*/
@Input() showThumbnails;
/** /**
* Whether to show the view mode switch * Whether to show the view mode switch
*/ */

View File

@@ -19,7 +19,7 @@ import { ListableObject } from '../object-collection/shared/listable-object.mode
templateUrl: '../theme-support/themed.component.html', templateUrl: '../theme-support/themed.component.html',
}) })
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', 'showCsvExport', 'showSidebar', 'showViewModes', 'useUniquePageId', 'viewModeList', 'showScopeSelector', 'resultFound', 'deselectObject', 'selectObject', 'trackStatistics', 'query']; protected inAndOutputNames: (keyof SearchComponent & keyof this)[] = ['configurationList', 'context', 'configuration', 'fixedFilterQuery', 'useCachedVersionIfAvailable', 'inPlaceSearch', 'linkType', 'paginationId', 'searchEnabled', 'sideBarWidth', 'searchFormPlaceholder', 'selectable', 'selectionConfig', 'showCsvExport', 'showSidebar', 'showThumbnails', 'showViewModes', 'useUniquePageId', 'viewModeList', 'showScopeSelector', 'resultFound', 'deselectObject', 'selectObject', 'trackStatistics', 'query'];
@Input() configurationList: SearchConfigurationOption[]; @Input() configurationList: SearchConfigurationOption[];
@@ -51,6 +51,8 @@ export class ThemedSearchComponent extends ThemedComponent<SearchComponent> {
@Input() showSidebar: boolean; @Input() showSidebar: boolean;
@Input() showThumbnails;
@Input() showViewModes: boolean; @Input() showViewModes: boolean;
@Input() useUniquePageId: boolean; @Input() useUniquePageId: boolean;