diff --git a/src/app/features/indicadores/indicador-conteos-pareados.html b/src/app/features/indicadores/indicador-conteos-pareados.html index 4d05c99..06d7829 100644 --- a/src/app/features/indicadores/indicador-conteos-pareados.html +++ b/src/app/features/indicadores/indicador-conteos-pareados.html @@ -1,25 +1,4 @@
-
-
- - @if (helpOpen) { - - } -
-
@switch (status()) { @case ('deferred') {

La vista se cargará al acercarse a esta región.

} @case ('loading') {

Cargando {{ par.unidades.examenes }} y {{ par.unidades.pacientes }} del mismo periodo…

} @@ -36,13 +15,45 @@ }
-

{{ par.unidades.examenes | titlecase }} por categoría, {{ m.periodo }}

+
+
+

{{ par.unidades.examenes | titlecase }} por categoría, {{ m.periodo }}

+
+ + @if (helpWhich === 'examenes') { + + } +
+
@if (total) { } @else {

{{ total === null ? 'Dona no disponible: hay celdas suprimidas o sin dato.' : 'Sin ' + par.unidades.examenes + ' en el periodo.' }}

} @if (m.sinDato) {

Fuera de la dona: {{ texto(m.sinDato) }} {{ par.unidades.examenes }} sin categoría.

}
-

{{ par.unidades.pacientes | titlecase }} por categoría, {{ m.periodo }}

+
+
+

{{ par.unidades.pacientes | titlecase }} por categoría, {{ m.periodo }}

+
+ + @if (helpWhich === 'pacientes') { + + } +
+
@if (totalPacientes) { } @else {

{{ !m.pacientesVerificados ? 'Dona de pacientes no disponible hasta verificar la definición publicada.' : totalPacientes === null ? 'Dona no disponible: hay celdas suprimidas o sin dato.' : 'Sin ' + par.unidades.pacientes + ' en el periodo.' }}

} diff --git a/src/app/features/indicadores/indicador-conteos-pareados.scss b/src/app/features/indicadores/indicador-conteos-pareados.scss index 80d515c..4f61da5 100644 --- a/src/app/features/indicadores/indicador-conteos-pareados.scss +++ b/src/app/features/indicadores/indicador-conteos-pareados.scss @@ -7,7 +7,9 @@ p, h3, summary { overflow-wrap: anywhere; } .reading-guide ul { margin: .5rem 0 0; padding-inline-start: 1.25rem; } .reading-guide + .reading-guide { margin-top: 1rem; } .reading-guide li + li { margin-top: .25rem; } -.help { position: relative; display: flex; justify-content: flex-end; } +.figure-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; } +.figure-head h3 { margin: 0; } +.help { position: relative; display: flex; flex: none; justify-content: flex-end; } .help .methodology { position: absolute; z-index: 8; top: calc(100% + .35rem); right: 0; width: min(34rem, calc(100vw - 2rem)); max-height: 18rem; overflow: auto; background: var(--issste-surface); box-shadow: 0 10px 28px rgb(0 0 0 / .14); } h3 { font-size: 1rem; font-weight: 500; line-height: 1.5; } .periods { display: flex; align-items: center; gap: var(--issste-space-3); } @@ -15,7 +17,6 @@ h3 { font-size: 1rem; font-weight: 500; line-height: 1.5; } border: 1px solid var(--issste-border); border-radius: var(--issste-radius); cursor: pointer; } .periods button:disabled { opacity: .5; cursor: default; } // The two figures share the card in equal halves; one above the other on a narrow card. -.conteos-head { display: flex; justify-content: flex-end; } .help-icon { display: inline-flex; align-items: center; justify-content: center; width: 1.75rem; height: 1.75rem; min-width: 1.75rem; min-height: 1.75rem; padding: 0; border: 0; border-radius: 50%; background: var(--issste-accent); color: var(--issste-on-accent); font: inherit; font-weight: 800; line-height: 1; cursor: pointer; } .help-icon:focus-visible { outline: 2px solid var(--issste-text); outline-offset: 3px; } .figures { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; } diff --git a/src/app/features/indicadores/indicador-conteos-pareados.ts b/src/app/features/indicadores/indicador-conteos-pareados.ts index 4d69cd9..ffd9d4e 100644 --- a/src/app/features/indicadores/indicador-conteos-pareados.ts +++ b/src/app/features/indicadores/indicador-conteos-pareados.ts @@ -48,8 +48,8 @@ export class IndicadorConteosPareados implements OnChanges, OnDestroy { get totalPacientes() { return this.model ? totalPacientes(this.model) : null; } texto(n: number | null) { return n === null ? 'Sin dato' : n.toLocaleString('es-MX'); } textoPacientes(n: number | null) { return n === null && this.model && !this.model.pacientesVerificados ? 'Pendiente' : this.texto(n); } - helpOpen = false; - private helpPinned = false; + helpWhich: 'examenes' | 'pacientes' | null = null; + private helpPinned: 'examenes' | 'pacientes' | null = null; // True only while a metadata request is outstanding. A failure leaves metadata empty, so the next // hover may ask again; the catalog card ignores a second ask until that request finishes. private helpAsked = false; @@ -60,23 +60,29 @@ export class IndicadorConteosPareados implements OnChanges, OnDestroy { const como_leer = (detail?.como_leer ?? []).filter(line => line.trim().length > 0); return descripcion || como_leer.length ? { descripcion, como_leer } : undefined; } - toggleHelp() { - if (this.helpPinned) { this.helpPinned = false; this.helpOpen = false; return; } - this.helpPinned = true; + toggleHelp(which: 'examenes' | 'pacientes') { + if (this.helpPinned === which) { this.helpPinned = null; this.helpWhich = null; return; } + this.helpPinned = which; + this.openHelp(which); + } + openHelp(which: 'examenes' | 'pacientes') { + this.helpWhich = which; this.showHelp(); } showHelp() { - this.helpOpen = true; if (this.metadata || this.helpAsked) return; this.helpAsked = true; this.metadataRequested.emit(); } - hideHelp() { if (!this.helpPinned) this.helpOpen = false; } - onHelpFocusOut(event: FocusEvent) { + hideHelp(which: 'examenes' | 'pacientes') { + if (this.helpPinned === which) return; + if (this.helpWhich === which) this.helpWhich = null; + } + onHelpFocusOut(which: 'examenes' | 'pacientes', event: FocusEvent) { const next = event.relatedTarget; if (next instanceof Node && (event.currentTarget as Node).contains(next)) return; - this.helpPinned = false; - this.helpOpen = false; + if (this.helpPinned === which) this.helpPinned = null; + if (this.helpWhich === which) this.helpWhich = null; } ngOnChanges(changes: SimpleChanges) { diff --git a/src/app/features/indicadores/indicadores-conteos-pareados.spec.ts b/src/app/features/indicadores/indicadores-conteos-pareados.spec.ts index 977ed15..279ca02 100644 --- a/src/app/features/indicadores/indicadores-conteos-pareados.spec.ts +++ b/src/app/features/indicadores/indicadores-conteos-pareados.spec.ts @@ -220,7 +220,7 @@ describe('Tarjeta pareada de CaMa en la página', () => { expect(filas).toEqual([['BI-RADS 4', '13', '15'], ['BI-RADS 5', '18', '18'], ['BI-RADS 6', '0', '0']]); expect(root().querySelector('.published-values caption')?.textContent).toContain('su categoría más alta'); expect(texto('app-indicador-conteos-pareados')).not.toContain('no se calcula la razón de mastografías por paciente'); - expect(root().querySelector('.help-icon')?.getAttribute('aria-label')).toBe('Cómo leer'); + expect([...root().querySelectorAll('.help-icon')].map(b => b.getAttribute('aria-label'))).toEqual(['Cómo leer, mastografías por categoría', 'Cómo leer, pacientes por categoría']); expect(texto('app-indicador-conteos-pareados')).not.toContain('Sin dato'); }); it('sin pacientes verificados dibuja la estructura y deja pendiente solo la cifra de pacientes', () => { @@ -284,7 +284,10 @@ describe('Cómo leer de conteos pareados: reintento tras un fallo', () => { fixture.detectChanges(); const segundo = meta(); expect(segundo).toHaveLength(1); - segundo[0].flush({ descripcion: 'Lectura de la dona' }); + segundo[0].flush({ descripcion: 'Lectura de la dona', figuras_detalle: [{ figura: 'fig_c2_donas', descripcion: 'Lectura de la dona', como_leer: [] }] }); + for (const q of http.match(r => r.url.endsWith('/datos'))) q.flush(q.request.url.includes('paciente') ? pacientes(LAB_P) : examenes(LAB_E)); + fixture.detectChanges(); + (fixture.nativeElement.querySelectorAll('.help-icon')[1] as HTMLButtonElement).dispatchEvent(new MouseEvent('mouseenter', { bubbles: true })); fixture.detectChanges(); expect(fixture.nativeElement.textContent).toContain('en la categoría más alta de sus mastografías'); expect(fixture.nativeElement.textContent).toContain('Cada dona muestra uno de esos conteos');