fix(cellset): parse Mondrian style-markers in formatted values#1027
Merged
Conversation
FoodMart Profit (and other schema calc members with conditional
formatting) renders the formatted value through Mondrian's inline
style marker:
|(2,561.57 €)|style=red
The rewrite was passing the whole string through verbatim, so cells
showed the literal markup. The legacy UI parsed these markers and
applied a CSS colour to the cell.
Add a parser ($lib/cellset/cellFormat) plus 6 unit tests covering
the canonical shape, localised currency, hex colours, malformed
input, and null/empty:
/^\|(.*)\|style=(#[0-9a-fA-F]{3,8}|[a-zA-Z]+)$/
Apply it in two cell renderers:
- CellsetTable.svelte: data cells get the inner value + a color
style attr. toNumber + sparkRange strip the marker so selection
stats and sparkline scales parse correctly.
- TableTile.svelte (dashboards): same treatment; clickFilterForCell
also passes the parsed display so click-to-filter doesn't carry
the marker through into the filter payload.
Anything that doesn't match the canonical shape is returned
verbatim, so unrelated pipe-bracketed text is untouched.
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.
Cells showed the literal Mondrian conditional-format markup ('|(2,561.57 €)|style=red') instead of the inner value rendered in the declared colour.
New parser $lib/cellset/cellFormat with 6 unit tests for the canonical shape, hex colours, malformed input, and null/empty. Applied in CellsetTable + TableTile so the inner value + CSS color make it through, and the marker is stripped before selection stats / sparkline scaling / click-to-filter so those derivations don't see the markup.