import { Component, Input, output } from '@angular/core'; import { MatButtonModule } from '@angular/material/button'; import { Dominio, Indicador, TipoPeriodo } from './indicadores.models'; import { figureDisplayName } from './indicadores-figure-labels'; import { PERIOD_INTERPRETATION } from './indicadores-methodology'; import { IndicadorMetadata } from './indicador-metadata'; @Component({ selector: 'app-indicadores-definitions', imports: [MatButtonModule, IndicadorMetadata], templateUrl: './indicadores-definitions.html', styleUrl: './indicadores-definitions.scss', }) export class IndicadoresDefinitions { readonly opened = new Set(); open(id: string, event: Event) { if ((event.target as HTMLDetailsElement).open) this.opened.add(this.dominio + ':' + id); } @Input({ required: true }) dominio!: Dominio; @Input({ required: true }) catalog: readonly Indicador[] = []; @Input() loading = false; @Input() error = ''; readonly retry = output(); readonly domainNames: Record = { tea: 'trastorno del espectro autista', cacu: 'cáncer cervicouterino', cama: 'cáncer de mama', }; readonly periodNames: Record = { semestre: 'Semestral', mes: 'Mensual' }; readonly figureDisplayName = figureDisplayName; readonly periodInterpretation = PERIOD_INTERPRETATION; get periodTypes() { return [...new Set(this.catalog.flatMap(item => item.tipos_periodo))]; } }