Files
dspace-angular/src/app/item-page/field-components/metadata-values/metadata-values.component.ts
Samuel Cambien 2af9984ace repair tests
2022-09-29 12:58:07 +02:00

47 lines
1.4 KiB
TypeScript

import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
import { MetadataValue } from '../../../core/shared/metadata.models';
import { environment } from '../../../../environments/environment';
/**
* This component renders the configured 'values' into the ds-metadata-field-wrapper component.
* It puts the given 'separator' between each two values.
*/
@Component({
selector: 'ds-metadata-values',
styleUrls: ['./metadata-values.component.scss'],
templateUrl: './metadata-values.component.html'
})
export class MetadataValuesComponent implements OnChanges {
/**
* The metadata values to display
*/
@Input() mdValues: MetadataValue[];
/**
* The seperator used to split the metadata values (can contain HTML)
*/
@Input() separator: string;
/**
* The label for this iteration of metadata values
*/
@Input() label: string;
/**
* Whether the {@link MarkdownPipe} should be used to render these metadata values.
* This will only have effect if {@link MarkdownConfig#enabled} is true.
* Mathjax will only be rendered if {@link MarkdownConfig#mathjax} is true.
*/
@Input() enableMarkdown = false;
/**
* This variable will be true if both {@link environment.markdown.enabled} and {@link enableMarkdown} are true.
*/
renderMarkdown;
ngOnChanges(changes: SimpleChanges): void {
this.renderMarkdown = !!environment.markdown.enabled && this.enableMarkdown;
}
}