Skip to content

fix(cellset): parse Mondrian style-markers in formatted values#1027

Merged
buggtb merged 1 commit into
developmentfrom
fix/mondrian-style-markers
May 28, 2026
Merged

fix(cellset): parse Mondrian style-markers in formatted values#1027
buggtb merged 1 commit into
developmentfrom
fix/mondrian-style-markers

Conversation

@buggtb
Copy link
Copy Markdown
Contributor

@buggtb buggtb commented May 28, 2026

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.

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.
@buggtb buggtb merged commit 3de115d into development May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant