choice.component.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { Component, Input } from '@angular/core';
  2. import { EditionLevelType } from '../../app.config';
  3. import { Choice } from '../../models/evt-models';
  4. import { register } from '../../services/component-register.service';
  5. import { EditionlevelSusceptible, Highlightable, TextFlowSusceptible } from '../components-mixins';
  6. export interface ChoiceComponent extends EditionlevelSusceptible, Highlightable, TextFlowSusceptible { }
  7. @Component({
  8. selector: 'evt-choice',
  9. templateUrl: './choice.component.html',
  10. styleUrls: ['./choice.component.scss'],
  11. })
  12. @register(Choice)
  13. export class ChoiceComponent {
  14. @Input() data: Choice;
  15. get content() {
  16. if (this.editionLevel === 'diplomatic') {
  17. return this.data.originalContent;
  18. }
  19. return this.data.normalizedContent;
  20. }
  21. get alternativeContent() {
  22. if (this.editionLevel === 'diplomatic') {
  23. return this.data.normalizedContent;
  24. }
  25. return this.data.originalContent;
  26. }
  27. get alternativeEditionLevel(): EditionLevelType {
  28. return this.editionLevel === 'diplomatic' ? 'interpretative' : 'diplomatic';
  29. }
  30. }