analytica-frontend-lib
Version:
Repositório público dos componentes utilizados nas plataformas da Analytica Ensino
45 lines • 2.44 kB
TypeScript
import type { CategoryConfig } from '../CheckBoxGroup/index';
import type { ActivityFiltersData } from '../types/activityFilters';
/**
* Extracts selected IDs from knowledge categories by their keys
* @param categories - Array of category configurations
* @param keys - Object mapping output keys to category keys
* @returns Object with extracted selected IDs for each output key
*/
export declare function getSelectedIdsFromCategories(categories: CategoryConfig[], keys: Record<string, string>): Record<string, string[]>;
/**
* Toggles an item in an array (adds if not present, removes if present)
* @param array - Current array
* @param item - Item to toggle
* @returns New array with item toggled
*/
export declare function toggleArrayItem<T>(array: T[], item: T): T[];
/**
* Toggles a single value (returns null if current value, otherwise returns new value)
* @param currentValue - Current selected value
* @param newValue - Value to toggle to
* @returns New value or null if toggling off
*/
export declare function toggleSingleValue<T>(currentValue: T | null, newValue: T): T | null;
export declare function areFiltersEqual(filters1: ActivityFiltersData | null, filters2: ActivityFiltersData | null): boolean;
/**
* Derives year IDs from bank IDs when explicit year IDs are not provided
* @param yearItens - Array of year items to filter
* @param bankIds - Array of bank IDs to filter by
* @param explicitYearIds - Explicitly provided year IDs (takes precedence)
* @returns Array of year IDs
*/
export declare function deriveYearIdsFromBankIds(yearItens: unknown[], bankIds: string[], explicitYearIds: string[]): string[];
/**
* Builds the year IDs to send for a set of selected banks, handling mixed
* selections: explicitly-selected years are retained for the banks that have
* them, and every selected bank *without* an explicit year contributes all of
* its available years (the backend filters only by bank-year, so a bank with no
* year would otherwise match everything). The result is deduplicated.
* @param yearItens - Array of year items (each with id/bankId)
* @param bankIds - Array of selected bank IDs
* @param explicitYearIds - Year IDs the user explicitly selected
* @returns Deduplicated array of year IDs
*/
export declare function mergeYearIdsForSelectedBanks(yearItens: unknown[], bankIds: string[], explicitYearIds: string[]): string[];
//# sourceMappingURL=activityFilters.d.ts.map