Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BJKMLHdxMwSUeYcdkwqX4W
22 lines
915 B
TypeScript
22 lines
915 B
TypeScript
// Что нужно включить, чтобы строку с ключом key можно было показать на экране (переход «Показать»).
|
||
import type { GridRow } from './statementGrid';
|
||
|
||
export interface FocusSwitches {
|
||
details: boolean;
|
||
emptySublines: boolean;
|
||
}
|
||
|
||
/** Какие переключатели нужно включить для строки key; уже включённые и неизвестный ключ — false. */
|
||
export function switchesFor(
|
||
key: string,
|
||
rows: GridRow[],
|
||
state: { showDetails: boolean; showEmptySublines: boolean; emptySublines: ReadonlySet<string> },
|
||
): FocusSwitches {
|
||
const row = rows.find((r) => r.key === key);
|
||
if (!row) return { details: false, emptySublines: false };
|
||
return {
|
||
details: row.lineStatus === 'detail' && !state.showDetails,
|
||
emptySublines: state.emptySublines.has(key) && !state.showEmptySublines,
|
||
};
|
||
}
|