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

Allow grouped table headers #769

Merged
merged 6 commits into from
Sep 21, 2023
Merged

Conversation

federico-ercoles
Copy link
Member

@federico-ercoles federico-ercoles commented Sep 14, 2023

This PR adds support for grouped headers. The following options for simple headers are available:

  • left-side stickiness: if a header group has sticky: "left", the whole group will be sticky, stickiness on singular columns will be ignored
  • header stickiness
  • label alignment
  • hints

Comment on lines 84 to 87
type Props<
C extends ReadonlyArray<SimpleColumnType<string, {}, any>>,
D extends ReadonlyArray<GroupedColumnType<string, {}, any>>
> = {
Copy link
Member Author

Choose a reason for hiding this comment

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

@gabro I think this makes the PR breaking, but I'm not sure. What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

The types are 99% of the times inferred, so I would ignore it

Comment on lines 84 to 87
type Props<
C extends ReadonlyArray<SimpleColumnType<string, {}, any>>,
D extends ReadonlyArray<GroupedColumnType<string, {}, any>>
> = {
Copy link
Member

Choose a reason for hiding this comment

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

The types are 99% of the times inferred, so I would ignore it

[columns, headerGroups]
headerGroups[0].headers
.filter((h) => h.sticky)
.flatMap((h) => h.columns || [h])
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.flatMap((h) => h.columns || [h])
.flatMap((h) => h.columns ?? [h])

}}
lastLeftSticky={
header.columns
? header.id === stickyLeftColumnGroupsIds[stickyLeftColumnGroupsIds.length - 1]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
? header.id === stickyLeftColumnGroupsIds[stickyLeftColumnGroupsIds.length - 1]
? header.id === stickyLeftColumnGroupsIds.at(-1)

🪄

@federico-ercoles
Copy link
Member Author

Approved offline

@federico-ercoles federico-ercoles merged commit 7922fe3 into main Sep 21, 2023
1 check passed
@federico-ercoles federico-ercoles deleted the allow_grouped_table_headers branch September 21, 2023 14:49
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.

2 participants