[CST-4633] fix issue with view mode list

This commit is contained in:
Giuseppe Digilio
2021-12-24 11:41:23 +01:00
parent 6f86824f23
commit cff29539fb
4 changed files with 19 additions and 4 deletions

View File

@@ -4,6 +4,7 @@ import { SearchConfigurationOption } from '../search-switch-configuration/search
import { Observable } from 'rxjs';
import { PaginatedSearchOptions } from '../models/paginated-search-options.model';
import { SortOptions } from '../../../core/cache/models/sort-options.model';
import { ViewMode } from '../../../core/shared/view-mode.model';
/**
* This component renders a simple item page.
@@ -50,7 +51,7 @@ export class SearchSidebarComponent {
/**
* The list of available view mode options
*/
@Input() viewModeList;
@Input() viewModeList: ViewMode[];
/**
* Whether to show the view mode switch

View File

@@ -47,6 +47,7 @@
[sortOptionsList]="(sortOptionsList$ | async)"
[currentSortOption]="(currentSortOptions$ | async)"
[inPlaceSearch]="inPlaceSearch"
[viewModeList]="viewModeList"
(changeConfiguration)="changeContext($event.context)"></ds-search-sidebar>
<ds-search-sidebar id="search-sidebar-sm" *ngIf="(isXsOrSm$ | async)"
[configurationList]="configurationList"
@@ -56,6 +57,7 @@
[searchOptions]="(searchOptions$ | async)"
[sortOptionsList]="(sortOptionsList$ | async)"
[currentSortOption]="(currentSortOptions$ | async)"
[viewModeList]="viewModeList"
(toggleSidebar)="closeSidebar()"
(changeConfiguration)="changeContext($event.context)">
</ds-search-sidebar>

View File

@@ -96,6 +96,11 @@ export class SearchComponent implements OnInit {
*/
@Input() showSidebar = true;
/**
* List of available view mode
*/
@Input() useUniquePageId: false;
/**
* List of available view mode
*/
@@ -178,8 +183,11 @@ export class SearchComponent implements OnInit {
* If something changes, update the list of scopes for the dropdown
*/
ngOnInit(): void {
if (this.useUniquePageId) {
// Create an unique pagination id related to the instance of the SearchComponent
this.paginationId = uniqueId(this.paginationId);
}
this.searchConfigService.setPaginationId(this.paginationId);
if (hasValue(this.fixedFilterQuery)) {

View File

@@ -17,13 +17,17 @@ import { Router } from '@angular/router';
templateUrl: './view-mode-switch.component.html'
})
export class ViewModeSwitchComponent implements OnInit, OnDestroy {
@Input() viewModeList: ViewMode[];
/**
* True when the search component should show results on the current page
*/
@Input() inPlaceSearch;
/**
* List of available view mode
*/
@Input() viewModeList: ViewMode[];
/**
* The current view mode
*/