Perspective's column axis cannot be collapsed. The row axis has had it forever — GROUP BY ROLLUP holds every level and view.set_depth() hides the deeper ones — but nothing equivalent is exposed for split_by, so a Year over Month pivot can only ever be shown fully expanded. The engine already implements it. t_ctx2 is symmetric: set_depth(t_header, depth), open(t_header, idx) and close(t_header, idx) each have a real HEADER_COLUMN branch on m_ctraversal mirroring m_rtraversal, and t_view_config carries m_column_pivot_depth which server.cpp already applies. None of it is reachable: set_column_pivot_depth() is never called, so the depth stays -1, and View<t_ctx2>::expand/collapse hardcode HEADER_ROW. The patch is 193 lines of wiring across the protobuf, the Rust client and the datagrid — no new engine logic. Two capabilities result, mirroring the row axis: - split_by_depth in ViewConfig, the split_by counterpart to group_by_depth - expand_column()/collapse_column(), addressed by column traversal index exactly as the row methods are addressed by row index which together give the Excel behaviour — one year folded to its subtotal while its siblings stay expanded — that no combination of existing config could produce. Verified in this app against fc_cash_9: clicking a Year header goes from 27 columns to 15, totals reconciling at every level. Vendored rather than aliased - The previous approach pointed vite at a local checkout, which built only on one laptop and left package.json claiming npm 5.2.0 while the build used something else. The four packages are now committed as npm tarballs and package.json names them, so the declaration is true and `pf.sh deploy` works unchanged — npm install expands them like any registry package. - Packed with `pnpm pack`, not `npm pack`: Perspective is a pnpm workspace and cross-package deps are `workspace:^`, which npm rejects outright. pnpm rewrites those to real version ranges at pack time. - All four move together. Perspective couples loader, package versions, data format and apache-arrow; a partial vendor reintroduces exactly that drift. Cost, stated plainly: 12MB of opaque binaries in git that do not delta, a fork to maintain, and a second engine build for anyone changing it. rebuild-perspective.sh makes that repeatable and PROVENANCE.txt records the commit each tarball came from, because a committed .tgz otherwise has no recoverable source. README.md says how to delete all of it once upstream ships the feature. This also moves the app from 5.2.0 to 5.4.0. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LoxNi8cFsQLPUSw3obb5NH
2.3 KiB
Vendored Perspective
pf_app runs a patched build of Perspective. Upstream's C++ engine has always
implemented column-axis expand/collapse — t_ctx2::set_depth(HEADER_COLUMN, …)
and open/close(HEADER_COLUMN, idx) are fully written — but nothing above C++
could reach it: set_column_pivot_depth() was never called, and
View<t_ctx2>::expand/collapse hardcoded HEADER_ROW. The patch is wiring, not
new engine logic.
It buys two things the released packages cannot do at all:
split_by_depthinViewConfig, thesplit_bycounterpart togroup_by_depthexpand_column()/collapse_column(), so one column branch can fold to its subtotal while its siblings stay expanded — the Excel behaviour
Source: https://github.com/fleetside72/perspective, branch
column-axis-expand-collapse. See PROVENANCE.txt for the exact commit these
tarballs were built from.
Why tarballs and not npm
The feature is not released upstream. Until it is, the four packages are built
from the fork and committed here as npm tarballs. npm install expands them
exactly as it expands anything from the registry — no special tooling, and
pf.sh deploy works unchanged. A deploy machine needs node and nothing else:
no emscripten, no cmake, no protoc, no Rust.
All four move together, never a subset. Perspective couples loader, package
versions, data format and apache-arrow; vendoring a partial set reintroduces
exactly the drift that causes trouble.
Changing the engine
./rebuild-perspective.sh # builds the fork, repacks, rewrites PROVENANCE.txt
cd .. && npm install
git add vendor && git commit
Push the fork first — the script warns if the source tree is dirty, because a tarball built from uncommitted code has no recoverable source.
The build itself needs cmake >= 3.29.5, protoc >= 22 (its version silently selects which protobuf source tree gets cloned), pnpm, and the Rust nightly the repo pins. Roughly 40 minutes cold. Only ever on a machine changing the engine.
Getting rid of this
This is a fork, with the maintenance that implies. The exit is upstream taking
the change — the patch is small and additive, and the engine work is already
theirs. When a release ships it, delete this directory and put normal version
ranges back in ui/package.json.