o-spreadsheet icon indicating copy to clipboard operation
o-spreadsheet copied to clipboard

[REF] headers: use ranges inside headers plugins

Open hokolomopo opened this issue 2 years ago • 1 comments

Before, the plugins header_sizes and header_visibility were updating their data "by hand" when handling commands such as ADD_COLUMNS_ROWS.

This commit introduce a HeaderMap object that handle all the grid changes automatically using ranges.

There a problem with the command MOVE_RANGES:

  • when inserting/deleting cell, we handle this with a CUT that will dispatch a MOVE_RANGES. This made the ranges of our HeaderMap move when we didn't wanted them to.

Solve this problem by returning the command that resulted in the changes in adaptRanges, and ignoring changes that were coming from a MOVE_RANGES.

Notes :

Not sure we really wan adaptRanges to return the command as well as the changed range. I'm not sure how else to fix the problem. Maybe there is 2 different concept that I bundle in Range, but I'm not too sure what's really different about them. We should brainstorm sometimes.

Odoo task ID : 2889911

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 (_lt("qmsdf %s", abc))
  • [ ] unit tested
  • [ ] clean commented code
  • [ ] track breaking changes
  • [ ] doc is rebuild (npm run doc)
  • [ ] status is correct in Odoo

hokolomopo avatar Jun 21 '22 12:06 hokolomopo