feat(ui): incorporar selector de figuras KPI y fijacion de indicadores
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Injectable, signal } from '@angular/core';
|
||||
import { Dominio, Indicador, parsePeriodos, Tema, TipoPeriodo } from './indicadores.models';
|
||||
|
||||
export type PeriodDraft =
|
||||
@@ -63,7 +63,24 @@ export type CardActivation = 'pending' | 'auto-open' | 'manual-open' | 'manual-c
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class IndicadoresMemory {
|
||||
private readonly pinnedIndicators = signal<ReadonlySet<string>>(new Set());
|
||||
isPinned(domain: Dominio, indicador: string) {
|
||||
return this.pinnedIndicators().has(JSON.stringify([domain, indicador]));
|
||||
}
|
||||
togglePinned(domain: Dominio, indicador: string) {
|
||||
const key = JSON.stringify([domain, indicador]);
|
||||
this.pinnedIndicators.update(current => {
|
||||
const next = new Set(current);
|
||||
if (next.has(key)) next.delete(key); else next.add(key);
|
||||
return next;
|
||||
});
|
||||
}
|
||||
private readonly themes = new Map<Dominio, Tema>();
|
||||
private readonly figures = new Map<string, string>();
|
||||
figure(domain: Dominio, indicador: string) { return this.figures.get(JSON.stringify([domain, indicador])); }
|
||||
rememberFigure(domain: Dominio, indicador: string, figure: string) {
|
||||
this.figures.set(JSON.stringify([domain, indicador]), figure);
|
||||
}
|
||||
private readonly expansions = new Map<string, CardActivation>();
|
||||
private readonly filters = new Map<Dominio, GlobalFilterState>();
|
||||
theme(domain: Dominio): Tema { return this.themes.get(domain) ?? 'claro'; }
|
||||
|
||||
Reference in New Issue
Block a user