odoo/o-spreadsheet#4638

Created by BI, Adrien Minne (adrm)
Merged at 33c82be44380152599200c13d790d2f895ad76a3

Statuses:

label
odoo:master-standalone-composer-adrm
head
87c2a235dbce0cdbbd6aaafb1c66354eff5d7c7f
merged
3 months ago by BI, Pierre Rousseau (pro)
odoo/o-spreadsheet
master #4638

[IMP] composer: add standalone composer in CF panel

Description:

[BLUR] stop composition on blur - this commit kinda sucks

ATM the composer do not lose the DOM focus if the composer is blurred.
At the next render, the composer will take back the DOM focus and
continue the edition.

This is fine for the grid/topbar composer, but it really sucks for a
standalone composer in the side panel. After editing the composer, click
on the button save of the panel ? Fat luck, you didn't actually confirm
the composer so you don't have the changes. Click on another input ?
Yeah you didn't confirm either. And at the next render, the focus will
randomly leave your input to go back to the composer.

I think functionnaly we really need to stop the composition on blur event.
But some blur events are expected by the composer: if the user click
on the grid on on another sheet to select a range, the composer will
receive a blur event but it should not stop the composition.

I don't have a very good idea to handle those cases. The
implementation I did seems to work but is not a very good design, we just check
the relatedTarget of the blur event (the new focused element) and if it's
"o-sheet" or "o-grid" we put the focus back on the composer.

[IMP] composer: add standalone composer

This commits adds a new type of composer that is standalone and is not
linked to a specific cell. All the inputs that accept formulas in the
CF side panel are now using this new composer.

[REF] composer: rename ComposerStore to CellComposerStore

Task: : 4045550

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

  1. https://github.com/odoo/odoo/blob/8346b2a7561c178fd7e9f9d1fbd7dac3e3843fd1/addons/account/models/account_move.py#L912 ↩↩↩↩

  2. https://github.com/odoo/odoo/blob/8346b2a7561c178fd7e9f9d1fbd7dac3e3843fd1/addons/account/models/account_move.py#L896-L912 ↩↩↩

  3. https://docs.python.org/3/library/logging.handlers.html#logging.StreamHandler ↩