pf_app
Go to file
Paul Trowbridge 4b9296abc1 Collapse the column hierarchy from the toolbar
The row axis has had Expand 0/1/2/3 since the pivot landed; the column
axis had nothing. With a year over month split there was no way to step
back to whole years short of dragging split_by apart in the settings
panel and putting it back afterwards.

Perspective gives the two axes nothing in common here. Rows collapse
because the GROUP BY ROLLUP view holds every level at once and
view.set_depth() hides the deeper ones. For columns there is no
equivalent: expand()/collapse() take a row index, ViewConfig has
group_by_depth but no split_by_depth, and split_rollup_mode only chooses
whether subtotal column groups are emitted — a view shape, not an
interaction. So applySplitDepth() collapses by restoring a truncated
split_by, which rebuilds the view.

Three consequences of that rebuild, each handled:

- Once collapsed, viewer.save() only reports the short split_by, so the
  full hierarchy is held separately (splitFullRef) and persisted into the
  layout as split_full. Without it, collapsing would be a one-way door:
  reload while collapsed and the deeper levels are gone. adoptSplit() is
  the single place it is set.
- perspective-config-update fires for our own restore as well as for the
  user rearranging the pivot, and the two mean opposite things — one must
  adopt the new hierarchy, the other must not. collapsingRef separates
  them.
- Row depth lives on the discarded view, so it is re-applied afterwards.

The selection is cleared on each change: slices name the split_by
dimensions they were cut from, and the highlight is keyed on grid
coordinates. Neither survives a column axis that just changed shape.

Buttons are named for the level they show — Total, then one per split_by
column — rather than numbered like Expand, since the levels are named and
a number would say nothing about what you are collapsing to.

Whole-axis, not per-branch: Excel can collapse 2025 while 2026 stays
expanded, and this cannot. `columns` selects which measures appear, not
individual split combinations, so there is no way to hide one branch's
leaves while keeping another's.

Verified in the browser against cash/test with split_by Year x Reason:
Reason -> Total -> Year -> Reason all render the expected column sets and
the right button highlights; and a reload while collapsed to Year comes
back collapsed with Reason still offered.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoxNi8cFsQLPUSw3obb5NH
2026-09-12 09:15:15 -04:00
lib Multi-slice operations, tagged bridge, and a reworked adjustment panel 2026-09-11 23:30:56 -04:00
public Add UX mockup and update spec with navigation direction 2026-04-25 14:56:29 -04:00
routes Multi-slice operations, tagged bridge, and a reworked adjustment panel 2026-09-11 23:30:56 -04:00
setup_sql Multi-slice operations, tagged bridge, and a reworked adjustment panel 2026-09-11 23:30:56 -04:00
ui Collapse the column hierarchy from the toolbar 2026-09-12 09:15:15 -04:00
.env.example Initial commit — pivot forecast application 2026-04-01 07:59:05 -04:00
.gitignore Scaffold React/Vite/Tailwind UI with 3-step Setup → Baseline → Forecast flow 2026-04-25 16:28:45 -04:00
CLAUDE.md Collapse the column hierarchy from the toolbar 2026-09-12 09:15:15 -04:00
install.sh Initial commit — pivot forecast application 2026-04-01 07:59:05 -04:00
package-lock.json Fix forecast data load and add byte-progress UI 2026-04-28 19:51:39 -04:00
package.json Add CLAUDE.md project instructions and license field to package.json 2026-05-02 20:47:15 -04:00
PERSPECTIVE.md Load Perspective from bundle, not CDN; pin all packages at 5.2.0 2026-08-17 21:30:19 -04:00
pf_perspective_options.md Record DuckDB virtual-server spike findings; choose display-grain pre-aggregation 2026-08-17 21:47:55 -04:00
pf_spec.md Merge perspective-inline-5.2.0: 5.2.0 pin, multi-slice ops, bridge, drag-select 2026-09-12 09:11:11 -04:00
pf.sh Add pf.sh — interactive deployment and service management script 2026-05-02 20:58:39 -04:00
server.js Fix forecast data load and add byte-progress UI 2026-04-28 19:51:39 -04:00