feat(sliders): support interpolation on merged/banner header tables#61
Merged
Merged
Conversation
Contributor
|
🧹 PR preview for #61 has been removed. |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 53 |
| Duplication | 2 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
A speed-vs-length matrix table often draws a merged banner above the numeric column headers — either a single full-width `<th colspan=N>` title, or a `<th rowspan=2>` corner label beside a colspan banner. The canonical addressing layer treated the FIRST header row as the column header, so the banner (or the collapsed column count it produced) hid the numeric axis: the table read as unsuitable and the interpolation (slider) enrichment was never offered. Teach the header resolution to peel off leading banner/grouping rows and return the LEAF column-header row, and add an occupancy-aware (colspan + rowspan) column reader so a rowspan corner that shifts the leaf cells right is handled. The change threads through every consumer of the header model: - table-grid: `resolveHeader` (banner peel), `headerRows`, `sourceHeaderColumns`, `dataHeaderCells`, `sourceColumnMatrix`. - type-detection / toggle-injector: flatten a multi-row header by logical column for suitability + column typing. - header-utils: place per-column lozenges on the leaf headers and the corner slider lozenge on the true corner; row lozenges on body rows. - slider-injection: read axis headers via `dataHeaderCells`; inject the row-slider header cell into the top header row spanning the block. All banner-aware paths are gated on `headerRows(table).length > 1`, so single-row-header tables are byte-identical. Adds unit coverage for both author permutations at the addressing, axis-binding, and full-activation (lozenge mounts) levels, plus injection teardown. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01EvweKwJZVqe5rWL8bF6ogS
A speed-vs-length matrix page demonstrating both authored header
permutations now supported by the sliders enrichment:
1. a full-width `<th colspan=N>` banner above the numeric column
headers, and
2. a `<th rowspan=2>` corner label beside a `<th colspan=N>` banner
(leaf row is all length headers, shifted right).
The tables are generated before the bundle loads so Grid-Sight sees a
complete table at init. Registered in the demo nav and on the landing
page. Verified in a headless browser: both tables are detected as
suitable, offer an enabled sliders lozenge, and inject both axis sliders
for bilinear interpolation.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EvweKwJZVqe5rWL8bF6ogS
0089159 to
c3a1050
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Speed-vs-length matrix tables commonly draw a merged banner above the numeric column headers. Two author permutations are now supported:
<th colspan="N">Length Overall (m)</th>row above theSpeed Knots | 10 | 20 | …header row.<th rowspan="2">Speed Knots</th>corner beside a<th colspan="N">banner, with the numeric length headers on the leaf row below.Previously the canonical addressing layer treated the first header row as the column header. The banner (or the collapsed column count it produced) hid the numeric axis, so the table read as not suitable and the interpolation (slider) enrichment was never offered — exactly the "extra header cell will probably prevent that" case reported.
What changed
Header resolution now peels off leading banner/grouping rows and returns the leaf column-header row that aligns 1:1 with the data columns. A new occupancy-aware (colspan + rowspan) column reader handles the rowspan corner, which shifts the leaf cells right. The fix threads through every consumer of the header model:
core/table-grid.ts—resolveHeader(banner peel) +headerRows,sourceHeaderColumns,dataHeaderCells,sourceColumnMatrix.core/type-detection.ts/ui/toggle-injector.ts— flatten a multi-row header by logical column so suitability + column typing see the real numeric columns instead of a collapsed banner.ui/header-utils.ts— place per-column lozenges on the leaf headers, the corner slider lozenge on the true corner, and row lozenges on the body rows.enrichments/slider-injection.ts— read axis headers viadataHeaderCells; inject the row-slider header cell into the top header row spanning the whole block so the gutter lines up with the body.Every banner-aware branch is gated on
headerRows(table).length > 1, so single-row-header tables are byte-identical — no behaviour change for the common case.Testing
src/core/__tests__/table-grid.test.ts— leaf-row resolution +dataHeaderCellsfor both permutations, no-<thead>banner, and a plain single-row equivalence check.src/enrichments/__tests__/slider.test.ts—buildAxisBindingfor both permutations, end-to-end dual-axis slider creation + interpolation on a rowspan-corner table, and clean injection teardown.src/ui/__tests__/toggle-injector.banner-header.test.ts— drives the real activation path and asserts the enabled slider lozenge appears for both permutations, plus byte-identical activate→deactivate teardown.Full jsdom unit suite: 731 passing (94 files).
tsc --noEmitclean;vite buildclean. The Storybook browser project + Playwright e2e couldn't run in this environment (Playwright browser-build version mismatch), so those weren't exercised here.Notes / follow-ups
demo/if useful for visual verification.🤖 Generated with Claude Code
https://claude.ai/code/session_01EvweKwJZVqe5rWL8bF6ogS
Generated by Claude Code