1
0
Files
yel-dspace-angular/src/app/+browse-by/+browse-by-date-page/browse-by-date-page.component.ts
2019-02-11 13:11:47 +01:00

40 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { Component } from '@angular/core';
import {
BrowseByMetadataPageComponent,
browseParamsToOptions
} from '../+browse-by-metadata-page/browse-by-metadata-page.component';
import { BrowseEntrySearchOptions } from '../../core/browse/browse-entry-search-options.model';
import { combineLatest as observableCombineLatest } from 'rxjs/internal/observable/combineLatest';
@Component({
selector: 'ds-browse-by-date-page',
styleUrls: ['./browse-by-date-page.component.scss'],
templateUrl: './browse-by-date-page.component.html'
})
/**
* Component for browsing items by metadata definition of type 'date'
* A metadata definition is a short term used to describe one or multiple metadata fields.
* An example would be 'dateissued' for 'dc.date.issued'
*/
export class BrowseByDatePageComponent extends BrowseByMetadataPageComponent {
ngOnInit(): void {
this.updatePage(new BrowseEntrySearchOptions(null, this.paginationConfig, this.sortConfig));
this.subs.push(
observableCombineLatest(
this.route.params,
this.route.queryParams,
this.route.data,
(params, queryParams, data ) => {
return Object.assign({}, params, queryParams, data);
})
.subscribe((params) => {
this.metadata = params.metadata || this.defaultMetadata;
const searchOptions = browseParamsToOptions(params, Object.assign({}), this.sortConfig, this.metadata);
this.updatePageWithItems(searchOptions, this.value);
this.updateParent(params.scope);
}));
}
}