diff --git a/public/favicon.ico b/public/favicon.ico index 57614f9..eeff64e 100644 Binary files a/public/favicon.ico and b/public/favicon.ico differ diff --git a/src/app/features/indicadores/indicador-confirmacion-citologia.scss b/src/app/features/indicadores/indicador-confirmacion-citologia.scss index 00d0c7a..8eb2d3b 100644 --- a/src/app/features/indicadores/indicador-confirmacion-citologia.scss +++ b/src/app/features/indicadores/indicador-confirmacion-citologia.scss @@ -35,6 +35,22 @@ summary { cursor: pointer; padding-block: .75rem; } table { border-collapse: collapse; width: 100%; margin-block: 1rem; } th, td { padding: .5rem; text-align: start; border-bottom: 1px solid var(--issste-border); } caption { text-align: start; font-weight: 600; } +.histo-meta { display: flex; justify-content: flex-end; align-items: flex-start; gap: .75rem; } +.view-context { display: flex; flex-direction: column; align-items: flex-end; gap: .1rem; margin: .15rem 0 0; color: var(--issste-text-secondary); font-size: .75rem; line-height: 1.35; } +.histo .figure { border-top: 0; } +.histo .figure + .figure { border-top: 1px solid var(--issste-border); padding-top: .25rem; } +.histo .help { position: relative; display: flex; justify-content: flex-end; padding-bottom: .35rem; } +.histo .help .methodology-toggle { 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-radius: 50%; font-weight: 800; font-size: 1rem; line-height: 1; background: color-mix(in srgb, var(--issste-accent) 14%, var(--issste-surface)); } +.histo .help .methodology { position: absolute; z-index: 8; top: 100%; 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); } +.histo .legend { display: flex; flex-direction: column; gap: 0; margin-block: .15rem 1rem; } +.histo .tab-bar { display: flex; align-items: flex-end; gap: .5rem; border-bottom: 1px solid var(--issste-border); } +.histo .tabs { display: flex; flex-wrap: wrap; gap: .2rem; min-width: 0; } +.histo .tabs .tab { border: 1px solid transparent; border-bottom: 0; border-radius: .75rem .75rem 0 0; background: transparent; box-shadow: none; } +.histo .tabs .tab[aria-selected=true] { background: color-mix(in srgb, var(--swatch) 18%, var(--issste-surface)); border-color: var(--issste-border); box-shadow: inset 0 -3px 0 var(--swatch); font-weight: 700; } +.histo .tab-panel { display: flex; flex-wrap: wrap; gap: .45rem; padding: .65rem .1rem .1rem; } +.histo .tab-panel .child { border-radius: .75rem; border-color: color-mix(in srgb, var(--swatch) 55%, var(--issste-border)); background: var(--issste-surface); } +.histo .tab-panel .child[aria-pressed=true] { background: color-mix(in srgb, var(--swatch) 16%, var(--issste-surface)); border-color: var(--swatch); } +.histo .tab .swatch, .histo .tab-panel .swatch { width: .35rem; height: 1.15rem; border: 0; border-radius: .2rem; background: var(--swatch); } .reading-guide h3 { margin: 0 0 .25rem; } .reading-guide + .reading-guide { margin-top: 1rem; } .reading-guide ul { margin: .5rem 0 0; padding-inline-start: 1.25rem; } @@ -43,4 +59,7 @@ app-plotly-chart { --plot-height: 360px; } .rate-states { margin: 0; padding-inline-start: 1.25rem; color: var(--issste-text-secondary); } .rate-states:empty { display: none; } /* Rates on the left, donut on the right (the reverse of EU7). */ -@media (min-width: 1100px) { .figures { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } } +@media (min-width: 1100px) { + .figures { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } + .histo .figure + .figure { border-top: 0; border-inline-start: 1px solid var(--issste-border); padding-top: 0; padding-inline-start: 1rem; } +} diff --git a/src/app/features/indicadores/indicador-conteos-pareados.html b/src/app/features/indicadores/indicador-conteos-pareados.html index d4d0fcd..8b6333a 100644 --- a/src/app/features/indicadores/indicador-conteos-pareados.html +++ b/src/app/features/indicadores/indicador-conteos-pareados.html @@ -1,21 +1,7 @@
- - @if (helpOpen) { -
-
-

Dona por categoría

- @if (donutGuide; as guide) { - @if (guide.descripcion) {

{{ guide.descripcion }}

} - @if (guide.como_leer.length) {
    @for (line of guide.como_leer; track $index) {
  • {{ line }}
  • }
} - } @else if (!metadata) {

Metadatos publicados pendientes. Vuelve a abrir «Cómo leer» para reintentar su consulta.

} - @else {

El servicio no publica instrucciones de lectura para esta figura.

} -
-
-

{{ par.unidades.pacientes | titlecase }} y {{ par.unidades.examenes }}

-

Cada paciente cuenta una vez en el periodo, en la categoría más grave de sus mastografías. Cada mastografía cuenta en su propia categoría. Las barras comparan ambos conteos por familia de BI-RADS; no se calcula cuántas mastografías tiene cada paciente, porque no son las mismas poblaciones.

-
-
- } +
+ +
@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…

} @@ -43,7 +29,6 @@ @if (!m.pacientesVerificados) {

Pacientes pendientes: la versión publicada del indicador de pacientes no es una cuya definición se haya verificado para sumar sus categorías.

}
-

Cada paciente cuenta una vez, en la categoría más grave de sus mastografías del periodo; cada mastografía cuenta en su categoría. Por eso no se calcula la razón de mastografías por paciente.

@for (note of m.notas; track $index) {

{{ note }}

}
Valores publicados
diff --git a/src/app/features/indicadores/indicador-conteos-pareados.scss b/src/app/features/indicadores/indicador-conteos-pareados.scss index 2707cca..8a8cf86 100644 --- a/src/app/features/indicadores/indicador-conteos-pareados.scss +++ b/src/app/features/indicadores/indicador-conteos-pareados.scss @@ -11,8 +11,15 @@ 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. -.figures { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--issste-space-6); } -@media (min-width: 1100px) { .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); } } +.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; } +.figure + .figure { border-top: 1px solid var(--issste-border); margin-top: var(--issste-space-4); padding-top: var(--issste-space-4); } +@media (min-width: 1100px) { + .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); } + .figure + .figure { border-top: 0; margin-top: 0; padding-top: 0; border-inline-start: 1px solid var(--issste-border); padding-inline-start: var(--issste-space-6); } +} app-plotly-chart { --plot-height: 400px; } // Keep space for the outside labels and let the existing plot viewport scroll on very narrow cards. .donut-chart { --plot-min-width: 230px; } diff --git a/src/app/features/indicadores/indicador-conteos-pareados.ts b/src/app/features/indicadores/indicador-conteos-pareados.ts index d08333e..5c9bc15 100644 --- a/src/app/features/indicadores/indicador-conteos-pareados.ts +++ b/src/app/features/indicadores/indicador-conteos-pareados.ts @@ -4,6 +4,7 @@ import { TitleCasePipe } from '@angular/common'; import { combineLatest, Subscription, timeout, TimeoutError } from 'rxjs'; import { MatButtonModule } from '@angular/material/button'; import { MatProgressBarModule } from '@angular/material/progress-bar'; +import { MatTooltipModule } from '@angular/material/tooltip'; import { PlotlyChart } from '../../shared/plotly/plotly-chart'; import { Dominio, Indicador, IndicadorMetadatos, PlotlyFigure, Tema } from './indicadores.models'; import { filterCompatibility, GlobalApplied } from './indicadores-memory'; @@ -13,7 +14,7 @@ import { barrasConteos, ConteosIncompatibles, donaConteos, ModeloConteos, modelo @Component({ selector: 'app-indicador-conteos-pareados', - imports: [MatButtonModule, MatProgressBarModule, PlotlyChart, TitleCasePipe], + imports: [MatButtonModule, MatProgressBarModule, MatTooltipModule, PlotlyChart, TitleCasePipe], templateUrl: './indicador-conteos-pareados.html', styleUrl: './indicador-conteos-pareados.scss', }) @@ -44,7 +45,7 @@ export class IndicadorConteosPareados implements OnChanges, OnDestroy { get total() { return this.model ? totalExamenes(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 helpAsked = false; // "Cómo leer": what the kit publishes for the exams' donut. The bars combine two indicators, so the kit's // description of its own bars does not apply to them and is not used. get donutGuide() { @@ -53,7 +54,18 @@ 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() { this.helpOpen = !this.helpOpen; if (this.helpOpen) this.metadataRequested.emit(); } + get helpText() { + const guide = this.donutGuide; + const dona = guide + ? ['Dona por categoría', guide.descripcion, ...guide.como_leer].filter(line => line.length) + : [this.metadata ? 'El servicio no publica instrucciones de lectura para esta figura.' : 'Metadatos publicados pendientes.']; + const pacientes = this.par.unidades.pacientes; + const examenes = this.par.unidades.examenes; + return [...dona, `${pacientes[0].toUpperCase()}${pacientes.slice(1)} y ${examenes}`, + `Cada ${pacientes.slice(0, -1)} cuenta una vez en el periodo, en la categoría más grave de sus ${examenes}. Cada ${examenes.slice(0, -1)} cuenta en su propia categoría. Las barras comparan ambos conteos por familia de BI-RADS; no se calcula cuántas ${examenes} tiene cada ${pacientes.slice(0, -1)}, porque no son las mismas poblaciones.`, + ].join('\n'); + } + showHelp() { if (!this.helpAsked) { this.helpAsked = true; this.metadataRequested.emit(); } } ngOnChanges(changes: SimpleChanges) { const key = snapshotKey(this.dominio, this.indicador, this.applied) + JSON.stringify([this.par.examenes, this.par.pacientes, this.indicador.tipos_periodo]); diff --git a/src/app/features/indicadores/indicador-histopatologia-cama.html b/src/app/features/indicadores/indicador-histopatologia-cama.html index 93cf34f..9eda07a 100644 --- a/src/app/features/indicadores/indicador-histopatologia-cama.html +++ b/src/app/features/indicadores/indicador-histopatologia-cama.html @@ -1,20 +1,27 @@ -
-

Filtro general aplicado: {{ appliedSummary }}

- - @if (helpOpen) { -
-

Cada punto es el porcentaje de pacientes de esa categoría BI-RADS cuyo resultado de biopsia pertenece a la selección, entre las que tienen resultado; la línea es su intervalo de confianza de 95 %. «Sin biopsia reportada» y «Sin dato» no entran en el denominador y se muestran aparte, en la tabla de valores publicados.

- @if (metadata) { - @for (guide of readingGuide; track guide.figura) { -
-

{{ guide.nombre }}

- @if (guide.descripcion) {

{{ guide.descripcion }}

} - @if (guide.como_leer.length) {
    @for (line of guide.como_leer; track $index) {
  • {{ line }}
  • }
} -
+
+
+
+ + @if (helpOpen) { + - } +
+ } +
+

+ {{ intervalLabel }} + @if (contextPeriod) { Periodo {{ contextPeriod }} } +

+
@switch (status()) { @case ('deferred') {

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

} @case ('loading') {

Cargando el mismo periodo para tasas y dona…

} @@ -32,14 +39,31 @@ @if (model; as m) { @if (status() === 'empty') {

No hay pacientes con resultado de mastografía BI-RADS 4, 5 o 6 publicadas para este periodo.

} @else { +
+
+
+ @for (g of m.grupos; track g.id; let gi = $index) { + + } +
+
+ @for (g of m.grupos; track g.id) { + @if (selection?.grupo === g.id) { +
+ @for (c of m.categorias; track c.id; let ci = $index) { + @if (c.grupo === g.id) { + + } + } +
+ } + } +

Por categoría BI-RADS, {{ m.periodo }}

@if (ratesFigure) { } -
    - @for (t of rates; track t.fila.id) { @if (t.k === null) {
  • {{ t.fila.etiqueta }}: {{ estadoTasa(t) }}
  • } } -

Resultado de la biopsia, {{ m.periodo }}

@if (m.conResultado !== null && m.conResultado > 0 && donutFigure) { @@ -47,25 +71,7 @@ } @else {

{{ m.conResultado === null ? 'Dona no disponible: hay celdas suprimidas o datos incompletos. No se calcula un total parcial.' : 'Sin pacientes con resultado de biopsia en el periodo.' }}

}
-
- -
- @for (g of m.grupos; track g.id; let gi = $index) { -
- -
- @for (c of m.categorias; track c.id; let ci = $index) { - @if (c.grupo === g.id) { - - } - } -
-
- } -
-
} -

{{ m.periodo }}, selección: {{ selectionLabel }}. {{ reading }}

@for (note of m.notas; track $index) {

{{ note }}

}
Valores publicados
diff --git a/src/app/features/indicadores/indicador-histopatologia-cama.ts b/src/app/features/indicadores/indicador-histopatologia-cama.ts index a2b3760..d6cd68c 100644 --- a/src/app/features/indicadores/indicador-histopatologia-cama.ts +++ b/src/app/features/indicadores/indicador-histopatologia-cama.ts @@ -5,7 +5,7 @@ import { MatButtonModule } from '@angular/material/button'; import { MatProgressBarModule } from '@angular/material/progress-bar'; import { PlotlyChart } from '../../shared/plotly/plotly-chart'; import { Dominio, Indicador, IndicadorMetadatos, PlotlyFigure, Tema } from './indicadores.models'; -import { describePeriods, filterCompatibility, GlobalApplied } from './indicadores-memory'; +import { filterCompatibility, GlobalApplied } from './indicadores-memory'; import { IndicadoresSnapshots, snapshotKey } from './indicadores-snapshots'; import { httpMessage } from './indicadores-http'; import { Celda } from './indicadores-confirmacion-citologia'; @@ -43,6 +43,7 @@ export class IndicadorHistopatologiaCama implements OnChanges, OnDestroy { donutFigure?: PlotlyFigure; ratesFigure?: PlotlyFigure; helpOpen = false; + private helpPinned = false; private readonly snapshots = inject(IndicadoresSnapshots); private readonly changeDetector = inject(ChangeDetectorRef); private subscription?: Subscription; @@ -54,7 +55,11 @@ export class IndicadorHistopatologiaCama implements OnChanges, OnDestroy { private readonly alCambiarAncho = () => this.draw(); constructor() { this.estrecho?.addEventListener('change', this.alCambiarAncho); } - get appliedSummary() { return describePeriods(this.applied.tipo, this.applied.selection); } + get intervalLabel() { return this.applied?.tipo === 'mes' ? 'Intervalo mensual' : 'Intervalo semestral'; } + get contextPeriod() { + return this.model?.periodo ?? this.periods[this.periodIndex] + ?? (this.applied?.selection.mode === 'explicit' && this.applied.selection.periodos.length === 1 ? this.applied.selection.periodos[0] : ''); + } get selectionLabel() { return this.model && this.selection ? seleccionEtiqueta(this.model, this.selection) : ''; } get reading() { return this.model && this.selection ? lectura(this.model, this.selection) : ''; } get isBase() { return !!this.model && !!this.selection && !this.selection.categoria && this.selection.grupo === this.model.base; } @@ -71,7 +76,23 @@ export class IndicadorHistopatologiaCama implements OnChanges, OnDestroy { return descripcion || como_leer.length ? [{ figura, nombre, descripcion, como_leer }] : []; }); } - toggleHelp() { this.helpOpen = !this.helpOpen; if (this.helpOpen) this.metadataRequested.emit(); } + toggleHelp() { + if (this.helpPinned) { this.helpPinned = false; this.helpOpen = false; return; } + this.helpPinned = true; + this.showHelp(); + } + showHelp() { + if (this.helpOpen) return; + this.helpOpen = true; + this.metadataRequested.emit(); + } + hideHelp() { if (!this.helpPinned) this.helpOpen = false; } + onHelpFocusOut(event: FocusEvent) { + const next = event.relatedTarget; + if (next instanceof Node && (event.currentTarget as Node).contains(next)) return; + this.helpPinned = false; + this.helpOpen = false; + } ngOnChanges(changes: SimpleChanges) { const key = snapshotKey(this.dominio, this.indicador, this.applied, { estrato: ESTRATO_BIRADS }) diff --git a/src/app/features/indicadores/indicador-kpi-card.spec.ts b/src/app/features/indicadores/indicador-kpi-card.spec.ts index ae3a5a1..c2d776a 100644 --- a/src/app/features/indicadores/indicador-kpi-card.spec.ts +++ b/src/app/features/indicadores/indicador-kpi-card.spec.ts @@ -27,6 +27,10 @@ import { IndicadorKpiCard } from './indicador-kpi-card'; expect(fixture.nativeElement.querySelector('.value').textContent).toContain('Valor de prueba'); expect(fixture.nativeElement.querySelector('.value span').textContent).toBe('Unidad de prueba'); expect(fixture.nativeElement.textContent).toContain('Referencia de prueba'); + expect(fixture.nativeElement.querySelector('.period-label')).toBeNull(); + fixture.componentRef.setInput('temporalReference', '2025-S2'); fixture.detectChanges(); + expect(fixture.nativeElement.querySelector('.period-label').textContent).toBe('Periodo:'); + expect(fixture.nativeElement.querySelector('.kpi-foot').textContent).toContain('2025-S2'); expect(fixture.nativeElement.querySelector('.kpi-state').textContent).toBe('Estado de prueba'); expect(fixture.nativeElement.querySelector('.additional-info').textContent).toBe('Información de prueba'); expect(fixture.nativeElement.textContent).not.toContain('Definición provisional'); diff --git a/src/app/features/indicadores/indicador-kpi-card.ts b/src/app/features/indicadores/indicador-kpi-card.ts index 0439d91..7a8699d 100644 --- a/src/app/features/indicadores/indicador-kpi-card.ts +++ b/src/app/features/indicadores/indicador-kpi-card.ts @@ -12,16 +12,23 @@ import { MatCardModule } from '@angular/material/card'; @if (value !== null && value !== undefined) {

{{ value }}@if (unit) { {{ unit }} }

} - @if (temporalReference) {

{{ temporalReference }}

} -

{{ state }}

- @if (informationLine) {

{{ informationLine }}

} +
+ @if (temporalReference) { +

@if (labeledPeriod) { Periodo: }{{ temporalReference }}

+ } +

{{ state }}

+ @if (informationLine) {

{{ informationLine }}

} +
`, styles: ` - :host { display: block; min-width: 0; } - mat-card { box-sizing: border-box; height: 100%; padding: var(--issste-space-6); + :host { display: flex; flex-direction: column; height: 100%; min-width: 0; } + mat-card { box-sizing: border-box; display: flex; flex-direction: column; flex: 1 1 auto; height: auto; min-height: 100%; padding: var(--issste-space-6); background: var(--issste-surface); color: var(--issste-text); border: 1px solid var(--issste-border); border-radius: var(--issste-radius); box-shadow: none; } + .kpi-foot { margin-top: auto; } + .period { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem; } + .period-label { font-weight: 600; } h3 { margin: 0; font-family: var(--issste-font-heading); font-size: 1rem; font-weight: 500; line-height: 1.3; } h3, p { overflow-wrap: anywhere; } p { margin: var(--issste-space-3) 0 0; } @@ -46,6 +53,10 @@ export class IndicadorKpiCard { // A card that shows its value needs no "Disponible" line. @Input() quietWhenAvailable = false; @Input() additionalInfo?: string; + get labeledPeriod(): boolean { + const text = this.temporalReference?.trim(); + return !!text && text.split(',').every(part => /^\d{4}-(?:S[12]|0[1-9]|1[0-2])$/.test(part.trim())); + } get informationLine(): string | undefined { const lines = [this.additionalInfo, ...this.notes].map(value => value?.trim()).filter((value): value is string => !!value); return [...new Set(lines)].join(' '); diff --git a/src/app/features/indicadores/indicador-period-filters.html b/src/app/features/indicadores/indicador-period-filters.html index 6bbc0e6..168a5fa 100644 --- a/src/app/features/indicadores/indicador-period-filters.html +++ b/src/app/features/indicadores/indicador-period-filters.html @@ -2,11 +2,13 @@
@if (!types.includes(state.tipo)) {

El intervalo de análisis del borrador ya no está publicado para este proyecto. Elige un intervalo de análisis disponible.

}
- Intervalo de análisis - - @for (tipo of types; track tipo) { {{ tipo === 'mes' ? 'Mensual' : 'Semestral' }} } - - +
+ Intervalo de análisis + + @if (types.includes('mes')) { Mensual } + @if (types.includes('semestre')) { Semestral } + +
Periodo seleccionado {{ selectedPeriods[0] }} @@ -51,11 +53,13 @@
@if (!types.includes(state.tipo)) {

El intervalo de análisis del borrador ya no está publicado para este proyecto. Elige un intervalo de análisis disponible.

}
- Intervalo de análisis - - @for (tipo of types; track tipo) { {{ tipo === 'mes' ? 'Mensual' : 'Semestral' }} } - - +
+ Intervalo de análisis + + @if (types.includes('mes')) { Mensual } + @if (types.includes('semestre')) { Semestral } + +
Periodo seleccionado {{ selectedPeriods[0] }} diff --git a/src/app/features/indicadores/indicador-period-filters.scss b/src/app/features/indicadores/indicador-period-filters.scss index c193d38..47e6a0f 100644 --- a/src/app/features/indicadores/indicador-period-filters.scss +++ b/src/app/features/indicadores/indicador-period-filters.scss @@ -8,7 +8,9 @@ :host(.compacto) .apply-button { min-height: 40px; } :host(.compacto) .period-builder button { min-height: 40px; } section { min-width: 0; } -.fields { display: flex; flex-wrap: wrap; align-items: start; gap: var(--issste-space-3); } +.fields { display: flex; flex-wrap: wrap; align-items: end; gap: var(--issste-space-3); } +.interval { display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; } +.field-label { color: var(--issste-text-secondary); font-size: .75rem; line-height: 1.2; } mat-form-field { flex: 1 1 14rem; min-width: 0; max-width: 24rem; } .period-builder mat-form-field { flex: 0 1 10rem; } .period-builder button { margin-top: var(--issste-space-2); min-height: 44px; } diff --git a/src/app/features/indicadores/indicador-period-filters.spec.ts b/src/app/features/indicadores/indicador-period-filters.spec.ts index 09abd82..4af86ed 100644 --- a/src/app/features/indicadores/indicador-period-filters.spec.ts +++ b/src/app/features/indicadores/indicador-period-filters.spec.ts @@ -138,16 +138,11 @@ describe('UX-04 control asistido', () => { fixture.nativeElement.querySelector('button[mat-flat-button]').click(); expect(apply).toHaveBeenCalledTimes(1); }); - it('ofrece el intervalo de análisis mensual o semestral, sin Modalidad', async () => { + it('ofrece el intervalo de análisis mensual o semestral, sin Modalidad', () => { const labels = Array.from(fixture.nativeElement.querySelectorAll('mat-label') as NodeListOf).map(l => l.textContent); - expect(labels).toContain('Intervalo de análisis'); + expect(fixture.nativeElement.querySelector('.field-label').textContent).toBe('Intervalo de análisis'); expect(labels).not.toContain('Modalidad'); - const select = fixture.debugElement.queryAll(By.css('mat-form-field')) - .find(f => f.nativeElement.textContent.includes('Intervalo de análisis'))!.query(By.directive(MatSelect)); - select.componentInstance.open(); fixture.detectChanges(); await fixture.whenStable(); - const options = Array.from(document.querySelectorAll('mat-option')).map(o => o.textContent?.trim()); - expect(options).toEqual(['Semestral', 'Mensual']); - select.componentInstance.close(); + expect([...fixture.nativeElement.querySelectorAll('mat-button-toggle')].map((b: HTMLElement) => b.textContent!.trim())).toEqual(['Mensual', 'Semestral']); }); it('al cambiar de intervalo elige el periodo más reciente con reporte', () => { fixture.componentRef.setInput('availability', { status: 'ready', byIndicator: {}, errors: {}, diff --git a/src/app/features/indicadores/indicador-period-filters.ts b/src/app/features/indicadores/indicador-period-filters.ts index 2361da5..a3291f1 100644 --- a/src/app/features/indicadores/indicador-period-filters.ts +++ b/src/app/features/indicadores/indicador-period-filters.ts @@ -1,6 +1,7 @@ import { Component, EventEmitter, Input, Output, OnChanges } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; +import { MatButtonToggleModule } from '@angular/material/button-toggle'; import { MatFormFieldModule } from '@angular/material/form-field'; import { MatInputModule } from '@angular/material/input'; import { MatSelectModule } from '@angular/material/select'; @@ -10,7 +11,7 @@ import { describePeriods, newEditor, FilterState, pending, validDraft } from './ @Component({ selector: 'app-indicador-period-filters', - imports: [FormsModule, MatButtonModule, MatFormFieldModule, MatInputModule, MatSelectModule], + imports: [FormsModule, MatButtonModule, MatButtonToggleModule, MatFormFieldModule, MatInputModule, MatSelectModule], host: { '[class.compacto]': 'compact' }, templateUrl: './indicador-period-filters.html', styleUrl: './indicador-period-filters.scss', diff --git a/src/app/features/indicadores/indicadores-cama-oportunidad.spec.ts b/src/app/features/indicadores/indicadores-cama-oportunidad.spec.ts index 28947ea..bfd1c1e 100644 --- a/src/app/features/indicadores/indicadores-cama-oportunidad.spec.ts +++ b/src/app/features/indicadores/indicadores-cama-oportunidad.spec.ts @@ -266,7 +266,7 @@ describe('Tarjetas de oportunidad de CaMa en la página', () => { expect(fixture.nativeElement.querySelector('header .domain')).toBeNull(); expect(text).not.toContain('Cáncer de mama, investigación'); expect(text).toContain('Explora los indicadores de cáncer de mama.'); - expect(fixture.nativeElement.querySelector('#global-filters-title').textContent.trim()).toBe('Filtros generales'); + expect(fixture.nativeElement.querySelector('#global-filters-title').textContent.trim()).toBe('Filtros'); expect(fixture.nativeElement.querySelector('.global-filters .section-description')).toBeNull(); expect(text).not.toContain('Se aplica a los indicadores de oportunidad y las gráficas, salvo las de selección independiente.'); expect(text).not.toContain('Filtro general aplicado'); @@ -312,7 +312,8 @@ describe('Filtros generales de CaMa: periodo único', () => { it('muestra Intervalo de análisis, Periodo seleccionado y Aplicar en una fila, sin modalidad ni resúmenes de edición', () => { // Fails if the multi-period controls or the editing summaries come back to CaMa. mount(true); - expect(labels()).toEqual(['Intervalo de análisis', 'Periodo seleccionado']); + expect(fixture.nativeElement.querySelector('.field-label').textContent!.trim()).toBe('Intervalo de análisis'); + expect(labels()).toEqual(['Periodo seleccionado']); expect(fixture.nativeElement.querySelector('.fields.compact .apply-button')).not.toBeNull(); const text = fixture.nativeElement.textContent as string; expect(text).not.toContain('Modalidad'); diff --git a/src/app/features/indicadores/indicadores-cama-resumen-clinico.spec.ts b/src/app/features/indicadores/indicadores-cama-resumen-clinico.spec.ts index 7bd34e4..ce769ff 100644 --- a/src/app/features/indicadores/indicadores-cama-resumen-clinico.spec.ts +++ b/src/app/features/indicadores/indicadores-cama-resumen-clinico.spec.ts @@ -46,8 +46,8 @@ describe('Resumen clínico de CaMa y los demás dominios', () => { const section = () => root().querySelector('.graphic-section') as HTMLElement; const titles = () => [...root().querySelectorAll('.catalog-grid app-indicador-catalog-card h2')].map(e => e.textContent?.trim()); - it('CaMa: «Indicadores clínicos» y un contador que cuenta lo que la sección muestra', () => { - // Fails if the heading or the counter go back to the whole catalog (6) while a card is not drawn. + it('CaMa: «Indicadores clínicos» muestra las tarjetas de la sección, sin el conteo de publicados', () => { + // Fails if the heading goes back to the whole catalog while a card is not drawn. open('cama', CAMA); expect(root().querySelector('#graphic-section-title')?.textContent).toBe('Indicadores clínicos'); expect(titles()).not.toContain('Distribución de resultados de biopsia'); @@ -55,7 +55,7 @@ describe('Resumen clínico de CaMa y los demás dominios', () => { expect(titles()).not.toContain('Porcentaje de pacientes con resultados de BI-RADS 4, 5 y 6'); // Only the paired card is a published indicator the summary draws; the other three are in Histórico. expect(titles()).toEqual(['Porcentaje individual de mastografías']); - expect(root().querySelector('.catalog-count')?.textContent?.trim()).toBe('1 indicador publicado'); + expect(root().textContent).not.toContain('indicador publicado'); }); it('CaMa: las tarjetas que el mockup no tiene en el Resumen se retiran sin quitarlas del catálogo', () => { // Fails if confirmation, screening-to-diagnosis or exam-to-result come back to the summary, or leave Datos y definiciones. @@ -111,7 +111,7 @@ describe('Resumen clínico de CaMa y los demás dominios', () => { expect(root().querySelector('.catalog-search')).not.toBeNull(); expect(root().querySelectorAll('.pin-toggle').length).toBe(6); expect(section().textContent).toContain('2 figuras publicadas'); - expect(root().querySelector('.catalog-count')?.textContent?.trim()).toBe('6 indicadores publicados'); + expect(root().textContent).not.toContain('indicadores publicados'); }); it('CaCu conserva su encabezado «Indicadores clínicos» y TEA «Indicadores gráficos»', () => { open('cacu', OTRO('cacu')); diff --git a/src/app/features/indicadores/indicadores-conteos-pareados.spec.ts b/src/app/features/indicadores/indicadores-conteos-pareados.spec.ts index 2e09190..d1ac2a2 100644 --- a/src/app/features/indicadores/indicadores-conteos-pareados.spec.ts +++ b/src/app/features/indicadores/indicadores-conteos-pareados.spec.ts @@ -193,7 +193,7 @@ describe('Tarjeta pareada de CaMa en la página', () => { const titulos = [...root().querySelectorAll('.catalog-grid app-indicador-catalog-card h2')].map(e => e.textContent?.trim()); // Confirmation is in Histórico and in Datos y definiciones, not in CaMa's summary. expect(titulos).toEqual(['Porcentaje individual de mastografías']); - expect(root().querySelector('.catalog-count')?.textContent?.trim()).toBe('1 indicador publicado'); + expect(root().textContent).not.toContain('indicador publicado'); }); it('al hacerse visible pide los dos conteos del mismo periodo y dibuja dona, barras y tabla con sus valores', () => { abrir(); @@ -205,7 +205,8 @@ describe('Tarjeta pareada de CaMa en la página', () => { expect(graficas.map(g => g.figure!.data.length)).toEqual([1, 2]); const filas = [...root().querySelectorAll('.published-values tbody tr')].map(tr => [...tr.children].map(c => c.textContent?.trim())); expect(filas).toEqual([['BI-RADS 4', '13', '15'], ['BI-RADS 5', '18', '18'], ['BI-RADS 6', '0', '0']]); - expect(texto('app-indicador-conteos-pareados')).toContain('no se calcula la razón de mastografías por paciente'); + 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(texto('app-indicador-conteos-pareados')).not.toContain('Sin dato'); }); it('sin pacientes verificados dibuja la estructura y deja pendiente solo la cifra de pacientes', () => { diff --git a/src/app/features/indicadores/indicadores-global-filters.spec.ts b/src/app/features/indicadores/indicadores-global-filters.spec.ts index afb2de6..55accac 100644 --- a/src/app/features/indicadores/indicadores-global-filters.spec.ts +++ b/src/app/features/indicadores/indicadores-global-filters.spec.ts @@ -58,8 +58,7 @@ describe('D.2 integración de autoridad global y consumidores', () => { load(undefined, domain); expect(fixture.debugElement.queryAll(By.directive(IndicadorPeriodFilters))).toHaveLength(1); const sections = fixture.nativeElement.querySelectorAll('#panel-resumen > section') as NodeListOf; - expect(sections[0].textContent).toContain(domain === 'cama' ? 'Filtros generales' : 'Filtros generales de ' + page.domainLabels[domain]); - if (domain === 'cama') expect(sections[0].textContent).not.toContain('Filtros generales de '); + expect(sections[0].querySelector('#global-filters-title')!.textContent!.trim()).toBe('Filtros'); expect(fixture.nativeElement.querySelectorAll('.kpi-section app-indicador-kpi-card')).toHaveLength(0); expect(sections[1].getAttribute('aria-labelledby')).toBe('graphic-section-title'); expect(page.filters!.applied.selection.mode).toBe('todos'); diff --git a/src/app/features/indicadores/indicadores-histopatologia-cama.spec.ts b/src/app/features/indicadores/indicadores-histopatologia-cama.spec.ts index 3d5bc3b..b8b461d 100644 --- a/src/app/features/indicadores/indicadores-histopatologia-cama.spec.ts +++ b/src/app/features/indicadores/indicadores-histopatologia-cama.spec.ts @@ -241,7 +241,7 @@ describe('Histopatología por BI-RADS: componente', () => { expect(r.request.params.get('estrato')).toBe('birads'); expect(r.request.params.get('periodos')).toBe(PERIODO); r.flush(body as Record); f.detectChanges(); } - const boton = (texto: string) => [...f.nativeElement.querySelectorAll('.families button')].find((b: Element) => b.textContent!.trim() === texto) as HTMLButtonElement; + const boton = (texto: string) => [...f.nativeElement.querySelectorAll('.legend button')].find((b: Element) => b.textContent!.trim() === texto) as HTMLButtonElement; it('carga diferida, tasas a la izquierda y dona a la derecha, leyenda accesible y tabla de valores', () => { f.componentRef.setInput('visible', false); f.detectChanges(); @@ -250,16 +250,22 @@ describe('Histopatología por BI-RADS: componente', () => { flush(); expect(f.componentInstance.status()).toBe('ready'); const figures = [...f.nativeElement.querySelectorAll('.figures > .figure')] as HTMLElement[]; expect(figures.map(s => s.classList.contains('rates') ? 'tasas' : 'dona')).toEqual(['tasas', 'dona']); - expect([...f.nativeElement.querySelectorAll('.families button')].map((b: Element) => b.textContent!.trim())) - .toEqual(['No maligno', 'Benigno', 'Lesión de riesgo (B3)', 'Maligno', 'Carcinoma in situ', 'Carcinoma invasor']); - expect(f.nativeElement.querySelectorAll('.family')).toHaveLength(2); - expect([...f.nativeElement.querySelectorAll('.family')[1].querySelectorAll('button')].map((b: Element) => b.textContent!.trim())) - .toEqual(['Maligno', 'Carcinoma in situ', 'Carcinoma invasor']); + expect([...f.nativeElement.querySelectorAll('.tabs button')].map((b: Element) => b.textContent!.trim())) + .toEqual(['No maligno', 'Maligno']); + expect(f.nativeElement.querySelector('.tabs button[aria-selected=true]')!.textContent!.trim()).toBe('Maligno'); + expect([...f.nativeElement.querySelectorAll('.tab-panel button')].map((b: Element) => b.textContent!.trim())) + .toEqual(['Carcinoma in situ', 'Carcinoma invasor']); const grafica = f.nativeElement.querySelector('.figures') as HTMLElement; - const seleccion = f.nativeElement.querySelector('.selection-status') as HTMLElement; - expect(grafica.nextElementSibling?.classList.contains('legend')).toBe(true); - expect(grafica.nextElementSibling?.nextElementSibling).toBe(seleccion); - expect(seleccion.textContent).toContain('selección: Maligno'); + const leyenda = f.nativeElement.querySelector('.legend') as HTMLElement; + const contexto = f.nativeElement.querySelector('.view-context') as HTMLElement; + expect(leyenda.compareDocumentPosition(grafica) & Node.DOCUMENT_POSITION_FOLLOWING).toBe(Node.DOCUMENT_POSITION_FOLLOWING); + expect(f.nativeElement.textContent).not.toContain('Filtro general aplicado'); + expect(f.nativeElement.querySelector('.selection-status')).toBeNull(); + expect(f.nativeElement.querySelector('.rate-states')).toBeNull(); + expect(f.nativeElement.textContent).not.toContain('Sin pacientes con resultado de biopsia'); + expect(contexto.textContent).toContain('Intervalo semestral'); + expect(contexto.textContent).toContain('Periodo 2025-S1'); + expect(f.componentInstance.selectionLabel).toBe('Maligno'); const table = f.nativeElement.querySelector('table') as HTMLTableElement; expect([...table.querySelectorAll('thead th')].map(th => th.textContent)).toEqual( ['Categoría BI-RADS', 'Benigno', 'Lesión de riesgo (B3)', 'Carcinoma in situ', 'Carcinoma invasor', 'Con resultado', 'Sin biopsia reportada', 'Sin dato', 'Total de pacientes']); @@ -272,16 +278,17 @@ describe('Histopatología por BI-RADS: componente', () => { it('seleccionar una categoría, volver al grupo y volver al estado general; el centro de la dona también vuelve', () => { f.detectChanges(); flush(); const charts = f.debugElement.queryAll(By.directive(ChartStub)).map(c => c.componentInstance as ChartStub); - const volver = () => [...f.nativeElement.querySelectorAll('.legend > button')].find((b: Element) => b.textContent!.trim() === 'Volver') as HTMLButtonElement; - expect(volver().disabled).toBe(true); + expect(f.nativeElement.textContent).not.toContain('Volver'); + boton('No maligno').click(); f.detectChanges(); const b3 = boton('Lesión de riesgo (B3)'); b3.click(); f.detectChanges(); expect(f.componentInstance.selection).toEqual({ grupo: 'NO_MALIGNO', categoria: 'RIESGO_B3' }); - expect(b3.getAttribute('aria-pressed')).toBe('true'); expect(volver().disabled).toBe(false); - expect(f.nativeElement.querySelector('.selection-status').textContent).toContain('Proporción con resultado lesión de riesgo (B3)'); + expect(b3.getAttribute('aria-pressed')).toBe('true'); + expect(f.componentInstance.reading).toContain('Proporción con resultado lesión de riesgo (B3)'); b3.click(); f.detectChanges(); expect(f.componentInstance.selection).toEqual({ grupo: 'NO_MALIGNO' }); + boton('Maligno').click(); f.detectChanges(); boton('Carcinoma invasor').click(); f.detectChanges(); expect(f.componentInstance.selection).toEqual({ grupo: 'MALIGNO', categoria: 'INVASOR' }); - volver().click(); f.detectChanges(); expect(f.componentInstance.selection).toEqual({ grupo: 'MALIGNO' }); + boton('Maligno').click(); f.detectChanges(); expect(f.componentInstance.selection).toEqual({ grupo: 'MALIGNO' }); charts[1].plotClick.emit({ points: [{ data: { name: 'categorias' }, pointNumber: 1 }] }); f.detectChanges(); expect(f.componentInstance.selection).toEqual({ grupo: 'NO_MALIGNO', categoria: 'RIESGO_B3' }); charts[1].plotClick.emit({ points: [{ data: { name: 'centro' }, pointNumber: 0 }] }); f.detectChanges(); @@ -295,7 +302,7 @@ describe('Histopatología por BI-RADS: componente', () => { f.detectChanges(); flush(d); expect(f.componentInstance.status()).toBe('ready'); expect(f.nativeElement.querySelector('.donut').textContent).toContain('Dona no disponible: hay celdas suprimidas o datos incompletos'); - expect(f.nativeElement.querySelector('.rate-states').textContent).toContain('BI-RADS 4C: Suprimido'); + expect(f.nativeElement.querySelector('.rates').textContent).not.toContain('Suprimido'); const tabla = [...f.nativeElement.querySelectorAll('tbody tr')].map((tr: Element) => [...tr.children].map(td => td.textContent)); expect(tabla[3][1]).toBe('Suprimido'); expect(tabla[3][5]).toBe('Suprimido'); expect(tabla[0][5]).toBe('4'); }); @@ -305,7 +312,7 @@ describe('Histopatología por BI-RADS: componente', () => { f.detectChanges(); flush(d); const ultima = [...f.nativeElement.querySelectorAll('tbody tr')].pop() as HTMLElement; expect([...ultima.children].map(td => td.textContent)).toEqual(['BI-RADS 6', ...Array(8).fill('No disponible')]); - expect(f.nativeElement.querySelector('.rate-states').textContent).toContain('BI-RADS 6: No disponible'); + expect(f.nativeElement.querySelector('.rates').textContent).not.toContain('No disponible'); }); it('sin filas en el periodo lo dice y conserva la tabla vacía', () => { const d = estrato(); d.filas = []; d.totales_estrato = []; diff --git a/src/app/features/indicadores/indicadores-historico-figures.ts b/src/app/features/indicadores/indicadores-historico-figures.ts index 507e0ba..7eac85e 100644 --- a/src/app/features/indicadores/indicadores-historico-figures.ts +++ b/src/app/features/indicadores/indicadores-historico-figures.ts @@ -14,6 +14,12 @@ const record = (v: unknown): v is Record => !!v && typeof v === const escape = (v: string) => v.replace(/&/g, '&').replace(//g, '>'); // The EEG indicators avoid green; their colours are shared with their age groups' palette. const LINEAS: Readonly> = { M21_diagnosticados_con_eeg: C2_PALETTE.edades[0], M22_diagnosticados_sin_eeg: C2_PALETTE.edades[2] }; +// CaMa's day-count lines sit next to the histopathology bars, so they borrow that figure's blue, purple and rose. +const DIAS: Readonly> = { + cama_dias_toma_diagnostico: { claro: '#2F6DB3', oscuro: '#9DBFE3', relleno: '#9DBFE380' }, + cama_eu38a: { claro: '#9C42C2', oscuro: '#D2A4EA', relleno: '#9C42C240' }, + cama_dias_resultado_diagnostico: { claro: '#C24269', oscuro: '#E7A3B8', relleno: '#C2426940' }, +}; const numero = (v: unknown): v is number => typeof v === 'number' && Number.isFinite(v); // sortedPeriods lists the newest first, for selectors; time here runs left to right. export const cronologico = (periodos: readonly string[]) => sortedPeriods(periodos).reverse(); @@ -56,7 +62,7 @@ function ejes(data: IndicadorDatos, periodos: string[], suprimidos: string[], te }; } // One polygon per run of consecutive values: a band must not bridge a gap in the line. -function banda(periodos: string[], bajo: (number | null)[], alto: (number | null)[], name: string, color: string) { +function banda(periodos: string[], bajo: (number | null)[], alto: (number | null)[], name: string, color: string, fillcolor = color + '40') { const x: (string | null)[] = [], y: (number | null)[] = []; let run: number[] = []; const cerrar = () => { @@ -69,7 +75,7 @@ function banda(periodos: string[], bajo: (number | null)[], alto: (number | null }; periodos.forEach((_, i) => { if (bajo[i] !== null && alto[i] !== null) run.push(i); else cerrar(); }); cerrar(); - return { type: 'scatter', mode: 'lines', name, x, y, fill: 'toself', fillcolor: color + '40', line: { width: 0 }, hoverinfo: 'skip' }; + return { type: 'scatter', mode: 'lines', name, x, y, fill: 'toself', fillcolor, line: { width: 0 }, hoverinfo: 'skip' }; } // Separate rows from what is missing or suppressed; a period is judged by its only row. function serie(data: IndicadorDatos, periodos: string[], valor: (row: Record) => boolean) { @@ -107,10 +113,13 @@ function porcentaje(data: IndicadorDatos, tema: Tema): Trazo { function mediana(data: IndicadorDatos, tema: Tema, opciones: HistoricoOpciones): Trazo { const periodos = validar(data), unidad = unidadDe(data); const { validas, suprimidos, sinDato } = serie(data, periodos, row => numero(row['mediana']) && numero(row['n']) && row['n'] > 0); + const propio = DIAS[data.id]; + const linea = propio ? (tema === 'oscuro' ? propio.oscuro : propio.claro) : c2Theme(tema).line; + const relleno = propio && tema === 'claro' ? propio.relleno : linea + '40'; return { figure: { data: [ - banda(periodos.map(etiquetaPeriodo), campo(validas, 'q1'), campo(validas, 'q3'), 'Primer a tercer cuartil', c2Theme(tema).line), - { type: 'scatter', mode: 'lines+markers', name: 'Mediana', x: periodos.map(etiquetaPeriodo), y: campo(validas, 'mediana'), connectgaps: false, line: { color: c2Theme(tema).line, width: 2 }, + banda(periodos.map(etiquetaPeriodo), campo(validas, 'q1'), campo(validas, 'q3'), 'Primer a tercer cuartil', linea, relleno), + { type: 'scatter', mode: 'lines+markers', name: 'Mediana', x: periodos.map(etiquetaPeriodo), y: campo(validas, 'mediana'), connectgaps: false, line: { color: linea, width: 2 }, marker: { color: linea }, text: validas.map(row => row ? `Mediana: ${row['mediana']} días
Q1 a Q3: ${row['q1']} a ${row['q3']} días
${row['n']} ${unidad.plural}` : ''), hovertemplate: '%{x}
%{text}' }, ], layout: (() => { diff --git a/src/app/features/indicadores/indicadores-historico.spec.ts b/src/app/features/indicadores/indicadores-historico.spec.ts index ea6cd9f..afbcfef 100644 --- a/src/app/features/indicadores/indicadores-historico.spec.ts +++ b/src/app/features/indicadores/indicadores-historico.spec.ts @@ -63,6 +63,16 @@ describe('Figuras de histórico', () => { expect(traza(data, 0).y).toEqual([30, 10]); expect(sinDato).toEqual(['feb 2024']); expect(suprimidos).toEqual([]); }); + it('las líneas de días de CaMa usan el azul, el morado y el rosa de la histopatología', () => { + const color = (id: string, tema: 'claro' | 'oscuro') => { + const figure = historicoFigura({ ...base, id, contrato: 'C3r', filas: [{ periodo: '2024-01', suprimido: 0, n: 9, mediana: 20, q1: 10, q3: 30 }] }, tema).figure; + return { linea: (figure.data[1]['line'] as { color: string }).color, banda: figure.data[0]['fillcolor'] }; + }; + expect(color('cama_dias_toma_diagnostico', 'claro')).toEqual({ linea: '#2F6DB3', banda: '#9DBFE380' }); + expect(color('cama_eu38a', 'claro')).toEqual({ linea: '#9C42C2', banda: '#9C42C240' }); + expect(color('cama_dias_resultado_diagnostico', 'claro')).toEqual({ linea: '#C24269', banda: '#C2426940' }); + expect(color('cama_dias_toma_diagnostico', 'oscuro').linea).toBe('#9DBFE3'); + }); it('las líneas usan el verde legible en cada tema', () => { const data: IndicadorDatos = { ...base, contrato: 'C1', filas: base.periodos.map(p => c1(p, 50)) }; const color = (tema: 'claro' | 'oscuro') => (historicoFigura(data, tema).figure.data[1]['line'] as { color: string }).color; diff --git a/src/app/features/indicadores/indicadores-historico.ts b/src/app/features/indicadores/indicadores-historico.ts index ad494d2..ad159c4 100644 --- a/src/app/features/indicadores/indicadores-historico.ts +++ b/src/app/features/indicadores/indicadores-historico.ts @@ -63,18 +63,23 @@ function agrupar(paneles: (Panel & { datos?: IndicadorDatos })[], tema: Tema): P imports: [MatButtonModule, MatButtonToggleModule, MatFormFieldModule, MatProgressBarModule, MatSelectModule, PlotlyChart], template: `
- Intervalo de análisis - - @if (tipos().includes('mes')) { Mensual } - @if (tipos().includes('semestre')) { Semestral } - - - Periodos a mostrar - - @for (opcion of opciones(); track opcion.valor) { {{ opcion.etiqueta }} } - - - @if (ventana() === PERSONALIZADO) { } +

Filtros

+
+
+ Intervalo de análisis + + @if (tipos().includes('mes')) { Mensual } + @if (tipos().includes('semestre')) { Semestral } + +
+ + Periodos a mostrar + + @for (opcion of opciones(); track opcion.valor) { {{ opcion.etiqueta }} } + + + @if (ventana() === PERSONALIZADO) { } +
@for (panel of paneles(); track panel.item.id) { @@ -123,8 +128,12 @@ function agrupar(paneles: (Panel & { datos?: IndicadorDatos })[], tema: Tema): P `, styles: ` :host { display: block; min-width: 0; } - .controles { display: flex; flex-wrap: wrap; align-items: center; gap: var(--issste-space-3); margin-bottom: var(--issste-space-6); padding: var(--issste-space-3) var(--issste-space-6); + .controles { display: flex; flex-direction: column; align-items: stretch; gap: var(--issste-space-3); margin-bottom: var(--issste-space-6); padding: var(--issste-space-3) var(--issste-space-6); background: var(--issste-surface); color: var(--issste-text); border: 1px solid var(--issste-border); border-radius: var(--issste-radius); } + .controles h2 { margin: 0; font-family: var(--issste-font-heading); font-size: 1rem; font-weight: 500; line-height: 1.3; } + .controles-fila { display: flex; flex-wrap: wrap; align-items: end; gap: var(--issste-space-3); } + .interval { display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; } + .field-label { color: var(--issste-text-secondary); font-size: .75rem; line-height: 1.2; } .paneles { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--issste-space-6); } @container dashboard (min-width: 1304px) { .paneles { grid-template-columns: repeat(2, minmax(0, 1fr)); } } .panel { box-sizing: border-box; min-width: 0; padding: var(--issste-space-6); background: var(--issste-surface); color: var(--issste-text); @@ -141,7 +150,7 @@ function agrupar(paneles: (Panel & { datos?: IndicadorDatos })[], tema: Tema): P .pasos { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--issste-space-4); margin-top: var(--issste-space-3); } @container dashboard (min-width: 960px) { .pasos { grid-template-columns: repeat(3, minmax(0, 1fr)); } } h3 { margin: 0; font: var(--mat-sys-title-small); } - mat-form-field { min-width: 18rem; } + mat-form-field { flex: 0 1 14rem; width: 14rem; min-width: 14rem; max-width: 24rem; } `, }) export class IndicadoresHistorico { diff --git a/src/app/features/indicadores/indicadores-page.html b/src/app/features/indicadores/indicadores-page.html index 7eda76a..cbad333 100644 --- a/src/app/features/indicadores/indicadores-page.html +++ b/src/app/features/indicadores/indicadores-page.html @@ -22,7 +22,7 @@
@if (!catalogLoading() && filters; as state) {
-

{{ dominio === 'cama' ? 'Filtros generales' : 'Filtros generales de ' + domainLabels[dominio] }}

+

Filtros

@if (dominio !== 'cama') {

{{ dominio === 'cacu' ? 'La selección se aplica a los indicadores de oportunidad y las gráficas, salvo las que indican selección independiente: Todos con reporte.' : 'La selección aplicada se comparte entre las figuras y los indicadores destacados de este proyecto.' }}

} @@ -74,9 +74,6 @@

{{ dominio === 'cacu' || dominio === 'cama' ? 'Indicadores clínicos' : 'Indicadores gráficos' }}

- @if (!catalogLoading() && !catalogError() && catalog().length) { -

{{ shownIndicators }} {{ shownIndicators === 1 ? 'indicador publicado' : 'indicadores publicados' }}

- }
@if (catalogLoading()) { diff --git a/src/app/features/indicadores/indicadores-page.scss b/src/app/features/indicadores/indicadores-page.scss index e6cd719..12e096d 100644 --- a/src/app/features/indicadores/indicadores-page.scss +++ b/src/app/features/indicadores/indicadores-page.scss @@ -3,7 +3,7 @@ // own `:host`) -- not present upstream, whose shell lays this out differently. // The workspace shell clips overflow, so the page scrolls itself. :host { display: block; flex: 1; min-width: 0; min-height: 0; overflow-y: auto; padding: 0 var(--space-6) var(--space-7); } -.dashboard { max-width: 1440px; margin: 0 auto; min-width: 0; container: dashboard / inline-size; } +.dashboard { max-width: 1680px; margin: 0 auto; min-width: 0; container: dashboard / inline-size; } h1 { font-family: var(--issste-font-heading); font-size: 1.75rem; font-weight: 500; line-height: 1.25; letter-spacing: 0; margin: .5rem 0; } header p { color: var(--mat-sys-on-surface-variant); margin-bottom: 1.5rem; } .domain { color: var(--mat-sys-primary); font: var(--mat-sys-label-large); } @@ -13,8 +13,11 @@ header p { color: var(--mat-sys-on-surface-variant); margin-bottom: 1.5rem; } .global-filters[data-domain='cama'] .section-title { font-size: 1rem; margin-bottom: var(--issste-space-3); } .section-title { font-family: var(--issste-font-heading); font-size: 1.25rem; font-weight: 500; line-height: 1.3; margin: 0; overflow-wrap: anywhere; } .section-description { color: var(--issste-text-secondary); margin: var(--issste-space-2) 0 var(--issste-space-4); overflow-wrap: anywhere; } -.kpi-section, .graphic-section { min-width: 0; } -.graphic-section { margin-top: var(--issste-space-6); padding-top: var(--issste-space-6); border-top: 1px solid var(--issste-border); } +.kpi-section, .graphic-section { box-sizing: border-box; min-width: 0; margin-inline: calc(var(--space-4) * -1); + padding: var(--issste-space-4) var(--issste-space-5) var(--issste-space-6); border: 1px solid var(--issste-border); + border-radius: var(--issste-radius); background: color-mix(in srgb, var(--issste-border) 42%, var(--issste-background)); } +.kpi-section > .section-title { margin-bottom: var(--issste-space-4); } +.graphic-section { margin-top: var(--issste-space-6); } .kpi-grid, .catalog-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--issste-space-6); } .kpi-section .kpi-grid.kpi-grid-oculto { display: none; } .catalog-grid { align-items: stretch; } @@ -22,7 +25,6 @@ header p { color: var(--mat-sys-on-surface-variant); margin-bottom: 1.5rem; } .reporte-acciones span { color: var(--issste-text-secondary); font: var(--mat-sys-body-medium); } .catalog-grid > app-indicador-catalog-card { min-width: 0; margin: 0; } .catalog-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--issste-space-3); margin-bottom: var(--issste-space-4); } -.catalog-count { margin: 0 0 0 auto; text-align: right; color: var(--issste-text-secondary); overflow-wrap: anywhere; } .catalog-search { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: var(--issste-space-3); margin-top: var(--issste-space-4); } .catalog-search mat-form-field { width: 100%; min-width: 0; max-width: 32rem; } .catalog-search button { min-height: 48px; } diff --git a/src/app/features/indicadores/indicadores-page.spec.ts b/src/app/features/indicadores/indicadores-page.spec.ts index 5e44bec..eac148d 100644 --- a/src/app/features/indicadores/indicadores-page.spec.ts +++ b/src/app/features/indicadores/indicadores-page.spec.ts @@ -93,8 +93,7 @@ describe('UX-06E.D.3.A catálogo permanentemente desplegado', () => { expect(Array.from(sections).map(section => section.getAttribute('aria-labelledby'))).toEqual(['global-filters-title', 'graphic-section-title']); // Cada figura trae su tabla de valores: no hay resumen de indicadores al final de la página. expect(fixture.nativeElement.querySelector('app-indicadores-numeric-summary')).toBeNull(); - expect(fixture.nativeElement.querySelector('.catalog-count').textContent.trim()).toBe('2 indicadores publicados'); - expect(getComputedStyle(fixture.nativeElement.querySelector('.catalog-count')).textAlign).toBe('right'); + expect(fixture.nativeElement.textContent).not.toContain('indicadores publicados'); toggle(0); toggle(1); flushAll(); expect(Array.from(grid.children).map(host => host.querySelectorAll('app-indicador-figure-panel').length)).toEqual([1, 1]); expect(panels().map(panel => panel.figuraId)).toEqual(['f1', 'g']); @@ -114,7 +113,7 @@ describe('UX-06E.D.3.A catálogo permanentemente desplegado', () => { it('Resumen omite los indicadores publicados solo para otra pestaña', () => { load([item, { ...second, vistas: ['historico'] }]); expect(page.searchResults().items.map(i => i.id)).toEqual([item.id]); - expect(fixture.nativeElement.querySelector('.catalog-count').textContent).toContain('1 indicador publicado'); + expect(fixture.nativeElement.textContent).not.toContain('indicador publicado'); expect(page.catalog()).toHaveLength(2); http.expectNone(r => r.url.endsWith('/figuras/f1')); }); diff --git a/src/app/features/indicadores/indicadores-page.ts b/src/app/features/indicadores/indicadores-page.ts index d2320b6..0112b38 100644 --- a/src/app/features/indicadores/indicadores-page.ts +++ b/src/app/features/indicadores/indicadores-page.ts @@ -323,7 +323,6 @@ export class IndicadoresPage { && !this.catalog().some(item => item.id === ID_HISTOPATOLOGIA_CAMA); } // How many indicators the graphic section shows: all the catalog, except in CaMa, which draws only some of them. - get shownIndicators() { return this.catalogOrder().length; } get availableKpis() { return this.kpisByDomain[this.dominio].filter(definition => this.catalog().some(item => item.id === definition.id)); } // TEA shows a summary paragraph instead of its cards for exactly one explicitly chosen period. get teaResumenPeriodo(): string | undefined { diff --git a/src/app/features/indicadores/indicadores-search.spec.ts b/src/app/features/indicadores/indicadores-search.spec.ts index e66dfd1..ff6a2bb 100644 --- a/src/app/features/indicadores/indicadores-search.spec.ts +++ b/src/app/features/indicadores/indicadores-search.spec.ts @@ -67,7 +67,7 @@ describe('Selección de indicadores gráficos', () => { expect(cards()[0]).toBe(before[1]); expect(cards()[1]).toBe(before[4]); expect(page.selectionSummary()).toBe('2 indicadores'); expect(result()).toBe('Mostrando 2 de 5 indicadores.'); - expect(fixture.nativeElement.querySelector('.catalog-count').textContent.trim()).toBe('5 indicadores publicados'); + expect(fixture.nativeElement.textContent).not.toContain('indicadores publicados'); choose(['M02_sexo']); expect(ids()).toEqual(['M02_sexo']); expect(page.selectionSummary()).toBe('Distribución por sexo'); expect(page.catalog()).toBe(original); http.expectNone(() => true); diff --git a/src/styles.scss b/src/styles.scss index 46c5562..04805c0 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -141,6 +141,7 @@ body { .indicator-select-panel .option-go { flex: none; padding: .25rem .6rem; border: 1px solid var(--issste-border); border-radius: var(--issste-radius); color: var(--issste-text); background: var(--issste-surface); font-weight: 600; text-decoration: none; } .indicator-select-panel .option-go:hover { background: var(--issste-accent); } +.issste-help-tooltip { max-width: min(28rem, calc(100vw - 2rem)); white-space: pre-line; line-height: 1.45; } .indicator-select-panel .option-go:focus-visible { outline: 2px solid var(--issste-text); outline-offset: 2px; } // The TEA report: while it's being prepared, charts draw at a width that fits a page.