Skip to content

Conversation

@hokolomopo
Copy link
Contributor

Description:

[IMP] pivots: implement pivot table styles

With this commit, we don't need to manually create a dynamic table
to a pivot to have a style applied. Instead we can add a style in the
pivot definition, and dynamic tables will automatically be created on
the dynamic pivot formulas.

Those new pivot styles are better than traditional tables styles because:

  • they are directly linked to the pivot, taking into account the
    number of headers, the presence of totals, etc.
  • they are automatically added on =PIVOT() formulas, without the need to
    create a dynamic table first.
  • they are more powerful than the old table styles, they can have a
    style for the sub-headers, the measure headers, etc.

[IMP] renderer: draw cell background over grid lines

With this commit, the cell background are now drawn totally covering
the grid lines. It's way prettier for table/pivots to have an uniform
background color without grid lines breaking it.

The downside is we cannot draw the hover overlay with a color alpha,
because it would overlap with the next cell, making a darker color
at the border. We can workaround by merging the colors programmatically
and avoid drawing with alpha.

[IMP] style: add skipCellGridLines style option

This commit introducing cell animations added an option
skipCellGridLines to the rendering boxes. The option allows to
skip drawing grid lines for specific cells.

This commit changes this rendering box option into a standard cell
style option, so it can be used in other parts of the codebase as well.

[REF] table style: add bold to table style presets

Before this commit, the table style presets contained all the style of
a table, except the bold property, which was handled separately and
applied to every total/header row or first/last column.

This made the code harder to read with two sources of truth for the
style, and with the introduction of pivot table styles, every header
row won't be in bold anymore.

This commit adds the bold property to the table style presets,
os it is handled like every other style property.

Task: 4552232

review checklist

  • feature is organized in plugin, or UI components
  • support of duplicate sheet (deep copy)
  • in model/core: ranges are Range object, and can be adapted (adaptRanges)
  • in model/UI: ranges are strings (to show the user)
  • undo-able commands (uses this.history.update)
  • multiuser-able commands (has inverse commands and transformations where needed)
  • new/updated/removed commands are documented
  • exportable in excel
  • translations (_t("qmsdf %s", abc))
  • unit tested
  • clean commented code
  • track breaking changes
  • doc is rebuild (npm run doc)
  • status is correct in Odoo

@robodoo
Copy link
Collaborator

robodoo commented Nov 12, 2025

Pull request status dashboard

@hokolomopo hokolomopo changed the title ### [IMP] pivots: implement pivot table styles [IMP] pivots: implement pivot table styles Nov 12, 2025
@hokolomopo hokolomopo force-pushed the master-pivot-table-style-adrm branch 4 times, most recently from e30e965 to cd9fa6d Compare November 13, 2025 14:02
fillColor?: Color;
textColor?: Color;
fontSize?: number; // in pt, not in px!
skipCellGridLines?: boolean;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really not a fan of adding this to Style which is supposed to be the core, raw data for style, while skipCellGridLines seems to be something derived from other things

EDIT: mouais...I see

templateName: "pivotMediumBlackHeaders",
primaryColor: colorSet.highlight,
wholeTable: {
style: { skipCellGridLines: true, fillColor: colorSet.light },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

skipCellGridLines: true not useful if there's a fill color ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But drawing grid lines just to paint a color over it is also useless 🤷

@LucasLefevre
Copy link
Collaborator

And the feature is really cool 👍

This commit extracts the logic that tracks the occurrence of the SUBTOTAL
formulas to a more generic plugin named `formula_tracker`. This will
be used to track the occurrences of `PIVOT` formulas in a future commit.

Task: 4552232
Before this commit, the table style presets contained all the style of
a table, except the `bold` property, which was handled separately and
applied to every total/header row or first/last column.

This made the code harder to read with two sources of truth for the
style, and with the introduction of pivot table styles, every header
row won't be in bold anymore.

This commit adds the `bold` property to the table style presets,
os it is handled like every other style property.

Task: 4552232
@hokolomopo hokolomopo force-pushed the master-pivot-table-style-adrm branch 2 times, most recently from cb9ce4a to ed35656 Compare November 20, 2025 07:31
This commit introducing cell animations added an option
`skipCellGridLines` to the rendering boxes. The option allows to
skip drawing grid lines for specific cells.

This commit changes this rendering box option into a standard cell
style option, so it can be used in other parts of the codebase as well.

Task: 4552232
With this commit, the cell background are now drawn totally covering
the grid lines. It's way prettier for table/pivots to have an uniform
background color without grid lines breaking it.

The downside is we cannot draw the hover overlay with a color alpha,
because it would overlap with the next cell, making a darker color
at the border. We can workaround by merging the colors programmatically
and avoid drawing with alpha.

Task: 4552232
With this commit, we don't need to manually create a dynamic table
to a pivot to have a style applied. Instead we can add a style in the
pivot definition, and dynamic tables will automatically be created on
the dynamic pivot formulas.

Those new pivot styles are better than traditional tables styles because:
- they are directly linked to the pivot, taking into account the
number of headers, the presence of totals, etc.
- they are automatically added on `=PIVOT()` formulas, without the need to
create a dynamic table first.
- they are more powerful than the old table styles, they can have a
style for the sub-headers, the measure headers, etc.

Task: 4552232
@hokolomopo hokolomopo force-pushed the master-pivot-table-style-adrm branch from ed35656 to 63cb270 Compare November 20, 2025 09:03
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.

3 participants