diff --git a/CHANGELOG.fr.md b/CHANGELOG.fr.md index 1a34346..7c0ae1c 100644 --- a/CHANGELOG.fr.md +++ b/CHANGELOG.fr.md @@ -2,6 +2,10 @@ ## [Non publié] +### Modifié + +- Rapports : les trois tableaux de rapport hiérarchiques (Comparaison réel-vs-réel, réel-vs-budget, et Tendances par catégorie) permettent désormais de **replier ou déplier chaque niveau de la hiérarchie de catégories**, plus seulement le premier. Chaque catégorie parente — y compris les intermédiaires — porte son propre chevron ; en déplier une révèle ses enfants directs (eux-mêmes repliés), pour descendre un niveau à la fois. Les tableaux s'ouvrent entièrement repliés (seules les catégories de premier niveau visibles), « Tout déplier » ouvre tous les niveaux d'un coup, et vos choix de repli sont désormais enregistrés **par profil** — dans la base de données du profil, donc détruits avec lui — au lieu du navigateur. Les sous-totaux et les lignes de résultat restent rigoureusement inchangés quel que soit ce que vous repliez (#288). + ## [0.13.0] - 2026-07-12 ### Ajouté diff --git a/CHANGELOG.md b/CHANGELOG.md index baa699f..9131ae0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +### Changed + +- Reports: the three hierarchical report tables (real-vs-real Compare, real-vs-budget Compare, and Trends by category) now let you **collapse or expand every level of the category hierarchy**, not just the top level. Every parent category — including the intermediate ones — carries its own chevron; expanding one reveals its direct children (themselves collapsed), so you drill down one level at a time. The tables open fully collapsed (only the top-level categories visible), "Expand all" opens every level at once, and your collapse choices are now saved **per profile** — in the profile's own database, so they are destroyed with the profile — instead of in the browser. Subtotals and result lines stay exactly the same whatever you fold away (#288). + ## [0.13.0] - 2026-07-12 ### Added diff --git a/src/components/reports/BudgetVsActualTable.tsx b/src/components/reports/BudgetVsActualTable.tsx index bd8f1b0..2257db5 100644 --- a/src/components/reports/BudgetVsActualTable.tsx +++ b/src/components/reports/BudgetVsActualTable.tsx @@ -29,11 +29,11 @@ interface BudgetVsActualTableProps { const STORAGE_KEY = "subtotals-position"; -// Collapse groups keyed by category id; depth mirrors the render logic below -// (a missing depth is derived from parent_id) so hidden rows are exactly a -// group's indented descendants. +// Collapse groups keyed by category id; a row is hidden when any ancestor +// (walking parent_id) is collapsed, so every parent level is collapsible. const BVA_COLLAPSE_ACCESSORS: CollapseAccessors = { - keyOf: (row) => String(row.category_id), + keyOf: (row) => `p:${row.category_id}`, + parentKeyOf: (row) => (row.parent_id != null ? `p:${row.parent_id}` : null), depthOf: (row) => row.depth ?? (row.parent_id !== null && !row.is_parent ? 1 : 0), isParent: (row) => row.is_parent, }; @@ -116,11 +116,12 @@ export default function BudgetVsActualTable({ data }: BudgetVsActualTableProps) const depth = row.depth ?? (row.parent_id !== null && !row.is_parent ? 1 : 0); const isTopParent = isParent && depth === 0; const isIntermediateParent = isParent && depth >= 1; - const collapsed = isTopParent && groups.isCollapsed(row); + const collapsed = isParent && groups.isCollapsed(row); const paddingClass = depth >= 3 ? "pl-20" : depth === 2 ? "pl-14" : depth === 1 ? "pl-8" : "px-3"; return ( - {isTopParent ? ( + {isParent ? (