-
-
Notifications
You must be signed in to change notification settings - Fork 337
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
Add ability to add table columns #540
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @pegnott, the add column functionality looks good! :)
I have some review comments, but most are minor and convention based.
{#each columns.data as column, i (column.name)} | ||
<div | ||
bind:this={resizerRefs[i]} | ||
on:mouseenter={(e) => showResizerForColumn(e, column)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes the resizer instance from column to column.
Currently, this logic leads to errors and unexpected behaviour while trying to resize columns.
Issues with resizing columns - Watch Video
Once we have an action for the movable package, it might be better to:
- create a separate column cell component, and handle the resizing logic within it.
- save the column size while resizing instead of waiting until resize completes
- create the resize instance on column component mount instead of during mouseover, and destroy the resize instance during component destroy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good afternoon. I have addressed the requested changes as follows:
-
create a separate column cell component, and handle the resizing logic within it.
(https://github.com/pegnott/mathesar/blob/307418dcc4344b3c9b7d937cc21a0b84e2f360c2/mathesar_ui/src/sections/table-view/HeaderCell.svelte) -
save the column size while resizing instead of waiting until resize completes (https://github.com/pegnott/mathesar/blob/307418dcc4344b3c9b7d937cc21a0b84e2f360c2/mathesar_ui/src/components/common/actions/moveable.ts#L44-L47)
-
create the resize instance on column component mount instead of during mouseover (https://github.com/pegnott/mathesar/blob/307418dcc4344b3c9b7d937cc21a0b84e2f360c2/mathesar_ui/src/components/common/actions/moveable.ts#L42)
-
destroy the resize instance during component destroy (https://github.com/pegnott/mathesar/blob/307418dcc4344b3c9b7d937cc21a0b84e2f360c2/mathesar_ui/src/components/common/actions/moveable.ts#L35)
@pegnott The add column functionality looks good to me! Thanks! Resizing columns do not seem stable. I have added a few review comments on it. |
@pegnott, I'm testing column resizing in Firefox, and it still seems doesn't seem to be stable. Some of the previously mentioned issues in the video still persist. It is also breaking the grouping feature. Since the resize feature is blocking the add column feature, I think it's best if we split them both up, as separate PRs. Once they are separate PRs, we could merge the add column feature early, since there are other contributors working on columns and it may have a lot of conflicts if we wait longer. The resize feature will need to be stabilized, and I assume it will take more rounds of review, and it is not an immediate priority. |
@kgodey @pegnott My suggestion would be to create a new branch from the last commit for 'adding a new column', and raise a PR from that branch. I assume there weren't additional changes with respect to column addition, after starting work on column resizing feature. If there were, we could do them as new commits on top of the created branch. |
Good evening - am looking at best strategy to split this PR up now, will follow up with any status/questions/etc. |
Thanks @pegnott! |
@pegnott Thank you so much for splitting the PRs. This looks great! I have approved the changes. I am currently half way through #651, which refactors a lot of areas this PR touches. I am blocking this PR, until that is merged. Once the changes for the refactor is merged, I'll add an additional commit to this PR, and merge this. @kgodey I hope this is okay. |
@pavish that's fine, thanks for the update! |
@kgodey I've added additional commits to handle merge conflicts with the refactor. I'm going to go ahead and merge this, since this was previously reviewed. Please feel free to add comments and we can take it up as separate issues. @ghislaineguerin This functionality differs quite a bit from the UX. We will have to reevaluate this as well. |
Fixes #495
This code adds functionality to create a new table column.
Resizing is in progress and coming soon
Technical details
Added addColumn function to TableData.ts to post to API
Added ui elements for column add in Header.svelte
Propagate events/data changes in TableView.svelte
Screenshots
New Add Column drop down UI:
Developer Certificate of Origin
Developer Certificate of Origin