import { Component, Inject, Input, OnChanges, SimpleChanges } from '@angular/core'; import { MetadataValue } from '../../../core/shared/metadata.models'; import { APP_CONFIG, AppConfig } from '../../../../config/app-config.interface'; /** * 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 { constructor( @Inject(APP_CONFIG) private appConfig: AppConfig, ) { } /** * 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 = !!this.appConfig.markdown.enabled && this.enableMarkdown; } }