diff --git a/src/app/features/indicadores/indicador-kpi-card.spec.ts b/src/app/features/indicadores/indicador-kpi-card.spec.ts
new file mode 100644
index 0000000..913be29
--- /dev/null
+++ b/src/app/features/indicadores/indicador-kpi-card.spec.ts
@@ -0,0 +1,34 @@
+import { TestBed } from '@angular/core/testing';
+import { IndicadorKpiCard } from './indicador-kpi-card';
+
+ describe('UX-06E.D.1 KPI presentacional', () => {
+ it('presenta título y definición pendiente sin valores, unidades, fechas ni controles', () => {
+ const fixture = TestBed.createComponent(IndicadorKpiCard);
+ fixture.componentRef.setInput('title', 'Indicador destacado 1'); fixture.detectChanges();
+ expect(fixture.nativeElement.querySelector('h3').textContent).toBe('Indicador destacado 1');
+ expect(fixture.nativeElement.querySelector('.kpi-state').textContent).toBe('Pendiente de definición');
+ expect(fixture.nativeElement.querySelector('.value')).toBeNull();
+ expect(fixture.nativeElement.querySelectorAll('p')).toHaveLength(1);
+ expect(fixture.nativeElement.querySelector('button, input, app-plotly-chart')).toBeNull();
+ fixture.destroy();
+ });
+ it.each([null, undefined])('omite el valor opcional %s sin convertirlo a cero', value => {
+ const fixture = TestBed.createComponent(IndicadorKpiCard);
+ fixture.componentRef.setInput('title', 'Presentación'); fixture.componentRef.setInput('value', value);
+ fixture.detectChanges(); expect(fixture.nativeElement.querySelector('.value')).toBeNull(); fixture.destroy();
+ });
+ it('admite contenido opcional suministrado por su consumidor sin servicios ni formatos impuestos', () => {
+ const fixture = TestBed.createComponent(IndicadorKpiCard);
+ for (const [name, value] of Object.entries({ title: 'Título de prueba', value: 'Valor de prueba', unit: 'Unidad de prueba',
+ temporalReference: 'Referencia de prueba', state: 'Estado de prueba', additionalInfo: 'Información de prueba' })) {
+ fixture.componentRef.setInput(name, value);
+ }
+ fixture.detectChanges();
+ 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('.kpi-state').textContent).toBe('Estado de prueba');
+ expect(fixture.nativeElement.querySelector('.additional-info').textContent).toBe('Información de prueba');
+ fixture.destroy();
+ });
+});
diff --git a/src/app/features/indicadores/indicador-kpi-card.ts b/src/app/features/indicadores/indicador-kpi-card.ts
new file mode 100644
index 0000000..3539f50
--- /dev/null
+++ b/src/app/features/indicadores/indicador-kpi-card.ts
@@ -0,0 +1,37 @@
+import { Component, Input } from '@angular/core';
+import { MatCardModule } from '@angular/material/card';
+
+@Component({
+ selector: 'app-indicador-kpi-card',
+ imports: [MatCardModule],
+ template: `
+
+ {{ title }}
+ @if (value !== null && value !== undefined) {
+ {{ value }}@if (unit) { {{ unit }} }
+ }
+ @if (temporalReference) { {{ temporalReference }}
}
+ {{ state }}
+ @if (additionalInfo) { {{ additionalInfo }}
}
+
+ `,
+ styles: `
+ :host { display: block; min-width: 0; }
+ mat-card { box-sizing: border-box; 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; }
+ h3 { margin: 0; font-family: var(--issste-font-heading); font-size: 1.25rem; line-height: 1.3; }
+ h3, p { overflow-wrap: anywhere; }
+ p { margin: var(--issste-space-3) 0 0; }
+ .kpi-state, .additional-info { color: var(--issste-text-secondary); font: var(--mat-sys-body-medium); }
+ .value { font: var(--mat-sys-headline-medium); }
+ `,
+})
+export class IndicadorKpiCard {
+ @Input({ required: true }) title!: string;
+ @Input() value?: string | number | null;
+ @Input() unit?: string;
+ @Input() temporalReference?: string;
+ @Input() state = 'Pendiente de definición';
+ @Input() additionalInfo?: string;
+}
diff --git a/src/app/features/indicadores/indicadores-page.html b/src/app/features/indicadores/indicadores-page.html
index a89e722..bfd61a0 100644
--- a/src/app/features/indicadores/indicadores-page.html
+++ b/src/app/features/indicadores/indicadores-page.html
@@ -10,41 +10,60 @@
}
- @if (catalogLoading()) {
-
-
Cargando catálogo de indicadores…
- } @else if (catalogError()) {
- {{ catalogError() }}
-
- } @else if (!catalog().length) {
- No hay indicadores disponibles en el catálogo.
-
- } @else {
- {{ catalog().length }} indicadores publicados
- @if (searchVisible()) {
-
-
- Buscar indicadores
-
- Las coincidencias aparecen primero; todos los indicadores siguen visibles.
-
-
-
-
- @if (searchResults().active) {
- @if (searchResults().count) {
- {{ searchResults().count }} coincidencias de {{ catalog().length }} indicadores. Todos permanecen disponibles.
- } @else {
- No se encontraron coincidencias. El catálogo completo permanece disponible en su orden original.
+
+ Indicadores destacados — Vista preliminar
+ Muestra visual de {{ domainLabels[dominio] }}. Las definiciones y fuentes de estos indicadores están pendientes.
+
+ @for (preview of kpiPreviewsByDomain[dominio]; track dominio + ':' + preview.id) {
+
+ }
+
+
+
+
+
+
Indicadores gráficos
+ @if (!catalogLoading() && !catalogError() && catalog().length) {
+
{{ catalog().length }} indicadores publicados
+ }
+
+ @if (catalogLoading()) {
+
+ Cargando catálogo de indicadores…
+ } @else if (catalogError()) {
+ {{ catalogError() }}
+
+ } @else if (!catalog().length) {
+ No hay indicadores disponibles en el catálogo.
+
+ } @else {
+ @if (searchVisible()) {
+
+
+ Buscar indicadores
+
+
+ Las coincidencias aparecen primero; todos los indicadores siguen visibles.
+
+
+
+ @if (searchResults().active) {
+ @if (searchResults().count) {
+ {{ searchResults().count }} coincidencias de {{ catalog().length }} indicadores. Todos permanecen disponibles.
+ } @else {
+ No se encontraron coincidencias. El catálogo completo permanece disponible en su orden original.
+ }
}
+
+ }
+
+ @for (item of searchResults().items; track cardIdentity(item)) {
+
}
-
+
}
- @for (item of searchResults().items; track cardIdentity(item)) {
-
- }
- }
+
diff --git a/src/app/features/indicadores/indicadores-page.scss b/src/app/features/indicadores/indicadores-page.scss
index ac239f7..8ee42b5 100644
--- a/src/app/features/indicadores/indicadores-page.scss
+++ b/src/app/features/indicadores/indicadores-page.scss
@@ -1,14 +1,28 @@
-:host { display: block; }
-.dashboard { max-width: 1440px; margin: 0 auto; }
+:host { display: block; min-width: 0; }
+.dashboard { max-width: 1440px; margin: 0 auto; min-width: 0; container: dashboard / inline-size; }
h1 { font: var(--mat-sys-headline-large); font-family: var(--issste-font-heading); font-weight: 700; margin: .65rem 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); }
.state { padding: 1.25rem; margin: 0; }
-mat-form-field { width: 100%; max-width: 24rem; }
-@media (max-width: 550px) { h1 { font-size: var(--mat-sys-headline-medium-size); line-height: var(--mat-sys-headline-medium-line-height); } }
-.catalog-search { display: flex; justify-content: flex-end; align-items: flex-start; gap: var(--issste-space-3); flex-wrap: wrap; margin-top: var(--issste-space-4); }
-.catalog-search button { flex: 0 0 48px; width: 48px; height: 48px; margin-top: .25rem; }
-.search-result { color: var(--mat-sys-on-surface-variant); font: var(--mat-sys-body-medium); }
+.section-title { font-family: var(--issste-font-heading); font-size: 1.5rem; 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-grid, .catalog-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--issste-space-6); }
+.catalog-grid { align-items: start; }
+.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; justify-content: flex-end; margin-top: var(--issste-space-4); }
+.catalog-search mat-form-field { width: 100%; min-width: 0; max-width: 32rem; }
+.catalog-search button { width: 48px; height: 48px; }
+.catalog-search button:focus-visible { outline: 2px solid var(--issste-text); outline-offset: -3px; }
+// Keep search semantics; Material supplies the single accessible clear control.
+.catalog-search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
+.search-result { color: var(--mat-sys-on-surface-variant); font: var(--mat-sys-body-medium); text-align: right;
+ overflow-wrap: anywhere; margin: var(--issste-space-2) 0 var(--issste-space-4); }
+@container dashboard (min-width: 600px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
+@container dashboard (min-width: 1304px) { .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
nav {
display: flex;
@@ -19,7 +33,6 @@ nav {
margin: var(--issste-space-4) 0;
border-radius: var(--issste-radius);
}
-
nav a {
flex: 0 1 6rem;
max-width: 10rem;
@@ -29,18 +42,12 @@ nav a {
min-height: 44px;
border-radius: var(--issste-radius);
}
-
nav a[aria-current='page'] {
background: var(--issste-accent);
font-weight: 700;
text-decoration: none;
}
-
-.catalog-search mat-form-field { flex: 1 1 18rem; min-width: 0; max-width: 32rem; }
-.search-result { overflow-wrap: anywhere; margin: var(--issste-space-2) 0 var(--issste-space-4); }
@media (max-width: 550px) {
- .catalog-search { justify-content: flex-start; flex-wrap: nowrap; }
- .catalog-search mat-form-field { flex-basis: 0; width: auto; max-width: none; }
- .catalog-search button { margin-top: .25rem; }
+ h1 { font-size: var(--mat-sys-headline-medium-size); line-height: var(--mat-sys-headline-medium-line-height); }
nav { gap: var(--issste-space-2); padding-inline: 0; }
}
diff --git a/src/app/features/indicadores/indicadores-page.spec.ts b/src/app/features/indicadores/indicadores-page.spec.ts
index 306b712..93d7f7b 100644
--- a/src/app/features/indicadores/indicadores-page.spec.ts
+++ b/src/app/features/indicadores/indicadores-page.spec.ts
@@ -41,6 +41,51 @@ describe('UX-05B catálogo expandible', () => {
function flushAll() { http.match(r => r.url.includes('/figuras/')).forEach(r => r.flush({ data: [{ y: [0, null] }], layout: {} })); fixture.detectChanges(); }
function control(index = 0) { return fixture.debugElement.queryAll(By.directive(IndicadorPeriodFilters))[index].componentInstance as IndicadorPeriodFilters; }
+ it.each(['tea', 'cacu', 'cama'] as const)('D.1 muestra dos KPI pendientes propios de %s fuera del catálogo', domain => {
+ if (domain !== 'tea') {
+ const initial = http.expectOne('/tea/indicadores');
+ page.changeDominio(domain); expect(initial.cancelled).toBe(true);
+ }
+ fixture.detectChanges();
+ const section = fixture.nativeElement.querySelector('.kpi-section') as HTMLElement;
+ expect(section.dataset['domain']).toBe(domain);
+ expect(section.querySelector('h2')?.textContent).toBe('Indicadores destacados — Vista preliminar');
+ expect(section.textContent).toContain('Muestra visual de ' + page.domainLabels[domain]);
+ const kpis = section.querySelectorAll('app-indicador-kpi-card');
+ expect(Array.from(kpis).map(kpi => kpi.querySelector('h3')?.textContent)).toEqual(['Indicador destacado 1', 'Indicador destacado 2']);
+ expect(Array.from(kpis).map(kpi => kpi.querySelector('.kpi-state')?.textContent)).toEqual(['Pendiente de definición', 'Pendiente de definición']);
+ expect(section.querySelector('.value, button, input, app-plotly-chart')).toBeNull();
+ expect(section.textContent).not.toContain('publicados');
+ load([], domain); expect(fixture.nativeElement.querySelectorAll('app-indicador-kpi-card')).toHaveLength(2);
+ http.expectNone(() => true);
+ });
+ it('D.1 conserva KPI durante carga, error, reintento y catálogo vacío sin HTTP propio', () => {
+ fixture.detectChanges();
+ const kpis = Array.from(fixture.nativeElement.querySelectorAll('app-indicador-kpi-card'));
+ expect(kpis).toHaveLength(2);
+ http.expectOne('/tea/indicadores').flush('private', { status: 500, statusText: 'Error' }); fixture.detectChanges();
+ expect(Array.from(fixture.nativeElement.querySelectorAll('app-indicador-kpi-card'))).toEqual(kpis);
+ page.retryCatalog(); fixture.detectChanges();
+ expect(Array.from(fixture.nativeElement.querySelectorAll('app-indicador-kpi-card'))).toEqual(kpis);
+ load([]); expect(Array.from(fixture.nativeElement.querySelectorAll('app-indicador-kpi-card'))).toEqual(kpis);
+ expect(fixture.nativeElement.querySelector('.catalog-count')).toBeNull(); http.expectNone(() => true);
+ });
+ it('D.1 separa secciones y conserva tarjetas, orden, identidades y figuras dentro del grid', () => {
+ load(); const before = cards();
+ const grid = fixture.nativeElement.querySelector('.catalog-grid') as HTMLElement;
+ expect(getComputedStyle(grid).display).toBe('grid');
+ expect(grid.children).toHaveLength(2);
+ expect(Array.from(grid.children).every(host => host.tagName === 'APP-INDICADOR-CATALOG-CARD')).toBe(true);
+ const sections = fixture.nativeElement.querySelectorAll('.dashboard > section') as NodeListOf;
+ expect(Array.from(sections).map(section => section.getAttribute('aria-labelledby'))).toEqual(['kpi-section-title', 'graphic-section-title']);
+ expect(fixture.nativeElement.querySelector('.catalog-count').textContent.trim()).toBe('2 indicadores publicados');
+ expect(getComputedStyle(fixture.nativeElement.querySelector('.catalog-count')).textAlign).toBe('right');
+ toggle(0); toggle(1); flushAll();
+ expect(Array.from(grid.children).map(host => host.querySelectorAll('app-indicador-figure-panel').length)).toEqual([2, 1]);
+ expect(panels().map(panel => panel.figuraId)).toEqual(['f1', 'f2', 'g']);
+ expect(cards()).toEqual(before); expect(cards().every(card => card.expanded)).toBe(true);
+ http.expectNone(() => true);
+ });
it('UX-06C: tarjeta contraída contiene solo identidad y flecha decorativa en un botón nativo', () => {
load();
const host = fixture.nativeElement.querySelector('app-indicador-catalog-card') as HTMLElement;
diff --git a/src/app/features/indicadores/indicadores-page.ts b/src/app/features/indicadores/indicadores-page.ts
index 5075c72..2705f16 100644
--- a/src/app/features/indicadores/indicadores-page.ts
+++ b/src/app/features/indicadores/indicadores-page.ts
@@ -15,12 +15,13 @@ import { Dominio, DOMINIOS, isDominio, Indicador, Tema } from './indicadores.mod
import { IndicadoresService } from './indicadores.service';
import { IndicadoresMemory } from './indicadores-memory';
import { IndicadorCatalogCard } from './indicador-catalog-card';
+import { IndicadorKpiCard } from './indicador-kpi-card';
import { indicatorIdentity } from './indicadores-identities';
import { httpMessage } from './indicadores-http';
@Component({
selector: 'app-indicadores-page',
- imports: [RouterLink, FormsModule, MatButtonModule, MatCardModule, MatFormFieldModule, MatInputModule, MatIconModule, MatSelectModule, MatProgressBarModule, IndicadorCatalogCard],
+ imports: [RouterLink, FormsModule, MatButtonModule, MatCardModule, MatFormFieldModule, MatInputModule, MatIconModule, MatSelectModule, MatProgressBarModule, IndicadorCatalogCard, IndicadorKpiCard],
templateUrl: './indicadores-page.html',
styleUrl: './indicadores-page.scss',
})
@@ -55,6 +56,12 @@ export class IndicadoresPage {
readonly dominios = DOMINIOS;
dominio: Dominio = 'tea';
readonly domainLabels: Record = { tea: 'TEA', cacu: 'CaCu', cama: 'CaMa' };
+ // Presentation samples only. Each domain can replace its own future configuration.
+ readonly kpiPreviewsByDomain: Record = {
+ tea: [{ id: 'preview-1', title: 'Indicador destacado 1' }, { id: 'preview-2', title: 'Indicador destacado 2' }],
+ cacu: [{ id: 'preview-1', title: 'Indicador destacado 1' }, { id: 'preview-2', title: 'Indicador destacado 2' }],
+ cama: [{ id: 'preview-1', title: 'Indicador destacado 1' }, { id: 'preview-2', title: 'Indicador destacado 2' }],
+ };
private readonly catalogRequests = new Subject();
readonly catalog = signal([]);
readonly searchQuery = signal('');
diff --git a/src/app/features/indicadores/indicadores-search.spec.ts b/src/app/features/indicadores/indicadores-search.spec.ts
index db9fc8a..a38446d 100644
--- a/src/app/features/indicadores/indicadores-search.spec.ts
+++ b/src/app/features/indicadores/indicadores-search.spec.ts
@@ -85,6 +85,23 @@ describe('UX-05C búsqueda local y partición estable', () => {
if (!(query as string).trim()) expect(fixture.nativeElement.querySelector('#catalog-search-result').textContent.trim()).toBe('');
http.expectNone(() => true);
});
+ it('D.1 mantiene KPI fuera de la búsqueda y del recuento y utiliza un único suffix Material', async () => {
+ load(); await settle();
+ const kpis = Array.from(fixture.nativeElement.querySelectorAll('app-indicador-kpi-card'));
+ const field = fixture.nativeElement.querySelector('.catalog-search mat-form-field') as HTMLElement;
+ const clear = field.querySelector('button')!;
+ expect(clear.hasAttribute('matIconSuffix')).toBe(true);
+ expect(clear.closest('.mat-mdc-form-field-icon-suffix')).toBeTruthy();
+ expect(fixture.nativeElement.querySelectorAll('.catalog-search button')).toHaveLength(1);
+ expect(input().type).toBe('search');
+ for (const query of ['sexo', 'Indicador destacado', '']) {
+ await search(query);
+ expect(Array.from(fixture.nativeElement.querySelectorAll('app-indicador-kpi-card'))).toEqual(kpis);
+ expect(fixture.nativeElement.querySelector('.catalog-count').textContent.trim()).toBe('5 indicadores publicados');
+ expect(cards()).toHaveLength(5);
+ }
+ http.expectNone(() => true);
+ });
it('escritura y limpieza mantienen foco, cursor, etiqueta y ayudas sin HTTP', async () => {
load(); await settle(); const field = input(); field.focus(); await search('sexo');
expect(document.activeElement).toBe(field); expect(field.value).toBe('sexo');