From 329c0891aec59f57df47e5df914d6206094d8311 Mon Sep 17 00:00:00 2001
From: ulises
Date: Sun, 22 Nov 2026 22:01:50 -0600
Subject: [PATCH] TEA indicators: Resumen and Trazabilidad tabs, round help
buttons, series chips, shared colours, summary box, three-per-row grid and
three-significant-digit EEG values
---
.../indicadores/indicador-ayuda.spec.ts | 50 ++++
.../features/indicadores/indicador-ayuda.ts | 39 ++++
.../indicadores/indicador-catalog-card.ts | 12 +-
.../indicadores/indicador-figure-card.html | 19 +-
.../indicadores/indicador-figure-card.scss | 5 +
.../indicadores/indicador-figure-card.spec.ts | 10 +
.../indicadores/indicador-figure-card.ts | 5 +-
.../indicador-figure-panel.spec.ts | 3 +
.../indicadores/indicador-figure-panel.ts | 11 +-
.../indicadores/indicadores-c1-donut.spec.ts | 4 +-
.../indicadores/indicadores-c2-palette.ts | 4 +-
.../indicadores/indicadores-c2-panel.spec.ts | 2 +-
.../indicadores-historico-figures.spec.ts | 12 +-
.../indicadores-historico-figures.ts | 28 ++-
.../indicadores-historico-pestana.spec.ts | 3 +-
.../indicadores-historico-series.spec.ts | 26 +++
.../indicadores/indicadores-historico.spec.ts | 5 +-
.../indicadores/indicadores-historico.ts | 83 ++++++-
.../indicadores/indicadores-page.html | 2 +-
.../indicadores/indicadores-page.scss | 3 +
.../indicadores/indicadores-page.spec.ts | 5 +-
.../features/indicadores/indicadores-page.ts | 7 +-
.../indicadores-recorrido-analisis.spec.ts | 3 +-
.../indicadores/indicadores-sections.spec.ts | 3 +-
.../indicadores-tea-secciones.spec.ts | 6 +-
.../indicadores/indicadores-tracking.html | 14 +-
.../indicadores/indicadores-tracking.scss | 3 +-
.../indicadores/indicadores-tracking.ts | 17 ++
.../indicadores/tea-paciente-resumen.html | 220 ++++++++++++------
.../indicadores/tea-paciente-resumen.scss | 46 ++--
.../indicadores/tea-paciente-resumen.ts | 22 +-
.../indicadores/tea-resumen-periodo.spec.ts | 11 +-
.../indicadores/tea-resumen-periodo.ts | 12 +-
.../indicadores/tea-seguimiento.spec.ts | 156 ++++++++-----
34 files changed, 625 insertions(+), 226 deletions(-)
create mode 100644 src/app/features/indicadores/indicador-ayuda.spec.ts
create mode 100644 src/app/features/indicadores/indicador-ayuda.ts
create mode 100644 src/app/features/indicadores/indicadores-historico-series.spec.ts
diff --git a/src/app/features/indicadores/indicador-ayuda.spec.ts b/src/app/features/indicadores/indicador-ayuda.spec.ts
new file mode 100644
index 0000000..e177c77
--- /dev/null
+++ b/src/app/features/indicadores/indicador-ayuda.spec.ts
@@ -0,0 +1,50 @@
+// Covers the round "?" help of TEA's cards: hover or focus shows the text, a click keeps it until the next click.
+// Fixture: a host component that projects one line of text into the button.
+import { Component } from '@angular/core';
+import { TestBed } from '@angular/core/testing';
+import { IndicadorAyuda } from './indicador-ayuda';
+
+@Component({ imports: [IndicadorAyuda], template: `Texto de ayuda` })
+class Host { aperturas = 0; }
+
+describe('Ayuda redonda', () => {
+ function crear() {
+ const fixture = TestBed.createComponent(Host);
+ fixture.detectChanges();
+ const root: HTMLElement = fixture.nativeElement;
+ const boton = () => root.querySelector('.ayuda-boton')!;
+ const texto = () => root.querySelector('.ayuda-texto')?.textContent?.trim();
+ const ayuda = root.querySelector('.ayuda')!;
+ return { fixture, boton, texto, ayuda };
+ }
+
+ it('muestra el texto al pasar el cursor y lo oculta al salir', () => {
+ // Fails if hovering stops showing the guide or leaving leaves it open when it was not pinned.
+ const { fixture, texto, ayuda } = crear();
+ expect(texto()).toBeUndefined();
+ ayuda.dispatchEvent(new MouseEvent('mouseenter')); fixture.detectChanges();
+ expect(texto()).toBe('Texto de ayuda');
+ ayuda.dispatchEvent(new MouseEvent('mouseleave')); fixture.detectChanges();
+ expect(texto()).toBeUndefined();
+ });
+
+ it('un clic fija el texto hasta el siguiente clic', () => {
+ // Fails if the click stops pinning the text, if leaving closes a pinned text, or if a second click does not close it.
+ const { fixture, boton, texto, ayuda } = crear();
+ ayuda.dispatchEvent(new MouseEvent('mouseenter')); boton().click(); fixture.detectChanges();
+ ayuda.dispatchEvent(new MouseEvent('mouseleave')); fixture.detectChanges();
+ expect(texto()).toBe('Texto de ayuda');
+ expect(boton().getAttribute('aria-expanded')).toBe('true');
+ boton().click(); fixture.detectChanges();
+ expect(texto()).toBeUndefined();
+ expect(boton().getAttribute('aria-expanded')).toBe('false');
+ });
+
+ it('avisa solo al abrirse con un clic y nombra el botón', () => {
+ // Fails if closing also reports an opening (the metadata would be requested again) or the accessible name is lost.
+ const { fixture, boton } = crear();
+ boton().click(); boton().click(); boton().click(); fixture.detectChanges();
+ expect(fixture.componentInstance.aperturas).toBe(2);
+ expect(boton().getAttribute('aria-label')).toBe('Cómo leer: prueba');
+ });
+});
diff --git a/src/app/features/indicadores/indicador-ayuda.ts b/src/app/features/indicadores/indicador-ayuda.ts
new file mode 100644
index 0000000..ffeb980
--- /dev/null
+++ b/src/app/features/indicadores/indicador-ayuda.ts
@@ -0,0 +1,39 @@
+import { Component, input, output, signal } from '@angular/core';
+
+// Round "?" button at the top right of a card. Hover or focus shows its text; a click keeps it open until the next click.
+@Component({
+ selector: 'app-indicador-ayuda',
+ template: `
+
+
+ @if (visible()) {
+
+ }
+
+ `,
+ styles: `
+ :host { position: absolute; top: .5rem; right: .5rem; z-index: 2; }
+ .ayuda { position: relative; }
+ .ayuda-boton { display: inline-flex; align-items: center; justify-content: center; width: 1.75rem; height: 1.75rem; padding: 0; border: 0;
+ border-radius: 50%; background: transparent; box-shadow: inset 0 0 0 1.5px var(--issste-text-secondary); color: var(--issste-text); font: inherit; font-weight: 800; line-height: 1; cursor: pointer; }
+ .ayuda-boton:focus-visible { outline: 2px solid var(--issste-text); outline-offset: 3px; }
+ .ayuda-texto { position: absolute; top: calc(100% + .375rem); right: 0; width: min(22rem, 80vw); box-sizing: border-box; padding: var(--issste-space-3) var(--issste-space-4);
+ background: var(--issste-surface); color: var(--issste-text); border: 1px solid var(--issste-border); border-inline-start: 3px solid var(--issste-accent);
+ border-radius: var(--issste-radius); box-shadow: 0 4px 16px rgb(0 0 0 / .18); font: var(--mat-sys-body-small); line-height: 1.5; text-align: start; overflow-wrap: anywhere; }
+ `,
+})
+export class IndicadorAyuda {
+ readonly etiqueta = input('Cómo leer');
+ readonly opened = output();
+ readonly sobre = signal(false);
+ readonly fijo = signal(false);
+ private static contador = 0;
+ readonly idPanel = 'ayuda-' + ++IndicadorAyuda.contador;
+ visible() { return this.sobre() || this.fijo(); }
+ alternar() {
+ const abre = !this.fijo();
+ this.fijo.set(abre);
+ if (abre) this.opened.emit();
+ }
+}
diff --git a/src/app/features/indicadores/indicador-catalog-card.ts b/src/app/features/indicadores/indicador-catalog-card.ts
index d175696..2e21b53 100644
--- a/src/app/features/indicadores/indicador-catalog-card.ts
+++ b/src/app/features/indicadores/indicador-catalog-card.ts
@@ -24,16 +24,18 @@ import { parTiempos } from './indicadores-tiempos-pareados';
import { IndicadorConteosPareados } from './indicador-conteos-pareados';
import { parConteos } from './indicadores-conteos-pareados';
+const DOBLE_ANCHO_TEA: readonly string[] = ['M28_casos_por_estado', 'M23_pacientes_evaluados'];
+
@Component({
selector: 'app-indicador-catalog-card',
- host: { '[class.dual-card]': 'isDual || isEu7 || isConfirmacion || isHistopatologia || !!tiempos || !!conteos' },
+ host: { '[class.dual-card]': 'isDual || isEu7 || isConfirmacion || isHistopatologia || !!tiempos || !!conteos', '[class.doble]': 'ocupaDos' },
imports: [MatButtonModule, MatCardModule, MatIconModule, IndicadorFigurePanel, IndicadorEu7Escenario, IndicadorTiemposPareados, IndicadorConfirmacionCitologia, IndicadorHistopatologiaCama, IndicadorConteosPareados],
template: `
@if (!conteos) {
}
@@ -81,12 +83,13 @@ import { parConteos } from './indicadores-conteos-pareados';
`,
styles: `
:host { display: flex; min-width: 0; margin: 0; }
- mat-card { flex: 1; min-width: 0; padding: clamp(.75rem, 2vw, 1.5rem); background: var(--issste-surface);
+ mat-card { position: relative; flex: 1; min-width: 0; padding: clamp(.75rem, 2vw, 1.5rem); background: var(--issste-surface);
color: var(--issste-text); border: 1px solid var(--issste-border); border-radius: var(--issste-radius); box-shadow: none; }
header { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: var(--issste-space-3); }
.catalog-content { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.graphic-region { flex: 1; min-width: 0; }
:host(.dual-card) { grid-column: 1 / -1; }
+ :host(.doble) { grid-column: span 2; }
.graphic-region { display: grid; grid-template-columns: minmax(0, 1fr); }
.representation-panel { display: grid; min-width: 0; grid-template-rows: auto minmax(0, 1fr); }
.representation-panel > h3 { margin: 1rem 0 0; overflow-wrap: anywhere; }
@@ -108,6 +111,7 @@ import { parConteos } from './indicadores-conteos-pareados';
.card-identity { min-width: 0; }
h2, p { overflow-wrap: anywhere; }
h2 { margin: 0; font-family: var(--issste-font-heading); font-weight: 500; font-size: 1.125rem; line-height: 1.3; }
+ h2.con-ayuda { padding-right: 2.5rem; }
.pin-toggle { align-self: start; margin-top: var(--issste-space-1); max-width: 100%; height: auto;
min-width: 48px; min-height: 48px; color: var(--issste-text); }
.pin-toggle mat-icon { flex-shrink: 0; }
@@ -137,6 +141,8 @@ export class IndicadorCatalogCard implements OnChanges, OnDestroy {
}
// Every domain follows CaMa's mockup: no pin, representation selector or figure count.
get sobrio() { return true; }
+ // TEA's stacked case charts span two columns of its three-column grid.
+ get ocupaDos() { return this.dominio === 'tea' && DOBLE_ANCHO_TEA.includes(this.indicador.id); }
get pair() { return dualFigures(this.indicador); }
get isEu7() { return this.dominio === 'cacu' && this.indicador.id === 'cacu_eu7'; }
get isConfirmacion() { return this.dominio === 'cacu' && this.indicador.id === ID_CONFIRMACION; }
diff --git a/src/app/features/indicadores/indicador-figure-card.html b/src/app/features/indicadores/indicador-figure-card.html
index 406c5c4..58e55a3 100644
--- a/src/app/features/indicadores/indicador-figure-card.html
+++ b/src/app/features/indicadores/indicador-figure-card.html
@@ -1,5 +1,12 @@
-
-@if (selected) {
+
+@if (selected && ayudaRedonda) {
+
+ @for (line of interpretation; track $index) { - {{ line }}
}
+ @if (state.status === 'ready' && state.footnotes?.length) {
+ @for (note of state.footnotes; track $index) { {{ note }}
}
+ }
+
+} @else if (selected) {
}
-
- Figura: {{ figureDisplayName(figuraId, selected?.figuras ?? []) }}
+ @if (!ayudaRedonda) {
+
+ Figura: {{ figureDisplayName(figuraId, selected?.figuras ?? []) }}
+ }
} @else {
{{ !selected?.figuras?.length ? 'El indicador no tiene figuras disponibles.' : 'Completa una selección válida para consultar la figura.' }}
}
@@ -84,7 +93,7 @@
}
@if (state.status === 'ready' && state.highlight; as h) {
-
+
Selección: {{ highlightStatus }}
@for (row of highlightRows(h); track row.group?.id ?? '') {
diff --git a/src/app/features/indicadores/indicador-figure-card.scss b/src/app/features/indicadores/indicador-figure-card.scss
index 3fe56b0..8f2c09f 100644
--- a/src/app/features/indicadores/indicador-figure-card.scss
+++ b/src/app/features/indicadores/indicador-figure-card.scss
@@ -22,6 +22,7 @@
.methodology-toggle:focus-visible { outline: 2px solid var(--issste-text); outline-offset: 3px; }
.figure-card { display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
overflow: visible; min-width: 0; border: 1px solid var(--issste-border); }
+.figure-card.sin-marco { position: static; border: 0; box-shadow: none; background: transparent; --mat-card-outlined-outline-width: 0; --mat-card-elevated-container-elevation: none; }
.figure-heading { grid-row: 2; min-width: 0; padding-bottom: .5rem; }
.interpretation { grid-row: 1; }
.figure-legend { grid-row: 3; min-width: 0; }
@@ -117,6 +118,7 @@
.highlight-legend { display: grid; gap: .5rem; padding: .5rem .75rem .75rem; color: var(--issste-text); }
.dark .highlight-legend { color: #eef1f7; }
.highlight-status { margin: 0; font-weight: 600; }
+.sin-estado .highlight-status { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.highlight-back { justify-self: start; }
.highlight-keys { display: flex; flex-wrap: wrap; gap: .5rem; }
.highlight-legend button { display: inline-flex; align-items: center; gap: .4rem; min-height: 36px; padding: .3rem .75rem; text-align: start;
@@ -126,3 +128,6 @@
.highlight-legend button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.highlight-legend .legend-swatch { border-radius: 50%; }
.highlight-legend .highlight-group { font-weight: 600; }
+
+.ayuda-lista { margin: 0; padding-left: 1.1rem; }
+.ayuda-nota { margin: .5rem 0 0; }
diff --git a/src/app/features/indicadores/indicador-figure-card.spec.ts b/src/app/features/indicadores/indicador-figure-card.spec.ts
index d7b6cd9..be6bde9 100644
--- a/src/app/features/indicadores/indicador-figure-card.spec.ts
+++ b/src/app/features/indicadores/indicador-figure-card.spec.ts
@@ -515,4 +515,14 @@ describe('IndicadorFigureCard', () => {
expect(JSON.stringify(original)).toBe(snapshot); expect(JSON.stringify(copy)).toBe(copySnapshot);
});
+ it('con la ayuda redonda no repite el título ni el nombre de la figura', () => {
+ // Fails if TEA's cards bring back the heading box with the title and «Figura: …» under the card's own title.
+ fixture.componentRef.setInput('ayudaRedonda', true);
+ ready({ data: [{ y: [1] }], layout: {} });
+ const root: HTMLElement = fixture.nativeElement;
+ expect(root.querySelector('.figure-title')).toBeNull();
+ expect(root.querySelector('.figure-id')).toBeNull();
+ expect(root.querySelector('.ayuda-boton')).not.toBeNull();
+ expect(root.querySelector('.interpretation')).toBeNull();
+ });
});
diff --git a/src/app/features/indicadores/indicador-figure-card.ts b/src/app/features/indicadores/indicador-figure-card.ts
index dc6f8cc..3e56541 100644
--- a/src/app/features/indicadores/indicador-figure-card.ts
+++ b/src/app/features/indicadores/indicador-figure-card.ts
@@ -10,6 +10,7 @@ import { figureDisplayName } from './indicadores-figure-labels';
import { CategoryLabel } from './indicadores-axis-labels';
import { figureIdentity, identityElementId } from './indicadores-identities';
import { PlotlyChart } from '../../shared/plotly/plotly-chart';
+import { IndicadorAyuda } from './indicador-ayuda';
import { figureInterpretation, PERIOD_INTERPRETATION } from './indicadores-methodology';
import { DonutHierarchy, DonutLegendEntry, DonutSelection, donutSimpleView, donutView } from './indicadores-donut-drilldown';
import { FigureHighlight, highlightAt, highlightFigure, highlightLabel, highlightRows, HighlightSelection, toggleHighlight } from './indicadores-highlight';
@@ -41,7 +42,7 @@ export interface FigureState {
selector: 'app-indicador-figure-card',
standalone: true,
host: { '[class.methodology-expanded]': 'methodologyExpanded()' },
- imports: [MatButtonModule, MatIconModule, MatCardModule, MatProgressBarModule, MatTooltipModule, PlotlyChart],
+ imports: [MatButtonModule, MatIconModule, MatCardModule, MatProgressBarModule, MatTooltipModule, PlotlyChart, IndicadorAyuda],
templateUrl: './indicador-figure-card.html',
styleUrl: './indicador-figure-card.scss',
})
@@ -142,6 +143,8 @@ export class IndicadorFigureCard implements OnChanges {
if (point?.curveNumber === (this.activeParent ? 1 : 0) && typeof point.label === 'string') this.expandParent(point.label);
else if (this.activeParent && point?.curveNumber === 0 && typeof point.label === 'string') this.selectCategory(point.label);
}
+ // A round "?" button with the reading guide instead of the «Cómo leer» box.
+ @Input() ayudaRedonda = false;
@Input() selected?: Indicador;
@Input() metadata?: IndicadorMetadatos;
@Input({ required: true }) figuraId!: string;
diff --git a/src/app/features/indicadores/indicador-figure-panel.spec.ts b/src/app/features/indicadores/indicador-figure-panel.spec.ts
index e34ec83..d858e65 100644
--- a/src/app/features/indicadores/indicador-figure-panel.spec.ts
+++ b/src/app/features/indicadores/indicador-figure-panel.spec.ts
@@ -33,6 +33,8 @@ describe('IndicadorFigurePanel', () => {
fixture.componentRef.setInput('dominio', 'tea');
fixture.componentRef.setInput('indicador', catalog[0]);
fixture.componentRef.setInput('figuraId', 'f1');
+ // These tests cover the «Cómo leer» box shared by the domains; TEA's round help has its own spec.
+ fixture.componentRef.setInput('ayudaRedonda', false);
fixture.componentRef.setInput('tema', 'claro');
state = TestBed.inject(IndicadoresMemory).restoreGlobal('tea', ['semestre']);
fixture.componentRef.setInput('applied', state.applied);
@@ -373,6 +375,7 @@ describe('IndicadorFigurePanel', () => {
fixture = TestBed.createComponent(IndicadorFigurePanel);
fixture.componentRef.setInput('dominio', 'tea'); fixture.componentRef.setInput('indicador', catalog[0]);
fixture.componentRef.setInput('figuraId', 'f1'); fixture.componentRef.setInput('tema', 'claro');
+ fixture.componentRef.setInput('ayudaRedonda', false);
fixture.componentRef.setInput('applied', state.applied);
page = fixture.componentInstance; load(); figure().flush({ data: [], layout: {} });
expect(JSON.stringify(state)).toBe(snapshot);
diff --git a/src/app/features/indicadores/indicador-figure-panel.ts b/src/app/features/indicadores/indicador-figure-panel.ts
index 0213b44..711c4c4 100644
--- a/src/app/features/indicadores/indicador-figure-panel.ts
+++ b/src/app/features/indicadores/indicador-figure-panel.ts
@@ -23,9 +23,10 @@ import { MatTooltipModule } from '@angular/material/tooltip';
@Component({
selector: 'app-indicador-figure-panel',
+ host: { '[class.ayuda-externa]': 'conAyudaRedonda' },
imports: [IndicadorFigureCard, MatTooltipModule],
template: `
-