Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] pivot: add icon to sort pivot #5363

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hokolomopo
Copy link
Contributor

Description:

description of this task, what is implemented and why it is implemented that way.

Task: 4281154

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 Dec 17, 2024

Pull request status dashboard

@hokolomopo hokolomopo force-pushed the master-pivot-sort-icon-adrm branch from ef48607 to 94c776d Compare January 6, 2025 13:53
Comment on lines +20 to +35
this.store.addIconProvider({
component: FilterIcon,
hasIcon: (getters, cellPosition) => getters.isFilterHeader(cellPosition),
type: "rightIcon",
});
this.store.addIconProvider({
component: DataValidationCheckbox,
hasIcon: (getters, cellPosition) => getters.isCellValidCheckbox(cellPosition),
type: "exclusiveIcon",
});
this.store.addIconProvider({
component: DataValidationListIcon,
hasIcon: (getters, cellPosition) =>
!getters.isReadonly() && getters.cellHasListDataValidationIcon(cellPosition),
type: "rightIcon",
});
Copy link
Contributor Author

@hokolomopo hokolomopo Jan 6, 2025

Choose a reason for hiding this comment

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

Having the overlay having to register its own providers is not the best, ideally it shouldn't have to know about them ... But we need to register them somewhere (in a component) 🤷

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can have a register of icon providers somewhere and then the overlay can add all of the entries of this register in the store ?

Since 18.1, we can sort the pivot on any column. But the feature is
only discoverable through the context menu of pivot cells. With this
commit, we display icons that sort a pivot when its side panel is open.

The icons are that were previously displayed in the `FilterOverlay`
and the `DataValidationOverlay` are now displayed in the
`GridCellIconOverlay`. This overlay is based on a store where we can
register icon providers.

The auto-resize feature also had to be transformed into a store since
it depends on the grid icons.

Task: 4281154
@hokolomopo hokolomopo force-pushed the master-pivot-sort-icon-adrm branch from 94c776d to 6f99bcf Compare January 6, 2025 14:17
Comment on lines +20 to +35
this.store.addIconProvider({
component: FilterIcon,
hasIcon: (getters, cellPosition) => getters.isFilterHeader(cellPosition),
type: "rightIcon",
});
this.store.addIconProvider({
component: DataValidationCheckbox,
hasIcon: (getters, cellPosition) => getters.isCellValidCheckbox(cellPosition),
type: "exclusiveIcon",
});
this.store.addIconProvider({
component: DataValidationListIcon,
hasIcon: (getters, cellPosition) =>
!getters.isReadonly() && getters.cellHasListDataValidationIcon(cellPosition),
type: "rightIcon",
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can have a register of icon providers somewhere and then the overlay can add all of the entries of this register in the store ?

this.model.dispatch("RESIZE_COLUMNS_ROWS", {
elements: [row],
dimension: "ROW",
size: null,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't we compute the size according to the content, as done for the columns ?

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