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] highlight: add drag & drop to array formula highlight #4083

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

hokolomopo
Copy link
Contributor

@hokolomopo hokolomopo commented Apr 16, 2024

[IMP] highlight: add drag & drop to array formula highlight

With this commit, it is now possible to drag & drop an array formula
by clicking on its highlight.

[IMP] highlight: improve border hitbox

The hitbox for the borders of the highlight was not very well placed.
There was some margins computations, I'm assuming they were there
to avoid overlapping with the highlight corners but they we both
wrong (there was overlap) and useless (the corner is above the border).

The highlight border was also not centered on the cell border, and
was quite small, making it hard to click.

This commit removed the "margins", and widened and centered the borders.

[REF] highlight: rename Highlight component:

The component that handle highlight's UI interactions is named
Highlight, which is the same as the type Highlight. This is annoying
because we always end up importing the wrong Highlight, and need
named imports if we want to use both the type and the component in a
file.

This commit renames the component to HighlightOverlay

Task: : 3869873

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

@hokolomopo hokolomopo changed the title Master drag and drop array formula adrm [IMP] highlight: add drag & drop to array formula highlight Apr 16, 2024
@robodoo
Copy link
Collaborator

robodoo commented Apr 16, 2024

@hokolomopo hokolomopo force-pushed the master-drag-and-drop-array-formula-adrm branch 2 times, most recently from 31b24ba to 352822f Compare April 16, 2024 11:08
We sometime need to create a UI plugin specifically to handle a command
so that its sub-commands are batched in a single history step.

This is kind of a problem when working with stores, because then we
need both a store to handle all the business logic, and a plugin that
handle a command created specifically to batch sub-commands (looking
at you find & replace).

We can fix that easily by creating a local command `BATCH_COMMANDS`
that take a callback as argument, and that batches every command
and sub-command executed in the callback within one history step.

Task: 3870119
Now that we can batch commands, the plugin find & replace
is now useless.

Task: 3870119
The component that handle highlight's UI interactions is named
`Highlight`, which is the same as the type `Highlight`. This is annoying
because we always end up importing the wrong `Highlight`, and need
named imports if we want to use both the type and the component in a
file.

This commit renames the component to `HighlightOverlay`

Task: 3869873
The hitbox for the borders of the highlight was not very well placed.
There was some margins computations, I'm assuming they were there
to avoid overlapping with the highlight corners but they were both
wrong (there was overlap) and useless (the corner is above the border).

The highlight border was also not centered on the cell border, and
was quite small, making it hard to click.

This commit removed the "margins", and widened and centered the borders.

Task: 3869873
With this commit, it is now possible to drag & drop an array formula
by clicking on its highlight.

Task 3869873
@hokolomopo hokolomopo force-pushed the master-drag-and-drop-array-formula-adrm branch from 352822f to e050917 Compare April 16, 2024 11:09
@@ -353,7 +353,7 @@ function constructZonesFromProfiles(
pendingZones = nextPendingZones;
}
mergedZone.push(...pendingZones);
return mergedZone;
return mergedZone as T[];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really happy about that but it's mighty annoying to type...

The rationale is that, as far as I know, calling recomputeZones on only Zones (and no unbounded zones) will always return Zones. So it'd be nice if it was typed as such.

The fact that it's typed as returning UnboundedZones make it very annoying to use for simple cases where we only handle zones. Do you have any good ideas @laa-odoo ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Indeed, this is never supposed to happen: recompute non-UnboundedZones will always give non-UnBoundedZones
But it will also be complicated to type the mechanics of recomputeZone.... The best would be to force the typing within recomputeZone itself so that it doesn't bother anyone. (
imo I am for)

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.

None yet

3 participants