g.component.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { Component, Input } from '@angular/core';
  2. import { map } from 'rxjs/operators';
  3. import { G } from '../../models/evt-models';
  4. import { register } from '../../services/component-register.service';
  5. import { EVTModelService } from '../../services/evt-model.service';
  6. import { EditionlevelSusceptible, Highlightable, TextFlowSusceptible } from '../components-mixins';
  7. export interface GComponent extends EditionlevelSusceptible, Highlightable, TextFlowSusceptible { }
  8. @Component({
  9. selector: 'evt-g',
  10. templateUrl: './g.component.html',
  11. styleUrls: ['./g.component.scss'],
  12. })
  13. @register(G)
  14. export class GComponent {
  15. @Input() data: G;
  16. specialChars$ = this.evtModelService.specialChars$.pipe(
  17. map((specialChars) => specialChars.find(char => char.id === this.data.charId)),
  18. );
  19. diplomaticMapping$ = this.specialChars$.pipe(
  20. map((specialChar) => {
  21. const mapping = specialChar?.mappings.find(m => m.type === 'diplomatic');
  22. return mapping?.content ?? [];
  23. }),
  24. );
  25. normalizedMapping$ = this.specialChars$.pipe(
  26. map((specialChar) => {
  27. const mapping = specialChar?.mappings.find(m => m.type === 'normalized');
  28. return mapping?.content ?? [];
  29. }),
  30. );
  31. constructor(
  32. private evtModelService: EVTModelService,
  33. ) {
  34. }
  35. }