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] styles: add support of indentation #4425

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

Conversation

pro-odoo
Copy link
Collaborator

This commit adds the support of indentation. Import and export of indentation from xlsx is also supported.

Task: 3984459

Description:

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

Task: : TASK_ID

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 Jun 11, 2024

Pull request status dashboard

This commit adds the support of indentation. Import and export of
indentation from xlsx is also supported.

Task: 3984459
Copy link
Contributor

@hokolomopo hokolomopo left a comment

Choose a reason for hiding this comment

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

More features 🥳 Is the next step to allow evaluation to return style ? I didn't follow the conversation on how he want to handle the indent in the pivots 😅

I added some testing notes in the task's pad

@@ -74,6 +74,11 @@ export const demoData = {
F2: { style: 5, content: "italic blablah" },
F3: { style: 6, content: "strikethrough" },
F4: { style: 7, content: "underline" },
F16: { content: "Indent 0" },
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick & personal opinion: I think the first demo sheet is cluttered enough, I'm not a fan of adding things in the middle. How about adding them below existing data instead ?

Comment on lines +110 to +115
case "SET_FORMATTING":
const hasStyle = "style" in cmd;
if (hasStyle && cmd.style?.indent && cmd.style.indent < 0) {
return CommandResult.IndentLevelError;
}
return CommandResult.Success;
Copy link
Contributor

Choose a reason for hiding this comment

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

We can use checkIncorrectIndentLevel no ?

@@ -1315,6 +1315,22 @@ describe("Menu Item actions", () => {
});
});

test("Format -> indentation", () => {
doAction(["format", "format_increase_indent"], env);
expect(dispatch).toHaveBeenCalledWith("SET_FORMATTING", {
Copy link
Contributor

Choose a reason for hiding this comment

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

Lucas-sensei once told be that it was better to check the effect of the menu item in the sheet, rather than checking that a command was dispatched 🤓

@@ -75,6 +75,7 @@ const simpleData = {
A38: { content: `='<Sheet2>'!B2` },
A39: { content: `=A39` },
A40: { content: `=(1+2)/3` },
A41: { content: `Indented text`, style: 12 },
Copy link
Contributor

Choose a reason for hiding this comment

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

The commit says that the xlsx import works. I don't think I saw it implemented ? Or at least it's not tested

@@ -713,7 +722,7 @@ export class GridRenderer {
return box;
}

private getGridBoxes(): Box[] {
private getGridBoxes(renderingContext: GridRenderingContext): Box[] {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm pretty sure someone once told me that we wanted to keep the creation of grid boxes independant from the ctx. Was it @rrahir ?

We could easily have the indent be fontsize * randomConstant, rather to bother having to measure space characters with the context

@@ -399,6 +399,15 @@ topbarMenuRegistry
...ACTION_FORMAT.formatWrappingClip,
sequence: 30,
})
.addChild("format_increase_indent", ["format"], {
...ACTION_FORMAT.styleIncreaseIndent,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd swap the entries, I feel like the button to indent (translate text to the right) shoudlbe at the right (& vice versa)

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.

4 participants