Repository navigation
feat: let the caller supply the pivot table filter line text - #1861
Merged
Merged
Conversation
The engine is about to gain a fourth argument, and a fourth positional one would be both unreadable at the call site and over the lint threshold. The class is internal - it is not re-exported from `src/index.js`, and the `exports` map in `package.json` blocks deep imports of the built files - so the signature can change outright rather than growing an options argument alongside the positional ones. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`PivotTableTitleRows` derives the filter row from `visualization.filters` and `rawData.metaData` via `getFilterText`. Sometimes it is easier for the consuming app to work that line out itself - Event Visualizer filters are often value conditions such as `GE:5:LE:10`, which need option sets and value types this package has no access to - so let the caller opt out of the derived text and pass its own in. `PivotTable` takes an optional `filterText` prop, passed through to the engine and kept on `engine.options` alongside `title` and `subtitle`. It deliberately does not travel on `visualization`, which should stay a partial of the saved visualization rather than a bag of render options. The prop picks the text and nothing else. Whether there is a filter row at all remains gated on `visualization.filters?.length`, exactly as before, so a supplied string cannot conjure a row the layout has no filters for, and an empty one renders an empty row rather than suppressing it. Hence `??` rather than `||`: the empty string is a supplied text like any other, and must not fall back to the derived line. `getFilterText` itself is untouched, as are its six other consumers in the Highcharts title and subtitle adapters. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Toggles the `deep - filter` layout between the line the lib derives from
the layout ("Eastern Area") and one supplied by the caller, with a third
mode showing that an empty `filters` layout has no row for either.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
HendrikThePendric
force-pushed
the
feat/pivot-table-filter-text
branch
from
September 24, 2026 09:34
41860b1 to
098bbdb
Compare
|
edoardo
approved these changes
Sep 24, 2026
dhis2-bot
added a commit
that referenced
this pull request
Sep 24, 2026
# [29.8.0](v29.7.1...v29.8.0) (2026-09-24) ### Features * let the caller supply the pivot table filter line text ([#1861](#1861)) ([877c8d5](877c8d5))
Contributor
|
🎉 This PR is included in version 29.8.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
3 tasks done
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.



Implements DHIS2-22147
Relates to https://github.com/dhis2/data-visualizer-app/pull/XXX
Key features
PivotTableaccepts an optionalfilterTextprop, which lets a caller opt out of the filter line the lib derives and supply its own.Description
PivotTableTitleRowsbuilds the filter row fromvisualization.filtersandrawData.metaDataviagetFilterText. Sometimes it is easier to work that line out in the app or plugin instead, so this PR adds afilterTextprop toPivotTablewhich can be used instead of the internally computed string.The prop is passed from
PivotTabletoPivotTableEngineand its constructor already accepted 3 positional argument and adding a 4th one is not allowed according to our ESLint rules. The engine is internal to the lib, so we could easily change this: the constructor now accepts a single options object.Whether there is a filter row keeps being determined by
visualization.filters?.lengthand iffilterTextis an empty string we fall back to the internally generated text, so we never render an empty filter row.TODO