openaire-library/claims/claim-utils/claimEntitiesSelection.comp...

40 lines
1.4 KiB
TypeScript

import {Component, Input, ViewChild} from '@angular/core';
import {ShowOptions} from './claimHelper.class';
import {MatSelect} from "@angular/material/select";
import {OpenaireEntities} from "../../utils/properties/searchFields";
@Component({
selector: 'claim-enities-selection',
template:`
<span *ngIf="showOptions && showOptions.linkToEntities && showOptions.linkToEntities.length > 0"
class=" entitiesSelection portal-box uk-text-small clickable" style=""
(click)="open()">
<mat-select [(value)]="showOptions.show"
[disableOptionCentering]="true" >
<mat-option *ngIf="showOptions.linkToEntities.indexOf('result')!=-1" value="result">{{openaireEntities.RESULTS}}</mat-option>
<mat-option *ngIf="showOptions.linkToEntities.indexOf('project')!=-1" value="project">{{openaireEntities.PROJECTS}}</mat-option>
<mat-option *ngIf="showOptions.linkToEntities.indexOf('context')!=-1" value="context">{{openaireEntities.COMMUNITIES}}</mat-option>
</mat-select>
</span>
`,
})
export class ClaimEntitiesSelectionComponent{
@ViewChild(MatSelect) matSelect: MatSelect;
@Input() showOptions:ShowOptions = new ShowOptions();
public openaireEntities = OpenaireEntities;
open() {
if (this.matSelect && !this.matSelect.focused) {
this.matSelect.open();
}
}
}