-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
feat: adds resizable columns #490
Conversation
className="mantine-datatable-header-resizable-knob" | ||
style={{ | ||
right: rem(deltaX), | ||
//backgroundColor: 'orange', |
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.
I assume this was there for testing, right?
I'm thinking It may be a good idea, though, to provide some visual feedback to the user as to give a clue that a column is resizable.
Perhaps we could indeed slightly change its background color on hover, to a semi-transparent Mantine active color? I believe there's a CSS var for that, I'll have a look.
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.
I assume this was there for testing, right?
yep, sorry, I forgot to delete it 😉
I was thinking the same thing too. Feel free to do some tests, and the idea of the hover might work 👍
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.
No need to be sorry. Seeing this actually triggered me to thnk about the visual feedback 😉
Outstanding work, thanks a lot! I have another minor suggestion: maybe we could make the "knob" a bit wider? I think 2px is a bit too narrow and can be difficult to target with a less-precise mouse. Perhaps we could make it 4 or 5px and place it over the column border... I'll investigate this a bit further. I completely agree with your suggestion to rename the |
Thank you
yes, I agree. In fact, during development, I had to manage the table with and without borders. In CSS, when the table has no borders, the 'knob' is actually thicker.
awesome 😉 |
@@ -105,6 +106,9 @@ export const DataTableHeader = forwardRef(function DataTableHeader<T>( | |||
sortable={sortable} | |||
draggable={draggable} | |||
toggleable={toggleable} | |||
// we won't display the resize handle for the last 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.
Good thinking here!
…er related components
This looks good enough for me now. I've renamed the components as you suggested and deprecated the old I also changed a bit the CSS to improve the visual feedback, but of course, I may be subjective. Please let me know what you think. |
sounds good to me 👍 |
From one side, a rename is a breaking change, however, since this new feature is relatively young, maybe it is enough to rename the hook without creating a new one with the working. |
I did create the new one named mantine-datatable/package/hooks/useDataTableColumns.ts Lines 136 to 140 in 4c6d45f
This way there's no significant bundle size impact, and we'll remove it at some point later. |
Thanks a lot, again, for your effort! Would you mind terribly if I'd send you a collaborator invitation to the repo at some point in the near future - in other words, add you as a co-maintainer? All in all, it's a nice part-time job - perks include:
What do you think? 😁 Joking aside, I was curious, do you use Mantine & DataTable internally at namecheap? And if so, do you need help with it? Feel free to drop me a line at the email address listed in my profile if you want. |
First of all, thank you for the wonderful, useful, and beautiful DataTable that has allowed me to create several applications without any problem. 👏 Currently, we are using both Mantine and your Mantine DataTable for an internal application (in Namecheap) that is not visible externally. Unfortunately, due to time constraints, we have not yet migrated to v7, which is planned for 2024. As you mentioned, open-source should be supported, if possible financially, otherwise, as I have done, with ingenuity. btw, I wanted to wish you a wonderful Christmas and a fantastic 2024 to you and your loved ones 🍾 Thank you again for your passionate work 😉 |
Thanks a lot!
Would it be ok, then, if I add a logo/link to Namecheap in the docs website footer where I list companies/projects using Mantine DataTable? 🙏 This would help the project a lot, as it encourages people to give it a shot. And it should also help Namecheap with some traffic too. Wonderful Christmas to you as well! 🍾 |
I think so, but let me ask our department to be sure 😉. I'll let you know asap |
@icflorescu Good news! It would be nice if you mentioned the product we developed using Mantine and Mantine DataTable. The product is called EasyWP, here are some useful links below. |
Will do, thanks! |
@icflorescu In this PR, I added the ability to resize one or more columns.
Currently, I used the same provider and hook used for dragging and toggling. I'm not sure if this is okay in terms of style.
Of course, it would be possible to rename the context/provider, for example, to
DataTableDragToggleResizeColumnsProvider
orDataTableColumnsProvider
.The issue is with the
useDragToggleColumns
hook, as it is public and indicated in the documentation. For compatibility reasons, a new one should be created, such asuseDataTableColumns
, and the previous one should be deprecated (with a console warning).Anyway, let me know what you think